@ynput/ayon-frontend-shared 0.3.10 → 0.3.11

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.
Files changed (21) hide show
  1. package/dist/api.cjs.js +1 -1
  2. package/dist/api.es.js +123 -122
  3. package/dist/shared/src/api/queries/tasks/updateTasks.cjs.js +1 -1
  4. package/dist/shared/src/api/queries/tasks/updateTasks.cjs.js.map +1 -1
  5. package/dist/shared/src/api/queries/tasks/updateTasks.es.js +40 -22
  6. package/dist/shared/src/api/queries/tasks/updateTasks.es.js.map +1 -1
  7. package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.cjs.js +1 -1
  8. package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.cjs.js.map +1 -1
  9. package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.es.js +93 -93
  10. package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.es.js.map +1 -1
  11. package/dist/shared/src/containers/ProjectTreeTable/context/ClipboardContext.cjs.js +4 -4
  12. package/dist/shared/src/containers/ProjectTreeTable/context/ClipboardContext.cjs.js.map +1 -1
  13. package/dist/shared/src/containers/ProjectTreeTable/context/ClipboardContext.es.js +226 -226
  14. package/dist/shared/src/containers/ProjectTreeTable/context/ClipboardContext.es.js.map +1 -1
  15. package/dist/shared/src/containers/ProjectTreeTable/hooks/useBuildGroupByTableData.cjs.js +1 -1
  16. package/dist/shared/src/containers/ProjectTreeTable/hooks/useBuildGroupByTableData.cjs.js.map +1 -1
  17. package/dist/shared/src/containers/ProjectTreeTable/hooks/useBuildGroupByTableData.es.js +25 -24
  18. package/dist/shared/src/containers/ProjectTreeTable/hooks/useBuildGroupByTableData.es.js.map +1 -1
  19. package/dist/types/api/queries/entityLists/types.d.ts +1 -0
  20. package/dist/types/api/queries/tasks/updateTasks.d.ts +7 -0
  21. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- import { j as xt } from "../../../../../_virtual/jsx-runtime.es.js";
2
- import { createContext as Ct, useCallback as st, useEffect as vt, useMemo as Et, useContext as St } from "react";
3
- import { useSelectionCellsContext as $t, ROW_SELECTION_COLUMN_ID as O } from "./SelectionCellsContext.es.js";
4
- import { useCellEditing as At } from "./CellEditingContext.es.js";
1
+ import { j as vt } from "../../../../../_virtual/jsx-runtime.es.js";
2
+ import { createContext as Et, useCallback as it, useEffect as St, useMemo as $t, useContext as At } from "react";
3
+ import { useSelectionCellsContext as Lt, ROW_SELECTION_COLUMN_ID as O } from "./SelectionCellsContext.es.js";
4
+ import { useCellEditing as _t } from "./CellEditingContext.es.js";
5
5
  import "../../../context/RemoteModulesContext.es.js";
6
6
  import "../../../context/DetailsPanelContext.es.js";
7
7
  import "../../../context/SubtasksModulesContext.es.js";
@@ -17,11 +17,11 @@ import "../../../context/MoveEntityContext.es.js";
17
17
  import "../../../context/MenuContext.es.js";
18
18
  import "../../../context/WebsocketContext.es.js";
19
19
  import "../../../context/GlobalContext.es.js";
20
- import { useProjectContext as Lt } from "../../../context/ProjectContext.es.js";
20
+ import { useProjectContext as Vt } from "../../../context/ProjectContext.es.js";
21
21
  import "../../../context/ProjectFoldersContext.es.js";
22
22
  import "../../../context/UriContext.es.js";
23
- import { parseCellId as q, getLinkEntityIdsByColumnId as _t, getCellValue as mt, getEntityDataById as nt } from "../utils/cellUtils.es.js";
24
- import Vt from "../hooks/usePasteLinks.es.js";
23
+ import { parseCellId as q, getLinkEntityIdsByColumnId as Pt, getCellValue as ft, getEntityDataById as lt } from "../utils/cellUtils.es.js";
24
+ import Rt from "../hooks/usePasteLinks.es.js";
25
25
  import "../../../api/base/client.es.js";
26
26
  import "../../../api/generated/graphql.es.js";
27
27
  import "../../../api/generated/graphqlLinks.es.js";
@@ -100,7 +100,7 @@ import "../../../api/queries/review/getReview.es.js";
100
100
  import "../../../api/queries/review/updateReview.es.js";
101
101
  import "../../../api/queries/share/share.es.js";
102
102
  import "../../../api/queries/system/getSystem.es.js";
103
- import { useUpdateSubtasksMutation as Pt } from "../../../api/queries/tasks/updateTasks.es.js";
103
+ import { useUpdateSubtasksMutation as Dt } from "../../../api/queries/tasks/updateTasks.es.js";
104
104
  import "../../../api/queries/userDashboard/getUserDashboard.es.js";
105
105
  import "../../../api/queries/users/getUsers.es.js";
