@panneau/data 4.0.82 → 4.1.0

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/dist/index.d.ts +22 -16
  2. package/dist/index.js +718 -363
  3. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -5,11 +5,10 @@ import { getJSON, getCSRFHeaders, postJSON } from '@folklore/fetch';
5
5
  import { generatePath } from '@folklore/routes';
6
6
  import queryString from 'query-string';
7
7
  import { jsx } from 'react/jsx-runtime';
8
- import { useQuery, keepPreviousData, hashKey, useMutation, QueryClient, QueryClientProvider } from '@tanstack/react-query';
8
+ import { useQuery, keepPreviousData, hashKey, useQueryClient, useMutation, QueryClient, QueryClientProvider } from '@tanstack/react-query';
9
9
  import isArray from 'lodash-es/isArray';
10
10
  import isObject from 'lodash-es/isObject';
11
11
  import isString from 'lodash-es/isString';
12
- import { isObject as isObject$1, isString as isString$1 } from 'lodash-es';
13
12
 
14
13
  function useItem(scope, id, loader, t0) {
15
14
  const $ = c(15);
@@ -85,7 +84,7 @@ function useItem(scope, id, loader, t0) {
85
84
  // The new, better version
86
85
 
87
86
  function useItems(scope, t0) {
88
- const $ = c(52);
87
+ const $ = c(51);
89
88
  const {
90
89
  url: t1,
91
90
  getItems: t2,
@@ -208,14 +207,14 @@ function useItems(scope, t0) {
208
207
  }
209
208
  const [updatedItems, setUpdatedItems] = useState(t20);
210
209
  let t21;
211
- if ($[11] !== updatedItems) {
210
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
212
211
  t21 = item => {
213
212
  const {
214
213
  id: t22
215
214
  } = item || {};
216
215
  const itemId = t22 === undefined ? null : t22;
217
216
  if (itemId !== null) {
218
- setUpdatedItems([...(updatedItems || []).filter(t23 => {
217
+ setUpdatedItems(currentUpdatedItems => [...(currentUpdatedItems || []).filter(t23 => {
219
218
  const {
220
219
  id: t24
221
220
  } = t23 === undefined ? {} : t23;
@@ -224,14 +223,13 @@ function useItems(scope, t0) {
224
223
  }), item]);
225
224
  }
226
225
  };
227
- $[11] = updatedItems;
228
- $[12] = t21;
226
+ $[11] = t21;
229
227
  } else {
230
- t21 = $[12];
228
+ t21 = $[11];
231
229
  }
232
230
  const updateItem = t21;
233
231
  let t22;
234
- if ($[13] !== updatedItems) {
232
+ if ($[12] !== updatedItems) {
235
233
  t22 = currentItems => {
236
234
  if (currentItems === null || updatedItems === null || updatedItems.length === 0) {
237
235
  return currentItems;
@@ -254,66 +252,66 @@ function useItems(scope, t0) {
254
252
  return item_0;
255
253
  }, []);
256
254
  };
257
- $[13] = updatedItems;
258
- $[14] = t22;
255
+ $[12] = updatedItems;
256
+ $[13] = t22;
259
257
  } else {
260
- t22 = $[14];
258
+ t22 = $[13];
261
259
  }
262
260
  const replaceUpdatedItems = t22;
263
261
  let t23;
264
- if ($[15] !== items || $[16] !== replaceUpdatedItems) {
262
+ if ($[14] !== items || $[15] !== replaceUpdatedItems) {
265
263
  t23 = replaceUpdatedItems(items);
266
- $[15] = items;
267
- $[16] = replaceUpdatedItems;
268
- $[17] = t23;
264
+ $[14] = items;
265
+ $[15] = replaceUpdatedItems;
266
+ $[16] = t23;
269
267
  } else {
270
- t23 = $[17];
268
+ t23 = $[16];
271
269
  }
272
270
  const finalItems = t23;
273
271
  const pagesKey = hashKey([scope, queryWithoutPage, count]);
274
272
  let t24;
275
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
273
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
276
274
  t24 = {};
277
- $[18] = t24;
275
+ $[17] = t24;
278
276
  } else {
279
- t24 = $[18];
277
+ t24 = $[17];
280
278
  }
281
279
  let t25;
282
- if ($[19] !== pagesKey) {
280
+ if ($[18] !== pagesKey) {
283
281
  t25 = {
284
282
  key: pagesKey,
285
283
  pages: t24
286
284
  };
287
- $[19] = pagesKey;
288
- $[20] = t25;
285
+ $[18] = pagesKey;
286
+ $[19] = t25;
289
287
  } else {
290
- t25 = $[20];
288
+ t25 = $[19];
291
289
  }
292
290
  const [pagesState, setPagesState] = useState(t25);
293
291
  let t26;
294
- if ($[21] !== pagesKey || $[22] !== pagesState.key || $[23] !== pagesState.pages) {
292
+ if ($[20] !== pagesKey || $[21] !== pagesState.key || $[22] !== pagesState.pages) {
295
293
  t26 = pagesState.key === pagesKey ? pagesState.pages : {};
296
- $[21] = pagesKey;
297
- $[22] = pagesState.key;
298
- $[23] = pagesState.pages;
299
- $[24] = t26;
294
+ $[20] = pagesKey;
295
+ $[21] = pagesState.key;
296
+ $[22] = pagesState.pages;
297
+ $[23] = t26;
300
298
  } else {
301
- t26 = $[24];
299
+ t26 = $[23];
302
300
  }
303
301
  const pages = t26;
304
- if (isFetched && !isPlaceholderData && page !== null && data !== null && typeof pages[page] === "undefined") {
302
+ if (isFetched && !isPlaceholderData && page !== null && data !== null && pages[page] !== data) {
305
303
  let t27;
306
- if ($[25] !== data || $[26] !== page || $[27] !== pages) {
304
+ if ($[24] !== data || $[25] !== page || $[26] !== pages) {
307
305
  t27 = {
308
306
  ...pages,
309
307
  [page]: data
310
308
  };
311
- $[25] = data;
312
- $[26] = page;
313
- $[27] = pages;
314
- $[28] = t27;
309
+ $[24] = data;
310
+ $[25] = page;
311
+ $[26] = pages;
312
+ $[27] = t27;
315
313
  } else {
316
- t27 = $[28];
314
+ t27 = $[27];
317
315
  }
318
316
  setPagesState({
319
317
  key: pagesKey,
@@ -321,34 +319,34 @@ function useItems(scope, t0) {
321
319
  });
322
320
  }
323
321
  let t27;
324
- if ($[29] !== finalItems || $[30] !== pages || $[31] !== replaceUpdatedItems) {
322
+ if ($[28] !== finalItems || $[29] !== pages || $[30] !== replaceUpdatedItems) {
325
323
  t27 = Object.keys(pages).length > 0 ? replaceUpdatedItems(Object.keys(pages).flatMap(k => pages[k]?.data)) : finalItems;
326
- $[29] = finalItems;
327
- $[30] = pages;
328
- $[31] = replaceUpdatedItems;
329
- $[32] = t27;
324
+ $[28] = finalItems;
325
+ $[29] = pages;
326
+ $[30] = replaceUpdatedItems;
327
+ $[31] = t27;
330
328
  } else {
331
- t27 = $[32];
329
+ t27 = $[31];
332
330
  }
333
331
  const allItems = t27;
334
332
  const finalLoading = isLoading || isFetching || isRefetching;
335
333
  let t28;
336
- if ($[33] !== currentPage || $[34] !== lastPage || $[35] !== paginated || $[36] !== total) {
334
+ if ($[32] !== currentPage || $[33] !== lastPage || $[34] !== paginated || $[35] !== total) {
337
335
  t28 = paginated ? {
338
336
  page: currentPage,
339
337
  lastPage,
340
338
  total
341
339
  } : null;
342
- $[33] = currentPage;
343
- $[34] = lastPage;
344
- $[35] = paginated;
345
- $[36] = total;
346
- $[37] = t28;
340
+ $[32] = currentPage;
341
+ $[33] = lastPage;
342
+ $[34] = paginated;
343
+ $[35] = total;
344
+ $[36] = t28;
347
345
  } else {
348
- t28 = $[37];
346
+ t28 = $[36];
349
347
  }
350
348
  let t29;
351
- if ($[38] !== allItems || $[39] !== finalItems || $[40] !== finalLoading || $[41] !== isFetched || $[42] !== isFetching || $[43] !== isLoading || $[44] !== isPlaceholderData || $[45] !== isRefetching || $[46] !== otherProps || $[47] !== pages || $[48] !== reload || $[49] !== t28 || $[50] !== updateItem) {
349
+ if ($[37] !== allItems || $[38] !== finalItems || $[39] !== finalLoading || $[40] !== isFetched || $[41] !== isFetching || $[42] !== isLoading || $[43] !== isPlaceholderData || $[44] !== isRefetching || $[45] !== otherProps || $[46] !== pages || $[47] !== reload || $[48] !== t28 || $[49] !== updateItem) {
352
350
  t29 = {
353
351
  ...otherProps,
354
352
  isLoading,
@@ -365,22 +363,22 @@ function useItems(scope, t0) {
365
363
  updateItem,
366
364
  pagination: t28
367
365
  };
368
- $[38] = allItems;
369
- $[39] = finalItems;
370
- $[40] = finalLoading;
371
- $[41] = isFetched;
372
- $[42] = isFetching;
373
- $[43] = isLoading;
374
- $[44] = isPlaceholderData;
375
- $[45] = isRefetching;
376
- $[46] = otherProps;
377
- $[47] = pages;
378
- $[48] = reload;
379
- $[49] = t28;
380
- $[50] = updateItem;
381
- $[51] = t29;
382
- } else {
383
- t29 = $[51];
366
+ $[37] = allItems;
367
+ $[38] = finalItems;
368
+ $[39] = finalLoading;
369
+ $[40] = isFetched;
370
+ $[41] = isFetching;
371
+ $[42] = isLoading;
372
+ $[43] = isPlaceholderData;
373
+ $[44] = isRefetching;
374
+ $[45] = otherProps;
375
+ $[46] = pages;
376
+ $[47] = reload;
377
+ $[48] = t28;
378
+ $[49] = updateItem;
379
+ $[50] = t29;
380
+ } else {
381
+ t29 = $[50];
384
382
  }
385
383
  return t29;
386
384
  }
@@ -441,12 +439,19 @@ class Base {
441
439
  routes,
442
440
  generateUrl = null
443
441
  } = this.options;
444
- if (generateUrl !== null) {
445
- return generateUrl(route, params);
442
+ // The url generator returns null for routes it doesn't know: fallback to the routes option
443
+ const url = generateUrl !== null ? generateUrl(route, params) : null;
444
+ if (url !== null && typeof url !== 'undefined') {
445
+ return url;
446
446
  }
447
- return generatePath(routes?.[route] || route, params);
447
+ const path = routes?.[route] ?? null;
448
+ // Return null for unknown routes, so callers can fallback to another route
449
+ return path !== null ? generatePath(path, params || {}) : null;
448
450
  }
449
451
  getFullUrl(path, query = null) {
452
+ if (path === null || typeof path === 'undefined') {
453
+ throw new Error('Api: route not found');
454
+ }
450
455
  const {
451
456
  baseUrl = null
452
457
  } = this.options;
@@ -748,8 +753,42 @@ function ApiProvider(t0) {
748
753
  return t6;
749
754
  }
750
755
 
756
+ /**
757
+ * Resolve the arguments of resource hooks supporting these call forms:
758
+ * (resource), (id), (resource, id), (resource, options), (id, options), (resource, id, options)
759
+ *
760
+ * The first argument is the resource when it is an object or a known resource id, or when a
761
+ * non-null id is passed as second argument. Otherwise, it is considered as the item id and the
762
+ * resource from the context is used.
763
+ */
764
+ function useResourceArguments(resource, id, options) {
765
+ const $ = c(4);
766
+ const idIsOptions = isObject(id);
767
+ const providedResource = usePanneauResource(resource);
768
+ const contextResource = useResource();
769
+ const resourceIsExplicit = providedResource !== null || !idIsOptions && id !== null;
770
+ const t0 = providedResource || contextResource || null;
771
+ const t1 = resourceIsExplicit ? idIsOptions ? null : id : resource;
772
+ const t2 = idIsOptions ? id : options;
773
+ let t3;
774
+ if ($[0] !== t0 || $[1] !== t1 || $[2] !== t2) {
775
+ t3 = {
776
+ resource: t0,
777
+ id: t1,
778
+ options: t2
779
+ };
780
+ $[0] = t0;
781
+ $[1] = t1;
782
+ $[2] = t2;
783
+ $[3] = t3;
784
+ } else {
785
+ t3 = $[3];
786
+ }
787
+ return t3;
788
+ }
789
+
751
790
  function useResourceDestroy(t0, t1, t2) {
752
- const $ = c(19);
791
+ const $ = c(32);
753
792
  const resource = t0 === undefined ? null : t0;
754
793
  const id = t1 === undefined ? null : t1;
755
794
  let t3;
@@ -761,62 +800,127 @@ function useResourceDestroy(t0, t1, t2) {
761
800
  t3 = $[1];
762
801
  }
763
802
  const options = t3;
764
- const providedResource = usePanneauResource(id !== null && !isObject(id) ? resource : null);
765
- const contextResource = useResource();
766
- const finalResource = providedResource || contextResource;
767
- const finalId = providedResource !== null ? id : resource;
768
- const api = useApi();
803
+ const {
804
+ resource: finalResource,
805
+ id: finalId,
806
+ options: finalOptions
807
+ } = useResourceArguments(resource, id, options);
769
808
  let t4;
770
- if ($[2] !== api || $[3] !== finalId || $[4] !== finalResource) {
771
- t4 = t5 => {
772
- const providedId = t5 === undefined ? null : t5;
809
+ if ($[2] !== finalOptions) {
810
+ t4 = finalOptions || {};
811
+ $[2] = finalOptions;
812
+ $[3] = t4;
813
+ } else {
814
+ t4 = $[3];
815
+ }
816
+ let otherOptions;
817
+ let t5;
818
+ if ($[4] !== t4) {
819
+ ({
820
+ onSuccess: t5,
821
+ ...otherOptions
822
+ } = t4);
823
+ $[4] = t4;
824
+ $[5] = otherOptions;
825
+ $[6] = t5;
826
+ } else {
827
+ otherOptions = $[5];
828
+ t5 = $[6];
829
+ }
830
+ const customOnSuccess = t5 === undefined ? null : t5;
831
+ let t6;
832
+ if ($[7] !== finalResource) {
833
+ t6 = finalResource || {};
834
+ $[7] = finalResource;
835
+ $[8] = t6;
836
+ } else {
837
+ t6 = $[8];
838
+ }
839
+ const {
840
+ id: t7
841
+ } = t6;
842
+ const resourceId = t7 === undefined ? null : t7;
843
+ const api = useApi();
844
+ const queryClient = useQueryClient();
845
+ let t8;
846
+ if ($[9] !== api || $[10] !== finalId || $[11] !== finalResource) {
847
+ t8 = t9 => {
848
+ const providedId = t9 === undefined ? null : t9;
773
849
  return api.resources.destroy(finalResource, providedId ?? finalId);
774
850
  };
775
- $[2] = api;
776
- $[3] = finalId;
777
- $[4] = finalResource;
778
- $[5] = t4;
851
+ $[9] = api;
852
+ $[10] = finalId;
853
+ $[11] = finalResource;
854
+ $[12] = t8;
779
855
  } else {
780
- t4 = $[5];
856
+ t8 = $[12];
781
857
  }
782
- let t5;
783
- if ($[6] !== options || $[7] !== t4) {
784
- t5 = {
785
- mutationFn: t4,
786
- ...options
858
+ let t9;
859
+ if ($[13] !== customOnSuccess || $[14] !== finalId || $[15] !== queryClient || $[16] !== resourceId) {
860
+ t9 = (data, variables, ...t10) => {
861
+ const args = t10;
862
+ const destroyedId = variables ?? finalId;
863
+ queryClient.invalidateQueries({
864
+ queryKey: [resourceId],
865
+ predicate: t11 => {
866
+ const {
867
+ queryKey
868
+ } = t11;
869
+ return String(queryKey[1]) !== String(destroyedId);
870
+ }
871
+ });
872
+ if (customOnSuccess !== null) {
873
+ return customOnSuccess(data, variables, ...args);
874
+ }
787
875
  };
788
- $[6] = options;
789
- $[7] = t4;
790
- $[8] = t5;
876
+ $[13] = customOnSuccess;
877
+ $[14] = finalId;
878
+ $[15] = queryClient;
879
+ $[16] = resourceId;
880
+ $[17] = t9;
791
881
  } else {
792
- t5 = $[8];
882
+ t9 = $[17];
883
+ }
884
+ let t10;
885
+ if ($[18] !== otherOptions || $[19] !== t8 || $[20] !== t9) {
886
+ t10 = {
887
+ mutationFn: t8,
888
+ onSuccess: t9,
889
+ ...otherOptions
890
+ };
891
+ $[18] = otherOptions;
892
+ $[19] = t8;
893
+ $[20] = t9;
894
+ $[21] = t10;
895
+ } else {
896
+ t10 = $[21];
793
897
  }
794
- const t6 = useMutation(t5);
898
+ const t11 = useMutation(t10);
795
899
  let isPending;
796
900
  let mutate;
797
901
  let mutateAsync;
798
902
  let other;
799
- if ($[9] !== t6) {
903
+ if ($[22] !== t11) {
800
904
  ({
801
905
  mutate,
802
906
  mutateAsync,
803
907
  isPending,
804
908
  ...other
805
- } = t6);
806
- $[9] = t6;
807
- $[10] = isPending;
808
- $[11] = mutate;
809
- $[12] = mutateAsync;
810
- $[13] = other;
909
+ } = t11);
910
+ $[22] = t11;
911
+ $[23] = isPending;
912
+ $[24] = mutate;
913
+ $[25] = mutateAsync;
914
+ $[26] = other;
811
915
  } else {
812
- isPending = $[10];
813
- mutate = $[11];
814
- mutateAsync = $[12];
815
- other = $[13];
916
+ isPending = $[23];
917
+ mutate = $[24];
918
+ mutateAsync = $[25];
919
+ other = $[26];
816
920
  }
817
- let t7;
818
- if ($[14] !== isPending || $[15] !== mutate || $[16] !== mutateAsync || $[17] !== other) {
819
- t7 = {
921
+ let t12;
922
+ if ($[27] !== isPending || $[28] !== mutate || $[29] !== mutateAsync || $[30] !== other) {
923
+ t12 = {
820
924
  destroy: mutate,
821
925
  destroyAsync: mutateAsync,
822
926
  loading: isPending,
@@ -825,19 +929,19 @@ function useResourceDestroy(t0, t1, t2) {
825
929
  isPending,
826
930
  ...other
827
931
  };
828
- $[14] = isPending;
829
- $[15] = mutate;
830
- $[16] = mutateAsync;
831
- $[17] = other;
832
- $[18] = t7;
932
+ $[27] = isPending;
933
+ $[28] = mutate;
934
+ $[29] = mutateAsync;
935
+ $[30] = other;
936
+ $[31] = t12;
833
937
  } else {
834
- t7 = $[18];
938
+ t12 = $[31];
835
939
  }
836
- return t7;
940
+ return t12;
837
941
  }
838
942
 
839
943
  function useResourceItem(resource, t0, t1) {
840
- const $ = c(17);
944
+ const $ = c(19);
841
945
  const id = t0 === undefined ? null : t0;
842
946
  const opts = t1 === undefined ? null : t1;
843
947
  const api = useApi();
@@ -845,71 +949,81 @@ function useResourceItem(resource, t0, t1) {
845
949
  const contextResource = useResource();
846
950
  const finalResource = providedResource || contextResource;
847
951
  const finalId = providedResource !== null ? id : resource;
848
- const {
849
- id: resourceId
850
- } = finalResource;
851
952
  let t2;
852
- if ($[0] !== finalId || $[1] !== resourceId) {
853
- t2 = [resourceId, finalId];
854
- $[0] = finalId;
855
- $[1] = resourceId;
856
- $[2] = t2;
953
+ if ($[0] !== finalResource) {
954
+ t2 = finalResource || {};
955
+ $[0] = finalResource;
956
+ $[1] = t2;
857
957
  } else {
858
- t2 = $[2];
958
+ t2 = $[1];
859
959
  }
860
- let t3;
861
- if ($[3] !== api || $[4] !== finalId || $[5] !== finalResource) {
862
- t3 = () => api.resources.find(finalResource, finalId);
863
- $[3] = api;
864
- $[4] = finalId;
865
- $[5] = finalResource;
866
- $[6] = t3;
960
+ const {
961
+ id: t3
962
+ } = t2;
963
+ const resourceId = t3 === undefined ? null : t3;
964
+ const t4 = finalId !== null ? String(finalId) : null;
965
+ let t5;
966
+ if ($[2] !== resourceId || $[3] !== t4) {
967
+ t5 = [resourceId, t4];
968
+ $[2] = resourceId;
969
+ $[3] = t4;
970
+ $[4] = t5;
867
971
  } else {
868
- t3 = $[6];
972
+ t5 = $[4];
869
973
  }
870
- let t4;
871
- if ($[7] !== opts || $[8] !== t2 || $[9] !== t3) {
872
- t4 = {
873
- queryKey: t2,
874
- queryFn: t3,
974
+ let t6;
975
+ if ($[5] !== api || $[6] !== finalId || $[7] !== finalResource) {
976
+ t6 = () => api.resources.find(finalResource, finalId);
977
+ $[5] = api;
978
+ $[6] = finalId;
979
+ $[7] = finalResource;
980
+ $[8] = t6;
981
+ } else {
982
+ t6 = $[8];
983
+ }
984
+ let t7;
985
+ if ($[9] !== opts || $[10] !== t5 || $[11] !== t6) {
986
+ t7 = {
987
+ queryKey: t5,
988
+ queryFn: t6,
875
989
  ...opts
876
990
  };
877
- $[7] = opts;
878
- $[8] = t2;
879
- $[9] = t3;
880
- $[10] = t4;
991
+ $[9] = opts;
992
+ $[10] = t5;
993
+ $[11] = t6;
994
+ $[12] = t7;
881
995
  } else {
882
- t4 = $[10];
996
+ t7 = $[12];
883
997
  }
884
- const t5 = useQuery(t4);
998
+ const t8 = useQuery(t7);
885
999
  let request;
886
- let t6;
887
- if ($[11] !== t5) {
1000
+ let t9;
1001
+ if ($[13] !== t8) {
888
1002
  ({
889
- data: t6,
1003
+ data: t9,
890
1004
  ...request
891
- } = t5);
892
- $[11] = t5;
893
- $[12] = request;
894
- $[13] = t6;
1005
+ } = t8);
1006
+ $[13] = t8;
1007
+ $[14] = request;
1008
+ $[15] = t9;
895
1009
  } else {
896
- request = $[12];
897
- t6 = $[13];
1010
+ request = $[14];
1011
+ t9 = $[15];
898
1012
  }
899
- const data = t6 === undefined ? null : t6;
900
- let t7;
901
- if ($[14] !== data || $[15] !== request) {
902
- t7 = {
1013
+ const data = t9 === undefined ? null : t9;
1014
+ let t10;
1015
+ if ($[16] !== data || $[17] !== request) {
1016
+ t10 = {
903
1017
  item: data,
904
1018
  ...request
905
1019
  };
906
- $[14] = data;
907
- $[15] = request;
908
- $[16] = t7;
1020
+ $[16] = data;
1021
+ $[17] = request;
1022
+ $[18] = t10;
909
1023
  } else {
910
- t7 = $[16];
1024
+ t10 = $[18];
911
1025
  }
912
- return t7;
1026
+ return t10;
913
1027
  }
914
1028
 
915
1029
  function useResourceItems(t0, t1, t2, t3, t4) {
@@ -976,7 +1090,7 @@ function useResourceItems(t0, t1, t2, t3, t4) {
976
1090
  }
977
1091
 
978
1092
  function useResourceStore(resource, t0) {
979
- const $ = c(18);
1093
+ const $ = c(30);
980
1094
  let t1;
981
1095
  if ($[0] !== t0) {
982
1096
  t1 = t0 === undefined ? {} : t0;
@@ -989,54 +1103,110 @@ function useResourceStore(resource, t0) {
989
1103
  const providedResource = usePanneauResource(resource);
990
1104
  const contextResource = useResource();
991
1105
  const finalResource = providedResource || contextResource;
992
- const api = useApi();
993
1106
  let t2;
994
- if ($[2] !== api || $[3] !== finalResource) {
995
- t2 = data => api.resources.store(finalResource, data);
996
- $[2] = api;
997
- $[3] = finalResource;
998
- $[4] = t2;
1107
+ if ($[2] !== finalResource) {
1108
+ t2 = finalResource || {};
1109
+ $[2] = finalResource;
1110
+ $[3] = t2;
999
1111
  } else {
1000
- t2 = $[4];
1112
+ t2 = $[3];
1001
1113
  }
1002
- let t3;
1003
- if ($[5] !== options || $[6] !== t2) {
1004
- t3 = {
1005
- mutationFn: t2,
1006
- ...options
1114
+ const {
1115
+ id: t3
1116
+ } = t2;
1117
+ const resourceId = t3 === undefined ? null : t3;
1118
+ let t4;
1119
+ if ($[4] !== options) {
1120
+ t4 = options || {};
1121
+ $[4] = options;
1122
+ $[5] = t4;
1123
+ } else {
1124
+ t4 = $[5];
1125
+ }
1126
+ let otherOptions;
1127
+ let t5;
1128
+ if ($[6] !== t4) {
1129
+ ({
1130
+ onSuccess: t5,
1131
+ ...otherOptions
1132
+ } = t4);
1133
+ $[6] = t4;
1134
+ $[7] = otherOptions;
1135
+ $[8] = t5;
1136
+ } else {
1137
+ otherOptions = $[7];
1138
+ t5 = $[8];
1139
+ }
1140
+ const customOnSuccess = t5 === undefined ? null : t5;
1141
+ const api = useApi();
1142
+ const queryClient = useQueryClient();
1143
+ let t6;
1144
+ if ($[9] !== api || $[10] !== finalResource) {
1145
+ t6 = data => api.resources.store(finalResource, data);
1146
+ $[9] = api;
1147
+ $[10] = finalResource;
1148
+ $[11] = t6;
1149
+ } else {
1150
+ t6 = $[11];
1151
+ }
1152
+ let t7;
1153
+ if ($[12] !== customOnSuccess || $[13] !== queryClient || $[14] !== resourceId) {
1154
+ t7 = (data_0, ...t8) => {
1155
+ const args = t8;
1156
+ queryClient.invalidateQueries({
1157
+ queryKey: [resourceId]
1158
+ });
1159
+ if (customOnSuccess !== null) {
1160
+ return customOnSuccess(data_0, ...args);
1161
+ }
1007
1162
  };
1008
- $[5] = options;
1009
- $[6] = t2;
1010
- $[7] = t3;
1163
+ $[12] = customOnSuccess;
1164
+ $[13] = queryClient;
1165
+ $[14] = resourceId;
1166
+ $[15] = t7;
1011
1167
  } else {
1012
- t3 = $[7];
1168
+ t7 = $[15];
1013
1169
  }
1014
- const t4 = useMutation(t3);
1170
+ let t8;
1171
+ if ($[16] !== otherOptions || $[17] !== t6 || $[18] !== t7) {
1172
+ t8 = {
1173
+ mutationFn: t6,
1174
+ onSuccess: t7,
1175
+ ...otherOptions
1176
+ };
1177
+ $[16] = otherOptions;
1178
+ $[17] = t6;
1179
+ $[18] = t7;
1180
+ $[19] = t8;
1181
+ } else {
1182
+ t8 = $[19];
1183
+ }
1184
+ const t9 = useMutation(t8);
1015
1185
  let isPending;
1016
1186
  let mutate;
1017
1187
  let mutateAsync;
1018
1188
  let other;
1019
- if ($[8] !== t4) {
1189
+ if ($[20] !== t9) {
1020
1190
  ({
1021
1191
  mutate,
1022
1192
  mutateAsync,
1023
1193
  isPending,
1024
1194
  ...other
1025
- } = t4);
1026
- $[8] = t4;
1027
- $[9] = isPending;
1028
- $[10] = mutate;
1029
- $[11] = mutateAsync;
1030
- $[12] = other;
1195
+ } = t9);
1196
+ $[20] = t9;
1197
+ $[21] = isPending;
1198
+ $[22] = mutate;
1199
+ $[23] = mutateAsync;
1200
+ $[24] = other;
1031
1201
  } else {
1032
- isPending = $[9];
1033
- mutate = $[10];
1034
- mutateAsync = $[11];
1035
- other = $[12];
1036
- }
1037
- let t5;
1038
- if ($[13] !== isPending || $[14] !== mutate || $[15] !== mutateAsync || $[16] !== other) {
1039
- t5 = {
1202
+ isPending = $[21];
1203
+ mutate = $[22];
1204
+ mutateAsync = $[23];
1205
+ other = $[24];
1206
+ }
1207
+ let t10;
1208
+ if ($[25] !== isPending || $[26] !== mutate || $[27] !== mutateAsync || $[28] !== other) {
1209
+ t10 = {
1040
1210
  store: mutate,
1041
1211
  storeAsync: mutateAsync,
1042
1212
  loading: isPending,
@@ -1045,19 +1215,19 @@ function useResourceStore(resource, t0) {
1045
1215
  isPending,
1046
1216
  ...other
1047
1217
  };
1048
- $[13] = isPending;
1049
- $[14] = mutate;
1050
- $[15] = mutateAsync;
1051
- $[16] = other;
1052
- $[17] = t5;
1218
+ $[25] = isPending;
1219
+ $[26] = mutate;
1220
+ $[27] = mutateAsync;
1221
+ $[28] = other;
1222
+ $[29] = t10;
1053
1223
  } else {
1054
- t5 = $[17];
1224
+ t10 = $[29];
1055
1225
  }
1056
- return t5;
1226
+ return t10;
1057
1227
  }
1058
1228
 
1059
1229
  function useResourceUpdate(resource, t0, t1) {
1060
- const $ = c(22);
1230
+ const $ = c(32);
1061
1231
  const id = t0 === undefined ? null : t0;
1062
1232
  let t2;
1063
1233
  if ($[0] !== t1) {
@@ -1068,69 +1238,124 @@ function useResourceUpdate(resource, t0, t1) {
1068
1238
  t2 = $[1];
1069
1239
  }
1070
1240
  const options = t2;
1071
- const providedResource = usePanneauResource(isObject$1(resource) || isString$1(id) ? resource : null);
1072
- const contextResource = useResource();
1073
- const finalResource = providedResource || contextResource;
1074
- const finalId = !isObject$1(id) ? id : resource;
1241
+ const {
1242
+ resource: finalResource,
1243
+ id: finalId,
1244
+ options: finalOptions
1245
+ } = useResourceArguments(resource, id, options);
1075
1246
  let t3;
1076
- if ($[2] !== id || $[3] !== options) {
1077
- t3 = isObject$1(id) ? id : options;
1078
- $[2] = id;
1079
- $[3] = options;
1080
- $[4] = t3;
1247
+ if ($[2] !== finalOptions) {
1248
+ t3 = finalOptions || {};
1249
+ $[2] = finalOptions;
1250
+ $[3] = t3;
1081
1251
  } else {
1082
- t3 = $[4];
1252
+ t3 = $[3];
1083
1253
  }
1084
- const finalOptions = t3;
1085
- const api = useApi();
1254
+ let otherOptions;
1086
1255
  let t4;
1087
- if ($[5] !== api || $[6] !== finalId || $[7] !== finalResource) {
1088
- t4 = data => api.resources.update(finalResource, finalId, data);
1089
- $[5] = api;
1090
- $[6] = finalId;
1091
- $[7] = finalResource;
1092
- $[8] = t4;
1256
+ if ($[4] !== t3) {
1257
+ ({
1258
+ onSuccess: t4,
1259
+ ...otherOptions
1260
+ } = t3);
1261
+ $[4] = t3;
1262
+ $[5] = otherOptions;
1263
+ $[6] = t4;
1093
1264
  } else {
1094
- t4 = $[8];
1265
+ otherOptions = $[5];
1266
+ t4 = $[6];
1095
1267
  }
1268
+ const customOnSuccess = t4 === undefined ? null : t4;
1096
1269
  let t5;
1097
- if ($[9] !== finalOptions || $[10] !== t4) {
1098
- t5 = {
1099
- mutationFn: t4,
1100
- ...finalOptions
1270
+ if ($[7] !== finalResource) {
1271
+ t5 = finalResource || {};
1272
+ $[7] = finalResource;
1273
+ $[8] = t5;
1274
+ } else {
1275
+ t5 = $[8];
1276
+ }
1277
+ const {
1278
+ id: t6
1279
+ } = t5;
1280
+ const resourceId = t6 === undefined ? null : t6;
1281
+ const api = useApi();
1282
+ const queryClient = useQueryClient();
1283
+ let t7;
1284
+ if ($[9] !== api || $[10] !== finalId || $[11] !== finalResource) {
1285
+ t7 = data => api.resources.update(finalResource, finalId, data);
1286
+ $[9] = api;
1287
+ $[10] = finalId;
1288
+ $[11] = finalResource;
1289
+ $[12] = t7;
1290
+ } else {
1291
+ t7 = $[12];
1292
+ }
1293
+ let t8;
1294
+ if ($[13] !== customOnSuccess || $[14] !== finalId || $[15] !== queryClient || $[16] !== resourceId) {
1295
+ t8 = (data_0, ...t9) => {
1296
+ const args = t9;
1297
+ queryClient.setQueryData([resourceId, String(finalId)], data_0);
1298
+ queryClient.invalidateQueries({
1299
+ queryKey: [resourceId],
1300
+ predicate: t10 => {
1301
+ const {
1302
+ queryKey
1303
+ } = t10;
1304
+ return String(queryKey[1]) !== String(finalId);
1305
+ }
1306
+ });
1307
+ if (customOnSuccess !== null) {
1308
+ return customOnSuccess(data_0, ...args);
1309
+ }
1101
1310
  };
1102
- $[9] = finalOptions;
1103
- $[10] = t4;
1104
- $[11] = t5;
1311
+ $[13] = customOnSuccess;
1312
+ $[14] = finalId;
1313
+ $[15] = queryClient;
1314
+ $[16] = resourceId;
1315
+ $[17] = t8;
1105
1316
  } else {
1106
- t5 = $[11];
1317
+ t8 = $[17];
1107
1318
  }
1108
- const t6 = useMutation(t5);
1319
+ let t9;
1320
+ if ($[18] !== otherOptions || $[19] !== t7 || $[20] !== t8) {
1321
+ t9 = {
1322
+ mutationFn: t7,
1323
+ onSuccess: t8,
1324
+ ...otherOptions
1325
+ };
1326
+ $[18] = otherOptions;
1327
+ $[19] = t7;
1328
+ $[20] = t8;
1329
+ $[21] = t9;
1330
+ } else {
1331
+ t9 = $[21];
1332
+ }
1333
+ const t10 = useMutation(t9);
1109
1334
  let isPending;
1110
1335
  let mutate;
1111
1336
  let mutateAsync;
1112
1337
  let other;
1113
- if ($[12] !== t6) {
1338
+ if ($[22] !== t10) {
1114
1339
  ({
1115
1340
  mutate,
1116
1341
  mutateAsync,
1117
1342
  isPending,
1118
1343
  ...other
1119
- } = t6);
1120
- $[12] = t6;
1121
- $[13] = isPending;
1122
- $[14] = mutate;
1123
- $[15] = mutateAsync;
1124
- $[16] = other;
1125
- } else {
1126
- isPending = $[13];
1127
- mutate = $[14];
1128
- mutateAsync = $[15];
1129
- other = $[16];
1344
+ } = t10);
1345
+ $[22] = t10;
1346
+ $[23] = isPending;
1347
+ $[24] = mutate;
1348
+ $[25] = mutateAsync;
1349
+ $[26] = other;
1350
+ } else {
1351
+ isPending = $[23];
1352
+ mutate = $[24];
1353
+ mutateAsync = $[25];
1354
+ other = $[26];
1130
1355
  }
1131
- let t7;
1132
- if ($[17] !== isPending || $[18] !== mutate || $[19] !== mutateAsync || $[20] !== other) {
1133
- t7 = {
1356
+ let t11;
1357
+ if ($[27] !== isPending || $[28] !== mutate || $[29] !== mutateAsync || $[30] !== other) {
1358
+ t11 = {
1134
1359
  update: mutate,
1135
1360
  updateAsync: mutateAsync,
1136
1361
  loading: isPending,
@@ -1139,19 +1364,19 @@ function useResourceUpdate(resource, t0, t1) {
1139
1364
  isPending,
1140
1365
  ...other
1141
1366
  };
1142
- $[17] = isPending;
1143
- $[18] = mutate;
1144
- $[19] = mutateAsync;
1145
- $[20] = other;
1146
- $[21] = t7;
1367
+ $[27] = isPending;
1368
+ $[28] = mutate;
1369
+ $[29] = mutateAsync;
1370
+ $[30] = other;
1371
+ $[31] = t11;
1147
1372
  } else {
1148
- t7 = $[21];
1373
+ t11 = $[31];
1149
1374
  }
1150
- return t7;
1375
+ return t11;
1151
1376
  }
1152
1377
 
1153
1378
  function useResourceClone(t0, t1, t2) {
1154
- const $ = c(19);
1379
+ const $ = c(31);
1155
1380
  const resource = t0 === undefined ? null : t0;
1156
1381
  const id = t1 === undefined ? null : t1;
1157
1382
  let t3;
@@ -1163,62 +1388,119 @@ function useResourceClone(t0, t1, t2) {
1163
1388
  t3 = $[1];
1164
1389
  }
1165
1390
  const options = t3;
1166
- const providedResource = usePanneauResource(id !== null && !isObject(id) ? resource : null);
1167
- const contextResource = useResource();
1168
- const finalResource = providedResource || contextResource;
1169
- const finalId = providedResource !== null ? id : resource;
1170
- const api = useApi();
1391
+ const {
1392
+ resource: finalResource,
1393
+ id: finalId,
1394
+ options: finalOptions
1395
+ } = useResourceArguments(resource, id, options);
1171
1396
  let t4;
1172
- if ($[2] !== api || $[3] !== finalId || $[4] !== finalResource) {
1173
- t4 = t5 => {
1174
- const providedId = t5 === undefined ? null : t5;
1397
+ if ($[2] !== finalOptions) {
1398
+ t4 = finalOptions || {};
1399
+ $[2] = finalOptions;
1400
+ $[3] = t4;
1401
+ } else {
1402
+ t4 = $[3];
1403
+ }
1404
+ let otherOptions;
1405
+ let t5;
1406
+ if ($[4] !== t4) {
1407
+ ({
1408
+ onSuccess: t5,
1409
+ ...otherOptions
1410
+ } = t4);
1411
+ $[4] = t4;
1412
+ $[5] = otherOptions;
1413
+ $[6] = t5;
1414
+ } else {
1415
+ otherOptions = $[5];
1416
+ t5 = $[6];
1417
+ }
1418
+ const customOnSuccess = t5 === undefined ? null : t5;
1419
+ let t6;
1420
+ if ($[7] !== finalResource) {
1421
+ t6 = finalResource || {};
1422
+ $[7] = finalResource;
1423
+ $[8] = t6;
1424
+ } else {
1425
+ t6 = $[8];
1426
+ }
1427
+ const {
1428
+ id: t7
1429
+ } = t6;
1430
+ const resourceId = t7 === undefined ? null : t7;
1431
+ const api = useApi();
1432
+ const queryClient = useQueryClient();
1433
+ let t8;
1434
+ if ($[9] !== api || $[10] !== finalId || $[11] !== finalResource) {
1435
+ t8 = t9 => {
1436
+ const providedId = t9 === undefined ? null : t9;
1175
1437
  return api.resources.clone(finalResource, providedId ?? finalId);
1176
1438
  };
1177
- $[2] = api;
1178
- $[3] = finalId;
1179
- $[4] = finalResource;
1180
- $[5] = t4;
1439
+ $[9] = api;
1440
+ $[10] = finalId;
1441
+ $[11] = finalResource;
1442
+ $[12] = t8;
1181
1443
  } else {
1182
- t4 = $[5];
1444
+ t8 = $[12];
1183
1445
  }
1184
- let t5;
1185
- if ($[6] !== options || $[7] !== t4) {
1186
- t5 = {
1187
- mutationFn: t4,
1188
- ...options
1446
+ let t9;
1447
+ if ($[13] !== customOnSuccess || $[14] !== queryClient || $[15] !== resourceId) {
1448
+ t9 = (data, variables, ...t10) => {
1449
+ const args = t10;
1450
+ queryClient.invalidateQueries({
1451
+ queryKey: [resourceId]
1452
+ });
1453
+ if (customOnSuccess !== null) {
1454
+ return customOnSuccess(data, variables, ...args);
1455
+ }
1189
1456
  };
1190
- $[6] = options;
1191
- $[7] = t4;
1192
- $[8] = t5;
1457
+ $[13] = customOnSuccess;
1458
+ $[14] = queryClient;
1459
+ $[15] = resourceId;
1460
+ $[16] = t9;
1193
1461
  } else {
1194
- t5 = $[8];
1462
+ t9 = $[16];
1463
+ }
1464
+ let t10;
1465
+ if ($[17] !== otherOptions || $[18] !== t8 || $[19] !== t9) {
1466
+ t10 = {
1467
+ mutationFn: t8,
1468
+ onSuccess: t9,
1469
+ ...otherOptions
1470
+ };
1471
+ $[17] = otherOptions;
1472
+ $[18] = t8;
1473
+ $[19] = t9;
1474
+ $[20] = t10;
1475
+ } else {
1476
+ t10 = $[20];
1195
1477
  }
1196
- const t6 = useMutation(t5);
1478
+ const t11 = useMutation(t10);
1197
1479
  let isPending;
1198
1480
  let mutate;
1199
1481
  let mutateAsync;
1200
1482
  let other;
1201
- if ($[9] !== t6) {
1483
+ if ($[21] !== t11) {
1202
1484
  ({
1203
1485
  mutate,
1204
1486
  mutateAsync,
1205
1487
  isPending,
1206
1488
  ...other
1207
- } = t6);
1208
- $[9] = t6;
1209
- $[10] = isPending;
1210
- $[11] = mutate;
1211
- $[12] = mutateAsync;
1212
- $[13] = other;
1489
+ } = t11);
1490
+ $[21] = t11;
1491
+ $[22] = isPending;
1492
+ $[23] = mutate;
1493
+ $[24] = mutateAsync;
1494
+ $[25] = other;
1213
1495
  } else {
1214
- isPending = $[10];
1215
- mutate = $[11];
1216
- mutateAsync = $[12];
1217
- other = $[13];
1496
+ isPending = $[22];
1497
+ mutate = $[23];
1498
+ mutateAsync = $[24];
1499
+ other = $[25];
1218
1500
  }
1219
- let t7;
1220
- if ($[14] !== isPending || $[15] !== mutate || $[16] !== mutateAsync || $[17] !== other) {
1221
- t7 = {
1501
+ let t12;
1502
+ if ($[26] !== isPending || $[27] !== mutate || $[28] !== mutateAsync || $[29] !== other) {
1503
+ t12 = {
1222
1504
  clone: mutate,
1223
1505
  cloneAsync: mutateAsync,
1224
1506
  loading: isPending,
@@ -1227,19 +1509,19 @@ function useResourceClone(t0, t1, t2) {
1227
1509
  isPending,
1228
1510
  ...other
1229
1511
  };
1230
- $[14] = isPending;
1231
- $[15] = mutate;
1232
- $[16] = mutateAsync;
1233
- $[17] = other;
1234
- $[18] = t7;
1512
+ $[26] = isPending;
1513
+ $[27] = mutate;
1514
+ $[28] = mutateAsync;
1515
+ $[29] = other;
1516
+ $[30] = t12;
1235
1517
  } else {
1236
- t7 = $[18];
1518
+ t12 = $[30];
1237
1519
  }
1238
- return t7;
1520
+ return t12;
1239
1521
  }
1240
1522
 
1241
1523
  function useResourceRestore(t0, t1, t2) {
1242
- const $ = c(19);
1524
+ const $ = c(31);
1243
1525
  const resource = t0 === undefined ? null : t0;
1244
1526
  const id = t1 === undefined ? null : t1;
1245
1527
  let t3;
@@ -1251,62 +1533,119 @@ function useResourceRestore(t0, t1, t2) {
1251
1533
  t3 = $[1];
1252
1534
  }
1253
1535
  const options = t3;
1254
- const providedResource = usePanneauResource(id !== null && !isObject(id) ? resource : null);
1255
- const contextResource = useResource();
1256
- const finalResource = providedResource || contextResource;
1257
- const finalId = providedResource !== null ? id : resource;
1258
- const api = useApi();
1536
+ const {
1537
+ resource: finalResource,
1538
+ id: finalId,
1539
+ options: finalOptions
1540
+ } = useResourceArguments(resource, id, options);
1259
1541
  let t4;
1260
- if ($[2] !== api || $[3] !== finalId || $[4] !== finalResource) {
1261
- t4 = t5 => {
1262
- const providedId = t5 === undefined ? null : t5;
1542
+ if ($[2] !== finalOptions) {
1543
+ t4 = finalOptions || {};
1544
+ $[2] = finalOptions;
1545
+ $[3] = t4;
1546
+ } else {
1547
+ t4 = $[3];
1548
+ }
1549
+ let otherOptions;
1550
+ let t5;
1551
+ if ($[4] !== t4) {
1552
+ ({
1553
+ onSuccess: t5,
1554
+ ...otherOptions
1555
+ } = t4);
1556
+ $[4] = t4;
1557
+ $[5] = otherOptions;
1558
+ $[6] = t5;
1559
+ } else {
1560
+ otherOptions = $[5];
1561
+ t5 = $[6];
1562
+ }
1563
+ const customOnSuccess = t5 === undefined ? null : t5;
1564
+ let t6;
1565
+ if ($[7] !== finalResource) {
1566
+ t6 = finalResource || {};
1567
+ $[7] = finalResource;
1568
+ $[8] = t6;
1569
+ } else {
1570
+ t6 = $[8];
1571
+ }
1572
+ const {
1573
+ id: t7
1574
+ } = t6;
1575
+ const resourceId = t7 === undefined ? null : t7;
1576
+ const api = useApi();
1577
+ const queryClient = useQueryClient();
1578
+ let t8;
1579
+ if ($[9] !== api || $[10] !== finalId || $[11] !== finalResource) {
1580
+ t8 = t9 => {
1581
+ const providedId = t9 === undefined ? null : t9;
1263
1582
  return api.resources.restore(finalResource, providedId ?? finalId);
1264
1583
  };
1265
- $[2] = api;
1266
- $[3] = finalId;
1267
- $[4] = finalResource;
1268
- $[5] = t4;
1584
+ $[9] = api;
1585
+ $[10] = finalId;
1586
+ $[11] = finalResource;
1587
+ $[12] = t8;
1269
1588
  } else {
1270
- t4 = $[5];
1589
+ t8 = $[12];
1271
1590
  }
1272
- let t5;
1273
- if ($[6] !== options || $[7] !== t4) {
1274
- t5 = {
1275
- mutationFn: t4,
1276
- ...options
1591
+ let t9;
1592
+ if ($[13] !== customOnSuccess || $[14] !== queryClient || $[15] !== resourceId) {
1593
+ t9 = (data, variables, ...t10) => {
1594
+ const args = t10;
1595
+ queryClient.invalidateQueries({
1596
+ queryKey: [resourceId]
1597
+ });
1598
+ if (customOnSuccess !== null) {
1599
+ return customOnSuccess(data, variables, ...args);
1600
+ }
1277
1601
  };
1278
- $[6] = options;
1279
- $[7] = t4;
1280
- $[8] = t5;
1602
+ $[13] = customOnSuccess;
1603
+ $[14] = queryClient;
1604
+ $[15] = resourceId;
1605
+ $[16] = t9;
1281
1606
  } else {
1282
- t5 = $[8];
1607
+ t9 = $[16];
1608
+ }
1609
+ let t10;
1610
+ if ($[17] !== otherOptions || $[18] !== t8 || $[19] !== t9) {
1611
+ t10 = {
1612
+ mutationFn: t8,
1613
+ onSuccess: t9,
1614
+ ...otherOptions
1615
+ };
1616
+ $[17] = otherOptions;
1617
+ $[18] = t8;
1618
+ $[19] = t9;
1619
+ $[20] = t10;
1620
+ } else {
1621
+ t10 = $[20];
1283
1622
  }
1284
- const t6 = useMutation(t5);
1623
+ const t11 = useMutation(t10);
1285
1624
  let isPending;
1286
1625
  let mutate;
1287
1626
  let mutateAsync;
1288
1627
  let other;
1289
- if ($[9] !== t6) {
1628
+ if ($[21] !== t11) {
1290
1629
  ({
1291
1630
  mutate,
1292
1631
  mutateAsync,
1293
1632
  isPending,
1294
1633
  ...other
1295
- } = t6);
1296
- $[9] = t6;
1297
- $[10] = isPending;
1298
- $[11] = mutate;
1299
- $[12] = mutateAsync;
1300
- $[13] = other;
1634
+ } = t11);
1635
+ $[21] = t11;
1636
+ $[22] = isPending;
1637
+ $[23] = mutate;
1638
+ $[24] = mutateAsync;
1639
+ $[25] = other;
1301
1640
  } else {
1302
- isPending = $[10];
1303
- mutate = $[11];
1304
- mutateAsync = $[12];
1305
- other = $[13];
1641
+ isPending = $[22];
1642
+ mutate = $[23];
1643
+ mutateAsync = $[24];
1644
+ other = $[25];
1306
1645
  }
1307
- let t7;
1308
- if ($[14] !== isPending || $[15] !== mutate || $[16] !== mutateAsync || $[17] !== other) {
1309
- t7 = {
1646
+ let t12;
1647
+ if ($[26] !== isPending || $[27] !== mutate || $[28] !== mutateAsync || $[29] !== other) {
1648
+ t12 = {
1310
1649
  restore: mutate,
1311
1650
  restoreAsync: mutateAsync,
1312
1651
  loading: isPending,
@@ -1315,15 +1654,15 @@ function useResourceRestore(t0, t1, t2) {
1315
1654
  isPending,
1316
1655
  ...other
1317
1656
  };
1318
- $[14] = isPending;
1319
- $[15] = mutate;
1320
- $[16] = mutateAsync;
1321
- $[17] = other;
1322
- $[18] = t7;
1657
+ $[26] = isPending;
1658
+ $[27] = mutate;
1659
+ $[28] = mutateAsync;
1660
+ $[29] = other;
1661
+ $[30] = t12;
1323
1662
  } else {
1324
- t7 = $[18];
1663
+ t12 = $[30];
1325
1664
  }
1326
- return t7;
1665
+ return t12;
1327
1666
  }
1328
1667
 
1329
1668
  const QueryContext = /*#__PURE__*/createContext(null);
@@ -1331,7 +1670,7 @@ function useQueryContext() {
1331
1670
  return use(QueryContext);
1332
1671
  }
1333
1672
  function QueryProvider(t0) {
1334
- const $ = c(7);
1673
+ const $ = c(10);
1335
1674
  const {
1336
1675
  config: t1,
1337
1676
  initialKey: t2,
@@ -1341,39 +1680,55 @@ function QueryProvider(t0) {
1341
1680
  const initialConfig = t1 === undefined ? null : t1;
1342
1681
  const initialKey = t2 === undefined ? null : t2;
1343
1682
  const initialData = t3 === undefined ? null : t3;
1344
- let client;
1683
+ let t4;
1345
1684
  if ($[0] !== initialConfig || $[1] !== initialData || $[2] !== initialKey) {
1346
- client = new QueryClient({
1347
- defaultOptions: {
1348
- queries: {
1349
- staleTime: Infinity
1350
- }
1351
- },
1352
- ...initialConfig
1353
- });
1354
- if (initialKey !== null && initialData !== null) {
1355
- client.setQueryData(initialKey, initialData);
1356
- }
1685
+ t4 = () => {
1686
+ const newClient = new QueryClient({
1687
+ defaultOptions: {
1688
+ queries: {
1689
+ staleTime: Infinity
1690
+ }
1691
+ },
1692
+ ...initialConfig
1693
+ });
1694
+ if (initialKey !== null && initialData !== null) {
1695
+ newClient.setQueryData(initialKey, initialData);
1696
+ }
1697
+ return newClient;
1698
+ };
1357
1699
  $[0] = initialConfig;
1358
1700
  $[1] = initialData;
1359
1701
  $[2] = initialKey;
1360
- $[3] = client;
1702
+ $[3] = t4;
1361
1703
  } else {
1362
- client = $[3];
1704
+ t4 = $[3];
1363
1705
  }
1364
- let t4;
1706
+ const [client] = useState(t4);
1707
+ let t5;
1365
1708
  if ($[4] !== children || $[5] !== client) {
1366
- t4 = /*#__PURE__*/jsx(QueryClientProvider, {
1709
+ t5 = /*#__PURE__*/jsx(QueryClientProvider, {
1367
1710
  client: client,
1368
1711
  children: children
1369
1712
  });
1370
1713
  $[4] = children;
1371
1714
  $[5] = client;
1372
- $[6] = t4;
1715
+ $[6] = t5;
1373
1716
  } else {
1374
- t4 = $[6];
1717
+ t5 = $[6];
1375
1718
  }
1376
- return t4;
1719
+ let t6;
1720
+ if ($[7] !== client || $[8] !== t5) {
1721
+ t6 = /*#__PURE__*/jsx(QueryContext, {
1722
+ value: client,
1723
+ children: t5
1724
+ });
1725
+ $[7] = client;
1726
+ $[8] = t5;
1727
+ $[9] = t6;
1728
+ } else {
1729
+ t6 = $[9];
1730
+ }
1731
+ return t6;
1377
1732
  }
1378
1733
 
1379
1734
  function DataProvider(t0) {