@ynput/ayon-frontend-shared 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,25 @@
1
1
  import { jsx as t, jsxs as f, Fragment as ue } from "react/jsx-runtime";
2
- import { useState as z, forwardRef as Ue, useRef as ce, useEffect as Le, useLayoutEffect as Ve, useContext as Pe, useMemo as ge } from "react";
2
+ import { useState as z, forwardRef as Ue, useRef as ce, useEffect as Le, useLayoutEffect as Ve, useContext as Pe, useId as Je, useMemo as ge } from "react";
3
3
  import { isEmpty as Ce } from "lodash";
4
4
  import "primereact/confirmdialog";
5
5
  import { toast as me } from "react-toastify";
6
- import { g as Je, R as Me } from "./chunks/realtimeUpdatesUtils.es.js";
7
- import { p as be, c as Xe, a as Ze } from "./chunks/parseHtmlToPlainTextWithLinks.es.js";
8
- import { bi as Ge } from "./chunks/searchTerms.es.js";
9
- import { dl as Qe } from "./chunks/getUris.es.js";
6
+ import { g as Xe, R as Me } from "./chunks/realtimeUpdatesUtils.es.js";
7
+ import { p as be, c as Ze, a as Ge } from "./chunks/parseHtmlToPlainTextWithLinks.es.js";
8
+ import { bi as Qe } from "./chunks/searchTerms.es.js";
9
+ import { dl as Ye } from "./chunks/getUris.es.js";
10
10
  import "@module-federation/enhanced/runtime";
11
- import { x as Te, y as ze, M as Ye } from "./chunks/DeleteEntitiesContextInstance.es.js";
11
+ import { x as Te, y as $e, M as et } from "./chunks/DeleteEntitiesContextInstance.es.js";
12
12
  import "semver";
13
- import { Dropdown as De, Icon as Q, InputText as he, Button as fe, InputSwitch as Ne, InputNumber as je, Spacer as Be, theme as qe, Dialog as et, ShortcutTag as tt, Toolbar as nt, SaveButton as at } from "@ynput/ayon-react-components";
13
+ import { Dropdown as De, Icon as Q, InputText as he, Button as fe, InputSwitch as Ne, InputNumber as je, Spacer as ze, theme as qe, Dialog as tt, ShortcutTag as nt, Toolbar as at, SaveButton as rt } from "@ynput/ayon-react-components";
14
14
  import "./chunks/ContextMenuContextInstance.es.js";
15
15
  import Ae from "clsx";
16
16
  import "uuid";
17
17
  import "react-dom";
18
18
  import "react-redux";
19
- import { f as rt, d as ot, C as st, g as lt, h as it, p as ct } from "./chunks/MetaWidget.es.js";
20
- import { N as dt, u as pt } from "./chunks/NewEntityContextInstance.es.js";
19
+ import { f as ot, d as st, C as lt, g as it, h as ct, p as dt } from "./chunks/MetaWidget.es.js";
20
+ import { N as pt, u as ft } from "./chunks/NewEntityContextInstance.es.js";
21
21
  import E from "styled-components";
22
- import { a as ft, K as ut } from "./chunks/platform.es.js";
22
+ import { a as ut, K as mt } from "./chunks/platform.es.js";
23
23
  import "./chunks/PlayableIcon.es.js";
24
24
  import "date-fns";
25
25
  import "lexical";
@@ -33,45 +33,45 @@ import "@lexical/rich-text";
33
33
  import "@lexical/selection";
34
34
  import "@lexical/utils";
35
35
  import "react-router-dom";
36
- import { u as mt } from "./chunks/useHierarchySelection.es.js";
36
+ import { u as ht } from "./chunks/useHierarchySelection.es.js";
37
37
  import { n as te } from "./chunks/entityDefinitions.es.js";
38
38
  import "@tanstack/react-table";
