@ynput/ayon-frontend-shared 0.5.0 → 0.6.1

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 (92) hide show
  1. package/dist/ContextMenu.es.js +34 -16
  2. package/dist/DetailsPanel.es.js +307 -311
  3. package/dist/Feed.es.js +179 -50
  4. package/dist/ListTable.es.js +99 -92
  5. package/dist/NewEntity.es.js +1256 -11
  6. package/dist/ProjectTreeTable.es.js +4459 -2959
  7. package/dist/SimpleTable.es.js +8 -7
  8. package/dist/Slicer.es.js +451 -147
  9. package/dist/Views.es.js +918 -310
  10. package/dist/api.es.js +331 -329
  11. package/dist/chunks/Actions.es.js +32 -27
  12. package/dist/chunks/ColumnDropIndicator.es.js +174 -328
  13. package/dist/chunks/ColumnDropIndicator.styled.es.js +281 -0
  14. package/dist/chunks/ColumnHeaderMenuUI.es.js +52 -0
  15. package/dist/chunks/ContextMenuContextInstance.es.js +12 -0
  16. package/dist/chunks/DeleteEntitiesConfirmDialog.es.js +229 -0
  17. package/dist/chunks/DeleteEntitiesContextInstance.es.js +827 -0
  18. package/dist/chunks/DetailsDialog.es.js +3 -3
  19. package/dist/chunks/EmptyPlaceholder.es.js +4 -4
  20. package/dist/chunks/EntityPath.es.js +74 -69
  21. package/dist/chunks/EntityPickerDialog.es.js +25 -21
  22. package/dist/chunks/EntityTooltip.es.js +29 -22
  23. package/dist/chunks/EntityUpdatesContext.es.js +38 -96
  24. package/dist/chunks/Feed.es.js +2321 -2668
  25. package/dist/chunks/FilterErrorActions.es.js +25 -229
  26. package/dist/chunks/Menu.es.js +21 -17
  27. package/dist/chunks/MenuContext.es.js +14 -256
  28. package/dist/chunks/MenuItem.es.js +34 -24
  29. package/dist/chunks/MetaWidget.es.js +2895 -4919
  30. package/dist/chunks/NewEntityContextInstance.es.js +11 -0
  31. package/dist/chunks/PlayableIcon.es.js +4215 -1179
  32. package/dist/chunks/ProjectContext.es.js +102 -66
  33. package/dist/chunks/RepresentationsList.es.js +4 -4
  34. package/dist/chunks/ReviewablesSelector.es.js +468 -460
  35. package/dist/chunks/SimpleForm.es.js +18 -18
  36. package/dist/chunks/SimpleTable.es.js +15 -13
  37. package/dist/chunks/Slicer.es.js +109 -98
  38. package/dist/chunks/TableSettingsFallback.es.js +22 -10
  39. package/dist/chunks/ThumbnailSimple.es.js +290 -52
  40. package/dist/chunks/VersionUploadContextInstance.es.js +12 -0
  41. package/dist/chunks/VideoPlayer.es.js +24 -28
  42. package/dist/chunks/Watchers.es.js +669 -644
  43. package/dist/chunks/entityDefinitions.es.js +2 -350
  44. package/dist/chunks/expandRelativeDates.es.js +27 -0
  45. package/dist/chunks/extractVersionFromFilename.es.js +28 -0
  46. package/dist/chunks/getBundleMode.es.js +1 -1
  47. package/dist/chunks/getUris.es.js +737 -710
  48. package/dist/chunks/queryFilterToClientFilter.es.js +11 -10
  49. package/dist/chunks/searchTerms.es.js +179 -174
  50. package/dist/chunks/useAttributeEnums.es.js +9 -9
  51. package/dist/chunks/useCreateContextMenu.es.js +66 -90
  52. package/dist/chunks/useDateRangeFilter.es.js +3 -3
  53. package/dist/chunks/useHierarchySelection.es.js +24 -0
  54. package/dist/chunks/useLoadModule.es.js +74 -0
  55. package/dist/chunks/useQueryArgumentChangeLoading.es.js +11 -0
  56. package/dist/chunks/versionUploadHelpers.es.js +16 -42
  57. package/dist/chunks/viewUpdateHelper.es.js +74 -57
  58. package/dist/components.es.js +1432 -1001
  59. package/dist/context.es.js +791 -78
  60. package/dist/hooks.es.js +95 -94
  61. package/dist/index.es.js +27 -26
  62. package/dist/types/Actions.d.ts +15 -15
  63. package/dist/types/ContextMenu.d.ts +19 -16
  64. package/dist/types/DetailsPanel.d.ts +110 -17
  65. package/dist/types/EntityPickerDialog.d.ts +15 -15
  66. package/dist/types/Feed.d.ts +19 -16
  67. package/dist/types/ListTable.d.ts +15 -15
  68. package/dist/types/NewEntity.d.ts +24 -18
  69. package/dist/types/ProjectTreeTable.d.ts +34 -123
  70. package/dist/types/RepresentationsList.d.ts +15 -15
  71. package/dist/types/SimpleTable.d.ts +19 -16
  72. package/dist/types/Slicer.d.ts +18 -15
  73. package/dist/types/Views.d.ts +19 -16
  74. package/dist/types/api.d.ts +515 -207
  75. package/dist/types/components.d.ts +84 -20
  76. package/dist/types/context.d.ts +108 -25
  77. package/dist/types/hooks.d.ts +15 -15
  78. package/dist/types/index.d.ts +15 -15
  79. package/dist/types/util.d.ts +20 -15
  80. package/dist/util.es.js +117 -105
  81. package/package.json +16 -4
  82. package/dist/chunks/DeleteEntitiesContext.es.js +0 -748
  83. package/dist/chunks/GlobalContext.es.js +0 -52
  84. package/dist/chunks/NewEntityContext.es.js +0 -1242
  85. package/dist/chunks/ProjectFoldersContext.es.js +0 -134
  86. package/dist/chunks/ProjectFoldersContextInstance.es.js +0 -7
  87. package/dist/chunks/VersionUploadContext.es.js +0 -232
  88. package/dist/chunks/ViewsContext.es.js +0 -878
  89. package/dist/chunks/mentionTypeOptions.es.js +0 -15
  90. package/dist/chunks/useColumnDragRestriction.es.js +0 -148
  91. package/dist/chunks/useLocalStorage.es.js +0 -355
  92. /package/dist/{useCreateContextMenu.css → ContextMenuContextInstance.css} +0 -0
