sanity 5.0.1-next.7 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/lib/_chunks-es/LiveQueries.js +1 -2
  2. package/lib/_chunks-es/LiveQueries.js.map +1 -1
  3. package/lib/_chunks-es/PresentationToolGrantsCheck.js +1 -2
  4. package/lib/_chunks-es/PresentationToolGrantsCheck.js.map +1 -1
  5. package/lib/_chunks-es/StructureToolProvider.js +1 -6
  6. package/lib/_chunks-es/StructureToolProvider.js.map +1 -1
  7. package/lib/_chunks-es/_internal.js +3 -11
  8. package/lib/_chunks-es/_internal.js.map +1 -1
  9. package/lib/_chunks-es/createAspectAction.js +1 -1
  10. package/lib/_chunks-es/createAspectAction.js.map +1 -1
  11. package/lib/_chunks-es/deleteSchemaAction.js +1 -1
  12. package/lib/_chunks-es/deleteSchemaAction.js.map +1 -1
  13. package/lib/_chunks-es/deployApiAction.js +1 -5
  14. package/lib/_chunks-es/deployApiAction.js.map +1 -1
  15. package/lib/_chunks-es/deploySchemasAction.js +1 -1
  16. package/lib/_chunks-es/deploySchemasAction.js.map +1 -1
  17. package/lib/_chunks-es/index3.js +1 -2
  18. package/lib/_chunks-es/index3.js.map +1 -1
  19. package/lib/_chunks-es/listSchemasAction.js +1 -1
  20. package/lib/_chunks-es/listSchemasAction.js.map +1 -1
  21. package/lib/_chunks-es/package.js +1 -1
  22. package/lib/_chunks-es/pane.js +2 -9
  23. package/lib/_chunks-es/pane.js.map +1 -1
  24. package/lib/_chunks-es/presentation.js +1 -2
  25. package/lib/_chunks-es/presentation.js.map +1 -1
  26. package/lib/_chunks-es/runtime.js +1 -1
  27. package/lib/_chunks-es/runtime.js.map +1 -1
  28. package/lib/_chunks-es/schemaStoreOutStrings.js +1 -1
  29. package/lib/_chunks-es/schemaStoreOutStrings.js.map +1 -1
  30. package/lib/_chunks-es/uniqueProjectIdDataset.js +1 -1
  31. package/lib/_chunks-es/uniqueProjectIdDataset.js.map +1 -1
  32. package/lib/_chunks-es/version.js +1 -1
  33. package/lib/_internal/cli/threads/extractManifest.cjs +3 -3
  34. package/lib/_internal/cli/threads/extractManifest.cjs.map +1 -1
  35. package/lib/_internal/cli/threads/getGraphQLAPIs.cjs +3 -3
  36. package/lib/_internal/cli/threads/getGraphQLAPIs.cjs.map +1 -1
  37. package/lib/index.d.ts +2 -3
  38. package/lib/index.js +78 -121
  39. package/lib/index.js.map +1 -1
  40. package/lib/router.js +1 -8
  41. package/lib/router.js.map +1 -1
  42. package/package.json +35 -36
package/lib/index.js CHANGED
@@ -2,13 +2,13 @@ import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
2
  import { c } from "react/compiler-runtime";
3
3
  import * as PathUtils from "@sanity/util/paths";
4
4
  import { toString, FOCUS_TERMINATOR, startsWith, isEqual as isEqual$3, pathFor, get as get$1, trimLeft, fromString, trimChildPath as trimChildPath$1 } from "@sanity/util/paths";
5
- import React, { forwardRef, useRef, useState, useId, useCallback, useMemo, useImperativeHandle, useEffect, isValidElement, Fragment, cloneElement, memo, useContext, useSyncExternalStore, Suspense, useReducer, startTransition, Component, useLayoutEffect, createContext, useDebugValue, PureComponent, Children, useTransition, useInsertionEffect, lazy, useDeferredValue, version, StrictMode } from "react";
5
+ import React, { forwardRef, useRef, useState, useId, useCallback, useMemo, useImperativeHandle, useEffect, isValidElement, Fragment, cloneElement, memo, useContext, useSyncExternalStore, Suspense, useReducer, startTransition, Component, useLayoutEffect, createContext, useDebugValue, PureComponent, Children, useTransition, useInsertionEffect, lazy, useEffectEvent, useDeferredValue, version, StrictMode } from "react";
6
6
  import deepEquals from "react-fast-compare";
