@ynput/ayon-frontend-shared 0.7.6 → 0.8.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 (70) hide show
  1. package/dist/DetailsPanel.es.js +361 -355
  2. package/dist/Feed.es.js +1 -1
  3. package/dist/ListTable.es.js +18 -18
  4. package/dist/NewEntity.es.js +30 -30
  5. package/dist/ProjectTreeTable.es.js +984 -974
  6. package/dist/ProjectsTable.es.js +3 -3
  7. package/dist/Slicer.es.js +53 -50
  8. package/dist/Views.es.js +150 -151
  9. package/dist/api.es.js +166 -165
  10. package/dist/chunks/Actions.es.js +9 -10
  11. package/dist/chunks/ColumnDropIndicator.es.js +2 -2
  12. package/dist/chunks/ColumnHeaderMenuUI.es.js +3 -4
  13. package/dist/chunks/DeleteEntitiesConfirmDialog.es.js +2 -2
  14. package/dist/chunks/DetailsDialog.es.js +3 -3
  15. package/dist/chunks/EmptyPlaceholder.es.js +7 -7
  16. package/dist/chunks/EntityPath.es.js +38 -39
  17. package/dist/chunks/EntityPickerDialog.es.js +65 -66
  18. package/dist/chunks/EntityTooltip.es.js +18 -19
  19. package/dist/chunks/Feed.es.js +1381 -1355
  20. package/dist/chunks/FilmstripEntityCard.es.js +5201 -0
  21. package/dist/chunks/FilterErrorActions.es.js +2 -3
  22. package/dist/chunks/GroupSettingsFallback.es.js +2 -2
  23. package/dist/chunks/Menu.es.js +52 -53
  24. package/dist/chunks/MetaWidget.es.js +1948 -1875
  25. package/dist/chunks/ProjectFoldersContext.es.js +40 -40
  26. package/dist/chunks/RepresentationsList.es.js +1 -1
  27. package/dist/chunks/ReviewablesSelector.es.js +759 -742
  28. package/dist/chunks/SimpleTable.es.js +2 -1
  29. package/dist/chunks/Slicer.es.js +49 -50
  30. package/dist/chunks/TableExportContextInstance.es.js +600 -402
  31. package/dist/chunks/TableSettingsFallback.es.js +3 -4
  32. package/dist/chunks/ThumbnailSimple.es.js +114 -99
  33. package/dist/chunks/VideoPlayer.es.js +8 -9
  34. package/dist/chunks/Watchers.es.js +928 -871
  35. package/dist/chunks/expandRelativeDates.es.js +1 -1
  36. package/dist/chunks/getThumbnailUrl.es.js +33 -21
  37. package/dist/chunks/getUris.es.js +1580 -1610
  38. package/dist/chunks/queryFilterToClientFilter.es.js +1 -1
  39. package/dist/chunks/realtimeUpdatesUtils.es.js +15 -15
  40. package/dist/chunks/searchTerms.es.js +774 -696
  41. package/dist/chunks/useAttributeEnums.es.js +22 -22
  42. package/dist/chunks/useDateRangeFilter.es.js +1 -1
  43. package/dist/chunks/useHierarchySelection.es.js +3 -4
  44. package/dist/chunks/useLoadModule.es.js +3 -4
  45. package/dist/components.es.js +1261 -1206
  46. package/dist/context.es.js +615 -540
  47. package/dist/hooks.es.js +193 -171
  48. package/dist/index.es.js +2 -2
  49. package/dist/types/Actions.d.ts +10 -8
  50. package/dist/types/DetailsPanel.d.ts +54 -76
  51. package/dist/types/EntityPickerDialog.d.ts +12 -6
  52. package/dist/types/Feed.d.ts +24 -24
  53. package/dist/types/ListTable.d.ts +33 -27
  54. package/dist/types/NewEntity.d.ts +26 -39
  55. package/dist/types/ProjectTreeTable.d.ts +275 -194
  56. package/dist/types/ProjectsTable.d.ts +6 -6
  57. package/dist/types/RepresentationsList.d.ts +4 -0
  58. package/dist/types/Slicer.d.ts +63 -246
  59. package/dist/types/Views.d.ts +71 -298
  60. package/dist/types/api.d.ts +3165 -2363
  61. package/dist/types/components.d.ts +444 -473
  62. package/dist/types/context.d.ts +285 -572
  63. package/dist/types/hooks.d.ts +76 -47
  64. package/dist/types/index.d.ts +6 -0
  65. package/dist/types/util.d.ts +141 -120
  66. package/dist/util.es.js +71 -68
  67. package/package.json +6 -6
  68. package/dist/chunks/EntityUpdatesContext.es.js +0 -61
  69. package/dist/chunks/PlayableIcon.es.js +0 -5020
  70. package/dist/chunks/viewUpdateHelper.es.js +0 -153
@@ -1,144 +1,214 @@
1
- import { jsxs as le, jsx as k } from "react/jsx-runtime";
2
- import { useState as h, useEffect as O, useMemo as q, useRef as ce, useCallback as C } from "react";
3
- import { registerRemotes as Pe, loadRemote as be } from "@module-federation/enhanced/runtime";
4
- import { setManifestsLoading as de, MANIFEST_MODULE as re, registerManifest as we } from "@ynput/ayon-addon/host";
5
- import { toast as I } from "react-toastify";
6
- import { d as ue, A as Ee, B as Se, G as Ce, R as xe, H as ke, I as Le, b as ee, p as Ie, J as De, K as Te, L as je, N as Ae, O as Oe, Q as Re, U as Me, V as Fe, W as Ue, X as $e, Y as Ne, Z as _e, _ as Be, a as Ge, $ as qe, a0 as Ve } from "./chunks/TableExportContextInstance.es.js";
7
- import { E as Zt, M as Jt, a1 as eo, P as to, n as oo, a2 as no, a3 as so, T as ro, a4 as ao, a5 as io, g as lo, a6 as co, a7 as uo, m as po, c as fo, a8 as mo, t as go, a9 as vo, aa as yo, ab as ho, ac as Po, ad as bo, x as wo, u as Eo, o as So, ae as Co, af as xo, y as ko, z as Lo, ag as Io, ah as Do, ai as To, aj as jo, ak as Ao, al as Oo, am as Ro } from "./chunks/TableExportContextInstance.es.js";
8
- import { aH as We, bt as He } from "./chunks/searchTerms.es.js";
9
- import { cZ as Qe, ca as ze, co as Ye, bu as Ke, c$ as Xe, cK as Ze, d5 as Je, dw as et, cR as tt } from "./chunks/getUris.es.js";
1
+ import { jsxs as pe, jsx as A } from "react/jsx-runtime";
2
+ import { useMemo as B, useState as y, useEffect as F, useCallback as D, useRef as Se } from "react";
3
+ import { registerRemotes as Ce, loadRemote as Ee } from "@module-federation/enhanced/runtime";
4
+ import { setManifestsLoading as fe, MANIFEST_MODULE as ae, registerManifest as ke } from "@ynput/ayon-addon/host";
5
+ import { toast as U } from "react-toastify";
6
+ import { c as me, v as xe, x as Le, y as De, R as Ie, A as je, z as Te, b as te, l as Ae, B as Oe, E as Re, G as Fe, H as Me, I as Ue, J as $e, K as Ne, L as Be, N as _e, O as Ge, Q as qe, U as Ve, V as Qe, a as We, W as He, X as Ye } from "./chunks/TableExportContextInstance.es.js";
7
+ import { Y as rn, Z as an, _ as ln, M as dn, $ as cn, P as un, j as pn, a0 as fn, a1 as mn, T as gn, a2 as vn, a3 as hn, a4 as yn, a5 as Pn, a6 as bn, a7 as wn, a8 as Sn, a9 as Cn, aa as En, ab as kn, ac as xn, ad as Ln, ae as Dn, af as In, m as jn, u as Tn, k as An, t as On, ag as Rn, q as Fn, s as Mn, ah as Un, ai as $n, aj as Nn, ak as Bn, al as _n, am as Gn, an as qn } from "./chunks/TableExportContextInstance.es.js";
8
+ import { aH as ze, bs as Ke } from "./chunks/searchTerms.es.js";
9
+ import { c_ as Xe, cY as Ze, cZ as Je, cb as et, cp as tt, bv as nt, d0 as ot, cL as st, d6 as rt, dx as at, cS as it } from "./chunks/getUris.es.js";
10
10
  import "primereact/confirmdialog";
11
11
  import "lodash";
