@ynput/ayon-frontend-shared 0.6.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 (89) hide show
  1. package/dist/ContextMenu.es.js +34 -16
  2. package/dist/DetailsPanel.es.js +292 -298
  3. package/dist/Feed.es.js +179 -50
  4. package/dist/ListTable.es.js +32 -35
  5. package/dist/NewEntity.es.js +1256 -11
  6. package/dist/ProjectTreeTable.es.js +4451 -2965
  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/chunks/Actions.es.js +9 -4
  11. package/dist/chunks/ColumnDropIndicator.es.js +174 -328
  12. package/dist/chunks/ColumnDropIndicator.styled.es.js +281 -0
  13. package/dist/chunks/ColumnHeaderMenuUI.es.js +52 -0
  14. package/dist/chunks/ContextMenuContextInstance.es.js +12 -0
  15. package/dist/chunks/DeleteEntitiesConfirmDialog.es.js +229 -0
  16. package/dist/chunks/DeleteEntitiesContextInstance.es.js +827 -0
  17. package/dist/chunks/EmptyPlaceholder.es.js +4 -4
  18. package/dist/chunks/EntityPath.es.js +58 -53
  19. package/dist/chunks/EntityPickerDialog.es.js +24 -20
  20. package/dist/chunks/EntityTooltip.es.js +20 -13
  21. package/dist/chunks/EntityUpdatesContext.es.js +38 -96
  22. package/dist/chunks/Feed.es.js +1495 -1439
  23. package/dist/chunks/FilterErrorActions.es.js +25 -229
  24. package/dist/chunks/Menu.es.js +21 -17
  25. package/dist/chunks/MenuContext.es.js +14 -65
  26. package/dist/chunks/MenuItem.es.js +34 -24
  27. package/dist/chunks/MetaWidget.es.js +2835 -4301
  28. package/dist/chunks/NewEntityContextInstance.es.js +11 -0
  29. package/dist/chunks/PlayableIcon.es.js +1532 -1594
  30. package/dist/chunks/ProjectContext.es.js +102 -66
  31. package/dist/chunks/RepresentationsList.es.js +1 -1
  32. package/dist/chunks/ReviewablesSelector.es.js +457 -458
  33. package/dist/chunks/SimpleForm.es.js +9 -9
  34. package/dist/chunks/SimpleTable.es.js +15 -13
  35. package/dist/chunks/Slicer.es.js +163 -154
  36. package/dist/chunks/TableSettingsFallback.es.js +25 -13
  37. package/dist/chunks/ThumbnailSimple.es.js +150 -261
  38. package/dist/chunks/VersionUploadContextInstance.es.js +12 -0
  39. package/dist/chunks/VideoPlayer.es.js +24 -28
  40. package/dist/chunks/Watchers.es.js +384 -389
  41. package/dist/chunks/entityDefinitions.es.js +2 -350
  42. package/dist/chunks/extractVersionFromFilename.es.js +28 -0
  43. package/dist/chunks/getBundleMode.es.js +61 -16
  44. package/dist/chunks/getUris.es.js +737 -712
  45. package/dist/chunks/searchTerms.es.js +57 -56
  46. package/dist/chunks/useAttributeEnums.es.js +4 -4
  47. package/dist/chunks/useCreateContextMenu.es.js +66 -90
  48. package/dist/chunks/useHierarchySelection.es.js +24 -0
  49. package/dist/chunks/useLoadModule.es.js +74 -0
  50. package/dist/chunks/useQueryArgumentChangeLoading.es.js +11 -0
  51. package/dist/chunks/versionUploadHelpers.es.js +16 -42
  52. package/dist/chunks/viewUpdateHelper.es.js +67 -50
  53. package/dist/components.es.js +1425 -999
  54. package/dist/context.es.js +791 -80
  55. package/dist/hooks.es.js +115 -120
  56. package/dist/index.es.js +19 -23
  57. package/dist/types/Actions.d.ts +7 -7
  58. package/dist/types/ContextMenu.d.ts +11 -8
  59. package/dist/types/DetailsPanel.d.ts +102 -9
  60. package/dist/types/EntityPickerDialog.d.ts +7 -7
  61. package/dist/types/Feed.d.ts +11 -8
  62. package/dist/types/ListTable.d.ts +7 -7
  63. package/dist/types/NewEntity.d.ts +16 -10
  64. package/dist/types/ProjectTreeTable.d.ts +22 -115
  65. package/dist/types/RepresentationsList.d.ts +7 -7
  66. package/dist/types/SimpleTable.d.ts +11 -8
  67. package/dist/types/Slicer.d.ts +10 -7
  68. package/dist/types/Views.d.ts +10 -7
  69. package/dist/types/api.d.ts +132 -120
  70. package/dist/types/components.d.ts +13 -8
  71. package/dist/types/context.d.ts +56 -16
  72. package/dist/types/hooks.d.ts +7 -7
  73. package/dist/types/index.d.ts +7 -7
  74. package/dist/types/util.d.ts +12 -7
  75. package/dist/util.es.js +72 -71
  76. package/package.json +1 -1
  77. package/dist/chunks/DeleteEntitiesContext.es.js +0 -748
  78. package/dist/chunks/DetailsPanelContext.es.js +0 -155
  79. package/dist/chunks/GlobalContext.es.js +0 -52
  80. package/dist/chunks/NewEntityContext.es.js +0 -1242
  81. package/dist/chunks/ProjectFoldersContext.es.js +0 -134
  82. package/dist/chunks/ProjectFoldersContextInstance.es.js +0 -7
  83. package/dist/chunks/VersionUploadContext.es.js +0 -232
  84. package/dist/chunks/ViewsContext.es.js +0 -878
  85. package/dist/chunks/uriUtils.es.js +0 -48
  86. package/dist/chunks/useColumnDragRestriction.es.js +0 -158
  87. package/dist/chunks/useLocalStorage.es.js +0 -355
  88. package/dist/chunks/useSessionStorage.es.js +0 -61
  89. /package/dist/{useCreateContextMenu.css → ContextMenuContextInstance.css} +0 -0