106
106
  import "../../../api/queries/users/updateUsers.es.js";
@@ -110,103 +110,103 @@ import "../../../api/queries/views/getViews.es.js";
110
110
  import "../../../api/queries/views/updateViews.es.js";
111
111
  import "../../../api/queries/watchers/getWatchers.es.js";
112
112
  import "../../../api/queries/uris/getUris.es.js";
113
- import { getEntityPath as Rt, clipboardError as K, parseClipboardText as ut, processFieldValue as Dt } from "./clipboard/clipboardUtils.es.js";
114
- import { validateClipboardData as Nt } from "./clipboard/clipboardValidation.es.js";
115
- import { subtasksToTSV as Ut, isSubtasksTSV as jt, tsvToSubtasks as at, sanitizeSubtaskName as Bt } from "./clipboard/clipboardSubtasks.es.js";
116
- import { useProjectTableContext as Ft } from "./ProjectTableContext.es.js";
113
+ import { getEntityPath as Nt, clipboardError as K, parseClipboardText as yt, processFieldValue as Ut } from "./clipboard/clipboardUtils.es.js";
114
+ import { validateClipboardData as jt } from "./clipboard/clipboardValidation.es.js";
115
+ import { subtasksToTSV as Bt, isSubtasksTSV as Ft, tsvToSubtasks as ct, sanitizeSubtaskName as Ot } from "./clipboard/clipboardSubtasks.es.js";
116
+ import { useProjectTableContext as Kt } from "./ProjectTableContext.es.js";
117
117
  import "lodash";
118
118
  import "react-toastify";
119
- import { getEntityId as Ot, validateEntityId as Kt } from "../../../util/getEntityId.es.js";
119
+ import { getEntityId as Mt, validateEntityId as Ht } from "../../../util/getEntityId.es.js";
120
120
  import "../../../util/pubsub.es.js";