12
- import { v4 as J } from "uuid";
13
- import { g as ot, c as nt, p as st, b as rt } from "./chunks/getBundleMode.es.js";
14
- import { U as Fo } from "./chunks/getBundleMode.es.js";
12
+ import { v4 as ee } from "uuid";
13
+ import { g as ge, c as lt, p as dt, b as ct } from "./chunks/getBundleMode.es.js";
14
+ import { U as Qn } from "./chunks/getBundleMode.es.js";
15
15
  import "axios";
16
- import { u as pe } from "./chunks/useLoadModule.es.js";
17
- import { T as $o } from "./chunks/ThumbnailUploaderContext.es.js";
16
+ import { u as ve } from "./chunks/useLoadModule.es.js";
17
+ import { T as Hn } from "./chunks/ThumbnailUploaderContext.es.js";
18
18
  import "react-dom";
19
- import { p as at, b as it, a as lt, c as ct, D as ae } from "./chunks/DeleteEntitiesConfirmDialog.es.js";
20
- import { d as _o } from "./chunks/DeleteEntitiesConfirmDialog.es.js";
21
- import { M as Go } from "./chunks/MenuContext.es.js";
22
- import { P as Vo, a as Wo } from "./chunks/ProjectFoldersContext.es.js";
23
- import { E as Qo, F as zo } from "./chunks/EntityUpdatesContext.es.js";
24
- import { useSearchParams as dt } from "react-router-dom";
25
- const ut = async (c) => {
26
- const s = {};
19
+ import { p as ut, b as pt, a as ft, c as mt, D as ie } from "./chunks/DeleteEntitiesConfirmDialog.es.js";
20
+ import { d as zn } from "./chunks/DeleteEntitiesConfirmDialog.es.js";
21
+ import { M as Xn } from "./chunks/MenuContext.es.js";
22
+ import { P as Jn, a as eo } from "./chunks/ProjectFoldersContext.es.js";
23
+ import { useSearchParams as gt } from "react-router-dom";
24
+ const vt = (r, t, n, e) => {
25
+ if (n === "developer") {
26
+ const i = t.find((u) => u.isDev && u.activeUser === e);
27
+ if (i) {
28
+ const u = {};
29
+ for (const [v, b] of Object.entries(i.addons ?? {}))
30
+ b && (u[v] = b);
31
+ return { variant: "developer", versions: u };
32
+ }
33
+ }
34
+ const s = n === "staging" ? "staging" : "production", o = {};
35
+ for (const i of r) {
36
+ const u = s === "staging" ? i.stagingVersion : i.productionVersion;
37
+ u && (o[i.name] = u);
38
+ }
39
+ return { variant: s, versions: o };
40
+ }, le = (r, t, n) => {
41
+ const e = r.find((o) => o.name === t), s = n ? e?.versions?.[n]?.frontendScopes : void 0;
42
+ return !!s && Object.keys(s).length > 0;
43
+ }, de = (r) => Object.fromEntries(r.map((t) => [t.addonName, t.addonVersion])), ce = (r, t, n) => [.../* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(t)])].filter((e) => r[e] !== t[e] && n(e)).map((e) => t[e] ? `${e} ${t[e]}` : `${e} removed`), ht = (r, t) => {
44
+ const n = ce(
45
+ de(r.modules),
46
+ de(t.modules),
47
+ () => !0
48
+ );
49
+ if (r.bundle && t.bundle) {
50
+ const e = r.bundle.versions, s = t.bundle.versions;
51
+ n.push(
52
+ ...ce(
53
+ e,
54
+ s,
55
+ (o) => le(t.addons, o, e[o]) || le(t.addons, o, s[o])
56
+ )
57
+ );
58
+ }
59
+ return [...new Set(n)];
60
+ }, yt = async (r) => {
61
+ const t = {};
27
62
  return await Promise.all(
28
- c.filter((o) => o.modules.includes(re)).map(async (o) => {
63
+ r.filter((n) => n.modules.includes(ae)).map(async (n) => {
29
64
  try {
30
- const e = await be(
31
- `${o.remote}/${re}`,
65
+ const e = await Ee(
66
+ `${n.remote}/${ae}`,
32
67
  { from: "runtime" }
33
- ), r = e?.default;
34
- if (!Array.isArray(r?.contributes))
68
+ ), s = e?.default;
69
+ if (!Array.isArray(s?.contributes))
35
70
  throw new Error('the manifest has no "contributes" list: export default defineAddon({ contributes })');
36
- we({ name: o.addon, version: o.version, remote: o.remote }, e?.default);
71
+ ke({ name: n.addon, version: n.version, remote: n.remote }, e?.default);
37
72
  } catch (e) {
38
- console.error(`[addon ${o.addon}] its manifest failed to load`, e), s[o.addon] = String(e);
73
+ console.error(`[addon ${n.addon}] its manifest failed to load`, e), t[n.addon] = String(e);
39
74
  }
40
75
  })
41
- ), de(!1), s;
42
- }, $t = ({ children: c, skip: s }) => {
76
+ ), fe(!1), t;
77
+ }, Qt = ({ children: r, skip: t }) => {
43
78
  const {
44
- data: o = [],
45
- isLoading: e,
46
- isFetching: r
47
- } = Qe(void 0, {
48
- skip: s
49
- }), {
50
- siteInfo: d,
51
- user: m,
52
- isLoading: { siteInfo: P, user: b }
53
- } = ue(), [y] = h(Ee), p = y && "override" in y ? y.override : void 0, [n, t] = h(
54
- y ? "override" in y ? { status: "loading", override: y.override } : { status: "rejected", ...y } : { status: "off" }
79
+ siteInfo: n,
80
+ user: e,
81
+ isLoading: { siteInfo: s, user: o }
82
+ } = me(), i = ge(e), {
83
+ data: u = [],
84
+ isLoading: v,
85
+ isFetching: b
86
+ } = Xe(
87
+ { variant: i },
88
+ {
89
+ skip: t || o
90
+ }
91
+ ), { data: h, isFetching: c } = Ze(
92
+ {},
93
+ { skip: t || o }
94
+ ), { data: a, isFetching: p } = Je(
95
+ { archived: !1 },
96
+ { skip: t || o || i !== "developer" }
97
+ ), f = B(() => h?.addons ?? [], [h]), P = B(() => a?.bundles ?? [], [a]), m = B(
98
+ () => vt(f, P, i, e?.name),
99
+ [f, P, i, e?.name]
100
+ ), L = c || p, [C] = y(xe), k = C && "override" in C ? C.override : void 0, [l, x] = y(
101
+ C ? "override" in C ? { status: "loading", override: C.override } : { status: "rejected", ...C } : { status: "off" }
55
102
  );
56
- O(() => {
57
- if (!p || b) return;
58
- const v = Se(m);
59
- if (v) {
60
- console.warn(`[addon dev] ignored: ${v}`), t({
103
+ F(() => {
104
+ if (!k || o) return;
105
+ const w = Le(e);
106
+ if (w) {
107
+ console.warn(`[addon dev] ignored: ${w}`), x({
61
108
  status: "rejected",
62
- request: `${p.addon}@${p.url}`,
63
- reason: v
109
+ request: `${k.addon}@${k.url}`,
110
+ reason: w
64
111
  });
65
112
  return;
66
113
  }
67
- Ce(p).then(
68
- (u) => t({ status: "active", override: p, info: u }),
69
- (u) => t({ status: "error", override: p, error: u.message })
114
+ De(k).then(
115
+ (g) => x({ status: "active", override: k, info: g }),
116
+ (g) => x({ status: "error", override: k, error: g.message })
70
117
  );
71
- }, [p, b, m]);
72
- const a = q(() => {
73
- if (n.status !== "active") return o;
74
- const { override: v, info: u } = n;
118
+ }, [k, o, e]);
119
+ const T = B(() => {
120
+ if (l.status !== "active") return u;
121
+ const { override: w, info: g } = l;
75
122
  return [
76
- ...o.filter((f) => f.addonName !== v.addon),
123
+ ...u.filter((S) => S.addonName !== w.addon),
77
124
  {
78
- addonName: v.addon,
79
- addonVersion: `${u.version}+dev`,
80
- modules: { [u.remote]: u.modules }
125
+ addonName: w.addon,
126
+ addonVersion: `${g.version}+dev`,
127
+ modules: { [g.remote]: g.modules }
81
128
  }
82
129
  ];
83
- }, [o, n]), [g, S] = h(!1), w = ce({});
84
- return O(() => {
85
- if (!g || r) return;
86
- const v = a.filter(({ addonName: E, addonVersion: R }) => {
87
- const D = w.current[E];
88
- return D !== void 0 && D !== R;
89
- }), u = "addon-versions-changed";
90
- if (!v.length) {
91
- I.dismiss(u);
130
+ }, [u, l]), [M, _] = y(!1), [I, d] = y(), [E, R] = y();
131
+ return F(() => {
132
+ t || o || E || !I || L || R(m);
133
+ }, [t, o, E, I, L, m]), F(() => {
134
+ if (!M || !I || b || L) return;
135
+ const w = ht(
136
+ { modules: I.modules, bundle: E },
137
+ { modules: T, bundle: m, addons: f }
138
+ ), g = i !== I.variant, S = "addon-versions-changed";
139
+ if (!w.length && !g) {
140
+ U.dismiss(S);
92
141
  return;
93
142
  }
94
- const f = v.map((E) => `${E.addonName} ${E.addonVersion}`).join(", "), i = /* @__PURE__ */ k(Le, { message: `Addons updated (${f}). Refresh to load them.` });
95
- I.isActive(u) ? I.update(u, { render: i }) : I.info(i, { toastId: u, autoClose: !1, closeOnClick: !1 });
96
- }, [a, r, g]), O(() => {
97
- if (e || P || g || n.status === "loading") return;
98
- if (!a.length) {
99
- S(!0), de(!1);
143
+ const $ = g ? "Bundle changed. Refresh to load its addon modules." : `Addons updated (${w.join(", ")}). Refresh to load them.`, O = /* @__PURE__ */ A(Te, { message: $ });
144
+ U.isActive(S) ? U.update(S, { render: O }) : U.info(O, { toastId: S, autoClose: !1, closeOnClick: !1 });
145
+ }, [
146
+ T,
147
+ b,
148
+ L,
149
+ M,
150
+ i,
151
+ I,
152
+ E,
153
+ m,
154
+ f
155
+ ]), F(() => {
156
+ if (v || s || o || M || l.status === "loading")
157
+ return;
158
+ if (!T.length) {
159
+ d({ variant: i, modules: T }), _(!0), fe(!1);
100
160
  return;
101
161
  }
102
- const v = [];
103
- a.forEach((f) => {
104
- const { addonName: i, addonVersion: E, modules: R = {} } = f;
105
- Object.entries(R).forEach(([D, $]) => {
106
- v.push({
107
- remote: D,
108
- addon: i,
109
- version: E,
110
- modules: $
162
+ const w = [];
163
+ T.forEach((S) => {
164
+ const { addonName: $, addonVersion: O, modules: H = {} } = S;
165
+ Object.entries(H).forEach(([X, W]) => {
166
+ w.push({
167
+ remote: X,
168
+ addon: $,
169
+ version: O,
170
+ modules: W
111
171
  });
112
172
  });
113
- }), w.current = Object.fromEntries(v.map((f) => [f.addon, f.version]));
114
- const u = n.status === "active" ? n : void 0;
115
- Pe(
116
- v.map((f) => ({
117
- name: f.remote,
118
- alias: f.remote,
119
- entry: u && f.addon === u.override.addon ? `${u.override.url}/remoteEntry.js?build=${u.info.buildId}` : `/addons/${f.addon || f.remote}/${f.version}/frontend/modules/${f.remote}/remoteEntry.js?server=${d?.releaseInfo?.version || d?.releaseInfo}-${d?.releaseInfo?.buildDate}-${(/* @__PURE__ */ new Date()).getTime()}`,
173
+ }), d({ variant: i, modules: T });
174
+ const g = l.status === "active" ? l : void 0;
175
+ Ce(
176
+ w.map((S) => ({
177
+ name: S.remote,
178
+ alias: S.remote,
179
+ entry: g && S.addon === g.override.addon ? `${g.override.url}/remoteEntry.js?build=${g.info.buildId}` : `/addons/${S.addon || S.remote}/${S.version}/frontend/modules/${S.remote}/remoteEntry.js?server=${n?.releaseInfo?.version || n?.releaseInfo}-${n?.releaseInfo?.buildDate}-${(/* @__PURE__ */ new Date()).getTime()}`,
120
180
  type: "module"
121
181
  }))
122
- ), S(!0), ut(v).then((f) => {
123
- const i = u && f[u.override.addon];
124
- i && t({ ...u, error: `its manifest failed to load (${i})` });
182
+ ), _(!0), yt(w).then((S) => {
183
+ const $ = g && S[g.override.addon];
184
+ $ && x({ ...g, error: `its manifest failed to load (${$})` });
125
185
  });
126
- }, [a, e, P, g, n]), /* @__PURE__ */ le(
127
- xe.Provider,
186
+ }, [
187
+ T,
188
+ v,
189
+ s,
190
+ o,
191
+ M,
192
+ l,
193
+ i
194
+ ]), /* @__PURE__ */ pe(
195
+ Ie.Provider,
128
196
  {
129
197
  value: {
130
- isLoading: e,
131
- modules: a,
132
- remotesInitialized: g,
133
- addonDev: n
198
+ isLoading: v,
199
+ modules: I?.modules ?? T,
200
+ remotesInitialized: M,
201
+ variant: I?.variant,
202
+ bundle: E,
203
+ addonDev: l
134
204
  },
135
205
  children: [
136
- c,
137
- n.status !== "off" && /* @__PURE__ */ k(ke, { state: n })
206
+ r,
207
+ l.status !== "off" && /* @__PURE__ */ A(je, { state: l })
138
208
  ]
139
209
  }
140
210
  );
141
- }, pt = {
211
+ }, Pt = {
142
212
  planner: {
143
213
  label: "Planner",
144
214
  icon: "calendar_month",
@@ -183,628 +253,633 @@ const ut = async (c) => {
183
253
  "dataPortability"
184
254
  ]
185
255
  }
186
- }, Nt = ({
187
- children: c,
188
- defaultTab: s = "feed",
189
- hasLicense: o,
256
+ }, Wt = ({
257
+ children: r,
258
+ defaultTab: t = "feed",
259
+ hasLicense: n,
190
260
  debug: e = {},
191
- ...r
261
+ ...s
192
262
  }) => {
193
- const d = r.user, m = ot(d), P = "isGuest" in e ? e.isGuest : d?.data?.isGuest, { powerLicense: b, setPowerpackDialog: y } = ee(), p = "hasLicense" in e ? e.hasLicense : !!b || o, [n, t] = h({}), [a, g] = h([]), [S, w] = h([]), v = C(
194
- (x) => n[x] ? n[x] : !1,
195
- [n]
196
- ), u = C(
197
- (x, A) => {
198
- const V = { ...n };
199
- V[x] = A, t(V);
263
+ const o = s.user, i = ge(o), u = "isGuest" in e ? e.isGuest : o?.data?.isGuest, { powerLicense: v, setPowerpackDialog: b } = te(), h = "hasLicense" in e ? e.hasLicense : !!v || n, [c, a] = y({}), [p, f] = y([]), [P, m] = y([]), L = D(
264
+ (j) => c[j] ? c[j] : !1,
265
+ [c]
266
+ ), C = D(
267
+ (j, N) => {
268
+ const Y = { ...c };
269
+ Y[j] = N, a(Y);
200
270
  },
201
- [n]
202
- ), [f, i] = Ie(De, {}), E = C(
203
- (x) => {
204
- const A = f[x];
205
- return Te(A) ? A : s;
271
+ [c]
272
+ ), [k, l] = Ae(Oe, {}), x = D(
273
+ (j) => {
274
+ const N = k[j];
275
+ return Re(N) ? N : t;
206
276
  },
207
- [f, s]
208
- ), [R, D] = h(null), $ = C((x) => {
209
- D(x);
210
- }, []), N = C(() => {
211
- D(null), R && F([]);
277
+ [k, t]
278
+ ), [T, M] = y(null), _ = D((j) => {
279
+ M(j);
280
+ }, []), I = D(() => {
281
+ M(null), T && O([]);
212
282
  }, []);
213
- O(() => {
214
- N();
215
- }, [r.useLocation().pathname]);
216
- const [l, L] = h(null), T = C((x) => {
217
- L(x);
218
- }, []), M = C(() => {
219
- L(null);
220
- }, []), [j, W] = h(null), [Y, F] = h([]), { uriType: K, uri: me, entity: H, getUriEntities: ge, setUri: ve } = je(), [Q] = r.useSearchParams(), _ = Q.get("project"), B = Q.get("type"), U = Q.get("id"), X = Q.get("activity");
221
- O(() => {
222
- if (!_ && !B && !U) return;
223
- const x = !!j && !!_ && !!B && !!U && j.entities[0]?.id !== U;
224
- if (x && ve(""), !x && K === "entity" && H && H.entityType !== "product") {
225
- ge().then((A) => {
226
- if (A.length === 0) return;
227
- const V = A.find((he) => he.uri === me), G = V?.entities?.[0];
228
- if (!V || !G) return;
229
- const ne = G?.projectName || H.projectName || "", se = G.representationId || G.versionId || G.productId || G.taskId || G.folderId;
230
- if (!ne || !se) return;
231
- const ye = {
232
- entityType: H.entityType,
283
+ F(() => {
284
+ I();
285
+ }, [s.useLocation().pathname]);
286
+ const [d, E] = y(null), R = D((j) => {
287
+ E(j);
288
+ }, []), w = D(() => {
289
+ E(null);
290
+ }, []), [g, S] = y(null), [$, O] = y([]), { uriType: H, uri: X, entity: W, getUriEntities: ye, setUri: Pe } = Fe(), [z] = s.useSearchParams(), q = z.get("project"), V = z.get("type"), G = z.get("id"), Z = z.get("activity");
291
+ F(() => {
292
+ if (!q && !V && !G) return;
293
+ const j = !!g && !!q && !!V && !!G && g.entities[0]?.id !== G;
294
+ if (j && Pe(""), !j && H === "entity" && W && W.entityType !== "product") {
295
+ ye().then((N) => {
296
+ if (N.length === 0) return;
297
+ const Y = N.find((we) => we.uri === X), Q = Y?.entities?.[0];
298
+ if (!Y || !Q) return;
299
+ const se = Q?.projectName || W.projectName || "", re = Q.representationId || Q.versionId || Q.productId || Q.taskId || Q.folderId;
300
+ if (!se || !re) return;
301
+ const be = {
302
+ entityType: W.entityType,
233
303
  entities: [
234
304
  {
235
- id: se,
236
- projectName: ne
305
+ id: re,
306
+ projectName: se
237
307
  }
238
308
  ],
239
309
  source: "uri"
240
310
  };
241
- W(ye);
242
- }).catch((A) => {
243
- console.warn("Failed to get URI entities:", A);
311
+ S(be);
312
+ }).catch((N) => {
313
+ console.warn("Failed to get URI entities:", N);
244
314
  });
245
315
  return;
246
316
  }
247
- _ && B && U && W({
248
- entityType: B,
317
+ q && V && G && S({
318
+ entityType: V,
249
319
  entities: [
250
320
  {
251
- id: U,
252
- projectName: _
321
+ id: G,
322
+ projectName: q
253
323
  }
254
324
  ],
255
325
  source: "url"
256
326
  });
257
- }, [_, B, U]), O(() => {
258
- !_ || !B || !U || !X || (F([X]), i({
259
- ...f,
327
+ }, [q, V, G]), F(() => {
328
+ !q || !V || !G || !Z || (O([Z]), l({
329
+ ...k,
260
330
  overview: "feed"
261
331
  }));
262
- }, [_, B, U, X]);
263
- const z = {
332
+ }, [q, V, G, Z]);
333
+ const K = {
264
334
  // open state for the panel by scope
265
- panelOpenByScope: n,
266
- getOpenForScope: v,
267
- setPanelOpen: u,
268
- setPanelOpenByScope: t,
335
+ panelOpenByScope: c,
336
+ getOpenForScope: L,
337
+ setPanelOpen: C,
338
+ setPanelOpenByScope: a,
269
339
  // tab preferences
270
- tabsByScope: f,
271
- getTabForScope: E,
340
+ tabsByScope: k,
341
+ getTabForScope: x,
272
342
  // slide out state
273
- slideOut: R,
274
- openSlideOut: $,
275
- closeSlideOut: N,
343
+ slideOut: T,
344
+ openSlideOut: _,
345
+ closeSlideOut: I,
276
346
  // highlighted activities
277
- highlightedActivities: Y,
278
- setHighlightedActivities: F,
347
+ highlightedActivities: $,
348
+ setHighlightedActivities: O,
279
349
  // PiP state
280
- pip: l,
281
- openPip: T,
282
- closePip: M,
350
+ pip: d,
351
+ openPip: R,
352
+ closePip: w,
283
353
  // entities state
284
- entities: j,
285
- setEntities: W,
286
- feedAnnotations: a,
287
- setFeedAnnotations: g,
288
- feedFrameLinks: S,
289
- setFeedFrameLinks: w,
290
- bundleMode: m,
291
- isGuest: P,
292
- hasLicense: p,
293
- onPowerFeature: y,
294
- ...r
295
- }, Z = ce(z), te = Z.current, oe = Object.keys(z);
296
- return (oe.length !== Object.keys(te).length || oe.some((x) => te[x] !== z[x])) && (Z.current = z), /* @__PURE__ */ k(Ae.Provider, { value: Z.current, children: c });
297
- }, ft = (c) => {
298
- const { setPowerpackDialog: s } = ee();
299
- return O(() => {
300
- s({ addon: "planner", feature: "subtasks" }), c?.onNotFound?.();
301
- }, [s, c.onNotFound]), null;
302
- }, _t = ({ children: c }) => {
303
- const [s, { outdated: o, isLoading: e }] = pe({
354
+ entities: g,
355
+ setEntities: S,
356
+ feedAnnotations: p,
357
+ setFeedAnnotations: f,
358
+ feedFrameLinks: P,
359
+ setFeedFrameLinks: m,
360
+ bundleMode: i,
361
+ isGuest: u,
362
+ hasLicense: h,
363
+ onPowerFeature: b,
364
+ ...s
365
+ }, J = Se(K), ne = J.current, oe = Object.keys(K);
366
+ return (oe.length !== Object.keys(ne).length || oe.some((j) => ne[j] !== K[j])) && (J.current = K), /* @__PURE__ */ A(Me.Provider, { value: J.current, children: r });
367
+ }, bt = (r) => {
368
+ const { setPowerpackDialog: t } = te();
369
+ return F(() => {
370
+ t({ addon: "planner", feature: "subtasks" }), r?.onNotFound?.();
371
+ }, [t, r.onNotFound]), null;
372
+ }, Ht = ({ children: r }) => {
373
+ const [t, { outdated: n, isLoading: e }] = ve({
304
374
  addon: "planner",
305
375
  remote: "planner",
306
376
  module: "SubtasksManager",
307
- fallback: ft
377
+ fallback: bt
308
378
  });
309
- return /* @__PURE__ */ k(
310
- Oe.Provider,
379
+ return /* @__PURE__ */ A(
380
+ Ue.Provider,
311
381
  {
312
382
  value: {
313
- SubtasksManager: e ? void 0 : s,
314
- requiredVersion: o?.required,
383
+ SubtasksManager: e ? void 0 : t,
384
+ requiredVersion: n?.required,
315
385
  isLoading: e
316
386
  },
317
- children: c
387
+ children: r
318
388
  }
319
389
  );
320
- }, Bt = ({ children: c }) => {
321
- const [s, o] = h(!1), [e, r] = h(null), [d, m] = h(null), P = () => {
322
- o(!0), r(null);
323
- }, b = () => {
324
- o(!1), r(null);
325
- }, y = (t, a = null) => {
326
- o((g) => !g), t && !s ? (r(t), m(a)) : (r(null), m(null));
327
- }, p = (t, a = null) => {
328
- r(t), m(a);
329
- }, n = () => {
330
- r(null), m(null);
390
+ }, Yt = ({ children: r }) => {
391
+ const [t, n] = y(!1), [e, s] = y(null), [o, i] = y(null), u = () => {
392
+ n(!0), s(null);
393
+ }, v = () => {
394
+ n(!1), s(null);
395
+ }, b = (a, p = null) => {
396
+ n((f) => !f), a && !t ? (s(a), i(p)) : (s(null), i(null));
397
+ }, h = (a, p = null) => {
398
+ s(a), i(p);
399
+ }, c = () => {
400
+ s(null), i(null);
331
401
  };
332
- return /* @__PURE__ */ k(
333
- Re.Provider,
402
+ return /* @__PURE__ */ A(
403
+ $e.Provider,
334
404
  {
335
405
  value: {
336
- isPanelOpen: s,
406
+ isPanelOpen: t,
337
407
  selectedSetting: e,
338
- highlightedSetting: d,
339
- setHighlightedSetting: m,
340
- openPanel: P,
341
- closePanel: b,
342
- togglePanel: y,
343
- selectSetting: p,
344
- backToMainMenu: n
408
+ highlightedSetting: o,
409
+ setHighlightedSetting: i,
410
+ openPanel: u,
411
+ closePanel: v,
412
+ togglePanel: b,
413
+ selectSetting: h,
414
+ backToMainMenu: c
345
415
  },
346
- children: c
416
+ children: r
347
417
  }
348
418
  );
349
419
  };
350
- function Gt({ children: c }) {
351
- const s = window.location.protocol === "https:" || window.location.hostname === "localhost", o = "documentPictureInPicture" in window && s, [e, r] = h(null), [d, m] = h(null), P = C(() => {
352
- m(null), e != null && (e.close(), r(null));
353
- }, [e, d]), b = C(
354
- async (p, n) => {
355
- if (!o) {
356
- m(J());
420
+ function zt({ children: r }) {
421
+ const t = window.location.protocol === "https:" || window.location.hostname === "localhost", n = "documentPictureInPicture" in window && t, [e, s] = y(null), [o, i] = y(null), u = D(() => {
422
+ i(null), e != null && (e.close(), s(null));
423
+ }, [e, o]), v = D(
424
+ async (h, c) => {
425
+ if (!n) {
426
+ i(ee());
357
427
  return;
358
428
  }
359
429
  if (e != null) {
360
- console.log("pipWindow is already open"), m(J());
430
+ console.log("pipWindow is already open"), i(ee());
361
431
  return;
362
432
  }
363
- const t = await window.documentPictureInPicture.requestWindow({
364
- width: p,
365
- height: n
433
+ const a = await window.documentPictureInPicture.requestWindow({
434
+ width: h,
435
+ height: c
366
436
  });
367
- t.addEventListener("pagehide", () => {
368
- r(null), m(null);
369
- }), r(t), m(J());
437
+ a.addEventListener("pagehide", () => {
438
+ s(null), i(null);
439
+ }), s(a), i(ee());
370
440
  },
371
- [e, d]
441
+ [e, o]
372
442
  );
373
- O(() => {
374
- [...document.styleSheets].forEach((p) => {
443
+ F(() => {
444
+ [...document.styleSheets].forEach((h) => {
375
445
  try {
376
- const n = [...p.cssRules].map((g) => g.cssText).join(""), t = document.createElement("style");
377
- t.textContent = n, e?.document.head.appendChild(t);
378
- const a = document.createElement("style");
379
- a.textContent = `
446
+ const c = [...h.cssRules].map((f) => f.cssText).join(""), a = document.createElement("style");
447
+ a.textContent = c, e?.document.head.appendChild(a);
448
+ const p = document.createElement("style");
449
+ p.textContent = `
380
450
  html, body, .pipRoot {
381
451
  height: 100%;
382
452
  margin: 0;
383
453
  padding: 0;
384
454
  overflow: hidden;
385
- }`, e?.document.head.appendChild(a);
455
+ }`, e?.document.head.appendChild(p);
386
456
  } catch {
387
- const t = document.createElement("link");
388
- if (p.href == null)
457
+ const a = document.createElement("link");
458
+ if (h.href == null)
389
459
  return;
390
- t.rel = "stylesheet", t.type = p.type, t.media = p.media.toString(), t.href = p.href, e?.document.head.appendChild(t);
460
+ a.rel = "stylesheet", a.type = h.type, a.media = h.media.toString(), a.href = h.href, e?.document.head.appendChild(a);
391
461
  }
392
462
  });
393
463
  }, [e]);
394
- const y = q(() => ({
395
- isSupported: o,
464
+ const b = B(() => ({
465
+ isSupported: n,
396
466
  pipWindow: e,
397
- pipId: d,
398
- requestPipWindow: b,
399
- closePipWindow: P
400
- }), [P, o, e, b]);
401
- return /* @__PURE__ */ k(Me.Provider, { value: y, children: c });
467
+ pipId: o,
468
+ requestPipWindow: v,
469
+ closePipWindow: u
470
+ }), [u, n, e, v]);
471
+ return /* @__PURE__ */ A(Ne.Provider, { value: b, children: r });
402
472
  }
403
- const qt = ({
404
- children: c,
405
- projectName: s,
473
+ const Kt = ({
474
+ children: r,
475
+ projectName: t,
406
476
  // utils
407
- toast: o,
477
+ toast: n,
408
478
  ...e
409
479
  }) => {
410
- const { data: r } = ze(
411
- { projectName: s },
412
- { skip: !s }
413
- ), { user: d } = ue();
414
- return /* @__PURE__ */ k(
415
- Fe.Provider,
480
+ const { data: s } = et(
481
+ { projectName: t },
482
+ { skip: !t }
483
+ ), { user: o } = me();
484
+ return /* @__PURE__ */ A(
485
+ Be.Provider,
416
486
  {
417
487
  value: {
418
488
  ...e,
419
- projectName: s,
420
- project: r,
421
- user: d,
422
- toast: o
489
+ projectName: t,
490
+ project: s,
491
+ user: o,
492
+ toast: n
423
493
  },
424
- children: c
494
+ children: r
425
495
  }
426
496
  );
427
- }, Vt = ({ children: c, ...s }) => /* @__PURE__ */ k(Ue.Provider, { value: { ...s }, children: c }), fe = "powerpack-license", mt = () => {
497
+ }, Xt = ({ children: r, ...t }) => /* @__PURE__ */ A(_e.Provider, { value: { ...t }, children: r }), he = "powerpack-license", wt = () => {
428
498
  try {
429
- const c = localStorage.getItem(fe);
430
- return c === null ? null : c === "true";
499
+ const r = localStorage.getItem(he);
500
+ return r === null ? null : r === "true";
431
501
  } catch {
432
502
  return null;
433
503
  }
434
- }, gt = (c) => {
504
+ }, St = (r) => {
435
505
  try {
436
- localStorage.setItem(fe, String(c));
506
+ localStorage.setItem(he, String(r));
437
507
  } catch {
438
508
  }
439
- }, Wt = ({
440
- children: c,
441
- debug: s
509
+ }, Zt = ({
510
+ children: r,
511
+ debug: t
442
512
  }) => {
443
- const [o, e] = h(null), [r, d] = h(null), m = (i) => i !== null && typeof i == "object" && "addon" in i, P = C((i) => {
444
- i === null ? (e(null), d(null)) : m(i) ? (e(null), d(i)) : (d(null), e(i));
445
- }, []), b = (i) => i ? at[i] : null, y = (i) => {
446
- if (!i) return null;
447
- const E = pt[i.addon];
448
- return E ? { ...E, selectedFeature: i.feature } : null;
449
- }, [p, n] = h(!1), [t] = h(mt), [a, g] = h(!0), S = async () => !1, [w, { isLoaded: v, isLoading: u }] = pe({
513
+ const [n, e] = y(null), [s, o] = y(null), i = (l) => l !== null && typeof l == "object" && "addon" in l, u = D((l) => {
514
+ l === null ? (e(null), o(null)) : i(l) ? (e(null), o(l)) : (o(null), e(l));
515
+ }, []), v = (l) => l ? ut[l] : null, b = (l) => {
516
+ if (!l) return null;
517
+ const x = Pt[l.addon];
518
+ return x ? { ...x, selectedFeature: l.feature } : null;
519
+ }, [h, c] = y(!1), [a] = y(wt), [p, f] = y(!0), P = async () => !1, [m, { isLoaded: L, isLoading: C }] = ve({
450
520
  addon: "powerpack",
451
521
  remote: "license",
452
522
  module: "checkPowerLicense",
453
- fallback: S
523
+ fallback: P
454
524
  });
455
- O(() => {
525
+ F(() => {
456
526
  (async () => {
457
- if (s?.powerLicense !== void 0)
458
- console.warn("Using debug power license:", s.powerLicense), n(s.powerLicense), g(!1);
459
- else if (v || !u) {
527
+ if (t?.powerLicense !== void 0)
528
+ console.warn("Using debug power license:", t.powerLicense), c(t.powerLicense), f(!1);
529
+ else if (L || !C) {
460
530
  try {
461
- const E = await w();
462
- n(E), gt(E);
463
- } catch (E) {
464
- console.error("Error checking power license:", E), n(!1);
531
+ const x = await m();
532
+ c(x), St(x);
533
+ } catch (x) {
534
+ console.error("Error checking power license:", x), c(!1);
465
535
  } finally {
466
- g(!1);
536
+ f(!1);
467
537
  }
468
- g(!1);
538
+ f(!1);
469
539
  }
470
540
  })();
471
- }, [s, v, u, w]);
472
- const f = q(
541
+ }, [t, L, C, m]);
542
+ const k = B(
473
543
  () => ({
474
- powerLicense: p,
475
- isLoading: a,
476
- storedLicense: t,
477
- selectedPowerPack: o,
478
- selectedAddon: r,
479
- setPowerpackDialog: P,
480
- powerpackDialog: b(o),
481
- addonDialog: y(r)
544
+ powerLicense: h,
545
+ isLoading: p,
546
+ storedLicense: a,
547
+ selectedPowerPack: n,
548
+ selectedAddon: s,
549
+ setPowerpackDialog: u,
550
+ powerpackDialog: v(n),
551
+ addonDialog: b(s)
482
552
  }),
483
- [p, o, r, P, a, t]
553
+ [h, n, s, u, p, a]
484
554
  );
485
- return /* @__PURE__ */ k($e.Provider, { value: f, children: c });
486
- }, Ht = ({ children: c, skip: s = !1 }) => {
555
+ return /* @__PURE__ */ A(Ge.Provider, { value: k, children: r });
556
+ }, Jt = ({ children: r, skip: t = !1 }) => {
487
557
  const {
488
- data: o = {},
558
+ data: n = {},
489
559
  isLoading: e,
490
- error: r
491
- } = Ye({ full: !0 }, { skip: s }), { data: d, isLoading: m, error: P } = Ke(), {
492
- data: b = [],
493
- isLoading: y,
494
- error: p
495
- } = Xe({}, { skip: s }), n = q(() => b.filter((S) => S.active), [b]), {
496
- data: t,
497
- isLoading: a,
498
- error: g
499
- } = Ze(void 0, { skip: !d?.name });
500
- return /* @__PURE__ */ k(
501
- Ne.Provider,
560
+ error: s
561
+ } = tt({ full: !0 }, { skip: t }), { data: o, isLoading: i, error: u } = nt(), {
562
+ data: v = [],
563
+ isLoading: b,
564
+ error: h
565
+ } = ot({}, { skip: t }), c = B(() => v.filter((P) => P.active), [v]), {
566
+ data: a,
567
+ isLoading: p,
568
+ error: f
569
+ } = st(void 0, { skip: !o?.name });
570
+ return /* @__PURE__ */ A(
571
+ qe.Provider,
502
572
  {
503
573
  value: {
504
- siteInfo: o,
505
- attributes: o?.attributes || [],
506
- user: d,
507
- cloudInfo: t,
574
+ siteInfo: n,
575
+ attributes: n?.attributes || [],
576
+ user: o,
577
+ cloudInfo: a,
508
578
  projects: {
509
- all: b,
510
- active: n
579
+ all: v,
580
+ active: c
511
581
  },
512
582
  isLoading: {
513
583
  siteInfo: e,
514
- user: m,
515
- cloudInfo: a,
516
- projects: y
584
+ user: i,
585
+ cloudInfo: p,
586
+ projects: b
517
587
  },
518
588
  error: {
519
- siteInfo: r,
520
- user: P,
521
- cloudInfo: g,
522
- projects: p
589
+ siteInfo: s,
590
+ user: u,
591
+ cloudInfo: f,
592
+ projects: h
523
593
  }
524
594
  },
525
- children: c
595
+ children: r
526
596
  }
527
597
  );
528
- }, Qt = ({ children: c }) => {
529
- const s = location.pathname, [o, e] = h(nt), r = ["projects", "settings", "manageProjects", "dashboard/tasks"];
530
- O(() => {
531
- r.some((a) => s.startsWith(`/${a}`)) || e("");
532
- }, [s, e]);
533
- const { type: d, entity: m, settings: P } = st(o), b = C(
534
- ({ projectName: t, folderPath: a, taskName: g, productName: S, versionName: w }) => {
535
- const v = rt({ projectName: t, folderPath: a, taskName: g, productName: S, versionName: w });
536
- e(v);
598
+ }, en = ({ children: r }) => {
599
+ const t = location.pathname, [n, e] = y(lt), s = ["projects", "settings", "manageProjects", "dashboard/tasks"];
600
+ F(() => {
601
+ s.some((p) => t.startsWith(`/${p}`)) || e("");
602
+ }, [t, e]);
603
+ const { type: o, entity: i, settings: u } = dt(n), v = D(
604
+ ({ projectName: a, folderPath: p, taskName: f, productName: P, versionName: m }) => {
605
+ const L = ct({ projectName: a, folderPath: p, taskName: f, productName: P, versionName: m });
606
+ e(L);
537
607
  },
538
608
  [e]
539
- ), [y] = Je(), p = C(async () => {
540
- if (d !== "entity" || !o) return [];
609
+ ), [b] = rt(), h = D(async () => {
610
+ if (o !== "entity" || !n) return [];
541
611
  try {
542
- const t = await y({ resolveRequestModel: { uris: [o] } }).unwrap();
543
- return console.log("Resolved entity from URI:", t), t;
544
- } catch (t) {
545
- return console.warn("Failed to resolve URI:", t), [];
612
+ const a = await b({ resolveRequestModel: { uris: [n] } }).unwrap();
613
+ return console.log("Resolved entity from URI:", a), a;
614
+ } catch (a) {
615
+ return console.warn("Failed to resolve URI:", a), [];
546
616
  }
547
- }, [y, o, d]), n = {
548
- uri: o,
549
- uriType: d,
550
- entity: m,
551
- settings: P,
617
+ }, [b, n, o]), c = {
618
+ uri: n,
619
+ uriType: o,
620
+ entity: i,
621
+ settings: u,
552
622
  setUri: e,
553
- setEntityUri: b,
554
- getUriEntities: p
623
+ setEntityUri: v,
624
+ getUriEntities: h
555
625
  };
556
- return /* @__PURE__ */ k(_e.Provider, { value: n, children: c });
557
- }, ie = [
626
+ return /* @__PURE__ */ A(Ve.Provider, { value: c, children: r });
627
+ }, ue = [
558
628
  "representation",
559
629
  "version",
560
630
  "workfile",
561
631
  "product",
562
632
  "task",
563
633
  "folder"
564
- ], vt = "delete-folder-with-children", zt = ({ children: c }) => {
565
- const [s] = et(), [o] = tt(), [e, r] = h(null), [d, m] = h(null), P = C(
566
- (n) => new Promise((t) => m({ payload: n, resolve: t })),
634
+ ], Ct = "delete-folder-with-children", tn = ({ children: r }) => {
635
+ const [t] = at(), [n] = it(), [e, s] = y(null), [o, i] = y(null), u = D(
636
+ (c) => new Promise((a) => i({ payload: c, resolve: a })),
567
637
  []
568
- ), b = C(
569
- async (n, t) => {
570
- if (!n || n.length === 0) {
571
- I.error("No entities selected");
638
+ ), v = D(
639
+ async (c, a) => {
640
+ if (!c || c.length === 0) {
641
+ U.error("No entities selected");
572
642
  return;
573
643
  }
574
- const a = /* @__PURE__ */ new Set(), g = n.filter((l) => !l?.id || a.has(l.id) ? !1 : (a.add(l.id), !0));
575
- if (g.length === 0) {
576
- I.error("No entities found");
644
+ const p = /* @__PURE__ */ new Set(), f = c.filter((d) => !d?.id || p.has(d.id) ? !1 : (p.add(d.id), !0));
645
+ if (f.length === 0) {
646
+ U.error("No entities found");
577
647
  return;
578
648
  }
579
- const S = new Set(g.map((l) => l.id)), w = g.filter((l) => l.entityType === "folder" && l.parentId ? !S.has(l.parentId) : (l.entityType === "task" || l.entityType === "product") && l.folderId ? !S.has(l.folderId) : !0), v = async (l, L) => {
580
- if (l.length === 0) return;
581
- const T = /* @__PURE__ */ new Map();
582
- for (const M of l) {
583
- const j = T.get(M.projectName) || [];
584
- j.push(M), T.set(M.projectName, j);
649
+ const P = new Set(f.map((d) => d.id)), m = f.filter((d) => d.entityType === "folder" && d.parentId ? !P.has(d.parentId) : (d.entityType === "task" || d.entityType === "product") && d.folderId ? !P.has(d.folderId) : !0), L = async (d, E) => {
650
+ if (d.length === 0) return;
651
+ const R = /* @__PURE__ */ new Map();
652
+ for (const w of d) {
653
+ const g = R.get(w.projectName) || [];
654
+ g.push(w), R.set(w.projectName, g);
585
655
  }
586
656
  await Promise.all(
587
- Array.from(T.entries()).map(([M, j]) => {
588
- const Y = [...j].sort(
589
- (F, K) => ie.indexOf(F.entityType) - ie.indexOf(K.entityType)
590
- ).map((F) => ({
657
+ Array.from(R.entries()).map(([w, g]) => {
658
+ const $ = [...g].sort(
659
+ (O, H) => ue.indexOf(O.entityType) - ue.indexOf(H.entityType)
660
+ ).map((O) => ({
591
661
  type: "delete",
592
- entityType: F.entityType,
593
- entityId: F.id,
594
- force: L
662
+ entityType: O.entityType,
663
+ entityId: O.id,
664
+ force: E
595
665
  }));
596
- return s({
597
- operationsRequestModel: { operations: Y },
598
- projectName: M
666
+ return t({
667
+ operationsRequestModel: { operations: $ },
668
+ projectName: w
599
669
  }).unwrap();
600
670
  })
601
671
  );
602
- }, u = async () => {
672
+ }, C = async () => {
603
673
  try {
604
- await v(w, !1), t?.onSuccess?.();
605
- } catch (l) {
606
- throw { message: He(l) || "Failed to delete entities", ...l };
674
+ await L(m, !1), a?.onSuccess?.();
675
+ } catch (d) {
676
+ throw { message: Ke(d) || "Failed to delete entities", ...d };
607
677
  }
608
- }, f = () => v(
609
- w.filter((l) => l.entityType === "folder" || l.entityType === "task"),
678
+ }, k = () => L(
679
+ m.filter((d) => d.entityType === "folder" || d.entityType === "task"),
610
680
  !0
611
- ), i = w.filter((l) => l.entityType === "folder");
612
- let E = [];
613
- if (i.length > 0) {
614
- const l = /* @__PURE__ */ new Map();
615
- for (const L of i) {
616
- const T = l.get(L.projectName) || [];
617
- T.push(L), l.set(L.projectName, T);
681
+ ), l = m.filter((d) => d.entityType === "folder");
682
+ let x = [];
683
+ if (l.length > 0) {
684
+ const d = /* @__PURE__ */ new Map();
685
+ for (const E of l) {
686
+ const R = d.get(E.projectName) || [];
687
+ R.push(E), d.set(E.projectName, R);
618
688
  }
619
689
  try {
620
- E = (await Promise.all(
621
- Array.from(l.entries()).map(
622
- ([T, M]) => o({
623
- projectName: T,
624
- folderIds: M.map((j) => j.id)
690
+ x = (await Promise.all(
691
+ Array.from(d.entries()).map(
692
+ ([R, w]) => n({
693
+ projectName: R,
694
+ folderIds: w.map((g) => g.id)
625
695
  }).unwrap()
626
696
  )
627
697
  )).flat();
628
- } catch (L) {
629
- console.warn("Failed to fetch folder delete info, falling back to local data", L);
698
+ } catch (E) {
699
+ console.warn("Failed to fetch folder delete info, falling back to local data", E);
630
700
  }
631
701
  }
632
- const R = it(i, E), D = w.filter((l) => l.entityType === "product").length;
633
- D > 0 && R.push(
634
- D > 1 ? "Deleting these products also deletes all their versions" : "Deleting this product also deletes all its versions"
702
+ const T = pt(l, x), M = m.filter((d) => d.entityType === "product").length;
703
+ M > 0 && T.push(
704
+ M > 1 ? "Deleting these products also deletes all their versions" : "Deleting this product also deletes all its versions"
635
705
  );
636
- const $ = lt(w), N = w.length === 1 ? w[0] : void 0;
637
- r({
706
+ const _ = ft(m), I = m.length === 1 ? m[0] : void 0;
707
+ s({
638
708
  payload: {
639
- entityLabel: $,
640
- childrenDetails: R,
641
- expectedCounts: ct(w, E),
642
- expectedName: N && (N.label || N.name || N.id)
709
+ entityLabel: _,
710
+ childrenDetails: T,
711
+ expectedCounts: mt(m, x),
712
+ expectedName: I && (I.label || I.name || I.id)
643
713
  },
644
- accept: u,
645
- recover: async (l) => We(l).includes(vt) ? await P({
646
- entityLabel: $,
647
- message: `Are you really sure you want to delete ${$} and all of its dependencies? This cannot be undone. (NOT RECOMMENDED)`,
714
+ accept: C,
715
+ recover: async (d) => ze(d).includes(Ct) ? await u({
716
+ entityLabel: _,
717
+ message: `Are you really sure you want to delete ${_} and all of its dependencies? This cannot be undone. (NOT RECOMMENDED)`,
648
718
  childrenDetails: [],
649
719
  expectedCounts: {},
650
720
  expectedName: "force delete",
651
721
  deleteLabel: "Force delete"
652
- }) ? (await f(), t?.onSuccess?.(), "recovered") : "cancelled" : "unhandled"
722
+ }) ? (await k(), a?.onSuccess?.(), "recovered") : "cancelled" : "unhandled"
653
723
  });
654
724
  },
655
- [s, o, P]
656
- ), y = C(async () => {
725
+ [t, n, u]
726
+ ), b = D(async () => {
657
727
  if (!e) return;
658
- const { payload: n, accept: t, recover: a } = e;
659
- r(null);
660
- const g = n.entityLabel, S = I.loading(`Deleting ${g}...`, { autoClose: !1 }), w = () => I.update(S, {
661
- render: `${g} deleted`,
728
+ const { payload: c, accept: a, recover: p } = e;
729
+ s(null);
730
+ const f = c.entityLabel, P = U.loading(`Deleting ${f}...`, { autoClose: !1 }), m = () => U.update(P, {
731
+ render: `${f} deleted`,
662
732
  type: "success",
663
733
  autoClose: 5e3,
664
734
  isLoading: !1
665
735
  });
666
736
  try {
667
- await t(), w();
668
- } catch (v) {
669
- let u = v;
737
+ await a(), m();
738
+ } catch (L) {
739
+ let C = L;
670
740
  try {
671
- const i = await a(v);
672
- if (i === "recovered") return w();
673
- if (i === "cancelled")
674
- return I.update(S, {
675
- render: `${g} was not deleted`,
741
+ const l = await p(L);
742
+ if (l === "recovered") return m();
743
+ if (l === "cancelled")
744
+ return U.update(P, {
745
+ render: `${f} was not deleted`,
676
746
  type: "info",
677
747
  autoClose: 5e3,
678
748
  isLoading: !1
679
749
  });
680
- } catch (i) {
681
- u = i;
750
+ } catch (l) {
751
+ C = l;
682
752
  }
683
- const f = typeof u == "string" ? u : u?.message || u?.error || `Error deleting ${g}`;
684
- I.update(S, {
685
- render: f,
753
+ const k = typeof C == "string" ? C : C?.message || C?.error || `Error deleting ${f}`;
754
+ U.update(P, {
755
+ render: k,
686
756
  type: "error",
687
757
  autoClose: 5e3,
688
758
  isLoading: !1
689
759
  });
690
760
  }
691
- }, [e]), p = q(() => ({ deleteEntities: b }), [b]);
692
- return /* @__PURE__ */ le(Be.Provider, { value: p, children: [
693
- c,
694
- e && /* @__PURE__ */ k(
695
- ae,
761
+ }, [e]), h = B(() => ({ deleteEntities: v }), [v]);
762
+ return /* @__PURE__ */ pe(Qe.Provider, { value: h, children: [
763
+ r,
764
+ e && /* @__PURE__ */ A(
765
+ ie,
696
766
  {
697
767
  payload: e.payload,
698
- onConfirm: y,
699
- onCancel: () => r(null)
768
+ onConfirm: b,
769
+ onCancel: () => s(null)
700
770
  }
701
771
  ),
702
- d && /* @__PURE__ */ k(
703
- ae,
772
+ o && /* @__PURE__ */ A(
773
+ ie,
704
774
  {
705
- payload: d.payload,
775
+ payload: o.payload,
706
776
  onConfirm: () => {
707
- m(null), d.resolve(!0);
777
+ i(null), o.resolve(!0);
708
778
  },
709
779
  onCancel: () => {
710
- m(null), d.resolve(!1);
780
+ i(null), o.resolve(!1);
711
781
  }
712
782
  }
713
783
  )
714
784
  ] });
715
- }, yt = "powerpack", ht = "tableExport", Pt = "TableExportApp", bt = "1.6.9", Yt = ({ children: c }) => {
716
- const [s, o] = h(null), [, e] = dt(), { powerLicense: r, setPowerpackDialog: d } = ee(), { modules: m } = Ge(), P = m.some(
717
- (t) => t.addonName === yt && t.modules[ht]?.includes(Pt)
718
- ), b = !!r && P, y = C((t) => (o(t), () => o((a) => a === t ? null : a)), []), p = C(
719
- (t) => {
720
- if (!r) return d("tableExport");
721
- if (!P)
722
- return void I.error("Update to Power Pack " + bt + " to export tables");
723
- e((a) => (a.set(qe, t), a));
785
+ }, Et = "powerpack", kt = "tableExport", xt = "TableExportApp", Lt = "1.6.9", nn = ({ children: r }) => {
786
+ const [t, n] = y(null), [, e] = gt(), { powerLicense: s, isLoading: o, setPowerpackDialog: i } = te(), { modules: u } = We(), [v, b] = y(null), h = u.some(
787
+ (P) => P.addonName === Et && P.modules[kt]?.includes(xt)
788
+ ), c = (!!s || o) && h, a = D((P) => (n(P), () => n((m) => m === P ? null : m)), []), p = D(
789
+ (P) => {
790
+ if (o) return b(P);
791
+ if (!s) return i("tableExport");
792
+ if (!h)
793
+ return void U.error("Update to Power Pack " + Lt + " to export tables");
794
+ e((m) => (m.set(He, P), m));
724
795
  },
725
- [r, P, d, e]
726
- ), n = q(
727
- () => ({ source: s, isAvailable: b, openExport: p, registerSource: y }),
728
- [s, b, p, y]
796
+ [o, s, h, i, e]
797
+ );
798
+ F(() => {
799
+ !v || o || (b(null), p(v));
800
+ }, [v, o, p]);
801
+ const f = B(
802
+ () => ({ source: t, isAvailable: c, openExport: p, registerSource: a }),
803
+ [t, c, p, a]
729
804
  );
730
- return /* @__PURE__ */ k(Ve.Provider, { value: n, children: c });
805
+ return /* @__PURE__ */ A(Ye.Provider, { value: f, children: r });
731
806
  };
732
807
  export {
733
- Ue as AddonContext,
734
- Fe as AddonProjectContext,
735
- qt as AddonProjectProvider,
736
- Vt as AddonProvider,
737
- Be as DeleteEntitiesContext,
738
- zt as DeleteEntitiesProvider,
739
- Ae as DetailsPanelContext,
740
- Nt as DetailsPanelProvider,
741
- Zt as EntityUpdatesContext,
742
- Qo as EntityUpdatesProvider,
743
- zo as FORCE_AUTO_SYNC,
744
- Ne as GlobalContext,
745
- Ht as GlobalProvider,
746
- Jt as MenuContext,
747
- Go as MenuProvider,
748
- Me as PiPContext,
749
- Gt as PiPProvider,
750
- eo as PiPWrapper,
751
- $e as PowerpackContext,
752
- Wt as PowerpackProvider,
753
- to as ProjectContext,
754
- Vo as ProjectContextProvider,
755
- oo as ProjectFoldersContext,
756
- Wo as ProjectFoldersContextProvider,
757
- xe as RemoteModulesContext,
758
- $t as RemoteModulesProvider,
759
- Re as SettingsPanelContext,
760
- Bt as SettingsPanelProvider,
761
- no as SocketContext,
762
- so as SocketProvider,
763
- Oe as SubtasksModulesContext,
764
- _t as SubtasksModulesProvider,
765
- qe as TABLE_EXPORT_SEARCH_PARAM,
766
- De as TABS_BY_SCOPE_KEY,
767
- Ve as TableExportContext,
768
- Yt as TableExportProvider,
769
- ro as ThumbnailUploadContext,
770
- $o as ThumbnailUploadProvider,
771
- _e as URIContext,
772
- Qt as URIProvider,
773
- Fo as URL_PARAM_ID,
774
- pt as addonConfigs,
775
- ao as getActivityFrameLink,
776
- io as getAutoSyncForTopic,
777
- lo as getUpdateType,
778
- co as isAddonDetailsPanelTab,
779
- uo as isDeletableEntityType,
780
- Te as isDetailsPanelTab,
781
- po as matchesProject,
782
- fo as matchesTopic,
783
- _o as powerpackFeatureOrder,
784
- at as powerpackFeatures,
785
- mo as setDetailsPanelTabForScope,
786
- go as toggleSyncAll,
787
- vo as useAddonContext,
788
- yo as useAddonProjectContext,
789
- ho as useAutoSyncSettings,
790
- Po as useDeleteEntitiesContext,
791
- bo as useDeleteEntitiesContextOptional,
792
- wo as useDetailsPanelContext,
793
- ue as useGlobalContext,
794
- Eo as useMenuContext,
795
- So as useOptionalProjectContext,
796
- Co as useOptionalProjectFoldersContext,
797
- xo as usePiPWindow,
798
- ee as usePowerpack,
799
- ko as useProjectContext,
800
- Lo as useProjectFoldersContext,
801
- Ge as useRemoteModules,
802
- Io as useScopedDetailsPanel,
803
- Do as useSettingsPanel,
804
- To as useSocketContext,
805
- jo as useSubtasksModulesContext,
806
- Ao as useSyncUpdates,
807
- Oo as useTableExportContext,
808
- Ro as useThumbnailUploadContext,
809
- je as useURIContext
808
+ _e as AddonContext,
809
+ Be as AddonProjectContext,
810
+ Kt as AddonProjectProvider,
811
+ Xt as AddonProvider,
812
+ Qe as DeleteEntitiesContext,
813
+ tn as DeleteEntitiesProvider,
814
+ Me as DetailsPanelContext,
815
+ Wt as DetailsPanelProvider,
816
+ rn as EntityUpdatesContext,
817
+ an as EntityUpdatesProvider,
818
+ ln as FORCE_AUTO_SYNC,
819
+ qe as GlobalContext,
820
+ Jt as GlobalProvider,
821
+ dn as MenuContext,
822
+ Xn as MenuProvider,
823
+ Ne as PiPContext,
824
+ zt as PiPProvider,
825
+ cn as PiPWrapper,
826
+ Ge as PowerpackContext,
827
+ Zt as PowerpackProvider,
828
+ un as ProjectContext,
829
+ Jn as ProjectContextProvider,
830
+ pn as ProjectFoldersContext,
831
+ eo as ProjectFoldersContextProvider,
832
+ Ie as RemoteModulesContext,
833
+ Qt as RemoteModulesProvider,
834
+ $e as SettingsPanelContext,
835
+ Yt as SettingsPanelProvider,
836
+ fn as SocketContext,
837
+ mn as SocketProvider,
838
+ Ue as SubtasksModulesContext,
839
+ Ht as SubtasksModulesProvider,
840
+ He as TABLE_EXPORT_SEARCH_PARAM,
841
+ Oe as TABS_BY_SCOPE_KEY,
842
+ Ye as TableExportContext,
843
+ nn as TableExportProvider,
844
+ gn as ThumbnailUploadContext,
845
+ Hn as ThumbnailUploadProvider,
846
+ Ve as URIContext,
847
+ en as URIProvider,
848
+ Qn as URL_PARAM_ID,
849
+ Pt as addonConfigs,
850
+ vn as getActivityFrameLink,
851
+ hn as getAutoSyncForTopic,
852
+ yn as getUpdateType,
853
+ Pn as isAddonDetailsPanelTab,
854
+ bn as isDeletableEntityType,
855
+ Re as isDetailsPanelTab,
856
+ wn as matchesProject,
857
+ Sn as matchesTopic,
858
+ zn as powerpackFeatureOrder,
859
+ ut as powerpackFeatures,
860
+ Cn as setDetailsPanelTabForScope,
861
+ En as toggleSyncAll,
862
+ kn as useAddonContext,
863
+ xn as useAddonProjectContext,
864
+ Ln as useAutoSyncSettings,
865
+ Dn as useDeleteEntitiesContext,
866
+ In as useDeleteEntitiesContextOptional,
867
+ jn as useDetailsPanelContext,
868
+ me as useGlobalContext,
869
+ Tn as useMenuContext,
870
+ An as useOptionalProjectContext,
871
+ On as useOptionalProjectFoldersContext,
872
+ Rn as usePiPWindow,
873
+ te as usePowerpack,
874
+ Fn as useProjectContext,
875
+ Mn as useProjectFoldersContext,
876
+ We as useRemoteModules,
877
+ Un as useScopedDetailsPanel,
878
+ $n as useSettingsPanel,
879
+ Nn as useSocketContext,
880
+ Bn as useSubtasksModulesContext,
881
+ _n as useSyncUpdates,
882
+ Gn as useTableExportContext,
883
+ qn as useThumbnailUploadContext,
884
+ Fe as useURIContext
810
885
  };