sanity 6.2.1-next.21 → 6.2.1-next.22

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 (44) hide show
  1. package/lib/_chunks-es/CommentsInspector.js +1 -0
  2. package/lib/_chunks-es/CommentsInspector.js.map +1 -1
  3. package/lib/_chunks-es/ReleasesStudioLayout.js +1 -0
  4. package/lib/_chunks-es/ReleasesStudioLayout.js.map +1 -1
  5. package/lib/_chunks-es/ReleasesTool.js +1 -0
  6. package/lib/_chunks-es/ReleasesTool.js.map +1 -1
  7. package/lib/_chunks-es/TasksDocumentInputLayout.js +1 -0
  8. package/lib/_chunks-es/TasksDocumentInputLayout.js.map +1 -1
  9. package/lib/_chunks-es/TasksFooterOpenTasks.js +1 -0
  10. package/lib/_chunks-es/TasksFooterOpenTasks.js.map +1 -1
  11. package/lib/_chunks-es/TasksStudioActiveToolLayout.js +1 -0
  12. package/lib/_chunks-es/TasksStudioActiveToolLayout.js.map +1 -1
  13. package/lib/_chunks-es/TasksStudioLayout.js +1 -0
  14. package/lib/_chunks-es/TasksStudioLayout.js.map +1 -1
  15. package/lib/_chunks-es/TasksStudioNavbar.js +1 -0
  16. package/lib/_chunks-es/TasksStudioNavbar.js.map +1 -1
  17. package/lib/_chunks-es/VariantsStudioNavbar.js +1 -0
  18. package/lib/_chunks-es/VariantsStudioNavbar.js.map +1 -1
  19. package/lib/_chunks-es/VariantsTool.js +1 -0
  20. package/lib/_chunks-es/VariantsTool.js.map +1 -1
  21. package/lib/_chunks-es/index2.js +93 -613
  22. package/lib/_chunks-es/index2.js.map +1 -1
  23. package/lib/_chunks-es/index3.js +1 -0
  24. package/lib/_chunks-es/index3.js.map +1 -1
  25. package/lib/_chunks-es/index6.js +1 -0
  26. package/lib/_chunks-es/index6.js.map +1 -1
  27. package/lib/_chunks-es/index7.js +1 -0
  28. package/lib/_chunks-es/index7.js.map +1 -1
  29. package/lib/_chunks-es/index8.js +1 -0
  30. package/lib/_chunks-es/index8.js.map +1 -1
  31. package/lib/_chunks-es/resources2.js +1 -0
  32. package/lib/_chunks-es/resources2.js.map +1 -1
  33. package/lib/_chunks-es/resources3.js +1 -0
  34. package/lib/_chunks-es/resources3.js.map +1 -1
  35. package/lib/_chunks-es/resources4.js +1 -0
  36. package/lib/_chunks-es/resources4.js.map +1 -1
  37. package/lib/_chunks-es/resources5.js +1 -0
  38. package/lib/_chunks-es/resources5.js.map +1 -1
  39. package/lib/_chunks-es/resources6.js +1 -0
  40. package/lib/_chunks-es/resources6.js.map +1 -1
  41. package/lib/_chunks-es/resources7.js +1 -0
  42. package/lib/_chunks-es/resources7.js.map +1 -1
  43. package/lib/_chunks-es/version.js +2 -2
  44. package/package.json +11 -11
@@ -3,7 +3,7 @@ import { c } from "react/compiler-runtime";
3
3
  import { Badge, Grid, Box, Stack, rem, Text as Text$1, Layer, Card, Spinner, Flex, Dialog, useTheme, Button as Button$2, Skeleton, Heading, useToast, Avatar, AvatarStack, Inline, Breadcrumbs, Code, useClickOutsideEvent, useLayer, Portal, LayerProvider, MenuDivider, Menu, useElementRect, useBoundaryElement, Autocomplete, useMediaIndex, useGlobalKeyDown, Checkbox as Checkbox$1, Switch as Switch$1, TextInput as TextInput$1, Select as Select$1, ElementQuery, TabList, rgba, MenuItem as MenuItem$1, BoundaryElementProvider, usePortal, PortalProvider, _responsive, useRootTheme, useArrayProp, TextArea, TextSkeleton, useElementSize, isHTMLElement, Radio, TabPanel, AvatarCounter, studioTheme, ThemeColorProvider, DialogProvider, focusLastDescendant, focusFirstDescendant, Container as Container$4, usePrefersDark, ThemeProvider, Label, ToastProvider, VirtualList } from "@sanity/ui";
4
4
  import * as PathUtils from "@sanity/util/paths";
5
5
  import { toString, FOCUS_TERMINATOR, startsWith, isEqual as isEqual$2, pathFor, fromString, get as get$1, trimChildPath as trimChildPath$1, trimLeft } from "@sanity/util/paths";
6
- import React, { forwardRef, useRef, useState, useId, useCallback, useMemo, useImperativeHandle, useEffect, isValidElement, Fragment, cloneElement, memo, useContext, useSyncExternalStore, Suspense, useReducer, startTransition, Component, use as use$2, useLayoutEffect, useEffectEvent, PureComponent, Children, createContext, useDebugValue, lazy, useTransition, useInsertionEffect, useDeferredValue, version, StrictMode } from "react";
6
+ import { forwardRef, useRef, useState, useId, useCallback, useMemo, useImperativeHandle, useEffect, isValidElement, Fragment, cloneElement, memo, useContext, useSyncExternalStore, Suspense, useReducer, startTransition, Component, use, useLayoutEffect, useEffectEvent, PureComponent, Children, lazy, useTransition, useInsertionEffect, useDeferredValue, version, StrictMode } from "react";
7
7
  import deepEquals from "react-fast-compare";
8
8
  import { VisibleWorkspacesContext, WorkspacesContext, LocaleContext, MediaLibraryIdsContext, PerspectiveContext, UserColorManagerContext, ResourceCacheContext, EventsContext, DocumentChangeContext, ReviewChangesContext, DiffContext, PresenceContext, FormBuilderContext, PortableTextMemberSchemaTypesContext, SelectedAnnotationsContext, ValidationContext, PortableTextMarkersContext, PortableTextMemberItemsContext, ChangeIndicatorTrackerContextStore, ChangeIndicatorTrackerContextGetSnapshot, FormCallbacksContext, ParseErrorsContext, ReferenceInputOptionsContext, WorkspaceContext, DocumentDivergencesContext, ActiveWorkspaceMatcherContext, DocumentIdContext, HoveredFieldContext, FieldActionsContext, FormValueContext, ReferenceItemRefContext, GetFormValueContext, EnhancedObjectDialogContext, DocumentFieldActionsContext, ArrayValidationContext, SortableItemIdContext, SourceContext, VirtualizerScrollInstanceContext, PortableTextMemberItemElementRefsContext, ScrollContext, FullscreenPTEContext, AssetLimitUpsellContext, DialogStackContext, ReleasesUpsellContext, SingleDocReleaseEnabledContext, SingleDocReleaseContext, SingleDocReleaseUpsellContext, PresenceTrackerContextStore, PresenceTrackerContextGetSnapshot, FormFieldPresenceContext, SearchContext, CalendarContext, AppIdCacheContext, CommentsIntentContext, CommentInputContext, CommentsContext, CommentsEnabledContext, CommentsSelectedPathContext, ScheduledPublishingEnabledContext, DocumentActionPropsContext, SchedulePublishUpsellContext, TasksEnabledContext, IsLastPaneContext, MentionUserContext, TasksNavigationContext, TasksContext, TasksUpsellContext, RouterHistoryContext, AddonDatasetContext, ColorSchemeSetValueContext, ColorSchemeValueContext, DocumentLimitUpsellContext, NavbarContext, FreeTrialContext, FeedbackContext, LiveUserApplicationContext, PackageVersionInfoContext, StudioAnnouncementContext, CopyPasteContext, UserApplicationCacheContext, PreviewCardContext, ZIndexContext, zIndexContextDefaults, CommentsAuthoringPathContext } from "sanity/_singletons";
9
9
  import { useVirtualizer, defaultRangeExtractor, elementScroll } from "@tanstack/react-virtual";
@@ -90,7 +90,7 @@ import { differenceInWeeks } from "date-fns/differenceInWeeks";
90
90
  import { differenceInYears } from "date-fns/differenceInYears";
91
91
  import { mergeMapArray } from "rxjs-mergemap-array";
92
92
  import { useDevicePixelRatio, getDevicePixelRatio } from "use-device-pixel-ratio";
93
- import { useSyncExternalStore as useSyncExternalStore$1 } from "use-sync-external-store/shim";
93
+ import useSWR from "swr";
94
94
  import DataLoader from "dataloader";
95
95
  import { createNode } from "@sanity/comlink";
96
96
  import { Mutation, BufferedDocument, extractWithPath, arrayToJSONMatchPath } from "@sanity/mutator";
@@ -122,7 +122,7 @@ import flow from "lodash-es/flow.js";
122
122
  import trim from "lodash-es/trim.js";
123
123
  import isFinite from "lodash-es/isFinite.js";
124
124
  import { randomKey as randomKey$1, isDeepEmpty, resolveTypeName as resolveTypeName$1, isShallowEmptyObject } from "@sanity/util/content";
125
- import noop$7 from "lodash-es/noop.js";
125
+ import noop$6 from "lodash-es/noop.js";
126
126
  import isPlainObject$1 from "lodash-es/isPlainObject.js";
127
127
  import capitalize from "lodash-es/capitalize.js";
128
128
  import { Rule as Rule$1, Schema } from "@sanity/schema";
@@ -170,7 +170,7 @@ import { renderToString, renderToStaticMarkup } from "react-dom/server";
170
170
  import { endOfMinute } from "date-fns/endOfMinute";
171
171
  import { startOfDay } from "date-fns/startOfDay";
172
172
  import { startOfToday } from "date-fns/startOfToday";
173
- import { sub as sub$1 } from "date-fns/sub";
173
+ import { sub } from "date-fns/sub";
174
174
  import { toHTML } from "@portabletext/to-html";
175
175
  import max from "lodash-es/max.js";
176
176
  import sum$1 from "lodash-es/sum.js";
