@epam/ai-dial-toolset-editor 1.3.0-dev.29 → 1.3.0-dev.290

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/index.js CHANGED
@@ -1,25 +1,64 @@
1
- import { DEFAULT_DEPLOYMENT_VERSION as e, DeploymentCreationFieldErrorCode as t, EntityEditor as n, MetadataField as r, MetadataForm as i, SEMVER_VERSION_PATTERN as a, useMetadataForm as o, validateDeploymentCreationFields as s } from "@epam/ai-dial-builder-form";
2
- import { ToolsetAuthTypes as c, ToolsetCredentialsLevel as l, WithLogin as u, dialFileToAttachment as d, getApiErrorDetails as f } from "@epam/ai-dial-chat-hooks";
3
- import { CopyButton as p, ENTITY_DESCRIPTION_MAX_LENGTH as m, ENTITY_NAME_MAX_LENGTH as h, TAG_INPUT_TAG_CLASS_NAME as g, TextRefinementField as _, mergeClasses as v, useCodeCopy as y, useTextRefinement as b } from "@epam/ai-dial-chat-shared";
4
- import { memo as x, useCallback as S, useEffect as C, useMemo as w, useRef as T, useState as E } from "react";
5
- import { IconBrandOauth as ee, IconKey as te, IconLockOff as D, IconLogin as ne, IconLogout as re } from "@tabler/icons-react";
6
- import { jsx as O, jsxs as k } from "react/jsx-runtime";
7
- import { ConfirmationPopup as ie, ConfirmationPopupVariant as ae, DIAL_ICON_SIZE as A, DIAL_KIT_ICON_STROKE as j, Input as M, NeutralButton as N, PasswordInput as P, Radio as F, RadioGroup as I, SegmentedControl as L, Select as oe, TagInput as R } from "@epam/ai-dial-ui-kit";
1
+ import { DEFAULT_DEPLOYMENT_VERSION as e, DeploymentCreationFieldErrorCode as t, EntityEditor as n, MetadataField as r, MetadataForm as i, useMetadataForm as a, validateDeploymentCreationFields as o } from "@epam/ai-dial-builder-form";
2
+ import { ToolsetAuthTypes as s, ToolsetCredentialsLevel as c, WithLogin as l, getApiErrorDetails as ee } from "@epam/ai-dial-chat-hooks";
3
+ import { CopyButton as u, ENTITY_DESCRIPTION_MAX_LENGTH as d, ENTITY_NAME_MAX_LENGTH as f, TAG_INPUT_TAG_CLASS_NAME as p, TextRefinementField as m, buildCssVars as h, mergeClasses as g, useCodeCopy as _, useTextRefinement as v } from "@epam/ai-dial-chat-shared";
4
+ import { memo as y, useCallback as b, useEffect as x, useMemo as S, useRef as C, useState as w } from "react";
5
+ import { IconBrandOauth as T, IconKey as E, IconLockOff as te, IconLogin as ne, IconLogout as re } from "@tabler/icons-react";
6
+ import { CaptionText as D, ConfirmationPopup as ie, ConfirmationPopupVariant as ae, DIAL_ICON_SIZE as O, DIAL_KIT_ICON_STROKE as k, Input as A, LiveRegion as oe, LiveRegionElement as j, NeutralButton as se, PasswordInput as M, Radio as N, RadioGroup as P, SegmentedControl as ce, Select as F, TagInput as I } from "@epam/ai-dial-ui-kit";
7
+ import { jsx as L, jsxs as R } from "react/jsx-runtime";
8
8
  //#region src/constants/public-class-names.ts
