sanity-plugin-media 6.1.0 → 6.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
+ import "@sanity/ui/styles.css";
1
2
  import { EditIcon } from "@sanity/icons/Edit";
2
3
  import { ImageIcon } from "@sanity/icons/Image";
3
4
  import { Preview, WithReferringDocuments, definePlugin, useClient, useColorSchemeValue, useDocumentStore, useFormValue, useSchema } from "sanity";
4
5
  import { c } from "react/compiler-runtime";
5
- import { Box, Button, Card, Checkbox, Container, Dialog, Flex, Grid, Inline, Label, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Spinner, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, Tooltip, Tree, TreeItem, rem, studioTheme, useLayer, useMediaIndex, usePortal, useToast } from "@sanity/ui";
6
+ import { Box, Button, Card, Checkbox, Container, Dialog, Flex, Grid, Inline, Label, Portal, PortalProvider, Spinner, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, Tree, TreeItem, rem, studioTheme, useLayer, useMediaIndex, usePortal } from "@sanity/ui";
6
7
  import { createContext, memo, useContext, useEffect, useMemo, useRef, useState } from "react";
7
8
  import { Provider, useDispatch, useSelector, useStore } from "react-redux";
8
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -15,16 +16,18 @@ import { bufferTime, catchError, concatMap, debounceTime, delay, filter, first,
15
16
  import { uuid } from "@sanity/uuid";
16
17
  import pluralize from "pluralize";
17
18
  import { createGlobalStyle, css, styled } from "styled-components";
18
- import { Controller, useForm } from "react-hook-form";
19
+ import { Controller, useForm, useFormState } from "react-hook-form";
19
20
  import * as z from "zod";
20
21
  import { zodResolver } from "@hookform/resolvers/zod";
21
22
  import { DownloadIcon } from "@sanity/icons/Download";
22
23
  import { format } from "date-fns/format";
23
24
  import filesize from "filesize";
24
25
  import { ClipboardIcon } from "@sanity/icons/Clipboard";
26
+ import { Popover } from "@sanity/ui/popover";
25
27
  import copy from "copy-to-clipboard";
26
28
  import { useIntentLink } from "sanity/router";
27
29
  import { FileIcon, defaultStyles } from "react-file-icon";
30
+ import { Tooltip } from "@sanity/ui/tooltip";
28
31
  import { hues, white } from "@sanity/color";
29
32
  import { FolderIcon } from "@sanity/icons/Folder";
30
33
  import { TrashIcon } from "@sanity/icons/Trash";
@@ -37,9 +40,11 @@ import Select, { components } from "react-select";
37
40
  import { GroupedVirtuoso, Virtuoso, VirtuosoGrid } from "react-virtuoso";
38
41
  import { CheckmarkCircleIcon } from "@sanity/icons/CheckmarkCircle";
39
42
  import { WarningFilledIcon } from "@sanity/icons/WarningFilled";
43
+ import { useToast } from "@sanity/ui/toast";
40
44
  import { isHotkey } from "is-hotkey-esm";
41
45
  import { WarningOutlineIcon } from "@sanity/icons/WarningOutline";
42
46
  import { SelectIcon } from "@sanity/icons/Select";
47
+ import { Menu, MenuButton, MenuDivider, MenuGroup, MenuItem } from "@sanity/ui/menu";
43
48
  import { ArrowDownIcon } from "@sanity/icons/ArrowDown";
44
49
  import { ArrowUpIcon } from "@sanity/icons/ArrowUp";
45
50
  import { SearchIcon } from "@sanity/icons/Search";
@@ -1208,7 +1213,10 @@ const UPLOADS_ACTIONS = { uploadComplete: createAction("uploads/uploadComplete",
1208
1213
  return of(assetsActions.listenerUpdateQueueComplete({ assets }));
1209
1214
  })), assetsSortEpic = (action$) => action$.pipe(ofType(assetsActions.insertUploads.type, assetsActions.listenerUpdateQueueComplete.type, assetsActions.updateComplete.type), mergeMap(() => of(assetsActions.sort()))), assetsTagsAddEpic = (action$, state$, { client }) => action$.pipe(filter(ASSETS_ACTIONS.tagsAddRequest.match), withLatestFrom(state$), mergeMap(([action, state]) => {
1210
1215
  let { assets, tag } = action.payload;
1211
- return of(action).pipe(debugThrottle(state.debug.badConnection), mergeMap(() => from((selectAssetsPicked(state)?.filter(filterAssetWithoutTag(tag))).reduce((tx, pickedAsset) => tx.patch(pickedAsset?.asset?._id, patchOperationTagAppend({ tag })), client.transaction()).commit())), mergeMap(() => of(ASSETS_ACTIONS.tagsAddComplete({
1216
+ return of(action).pipe(debugThrottle(state.debug.badConnection), mergeMap(() => {
1217
+ let transaction = (selectAssetsPicked(state)?.filter(filterAssetWithoutTag(tag))).reduce((tx, pickedAsset) => tx.patch(pickedAsset?.asset?._id, patchOperationTagAppend({ tag })), client.transaction());
1218
+ return from(transaction.commit());
1219
+ }), mergeMap(() => of(ASSETS_ACTIONS.tagsAddComplete({
1212
1220
  assets,
1213
1221
  tag
1214
1222
  }))), catchError((error) => of(ASSETS_ACTIONS.tagsAddError({
@@ -1221,10 +1229,13 @@ const UPLOADS_ACTIONS = { uploadComplete: createAction("uploads/uploadComplete",
1221
1229
  }))));
1222
1230
  })), assetsTagsRemoveEpic = (action$, state$, { client }) => action$.pipe(filter(ASSETS_ACTIONS.tagsRemoveRequest.match), withLatestFrom(state$), mergeMap(([action, state]) => {
1223
1231
  let { assets, tag } = action.payload;
1224
- return of(action).pipe(debugThrottle(state.debug.badConnection), mergeMap(() => from(selectAssetsPicked(state).reduce((tx, pickedAsset) => tx.patch(pickedAsset?.asset?._id, patchOperationTagUnset({
1225
- asset: pickedAsset,
1226
- tag
1227
- })), client.transaction()).commit())), mergeMap(() => of(ASSETS_ACTIONS.tagsRemoveComplete({
1232
+ return of(action).pipe(debugThrottle(state.debug.badConnection), mergeMap(() => {
1233
+ let transaction = selectAssetsPicked(state).reduce((tx, pickedAsset) => tx.patch(pickedAsset?.asset?._id, patchOperationTagUnset({
1234
+ asset: pickedAsset,
1235
+ tag
1236
+ })), client.transaction());
1237
+ return from(transaction.commit());
1238
+ }), mergeMap(() => of(ASSETS_ACTIONS.tagsRemoveComplete({
1228
1239
  assets,
1229
1240
  tag
1230
1241
  }))), catchError((error) => of(ASSETS_ACTIONS.tagsRemoveError({
@@ -1237,10 +1248,13 @@ const UPLOADS_ACTIONS = { uploadComplete: createAction("uploads/uploadComplete",
1237
1248
  }))));
1238
1249
  })), assetsFolderSetEpic = (action$, state$, { client }) => action$.pipe(filter(assetsActions.folderSetRequest.match), withLatestFrom(state$), mergeMap(([action, state]) => {
1239
1250
  let { assets, closeDialogId, folderId } = action.payload, assetIds = assets.map((asset) => asset.asset._id);
1240
- return of(action).pipe(debugThrottle(state.debug.badConnection), mergeMap(() => from(assets.reduce((tx, asset) => tx.patch(asset.asset._id, patchOperationFolderSet({
1241
- asset,
1242
- folderId
1243
- })), client.transaction()).commit())), mergeMap(() => of(assetsActions.folderSetComplete({
1251
+ return of(action).pipe(debugThrottle(state.debug.badConnection), mergeMap(() => {
1252
+ let transaction = assets.reduce((tx, asset) => tx.patch(asset.asset._id, patchOperationFolderSet({
1253
+ asset,
1254
+ folderId
1255
+ })), client.transaction());
1256
+ return from(transaction.commit());
1257
+ }), mergeMap(() => of(assetsActions.folderSetComplete({
1244
1258
  assetIds,
1245
1259
  closeDialogId,
1246
1260
  folderId
@@ -1540,18 +1554,18 @@ const initialState = {
1540
1554
  path: buildFolderPath(id, byId),
1541
1555
  totalCount: 0
1542
1556
  }));
1543
- }), selectCurrentFolderChildren = createSelector([
1544
- createSelector([
1545
- selectById,
1546
- selectChildrenByParentId,
1547
- selectRootIds,
1548
- selectExactCountByFolderId
1549
- ], (byId, childrenByParentId, rootIds, exactCountByFolderId) => ({
1550
- byId,
1551
- childrenByParentId,
1552
- rootIds,
1553
- exactCountByFolderId
1554
- })),
1557
+ }), selectFoldersIndex = createSelector([
1558
+ selectById,
1559
+ selectChildrenByParentId,
1560
+ selectRootIds,
1561
+ selectExactCountByFolderId
1562
+ ], (byId, childrenByParentId, rootIds, exactCountByFolderId) => ({
1563
+ byId,
1564
+ childrenByParentId,
1565
+ rootIds,
1566
+ exactCountByFolderId
1567
+ })), selectCurrentFolderChildren = createSelector([
1568
+ selectFoldersIndex,
1555
1569
  selectCurrentFolderId,
1556
1570
  selectCurrentFolderUnfiled
1557
1571
  ], ({ byId, childrenByParentId, rootIds, exactCountByFolderId }, currentFolderId, currentFolderUnfiled) => {
@@ -1831,7 +1845,7 @@ const imageDprUrl = (asset, options) => {
1831
1845
  return urlParams.append("fit", "max"), urlParams.append("w", imgW.toString()), imgH && urlParams.append("h", imgH.toString()), `${asset.url}?${urlParams.toString()}`;
1832
1846
  }, sanitizeFormData = (formData) => Object.keys(formData).reduce((acc, key) => {
1833
1847
  let val = formData[key];
1834
- return typeof val == "object" && val && val.constructor !== Array ? acc[key] = sanitizeFormData(val) : val === "" || val === void 0 || val?.length === 0 ? acc[key] = null : typeof val == "string" && val ? acc[key] = formData[key].trim() : acc[key] = formData[key], acc;
1848
+ return acc[key] = typeof val == "object" && val && val.constructor !== Array ? sanitizeFormData(val) : val === "" || val === void 0 || val?.length === 0 ? null : typeof val == "string" && val ? formData[key].trim() : formData[key], acc;
1835
1849
  }, {}), isFileAsset = (asset) => asset._type === "sanity.fileAsset", isImageAsset = (asset) => asset._type === "sanity.imageAsset";
1836
1850
  /**
1837
1851
  * `@hookform/resolvers/zod` resolves its own `zod` typings through dependency
@@ -1955,7 +1969,7 @@ const ButtonAssetCopy = (t0) => {
1955
1969
  }), $[13] = asset, $[14] = t8);
1956
1970
  let t9;
1957
1971
  $[15] !== t3 || $[16] !== t5 || $[17] !== t7 || $[18] !== t8 ? (t9 = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, {
1958
- space: 3,
1972
+ gap: 3,
1959
1973
  children: [
1960
1974
  t3,
1961
1975
  t5,
@@ -1972,7 +1986,7 @@ const ButtonAssetCopy = (t0) => {
1972
1986
  width: "100%"
1973
1987
  }
1974
1988
  }), /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, {
1975
- space: 3,
1989
+ gap: 3,
1976
1990
  children: [
1977
1991
  exif.ISO && /* @__PURE__ */ jsx(Row, {
1978
1992
  label: "ISO",
@@ -2014,7 +2028,7 @@ const ButtonAssetCopy = (t0) => {
2014
2028
  $[28] !== t12 || $[29] !== t14 ? (t15 = /* @__PURE__ */ jsx(Box, {
2015
2029
  marginTop: 5,
2016
2030
  children: /* @__PURE__ */ jsxs(Inline, {
2017
- space: 2,
2031
+ gap: 2,
2018
2032
  children: [t12, t14]
2019
2033
  })
2020
2034
  }), $[28] = t12, $[29] = t14, $[30] = t15) : t15 = $[30];
@@ -2066,7 +2080,7 @@ const ButtonAssetCopy = (t0) => {
2066
2080
  radius: 2,
2067
2081
  shadow: 1,
2068
2082
  children: /* @__PURE__ */ jsx(Stack, {
2069
- space: 2,
2083
+ gap: 2,
2070
2084
  children: t1
2071
2085
  })
2072
2086
  }), $[5] = t1, $[6] = t2), t2;
@@ -2244,7 +2258,7 @@ const Image$1 = styled.img.attrs({ crossOrigin: "anonymous" }).withConfig({
2244
2258
  componentId: "sc-xak9t2-0"
2245
2259
  })`--checkerboard-color:${(props) => props.$scheme ? getSchemeColor(props.$scheme, "bg2") : "inherit"};display:block;width:100%;height:100%;object-fit:contain;${(props) => props.$showCheckerboard && css`background-image:linear-gradient(45deg,var(--checkerboard-color) 25%,transparent 25%),linear-gradient(-45deg,var(--checkerboard-color) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--checkerboard-color) 75%),linear-gradient(-45deg,transparent 75%,var(--checkerboard-color) 75%);background-size:20px 20px;background-position:0 0,0 10px,10px -10px,-10px 0;`}`, StyledErrorOutlineIcon = /* @__PURE__ */ styled(ErrorOutlineIcon).withConfig({
2246
2260
  displayName: "StyledErrorOutlineIcon",
2247
- componentId: "sc-g4wo97-0"
2261
+ componentId: "sc-5i8ed3-0"
2248
2262
  })(({ theme }) => ({ color: theme.sanity.color.spot.red })), FormFieldInputLabel = (props) => {
2249
2263
  let $ = c(14), { description, error, label, name } = props, t0;
2250
2264
  $[0] !== label || $[1] !== name ? (t0 = /* @__PURE__ */ jsx(Text, {
@@ -2277,7 +2291,7 @@ const Image$1 = styled.img.attrs({ crossOrigin: "anonymous" }).withConfig({
2277
2291
  $[5] !== t0 || $[6] !== t1 ? (t2 = /* @__PURE__ */ jsx(Box, {
2278
2292
  marginY: 3,
2279
2293
  children: /* @__PURE__ */ jsxs(Inline, {
2280
- space: 2,
2294
+ gap: 2,
2281
2295
  children: [t0, t1]
2282
2296
  })
2283
2297
  }), $[5] = t0, $[6] = t1, $[7] = t2) : t2 = $[7];
@@ -2515,17 +2529,17 @@ function _temp3$10() {
2515
2529
  return "No tags";
2516
2530
  }
2517
2531
  const FormFieldInputText = (props) => {
2518
- let $ = c(25), description, disabled, error, label, name, placeholder, ref, rest, value;
2519
- $[0] === props ? (description = $[1], disabled = $[2], error = $[3], label = $[4], name = $[5], placeholder = $[6], ref = $[7], rest = $[8], value = $[9]) : ({description, disabled, error, label, name, placeholder, value, ref, ...rest} = props, $[0] = props, $[1] = description, $[2] = disabled, $[3] = error, $[4] = label, $[5] = name, $[6] = placeholder, $[7] = ref, $[8] = rest, $[9] = value);
2532
+ let $ = c(29), description, disabled, error, label, name, onBlur, onChange, placeholder, ref, rest, value;
2533
+ $[0] === props ? (description = $[1], disabled = $[2], error = $[3], label = $[4], name = $[5], onBlur = $[6], onChange = $[7], placeholder = $[8], ref = $[9], rest = $[10], value = $[11]) : ({description, disabled, error, label, name, onBlur, onChange, placeholder, value, ref, ...rest} = props, $[0] = props, $[1] = description, $[2] = disabled, $[3] = error, $[4] = label, $[5] = name, $[6] = onBlur, $[7] = onChange, $[8] = placeholder, $[9] = ref, $[10] = rest, $[11] = value);
2520
2534
  let t0;
2521
- $[10] !== description || $[11] !== error || $[12] !== label || $[13] !== name ? (t0 = /* @__PURE__ */ jsx(FormFieldInputLabel, {
2535
+ $[12] !== description || $[13] !== error || $[14] !== label || $[15] !== name ? (t0 = /* @__PURE__ */ jsx(FormFieldInputLabel, {
2522
2536
  description,
2523
2537
  error,
2524
2538
  label,
2525
2539
  name
2526
- }), $[10] = description, $[11] = error, $[12] = label, $[13] = name, $[14] = t0) : t0 = $[14];
2540
+ }), $[12] = description, $[13] = error, $[14] = label, $[15] = name, $[16] = t0) : t0 = $[16];
2527
2541
  let t1;
2528
- $[15] !== disabled || $[16] !== name || $[17] !== placeholder || $[18] !== ref || $[19] !== rest || $[20] !== value ? (t1 = /* @__PURE__ */ jsx(TextInput, {
2542
+ $[17] !== disabled || $[18] !== name || $[19] !== onBlur || $[20] !== onChange || $[21] !== placeholder || $[22] !== ref || $[23] !== rest || $[24] !== value ? (t1 = /* @__PURE__ */ jsx(TextInput, {
2529
2543
  ...rest,
2530
2544
  autoComplete: "off",
2531
2545
  autoFocus: !0,
@@ -2533,35 +2547,39 @@ const FormFieldInputText = (props) => {
2533
2547
  disabled,
2534
2548
  id: name,
2535
2549
  name,
2550
+ onBlur,
2551
+ onChange,
2536
2552
  placeholder,
2537
2553
  ref
2538
- }), $[15] = disabled, $[16] = name, $[17] = placeholder, $[18] = ref, $[19] = rest, $[20] = value, $[21] = t1) : t1 = $[21];
2554
+ }), $[17] = disabled, $[18] = name, $[19] = onBlur, $[20] = onChange, $[21] = placeholder, $[22] = ref, $[23] = rest, $[24] = value, $[25] = t1) : t1 = $[25];
2539
2555
  let t2;
2540
- return $[22] !== t0 || $[23] !== t1 ? (t2 = /* @__PURE__ */ jsxs(Box, { children: [t0, t1] }), $[22] = t0, $[23] = t1, $[24] = t2) : t2 = $[24], t2;
2556
+ return $[26] !== t0 || $[27] !== t1 ? (t2 = /* @__PURE__ */ jsxs(Box, { children: [t0, t1] }), $[26] = t0, $[27] = t1, $[28] = t2) : t2 = $[28], t2;
2541
2557
  }, FormFieldInputTextarea = (props) => {
2542
- let $ = c(27), description, disabled, error, label, name, placeholder, ref, rest, rows, value;
2543
- $[0] === props ? (description = $[1], disabled = $[2], error = $[3], label = $[4], name = $[5], placeholder = $[6], ref = $[7], rest = $[8], rows = $[9], value = $[10]) : ({description, disabled, error, label, name, placeholder, rows, value, ref, ...rest} = props, $[0] = props, $[1] = description, $[2] = disabled, $[3] = error, $[4] = label, $[5] = name, $[6] = placeholder, $[7] = ref, $[8] = rest, $[9] = rows, $[10] = value);
2558
+ let $ = c(31), description, disabled, error, label, name, onBlur, onChange, placeholder, ref, rest, rows, value;
2559
+ $[0] === props ? (description = $[1], disabled = $[2], error = $[3], label = $[4], name = $[5], onBlur = $[6], onChange = $[7], placeholder = $[8], ref = $[9], rest = $[10], rows = $[11], value = $[12]) : ({description, disabled, error, label, name, onBlur, onChange, placeholder, rows, value, ref, ...rest} = props, $[0] = props, $[1] = description, $[2] = disabled, $[3] = error, $[4] = label, $[5] = name, $[6] = onBlur, $[7] = onChange, $[8] = placeholder, $[9] = ref, $[10] = rest, $[11] = rows, $[12] = value);
2544
2560
  let t0;
2545
- $[11] !== description || $[12] !== error || $[13] !== label || $[14] !== name ? (t0 = /* @__PURE__ */ jsx(FormFieldInputLabel, {
2561
+ $[13] !== description || $[14] !== error || $[15] !== label || $[16] !== name ? (t0 = /* @__PURE__ */ jsx(FormFieldInputLabel, {
2546
2562
  description,
2547
2563
  error,
2548
2564
  label,
2549
2565
  name
2550
- }), $[11] = description, $[12] = error, $[13] = label, $[14] = name, $[15] = t0) : t0 = $[15];
2566
+ }), $[13] = description, $[14] = error, $[15] = label, $[16] = name, $[17] = t0) : t0 = $[17];
2551
2567
  let t1;
2552
- $[16] !== disabled || $[17] !== name || $[18] !== placeholder || $[19] !== ref || $[20] !== rest || $[21] !== rows || $[22] !== value ? (t1 = /* @__PURE__ */ jsx(TextArea, {
2568
+ $[18] !== disabled || $[19] !== name || $[20] !== onBlur || $[21] !== onChange || $[22] !== placeholder || $[23] !== ref || $[24] !== rest || $[25] !== rows || $[26] !== value ? (t1 = /* @__PURE__ */ jsx(TextArea, {
2553
2569
  ...rest,
2554
2570
  autoComplete: "off",
2555
2571
  defaultValue: value,
2556
2572
  disabled,
2557
2573
  id: name,
2558
2574
  name,
2575
+ onBlur,
2576
+ onChange,
2559
2577
  placeholder,
2560
2578
  ref,
2561
2579
  rows
2562
- }), $[16] = disabled, $[17] = name, $[18] = placeholder, $[19] = ref, $[20] = rest, $[21] = rows, $[22] = value, $[23] = t1) : t1 = $[23];
2580
+ }), $[18] = disabled, $[19] = name, $[20] = onBlur, $[21] = onChange, $[22] = placeholder, $[23] = ref, $[24] = rest, $[25] = rows, $[26] = value, $[27] = t1) : t1 = $[27];
2563
2581
  let t2;
2564
- return $[24] !== t0 || $[25] !== t1 ? (t2 = /* @__PURE__ */ jsxs(Box, { children: [t0, t1] }), $[24] = t0, $[25] = t1, $[26] = t2) : t2 = $[26], t2;
2582
+ return $[28] !== t0 || $[29] !== t1 ? (t2 = /* @__PURE__ */ jsxs(Box, { children: [t0, t1] }), $[28] = t0, $[29] = t1, $[30] = t2) : t2 = $[30], t2;
2565
2583
  };
2566
2584
  function toStringField(value) {
2567
2585
  if (typeof value == "string") return value;
@@ -2575,201 +2593,180 @@ function truncateFolderPath(path) {
2575
2593
  ...segments.slice(-2)
2576
2594
  ].join("/");
2577
2595
  }
2578
- function Details(t0) {
2579
- let $ = c(56), { formUpdating, handleCreateTag, control, errors, register, allTagOptions, assetTagOptions, currentAsset, folderPath, folderMissing, onChangeFolder, onRemoveFolder, creditLine, locales } = t0, hasLocales = locales && locales.length > 0, [activeLocaleTab, setActiveLocaleTab] = useState(0), folderId = currentAsset?.opt?.media?.folder?._ref, t1;
2580
- $[0] !== folderMissing || $[1] !== folderPath ? (t1 = truncateFolderPath(folderPath) || (folderMissing ? "Folder no longer exists" : "No folder"), $[0] = folderMissing, $[1] = folderPath, $[2] = t1) : t1 = $[2];
2581
- let folderLabel = t1, t2 = errors?.opt?.media?.tags?.message, t3;
2582
- $[3] !== allTagOptions || $[4] !== assetTagOptions || $[5] !== control || $[6] !== formUpdating || $[7] !== handleCreateTag || $[8] !== t2 ? (t3 = /* @__PURE__ */ jsx(FormFieldInputTags, {
2583
- control,
2584
- disabled: formUpdating,
2585
- error: t2,
2586
- label: "Tags",
2587
- name: "opt.media.tags",
2588
- onCreateTag: handleCreateTag,
2589
- options: allTagOptions,
2590
- placeholder: "Select or create...",
2591
- value: assetTagOptions
2592
- }), $[3] = allTagOptions, $[4] = assetTagOptions, $[5] = control, $[6] = formUpdating, $[7] = handleCreateTag, $[8] = t2, $[9] = t3) : t3 = $[9];
2593
- let t4;
2594
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t4 = /* @__PURE__ */ jsx(FormFieldInputLabel, {
2595
- label: "Folder",
2596
- name: "folder"
2597
- }), $[10] = t4) : t4 = $[10];
2598
- let t5, t6;
2599
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = {
2600
- minWidth: 0,
2601
- overflowX: "auto",
2602
- whiteSpace: "nowrap",
2603
- overflowY: "hidden"
2604
- }, t6 = /* @__PURE__ */ jsx(FolderIcon, {}), $[11] = t5, $[12] = t6) : (t5 = $[11], t6 = $[12]);
2605
- let t7 = !folderId, t8;
2606
- $[13] !== folderLabel || $[14] !== t7 ? (t8 = /* @__PURE__ */ jsxs(Flex, {
2607
- align: "center",
2608
- gap: 2,
2609
- flex: 1,
2610
- style: t5,
2611
- children: [t6, /* @__PURE__ */ jsx(Text, {
2612
- muted: t7,
2613
- size: 1,
2614
- children: folderLabel
2615
- })]
2616
- }), $[13] = folderLabel, $[14] = t7, $[15] = t8) : t8 = $[15];
2617
- let t9;
2618
- $[16] !== folderId || $[17] !== formUpdating || $[18] !== onRemoveFolder ? (t9 = folderId && /* @__PURE__ */ jsx(Button, {
2619
- "aria-label": "Remove from folder",
2620
- disabled: formUpdating,
2621
- fontSize: 1,
2622
- icon: TrashIcon,
2623
- mode: "bleed",
2624
- onClick: onRemoveFolder,
2625
- padding: 2,
2626
- tone: "critical",
2627
- type: "button"
2628
- }), $[16] = folderId, $[17] = formUpdating, $[18] = onRemoveFolder, $[19] = t9) : t9 = $[19];
2629
- let t10 = folderId ? "Change folder" : "Add to folder", t11;
2630
- $[20] !== formUpdating || $[21] !== onChangeFolder || $[22] !== t10 ? (t11 = /* @__PURE__ */ jsx(Button, {
2631
- padding: 2,
2632
- disabled: formUpdating,
2633
- fontSize: 1,
2634
- mode: "ghost",
2635
- onClick: onChangeFolder,
2636
- text: t10,
2637
- type: "button"
2638
- }), $[20] = formUpdating, $[21] = onChangeFolder, $[22] = t10, $[23] = t11) : t11 = $[23];
2639
- let t12;
2640
- $[24] !== t11 || $[25] !== t8 || $[26] !== t9 ? (t12 = /* @__PURE__ */ jsxs(Box, { children: [t4, /* @__PURE__ */ jsx(Card, {
2641
- border: !0,
2642
- padding: 2,
2643
- radius: 2,
2644
- children: /* @__PURE__ */ jsxs(Flex, {
2645
- align: "center",
2646
- gap: 3,
2647
- justify: "space-between",
2648
- children: [
2649
- t8,
2650
- t9,
2651
- t11
2652
- ]
2653
- })
2654
- })] }), $[24] = t11, $[25] = t8, $[26] = t9, $[27] = t12) : t12 = $[27];
2655
- let t13;
2656
- $[28] === register ? t13 = $[29] : (t13 = register("originalFilename"), $[28] = register, $[29] = t13);
2657
- let t14 = errors?.originalFilename?.message, t15 = currentAsset?.originalFilename, t16;
2658
- $[30] !== formUpdating || $[31] !== t13 || $[32] !== t14 || $[33] !== t15 ? (t16 = /* @__PURE__ */ jsx(FormFieldInputText, {
2659
- ...t13,
2660
- disabled: formUpdating,
2661
- error: t14,
2662
- label: "Filename",
2663
- name: "originalFilename",
2664
- value: t15
2665
- }), $[30] = formUpdating, $[31] = t13, $[32] = t14, $[33] = t15, $[34] = t16) : t16 = $[34];
2666
- let t17;
2667
- $[35] !== activeLocaleTab || $[36] !== creditLine?.enabled || $[37] !== creditLine?.excludeSources || $[38] !== currentAsset?.altText || $[39] !== currentAsset?.creditLine || $[40] !== currentAsset?.source?.name || $[41] !== currentAsset?.title || $[42] !== errors?.altText || $[43] !== errors?.creditLine || $[44] !== errors?.description || $[45] !== errors?.title || $[46] !== formUpdating || $[47] !== hasLocales || $[48] !== locales || $[49] !== register ? (t17 = hasLocales ? /* @__PURE__ */ jsx(Card, {
2668
- marginTop: 2,
2669
- shadow: 1,
2670
- padding: 3,
2671
- radius: 1,
2672
- children: /* @__PURE__ */ jsxs(Stack, {
2673
- space: 2,
2674
- children: [/* @__PURE__ */ jsx(TabList, {
2675
- space: 2,
2676
- children: locales.map((locale, idx) => /* @__PURE__ */ jsx(Tab, {
2677
- id: `locale-tab-${locale.id}`,
2678
- "aria-controls": `locale-panel-${locale.id}`,
2679
- selected: activeLocaleTab === idx,
2680
- onClick: () => setActiveLocaleTab(idx),
2681
- label: locale.title
2682
- }, locale.id))
2683
- }), locales.map((locale_0, idx_0) => /* @__PURE__ */ jsx(TabPanel, {
2684
- id: `locale-panel-${locale_0.id}`,
2685
- "aria-labelledby": `locale-tab-${locale_0.id}`,
2686
- hidden: activeLocaleTab !== idx_0,
2687
- children: /* @__PURE__ */ jsxs(Stack, {
2688
- space: 3,
2596
+ function Details({ formUpdating, handleCreateTag, control, errors, register, allTagOptions, assetTagOptions, currentAsset, folderPath, folderMissing, onChangeFolder, onRemoveFolder, creditLine, locales }) {
2597
+ "use no memo";
2598
+ let hasLocales = locales && locales.length > 0, [activeLocaleTab, setActiveLocaleTab] = useState(0), folderId = currentAsset?.opt?.media?.folder?._ref, folderLabel = truncateFolderPath(folderPath) || (folderMissing ? "Folder no longer exists" : "No folder");
2599
+ return /* @__PURE__ */ jsxs(Stack, {
2600
+ gap: 3,
2601
+ children: [
2602
+ /* @__PURE__ */ jsx(FormFieldInputTags, {
2603
+ control,
2604
+ disabled: formUpdating,
2605
+ error: errors?.opt?.media?.tags?.message,
2606
+ label: "Tags",
2607
+ name: "opt.media.tags",
2608
+ onCreateTag: handleCreateTag,
2609
+ options: allTagOptions,
2610
+ placeholder: "Select or create...",
2611
+ value: assetTagOptions
2612
+ }),
2613
+ /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(FormFieldInputLabel, {
2614
+ label: "Folder",
2615
+ name: "folder"
2616
+ }), /* @__PURE__ */ jsx(Card, {
2617
+ border: !0,
2618
+ padding: 2,
2619
+ radius: 2,
2620
+ children: /* @__PURE__ */ jsxs(Flex, {
2621
+ align: "center",
2622
+ gap: 3,
2623
+ justify: "space-between",
2689
2624
  children: [
2690
- /* @__PURE__ */ jsx(FormFieldInputText, {
2691
- ...register(`title.${locale_0.id}`),
2692
- disabled: formUpdating,
2693
- error: (errors?.title)?.[locale_0.id]?.message,
2694
- label: "Title",
2695
- name: `title.${locale_0.id}`
2625
+ /* @__PURE__ */ jsxs(Flex, {
2626
+ align: "center",
2627
+ gap: 2,
2628
+ flex: 1,
2629
+ style: {
2630
+ minWidth: 0,
2631
+ overflowX: "auto",
2632
+ whiteSpace: "nowrap",
2633
+ overflowY: "hidden"
2634
+ },
2635
+ children: [/* @__PURE__ */ jsx(FolderIcon, {}), /* @__PURE__ */ jsx(Text, {
2636
+ muted: !folderId,
2637
+ size: 1,
2638
+ children: folderLabel
2639
+ })]
2696
2640
  }),
2697
- /* @__PURE__ */ jsx(FormFieldInputText, {
2698
- ...register(`altText.${locale_0.id}`),
2641
+ folderId && /* @__PURE__ */ jsx(Button, {
2642
+ "aria-label": "Remove from folder",
2699
2643
  disabled: formUpdating,
2700
- error: (errors?.altText)?.[locale_0.id]?.message,
2701
- label: "Alt Text",
2702
- name: `altText.${locale_0.id}`
2644
+ fontSize: 1,
2645
+ icon: TrashIcon,
2646
+ mode: "bleed",
2647
+ onClick: onRemoveFolder,
2648
+ padding: 2,
2649
+ tone: "critical",
2650
+ type: "button"
2703
2651
  }),
2704
- /* @__PURE__ */ jsx(FormFieldInputTextarea, {
2705
- ...register(`description.${locale_0.id}`),
2652
+ /* @__PURE__ */ jsx(Button, {
2653
+ padding: 2,
2706
2654
  disabled: formUpdating,
2707
- error: (errors?.description)?.[locale_0.id]?.message,
2708
- label: "Description",
2709
- name: `description.${locale_0.id}`,
2710
- rows: 5
2711
- }),
2712
- creditLine?.enabled && /* @__PURE__ */ jsx(FormFieldInputText, {
2713
- ...register(`creditLine.${locale_0.id}`),
2714
- error: (errors?.creditLine)?.[locale_0.id]?.message,
2715
- label: "Credit",
2716
- name: `creditLine.${locale_0.id}`,
2717
- disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
2655
+ fontSize: 1,
2656
+ mode: "ghost",
2657
+ onClick: onChangeFolder,
2658
+ text: folderId ? "Change folder" : "Add to folder",
2659
+ type: "button"
2718
2660
  })
2719
2661
  ]
2720
2662
  })
2721
- }, locale_0.id))]
2722
- })
2723
- }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2724
- /* @__PURE__ */ jsx(FormFieldInputText, {
2725
- ...register("title"),
2726
- disabled: formUpdating,
2727
- error: errors?.title?.message,
2728
- label: "Title",
2729
- name: "title",
2730
- value: toStringField(currentAsset?.title)
2731
- }),
2732
- /* @__PURE__ */ jsx(FormFieldInputText, {
2733
- ...register("altText"),
2734
- disabled: formUpdating,
2735
- error: errors?.altText?.message,
2736
- label: "Alt Text",
2737
- name: "altText",
2738
- value: toStringField(currentAsset?.altText)
2739
- }),
2740
- /* @__PURE__ */ jsx(FormFieldInputTextarea, {
2741
- ...register("description"),
2742
- disabled: formUpdating,
2743
- error: errors?.description?.message,
2744
- label: "Description",
2745
- name: "description",
2746
- rows: 5
2747
- }),
2748
- creditLine?.enabled && /* @__PURE__ */ jsx(FormFieldInputText, {
2749
- ...register("creditLine"),
2750
- error: errors?.creditLine?.message,
2751
- label: "Credit",
2752
- name: "creditLine",
2753
- value: toStringField(currentAsset?.creditLine),
2754
- disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
2755
- })
2756
- ] }), $[35] = activeLocaleTab, $[36] = creditLine?.enabled, $[37] = creditLine?.excludeSources, $[38] = currentAsset?.altText, $[39] = currentAsset?.creditLine, $[40] = currentAsset?.source?.name, $[41] = currentAsset?.title, $[42] = errors?.altText, $[43] = errors?.creditLine, $[44] = errors?.description, $[45] = errors?.title, $[46] = formUpdating, $[47] = hasLocales, $[48] = locales, $[49] = register, $[50] = t17) : t17 = $[50];
2757
- let t18;
2758
- return $[51] !== t12 || $[52] !== t16 || $[53] !== t17 || $[54] !== t3 ? (t18 = /* @__PURE__ */ jsxs(Stack, {
2759
- space: 3,
2760
- children: [
2761
- t3,
2762
- t12,
2763
- t16,
2764
- t17
2663
+ })] }),
2664
+ /* @__PURE__ */ jsx(FormFieldInputText, {
2665
+ ...register("originalFilename"),
2666
+ disabled: formUpdating,
2667
+ error: errors?.originalFilename?.message,
2668
+ label: "Filename",
2669
+ name: "originalFilename",
2670
+ value: currentAsset?.originalFilename
2671
+ }),
2672
+ hasLocales ? /* @__PURE__ */ jsx(Card, {
2673
+ marginTop: 2,
2674
+ shadow: 1,
2675
+ padding: 3,
2676
+ radius: 1,
2677
+ children: /* @__PURE__ */ jsxs(Stack, {
2678
+ gap: 2,
2679
+ children: [/* @__PURE__ */ jsx(TabList, {
2680
+ gap: 2,
2681
+ children: locales.map((locale, idx) => /* @__PURE__ */ jsx(Tab, {
2682
+ id: `locale-tab-${locale.id}`,
2683
+ "aria-controls": `locale-panel-${locale.id}`,
2684
+ selected: activeLocaleTab === idx,
2685
+ onClick: () => setActiveLocaleTab(idx),
2686
+ label: locale.title
2687
+ }, locale.id))
2688
+ }), locales.map((locale_0, idx_0) => /* @__PURE__ */ jsx(TabPanel, {
2689
+ id: `locale-panel-${locale_0.id}`,
2690
+ "aria-labelledby": `locale-tab-${locale_0.id}`,
2691
+ hidden: activeLocaleTab !== idx_0,
2692
+ children: /* @__PURE__ */ jsxs(Stack, {
2693
+ gap: 3,
2694
+ children: [
2695
+ /* @__PURE__ */ jsx(FormFieldInputText, {
2696
+ ...register(`title.${locale_0.id}`),
2697
+ disabled: formUpdating,
2698
+ error: (errors?.title)?.[locale_0.id]?.message,
2699
+ label: "Title",
2700
+ name: `title.${locale_0.id}`
2701
+ }),
2702
+ /* @__PURE__ */ jsx(FormFieldInputText, {
2703
+ ...register(`altText.${locale_0.id}`),
2704
+ disabled: formUpdating,
2705
+ error: (errors?.altText)?.[locale_0.id]?.message,
2706
+ label: "Alt Text",
2707
+ name: `altText.${locale_0.id}`
2708
+ }),
2709
+ /* @__PURE__ */ jsx(FormFieldInputTextarea, {
2710
+ ...register(`description.${locale_0.id}`),
2711
+ disabled: formUpdating,
2712
+ error: (errors?.description)?.[locale_0.id]?.message,
2713
+ label: "Description",
2714
+ name: `description.${locale_0.id}`,
2715
+ rows: 5
2716
+ }),
2717
+ creditLine?.enabled && /* @__PURE__ */ jsx(FormFieldInputText, {
2718
+ ...register(`creditLine.${locale_0.id}`),
2719
+ error: (errors?.creditLine)?.[locale_0.id]?.message,
2720
+ label: "Credit",
2721
+ name: `creditLine.${locale_0.id}`,
2722
+ disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
2723
+ })
2724
+ ]
2725
+ })
2726
+ }, locale_0.id))]
2727
+ })
2728
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2729
+ /* @__PURE__ */ jsx(FormFieldInputText, {
2730
+ ...register("title"),
2731
+ disabled: formUpdating,
2732
+ error: errors?.title?.message,
2733
+ label: "Title",
2734
+ name: "title",
2735
+ value: toStringField(currentAsset?.title)
2736
+ }),
2737
+ /* @__PURE__ */ jsx(FormFieldInputText, {
2738
+ ...register("altText"),
2739
+ disabled: formUpdating,
2740
+ error: errors?.altText?.message,
2741
+ label: "Alt Text",
2742
+ name: "altText",
2743
+ value: toStringField(currentAsset?.altText)
2744
+ }),
2745
+ /* @__PURE__ */ jsx(FormFieldInputTextarea, {
2746
+ ...register("description"),
2747
+ disabled: formUpdating,
2748
+ error: errors?.description?.message,
2749
+ label: "Description",
2750
+ name: "description",
2751
+ rows: 5
2752
+ }),
2753
+ creditLine?.enabled && /* @__PURE__ */ jsx(FormFieldInputText, {
2754
+ ...register("creditLine"),
2755
+ error: errors?.creditLine?.message,
2756
+ label: "Credit",
2757
+ name: "creditLine",
2758
+ value: toStringField(currentAsset?.creditLine),
2759
+ disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
2760
+ })
2761
+ ] })
2765
2762
  ]
2766
- }), $[51] = t12, $[52] = t16, $[53] = t17, $[54] = t3, $[55] = t18) : t18 = $[55], t18;
2763
+ });
2767
2764
  }
2768
2765
  function renderDefaultDetails(props) {
2769
2766
  return /* @__PURE__ */ jsx(Details, { ...props });
2770
2767
  }
2771
2768
  const DialogAssetEdit = (props) => {
2772
- let $ = c(139), { children, dialog: t0 } = props, { assetId, id, lastCreatedTag, lastRemovedTagIds } = t0, client = useVersionedClient(), scheme = useColorSchemeValue(), documentStore = useDocumentStore(), dispatch = useDispatch(), t1;
2769
+ let $ = c(149), { children, dialog: t0 } = props, { assetId, id, lastCreatedTag, lastRemovedTagIds } = t0, client = useVersionedClient(), scheme = useColorSchemeValue(), documentStore = useDocumentStore(), dispatch = useDispatch(), t1;
2773
2770
  $[0] === assetId ? t1 = $[1] : (t1 = (state) => selectAssetById(state, String(assetId)), $[0] = assetId, $[1] = t1);
2774
2771
  let assetItem = useTypedSelector(t1), tags = useTypedSelector(selectTags), assetUpdatedPrev = useRef(void 0), [assetSnapshot, setAssetSnapshot] = useState(assetItem?.asset), [tabSection, setTabSection] = useState("details"), currentAsset = assetItem ? assetItem?.asset : assetSnapshot, t2;
2775
2772
  $[2] === tags ? t2 = $[3] : (t2 = getTagSelectOptions(tags), $[2] = tags, $[3] = t2);
@@ -2824,45 +2821,47 @@ const DialogAssetEdit = (props) => {
2824
2821
  mode: "onChange",
2825
2822
  resolver: t10
2826
2823
  }, $[18] = t10, $[19] = t9, $[20] = t11) : t11 = $[20];
2827
- let { control, formState: t12, getValues, handleSubmit, register, reset, setValue } = useForm(t11), { errors, isDirty, isValid } = t12, formUpdating = !assetItem || assetItem?.updating, t13;
2828
- $[21] !== dispatch || $[22] !== id ? (t13 = () => {
2824
+ let { control, getValues, handleSubmit, register, reset, setValue } = useForm(t11), t12;
2825
+ $[21] === control ? t12 = $[22] : (t12 = { control }, $[21] = control, $[22] = t12);
2826
+ let { errors, isDirty, isValid } = useFormState(t12), formUpdating = !assetItem || assetItem?.updating, t13;
2827
+ $[23] !== dispatch || $[24] !== id ? (t13 = () => {
2829
2828
  dispatch(dialogActions.remove({ id }));
2830
- }, $[21] = dispatch, $[22] = id, $[23] = t13) : t13 = $[23];
2829
+ }, $[23] = dispatch, $[24] = id, $[25] = t13) : t13 = $[25];
2831
2830
  let handleClose = t13, t14;
2832
- $[24] !== assetItem || $[25] !== dispatch ? (t14 = () => {
2831
+ $[26] !== assetItem || $[27] !== dispatch ? (t14 = () => {
2833
2832
  assetItem?.asset && dispatch(dialogActions.showConfirmDeleteAssets({
2834
2833
  assets: [assetItem],
2835
2834
  closeDialogId: assetItem?.asset._id
2836
2835
  }));
2837
- }, $[24] = assetItem, $[25] = dispatch, $[26] = t14) : t14 = $[26];
2836
+ }, $[26] = assetItem, $[27] = dispatch, $[28] = t14) : t14 = $[28];
2838
2837
  let handleDelete = t14, t15;
2839
- $[27] === Symbol.for("react.memo_cache_sentinel") ? (t15 = (update) => {
2838
+ $[29] === Symbol.for("react.memo_cache_sentinel") ? (t15 = (update) => {
2840
2839
  let { result, transition } = update;
2841
2840
  result && transition === "update" && setAssetSnapshot(result);
2842
- }, $[27] = t15) : t15 = $[27];
2841
+ }, $[29] = t15) : t15 = $[29];
2843
2842
  let handleAssetUpdate = t15, t16;
2844
- $[28] !== currentAsset?._id || $[29] !== dispatch ? (t16 = (tagName) => {
2843
+ $[30] !== currentAsset?._id || $[31] !== dispatch ? (t16 = (tagName) => {
2845
2844
  dispatch(tagsActions.createRequest({
2846
2845
  assetId: currentAsset?._id,
2847
2846
  name: tagName
2848
2847
  }));
2849
- }, $[28] = currentAsset?._id, $[29] = dispatch, $[30] = t16) : t16 = $[30], currentAsset?._id;
2848
+ }, $[30] = currentAsset?._id, $[31] = dispatch, $[32] = t16) : t16 = $[32], currentAsset?._id;
2850
2849
  let handleCreateTag = t16, t17;
2851
- $[31] !== assetItem || $[32] !== currentFolderId || $[33] !== dispatch ? (t17 = () => {
2850
+ $[33] !== assetItem || $[34] !== currentFolderId || $[35] !== dispatch ? (t17 = () => {
2852
2851
  assetItem && dispatch(DIALOG_ACTIONS.showFolderMove({
2853
2852
  assets: [assetItem],
2854
2853
  folderId: currentFolderId
2855
2854
  }));
2856
- }, $[31] = assetItem, $[32] = currentFolderId, $[33] = dispatch, $[34] = t17) : t17 = $[34];
2855
+ }, $[33] = assetItem, $[34] = currentFolderId, $[35] = dispatch, $[36] = t17) : t17 = $[36];
2857
2856
  let handleChangeFolder = t17, t18;
2858
- $[35] !== assetItem || $[36] !== currentFolderId || $[37] !== dispatch ? (t18 = () => {
2857
+ $[37] !== assetItem || $[38] !== currentFolderId || $[39] !== dispatch ? (t18 = () => {
2859
2858
  !assetItem || !currentFolderId || dispatch(assetsActions.folderSetRequest({
2860
2859
  assets: [assetItem],
2861
2860
  folderId: null
2862
2861
  }));
2863
- }, $[35] = assetItem, $[36] = currentFolderId, $[37] = dispatch, $[38] = t18) : t18 = $[38];
2862
+ }, $[37] = assetItem, $[38] = currentFolderId, $[39] = dispatch, $[40] = t18) : t18 = $[40];
2864
2863
  let handleRemoveFolder = t18, t19;
2865
- if ($[39] !== currentAsset || $[40] !== locales) {
2864
+ if ($[41] !== currentAsset || $[42] !== locales) {
2866
2865
  bb0: {
2867
2866
  if (!currentAsset) {
2868
2867
  t19 = !1;
@@ -2885,10 +2884,10 @@ const DialogAssetEdit = (props) => {
2885
2884
  let configuredIds = new Set(locales.map(_temp4$5));
2886
2885
  t19 = fields.some((f_0) => isLocaleObj(f_0) ? Object.keys(f_0).some((k) => !configuredIds.has(k)) : !1);
2887
2886
  }
2888
- $[39] = currentAsset, $[40] = locales, $[41] = t19;
2889
- } else t19 = $[41];
2887
+ $[41] = currentAsset, $[42] = locales, $[43] = t19;
2888
+ } else t19 = $[43];
2890
2889
  let hasOrphanedLocales = t19, t20;
2891
- $[42] !== client || $[43] !== currentAsset || $[44] !== locales ? (t20 = async () => {
2890
+ $[44] !== client || $[45] !== currentAsset || $[46] !== locales ? (t20 = async () => {
2892
2891
  if (!currentAsset) return;
2893
2892
  let cleanField = (field_1) => {
2894
2893
  if (typeof field_1 != "object" || !field_1 || Array.isArray(field_1)) return field_1;
@@ -2904,9 +2903,9 @@ const DialogAssetEdit = (props) => {
2904
2903
  description: cleanField(currentAsset.description),
2905
2904
  ...currentAsset._type === "sanity.imageAsset" && { creditLine: cleanField(currentAsset.creditLine) }
2906
2905
  }).commit();
2907
- }, $[42] = client, $[43] = currentAsset, $[44] = locales, $[45] = t20) : t20 = $[45];
2906
+ }, $[44] = client, $[45] = currentAsset, $[46] = locales, $[47] = t20) : t20 = $[47];
2908
2907
  let handleCleanupLocales = t20, t21;
2909
- $[46] !== assetItem?.asset || $[47] !== dispatch ? (t21 = (formData) => {
2908
+ $[48] !== assetItem?.asset || $[49] !== dispatch ? (t21 = (formData) => {
2910
2909
  if (!assetItem?.asset) return;
2911
2910
  let sanitizedFormData = sanitizeFormData(formData);
2912
2911
  formData.description === "" && (sanitizedFormData.description = ""), dispatch(assetsActions.updateRequest({
@@ -2920,23 +2919,23 @@ const DialogAssetEdit = (props) => {
2920
2919
  } }
2921
2920
  }
2922
2921
  }));
2923
- }, $[46] = assetItem?.asset, $[47] = dispatch, $[48] = t21) : t21 = $[48], assetItem?.asset;
2922
+ }, $[48] = assetItem?.asset, $[49] = dispatch, $[50] = t21) : t21 = $[50], assetItem?.asset;
2924
2923
  let onSubmit = t21, t22;
2925
- $[49] !== assetItem?.asset || $[50] !== client ? (t22 = () => {
2924
+ $[51] !== assetItem?.asset || $[52] !== client ? (t22 = () => {
2926
2925
  if (!assetItem?.asset) return;
2927
2926
  let subscriptionAsset = client.listen(groq`*[_id == $id]`, { id: assetItem?.asset._id }).subscribe(handleAssetUpdate);
2928
2927
  return () => {
2929
2928
  subscriptionAsset?.unsubscribe();
2930
2929
  };
2931
- }, $[49] = assetItem?.asset, $[50] = client, $[51] = t22) : t22 = $[51];
2930
+ }, $[51] = assetItem?.asset, $[52] = client, $[53] = t22) : t22 = $[53];
2932
2931
  let t23 = assetItem?.asset, t24;
2933
- $[52] !== client || $[53] !== t23 ? (t24 = [
2932
+ $[54] !== client || $[55] !== t23 ? (t24 = [
2934
2933
  t23,
2935
2934
  client,
2936
2935
  handleAssetUpdate
2937
- ], $[52] = client, $[53] = t23, $[54] = t24) : t24 = $[54], useEffect(t22, t24);
2936
+ ], $[54] = client, $[55] = t23, $[56] = t24) : t24 = $[56], useEffect(t22, t24);
2938
2937
  let t25, t26;
2939
- $[55] !== getValues || $[56] !== lastCreatedTag || $[57] !== setValue ? (t25 = () => {
2938
+ $[57] !== getValues || $[58] !== lastCreatedTag || $[59] !== setValue ? (t25 = () => {
2940
2939
  if (lastCreatedTag) {
2941
2940
  let updatedTags = (getValues("opt.media.tags") || []).concat([lastCreatedTag]);
2942
2941
  setValue("opt.media.tags", updatedTags, { shouldDirty: !0 });
@@ -2945,9 +2944,9 @@ const DialogAssetEdit = (props) => {
2945
2944
  getValues,
2946
2945
  lastCreatedTag,
2947
2946
  setValue
2948
- ], $[55] = getValues, $[56] = lastCreatedTag, $[57] = setValue, $[58] = t25, $[59] = t26) : (t25 = $[58], t26 = $[59]), useEffect(t25, t26);
2947
+ ], $[57] = getValues, $[58] = lastCreatedTag, $[59] = setValue, $[60] = t25, $[61] = t26) : (t25 = $[60], t26 = $[61]), useEffect(t25, t26);
2949
2948
  let t27, t28;
2950
- $[60] !== getValues || $[61] !== lastRemovedTagIds || $[62] !== setValue ? (t27 = () => {
2949
+ $[62] !== getValues || $[63] !== lastRemovedTagIds || $[64] !== setValue ? (t27 = () => {
2951
2950
  if (lastRemovedTagIds) {
2952
2951
  let updatedTags_0 = (getValues("opt.media.tags") || []).filter((tag_0) => !lastRemovedTagIds.includes(tag_0.value));
2953
2952
  setValue("opt.media.tags", updatedTags_0, { shouldDirty: !0 });
@@ -2956,64 +2955,74 @@ const DialogAssetEdit = (props) => {
2956
2955
  getValues,
2957
2956
  lastRemovedTagIds,
2958
2957
  setValue
2959
- ], $[60] = getValues, $[61] = lastRemovedTagIds, $[62] = setValue, $[63] = t27, $[64] = t28) : (t27 = $[63], t28 = $[64]), useEffect(t27, t28);
2958
+ ], $[62] = getValues, $[63] = lastRemovedTagIds, $[64] = setValue, $[65] = t27, $[66] = t28) : (t27 = $[65], t28 = $[66]), useEffect(t27, t28);
2960
2959
  let t29;
2961
- $[65] !== assetItem?.asset || $[66] !== generateDefaultValues || $[67] !== reset ? (t29 = () => {
2960
+ $[67] !== assetItem?.asset || $[68] !== generateDefaultValues || $[69] !== reset ? (t29 = () => {
2962
2961
  assetUpdatedPrev.current !== assetItem?.asset._updatedAt && reset(generateDefaultValues(assetItem?.asset)), assetUpdatedPrev.current = assetItem?.asset._updatedAt;
2963
- }, $[65] = assetItem?.asset, $[66] = generateDefaultValues, $[67] = reset, $[68] = t29) : t29 = $[68];
2962
+ }, $[67] = assetItem?.asset, $[68] = generateDefaultValues, $[69] = reset, $[70] = t29) : t29 = $[70];
2964
2963
  let t30 = assetItem?.asset, t31;
2965
- $[69] !== generateDefaultValues || $[70] !== reset || $[71] !== t30 ? (t31 = [
2964
+ $[71] !== generateDefaultValues || $[72] !== reset || $[73] !== t30 ? (t31 = [
2966
2965
  t30,
2967
2966
  generateDefaultValues,
2968
2967
  reset
2969
- ], $[69] = generateDefaultValues, $[70] = reset, $[71] = t30, $[72] = t31) : t31 = $[72], useEffect(t29, t31);
2968
+ ], $[71] = generateDefaultValues, $[72] = reset, $[73] = t30, $[74] = t31) : t31 = $[74], useEffect(t29, t31);
2970
2969
  let t32;
2971
- $[73] !== currentAsset?._updatedAt || $[74] !== formUpdating || $[75] !== handleCleanupLocales || $[76] !== handleDelete || $[77] !== handleSubmit || $[78] !== hasOrphanedLocales || $[79] !== isDirty || $[80] !== isValid || $[81] !== onSubmit ? (t32 = () => /* @__PURE__ */ jsx(Box, {
2970
+ $[75] !== handleCleanupLocales || $[76] !== hasOrphanedLocales ? (t32 = hasOrphanedLocales && /* @__PURE__ */ jsx(Card, {
2972
2971
  padding: 3,
2973
- children: /* @__PURE__ */ jsxs(Stack, {
2974
- space: 3,
2975
- children: [hasOrphanedLocales && /* @__PURE__ */ jsx(Card, {
2976
- padding: 3,
2977
- radius: 2,
2978
- shadow: 1,
2979
- tone: "caution",
2980
- children: /* @__PURE__ */ jsxs(Flex, {
2981
- align: "center",
2982
- justify: "space-between",
2983
- gap: 3,
2984
- children: [/* @__PURE__ */ jsx(Text, {
2985
- size: 1,
2986
- children: "This asset has localized fields that are no longer configured. Clean them up to avoid validation errors."
2987
- }), /* @__PURE__ */ jsx(Button, {
2988
- fontSize: 1,
2989
- mode: "ghost",
2990
- onClick: handleCleanupLocales,
2991
- text: "Cleanup localized fields",
2992
- tone: "caution"
2993
- })]
2994
- })
2995
- }), /* @__PURE__ */ jsxs(Flex, {
2996
- justify: "space-between",
2997
- children: [/* @__PURE__ */ jsx(Button, {
2998
- disabled: formUpdating,
2999
- fontSize: 1,
3000
- mode: "bleed",
3001
- onClick: handleDelete,
3002
- text: "Delete",
3003
- tone: "critical"
3004
- }), /* @__PURE__ */ jsx(FormSubmitButton, {
3005
- disabled: formUpdating || !isDirty || !isValid || hasOrphanedLocales,
3006
- isValid,
3007
- lastUpdated: currentAsset?._updatedAt,
3008
- onClick: handleSubmit(onSubmit)
3009
- })]
2972
+ radius: 2,
2973
+ shadow: 1,
2974
+ tone: "caution",
2975
+ children: /* @__PURE__ */ jsxs(Flex, {
2976
+ align: "center",
2977
+ justify: "space-between",
2978
+ gap: 3,
2979
+ children: [/* @__PURE__ */ jsx(Text, {
2980
+ size: 1,
2981
+ children: "This asset has localized fields that are no longer configured. Clean them up to avoid validation errors."
2982
+ }), /* @__PURE__ */ jsx(Button, {
2983
+ fontSize: 1,
2984
+ mode: "ghost",
2985
+ onClick: handleCleanupLocales,
2986
+ text: "Cleanup localized fields",
2987
+ tone: "caution"
3010
2988
  })]
3011
2989
  })
3012
- }), $[73] = currentAsset?._updatedAt, $[74] = formUpdating, $[75] = handleCleanupLocales, $[76] = handleDelete, $[77] = handleSubmit, $[78] = hasOrphanedLocales, $[79] = isDirty, $[80] = isValid, $[81] = onSubmit, $[82] = t32) : t32 = $[82];
3013
- let Footer = t32;
2990
+ }), $[75] = handleCleanupLocales, $[76] = hasOrphanedLocales, $[77] = t32) : t32 = $[77];
2991
+ let t33;
2992
+ $[78] !== formUpdating || $[79] !== handleDelete ? (t33 = /* @__PURE__ */ jsx(Button, {
2993
+ disabled: formUpdating,
2994
+ fontSize: 1,
2995
+ mode: "bleed",
2996
+ onClick: handleDelete,
2997
+ text: "Delete",
2998
+ tone: "critical"
2999
+ }), $[78] = formUpdating, $[79] = handleDelete, $[80] = t33) : t33 = $[80];
3000
+ let t34 = formUpdating || !isDirty || !isValid || hasOrphanedLocales, t35 = currentAsset?._updatedAt, t36;
3001
+ $[81] !== handleSubmit || $[82] !== onSubmit ? (t36 = handleSubmit(onSubmit), $[81] = handleSubmit, $[82] = onSubmit, $[83] = t36) : t36 = $[83];
3002
+ let t37;
3003
+ $[84] !== isValid || $[85] !== t34 || $[86] !== t35 || $[87] !== t36 ? (t37 = /* @__PURE__ */ jsx(FormSubmitButton, {
3004
+ disabled: t34,
3005
+ isValid,
3006
+ lastUpdated: t35,
3007
+ onClick: t36
3008
+ }), $[84] = isValid, $[85] = t34, $[86] = t35, $[87] = t36, $[88] = t37) : t37 = $[88];
3009
+ let t38;
3010
+ $[89] !== t33 || $[90] !== t37 ? (t38 = /* @__PURE__ */ jsxs(Flex, {
3011
+ justify: "space-between",
3012
+ children: [t33, t37]
3013
+ }), $[89] = t33, $[90] = t37, $[91] = t38) : t38 = $[91];
3014
+ let t39;
3015
+ $[92] !== t32 || $[93] !== t38 ? (t39 = /* @__PURE__ */ jsx(Box, {
3016
+ padding: 3,
3017
+ children: /* @__PURE__ */ jsxs(Stack, {
3018
+ gap: 3,
3019
+ children: [t32, t38]
3020
+ })
3021
+ }), $[92] = t32, $[93] = t38, $[94] = t39) : t39 = $[94];
3022
+ let footer = t39;
3014
3023
  if (!currentAsset) return null;
3015
- let t33 = !!currentFolderId && !currentFolderPath, t34;
3016
- $[83] !== allTagOptions || $[84] !== assetTagOptions || $[85] !== control || $[86] !== creditLine || $[87] !== currentAsset || $[88] !== currentFolderPath || $[89] !== errors || $[90] !== formUpdating || $[91] !== handleChangeFolder || $[92] !== handleCreateTag || $[93] !== handleRemoveFolder || $[94] !== locales || $[95] !== register || $[96] !== setValue || $[97] !== t33 ? (t34 = {
3024
+ let t40 = !!currentFolderId && !currentFolderPath, t41;
3025
+ $[95] !== allTagOptions || $[96] !== assetTagOptions || $[97] !== control || $[98] !== creditLine || $[99] !== currentAsset || $[100] !== currentFolderPath || $[101] !== errors || $[102] !== formUpdating || $[103] !== handleChangeFolder || $[104] !== handleCreateTag || $[105] !== handleRemoveFolder || $[106] !== locales || $[107] !== register || $[108] !== setValue || $[109] !== t40 ? (t41 = {
3017
3026
  control,
3018
3027
  errors,
3019
3028
  formUpdating,
@@ -3024,31 +3033,29 @@ const DialogAssetEdit = (props) => {
3024
3033
  handleCreateTag,
3025
3034
  currentAsset,
3026
3035
  folderPath: currentFolderPath,
3027
- folderMissing: t33,
3036
+ folderMissing: t40,
3028
3037
  onChangeFolder: handleChangeFolder,
3029
3038
  onRemoveFolder: handleRemoveFolder,
3030
3039
  creditLine,
3031
3040
  locales
3032
- }, $[83] = allTagOptions, $[84] = assetTagOptions, $[85] = control, $[86] = creditLine, $[87] = currentAsset, $[88] = currentFolderPath, $[89] = errors, $[90] = formUpdating, $[91] = handleChangeFolder, $[92] = handleCreateTag, $[93] = handleRemoveFolder, $[94] = locales, $[95] = register, $[96] = setValue, $[97] = t33, $[98] = t34) : t34 = $[98];
3033
- let detailsProps = t34, t35;
3034
- $[99] === Footer ? t35 = $[100] : (t35 = /* @__PURE__ */ jsx(Footer, {}), $[99] = Footer, $[100] = t35);
3035
- let t36;
3036
- $[101] === Symbol.for("react.memo_cache_sentinel") ? (t36 = [
3041
+ }, $[95] = allTagOptions, $[96] = assetTagOptions, $[97] = control, $[98] = creditLine, $[99] = currentAsset, $[100] = currentFolderPath, $[101] = errors, $[102] = formUpdating, $[103] = handleChangeFolder, $[104] = handleCreateTag, $[105] = handleRemoveFolder, $[106] = locales, $[107] = register, $[108] = setValue, $[109] = t40, $[110] = t41) : t41 = $[110];
3042
+ let detailsProps = t41, t42;
3043
+ $[111] === Symbol.for("react.memo_cache_sentinel") ? (t42 = [
3037
3044
  "column-reverse",
3038
3045
  "column-reverse",
3039
3046
  "row-reverse"
3040
- ], $[101] = t36) : t36 = $[101];
3041
- let t37;
3042
- $[102] === Symbol.for("react.memo_cache_sentinel") ? (t37 = [
3047
+ ], $[111] = t42) : t42 = $[111];
3048
+ let t43;
3049
+ $[112] === Symbol.for("react.memo_cache_sentinel") ? (t43 = [
3043
3050
  5,
3044
3051
  5,
3045
3052
  0
3046
- ], $[102] = t37) : t37 = $[102];
3047
- let t38;
3048
- $[103] !== CustomDetails || $[104] !== assetItem || $[105] !== detailsProps || $[106] !== formUpdating || $[107] !== handleSubmit || $[108] !== onSubmit || $[109] !== tabSection ? (t38 = (t39) => {
3049
- let { isLoading, referringDocuments } = t39, uniqueReferringDocuments = getUniqueDocuments(referringDocuments);
3053
+ ], $[112] = t43) : t43 = $[112];
3054
+ let t44;
3055
+ $[113] !== CustomDetails || $[114] !== assetItem || $[115] !== detailsProps || $[116] !== formUpdating || $[117] !== handleSubmit || $[118] !== onSubmit || $[119] !== tabSection ? (t44 = (t45) => {
3056
+ let { isLoading, referringDocuments } = t45, uniqueReferringDocuments = getUniqueDocuments(referringDocuments);
3050
3057
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(TabList, {
3051
- space: 2,
3058
+ gap: 2,
3052
3059
  children: [/* @__PURE__ */ jsx(Tab, {
3053
3060
  "aria-controls": "details-panel",
3054
3061
  disabled: formUpdating,
@@ -3110,24 +3117,24 @@ const DialogAssetEdit = (props) => {
3110
3117
  })
3111
3118
  ]
3112
3119
  })] });
3113
- }, $[103] = CustomDetails, $[104] = assetItem, $[105] = detailsProps, $[106] = formUpdating, $[107] = handleSubmit, $[108] = onSubmit, $[109] = tabSection, $[110] = t38) : t38 = $[110];
3114
- let t39;
3115
- $[111] !== currentAsset._id || $[112] !== documentStore || $[113] !== t38 ? (t39 = /* @__PURE__ */ jsx(Box, {
3120
+ }, $[113] = CustomDetails, $[114] = assetItem, $[115] = detailsProps, $[116] = formUpdating, $[117] = handleSubmit, $[118] = onSubmit, $[119] = tabSection, $[120] = t44) : t44 = $[120];
3121
+ let t45;
3122
+ $[121] !== currentAsset._id || $[122] !== documentStore || $[123] !== t44 ? (t45 = /* @__PURE__ */ jsx(Box, {
3116
3123
  flex: 1,
3117
- marginTop: t37,
3124
+ marginTop: t43,
3118
3125
  padding: 4,
3119
3126
  children: /* @__PURE__ */ jsx(WithReferringDocuments, {
3120
3127
  documentStore,
3121
3128
  id: currentAsset._id,
3122
- children: t38
3129
+ children: t44
3123
3130
  })
3124
- }), $[111] = currentAsset._id, $[112] = documentStore, $[113] = t38, $[114] = t39) : t39 = $[114];
3125
- let t40;
3126
- $[115] === Symbol.for("react.memo_cache_sentinel") ? (t40 = { aspectRatio: "1" }, $[115] = t40) : t40 = $[115];
3127
- let t41;
3128
- $[116] === currentAsset ? t41 = $[117] : (t41 = isFileAsset(currentAsset) && /* @__PURE__ */ jsx(FileAssetPreview, { asset: currentAsset }), $[116] = currentAsset, $[117] = t41);
3129
- let t42;
3130
- $[118] !== currentAsset || $[119] !== scheme ? (t42 = isImageAsset(currentAsset) && /* @__PURE__ */ jsx(Image$1, {
3131
+ }), $[121] = currentAsset._id, $[122] = documentStore, $[123] = t44, $[124] = t45) : t45 = $[124];
3132
+ let t46;
3133
+ $[125] === Symbol.for("react.memo_cache_sentinel") ? (t46 = { aspectRatio: "1" }, $[125] = t46) : t46 = $[125];
3134
+ let t47;
3135
+ $[126] === currentAsset ? t47 = $[127] : (t47 = isFileAsset(currentAsset) && /* @__PURE__ */ jsx(FileAssetPreview, { asset: currentAsset }), $[126] = currentAsset, $[127] = t47);
3136
+ let t48;
3137
+ $[128] !== currentAsset || $[129] !== scheme ? (t48 = isImageAsset(currentAsset) && /* @__PURE__ */ jsx(Image$1, {
3131
3138
  draggable: !1,
3132
3139
  $scheme: scheme,
3133
3140
  $showCheckerboard: !currentAsset?.metadata?.isOpaque,
@@ -3135,41 +3142,41 @@ const DialogAssetEdit = (props) => {
3135
3142
  height: 600,
3136
3143
  width: 600
3137
3144
  })
3138
- }), $[118] = currentAsset, $[119] = scheme, $[120] = t42) : t42 = $[120];
3139
- let t43;
3140
- $[121] !== t41 || $[122] !== t42 ? (t43 = /* @__PURE__ */ jsxs(Box, {
3141
- style: t40,
3142
- children: [t41, t42]
3143
- }), $[121] = t41, $[122] = t42, $[123] = t43) : t43 = $[123];
3144
- let t44;
3145
- $[124] !== assetItem || $[125] !== currentAsset ? (t44 = currentAsset && /* @__PURE__ */ jsx(Box, {
3145
+ }), $[128] = currentAsset, $[129] = scheme, $[130] = t48) : t48 = $[130];
3146
+ let t49;
3147
+ $[131] !== t47 || $[132] !== t48 ? (t49 = /* @__PURE__ */ jsxs(Box, {
3148
+ style: t46,
3149
+ children: [t47, t48]
3150
+ }), $[131] = t47, $[132] = t48, $[133] = t49) : t49 = $[133];
3151
+ let t50;
3152
+ $[134] !== assetItem || $[135] !== currentAsset ? (t50 = currentAsset && /* @__PURE__ */ jsx(Box, {
3146
3153
  marginTop: 4,
3147
3154
  children: /* @__PURE__ */ jsx(AssetMetadata, {
3148
3155
  asset: currentAsset,
3149
3156
  item: assetItem
3150
3157
  })
3151
- }), $[124] = assetItem, $[125] = currentAsset, $[126] = t44) : t44 = $[126];
3152
- let t45;
3153
- $[127] !== t43 || $[128] !== t44 ? (t45 = /* @__PURE__ */ jsxs(Box, {
3158
+ }), $[134] = assetItem, $[135] = currentAsset, $[136] = t50) : t50 = $[136];
3159
+ let t51;
3160
+ $[137] !== t49 || $[138] !== t50 ? (t51 = /* @__PURE__ */ jsxs(Box, {
3154
3161
  flex: 1,
3155
3162
  padding: 4,
3156
- children: [t43, t44]
3157
- }), $[127] = t43, $[128] = t44, $[129] = t45) : t45 = $[129];
3158
- let t46;
3159
- $[130] !== t39 || $[131] !== t45 ? (t46 = /* @__PURE__ */ jsxs(Flex, {
3160
- direction: t36,
3161
- children: [t39, t45]
3162
- }), $[130] = t39, $[131] = t45, $[132] = t46) : t46 = $[132];
3163
- let t47;
3164
- return $[133] !== children || $[134] !== handleClose || $[135] !== id || $[136] !== t35 || $[137] !== t46 ? (t47 = /* @__PURE__ */ jsxs(Dialog$1, {
3163
+ children: [t49, t50]
3164
+ }), $[137] = t49, $[138] = t50, $[139] = t51) : t51 = $[139];
3165
+ let t52;
3166
+ $[140] !== t45 || $[141] !== t51 ? (t52 = /* @__PURE__ */ jsxs(Flex, {
3167
+ direction: t42,
3168
+ children: [t45, t51]
3169
+ }), $[140] = t45, $[141] = t51, $[142] = t52) : t52 = $[142];
3170
+ let t53;
3171
+ return $[143] !== children || $[144] !== footer || $[145] !== handleClose || $[146] !== id || $[147] !== t52 ? (t53 = /* @__PURE__ */ jsxs(Dialog$1, {
3165
3172
  animate: !0,
3166
- footer: t35,
3173
+ footer,
3167
3174
  header: "Asset details",
3168
3175
  id,
3169
3176
  onClose: handleClose,
3170
3177
  width: 3,
3171
- children: [t46, children]
3172
- }), $[133] = children, $[134] = handleClose, $[135] = id, $[136] = t35, $[137] = t46, $[138] = t47) : t47 = $[138], t47;
3178
+ children: [t52, children]
3179
+ }), $[143] = children, $[144] = footer, $[145] = handleClose, $[146] = id, $[147] = t52, $[148] = t53) : t53 = $[148], t53;
3173
3180
  };
3174
3181
  function _temp$35(v) {
3175
3182
  return v;
@@ -3236,18 +3243,18 @@ const selectCombinedItems = createSelector([
3236
3243
  }), t3 = [downHandler, upHandler], $[4] = downHandler, $[5] = t2, $[6] = t3), useEffect(t2, t3), keyPressed;
3237
3244
  }, CardWrapper$2 = styled(Flex).withConfig({
3238
3245
  displayName: "CardWrapper",
3239
- componentId: "sc-xfb4zy-0"
3246
+ componentId: "sc-dw6rvv-0"
3240
3247
  })`box-sizing:border-box;height:100%;overflow:hidden;position:relative;width:100%;`, CardContainer = /* @__PURE__ */ styled(Flex).withConfig({
3241
3248
  displayName: "CardContainer",
3242
- componentId: "sc-xfb4zy-1"
3249
+ componentId: "sc-dw6rvv-1"
3243
3250
  })(({ $picked, theme, $updating }) => css`border:1px solid transparent;height:100%;pointer-events:${$updating ? "none" : "auto"};position:relative;transition:all 300ms;user-select:none;width:100%;border:${$picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};${!$updating && css`@media (hover:hover) and (pointer:fine){&:hover{border:1px solid var(--card-border-color);}}`}`), ContextActionContainer$2 = /* @__PURE__ */ styled(Flex).withConfig({
3244
3251
  displayName: "ContextActionContainer",
3245
- componentId: "sc-xfb4zy-2"
3252
+ componentId: "sc-dw6rvv-2"
3246
3253
  })(({ $scheme }) => css`cursor:pointer;height:${32}px;transition:all 300ms;@media (hover:hover) and (pointer:fine){&:hover{background:${getSchemeColor($scheme, "bg")};}}`), StyledWarningOutlineIcon = /* @__PURE__ */ styled(WarningFilledIcon).withConfig({
3247
3254
  displayName: "StyledWarningOutlineIcon",
3248
- componentId: "sc-xfb4zy-3"
3255
+ componentId: "sc-dw6rvv-3"
3249
3256
  })(({ theme }) => ({ color: theme.sanity.color.spot.red })), CardAsset = (props) => {
3250
- let $ = c(82), { id, selected, source } = props, scheme = useColorSchemeValue(), toast = useToast(), shiftPressed = useKeyPress("shift"), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$34), assetsPicked = useTypedSelector(selectAssetsPicked), t0;
3257
+ let $ = c(83), { id, selected, source } = props, scheme = useColorSchemeValue(), toast = useToast(), shiftPressed = useKeyPress("shift"), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$34), assetsPicked = useTypedSelector(selectAssetsPicked), t0;
3251
3258
  $[0] === id ? t0 = $[1] : (t0 = (state_0) => selectAssetById(state_0, id), $[0] = id, $[1] = t0);
3252
3259
  let item = useTypedSelector(t0), t1;
3253
3260
  $[2] === source ? t1 = $[3] : (t1 = (state_1) => {
@@ -3311,18 +3318,18 @@ const selectCombinedItems = createSelector([
3311
3318
  cursor: t6,
3312
3319
  position: "relative"
3313
3320
  }, $[34] = t6, $[35] = t7);
3314
- let t8;
3315
- $[36] === opacityPreview ? t8 = $[37] : (t8 = {
3321
+ let t8 = `media-asset-card-${asset._id}`, t9;
3322
+ $[36] === opacityPreview ? t9 = $[37] : (t9 = {
3316
3323
  height: "100%",
3317
3324
  opacity: opacityPreview
3318
- }, $[36] = opacityPreview, $[37] = t8);
3319
- let t9;
3320
- $[38] === asset ? t9 = $[39] : (t9 = isFileAsset(asset) && /* @__PURE__ */ jsx(FileIcon$1, {
3325
+ }, $[36] = opacityPreview, $[37] = t9);
3326
+ let t10;
3327
+ $[38] === asset ? t10 = $[39] : (t10 = isFileAsset(asset) && /* @__PURE__ */ jsx(FileIcon$1, {
3321
3328
  extension: asset.extension,
3322
3329
  width: "80px"
3323
- }), $[38] = asset, $[39] = t9);
3324
- let t10;
3325
- $[40] !== asset || $[41] !== isOpaque || $[42] !== scheme ? (t10 = isImageAsset(asset) && /* @__PURE__ */ jsx(Image$1, {
3330
+ }), $[38] = asset, $[39] = t10);
3331
+ let t11;
3332
+ $[40] !== asset || $[41] !== isOpaque || $[42] !== scheme ? (t11 = isImageAsset(asset) && /* @__PURE__ */ jsx(Image$1, {
3326
3333
  draggable: !1,
3327
3334
  $scheme: scheme,
3328
3335
  $showCheckerboard: !isOpaque,
@@ -3334,15 +3341,16 @@ const selectCombinedItems = createSelector([
3334
3341
  draggable: !1,
3335
3342
  transition: "opacity 1000ms"
3336
3343
  }
3337
- }), $[40] = asset, $[41] = isOpaque, $[42] = scheme, $[43] = t10) : t10 = $[43];
3338
- let t11;
3339
- $[44] !== handleAssetClick || $[45] !== t10 || $[46] !== t8 || $[47] !== t9 ? (t11 = /* @__PURE__ */ jsxs("div", {
3340
- onClick: handleAssetClick,
3341
- style: t8,
3342
- children: [t9, t10]
3343
- }), $[44] = handleAssetClick, $[45] = t10, $[46] = t8, $[47] = t9, $[48] = t11) : t11 = $[48];
3344
+ }), $[40] = asset, $[41] = isOpaque, $[42] = scheme, $[43] = t11) : t11 = $[43];
3344
3345
  let t12;
3345
- $[49] !== opacityContainer || $[50] !== selected || $[51] !== updating ? (t12 = selected && !updating && /* @__PURE__ */ jsx(Flex, {
3346
+ $[44] !== handleAssetClick || $[45] !== t10 || $[46] !== t11 || $[47] !== t8 || $[48] !== t9 ? (t12 = /* @__PURE__ */ jsxs("div", {
3347
+ "data-testid": t8,
3348
+ onClick: handleAssetClick,
3349
+ style: t9,
3350
+ children: [t10, t11]
3351
+ }), $[44] = handleAssetClick, $[45] = t10, $[46] = t11, $[47] = t8, $[48] = t9, $[49] = t12) : t12 = $[49];
3352
+ let t13;
3353
+ $[50] !== opacityContainer || $[51] !== selected || $[52] !== updating ? (t13 = selected && !updating && /* @__PURE__ */ jsx(Flex, {
3346
3354
  align: "center",
3347
3355
  justify: "center",
3348
3356
  style: {
@@ -3357,9 +3365,9 @@ const selectCombinedItems = createSelector([
3357
3365
  size: 2,
3358
3366
  children: /* @__PURE__ */ jsx(CheckmarkCircleIcon, {})
3359
3367
  })
3360
- }), $[49] = opacityContainer, $[50] = selected, $[51] = updating, $[52] = t12) : t12 = $[52];
3361
- let t13;
3362
- $[53] === updating ? t13 = $[54] : (t13 = updating && /* @__PURE__ */ jsx(Flex, {
3368
+ }), $[50] = opacityContainer, $[51] = selected, $[52] = updating, $[53] = t13) : t13 = $[53];
3369
+ let t14;
3370
+ $[54] === updating ? t14 = $[55] : (t14 = updating && /* @__PURE__ */ jsx(Flex, {
3363
3371
  align: "center",
3364
3372
  justify: "center",
3365
3373
  style: {
@@ -3370,21 +3378,21 @@ const selectCombinedItems = createSelector([
3370
3378
  width: "100%"
3371
3379
  },
3372
3380
  children: /* @__PURE__ */ jsx(Spinner, {})
3373
- }), $[53] = updating, $[54] = t13);
3374
- let t14;
3375
- $[55] !== t11 || $[56] !== t12 || $[57] !== t13 || $[58] !== t7 ? (t14 = /* @__PURE__ */ jsxs(Box, {
3381
+ }), $[54] = updating, $[55] = t14);
3382
+ let t15;
3383
+ $[56] !== t12 || $[57] !== t13 || $[58] !== t14 || $[59] !== t7 ? (t15 = /* @__PURE__ */ jsxs(Box, {
3376
3384
  flex: 1,
3377
3385
  style: t7,
3378
3386
  children: [
3379
- t11,
3380
3387
  t12,
3381
- t13
3388
+ t13,
3389
+ t14
3382
3390
  ]
3383
- }), $[55] = t11, $[56] = t12, $[57] = t13, $[58] = t7, $[59] = t14) : t14 = $[59];
3384
- let t15;
3385
- $[60] === opacityContainer ? t15 = $[61] : (t15 = { opacity: opacityContainer }, $[60] = opacityContainer, $[61] = t15);
3391
+ }), $[56] = t12, $[57] = t13, $[58] = t14, $[59] = t7, $[60] = t15) : t15 = $[60];
3386
3392
  let t16;
3387
- $[62] !== isMultiSelect || $[63] !== onSelect || $[64] !== picked ? (t16 = onSelect && !isMultiSelect ? /* @__PURE__ */ jsx(EditIcon, { style: {
3393
+ $[61] === opacityContainer ? t16 = $[62] : (t16 = { opacity: opacityContainer }, $[61] = opacityContainer, $[62] = t16);
3394
+ let t17;
3395
+ $[63] !== isMultiSelect || $[64] !== onSelect || $[65] !== picked ? (t17 = onSelect && !isMultiSelect ? /* @__PURE__ */ jsx(EditIcon, { style: {
3388
3396
  flexShrink: 0,
3389
3397
  opacity: .5
3390
3398
  } }) : /* @__PURE__ */ jsx(Checkbox, {
@@ -3395,9 +3403,9 @@ const selectCombinedItems = createSelector([
3395
3403
  pointerEvents: "none",
3396
3404
  transform: "scale(0.8)"
3397
3405
  }
3398
- }), $[62] = isMultiSelect, $[63] = onSelect, $[64] = picked, $[65] = t16) : t16 = $[65];
3399
- let t17;
3400
- $[66] === asset.originalFilename ? t17 = $[67] : (t17 = /* @__PURE__ */ jsx(Box, {
3406
+ }), $[63] = isMultiSelect, $[64] = onSelect, $[65] = picked, $[66] = t17) : t17 = $[66];
3407
+ let t18;
3408
+ $[67] === asset.originalFilename ? t18 = $[68] : (t18 = /* @__PURE__ */ jsx(Box, {
3401
3409
  marginLeft: 2,
3402
3410
  children: /* @__PURE__ */ jsx(Text, {
3403
3411
  muted: !0,
@@ -3405,18 +3413,18 @@ const selectCombinedItems = createSelector([
3405
3413
  textOverflow: "ellipsis",
3406
3414
  children: asset.originalFilename
3407
3415
  })
3408
- }), $[66] = asset.originalFilename, $[67] = t17);
3409
- let t18;
3410
- $[68] !== handleContextActionClick || $[69] !== scheme || $[70] !== t15 || $[71] !== t16 || $[72] !== t17 ? (t18 = /* @__PURE__ */ jsxs(ContextActionContainer$2, {
3416
+ }), $[67] = asset.originalFilename, $[68] = t18);
3417
+ let t19;
3418
+ $[69] !== handleContextActionClick || $[70] !== scheme || $[71] !== t16 || $[72] !== t17 || $[73] !== t18 ? (t19 = /* @__PURE__ */ jsxs(ContextActionContainer$2, {
3411
3419
  align: "center",
3412
3420
  onClick: handleContextActionClick,
3413
3421
  paddingX: 1,
3414
3422
  $scheme: scheme,
3415
- style: t15,
3416
- children: [t16, t17]
3417
- }), $[68] = handleContextActionClick, $[69] = scheme, $[70] = t15, $[71] = t16, $[72] = t17, $[73] = t18) : t18 = $[73];
3418
- let t19;
3419
- $[74] === error ? t19 = $[75] : (t19 = error && /* @__PURE__ */ jsx(Box, {
3423
+ style: t16,
3424
+ children: [t17, t18]
3425
+ }), $[69] = handleContextActionClick, $[70] = scheme, $[71] = t16, $[72] = t17, $[73] = t18, $[74] = t19) : t19 = $[74];
3426
+ let t20;
3427
+ $[75] === error ? t20 = $[76] : (t20 = error && /* @__PURE__ */ jsx(Box, {
3420
3428
  padding: 3,
3421
3429
  style: {
3422
3430
  position: "absolute",
@@ -3440,21 +3448,21 @@ const selectCombinedItems = createSelector([
3440
3448
  children: /* @__PURE__ */ jsx(StyledWarningOutlineIcon, { color: "critical" })
3441
3449
  })
3442
3450
  })
3443
- }), $[74] = error, $[75] = t19);
3444
- let t20;
3445
- return $[76] !== item.updating || $[77] !== picked || $[78] !== t14 || $[79] !== t18 || $[80] !== t19 ? (t20 = /* @__PURE__ */ jsx(CardWrapper$2, {
3451
+ }), $[75] = error, $[76] = t20);
3452
+ let t21;
3453
+ return $[77] !== item.updating || $[78] !== picked || $[79] !== t15 || $[80] !== t19 || $[81] !== t20 ? (t21 = /* @__PURE__ */ jsx(CardWrapper$2, {
3446
3454
  padding: 1,
3447
3455
  children: /* @__PURE__ */ jsxs(CardContainer, {
3448
3456
  direction: "column",
3449
3457
  $picked: picked,
3450
3458
  $updating: item.updating,
3451
3459
  children: [
3452
- t14,
3453
- t18,
3454
- t19
3460
+ t15,
3461
+ t19,
3462
+ t20
3455
3463
  ]
3456
3464
  })
3457
- }), $[76] = item.updating, $[77] = picked, $[78] = t14, $[79] = t18, $[80] = t19, $[81] = t20) : t20 = $[81], t20;
3465
+ }), $[77] = item.updating, $[78] = picked, $[79] = t15, $[80] = t19, $[81] = t20, $[82] = t21) : t21 = $[82], t21;
3458
3466
  };
3459
3467
  var CardAsset_default = memo(CardAsset);
3460
3468
  function _temp$34(state) {
@@ -3465,13 +3473,13 @@ function _temp2$20(d) {
3465
3473
  }
3466
3474
  const CardWrapper$1 = styled(Flex).withConfig({
3467
3475
  displayName: "CardWrapper",
3468
- componentId: "sc-75tou-0"
3476
+ componentId: "sc-21m5j6-0"
3469
3477
  })`box-sizing:border-box;height:100%;overflow:hidden;position:relative;width:100%;`, FolderCard = styled(Card).withConfig({
3470
3478
  displayName: "FolderCard",
3471
- componentId: "sc-75tou-1"
3479
+ componentId: "sc-21m5j6-1"
3472
3480
  })`cursor:pointer;height:100%;transition:border-color 200ms ease;width:100%;@media (hover:hover) and (pointer:fine){&:hover{border-color:var(--card-border-color);}}`, FolderGlyph = /* @__PURE__ */ styled(Box).withConfig({
3473
3481
  displayName: "FolderGlyph",
3474
- componentId: "sc-75tou-2"
3482
+ componentId: "sc-21m5j6-2"
3475
3483
  })(({ theme }) => css`align-items:flex-end;background:linear-gradient( 180deg,${theme.sanity.color.spot.yellow} 0%,${theme.sanity.color.spot.yellow} 100% );border-radius:8px;display:flex;height:72px;position:relative;width:96px;&::before{background:${theme.sanity.color.spot.yellow};border-radius:8px 8px 0 0;content:'';height:18px;left:0;position:absolute;top:-8px;width:38px;}`), CardFolder = (t0) => {
3476
3484
  let $ = c(22), { folderId, name, totalCount } = t0, dispatch = useDispatch(), scheme = useColorSchemeValue(), t1;
3477
3485
  $[0] !== dispatch || $[1] !== folderId ? (t1 = () => dispatch(foldersActions.currentFolderSet({ folderId })), $[0] = dispatch, $[1] = folderId, $[2] = t1) : t1 = $[2];
@@ -3521,7 +3529,7 @@ const CardWrapper$1 = styled(Flex).withConfig({
3521
3529
  height: "fill",
3522
3530
  justify: "space-between",
3523
3531
  children: [t4, /* @__PURE__ */ jsxs(Stack, {
3524
- space: 2,
3532
+ gap: 2,
3525
3533
  children: [t6, t9]
3526
3534
  })]
3527
3535
  }), $[15] = t6, $[16] = t9, $[17] = t10) : t10 = $[17];
@@ -3697,14 +3705,14 @@ const createThrottler = (concurrency = 4) => {
3697
3705
  }));
3698
3706
  }));
3699
3707
  })), uploadsCompleteQueueEpic = (action$) => action$.pipe(filter(UPLOADS_ACTIONS.uploadComplete.match), mergeMap((action) => of(uploadsActions.checkRequest({ assets: [action.payload.asset] })))), uploadsCheckRequestEpic = (action$, state$, { client }) => action$.pipe(filter(uploadsActions.checkRequest.match), withLatestFrom(state$), mergeMap(([action, state]) => {
3700
- let { assets } = action.payload, documentIds = assets.map((asset) => asset._id), query = groq`
3701
- *[${constructFilter({
3708
+ let { assets } = action.payload, documentIds = assets.map((asset) => asset._id), constructedFilter = constructFilter({
3702
3709
  assetTypes: state.assets.assetTypes,
3703
3710
  currentFolderId: state.folders.currentFolderId,
3704
3711
  excludeTagSlugs: state.assets.excludeTagSlugs,
3705
3712
  searchFacets: state.search.facets,
3706
3713
  searchQuery: state.search.query
3707
- })} && _id in $documentIds].sha1hash
3714
+ }), query = groq`
3715
+ *[${constructedFilter} && _id in $documentIds].sha1hash
3708
3716
  `;
3709
3717
  return of(action).pipe(delay(1e3), mergeMap(() => client.observable.fetch(query, { documentIds })), mergeMap((resultHashes) => {
3710
3718
  let checkedResults = assets.reduce((acc, asset) => (acc[asset.sha1hash] = resultHashes.includes(asset.sha1hash) ? asset._id : null, acc), {});
@@ -4147,7 +4155,7 @@ const DialogAllAssets = (props) => {
4147
4155
  paddingX: 4,
4148
4156
  paddingY: 4,
4149
4157
  children: /* @__PURE__ */ jsxs(Stack, {
4150
- space: 3,
4158
+ gap: 3,
4151
4159
  children: [t6, t7]
4152
4160
  })
4153
4161
  }), $[22] = t6, $[23] = t7, $[24] = t8) : t8 = $[24];
@@ -4385,7 +4393,7 @@ const getExpandedIdSet$1 = (folderId, byId) => {
4385
4393
  }), $[34] = t16, $[35] = t17, $[36] = t18) : t18 = $[36];
4386
4394
  let t19;
4387
4395
  $[37] === selectedFolder ? t19 = $[38] : (t19 = selectedFolder && /* @__PURE__ */ jsxs(Inline, {
4388
- space: 2,
4396
+ gap: 2,
4389
4397
  children: [/* @__PURE__ */ jsx(Text, {
4390
4398
  muted: !0,
4391
4399
  size: 1,
@@ -4398,8 +4406,8 @@ const getExpandedIdSet$1 = (folderId, byId) => {
4398
4406
  }), $[37] = selectedFolder, $[38] = t19);
4399
4407
  let t20;
4400
4408
  $[39] !== t14 || $[40] !== t18 || $[41] !== t19 ? (t20 = /* @__PURE__ */ jsxs(Stack, {
4409
+ gap: 4,
4401
4410
  padding: 4,
4402
- space: 4,
4403
4411
  children: [
4404
4412
  t14,
4405
4413
  t18,
@@ -4684,7 +4692,7 @@ const getExpandedIdSet = (folderId, byId) => {
4684
4692
  $[15] === t6 ? t7 = $[16] : (t7 = /* @__PURE__ */ jsx(Box, {
4685
4693
  flex: 1,
4686
4694
  children: /* @__PURE__ */ jsxs(Inline, {
4687
- space: 2,
4695
+ gap: 2,
4688
4696
  children: [t5, t6]
4689
4697
  })
4690
4698
  }), $[15] = t6, $[16] = t7);
@@ -4713,7 +4721,7 @@ const getExpandedIdSet = (folderId, byId) => {
4713
4721
  }), $[24] = canDeleteFolder, $[25] = currentFolderId, $[26] = handleFolderDelete, $[27] = t11) : t11 = $[27];
4714
4722
  let t12;
4715
4723
  $[28] !== t10 || $[29] !== t11 || $[30] !== t8 ? (t12 = /* @__PURE__ */ jsxs(Inline, {
4716
- space: 1,
4724
+ gap: 1,
4717
4725
  children: [
4718
4726
  t8,
4719
4727
  t10,
@@ -4965,13 +4973,16 @@ const DialogFolders = (props) => {
4965
4973
  text: selectedModifier?.title
4966
4974
  }),
4967
4975
  id: "modifier",
4968
- menu: /* @__PURE__ */ jsx(Menu, { children: modifiers.map((modifier_1) => /* @__PURE__ */ jsx(MenuItem, {
4969
- disabled: modifier_1.name === facet.modifier,
4970
- fontSize: 1,
4971
- onClick: () => handleModifierClick(modifier_1),
4972
- padding: 2,
4973
- text: modifier_1.title
4974
- }, modifier_1.name)) }),
4976
+ menu: /* @__PURE__ */ jsx(Menu, { children: modifiers.map((modifier_1) => {
4977
+ let selected_0 = modifier_1.name === facet.modifier;
4978
+ return /* @__PURE__ */ jsx(MenuItem, {
4979
+ disabled: selected_0,
4980
+ fontSize: 1,
4981
+ onClick: () => handleModifierClick(modifier_1),
4982
+ padding: 2,
4983
+ text: modifier_1.title
4984
+ }, modifier_1.name);
4985
+ }) }),
4975
4986
  popover: popoverProps
4976
4987
  }), $[21] = facet.modifier, $[22] = handleModifierClick, $[23] = modifiers, $[24] = popoverProps, $[25] = selectedModifier?.title, $[26] = t9) : t9 = $[26];
4977
4988
  let t10;
@@ -5029,13 +5040,16 @@ const DialogFolders = (props) => {
5029
5040
  text: t5
5030
5041
  }), $[14] = t5, $[15] = t6);
5031
5042
  let t7;
5032
- $[16] !== handleListItemClick || $[17] !== options || $[18] !== selectedItem?.name ? (t7 = options?.map((item) => /* @__PURE__ */ jsx(MenuItem, {
5033
- disabled: item.name === selectedItem?.name,
5034
- fontSize: 1,
5035
- onClick: () => handleListItemClick(item),
5036
- padding: 2,
5037
- text: item.title
5038
- }, item.name)), $[16] = handleListItemClick, $[17] = options, $[18] = selectedItem?.name, $[19] = t7) : t7 = $[19];
5043
+ $[16] !== handleListItemClick || $[17] !== options || $[18] !== selectedItem?.name ? (t7 = options?.map((item) => {
5044
+ let selected_0 = item.name === selectedItem?.name;
5045
+ return /* @__PURE__ */ jsx(MenuItem, {
5046
+ disabled: selected_0,
5047
+ fontSize: 1,
5048
+ onClick: () => handleListItemClick(item),
5049
+ padding: 2,
5050
+ text: item.title
5051
+ }, item.name);
5052
+ }), $[16] = handleListItemClick, $[17] = options, $[18] = selectedItem?.name, $[19] = t7) : t7 = $[19];
5039
5053
  let t8;
5040
5054
  $[20] === t7 ? t8 = $[21] : (t8 = /* @__PURE__ */ jsx(Menu, { children: t7 }), $[20] = t7, $[21] = t8);
5041
5055
  let t9;
@@ -5304,7 +5318,7 @@ const DialogFolders = (props) => {
5304
5318
  fontSize: 1,
5305
5319
  onClick: () => handleOperatorItemClick(operatorType_0),
5306
5320
  padding: 2,
5307
- space: 4,
5321
+ gap: 4,
5308
5322
  style: { minWidth: "150px" },
5309
5323
  text: operators[operatorType_0].label
5310
5324
  }, operatorType_0) : /* @__PURE__ */ jsx(MenuDivider, {}, index)) }),
@@ -5346,7 +5360,7 @@ function _temp3$6() {
5346
5360
  }
5347
5361
  const StackContainer = /* @__PURE__ */ styled(Flex).withConfig({
5348
5362
  displayName: "StackContainer",
5349
- componentId: "sc-aa4qqn-0"
5363
+ componentId: "sc-bz9z8l-0"
5350
5364
  })(({ theme }) => css`> *{margin-bottom:${rem(theme.sanity.space[2])};}`), SearchFacets = (props) => {
5351
5365
  let $ = c(6), { layout: t0 } = props, layout = t0 === void 0 ? "inline" : t0, searchFacets = useTypedSelector(_temp$26), t1;
5352
5366
  $[0] === searchFacets ? t1 = $[1] : (t1 = searchFacets.map(_temp2$13), $[0] = searchFacets, $[1] = t1);
@@ -5357,7 +5371,7 @@ const StackContainer = /* @__PURE__ */ styled(Flex).withConfig({
5357
5371
  return $[2] === Items ? t2 = $[3] : (t2 = /* @__PURE__ */ jsx(Box, {
5358
5372
  marginBottom: 2,
5359
5373
  children: /* @__PURE__ */ jsx(Inline, {
5360
- space: 2,
5374
+ gap: 2,
5361
5375
  children: Items
5362
5376
  })
5363
5377
  }), $[2] = Items, $[3] = t2), t2;
@@ -5386,17 +5400,25 @@ const SearchFacetsControl = () => {
5386
5400
  $[11] !== assetTypes || $[12] !== creditLine?.enabled || $[13] !== isTool ? (t3 = (facet) => !creditLine?.enabled && facet?.type === "string" && facet?.name === "creditLine" ? !1 : facet.type === "group" || facet.type === "divider" ? !0 : isTool ? !facet?.selectOnly : facet.assetTypes.filter((assetType) => assetTypes.includes(assetType)).length > 0, $[11] = assetTypes, $[12] = creditLine?.enabled, $[13] = isTool, $[14] = t3) : t3 = $[14];
5387
5401
  let filteredFacets = FACETS.filter(t3).filter(_temp4$3), hasSearchFacets = filteredFacets.length > 0, renderMenuFacets = (facets_0, t4) => {
5388
5402
  let level = t4 === void 0 ? 0 : t4;
5389
- return /* @__PURE__ */ jsx(Fragment, { children: facets_0?.map((facet_1, index_0) => facet_1.type === "divider" ? /* @__PURE__ */ jsx(MenuDivider, {}, index_0) : facet_1.type === "group" ? /* @__PURE__ */ jsx(MenuGroup, {
5390
- text: facet_1.title,
5391
- title: facet_1.title,
5392
- children: renderMenuFacets(facet_1.facets, level + 1)
5393
- }, `group-${level}-${index_0}`) : facet_1 ? /* @__PURE__ */ jsx(MenuItem, {
5394
- disabled: !facet_1.operatorTypes && !!searchFacets.find((v) => v.name === facet_1.name),
5395
- fontSize: 1,
5396
- onClick: () => dispatch(searchActions.facetsAdd({ facet: facet_1 })),
5397
- padding: 2,
5398
- text: facet_1.title
5399
- }, facet_1.name) : null) });
5403
+ return /* @__PURE__ */ jsx(Fragment, { children: facets_0?.map((facet_1, index_0) => {
5404
+ if (facet_1.type === "divider") return /* @__PURE__ */ jsx(MenuDivider, {}, index_0);
5405
+ if (facet_1.type === "group") return /* @__PURE__ */ jsx(MenuGroup, {
5406
+ text: facet_1.title,
5407
+ title: facet_1.title,
5408
+ children: renderMenuFacets(facet_1.facets, level + 1)
5409
+ }, `group-${level}-${index_0}`);
5410
+ if (facet_1) {
5411
+ let disabled = !facet_1.operatorTypes && !!searchFacets.find((v) => v.name === facet_1.name);
5412
+ return /* @__PURE__ */ jsx(MenuItem, {
5413
+ disabled,
5414
+ fontSize: 1,
5415
+ onClick: () => dispatch(searchActions.facetsAdd({ facet: facet_1 })),
5416
+ padding: 2,
5417
+ text: facet_1.title
5418
+ }, facet_1.name);
5419
+ }
5420
+ return null;
5421
+ }) });
5400
5422
  };
5401
5423
  T2 = Flex, T1 = MenuButton;
5402
5424
  let t5 = !hasSearchFacets;
@@ -5405,7 +5427,7 @@ const SearchFacetsControl = () => {
5405
5427
  fontSize: 1,
5406
5428
  icon: AddIcon,
5407
5429
  mode: "bleed",
5408
- space: 2,
5430
+ gap: 2,
5409
5431
  text: "Add filter",
5410
5432
  tone: "primary"
5411
5433
  }), $[15] = t5, $[16] = t1), t2 = "facets", T0 = Menu, t0 = renderMenuFacets(filteredFacets), $[0] = assetTypes, $[1] = creditLine?.enabled, $[2] = dispatch, $[3] = isTool, $[4] = searchFacets, $[5] = T0, $[6] = T1, $[7] = T2, $[8] = t0, $[9] = t1, $[10] = t2;
@@ -5687,10 +5709,10 @@ function _temp$23(tag) {
5687
5709
  }
5688
5710
  const TagContainer = styled(Flex).withConfig({
5689
5711
  displayName: "TagContainer",
5690
- componentId: "sc-4mmug9-0"
5712
+ componentId: "sc-wgczkj-0"
5691
5713
  })`height:${32}px;`, ButtonContainer = styled(Flex).withConfig({
5692
5714
  displayName: "ButtonContainer",
5693
- componentId: "sc-4mmug9-1"
5715
+ componentId: "sc-wgczkj-1"
5694
5716
  })`@media (pointer:fine){visibility:hidden;}@media (hover:hover) and (pointer:fine){${TagContainer}:hover &{visibility:visible;}}`, TagButton = (props) => {
5695
5717
  let $ = c(10), { disabled, icon, onClick, tone, tooltip } = props, t0;
5696
5718
  $[0] === tooltip ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Container, {
@@ -5992,7 +6014,7 @@ const TagViewHeader = (t0) => {
5992
6014
  }), $[9] = tagsFetching, $[10] = t5);
5993
6015
  let t6;
5994
6016
  $[11] !== t4 || $[12] !== t5 ? (t6 = /* @__PURE__ */ jsxs(Inline, {
5995
- space: 2,
6017
+ gap: 2,
5996
6018
  children: [t4, t5]
5997
6019
  }), $[11] = t4, $[12] = t5, $[13] = t6) : t6 = $[13];
5998
6020
  let t7;
@@ -6441,7 +6463,7 @@ const ButtonViewGroup = () => {
6441
6463
  }), $[10] = t5, $[11] = t6, $[12] = t8) : t8 = $[12];
6442
6464
  let t9;
6443
6465
  return $[13] !== t4 || $[14] !== t8 ? (t9 = /* @__PURE__ */ jsxs(Inline, {
6444
- space: 0,
6466
+ gap: 0,
6445
6467
  style: t0,
6446
6468
  children: [t4, t8]
6447
6469
  }), $[13] = t4, $[14] = t8, $[15] = t9) : t9 = $[15], t9;
@@ -6474,7 +6496,7 @@ const OrderSelect = () => {
6474
6496
  } })),
6475
6497
  padding: 2,
6476
6498
  selected,
6477
- space: 4,
6499
+ gap: 4,
6478
6500
  style: { minWidth: "200px" },
6479
6501
  text: getOrderTitle(item.field, item.direction)
6480
6502
  }, index);
@@ -6643,7 +6665,7 @@ const Controls = () => {
6643
6665
  $[19] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsxs(Box, {
6644
6666
  display: t10,
6645
6667
  children: [t11, /* @__PURE__ */ jsx(Inline, {
6646
- space: 2,
6668
+ gap: 2,
6647
6669
  children: /* @__PURE__ */ jsx(SearchFacetsControl, {})
6648
6670
  })]
6649
6671
  }), $[19] = t12) : t12 = $[19];
@@ -6684,7 +6706,7 @@ const Controls = () => {
6684
6706
  display: t13,
6685
6707
  marginX: 2,
6686
6708
  children: /* @__PURE__ */ jsxs(Inline, {
6687
- space: 2,
6709
+ gap: 2,
6688
6710
  style: t14,
6689
6711
  children: [
6690
6712
  t16,
@@ -6738,7 +6760,7 @@ const Controls = () => {
6738
6760
  $[43] === t25 ? t27 = $[44] : (t27 = /* @__PURE__ */ jsx(Box, {
6739
6761
  marginX: 2,
6740
6762
  children: /* @__PURE__ */ jsxs(Inline, {
6741
- space: 2,
6763
+ gap: 2,
6742
6764
  style: t22,
6743
6765
  children: [t25, t26]
6744
6766
  })
@@ -6895,7 +6917,7 @@ const FolderBreadcrumbs = () => {
6895
6917
  if ($[3] !== currentFolderId || $[4] !== dispatch || $[5] !== segments) {
6896
6918
  let t3;
6897
6919
  $[7] !== currentFolderId || $[8] !== dispatch ? (t3 = (segment) => /* @__PURE__ */ jsxs(Inline, {
6898
- space: 1,
6920
+ gap: 1,
6899
6921
  children: [/* @__PURE__ */ jsx(Text, {
6900
6922
  muted: !0,
6901
6923
  size: 1,
@@ -6914,7 +6936,7 @@ const FolderBreadcrumbs = () => {
6914
6936
  display: t0,
6915
6937
  padding: 2,
6916
6938
  children: /* @__PURE__ */ jsxs(Inline, {
6917
- space: 1,
6939
+ gap: 1,
6918
6940
  children: [t1, t2]
6919
6941
  })
6920
6942
  }), $[10] = t1, $[11] = t2, $[12] = t3) : t3 = $[12], t3;
@@ -7168,13 +7190,13 @@ function _temp$7(state) {
7168
7190
  }
7169
7191
  const ContainerGrid$1 = /* @__PURE__ */ styled(Grid).withConfig({
7170
7192
  displayName: "ContainerGrid",
7171
- componentId: "sc-5nw9dx-0"
7193
+ componentId: "sc-8clx1w-0"
7172
7194
  })(({ $scheme, $selected, $updating }) => css`align-items:center;cursor:${$selected ? "default" : "pointer"};height:100%;pointer-events:${$updating ? "none" : "auto"};user-select:none;white-space:nowrap;${!$updating && css`@media (hover:hover) and (pointer:fine){&:hover{background:${getSchemeColor($scheme, "bg")};}}`}`), ContextActionContainer = /* @__PURE__ */ styled(Flex).withConfig({
7173
7195
  displayName: "ContextActionContainer",
7174
- componentId: "sc-5nw9dx-1"
7196
+ componentId: "sc-8clx1w-1"
7175
7197
  })(({ $scheme }) => css`cursor:pointer;@media (hover:hover) and (pointer:fine){&:hover{background:${getSchemeColor($scheme, "bg2")};}}`), StyledWarningIcon = /* @__PURE__ */ styled(WarningFilledIcon).withConfig({
7176
7198
  displayName: "StyledWarningIcon",
7177
- componentId: "sc-5nw9dx-2"
7199
+ componentId: "sc-8clx1w-2"
7178
7200
  })(({ theme }) => ({ color: theme.sanity.color.spot.red })), TableRowAsset = (props) => {
7179
7201
  let $ = c(150), { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = useState(!1), refCountVisibleTimeout = useRef(null), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$6), t0;
7180
7202
  $[0] === id ? t0 = $[1] : (t0 = (state_0) => selectAssetById(state_0, id), $[0] = id, $[1] = t0);
@@ -7539,10 +7561,10 @@ function _temp2$4(t0) {
7539
7561
  }
7540
7562
  const ContainerGrid = /* @__PURE__ */ styled(Grid).withConfig({
7541
7563
  displayName: "ContainerGrid",
7542
- componentId: "sc-k92msu-0"
7564
+ componentId: "sc-a1pmug-0"
7543
7565
  })(({ theme }) => css`align-items:center;cursor:pointer;height:100%;user-select:none;white-space:nowrap;@media (hover:hover) and (pointer:fine){&:hover{background:${theme.sanity.color.card.enabled.bg};}}`), FolderBadge = /* @__PURE__ */ styled(Box).withConfig({
7544
7566
  displayName: "FolderBadge",
7545
- componentId: "sc-k92msu-1"
7567
+ componentId: "sc-a1pmug-1"
7546
7568
  })(({ theme }) => css`background:${theme.sanity.color.spot.yellow};border-radius:6px;height:42px;position:relative;width:52px;&::before{background:${theme.sanity.color.spot.yellow};border-radius:6px 6px 0 0;content:'';height:12px;left:0;position:absolute;top:-6px;width:18px;}`), TableRowFolder = (t0) => {
7547
7569
  let $ = c(45), { folderId, name, totalCount } = t0, dispatch = useDispatch(), mediaIndex = useMediaIndex(), scheme = useColorSchemeValue(), t1;
7548
7570
  $[0] !== dispatch || $[1] !== folderId ? (t1 = () => dispatch(foldersActions.currentFolderSet({ folderId })), $[0] = dispatch, $[1] = folderId, $[2] = t1) : t1 = $[2];
@@ -7592,7 +7614,7 @@ const ContainerGrid = /* @__PURE__ */ styled(Grid).withConfig({
7592
7614
  }), $[18] = t15) : t15 = $[18];
7593
7615
  let t16;
7594
7616
  $[19] === t14 ? t16 = $[20] : (t16 = /* @__PURE__ */ jsxs(Stack, {
7595
- space: 2,
7617
+ gap: 2,
7596
7618
  children: [t14, t15]
7597
7619
  }), $[19] = t14, $[20] = t16);
7598
7620
  let t17;
@@ -7786,7 +7808,7 @@ const ContainerGrid = /* @__PURE__ */ styled(Grid).withConfig({
7786
7808
  }), $[44] = status, $[45] = t24);
7787
7809
  let t25;
7788
7810
  $[46] !== t23 || $[47] !== t24 ? (t25 = /* @__PURE__ */ jsxs(Stack, {
7789
- space: 3,
7811
+ gap: 3,
7790
7812
  children: [t23, t24]
7791
7813
  }), $[46] = t23, $[47] = t24, $[48] = t25) : t25 = $[48];
7792
7814
  let t26;
@@ -8254,10 +8276,7 @@ function createAssetHandler(dispatch) {
8254
8276
  case "disappear":
8255
8277
  dispatch(assetsActions.listenerDeleteQueue({ assetId: documentId }));
8256
8278
  break;
8257
- case "update":
8258
- dispatch(assetsActions.listenerUpdateQueue({ asset: result }));
8259
- break;
8260
- default: break;
8279
+ case "update": dispatch(assetsActions.listenerUpdateQueue({ asset: result }));
8261
8280
  }
8262
8281
  };
8263
8282
  }
@@ -8271,10 +8290,7 @@ function createTagHandler(dispatch) {
8271
8290
  case "disappear":
8272
8291
  dispatch(tagsActions.listenerDeleteQueue({ tagId: documentId }));
8273
8292
  break;
8274
- case "update":
8275
- dispatch(tagsActions.listenerUpdateQueue({ tag: result }));
8276
- break;
8277
- default: break;
8293
+ case "update": dispatch(tagsActions.listenerUpdateQueue({ tag: result }));
8278
8294
  }
8279
8295
  };
8280
8296
  }
@@ -8337,6 +8353,7 @@ const BrowserContent = (t0) => {
8337
8353
  t1,
8338
8354
  t2,
8339
8355
  /* @__PURE__ */ jsx(Card, {
8356
+ "data-testid": "media-browser",
8340
8357
  display: "flex",
8341
8358
  height: "fill",
8342
8359
  ref: setPortalElement,