7
7
  import { WorkspacesContext, LocaleContext, MediaLibraryIdsContext, PerspectiveContext, UserColorManagerContext, ResourceCacheContext, EventsContext, WorkspaceContext, DocumentChangeContext, ReviewChangesContext, DiffContext, PresenceContext, FormBuilderContext, ValidationContext, PortableTextMarkersContext, PortableTextMemberItemsContext, ChangeIndicatorTrackerContextStore, ChangeIndicatorTrackerContextGetSnapshot, FormCallbacksContext, ReferenceInputOptionsContext, DocumentIdContext, HoveredFieldContext, FieldActionsContext, FormValueContext, ReferenceItemRefContext, GetFormValueContext, EnhancedObjectDialogContext, DocumentFieldActionsContext, SortableItemIdContext, VirtualizerScrollInstanceContext, FullscreenPTEContext, PresenceTrackerContextStore, PresenceTrackerContextGetSnapshot, FormFieldPresenceContext, SourceContext, PortableTextMemberItemElementRefsContext, ScrollContext, AssetLimitUpsellContext, ReleasesUpsellContext, ReleasesMetadataContext, TableContext, SearchContext, SingleDocReleaseEnabledContext, SingleDocReleaseUpsellContext, SingleDocReleaseContext, ActiveWorkspaceMatcherContext, CalendarContext, AppIdCacheContext, CommentsAuthoringPathContext, CommentsIntentContext, CommentInputContext, CommentsContext, CommentsEnabledContext, CommentsOnboardingContext, CommentsSelectedPathContext, CommentsUpsellContext, AddonDatasetContext, SanityCreateConfigContext, ScheduledPublishingEnabledContext, SchedulesContext, SchedulePublishUpsellContext, DocumentActionPropsContext, TasksEnabledContext, IsLastPaneContext, MentionUserContext, TasksNavigationContext, TasksContext, TasksUpsellContext, RouterHistoryContext, ColorSchemeSetValueContext, ColorSchemeValueContext, DocumentLimitUpsellContext, NavbarContext, FreeTrialContext, PackageVersionInfoContext, StudioAnnouncementContext, CopyPasteContext, UserApplicationCacheContext, LiveUserApplicationContext, PreviewCardContext, ZIndexContext, zIndexContextDefaults } from "sanity/_singletons";
8
8
  import { SchedulesContext as SchedulesContext2 } from "sanity/_singletons";
9
9
  import { Badge, Grid, rem, Box, Stack, Card, Spinner, Text as Text$1, Layer, Flex, Skeleton, Heading, Avatar, AvatarStack, Inline, Breadcrumbs, useClickOutsideEvent, Code, useTheme, useGlobalKeyDown, MenuDivider, Menu, useElementRect, Autocomplete, useToast, Button as Button$1, useElementSize, AvatarCounter, TextInput as TextInput$1, Container as Container$2, Checkbox as Checkbox$1, Switch as Switch$1, Select, LayerProvider, ElementQuery, TabList, rgba, useLayer, MenuItem as MenuItem$1, useBoundaryElement, BoundaryElementProvider, usePortal, PortalProvider, Portal, _responsive, useRootTheme, useArrayProp, TextArea, TextSkeleton, useMediaIndex, isHTMLElement, Radio, TabPanel, studioTheme, Label, Dialog as Dialog$1, ThemeColorProvider, DialogProvider, focusLastDescendant, focusFirstDescendant, VirtualList as VirtualList$1, usePrefersDark, ThemeProvider, ToastProvider } from "@sanity/ui";
10
10
  import { useVirtualizer, defaultRangeExtractor, elementScroll } from "@tanstack/react-virtual";
11
- import throttle from "lodash/throttle.js";
11
+ import { throttle, isEqual as isEqual$2, memoize as memoize$1, partition, groupBy, omit, isPlainObject as isPlainObject$1, get, flatten as flatten$1, uniqBy, sample, uniq, orderBy, xor, debounce, keyBy, toLower, compact, words, intersection, union, flow, trim, sortBy, isFinite, pickBy, findIndex as findIndex$1, clone, isObject, isString as isString$1, noop as noop$6, capitalize, deburr, startCase, last as last$1, difference, upperFirst, set as set$1, find, uniqueId, castArray, pick, sortedIndex, values, identity as identity$2, isEmpty as isEmpty$1, range, sum as sum$1, max, escapeRegExp as escapeRegExp$1 } from "lodash-es";
12
12
  import { styled, css, keyframes, useTheme as useTheme$1, createGlobalStyle, ServerStyleSheet } from "styled-components";
13
13
  import { EllipsisHorizontalIcon, ErrorOutlineIcon, CircleIcon, CalendarIcon, UnpublishIcon, PublishIcon, EditIcon, CloseIcon, TrashIcon, AddCircleIcon, TimelineIcon, ChevronRightIcon, DocumentIcon, ImageIcon, ChevronDownIcon, ArrowRightIcon, ArrowDownIcon, RevertIcon, WarningOutlineIcon, InfoOutlineIcon, CheckmarkIcon, AddIcon, HelpCircleIcon, AccessDeniedIcon, ToggleArrowRightIcon, SyncIcon, LaunchIcon, BulbOutlineIcon, UnknownIcon, UploadIcon, DragHandleIcon, SearchIcon, StackCompactIcon, PanelLeftIcon, InsertAboveIcon, InsertBelowIcon, CopyIcon, AddDocumentIcon, ChevronLeftIcon, EarthGlobeIcon, EarthAmericasIcon, LinkIcon, UlistIcon, OlistIcon, CodeIcon, UnderlineIcon, StrikethroughIcon, ItalicIcon, BoldIcon, BlockElementIcon, InlineElementIcon, CollapseIcon, ExpandIcon, ResetIcon, Icon, ChevronUpIcon, DownloadIcon, DocumentsIcon, ReadOnlyIcon, BinaryDocumentIcon, CropIcon, EyeOpenIcon, DotIcon, LockIcon, CheckmarkCircleIcon, PinFilledIcon, PinIcon, RestoreIcon, ClockIcon, CloseCircleIcon, UnarchiveIcon, ArchiveIcon, ArrowUpIcon, ControlsIcon, SpinnerIcon, ArrowLeftIcon, SortIcon, ComposeSparklesIcon, ClipboardIcon, StringIcon, NumberIcon, BlockContentIcon, UndoIcon, UnlinkIcon, LinkRemovedIcon, AddCommentIcon, CommentIcon, SelectIcon, TaskIcon, UserIcon, DesktopIcon, MoonIcon, SunIcon, EyeClosedIcon, DoubleChevronRightIcon, AddUserIcon, CogIcon, BoltIcon, LeaveIcon, UsersIcon, GithubIcon, RefreshIcon, MenuIcon } from "@sanity/icons";
