@vidispine/vdt-react 23.2.0-pre.1 → 23.2.0-pre.2
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.
- package/dist/index.js +3630 -61
- package/dist/index.umd.cjs +10 -0
- package/package.json +20 -24
- package/dist/DropArea.js +0 -7
- package/dist/context/AuthContext.js +0 -15
- package/dist/context/BinContext.js +0 -12
- package/dist/context/RolesContext.js +0 -10
- package/dist/context/SettingsContext.js +0 -15
- package/dist/hoc/compose.js +0 -3
- package/dist/hoc/withErrorBoundary.js +0 -7
- package/dist/hooks/useAddMetadataFieldAttributes.js +0 -15
- package/dist/hooks/useApi.js +0 -10
- package/dist/hooks/useAutocomplete.js +0 -10
- package/dist/hooks/useCollectionAutoPlay.js +0 -10
- package/dist/hooks/useCompoundMetadata.js +0 -10
- package/dist/hooks/useCsvDownload.js +0 -10
- package/dist/hooks/useDocSearchAutocomplete.js +0 -11
- package/dist/hooks/useEntityAccess.js +0 -10
- package/dist/hooks/useGetCollection.js +0 -7
- package/dist/hooks/useGetCollectionItem.js +0 -7
- package/dist/hooks/useGetEntity.js +0 -16
- package/dist/hooks/useGetEntityMetadata.js +0 -7
- package/dist/hooks/useGetFieldGroup.js +0 -7
- package/dist/hooks/useGetFieldMetadataDataset.js +0 -6
- package/dist/hooks/useGetItem.js +0 -7
- package/dist/hooks/useGetSavedSearchFolders.js +0 -15
- package/dist/hooks/useGroup.js +0 -7
- package/dist/hooks/useHoverScrub.js +0 -17
- package/dist/hooks/useInterval.js +0 -5
- package/dist/hooks/useJobSearch.js +0 -9
- package/dist/hooks/useListGroup.js +0 -8
- package/dist/hooks/useListUser.js +0 -8
- package/dist/hooks/useLocalStorage.js +0 -6
- package/dist/hooks/useMouseDownPosition.js +0 -6
- package/dist/hooks/useQueryInitialState.js +0 -7
- package/dist/hooks/useRepresentativeItems.js +0 -12
- package/dist/hooks/useSavedSearch.js +0 -12
- package/dist/hooks/useSearch.js +0 -8
- package/dist/hooks/useSearchGroup.js +0 -11
- package/dist/hooks/useSearchItem.js +0 -7
- package/dist/hooks/useSearchUser.js +0 -11
- package/dist/hooks/useSelected.js +0 -7
- package/dist/hooks/useTab.js +0 -6
- package/dist/hooks/useThumbnailScrub.js +0 -6
- package/dist/hooks/useUpdateEffect.js +0 -6
- package/dist/hooks/useUpdateQueryState.js +0 -9
- package/dist/hooks/useUploadFiles.js +0 -13
- package/dist/hooks/useUser.js +0 -8
- package/dist/moveEntity.js +0 -6
- package/dist/utils.js +0 -7
- package/dist/wrappers/Auth.js +0 -11
- package/dist/wrappers/ComposeProviders.js +0 -7
- package/dist/wrappers/ErrorBoundary.js +0 -11
- package/dist/wrappers/GetCollection.js +0 -6
- package/dist/wrappers/GetEntityMetadata.js +0 -6
- package/dist/wrappers/GetFieldGroup.js +0 -6
- package/dist/wrappers/GetItem.js +0 -6
- package/dist/wrappers/GetJobs.js +0 -8
- package/dist/wrappers/HasRole.js +0 -6
- package/dist/wrappers/ListEntityAccess.js +0 -8
- package/dist/wrappers/MetadataType.js +0 -8
- package/dist/wrappers/SearchCollection.js +0 -8
- package/dist/wrappers/SearchItem.js +0 -6
- package/dist/wrappers/SearchItemCollection.js +0 -8
- package/dist/wrappers/VidispineApi.js +0 -11
package/dist/index.js
CHANGED
|
@@ -1,61 +1,3630 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
1
|
+
import { useRef as K, useReducer as fe, useCallback as P, useEffect as $, useState as M, useMemo as he, Children as ne, cloneElement as oe, Component as Je, createContext as Ee, useContext as Ie, isValidElement as _e } from "react";
|
|
2
|
+
import { utils as J, search as Xe, vsimport as xe, collection as j, ChunkedTransferManager as Rt, ChunkedUpload as Pt, access as Pe, metadatafield as ze, fieldgroup as Ke, item as ue, library as ge, user as X, group as te, storage as Nt, job as Ze, file as It, metadata as Ne, noauth as et } from "@vidispine/vdt-api";
|
|
3
|
+
import { createMetadataType as de, formatTimeCodeText as _t, formatTimeCodeSeconds as Gt, parseMetadataType as tt, ROLE_NAMES as bt } from "@vidispine/vdt-js";
|
|
4
|
+
import { compressToEncodedURIComponent as wt, decompressFromEncodedURIComponent as Dt } from "lz-string";
|
|
5
|
+
import Z from "use-deep-compare-effect";
|
|
6
|
+
import rt from "lodash.debounce";
|
|
7
|
+
import { jsx as B, jsxs as Ot } from "react/jsx-runtime";
|
|
8
|
+
import { useCookies as nt } from "react-cookie";
|
|
9
|
+
import ot from "react-is";
|
|
10
|
+
const Ht = ({
|
|
11
|
+
hasLoaded: e = !1,
|
|
12
|
+
isLoading: t = !0,
|
|
13
|
+
isError: n = !1,
|
|
14
|
+
response: r = void 0,
|
|
15
|
+
data: o = void 0
|
|
16
|
+
} = {}, s = void 0) => ({
|
|
17
|
+
isLoading: t,
|
|
18
|
+
hasLoaded: e,
|
|
19
|
+
isError: n,
|
|
20
|
+
response: r,
|
|
21
|
+
data: s && s.current ? s.current : o
|
|
22
|
+
}), Lt = (e, t) => {
|
|
23
|
+
switch (t.type) {
|
|
24
|
+
case "START":
|
|
25
|
+
return {
|
|
26
|
+
...e,
|
|
27
|
+
isLoading: !0,
|
|
28
|
+
isError: !1
|
|
29
|
+
};
|
|
30
|
+
case "SUCCESS": {
|
|
31
|
+
const { responseType: n } = t.response, r = {
|
|
32
|
+
isLoading: !1,
|
|
33
|
+
isError: !1,
|
|
34
|
+
hasLoaded: !0,
|
|
35
|
+
response: t.response,
|
|
36
|
+
data: t.response.data
|
|
37
|
+
};
|
|
38
|
+
return n && (r[n] = t.response[n]), r;
|
|
39
|
+
}
|
|
40
|
+
case "ERROR":
|
|
41
|
+
return {
|
|
42
|
+
isLoading: !1,
|
|
43
|
+
isError: !0,
|
|
44
|
+
hasLoaded: !0,
|
|
45
|
+
response: t.response,
|
|
46
|
+
data: t.response.data
|
|
47
|
+
};
|
|
48
|
+
case "CANCEL":
|
|
49
|
+
return {
|
|
50
|
+
...e,
|
|
51
|
+
isLoading: !1,
|
|
52
|
+
isError: !1,
|
|
53
|
+
hasLoaded: !0
|
|
54
|
+
};
|
|
55
|
+
case "RESET":
|
|
56
|
+
return {
|
|
57
|
+
...t.initialState
|
|
58
|
+
};
|
|
59
|
+
default:
|
|
60
|
+
return e;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
function W(e, t, n) {
|
|
64
|
+
const r = K(() => null), o = Ht(t, n), s = K(o), [a, i] = fe(Lt, o), l = P(
|
|
65
|
+
(p) => (i({ type: "START" }), new Promise((m, d) => {
|
|
66
|
+
e({
|
|
67
|
+
cancelToken: new J.CancelToken((h) => {
|
|
68
|
+
r.current = h;
|
|
69
|
+
}),
|
|
70
|
+
...p
|
|
71
|
+
}).then((h) => {
|
|
72
|
+
m(h), i({ type: "SUCCESS", response: h }), n && (n.current = h.data);
|
|
73
|
+
}).catch((h) => {
|
|
74
|
+
h.__CANCEL__ ? i({ type: "CANCEL" }) : (d(h), i({ type: "ERROR", response: h }));
|
|
75
|
+
});
|
|
76
|
+
})),
|
|
77
|
+
[e, n]
|
|
78
|
+
), u = P(
|
|
79
|
+
() => i({ type: "RESET", initialState: s.current }),
|
|
80
|
+
[]
|
|
81
|
+
), c = P(() => r.current(), []);
|
|
82
|
+
return $(
|
|
83
|
+
() => () => {
|
|
84
|
+
c(), u();
|
|
85
|
+
},
|
|
86
|
+
[c, u]
|
|
87
|
+
), {
|
|
88
|
+
request: l,
|
|
89
|
+
reset: u,
|
|
90
|
+
cancel: c,
|
|
91
|
+
...a
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
const Ut = "CHANGE_PAGE", xt = "CHANGE_ROWS", Mt = "CHANGE_SORT", Ft = "CHANGE_SEARCHTEXT", qt = "CHANGE_SEARCHFIELD", $t = "CHANGE_SEARCHFIELDFACET", jt = "CHANGE_SEARCHFILTER", Wt = "CHANGE_SEARCHFILTERFACET", Vt = "CHANGE_PARENT_COLLECTION", kt = "CHANGE_FACET", Yt = "CHANGE_ITEMSEARCHDOCUMENT", Bt = "CHANGE_QUERYPARAMS", Qt = "CHANGE_MATRIXPARAMS", Jt = "CHANGE_SUGGESTION", x = {
|
|
95
|
+
CHANGE_PAGE: Ut,
|
|
96
|
+
CHANGE_ROWS: xt,
|
|
97
|
+
CHANGE_SORT: Mt,
|
|
98
|
+
CHANGE_SEARCHTEXT: Ft,
|
|
99
|
+
CHANGE_SEARCHFIELD: qt,
|
|
100
|
+
CHANGE_SEARCHFIELDFACET: $t,
|
|
101
|
+
CHANGE_SEARCHFILTER: jt,
|
|
102
|
+
CHANGE_SEARCHFILTERFACET: Wt,
|
|
103
|
+
CHANGE_PARENT_COLLECTION: Vt,
|
|
104
|
+
CHANGE_FACET: kt,
|
|
105
|
+
CHANGE_ITEMSEARCHDOCUMENT: Yt,
|
|
106
|
+
CHANGE_QUERYPARAMS: Bt,
|
|
107
|
+
CHANGE_MATRIXPARAMS: Qt,
|
|
108
|
+
CHANGE_SUGGESTION: Jt
|
|
109
|
+
}, Xt = ({
|
|
110
|
+
queryParams: e = {},
|
|
111
|
+
matrixParams: t = {},
|
|
112
|
+
itemSearchDocument: n = {},
|
|
113
|
+
rowsPerPage: r = 10,
|
|
114
|
+
page: o = 0,
|
|
115
|
+
...s
|
|
116
|
+
} = {}) => ({
|
|
117
|
+
...s,
|
|
118
|
+
queryParams: {
|
|
119
|
+
content: "metadata",
|
|
120
|
+
interval: "generic",
|
|
121
|
+
...e
|
|
122
|
+
},
|
|
123
|
+
matrixParams: {
|
|
124
|
+
first: o * r + 1,
|
|
125
|
+
number: r,
|
|
126
|
+
...t
|
|
127
|
+
},
|
|
128
|
+
itemSearchDocument: {
|
|
129
|
+
intervals: "generic",
|
|
130
|
+
filter: [],
|
|
131
|
+
...n
|
|
132
|
+
},
|
|
133
|
+
rowsPerPage: r,
|
|
134
|
+
page: o
|
|
135
|
+
}), zt = (e, t) => {
|
|
136
|
+
switch (t.type) {
|
|
137
|
+
case x.CHANGE_ITEMSEARCHDOCUMENT:
|
|
138
|
+
return {
|
|
139
|
+
...e,
|
|
140
|
+
page: Number.isInteger(t.page) ? t.page : e.page,
|
|
141
|
+
itemSearchDocument: t.itemSearchDocument,
|
|
142
|
+
matrixParams: {
|
|
143
|
+
...e.matrixParams,
|
|
144
|
+
first: Number.isInteger(t.page) ? t.page * e.rowsPerPage + 1 : e.matrixParams.first
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
case x.CHANGE_QUERYPARAMS:
|
|
148
|
+
return {
|
|
149
|
+
...e,
|
|
150
|
+
queryParams: t.queryParams
|
|
151
|
+
};
|
|
152
|
+
case x.CHANGE_MATRIXPARAMS:
|
|
153
|
+
return {
|
|
154
|
+
...e,
|
|
155
|
+
matrixParams: t.matrixParams
|
|
156
|
+
};
|
|
157
|
+
case x.CHANGE_PAGE:
|
|
158
|
+
return {
|
|
159
|
+
...e,
|
|
160
|
+
page: t.page,
|
|
161
|
+
matrixParams: {
|
|
162
|
+
...e.matrixParams,
|
|
163
|
+
first: t.page * e.rowsPerPage + 1
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
case x.CHANGE_ROWS:
|
|
167
|
+
return {
|
|
168
|
+
...e,
|
|
169
|
+
rowsPerPage: t.rowsPerPage,
|
|
170
|
+
page: 0,
|
|
171
|
+
matrixParams: {
|
|
172
|
+
...e.matrixParams,
|
|
173
|
+
first: 1,
|
|
174
|
+
number: t.rowsPerPage
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
case x.CHANGE_SORT:
|
|
178
|
+
return {
|
|
179
|
+
...e,
|
|
180
|
+
page: 0,
|
|
181
|
+
searchText: t.value,
|
|
182
|
+
sort: t.value,
|
|
183
|
+
itemSearchDocument: {
|
|
184
|
+
...e.itemSearchDocument,
|
|
185
|
+
sort: t.field ? [
|
|
186
|
+
{
|
|
187
|
+
field: t.field,
|
|
188
|
+
order: t.order || "descending"
|
|
189
|
+
}
|
|
190
|
+
] : []
|
|
191
|
+
},
|
|
192
|
+
matrixParams: {
|
|
193
|
+
...e.matrixParams,
|
|
194
|
+
first: 1
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
case x.CHANGE_SEARCHTEXT:
|
|
198
|
+
return {
|
|
199
|
+
...e,
|
|
200
|
+
page: 0,
|
|
201
|
+
searchText: t.value,
|
|
202
|
+
itemSearchDocument: t.value ? {
|
|
203
|
+
...e.itemSearchDocument,
|
|
204
|
+
text: [{ value: `${t.value}` }]
|
|
205
|
+
} : {
|
|
206
|
+
...e.itemSearchDocument,
|
|
207
|
+
text: []
|
|
208
|
+
},
|
|
209
|
+
matrixParams: {
|
|
210
|
+
...e.matrixParams,
|
|
211
|
+
first: 1
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
case x.CHANGE_SEARCHFIELD:
|
|
215
|
+
return {
|
|
216
|
+
...e,
|
|
217
|
+
page: 0,
|
|
218
|
+
field: t.field,
|
|
219
|
+
itemSearchDocument: t.field ? {
|
|
220
|
+
...e.itemSearchDocument,
|
|
221
|
+
field: t.field
|
|
222
|
+
} : {
|
|
223
|
+
...e.itemSearchDocument,
|
|
224
|
+
field: []
|
|
225
|
+
},
|
|
226
|
+
matrixParams: {
|
|
227
|
+
...e.matrixParams,
|
|
228
|
+
first: 1
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
case x.CHANGE_SEARCHFIELDFACET:
|
|
232
|
+
return {
|
|
233
|
+
...e,
|
|
234
|
+
page: 0,
|
|
235
|
+
field: t.field,
|
|
236
|
+
facet: t.facet,
|
|
237
|
+
itemSearchDocument: t.field ? {
|
|
238
|
+
...e.itemSearchDocument,
|
|
239
|
+
field: t.field,
|
|
240
|
+
facet: t.facet
|
|
241
|
+
} : {
|
|
242
|
+
...e.itemSearchDocument,
|
|
243
|
+
field: [],
|
|
244
|
+
facet: []
|
|
245
|
+
},
|
|
246
|
+
matrixParams: {
|
|
247
|
+
...e.matrixParams,
|
|
248
|
+
first: 1
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
case x.CHANGE_SEARCHFILTER:
|
|
252
|
+
return {
|
|
253
|
+
...e,
|
|
254
|
+
page: 0,
|
|
255
|
+
filter: t.filter,
|
|
256
|
+
itemSearchDocument: t.filter ? {
|
|
257
|
+
...e.itemSearchDocument,
|
|
258
|
+
filter: t.filter
|
|
259
|
+
} : {
|
|
260
|
+
...e.itemSearchDocument,
|
|
261
|
+
filter: []
|
|
262
|
+
},
|
|
263
|
+
matrixParams: {
|
|
264
|
+
...e.matrixParams,
|
|
265
|
+
first: 1
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
case x.CHANGE_SEARCHFILTERFACET:
|
|
269
|
+
return {
|
|
270
|
+
...e,
|
|
271
|
+
page: 0,
|
|
272
|
+
filter: t.filter,
|
|
273
|
+
itemSearchDocument: t.filter ? {
|
|
274
|
+
...e.itemSearchDocument,
|
|
275
|
+
filter: t.filter,
|
|
276
|
+
facet: t.facet
|
|
277
|
+
} : {
|
|
278
|
+
...e.itemSearchDocument,
|
|
279
|
+
filter: [],
|
|
280
|
+
facet: []
|
|
281
|
+
},
|
|
282
|
+
matrixParams: {
|
|
283
|
+
...e.matrixParams,
|
|
284
|
+
first: 1
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
case x.CHANGE_FACET:
|
|
288
|
+
return {
|
|
289
|
+
...e,
|
|
290
|
+
page: 0,
|
|
291
|
+
facet: t.facet,
|
|
292
|
+
itemSearchDocument: t.facet ? {
|
|
293
|
+
...e.itemSearchDocument,
|
|
294
|
+
facet: t.facet
|
|
295
|
+
} : {
|
|
296
|
+
...e.itemSearchDocument,
|
|
297
|
+
facet: []
|
|
298
|
+
},
|
|
299
|
+
matrixParams: {
|
|
300
|
+
...e.matrixParams,
|
|
301
|
+
first: 1
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
case x.CHANGE_PARENT_COLLECTION:
|
|
305
|
+
return {
|
|
306
|
+
...e,
|
|
307
|
+
page: 0,
|
|
308
|
+
parentCollection: t.value,
|
|
309
|
+
itemSearchDocument: t.value ? {
|
|
310
|
+
...e.itemSearchDocument,
|
|
311
|
+
operator: {
|
|
312
|
+
field: [
|
|
313
|
+
{ name: "__parent_collection", value: [{ value: `${t.value}` }] },
|
|
314
|
+
{ name: "__collection", value: [{ value: `${t.value}` }] }
|
|
315
|
+
],
|
|
316
|
+
operation: "OR"
|
|
317
|
+
}
|
|
318
|
+
} : {
|
|
319
|
+
...e.itemSearchDocument,
|
|
320
|
+
operator: void 0
|
|
321
|
+
},
|
|
322
|
+
matrixParams: {
|
|
323
|
+
...e.matrixParams,
|
|
324
|
+
first: 1
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
case x.CHANGE_SUGGESTION:
|
|
328
|
+
return {
|
|
329
|
+
...e,
|
|
330
|
+
itemSearchDocument: {
|
|
331
|
+
...e.itemSearchDocument,
|
|
332
|
+
suggestion: t.suggestion
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
default:
|
|
336
|
+
return e;
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
function Kt(e) {
|
|
340
|
+
const t = Xt(e), [n, r] = fe(zt, t), o = ({ target: { value: g } } = {}) => r({
|
|
341
|
+
type: x.CHANGE_ROWS,
|
|
342
|
+
rowsPerPage: g
|
|
343
|
+
}), s = ({ page: g }) => r({
|
|
344
|
+
type: x.CHANGE_PAGE,
|
|
345
|
+
page: g
|
|
346
|
+
}), a = (g, y, S) => r({
|
|
347
|
+
type: x.CHANGE_SORT,
|
|
348
|
+
field: y,
|
|
349
|
+
order: S
|
|
350
|
+
}), i = P(
|
|
351
|
+
(g) => r({
|
|
352
|
+
type: x.CHANGE_SEARCHTEXT,
|
|
353
|
+
value: g
|
|
354
|
+
}),
|
|
355
|
+
[]
|
|
356
|
+
), l = P(
|
|
357
|
+
(g, y) => r({
|
|
358
|
+
type: x.CHANGE_ITEMSEARCHDOCUMENT,
|
|
359
|
+
itemSearchDocument: g,
|
|
360
|
+
page: y
|
|
361
|
+
}),
|
|
362
|
+
[]
|
|
363
|
+
), u = P(
|
|
364
|
+
(g) => r({
|
|
365
|
+
type: x.CHANGE_QUERYPARAMS,
|
|
366
|
+
queryParams: g
|
|
367
|
+
}),
|
|
368
|
+
[]
|
|
369
|
+
), c = P(
|
|
370
|
+
(g) => r({
|
|
371
|
+
type: x.CHANGE_MATRIXPARAMS,
|
|
372
|
+
matrixParams: g
|
|
373
|
+
}),
|
|
374
|
+
[]
|
|
375
|
+
), p = P(
|
|
376
|
+
(g) => r({
|
|
377
|
+
type: x.CHANGE_SEARCHFIELD,
|
|
378
|
+
field: g
|
|
379
|
+
}),
|
|
380
|
+
[]
|
|
381
|
+
), m = P((g) => {
|
|
382
|
+
const y = g.map(({ name: S }) => ({ field: S, count: !0 }));
|
|
383
|
+
r({ type: x.CHANGE_SEARCHFIELDFACET, field: g, facet: y });
|
|
384
|
+
}, []), d = P(
|
|
385
|
+
(g) => r({
|
|
386
|
+
type: x.CHANGE_SEARCHFILTER,
|
|
387
|
+
filter: g
|
|
388
|
+
}),
|
|
389
|
+
[]
|
|
390
|
+
), h = P(
|
|
391
|
+
(g) => {
|
|
392
|
+
const S = g.reduce((R, { field: A = [] }) => R.concat(A), []).map(({ name: R }) => ({
|
|
393
|
+
name: R,
|
|
394
|
+
field: R,
|
|
395
|
+
count: !0,
|
|
396
|
+
exclude: [R]
|
|
397
|
+
}));
|
|
398
|
+
r({ type: x.CHANGE_SEARCHFILTERFACET, filter: g, facet: S });
|
|
399
|
+
},
|
|
400
|
+
[r]
|
|
401
|
+
), f = P(
|
|
402
|
+
(g) => {
|
|
403
|
+
r({ type: x.CHANGE_FACET, facet: g });
|
|
404
|
+
},
|
|
405
|
+
[r]
|
|
406
|
+
), C = P(
|
|
407
|
+
(g) => r({
|
|
408
|
+
type: x.CHANGE_PARENT_COLLECTION,
|
|
409
|
+
value: g
|
|
410
|
+
}),
|
|
411
|
+
[]
|
|
412
|
+
), v = P((g) => {
|
|
413
|
+
r({ type: x.CHANGE_SUGGESTION, suggestion: g });
|
|
414
|
+
}, []);
|
|
415
|
+
return {
|
|
416
|
+
state: n,
|
|
417
|
+
onChangeRowsPerPage: o,
|
|
418
|
+
onChangePage: s,
|
|
419
|
+
onChangeSort: a,
|
|
420
|
+
setSearchText: i,
|
|
421
|
+
setSearchField: p,
|
|
422
|
+
setSearchFieldFacet: m,
|
|
423
|
+
setSearchFilter: d,
|
|
424
|
+
setSearchFilterFacet: h,
|
|
425
|
+
setFacet: f,
|
|
426
|
+
setItemSearchDocument: l,
|
|
427
|
+
setQueryParams: u,
|
|
428
|
+
setMatrixParams: c,
|
|
429
|
+
setParentCollection: C,
|
|
430
|
+
setSuggestion: v
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
function st(e, t) {
|
|
434
|
+
const n = K(!1);
|
|
435
|
+
$(() => {
|
|
436
|
+
n.current ? e() : n.current = !0;
|
|
437
|
+
}, t);
|
|
438
|
+
}
|
|
439
|
+
const Zt = ({
|
|
440
|
+
field: e = void 0,
|
|
441
|
+
text: t = "",
|
|
442
|
+
maximumSuggestions: n = 10
|
|
443
|
+
} = {}) => ({
|
|
444
|
+
field: e,
|
|
445
|
+
text: t,
|
|
446
|
+
maximumSuggestions: n
|
|
447
|
+
});
|
|
448
|
+
function Un(e) {
|
|
449
|
+
const t = Zt(e), [n, r] = M(t), o = P((u, c = "") => {
|
|
450
|
+
r((p) => ({ ...p, field: u, text: c }));
|
|
451
|
+
}, []), s = P((u) => {
|
|
452
|
+
r((c) => ({ ...c, text: u }));
|
|
453
|
+
}, []), a = P((u) => {
|
|
454
|
+
r((c) => ({ ...c, maximumSuggestions: u }));
|
|
455
|
+
}, []), { request: i, data: { suggestion: l = [] } = {} } = W(
|
|
456
|
+
Xe.searchAutoComplete
|
|
457
|
+
);
|
|
458
|
+
return st(() => {
|
|
459
|
+
i({ autocompleteRequestDocument: n });
|
|
460
|
+
}, [n]), {
|
|
461
|
+
suggestions: l,
|
|
462
|
+
setAutocompleteField: o,
|
|
463
|
+
setAutocompleteText: s,
|
|
464
|
+
setAutocompleteMaxSuggestions: a
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
const xn = (e = "id", t = []) => {
|
|
468
|
+
const [n, r] = M(t);
|
|
469
|
+
return {
|
|
470
|
+
selected: n,
|
|
471
|
+
onSelect: (i, l, u) => {
|
|
472
|
+
const c = u[e], p = n.findIndex((m) => m[e] === c);
|
|
473
|
+
if (p === -1 && l === !0)
|
|
474
|
+
l === !0 && r([...n, u]);
|
|
475
|
+
else if (p > -1 && l === !1) {
|
|
476
|
+
const m = [...n];
|
|
477
|
+
m.splice(p, 1), r(m);
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
onClear: () => r([]),
|
|
481
|
+
isSelected: (i) => {
|
|
482
|
+
const l = i[e];
|
|
483
|
+
return n.findIndex((c) => c[e] === l) > -1;
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
}, Mn = (e) => {
|
|
487
|
+
const [t, n] = M(e);
|
|
488
|
+
return { activeTab: t, changeTab: (o, s) => n(s) };
|
|
489
|
+
};
|
|
490
|
+
function Fn(e, t) {
|
|
491
|
+
const n = K();
|
|
492
|
+
$(() => {
|
|
493
|
+
n.current = e;
|
|
494
|
+
}, [e]), $(() => {
|
|
495
|
+
const o = setInterval(() => n.current(), t);
|
|
496
|
+
return () => clearInterval(o);
|
|
497
|
+
}, [t]);
|
|
498
|
+
}
|
|
499
|
+
function qn(e = []) {
|
|
500
|
+
const t = K(), n = he(() => Math.floor(e.length / 2), [e]), [r, o] = M(), s = K(r);
|
|
501
|
+
if ($(() => () => t.current && clearInterval(t.current), []), e.length === 0)
|
|
502
|
+
return { width: 0 };
|
|
503
|
+
s.current = r;
|
|
504
|
+
const a = () => {
|
|
505
|
+
const p = () => {
|
|
506
|
+
s.current === void 0 ? o(0) : s.current === e.length - 1 ? clearInterval(t.current) : o(s.current + 1);
|
|
507
|
+
};
|
|
508
|
+
t.current = setInterval(p, 500);
|
|
509
|
+
}, i = () => {
|
|
510
|
+
o(), clearInterval(t.current);
|
|
511
|
+
}, l = e[r === void 0 ? n : r], u = r === void 0 ? 0 : `${Math.floor(r / (e.length - 1) * 100)}%`;
|
|
512
|
+
return {
|
|
513
|
+
imageSrc: l,
|
|
514
|
+
onMouseEnter: a,
|
|
515
|
+
onMouseLeave: i,
|
|
516
|
+
width: u
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
const er = "CHANGE_PAGE", tr = "CHANGE_ROWS", rr = "CHANGE_SORT", nr = "CHANGE_TYPE", or = "CHANGE_STATE", sr = "CHANGE_PRIORITY", ar = "CHANGE_STARTTIME", ir = "CHANGE_FINISHTIME", Y = {
|
|
520
|
+
CHANGE_PAGE: er,
|
|
521
|
+
CHANGE_ROWS: tr,
|
|
522
|
+
CHANGE_SORT: rr,
|
|
523
|
+
CHANGE_TYPE: nr,
|
|
524
|
+
CHANGE_STATE: or,
|
|
525
|
+
CHANGE_PRIORITY: sr,
|
|
526
|
+
CHANGE_STARTTIME: ar,
|
|
527
|
+
CHANGE_FINISHTIME: ir
|
|
528
|
+
}, cr = ({ queryParams: e = {}, matrixParams: t = {} } = {}) => ({
|
|
529
|
+
queryParams: e,
|
|
530
|
+
matrixParams: {
|
|
531
|
+
first: 1,
|
|
532
|
+
number: 10,
|
|
533
|
+
...t
|
|
534
|
+
},
|
|
535
|
+
rowsPerPage: 10,
|
|
536
|
+
page: 0,
|
|
537
|
+
jobMetadata: []
|
|
538
|
+
}), ur = (e, t) => {
|
|
539
|
+
const { type: n, ...r } = t;
|
|
540
|
+
switch (n) {
|
|
541
|
+
case Y.CHANGE_PAGE: {
|
|
542
|
+
const { page: o = 0 } = t, { rowsPerPage: s = 10 } = e;
|
|
543
|
+
return {
|
|
544
|
+
...e,
|
|
545
|
+
page: o,
|
|
546
|
+
matrixParams: {
|
|
547
|
+
...e.matrixParams,
|
|
548
|
+
first: o * s + 1
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
case Y.CHANGE_ROWS: {
|
|
553
|
+
const { rowsPerPage: o } = t;
|
|
554
|
+
return {
|
|
555
|
+
...e,
|
|
556
|
+
rowsPerPage: o,
|
|
557
|
+
page: 0,
|
|
558
|
+
matrixParams: {
|
|
559
|
+
...e.matrixParams,
|
|
560
|
+
first: 1,
|
|
561
|
+
number: o
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
case Y.CHANGE_SORT: {
|
|
566
|
+
const { field: o, order: s = "desc" } = t;
|
|
567
|
+
return {
|
|
568
|
+
...e,
|
|
569
|
+
page: 0,
|
|
570
|
+
matrixParams: {
|
|
571
|
+
...e.matrixParams,
|
|
572
|
+
first: 1,
|
|
573
|
+
sort: `${o} ${s}`
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
case Y.CHANGE_TYPE:
|
|
578
|
+
case Y.CHANGE_STATE:
|
|
579
|
+
case Y.CHANGE_PRIORITY: {
|
|
580
|
+
const { field: o, value: s = [] } = r;
|
|
581
|
+
let a;
|
|
582
|
+
if (s)
|
|
583
|
+
a = {
|
|
584
|
+
...e.matrixParams,
|
|
585
|
+
first: 1,
|
|
586
|
+
[o]: Array.isArray(s) ? s.join(",") : s
|
|
587
|
+
};
|
|
588
|
+
else {
|
|
589
|
+
const { [o]: i, ...l } = e.matrixParams;
|
|
590
|
+
a = { ...l, first: 1 };
|
|
591
|
+
}
|
|
592
|
+
return {
|
|
593
|
+
...e,
|
|
594
|
+
page: 0,
|
|
595
|
+
matrixParams: a
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
case Y.CHANGE_STARTTIME:
|
|
599
|
+
case Y.CHANGE_FINISHTIME: {
|
|
600
|
+
const { field: o, value: s = [] } = r;
|
|
601
|
+
let a;
|
|
602
|
+
if (s)
|
|
603
|
+
a = {
|
|
604
|
+
...e.queryParams,
|
|
605
|
+
first: 1,
|
|
606
|
+
[o]: s
|
|
607
|
+
};
|
|
608
|
+
else {
|
|
609
|
+
const { [o]: i, ...l } = e.queryParams;
|
|
610
|
+
a = { ...l, first: 1 };
|
|
611
|
+
}
|
|
612
|
+
return {
|
|
613
|
+
...e,
|
|
614
|
+
page: 0,
|
|
615
|
+
queryParams: a
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
case Y.CHANGE_JOBMETADATA: {
|
|
619
|
+
const { field: o, value: s = [] } = r;
|
|
620
|
+
let a;
|
|
621
|
+
if (s.length)
|
|
622
|
+
a = {
|
|
623
|
+
...e.queryParams,
|
|
624
|
+
first: 1,
|
|
625
|
+
[o]: s
|
|
626
|
+
};
|
|
627
|
+
else {
|
|
628
|
+
const { [o]: i, ...l } = e.queryParams;
|
|
629
|
+
a = { ...l, first: 1 };
|
|
630
|
+
}
|
|
631
|
+
return {
|
|
632
|
+
...e,
|
|
633
|
+
page: 0,
|
|
634
|
+
queryParams: a,
|
|
635
|
+
jobMetadata: s
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
default:
|
|
639
|
+
return e;
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
function $n(e) {
|
|
643
|
+
const t = cr(e), [n, r] = fe(ur, t);
|
|
644
|
+
return {
|
|
645
|
+
state: n,
|
|
646
|
+
onChangePage: ({ page: d }) => r({
|
|
647
|
+
type: Y.CHANGE_PAGE,
|
|
648
|
+
page: d
|
|
649
|
+
}),
|
|
650
|
+
onChangeSort: (d, h, f) => {
|
|
651
|
+
const C = typeof h == "object" ? h.value : h;
|
|
652
|
+
r({
|
|
653
|
+
type: Y.CHANGE_SORT,
|
|
654
|
+
field: C,
|
|
655
|
+
order: f
|
|
656
|
+
});
|
|
657
|
+
},
|
|
658
|
+
onChangeType: ({ field: d = [] }) => {
|
|
659
|
+
const [{ name: h = "type", value: f = [] }] = d;
|
|
660
|
+
r({
|
|
661
|
+
type: Y.CHANGE_TYPE,
|
|
662
|
+
field: h,
|
|
663
|
+
value: f.length ? f[0].value : null
|
|
664
|
+
});
|
|
665
|
+
},
|
|
666
|
+
onChangeState: ({ field: d = [] }) => {
|
|
667
|
+
const [{ name: h = "state", value: f = [] }] = d;
|
|
668
|
+
r({
|
|
669
|
+
type: Y.CHANGE_STATE,
|
|
670
|
+
field: h,
|
|
671
|
+
value: f.length ? f[0].value : null
|
|
672
|
+
});
|
|
673
|
+
},
|
|
674
|
+
onChangePriority: ({ field: d = [] }) => {
|
|
675
|
+
const [{ name: h = "priority", value: f = [] }] = d;
|
|
676
|
+
r({
|
|
677
|
+
type: Y.CHANGE_PRIORITY,
|
|
678
|
+
field: h,
|
|
679
|
+
value: f.length ? f[0].value : null
|
|
680
|
+
});
|
|
681
|
+
},
|
|
682
|
+
onChangeStarttime: ({ field: d = [] }) => {
|
|
683
|
+
const [{ name: h = "starttime-from", value: f = [] }] = d;
|
|
684
|
+
r({
|
|
685
|
+
type: Y.CHANGE_STARTTIME,
|
|
686
|
+
field: h,
|
|
687
|
+
value: f.length ? f[0].value : null
|
|
688
|
+
});
|
|
689
|
+
},
|
|
690
|
+
onChangeFinishtime: ({ field: d = [] }) => {
|
|
691
|
+
const [{ name: h = "finishtime-from", value: f = [] }] = d;
|
|
692
|
+
r({
|
|
693
|
+
type: Y.CHANGE_FINISHTIME,
|
|
694
|
+
field: h,
|
|
695
|
+
value: f.length ? f[0].value : null
|
|
696
|
+
});
|
|
697
|
+
},
|
|
698
|
+
onChangeRowsPerPage: ({ target: { value: d } } = {}) => r({
|
|
699
|
+
type: Y.CHANGE_ROWS,
|
|
700
|
+
rowsPerPage: d
|
|
701
|
+
}),
|
|
702
|
+
onChangeJobmetadata: (d) => {
|
|
703
|
+
r({
|
|
704
|
+
type: Y.CHANGE_JOBMETADATA,
|
|
705
|
+
field: "jobmetadata",
|
|
706
|
+
value: d
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
const jn = (e, t) => {
|
|
712
|
+
const [n, r] = M(
|
|
713
|
+
JSON.parse(window.localStorage.getItem(e) || JSON.stringify(t))
|
|
714
|
+
);
|
|
715
|
+
return $(() => {
|
|
716
|
+
window.localStorage.setItem(e, JSON.stringify(n));
|
|
717
|
+
}, [e, n]), [n, r, () => JSON.parse(window.localStorage.getItem(e))];
|
|
718
|
+
};
|
|
719
|
+
function at() {
|
|
720
|
+
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(
|
|
721
|
+
/[018]/g,
|
|
722
|
+
(e) => (
|
|
723
|
+
// eslint-disable-next-line
|
|
724
|
+
(e ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> e / 4).toString(16)
|
|
725
|
+
)
|
|
726
|
+
);
|
|
727
|
+
}
|
|
728
|
+
function lr(e) {
|
|
729
|
+
return wt(e);
|
|
730
|
+
}
|
|
731
|
+
function dr(e) {
|
|
732
|
+
return e.slice(-1) === "=" ? decodeURIComponent(
|
|
733
|
+
atob(e).split("").map((t) => `%${`00${t.charCodeAt(0).toString(16)}`.slice(-2)}`).join("")
|
|
734
|
+
) : Dt(e);
|
|
735
|
+
}
|
|
736
|
+
const fr = ["__mp3_160k"], mr = ["__mp4"], pr = ["__png"], hr = "audio", Er = "video", gr = "image", yr = ["application/mxf"], Ar = [], Cr = [], Sr = (e) => {
|
|
737
|
+
if (!e || !e.type)
|
|
738
|
+
return [];
|
|
739
|
+
const t = e.type.toLowerCase();
|
|
740
|
+
return t.startsWith(hr) || Cr.includes(t) ? fr : t.startsWith(Er) || yr.includes(t) ? mr : t.startsWith(gr) || Ar.includes(t) ? pr : [];
|
|
741
|
+
}, vr = (e, t = {}) => new Promise((n, r) => {
|
|
742
|
+
const o = new Rt(), s = new Pt(e, {
|
|
743
|
+
onFail: (a) => r(a),
|
|
744
|
+
onComplete: (a) => n(a),
|
|
745
|
+
...t
|
|
746
|
+
});
|
|
747
|
+
o.addChunkedUpload(s), o.upload();
|
|
748
|
+
}), Tr = ({
|
|
749
|
+
file: e,
|
|
750
|
+
collectionId: t,
|
|
751
|
+
onProgress: n,
|
|
752
|
+
metadata: r = {},
|
|
753
|
+
placeholderParams: o = {},
|
|
754
|
+
importParams: s = {},
|
|
755
|
+
chunkedUploadProps: a = {},
|
|
756
|
+
generateTransferId: i = at,
|
|
757
|
+
getShapeTags: l = Sr
|
|
758
|
+
}) => new Promise((u, c) => {
|
|
759
|
+
try {
|
|
760
|
+
let p;
|
|
761
|
+
n({});
|
|
762
|
+
const m = l(e), d = e.name, h = e.type, [f] = h.split("/"), C = {
|
|
763
|
+
originalFilename: d,
|
|
764
|
+
mimeType: h,
|
|
765
|
+
mediaType: f,
|
|
766
|
+
...r
|
|
767
|
+
}, v = de(C);
|
|
768
|
+
xe.createImportPlaceholder({
|
|
769
|
+
metadataDocument: v,
|
|
770
|
+
queryParams: {
|
|
771
|
+
container: 1,
|
|
772
|
+
...o
|
|
773
|
+
}
|
|
774
|
+
}).then(({ data: g }) => {
|
|
775
|
+
if (p = g.id, !t)
|
|
776
|
+
return Promise.resolve();
|
|
777
|
+
const y = Array.isArray(t) ? t : [t];
|
|
778
|
+
return Promise.all(
|
|
779
|
+
y.map(
|
|
780
|
+
(S) => j.addCollectionEntity({
|
|
781
|
+
collectionId: S,
|
|
782
|
+
entityId: p
|
|
783
|
+
})
|
|
784
|
+
)
|
|
785
|
+
);
|
|
786
|
+
}).then(() => {
|
|
787
|
+
const g = i(), y = {
|
|
788
|
+
filename: d,
|
|
789
|
+
transferId: g,
|
|
790
|
+
tag: m,
|
|
791
|
+
...s
|
|
792
|
+
};
|
|
793
|
+
return vr(e, {
|
|
794
|
+
api: {
|
|
795
|
+
method: xe.createImportComponentRaw,
|
|
796
|
+
props: {
|
|
797
|
+
itemId: p,
|
|
798
|
+
component: "container",
|
|
799
|
+
queryParams: y
|
|
800
|
+
}
|
|
801
|
+
},
|
|
802
|
+
onProgress: n,
|
|
803
|
+
...a
|
|
804
|
+
});
|
|
805
|
+
}).then((g) => {
|
|
806
|
+
u({ ...g, itemId: p, collectionId: t });
|
|
807
|
+
}).catch((g) => c(g));
|
|
808
|
+
} catch (p) {
|
|
809
|
+
console.error(p), c(p);
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
function Wn({
|
|
813
|
+
onUploadFile: e = Tr,
|
|
814
|
+
initialMetadata: t = {},
|
|
815
|
+
...n
|
|
816
|
+
}) {
|
|
817
|
+
const [r, o] = M([]);
|
|
818
|
+
$(
|
|
819
|
+
() => () => {
|
|
820
|
+
r.forEach((m) => URL.revokeObjectURL(m.preview));
|
|
821
|
+
},
|
|
822
|
+
[r]
|
|
823
|
+
);
|
|
824
|
+
const s = P(
|
|
825
|
+
(m = []) => {
|
|
826
|
+
const d = m.map((h) => ({
|
|
827
|
+
file: h,
|
|
828
|
+
metadata: { title: h.name, ...t }
|
|
829
|
+
}));
|
|
830
|
+
o((h) => d.concat(h));
|
|
831
|
+
},
|
|
832
|
+
[t]
|
|
833
|
+
), a = P(
|
|
834
|
+
(m, d = {}) => {
|
|
835
|
+
o((h) => {
|
|
836
|
+
const f = h[m], { metadata: C, progress: v } = d, { metadata: g = {}, progress: y = {} } = f, S = [...h], R = { ...f };
|
|
837
|
+
return C && (R.metadata = { ...g, ...C }), v && (R.progress = { ...y, ...v }), S[m] = R, S;
|
|
838
|
+
});
|
|
839
|
+
},
|
|
840
|
+
[o]
|
|
841
|
+
), i = P(
|
|
842
|
+
(m) => (d = {}) => {
|
|
843
|
+
a(m, { progress: d });
|
|
844
|
+
},
|
|
845
|
+
[a]
|
|
846
|
+
), l = P(
|
|
847
|
+
(m) => (d = {}) => {
|
|
848
|
+
a(m, { metadata: d });
|
|
849
|
+
},
|
|
850
|
+
[a]
|
|
851
|
+
), u = P(
|
|
852
|
+
(m) => r.reduce(
|
|
853
|
+
(d, h, f) => d.then((C) => h.progress ? d : e({
|
|
854
|
+
file: h.file,
|
|
855
|
+
onProgress: i(f),
|
|
856
|
+
metadata: h.metadata,
|
|
857
|
+
...m,
|
|
858
|
+
...n
|
|
859
|
+
}).then((v) => [...C, v])),
|
|
860
|
+
Promise.resolve([])
|
|
861
|
+
),
|
|
862
|
+
[r, e, i, n]
|
|
863
|
+
), c = P(
|
|
864
|
+
(m) => () => {
|
|
865
|
+
o([...r].filter((d, h) => h !== m));
|
|
866
|
+
},
|
|
867
|
+
[o, r]
|
|
868
|
+
), p = P(
|
|
869
|
+
(m) => () => {
|
|
870
|
+
o([...r].filter((d, h) => !m.includes(h)));
|
|
871
|
+
},
|
|
872
|
+
[o, r]
|
|
873
|
+
);
|
|
874
|
+
return {
|
|
875
|
+
onAddFiles: s,
|
|
876
|
+
onChangeFile: a,
|
|
877
|
+
onChangeMetadata: l,
|
|
878
|
+
onUpload: u,
|
|
879
|
+
onRemoveFile: c,
|
|
880
|
+
onRemoveFiles: p,
|
|
881
|
+
files: r,
|
|
882
|
+
setFiles: o
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
function Vn({
|
|
886
|
+
history: e,
|
|
887
|
+
navigate: t,
|
|
888
|
+
location: n,
|
|
889
|
+
queryName: r = "q",
|
|
890
|
+
defaultState: o = void 0
|
|
891
|
+
}) {
|
|
892
|
+
const s = K(o);
|
|
893
|
+
return { queryInitialState: he(() => {
|
|
894
|
+
const { location: i = n } = e || {}, u = new URLSearchParams(i.search).get(r);
|
|
895
|
+
if (!u)
|
|
896
|
+
return s.current;
|
|
897
|
+
try {
|
|
898
|
+
const c = dr(u);
|
|
899
|
+
return JSON.parse(c);
|
|
900
|
+
} catch {
|
|
901
|
+
e ? e.replace({ pathName: e.location.pathName, search: "" }) : t && t(i.pathName, { replace: !0 });
|
|
902
|
+
}
|
|
903
|
+
}, [e, t, n, r]) };
|
|
904
|
+
}
|
|
905
|
+
function kn({
|
|
906
|
+
history: e,
|
|
907
|
+
navigate: t,
|
|
908
|
+
location: n,
|
|
909
|
+
state: r,
|
|
910
|
+
queryName: o = "q"
|
|
911
|
+
}) {
|
|
912
|
+
const s = P(() => {
|
|
913
|
+
const { location: a = n } = e || {}, i = lr(JSON.stringify(r));
|
|
914
|
+
e ? e.replace({
|
|
915
|
+
pathName: a.pathName,
|
|
916
|
+
search: `?${o}=${i}`
|
|
917
|
+
}) : t && t(`${a.pathName}?${o}=${i}`, { replace: !0 });
|
|
918
|
+
}, [e, t, n, o, r]);
|
|
919
|
+
st(() => {
|
|
920
|
+
s(r);
|
|
921
|
+
}, [s, r]);
|
|
922
|
+
}
|
|
923
|
+
const Yn = ({ entityId: e, entityType: t }) => {
|
|
924
|
+
const {
|
|
925
|
+
request: n,
|
|
926
|
+
data: r = {},
|
|
927
|
+
isLoading: o
|
|
928
|
+
} = W(Pe.listEntityAccess), s = P(
|
|
929
|
+
(l = {}) => n({
|
|
930
|
+
entityId: e,
|
|
931
|
+
entityType: t,
|
|
932
|
+
...l
|
|
933
|
+
}),
|
|
934
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
935
|
+
[e, t]
|
|
936
|
+
), a = P(
|
|
937
|
+
({ accessId: l, ...u }) => Pe.removeEntityAccess({
|
|
938
|
+
accessId: l,
|
|
939
|
+
entityId: e,
|
|
940
|
+
entityType: t,
|
|
941
|
+
...u
|
|
942
|
+
}),
|
|
943
|
+
[e, t]
|
|
944
|
+
), i = P(
|
|
945
|
+
({ accessControlDocument: l, ...u }) => Pe.createEntityAccess({
|
|
946
|
+
entityType: t,
|
|
947
|
+
entityId: e,
|
|
948
|
+
accessControlDocument: l,
|
|
949
|
+
...u
|
|
950
|
+
}),
|
|
951
|
+
[e, t]
|
|
952
|
+
);
|
|
953
|
+
return {
|
|
954
|
+
accessControlList: r,
|
|
955
|
+
isLoading: o,
|
|
956
|
+
onList: s,
|
|
957
|
+
onRemove: a,
|
|
958
|
+
onAdd: i
|
|
959
|
+
};
|
|
960
|
+
}, it = ({ data: e = [] } = {}, t = void 0) => {
|
|
961
|
+
if (!t)
|
|
962
|
+
return;
|
|
963
|
+
const { value: n } = e.find((r) => r.key === t) || {};
|
|
964
|
+
return n;
|
|
965
|
+
}, Rr = (e, t) => Object.assign(
|
|
966
|
+
{},
|
|
967
|
+
...t.map((n) => ({
|
|
968
|
+
[n]: it(e, n)
|
|
969
|
+
}))
|
|
970
|
+
), Pr = ({ values: { field: e } = {} } = {}) => e ? e.map((t) => ({ value: t.value, label: t.key || t.value })) : void 0, Nr = (e) => {
|
|
971
|
+
const n = new DOMParser().parseFromString(e, "application/xml").getElementsByTagName("field");
|
|
972
|
+
if (!n.length)
|
|
973
|
+
return;
|
|
974
|
+
const r = { field: [] };
|
|
975
|
+
for (let o = 0; o < n.length; o += 1) {
|
|
976
|
+
const [s, a] = n[o].childNodes;
|
|
977
|
+
r.field.push({
|
|
978
|
+
[s.nodeName]: s.firstChild.nodeValue,
|
|
979
|
+
[a.nodeName]: a.firstChild.nodeValue
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
return r;
|
|
983
|
+
}, Bn = ({
|
|
984
|
+
fields: e,
|
|
985
|
+
groups: t,
|
|
986
|
+
getDataAttributes: n = Rr,
|
|
987
|
+
fieldDataToInclude: r = "label,displayType,required",
|
|
988
|
+
groupDataToInclude: o = "label,order",
|
|
989
|
+
fieldQueryParams: s = {},
|
|
990
|
+
groupQueryParams: a = {},
|
|
991
|
+
getAttributes: i = !0
|
|
992
|
+
}) => {
|
|
993
|
+
const [l, u] = M(!1), [c, p] = M(e), [m, d] = M(t);
|
|
994
|
+
return Z(() => {
|
|
995
|
+
let h = !1;
|
|
996
|
+
if (i === !1)
|
|
997
|
+
return () => {
|
|
998
|
+
h = !0;
|
|
999
|
+
};
|
|
1000
|
+
const f = (g = [], y = {}) => g.map(({ name: S, ...R }) => {
|
|
1001
|
+
const A = y[S] || {}, { label: N, ...I } = n(
|
|
1002
|
+
A,
|
|
1003
|
+
r.split(",")
|
|
1004
|
+
);
|
|
1005
|
+
return {
|
|
1006
|
+
name: S,
|
|
1007
|
+
label: N || S,
|
|
1008
|
+
type: A.type,
|
|
1009
|
+
constraint: A.constraint,
|
|
1010
|
+
options: Pr(A),
|
|
1011
|
+
...I,
|
|
1012
|
+
...R
|
|
1013
|
+
};
|
|
1014
|
+
}), C = (g = [], y = {}, S = {}) => g.map(({ name: R, field: A, group: N, ...I }) => {
|
|
1015
|
+
const O = y[R] || {}, V = A || O && O.field, k = N || O && O.group, { label: Q, ...re } = n(
|
|
1016
|
+
O,
|
|
1017
|
+
o.split(",")
|
|
1018
|
+
);
|
|
1019
|
+
return {
|
|
1020
|
+
name: R,
|
|
1021
|
+
label: Q || R,
|
|
1022
|
+
order: it(O, "order"),
|
|
1023
|
+
fields: f(V, S),
|
|
1024
|
+
groups: C(k, y, S),
|
|
1025
|
+
...re,
|
|
1026
|
+
...I
|
|
1027
|
+
};
|
|
1028
|
+
});
|
|
1029
|
+
async function v() {
|
|
1030
|
+
u(!0);
|
|
1031
|
+
const g = {}, y = {};
|
|
1032
|
+
let S = [];
|
|
1033
|
+
if (e) {
|
|
1034
|
+
const A = { ...s, data: r };
|
|
1035
|
+
S = e.map(async ({ name: N }) => {
|
|
1036
|
+
try {
|
|
1037
|
+
const { data: I } = await ze.getMetadataField({
|
|
1038
|
+
fieldName: N,
|
|
1039
|
+
queryParams: A
|
|
1040
|
+
});
|
|
1041
|
+
g[N] = I;
|
|
1042
|
+
} catch {
|
|
1043
|
+
console.warn(`Could not retrieve attributes for ${N}`);
|
|
1044
|
+
}
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
let R = [];
|
|
1048
|
+
if (t) {
|
|
1049
|
+
const A = [...t], N = { ...a, data: o };
|
|
1050
|
+
R = A.map(async ({ name: I }) => {
|
|
1051
|
+
try {
|
|
1052
|
+
const { data: O } = await Ke.getFieldGroup({
|
|
1053
|
+
groupName: I,
|
|
1054
|
+
queryParams: N
|
|
1055
|
+
}), { field: V = [], group: k = [] } = O;
|
|
1056
|
+
V.forEach((Q) => {
|
|
1057
|
+
const re = Q.data && Q.data.find((ae) => ae.key === "__values");
|
|
1058
|
+
if (re) {
|
|
1059
|
+
const ae = Nr(re.value);
|
|
1060
|
+
g[Q.name] = { ...Q, values: ae };
|
|
1061
|
+
}
|
|
1062
|
+
}), k.forEach((Q) => {
|
|
1063
|
+
A.push(Q);
|
|
1064
|
+
}), y[I] = O;
|
|
1065
|
+
} catch {
|
|
1066
|
+
console.warn(`Could not retrieve attributes for ${I}`);
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
await Promise.all([...S, ...R]), h || (Object.values(g).some((A) => A) && p(() => f(e, g)), Object.values(y).some((A) => A) && d(() => {
|
|
1071
|
+
const A = C(
|
|
1072
|
+
t,
|
|
1073
|
+
y,
|
|
1074
|
+
g
|
|
1075
|
+
);
|
|
1076
|
+
return A.forEach((N) => {
|
|
1077
|
+
const { order: I } = N;
|
|
1078
|
+
I && N.fields.sort((O, V) => I.indexOf(O.name) - I.indexOf(V.name));
|
|
1079
|
+
}), A;
|
|
1080
|
+
}), u(!1));
|
|
1081
|
+
}
|
|
1082
|
+
return v(), () => {
|
|
1083
|
+
h = !0;
|
|
1084
|
+
};
|
|
1085
|
+
}, [
|
|
1086
|
+
e,
|
|
1087
|
+
t,
|
|
1088
|
+
r,
|
|
1089
|
+
o,
|
|
1090
|
+
s,
|
|
1091
|
+
a,
|
|
1092
|
+
i
|
|
1093
|
+
]), { fieldsWithAttributes: c, groupsWithAttributes: m, isLoading: l };
|
|
1094
|
+
}, Ir = 1e3, _r = "TRANSIENT";
|
|
1095
|
+
function Gr({ metadata: e, markerField: t, markerValue: n, itemSearchDocument: r }) {
|
|
1096
|
+
return ue.searchItem({
|
|
1097
|
+
queryParams: {
|
|
1098
|
+
result: "library",
|
|
1099
|
+
updateMode: _r,
|
|
1100
|
+
updateFrequency: Ir
|
|
1101
|
+
},
|
|
1102
|
+
itemSearchDocument: r
|
|
1103
|
+
}).then(
|
|
1104
|
+
({ data: { library: o } }) => j.createCollection({
|
|
1105
|
+
collectionDocument: {
|
|
1106
|
+
metadata: t ? de({
|
|
1107
|
+
[t]: n || o,
|
|
1108
|
+
...e
|
|
1109
|
+
}) : e,
|
|
1110
|
+
content: [
|
|
1111
|
+
{
|
|
1112
|
+
id: o,
|
|
1113
|
+
type: "library"
|
|
1114
|
+
}
|
|
1115
|
+
]
|
|
1116
|
+
}
|
|
1117
|
+
})
|
|
1118
|
+
);
|
|
1119
|
+
}
|
|
1120
|
+
const ct = ({ collectionId: e }) => new Promise((t, n) => {
|
|
1121
|
+
j.getCollection({ collectionId: e, queryParams: { children: "library" } }).then(
|
|
1122
|
+
({ data: r }) => {
|
|
1123
|
+
const { content: o = [] } = r, [s] = o;
|
|
1124
|
+
s || n(new Error("No Libraries")), t(s);
|
|
1125
|
+
}
|
|
1126
|
+
);
|
|
1127
|
+
}), br = ({ collectionId: e }) => ct({ collectionId: e }).then(
|
|
1128
|
+
({ id: t }) => Promise.all([
|
|
1129
|
+
ge.removeLibrary({ libraryId: t }),
|
|
1130
|
+
j.removeCollection({ collectionId: e })
|
|
1131
|
+
])
|
|
1132
|
+
);
|
|
1133
|
+
function wr({ libraryId: e }) {
|
|
1134
|
+
return new Promise((t) => {
|
|
1135
|
+
ge.getLibrarySettings({ libraryId: e }).then(({ data: { query: n } }) => {
|
|
1136
|
+
t(n);
|
|
1137
|
+
});
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
const Dr = ({ collectionId: e }) => new Promise((t) => {
|
|
1141
|
+
ct({ collectionId: e }).then(({ id: n }) => wr({ libraryId: n })).then(t);
|
|
1142
|
+
});
|
|
1143
|
+
function Qn({
|
|
1144
|
+
markerField: e,
|
|
1145
|
+
markerValue: t,
|
|
1146
|
+
initialSearchState: n,
|
|
1147
|
+
onSaveSearch: r = Gr,
|
|
1148
|
+
onDeleteSearch: o = br,
|
|
1149
|
+
onUpdateSearchMetadata: s = j.updateCollectionMetadata,
|
|
1150
|
+
onGetSavedSearchSettings: a = Dr
|
|
1151
|
+
}) {
|
|
1152
|
+
const i = P(
|
|
1153
|
+
({ metadata: m, itemSearchDocument: d }) => r({
|
|
1154
|
+
metadata: m,
|
|
1155
|
+
markerField: e,
|
|
1156
|
+
markerValue: t,
|
|
1157
|
+
itemSearchDocument: d
|
|
1158
|
+
}),
|
|
1159
|
+
[e, t, r]
|
|
1160
|
+
), l = (m = {}) => ({
|
|
1161
|
+
...m,
|
|
1162
|
+
operator: {
|
|
1163
|
+
field: [
|
|
1164
|
+
{
|
|
1165
|
+
name: e,
|
|
1166
|
+
value: [{ value: t || "*" }]
|
|
1167
|
+
}
|
|
1168
|
+
],
|
|
1169
|
+
operator: m.operator ? [m.operator] : [],
|
|
1170
|
+
operation: "AND"
|
|
1171
|
+
}
|
|
1172
|
+
}), u = Kt({
|
|
1173
|
+
...n,
|
|
1174
|
+
itemSearchDocument: l()
|
|
1175
|
+
}), { setItemSearchDocument: c, ...p } = u;
|
|
1176
|
+
return {
|
|
1177
|
+
onSaveSearch: i,
|
|
1178
|
+
onDeleteSearch: o,
|
|
1179
|
+
onUpdateSearchMetadata: s,
|
|
1180
|
+
onGetSavedSearchSettings: a,
|
|
1181
|
+
searchProps: {
|
|
1182
|
+
setItemSearchDocument: (m) => c(l(m)),
|
|
1183
|
+
...p
|
|
1184
|
+
}
|
|
1185
|
+
};
|
|
1186
|
+
}
|
|
1187
|
+
function Or({ itemSearchDocument: e, queryParams: t, matrixParams: n }) {
|
|
1188
|
+
const {
|
|
1189
|
+
request: r,
|
|
1190
|
+
data: o = {},
|
|
1191
|
+
isLoading: s,
|
|
1192
|
+
isError: a,
|
|
1193
|
+
cancel: i
|
|
1194
|
+
} = W(ue.searchItem), l = () => r({ itemSearchDocument: e, queryParams: t, matrixParams: n });
|
|
1195
|
+
return Z(() => {
|
|
1196
|
+
l();
|
|
1197
|
+
}, [e, t, n]), {
|
|
1198
|
+
itemListType: o,
|
|
1199
|
+
isLoading: s,
|
|
1200
|
+
isError: a,
|
|
1201
|
+
onRefresh: l,
|
|
1202
|
+
cancel: i
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
const Jn = () => {
|
|
1206
|
+
const [e, t] = M({ x: 0, y: 0 });
|
|
1207
|
+
return $(() => {
|
|
1208
|
+
const n = (r) => t({ x: r.clientX, y: r.clientY });
|
|
1209
|
+
return window.addEventListener("mousedown", n), () => {
|
|
1210
|
+
window.removeEventListener("mousedown", n);
|
|
1211
|
+
};
|
|
1212
|
+
}, []), e;
|
|
1213
|
+
};
|
|
1214
|
+
function Hr({
|
|
1215
|
+
collectionId: e,
|
|
1216
|
+
queryParams: t = {},
|
|
1217
|
+
refreshOnMount: n = !0
|
|
1218
|
+
}) {
|
|
1219
|
+
const {
|
|
1220
|
+
request: r,
|
|
1221
|
+
data: o = {},
|
|
1222
|
+
isLoading: s,
|
|
1223
|
+
isError: a
|
|
1224
|
+
} = W(j.getCollection), i = () => r({ collectionId: e, queryParams: t });
|
|
1225
|
+
return Z(() => {
|
|
1226
|
+
n && i();
|
|
1227
|
+
}, [e, t]), {
|
|
1228
|
+
collectionType: o,
|
|
1229
|
+
isLoading: s,
|
|
1230
|
+
isError: a,
|
|
1231
|
+
onRefresh: i
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
function Xn({
|
|
1235
|
+
collectionId: e,
|
|
1236
|
+
queryParams: t = {},
|
|
1237
|
+
refreshOnMount: n = !0
|
|
1238
|
+
}) {
|
|
1239
|
+
const { request: r, data: o = {} } = W(j.getCollectionItem), s = () => r({ collectionId: e, queryParams: t });
|
|
1240
|
+
return Z(() => {
|
|
1241
|
+
n && s();
|
|
1242
|
+
}, [e, t]), {
|
|
1243
|
+
itemListType: o,
|
|
1244
|
+
onRefresh: s
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
const zn = ({ entityId: e, entityType: t }) => {
|
|
1248
|
+
let n, r, o;
|
|
1249
|
+
switch (t) {
|
|
1250
|
+
case "collection":
|
|
1251
|
+
n = "collectionType", o = "collectionId", r = j.getCollection;
|
|
1252
|
+
break;
|
|
1253
|
+
case "library":
|
|
1254
|
+
n = "libraryType", o = "libraryId", r = ge.getLibrary;
|
|
1255
|
+
break;
|
|
1256
|
+
case "item":
|
|
1257
|
+
n = "itemType", o = "itemId", r = ue.getItem;
|
|
1258
|
+
break;
|
|
1259
|
+
default:
|
|
1260
|
+
throw new Error("unknown entityType");
|
|
1261
|
+
}
|
|
1262
|
+
const { request: s, data: a, ...i } = W(r), l = P(
|
|
1263
|
+
(u) => s({ [o]: e, ...u }),
|
|
1264
|
+
[e, o, s]
|
|
1265
|
+
);
|
|
1266
|
+
return {
|
|
1267
|
+
[n]: a,
|
|
1268
|
+
[o]: e,
|
|
1269
|
+
onGetEntity: l,
|
|
1270
|
+
...i
|
|
1271
|
+
};
|
|
1272
|
+
};
|
|
1273
|
+
function Kn(e) {
|
|
1274
|
+
const { data: t, request: n } = W(X.getUser, { data: e }), { userName: r } = t || {}, o = P(() => n({ userName: r }), [n, r]);
|
|
1275
|
+
$(() => {
|
|
1276
|
+
r && o();
|
|
1277
|
+
}, [o, r]);
|
|
1278
|
+
const s = P(
|
|
1279
|
+
({ userDocument: m }) => X.updateUser({
|
|
1280
|
+
userName: r,
|
|
1281
|
+
userDocument: m
|
|
1282
|
+
}).then(() => n({ userName: m.userName })),
|
|
1283
|
+
[n, r]
|
|
1284
|
+
), a = P(
|
|
1285
|
+
({ groups: m = [] }) => X.updateUserGroup({
|
|
1286
|
+
userName: r,
|
|
1287
|
+
groupListDocument: {
|
|
1288
|
+
group: m.map((d) => ({ groupName: d }))
|
|
1289
|
+
}
|
|
1290
|
+
}).then(o),
|
|
1291
|
+
[o, r]
|
|
1292
|
+
), i = P(
|
|
1293
|
+
(m) => te.removeGroupUser({
|
|
1294
|
+
groupName: m,
|
|
1295
|
+
userName: r
|
|
1296
|
+
}).then(o),
|
|
1297
|
+
[o, r]
|
|
1298
|
+
), l = P(
|
|
1299
|
+
(m) => X.updateUser({
|
|
1300
|
+
userName: r,
|
|
1301
|
+
userDocument: {
|
|
1302
|
+
password: m
|
|
1303
|
+
},
|
|
1304
|
+
queryParams: {
|
|
1305
|
+
passwordType: "raw"
|
|
1306
|
+
}
|
|
1307
|
+
}),
|
|
1308
|
+
[r]
|
|
1309
|
+
);
|
|
1310
|
+
return {
|
|
1311
|
+
userType: t,
|
|
1312
|
+
getUser: o,
|
|
1313
|
+
updateUser: s,
|
|
1314
|
+
updateUserGroups: a,
|
|
1315
|
+
removeUserFromGroup: i,
|
|
1316
|
+
disableUser: (m) => X.disableUser({ userName: r, ...m }).then(o),
|
|
1317
|
+
enableUser: (m) => X.enableUser({ userName: r, ...m }).then(o),
|
|
1318
|
+
deleteUser: ({ queryParams: m = {} } = {}) => X.disableUser({ userName: r, queryParams: { hard: !0, ...m } }),
|
|
1319
|
+
changePassword: l
|
|
1320
|
+
};
|
|
1321
|
+
}
|
|
1322
|
+
const Lr = "CHANGE_PAGE", Ur = "CHANGE_ROWS", xr = "CHANGE_SORT", Mr = "CHANGE_QUERY", ce = {
|
|
1323
|
+
CHANGE_PAGE: Lr,
|
|
1324
|
+
CHANGE_ROWS: Ur,
|
|
1325
|
+
CHANGE_SORT: xr,
|
|
1326
|
+
CHANGE_QUERY: Mr
|
|
1327
|
+
}, Fr = ({ queryParams: e = {}, rowsPerPage: t = 10, page: n = 0 } = {}) => ({
|
|
1328
|
+
queryParams: {
|
|
1329
|
+
first: n * t + 1,
|
|
1330
|
+
number: t,
|
|
1331
|
+
...e
|
|
1332
|
+
},
|
|
1333
|
+
rowsPerPage: t,
|
|
1334
|
+
page: n,
|
|
1335
|
+
userSearchDocument: {
|
|
1336
|
+
sort: [
|
|
1337
|
+
{
|
|
1338
|
+
field: "username",
|
|
1339
|
+
order: "ascending"
|
|
1340
|
+
}
|
|
1341
|
+
]
|
|
1342
|
+
}
|
|
1343
|
+
}), qr = (e, t) => {
|
|
1344
|
+
const { type: n } = t;
|
|
1345
|
+
switch (n) {
|
|
1346
|
+
case ce.CHANGE_PAGE: {
|
|
1347
|
+
const { page: r } = t;
|
|
1348
|
+
return {
|
|
1349
|
+
...e,
|
|
1350
|
+
page: r,
|
|
1351
|
+
queryParams: {
|
|
1352
|
+
...e.queryParams,
|
|
1353
|
+
first: r * e.rowsPerPage + 1
|
|
1354
|
+
}
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
case ce.CHANGE_ROWS: {
|
|
1358
|
+
const { rowsPerPage: r } = t;
|
|
1359
|
+
return {
|
|
1360
|
+
...e,
|
|
1361
|
+
rowsPerPage: r,
|
|
1362
|
+
page: 0,
|
|
1363
|
+
queryParams: {
|
|
1364
|
+
...e.queryParams,
|
|
1365
|
+
first: 1,
|
|
1366
|
+
number: r
|
|
1367
|
+
}
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1370
|
+
case ce.CHANGE_QUERY:
|
|
1371
|
+
return {
|
|
1372
|
+
...e,
|
|
1373
|
+
page: 0,
|
|
1374
|
+
userSearchDocument: {
|
|
1375
|
+
...e.userSearchDocument,
|
|
1376
|
+
field: [
|
|
1377
|
+
{
|
|
1378
|
+
name: t.field || "username",
|
|
1379
|
+
value: t.query || ""
|
|
1380
|
+
}
|
|
1381
|
+
]
|
|
1382
|
+
},
|
|
1383
|
+
queryParams: {
|
|
1384
|
+
...e.queryParams,
|
|
1385
|
+
first: 1
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
default:
|
|
1389
|
+
return e;
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
function Zn(e) {
|
|
1393
|
+
const t = Fr(e), [n, r] = fe(qr, t), {
|
|
1394
|
+
data: o,
|
|
1395
|
+
request: s,
|
|
1396
|
+
hasLoaded: a,
|
|
1397
|
+
isError: i
|
|
1398
|
+
} = W(X.searchUser), l = () => s({
|
|
1399
|
+
userSearchDocument: n.userSearchDocument,
|
|
1400
|
+
queryParams: n.queryParams
|
|
1401
|
+
});
|
|
1402
|
+
return $(() => {
|
|
1403
|
+
l();
|
|
1404
|
+
}, [n.queryParams, n.userSearchDocument]), {
|
|
1405
|
+
...n,
|
|
1406
|
+
hasLoaded: a,
|
|
1407
|
+
isError: i,
|
|
1408
|
+
userListDocument: o,
|
|
1409
|
+
onSearchUser: l,
|
|
1410
|
+
onChangePage: ({ page: d }) => r({
|
|
1411
|
+
type: ce.CHANGE_PAGE,
|
|
1412
|
+
page: d
|
|
1413
|
+
}),
|
|
1414
|
+
onChangeSort: (d, h, f) => {
|
|
1415
|
+
const C = typeof h == "object" ? h.value : h;
|
|
1416
|
+
r({
|
|
1417
|
+
type: ce.CHANGE_SORT,
|
|
1418
|
+
field: C,
|
|
1419
|
+
order: f
|
|
1420
|
+
});
|
|
1421
|
+
},
|
|
1422
|
+
onChangeRowsPerPage: ({ target: { value: d } } = {}) => r({
|
|
1423
|
+
type: ce.CHANGE_ROWS,
|
|
1424
|
+
rowsPerPage: d
|
|
1425
|
+
}),
|
|
1426
|
+
onChangeQuery: (d, h) => {
|
|
1427
|
+
r({
|
|
1428
|
+
type: ce.CHANGE_QUERY,
|
|
1429
|
+
field: d,
|
|
1430
|
+
query: h
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
const eo = (e) => {
|
|
1436
|
+
const { request: t, data: n = {}, isLoading: r } = W(te.listGroup), o = () => t(e);
|
|
1437
|
+
return $(() => {
|
|
1438
|
+
o();
|
|
1439
|
+
}, [e]), {
|
|
1440
|
+
onRefresh: o,
|
|
1441
|
+
groupListType: n,
|
|
1442
|
+
isLoading: r
|
|
1443
|
+
};
|
|
1444
|
+
}, to = (e) => {
|
|
1445
|
+
const { request: t, data: n = {}, isLoading: r } = W(X.listUser), o = () => t(e);
|
|
1446
|
+
return $(() => {
|
|
1447
|
+
o();
|
|
1448
|
+
}, [e]), {
|
|
1449
|
+
onRefresh: o,
|
|
1450
|
+
userListType: n,
|
|
1451
|
+
isLoading: r
|
|
1452
|
+
};
|
|
1453
|
+
}, $r = "CHANGE_PAGE", jr = "CHANGE_ROWS", Wr = "CHANGE_SORT", Vr = "CHANGE_QUERY", kr = "HIDE_ROLES", se = {
|
|
1454
|
+
CHANGE_PAGE: $r,
|
|
1455
|
+
CHANGE_ROWS: jr,
|
|
1456
|
+
CHANGE_SORT: Wr,
|
|
1457
|
+
CHANGE_QUERY: Vr,
|
|
1458
|
+
HIDE_ROLES: kr
|
|
1459
|
+
}, Yr = ({ queryParams: e = {}, rowsPerPage: t = 10, page: n = 0 } = {}) => ({
|
|
1460
|
+
queryParams: {
|
|
1461
|
+
first: n * t + 1,
|
|
1462
|
+
number: t,
|
|
1463
|
+
...e
|
|
1464
|
+
},
|
|
1465
|
+
rowsPerPage: t,
|
|
1466
|
+
page: n,
|
|
1467
|
+
groupSearchDocument: {}
|
|
1468
|
+
}), Br = (e, t) => {
|
|
1469
|
+
const { type: n } = t;
|
|
1470
|
+
switch (n) {
|
|
1471
|
+
case se.CHANGE_PAGE: {
|
|
1472
|
+
const { page: r } = t;
|
|
1473
|
+
return {
|
|
1474
|
+
...e,
|
|
1475
|
+
page: r,
|
|
1476
|
+
queryParams: {
|
|
1477
|
+
...e.queryParams,
|
|
1478
|
+
first: r * e.rowsPerPage + 1
|
|
1479
|
+
}
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
case se.CHANGE_ROWS: {
|
|
1483
|
+
const { rowsPerPage: r } = t;
|
|
1484
|
+
return {
|
|
1485
|
+
...e,
|
|
1486
|
+
rowsPerPage: r,
|
|
1487
|
+
page: 0,
|
|
1488
|
+
queryParams: {
|
|
1489
|
+
...e.queryParams,
|
|
1490
|
+
first: 1,
|
|
1491
|
+
number: r
|
|
1492
|
+
}
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
case se.HIDE_ROLES: {
|
|
1496
|
+
const { hideRoles: r } = t, o = r === !0 ? !1 : void 0;
|
|
1497
|
+
return {
|
|
1498
|
+
...e,
|
|
1499
|
+
page: 0,
|
|
1500
|
+
queryParams: {
|
|
1501
|
+
...e.queryParams,
|
|
1502
|
+
first: 1,
|
|
1503
|
+
role: o
|
|
1504
|
+
}
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
case se.CHANGE_QUERY:
|
|
1508
|
+
return {
|
|
1509
|
+
...e,
|
|
1510
|
+
page: 0,
|
|
1511
|
+
groupSearchDocument: {
|
|
1512
|
+
...e.groupSearchDocument,
|
|
1513
|
+
field: [
|
|
1514
|
+
{
|
|
1515
|
+
name: t.field || "groupname",
|
|
1516
|
+
value: t.query || ""
|
|
1517
|
+
}
|
|
1518
|
+
]
|
|
1519
|
+
},
|
|
1520
|
+
queryParams: {
|
|
1521
|
+
...e.queryParams,
|
|
1522
|
+
first: 1
|
|
1523
|
+
}
|
|
1524
|
+
};
|
|
1525
|
+
default:
|
|
1526
|
+
return e;
|
|
1527
|
+
}
|
|
1528
|
+
};
|
|
1529
|
+
function ro(e) {
|
|
1530
|
+
const t = Yr(e), [n, r] = fe(Br, t), {
|
|
1531
|
+
data: o,
|
|
1532
|
+
request: s,
|
|
1533
|
+
hasLoaded: a,
|
|
1534
|
+
isError: i
|
|
1535
|
+
} = W(te.searchGroup), l = () => s({
|
|
1536
|
+
groupSearchDocument: n.groupSearchDocument,
|
|
1537
|
+
queryParams: n.queryParams
|
|
1538
|
+
});
|
|
1539
|
+
return $(() => {
|
|
1540
|
+
l();
|
|
1541
|
+
}, [n.queryParams, n.groupSearchDocument]), {
|
|
1542
|
+
...n,
|
|
1543
|
+
hasLoaded: a,
|
|
1544
|
+
isError: i,
|
|
1545
|
+
groupListDocument: o,
|
|
1546
|
+
onSearchGroup: l,
|
|
1547
|
+
onChangePage: ({ page: h }) => r({
|
|
1548
|
+
type: se.CHANGE_PAGE,
|
|
1549
|
+
page: h
|
|
1550
|
+
}),
|
|
1551
|
+
onChangeSort: (h, f, C) => {
|
|
1552
|
+
const v = typeof f == "object" ? f.value : f;
|
|
1553
|
+
r({
|
|
1554
|
+
type: se.CHANGE_SORT,
|
|
1555
|
+
field: v,
|
|
1556
|
+
order: C
|
|
1557
|
+
});
|
|
1558
|
+
},
|
|
1559
|
+
onChangeRowsPerPage: ({ target: { value: h } } = {}) => r({
|
|
1560
|
+
type: se.CHANGE_ROWS,
|
|
1561
|
+
rowsPerPage: h
|
|
1562
|
+
}),
|
|
1563
|
+
onChangeQuery: (h, f) => {
|
|
1564
|
+
r({
|
|
1565
|
+
type: se.CHANGE_QUERY,
|
|
1566
|
+
field: h,
|
|
1567
|
+
query: f
|
|
1568
|
+
});
|
|
1569
|
+
},
|
|
1570
|
+
onHideRoles: ({ hideRoles: h }) => r({
|
|
1571
|
+
type: se.HIDE_ROLES,
|
|
1572
|
+
hideRoles: h
|
|
1573
|
+
})
|
|
1574
|
+
};
|
|
1575
|
+
}
|
|
1576
|
+
function no(e) {
|
|
1577
|
+
const { data: t, request: n } = W(te.getGroup, { data: e }), { groupName: r } = t || {}, o = P(() => n({ groupName: r }), [n, r]);
|
|
1578
|
+
$(() => {
|
|
1579
|
+
r && o();
|
|
1580
|
+
}, [o, r]);
|
|
1581
|
+
const s = P(
|
|
1582
|
+
({ groupDocument: d }) => te.updateGroup({
|
|
1583
|
+
groupName: r,
|
|
1584
|
+
groupDocument: d
|
|
1585
|
+
}).then(o),
|
|
1586
|
+
[o, r]
|
|
1587
|
+
), a = P(
|
|
1588
|
+
({ groups: d }) => te.updateGroup({
|
|
1589
|
+
groupName: r,
|
|
1590
|
+
groupDocument: {
|
|
1591
|
+
childGroupList: {
|
|
1592
|
+
group: d.map((h) => ({ groupName: h }))
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
}).then(o),
|
|
1596
|
+
[o, r]
|
|
1597
|
+
), i = P(
|
|
1598
|
+
({ groups: d }) => te.updateGroup({
|
|
1599
|
+
groupName: r,
|
|
1600
|
+
groupDocument: {
|
|
1601
|
+
parentGroupList: {
|
|
1602
|
+
group: d.map((h) => ({ groupName: h }))
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
}).then(o),
|
|
1606
|
+
[o, r]
|
|
1607
|
+
), l = P(
|
|
1608
|
+
({ users: d }) => te.updateGroup({
|
|
1609
|
+
groupName: r,
|
|
1610
|
+
groupDocument: {
|
|
1611
|
+
userList: {
|
|
1612
|
+
user: d.map((h) => ({ userName: h }))
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
}).then(o),
|
|
1616
|
+
[o, r]
|
|
1617
|
+
), u = P(
|
|
1618
|
+
(d) => te.removeGroupUser({
|
|
1619
|
+
groupName: r,
|
|
1620
|
+
userName: d
|
|
1621
|
+
}).then(o),
|
|
1622
|
+
[o, r]
|
|
1623
|
+
), c = P(
|
|
1624
|
+
(d) => te.removeGroupChildren({
|
|
1625
|
+
groupName: r,
|
|
1626
|
+
childGroupName: d
|
|
1627
|
+
}).then(o),
|
|
1628
|
+
[o, r]
|
|
1629
|
+
), p = P(
|
|
1630
|
+
(d) => te.removeGroupChildren({
|
|
1631
|
+
groupName: d,
|
|
1632
|
+
childGroupName: r
|
|
1633
|
+
}).then(o),
|
|
1634
|
+
[o, r]
|
|
1635
|
+
), m = P(() => te.removeGroup({ groupName: r }), [r]);
|
|
1636
|
+
return {
|
|
1637
|
+
groupType: t,
|
|
1638
|
+
getGroup: o,
|
|
1639
|
+
updateGroup: s,
|
|
1640
|
+
removeGroup: m,
|
|
1641
|
+
addChildGroups: a,
|
|
1642
|
+
addParentGroups: i,
|
|
1643
|
+
addUsersToGroup: l,
|
|
1644
|
+
removeUserFromGroup: u,
|
|
1645
|
+
removeChildGroup: c,
|
|
1646
|
+
removeFromParentGroup: p
|
|
1647
|
+
};
|
|
1648
|
+
}
|
|
1649
|
+
function Qr({ itemId: e, queryParams: t = {}, refreshOnMount: n = !0 }) {
|
|
1650
|
+
const { request: r, data: o = {}, isLoading: s, isError: a } = W(ue.getItem), i = () => r({ itemId: e, queryParams: t });
|
|
1651
|
+
return Z(() => {
|
|
1652
|
+
n && i();
|
|
1653
|
+
}, [e, t]), {
|
|
1654
|
+
itemType: o,
|
|
1655
|
+
isLoading: s,
|
|
1656
|
+
isError: a,
|
|
1657
|
+
onRefresh: i
|
|
1658
|
+
};
|
|
1659
|
+
}
|
|
1660
|
+
const oo = ({ collectionId: e, defaultEnabled: t = !0 }) => {
|
|
1661
|
+
const [n, r] = M(), [o, s] = M(t), a = (p) => s((m) => p !== void 0 ? p : !m), i = K(), l = K(), u = K(), c = P(
|
|
1662
|
+
({ itemId: p }) => {
|
|
1663
|
+
if (o === !1)
|
|
1664
|
+
return;
|
|
1665
|
+
const m = {
|
|
1666
|
+
field: [
|
|
1667
|
+
{
|
|
1668
|
+
name: "mediaType",
|
|
1669
|
+
value: [{ value: "video" }, { value: "audio" }]
|
|
1670
|
+
}
|
|
1671
|
+
]
|
|
1672
|
+
}, d = ({ first: h, number: f } = {}) => {
|
|
1673
|
+
const { current: C } = i, { current: v } = l;
|
|
1674
|
+
if (!Array.isArray(C)) {
|
|
1675
|
+
Promise.all([
|
|
1676
|
+
j.getCollection({
|
|
1677
|
+
collectionId: e,
|
|
1678
|
+
queryParams: { children: "item" }
|
|
1679
|
+
}),
|
|
1680
|
+
j.searchCollectionItem({
|
|
1681
|
+
collectionId: e,
|
|
1682
|
+
searchDocument: m,
|
|
1683
|
+
queryParams: { first: h, number: f }
|
|
1684
|
+
})
|
|
1685
|
+
]).then(([{ data: A }, { data: N }]) => {
|
|
1686
|
+
const { hits: I, item: O = [] } = N;
|
|
1687
|
+
i.current = O.map(({ id: k }) => k), u.current = I;
|
|
1688
|
+
const { content: V } = A;
|
|
1689
|
+
l.current = V, d({ first: 1, number: 100 });
|
|
1690
|
+
});
|
|
1691
|
+
return;
|
|
1692
|
+
}
|
|
1693
|
+
const { current: g } = u, y = v.findIndex(({ id: A }) => A === p);
|
|
1694
|
+
if (y + 1 === v.length) {
|
|
1695
|
+
r();
|
|
1696
|
+
return;
|
|
1697
|
+
}
|
|
1698
|
+
if (y === -1 && g > C.length) {
|
|
1699
|
+
j.searchCollectionItem({
|
|
1700
|
+
collectionId: e,
|
|
1701
|
+
searchDocument: m,
|
|
1702
|
+
queryParams: { first: h + f, number: f }
|
|
1703
|
+
}).then(({ data: A }) => {
|
|
1704
|
+
const { item: N = [] } = A;
|
|
1705
|
+
i.current.push(...N.map(({ id: I }) => I)), d({ first: h + f, number: f });
|
|
1706
|
+
});
|
|
1707
|
+
return;
|
|
1708
|
+
}
|
|
1709
|
+
const R = v.slice(y + 1).find(({ id: A }) => C.includes(A));
|
|
1710
|
+
r(R);
|
|
1711
|
+
};
|
|
1712
|
+
d();
|
|
1713
|
+
},
|
|
1714
|
+
[e, o]
|
|
1715
|
+
);
|
|
1716
|
+
return {
|
|
1717
|
+
isAutoPlayEnabled: o,
|
|
1718
|
+
toggleAutoPlay: a,
|
|
1719
|
+
setNextPlaying: r,
|
|
1720
|
+
nextPlaying: n,
|
|
1721
|
+
onNext: c
|
|
1722
|
+
};
|
|
1723
|
+
}, Jr = (e) => {
|
|
1724
|
+
const t = [];
|
|
1725
|
+
for (let n = 0; n < e.length; n += 1) {
|
|
1726
|
+
const r = e[n];
|
|
1727
|
+
if (r && typeof r == "string")
|
|
1728
|
+
try {
|
|
1729
|
+
const o = r.split("version")[1].split("/")[1].split("?")[0], s = _t(o);
|
|
1730
|
+
t.push(s);
|
|
1731
|
+
} catch {
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
return t;
|
|
1735
|
+
};
|
|
1736
|
+
function so(e = [], t = 0, n = void 0, r = Jr) {
|
|
1737
|
+
const [o, s] = M(0), [a, i] = M(0), [l, u] = M(!1), [c, p] = M([]), [m, d] = M(), [h, f] = M(0), C = K(
|
|
1738
|
+
rt((A) => {
|
|
1739
|
+
i(A);
|
|
1740
|
+
}, 10)
|
|
1741
|
+
).current, v = (A) => {
|
|
1742
|
+
try {
|
|
1743
|
+
return Math.round(A.getBoundingClientRect().left);
|
|
1744
|
+
} catch {
|
|
1745
|
+
return 0;
|
|
1746
|
+
}
|
|
1747
|
+
}, g = P(
|
|
1748
|
+
(A) => {
|
|
1749
|
+
const N = A.clientX - v(A.currentTarget) - t, I = A.currentTarget.offsetWidth;
|
|
1750
|
+
return N < 0 ? 0 : N > I ? I : N;
|
|
1751
|
+
},
|
|
1752
|
+
[t]
|
|
1753
|
+
), y = (A, N) => {
|
|
1754
|
+
let I = N[0], O = Math.abs(A - I), V = 0;
|
|
1755
|
+
for (let k = 0; k < N.length; k += 1) {
|
|
1756
|
+
const Q = Math.abs(A - N[k]), re = A - N[k] > 0;
|
|
1757
|
+
Q < O && re && (O = Q, I = N[k], V = k);
|
|
1758
|
+
}
|
|
1759
|
+
return V;
|
|
1760
|
+
}, S = (A) => {
|
|
1761
|
+
if (n) {
|
|
1762
|
+
const N = g(A);
|
|
1763
|
+
s(N - 1), h !== A.currentTarget.offsetWidth && f(A.currentTarget.offsetWidth);
|
|
1764
|
+
const I = N / (A.currentTarget.offsetWidth / +n);
|
|
1765
|
+
d(Gt(I));
|
|
1766
|
+
const O = y(
|
|
1767
|
+
I,
|
|
1768
|
+
c.map((V) => V.toSeconds().toFixed(0))
|
|
1769
|
+
);
|
|
1770
|
+
O !== a && C(O);
|
|
1771
|
+
}
|
|
1772
|
+
};
|
|
1773
|
+
return Z(() => {
|
|
1774
|
+
const A = r(e);
|
|
1775
|
+
p(A);
|
|
1776
|
+
}, [e]), {
|
|
1777
|
+
thumbnailIndex: a,
|
|
1778
|
+
thumbnailTimeCode: m,
|
|
1779
|
+
thumbnailWidth: h,
|
|
1780
|
+
showScrub: l,
|
|
1781
|
+
scrubPosition: o,
|
|
1782
|
+
handleShowScrub: (A) => () => {
|
|
1783
|
+
n > 0 && u(A);
|
|
1784
|
+
},
|
|
1785
|
+
onMouseMove: S
|
|
1786
|
+
};
|
|
1787
|
+
}
|
|
1788
|
+
function ao({
|
|
1789
|
+
searchDoc: e,
|
|
1790
|
+
queryParams: t,
|
|
1791
|
+
debounceTime: n,
|
|
1792
|
+
suggestionSettings: r = { maximumSuggestions: 10, accuracy: 1 },
|
|
1793
|
+
triggerLength: o = 1,
|
|
1794
|
+
apiCall: s = ue.searchItem
|
|
1795
|
+
}) {
|
|
1796
|
+
const [a, i] = M(""), l = K(rt(i, n)).current, { data: { autocomplete: u = [] } = {}, request: c } = W(s), { suggestion: p = [] } = u[0] || {};
|
|
1797
|
+
return Z(() => {
|
|
1798
|
+
e && a && a.length >= o && c({
|
|
1799
|
+
body: {
|
|
1800
|
+
...e,
|
|
1801
|
+
suggestion: r,
|
|
1802
|
+
autocomplete: [
|
|
1803
|
+
{
|
|
1804
|
+
text: a
|
|
1805
|
+
}
|
|
1806
|
+
],
|
|
1807
|
+
text: [{ value: a }]
|
|
1808
|
+
},
|
|
1809
|
+
queryParams: { count: !1, number: 0, ...t }
|
|
1810
|
+
});
|
|
1811
|
+
}, [c, a, t, o]), {
|
|
1812
|
+
suggestion: p,
|
|
1813
|
+
handleAutocompleteChange: l
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
1816
|
+
function io() {
|
|
1817
|
+
const {
|
|
1818
|
+
request: e,
|
|
1819
|
+
data: { value: t = [] } = {},
|
|
1820
|
+
isLoading: n
|
|
1821
|
+
} = W(ze.getMetadataFieldAllowedValues);
|
|
1822
|
+
return {
|
|
1823
|
+
getMetadataDataset: (o, s, a) => {
|
|
1824
|
+
o && e({
|
|
1825
|
+
fieldName: o,
|
|
1826
|
+
metadataFieldValueConstraintListDocument: {
|
|
1827
|
+
constraint: s ? [{ field: a, value: s }] : []
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1830
|
+
},
|
|
1831
|
+
dataset: t,
|
|
1832
|
+
isLoading: n
|
|
1833
|
+
};
|
|
1834
|
+
}
|
|
1835
|
+
const Xr = 1e3, zr = "TRANSIENT", Me = (e) => e.find((t) => t.name === "title").value[0].value;
|
|
1836
|
+
function co({
|
|
1837
|
+
childFolders: e = [],
|
|
1838
|
+
queryParams: t = { content: ["metadata"] },
|
|
1839
|
+
markerProps: n = {
|
|
1840
|
+
markerValue: "savedSearch",
|
|
1841
|
+
markerField: "eidr_referentType"
|
|
1842
|
+
},
|
|
1843
|
+
expand: r
|
|
1844
|
+
}) {
|
|
1845
|
+
const [o, s] = M(e), [a, i] = M([]), [l, u] = M(), c = P(() => {
|
|
1846
|
+
Promise.all(
|
|
1847
|
+
o.map(async (f) => {
|
|
1848
|
+
const {
|
|
1849
|
+
data: { content: C, metadata: v = {} }
|
|
1850
|
+
} = await j.getCollection({
|
|
1851
|
+
collectionId: f,
|
|
1852
|
+
queryParams: t
|
|
1853
|
+
}), { field: g } = v.timespan[0];
|
|
1854
|
+
return C && C[0].type === "library" ? {
|
|
1855
|
+
id: f,
|
|
1856
|
+
libraryId: C[0].id,
|
|
1857
|
+
title: Me(g),
|
|
1858
|
+
type: "query",
|
|
1859
|
+
metadata: v
|
|
1860
|
+
} : {
|
|
1861
|
+
id: f,
|
|
1862
|
+
title: Me(g),
|
|
1863
|
+
subFolders: C && C.map((y) => y.id),
|
|
1864
|
+
type: "folder",
|
|
1865
|
+
metadata: v
|
|
1866
|
+
};
|
|
1867
|
+
})
|
|
1868
|
+
).then((f) => {
|
|
1869
|
+
i((C) => [...f, ...C]);
|
|
1870
|
+
}).catch((f) => {
|
|
1871
|
+
u(f);
|
|
1872
|
+
});
|
|
1873
|
+
}, [o, t]), p = (f, C, v, g, y) => {
|
|
1874
|
+
j.createCollection({
|
|
1875
|
+
collectionDocument: {
|
|
1876
|
+
metadata: de({
|
|
1877
|
+
[C]: v,
|
|
1878
|
+
title: g
|
|
1879
|
+
})
|
|
1880
|
+
}
|
|
1881
|
+
}).then(({ data: { id: S } }) => f ? j.updateCollection({
|
|
1882
|
+
collectionId: f,
|
|
1883
|
+
collectionDocument: {
|
|
1884
|
+
content: [
|
|
1885
|
+
{
|
|
1886
|
+
id: S,
|
|
1887
|
+
mode: "add",
|
|
1888
|
+
type: "collection"
|
|
1889
|
+
}
|
|
1890
|
+
]
|
|
1891
|
+
}
|
|
1892
|
+
}).then(({ data: { content: R } }) => {
|
|
1893
|
+
R && (s(
|
|
1894
|
+
R.filter((A) => A.id === S).map((A) => A.id)
|
|
1895
|
+
), y && y());
|
|
1896
|
+
}).catch((R) => {
|
|
1897
|
+
u(R);
|
|
1898
|
+
}) : null).catch((S) => {
|
|
1899
|
+
u(S);
|
|
1900
|
+
});
|
|
1901
|
+
}, m = (f, C, v, g) => {
|
|
1902
|
+
try {
|
|
1903
|
+
ue.searchItem({
|
|
1904
|
+
queryParams: {
|
|
1905
|
+
result: "library",
|
|
1906
|
+
updateMode: zr,
|
|
1907
|
+
updateFrequency: Xr
|
|
1908
|
+
},
|
|
1909
|
+
itemSearchDocument: v
|
|
1910
|
+
}).then(
|
|
1911
|
+
({ data: { library: y } }) => j.createCollection({
|
|
1912
|
+
collectionDocument: {
|
|
1913
|
+
metadata: de({
|
|
1914
|
+
[n.markerField]: n.markerValue,
|
|
1915
|
+
title: C
|
|
1916
|
+
}),
|
|
1917
|
+
content: [
|
|
1918
|
+
{
|
|
1919
|
+
id: y,
|
|
1920
|
+
type: "library"
|
|
1921
|
+
}
|
|
1922
|
+
]
|
|
1923
|
+
}
|
|
1924
|
+
})
|
|
1925
|
+
).then(
|
|
1926
|
+
({ data: { id: y } }) => j.updateCollection({
|
|
1927
|
+
collectionId: f,
|
|
1928
|
+
collectionDocument: {
|
|
1929
|
+
content: [
|
|
1930
|
+
{
|
|
1931
|
+
id: y,
|
|
1932
|
+
mode: "add",
|
|
1933
|
+
type: "collection"
|
|
1934
|
+
}
|
|
1935
|
+
]
|
|
1936
|
+
}
|
|
1937
|
+
}).then(({ data: { content: S } }) => {
|
|
1938
|
+
S && (s(
|
|
1939
|
+
S.filter((R) => R.id === y).map((R) => R.id)
|
|
1940
|
+
), g && g());
|
|
1941
|
+
}).catch((S) => {
|
|
1942
|
+
u(S);
|
|
1943
|
+
})
|
|
1944
|
+
).catch((y) => {
|
|
1945
|
+
u(y);
|
|
1946
|
+
});
|
|
1947
|
+
} catch (y) {
|
|
1948
|
+
u(y);
|
|
1949
|
+
}
|
|
1950
|
+
}, d = (f) => j.removeCollection({ collectionId: f }).catch((C) => {
|
|
1951
|
+
u(C);
|
|
1952
|
+
}), h = (f) => {
|
|
1953
|
+
i((C) => C.filter((v) => v.id !== f));
|
|
1954
|
+
};
|
|
1955
|
+
return Z(() => {
|
|
1956
|
+
o.length > 0 && r && c();
|
|
1957
|
+
}, [o, r]), $(() => {
|
|
1958
|
+
!r && typeof r == "boolean" && (s(() => a.map((f) => f.id)), i([]));
|
|
1959
|
+
}, [r]), {
|
|
1960
|
+
createFolder: p,
|
|
1961
|
+
saveSearch: m,
|
|
1962
|
+
getSubFolders: c,
|
|
1963
|
+
deleteFolder: d,
|
|
1964
|
+
removeItem: h,
|
|
1965
|
+
subFolders: a,
|
|
1966
|
+
setSubFolders: i,
|
|
1967
|
+
setCurrentFolders: s,
|
|
1968
|
+
errors: l
|
|
1969
|
+
};
|
|
1970
|
+
}
|
|
1971
|
+
const uo = ({ collectionId: e, onError: t }) => {
|
|
1972
|
+
const [n, r] = M([]), s = async () => {
|
|
1973
|
+
try {
|
|
1974
|
+
if (!e)
|
|
1975
|
+
throw Error("Missing collectionId");
|
|
1976
|
+
const { data: u = {} } = await j.getCollectionMetadata({
|
|
1977
|
+
collectionId: e,
|
|
1978
|
+
queryParams: {
|
|
1979
|
+
content: "metadata",
|
|
1980
|
+
field: "representativeItems"
|
|
1981
|
+
}
|
|
1982
|
+
}).catch((p) => {
|
|
1983
|
+
t && t(p);
|
|
1984
|
+
}), { representativeItems: c = [] } = tt(u, {
|
|
1985
|
+
flat: !0,
|
|
1986
|
+
includeValueAttributes: !0
|
|
1987
|
+
});
|
|
1988
|
+
r(() => c);
|
|
1989
|
+
} catch (u) {
|
|
1990
|
+
t && t(u);
|
|
1991
|
+
}
|
|
1992
|
+
}, a = async (u) => {
|
|
1993
|
+
try {
|
|
1994
|
+
const c = de({
|
|
1995
|
+
representativeItems: Array.isArray(u) ? u : [u]
|
|
1996
|
+
}), p = await j.updateCollectionMetadata({
|
|
1997
|
+
collectionId: e,
|
|
1998
|
+
metadataDocument: c
|
|
1999
|
+
});
|
|
2000
|
+
return s(), p;
|
|
2001
|
+
} catch (c) {
|
|
2002
|
+
t && t(c);
|
|
2003
|
+
return;
|
|
2004
|
+
}
|
|
2005
|
+
}, i = (u) => a({ value: u, mode: "add" }), l = (u) => {
|
|
2006
|
+
try {
|
|
2007
|
+
const c = n.filter((p) => p.value === u).map((p) => p.uuid);
|
|
2008
|
+
return c.length ? a(
|
|
2009
|
+
c.map((p) => ({ uuid: p, mode: "remove" }))
|
|
2010
|
+
) : void 0;
|
|
2011
|
+
} catch (c) {
|
|
2012
|
+
t && t(c);
|
|
2013
|
+
return;
|
|
2014
|
+
}
|
|
2015
|
+
};
|
|
2016
|
+
return $(() => {
|
|
2017
|
+
s();
|
|
2018
|
+
}, [e]), {
|
|
2019
|
+
representativeItems: n,
|
|
2020
|
+
onRefresh: s,
|
|
2021
|
+
onAdd: i,
|
|
2022
|
+
onRemove: l
|
|
2023
|
+
};
|
|
2024
|
+
};
|
|
2025
|
+
function Kr() {
|
|
2026
|
+
return Nt.listStorage().then((t) => ({
|
|
2027
|
+
id: t.data.storage[0].id,
|
|
2028
|
+
uri: t.data.storage[0].method[0].uri
|
|
2029
|
+
}));
|
|
2030
|
+
}
|
|
2031
|
+
function Zr(e) {
|
|
2032
|
+
return ge.createLibrary({
|
|
2033
|
+
itemListDocument: {
|
|
2034
|
+
item: [
|
|
2035
|
+
...e.item.map(({ id: t }) => ({
|
|
2036
|
+
id: t
|
|
2037
|
+
}))
|
|
2038
|
+
]
|
|
2039
|
+
}
|
|
2040
|
+
});
|
|
2041
|
+
}
|
|
2042
|
+
function en(e, t, n) {
|
|
2043
|
+
const { fileName: r = "output", outputFormat: o = "csv" } = n, { uri: s } = t, { data: { uri: [a] = [] } = {} } = e, l = encodeURIComponent((() => {
|
|
2044
|
+
if (s.includes("s3")) {
|
|
2045
|
+
const [u, c] = s.split("?region");
|
|
2046
|
+
return `${u}${r}.${o}?region${c}`;
|
|
2047
|
+
}
|
|
2048
|
+
return `${s}${r}.${o}`;
|
|
2049
|
+
})());
|
|
2050
|
+
return ge.getLibraryBatch({
|
|
2051
|
+
libraryId: a,
|
|
2052
|
+
queryParams: { destinationUri: l, ...n }
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
const tn = ["FINISHED", "FINISHED_WARNING"], rn = ["FINISHED", "FINISHED_WARNING", "FAILED_TOTAL", "ABORTED"];
|
|
2056
|
+
function ut(e, t, n, r) {
|
|
2057
|
+
const { data: { jobId: o } = {} } = e, { id: s } = t, { fileName: a = "output", outputFormat: i = "csv" } = n, l = `${a}.${i}`;
|
|
2058
|
+
Ze.getJob({ jobId: o }).then(({ data: { status: u } = {} } = {}) => {
|
|
2059
|
+
if (tn.includes(u))
|
|
2060
|
+
try {
|
|
2061
|
+
It.listFileStorage({
|
|
2062
|
+
storageId: s,
|
|
2063
|
+
queryParams: {
|
|
2064
|
+
path: l,
|
|
2065
|
+
methodMetadata: [
|
|
2066
|
+
{ key: "format", value: "SIGNED-AUTO" },
|
|
2067
|
+
{ key: "contentDisposition", value: `attachment;+filename=${l}` }
|
|
2068
|
+
],
|
|
2069
|
+
"noauth-url": !0
|
|
2070
|
+
}
|
|
2071
|
+
}).then((c) => window.open(c.data.file[0].uri[0]));
|
|
2072
|
+
} catch (c) {
|
|
2073
|
+
console.error(`Download error:
|
|
2074
|
+
${c}`), r({ message: "Download failed" });
|
|
2075
|
+
}
|
|
2076
|
+
else
|
|
2077
|
+
rn.includes(u) ? r({ message: "Download failed" }) : setTimeout(() => {
|
|
2078
|
+
ut(e, t, n, r);
|
|
2079
|
+
}, 1e3);
|
|
2080
|
+
});
|
|
2081
|
+
}
|
|
2082
|
+
const lo = ({
|
|
2083
|
+
itemListType: e,
|
|
2084
|
+
queryParams: t,
|
|
2085
|
+
onSuccess: n,
|
|
2086
|
+
onError: r = ({ message: l, error: u }) => console.error(`${l}
|
|
2087
|
+
${u}`),
|
|
2088
|
+
onGetFile: o = ut,
|
|
2089
|
+
onCreateList: s = Zr,
|
|
2090
|
+
onList: a = en,
|
|
2091
|
+
onGetStorage: i = Kr
|
|
2092
|
+
}) => ({ onDownload: () => i().then(
|
|
2093
|
+
(u) => Promise.all([
|
|
2094
|
+
s(e).then((c) => a(c, u, t)).then(n()).then((c) => o(c, u, t, r))
|
|
2095
|
+
])
|
|
2096
|
+
) });
|
|
2097
|
+
function fo(e, t, n, r, o, s, a, i) {
|
|
2098
|
+
const l = n[0].fields.map((d) => d), [u, c] = M(r), p = (d, h, f, C) => {
|
|
2099
|
+
const { value: v } = d.target, y = r.map((S) => S).map((S, R) => f === R ? { ...h, [C]: v } : S);
|
|
2100
|
+
o(y), c(y);
|
|
2101
|
+
}, m = async (d, h) => {
|
|
2102
|
+
const f = de(d), { timespan: C } = f, v = [];
|
|
2103
|
+
C.forEach((R, A) => {
|
|
2104
|
+
const N = {
|
|
2105
|
+
field: [],
|
|
2106
|
+
name: "V3_sport_Team",
|
|
2107
|
+
mode: "add"
|
|
2108
|
+
};
|
|
2109
|
+
R.field.forEach((I) => {
|
|
2110
|
+
N.field.push(I);
|
|
2111
|
+
}), h.includes(A) && v.push(N);
|
|
2112
|
+
});
|
|
2113
|
+
const g = {
|
|
2114
|
+
timespan: [
|
|
2115
|
+
{
|
|
2116
|
+
start: "-INF",
|
|
2117
|
+
end: "+INF",
|
|
2118
|
+
field: [],
|
|
2119
|
+
group: v
|
|
2120
|
+
}
|
|
2121
|
+
]
|
|
2122
|
+
}, y = [...new Set(h)], S = [];
|
|
2123
|
+
y.forEach((R) => {
|
|
2124
|
+
const A = t.itemType.metadata.timespan[0].group.find(
|
|
2125
|
+
(N, I) => R === I
|
|
2126
|
+
);
|
|
2127
|
+
S.push(A.uuid);
|
|
2128
|
+
});
|
|
2129
|
+
try {
|
|
2130
|
+
await S.forEach((R) => setTimeout(Ne.removeMetadata({ metadataUuid: R }), 500)), await ue.updateItemMetadata({
|
|
2131
|
+
itemId: e,
|
|
2132
|
+
metadataDocument: g
|
|
2133
|
+
}), await s(), o(u), a();
|
|
2134
|
+
} catch (R) {
|
|
2135
|
+
i(R);
|
|
2136
|
+
}
|
|
2137
|
+
};
|
|
2138
|
+
return Z(() => {
|
|
2139
|
+
o(t.group);
|
|
2140
|
+
}, [t]), {
|
|
2141
|
+
tableColumns: l,
|
|
2142
|
+
onChange: p,
|
|
2143
|
+
onSubmit: m
|
|
2144
|
+
};
|
|
2145
|
+
}
|
|
2146
|
+
function nn({
|
|
2147
|
+
entity: e,
|
|
2148
|
+
entityId: t,
|
|
2149
|
+
queryParams: n = {},
|
|
2150
|
+
refreshOnMount: r = !0
|
|
2151
|
+
}) {
|
|
2152
|
+
const {
|
|
2153
|
+
request: o,
|
|
2154
|
+
data: s = {},
|
|
2155
|
+
isLoading: a,
|
|
2156
|
+
isError: i
|
|
2157
|
+
} = W(Ne.getEntityMetadata), l = () => o({ entity: e, entityId: t, queryParams: n });
|
|
2158
|
+
return Z(() => {
|
|
2159
|
+
r && l();
|
|
2160
|
+
}, [e, t, n]), {
|
|
2161
|
+
metadataType: s,
|
|
2162
|
+
isLoading: a,
|
|
2163
|
+
isError: i,
|
|
2164
|
+
onRefresh: l
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
2167
|
+
function on({ groupName: e, queryParams: t = {}, refreshOnMount: n = !0 }) {
|
|
2168
|
+
const {
|
|
2169
|
+
request: r,
|
|
2170
|
+
data: o = {},
|
|
2171
|
+
isLoading: s,
|
|
2172
|
+
isError: a
|
|
2173
|
+
} = W(Ke.getFieldGroup), i = () => r({ groupName: e, queryParams: t });
|
|
2174
|
+
return Z(() => {
|
|
2175
|
+
n && i();
|
|
2176
|
+
}, [e, t]), {
|
|
2177
|
+
metadataFieldGroupType: o,
|
|
2178
|
+
isLoading: s,
|
|
2179
|
+
isError: a,
|
|
2180
|
+
onRefresh: i
|
|
2181
|
+
};
|
|
2182
|
+
}
|
|
2183
|
+
function mo({
|
|
2184
|
+
itemType: e,
|
|
2185
|
+
collectionType: t,
|
|
2186
|
+
metadataType: n,
|
|
2187
|
+
joinValue: r = ",",
|
|
2188
|
+
flat: o = !0,
|
|
2189
|
+
groupAsList: s = !0,
|
|
2190
|
+
children: a,
|
|
2191
|
+
...i
|
|
2192
|
+
}) {
|
|
2193
|
+
let l = n;
|
|
2194
|
+
if (e || t) {
|
|
2195
|
+
const m = e || t || {};
|
|
2196
|
+
l = m == null ? void 0 : m.metadata;
|
|
2197
|
+
}
|
|
2198
|
+
const u = he(
|
|
2199
|
+
() => tt(l, { joinValue: r, flat: o, groupAsList: s }),
|
|
2200
|
+
[o, s, r, l]
|
|
2201
|
+
), c = {
|
|
2202
|
+
...i,
|
|
2203
|
+
...u,
|
|
2204
|
+
itemType: e
|
|
2205
|
+
}, p = (m) => oe(m, c);
|
|
2206
|
+
return ne.map(a, p);
|
|
2207
|
+
}
|
|
2208
|
+
function po({
|
|
2209
|
+
itemSearchDocument: e,
|
|
2210
|
+
queryParams: t,
|
|
2211
|
+
matrixParams: n,
|
|
2212
|
+
responseRef: r,
|
|
2213
|
+
initialState: o,
|
|
2214
|
+
children: s
|
|
2215
|
+
}) {
|
|
2216
|
+
const {
|
|
2217
|
+
request: a,
|
|
2218
|
+
data: i = {},
|
|
2219
|
+
isLoading: l,
|
|
2220
|
+
isError: u
|
|
2221
|
+
} = W(j.searchCollection, o, r), c = () => a({ itemSearchDocument: e, queryParams: t, matrixParams: n });
|
|
2222
|
+
Z(() => {
|
|
2223
|
+
c();
|
|
2224
|
+
}, [e, t, n]);
|
|
2225
|
+
const p = {
|
|
2226
|
+
itemSearchDocument: e,
|
|
2227
|
+
matrixParams: n,
|
|
2228
|
+
queryParams: t,
|
|
2229
|
+
collectionListType: i,
|
|
2230
|
+
onRefresh: c,
|
|
2231
|
+
isLoading: l,
|
|
2232
|
+
isError: u
|
|
2233
|
+
}, m = (d) => oe(d, p);
|
|
2234
|
+
return ne.map(s, m);
|
|
2235
|
+
}
|
|
2236
|
+
function ho({ itemSearchDocument: e, queryParams: t, matrixParams: n, children: r }) {
|
|
2237
|
+
const { itemListType: o, onRefresh: s, isLoading: a, isError: i } = Or({
|
|
2238
|
+
itemSearchDocument: e,
|
|
2239
|
+
queryParams: t,
|
|
2240
|
+
matrixParams: n
|
|
2241
|
+
}), l = {
|
|
2242
|
+
itemSearchDocument: e,
|
|
2243
|
+
matrixParams: n,
|
|
2244
|
+
queryParams: t,
|
|
2245
|
+
itemListType: o,
|
|
2246
|
+
onRefresh: s,
|
|
2247
|
+
isLoading: a,
|
|
2248
|
+
isError: i
|
|
2249
|
+
}, u = (c) => oe(c, l);
|
|
2250
|
+
return ne.map(r, u);
|
|
2251
|
+
}
|
|
2252
|
+
function Eo({
|
|
2253
|
+
itemSearchDocument: e,
|
|
2254
|
+
queryParams: t,
|
|
2255
|
+
matrixParams: n,
|
|
2256
|
+
children: r
|
|
2257
|
+
}) {
|
|
2258
|
+
const {
|
|
2259
|
+
request: o,
|
|
2260
|
+
data: s = {},
|
|
2261
|
+
isLoading: a,
|
|
2262
|
+
isError: i
|
|
2263
|
+
} = W(Xe.searchItemCollection), l = () => o({ itemSearchDocument: e, queryParams: t, matrixParams: n });
|
|
2264
|
+
Z(() => {
|
|
2265
|
+
l();
|
|
2266
|
+
}, [e, t, n]);
|
|
2267
|
+
const u = {
|
|
2268
|
+
itemSearchDocument: e,
|
|
2269
|
+
matrixParams: n,
|
|
2270
|
+
queryParams: t,
|
|
2271
|
+
searchResultType: s,
|
|
2272
|
+
onRefresh: l,
|
|
2273
|
+
isLoading: a,
|
|
2274
|
+
isError: i
|
|
2275
|
+
}, c = (p) => oe(p, u);
|
|
2276
|
+
return ne.map(r, c);
|
|
2277
|
+
}
|
|
2278
|
+
function go({ itemId: e, queryParams: t, refreshOnMount: n, children: r }) {
|
|
2279
|
+
const { itemType: o, onRefresh: s, isLoading: a, isError: i } = Qr({
|
|
2280
|
+
itemId: e,
|
|
2281
|
+
queryParams: t,
|
|
2282
|
+
refreshOnMount: n
|
|
2283
|
+
}), l = {
|
|
2284
|
+
itemId: e,
|
|
2285
|
+
queryParams: t,
|
|
2286
|
+
itemType: o,
|
|
2287
|
+
onRefresh: s,
|
|
2288
|
+
isLoading: a,
|
|
2289
|
+
isError: i
|
|
2290
|
+
}, u = (c) => oe(c, l);
|
|
2291
|
+
return ne.map(r, u);
|
|
2292
|
+
}
|
|
2293
|
+
function yo({
|
|
2294
|
+
collectionId: e,
|
|
2295
|
+
queryParams: t,
|
|
2296
|
+
refreshOnMount: n,
|
|
2297
|
+
children: r
|
|
2298
|
+
}) {
|
|
2299
|
+
const { collectionType: o, onRefresh: s, isLoading: a, isError: i } = Hr({
|
|
2300
|
+
collectionId: e,
|
|
2301
|
+
queryParams: t,
|
|
2302
|
+
refreshOnMount: n
|
|
2303
|
+
}), l = {
|
|
2304
|
+
collectionId: e,
|
|
2305
|
+
queryParams: t,
|
|
2306
|
+
collectionType: o,
|
|
2307
|
+
onRefresh: s,
|
|
2308
|
+
isLoading: a,
|
|
2309
|
+
isError: i
|
|
2310
|
+
}, u = (c) => oe(c, l);
|
|
2311
|
+
return ne.map(r, u);
|
|
2312
|
+
}
|
|
2313
|
+
function Ao({ matrixParams: e, queryParams: t, children: n }) {
|
|
2314
|
+
const { request: r, data: o = {}, isLoading: s, isError: a } = W(Ze.listJob), i = () => r({ matrixParams: e, queryParams: t });
|
|
2315
|
+
Z(() => {
|
|
2316
|
+
i();
|
|
2317
|
+
}, [e, t]);
|
|
2318
|
+
const l = {
|
|
2319
|
+
matrixParams: e,
|
|
2320
|
+
queryParams: t,
|
|
2321
|
+
onRefresh: i,
|
|
2322
|
+
isLoading: s,
|
|
2323
|
+
isError: a,
|
|
2324
|
+
jobs: o
|
|
2325
|
+
}, u = (c) => oe(c, l);
|
|
2326
|
+
return ne.map(n, u);
|
|
2327
|
+
}
|
|
2328
|
+
function Co({ entityId: e, entityType: t, queryParams: n, children: r }) {
|
|
2329
|
+
const { request: o, data: s = {}, isLoading: a } = W(Pe.listEntityAccess), i = () => o({ entityId: e, entityType: t, queryParams: n });
|
|
2330
|
+
$(() => {
|
|
2331
|
+
i();
|
|
2332
|
+
}, [e, t, n]);
|
|
2333
|
+
const l = {
|
|
2334
|
+
entityId: e,
|
|
2335
|
+
entityType: t,
|
|
2336
|
+
queryParams: n,
|
|
2337
|
+
accessControlList: s,
|
|
2338
|
+
onRefresh: i,
|
|
2339
|
+
isLoading: a
|
|
2340
|
+
}, u = (c) => oe(c, l);
|
|
2341
|
+
return ne.map(r, u);
|
|
2342
|
+
}
|
|
2343
|
+
class lt extends Je {
|
|
2344
|
+
constructor(t) {
|
|
2345
|
+
super(t);
|
|
2346
|
+
const { serverUrl: n, token: r, username: o, password: s, runAs: a } = t;
|
|
2347
|
+
n && (J.defaultClient.defaults.baseURL = n), r ? J.defaultClient.defaults.headers.Authorization = `token ${r}` : J.defaultClient.defaults.auth = { username: o, password: s }, a && (J.defaultClient.defaults.headers.RunAs = a);
|
|
2348
|
+
}
|
|
2349
|
+
componentDidUpdate(t) {
|
|
2350
|
+
const { serverUrl: n, token: r, username: o, password: s, runAs: a } = this.props;
|
|
2351
|
+
t.serverUrl !== n && (n ? J.defaultClient.defaults.baseURL = n : delete J.defaultClient.defaults.baseURL), t.token !== r && (r ? J.defaultClient.defaults.headers.Authorization = `token ${r}` : delete J.defaultClient.defaults.headers.Authorization), !r && (t.username !== o || t.password !== s) && (J.defaultClient.defaults.auth = { username: o, password: s }), t.runAs !== a && (a ? J.defaultClient.defaults.headers.RunAs = a : delete J.defaultClient.defaults.headers.RunAs);
|
|
2352
|
+
}
|
|
2353
|
+
render() {
|
|
2354
|
+
const { children: t, username: n, serverUrl: r } = this.props, o = { username: n, serverUrl: r }, s = (a) => oe(a, o);
|
|
2355
|
+
return ne.map(t, s);
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
const ye = "VIDISPINE-TOKEN", Ae = "VIDISPINE-USERNAME", Ce = "VIDISPINE-SERVER-URL", Se = "VIDISPINE-REMEMBER-ME", sn = ({ userName: e, password: t, serverUrl: n }) => {
|
|
2359
|
+
n && (J.defaultClient.defaults.baseURL = n);
|
|
2360
|
+
const r = { seconds: 2592e3, autoRefresh: "true" }, o = { password: t, username: e };
|
|
2361
|
+
try {
|
|
2362
|
+
X.getToken({ queryParams: r, headers: o }).then(({ data: s }) => s).catch(({ response: s = {}, message: a = "Unknown error." }) => {
|
|
2363
|
+
let i = a;
|
|
2364
|
+
throw s.status === 401 && (i = "Incorrect Username/Password"), i;
|
|
2365
|
+
});
|
|
2366
|
+
} catch {
|
|
2367
|
+
throw "Incorrect Username/Password";
|
|
2368
|
+
}
|
|
2369
|
+
};
|
|
2370
|
+
function So({
|
|
2371
|
+
LoginComponent: e,
|
|
2372
|
+
LoginProps: t = {},
|
|
2373
|
+
AppComponent: n,
|
|
2374
|
+
AppProps: r = {},
|
|
2375
|
+
onGetToken: o = sn,
|
|
2376
|
+
onSuccess: s,
|
|
2377
|
+
onError: a,
|
|
2378
|
+
cookieOptions: i = {
|
|
2379
|
+
maxAge: 604800,
|
|
2380
|
+
path: "/"
|
|
2381
|
+
},
|
|
2382
|
+
...l
|
|
2383
|
+
}) {
|
|
2384
|
+
const [u, c, p] = nt([
|
|
2385
|
+
ye,
|
|
2386
|
+
Ae,
|
|
2387
|
+
Ce,
|
|
2388
|
+
Se
|
|
2389
|
+
]), {
|
|
2390
|
+
[ye]: m,
|
|
2391
|
+
[Ae]: d,
|
|
2392
|
+
[Ce]: h
|
|
2393
|
+
} = u, f = u[Se] === "true";
|
|
2394
|
+
return m ? /* @__PURE__ */ B(lt, { token: m, username: d, serverUrl: h, children: /* @__PURE__ */ B(n, { onLogout: () => {
|
|
2395
|
+
p(ye, i), f || (p(Ae, i), p(Ce, i), p(Se, i));
|
|
2396
|
+
}, ...l, ...r }) }) : /* @__PURE__ */ B(
|
|
2397
|
+
e,
|
|
2398
|
+
{
|
|
2399
|
+
onLogin: (g) => {
|
|
2400
|
+
let y;
|
|
2401
|
+
try {
|
|
2402
|
+
o(g).then((S) => {
|
|
2403
|
+
const {
|
|
2404
|
+
userName: R,
|
|
2405
|
+
serverUrl: A,
|
|
2406
|
+
rememberMe: N
|
|
2407
|
+
} = g;
|
|
2408
|
+
R && c(Ae, R, i), A && c(Ce, A, i), N && c(Se, N, i), S && c(ye, S, i), s && s(g);
|
|
2409
|
+
}).catch((S) => {
|
|
2410
|
+
if (y = S, a)
|
|
2411
|
+
return a(y);
|
|
2412
|
+
throw y;
|
|
2413
|
+
});
|
|
2414
|
+
} catch (S) {
|
|
2415
|
+
if (y = S, a)
|
|
2416
|
+
return a(y);
|
|
2417
|
+
}
|
|
2418
|
+
return y;
|
|
2419
|
+
},
|
|
2420
|
+
userName: d,
|
|
2421
|
+
serverUrl: h,
|
|
2422
|
+
rememberMe: f,
|
|
2423
|
+
...l,
|
|
2424
|
+
...t
|
|
2425
|
+
}
|
|
2426
|
+
);
|
|
2427
|
+
}
|
|
2428
|
+
function an({ error: e, info: t }) {
|
|
2429
|
+
return /* @__PURE__ */ Ot(
|
|
2430
|
+
"div",
|
|
2431
|
+
{
|
|
2432
|
+
style: {
|
|
2433
|
+
height: "100%",
|
|
2434
|
+
maxHeight: "100vh",
|
|
2435
|
+
width: "100%",
|
|
2436
|
+
maxWidth: "100vw",
|
|
2437
|
+
backgroundColor: "red",
|
|
2438
|
+
color: "white"
|
|
2439
|
+
},
|
|
2440
|
+
children: [
|
|
2441
|
+
e && /* @__PURE__ */ B("div", { children: e.toString() }),
|
|
2442
|
+
t && /* @__PURE__ */ B("div", { children: t.componentStack })
|
|
2443
|
+
]
|
|
2444
|
+
}
|
|
2445
|
+
);
|
|
2446
|
+
}
|
|
2447
|
+
class cn extends Je {
|
|
2448
|
+
constructor(t) {
|
|
2449
|
+
super(t), this.state = { hasError: !1 };
|
|
2450
|
+
}
|
|
2451
|
+
static getDerivedStateFromError(t) {
|
|
2452
|
+
return { error: t, hasError: !0 };
|
|
2453
|
+
}
|
|
2454
|
+
shouldComponentUpdate(t, n) {
|
|
2455
|
+
const { hasError: r, info: o } = this.state, { info: s } = n;
|
|
2456
|
+
return !(o === s && r === !0);
|
|
2457
|
+
}
|
|
2458
|
+
componentDidCatch(t, n) {
|
|
2459
|
+
const { onError: r } = this.props;
|
|
2460
|
+
if (typeof r == "function")
|
|
2461
|
+
try {
|
|
2462
|
+
r(t, n);
|
|
2463
|
+
} catch {
|
|
2464
|
+
return;
|
|
2465
|
+
}
|
|
2466
|
+
this.setState({ info: n });
|
|
2467
|
+
}
|
|
2468
|
+
render() {
|
|
2469
|
+
const { children: t } = this.props, { hasError: n, error: r, info: o } = this.state;
|
|
2470
|
+
return n ? /* @__PURE__ */ B(an, { info: o, error: r }) : t;
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
function vo({ groupName: e, queryParams: t, refreshOnMount: n, children: r }) {
|
|
2474
|
+
const { metadataFieldGroupType: o, onRefresh: s, isLoading: a, isError: i } = on({
|
|
2475
|
+
groupName: e,
|
|
2476
|
+
queryParams: t,
|
|
2477
|
+
refreshOnMount: n
|
|
2478
|
+
}), l = {
|
|
2479
|
+
groupName: e,
|
|
2480
|
+
queryParams: t,
|
|
2481
|
+
metadataFieldGroupType: o,
|
|
2482
|
+
onRefresh: s,
|
|
2483
|
+
isLoading: a,
|
|
2484
|
+
isError: i
|
|
2485
|
+
}, u = (c) => oe(c, l);
|
|
2486
|
+
return ne.map(r, u);
|
|
2487
|
+
}
|
|
2488
|
+
const dt = Ee();
|
|
2489
|
+
function To({ intialState: e = {}, onRefresh: t, userName: n, children: r }) {
|
|
2490
|
+
const [o, s] = M(e);
|
|
2491
|
+
return $(() => {
|
|
2492
|
+
if (n)
|
|
2493
|
+
X.getUserRole({ userName: n }).then(({ data: i }) => {
|
|
2494
|
+
s(i), t && t(i);
|
|
2495
|
+
});
|
|
2496
|
+
else {
|
|
2497
|
+
let i;
|
|
2498
|
+
X.whoAmI().then(({ data: l }) => (i = l, X.getUserRole({ userName: l }))).then(({ data: l }) => {
|
|
2499
|
+
s(l), t && t(l, i);
|
|
2500
|
+
});
|
|
2501
|
+
}
|
|
2502
|
+
}, [n]), /* @__PURE__ */ B(dt.Provider, { value: o, children: r });
|
|
2503
|
+
}
|
|
2504
|
+
function un() {
|
|
2505
|
+
const e = Ie(dt);
|
|
2506
|
+
if (e === void 0)
|
|
2507
|
+
throw new Error("useRoles must be used within RolesContext");
|
|
2508
|
+
return { hasRole: (n) => {
|
|
2509
|
+
if (n === void 0)
|
|
2510
|
+
throw new Error("roleName is undefined");
|
|
2511
|
+
const { group: r } = e;
|
|
2512
|
+
if (!Array.isArray(r))
|
|
2513
|
+
return null;
|
|
2514
|
+
const o = r.map(({ groupName: s }) => s);
|
|
2515
|
+
return o.includes(bt.SUPER_ACCESS_USER) ? !0 : Array.isArray(n) ? n.findIndex((s) => o.includes(s)) > -1 : o.includes(n);
|
|
2516
|
+
}, groupListType: e };
|
|
2517
|
+
}
|
|
2518
|
+
function Ro({ roleName: e, allow: t, deny: n, loading: r }) {
|
|
2519
|
+
if (e === void 0)
|
|
2520
|
+
throw new Error("roleName is undefined");
|
|
2521
|
+
const { hasRole: o } = un(), s = o(e);
|
|
2522
|
+
return _e(t) && s === !0 ? t : _e(n) && s === !1 ? n : _e(r) && s === null ? r : null;
|
|
2523
|
+
}
|
|
2524
|
+
function Po({ providers: e = [], children: t, ...n }) {
|
|
2525
|
+
return e.reduceRight((r, o) => {
|
|
2526
|
+
if (typeof o == "function")
|
|
2527
|
+
return /* @__PURE__ */ B(o, { ...n, children: r });
|
|
2528
|
+
const { provider: s, ...a } = o;
|
|
2529
|
+
return /* @__PURE__ */ B(s, { ...n, ...a, children: r });
|
|
2530
|
+
}, t);
|
|
2531
|
+
}
|
|
2532
|
+
function No({
|
|
2533
|
+
entity: e,
|
|
2534
|
+
entityId: t,
|
|
2535
|
+
queryParams: n,
|
|
2536
|
+
refreshOnMount: r,
|
|
2537
|
+
children: o
|
|
2538
|
+
}) {
|
|
2539
|
+
const { metadataType: s, onRefresh: a, isLoading: i, isError: l } = nn({
|
|
2540
|
+
entity: e,
|
|
2541
|
+
entityId: t,
|
|
2542
|
+
queryParams: n,
|
|
2543
|
+
refreshOnMount: r
|
|
2544
|
+
}), u = {
|
|
2545
|
+
entity: e,
|
|
2546
|
+
entityId: t,
|
|
2547
|
+
queryParams: n,
|
|
2548
|
+
metadataType: s,
|
|
2549
|
+
onRefresh: a,
|
|
2550
|
+
isLoading: i,
|
|
2551
|
+
isError: l
|
|
2552
|
+
};
|
|
2553
|
+
e === "collection" ? u.collectionId = t : e === "item" && (u.itemId = t);
|
|
2554
|
+
const c = (p) => oe(p, u);
|
|
2555
|
+
return ne.map(o, c);
|
|
2556
|
+
}
|
|
2557
|
+
const Io = (e, t = {}) => (n) => /* @__PURE__ */ B(cn, { ...t, children: /* @__PURE__ */ B(e, { ...n }) }), _o = (...e) => e.reduce(
|
|
2558
|
+
(t, n) => (...r) => t(n(...r)),
|
|
2559
|
+
(t) => t
|
|
2560
|
+
), ln = Ee(), dn = (e, { entityId: t, entityType: n, entityTimespan: { start: r, end: o, field: [{ name: s } = {}] = [] } = {} }) => {
|
|
2561
|
+
const a = e.some(
|
|
2562
|
+
(l) => l.entity.id === t && l.entityType === n
|
|
2563
|
+
);
|
|
2564
|
+
let i = !1;
|
|
2565
|
+
return a && e.filter(
|
|
2566
|
+
(u) => u.entity.id === t && u.entityType === n
|
|
2567
|
+
).forEach(
|
|
2568
|
+
({
|
|
2569
|
+
entityTimespan: { start: u, end: c, field: [{ name: p } = {}] = [] } = {}
|
|
2570
|
+
}) => {
|
|
2571
|
+
r === u && o === c && s === p && (i = !0);
|
|
2572
|
+
}
|
|
2573
|
+
), !a || !i;
|
|
2574
|
+
};
|
|
2575
|
+
function Go({
|
|
2576
|
+
onChange: e,
|
|
2577
|
+
children: t,
|
|
2578
|
+
initialState: n = [],
|
|
2579
|
+
allowDuplicates: r = !1,
|
|
2580
|
+
isUniqueBinItem: o = dn
|
|
2581
|
+
}) {
|
|
2582
|
+
const [s, a] = M(n), [i, l] = M(r), u = P(
|
|
2583
|
+
(f) => {
|
|
2584
|
+
if (!f || !["string", "number"].includes(typeof f)) {
|
|
2585
|
+
console.error("BinProvider onDelete called without a binId of the entity to delete");
|
|
2586
|
+
return;
|
|
2587
|
+
}
|
|
2588
|
+
a((C) => {
|
|
2589
|
+
const v = C.filter((g) => g.binId !== f);
|
|
2590
|
+
return e && e(v), v;
|
|
2591
|
+
});
|
|
2592
|
+
},
|
|
2593
|
+
[e]
|
|
2594
|
+
), c = P(() => {
|
|
2595
|
+
a([]), e && e([]);
|
|
2596
|
+
}, [e]), p = (f) => {
|
|
2597
|
+
const [C] = at().split("-");
|
|
2598
|
+
return { binId: C, ...f };
|
|
2599
|
+
}, m = P(
|
|
2600
|
+
({ dragInfo: f = {} } = {}) => {
|
|
2601
|
+
const { entityId: C, entityType: v, entity: g } = f;
|
|
2602
|
+
if (!C || !v || !g)
|
|
2603
|
+
throw new Error("Dragged element needs to have entityId, entityType and entity props");
|
|
2604
|
+
a((y = []) => {
|
|
2605
|
+
if (o(y, f) || i) {
|
|
2606
|
+
const S = [...y, p(f)];
|
|
2607
|
+
return e && e(S), S;
|
|
2608
|
+
}
|
|
2609
|
+
return y;
|
|
2610
|
+
});
|
|
2611
|
+
},
|
|
2612
|
+
[i, o, e]
|
|
2613
|
+
), d = P(
|
|
2614
|
+
({ dragId: f, hoverId: C, originalDragIndex: v }) => {
|
|
2615
|
+
f === void 0 || C === void 0 && v === void 0 || a((g) => {
|
|
2616
|
+
const y = [...g], S = s.findIndex((N) => N.binId === f), R = s.findIndex((N) => N.binId === C), A = R > -1 ? R : v;
|
|
2617
|
+
return [y[A], y[S]] = [
|
|
2618
|
+
y[S],
|
|
2619
|
+
y[A]
|
|
2620
|
+
], e && e(y), y;
|
|
2621
|
+
});
|
|
2622
|
+
},
|
|
2623
|
+
[s, e]
|
|
2624
|
+
), h = he(
|
|
2625
|
+
() => ({
|
|
2626
|
+
setBin: a,
|
|
2627
|
+
bin: s,
|
|
2628
|
+
allowDuplicates: i,
|
|
2629
|
+
setAllowDuplicates: l,
|
|
2630
|
+
onDrop: m,
|
|
2631
|
+
onSort: d,
|
|
2632
|
+
onFind: () => null,
|
|
2633
|
+
onEmptyBin: c,
|
|
2634
|
+
onDelete: u
|
|
2635
|
+
}),
|
|
2636
|
+
[i, s, m, d, u, c]
|
|
2637
|
+
);
|
|
2638
|
+
return /* @__PURE__ */ B(ln.Provider, { value: h, children: t });
|
|
2639
|
+
}
|
|
2640
|
+
var q = {}, Fe = {
|
|
2641
|
+
get exports() {
|
|
2642
|
+
return q;
|
|
2643
|
+
},
|
|
2644
|
+
set exports(e) {
|
|
2645
|
+
q = e;
|
|
2646
|
+
}
|
|
2647
|
+
};
|
|
2648
|
+
/*
|
|
2649
|
+
object-assign
|
|
2650
|
+
(c) Sindre Sorhus
|
|
2651
|
+
@license MIT
|
|
2652
|
+
*/
|
|
2653
|
+
var Ge, qe;
|
|
2654
|
+
function fn() {
|
|
2655
|
+
if (qe)
|
|
2656
|
+
return Ge;
|
|
2657
|
+
qe = 1;
|
|
2658
|
+
var e = Object.getOwnPropertySymbols, t = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
|
|
2659
|
+
function r(s) {
|
|
2660
|
+
if (s == null)
|
|
2661
|
+
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
2662
|
+
return Object(s);
|
|
2663
|
+
}
|
|
2664
|
+
function o() {
|
|
2665
|
+
try {
|
|
2666
|
+
if (!Object.assign)
|
|
2667
|
+
return !1;
|
|
2668
|
+
var s = new String("abc");
|
|
2669
|
+
if (s[5] = "de", Object.getOwnPropertyNames(s)[0] === "5")
|
|
2670
|
+
return !1;
|
|
2671
|
+
for (var a = {}, i = 0; i < 10; i++)
|
|
2672
|
+
a["_" + String.fromCharCode(i)] = i;
|
|
2673
|
+
var l = Object.getOwnPropertyNames(a).map(function(c) {
|
|
2674
|
+
return a[c];
|
|
2675
|
+
});
|
|
2676
|
+
if (l.join("") !== "0123456789")
|
|
2677
|
+
return !1;
|
|
2678
|
+
var u = {};
|
|
2679
|
+
return "abcdefghijklmnopqrst".split("").forEach(function(c) {
|
|
2680
|
+
u[c] = c;
|
|
2681
|
+
}), Object.keys(Object.assign({}, u)).join("") === "abcdefghijklmnopqrst";
|
|
2682
|
+
} catch {
|
|
2683
|
+
return !1;
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
return Ge = o() ? Object.assign : function(s, a) {
|
|
2687
|
+
for (var i, l = r(s), u, c = 1; c < arguments.length; c++) {
|
|
2688
|
+
i = Object(arguments[c]);
|
|
2689
|
+
for (var p in i)
|
|
2690
|
+
t.call(i, p) && (l[p] = i[p]);
|
|
2691
|
+
if (e) {
|
|
2692
|
+
u = e(i);
|
|
2693
|
+
for (var m = 0; m < u.length; m++)
|
|
2694
|
+
n.call(i, u[m]) && (l[u[m]] = i[u[m]]);
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
return l;
|
|
2698
|
+
}, Ge;
|
|
2699
|
+
}
|
|
2700
|
+
var be, $e;
|
|
2701
|
+
function Le() {
|
|
2702
|
+
if ($e)
|
|
2703
|
+
return be;
|
|
2704
|
+
$e = 1;
|
|
2705
|
+
var e = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
2706
|
+
return be = e, be;
|
|
2707
|
+
}
|
|
2708
|
+
var we, je;
|
|
2709
|
+
function ft() {
|
|
2710
|
+
return je || (je = 1, we = Function.call.bind(Object.prototype.hasOwnProperty)), we;
|
|
2711
|
+
}
|
|
2712
|
+
var De, We;
|
|
2713
|
+
function mn() {
|
|
2714
|
+
if (We)
|
|
2715
|
+
return De;
|
|
2716
|
+
We = 1;
|
|
2717
|
+
var e = function() {
|
|
2718
|
+
};
|
|
2719
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2720
|
+
var t = Le(), n = {}, r = ft();
|
|
2721
|
+
e = function(s) {
|
|
2722
|
+
var a = "Warning: " + s;
|
|
2723
|
+
typeof console < "u" && console.error(a);
|
|
2724
|
+
try {
|
|
2725
|
+
throw new Error(a);
|
|
2726
|
+
} catch {
|
|
2727
|
+
}
|
|
2728
|
+
};
|
|
2729
|
+
}
|
|
2730
|
+
function o(s, a, i, l, u) {
|
|
2731
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2732
|
+
for (var c in s)
|
|
2733
|
+
if (r(s, c)) {
|
|
2734
|
+
var p;
|
|
2735
|
+
try {
|
|
2736
|
+
if (typeof s[c] != "function") {
|
|
2737
|
+
var m = Error(
|
|
2738
|
+
(l || "React class") + ": " + i + " type `" + c + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof s[c] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
|
|
2739
|
+
);
|
|
2740
|
+
throw m.name = "Invariant Violation", m;
|
|
2741
|
+
}
|
|
2742
|
+
p = s[c](a, c, l, i, null, t);
|
|
2743
|
+
} catch (h) {
|
|
2744
|
+
p = h;
|
|
2745
|
+
}
|
|
2746
|
+
if (p && !(p instanceof Error) && e(
|
|
2747
|
+
(l || "React class") + ": type specification of " + i + " `" + c + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof p + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
|
|
2748
|
+
), p instanceof Error && !(p.message in n)) {
|
|
2749
|
+
n[p.message] = !0;
|
|
2750
|
+
var d = u ? u() : "";
|
|
2751
|
+
e(
|
|
2752
|
+
"Failed " + i + " type: " + p.message + (d ?? "")
|
|
2753
|
+
);
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
return o.resetWarningCache = function() {
|
|
2759
|
+
process.env.NODE_ENV !== "production" && (n = {});
|
|
2760
|
+
}, De = o, De;
|
|
2761
|
+
}
|
|
2762
|
+
var Oe, Ve;
|
|
2763
|
+
function pn() {
|
|
2764
|
+
if (Ve)
|
|
2765
|
+
return Oe;
|
|
2766
|
+
Ve = 1;
|
|
2767
|
+
var e = ot, t = fn(), n = Le(), r = ft(), o = mn(), s = function() {
|
|
2768
|
+
};
|
|
2769
|
+
process.env.NODE_ENV !== "production" && (s = function(i) {
|
|
2770
|
+
var l = "Warning: " + i;
|
|
2771
|
+
typeof console < "u" && console.error(l);
|
|
2772
|
+
try {
|
|
2773
|
+
throw new Error(l);
|
|
2774
|
+
} catch {
|
|
2775
|
+
}
|
|
2776
|
+
});
|
|
2777
|
+
function a() {
|
|
2778
|
+
return null;
|
|
2779
|
+
}
|
|
2780
|
+
return Oe = function(i, l) {
|
|
2781
|
+
var u = typeof Symbol == "function" && Symbol.iterator, c = "@@iterator";
|
|
2782
|
+
function p(E) {
|
|
2783
|
+
var T = E && (u && E[u] || E[c]);
|
|
2784
|
+
if (typeof T == "function")
|
|
2785
|
+
return T;
|
|
2786
|
+
}
|
|
2787
|
+
var m = "<<anonymous>>", d = {
|
|
2788
|
+
array: v("array"),
|
|
2789
|
+
bigint: v("bigint"),
|
|
2790
|
+
bool: v("boolean"),
|
|
2791
|
+
func: v("function"),
|
|
2792
|
+
number: v("number"),
|
|
2793
|
+
object: v("object"),
|
|
2794
|
+
string: v("string"),
|
|
2795
|
+
symbol: v("symbol"),
|
|
2796
|
+
any: g(),
|
|
2797
|
+
arrayOf: y,
|
|
2798
|
+
element: S(),
|
|
2799
|
+
elementType: R(),
|
|
2800
|
+
instanceOf: A,
|
|
2801
|
+
node: V(),
|
|
2802
|
+
objectOf: I,
|
|
2803
|
+
oneOf: N,
|
|
2804
|
+
oneOfType: O,
|
|
2805
|
+
shape: Q,
|
|
2806
|
+
exact: re
|
|
2807
|
+
};
|
|
2808
|
+
function h(E, T) {
|
|
2809
|
+
return E === T ? E !== 0 || 1 / E === 1 / T : E !== E && T !== T;
|
|
2810
|
+
}
|
|
2811
|
+
function f(E, T) {
|
|
2812
|
+
this.message = E, this.data = T && typeof T == "object" ? T : {}, this.stack = "";
|
|
2813
|
+
}
|
|
2814
|
+
f.prototype = Error.prototype;
|
|
2815
|
+
function C(E) {
|
|
2816
|
+
if (process.env.NODE_ENV !== "production")
|
|
2817
|
+
var T = {}, D = 0;
|
|
2818
|
+
function b(H, G, w, L, F, U, ee) {
|
|
2819
|
+
if (L = L || m, U = U || w, ee !== n) {
|
|
2820
|
+
if (l) {
|
|
2821
|
+
var z = new Error(
|
|
2822
|
+
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
|
|
2823
|
+
);
|
|
2824
|
+
throw z.name = "Invariant Violation", z;
|
|
2825
|
+
} else if (process.env.NODE_ENV !== "production" && typeof console < "u") {
|
|
2826
|
+
var le = L + ":" + w;
|
|
2827
|
+
!T[le] && // Avoid spamming the console because they are often not actionable except for lib authors
|
|
2828
|
+
D < 3 && (s(
|
|
2829
|
+
"You are manually calling a React.PropTypes validation function for the `" + U + "` prop on `" + L + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
|
|
2830
|
+
), T[le] = !0, D++);
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
return G[w] == null ? H ? G[w] === null ? new f("The " + F + " `" + U + "` is marked as required " + ("in `" + L + "`, but its value is `null`.")) : new f("The " + F + " `" + U + "` is marked as required in " + ("`" + L + "`, but its value is `undefined`.")) : null : E(G, w, L, F, U);
|
|
2834
|
+
}
|
|
2835
|
+
var _ = b.bind(null, !1);
|
|
2836
|
+
return _.isRequired = b.bind(null, !0), _;
|
|
2837
|
+
}
|
|
2838
|
+
function v(E) {
|
|
2839
|
+
function T(D, b, _, H, G, w) {
|
|
2840
|
+
var L = D[b], F = ie(L);
|
|
2841
|
+
if (F !== E) {
|
|
2842
|
+
var U = me(L);
|
|
2843
|
+
return new f(
|
|
2844
|
+
"Invalid " + H + " `" + G + "` of type " + ("`" + U + "` supplied to `" + _ + "`, expected ") + ("`" + E + "`."),
|
|
2845
|
+
{ expectedType: E }
|
|
2846
|
+
);
|
|
2847
|
+
}
|
|
2848
|
+
return null;
|
|
2849
|
+
}
|
|
2850
|
+
return C(T);
|
|
2851
|
+
}
|
|
2852
|
+
function g() {
|
|
2853
|
+
return C(a);
|
|
2854
|
+
}
|
|
2855
|
+
function y(E) {
|
|
2856
|
+
function T(D, b, _, H, G) {
|
|
2857
|
+
if (typeof E != "function")
|
|
2858
|
+
return new f("Property `" + G + "` of component `" + _ + "` has invalid PropType notation inside arrayOf.");
|
|
2859
|
+
var w = D[b];
|
|
2860
|
+
if (!Array.isArray(w)) {
|
|
2861
|
+
var L = ie(w);
|
|
2862
|
+
return new f("Invalid " + H + " `" + G + "` of type " + ("`" + L + "` supplied to `" + _ + "`, expected an array."));
|
|
2863
|
+
}
|
|
2864
|
+
for (var F = 0; F < w.length; F++) {
|
|
2865
|
+
var U = E(w, F, _, H, G + "[" + F + "]", n);
|
|
2866
|
+
if (U instanceof Error)
|
|
2867
|
+
return U;
|
|
2868
|
+
}
|
|
2869
|
+
return null;
|
|
2870
|
+
}
|
|
2871
|
+
return C(T);
|
|
2872
|
+
}
|
|
2873
|
+
function S() {
|
|
2874
|
+
function E(T, D, b, _, H) {
|
|
2875
|
+
var G = T[D];
|
|
2876
|
+
if (!i(G)) {
|
|
2877
|
+
var w = ie(G);
|
|
2878
|
+
return new f("Invalid " + _ + " `" + H + "` of type " + ("`" + w + "` supplied to `" + b + "`, expected a single ReactElement."));
|
|
2879
|
+
}
|
|
2880
|
+
return null;
|
|
2881
|
+
}
|
|
2882
|
+
return C(E);
|
|
2883
|
+
}
|
|
2884
|
+
function R() {
|
|
2885
|
+
function E(T, D, b, _, H) {
|
|
2886
|
+
var G = T[D];
|
|
2887
|
+
if (!e.isValidElementType(G)) {
|
|
2888
|
+
var w = ie(G);
|
|
2889
|
+
return new f("Invalid " + _ + " `" + H + "` of type " + ("`" + w + "` supplied to `" + b + "`, expected a single ReactElement type."));
|
|
2890
|
+
}
|
|
2891
|
+
return null;
|
|
2892
|
+
}
|
|
2893
|
+
return C(E);
|
|
2894
|
+
}
|
|
2895
|
+
function A(E) {
|
|
2896
|
+
function T(D, b, _, H, G) {
|
|
2897
|
+
if (!(D[b] instanceof E)) {
|
|
2898
|
+
var w = E.name || m, L = Tt(D[b]);
|
|
2899
|
+
return new f("Invalid " + H + " `" + G + "` of type " + ("`" + L + "` supplied to `" + _ + "`, expected ") + ("instance of `" + w + "`."));
|
|
2900
|
+
}
|
|
2901
|
+
return null;
|
|
2902
|
+
}
|
|
2903
|
+
return C(T);
|
|
2904
|
+
}
|
|
2905
|
+
function N(E) {
|
|
2906
|
+
if (!Array.isArray(E))
|
|
2907
|
+
return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? s(
|
|
2908
|
+
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
|
|
2909
|
+
) : s("Invalid argument supplied to oneOf, expected an array.")), a;
|
|
2910
|
+
function T(D, b, _, H, G) {
|
|
2911
|
+
for (var w = D[b], L = 0; L < E.length; L++)
|
|
2912
|
+
if (h(w, E[L]))
|
|
2913
|
+
return null;
|
|
2914
|
+
var F = JSON.stringify(E, function(ee, z) {
|
|
2915
|
+
var le = me(z);
|
|
2916
|
+
return le === "symbol" ? String(z) : z;
|
|
2917
|
+
});
|
|
2918
|
+
return new f("Invalid " + H + " `" + G + "` of value `" + String(w) + "` " + ("supplied to `" + _ + "`, expected one of " + F + "."));
|
|
2919
|
+
}
|
|
2920
|
+
return C(T);
|
|
2921
|
+
}
|
|
2922
|
+
function I(E) {
|
|
2923
|
+
function T(D, b, _, H, G) {
|
|
2924
|
+
if (typeof E != "function")
|
|
2925
|
+
return new f("Property `" + G + "` of component `" + _ + "` has invalid PropType notation inside objectOf.");
|
|
2926
|
+
var w = D[b], L = ie(w);
|
|
2927
|
+
if (L !== "object")
|
|
2928
|
+
return new f("Invalid " + H + " `" + G + "` of type " + ("`" + L + "` supplied to `" + _ + "`, expected an object."));
|
|
2929
|
+
for (var F in w)
|
|
2930
|
+
if (r(w, F)) {
|
|
2931
|
+
var U = E(w, F, _, H, G + "." + F, n);
|
|
2932
|
+
if (U instanceof Error)
|
|
2933
|
+
return U;
|
|
2934
|
+
}
|
|
2935
|
+
return null;
|
|
2936
|
+
}
|
|
2937
|
+
return C(T);
|
|
2938
|
+
}
|
|
2939
|
+
function O(E) {
|
|
2940
|
+
if (!Array.isArray(E))
|
|
2941
|
+
return process.env.NODE_ENV !== "production" && s("Invalid argument supplied to oneOfType, expected an instance of array."), a;
|
|
2942
|
+
for (var T = 0; T < E.length; T++) {
|
|
2943
|
+
var D = E[T];
|
|
2944
|
+
if (typeof D != "function")
|
|
2945
|
+
return s(
|
|
2946
|
+
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + vt(D) + " at index " + T + "."
|
|
2947
|
+
), a;
|
|
2948
|
+
}
|
|
2949
|
+
function b(_, H, G, w, L) {
|
|
2950
|
+
for (var F = [], U = 0; U < E.length; U++) {
|
|
2951
|
+
var ee = E[U], z = ee(_, H, G, w, L, n);
|
|
2952
|
+
if (z == null)
|
|
2953
|
+
return null;
|
|
2954
|
+
z.data && r(z.data, "expectedType") && F.push(z.data.expectedType);
|
|
2955
|
+
}
|
|
2956
|
+
var le = F.length > 0 ? ", expected one of type [" + F.join(", ") + "]" : "";
|
|
2957
|
+
return new f("Invalid " + w + " `" + L + "` supplied to " + ("`" + G + "`" + le + "."));
|
|
2958
|
+
}
|
|
2959
|
+
return C(b);
|
|
2960
|
+
}
|
|
2961
|
+
function V() {
|
|
2962
|
+
function E(T, D, b, _, H) {
|
|
2963
|
+
return ae(T[D]) ? null : new f("Invalid " + _ + " `" + H + "` supplied to " + ("`" + b + "`, expected a ReactNode."));
|
|
2964
|
+
}
|
|
2965
|
+
return C(E);
|
|
2966
|
+
}
|
|
2967
|
+
function k(E, T, D, b, _) {
|
|
2968
|
+
return new f(
|
|
2969
|
+
(E || "React class") + ": " + T + " type `" + D + "." + b + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + _ + "`."
|
|
2970
|
+
);
|
|
2971
|
+
}
|
|
2972
|
+
function Q(E) {
|
|
2973
|
+
function T(D, b, _, H, G) {
|
|
2974
|
+
var w = D[b], L = ie(w);
|
|
2975
|
+
if (L !== "object")
|
|
2976
|
+
return new f("Invalid " + H + " `" + G + "` of type `" + L + "` " + ("supplied to `" + _ + "`, expected `object`."));
|
|
2977
|
+
for (var F in E) {
|
|
2978
|
+
var U = E[F];
|
|
2979
|
+
if (typeof U != "function")
|
|
2980
|
+
return k(_, H, G, F, me(U));
|
|
2981
|
+
var ee = U(w, F, _, H, G + "." + F, n);
|
|
2982
|
+
if (ee)
|
|
2983
|
+
return ee;
|
|
2984
|
+
}
|
|
2985
|
+
return null;
|
|
2986
|
+
}
|
|
2987
|
+
return C(T);
|
|
2988
|
+
}
|
|
2989
|
+
function re(E) {
|
|
2990
|
+
function T(D, b, _, H, G) {
|
|
2991
|
+
var w = D[b], L = ie(w);
|
|
2992
|
+
if (L !== "object")
|
|
2993
|
+
return new f("Invalid " + H + " `" + G + "` of type `" + L + "` " + ("supplied to `" + _ + "`, expected `object`."));
|
|
2994
|
+
var F = t({}, D[b], E);
|
|
2995
|
+
for (var U in F) {
|
|
2996
|
+
var ee = E[U];
|
|
2997
|
+
if (r(E, U) && typeof ee != "function")
|
|
2998
|
+
return k(_, H, G, U, me(ee));
|
|
2999
|
+
if (!ee)
|
|
3000
|
+
return new f(
|
|
3001
|
+
"Invalid " + H + " `" + G + "` key `" + U + "` supplied to `" + _ + "`.\nBad object: " + JSON.stringify(D[b], null, " ") + `
|
|
3002
|
+
Valid keys: ` + JSON.stringify(Object.keys(E), null, " ")
|
|
3003
|
+
);
|
|
3004
|
+
var z = ee(w, U, _, H, G + "." + U, n);
|
|
3005
|
+
if (z)
|
|
3006
|
+
return z;
|
|
3007
|
+
}
|
|
3008
|
+
return null;
|
|
3009
|
+
}
|
|
3010
|
+
return C(T);
|
|
3011
|
+
}
|
|
3012
|
+
function ae(E) {
|
|
3013
|
+
switch (typeof E) {
|
|
3014
|
+
case "number":
|
|
3015
|
+
case "string":
|
|
3016
|
+
case "undefined":
|
|
3017
|
+
return !0;
|
|
3018
|
+
case "boolean":
|
|
3019
|
+
return !E;
|
|
3020
|
+
case "object":
|
|
3021
|
+
if (Array.isArray(E))
|
|
3022
|
+
return E.every(ae);
|
|
3023
|
+
if (E === null || i(E))
|
|
3024
|
+
return !0;
|
|
3025
|
+
var T = p(E);
|
|
3026
|
+
if (T) {
|
|
3027
|
+
var D = T.call(E), b;
|
|
3028
|
+
if (T !== E.entries) {
|
|
3029
|
+
for (; !(b = D.next()).done; )
|
|
3030
|
+
if (!ae(b.value))
|
|
3031
|
+
return !1;
|
|
3032
|
+
} else
|
|
3033
|
+
for (; !(b = D.next()).done; ) {
|
|
3034
|
+
var _ = b.value;
|
|
3035
|
+
if (_ && !ae(_[1]))
|
|
3036
|
+
return !1;
|
|
3037
|
+
}
|
|
3038
|
+
} else
|
|
3039
|
+
return !1;
|
|
3040
|
+
return !0;
|
|
3041
|
+
default:
|
|
3042
|
+
return !1;
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
function St(E, T) {
|
|
3046
|
+
return E === "symbol" ? !0 : T ? T["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && T instanceof Symbol : !1;
|
|
3047
|
+
}
|
|
3048
|
+
function ie(E) {
|
|
3049
|
+
var T = typeof E;
|
|
3050
|
+
return Array.isArray(E) ? "array" : E instanceof RegExp ? "object" : St(T, E) ? "symbol" : T;
|
|
3051
|
+
}
|
|
3052
|
+
function me(E) {
|
|
3053
|
+
if (typeof E > "u" || E === null)
|
|
3054
|
+
return "" + E;
|
|
3055
|
+
var T = ie(E);
|
|
3056
|
+
if (T === "object") {
|
|
3057
|
+
if (E instanceof Date)
|
|
3058
|
+
return "date";
|
|
3059
|
+
if (E instanceof RegExp)
|
|
3060
|
+
return "regexp";
|
|
3061
|
+
}
|
|
3062
|
+
return T;
|
|
3063
|
+
}
|
|
3064
|
+
function vt(E) {
|
|
3065
|
+
var T = me(E);
|
|
3066
|
+
switch (T) {
|
|
3067
|
+
case "array":
|
|
3068
|
+
case "object":
|
|
3069
|
+
return "an " + T;
|
|
3070
|
+
case "boolean":
|
|
3071
|
+
case "date":
|
|
3072
|
+
case "regexp":
|
|
3073
|
+
return "a " + T;
|
|
3074
|
+
default:
|
|
3075
|
+
return T;
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
function Tt(E) {
|
|
3079
|
+
return !E.constructor || !E.constructor.name ? m : E.constructor.name;
|
|
3080
|
+
}
|
|
3081
|
+
return d.checkPropTypes = o, d.resetWarningCache = o.resetWarningCache, d.PropTypes = d, d;
|
|
3082
|
+
}, Oe;
|
|
3083
|
+
}
|
|
3084
|
+
var He, ke;
|
|
3085
|
+
function hn() {
|
|
3086
|
+
if (ke)
|
|
3087
|
+
return He;
|
|
3088
|
+
ke = 1;
|
|
3089
|
+
var e = Le();
|
|
3090
|
+
function t() {
|
|
3091
|
+
}
|
|
3092
|
+
function n() {
|
|
3093
|
+
}
|
|
3094
|
+
return n.resetWarningCache = t, He = function() {
|
|
3095
|
+
function r(a, i, l, u, c, p) {
|
|
3096
|
+
if (p !== e) {
|
|
3097
|
+
var m = new Error(
|
|
3098
|
+
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
|
|
3099
|
+
);
|
|
3100
|
+
throw m.name = "Invariant Violation", m;
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
r.isRequired = r;
|
|
3104
|
+
function o() {
|
|
3105
|
+
return r;
|
|
3106
|
+
}
|
|
3107
|
+
var s = {
|
|
3108
|
+
array: r,
|
|
3109
|
+
bigint: r,
|
|
3110
|
+
bool: r,
|
|
3111
|
+
func: r,
|
|
3112
|
+
number: r,
|
|
3113
|
+
object: r,
|
|
3114
|
+
string: r,
|
|
3115
|
+
symbol: r,
|
|
3116
|
+
any: r,
|
|
3117
|
+
arrayOf: o,
|
|
3118
|
+
element: r,
|
|
3119
|
+
elementType: r,
|
|
3120
|
+
instanceOf: o,
|
|
3121
|
+
node: r,
|
|
3122
|
+
objectOf: o,
|
|
3123
|
+
oneOf: o,
|
|
3124
|
+
oneOfType: o,
|
|
3125
|
+
shape: o,
|
|
3126
|
+
exact: o,
|
|
3127
|
+
checkPropTypes: n,
|
|
3128
|
+
resetWarningCache: t
|
|
3129
|
+
};
|
|
3130
|
+
return s.PropTypes = s, s;
|
|
3131
|
+
}, He;
|
|
3132
|
+
}
|
|
3133
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3134
|
+
var En = ot, gn = !0;
|
|
3135
|
+
Fe.exports = pn()(En.isElement, gn);
|
|
3136
|
+
} else
|
|
3137
|
+
Fe.exports = hn()();
|
|
3138
|
+
const mt = Ee(), pt = Ee(), Ue = "UPDATE_ALL_SETTINGS", ht = "UPDATE_SETTING", Et = "UPDATE_USERNAME", gt = "REMOVE_SETTING", yn = (e, t) => {
|
|
3139
|
+
switch (t.type) {
|
|
3140
|
+
case Et:
|
|
3141
|
+
return { ...e, userName: t.userName };
|
|
3142
|
+
case Ue:
|
|
3143
|
+
return { ...e, settings: t.settings };
|
|
3144
|
+
case ht: {
|
|
3145
|
+
const n = { ...e.settings, ...t.setting };
|
|
3146
|
+
return { ...e, settings: n };
|
|
3147
|
+
}
|
|
3148
|
+
case gt: {
|
|
3149
|
+
const n = { ...e.settings };
|
|
3150
|
+
return delete n[t.key], { ...e, settings: n };
|
|
3151
|
+
}
|
|
3152
|
+
default:
|
|
3153
|
+
return e;
|
|
3154
|
+
}
|
|
3155
|
+
};
|
|
3156
|
+
function yt({
|
|
3157
|
+
userName: e,
|
|
3158
|
+
settingsKey: t,
|
|
3159
|
+
children: n,
|
|
3160
|
+
initialSettings: r,
|
|
3161
|
+
onChange: o,
|
|
3162
|
+
getSettingsApi: s,
|
|
3163
|
+
updateSettingsApi: a
|
|
3164
|
+
}) {
|
|
3165
|
+
const [i, l] = fe(yn, {
|
|
3166
|
+
settings: r,
|
|
3167
|
+
userName: e
|
|
3168
|
+
}), u = K();
|
|
3169
|
+
return $(() => {
|
|
3170
|
+
const { userName: c } = i;
|
|
3171
|
+
!s || !c || s({
|
|
3172
|
+
entityType: "user",
|
|
3173
|
+
entityId: c,
|
|
3174
|
+
key: t
|
|
3175
|
+
}).then(({ data: p }) => {
|
|
3176
|
+
l({
|
|
3177
|
+
type: Ue,
|
|
3178
|
+
settings: p,
|
|
3179
|
+
userName: c,
|
|
3180
|
+
settingsKey: t
|
|
3181
|
+
}), u.current = JSON.stringify(p);
|
|
3182
|
+
}).catch((p) => {
|
|
3183
|
+
const { response: m } = p;
|
|
3184
|
+
if (m.status !== 404)
|
|
3185
|
+
throw new Error(p);
|
|
3186
|
+
});
|
|
3187
|
+
}, [i.userName]), $(() => {
|
|
3188
|
+
o && o(i.settings);
|
|
3189
|
+
const { userName: c } = i;
|
|
3190
|
+
if (!a || !c)
|
|
3191
|
+
return;
|
|
3192
|
+
const p = JSON.stringify(i.settings), m = u.current;
|
|
3193
|
+
!m || p === m || (a({
|
|
3194
|
+
entityType: "user",
|
|
3195
|
+
entityId: c,
|
|
3196
|
+
key: t,
|
|
3197
|
+
value: p
|
|
3198
|
+
}), u.current = p);
|
|
3199
|
+
}, [i.settings]), /* @__PURE__ */ B(pt.Provider, { value: i, children: /* @__PURE__ */ B(mt.Provider, { value: l, children: n }) });
|
|
3200
|
+
}
|
|
3201
|
+
const An = () => {
|
|
3202
|
+
const e = Ie(pt);
|
|
3203
|
+
if (!e)
|
|
3204
|
+
throw new Error("useSettingsState must be used within SettingsStateContext");
|
|
3205
|
+
return e;
|
|
3206
|
+
}, Cn = () => {
|
|
3207
|
+
const e = Ie(mt);
|
|
3208
|
+
if (!e)
|
|
3209
|
+
throw new Error("useSettingsDispatch must be used within SettingsDispatchContext");
|
|
3210
|
+
return e;
|
|
3211
|
+
}, Sn = () => {
|
|
3212
|
+
const e = Cn(), t = P(
|
|
3213
|
+
(s) => e({ type: Ue, settings: s }),
|
|
3214
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3215
|
+
[]
|
|
3216
|
+
), n = P(
|
|
3217
|
+
(s) => e({ type: ht, setting: s }),
|
|
3218
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3219
|
+
[]
|
|
3220
|
+
), r = P(
|
|
3221
|
+
(s) => e({ type: Et, userName: s }),
|
|
3222
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3223
|
+
[]
|
|
3224
|
+
), o = P((s) => e({ type: gt, key: s }), []);
|
|
3225
|
+
return {
|
|
3226
|
+
updateAllSettings: t,
|
|
3227
|
+
updateSetting: n,
|
|
3228
|
+
updateUsername: r,
|
|
3229
|
+
removeSetting: o
|
|
3230
|
+
};
|
|
3231
|
+
}, bo = () => {
|
|
3232
|
+
const { settings: e = {} } = An();
|
|
3233
|
+
return {
|
|
3234
|
+
...Sn(),
|
|
3235
|
+
settings: e
|
|
3236
|
+
};
|
|
3237
|
+
};
|
|
3238
|
+
yt.propTypes = {
|
|
3239
|
+
userName: q.string,
|
|
3240
|
+
settingsKey: q.string,
|
|
3241
|
+
children: q.objectOf(q.any),
|
|
3242
|
+
initialSettings: q.objectOf(q.any),
|
|
3243
|
+
onChange: q.func,
|
|
3244
|
+
getSettingsApi: q.func,
|
|
3245
|
+
updateSettingsApi: q.func
|
|
3246
|
+
};
|
|
3247
|
+
yt.defaultProps = {
|
|
3248
|
+
userName: void 0,
|
|
3249
|
+
settingsKey: void 0,
|
|
3250
|
+
children: null,
|
|
3251
|
+
initialSettings: {},
|
|
3252
|
+
onChange: null,
|
|
3253
|
+
getSettingsApi: Ne.getSimpleMetadataKey,
|
|
3254
|
+
updateSettingsApi: Ne.updateSimpleMetadataKey
|
|
3255
|
+
};
|
|
3256
|
+
const ve = "VIDISPINE-TOKEN", pe = "VIDISPINE-USERNAME", Te = "VIDISPINE-SERVER-URL", Re = "VIDISPINE-REMEMBER-ME", vn = "Incorrect username or password", Ye = "Offline or CORS not configured", Be = "Session expired", Tn = "VIDISPINE_URL mismatch", Qe = (e) => {
|
|
3257
|
+
try {
|
|
3258
|
+
return et.getSelfTest({ baseURL: e }).then(() => vn).catch(() => Ye);
|
|
3259
|
+
} catch {
|
|
3260
|
+
return Promise.resolve(Ye);
|
|
3261
|
+
}
|
|
3262
|
+
}, Rn = ({ maxAge: e = 60, userName: t, password: n, serverUrl: r }) => {
|
|
3263
|
+
try {
|
|
3264
|
+
return X.getToken({
|
|
3265
|
+
queryParams: { seconds: e, autoRefresh: "true" },
|
|
3266
|
+
headers: { password: n, username: t },
|
|
3267
|
+
baseURL: r
|
|
3268
|
+
}).then(({ data: o }) => o).catch(
|
|
3269
|
+
() => Qe(r).then((o) => {
|
|
3270
|
+
throw Error(o);
|
|
3271
|
+
})
|
|
3272
|
+
);
|
|
3273
|
+
} catch {
|
|
3274
|
+
return Qe(r).then((s) => {
|
|
3275
|
+
throw Error(s);
|
|
3276
|
+
});
|
|
3277
|
+
}
|
|
3278
|
+
}, At = Ee({
|
|
3279
|
+
serverUrl: null,
|
|
3280
|
+
token: null,
|
|
3281
|
+
userType: null,
|
|
3282
|
+
userName: null,
|
|
3283
|
+
onLogin: () => null,
|
|
3284
|
+
onLogout: () => null
|
|
3285
|
+
});
|
|
3286
|
+
function Ct({
|
|
3287
|
+
cookieOptions: e,
|
|
3288
|
+
LoginComponent: t,
|
|
3289
|
+
LoginProps: n,
|
|
3290
|
+
onGetToken: r,
|
|
3291
|
+
onSuccess: o,
|
|
3292
|
+
onError: s,
|
|
3293
|
+
serverUrl: a,
|
|
3294
|
+
userName: i,
|
|
3295
|
+
token: l,
|
|
3296
|
+
children: u
|
|
3297
|
+
}) {
|
|
3298
|
+
const { data: c, request: p } = W(X.getUser), [m, d, h] = nt([
|
|
3299
|
+
ve,
|
|
3300
|
+
pe,
|
|
3301
|
+
Te,
|
|
3302
|
+
Re
|
|
3303
|
+
]), {
|
|
3304
|
+
[ve]: f = l,
|
|
3305
|
+
[pe]: C = i,
|
|
3306
|
+
[Te]: v = a
|
|
3307
|
+
} = m, g = m[Re] === "true", { maxAge: y } = e, S = P(
|
|
3308
|
+
(I) => {
|
|
3309
|
+
let O;
|
|
3310
|
+
try {
|
|
3311
|
+
return r({ maxAge: y, ...I }).then((V) => {
|
|
3312
|
+
const {
|
|
3313
|
+
userName: k,
|
|
3314
|
+
serverUrl: Q,
|
|
3315
|
+
rememberMe: re
|
|
3316
|
+
} = I;
|
|
3317
|
+
k && d(pe, k, e), Q && d(Te, Q, e), re && d(Re, re, e), V && d(ve, V, e), p({ userName: k }), o && o(I);
|
|
3318
|
+
}).catch((V) => {
|
|
3319
|
+
O = V, s && s(O);
|
|
3320
|
+
});
|
|
3321
|
+
} catch (V) {
|
|
3322
|
+
O = V, s && s(O);
|
|
3323
|
+
}
|
|
3324
|
+
return O;
|
|
3325
|
+
},
|
|
3326
|
+
[e, y, s, r, o, p, d]
|
|
3327
|
+
), R = P(() => {
|
|
3328
|
+
h(ve, e), g || (h(pe, e), h(Te, e), h(Re, e));
|
|
3329
|
+
}, [e, g, h]), A = K();
|
|
3330
|
+
$(() => (f && (A.current && J.defaultClient.interceptors.response.eject(A.current), A.current = J.defaultClient.interceptors.response.use(
|
|
3331
|
+
(I) => I,
|
|
3332
|
+
(I) => {
|
|
3333
|
+
if (I.response)
|
|
3334
|
+
I.response.status === 401 && (R(), s && s(Error(Be)));
|
|
3335
|
+
else {
|
|
3336
|
+
const { config: { baseURL: O } = {} } = I;
|
|
3337
|
+
et.getSelfTest({ baseURL: O }).then(() => {
|
|
3338
|
+
R(), s && s(Error(Be));
|
|
3339
|
+
}).catch(() => null);
|
|
3340
|
+
}
|
|
3341
|
+
return Promise.reject(I);
|
|
3342
|
+
}
|
|
3343
|
+
)), () => {
|
|
3344
|
+
A.current && J.defaultClient.interceptors.response.eject(A.current);
|
|
3345
|
+
}), [R, s, f]), $(() => {
|
|
3346
|
+
f && C === void 0 && X.whoAmI().then(
|
|
3347
|
+
({ data: I }) => d(pe, I, e)
|
|
3348
|
+
);
|
|
3349
|
+
}, [C, f]), $(() => {
|
|
3350
|
+
f && v && a && v !== a && (R(), s && s(Error(Tn)));
|
|
3351
|
+
}, [f, v, a, R, s]);
|
|
3352
|
+
const N = he(
|
|
3353
|
+
() => ({
|
|
3354
|
+
serverUrl: v,
|
|
3355
|
+
token: f,
|
|
3356
|
+
userType: c,
|
|
3357
|
+
userName: C,
|
|
3358
|
+
onLogin: S,
|
|
3359
|
+
onLogout: R
|
|
3360
|
+
}),
|
|
3361
|
+
[S, R, v, f, C, c]
|
|
3362
|
+
);
|
|
3363
|
+
return f ? /* @__PURE__ */ B(lt, { token: f, username: C, serverUrl: v, children: /* @__PURE__ */ B(At.Provider, { value: N, children: u }) }) : /* @__PURE__ */ B(
|
|
3364
|
+
t,
|
|
3365
|
+
{
|
|
3366
|
+
onLogin: S,
|
|
3367
|
+
userName: C,
|
|
3368
|
+
serverUrl: v,
|
|
3369
|
+
rememberMe: g,
|
|
3370
|
+
...n
|
|
3371
|
+
}
|
|
3372
|
+
);
|
|
3373
|
+
}
|
|
3374
|
+
Ct.propTypes = {
|
|
3375
|
+
cookieOptions: q.shape({
|
|
3376
|
+
maxAge: q.number,
|
|
3377
|
+
path: q.string
|
|
3378
|
+
}),
|
|
3379
|
+
LoginComponent: q.elementType.isRequired,
|
|
3380
|
+
LoginProps: q.objectOf(q.any),
|
|
3381
|
+
onGetToken: q.func,
|
|
3382
|
+
children: q.oneOfType([q.arrayOf(q.element), q.element]),
|
|
3383
|
+
onSuccess: q.func,
|
|
3384
|
+
onError: q.func,
|
|
3385
|
+
serverUrl: q.string.isRequired,
|
|
3386
|
+
userName: q.string,
|
|
3387
|
+
token: q.string
|
|
3388
|
+
};
|
|
3389
|
+
Ct.defaultProps = {
|
|
3390
|
+
cookieOptions: {
|
|
3391
|
+
maxAge: 604800,
|
|
3392
|
+
path: "/"
|
|
3393
|
+
},
|
|
3394
|
+
LoginProps: {},
|
|
3395
|
+
onGetToken: Rn,
|
|
3396
|
+
children: null,
|
|
3397
|
+
onSuccess: null,
|
|
3398
|
+
onError: null,
|
|
3399
|
+
userName: null,
|
|
3400
|
+
token: null
|
|
3401
|
+
};
|
|
3402
|
+
const wo = () => {
|
|
3403
|
+
const e = Ie(At);
|
|
3404
|
+
if (e === void 0)
|
|
3405
|
+
throw new Error("useAuth must be used within an AuthContext");
|
|
3406
|
+
return e;
|
|
3407
|
+
}, Pn = ({ entityId: e, entityType: t, collectionId: n, rootParentId: r, onError: o }) => {
|
|
3408
|
+
if (n && n !== r)
|
|
3409
|
+
try {
|
|
3410
|
+
return j.addCollectionEntity({
|
|
3411
|
+
collectionId: n,
|
|
3412
|
+
entityId: e,
|
|
3413
|
+
queryParams: {
|
|
3414
|
+
type: t.toLowerCase()
|
|
3415
|
+
}
|
|
3416
|
+
});
|
|
3417
|
+
} catch (s) {
|
|
3418
|
+
o({
|
|
3419
|
+
message: `Could not add ${e} to collection ${n}`,
|
|
3420
|
+
error: s
|
|
3421
|
+
});
|
|
3422
|
+
}
|
|
3423
|
+
}, Nn = ({
|
|
3424
|
+
entityId: e,
|
|
3425
|
+
entityType: t,
|
|
3426
|
+
collectionId: n,
|
|
3427
|
+
rootParentId: r,
|
|
3428
|
+
onError: o
|
|
3429
|
+
}) => {
|
|
3430
|
+
if (n && n !== r)
|
|
3431
|
+
try {
|
|
3432
|
+
return j.removeCollectionEntity({
|
|
3433
|
+
collectionId: n,
|
|
3434
|
+
entityId: e,
|
|
3435
|
+
queryParams: {
|
|
3436
|
+
type: t.toLowerCase()
|
|
3437
|
+
}
|
|
3438
|
+
});
|
|
3439
|
+
} catch (s) {
|
|
3440
|
+
o({
|
|
3441
|
+
message: `Could not remove ${e} from collection ${n}`,
|
|
3442
|
+
error: s
|
|
3443
|
+
});
|
|
3444
|
+
}
|
|
3445
|
+
}, Do = ({
|
|
3446
|
+
entityId: e,
|
|
3447
|
+
entityType: t,
|
|
3448
|
+
addToCollectionId: n,
|
|
3449
|
+
removeFromCollectionId: r,
|
|
3450
|
+
rootParentId: o,
|
|
3451
|
+
onAddEntity: s = Pn,
|
|
3452
|
+
onRemoveEntity: a = Nn,
|
|
3453
|
+
onMoved: i = () => null,
|
|
3454
|
+
onAdded: l = () => null,
|
|
3455
|
+
onRemoved: u = () => null,
|
|
3456
|
+
// eslint-disable-next-line no-console
|
|
3457
|
+
onError: c = ({ message: p, error: m }) => console.error(`${p}
|
|
3458
|
+
${m}`)
|
|
3459
|
+
}) => {
|
|
3460
|
+
if (!n) {
|
|
3461
|
+
c({ message: "Missing the collection id to add entity to", error: "" });
|
|
3462
|
+
return;
|
|
3463
|
+
}
|
|
3464
|
+
if (!r) {
|
|
3465
|
+
c({ message: "Missing the collection id to remove entity from", error: "" });
|
|
3466
|
+
return;
|
|
3467
|
+
}
|
|
3468
|
+
try {
|
|
3469
|
+
const p = s({
|
|
3470
|
+
entityId: e,
|
|
3471
|
+
entityType: t,
|
|
3472
|
+
rootParentId: o,
|
|
3473
|
+
collectionId: n,
|
|
3474
|
+
onError: c
|
|
3475
|
+
}), m = a({
|
|
3476
|
+
entityId: e,
|
|
3477
|
+
entityType: t,
|
|
3478
|
+
rootParentId: o,
|
|
3479
|
+
collectionId: r,
|
|
3480
|
+
onError: c
|
|
3481
|
+
}), d = [p, m].filter((h) => h !== void 0);
|
|
3482
|
+
Promise.allSettled(d).then((h) => {
|
|
3483
|
+
const f = h.filter((y) => y.status !== "fulfilled"), C = f.length === 0, v = f.length === d.length, g = f.length === 1;
|
|
3484
|
+
if (C)
|
|
3485
|
+
i(), l(), u();
|
|
3486
|
+
else if (v)
|
|
3487
|
+
c({
|
|
3488
|
+
message: `Could not move ${e} from ${r} to ${n}`,
|
|
3489
|
+
error: f.map((y) => y.reason).join(`
|
|
3490
|
+
`)
|
|
3491
|
+
});
|
|
3492
|
+
else if (g) {
|
|
3493
|
+
const y = f[0].reason.config.method, S = y === "delete", R = y === "put";
|
|
3494
|
+
c({
|
|
3495
|
+
message: S ? `Could not remove ${e} from collection ${r}` : `Could not add ${e} to collection ${n}`,
|
|
3496
|
+
error: f[0].reason
|
|
3497
|
+
});
|
|
3498
|
+
let A;
|
|
3499
|
+
S ? A = a({
|
|
3500
|
+
entityId: e,
|
|
3501
|
+
entityType: t,
|
|
3502
|
+
collectionId: n,
|
|
3503
|
+
onError: c
|
|
3504
|
+
}) : R && (A = s({
|
|
3505
|
+
entityId: e,
|
|
3506
|
+
entityType: t,
|
|
3507
|
+
collectionId: r,
|
|
3508
|
+
onError: c
|
|
3509
|
+
})), A && A.then(() => {
|
|
3510
|
+
console.info(
|
|
3511
|
+
`Rollbacked moving ${e} from ${r} to ${n}`
|
|
3512
|
+
);
|
|
3513
|
+
}).catch((N) => {
|
|
3514
|
+
c({ message: "Could not rollback after moving entity", error: N });
|
|
3515
|
+
});
|
|
3516
|
+
}
|
|
3517
|
+
}).catch((h) => {
|
|
3518
|
+
c({
|
|
3519
|
+
message: `Could not add ${e} to collection ${n}`,
|
|
3520
|
+
error: h
|
|
3521
|
+
});
|
|
3522
|
+
});
|
|
3523
|
+
} catch (p) {
|
|
3524
|
+
c({
|
|
3525
|
+
message: `Could not move ${e} from ${r} to collection ${n}`,
|
|
3526
|
+
error: p
|
|
3527
|
+
});
|
|
3528
|
+
}
|
|
3529
|
+
};
|
|
3530
|
+
function Oo({
|
|
3531
|
+
children: e,
|
|
3532
|
+
setDrag: t,
|
|
3533
|
+
onDrop: n,
|
|
3534
|
+
onDragEnter: r,
|
|
3535
|
+
onDragOver: o,
|
|
3536
|
+
onDragLeave: s,
|
|
3537
|
+
style: a
|
|
3538
|
+
}) {
|
|
3539
|
+
const [i, l] = M(0), u = (d) => {
|
|
3540
|
+
d.preventDefault(), d.stopPropagation(), t(!1), n && n(d);
|
|
3541
|
+
}, c = (d) => {
|
|
3542
|
+
d.preventDefault(), d.stopPropagation(), l(i + 1), i === 0 && t(!0), r && r(d);
|
|
3543
|
+
}, p = (d) => {
|
|
3544
|
+
d.preventDefault(), d.stopPropagation(), o && o(d);
|
|
3545
|
+
}, m = (d) => {
|
|
3546
|
+
d.preventDefault(), d.stopPropagation(), l(i - 1), i === 1 && t(!1), s && s(d);
|
|
3547
|
+
};
|
|
3548
|
+
return /* @__PURE__ */ B(
|
|
3549
|
+
"div",
|
|
3550
|
+
{
|
|
3551
|
+
onDragEnter: (d) => c(d),
|
|
3552
|
+
onDragOver: (d) => p(d),
|
|
3553
|
+
onDrop: (d) => u(d),
|
|
3554
|
+
onDragLeave: (d) => m(d),
|
|
3555
|
+
style: a,
|
|
3556
|
+
children: e
|
|
3557
|
+
}
|
|
3558
|
+
);
|
|
3559
|
+
}
|
|
3560
|
+
export {
|
|
3561
|
+
So as Auth,
|
|
3562
|
+
At as AuthContext,
|
|
3563
|
+
Ct as AuthProvider,
|
|
3564
|
+
ln as BinContext,
|
|
3565
|
+
Go as BinProvider,
|
|
3566
|
+
Po as ComposeProviders,
|
|
3567
|
+
Oo as DropArea,
|
|
3568
|
+
cn as ErrorBoundary,
|
|
3569
|
+
yo as GetCollection,
|
|
3570
|
+
No as GetEntityMetadata,
|
|
3571
|
+
vo as GetFieldGroup,
|
|
3572
|
+
go as GetItem,
|
|
3573
|
+
Ao as GetJobs,
|
|
3574
|
+
Ro as HasRole,
|
|
3575
|
+
Co as ListEntityAccess,
|
|
3576
|
+
mo as MetadataType,
|
|
3577
|
+
To as RolesProvider,
|
|
3578
|
+
po as SearchCollection,
|
|
3579
|
+
ho as SearchItem,
|
|
3580
|
+
Eo as SearchItemCollection,
|
|
3581
|
+
yt as SettingsProvider,
|
|
3582
|
+
lt as VidispineApi,
|
|
3583
|
+
_o as compose,
|
|
3584
|
+
Pn as handleAddEntity,
|
|
3585
|
+
Do as handleMoveEntity,
|
|
3586
|
+
Nn as handleRemoveEntity,
|
|
3587
|
+
Bn as useAddMetadataFieldAttributes,
|
|
3588
|
+
W as useApi,
|
|
3589
|
+
wo as useAuthContext,
|
|
3590
|
+
Un as useAutocomplete,
|
|
3591
|
+
oo as useCollectionAutoPlay,
|
|
3592
|
+
fo as useCompoundMetadata,
|
|
3593
|
+
lo as useCsvDownload,
|
|
3594
|
+
ao as useDocSearchAutocomplete,
|
|
3595
|
+
Yn as useEntityAccess,
|
|
3596
|
+
Hr as useGetCollection,
|
|
3597
|
+
Xn as useGetCollectionItem,
|
|
3598
|
+
zn as useGetEntity,
|
|
3599
|
+
nn as useGetEntityMetadata,
|
|
3600
|
+
on as useGetFieldGroup,
|
|
3601
|
+
io as useGetFieldMetadataDataset,
|
|
3602
|
+
Qr as useGetItem,
|
|
3603
|
+
co as useGetSavedSearchFolders,
|
|
3604
|
+
no as useGroup,
|
|
3605
|
+
so as useHoverScrub,
|
|
3606
|
+
Fn as useInterval,
|
|
3607
|
+
$n as useJobSearch,
|
|
3608
|
+
eo as useListGroup,
|
|
3609
|
+
to as useListUser,
|
|
3610
|
+
jn as useLocalStorage,
|
|
3611
|
+
Jn as useMouseDownPosition,
|
|
3612
|
+
Vn as useQueryInitialState,
|
|
3613
|
+
uo as useRepresentativeItems,
|
|
3614
|
+
un as useRoles,
|
|
3615
|
+
Qn as useSavedSearch,
|
|
3616
|
+
Kt as useSearch,
|
|
3617
|
+
ro as useSearchGroup,
|
|
3618
|
+
Or as useSearchItem,
|
|
3619
|
+
Zn as useSearchUser,
|
|
3620
|
+
xn as useSelected,
|
|
3621
|
+
bo as useSettings,
|
|
3622
|
+
Sn as useSettingsActions,
|
|
3623
|
+
Mn as useTab,
|
|
3624
|
+
qn as useThumbnailScrub,
|
|
3625
|
+
st as useUpdateEffect,
|
|
3626
|
+
kn as useUpdateQueryState,
|
|
3627
|
+
Wn as useUploadFiles,
|
|
3628
|
+
Kn as useUser,
|
|
3629
|
+
Io as withErrorBoundary
|
|
3630
|
+
};
|