121
- const ft = Ct(void 0), os = ({
121
+ const bt = Et(void 0), rs = ({
122
122
  children: z,
123
123
  entitiesMap: j,
124
- columnEnums: lt,
125
- columnReadOnly: bt,
124
+ columnEnums: pt,
125
+ columnReadOnly: gt,
126
126
  visibleColumns: X
127
127
  }) => {
128
- const { selectedCells: B, gridMap: y, focusedCellId: yt } = $t(), { updateEntities: ct, history: rt } = At(), { pasteTableLinks: pt } = Vt(), { getEntityById: W, attribFields: J } = Ft(), { projectName: Q } = Lt(), [Y] = Pt(), it = st(
128
+ const { selectedCells: B, gridMap: b, focusedCellId: It } = Lt(), { updateEntities: dt, history: nt } = _t(), { pasteTableLinks: mt } = Rt(), { getEntityById: M, attribFields: J } = Kt(), { projectName: Q } = Vt(), [Y] = Dt(), at = it(
129
129
  async (a, p) => {
130
- const { headers: l, fullRow: g } = p || {};
130
+ const { headers: l, fullRow: I } = p || {};
131
131
  try {
132
- const $ = X.map((I) => I.id).filter((I) => I !== O), x = /* @__PURE__ */ new Map();
133
- a.forEach((I) => {
134
- const o = q(I);
132
+ const E = X.map((h) => h.id).filter((h) => h !== O), x = /* @__PURE__ */ new Map();
133
+ a.forEach((h) => {
134
+ const o = q(h);
135
135
  if (!o) return;
136
- const { rowId: m, colId: A } = o;
137
- A === O || !$.includes(A) || (x.has(m) || x.set(m, /* @__PURE__ */ new Set()), x.get(m)?.add(A));
138
- }), g && a.filter(
136
+ const { rowId: m, colId: S } = o;
137
+ S === O || !E.includes(S) || (x.has(m) || x.set(m, /* @__PURE__ */ new Set()), x.get(m)?.add(S));
138
+ }), I && a.filter(
139
139
  (o) => q(o)?.rowId && q(o)?.colId === O
140
140
  ).map((o) => q(o)?.rowId).forEach((o) => {
141
- x.has(o) || x.set(o, /* @__PURE__ */ new Set()), Array.from(y.colIdToIndex.keys()).forEach((A) => {
142
- x.get(o)?.add(A);
141
+ x.has(o) || x.set(o, /* @__PURE__ */ new Set()), Array.from(b.colIdToIndex.keys()).forEach((S) => {
142
+ x.get(o)?.add(S);
143
143
  });
144
144
  });
145
- const d = Array.from(x.keys()).sort((I, o) => {
146
- const m = y.rowIdToIndex.get(I) ?? 1 / 0, A = y.rowIdToIndex.get(o) ?? 1 / 0;
147
- return m - A;
145
+ const d = Array.from(x.keys()).sort((h, o) => {
146
+ const m = b.rowIdToIndex.get(h) ?? 1 / 0, S = b.rowIdToIndex.get(o) ?? 1 / 0;
147
+ return m - S;
148
148
  });
149
149
  let R = "";
150
150
  const et = d[0];
151
151
  if (!et) return "";
152
- const ot = Array.from(x.get(et) || []).sort((I, o) => {
153
- const m = y.colIdToIndex.get(I) ?? 1 / 0, A = y.colIdToIndex.get(o) ?? 1 / 0;
154
- return m - A;
152
+ const ot = Array.from(x.get(et) || []).sort((h, o) => {
153
+ const m = b.colIdToIndex.get(h) ?? 1 / 0, S = b.colIdToIndex.get(o) ?? 1 / 0;
154
+ return m - S;
155
155
  });
156
156
  if (l && ot.length > 0) {
157
- const I = [];
157
+ const h = [];
158
158
  for (const o of ot) {
159
159
  const m = o;
160
- I.push(`${m.replace(/"/g, '""')}`);
160
+ h.push(`${m.replace(/"/g, '""')}`);
161
161
  }
162
- R += I.join(" ") + `
162
+ R += h.join(" ") + `
163
163
  `;
164
164
  }
165
- for (const I of d) {
166
- const o = W(I);
165
+ for (const h of d) {
166
+ const o = M(h);
167
167
  if (!o) {
168
- console.warn(`Entity not found for rowId: ${I}`);
168
+ console.warn(`Entity not found for rowId: ${h}`);
169
169
  continue;
170
170
  }
171
- const A = Array.from(x.get(I) || []).sort((u, E) => {
172
- const L = y.colIdToIndex.get(u) ?? 1 / 0, N = y.colIdToIndex.get(E) ?? 1 / 0;
173
- return L - N;
174
- }).filter((u) => u !== O), V = [];
175
- for (const u of A) {
176
- let E = "";
171
+ const S = Array.from(x.get(h) || []).sort((u, v) => {
172
+ const $ = b.colIdToIndex.get(u) ?? 1 / 0, U = b.colIdToIndex.get(v) ?? 1 / 0;
173
+ return $ - U;
174
+ }).filter((u) => u !== O), P = [];
175
+ for (const u of S) {
176
+ let v = "";
177
177
  if (u.startsWith("link_"))
178
- E = _t(o.links, u);
178
+ v = Pt(o.links, u);
179
179
  else if (u === "subtasks") {
180
- const L = mt(o, u) || [];
181
- E = Ut(L, o.id, o.name);
180
+ const $ = ft(o, u) || [];
181
+ v = Bt($, o.id, o.name);
182
182
  } else {
183
- let L = mt(o, u);
184
- if (!L) {
185
- const N = J.find((M) => M.name === u.replace("attrib_", ""));
186
- N && N.data.type === "boolean" ? L = !1 : N && N.data.type.includes("list_of") && (L = []);
183
+ let $ = ft(o, u);
184
+ if (!$) {
185
+ const U = J.find((H) => H.name === u.replace("attrib_", ""));
186
+ U && U.data.type === "boolean" ? $ = !1 : U && U.data.type.includes("list_of") && ($ = []);
187
187
  }
188
- E = L != null ? String(L) : "", u === "name" && (E = Rt(o.entityId || o.id, j)), u === "subType" && ("folderType" in o && (E = o.folderType || ""), "taskType" in o && (E = o.taskType || ""));
188
+ v = $ != null ? String($) : "", u === "name" && (v = Nt(o.entityId || o.id, j)), u === "subType" && ("folderType" in o && (v = o.folderType || ""), "taskType" in o && (v = o.taskType || ""));
189
189
  }
190
- V.push(`${E.replace(/"/g, '""')}`);
190
+ P.push(`${v.replace(/"/g, '""')}`);
191
191
  }
192
- R += V.join(" ") + `
192
+ R += P.join(" ") + `
193
193
  `;
194
194
  }
195
195
  return R;
196
- } catch ($) {
197
- console.error("Failed to copy to clipboard:", $);
196
+ } catch (E) {
197
+ console.error("Failed to copy to clipboard:", E);
198
198
  }
199
199
  },
200
- [B, yt, y, j, W, X]
201
- ), gt = async () => {
202
- const a = await dt();
200
+ [B, It, b, j, M, X]
201
+ ), ht = async () => {
202
+ const a = await ut();
203
203
  if (!a) return !1;
204
- const p = ut(a);
205
- return p.length === 0 ? !1 : p.every((l) => l.values.every((g) => g.split(",").every(($) => Kt($))));
206
- }, Z = st(
204
+ const p = yt(a);
205
+ return p.length === 0 ? !1 : p.every((l) => l.values.every((I) => I.split(",").every((E) => Ht(E))));
206
+ }, Z = it(
207
207
  async (a, p) => {
208
208
  if (a = a || Array.from(B), !a.length) return;
209
- const l = await it(a, { fullRow: p });
209
+ const l = await at(a, { fullRow: p });
210
210
  if (l) {
211
211
  if (!navigator.clipboard) {
212
212
  K("Clipboard API not supported in this browser.");
@@ -218,28 +218,28 @@ const ft = Ct(void 0), os = ({
218
218
  }
219
219
  try {
220
220
  await navigator.clipboard.writeText(l);
221
- } catch (g) {
222
- K(`Failed to copy to clipboard: ${g.message}`);
221
+ } catch (I) {
222
+ K(`Failed to copy to clipboard: ${I.message}`);
223
223
  }
224
224
  }
225
225
  },
226
- [B, j, y]
227
- ), It = st(
226
+ [B, j, b]
227
+ ), wt = it(
228
228
  async (a, p, l) => {
229
229
  if (a = a || Array.from(B), !!a.length)
230
230
  try {
231
- const g = await it(a, { headers: !0, fullRow: l });
232
- if (!g) return;
233
- const $ = new Blob([g], { type: "text/csv" }), x = URL.createObjectURL($), d = document.createElement("a");
231
+ const I = await at(a, { headers: !0, fullRow: l });
232
+ if (!I) return;
233
+ const E = new Blob([I], { type: "text/csv" }), x = URL.createObjectURL(E), d = document.createElement("a");
234
234
  d.href = x;
235
235
  const R = a.length;
236
236
  d.download = `${p}-export-${R}_cells-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.csv`, d.click(), URL.revokeObjectURL(x);
237
- } catch (g) {
238
- console.error("Failed to copy to clipboard:", g);
237
+ } catch (I) {
238
+ console.error("Failed to copy to clipboard:", I);
239
239
  }
240
240
  },
241
- [B, j, y, it]
242
- ), dt = async () => {
241
+ [B, j, b, at]
242
+ ), ut = async () => {
243
243
  if (!navigator.clipboard) {
244
244
  K("Clipboard API not supported in this browser.");
245
245
  return;
@@ -255,27 +255,27 @@ const ft = Ct(void 0), os = ({
255
255
  K(`Failed to read from clipboard: ${p.message}`);
256
256
  return;
257
257
  }
258
- }, tt = st(
258
+ }, tt = it(
259
259
  async (a, p) => {
260
260
  const { method: l = "replace" } = p || {};
261
261
  if (!a.length) return;
262
- const g = await dt();
263
- if (!g) return;
264
- let $ = !1, x = g;
265
- jt(g) && ($ = !0);
266
- const d = ut(g);
262
+ const I = await ut();
263
+ if (!I) return;
264
+ let E = !1, x = I;
265
+ Ft(I) && (E = !0);
266
+ const d = yt(I);
267
267
  if (!d.length) return;
268
268
  const R = d.length === 1 && d[0].values.length === 1, et = X.map((t) => t.id).filter((t) => t !== O), ot = (t, e, s) => {
269
269
  const f = {};
270
- return s && s.length > 0 ? s.forEach((c, i) => {
271
- const h = e.find(
270
+ return s && s.length > 0 ? s.forEach((c, r) => {
271
+ const g = e.find(
272
272
  (n) => n === c || n.replace("attrib_", "") === c || n === `attrib_${c}` || n.toLowerCase() === c.toLowerCase()
273
273
  );
274
- h && i < t.values.length && (f[h] = t.values[i]);
275
- }) : e.forEach((c, i) => {
276
- i < t.values.length && (f[c] = t.values[i]);
274
+ g && r < t.values.length && (f[g] = t.values[r]);
275
+ }) : e.forEach((c, r) => {
276
+ r < t.values.length && (f[c] = t.values[r]);
277
277
  }), f;
278
- }, I = d[0]?.colIds || void 0, o = /* @__PURE__ */ new Map();
278
+ }, h = d[0]?.colIds || void 0, o = /* @__PURE__ */ new Map();
279
279
  Array.from(a).forEach((t) => {
280
280
  const e = q(t);
281
281
  if (!e) return;
@@ -283,132 +283,132 @@ const ft = Ct(void 0), os = ({
283
283
  f === O || !et.includes(f) || (o.has(s) || o.set(s, /* @__PURE__ */ new Set()), o.get(s)?.add(f));
284
284
  });
285
285
  const m = Array.from(o.keys()).sort((t, e) => {
286
- const s = y.rowIdToIndex.get(t) ?? 1 / 0, f = y.rowIdToIndex.get(e) ?? 1 / 0;
286
+ const s = b.rowIdToIndex.get(t) ?? 1 / 0, f = b.rowIdToIndex.get(e) ?? 1 / 0;
287
287
  return s - f;
288
- }), A = m[0], V = Array.from(o.get(A) || []).sort((t, e) => {
289
- const s = y.colIdToIndex.get(t) ?? 1 / 0, f = y.colIdToIndex.get(e) ?? 1 / 0;
288
+ }), S = m[0], P = Array.from(o.get(S) || []).sort((t, e) => {
289
+ const s = b.colIdToIndex.get(t) ?? 1 / 0, f = b.colIdToIndex.get(e) ?? 1 / 0;
290
290
  return s - f;
291
291
  });
292
292
  for (let t = 0; t < m.length; t++) {
293
- const e = m[t], s = nt(e, j)?.entityType === "folder", f = t % d.length, c = d[f], i = R ? { [V[0]]: d[0].values[0] } : ot(c, V, I);
294
- for (const h of V) {
295
- const n = i[h] || "";
296
- if (!Nt({
297
- colId: h,
293
+ const e = m[t], s = lt(e, j)?.entityType === "folder", f = t % d.length, c = d[f], r = R ? { [P[0]]: d[0].values[0] } : ot(c, P, h);
294
+ for (const g of P) {
295
+ const n = r[g] || "";
296
+ if (!jt({
297
+ colId: g,
298
298
  isFolder: s,
299
299
  pasteValue: n,
300
300
  parsedData: d,
301
- columnEnums: lt,
302
- columnReadOnly: bt,
301
+ columnEnums: pt,
302
+ columnReadOnly: gt,
303
303
  rowIndex: t,
304
- colIndex: V.indexOf(h),
304
+ colIndex: P.indexOf(g),
305
305
  isSingleCellValue: R,
306
306
  attribFields: J
307
307
  })) return;
308
308
  }
309
309
  }
310
310
  const u = /* @__PURE__ */ new Map();
311
- for (let t = 0; t < V.length; t++) {
312
- const e = V[t];
311
+ for (let t = 0; t < P.length; t++) {
312
+ const e = P[t];
313
313
  if (e === "name") continue;
314
314
  if (e === "subtasks") {
315
- let i = [], h = !1;
316
- if ($) {
315
+ let r = [], g = !1;
316
+ if (E) {
317
317
  const n = x.trim().split(`
318
- `), b = n[0].toLowerCase(), P = b.includes("label") && b.includes("name") && b.includes("start date") && b.includes("end date") && b.includes("assignees") && b.includes("status") ? n.slice(1) : n, S = /* @__PURE__ */ new Map(), D = [];
319
- P.forEach((_) => {
320
- const C = at(_);
321
- if (C.length === 0) return;
322
- const w = C[0], r = `${w.taskId || ""}|${w.taskName || ""}`;
323
- S.has(r) || (S.set(r, []), D.push(r)), S.get(r).push(w);
324
- }), D.forEach((_) => {
325
- const [C, w] = _.split("|");
326
- i.push({
327
- taskId: C || void 0,
318
+ `), y = n[0].toLowerCase(), _ = y.includes("label") && y.includes("name") && y.includes("start date") && y.includes("end date") && y.includes("assignees") && y.includes("status") ? n.slice(1) : n, V = /* @__PURE__ */ new Map(), F = [];
319
+ _.forEach((D) => {
320
+ const A = ct(D);
321
+ if (A.length === 0) return;
322
+ const w = A[0], N = `${w.taskId || ""}|${w.taskName || ""}`;
323
+ V.has(N) || (V.set(N, []), F.push(N)), V.get(N).push(w);
324
+ }), F.forEach((D) => {
325
+ const [A, w] = D.split("|");
326
+ r.push({
327
+ taskId: A || void 0,
328
328
  taskName: w || void 0,
329
- subtasks: S.get(_) || []
329
+ subtasks: V.get(D) || []
330
330
  });
331
- }), h = i.length <= 1;
331
+ }), g = r.length <= 1;
332
332
  }
333
333
  for (let n = 0; n < m.length; n++) {
334
- const b = m[n], k = nt(b, j)?.entityType;
335
- if (k !== "task") continue;
336
- const P = `${b}-${k}`;
337
- u.has(P) || u.set(P, {
338
- rowId: b,
339
- id: b,
340
- type: k,
334
+ const y = m[n], T = lt(y, j)?.entityType;
335
+ if (T !== "task") continue;
336
+ const _ = M(y), V = _?.entityId || y, F = `${y}-${T}`;
337
+ u.has(F) || u.set(F, {
338
+ rowId: y,
339
+ id: V,
340
+ type: T,
341
341
  fields: {},
342
342
  attrib: {},
343
343
  links: {}
344
344
  });
345
- const S = u.get(P), D = W(b), _ = D && "subtasks" in D && D.subtasks || [];
346
- S.previousSubtasks = _;
347
- let C = [];
348
- if ($) {
349
- if (h && i.length > 0)
350
- C = i[0].subtasks;
351
- else if (i.length > 0) {
352
- const r = n % i.length;
353
- C = i[r].subtasks;
345
+ const D = u.get(F), A = _ && "subtasks" in _ && _.subtasks || [];
346
+ D.previousSubtasks = A;
347
+ let w = [];
348
+ if (E) {
349
+ if (g && r.length > 0)
350
+ w = r[0].subtasks;
351
+ else if (r.length > 0) {
352
+ const i = n % r.length;
353
+ w = r[i].subtasks;
354
354
  }
355
355
  } else if (R) {
356
- const r = d[0].values[0];
357
- C = at(r);
356
+ const i = d[0].values[0];
357
+ w = ct(i);
358
358
  } else {
359
- const r = n % d.length, T = d[r], v = t % T.values.length, U = T.values[v];
360
- C = at(U);
359
+ const i = n % d.length, k = d[i], C = t % k.values.length, L = k.values[C];
360
+ w = ct(L);
361
361
  }
362
- if (!C || C.length === 0) continue;
363
- const w = C.map((r, T) => ({
364
- id: Ot(),
365
- name: Bt(r.name || r.label || `Subtask ${T + 1}`),
366
- label: r.label || "",
367
- assignees: r.assignees || [],
368
- description: r.label || "",
369
- startDate: r.startDate,
370
- endDate: r.endDate,
371
- isDone: r.isDone || !1
362
+ if (!w || w.length === 0) continue;
363
+ const N = w.map((i, k) => ({
364
+ id: Mt(),
365
+ name: Ot(i.name || i.label || `Subtask ${k + 1}`),
366
+ label: i.label || "",
367
+ assignees: i.assignees || [],
368
+ description: i.label || "",
369
+ startDate: i.startDate,
370
+ endDate: i.endDate,
371
+ isDone: i.isDone || !1
372
372
  }));
373
373
  if (l === "merge") {
374
- const r = [..._], T = new Set(
375
- _.map((v) => {
376
- const U = (v.label || "").toLowerCase(), H = (v.name || "").toLowerCase();
377
- return `${U}|${H}`;
374
+ const i = [...A], k = new Set(
375
+ A.map((C) => {
376
+ const L = (C.label || "").toLowerCase(), st = (C.name || "").toLowerCase();
377
+ return `${L}|${st}`;
378
378
  })
379
379
  );
380
- for (const v of w) {
381
- const U = (v.label || "").toLowerCase(), H = (v.name || "").toLowerCase(), F = `${U}|${H}`;
382
- T.has(F) || r.push(v);
380
+ for (const C of N) {
381
+ const L = (C.label || "").toLowerCase(), st = (C.name || "").toLowerCase(), rt = `${L}|${st}`;
382
+ k.has(rt) || i.push(C);
383
383
  }
384
- S.subtasks = r;
384
+ D.subtasks = i;
385
385
  } else {
386
- const r = w.map((T) => {
387
- const v = _.find(
388
- (U) => (U.label || "").toLowerCase() === (T.label || "").toLowerCase() && (U.name || "").toLowerCase() === (T.name || "").toLowerCase()
386
+ const i = N.map((k) => {
387
+ const C = A.find(
388
+ (L) => (L.label || "").toLowerCase() === (k.label || "").toLowerCase() && (L.name || "").toLowerCase() === (k.name || "").toLowerCase()
389
389
  );
390
390
  return {
391
- ...T,
392
- id: v?.id || T.id
391
+ ...k,
392
+ id: C?.id || k.id
393
393
  };
394
394
  });
395
- S.subtasks = r;
395
+ D.subtasks = i;
396
396
  }
397
397
  }
398
398
  continue;
399
399
  }
400
400
  let s = !1, f = !1, c = "string";
401
401
  if (m.length > 0) {
402
- const i = m[0];
403
- if (W(i))
402
+ const r = m[0];
403
+ if (M(r))
404
404
  if (s = e.startsWith("attrib_"), f = e.startsWith("link_"), e === "status" || e === "subType")
405
405
  c = "string", s = !1;
406
406
  else if (e === "tags" || e === "assignees")
407
407
  c = "array";
408
408
  else if (s) {
409
- const n = e.replace("attrib_", ""), b = J.find((k) => k.name === n);
410
- if (b)
411
- switch (b.data.type) {
409
+ const n = e.replace("attrib_", ""), y = J.find((T) => T.name === n);
410
+ if (y)
411
+ switch (y.data.type) {
412
412
  case "boolean":
413
413
  c = "boolean";
414
414
  break;
@@ -427,52 +427,52 @@ const ft = Ct(void 0), os = ({
427
427
  }
428
428
  } else f && (c = "array");
429
429
  }
430
- for (let i = 0; i < m.length; i++) {
431
- const h = m[i], n = nt(h, j)?.entityType, b = n === "folder";
432
- let k;
430
+ for (let r = 0; r < m.length; r++) {
431
+ const g = m[r], n = lt(g, j)?.entityType, y = n === "folder";
432
+ let T;
433
433
  if (R)
434
- k = d[0].values[0];
434
+ T = d[0].values[0];
435
435
  else {
436
- const C = i % d.length, w = d[C];
437
- if (w.values.length > V.length) {
438
- const r = y.colIdToIndex.get(V[0]) ?? 0, T = Array.from(y.colIdToIndex.keys()).filter((F) => F !== O).sort((F, wt) => {
439
- const kt = y.colIdToIndex.get(F) ?? 1 / 0, Tt = y.colIdToIndex.get(wt) ?? 1 / 0;
440
- return kt - Tt;
441
- }), v = T.findIndex(
442
- (F) => y.colIdToIndex.get(F) === r
443
- ), H = T.slice(
444
- v,
445
- v + w.values.length
436
+ const N = r % d.length, i = d[N];
437
+ if (i.values.length > P.length) {
438
+ const k = b.colIdToIndex.get(P[0]) ?? 0, C = Array.from(b.colIdToIndex.keys()).filter((G) => G !== O).sort((G, Tt) => {
439
+ const xt = b.colIdToIndex.get(G) ?? 1 / 0, Ct = b.colIdToIndex.get(Tt) ?? 1 / 0;
440
+ return xt - Ct;
441
+ }), L = C.findIndex(
442
+ (G) => b.colIdToIndex.get(G) === k
443
+ ), rt = C.slice(
444
+ L,
445
+ L + i.values.length
446
446
  ).indexOf(e);
447
- k = w.values[H] || w.values[H % w.values.length];
447
+ T = i.values[rt] || i.values[rt % i.values.length];
448
448
  } else {
449
- const r = t % w.values.length;
450
- k = w.values[r];
449
+ const k = t % i.values.length;
450
+ T = i.values[k];
451
451
  }
452
452
  }
453
- let P = e.split("_").pop() || e;
454
- if (e === "subType" && (P = b ? "folderType" : "taskType", s = !1, !k))
453
+ let _ = e.split("_").pop() || e;
454
+ if (e === "subType" && (_ = y ? "folderType" : "taskType", s = !1, !T))
455
455
  continue;
456
- const S = Dt(k, c), D = `${h}-${n}`;
457
- !u.has(D) && n && u.set(D, {
458
- rowId: h,
459
- id: h,
456
+ const V = Ut(T, c), D = M(g)?.entityId || g, A = `${g}-${n}`;
457
+ !u.has(A) && n && u.set(A, {
458
+ rowId: g,
459
+ id: D,
460
460
  type: n,
461
461
  fields: {},
462
462
  attrib: {},
463
463
  links: {}
464
464
  });
465
- const _ = u.get(D);
465
+ const w = u.get(A);
466
466
  if (f) {
467
- const [C, w, r, T, v] = e.split("_");
468
- _.links[`${w}|${r}|${T}_${v}`] = S;
469
- } else s ? _.attrib[P] = S : _.fields[P] = S;
467
+ const [N, i, k, C, L] = e.split("_");
468
+ w.links[`${i}|${k}|${C}_${L}`] = V;
469
+ } else s ? w.attrib[_] = V : w.fields[_] = V;
470
470
  }
471
471
  }
472
- const E = [], L = /* @__PURE__ */ new Map();
472
+ const v = [], $ = /* @__PURE__ */ new Map();
473
473
  u.forEach((t) => {
474
474
  Object.entries(t.fields).forEach(([e, s]) => {
475
- E.push({
475
+ v.push({
476
476
  rowId: t.rowId,
477
477
  id: t.id,
478
478
  type: t.type,
@@ -480,7 +480,7 @@ const ft = Ct(void 0), os = ({
480
480
  value: s
481
481
  });
482
482
  }), Object.entries(t.attrib).forEach(([e, s]) => {
483
- E.push({
483
+ v.push({
484
484
  rowId: t.rowId,
485
485
  id: t.id,
486
486
  type: t.type,
@@ -489,81 +489,81 @@ const ft = Ct(void 0), os = ({
489
489
  isAttrib: !0
490
490
  });
491
491
  }), Object.entries(t.links).forEach(([e, s]) => {
492
- const [f, c] = e.split("_"), i = f.split("|");
493
- if (i.length >= 3) {
494
- const h = i[0], n = i[1], b = i[2], k = `${h}|${n}|${b}`, P = c === "out" ? b : n, S = `${t.id}-${k}-${c}`;
495
- L.set(S, {
492
+ const [f, c] = e.split("_"), r = f.split("|");
493
+ if (r.length >= 3) {
494
+ const g = r[0], n = r[1], y = r[2], T = `${g}|${n}|${y}`, _ = c === "out" ? y : n, V = `${t.id}-${T}-${c}`;
495
+ $.set(V, {
496
496
  rowId: t.rowId,
497
497
  sourceEntityId: t.id,
498
498
  sourceEntityType: t.type,
499
- linkType: k,
499
+ linkType: T,
500
500
  direction: c,
501
- targetEntityType: P,
501
+ targetEntityType: _,
502
502
  operation: l,
503
503
  targetEntityIds: Array.isArray(s) ? s : []
504
504
  });
505
505
  }
506
506
  });
507
507
  });
508
- const N = Array.from(L.values()), M = [];
508
+ const U = Array.from($.values()), H = [];
509
509
  u.forEach((t) => {
510
- t.subtasks && M.push({
510
+ t.subtasks && H.push({
511
511
  taskId: t.id,
512
512
  subtasks: t.subtasks,
513
513
  previousSubtasks: t.previousSubtasks
514
514
  });
515
515
  });
516
- const G = [];
517
- if (E.length > 0 && G.push(ct(E)), N.length > 0 && G.push(pt(N)), M.length > 0) {
518
- rt && M.forEach(({ taskId: e, subtasks: s, previousSubtasks: f }) => {
519
- const c = f || [], i = s || [], h = () => {
516
+ const W = [];
517
+ if (v.length > 0 && W.push(dt(v)), U.length > 0 && W.push(mt(U)), H.length > 0) {
518
+ nt && H.forEach(({ taskId: e, subtasks: s, previousSubtasks: f }) => {
519
+ const c = f || [], r = s || [], g = () => {
520
520
  Y({ projectName: Q, taskId: e, subtasks: c }).unwrap().catch(() => {
521
521
  });
522
522
  }, n = () => {
523
- Y({ projectName: Q, taskId: e, subtasks: i }).unwrap().catch(() => {
523
+ Y({ projectName: Q, taskId: e, subtasks: r }).unwrap().catch(() => {
524
524
  });
525
525
  };
526
- rt.pushHistory([h], [n]);
526
+ nt.pushHistory([g], [n]);
527
527
  });
528
- const t = M.map(
528
+ const t = H.map(
529
529
  ({ taskId: e, subtasks: s }) => Y({ projectName: Q, taskId: e, subtasks: s }).unwrap()
530
530
  );
531
- G.push(...t);
531
+ W.push(...t);
532
532
  }
533
- if (G.length > 0)
533
+ if (W.length > 0)
534
534
  try {
535
- await Promise.all(G);
535
+ await Promise.all(W);
536
536
  } catch (t) {
537
537
  console.error("Error updating entities:", t), K(`Paste failed: ${t || t?.message || "Unknown error"}`);
538
538
  }
539
539
  },
540
540
  [
541
541
  B,
542
- y,
542
+ b,
543
543
  j,
544
- ct,
544
+ dt,
545
+ mt,
545
546
  pt,
546
- lt,
547
- W,
547
+ M,
548
548
  X,
549
549
  J,
550
550
  Q,
551
551
  Y,
552
- rt
552
+ nt
553
553
  ]
554
554
  );
555
- vt(() => {
555
+ St(() => {
556
556
  const a = async (p) => {
557
557
  if ((p.ctrlKey || p.metaKey) && p.key === "c") {
558
- const l = document.activeElement, g = l?.closest("table") !== null || l?.closest(".table-container") !== null || l?.tagName === "TD" || l?.tagName === "TH", $ = l?.tagName === "INPUT" || l?.tagName === "TEXTAREA" || l?.isContentEditable;
559
- if ((window.getSelection()?.toString().length ?? !1) && !g || $ && !g)
558
+ const l = document.activeElement, I = l?.closest("table") !== null || l?.closest(".table-container") !== null || l?.tagName === "TD" || l?.tagName === "TH", E = l?.tagName === "INPUT" || l?.tagName === "TEXTAREA" || l?.isContentEditable;
559
+ if ((window.getSelection()?.toString().length ?? !1) && !I || E && !I)
560
560
  return;
561
561
  B.size > 0 && await Z();
562
562
  }
563
563
  if ((p.ctrlKey || p.metaKey) && p.key === "v") {
564
564
  const l = document.activeElement;
565
565
  if (l && (l.tagName === "INPUT" || l.tagName === "TEXTAREA" || l.isContentEditable))
566
- if (await gt())
566
+ if (await ht())
567
567
  p.preventDefault();
568
568
  else
569
569
  return;
@@ -577,23 +577,23 @@ const ft = Ct(void 0), os = ({
577
577
  window.removeEventListener("keydown", a);
578
578
  };
579
579
  }, [Z, tt]);
580
- const ht = Et(
580
+ const kt = $t(
581
581
  () => ({
582
582
  copyToClipboard: Z,
583
583
  pasteFromClipboard: tt,
584
- exportCSV: It
584
+ exportCSV: wt
585
585
  }),
586
586
  [Z, tt]
587
587
  );
588
- return /* @__PURE__ */ xt.jsx(ft.Provider, { value: ht, children: z });
589
- }, ss = () => {
590
- const z = St(ft);
588
+ return /* @__PURE__ */ vt.jsx(bt.Provider, { value: kt, children: z });
589
+ }, is = () => {
590
+ const z = At(bt);
591
591
  if (z === void 0)
592
592
  throw new Error("useClipboard must be used within a ClipboardProvider");
593
593
  return z;
594
594
  };
595
595
  export {
596
- os as ClipboardProvider,
597
- ss as useClipboard
596
+ rs as ClipboardProvider,
597
+ is as useClipboard
598
598
  };
599
599
  //# sourceMappingURL=ClipboardContext.es.js.map