@@ -7965,15 +7965,15 @@ function validateReference(value, path = []) {
7965
7965
  function isBuilder(template) {
7966
7966
  return isRecord$1(template) && typeof template.serialize == "function";
7967
7967
  }
7968
- const cache$7 = /* @__PURE__ */ new WeakMap();
7968
+ const cache$6 = /* @__PURE__ */ new WeakMap();
7969
7969
  async function resolveValue(initialValueOpt, params, context, options) {
7970
7970
  const useCache = options?.useCache;
7971
7971
  if (typeof initialValueOpt == "function") {
7972
- const cached = cache$7.get(initialValueOpt), key = JSON.stringify([params, context.projectId, context.dataset, context.currentUser?.id]);
7972
+ const cached = cache$6.get(initialValueOpt), key = JSON.stringify([params, context.projectId, context.dataset, context.currentUser?.id]);
7973
7973
  if (useCache && cached?.[key])
7974
7974
  return cached[key];
7975
7975
  const value = initialValueOpt(params, context);
7976
- return useCache && cache$7.set(initialValueOpt, {
7976
+ return useCache && cache$6.set(initialValueOpt, {
7977
7977
  ...cached,
7978
7978
  [key]: value
7979
7979
  }), value;
@@ -8789,8 +8789,8 @@ async function grantsPermissionOn(userId, grants, permission, document2) {
8789
8789
  reason: foundMatch ? "Matching grant" : "No matching grants found"
8790
8790
  };
8791
8791
  }
8792
- function serialize$5(item) {
8793
- return typeof item == "object" && item !== null && "serialize" in item ? serialize$5(item.serialize()) : item;
8792
+ function serialize$4(item) {
8793
+ return typeof item == "object" && item !== null && "serialize" in item ? serialize$4(item.serialize()) : item;
8794
8794
  }
8795
8795
  function getTemplatePermissions({
8796
8796
  grantsStore,
@@ -8802,7 +8802,7 @@ function getTemplatePermissions({
8802
8802
  return templateItems?.length ? defer(() => from(templateItems).pipe(
8803
8803
  // Serialize and resolve each item one at a time
8804
8804
  concatMap$1(async (item) => {
8805
- const serializedItem = serialize$5(item), template = templates.find((t) => t.id === serializedItem.templateId);
8805
+ const serializedItem = serialize$4(item), template = templates.find((t) => t.id === serializedItem.templateId);
8806
8806
  if (!template)
8807
8807
  throw new Error(`template not found: "${serializedItem.templateId}"`);
8808
8808
  const resolvedInitialValue = await resolveInitialValue(schema2, template, serializedItem.parameters, context, {
@@ -13142,7 +13142,7 @@ const JsonFieldDiff = (t0) => {
13142
13142
  content
13143
13143
  ] }), $[13] = content, $[14] = t5, $[15] = t6) : t6 = $[15], t6;
13144
13144
  };
13145
- function noop$6() {
13145
+ function noop$5() {
13146
13146
  }
13147
13147
  function isFieldChange(change) {
13148
13148
  return change.type === "field";
@@ -15877,7 +15877,7 @@ function PortableTextMemberSchemaTypesProvider(t0) {
15877
15877
  return $[2] !== children || $[3] !== value ? (t2 = /* @__PURE__ */ jsx(PortableTextMemberSchemaTypesContext.Provider, { value, children }), $[2] = children, $[3] = value, $[4] = t2) : t2 = $[4], t2;
15878
15878
  }
15879
15879
  function usePortableTextMemberSchemaTypes() {
15880
- const context = use$2(PortableTextMemberSchemaTypesContext);
15880
+ const context = use(PortableTextMemberSchemaTypesContext);
15881
15881
  if (!context)
15882
15882
  throw new Error("usePortableTextMemberSchemaTypes must be used within PortableTextMemberSchemaTypesProvider");
15883
15883
  return context;
@@ -17196,12 +17196,12 @@ function delayTask() {
17196
17196
  }
17197
17197
  return pipe();
17198
17198
  }
17199
- let cache$6;
17199
+ let cache$5;
17200
17200
  function findMovesInArrayOfObjects(a, b) {
17201
17201
  if (typeof a > "u" || typeof b > "u")
17202
17202
  return EMPTY$5;
17203
- cache$6 ??= createMultiKeyWeakMap();
17204
- const cached = cache$6.get([a, b]);
17203
+ cache$5 ??= createMultiKeyWeakMap();
17204
+ const cached = cache$5.get([a, b]);
17205
17205
  if (typeof cached < "u")
17206
17206
  return cached;
17207
17207
  const {
@@ -17209,7 +17209,7 @@ function findMovesInArrayOfObjects(a, b) {
17209
17209
  aIntersectingKeys,
17210
17210
  bIntersectingKeys
17211
17211
  } = findIntersectingKeys(a, b), readMoves = of([aIntersectingKeys, bIntersectingKeys]).pipe(map$1(([aIntersecting, bIntersecting]) => lcs_dp(aIntersecting.length, bIntersecting.length, (x, y) => aIntersecting[x] === bIntersecting[y])), map$1((lcs) => lcs.map(([aIndex]) => aIntersectingKeys[aIndex])), switchMap$1((lcsKeys) => intersectingKeys.size < 3 ? from(lcsKeys) : lcsKeys.length === 1 ? from(intersectingKeys) : from(intersectingKeys).pipe(filter$1((_key) => !lcsKeys.includes(_key)))), map$1((_key) => [_key, bIntersectingKeys.indexOf(_key) - aIntersectingKeys.indexOf(_key)]), filter$1(([, positionDelta]) => positionDelta !== 0), toArray$2(), map$1(Object.fromEntries), shareReplay$1(1));
17212
- return cache$6.set([a, b], readMoves), readMoves;
17212
+ return cache$5.set([a, b], readMoves), readMoves;
17213
17213
  }
17214
17214
  const findIntersectingKeys = (a, b) => "intersection" in Set.prototype ? findIntersectingKeysUsingSet(a, b) : findIntersectingKeysUsingArray(a, b), findIntersectingKeysUsingSet = (a, b) => {
17215
17215
  const aKeys = new Set(a.map(({
@@ -17604,7 +17604,7 @@ function isDivergenceResolution(maybeDivergenceResolution) {
17604
17604
  return typeof maybeDivergenceResolution == "object" && maybeDivergenceResolution !== null && "_key" in maybeDivergenceResolution && typeof maybeDivergenceResolution._key == "string" && "resolutionMarker" in maybeDivergenceResolution && isDivergenceResolutionMarker(maybeDivergenceResolution.resolutionMarker);
17605
17605
  }
17606
17606
  const DEBOUNCE_DURATION = 1e3, CACHE_MAX_SIZE$1 = 10;
17607
- let cacheWriteChannel, cache$5;
17607
+ let cacheWriteChannel, cache$4;
17608
17608
  const collateDocumentDivergencesInitialState = {
17609
17609
  state: "pending",
17610
17610
  upstreamId: void 0,
@@ -17618,7 +17618,7 @@ function collateDocumentDivergences({
17618
17618
  const cacheKey2 = getCacheKey$1({
17619
17619
  upstreamId,
17620
17620
  subjectId
17621
- }), cachedInstance = cache$5.get(cacheKey2);
17621
+ }), cachedInstance = cache$4.get(cacheKey2);
17622
17622
  if (typeof cachedInstance < "u")
17623
17623
  return cachedInstance;
17624
17624
  const context = new Subject(), markName = ["collateDocumentDivergences", cacheKey2].join(".");
@@ -17650,13 +17650,13 @@ function collateDocumentDivergences({
17650
17650
  context,
17651
17651
  observable
17652
17652
  };
17653
- return cache$5.set(cacheKey2, instance), cacheWriteChannel.next(cacheKey2), instance;
17653
+ return cache$4.set(cacheKey2, instance), cacheWriteChannel.next(cacheKey2), instance;
17654
17654
  }
17655
17655
  function isContextEqual(a, b) {
17656
17656
  return a.upstreamHead._rev === b.upstreamHead._rev && a.subjectHead._rev === b.subjectHead._rev && a.upstreamAtFork._rev === b.upstreamAtFork._rev && isEqual$1(a.resolutions, b.resolutions);
17657
17657
  }
17658
17658
  function initialiseCache() {
17659
- cache$5 ??= new QuickLRU({
17659
+ cache$4 ??= new QuickLRU({
17660
17660
  maxSize: CACHE_MAX_SIZE$1
17661
17661
  }), cacheWriteChannel ??= new Subject();
17662
17662
  }
@@ -17667,7 +17667,7 @@ function getCacheKey$1({
17667
17667
  return [upstreamId, subjectId].join(".");
17668
17668
  }
17669
17669
  const PAGE_LENGTH = 50;
17670
- let cache$4;
17670
+ let cache$3;
17671
17671
  function readMostRecentSharedTransaction({
17672
17672
  a,
17673
17673
  b,
@@ -17676,10 +17676,10 @@ function readMostRecentSharedTransaction({
17676
17676
  }) {
17677
17677
  if (typeof a > "u" || typeof b > "u")
17678
17678
  return EMPTY$5;
17679
- cache$4 ??= new QuickLRU({
17679
+ cache$3 ??= new QuickLRU({
17680
17680
  maxSize: 250
17681
17681
  });
17682
- const cacheKey2 = [a, b].join(";"), cachedReader = cache$4.get(cacheKey2);
17682
+ const cacheKey2 = [a, b].join(";"), cachedReader = cache$3.get(cacheKey2);
17683
17683
  if (typeof cachedReader < "u")
17684
17684
  return cachedReader;
17685
17685
  const reader = merge(readTransactionsFollowingLineage({
@@ -17710,9 +17710,9 @@ function readMostRecentSharedTransaction({
17710
17710
  const [, transaction] = accumulation.currentTransaction;
17711
17711
  return transaction;
17712
17712
  }), catchError$1((error) => {
17713
- throw cache$4?.delete(cacheKey2), error;
17713
+ throw cache$3?.delete(cacheKey2), error;
17714
17714
  }));
17715
- return cache$4.set(cacheKey2, reader), reader;
17715
+ return cache$3.set(cacheKey2, reader), reader;
17716
17716
  }
17717
17717
  let lineageCache;
17718
17718
  function readTransactionsFollowingLineage({
@@ -18914,11 +18914,11 @@ function _temp$3m() {
18914
18914
  return /* @__PURE__ */ new Set();
18915
18915
  }
18916
18916
  function useDidUpdate(current, didUpdate, t0) {
18917
- const $ = c(5), compare2 = t0 === void 0 ? shallowEquals : t0, previous = useRef(void 0);
18917
+ const $ = c(5), compare = t0 === void 0 ? shallowEquals : t0, previous = useRef(void 0);
18918
18918
  let t1, t2;
18919
- $[0] !== compare2 || $[1] !== current || $[2] !== didUpdate ? (t1 = () => {
18920
- compare2(previous.current, current) || (didUpdate(previous.current, current), previous.current = current);
18921
- }, t2 = [compare2, current, didUpdate], $[0] = compare2, $[1] = current, $[2] = didUpdate, $[3] = t1, $[4] = t2) : (t1 = $[3], t2 = $[4]), useEffect(t1, t2);
18919
+ $[0] !== compare || $[1] !== current || $[2] !== didUpdate ? (t1 = () => {
18920
+ compare(previous.current, current) || (didUpdate(previous.current, current), previous.current = current);
18921
+ }, t2 = [compare, current, didUpdate], $[0] = compare, $[1] = current, $[2] = didUpdate, $[3] = t1, $[4] = t2) : (t1 = $[3], t2 = $[4]), useEffect(t1, t2);
18922
18922
  }
18923
18923
  function useScrollIntoViewOnFocusWithin(elementRef, hasFocusWithin) {
18924
18924
  const $ = c(2);
@@ -20782,17 +20782,17 @@ function ReferenceStrengthMismatchAlertStrip(t0) {
20782
20782
  let t11;
20783
20783
  return $[20] !== t1 || $[21] !== t10 ? (t11 = /* @__PURE__ */ jsx(AlertStrip, { padding: 1, title: t1, status: "warning", "data-testid": "alert-reference-strength-mismatch", children: t10 }), $[20] = t1, $[21] = t10, $[22] = t11) : t11 = $[22], t11;
20784
20784
  }
20785
- const noop$5 = () => {
20785
+ const noop$4 = () => {
20786
20786
  }, INITIAL_LOADING_STATE$4 = {
20787
20787
  isLoading: !0,
20788
20788
  result: void 0,
20789
20789
  error: void 0,
20790
- retry: noop$5
20790
+ retry: noop$4
20791
20791
  }, EMPTY_STATE$2 = {
20792
20792
  isLoading: !1,
20793
20793
  result: void 0,
20794
20794
  error: void 0,
20795
- retry: noop$5
20795
+ retry: noop$4
20796
20796
  };
20797
20797
  function useReferenceInfo$2(id2, getReferenceInfo2) {
20798
20798
  const $ = c(10), [t0] = useState(_temp$3e), [onRetry$2, onRetry2] = t0;
@@ -21646,19 +21646,19 @@ function whatwgRNG(length = 16) {
21646
21646
  return crypto.getRandomValues(rnds8), rnds8;
21647
21647
  }
21648
21648
  const getByteHexTable = /* @__PURE__ */ (() => {
21649
- let table2;
21649
+ let table;
21650
21650
  return () => {
21651
- if (table2)
21652
- return table2;
21653
- table2 = [];
21651
+ if (table)
21652
+ return table;
21653
+ table = [];
21654
21654
  for (let i = 0; i < 256; ++i)
21655
- table2[i] = (i + 256).toString(16).slice(1);
21656
- return table2;
21655
+ table[i] = (i + 256).toString(16).slice(1);
21656
+ return table;
21657
21657
  };
21658
21658
  })();
21659
21659
  function randomKey(length) {
21660
- const table2 = getByteHexTable();
21661
- return whatwgRNG(length).reduce((str, n) => str + table2[n], "").slice(0, length);
21660
+ const table = getByteHexTable();
21661
+ return whatwgRNG(length).reduce((str, n) => str + table[n], "").slice(0, length);
21662
21662
  }
21663
21663
  function hasKey$1(item) {
21664
21664
  return item._key !== void 0;
@@ -23123,7 +23123,7 @@ function ArrayOfObjectsField(props2) {
23123
23123
  }));
23124
23124
  const uploader = new assetSource.Uploader();
23125
23125
  setAssetSourceUploadComponents((prev) => {
23126
- const AssetSourceComponent = assetSource.component, assetSourceComponent = /* @__PURE__ */ jsx(AssetSourceComponent, { assetSource, action: "upload", onSelect: (assets_0) => handleSelectAssetsFromSource(assets_0, schemaType_0, key_0), accept: "*/*", onClose: noop$7, selectedAssets: [], selectionType: "single", uploader }, key_0);
23126
+ const AssetSourceComponent = assetSource.component, assetSourceComponent = /* @__PURE__ */ jsx(AssetSourceComponent, { assetSource, action: "upload", onSelect: (assets_0) => handleSelectAssetsFromSource(assets_0, schemaType_0, key_0), accept: "*/*", onClose: noop$6, selectedAssets: [], selectionType: "single", uploader }, key_0);
23127
23127
  return [...prev, assetSourceComponent];
23128
23128
  });
23129
23129
  const unsubscribe = uploader.subscribe((event_4) => {
@@ -23844,7 +23844,7 @@ const MemberField = memo(function(props2) {
23844
23844
  return $[27] !== member || $[28] !== renderField || $[29] !== renderInput ? (t0 = /* @__PURE__ */ jsx(PrimitiveField, { member, renderField, renderInput }), $[27] = member, $[28] = renderField, $[29] = renderInput, $[30] = t0) : t0 = $[30], t0;
23845
23845
  }
23846
23846
  return null;
23847
- }), TRUTHY_STRINGS = ["yes", "true", "1"], FALSEY_STRINGS = ["false", "no", "false", "0", "null"], BOOL_STRINGS = TRUTHY_STRINGS.concat(FALSEY_STRINGS), TRUE = () => !0, has$1 = (prop) => (val) => val && val[prop], is = (typeName) => (val) => (val && val._type) === typeName;
23847
+ }), TRUTHY_STRINGS = ["yes", "true", "1"], FALSEY_STRINGS = ["false", "no", "false", "0", "null"], BOOL_STRINGS = TRUTHY_STRINGS.concat(FALSEY_STRINGS), TRUE = () => !0, has = (prop) => (val) => val && val[prop], is = (typeName) => (val) => (val && val._type) === typeName;
23848
23848
  function toLocalDate(input) {
23849
23849
  const newDate = new Date(input.getTime() + input.getTimezoneOffset() * 60 * 1e3), offset = input.getTimezoneOffset() / 60, hours = input.getHours();
23850
23850
  return newDate.setHours(hours - offset), newDate;
@@ -23887,7 +23887,7 @@ const converters = {
23887
23887
  },
23888
23888
  richDate: {
23889
23889
  datetime: {
23890
- test: has$1("utc"),
23890
+ test: has("utc"),
23891
23891
  convert: (value) => value.utc
23892
23892
  }
23893
23893
  },
@@ -28067,12 +28067,12 @@ function _temp2$1b(itemProps) {
28067
28067
  function _temp$2O(v) {
28068
28068
  return v.level === "error";
28069
28069
  }
28070
- function useMemoCompare(next, compare2) {
28070
+ function useMemoCompare(next, compare) {
28071
28071
  const [previous, setPrevious] = useState(next);
28072
- return compare2(previous, next) ? previous : (setPrevious(next), next);
28072
+ return compare(previous, next) ? previous : (setPrevious(next), next);
28073
28073
  }
28074
28074
  function useVisibilityDetection(parentRef) {
28075
- const $ = c(6), [isVisible2, setIsVisible] = useState(!0), [mountKey, setMountKey] = useState(0), prevVisible = useRef(!0);
28075
+ const $ = c(6), [isVisible, setIsVisible] = useState(!0), [mountKey, setMountKey] = useState(0), prevVisible = useRef(!0);
28076
28076
  let t0, t1;
28077
28077
  $[0] !== parentRef ? (t0 = () => {
28078
28078
  const resizeObserver = new ResizeObserver((entries) => {
@@ -28090,10 +28090,10 @@ function useVisibilityDetection(parentRef) {
28090
28090
  return parentRef.current && resizeObserver.observe(parentRef.current), () => resizeObserver.disconnect();
28091
28091
  }, t1 = [parentRef], $[0] = parentRef, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), useEffect(t0, t1);
28092
28092
  let t2;
28093
- return $[3] !== isVisible2 || $[4] !== mountKey ? (t2 = {
28094
- isVisible: isVisible2,
28093
+ return $[3] !== isVisible || $[4] !== mountKey ? (t2 = {
28094
+ isVisible,
28095
28095
  mountKey
28096
- }, $[3] = isVisible2, $[4] = mountKey, $[5] = t2) : t2 = $[5], t2;
28096
+ }, $[3] = isVisible, $[4] = mountKey, $[5] = t2) : t2 = $[5], t2;
28097
28097
  }
28098
28098
  function _temp$2N(prev) {
28099
28099
  return prev + 1;
@@ -28416,7 +28416,7 @@ function ListArrayInput(props2) {
28416
28416
  let t3;
28417
28417
  $[2] !== members ? (t3 = members.map(_temp2$1a), $[2] = members, $[3] = t3) : t3 = $[3];
28418
28418
  const memberKeys = useMemoCompare(t3, shallowEquals), parentRef = useRef(null), {
28419
- isVisible: isVisible2,
28419
+ isVisible,
28420
28420
  mountKey
28421
28421
  } = useVisibilityDetection(parentRef);
28422
28422
  let t4;
@@ -28447,7 +28447,7 @@ function ListArrayInput(props2) {
28447
28447
  }, $[5] = t6) : t6 = $[5];
28448
28448
  const handleItemMoveEnd = t6, sortable = schemaType.options?.sortable !== !1;
28449
28449
  let t7;
28450
- $[6] !== activeDragItemIndex || $[7] !== errorTone || $[8] !== focusPathKey || $[9] !== isVisible2 || $[10] !== memberKeys || $[11] !== members || $[12] !== mountKey || $[13] !== onItemMove || $[14] !== props2 || $[15] !== readOnly || $[16] !== renderAnnotation || $[17] !== renderBlock2 || $[18] !== renderField || $[19] !== renderInlineBlock || $[20] !== renderInput || $[21] !== renderItem2 || $[22] !== renderPreview || $[23] !== schemaType.placeholder || $[24] !== sortable || $[25] !== t ? (t7 = members.length === 0 ? /* @__PURE__ */ jsx(Card, { padding: 3, border: !0, radius: 2, tone: errorTone, children: /* @__PURE__ */ jsx(Text$1, { align: "center", muted: !0, size: 1, children: schemaType.placeholder || /* @__PURE__ */ jsx(Fragment$1, { children: t("inputs.array.no-items-label") }) }) }) : isVisible2 ? /* @__PURE__ */ jsx(VirtualizedArrayList, { members, tone: errorTone, memberKeys, activeDragItemIndex, focusPathKey, onItemMove, onItemMoveStart: handleItemMoveStart, onItemMoveEnd: handleItemMoveEnd, sortable, readOnly, onItemRemove: (key) => props2.onItemRemove(key), renderAnnotation, renderBlock: renderBlock2, renderField, renderInlineBlock, renderInput, renderItem: renderItem2, renderPreview, listGridGap: 1, paddingY: 1, radius: 2 }, mountKey) : null, $[6] = activeDragItemIndex, $[7] = errorTone, $[8] = focusPathKey, $[9] = isVisible2, $[10] = memberKeys, $[11] = members, $[12] = mountKey, $[13] = onItemMove, $[14] = props2, $[15] = readOnly, $[16] = renderAnnotation, $[17] = renderBlock2, $[18] = renderField, $[19] = renderInlineBlock, $[20] = renderInput, $[21] = renderItem2, $[22] = renderPreview, $[23] = schemaType.placeholder, $[24] = sortable, $[25] = t, $[26] = t7) : t7 = $[26];
28450
+ $[6] !== activeDragItemIndex || $[7] !== errorTone || $[8] !== focusPathKey || $[9] !== isVisible || $[10] !== memberKeys || $[11] !== members || $[12] !== mountKey || $[13] !== onItemMove || $[14] !== props2 || $[15] !== readOnly || $[16] !== renderAnnotation || $[17] !== renderBlock2 || $[18] !== renderField || $[19] !== renderInlineBlock || $[20] !== renderInput || $[21] !== renderItem2 || $[22] !== renderPreview || $[23] !== schemaType.placeholder || $[24] !== sortable || $[25] !== t ? (t7 = members.length === 0 ? /* @__PURE__ */ jsx(Card, { padding: 3, border: !0, radius: 2, tone: errorTone, children: /* @__PURE__ */ jsx(Text$1, { align: "center", muted: !0, size: 1, children: schemaType.placeholder || /* @__PURE__ */ jsx(Fragment$1, { children: t("inputs.array.no-items-label") }) }) }) : isVisible ? /* @__PURE__ */ jsx(VirtualizedArrayList, { members, tone: errorTone, memberKeys, activeDragItemIndex, focusPathKey, onItemMove, onItemMoveStart: handleItemMoveStart, onItemMoveEnd: handleItemMoveEnd, sortable, readOnly, onItemRemove: (key) => props2.onItemRemove(key), renderAnnotation, renderBlock: renderBlock2, renderField, renderInlineBlock, renderInput, renderItem: renderItem2, renderPreview, listGridGap: 1, paddingY: 1, radius: 2 }, mountKey) : null, $[6] = activeDragItemIndex, $[7] = errorTone, $[8] = focusPathKey, $[9] = isVisible, $[10] = memberKeys, $[11] = members, $[12] = mountKey, $[13] = onItemMove, $[14] = props2, $[15] = readOnly, $[16] = renderAnnotation, $[17] = renderBlock2, $[18] = renderField, $[19] = renderInlineBlock, $[20] = renderInput, $[21] = renderItem2, $[22] = renderPreview, $[23] = schemaType.placeholder, $[24] = sortable, $[25] = t, $[26] = t7) : t7 = $[26];
28451
28451
  let t8;
28452
28452
  $[27] !== t7 ? (t8 = /* @__PURE__ */ jsx(Stack, { "data-ui": "ArrayInput__content", space: 2, children: t7 }), $[27] = t7, $[28] = t8) : t8 = $[28];
28453
28453
  let t9;
@@ -30315,7 +30315,7 @@ function getCalendarLabels(t) {
30315
30315
  })
30316
30316
  };
30317
30317
  }
30318
- const deserialize$2 = (value) => parse$2(value, DEFAULT_DATE_FORMAT), serialize$4 = (date) => format$1(date, DEFAULT_DATE_FORMAT);
30318
+ const deserialize$2 = (value) => parse$2(value, DEFAULT_DATE_FORMAT), serialize$3 = (date) => format$1(date, DEFAULT_DATE_FORMAT);
30319
30319
  function DateInput(props2) {
30320
30320
  const $ = c(21), {
30321
30321
  readOnly,
@@ -30351,7 +30351,7 @@ function DateInput(props2) {
30351
30351
  $[8] !== t ? (t4 = getCalendarLabels(t), $[8] = t, $[9] = t4) : t4 = $[9];
30352
30352
  const calendarLabels = t4;
30353
30353
  let t5;
30354
- return $[10] !== calendarLabels || $[11] !== elementProps || $[12] !== formatInputValue || $[13] !== handleChange || $[14] !== parseInputValue || $[15] !== readOnly || $[16] !== schemaType.placeholder || $[17] !== timeZoneScope || $[18] !== validationError || $[19] !== value ? (t5 = /* @__PURE__ */ jsx(CommonDateTimeInput$1, { ...elementProps, deserialize: deserialize$2, formatInputValue, onChange: handleChange, onParseError: setParseError, parseInputValue, placeholder: schemaType.placeholder, calendarLabels, readOnly, selectTime: !1, serialize: serialize$4, value, timeZoneScope, validationError }), $[10] = calendarLabels, $[11] = elementProps, $[12] = formatInputValue, $[13] = handleChange, $[14] = parseInputValue, $[15] = readOnly, $[16] = schemaType.placeholder, $[17] = timeZoneScope, $[18] = validationError, $[19] = value, $[20] = t5) : t5 = $[20], t5;
30354
+ return $[10] !== calendarLabels || $[11] !== elementProps || $[12] !== formatInputValue || $[13] !== handleChange || $[14] !== parseInputValue || $[15] !== readOnly || $[16] !== schemaType.placeholder || $[17] !== timeZoneScope || $[18] !== validationError || $[19] !== value ? (t5 = /* @__PURE__ */ jsx(CommonDateTimeInput$1, { ...elementProps, deserialize: deserialize$2, formatInputValue, onChange: handleChange, onParseError: setParseError, parseInputValue, placeholder: schemaType.placeholder, calendarLabels, readOnly, selectTime: !1, serialize: serialize$3, value, timeZoneScope, validationError }), $[10] = calendarLabels, $[11] = elementProps, $[12] = formatInputValue, $[13] = handleChange, $[14] = parseInputValue, $[15] = readOnly, $[16] = schemaType.placeholder, $[17] = timeZoneScope, $[18] = validationError, $[19] = value, $[20] = t5) : t5 = $[20], t5;
30355
30355
  }
30356
30356
  const TimeZoneButton = (props2) => {
30357
30357
  const $ = c(18), {
@@ -30372,15 +30372,15 @@ const TimeZoneButton = (props2) => {
30372
30372
  $[3] !== tooltipContent ? (t2 = /* @__PURE__ */ jsx(Box, { flex: 1, padding: 1, children: /* @__PURE__ */ jsx(Text$1, { size: 1, children: tooltipContent }) }), $[3] = tooltipContent, $[4] = t2) : t2 = $[4];
30373
30373
  let t3;
30374
30374
  $[5] !== allowTimeZoneSwitch || $[6] !== dialogTimeZoneShow || $[7] !== timeZone.alternativeName || $[8] !== timeZone.city || $[9] !== timeZone.namePretty || $[10] !== useElementQueries ? (t3 = /* @__PURE__ */ jsx("div", { children: useElementQueries ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
30375
- /* @__PURE__ */ jsx(Box, { className: "button-small", children: allowTimeZoneSwitch ? /* @__PURE__ */ jsx(Button$1, { "data-testid": "timezone-button", icon: EarthAmericasIcon, mode: "bleed", readOnly: !allowTimeZoneSwitch, onClick: allowTimeZoneSwitch ? dialogTimeZoneShow : noop$7, text: `${timeZone.city}` }) : /* @__PURE__ */ jsxs(Inline, { space: 2, padding: 2, children: [
30375
+ /* @__PURE__ */ jsx(Box, { className: "button-small", children: allowTimeZoneSwitch ? /* @__PURE__ */ jsx(Button$1, { "data-testid": "timezone-button", icon: EarthAmericasIcon, mode: "bleed", readOnly: !allowTimeZoneSwitch, onClick: allowTimeZoneSwitch ? dialogTimeZoneShow : noop$6, text: `${timeZone.city}` }) : /* @__PURE__ */ jsxs(Inline, { space: 2, padding: 2, children: [
30376
30376
  /* @__PURE__ */ jsx(Text$1, { weight: "medium", size: 1, children: /* @__PURE__ */ jsx(EarthAmericasIcon, {}) }),
30377
30377
  /* @__PURE__ */ jsx(Text$1, { weight: "medium", size: 1, children: `${timeZone.city}` })
30378
30378
  ] }) }),
30379
- /* @__PURE__ */ jsx(Box, { className: "button-large", children: allowTimeZoneSwitch ? /* @__PURE__ */ jsx(Button$1, { "data-testid": "timezone-button", icon: EarthAmericasIcon, mode: "bleed", readOnly: !allowTimeZoneSwitch, onClick: allowTimeZoneSwitch ? dialogTimeZoneShow : noop$7, text: `${timeZone.alternativeName} (${timeZone.namePretty})` }) : /* @__PURE__ */ jsxs(Inline, { space: 2, padding: 2, children: [
30379
+ /* @__PURE__ */ jsx(Box, { className: "button-large", children: allowTimeZoneSwitch ? /* @__PURE__ */ jsx(Button$1, { "data-testid": "timezone-button", icon: EarthAmericasIcon, mode: "bleed", readOnly: !allowTimeZoneSwitch, onClick: allowTimeZoneSwitch ? dialogTimeZoneShow : noop$6, text: `${timeZone.alternativeName} (${timeZone.namePretty})` }) : /* @__PURE__ */ jsxs(Inline, { space: 2, padding: 2, children: [
30380
30380
  /* @__PURE__ */ jsx(Text$1, { weight: "medium", size: 1, children: /* @__PURE__ */ jsx(EarthAmericasIcon, {}) }),
30381
30381
  /* @__PURE__ */ jsx(Text$1, { weight: "medium", size: 1, children: `${timeZone.alternativeName} (${timeZone.namePretty})` })
30382
30382
  ] }) })
30383
- ] }) : /* @__PURE__ */ jsx(Fragment$1, { children: allowTimeZoneSwitch ? /* @__PURE__ */ jsx(Button$1, { icon: EarthAmericasIcon, mode: "bleed", readOnly: !allowTimeZoneSwitch, onClick: allowTimeZoneSwitch ? dialogTimeZoneShow : noop$7, text: `${timeZone.alternativeName} (${timeZone.namePretty})` }) : /* @__PURE__ */ jsxs(Inline, { space: 2, padding: 2, children: [
30383
+ ] }) : /* @__PURE__ */ jsx(Fragment$1, { children: allowTimeZoneSwitch ? /* @__PURE__ */ jsx(Button$1, { icon: EarthAmericasIcon, mode: "bleed", readOnly: !allowTimeZoneSwitch, onClick: allowTimeZoneSwitch ? dialogTimeZoneShow : noop$6, text: `${timeZone.alternativeName} (${timeZone.namePretty})` }) : /* @__PURE__ */ jsxs(Inline, { space: 2, padding: 2, children: [
30384
30384
  /* @__PURE__ */ jsx(Text$1, { weight: "medium", size: 1, children: /* @__PURE__ */ jsx(EarthAmericasIcon, {}) }),
30385
30385
  /* @__PURE__ */ jsx(Text$1, { weight: "medium", size: 1, children: `${timeZone.alternativeName} (${timeZone.namePretty})` })
30386
30386
  ] }) }) }), $[5] = allowTimeZoneSwitch, $[6] = dialogTimeZoneShow, $[7] = timeZone.alternativeName, $[8] = timeZone.city, $[9] = timeZone.namePretty, $[10] = useElementQueries, $[11] = t3) : t3 = $[11];
@@ -30405,7 +30405,7 @@ function sanitizeTimeZoneKeyId(id2) {
30405
30405
  const Root$n = styled(Card).withConfig({
30406
30406
  displayName: "Root",
30407
30407
  componentId: "sc-1t1t98a-0"
30408
- })`line-height:1;`, serialize$3 = (date) => date.toISOString();
30408
+ })`line-height:1;`, serialize$2 = (date) => date.toISOString();
30409
30409
  function parseOptions$1(options = {}) {
30410
30410
  const displayTimeZone = options.displayTimeZone && isValidTimeZoneString(options.displayTimeZone) ? options.displayTimeZone : void 0;
30411
30411
  return options.displayTimeZone && !displayTimeZone && console.warn(`Invalid time zone "${options.displayTimeZone}" supplied to datetime input, defaulting to local time zone or a previously stored preference`), {
@@ -30432,7 +30432,7 @@ function enforceTimeStep$1(dateString, timeStep) {
30432
30432
  if (!timeStep || timeStep === 1)
30433
30433
  return dateString;
30434
30434
  const date = parseISO(dateString), minutes = getMinutes(date), leftOver = minutes % timeStep;
30435
- return serialize$3(leftOver !== 0 ? setMinutes(date, minutes - leftOver) : date);
30435
+ return serialize$2(leftOver !== 0 ? setMinutes(date, minutes - leftOver) : date);
30436
30436
  }
30437
30437
  function DateTimeInput$2(props2) {
30438
30438
  const $ = c(79), {
@@ -30525,7 +30525,7 @@ function DateTimeInput$2(props2) {
30525
30525
  $[53] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t20 = /* @__PURE__ */ jsx(FormFieldStatus, { maxAvatars: 1, position: "top" }), $[53] = t20) : t20 = $[53];
30526
30526
  const t21 = !!focused;
30527
30527
  let t22;
30528
- $[54] !== calendarLabels || $[55] !== deserialize2 || $[56] !== elementProps || $[57] !== formatInputValue || $[58] !== handleChange || $[59] !== parseInputValue || $[60] !== schemaType.placeholder || $[61] !== timeStep || $[62] !== timeZoneScope || $[63] !== validationError || $[64] !== value ? (t22 = /* @__PURE__ */ jsx("div", { "data-testid": "change-bar-wrapper", children: /* @__PURE__ */ jsx("div", { "data-testid": "change-bar__field-wrapper", children: /* @__PURE__ */ jsx(CommonDateTimeInput$1, { ...elementProps, calendarLabels, deserialize: deserialize2, formatInputValue, onChange: handleChange, onParseError: setParseError, parseInputValue, placeholder: schemaType.placeholder, serialize: serialize$3, timeStep, selectTime: !0, value, timeZoneScope, validationError }) }) }), $[54] = calendarLabels, $[55] = deserialize2, $[56] = elementProps, $[57] = formatInputValue, $[58] = handleChange, $[59] = parseInputValue, $[60] = schemaType.placeholder, $[61] = timeStep, $[62] = timeZoneScope, $[63] = validationError, $[64] = value, $[65] = t22) : t22 = $[65];
30528
+ $[54] !== calendarLabels || $[55] !== deserialize2 || $[56] !== elementProps || $[57] !== formatInputValue || $[58] !== handleChange || $[59] !== parseInputValue || $[60] !== schemaType.placeholder || $[61] !== timeStep || $[62] !== timeZoneScope || $[63] !== validationError || $[64] !== value ? (t22 = /* @__PURE__ */ jsx("div", { "data-testid": "change-bar-wrapper", children: /* @__PURE__ */ jsx("div", { "data-testid": "change-bar__field-wrapper", children: /* @__PURE__ */ jsx(CommonDateTimeInput$1, { ...elementProps, calendarLabels, deserialize: deserialize2, formatInputValue, onChange: handleChange, onParseError: setParseError, parseInputValue, placeholder: schemaType.placeholder, serialize: serialize$2, timeStep, selectTime: !0, value, timeZoneScope, validationError }) }) }), $[54] = calendarLabels, $[55] = deserialize2, $[56] = elementProps, $[57] = formatInputValue, $[58] = handleChange, $[59] = parseInputValue, $[60] = schemaType.placeholder, $[61] = timeStep, $[62] = timeZoneScope, $[63] = validationError, $[64] = value, $[65] = t22) : t22 = $[65];
30529
30529
  let t23;
30530
30530
  $[66] !== changed || $[67] !== path || $[68] !== t21 || $[69] !== t22 ? (t23 = /* @__PURE__ */ jsx(ChangeIndicator, { hasFocus: t21, isChanged: changed, path, children: t22 }), $[66] = changed, $[67] = path, $[68] = t21, $[69] = t22, $[70] = t23) : t23 = $[70];
30531
30531
  let t24;
@@ -36032,17 +36032,17 @@ function CrossDatasetReferencePreview(props2) {
36032
36032
  t5
36033
36033
  ] }), $[34] = t1, $[35] = t5, $[36] = t6) : t6 = $[36], t6;
36034
36034
  }
36035
- const noop$4 = () => {
36035
+ const noop$3 = () => {
36036
36036
  }, INITIAL_LOADING_STATE$2 = {
36037
36037
  isLoading: !0,
36038
36038
  result: void 0,
36039
36039
  error: void 0,
36040
- retry: noop$4
36040
+ retry: noop$3
36041
36041
  }, EMPTY_STATE$1 = {
36042
36042
  isLoading: !1,
36043
36043
  result: void 0,
36044
36044
  error: void 0,
36045
- retry: noop$4
36045
+ retry: noop$3
36046
36046
  };
36047
36047
  function useReferenceInfo$1(doc, getReferenceInfo2) {
36048
36048
  const $ = c(8), [retryAttempt, setRetryAttempt] = useState(0);
@@ -36631,17 +36631,17 @@ function GlobalDocumentReferencePreview(props2) {
36631
36631
  t5
36632
36632
  ] }), $[34] = t1, $[35] = t5, $[36] = t6) : t6 = $[36], t6;
36633
36633
  }
36634
- const noop$3 = () => {
36634
+ const noop$2 = () => {
36635
36635
  }, INITIAL_LOADING_STATE$1 = {
36636
36636
  isLoading: !0,
36637
36637
  result: void 0,
36638
36638
  error: void 0,
36639
- retry: noop$3
36639
+ retry: noop$2
36640
36640
  }, EMPTY_STATE = {
36641
36641
  isLoading: !1,
36642
36642
  result: void 0,
36643
36643
  error: void 0,
36644
- retry: noop$3
36644
+ retry: noop$2
36645
36645
  };
36646
36646
  function useReferenceInfo(doc, getReferenceInfo2) {
36647
36647
  const $ = c(10), [retryAttempt, setRetryAttempt] = useState(0);
@@ -38117,526 +38117,6 @@ function useAssetSource(options) {
38117
38117
  clearUploadStatus
38118
38118
  }, $[15] = assetSourceUploader, $[16] = clearUploadStatus, $[17] = close, $[18] = handleSelectFilesToUpload, $[19] = state, $[20] = uploadWith, $[21] = t3) : t3 = $[21], t3;
38119
38119
  }
38120
- const FOCUS_EVENT = 0, RECONNECT_EVENT = 1, MUTATE_EVENT = 2, ERROR_REVALIDATE_EVENT = 3;
38121
- var has = Object.prototype.hasOwnProperty;
38122
- function dequal(foo, bar) {
38123
- var ctor, len;
38124
- if (foo === bar) return !0;
38125
- if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
38126
- if (ctor === Date) return foo.getTime() === bar.getTime();
38127
- if (ctor === RegExp) return foo.toString() === bar.toString();
38128
- if (ctor === Array) {
38129
- if ((len = foo.length) === bar.length)
38130
- for (; len-- && dequal(foo[len], bar[len]); ) ;
38131
- return len === -1;
38132
- }
38133
- if (!ctor || typeof foo == "object") {
38134
- len = 0;
38135
- for (ctor in foo)
38136
- if (has.call(foo, ctor) && ++len && !has.call(bar, ctor) || !(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return !1;
38137
- return Object.keys(bar).length === len;
38138
- }
38139
- }
38140
- return foo !== foo && bar !== bar;
38141
- }
38142
- const SWRGlobalState = /* @__PURE__ */ new WeakMap(), noop$2 = () => {
38143
- }, UNDEFINED = (
38144
- /*#__NOINLINE__*/
38145
- noop$2()
38146
- ), OBJECT = Object, isUndefined = (v) => v === UNDEFINED, isFunction = (v) => typeof v == "function", mergeObjects = (a, b) => ({
38147
- ...a,
38148
- ...b
38149
- }), isPromiseLike = (x) => isFunction(x.then), EMPTY_CACHE = {}, INITIAL_CACHE = {}, STR_UNDEFINED = "undefined", isWindowDefined = typeof window != STR_UNDEFINED, isDocumentDefined = typeof document != STR_UNDEFINED, isLegacyDeno = isWindowDefined && "Deno" in window, hasRequestAnimationFrame = () => isWindowDefined && typeof window.requestAnimationFrame != STR_UNDEFINED, createCacheHelper = (cache2, key) => {
38150
- const state = SWRGlobalState.get(cache2);
38151
- return [
38152
- // Getter
38153
- () => !isUndefined(key) && cache2.get(key) || EMPTY_CACHE,
38154
- // Setter
38155
- (info) => {
38156
- if (!isUndefined(key)) {
38157
- const prev = cache2.get(key);
38158
- key in INITIAL_CACHE || (INITIAL_CACHE[key] = prev), state[5](key, mergeObjects(prev, info), prev || EMPTY_CACHE);
38159
- }
38160
- },
38161
- // Subscriber
38162
- state[6],
38163
- // Get server cache snapshot
38164
- () => !isUndefined(key) && key in INITIAL_CACHE ? INITIAL_CACHE[key] : !isUndefined(key) && cache2.get(key) || EMPTY_CACHE
38165
- ];
38166
- };
38167
- let online = !0;
38168
- const isOnline = () => online, [onWindowEvent, offWindowEvent] = isWindowDefined && window.addEventListener ? [
38169
- window.addEventListener.bind(window),
38170
- window.removeEventListener.bind(window)
38171
- ] : [
38172
- noop$2,
38173
- noop$2
38174
- ], isVisible = () => {
38175
- const visibilityState = isDocumentDefined && document.visibilityState;
38176
- return isUndefined(visibilityState) || visibilityState !== "hidden";
38177
- }, initFocus = (callback) => (isDocumentDefined && document.addEventListener("visibilitychange", callback), onWindowEvent("focus", callback), () => {
38178
- isDocumentDefined && document.removeEventListener("visibilitychange", callback), offWindowEvent("focus", callback);
38179
- }), initReconnect = (callback) => {
38180
- const onOnline = () => {
38181
- online = !0, callback();
38182
- }, onOffline = () => {
38183
- online = !1;
38184
- };
38185
- return onWindowEvent("online", onOnline), onWindowEvent("offline", onOffline), () => {
38186
- offWindowEvent("online", onOnline), offWindowEvent("offline", onOffline);
38187
- };
38188
- }, preset = {
38189
- isOnline,
38190
- isVisible
38191
- }, defaultConfigOptions = {
38192
- initFocus,
38193
- initReconnect
38194
- }, IS_REACT_LEGACY = !React.useId, IS_SERVER = !isWindowDefined || isLegacyDeno, rAF = (f) => hasRequestAnimationFrame() ? window.requestAnimationFrame(f) : setTimeout(f, 1), useIsomorphicLayoutEffect = IS_SERVER ? useEffect : useLayoutEffect, navigatorConnection = typeof navigator < "u" && navigator.connection, slowConnection = !IS_SERVER && navigatorConnection && ([
38195
- "slow-2g",
38196
- "2g"
38197
- ].includes(navigatorConnection.effectiveType) || navigatorConnection.saveData), table = /* @__PURE__ */ new WeakMap(), getTypeName = (value) => OBJECT.prototype.toString.call(value), isObjectTypeName = (typeName, type) => typeName === `[object ${type}]`;
38198
- let counter$1 = 0;
38199
- const stableHash = (arg) => {
38200
- const type = typeof arg, typeName = getTypeName(arg), isDate = isObjectTypeName(typeName, "Date"), isRegex = isObjectTypeName(typeName, "RegExp"), isPlainObject2 = isObjectTypeName(typeName, "Object");
38201
- let result, index;
38202
- if (OBJECT(arg) === arg && !isDate && !isRegex) {
38203
- if (result = table.get(arg), result) return result;
38204
- if (result = ++counter$1 + "~", table.set(arg, result), Array.isArray(arg)) {
38205
- for (result = "@", index = 0; index < arg.length; index++)
38206
- result += stableHash(arg[index]) + ",";
38207
- table.set(arg, result);
38208
- }
38209
- if (isPlainObject2) {
38210
- result = "#";
38211
- const keys = OBJECT.keys(arg).sort();
38212
- for (; !isUndefined(index = keys.pop()); )
38213
- isUndefined(arg[index]) || (result += index + ":" + stableHash(arg[index]) + ",");
38214
- table.set(arg, result);
38215
- }
38216
- } else
38217
- result = isDate ? arg.toJSON() : type == "symbol" ? arg.toString() : type == "string" ? JSON.stringify(arg) : "" + arg;
38218
- return result;
38219
- }, serialize$2 = (key) => {
38220
- if (isFunction(key))
38221
- try {
38222
- key = key();
38223
- } catch {
38224
- key = "";
38225
- }
38226
- const args = key;
38227
- return key = typeof key == "string" ? key : (Array.isArray(key) ? key.length : key) ? stableHash(key) : "", [
38228
- key,
38229
- args
38230
- ];
38231
- };
38232
- let __timestamp = 0;
38233
- const getTimestamp = () => ++__timestamp;
38234
- async function internalMutate(...args) {
38235
- const [cache2, _key, _data, _opts] = args, options = mergeObjects({
38236
- populateCache: !0,
38237
- throwOnError: !0
38238
- }, typeof _opts == "boolean" ? {
38239
- revalidate: _opts
38240
- } : _opts || {});
38241
- let populateCache = options.populateCache;
38242
- const rollbackOnErrorOption = options.rollbackOnError;
38243
- let optimisticData = options.optimisticData;
38244
- const rollbackOnError = (error) => typeof rollbackOnErrorOption == "function" ? rollbackOnErrorOption(error) : rollbackOnErrorOption !== !1, throwOnError = options.throwOnError;
38245
- if (isFunction(_key)) {
38246
- const keyFilter = _key, matchedKeys = [], it = cache2.keys();
38247
- for (const key of it)
38248
- // Skip the special useSWRInfinite and useSWRSubscription keys.
38249
- !/^\$(inf|sub)\$/.test(key) && keyFilter(cache2.get(key)._k) && matchedKeys.push(key);
38250
- return Promise.all(matchedKeys.map(mutateByKey));
38251
- }
38252
- return mutateByKey(_key);
38253
- async function mutateByKey(_k) {
38254
- const [key] = serialize$2(_k);
38255
- if (!key) return;
38256
- const [get2, set2] = createCacheHelper(cache2, key), [EVENT_REVALIDATORS, MUTATION, FETCH, PRELOAD] = SWRGlobalState.get(cache2), startRevalidate = () => {
38257
- const revalidators = EVENT_REVALIDATORS[key];
38258
- return (isFunction(options.revalidate) ? options.revalidate(get2().data, _k) : options.revalidate !== !1) && (delete FETCH[key], delete PRELOAD[key], revalidators && revalidators[0]) ? revalidators[0](MUTATE_EVENT).then(() => get2().data) : get2().data;
38259
- };
38260
- if (args.length < 3)
38261
- return startRevalidate();
38262
- let data = _data, error, isError2 = !1;
38263
- const beforeMutationTs = getTimestamp();
38264
- MUTATION[key] = [
38265
- beforeMutationTs,
38266
- 0
38267
- ];
38268
- const hasOptimisticData = !isUndefined(optimisticData), state = get2(), displayedData = state.data, currentData = state._c, committedData = isUndefined(currentData) ? displayedData : currentData;
38269
- if (hasOptimisticData && (optimisticData = isFunction(optimisticData) ? optimisticData(committedData, displayedData) : optimisticData, set2({
38270
- data: optimisticData,
38271
- _c: committedData
38272
- })), isFunction(data))
38273
- try {
38274
- data = data(committedData);
38275
- } catch (err) {
38276
- error = err, isError2 = !0;
38277
- }
38278
- if (data && isPromiseLike(data))
38279
- if (data = await data.catch((err) => {
38280
- error = err, isError2 = !0;
38281
- }), beforeMutationTs !== MUTATION[key][0]) {
38282
- if (isError2) throw error;
38283
- return data;
38284
- } else isError2 && hasOptimisticData && rollbackOnError(error) && (populateCache = !0, set2({
38285
- data: committedData,
38286
- _c: UNDEFINED
38287
- }));
38288
- if (populateCache && !isError2)
38289
- if (isFunction(populateCache)) {
38290
- const populateCachedData = populateCache(data, committedData);
38291
- set2({
38292
- data: populateCachedData,
38293
- error: UNDEFINED,
38294
- _c: UNDEFINED
38295
- });
38296
- } else
38297
- set2({
38298
- data,
38299
- error: UNDEFINED,
38300
- _c: UNDEFINED
38301
- });
38302
- if (MUTATION[key][1] = getTimestamp(), Promise.resolve(startRevalidate()).then(() => {
38303
- set2({
38304
- _c: UNDEFINED
38305
- });
38306
- }), isError2) {
38307
- if (throwOnError) throw error;
38308
- return;
38309
- }
38310
- return data;
38311
- }
38312
- }
38313
- const revalidateAllKeys = (revalidators, type) => {
38314
- for (const key in revalidators)
38315
- revalidators[key][0] && revalidators[key][0](type);
38316
- }, initCache = (provider, options) => {
38317
- if (!SWRGlobalState.has(provider)) {
38318
- const opts = mergeObjects(defaultConfigOptions, options), EVENT_REVALIDATORS = /* @__PURE__ */ Object.create(null), mutate2 = internalMutate.bind(UNDEFINED, provider);
38319
- let unmount = noop$2;
38320
- const subscriptions = /* @__PURE__ */ Object.create(null), subscribe2 = (key, callback) => {
38321
- const subs = subscriptions[key] || [];
38322
- return subscriptions[key] = subs, subs.push(callback), () => subs.splice(subs.indexOf(callback), 1);
38323
- }, setter = (key, value, prev) => {
38324
- provider.set(key, value);
38325
- const subs = subscriptions[key];
38326
- if (subs)
38327
- for (const fn of subs)
38328
- fn(value, prev);
38329
- }, initProvider = () => {
38330
- if (!SWRGlobalState.has(provider) && (SWRGlobalState.set(provider, [
38331
- EVENT_REVALIDATORS,
38332
- /* @__PURE__ */ Object.create(null),
38333
- /* @__PURE__ */ Object.create(null),
38334
- /* @__PURE__ */ Object.create(null),
38335
- mutate2,
38336
- setter,
38337
- subscribe2
38338
- ]), !IS_SERVER)) {
38339
- const releaseFocus = opts.initFocus(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, FOCUS_EVENT))), releaseReconnect = opts.initReconnect(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, RECONNECT_EVENT)));
38340
- unmount = () => {
38341
- releaseFocus && releaseFocus(), releaseReconnect && releaseReconnect(), SWRGlobalState.delete(provider);
38342
- };
38343
- }
38344
- };
38345
- return initProvider(), [
38346
- provider,
38347
- mutate2,
38348
- initProvider,
38349
- unmount
38350
- ];
38351
- }
38352
- return [
38353
- provider,
38354
- SWRGlobalState.get(provider)[4]
38355
- ];
38356
- }, onErrorRetry = (_, __, config, revalidate, opts) => {
38357
- const maxRetryCount = config.errorRetryCount, currentRetryCount = opts.retryCount, timeout2 = ~~((Math.random() + 0.5) * (1 << (currentRetryCount < 8 ? currentRetryCount : 8))) * config.errorRetryInterval;
38358
- !isUndefined(maxRetryCount) && currentRetryCount > maxRetryCount || setTimeout(revalidate, timeout2, opts);
38359
- }, compare = dequal, [cache$3, mutate] = initCache(/* @__PURE__ */ new Map()), defaultConfig = mergeObjects(
38360
- {
38361
- // events
38362
- onLoadingSlow: noop$2,
38363
- onSuccess: noop$2,
38364
- onError: noop$2,
38365
- onErrorRetry,
38366
- onDiscarded: noop$2,
38367
- // switches
38368
- revalidateOnFocus: !0,
38369
- revalidateOnReconnect: !0,
38370
- revalidateIfStale: !0,
38371
- shouldRetryOnError: !0,
38372
- // timeouts
38373
- errorRetryInterval: slowConnection ? 1e4 : 5e3,
38374
- focusThrottleInterval: 5 * 1e3,
38375
- dedupingInterval: 2 * 1e3,
38376
- loadingTimeout: slowConnection ? 5e3 : 3e3,
38377
- // providers
38378
- compare,
38379
- isPaused: () => !1,
38380
- cache: cache$3,
38381
- mutate,
38382
- fallback: {}
38383
- },
38384
- // use web preset by default
38385
- preset
38386
- ), mergeConfigs = (a, b) => {
38387
- const v = mergeObjects(a, b);
38388
- if (b) {
38389
- const { use: u1, fallback: f1 } = a, { use: u2, fallback: f2 } = b;
38390
- u1 && u2 && (v.use = u1.concat(u2)), f1 && f2 && (v.fallback = mergeObjects(f1, f2));
38391
- }
38392
- return v;
38393
- }, SWRConfigContext = createContext({}), INFINITE_PREFIX = "$inf$", enableDevtools = isWindowDefined && window.__SWR_DEVTOOLS_USE__, use$1 = enableDevtools ? window.__SWR_DEVTOOLS_USE__ : [], setupDevTools = () => {
38394
- enableDevtools && (window.__SWR_DEVTOOLS_REACT__ = React);
38395
- }, normalize = (args) => isFunction(args[1]) ? [
38396
- args[0],
38397
- args[1],
38398
- args[2] || {}
38399
- ] : [
38400
- args[0],
38401
- null,
38402
- (args[1] === null ? args[2] : args[1]) || {}
38403
- ], useSWRConfig = () => {
38404
- const parentConfig = useContext(SWRConfigContext);
38405
- return useMemo(() => mergeObjects(defaultConfig, parentConfig), [
38406
- parentConfig
38407
- ]);
38408
- }, middleware = (useSWRNext) => (key_, fetcher_, config) => useSWRNext(key_, fetcher_ && ((...args) => {
38409
- const [key] = serialize$2(key_), [, , , PRELOAD] = SWRGlobalState.get(cache$3);
38410
- if (key.startsWith(INFINITE_PREFIX))
38411
- return fetcher_(...args);
38412
- const req = PRELOAD[key];
38413
- return isUndefined(req) ? fetcher_(...args) : (delete PRELOAD[key], req);
38414
- }), config), BUILT_IN_MIDDLEWARE = use$1.concat(middleware), withArgs = (hook) => function(...args) {
38415
- const fallbackConfig = useSWRConfig(), [key, fn, _config] = normalize(args), config = mergeConfigs(fallbackConfig, _config);
38416
- let next = hook;
38417
- const { use: use2 } = config, middleware2 = (use2 || []).concat(BUILT_IN_MIDDLEWARE);
38418
- for (let i = middleware2.length; i--; )
38419
- next = middleware2[i](next);
38420
- return next(key, fn || config.fetcher || null, config);
38421
- }, subscribeCallback = (key, callbacks, callback) => {
38422
- const keyedRevalidators = callbacks[key] || (callbacks[key] = []);
38423
- return keyedRevalidators.push(callback), () => {
38424
- const index = keyedRevalidators.indexOf(callback);
38425
- index >= 0 && (keyedRevalidators[index] = keyedRevalidators[keyedRevalidators.length - 1], keyedRevalidators.pop());
38426
- };
38427
- };
38428
- setupDevTools();
38429
- const use = React.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
38430
- // and emitting an error.
38431
- // We assume that this is only for the `use(thenable)` case, not `use(context)`.
38432
- // https://github.com/facebook/react/blob/aed00dacfb79d17c53218404c52b1c7aa59c4a89/packages/react-server/src/ReactFizzThenable.js#L45
38433
- ((thenable) => {
38434
- switch (thenable.status) {
38435
- case "pending":
38436
- throw thenable;
38437
- case "fulfilled":
38438
- return thenable.value;
38439
- case "rejected":
38440
- throw thenable.reason;
38441
- default:
38442
- throw thenable.status = "pending", thenable.then((v) => {
38443
- thenable.status = "fulfilled", thenable.value = v;
38444
- }, (e) => {
38445
- thenable.status = "rejected", thenable.reason = e;
38446
- }), thenable;
38447
- }
38448
- }), WITH_DEDUPE = {
38449
- dedupe: !0
38450
- }, resolvedUndef = Promise.resolve(UNDEFINED), sub = () => noop$2, useSWRHandler = (_key, fetcher, config) => {
38451
- const { cache: cache2, compare: compare2, suspense, fallbackData, revalidateOnMount, revalidateIfStale, refreshInterval, refreshWhenHidden, refreshWhenOffline, keepPreviousData, strictServerPrefetchWarning } = config, [EVENT_REVALIDATORS, MUTATION, FETCH, PRELOAD] = SWRGlobalState.get(cache2), [key, fnArg] = serialize$2(_key), initialMountedRef = useRef(!1), unmountedRef = useRef(!1), keyRef = useRef(key), fetcherRef = useRef(fetcher), configRef = useRef(config), getConfig = () => configRef.current, isActive = () => getConfig().isVisible() && getConfig().isOnline(), [getCache, setCache, subscribeCache, getInitialCache] = createCacheHelper(cache2, key), stateDependencies = useRef({}).current, fallback2 = isUndefined(fallbackData) ? isUndefined(config.fallback) ? UNDEFINED : config.fallback[key] : fallbackData, isEqual2 = (prev, current) => {
38452
- for (const _ in stateDependencies) {
38453
- const t = _;
38454
- if (t === "data") {
38455
- if (!compare2(prev[t], current[t]) && (!isUndefined(prev[t]) || !compare2(returnedData, current[t])))
38456
- return !1;
38457
- } else if (current[t] !== prev[t])
38458
- return !1;
38459
- }
38460
- return !0;
38461
- }, isInitialMount = !initialMountedRef.current, getSnapshot2 = useMemo(() => {
38462
- const cachedData2 = getCache(), initialData = getInitialCache(), getSelectedCache = (state) => {
38463
- const snapshot2 = mergeObjects(state);
38464
- return delete snapshot2._k, (() => {
38465
- if (!key || !fetcher || getConfig().isPaused()) return !1;
38466
- if (isInitialMount && !isUndefined(revalidateOnMount)) return revalidateOnMount;
38467
- const data2 = isUndefined(fallback2) ? snapshot2.data : fallback2;
38468
- return isUndefined(data2) || revalidateIfStale;
38469
- })() ? {
38470
- isValidating: !0,
38471
- isLoading: !0,
38472
- ...snapshot2
38473
- } : snapshot2;
38474
- }, clientSnapshot = getSelectedCache(cachedData2), serverSnapshot = cachedData2 === initialData ? clientSnapshot : getSelectedCache(initialData);
38475
- let memorizedSnapshot = clientSnapshot;
38476
- return [
38477
- () => {
38478
- const newSnapshot = getSelectedCache(getCache());
38479
- return isEqual2(newSnapshot, memorizedSnapshot) ? (memorizedSnapshot.data = newSnapshot.data, memorizedSnapshot.isLoading = newSnapshot.isLoading, memorizedSnapshot.isValidating = newSnapshot.isValidating, memorizedSnapshot.error = newSnapshot.error, memorizedSnapshot) : (memorizedSnapshot = newSnapshot, newSnapshot);
38480
- },
38481
- () => serverSnapshot
38482
- ];
38483
- }, [
38484
- cache2,
38485
- key
38486
- ]), cached = useSyncExternalStore$1(useCallback(
38487
- (callback) => subscribeCache(key, (current, prev) => {
38488
- isEqual2(prev, current) || callback();
38489
- }),
38490
- // eslint-disable-next-line react-hooks/exhaustive-deps
38491
- [
38492
- cache2,
38493
- key
38494
- ]
38495
- ), getSnapshot2[0], getSnapshot2[1]), hasRevalidator = EVENT_REVALIDATORS[key] && EVENT_REVALIDATORS[key].length > 0, cachedData = cached.data, data = isUndefined(cachedData) ? fallback2 && isPromiseLike(fallback2) ? use(fallback2) : fallback2 : cachedData, error = cached.error, laggyDataRef = useRef(data), returnedData = keepPreviousData ? isUndefined(cachedData) ? isUndefined(laggyDataRef.current) ? data : laggyDataRef.current : cachedData : data, hasKeyButNoData = key && isUndefined(data), hydrationRef = useRef(null);
38496
- !IS_SERVER && // getServerSnapshot is only called during hydration
38497
- // eslint-disable-next-line react-hooks/rules-of-hooks
38498
- useSyncExternalStore$1(sub, () => (hydrationRef.current = !1, hydrationRef), () => (hydrationRef.current = !0, hydrationRef));
38499
- const isHydration = hydrationRef.current;
38500
- strictServerPrefetchWarning && isHydration && !suspense && hasKeyButNoData && console.warn(`Missing pre-initiated data for serialized key "${key}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);
38501
- const shouldDoInitialRevalidation = !key || !fetcher || getConfig().isPaused() || hasRevalidator && !isUndefined(error) ? !1 : isInitialMount && !isUndefined(revalidateOnMount) ? revalidateOnMount : suspense ? isUndefined(data) ? !1 : revalidateIfStale : isUndefined(data) || revalidateIfStale, defaultValidatingState = isInitialMount && shouldDoInitialRevalidation, isValidating = isUndefined(cached.isValidating) ? defaultValidatingState : cached.isValidating, isLoading = isUndefined(cached.isLoading) ? defaultValidatingState : cached.isLoading, revalidate = useCallback(
38502
- async (revalidateOpts) => {
38503
- const currentFetcher = fetcherRef.current;
38504
- if (!key || !currentFetcher || unmountedRef.current || getConfig().isPaused())
38505
- return !1;
38506
- let newData, startAt, loading = !0;
38507
- const opts = revalidateOpts || {}, shouldStartNewRequest = !FETCH[key] || !opts.dedupe, callbackSafeguard = () => IS_REACT_LEGACY ? !unmountedRef.current && key === keyRef.current && initialMountedRef.current : key === keyRef.current, finalState = {
38508
- isValidating: !1,
38509
- isLoading: !1
38510
- }, finishRequestAndUpdateState = () => {
38511
- setCache(finalState);
38512
- }, cleanupState = () => {
38513
- const requestInfo = FETCH[key];
38514
- requestInfo && requestInfo[1] === startAt && delete FETCH[key];
38515
- }, initialState2 = {
38516
- isValidating: !0
38517
- };
38518
- isUndefined(getCache().data) && (initialState2.isLoading = !0);
38519
- try {
38520
- if (shouldStartNewRequest && (setCache(initialState2), config.loadingTimeout && isUndefined(getCache().data) && setTimeout(() => {
38521
- loading && callbackSafeguard() && getConfig().onLoadingSlow(key, config);
38522
- }, config.loadingTimeout), FETCH[key] = [
38523
- currentFetcher(fnArg),
38524
- getTimestamp()
38525
- ]), [newData, startAt] = FETCH[key], newData = await newData, shouldStartNewRequest && setTimeout(cleanupState, config.dedupingInterval), !FETCH[key] || FETCH[key][1] !== startAt)
38526
- return shouldStartNewRequest && callbackSafeguard() && getConfig().onDiscarded(key), !1;
38527
- finalState.error = UNDEFINED;
38528
- const mutationInfo = MUTATION[key];
38529
- if (!isUndefined(mutationInfo) && // case 1
38530
- (startAt <= mutationInfo[0] || // case 2
38531
- startAt <= mutationInfo[1] || // case 3
38532
- mutationInfo[1] === 0))
38533
- return finishRequestAndUpdateState(), shouldStartNewRequest && callbackSafeguard() && getConfig().onDiscarded(key), !1;
38534
- const cacheData = getCache().data;
38535
- finalState.data = compare2(cacheData, newData) ? cacheData : newData, shouldStartNewRequest && callbackSafeguard() && getConfig().onSuccess(newData, key, config);
38536
- } catch (err) {
38537
- cleanupState();
38538
- const currentConfig = getConfig(), { shouldRetryOnError } = currentConfig;
38539
- currentConfig.isPaused() || (finalState.error = err, shouldStartNewRequest && callbackSafeguard() && (currentConfig.onError(err, key, currentConfig), (shouldRetryOnError === !0 || isFunction(shouldRetryOnError) && shouldRetryOnError(err)) && (!getConfig().revalidateOnFocus || !getConfig().revalidateOnReconnect || isActive()) && currentConfig.onErrorRetry(err, key, currentConfig, (_opts) => {
38540
- const revalidators = EVENT_REVALIDATORS[key];
38541
- revalidators && revalidators[0] && revalidators[0](ERROR_REVALIDATE_EVENT, _opts);
38542
- }, {
38543
- retryCount: (opts.retryCount || 0) + 1,
38544
- dedupe: !0
38545
- })));
38546
- }
38547
- return loading = !1, finishRequestAndUpdateState(), !0;
38548
- },
38549
- // `setState` is immutable, and `eventsCallback`, `fnArg`, and
38550
- // `keyValidating` are depending on `key`, so we can exclude them from
38551
- // the deps array.
38552
- //
38553
- // FIXME:
38554
- // `fn` and `config` might be changed during the lifecycle,
38555
- // but they might be changed every render like this.
38556
- // `useSWR('key', () => fetch('/api/'), { suspense: true })`
38557
- // So we omit the values from the deps array
38558
- // even though it might cause unexpected behaviors.
38559
- // eslint-disable-next-line react-hooks/exhaustive-deps
38560
- [
38561
- key,
38562
- cache2
38563
- ]
38564
- ), boundMutate = useCallback(
38565
- // Use callback to make sure `keyRef.current` returns latest result every time
38566
- (...args) => internalMutate(cache2, keyRef.current, ...args),
38567
- // eslint-disable-next-line react-hooks/exhaustive-deps
38568
- []
38569
- );
38570
- if (useIsomorphicLayoutEffect(() => {
38571
- fetcherRef.current = fetcher, configRef.current = config, isUndefined(cachedData) || (laggyDataRef.current = cachedData);
38572
- }), useIsomorphicLayoutEffect(() => {
38573
- if (!key) return;
38574
- const softRevalidate = revalidate.bind(UNDEFINED, WITH_DEDUPE);
38575
- let nextFocusRevalidatedAt = 0;
38576
- getConfig().revalidateOnFocus && (nextFocusRevalidatedAt = Date.now() + getConfig().focusThrottleInterval);
38577
- const unsubEvents = subscribeCallback(key, EVENT_REVALIDATORS, (type, opts = {}) => {
38578
- if (type == FOCUS_EVENT) {
38579
- const now = Date.now();
38580
- getConfig().revalidateOnFocus && now > nextFocusRevalidatedAt && isActive() && (nextFocusRevalidatedAt = now + getConfig().focusThrottleInterval, softRevalidate());
38581
- } else if (type == RECONNECT_EVENT)
38582
- getConfig().revalidateOnReconnect && isActive() && softRevalidate();
38583
- else {
38584
- if (type == MUTATE_EVENT)
38585
- return revalidate();
38586
- if (type == ERROR_REVALIDATE_EVENT)
38587
- return revalidate(opts);
38588
- }
38589
- });
38590
- return unmountedRef.current = !1, keyRef.current = key, initialMountedRef.current = !0, setCache({
38591
- _k: fnArg
38592
- }), shouldDoInitialRevalidation && (FETCH[key] || (isUndefined(data) || IS_SERVER ? softRevalidate() : rAF(softRevalidate))), () => {
38593
- unmountedRef.current = !0, unsubEvents();
38594
- };
38595
- }, [
38596
- key
38597
- ]), useIsomorphicLayoutEffect(() => {
38598
- let timer2;
38599
- function next() {
38600
- const interval = isFunction(refreshInterval) ? refreshInterval(getCache().data) : refreshInterval;
38601
- interval && timer2 !== -1 && (timer2 = setTimeout(execute2, interval));
38602
- }
38603
- function execute2() {
38604
- !getCache().error && (refreshWhenHidden || getConfig().isVisible()) && (refreshWhenOffline || getConfig().isOnline()) ? revalidate(WITH_DEDUPE).then(next) : next();
38605
- }
38606
- return next(), () => {
38607
- timer2 && (clearTimeout(timer2), timer2 = -1);
38608
- };
38609
- }, [
38610
- refreshInterval,
38611
- refreshWhenHidden,
38612
- refreshWhenOffline,
38613
- key
38614
- ]), useDebugValue(returnedData), suspense) {
38615
- if (!IS_REACT_LEGACY && IS_SERVER && hasKeyButNoData)
38616
- throw new Error("Fallback data is required when using Suspense in SSR.");
38617
- hasKeyButNoData && (fetcherRef.current = fetcher, configRef.current = config, unmountedRef.current = !1);
38618
- const req = PRELOAD[key], mutateReq = !isUndefined(req) && hasKeyButNoData ? boundMutate(req) : resolvedUndef;
38619
- if (use(mutateReq), !isUndefined(error) && hasKeyButNoData)
38620
- throw error;
38621
- const revalidation = hasKeyButNoData ? revalidate(WITH_DEDUPE) : resolvedUndef;
38622
- !isUndefined(returnedData) && hasKeyButNoData && (revalidation.status = "fulfilled", revalidation.value = !0), use(revalidation);
38623
- }
38624
- return {
38625
- mutate: boundMutate,
38626
- get data() {
38627
- return stateDependencies.data = !0, returnedData;
38628
- },
38629
- get error() {
38630
- return stateDependencies.error = !0, error;
38631
- },
38632
- get isValidating() {
38633
- return stateDependencies.isValidating = !0, isValidating;
38634
- },
38635
- get isLoading() {
38636
- return stateDependencies.isLoading = !0, isLoading;
38637
- }
38638
- };
38639
- }, useSWR = withArgs(useSWRHandler);
38640
38120
  function hasOwnRecord(value, key) {
38641
38121
  return typeof value == "object" && value !== null && Object.prototype.hasOwnProperty.call(value, key);
38642
38122
  }
@@ -44468,7 +43948,7 @@ function useVisibility(props2) {
44468
43948
  if (!element || disabled)
44469
43949
  return;
44470
43950
  element && "checkVisibility" in element && setVisible(element.checkVisibility());
44471
- const isDocumentVisible$ = concat(of(!document.hidden), visibilityChange$.pipe(map(_temp$20))).pipe(distinctUntilChanged()), inViewport$ = intersectionObservableFor(element).pipe(map(_temp2$O)), sub2 = isDocumentVisible$.pipe(switchMap((isDocumentVisible) => isDocumentVisible ? inViewport$ : of(!1)), switchMap((isVisible2) => isVisible2 ? of(!0) : of(!1).pipe(delay(hideDelay))), distinctUntilChanged()).subscribe(setVisible);
43951
+ const isDocumentVisible$ = concat(of(!document.hidden), visibilityChange$.pipe(map(_temp$20))).pipe(distinctUntilChanged()), inViewport$ = intersectionObservableFor(element).pipe(map(_temp2$O)), sub2 = isDocumentVisible$.pipe(switchMap((isDocumentVisible) => isDocumentVisible ? inViewport$ : of(!1)), switchMap((isVisible) => isVisible ? of(!0) : of(!1).pipe(delay(hideDelay))), distinctUntilChanged()).subscribe(setVisible);
44472
43952
  return () => sub2.unsubscribe();
44473
43953
  }, t2 = [element, hideDelay, disabled], $[0] = disabled, $[1] = element, $[2] = hideDelay, $[3] = t1, $[4] = t2) : (t1 = $[3], t2 = $[4]), useLayoutEffect(t1, t2), disabled ? !1 : visible;
44474
43954
  }
@@ -44515,11 +43995,11 @@ function PreviewLoader(props2) {
44515
43995
  } = props2, $[0] = props2, $[1] = Component2, $[2] = layout, $[3] = perspectiveStack, $[4] = restProps, $[5] = schemaType, $[6] = skipVisibilityCheck, $[7] = styleProp, $[8] = value) : (Component2 = $[1], layout = $[2], perspectiveStack = $[3], restProps = $[4], schemaType = $[5], skipVisibilityCheck = $[6], styleProp = $[7], value = $[8]);
44516
43996
  const {
44517
43997
  t
44518
- } = useTranslation(), [element, setElement] = useState(null), isVisible2 = useVisibility({
43998
+ } = useTranslation(), [element, setElement] = useState(null), isVisible = useVisibility({
44519
43999
  disabled: skipVisibilityCheck,
44520
44000
  element,
44521
44001
  hideDelay: _HIDE_DELAY
44522
- }) || skipVisibilityCheck, t0 = skipVisibilityCheck || isVisible2;
44002
+ }) || skipVisibilityCheck, t0 = skipVisibilityCheck || isVisible;
44523
44003
  let t1;
44524
44004
  $[9] !== perspectiveStack || $[10] !== schemaType || $[11] !== t0 || $[12] !== value ? (t1 = {
44525
44005
  enabled: t0,
@@ -49580,7 +49060,7 @@ function useGuardWithReleaseLimitUpsell() {
49580
49060
  $[0] !== guardWithReleaseLimitUpsell ? (t0 = () => {
49581
49061
  setIsPendingGuardResponse(!0);
49582
49062
  const promise = new Promise((resolve) => {
49583
- guardWithReleaseLimitUpsell(noop$7, !1, (hasPassed) => {
49063
+ guardWithReleaseLimitUpsell(noop$6, !1, (hasPassed) => {
49584
49064
  resolve(hasPassed);
49585
49065
  });
49586
49066
  });
@@ -57046,7 +56526,7 @@ const COMMON = {
57046
56526
  fieldPath,
57047
56527
  value
57048
56528
  }) => {
57049
- const flooredValue = typeof value?.unitValue == "number" ? Math.floor(value.unitValue) : void 0, timestampAgo = Number.isFinite(flooredValue) ? sub$1(/* @__PURE__ */ new Date(), {
56529
+ const flooredValue = typeof value?.unitValue == "number" ? Math.floor(value.unitValue) : void 0, timestampAgo = Number.isFinite(flooredValue) ? sub(/* @__PURE__ */ new Date(), {
57050
56530
  days: value?.unit === "day" ? flooredValue : 0,
57051
56531
  months: value?.unit === "month" ? flooredValue : 0,
57052
56532
  years: value?.unit === "year" ? flooredValue : 0
@@ -57135,7 +56615,7 @@ const COMMON = {
57135
56615
  fieldPath,
57136
56616
  value
57137
56617
  }) => {
57138
- const flooredValue = typeof value?.unitValue == "number" ? Math.floor(value.unitValue) : void 0, timestampAgo = Number.isFinite(flooredValue) ? sub$1(/* @__PURE__ */ new Date(), {
56618
+ const flooredValue = typeof value?.unitValue == "number" ? Math.floor(value.unitValue) : void 0, timestampAgo = Number.isFinite(flooredValue) ? sub(/* @__PURE__ */ new Date(), {
57139
56619
  days: value?.unit === "day" ? flooredValue : 0,
57140
56620
  months: value?.unit === "month" ? flooredValue : 0,
57141
56621
  years: value?.unit === "year" ? flooredValue : 0
@@ -62455,8 +61935,8 @@ const linkMiddleware = (node) => typeof node == "string" ? node.split(URL_REGEX)
62455
61935
  function transformChildren(node) {
62456
61936
  return Array.isArray(node) ? node.flatMap((item) => {
62457
61937
  let transformedItem = [item];
62458
- for (const middleware2 of middlewares)
62459
- transformedItem = transformedItem.flatMap(middleware2);
61938
+ for (const middleware of middlewares)
61939
+ transformedItem = transformedItem.flatMap(middleware);
62460
61940
  return transformedItem;
62461
61941
  }) : node;
62462
61942
  }
@@ -64261,25 +63741,25 @@ function usePollSchedules(t0) {
64261
63741
  const queryKey = t7, fetcher = useFetcher(queryKey), {
64262
63742
  data,
64263
63743
  error,
64264
- mutate: mutate2
63744
+ mutate
64265
63745
  } = useSWR(enabled ? queryKey : null, fetcher, swrOptions);
64266
63746
  let t8;
64267
- $[12] !== mutate2 ? (t8 = (event) => {
64268
- mutate2((currentData) => ({
63747
+ $[12] !== mutate ? (t8 = (event) => {
63748
+ mutate((currentData) => ({
64269
63749
  schedules: currentData?.schedules?.filter((schedule) => schedule.id !== event.detail.scheduleId)
64270
63750
  }), !0);
64271
- }, $[12] = mutate2, $[13] = t8) : t8 = $[13];
63751
+ }, $[12] = mutate, $[13] = t8) : t8 = $[13];
64272
63752
  const handleDelete = t8;
64273
63753
  let t9;
64274
- $[14] !== mutate2 ? (t9 = (event_0) => {
64275
- mutate2((currentData_0) => ({
63754
+ $[14] !== mutate ? (t9 = (event_0) => {
63755
+ mutate((currentData_0) => ({
64276
63756
  schedules: currentData_0?.schedules?.filter((schedule_0) => !event_0.detail.scheduleIds.includes(schedule_0.id))
64277
63757
  }), !0);
64278
- }, $[14] = mutate2, $[15] = t9) : t9 = $[15];
63758
+ }, $[14] = mutate, $[15] = t9) : t9 = $[15];
64279
63759
  const handleDeleteMultiple = t9;
64280
63760
  let t10;
64281
- $[16] !== mutate2 ? (t10 = (event_1) => {
64282
- mutate2((currentData_1) => {
63761
+ $[16] !== mutate ? (t10 = (event_1) => {
63762
+ mutate((currentData_1) => {
64283
63763
  const currentSchedules = currentData_1?.schedules || [], index = currentSchedules.findIndex((schedule_1) => schedule_1.id === event_1.detail.scheduleId);
64284
63764
  return {
64285
63765
  schedules: [...currentSchedules.slice(0, index), {
@@ -64289,11 +63769,11 @@ function usePollSchedules(t0) {
64289
63769
  }, ...currentSchedules.slice(index + 1)]
64290
63770
  };
64291
63771
  }, !0);
64292
- }, $[16] = mutate2, $[17] = t10) : t10 = $[17];
63772
+ }, $[16] = mutate, $[17] = t10) : t10 = $[17];
64293
63773
  const handlePublish = t10;
64294
63774
  let t11;
64295
- $[18] !== mutate2 ? (t11 = (event_2) => {
64296
- mutate2((currentData_2) => {
63775
+ $[18] !== mutate ? (t11 = (event_2) => {
63776
+ mutate((currentData_2) => {
64297
63777
  const currentSchedules_0 = currentData_2?.schedules || [], index_0 = currentSchedules_0.findIndex((schedule_2) => schedule_2.id === event_2.detail.scheduleId);
64298
63778
  return {
64299
63779
  schedules: [...currentSchedules_0.slice(0, index_0), {
@@ -64302,7 +63782,7 @@ function usePollSchedules(t0) {
64302
63782
  }, ...currentSchedules_0.slice(index_0 + 1)]
64303
63783
  };
64304
63784
  }, !0);
64305
- }, $[18] = mutate2, $[19] = t11) : t11 = $[19];
63785
+ }, $[18] = mutate, $[19] = t11) : t11 = $[19];
64306
63786
  const handleUpdate = t11;
64307
63787
  let t12, t13;
64308
63788
  $[20] !== handleDelete || $[21] !== handleDeleteMultiple || $[22] !== handlePublish || $[23] !== handleUpdate ? (t12 = () => (window.addEventListener(ScheduleEvents.delete, handleDelete), window.addEventListener(ScheduleEvents.deleteMultiple, handleDeleteMultiple), window.addEventListener(ScheduleEvents.publish, handlePublish), window.addEventListener(ScheduleEvents.update, handleUpdate), () => {
@@ -75539,18 +75019,18 @@ function ToolCollapseMenu(props2) {
75539
75019
  function ToolVerticalMenu(props2) {
75540
75020
  const $ = c(9), {
75541
75021
  activeToolName,
75542
- isVisible: isVisible2,
75022
+ isVisible,
75543
75023
  tools
75544
75024
  } = props2;
75545
75025
  let t0;
75546
- if ($[0] !== activeToolName || $[1] !== isVisible2 || $[2] !== tools) {
75026
+ if ($[0] !== activeToolName || $[1] !== isVisible || $[2] !== tools) {
75547
75027
  let t12;
75548
- $[4] !== activeToolName || $[5] !== isVisible2 ? (t12 = (tool) => {
75028
+ $[4] !== activeToolName || $[5] !== isVisible ? (t12 = (tool) => {
75549
75029
  const title = tool?.title || startCase(tool.name), Link2 = forwardRef(function(linkProps, ref) {
75550
75030
  return /* @__PURE__ */ jsx(ToolLink, { ...linkProps, ref, name: tool.name, children: linkProps.children });
75551
75031
  });
75552
- return /* @__PURE__ */ jsx(Stack, { as: "li", children: /* @__PURE__ */ jsx(Button$1, { as: Link2, justify: "flex-start", mode: "bleed", selected: activeToolName === tool.name, size: "large", tabIndex: isVisible2 ? 0 : -1, text: title }) }, tool.name);
75553
- }, $[4] = activeToolName, $[5] = isVisible2, $[6] = t12) : t12 = $[6], t0 = tools.map(t12), $[0] = activeToolName, $[1] = isVisible2, $[2] = tools, $[3] = t0;
75032
+ return /* @__PURE__ */ jsx(Stack, { as: "li", children: /* @__PURE__ */ jsx(Button$1, { as: Link2, justify: "flex-start", mode: "bleed", selected: activeToolName === tool.name, size: "large", tabIndex: isVisible ? 0 : -1, text: title }) }, tool.name);
75033
+ }, $[4] = activeToolName, $[5] = isVisible, $[6] = t12) : t12 = $[6], t0 = tools.map(t12), $[0] = activeToolName, $[1] = isVisible, $[2] = tools, $[3] = t0;
75554
75034
  } else
75555
75035
  t0 = $[3];
75556
75036
  let t1;
@@ -78879,7 +78359,7 @@ function getOrderedTools(tools) {
78879
78359
  tool,
78880
78360
  index: toolIndex === -1 ? 1 / 0 : toolIndex
78881
78361
  }, target;
78882
- }, {}), isVisible2 = (tool) => hidden.indexOf(tool.name) === -1, ret = tools.filter(isVisible2);
78362
+ }, {}), isVisible = (tool) => hidden.indexOf(tool.name) === -1, ret = tools.filter(isVisible);
78883
78363
  return ret.sort((tool1, tool2) => {
78884
78364
  const toolA = keyed[tool1.name], toolB = keyed[tool2.name], indexA = toolA ? toolA.index : 1 / 0, indexB = toolB ? toolB.index : 1 / 0;
78885
78365
  return indexA === indexB ? 0 : indexA - indexB;
@@ -87637,7 +87117,7 @@ export {
87637
87117
  measureFirstMatch,
87638
87118
  mergeParseErrors,
87639
87119
  newDraftFrom,
87640
- noop$6 as noop,
87120
+ noop$5 as noop,
87641
87121
  normalizeIndexSegment,
87642
87122
  normalizeIndexTupleSegment,
87643
87123
  normalizeKeySegment,