@@ -1,89 +1,802 @@
1
- import { a as r, u as n } from "./chunks/useLocalStorage.es.js";
2
- import { P as k, R as f, b as M, p as g, c as D, d as F } from "./chunks/useLocalStorage.es.js";
3
- import { D as A, a as j, M as w, U as E, b as T, s as R, c as y, u as h, d as O, e as _ } from "./chunks/MenuContext.es.js";
4
- import { jsx as u } from "react/jsx-runtime";
5
- import { useContext as d, useEffect as i } from "react";
6
- import { S as t } from "./chunks/DeleteEntitiesContext.es.js";
7
- import { A as I, a as L, D as N, P as q, b as W, c as V, d as Y, T as z, e as B, i as H, u as J, f as K, g as Q, h as X, j as Z, k as $, l as ee, m as oe } from "./chunks/DeleteEntitiesContext.es.js";
1
+ import { jsx as T, jsxs as ce } from "react/jsx-runtime";
2
+ import { useState as w, useEffect as B, useCallback as E, useMemo as j } from "react";
3
+ import { registerRemotes as de } from "@module-federation/enhanced/runtime";
4
+ import { ay as ue, bi as pe } from "./chunks/searchTerms.es.js";
5
+ import { cQ as fe, c2 as ge, cg as me, bp as he, cS as ye, cB as Pe, bJ as ve, cY as we, dl as be, cI as Ce } from "./chunks/getUris.es.js";
6
+ import "primereact/confirmdialog";
7
+ import { d as te, z as Se, a as ne, q as Ie, A as ke, B as Le, G as xe, H as Ee, I as De, J as Fe, K as Te, L as je, N as Me, O as Oe, Q as Ae, U as Ue, V as Re, W as Ne } from "./chunks/DeleteEntitiesContextInstance.es.js";
8
+ import { E as Lt, M as xt, X as Et, P as Dt, Y as Ft, Z as Tt, T as jt, _ as Mt, $ as Ot, g as At, a0 as Ut, m as Rt, c as Nt, a1 as Bt, t as Gt, a2 as _t, a3 as $t, a4 as Qt, a5 as Wt, a6 as qt, v as zt, u as Vt, n as Ht, a7 as Yt, x as Jt, y as Kt, b as Xt, a8 as Zt, a9 as en, aa as tn, ab as nn, ac as on, ad as sn } from "./chunks/DeleteEntitiesContextInstance.es.js";
9
+ import "lodash";
10
+ import { toast as G } from "react-toastify";
11
+ import { v4 as Y } from "uuid";
12
+ import { g as Be, p as Ge, b as _e } from "./chunks/getBundleMode.es.js";
13
+ import { u as oe } from "./chunks/useLoadModule.es.js";
14
+ import { P as an, T as ln } from "./chunks/ProjectContext.es.js";
8
15
  import "react-dom";