9
- var se = {
9
+ var le = {
10
10
  metadataSection: "dial-toolset-editor-metadata-section",
11
11
  setupSection: "dial-toolset-editor-setup-section"
12
12
  }, z = /* @__PURE__ */ function(e) {
13
13
  return e.Http = "HTTP", e.Sse = "SSE", e;
14
- }({}), B = e, ce = { validateVersionPattern: a }, V = {
15
- [c.OAuth]: ee,
16
- [c.ApiKey]: te,
17
- [c.None]: D
18
- }, le = () => ({
19
- authenticationType: c.None,
20
- withLogin: u.WithoutLogin,
14
+ }({}), B = e, ue = {
15
+ name: {
16
+ label: "Name",
17
+ placeholder: "Enter name"
18
+ },
19
+ description: {
20
+ label: "Description",
21
+ placeholder: "Describe what this toolset does"
22
+ },
23
+ iconUrl: {
24
+ label: "Avatar",
25
+ addAvatarLabel: "Add avatar",
26
+ captionText: "PNG, JPG or SVG (max 1 MB)"
27
+ },
28
+ version: {
29
+ label: "Version",
30
+ placeholder: "e.g. 1.0.0"
31
+ },
32
+ topics: {
33
+ label: "Tags",
34
+ placeholder: "Add tags, comma separated"
35
+ },
36
+ otherLocales: {
37
+ summaryLabel: "Locales",
38
+ addLabel: "Add locales",
39
+ editLabel: "Edit locales",
40
+ popupTitle: "Add locale",
41
+ addLocaleLabel: "Add locale",
42
+ localeRowLabel: "Locale",
43
+ languageLabel: "Language",
44
+ nameLabel: "Name",
45
+ namePlaceholder: "Enter name",
46
+ descriptionLabel: "About",
47
+ descriptionPlaceholder: "Enter brief description",
48
+ deleteAriaLabel: "Delete locale",
49
+ cancelLabel: "Cancel",
50
+ saveLabel: "Save"
51
+ },
52
+ ariaLabel: "General"
53
+ }, V = {
54
+ [s.OAuth]: T,
55
+ [s.ApiKey]: E,
56
+ [s.None]: te
57
+ }, H = () => ({
58
+ authenticationType: s.None,
59
+ withLogin: l.WithoutLogin,
21
60
  isLoggedIn: !1
22
- }), H = () => ({
61
+ }), de = () => ({
23
62
  name: "",
24
63
  version: B,
25
64
  iconUrl: "",
@@ -29,7 +68,7 @@ var se = {
29
68
  endpoint: "",
30
69
  protocol: z.Http,
31
70
  allowedTools: [],
32
- auth: le()
71
+ auth: H()
33
72
  }), U = (e) => {
34
73
  if (!/^https?:\/\//.test(e) || e.endsWith(".") || e.endsWith("//")) return !1;
35
74
  try {
@@ -50,262 +89,190 @@ var se = {
50
89
  if (U(t)) return t;
51
90
  }
52
91
  return t;
53
- }, q = (e) => !e?.trim() || W(e), J = (e, t = !1) => e.isLoggedIn ? !0 : e.authenticationType === c.ApiKey ? e.keyHeader?.trim() ? e.withLogin === u.WithoutLogin ? !0 : !!(e.keyHeader?.trim() && e.apiKey?.trim()) : !1 : e.authenticationType === c.OAuth && e.withLogin === u.WithConfig ? !!e.clientId?.trim() && (t || !!e.clientSecret?.trim()) && q(e.authorizationEndpoint) && q(e.tokenEndpoint) : !0, ue = (e, t = !1) => Object.keys(s(e, ce)).length === 0 && W(e.endpoint) && J(e.auth, t), Y = new Set([
92
+ }, q = (e, t = !1) => e.isLoggedIn ? !0 : e.authenticationType === s.ApiKey ? e.keyHeader?.trim() ? e.withLogin === l.WithoutLogin || !!(e.keyHeader?.trim() && e.apiKey?.trim()) : !1 : e.authenticationType === s.OAuth && e.withLogin === l.WithConfig ? !!e.clientId?.trim() && (t || !!e.clientSecret?.trim()) && W(e.authorizationEndpoint ?? "") && W(e.tokenEndpoint ?? "") : !0, fe = (e, t = !1) => Object.keys(o(e, { validateVersionPattern: !0 })).length === 0 && W(e.endpoint) && q(e.auth, t), J = /* @__PURE__ */ new Set([
54
93
  "name",
55
94
  "description",
56
95
  "iconUrl",
57
96
  "version",
58
97
  "topics",
59
98
  "otherLocales"
60
- ]), de = (e) => ({
99
+ ]), pe = (e) => ({
61
100
  name: e.name,
62
101
  description: e.description,
63
102
  iconUrl: e.iconUrl,
64
103
  version: e.version,
65
104
  topics: e.topics,
66
105
  otherLocales: e.otherLocales
67
- }), fe = (e) => {
106
+ }), me = (e) => {
68
107
  let t = {}, n = {};
69
- for (let [r, i] of Object.entries(e)) (Y.has(r) ? t : n)[r] = i;
108
+ for (let [r, i] of Object.entries(e)) (J.has(r) ? t : n)[r] = i;
70
109
  return {
71
110
  metadata: t,
72
111
  setup: n
73
112
  };
74
- }, pe = {
75
- name: {
76
- label: "Name",
77
- placeholder: "Enter name"
78
- },
79
- description: {
80
- label: "Description",
81
- placeholder: "Describe what this toolset does"
82
- },
83
- iconUrl: {
84
- label: "Avatar",
85
- addAvatarLabel: "Add avatar",
86
- captionText: "PNG, JPG or SVG (max 1 MB)"
87
- },
88
- version: {
89
- label: "Version",
90
- placeholder: "e.g. 1.0.0"
91
- },
92
- topics: {
93
- label: "Tags",
94
- placeholder: "Add tags, comma separated"
95
- },
96
- otherLocales: {
97
- summaryLabel: "Locales",
98
- addLabel: "Add locales",
99
- editLabel: "Edit locales",
100
- popupTitle: "Add locale",
101
- addLocaleLabel: "Add locale",
102
- localeRowLabel: "Locale",
103
- languageLabel: "Language",
104
- nameLabel: "Name",
105
- namePlaceholder: "Enter name",
106
- descriptionLabel: "About",
107
- descriptionPlaceholder: "Enter brief description",
108
- deleteAriaLabel: "Delete locale",
109
- cancelLabel: "Cancel",
110
- saveLabel: "Save"
111
- },
112
- ariaLabel: "General"
113
- }, me = ({ form: e, errors: t, bucket: n, FileManagerModal: r, resolveIconUrl: a, allowedMimeTypes: o, maxFileSizeBytes: s, availableLocaleOptions: c, onChange: l, onNameBlur: u, onVersionBlur: f, renderDescription: p, labels: m }) => {
114
- let h = S((e) => {
115
- let [t] = e.files;
116
- return (t ? d(t, n, { resolvePreviewUrl: a }) : null)?.url;
117
- }, [n, a]);
118
- return /* @__PURE__ */ O(i, {
119
- values: e,
120
- errors: t,
121
- onChange: l,
122
- onNameBlur: u,
123
- onVersionBlur: f,
124
- avatarPicker: w(() => ({
125
- bucket: n,
126
- FileManagerModal: r,
127
- resolveIconUrl: a,
128
- resolveAttachedIconUrl: h,
129
- allowedMimeTypes: o,
130
- maxFileSizeBytes: s
131
- }), [
132
- n,
133
- r,
134
- a,
135
- h,
136
- o,
137
- s
138
- ]),
139
- availableLocaleOptions: c,
140
- renderDescription: p,
141
- labels: w(() => ({
142
- form: m?.form ?? pe,
143
- avatarPicker: m?.avatarPicker
144
- }), [m?.form, m?.avatarPicker])
145
- });
146
- }, X = /* @__PURE__ */ function(e) {
113
+ }, Y = /* @__PURE__ */ function(e) {
147
114
  return e.Success = "success", e.Cancelled = "cancelled", e.PopupBlocked = "popup-blocked", e.InvalidConfig = "invalid-config", e.Failed = "failed", e;
148
- }({}), Z = (e) => e === c.None ? u.WithoutLogin : u.WithLogin, Q = (e, t) => e === c.None ? t?.typeNone ?? "Open access" : e === c.OAuth ? t?.typeOAuth ?? "OAuth" : t?.typeApiKey ?? "API Key", he = ({ auth: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, endpoint: a, authActions: o, onOAuthLogin: s, onNotifySuccess: d, onNotifyError: p, onAuthChange: m, onEnsureSaved: h, labels: _ }) => {
149
- let [v, y] = E(!1), [b, x] = E(!1), S = e.isLoggedIn || n || v, C = W(a) && J(e, i) && !S, w = (t) => {
150
- S || t === e.authenticationType || m({
115
+ }({}), he = { openAccessDescription: "_openAccessDescription_1ltst_1" }, X = "toolset-client-secret-keep-caption", ge = (e) => `******${e}`, _e = (e) => e === s.None ? l.WithoutLogin : l.WithLogin, Z = (e, t) => e === s.None ? t?.typeNone ?? "Open access" : e === s.OAuth ? t?.typeOAuth ?? "OAuth" : t?.typeApiKey ?? "API Key", Q = ({ auth: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, endpoint: a, authActions: o, onOAuthLogin: u, onNotifySuccess: d, onNotifyError: f, onAuthChange: m, onEnsureSaved: h, labels: _, titleClassName: v = "dial-h3-text", openAccessDescriptionClassName: y = "dial-small-text" }) => {
116
+ let [b, x] = w(!1), [S, C] = w(!1), T = e.isLoggedIn || n || b, E = i && e.clientSecretHint && !e.clientSecret ? e.clientSecretHint : void 0, te = W(a) && q(e, i) && !T, oe = (t) => {
117
+ T || t === e.authenticationType || m({
151
118
  authenticationType: t,
152
- withLogin: Z(t)
119
+ withLogin: _e(t)
153
120
  });
154
- }, T = (e) => {
121
+ }, j = (e) => {
155
122
  m({ withLogin: e });
156
- }, ee = (e) => {
123
+ }, P = (e) => {
157
124
  switch (e.auth != null && m(e.auth), e.status) {
158
- case X.Success:
125
+ case Y.Success:
159
126
  m({ isLoggedIn: !0 }), d(_?.loginSuccessMessage ?? "Successfully logged in.");
160
127
  return;
161
- case X.PopupBlocked:
162
- p(_?.errorPopupBlocked ?? "The login popup was blocked by your browser. Please allow popups for this site and try again.");
128
+ case Y.PopupBlocked:
129
+ f(_?.errorPopupBlocked ?? "The login popup was blocked by your browser. Please allow popups for this site and try again.");
163
130
  return;
164
- case X.InvalidConfig:
165
- p(_?.errorOAuthConfigMissing ?? "The OAuth provider did not return a valid client configuration. Please check the endpoint or contact your administrator.");
131
+ case Y.InvalidConfig:
132
+ f(_?.errorOAuthConfigMissing ?? "The OAuth provider did not return a valid client configuration. Please check the endpoint or contact your administrator.");
166
133
  return;
167
- case X.Failed:
168
- p(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", e.traceId);
134
+ case Y.Failed:
135
+ f(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", e.traceId);
169
136
  return;
170
- case X.Cancelled: return;
137
+ case Y.Cancelled: return;
171
138
  }
172
- }, te = async () => {
173
- if (!C) return;
174
- if (e.authenticationType === c.OAuth) {
175
- y(!0);
139
+ }, F = async () => {
140
+ if (!te) return;
141
+ if (e.authenticationType === s.OAuth) {
142
+ x(!0);
176
143
  try {
177
- ee(await s({
144
+ P(await u({
178
145
  auth: e,
179
146
  ensureSaved: h
180
147
  }));
181
148
  } finally {
182
- y(!1);
149
+ x(!1);
183
150
  }
184
151
  return;
185
152
  }
186
153
  let t = await h();
187
154
  if (t) {
188
- y(!0);
155
+ x(!0);
189
156
  try {
190
157
  let n = {
191
158
  url: t,
192
- credentialsLevel: l.User,
159
+ credentialsLevel: c.User,
193
160
  authenticationType: e.authenticationType,
194
161
  apiKey: e.apiKey?.trim()
195
162
  };
196
163
  await o.login(t, n), m({ isLoggedIn: !0 }), d(_?.loginSuccessMessage ?? "Successfully logged in.");
197
164
  } catch (e) {
198
- let { traceId: t } = await f(e);
199
- p(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
165
+ let { traceId: t } = await ee(e);
166
+ f(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
200
167
  } finally {
201
- y(!1);
168
+ x(!1);
202
169
  }
203
170
  }
204
- }, D = async () => {
205
- y(!0);
171
+ }, le = async () => {
172
+ x(!0);
206
173
  try {
207
174
  let t = {
208
175
  url: r,
209
- credentialsLevel: l.User,
176
+ credentialsLevel: c.User,
210
177
  authenticationType: e.authenticationType
211
178
  };
212
- await o.logout(r, t), m({ isLoggedIn: !1 }), x(!1), d(_?.logoutSuccessMessage ?? "Successfully logged out.");
179
+ await o.logout(r, t), m({ isLoggedIn: !1 }), C(!1), d(_?.logoutSuccessMessage ?? "Successfully logged out.");
213
180
  } catch (e) {
214
- let { traceId: t } = await f(e);
215
- p(_?.errorLogoutFailed ?? "Failed to log out. Please try again.", t);
181
+ let { traceId: t } = await ee(e);
182
+ f(_?.errorLogoutFailed ?? "Failed to log out. Please try again.", t);
216
183
  } finally {
217
- y(!1);
184
+ x(!1);
218
185
  }
219
- }, I = () => e.isLoggedIn ? /* @__PURE__ */ O("div", {
186
+ }, z = () => e.isLoggedIn ? /* @__PURE__ */ L("div", {
220
187
  className: "flex",
221
- children: /* @__PURE__ */ O(N, {
188
+ children: /* @__PURE__ */ L(se, {
222
189
  label: _?.logOutLabel ?? "Log out",
223
- iconBefore: /* @__PURE__ */ O(re, {
224
- size: A.MD,
225
- stroke: j
190
+ iconBefore: /* @__PURE__ */ L(re, {
191
+ size: O.MD,
192
+ stroke: k
226
193
  }),
227
- onClick: () => x(!0),
228
- disabled: n || v
194
+ onClick: () => C(!0),
195
+ disabled: n || b
229
196
  })
230
- }) : /* @__PURE__ */ O("div", {
197
+ }) : /* @__PURE__ */ L("div", {
231
198
  className: "flex",
232
- children: /* @__PURE__ */ O(N, {
199
+ children: /* @__PURE__ */ L(se, {
233
200
  label: _?.logInLabel ?? "Log in",
234
- iconBefore: /* @__PURE__ */ O(ne, {
235
- size: A.MD,
236
- stroke: j
201
+ iconBefore: /* @__PURE__ */ L(ne, {
202
+ size: O.MD,
203
+ stroke: k
237
204
  }),
238
- onClick: te,
239
- disabled: !C
205
+ onClick: F,
206
+ disabled: !te
240
207
  })
241
208
  });
242
- return /* @__PURE__ */ k("section", {
209
+ return /* @__PURE__ */ R("section", {
243
210
  className: "flex flex-col gap-2",
244
211
  children: [
245
- /* @__PURE__ */ O("h3", {
246
- className: "dial-h3-text",
212
+ /* @__PURE__ */ L("h3", {
213
+ className: v,
247
214
  children: _?.sectionTitle ?? "Authentication"
248
215
  }),
249
- /* @__PURE__ */ O(L, {
216
+ /* @__PURE__ */ L(ce, {
250
217
  "aria-label": _?.sectionTitle ?? "Authentication",
251
218
  value: e.authenticationType,
252
- onChange: (e) => w(e),
219
+ onChange: (e) => oe(e),
253
220
  segmentClassName: "px-2",
254
221
  items: [
255
- c.None,
256
- c.OAuth,
257
- c.ApiKey
222
+ s.None,
223
+ s.OAuth,
224
+ s.ApiKey
258
225
  ].map((t) => {
259
226
  let n = V[t];
260
227
  return {
261
228
  value: t,
262
- label: /* @__PURE__ */ k("div", {
229
+ label: /* @__PURE__ */ R("div", {
263
230
  className: "flex items-center gap-2",
264
- children: [/* @__PURE__ */ O(n, {
231
+ children: [/* @__PURE__ */ L(n, {
265
232
  className: "shrink-0",
266
- size: A.SM,
267
- stroke: j,
233
+ size: O.SM,
234
+ stroke: k,
268
235
  "aria-hidden": !0
269
- }), /* @__PURE__ */ O("span", {
236
+ }), /* @__PURE__ */ L("span", {
270
237
  className: "sr-only desktop:not-sr-only",
271
- children: Q(t, _)
238
+ children: Z(t, _)
272
239
  })]
273
240
  }),
274
- disabled: S && e.authenticationType !== t
241
+ disabled: T && e.authenticationType !== t
275
242
  };
276
243
  })
277
244
  }),
278
- e.authenticationType === c.None && /* @__PURE__ */ O("p", {
279
- className: "dial-small-text pt-2 text-secondary",
245
+ e.authenticationType === s.None && /* @__PURE__ */ L("p", {
246
+ className: g("pt-2", y, he.openAccessDescription),
280
247
  children: _?.openAccessDescription ?? "Open endpoint, no credentials"
281
248
  }),
282
- e.authenticationType === c.OAuth && /* @__PURE__ */ k("div", {
249
+ e.authenticationType === s.OAuth && /* @__PURE__ */ R("div", {
283
250
  className: "flex flex-col gap-3 pt-2",
284
251
  children: [
285
- /* @__PURE__ */ k("div", {
252
+ /* @__PURE__ */ R("div", {
286
253
  className: "flex flex-col gap-2",
287
- children: [/* @__PURE__ */ O(F, {
254
+ children: [/* @__PURE__ */ L(N, {
288
255
  name: "oauth-login-mode",
289
256
  id: "oauth-with-login",
290
- value: u.WithLogin,
257
+ value: l.WithLogin,
291
258
  labelProps: { label: _?.withLoginOAuthLabel ?? "Standard login" },
292
- isSelected: e.withLogin === u.WithLogin,
293
- disabled: S,
294
- onChange: T
295
- }), /* @__PURE__ */ O(F, {
259
+ isSelected: e.withLogin === l.WithLogin,
260
+ disabled: T,
261
+ onChange: j
262
+ }), /* @__PURE__ */ L(N, {
296
263
  name: "oauth-login-mode",
297
264
  id: "oauth-with-config",
298
- value: u.WithConfig,
265
+ value: l.WithConfig,
299
266
  labelProps: { label: _?.withConfigOAuthLabel ?? "Custom login" },
300
- isSelected: e.withLogin === u.WithConfig,
301
- disabled: S,
302
- onChange: T
267
+ isSelected: e.withLogin === l.WithConfig,
268
+ disabled: T,
269
+ onChange: j
303
270
  })]
304
271
  }),
305
- e.withLogin === u.WithConfig && /* @__PURE__ */ k("div", {
272
+ e.withLogin === l.WithConfig && /* @__PURE__ */ R("div", {
306
273
  className: "flex flex-col gap-3",
307
274
  children: [
308
- /* @__PURE__ */ O(M, {
275
+ /* @__PURE__ */ L(A, {
309
276
  id: "toolset-client-id",
310
277
  value: e.clientId ?? "",
311
278
  onChange: (e) => m({ clientId: e ?? "" }),
@@ -316,83 +283,96 @@ var se = {
316
283
  placeholder: _?.clientIdPlaceholder ?? "Enter client ID",
317
284
  error: t.clientId || void 0,
318
285
  invalid: !!t.clientId,
319
- disabled: S
286
+ disabled: T
320
287
  }),
321
- /* @__PURE__ */ O(P, {
322
- id: "toolset-client-secret",
323
- value: e.clientSecret ?? "",
324
- onChange: (e) => m({ clientSecret: e ?? "" }),
325
- labelProps: {
326
- label: _?.clientSecretLabel ?? "Client secret",
327
- required: !i
328
- },
329
- placeholder: _?.clientSecretPlaceholder ?? "Enter client secret",
330
- showPasswordLabel: _?.showClientSecretLabel ?? "Show client secret",
331
- hidePasswordLabel: _?.hideClientSecretLabel ?? "Hide client secret",
332
- error: t.clientSecret || void 0,
333
- invalid: !!t.clientSecret,
334
- disabled: S
288
+ /* @__PURE__ */ R("div", {
289
+ className: "flex flex-col gap-1",
290
+ children: [/* @__PURE__ */ L(M, {
291
+ id: "toolset-client-secret",
292
+ value: e.clientSecret ?? "",
293
+ onChange: (e) => m({ clientSecret: e ?? "" }),
294
+ labelProps: {
295
+ label: _?.clientSecretLabel ?? "Client secret",
296
+ required: !i
297
+ },
298
+ placeholder: E == null ? _?.clientSecretPlaceholder ?? "Enter client secret" : (_?.clientSecretHintPlaceholder ?? ge)(E),
299
+ "aria-describedby": E == null ? void 0 : X,
300
+ showPasswordLabel: _?.showClientSecretLabel ?? "Show client secret",
301
+ hidePasswordLabel: _?.hideClientSecretLabel ?? "Hide client secret",
302
+ error: t.clientSecret || void 0,
303
+ invalid: !!t.clientSecret,
304
+ disabled: T
305
+ }), E != null && /* @__PURE__ */ L(D, {
306
+ id: X,
307
+ text: _?.clientSecretKeepCaption ?? "Leave empty to keep the saved secret."
308
+ })]
335
309
  }),
336
- /* @__PURE__ */ O(M, {
310
+ /* @__PURE__ */ L(A, {
337
311
  id: "toolset-authorization-endpoint",
338
312
  value: e.authorizationEndpoint ?? "",
339
313
  onChange: (e) => m({ authorizationEndpoint: e ?? "" }),
340
- labelProps: { label: _?.authorizationEndpointLabel ?? "Authorization endpoint" },
314
+ labelProps: {
315
+ label: _?.authorizationEndpointLabel ?? "Authorization endpoint",
316
+ required: !0
317
+ },
341
318
  placeholder: _?.authorizationEndpointPlaceholder ?? "Enter authorization endpoint",
342
319
  error: t.authorizationEndpoint || void 0,
343
320
  invalid: !!t.authorizationEndpoint,
344
- disabled: S
321
+ disabled: T
345
322
  }),
346
- /* @__PURE__ */ O(M, {
323
+ /* @__PURE__ */ L(A, {
347
324
  id: "toolset-token-endpoint",
348
325
  value: e.tokenEndpoint ?? "",
349
326
  onChange: (e) => m({ tokenEndpoint: e ?? "" }),
350
- labelProps: { label: _?.tokenEndpointLabel ?? "Token endpoint" },
327
+ labelProps: {
328
+ label: _?.tokenEndpointLabel ?? "Token endpoint",
329
+ required: !0
330
+ },
351
331
  placeholder: _?.tokenEndpointPlaceholder ?? "Enter token endpoint",
352
332
  error: t.tokenEndpoint || void 0,
353
333
  invalid: !!t.tokenEndpoint,
354
- disabled: S
334
+ disabled: T
355
335
  }),
356
- /* @__PURE__ */ O(R, {
336
+ /* @__PURE__ */ L(I, {
357
337
  id: "toolset-scopes",
358
338
  labelProps: { label: _?.scopesLabel ?? "Scopes" },
359
339
  placeholder: _?.scopesPlaceholder ?? "Enter scopes",
360
340
  value: e.scopes ?? [],
361
341
  onChange: (e) => m({ scopes: e }),
362
- disabled: S,
363
- tagClassName: g
342
+ disabled: T,
343
+ tagClassName: p
364
344
  })
365
345
  ]
366
346
  }),
367
- I()
347
+ z()
368
348
  ]
369
349
  }),
370
- e.authenticationType === c.ApiKey && /* @__PURE__ */ k("div", {
350
+ e.authenticationType === s.ApiKey && /* @__PURE__ */ R("div", {
371
351
  className: "flex flex-col gap-3 pt-2",
372
352
  children: [
373
- /* @__PURE__ */ k("div", {
353
+ /* @__PURE__ */ R("div", {
374
354
  className: "flex flex-col gap-2",
375
- children: [/* @__PURE__ */ O(F, {
355
+ children: [/* @__PURE__ */ L(N, {
376
356
  name: "apikey-login-mode",
377
357
  id: "apikey-with-login",
378
- value: u.WithLogin,
358
+ value: l.WithLogin,
379
359
  labelProps: { label: _?.withLoginLabel ?? "With login" },
380
- isSelected: e.withLogin === u.WithLogin,
381
- disabled: S,
382
- onChange: T
383
- }), /* @__PURE__ */ O(F, {
360
+ isSelected: e.withLogin === l.WithLogin,
361
+ disabled: T,
362
+ onChange: j
363
+ }), /* @__PURE__ */ L(N, {
384
364
  name: "apikey-login-mode",
385
365
  id: "apikey-without-login",
386
- value: u.WithoutLogin,
366
+ value: l.WithoutLogin,
387
367
  labelProps: { label: _?.withoutLoginLabel ?? "Without login" },
388
- isSelected: e.withLogin === u.WithoutLogin,
389
- disabled: S,
390
- onChange: T
368
+ isSelected: e.withLogin === l.WithoutLogin,
369
+ disabled: T,
370
+ onChange: j
391
371
  })]
392
372
  }),
393
- /* @__PURE__ */ k("div", {
373
+ /* @__PURE__ */ R("div", {
394
374
  className: "flex flex-col gap-3",
395
- children: [/* @__PURE__ */ O(M, {
375
+ children: [/* @__PURE__ */ L(A, {
396
376
  id: "toolset-key-header",
397
377
  value: e.keyHeader ?? "",
398
378
  onChange: (e) => m({ keyHeader: e ?? "" }),
@@ -403,8 +383,8 @@ var se = {
403
383
  placeholder: _?.keyHeaderPlaceholder ?? "Enter API key parameter name",
404
384
  error: t.keyHeader || void 0,
405
385
  invalid: !!t.keyHeader,
406
- disabled: S
407
- }), e.withLogin === u.WithLogin && /* @__PURE__ */ O(P, {
386
+ disabled: T
387
+ }), e.withLogin === l.WithLogin && /* @__PURE__ */ L(M, {
408
388
  id: "toolset-api-key",
409
389
  value: e.apiKey ?? "",
410
390
  onChange: (e) => m({ apiKey: e ?? "" }),
@@ -417,76 +397,78 @@ var se = {
417
397
  hidePasswordLabel: _?.hideApiKeyLabel ?? "Hide API key",
418
398
  error: t.apiKey || void 0,
419
399
  invalid: !!t.apiKey,
420
- disabled: S
400
+ disabled: T
421
401
  })]
422
402
  }),
423
- e.withLogin !== u.WithoutLogin && I()
403
+ e.withLogin !== l.WithoutLogin && z()
424
404
  ]
425
405
  }),
426
- b && /* @__PURE__ */ O(ie, {
427
- open: b,
406
+ S && /* @__PURE__ */ L(ie, {
407
+ open: S,
428
408
  header: _?.logoutConfirmTitle ?? "Log out?",
429
409
  description: _?.logoutConfirmDescription ?? "Are you sure you want to log out? You will need to re-enter your credentials to use this toolset again.",
430
410
  confirmLabel: _?.logOutLabel ?? "Log out",
431
411
  cancelLabel: _?.cancelLabel ?? "Cancel",
432
412
  variant: ae.Danger,
433
- isLoading: v,
434
- disableConfirmButton: v,
435
- onConfirm: D,
436
- onCancel: () => x(!1),
437
- onClose: () => x(!1)
413
+ isLoading: b,
414
+ disableConfirmButton: b,
415
+ onConfirm: le,
416
+ onCancel: () => C(!1),
417
+ onClose: () => C(!1)
438
418
  })
439
419
  ]
440
420
  });
441
- }, ge = x(({ url: e, className: t, labels: n }) => {
442
- let { isCopied: r, copy: i } = y(e), a = n?.copiedLabel ?? "Copied!";
443
- return /* @__PURE__ */ k("div", {
444
- className: v("flex flex-col gap-3", t),
421
+ }, ve = {
422
+ title: "_title_17wsg_1",
423
+ description: "_description_17wsg_5"
424
+ }, ye = y(({ url: e, className: t, labels: n, titleClassName: r = "dial-body-semi-text", descriptionClassName: i = "dial-small-text" }) => {
425
+ let { isCopied: a, copy: o } = _(e), s = n?.copiedLabel ?? "Copied!";
426
+ return /* @__PURE__ */ R("div", {
427
+ className: g("flex flex-col gap-3", t),
445
428
  children: [
446
- /* @__PURE__ */ k("div", {
429
+ /* @__PURE__ */ R("div", {
447
430
  className: "flex flex-col gap-1",
448
- children: [/* @__PURE__ */ O("p", {
449
- className: "dial-body-semi-text text-start text-primary",
431
+ children: [/* @__PURE__ */ L("p", {
432
+ className: g("text-start", r, ve.title),
450
433
  children: n?.title ?? "Connect toolset"
451
- }), /* @__PURE__ */ O("p", {
452
- className: "dial-small-text text-start text-secondary",
434
+ }), /* @__PURE__ */ L("p", {
435
+ className: g("text-start", i, ve.description),
453
436
  children: n?.description ?? "Copy endpoint URL to easily integrate toolset into your workflows"
454
437
  })]
455
438
  }),
456
- /* @__PURE__ */ O("div", { children: /* @__PURE__ */ O(p, {
457
- copiedLabel: a,
439
+ /* @__PURE__ */ L("div", { children: /* @__PURE__ */ L(u, {
440
+ copiedLabel: s,
458
441
  copyLabel: n?.copyLabel ?? "Copy URL",
459
- isCopied: r,
460
- onClick: i
442
+ isCopied: a,
443
+ onClick: o
461
444
  }) }),
462
- /* @__PURE__ */ O("span", {
463
- role: "status",
464
- "aria-live": "polite",
465
- className: "sr-only",
466
- children: r ? a : ""
445
+ /* @__PURE__ */ L(oe, {
446
+ visuallyHidden: !0,
447
+ as: j.Span,
448
+ children: a ? s : ""
467
449
  })
468
450
  ]
469
451
  });
470
- }), _e = ({ form: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, connectUrl: a, listToolNames: o, authActions: s, onOAuthLogin: c, onNotifySuccess: l, onNotifyError: u, onChange: d, onAuthChange: f, onEnsureSaved: p, labels: m }) => {
471
- let [h, _] = E(null), v = !!a && !!r, y = w(() => [{
452
+ }), be = { connectDivider: "_connectDivider_obfkd_1" }, xe = ({ form: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, connectUrl: a, listToolNames: o, authActions: s, onOAuthLogin: c, onNotifySuccess: l, onNotifyError: ee, onChange: u, onAuthChange: d, onEnsureSaved: f, labels: m, colors: _, typography: v }) => {
453
+ let [y, b] = w(null), C = !!a && !!r, T = S(() => [{
472
454
  value: z.Http,
473
455
  label: "HTTP"
474
456
  }, {
475
457
  value: z.Sse,
476
458
  label: "SSE"
477
459
  }], []);
478
- return C(() => {
479
- if (!r || !o || !J(e.auth, i)) {
480
- _(null);
460
+ return x(() => {
461
+ if (!r || !o || !q(e.auth, i)) {
462
+ b(null);
481
463
  return;
482
464
  }
483
465
  let t = !1;
484
466
  return (async () => {
485
467
  try {
486
468
  let e = await o(r);
487
- t || _(e.length > 0 ? e : null);
469
+ t || b(e.length > 0 ? e : null);
488
470
  } catch {
489
- t || _(null);
471
+ t || b(null);
490
472
  }
491
473
  })(), () => {
492
474
  t = !0;
@@ -497,13 +479,19 @@ var se = {
497
479
  e.auth,
498
480
  e.endpoint,
499
481
  o
500
- ]), /* @__PURE__ */ k("div", {
482
+ ]), /* @__PURE__ */ R("div", {
501
483
  className: "flex max-w-[1060px] flex-col gap-4",
484
+ style: h({
485
+ "--te-connect-title": _?.connectTitle,
486
+ "--te-connect-description": _?.connectDescription,
487
+ "--te-connect-divider": _?.connectDivider,
488
+ "--te-open-access-description": _?.openAccessDescription
489
+ }),
502
490
  children: [
503
- /* @__PURE__ */ O(M, {
491
+ /* @__PURE__ */ L(A, {
504
492
  id: "toolset-endpoint",
505
493
  value: e.endpoint,
506
- onChange: (e) => d({ endpoint: e ?? "" }),
494
+ onChange: (e) => u({ endpoint: e ?? "" }),
507
495
  labelProps: {
508
496
  label: m?.endpointLabel ?? "Endpoint",
509
497
  required: !0
@@ -513,40 +501,40 @@ var se = {
513
501
  error: t.endpoint || void 0,
514
502
  invalid: !!t.endpoint
515
503
  }),
516
- /* @__PURE__ */ O(I, {
504
+ /* @__PURE__ */ L(P, {
517
505
  labelProps: {
518
506
  label: m?.protocolLabel ?? "Protocol",
519
507
  required: !0
520
508
  },
521
509
  id: "toolset-protocol",
522
- items: y,
510
+ items: T,
523
511
  value: e.protocol,
524
512
  onChange: (e) => {
525
- d({ protocol: e });
513
+ u({ protocol: e });
526
514
  }
527
515
  }),
528
- h ? /* @__PURE__ */ O(oe, {
516
+ y ? /* @__PURE__ */ L(F, {
529
517
  id: "toolset-allowed-tools",
530
518
  multiple: !0,
531
519
  searchable: !0,
532
520
  selectAll: !0,
533
521
  labelProps: { label: m?.allowedToolsLabel ?? "Allowed tools" },
534
522
  placeholder: m?.allowedToolsSelectPlaceholder ?? "Select allowed tools",
535
- options: h.map((e) => ({
523
+ options: y.map((e) => ({
536
524
  value: e,
537
525
  label: e
538
526
  })),
539
527
  value: e.allowedTools,
540
- onChange: (e) => d({ allowedTools: e })
541
- }) : /* @__PURE__ */ O(R, {
528
+ onChange: (e) => u({ allowedTools: e })
529
+ }) : /* @__PURE__ */ L(I, {
542
530
  id: "toolset-allowed-tools",
543
531
  labelProps: { label: m?.allowedToolsLabel ?? "Allowed tools" },
544
532
  placeholder: m?.allowedToolsPlaceholder ?? "Add tools, comma separated",
545
533
  value: e.allowedTools,
546
- onChange: (e) => d({ allowedTools: e }),
547
- tagClassName: g
534
+ onChange: (e) => u({ allowedTools: e }),
535
+ tagClassName: p
548
536
  }),
549
- /* @__PURE__ */ O(he, {
537
+ /* @__PURE__ */ L(Q, {
550
538
  auth: e.auth,
551
539
  errors: t,
552
540
  isSaving: n,
@@ -556,207 +544,216 @@ var se = {
556
544
  authActions: s,
557
545
  onOAuthLogin: c,
558
546
  onNotifySuccess: l,
559
- onNotifyError: u,
560
- onAuthChange: f,
561
- onEnsureSaved: p,
562
- labels: m?.auth
547
+ onNotifyError: ee,
548
+ onAuthChange: d,
549
+ onEnsureSaved: f,
550
+ labels: m?.auth,
551
+ titleClassName: v?.authTitleClassName,
552
+ openAccessDescriptionClassName: v?.openAccessDescriptionClassName
563
553
  }),
564
- v && /* @__PURE__ */ O(ge, {
554
+ C && /* @__PURE__ */ L(ye, {
565
555
  url: a ?? "",
566
556
  labels: m?.connect,
567
- className: "border-t border-tertiary pt-4"
557
+ titleClassName: v?.connectTitleClassName,
558
+ descriptionClassName: v?.connectDescriptionClassName,
559
+ className: g("border-t pt-4", be.connectDivider)
568
560
  })
569
561
  ]
570
562
  });
571
- }, ve = [
563
+ }, Se = [
572
564
  "keyHeader",
573
565
  "apiKey",
574
566
  "clientId",
575
567
  "clientSecret",
576
568
  "authorizationEndpoint",
577
569
  "tokenEndpoint"
578
- ], ye = ["endpoint", ...ve], be = new Set(ye), xe = (e) => {
570
+ ], Ce = ["endpoint", ...Se], $ = new Set(Ce), we = { validateVersionPattern: !0 }, Te = (e) => {
579
571
  let t = {};
580
- for (let n of Object.keys(e)) be.has(n) && (t[n] = !0);
572
+ for (let n of Object.keys(e)) $.has(n) && (t[n] = !0);
581
573
  return t;
582
- }, $ = ({ initialForm: e, toolsetId: i, onPersist: a, onPostSaveLogin: s, onToolsetsChanged: l, onSaveSuccess: d, onSaveComplete: p, onBack: g, buildMcpUrl: v, listToolNames: y, authActions: x, onOAuthLogin: ee, onNotifySuccess: te, onNotifyError: D, bucket: ne, FileManagerModal: re, resolveIconUrl: k, allowedMimeTypes: ie, maxFileSizeBytes: ae, availableLocaleOptions: A, onRefineDescription: j, labels: M }) => {
583
- let N = !!i, [P, F] = E(""), I = i || P, [L, oe] = E({
574
+ }, Ee = ({ initialForm: e, toolsetId: o, onPersist: c, onPostSaveLogin: u, onToolsetsChanged: p, onSaveSuccess: h, onSaveComplete: g, onBack: _, onDirtyChange: y, buildMcpUrl: T, listToolNames: E, authActions: te, onOAuthLogin: ne, onNotifySuccess: re, onNotifyError: D, avatarPicker: ie, availableLocaleOptions: ae, onRefineDescription: O, labels: k, colors: A, typography: oe }) => {
575
+ let j = !!o, [se, M] = w(""), N = o || se, [P, ce] = w({
584
576
  initialForm: e,
585
577
  key: 0
586
- });
587
- L.initialForm !== e && oe({
578
+ }), [F, I] = w(e);
579
+ P.initialForm !== e && (ce({
588
580
  initialForm: e,
589
- key: L.key + 1
590
- });
591
- let { values: R, setValues: z, markTouched: B, visibleErrorCodes: V, attemptSubmit: le } = o({
592
- initialValues: w(() => de(e), [e]),
593
- validationOptions: ce,
594
- reseedKey: L.key
595
- }), [H, U] = E(e), G = w(() => ({
596
- ...H,
597
- ...R
598
- }), [H, R]), [K, q] = E(!1), [J, Y] = E({}), [pe, X] = E({}), Z = T(null);
599
- C(() => {
600
- U(e), Z.current = e, Y({}), X({}), F("");
581
+ key: P.key + 1
582
+ }), I(e));
583
+ let R = S(() => pe(e), [e]), { values: z, setValues: B, markTouched: V, visibleErrorCodes: H, attemptSubmit: de } = a({
584
+ initialValues: R,
585
+ validationOptions: we,
586
+ reseedKey: P.key
587
+ }), [U, G] = w(e), K = S(() => ({
588
+ ...U,
589
+ ...z
590
+ }), [U, z]), q = S(() => JSON.stringify(K) !== JSON.stringify(F), [K, F]);
591
+ x(() => {
592
+ y?.(q);
593
+ }, [q, y]);
594
+ let [J, Y] = w(!1), [he, X] = w({}), [ge, _e] = w({}), Z = C(null);
595
+ x(() => {
596
+ G(e), Z.current = e, X({}), _e({}), M("");
601
597
  }, [e]);
602
- let Q = S((e) => {
603
- let { metadata: t, setup: n } = fe(e);
604
- Object.keys(t).length > 0 && (z(t), "name" in t && B(r.Name), "version" in t && B(r.Version)), Object.keys(n).length !== 0 && (U((e) => ({
598
+ let Q = b((e) => {
599
+ let { metadata: t, setup: n } = me(e);
600
+ Object.keys(t).length > 0 && (B(t), "name" in t && V(r.Name), "version" in t && V(r.Version)), Object.keys(n).length !== 0 && (G((e) => ({
605
601
  ...e,
606
602
  ...n
607
- })), X((e) => ({
603
+ })), _e((e) => ({
608
604
  ...e,
609
- ...xe(n)
610
- })), Y((e) => {
605
+ ...Te(n)
606
+ })), X((e) => {
611
607
  let t = { ...e };
612
608
  for (let e of Object.keys(n)) delete t[e];
613
609
  return t;
614
610
  }));
615
- }, [z, B]), he = S((e) => {
616
- U((t) => ({
611
+ }, [B, V]), ve = b((e) => {
612
+ G((t) => ({
617
613
  ...t,
618
614
  auth: {
619
615
  ...t.auth,
620
616
  ...e
621
617
  }
622
- })), X((t) => ({
618
+ })), _e((t) => ({
623
619
  ...t,
624
- ...xe(e)
625
- })), Y((t) => {
620
+ ...Te(e)
621
+ })), X((t) => {
626
622
  let n = { ...t };
627
- if ("authenticationType" in e || "withLogin" in e || "isLoggedIn" in e) for (let e of ve) delete n[e];
623
+ if ("authenticationType" in e || "withLogin" in e || "isLoggedIn" in e) for (let e of Se) delete n[e];
628
624
  else for (let t of Object.keys(e)) delete n[t];
629
625
  return n;
630
- }), "isLoggedIn" in e && l();
631
- }, [l]), ge = S(async () => {
632
- if (I && Z.current != null && JSON.stringify(Z.current) === JSON.stringify(G)) return I;
633
- q(!0);
626
+ }), "isLoggedIn" in e && p();
627
+ }, [p]), ye = b(async () => {
628
+ if (N && Z.current != null && JSON.stringify(Z.current) === JSON.stringify(K)) return N;
629
+ Y(!0);
634
630
  try {
635
- let e = await a(G, I);
636
- return e ? (I || F(e), Z.current = G, await l(), e) : null;
631
+ let e = await c(K, N);
632
+ return e ? (N || M(e), Z.current = K, I(K), y?.(!1), await p(), e) : null;
637
633
  } catch {
638
634
  return null;
639
635
  } finally {
640
- q(!1);
636
+ Y(!1);
641
637
  }
642
638
  }, [
643
- G,
644
- I,
645
- a,
646
- l
647
- ]), be = S(async () => await ge() ?? !1, [ge]), $ = S((e) => {
648
- let t = M?.validation, n = {};
649
- return e.endpoint.trim() ? W(e.endpoint) || (n.endpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.endpoint = t?.endpointRequired ?? "Endpoint is required", e.auth.isLoggedIn || (e.auth.authenticationType === c.ApiKey && (e.auth.keyHeader?.trim() || (n.keyHeader = t?.keyHeaderRequired ?? "Key name is required"), e.auth.withLogin === u.WithLogin && !e.auth.apiKey?.trim() && (n.apiKey = t?.apiKeyRequired ?? "API key is required")), e.auth.authenticationType === c.OAuth && e.auth.withLogin === u.WithConfig && (e.auth.clientId?.trim() || (n.clientId = t?.clientIdRequired ?? "Client ID is required"), !N && !e.auth.clientSecret?.trim() && (n.clientSecret = t?.clientSecretRequired ?? "Client secret is required"), e.auth.authorizationEndpoint?.trim() && !W(e.auth.authorizationEndpoint) && (n.authorizationEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"), e.auth.tokenEndpoint?.trim() && !W(e.auth.tokenEndpoint) && (n.tokenEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"))), n;
650
- }, [M, N]), Se = S(async () => {
651
- let e = le(), t = $(G);
652
- if (!e || Object.keys(t).length > 0) {
653
- Y(t);
654
- return;
655
- }
656
- Y({}), q(!0);
657
- try {
658
- let e = await a(G, I);
659
- if (!e) return;
660
- await l(), d(G);
639
+ K,
640
+ N,
641
+ c,
642
+ p,
643
+ y
644
+ ]), be = b(async () => await ye() ?? !1, [ye]), $ = b((e) => {
645
+ let t = k?.validation, n = {};
646
+ return e.endpoint.trim() ? W(e.endpoint) || (n.endpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.endpoint = t?.endpointRequired ?? "Endpoint is required", e.auth.isLoggedIn || (e.auth.authenticationType === s.ApiKey && (e.auth.keyHeader?.trim() || (n.keyHeader = t?.keyHeaderRequired ?? "Key name is required"), e.auth.withLogin === l.WithLogin && !e.auth.apiKey?.trim() && (n.apiKey = t?.apiKeyRequired ?? "API key is required")), e.auth.authenticationType === s.OAuth && e.auth.withLogin === l.WithConfig && (e.auth.clientId?.trim() || (n.clientId = t?.clientIdRequired ?? "Client ID is required"), !j && !e.auth.clientSecret?.trim() && (n.clientSecret = t?.clientSecretRequired ?? "Client secret is required"), e.auth.authorizationEndpoint?.trim() ? W(e.auth.authorizationEndpoint) || (n.authorizationEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.authorizationEndpoint = t?.authorizationEndpointRequired ?? "Authorization endpoint is required", e.auth.tokenEndpoint?.trim() ? W(e.auth.tokenEndpoint) || (n.tokenEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.tokenEndpoint = t?.tokenEndpointRequired ?? "Token endpoint is required")), n;
647
+ }, [k, j]), Ee = b(async () => {
648
+ let e = de(), t = $(K);
649
+ if (!e || Object.keys(t).length > 0) X(t);
650
+ else {
651
+ X({}), Y(!0);
661
652
  try {
662
- await s(e, G.auth), p();
663
- } catch (e) {
664
- let { traceId: t } = await f(e);
665
- D(M?.settings?.auth?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
653
+ let e = await c(K, N);
654
+ if (!e) return;
655
+ I(K), await p(), h(K);
656
+ try {
657
+ await u(e, K.auth), g();
658
+ } catch (e) {
659
+ let { traceId: t } = await ee(e);
660
+ D(k?.settings?.auth?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
661
+ }
662
+ } catch {} finally {
663
+ Y(!1);
666
664
  }
667
- } catch {} finally {
668
- q(!1);
669
665
  }
670
666
  }, [
671
- le,
672
- G,
667
+ de,
668
+ K,
673
669
  $,
674
- I,
675
- a,
676
- l,
677
- d,
670
+ N,
671
+ c,
678
672
  p,
679
- s,
673
+ h,
674
+ g,
675
+ u,
680
676
  D,
681
- M
682
- ]), Ce = b({
683
- value: R.description,
677
+ k
678
+ ]), De = v({
679
+ value: z.description,
684
680
  onChange: (e) => Q({ description: e }),
685
- onRefine: j,
686
- disabled: K,
687
- resetKey: L.key
688
- }), we = j ? (e, t) => /* @__PURE__ */ O(_, {
681
+ onRefine: O,
682
+ disabled: J,
683
+ resetKey: P.key
684
+ }), Oe = O ? (e, t) => /* @__PURE__ */ L(m, {
689
685
  isEnabled: !0,
690
686
  fieldId: t,
691
- label: M?.general?.form?.description.label ?? "Description",
692
- labels: M?.refinement,
693
- refinement: Ce,
694
- disabled: Ce.isPending || K,
687
+ label: k?.general?.form?.description.label ?? "Description",
688
+ labels: k?.refinement,
689
+ refinement: De,
690
+ disabled: De.isPending || J,
695
691
  children: e
696
- }) : void 0, Te = w(() => !ue(G, N), [G, N]), Ee = w(() => {
697
- let e = M?.validation, n = $(G), r = { ...J };
698
- for (let e of ye) {
699
- if (!pe[e]) continue;
692
+ }) : void 0, ke = S(() => ({
693
+ form: k?.general?.form ?? ue,
694
+ avatarPicker: k?.general?.avatarPicker
695
+ }), [k?.general?.form, k?.general?.avatarPicker]), Ae = S(() => !fe(K, j), [K, j]), je = S(() => {
696
+ let e = k?.validation, n = $(K), r = { ...he };
697
+ for (let e of Ce) {
698
+ if (!ge[e]) continue;
700
699
  let t = n[e];
701
700
  t ? r[e] = t : delete r[e];
702
701
  }
703
- return V.name === t.Required ? r.name = e?.nameRequired ?? "Name is required" : V.name === t.TooLong ? r.name = e?.nameTooLong ?? `Use ${h} characters or fewer.` : V.name === t.ControlCharacters && (r.name = e?.nameControlCharacters ?? "Remove line breaks, tabs and other control characters."), V.description === t.TooLong && (r.description = e?.descriptionTooLong ?? `Use ${m} characters or fewer.`), V.version === t.InvalidFormat && (r.version = e?.versionInvalid ?? "Version must follow semantic versioning (e.g., 1.0.0)"), r;
702
+ return H.name === t.Required ? r.name = e?.nameRequired ?? "Name is required" : H.name === t.TooLong ? r.name = e?.nameTooLong ?? `Use ${f} characters or fewer.` : H.name === t.ControlCharacters && (r.name = e?.nameControlCharacters ?? "Remove line breaks, tabs and other control characters."), H.description === t.TooLong && (r.description = e?.descriptionTooLong ?? `Use ${d} characters or fewer.`), H.version === t.InvalidFormat && (r.version = e?.versionInvalid ?? "Version may only contain letters, digits, dots, underscores, and dashes"), r;
704
703
  }, [
705
- pe,
706
- J,
707
- G,
708
- M,
709
- V,
704
+ ge,
705
+ he,
706
+ K,
707
+ k,
708
+ H,
710
709
  $
711
- ]), De = v && I ? v(I) : void 0;
712
- return /* @__PURE__ */ O(n, {
713
- title: N ? M?.layout?.editTitle ?? "Edit toolset" : M?.layout?.createTitle ?? "Create toolset",
714
- onBack: g,
715
- onCancel: g,
716
- onSubmit: Se,
717
- submitLabel: N ? M?.layout?.saveLabel ?? "Save" : M?.layout?.createLabel ?? "Create",
718
- isSubmitting: K,
719
- isSubmitDisabled: Te || Ce.isPending,
720
- metadataSectionClassName: se.metadataSection,
721
- setupSectionClassName: se.setupSection,
710
+ ]), Me = T && N ? T(N) : void 0;
711
+ return /* @__PURE__ */ L(n, {
712
+ title: j ? k?.layout?.editTitle ?? "Edit toolset" : k?.layout?.createTitle ?? "Create toolset",
713
+ onBack: _,
714
+ onCancel: _,
715
+ onSubmit: Ee,
716
+ submitLabel: j ? k?.layout?.saveLabel ?? "Save" : k?.layout?.createLabel ?? "Create",
717
+ isSubmitting: J,
718
+ isSubmitDisabled: Ae || De.isPending,
719
+ metadataSectionClassName: le.metadataSection,
720
+ setupSectionClassName: le.setupSection,
722
721
  labels: {
723
- backAriaLabel: M?.layout?.backAriaLabel ?? "Back to catalog",
724
- savingStatusLabel: M?.layout?.savingStatusLabel ?? "Saving",
725
- metadataTitle: M?.layout?.metadataSectionTitle ?? "Metadata",
726
- setupTitle: M?.layout?.setupSectionTitle ?? "Setup",
727
- cancelLabel: M?.layout?.cancelLabel ?? "Cancel"
722
+ backAriaLabel: k?.layout?.backAriaLabel ?? "Back to catalog",
723
+ savingStatusLabel: k?.layout?.savingStatusLabel ?? "Saving",
724
+ metadataTitle: k?.layout?.metadataSectionTitle ?? "Metadata",
725
+ setupTitle: k?.layout?.setupSectionTitle ?? "Setup",
726
+ cancelLabel: k?.layout?.cancelLabel ?? "Cancel"
728
727
  },
729
- metadata: /* @__PURE__ */ O(me, {
730
- form: G,
731
- errors: Ee,
732
- bucket: ne,
733
- FileManagerModal: re,
734
- resolveIconUrl: k,
735
- allowedMimeTypes: ie,
736
- maxFileSizeBytes: ae,
737
- availableLocaleOptions: A,
728
+ metadata: /* @__PURE__ */ L(i, {
729
+ values: K,
730
+ errors: je,
738
731
  onChange: Q,
739
- renderDescription: we,
740
- labels: M?.general
732
+ avatarPicker: ie,
733
+ availableLocaleOptions: ae,
734
+ renderDescription: Oe,
735
+ labels: ke
741
736
  }),
742
- setup: /* @__PURE__ */ O(_e, {
743
- form: G,
744
- errors: Ee,
745
- isSaving: K,
746
- toolsetId: I,
747
- isEditMode: N,
748
- connectUrl: De,
749
- listToolNames: y,
750
- authActions: x,
751
- onOAuthLogin: ee,
752
- onNotifySuccess: te,
737
+ setup: /* @__PURE__ */ L(xe, {
738
+ form: K,
739
+ errors: je,
740
+ isSaving: J,
741
+ toolsetId: N,
742
+ isEditMode: j,
743
+ connectUrl: Me,
744
+ listToolNames: E,
745
+ authActions: te,
746
+ onOAuthLogin: ne,
747
+ onNotifySuccess: re,
753
748
  onNotifyError: D,
754
749
  onChange: Q,
755
- onAuthChange: he,
750
+ onAuthChange: ve,
756
751
  onEnsureSaved: be,
757
- labels: M?.settings
752
+ labels: k?.settings,
753
+ colors: A?.settings,
754
+ typography: oe?.settings
758
755
  })
759
756
  });
760
757
  };
761
758
  //#endregion
762
- export { V as AUTH_TYPE_ICONS, B as DEFAULT_TOOLSET_VERSION, me as GeneralForm, se as TOOLSET_EDITOR_CLASS, $ as ToolsetEditor, X as ToolsetOAuthLoginStatus, z as ToolsetTransportType, H as getDefaultToolsetForm, J as isToolsetAuthValid, ue as isToolsetFormValid, W as isValidEndpointUrl, K as normalizeReturnedEndpointUrl };
759
+ export { V as AUTH_TYPE_ICONS, B as DEFAULT_TOOLSET_VERSION, le as TOOLSET_EDITOR_CLASS, Ee as ToolsetEditor, Y as ToolsetOAuthLoginStatus, z as ToolsetTransportType, de as getDefaultToolsetForm, q as isToolsetAuthValid, fe as isToolsetFormValid, W as isValidEndpointUrl, K as normalizeReturnedEndpointUrl };