39
- const Ee = (c, m, u) => {
40
- const d = c.match(/\d+$/), v = m.match(/\d+$/), h = d ? parseInt(d[0], 10) : NaN, O = (v ? parseInt(v[0], 10) : NaN) - h;
41
- if (isNaN(O)) return [];
39
+ const Ee = (i, m, u) => {
40
+ const c = i.match(/\d+$/), w = m.match(/\d+$/), h = c ? parseInt(c[0], 10) : NaN, D = (w ? parseInt(w[0], 10) : NaN) - h;
41
+ if (isNaN(D)) return [];
42
42
  const r = [];
43
- for (let D = 0; D < u; D++) {
44
- const y = h + D * O, F = c.match(/\d+$/);
45
- if (!F) return [];
46
- const A = String(y).padStart(F[0].length, "0"), _ = c.replace(/\d+$/, A);
47
- r.push(_);
43
+ for (let q = 0; q < u; q++) {
44
+ const v = h + q * D, O = i.match(/\d+$/);
45
+ if (!O) return [];
46
+ const j = String(v).padStart(O[0].length, "0"), W = i.replace(/\d+$/, j);
47
+ r.push(W);
48
48
  }
49
49
  return r;
50
- }, ht = (c, m, u) => {
51
- if (!c || !m) return "";
52
- const d = (c === "folder" ? u?.folderTypes : u?.taskTypes)?.find(
53
- (v) => v.name === m
50
+ }, yt = (i, m, u) => {
51
+ if (!i || !m) return "";
52
+ const c = (i === "folder" ? u?.folderTypes : u?.taskTypes)?.find(
53
+ (w) => w.name === m
54
54
  );
55
- return d ? d.name : "";
56
- }, xn = ({ children: c }) => {
57
- const { projectName: m, ...u } = Te(), { attribFields: d } = rt(), { findNonInheritedValues: v, getFolderById: h } = ze(), { attrib: n = {}, statuses: O } = u || {}, { anatomy: r } = Te(), { entity_naming: D = { capitalization: "lower", separator: "_" } } = r, { rowSelection: y, sliceType: F } = ot(), A = O?.filter((a) => a.scope?.includes("task"))?.[0]?.name || O?.[0]?.name || "none", _ = O?.filter((a) => a.scope?.includes("folder"))?.[0]?.name || O?.[0]?.name || "none", [q, o] = z(null), [R, J] = z(null), K = { label: "", subType: "", name: "" }, [x, ne] = z(K), [W, V] = z({
55
+ return c ? c.name : "";
56
+ }, wn = ({ children: i }) => {
57
+ const { projectName: m, ...u } = Te(), { attribFields: c } = ot(), { findNonInheritedValues: w, getFolderById: h } = $e(), { attrib: n = {}, statuses: D } = u || {}, { anatomy: r } = Te(), { entity_naming: q = { capitalization: "lower", separator: "_" } } = r, { rowSelection: v, sliceType: O } = st(), j = D?.filter((a) => a.scope?.includes("task"))?.[0]?.name || D?.[0]?.name || "none", W = D?.filter((a) => a.scope?.includes("folder"))?.[0]?.name || D?.[0]?.name || "none", [F, R] = z(null), [p, K] = z(null), L = { label: "", subType: "", name: "" }, [b, ne] = z(L), [H, J] = z({
58
58
  active: !1,
59
59
  increment: "",
60
60
  length: 10,
61
61
  prefix: !1,
62
62
  prefixDepth: 0
63
- }), X = (a, p, g, S) => {
64
- const s = {};
65
- if (F !== "hierarchy" && !Ce(y) && a === "task") {
66
- const b = Object.keys(y).filter(
67
- (l) => !["hasValue", "noValue"].includes(l)
63
+ }), X = (a, d, y, k) => {
64
+ const o = {};
65
+ if (O !== "hierarchy" && !Ce(v) && a === "task") {
66
+ const g = Object.keys(v).filter(
67
+ (s) => !["hasValue", "noValue"].includes(s)
68
68
  );
69
- switch (F) {
69
+ switch (O) {
70
70
  case "assignees":
71
- s.assignees = b;
71
+ o.assignees = g;
72
72
  break;
73
73
  case "status":
74
- s.status = b[0];
74
+ o.status = g[0];
75
75
  break;
76
76
  }
77
77
  }
@@ -79,77 +79,77 @@ const Ee = (c, m, u) => {
79
79
  type: "create",
80
80
  entityType: a,
81
81
  data: {
82
- [`${a}Type`]: p,
83
- id: Je(),
84
- label: g.label || g.name,
85
- name: g.name,
86
- ...S && { [a === "folder" ? "parentId" : "folderId"]: S },
87
- ...s
82
+ [`${a}Type`]: d,
83
+ id: Xe(),
84
+ label: y.label || y.name,
85
+ name: y.name,
86
+ ...k && { [a === "folder" ? "parentId" : "folderId"]: k },
87
+ ...o
88
88
  }
89
89
  };
90
- }, ae = (a, p, g, S, s) => {
91
- if (S.length === 0 && a === "folder")
92
- return g.map((l) => X(a, p, { name: l }));
93
- const b = [];
94
- for (const l of S)
95
- for (const C of g) {
96
- const $ = s ? (l.label || l.name) + C : C;
97
- b.push(X(a, p, { name: $ }, l.id));
90
+ }, ae = (a, d, y, k, o) => {
91
+ if (k.length === 0 && a === "folder")
92
+ return y.map((s) => X(a, d, { name: s }));
93
+ const g = [];
94
+ for (const s of k)
95
+ for (const S of y) {
96
+ const _ = o ? (s.label || s.name) + S : S;
97
+ g.push(X(a, d, { name: _ }, s.id));
98
98
  }
99
- return b;
100
- }, de = (a, p, g, S, s) => S.length === 0 && a === "folder" ? [X(a, p, { name: s, label: g })] : S.map(
101
- (b) => X(a, p, { name: s, label: g }, b)
102
- ), H = (a, p = {}) => {
103
- const g = /* @__PURE__ */ new Set();
104
- for (const T of a)
105
- if (T.entityType === "folder")
106
- T.data?.parentId && g.add(T.data.parentId);
107
- else if (T.entityType === "task") {
108
- if (!T.data?.folderId) {
109
- console.warn("Task operation without folderId:", T);
99
+ return g;
100
+ }, de = (a, d, y, k, o) => k.length === 0 && a === "folder" ? [X(a, d, { name: o, label: y })] : k.map(
101
+ (g) => X(a, d, { name: o, label: y }, g)
102
+ ), U = (a, d = {}) => {
103
+ const y = /* @__PURE__ */ new Set();
104
+ for (const C of a)
105
+ if (C.entityType === "folder")
106
+ C.data?.parentId && y.add(C.data.parentId);
107
+ else if (C.entityType === "task") {
108
+ if (!C.data?.folderId) {
109
+ console.warn("Task operation without folderId:", C);
110
110
  continue;
111
111
  }
112
- g.add(T.data.folderId);
112
+ y.add(C.data.folderId);
113
113
  }
114
- const S = /* @__PURE__ */ new Map();
115
- for (const T of g) {
116
- if (!T) continue;
117
- const k = v(
118
- T,
119
- d.map((P) => P.name)
114
+ const k = /* @__PURE__ */ new Map();
115
+ for (const C of y) {
116
+ if (!C) continue;
117
+ const I = w(
118
+ C,
119
+ c.map((P) => P.name)
120
120
  );
121
- S.set(T, k);
121
+ k.set(C, I);
122
122
  }
123
- const s = a.filter((T) => T.entityType === "folder"), b = a.filter((T) => T.entityType === "task"), l = (T, k) => {
123
+ const o = a.filter((C) => C.entityType === "folder"), g = a.filter((C) => C.entityType === "task"), s = (C, I) => {
124
124
  let P = [];
125
- for (const i of T) {
126
- const Z = k === "folder" ? i.data.parentId : i.data.folderId, j = S.get(Z) || n, M = Object.keys(j).reduce((N, U) => {
127
- const oe = d.find((pe) => pe.name === U);
125
+ for (const l of C) {
126
+ const Z = I === "folder" ? l.data.parentId : l.data.folderId, A = k.get(Z) || n, M = Object.keys(A).reduce((N, V) => {
127
+ const oe = c.find((pe) => pe.name === V);
128
128
  if (!oe) return N;
129
- const ye = oe.scope?.includes(k), se = !!oe.data.inherit;
130
- return ye ? N[U] = j[U] : se && j[U] && (N[U] = {
131
- ...j[U],
129
+ const ye = oe.scope?.includes(I), se = !!oe.data.inherit;
130
+ return ye ? N[V] = A[V] : se && A[V] && (N[V] = {
131
+ ...A[V],
132
132
  inherited: !0,
133
133
  inheritedFrom: Z
134
134
  }), N;
135
135
  }, {});
136
- if (k === "folder") {
137
- let N = i.data.parentId && p[i.data.parentId];
138
- N = N ? N + "/" + i.data.name : "";
139
- const U = {
136
+ if (I === "folder") {
137
+ let N = l.data.parentId && d[l.data.parentId];
138
+ N = N ? N + "/" + l.data.name : "";
139
+ const V = {
140
140
  type: "create",
141
141
  entityType: "folder",
142
- entityId: i.data.id,
142
+ entityId: l.data.id,
143
143
  data: {
144
- ...i.data,
145
- entityId: i.data.id,
144
+ ...l.data,
145
+ entityId: l.data.id,
146
146
  entityType: "folder",
147
147
  projectName: m,
148
- folderType: i.data.folderType,
148
+ folderType: l.data.folderType,
149
149
  parents: [],
150
150
  updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
151
151
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
152
- status: _,
152
+ status: W,
153
153
  ownAttrib: [],
154
154
  path: N,
155
155
  tags: [],
@@ -158,25 +158,25 @@ const Ee = (c, m, u) => {
158
158
  // Add empty links object
159
159
  }
160
160
  };
161
- P.push(U);
161
+ P.push(V);
162
162
  } else {
163
163
  const N = {
164
164
  type: "create",
165
165
  entityType: "task",
166
- entityId: i.data.id,
166
+ entityId: l.data.id,
167
167
  data: {
168
- ...i.data,
169
- entityId: i.data.id,
168
+ ...l.data,
169
+ entityId: l.data.id,
170
170
  entityType: "task",
171
- label: i.data.label || i.data.name,
172
- taskType: i.data.taskType || "",
173
- folderId: i.data.folderId || "",
171
+ label: l.data.label || l.data.name,
172
+ taskType: l.data.taskType || "",
173
+ folderId: l.data.folderId || "",
174
174
  active: !0,
175
- assignees: i.data.assignees || [],
175
+ assignees: l.data.assignees || [],
176
176
  projectName: m,
177
- status: i.data.status || A,
177
+ status: l.data.status || j,
178
178
  folder: {
179
- path: i.data.folderId ? p[i.data.folderId] : "",
179
+ path: l.data.folderId ? d[l.data.folderId] : "",
180
180
  folderType: ""
181
181
  },
182
182
  tags: [],
@@ -199,138 +199,138 @@ const Ee = (c, m, u) => {
199
199
  }
200
200
  }
201
201
  return P;
202
- }, C = l(
203
- s,
202
+ }, S = s(
203
+ o,
204
204
  "folder"
205
- ), $ = l(
206
- b,
205
+ ), _ = s(
206
+ g,
207
207
  "task"
208
208
  );
209
- return [...C, ...$];
210
- }, [Y] = Qe(), ee = async (a) => {
211
- if (!q || !x.label || !x.name)
209
+ return [...S, ..._];
210
+ }, [Y] = Ye(), ee = async (a) => {
211
+ if (!F || !b.label || !b.name)
212
212
  throw me.error("Please provide a valid name and select an entity type"), new Error("Invalid entity type or label");
213
- if (q === "task" && a.length === 0)
213
+ if (F === "task" && a.length === 0)
214
214
  throw me.error("Cannot create a task without selecting a folder"), new Error("No folder selected for task creation");
215
- let p;
216
- if (W.active) {
217
- const s = [];
218
- for (const l of a) {
219
- const C = h(l);
220
- C && s.push({
221
- id: C.id,
222
- name: C.name,
223
- label: C.label || C.name
215
+ let d;
216
+ if (H.active) {
217
+ const o = [];
218
+ for (const s of a) {
219
+ const S = h(s);
220
+ S && o.push({
221
+ id: S.id,
222
+ name: S.name,
223
+ label: S.label || S.name
224
224
  });
225
225
  }
226
- const b = Ee(x.label, W.increment, W.length);
227
- p = ae(
228
- q,
229
- x.subType,
230
- b,
231
- s,
232
- W.prefix
226
+ const g = Ee(b.label, H.increment, H.length);
227
+ d = ae(
228
+ F,
229
+ b.subType,
230
+ g,
231
+ o,
232
+ H.prefix
233
233
  );
234
234
  } else
235
- p = de(
236
- q,
237
- x.subType,
238
- x.label,
235
+ d = de(
236
+ F,
237
+ b.subType,
238
+ b.label,
239
239
  a,
240
- x.name
240
+ b.name
241
241
  );
242
- const g = {};
243
- for (const s of a) {
244
- const b = h(s);
245
- b && (g[b.id] = b.path);
242
+ const y = {};
243
+ for (const o of a) {
244
+ const g = h(o);
245
+ g && (y[g.id] = g.path);
246
246
  }
247
- const S = H(p, g);
247
+ const k = U(d, y);
248
248
  try {
249
- const s = await Y({
250
- operationsRequestModel: { operations: p },
249
+ const o = await Y({
250
+ operationsRequestModel: { operations: d },
251
251
  projectName: m,
252
- patchOperations: S
252
+ patchOperations: k
253
253
  }).unwrap();
254
- if (s?.success && s.operations)
255
- return s.operations;
254
+ if (o?.success && o.operations)
255
+ return o.operations;
256
256
  throw {
257
257
  error: (
258
258
  // @ts-expect-error - res.operations may not be typed
259
- s?.operations?.[0]?.error || "An error occurred while creating the entity. Please try again."
259
+ o?.operations?.[0]?.error || "An error occurred while creating the entity. Please try again."
260
260
  )
261
261
  };
262
- } catch (s) {
263
- console.log(s);
264
- const b = Ge(s);
265
- throw me.error(b), new Error(b);
262
+ } catch (o) {
263
+ console.log(o);
264
+ const g = Qe(o);
265
+ throw me.error(g), new Error(g);
266
266
  }
267
- }, B = (a, p) => {
268
- o(a), J(p?.parentFolderIds ?? null);
269
- const s = ((a === "folder" ? u?.folderTypes : u?.taskTypes) || [])[0].name || "", b = ht(a, s, u), l = {
270
- subType: s,
271
- label: b,
272
- name: be(b, D)
267
+ }, B = (a, d) => {
268
+ R(a), K(d?.parentFolderIds ?? null);
269
+ const o = ((a === "folder" ? u?.folderTypes : u?.taskTypes) || [])[0].name || "", g = yt(a, o, u), s = {
270
+ subType: o,
271
+ label: g,
272
+ name: be(g, q)
273
273
  };
274
- p?.isSequence && V((C) => ({
275
- ...C,
274
+ d?.isSequence && J((S) => ({
275
+ ...S,
276
276
  active: !0
277
- })), ne(l);
277
+ })), ne(s);
278
278
  };
279
279
  return /* @__PURE__ */ t(
280
- dt.Provider,
280
+ pt.Provider,
281
281
  {
282
282
  value: {
283
- config: D,
284
- entityType: q,
285
- setEntityType: o,
286
- entityForm: x,
283
+ config: q,
284
+ entityType: F,
285
+ setEntityType: R,
286
+ entityForm: b,
287
287
  setEntityForm: ne,
288
- sequenceForm: W,
289
- setSequenceForm: V,
288
+ sequenceForm: H,
289
+ setSequenceForm: J,
290
290
  onCreateNew: ee,
291
291
  onOpenNew: B,
292
- parentFolderIds: R
292
+ parentFolderIds: p
293
293
  },
294
- children: c
294
+ children: i
295
295
  }
296
296
  );
297
297
  }, xe = Ue(
298
298
  ({
299
- value: c,
299
+ value: i,
300
300
  options: m,
301
301
  onChange: u,
302
- style: d,
303
- mainStyle: v,
302
+ style: c,
303
+ mainStyle: w,
304
304
  disabled: h,
305
305
  placeholder: n,
306
- isChanged: O,
306
+ isChanged: D,
307
307
  align: r,
308
- type: D,
309
- ...y
310
- }, F) => /* @__PURE__ */ t(
308
+ type: q,
309
+ ...v
310
+ }, O) => /* @__PURE__ */ t(
311
311
  De,
312
312
  {
313
313
  options: m,
314
314
  dataKey: "name",
315
- value: c,
316
- valueStyle: d,
317
- onChange: (A) => u(A[0]),
315
+ value: i,
316
+ valueStyle: c,
317
+ onChange: (j) => u(j[0]),
318
318
  disabled: h,
319
- isChanged: O,
319
+ isChanged: D,
320
320
  placeholder: n,
321
321
  widthExpand: !0,
322
322
  search: !0,
323
323
  searchFields: ["name"],
324
324
  emptyMessage: "None Set",
325
- style: v,
325
+ style: w,
326
326
  align: r,
327
- ref: F,
328
- ...y
327
+ ref: O,
328
+ ...v
329
329
  }
330
330
  )
331
331
  );
332
332
  xe.displayName = "TypeEditor";
333
- const yt = E.div`
333
+ const gt = E.div`
334
334
  position: relative;
335
335
  display: flex;
336
336
  flex-direction: column;
@@ -347,7 +347,7 @@ const yt = E.div`
347
347
  &.task {
348
348
  width: 100%;
349
349
  }
350
- `, $e = E.div`
350
+ `, Be = E.div`
351
351
  display: flex;
352
352
  flex-direction: column;
353
353
  /* panel */
@@ -378,7 +378,7 @@ const yt = E.div`
378
378
  .form > .icon {
379
379
  padding: 5px 0;
380
380
  }
381
- `, gt = E($e)`
381
+ `, bt = E(Be)`
382
382
  & > div {
383
383
  align-items: center;
384
384
  }
@@ -418,7 +418,7 @@ const yt = E.div`
418
418
  text-overflow: ellipsis;
419
419
  white-space: nowrap;
420
420
  }
421
- `, bt = E.div`
421
+ `, xt = E.div`
422
422
  display: flex;
423
423
  flex-direction: column;
424
424
  gap: var(--base-gap-small);
@@ -429,18 +429,18 @@ const yt = E.div`
429
429
  display: none;
430
430
  }
431
431
  width: 100%;
432
- `, xt = E.div`
432
+ `, wt = E.div`
433
433
  display: flex;
434
434
  flex-direction: row;
435
435
  align-items: center;
436
436
  gap: var(--base-gap-small);
437
437
  width: 100%;
438
- `, wt = E.div`
438
+ `, vt = E.div`
439
439
  display: flex;
440
440
  flex-direction: column;
441
441
  gap: var(--base-gap-small);
442
442
  z-index: 10;
443
- `, vt = E.span``, kt = E.span`
443
+ `, It = E.span``, kt = E.span`
444
444
  background-color: var(--md-sys-color-surface-container-low);
445
445
  padding: 5px 8px;
446
446
  border-radius: var(--border-radius);
@@ -451,16 +451,16 @@ const yt = E.div`
451
451
  color: var(--md-sys-color-outline);
452
452
  min-height: 30px;
453
453
  `;
454
- function It(c, m, u = "") {
455
- if (c.length <= m)
456
- return c.map((d) => u + d).join(", ");
454
+ function St(i, m, u = "") {
455
+ if (i.length <= m)
456
+ return i.map((c) => u + c).join(", ");
457
457
  {
458
- const d = c.slice(0, Math.ceil(m / 2)).map((h) => u + h), v = c.slice(-1).map((h) => u + h);
459
- return `${d.join(", ")} ... ${v.join(", ")}`;
458
+ const c = i.slice(0, Math.ceil(m / 2)).map((h) => u + h), w = i.slice(-1).map((h) => u + h);
459
+ return `${c.join(", ")} ... ${w.join(", ")}`;
460
460
  }
461
461
  }
462
- function Re(c) {
463
- return c === "Shot" ? {
462
+ function Re(i) {
463
+ return i === "Shot" ? {
464
464
  base: "0010",
465
465
  increment: "0020",
466
466
  length: 10,
@@ -472,84 +472,84 @@ function Re(c) {
472
472
  difference: 1
473
473
  };
474
474
  }
475
- const St = ({
476
- onChange: c,
475
+ const Ct = ({
476
+ onChange: i,
477
477
  parentId: m = null,
478
478
  children: u,
479
- depth: d,
480
- onNew: v,
479
+ depth: c,
480
+ onNew: w,
481
481
  index: h,
482
482
  nesting: n = !0,
483
- isRoot: O,
483
+ isRoot: D,
484
484
  parentLabel: r,
485
- prefixDisabled: D,
486
- typeSelectRef: y,
487
- onLastInputKeydown: F,
488
- folders: A,
489
- ..._
485
+ prefixDisabled: q,
486
+ typeSelectRef: v,
487
+ onLastInputKeydown: O,
488
+ folders: j,
489
+ ...W
490
490
  }) => {
491
- const { base: q, increment: o, length: R, type: J, id: K, prefix: x, prefixDepth: ne, parentBases: W } = _, V = _.entityType, X = !n && O || D;
491
+ const { base: F, increment: R, length: p, type: K, id: L, prefix: b, prefixDepth: ne, parentBases: H } = W, J = W.entityType, X = !n && D || q;
492
492
  let ae = [];
493
- q && o && R && (ae = Ee(q, o, R));
494
- const [de, H] = z(ae), Y = ce(null), ee = ce(null), B = (l) => {
495
- l?.preventDefault && l?.preventDefault();
496
- let { value: C, id: $ } = l.target;
497
- $ === "prefixDepth" && (C = parseInt(String(C), 10));
498
- const T = { [$]: C }, k = { ..._, ...T };
499
- if ($ === "type") {
493
+ F && R && p && (ae = Ee(F, R, p));
494
+ const [de, U] = z(ae), Y = ce(null), ee = ce(null), B = (s) => {
495
+ s?.preventDefault && s?.preventDefault();
496
+ let { value: S, id: _ } = s.target;
497
+ _ === "prefixDepth" && (S = parseInt(String(S), 10));
498
+ const C = { [_]: S }, I = { ...W, ...C };
499
+ if (_ === "type") {
500
500
  let P = !1;
501
- const i = A.find((M) => M.name === C);
502
- for (const M of A) {
503
- if (k.base === "") {
501
+ const l = j.find((M) => M.name === S);
502
+ for (const M of j) {
503
+ if (I.base === "") {
504
504
  P = !0;
505
505
  break;
506
506
  }
507
507
  for (const N in M)
508
- if (typeof M[N] == "string" && k.base?.toLowerCase().includes(M[N].toLowerCase())) {
508
+ if (typeof M[N] == "string" && I.base?.toLowerCase().includes(M[N].toLowerCase())) {
509
509
  P = !0;
510
510
  break;
511
511
  }
512
512
  }
513
- if (!P || !i) return;
514
- const Z = V === "folder" && i.shortName || i.name, j = Re(String(C));
515
- k.base = Z + j.base, k.increment = Z + j.increment, k.length = j.length;
513
+ if (!P || !l) return;
514
+ const Z = J === "folder" && l.shortName || l.name, A = Re(String(S));
515
+ I.base = Z + A.base, I.increment = Z + A.increment, I.length = A.length;
516
516
  }
517
- if ($ === "base") {
518
- const P = Re(k.type), i = String(C), Z = i.replace(/[^a-zA-Z]/g, ""), j = i.replace(/[^0-9]/g, ""), M = parseInt(j, 10), N = j.length, U = Z + (M + P.difference).toString().padStart(N, "0");
519
- k.increment = U.replace("NaN", "");
517
+ if (_ === "base") {
518
+ const P = Re(I.type), l = String(S), Z = l.replace(/[^a-zA-Z]/g, ""), A = l.replace(/[^0-9]/g, ""), M = parseInt(A, 10), N = A.length, V = Z + (M + P.difference).toString().padStart(N, "0");
519
+ I.increment = V.replace("NaN", "");
520
520
  }
521
- if (c(
522
- k,
523
- typeof K == "string" ? K : void 0,
524
- V
525
- ), k.base && k.increment && k.length) {
526
- const P = Ee(k.base, k.increment, k.length);
527
- H(P);
521
+ if (i(
522
+ I,
523
+ typeof L == "string" ? L : void 0,
524
+ J
525
+ ), I.base && I.increment && I.length) {
526
+ const P = Ee(I.base, I.increment, I.length);
527
+ U(P);
528
528
  }
529
- $ === "type" && setTimeout(X ? () => {
529
+ _ === "type" && setTimeout(X ? () => {
530
530
  Y.current?.focus(), Y.current?.select();
531
531
  } : () => {
532
532
  ee.current?.focus();
533
533
  }, 50);
534
- }, [a, p] = z(!0);
534
+ }, [a, d] = z(!0);
535
535
  Le(
536
536
  () => {
537
- const l = setTimeout(() => {
538
- p(!1);
537
+ const s = setTimeout(() => {
538
+ d(!1);
539
539
  }, 1e3);
540
- return () => clearTimeout(l);
540
+ return () => clearTimeout(s);
541
541
  },
542
542
  // eslint-disable-next-line react-hooks/exhaustive-deps
543
543
  []
544
544
  );
545
- const g = It(de, 5, x ? r : void 0), S = ce(null), [s, b] = z(0);
545
+ const y = St(de, 5, b ? r : void 0), k = ce(null), [o, g] = z(0);
546
546
  return Ve(() => {
547
- S.current && b(S.current.offsetWidth);
548
- }, [S.current, x]), V === "task" ? /* @__PURE__ */ t(
549
- gt,
547
+ k.current && g(k.current.offsetWidth);
548
+ }, [k.current, b]), J === "task" ? /* @__PURE__ */ t(
549
+ bt,
550
550
  {
551
551
  className: Ae("task", { "is-new": a, nesting: n, "no-nesting": !n }),
552
- style: { zIndex: 100 - (d ?? 0) - (h ?? 0) },
552
+ style: { zIndex: 100 - (c ?? 0) - (h ?? 0) },
553
553
  children: /* @__PURE__ */ f(Se, { className: "form", children: [
554
554
  /* @__PURE__ */ t(Q, { icon: "task_alt" }),
555
555
  /* @__PURE__ */ t("strong", { children: "Task" }),
@@ -557,9 +557,9 @@ const St = ({
557
557
  /* @__PURE__ */ t(
558
558
  xe,
559
559
  {
560
- value: [J],
561
- onChange: (l) => B({ target: { value: l, id: "type" } }),
562
- options: A,
560
+ value: [K],
561
+ onChange: (s) => B({ target: { value: s, id: "type" } }),
562
+ options: j,
563
563
  style: { width: 160 },
564
564
  align: "right"
565
565
  }
@@ -568,7 +568,7 @@ const St = ({
568
568
  /* @__PURE__ */ t(
569
569
  he,
570
570
  {
571
- value: q,
571
+ value: F,
572
572
  id: "base",
573
573
  onChange: B,
574
574
  placeholder: "compositing...",
@@ -580,21 +580,21 @@ const St = ({
580
580
  {
581
581
  icon: "close",
582
582
  variant: "text",
583
- onClick: () => c({ id: K, delete: !0 }, m),
583
+ onClick: () => i({ id: L, delete: !0 }, m),
584
584
  className: "delete"
585
585
  }
586
586
  )
587
587
  ] })
588
588
  }
589
- ) : /* @__PURE__ */ f(yt, { className: "folder", children: [
590
- /* @__PURE__ */ f(xt, { className: "seq", style: { zIndex: 100 - (d ?? 0) - (h ?? 0) }, children: [
591
- n && /* @__PURE__ */ f(wt, { className: "buttons", children: [
589
+ ) : /* @__PURE__ */ f(gt, { className: "folder", children: [
590
+ /* @__PURE__ */ f(wt, { className: "seq", style: { zIndex: 100 - (c ?? 0) - (h ?? 0) }, children: [
591
+ n && /* @__PURE__ */ f(vt, { className: "buttons", children: [
592
592
  /* @__PURE__ */ f(Se, { children: [
593
- d === 0 && /* @__PURE__ */ t(
593
+ c === 0 && /* @__PURE__ */ t(
594
594
  fe,
595
595
  {
596
596
  icon: "south",
597
- onClick: () => v?.(null),
597
+ onClick: () => w?.(null),
598
598
  label: "Root",
599
599
  title: "add root folder"
600
600
  }
@@ -603,8 +603,8 @@ const St = ({
603
603
  fe,
604
604
  {
605
605
  icon: te.folder.icon,
606
- onClick: () => K && v?.(K, "folder"),
607
- label: d === 0 ? te.folder.label : void 0,
606
+ onClick: () => L && w?.(L, "folder"),
607
+ label: c === 0 ? te.folder.label : void 0,
608
608
  title: "add nested folder"
609
609
  }
610
610
  )
@@ -613,18 +613,18 @@ const St = ({
613
613
  fe,
614
614
  {
615
615
  icon: te.task.icon,
616
- onClick: () => K && v?.(K, "task"),
617
- label: d === 0 ? te.task.label : void 0,
616
+ onClick: () => L && w?.(L, "task"),
617
+ label: c === 0 ? te.task.label : void 0,
618
618
  title: "add nested task",
619
619
  style: { width: "max-content", marginLeft: "auto" }
620
620
  }
621
621
  )
622
622
  ] }),
623
623
  /* @__PURE__ */ f(
624
- $e,
624
+ Be,
625
625
  {
626
626
  className: Ae({ "is-new": a, "no-nesting": !n }),
627
- ref: S,
627
+ ref: k,
628
628
  children: [
629
629
  /* @__PURE__ */ f(Se, { className: "form folder", children: [
630
630
  /* @__PURE__ */ f(re, { children: [
@@ -632,26 +632,26 @@ const St = ({
632
632
  /* @__PURE__ */ t(
633
633
  xe,
634
634
  {
635
- value: [J],
636
- onChange: (l) => B({ target: { value: l, id: "type" } }),
637
- options: A,
635
+ value: [K],
636
+ onChange: (s) => B({ target: { value: s, id: "type" } }),
637
+ options: j,
638
638
  style: { width: 160 },
639
639
  align: "right",
640
- ref: y
640
+ ref: v
641
641
  }
642
642
  )
643
643
  ] }),
644
644
  /* @__PURE__ */ t(Q, { icon: "trending_flat" }),
645
- (d !== 0 || !n) && /* @__PURE__ */ f(ue, { children: [
645
+ (c !== 0 || !n) && /* @__PURE__ */ f(ue, { children: [
646
646
  /* @__PURE__ */ f(ue, { children: [
647
647
  /* @__PURE__ */ f(re, { children: [
648
648
  /* @__PURE__ */ t("label", { children: "Prefix" }),
649
649
  /* @__PURE__ */ t(
650
650
  Ne,
651
651
  {
652
- checked: x,
652
+ checked: b,
653
653
  id: "prefix",
654
- onChange: () => B({ target: { value: !x, id: "prefix" } }),
654
+ onChange: () => B({ target: { value: !b, id: "prefix" } }),
655
655
  disabled: X,
656
656
  ref: ee,
657
657
  switchStyle: { margin: "4px 0" }
@@ -660,7 +660,7 @@ const St = ({
660
660
  ] }),
661
661
  /* @__PURE__ */ t(Q, { icon: "trending_flat" })
662
662
  ] }),
663
- n && x && /* @__PURE__ */ f(re, { children: [
663
+ n && b && /* @__PURE__ */ f(re, { children: [
664
664
  /* @__PURE__ */ t("label", { children: "Depth" }),
665
665
  /* @__PURE__ */ t(
666
666
  je,
@@ -668,19 +668,19 @@ const St = ({
668
668
  value: ne,
669
669
  id: "prefixDepth",
670
670
  onChange: B,
671
- max: W?.length,
671
+ max: H?.length,
672
672
  min: 0
673
673
  }
674
674
  )
675
675
  ] })
676
676
  ] }),
677
- W && n && /* @__PURE__ */ t(re, { style: { display: x ? "flex" : "none" }, children: /* @__PURE__ */ t(kt, { children: W.join("") }) }),
677
+ H && n && /* @__PURE__ */ t(re, { style: { display: b ? "flex" : "none" }, children: /* @__PURE__ */ t(kt, { children: H.join("") }) }),
678
678
  /* @__PURE__ */ f(re, { className: "seq", children: [
679
679
  /* @__PURE__ */ t("label", { children: "First Name" }),
680
680
  /* @__PURE__ */ t(
681
681
  he,
682
682
  {
683
- value: q,
683
+ value: F,
684
684
  id: "base",
685
685
  ref: Y,
686
686
  onChange: B,
@@ -695,7 +695,7 @@ const St = ({
695
695
  /* @__PURE__ */ t(
696
696
  he,
697
697
  {
698
- value: o,
698
+ value: R,
699
699
  id: "increment",
700
700
  onChange: B,
701
701
  placeholder: "ep102...",
@@ -709,62 +709,62 @@ const St = ({
709
709
  /* @__PURE__ */ t(
710
710
  je,
711
711
  {
712
- value: R,
712
+ value: p,
713
713
  id: "length",
714
714
  onChange: B,
715
715
  placeholder: "15...",
716
716
  min: 2,
717
- onFocus: (l) => l.target.select(),
718
- onKeyDown: F
717
+ onFocus: (s) => s.target.select(),
718
+ onKeyDown: O
719
719
  }
720
720
  )
721
721
  ] }),
722
- /* @__PURE__ */ t(Be, {}),
722
+ /* @__PURE__ */ t(ze, {}),
723
723
  n && /* @__PURE__ */ t(
724
724
  fe,
725
725
  {
726
726
  icon: "close",
727
727
  variant: "text",
728
- onClick: () => c({ id: K, delete: !0 }),
729
- disabled: d === 0 && h === 0
728
+ onClick: () => i({ id: L, delete: !0 }),
729
+ disabled: c === 0 && h === 0
730
730
  }
731
731
  )
732
732
  ] }),
733
- !n && /* @__PURE__ */ f(vt, { children: [
733
+ !n && /* @__PURE__ */ f(It, { children: [
734
734
  "Example: ",
735
- g
735
+ y
736
736
  ] })
737
737
  ]
738
738
  }
739
739
  )
740
740
  ] }),
741
741
  n && /* @__PURE__ */ t(
742
- bt,
742
+ xt,
743
743
  {
744
744
  className: "children",
745
- style: { width: s, zIndex: 99 - (d ?? 0) - (h ?? 0) },
745
+ style: { width: o, zIndex: 99 - (c ?? 0) - (h ?? 0) },
746
746
  children: u
747
747
  }
748
748
  )
749
749
  ] });
750
- }, Ct = ({
751
- options: c,
750
+ }, Tt = ({
751
+ options: i,
752
752
  onOpenNew: m,
753
753
  enabled: u = !0
754
754
  }) => {
755
- const { menuOpen: d } = Pe(Ye) || { menuOpen: !1 }, { editingCellId: v } = Pe(st) || { editingCellId: null };
755
+ const { menuOpen: c } = Pe(et) || { menuOpen: !1 }, { editingCellId: w } = Pe(lt) || { editingCellId: null };
756
756
  Le(() => {
757
757
  if (!u) return;
758
758
  const h = (n) => {
759
- if (d || n.target instanceof HTMLElement && (n.target.tagName === "INPUT" || n.target.tagName === "TEXTAREA" || n.target.isContentEditable || n.target.getAttribute("role") === "textbox") || v || n.ctrlKey || n.metaKey || n.altKey)
759
+ if (c || n.target instanceof HTMLElement && (n.target.tagName === "INPUT" || n.target.tagName === "TEXTAREA" || n.target.isContentEditable || n.target.getAttribute("role") === "textbox") || w || n.ctrlKey || n.metaKey || n.altKey)
760
760
  return;
761
- const O = n.key.toUpperCase(), r = c.find((D) => D.shortcut === O);
761
+ const D = n.key.toUpperCase(), r = i.find((q) => q.shortcut === D);
762
762
  r && !r.disabled && (n.preventDefault(), m(r.type, { isSequence: r.isSequence }));
763
763
  };
764
764
  return window.addEventListener("keydown", h), () => {
765
765
  window.removeEventListener("keydown", h);
766
766
  };
767
- }, [u, c, m, v, d]);
767
+ }, [u, i, m, w, c]);
768
768
  }, we = E.label`
769
769
  font-size: ${qe.labelMedium};
770
770
  color: var(--md-sys-color-outline);
@@ -783,14 +783,14 @@ const St = ({
783
783
  font-size: 16px;
784
784
  color: var(--md-sys-color-outline);
785
785
  }
786
- `, Tt = E.div`
786
+ `, Nt = E.div`
787
787
  display: flex;
788
788
  align-items: center;
789
789
  margin-top: 6px;
790
790
  gap: var(--base-gap-small);
791
791
  width: 100%;
792
792
  word-break: break-all;
793
- `, Nt = E.span`
793
+ `, Et = E.span`
794
794
  position: relative;
795
795
  padding: 2px 6px;
796
796
  font-size: ${qe.bodySmall};
@@ -810,7 +810,7 @@ const St = ({
810
810
  display: flex;
811
811
  }
812
812
  }
813
- `, Et = E(he)`
813
+ `, Ot = E(he)`
814
814
  font-size: ${qe.bodySmall};
815
815
  width: 100px;
816
816
  max-width: 160px;
@@ -829,76 +829,78 @@ const St = ({
829
829
  outline: 1px solid var(--md-sys-color-primary);
830
830
  }
831
831
  }
832
- `, Ot = ({
833
- handleChange: c,
832
+ `, Dt = ({
833
+ handleChange: i,
834
834
  entityForm: m,
835
835
  setNameFocused: u,
836
- handleKeyDown: d,
837
- labelRef: v,
836
+ handleKeyDown: c,
837
+ labelRef: w,
838
838
  nameInfo: h = ""
839
839
  }) => {
840
- const [n, O] = z(!1), [r, D] = z(void 0), y = ce(null), F = () => {
841
- O(!0), u(!0), D(m.name), setTimeout(() => {
842
- y.current && (y.current.focus(), y.current.select());
840
+ const n = Je(), [D, r] = z(!1), [q, v] = z(void 0), O = ce(null), j = () => {
841
+ r(!0), u(!0), v(m.name), setTimeout(() => {
842
+ O.current && (O.current.focus(), O.current.select());
843
843
  }, 0);
844
- }, A = (o) => {
845
- const R = o.relatedTarget;
846
- (!R || !y.current?.contains(R)) && (O(!1), u(!1), D(void 0));
847
- }, _ = (o) => {
848
- if (o.key === "ArrowDown" && !o.altKey || o.key === "Tab") {
849
- o.preventDefault(), F();
844
+ }, W = (p) => {
845
+ const K = p.relatedTarget;
846
+ (!K || !O.current?.contains(K)) && (r(!1), u(!1), v(void 0));
847
+ }, F = (p) => {
848
+ if (p.key === "ArrowDown" && !p.altKey || p.key === "Tab") {
849
+ p.preventDefault(), j();
850
850
  return;
851
851
  }
852
- d(o, !0);
853
- }, q = (o) => {
854
- if (o.key === "Enter" || o.key === "Escape" || o.key === "ArrowUp" && !o.altKey) {
855
- if (o.stopPropagation(), o.key === "Enter" && !n)
856
- return F();
857
- o.key === "Escape" && r !== void 0 && c(r, "name"), O(!1), u(!1), D(void 0), setTimeout(() => {
858
- v.current?.focus();
859
- const R = m.label.length || 0;
860
- v.current?.setSelectionRange(R, R);
852
+ c(p, !0);
853
+ }, R = (p) => {
854
+ if (p.key === "Enter" || p.key === "Escape" || p.key === "ArrowUp" && !p.altKey) {
855
+ if (p.stopPropagation(), p.key === "Enter" && !D)
856
+ return j();
857
+ p.key === "Escape" && q !== void 0 && i(q, "name"), r(!1), u(!1), v(void 0), setTimeout(() => {
858
+ w.current?.focus();
859
+ const K = m.label.length || 0;
860
+ w.current?.setSelectionRange(K, K);
861
861
  }, 0);
862
862
  return;
863
863
  }
864
864
  };
865
865
  return /* @__PURE__ */ f(Oe, { style: { flex: 1 }, children: [
866
- /* @__PURE__ */ t(we, { children: "Label" }),
866
+ /* @__PURE__ */ t(we, { htmlFor: `${n}-label`, children: "Label" }),
867
867
  /* @__PURE__ */ t(
868
868
  he,
869
869
  {
870
+ id: `${n}-label`,
870
871
  value: m.label,
871
- onChange: (o) => c(o.target.value, "label"),
872
- ref: v,
872
+ onChange: (p) => i(p.target.value, "label"),
873
+ ref: w,
873
874
  onFocus: () => u(!0),
874
- onKeyDown: _,
875
+ onKeyDown: F,
875
876
  style: { flex: 1, width: "100%" }
876
877
  }
877
878
  ),
878
- /* @__PURE__ */ f(Tt, { onKeyDown: q, children: [
879
- /* @__PURE__ */ t(we, { children: "Name" }),
879
+ /* @__PURE__ */ f(Nt, { onKeyDown: R, children: [
880
+ /* @__PURE__ */ t(we, { htmlFor: `${n}-name`, children: "Name" }),
880
881
  h && /* @__PURE__ */ t(Q, { icon: "info", "data-tooltip": h, "data-tooltip-delay": 0 }),
881
- n ? /* @__PURE__ */ t(
882
- Et,
882
+ D ? /* @__PURE__ */ t(
883
+ Ot,
883
884
  {
884
- ref: y,
885
+ id: `${n}-name`,
886
+ ref: O,
885
887
  value: m.name,
886
- onChange: (o) => c(o.target.value, "name"),
887
- onBlur: A,
888
+ onChange: (p) => i(p.target.value, "name"),
889
+ onBlur: W,
888
890
  style: { flex: 1 }
889
891
  }
890
- ) : /* @__PURE__ */ f(Nt, { onClick: F, tabIndex: 0, children: [
892
+ ) : /* @__PURE__ */ f(Et, { onClick: j, tabIndex: 0, children: [
891
893
  m.name,
892
894
  " ",
893
895
  /* @__PURE__ */ t(Q, { icon: "edit" })
894
896
  ] })
895
897
  ] })
896
898
  ] });
897
- }, Dt = E(et)`
899
+ }, qt = E(tt)`
898
900
  .body {
899
901
  overflow: visible;
900
902
  }
901
- `, qt = E.div`
903
+ `, Ft = E.div`
902
904
  display: flex;
903
905
  align-items: flex-start;
904
906
  gap: var(--base-gap-large);
@@ -907,7 +909,7 @@ const St = ({
907
909
  margin-right: 8px;
908
910
  }
909
911
  }
910
- `, Ft = E(De)`
912
+ `, Pt = E(De)`
911
913
  overflow: visible;
912
914
  min-width: fit-content;
913
915
  .button {
@@ -932,7 +934,7 @@ const St = ({
932
934
  align-items: center;
933
935
  min-height: 32px;
934
936
  color: var(--md-sys-color-outline);
935
- `, Pt = E.span`
937
+ `, Mt = E.span`
936
938
  display: flex;
937
939
  align-items: center;
938
940
  gap: var(--base-gap-small);
@@ -948,110 +950,110 @@ const St = ({
948
950
  &.disabled {
949
951
  opacity: 0.5;
950
952
  }
951
- `, wn = ({
952
- disabled: c,
953
+ `, vn = ({
954
+ disabled: i,
953
955
  onNewEntities: m,
954
956
  showButton: u = !0,
955
- showDialog: d = !0,
956
- enableShortcuts: v = !0
957
+ showDialog: c = !0,
958
+ enableShortcuts: w = !0
957
959
  }) => {
958
960
  const { ...h } = Te(), {
959
961
  entityType: n,
960
- setEntityType: O,
962
+ setEntityType: D,
961
963
  entityForm: r,
962
- setEntityForm: D,
963
- sequenceForm: y,
964
- setSequenceForm: F,
965
- onCreateNew: A,
966
- onOpenNew: _,
967
- config: q,
968
- parentFolderIds: o
969
- } = pt(), [R, J] = z(!1), { selectedCells: K } = lt() || {}, x = mt(), { getFolderById: ne } = ze(), W = it(), V = W?.getEntityById, X = W?.showHierarchy ?? !0, ae = ge(() => {
970
- if (o !== null) return o;
971
- const e = K ? Array.from(K).map((I) => ct(I)) : [], w = Array.from(
964
+ setEntityForm: q,
965
+ sequenceForm: v,
966
+ setSequenceForm: O,
967
+ onCreateNew: j,
968
+ onOpenNew: W,
969
+ config: F,
970
+ parentFolderIds: R
971
+ } = ft(), [p, K] = z(!1), { selectedCells: L } = it() || {}, b = ht(), { getFolderById: ne } = $e(), H = ct(), J = H?.getEntityById, X = H?.showHierarchy ?? !0, ae = ge(() => {
972
+ if (R !== null) return R;
973
+ const e = L ? Array.from(L).map((T) => dt(T)) : [], x = Array.from(
972
974
  new Set(
973
- e.filter((I) => I && I.colId !== Me).map((I) => I?.rowId).filter(Boolean)
975
+ e.filter((T) => T && T.colId !== Me).map((T) => T?.rowId).filter(Boolean)
974
976
  )
975
- ), L = Array.from(
977
+ ), $ = Array.from(
976
978
  new Set(
977
- e.filter((I) => I?.colId === Me).map((I) => I?.rowId).filter(Boolean)
979
+ e.filter((T) => T?.colId === Me).map((T) => T?.rowId).filter(Boolean)
978
980
  )
979
- ), le = w.length > 0 ? w : L;
981
+ ), le = x.length > 0 ? x : $;
980
982
  if (le.length > 0) {
981
- const I = le.map((G) => V?.(G)), ie = I.filter(
983
+ const T = le.map((G) => J?.(G)), ie = T.filter(
982
984
  (G) => G?.entityType === "folder"
983
- ), Ie = I.filter(
985
+ ), ke = T.filter(
984
986
  (G) => G?.entityType === "task"
985
987
  ), Fe = Array.from(
986
988
  /* @__PURE__ */ new Set([
987
989
  ...ie.map((G) => G.id),
988
- ...Ie.map((G) => G.folderId)
990
+ ...ke.map((G) => G.folderId)
989
991
  ])
990
992
  );
991
993
  if (Fe.length) return Fe;
992
994
  }
993
- return x ? Object.keys(x).filter((I) => x[I]) : [];
994
- }, [o, K, x, V]), de = ge(() => o !== null ? o : x ? Object.keys(x).filter((e) => x[e]) : [], [o, x]), H = n === "folder" && !X ? de : ae, Y = ae.length > 0, ee = ge(
995
- () => H.map((e) => {
996
- const w = V?.(e) || ne(e);
997
- return { value: e, label: w?.label || w?.name || e };
995
+ return b ? Object.keys(b).filter((T) => b[T]) : [];
996
+ }, [R, L, b, J]), de = ge(() => R !== null ? R : b ? Object.keys(b).filter((e) => b[e]) : [], [R, b]), U = n === "folder" && !X ? de : ae, Y = ae.length > 0, ee = ge(
997
+ () => U.map((e) => {
998
+ const x = J?.(e) || ne(e);
999
+ return { value: e, label: x?.label || x?.name || e };
998
1000
  }),
999
- [H, V, ne]
1001
+ [U, J, ne]
1000
1002
  ), [B, a] = z(null);
1001
- let p = B !== null ? B : H;
1002
- p = p.filter((e) => H.includes(e)), p.length === 0 && H.length > 0 && (p = H);
1003
- const g = p.map((e) => ee.find((w) => w.value === e)?.label || "").filter(Boolean), S = g[0] || "", s = Ce(H), [b, l] = z(!1), [C, $] = z(!1), T = { label: "", subType: "", name: "" }, k = () => {
1003
+ let d = B !== null ? B : U;
1004
+ d = d.filter((e) => U.includes(e)), d.length === 0 && U.length > 0 && (d = U);
1005
+ const y = d.map((e) => ee.find((x) => x.value === e)?.label || "").filter(Boolean), k = y[0] || "", o = Ce(U), [g, s] = z(!1), [S, _] = z(!1), C = { label: "", subType: "", name: "" }, I = () => {
1004
1006
  let e = "Add New ";
1005
- return s && n === "folder" && (e += "Root "), e += n ? te[n].label : "", s || (g.length > 2 ? e += " - " + g.slice(0, 2).join(", ") + ` +${g.length - 2} more` : e += " - " + g.join(", ")), e;
1006
- }, P = (n === "folder" ? h?.folderTypes : h?.taskTypes) || [], i = (e, w) => {
1007
- if (!w) return;
1008
- let L = { ...r };
1009
- if (L[w] = e, e && w === "subType") {
1010
- const le = P.find((ie) => ie.name === r.subType), I = P.find((ie) => ie.name === e);
1011
- if (I && r.label === le?.name) {
1012
- L.label = I.name;
1013
- const Ie = be(r.label, q);
1014
- r.name === Ie && (L.name = be(L.label, q));
1007
+ return o && n === "folder" && (e += "Root "), e += n ? te[n].label : "", o || (y.length > 2 ? e += " - " + y.slice(0, 2).join(", ") + ` +${y.length - 2} more` : e += " - " + y.join(", ")), e;
1008
+ }, P = (n === "folder" ? h?.folderTypes : h?.taskTypes) || [], l = (e, x) => {
1009
+ if (!x) return;
1010
+ let $ = { ...r };
1011
+ if ($[x] = e, e && x === "subType") {
1012
+ const le = P.find((ie) => ie.name === r.subType), T = P.find((ie) => ie.name === e);
1013
+ if (T && r.label === le?.name) {
1014
+ $.label = T.name;
1015
+ const ke = be(r.label, F);
1016
+ r.name === ke && ($.name = be($.label, F));
1015
1017
  }
1016
1018
  setTimeout(() => {
1017
1019
  M.current?.focus();
1018
1020
  }, 100);
1019
- } else w === "label" ? (L.label = e, C || (L.name = be(e, q))) : w === "name" && ($(!0), L.name = e);
1020
- D(L);
1021
+ } else x === "label" ? ($.label = e, S || ($.name = be(e, F))) : x === "name" && (_(!0), $.name = e);
1022
+ q($);
1021
1023
  }, Z = (e) => {
1022
- D({ ...r, label: e.base, subType: e.type }), F({
1023
- ...y,
1024
+ q({ ...r, label: e.base, subType: e.type }), O({
1025
+ ...v,
1024
1026
  increment: e.increment,
1025
1027
  length: e.length,
1026
1028
  prefix: e.prefix,
1027
1029
  prefixDepth: e.prefixDepth
1028
1030
  });
1029
- }, j = ce(null), M = ce(null), N = () => {
1030
- O(null), D(T), F((e) => ({ ...e, active: !1 })), $(!1), a(null);
1031
- }, U = () => setTimeout(() => j.current?.open(), 180), [oe, ye] = z(!1), se = async (e) => {
1032
- const w = Xe(r.label);
1033
- if (!w.valid) {
1034
- me.error(w.error || "Invalid label");
1031
+ }, A = ce(null), M = ce(null), N = () => {
1032
+ D(null), q(C), O((e) => ({ ...e, active: !1 })), _(!1), a(null);
1033
+ }, V = () => setTimeout(() => A.current?.open(), 180), [oe, ye] = z(!1), se = async (e) => {
1034
+ const x = Ze(r.label);
1035
+ if (!x.valid) {
1036
+ me.error(x.error || "Invalid label");
1035
1037
  return;
1036
1038
  }
1037
- const { valid: L, error: le } = Ze(r.name);
1038
- if (!L) {
1039
+ const { valid: $, error: le } = Ge(r.name);
1040
+ if (!$) {
1039
1041
  me.error(le || "Invalid name");
1040
1042
  return;
1041
1043
  }
1042
1044
  ye(!0);
1043
1045
  try {
1044
- const I = await A(p);
1045
- console.log(I), m?.(I, e), e ? (M.current && (M.current.focus(), M.current.select()), $(!1)) : N();
1046
+ const T = await j(d);
1047
+ m?.(T, e, d), e ? (M.current && (M.current.focus(), M.current.select()), _(!1)) : N();
1046
1048
  } catch {
1047
1049
  } finally {
1048
1050
  ye(!1);
1049
1051
  }
1050
- }, pe = (e, w) => {
1051
- e?.stopPropagation(), e.key === "Enter" ? w && !e.shiftKey || e.ctrlKey || e.metaKey ? (se(!1), J(!1)) : e.shiftKey && (se(!0), J(!0)) : e.key === "Escape" && N();
1052
+ }, pe = (e, x) => {
1053
+ e?.stopPropagation(), e.key === "Enter" ? x && !e.shiftKey || e.ctrlKey || e.metaKey ? (se(!1), K(!1)) : e.shiftKey && (se(!0), K(!0)) : e.key === "Escape" && N();
1052
1054
  }, _e = () => {
1053
- b && (l(!1), setTimeout(() => {
1054
- j.current?.open();
1055
+ g && (s(!1), setTimeout(() => {
1056
+ A.current?.open();
1055
1057
  }, 100));
1056
1058
  }, ve = ge(
1057
1059
  () => [
@@ -1080,14 +1082,14 @@ const St = ({
1080
1082
  ],
1081
1083
  [Y]
1082
1084
  );
1083
- Ct({ options: ve, onOpenNew: _, enabled: v });
1085
+ Tt({ options: ve, onOpenNew: W, enabled: w });
1084
1086
  const We = (e) => {
1085
- const w = ve.find((L) => L.value === e);
1086
- w && !w.disabled && _(w.type, { isSequence: w.isSequence });
1087
- }, ke = n === "task" && Ce(p), He = !r.label || !r.subType || ke;
1087
+ const x = ve.find(($) => $.value === e);
1088
+ x && !x.disabled && W(x.type, { isSequence: x.isSequence });
1089
+ }, Ie = n === "task" && Ce(d), He = !r.label || !r.subType || Ie;
1088
1090
  return /* @__PURE__ */ f(ue, { children: [
1089
1091
  u && /* @__PURE__ */ t(
1090
- Ft,
1092
+ Pt,
1091
1093
  {
1092
1094
  options: ve,
1093
1095
  value: [],
@@ -1097,73 +1099,73 @@ const St = ({
1097
1099
  /* @__PURE__ */ t("span", { children: "Create" })
1098
1100
  ] }),
1099
1101
  itemTemplate: (e) => /* @__PURE__ */ f(
1100
- Pt,
1102
+ Mt,
1101
1103
  {
1102
1104
  className: e.disabled ? "disabled" : void 0,
1103
1105
  "data-tooltip": e.disabled ? e.disabledMessage : void 0,
1104
1106
  children: [
1105
1107
  /* @__PURE__ */ t(Q, { icon: e.icon }),
1106
1108
  /* @__PURE__ */ t("span", { className: "label", children: e.label }),
1107
- /* @__PURE__ */ t(tt, { children: e.shortcut })
1109
+ /* @__PURE__ */ t(nt, { children: e.shortcut })
1108
1110
  ]
1109
1111
  }
1110
1112
  ),
1111
1113
  itemStyle: {
1112
1114
  paddingRight: 16
1113
1115
  },
1114
- disabled: c,
1116
+ disabled: i,
1115
1117
  "data-tooltip": "Create new entity"
1116
1118
  }
1117
1119
  ),
1118
- d && n && /* @__PURE__ */ t(
1119
- Dt,
1120
+ c && n && /* @__PURE__ */ t(
1121
+ qt,
1120
1122
  {
1121
- header: k(),
1123
+ header: I(),
1122
1124
  isOpen: !0,
1123
1125
  onClose: N,
1124
- onShow: U,
1125
- size: y.active ? "lg" : "md",
1126
- style: { maxWidth: y.active ? "unset" : 430 },
1126
+ onShow: V,
1127
+ size: v.active ? "lg" : "md",
1128
+ style: { maxWidth: v.active ? "unset" : 430 },
1127
1129
  enableBackdropClose: !1,
1128
- footer: /* @__PURE__ */ f(nt, { onFocus: () => l(!1), style: { width: "100%" }, children: [
1130
+ footer: /* @__PURE__ */ f(at, { onFocus: () => s(!1), style: { width: "100%" }, children: [
1129
1131
  n === "folder" && /* @__PURE__ */ f(ue, { children: [
1130
1132
  /* @__PURE__ */ t("span", { children: "Sequence" }),
1131
1133
  /* @__PURE__ */ t(
1132
1134
  Ne,
1133
1135
  {
1134
- checked: y.active,
1135
- onChange: (e) => F({
1136
- ...y,
1136
+ checked: v.active,
1137
+ onChange: (e) => O({
1138
+ ...v,
1137
1139
  active: e.target.checked
1138
1140
  })
1139
1141
  }
1140
1142
  )
1141
1143
  ] }),
1142
- /* @__PURE__ */ t(Be, {}),
1144
+ /* @__PURE__ */ t(ze, {}),
1143
1145
  /* @__PURE__ */ t("span", { children: "Create more" }),
1144
1146
  /* @__PURE__ */ t(
1145
1147
  Ne,
1146
1148
  {
1147
- checked: R,
1148
- onChange: (e) => J(e.target.checked)
1149
+ checked: p,
1150
+ onChange: (e) => K(e.target.checked)
1149
1151
  }
1150
1152
  ),
1151
1153
  /* @__PURE__ */ t(
1152
- at,
1154
+ rt,
1153
1155
  {
1154
1156
  label: te[n].createLabel,
1155
- onClick: () => se(R),
1157
+ onClick: () => se(p),
1156
1158
  active: !He || oe,
1157
- disabled: !r.name || !r.label || ke,
1158
- "data-tooltip": ke ? "Select a parent folder" : void 0,
1159
- "data-shortcut": ft("Enter", [ut.Ctrl]),
1159
+ disabled: !r.name || !r.label || Ie,
1160
+ "data-tooltip": Ie ? "Select a parent folder" : void 0,
1161
+ "data-shortcut": ut("Enter", [mt.Ctrl]),
1160
1162
  saving: oe
1161
1163
  }
1162
1164
  )
1163
1165
  ] }),
1164
1166
  onKeyDown: (e) => pe(e),
1165
1167
  onClick: (e) => {
1166
- e.target.tagName !== "INPUT" && l(!1);
1168
+ e.target.tagName !== "INPUT" && s(!1);
1167
1169
  },
1168
1170
  children: /* @__PURE__ */ f(
1169
1171
  "div",
@@ -1176,10 +1178,10 @@ const St = ({
1176
1178
  children: [
1177
1179
  /* @__PURE__ */ f(Oe, { children: [
1178
1180
  /* @__PURE__ */ t(we, { children: "Parent folder" }),
1179
- H.length > 0 ? /* @__PURE__ */ t(
1181
+ U.length > 0 ? /* @__PURE__ */ t(
1180
1182
  De,
1181
1183
  {
1182
- value: p,
1184
+ value: d,
1183
1185
  options: ee,
1184
1186
  onChange: (e) => a(e),
1185
1187
  disabled: ee.length <= 1,
@@ -1188,52 +1190,52 @@ const St = ({
1188
1190
  }
1189
1191
  ) : n === "task" ? /* @__PURE__ */ t(Ke, { children: "Select a folder to create a task in" }) : /* @__PURE__ */ t(Ke, { children: "Creating in the project root" })
1190
1192
  ] }),
1191
- y.active ? (
1193
+ v.active ? (
1192
1194
  // @ts-ignore
1193
1195
  /* @__PURE__ */ t(
1194
- St,
1196
+ Ct,
1195
1197
  {
1196
1198
  base: r.label,
1197
1199
  type: r.subType,
1198
- increment: y.increment,
1199
- length: y.length,
1200
- prefix: y.prefix,
1201
- prefixDepth: y.prefixDepth,
1202
- parentLabel: S,
1200
+ increment: v.increment,
1201
+ length: v.length,
1202
+ prefix: v.prefix,
1203
+ prefixDepth: v.prefixDepth,
1204
+ parentLabel: k,
1203
1205
  entityType: "folder",
1204
1206
  nesting: !1,
1205
1207
  onChange: Z,
1206
- isRoot: s,
1207
- typeSelectRef: j,
1208
+ isRoot: o,
1209
+ typeSelectRef: A,
1208
1210
  onLastInputKeydown: (e) => pe(e, !0),
1209
1211
  folders: h?.folderTypes || []
1210
1212
  }
1211
1213
  )
1212
- ) : /* @__PURE__ */ f(qt, { children: [
1214
+ ) : /* @__PURE__ */ f(Ft, { children: [
1213
1215
  /* @__PURE__ */ f(Oe, { children: [
1214
1216
  /* @__PURE__ */ t(we, { children: "Type" }),
1215
1217
  /* @__PURE__ */ t(
1216
1218
  xe,
1217
1219
  {
1218
1220
  value: [r.subType],
1219
- onChange: (e) => i(e, "subType"),
1221
+ onChange: (e) => l(e, "subType"),
1220
1222
  options: P,
1221
1223
  style: { width: 160 },
1222
- ref: j,
1224
+ ref: A,
1223
1225
  onFocus: _e,
1224
- onClick: () => l(!1)
1226
+ onClick: () => s(!1)
1225
1227
  }
1226
1228
  )
1227
1229
  ] }),
1228
1230
  /* @__PURE__ */ t(
1229
- Ot,
1231
+ Dt,
1230
1232
  {
1231
- handleChange: i,
1233
+ handleChange: l,
1232
1234
  entityForm: r,
1233
1235
  labelRef: M,
1234
- setNameFocused: l,
1236
+ setNameFocused: s,
1235
1237
  handleKeyDown: pe,
1236
- nameInfo: `Names are auto generated from the label using the Entity Naming setting on the project anatomy. Capitalization: ${q.capitalization}. Separator: "${q.separator}"`
1238
+ nameInfo: `Names are auto generated from the label using the Entity Naming setting on the project anatomy. Capitalization: ${F.capitalization}. Separator: "${F.separator}"`
1237
1239
  }
1238
1240
  )
1239
1241
  ] })
@@ -1247,12 +1249,12 @@ const St = ({
1247
1249
  export {
1248
1250
  we as InputLabel,
1249
1251
  Oe as InputsContainer,
1250
- Tt as NameRow,
1251
- wn as NewEntity,
1252
- dt as NewEntityContext,
1253
- Ot as NewEntityForm,
1254
- xn as NewEntityProvider,
1255
- ht as generateLabel,
1252
+ Nt as NameRow,
1253
+ vn as NewEntity,
1254
+ pt as NewEntityContext,
1255
+ Dt as NewEntityForm,
1256
+ wn as NewEntityProvider,
1257
+ yt as generateLabel,
1256
1258
  te as newEntityDefinitions,
1257
- pt as useNewEntityContext
1259
+ ft as useNewEntityContext
1258
1260
  };