@mintlify/msft-sdk 1.1.49 → 1.1.50
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/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js +3 -2
- package/dist/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.js.map +1 -1
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +6 -7
- package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js.map +1 -1
- package/dist/api-playground/EndpointFields/index.js +3 -4
- package/dist/api-playground/EndpointFields/index.js.map +1 -1
- package/dist/components/content-components/latex.js +14 -14
- package/dist/components/content-components/latex.js.map +1 -1
- package/dist/components/toc/index.js +50 -49
- package/dist/components/toc/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
import "@mintlify/validation";
|
|
3
|
+
const r = (t) => t.type === "enum<integer>" || t.type === "enum<number>" || t.type === "enum<string>";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
+
r as isEnum
|
|
5
6
|
};
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.tsx"],"sourcesContent":["\nimport {\n AnySchema,\n BooleanSchema,\n DataSchema,\n DataSchemaArray,\n FileSchema,\n IncrementalDataSchema,\n IncrementalDataSchemaArray,\n NullSchema,\n NumberEnumSchema,\n NumberSchema,\n StringEnumSchema,\n StringSchema,\n} from '@mintlify/validation';\n\nimport { ParamHead } from '@/components/Api/Param';\nimport { cn } from '@/api-playground-2/schemaGraph/utils';\n\nimport { Description } from '../../components/Description';\nimport { ExampleDescription } from '../ExampleDescription';\nimport { EnumConstTable, EnumOptions } from './Enum';\nimport { NumberMetadata } from './NumberMetadata';\nimport { StringMetadata } from './StringMetadata';\nimport { FieldType } from '@/api-playground-2/types/api';\n\nexport type PrimitiveParamFieldParams = {\n fieldType: FieldType;\n schema:\n | BooleanSchema\n | StringSchema\n | NumberSchema\n | StringEnumSchema\n | NumberEnumSchema\n | FileSchema\n | NullSchema\n | AnySchema;\n schemaArray?: DataSchemaArray | IncrementalDataSchemaArray;\n typeOptions: string[];\n name?: string | null;\n location?: string;\n selectedIndex?: number;\n onSelectTypeOption?: (index: number) => void;\n parentName?: string;\n paramId?: string;\n style?: string;\n explode?: boolean;\n};\n\nexport const PrimitiveParamField = ({\n fieldType,\n schema,\n schemaArray,\n name,\n location,\n typeOptions,\n selectedIndex,\n onSelectTypeOption,\n parentName,\n paramId,\n style,\n explode,\n}: PrimitiveParamFieldParams) => {\n const typeLabel = typeOptions[selectedIndex ?? 0];\n\n const description =\n schema.description ??\n (name === undefined ? `The ${fieldType} is of type \\`${typeLabel}\\`.` : undefined);\n\n return (\n <div className=\"mint:py-6\">\n <ParamHead\n id={paramId}\n name={name}\n typeLabel={typeLabel}\n location={location}\n fieldType={fieldType}\n required={schema.required}\n deprecated={schema.deprecated}\n defaultValue={schema.default}\n typeOptions={typeOptions}\n selectedTypeOptionIndex={selectedIndex}\n onSelectTypeOption={onSelectTypeOption}\n parentName={parentName}\n style={style}\n explode={explode}\n />\n <div className={cn({ 'mint:mt-4': description || isEnum(schema) })}>\n {description && <Description markdown={description} />}\n {schemaArray && isEnumWithConsts(schemaArray) ? (\n <EnumConstTable schemaArray={schemaArray} />\n ) : (\n isEnum(schema) && <EnumOptions schema={schema} />\n )}\n {isStringSchema(schema) && <StringMetadata schema={schema} description={description} />}\n {isNumberSchema(schema) && <NumberMetadata schema={schema} />}\n <ExampleDescription schema={schema} />\n </div>\n </div>\n );\n};\n\nexport const isEnum = (\n schema: DataSchema | IncrementalDataSchema\n): schema is NumberEnumSchema | StringEnumSchema => {\n return (\n schema.type === 'enum<integer>' ||\n schema.type === 'enum<number>' ||\n schema.type === 'enum<string>'\n );\n};\n\nexport const isEnumWithConsts = (\n schemaArray?: DataSchemaArray | IncrementalDataSchemaArray\n): boolean => {\n if (!schemaArray) return false;\n return schemaArray.some((schema) => isEnum(schema) && 'const' in schema);\n};\n\nconst isStringSchema = (schema: DataSchema | IncrementalDataSchema): schema is StringSchema => {\n return schema.type === 'string';\n};\n\nconst isNumberSchema = (schema: DataSchema | IncrementalDataSchema): schema is NumberSchema => {\n return schema.type === 'number' || schema.type === 'integer';\n};\n"],"names":["isEnum","schema"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/api-playground/EndpointFields/ParamFields/PrimitiveParamField/index.tsx"],"sourcesContent":["\nimport {\n AnySchema,\n BooleanSchema,\n DataSchema,\n DataSchemaArray,\n FileSchema,\n IncrementalDataSchema,\n IncrementalDataSchemaArray,\n NullSchema,\n NumberEnumSchema,\n NumberSchema,\n StringEnumSchema,\n StringSchema,\n} from '@mintlify/validation';\n\nimport { ParamHead } from '@/components/Api/Param';\nimport { cn } from '@/api-playground-2/schemaGraph/utils';\n\nimport { Description } from '../../components/Description';\nimport { ExampleDescription } from '../ExampleDescription';\nimport { EnumConstTable, EnumOptions } from './Enum';\nimport { NumberMetadata } from './NumberMetadata';\nimport { StringMetadata } from './StringMetadata';\nimport { FieldType } from '@/api-playground-2/types/api';\n\nexport type PrimitiveParamFieldParams = {\n fieldType: FieldType;\n schema:\n | BooleanSchema\n | StringSchema\n | NumberSchema\n | StringEnumSchema\n | NumberEnumSchema\n | FileSchema\n | NullSchema\n | AnySchema;\n schemaArray?: DataSchemaArray | IncrementalDataSchemaArray;\n typeOptions: string[];\n name?: string | null;\n location?: string;\n selectedIndex?: number;\n onSelectTypeOption?: (index: number) => void;\n parentName?: string;\n paramId?: string;\n style?: string;\n explode?: boolean;\n};\n\nexport const PrimitiveParamField = ({\n fieldType,\n schema,\n schemaArray,\n name,\n location,\n typeOptions,\n selectedIndex,\n onSelectTypeOption,\n parentName,\n paramId,\n style,\n explode,\n}: PrimitiveParamFieldParams) => {\n const typeLabel = typeOptions[selectedIndex ?? 0];\n\n const description =\n schema.description ??\n (name === undefined ? `The ${fieldType} is of type \\`${typeLabel}\\`.` : undefined);\n\n return (\n <div className=\"mint:py-6\">\n <ParamHead\n id={paramId}\n name={name}\n typeLabel={typeLabel}\n location={location}\n fieldType={fieldType}\n required={schema.required}\n deprecated={schema.deprecated}\n defaultValue={schema.default}\n typeOptions={typeOptions}\n selectedTypeOptionIndex={selectedIndex}\n onSelectTypeOption={onSelectTypeOption}\n parentName={parentName}\n style={style}\n explode={explode}\n />\n <div className={cn({ 'mint:mt-4': description || isEnum(schema) })}>\n {description && <Description markdown={description} />}\n {schemaArray && isEnumWithConsts(schemaArray) ? (\n <EnumConstTable schemaArray={schemaArray} />\n ) : (\n isEnum(schema) && <EnumOptions schema={schema} />\n )}\n {isStringSchema(schema) && <StringMetadata schema={schema} description={description} />}\n {isNumberSchema(schema) && <NumberMetadata schema={schema} />}\n <ExampleDescription schema={schema} />\n </div>\n </div>\n );\n};\n\nexport const isEnum = (\n schema: DataSchema | IncrementalDataSchema\n): schema is NumberEnumSchema | StringEnumSchema => {\n return (\n schema.type === 'enum<integer>' ||\n schema.type === 'enum<number>' ||\n schema.type === 'enum<string>'\n );\n};\n\nexport const isEnumWithConsts = (\n schemaArray?: DataSchemaArray | IncrementalDataSchemaArray\n): boolean => {\n if (!schemaArray) return false;\n return schemaArray.some((schema) => isEnum(schema) && 'const' in schema);\n};\n\nconst isStringSchema = (schema: DataSchema | IncrementalDataSchema): schema is StringSchema => {\n return schema.type === 'string';\n};\n\nconst isNumberSchema = (schema: DataSchema | IncrementalDataSchema): schema is NumberSchema => {\n return schema.type === 'number' || schema.type === 'integer';\n};\n"],"names":["isEnum","schema"],"mappings":";;AAsGO,MAAMA,IAAS,CACpBC,MAGEA,EAAO,SAAS,mBAChBA,EAAO,SAAS,kBAChBA,EAAO,SAAS;"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`${r ? `${r}-` : ""}${e ? `${e}-` : ""}${t || ""}-`,
|
|
2
|
+
import $ from "@sindresorhus/slugify";
|
|
3
|
+
const c = (r, e, t, i) => $(
|
|
4
|
+
`${r ? `${r}-` : ""}${t ? `${t}-` : ""}${e || ""}-`,
|
|
6
5
|
{
|
|
7
6
|
decamelize: !0
|
|
8
7
|
}
|
|
9
|
-
),
|
|
8
|
+
), s = (r, e) => r ? `${e ? `${e}` : ""}${r}.` : "";
|
|
10
9
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
c as buildRecursiveParamFieldId,
|
|
11
|
+
s as getRecursiveParentName
|
|
13
12
|
};
|
|
14
13
|
//# sourceMappingURL=RecursiveParamField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecursiveParamField.js","sources":["../../../../src/api-playground/EndpointFields/ParamFields/RecursiveParamField.tsx"],"sourcesContent":["\nimport { DataSchema, DataSchemaArray, IncrementalDataSchemaArray } from '@mintlify/validation';\nimport slugify from '@sindresorhus/slugify';\n\nimport { useEndpointLocation } from '@/contexts/EndpointLocationContext';\nimport { getConstFilteredSchemaArray } from '@/openapi/filterEnums';\nimport {\n getAuthFilteredSchemaArray,\n isDataSchemaArrayOrIncrementalDataSchemaArray,\n} from '@/openapi/getAuthFilteredSchemaArray';\nimport { getNextPropertiesByType } from '@/utils/api-reference/getNextPropertiesByType';\n\nimport { RecursiveParamFieldWithChildrenObserver } from './RecursiveParamFieldWithChildrenObserver';\nimport { RecursiveParamFieldWithObserver } from './RecursiveParamFieldWithObserver';\nimport { FieldType, RenderedRefs } from '@/api-playground-2/types/api';\n\nexport type RecursiveParamFieldParams = {\n fieldType: FieldType;\n schemaArray: DataSchemaArray | IncrementalDataSchemaArray;\n renderedRefs?: RenderedRefs;\n name?: string | null;\n location?: string;\n parentName?: string;\n depth?: number;\n hideDescription?: boolean;\n circularRefs?: string[];\n paramId?: string;\n style?: string;\n explode?: boolean;\n};\n\nexport const RecursiveParamField = ({\n fieldType,\n schemaArray,\n name,\n location,\n parentName,\n depth = 0,\n hideDescription = false,\n renderedRefs = new Set(),\n circularRefs,\n paramId,\n style,\n explode,\n}: RecursiveParamFieldParams) => {\n const { anchor } = useEndpointLocation();\n let filteredSchemaArray: DataSchemaArray | IncrementalDataSchemaArray | null = schemaArray;\n filteredSchemaArray = getAuthFilteredSchemaArray({ schemaArray, userGroups: undefined });\n\n if (\n filteredSchemaArray &&\n filteredSchemaArray.some((schema) => 'enum' in schema && 'const' in schema)\n ) {\n filteredSchemaArray = getConstFilteredSchemaArray({ schemaArray });\n }\n\n if (!isDataSchemaArrayOrIncrementalDataSchemaArray(filteredSchemaArray)) {\n return null;\n }\n\n const RecursiveParamFieldType = anchor\n ? RecursiveParamFieldWithChildrenObserver\n : RecursiveParamFieldWithObserver;\n\n return (\n <RecursiveParamFieldType\n fieldType={fieldType}\n schemaArray={filteredSchemaArray}\n name={name}\n location={location}\n parentName={parentName}\n depth={depth}\n style={style}\n explode={explode}\n hideDescription={hideDescription}\n renderedRefs={renderedRefs}\n circularRefs={circularRefs}\n paramId={paramId}\n />\n );\n};\n\ntype RenderNextPropertiesRecursivelyParams = {\n properties: [string, DataSchemaArray | IncrementalDataSchemaArray][];\n fieldType: FieldType;\n depth: number;\n refs: Set<string>;\n parentName?: string;\n name?: string | null;\n currentSchemaRef: string | undefined;\n style?: string;\n explode?: boolean;\n hideParentName?: boolean;\n};\n\nexport const renderNextPropertiesRecursively = ({\n currentSchemaRef,\n properties,\n fieldType,\n parentName,\n name,\n depth,\n refs,\n style,\n explode,\n hideParentName,\n}: RenderNextPropertiesRecursivelyParams) => {\n // Create a new set with the current refs for this level\n const currentLevelRefs = new Set(refs);\n\n if (currentSchemaRef) {\n currentLevelRefs.add(currentSchemaRef);\n }\n\n if (currentLevelRefs.size > 0) {\n return properties.map((property) => {\n const [propertyName, schemaArray] = property;\n const nextSchemaArray = schemaArray[0];\n const nextSchemaArrayProperties = getNextPropertiesByType(nextSchemaArray);\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName, propertyName);\n const passedName = hideParentName ? '' : name;\n let circularReferences: string[] = [];\n if (\n Object.values(nextSchemaArrayProperties).some(\n (value: unknown) => typeof value === 'string' && currentLevelRefs.has(value)\n )\n ) {\n circularReferences = Object.values(nextSchemaArrayProperties).filter(\n (value: unknown) => typeof value === 'string' && currentLevelRefs.has(value)\n );\n }\n return (\n <RecursiveParamField\n paramId={paramId}\n fieldType={fieldType}\n key={propertyName}\n schemaArray={schemaArray}\n name={propertyName}\n parentName={\n style === 'deepObject' && explode\n ? getDeepObjectParentName(passedName, parentName)\n : getRecursiveParentName(passedName, parentName)\n }\n depth={depth + 1}\n renderedRefs={new Set(currentLevelRefs)}\n circularRefs={circularReferences}\n style={style}\n explode={explode}\n />\n );\n });\n } else {\n return properties.map(([propertyName, schemaArray]) => {\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName, propertyName);\n const passedName = hideParentName ? '' : name;\n return (\n <RecursiveParamField\n paramId={paramId}\n fieldType={fieldType}\n key={propertyName}\n schemaArray={schemaArray}\n name={propertyName}\n parentName={\n style === 'deepObject' && explode\n ? getDeepObjectParentName(passedName, parentName)\n : getRecursiveParentName(passedName, parentName)\n }\n depth={depth + 1}\n renderedRefs={new Set()}\n style={style}\n explode={explode}\n />\n );\n });\n }\n};\n\ntype RenderTruncatedNextPropertiesParams = {\n properties: [string, DataSchemaArray | IncrementalDataSchemaArray][];\n fieldType: FieldType;\n parentName?: string;\n name?: string | null;\n depth: number;\n};\n\nexport const renderTruncatedNextProperties = ({\n properties,\n fieldType,\n parentName,\n name,\n depth,\n}: RenderTruncatedNextPropertiesParams) => {\n return properties.map((property) => {\n const [propertyName, schemaArray] = property;\n const nextSchemaArray = schemaArray[0];\n const baseSchema: DataSchema = nextSchemaArray as DataSchema;\n if (baseSchema.type === 'array') {\n baseSchema.items = [{ type: 'any' }];\n } else if (baseSchema.type === 'object') {\n baseSchema.properties = {};\n }\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName);\n const id = `${paramId}-${propertyName}`;\n return (\n <RecursiveParamField\n fieldType={fieldType}\n key={propertyName}\n schemaArray={[baseSchema]}\n name={propertyName}\n paramId={id}\n depth={depth + 1}\n renderedRefs={new Set()}\n />\n );\n });\n};\n\nexport const buildRecursiveParamFieldId = (\n fieldType: FieldType | undefined,\n name: string | undefined | null,\n parentName: string | undefined,\n propertyName?: string | undefined\n) => {\n return slugify(\n `${fieldType ? `${fieldType}-` : ''}${parentName ? `${parentName}-` : ''}${name ? name : ''}-${propertyName ? propertyName : ''}`,\n {\n decamelize: true,\n }\n );\n};\n\nexport const getRecursiveParentName = (name?: string | null, parentName?: string): string => {\n if (!name) {\n return '';\n }\n\n return `${parentName ? `${parentName}` : ''}${name}.`;\n};\n\nexport const getDeepObjectParentName = (name?: string | null, parentName?: string): string => {\n if (!name) {\n return '';\n }\n\n return parentName ? `${parentName}${name}][` : `${name}[`;\n};\n"],"names":["buildRecursiveParamFieldId","fieldType","name","parentName","propertyName","slugify","getRecursiveParentName"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RecursiveParamField.js","sources":["../../../../src/api-playground/EndpointFields/ParamFields/RecursiveParamField.tsx"],"sourcesContent":["\nimport { DataSchema, DataSchemaArray, IncrementalDataSchemaArray } from '@mintlify/validation';\nimport slugify from '@sindresorhus/slugify';\n\nimport { useEndpointLocation } from '@/contexts/EndpointLocationContext';\nimport { getConstFilteredSchemaArray } from '@/openapi/filterEnums';\nimport {\n getAuthFilteredSchemaArray,\n isDataSchemaArrayOrIncrementalDataSchemaArray,\n} from '@/openapi/getAuthFilteredSchemaArray';\nimport { getNextPropertiesByType } from '@/utils/api-reference/getNextPropertiesByType';\n\nimport { RecursiveParamFieldWithChildrenObserver } from './RecursiveParamFieldWithChildrenObserver';\nimport { RecursiveParamFieldWithObserver } from './RecursiveParamFieldWithObserver';\nimport { FieldType, RenderedRefs } from '@/api-playground-2/types/api';\n\nexport type RecursiveParamFieldParams = {\n fieldType: FieldType;\n schemaArray: DataSchemaArray | IncrementalDataSchemaArray;\n renderedRefs?: RenderedRefs;\n name?: string | null;\n location?: string;\n parentName?: string;\n depth?: number;\n hideDescription?: boolean;\n circularRefs?: string[];\n paramId?: string;\n style?: string;\n explode?: boolean;\n};\n\nexport const RecursiveParamField = ({\n fieldType,\n schemaArray,\n name,\n location,\n parentName,\n depth = 0,\n hideDescription = false,\n renderedRefs = new Set(),\n circularRefs,\n paramId,\n style,\n explode,\n}: RecursiveParamFieldParams) => {\n const { anchor } = useEndpointLocation();\n let filteredSchemaArray: DataSchemaArray | IncrementalDataSchemaArray | null = schemaArray;\n filteredSchemaArray = getAuthFilteredSchemaArray({ schemaArray, userGroups: undefined });\n\n if (\n filteredSchemaArray &&\n filteredSchemaArray.some((schema) => 'enum' in schema && 'const' in schema)\n ) {\n filteredSchemaArray = getConstFilteredSchemaArray({ schemaArray });\n }\n\n if (!isDataSchemaArrayOrIncrementalDataSchemaArray(filteredSchemaArray)) {\n return null;\n }\n\n const RecursiveParamFieldType = anchor\n ? RecursiveParamFieldWithChildrenObserver\n : RecursiveParamFieldWithObserver;\n\n return (\n <RecursiveParamFieldType\n fieldType={fieldType}\n schemaArray={filteredSchemaArray}\n name={name}\n location={location}\n parentName={parentName}\n depth={depth}\n style={style}\n explode={explode}\n hideDescription={hideDescription}\n renderedRefs={renderedRefs}\n circularRefs={circularRefs}\n paramId={paramId}\n />\n );\n};\n\ntype RenderNextPropertiesRecursivelyParams = {\n properties: [string, DataSchemaArray | IncrementalDataSchemaArray][];\n fieldType: FieldType;\n depth: number;\n refs: Set<string>;\n parentName?: string;\n name?: string | null;\n currentSchemaRef: string | undefined;\n style?: string;\n explode?: boolean;\n hideParentName?: boolean;\n};\n\nexport const renderNextPropertiesRecursively = ({\n currentSchemaRef,\n properties,\n fieldType,\n parentName,\n name,\n depth,\n refs,\n style,\n explode,\n hideParentName,\n}: RenderNextPropertiesRecursivelyParams) => {\n // Create a new set with the current refs for this level\n const currentLevelRefs = new Set(refs);\n\n if (currentSchemaRef) {\n currentLevelRefs.add(currentSchemaRef);\n }\n\n if (currentLevelRefs.size > 0) {\n return properties.map((property) => {\n const [propertyName, schemaArray] = property;\n const nextSchemaArray = schemaArray[0];\n const nextSchemaArrayProperties = getNextPropertiesByType(nextSchemaArray);\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName, propertyName);\n const passedName = hideParentName ? '' : name;\n let circularReferences: string[] = [];\n if (\n Object.values(nextSchemaArrayProperties).some(\n (value: unknown) => typeof value === 'string' && currentLevelRefs.has(value)\n )\n ) {\n circularReferences = Object.values(nextSchemaArrayProperties).filter(\n (value: unknown) => typeof value === 'string' && currentLevelRefs.has(value)\n );\n }\n return (\n <RecursiveParamField\n paramId={paramId}\n fieldType={fieldType}\n key={propertyName}\n schemaArray={schemaArray}\n name={propertyName}\n parentName={\n style === 'deepObject' && explode\n ? getDeepObjectParentName(passedName, parentName)\n : getRecursiveParentName(passedName, parentName)\n }\n depth={depth + 1}\n renderedRefs={new Set(currentLevelRefs)}\n circularRefs={circularReferences}\n style={style}\n explode={explode}\n />\n );\n });\n } else {\n return properties.map(([propertyName, schemaArray]) => {\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName, propertyName);\n const passedName = hideParentName ? '' : name;\n return (\n <RecursiveParamField\n paramId={paramId}\n fieldType={fieldType}\n key={propertyName}\n schemaArray={schemaArray}\n name={propertyName}\n parentName={\n style === 'deepObject' && explode\n ? getDeepObjectParentName(passedName, parentName)\n : getRecursiveParentName(passedName, parentName)\n }\n depth={depth + 1}\n renderedRefs={new Set()}\n style={style}\n explode={explode}\n />\n );\n });\n }\n};\n\ntype RenderTruncatedNextPropertiesParams = {\n properties: [string, DataSchemaArray | IncrementalDataSchemaArray][];\n fieldType: FieldType;\n parentName?: string;\n name?: string | null;\n depth: number;\n};\n\nexport const renderTruncatedNextProperties = ({\n properties,\n fieldType,\n parentName,\n name,\n depth,\n}: RenderTruncatedNextPropertiesParams) => {\n return properties.map((property) => {\n const [propertyName, schemaArray] = property;\n const nextSchemaArray = schemaArray[0];\n const baseSchema: DataSchema = nextSchemaArray as DataSchema;\n if (baseSchema.type === 'array') {\n baseSchema.items = [{ type: 'any' }];\n } else if (baseSchema.type === 'object') {\n baseSchema.properties = {};\n }\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName);\n const id = `${paramId}-${propertyName}`;\n return (\n <RecursiveParamField\n fieldType={fieldType}\n key={propertyName}\n schemaArray={[baseSchema]}\n name={propertyName}\n paramId={id}\n depth={depth + 1}\n renderedRefs={new Set()}\n />\n );\n });\n};\n\nexport const buildRecursiveParamFieldId = (\n fieldType: FieldType | undefined,\n name: string | undefined | null,\n parentName: string | undefined,\n propertyName?: string | undefined\n) => {\n return slugify(\n `${fieldType ? `${fieldType}-` : ''}${parentName ? `${parentName}-` : ''}${name ? name : ''}-${propertyName ? propertyName : ''}`,\n {\n decamelize: true,\n }\n );\n};\n\nexport const getRecursiveParentName = (name?: string | null, parentName?: string): string => {\n if (!name) {\n return '';\n }\n\n return `${parentName ? `${parentName}` : ''}${name}.`;\n};\n\nexport const getDeepObjectParentName = (name?: string | null, parentName?: string): string => {\n if (!name) {\n return '';\n }\n\n return parentName ? `${parentName}${name}][` : `${name}[`;\n};\n"],"names":["buildRecursiveParamFieldId","fieldType","name","parentName","propertyName","slugify","getRecursiveParentName"],"mappings":";;AAyNO,MAAMA,IAA6B,CACxCC,GACAC,GACAC,GACAC,MAEOC;AAAA,EACL,GAAGJ,IAAY,GAAGA,CAAS,MAAM,EAAE,GAAGE,IAAa,GAAGA,CAAU,MAAM,EAAE,GAAGD,KAAc,EAAE;AAAA,EAC3F;AAAA,IACE,YAAY;AAAA,EAAA;AACd,GAISI,IAAyB,CAACJ,GAAsBC,MACtDD,IAIE,GAAGC,IAAa,GAAGA,CAAU,KAAK,EAAE,GAAGD,CAAI,MAHzC;"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import "../../
|
|
3
|
-
|
|
4
|
-
const i = () => (t(), null);
|
|
2
|
+
import { useOpenApiEndpoint as n } from "../../hooks/useEndpoint.js";
|
|
3
|
+
const p = () => (n(), null);
|
|
5
4
|
export {
|
|
6
|
-
|
|
5
|
+
p as default
|
|
7
6
|
};
|
|
8
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/api-playground/EndpointFields/index.tsx"],"sourcesContent":["\nimport { EndpointLocationProvider } from '@/contexts/EndpointLocationContext';\nimport { useOpenApiEndpoint } from '@/hooks/useEndpoint';\nimport { getFilteredSecurityOptions } from '@/utils/api-reference/getFilteredSecurityOptions';\n\nimport { EndpointBody } from './EndpointBody';\nimport { EndpointParameters } from './EndpointParameters';\nimport { EndpointResponse } from './EndpointResponse';\nimport { EndpointSecurity } from './EndpointSecurity';\n\nconst EndpointFields = () => {\n const endpoint = useOpenApiEndpoint();\n const newApiReferencePage = true;\n\n if (endpoint === undefined || newApiReferencePage) {\n return null;\n }\n\n // TODO(ronan): remove when all security options are handled (none should be empty)\n const filteredSecurityOptions = getFilteredSecurityOptions(endpoint);\n\n return (\n <>\n {filteredSecurityOptions.length > 0 && (\n <EndpointSecurity securityOptions={filteredSecurityOptions} />\n )}\n <EndpointParameters parameters={endpoint.request.parameters} />\n <EndpointLocationProvider location=\"request\">\n <EndpointBody body={endpoint.request.body} />\n </EndpointLocationProvider>\n <EndpointLocationProvider location=\"response\">\n {Object.entries(endpoint.response)[0] && <EndpointResponse response={endpoint.response} />}\n </EndpointLocationProvider>\n </>\n );\n};\n\nexport default EndpointFields;\n"],"names":["EndpointFields","useOpenApiEndpoint"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/api-playground/EndpointFields/index.tsx"],"sourcesContent":["\nimport { EndpointLocationProvider } from '@/contexts/EndpointLocationContext';\nimport { useOpenApiEndpoint } from '@/hooks/useEndpoint';\nimport { getFilteredSecurityOptions } from '@/utils/api-reference/getFilteredSecurityOptions';\n\nimport { EndpointBody } from './EndpointBody';\nimport { EndpointParameters } from './EndpointParameters';\nimport { EndpointResponse } from './EndpointResponse';\nimport { EndpointSecurity } from './EndpointSecurity';\n\nconst EndpointFields = () => {\n const endpoint = useOpenApiEndpoint();\n const newApiReferencePage = true;\n\n if (endpoint === undefined || newApiReferencePage) {\n return null;\n }\n\n // TODO(ronan): remove when all security options are handled (none should be empty)\n const filteredSecurityOptions = getFilteredSecurityOptions(endpoint);\n\n return (\n <>\n {filteredSecurityOptions.length > 0 && (\n <EndpointSecurity securityOptions={filteredSecurityOptions} />\n )}\n <EndpointParameters parameters={endpoint.request.parameters} />\n <EndpointLocationProvider location=\"request\">\n <EndpointBody body={endpoint.request.body} />\n </EndpointLocationProvider>\n <EndpointLocationProvider location=\"response\">\n {Object.entries(endpoint.response)[0] && <EndpointResponse response={endpoint.response} />}\n </EndpointLocationProvider>\n </>\n );\n};\n\nexport default EndpointFields;\n"],"names":["EndpointFields","useOpenApiEndpoint"],"mappings":";;AAUA,MAAMA,IAAiB,OACJC,EAAA,GAIR;"}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useState as a, useRef as l, useEffect as
|
|
4
|
-
let
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import u from "katex";
|
|
3
|
+
import { useState as a, useRef as l, useEffect as s } from "react";
|
|
4
|
+
let d = !1;
|
|
5
5
|
const m = () => {
|
|
6
|
-
if (
|
|
6
|
+
if (d || typeof document > "u")
|
|
7
7
|
return;
|
|
8
8
|
const e = document.createElement("link");
|
|
9
|
-
e.rel = "stylesheet", e.href = "https://d4tuoctqmanu0.cloudfront.net/katex.min.css", e.integrity = "sha384-Xi8rHCmBmhbuyyhbI88391ZKP2dmfnOl4rT9ZfRI7mLTdk1wblIUnrIq35nqwEvC", e.crossOrigin = "anonymous", document.head.appendChild(e),
|
|
9
|
+
e.rel = "stylesheet", e.href = "https://d4tuoctqmanu0.cloudfront.net/katex.min.css", e.integrity = "sha384-Xi8rHCmBmhbuyyhbI88391ZKP2dmfnOl4rT9ZfRI7mLTdk1wblIUnrIq35nqwEvC", e.crossOrigin = "anonymous", document.head.appendChild(e), d = !0;
|
|
10
10
|
};
|
|
11
|
-
function
|
|
11
|
+
function x({ children: e, latex: t, className: o }) {
|
|
12
12
|
const [n, c] = a(!1), r = l(null);
|
|
13
|
-
return
|
|
13
|
+
return s(() => {
|
|
14
14
|
m(), c(!0);
|
|
15
|
-
}, []),
|
|
15
|
+
}, []), s(() => {
|
|
16
16
|
if (n && r.current)
|
|
17
17
|
try {
|
|
18
|
-
|
|
18
|
+
u.render(t, r.current, {
|
|
19
19
|
displayMode: !0,
|
|
20
20
|
throwOnError: !1
|
|
21
21
|
});
|
|
22
|
-
} catch (
|
|
23
|
-
console.error("KaTeX rendering error:",
|
|
22
|
+
} catch (f) {
|
|
23
|
+
console.error("KaTeX rendering error:", f), r.current && (r.current.textContent = t);
|
|
24
24
|
}
|
|
25
|
-
}, [n, t]), n ? /* @__PURE__ */
|
|
25
|
+
}, [n, t]), n ? /* @__PURE__ */ i("div", { ref: r, id: "mintlify-latex-container", className: o }) : /* @__PURE__ */ i("div", { id: "mintlify-latex-container", className: o, children: e });
|
|
26
26
|
}
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
x as LaTeX
|
|
29
29
|
};
|
|
30
30
|
//# sourceMappingURL=latex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latex.js","sources":["../../../src/components/content-components/latex.tsx"],"sourcesContent":["'use client';\n\nimport katex from 'katex';\nimport React, { useEffect, useState, useRef } from 'react';\n\nlet katexCssLoaded = false;\n\nconst loadKatexCss = () => {\n if (katexCssLoaded || typeof document === 'undefined') {\n return;\n }\n\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = 'https://d4tuoctqmanu0.cloudfront.net/katex.min.css';\n link.integrity = 'sha384-Xi8rHCmBmhbuyyhbI88391ZKP2dmfnOl4rT9ZfRI7mLTdk1wblIUnrIq35nqwEvC';\n link.crossOrigin = 'anonymous';\n document.head.appendChild(link);\n\n katexCssLoaded = true;\n};\n\nexport interface LaTeXProps {\n children: string;\n latex: string;\n className?: string;\n}\n\nexport function LaTeX({ children, latex, className }: LaTeXProps) {\n const [cssLoaded, setCssLoaded] = useState(false);\n const containerRef = useRef<HTMLDivElement>(null);\n
|
|
1
|
+
{"version":3,"file":"latex.js","sources":["../../../src/components/content-components/latex.tsx"],"sourcesContent":["'use client';\n\nimport katex from 'katex';\nimport React, { useEffect, useState, useRef } from 'react';\n\nlet katexCssLoaded = false;\n\nconst loadKatexCss = () => {\n if (katexCssLoaded || typeof document === 'undefined') {\n return;\n }\n\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = 'https://d4tuoctqmanu0.cloudfront.net/katex.min.css';\n link.integrity = 'sha384-Xi8rHCmBmhbuyyhbI88391ZKP2dmfnOl4rT9ZfRI7mLTdk1wblIUnrIq35nqwEvC';\n link.crossOrigin = 'anonymous';\n document.head.appendChild(link);\n\n katexCssLoaded = true;\n};\n\nexport interface LaTeXProps {\n children: string;\n latex: string;\n className?: string;\n}\n\nexport function LaTeX({ children, latex, className }: LaTeXProps) {\n const [cssLoaded, setCssLoaded] = useState(false);\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n loadKatexCss();\n setCssLoaded(true);\n }, []);\n\n useEffect(() => {\n if (cssLoaded && containerRef.current) {\n try {\n katex.render(latex, containerRef.current, {\n displayMode: true,\n throwOnError: false,\n });\n } catch (error) {\n console.error('KaTeX rendering error:', error);\n if (containerRef.current) {\n containerRef.current.textContent = latex;\n }\n }\n }\n }, [cssLoaded, latex]);\n\n if (!cssLoaded) {\n return (\n <div id=\"mintlify-latex-container\" className={className}>\n {children}\n </div>\n );\n }\n\n return <div ref={containerRef} id=\"mintlify-latex-container\" className={className} />;\n}\n"],"names":["katexCssLoaded","loadKatexCss","link","LaTeX","children","latex","className","cssLoaded","setCssLoaded","useState","containerRef","useRef","useEffect","katex","error","jsx"],"mappings":";;;AAKA,IAAIA,IAAiB;AAErB,MAAMC,IAAe,MAAM;AACzB,MAAID,KAAkB,OAAO,WAAa;AACxC;AAGF,QAAME,IAAO,SAAS,cAAc,MAAM;AAC1C,EAAAA,EAAK,MAAM,cACXA,EAAK,OAAO,sDACZA,EAAK,YAAY,2EACjBA,EAAK,cAAc,aACnB,SAAS,KAAK,YAAYA,CAAI,GAE9BF,IAAiB;AACnB;AAQO,SAASG,EAAM,EAAE,UAAAC,GAAU,OAAAC,GAAO,WAAAC,KAAyB;AAChE,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1CC,IAAeC,EAAuB,IAAI;AAuBhD,SArBAC,EAAU,MAAM;AACd,IAAAX,EAAA,GACAO,EAAa,EAAI;AAAA,EACnB,GAAG,CAAA,CAAE,GAELI,EAAU,MAAM;AACd,QAAIL,KAAaG,EAAa;AAC5B,UAAI;AACF,QAAAG,EAAM,OAAOR,GAAOK,EAAa,SAAS;AAAA,UACxC,aAAa;AAAA,UACb,cAAc;AAAA,QAAA,CACf;AAAA,MACH,SAASI,GAAO;AACd,gBAAQ,MAAM,0BAA0BA,CAAK,GACzCJ,EAAa,YACfA,EAAa,QAAQ,cAAcL;AAAA,MAEvC;AAAA,EAEJ,GAAG,CAACE,GAAWF,CAAK,CAAC,GAEhBE,sBAQG,OAAA,EAAI,KAAKG,GAAc,IAAG,4BAA2B,WAAAJ,GAAsB,IAN/E,gBAAAS,EAAC,OAAA,EAAI,IAAG,4BAA2B,WAAAT,GAChC,UAAAF,GACH;AAKN;"}
|
|
@@ -1,75 +1,76 @@
|
|
|
1
1
|
import { jsx as w, jsxs as k } from "react/jsx-runtime";
|
|
2
|
-
import { useState as I, useRef as
|
|
2
|
+
import { useState as I, useRef as y, useEffect as L } from "react";
|
|
3
3
|
import { cn as _ } from "../../utils/cn.js";
|
|
4
4
|
function N({ toc: i }) {
|
|
5
|
-
const [
|
|
5
|
+
const [p, l] = I(""), x = y(!1), u = y();
|
|
6
6
|
return L(() => {
|
|
7
7
|
var c;
|
|
8
8
|
if (i.length === 0) return;
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const T = document.getElementById(m.slug);
|
|
24
|
-
if (!T) return null;
|
|
25
|
-
const y = T.getBoundingClientRect(), S = e.getBoundingClientRect(), B = y.top - S.top + b;
|
|
26
|
-
return { id: m.slug, top: B };
|
|
9
|
+
x.current = !1, u.current && clearTimeout(u.current);
|
|
10
|
+
const e = window.location.hash.slice(1);
|
|
11
|
+
l(e || ((c = i[0]) == null ? void 0 : c.slug) || "");
|
|
12
|
+
const f = () => {
|
|
13
|
+
const t = window.location.hash.slice(1);
|
|
14
|
+
t && l(t);
|
|
15
|
+
}, n = document.getElementById("main-content"), h = () => {
|
|
16
|
+
var E, C;
|
|
17
|
+
if (!n) return (E = i[0]) == null ? void 0 : E.slug;
|
|
18
|
+
const t = window.getComputedStyle(document.documentElement), s = parseFloat(t.getPropertyValue("--scroll-mt") || "0"), a = parseFloat(t.fontSize), v = s * a + 100, b = n.scrollTop, m = i.map((d) => {
|
|
19
|
+
const R = document.getElementById(d.slug);
|
|
20
|
+
if (!R) return null;
|
|
21
|
+
const T = R.getBoundingClientRect(), S = n.getBoundingClientRect(), B = T.top - S.top + b;
|
|
22
|
+
return { id: d.slug, top: B };
|
|
27
23
|
}).filter(Boolean);
|
|
28
|
-
if (
|
|
29
|
-
let
|
|
30
|
-
for (const
|
|
31
|
-
b + v >=
|
|
32
|
-
return
|
|
33
|
-
},
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
|
|
24
|
+
if (m.length === 0) return (C = i[0]) == null ? void 0 : C.slug;
|
|
25
|
+
let g = m[0];
|
|
26
|
+
for (const d of m)
|
|
27
|
+
b + v >= d.top && (g = d);
|
|
28
|
+
return g == null ? void 0 : g.id;
|
|
29
|
+
}, o = () => {
|
|
30
|
+
if (x.current) return;
|
|
31
|
+
const t = window.location.hash.slice(1);
|
|
32
|
+
if (t && i.some((a) => a.slug === t)) {
|
|
33
|
+
p !== t && l(t);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const s = h();
|
|
37
|
+
s && l(s);
|
|
37
38
|
};
|
|
38
|
-
window.addEventListener("hashchange",
|
|
39
|
+
window.addEventListener("hashchange", f), n ? n.addEventListener("scroll", o, {
|
|
39
40
|
passive: !0
|
|
40
|
-
}) : window.addEventListener("scroll",
|
|
41
|
-
let
|
|
42
|
-
return
|
|
43
|
-
|
|
41
|
+
}) : window.addEventListener("scroll", o, { passive: !0 });
|
|
42
|
+
let r;
|
|
43
|
+
return e || (r = setTimeout(o, 100)), () => {
|
|
44
|
+
r && clearTimeout(r), u.current && clearTimeout(u.current), window.removeEventListener("hashchange", f), n ? n.removeEventListener("scroll", o) : window.removeEventListener("scroll", o);
|
|
44
45
|
};
|
|
45
|
-
}, [i]), /* @__PURE__ */ w("ul", { className: "mint:list-none mint:flex mint:flex-col mint:gap-2 mint:text-sm mint:text-[#6b7280] mint:dark:text-[#adadad] mint:font-medium mint:relative mint:pl-[0.15rem] mint:before:content-[''] mint:before:absolute mint:before:left-[0.15rem] mint:before:top-0 mint:before:bottom-0 mint:before:w-[3px] mint:before:bg-[#f2f3f3] mint:dark:before:bg-[#222223] mint:before:rounded-full", children: i.map((
|
|
46
|
-
const
|
|
46
|
+
}, [i, p]), /* @__PURE__ */ w("ul", { className: "mint:list-none mint:flex mint:flex-col mint:gap-2 mint:text-sm mint:text-[#6b7280] mint:dark:text-[#adadad] mint:font-medium mint:relative mint:pl-[0.15rem] mint:before:content-[''] mint:before:absolute mint:before:left-[0.15rem] mint:before:top-0 mint:before:bottom-0 mint:before:w-[3px] mint:before:bg-[#f2f3f3] mint:dark:before:bg-[#222223] mint:before:rounded-full", children: i.map((e, f) => {
|
|
47
|
+
const n = p === e.slug;
|
|
47
48
|
return /* @__PURE__ */ k("li", { className: "mint:relative", children: [
|
|
48
|
-
|
|
49
|
+
n && /* @__PURE__ */ w("div", { className: "mint:absolute mint:left-0 mint:top-0 mint:bottom-0 mint:w-[3px] mint:rounded-full mint:bg-[#643fb2] mint:dark:bg-[#c9aaf9] mint:z-1" }),
|
|
49
50
|
/* @__PURE__ */ w(
|
|
50
51
|
"a",
|
|
51
52
|
{
|
|
52
|
-
href: `#${
|
|
53
|
-
onClick: (
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
const c = window.getComputedStyle(document.documentElement),
|
|
58
|
-
|
|
59
|
-
top:
|
|
53
|
+
href: `#${e.slug}`,
|
|
54
|
+
onClick: (h) => {
|
|
55
|
+
h.preventDefault(), l(e.slug);
|
|
56
|
+
const o = document.getElementById("main-content"), r = document.getElementById(e.slug);
|
|
57
|
+
if (o && r) {
|
|
58
|
+
const c = window.getComputedStyle(document.documentElement), t = parseFloat(c.getPropertyValue("--scroll-mt") || "0"), s = parseFloat(c.fontSize), a = t * s, v = o.getBoundingClientRect(), m = r.getBoundingClientRect().top - v.top + o.scrollTop - a;
|
|
59
|
+
o.scrollTo({
|
|
60
|
+
top: m,
|
|
60
61
|
behavior: "instant"
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
|
-
history.replaceState(null, "", `#${
|
|
64
|
+
history.replaceState(null, "", `#${e.slug}`);
|
|
64
65
|
},
|
|
65
66
|
className: _(
|
|
66
67
|
"mint:block mint:pl-6 mint:leading-relaxed mint:no-underline",
|
|
67
|
-
|
|
68
|
+
n ? "mint:text-[#643fb2] mint:dark:text-[#c9aaf9] mint:[text-shadow:-0.2px_0_0_currentColor,0.2px_0_0_currentColor]" : "mint:text-[#424242] mint:dark:text-[#d6d6d6] mint:dark:hover:text-[#d1d5db] mint:hover:text-[#111827]"
|
|
68
69
|
),
|
|
69
|
-
children:
|
|
70
|
+
children: e.title
|
|
70
71
|
}
|
|
71
72
|
)
|
|
72
|
-
] }, `${
|
|
73
|
+
] }, `${e.slug}-${f}`);
|
|
73
74
|
}) });
|
|
74
75
|
}
|
|
75
76
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/toc/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport type { TocItem } from '../../types';\nimport { cn } from '../../utils/cn';\n\ninterface TableOfContentsProps {\n toc: TocItem[];\n}\n\nexport function TableOfContents({ toc }: TableOfContentsProps) {\n const [activeId, setActiveId] = useState('');\n const ignoreScrollRef = useRef(false);\n const ignoreTimeoutRef = useRef<NodeJS.Timeout>();\n\n useEffect(() => {\n if (toc.length === 0) return;\n\n ignoreScrollRef.current = false;\n if (ignoreTimeoutRef.current) {\n clearTimeout(ignoreTimeoutRef.current);\n }\n\n const hash = window.location.hash.slice(1);\n if (hash) {\n setActiveId(hash);\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/toc/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport type { TocItem } from '../../types';\nimport { cn } from '../../utils/cn';\n\ninterface TableOfContentsProps {\n toc: TocItem[];\n}\n\nexport function TableOfContents({ toc }: TableOfContentsProps) {\n const [activeId, setActiveId] = useState('');\n const ignoreScrollRef = useRef(false);\n const ignoreTimeoutRef = useRef<NodeJS.Timeout>();\n\n useEffect(() => {\n if (toc.length === 0) return;\n\n ignoreScrollRef.current = false;\n if (ignoreTimeoutRef.current) {\n clearTimeout(ignoreTimeoutRef.current);\n }\n\n const hash = window.location.hash.slice(1);\n if (hash) {\n setActiveId(hash);\n } else {\n setActiveId(toc[0]?.slug || '');\n }\n\n const handleHashChange = () => {\n const hash = window.location.hash.slice(1);\n if (hash) {\n setActiveId(hash);\n }\n };\n\n const scrollContainer = document.getElementById('main-content');\n\n const getActiveHeading = () => {\n if (!scrollContainer) return toc[0]?.slug;\n\n const style = window.getComputedStyle(document.documentElement);\n const scrollMtRem = parseFloat(style.getPropertyValue('--scroll-mt') || '0');\n const fontSize = parseFloat(style.fontSize);\n const scrollOffset = scrollMtRem * fontSize + 100;\n\n const scrollY = scrollContainer.scrollTop;\n\n const headingPositions = toc\n .map((item) => {\n const element = document.getElementById(item.slug);\n if (!element) return null;\n\n const rect = element.getBoundingClientRect();\n const containerRect = scrollContainer.getBoundingClientRect();\n const relativeTop = rect.top - containerRect.top + scrollY;\n\n return { id: item.slug, top: relativeTop };\n })\n .filter(Boolean) as Array<{ id: string; top: number }>;\n\n if (headingPositions.length === 0) return toc[0]?.slug;\n\n let currentHeading = headingPositions[0];\n for (const heading of headingPositions) {\n if (scrollY + scrollOffset >= heading.top) {\n currentHeading = heading;\n }\n }\n\n return currentHeading?.id;\n };\n\n const handleScroll = () => {\n if (ignoreScrollRef.current) return;\n\n const hash = window.location.hash.slice(1);\n // If there's a hash in the URL, keep that heading active regardless of scroll position\n // This ensures headings near the bottom of the page stay active when clicked\n if (hash && toc.some((item) => item.slug === hash)) {\n if (activeId !== hash) {\n setActiveId(hash);\n }\n return;\n }\n\n const newActiveId = getActiveHeading();\n if (newActiveId) {\n setActiveId(newActiveId);\n }\n };\n\n window.addEventListener('hashchange', handleHashChange);\n\n if (scrollContainer) {\n scrollContainer.addEventListener('scroll', handleScroll, {\n passive: true,\n });\n } else {\n window.addEventListener('scroll', handleScroll, { passive: true });\n }\n\n let timeoutId: NodeJS.Timeout | undefined;\n if (!hash) {\n timeoutId = setTimeout(handleScroll, 100);\n }\n\n return () => {\n if (timeoutId) clearTimeout(timeoutId);\n if (ignoreTimeoutRef.current) clearTimeout(ignoreTimeoutRef.current);\n window.removeEventListener('hashchange', handleHashChange);\n if (scrollContainer) {\n scrollContainer.removeEventListener('scroll', handleScroll);\n } else {\n window.removeEventListener('scroll', handleScroll);\n }\n };\n }, [toc, activeId]);\n\n return (\n <ul className=\"mint:list-none mint:flex mint:flex-col mint:gap-2 mint:text-sm mint:text-[#6b7280] mint:dark:text-[#adadad] mint:font-medium mint:relative mint:pl-[0.15rem] mint:before:content-[''] mint:before:absolute mint:before:left-[0.15rem] mint:before:top-0 mint:before:bottom-0 mint:before:w-[3px] mint:before:bg-[#f2f3f3] mint:dark:before:bg-[#222223] mint:before:rounded-full\">\n {toc.map((item, index) => {\n const isActive = activeId === item.slug;\n return (\n <li key={`${item.slug}-${index}`} className=\"mint:relative\">\n {isActive && (\n <div className=\"mint:absolute mint:left-0 mint:top-0 mint:bottom-0 mint:w-[3px] mint:rounded-full mint:bg-[#643fb2] mint:dark:bg-[#c9aaf9] mint:z-1\" />\n )}\n <a\n href={`#${item.slug}`}\n onClick={(e) => {\n e.preventDefault();\n\n // Immediately set the active ID to ensure it's highlighted\n setActiveId(item.slug);\n\n const scrollContainer = document.getElementById('main-content');\n const targetElement = document.getElementById(item.slug);\n\n if (scrollContainer && targetElement) {\n const style = window.getComputedStyle(document.documentElement);\n const scrollMtRem = parseFloat(style.getPropertyValue('--scroll-mt') || '0');\n const fontSize = parseFloat(style.fontSize);\n const scrollOffset = scrollMtRem * fontSize;\n\n const containerRect = scrollContainer.getBoundingClientRect();\n const targetRect = targetElement.getBoundingClientRect();\n const relativeTop =\n targetRect.top - containerRect.top + scrollContainer.scrollTop - scrollOffset;\n\n scrollContainer.scrollTo({\n top: relativeTop,\n behavior: 'instant',\n });\n }\n\n history.replaceState(null, '', `#${item.slug}`);\n }}\n className={cn(\n 'mint:block mint:pl-6 mint:leading-relaxed mint:no-underline',\n isActive\n ? 'mint:text-[#643fb2] mint:dark:text-[#c9aaf9] mint:[text-shadow:-0.2px_0_0_currentColor,0.2px_0_0_currentColor]'\n : 'mint:text-[#424242] mint:dark:text-[#d6d6d6] mint:dark:hover:text-[#d1d5db] mint:hover:text-[#111827]'\n )}\n >\n {item.title}\n </a>\n </li>\n );\n })}\n </ul>\n );\n}\n"],"names":["TableOfContents","toc","activeId","setActiveId","useState","ignoreScrollRef","useRef","ignoreTimeoutRef","useEffect","hash","_a","handleHashChange","scrollContainer","getActiveHeading","style","scrollMtRem","fontSize","scrollOffset","scrollY","headingPositions","item","element","rect","containerRect","relativeTop","_b","currentHeading","heading","handleScroll","newActiveId","timeoutId","jsx","index","isActive","jsxs","e","targetElement","cn"],"mappings":"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"}
|