@compill/admin 1.0.38 → 1.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.cjs.js +152 -1214
  2. package/index.esm.js +133 -1195
  3. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -1,22 +1,22 @@
1
1
  import { jsx, jsxs, Fragment } from '@soperio/jsx-runtime';
2
2
  import { Icon, Button, Container, Tile, Popover, Modal, Collapse, Checkbox, Badge } from '@valerya/ui';
3
3
  import Link from 'next/link';
4
- import React, { forwardRef, useEffect, useRef, useLayoutEffect, useReducer, useState, isValidElement, cloneElement, useCallback, useContext as useContext$2, createContext } from 'react';
4
+ import React, { useRef, useCallback, useContext as useContext$2, useLayoutEffect, useEffect, createContext } from 'react';
5
5
  import { INVALIDATE_API } from '@compill/admin-api';
6
- import 'axios';
7
- import { useQueryClient, useMutation, useQuery, useQueries as useQueries$1 } from '@tanstack/react-query';
6
+ import { useApiMutation, useMutate, useInvalidateMutation, useApiQuery, useInvalidateQuery, useInvalidateParentMutation, useApiQueries } from '@compill/api';
8
7
  import { useNavigate, useParams } from 'react-router-dom';
9
8
  import { toast } from 'react-toastify';
10
9
  import { SubmitButton, FormProvider, TextArea, FormRenderer, mergeInitialFormValues, FieldLabel } from '@compill/form';
11
- import { useFormikContext, Formik, Form } from 'formik';
10
+ import { useFormikContext, Field, Formik, Form } from 'formik';
12
11
  import 'react/jsx-runtime';
13
12
  import { FlexCenter, QueryLoadingState, RetryOnError, TabContainer, ModalLoadingOverlay } from '@compill/components';
14
- import { createContext as createContext$1, runIfFn as runIfFn$1, isFunction as isFunction$1 } from '@soperio/react';
15
- import { FormEditor } from '@compill/form-extras';
13
+ import { createContext as createContext$1, runIfFn, isFunction } from '@soperio/react';
14
+ import { Editor } from '@compill/editor';
16
15
  import { PageSectionTitle as PageSectionTitle$1 } from '@compill/admin';
17
16
  import { createPortal } from 'react-dom';
18
17
  import { TableContextProvider, useTableContext, Table } from '@compill/table';
19
18
  import { useOpenLink } from '@compill/hooks';
19
+ import { useQueryClient } from '@tanstack/react-query';
20
20
 
21
21
  /******************************************************************************
22
22
  Copyright (c) Microsoft Corporation.
@@ -33,7 +33,7 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
33
33
  PERFORMANCE OF THIS SOFTWARE.
34
34
  ***************************************************************************** */
35
35
 
