fumadocs-openapi 8.1.1 → 8.1.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/icons.d.ts +2 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +1 -0
- package/dist/playground/client.d.ts +3 -3
- package/dist/playground/client.d.ts.map +1 -1
- package/dist/playground/client.js +2 -2
- package/dist/playground/index.d.ts +3 -5
- package/dist/playground/index.d.ts.map +1 -1
- package/dist/playground/inputs.js +3 -2
- package/dist/playground/status-info.js +9 -9
- package/dist/ui/components/dialog.js +1 -1
- package/dist/ui/components/select.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/utils/get-pathname-from-input.d.ts.map +1 -1
- package/dist/utils/get-pathname-from-input.js +18 -10
- package/package.json +7 -8
package/dist/icons.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.tsx"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
package/dist/icons.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'fumadocs-ui/internal/icons';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type FC, type HTMLAttributes, type ReactElement, type RefObject } from 'react';
|
|
2
2
|
import type { ControllerFieldState, ControllerRenderProps, FieldPath, UseFormStateReturn } from 'react-hook-form';
|
|
3
3
|
import type { FetchResult } from '../playground/fetcher.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ParameterField, ReferenceSchema, RequestSchema } from '../playground/index.js';
|
|
5
5
|
import type { Security } from '../utils/get-security.js';
|
|
6
6
|
interface FormValues {
|
|
7
7
|
authorization: string | {
|
|
@@ -31,7 +31,7 @@ export type ClientProps = HTMLAttributes<HTMLFormElement> & {
|
|
|
31
31
|
authorization?: Security & {
|
|
32
32
|
persistentId: string;
|
|
33
33
|
};
|
|
34
|
-
parameters?:
|
|
34
|
+
parameters?: ParameterField[];
|
|
35
35
|
body?: RequestSchema & {
|
|
36
36
|
mediaType: string;
|
|
37
37
|
};
|
|
@@ -41,7 +41,7 @@ export type ClientProps = HTMLAttributes<HTMLFormElement> & {
|
|
|
41
41
|
references: Record<string, RequestSchema>;
|
|
42
42
|
proxyUrl?: string;
|
|
43
43
|
fields?: {
|
|
44
|
-
parameter?: CustomField<`${
|
|
44
|
+
parameter?: CustomField<`${ParameterField['in']}.${string}`, ParameterField>;
|
|
45
45
|
auth?: CustomField<'authorization', RequestSchema>;
|
|
46
46
|
body?: CustomField<'body', RequestSchema>;
|
|
47
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/playground/client.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,EAAE,EAEP,KAAK,cAAc,EACnB,KAAK,YAAY,EAEjB,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,SAAS,EACT,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAQzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/playground/client.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,EAAE,EAEP,KAAK,cAAc,EACnB,KAAK,YAAY,EAEjB,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,SAAS,EACT,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAQzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACd,MAAM,oBAAoB,CAAC;AAa5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAA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GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,MAAM,EAAE,EACnC,cAAc,CACf,CAAC;QACF,IAAI,CAAC,EAAE,WAAW,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;QACnD,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;KAC3C,CAAC;IAEF,UAAU,CAAC,EAAE,OAAO,CAAC;QACnB,aAAa,EAAE,EAAE,CAAC;YAAE,IAAI,EAAE,WAAW,CAAA;SAAE,CAAC,CAAC;KAC1C,CAAC,CAAC;CACJ,CAAC;AAEF,UAAU,iBAAiB;IACzB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1C,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;CAC/C;AAED,MAAM,MAAM,YAAY,GACpB;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,aAAa,GAAG,eAAe,CAAC;CACzC,CAAC;AAIN,wBAAgB,gBAAgB,IAAI,iBAAiB,CAIpD;AAkBD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,KAAK,EACL,MAAc,EACd,aAAa,EACb,UAAU,EACV,IAAI,EACJ,MAAM,EACN,UAAU,EACV,QAAQ,EACR,UAAU,EAAE,EAAE,aAAoC,EAAO,EACzD,GAAG,IAAI,EACR,EAAE,WAAW,2CAuHb"}
|
|
@@ -11,7 +11,7 @@ import { MethodLabel } from '../ui/components/method-label.js';
|
|
|
11
11
|
import { useQuery } from '../utils/use-query.js';
|
|
12
12
|
import ServerSelect from '../ui/server-select.js';
|
|
13
13
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from 'fumadocs-ui/components/ui/collapsible';
|
|
14
|
-
import { ChevronDown,
|
|
14
|
+
import { ChevronDown, LoaderCircle } from '../icons.js';
|
|
15
15
|
import { OauthDialog, OauthDialogTrigger, } from '../playground/auth/oauth-dialog.js';
|
|
16
16
|
import { useRequestData } from '../ui/contexts/code-example.js';
|
|
17
17
|
import { useEffectEvent } from 'fumadocs-core/utils/use-effect-event';
|
|
@@ -83,7 +83,7 @@ export default function Client({ route, method = 'GET', authorization, parameter
|
|
|
83
83
|
const onSubmit = form.handleSubmit((value) => {
|
|
84
84
|
testQuery.start(value);
|
|
85
85
|
});
|
|
86
|
-
return (_jsx(FormProvider, { ...form, children: _jsx(SchemaContext.Provider, { value: useMemo(() => ({ references: references, dynamic: dynamicRef }), [references]), children: _jsx(AuthProvider, { authorization: authorization, children: _jsxs("form", { ...rest, className: cn('not-prose flex flex-col rounded-xl border shadow-md overflow-hidden bg-fd-card text-fd-card-foreground', rest.className), onSubmit: onSubmit, children: [_jsxs("div", { className: "flex flex-row items-center gap-2 text-sm p-3 pb-0", children: [_jsx(MethodLabel, { children: method }), _jsx(Route, { route: route, className: "flex-1" }), _jsx("button", { type: "submit", className: cn(buttonVariants({ color: 'primary', size: 'sm' }), 'px-3 py-1.5'), disabled: testQuery.isLoading, children: testQuery.isLoading ? (_jsx(
|
|
86
|
+
return (_jsx(FormProvider, { ...form, children: _jsx(SchemaContext.Provider, { value: useMemo(() => ({ references: references, dynamic: dynamicRef }), [references]), children: _jsx(AuthProvider, { authorization: authorization, children: _jsxs("form", { ...rest, className: cn('not-prose flex flex-col rounded-xl border shadow-md overflow-hidden bg-fd-card text-fd-card-foreground', rest.className), onSubmit: onSubmit, children: [_jsxs("div", { className: "flex flex-row items-center gap-2 text-sm p-3 pb-0", children: [_jsx(MethodLabel, { children: method }), _jsx(Route, { route: route, className: "flex-1" }), _jsx("button", { type: "submit", className: cn(buttonVariants({ color: 'primary', size: 'sm' }), 'px-3 py-1.5'), disabled: testQuery.isLoading, children: testQuery.isLoading ? (_jsx(LoaderCircle, { className: "size-4 animate-spin" })) : ('Send') })] }), _jsx(FormBody, { body: body, fields: fields, parameters: parameters, authorization: authorization }), testQuery.data ? _jsx(ResultDisplay, { data: testQuery.data }) : null] }) }) }) }));
|
|
87
87
|
}
|
|
88
88
|
const paramNames = ['Headers', 'Cookies', 'Query', 'Path'];
|
|
89
89
|
const paramTypes = ['header', 'cookie', 'query', 'path'];
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { MethodInformation, RenderContext } from '../types.js';
|
|
2
2
|
import { type ClientProps } from './client.js';
|
|
3
|
-
interface BaseRequestField {
|
|
4
|
-
name: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
}
|
|
7
3
|
interface BaseSchema {
|
|
8
4
|
description?: string;
|
|
9
5
|
isRequired: boolean;
|
|
10
6
|
}
|
|
11
|
-
export type
|
|
7
|
+
export type ParameterField = (PrimitiveSchema | ArraySchema) & {
|
|
8
|
+
name: string;
|
|
9
|
+
description?: string;
|
|
12
10
|
in: 'cookie' | 'header' | 'query' | 'path';
|
|
13
11
|
};
|
|
14
12
|
interface PrimitiveSchema extends BaseSchema {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/playground/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAEjB,aAAa,EACd,MAAM,SAAS,CAAC;AAOjB,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/playground/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAEjB,aAAa,EACd,MAAM,SAAS,CAAC;AAOjB,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,UAAU,UAAU;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,eAAe,GAAG,WAAW,CAAC,GAAG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E,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEzD,wBAAsB,aAAa,CAAC,EAClC,IAAI,EACJ,MAAM,EACN,GAAG,EACH,MAAM,GACP,EAAE,kBAAkB,oDAsCpB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState, } from 'react';
|
|
4
|
-
import { Plus, Trash2 } from '
|
|
4
|
+
import { Plus, Trash2 } from '../icons.js';
|
|
5
5
|
import { Controller, useController, useFieldArray, useFormContext, } from 'react-hook-form';
|
|
6
6
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '../ui/components/select.js';
|
|
7
7
|
import { resolve } from '../playground/resolve.js';
|
|
@@ -185,10 +185,11 @@ export function FieldSet({ field, fieldName, toolbar, name, ...props }) {
|
|
|
185
185
|
function ArrayInput({ fieldName, field, ...props }) {
|
|
186
186
|
const { references } = useSchemaContext();
|
|
187
187
|
const items = resolve(field.items, references);
|
|
188
|
+
const name = fieldName.split('.').at(-1) ?? '';
|
|
188
189
|
const { fields, append, remove } = useFieldArray({
|
|
189
190
|
name: fieldName,
|
|
190
191
|
});
|
|
191
|
-
return (_jsxs("div", { ...props, className: cn('flex flex-col gap-2', props.className), children: [fields.map((item, index) => (_jsx(FieldSet, { name: _jsxs("span", { className: "text-fd-muted-foreground", children: [
|
|
192
|
+
return (_jsxs("div", { ...props, className: cn('flex flex-col gap-2', props.className), children: [fields.map((item, index) => (_jsx(FieldSet, { name: _jsxs("span", { className: "text-fd-muted-foreground", children: [name, "[", index, "]"] }), field: items, fieldName: `${fieldName}.${index}`, toolbar: _jsx("button", { type: "button", "aria-label": "Remove Item", className: cn(buttonVariants({
|
|
192
193
|
color: 'secondary',
|
|
193
194
|
size: 'sm',
|
|
194
195
|
})), onClick: () => {
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CircleCheck, CircleX } from '../icons.js';
|
|
2
2
|
const statusMap = {
|
|
3
|
-
400: { description: 'Bad Request', color: 'text-red-500', icon:
|
|
3
|
+
400: { description: 'Bad Request', color: 'text-red-500', icon: CircleX },
|
|
4
4
|
401: {
|
|
5
5
|
description: 'Unauthorized',
|
|
6
6
|
color: 'text-red-500',
|
|
7
|
-
icon:
|
|
7
|
+
icon: CircleX,
|
|
8
8
|
},
|
|
9
|
-
403: { description: 'Forbidden', color: 'text-red-500', icon:
|
|
9
|
+
403: { description: 'Forbidden', color: 'text-red-500', icon: CircleX },
|
|
10
10
|
404: {
|
|
11
11
|
description: 'Not Found',
|
|
12
12
|
color: 'text-fd-muted-foreground',
|
|
13
|
-
icon:
|
|
13
|
+
icon: CircleX,
|
|
14
14
|
},
|
|
15
15
|
500: {
|
|
16
16
|
description: 'Internal Server Error',
|
|
17
17
|
color: 'text-red-500',
|
|
18
|
-
icon:
|
|
18
|
+
icon: CircleX,
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
21
|
export function getStatusInfo(status) {
|
|
@@ -26,15 +26,15 @@ export function getStatusInfo(status) {
|
|
|
26
26
|
return {
|
|
27
27
|
description: 'Successful',
|
|
28
28
|
color: 'text-green-500',
|
|
29
|
-
icon:
|
|
29
|
+
icon: CircleCheck,
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
if (status >= 400) {
|
|
33
|
-
return { description: 'Error', color: 'text-red-500', icon:
|
|
33
|
+
return { description: 'Error', color: 'text-red-500', icon: CircleX };
|
|
34
34
|
}
|
|
35
35
|
return {
|
|
36
36
|
description: 'No Description',
|
|
37
37
|
color: 'text-fd-muted-foreground',
|
|
38
|
-
icon:
|
|
38
|
+
icon: CircleX,
|
|
39
39
|
};
|
|
40
40
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
5
|
-
import { X } from '
|
|
5
|
+
import { X } from '../../icons.js';
|
|
6
6
|
import { cn } from 'fumadocs-ui/utils/cn';
|
|
7
7
|
const Dialog = DialogPrimitive.Root;
|
|
8
8
|
const DialogTrigger = DialogPrimitive.Trigger;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
|
-
import { Check, ChevronDown, ChevronUp } from '
|
|
3
|
+
import { Check, ChevronDown, ChevronUp } from '../../icons.js';
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
5
|
import { cn } from 'fumadocs-ui/utils/cn';
|
|
6
6
|
const Select = SelectPrimitive.Root;
|
package/dist/ui/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Badge } from '../ui/components/method-label.js';
|
|
3
3
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from 'fumadocs-ui/components/ui/collapsible';
|
|
4
|
-
import { ChevronDown } from '
|
|
4
|
+
import { ChevronDown } from '../icons.js';
|
|
5
5
|
import { ApiProvider } from '../ui/contexts/api.js';
|
|
6
6
|
import { cn } from 'fumadocs-ui/utils/cn';
|
|
7
7
|
import { buttonVariants } from 'fumadocs-ui/components/ui/button';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-pathname-from-input.d.ts","sourceRoot":"","sources":["../../src/utils/get-pathname-from-input.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,
|
|
1
|
+
{"version":3,"file":"get-pathname-from-input.d.ts","sourceRoot":"","sources":["../../src/utils/get-pathname-from-input.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CA0BR"}
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
export function getPathnameFromInput(url, path, query) {
|
|
2
2
|
let pathname = url;
|
|
3
3
|
for (const key in path) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
if (path[key] === '')
|
|
5
|
+
continue;
|
|
6
|
+
if (Array.isArray(path[key])) {
|
|
7
|
+
pathname = pathname.replace(`{${key}}`, path[key].join('/'));
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
pathname = pathname.replace(`{${key}}`, String(path[key]));
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
13
|
const searchParams = new URLSearchParams();
|
|
11
14
|
for (const key in query) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
if (query[key] === '')
|
|
16
|
+
continue;
|
|
17
|
+
if (Array.isArray(query[key])) {
|
|
18
|
+
for (const value of query[key]) {
|
|
19
|
+
searchParams.append(key, String(value));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
searchParams.set(key, String(query[key]));
|
|
24
|
+
}
|
|
17
25
|
}
|
|
18
26
|
return searchParams.size > 0 ? `${pathname}?${searchParams}` : pathname;
|
|
19
27
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.2",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@fumari/json-schema-to-typescript": "^1.1.3",
|
|
48
|
-
"@radix-ui/react-dialog": "^1.1.
|
|
48
|
+
"@radix-ui/react-dialog": "^1.1.11",
|
|
49
49
|
"@radix-ui/react-select": "^2.2.2",
|
|
50
50
|
"@radix-ui/react-slot": "^1.2.0",
|
|
51
51
|
"@scalar/openapi-parser": "0.10.16",
|
|
@@ -55,21 +55,20 @@
|
|
|
55
55
|
"github-slugger": "^2.0.0",
|
|
56
56
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
57
57
|
"js-yaml": "^4.1.0",
|
|
58
|
-
"lucide-react": "^0.503.0",
|
|
59
58
|
"next-themes": "^0.4.6",
|
|
60
59
|
"openapi-sampler": "^1.6.1",
|
|
61
|
-
"react-hook-form": "^7.56.
|
|
60
|
+
"react-hook-form": "^7.56.1",
|
|
62
61
|
"remark": "^15.0.1",
|
|
63
62
|
"remark-rehype": "^11.1.2",
|
|
64
63
|
"shiki": "^3.3.0",
|
|
65
64
|
"xml-js": "^1.6.11",
|
|
66
|
-
"fumadocs-core": "15.2.
|
|
67
|
-
"fumadocs-ui": "15.2.
|
|
65
|
+
"fumadocs-core": "15.2.11",
|
|
66
|
+
"fumadocs-ui": "15.2.11"
|
|
68
67
|
},
|
|
69
68
|
"devDependencies": {
|
|
70
|
-
"@scalar/api-client-react": "^1.2.
|
|
69
|
+
"@scalar/api-client-react": "^1.2.26",
|
|
71
70
|
"@types/js-yaml": "^4.0.9",
|
|
72
|
-
"@types/node": "22.
|
|
71
|
+
"@types/node": "22.15.2",
|
|
73
72
|
"@types/openapi-sampler": "^1.0.3",
|
|
74
73
|
"@types/react": "^19.1.2",
|
|
75
74
|
"next": "15.3.1",
|