sanity-plugin-media 4.3.2 → 4.3.3

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,48 +1,56 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: !0 });
3
- var jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), sanity = require("sanity"), ui = require("@sanity/ui"), react = require("react"), isHotkeyEsm = require("is-hotkey-esm"), styledComponents = require("styled-components"), reactRedux = require("react-redux"), toolkit = require("@reduxjs/toolkit"), pluralize = require("pluralize"), reduxObservable = require("redux-observable"), rxjs = require("rxjs"), operators$1 = require("rxjs/operators"), groq = require("groq"), nanoid = require("nanoid"), uuid = require("@sanity/uuid"), reactNprogress = require("@tanem/react-nprogress"), color = require("@sanity/color"), Select = require("react-select"), reactVirtuoso = require("react-virtuoso"), reactHookForm = require("react-hook-form"), z = require("zod"), zod = require("@hookform/resolvers/zod"), dateFns = require("date-fns"), filesize = require("filesize"), copy = require("copy-to-clipboard"), router = require("sanity/router"), reactFileIcon = require("react-file-icon"), CreatableSelect = require("react-select/creatable"), reactDropzone = require("react-dropzone");
4
- function _interopDefaultCompat(e) {
5
- return e && typeof e == "object" && "default" in e ? e : { default: e };
6
- }
7
- function _interopNamespaceCompat(e) {
8
- if (e && typeof e == "object" && "default" in e) return e;
9
- var n = /* @__PURE__ */ Object.create(null);
10
- return e && Object.keys(e).forEach(function(k) {
11
- if (k !== "default") {
12
- var d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: !0,
15
- get: function() {
16
- return e[k];
17
- }
18
- });
19
- }
20
- }), n.default = e, Object.freeze(n);
21
- }
22
- var pluralize__default = /* @__PURE__ */ _interopDefaultCompat(pluralize), groq__default = /* @__PURE__ */ _interopDefaultCompat(groq), Select__default = /* @__PURE__ */ _interopDefaultCompat(Select), z__namespace = /* @__PURE__ */ _interopNamespaceCompat(z), filesize__default = /* @__PURE__ */ _interopDefaultCompat(filesize), copy__default = /* @__PURE__ */ _interopDefaultCompat(copy), CreatableSelect__default = /* @__PURE__ */ _interopDefaultCompat(CreatableSelect);
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { ThLargeIcon, ThListIcon, SortIcon, CloseIcon, SelectIcon, AddIcon, SearchIcon, PlugIcon, ClipboardIcon, DownloadIcon, ChevronDownIcon, ErrorOutlineIcon, WarningOutlineIcon, EditIcon, ArrowUpIcon, ArrowDownIcon, TrashIcon, ComposeIcon, Icon, UploadIcon, WarningFilledIcon, CheckmarkCircleIcon, ChevronUpIcon, ImageIcon } from "@sanity/icons";
3
+ import { useClient, useColorSchemeValue, useSchema, Preview, useDocumentStore, WithReferringDocuments, useFormValue, definePlugin } from "sanity";
4
+ import { Inline, Button, usePortal, MenuButton, Menu as Menu$2, MenuItem, MenuDivider, Box, studioTheme, rem, Flex, Label, Text, TextInput, Card, MenuGroup, useMediaIndex, Tooltip, Switch, Popover, Stack, Dialog as Dialog$1, TextArea, TabList, Tab, TabPanel, Container as Container$2, Spinner, Checkbox, Grid, useToast, PortalProvider, useLayer, Portal } from "@sanity/ui";
5
+ import { useRef, useCallback, useEffect, createContext, useContext, useMemo, useState, forwardRef, memo, Component } from "react";
6
+ import { isHotkey } from "is-hotkey-esm";
7
+ import { css, createGlobalStyle, styled } from "styled-components";
8
+ import { useSelector, useDispatch, Provider } from "react-redux";
9
+ import { createAction, createSlice, isAnyOf, createSelector, combineReducers, configureStore } from "@reduxjs/toolkit";
10
+ import pluralize from "pluralize";
11
+ import { ofType, combineEpics, createEpicMiddleware } from "redux-observable";
12
+ import { iif, throwError, of, from, EMPTY, Subject, Observable, merge, empty } from "rxjs";
13
+ import { delay, mergeMap, filter, withLatestFrom, catchError, switchMap, bufferTime, debounceTime, first, map, takeUntil } from "rxjs/operators";
14
+ import groq from "groq";
15
+ import { nanoid } from "nanoid";
16
+ import { uuid } from "@sanity/uuid";
17
+ import { useNProgress } from "@tanem/react-nprogress";
18
+ import { hues, white } from "@sanity/color";
19
+ import Select, { components } from "react-select";
20
+ import { Virtuoso, VirtuosoGrid, GroupedVirtuoso } from "react-virtuoso";
21
+ import { Controller, useForm } from "react-hook-form";
22
+ import * as z from "zod";
23
+ import { zodResolver } from "@hookform/resolvers/zod";
24
+ import { format, formatRelative } from "date-fns";
25
+ import filesize from "filesize";
26
+ import copy from "copy-to-clipboard";
27
+ import { useIntentLink } from "sanity/router";
28
+ import { FileIcon as FileIcon$1, defaultStyles } from "react-file-icon";
29
+ import CreatableSelect from "react-select/creatable";
30
+ import { useDropzone } from "react-dropzone";
23
31
  const useKeyPress = (hotkey, onPress) => {
24
- const keyPressed = react.useRef(!1), downHandler = react.useCallback(
32
+ const keyPressed = useRef(!1), downHandler = useCallback(
25
33
  (e) => {
26
- isHotkeyEsm.isHotkey(hotkey, e) && (keyPressed.current = !0, onPress && onPress());
34
+ isHotkey(hotkey, e) && (keyPressed.current = !0, onPress && onPress());
27
35
  },
28
36
  [hotkey, onPress]
29
- ), upHandler = react.useCallback(() => {
37
+ ), upHandler = useCallback(() => {
30
38
  keyPressed.current = !1;
31
39
  }, []);
32
- return react.useEffect(() => (window.addEventListener("keydown", downHandler), window.addEventListener("keyup", upHandler), () => {
40
+ return useEffect(() => (window.addEventListener("keydown", downHandler), window.addEventListener("keyup", upHandler), () => {
33
41
  window.removeEventListener("keydown", downHandler), window.removeEventListener("keyup", upHandler);
34
42
  }), [downHandler, upHandler]), keyPressed;
35
- }, AssetSourceDispatchContext = react.createContext(void 0), AssetBrowserDispatchProvider = (props) => {
43
+ }, AssetSourceDispatchContext = createContext(void 0), AssetBrowserDispatchProvider = (props) => {
36
44
  const { children, onSelect } = props, contextValue = {
37
45
  onSelect
38
46
  };
39
- return /* @__PURE__ */ jsxRuntime.jsx(AssetSourceDispatchContext.Provider, { value: contextValue, children });
47
+ return /* @__PURE__ */ jsx(AssetSourceDispatchContext.Provider, { value: contextValue, children });
40
48
  }, useAssetSourceActions = () => {
41
- const context = react.useContext(AssetSourceDispatchContext);
49
+ const context = useContext(AssetSourceDispatchContext);
42
50
  if (context === void 0)
43
51
  throw new Error("useAssetSourceActions must be used within an AssetSourceDispatchProvider");
44
52
  return context;
45
- }, useVersionedClient = () => sanity.useClient({ apiVersion: "2025-10-02" }), customScrollbar = styledComponents.css`
53
+ }, useVersionedClient = () => useClient({ apiVersion: "2025-10-02" }), customScrollbar = css`
46
54
  ::-webkit-scrollbar {
47
55
  width: 14px;
48
56
  }
@@ -58,7 +66,7 @@ const useKeyPress = (hotkey, onPress) => {
58
66
  background-clip: padding-box;
59
67
  }
60
68
  }
61
- `, GlobalStyle = styledComponents.createGlobalStyle`
69
+ `, GlobalStyle = createGlobalStyle`
62
70
  .media__custom-scrollbar {
63
71
  ${customScrollbar}
64
72
  }
@@ -75,7 +83,7 @@ const useKeyPress = (hotkey, onPress) => {
75
83
  background-color: rgba(15, 17, 18, 0.9);
76
84
  }
77
85
 
78
- `, useTypedSelector = reactRedux.useSelector, ORDER_DICTIONARY = {
86
+ `, useTypedSelector = useSelector, ORDER_DICTIONARY = {
79
87
  _createdAt: {
80
88
  asc: "Last created: Oldest first",
81
89
  desc: "Last created: Newest first"
@@ -162,12 +170,12 @@ const useKeyPress = (hotkey, onPress) => {
162
170
  {
163
171
  name: "true",
164
172
  title: "True",
165
- value: groq__default.default`_id in $documentAssetIds`
173
+ value: groq`_id in $documentAssetIds`
166
174
  },
167
175
  {
168
176
  name: "false",
169
177
  title: "False",
170
- value: groq__default.default`!(_id in $documentAssetIds)`
178
+ value: groq`!(_id in $documentAssetIds)`
171
179
  }
172
180
  ],
173
181
  selectOnly: !0,
@@ -183,12 +191,12 @@ const useKeyPress = (hotkey, onPress) => {
183
191
  {
184
192
  name: "true",
185
193
  title: "True",
186
- value: groq__default.default`count(*[references(^._id)]) > 0`
194
+ value: groq`count(*[references(^._id)]) > 0`
187
195
  },
188
196
  {
189
197
  name: "false",
190
198
  title: "False",
191
- value: groq__default.default`count(*[references(^._id)]) == 0`
199
+ value: groq`count(*[references(^._id)]) == 0`
192
200
  }
193
201
  ],
194
202
  title: "In use",
@@ -460,14 +468,14 @@ const useKeyPress = (hotkey, onPress) => {
460
468
  SMALL: "3rem 100px auto 1.5rem",
461
469
  LARGE: "3rem 100px auto 5.5rem 5.5rem 3.5rem 8.5rem 4.75rem 2rem"
462
470
  }, PANEL_HEIGHT = 32, TAG_DOCUMENT_NAME = "media.tag", TAGS_PANEL_WIDTH = 250, debugThrottle = (throttled) => function(source) {
463
- return rxjs.iif(
471
+ return iif(
464
472
  () => !!throttled,
465
473
  source.pipe(
466
- operators$1.delay(3e3),
467
- operators$1.mergeMap((v) => Math.random() > 0.5 ? rxjs.throwError({
474
+ delay(3e3),
475
+ mergeMap((v) => Math.random() > 0.5 ? throwError({
468
476
  message: "Test error",
469
477
  statusCode: 500
470
- }) : rxjs.of(v))
478
+ }) : of(v))
471
479
  ),
472
480
  source
473
481
  );
@@ -476,7 +484,7 @@ const useKeyPress = (hotkey, onPress) => {
476
484
  searchFacets,
477
485
  searchQuery
478
486
  }) => {
479
- const documentAssetTypes = assetTypes.map((type) => `sanity.${type}Asset`), baseFilter = groq__default.default`
487
+ const documentAssetTypes = assetTypes.map((type) => `sanity.${type}Asset`), baseFilter = groq`
480
488
  _type in ${JSON.stringify(documentAssetTypes)} && !(_id in path("drafts.**"))
481
489
  `, searchFacetFragments = searchFacets.reduce((acc, facet) => {
482
490
  if (facet.type === "number") {
@@ -505,22 +513,22 @@ const useKeyPress = (hotkey, onPress) => {
505
513
  // It's possible to add this by adding the following line to the searchQuery, but it's quite slow
506
514
  // references(*[_type == "media.tag" && name.current == "${searchQuery.trim()}"]._id)
507
515
  ...searchQuery ? [
508
- groq__default.default`[_id, altText, assetId, creditLine, description, originalFilename, title, url] match '*${searchQuery.trim()}*'`
516
+ groq`[_id, altText, assetId, creditLine, description, originalFilename, title, url] match '*${searchQuery.trim()}*'`
509
517
  ] : [],
510
518
  // Search facets
511
519
  ...searchFacetFragments
512
520
  ].join(" && ");
513
521
  }, checkTagName = (client, name) => function(source) {
514
522
  return source.pipe(
515
- operators$1.mergeMap(() => rxjs.from(
516
- client.fetch(groq__default.default`count(*[_type == "${TAG_DOCUMENT_NAME}" && name.current == $name])`, {
523
+ mergeMap(() => from(
524
+ client.fetch(groq`count(*[_type == "${TAG_DOCUMENT_NAME}" && name.current == $name])`, {
517
525
  name
518
526
  })
519
527
  )),
520
- operators$1.mergeMap((existingTagCount) => existingTagCount > 0 ? rxjs.throwError({
528
+ mergeMap((existingTagCount) => existingTagCount > 0 ? throwError({
521
529
  message: "Tag already exists",
522
530
  statusCode: 409
523
- }) : rxjs.of(!0))
531
+ }) : of(!0))
524
532
  );
525
533
  }, getTagSelectOptions = (tags) => tags.reduce((acc, val) => {
526
534
  const tag = val?.tag;
@@ -529,45 +537,45 @@ const useKeyPress = (hotkey, onPress) => {
529
537
  value: tag?._id
530
538
  }), acc;
531
539
  }, []), ASSETS_ACTIONS = {
532
- tagsAddComplete: toolkit.createAction(
540
+ tagsAddComplete: createAction(
533
541
  "actions/tagsAddComplete",
534
542
  function({ assets, tag }) {
535
543
  return { payload: { assets, tag } };
536
544
  }
537
545
  ),
538
- tagsAddError: toolkit.createAction(
546
+ tagsAddError: createAction(
539
547
  "actions/tagsAddError",
540
548
  function({ assets, error, tag }) {
541
549
  return { payload: { assets, error, tag } };
542
550
  }
543
551
  ),
544
- tagsAddRequest: toolkit.createAction(
552
+ tagsAddRequest: createAction(
545
553
  "actions/tagsAddRequest",
546
554
  function({ assets, tag }) {
547
555
  return { payload: { assets, tag } };
548
556
  }
549
557
  ),
550
- tagsRemoveComplete: toolkit.createAction(
558
+ tagsRemoveComplete: createAction(
551
559
  "actions/tagsRemoveComplete",
552
560
  function({ assets, tag }) {
553
561
  return { payload: { assets, tag } };
554
562
  }
555
563
  ),
556
- tagsRemoveError: toolkit.createAction(
564
+ tagsRemoveError: createAction(
557
565
  "actions/tagsRemoveError",
558
566
  function({ assets, error, tag }) {
559
567
  return { payload: { assets, error, tag } };
560
568
  }
561
569
  ),
562
- tagsRemoveRequest: toolkit.createAction(
570
+ tagsRemoveRequest: createAction(
563
571
  "actions/tagsRemoveRequest",
564
572
  function({ assets, tag }) {
565
573
  return { payload: { assets, tag } };
566
574
  }
567
575
  )
568
576
  }, DIALOG_ACTIONS = {
569
- showTagCreate: toolkit.createAction("dialog/showTagCreate"),
570
- showTagEdit: toolkit.createAction("dialog/showTagEdit", function({ tagId }) {
577
+ showTagCreate: createAction("dialog/showTagCreate"),
578
+ showTagEdit: createAction("dialog/showTagEdit", function({ tagId }) {
571
579
  return {
572
580
  payload: { tagId }
573
581
  };
@@ -581,7 +589,7 @@ const useKeyPress = (hotkey, onPress) => {
581
589
  fetching: !1,
582
590
  fetchingError: void 0,
583
591
  panelVisible: !0
584
- }, tagsSlice = toolkit.createSlice({
592
+ }, tagsSlice = createSlice({
585
593
  name: "tags",
586
594
  initialState: initialState$7,
587
595
  extraReducers: (builder) => {
@@ -591,7 +599,7 @@ const useKeyPress = (hotkey, onPress) => {
591
599
  const { tagId } = action.payload;
592
600
  delete state.byIds[tagId].error;
593
601
  }).addMatcher(
594
- toolkit.isAnyOf(
602
+ isAnyOf(
595
603
  ASSETS_ACTIONS.tagsAddComplete,
596
604
  ASSETS_ACTIONS.tagsAddError,
597
605
  ASSETS_ACTIONS.tagsRemoveComplete,
@@ -602,7 +610,7 @@ const useKeyPress = (hotkey, onPress) => {
602
610
  state.byIds[tag._id].updating = !1;
603
611
  }
604
612
  ).addMatcher(
605
- toolkit.isAnyOf(ASSETS_ACTIONS.tagsAddRequest, ASSETS_ACTIONS.tagsRemoveRequest),
613
+ isAnyOf(ASSETS_ACTIONS.tagsAddRequest, ASSETS_ACTIONS.tagsRemoveRequest),
606
614
  (state, action) => {
607
615
  const { tag } = action.payload;
608
616
  state.byIds[tag._id].updating = !0;
@@ -658,7 +666,7 @@ const useKeyPress = (hotkey, onPress) => {
658
666
  reducer: (state, _action) => {
659
667
  state.fetching = !0, delete state.fetchingError;
660
668
  },
661
- prepare: () => ({ payload: { query: groq__default.default`
669
+ prepare: () => ({ payload: { query: groq`
662
670
  {
663
671
  "items": *[
664
672
  _type == "${TAG_DOCUMENT_NAME}"
@@ -736,14 +744,14 @@ const useKeyPress = (hotkey, onPress) => {
736
744
  }
737
745
  }
738
746
  }), tagsCreateEpic = (action$, state$, { client }) => action$.pipe(
739
- operators$1.filter(tagsSlice.actions.createRequest.match),
740
- operators$1.withLatestFrom(state$),
741
- operators$1.mergeMap(([action, state]) => {
747
+ filter(tagsSlice.actions.createRequest.match),
748
+ withLatestFrom(state$),
749
+ mergeMap(([action, state]) => {
742
750
  const { assetId, name } = action.payload;
743
- return rxjs.of(action).pipe(
751
+ return of(action).pipe(
744
752
  debugThrottle(state.debug.badConnection),
745
753
  checkTagName(client, name),
746
- operators$1.mergeMap(
754
+ mergeMap(
747
755
  () => client.observable.create({
748
756
  _type: TAG_DOCUMENT_NAME,
749
757
  name: {
@@ -752,9 +760,9 @@ const useKeyPress = (hotkey, onPress) => {
752
760
  }
753
761
  })
754
762
  ),
755
- operators$1.mergeMap((result) => rxjs.of(tagsSlice.actions.createComplete({ assetId, tag: result }))),
756
- operators$1.catchError(
757
- (error) => rxjs.of(
763
+ mergeMap((result) => of(tagsSlice.actions.createComplete({ assetId, tag: result }))),
764
+ catchError(
765
+ (error) => of(
758
766
  tagsSlice.actions.createError({
759
767
  error: {
760
768
  message: error?.message || "Internal error",
@@ -767,17 +775,17 @@ const useKeyPress = (hotkey, onPress) => {
767
775
  );
768
776
  })
769
777
  ), tagsDeleteEpic = (action$, state$, { client }) => action$.pipe(
770
- operators$1.filter(tagsSlice.actions.deleteRequest.match),
771
- operators$1.withLatestFrom(state$),
772
- operators$1.mergeMap(([action, state]) => {
778
+ filter(tagsSlice.actions.deleteRequest.match),
779
+ withLatestFrom(state$),
780
+ mergeMap(([action, state]) => {
773
781
  const { tag } = action.payload;
774
- return rxjs.of(action).pipe(
782
+ return of(action).pipe(
775
783
  // Optionally throttle
776
784
  debugThrottle(state.debug.badConnection),
777
785
  // Fetch assets which reference this tag
778
- operators$1.mergeMap(
786
+ mergeMap(
779
787
  () => client.observable.fetch(
780
- groq__default.default`*[
788
+ groq`*[
781
789
  _type in ["sanity.fileAsset", "sanity.imageAsset"]
782
790
  && references(*[_type == "media.tag" && name.current == $tagName]._id)
783
791
  ] {
@@ -789,7 +797,7 @@ const useKeyPress = (hotkey, onPress) => {
789
797
  )
790
798
  ),
791
799
  // Create transaction which remove tag references from all matched assets and delete tag
792
- operators$1.mergeMap((assets) => {
800
+ mergeMap((assets) => {
793
801
  const transaction = assets.map((asset) => ({
794
802
  id: asset._id,
795
803
  patch: {
@@ -801,12 +809,12 @@ const useKeyPress = (hotkey, onPress) => {
801
809
  (tx, patch) => tx.patch(patch.id, patch.patch),
802
810
  client.transaction()
803
811
  );
804
- return transaction.delete(tag._id), rxjs.from(transaction.commit());
812
+ return transaction.delete(tag._id), from(transaction.commit());
805
813
  }),
806
814
  // Dispatch complete action
807
- operators$1.mergeMap(() => rxjs.of(tagsSlice.actions.deleteComplete({ tagId: tag._id }))),
808
- operators$1.catchError(
809
- (error) => rxjs.of(
815
+ mergeMap(() => of(tagsSlice.actions.deleteComplete({ tagId: tag._id }))),
816
+ catchError(
817
+ (error) => of(
810
818
  tagsSlice.actions.deleteError({
811
819
  error: {
812
820
  message: error?.message || "Internal error",
@@ -819,24 +827,24 @@ const useKeyPress = (hotkey, onPress) => {
819
827
  );
820
828
  })
821
829
  ), tagsFetchEpic = (action$, state$, { client }) => action$.pipe(
822
- operators$1.filter(tagsSlice.actions.fetchRequest.match),
823
- operators$1.withLatestFrom(state$),
824
- operators$1.switchMap(([action, state]) => {
830
+ filter(tagsSlice.actions.fetchRequest.match),
831
+ withLatestFrom(state$),
832
+ switchMap(([action, state]) => {
825
833
  const { query } = action.payload;
826
- return rxjs.of(action).pipe(
834
+ return of(action).pipe(
827
835
  // Optionally throttle
828
836
  debugThrottle(state.debug.badConnection),
829
837
  // Fetch tags
830
- operators$1.mergeMap(
838
+ mergeMap(
831
839
  () => client.observable.fetch(query)
832
840
  ),
833
841
  // Dispatch complete action
834
- operators$1.mergeMap((result) => {
842
+ mergeMap((result) => {
835
843
  const { items } = result;
836
- return rxjs.of(tagsSlice.actions.fetchComplete({ tags: items }));
844
+ return of(tagsSlice.actions.fetchComplete({ tags: items }));
837
845
  }),
838
- operators$1.catchError(
839
- (error) => rxjs.of(
846
+ catchError(
847
+ (error) => of(
840
848
  tagsSlice.actions.fetchError({
841
849
  error: {
842
850
  message: error?.message || "Internal error",
@@ -848,62 +856,62 @@ const useKeyPress = (hotkey, onPress) => {
848
856
  );
849
857
  })
850
858
  ), tagsListenerCreateQueueEpic = (action$) => action$.pipe(
851
- operators$1.filter(tagsSlice.actions.listenerCreateQueue.match),
852
- operators$1.bufferTime(2e3),
853
- operators$1.filter((actions) => actions.length > 0),
854
- operators$1.mergeMap((actions) => {
859
+ filter(tagsSlice.actions.listenerCreateQueue.match),
860
+ bufferTime(2e3),
861
+ filter((actions) => actions.length > 0),
862
+ mergeMap((actions) => {
855
863
  const tags = actions?.map((action) => action.payload.tag);
856
- return rxjs.of(tagsSlice.actions.listenerCreateQueueComplete({ tags }));
864
+ return of(tagsSlice.actions.listenerCreateQueueComplete({ tags }));
857
865
  })
858
866
  ), tagsListenerDeleteQueueEpic = (action$) => action$.pipe(
859
- operators$1.filter(tagsSlice.actions.listenerDeleteQueue.match),
860
- operators$1.bufferTime(2e3),
861
- operators$1.filter((actions) => actions.length > 0),
862
- operators$1.mergeMap((actions) => {
867
+ filter(tagsSlice.actions.listenerDeleteQueue.match),
868
+ bufferTime(2e3),
869
+ filter((actions) => actions.length > 0),
870
+ mergeMap((actions) => {
863
871
  const tagIds = actions?.map((action) => action.payload.tagId);
864
- return rxjs.of(tagsSlice.actions.listenerDeleteQueueComplete({ tagIds }));
872
+ return of(tagsSlice.actions.listenerDeleteQueueComplete({ tagIds }));
865
873
  })
866
874
  ), tagsListenerUpdateQueueEpic = (action$) => action$.pipe(
867
- operators$1.filter(tagsSlice.actions.listenerUpdateQueue.match),
868
- operators$1.bufferTime(2e3),
869
- operators$1.filter((actions) => actions.length > 0),
870
- operators$1.mergeMap((actions) => {
875
+ filter(tagsSlice.actions.listenerUpdateQueue.match),
876
+ bufferTime(2e3),
877
+ filter((actions) => actions.length > 0),
878
+ mergeMap((actions) => {
871
879
  const tags = actions?.map((action) => action.payload.tag);
872
- return rxjs.of(tagsSlice.actions.listenerUpdateQueueComplete({ tags }));
880
+ return of(tagsSlice.actions.listenerUpdateQueueComplete({ tags }));
873
881
  })
874
882
  ), tagsSortEpic = (action$) => action$.pipe(
875
- reduxObservable.ofType(
883
+ ofType(
876
884
  tagsSlice.actions.listenerCreateQueueComplete.type,
877
885
  tagsSlice.actions.listenerUpdateQueueComplete.type
878
886
  ),
879
- operators$1.bufferTime(1e3),
880
- operators$1.filter((actions) => actions.length > 0),
881
- operators$1.mergeMap(() => rxjs.of(tagsSlice.actions.sort()))
887
+ bufferTime(1e3),
888
+ filter((actions) => actions.length > 0),
889
+ mergeMap(() => of(tagsSlice.actions.sort()))
882
890
  ), tagsUpdateEpic = (action$, state$, { client }) => action$.pipe(
883
- operators$1.filter(tagsSlice.actions.updateRequest.match),
884
- operators$1.withLatestFrom(state$),
885
- operators$1.mergeMap(([action, state]) => {
891
+ filter(tagsSlice.actions.updateRequest.match),
892
+ withLatestFrom(state$),
893
+ mergeMap(([action, state]) => {
886
894
  const { closeDialogId, formData, tag } = action.payload;
887
- return rxjs.of(action).pipe(
895
+ return of(action).pipe(
888
896
  // Optionally throttle
889
897
  debugThrottle(state.debug.badConnection),
890
898
  // Check if tag name is available, throw early if not
891
899
  checkTagName(client, formData?.name?.current),
892
900
  // Patch document (Update tag)
893
- operators$1.mergeMap(
894
- () => rxjs.from(
901
+ mergeMap(
902
+ () => from(
895
903
  client.patch(tag._id).set({ name: { _type: "slug", current: formData?.name.current } }).commit()
896
904
  )
897
905
  ),
898
906
  // Dispatch complete action
899
- operators$1.mergeMap((updatedTag) => rxjs.of(
907
+ mergeMap((updatedTag) => of(
900
908
  tagsSlice.actions.updateComplete({
901
909
  closeDialogId,
902
910
  tag: updatedTag
903
911
  })
904
912
  )),
905
- operators$1.catchError(
906
- (error) => rxjs.of(
913
+ catchError(
914
+ (error) => of(
907
915
  tagsSlice.actions.updateError({
908
916
  error: {
909
917
  message: error?.message || "Internal error",
@@ -915,10 +923,10 @@ const useKeyPress = (hotkey, onPress) => {
915
923
  )
916
924
  );
917
925
  })
918
- ), selectTagsByIds = (state) => state.tags.byIds, selectTagsAllIds = (state) => state.tags.allIds, selectTags = toolkit.createSelector(
926
+ ), selectTagsByIds = (state) => state.tags.byIds, selectTagsAllIds = (state) => state.tags.allIds, selectTags = createSelector(
919
927
  [selectTagsByIds, selectTagsAllIds],
920
928
  (byIds, allIds) => allIds.map((id) => byIds[id])
921
- ), selectTagById = toolkit.createSelector(
929
+ ), selectTagById = createSelector(
922
930
  [selectTagsByIds, (_state, tagId) => tagId],
923
931
  (byIds, tagId) => byIds[tagId]
924
932
  ), selectTagSelectOptions = (asset) => (state) => {
@@ -932,13 +940,13 @@ var tagsReducer = tagsSlice.reducer;
932
940
  const initialState$6 = {
933
941
  facets: [],
934
942
  query: ""
935
- }, searchSlice = toolkit.createSlice({
943
+ }, searchSlice = createSlice({
936
944
  name: "search",
937
945
  initialState: initialState$6,
938
946
  reducers: {
939
947
  // Add search facet
940
948
  facetsAdd(state, action) {
941
- state.facets.push({ ...action.payload.facet, id: uuid.uuid() });
949
+ state.facets.push({ ...action.payload.facet, id: uuid() });
942
950
  },
943
951
  // Clear all search facets
944
952
  facetsClear(state) {
@@ -976,11 +984,11 @@ const initialState$6 = {
976
984
  }
977
985
  }
978
986
  }), searchFacetTagUpdateEpic = (action$, state$) => action$.pipe(
979
- operators$1.filter(tagsActions.updateComplete.match),
980
- operators$1.withLatestFrom(state$),
981
- operators$1.mergeMap(([action, state]) => {
987
+ filter(tagsActions.updateComplete.match),
988
+ withLatestFrom(state$),
989
+ mergeMap(([action, state]) => {
982
990
  const { tag } = action.payload, currentSearchFacetTag = state.search.facets?.find((facet) => facet.name === "tag"), tagItem = state.tags.byIds[tag._id];
983
- return currentSearchFacetTag?.type === "searchable" && currentSearchFacetTag.value?.value === tag._id ? rxjs.of(
991
+ return currentSearchFacetTag?.type === "searchable" && currentSearchFacetTag.value?.value === tag._id ? of(
984
992
  searchSlice.actions.facetsUpdate({
985
993
  name: "tag",
986
994
  value: {
@@ -988,9 +996,9 @@ const initialState$6 = {
988
996
  value: tagItem?.tag?._id
989
997
  }
990
998
  })
991
- ) : rxjs.EMPTY;
999
+ ) : EMPTY;
992
1000
  })
993
- ), selectIsSearchFacetTag = toolkit.createSelector(
1001
+ ), selectIsSearchFacetTag = createSelector(
994
1002
  [
995
1003
  (state) => state.search.facets,
996
1004
  (_state, tagId) => tagId
@@ -1001,7 +1009,7 @@ const initialState$6 = {
1001
1009
  ), searchActions = { ...searchSlice.actions };
1002
1010
  var searchReducer = searchSlice.reducer;
1003
1011
  const UPLOADS_ACTIONS = {
1004
- uploadComplete: toolkit.createAction(
1012
+ uploadComplete: createAction(
1005
1013
  "uploads/uploadComplete",
1006
1014
  function({ asset }) {
1007
1015
  return {
@@ -1026,7 +1034,7 @@ const UPLOADS_ACTIONS = {
1026
1034
  pageSize: 100,
1027
1035
  // totalCount: -1,
1028
1036
  view: "grid"
1029
- }, assetsSlice = toolkit.createSlice({
1037
+ }, assetsSlice = createSlice({
1030
1038
  name: "assets",
1031
1039
  initialState: initialState$5,
1032
1040
  extraReducers: (builder) => {
@@ -1124,9 +1132,9 @@ const UPLOADS_ACTIONS = {
1124
1132
  params = {},
1125
1133
  queryFilter,
1126
1134
  selector = "",
1127
- sort = groq__default.default`order(_updatedAt desc)`
1135
+ sort = groq`order(_updatedAt desc)`
1128
1136
  }) => {
1129
- const query = groq__default.default`
1137
+ const query = groq`
1130
1138
  {
1131
1139
  "items": *[${queryFilter}] {
1132
1140
  _id,
@@ -1243,38 +1251,38 @@ const UPLOADS_ACTIONS = {
1243
1251
  }
1244
1252
  }
1245
1253
  }), assetsDeleteEpic = (action$, _state$, { client }) => action$.pipe(
1246
- operators$1.filter(assetsActions.deleteRequest.match),
1247
- operators$1.mergeMap((action) => {
1254
+ filter(assetsActions.deleteRequest.match),
1255
+ mergeMap((action) => {
1248
1256
  const { assets } = action.payload, assetIds = assets.map((asset) => asset._id);
1249
- return rxjs.of(assets).pipe(
1250
- operators$1.mergeMap(
1257
+ return of(assets).pipe(
1258
+ mergeMap(
1251
1259
  () => client.observable.delete({
1252
- query: groq__default.default`*[_id in ${JSON.stringify(assetIds)}]`
1260
+ query: groq`*[_id in ${JSON.stringify(assetIds)}]`
1253
1261
  })
1254
1262
  ),
1255
- operators$1.mergeMap(() => rxjs.of(assetsActions.deleteComplete({ assetIds }))),
1256
- operators$1.catchError((error) => rxjs.of(assetsActions.deleteError({ assetIds, error })))
1263
+ mergeMap(() => of(assetsActions.deleteComplete({ assetIds }))),
1264
+ catchError((error) => of(assetsActions.deleteError({ assetIds, error })))
1257
1265
  );
1258
1266
  })
1259
1267
  ), assetsFetchEpic = (action$, state$, { client }) => action$.pipe(
1260
- operators$1.filter(assetsActions.fetchRequest.match),
1261
- operators$1.withLatestFrom(state$),
1262
- operators$1.switchMap(([action, state]) => {
1268
+ filter(assetsActions.fetchRequest.match),
1269
+ withLatestFrom(state$),
1270
+ switchMap(([action, state]) => {
1263
1271
  const params = action.payload?.params, query = action.payload?.query;
1264
- return rxjs.of(action).pipe(
1272
+ return of(action).pipe(
1265
1273
  debugThrottle(state.debug.badConnection),
1266
- operators$1.mergeMap(
1274
+ mergeMap(
1267
1275
  () => client.observable.fetch(query, params)
1268
1276
  ),
1269
- operators$1.mergeMap((result) => {
1277
+ mergeMap((result) => {
1270
1278
  const {
1271
1279
  items
1272
1280
  // totalCount
1273
1281
  } = result;
1274
- return rxjs.of(assetsActions.fetchComplete({ assets: items }));
1282
+ return of(assetsActions.fetchComplete({ assets: items }));
1275
1283
  }),
1276
- operators$1.catchError(
1277
- (error) => rxjs.of(
1284
+ catchError(
1285
+ (error) => of(
1278
1286
  assetsActions.fetchError({
1279
1287
  message: error?.message || "Internal error",
1280
1288
  statusCode: error?.statusCode || 500
@@ -1284,9 +1292,9 @@ const UPLOADS_ACTIONS = {
1284
1292
  );
1285
1293
  })
1286
1294
  ), assetsFetchPageIndexEpic = (action$, state$) => action$.pipe(
1287
- operators$1.filter(assetsActions.loadPageIndex.match),
1288
- operators$1.withLatestFrom(state$),
1289
- operators$1.switchMap(([action, state]) => {
1295
+ filter(assetsActions.loadPageIndex.match),
1296
+ withLatestFrom(state$),
1297
+ switchMap(([action, state]) => {
1290
1298
  const pageSize = state.assets.pageSize, start = action.payload.pageIndex * pageSize, end = start + pageSize, documentId = state?.selected.document?._id, documentAssetIds = state?.selected?.documentAssetIds, constructedFilter = constructFilter({
1291
1299
  assetTypes: state.assets.assetTypes,
1292
1300
  searchFacets: state.search.facets,
@@ -1295,40 +1303,40 @@ const UPLOADS_ACTIONS = {
1295
1303
  ...documentId ? { documentId } : {},
1296
1304
  documentAssetIds
1297
1305
  };
1298
- return rxjs.of(
1306
+ return of(
1299
1307
  assetsActions.fetchRequest({
1300
1308
  params,
1301
1309
  queryFilter: constructedFilter,
1302
- selector: groq__default.default`[${start}...${end}]`,
1303
- sort: groq__default.default`order(${state.assets?.order?.field} ${state.assets?.order?.direction})`
1310
+ selector: groq`[${start}...${end}]`,
1311
+ sort: groq`order(${state.assets?.order?.field} ${state.assets?.order?.direction})`
1304
1312
  })
1305
1313
  );
1306
1314
  })
1307
1315
  ), assetsFetchNextPageEpic = (action$, state$) => action$.pipe(
1308
- operators$1.filter(assetsActions.loadNextPage.match),
1309
- operators$1.withLatestFrom(state$),
1310
- operators$1.switchMap(
1311
- ([_action, state]) => rxjs.of(assetsActions.loadPageIndex({ pageIndex: state.assets.pageIndex + 1 }))
1316
+ filter(assetsActions.loadNextPage.match),
1317
+ withLatestFrom(state$),
1318
+ switchMap(
1319
+ ([_action, state]) => of(assetsActions.loadPageIndex({ pageIndex: state.assets.pageIndex + 1 }))
1312
1320
  )
1313
1321
  ), assetsFetchAfterDeleteAllEpic = (action$, state$) => action$.pipe(
1314
- operators$1.filter(assetsActions.deleteComplete.match),
1315
- operators$1.withLatestFrom(state$),
1316
- operators$1.switchMap(([_action, state]) => {
1322
+ filter(assetsActions.deleteComplete.match),
1323
+ withLatestFrom(state$),
1324
+ switchMap(([_action, state]) => {
1317
1325
  if (state.assets.allIds.length === 0) {
1318
1326
  const nextPageIndex = Math.floor(state.assets.allIds.length / state.assets.pageSize);
1319
- return rxjs.of(assetsActions.loadPageIndex({ pageIndex: nextPageIndex }));
1327
+ return of(assetsActions.loadPageIndex({ pageIndex: nextPageIndex }));
1320
1328
  }
1321
- return rxjs.EMPTY;
1329
+ return EMPTY;
1322
1330
  })
1323
- ), filterAssetWithoutTag = (tag) => (asset) => (asset?.asset?.opt?.media?.tags?.findIndex((t) => t._ref === tag?._id) ?? -1) < 0, patchOperationTagAppend = ({ tag }) => (patch) => patch.setIfMissing({ opt: {} }).setIfMissing({ "opt.media": {} }).setIfMissing({ "opt.media.tags": [] }).append("opt.media.tags", [{ _key: nanoid.nanoid(), _ref: tag?._id, _type: "reference", _weak: !0 }]), patchOperationTagUnset = ({ asset, tag }) => (patch) => patch.ifRevisionId(asset?.asset?._rev).unset([`opt.media.tags[_ref == "${tag._id}"]`]), assetsOrderSetEpic = (action$) => action$.pipe(
1324
- operators$1.filter(assetsActions.orderSet.match),
1325
- operators$1.mergeMap(() => rxjs.of(
1331
+ ), filterAssetWithoutTag = (tag) => (asset) => (asset?.asset?.opt?.media?.tags?.findIndex((t) => t._ref === tag?._id) ?? -1) < 0, patchOperationTagAppend = ({ tag }) => (patch) => patch.setIfMissing({ opt: {} }).setIfMissing({ "opt.media": {} }).setIfMissing({ "opt.media.tags": [] }).append("opt.media.tags", [{ _key: nanoid(), _ref: tag?._id, _type: "reference", _weak: !0 }]), patchOperationTagUnset = ({ asset, tag }) => (patch) => patch.ifRevisionId(asset?.asset?._rev).unset([`opt.media.tags[_ref == "${tag._id}"]`]), assetsOrderSetEpic = (action$) => action$.pipe(
1332
+ filter(assetsActions.orderSet.match),
1333
+ mergeMap(() => of(
1326
1334
  assetsActions.clear(),
1327
1335
  //
1328
1336
  assetsActions.loadPageIndex({ pageIndex: 0 })
1329
1337
  ))
1330
1338
  ), assetsSearchEpic = (action$) => action$.pipe(
1331
- reduxObservable.ofType(
1339
+ ofType(
1332
1340
  searchActions.facetsAdd.type,
1333
1341
  searchActions.facetsClear.type,
1334
1342
  searchActions.facetsRemoveById.type,
@@ -1338,63 +1346,63 @@ const UPLOADS_ACTIONS = {
1338
1346
  searchActions.facetsUpdateById.type,
1339
1347
  searchActions.querySet.type
1340
1348
  ),
1341
- operators$1.debounceTime(400),
1342
- operators$1.mergeMap(() => rxjs.of(
1349
+ debounceTime(400),
1350
+ mergeMap(() => of(
1343
1351
  assetsActions.clear(),
1344
1352
  //
1345
1353
  assetsActions.loadPageIndex({ pageIndex: 0 })
1346
1354
  ))
1347
1355
  ), assetsListenerCreateQueueEpic = (action$) => action$.pipe(
1348
- operators$1.filter(assetsActions.listenerCreateQueue.match),
1349
- operators$1.bufferTime(2e3),
1350
- operators$1.filter((actions) => actions.length > 0),
1351
- operators$1.mergeMap((actions) => {
1356
+ filter(assetsActions.listenerCreateQueue.match),
1357
+ bufferTime(2e3),
1358
+ filter((actions) => actions.length > 0),
1359
+ mergeMap((actions) => {
1352
1360
  const assets = actions?.map((action) => action.payload.asset);
1353
- return rxjs.of(assetsActions.listenerCreateQueueComplete({ assets }));
1361
+ return of(assetsActions.listenerCreateQueueComplete({ assets }));
1354
1362
  })
1355
1363
  ), assetsListenerDeleteQueueEpic = (action$) => action$.pipe(
1356
- operators$1.filter(assetsActions.listenerDeleteQueue.match),
1357
- operators$1.bufferTime(2e3),
1358
- operators$1.filter((actions) => actions.length > 0),
1359
- operators$1.mergeMap((actions) => {
1364
+ filter(assetsActions.listenerDeleteQueue.match),
1365
+ bufferTime(2e3),
1366
+ filter((actions) => actions.length > 0),
1367
+ mergeMap((actions) => {
1360
1368
  const assetIds = actions?.map((action) => action.payload.assetId);
1361
- return rxjs.of(assetsActions.listenerDeleteQueueComplete({ assetIds }));
1369
+ return of(assetsActions.listenerDeleteQueueComplete({ assetIds }));
1362
1370
  })
1363
1371
  ), assetsListenerUpdateQueueEpic = (action$) => action$.pipe(
1364
- operators$1.filter(assetsActions.listenerUpdateQueue.match),
1365
- operators$1.bufferTime(2e3),
1366
- operators$1.filter((actions) => actions.length > 0),
1367
- operators$1.mergeMap((actions) => {
1372
+ filter(assetsActions.listenerUpdateQueue.match),
1373
+ bufferTime(2e3),
1374
+ filter((actions) => actions.length > 0),
1375
+ mergeMap((actions) => {
1368
1376
  const assets = actions?.map((action) => action.payload.asset);
1369
- return rxjs.of(assetsActions.listenerUpdateQueueComplete({ assets }));
1377
+ return of(assetsActions.listenerUpdateQueueComplete({ assets }));
1370
1378
  })
1371
1379
  ), assetsSortEpic = (action$) => action$.pipe(
1372
- reduxObservable.ofType(
1380
+ ofType(
1373
1381
  assetsActions.insertUploads.type,
1374
1382
  assetsActions.listenerUpdateQueueComplete.type,
1375
1383
  assetsActions.updateComplete.type
1376
1384
  ),
1377
- operators$1.mergeMap(() => rxjs.of(assetsActions.sort()))
1385
+ mergeMap(() => of(assetsActions.sort()))
1378
1386
  ), assetsTagsAddEpic = (action$, state$, { client }) => action$.pipe(
1379
- operators$1.filter(ASSETS_ACTIONS.tagsAddRequest.match),
1380
- operators$1.withLatestFrom(state$),
1381
- operators$1.mergeMap(([action, state]) => {
1387
+ filter(ASSETS_ACTIONS.tagsAddRequest.match),
1388
+ withLatestFrom(state$),
1389
+ mergeMap(([action, state]) => {
1382
1390
  const { assets, tag } = action.payload;
1383
- return rxjs.of(action).pipe(
1391
+ return of(action).pipe(
1384
1392
  // Optionally throttle
1385
1393
  debugThrottle(state.debug.badConnection),
1386
1394
  // Add tag references to all picked assets
1387
- operators$1.mergeMap(() => {
1395
+ mergeMap(() => {
1388
1396
  const transaction = (selectAssetsPicked(state)?.filter(filterAssetWithoutTag(tag))).reduce(
1389
1397
  (tx, pickedAsset) => tx.patch(pickedAsset?.asset?._id, patchOperationTagAppend({ tag })),
1390
1398
  client.transaction()
1391
1399
  );
1392
- return rxjs.from(transaction.commit());
1400
+ return from(transaction.commit());
1393
1401
  }),
1394
1402
  // Dispatch complete action
1395
- operators$1.mergeMap(() => rxjs.of(ASSETS_ACTIONS.tagsAddComplete({ assets, tag }))),
1396
- operators$1.catchError(
1397
- (error) => rxjs.of(
1403
+ mergeMap(() => of(ASSETS_ACTIONS.tagsAddComplete({ assets, tag }))),
1404
+ catchError(
1405
+ (error) => of(
1398
1406
  ASSETS_ACTIONS.tagsAddError({
1399
1407
  assets,
1400
1408
  error: {
@@ -1408,25 +1416,25 @@ const UPLOADS_ACTIONS = {
1408
1416
  );
1409
1417
  })
1410
1418
  ), assetsTagsRemoveEpic = (action$, state$, { client }) => action$.pipe(
1411
- operators$1.filter(ASSETS_ACTIONS.tagsRemoveRequest.match),
1412
- operators$1.withLatestFrom(state$),
1413
- operators$1.mergeMap(([action, state]) => {
1419
+ filter(ASSETS_ACTIONS.tagsRemoveRequest.match),
1420
+ withLatestFrom(state$),
1421
+ mergeMap(([action, state]) => {
1414
1422
  const { assets, tag } = action.payload;
1415
- return rxjs.of(action).pipe(
1423
+ return of(action).pipe(
1416
1424
  // Optionally throttle
1417
1425
  debugThrottle(state.debug.badConnection),
1418
1426
  // Remove tag references from all picked assets
1419
- operators$1.mergeMap(() => {
1427
+ mergeMap(() => {
1420
1428
  const transaction = selectAssetsPicked(state).reduce(
1421
1429
  (tx, pickedAsset) => tx.patch(pickedAsset?.asset?._id, patchOperationTagUnset({ asset: pickedAsset, tag })),
1422
1430
  client.transaction()
1423
1431
  );
1424
- return rxjs.from(transaction.commit());
1432
+ return from(transaction.commit());
1425
1433
  }),
1426
1434
  // Dispatch complete action
1427
- operators$1.mergeMap(() => rxjs.of(ASSETS_ACTIONS.tagsRemoveComplete({ assets, tag }))),
1428
- operators$1.catchError(
1429
- (error) => rxjs.of(
1435
+ mergeMap(() => of(ASSETS_ACTIONS.tagsRemoveComplete({ assets, tag }))),
1436
+ catchError(
1437
+ (error) => of(
1430
1438
  ASSETS_ACTIONS.tagsRemoveError({
1431
1439
  assets,
1432
1440
  error: {
@@ -1440,7 +1448,7 @@ const UPLOADS_ACTIONS = {
1440
1448
  );
1441
1449
  })
1442
1450
  ), assetsUnpickEpic = (action$) => action$.pipe(
1443
- reduxObservable.ofType(
1451
+ ofType(
1444
1452
  assetsActions.orderSet.type,
1445
1453
  assetsActions.viewSet.type,
1446
1454
  searchActions.facetsAdd.type,
@@ -1452,29 +1460,29 @@ const UPLOADS_ACTIONS = {
1452
1460
  searchActions.facetsUpdateById.type,
1453
1461
  searchActions.querySet.type
1454
1462
  ),
1455
- operators$1.mergeMap(() => rxjs.of(assetsActions.pickClear()))
1463
+ mergeMap(() => of(assetsActions.pickClear()))
1456
1464
  ), assetsUpdateEpic = (action$, state$, { client }) => action$.pipe(
1457
- operators$1.filter(assetsActions.updateRequest.match),
1458
- operators$1.withLatestFrom(state$),
1459
- operators$1.mergeMap(([action, state]) => {
1465
+ filter(assetsActions.updateRequest.match),
1466
+ withLatestFrom(state$),
1467
+ mergeMap(([action, state]) => {
1460
1468
  const { asset, closeDialogId, formData } = action.payload;
1461
- return rxjs.of(action).pipe(
1469
+ return of(action).pipe(
1462
1470
  debugThrottle(state.debug.badConnection),
1463
- operators$1.mergeMap(
1464
- () => rxjs.from(
1471
+ mergeMap(
1472
+ () => from(
1465
1473
  client.patch(asset._id).setIfMissing({ opt: {} }).setIfMissing({ "opt.media": {} }).set(formData).commit()
1466
1474
  )
1467
1475
  ),
1468
- operators$1.mergeMap(
1469
- (updatedAsset) => rxjs.of(
1476
+ mergeMap(
1477
+ (updatedAsset) => of(
1470
1478
  assetsActions.updateComplete({
1471
1479
  asset: updatedAsset,
1472
1480
  closeDialogId
1473
1481
  })
1474
1482
  )
1475
1483
  ),
1476
- operators$1.catchError(
1477
- (error) => rxjs.of(
1484
+ catchError(
1485
+ (error) => of(
1478
1486
  assetsActions.updateError({
1479
1487
  asset,
1480
1488
  error: {
@@ -1486,26 +1494,26 @@ const UPLOADS_ACTIONS = {
1486
1494
  )
1487
1495
  );
1488
1496
  })
1489
- ), selectAssetsByIds = (state) => state.assets.byIds, selectAssetsAllIds = (state) => state.assets.allIds, selectAssetById = toolkit.createSelector(
1497
+ ), selectAssetsByIds = (state) => state.assets.byIds, selectAssetsAllIds = (state) => state.assets.allIds, selectAssetById = createSelector(
1490
1498
  [
1491
1499
  (state) => state.assets.byIds,
1492
1500
  (_state, assetId) => assetId
1493
1501
  ],
1494
1502
  (byIds, assetId) => byIds[assetId] || void 0
1495
- ), selectAssets = toolkit.createSelector(
1503
+ ), selectAssets = createSelector(
1496
1504
  [selectAssetsByIds, selectAssetsAllIds],
1497
1505
  (byIds, allIds) => allIds.map((id) => byIds[id])
1498
- ), selectAssetsLength = toolkit.createSelector([selectAssets], (assets) => assets.length), selectAssetsPicked = toolkit.createSelector(
1506
+ ), selectAssetsLength = createSelector([selectAssets], (assets) => assets.length), selectAssetsPicked = createSelector(
1499
1507
  [selectAssets],
1500
1508
  (assets) => assets.filter((item) => item?.picked)
1501
- ), selectAssetsPickedLength = toolkit.createSelector(
1509
+ ), selectAssetsPickedLength = createSelector(
1502
1510
  [selectAssetsPicked],
1503
1511
  (assetsPicked) => assetsPicked.length
1504
1512
  ), assetsActions = { ...assetsSlice.actions };
1505
1513
  var assetsReducer = assetsSlice.reducer;
1506
1514
  const initialState$4 = {
1507
1515
  items: []
1508
- }, dialogSlice = toolkit.createSlice({
1516
+ }, dialogSlice = createSlice({
1509
1517
  name: "dialog",
1510
1518
  initialState: initialState$4,
1511
1519
  extraReducers: (builder) => {
@@ -1551,7 +1559,7 @@ const initialState$4 = {
1551
1559
  state.items = state.items.filter((item) => item.id !== id);
1552
1560
  },
1553
1561
  showConfirmAssetsTagAdd(state, action) {
1554
- const { assetsPicked, closeDialogId, tag } = action.payload, suffix = `${assetsPicked.length} ${pluralize__default.default("asset", assetsPicked.length)}`;
1562
+ const { assetsPicked, closeDialogId, tag } = action.payload, suffix = `${assetsPicked.length} ${pluralize("asset", assetsPicked.length)}`;
1555
1563
  state.items.push({
1556
1564
  closeDialogId,
1557
1565
  confirmCallbackAction: ASSETS_ACTIONS.tagsAddRequest({
@@ -1567,7 +1575,7 @@ const initialState$4 = {
1567
1575
  });
1568
1576
  },
1569
1577
  showConfirmAssetsTagRemove(state, action) {
1570
- const { assetsPicked, closeDialogId, tag } = action.payload, suffix = `${assetsPicked.length} ${pluralize__default.default("asset", assetsPicked.length)}`;
1578
+ const { assetsPicked, closeDialogId, tag } = action.payload, suffix = `${assetsPicked.length} ${pluralize("asset", assetsPicked.length)}`;
1571
1579
  state.items.push({
1572
1580
  closeDialogId,
1573
1581
  confirmCallbackAction: ASSETS_ACTIONS.tagsRemoveRequest({ assets: assetsPicked, tag }),
@@ -1580,7 +1588,7 @@ const initialState$4 = {
1580
1588
  });
1581
1589
  },
1582
1590
  showConfirmDeleteAssets(state, action) {
1583
- const { assets, closeDialogId } = action.payload, suffix = `${assets.length} ${pluralize__default.default("asset", assets.length)}`;
1591
+ const { assets, closeDialogId } = action.payload, suffix = `${assets.length} ${pluralize("asset", assets.length)}`;
1584
1592
  state.items.push({
1585
1593
  closeDialogId,
1586
1594
  confirmCallbackAction: assetsActions.deleteRequest({
@@ -1631,41 +1639,41 @@ const initialState$4 = {
1631
1639
  }
1632
1640
  }
1633
1641
  }), dialogClearOnAssetUpdateEpic = (action$) => action$.pipe(
1634
- reduxObservable.ofType(
1642
+ ofType(
1635
1643
  assetsActions.deleteComplete.type,
1636
1644
  assetsActions.updateComplete.type,
1637
1645
  tagsActions.deleteComplete.type,
1638
1646
  tagsActions.updateComplete.type
1639
1647
  ),
1640
- operators$1.filter(
1648
+ filter(
1641
1649
  (action) => !!action?.payload?.closeDialogId
1642
1650
  ),
1643
- operators$1.mergeMap((action) => {
1651
+ mergeMap((action) => {
1644
1652
  const dialogId = action?.payload?.closeDialogId;
1645
- return dialogId ? rxjs.of(dialogSlice.actions.remove({ id: dialogId })) : rxjs.EMPTY;
1653
+ return dialogId ? of(dialogSlice.actions.remove({ id: dialogId })) : EMPTY;
1646
1654
  })
1647
1655
  ), dialogTagCreateEpic = (action$) => action$.pipe(
1648
- operators$1.filter(tagsActions.createComplete.match),
1649
- operators$1.mergeMap((action) => {
1656
+ filter(tagsActions.createComplete.match),
1657
+ mergeMap((action) => {
1650
1658
  const { assetId, tag } = action?.payload;
1651
- return assetId ? rxjs.of(dialogSlice.actions.inlineTagCreate({ tag, assetId })) : tag._id ? rxjs.of(dialogSlice.actions.remove({ id: "tagCreate" })) : rxjs.EMPTY;
1659
+ return assetId ? of(dialogSlice.actions.inlineTagCreate({ tag, assetId })) : tag._id ? of(dialogSlice.actions.remove({ id: "tagCreate" })) : EMPTY;
1652
1660
  })
1653
1661
  ), dialogTagDeleteEpic = (action$) => action$.pipe(
1654
- operators$1.filter(tagsActions.listenerDeleteQueueComplete.match),
1655
- operators$1.mergeMap((action) => {
1662
+ filter(tagsActions.listenerDeleteQueueComplete.match),
1663
+ mergeMap((action) => {
1656
1664
  const { tagIds } = action?.payload;
1657
- return rxjs.of(dialogSlice.actions.inlineTagRemove({ tagIds }));
1665
+ return of(dialogSlice.actions.inlineTagRemove({ tagIds }));
1658
1666
  })
1659
1667
  ), dialogActions = { ...dialogSlice.actions };
1660
1668
  var dialogReducer = dialogSlice.reducer;
1661
1669
  const ButtonViewGroup = () => {
1662
- const dispatch = reactRedux.useDispatch(), view = useTypedSelector((state) => state.assets.view);
1663
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 0, style: { whiteSpace: "nowrap" }, children: [
1664
- /* @__PURE__ */ jsxRuntime.jsx(
1665
- ui.Button,
1670
+ const dispatch = useDispatch(), view = useTypedSelector((state) => state.assets.view);
1671
+ return /* @__PURE__ */ jsxs(Inline, { space: 0, style: { whiteSpace: "nowrap" }, children: [
1672
+ /* @__PURE__ */ jsx(
1673
+ Button,
1666
1674
  {
1667
1675
  fontSize: 1,
1668
- icon: icons.ThLargeIcon,
1676
+ icon: ThLargeIcon,
1669
1677
  mode: view === "grid" ? "default" : "ghost",
1670
1678
  onClick: () => dispatch(assetsActions.viewSet({ view: "grid" })),
1671
1679
  style: {
@@ -1674,11 +1682,11 @@ const ButtonViewGroup = () => {
1674
1682
  }
1675
1683
  }
1676
1684
  ),
1677
- /* @__PURE__ */ jsxRuntime.jsx(
1678
- ui.Button,
1685
+ /* @__PURE__ */ jsx(
1686
+ Button,
1679
1687
  {
1680
1688
  fontSize: 1,
1681
- icon: icons.ThListIcon,
1689
+ icon: ThListIcon,
1682
1690
  mode: view === "table" ? "default" : "ghost",
1683
1691
  onClick: () => dispatch(assetsActions.viewSet({ view: "table" })),
1684
1692
  style: {
@@ -1690,7 +1698,7 @@ const ButtonViewGroup = () => {
1690
1698
  ] });
1691
1699
  };
1692
1700
  function usePortalPopoverProps() {
1693
- const portal = ui.usePortal();
1701
+ const portal = usePortal();
1694
1702
  return {
1695
1703
  animate: !0,
1696
1704
  constrainSize: !0,
@@ -1700,26 +1708,26 @@ function usePortalPopoverProps() {
1700
1708
  };
1701
1709
  }
1702
1710
  const OrderSelect = () => {
1703
- const dispatch = reactRedux.useDispatch(), order = useTypedSelector((state) => state.assets.order), popoverProps = usePortalPopoverProps();
1704
- return /* @__PURE__ */ jsxRuntime.jsx(
1705
- ui.MenuButton,
1711
+ const dispatch = useDispatch(), order = useTypedSelector((state) => state.assets.order), popoverProps = usePortalPopoverProps();
1712
+ return /* @__PURE__ */ jsx(
1713
+ MenuButton,
1706
1714
  {
1707
- button: /* @__PURE__ */ jsxRuntime.jsx(
1708
- ui.Button,
1715
+ button: /* @__PURE__ */ jsx(
1716
+ Button,
1709
1717
  {
1710
1718
  fontSize: 1,
1711
- icon: icons.SortIcon,
1719
+ icon: SortIcon,
1712
1720
  mode: "bleed",
1713
1721
  padding: 3,
1714
1722
  text: getOrderTitle(order.field, order.direction)
1715
1723
  }
1716
1724
  ),
1717
1725
  id: "order",
1718
- menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: ORDER_OPTIONS?.map((item, index) => {
1726
+ menu: /* @__PURE__ */ jsx(Menu$2, { children: ORDER_OPTIONS?.map((item, index) => {
1719
1727
  if (item) {
1720
1728
  const selected = order.field === item.field && order.direction === item.direction;
1721
- return /* @__PURE__ */ jsxRuntime.jsx(
1722
- ui.MenuItem,
1729
+ return /* @__PURE__ */ jsx(
1730
+ MenuItem,
1723
1731
  {
1724
1732
  disabled: selected,
1725
1733
  fontSize: 1,
@@ -1738,25 +1746,25 @@ const OrderSelect = () => {
1738
1746
  index
1739
1747
  );
1740
1748
  }
1741
- return /* @__PURE__ */ jsxRuntime.jsx(ui.MenuDivider, {}, index);
1749
+ return /* @__PURE__ */ jsx(MenuDivider, {}, index);
1742
1750
  }) }),
1743
1751
  popover: popoverProps
1744
1752
  }
1745
1753
  );
1746
1754
  }, Progress = (props) => {
1747
- const { loading } = props, { animationDuration, isFinished, progress } = reactNprogress.useNProgress({
1755
+ const { loading } = props, { animationDuration, isFinished, progress } = useNProgress({
1748
1756
  animationDuration: 300,
1749
1757
  isAnimating: loading
1750
1758
  });
1751
- return /* @__PURE__ */ jsxRuntime.jsx(
1752
- ui.Box,
1759
+ return /* @__PURE__ */ jsx(
1760
+ Box,
1753
1761
  {
1754
1762
  style: {
1755
1763
  opacity: isFinished ? 0 : 1,
1756
1764
  transition: `opacity ${animationDuration}ms linear`
1757
1765
  },
1758
- children: /* @__PURE__ */ jsxRuntime.jsx(
1759
- ui.Box,
1766
+ children: /* @__PURE__ */ jsx(
1767
+ Box,
1760
1768
  {
1761
1769
  style: {
1762
1770
  height: "1px",
@@ -1773,51 +1781,51 @@ const OrderSelect = () => {
1773
1781
  );
1774
1782
  }, SCHEME_COLORS = {
1775
1783
  bg: {
1776
- dark: color.hues.gray[950].hex,
1777
- light: color.hues.gray[50].hex
1784
+ dark: hues.gray[950].hex,
1785
+ light: hues.gray[50].hex
1778
1786
  },
1779
1787
  bg2: {
1780
- dark: color.hues.gray[900].hex,
1781
- light: color.hues.gray[100].hex
1788
+ dark: hues.gray[900].hex,
1789
+ light: hues.gray[100].hex
1782
1790
  },
1783
1791
  inputEnabledBorder: {
1784
- dark: ui.studioTheme.color.dark.default.input.default.enabled.border,
1785
- light: ui.studioTheme.color.light.default.input.default.enabled.border
1792
+ dark: studioTheme.color.dark.default.input.default.enabled.border,
1793
+ light: studioTheme.color.light.default.input.default.enabled.border
1786
1794
  },
1787
1795
  inputHoveredBorder: {
1788
- dark: ui.studioTheme.color.dark.default.input.default.hovered.border,
1789
- light: ui.studioTheme.color.light.default.input.default.hovered.border
1796
+ dark: studioTheme.color.dark.default.input.default.hovered.border,
1797
+ light: studioTheme.color.light.default.input.default.hovered.border
1790
1798
  },
1791
1799
  mutedHoveredBg: {
1792
- dark: ui.studioTheme.color.dark.primary.muted.primary.hovered.bg,
1793
- light: ui.studioTheme.color.light.primary.muted.primary.hovered.bg
1800
+ dark: studioTheme.color.dark.primary.muted.primary.hovered.bg,
1801
+ light: studioTheme.color.light.primary.muted.primary.hovered.bg
1794
1802
  },
1795
1803
  mutedHoveredFg: {
1796
- dark: ui.studioTheme.color.dark.primary.muted.primary.hovered.fg,
1797
- light: ui.studioTheme.color.light.primary.muted.primary.hovered.fg
1804
+ dark: studioTheme.color.dark.primary.muted.primary.hovered.fg,
1805
+ light: studioTheme.color.light.primary.muted.primary.hovered.fg
1798
1806
  },
1799
1807
  mutedSelectedBg: {
1800
- dark: ui.studioTheme.color.dark.primary.muted.primary.selected.bg,
1801
- light: ui.studioTheme.color.light.primary.muted.primary.selected.bg
1808
+ dark: studioTheme.color.dark.primary.muted.primary.selected.bg,
1809
+ light: studioTheme.color.light.primary.muted.primary.selected.bg
1802
1810
  },
1803
1811
  spotBlue: {
1804
- dark: ui.studioTheme.color.dark.primary.spot.blue,
1805
- light: ui.studioTheme.color.light.primary.spot.blue
1812
+ dark: studioTheme.color.dark.primary.spot.blue,
1813
+ light: studioTheme.color.light.primary.spot.blue
1806
1814
  }
1807
1815
  };
1808
1816
  function getSchemeColor(scheme, colorKey) {
1809
1817
  return SCHEME_COLORS[colorKey]?.[scheme];
1810
1818
  }
1811
- const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styledComponents.css`
1819
+ const Container$1 = styled(Box)(({ $scheme, theme }) => css`
1812
1820
  background: ${getSchemeColor($scheme, "bg")};
1813
- border-radius: ${ui.rem(theme.sanity.radius[2])};
1821
+ border-radius: ${rem(theme.sanity.radius[2])};
1814
1822
  `), SearchFacet = (props) => {
1815
- const { children, facet } = props, scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), handleClose = () => {
1823
+ const { children, facet } = props, scheme = useColorSchemeValue(), dispatch = useDispatch(), handleClose = () => {
1816
1824
  dispatch(searchActions.facetsRemoveById({ facetId: facet.id }));
1817
1825
  };
1818
- return /* @__PURE__ */ jsxRuntime.jsx(Container$1, { padding: [2, 2, 1], $scheme: scheme, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: ["flex-start", "flex-start", "center"], direction: ["column", "column", "row"], children: [
1819
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingBottom: [3, 3, 0], paddingLeft: 1, paddingRight: 2, paddingTop: [1, 1, 0], children: /* @__PURE__ */ jsxRuntime.jsx(
1820
- ui.Label,
1826
+ return /* @__PURE__ */ jsx(Container$1, { padding: [2, 2, 1], $scheme: scheme, children: /* @__PURE__ */ jsxs(Flex, { align: ["flex-start", "flex-start", "center"], direction: ["column", "column", "row"], children: [
1827
+ /* @__PURE__ */ jsx(Box, { paddingBottom: [3, 3, 0], paddingLeft: 1, paddingRight: 2, paddingTop: [1, 1, 0], children: /* @__PURE__ */ jsx(
1828
+ Label,
1821
1829
  {
1822
1830
  size: 0,
1823
1831
  style: {
@@ -1826,15 +1834,15 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
1826
1834
  children: facet.title
1827
1835
  }
1828
1836
  ) }),
1829
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
1837
+ /* @__PURE__ */ jsxs(Flex, { align: "center", children: [
1830
1838
  children,
1831
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 1, paddingX: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 0, children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, { onClick: handleClose }) }) })
1839
+ /* @__PURE__ */ jsx(Box, { marginLeft: 1, paddingX: 2, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 0, children: /* @__PURE__ */ jsx(CloseIcon, { onClick: handleClose }) }) })
1832
1840
  ] })
1833
1841
  ] }) });
1834
1842
  }, TextInputNumber = (props) => {
1835
1843
  const { onValueChange, value, ...remainingProps } = props;
1836
- return /* @__PURE__ */ jsxRuntime.jsx(
1837
- ui.TextInput,
1844
+ return /* @__PURE__ */ jsx(
1845
+ TextInput,
1838
1846
  {
1839
1847
  ...remainingProps,
1840
1848
  onChange: (e) => {
@@ -1845,29 +1853,29 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
1845
1853
  }
1846
1854
  );
1847
1855
  }, SearchFacetNumber = ({ facet }) => {
1848
- const dispatch = reactRedux.useDispatch(), popoverProps = usePortalPopoverProps(), modifiers = facet?.modifiers, selectedModifier = facet?.modifier ? modifiers?.find((modifier) => modifier.name === facet?.modifier) : modifiers?.[0], handleOperatorItemClick = (operatorType) => {
1856
+ const dispatch = useDispatch(), popoverProps = usePortalPopoverProps(), modifiers = facet?.modifiers, selectedModifier = facet?.modifier ? modifiers?.find((modifier) => modifier.name === facet?.modifier) : modifiers?.[0], handleOperatorItemClick = (operatorType) => {
1849
1857
  dispatch(searchActions.facetsUpdateById({ id: facet.id, operatorType }));
1850
1858
  }, handleModifierClick = (modifier) => {
1851
1859
  dispatch(searchActions.facetsUpdateById({ id: facet.id, modifier: modifier.name }));
1852
1860
  }, handleValueChange = (value) => {
1853
1861
  dispatch(searchActions.facetsUpdateById({ id: facet.id, value }));
1854
1862
  }, selectedOperatorType = facet.operatorType ?? "greaterThan";
1855
- return /* @__PURE__ */ jsxRuntime.jsxs(SearchFacet, { facet, children: [
1856
- facet?.operatorTypes && /* @__PURE__ */ jsxRuntime.jsx(
1857
- ui.MenuButton,
1863
+ return /* @__PURE__ */ jsxs(SearchFacet, { facet, children: [
1864
+ facet?.operatorTypes && /* @__PURE__ */ jsx(
1865
+ MenuButton,
1858
1866
  {
1859
- button: /* @__PURE__ */ jsxRuntime.jsx(
1860
- ui.Button,
1867
+ button: /* @__PURE__ */ jsx(
1868
+ Button,
1861
1869
  {
1862
1870
  fontSize: 1,
1863
- iconRight: icons.SelectIcon,
1871
+ iconRight: SelectIcon,
1864
1872
  padding: 2,
1865
1873
  text: operators[selectedOperatorType].label
1866
1874
  }
1867
1875
  ),
1868
1876
  id: "operators",
1869
- menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: facet.operatorTypes.map((operatorType, index) => operatorType ? /* @__PURE__ */ jsxRuntime.jsx(
1870
- ui.MenuItem,
1877
+ menu: /* @__PURE__ */ jsx(Menu$2, { children: facet.operatorTypes.map((operatorType, index) => operatorType ? /* @__PURE__ */ jsx(
1878
+ MenuItem,
1871
1879
  {
1872
1880
  disabled: operatorType === selectedOperatorType,
1873
1881
  fontSize: 1,
@@ -1876,11 +1884,11 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
1876
1884
  text: operators[operatorType].label
1877
1885
  },
1878
1886
  operatorType
1879
- ) : /* @__PURE__ */ jsxRuntime.jsx(ui.MenuDivider, {}, index)) }),
1887
+ ) : /* @__PURE__ */ jsx(MenuDivider, {}, index)) }),
1880
1888
  popover: popoverProps
1881
1889
  }
1882
1890
  ),
1883
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginX: 1, style: { maxWidth: "50px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
1891
+ /* @__PURE__ */ jsx(Box, { marginX: 1, style: { maxWidth: "50px" }, children: /* @__PURE__ */ jsx(
1884
1892
  TextInputNumber,
1885
1893
  {
1886
1894
  fontSize: 1,
@@ -1891,23 +1899,23 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
1891
1899
  value: facet?.value
1892
1900
  }
1893
1901
  ) }),
1894
- modifiers && /* @__PURE__ */ jsxRuntime.jsx(
1895
- ui.MenuButton,
1902
+ modifiers && /* @__PURE__ */ jsx(
1903
+ MenuButton,
1896
1904
  {
1897
- button: /* @__PURE__ */ jsxRuntime.jsx(
1898
- ui.Button,
1905
+ button: /* @__PURE__ */ jsx(
1906
+ Button,
1899
1907
  {
1900
1908
  fontSize: 1,
1901
- iconRight: icons.SelectIcon,
1909
+ iconRight: SelectIcon,
1902
1910
  padding: 2,
1903
1911
  text: selectedModifier?.title
1904
1912
  }
1905
1913
  ),
1906
1914
  id: "modifier",
1907
- menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: modifiers.map((modifier) => {
1915
+ menu: /* @__PURE__ */ jsx(Menu$2, { children: modifiers.map((modifier) => {
1908
1916
  const selected = modifier.name === facet.modifier;
1909
- return /* @__PURE__ */ jsxRuntime.jsx(
1910
- ui.MenuItem,
1917
+ return /* @__PURE__ */ jsx(
1918
+ MenuItem,
1911
1919
  {
1912
1920
  disabled: selected,
1913
1921
  fontSize: 1,
@@ -1923,27 +1931,27 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
1923
1931
  )
1924
1932
  ] });
1925
1933
  }, SearchFacetSelect = ({ facet }) => {
1926
- const dispatch = reactRedux.useDispatch(), popoverProps = usePortalPopoverProps(), options = facet?.options, selectedItem = options?.find((v) => v.name === facet?.value), handleListItemClick = (option) => {
1934
+ const dispatch = useDispatch(), popoverProps = usePortalPopoverProps(), options = facet?.options, selectedItem = options?.find((v) => v.name === facet?.value), handleListItemClick = (option) => {
1927
1935
  dispatch(searchActions.facetsUpdate({ name: facet.name, value: option.name }));
1928
1936
  }, handleOperatorItemClick = (operatorType) => {
1929
1937
  dispatch(searchActions.facetsUpdate({ name: facet.name, operatorType }));
1930
1938
  }, selectedOperatorType = facet?.operatorType ?? "is";
1931
- return /* @__PURE__ */ jsxRuntime.jsxs(SearchFacet, { facet, children: [
1932
- facet?.operatorTypes && /* @__PURE__ */ jsxRuntime.jsx(
1933
- ui.MenuButton,
1939
+ return /* @__PURE__ */ jsxs(SearchFacet, { facet, children: [
1940
+ facet?.operatorTypes && /* @__PURE__ */ jsx(
1941
+ MenuButton,
1934
1942
  {
1935
- button: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginRight: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
1936
- ui.Button,
1943
+ button: /* @__PURE__ */ jsx(Box, { marginRight: 1, children: /* @__PURE__ */ jsx(
1944
+ Button,
1937
1945
  {
1938
1946
  fontSize: 1,
1939
- iconRight: icons.SelectIcon,
1947
+ iconRight: SelectIcon,
1940
1948
  padding: 2,
1941
1949
  text: operators[selectedOperatorType].label
1942
1950
  }
1943
1951
  ) }),
1944
1952
  id: "operators",
1945
- menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: facet.operatorTypes.map((operatorType, index) => operatorType ? /* @__PURE__ */ jsxRuntime.jsx(
1946
- ui.MenuItem,
1953
+ menu: /* @__PURE__ */ jsx(Menu$2, { children: facet.operatorTypes.map((operatorType, index) => operatorType ? /* @__PURE__ */ jsx(
1954
+ MenuItem,
1947
1955
  {
1948
1956
  disabled: operatorType === selectedOperatorType,
1949
1957
  fontSize: 1,
@@ -1952,19 +1960,19 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
1952
1960
  text: operators[operatorType].label
1953
1961
  },
1954
1962
  operatorType
1955
- ) : /* @__PURE__ */ jsxRuntime.jsx(ui.MenuDivider, {}, index)) }),
1963
+ ) : /* @__PURE__ */ jsx(MenuDivider, {}, index)) }),
1956
1964
  popover: popoverProps
1957
1965
  }
1958
1966
  ),
1959
- /* @__PURE__ */ jsxRuntime.jsx(
1960
- ui.MenuButton,
1967
+ /* @__PURE__ */ jsx(
1968
+ MenuButton,
1961
1969
  {
1962
- button: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { fontSize: 1, iconRight: icons.SelectIcon, padding: 2, text: selectedItem?.title }),
1970
+ button: /* @__PURE__ */ jsx(Button, { fontSize: 1, iconRight: SelectIcon, padding: 2, text: selectedItem?.title }),
1963
1971
  id: "list",
1964
- menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: options?.map((item, index) => {
1972
+ menu: /* @__PURE__ */ jsx(Menu$2, { children: options?.map((item, index) => {
1965
1973
  const selected = item.name === selectedItem?.name;
1966
- return /* @__PURE__ */ jsxRuntime.jsx(
1967
- ui.MenuItem,
1974
+ return /* @__PURE__ */ jsx(
1975
+ MenuItem,
1968
1976
  {
1969
1977
  disabled: selected,
1970
1978
  fontSize: 1,
@@ -1980,27 +1988,27 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
1980
1988
  )
1981
1989
  ] });
1982
1990
  }, SearchFacetString = ({ facet }) => {
1983
- const dispatch = reactRedux.useDispatch(), popoverProps = usePortalPopoverProps(), handleOperatorItemClick = (operatorType) => {
1991
+ const dispatch = useDispatch(), popoverProps = usePortalPopoverProps(), handleOperatorItemClick = (operatorType) => {
1984
1992
  dispatch(searchActions.facetsUpdateById({ id: facet.id, operatorType }));
1985
1993
  }, handleChange = (e) => {
1986
1994
  dispatch(searchActions.facetsUpdateById({ id: facet.id, value: e.target.value }));
1987
1995
  }, selectedOperatorType = facet.operatorType;
1988
- return /* @__PURE__ */ jsxRuntime.jsxs(SearchFacet, { facet, children: [
1989
- facet?.operatorTypes && /* @__PURE__ */ jsxRuntime.jsx(
1990
- ui.MenuButton,
1996
+ return /* @__PURE__ */ jsxs(SearchFacet, { facet, children: [
1997
+ facet?.operatorTypes && /* @__PURE__ */ jsx(
1998
+ MenuButton,
1991
1999
  {
1992
- button: /* @__PURE__ */ jsxRuntime.jsx(
1993
- ui.Button,
2000
+ button: /* @__PURE__ */ jsx(
2001
+ Button,
1994
2002
  {
1995
2003
  fontSize: 1,
1996
- iconRight: icons.SelectIcon,
2004
+ iconRight: SelectIcon,
1997
2005
  padding: 2,
1998
2006
  text: operators[selectedOperatorType].label
1999
2007
  }
2000
2008
  ),
2001
2009
  id: "operators",
2002
- menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: facet.operatorTypes.map((operatorType, index) => operatorType ? /* @__PURE__ */ jsxRuntime.jsx(
2003
- ui.MenuItem,
2010
+ menu: /* @__PURE__ */ jsx(Menu$2, { children: facet.operatorTypes.map((operatorType, index) => operatorType ? /* @__PURE__ */ jsx(
2011
+ MenuItem,
2004
2012
  {
2005
2013
  disabled: operatorType === selectedOperatorType,
2006
2014
  fontSize: 1,
@@ -2009,12 +2017,12 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2009
2017
  text: operators[operatorType].label
2010
2018
  },
2011
2019
  operatorType
2012
- ) : /* @__PURE__ */ jsxRuntime.jsx(ui.MenuDivider, {}, index)) }),
2020
+ ) : /* @__PURE__ */ jsx(MenuDivider, {}, index)) }),
2013
2021
  popover: popoverProps
2014
2022
  }
2015
2023
  ),
2016
- !operators[selectedOperatorType].hideInput && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 1, style: { maxWidth: "125px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
2017
- ui.TextInput,
2024
+ !operators[selectedOperatorType].hideInput && /* @__PURE__ */ jsx(Box, { marginLeft: 1, style: { maxWidth: "125px" }, children: /* @__PURE__ */ jsx(
2025
+ TextInput,
2018
2026
  {
2019
2027
  fontSize: 1,
2020
2028
  onChange: handleChange,
@@ -2031,7 +2039,7 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2031
2039
  },
2032
2040
  radius: themeRadius$1,
2033
2041
  space: themeSpace$1
2034
- } = ui.studioTheme, reactSelectStyles$1 = (scheme) => ({
2042
+ } = studioTheme, reactSelectStyles$1 = (scheme) => ({
2035
2043
  control: (styles, { isDisabled, isFocused }) => {
2036
2044
  let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
2037
2045
  return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
@@ -2056,9 +2064,9 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2056
2064
  input: (styles) => ({
2057
2065
  ...styles,
2058
2066
  color: "var(--card-fg-color)",
2059
- fontFamily: ui.studioTheme.fonts.text.family,
2067
+ fontFamily: studioTheme.fonts.text.family,
2060
2068
  fontSize: themeTextSizes[1].fontSize,
2061
- marginLeft: ui.rem(themeSpace$1[2])
2069
+ marginLeft: rem(themeSpace$1[2])
2062
2070
  }),
2063
2071
  menuList: (styles) => ({
2064
2072
  ...styles,
@@ -2066,7 +2074,7 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2066
2074
  }),
2067
2075
  noOptionsMessage: (styles) => ({
2068
2076
  ...styles,
2069
- fontFamily: ui.studioTheme.fonts.text.family,
2077
+ fontFamily: studioTheme.fonts.text.family,
2070
2078
  fontSize: themeTextSizes[1].fontSize,
2071
2079
  lineHeight: "1em"
2072
2080
  }),
@@ -2078,7 +2086,7 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2078
2086
  fontSize: themeTextSizes[1].fontSize,
2079
2087
  lineHeight: "1em",
2080
2088
  margin: 0,
2081
- padding: ui.rem(themeSpace$1[1]),
2089
+ padding: rem(themeSpace$1[1]),
2082
2090
  "&:hover": {
2083
2091
  backgroundColor: getSchemeColor(scheme, "spotBlue"),
2084
2092
  color: getSchemeColor(scheme, "bg")
@@ -2087,7 +2095,7 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2087
2095
  placeholder: (styles) => ({
2088
2096
  ...styles,
2089
2097
  fontSize: themeTextSizes[1].fontSize,
2090
- marginLeft: ui.rem(themeSpace$1[2]),
2098
+ marginLeft: rem(themeSpace$1[2]),
2091
2099
  paddingLeft: 0
2092
2100
  }),
2093
2101
  singleValue: (styles) => ({
@@ -2095,41 +2103,41 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2095
2103
  alignItems: "center",
2096
2104
  display: "inline-flex",
2097
2105
  height: "100%",
2098
- marginLeft: ui.rem(themeSpace$1[2])
2106
+ marginLeft: rem(themeSpace$1[2])
2099
2107
  }),
2100
2108
  valueContainer: (styles) => ({
2101
2109
  ...styles,
2102
2110
  margin: 0,
2103
2111
  padding: 0
2104
2112
  })
2105
- }), ClearIndicator = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.ClearIndicator, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
2106
- ui.Box,
2113
+ }), ClearIndicator = (props) => /* @__PURE__ */ jsx(components.ClearIndicator, { ...props, children: /* @__PURE__ */ jsx(
2114
+ Box,
2107
2115
  {
2108
2116
  paddingRight: 1,
2109
2117
  style: {
2110
2118
  transform: "scale(0.85)"
2111
2119
  },
2112
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 0, children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, {}) })
2120
+ children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 0, children: /* @__PURE__ */ jsx(CloseIcon, {}) })
2113
2121
  }
2114
- ) }), Menu$1 = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.Menu, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { radius: 1, shadow: 2, children: props.children }) }), MenuList$1 = (props) => {
2122
+ ) }), Menu$1 = (props) => /* @__PURE__ */ jsx(components.Menu, { ...props, children: /* @__PURE__ */ jsx(Card, { radius: 1, shadow: 2, children: props.children }) }), MenuList$1 = (props) => {
2115
2123
  const { children } = props, MAX_ROWS = 5, OPTION_HEIGHT = 33;
2116
2124
  if (Array.isArray(children)) {
2117
2125
  const height = children.length > MAX_ROWS ? OPTION_HEIGHT * MAX_ROWS : children.length * OPTION_HEIGHT;
2118
- return /* @__PURE__ */ jsxRuntime.jsx(
2119
- reactVirtuoso.Virtuoso,
2126
+ return /* @__PURE__ */ jsx(
2127
+ Virtuoso,
2120
2128
  {
2121
2129
  className: "media__custom-scrollbar",
2122
2130
  itemContent: (index) => {
2123
2131
  const item = children[index];
2124
- return /* @__PURE__ */ jsxRuntime.jsx(Option$1, { ...item.props });
2132
+ return /* @__PURE__ */ jsx(Option$1, { ...item.props });
2125
2133
  },
2126
2134
  style: { height },
2127
2135
  totalCount: children.length
2128
2136
  }
2129
2137
  );
2130
2138
  }
2131
- return /* @__PURE__ */ jsxRuntime.jsx(Select.components.MenuList, { ...props, children });
2132
- }, NoOptionsMessage = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.NoOptionsMessage, { ...props, children: props.children }), Option$1 = (props) => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Select.components.Option, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingY: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, style: { color: "inherit" }, textOverflow: "ellipsis", children: props.children }) }) }) }), SingleValue = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.SingleValue, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, textOverflow: "ellipsis", children: props.children }) }), reactSelectComponents$1 = {
2139
+ return /* @__PURE__ */ jsx(components.MenuList, { ...props, children });
2140
+ }, NoOptionsMessage = (props) => /* @__PURE__ */ jsx(components.NoOptionsMessage, { ...props, children: props.children }), Option$1 = (props) => /* @__PURE__ */ jsx(Box, { padding: 1, children: /* @__PURE__ */ jsx(components.Option, { ...props, children: /* @__PURE__ */ jsx(Box, { paddingY: 1, children: /* @__PURE__ */ jsx(Text, { size: 1, style: { color: "inherit" }, textOverflow: "ellipsis", children: props.children }) }) }) }), SingleValue = (props) => /* @__PURE__ */ jsx(components.SingleValue, { ...props, children: /* @__PURE__ */ jsx(Text, { size: 1, textOverflow: "ellipsis", children: props.children }) }), reactSelectComponents$1 = {
2133
2141
  ClearIndicator,
2134
2142
  DropdownIndicator: null,
2135
2143
  IndicatorSeparator: null,
@@ -2139,7 +2147,7 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2139
2147
  Option: Option$1,
2140
2148
  SingleValue
2141
2149
  }, SearchFacetTags = ({ facet }) => {
2142
- const scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), tags = useTypedSelector((state) => selectTags(state)), tagsFetching = useTypedSelector((state) => state.tags.fetching), allTagOptions = getTagSelectOptions(tags), popoverProps = usePortalPopoverProps(), handleChange = (option) => {
2150
+ const scheme = useColorSchemeValue(), dispatch = useDispatch(), tags = useTypedSelector((state) => selectTags(state)), tagsFetching = useTypedSelector((state) => state.tags.fetching), allTagOptions = getTagSelectOptions(tags), popoverProps = usePortalPopoverProps(), handleChange = (option) => {
2143
2151
  dispatch(
2144
2152
  searchActions.facetsUpdateById({
2145
2153
  id: facet.id,
@@ -2154,22 +2162,22 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2154
2162
  })
2155
2163
  );
2156
2164
  }, selectedOperatorType = facet.operatorType;
2157
- return /* @__PURE__ */ jsxRuntime.jsxs(SearchFacet, { facet, children: [
2158
- facet?.operatorTypes && /* @__PURE__ */ jsxRuntime.jsx(
2159
- ui.MenuButton,
2165
+ return /* @__PURE__ */ jsxs(SearchFacet, { facet, children: [
2166
+ facet?.operatorTypes && /* @__PURE__ */ jsx(
2167
+ MenuButton,
2160
2168
  {
2161
- button: /* @__PURE__ */ jsxRuntime.jsx(
2162
- ui.Button,
2169
+ button: /* @__PURE__ */ jsx(
2170
+ Button,
2163
2171
  {
2164
2172
  fontSize: 1,
2165
- iconRight: icons.SelectIcon,
2173
+ iconRight: SelectIcon,
2166
2174
  padding: 2,
2167
2175
  text: operators[selectedOperatorType].label
2168
2176
  }
2169
2177
  ),
2170
2178
  id: "operators",
2171
- menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: facet.operatorTypes.map((operatorType, index) => operatorType ? /* @__PURE__ */ jsxRuntime.jsx(
2172
- ui.MenuItem,
2179
+ menu: /* @__PURE__ */ jsx(Menu$2, { children: facet.operatorTypes.map((operatorType, index) => operatorType ? /* @__PURE__ */ jsx(
2180
+ MenuItem,
2173
2181
  {
2174
2182
  disabled: operatorType === selectedOperatorType,
2175
2183
  fontSize: 1,
@@ -2180,12 +2188,12 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2180
2188
  text: operators[operatorType].label
2181
2189
  },
2182
2190
  operatorType
2183
- ) : /* @__PURE__ */ jsxRuntime.jsx(ui.MenuDivider, {}, index)) }),
2191
+ ) : /* @__PURE__ */ jsx(MenuDivider, {}, index)) }),
2184
2192
  popover: popoverProps
2185
2193
  }
2186
2194
  ),
2187
- !operators[selectedOperatorType].hideInput && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginX: 1, style: { width: "160px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
2188
- Select__default.default,
2195
+ !operators[selectedOperatorType].hideInput && /* @__PURE__ */ jsx(Box, { marginX: 1, style: { width: "160px" }, children: /* @__PURE__ */ jsx(
2196
+ Select,
2189
2197
  {
2190
2198
  components: reactSelectComponents$1,
2191
2199
  instanceId: "facet-searchable",
@@ -2202,22 +2210,22 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2202
2210
  }
2203
2211
  ) })
2204
2212
  ] });
2205
- }, StackContainer = styledComponents.styled(ui.Flex)(({ theme }) => styledComponents.css`
2213
+ }, StackContainer = styled(Flex)(({ theme }) => css`
2206
2214
  > * {
2207
- margin-bottom: ${ui.rem(theme.sanity.space[2])};
2215
+ margin-bottom: ${rem(theme.sanity.space[2])};
2208
2216
  }
2209
2217
  `), SearchFacets = (props) => {
2210
2218
  const { layout = "inline" } = props, searchFacets = useTypedSelector((state) => state.search.facets), Items2 = searchFacets.map((facet) => {
2211
2219
  const key = facet.id;
2212
- return facet.type === "number" ? /* @__PURE__ */ jsxRuntime.jsx(SearchFacetNumber, { facet }, key) : facet.type === "searchable" ? /* @__PURE__ */ jsxRuntime.jsx(SearchFacetTags, { facet }, key) : facet.type === "select" ? /* @__PURE__ */ jsxRuntime.jsx(SearchFacetSelect, { facet }, key) : facet.type === "string" ? /* @__PURE__ */ jsxRuntime.jsx(SearchFacetString, { facet }, key) : null;
2220
+ return facet.type === "number" ? /* @__PURE__ */ jsx(SearchFacetNumber, { facet }, key) : facet.type === "searchable" ? /* @__PURE__ */ jsx(SearchFacetTags, { facet }, key) : facet.type === "select" ? /* @__PURE__ */ jsx(SearchFacetSelect, { facet }, key) : facet.type === "string" ? /* @__PURE__ */ jsx(SearchFacetString, { facet }, key) : null;
2213
2221
  });
2214
2222
  if (layout === "inline")
2215
- return searchFacets.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginBottom: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Inline, { space: 2, children: Items2 }) });
2223
+ return searchFacets.length === 0 ? null : /* @__PURE__ */ jsx(Box, { marginBottom: 2, children: /* @__PURE__ */ jsx(Inline, { space: 2, children: Items2 }) });
2216
2224
  if (layout === "stack")
2217
- return /* @__PURE__ */ jsxRuntime.jsx(StackContainer, { align: "flex-start", direction: "column", children: Items2 });
2225
+ return /* @__PURE__ */ jsx(StackContainer, { align: "flex-start", direction: "column", children: Items2 });
2218
2226
  throw Error("Invalid layout");
2219
- }, ToolOptionsContext = react.createContext(null), ToolOptionsProvider = ({ options, children }) => {
2220
- const value = react.useMemo(() => {
2227
+ }, ToolOptionsContext = createContext(null), ToolOptionsProvider = ({ options, children }) => {
2228
+ const value = useMemo(() => {
2221
2229
  let creditLineExcludeSources;
2222
2230
  return options?.creditLine?.excludeSources && (creditLineExcludeSources = Array.isArray(options?.creditLine?.excludeSources) ? options.creditLine.excludeSources : [options?.creditLine?.excludeSources]), {
2223
2231
  dropzone: { maxSize: options?.maximumUploadSize },
@@ -2241,27 +2249,27 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2241
2249
  options?.directUploads,
2242
2250
  options?.locales
2243
2251
  ]);
2244
- return /* @__PURE__ */ jsxRuntime.jsx(ToolOptionsContext.Provider, { value, children });
2252
+ return /* @__PURE__ */ jsx(ToolOptionsContext.Provider, { value, children });
2245
2253
  }, useToolOptions = () => {
2246
- const context = react.useContext(ToolOptionsContext);
2254
+ const context = useContext(ToolOptionsContext);
2247
2255
  if (!context)
2248
2256
  throw new Error("useToolOptions must be used within an ToolOptionsProvider");
2249
2257
  return context;
2250
2258
  }, SearchFacetsControl = () => {
2251
- const dispatch = reactRedux.useDispatch(), assetTypes = useTypedSelector((state) => state.assets.assetTypes), searchFacets = useTypedSelector((state) => state.search.facets), selectedDocument = useTypedSelector((state) => state.selected.document), popoverProps = usePortalPopoverProps(), { creditLine } = useToolOptions(), isTool = !selectedDocument, filteredFacets = FACETS.filter((facet) => !creditLine?.enabled && facet?.type === "string" && facet?.name === "creditLine" ? !1 : facet.type === "group" || facet.type === "divider" ? !0 : isTool ? !facet?.selectOnly : facet.assetTypes.filter(
2259
+ const dispatch = useDispatch(), assetTypes = useTypedSelector((state) => state.assets.assetTypes), searchFacets = useTypedSelector((state) => state.search.facets), selectedDocument = useTypedSelector((state) => state.selected.document), popoverProps = usePortalPopoverProps(), { creditLine } = useToolOptions(), isTool = !selectedDocument, filteredFacets = FACETS.filter((facet) => !creditLine?.enabled && facet?.type === "string" && facet?.name === "creditLine" ? !1 : facet.type === "group" || facet.type === "divider" ? !0 : isTool ? !facet?.selectOnly : facet.assetTypes.filter(
2252
2260
  (assetType) => assetTypes.includes(assetType)
2253
2261
  ).length > 0).filter((facet, index, facets) => {
2254
2262
  const previousFacet = facets[index - 1];
2255
2263
  return !(facet.type === "divider" && (index === 0 || index === facets.length - 1) || facet.type === "divider" && previousFacet?.type === "divider");
2256
- }), hasSearchFacets = filteredFacets.length > 0, renderMenuFacets = (facets, level = 0) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: facets?.map((facet, index) => {
2264
+ }), hasSearchFacets = filteredFacets.length > 0, renderMenuFacets = (facets, level = 0) => /* @__PURE__ */ jsx(Fragment, { children: facets?.map((facet, index) => {
2257
2265
  if (facet.type === "divider")
2258
- return /* @__PURE__ */ jsxRuntime.jsx(ui.MenuDivider, {}, index);
2266
+ return /* @__PURE__ */ jsx(MenuDivider, {}, index);
2259
2267
  if (facet.type === "group")
2260
- return /* @__PURE__ */ jsxRuntime.jsx(ui.MenuGroup, { text: facet.title, title: facet.title, children: renderMenuFacets(facet.facets, level + 1) }, `group-${level}-${index}`);
2268
+ return /* @__PURE__ */ jsx(MenuGroup, { text: facet.title, title: facet.title, children: renderMenuFacets(facet.facets, level + 1) }, `group-${level}-${index}`);
2261
2269
  if (facet) {
2262
2270
  const disabled = !facet.operatorTypes && !!searchFacets.find((v) => v.name === facet.name);
2263
- return /* @__PURE__ */ jsxRuntime.jsx(
2264
- ui.MenuItem,
2271
+ return /* @__PURE__ */ jsx(
2272
+ MenuItem,
2265
2273
  {
2266
2274
  disabled,
2267
2275
  fontSize: 1,
@@ -2274,16 +2282,16 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2274
2282
  }
2275
2283
  return null;
2276
2284
  }) });
2277
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { children: [
2278
- /* @__PURE__ */ jsxRuntime.jsx(
2279
- ui.MenuButton,
2285
+ return /* @__PURE__ */ jsxs(Flex, { children: [
2286
+ /* @__PURE__ */ jsx(
2287
+ MenuButton,
2280
2288
  {
2281
- button: /* @__PURE__ */ jsxRuntime.jsx(
2282
- ui.Button,
2289
+ button: /* @__PURE__ */ jsx(
2290
+ Button,
2283
2291
  {
2284
2292
  disabled: !hasSearchFacets,
2285
2293
  fontSize: 1,
2286
- icon: icons.AddIcon,
2294
+ icon: AddIcon,
2287
2295
  mode: "bleed",
2288
2296
  space: 2,
2289
2297
  text: "Add filter",
@@ -2291,15 +2299,15 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2291
2299
  }
2292
2300
  ),
2293
2301
  id: "facets",
2294
- menu: /* @__PURE__ */ jsxRuntime.jsx(ui.Menu, { children: renderMenuFacets(filteredFacets) }),
2302
+ menu: /* @__PURE__ */ jsx(Menu$2, { children: renderMenuFacets(filteredFacets) }),
2295
2303
  popover: {
2296
2304
  ...popoverProps,
2297
2305
  placement: "right-start"
2298
2306
  }
2299
2307
  }
2300
2308
  ),
2301
- searchFacets.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
2302
- ui.Button,
2309
+ searchFacets.length > 0 && /* @__PURE__ */ jsx(
2310
+ Button,
2303
2311
  {
2304
2312
  fontSize: 1,
2305
2313
  mode: "bleed",
@@ -2308,7 +2316,7 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2308
2316
  }
2309
2317
  )
2310
2318
  ] });
2311
- }, TagIcon = () => /* @__PURE__ */ jsxRuntime.jsxs(
2319
+ }, TagIcon = () => /* @__PURE__ */ jsxs(
2312
2320
  "svg",
2313
2321
  {
2314
2322
  "data-sanity-icon": "media__tag",
@@ -2319,7 +2327,7 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2319
2327
  viewBox: "0 0 512 512",
2320
2328
  width: "1em",
2321
2329
  children: [
2322
- /* @__PURE__ */ jsxRuntime.jsx(
2330
+ /* @__PURE__ */ jsx(
2323
2331
  "path",
2324
2332
  {
2325
2333
  d: "M435.25 48h-122.9a14.46 14.46 0 00-10.2 4.2L56.45 297.9a28.85 28.85 0 000 40.7l117 117a28.85 28.85 0 0040.7 0L459.75 210a14.46 14.46 0 004.2-10.2v-123a28.66 28.66 0 00-28.7-28.8z",
@@ -2329,29 +2337,29 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2329
2337
  strokeWidth: "32"
2330
2338
  }
2331
2339
  ),
2332
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M384 160a32 32 0 1132-32 32 32 0 01-32 32z" })
2340
+ /* @__PURE__ */ jsx("path", { d: "M384 160a32 32 0 1132-32 32 32 0 01-32 32z" })
2333
2341
  ]
2334
2342
  }
2335
2343
  ), TextInputSearch = () => {
2336
- const searchQuery = useTypedSelector((state) => state.search.query), dispatch = reactRedux.useDispatch(), handleChange = (e) => {
2344
+ const searchQuery = useTypedSelector((state) => state.search.query), dispatch = useDispatch(), handleChange = (e) => {
2337
2345
  dispatch(searchActions.querySet({ searchQuery: e.currentTarget.value }));
2338
2346
  }, handleClear = () => {
2339
2347
  dispatch(searchActions.querySet({ searchQuery: "" }));
2340
2348
  };
2341
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: { position: "relative" }, children: [
2342
- /* @__PURE__ */ jsxRuntime.jsx(
2343
- ui.TextInput,
2349
+ return /* @__PURE__ */ jsxs(Box, { style: { position: "relative" }, children: [
2350
+ /* @__PURE__ */ jsx(
2351
+ TextInput,
2344
2352
  {
2345
2353
  fontSize: 1,
2346
- icon: icons.SearchIcon,
2354
+ icon: SearchIcon,
2347
2355
  onChange: handleChange,
2348
2356
  placeholder: "Search",
2349
2357
  radius: 2,
2350
2358
  value: searchQuery
2351
2359
  }
2352
2360
  ),
2353
- searchQuery.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
2354
- ui.Flex,
2361
+ searchQuery.length > 0 && /* @__PURE__ */ jsx(
2362
+ Flex,
2355
2363
  {
2356
2364
  align: "center",
2357
2365
  justify: "center",
@@ -2367,20 +2375,20 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2367
2375
  zIndex: 1
2368
2376
  // force stacking context
2369
2377
  },
2370
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, {})
2378
+ children: /* @__PURE__ */ jsx(CloseIcon, {})
2371
2379
  }
2372
2380
  )
2373
2381
  ] });
2374
2382
  }, Controls = () => {
2375
- const dispatch = reactRedux.useDispatch(), fetching = useTypedSelector((state) => state.assets.fetching), pageIndex = useTypedSelector((state) => state.assets.pageIndex), searchFacets = useTypedSelector((state) => state.search.facets), tagsPanelVisible = useTypedSelector((state) => state.tags.panelVisible), mediaIndex = ui.useMediaIndex(), handleShowSearchFacetDialog = () => {
2383
+ const dispatch = useDispatch(), fetching = useTypedSelector((state) => state.assets.fetching), pageIndex = useTypedSelector((state) => state.assets.pageIndex), searchFacets = useTypedSelector((state) => state.search.facets), tagsPanelVisible = useTypedSelector((state) => state.tags.panelVisible), mediaIndex = useMediaIndex(), handleShowSearchFacetDialog = () => {
2376
2384
  dispatch(dialogActions.showSearchFacets());
2377
2385
  }, handleShowTagsDialog = () => {
2378
2386
  dispatch(dialogActions.showTags());
2379
2387
  }, toggleTagsPanelToggle = () => {
2380
2388
  dispatch(tagsActions.panelVisibleSet({ panelVisible: !tagsPanelVisible }));
2381
2389
  };
2382
- return /* @__PURE__ */ jsxRuntime.jsxs(
2383
- ui.Box,
2390
+ return /* @__PURE__ */ jsxs(
2391
+ Box,
2384
2392
  {
2385
2393
  paddingY: 2,
2386
2394
  style: {
@@ -2388,14 +2396,14 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2388
2396
  zIndex: 2
2389
2397
  },
2390
2398
  children: [
2391
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginBottom: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
2392
- ui.Flex,
2399
+ /* @__PURE__ */ jsx(Box, { marginBottom: 2, children: /* @__PURE__ */ jsx(
2400
+ Flex,
2393
2401
  {
2394
2402
  align: "flex-start",
2395
2403
  direction: ["column", "column", "column", "column", "row"],
2396
2404
  justify: "space-between",
2397
- children: /* @__PURE__ */ jsxRuntime.jsxs(
2398
- ui.Flex,
2405
+ children: /* @__PURE__ */ jsxs(
2406
+ Flex,
2399
2407
  {
2400
2408
  flex: 1,
2401
2409
  style: {
@@ -2407,14 +2415,14 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2407
2415
  width: "100%"
2408
2416
  },
2409
2417
  children: [
2410
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginX: 2, style: { minWidth: "200px" }, children: /* @__PURE__ */ jsxRuntime.jsx(TextInputSearch, {}) }),
2411
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { display: ["none", "none", "block"], children: [
2412
- /* @__PURE__ */ jsxRuntime.jsx(SearchFacets, {}),
2413
- /* @__PURE__ */ jsxRuntime.jsx(SearchFacetsControl, {})
2418
+ /* @__PURE__ */ jsx(Box, { marginX: 2, style: { minWidth: "200px" }, children: /* @__PURE__ */ jsx(TextInputSearch, {}) }),
2419
+ /* @__PURE__ */ jsxs(Box, { display: ["none", "none", "block"], children: [
2420
+ /* @__PURE__ */ jsx(SearchFacets, {}),
2421
+ /* @__PURE__ */ jsx(SearchFacetsControl, {})
2414
2422
  ] }),
2415
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { display: ["block", "block", "none"], marginX: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 2, style: { whiteSpace: "nowrap" }, children: [
2416
- /* @__PURE__ */ jsxRuntime.jsx(
2417
- ui.Button,
2423
+ /* @__PURE__ */ jsx(Box, { display: ["block", "block", "none"], marginX: 2, children: /* @__PURE__ */ jsxs(Inline, { space: 2, style: { whiteSpace: "nowrap" }, children: [
2424
+ /* @__PURE__ */ jsx(
2425
+ Button,
2418
2426
  {
2419
2427
  fontSize: 1,
2420
2428
  mode: "ghost",
@@ -2423,8 +2431,8 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2423
2431
  tone: "primary"
2424
2432
  }
2425
2433
  ),
2426
- /* @__PURE__ */ jsxRuntime.jsx(
2427
- ui.Button,
2434
+ /* @__PURE__ */ jsx(
2435
+ Button,
2428
2436
  {
2429
2437
  fontSize: 1,
2430
2438
  mode: "ghost",
@@ -2439,15 +2447,15 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2439
2447
  )
2440
2448
  }
2441
2449
  ) }),
2442
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: ["space-between"], children: [
2443
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginX: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ButtonViewGroup, {}) }),
2444
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { marginX: 2, children: [
2445
- /* @__PURE__ */ jsxRuntime.jsx(OrderSelect, {}),
2446
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { display: ["none", "none", "block"], marginLeft: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
2447
- ui.Button,
2450
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Flex, { align: "center", justify: ["space-between"], children: [
2451
+ /* @__PURE__ */ jsx(Box, { marginX: 2, children: /* @__PURE__ */ jsx(ButtonViewGroup, {}) }),
2452
+ /* @__PURE__ */ jsxs(Flex, { marginX: 2, children: [
2453
+ /* @__PURE__ */ jsx(OrderSelect, {}),
2454
+ /* @__PURE__ */ jsx(Box, { display: ["none", "none", "block"], marginLeft: 2, children: /* @__PURE__ */ jsx(
2455
+ Button,
2448
2456
  {
2449
2457
  fontSize: 1,
2450
- icon: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { transform: "scale(0.75)" }, children: /* @__PURE__ */ jsxRuntime.jsx(TagIcon, {}) }),
2458
+ icon: /* @__PURE__ */ jsx(Box, { style: { transform: "scale(0.75)" }, children: /* @__PURE__ */ jsx(TagIcon, {}) }),
2451
2459
  onClick: toggleTagsPanelToggle,
2452
2460
  mode: tagsPanelVisible ? "default" : "ghost",
2453
2461
  text: tagsPanelVisible ? "Tags" : ""
@@ -2455,14 +2463,14 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2455
2463
  ) })
2456
2464
  ] })
2457
2465
  ] }) }),
2458
- /* @__PURE__ */ jsxRuntime.jsx(Progress, { loading: fetching }, pageIndex)
2466
+ /* @__PURE__ */ jsx(Progress, { loading: fetching }, pageIndex)
2459
2467
  ]
2460
2468
  }
2461
2469
  );
2462
2470
  }, initialState$3 = {
2463
2471
  badConnection: !1,
2464
2472
  enabled: !1
2465
- }, debugSlice = toolkit.createSlice({
2473
+ }, debugSlice = createSlice({
2466
2474
  name: "debug",
2467
2475
  initialState: initialState$3,
2468
2476
  reducers: {
@@ -2476,14 +2484,14 @@ const Container$1 = styledComponents.styled(ui.Box)(({ $scheme, theme }) => styl
2476
2484
  }), debugActions = { ...debugSlice.actions };
2477
2485
  var debugReducer = debugSlice.reducer;
2478
2486
  const DebugControls = () => {
2479
- const dispatch = reactRedux.useDispatch(), badConnection = useTypedSelector((state) => state.debug.badConnection), debugEnabled = useTypedSelector((state) => state.debug.enabled), handleChange = (e) => {
2487
+ const dispatch = useDispatch(), badConnection = useTypedSelector((state) => state.debug.badConnection), debugEnabled = useTypedSelector((state) => state.debug.enabled), handleChange = (e) => {
2480
2488
  const checked = e.target.checked;
2481
2489
  dispatch(debugActions.setBadConnection(checked));
2482
2490
  };
2483
2491
  return useKeyPress("alt+ctrl+shift+/", () => {
2484
2492
  dispatch(debugActions.toggleEnabled());
2485
- }), debugEnabled ? /* @__PURE__ */ jsxRuntime.jsx(
2486
- ui.Box,
2493
+ }), debugEnabled ? /* @__PURE__ */ jsx(
2494
+ Box,
2487
2495
  {
2488
2496
  padding: 4,
2489
2497
  style: {
@@ -2493,18 +2501,18 @@ const DebugControls = () => {
2493
2501
  position: "fixed",
2494
2502
  width: "100%"
2495
2503
  },
2496
- children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
2497
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginRight: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(icons.PlugIcon, {}) }) }),
2498
- /* @__PURE__ */ jsxRuntime.jsx(
2499
- ui.Tooltip,
2504
+ children: /* @__PURE__ */ jsxs(Flex, { align: "center", children: [
2505
+ /* @__PURE__ */ jsx(Box, { marginRight: 3, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsx(PlugIcon, {}) }) }),
2506
+ /* @__PURE__ */ jsx(
2507
+ Tooltip,
2500
2508
  {
2501
2509
  animate: !0,
2502
- content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: badConnection ? "Bad connection: +3000ms & 50% chance to fail" : "No connection throttling" }) }),
2510
+ content: /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: badConnection ? "Bad connection: +3000ms & 50% chance to fail" : "No connection throttling" }) }),
2503
2511
  fallbackPlacements: ["right", "left"],
2504
2512
  placement: "bottom",
2505
2513
  portal: !0,
2506
- children: /* @__PURE__ */ jsxRuntime.jsx(
2507
- ui.Switch,
2514
+ children: /* @__PURE__ */ jsx(
2515
+ Switch,
2508
2516
  {
2509
2517
  checked: badConnection,
2510
2518
  onChange: handleChange,
@@ -2521,33 +2529,33 @@ const DebugControls = () => {
2521
2529
  };
2522
2530
  function localizedStringSchema(locales) {
2523
2531
  if (!locales || locales.length === 0)
2524
- return z__namespace.string().trim().optional();
2532
+ return z.string().trim().optional();
2525
2533
  const shape = {};
2526
2534
  for (const locale of locales)
2527
- shape[locale.id] = z__namespace.string().trim().optional();
2528
- return z__namespace.object(shape).passthrough();
2535
+ shape[locale.id] = z.string().trim().optional();
2536
+ return z.object(shape).passthrough();
2529
2537
  }
2530
- const tagOptionSchema = z__namespace.object({
2531
- label: z__namespace.string().trim().min(1, { message: "Label cannot be empty" }),
2532
- value: z__namespace.string().trim().min(1, { message: "Value cannot be empty" })
2538
+ const tagOptionSchema = z.object({
2539
+ label: z.string().trim().min(1, { message: "Label cannot be empty" }),
2540
+ value: z.string().trim().min(1, { message: "Value cannot be empty" })
2533
2541
  });
2534
2542
  function getAssetFormSchema(locales) {
2535
- return z__namespace.object({
2543
+ return z.object({
2536
2544
  altText: localizedStringSchema(locales),
2537
2545
  creditLine: localizedStringSchema(locales),
2538
2546
  description: localizedStringSchema(locales),
2539
- opt: z__namespace.object({
2540
- media: z__namespace.object({
2541
- tags: z__namespace.array(tagOptionSchema).nullable()
2547
+ opt: z.object({
2548
+ media: z.object({
2549
+ tags: z.array(tagOptionSchema).nullable()
2542
2550
  })
2543
2551
  }),
2544
- originalFilename: z__namespace.string().trim().min(1, { message: "Filename cannot be empty" }),
2552
+ originalFilename: z.string().trim().min(1, { message: "Filename cannot be empty" }),
2545
2553
  title: localizedStringSchema(locales)
2546
2554
  });
2547
2555
  }
2548
2556
  getAssetFormSchema();
2549
- const tagFormSchema = z__namespace.object({
2550
- name: z__namespace.string().min(1, { message: "Name cannot be empty" })
2557
+ const tagFormSchema = z.object({
2558
+ name: z.string().min(1, { message: "Name cannot be empty" })
2551
2559
  });
2552
2560
  function getUniqueDocuments(documents) {
2553
2561
  const draftIds = documents.reduce(
@@ -2566,33 +2574,33 @@ const imageDprUrl = (asset, options) => {
2566
2574
  return typeof val == "object" && val !== null && val.constructor !== Array ? acc[key] = sanitizeFormData(val) : val === "" || typeof val > "u" || val?.length === 0 ? acc[key] = null : typeof val == "string" && val ? acc[key] = formData[key].trim() : acc[key] = formData[key], acc;
2567
2575
  }, {}), isFileAsset = (asset) => asset._type === "sanity.fileAsset", isImageAsset = (asset) => asset._type === "sanity.imageAsset";
2568
2576
  function zodFormResolver(schema) {
2569
- return zod.zodResolver(
2577
+ return zodResolver(
2570
2578
  schema
2571
2579
  );
2572
2580
  }
2573
2581
  const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asset.metadata.dimensions.height}px`, ButtonAssetCopy = ({ disabled, url }) => {
2574
- const popoverProps = usePortalPopoverProps(), refPopoverTimeout = react.useRef(null), [popoverVisible, setPopoverVisible] = react.useState(!1), handleClick = () => {
2575
- refPopoverTimeout.current && clearTimeout(refPopoverTimeout.current), setPopoverVisible(!0), copy__default.default(url), refPopoverTimeout.current = setTimeout(() => {
2582
+ const popoverProps = usePortalPopoverProps(), refPopoverTimeout = useRef(null), [popoverVisible, setPopoverVisible] = useState(!1), handleClick = () => {
2583
+ refPopoverTimeout.current && clearTimeout(refPopoverTimeout.current), setPopoverVisible(!0), copy(url), refPopoverTimeout.current = setTimeout(() => {
2576
2584
  setPopoverVisible(!1);
2577
2585
  }, 1250);
2578
2586
  };
2579
- return react.useEffect(() => () => {
2587
+ return useEffect(() => () => {
2580
2588
  refPopoverTimeout.current && clearTimeout(refPopoverTimeout.current);
2581
- }, []), /* @__PURE__ */ jsxRuntime.jsx(
2582
- ui.Popover,
2589
+ }, []), /* @__PURE__ */ jsx(
2590
+ Popover,
2583
2591
  {
2584
- content: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: "Copied!" }),
2592
+ content: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: "Copied!" }),
2585
2593
  open: popoverVisible,
2586
2594
  padding: 2,
2587
2595
  placement: "top",
2588
2596
  radius: 1,
2589
2597
  ...popoverProps,
2590
- children: /* @__PURE__ */ jsxRuntime.jsx(
2591
- ui.Button,
2598
+ children: /* @__PURE__ */ jsx(
2599
+ Button,
2592
2600
  {
2593
2601
  disabled,
2594
2602
  fontSize: 1,
2595
- icon: icons.ClipboardIcon,
2603
+ icon: ClipboardIcon,
2596
2604
  mode: "ghost",
2597
2605
  onClick: handleClick,
2598
2606
  text: "Copy URL"
@@ -2600,9 +2608,9 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2600
2608
  )
2601
2609
  }
2602
2610
  );
2603
- }, Row = ({ label, value }) => /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "space-between", children: [
2604
- /* @__PURE__ */ jsxRuntime.jsx(
2605
- ui.Text,
2611
+ }, Row = ({ label, value }) => /* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
2612
+ /* @__PURE__ */ jsx(
2613
+ Text,
2606
2614
  {
2607
2615
  size: 1,
2608
2616
  style: {
@@ -2613,8 +2621,8 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2613
2621
  children: label
2614
2622
  }
2615
2623
  ),
2616
- /* @__PURE__ */ jsxRuntime.jsx(
2617
- ui.Text,
2624
+ /* @__PURE__ */ jsx(
2625
+ Text,
2618
2626
  {
2619
2627
  size: 1,
2620
2628
  style: {
@@ -2630,16 +2638,16 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2630
2638
  const { asset, item } = props, exif = asset?.metadata?.exif, handleDownload = () => {
2631
2639
  window.location.href = `${asset.url}?dl=${asset.originalFilename}`;
2632
2640
  };
2633
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { marginTop: 3, children: [
2634
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
2635
- /* @__PURE__ */ jsxRuntime.jsx(Row, { label: "Size", value: filesize__default.default(asset?.size, { base: 10, round: 0 }) }),
2636
- /* @__PURE__ */ jsxRuntime.jsx(Row, { label: "MIME type", value: asset?.mimeType }),
2637
- /* @__PURE__ */ jsxRuntime.jsx(Row, { label: "Extension", value: (asset?.extension).toUpperCase() }),
2638
- isImageAsset(asset) && /* @__PURE__ */ jsxRuntime.jsx(Row, { label: "Dimensions", value: getAssetResolution(asset) })
2641
+ return /* @__PURE__ */ jsxs(Box, { marginTop: 3, children: [
2642
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
2643
+ /* @__PURE__ */ jsx(Row, { label: "Size", value: filesize(asset?.size, { base: 10, round: 0 }) }),
2644
+ /* @__PURE__ */ jsx(Row, { label: "MIME type", value: asset?.mimeType }),
2645
+ /* @__PURE__ */ jsx(Row, { label: "Extension", value: (asset?.extension).toUpperCase() }),
2646
+ isImageAsset(asset) && /* @__PURE__ */ jsx(Row, { label: "Dimensions", value: getAssetResolution(asset) })
2639
2647
  ] }) }),
2640
- exif && (exif.DateTimeOriginal || exif.FNumber || exif.FocalLength || exif.ExposureTime || exif.ISO) && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2641
- /* @__PURE__ */ jsxRuntime.jsx(
2642
- ui.Box,
2648
+ exif && (exif.DateTimeOriginal || exif.FNumber || exif.FocalLength || exif.ExposureTime || exif.ISO) && /* @__PURE__ */ jsxs(Fragment, { children: [
2649
+ /* @__PURE__ */ jsx(
2650
+ Box,
2643
2651
  {
2644
2652
  marginY: 4,
2645
2653
  style: {
@@ -2649,48 +2657,48 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2649
2657
  }
2650
2658
  }
2651
2659
  ),
2652
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
2653
- exif.ISO && /* @__PURE__ */ jsxRuntime.jsx(Row, { label: "ISO", value: exif.ISO }),
2654
- exif.FNumber && /* @__PURE__ */ jsxRuntime.jsx(Row, { label: "Aperture", value: `\u0192/${exif.FNumber}` }),
2655
- exif.FocalLength && /* @__PURE__ */ jsxRuntime.jsx(Row, { label: "Focal length", value: `${exif.FocalLength}mm` }),
2656
- exif.ExposureTime && /* @__PURE__ */ jsxRuntime.jsx(Row, { label: "Exposure time", value: `1/${1 / exif.ExposureTime}` }),
2657
- exif.DateTimeOriginal && /* @__PURE__ */ jsxRuntime.jsx(
2660
+ /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
2661
+ exif.ISO && /* @__PURE__ */ jsx(Row, { label: "ISO", value: exif.ISO }),
2662
+ exif.FNumber && /* @__PURE__ */ jsx(Row, { label: "Aperture", value: `\u0192/${exif.FNumber}` }),
2663
+ exif.FocalLength && /* @__PURE__ */ jsx(Row, { label: "Focal length", value: `${exif.FocalLength}mm` }),
2664
+ exif.ExposureTime && /* @__PURE__ */ jsx(Row, { label: "Exposure time", value: `1/${1 / exif.ExposureTime}` }),
2665
+ exif.DateTimeOriginal && /* @__PURE__ */ jsx(
2658
2666
  Row,
2659
2667
  {
2660
2668
  label: "Original date",
2661
- value: dateFns.format(new Date(exif.DateTimeOriginal), "PPp")
2669
+ value: format(new Date(exif.DateTimeOriginal), "PPp")
2662
2670
  }
2663
2671
  )
2664
2672
  ] }) })
2665
2673
  ] }),
2666
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 5, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 2, children: [
2667
- /* @__PURE__ */ jsxRuntime.jsx(
2668
- ui.Button,
2674
+ /* @__PURE__ */ jsx(Box, { marginTop: 5, children: /* @__PURE__ */ jsxs(Inline, { space: 2, children: [
2675
+ /* @__PURE__ */ jsx(
2676
+ Button,
2669
2677
  {
2670
2678
  disabled: !item || item?.updating,
2671
2679
  fontSize: 1,
2672
- icon: icons.DownloadIcon,
2680
+ icon: DownloadIcon,
2673
2681
  mode: "ghost",
2674
2682
  onClick: handleDownload,
2675
2683
  text: "Download"
2676
2684
  }
2677
2685
  ),
2678
- /* @__PURE__ */ jsxRuntime.jsx(ButtonAssetCopy, { disabled: !item || item?.updating, url: asset.url })
2686
+ /* @__PURE__ */ jsx(ButtonAssetCopy, { disabled: !item || item?.updating, url: asset.url })
2679
2687
  ] }) })
2680
2688
  ] });
2681
- }, Dialog = (props) => /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { ...props, style: { position: "fixed" } }), DocumentList = ({ documents, isLoading }) => {
2682
- const schema = sanity.useSchema();
2683
- return isLoading ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: "Loading..." }) : documents.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: "No documents are referencing this asset" }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { flex: 1, marginBottom: 2, padding: 2, radius: 2, shadow: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { space: 2, children: documents?.map((doc) => /* @__PURE__ */ jsxRuntime.jsx(ReferringDocument, { doc, schemaType: schema.get(doc._type) }, doc._id)) }) });
2689
+ }, Dialog = (props) => /* @__PURE__ */ jsx(Dialog$1, { ...props, style: { position: "fixed" } }), DocumentList = ({ documents, isLoading }) => {
2690
+ const schema = useSchema();
2691
+ return isLoading ? /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: "Loading..." }) : documents.length === 0 ? /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: "No documents are referencing this asset" }) : /* @__PURE__ */ jsx(Card, { flex: 1, marginBottom: 2, padding: 2, radius: 2, shadow: 1, children: /* @__PURE__ */ jsx(Stack, { space: 2, children: documents?.map((doc) => /* @__PURE__ */ jsx(ReferringDocument, { doc, schemaType: schema.get(doc._type) }, doc._id)) }) });
2684
2692
  }, ReferringDocument = (props) => {
2685
- const { doc, schemaType } = props, { onClick } = router.useIntentLink({
2693
+ const { doc, schemaType } = props, { onClick } = useIntentLink({
2686
2694
  intent: "edit",
2687
2695
  params: { id: doc._id }
2688
2696
  });
2689
- return schemaType ? /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { mode: "bleed", onClick, padding: 2, style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(sanity.Preview, { layout: "default", schemaType, value: doc }) }, doc._id) : /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 1, children: [
2697
+ return schemaType ? /* @__PURE__ */ jsx(Button, { mode: "bleed", onClick, padding: 2, style: { width: "100%" }, children: /* @__PURE__ */ jsx(Preview, { layout: "default", schemaType, value: doc }) }, doc._id) : /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsxs(Text, { size: 1, children: [
2690
2698
  "A document of the unknown type ",
2691
- /* @__PURE__ */ jsxRuntime.jsx("em", { children: doc._type })
2699
+ /* @__PURE__ */ jsx("em", { children: doc._type })
2692
2700
  ] }) });
2693
- }, Container = styledComponents.styled(ui.Box)(({ theme }) => styledComponents.css`
2701
+ }, Container = styled(Box)(({ theme }) => css`
2694
2702
  text {
2695
2703
  font-family: ${theme.sanity.fonts.text.family} !important;
2696
2704
  font-size: 8px !important;
@@ -2698,16 +2706,16 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2698
2706
  }
2699
2707
  `), FileIcon = (props) => {
2700
2708
  const { extension, onClick, width } = props;
2701
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { align: "center", justify: "center", onClick, style: { height: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(Container, { style: { width }, children: extension ? /* @__PURE__ */ jsxRuntime.jsx(
2702
- reactFileIcon.FileIcon,
2709
+ return /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", onClick, style: { height: "100%" }, children: /* @__PURE__ */ jsx(Container, { style: { width }, children: extension ? /* @__PURE__ */ jsx(
2710
+ FileIcon$1,
2703
2711
  {
2704
2712
  extension,
2705
- ...reactFileIcon.defaultStyles[extension]
2713
+ ...defaultStyles[extension]
2706
2714
  }
2707
- ) : /* @__PURE__ */ jsxRuntime.jsx(reactFileIcon.FileIcon, {}) }) });
2715
+ ) : /* @__PURE__ */ jsx(FileIcon$1, {}) }) });
2708
2716
  }, FileAssetPreview = (props) => {
2709
2717
  const { asset } = props;
2710
- return asset.mimeType.search("audio") === 0 ? /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { align: "center", justify: "center", style: { height: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx("audio", { controls: !0, src: asset.url, style: { width: "100%" } }) }) : asset.mimeType.search("video") === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
2718
+ return asset.mimeType.search("audio") === 0 ? /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", style: { height: "100%" }, children: /* @__PURE__ */ jsx("audio", { controls: !0, src: asset.url, style: { width: "100%" } }) }) : asset.mimeType.search("video") === 0 ? /* @__PURE__ */ jsx(
2711
2719
  "video",
2712
2720
  {
2713
2721
  controls: !0,
@@ -2717,25 +2725,25 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2717
2725
  width: "100%"
2718
2726
  }
2719
2727
  }
2720
- ) : /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { extension: asset.extension, width: "50%" });
2728
+ ) : /* @__PURE__ */ jsx(FileIcon, { extension: asset.extension, width: "50%" });
2721
2729
  }, FormSubmitButton = (props) => {
2722
2730
  const { disabled, isValid, lastUpdated, onClick } = props;
2723
2731
  let content;
2724
- return isValid ? lastUpdated ? content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2732
+ return isValid ? lastUpdated ? content = /* @__PURE__ */ jsxs(Fragment, { children: [
2725
2733
  "Last updated",
2726
- /* @__PURE__ */ jsxRuntime.jsx("br", {}),
2734
+ /* @__PURE__ */ jsx("br", {}),
2727
2735
  " ",
2728
- dateFns.format(new Date(lastUpdated), "PPp")
2729
- ] }) : content = "No unpublished changes" : content = "There are validation errors that need to be fixed before this document can be published", /* @__PURE__ */ jsxRuntime.jsx(
2730
- ui.Tooltip,
2736
+ format(new Date(lastUpdated), "PPp")
2737
+ ] }) : content = "No unpublished changes" : content = "There are validation errors that need to be fixed before this document can be published", /* @__PURE__ */ jsx(
2738
+ Tooltip,
2731
2739
  {
2732
2740
  animate: !0,
2733
- content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, style: { maxWidth: "185px" }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: content }) }),
2741
+ content: /* @__PURE__ */ jsx(Box, { padding: 3, style: { maxWidth: "185px" }, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: content }) }),
2734
2742
  disabled: "ontouchstart" in window,
2735
2743
  placement: "top",
2736
2744
  portal: !0,
2737
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
2738
- ui.Button,
2745
+ children: /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
2746
+ Button,
2739
2747
  {
2740
2748
  disabled,
2741
2749
  fontSize: 1,
@@ -2746,7 +2754,7 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2746
2754
  ) })
2747
2755
  }
2748
2756
  );
2749
- }, Image$1 = styledComponents.styled.img`
2757
+ }, Image$1 = styled.img`
2750
2758
  --checkerboard-color: ${(props) => props.$scheme ? getSchemeColor(props.$scheme, "bg2") : "inherit"};
2751
2759
 
2752
2760
  display: block;
@@ -2754,7 +2762,7 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2754
2762
  height: 100%;
2755
2763
  object-fit: contain;
2756
2764
 
2757
- ${(props) => props.$showCheckerboard && styledComponents.css`
2765
+ ${(props) => props.$showCheckerboard && css`
2758
2766
  background-image:
2759
2767
  linear-gradient(45deg, var(--checkerboard-color) 25%, transparent 25%),
2760
2768
  linear-gradient(-45deg, var(--checkerboard-color) 25%, transparent 25%),
@@ -2767,7 +2775,7 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2767
2775
  10px -10px,
2768
2776
  -10px 0;
2769
2777
  `}
2770
- `, { radius: themeRadius, space: themeSpace } = ui.studioTheme, reactSelectStyles = (scheme) => ({
2778
+ `, { radius: themeRadius, space: themeSpace } = studioTheme, reactSelectStyles = (scheme) => ({
2771
2779
  control: (styles, { isFocused }) => {
2772
2780
  let boxShadow = "inset 0 0 0 1px var(--card-border-color)";
2773
2781
  return isFocused && (boxShadow = `inset 0 0 0 1px ${getSchemeColor(scheme, "inputEnabledBorder")},
@@ -2782,7 +2790,7 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2782
2790
  margin: 0,
2783
2791
  minHeight: "35px",
2784
2792
  outline: "none",
2785
- padding: ui.rem(themeSpace[1]),
2793
+ padding: rem(themeSpace[1]),
2786
2794
  transition: "none",
2787
2795
  "&:hover": {
2788
2796
  boxShadow: `inset 0 0 0 1px ${getSchemeColor(scheme, "inputHoveredBorder")}`
@@ -2796,8 +2804,8 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2796
2804
  input: (styles) => ({
2797
2805
  ...styles,
2798
2806
  color: "var(--card-fg-color)",
2799
- fontFamily: ui.studioTheme.fonts.text.family,
2800
- marginLeft: ui.rem(themeSpace[2])
2807
+ fontFamily: studioTheme.fonts.text.family,
2808
+ marginLeft: rem(themeSpace[2])
2801
2809
  }),
2802
2810
  menuList: (styles) => ({
2803
2811
  ...styles
@@ -2824,7 +2832,7 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2824
2832
  }),
2825
2833
  noOptionsMessage: (styles) => ({
2826
2834
  ...styles,
2827
- fontFamily: ui.studioTheme.fonts.text.family,
2835
+ fontFamily: studioTheme.fonts.text.family,
2828
2836
  lineHeight: "1em"
2829
2837
  }),
2830
2838
  option: (styles, { isFocused }) => ({
@@ -2832,7 +2840,7 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2832
2840
  backgroundColor: isFocused ? getSchemeColor(scheme, "spotBlue") : "transparent",
2833
2841
  borderRadius: themeRadius[2],
2834
2842
  color: isFocused ? getSchemeColor(scheme, "bg") : "inherit",
2835
- padding: `${ui.rem(themeSpace[1])} ${ui.rem(themeSpace[2])}`,
2843
+ padding: `${rem(themeSpace[1])} ${rem(themeSpace[2])}`,
2836
2844
  "&:hover": {
2837
2845
  backgroundColor: getSchemeColor(scheme, "spotBlue"),
2838
2846
  color: getSchemeColor(scheme, "bg")
@@ -2840,33 +2848,33 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2840
2848
  }),
2841
2849
  placeholder: (styles) => ({
2842
2850
  ...styles,
2843
- marginLeft: ui.rem(themeSpace[2])
2851
+ marginLeft: rem(themeSpace[2])
2844
2852
  }),
2845
2853
  valueContainer: (styles) => ({
2846
2854
  ...styles,
2847
2855
  margin: 0,
2848
2856
  padding: 0
2849
2857
  })
2850
- }), DropdownIndicator = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDownIcon, {}) }) }) }), Menu = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.Menu, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { radius: 1, shadow: 2, children: props.children }) }), MenuList = (props) => {
2858
+ }), DropdownIndicator = (props) => /* @__PURE__ */ jsx(components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(Box, { paddingX: 2, children: /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(ChevronDownIcon, {}) }) }) }), Menu = (props) => /* @__PURE__ */ jsx(components.Menu, { ...props, children: /* @__PURE__ */ jsx(Card, { radius: 1, shadow: 2, children: props.children }) }), MenuList = (props) => {
2851
2859
  const { children } = props, MAX_ROWS = 5, OPTION_HEIGHT = 37;
2852
2860
  if (Array.isArray(children)) {
2853
2861
  const height = children.length > MAX_ROWS ? OPTION_HEIGHT * MAX_ROWS : children.length * OPTION_HEIGHT;
2854
- return /* @__PURE__ */ jsxRuntime.jsx(
2855
- reactVirtuoso.Virtuoso,
2862
+ return /* @__PURE__ */ jsx(
2863
+ Virtuoso,
2856
2864
  {
2857
2865
  className: "media__custom-scrollbar",
2858
2866
  itemContent: (index) => {
2859
2867
  const item = children[index];
2860
- return /* @__PURE__ */ jsxRuntime.jsx(Option, { ...item.props });
2868
+ return /* @__PURE__ */ jsx(Option, { ...item.props });
2861
2869
  },
2862
2870
  style: { height },
2863
2871
  totalCount: children.length
2864
2872
  }
2865
2873
  );
2866
2874
  }
2867
- return /* @__PURE__ */ jsxRuntime.jsx(Select.components.MenuList, { ...props, children });
2868
- }, MultiValueLabel = (props) => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, paddingRight: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, weight: "medium", children: /* @__PURE__ */ jsxRuntime.jsx(Select.components.MultiValueLabel, { ...props }) }) }), MultiValueRemove = (props) => /* @__PURE__ */ jsxRuntime.jsx(Select.components.MultiValueRemove, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, { color: "#1f2123" }) }), Option = (props) => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 1, paddingY: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Select.components.Option, { ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
2869
- props.data.__isNew__ && /* @__PURE__ */ jsxRuntime.jsx(icons.AddIcon, { style: { marginRight: "3px" } }),
2875
+ return /* @__PURE__ */ jsx(components.MenuList, { ...props, children });
2876
+ }, MultiValueLabel = (props) => /* @__PURE__ */ jsx(Box, { padding: 2, paddingRight: 1, children: /* @__PURE__ */ jsx(Text, { size: 1, weight: "medium", children: /* @__PURE__ */ jsx(components.MultiValueLabel, { ...props }) }) }), MultiValueRemove = (props) => /* @__PURE__ */ jsx(components.MultiValueRemove, { ...props, children: /* @__PURE__ */ jsx(CloseIcon, { color: "#1f2123" }) }), Option = (props) => /* @__PURE__ */ jsx(Box, { paddingX: 1, paddingY: 1, children: /* @__PURE__ */ jsx(components.Option, { ...props, children: /* @__PURE__ */ jsxs(Flex, { align: "center", children: [
2877
+ props.data.__isNew__ && /* @__PURE__ */ jsx(AddIcon, { style: { marginRight: "3px" } }),
2870
2878
  props.children
2871
2879
  ] }) }) }), reactSelectComponents = {
2872
2880
  DropdownIndicator,
@@ -2876,29 +2884,29 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2876
2884
  MultiValueLabel,
2877
2885
  MultiValueRemove,
2878
2886
  Option
2879
- }, StyledErrorOutlineIcon = styledComponents.styled(icons.ErrorOutlineIcon)(({ theme }) => ({
2887
+ }, StyledErrorOutlineIcon = styled(ErrorOutlineIcon)(({ theme }) => ({
2880
2888
  color: theme.sanity.color.spot.red
2881
2889
  })), FormFieldInputLabel = (props) => {
2882
2890
  const { description, error, label, name } = props;
2883
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2884
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginY: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 2, children: [
2885
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "label", htmlFor: name, size: 1, weight: "semibold", children: label }),
2886
- error && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
2887
- ui.Tooltip,
2891
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2892
+ /* @__PURE__ */ jsx(Box, { marginY: 3, children: /* @__PURE__ */ jsxs(Inline, { space: 2, children: [
2893
+ /* @__PURE__ */ jsx(Text, { as: "label", htmlFor: name, size: 1, weight: "semibold", children: label }),
2894
+ error && /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(
2895
+ Tooltip,
2888
2896
  {
2889
2897
  animate: !0,
2890
- content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { muted: !0, size: 1, children: [
2891
- /* @__PURE__ */ jsxRuntime.jsx(StyledErrorOutlineIcon, { style: { marginRight: "0.1em" } }),
2898
+ content: /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsxs(Text, { muted: !0, size: 1, children: [
2899
+ /* @__PURE__ */ jsx(StyledErrorOutlineIcon, { style: { marginRight: "0.1em" } }),
2892
2900
  error
2893
2901
  ] }) }),
2894
2902
  fallbackPlacements: ["top", "left"],
2895
2903
  placement: "right",
2896
2904
  portal: !0,
2897
- children: /* @__PURE__ */ jsxRuntime.jsx(StyledErrorOutlineIcon, {})
2905
+ children: /* @__PURE__ */ jsx(StyledErrorOutlineIcon, {})
2898
2906
  }
2899
2907
  ) })
2900
2908
  ] }) }),
2901
- description && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginY: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { htmlFor: name, muted: !0, size: 1, children: description }) })
2909
+ description && /* @__PURE__ */ jsx(Box, { marginY: 3, children: /* @__PURE__ */ jsx(Text, { htmlFor: name, muted: !0, size: 1, children: description }) })
2902
2910
  ] });
2903
2911
  }, FormFieldInputTags = (props) => {
2904
2912
  const {
@@ -2912,23 +2920,23 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2912
2920
  options,
2913
2921
  placeholder,
2914
2922
  value
2915
- } = props, scheme = sanity.useColorSchemeValue(), creating = useTypedSelector((state) => state.tags.creating), tagsFetching = useTypedSelector((state) => state.tags.fetching);
2916
- return /* @__PURE__ */ jsxRuntime.jsxs(
2917
- ui.Box,
2923
+ } = props, scheme = useColorSchemeValue(), creating = useTypedSelector((state) => state.tags.creating), tagsFetching = useTypedSelector((state) => state.tags.fetching);
2924
+ return /* @__PURE__ */ jsxs(
2925
+ Box,
2918
2926
  {
2919
2927
  style: { zIndex: 2 },
2920
2928
  children: [
2921
- /* @__PURE__ */ jsxRuntime.jsx(FormFieldInputLabel, { description, error, label, name }),
2922
- /* @__PURE__ */ jsxRuntime.jsx(
2923
- reactHookForm.Controller,
2929
+ /* @__PURE__ */ jsx(FormFieldInputLabel, { description, error, label, name }),
2930
+ /* @__PURE__ */ jsx(
2931
+ Controller,
2924
2932
  {
2925
2933
  control,
2926
2934
  defaultValue: value,
2927
2935
  name,
2928
2936
  render: ({ field }) => {
2929
2937
  const { onBlur, onChange, value: controllerValue } = field;
2930
- return /* @__PURE__ */ jsxRuntime.jsx(
2931
- CreatableSelect__default.default,
2938
+ return /* @__PURE__ */ jsx(
2939
+ CreatableSelect,
2932
2940
  {
2933
2941
  components: reactSelectComponents,
2934
2942
  instanceId: "tags",
@@ -2953,12 +2961,12 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2953
2961
  ]
2954
2962
  }
2955
2963
  );
2956
- }, FormFieldInputText = react.forwardRef((props, ref) => {
2964
+ }, FormFieldInputText = forwardRef((props, ref) => {
2957
2965
  const { description, disabled, error, label, name, placeholder, value, ...rest } = props;
2958
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { children: [
2959
- /* @__PURE__ */ jsxRuntime.jsx(FormFieldInputLabel, { description, error, label, name }),
2960
- /* @__PURE__ */ jsxRuntime.jsx(
2961
- ui.TextInput,
2966
+ return /* @__PURE__ */ jsxs(Box, { children: [
2967
+ /* @__PURE__ */ jsx(FormFieldInputLabel, { description, error, label, name }),
2968
+ /* @__PURE__ */ jsx(
2969
+ TextInput,
2962
2970
  {
2963
2971
  ...rest,
2964
2972
  autoComplete: "off",
@@ -2972,12 +2980,12 @@ const getAssetResolution = (asset) => `${asset.metadata.dimensions.width}x${asse
2972
2980
  }
2973
2981
  )
2974
2982
  ] });
2975
- }), FormFieldInputTextarea = react.forwardRef((props, ref) => {
2983
+ }), FormFieldInputTextarea = forwardRef((props, ref) => {
2976
2984
  const { description, disabled, error, label, name, placeholder, rows, value, ...rest } = props;
2977
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { children: [
2978
- /* @__PURE__ */ jsxRuntime.jsx(FormFieldInputLabel, { description, error, label, name }),
2979
- /* @__PURE__ */ jsxRuntime.jsx(
2980
- ui.TextArea,
2985
+ return /* @__PURE__ */ jsxs(Box, { children: [
2986
+ /* @__PURE__ */ jsx(FormFieldInputLabel, { description, error, label, name }),
2987
+ /* @__PURE__ */ jsx(
2988
+ TextArea,
2981
2989
  {
2982
2990
  ...rest,
2983
2991
  autoComplete: "off",
@@ -3009,9 +3017,9 @@ function Details({
3009
3017
  creditLine,
3010
3018
  locales
3011
3019
  }) {
3012
- const hasLocales = locales && locales.length > 0, [activeLocaleTab, setActiveLocaleTab] = react.useState(0);
3013
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3014
- /* @__PURE__ */ jsxRuntime.jsx(
3020
+ const hasLocales = locales && locales.length > 0, [activeLocaleTab, setActiveLocaleTab] = useState(0);
3021
+ return /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
3022
+ /* @__PURE__ */ jsx(
3015
3023
  FormFieldInputTags,
3016
3024
  {
3017
3025
  control,
@@ -3025,7 +3033,7 @@ function Details({
3025
3033
  value: assetTagOptions
3026
3034
  }
3027
3035
  ),
3028
- /* @__PURE__ */ jsxRuntime.jsx(
3036
+ /* @__PURE__ */ jsx(
3029
3037
  FormFieldInputText,
3030
3038
  {
3031
3039
  ...register("originalFilename"),
@@ -3036,9 +3044,9 @@ function Details({
3036
3044
  value: currentAsset?.originalFilename
3037
3045
  }
3038
3046
  ),
3039
- hasLocales ? /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { marginTop: 2, shadow: 1, padding: 3, radius: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
3040
- /* @__PURE__ */ jsxRuntime.jsx(ui.TabList, { space: 2, children: locales.map((locale, idx) => /* @__PURE__ */ jsxRuntime.jsx(
3041
- ui.Tab,
3047
+ hasLocales ? /* @__PURE__ */ jsx(Card, { marginTop: 2, shadow: 1, padding: 3, radius: 1, children: /* @__PURE__ */ jsxs(Stack, { space: 2, children: [
3048
+ /* @__PURE__ */ jsx(TabList, { space: 2, children: locales.map((locale, idx) => /* @__PURE__ */ jsx(
3049
+ Tab,
3042
3050
  {
3043
3051
  id: `locale-tab-${locale.id}`,
3044
3052
  "aria-controls": `locale-panel-${locale.id}`,
@@ -3048,14 +3056,14 @@ function Details({
3048
3056
  },
3049
3057
  locale.id
3050
3058
  )) }),
3051
- locales.map((locale, idx) => /* @__PURE__ */ jsxRuntime.jsx(
3052
- ui.TabPanel,
3059
+ locales.map((locale, idx) => /* @__PURE__ */ jsx(
3060
+ TabPanel,
3053
3061
  {
3054
3062
  id: `locale-panel-${locale.id}`,
3055
3063
  "aria-labelledby": `locale-tab-${locale.id}`,
3056
3064
  hidden: activeLocaleTab !== idx,
3057
- children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3058
- /* @__PURE__ */ jsxRuntime.jsx(
3065
+ children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
3066
+ /* @__PURE__ */ jsx(
3059
3067
  FormFieldInputText,
3060
3068
  {
3061
3069
  ...register(`title.${locale.id}`),
@@ -3065,7 +3073,7 @@ function Details({
3065
3073
  name: `title.${locale.id}`
3066
3074
  }
3067
3075
  ),
3068
- /* @__PURE__ */ jsxRuntime.jsx(
3076
+ /* @__PURE__ */ jsx(
3069
3077
  FormFieldInputText,
3070
3078
  {
3071
3079
  ...register(`altText.${locale.id}`),
@@ -3075,7 +3083,7 @@ function Details({
3075
3083
  name: `altText.${locale.id}`
3076
3084
  }
3077
3085
  ),
3078
- /* @__PURE__ */ jsxRuntime.jsx(
3086
+ /* @__PURE__ */ jsx(
3079
3087
  FormFieldInputTextarea,
3080
3088
  {
3081
3089
  ...register(`description.${locale.id}`),
@@ -3086,7 +3094,7 @@ function Details({
3086
3094
  rows: 5
3087
3095
  }
3088
3096
  ),
3089
- creditLine?.enabled && /* @__PURE__ */ jsxRuntime.jsx(
3097
+ creditLine?.enabled && /* @__PURE__ */ jsx(
3090
3098
  FormFieldInputText,
3091
3099
  {
3092
3100
  ...register(`creditLine.${locale.id}`),
@@ -3100,8 +3108,8 @@ function Details({
3100
3108
  },
3101
3109
  locale.id
3102
3110
  ))
3103
- ] }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3104
- /* @__PURE__ */ jsxRuntime.jsx(
3111
+ ] }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3112
+ /* @__PURE__ */ jsx(
3105
3113
  FormFieldInputText,
3106
3114
  {
3107
3115
  ...register("title"),
@@ -3112,7 +3120,7 @@ function Details({
3112
3120
  value: toStringField(currentAsset?.title)
3113
3121
  }
3114
3122
  ),
3115
- /* @__PURE__ */ jsxRuntime.jsx(
3123
+ /* @__PURE__ */ jsx(
3116
3124
  FormFieldInputText,
3117
3125
  {
3118
3126
  ...register("altText"),
@@ -3123,7 +3131,7 @@ function Details({
3123
3131
  value: toStringField(currentAsset?.altText)
3124
3132
  }
3125
3133
  ),
3126
- /* @__PURE__ */ jsxRuntime.jsx(
3134
+ /* @__PURE__ */ jsx(
3127
3135
  FormFieldInputTextarea,
3128
3136
  {
3129
3137
  ...register("description"),
@@ -3135,7 +3143,7 @@ function Details({
3135
3143
  value: toStringField(currentAsset?.description)
3136
3144
  }
3137
3145
  ),
3138
- creditLine?.enabled && /* @__PURE__ */ jsxRuntime.jsx(
3146
+ creditLine?.enabled && /* @__PURE__ */ jsx(
3139
3147
  FormFieldInputText,
3140
3148
  {
3141
3149
  ...register("creditLine"),
@@ -3150,13 +3158,13 @@ function Details({
3150
3158
  ] });
3151
3159
  }
3152
3160
  function renderDefaultDetails(props) {
3153
- return /* @__PURE__ */ jsxRuntime.jsx(Details, { ...props });
3161
+ return /* @__PURE__ */ jsx(Details, { ...props });
3154
3162
  }
3155
3163
  const DialogAssetEdit = (props) => {
3156
3164
  const {
3157
3165
  children,
3158
3166
  dialog: { assetId, id, lastCreatedTag, lastRemovedTagIds }
3159
- } = props, client = useVersionedClient(), scheme = sanity.useColorSchemeValue(), documentStore = sanity.useDocumentStore(), dispatch = reactRedux.useDispatch(), assetItem = useTypedSelector((state) => selectAssetById(state, String(assetId))), tags = useTypedSelector(selectTags), assetUpdatedPrev = react.useRef(void 0), [assetSnapshot, setAssetSnapshot] = react.useState(assetItem?.asset), [tabSection, setTabSection] = react.useState("details"), currentAsset = assetItem ? assetItem?.asset : assetSnapshot, allTagOptions = getTagSelectOptions(tags), assetTagOptions = useTypedSelector(selectTagSelectOptions(currentAsset)), { creditLine, components: { details: CustomDetails } = {}, locales } = useToolOptions(), generateDefaultValues = react.useCallback(
3167
+ } = props, client = useVersionedClient(), scheme = useColorSchemeValue(), documentStore = useDocumentStore(), dispatch = useDispatch(), assetItem = useTypedSelector((state) => selectAssetById(state, String(assetId))), tags = useTypedSelector(selectTags), assetUpdatedPrev = useRef(void 0), [assetSnapshot, setAssetSnapshot] = useState(assetItem?.asset), [tabSection, setTabSection] = useState("details"), currentAsset = assetItem ? assetItem?.asset : assetSnapshot, allTagOptions = getTagSelectOptions(tags), assetTagOptions = useTypedSelector(selectTagSelectOptions(currentAsset)), { creditLine, components: { details: CustomDetails } = {}, locales } = useToolOptions(), generateDefaultValues = useCallback(
3160
3168
  (asset) => {
3161
3169
  if (locales && locales.length > 0) {
3162
3170
  const makeLocaleObj = (field) => {
@@ -3196,23 +3204,23 @@ const DialogAssetEdit = (props) => {
3196
3204
  register,
3197
3205
  reset,
3198
3206
  setValue
3199
- } = reactHookForm.useForm({
3207
+ } = useForm({
3200
3208
  defaultValues: generateDefaultValues(assetItem?.asset),
3201
3209
  mode: "onChange",
3202
3210
  resolver: zodFormResolver(getAssetFormSchema(locales))
3203
- }), formUpdating = !assetItem || assetItem?.updating, handleClose = react.useCallback(() => {
3211
+ }), formUpdating = !assetItem || assetItem?.updating, handleClose = useCallback(() => {
3204
3212
  dispatch(dialogActions.remove({ id }));
3205
- }, [dispatch, id]), handleDelete = react.useCallback(() => {
3213
+ }, [dispatch, id]), handleDelete = useCallback(() => {
3206
3214
  assetItem?.asset && dispatch(
3207
3215
  dialogActions.showConfirmDeleteAssets({
3208
3216
  assets: [assetItem],
3209
3217
  closeDialogId: assetItem?.asset._id
3210
3218
  })
3211
3219
  );
3212
- }, [assetItem, dispatch]), handleAssetUpdate = react.useCallback((update) => {
3220
+ }, [assetItem, dispatch]), handleAssetUpdate = useCallback((update) => {
3213
3221
  const { result, transition } = update;
3214
3222
  result && transition === "update" && setAssetSnapshot(result);
3215
- }, []), handleCreateTag = react.useCallback(
3223
+ }, []), handleCreateTag = useCallback(
3216
3224
  (tagName) => {
3217
3225
  dispatch(
3218
3226
  tagsActions.createRequest({
@@ -3222,7 +3230,7 @@ const DialogAssetEdit = (props) => {
3222
3230
  );
3223
3231
  },
3224
3232
  [currentAsset?._id, dispatch]
3225
- ), hasOrphanedLocales = react.useMemo(() => {
3233
+ ), hasOrphanedLocales = useMemo(() => {
3226
3234
  if (!currentAsset) return !1;
3227
3235
  const isLocaleObj = (v) => typeof v == "object" && v !== null && !Array.isArray(v), fields = [
3228
3236
  currentAsset.title,
@@ -3234,7 +3242,7 @@ const DialogAssetEdit = (props) => {
3234
3242
  if (!locales || locales.length === 0) return !0;
3235
3243
  const configuredIds = new Set(locales.map((l) => l.id));
3236
3244
  return fields.some((f) => isLocaleObj(f) ? Object.keys(f).some((k) => !configuredIds.has(k)) : !1);
3237
- }, [currentAsset, locales]), handleCleanupLocales = react.useCallback(async () => {
3245
+ }, [currentAsset, locales]), handleCleanupLocales = useCallback(async () => {
3238
3246
  if (!currentAsset) return;
3239
3247
  const cleanField = (field) => {
3240
3248
  if (typeof field != "object" || field === null || Array.isArray(field)) return field;
@@ -3254,7 +3262,7 @@ const DialogAssetEdit = (props) => {
3254
3262
  creditLine: cleanField(currentAsset.creditLine)
3255
3263
  }
3256
3264
  }).commit();
3257
- }, [client, currentAsset, locales]), onSubmit = react.useCallback(
3265
+ }, [client, currentAsset, locales]), onSubmit = useCallback(
3258
3266
  (formData) => {
3259
3267
  if (!assetItem?.asset)
3260
3268
  return;
@@ -3282,31 +3290,31 @@ const DialogAssetEdit = (props) => {
3282
3290
  },
3283
3291
  [assetItem?.asset, dispatch]
3284
3292
  );
3285
- react.useEffect(() => {
3293
+ useEffect(() => {
3286
3294
  if (!assetItem?.asset)
3287
3295
  return;
3288
- const subscriptionAsset = client.listen(groq__default.default`*[_id == $id]`, { id: assetItem?.asset._id }).subscribe(handleAssetUpdate);
3296
+ const subscriptionAsset = client.listen(groq`*[_id == $id]`, { id: assetItem?.asset._id }).subscribe(handleAssetUpdate);
3289
3297
  return () => {
3290
3298
  subscriptionAsset?.unsubscribe();
3291
3299
  };
3292
- }, [assetItem?.asset, client, handleAssetUpdate]), react.useEffect(() => {
3300
+ }, [assetItem?.asset, client, handleAssetUpdate]), useEffect(() => {
3293
3301
  if (lastCreatedTag) {
3294
3302
  const updatedTags = (getValues("opt.media.tags") || []).concat([lastCreatedTag]);
3295
3303
  setValue("opt.media.tags", updatedTags, { shouldDirty: !0 });
3296
3304
  }
3297
- }, [getValues, lastCreatedTag, setValue]), react.useEffect(() => {
3305
+ }, [getValues, lastCreatedTag, setValue]), useEffect(() => {
3298
3306
  if (lastRemovedTagIds) {
3299
3307
  const updatedTags = (getValues("opt.media.tags") || []).filter((tag) => !lastRemovedTagIds.includes(tag.value));
3300
3308
  setValue("opt.media.tags", updatedTags, { shouldDirty: !0 });
3301
3309
  }
3302
- }, [getValues, lastRemovedTagIds, setValue]), react.useEffect(() => {
3310
+ }, [getValues, lastRemovedTagIds, setValue]), useEffect(() => {
3303
3311
  assetUpdatedPrev.current !== assetItem?.asset._updatedAt && reset(generateDefaultValues(assetItem?.asset)), assetUpdatedPrev.current = assetItem?.asset._updatedAt;
3304
3312
  }, [assetItem?.asset, generateDefaultValues, reset]);
3305
- const Footer = () => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3306
- hasOrphanedLocales && /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { padding: 3, radius: 2, shadow: 1, tone: "caution", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: "space-between", gap: 3, children: [
3307
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "This asset has localized fields that are no longer configured. Clean them up to avoid validation errors." }),
3308
- /* @__PURE__ */ jsxRuntime.jsx(
3309
- ui.Button,
3313
+ const Footer = () => /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
3314
+ hasOrphanedLocales && /* @__PURE__ */ jsx(Card, { padding: 3, radius: 2, shadow: 1, tone: "caution", children: /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "space-between", gap: 3, children: [
3315
+ /* @__PURE__ */ jsx(Text, { size: 1, children: "This asset has localized fields that are no longer configured. Clean them up to avoid validation errors." }),
3316
+ /* @__PURE__ */ jsx(
3317
+ Button,
3310
3318
  {
3311
3319
  fontSize: 1,
3312
3320
  mode: "ghost",
@@ -3316,9 +3324,9 @@ const DialogAssetEdit = (props) => {
3316
3324
  }
3317
3325
  )
3318
3326
  ] }) }),
3319
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "space-between", children: [
3320
- /* @__PURE__ */ jsxRuntime.jsx(
3321
- ui.Button,
3327
+ /* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
3328
+ /* @__PURE__ */ jsx(
3329
+ Button,
3322
3330
  {
3323
3331
  disabled: formUpdating,
3324
3332
  fontSize: 1,
@@ -3328,7 +3336,7 @@ const DialogAssetEdit = (props) => {
3328
3336
  tone: "critical"
3329
3337
  }
3330
3338
  ),
3331
- /* @__PURE__ */ jsxRuntime.jsx(
3339
+ /* @__PURE__ */ jsx(
3332
3340
  FormSubmitButton,
3333
3341
  {
3334
3342
  disabled: formUpdating || !isDirty || !isValid || hasOrphanedLocales,
@@ -3354,23 +3362,23 @@ const DialogAssetEdit = (props) => {
3354
3362
  creditLine,
3355
3363
  locales
3356
3364
  };
3357
- return /* @__PURE__ */ jsxRuntime.jsxs(
3365
+ return /* @__PURE__ */ jsxs(
3358
3366
  Dialog,
3359
3367
  {
3360
3368
  animate: !0,
3361
- footer: /* @__PURE__ */ jsxRuntime.jsx(Footer, {}),
3369
+ footer: /* @__PURE__ */ jsx(Footer, {}),
3362
3370
  header: "Asset details",
3363
3371
  id,
3364
3372
  onClose: handleClose,
3365
3373
  width: 3,
3366
3374
  children: [
3367
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: ["column-reverse", "column-reverse", "row-reverse"], children: [
3368
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, marginTop: [5, 5, 0], padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(sanity.WithReferringDocuments, { documentStore, id: currentAsset._id, children: ({ isLoading, referringDocuments }) => {
3375
+ /* @__PURE__ */ jsxs(Flex, { direction: ["column-reverse", "column-reverse", "row-reverse"], children: [
3376
+ /* @__PURE__ */ jsx(Box, { flex: 1, marginTop: [5, 5, 0], padding: 4, children: /* @__PURE__ */ jsx(WithReferringDocuments, { documentStore, id: currentAsset._id, children: ({ isLoading, referringDocuments }) => {
3369
3377
  const uniqueReferringDocuments = getUniqueDocuments(referringDocuments);
3370
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3371
- /* @__PURE__ */ jsxRuntime.jsxs(ui.TabList, { space: 2, children: [
3372
- /* @__PURE__ */ jsxRuntime.jsx(
3373
- ui.Tab,
3378
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3379
+ /* @__PURE__ */ jsxs(TabList, { space: 2, children: [
3380
+ /* @__PURE__ */ jsx(
3381
+ Tab,
3374
3382
  {
3375
3383
  "aria-controls": "details-panel",
3376
3384
  disabled: formUpdating,
@@ -3381,8 +3389,8 @@ const DialogAssetEdit = (props) => {
3381
3389
  size: 2
3382
3390
  }
3383
3391
  ),
3384
- /* @__PURE__ */ jsxRuntime.jsx(
3385
- ui.Tab,
3392
+ /* @__PURE__ */ jsx(
3393
+ Tab,
3386
3394
  {
3387
3395
  "aria-controls": "references-panel",
3388
3396
  disabled: formUpdating,
@@ -3394,31 +3402,31 @@ const DialogAssetEdit = (props) => {
3394
3402
  }
3395
3403
  )
3396
3404
  ] }),
3397
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "form", marginTop: 4, onSubmit: handleSubmit(onSubmit), children: [
3398
- !assetItem && /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { marginBottom: 3, padding: 3, radius: 2, shadow: 1, tone: "critical", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "This file cannot be found \u2013 it may have been deleted." }) }),
3399
- /* @__PURE__ */ jsxRuntime.jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
3400
- /* @__PURE__ */ jsxRuntime.jsx(
3401
- ui.TabPanel,
3405
+ /* @__PURE__ */ jsxs(Box, { as: "form", marginTop: 4, onSubmit: handleSubmit(onSubmit), children: [
3406
+ !assetItem && /* @__PURE__ */ jsx(Card, { marginBottom: 3, padding: 3, radius: 2, shadow: 1, tone: "critical", children: /* @__PURE__ */ jsx(Text, { size: 1, children: "This file cannot be found \u2013 it may have been deleted." }) }),
3407
+ /* @__PURE__ */ jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
3408
+ /* @__PURE__ */ jsx(
3409
+ TabPanel,
3402
3410
  {
3403
3411
  "aria-labelledby": "details",
3404
3412
  hidden: tabSection !== "details",
3405
3413
  id: "details-panel",
3406
- children: CustomDetails ? /* @__PURE__ */ jsxRuntime.jsx(
3414
+ children: CustomDetails ? /* @__PURE__ */ jsx(
3407
3415
  CustomDetails,
3408
3416
  {
3409
3417
  ...detailsProps,
3410
3418
  renderDefaultDetails
3411
3419
  }
3412
- ) : /* @__PURE__ */ jsxRuntime.jsx(Details, { ...detailsProps })
3420
+ ) : /* @__PURE__ */ jsx(Details, { ...detailsProps })
3413
3421
  }
3414
3422
  ),
3415
- /* @__PURE__ */ jsxRuntime.jsx(
3416
- ui.TabPanel,
3423
+ /* @__PURE__ */ jsx(
3424
+ TabPanel,
3417
3425
  {
3418
3426
  "aria-labelledby": "references",
3419
3427
  hidden: tabSection !== "references",
3420
3428
  id: "references-panel",
3421
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 5, children: assetItem?.asset && /* @__PURE__ */ jsxRuntime.jsx(
3429
+ children: /* @__PURE__ */ jsx(Box, { marginTop: 5, children: assetItem?.asset && /* @__PURE__ */ jsx(
3422
3430
  DocumentList,
3423
3431
  {
3424
3432
  documents: uniqueReferringDocuments,
@@ -3430,10 +3438,10 @@ const DialogAssetEdit = (props) => {
3430
3438
  ] })
3431
3439
  ] });
3432
3440
  } }) }),
3433
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { flex: 1, padding: 4, children: [
3434
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: { aspectRatio: "1" }, children: [
3435
- isFileAsset(currentAsset) && /* @__PURE__ */ jsxRuntime.jsx(FileAssetPreview, { asset: currentAsset }),
3436
- isImageAsset(currentAsset) && /* @__PURE__ */ jsxRuntime.jsx(
3441
+ /* @__PURE__ */ jsxs(Box, { flex: 1, padding: 4, children: [
3442
+ /* @__PURE__ */ jsxs(Box, { style: { aspectRatio: "1" }, children: [
3443
+ isFileAsset(currentAsset) && /* @__PURE__ */ jsx(FileAssetPreview, { asset: currentAsset }),
3444
+ isImageAsset(currentAsset) && /* @__PURE__ */ jsx(
3437
3445
  Image$1,
3438
3446
  {
3439
3447
  draggable: !1,
@@ -3443,7 +3451,7 @@ const DialogAssetEdit = (props) => {
3443
3451
  }
3444
3452
  )
3445
3453
  ] }),
3446
- currentAsset && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(AssetMetadata, { asset: currentAsset, item: assetItem }) })
3454
+ currentAsset && /* @__PURE__ */ jsx(Box, { marginTop: 4, children: /* @__PURE__ */ jsx(AssetMetadata, { asset: currentAsset, item: assetItem }) })
3447
3455
  ] })
3448
3456
  ] }),
3449
3457
  children
@@ -3451,19 +3459,19 @@ const DialogAssetEdit = (props) => {
3451
3459
  }
3452
3460
  );
3453
3461
  }, DialogConfirm = (props) => {
3454
- const { children, dialog } = props, dispatch = reactRedux.useDispatch(), handleClose = () => {
3462
+ const { children, dialog } = props, dispatch = useDispatch(), handleClose = () => {
3455
3463
  dispatch(dialogActions.remove({ id: dialog?.id }));
3456
3464
  }, handleConfirm = () => {
3457
3465
  dialog?.closeDialogId && dispatch(dialogActions.remove({ id: dialog?.closeDialogId })), dialog?.confirmCallbackAction && dispatch(dialog.confirmCallbackAction), handleClose();
3458
3466
  };
3459
- return /* @__PURE__ */ jsxRuntime.jsxs(
3467
+ return /* @__PURE__ */ jsxs(
3460
3468
  Dialog,
3461
3469
  {
3462
3470
  animate: !0,
3463
- footer: /* @__PURE__ */ jsxRuntime.jsx(() => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "space-between", children: [
3464
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { fontSize: 1, mode: "bleed", onClick: handleClose, text: "Cancel" }),
3465
- /* @__PURE__ */ jsxRuntime.jsx(
3466
- ui.Button,
3471
+ footer: /* @__PURE__ */ jsx(() => /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
3472
+ /* @__PURE__ */ jsx(Button, { fontSize: 1, mode: "bleed", onClick: handleClose, text: "Cancel" }),
3473
+ /* @__PURE__ */ jsx(
3474
+ Button,
3467
3475
  {
3468
3476
  fontSize: 1,
3469
3477
  onClick: handleConfirm,
@@ -3472,17 +3480,17 @@ const DialogAssetEdit = (props) => {
3472
3480
  }
3473
3481
  )
3474
3482
  ] }) }), {}),
3475
- header: /* @__PURE__ */ jsxRuntime.jsx(() => /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
3476
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 1, children: /* @__PURE__ */ jsxRuntime.jsx(icons.WarningOutlineIcon, {}) }),
3477
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 2, children: dialog?.headerTitle })
3483
+ header: /* @__PURE__ */ jsx(() => /* @__PURE__ */ jsxs(Flex, { align: "center", children: [
3484
+ /* @__PURE__ */ jsx(Box, { paddingX: 1, children: /* @__PURE__ */ jsx(WarningOutlineIcon, {}) }),
3485
+ /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: dialog?.headerTitle })
3478
3486
  ] }), {}),
3479
3487
  id: "confirm",
3480
3488
  onClose: handleClose,
3481
3489
  width: 1,
3482
3490
  children: [
3483
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 4, paddingY: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
3484
- dialog?.title && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: dialog.title }),
3485
- dialog?.description && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsxRuntime.jsx("em", { children: dialog.description }) })
3491
+ /* @__PURE__ */ jsx(Box, { paddingX: 4, paddingY: 4, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
3492
+ dialog?.title && /* @__PURE__ */ jsx(Text, { size: 1, children: dialog.title }),
3493
+ dialog?.description && /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsx("em", { children: dialog.description }) })
3486
3494
  ] }) }),
3487
3495
  children
3488
3496
  ]
@@ -3492,13 +3500,13 @@ const DialogAssetEdit = (props) => {
3492
3500
  const {
3493
3501
  children,
3494
3502
  dialog: { id }
3495
- } = props, dispatch = reactRedux.useDispatch(), handleClose = react.useCallback(() => {
3503
+ } = props, dispatch = useDispatch(), handleClose = useCallback(() => {
3496
3504
  dispatch(dialogActions.clear());
3497
3505
  }, []);
3498
- return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { animate: !0, header: "Filters", id, onClose: handleClose, width: 1, children: [
3499
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { padding: 3, children: [
3500
- /* @__PURE__ */ jsxRuntime.jsx(SearchFacets, { layout: "stack" }),
3501
- /* @__PURE__ */ jsxRuntime.jsx(SearchFacetsControl, {})
3506
+ return /* @__PURE__ */ jsxs(Dialog, { animate: !0, header: "Filters", id, onClose: handleClose, width: 1, children: [
3507
+ /* @__PURE__ */ jsxs(Box, { padding: 3, children: [
3508
+ /* @__PURE__ */ jsx(SearchFacets, { layout: "stack" }),
3509
+ /* @__PURE__ */ jsx(SearchFacetsControl, {})
3502
3510
  ] }),
3503
3511
  children
3504
3512
  ] });
@@ -3506,13 +3514,13 @@ const DialogAssetEdit = (props) => {
3506
3514
  const {
3507
3515
  children,
3508
3516
  dialog: { id }
3509
- } = props, dispatch = reactRedux.useDispatch(), creating = useTypedSelector((state) => state.tags.creating), creatingError = useTypedSelector((state) => state.tags.creatingError), {
3517
+ } = props, dispatch = useDispatch(), creating = useTypedSelector((state) => state.tags.creating), creatingError = useTypedSelector((state) => state.tags.creatingError), {
3510
3518
  // Read the formState before render to subscribe the form state through Proxy
3511
3519
  formState: { errors, isDirty, isValid },
3512
3520
  handleSubmit,
3513
3521
  register,
3514
3522
  setError
3515
- } = reactHookForm.useForm({
3523
+ } = useForm({
3516
3524
  defaultValues: {
3517
3525
  name: ""
3518
3526
  },
@@ -3524,11 +3532,11 @@ const DialogAssetEdit = (props) => {
3524
3532
  const sanitizedFormData = sanitizeFormData(formData);
3525
3533
  dispatch(tagsActions.createRequest({ name: sanitizedFormData.name }));
3526
3534
  };
3527
- return react.useEffect(() => {
3535
+ return useEffect(() => {
3528
3536
  creatingError && setError("name", {
3529
3537
  message: creatingError?.message
3530
3538
  });
3531
- }, [creatingError, setError]), /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { animate: !0, footer: /* @__PURE__ */ jsxRuntime.jsx(() => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(
3539
+ }, [creatingError, setError]), /* @__PURE__ */ jsxs(Dialog, { animate: !0, footer: /* @__PURE__ */ jsx(() => /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsx(Flex, { justify: "flex-end", children: /* @__PURE__ */ jsx(
3532
3540
  FormSubmitButton,
3533
3541
  {
3534
3542
  disabled: formUpdating || !isDirty || !isValid,
@@ -3536,9 +3544,9 @@ const DialogAssetEdit = (props) => {
3536
3544
  onClick: handleSubmit(onSubmit)
3537
3545
  }
3538
3546
  ) }) }), {}), header: "Create Tag", id, onClose: handleClose, width: 1, children: [
3539
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "form", padding: 4, onSubmit: handleSubmit(onSubmit), children: [
3540
- /* @__PURE__ */ jsxRuntime.jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
3541
- /* @__PURE__ */ jsxRuntime.jsx(
3547
+ /* @__PURE__ */ jsxs(Box, { as: "form", padding: 4, onSubmit: handleSubmit(onSubmit), children: [
3548
+ /* @__PURE__ */ jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
3549
+ /* @__PURE__ */ jsx(
3542
3550
  FormFieldInputText,
3543
3551
  {
3544
3552
  ...register("name"),
@@ -3555,7 +3563,7 @@ const DialogAssetEdit = (props) => {
3555
3563
  const {
3556
3564
  children,
3557
3565
  dialog: { id, tagId }
3558
- } = props, client = useVersionedClient(), dispatch = reactRedux.useDispatch(), tagItem = useTypedSelector((state) => selectTagById(state, String(tagId))), [tagSnapshot, setTagSnapshot] = react.useState(tagItem?.tag), currentTag = tagItem ? tagItem?.tag : tagSnapshot, generateDefaultValues = (tag) => ({
3566
+ } = props, client = useVersionedClient(), dispatch = useDispatch(), tagItem = useTypedSelector((state) => selectTagById(state, String(tagId))), [tagSnapshot, setTagSnapshot] = useState(tagItem?.tag), currentTag = tagItem ? tagItem?.tag : tagSnapshot, generateDefaultValues = (tag) => ({
3559
3567
  name: tag?.name?.current || ""
3560
3568
  }), {
3561
3569
  // Read the formState before render to subscribe the form state through Proxy
@@ -3564,7 +3572,7 @@ const DialogAssetEdit = (props) => {
3564
3572
  register,
3565
3573
  reset,
3566
3574
  setError
3567
- } = reactHookForm.useForm({
3575
+ } = useForm({
3568
3576
  defaultValues: generateDefaultValues(tagItem?.tag),
3569
3577
  mode: "onChange",
3570
3578
  resolver: zodFormResolver(tagFormSchema)
@@ -3593,28 +3601,27 @@ const DialogAssetEdit = (props) => {
3593
3601
  tag: tagItem?.tag
3594
3602
  })
3595
3603
  );
3596
- }, handleTagUpdate = react.useCallback(
3604
+ }, handleTagUpdate = useCallback(
3597
3605
  (update) => {
3598
3606
  const { result, transition } = update;
3599
3607
  result && transition === "update" && (setTagSnapshot(result), reset(generateDefaultValues(result)));
3600
3608
  },
3601
3609
  [reset]
3602
3610
  );
3603
- react.useEffect(() => {
3611
+ return useEffect(() => {
3604
3612
  tagItem?.error && setError("name", {
3605
3613
  message: tagItem.error?.message
3606
3614
  });
3607
- }, [setError, tagItem.error]), react.useEffect(() => {
3615
+ }, [setError, tagItem.error]), useEffect(() => {
3608
3616
  if (!tagItem?.tag)
3609
3617
  return;
3610
- const subscriptionAsset = client.listen(groq__default.default`*[_id == $id]`, { id: tagItem?.tag._id }).subscribe(handleTagUpdate);
3618
+ const subscriptionAsset = client.listen(groq`*[_id == $id]`, { id: tagItem?.tag._id }).subscribe(handleTagUpdate);
3611
3619
  return () => {
3612
3620
  subscriptionAsset?.unsubscribe();
3613
3621
  };
3614
- }, [client, handleTagUpdate, tagItem?.tag]);
3615
- const Footer = () => /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "space-between", children: [
3616
- /* @__PURE__ */ jsxRuntime.jsx(
3617
- ui.Button,
3622
+ }, [client, handleTagUpdate, tagItem?.tag]), currentTag ? /* @__PURE__ */ jsxs(Dialog, { animate: !0, footer: /* @__PURE__ */ jsx(() => /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", children: [
3623
+ /* @__PURE__ */ jsx(
3624
+ Button,
3618
3625
  {
3619
3626
  disabled: formUpdating,
3620
3627
  fontSize: 1,
@@ -3624,7 +3631,7 @@ const DialogAssetEdit = (props) => {
3624
3631
  tone: "critical"
3625
3632
  }
3626
3633
  ),
3627
- /* @__PURE__ */ jsxRuntime.jsx(
3634
+ /* @__PURE__ */ jsx(
3628
3635
  FormSubmitButton,
3629
3636
  {
3630
3637
  disabled: formUpdating || !isDirty || !isValid,
@@ -3633,12 +3640,11 @@ const DialogAssetEdit = (props) => {
3633
3640
  onClick: handleSubmit(onSubmit)
3634
3641
  }
3635
3642
  )
3636
- ] }) });
3637
- return currentTag ? /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { animate: !0, footer: /* @__PURE__ */ jsxRuntime.jsx(Footer, {}), header: "Edit Tag", id, onClose: handleClose, width: 1, children: [
3638
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "form", padding: 4, onSubmit: handleSubmit(onSubmit), children: [
3639
- !tagItem && /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { marginBottom: 3, padding: 3, radius: 2, shadow: 1, tone: "critical", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "This tag cannot be found \u2013 it may have been deleted." }) }),
3640
- /* @__PURE__ */ jsxRuntime.jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
3641
- /* @__PURE__ */ jsxRuntime.jsx(
3643
+ ] }) }), {}), header: "Edit Tag", id, onClose: handleClose, width: 1, children: [
3644
+ /* @__PURE__ */ jsxs(Box, { as: "form", padding: 4, onSubmit: handleSubmit(onSubmit), children: [
3645
+ !tagItem && /* @__PURE__ */ jsx(Card, { marginBottom: 3, padding: 3, radius: 2, shadow: 1, tone: "critical", children: /* @__PURE__ */ jsx(Text, { size: 1, children: "This tag cannot be found \u2013 it may have been deleted." }) }),
3646
+ /* @__PURE__ */ jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
3647
+ /* @__PURE__ */ jsx(
3642
3648
  FormFieldInputText,
3643
3649
  {
3644
3650
  ...register("name"),
@@ -3651,9 +3657,9 @@ const DialogAssetEdit = (props) => {
3651
3657
  ] }),
3652
3658
  children
3653
3659
  ] }) : null;
3654
- }, TagContainer = styledComponents.styled(ui.Flex)`
3660
+ }, TagContainer = styled(Flex)`
3655
3661
  height: ${PANEL_HEIGHT}px;
3656
- `, ButtonContainer = styledComponents.styled(ui.Flex)`
3662
+ `, ButtonContainer = styled(Flex)`
3657
3663
  @media (pointer: fine) {
3658
3664
  visibility: hidden;
3659
3665
  }
@@ -3665,16 +3671,16 @@ const DialogAssetEdit = (props) => {
3665
3671
  }
3666
3672
  `, TagButton = (props) => {
3667
3673
  const { disabled, icon, onClick, tone, tooltip } = props;
3668
- return /* @__PURE__ */ jsxRuntime.jsx(
3669
- ui.Tooltip,
3674
+ return /* @__PURE__ */ jsx(
3675
+ Tooltip,
3670
3676
  {
3671
3677
  animate: !0,
3672
- content: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { padding: 2, width: 0, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: tooltip }) }),
3678
+ content: /* @__PURE__ */ jsx(Container$2, { padding: 2, width: 0, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: tooltip }) }),
3673
3679
  disabled: "ontouchstart" in window,
3674
3680
  placement: "top",
3675
3681
  portal: !0,
3676
- children: /* @__PURE__ */ jsxRuntime.jsx(
3677
- ui.Button,
3682
+ children: /* @__PURE__ */ jsx(
3683
+ Button,
3678
3684
  {
3679
3685
  disabled,
3680
3686
  fontSize: 1,
@@ -3688,7 +3694,7 @@ const DialogAssetEdit = (props) => {
3688
3694
  }
3689
3695
  );
3690
3696
  }, Tag = (props) => {
3691
- const { actions, tag } = props, dispatch = reactRedux.useDispatch(), assetsPicked = useTypedSelector(selectAssetsPicked), isSearchFacetTag = useTypedSelector((state) => selectIsSearchFacetTag(state, tag?.tag?._id)), handleSearchFacetTagRemove = () => {
3697
+ const { actions, tag } = props, dispatch = useDispatch(), assetsPicked = useTypedSelector(selectAssetsPicked), isSearchFacetTag = useTypedSelector((state) => selectIsSearchFacetTag(state, tag?.tag?._id)), handleSearchFacetTagRemove = () => {
3692
3698
  dispatch(searchActions.facetsRemoveByTag({ tagId: tag.tag._id }));
3693
3699
  }, handleShowAddTagToAssetsDialog = () => {
3694
3700
  dispatch(dialogActions.showConfirmAssetsTagAdd({ assetsPicked, tag: tag.tag }));
@@ -3714,9 +3720,9 @@ const DialogAssetEdit = (props) => {
3714
3720
  }) : searchActions.facetsAdd({ facet: searchFacet })
3715
3721
  );
3716
3722
  };
3717
- return /* @__PURE__ */ jsxRuntime.jsxs(TagContainer, { align: "center", flex: 1, justify: "space-between", paddingLeft: 3, children: [
3718
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
3719
- ui.Text,
3723
+ return /* @__PURE__ */ jsxs(TagContainer, { align: "center", flex: 1, justify: "space-between", paddingLeft: 3, children: [
3724
+ /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(
3725
+ Text,
3720
3726
  {
3721
3727
  muted: !0,
3722
3728
  size: 1,
@@ -3728,51 +3734,51 @@ const DialogAssetEdit = (props) => {
3728
3734
  children: tag?.tag?.name?.current
3729
3735
  }
3730
3736
  ) }),
3731
- /* @__PURE__ */ jsxRuntime.jsxs(ButtonContainer, { align: "center", style: { flexShrink: 0 }, children: [
3732
- actions?.includes("search") && /* @__PURE__ */ jsxRuntime.jsx(
3737
+ /* @__PURE__ */ jsxs(ButtonContainer, { align: "center", style: { flexShrink: 0 }, children: [
3738
+ actions?.includes("search") && /* @__PURE__ */ jsx(
3733
3739
  TagButton,
3734
3740
  {
3735
3741
  disabled: tag?.updating,
3736
- icon: isSearchFacetTag ? /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(icons.SearchIcon, {}),
3742
+ icon: isSearchFacetTag ? /* @__PURE__ */ jsx(CloseIcon, {}) : /* @__PURE__ */ jsx(SearchIcon, {}),
3737
3743
  onClick: isSearchFacetTag ? handleSearchFacetTagRemove : handleSearchFacetTagAddOrUpdate,
3738
3744
  tooltip: isSearchFacetTag ? "Remove filter" : "Filter by tag"
3739
3745
  }
3740
3746
  ),
3741
- actions?.includes("edit") && /* @__PURE__ */ jsxRuntime.jsx(
3747
+ actions?.includes("edit") && /* @__PURE__ */ jsx(
3742
3748
  TagButton,
3743
3749
  {
3744
3750
  disabled: tag?.updating,
3745
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.EditIcon, {}),
3751
+ icon: /* @__PURE__ */ jsx(EditIcon, {}),
3746
3752
  onClick: handleShowTagEditDialog,
3747
3753
  tone: "primary",
3748
3754
  tooltip: "Edit tag"
3749
3755
  }
3750
3756
  ),
3751
- actions?.includes("applyAll") && /* @__PURE__ */ jsxRuntime.jsx(
3757
+ actions?.includes("applyAll") && /* @__PURE__ */ jsx(
3752
3758
  TagButton,
3753
3759
  {
3754
3760
  disabled: tag?.updating,
3755
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpIcon, {}),
3761
+ icon: /* @__PURE__ */ jsx(ArrowUpIcon, {}),
3756
3762
  onClick: handleShowAddTagToAssetsDialog,
3757
3763
  tone: "primary",
3758
3764
  tooltip: "Add tag to selected assets"
3759
3765
  }
3760
3766
  ),
3761
- actions?.includes("removeAll") && /* @__PURE__ */ jsxRuntime.jsx(
3767
+ actions?.includes("removeAll") && /* @__PURE__ */ jsx(
3762
3768
  TagButton,
3763
3769
  {
3764
3770
  disabled: tag?.updating,
3765
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownIcon, {}),
3771
+ icon: /* @__PURE__ */ jsx(ArrowDownIcon, {}),
3766
3772
  onClick: handleShowRemoveTagFromAssetsDialog,
3767
3773
  tone: "critical",
3768
3774
  tooltip: "Remove tag from selected assets"
3769
3775
  }
3770
3776
  ),
3771
- actions?.includes("delete") && /* @__PURE__ */ jsxRuntime.jsx(
3777
+ actions?.includes("delete") && /* @__PURE__ */ jsx(
3772
3778
  TagButton,
3773
3779
  {
3774
3780
  disabled: tag?.updating,
3775
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.TrashIcon, {}),
3781
+ icon: /* @__PURE__ */ jsx(TrashIcon, {}),
3776
3782
  onClick: handleShowTagDeleteDialog,
3777
3783
  tone: "critical",
3778
3784
  tooltip: "Delete tag"
@@ -3780,23 +3786,23 @@ const DialogAssetEdit = (props) => {
3780
3786
  )
3781
3787
  ] })
3782
3788
  ] });
3783
- }, VirtualRow$1 = react.memo(
3789
+ }, VirtualRow$1 = memo(
3784
3790
  ({
3785
3791
  isScrolling,
3786
3792
  item
3787
- }) => typeof item == "string" ? /* @__PURE__ */ jsxRuntime.jsx(
3788
- ui.Flex,
3793
+ }) => typeof item == "string" ? /* @__PURE__ */ jsx(
3794
+ Flex,
3789
3795
  {
3790
3796
  align: "center",
3791
3797
  justify: "space-between",
3792
3798
  paddingX: 3,
3793
3799
  style: { height: `${PANEL_HEIGHT}px` },
3794
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 0, children: item })
3800
+ children: /* @__PURE__ */ jsx(Label, { size: 0, children: item })
3795
3801
  },
3796
3802
  item
3797
- ) : /* @__PURE__ */ jsxRuntime.jsx(Tag, { actions: isScrolling ? void 0 : item.actions, tag: item }, item.tag?._id)
3803
+ ) : /* @__PURE__ */ jsx(Tag, { actions: isScrolling ? void 0 : item.actions, tag: item }, item.tag?._id)
3798
3804
  ), TagsVirtualized = () => {
3799
- const assetsPicked = useTypedSelector(selectAssetsPicked), tags = useTypedSelector(selectTags), [isScrolling, setIsScrolling] = react.useState(!1), pickedTagIds = assetsPicked?.reduce((acc, val) => {
3805
+ const assetsPicked = useTypedSelector(selectAssetsPicked), tags = useTypedSelector(selectTags), [isScrolling, setIsScrolling] = useState(!1), pickedTagIds = assetsPicked?.reduce((acc, val) => {
3800
3806
  const assetTagIds = val?.asset?.opt?.media?.tags?.map((tag) => tag._ref) || [];
3801
3807
  return acc = acc.concat(assetTagIds), acc;
3802
3808
  }, []), pickedTagIdsUnique = [...new Set(pickedTagIds)], tagIdsSegmented = pickedTagIdsUnique.reduce(
@@ -3834,8 +3840,8 @@ const DialogAssetEdit = (props) => {
3834
3840
  //
3835
3841
  "Unused",
3836
3842
  ...tagsUnused
3837
- ])), /* @__PURE__ */ jsxRuntime.jsx(
3838
- reactVirtuoso.Virtuoso,
3843
+ ])), /* @__PURE__ */ jsx(
3844
+ Virtuoso,
3839
3845
  {
3840
3846
  className: "media__custom-scrollbar",
3841
3847
  computeItemKey: (index) => {
@@ -3843,17 +3849,17 @@ const DialogAssetEdit = (props) => {
3843
3849
  return typeof item == "string" ? item : item.tag._id;
3844
3850
  },
3845
3851
  isScrolling: setIsScrolling,
3846
- itemContent: (index) => /* @__PURE__ */ jsxRuntime.jsx(VirtualRow$1, { isScrolling, item: items[index] }),
3852
+ itemContent: (index) => /* @__PURE__ */ jsx(VirtualRow$1, { isScrolling, item: items[index] }),
3847
3853
  style: { flex: 1, overflowX: "hidden" },
3848
3854
  totalCount: items.length
3849
3855
  }
3850
3856
  );
3851
3857
  }, TagViewHeader = ({ allowCreate, light, title }) => {
3852
- const scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), tagsCreating = useTypedSelector((state) => state.tags.creating), tagsFetching = useTypedSelector((state) => state.tags.fetching), handleTagCreate = () => {
3858
+ const scheme = useColorSchemeValue(), dispatch = useDispatch(), tagsCreating = useTypedSelector((state) => state.tags.creating), tagsFetching = useTypedSelector((state) => state.tags.fetching), handleTagCreate = () => {
3853
3859
  dispatch(DIALOG_ACTIONS.showTagCreate());
3854
3860
  };
3855
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
3856
- ui.Flex,
3861
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
3862
+ Flex,
3857
3863
  {
3858
3864
  align: "center",
3859
3865
  justify: "space-between",
@@ -3865,16 +3871,16 @@ const DialogAssetEdit = (props) => {
3865
3871
  height: `${PANEL_HEIGHT}px`
3866
3872
  },
3867
3873
  children: [
3868
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 2, children: [
3869
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 0, children: title }),
3870
- tagsFetching && /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 0, style: { opacity: 0.3 }, children: "Loading..." })
3874
+ /* @__PURE__ */ jsxs(Inline, { space: 2, children: [
3875
+ /* @__PURE__ */ jsx(Label, { size: 0, children: title }),
3876
+ tagsFetching && /* @__PURE__ */ jsx(Label, { size: 0, style: { opacity: 0.3 }, children: "Loading..." })
3871
3877
  ] }),
3872
- allowCreate && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginRight: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
3873
- ui.Button,
3878
+ allowCreate && /* @__PURE__ */ jsx(Box, { marginRight: 1, children: /* @__PURE__ */ jsx(
3879
+ Button,
3874
3880
  {
3875
3881
  disabled: tagsCreating,
3876
3882
  fontSize: 1,
3877
- icon: icons.ComposeIcon,
3883
+ icon: ComposeIcon,
3878
3884
  mode: "bleed",
3879
3885
  onClick: handleTagCreate,
3880
3886
  style: {
@@ -3888,8 +3894,8 @@ const DialogAssetEdit = (props) => {
3888
3894
  ) });
3889
3895
  }, TagView = () => {
3890
3896
  const numPickedAssets = useTypedSelector(selectAssetsPickedLength), tags = useTypedSelector(selectTags), fetching = useTypedSelector((state) => state.tags.fetching), fetchComplete = useTypedSelector((state) => state.tags.fetchCount) !== -1, hasTags = !fetching && tags?.length > 0, hasPicked = numPickedAssets > 0;
3891
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", flex: 1, height: "fill", children: [
3892
- /* @__PURE__ */ jsxRuntime.jsx(
3897
+ return /* @__PURE__ */ jsxs(Flex, { direction: "column", flex: 1, height: "fill", children: [
3898
+ /* @__PURE__ */ jsx(
3893
3899
  TagViewHeader,
3894
3900
  {
3895
3901
  allowCreate: !0,
@@ -3897,26 +3903,26 @@ const DialogAssetEdit = (props) => {
3897
3903
  title: hasPicked ? "Tags (in selection)" : "Tags"
3898
3904
  }
3899
3905
  ),
3900
- fetchComplete && !hasTags && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsxRuntime.jsx("em", { children: "No tags" }) }) }),
3901
- hasTags && /* @__PURE__ */ jsxRuntime.jsx(TagsVirtualized, {})
3906
+ fetchComplete && !hasTags && /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsx("em", { children: "No tags" }) }) }),
3907
+ hasTags && /* @__PURE__ */ jsx(TagsVirtualized, {})
3902
3908
  ] });
3903
3909
  }, DialogTags = (props) => {
3904
3910
  const {
3905
3911
  children,
3906
3912
  dialog: { id }
3907
- } = props, dispatch = reactRedux.useDispatch(), handleClose = react.useCallback(() => {
3913
+ } = props, dispatch = useDispatch(), handleClose = useCallback(() => {
3908
3914
  dispatch(dialogActions.clear());
3909
3915
  }, []);
3910
- return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { animate: !0, header: "All Tags", id, onClose: handleClose, width: 1, children: [
3911
- /* @__PURE__ */ jsxRuntime.jsx(
3912
- ui.Box,
3916
+ return /* @__PURE__ */ jsxs(Dialog, { animate: !0, header: "All Tags", id, onClose: handleClose, width: 1, children: [
3917
+ /* @__PURE__ */ jsx(
3918
+ Box,
3913
3919
  {
3914
3920
  style: {
3915
3921
  height: "100%",
3916
3922
  minHeight: "420px"
3917
3923
  // explicit height required as <TagView> is virtualized
3918
3924
  },
3919
- children: /* @__PURE__ */ jsxRuntime.jsx(TagView, {})
3925
+ children: /* @__PURE__ */ jsx(TagView, {})
3920
3926
  }
3921
3927
  ),
3922
3928
  children
@@ -3926,43 +3932,43 @@ const DialogAssetEdit = (props) => {
3926
3932
  if (dialogs.length === 0 || index >= dialogs.length)
3927
3933
  return null;
3928
3934
  const dialog = dialogs[index], childDialogs = renderDialogs(dialogs, index + 1);
3929
- return dialog.type === "assetEdit" ? /* @__PURE__ */ jsxRuntime.jsx(DialogAssetEdit, { dialog, children: childDialogs }, index) : dialog.type === "confirm" ? /* @__PURE__ */ jsxRuntime.jsx(DialogConfirm, { dialog, children: childDialogs }, index) : dialog.type === "searchFacets" ? /* @__PURE__ */ jsxRuntime.jsx(DialogSearchFacets, { dialog, children: childDialogs }, index) : dialog.type === "tagCreate" ? /* @__PURE__ */ jsxRuntime.jsx(DialogTagCreate, { dialog, children: childDialogs }, index) : dialog.type === "tagEdit" ? /* @__PURE__ */ jsxRuntime.jsx(DialogTagEdit, { dialog, children: childDialogs }, index) : dialog.type === "tags" ? /* @__PURE__ */ jsxRuntime.jsx(DialogTags, { dialog, children: childDialogs }, index) : null;
3935
+ return dialog.type === "assetEdit" ? /* @__PURE__ */ jsx(DialogAssetEdit, { dialog, children: childDialogs }, index) : dialog.type === "confirm" ? /* @__PURE__ */ jsx(DialogConfirm, { dialog, children: childDialogs }, index) : dialog.type === "searchFacets" ? /* @__PURE__ */ jsx(DialogSearchFacets, { dialog, children: childDialogs }, index) : dialog.type === "tagCreate" ? /* @__PURE__ */ jsx(DialogTagCreate, { dialog, children: childDialogs }, index) : dialog.type === "tagEdit" ? /* @__PURE__ */ jsx(DialogTagEdit, { dialog, children: childDialogs }, index) : dialog.type === "tags" ? /* @__PURE__ */ jsx(DialogTags, { dialog, children: childDialogs }, index) : null;
3930
3936
  };
3931
3937
  return renderDialogs(currentDialogs, 0);
3932
- }, DropzoneDispatchContext = react.createContext(void 0), DropzoneDispatchProvider = (props) => {
3938
+ }, DropzoneDispatchContext = createContext(void 0), DropzoneDispatchProvider = (props) => {
3933
3939
  const { children, open } = props, contextValue = { open };
3934
- return /* @__PURE__ */ jsxRuntime.jsx(DropzoneDispatchContext.Provider, { value: contextValue, children });
3940
+ return /* @__PURE__ */ jsx(DropzoneDispatchContext.Provider, { value: contextValue, children });
3935
3941
  }, useDropzoneActions = () => {
3936
- const context = react.useContext(DropzoneDispatchContext);
3942
+ const context = useContext(DropzoneDispatchContext);
3937
3943
  if (context === void 0)
3938
3944
  throw new Error("useDropzoneActions must be used within an DropzoneDispatchProvider");
3939
3945
  return context;
3940
3946
  }, Header = (props) => {
3941
3947
  const { onClose } = props, { open } = useDropzoneActions(), { onSelect } = useAssetSourceActions(), assetTypes = useTypedSelector((state) => state.assets.assetTypes), selectedDocument = useTypedSelector((state) => state.selected.document), { directUploads } = useToolOptions();
3942
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingY: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: "space-between", children: [
3943
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, marginX: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { style: { whiteSpace: "nowrap" }, children: [
3944
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { textOverflow: "ellipsis", weight: "semibold", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: onSelect ? `Insert ${assetTypes.join(" or ")}` : "Browse Assets" }) }),
3945
- selectedDocument && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { display: ["none", "none", "block"], children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { children: [
3946
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { margin: "0 0.5em" }, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Icon, { symbol: "arrow-right" }) }),
3947
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { textTransform: "capitalize" }, children: selectedDocument._type })
3948
+ return /* @__PURE__ */ jsx(Box, { paddingY: 2, children: /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "space-between", children: [
3949
+ /* @__PURE__ */ jsx(Box, { flex: 1, marginX: 3, children: /* @__PURE__ */ jsxs(Inline, { style: { whiteSpace: "nowrap" }, children: [
3950
+ /* @__PURE__ */ jsx(Text, { textOverflow: "ellipsis", weight: "semibold", children: /* @__PURE__ */ jsx("span", { children: onSelect ? `Insert ${assetTypes.join(" or ")}` : "Browse Assets" }) }),
3951
+ selectedDocument && /* @__PURE__ */ jsx(Box, { display: ["none", "none", "block"], children: /* @__PURE__ */ jsxs(Text, { children: [
3952
+ /* @__PURE__ */ jsx("span", { style: { margin: "0 0.5em" }, children: /* @__PURE__ */ jsx(Icon, { symbol: "arrow-right" }) }),
3953
+ /* @__PURE__ */ jsx("span", { style: { textTransform: "capitalize" }, children: selectedDocument._type })
3948
3954
  ] }) })
3949
3955
  ] }) }),
3950
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { marginX: 2, children: [
3951
- directUploads && /* @__PURE__ */ jsxRuntime.jsx(
3952
- ui.Button,
3956
+ /* @__PURE__ */ jsxs(Flex, { marginX: 2, children: [
3957
+ directUploads && /* @__PURE__ */ jsx(
3958
+ Button,
3953
3959
  {
3954
3960
  fontSize: 1,
3955
- icon: icons.UploadIcon,
3961
+ icon: UploadIcon,
3956
3962
  mode: "bleed",
3957
3963
  onClick: open,
3958
- text: `Upload ${assetTypes.length === 1 ? pluralize__default.default(assetTypes[0]) : "assets"}`
3964
+ text: `Upload ${assetTypes.length === 1 ? pluralize(assetTypes[0]) : "assets"}`
3959
3965
  }
3960
3966
  ),
3961
- onClose && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(
3962
- ui.Button,
3967
+ onClose && /* @__PURE__ */ jsx(Box, { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx(
3968
+ Button,
3963
3969
  {
3964
3970
  disabled: !onClose,
3965
- icon: icons.CloseIcon,
3971
+ icon: CloseIcon,
3966
3972
  mode: "bleed",
3967
3973
  onClick: onClose,
3968
3974
  radius: 2
@@ -3971,10 +3977,10 @@ const DialogAssetEdit = (props) => {
3971
3977
  ] })
3972
3978
  ] }) });
3973
3979
  }, useBreakpointIndex = () => {
3974
- const mediaQueryLists = ui.studioTheme?.container?.map(
3980
+ const mediaQueryLists = studioTheme?.container?.map(
3975
3981
  (width) => window.matchMedia(`(max-width: ${width}px)`)
3976
- ), getBreakpointIndex = () => mediaQueryLists.findIndex((mql) => mql.matches), [value, setValue] = react.useState(getBreakpointIndex());
3977
- return react.useEffect(() => {
3982
+ ), getBreakpointIndex = () => mediaQueryLists.findIndex((mql) => mql.matches), [value, setValue] = useState(getBreakpointIndex());
3983
+ return useEffect(() => {
3978
3984
  const handleBreakpoint = () => {
3979
3985
  setValue(getBreakpointIndex);
3980
3986
  };
@@ -3998,7 +4004,7 @@ const DialogAssetEdit = (props) => {
3998
4004
  }
3999
4005
  };
4000
4006
  }, []), value;
4001
- }, selectCombinedItems = toolkit.createSelector(
4007
+ }, selectCombinedItems = createSelector(
4002
4008
  [
4003
4009
  (state) => state.assets.allIds,
4004
4010
  (state) => state.uploads.allIds
@@ -4007,17 +4013,17 @@ const DialogAssetEdit = (props) => {
4007
4013
  const assetItems = assetIds.map((id) => ({ id, type: "asset" }));
4008
4014
  return [...uploadIds.map((id) => ({ id, type: "upload" })), ...assetItems];
4009
4015
  }
4010
- ), CardWrapper$1 = styledComponents.styled(ui.Flex)`
4016
+ ), CardWrapper$1 = styled(Flex)`
4011
4017
  box-sizing: border-box;
4012
4018
  height: 100%;
4013
4019
  overflow: hidden;
4014
4020
  position: relative;
4015
4021
  width: 100%;
4016
- `, CardContainer = styledComponents.styled(ui.Flex)(({
4022
+ `, CardContainer = styled(Flex)(({
4017
4023
  $picked,
4018
4024
  theme,
4019
4025
  $updating
4020
- }) => styledComponents.css`
4026
+ }) => css`
4021
4027
  border: 1px solid transparent;
4022
4028
  height: 100%;
4023
4029
  pointer-events: ${$updating ? "none" : "auto"};
@@ -4028,16 +4034,16 @@ const DialogAssetEdit = (props) => {
4028
4034
 
4029
4035
  border: ${$picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};
4030
4036
 
4031
- ${!$updating && styledComponents.css`
4037
+ ${!$updating && css`
4032
4038
  @media (hover: hover) and (pointer: fine) {
4033
4039
  &:hover {
4034
4040
  border: 1px solid var(--card-border-color);
4035
4041
  }
4036
4042
  }
4037
4043
  `}
4038
- `), ContextActionContainer$2 = styledComponents.styled(ui.Flex)(({
4044
+ `), ContextActionContainer$2 = styled(Flex)(({
4039
4045
  $scheme
4040
- }) => styledComponents.css`
4046
+ }) => css`
4041
4047
  cursor: pointer;
4042
4048
  height: ${PANEL_HEIGHT}px;
4043
4049
  transition: all 300ms;
@@ -4046,10 +4052,10 @@ const DialogAssetEdit = (props) => {
4046
4052
  background: ${getSchemeColor($scheme, "bg")};
4047
4053
  }
4048
4054
  }
4049
- `), StyledWarningOutlineIcon = styledComponents.styled(icons.WarningFilledIcon)(({ theme }) => ({
4055
+ `), StyledWarningOutlineIcon = styled(WarningFilledIcon)(({ theme }) => ({
4050
4056
  color: theme.sanity.color.spot.red
4051
4057
  })), CardAsset$1 = (props) => {
4052
- const { id, selected } = props, scheme = sanity.useColorSchemeValue(), shiftPressed = useKeyPress("shift"), dispatch = reactRedux.useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions();
4058
+ const { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), dispatch = useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions();
4053
4059
  if (!asset)
4054
4060
  return null;
4055
4061
  const handleAssetClick = (e) => {
@@ -4062,9 +4068,9 @@ const DialogAssetEdit = (props) => {
4062
4068
  }, handleContextActionClick = (e) => {
4063
4069
  e.stopPropagation(), onSelect ? dispatch(dialogActions.showAssetEdit({ assetId: asset._id })) : shiftPressed.current && !picked ? dispatch(assetsActions.pickRange({ startId: lastPicked || asset._id, endId: asset._id })) : dispatch(assetsActions.pick({ assetId: asset._id, picked: !picked }));
4064
4070
  }, opacityContainer = updating ? 0.5 : 1, opacityPreview = selected || updating ? 0.25 : 1;
4065
- return /* @__PURE__ */ jsxRuntime.jsx(CardWrapper$1, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(CardContainer, { direction: "column", $picked: picked, $updating: item.updating, children: [
4066
- /* @__PURE__ */ jsxRuntime.jsxs(
4067
- ui.Box,
4071
+ return /* @__PURE__ */ jsx(CardWrapper$1, { padding: 1, children: /* @__PURE__ */ jsxs(CardContainer, { direction: "column", $picked: picked, $updating: item.updating, children: [
4072
+ /* @__PURE__ */ jsxs(
4073
+ Box,
4068
4074
  {
4069
4075
  flex: 1,
4070
4076
  style: {
@@ -4072,9 +4078,9 @@ const DialogAssetEdit = (props) => {
4072
4078
  position: "relative"
4073
4079
  },
4074
4080
  children: [
4075
- /* @__PURE__ */ jsxRuntime.jsxs("div", { onClick: handleAssetClick, style: { height: "100%", opacity: opacityPreview }, children: [
4076
- isFileAsset(asset) && /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { extension: asset.extension, width: "80px" }),
4077
- isImageAsset(asset) && /* @__PURE__ */ jsxRuntime.jsx(
4081
+ /* @__PURE__ */ jsxs("div", { onClick: handleAssetClick, style: { height: "100%", opacity: opacityPreview }, children: [
4082
+ isFileAsset(asset) && /* @__PURE__ */ jsx(FileIcon, { extension: asset.extension, width: "80px" }),
4083
+ isImageAsset(asset) && /* @__PURE__ */ jsx(
4078
4084
  Image$1,
4079
4085
  {
4080
4086
  draggable: !1,
@@ -4088,8 +4094,8 @@ const DialogAssetEdit = (props) => {
4088
4094
  }
4089
4095
  )
4090
4096
  ] }),
4091
- selected && !updating && /* @__PURE__ */ jsxRuntime.jsx(
4092
- ui.Flex,
4097
+ selected && !updating && /* @__PURE__ */ jsx(
4098
+ Flex,
4093
4099
  {
4094
4100
  align: "center",
4095
4101
  justify: "center",
@@ -4101,11 +4107,11 @@ const DialogAssetEdit = (props) => {
4101
4107
  top: 0,
4102
4108
  width: "100%"
4103
4109
  },
4104
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 2, children: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckmarkCircleIcon, {}) })
4110
+ children: /* @__PURE__ */ jsx(Text, { size: 2, children: /* @__PURE__ */ jsx(CheckmarkCircleIcon, {}) })
4105
4111
  }
4106
4112
  ),
4107
- updating && /* @__PURE__ */ jsxRuntime.jsx(
4108
- ui.Flex,
4113
+ updating && /* @__PURE__ */ jsx(
4114
+ Flex,
4109
4115
  {
4110
4116
  align: "center",
4111
4117
  justify: "center",
@@ -4116,13 +4122,13 @@ const DialogAssetEdit = (props) => {
4116
4122
  top: 0,
4117
4123
  width: "100%"
4118
4124
  },
4119
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, {})
4125
+ children: /* @__PURE__ */ jsx(Spinner, {})
4120
4126
  }
4121
4127
  )
4122
4128
  ]
4123
4129
  }
4124
4130
  ),
4125
- /* @__PURE__ */ jsxRuntime.jsxs(
4131
+ /* @__PURE__ */ jsxs(
4126
4132
  ContextActionContainer$2,
4127
4133
  {
4128
4134
  align: "center",
@@ -4131,16 +4137,16 @@ const DialogAssetEdit = (props) => {
4131
4137
  $scheme: scheme,
4132
4138
  style: { opacity: opacityContainer },
4133
4139
  children: [
4134
- onSelect ? /* @__PURE__ */ jsxRuntime.jsx(
4135
- icons.EditIcon,
4140
+ onSelect ? /* @__PURE__ */ jsx(
4141
+ EditIcon,
4136
4142
  {
4137
4143
  style: {
4138
4144
  flexShrink: 0,
4139
4145
  opacity: 0.5
4140
4146
  }
4141
4147
  }
4142
- ) : /* @__PURE__ */ jsxRuntime.jsx(
4143
- ui.Checkbox,
4148
+ ) : /* @__PURE__ */ jsx(
4149
+ Checkbox,
4144
4150
  {
4145
4151
  checked: picked,
4146
4152
  readOnly: !0,
@@ -4151,12 +4157,12 @@ const DialogAssetEdit = (props) => {
4151
4157
  }
4152
4158
  }
4153
4159
  ),
4154
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 0, textOverflow: "ellipsis", children: asset.originalFilename }) })
4160
+ /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 0, textOverflow: "ellipsis", children: asset.originalFilename }) })
4155
4161
  ]
4156
4162
  }
4157
4163
  ),
4158
- error && /* @__PURE__ */ jsxRuntime.jsx(
4159
- ui.Box,
4164
+ error && /* @__PURE__ */ jsx(
4165
+ Box,
4160
4166
  {
4161
4167
  padding: 3,
4162
4168
  style: {
@@ -4164,21 +4170,21 @@ const DialogAssetEdit = (props) => {
4164
4170
  right: 0,
4165
4171
  top: 0
4166
4172
  },
4167
- children: /* @__PURE__ */ jsxRuntime.jsx(
4168
- ui.Tooltip,
4173
+ children: /* @__PURE__ */ jsx(
4174
+ Tooltip,
4169
4175
  {
4170
4176
  animate: !0,
4171
- content: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { padding: 2, width: 0, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: error }) }),
4177
+ content: /* @__PURE__ */ jsx(Container$2, { padding: 2, width: 0, children: /* @__PURE__ */ jsx(Text, { size: 1, children: error }) }),
4172
4178
  placement: "left",
4173
4179
  portal: !0,
4174
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(StyledWarningOutlineIcon, { color: "critical" }) })
4180
+ children: /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(StyledWarningOutlineIcon, { color: "critical" }) })
4175
4181
  }
4176
4182
  )
4177
4183
  }
4178
4184
  )
4179
4185
  ] }) });
4180
4186
  };
4181
- var CardAsset = react.memo(CardAsset$1);
4187
+ var CardAsset = memo(CardAsset$1);
4182
4188
  const PREVIEW_WIDTH = 180, createBlob = (img) => new Promise((resolve) => {
4183
4189
  const imageAspect = img.width / img.height, canvas = document.createElement("canvas");
4184
4190
  canvas.width = PREVIEW_WIDTH, canvas.height = Math.max(PREVIEW_WIDTH / imageAspect, 1);
@@ -4197,17 +4203,17 @@ const PREVIEW_WIDTH = 180, createBlob = (img) => new Promise((resolve) => {
4197
4203
  if (!blob)
4198
4204
  throw Error("Unable to generate file Blob");
4199
4205
  return window.URL.createObjectURL(blob);
4200
- }, generatePreviewBlobUrl$ = (file) => rxjs.of(null).pipe(operators$1.mergeMap(() => rxjs.from(generatePreviewBlobUrl(file)))), DEFAULT_CONCURRENCY = 4;
4206
+ }, generatePreviewBlobUrl$ = (file) => of(null).pipe(mergeMap(() => from(generatePreviewBlobUrl(file)))), DEFAULT_CONCURRENCY = 4;
4201
4207
  function remove(array, item) {
4202
4208
  const index = array.indexOf(item);
4203
4209
  return index > -1 && array.splice(index, 1), array;
4204
4210
  }
4205
4211
  const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
4206
- const currentSubscriptions = [], pendingObservables = [], ready$ = new rxjs.Subject();
4212
+ const currentSubscriptions = [], pendingObservables = [], ready$ = new Subject();
4207
4213
  function request(observable) {
4208
- return new rxjs.Observable((observer) => {
4214
+ return new Observable((observer) => {
4209
4215
  if (currentSubscriptions.length >= concurrency)
4210
- return scheduleAndWait$(observable).pipe(operators$1.mergeMap(request)).subscribe(observer);
4216
+ return scheduleAndWait$(observable).pipe(mergeMap(request)).subscribe(observer);
4211
4217
  const subscription = observable.subscribe(observer);
4212
4218
  return currentSubscriptions.push(subscription), () => {
4213
4219
  for (remove(currentSubscriptions, subscription), remove(pendingObservables, observable), subscription.unsubscribe(); pendingObservables.length > 0 && currentSubscriptions.length < concurrency; )
@@ -4216,16 +4222,16 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
4216
4222
  });
4217
4223
  }
4218
4224
  function scheduleAndWait$(observable) {
4219
- return pendingObservables.push(observable), ready$.asObservable().pipe(operators$1.first((obs) => obs === observable));
4225
+ return pendingObservables.push(observable), ready$.asObservable().pipe(first((obs) => obs === observable));
4220
4226
  }
4221
4227
  return request;
4222
4228
  }, withMaxConcurrency = (func, concurrency = DEFAULT_CONCURRENCY) => {
4223
4229
  const throttler = createThrottler(concurrency);
4224
- return (...args) => rxjs.from(throttler(func(...args)));
4230
+ return (...args) => from(throttler(func(...args)));
4225
4231
  }, fetchExisting$ = (client, type, hash) => client.observable.fetch("*[_type == $documentType && sha1hash == $hash][0]", {
4226
4232
  documentType: type,
4227
4233
  hash
4228
- }), readFile$ = (file) => new rxjs.Observable((subscriber) => {
4234
+ }), readFile$ = (file) => new Observable((subscriber) => {
4229
4235
  const reader = new FileReader();
4230
4236
  return reader.onload = () => {
4231
4237
  subscriber.next(reader.result), subscriber.complete();
@@ -4234,25 +4240,25 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
4234
4240
  }, reader.readAsArrayBuffer(file), () => {
4235
4241
  reader.abort();
4236
4242
  };
4237
- }), hexFromBuffer = (buffer) => Array.prototype.map.call(new Uint8Array(buffer), (x) => `00${x.toString(16)}`.slice(-2)).join(""), hashFile$ = (file) => !window.crypto || !window.crypto.subtle || !window.FileReader ? rxjs.throwError({
4243
+ }), hexFromBuffer = (buffer) => Array.prototype.map.call(new Uint8Array(buffer), (x) => `00${x.toString(16)}`.slice(-2)).join(""), hashFile$ = (file) => !window.crypto || !window.crypto.subtle || !window.FileReader ? throwError({
4238
4244
  message: "Unable to generate hash: uploads are only allowed in secure contexts",
4239
4245
  statusCode: 500
4240
4246
  }) : readFile$(file).pipe(
4241
- operators$1.mergeMap((arrayBuffer) => window.crypto.subtle.digest("SHA-1", arrayBuffer)),
4242
- operators$1.map(hexFromBuffer)
4243
- ), uploadSanityAsset$ = (client, assetType, file, hash) => rxjs.of(null).pipe(
4247
+ mergeMap((arrayBuffer) => window.crypto.subtle.digest("SHA-1", arrayBuffer)),
4248
+ map(hexFromBuffer)
4249
+ ), uploadSanityAsset$ = (client, assetType, file, hash) => of(null).pipe(
4244
4250
  // NOTE: the sanity api will still dedupe unique files, but this saves us from uploading the asset file entirely
4245
- operators$1.mergeMap(() => fetchExisting$(client, `sanity.${assetType}Asset`, hash)),
4251
+ mergeMap(() => fetchExisting$(client, `sanity.${assetType}Asset`, hash)),
4246
4252
  // Cancel if the asset already exists
4247
- operators$1.mergeMap((existingAsset) => existingAsset ? rxjs.throwError({
4253
+ mergeMap((existingAsset) => existingAsset ? throwError({
4248
4254
  message: "Asset already exists",
4249
4255
  statusCode: 409
4250
- }) : rxjs.of(null)),
4251
- operators$1.mergeMap(() => client.observable.assets.upload(assetType, file, {
4256
+ }) : of(null)),
4257
+ mergeMap(() => client.observable.assets.upload(assetType, file, {
4252
4258
  extract: ["blurhash", "exif", "location", "lqip", "palette"],
4253
4259
  preserveFilename: !0
4254
4260
  }).pipe(
4255
- operators$1.map(
4261
+ map(
4256
4262
  (event) => event.type === "response" ? {
4257
4263
  // rewrite to a 'complete' event
4258
4264
  asset: event.body.document,
@@ -4264,7 +4270,7 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
4264
4270
  ), uploadAsset$ = withMaxConcurrency(uploadSanityAsset$), initialState$2 = {
4265
4271
  allIds: [],
4266
4272
  byIds: {}
4267
- }, uploadsSlice = toolkit.createSlice({
4273
+ }, uploadsSlice = createSlice({
4268
4274
  name: "uploads",
4269
4275
  initialState: initialState$2,
4270
4276
  extraReducers: (builder) => {
@@ -4310,14 +4316,14 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
4310
4316
  }
4311
4317
  }
4312
4318
  }), uploadsAssetStartEpic = (action$, _state$, { client }) => action$.pipe(
4313
- operators$1.filter(uploadsActions.uploadStart.match),
4314
- operators$1.mergeMap((action) => {
4319
+ filter(uploadsActions.uploadStart.match),
4320
+ mergeMap((action) => {
4315
4321
  const { file, uploadItem } = action.payload;
4316
- return rxjs.merge(
4322
+ return merge(
4317
4323
  // Generate low res preview
4318
- rxjs.of(null).pipe(
4319
- operators$1.mergeMap(() => generatePreviewBlobUrl$(file)),
4320
- operators$1.mergeMap((url) => rxjs.of(
4324
+ of(null).pipe(
4325
+ mergeMap(() => generatePreviewBlobUrl$(file)),
4326
+ mergeMap((url) => of(
4321
4327
  uploadsActions.previewReady({
4322
4328
  blobUrl: url,
4323
4329
  hash: uploadItem.hash
@@ -4325,27 +4331,27 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
4325
4331
  ))
4326
4332
  ),
4327
4333
  // Upload asset and receive progress / complete events
4328
- rxjs.of(null).pipe(
4334
+ of(null).pipe(
4329
4335
  // delay(500000), // debug uploads
4330
- operators$1.mergeMap(() => uploadAsset$(client, uploadItem.assetType, file, uploadItem.hash)),
4331
- operators$1.takeUntil(
4336
+ mergeMap(() => uploadAsset$(client, uploadItem.assetType, file, uploadItem.hash)),
4337
+ takeUntil(
4332
4338
  action$.pipe(
4333
- operators$1.filter(uploadsActions.uploadCancel.match),
4334
- operators$1.filter((v) => v.payload.hash === uploadItem.hash)
4339
+ filter(uploadsActions.uploadCancel.match),
4340
+ filter((v) => v.payload.hash === uploadItem.hash)
4335
4341
  )
4336
4342
  ),
4337
- operators$1.mergeMap((event) => event?.type === "complete" ? rxjs.of(
4343
+ mergeMap((event) => event?.type === "complete" ? of(
4338
4344
  UPLOADS_ACTIONS.uploadComplete({
4339
4345
  asset: event.asset
4340
4346
  })
4341
- ) : event?.type === "progress" && event?.stage === "upload" ? rxjs.of(
4347
+ ) : event?.type === "progress" && event?.stage === "upload" ? of(
4342
4348
  uploadsActions.uploadProgress({
4343
4349
  event,
4344
4350
  uploadHash: uploadItem.hash
4345
4351
  })
4346
- ) : rxjs.empty()),
4347
- operators$1.catchError(
4348
- (error) => rxjs.of(
4352
+ ) : empty()),
4353
+ catchError(
4354
+ (error) => of(
4349
4355
  uploadsActions.uploadError({
4350
4356
  error: {
4351
4357
  message: error?.message || "Internal error",
@@ -4359,18 +4365,18 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
4359
4365
  );
4360
4366
  })
4361
4367
  ), uploadsAssetUploadEpic = (action$, state$) => action$.pipe(
4362
- operators$1.filter(uploadsActions.uploadRequest.match),
4363
- operators$1.withLatestFrom(state$),
4364
- operators$1.mergeMap(([action, state]) => {
4368
+ filter(uploadsActions.uploadRequest.match),
4369
+ withLatestFrom(state$),
4370
+ mergeMap(([action, state]) => {
4365
4371
  const { file, forceAsAssetType } = action.payload;
4366
- return rxjs.of(action).pipe(
4372
+ return of(action).pipe(
4367
4373
  // Generate SHA1 hash from local file
4368
4374
  // This will throw in insecure contexts (non-localhost / https)
4369
- operators$1.mergeMap(() => hashFile$(file)),
4375
+ mergeMap(() => hashFile$(file)),
4370
4376
  // Ignore if the file exists and is currently being uploaded
4371
- operators$1.filter((hash) => !state.uploads.byIds[hash]),
4377
+ filter((hash) => !state.uploads.byIds[hash]),
4372
4378
  // Dispatch start action and begin upload process
4373
- operators$1.mergeMap((hash) => {
4379
+ mergeMap((hash) => {
4374
4380
  const uploadItem = {
4375
4381
  _type: "upload",
4376
4382
  assetType: forceAsAssetType || (file.type.indexOf("image") >= 0 ? "image" : "file"),
@@ -4379,35 +4385,35 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
4379
4385
  size: file.size,
4380
4386
  status: "queued"
4381
4387
  };
4382
- return rxjs.of(uploadsActions.uploadStart({ file, uploadItem }));
4388
+ return of(uploadsActions.uploadStart({ file, uploadItem }));
4383
4389
  })
4384
4390
  );
4385
4391
  })
4386
4392
  ), uploadsCompleteQueueEpic = (action$) => action$.pipe(
4387
- operators$1.filter(UPLOADS_ACTIONS.uploadComplete.match),
4388
- operators$1.mergeMap((action) => rxjs.of(
4393
+ filter(UPLOADS_ACTIONS.uploadComplete.match),
4394
+ mergeMap((action) => of(
4389
4395
  uploadsActions.checkRequest({
4390
4396
  assets: [action.payload.asset]
4391
4397
  })
4392
4398
  ))
4393
4399
  ), uploadsCheckRequestEpic = (action$, state$, { client }) => action$.pipe(
4394
- operators$1.filter(uploadsActions.checkRequest.match),
4395
- operators$1.withLatestFrom(state$),
4396
- operators$1.mergeMap(([action, state]) => {
4400
+ filter(uploadsActions.checkRequest.match),
4401
+ withLatestFrom(state$),
4402
+ mergeMap(([action, state]) => {
4397
4403
  const { assets } = action.payload, documentIds = assets.map((asset) => asset._id), constructedFilter = constructFilter({
4398
4404
  assetTypes: state.assets.assetTypes,
4399
4405
  searchFacets: state.search.facets,
4400
4406
  searchQuery: state.search.query
4401
- }), query = groq__default.default`
4407
+ }), query = groq`
4402
4408
  *[${constructedFilter} && _id in $documentIds].sha1hash
4403
4409
  `;
4404
- return rxjs.of(action).pipe(
4405
- operators$1.delay(1e3),
4410
+ return of(action).pipe(
4411
+ delay(1e3),
4406
4412
  // give Sanity some time to register the recently uploaded asset
4407
- operators$1.mergeMap(() => client.observable.fetch(query, { documentIds })),
4408
- operators$1.mergeMap((resultHashes) => {
4413
+ mergeMap(() => client.observable.fetch(query, { documentIds })),
4414
+ mergeMap((resultHashes) => {
4409
4415
  const checkedResults = assets.reduce((acc, asset) => (acc[asset.sha1hash] = resultHashes.includes(asset.sha1hash) ? asset._id : null, acc), {});
4410
- return rxjs.of(
4416
+ return of(
4411
4417
  uploadsActions.checkComplete({ results: checkedResults }),
4412
4418
  //
4413
4419
  assetsActions.insertUploads({ results: checkedResults })
@@ -4415,37 +4421,37 @@ const createThrottler = (concurrency = DEFAULT_CONCURRENCY) => {
4415
4421
  })
4416
4422
  );
4417
4423
  })
4418
- ), selectUploadsByIds = (state) => state.uploads.byIds, selectUploadsAllIds = (state) => state.uploads.allIds, selectUploadById = toolkit.createSelector(
4424
+ ), selectUploadsByIds = (state) => state.uploads.byIds, selectUploadsAllIds = (state) => state.uploads.allIds, selectUploadById = createSelector(
4419
4425
  [
4420
4426
  (state) => state.uploads.byIds,
4421
4427
  (_state, uploadId) => uploadId
4422
4428
  ],
4423
4429
  (byIds, uploadId) => byIds[uploadId]
4424
4430
  );
4425
- toolkit.createSelector(
4431
+ createSelector(
4426
4432
  [selectUploadsByIds, selectUploadsAllIds],
4427
4433
  (byIds, allIds) => allIds.map((id) => byIds[id])
4428
4434
  );
4429
4435
  const uploadsActions = { ...uploadsSlice.actions };
4430
4436
  var uploadsReducer = uploadsSlice.reducer;
4431
- const CardWrapper = styledComponents.styled(ui.Flex)`
4437
+ const CardWrapper = styled(Flex)`
4432
4438
  box-sizing: border-box;
4433
4439
  height: 100%;
4434
4440
  overflow: hidden;
4435
4441
  position: relative;
4436
4442
  width: 100%;
4437
4443
  `, CardUpload = (props) => {
4438
- const { id } = props, scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), item = useTypedSelector((state) => selectUploadById(state, id));
4444
+ const { id } = props, scheme = useColorSchemeValue(), dispatch = useDispatch(), item = useTypedSelector((state) => selectUploadById(state, id));
4439
4445
  if (!item)
4440
4446
  return null;
4441
- const fileSize = filesize__default.default(item.size, { base: 10, round: 0 }), percentLoaded = Math.round(item.percent || 0), isComplete = item.status === "complete", isUploading = item.status === "uploading", isQueued = item.status === "queued";
4447
+ const fileSize = filesize(item.size, { base: 10, round: 0 }), percentLoaded = Math.round(item.percent || 0), isComplete = item.status === "complete", isUploading = item.status === "uploading", isQueued = item.status === "queued";
4442
4448
  let status;
4443
4449
  isComplete && (status = "Verifying"), isUploading && (status = `${percentLoaded}%`), isQueued && (status = "Queued");
4444
4450
  const handleCancelUpload = () => {
4445
4451
  dispatch(uploadsActions.uploadCancel({ hash: item.hash }));
4446
4452
  };
4447
- return /* @__PURE__ */ jsxRuntime.jsx(CardWrapper, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(
4448
- ui.Flex,
4453
+ return /* @__PURE__ */ jsx(CardWrapper, { padding: 1, children: /* @__PURE__ */ jsxs(
4454
+ Flex,
4449
4455
  {
4450
4456
  direction: "column",
4451
4457
  flex: 1,
@@ -4456,7 +4462,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4456
4462
  position: "relative"
4457
4463
  },
4458
4464
  children: [
4459
- /* @__PURE__ */ jsxRuntime.jsx(
4465
+ /* @__PURE__ */ jsx(
4460
4466
  "div",
4461
4467
  {
4462
4468
  style: {
@@ -4472,8 +4478,8 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4472
4478
  }
4473
4479
  }
4474
4480
  ),
4475
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { flex: 1, style: { position: "relative" }, children: [
4476
- item.assetType === "image" && item?.objectUrl && /* @__PURE__ */ jsxRuntime.jsx(
4481
+ /* @__PURE__ */ jsxs(Box, { flex: 1, style: { position: "relative" }, children: [
4482
+ item.assetType === "image" && item?.objectUrl && /* @__PURE__ */ jsx(
4477
4483
  Image$1,
4478
4484
  {
4479
4485
  draggable: !1,
@@ -4484,9 +4490,9 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4484
4490
  }
4485
4491
  }
4486
4492
  ),
4487
- item.assetType === "file" && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100%", opacity: 0.1 }, children: /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { width: "80px" }) }),
4488
- !isComplete && percentLoaded !== 100 && /* @__PURE__ */ jsxRuntime.jsx(
4489
- ui.Flex,
4493
+ item.assetType === "file" && /* @__PURE__ */ jsx("div", { style: { height: "100%", opacity: 0.1 }, children: /* @__PURE__ */ jsx(FileIcon, { width: "80px" }) }),
4494
+ !isComplete && percentLoaded !== 100 && /* @__PURE__ */ jsx(
4495
+ Flex,
4490
4496
  {
4491
4497
  align: "center",
4492
4498
  direction: "column",
@@ -4498,11 +4504,11 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4498
4504
  top: 0,
4499
4505
  width: "100%"
4500
4506
  },
4501
- children: /* @__PURE__ */ jsxRuntime.jsx(
4502
- ui.Button,
4507
+ children: /* @__PURE__ */ jsx(
4508
+ Button,
4503
4509
  {
4504
4510
  fontSize: 4,
4505
- icon: icons.CloseIcon,
4511
+ icon: CloseIcon,
4506
4512
  mode: "bleed",
4507
4513
  onClick: handleCancelUpload,
4508
4514
  padding: 2,
@@ -4513,48 +4519,48 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4513
4519
  }
4514
4520
  )
4515
4521
  ] }),
4516
- /* @__PURE__ */ jsxRuntime.jsxs(
4517
- ui.Flex,
4522
+ /* @__PURE__ */ jsxs(
4523
+ Flex,
4518
4524
  {
4519
4525
  align: "center",
4520
4526
  justify: "space-between",
4521
4527
  paddingX: 2,
4522
4528
  style: { height: `${PANEL_HEIGHT}px` },
4523
4529
  children: [
4524
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, marginRight: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: 0, textOverflow: "ellipsis", children: [
4530
+ /* @__PURE__ */ jsx(Box, { flex: 1, marginRight: 1, children: /* @__PURE__ */ jsxs(Text, { size: 0, textOverflow: "ellipsis", children: [
4525
4531
  item.name,
4526
4532
  " (",
4527
4533
  fileSize,
4528
4534
  ")"
4529
4535
  ] }) }),
4530
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 0, style: { flexShrink: 0 }, weight: "semibold", children: status })
4536
+ /* @__PURE__ */ jsx(Text, { size: 0, style: { flexShrink: 0 }, weight: "semibold", children: status })
4531
4537
  ]
4532
4538
  }
4533
4539
  )
4534
4540
  ]
4535
4541
  }
4536
4542
  ) });
4537
- }, CARD_HEIGHT = 220, CARD_WIDTH = 240, VirtualCell = react.memo(
4538
- ({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsxRuntime.jsx(CardAsset, { id: item.id, selected }) : item?.type === "upload" ? /* @__PURE__ */ jsxRuntime.jsx(CardUpload, { id: item.id }) : null
4539
- ), StyledItemContainer = styledComponents.styled.div`
4543
+ }, CARD_HEIGHT = 220, CARD_WIDTH = 240, VirtualCell = memo(
4544
+ ({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsx(CardAsset, { id: item.id, selected }) : item?.type === "upload" ? /* @__PURE__ */ jsx(CardUpload, { id: item.id }) : null
4545
+ ), StyledItemContainer = styled.div`
4540
4546
  height: ${CARD_HEIGHT}px;
4541
4547
  width: ${CARD_WIDTH}px;
4542
- `, ItemContainer = react.forwardRef((props, ref) => {
4548
+ `, ItemContainer = forwardRef((props, ref) => {
4543
4549
  const { context, ...rest } = props;
4544
- return /* @__PURE__ */ jsxRuntime.jsx(StyledItemContainer, { ref, ...rest });
4545
- }), StyledListContainer = styledComponents.styled.div`
4550
+ return /* @__PURE__ */ jsx(StyledItemContainer, { ref, ...rest });
4551
+ }), StyledListContainer = styled.div`
4546
4552
  display: grid;
4547
4553
  grid-template-columns: repeat(auto-fill, ${CARD_WIDTH}px);
4548
4554
  grid-template-rows: repeat(auto-fill, ${CARD_HEIGHT}px);
4549
4555
  justify-content: center;
4550
4556
  margin: 0 auto;
4551
- `, ListContainer = react.forwardRef((props, ref) => {
4557
+ `, ListContainer = forwardRef((props, ref) => {
4552
4558
  const { context, ...rest } = props;
4553
- return /* @__PURE__ */ jsxRuntime.jsx(StyledListContainer, { ref, ...rest });
4559
+ return /* @__PURE__ */ jsx(StyledListContainer, { ref, ...rest });
4554
4560
  }), AssetGridVirtualized = (props) => {
4555
4561
  const { items, onLoadMore } = props, selectedAssets = useTypedSelector((state) => state.selected.assets), selectedIds = selectedAssets && selectedAssets.map((asset) => asset._id) || [], totalCount = items?.length;
4556
- return totalCount === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(
4557
- reactVirtuoso.VirtuosoGrid,
4562
+ return totalCount === 0 ? null : /* @__PURE__ */ jsx(
4563
+ VirtuosoGrid,
4558
4564
  {
4559
4565
  className: "media__custom-scrollbar",
4560
4566
  computeItemKey: (index) => items[index]?.id,
@@ -4565,7 +4571,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4565
4571
  endReached: onLoadMore,
4566
4572
  itemContent: (index) => {
4567
4573
  const item = items[index], selected = selectedIds.includes(item?.id);
4568
- return /* @__PURE__ */ jsxRuntime.jsx(VirtualCell, { item, selected });
4574
+ return /* @__PURE__ */ jsx(VirtualCell, { item, selected });
4569
4575
  },
4570
4576
  overscan: 48,
4571
4577
  style: { overflowX: "hidden", overflowY: "scroll" },
@@ -4573,9 +4579,9 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4573
4579
  }
4574
4580
  );
4575
4581
  }, TableHeaderItem = (props) => {
4576
- const { field, title } = props, dispatch = reactRedux.useDispatch(), order = useTypedSelector((state) => state.assets.order), isActive = order.field === field;
4577
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { muted: !field, size: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
4578
- ui.Box,
4582
+ const { field, title } = props, dispatch = useDispatch(), order = useTypedSelector((state) => state.assets.order), isActive = order.field === field;
4583
+ return /* @__PURE__ */ jsx(Label, { muted: !field, size: 0, children: /* @__PURE__ */ jsxs(
4584
+ Box,
4579
4585
  {
4580
4586
  onClick: field ? () => {
4581
4587
  if (!(!field || !title))
@@ -4591,7 +4597,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4591
4597
  whiteSpace: "nowrap"
4592
4598
  },
4593
4599
  children: [
4594
- /* @__PURE__ */ jsxRuntime.jsx(
4600
+ /* @__PURE__ */ jsx(
4595
4601
  "span",
4596
4602
  {
4597
4603
  style: {
@@ -4600,14 +4606,14 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4600
4606
  children: title
4601
4607
  }
4602
4608
  ),
4603
- isActive && order?.direction === "asc" && /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronUpIcon, {}),
4604
- isActive && order?.direction === "desc" && /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDownIcon, {})
4609
+ isActive && order?.direction === "asc" && /* @__PURE__ */ jsx(ChevronUpIcon, {}),
4610
+ isActive && order?.direction === "desc" && /* @__PURE__ */ jsx(ChevronDownIcon, {})
4605
4611
  ]
4606
4612
  }
4607
4613
  ) });
4608
- }, ContextActionContainer$1 = styledComponents.styled(ui.Flex)(({
4614
+ }, ContextActionContainer$1 = styled(Flex)(({
4609
4615
  $scheme
4610
- }) => styledComponents.css`
4616
+ }) => css`
4611
4617
  cursor: pointer;
4612
4618
  @media (hover: hover) and (pointer: fine) {
4613
4619
  &:hover {
@@ -4615,11 +4621,11 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4615
4621
  }
4616
4622
  }
4617
4623
  `), TableHeader = () => {
4618
- const scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), fetching = useTypedSelector((state) => state.assets.fetching), itemsLength = useTypedSelector(selectAssetsLength), numPickedAssets = useTypedSelector(selectAssetsPickedLength), mediaIndex = ui.useMediaIndex(), { onSelect } = useAssetSourceActions(), allSelected = numPickedAssets === itemsLength, handleContextActionClick = (e) => {
4624
+ const scheme = useColorSchemeValue(), dispatch = useDispatch(), fetching = useTypedSelector((state) => state.assets.fetching), itemsLength = useTypedSelector(selectAssetsLength), numPickedAssets = useTypedSelector(selectAssetsPickedLength), mediaIndex = useMediaIndex(), { onSelect } = useAssetSourceActions(), allSelected = numPickedAssets === itemsLength, handleContextActionClick = (e) => {
4619
4625
  e.stopPropagation(), dispatch(allSelected ? assetsActions.pickClear() : assetsActions.pickAll());
4620
4626
  };
4621
- return /* @__PURE__ */ jsxRuntime.jsxs(
4622
- ui.Grid,
4627
+ return /* @__PURE__ */ jsxs(
4628
+ Grid,
4623
4629
  {
4624
4630
  style: {
4625
4631
  alignItems: "center",
@@ -4638,7 +4644,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4638
4644
  // force stacking context
4639
4645
  },
4640
4646
  children: [
4641
- onSelect ? /* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, {}) : /* @__PURE__ */ jsxRuntime.jsx(
4647
+ onSelect ? /* @__PURE__ */ jsx(TableHeaderItem, {}) : /* @__PURE__ */ jsx(
4642
4648
  ContextActionContainer$1,
4643
4649
  {
4644
4650
  align: "center",
@@ -4649,8 +4655,8 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4649
4655
  height: "100%",
4650
4656
  position: "relative"
4651
4657
  },
4652
- children: /* @__PURE__ */ jsxRuntime.jsx(
4653
- ui.Checkbox,
4658
+ children: /* @__PURE__ */ jsx(
4659
+ Checkbox,
4654
4660
  {
4655
4661
  checked: !fetching && allSelected,
4656
4662
  readOnly: !0,
@@ -4663,18 +4669,18 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4663
4669
  )
4664
4670
  }
4665
4671
  ),
4666
- /* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, {}),
4667
- /* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, { field: "originalFilename", title: "Filename" }),
4668
- /* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, { title: "Resolution" }),
4669
- /* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, { field: "mimeType", title: "MIME type" }),
4670
- /* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, { field: "size", title: "Size" }),
4671
- /* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, { field: "_updatedAt", title: "Last updated" }),
4672
- /* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, { title: "References" }),
4673
- /* @__PURE__ */ jsxRuntime.jsx(TableHeaderItem, {})
4672
+ /* @__PURE__ */ jsx(TableHeaderItem, {}),
4673
+ /* @__PURE__ */ jsx(TableHeaderItem, { field: "originalFilename", title: "Filename" }),
4674
+ /* @__PURE__ */ jsx(TableHeaderItem, { title: "Resolution" }),
4675
+ /* @__PURE__ */ jsx(TableHeaderItem, { field: "mimeType", title: "MIME type" }),
4676
+ /* @__PURE__ */ jsx(TableHeaderItem, { field: "size", title: "Size" }),
4677
+ /* @__PURE__ */ jsx(TableHeaderItem, { field: "_updatedAt", title: "Last updated" }),
4678
+ /* @__PURE__ */ jsx(TableHeaderItem, { title: "References" }),
4679
+ /* @__PURE__ */ jsx(TableHeaderItem, {})
4674
4680
  ]
4675
4681
  }
4676
4682
  );
4677
- }, REFERENCE_COUNT_VISIBILITY_DELAY = 750, ContainerGrid = styledComponents.styled(ui.Grid)(({ $scheme, $selected, $updating }) => styledComponents.css`
4683
+ }, REFERENCE_COUNT_VISIBILITY_DELAY = 750, ContainerGrid = styled(Grid)(({ $scheme, $selected, $updating }) => css`
4678
4684
  align-items: center;
4679
4685
  cursor: ${$selected ? "default" : "pointer"};
4680
4686
  height: 100%;
@@ -4682,42 +4688,42 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4682
4688
  user-select: none;
4683
4689
  white-space: nowrap;
4684
4690
 
4685
- ${!$updating && styledComponents.css`
4691
+ ${!$updating && css`
4686
4692
  @media (hover: hover) and (pointer: fine) {
4687
4693
  &:hover {
4688
4694
  background: ${getSchemeColor($scheme, "bg")};
4689
4695
  }
4690
4696
  }
4691
4697
  `}
4692
- `), ContextActionContainer = styledComponents.styled(ui.Flex)(({
4698
+ `), ContextActionContainer = styled(Flex)(({
4693
4699
  $scheme
4694
- }) => styledComponents.css`
4700
+ }) => css`
4695
4701
  cursor: pointer;
4696
4702
  @media (hover: hover) and (pointer: fine) {
4697
4703
  &:hover {
4698
4704
  background: ${getSchemeColor($scheme, "bg2")};
4699
4705
  }
4700
4706
  }
4701
- `), StyledWarningIcon = styledComponents.styled(icons.WarningFilledIcon)(({ theme }) => ({
4707
+ `), StyledWarningIcon = styled(WarningFilledIcon)(({ theme }) => ({
4702
4708
  color: theme.sanity.color.spot.red
4703
4709
  })), TableRowAsset$1 = (props) => {
4704
- const { id, selected } = props, scheme = sanity.useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = react.useState(!1), refCountVisibleTimeout = react.useRef(null), dispatch = reactRedux.useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), mediaIndex = ui.useMediaIndex(), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions(), handleContextActionClick = react.useCallback(
4710
+ const { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = useState(!1), refCountVisibleTimeout = useRef(null), dispatch = useDispatch(), lastPicked = useTypedSelector((state) => state.assets.lastPicked), item = useTypedSelector((state) => selectAssetById(state, id)), mediaIndex = useMediaIndex(), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { onSelect } = useAssetSourceActions(), handleContextActionClick = useCallback(
4705
4711
  (e) => {
4706
4712
  e.stopPropagation(), asset && (onSelect ? dispatch(dialogActions.showAssetEdit({ assetId: asset._id })) : shiftPressed.current && !picked ? dispatch(assetsActions.pickRange({ startId: lastPicked || asset._id, endId: asset._id })) : dispatch(assetsActions.pick({ assetId: asset._id, picked: !picked })));
4707
4713
  },
4708
4714
  [asset, dispatch, lastPicked, onSelect, picked, shiftPressed]
4709
- ), handleClick = react.useCallback(
4715
+ ), handleClick = useCallback(
4710
4716
  (e) => {
4711
4717
  e.stopPropagation(), asset && (onSelect ? onSelect([{ kind: "assetDocumentId", value: asset._id }]) : shiftPressed.current ? dispatch(picked ? assetsActions.pick({ assetId: asset._id, picked: !picked }) : assetsActions.pickRange({ startId: lastPicked || asset._id, endId: asset._id })) : dispatch(dialogActions.showAssetEdit({ assetId: asset._id })));
4712
4718
  },
4713
4719
  [asset, dispatch, lastPicked, onSelect, picked, shiftPressed]
4714
4720
  ), opacityCell = updating ? 0.5 : 1, opacityPreview = selected || updating ? 0.1 : 1;
4715
- return react.useEffect(() => (refCountVisibleTimeout.current = setTimeout(
4721
+ return useEffect(() => (refCountVisibleTimeout.current = setTimeout(
4716
4722
  () => setReferenceCountVisible(!0),
4717
4723
  REFERENCE_COUNT_VISIBILITY_DELAY
4718
4724
  ), () => {
4719
4725
  refCountVisibleTimeout.current && clearTimeout(refCountVisibleTimeout.current);
4720
- }), []), asset ? /* @__PURE__ */ jsxRuntime.jsxs(
4726
+ }), []), asset ? /* @__PURE__ */ jsxs(
4721
4727
  ContainerGrid,
4722
4728
  {
4723
4729
  onClick: selected ? void 0 : handleClick,
@@ -4731,7 +4737,7 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4731
4737
  },
4732
4738
  $updating: item.updating,
4733
4739
  children: [
4734
- /* @__PURE__ */ jsxRuntime.jsx(
4740
+ /* @__PURE__ */ jsx(
4735
4741
  ContextActionContainer,
4736
4742
  {
4737
4743
  onClick: handleContextActionClick,
@@ -4746,16 +4752,16 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4746
4752
  opacity: opacityCell,
4747
4753
  position: "relative"
4748
4754
  },
4749
- children: onSelect ? /* @__PURE__ */ jsxRuntime.jsx(
4750
- icons.EditIcon,
4755
+ children: onSelect ? /* @__PURE__ */ jsx(
4756
+ EditIcon,
4751
4757
  {
4752
4758
  style: {
4753
4759
  flexShrink: 0,
4754
4760
  opacity: 0.5
4755
4761
  }
4756
4762
  }
4757
- ) : /* @__PURE__ */ jsxRuntime.jsx(
4758
- ui.Checkbox,
4763
+ ) : /* @__PURE__ */ jsx(
4764
+ Checkbox,
4759
4765
  {
4760
4766
  checked: picked,
4761
4767
  readOnly: !0,
@@ -4768,8 +4774,8 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4768
4774
  )
4769
4775
  }
4770
4776
  ),
4771
- /* @__PURE__ */ jsxRuntime.jsx(
4772
- ui.Box,
4777
+ /* @__PURE__ */ jsx(
4778
+ Box,
4773
4779
  {
4774
4780
  style: {
4775
4781
  gridColumn: 2,
@@ -4778,10 +4784,10 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4778
4784
  height: "90px",
4779
4785
  width: "100px"
4780
4786
  },
4781
- children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: "center", style: { height: "100%", position: "relative" }, children: [
4782
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: { height: "100%", opacity: opacityPreview, position: "relative" }, children: [
4783
- isFileAsset(asset) && /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { extension: asset.extension, width: "40px" }),
4784
- isImageAsset(asset) && /* @__PURE__ */ jsxRuntime.jsx(
4787
+ children: /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "center", style: { height: "100%", position: "relative" }, children: [
4788
+ /* @__PURE__ */ jsxs(Box, { style: { height: "100%", opacity: opacityPreview, position: "relative" }, children: [
4789
+ isFileAsset(asset) && /* @__PURE__ */ jsx(FileIcon, { extension: asset.extension, width: "40px" }),
4790
+ isImageAsset(asset) && /* @__PURE__ */ jsx(
4785
4791
  Image$1,
4786
4792
  {
4787
4793
  draggable: !1,
@@ -4791,8 +4797,8 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4791
4797
  }
4792
4798
  )
4793
4799
  ] }),
4794
- updating && /* @__PURE__ */ jsxRuntime.jsx(
4795
- ui.Flex,
4800
+ updating && /* @__PURE__ */ jsx(
4801
+ Flex,
4796
4802
  {
4797
4803
  align: "center",
4798
4804
  justify: "center",
@@ -4803,11 +4809,11 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4803
4809
  top: 0,
4804
4810
  width: "100%"
4805
4811
  },
4806
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, {})
4812
+ children: /* @__PURE__ */ jsx(Spinner, {})
4807
4813
  }
4808
4814
  ),
4809
- selected && !updating && /* @__PURE__ */ jsxRuntime.jsx(
4810
- ui.Flex,
4815
+ selected && !updating && /* @__PURE__ */ jsx(
4816
+ Flex,
4811
4817
  {
4812
4818
  align: "center",
4813
4819
  justify: "center",
@@ -4818,14 +4824,14 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4818
4824
  top: 0,
4819
4825
  width: "100%"
4820
4826
  },
4821
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 2, children: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckmarkCircleIcon, {}) })
4827
+ children: /* @__PURE__ */ jsx(Text, { size: 2, children: /* @__PURE__ */ jsx(CheckmarkCircleIcon, {}) })
4822
4828
  }
4823
4829
  )
4824
4830
  ] })
4825
4831
  }
4826
4832
  ),
4827
- /* @__PURE__ */ jsxRuntime.jsx(
4828
- ui.Box,
4833
+ /* @__PURE__ */ jsx(
4834
+ Box,
4829
4835
  {
4830
4836
  marginLeft: mediaIndex < 3 ? 3 : 0,
4831
4837
  style: {
@@ -4833,11 +4839,11 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4833
4839
  gridRow: mediaIndex < 3 ? 2 : "auto",
4834
4840
  opacity: opacityCell
4835
4841
  },
4836
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: asset.originalFilename })
4842
+ children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: asset.originalFilename })
4837
4843
  }
4838
4844
  ),
4839
- /* @__PURE__ */ jsxRuntime.jsx(
4840
- ui.Box,
4845
+ /* @__PURE__ */ jsx(
4846
+ Box,
4841
4847
  {
4842
4848
  marginLeft: mediaIndex < 3 ? 3 : 0,
4843
4849
  style: {
@@ -4845,11 +4851,11 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4845
4851
  gridRow: mediaIndex < 3 ? 3 : "auto",
4846
4852
  opacity: opacityCell
4847
4853
  },
4848
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: isImageAsset(asset) && getAssetResolution(asset) })
4854
+ children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: isImageAsset(asset) && getAssetResolution(asset) })
4849
4855
  }
4850
4856
  ),
4851
- /* @__PURE__ */ jsxRuntime.jsx(
4852
- ui.Box,
4857
+ /* @__PURE__ */ jsx(
4858
+ Box,
4853
4859
  {
4854
4860
  style: {
4855
4861
  display: mediaIndex < 3 ? "none" : "block",
@@ -4857,11 +4863,11 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4857
4863
  gridRow: "auto",
4858
4864
  opacity: opacityCell
4859
4865
  },
4860
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: asset.mimeType })
4866
+ children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: asset.mimeType })
4861
4867
  }
4862
4868
  ),
4863
- /* @__PURE__ */ jsxRuntime.jsx(
4864
- ui.Box,
4869
+ /* @__PURE__ */ jsx(
4870
+ Box,
4865
4871
  {
4866
4872
  style: {
4867
4873
  display: mediaIndex < 3 ? "none" : "block",
@@ -4869,11 +4875,11 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4869
4875
  gridRow: "auto",
4870
4876
  opacity: opacityCell
4871
4877
  },
4872
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: filesize__default.default(asset.size, { base: 10, round: 0 }) })
4878
+ children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: filesize(asset.size, { base: 10, round: 0 }) })
4873
4879
  }
4874
4880
  ),
4875
- /* @__PURE__ */ jsxRuntime.jsx(
4876
- ui.Box,
4881
+ /* @__PURE__ */ jsx(
4882
+ Box,
4877
4883
  {
4878
4884
  marginLeft: mediaIndex < 3 ? 3 : 0,
4879
4885
  style: {
@@ -4881,11 +4887,11 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4881
4887
  gridRow: mediaIndex < 3 ? 4 : "auto",
4882
4888
  opacity: opacityCell
4883
4889
  },
4884
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: dateFns.formatRelative(new Date(asset._updatedAt), /* @__PURE__ */ new Date()) })
4890
+ children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: formatRelative(new Date(asset._updatedAt), /* @__PURE__ */ new Date()) })
4885
4891
  }
4886
4892
  ),
4887
- /* @__PURE__ */ jsxRuntime.jsx(
4888
- ui.Box,
4893
+ /* @__PURE__ */ jsx(
4894
+ Box,
4889
4895
  {
4890
4896
  style: {
4891
4897
  display: mediaIndex < 3 ? "none" : "block",
@@ -4893,14 +4899,14 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4893
4899
  gridRow: "auto",
4894
4900
  opacity: opacityCell
4895
4901
  },
4896
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: referenceCountVisible ? /* @__PURE__ */ jsxRuntime.jsx(sanity.WithReferringDocuments, { id, children: ({ isLoading, referringDocuments }) => {
4902
+ children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, style: { lineHeight: "2em" }, textOverflow: "ellipsis", children: referenceCountVisible ? /* @__PURE__ */ jsx(WithReferringDocuments, { id, children: ({ isLoading, referringDocuments }) => {
4897
4903
  const uniqueDocuments = getUniqueDocuments(referringDocuments);
4898
- return isLoading ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "-" }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.isArray(uniqueDocuments) ? uniqueDocuments.length : 0 });
4899
- } }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "-" }) })
4904
+ return isLoading ? /* @__PURE__ */ jsx(Fragment, { children: "-" }) : /* @__PURE__ */ jsx(Fragment, { children: Array.isArray(uniqueDocuments) ? uniqueDocuments.length : 0 });
4905
+ } }) : /* @__PURE__ */ jsx(Fragment, { children: "-" }) })
4900
4906
  }
4901
4907
  ),
4902
- /* @__PURE__ */ jsxRuntime.jsx(
4903
- ui.Flex,
4908
+ /* @__PURE__ */ jsx(
4909
+ Flex,
4904
4910
  {
4905
4911
  align: "center",
4906
4912
  justify: "center",
@@ -4910,14 +4916,14 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4910
4916
  gridRowEnd: mediaIndex < 3 ? "span 5" : "auto",
4911
4917
  opacity: opacityCell
4912
4918
  },
4913
- children: error && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
4914
- ui.Tooltip,
4919
+ children: error && /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsx(
4920
+ Tooltip,
4915
4921
  {
4916
4922
  animate: !0,
4917
- content: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { padding: 2, width: 0, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: error }) }),
4923
+ content: /* @__PURE__ */ jsx(Container$2, { padding: 2, width: 0, children: /* @__PURE__ */ jsx(Text, { size: 1, children: error }) }),
4918
4924
  placement: "left",
4919
4925
  portal: !0,
4920
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(StyledWarningIcon, { color: "critical" }) })
4926
+ children: /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(StyledWarningIcon, { color: "critical" }) })
4921
4927
  }
4922
4928
  ) })
4923
4929
  }
@@ -4926,19 +4932,19 @@ const CardWrapper = styledComponents.styled(ui.Flex)`
4926
4932
  }
4927
4933
  ) : null;
4928
4934
  };
4929
- var TableRowAsset = react.memo(TableRowAsset$1);
4935
+ var TableRowAsset = memo(TableRowAsset$1);
4930
4936
  const TableRowUpload = (props) => {
4931
- const { id } = props, scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), item = useTypedSelector((state) => selectUploadById(state, id)), mediaIndex = ui.useMediaIndex();
4937
+ const { id } = props, scheme = useColorSchemeValue(), dispatch = useDispatch(), item = useTypedSelector((state) => selectUploadById(state, id)), mediaIndex = useMediaIndex();
4932
4938
  if (!item)
4933
4939
  return null;
4934
- const fileSize = filesize__default.default(item.size, { base: 10, round: 0 }), percentLoaded = Math.round(item.percent || 0), isComplete = item.status === "complete", isUploading = item.status === "uploading", isQueued = item.status === "queued";
4940
+ const fileSize = filesize(item.size, { base: 10, round: 0 }), percentLoaded = Math.round(item.percent || 0), isComplete = item.status === "complete", isUploading = item.status === "uploading", isQueued = item.status === "queued";
4935
4941
  let status;
4936
4942
  isComplete && (status = "Verifying"), isUploading && (status = `${percentLoaded}%`), isQueued && (status = "Queued");
4937
4943
  const handleCancelUpload = () => {
4938
4944
  dispatch(uploadsActions.uploadCancel({ hash: item.hash }));
4939
4945
  };
4940
- return /* @__PURE__ */ jsxRuntime.jsxs(
4941
- ui.Grid,
4946
+ return /* @__PURE__ */ jsxs(
4947
+ Grid,
4942
4948
  {
4943
4949
  style: {
4944
4950
  alignItems: "center",
@@ -4951,7 +4957,7 @@ const TableRowUpload = (props) => {
4951
4957
  position: "relative"
4952
4958
  },
4953
4959
  children: [
4954
- /* @__PURE__ */ jsxRuntime.jsx(
4960
+ /* @__PURE__ */ jsx(
4955
4961
  "div",
4956
4962
  {
4957
4963
  style: {
@@ -4967,8 +4973,8 @@ const TableRowUpload = (props) => {
4967
4973
  }
4968
4974
  }
4969
4975
  ),
4970
- /* @__PURE__ */ jsxRuntime.jsx(
4971
- ui.Box,
4976
+ /* @__PURE__ */ jsx(
4977
+ Box,
4972
4978
  {
4973
4979
  style: {
4974
4980
  gridColumn: 2,
@@ -4977,8 +4983,8 @@ const TableRowUpload = (props) => {
4977
4983
  height: "90px",
4978
4984
  width: "100px"
4979
4985
  },
4980
- children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: { height: "100%", position: "relative" }, children: [
4981
- item.assetType === "image" && item?.objectUrl && /* @__PURE__ */ jsxRuntime.jsx(
4986
+ children: /* @__PURE__ */ jsxs(Box, { style: { height: "100%", position: "relative" }, children: [
4987
+ item.assetType === "image" && item?.objectUrl && /* @__PURE__ */ jsx(
4982
4988
  Image$1,
4983
4989
  {
4984
4990
  draggable: !1,
@@ -4987,9 +4993,9 @@ const TableRowUpload = (props) => {
4987
4993
  style: { opacity: 0.25 }
4988
4994
  }
4989
4995
  ),
4990
- item.assetType === "file" && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100%", opacity: 0.1 }, children: /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { width: "40px" }) }),
4991
- !isComplete && percentLoaded !== 100 && /* @__PURE__ */ jsxRuntime.jsx(
4992
- ui.Flex,
4996
+ item.assetType === "file" && /* @__PURE__ */ jsx("div", { style: { height: "100%", opacity: 0.1 }, children: /* @__PURE__ */ jsx(FileIcon, { width: "40px" }) }),
4997
+ !isComplete && percentLoaded !== 100 && /* @__PURE__ */ jsx(
4998
+ Flex,
4993
4999
  {
4994
5000
  align: "center",
4995
5001
  justify: "center",
@@ -5000,11 +5006,11 @@ const TableRowUpload = (props) => {
5000
5006
  top: 0,
5001
5007
  width: "100%"
5002
5008
  },
5003
- children: /* @__PURE__ */ jsxRuntime.jsx(
5004
- ui.Button,
5009
+ children: /* @__PURE__ */ jsx(
5010
+ Button,
5005
5011
  {
5006
5012
  fontSize: 3,
5007
- icon: icons.CloseIcon,
5013
+ icon: CloseIcon,
5008
5014
  mode: "bleed",
5009
5015
  onClick: handleCancelUpload,
5010
5016
  padding: 2,
@@ -5017,60 +5023,60 @@ const TableRowUpload = (props) => {
5017
5023
  ] })
5018
5024
  }
5019
5025
  ),
5020
- /* @__PURE__ */ jsxRuntime.jsx(
5021
- ui.Box,
5026
+ /* @__PURE__ */ jsx(
5027
+ Box,
5022
5028
  {
5023
5029
  style: {
5024
5030
  gridColumn: mediaIndex < 3 ? 3 : "3/8",
5025
5031
  gridRow: mediaIndex < 3 ? "2/4" : "auto",
5026
5032
  marginLeft: mediaIndex < 3 ? 3 : 0
5027
5033
  },
5028
- children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
5029
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { muted: !0, size: 1, textOverflow: "ellipsis", children: [
5034
+ children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
5035
+ /* @__PURE__ */ jsxs(Text, { muted: !0, size: 1, textOverflow: "ellipsis", children: [
5030
5036
  item.name,
5031
5037
  " (",
5032
5038
  fileSize,
5033
5039
  ")"
5034
5040
  ] }),
5035
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, textOverflow: "ellipsis", weight: "semibold", children: status })
5041
+ /* @__PURE__ */ jsx(Text, { size: 1, textOverflow: "ellipsis", weight: "semibold", children: status })
5036
5042
  ] })
5037
5043
  }
5038
5044
  )
5039
5045
  ]
5040
5046
  }
5041
5047
  );
5042
- }, VirtualRow = react.memo(
5043
- ({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsxRuntime.jsx(TableRowAsset, { id: item.id, selected }) }) : item?.type === "upload" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsxRuntime.jsx(TableRowUpload, { id: item.id }) }) : null
5048
+ }, VirtualRow = memo(
5049
+ ({ item, selected }) => item?.type === "asset" ? /* @__PURE__ */ jsx(Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsx(TableRowAsset, { id: item.id, selected }) }) : item?.type === "upload" ? /* @__PURE__ */ jsx(Box, { style: { height: "100px" }, children: /* @__PURE__ */ jsx(TableRowUpload, { id: item.id }) }) : null
5044
5050
  ), AssetTableVirtualized = (props) => {
5045
5051
  const { items, onLoadMore } = props, selectedAssets = useTypedSelector((state) => state.selected.assets), selectedIds = selectedAssets && selectedAssets.map((asset) => asset._id) || [], totalCount = items?.length;
5046
- return totalCount === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(
5047
- reactVirtuoso.GroupedVirtuoso,
5052
+ return totalCount === 0 ? null : /* @__PURE__ */ jsx(
5053
+ GroupedVirtuoso,
5048
5054
  {
5049
5055
  className: "media__custom-scrollbar",
5050
5056
  computeItemKey: (index) => items[index]?.id || index,
5051
5057
  endReached: onLoadMore,
5052
5058
  groupCounts: Array(1).fill(totalCount),
5053
- groupContent: () => /* @__PURE__ */ jsxRuntime.jsx(TableHeader, {}),
5059
+ groupContent: () => /* @__PURE__ */ jsx(TableHeader, {}),
5054
5060
  itemContent: (index) => {
5055
5061
  const item = items[index], selected = selectedIds.includes(item?.id);
5056
- return /* @__PURE__ */ jsxRuntime.jsx(VirtualRow, { item, selected });
5062
+ return /* @__PURE__ */ jsx(VirtualRow, { item, selected });
5057
5063
  },
5058
5064
  style: { overflowX: "hidden" }
5059
5065
  }
5060
5066
  );
5061
5067
  }, Items = () => {
5062
- const dispatch = reactRedux.useDispatch(), fetchCount = useTypedSelector((state) => state.assets.fetchCount), fetching = useTypedSelector((state) => state.assets.fetching), tagsPanelVisible = useTypedSelector((state) => state.tags.panelVisible), view = useTypedSelector((state) => state.assets.view), combinedItems = useTypedSelector(selectCombinedItems), breakpointIndex = useBreakpointIndex(), hasFetchedOnce = fetchCount >= 0, hasItems = combinedItems.length > 0, handleLoadMoreItems = () => {
5068
+ const dispatch = useDispatch(), fetchCount = useTypedSelector((state) => state.assets.fetchCount), fetching = useTypedSelector((state) => state.assets.fetching), tagsPanelVisible = useTypedSelector((state) => state.tags.panelVisible), view = useTypedSelector((state) => state.assets.view), combinedItems = useTypedSelector(selectCombinedItems), breakpointIndex = useBreakpointIndex(), hasFetchedOnce = fetchCount >= 0, hasItems = combinedItems.length > 0, handleLoadMoreItems = () => {
5063
5069
  fetching || dispatch(assetsActions.loadNextPage());
5064
5070
  };
5065
- return react.useEffect(() => {
5071
+ return useEffect(() => {
5066
5072
  breakpointIndex <= 1 && tagsPanelVisible && dispatch(tagsActions.panelVisibleSet({ panelVisible: !1 }));
5067
- }, [breakpointIndex]), /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, style: { width: "100%" }, children: !hasItems && hasFetchedOnce && !fetching ? /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, weight: "semibold", children: "No results for the current query" }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5068
- view === "grid" && /* @__PURE__ */ jsxRuntime.jsx(AssetGridVirtualized, { items: combinedItems, onLoadMore: handleLoadMoreItems }),
5069
- view === "table" && /* @__PURE__ */ jsxRuntime.jsx(AssetTableVirtualized, { items: combinedItems, onLoadMore: handleLoadMoreItems })
5073
+ }, [breakpointIndex]), /* @__PURE__ */ jsx(Box, { flex: 1, style: { width: "100%" }, children: !hasItems && hasFetchedOnce && !fetching ? /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsx(Text, { size: 1, weight: "semibold", children: "No results for the current query" }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
5074
+ view === "grid" && /* @__PURE__ */ jsx(AssetGridVirtualized, { items: combinedItems, onLoadMore: handleLoadMoreItems }),
5075
+ view === "table" && /* @__PURE__ */ jsx(AssetTableVirtualized, { items: combinedItems, onLoadMore: handleLoadMoreItems })
5070
5076
  ] }) });
5071
5077
  }, Notifications = () => {
5072
- const items = useTypedSelector((state) => state.notifications.items), toast = ui.useToast();
5073
- return react.useEffect(() => {
5078
+ const items = useTypedSelector((state) => state.notifications.items), toast = useToast();
5079
+ return useEffect(() => {
5074
5080
  if (items.length > 0) {
5075
5081
  const lastItem = items[items.length - 1];
5076
5082
  toast.push({
@@ -5081,13 +5087,13 @@ const TableRowUpload = (props) => {
5081
5087
  }
5082
5088
  }, [items.length]), null;
5083
5089
  }, PickedBar = () => {
5084
- const scheme = sanity.useColorSchemeValue(), dispatch = reactRedux.useDispatch(), assetsPicked = useTypedSelector(selectAssetsPicked), handlePickClear = () => {
5090
+ const scheme = useColorSchemeValue(), dispatch = useDispatch(), assetsPicked = useTypedSelector(selectAssetsPicked), handlePickClear = () => {
5085
5091
  dispatch(assetsActions.pickClear());
5086
5092
  }, handleDeletePicked = () => {
5087
5093
  dispatch(dialogActions.showConfirmDeleteAssets({ assets: assetsPicked }));
5088
5094
  };
5089
- return assetsPicked.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(
5090
- ui.Flex,
5095
+ return assetsPicked.length === 0 ? null : /* @__PURE__ */ jsx(
5096
+ Flex,
5091
5097
  {
5092
5098
  align: "center",
5093
5099
  justify: "flex-start",
@@ -5098,33 +5104,33 @@ const TableRowUpload = (props) => {
5098
5104
  position: "relative",
5099
5105
  width: "100%"
5100
5106
  },
5101
- children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", paddingX: 3, children: [
5102
- /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingRight: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Label, { size: 0, style: { color: "inherit" }, children: [
5107
+ children: /* @__PURE__ */ jsxs(Flex, { align: "center", paddingX: 3, children: [
5108
+ /* @__PURE__ */ jsx(Box, { paddingRight: 2, children: /* @__PURE__ */ jsxs(Label, { size: 0, style: { color: "inherit" }, children: [
5103
5109
  assetsPicked.length,
5104
5110
  " ",
5105
- pluralize__default.default("asset", assetsPicked.length),
5111
+ pluralize("asset", assetsPicked.length),
5106
5112
  " selected"
5107
5113
  ] }) }),
5108
- /* @__PURE__ */ jsxRuntime.jsx(
5109
- ui.Button,
5114
+ /* @__PURE__ */ jsx(
5115
+ Button,
5110
5116
  {
5111
5117
  mode: "bleed",
5112
5118
  onClick: handlePickClear,
5113
5119
  padding: 2,
5114
5120
  style: { background: "none", boxShadow: "none" },
5115
5121
  tone: "default",
5116
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 0, children: "Deselect" })
5122
+ children: /* @__PURE__ */ jsx(Label, { size: 0, children: "Deselect" })
5117
5123
  }
5118
5124
  ),
5119
- /* @__PURE__ */ jsxRuntime.jsx(
5120
- ui.Button,
5125
+ /* @__PURE__ */ jsx(
5126
+ Button,
5121
5127
  {
5122
5128
  mode: "bleed",
5123
5129
  onClick: handleDeletePicked,
5124
5130
  padding: 2,
5125
5131
  style: { background: "none", boxShadow: "none" },
5126
5132
  tone: "critical",
5127
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 0, children: "Delete" })
5133
+ children: /* @__PURE__ */ jsx(Label, { size: 0, children: "Delete" })
5128
5134
  }
5129
5135
  )
5130
5136
  ] })
@@ -5136,7 +5142,7 @@ function messageFromGenericErrorPayload(payload) {
5136
5142
  }
5137
5143
  const initialState$1 = {
5138
5144
  items: []
5139
- }, notificationsSlice = toolkit.createSlice({
5145
+ }, notificationsSlice = createSlice({
5140
5146
  name: "notifications",
5141
5147
  initialState: initialState$1,
5142
5148
  reducers: {
@@ -5150,24 +5156,24 @@ const initialState$1 = {
5150
5156
  }
5151
5157
  }
5152
5158
  }), notificationsAssetsDeleteCompleteEpic = (action$) => action$.pipe(
5153
- operators$1.filter(assetsActions.deleteComplete.match),
5154
- operators$1.mergeMap((action) => {
5159
+ filter(assetsActions.deleteComplete.match),
5160
+ mergeMap((action) => {
5155
5161
  const { assetIds } = action.payload, deletedCount = assetIds.length;
5156
- return rxjs.of(
5162
+ return of(
5157
5163
  notificationsSlice.actions.add({
5158
5164
  status: "info",
5159
- title: `${deletedCount} ${pluralize__default.default("asset", deletedCount)} deleted`
5165
+ title: `${deletedCount} ${pluralize("asset", deletedCount)} deleted`
5160
5166
  })
5161
5167
  );
5162
5168
  })
5163
5169
  ), notificationsAssetsDeleteErrorEpic = (action$) => action$.pipe(
5164
- operators$1.filter(assetsActions.deleteError.match),
5165
- operators$1.mergeMap((action) => {
5170
+ filter(assetsActions.deleteError.match),
5171
+ mergeMap((action) => {
5166
5172
  const { assetIds } = action.payload, count = assetIds.length;
5167
- return rxjs.of(
5173
+ return of(
5168
5174
  notificationsSlice.actions.add({
5169
5175
  status: "error",
5170
- title: `Unable to delete ${count} ${pluralize__default.default(
5176
+ title: `Unable to delete ${count} ${pluralize(
5171
5177
  "asset",
5172
5178
  count
5173
5179
  )}. Please review any asset errors and try again.`
@@ -5175,42 +5181,42 @@ const initialState$1 = {
5175
5181
  );
5176
5182
  })
5177
5183
  ), notificationsAssetsTagsAddCompleteEpic = (action$) => action$.pipe(
5178
- operators$1.filter(ASSETS_ACTIONS.tagsAddComplete.match),
5179
- operators$1.mergeMap((action) => {
5184
+ filter(ASSETS_ACTIONS.tagsAddComplete.match),
5185
+ mergeMap((action) => {
5180
5186
  const count = action?.payload?.assets?.length;
5181
- return rxjs.of(
5187
+ return of(
5182
5188
  notificationsSlice.actions.add({
5183
5189
  status: "info",
5184
- title: `Tag added to ${count} ${pluralize__default.default("asset", count)}`
5190
+ title: `Tag added to ${count} ${pluralize("asset", count)}`
5185
5191
  })
5186
5192
  );
5187
5193
  })
5188
5194
  ), notificationsAssetsTagsRemoveCompleteEpic = (action$) => action$.pipe(
5189
- operators$1.filter(ASSETS_ACTIONS.tagsRemoveComplete.match),
5190
- operators$1.mergeMap((action) => {
5195
+ filter(ASSETS_ACTIONS.tagsRemoveComplete.match),
5196
+ mergeMap((action) => {
5191
5197
  const count = action?.payload?.assets?.length;
5192
- return rxjs.of(
5198
+ return of(
5193
5199
  notificationsSlice.actions.add({
5194
5200
  status: "info",
5195
- title: `Tag removed from ${count} ${pluralize__default.default("asset", count)}`
5201
+ title: `Tag removed from ${count} ${pluralize("asset", count)}`
5196
5202
  })
5197
5203
  );
5198
5204
  })
5199
5205
  ), notificationsAssetsUpdateCompleteEpic = (action$) => action$.pipe(
5200
- operators$1.filter(assetsActions.updateComplete.match),
5201
- operators$1.bufferTime(2e3),
5202
- operators$1.filter((actions) => actions.length > 0),
5203
- operators$1.mergeMap((actions) => {
5206
+ filter(assetsActions.updateComplete.match),
5207
+ bufferTime(2e3),
5208
+ filter((actions) => actions.length > 0),
5209
+ mergeMap((actions) => {
5204
5210
  const updatedCount = actions.length;
5205
- return rxjs.of(
5211
+ return of(
5206
5212
  notificationsSlice.actions.add({
5207
5213
  status: "info",
5208
- title: `${updatedCount} ${pluralize__default.default("asset", updatedCount)} updated`
5214
+ title: `${updatedCount} ${pluralize("asset", updatedCount)} updated`
5209
5215
  })
5210
5216
  );
5211
5217
  })
5212
5218
  ), notificationsGenericErrorEpic = (action$) => action$.pipe(
5213
- reduxObservable.ofType(
5219
+ ofType(
5214
5220
  assetsActions.fetchError.type,
5215
5221
  assetsActions.updateError.type,
5216
5222
  tagsActions.createError.type,
@@ -5219,9 +5225,9 @@ const initialState$1 = {
5219
5225
  tagsActions.updateError.type,
5220
5226
  uploadsActions.uploadError.type
5221
5227
  ),
5222
- operators$1.mergeMap((action) => {
5228
+ mergeMap((action) => {
5223
5229
  const title = `An error occurred: ${messageFromGenericErrorPayload(action.payload)}`;
5224
- return rxjs.of(
5230
+ return of(
5225
5231
  notificationsSlice.actions.add({
5226
5232
  status: "error",
5227
5233
  title
@@ -5229,27 +5235,27 @@ const initialState$1 = {
5229
5235
  );
5230
5236
  })
5231
5237
  ), notificationsTagCreateCompleteEpic = (action$) => action$.pipe(
5232
- operators$1.filter(tagsActions.createComplete.match),
5233
- operators$1.mergeMap(() => rxjs.of(notificationsSlice.actions.add({ status: "info", title: "Tag created" })))
5238
+ filter(tagsActions.createComplete.match),
5239
+ mergeMap(() => of(notificationsSlice.actions.add({ status: "info", title: "Tag created" })))
5234
5240
  ), notificationsTagDeleteCompleteEpic = (action$) => action$.pipe(
5235
- operators$1.filter(tagsActions.deleteComplete.match),
5236
- operators$1.mergeMap(() => rxjs.of(notificationsSlice.actions.add({ status: "info", title: "Tag deleted" })))
5241
+ filter(tagsActions.deleteComplete.match),
5242
+ mergeMap(() => of(notificationsSlice.actions.add({ status: "info", title: "Tag deleted" })))
5237
5243
  ), notificationsTagUpdateCompleteEpic = (action$) => action$.pipe(
5238
- operators$1.filter(tagsActions.updateComplete.match),
5239
- operators$1.mergeMap(() => rxjs.of(notificationsSlice.actions.add({ status: "info", title: "Tag updated" })))
5244
+ filter(tagsActions.updateComplete.match),
5245
+ mergeMap(() => of(notificationsSlice.actions.add({ status: "info", title: "Tag updated" })))
5240
5246
  ), notificationsActions = { ...notificationsSlice.actions };
5241
5247
  var notificationsReducer = notificationsSlice.reducer;
5242
5248
  const initialState = {
5243
5249
  assets: [],
5244
5250
  document: void 0,
5245
5251
  documentAssetIds: []
5246
- }, selectedSlice = toolkit.createSlice({
5252
+ }, selectedSlice = createSlice({
5247
5253
  name: "selected",
5248
5254
  initialState,
5249
5255
  reducers: {}
5250
5256
  });
5251
5257
  var selectedReducer = selectedSlice.reducer;
5252
- const rootEpic = reduxObservable.combineEpics(
5258
+ const rootEpic = combineEpics(
5253
5259
  assetsDeleteEpic,
5254
5260
  assetsFetchEpic,
5255
5261
  assetsFetchAfterDeleteAllEpic,
@@ -5299,7 +5305,7 @@ const rootEpic = reduxObservable.combineEpics(
5299
5305
  selected: selectedReducer,
5300
5306
  tags: tagsReducer,
5301
5307
  uploads: uploadsReducer
5302
- }, rootReducer = toolkit.combineReducers(reducers), isPlainObject = (value) => value !== null && typeof value == "object" && !Array.isArray(value), getAssetIds = (node, acc = []) => (Array.isArray(node) && node.forEach((v) => {
5308
+ }, rootReducer = combineReducers(reducers), isPlainObject = (value) => value !== null && typeof value == "object" && !Array.isArray(value), getAssetIds = (node, acc = []) => (Array.isArray(node) && node.forEach((v) => {
5303
5309
  getAssetIds(v, acc);
5304
5310
  }), isPlainObject(node) && (node?.asset?._type === "reference" && node?.asset?._ref && acc.push(node.asset._ref), Object.values(node).forEach((val) => {
5305
5311
  getAssetIds(val, acc);
@@ -5310,17 +5316,17 @@ const rootEpic = reduxObservable.combineEpics(
5310
5316
  function isSupportedAssetType(assetType) {
5311
5317
  return assetType ? SUPPORTED_ASSET_TYPES.includes(assetType) : !1;
5312
5318
  }
5313
- class ReduxProvider extends react.Component {
5319
+ class ReduxProvider extends Component {
5314
5320
  store;
5315
5321
  constructor(props) {
5316
5322
  super(props);
5317
- const epicMiddleware = reduxObservable.createEpicMiddleware({
5323
+ const epicMiddleware = createEpicMiddleware({
5318
5324
  dependencies: {
5319
5325
  client: props.client
5320
5326
  // inject sanity client as a dependency to all epics
5321
5327
  }
5322
5328
  });
5323
- this.store = toolkit.configureStore({
5329
+ this.store = configureStore({
5324
5330
  reducer: rootReducer,
5325
5331
  middleware: (getDefaultMiddleware) => getDefaultMiddleware({
5326
5332
  /*
@@ -5370,18 +5376,18 @@ class ReduxProvider extends react.Component {
5370
5376
  }), epicMiddleware.run(rootEpic);
5371
5377
  }
5372
5378
  render() {
5373
- return /* @__PURE__ */ jsxRuntime.jsx(reactRedux.Provider, { store: this.store, children: this.props.children });
5379
+ return /* @__PURE__ */ jsx(Provider, { store: this.store, children: this.props.children });
5374
5380
  }
5375
5381
  }
5376
- const TagsPanel = () => useTypedSelector((state) => state.tags.panelVisible) ? /* @__PURE__ */ jsxRuntime.jsx(
5377
- ui.Box,
5382
+ const TagsPanel = () => useTypedSelector((state) => state.tags.panelVisible) ? /* @__PURE__ */ jsx(
5383
+ Box,
5378
5384
  {
5379
5385
  style: {
5380
5386
  position: "relative",
5381
5387
  width: TAGS_PANEL_WIDTH
5382
5388
  },
5383
- children: /* @__PURE__ */ jsxRuntime.jsx(
5384
- ui.Box,
5389
+ children: /* @__PURE__ */ jsx(
5390
+ Box,
5385
5391
  {
5386
5392
  className: "media__custom-scrollbar",
5387
5393
  style: {
@@ -5394,11 +5400,11 @@ const TagsPanel = () => useTypedSelector((state) => state.tags.panelVisible) ? /
5394
5400
  top: 0,
5395
5401
  width: "100%"
5396
5402
  },
5397
- children: /* @__PURE__ */ jsxRuntime.jsx(TagView, {})
5403
+ children: /* @__PURE__ */ jsx(TagView, {})
5398
5404
  }
5399
5405
  )
5400
5406
  }
5401
- ) : null, UploadContainer = styledComponents.styled.div`
5407
+ ) : null, UploadContainer = styled.div`
5402
5408
  color: white;
5403
5409
  height: 100%;
5404
5410
  min-height: 100%;
@@ -5409,7 +5415,7 @@ const TagsPanel = () => useTypedSelector((state) => state.tags.panelVisible) ? /
5409
5415
  &:focus {
5410
5416
  outline: none;
5411
5417
  }
5412
- `, DragActiveContainer = styledComponents.styled.div`
5418
+ `, DragActiveContainer = styled.div`
5413
5419
  align-items: center;
5414
5420
  background: rgba(0, 0, 0, 0.75);
5415
5421
  display: flex;
@@ -5434,7 +5440,7 @@ const UploadDropzone = (props) => {
5434
5440
  const { children } = props, {
5435
5441
  dropzone: { maxSize },
5436
5442
  directUploads
5437
- } = useToolOptions(), { onSelect } = useAssetSourceActions(), dispatch = reactRedux.useDispatch(), assetTypes = useTypedSelector((state) => state.assets.assetTypes), isImageAssetType = assetTypes.length === 1 && assetTypes[0] === "image", handleDrop = async (acceptedFiles) => {
5443
+ } = useToolOptions(), { onSelect } = useAssetSourceActions(), dispatch = useDispatch(), assetTypes = useTypedSelector((state) => state.assets.assetTypes), isImageAssetType = assetTypes.length === 1 && assetTypes[0] === "image", handleDrop = async (acceptedFiles) => {
5438
5444
  acceptedFiles.forEach(
5439
5445
  (file) => dispatch(
5440
5446
  uploadsActions.uploadRequest({
@@ -5465,7 +5471,7 @@ const UploadDropzone = (props) => {
5465
5471
  title: "Unable to upload some items (folders and packages aren't supported)"
5466
5472
  })
5467
5473
  ), files;
5468
- }, { getRootProps, getInputProps, isDragActive, open } = reactDropzone.useDropzone({
5474
+ }, { getRootProps, getInputProps, isDragActive, open } = useDropzone({
5469
5475
  accept: isImageAssetType ? "image/*" : "",
5470
5476
  getFilesFromEvent: handleFileGetter,
5471
5477
  noClick: !0,
@@ -5477,9 +5483,9 @@ const UploadDropzone = (props) => {
5477
5483
  onDropRejected: handleDropRejected,
5478
5484
  disabled: !directUploads
5479
5485
  });
5480
- return /* @__PURE__ */ jsxRuntime.jsx(DropzoneDispatchProvider, { open, children: /* @__PURE__ */ jsxRuntime.jsxs(UploadContainer, { ...getRootProps(), children: [
5481
- /* @__PURE__ */ jsxRuntime.jsx("input", { ...getInputProps() }),
5482
- isDragActive && /* @__PURE__ */ jsxRuntime.jsx(DragActiveContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { direction: "column", justify: "center", style: { color: color.white.hex }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 3, style: { color: "inherit" }, children: "Drop files to upload" }) }) }),
5486
+ return /* @__PURE__ */ jsx(DropzoneDispatchProvider, { open, children: /* @__PURE__ */ jsxs(UploadContainer, { ...getRootProps(), children: [
5487
+ /* @__PURE__ */ jsx("input", { ...getInputProps() }),
5488
+ isDragActive && /* @__PURE__ */ jsx(DragActiveContainer, { children: /* @__PURE__ */ jsx(Flex, { direction: "column", justify: "center", style: { color: white.hex }, children: /* @__PURE__ */ jsx(Text, { size: 3, style: { color: "inherit" }, children: "Drop files to upload" }) }) }),
5483
5489
  children
5484
5490
  ] }) });
5485
5491
  };
@@ -5524,16 +5530,16 @@ function createTagHandler(dispatch) {
5524
5530
  };
5525
5531
  }
5526
5532
  function useBrowserInit(client, schemaType) {
5527
- const dispatch = reactRedux.useDispatch(), tagsByIds = reactRedux.useSelector((state) => state.tags.byIds), tagsFetchCount = reactRedux.useSelector((state) => state.tags.fetchCount), tagNames = getMediaTagNames(schemaType), hasMediaTags = tagNames.length > 0;
5528
- react.useEffect(() => {
5533
+ const dispatch = useDispatch(), tagsByIds = useSelector((state) => state.tags.byIds), tagsFetchCount = useSelector((state) => state.tags.fetchCount), tagNames = getMediaTagNames(schemaType), hasMediaTags = tagNames.length > 0;
5534
+ useEffect(() => {
5529
5535
  hasMediaTags || dispatch(searchActions.facetsClear()), dispatch(tagsActions.fetchRequest());
5530
5536
  const assetSubscription = client.listen(
5531
- groq__default.default`*[_type in ["sanity.fileAsset", "sanity.imageAsset"] && !(_id in path("drafts.**"))]`
5532
- ).subscribe(createAssetHandler(dispatch)), tagSubscription = client.listen(groq__default.default`*[_type == "${TAG_DOCUMENT_NAME}" && !(_id in path("drafts.**"))]`).subscribe(createTagHandler(dispatch));
5537
+ groq`*[_type in ["sanity.fileAsset", "sanity.imageAsset"] && !(_id in path("drafts.**"))]`
5538
+ ).subscribe(createAssetHandler(dispatch)), tagSubscription = client.listen(groq`*[_type == "${TAG_DOCUMENT_NAME}" && !(_id in path("drafts.**"))]`).subscribe(createTagHandler(dispatch));
5533
5539
  return () => {
5534
5540
  assetSubscription.unsubscribe(), tagSubscription.unsubscribe();
5535
5541
  };
5536
- }, [client, dispatch, hasMediaTags]), react.useEffect(() => {
5542
+ }, [client, dispatch, hasMediaTags]), useEffect(() => {
5537
5543
  if (!hasMediaTags || tagsFetchCount < 0) return;
5538
5544
  const tagFacetInput = inputs.tag;
5539
5545
  if (tagFacetInput.type !== "searchable") return;
@@ -5555,46 +5561,46 @@ const BrowserContent = ({
5555
5561
  onClose,
5556
5562
  schemaType
5557
5563
  }) => {
5558
- const client = useVersionedClient(), [portalElement, setPortalElement] = react.useState(null);
5559
- return useBrowserInit(client, schemaType), /* @__PURE__ */ jsxRuntime.jsx(ui.PortalProvider, { element: portalElement, children: /* @__PURE__ */ jsxRuntime.jsxs(UploadDropzone, { children: [
5560
- /* @__PURE__ */ jsxRuntime.jsx(Dialogs, {}),
5561
- /* @__PURE__ */ jsxRuntime.jsx(Notifications, {}),
5562
- /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { display: "flex", height: "fill", ref: setPortalElement, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", flex: 1, children: [
5563
- /* @__PURE__ */ jsxRuntime.jsx(Header, { onClose }),
5564
- /* @__PURE__ */ jsxRuntime.jsx(Controls, {}),
5565
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { flex: 1, children: [
5566
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "flex-end", direction: "column", flex: 1, style: { position: "relative" }, children: [
5567
- /* @__PURE__ */ jsxRuntime.jsx(PickedBar, {}),
5568
- /* @__PURE__ */ jsxRuntime.jsx(Items, {})
5564
+ const client = useVersionedClient(), [portalElement, setPortalElement] = useState(null);
5565
+ return useBrowserInit(client, schemaType), /* @__PURE__ */ jsx(PortalProvider, { element: portalElement, children: /* @__PURE__ */ jsxs(UploadDropzone, { children: [
5566
+ /* @__PURE__ */ jsx(Dialogs, {}),
5567
+ /* @__PURE__ */ jsx(Notifications, {}),
5568
+ /* @__PURE__ */ jsx(Card, { display: "flex", height: "fill", ref: setPortalElement, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", flex: 1, children: [
5569
+ /* @__PURE__ */ jsx(Header, { onClose }),
5570
+ /* @__PURE__ */ jsx(Controls, {}),
5571
+ /* @__PURE__ */ jsxs(Flex, { flex: 1, children: [
5572
+ /* @__PURE__ */ jsxs(Flex, { align: "flex-end", direction: "column", flex: 1, style: { position: "relative" }, children: [
5573
+ /* @__PURE__ */ jsx(PickedBar, {}),
5574
+ /* @__PURE__ */ jsx(Items, {})
5569
5575
  ] }),
5570
- /* @__PURE__ */ jsxRuntime.jsx(TagsPanel, {})
5576
+ /* @__PURE__ */ jsx(TagsPanel, {})
5571
5577
  ] }),
5572
- /* @__PURE__ */ jsxRuntime.jsx(DebugControls, {})
5578
+ /* @__PURE__ */ jsx(DebugControls, {})
5573
5579
  ] }) })
5574
5580
  ] }) });
5575
5581
  }, Browser = (props) => {
5576
5582
  const client = useVersionedClient();
5577
- return /* @__PURE__ */ jsxRuntime.jsx(
5583
+ return /* @__PURE__ */ jsx(
5578
5584
  ReduxProvider,
5579
5585
  {
5580
5586
  assetType: props?.assetType,
5581
5587
  client,
5582
5588
  document: props?.document,
5583
5589
  selectedAssets: props?.selectedAssets,
5584
- children: /* @__PURE__ */ jsxRuntime.jsxs(AssetBrowserDispatchProvider, { onSelect: props?.onSelect, children: [
5585
- /* @__PURE__ */ jsxRuntime.jsx(GlobalStyle, {}),
5586
- /* @__PURE__ */ jsxRuntime.jsx(BrowserContent, { onClose: props?.onClose, schemaType: props?.schemaType })
5590
+ children: /* @__PURE__ */ jsxs(AssetBrowserDispatchProvider, { onSelect: props?.onSelect, children: [
5591
+ /* @__PURE__ */ jsx(GlobalStyle, {}),
5592
+ /* @__PURE__ */ jsx(BrowserContent, { onClose: props?.onClose, schemaType: props?.schemaType })
5587
5593
  ] })
5588
5594
  }
5589
5595
  );
5590
5596
  }, FormBuilderTool = (props) => {
5591
- const { onClose } = props, portalElement = useRootPortalElement(), currentDocument = sanity.useFormValue([]);
5597
+ const { onClose } = props, portalElement = useRootPortalElement(), currentDocument = useFormValue([]);
5592
5598
  useKeyPress("escape", onClose);
5593
5599
  const handleStopPropagation = (event) => {
5594
5600
  event.nativeEvent.stopImmediatePropagation(), event.stopPropagation();
5595
- }, { zIndex } = ui.useLayer();
5596
- return /* @__PURE__ */ jsxRuntime.jsx(ui.PortalProvider, { element: portalElement, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
5597
- ui.Box,
5601
+ }, { zIndex } = useLayer();
5602
+ return /* @__PURE__ */ jsx(PortalProvider, { element: portalElement, children: /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(
5603
+ Box,
5598
5604
  {
5599
5605
  onDragEnter: handleStopPropagation,
5600
5606
  onDragLeave: handleStopPropagation,
@@ -5610,15 +5616,15 @@ const BrowserContent = ({
5610
5616
  width: "100%",
5611
5617
  zIndex
5612
5618
  },
5613
- children: /* @__PURE__ */ jsxRuntime.jsx(Browser, { document: currentDocument, schemaType: props.schemaType, ...props })
5619
+ children: /* @__PURE__ */ jsx(Browser, { document: currentDocument, schemaType: props.schemaType, ...props })
5614
5620
  }
5615
5621
  ) }) });
5616
5622
  }, useRootPortalElement = () => {
5617
- const [container] = react.useState(() => document.createElement("div"));
5618
- return react.useEffect(() => (container.classList.add("media-portal"), document.body.appendChild(container), () => {
5623
+ const [container] = useState(() => document.createElement("div"));
5624
+ return useEffect(() => (container.classList.add("media-portal"), document.body.appendChild(container), () => {
5619
5625
  document.body.removeChild(container);
5620
5626
  }), [container]), container;
5621
- }, Tool = () => /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { direction: "column", height: "fill", flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Browser, {}) });
5627
+ }, Tool = () => /* @__PURE__ */ jsx(Flex, { direction: "column", height: "fill", flex: 1, children: /* @__PURE__ */ jsx(Browser, {}) });
5622
5628
  var mediaTag = {
5623
5629
  title: "Media Tag",
5624
5630
  icon: TagIcon,
@@ -5645,7 +5651,7 @@ var mediaTag = {
5645
5651
  }
5646
5652
  };
5647
5653
  const plugin = {
5648
- icon: icons.ImageIcon,
5654
+ icon: ImageIcon,
5649
5655
  name: "media",
5650
5656
  title: "Media"
5651
5657
  }, mediaAssetSource = {
@@ -5655,11 +5661,11 @@ const plugin = {
5655
5661
  ...plugin,
5656
5662
  component: Tool,
5657
5663
  __internalApplicationType: "sanity/media"
5658
- }, media = sanity.definePlugin((options) => ({
5664
+ }, media = definePlugin((options) => ({
5659
5665
  name: "media",
5660
5666
  studio: {
5661
5667
  components: {
5662
- layout: (props) => /* @__PURE__ */ jsxRuntime.jsx(ToolOptionsProvider, { options, children: props.renderDefault(props) })
5668
+ layout: (props) => /* @__PURE__ */ jsx(ToolOptionsProvider, { options, children: props.renderDefault(props) })
5663
5669
  }
5664
5670
  },
5665
5671
  form: {
@@ -5693,7 +5699,7 @@ async function doApplyMediaTags({
5693
5699
  if (!mediaTags || mediaTags.length === 0) return;
5694
5700
  const validTags = (await Promise.all(
5695
5701
  mediaTags.map(async (tagName) => await client.fetch(
5696
- groq__default.default`*[_type == "${TAG_DOCUMENT_NAME}" && name.current == $tagName][0]`,
5702
+ groq`*[_type == "${TAG_DOCUMENT_NAME}" && name.current == $tagName][0]`,
5697
5703
  { tagName }
5698
5704
  ) || (createTagsOnUpload ? await client.create({
5699
5705
  _type: TAG_DOCUMENT_NAME,
@@ -5702,12 +5708,12 @@ async function doApplyMediaTags({
5702
5708
  )).filter((tag) => tag !== null);
5703
5709
  if (validTags.length === 0) return;
5704
5710
  const existing = await client.fetch(
5705
- groq__default.default`*[_id == $assetId][0]{'tagIds': opt.media.tags[]._ref}`,
5711
+ groq`*[_id == $assetId][0]{'tagIds': opt.media.tags[]._ref}`,
5706
5712
  { assetId },
5707
5713
  { useCdn: !1 }
5708
5714
  // bypass CDN cache so we see the latest committed tag refs
5709
5715
  ), existingIds = new Set(existing?.tagIds ?? []), tagReferences = validTags.filter((tag) => !existingIds.has(tag._id)).map((tag) => ({
5710
- _key: nanoid.nanoid(),
5716
+ _key: nanoid(),
5711
5717
  _ref: tag._id,
5712
5718
  _type: "reference",
5713
5719
  _weak: !0
@@ -5715,8 +5721,8 @@ async function doApplyMediaTags({
5715
5721
  tagReferences.length !== 0 && await client.patch(assetId).setIfMissing({ opt: {} }).setIfMissing({ "opt.media": {} }).setIfMissing({ "opt.media.tags": [] }).append("opt.media.tags", tagReferences).commit();
5716
5722
  }
5717
5723
  function AutoTagInput(props) {
5718
- const { renderDefault, schemaType, value, mediaTags: mediaTagsProp } = props, toast = ui.useToast(), mediaTags = mediaTagsProp ?? schemaType?.options?.mediaTags, client = useVersionedClient(), { createTagsOnUpload } = useToolOptions(), prevAssetRef = react.useRef(void 0), isInitialMount = react.useRef(!0), currentAssetRef = value?.asset?._ref;
5719
- return react.useEffect(() => {
5724
+ const { renderDefault, schemaType, value, mediaTags: mediaTagsProp } = props, toast = useToast(), mediaTags = mediaTagsProp ?? schemaType?.options?.mediaTags, client = useVersionedClient(), { createTagsOnUpload } = useToolOptions(), prevAssetRef = useRef(void 0), isInitialMount = useRef(!0), currentAssetRef = value?.asset?._ref;
5725
+ return useEffect(() => {
5720
5726
  if (isInitialMount.current) {
5721
5727
  isInitialMount.current = !1, prevAssetRef.current = currentAssetRef;
5722
5728
  return;
@@ -5739,15 +5745,17 @@ function AutoTagInput(props) {
5739
5745
  }, [currentAssetRef, mediaTags, client, createTagsOnUpload]), renderDefault(props);
5740
5746
  }
5741
5747
  function mediaField(config) {
5742
- const { mediaTags, options, components, ...rest } = config;
5748
+ const { mediaTags, options, components: components2, ...rest } = config;
5743
5749
  return {
5744
5750
  ...rest,
5745
5751
  options: { ...options, mediaTags },
5746
- components: { ...components, input: AutoTagInput }
5752
+ components: { ...components2, input: AutoTagInput }
5747
5753
  };
5748
5754
  }
5749
- exports.AutoTagInput = AutoTagInput;
5750
- exports.media = media;
5751
- exports.mediaAssetSource = mediaAssetSource;
5752
- exports.mediaField = mediaField;
5755
+ export {
5756
+ AutoTagInput,
5757
+ media,
5758
+ mediaAssetSource,
5759
+ mediaField
5760
+ };
5753
5761
  //# sourceMappingURL=index.js.map