36
- function __rest(s, e) {
36
+ function __rest$1(s, e) {
37
37
  var t = {};
38
38
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39
39
  t[p] = s[p];
@@ -64,7 +64,7 @@ function SectionTitle(_a) {
64
64
  var {
65
65
  children
66
66
  } = _a,
67
- props = __rest(_a, ["children"]);
67
+ props = __rest$1(_a, ["children"]);
68
68
  return jsx("h2", Object.assign({
69
69
  textSize: "xl",
70
70
  fontWeight: "600",
@@ -96,7 +96,7 @@ function Breadcrumbs(_a) {
96
96
  var {
97
97
  breadcrumbs
98
98
  } = _a,
99
- props = __rest(_a, ["breadcrumbs"]);
99
+ props = __rest$1(_a, ["breadcrumbs"]);
100
100
  return jsx("div", Object.assign({
101
101
  dflex: true,
102
102
  alignItems: "center",
@@ -134,7 +134,7 @@ function DialogButton(_a) {
134
134
  var {
135
135
  buildDialog
136
136
  } = _a,
137
- props = __rest(_a, ["buildDialog"]);
137
+ props = __rest$1(_a, ["buildDialog"]);
138
138
  const [showDialog, setShowDialog] = React.useState(false);
139
139
  const onShowDialog = React.useCallback(event => {
140
140
  event === null || event === void 0 ? void 0 : event.preventDefault();
@@ -151,1130 +151,11 @@ function DialogButton(_a) {
151
151
  });
152
152
  }
153
153
 
154
- /*! js-cookie v3.0.5 | MIT */ /* eslint-disable no-var */ function assign(target) {
155
- for(var i = 1; i < arguments.length; i++){
156
- var source = arguments[i];
157
- for(var key in source){
158
- target[key] = source[key];
159
- }
160
- }
161
- return target;
162
- }
163
- /* eslint-enable no-var */ /* eslint-disable no-var */ var defaultConverter = {
164
- read: function read(value) {
165
- if (value[0] === '"') {
166
- value = value.slice(1, -1);
167
- }
168
- return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
169
- },
170
- write: function write(value) {
171
- return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
172
- }
173
- };
174
- /* eslint-enable no-var */ /* eslint-disable no-var */ function init(converter, defaultAttributes) {
175
- function set(name, value, attributes) {
176
- if (typeof document === "undefined") {
177
- return;
178
- }
179
- attributes = assign({}, defaultAttributes, attributes);
180
- if (typeof attributes.expires === "number") {
181
- attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
182
- }
183
- if (attributes.expires) {
184
- attributes.expires = attributes.expires.toUTCString();
185
- }
186
- name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
187
- var stringifiedAttributes = "";
188
- for(var attributeName in attributes){
189
- if (!attributes[attributeName]) {
190
- continue;
191
- }
192
- stringifiedAttributes += "; " + attributeName;
193
- if (attributes[attributeName] === true) {
194
- continue;
195
- }
196
- // Considers RFC 6265 section 5.2:
197
- // ...
198
- // 3. If the remaining unparsed-attributes contains a %x3B (";")
199
- // character:
200
- // Consume the characters of the unparsed-attributes up to,
201
- // not including, the first %x3B (";") character.
202
- // ...
203
- stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
204
- }
205
- return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes;
206
- }
207
- function get(name) {
208
- if (typeof document === "undefined" || arguments.length && !name) {
209
- return;
210
- }
211
- // To prevent the for loop in the first place assign an empty array
212
- // in case there are no cookies at all.
213
- var cookies = document.cookie ? document.cookie.split("; ") : [];
214
- var jar = {};
215
- for(var i = 0; i < cookies.length; i++){
216
- var parts = cookies[i].split("=");
217
- var value = parts.slice(1).join("=");
218
- try {
219
- var found = decodeURIComponent(parts[0]);
220
- jar[found] = converter.read(value, found);
221
- if (name === found) {
222
- break;
223
- }
224
- } catch (e) {}
225
- }
226
- return name ? jar[name] : jar;
227
- }
228
- return Object.create({
229
- set: set,
230
- get: get,
231
- remove: function remove(name, attributes) {
232
- set(name, "", assign({}, attributes, {
233
- expires: -1
234
- }));
235
- },
236
- withAttributes: function withAttributes(attributes) {
237
- return init(this.converter, assign({}, this.attributes, attributes));
238
- },
239
- withConverter: function withConverter(converter) {
240
- return init(assign({}, this.converter, converter), this.attributes);
241
- }
242
- }, {
243
- attributes: {
244
- value: Object.freeze(defaultAttributes)
245
- },
246
- converter: {
247
- value: Object.freeze(converter)
248
- }
249
- });
250
- }
251
- init(defaultConverter, {
252
- path: "/"
253
- });
254
-
255
- function useInvalidateQuery(queryKey, queryId) {
256
- var queryClient = useQueryClient();
257
- var key = queryId ? queryKey.concat([
258
- "".concat(queryId)
259
- ]) : queryKey;
260
- var invalidate = React.useCallback(function() {
261
- return key ? queryClient.invalidateQueries(key) : null;
262
- }, [
263
- key,
264
- queryClient
265
- ]);
266
- return invalidate;
267
- }
268
-
269
- function _define_property$3(obj, key, value) {
270
- if (key in obj) {
271
- Object.defineProperty(obj, key, {
272
- value: value,
273
- enumerable: true,
274
- configurable: true,
275
- writable: true
276
- });
277
- } else {
278
- obj[key] = value;
279
- }
280
- return obj;
281
- }
282
- function _object_spread$3(target) {
283
- for(var i = 1; i < arguments.length; i++){
284
- var source = arguments[i] != null ? arguments[i] : {};
285
- var ownKeys = Object.keys(source);
286
- if (typeof Object.getOwnPropertySymbols === "function") {
287
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
288
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
289
- }));
290
- }
291
- ownKeys.forEach(function(key) {
292
- _define_property$3(target, key, source[key]);
293
- });
294
- }
295
- return target;
296
- }
297
- function useApiMutation(queryFn, queryKey, queryParam, queryOptions) {
298
- var key = (queryKey !== null && queryKey !== void 0 ? queryKey : []).concat([
299
- queryParam ? typeof queryParam == "number" ? "".concat(queryParam) : queryParam : undefined
300
- ]);
301
- return useMutation(key, queryFn, queryOptions);
302
- }
303
- function useInvalidateMutation(queryFn, queryKey, queryId, queryOptions) {
304
- var invalidateQuery = useInvalidateQuery(queryKey, queryId);
305
- var key = queryId ? queryKey.concat("".concat(queryId)) : queryKey;
306
- return useMutation(key, queryFn, _object_spread$3({
307
- onSuccess: function() {
308
- return invalidateQuery();
309
- }
310
- }, queryOptions));
311
- }
312
- function useInvalidateParentMutation(queryFn, queryKey, queryOptions) {
313
- var invalidateQuery = useInvalidateQuery(queryKey);
314
- return useMutation(queryKey, queryFn, _object_spread$3({
315
- onSuccess: function() {
316
- return invalidateQuery();
317
- }
318
- }, queryOptions));
319
- }
320
- // useInvalidateMutation : invalidate the object e.g /xxx/id
321
- // useInvalidateParentMutation : invalidate the parent object e.g /xxx
322
- // useUpdateMutation : replace the data in cache to avoid refetching the server
323
-
324
- function _define_property$2(obj, key, value) {
325
- if (key in obj) {
326
- Object.defineProperty(obj, key, {
327
- value: value,
328
- enumerable: true,
329
- configurable: true,
330
- writable: true
331
- });
332
- } else {
333
- obj[key] = value;
334
- }
335
- return obj;
336
- }
337
- function _object_spread$2(target) {
338
- for(var i = 1; i < arguments.length; i++){
339
- var source = arguments[i] != null ? arguments[i] : {};
340
- var ownKeys = Object.keys(source);
341
- if (typeof Object.getOwnPropertySymbols === "function") {
342
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
343
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
344
- }));
345
- }
346
- ownKeys.forEach(function(key) {
347
- _define_property$2(target, key, source[key]);
348
- });
349
- }
350
- return target;
351
- }
352
- function queryFnWrapper(queryFn, queryParam) {
353
- return function(context) {
354
- if (queryParam) return queryFn(queryParam);
355
- return queryFn();
356
- };
357
- }
358
- function useApiQuery(queryKey, queryFn, queryParam, queryOptions) {
359
- var key = queryParam ? queryKey.concat([
360
- typeof queryParam == "number" ? "".concat(queryParam) : queryParam
361
- ]) : queryKey;
362
- return useQuery(key, queryFnWrapper(queryFn, queryParam), _object_spread$2({
363
- retry: 0,
364
- networkMode: "always",
365
- retryOnMount: false,
366
- refetchOnMount: false,
367
- refetchOnWindowFocus: false
368
- }, queryOptions));
369
- }
370
- function useApiQueries(queries) {
371
- var results = useQueries$1({
372
- queries: queries.map(function(q) {
373
- var key = q.queryParam ? q.queryKey.concat([
374
- typeof q.queryParam == "number" ? "".concat(q.queryParam) : q.queryParam
375
- ]) : q.queryKey;
376
- return _object_spread$2({
377
- queryKey: key,
378
- queryFn: queryFnWrapper(q.queryFn, q.queryParam),
379
- retry: 0,
380
- // networkMode: "always",
381
- retryOnMount: false,
382
- refetchOnMount: false,
383
- refetchOnWindowFocus: false
384
- }, q.queryOptions);
385
- })
386
- });
387
- var isFetching = results.findIndex(function(r) {
388
- return r.isFetching === true;
389
- }) != -1;
390
- var isError = results.findIndex(function(r) {
391
- return r.isError === true;
392
- }) != -1;
393
- var data = results.map(function(r) {
394
- return r.data;
395
- });
396
- return {
397
- data: data,
398
- isFetching: isFetching,
399
- isError: isError
400
- };
401
- }
402
-
403
- function r(e) {
404
- var t, f, n = "";
405
- if ("string" == typeof e || "number" == typeof e) n += e;
406
- else if ("object" == typeof e) if (Array.isArray(e)) for(t = 0; t < e.length; t++)e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
407
- else for(t in e)e[t] && (n && (n += " "), n += t);
408
- return n;
409
- }
410
- function clsx() {
411
- for(var e, t, f = 0, n = ""; f < arguments.length;)(e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
412
- return n;
413
- }
414
-
415
- function _array_like_to_array$1(arr, len) {
416
- if (len == null || len > arr.length) len = arr.length;
417
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
418
- return arr2;
419
- }
420
- function _array_with_holes(arr) {
421
- if (Array.isArray(arr)) return arr;
422
- }
423
- function _array_without_holes$1(arr) {
424
- if (Array.isArray(arr)) return _array_like_to_array$1(arr);
425
- }
426
- function _define_property$1(obj, key, value) {
427
- if (key in obj) {
428
- Object.defineProperty(obj, key, {
429
- value: value,
430
- enumerable: true,
431
- configurable: true,
432
- writable: true
433
- });
434
- } else {
435
- obj[key] = value;
436
- }
437
- return obj;
438
- }
439
- function _iterable_to_array$1(iter) {
440
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
441
- }
442
- function _iterable_to_array_limit(arr, i) {
443
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
444
- if (_i == null) return;
445
- var _arr = [];
446
- var _n = true;
447
- var _d = false;
448
- var _s, _e;
449
- try {
450
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
451
- _arr.push(_s.value);
452
- if (i && _arr.length === i) break;
453
- }
454
- } catch (err) {
455
- _d = true;
456
- _e = err;
457
- } finally{
458
- try {
459
- if (!_n && _i["return"] != null) _i["return"]();
460
- } finally{
461
- if (_d) throw _e;
462
- }
463
- }
464
- return _arr;
465
- }
466
- function _non_iterable_rest() {
467
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
468
- }
469
- function _non_iterable_spread$1() {
470
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
471
- }
472
- function _object_spread$1(target) {
473
- for(var i = 1; i < arguments.length; i++){
474
- var source = arguments[i] != null ? arguments[i] : {};
475
- var ownKeys = Object.keys(source);
476
- if (typeof Object.getOwnPropertySymbols === "function") {
477
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
478
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
479
- }));
480
- }
481
- ownKeys.forEach(function(key) {
482
- _define_property$1(target, key, source[key]);
483
- });
484
- }
485
- return target;
486
- }
487
- function ownKeys(object, enumerableOnly) {
488
- var keys = Object.keys(object);
489
- if (Object.getOwnPropertySymbols) {
490
- var symbols = Object.getOwnPropertySymbols(object);
491
- if (enumerableOnly) {
492
- symbols = symbols.filter(function(sym) {
493
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
494
- });
495
- }
496
- keys.push.apply(keys, symbols);
497
- }
498
- return keys;
499
- }
500
- function _object_spread_props(target, source) {
501
- source = source != null ? source : {};
502
- if (Object.getOwnPropertyDescriptors) {
503
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
504
- } else {
505
- ownKeys(Object(source)).forEach(function(key) {
506
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
507
- });
508
- }
509
- return target;
510
- }
511
- function _object_without_properties(source, excluded) {
512
- if (source == null) return {};
513
- var target = _object_without_properties_loose(source, excluded);
514
- var key, i;
515
- if (Object.getOwnPropertySymbols) {
516
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
517
- for(i = 0; i < sourceSymbolKeys.length; i++){
518
- key = sourceSymbolKeys[i];
519
- if (excluded.indexOf(key) >= 0) continue;
520
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
521
- target[key] = source[key];
522
- }
523
- }
524
- return target;
525
- }
526
- function _object_without_properties_loose(source, excluded) {
527
- if (source == null) return {};
528
- var target = {};
529
- var sourceKeys = Object.keys(source);
530
- var key, i;
531
- for(i = 0; i < sourceKeys.length; i++){
532
- key = sourceKeys[i];
533
- if (excluded.indexOf(key) >= 0) continue;
534
- target[key] = source[key];
535
- }
536
- return target;
537
- }
538
- function _sliced_to_array(arr, i) {
539
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest();
540
- }
541
- function _to_consumable_array$1(arr) {
542
- return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread$1();
543
- }
544
- function _unsupported_iterable_to_array$1(o, minLen) {
545
- if (!o) return;
546
- if (typeof o === "string") return _array_like_to_array$1(o, minLen);
547
- var n = Object.prototype.toString.call(o).slice(8, -1);
548
- if (n === "Object" && o.constructor) n = o.constructor.name;
549
- if (n === "Map" || n === "Set") return Array.from(n);
550
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
551
- }
552
- var u = function(t) {
553
- return "number" == typeof t && !isNaN(t);
554
- }, d = function(t) {
555
- return "string" == typeof t;
556
- }, p = function(t) {
557
- return "function" == typeof t;
558
- }, m = function(t) {
559
- return d(t) || p(t) ? t : null;
560
- }, f = function(t) {
561
- return isValidElement(t) || d(t) || p(t) || u(t);
562
- };
563
- function g(t, e, n) {
564
- void 0 === n && (n = 300);
565
- var o = t.scrollHeight, s = t.style;
566
- requestAnimationFrame(function() {
567
- s.minHeight = "initial", s.height = o + "px", s.transition = "all ".concat(n, "ms"), requestAnimationFrame(function() {
568
- s.height = "0", s.padding = "0", s.margin = "0", setTimeout(e, n);
569
- });
570
- });
571
- }
572
- function h(e) {
573
- var a = e.enter, r = e.exit, tmp = e.appendPosition, i = tmp === void 0 ? !1 : tmp, tmp1 = e.collapse, _$l = tmp1 === void 0 ? !0 : tmp1, tmp2 = e.collapseDuration, c = tmp2 === void 0 ? 300 : tmp2;
574
- return function(e) {
575
- var u = e.children, d = e.position, p = e.preventExitTransition, m = e.done, f = e.nodeRef, _$h = e.isIn;
576
- var y = i ? "".concat(a, "--").concat(d) : a, v = i ? "".concat(r, "--").concat(d) : r, T = useRef(0);
577
- return useLayoutEffect(function() {
578
- var _t_classList;
579
- var _$t = f.current, _$e = y.split(" "), _$n = function(o) {
580
- var _t_classList;
581
- o.target === f.current && (_$t.dispatchEvent(new Event("d")), _$t.removeEventListener("animationend", _$n), _$t.removeEventListener("animationcancel", _$n), 0 === T.current && "animationcancel" !== o.type && (_t_classList = _$t.classList).remove.apply(_t_classList, _to_consumable_array$1(_$e)));
582
- };
583
- (_t_classList = _$t.classList).add.apply(_t_classList, _to_consumable_array$1(_$e)), _$t.addEventListener("animationend", _$n), _$t.addEventListener("animationcancel", _$n);
584
- }, []), useEffect(function() {
585
- var _$t = f.current, _$e = function() {
586
- _$t.removeEventListener("animationend", _$e), _$l ? g(_$t, m, c) : m();
587
- };
588
- _$h || (p ? _$e() : (T.current = 1, _$t.className += " ".concat(v), _$t.addEventListener("animationend", _$e)));
589
- }, [
590
- _$h
591
- ]), React.createElement(React.Fragment, null, u);
592
- };
593
- }
594
- function y(t, e) {
595
- return null != t ? {
596
- content: t.content,
597
- containerId: t.props.containerId,
598
- id: t.props.toastId,
599
- theme: t.props.theme,
600
- type: t.props.type,
601
- data: t.props.data || {},
602
- isLoading: t.props.isLoading,
603
- icon: t.props.icon,
604
- status: e
605
- } : {};
606
- }
607
- var v = {
608
- list: new Map,
609
- emitQueue: new Map,
610
- on: function on(t, e) {
611
- return this.list.has(t) || this.list.set(t, []), this.list.get(t).push(e), this;
612
- },
613
- off: function off(t, e) {
614
- if (e) {
615
- var n = this.list.get(t).filter(function(t) {
616
- return t !== e;
617
- });
618
- return this.list.set(t, n), this;
619
- }
620
- return this.list.delete(t), this;
621
- },
622
- cancelEmit: function cancelEmit(t) {
623
- var e = this.emitQueue.get(t);
624
- return e && (e.forEach(clearTimeout), this.emitQueue.delete(t)), this;
625
- },
626
- emit: function emit(t) {
627
- var _this = this, _arguments = arguments;
628
- this.list.has(t) && this.list.get(t).forEach(function(e) {
629
- var n = setTimeout(function() {
630
- e.apply(void 0, _to_consumable_array$1([].slice.call(_arguments, 1)));
631
- }, 0);
632
- _this.emitQueue.has(t) || _this.emitQueue.set(t, []), _this.emitQueue.get(t).push(n);
633
- });
634
- }
635
- }, T = function(e) {
636
- var n = e.theme, o = e.type, s = _object_without_properties(e, [
637
- "theme",
638
- "type"
639
- ]);
640
- return React.createElement("svg", _object_spread$1({
641
- viewBox: "0 0 24 24",
642
- width: "100%",
643
- height: "100%",
644
- fill: "colored" === n ? "currentColor" : "var(--toastify-icon-color-".concat(o, ")")
645
- }, s));
646
- }, E = {
647
- info: function info(e) {
648
- return React.createElement(T, _object_spread$1({}, e), React.createElement("path", {
649
- d: "M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"
650
- }));
651
- },
652
- warning: function warning(e) {
653
- return React.createElement(T, _object_spread$1({}, e), React.createElement("path", {
654
- d: "M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"
655
- }));
656
- },
657
- success: function success(e) {
658
- return React.createElement(T, _object_spread$1({}, e), React.createElement("path", {
659
- d: "M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"
660
- }));
661
- },
662
- error: function error(e) {
663
- return React.createElement(T, _object_spread$1({}, e), React.createElement("path", {
664
- d: "M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"
665
- }));
666
- },
667
- spinner: function spinner() {
668
- return React.createElement("div", {
669
- className: "Toastify__spinner"
670
- });
671
- }
672
- };
673
- function C(t) {
674
- var _r = _sliced_to_array(useReducer(function(t) {
675
- return t + 1;
676
- }, 0), 2), o = _r[1], _i = _sliced_to_array(useState([]), 2), _$l = _i[0], c = _i[1], g = useRef(null), _$h = useRef(new Map).current, T = function(t) {
677
- return -1 !== _$l.indexOf(t);
678
- }, C = useRef({
679
- toastKey: 1,
680
- displayedToast: 0,
681
- count: 0,
682
- queue: [],
683
- props: t,
684
- containerId: null,
685
- isToastActive: T,
686
- getToast: function(t) {
687
- return _$h.get(t);
688
- }
689
- }).current;
690
- function b(t) {
691
- var e = t.containerId;
692
- var _C_props = C.props, _$n = _C_props.limit;
693
- !_$n || e && C.containerId !== e || (C.count -= C.queue.length, C.queue = []);
694
- }
695
- function I(t) {
696
- c(function(e) {
697
- return null == t ? [] : e.filter(function(e) {
698
- return e !== t;
699
- });
700
- });
701
- }
702
- function _() {
703
- var _C_queue_shift = C.queue.shift(), _$t = _C_queue_shift.toastContent, e = _C_queue_shift.toastProps, _$n = _C_queue_shift.staleId;
704
- O(_$t, e, _$n);
705
- }
706
- function L(t, n) {
707
- var _$s = n.delay, _$r = n.staleId, _$i = _object_without_properties(n, [
708
- "delay",
709
- "staleId"
710
- ]);
711
- if (!f(t) || function(t) {
712
- return !g.current || C.props.enableMultiContainer && t.containerId !== C.props.containerId || _$h.has(t.toastId) && null == t.updateId;
713
- }(_$i)) return;
714
- var _$l = _$i.toastId, c = _$i.updateId, T = _$i.data, b = C.props, _$L = function() {
715
- return I(_$l);
716
- }, N = null == c;
717
- N && C.count++;
718
- var M = _object_spread_props(_object_spread$1(_object_spread_props(_object_spread$1({}, b), {
719
- style: b.toastStyle,
720
- key: C.toastKey++
721
- }), Object.fromEntries(Object.entries(_$i).filter(function(t) {
722
- var _t = _sliced_to_array(t, 2); _t[0]; var _$n = _t[1];
723
- return null != _$n;
724
- }))), {
725
- toastId: _$l,
726
- updateId: c,
727
- data: T,
728
- closeToast: _$L,
729
- isIn: !1,
730
- className: m(_$i.className || b.toastClassName),
731
- bodyClassName: m(_$i.bodyClassName || b.bodyClassName),
732
- progressClassName: m(_$i.progressClassName || b.progressClassName),
733
- autoClose: !_$i.isLoading && (R = _$i.autoClose, w = b.autoClose, !1 === R || u(R) && R > 0 ? R : w),
734
- deleteToast: function deleteToast() {
735
- var _$t = y(_$h.get(_$l), "removed");
736
- _$h.delete(_$l), v.emit(4, _$t);
737
- var _$e = C.queue.length;
738
- if (C.count = null == _$l ? C.count - C.displayedToast : C.count - 1, C.count < 0 && (C.count = 0), _$e > 0) {
739
- var _$t1 = null == _$l ? C.props.limit : 1;
740
- if (1 === _$e || 1 === _$t1) C.displayedToast++, _();
741
- else {
742
- var _$n = _$t1 > _$e ? _$e : _$t1;
743
- C.displayedToast = _$n;
744
- for(var _$t2 = 0; _$t2 < _$n; _$t2++)_();
745
- }
746
- } else o();
747
- }
748
- });
749
- var R, w;
750
- M.iconOut = function(t) {
751
- var _$n = t.theme, o = t.type, _$s = t.isLoading, _$r = t.icon, _$i = null;
752
- var _$l = {
753
- theme: _$n,
754
- type: o
755
- };
756
- return !1 === _$r || (p(_$r) ? _$i = _$r(_$l) : isValidElement(_$r) ? _$i = cloneElement(_$r, _$l) : d(_$r) || u(_$r) ? _$i = _$r : _$s ? _$i = E.spinner() : function(t) {
757
- return t in E;
758
- }(o) && (_$i = E[o](_$l))), _$i;
759
- }(M), p(_$i.onOpen) && (M.onOpen = _$i.onOpen), p(_$i.onClose) && (M.onClose = _$i.onClose), M.closeButton = b.closeButton, !1 === _$i.closeButton || f(_$i.closeButton) ? M.closeButton = _$i.closeButton : !0 === _$i.closeButton && (M.closeButton = !f(b.closeButton) || b.closeButton);
760
- var x = t;
761
- isValidElement(t) && !d(t.type) ? x = cloneElement(t, {
762
- closeToast: _$L,
763
- toastProps: M,
764
- data: T
765
- }) : p(t) && (x = t({
766
- closeToast: _$L,
767
- toastProps: M,
768
- data: T
769
- })), b.limit && b.limit > 0 && C.count > b.limit && N ? C.queue.push({
770
- toastContent: x,
771
- toastProps: M,
772
- staleId: _$r
773
- }) : u(_$s) ? setTimeout(function() {
774
- O(x, M, _$r);
775
- }, _$s) : O(x, M, _$r);
776
- }
777
- function O(t, e, n) {
778
- var o = e.toastId;
779
- n && _$h.delete(n);
780
- var _$s = {
781
- content: t,
782
- props: e
783
- };
784
- _$h.set(o, _$s), c(function(t) {
785
- return _to_consumable_array$1(t).concat([
786
- o
787
- ]).filter(function(t) {
788
- return t !== n;
789
- });
790
- }), v.emit(4, y(_$s, null == _$s.props.updateId ? "added" : "updated"));
791
- }
792
- return useEffect(function() {
793
- return C.containerId = t.containerId, v.cancelEmit(3).on(0, L).on(1, function(t) {
794
- return g.current && I(t);
795
- }).on(5, b).emit(2, C), function() {
796
- _$h.clear(), v.emit(3, C);
797
- };
798
- }, []), useEffect(function() {
799
- C.props = t, C.isToastActive = T, C.displayedToast = _$l.length;
800
- }), {
801
- getToastToRender: function getToastToRender(e) {
802
- var _$n = new Map, o = Array.from(_$h.values());
803
- return t.newestOnTop && o.reverse(), o.forEach(function(t) {
804
- var _t_props = t.props, e = _t_props.position;
805
- _$n.has(e) || _$n.set(e, []), _$n.get(e).push(t);
806
- }), Array.from(_$n, function(t) {
807
- return e(t[0], t[1]);
808
- });
809
- },
810
- containerRef: g,
811
- isToastActive: T
812
- };
813
- }
814
- function b(t) {
815
- return t.targetTouches && t.targetTouches.length >= 1 ? t.targetTouches[0].clientX : t.clientX;
816
- }
817
- function I(t) {
818
- return t.targetTouches && t.targetTouches.length >= 1 ? t.targetTouches[0].clientY : t.clientY;
819
- }
820
- function _(t) {
821
- var _i = _sliced_to_array(useState(!1), 2), o = _i[0], a = _i[1], _i1 = _sliced_to_array(useState(!1), 2), r = _i1[0], _$l = _i1[1], c = useRef(null), u = useRef({
822
- start: 0,
823
- x: 0,
824
- y: 0,
825
- delta: 0,
826
- removalDistance: 0,
827
- canCloseOnClick: !0,
828
- canDrag: !1,
829
- boundingRect: null,
830
- didMove: !1
831
- }).current, d = useRef(t), m = t.autoClose, f = t.pauseOnHover, g = t.closeToast, _$h = t.onClick, y = t.closeOnClick;
832
- function v(e) {
833
- if (t.draggable) {
834
- "touchstart" === e.nativeEvent.type && e.nativeEvent.preventDefault(), u.didMove = !1, document.addEventListener("mousemove", _), document.addEventListener("mouseup", L), document.addEventListener("touchmove", _), document.addEventListener("touchend", L);
835
- var _$n = c.current;
836
- u.canCloseOnClick = !0, u.canDrag = !0, u.boundingRect = _$n.getBoundingClientRect(), _$n.style.transition = "", u.x = b(e.nativeEvent), u.y = I(e.nativeEvent), "x" === t.draggableDirection ? (u.start = u.x, u.removalDistance = _$n.offsetWidth * (t.draggablePercent / 100)) : (u.start = u.y, u.removalDistance = _$n.offsetHeight * (80 === t.draggablePercent ? 1.5 * t.draggablePercent : t.draggablePercent / 100));
837
- }
838
- }
839
- function T(e) {
840
- if (u.boundingRect) {
841
- var _u_boundingRect = u.boundingRect, _$n = _u_boundingRect.top, o = _u_boundingRect.bottom, _$s = _u_boundingRect.left, a = _u_boundingRect.right;
842
- "touchend" !== e.nativeEvent.type && t.pauseOnHover && u.x >= _$s && u.x <= a && u.y >= _$n && u.y <= o ? C() : E();
843
- }
844
- }
845
- function E() {
846
- a(!0);
847
- }
848
- function C() {
849
- a(!1);
850
- }
851
- function _(e) {
852
- var _$n = c.current;
853
- u.canDrag && _$n && (u.didMove = !0, o && C(), u.x = b(e), u.y = I(e), u.delta = "x" === t.draggableDirection ? u.x - u.start : u.y - u.start, u.start !== u.x && (u.canCloseOnClick = !1), _$n.style.transform = "translate".concat(t.draggableDirection, "(").concat(u.delta, "px)"), _$n.style.opacity = "" + (1 - Math.abs(u.delta / u.removalDistance)));
854
- }
855
- function L() {
856
- document.removeEventListener("mousemove", _), document.removeEventListener("mouseup", L), document.removeEventListener("touchmove", _), document.removeEventListener("touchend", L);
857
- var e = c.current;
858
- if (u.canDrag && u.didMove && e) {
859
- if (u.canDrag = !1, Math.abs(u.delta) > u.removalDistance) return _$l(!0), void t.closeToast();
860
- e.style.transition = "transform 0.2s, opacity 0.2s", e.style.transform = "translate".concat(t.draggableDirection, "(0)"), e.style.opacity = "1";
861
- }
862
- }
863
- useEffect(function() {
864
- d.current = t;
865
- }), useEffect(function() {
866
- return c.current && c.current.addEventListener("d", E, {
867
- once: !0
868
- }), p(t.onOpen) && t.onOpen(isValidElement(t.children) && t.children.props), function() {
869
- var _$t = d.current;
870
- p(_$t.onClose) && _$t.onClose(isValidElement(_$t.children) && _$t.children.props);
871
- };
872
- }, []), useEffect(function() {
873
- return t.pauseOnFocusLoss && (document.hasFocus() || C(), window.addEventListener("focus", E), window.addEventListener("blur", C)), function() {
874
- t.pauseOnFocusLoss && (window.removeEventListener("focus", E), window.removeEventListener("blur", C));
875
- };
876
- }, [
877
- t.pauseOnFocusLoss
878
- ]);
879
- var O = {
880
- onMouseDown: v,
881
- onTouchStart: v,
882
- onMouseUp: T,
883
- onTouchEnd: T
884
- };
885
- return m && f && (O.onMouseEnter = C, O.onMouseLeave = E), y && (O.onClick = function(t) {
886
- _$h && _$h(t), u.canCloseOnClick && g();
887
- }), {
888
- playToast: E,
889
- pauseToast: C,
890
- isRunning: o,
891
- preventExitTransition: r,
892
- toastRef: c,
893
- eventHandlers: O
894
- };
895
- }
896
- function L(e) {
897
- var n = e.closeToast, o = e.theme, tmp = e.ariaLabel, s = tmp === void 0 ? "close" : tmp;
898
- return React.createElement("button", {
899
- className: "Toastify__close-button Toastify__close-button--".concat(o),
900
- type: "button",
901
- onClick: function(t) {
902
- t.stopPropagation(), n(t);
903
- },
904
- "aria-label": s
905
- }, React.createElement("svg", {
906
- "aria-hidden": "true",
907
- viewBox: "0 0 14 16"
908
- }, React.createElement("path", {
909
- fillRule: "evenodd",
910
- d: "M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"
911
- })));
912
- }
913
- function O(e) {
914
- var n = e.delay, o = e.isRunning, s = e.closeToast, tmp = e.type, a = tmp === void 0 ? "default" : tmp, r = e.hide, i = e.className, _$l = e.style, u = e.controlledProgress, d = e.progress, m = e.rtl, f = e.isIn, g = e.theme;
915
- var _$h = r || u && 0 === d, y = _object_spread_props(_object_spread$1({}, _$l), {
916
- animationDuration: "".concat(n, "ms"),
917
- animationPlayState: o ? "running" : "paused",
918
- opacity: _$h ? 0 : 1
919
- });
920
- u && (y.transform = "scaleX(".concat(d, ")"));
921
- var v = clsx("Toastify__progress-bar", u ? "Toastify__progress-bar--controlled" : "Toastify__progress-bar--animated", "Toastify__progress-bar-theme--".concat(g), "Toastify__progress-bar--".concat(a), {
922
- "Toastify__progress-bar--rtl": m
923
- }), T = p(i) ? i({
924
- rtl: m,
925
- type: a,
926
- defaultClassName: v
927
- }) : clsx(v, i);
928
- return React.createElement("div", _define_property$1({
929
- role: "progressbar",
930
- "aria-hidden": _$h ? "true" : "false",
931
- "aria-label": "notification timer",
932
- className: T,
933
- style: y
934
- }, u && d >= 1 ? "onTransitionEnd" : "onAnimationEnd", u && d < 1 ? null : function() {
935
- f && s();
936
- }));
937
- }
938
- var N = function(n) {
939
- var _$_ = _(n), o = _$_.isRunning, s = _$_.preventExitTransition, r = _$_.toastRef, i = _$_.eventHandlers, _$l = n.closeButton, u = n.children, d = n.autoClose, m = n.onClick, f = n.type, g = n.hideProgressBar, _$h = n.closeToast, y = n.transition, v = n.position, T = n.className, E = n.style, C = n.bodyClassName, b = n.bodyStyle, I = n.progressClassName, N = n.progressStyle, M = n.updateId, R = n.role, w = n.progress, x = n.rtl, $ = n.toastId, k = n.deleteToast, P = n.isIn, B = n.isLoading, D = n.iconOut, A = n.closeOnClick, z = n.theme, F = clsx("Toastify__toast", "Toastify__toast-theme--".concat(z), "Toastify__toast--".concat(f), {
940
- "Toastify__toast--rtl": x
941
- }, {
942
- "Toastify__toast--close-on-click": A
943
- }), H = p(T) ? T({
944
- rtl: x,
945
- position: v,
946
- type: f,
947
- defaultClassName: F
948
- }) : clsx(F, T), S = !!w || !d, _$q = {
949
- closeToast: _$h,
950
- type: f,
951
- theme: z
952
- };
953
- var _$Q = null;
954
- return !1 === _$l || (_$Q = p(_$l) ? _$l(_$q) : isValidElement(_$l) ? cloneElement(_$l, _$q) : L(_$q)), React.createElement(y, {
955
- isIn: P,
956
- done: k,
957
- position: v,
958
- preventExitTransition: s,
959
- nodeRef: r
960
- }, React.createElement("div", _object_spread_props(_object_spread$1({
961
- id: $,
962
- onClick: m,
963
- className: H
964
- }, i), {
965
- style: E,
966
- ref: r
967
- }), React.createElement("div", _object_spread_props(_object_spread$1({}, P && {
968
- role: R
969
- }), {
970
- className: p(C) ? C({
971
- type: f
972
- }) : clsx("Toastify__toast-body", C),
973
- style: b
974
- }), null != D && React.createElement("div", {
975
- className: clsx("Toastify__toast-icon", {
976
- "Toastify--animate-icon Toastify__zoom-enter": !B
977
- })
978
- }, D), React.createElement("div", null, u)), _$Q, React.createElement(O, _object_spread_props(_object_spread$1({}, M && !S ? {
979
- key: "pb-".concat(M)
980
- } : {}), {
981
- rtl: x,
982
- theme: z,
983
- delay: d,
984
- isRunning: o,
985
- isIn: P,
986
- closeToast: _$h,
987
- hide: g,
988
- type: f,
989
- style: N,
990
- className: I,
991
- controlledProgress: S,
992
- progress: w || 0
993
- }))));
994
- }, M = function M(t, e) {
995
- return void 0 === e && (e = !1), {
996
- enter: "Toastify--animate Toastify__".concat(t, "-enter"),
997
- exit: "Toastify--animate Toastify__".concat(t, "-exit"),
998
- appendPosition: e
999
- };
1000
- }, R = h(M("bounce", !0)); h(M("slide", !0)); h(M("zoom")); h(M("flip")); var k = forwardRef(function(e, n) {
1001
- var f = function f(t) {
1002
- var _$e = clsx("Toastify__toast-container", "Toastify__toast-container--".concat(t), {
1003
- "Toastify__toast-container--rtl": u
1004
- });
1005
- return p(i) ? i({
1006
- position: t,
1007
- rtl: u,
1008
- defaultClassName: _$e
1009
- }) : clsx(_$e, m(i));
1010
- };
1011
- var _C = C(e), o = _C.getToastToRender, a = _C.containerRef, r = _C.isToastActive, i = e.className, _$l = e.style, u = e.rtl, d = e.containerId;
1012
- return useEffect(function() {
1013
- n && (n.current = a.current);
1014
- }, []), React.createElement("div", {
1015
- ref: a,
1016
- className: "Toastify",
1017
- id: d
1018
- }, o(function(e, n) {
1019
- var o = n.length ? _object_spread$1({}, _$l) : _object_spread_props(_object_spread$1({}, _$l), {
1020
- pointerEvents: "none"
1021
- });
1022
- return React.createElement("div", {
1023
- className: f(e),
1024
- style: o,
1025
- key: "container-".concat(e)
1026
- }, n.map(function(e, o) {
1027
- var _$s = e.content, a = e.props;
1028
- return React.createElement(N, _object_spread_props(_object_spread$1({}, a), {
1029
- isIn: r(a.toastId),
1030
- style: _object_spread_props(_object_spread$1({}, a.style), {
1031
- "--nth": o + 1,
1032
- "--len": n.length
1033
- }),
1034
- key: "toast-".concat(a.key)
1035
- }), _$s);
1036
- }));
1037
- }));
1038
- });
1039
- k.displayName = "ToastContainer", k.defaultProps = {
1040
- position: "top-right",
1041
- transition: R,
1042
- autoClose: 5e3,
1043
- closeButton: L,
1044
- pauseOnHover: !0,
1045
- pauseOnFocusLoss: !0,
1046
- closeOnClick: !0,
1047
- draggable: !0,
1048
- draggablePercent: 80,
1049
- draggableDirection: "x",
1050
- role: "alert",
1051
- theme: "light"
1052
- };
1053
- var P, B = new Map, D = [], A = 1;
1054
- function z() {
1055
- return "" + A++;
1056
- }
1057
- function F(t) {
1058
- return t && (d(t.toastId) || u(t.toastId)) ? t.toastId : z();
1059
- }
1060
- function H(t, e) {
1061
- return B.size > 0 ? v.emit(0, t, e) : D.push({
1062
- content: t,
1063
- options: e
1064
- }), e.toastId;
1065
- }
1066
- function S(t, e) {
1067
- return _object_spread_props(_object_spread$1({}, e), {
1068
- type: e && e.type || t,
1069
- toastId: F(e)
1070
- });
1071
- }
1072
- function q(t) {
1073
- return function(e, n) {
1074
- return H(e, S(t, n));
1075
- };
1076
- }
1077
- function Q(t, e) {
1078
- return H(t, S("default", e));
1079
- }
1080
- Q.loading = function(t, e) {
1081
- return H(t, S("default", _object_spread$1({
1082
- isLoading: !0,
1083
- autoClose: !1,
1084
- closeOnClick: !1,
1085
- closeButton: !1,
1086
- draggable: !1
1087
- }, e)));
1088
- }, Q.promise = function(t, e, n) {
1089
- var o, s = e.pending, a = e.error, r = e.success;
1090
- s && (o = d(s) ? Q.loading(s, n) : Q.loading(s.render, _object_spread$1({}, n, s)));
1091
- var i = {
1092
- isLoading: null,
1093
- autoClose: null,
1094
- closeOnClick: null,
1095
- closeButton: null,
1096
- draggable: null
1097
- }, _$l = function(t, e, s) {
1098
- if (null == e) return void Q.dismiss(o);
1099
- var a = _object_spread_props(_object_spread$1({
1100
- type: t
1101
- }, i, n), {
1102
- data: s
1103
- }), r = d(e) ? {
1104
- render: e
1105
- } : e;
1106
- return o ? Q.update(o, _object_spread$1({}, a, r)) : Q(r.render, _object_spread$1({}, a, r)), s;
1107
- }, c = p(t) ? t() : t;
1108
- return c.then(function(t) {
1109
- return _$l("success", r, t);
1110
- }).catch(function(t) {
1111
- return _$l("error", a, t);
1112
- }), c;
1113
- }, Q.success = q("success"), Q.info = q("info"), Q.error = q("error"), Q.warning = q("warning"), Q.warn = Q.warning, Q.dark = function(t, e) {
1114
- return H(t, S("default", _object_spread$1({
1115
- theme: "dark"
1116
- }, e)));
1117
- }, Q.dismiss = function(t) {
1118
- B.size > 0 ? v.emit(1, t) : D = D.filter(function(e) {
1119
- return null != t && e.options.toastId !== t;
1120
- });
1121
- }, Q.clearWaitingQueue = function(t) {
1122
- return void 0 === t && (t = {}), v.emit(5, t);
1123
- }, Q.isActive = function(t) {
1124
- var e = !1;
1125
- return B.forEach(function(n) {
1126
- n.isToastActive && n.isToastActive(t) && (e = !0);
1127
- }), e;
1128
- }, Q.update = function(t, e) {
1129
- void 0 === e && (e = {}), setTimeout(function() {
1130
- var n = function(t, e) {
1131
- var n = e.containerId;
1132
- var o = B.get(n || P);
1133
- return o && o.getToast(t);
1134
- }(t, e);
1135
- if (n) {
1136
- var o = n.props, s = n.content, a = _object_spread_props(_object_spread$1({
1137
- delay: 100
1138
- }, o, e), {
1139
- toastId: e.toastId || t,
1140
- updateId: z()
1141
- });
1142
- a.toastId !== t && (a.staleId = t);
1143
- var r = a.render || s;
1144
- delete a.render, H(r, a);
1145
- }
1146
- }, 0);
1147
- }, Q.done = function(t) {
1148
- Q.update(t, {
1149
- progress: 1
1150
- });
1151
- }, Q.onChange = function(t) {
1152
- return v.on(4, t), function() {
1153
- v.off(4, t);
1154
- };
1155
- }, Q.POSITION = {
1156
- TOP_LEFT: "top-left",
1157
- TOP_RIGHT: "top-right",
1158
- TOP_CENTER: "top-center",
1159
- BOTTOM_LEFT: "bottom-left",
1160
- BOTTOM_RIGHT: "bottom-right",
1161
- BOTTOM_CENTER: "bottom-center"
1162
- }, Q.TYPE = {
1163
- INFO: "info",
1164
- SUCCESS: "success",
1165
- WARNING: "warning",
1166
- ERROR: "error",
1167
- DEFAULT: "default"
1168
- }, v.on(2, function(t) {
1169
- P = t.containerId || t, B.set(P, t), D.forEach(function(t) {
1170
- v.emit(0, t.content, t.options);
1171
- }), D = [];
1172
- }).on(3, function(t) {
1173
- B.delete(t.containerId || t), 0 === B.size && v.off(0).off(1).off(5);
1174
- });
1175
-
1176
- function _array_like_to_array(arr, len) {
1177
- if (len == null || len > arr.length) len = arr.length;
1178
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1179
- return arr2;
1180
- }
1181
- function _array_without_holes(arr) {
1182
- if (Array.isArray(arr)) return _array_like_to_array(arr);
1183
- }
1184
- function _define_property(obj, key, value) {
1185
- if (key in obj) {
1186
- Object.defineProperty(obj, key, {
1187
- value: value,
1188
- enumerable: true,
1189
- configurable: true,
1190
- writable: true
1191
- });
1192
- } else {
1193
- obj[key] = value;
1194
- }
1195
- return obj;
1196
- }
1197
- function _iterable_to_array(iter) {
1198
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1199
- }
1200
- function _non_iterable_spread() {
1201
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1202
- }
1203
- function _object_spread(target) {
1204
- for(var i = 1; i < arguments.length; i++){
1205
- var source = arguments[i] != null ? arguments[i] : {};
1206
- var ownKeys = Object.keys(source);
1207
- if (typeof Object.getOwnPropertySymbols === "function") {
1208
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1209
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1210
- }));
1211
- }
1212
- ownKeys.forEach(function(key) {
1213
- _define_property(target, key, source[key]);
1214
- });
1215
- }
1216
- return target;
1217
- }
1218
- function _to_consumable_array(arr) {
1219
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
1220
- }
1221
- function _unsupported_iterable_to_array(o, minLen) {
1222
- if (!o) return;
1223
- if (typeof o === "string") return _array_like_to_array(o, minLen);
1224
- var n = Object.prototype.toString.call(o).slice(8, -1);
1225
- if (n === "Object" && o.constructor) n = o.constructor.name;
1226
- if (n === "Map" || n === "Set") return Array.from(n);
1227
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
1228
- }
1229
- var defaultOptions = {
1230
- showSuccessMsg: true,
1231
- showErrorMsg: true,
1232
- successMsg: undefined,
1233
- errorMsg: undefined,
1234
- onSuccess: undefined,
1235
- onError: undefined,
1236
- processInput: undefined
1237
- };
1238
- function useMutate(mutation, options) {
1239
- var mergedOptions = _object_spread({}, defaultOptions, options !== null && options !== void 0 ? options : {});
1240
- var mutate = React.useCallback(function(values) {
1241
- mutation.reset();
1242
- var _runIfFn;
1243
- // Return the mutation so that Formik can update submitting state
1244
- return mutation.mutateAsync((_runIfFn = runIfFn(mergedOptions.processInput, values)) !== null && _runIfFn !== void 0 ? _runIfFn : values).then(function(result) {
1245
- var _mergedOptions_onSuccess;
1246
- if (mergedOptions.showSuccessMsg && mergedOptions.successMsg) Q.success(runIfFn(mergedOptions.successMsg, result, values));
1247
- (_mergedOptions_onSuccess = mergedOptions.onSuccess) === null || _mergedOptions_onSuccess === void 0 ? void 0 : _mergedOptions_onSuccess.call(mergedOptions, result);
1248
- return result;
1249
- }).catch(function(error) {
1250
- var _mergedOptions_onError;
1251
- if (mergedOptions.showErrorMsg) {
1252
- var _runIfFn;
1253
- Q.error((_runIfFn = runIfFn(mergedOptions.errorMsg, error, values)) !== null && _runIfFn !== void 0 ? _runIfFn : "Oops, something went wrong :(");
1254
- }
1255
- (_mergedOptions_onError = mergedOptions.onError) === null || _mergedOptions_onError === void 0 ? void 0 : _mergedOptions_onError.call(mergedOptions, error);
1256
- });
1257
- }, [
1258
- mutation,
1259
- options
1260
- ]);
1261
- return mutate;
1262
- }
1263
- function isFunction(value) {
1264
- return typeof value === "function";
1265
- }
1266
- function runIfFn(valueOrFn) {
1267
- for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
1268
- args[_key - 1] = arguments[_key];
1269
- }
1270
- return isFunction(valueOrFn) ? valueOrFn.apply(void 0, _to_consumable_array(args)) : valueOrFn;
1271
- }
1272
-
1273
154
  function InvalidateButton(_a) {
1274
155
  var {
1275
156
  pathOrPermalink
1276
157
  } = _a,
1277
- props = __rest(_a, ["pathOrPermalink"]);
158
+ props = __rest$1(_a, ["pathOrPermalink"]);
1278
159
  const api = INVALIDATE_API.new(pathOrPermalink);
1279
160
  const mutation = useApiMutation(api.invalidate, api.queryKey);
1280
161
  const invalidate = useMutate(mutation, {
@@ -1300,7 +181,7 @@ function NavigateButton(_a) {
1300
181
  var {
1301
182
  path
1302
183
  } = _a,
1303
- props = __rest(_a, ["path"]);
184
+ props = __rest$1(_a, ["path"]);
1304
185
  const navigate = useNavigate();
1305
186
  const handleClick = React.useCallback(() => {
1306
187
  navigate(path);
@@ -1326,7 +207,7 @@ function PublishButton(_a) {
1326
207
  queryId,
1327
208
  api
1328
209
  } = _a,
1329
- props = __rest(_a, ["status", "queryId", "api"]);
210
+ props = __rest$1(_a, ["status", "queryId", "api"]);
1330
211
  const isDraft = status == "draft";
1331
212
  const mutation = useInvalidateMutation(isDraft ? api.publish : api.unpublish, api.queryKey, queryId, {
1332
213
  networkMode: "always"
@@ -1741,7 +622,7 @@ function useHotkeys(keys, callback, options, dependencies) {
1741
622
 
1742
623
  function UpdateButton(_a) {
1743
624
  var _b;
1744
- var props = __rest(_a, []);
625
+ var props = __rest$1(_a, []);
1745
626
  const {
1746
627
  dirty,
1747
628
  handleSubmit
@@ -1774,7 +655,7 @@ function ViewButton(_a) {
1774
655
  path,
1775
656
  icon
1776
657
  } = _a,
1777
- props = __rest(_a, ["path", "icon"]);
658
+ props = __rest$1(_a, ["path", "icon"]);
1778
659
  const openPage = React.useCallback(() => {
1779
660
  window.open(path, '_blank');
1780
661
  }, [path]);
@@ -1838,7 +719,7 @@ function PageContainer(_a) {
1838
719
  var {
1839
720
  children
1840
721
  } = _a,
1841
- props = __rest(_a, ["children"]);
722
+ props = __rest$1(_a, ["children"]);
1842
723
  return jsx(Container, Object.assign({
1843
724
  center: true,
1844
725
  dflex: true,
@@ -1849,11 +730,68 @@ function PageContainer(_a) {
1849
730
  }));
1850
731
  }
1851
732
 
733
+ /******************************************************************************
734
+ Copyright (c) Microsoft Corporation.
735
+
736
+ Permission to use, copy, modify, and/or distribute this software for any
737
+ purpose with or without fee is hereby granted.
738
+
739
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
740
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
741
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
742
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
743
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
744
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
745
+ PERFORMANCE OF THIS SOFTWARE.
746
+ ***************************************************************************** */
747
+
748
+ function __rest(s, e) {
749
+ var t = {};
750
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
751
+ t[p] = s[p];
752
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
753
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
754
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
755
+ t[p[i]] = s[p[i]];
756
+ }
757
+ return t;
758
+ }
759
+
760
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
761
+ var e = new Error(message);
762
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
763
+ };
764
+
765
+ function FormEditor(_a) {
766
+ // const { initialValues } = useFormikContext();
767
+ var {
768
+ name,
769
+ placeholder
770
+ } = _a,
771
+ props = __rest(_a, ["name", "placeholder"]);
772
+ return jsx(Field, {
773
+ name: name,
774
+ children: ({
775
+ field,
776
+ meta
777
+ }) => jsx(Editor, Object.assign({}, props, {
778
+ // placeholder={placeholder}
779
+ defaultValue: meta.initialValue,
780
+ onChange: e => field.onChange({
781
+ target: {
782
+ name: name,
783
+ value: e
784
+ }
785
+ })
786
+ }))
787
+ });
788
+ }
789
+
1852
790
  function PageMain(_a) {
1853
791
  var {
1854
792
  children
1855
793
  } = _a,
1856
- props = __rest(_a, ["children"]);
794
+ props = __rest$1(_a, ["children"]);
1857
795
  return jsx(Tile, Object.assign({
1858
796
  scheme: "light",
1859
797
  p: "5"
@@ -1866,7 +804,7 @@ function PageContentEditor(_a) {
1866
804
  var {
1867
805
  name
1868
806
  } = _a,
1869
- props = __rest(_a, ["name"]);
807
+ props = __rest$1(_a, ["name"]);
1870
808
  return jsx(PageMain, Object.assign({
1871
809
  h: "min"
1872
810
  }, props, {
@@ -1888,7 +826,7 @@ function PageQueryStateContainerInner(_a) {
1888
826
  errorStyles,
1889
827
  children
1890
828
  } = _a,
1891
- props = __rest(_a, ["queryId", "api", "apiFn", "loadingStyles", "errorStyles", "children"]);
829
+ props = __rest$1(_a, ["queryId", "api", "apiFn", "loadingStyles", "errorStyles", "children"]);
1892
830
  const {
1893
831
  data,
1894
832
  isLoading,
@@ -1913,7 +851,7 @@ function PageSidebar(_a) {
1913
851
  var {
1914
852
  children
1915
853
  } = _a,
1916
- props = __rest(_a, ["children"]);
854
+ props = __rest$1(_a, ["children"]);
1917
855
  return jsx("div", Object.assign({
1918
856
  w: "112",
1919
857
  minW: "112",
@@ -1931,7 +869,7 @@ function PageSidebarSection(_a) {
1931
869
  title,
1932
870
  children
1933
871
  } = _a,
1934
- props = __rest(_a, ["title", "children"]);
872
+ props = __rest$1(_a, ["title", "children"]);
1935
873
  return jsxs("div", Object.assign({
1936
874
  w: "full",
1937
875
  bgColor: "white",
@@ -1949,7 +887,7 @@ function PageTitle(_a) {
1949
887
  var {
1950
888
  children
1951
889
  } = _a;
1952
- __rest(_a, ["children"]);
890
+ __rest$1(_a, ["children"]);
1953
891
  return jsx("div", {
1954
892
  trait: "typo.h5",
1955
893
  children: children
@@ -1962,7 +900,7 @@ function PageTopBar(_a) {
1962
900
  breadcrumbs,
1963
901
  children
1964
902
  } = _a,
1965
- props = __rest(_a, ["title", "breadcrumbs", "children"]);
903
+ props = __rest$1(_a, ["title", "breadcrumbs", "children"]);
1966
904
  return jsxs(FlexCenter, Object.assign({
1967
905
  gap: "3",
1968
906
  minH: "9"
@@ -1995,7 +933,7 @@ function PageTabbedTopBar(_a) {
1995
933
  breadcrumbs,
1996
934
  children
1997
935
  } = _a,
1998
- props = __rest(_a, ["title", "breadcrumbs", "children"]);
936
+ props = __rest$1(_a, ["title", "breadcrumbs", "children"]);
1999
937
  const ref = /*#__PURE__*/React.createRef();
2000
938
  const {
2001
939
  setContainerEl
@@ -2138,7 +1076,7 @@ function DetailsView(_a) {
2138
1076
  screen,
2139
1077
  tabbed
2140
1078
  } = _a,
2141
- props = __rest(_a, ["queryField", "api", "processInput", "screen", "tabbed"]);
1079
+ props = __rest$1(_a, ["queryField", "api", "processInput", "screen", "tabbed"]);
2142
1080
  const {
2143
1081
  [queryField]: id
2144
1082
  } = useParams();
@@ -2179,19 +1117,19 @@ function Internal({
2179
1117
  editor,
2180
1118
  type,
2181
1119
  invalidateParentQueryKey
2182
- } = runIfFn$1(screen, item);
1120
+ } = runIfFn(screen, item);
2183
1121
  const mutation = useInvalidateParentMutation(api.update, invalidateParentQueryKey !== null && invalidateParentQueryKey !== void 0 ? invalidateParentQueryKey : api.queryKey, {
2184
1122
  networkMode: "always"
2185
1123
  });
2186
1124
  const save = useMutate(mutation, {
2187
1125
  processInput,
2188
- successMsg: item => `${item.title} updated.`,
1126
+ successMsg: (item, values) => `${item.title} updated.`,
2189
1127
  errorMsg: (error, item) => `Error updating ${item.title}: ${error}`
2190
1128
  });
2191
1129
  let editorMaxW = undefined;
2192
1130
  if (type == "post") editorMaxW = "calc(1280px - 30rem)";else if (type == "section") editorMaxW = "calc(1280px - 22rem)";
2193
1131
  return jsxs(FormProvider, {
2194
- initialValues: runIfFn$1(initialValues, item),
1132
+ initialValues: runIfFn(initialValues, item),
2195
1133
  validationSchema: schema,
2196
1134
  onSubmit: save,
2197
1135
  enableReinitialize: true,
@@ -2248,11 +1186,11 @@ function Section({
2248
1186
  return jsx(PageSidebarSection, {
2249
1187
  title: section.title,
2250
1188
  children: jsx(FormRenderer, {
2251
- form: runIfFn$1(section.form, item)
1189
+ form: runIfFn(section.form, item)
2252
1190
  })
2253
1191
  });
2254
1192
  }
2255
- if (section.type === "custom") return runIfFn$1(section.component, item);
1193
+ if (section.type === "custom") return runIfFn(section.component, item);
2256
1194
  return null;
2257
1195
  }
2258
1196
 
@@ -2267,7 +1205,7 @@ function useApi(api, queryField) {
2267
1205
  } = params;
2268
1206
  return {
2269
1207
  id,
2270
- api: runIfFn$1(api, id)
1208
+ api: runIfFn(api, id)
2271
1209
  };
2272
1210
  }
2273
1211
  function QueryWrapper(_a) {
@@ -2279,14 +1217,14 @@ function QueryWrapper(_a) {
2279
1217
  config,
2280
1218
  tabbed
2281
1219
  } = _a,
2282
- props = __rest(_a, ["api", "queryField", "fn", "transformFn", "config", "tabbed"]);
1220
+ props = __rest$1(_a, ["api", "queryField", "fn", "transformFn", "config", "tabbed"]);
2283
1221
  const {
2284
1222
  id,
2285
1223
  api: mApi
2286
1224
  } = useApi(api, queryField);
2287
1225
  const {
2288
1226
  data
2289
- } = useApiQuery(mApi.queryKey, fn === "get" || fn === "getTransformed" ? mApi.get : mApi.getAll, isFunction$1(api) ? undefined : id);
1227
+ } = useApiQuery(mApi.queryKey, fn === "get" || fn === "getTransformed" ? mApi.get : mApi.getAll, isFunction(api) ? undefined : id);
2290
1228
  const transformedData = React.useMemo(() => {
2291
1229
  if (data && (fn === "getTransformed" || fn === "getAllTransformed")) {
2292
1230
  if (!transformFn) console.warn(`QueryWrapperDialog: you forgot to pass transformFn as parameter for fn ${fn}`);
@@ -2308,7 +1246,7 @@ function TabbedView(_a) {
2308
1246
  api,
2309
1247
  screen
2310
1248
  } = _a;
2311
- __rest(_a, ["queryField", "api", "screen"]);
1249
+ __rest$1(_a, ["queryField", "api", "screen"]);
2312
1250
  const {
2313
1251
  [queryField]: id
2314
1252
  } = useParams();
@@ -2321,7 +1259,7 @@ function TabbedView(_a) {
2321
1259
  const {
2322
1260
  breadcrumbs,
2323
1261
  tabs
2324
- } = runIfFn$1(screen, city);
1262
+ } = runIfFn(screen, city);
2325
1263
  return jsxs(PageTabbedTopBarProvider, {
2326
1264
  children: [jsx(PageTabbedTopBar, {
2327
1265
  breadcrumbs: breadcrumbs,
@@ -2404,7 +1342,7 @@ function TableContainer(_a) {
2404
1342
  columns,
2405
1343
  children
2406
1344
  } = _a,
2407
- props = __rest(_a, ["initialPageSize", "initialVisibleColumns", "columns", "children"]);
1345
+ props = __rest$1(_a, ["initialPageSize", "initialVisibleColumns", "columns", "children"]);
2408
1346
  return jsx(Tile, Object.assign({
2409
1347
  scheme: "light",
2410
1348
  shadow: true,
@@ -2430,7 +1368,7 @@ function TableCreateButton(_a) {
2430
1368
  var {
2431
1369
  children
2432
1370
  } = _a,
2433
- props = __rest(_a, ["children"]);
1371
+ props = __rest$1(_a, ["children"]);
2434
1372
  return jsx(DialogButton, Object.assign({
2435
1373
  scheme: "default",
2436
1374
  corners: "pill",
@@ -2444,7 +1382,7 @@ function TableCreateButton(_a) {
2444
1382
  }
2445
1383
 
2446
1384
  function TableFilterButton(_a) {
2447
- var props = __rest(_a, []);
1385
+ var props = __rest$1(_a, []);
2448
1386
  // return <Button scheme="secondary" {...props}><Icon path={mdiFilter} /></Button>
2449
1387
  return jsxs(Popover, {
2450
1388
  side: "bottom-end",
@@ -2492,7 +1430,7 @@ function TableTopBar(_a) {
2492
1430
  queryKey,
2493
1431
  children
2494
1432
  } = _a,
2495
- props = __rest(_a, ["title", "queryKey", "children"]);
1433
+ props = __rest$1(_a, ["title", "queryKey", "children"]);
2496
1434
  const invalidate = useInvalidateQuery(queryKey);
2497
1435
  useHotkeys('ctrl+r', () => invalidate(), {
2498
1436
  preventDefault: true
@@ -2573,7 +1511,7 @@ function ItemEditDialog$1(_a) {
2573
1511
  onClose,
2574
1512
  formikProps
2575
1513
  } = _a,
2576
- props = __rest(_a, ["initialValues", "itemLabel", "queryId", "api", "queryFetchOptions", "querySaveOptions", "onSuccess", "onFetchError", "fetchErrorMsg", "onSaveError", "saveErrorMsg", "fetchToFormData", "formToQueryData", "invalidateQueriesOnSuccess", "invalidateQueryKey", "retryText", "cancelLabel", "saveLabel", "size", "title", "form", "show", "onClose", "formikProps"]);
1514
+ props = __rest$1(_a, ["initialValues", "itemLabel", "queryId", "api", "queryFetchOptions", "querySaveOptions", "onSuccess", "onFetchError", "fetchErrorMsg", "onSaveError", "saveErrorMsg", "fetchToFormData", "formToQueryData", "invalidateQueriesOnSuccess", "invalidateQueryKey", "retryText", "cancelLabel", "saveLabel", "size", "title", "form", "show", "onClose", "formikProps"]);
2577
1515
  const {
2578
1516
  isInitialLoading,
2579
1517
  isFetching,
@@ -2661,7 +1599,7 @@ function ItemEditDialog$1(_a) {
2661
1599
  children: jsxs(Form, {
2662
1600
  children: [/*#__PURE__*/React.isValidElement(form) && form, Array.isArray(form) && jsx(FormRenderer, {
2663
1601
  form: form
2664
- }), isFunction$1(form) && jsx(FormRenderer, {
1602
+ }), isFunction(form) && jsx(FormRenderer, {
2665
1603
  form: form(data !== null && data !== void 0 ? data : values)
2666
1604
  })]
2667
1605
  })
@@ -2769,7 +1707,7 @@ function DialogRenderer({
2769
1707
  invalidateQueryKey,
2770
1708
  queryId
2771
1709
  }) {
2772
- const props = __rest(config, ["type"]);
1710
+ const props = __rest$1(config, ["type"]);
2773
1711
  if (config.type === "dialog") return jsx(ItemEditDialog$1, Object.assign({}, props, {
2774
1712
  queryId: queryId,
2775
1713
  invalidateQueryKey: invalidateQueryKey,
@@ -2800,7 +1738,7 @@ function ItemDeleteDialog(_a) {
2800
1738
  show,
2801
1739
  onClose
2802
1740
  } = _a,
2803
- props = __rest(_a, ["itemLabel", "queryId", "api", "invalidateQueriesOnSuccess", "invalidateQueryKey", "size", "show", "onClose"]);
1741
+ props = __rest$1(_a, ["itemLabel", "queryId", "api", "invalidateQueriesOnSuccess", "invalidateQueryKey", "size", "show", "onClose"]);
2804
1742
  const mutation = invalidateQueriesOnSuccess ? useInvalidateParentMutation(api.delete, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api.queryKey) : useApiMutation(api.upsert, api.queryKey);
2805
1743
  const mutate = useMutate(mutation, {
2806
1744
  onSuccess: () => onClose === null || onClose === void 0 ? void 0 : onClose()
@@ -2855,12 +1793,12 @@ function TableViewProvider({
2855
1793
  switch (action.type) {
2856
1794
  case "view":
2857
1795
  {
2858
- navigate(runIfFn$1(action.path, item));
1796
+ navigate(runIfFn(action.path, item));
2859
1797
  break;
2860
1798
  }
2861
1799
  case "link":
2862
1800
  {
2863
- openLink(`${process.env["NEXT_PUBLIC_WEBSITE_URL"]}/${runIfFn$1(action.path, item)}`);
1801
+ openLink(`${process.env["NEXT_PUBLIC_WEBSITE_URL"]}/${runIfFn(action.path, item)}`);
2864
1802
  break;
2865
1803
  }
2866
1804
  case "edit":
@@ -2888,7 +1826,7 @@ function TableViewProvider({
2888
1826
  queryId: item.id,
2889
1827
  invalidateQueryKey: queryKey
2890
1828
  }, deleteItem, {
2891
- itemLabel: runIfFn$1(deleteItem.itemLabel, item)
1829
+ itemLabel: runIfFn(deleteItem.itemLabel, item)
2892
1830
  })));
2893
1831
  // TODO
2894
1832
  // const { initialValues, ...props } = editItem!!
@@ -2982,7 +1920,7 @@ function TableRowPublishPostButton$1(_a) {
2982
1920
  status,
2983
1921
  invalidateQueryKey
2984
1922
  } = _a,
2985
- props = __rest(_a, ["id", "api", "status", "invalidateQueryKey"]);
1923
+ props = __rest$1(_a, ["id", "api", "status", "invalidateQueryKey"]);
2986
1924
  const isDraft = status == "draft";
2987
1925
  const mutation = useInvalidateParentMutation(isDraft ? api.publish : api.unpublish, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api.queryKey, {
2988
1926
  networkMode: "always"
@@ -3041,7 +1979,7 @@ function ActionButton$1(_a) {
3041
1979
  var {
3042
1980
  onClick
3043
1981
  } = _a,
3044
- props = __rest(_a, ["onClick"]);
1982
+ props = __rest$1(_a, ["onClick"]);
3045
1983
  const handleClick = React.useCallback(event => {
3046
1984
  event === null || event === void 0 ? void 0 : event.preventDefault();
3047
1985
  event === null || event === void 0 ? void 0 : event.stopPropagation();
@@ -3082,9 +2020,9 @@ function useTableProps(api, table, rowActions) {
3082
2020
  onRowClick,
3083
2021
  columns: c
3084
2022
  } = table,
3085
- props = __rest(table, ["onRowClick", "columns"]);
2023
+ props = __rest$1(table, ["onRowClick", "columns"]);
3086
2024
  const onRowClickHandler = React.useCallback(item => {
3087
- if ((onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick.type) === "navigate") navigate(runIfFn$1(onRowClick.path, item));else if ((onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick.type) == "link") openLink(`${process.env["NEXT_PUBLIC_WEBSITE_URL"]}/${runIfFn$1(onRowClick.path, item)}`);
2025
+ if ((onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick.type) === "navigate") navigate(runIfFn(onRowClick.path, item));else if ((onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick.type) == "link") openLink(`${process.env["NEXT_PUBLIC_WEBSITE_URL"]}/${runIfFn(onRowClick.path, item)}`);
3088
2026
  }, [navigate, onRowClick]);
3089
2027
  const columns = React.useMemo(() => {
3090
2028
  const columns = table.columns.concat([]);
@@ -3543,9 +2481,9 @@ function TableView(_a) {
3543
2481
  subtitle,
3544
2482
  screen
3545
2483
  } = _a,
3546
- props = __rest(_a, ["queryField", "title", "subtitle", "screen"]);
2484
+ props = __rest$1(_a, ["queryField", "title", "subtitle", "screen"]);
3547
2485
  const id = useId(queryField);
3548
- const _screen = runIfFn$1(screen, id);
2486
+ const _screen = runIfFn(screen, id);
3549
2487
  return jsx(PageContainer, Object.assign({
3550
2488
  p: "5"
3551
2489
  }, props, {
@@ -3582,7 +2520,7 @@ function TT({
3582
2520
  deleteItem,
3583
2521
  breadcrumbs
3584
2522
  } = screen;
3585
- const tableApi = runIfFn$1(api, id !== null && id !== void 0 ? id : "");
2523
+ const tableApi = runIfFn(api, id !== null && id !== void 0 ? id : "");
3586
2524
  return jsxs(Fragment, {
3587
2525
  children: [breadcrumbs && jsx(PageTopBar, {
3588
2526
  breadcrumbs: breadcrumbs
@@ -3658,7 +2596,7 @@ function TableWrapper({
3658
2596
  textSize: "lg",
3659
2597
  textColor: "#475569",
3660
2598
  fontWeight: "600",
3661
- children: isFunction$1(subtitle) ? subtitle(data) : subtitle
2599
+ children: isFunction(subtitle) ? subtitle(data) : subtitle
3662
2600
  });
3663
2601
  };
3664
2602
  }, [subtitle]);
@@ -3680,7 +2618,7 @@ function useQueries(queries) {
3680
2618
  isFetching,
3681
2619
  isError
3682
2620
  } = useApiQueries(queries.map(q => {
3683
- if (!q.queryField || !isFunction$1(q.api)) {
2621
+ if (!q.queryField || !isFunction(q.api)) {
3684
2622
  const _api = q.api;
3685
2623
  return {
3686
2624
  queryKey: _api.queryKey,
@@ -3689,11 +2627,11 @@ function useQueries(queries) {
3689
2627
  };
3690
2628
  }
3691
2629
  const id = params[q.queryField];
3692
- const api = runIfFn$1(q.api, id);
2630
+ const api = runIfFn(q.api, id);
3693
2631
  return {
3694
2632
  queryKey: api.queryKey,
3695
2633
  queryFn: q.fn == "get" ? api.get : api.getAll,
3696
- queryParam: q.fn == "getAll" ? q.params : isFunction$1(q.api) ? undefined : id
2634
+ queryParam: q.fn == "getAll" ? q.params : isFunction(q.api) ? undefined : id
3697
2635
  };
3698
2636
  }));
3699
2637
  let transformedData = undefined;
@@ -3715,11 +2653,11 @@ function useInvalidate(queries) {
3715
2653
  const invalidate = React.useCallback(() => {
3716
2654
  const queryKeys = [];
3717
2655
  queries.forEach(q => {
3718
- if (!q.queryField || !isFunction$1(q.api)) {
2656
+ if (!q.queryField || !isFunction(q.api)) {
3719
2657
  queryKeys.push(q.api.queryKey);
3720
2658
  } else {
3721
2659
  const id = params[q.queryField];
3722
- const api = runIfFn$1(q.api, id);
2660
+ const api = runIfFn(q.api, id);
3723
2661
  queryKeys.push(api.queryKey);
3724
2662
  }
3725
2663
  });
@@ -3735,7 +2673,7 @@ function MultiQueryWrapper(_a) {
3735
2673
  config,
3736
2674
  tabbed
3737
2675
  } = _a,
3738
- props = __rest(_a, ["queries", "config", "tabbed"]);
2676
+ props = __rest$1(_a, ["queries", "config", "tabbed"]);
3739
2677
  const {
3740
2678
  data,
3741
2679
  isFetching,
@@ -3763,7 +2701,7 @@ function ScreenRenderer(_a) {
3763
2701
  config,
3764
2702
  tabbed
3765
2703
  } = _a,
3766
- props = __rest(_a, ["config", "tabbed"]);
2704
+ props = __rest$1(_a, ["config", "tabbed"]);
3767
2705
  if (config.type === "table") return jsx(TableView, Object.assign({}, config, props));
3768
2706
  if (config.type === "tabbed") return jsx(TabbedView, Object.assign({}, config, props));
3769
2707
  if (config.type === "details") return jsx(DetailsView, Object.assign({}, config, {
@@ -3804,7 +2742,7 @@ function AttachDialog(_a) {
3804
2742
  formikProps,
3805
2743
  getItemName
3806
2744
  } = _a,
3807
- props = __rest(_a, ["queryId", "queryKey", "queryFetchFn", "queryFetchAllKey", "queryFetchAllFn", "querySaveFn", "matchKey", "size", "show", "onClose", "itemLabel", "onSuccess", "onFetchError", "fetchErrorMsg", "onSaveError", "saveErrorMsg", "invalidateQueriesOnSuccess", "retryText", "cancelLabel", "saveLabel", "formikProps", "getItemName"]);
2745
+ props = __rest$1(_a, ["queryId", "queryKey", "queryFetchFn", "queryFetchAllKey", "queryFetchAllFn", "querySaveFn", "matchKey", "size", "show", "onClose", "itemLabel", "onSuccess", "onFetchError", "fetchErrorMsg", "onSaveError", "saveErrorMsg", "invalidateQueriesOnSuccess", "retryText", "cancelLabel", "saveLabel", "formikProps", "getItemName"]);
3808
2746
  const queryClient = useQueryClient();
3809
2747
  const {
3810
2748
  data: attached,
@@ -3930,7 +2868,7 @@ function ListItem(_a) {
3930
2868
  value,
3931
2869
  checked
3932
2870
  } = _a,
3933
- props = __rest(_a, ["label", "value", "checked"]);
2871
+ props = __rest$1(_a, ["label", "value", "checked"]);
3934
2872
  return jsxs("div", Object.assign({
3935
2873
  dflex: true,
3936
2874
  alignItems: "center",
@@ -3975,7 +2913,7 @@ function FormActionDialog(_a) {
3975
2913
  onClose,
3976
2914
  formikProps
3977
2915
  } = _a,
3978
- props = __rest(_a, ["initialValues", "itemLabel", "queryId", "queryKey", "queryFn", "queryOptions", "onSuccess", "successMsg", "showSuccessMsg", "onError", "errorMsg", "showErrorMsg", "processInput", "invalidateQueriesOnSuccess", "cancelLabel", "saveLabel", "size", "title", "form", "show", "onClose", "formikProps"]);
2916
+ props = __rest$1(_a, ["initialValues", "itemLabel", "queryId", "queryKey", "queryFn", "queryOptions", "onSuccess", "successMsg", "showSuccessMsg", "onError", "errorMsg", "showErrorMsg", "processInput", "invalidateQueriesOnSuccess", "cancelLabel", "saveLabel", "size", "title", "form", "show", "onClose", "formikProps"]);
3979
2917
  const mutation = invalidateQueriesOnSuccess ? useInvalidateParentMutation(queryFn, queryKey, queryOptions) : useApiMutation(queryFn, queryKey, queryId, queryOptions);
3980
2918
  const mutate = useMutate(mutation, {
3981
2919
  onSuccess,
@@ -4063,7 +3001,7 @@ function ItemEditDialog(_a) {
4063
3001
  onClose,
4064
3002
  formikProps
4065
3003
  } = _a,
4066
- props = __rest(_a, ["initialValues", "itemLabel", "queryId", "queryKey", "queryFetchFn", "queryFetchOptions", "querySaveFn", "querySaveOptions", "onSuccess", "onFetchError", "fetchErrorMsg", "onSaveError", "saveErrorMsg", "fetchToFormData", "formToQueryData", "invalidateQueriesOnSuccess", "invalidateQueryKey", "retryText", "cancelLabel", "saveLabel", "size", "title", "form", "show", "onClose", "formikProps"]);
3004
+ props = __rest$1(_a, ["initialValues", "itemLabel", "queryId", "queryKey", "queryFetchFn", "queryFetchOptions", "querySaveFn", "querySaveOptions", "onSuccess", "onFetchError", "fetchErrorMsg", "onSaveError", "saveErrorMsg", "fetchToFormData", "formToQueryData", "invalidateQueriesOnSuccess", "invalidateQueryKey", "retryText", "cancelLabel", "saveLabel", "size", "title", "form", "show", "onClose", "formikProps"]);
4067
3005
  const {
4068
3006
  isInitialLoading,
4069
3007
  isFetching,
@@ -4148,7 +3086,7 @@ function ItemEditDialog(_a) {
4148
3086
  children: jsxs(Form, {
4149
3087
  children: [/*#__PURE__*/React.isValidElement(form) && form, Array.isArray(form) && jsx(FormRenderer, {
4150
3088
  form: form
4151
- }), isFunction$1(form) && jsx(FormRenderer, {
3089
+ }), isFunction(form) && jsx(FormRenderer, {
4152
3090
  form: form(data !== null && data !== void 0 ? data : values)
4153
3091
  })]
4154
3092
  })
@@ -4179,7 +3117,7 @@ function PageSectionTitle(_a) {
4179
3117
  var {
4180
3118
  children
4181
3119
  } = _a,
4182
- props = __rest(_a, ["children"]);
3120
+ props = __rest$1(_a, ["children"]);
4183
3121
  return jsx("div", Object.assign({
4184
3122
  trait: "typo.h6",
4185
3123
  mb: "5"
@@ -4193,7 +3131,7 @@ const PageStateContainer = /*#__PURE__*/React.forwardRef((_a, ref) => {
4193
3131
  loading = false,
4194
3132
  children
4195
3133
  } = _a,
4196
- props = __rest(_a, ["loading", "children"]);
3134
+ props = __rest$1(_a, ["loading", "children"]);
4197
3135
  return jsxs(Fragment, {
4198
3136
  children: [loading && jsx(QueryLoadingState, {
4199
3137
  w: "full",
@@ -4215,7 +3153,7 @@ function PageSubSectionTitle(_a) {
4215
3153
  var {
4216
3154
  children
4217
3155
  } = _a,
4218
- props = __rest(_a, ["children"]);
3156
+ props = __rest$1(_a, ["children"]);
4219
3157
  return jsx("div", Object.assign({
4220
3158
  trait: "typo.h6",
4221
3159
  mb: "3"
@@ -4244,7 +3182,7 @@ function StatusBadge(_a) {
4244
3182
  var {
4245
3183
  status
4246
3184
  } = _a,
4247
- props = __rest(_a, ["status"]);
3185
+ props = __rest$1(_a, ["status"]);
4248
3186
  return jsx(Badge, Object.assign({
4249
3187
  size: "sm",
4250
3188
  variant: "glass",
@@ -4261,7 +3199,7 @@ function TableRowViewButton(_a) {
4261
3199
  var {
4262
3200
  path
4263
3201
  } = _a,
4264
- props = __rest(_a, ["path"]);
3202
+ props = __rest$1(_a, ["path"]);
4265
3203
  const openPage = React.useCallback(event => {
4266
3204
  event === null || event === void 0 ? void 0 : event.preventDefault();
4267
3205
  event === null || event === void 0 ? void 0 : event.stopPropagation();
@@ -4285,7 +3223,7 @@ function TableRowNavigateButton(_a) {
4285
3223
  var {
4286
3224
  path
4287
3225
  } = _a,
4288
- props = __rest(_a, ["path"]);
3226
+ props = __rest$1(_a, ["path"]);
4289
3227
  const navigate = useNavigate();
4290
3228
  const handleClick = React.useCallback(event => {
4291
3229
  event === null || event === void 0 ? void 0 : event.preventDefault();
@@ -4310,7 +3248,7 @@ function TableRowEditButton(_a) {
4310
3248
  var {
4311
3249
  children
4312
3250
  } = _a,
4313
- props = __rest(_a, ["children"]);
3251
+ props = __rest$1(_a, ["children"]);
4314
3252
  return jsx(DialogButton, Object.assign({
4315
3253
  w: "10",
4316
3254
  h: "10",
@@ -4328,7 +3266,7 @@ function TableRowDeleteButton(_a) {
4328
3266
  var {
4329
3267
  children
4330
3268
  } = _a,
4331
- props = __rest(_a, ["children"]);
3269
+ props = __rest$1(_a, ["children"]);
4332
3270
  return jsx(DialogButton, Object.assign({
4333
3271
  w: "10",
4334
3272
  h: "10",
@@ -4351,7 +3289,7 @@ function TableRowActionBar(_a) {
4351
3289
  deleteDialog,
4352
3290
  children
4353
3291
  } = _a,
4354
- props = __rest(_a, ["publishId", "viewPath", "navigatePath", "editDialog", "deleteDialog", "children"]);
3292
+ props = __rest$1(_a, ["publishId", "viewPath", "navigatePath", "editDialog", "deleteDialog", "children"]);
4355
3293
  return jsxs("div", Object.assign({
4356
3294
  dflex: true,
4357
3295
  spaceX: "1",
@@ -4376,7 +3314,7 @@ function TableRowPublishPostButton(_a) {
4376
3314
  status,
4377
3315
  invalidateQueryKey
4378
3316
  } = _a,
4379
- props = __rest(_a, ["id", "api", "status", "invalidateQueryKey"]);
3317
+ props = __rest$1(_a, ["id", "api", "status", "invalidateQueryKey"]);
4380
3318
  const isDraft = status == "draft";
4381
3319
  const mutation = useInvalidateParentMutation(isDraft ? api.publish : api.unpublish, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api.queryKey, {
4382
3320
  networkMode: "always"