@prorobotech/openapi-k8s-toolkit 1.1.0-alpha.11 → 1.1.0-alpha.12
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/openapi-k8s-toolkit.es.js +1122 -828
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +1121 -827
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/api/forms.d.ts +4 -0
- package/dist/types/components/molecules/BlackholeForm/index.d.ts +0 -1
- package/dist/types/components/molecules/BlackholeForm/molecules/index.d.ts +0 -1
- package/dist/types/components/molecules/{BlackholeForm/molecules/YamlEditorSingleton → YamlEditorSingleton}/YamlEditorSingleton.d.ts +1 -1
- package/dist/types/components/molecules/index.d.ts +2 -1
- package/dist/types/components/organisms/DynamicComponents/molecules/Toggler/Toggler.d.ts +6 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/Toggler/index.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/TogglerSegmented/TogglerSegmented.d.ts +6 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/TogglerSegmented/index.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/types.d.ts +39 -0
- package/package.json +1 -1
- /package/dist/types/components/molecules/{BlackholeForm/molecules/YamlEditorSingleton → YamlEditorSingleton}/index.d.ts +0 -0
- /package/dist/types/components/molecules/{BlackholeForm/molecules/YamlEditorSingleton → YamlEditorSingleton}/styled.d.ts +0 -0
|
@@ -7886,19 +7886,54 @@
|
|
|
7886
7886
|
pathToValue,
|
|
7887
7887
|
body
|
|
7888
7888
|
}) => {
|
|
7889
|
-
const
|
|
7889
|
+
const config = {
|
|
7890
|
+
headers: {
|
|
7891
|
+
"Content-Type": "application/json-patch+json"
|
|
7892
|
+
}
|
|
7893
|
+
};
|
|
7894
|
+
const replaceOp = [
|
|
7890
7895
|
{
|
|
7891
7896
|
op: "replace",
|
|
7892
7897
|
path: pathToValue,
|
|
7893
7898
|
value: body
|
|
7894
7899
|
}
|
|
7895
7900
|
];
|
|
7896
|
-
|
|
7897
|
-
|
|
7901
|
+
try {
|
|
7902
|
+
return await axios.patch(endpoint, replaceOp, config);
|
|
7903
|
+
} catch (error) {
|
|
7904
|
+
if (!isAxiosError(error)) {
|
|
7905
|
+
throw error;
|
|
7906
|
+
}
|
|
7907
|
+
const status = error.response?.status;
|
|
7908
|
+
if (status !== 422) {
|
|
7909
|
+
throw error;
|
|
7910
|
+
}
|
|
7911
|
+
const addOp = [
|
|
7912
|
+
{
|
|
7913
|
+
op: "add",
|
|
7914
|
+
path: pathToValue,
|
|
7915
|
+
value: body
|
|
7916
|
+
}
|
|
7917
|
+
];
|
|
7918
|
+
return axios.patch(endpoint, addOp, config);
|
|
7919
|
+
}
|
|
7920
|
+
};
|
|
7921
|
+
const patchEntryWithDeleteOp = async ({
|
|
7922
|
+
endpoint,
|
|
7923
|
+
pathToValue
|
|
7924
|
+
}) => {
|
|
7925
|
+
const config = {
|
|
7898
7926
|
headers: {
|
|
7899
7927
|
"Content-Type": "application/json-patch+json"
|
|
7900
7928
|
}
|
|
7901
|
-
}
|
|
7929
|
+
};
|
|
7930
|
+
const replaceOp = [
|
|
7931
|
+
{
|
|
7932
|
+
op: "remove",
|
|
7933
|
+
path: pathToValue
|
|
7934
|
+
}
|
|
7935
|
+
];
|
|
7936
|
+
return axios.patch(endpoint, replaceOp, config);
|
|
7902
7937
|
};
|
|
7903
7938
|
|
|
7904
7939
|
const DeleteModal = ({ name, onClose, endpoint }) => {
|
|
@@ -38428,6 +38463,263 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
38428
38463
|
] });
|
|
38429
38464
|
};
|
|
38430
38465
|
|
|
38466
|
+
const Toggler = ({ data, children }) => {
|
|
38467
|
+
const {
|
|
38468
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
38469
|
+
id,
|
|
38470
|
+
reqIndex,
|
|
38471
|
+
jsonPathToValue,
|
|
38472
|
+
criteria,
|
|
38473
|
+
notificationSuccessMessage,
|
|
38474
|
+
notificationSuccessMessageDescription,
|
|
38475
|
+
notificationErrorMessage,
|
|
38476
|
+
notificationErrorMessageDescription,
|
|
38477
|
+
containerStyle,
|
|
38478
|
+
endpoint,
|
|
38479
|
+
pathToValue,
|
|
38480
|
+
valueToSubmit
|
|
38481
|
+
} = data;
|
|
38482
|
+
const [api, contextHolder] = antd.notification.useNotification();
|
|
38483
|
+
const queryClient = reactQuery.useQueryClient();
|
|
38484
|
+
const { data: multiQueryData, isLoading: isMultiQueryLoading, isError: isMultiQueryErrors, errors } = useMultiQuery();
|
|
38485
|
+
const partsOfUrl = usePartsOfUrl();
|
|
38486
|
+
if (isMultiQueryLoading) {
|
|
38487
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
|
|
38488
|
+
}
|
|
38489
|
+
if (isMultiQueryErrors) {
|
|
38490
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
38491
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
|
|
38492
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
|
|
38493
|
+
] });
|
|
38494
|
+
}
|
|
38495
|
+
const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
|
|
38496
|
+
acc[index.toString()] = value;
|
|
38497
|
+
return acc;
|
|
38498
|
+
}, {});
|
|
38499
|
+
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
38500
|
+
if (jsonRoot === void 0) {
|
|
38501
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
|
|
38502
|
+
}
|
|
38503
|
+
const valueToCompare = jp.query(jsonRoot, `$${jsonPathToValue}`)[0];
|
|
38504
|
+
let valueToSwitch = false;
|
|
38505
|
+
if (criteria.type === "forSuccess") {
|
|
38506
|
+
if (criteria.operator === "exists") {
|
|
38507
|
+
valueToSwitch = valueToCompare !== void 0;
|
|
38508
|
+
}
|
|
38509
|
+
if (criteria.operator === "equals") {
|
|
38510
|
+
valueToSwitch = String(valueToCompare) === criteria.valueToCompare;
|
|
38511
|
+
}
|
|
38512
|
+
}
|
|
38513
|
+
if (criteria.type === "forError") {
|
|
38514
|
+
if (criteria.operator === "exists") {
|
|
38515
|
+
valueToSwitch = !valueToCompare;
|
|
38516
|
+
}
|
|
38517
|
+
if (criteria.operator === "equals") {
|
|
38518
|
+
valueToSwitch = String(valueToCompare) !== criteria.valueToCompare;
|
|
38519
|
+
}
|
|
38520
|
+
}
|
|
38521
|
+
const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
|
|
38522
|
+
text: notificationSuccessMessage,
|
|
38523
|
+
replaceValues,
|
|
38524
|
+
multiQueryData
|
|
38525
|
+
}) : "Success";
|
|
38526
|
+
const notificationSuccessMessageDescriptionPrepared = notificationSuccessMessageDescription ? parseAll({
|
|
38527
|
+
text: notificationSuccessMessageDescription,
|
|
38528
|
+
replaceValues,
|
|
38529
|
+
multiQueryData
|
|
38530
|
+
}) : "Success";
|
|
38531
|
+
const notificationErrorMessagePrepared = notificationErrorMessage ? parseAll({
|
|
38532
|
+
text: notificationErrorMessage,
|
|
38533
|
+
replaceValues,
|
|
38534
|
+
multiQueryData
|
|
38535
|
+
}) : "Success";
|
|
38536
|
+
const notificationErrorMessageDescriptionPrepared = notificationErrorMessageDescription ? parseAll({
|
|
38537
|
+
text: notificationErrorMessageDescription,
|
|
38538
|
+
replaceValues,
|
|
38539
|
+
multiQueryData
|
|
38540
|
+
}) : "Success";
|
|
38541
|
+
const openNotificationSuccess = () => {
|
|
38542
|
+
api.success({
|
|
38543
|
+
message: notificationSuccessMessagePrepared,
|
|
38544
|
+
description: notificationSuccessMessageDescriptionPrepared,
|
|
38545
|
+
placement: "bottomRight"
|
|
38546
|
+
});
|
|
38547
|
+
};
|
|
38548
|
+
const openNotificationError = () => {
|
|
38549
|
+
api.error({
|
|
38550
|
+
message: notificationErrorMessagePrepared,
|
|
38551
|
+
description: notificationErrorMessageDescriptionPrepared,
|
|
38552
|
+
placement: "bottomRight"
|
|
38553
|
+
});
|
|
38554
|
+
};
|
|
38555
|
+
const endpointPrepared = endpoint ? parseAll({ text: endpoint, replaceValues, multiQueryData }) : "no-endpoint-provided";
|
|
38556
|
+
const pathToValuePrepared = pathToValue ? parseAll({ text: pathToValue, replaceValues, multiQueryData }) : "no-pathToValue-provided";
|
|
38557
|
+
const toggleOn = () => {
|
|
38558
|
+
patchEntryWithReplaceOp({
|
|
38559
|
+
endpoint: endpointPrepared,
|
|
38560
|
+
pathToValue: pathToValuePrepared,
|
|
38561
|
+
body: valueToSubmit.onValue
|
|
38562
|
+
}).then(() => {
|
|
38563
|
+
queryClient.invalidateQueries({ queryKey: ["multi"] });
|
|
38564
|
+
openNotificationSuccess();
|
|
38565
|
+
}).catch((error) => {
|
|
38566
|
+
openNotificationError();
|
|
38567
|
+
console.error(error);
|
|
38568
|
+
});
|
|
38569
|
+
};
|
|
38570
|
+
const toggleOff = () => {
|
|
38571
|
+
if (valueToSubmit.offValue !== void 0) {
|
|
38572
|
+
patchEntryWithReplaceOp({
|
|
38573
|
+
endpoint: endpointPrepared,
|
|
38574
|
+
pathToValue: pathToValuePrepared,
|
|
38575
|
+
body: valueToSubmit.offValue
|
|
38576
|
+
}).then(() => {
|
|
38577
|
+
queryClient.invalidateQueries({ queryKey: ["multi"] });
|
|
38578
|
+
openNotificationSuccess();
|
|
38579
|
+
}).catch((error) => {
|
|
38580
|
+
openNotificationError();
|
|
38581
|
+
console.error(error);
|
|
38582
|
+
});
|
|
38583
|
+
}
|
|
38584
|
+
if (valueToSubmit.toRemoveWhenOff) {
|
|
38585
|
+
patchEntryWithDeleteOp({
|
|
38586
|
+
endpoint: endpointPrepared,
|
|
38587
|
+
pathToValue: pathToValuePrepared
|
|
38588
|
+
}).then(() => {
|
|
38589
|
+
queryClient.invalidateQueries({ queryKey: ["multi"] });
|
|
38590
|
+
openNotificationSuccess();
|
|
38591
|
+
}).catch((error) => {
|
|
38592
|
+
openNotificationError();
|
|
38593
|
+
console.error(error);
|
|
38594
|
+
});
|
|
38595
|
+
}
|
|
38596
|
+
};
|
|
38597
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
|
|
38598
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
38599
|
+
antd.Switch,
|
|
38600
|
+
{
|
|
38601
|
+
value: valueToSwitch,
|
|
38602
|
+
onChange: (checked) => {
|
|
38603
|
+
if (checked) {
|
|
38604
|
+
toggleOn();
|
|
38605
|
+
} else {
|
|
38606
|
+
toggleOff();
|
|
38607
|
+
}
|
|
38608
|
+
}
|
|
38609
|
+
}
|
|
38610
|
+
),
|
|
38611
|
+
children,
|
|
38612
|
+
contextHolder
|
|
38613
|
+
] });
|
|
38614
|
+
};
|
|
38615
|
+
|
|
38616
|
+
const TogglerSegmented = ({
|
|
38617
|
+
data,
|
|
38618
|
+
children
|
|
38619
|
+
}) => {
|
|
38620
|
+
const {
|
|
38621
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
38622
|
+
id,
|
|
38623
|
+
reqIndex,
|
|
38624
|
+
jsonPathToValue,
|
|
38625
|
+
notificationSuccessMessage,
|
|
38626
|
+
notificationSuccessMessageDescription,
|
|
38627
|
+
notificationErrorMessage,
|
|
38628
|
+
notificationErrorMessageDescription,
|
|
38629
|
+
containerStyle,
|
|
38630
|
+
endpoint,
|
|
38631
|
+
pathToValue,
|
|
38632
|
+
possibleValues,
|
|
38633
|
+
valuesMap
|
|
38634
|
+
} = data;
|
|
38635
|
+
const [api, contextHolder] = antd.notification.useNotification();
|
|
38636
|
+
const queryClient = reactQuery.useQueryClient();
|
|
38637
|
+
const { data: multiQueryData, isLoading: isMultiQueryLoading, isError: isMultiQueryErrors, errors } = useMultiQuery();
|
|
38638
|
+
const partsOfUrl = usePartsOfUrl();
|
|
38639
|
+
if (isMultiQueryLoading) {
|
|
38640
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
|
|
38641
|
+
}
|
|
38642
|
+
if (isMultiQueryErrors) {
|
|
38643
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
38644
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h4", { children: "Errors:" }),
|
|
38645
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errors.map((e, i) => e && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: typeof e === "string" ? e : e.message }, i)) })
|
|
38646
|
+
] });
|
|
38647
|
+
}
|
|
38648
|
+
const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value, index) => {
|
|
38649
|
+
acc[index.toString()] = value;
|
|
38650
|
+
return acc;
|
|
38651
|
+
}, {});
|
|
38652
|
+
const jsonRoot = multiQueryData[`req${reqIndex}`];
|
|
38653
|
+
if (jsonRoot === void 0) {
|
|
38654
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "No root for json path" });
|
|
38655
|
+
}
|
|
38656
|
+
const valueToCompare = jp.query(jsonRoot, `$${jsonPathToValue}`)[0];
|
|
38657
|
+
const valueToSegmented = valuesMap?.find((el) => el.value === valueToCompare)?.renderedValue;
|
|
38658
|
+
const notificationSuccessMessagePrepared = notificationSuccessMessage ? parseAll({
|
|
38659
|
+
text: notificationSuccessMessage,
|
|
38660
|
+
replaceValues,
|
|
38661
|
+
multiQueryData
|
|
38662
|
+
}) : "Success";
|
|
38663
|
+
const notificationSuccessMessageDescriptionPrepared = notificationSuccessMessageDescription ? parseAll({
|
|
38664
|
+
text: notificationSuccessMessageDescription,
|
|
38665
|
+
replaceValues,
|
|
38666
|
+
multiQueryData
|
|
38667
|
+
}) : "Success";
|
|
38668
|
+
const notificationErrorMessagePrepared = notificationErrorMessage ? parseAll({
|
|
38669
|
+
text: notificationErrorMessage,
|
|
38670
|
+
replaceValues,
|
|
38671
|
+
multiQueryData
|
|
38672
|
+
}) : "Success";
|
|
38673
|
+
const notificationErrorMessageDescriptionPrepared = notificationErrorMessageDescription ? parseAll({
|
|
38674
|
+
text: notificationErrorMessageDescription,
|
|
38675
|
+
replaceValues,
|
|
38676
|
+
multiQueryData
|
|
38677
|
+
}) : "Success";
|
|
38678
|
+
const openNotificationSuccess = () => {
|
|
38679
|
+
api.success({
|
|
38680
|
+
message: notificationSuccessMessagePrepared,
|
|
38681
|
+
description: notificationSuccessMessageDescriptionPrepared,
|
|
38682
|
+
placement: "bottomRight"
|
|
38683
|
+
});
|
|
38684
|
+
};
|
|
38685
|
+
const openNotificationError = () => {
|
|
38686
|
+
api.error({
|
|
38687
|
+
message: notificationErrorMessagePrepared,
|
|
38688
|
+
description: notificationErrorMessageDescriptionPrepared,
|
|
38689
|
+
placement: "bottomRight"
|
|
38690
|
+
});
|
|
38691
|
+
};
|
|
38692
|
+
const endpointPrepared = endpoint ? parseAll({ text: endpoint, replaceValues, multiQueryData }) : "no-endpoint-provided";
|
|
38693
|
+
const pathToValuePrepared = pathToValue ? parseAll({ text: pathToValue, replaceValues, multiQueryData }) : "no-pathToValue-provided";
|
|
38694
|
+
const onChange = (renderedValue) => {
|
|
38695
|
+
const valueFromMap = valuesMap?.find((el) => el.renderedValue === renderedValue)?.value;
|
|
38696
|
+
const valueToSend = valueFromMap || renderedValue;
|
|
38697
|
+
patchEntryWithReplaceOp({
|
|
38698
|
+
endpoint: endpointPrepared,
|
|
38699
|
+
pathToValue: pathToValuePrepared,
|
|
38700
|
+
body: valueToSend
|
|
38701
|
+
}).then(() => {
|
|
38702
|
+
queryClient.invalidateQueries({ queryKey: ["multi"] });
|
|
38703
|
+
openNotificationSuccess();
|
|
38704
|
+
}).catch((error) => {
|
|
38705
|
+
openNotificationError();
|
|
38706
|
+
console.error(error);
|
|
38707
|
+
});
|
|
38708
|
+
};
|
|
38709
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: containerStyle, children: [
|
|
38710
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
38711
|
+
antd.Segmented,
|
|
38712
|
+
{
|
|
38713
|
+
options: possibleValues,
|
|
38714
|
+
value: valueToSegmented || "~n~e~v~e~r",
|
|
38715
|
+
onChange: (value) => onChange(value)
|
|
38716
|
+
}
|
|
38717
|
+
),
|
|
38718
|
+
children,
|
|
38719
|
+
contextHolder
|
|
38720
|
+
] });
|
|
38721
|
+
};
|
|
38722
|
+
|
|
38431
38723
|
const DynamicComponents = {
|
|
38432
38724
|
DefaultDiv,
|
|
38433
38725
|
antdText: AntdText,
|
|
@@ -38465,7 +38757,9 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
38465
38757
|
SecretBase64Plain,
|
|
38466
38758
|
ResourceBadge,
|
|
38467
38759
|
Events: Events$1,
|
|
38468
|
-
OwnerRefs
|
|
38760
|
+
OwnerRefs,
|
|
38761
|
+
Toggler,
|
|
38762
|
+
TogglerSegmented
|
|
38469
38763
|
};
|
|
38470
38764
|
|
|
38471
38765
|
const prepareUrlsToFetchForDynamicRenderer = ({
|
|
@@ -39210,733 +39504,161 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
39210
39504
|
);
|
|
39211
39505
|
};
|
|
39212
39506
|
|
|
39213
|
-
|
|
39214
|
-
|
|
39215
|
-
|
|
39216
|
-
|
|
39217
|
-
|
|
39218
|
-
|
|
39219
|
-
|
|
39220
|
-
|
|
39221
|
-
|
|
39222
|
-
|
|
39223
|
-
|
|
39224
|
-
|
|
39225
|
-
/** Used as references for various `Number` constants. */
|
|
39226
|
-
var NAN = 0 / 0;
|
|
39507
|
+
function _defineProperty$1(obj, key, value) {
|
|
39508
|
+
if (key in obj) {
|
|
39509
|
+
Object.defineProperty(obj, key, {
|
|
39510
|
+
value: value,
|
|
39511
|
+
enumerable: true,
|
|
39512
|
+
configurable: true,
|
|
39513
|
+
writable: true
|
|
39514
|
+
});
|
|
39515
|
+
} else {
|
|
39516
|
+
obj[key] = value;
|
|
39517
|
+
}
|
|
39227
39518
|
|
|
39228
|
-
|
|
39229
|
-
|
|
39519
|
+
return obj;
|
|
39520
|
+
}
|
|
39230
39521
|
|
|
39231
|
-
|
|
39232
|
-
|
|
39522
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
39523
|
+
var keys = Object.keys(object);
|
|
39233
39524
|
|
|
39234
|
-
|
|
39235
|
-
|
|
39525
|
+
if (Object.getOwnPropertySymbols) {
|
|
39526
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
39527
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
39528
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
39529
|
+
});
|
|
39530
|
+
keys.push.apply(keys, symbols);
|
|
39531
|
+
}
|
|
39236
39532
|
|
|
39237
|
-
|
|
39238
|
-
|
|
39533
|
+
return keys;
|
|
39534
|
+
}
|
|
39239
39535
|
|
|
39240
|
-
|
|
39241
|
-
|
|
39536
|
+
function _objectSpread2$1(target) {
|
|
39537
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
39538
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
39242
39539
|
|
|
39243
|
-
|
|
39244
|
-
|
|
39540
|
+
if (i % 2) {
|
|
39541
|
+
ownKeys$1(Object(source), true).forEach(function (key) {
|
|
39542
|
+
_defineProperty$1(target, key, source[key]);
|
|
39543
|
+
});
|
|
39544
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
39545
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
39546
|
+
} else {
|
|
39547
|
+
ownKeys$1(Object(source)).forEach(function (key) {
|
|
39548
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
39549
|
+
});
|
|
39550
|
+
}
|
|
39551
|
+
}
|
|
39245
39552
|
|
|
39246
|
-
|
|
39247
|
-
|
|
39553
|
+
return target;
|
|
39554
|
+
}
|
|
39248
39555
|
|
|
39249
|
-
|
|
39250
|
-
|
|
39556
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
39557
|
+
if (source == null) return {};
|
|
39558
|
+
var target = {};
|
|
39559
|
+
var sourceKeys = Object.keys(source);
|
|
39560
|
+
var key, i;
|
|
39251
39561
|
|
|
39252
|
-
|
|
39253
|
-
|
|
39562
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
39563
|
+
key = sourceKeys[i];
|
|
39564
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
39565
|
+
target[key] = source[key];
|
|
39566
|
+
}
|
|
39254
39567
|
|
|
39255
|
-
|
|
39256
|
-
|
|
39568
|
+
return target;
|
|
39569
|
+
}
|
|
39257
39570
|
|
|
39258
|
-
|
|
39259
|
-
|
|
39260
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
39261
|
-
* of values.
|
|
39262
|
-
*/
|
|
39263
|
-
var objectToString = objectProto.toString;
|
|
39571
|
+
function _objectWithoutProperties(source, excluded) {
|
|
39572
|
+
if (source == null) return {};
|
|
39264
39573
|
|
|
39265
|
-
|
|
39266
|
-
var nativeMax = Math.max,
|
|
39267
|
-
nativeMin = Math.min;
|
|
39574
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
39268
39575
|
|
|
39269
|
-
|
|
39270
|
-
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
39271
|
-
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
39272
|
-
*
|
|
39273
|
-
* @static
|
|
39274
|
-
* @memberOf _
|
|
39275
|
-
* @since 2.4.0
|
|
39276
|
-
* @category Date
|
|
39277
|
-
* @returns {number} Returns the timestamp.
|
|
39278
|
-
* @example
|
|
39279
|
-
*
|
|
39280
|
-
* _.defer(function(stamp) {
|
|
39281
|
-
* console.log(_.now() - stamp);
|
|
39282
|
-
* }, _.now());
|
|
39283
|
-
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
39284
|
-
*/
|
|
39285
|
-
var now = function() {
|
|
39286
|
-
return root.Date.now();
|
|
39287
|
-
};
|
|
39576
|
+
var key, i;
|
|
39288
39577
|
|
|
39289
|
-
|
|
39290
|
-
|
|
39291
|
-
* milliseconds have elapsed since the last time the debounced function was
|
|
39292
|
-
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
39293
|
-
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
39294
|
-
* Provide `options` to indicate whether `func` should be invoked on the
|
|
39295
|
-
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
39296
|
-
* with the last arguments provided to the debounced function. Subsequent
|
|
39297
|
-
* calls to the debounced function return the result of the last `func`
|
|
39298
|
-
* invocation.
|
|
39299
|
-
*
|
|
39300
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
39301
|
-
* invoked on the trailing edge of the timeout only if the debounced function
|
|
39302
|
-
* is invoked more than once during the `wait` timeout.
|
|
39303
|
-
*
|
|
39304
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
39305
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
39306
|
-
*
|
|
39307
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
39308
|
-
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
39309
|
-
*
|
|
39310
|
-
* @static
|
|
39311
|
-
* @memberOf _
|
|
39312
|
-
* @since 0.1.0
|
|
39313
|
-
* @category Function
|
|
39314
|
-
* @param {Function} func The function to debounce.
|
|
39315
|
-
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
39316
|
-
* @param {Object} [options={}] The options object.
|
|
39317
|
-
* @param {boolean} [options.leading=false]
|
|
39318
|
-
* Specify invoking on the leading edge of the timeout.
|
|
39319
|
-
* @param {number} [options.maxWait]
|
|
39320
|
-
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
39321
|
-
* @param {boolean} [options.trailing=true]
|
|
39322
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
39323
|
-
* @returns {Function} Returns the new debounced function.
|
|
39324
|
-
* @example
|
|
39325
|
-
*
|
|
39326
|
-
* // Avoid costly calculations while the window size is in flux.
|
|
39327
|
-
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
39328
|
-
*
|
|
39329
|
-
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
39330
|
-
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
39331
|
-
* 'leading': true,
|
|
39332
|
-
* 'trailing': false
|
|
39333
|
-
* }));
|
|
39334
|
-
*
|
|
39335
|
-
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
39336
|
-
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
39337
|
-
* var source = new EventSource('/stream');
|
|
39338
|
-
* jQuery(source).on('message', debounced);
|
|
39339
|
-
*
|
|
39340
|
-
* // Cancel the trailing debounced invocation.
|
|
39341
|
-
* jQuery(window).on('popstate', debounced.cancel);
|
|
39342
|
-
*/
|
|
39343
|
-
function debounce(func, wait, options) {
|
|
39344
|
-
var lastArgs,
|
|
39345
|
-
lastThis,
|
|
39346
|
-
maxWait,
|
|
39347
|
-
result,
|
|
39348
|
-
timerId,
|
|
39349
|
-
lastCallTime,
|
|
39350
|
-
lastInvokeTime = 0,
|
|
39351
|
-
leading = false,
|
|
39352
|
-
maxing = false,
|
|
39353
|
-
trailing = true;
|
|
39578
|
+
if (Object.getOwnPropertySymbols) {
|
|
39579
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
39354
39580
|
|
|
39355
|
-
|
|
39356
|
-
|
|
39357
|
-
|
|
39358
|
-
|
|
39359
|
-
|
|
39360
|
-
|
|
39361
|
-
maxing = 'maxWait' in options;
|
|
39362
|
-
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
39363
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
39581
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
39582
|
+
key = sourceSymbolKeys[i];
|
|
39583
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
39584
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
39585
|
+
target[key] = source[key];
|
|
39586
|
+
}
|
|
39364
39587
|
}
|
|
39365
39588
|
|
|
39366
|
-
|
|
39367
|
-
|
|
39368
|
-
thisArg = lastThis;
|
|
39589
|
+
return target;
|
|
39590
|
+
}
|
|
39369
39591
|
|
|
39370
|
-
|
|
39371
|
-
|
|
39372
|
-
|
|
39373
|
-
return result;
|
|
39374
|
-
}
|
|
39592
|
+
function _slicedToArray(arr, i) {
|
|
39593
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
39594
|
+
}
|
|
39375
39595
|
|
|
39376
|
-
|
|
39377
|
-
|
|
39378
|
-
|
|
39379
|
-
// Start the timer for the trailing edge.
|
|
39380
|
-
timerId = setTimeout(timerExpired, wait);
|
|
39381
|
-
// Invoke the leading edge.
|
|
39382
|
-
return leading ? invokeFunc(time) : result;
|
|
39383
|
-
}
|
|
39596
|
+
function _arrayWithHoles(arr) {
|
|
39597
|
+
if (Array.isArray(arr)) return arr;
|
|
39598
|
+
}
|
|
39384
39599
|
|
|
39385
|
-
|
|
39386
|
-
|
|
39387
|
-
|
|
39388
|
-
|
|
39600
|
+
function _iterableToArrayLimit(arr, i) {
|
|
39601
|
+
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
39602
|
+
var _arr = [];
|
|
39603
|
+
var _n = true;
|
|
39604
|
+
var _d = false;
|
|
39605
|
+
var _e = undefined;
|
|
39389
39606
|
|
|
39390
|
-
|
|
39607
|
+
try {
|
|
39608
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
39609
|
+
_arr.push(_s.value);
|
|
39610
|
+
|
|
39611
|
+
if (i && _arr.length === i) break;
|
|
39612
|
+
}
|
|
39613
|
+
} catch (err) {
|
|
39614
|
+
_d = true;
|
|
39615
|
+
_e = err;
|
|
39616
|
+
} finally {
|
|
39617
|
+
try {
|
|
39618
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
39619
|
+
} finally {
|
|
39620
|
+
if (_d) throw _e;
|
|
39621
|
+
}
|
|
39391
39622
|
}
|
|
39392
39623
|
|
|
39393
|
-
|
|
39394
|
-
|
|
39395
|
-
timeSinceLastInvoke = time - lastInvokeTime;
|
|
39624
|
+
return _arr;
|
|
39625
|
+
}
|
|
39396
39626
|
|
|
39397
|
-
|
|
39398
|
-
|
|
39399
|
-
|
|
39400
|
-
|
|
39401
|
-
|
|
39402
|
-
|
|
39627
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
39628
|
+
if (!o) return;
|
|
39629
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
39630
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
39631
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
39632
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
39633
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
39634
|
+
}
|
|
39403
39635
|
|
|
39404
|
-
|
|
39405
|
-
|
|
39406
|
-
if (shouldInvoke(time)) {
|
|
39407
|
-
return trailingEdge(time);
|
|
39408
|
-
}
|
|
39409
|
-
// Restart the timer.
|
|
39410
|
-
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
39411
|
-
}
|
|
39636
|
+
function _arrayLikeToArray(arr, len) {
|
|
39637
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
39412
39638
|
|
|
39413
|
-
|
|
39414
|
-
timerId = undefined;
|
|
39639
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
39415
39640
|
|
|
39416
|
-
|
|
39417
|
-
|
|
39418
|
-
if (trailing && lastArgs) {
|
|
39419
|
-
return invokeFunc(time);
|
|
39420
|
-
}
|
|
39421
|
-
lastArgs = lastThis = undefined;
|
|
39422
|
-
return result;
|
|
39423
|
-
}
|
|
39641
|
+
return arr2;
|
|
39642
|
+
}
|
|
39424
39643
|
|
|
39425
|
-
|
|
39426
|
-
|
|
39427
|
-
|
|
39428
|
-
}
|
|
39429
|
-
lastInvokeTime = 0;
|
|
39430
|
-
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
39431
|
-
}
|
|
39644
|
+
function _nonIterableRest() {
|
|
39645
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
39646
|
+
}
|
|
39432
39647
|
|
|
39433
|
-
|
|
39434
|
-
|
|
39648
|
+
function _defineProperty(obj, key, value) {
|
|
39649
|
+
if (key in obj) {
|
|
39650
|
+
Object.defineProperty(obj, key, {
|
|
39651
|
+
value: value,
|
|
39652
|
+
enumerable: true,
|
|
39653
|
+
configurable: true,
|
|
39654
|
+
writable: true
|
|
39655
|
+
});
|
|
39656
|
+
} else {
|
|
39657
|
+
obj[key] = value;
|
|
39435
39658
|
}
|
|
39436
39659
|
|
|
39437
|
-
|
|
39438
|
-
|
|
39439
|
-
isInvoking = shouldInvoke(time);
|
|
39440
|
-
|
|
39441
|
-
lastArgs = arguments;
|
|
39442
|
-
lastThis = this;
|
|
39443
|
-
lastCallTime = time;
|
|
39444
|
-
|
|
39445
|
-
if (isInvoking) {
|
|
39446
|
-
if (timerId === undefined) {
|
|
39447
|
-
return leadingEdge(lastCallTime);
|
|
39448
|
-
}
|
|
39449
|
-
if (maxing) {
|
|
39450
|
-
// Handle invocations in a tight loop.
|
|
39451
|
-
timerId = setTimeout(timerExpired, wait);
|
|
39452
|
-
return invokeFunc(lastCallTime);
|
|
39453
|
-
}
|
|
39454
|
-
}
|
|
39455
|
-
if (timerId === undefined) {
|
|
39456
|
-
timerId = setTimeout(timerExpired, wait);
|
|
39457
|
-
}
|
|
39458
|
-
return result;
|
|
39459
|
-
}
|
|
39460
|
-
debounced.cancel = cancel;
|
|
39461
|
-
debounced.flush = flush;
|
|
39462
|
-
return debounced;
|
|
39463
|
-
}
|
|
39464
|
-
|
|
39465
|
-
/**
|
|
39466
|
-
* Checks if `value` is the
|
|
39467
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
39468
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
39469
|
-
*
|
|
39470
|
-
* @static
|
|
39471
|
-
* @memberOf _
|
|
39472
|
-
* @since 0.1.0
|
|
39473
|
-
* @category Lang
|
|
39474
|
-
* @param {*} value The value to check.
|
|
39475
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
39476
|
-
* @example
|
|
39477
|
-
*
|
|
39478
|
-
* _.isObject({});
|
|
39479
|
-
* // => true
|
|
39480
|
-
*
|
|
39481
|
-
* _.isObject([1, 2, 3]);
|
|
39482
|
-
* // => true
|
|
39483
|
-
*
|
|
39484
|
-
* _.isObject(_.noop);
|
|
39485
|
-
* // => true
|
|
39486
|
-
*
|
|
39487
|
-
* _.isObject(null);
|
|
39488
|
-
* // => false
|
|
39489
|
-
*/
|
|
39490
|
-
function isObject$2(value) {
|
|
39491
|
-
var type = typeof value;
|
|
39492
|
-
return !!value && (type == 'object' || type == 'function');
|
|
39493
|
-
}
|
|
39494
|
-
|
|
39495
|
-
/**
|
|
39496
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
39497
|
-
* and has a `typeof` result of "object".
|
|
39498
|
-
*
|
|
39499
|
-
* @static
|
|
39500
|
-
* @memberOf _
|
|
39501
|
-
* @since 4.0.0
|
|
39502
|
-
* @category Lang
|
|
39503
|
-
* @param {*} value The value to check.
|
|
39504
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
39505
|
-
* @example
|
|
39506
|
-
*
|
|
39507
|
-
* _.isObjectLike({});
|
|
39508
|
-
* // => true
|
|
39509
|
-
*
|
|
39510
|
-
* _.isObjectLike([1, 2, 3]);
|
|
39511
|
-
* // => true
|
|
39512
|
-
*
|
|
39513
|
-
* _.isObjectLike(_.noop);
|
|
39514
|
-
* // => false
|
|
39515
|
-
*
|
|
39516
|
-
* _.isObjectLike(null);
|
|
39517
|
-
* // => false
|
|
39518
|
-
*/
|
|
39519
|
-
function isObjectLike(value) {
|
|
39520
|
-
return !!value && typeof value == 'object';
|
|
39521
|
-
}
|
|
39522
|
-
|
|
39523
|
-
/**
|
|
39524
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
39525
|
-
*
|
|
39526
|
-
* @static
|
|
39527
|
-
* @memberOf _
|
|
39528
|
-
* @since 4.0.0
|
|
39529
|
-
* @category Lang
|
|
39530
|
-
* @param {*} value The value to check.
|
|
39531
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
39532
|
-
* @example
|
|
39533
|
-
*
|
|
39534
|
-
* _.isSymbol(Symbol.iterator);
|
|
39535
|
-
* // => true
|
|
39536
|
-
*
|
|
39537
|
-
* _.isSymbol('abc');
|
|
39538
|
-
* // => false
|
|
39539
|
-
*/
|
|
39540
|
-
function isSymbol(value) {
|
|
39541
|
-
return typeof value == 'symbol' ||
|
|
39542
|
-
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
39543
|
-
}
|
|
39544
|
-
|
|
39545
|
-
/**
|
|
39546
|
-
* Converts `value` to a number.
|
|
39547
|
-
*
|
|
39548
|
-
* @static
|
|
39549
|
-
* @memberOf _
|
|
39550
|
-
* @since 4.0.0
|
|
39551
|
-
* @category Lang
|
|
39552
|
-
* @param {*} value The value to process.
|
|
39553
|
-
* @returns {number} Returns the number.
|
|
39554
|
-
* @example
|
|
39555
|
-
*
|
|
39556
|
-
* _.toNumber(3.2);
|
|
39557
|
-
* // => 3.2
|
|
39558
|
-
*
|
|
39559
|
-
* _.toNumber(Number.MIN_VALUE);
|
|
39560
|
-
* // => 5e-324
|
|
39561
|
-
*
|
|
39562
|
-
* _.toNumber(Infinity);
|
|
39563
|
-
* // => Infinity
|
|
39564
|
-
*
|
|
39565
|
-
* _.toNumber('3.2');
|
|
39566
|
-
* // => 3.2
|
|
39567
|
-
*/
|
|
39568
|
-
function toNumber(value) {
|
|
39569
|
-
if (typeof value == 'number') {
|
|
39570
|
-
return value;
|
|
39571
|
-
}
|
|
39572
|
-
if (isSymbol(value)) {
|
|
39573
|
-
return NAN;
|
|
39574
|
-
}
|
|
39575
|
-
if (isObject$2(value)) {
|
|
39576
|
-
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
39577
|
-
value = isObject$2(other) ? (other + '') : other;
|
|
39578
|
-
}
|
|
39579
|
-
if (typeof value != 'string') {
|
|
39580
|
-
return value === 0 ? value : +value;
|
|
39581
|
-
}
|
|
39582
|
-
value = value.replace(reTrim, '');
|
|
39583
|
-
var isBinary = reIsBinary.test(value);
|
|
39584
|
-
return (isBinary || reIsOctal.test(value))
|
|
39585
|
-
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
39586
|
-
: (reIsBadHex.test(value) ? NAN : +value);
|
|
39587
|
-
}
|
|
39588
|
-
|
|
39589
|
-
var lodash_debounce = debounce;
|
|
39590
|
-
|
|
39591
|
-
const debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(lodash_debounce);
|
|
39592
|
-
|
|
39593
|
-
function useUnmount(func) {
|
|
39594
|
-
const funcRef = K.useRef(func);
|
|
39595
|
-
funcRef.current = func;
|
|
39596
|
-
K.useEffect(
|
|
39597
|
-
() => () => {
|
|
39598
|
-
funcRef.current();
|
|
39599
|
-
},
|
|
39600
|
-
[]
|
|
39601
|
-
);
|
|
39602
|
-
}
|
|
39603
|
-
|
|
39604
|
-
// src/useDebounceCallback/useDebounceCallback.ts
|
|
39605
|
-
function useDebounceCallback(func, delay = 500, options) {
|
|
39606
|
-
const debouncedFunc = K.useRef();
|
|
39607
|
-
useUnmount(() => {
|
|
39608
|
-
if (debouncedFunc.current) {
|
|
39609
|
-
debouncedFunc.current.cancel();
|
|
39610
|
-
}
|
|
39611
|
-
});
|
|
39612
|
-
const debounced = K.useMemo(() => {
|
|
39613
|
-
const debouncedFuncInstance = debounce$1(func, delay, options);
|
|
39614
|
-
const wrappedFunc = (...args) => {
|
|
39615
|
-
return debouncedFuncInstance(...args);
|
|
39616
|
-
};
|
|
39617
|
-
wrappedFunc.cancel = () => {
|
|
39618
|
-
debouncedFuncInstance.cancel();
|
|
39619
|
-
};
|
|
39620
|
-
wrappedFunc.isPending = () => {
|
|
39621
|
-
return !!debouncedFunc.current;
|
|
39622
|
-
};
|
|
39623
|
-
wrappedFunc.flush = () => {
|
|
39624
|
-
return debouncedFuncInstance.flush();
|
|
39625
|
-
};
|
|
39626
|
-
return wrappedFunc;
|
|
39627
|
-
}, [func, delay, options]);
|
|
39628
|
-
K.useEffect(() => {
|
|
39629
|
-
debouncedFunc.current = debounce$1(func, delay, options);
|
|
39630
|
-
}, [func, delay, options]);
|
|
39631
|
-
return debounced;
|
|
39632
|
-
}
|
|
39633
|
-
|
|
39634
|
-
function floorToDecimal(num, decimalPlaces) {
|
|
39635
|
-
const factor = 10 ** decimalPlaces;
|
|
39636
|
-
return Math.floor(num * factor) / factor;
|
|
39637
|
-
}
|
|
39638
|
-
const parseQuotaValue = (key, val) => {
|
|
39639
|
-
let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
|
|
39640
|
-
if (key === "cpu") {
|
|
39641
|
-
if (val.endsWith("m")) {
|
|
39642
|
-
numericValue /= 1e3;
|
|
39643
|
-
}
|
|
39644
|
-
return floorToDecimal(numericValue, 1);
|
|
39645
|
-
}
|
|
39646
|
-
if (val.endsWith("m")) {
|
|
39647
|
-
numericValue /= 1e3;
|
|
39648
|
-
} else if (val.endsWith("k")) {
|
|
39649
|
-
numericValue /= 1e6;
|
|
39650
|
-
} else if (val.endsWith("M")) {
|
|
39651
|
-
numericValue /= 1e3;
|
|
39652
|
-
} else if (val.endsWith("G")) {
|
|
39653
|
-
numericValue /= 1;
|
|
39654
|
-
} else if (val.endsWith("T")) {
|
|
39655
|
-
numericValue *= 1e3;
|
|
39656
|
-
} else if (val.endsWith("Ki")) {
|
|
39657
|
-
numericValue /= 1024;
|
|
39658
|
-
numericValue /= 1e6;
|
|
39659
|
-
} else if (val.endsWith("Mi")) {
|
|
39660
|
-
numericValue /= 1e3;
|
|
39661
|
-
numericValue /= 1e3;
|
|
39662
|
-
} else if (/^\d+(\.\d+)?$/.test(val)) {
|
|
39663
|
-
numericValue /= 1e9;
|
|
39664
|
-
} else {
|
|
39665
|
-
throw new Error("Invalid value");
|
|
39666
|
-
}
|
|
39667
|
-
return floorToDecimal(numericValue, 1);
|
|
39668
|
-
};
|
|
39669
|
-
const parseQuotaValueCpu = (val) => {
|
|
39670
|
-
if (typeof val === "string") {
|
|
39671
|
-
let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
|
|
39672
|
-
if (val.endsWith("m")) {
|
|
39673
|
-
numericValue /= 1e3;
|
|
39674
|
-
}
|
|
39675
|
-
return floorToDecimal(numericValue, 1);
|
|
39676
|
-
}
|
|
39677
|
-
return 0;
|
|
39678
|
-
};
|
|
39679
|
-
const parseQuotaValueMemoryAndStorage = (val) => {
|
|
39680
|
-
if (typeof val === "string") {
|
|
39681
|
-
let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
|
|
39682
|
-
if (val.endsWith("k")) {
|
|
39683
|
-
numericValue /= 1e6;
|
|
39684
|
-
} else if (val.endsWith("m")) {
|
|
39685
|
-
numericValue /= 1e3;
|
|
39686
|
-
} else if (val.endsWith("M")) {
|
|
39687
|
-
numericValue /= 1e3;
|
|
39688
|
-
} else if (val.endsWith("G")) {
|
|
39689
|
-
numericValue /= 1;
|
|
39690
|
-
} else if (val.endsWith("T")) {
|
|
39691
|
-
numericValue *= 1e3;
|
|
39692
|
-
} else if (val.endsWith("P")) {
|
|
39693
|
-
numericValue *= 1e6;
|
|
39694
|
-
} else if (val.endsWith("E")) {
|
|
39695
|
-
numericValue *= 1e9;
|
|
39696
|
-
} else if (val.endsWith("Ki")) {
|
|
39697
|
-
numericValue *= 1024 / 1e9;
|
|
39698
|
-
} else if (val.endsWith("Mi")) {
|
|
39699
|
-
numericValue /= 1048.576;
|
|
39700
|
-
} else if (val.endsWith("Gi")) {
|
|
39701
|
-
numericValue *= 1.073741824;
|
|
39702
|
-
} else if (val.endsWith("Ti")) {
|
|
39703
|
-
numericValue *= 1.099511628;
|
|
39704
|
-
} else if (val.endsWith("Pi")) {
|
|
39705
|
-
numericValue *= 1.125899907;
|
|
39706
|
-
} else if (val.endsWith("Ei")) {
|
|
39707
|
-
numericValue *= 1.152921505;
|
|
39708
|
-
} else if (val === "0") {
|
|
39709
|
-
return 0;
|
|
39710
|
-
} else {
|
|
39711
|
-
throw new Error("Invalid value");
|
|
39712
|
-
}
|
|
39713
|
-
return floorToDecimal(numericValue, 1);
|
|
39714
|
-
}
|
|
39715
|
-
return 0;
|
|
39716
|
-
};
|
|
39717
|
-
|
|
39718
|
-
const findAllPathsForObject = (obj, targetKey, targetValue, currentPath = []) => {
|
|
39719
|
-
let paths = [];
|
|
39720
|
-
if (typeof obj !== "object" || obj === null) {
|
|
39721
|
-
return paths;
|
|
39722
|
-
}
|
|
39723
|
-
if (obj[targetKey] === targetValue) {
|
|
39724
|
-
paths.push([...currentPath]);
|
|
39725
|
-
}
|
|
39726
|
-
for (const key in obj) {
|
|
39727
|
-
if (obj.hasOwnProperty(key)) {
|
|
39728
|
-
const value = obj[key];
|
|
39729
|
-
if (typeof value === "object" && value !== null) {
|
|
39730
|
-
const newPath = [...currentPath, key];
|
|
39731
|
-
const subPaths = findAllPathsForObject(value, targetKey, targetValue, newPath);
|
|
39732
|
-
paths = paths.concat(subPaths);
|
|
39733
|
-
}
|
|
39734
|
-
}
|
|
39735
|
-
}
|
|
39736
|
-
return paths;
|
|
39737
|
-
};
|
|
39738
|
-
const normalizeValuesForQuotasToNumber = (object, properties) => {
|
|
39739
|
-
const newObject = _$1.cloneDeep(object);
|
|
39740
|
-
const cpuPaths = findAllPathsForObject(properties, "type", "rangeInputCpu");
|
|
39741
|
-
const memoryPaths = findAllPathsForObject(properties, "type", "rangeInputMemory");
|
|
39742
|
-
memoryPaths.forEach((path) => {
|
|
39743
|
-
const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
|
|
39744
|
-
const value = _$1.get(newObject, cleanPath);
|
|
39745
|
-
if (value || value === 0) {
|
|
39746
|
-
_$1.set(newObject, cleanPath, parseQuotaValueMemoryAndStorage(value));
|
|
39747
|
-
}
|
|
39748
|
-
});
|
|
39749
|
-
cpuPaths.forEach((path) => {
|
|
39750
|
-
const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
|
|
39751
|
-
const value = _$1.get(newObject, cleanPath);
|
|
39752
|
-
if (value || value === 0) {
|
|
39753
|
-
_$1.set(newObject, cleanPath, parseQuotaValueCpu(value));
|
|
39754
|
-
}
|
|
39755
|
-
});
|
|
39756
|
-
return newObject;
|
|
39757
|
-
};
|
|
39758
|
-
|
|
39759
|
-
const getAllPathsFromObj = (obj, prefix = []) => {
|
|
39760
|
-
const entries = Array.isArray(obj) ? obj.map((value, index) => [index, value]) : Object.entries(obj);
|
|
39761
|
-
return entries.flatMap(([key, value]) => {
|
|
39762
|
-
const currentPath = [...prefix, key];
|
|
39763
|
-
return typeof value === "object" && value !== null ? [currentPath, ...getAllPathsFromObj(value, currentPath)] : [currentPath];
|
|
39764
|
-
});
|
|
39765
|
-
};
|
|
39766
|
-
|
|
39767
|
-
const getPrefixSubarrays = (arr) => {
|
|
39768
|
-
return arr.map((_, index) => arr.slice(0, index + 1));
|
|
39769
|
-
};
|
|
39770
|
-
|
|
39771
|
-
const deepMerge = (a, b) => {
|
|
39772
|
-
const result = { ...a };
|
|
39773
|
-
for (const key of Object.keys(b)) {
|
|
39774
|
-
const aVal = a[key];
|
|
39775
|
-
const bVal = b[key];
|
|
39776
|
-
if (aVal !== null && bVal !== null && typeof aVal === "object" && typeof bVal === "object" && !Array.isArray(aVal) && !Array.isArray(bVal)) {
|
|
39777
|
-
result[key] = deepMerge(aVal, bVal);
|
|
39778
|
-
} else {
|
|
39779
|
-
result[key] = bVal;
|
|
39780
|
-
}
|
|
39781
|
-
}
|
|
39782
|
-
return result;
|
|
39783
|
-
};
|
|
39784
|
-
|
|
39785
|
-
function _defineProperty$1(obj, key, value) {
|
|
39786
|
-
if (key in obj) {
|
|
39787
|
-
Object.defineProperty(obj, key, {
|
|
39788
|
-
value: value,
|
|
39789
|
-
enumerable: true,
|
|
39790
|
-
configurable: true,
|
|
39791
|
-
writable: true
|
|
39792
|
-
});
|
|
39793
|
-
} else {
|
|
39794
|
-
obj[key] = value;
|
|
39795
|
-
}
|
|
39796
|
-
|
|
39797
|
-
return obj;
|
|
39798
|
-
}
|
|
39799
|
-
|
|
39800
|
-
function ownKeys$1(object, enumerableOnly) {
|
|
39801
|
-
var keys = Object.keys(object);
|
|
39802
|
-
|
|
39803
|
-
if (Object.getOwnPropertySymbols) {
|
|
39804
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
39805
|
-
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
39806
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
39807
|
-
});
|
|
39808
|
-
keys.push.apply(keys, symbols);
|
|
39809
|
-
}
|
|
39810
|
-
|
|
39811
|
-
return keys;
|
|
39812
|
-
}
|
|
39813
|
-
|
|
39814
|
-
function _objectSpread2$1(target) {
|
|
39815
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
39816
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
39817
|
-
|
|
39818
|
-
if (i % 2) {
|
|
39819
|
-
ownKeys$1(Object(source), true).forEach(function (key) {
|
|
39820
|
-
_defineProperty$1(target, key, source[key]);
|
|
39821
|
-
});
|
|
39822
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
39823
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
39824
|
-
} else {
|
|
39825
|
-
ownKeys$1(Object(source)).forEach(function (key) {
|
|
39826
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
39827
|
-
});
|
|
39828
|
-
}
|
|
39829
|
-
}
|
|
39830
|
-
|
|
39831
|
-
return target;
|
|
39832
|
-
}
|
|
39833
|
-
|
|
39834
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
39835
|
-
if (source == null) return {};
|
|
39836
|
-
var target = {};
|
|
39837
|
-
var sourceKeys = Object.keys(source);
|
|
39838
|
-
var key, i;
|
|
39839
|
-
|
|
39840
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
39841
|
-
key = sourceKeys[i];
|
|
39842
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
39843
|
-
target[key] = source[key];
|
|
39844
|
-
}
|
|
39845
|
-
|
|
39846
|
-
return target;
|
|
39847
|
-
}
|
|
39848
|
-
|
|
39849
|
-
function _objectWithoutProperties(source, excluded) {
|
|
39850
|
-
if (source == null) return {};
|
|
39851
|
-
|
|
39852
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
39853
|
-
|
|
39854
|
-
var key, i;
|
|
39855
|
-
|
|
39856
|
-
if (Object.getOwnPropertySymbols) {
|
|
39857
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
39858
|
-
|
|
39859
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
39860
|
-
key = sourceSymbolKeys[i];
|
|
39861
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
39862
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
39863
|
-
target[key] = source[key];
|
|
39864
|
-
}
|
|
39865
|
-
}
|
|
39866
|
-
|
|
39867
|
-
return target;
|
|
39868
|
-
}
|
|
39869
|
-
|
|
39870
|
-
function _slicedToArray(arr, i) {
|
|
39871
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
39872
|
-
}
|
|
39873
|
-
|
|
39874
|
-
function _arrayWithHoles(arr) {
|
|
39875
|
-
if (Array.isArray(arr)) return arr;
|
|
39876
|
-
}
|
|
39877
|
-
|
|
39878
|
-
function _iterableToArrayLimit(arr, i) {
|
|
39879
|
-
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
39880
|
-
var _arr = [];
|
|
39881
|
-
var _n = true;
|
|
39882
|
-
var _d = false;
|
|
39883
|
-
var _e = undefined;
|
|
39884
|
-
|
|
39885
|
-
try {
|
|
39886
|
-
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
39887
|
-
_arr.push(_s.value);
|
|
39888
|
-
|
|
39889
|
-
if (i && _arr.length === i) break;
|
|
39890
|
-
}
|
|
39891
|
-
} catch (err) {
|
|
39892
|
-
_d = true;
|
|
39893
|
-
_e = err;
|
|
39894
|
-
} finally {
|
|
39895
|
-
try {
|
|
39896
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
39897
|
-
} finally {
|
|
39898
|
-
if (_d) throw _e;
|
|
39899
|
-
}
|
|
39900
|
-
}
|
|
39901
|
-
|
|
39902
|
-
return _arr;
|
|
39903
|
-
}
|
|
39904
|
-
|
|
39905
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
39906
|
-
if (!o) return;
|
|
39907
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
39908
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
39909
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
39910
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
39911
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
39912
|
-
}
|
|
39913
|
-
|
|
39914
|
-
function _arrayLikeToArray(arr, len) {
|
|
39915
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
39916
|
-
|
|
39917
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
39918
|
-
|
|
39919
|
-
return arr2;
|
|
39920
|
-
}
|
|
39921
|
-
|
|
39922
|
-
function _nonIterableRest() {
|
|
39923
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
39924
|
-
}
|
|
39925
|
-
|
|
39926
|
-
function _defineProperty(obj, key, value) {
|
|
39927
|
-
if (key in obj) {
|
|
39928
|
-
Object.defineProperty(obj, key, {
|
|
39929
|
-
value: value,
|
|
39930
|
-
enumerable: true,
|
|
39931
|
-
configurable: true,
|
|
39932
|
-
writable: true
|
|
39933
|
-
});
|
|
39934
|
-
} else {
|
|
39935
|
-
obj[key] = value;
|
|
39936
|
-
}
|
|
39937
|
-
|
|
39938
|
-
return obj;
|
|
39939
|
-
}
|
|
39660
|
+
return obj;
|
|
39661
|
+
}
|
|
39940
39662
|
|
|
39941
39663
|
function ownKeys(object, enumerableOnly) {
|
|
39942
39664
|
var keys = Object.keys(object);
|
|
@@ -40002,7 +39724,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
40002
39724
|
};
|
|
40003
39725
|
}
|
|
40004
39726
|
|
|
40005
|
-
function isObject$
|
|
39727
|
+
function isObject$2(value) {
|
|
40006
39728
|
return {}.toString.call(value).includes('Object');
|
|
40007
39729
|
}
|
|
40008
39730
|
|
|
@@ -40019,7 +39741,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
40019
39741
|
}
|
|
40020
39742
|
|
|
40021
39743
|
function validateChanges(initial, changes) {
|
|
40022
|
-
if (!isObject$
|
|
39744
|
+
if (!isObject$2(changes)) errorHandler$1('changeType');
|
|
40023
39745
|
if (Object.keys(changes).some(function (field) {
|
|
40024
39746
|
return !hasOwnProperty(initial, field);
|
|
40025
39747
|
})) errorHandler$1('changeField');
|
|
@@ -40031,15 +39753,15 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
40031
39753
|
}
|
|
40032
39754
|
|
|
40033
39755
|
function validateHandler(handler) {
|
|
40034
|
-
if (!(isFunction(handler) || isObject$
|
|
40035
|
-
if (isObject$
|
|
39756
|
+
if (!(isFunction(handler) || isObject$2(handler))) errorHandler$1('handlerType');
|
|
39757
|
+
if (isObject$2(handler) && Object.values(handler).some(function (_handler) {
|
|
40036
39758
|
return !isFunction(_handler);
|
|
40037
39759
|
})) errorHandler$1('handlersType');
|
|
40038
39760
|
}
|
|
40039
39761
|
|
|
40040
39762
|
function validateInitial(initial) {
|
|
40041
39763
|
if (!initial) errorHandler$1('initialIsRequired');
|
|
40042
|
-
if (!isObject$
|
|
39764
|
+
if (!isObject$2(initial)) errorHandler$1('initialType');
|
|
40043
39765
|
if (isEmpty$1(initial)) errorHandler$1('initialContent');
|
|
40044
39766
|
}
|
|
40045
39767
|
|
|
@@ -40139,7 +39861,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
40139
39861
|
};
|
|
40140
39862
|
}
|
|
40141
39863
|
|
|
40142
|
-
function isObject(value) {
|
|
39864
|
+
function isObject$1(value) {
|
|
40143
39865
|
return {}.toString.call(value).includes('Object');
|
|
40144
39866
|
}
|
|
40145
39867
|
|
|
@@ -40151,7 +39873,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
40151
39873
|
|
|
40152
39874
|
function validateConfig(config) {
|
|
40153
39875
|
if (!config) errorHandler('configIsRequired');
|
|
40154
|
-
if (!isObject(config)) errorHandler('configType');
|
|
39876
|
+
if (!isObject$1(config)) errorHandler('configType');
|
|
40155
39877
|
|
|
40156
39878
|
if (config.urls) {
|
|
40157
39879
|
informAboutDeprecation();
|
|
@@ -47287,120 +47009,6 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47287
47009
|
}
|
|
47288
47010
|
|
|
47289
47011
|
const BorderRadiusContainer$1 = styled.div`
|
|
47290
|
-
height: 100%;
|
|
47291
|
-
border: 1px solid ${({ $colorBorder }) => $colorBorder};
|
|
47292
|
-
border-radius: 8px;
|
|
47293
|
-
padding: 2px;
|
|
47294
|
-
|
|
47295
|
-
.monaco-editor,
|
|
47296
|
-
.overflow-guard {
|
|
47297
|
-
border-radius: 8px;
|
|
47298
|
-
}
|
|
47299
|
-
`;
|
|
47300
|
-
const Styled$k = {
|
|
47301
|
-
BorderRadiusContainer: BorderRadiusContainer$1
|
|
47302
|
-
};
|
|
47303
|
-
|
|
47304
|
-
const YamlEditor = ({ theme, currentValues, onChange, editorUri }) => {
|
|
47305
|
-
const { token } = antd.theme.useToken();
|
|
47306
|
-
const [yamlData, setYamlData] = K.useState("");
|
|
47307
|
-
const editorRef = K.useRef(null);
|
|
47308
|
-
const monacoRef = K.useRef(null);
|
|
47309
|
-
const isFocusedRef = K.useRef(false);
|
|
47310
|
-
const pendingExternalYamlRef = K.useRef(null);
|
|
47311
|
-
const isApplyingExternalUpdateRef = K.useRef(false);
|
|
47312
|
-
K.useEffect(() => {
|
|
47313
|
-
const next = stringify(currentValues, {
|
|
47314
|
-
// Use literal block scalar for multiline strings
|
|
47315
|
-
blockQuote: "literal",
|
|
47316
|
-
// Preserve line breaks
|
|
47317
|
-
lineWidth: 0,
|
|
47318
|
-
// Use double quotes for strings that need escaping
|
|
47319
|
-
doubleQuotedAsJSON: false
|
|
47320
|
-
});
|
|
47321
|
-
if (isFocusedRef.current) {
|
|
47322
|
-
pendingExternalYamlRef.current = next ?? "";
|
|
47323
|
-
return;
|
|
47324
|
-
}
|
|
47325
|
-
setYamlData(next ?? "");
|
|
47326
|
-
}, [currentValues]);
|
|
47327
|
-
K.useEffect(() => {
|
|
47328
|
-
const editor = editorRef.current;
|
|
47329
|
-
const monaco = monacoRef.current;
|
|
47330
|
-
if (editor && monaco) {
|
|
47331
|
-
if (isFocusedRef.current) return;
|
|
47332
|
-
const uri = monaco.Uri.parse(editorUri);
|
|
47333
|
-
let model = editor.getModel() || monaco.editor.getModel(uri);
|
|
47334
|
-
if (!model) {
|
|
47335
|
-
model = monaco.editor.createModel(yamlData ?? "", "yaml", uri);
|
|
47336
|
-
}
|
|
47337
|
-
if (model) {
|
|
47338
|
-
monaco.editor.setModelLanguage(model, "yaml");
|
|
47339
|
-
const current = model.getValue();
|
|
47340
|
-
if ((yamlData ?? "") !== current) {
|
|
47341
|
-
isApplyingExternalUpdateRef.current = true;
|
|
47342
|
-
model.setValue(yamlData ?? "");
|
|
47343
|
-
}
|
|
47344
|
-
}
|
|
47345
|
-
}
|
|
47346
|
-
}, [yamlData, editorUri]);
|
|
47347
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.BorderRadiusContainer, { $colorBorder: token.colorBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47348
|
-
Ft,
|
|
47349
|
-
{
|
|
47350
|
-
language: "yaml",
|
|
47351
|
-
path: editorUri,
|
|
47352
|
-
keepCurrentModel: true,
|
|
47353
|
-
width: "100%",
|
|
47354
|
-
height: "100%",
|
|
47355
|
-
defaultValue: yamlData ?? "",
|
|
47356
|
-
onMount: (editor, m) => {
|
|
47357
|
-
editorRef.current = editor;
|
|
47358
|
-
monacoRef.current = m;
|
|
47359
|
-
try {
|
|
47360
|
-
isFocusedRef.current = !!editor.hasTextFocus?.();
|
|
47361
|
-
} catch {
|
|
47362
|
-
isFocusedRef.current = false;
|
|
47363
|
-
}
|
|
47364
|
-
editor.onDidFocusEditorText(() => {
|
|
47365
|
-
isFocusedRef.current = true;
|
|
47366
|
-
});
|
|
47367
|
-
editor.onDidBlurEditorText(() => {
|
|
47368
|
-
isFocusedRef.current = false;
|
|
47369
|
-
if (pendingExternalYamlRef.current !== null) {
|
|
47370
|
-
setYamlData(pendingExternalYamlRef.current);
|
|
47371
|
-
pendingExternalYamlRef.current = null;
|
|
47372
|
-
}
|
|
47373
|
-
});
|
|
47374
|
-
const uri = m.Uri.parse("inmemory://openapi-ui/form.yaml");
|
|
47375
|
-
let model = editor.getModel() || m.editor.getModel(uri);
|
|
47376
|
-
if (!model) {
|
|
47377
|
-
model = m.editor.createModel(yamlData ?? "", "yaml", uri);
|
|
47378
|
-
}
|
|
47379
|
-
if (model) {
|
|
47380
|
-
m.editor.setModelLanguage(model, "yaml");
|
|
47381
|
-
}
|
|
47382
|
-
},
|
|
47383
|
-
onChange: (value) => {
|
|
47384
|
-
if (isApplyingExternalUpdateRef.current) {
|
|
47385
|
-
isApplyingExternalUpdateRef.current = false;
|
|
47386
|
-
setYamlData(value || "");
|
|
47387
|
-
return;
|
|
47388
|
-
}
|
|
47389
|
-
try {
|
|
47390
|
-
onChange(parse(value || ""));
|
|
47391
|
-
} catch {
|
|
47392
|
-
}
|
|
47393
|
-
setYamlData(value || "");
|
|
47394
|
-
},
|
|
47395
|
-
theme: theme === "dark" ? "vs-dark" : theme === void 0 ? "vs-dark" : "vs",
|
|
47396
|
-
options: {
|
|
47397
|
-
theme: theme === "dark" ? "vs-dark" : theme === void 0 ? "vs-dark" : "vs"
|
|
47398
|
-
}
|
|
47399
|
-
}
|
|
47400
|
-
) });
|
|
47401
|
-
};
|
|
47402
|
-
|
|
47403
|
-
const BorderRadiusContainer = styled.div`
|
|
47404
47012
|
height: ${({ $designNewLayoutHeight }) => $designNewLayoutHeight ? `${$designNewLayoutHeight}px` : "75vh"};
|
|
47405
47013
|
border: 1px solid ${({ $colorBorder }) => $colorBorder};
|
|
47406
47014
|
border-radius: 8px;
|
|
@@ -47424,8 +47032,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47424
47032
|
font-size: 16px;
|
|
47425
47033
|
line-height: 24px;
|
|
47426
47034
|
`;
|
|
47427
|
-
const Styled$
|
|
47428
|
-
BorderRadiusContainer,
|
|
47035
|
+
const Styled$k = {
|
|
47036
|
+
BorderRadiusContainer: BorderRadiusContainer$1,
|
|
47429
47037
|
ControlsRowContainer: ControlsRowContainer$1,
|
|
47430
47038
|
BigText: BigText$1
|
|
47431
47039
|
};
|
|
@@ -47548,7 +47156,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47548
47156
|
};
|
|
47549
47157
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
47550
47158
|
contextHolder,
|
|
47551
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Styled$
|
|
47159
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.BorderRadiusContainer, { $designNewLayoutHeight: designNewLayoutHeight, $colorBorder: token.colorBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47552
47160
|
Ft,
|
|
47553
47161
|
{
|
|
47554
47162
|
defaultLanguage: "yaml",
|
|
@@ -47567,7 +47175,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47567
47175
|
}
|
|
47568
47176
|
}
|
|
47569
47177
|
) }),
|
|
47570
|
-
!readOnly && /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$
|
|
47178
|
+
!readOnly && /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.ControlsRowContainer, { $bgColor: token.colorPrimaryBg, $designNewLayout: designNewLayout, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Flex, { gap: designNewLayout ? 10 : 16, align: "center", children: [
|
|
47571
47179
|
/* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { type: "primary", onClick: onSubmit, loading: isLoading, children: "Submit" }),
|
|
47572
47180
|
backlink && /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { onClick: () => navigate(backlink), children: "Cancel" }),
|
|
47573
47181
|
/* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { onClick: handleReload, children: "Reload" })
|
|
@@ -47578,7 +47186,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47578
47186
|
open: !!error,
|
|
47579
47187
|
onOk: () => setError(void 0),
|
|
47580
47188
|
onCancel: () => setError(void 0),
|
|
47581
|
-
title: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Typography.Text, { type: "danger", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$
|
|
47189
|
+
title: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Typography.Text, { type: "danger", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$k.BigText, { children: "Error!" }) }),
|
|
47582
47190
|
cancelButtonProps: { style: { display: "none" } },
|
|
47583
47191
|
children: [
|
|
47584
47192
|
"An error has occurred: ",
|
|
@@ -47589,6 +47197,692 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47589
47197
|
] });
|
|
47590
47198
|
};
|
|
47591
47199
|
|
|
47200
|
+
/**
|
|
47201
|
+
* lodash (Custom Build) <https://lodash.com/>
|
|
47202
|
+
* Build: `lodash modularize exports="npm" -o ./`
|
|
47203
|
+
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
47204
|
+
* Released under MIT license <https://lodash.com/license>
|
|
47205
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
47206
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
47207
|
+
*/
|
|
47208
|
+
|
|
47209
|
+
/** Used as the `TypeError` message for "Functions" methods. */
|
|
47210
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
47211
|
+
|
|
47212
|
+
/** Used as references for various `Number` constants. */
|
|
47213
|
+
var NAN = 0 / 0;
|
|
47214
|
+
|
|
47215
|
+
/** `Object#toString` result references. */
|
|
47216
|
+
var symbolTag = '[object Symbol]';
|
|
47217
|
+
|
|
47218
|
+
/** Used to match leading and trailing whitespace. */
|
|
47219
|
+
var reTrim = /^\s+|\s+$/g;
|
|
47220
|
+
|
|
47221
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
47222
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
47223
|
+
|
|
47224
|
+
/** Used to detect binary string values. */
|
|
47225
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
47226
|
+
|
|
47227
|
+
/** Used to detect octal string values. */
|
|
47228
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
47229
|
+
|
|
47230
|
+
/** Built-in method references without a dependency on `root`. */
|
|
47231
|
+
var freeParseInt = parseInt;
|
|
47232
|
+
|
|
47233
|
+
/** Detect free variable `global` from Node.js. */
|
|
47234
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
47235
|
+
|
|
47236
|
+
/** Detect free variable `self`. */
|
|
47237
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
47238
|
+
|
|
47239
|
+
/** Used as a reference to the global object. */
|
|
47240
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
47241
|
+
|
|
47242
|
+
/** Used for built-in method references. */
|
|
47243
|
+
var objectProto = Object.prototype;
|
|
47244
|
+
|
|
47245
|
+
/**
|
|
47246
|
+
* Used to resolve the
|
|
47247
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
47248
|
+
* of values.
|
|
47249
|
+
*/
|
|
47250
|
+
var objectToString = objectProto.toString;
|
|
47251
|
+
|
|
47252
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
47253
|
+
var nativeMax = Math.max,
|
|
47254
|
+
nativeMin = Math.min;
|
|
47255
|
+
|
|
47256
|
+
/**
|
|
47257
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
47258
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
47259
|
+
*
|
|
47260
|
+
* @static
|
|
47261
|
+
* @memberOf _
|
|
47262
|
+
* @since 2.4.0
|
|
47263
|
+
* @category Date
|
|
47264
|
+
* @returns {number} Returns the timestamp.
|
|
47265
|
+
* @example
|
|
47266
|
+
*
|
|
47267
|
+
* _.defer(function(stamp) {
|
|
47268
|
+
* console.log(_.now() - stamp);
|
|
47269
|
+
* }, _.now());
|
|
47270
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
47271
|
+
*/
|
|
47272
|
+
var now = function() {
|
|
47273
|
+
return root.Date.now();
|
|
47274
|
+
};
|
|
47275
|
+
|
|
47276
|
+
/**
|
|
47277
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
47278
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
47279
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
47280
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
47281
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
47282
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
47283
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
47284
|
+
* calls to the debounced function return the result of the last `func`
|
|
47285
|
+
* invocation.
|
|
47286
|
+
*
|
|
47287
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
47288
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
47289
|
+
* is invoked more than once during the `wait` timeout.
|
|
47290
|
+
*
|
|
47291
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
47292
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
47293
|
+
*
|
|
47294
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
47295
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
47296
|
+
*
|
|
47297
|
+
* @static
|
|
47298
|
+
* @memberOf _
|
|
47299
|
+
* @since 0.1.0
|
|
47300
|
+
* @category Function
|
|
47301
|
+
* @param {Function} func The function to debounce.
|
|
47302
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
47303
|
+
* @param {Object} [options={}] The options object.
|
|
47304
|
+
* @param {boolean} [options.leading=false]
|
|
47305
|
+
* Specify invoking on the leading edge of the timeout.
|
|
47306
|
+
* @param {number} [options.maxWait]
|
|
47307
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
47308
|
+
* @param {boolean} [options.trailing=true]
|
|
47309
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
47310
|
+
* @returns {Function} Returns the new debounced function.
|
|
47311
|
+
* @example
|
|
47312
|
+
*
|
|
47313
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
47314
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
47315
|
+
*
|
|
47316
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
47317
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
47318
|
+
* 'leading': true,
|
|
47319
|
+
* 'trailing': false
|
|
47320
|
+
* }));
|
|
47321
|
+
*
|
|
47322
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
47323
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
47324
|
+
* var source = new EventSource('/stream');
|
|
47325
|
+
* jQuery(source).on('message', debounced);
|
|
47326
|
+
*
|
|
47327
|
+
* // Cancel the trailing debounced invocation.
|
|
47328
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
47329
|
+
*/
|
|
47330
|
+
function debounce(func, wait, options) {
|
|
47331
|
+
var lastArgs,
|
|
47332
|
+
lastThis,
|
|
47333
|
+
maxWait,
|
|
47334
|
+
result,
|
|
47335
|
+
timerId,
|
|
47336
|
+
lastCallTime,
|
|
47337
|
+
lastInvokeTime = 0,
|
|
47338
|
+
leading = false,
|
|
47339
|
+
maxing = false,
|
|
47340
|
+
trailing = true;
|
|
47341
|
+
|
|
47342
|
+
if (typeof func != 'function') {
|
|
47343
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
47344
|
+
}
|
|
47345
|
+
wait = toNumber(wait) || 0;
|
|
47346
|
+
if (isObject(options)) {
|
|
47347
|
+
leading = !!options.leading;
|
|
47348
|
+
maxing = 'maxWait' in options;
|
|
47349
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
47350
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
47351
|
+
}
|
|
47352
|
+
|
|
47353
|
+
function invokeFunc(time) {
|
|
47354
|
+
var args = lastArgs,
|
|
47355
|
+
thisArg = lastThis;
|
|
47356
|
+
|
|
47357
|
+
lastArgs = lastThis = undefined;
|
|
47358
|
+
lastInvokeTime = time;
|
|
47359
|
+
result = func.apply(thisArg, args);
|
|
47360
|
+
return result;
|
|
47361
|
+
}
|
|
47362
|
+
|
|
47363
|
+
function leadingEdge(time) {
|
|
47364
|
+
// Reset any `maxWait` timer.
|
|
47365
|
+
lastInvokeTime = time;
|
|
47366
|
+
// Start the timer for the trailing edge.
|
|
47367
|
+
timerId = setTimeout(timerExpired, wait);
|
|
47368
|
+
// Invoke the leading edge.
|
|
47369
|
+
return leading ? invokeFunc(time) : result;
|
|
47370
|
+
}
|
|
47371
|
+
|
|
47372
|
+
function remainingWait(time) {
|
|
47373
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
47374
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
47375
|
+
result = wait - timeSinceLastCall;
|
|
47376
|
+
|
|
47377
|
+
return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
|
|
47378
|
+
}
|
|
47379
|
+
|
|
47380
|
+
function shouldInvoke(time) {
|
|
47381
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
47382
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
47383
|
+
|
|
47384
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
47385
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
47386
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
47387
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
47388
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
47389
|
+
}
|
|
47390
|
+
|
|
47391
|
+
function timerExpired() {
|
|
47392
|
+
var time = now();
|
|
47393
|
+
if (shouldInvoke(time)) {
|
|
47394
|
+
return trailingEdge(time);
|
|
47395
|
+
}
|
|
47396
|
+
// Restart the timer.
|
|
47397
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
47398
|
+
}
|
|
47399
|
+
|
|
47400
|
+
function trailingEdge(time) {
|
|
47401
|
+
timerId = undefined;
|
|
47402
|
+
|
|
47403
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
47404
|
+
// debounced at least once.
|
|
47405
|
+
if (trailing && lastArgs) {
|
|
47406
|
+
return invokeFunc(time);
|
|
47407
|
+
}
|
|
47408
|
+
lastArgs = lastThis = undefined;
|
|
47409
|
+
return result;
|
|
47410
|
+
}
|
|
47411
|
+
|
|
47412
|
+
function cancel() {
|
|
47413
|
+
if (timerId !== undefined) {
|
|
47414
|
+
clearTimeout(timerId);
|
|
47415
|
+
}
|
|
47416
|
+
lastInvokeTime = 0;
|
|
47417
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
47418
|
+
}
|
|
47419
|
+
|
|
47420
|
+
function flush() {
|
|
47421
|
+
return timerId === undefined ? result : trailingEdge(now());
|
|
47422
|
+
}
|
|
47423
|
+
|
|
47424
|
+
function debounced() {
|
|
47425
|
+
var time = now(),
|
|
47426
|
+
isInvoking = shouldInvoke(time);
|
|
47427
|
+
|
|
47428
|
+
lastArgs = arguments;
|
|
47429
|
+
lastThis = this;
|
|
47430
|
+
lastCallTime = time;
|
|
47431
|
+
|
|
47432
|
+
if (isInvoking) {
|
|
47433
|
+
if (timerId === undefined) {
|
|
47434
|
+
return leadingEdge(lastCallTime);
|
|
47435
|
+
}
|
|
47436
|
+
if (maxing) {
|
|
47437
|
+
// Handle invocations in a tight loop.
|
|
47438
|
+
timerId = setTimeout(timerExpired, wait);
|
|
47439
|
+
return invokeFunc(lastCallTime);
|
|
47440
|
+
}
|
|
47441
|
+
}
|
|
47442
|
+
if (timerId === undefined) {
|
|
47443
|
+
timerId = setTimeout(timerExpired, wait);
|
|
47444
|
+
}
|
|
47445
|
+
return result;
|
|
47446
|
+
}
|
|
47447
|
+
debounced.cancel = cancel;
|
|
47448
|
+
debounced.flush = flush;
|
|
47449
|
+
return debounced;
|
|
47450
|
+
}
|
|
47451
|
+
|
|
47452
|
+
/**
|
|
47453
|
+
* Checks if `value` is the
|
|
47454
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
47455
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
47456
|
+
*
|
|
47457
|
+
* @static
|
|
47458
|
+
* @memberOf _
|
|
47459
|
+
* @since 0.1.0
|
|
47460
|
+
* @category Lang
|
|
47461
|
+
* @param {*} value The value to check.
|
|
47462
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
47463
|
+
* @example
|
|
47464
|
+
*
|
|
47465
|
+
* _.isObject({});
|
|
47466
|
+
* // => true
|
|
47467
|
+
*
|
|
47468
|
+
* _.isObject([1, 2, 3]);
|
|
47469
|
+
* // => true
|
|
47470
|
+
*
|
|
47471
|
+
* _.isObject(_.noop);
|
|
47472
|
+
* // => true
|
|
47473
|
+
*
|
|
47474
|
+
* _.isObject(null);
|
|
47475
|
+
* // => false
|
|
47476
|
+
*/
|
|
47477
|
+
function isObject(value) {
|
|
47478
|
+
var type = typeof value;
|
|
47479
|
+
return !!value && (type == 'object' || type == 'function');
|
|
47480
|
+
}
|
|
47481
|
+
|
|
47482
|
+
/**
|
|
47483
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
47484
|
+
* and has a `typeof` result of "object".
|
|
47485
|
+
*
|
|
47486
|
+
* @static
|
|
47487
|
+
* @memberOf _
|
|
47488
|
+
* @since 4.0.0
|
|
47489
|
+
* @category Lang
|
|
47490
|
+
* @param {*} value The value to check.
|
|
47491
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
47492
|
+
* @example
|
|
47493
|
+
*
|
|
47494
|
+
* _.isObjectLike({});
|
|
47495
|
+
* // => true
|
|
47496
|
+
*
|
|
47497
|
+
* _.isObjectLike([1, 2, 3]);
|
|
47498
|
+
* // => true
|
|
47499
|
+
*
|
|
47500
|
+
* _.isObjectLike(_.noop);
|
|
47501
|
+
* // => false
|
|
47502
|
+
*
|
|
47503
|
+
* _.isObjectLike(null);
|
|
47504
|
+
* // => false
|
|
47505
|
+
*/
|
|
47506
|
+
function isObjectLike(value) {
|
|
47507
|
+
return !!value && typeof value == 'object';
|
|
47508
|
+
}
|
|
47509
|
+
|
|
47510
|
+
/**
|
|
47511
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
47512
|
+
*
|
|
47513
|
+
* @static
|
|
47514
|
+
* @memberOf _
|
|
47515
|
+
* @since 4.0.0
|
|
47516
|
+
* @category Lang
|
|
47517
|
+
* @param {*} value The value to check.
|
|
47518
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
47519
|
+
* @example
|
|
47520
|
+
*
|
|
47521
|
+
* _.isSymbol(Symbol.iterator);
|
|
47522
|
+
* // => true
|
|
47523
|
+
*
|
|
47524
|
+
* _.isSymbol('abc');
|
|
47525
|
+
* // => false
|
|
47526
|
+
*/
|
|
47527
|
+
function isSymbol(value) {
|
|
47528
|
+
return typeof value == 'symbol' ||
|
|
47529
|
+
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
47530
|
+
}
|
|
47531
|
+
|
|
47532
|
+
/**
|
|
47533
|
+
* Converts `value` to a number.
|
|
47534
|
+
*
|
|
47535
|
+
* @static
|
|
47536
|
+
* @memberOf _
|
|
47537
|
+
* @since 4.0.0
|
|
47538
|
+
* @category Lang
|
|
47539
|
+
* @param {*} value The value to process.
|
|
47540
|
+
* @returns {number} Returns the number.
|
|
47541
|
+
* @example
|
|
47542
|
+
*
|
|
47543
|
+
* _.toNumber(3.2);
|
|
47544
|
+
* // => 3.2
|
|
47545
|
+
*
|
|
47546
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
47547
|
+
* // => 5e-324
|
|
47548
|
+
*
|
|
47549
|
+
* _.toNumber(Infinity);
|
|
47550
|
+
* // => Infinity
|
|
47551
|
+
*
|
|
47552
|
+
* _.toNumber('3.2');
|
|
47553
|
+
* // => 3.2
|
|
47554
|
+
*/
|
|
47555
|
+
function toNumber(value) {
|
|
47556
|
+
if (typeof value == 'number') {
|
|
47557
|
+
return value;
|
|
47558
|
+
}
|
|
47559
|
+
if (isSymbol(value)) {
|
|
47560
|
+
return NAN;
|
|
47561
|
+
}
|
|
47562
|
+
if (isObject(value)) {
|
|
47563
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
47564
|
+
value = isObject(other) ? (other + '') : other;
|
|
47565
|
+
}
|
|
47566
|
+
if (typeof value != 'string') {
|
|
47567
|
+
return value === 0 ? value : +value;
|
|
47568
|
+
}
|
|
47569
|
+
value = value.replace(reTrim, '');
|
|
47570
|
+
var isBinary = reIsBinary.test(value);
|
|
47571
|
+
return (isBinary || reIsOctal.test(value))
|
|
47572
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
47573
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
|
47574
|
+
}
|
|
47575
|
+
|
|
47576
|
+
var lodash_debounce = debounce;
|
|
47577
|
+
|
|
47578
|
+
const debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(lodash_debounce);
|
|
47579
|
+
|
|
47580
|
+
function useUnmount(func) {
|
|
47581
|
+
const funcRef = K.useRef(func);
|
|
47582
|
+
funcRef.current = func;
|
|
47583
|
+
K.useEffect(
|
|
47584
|
+
() => () => {
|
|
47585
|
+
funcRef.current();
|
|
47586
|
+
},
|
|
47587
|
+
[]
|
|
47588
|
+
);
|
|
47589
|
+
}
|
|
47590
|
+
|
|
47591
|
+
// src/useDebounceCallback/useDebounceCallback.ts
|
|
47592
|
+
function useDebounceCallback(func, delay = 500, options) {
|
|
47593
|
+
const debouncedFunc = K.useRef();
|
|
47594
|
+
useUnmount(() => {
|
|
47595
|
+
if (debouncedFunc.current) {
|
|
47596
|
+
debouncedFunc.current.cancel();
|
|
47597
|
+
}
|
|
47598
|
+
});
|
|
47599
|
+
const debounced = K.useMemo(() => {
|
|
47600
|
+
const debouncedFuncInstance = debounce$1(func, delay, options);
|
|
47601
|
+
const wrappedFunc = (...args) => {
|
|
47602
|
+
return debouncedFuncInstance(...args);
|
|
47603
|
+
};
|
|
47604
|
+
wrappedFunc.cancel = () => {
|
|
47605
|
+
debouncedFuncInstance.cancel();
|
|
47606
|
+
};
|
|
47607
|
+
wrappedFunc.isPending = () => {
|
|
47608
|
+
return !!debouncedFunc.current;
|
|
47609
|
+
};
|
|
47610
|
+
wrappedFunc.flush = () => {
|
|
47611
|
+
return debouncedFuncInstance.flush();
|
|
47612
|
+
};
|
|
47613
|
+
return wrappedFunc;
|
|
47614
|
+
}, [func, delay, options]);
|
|
47615
|
+
K.useEffect(() => {
|
|
47616
|
+
debouncedFunc.current = debounce$1(func, delay, options);
|
|
47617
|
+
}, [func, delay, options]);
|
|
47618
|
+
return debounced;
|
|
47619
|
+
}
|
|
47620
|
+
|
|
47621
|
+
function floorToDecimal(num, decimalPlaces) {
|
|
47622
|
+
const factor = 10 ** decimalPlaces;
|
|
47623
|
+
return Math.floor(num * factor) / factor;
|
|
47624
|
+
}
|
|
47625
|
+
const parseQuotaValue = (key, val) => {
|
|
47626
|
+
let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
|
|
47627
|
+
if (key === "cpu") {
|
|
47628
|
+
if (val.endsWith("m")) {
|
|
47629
|
+
numericValue /= 1e3;
|
|
47630
|
+
}
|
|
47631
|
+
return floorToDecimal(numericValue, 1);
|
|
47632
|
+
}
|
|
47633
|
+
if (val.endsWith("m")) {
|
|
47634
|
+
numericValue /= 1e3;
|
|
47635
|
+
} else if (val.endsWith("k")) {
|
|
47636
|
+
numericValue /= 1e6;
|
|
47637
|
+
} else if (val.endsWith("M")) {
|
|
47638
|
+
numericValue /= 1e3;
|
|
47639
|
+
} else if (val.endsWith("G")) {
|
|
47640
|
+
numericValue /= 1;
|
|
47641
|
+
} else if (val.endsWith("T")) {
|
|
47642
|
+
numericValue *= 1e3;
|
|
47643
|
+
} else if (val.endsWith("Ki")) {
|
|
47644
|
+
numericValue /= 1024;
|
|
47645
|
+
numericValue /= 1e6;
|
|
47646
|
+
} else if (val.endsWith("Mi")) {
|
|
47647
|
+
numericValue /= 1e3;
|
|
47648
|
+
numericValue /= 1e3;
|
|
47649
|
+
} else if (/^\d+(\.\d+)?$/.test(val)) {
|
|
47650
|
+
numericValue /= 1e9;
|
|
47651
|
+
} else {
|
|
47652
|
+
throw new Error("Invalid value");
|
|
47653
|
+
}
|
|
47654
|
+
return floorToDecimal(numericValue, 1);
|
|
47655
|
+
};
|
|
47656
|
+
const parseQuotaValueCpu = (val) => {
|
|
47657
|
+
if (typeof val === "string") {
|
|
47658
|
+
let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
|
|
47659
|
+
if (val.endsWith("m")) {
|
|
47660
|
+
numericValue /= 1e3;
|
|
47661
|
+
}
|
|
47662
|
+
return floorToDecimal(numericValue, 1);
|
|
47663
|
+
}
|
|
47664
|
+
return 0;
|
|
47665
|
+
};
|
|
47666
|
+
const parseQuotaValueMemoryAndStorage = (val) => {
|
|
47667
|
+
if (typeof val === "string") {
|
|
47668
|
+
let numericValue = parseFloat(val.replace(/[a-zA-Zа-яА-Я]/g, ""));
|
|
47669
|
+
if (val.endsWith("k")) {
|
|
47670
|
+
numericValue /= 1e6;
|
|
47671
|
+
} else if (val.endsWith("m")) {
|
|
47672
|
+
numericValue /= 1e3;
|
|
47673
|
+
} else if (val.endsWith("M")) {
|
|
47674
|
+
numericValue /= 1e3;
|
|
47675
|
+
} else if (val.endsWith("G")) {
|
|
47676
|
+
numericValue /= 1;
|
|
47677
|
+
} else if (val.endsWith("T")) {
|
|
47678
|
+
numericValue *= 1e3;
|
|
47679
|
+
} else if (val.endsWith("P")) {
|
|
47680
|
+
numericValue *= 1e6;
|
|
47681
|
+
} else if (val.endsWith("E")) {
|
|
47682
|
+
numericValue *= 1e9;
|
|
47683
|
+
} else if (val.endsWith("Ki")) {
|
|
47684
|
+
numericValue *= 1024 / 1e9;
|
|
47685
|
+
} else if (val.endsWith("Mi")) {
|
|
47686
|
+
numericValue /= 1048.576;
|
|
47687
|
+
} else if (val.endsWith("Gi")) {
|
|
47688
|
+
numericValue *= 1.073741824;
|
|
47689
|
+
} else if (val.endsWith("Ti")) {
|
|
47690
|
+
numericValue *= 1.099511628;
|
|
47691
|
+
} else if (val.endsWith("Pi")) {
|
|
47692
|
+
numericValue *= 1.125899907;
|
|
47693
|
+
} else if (val.endsWith("Ei")) {
|
|
47694
|
+
numericValue *= 1.152921505;
|
|
47695
|
+
} else if (val === "0") {
|
|
47696
|
+
return 0;
|
|
47697
|
+
} else {
|
|
47698
|
+
throw new Error("Invalid value");
|
|
47699
|
+
}
|
|
47700
|
+
return floorToDecimal(numericValue, 1);
|
|
47701
|
+
}
|
|
47702
|
+
return 0;
|
|
47703
|
+
};
|
|
47704
|
+
|
|
47705
|
+
const findAllPathsForObject = (obj, targetKey, targetValue, currentPath = []) => {
|
|
47706
|
+
let paths = [];
|
|
47707
|
+
if (typeof obj !== "object" || obj === null) {
|
|
47708
|
+
return paths;
|
|
47709
|
+
}
|
|
47710
|
+
if (obj[targetKey] === targetValue) {
|
|
47711
|
+
paths.push([...currentPath]);
|
|
47712
|
+
}
|
|
47713
|
+
for (const key in obj) {
|
|
47714
|
+
if (obj.hasOwnProperty(key)) {
|
|
47715
|
+
const value = obj[key];
|
|
47716
|
+
if (typeof value === "object" && value !== null) {
|
|
47717
|
+
const newPath = [...currentPath, key];
|
|
47718
|
+
const subPaths = findAllPathsForObject(value, targetKey, targetValue, newPath);
|
|
47719
|
+
paths = paths.concat(subPaths);
|
|
47720
|
+
}
|
|
47721
|
+
}
|
|
47722
|
+
}
|
|
47723
|
+
return paths;
|
|
47724
|
+
};
|
|
47725
|
+
const normalizeValuesForQuotasToNumber = (object, properties) => {
|
|
47726
|
+
const newObject = _$1.cloneDeep(object);
|
|
47727
|
+
const cpuPaths = findAllPathsForObject(properties, "type", "rangeInputCpu");
|
|
47728
|
+
const memoryPaths = findAllPathsForObject(properties, "type", "rangeInputMemory");
|
|
47729
|
+
memoryPaths.forEach((path) => {
|
|
47730
|
+
const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
|
|
47731
|
+
const value = _$1.get(newObject, cleanPath);
|
|
47732
|
+
if (value || value === 0) {
|
|
47733
|
+
_$1.set(newObject, cleanPath, parseQuotaValueMemoryAndStorage(value));
|
|
47734
|
+
}
|
|
47735
|
+
});
|
|
47736
|
+
cpuPaths.forEach((path) => {
|
|
47737
|
+
const cleanPath = path.filter((el) => typeof el === "string").filter((el) => el !== "properties");
|
|
47738
|
+
const value = _$1.get(newObject, cleanPath);
|
|
47739
|
+
if (value || value === 0) {
|
|
47740
|
+
_$1.set(newObject, cleanPath, parseQuotaValueCpu(value));
|
|
47741
|
+
}
|
|
47742
|
+
});
|
|
47743
|
+
return newObject;
|
|
47744
|
+
};
|
|
47745
|
+
|
|
47746
|
+
const getAllPathsFromObj = (obj, prefix = []) => {
|
|
47747
|
+
const entries = Array.isArray(obj) ? obj.map((value, index) => [index, value]) : Object.entries(obj);
|
|
47748
|
+
return entries.flatMap(([key, value]) => {
|
|
47749
|
+
const currentPath = [...prefix, key];
|
|
47750
|
+
return typeof value === "object" && value !== null ? [currentPath, ...getAllPathsFromObj(value, currentPath)] : [currentPath];
|
|
47751
|
+
});
|
|
47752
|
+
};
|
|
47753
|
+
|
|
47754
|
+
const getPrefixSubarrays = (arr) => {
|
|
47755
|
+
return arr.map((_, index) => arr.slice(0, index + 1));
|
|
47756
|
+
};
|
|
47757
|
+
|
|
47758
|
+
const deepMerge = (a, b) => {
|
|
47759
|
+
const result = { ...a };
|
|
47760
|
+
for (const key of Object.keys(b)) {
|
|
47761
|
+
const aVal = a[key];
|
|
47762
|
+
const bVal = b[key];
|
|
47763
|
+
if (aVal !== null && bVal !== null && typeof aVal === "object" && typeof bVal === "object" && !Array.isArray(aVal) && !Array.isArray(bVal)) {
|
|
47764
|
+
result[key] = deepMerge(aVal, bVal);
|
|
47765
|
+
} else {
|
|
47766
|
+
result[key] = bVal;
|
|
47767
|
+
}
|
|
47768
|
+
}
|
|
47769
|
+
return result;
|
|
47770
|
+
};
|
|
47771
|
+
|
|
47772
|
+
const BorderRadiusContainer = styled.div`
|
|
47773
|
+
height: 100%;
|
|
47774
|
+
border: 1px solid ${({ $colorBorder }) => $colorBorder};
|
|
47775
|
+
border-radius: 8px;
|
|
47776
|
+
padding: 2px;
|
|
47777
|
+
|
|
47778
|
+
.monaco-editor,
|
|
47779
|
+
.overflow-guard {
|
|
47780
|
+
border-radius: 8px;
|
|
47781
|
+
}
|
|
47782
|
+
`;
|
|
47783
|
+
const Styled$j = {
|
|
47784
|
+
BorderRadiusContainer
|
|
47785
|
+
};
|
|
47786
|
+
|
|
47787
|
+
const YamlEditor = ({ theme, currentValues, onChange, editorUri }) => {
|
|
47788
|
+
const { token } = antd.theme.useToken();
|
|
47789
|
+
const [yamlData, setYamlData] = K.useState("");
|
|
47790
|
+
const editorRef = K.useRef(null);
|
|
47791
|
+
const monacoRef = K.useRef(null);
|
|
47792
|
+
const isFocusedRef = K.useRef(false);
|
|
47793
|
+
const pendingExternalYamlRef = K.useRef(null);
|
|
47794
|
+
const isApplyingExternalUpdateRef = K.useRef(false);
|
|
47795
|
+
K.useEffect(() => {
|
|
47796
|
+
const next = stringify(currentValues, {
|
|
47797
|
+
// Use literal block scalar for multiline strings
|
|
47798
|
+
blockQuote: "literal",
|
|
47799
|
+
// Preserve line breaks
|
|
47800
|
+
lineWidth: 0,
|
|
47801
|
+
// Use double quotes for strings that need escaping
|
|
47802
|
+
doubleQuotedAsJSON: false
|
|
47803
|
+
});
|
|
47804
|
+
if (isFocusedRef.current) {
|
|
47805
|
+
pendingExternalYamlRef.current = next ?? "";
|
|
47806
|
+
return;
|
|
47807
|
+
}
|
|
47808
|
+
setYamlData(next ?? "");
|
|
47809
|
+
}, [currentValues]);
|
|
47810
|
+
K.useEffect(() => {
|
|
47811
|
+
const editor = editorRef.current;
|
|
47812
|
+
const monaco = monacoRef.current;
|
|
47813
|
+
if (editor && monaco) {
|
|
47814
|
+
if (isFocusedRef.current) return;
|
|
47815
|
+
const uri = monaco.Uri.parse(editorUri);
|
|
47816
|
+
let model = editor.getModel() || monaco.editor.getModel(uri);
|
|
47817
|
+
if (!model) {
|
|
47818
|
+
model = monaco.editor.createModel(yamlData ?? "", "yaml", uri);
|
|
47819
|
+
}
|
|
47820
|
+
if (model) {
|
|
47821
|
+
monaco.editor.setModelLanguage(model, "yaml");
|
|
47822
|
+
const current = model.getValue();
|
|
47823
|
+
if ((yamlData ?? "") !== current) {
|
|
47824
|
+
isApplyingExternalUpdateRef.current = true;
|
|
47825
|
+
model.setValue(yamlData ?? "");
|
|
47826
|
+
}
|
|
47827
|
+
}
|
|
47828
|
+
}
|
|
47829
|
+
}, [yamlData, editorUri]);
|
|
47830
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$j.BorderRadiusContainer, { $colorBorder: token.colorBorder, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47831
|
+
Ft,
|
|
47832
|
+
{
|
|
47833
|
+
language: "yaml",
|
|
47834
|
+
path: editorUri,
|
|
47835
|
+
keepCurrentModel: true,
|
|
47836
|
+
width: "100%",
|
|
47837
|
+
height: "100%",
|
|
47838
|
+
defaultValue: yamlData ?? "",
|
|
47839
|
+
onMount: (editor, m) => {
|
|
47840
|
+
editorRef.current = editor;
|
|
47841
|
+
monacoRef.current = m;
|
|
47842
|
+
try {
|
|
47843
|
+
isFocusedRef.current = !!editor.hasTextFocus?.();
|
|
47844
|
+
} catch {
|
|
47845
|
+
isFocusedRef.current = false;
|
|
47846
|
+
}
|
|
47847
|
+
editor.onDidFocusEditorText(() => {
|
|
47848
|
+
isFocusedRef.current = true;
|
|
47849
|
+
});
|
|
47850
|
+
editor.onDidBlurEditorText(() => {
|
|
47851
|
+
isFocusedRef.current = false;
|
|
47852
|
+
if (pendingExternalYamlRef.current !== null) {
|
|
47853
|
+
setYamlData(pendingExternalYamlRef.current);
|
|
47854
|
+
pendingExternalYamlRef.current = null;
|
|
47855
|
+
}
|
|
47856
|
+
});
|
|
47857
|
+
const uri = m.Uri.parse("inmemory://openapi-ui/form.yaml");
|
|
47858
|
+
let model = editor.getModel() || m.editor.getModel(uri);
|
|
47859
|
+
if (!model) {
|
|
47860
|
+
model = m.editor.createModel(yamlData ?? "", "yaml", uri);
|
|
47861
|
+
}
|
|
47862
|
+
if (model) {
|
|
47863
|
+
m.editor.setModelLanguage(model, "yaml");
|
|
47864
|
+
}
|
|
47865
|
+
},
|
|
47866
|
+
onChange: (value) => {
|
|
47867
|
+
if (isApplyingExternalUpdateRef.current) {
|
|
47868
|
+
isApplyingExternalUpdateRef.current = false;
|
|
47869
|
+
setYamlData(value || "");
|
|
47870
|
+
return;
|
|
47871
|
+
}
|
|
47872
|
+
try {
|
|
47873
|
+
onChange(parse(value || ""));
|
|
47874
|
+
} catch {
|
|
47875
|
+
}
|
|
47876
|
+
setYamlData(value || "");
|
|
47877
|
+
},
|
|
47878
|
+
theme: theme === "dark" ? "vs-dark" : theme === void 0 ? "vs-dark" : "vs",
|
|
47879
|
+
options: {
|
|
47880
|
+
theme: theme === "dark" ? "vs-dark" : theme === void 0 ? "vs-dark" : "vs"
|
|
47881
|
+
}
|
|
47882
|
+
}
|
|
47883
|
+
) });
|
|
47884
|
+
};
|
|
47885
|
+
|
|
47592
47886
|
const getStringByName = (name) => {
|
|
47593
47887
|
if (typeof name === "string") {
|
|
47594
47888
|
return name;
|