14
14
  import { Button, ErrorBoundary, Tooltip, Popover, MenuItem, MenuButton, TooltipDelayGroupProvider, Dialog, Tab } from "./_chunks-es/TooltipDelayGroupProvider.js";
@@ -24,23 +24,16 @@ import { of, concat, defer, EMPTY as EMPTY$5, map as map$1, defaultIfEmpty, catc
24
24
  import { catchError, tap, switchMap, map, scan, distinctUntilChanged, shareReplay, filter, startWith, mergeMapTo, takeUntil, take as take$1, publishReplay, refCount, withLatestFrom, share, mergeMap, concatMap as concatMap$1, groupBy as groupBy$1, throttleTime, last, mergeAll, toArray as toArray$1, distinct, skip, first, debounceTime, auditTime, switchMapTo, delay, reduce as reduce$1, debounce as debounce$1, finalize as finalize$1, expand as expand$1, mapTo, retry as retry$1, timeout } from "rxjs/operators";
25
25
  import { SANITY_VERSION } from "./_chunks-es/version.js";
26
26
  import { createClient, ClientError } from "@sanity/client";
27
- import isEqual$2 from "lodash/isEqual.js";
28
- import memoize$1 from "lodash/memoize.js";
29
27
  import { useObservable, useObservableEvent } from "react-rx";
30
28
  import { observableCallback } from "observable-callback";
31
29
  import { fromUrl } from "@sanity/bifur-client";
32
30
  import debug$c from "debug";
33
- import startCase from "lodash/startCase.js";
34
31
  import { isValidElementType } from "react-is";
35
- import uniqueId from "lodash/uniqueId.js";
36
32
  import { isHotkey } from "is-hotkey-esm";
37
33
  import FocusLock from "react-focus-lock";
38
34
  import { defineEvent, createSessionId, createBatchedStore } from "@sanity/telemetry";
39
35
  import { nanoid, customAlphabet } from "nanoid";
40
- import { useEffectEvent } from "use-effect-event";
41
- import flatten$1 from "lodash/flatten.js";
42
36
  import { useTelemetry, TelemetryProvider } from "@sanity/telemetry/react";
43
- import last$1 from "lodash/last.js";
44
37
  import { getVersionId, getDraftId, getPublishedId, isPublishedId, isDraftId, getVersionFromId, isVersionId, DRAFTS_FOLDER } from "@sanity/client/csm";
45
38
  import { DRAFTS_FOLDER as DRAFTS_FOLDER2, VERSION_FOLDER, getDraftId as getDraftId2, getPublishedId as getPublishedId2, getVersionFromId as getVersionFromId2, getVersionId as getVersionId2, isDraftId as isDraftId2, isPublishedId as isPublishedId2, isVersionId as isVersionId2 } from "@sanity/client/csm";
46
39
  import * as legacyDateFormat from "@sanity/util/legacyDateFormat";
@@ -53,27 +46,11 @@ import DataLoader from "dataloader";
53
46
  import { getTheme_v2, rgba as rgba$1, parseColor, rgbToHex, screen, multiply, createColorTheme, buildTheme } from "@sanity/ui/theme";
54
47
  import { mergeMapArray } from "rxjs-mergemap-array";
55
48
  import { isVersionId as isVersionId$1, getVersionNameFromId } from "@sanity/id-utils";
56
- import isString$1 from "lodash/isString.js";
57
49
  import { useDevicePixelRatio, getDevicePixelRatio } from "use-device-pixel-ratio";
58
50
  import classNames from "classnames";
59
- import sortBy from "lodash/sortBy.js";
60
- import uniqBy from "lodash/uniqBy.js";
61
- import debounce from "lodash/debounce.js";
62
- import groupBy from "lodash/groupBy.js";
63
- import orderBy from "lodash/orderBy.js";
64
51
  import { DEFAULT_MAX_FIELD_DEPTH, builtinTypes, validateSchema, groupProblems, DescriptorConverter, ALL_FIELDS_GROUP_NAME, isActionEnabled, processSchemaSynchronization } from "@sanity/schema/_internal";
65
- import compact from "lodash/compact.js";
66
- import flow from "lodash/flow.js";
67
- import toLower from "lodash/toLower.js";
68
- import trim from "lodash/trim.js";
69
- import union from "lodash/union.js";
70
- import uniq from "lodash/uniq.js";
71
- import words from "lodash/words.js";
72
52
  import { randomKey as randomKey$1, isDeepEmpty, resolveTypeName as resolveTypeName$2, isShallowEmptyObject } from "@sanity/util/content";
73
- import noop$6 from "lodash/noop.js";
74
53
  import shallowEquals from "shallow-equals";
75
- import isPlainObject$1 from "lodash/isPlainObject.js";
76
- import capitalize from "lodash/capitalize.js";
77
54
  import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from "@dnd-kit/core";
78
55
  import { restrictToHorizontalAxis, restrictToVerticalAxis } from "@dnd-kit/modifiers";
79
56
  import { sortableKeyboardCoordinates, useSortable, SortableContext, horizontalListSortingStrategy, verticalListSortingStrategy } from "@dnd-kit/sortable";
@@ -86,30 +63,17 @@ import { defineBehavior, raise, forward } from "@portabletext/editor/behaviors";
86
63
  import { OneLinePlugin } from "@portabletext/plugin-one-line";
87
64
  import { cleanupEfficiency, makeDiff, DIFF_INSERT, DIFF_DELETE, DIFF_EQUAL, applyPatches, parsePatch, makePatches } from "@sanity/diff-match-patch";
88
65
  import { isPortableTextBlock, toPlainText } from "@portabletext/toolkit";
89
- import keyBy from "lodash/keyBy.js";
90
66
  import QuickLRU from "quick-lru";
91
- import get from "lodash/get.js";
92
- import pick from "lodash/pick.js";
93
- import omit from "lodash/omit.js";
94
67
  import { Mutation, BufferedDocument, extractWithPath, arrayToJSONMatchPath } from "@sanity/mutator";
95
- import intersection from "lodash/intersection.js";
96
- import isEmpty$1 from "lodash/isEmpty.js";
97
68
  import { createInstance } from "i18next";
98
69
  import scrollIntoView$1 from "scroll-into-view-if-needed";
99
- import difference from "lodash/difference.js";
100
70
  import { IntentLink, useRouter, RouterContext, useIntentLink, route, encodeJsonParams, useRouterState, useStateLink, Link as Link$3, StateLink, RouteScope, STICKY_PARAMS, RouterProvider } from "sanity/router";
101
- import partition from "lodash/partition.js";
102
- import range from "lodash/range.js";
103
71
  import { useSyncExternalStore as useSyncExternalStore$1 } from "use-sync-external-store/shim/index.js";
104
72
  import { uuid } from "@sanity/uuid";
105
73
  import { motion, AnimatePresence } from "motion/react";
106
74
  import { diffInput, wrap as wrap$1 } from "@sanity/diff";
107
- import castArray from "lodash/castArray.js";
108
75
  import { ConfirmPopover, MenuGroup } from "./_chunks-es/MenuGroup.js";
109
- import deburr from "lodash/deburr.js";
110
76
  import { normalizeBlock } from "@portabletext/block-tools";
111
- import sample from "lodash/sample.js";
112
- import isFinite from "lodash/isFinite.js";
113
77
  import { generateHelpUrl } from "./_chunks-es/generate-help-url.esm.js";
114
78
  import { registerLanguage } from "react-refractor";
115
79
  import bash from "refractor/bash";
@@ -120,17 +84,13 @@ import typescript from "refractor/typescript";
120
84
  import { makeFetchTransport, inboundFiltersIntegration, functionToStringIntegration, browserApiErrorsIntegration, breadcrumbsIntegration, globalHandlersIntegration, linkedErrorsIntegration, dedupeIntegration, httpContextIntegration, isInitialized, getClient, getCurrentScope, BrowserClient, defaultStackParser, Scope, init, withScope, captureException } from "@sentry/react";
121
85
  import { createMemoryHistory, createBrowserHistory } from "history";
122
86
  import { useSyncExternalStoreWithSelector } from "use-sync-external-store/with-selector";
123
- import escapeRegExp$1 from "lodash/escapeRegExp.js";
124
87
  import { SanityLogo, SanityMonogram } from "@sanity/logos";
125
88
  import DOMPurify from "isomorphic-dompurify";
126
89
  import { renderToString, renderToStaticMarkup } from "react-dom/server";
127
90
  import { darken, lighten, readableColor, hasBadContrast } from "color2k";
128
91
  import semver, { satisfies } from "semver";
129
92
  import { useHotModuleReload } from "use-hot-module-reload";
130
- import isObject from "lodash/isObject.js";
131
93
  import arrify from "arrify";
132
- import upperFirst from "lodash/upperFirst.js";
133
- import pickBy from "lodash/pickBy.js";
134
94
  import { parse as parse$1, evaluate } from "groq-js";
135
95
  import { InsertMenu as InsertMenu$2 } from "@sanity/insert-menu";
136
96
  import { applyPatch as applyPatch$1, incremental } from "mendoza";
@@ -138,24 +98,14 @@ import { exhaustMapWithTrailing } from "rxjs-exhaustmap-with-trailing";
138
98
  import { reduce } from "json-reduce";
139
99
  import { createClientConcurrencyLimiter } from "@sanity/util/client";
140
100
  import { ConcurrencyLimiter } from "@sanity/util/concurrency-limiter";
141
- import findIndex$1 from "lodash/findIndex.js";
142
101
  import TTLCache from "@isaacs/ttlcache";
143
- import set$1 from "lodash/set.js";
144
102
  import { MarkdownShortcutsPlugin } from "@portabletext/plugin-markdown-shortcuts";
145
103
  import { createDecoratorGuard, TypographyPlugin } from "@portabletext/plugin-typography";
146
- import find from "lodash/find.js";
147
104
  import exif from "exif-component";
148
- import clone from "lodash/clone.js";
149
105
  import speakingurl from "speakingurl";
150
- import sortedIndex from "lodash/sortedIndex.js";
151
- import identity$2 from "lodash/identity.js";
152
- import values from "lodash/values.js";
153
106
  import { createNode } from "@sanity/comlink";
154
107
  import raf from "raf";
155
- import xor from "lodash/xor.js";
156
108
  import { diffItem } from "@sanity/diff-patch";
157
- import max from "lodash/max.js";
158
- import sum$1 from "lodash/sum.js";
159
109
  import { createRoot } from "react-dom/client";
160
110
  import { getLuminance, parseToRgb, rgb, mix } from "polished";
161
111
  function BetaBadge(props2) {
@@ -22161,7 +22111,7 @@ const Overlay$2 = styled(Layer)`
22161
22111
  function uploadTarget$1(Component2) {
22162
22112
  const FileTarget2 = fileTarget(Component2);
22163
22113
  return forwardRef(function(props2, forwardedRef) {
22164
- const $ = c(65);
22114
+ const $ = c(68);
22165
22115
  let children, isReadOnly, onSelectFile, onSetHoveringFiles, pasteTarget, rest, toneFromProps, types;
22166
22116
  $[0] !== props2 ? ({
22167
22117
  children,
@@ -22182,109 +22132,116 @@ function uploadTarget$1(Component2) {
22182
22132
  $[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = [], $[9] = t0) : t0 = $[9];
22183
22133
  const [filesToUpload, setFilesToUpload] = useState(t0), [showAssetSourceDestinationPicker, setShowAssetSourceDestinationPicker] = useState(!1), [tone, setTone] = useState(toneFromProps || (isReadOnly ? "transparent" : "default")), assetSourceDestinationName = useRef(null);
22184
22134
  let t1;
22185
- $[10] !== formBuilder || $[11] !== onSelectFile || $[12] !== pushToast || $[13] !== t || $[14] !== types ? (t1 = (files) => {
22186
- const filesAndAssetSources = getFilesAndAssetSources(files, types, assetSourceDestinationName.current, formBuilder), ready = filesAndAssetSources.filter(_temp$3m), rejected = filesAndAssetSources.filter(_temp2$1o);
22187
- rejected.length > 0 && pushToast({
22135
+ $[10] !== pushToast || $[11] !== t ? (t1 = (rejected) => {
22136
+ pushToast({
22188
22137
  closable: !0,
22189
22138
  status: "warning",
22190
22139
  title: t("inputs.array.error.cannot-upload-unable-to-convert", {
22191
22140
  count: rejected.length
22192
22141
  }),
22193
- description: rejected.map(_temp3$C)
22194
- }), onSelectFile && ready.forEach((entry_1) => {
22142
+ description: rejected.map(_temp$3m)
22143
+ });
22144
+ }, $[10] = pushToast, $[11] = t, $[12] = t1) : t1 = $[12];
22145
+ const alertRejectedFiles = t1;
22146
+ let t2;
22147
+ $[13] !== alertRejectedFiles || $[14] !== formBuilder || $[15] !== onSelectFile || $[16] !== types ? (t2 = (files) => {
22148
+ const filesAndAssetSources = getFilesAndAssetSources(files, types, assetSourceDestinationName.current, formBuilder), ready = filesAndAssetSources.filter(_temp2$1o), rejected_0 = filesAndAssetSources.filter(_temp3$C);
22149
+ rejected_0.length > 0 && alertRejectedFiles(rejected_0), onSelectFile && ready.forEach((entry_1) => {
22195
22150
  onSelectFile({
22196
22151
  assetSource: entry_1.assetSource,
22197
22152
  schemaType: entry_1.schemaType,
22198
22153
  file: entry_1.file
22199
22154
  });
22200
22155
  });
22201
- }, $[10] = formBuilder, $[11] = onSelectFile, $[12] = pushToast, $[13] = t, $[14] = types, $[15] = t1) : t1 = $[15];
22202
- const handleUploadFiles = t1;
22203
- let t2;
22204
- $[16] !== formBuilder || $[17] !== handleUploadFiles || $[18] !== isReadOnly || $[19] !== types ? (t2 = (files_0) => {
22156
+ }, $[13] = alertRejectedFiles, $[14] = formBuilder, $[15] = onSelectFile, $[16] = types, $[17] = t2) : t2 = $[17];
22157
+ const handleUploadFiles = t2;
22158
+ let t3;
22159
+ $[18] !== alertRejectedFiles || $[19] !== formBuilder || $[20] !== handleUploadFiles || $[21] !== isReadOnly || $[22] !== types ? (t3 = (files_0) => {
22205
22160
  if (isReadOnly || types.length === 0)
22206
22161
  return;
22207
- const ready_0 = getFilesAndAssetSources(files_0, types, assetSourceDestinationName.current, formBuilder).filter(_temp4$h);
22208
- if (ready_0.length === 0)
22162
+ const filesAndAssetSources_0 = getFilesAndAssetSources(files_0, types, assetSourceDestinationName.current, formBuilder), ready_0 = filesAndAssetSources_0.filter(_temp4$h);
22163
+ if (ready_0.length === 0) {
22164
+ alertRejectedFiles(filesAndAssetSources_0);
22209
22165
  return;
22166
+ }
22210
22167
  const allAssetSources = types.flatMap((type) => resolveUploadAssetSources?.(type, formBuilder) ?? []);
22211
22168
  if (uniqBy(allAssetSources, "name").length > 1 && !assetSourceDestinationName.current) {
22212
22169
  setShowAssetSourceDestinationPicker(!0), setFilesToUpload(files_0);
22213
22170
  return;
22214
22171
  }
22215
22172
  setShowAssetSourceDestinationPicker(!1), setFilesToUpload([]), handleUploadFiles(ready_0.map(_temp5$a));
22216
- }, $[16] = formBuilder, $[17] = handleUploadFiles, $[18] = isReadOnly, $[19] = types, $[20] = t2) : t2 = $[20];
22217
- const handleFiles = t2;
22218
- let t3;
22219
- $[21] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t3 = [], $[21] = t3) : t3 = $[21];
22220
- const [hoveringFiles, setHoveringFiles] = useState(t3);
22173
+ }, $[18] = alertRejectedFiles, $[19] = formBuilder, $[20] = handleUploadFiles, $[21] = isReadOnly, $[22] = types, $[23] = t3) : t3 = $[23];
22174
+ const handleFiles = t3;
22221
22175
  let t4;
22222
- $[22] !== formBuilder || $[23] !== isReadOnly || $[24] !== onSetHoveringFiles || $[25] !== types ? (t4 = (files_1) => {
22176
+ $[24] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t4 = [], $[24] = t4) : t4 = $[24];
22177
+ const [hoveringFiles, setHoveringFiles] = useState(t4);
22178
+ let t5;
22179
+ $[25] !== formBuilder || $[26] !== isReadOnly || $[27] !== onSetHoveringFiles || $[28] !== types ? (t5 = (files_1) => {
22223
22180
  if (isReadOnly)
22224
22181
  return;
22225
22182
  setHoveringFiles(files_1);
22226
22183
  const acceptedFiles = files_1.filter((file) => types.some((type_0) => resolveUploadAssetSources(type_0, formBuilder, file).length > 0));
22227
22184
  files_1.length - acceptedFiles.length > 0 ? setTone("critical") : acceptedFiles.length > 0 ? setTone("primary") : setTone("default"), onSetHoveringFiles && onSetHoveringFiles(files_1);
22228
- }, $[22] = formBuilder, $[23] = isReadOnly, $[24] = onSetHoveringFiles, $[25] = types, $[26] = t4) : t4 = $[26];
22229
- const handleFilesOver = t4;
22230
- let t5;
22231
- $[27] !== isReadOnly || $[28] !== onSetHoveringFiles ? (t5 = () => {
22232
- isReadOnly || (setHoveringFiles([]), setTone("default"), onSetHoveringFiles && onSetHoveringFiles([]), setFilesToUpload([]));
22233
- }, $[27] = isReadOnly, $[28] = onSetHoveringFiles, $[29] = t5) : t5 = $[29];
22234
- const handleFilesOut = t5;
22185
+ }, $[25] = formBuilder, $[26] = isReadOnly, $[27] = onSetHoveringFiles, $[28] = types, $[29] = t5) : t5 = $[29];
22186
+ const handleFilesOver = t5;
22235
22187
  let t6;
22236
- if ($[30] !== formBuilder || $[31] !== types) {
22237
- let t72;
22238
- $[33] !== formBuilder ? (t72 = (type_1) => resolveUploadAssetSources?.(type_1, formBuilder) ?? [], $[33] = formBuilder, $[34] = t72) : t72 = $[34];
22239
- const allAssetSourcesWithUpload = types.flatMap(t72);
22240
- t6 = uniqBy(allAssetSourcesWithUpload, "name"), $[30] = formBuilder, $[31] = types, $[32] = t6;
22241
- } else
22242
- t6 = $[32];
22243
- const assetSourcesWithUploadByName = t6;
22188
+ $[30] !== isReadOnly || $[31] !== onSetHoveringFiles ? (t6 = () => {
22189
+ isReadOnly || (setHoveringFiles([]), setTone("default"), onSetHoveringFiles && onSetHoveringFiles([]), setFilesToUpload([]));
22190
+ }, $[30] = isReadOnly, $[31] = onSetHoveringFiles, $[32] = t6) : t6 = $[32];
22191
+ const handleFilesOut = t6;
22244
22192
  let t7;
22245
- $[35] !== filesToUpload || $[36] !== handleUploadFiles ? (t7 = (assetSource) => {
22246
- assetSourceDestinationName.current = assetSource?.name ?? null, filesToUpload.length > 0 && assetSource && handleUploadFiles(filesToUpload), setFilesToUpload([]), setShowAssetSourceDestinationPicker(!1), assetSourceDestinationName.current = null;
22247
- }, $[35] = filesToUpload, $[36] = handleUploadFiles, $[37] = t7) : t7 = $[37];
22248
- const handleSetAssetSourceDestination = t7;
22193
+ if ($[33] !== formBuilder || $[34] !== types) {
22194
+ let t82;
22195
+ $[36] !== formBuilder ? (t82 = (type_1) => resolveUploadAssetSources?.(type_1, formBuilder) ?? [], $[36] = formBuilder, $[37] = t82) : t82 = $[37];
22196
+ const allAssetSourcesWithUpload = types.flatMap(t82);
22197
+ t7 = uniqBy(allAssetSourcesWithUpload, "name"), $[33] = formBuilder, $[34] = types, $[35] = t7;
22198
+ } else
22199
+ t7 = $[35];
22200
+ const assetSourcesWithUploadByName = t7;
22249
22201
  let t8;
22250
- $[38] !== handleFilesOver ? (t8 = () => {
22202
+ $[38] !== filesToUpload || $[39] !== handleUploadFiles ? (t8 = (assetSource) => {
22203
+ assetSourceDestinationName.current = assetSource?.name ?? null, filesToUpload.length > 0 && assetSource && handleUploadFiles(filesToUpload), setFilesToUpload([]), setShowAssetSourceDestinationPicker(!1), assetSourceDestinationName.current = null;
22204
+ }, $[38] = filesToUpload, $[39] = handleUploadFiles, $[40] = t8) : t8 = $[40];
22205
+ const handleSetAssetSourceDestination = t8;
22206
+ let t9;
22207
+ $[41] !== handleFilesOver ? (t9 = () => {
22251
22208
  handleFilesOver([]), setFilesToUpload([]), setShowAssetSourceDestinationPicker(!1), assetSourceDestinationName.current = null;
22252
- }, $[38] = handleFilesOver, $[39] = t8) : t8 = $[39];
22253
- const handleUploadDestinationPickerClose = t8, t9 = types.length > 1 ? "array" : types[0].name;
22254
- let t10;
22255
- $[40] !== t || $[41] !== t9 ? (t10 = t("inputs.files.common.placeholder.select-asset-source-upload-destination", {
22256
- context: t9
22257
- }), $[40] = t, $[41] = t9, $[42] = t10) : t10 = $[42];
22258
- const uploadDestinationPickerText = t10;
22209
+ }, $[41] = handleFilesOver, $[42] = t9) : t9 = $[42];
22210
+ const handleUploadDestinationPickerClose = t9, t10 = types.length > 1 ? "array" : types[0].name;
22259
22211
  let t11;
22260
- $[43] !== assetSourcesWithUploadByName || $[44] !== handleSetAssetSourceDestination || $[45] !== handleUploadDestinationPickerClose || $[46] !== showAssetSourceDestinationPicker || $[47] !== uploadDestinationPickerText ? (t11 = showAssetSourceDestinationPicker && /* @__PURE__ */ jsx(UploadDestinationPicker, { assetSources: assetSourcesWithUploadByName, onSelectAssetSource: handleSetAssetSourceDestination, onClose: handleUploadDestinationPickerClose, text: uploadDestinationPickerText }), $[43] = assetSourcesWithUploadByName, $[44] = handleSetAssetSourceDestination, $[45] = handleUploadDestinationPickerClose, $[46] = showAssetSourceDestinationPicker, $[47] = uploadDestinationPickerText, $[48] = t11) : t11 = $[48];
22261
- const t12 = toneFromProps || tone;
22262
- let t13;
22263
- $[49] !== hoveringFiles || $[50] !== types ? (t13 = hoveringFiles.length > 0 && /* @__PURE__ */ jsx(Overlay$2, { zOffset: 10, children: /* @__PURE__ */ jsx(DropMessage$1, { hoveringFiles, types }) }), $[49] = hoveringFiles, $[50] = types, $[51] = t13) : t13 = $[51];
22212
+ $[43] !== t || $[44] !== t10 ? (t11 = t("inputs.files.common.placeholder.select-asset-source-upload-destination", {
22213
+ context: t10
22214
+ }), $[43] = t, $[44] = t10, $[45] = t11) : t11 = $[45];
22215
+ const uploadDestinationPickerText = t11;
22216
+ let t12;
22217
+ $[46] !== assetSourcesWithUploadByName || $[47] !== handleSetAssetSourceDestination || $[48] !== handleUploadDestinationPickerClose || $[49] !== showAssetSourceDestinationPicker || $[50] !== uploadDestinationPickerText ? (t12 = showAssetSourceDestinationPicker && /* @__PURE__ */ jsx(UploadDestinationPicker, { assetSources: assetSourcesWithUploadByName, onSelectAssetSource: handleSetAssetSourceDestination, onClose: handleUploadDestinationPickerClose, text: uploadDestinationPickerText }), $[46] = assetSourcesWithUploadByName, $[47] = handleSetAssetSourceDestination, $[48] = handleUploadDestinationPickerClose, $[49] = showAssetSourceDestinationPicker, $[50] = uploadDestinationPickerText, $[51] = t12) : t12 = $[51];
22218
+ const t13 = toneFromProps || tone;
22264
22219
  let t14;
22265
- $[52] !== children || $[53] !== forwardedRef || $[54] !== handleFiles || $[55] !== handleFilesOut || $[56] !== handleFilesOver || $[57] !== pasteTarget || $[58] !== rest || $[59] !== t12 || $[60] !== t13 ? (t14 = /* @__PURE__ */ jsxs(FileTarget2, { ...rest, tone: t12, ref: forwardedRef, onFiles: handleFiles, onFilesOver: handleFilesOver, onFilesOut: handleFilesOut, pasteTarget, children: [
22266
- t13,
22267
- children
22268
- ] }), $[52] = children, $[53] = forwardedRef, $[54] = handleFiles, $[55] = handleFilesOut, $[56] = handleFilesOver, $[57] = pasteTarget, $[58] = rest, $[59] = t12, $[60] = t13, $[61] = t14) : t14 = $[61];
22220
+ $[52] !== hoveringFiles || $[53] !== types ? (t14 = hoveringFiles.length > 0 && /* @__PURE__ */ jsx(Overlay$2, { zOffset: 10, children: /* @__PURE__ */ jsx(DropMessage$1, { hoveringFiles, types }) }), $[52] = hoveringFiles, $[53] = types, $[54] = t14) : t14 = $[54];
22269
22221
  let t15;
22270
- return $[62] !== t11 || $[63] !== t14 ? (t15 = /* @__PURE__ */ jsxs(Root$t, { children: [
22271
- t11,
22272
- t14
22273
- ] }), $[62] = t11, $[63] = t14, $[64] = t15) : t15 = $[64], t15;
22222
+ $[55] !== children || $[56] !== forwardedRef || $[57] !== handleFiles || $[58] !== handleFilesOut || $[59] !== handleFilesOver || $[60] !== pasteTarget || $[61] !== rest || $[62] !== t13 || $[63] !== t14 ? (t15 = /* @__PURE__ */ jsxs(FileTarget2, { ...rest, tone: t13, ref: forwardedRef, onFiles: handleFiles, onFilesOver: handleFilesOver, onFilesOut: handleFilesOut, pasteTarget, children: [
22223
+ t14,
22224
+ children
22225
+ ] }), $[55] = children, $[56] = forwardedRef, $[57] = handleFiles, $[58] = handleFilesOut, $[59] = handleFilesOver, $[60] = pasteTarget, $[61] = rest, $[62] = t13, $[63] = t14, $[64] = t15) : t15 = $[64];
22226
+ let t16;
22227
+ return $[65] !== t12 || $[66] !== t15 ? (t16 = /* @__PURE__ */ jsxs(Root$t, { children: [
22228
+ t12,
22229
+ t15
22230
+ ] }), $[65] = t12, $[66] = t15, $[67] = t16) : t16 = $[67], t16;
22274
22231
  });
22275
22232
  }
22276
22233
  function getFilesAndAssetSources(files, types, assetSourceDestinationName, formBuilder) {
22277
- const imageType = types.find((type) => type.name === "image"), imageAssetSource = imageType && resolveUploadAssetSources(imageType, formBuilder).find((source) => !assetSourceDestinationName || source.name === assetSourceDestinationName) || null, fileType = types.find((type) => type.name === "file"), fileAssetSource = fileType && resolveUploadAssetSources(fileType, formBuilder).find((source) => !assetSourceDestinationName || source.name === assetSourceDestinationName) || null;
22234
+ const imageType = types.find((type) => type.name === "image"), fileType = types.find((type) => type.name === "file");
22278
22235
  return files.map((file) => {
22279
- const isImage2 = imageType && file.type.startsWith("image/") && imageAssetSource, acceptedImage = imageType && (!imageType.options.accept || imageType.options.accept?.includes(file.type));
22280
- if (isImage2 && acceptedImage)
22236
+ const imageAssetSource = imageType && resolveUploadAssetSources(imageType, formBuilder, file).find((source) => !assetSourceDestinationName || source.name === assetSourceDestinationName) || null;
22237
+ if (imageType && file.type.startsWith("image/") && imageAssetSource)
22281
22238
  return {
22282
22239
  file,
22283
22240
  schemaType: imageType,
22284
22241
  assetSource: imageAssetSource
22285
22242
  };
22286
- const isFile = fileType && fileAssetSource, acceptedFile = fileType && (!fileType.options.accept || fileType.options.accept?.includes(file.type));
22287
- return isFile && acceptedFile ? {
22243
+ const fileAssetSource = fileType && resolveUploadAssetSources(fileType, formBuilder, file).find((source) => !assetSourceDestinationName || source.name === assetSourceDestinationName) || null;
22244
+ return fileType && fileAssetSource ? {
22288
22245
  file,
22289
22246
  schemaType: fileType,
22290
22247
  assetSource: fileAssetSource
@@ -22295,13 +22252,7 @@ function getFilesAndAssetSources(files, types, assetSourceDestinationName, formB
22295
22252
  };
22296
22253
  });
22297
22254
  }
22298
- function _temp$3m(entry) {
22299
- return entry.assetSource !== null;
22300
- }
22301
- function _temp2$1o(entry_0) {
22302
- return entry_0.assetSource === null;
22303
- }
22304
- function _temp3$C(task, i) {
22255
+ function _temp$3m(task, i) {
22305
22256
  return /* @__PURE__ */ jsxs(Flex, { gap: 2, padding: 2, children: [
22306
22257
  /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text$1, { weight: "medium", children: task.file.name }) }),
22307
22258
  /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text$1, { size: 1, children: [
@@ -22311,6 +22262,12 @@ function _temp3$C(task, i) {
22311
22262
  ] }) })
22312
22263
  ] }, i);
22313
22264
  }
22265
+ function _temp2$1o(entry) {
22266
+ return entry.assetSource !== null;
22267
+ }
22268
+ function _temp3$C(entry_0) {
22269
+ return entry_0.assetSource === null;
22270
+ }
22314
22271
  function _temp4$h(entry_2) {
22315
22272
  return entry_2.assetSource !== null;
22316
22273
  }