9
- import { G as se, u as ae } from "./chunks/GlobalContext.es.js";
10
- import { P as ne, u as ue, a as de } from "./chunks/ProjectContext.es.js";
11
- import { P as le, u as Pe } from "./chunks/ProjectFoldersContext.es.js";
12
- import { E as ce, F as xe, g as me, a as Ce, u as be, b as ve } from "./chunks/EntityUpdatesContext.es.js";
13
- const l = (e) => {
14
- const { setPowerpackDialog: o } = n();
15
- return i(() => {
16
- o({ addon: "planner", feature: "subtasks" }), e?.onNotFound?.();
17
- }, [o, e.onNotFound]), null;
18
- }, C = ({ children: e }) => {
19
- const [o, { outdated: s, isLoading: a }] = r({
16
+ import { p as $e, c as Qe, d as We, e as qe, b as Z } from "./chunks/DeleteEntitiesConfirmDialog.es.js";
17
+ import { a as dn } from "./chunks/DeleteEntitiesConfirmDialog.es.js";
18
+ import { M as pn } from "./chunks/MenuContext.es.js";
19
+ import { u as ze } from "./chunks/useQueryArgumentChangeLoading.es.js";
20
+ import { E as gn, F as mn } from "./chunks/EntityUpdatesContext.es.js";
21
+ const ut = ({ children: f, skip: i }) => {
22
+ const { data: s = [], isLoading: e } = fe(void 0, {
23
+ skip: i
24
+ }), {
25
+ siteInfo: r,
26
+ isLoading: { siteInfo: c }
27
+ } = te(), [d, h] = w(!1);
28
+ return B(() => {
29
+ if (e || c || d) return;
30
+ if (!s.length) {
31
+ h(!0);
32
+ return;
33
+ }
34
+ const y = [];
35
+ s.forEach((g) => {
36
+ const { addonName: p, addonVersion: l, modules: n = {} } = g;
37
+ Object.entries(n).forEach(([u, m]) => {
38
+ y.push({
39
+ remote: u,
40
+ addon: p,
41
+ version: l,
42
+ modules: m
43
+ });
44
+ });
45
+ }), de(
46
+ y.map((g) => ({
47
+ name: g.remote,
48
+ alias: g.remote,
49
+ entry: `/addons/${g.addon || g.remote}/${g.version}/frontend/modules/${g.remote}/remoteEntry.js?server=${r?.releaseInfo?.version || r?.releaseInfo}-${r?.releaseInfo?.buildDate}-${(/* @__PURE__ */ new Date()).getTime()}`,
50
+ type: "module"
51
+ }))
52
+ ), h(!0);
53
+ }, [s, e, c, d]), /* @__PURE__ */ T(
54
+ Se.Provider,
55
+ {
56
+ value: {
57
+ isLoading: e,
58
+ modules: s,
59
+ remotesInitialized: d
60
+ },
61
+ children: f
62
+ }
63
+ );
64
+ }, Ve = {
65
+ planner: {
66
+ label: "Planner",
67
+ icon: "calendar_month",
68
+ features: {
69
+ subtasks: {
70
+ label: "Subtasks",
71
+ description: "Divide complex tasks into smaller, actionable items for more granular tracking and clearer responsibility.",
72
+ bullet: "Granular task breakdown with subtasks"
73
+ },
74
+ integratedPlanning: {
75
+ label: "Integrated Planning",
76
+ description: "Bridge high-level phase estimation and detailed task scheduling to map out production timelines before assigning artists.",
77
+ bullet: "High-level and granular planning in one place"
78
+ },
79
+ studioOversight: {
80
+ label: "Studio Oversight",
81
+ description: "Toggle between a bird's-eye view of all studio projects and project-specific deep-dive views to spot scheduling overlaps.",
82
+ bullet: "Cross-project scheduling and conflict detection"
83
+ },
84
+ sandboxScenarios: {
85
+ label: "Sandbox Scenarios",
86
+ description: 'Experiment with "what-if" scheduling strategies in private scenarios, then set your best version to "Live" with one click.',
87
+ bullet: 'Risk-free "what-if" scheduling experiments'
88
+ },
89
+ trackBasedTimelines: {
90
+ label: "Track-Based Timelines",
91
+ description: "Manage complex timelines using familiar lane-based organization—similar to video editing—for episodes, departments, or assets.",
92
+ bullet: "Familiar lane-based timeline organization"
93
+ },
94
+ dataPortability: {
95
+ label: "Data Portability",
96
+ description: "Export schedules to CSV or ICS to keep your team synced across spreadsheets, calendars, and other platforms.",
97
+ bullet: "CSV and ICS export for universal sync"
98
+ }
99
+ },
100
+ featureOrder: [
101
+ "subtasks",
102
+ "integratedPlanning",
103
+ "studioOversight",
104
+ "sandboxScenarios",
105
+ "trackBasedTimelines",
106
+ "dataPortability"
107
+ ]
108
+ }
109
+ }, pt = ({
110
+ children: f,
111
+ defaultTab: i = "feed",
112
+ hasLicense: s,
113
+ debug: e = {},
114
+ ...r
115
+ }) => {
116
+ const c = r.user, d = Be(c), h = "isGuest" in e ? e.isGuest : c?.data?.isGuest, { powerLicense: y, setPowerpackDialog: g } = ne(), p = "hasLicense" in e ? e.hasLicense : !!y || s, [l, n] = w({}), [u, m] = w([]), [C, v] = w([]), x = E(
117
+ (L) => l[L] ? l[L] : !1,
118
+ [l]
119
+ ), D = E(
120
+ (L, N) => {
121
+ const A = { ...l };
122
+ A[L] = N, n(A);
123
+ },
124
+ [l]
125
+ ), [o, a] = Ie(Ee, {}), b = E(
126
+ (L) => {
127
+ const N = o[L];
128
+ return ke(N) ? N : i;
129
+ },
130
+ [o, i]
131
+ ), [P, S] = w(null), M = E((L) => {
132
+ S(L);
133
+ }, []), F = E(() => {
134
+ S(null), P && R([]);
135
+ }, []);
136
+ B(() => {
137
+ F();
138
+ }, [r.useLocation().pathname]);
139
+ const [t, I] = w(null), k = E((L) => {
140
+ I(L);
141
+ }, []), O = E(() => {
142
+ I(null);
143
+ }, []), [U, _] = w(null), [V, R] = w([]), { uriType: H, uri: se, entity: $, getUriEntities: re } = Le(), [Q] = r.useSearchParams(), W = Q.get("project"), q = Q.get("type"), z = Q.get("id"), J = Q.get("activity");
144
+ B(() => {
145
+ if (!(!W && !q && !z)) {
146
+ if (H === "entity" && $ && $.entityType !== "product") {
147
+ re().then((L) => {
148
+ if (L.length === 0) return;
149
+ const N = L.find((le) => le.uri === se), A = N?.entities?.[0];
150
+ if (!N || !A) return;
151
+ const K = A?.projectName || $.projectName || "", X = A.representationId || A.versionId || A.productId || A.taskId || A.folderId;
152
+ if (!K || !X) return;
153
+ const ae = {
154
+ entityType: $.entityType,
155
+ entities: [
156
+ {
157
+ id: X,
158
+ projectName: K
159
+ }
160
+ ],
161
+ source: "uri"
162
+ };
163
+ _(ae);
164
+ }).catch((L) => {
165
+ console.warn("Failed to get URI entities:", L);
166
+ });
167
+ return;
168
+ }
169
+ W && q && z && (_({
170
+ entityType: q,
171
+ entities: [
172
+ {
173
+ id: z,
174
+ projectName: W
175
+ }
176
+ ],
177
+ source: "url"
178
+ }), J && (R([J]), a({
179
+ ...o,
180
+ overview: "feed"
181
+ })));
182
+ }
183
+ }, [W, q, z]);
184
+ const ie = {
185
+ // open state for the panel by scope
186
+ panelOpenByScope: l,
187
+ getOpenForScope: x,
188
+ setPanelOpen: D,
189
+ setPanelOpenByScope: n,
190
+ // tab preferences
191
+ tabsByScope: o,
192
+ getTabForScope: b,
193
+ // slide out state
194
+ slideOut: P,
195
+ openSlideOut: M,
196
+ closeSlideOut: F,
197
+ // highlighted activities
198
+ highlightedActivities: V,
199
+ setHighlightedActivities: R,
200
+ // PiP state
201
+ pip: t,
202
+ openPip: k,
203
+ closePip: O,
204
+ // entities state
205
+ entities: U,
206
+ setEntities: _,
207
+ feedAnnotations: u,
208
+ setFeedAnnotations: m,
209
+ feedFrameLinks: C,
210
+ setFeedFrameLinks: v,
211
+ bundleMode: d,
212
+ isGuest: h,
213
+ hasLicense: p,
214
+ onPowerFeature: g,
215
+ ...r
216
+ };
217
+ return /* @__PURE__ */ T(xe.Provider, { value: ie, children: f });
218
+ }, He = (f) => {
219
+ const { setPowerpackDialog: i } = ne();
220
+ return B(() => {
221
+ i({ addon: "planner", feature: "subtasks" }), f?.onNotFound?.();
222
+ }, [i, f.onNotFound]), null;
223
+ }, ft = ({ children: f }) => {
224
+ const [i, { outdated: s, isLoading: e }] = oe({
20
225
  addon: "planner",
21
226
  remote: "planner",
22
227
  module: "SubtasksManager",
23
- fallback: l
228
+ fallback: He
229
+ });
230
+ return /* @__PURE__ */ T(
231
+ De.Provider,
232
+ {
233
+ value: { SubtasksManager: i, requiredVersion: s?.required, isLoading: e },
234
+ children: f
235
+ }
236
+ );
237
+ }, gt = ({ children: f }) => {
238
+ const [i, s] = w(!1), [e, r] = w(null), [c, d] = w(null), h = () => {
239
+ s(!0), r(null);
240
+ }, y = () => {
241
+ s(!1), r(null);
242
+ }, g = (n, u = null) => {
243
+ s((m) => !m), n && !i ? (r(n), d(u)) : (r(null), d(null));
244
+ }, p = (n, u = null) => {
245
+ r(n), d(u);
246
+ }, l = () => {
247
+ r(null), d(null);
248
+ };
249
+ return /* @__PURE__ */ T(
250
+ Fe.Provider,
251
+ {
252
+ value: {
253
+ isPanelOpen: i,
254
+ selectedSetting: e,
255
+ highlightedSetting: c,
256
+ setHighlightedSetting: d,
257
+ openPanel: h,
258
+ closePanel: y,
259
+ togglePanel: g,
260
+ selectSetting: p,
261
+ backToMainMenu: l
262
+ },
263
+ children: f
264
+ }
265
+ );
266
+ };
267
+ function mt({ children: f }) {
268
+ const i = window.location.protocol === "https:" || window.location.hostname === "localhost", s = "documentPictureInPicture" in window && i, [e, r] = w(null), [c, d] = w(null), h = E(() => {
269
+ d(null), e != null && (e.close(), r(null));
270
+ }, [e, c]), y = E(
271
+ async (p, l) => {
272
+ if (!s) {
273
+ d(Y());
274
+ return;
275
+ }
276
+ if (e != null) {
277
+ console.log("pipWindow is already open"), d(Y());
278
+ return;
279
+ }
280
+ const n = await window.documentPictureInPicture.requestWindow({
281
+ width: p,
282
+ height: l
283
+ });
284
+ n.addEventListener("pagehide", () => {
285
+ r(null), d(null);
286
+ }), r(n), d(Y());
287
+ },
288
+ [e, c]
289
+ );
290
+ B(() => {
291
+ [...document.styleSheets].forEach((p) => {
292
+ try {
293
+ const l = [...p.cssRules].map((m) => m.cssText).join(""), n = document.createElement("style");
294
+ n.textContent = l, e?.document.head.appendChild(n);
295
+ const u = document.createElement("style");
296
+ u.textContent = `
297
+ html, body, .pipRoot {
298
+ height: 100%;
299
+ margin: 0;
300
+ padding: 0;
301
+ overflow: hidden;
302
+ }`, e?.document.head.appendChild(u);
303
+ } catch {
304
+ const n = document.createElement("link");
305
+ if (p.href == null)
306
+ return;
307
+ n.rel = "stylesheet", n.type = p.type, n.media = p.media.toString(), n.href = p.href, e?.document.head.appendChild(n);
308
+ }
309
+ });
310
+ }, [e]);
311
+ const g = j(() => ({
312
+ isSupported: s,
313
+ pipWindow: e,
314
+ pipId: c,
315
+ requestPipWindow: y,
316
+ closePipWindow: h
317
+ }), [h, s, e, y]);
318
+ return /* @__PURE__ */ T(Te.Provider, { value: g, children: f });
319
+ }
320
+ const ht = ({
321
+ children: f,
322
+ projectName: i,
323
+ // utils
324
+ toast: s,
325
+ ...e
326
+ }) => {
327
+ const { data: r } = ge(
328
+ { projectName: i },
329
+ { skip: !i }
330
+ ), { user: c } = te();
331
+ return /* @__PURE__ */ T(
332
+ je.Provider,
333
+ {
334
+ value: {
335
+ ...e,
336
+ projectName: i,
337
+ project: r,
338
+ user: c,
339
+ toast: s
340
+ },
341
+ children: f
342
+ }
343
+ );
344
+ }, yt = ({ children: f, ...i }) => /* @__PURE__ */ T(Me.Provider, { value: { ...i }, children: f }), Pt = ({
345
+ children: f,
346
+ debug: i
347
+ }) => {
348
+ const [s, e] = w(null), [r, c] = w(null), d = (o) => o !== null && typeof o == "object" && "addon" in o, h = E((o) => {
349
+ o === null ? (e(null), c(null)) : d(o) ? (e(null), c(o)) : (c(null), e(o));
350
+ }, []), y = (o) => o ? $e[o] : null, g = (o) => {
351
+ if (!o) return null;
352
+ const a = Ve[o.addon];
353
+ return a ? { ...a, selectedFeature: o.feature } : null;
354
+ }, [p, l] = w(!1), [n, u] = w(!0), m = async () => !1, [C, { isLoaded: v, isLoading: x }] = oe({
355
+ addon: "powerpack",
356
+ remote: "license",
357
+ module: "checkPowerLicense",
358
+ fallback: m
24
359
  });
25
- return /* @__PURE__ */ u(
26
- t.Provider,
360
+ B(() => {
361
+ (async () => {
362
+ if (i?.powerLicense !== void 0)
363
+ console.warn("Using debug power license:", i.powerLicense), l(i.powerLicense), u(!1);
364
+ else if (v || !x) {
365
+ try {
366
+ const a = await C();
367
+ l(a);
368
+ } catch (a) {
369
+ console.error("Error checking power license:", a), l(!1);
370
+ } finally {
371
+ u(!1);
372
+ }
373
+ u(!1);
374
+ }
375
+ })();
376
+ }, [i, v, x, C]);
377
+ const D = j(
378
+ () => ({
379
+ powerLicense: p,
380
+ isLoading: n,
381
+ selectedPowerPack: s,
382
+ selectedAddon: r,
383
+ setPowerpackDialog: h,
384
+ powerpackDialog: y(s),
385
+ addonDialog: g(r)
386
+ }),
387
+ [p, s, r, h, n]
388
+ );
389
+ return /* @__PURE__ */ T(Oe.Provider, { value: D, children: f });
390
+ }, vt = ({ children: f, skip: i = !1 }) => {
391
+ const {
392
+ data: s = {},
393
+ isLoading: e,
394
+ error: r
395
+ } = me({ full: !0 }, { skip: i }), { data: c, isLoading: d, error: h } = he(), {
396
+ data: y = [],
397
+ isLoading: g,
398
+ error: p
399
+ } = ye({}, { skip: i }), l = j(() => y.filter((C) => C.active), [y]), {
400
+ data: n,
401
+ isLoading: u,
402
+ error: m
403
+ } = Pe(void 0, { skip: !c?.name });
404
+ return /* @__PURE__ */ T(
405
+ Ae.Provider,
27
406
  {
28
- value: { SubtasksManager: o, requiredVersion: s?.required, isLoading: a },
29
- children: e
407
+ value: {
408
+ siteInfo: s,
409
+ attributes: s?.attributes || [],
410
+ user: c,
411
+ cloudInfo: n,
412
+ projects: {
413
+ all: y,
414
+ active: l
415
+ },
416
+ isLoading: {
417
+ siteInfo: e,
418
+ user: d,
419
+ cloudInfo: u,
420
+ projects: g
421
+ },
422
+ error: {
423
+ siteInfo: r,
424
+ user: h,
425
+ cloudInfo: m,
426
+ projects: p
427
+ }
428
+ },
429
+ children: f
430
+ }
431
+ );
432
+ }, wt = ({
433
+ projectName: f,
434
+ children: i
435
+ }) => {
436
+ const {
437
+ data: { folders: s = [] } = {},
438
+ isLoading: e,
439
+ isFetching: r,
440
+ isSuccess: c,
441
+ isUninitialized: d,
442
+ error: h,
443
+ refetch: y
444
+ } = ve({ projectName: f, attrib: !0 }), g = ze({ projectName: f }, r || e), p = j(() => {
445
+ const o = /* @__PURE__ */ new Map();
446
+ for (const a of s)
447
+ o.set(a.id, a);
448
+ return o;
449
+ }, [s]), l = j(() => (o) => p.get(o), [p]), n = j(
450
+ () => (o, a, b = {}) => {
451
+ if (!a.length) return {};
452
+ const P = {}, S = new Set(a), M = /* @__PURE__ */ new Set();
453
+ let F = o;
454
+ for (; S.size > 0 && F && !M.has(F); ) {
455
+ M.add(F);
456
+ const t = p.get(F);
457
+ if (!t) break;
458
+ const I = t.attrib || {};
459
+ for (const k of Array.from(S))
460
+ t.ownAttrib?.includes(k) && k in I && (P[k] = Object.entries(I).find(
461
+ ([O]) => O === k
462
+ )?.[1], S.delete(k));
463
+ F = t.parentId;
464
+ }
465
+ for (const t of Array.from(S))
466
+ t in b && (P[t] = b[t], S.delete(t));
467
+ for (const t of S)
468
+ P[t] = null;
469
+ return P;
470
+ },
471
+ [p]
472
+ ), u = j(
473
+ () => (o) => {
474
+ const a = [], b = /* @__PURE__ */ new Set();
475
+ let P = o;
476
+ for (; P && !b.has(P); ) {
477
+ b.add(P);
478
+ const S = p.get(P);
479
+ if (!S?.parentId) break;
480
+ a.push(S.parentId), P = S.parentId;
481
+ }
482
+ return a;
483
+ },
484
+ [p]
485
+ ), m = j(
486
+ () => (o) => {
487
+ const a = new Set(o);
488
+ return o.filter((b) => !u(b).some((P) => a.has(P)));
489
+ },
490
+ [u]
491
+ ), C = j(() => {
492
+ const o = /* @__PURE__ */ new Map();
493
+ for (const a of s) {
494
+ if (!a.parentId) continue;
495
+ const b = o.get(a.parentId);
496
+ b ? b.push(a.id) : o.set(a.parentId, [a.id]);
30
497
  }
498
+ return o;
499
+ }, [s]), v = j(
500
+ () => (o, a = !1) => {
501
+ const b = a ? [...o] : [], P = [...o];
502
+ for (; P.length > 0; ) {
503
+ const S = P.shift();
504
+ for (const M of C.get(S) || [])
505
+ b.push(M), P.push(M);
506
+ }
507
+ return b;
508
+ },
509
+ [C]
510
+ ), x = () => y().unwrap(), D = j(
511
+ () => ({
512
+ folders: s,
513
+ getFolderById: l,
514
+ findNonInheritedValues: n,
515
+ getParentFolderIds: u,
516
+ getFolderIdsWithoutChildren: m,
517
+ getChildFolderIds: v,
518
+ isLoading: g,
519
+ // first time and when args change
520
+ isFetching: r,
521
+ // any background fetching
522
+ isSuccess: c,
523
+ isUninitialized: d,
524
+ error: h,
525
+ refetch: x
526
+ }),
527
+ [
528
+ s,
529
+ l,
530
+ n,
531
+ u,
532
+ m,
533
+ v,
534
+ g,
535
+ r,
536
+ c,
537
+ d,
538
+ h,
539
+ x
540
+ ]
31
541
  );
32
- }, b = () => {
33
- const e = d(t);
34
- if (!e)
35
- throw new Error("useSubtasksModulesContext must be used within a SubtasksModulesProvider");
36
- return e;
542
+ return /* @__PURE__ */ T(Ue.Provider, { value: D, children: i });
543
+ }, bt = "uri", Ct = ({ children: f }) => {
544
+ const i = location.pathname, [s, e] = w(""), r = ["projects", "settings", "dashboard/tasks"];
545
+ B(() => {
546
+ r.some((u) => i.startsWith(`/${u}`)) || e("");
547
+ }, [i, e]);
548
+ const { type: c, entity: d, settings: h } = Ge(s), y = E(
549
+ ({ projectName: n, folderPath: u, taskName: m, productName: C, versionName: v }) => {
550
+ const x = _e({ projectName: n, folderPath: u, taskName: m, productName: C, versionName: v });
551
+ e(x);
552
+ },
553
+ [e]
554
+ ), [g] = we(), p = E(async () => {
555
+ if (c !== "entity" || !s) return [];
556
+ try {
557
+ const n = await g({ resolveRequestModel: { uris: [s] } }).unwrap();
558
+ return console.log("Resolved entity from URI:", n), n;
559
+ } catch (n) {
560
+ return console.warn("Failed to resolve URI:", n), [];
561
+ }
562
+ }, [g, s, c]), l = {
563
+ uri: s,
564
+ uriType: c,
565
+ entity: d,
566
+ settings: h,
567
+ setUri: e,
568
+ setEntityUri: y,
569
+ getUriEntities: p
570
+ };
571
+ return /* @__PURE__ */ T(Re.Provider, { value: l, children: f });
572
+ }, ee = [
573
+ "representation",
574
+ "version",
575
+ "workfile",
576
+ "product",
577
+ "task",
578
+ "folder"
579
+ ], Ye = "delete-folder-with-children", St = ({ children: f }) => {
580
+ const [i] = be(), [s] = Ce(), [e, r] = w(null), [c, d] = w(null), h = E(
581
+ (l) => new Promise((n) => d({ payload: l, resolve: n })),
582
+ []
583
+ ), y = E(
584
+ async (l, n) => {
585
+ if (!l || l.length === 0) {
586
+ G.error("No entities selected");
587
+ return;
588
+ }
589
+ const u = /* @__PURE__ */ new Set(), m = l.filter((t) => !t?.id || u.has(t.id) ? !1 : (u.add(t.id), !0));
590
+ if (m.length === 0) {
591
+ G.error("No entities found");
592
+ return;
593
+ }
594
+ const C = new Set(m.map((t) => t.id)), v = m.filter((t) => t.entityType === "folder" && t.parentId ? !C.has(t.parentId) : (t.entityType === "task" || t.entityType === "product") && t.folderId ? !C.has(t.folderId) : !0), x = async (t, I) => {
595
+ if (t.length === 0) return;
596
+ const k = /* @__PURE__ */ new Map();
597
+ for (const O of t) {
598
+ const U = k.get(O.projectName) || [];
599
+ U.push(O), k.set(O.projectName, U);
600
+ }
601
+ await Promise.all(
602
+ Array.from(k.entries()).map(([O, U]) => {
603
+ const V = [...U].sort(
604
+ (R, H) => ee.indexOf(R.entityType) - ee.indexOf(H.entityType)
605
+ ).map((R) => ({
606
+ type: "delete",
607
+ entityType: R.entityType,
608
+ entityId: R.id,
609
+ force: I
610
+ }));
611
+ return i({
612
+ operationsRequestModel: { operations: V },
613
+ projectName: O
614
+ }).unwrap();
615
+ })
616
+ );
617
+ }, D = async () => {
618
+ try {
619
+ await x(v, !1), n?.onSuccess?.();
620
+ } catch (t) {
621
+ throw { message: pe(t) || "Failed to delete entities", ...t };
622
+ }
623
+ }, o = () => x(
624
+ v.filter((t) => t.entityType === "folder" || t.entityType === "task"),
625
+ !0
626
+ ), a = v.filter((t) => t.entityType === "folder");
627
+ let b = [];
628
+ if (a.length > 0) {
629
+ const t = /* @__PURE__ */ new Map();
630
+ for (const I of a) {
631
+ const k = t.get(I.projectName) || [];
632
+ k.push(I), t.set(I.projectName, k);
633
+ }
634
+ try {
635
+ b = (await Promise.all(
636
+ Array.from(t.entries()).map(
637
+ ([k, O]) => s({
638
+ projectName: k,
639
+ folderIds: O.map((U) => U.id)
640
+ }).unwrap()
641
+ )
642
+ )).flat();
643
+ } catch (I) {
644
+ console.warn("Failed to fetch folder delete info, falling back to local data", I);
645
+ }
646
+ }
647
+ const P = Qe(a, b), S = v.filter((t) => t.entityType === "product").length;
648
+ S > 0 && P.push(
649
+ S > 1 ? "Deleting these products also deletes all their versions" : "Deleting this product also deletes all its versions"
650
+ );
651
+ const M = We(v), F = v.length === 1 ? v[0] : void 0;
652
+ r({
653
+ payload: {
654
+ entityLabel: M,
655
+ childrenDetails: P,
656
+ expectedCounts: qe(v, b),
657
+ expectedName: F && (F.label || F.name || F.id)
658
+ },
659
+ accept: D,
660
+ recover: async (t) => ue(t).includes(Ye) ? await h({
661
+ entityLabel: M,
662
+ message: `Are you really sure you want to delete ${M} and all of its dependencies? This cannot be undone. (NOT RECOMMENDED)`,
663
+ childrenDetails: [],
664
+ expectedCounts: {},
665
+ deleteLabel: "Force delete"
666
+ }) ? (await o(), n?.onSuccess?.(), "recovered") : "cancelled" : "unhandled"
667
+ });
668
+ },
669
+ [i, s, h]
670
+ ), g = E(async () => {
671
+ if (!e) return;
672
+ const { payload: l, accept: n, recover: u } = e;
673
+ r(null);
674
+ const m = l.entityLabel, C = G.loading(`Deleting ${m}...`, { autoClose: !1 }), v = () => G.update(C, {
675
+ render: `${m} deleted`,
676
+ type: "success",
677
+ autoClose: 5e3,
678
+ isLoading: !1
679
+ });
680
+ try {
681
+ await n(), v();
682
+ } catch (x) {
683
+ let D = x;
684
+ try {
685
+ const a = await u(x);
686
+ if (a === "recovered") return v();
687
+ if (a === "cancelled")
688
+ return G.update(C, {
689
+ render: `${m} was not deleted`,
690
+ type: "info",
691
+ autoClose: 5e3,
692
+ isLoading: !1
693
+ });
694
+ } catch (a) {
695
+ D = a;
696
+ }
697
+ const o = typeof D == "string" ? D : D?.message || D?.error || `Error deleting ${m}`;
698
+ G.update(C, {
699
+ render: o,
700
+ type: "error",
701
+ autoClose: 5e3,
702
+ isLoading: !1
703
+ });
704
+ }
705
+ }, [e]), p = j(() => ({ deleteEntities: y }), [y]);
706
+ return /* @__PURE__ */ ce(Ne.Provider, { value: p, children: [
707
+ f,
708
+ e && /* @__PURE__ */ T(
709
+ Z,
710
+ {
711
+ payload: e.payload,
712
+ onConfirm: g,
713
+ onCancel: () => r(null)
714
+ }
715
+ ),
716
+ c && /* @__PURE__ */ T(
717
+ Z,
718
+ {
719
+ payload: c.payload,
720
+ onConfirm: () => {
721
+ d(null), c.resolve(!0);
722
+ },
723
+ onCancel: () => {
724
+ d(null), c.resolve(!1);
725
+ }
726
+ }
727
+ )
728
+ ] });
37
729
  };
38
730
  export {
39
- I as AddonProjectProvider,
40
- L as AddonProvider,
41
- N as DeleteEntitiesProvider,
42
- A as DetailsPanelProvider,
43
- ce as EntityUpdatesProvider,
44
- xe as FORCE_AUTO_SYNC,
45
- se as GlobalProvider,
46
- j as MenuContext,
47
- w as MenuProvider,
48
- q as PiPProvider,
49
- W as PiPWrapper,
50
- k as PowerpackProvider,
51
- ne as ProjectContextProvider,
52
- le as ProjectFoldersContextProvider,
53
- f as RemoteModulesProvider,
54
- V as SettingsPanelProvider,
55
- Y as SocketProvider,
56
- C as SubtasksModulesProvider,
57
- z as ThumbnailUploadContext,
58
- B as ThumbnailUploadProvider,
59
- E as URIProvider,
60
- T as URL_PARAM_ID,
61
- M as addonConfigs,
62
- me as getAutoSyncForTopic,
63
- Ce as getUpdateType,
64
- H as isDeletableEntityType,
65
- g as powerpackFeatureOrder,
66
- D as powerpackFeatures,
67
- R as setDetailsPanelTabForScope,
68
- J as useAddonContext,
69
- K as useAddonProjectContext,
70
- be as useAutoSyncSettings,
71
- Q as useDeleteEntitiesContext,
72
- X as useDeleteEntitiesContextOptional,
73
- y as useDetailsPanelContext,
74
- ae as useGlobalContext,
75
- h as useMenuContext,
76
- ue as useOptionalProjectContext,
77
- Z as usePiPWindow,
78
- n as usePowerpack,
79
- de as useProjectContext,
80
- Pe as useProjectFoldersContext,
81
- F as useRemoteModules,
82
- O as useScopedDetailsPanel,
83
- $ as useSettingsPanel,
84
- ee as useSocketContext,
85
- b as useSubtasksModulesContext,
86
- ve as useSyncUpdates,
87
- oe as useThumbnailUploadContext,
88
- _ as useURIContext
731
+ Me as AddonContext,
732
+ je as AddonProjectContext,
733
+ ht as AddonProjectProvider,
734
+ yt as AddonProvider,
735
+ Ne as DeleteEntitiesContext,
736
+ St as DeleteEntitiesProvider,
737
+ xe as DetailsPanelContext,
738
+ pt as DetailsPanelProvider,
739
+ Lt as EntityUpdatesContext,
740
+ gn as EntityUpdatesProvider,
741
+ mn as FORCE_AUTO_SYNC,
742
+ Ae as GlobalContext,
743
+ vt as GlobalProvider,
744
+ xt as MenuContext,
745
+ pn as MenuProvider,
746
+ Te as PiPContext,
747
+ mt as PiPProvider,
748
+ Et as PiPWrapper,
749
+ Oe as PowerpackContext,
750
+ Pt as PowerpackProvider,
751
+ Dt as ProjectContext,
752
+ an as ProjectContextProvider,
753
+ Ue as ProjectFoldersContext,
754
+ wt as ProjectFoldersContextProvider,
755
+ Se as RemoteModulesContext,
756
+ ut as RemoteModulesProvider,
757
+ Fe as SettingsPanelContext,
758
+ gt as SettingsPanelProvider,
759
+ Ft as SocketContext,
760
+ Tt as SocketProvider,
761
+ De as SubtasksModulesContext,
762
+ ft as SubtasksModulesProvider,
763
+ Ee as TABS_BY_SCOPE_KEY,
764
+ jt as ThumbnailUploadContext,
765
+ ln as ThumbnailUploadProvider,
766
+ Re as URIContext,
767
+ Ct as URIProvider,
768
+ bt as URL_PARAM_ID,
769
+ Ve as addonConfigs,
770
+ Mt as getActivityFrameLink,
771
+ Ot as getAutoSyncForTopic,
772
+ At as getUpdateType,
773
+ Ut as isDeletableEntityType,
774
+ ke as isDetailsPanelTab,
775
+ Rt as matchesProject,
776
+ Nt as matchesTopic,
777
+ dn as powerpackFeatureOrder,
778
+ $e as powerpackFeatures,
779
+ Bt as setDetailsPanelTabForScope,
780
+ Gt as toggleSyncAll,
781
+ _t as useAddonContext,
782
+ $t as useAddonProjectContext,
783
+ Qt as useAutoSyncSettings,
784
+ Wt as useDeleteEntitiesContext,
785
+ qt as useDeleteEntitiesContextOptional,
786
+ zt as useDetailsPanelContext,
787
+ te as useGlobalContext,
788
+ Vt as useMenuContext,
789
+ Ht as useOptionalProjectContext,
790
+ Yt as usePiPWindow,
791
+ ne as usePowerpack,
792
+ Jt as useProjectContext,
793
+ Kt as useProjectFoldersContext,
794
+ Xt as useRemoteModules,
795
+ Zt as useScopedDetailsPanel,
796
+ en as useSettingsPanel,
797
+ tn as useSocketContext,
798
+ nn as useSubtasksModulesContext,
799
+ on as useSyncUpdates,
800
+ sn as useThumbnailUploadContext,
801
+ Le as useURIContext
89
802
  };