@@ -0,0 +1,827 @@
1
+ import { jsx as l, jsxs as k } from "react/jsx-runtime";
2
+ import W, { createContext as g, useContext as d, useRef as S, useState as b, useEffect as v, useCallback as O, useMemo as re, forwardRef as M } from "react";
3
+ import { Button as $, theme as H, Icon as ae, Dialog as ie, InputText as K } from "@ynput/ayon-react-components";
4
+ import u from "styled-components";
5
+ import A from "clsx";
6
+ import { a as ce, K as J } from "./platform.es.js";
7
+ import { debounce as B, isEqual as le } from "lodash";
8
+ import { confirmDialog as de } from "primereact/confirmdialog";
9
+ import { toast as z } from "react-toastify";
10
+ import "uuid";
11
+ import { be as T, a as ue } from "./searchTerms.es.js";
12
+ import { cL as pe } from "./getUris.es.js";
13
+ import "@module-federation/enhanced/runtime";
14
+ import "./ContextMenuContextInstance.es.js";
15
+ import { createPortal as ge } from "react-dom";
16
+ import { Dialog as fe } from "primereact/dialog";
17
+ import he, { ReadyState as me } from "react-use-websocket";
18
+ import "react-redux";
19
+ import "semver";
20
+ const we = g(void 0), kt = () => d(we) || {}, ve = g({
21
+ isLoading: !0,
22
+ modules: [],
23
+ remotesInitialized: !1
24
+ }), Dt = () => {
25
+ const e = d(ve);
26
+ if (e === void 0)
27
+ throw new Error("useRemoteModules must be used within a RemoteModulesProvider");
28
+ return e;
29
+ }, xe = g(void 0), Rt = () => {
30
+ const e = d(xe);
31
+ if (e === void 0)
32
+ throw new Error("usePowerpack must be used within a PowerpackProvider");
33
+ return e;
34
+ }, Se = g(void 0), At = () => {
35
+ const e = d(Se);
36
+ if (e === void 0)
37
+ throw new Error("useURIContext must be used within a URIProvider");
38
+ return e;
39
+ }, N = (e, t = null) => {
40
+ if (!e) return t;
41
+ try {
42
+ return JSON.parse(e);
43
+ } catch {
44
+ return t;
45
+ }
46
+ }, Nt = (e, t) => {
47
+ if (typeof window > "u") return t;
48
+ try {
49
+ return N(sessionStorage.getItem(e), t);
50
+ } catch {
51
+ return t;
52
+ }
53
+ }, _t = (e, t) => {
54
+ if (!(typeof window > "u"))
55
+ try {
56
+ sessionStorage.setItem(e, JSON.stringify(t)), window.dispatchEvent(new CustomEvent("session-storage", { detail: { key: e } }));
57
+ } catch (o) {
58
+ console.error(o);
59
+ }
60
+ };
61
+ function be(e, t) {
62
+ const o = S(t);
63
+ o.current = t;
64
+ const [i, n] = b(() => typeof window > "u" ? t : N(sessionStorage.getItem(e), t));
65
+ v(() => {
66
+ const s = sessionStorage.getItem(e);
67
+ n(N(s, o.current)), s || sessionStorage.setItem(e, JSON.stringify(o.current));
68
+ function a(c) {
69
+ if ("key" in c && c.key && c.key !== e) return;
70
+ const p = c.detail?.key;
71
+ if (p && p !== e) return;
72
+ const f = sessionStorage.getItem(e);
73
+ n(N(f, o.current));
74
+ }
75
+ return window.addEventListener("session-storage", a), window.addEventListener("storage", a), () => {
76
+ window.removeEventListener("session-storage", a), window.removeEventListener("storage", a);
77
+ };
78
+ }, [e]);
79
+ const r = O(
80
+ (s) => {
81
+ try {
82
+ n((a) => {
83
+ const c = typeof s == "function" ? s(a) : s;
84
+ return sessionStorage.setItem(e, JSON.stringify(c)), typeof window < "u" && window.dispatchEvent(new CustomEvent("session-storage", { detail: { key: e } })), c;
85
+ });
86
+ } catch (a) {
87
+ console.error(a);
88
+ }
89
+ },
90
+ [e]
91
+ );
92
+ return [i, r];
93
+ }
94
+ const _ = (e, t = null) => {
95
+ if (!e) return t;
96
+ try {
97
+ return JSON.parse(e);
98
+ } catch {
99
+ return t;
100
+ }
101
+ }, ye = (e, t) => {
102
+ if (typeof window > "u") return t;
103
+ try {
104
+ return _(localStorage.getItem(e), t);
105
+ } catch {
106
+ return t;
107
+ }
108
+ }, Ce = (e, t) => {
109
+ if (!(typeof window > "u"))
110
+ try {
111
+ localStorage.setItem(e, JSON.stringify(t)), window.dispatchEvent(new Event("storage"));
112
+ } catch (o) {
113
+ console.error(o);
114
+ }
115
+ };
116
+ function Ot(e, t) {
117
+ const o = S(t);
118
+ o.current = t;
119
+ const [i, n] = b(() => {
120
+ const s = localStorage.getItem(e);
121
+ return _(s, t);
122
+ });
123
+ v(() => {
124
+ const s = localStorage.getItem(e);
125
+ n(_(s, o.current)), s || localStorage.setItem(e, JSON.stringify(o.current));
126
+ function a(c) {
127
+ if (c.key && c.key !== e) return;
128
+ const p = localStorage.getItem(e);
129
+ n(_(p, o.current));
130
+ }
131
+ return window.addEventListener("storage", a), () => {
132
+ window.removeEventListener("storage", a);
133
+ };
134
+ }, [e]);
135
+ const r = O(
136
+ (s) => {
137
+ try {
138
+ n((a) => {
139
+ const c = typeof s == "function" ? s(a) : s;
140
+ return localStorage.setItem(e, JSON.stringify(c)), typeof window < "u" && setTimeout(() => {
141
+ window.dispatchEvent(new Event("storage"));
142
+ }, 0), c;
143
+ });
144
+ } catch (a) {
145
+ console.error(a);
146
+ }
147
+ },
148
+ [e]
149
+ );
150
+ return [i, r];
151
+ }
152
+ const Pe = g(void 0), Ee = ["feed", "subtasks", "details", "files"], Ie = (e) => typeof e == "string" && Ee.includes(e), Lt = (e) => {
153
+ const { startFrame: t, endFrame: o } = e.activityData || {}, i = e.origin?.id ?? e.entityId;
154
+ if (!Number.isSafeInteger(t) || !i) return null;
155
+ const n = t, r = Number.isSafeInteger(o) ? Math.max(n, o) : n;
156
+ return { entityId: i, startFrame: n, endFrame: r };
157
+ }, Te = () => {
158
+ const e = d(Pe);
159
+ if (e === void 0)
160
+ throw new Error("useDetailsPanel must be used within a DetailsPanelProvider");
161
+ return e;
162
+ }, j = "details/tabs-by-scope", jt = (e, t) => {
163
+ const o = ye(j, {});
164
+ Ce(j, { ...o, [e]: t });
165
+ }, Mt = (e) => {
166
+ const { getOpenForScope: t, setPanelOpen: o, getTabForScope: i } = Te(), [n, r] = be(j, {}), s = n[e], a = Ie(s) ? s : i(e), c = O(
167
+ (f) => {
168
+ r((y) => ({ ...y, [e]: f }));
169
+ },
170
+ [e, r]
171
+ ), p = a === "feed";
172
+ return {
173
+ isOpen: t(e),
174
+ setOpen: (f) => o(e, f),
175
+ currentTab: a,
176
+ setTab: c,
177
+ isFeed: p
178
+ };
179
+ }, ke = g(
180
+ void 0
181
+ ), $t = () => {
182
+ const e = d(ke);
183
+ if (!e)
184
+ throw new Error("useSubtasksModulesContext must be used within a SubtasksModulesProvider");
185
+ return e;
186
+ }, De = g({}), Ft = () => {
187
+ const e = d(De);
188
+ if (!e)
189
+ throw new Error("useThumbnailUploadContext must be used within a ThumbnailUploadProvider");
190
+ return e;
191
+ }, Re = g(void 0), Ut = () => {
192
+ const e = d(Re);
193
+ if (e === void 0)
194
+ throw new Error("useSettingsPanel must be used within a SettingsPanelProvider");
195
+ return e;
196
+ }, Ae = g(void 0);
197
+ function Ne() {
198
+ const e = d(Ae);
199
+ if (e === void 0)
200
+ throw new Error("usePiPWindow must be used within a PiPContext");
201
+ return e;
202
+ }
203
+ function _e({ pipWindow: e, children: t }) {
204
+ return ge(t, e.document.body);
205
+ }
206
+ const Oe = u(fe)`
207
+ width: 25vw;
208
+ height: 70vh;
209
+ border: solid 1px var(--md-sys-color-outline-variant);
210
+ border-radius: 10px;
211
+ overflow: hidden;
212
+ box-shadow: 0 0 1px 1px #000, 0 11px 15px -7px #0003, 0 24px 38px 3px #00000024,
213
+ 0 9px 46px 8px #0000001f;
214
+ &:hover {
215
+ .close {
216
+ opacity: 1;
217
+ }
218
+ }
219
+ `, Le = u($)`
220
+ width: 26px;
221
+ height: 26px;
222
+ margin-left: auto;
223
+
224
+ .icon {
225
+ font-size: 15px;
226
+ font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 200, 'opsz' 20;
227
+ }
228
+ background-color: unset !important;
229
+ opacity: 0;
230
+ border-radius: 100%;
231
+ transition: opacity 400ms, background-color 400ms;
232
+ &:hover {
233
+ background-color: #3d3e40;
234
+ }
235
+ `, Vt = ({ children: e }) => {
236
+ const { pipWindow: t, pipId: o, isSupported: i, closePipWindow: n } = Ne(), r = o && W.isValidElement(e) ? W.cloneElement(e, { id: o }) : e;
237
+ return !i && o ? /* @__PURE__ */ l(
238
+ Oe,
239
+ {
240
+ header: /* @__PURE__ */ l(Le, { icon: "close", className: "close", onClick: n }),
241
+ headerStyle: {
242
+ padding: 4,
243
+ backgroundColor: "#202124",
244
+ border: "none",
245
+ height: 33
246
+ },
247
+ contentStyle: { overflow: "hidden", height: "revert-layer", padding: 8, border: "none" },
248
+ maskStyle: { pointerEvents: "none", userSelect: "none", backgroundColor: "unset" },
249
+ visible: !0,
250
+ closeOnEscape: !1,
251
+ pt: {
252
+ closeButton: {
253
+ style: { display: "none" }
254
+ },
255
+ footer: {
256
+ style: { padding: 0, border: "none" }
257
+ }
258
+ },
259
+ onHide: n,
260
+ position: "right",
261
+ children: r
262
+ }
263
+ ) : t && /* @__PURE__ */ l(_e, { pipWindow: t, children: /* @__PURE__ */ l("div", { className: "pipRoot", children: r }) });
264
+ }, je = g(void 0), Wt = () => {
265
+ const e = d(je);
266
+ if (!e)
267
+ throw new Error("useAddonProjectContext must be used within a AddonProjectContext");
268
+ return e;
269
+ }, Me = g(void 0), Jt = () => {
270
+ const e = d(Me);
271
+ if (!e)
272
+ throw new Error("useAddonContext must be used within a AddonContext");
273
+ return e;
274
+ }, $e = g(void 0), Bt = () => {
275
+ const e = d($e);
276
+ if (e === void 0)
277
+ throw new Error("useMenuContext must be used within a MenuProvider");
278
+ return e;
279
+ }, Fe = () => /* @__PURE__ */ k("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
280
+ "Refresh to see latest changes.",
281
+ /* @__PURE__ */ l($, { onClick: () => window.location.reload(), variant: "filled", children: "Refresh" })
282
+ ] }), q = g(void 0), zt = () => {
283
+ const e = d(q);
284
+ if (e === void 0)
285
+ throw new Error("useSocketContext must be used within a SocketProvider");
286
+ return e;
287
+ }, Ue = window.location.protocol.replace("http", "ws"), Ve = `${Ue}//${window.location.host}/ws`, Ht = ({
288
+ children: e,
289
+ userName: t,
290
+ projectName: o,
291
+ dispatch: i
292
+ }) => {
293
+ const [n, r] = b(!1), [s, a] = b([]), [c] = pe(), p = S(!1);
294
+ v(() => {
295
+ p.current = n;
296
+ }, [n]);
297
+ const f = {
298
+ shouldReconnect: () => !t || !localStorage.getItem("accessToken") ? !1 : (c({ full: !1 }).unwrap(), !0)
299
+ }, { sendMessage: y, readyState: C, getWebSocket: P } = he(
300
+ Ve,
301
+ f,
302
+ !!t
303
+ ), m = () => {
304
+ y(
305
+ JSON.stringify({
306
+ topic: "auth",
307
+ token: localStorage.getItem("accessToken"),
308
+ subscribe: s,
309
+ project: o
310
+ })
311
+ );
312
+ };
313
+ v(() => {
314
+ console.debug("Topics changed", s), m();
315
+ }, [s, o]);
316
+ const D = S(s);
317
+ D.current = s;
318
+ const h = re(
319
+ () => B((w) => {
320
+ le(D.current, w) || (console.log("WS: Subscriptions changed"), a(w));
321
+ }, 200),
322
+ []
323
+ );
324
+ v(() => (T.setOnSubscriptionsChange((w) => h(w)), h(T.getSubscriptions("")), () => {
325
+ T.setOnSubscriptionsChange(null), h.cancel();
326
+ }), [h]);
327
+ const [R, X] = b(!1), [F, Z] = b(!1);
328
+ v(() => {
329
+ R && !F && (z.warning(/* @__PURE__ */ l(Fe, {}), {
330
+ autoClose: !1,
331
+ closeButton: !1
332
+ }), Z(!0));
333
+ }, [R, F]);
334
+ const E = S({ callCount: 0, lastCall: Date.now() }), ee = B(() => {
335
+ console.log("Resetting API state due to server restart"), r(!1), i(ue.util.resetApiState());
336
+ }, 1e3), te = O(
337
+ (w) => {
338
+ if (E.current.callCount > 1e3)
339
+ return X(!0), console.log(
340
+ "Overload: Over 1000 messages per second. Ignoring subsequent messages."
341
+ );
342
+ let I;
343
+ try {
344
+ I = JSON.parse(w.data);
345
+ } catch (se) {
346
+ console.error("Failed to parse websocket message:", se, w.data);
347
+ return;
348
+ }
349
+ const { topic: x, sender: U, summary: oe, status: ne } = I || {};
350
+ if (p.current && (x === "heartbeat" || x === "server.started" && ne === "finished")) {
351
+ console.log("Server replica booted"), ee();
352
+ return;
353
+ }
354
+ if (x === "heartbeat") return;
355
+ if (x === "server.restart_requested" && (console.log("Server restart requested"), r(!0)), ["import.data"].includes(x)) {
356
+ if (U !== window.senderId) return;
357
+ } else if (U === window.senderId)
358
+ return;
359
+ const V = Date.now();
360
+ V - E.current.lastCall < 1e3 ? E.current.callCount += 1 : E.current.callCount = 0, console.log("Event RX", I), E.current.lastCall = V, x === "shout" && I?.summary?.text && z.info(oe.text), T.publish(x, I);
361
+ },
362
+ [r]
363
+ );
364
+ return v(() => {
365
+ C === me.OPEN && (P().onmessage = te, m(), T.publish("client.connected", {
366
+ topic: "client.connected"
367
+ }));
368
+ }, [C, P]), /* @__PURE__ */ l(
369
+ q.Provider,
370
+ {
371
+ value: {
372
+ getWebSocket: P,
373
+ readyState: C,
374
+ serverRestartingVisible: n
375
+ },
376
+ children: e
377
+ }
378
+ );
379
+ }, G = g(void 0), Kt = () => {
380
+ const e = d(G);
381
+ if (e === void 0)
382
+ throw new Error("useProjectContext must be used within a ProjectContextProvider");
383
+ return e;
384
+ }, qt = () => d(G), We = g(
385
+ void 0
386
+ ), Gt = () => {
387
+ const e = d(We);
388
+ if (e === void 0)
389
+ throw new Error("useProjectFoldersContext must be used within a ProjectFoldersContextProvider");
390
+ return e;
391
+ }, Y = g(void 0), Je = (e) => ({
392
+ created: e,
393
+ label_changed: e,
394
+ renamed: e,
395
+ type_changed: e,
396
+ status_changed: e,
397
+ tags_changed: e,
398
+ attrib_changed: e,
399
+ deleted: e
400
+ }), Be = (e, t) => e === t || e.startsWith(`${t}.`), ze = (e, t) => t.length === 0 ? !0 : t.includes(e || ""), He = (e) => {
401
+ const t = e.split(".").pop();
402
+ if (t && [
403
+ "created",
404
+ "label_changed",
405
+ "renamed",
406
+ "type_changed",
407
+ "status_changed",
408
+ "tags_changed",
409
+ "attrib_changed",
410
+ "deleted"
411
+ ].includes(t))
412
+ return t;
413
+ }, Yt = ({
414
+ projectNames: e,
415
+ topics: t,
416
+ isSyncing: o = !1,
417
+ shouldSyncOnUpdate: i
418
+ }) => {
419
+ const n = d(Y);
420
+ if (!n)
421
+ throw new Error("useSyncUpdates must be used within an EntityUpdatesProvider");
422
+ const r = e || n.projectNames, s = S(0), a = S(!1), c = n.updates.filter(
423
+ (p) => ze(p.project, r) && t.some((f) => Be(p.topic, f)) && (i?.(p) ?? !0)
424
+ );
425
+ return v(() => {
426
+ o && !a.current ? s.current = n.getLatestId() : !o && a.current && n.acknowledge(t, r, s.current), a.current = o;
427
+ }, [n, o, r, t]), {
428
+ updates: c,
429
+ hasUpdates: c.length > 0,
430
+ updateCount: c.length
431
+ };
432
+ }, Qt = () => {
433
+ const e = d(Y);
434
+ if (!e)
435
+ throw new Error("useAutoSyncSettings must be used within an EntityUpdatesProvider");
436
+ const { autoSyncSettings: t, setAutoSyncSettings: o } = e;
437
+ return [t, (n) => {
438
+ const { settings: r, global: s } = n;
439
+ o(s !== void 0 ? Je(s) : (a) => ({ ...a, ...r }));
440
+ }];
441
+ }, Xt = (e, t) => {
442
+ if (!t) return !1;
443
+ const o = He(e);
444
+ return o ? t[o] : !1;
445
+ }, Ke = u.li`
446
+ position: relative;
447
+ padding: 4px 6px 4px 12px;
448
+ user-select: none;
449
+
450
+ &:has(.start-icon) {
451
+ padding-left: 8px;
452
+ }
453
+
454
+ height: 32px;
455
+ border-radius: var(--border-radius-m);
456
+
457
+ display: flex;
458
+ align-items: center;
459
+ gap: var(--base-gap-small);
460
+
461
+ cursor: pointer;
462
+
463
+ .label {
464
+ flex: 1;
465
+ }
466
+
467
+ &:hover {
468
+ background-color: var(--md-sys-color-surface-container-high-hover);
469
+ }
470
+
471
+ &.selected {
472
+ background-color: var(--md-sys-color-primary-container);
473
+ &,
474
+ .icon {
475
+ color: var(--md-sys-color-on-primary-container);
476
+ }
477
+
478
+ .more {
479
+ &:hover {
480
+ background-color: var(--md-sys-color-primary-container-hover);
481
+ }
482
+ }
483
+ .reset {
484
+ &:hover {
485
+ background-color: var(--md-sys-color-primary-container-hover);
486
+ }
487
+ }
488
+ }
489
+ /* hide save button by default */
490
+ .save {
491
+ display: none;
492
+ }
493
+ &:hover {
494
+ .save {
495
+ display: flex;
496
+ }
497
+ }
498
+ `, L = u($)`
499
+ &.hasIcon {
500
+ padding: 2px;
501
+ }
502
+ &:hover {
503
+ background-color: var(--md-sys-color-surface-container-highest-hover);
504
+ }
505
+ &.active {
506
+ display: flex !important;
507
+ &:not(.reset) {
508
+ background-color: var(--md-sys-color-primary);
509
+ color: var(--md-sys-color-on-primary);
510
+
511
+ &:hover {
512
+ background-color: var(--md-sys-color-primary-hover);
513
+ }
514
+ }
515
+ }
516
+ `, qe = M(
517
+ ({
518
+ id: e,
519
+ label: t,
520
+ startContent: o,
521
+ endContent: i,
522
+ isSelected: n,
523
+ isEditable: r,
524
+ isSaveable: s,
525
+ highlighted: a,
526
+ onEdit: c,
527
+ onSave: p,
528
+ onResetView: f,
529
+ className: y,
530
+ ...C
531
+ }, P) => {
532
+ const { viewAlias: m } = ot(), D = (h, R) => {
533
+ h.stopPropagation(), R ? de({
534
+ message: `Save current ${m} settings and overwrite this ${m}?`,
535
+ header: "Confirm save",
536
+ accept: () => p && p(h, e)
537
+ }) : p && p(h, e);
538
+ };
539
+ return /* @__PURE__ */ k(
540
+ Ke,
541
+ {
542
+ ...C,
543
+ id: e,
544
+ className: A(y, { selected: n }),
545
+ ref: P,
546
+ children: [
547
+ o && o,
548
+ /* @__PURE__ */ l("span", { className: "label", children: t }),
549
+ f && /* @__PURE__ */ l(
550
+ L,
551
+ {
552
+ icon: "restart_alt",
553
+ variant: "text",
554
+ className: "reset",
555
+ onClick: f,
556
+ "data-tooltip": "Reset to Default",
557
+ "data-shortcut": ce("0", [J.Shift, J.Ctrl])
558
+ }
559
+ ),
560
+ r && s && !n && /* @__PURE__ */ l(
561
+ L,
562
+ {
563
+ icon: "save",
564
+ variant: "text",
565
+ className: A("save", { active: a === "save" }),
566
+ onClick: (h) => D(h, a !== "save"),
567
+ "data-tooltip": `Save ${m} settings from current ${m}`
568
+ }
569
+ ),
570
+ r && c && /* @__PURE__ */ l(
571
+ L,
572
+ {
573
+ variant: "text",
574
+ icon: "more_horiz",
575
+ className: A("more", { active: a === "edit" }),
576
+ onClick: (h) => c(h, e),
577
+ "data-tooltip": `Edit ${m}`
578
+ }
579
+ ),
580
+ i && i
581
+ ]
582
+ }
583
+ );
584
+ }
585
+ ), Ge = u.div`
586
+ overflow: auto;
587
+ max-height: 40vh;
588
+ `, Ye = u.ul`
589
+ /* reset defaults */
590
+ margin: 0;
591
+ padding: 0;
592
+ list-style: none;
593
+
594
+ display: flex;
595
+ flex-direction: column;
596
+ gap: var(--base-gap-small);
597
+ margin-bottom: var(--padding-s);
598
+ `, Qe = u.li`
599
+ height: 1px;
600
+ background-color: var(--md-sys-color-outline-variant);
601
+ margin: 4px 0;
602
+ `;
603
+ u.li`
604
+ ${H.labelSmall}
605
+ color: var(--md-sys-color-outline);
606
+ `;
607
+ const Xe = u.li`
608
+ ${H.labelSmall}
609
+ color: var(--md-sys-color-outline);
610
+ user-select: none;
611
+ border-radius: var(--border-radius-m);
612
+ height: 28px;
613
+ padding: 0 8px;
614
+
615
+ display: flex;
616
+ align-items: center;
617
+ gap: var(--base-gap-small);
618
+
619
+ cursor: pointer;
620
+
621
+ &:hover {
622
+ background-color: var(--md-sys-color-surface-container-high-hover);
623
+ }
624
+
625
+ .spacer {
626
+ flex: 1;
627
+ }
628
+ .icon {
629
+ font-size: 18px;
630
+ color: var(--md-sys-color-outline);
631
+ display: none;
632
+ }
633
+
634
+ /* if collapsed show icon at 90degrees */
635
+ &.collapsed .icon {
636
+ display: inline-flex;
637
+ transform: rotate(-90deg);
638
+ }
639
+
640
+ &:hover .icon {
641
+ display: inline-flex;
642
+ }
643
+ `, Ze = M(
644
+ ({ title: e, collapsed: t, className: o, ...i }, n) => /* @__PURE__ */ k(
645
+ Xe,
646
+ {
647
+ ...i,
648
+ className: A("views-section-header", { collapsed: t }, o),
649
+ ref: n,
650
+ children: [
651
+ /* @__PURE__ */ l("span", { children: e }),
652
+ /* @__PURE__ */ l("span", { className: "spacer" }),
653
+ /* @__PURE__ */ l(ae, { className: "icon", icon: "expand_more" })
654
+ ]
655
+ }
656
+ )
657
+ ), Zt = "_divider_", et = (e) => typeof e == "object" && e !== null && "type" in e && e.type === "section", eo = M(
658
+ ({ items: e, selected: t, ...o }, i) => /* @__PURE__ */ l(Ge, { children: /* @__PURE__ */ l(Ye, { ...o, ref: i, children: e.map((n, r) => n === "_divider_" ? /* @__PURE__ */ l(Qe, {}, r) : et(n) ? /* @__PURE__ */ l(
659
+ Ze,
660
+ {
661
+ id: n.id,
662
+ title: n.title,
663
+ collapsed: n.collapsed,
664
+ onClick: n.onToggle
665
+ },
666
+ n.id
667
+ ) : /* @__PURE__ */ l(
668
+ qe,
669
+ {
670
+ tabIndex: 0,
671
+ isSelected: n.id === t,
672
+ autoFocus: r === 0,
673
+ ...n
674
+ },
675
+ (n.id || "") + r.toString()
676
+ )) }) })
677
+ ), tt = g(null), ot = () => {
678
+ const e = d(tt);
679
+ if (!e)
680
+ throw new Error("useViewsContext must be used within a ViewsProvider");
681
+ return e;
682
+ }, to = 1, nt = u.div`
683
+ min-width: 350px;
684
+ `, st = u.div`
685
+ margin-top: 12px;
686
+ min-height: 60px;
687
+ min-width: 350px;
688
+ `, rt = u.p`
689
+ font-weight: 600;
690
+ margin-bottom: 4px;
691
+ `, at = u.p`
692
+ margin-top: 12px;
693
+ font-weight: 600;
694
+ color: var(--md-sys-color-error);
695
+ `, oo = ({
696
+ entityLabel: e,
697
+ childrenDetails: t,
698
+ totalLine: o,
699
+ message: i
700
+ }) => /* @__PURE__ */ k(nt, { children: [
701
+ /* @__PURE__ */ l("p", { children: i || `Are you sure you want to delete ${e}? This action cannot be undone.` }),
702
+ t.length > 0 && /* @__PURE__ */ k(st, { children: [
703
+ /* @__PURE__ */ l(rt, { children: "The following will also be affected:" }),
704
+ t.map((n, r) => /* @__PURE__ */ l("p", { children: n }, r))
705
+ ] }),
706
+ o && /* @__PURE__ */ l(at, { children: o })
707
+ ] }), no = u(ie)`
708
+ max-height: min(600px, 90vh);
709
+ `, so = u.div`
710
+ display: flex;
711
+ flex-direction: column;
712
+ width: 100%;
713
+ `, ro = u.label`
714
+ margin: 2px 0 14px 0;
715
+ `, ao = u.div`
716
+ display: flex;
717
+ padding-top: 14px;
718
+ gap: 8px;
719
+ justify-content: flex-end;
720
+ `, io = u.div`
721
+ display: flex;
722
+ flex-direction: column;
723
+ gap: 8px;
724
+ max-height: 30vh;
725
+ overflow-y: auto;
726
+ /* scroll container clips the inputs' 2px focus outline — inset it, then pull back to keep alignment */
727
+ padding: 4px;
728
+ margin: -4px;
729
+ `, co = u.label`
730
+ display: flex;
731
+ align-items: center;
732
+ justify-content: space-between;
733
+ gap: 12px;
734
+ `, lo = u(K)`
735
+ width: 180px;
736
+ `, uo = u(K)`
737
+ width: 100%;
738
+ /* room for the 2px focus outline */
739
+ margin: 2px 0;
740
+ `, it = /* @__PURE__ */ new Set([
741
+ "folder",
742
+ "task",
743
+ "product",
744
+ "version",
745
+ "representation",
746
+ "workfile"
747
+ ]), po = (e) => !!e && it.has(e), Q = g(null), go = () => {
748
+ const e = d(Q);
749
+ if (!e)
750
+ throw new Error("useDeleteEntitiesContext must be used within a DeleteEntitiesProvider");
751
+ return e;
752
+ }, fo = () => d(Q);
753
+ export {
754
+ Xt as $,
755
+ Ie as A,
756
+ At as B,
757
+ uo as C,
758
+ oo as D,
759
+ Y as E,
760
+ so as F,
761
+ Pe as G,
762
+ j as H,
763
+ ke as I,
764
+ Re as J,
765
+ Ae as K,
766
+ je as L,
767
+ $e as M,
768
+ Me as N,
769
+ xe as O,
770
+ G as P,
771
+ we as Q,
772
+ Fe as R,
773
+ no as S,
774
+ De as T,
775
+ We as U,
776
+ Se as V,
777
+ Q as W,
778
+ Vt as X,
779
+ q as Y,
780
+ Ht as Z,
781
+ Lt as _,
782
+ Rt as a,
783
+ po as a0,
784
+ jt as a1,
785
+ Jt as a2,
786
+ Wt as a3,
787
+ Qt as a4,
788
+ go as a5,
789
+ fo as a6,
790
+ Ne as a7,
791
+ Mt as a8,
792
+ Ut as a9,
793
+ zt as aa,
794
+ $t as ab,
795
+ Yt as ac,
796
+ Ft as ad,
797
+ Zt as ae,
798
+ tt as af,
799
+ Ze as ag,
800
+ eo as ah,
801
+ qe as ai,
802
+ Dt as b,
803
+ Be as c,
804
+ kt as d,
805
+ ot as e,
806
+ to as f,
807
+ He as g,
808
+ ro as h,
809
+ io as i,
810
+ co as j,
811
+ lo as k,
812
+ ao as l,
813
+ ze as m,
814
+ qt as n,
815
+ Nt as o,
816
+ Ot as p,
817
+ be as q,
818
+ ye as r,
819
+ _t as s,
820
+ Je as t,
821
+ Bt as u,
822
+ Te as v,
823
+ Ce as w,
824
+ Kt as x,
825
+ Gt as y,
826
+ ve as z
827
+ };