sanity-plugin-media 6.1.8 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -501,10 +501,10 @@ const useTypedSelector = useSelector, useVersionedClient = () => {
501
501
  }, buildExcludeTagsFragment = (excludeTagSlugs) => {
502
502
  let serializedExcludeTagSlugs = excludeTagSlugs?.length ? JSON.stringify(excludeTagSlugs) : void 0;
503
503
  return serializedExcludeTagSlugs ? groq`!(defined(opt.media.tags) && count(opt.media.tags[@._ref in *[_type == "${TAG_DOCUMENT_NAME}" && name.current in ${serializedExcludeTagSlugs}]._id]) > 0)` : void 0;
504
- }, constructFilter = ({ assetTypes, currentFolderId, excludeTagSlugs, searchFacets, searchQuery }) => {
504
+ }, buildExcludeMediaLibraryFragment = (showMediaLibraryAssets) => showMediaLibraryAssets ? void 0 : groq`(!defined(source.name) || source.name != "${"sanity-media-library"}") && (!defined(media._ref) || !string::startsWith(media._ref, "${"media-library:"}"))`, constructFilter = ({ assetTypes, currentFolderId, excludeTagSlugs, searchFacets, searchQuery, showMediaLibraryAssets = !0 }) => {
505
505
  let documentAssetTypes = assetTypes.map((type) => `sanity.${type}Asset`), baseFilter = groq`
506
506
  _type in ${JSON.stringify(documentAssetTypes)} && !(_id in path("drafts.**"))
507
- `, excludeTagsFragment = buildExcludeTagsFragment(excludeTagSlugs), searchFacetFragments = searchFacets.reduce((acc, facet) => {
507
+ `, excludeTagsFragment = buildExcludeTagsFragment(excludeTagSlugs), excludeMediaLibraryFragment = buildExcludeMediaLibraryFragment(showMediaLibraryAssets), searchFacetFragments = searchFacets.reduce((acc, facet) => {
508
508
  if (facet.type === "number") {
509
509
  let { field, modifier, modifiers, operatorType, value } = facet, operator = operators[operatorType], currentModifier = modifiers?.find((m) => m.name === modifier), facetField = currentModifier?.fieldModifier ? currentModifier.fieldModifier(field) : field, fragment = operator.fn(value, facetField);
510
510
  fragment && acc.push(fragment);
@@ -525,6 +525,7 @@ const useTypedSelector = useSelector, useVersionedClient = () => {
525
525
  }, []), folderFilter = currentFolderId ? `opt.media.folder._ref == ${JSON.stringify(currentFolderId)}` : void 0;
526
526
  return [
527
527
  baseFilter,
528
+ ...excludeMediaLibraryFragment ? [excludeMediaLibraryFragment] : [],
528
529
  ...excludeTagsFragment ? [excludeTagsFragment] : [],
529
530
  ...searchQuery ? [groq`[_id, altText, assetId, creditLine, description, originalFilename, title, url] match '*${searchQuery.trim()}*'`] : [],
530
531
  ...folderFilter ? [folderFilter] : [],
@@ -914,6 +915,7 @@ const UPLOADS_ACTIONS = { uploadComplete: createAction("uploads/uploadComplete",
914
915
  },
915
916
  pageIndex: 0,
916
917
  pageSize: 100,
918
+ showMediaLibraryAssets: !0,
917
919
  view: "grid"
918
920
  }, assetsSlice = createSlice({
919
921
  name: "assets",
@@ -1173,7 +1175,8 @@ const UPLOADS_ACTIONS = { uploadComplete: createAction("uploads/uploadComplete",
1173
1175
  currentFolderId: state.folders.currentFolderId,
1174
1176
  excludeTagSlugs: state.assets.excludeTagSlugs,
1175
1177
  searchFacets: state.search.facets,
1176
- searchQuery: state.search.query
1178
+ searchQuery: state.search.query,
1179
+ showMediaLibraryAssets: state.assets.showMediaLibraryAssets
1177
1180
  }), params = {
1178
1181
  ...documentId ? { documentId } : {},
1179
1182
  documentAssetIds
@@ -1392,7 +1395,7 @@ const initialState = {
1392
1395
  }
1393
1396
  }
1394
1397
  }), foldersFetchEpic = (action$, state$, { client }) => action$.pipe(filter(foldersSlice.actions.fetchRequest.match), withLatestFrom(state$), switchMap(([action, state]) => of(action).pipe(debugThrottle(state.debug.badConnection), mergeMap(() => {
1395
- let assetTypes = state.assets.assetTypes.map((type) => `sanity.${type}Asset`), excludeTagsFragment = buildExcludeTagsFragment(state.assets.excludeTagSlugs), excludeTagsClause = excludeTagsFragment ? `&& ${excludeTagsFragment}` : "";
1398
+ let assetTypes = state.assets.assetTypes.map((type) => `sanity.${type}Asset`), excludeAssetsClause = [buildExcludeTagsFragment(state.assets.excludeTagSlugs), buildExcludeMediaLibraryFragment(state.assets.showMediaLibraryAssets)].filter(Boolean).map((fragment) => `&& ${fragment}`).join("\n ");
1396
1399
  return client.observable.fetch(groq`{
1397
1400
  "folders": *[
1398
1401
  _type == "${FOLDER_DOCUMENT_NAME}"
@@ -1405,14 +1408,14 @@ const initialState = {
1405
1408
  _type in ${JSON.stringify(assetTypes)}
1406
1409
  && !(_id in path("drafts.**"))
1407
1410
  && opt.media.folder._ref == ^._id
1408
- ${excludeTagsClause}
1411
+ ${excludeAssetsClause}
1409
1412
  ])
1410
1413
  },
1411
1414
  "unfiledCount": count(*[
1412
1415
  _type in ${JSON.stringify(assetTypes)}
1413
1416
  && !(_id in path("drafts.**"))
1414
1417
  && !defined(opt.media.folder._ref)
1415
- ${excludeTagsClause}
1418
+ ${excludeAssetsClause}
1416
1419
  ])
1417
1420
  }`);
1418
1421
  }), mergeMap((result) => {
@@ -1793,7 +1796,8 @@ const customScrollbar = css`::-webkit-scrollbar{width:14px;}::-webkit-scrollbar-
1793
1796
  },
1794
1797
  directUploads: options?.directUploads ?? !0,
1795
1798
  excludeTagSlugs: options?.excludeTags?.length ? [...options.excludeTags] : [],
1796
- locales: options?.locales
1799
+ locales: options?.locales,
1800
+ showMediaLibraryAssets: options?.showMediaLibraryAssets ?? !0
1797
1801
  };
1798
1802
  }, [
1799
1803
  options?.creditLine?.enabled,
@@ -1803,7 +1807,8 @@ const customScrollbar = css`::-webkit-scrollbar{width:14px;}::-webkit-scrollbar-
1803
1807
  options?.excludeTags,
1804
1808
  options?.maximumUploadSize,
1805
1809
  options?.directUploads,
1806
- options?.locales
1810
+ options?.locales,
1811
+ options?.showMediaLibraryAssets
1807
1812
  ]);
1808
1813
  return /* @__PURE__ */ jsx(ToolOptionsContext.Provider, {
1809
1814
  value,
@@ -2497,7 +2502,7 @@ const Image$1 = styled.img.attrs({ crossOrigin: "anonymous" }).withConfig({
2497
2502
  isLoading: creating,
2498
2503
  isMulti: !0,
2499
2504
  name,
2500
- noOptionsMessage: _temp3$11,
2505
+ noOptionsMessage: _temp3$13,
2501
2506
  onBlur,
2502
2507
  onChange,
2503
2508
  onCreateOption: onCreateTag,
@@ -2526,7 +2531,7 @@ function _temp$37(state) {
2526
2531
  function _temp2$23(state_0) {
2527
2532
  return state_0.tags.fetching;
2528
2533
  }
2529
- function _temp3$11() {
2534
+ function _temp3$13() {
2530
2535
  return "No tags";
2531
2536
  }
2532
2537
  const FormFieldInputText = (props) => {
@@ -2868,7 +2873,7 @@ const DialogAssetEdit = (props) => {
2868
2873
  t19 = !1;
2869
2874
  break bb0;
2870
2875
  }
2871
- let isLocaleObj = _temp3$10, fields = [
2876
+ let isLocaleObj = _temp3$12, fields = [
2872
2877
  currentAsset.title,
2873
2878
  currentAsset.altText,
2874
2879
  currentAsset.description,
@@ -2882,7 +2887,7 @@ const DialogAssetEdit = (props) => {
2882
2887
  t19 = !0;
2883
2888
  break bb0;
2884
2889
  }
2885
- let configuredIds = new Set(locales.map(_temp4$5));
2890
+ let configuredIds = new Set(locales.map(_temp4$7));
2886
2891
  t19 = fields.some((f_0) => isLocaleObj(f_0) ? Object.keys(f_0).some((k) => !configuredIds.has(k)) : !1);
2887
2892
  }
2888
2893
  $[41] = currentAsset, $[42] = locales, $[43] = t19;
@@ -2893,8 +2898,8 @@ const DialogAssetEdit = (props) => {
2893
2898
  let cleanField = (field_1) => {
2894
2899
  if (typeof field_1 != "object" || !field_1 || Array.isArray(field_1)) return field_1;
2895
2900
  let obj_0 = field_1;
2896
- if (!locales || locales.length === 0) return Object.keys(obj_0).sort().map((k_0) => obj_0[k_0]).find(_temp5$4) || "";
2897
- let configuredIds_0 = new Set(locales.map(_temp6$2)), cleaned = {};
2901
+ if (!locales || locales.length === 0) return Object.keys(obj_0).sort().map((k_0) => obj_0[k_0]).find(_temp5$5) || "";
2902
+ let configuredIds_0 = new Set(locales.map(_temp6$3)), cleaned = {};
2898
2903
  for (let [key, val] of Object.entries(obj_0)) configuredIds_0.has(key) && (cleaned[key] = val);
2899
2904
  return cleaned;
2900
2905
  };
@@ -3187,16 +3192,16 @@ function _temp2$22(field_0, t0) {
3187
3192
  let fallback_0 = t0 === void 0 ? "" : t0;
3188
3193
  return typeof field_0 == "string" ? field_0 : typeof field_0 == "object" && field_0 && Object.values(field_0).find(_temp$36) || fallback_0;
3189
3194
  }
3190
- function _temp3$10(v_0) {
3195
+ function _temp3$12(v_0) {
3191
3196
  return typeof v_0 == "object" && !!v_0 && !Array.isArray(v_0);
3192
3197
  }
3193
- function _temp4$5(l) {
3198
+ function _temp4$7(l) {
3194
3199
  return l.id;
3195
3200
  }
3196
- function _temp5$4(v_1) {
3201
+ function _temp5$5(v_1) {
3197
3202
  return v_1;
3198
3203
  }
3199
- function _temp6$2(l_0) {
3204
+ function _temp6$3(l_0) {
3200
3205
  return l_0.id;
3201
3206
  }
3202
3207
  function _temp7$1(tag) {
@@ -3243,20 +3248,49 @@ const selectCombinedItems = createSelector([
3243
3248
  return $[4] === downHandler ? (t2 = $[5], t3 = $[6]) : (t2 = () => (window.addEventListener("keydown", downHandler), window.addEventListener("keyup", upHandler), () => {
3244
3249
  window.removeEventListener("keydown", downHandler), window.removeEventListener("keyup", upHandler);
3245
3250
  }), t3 = [downHandler, upHandler], $[4] = downHandler, $[5] = t2, $[6] = t3), useEffect(t2, t3), keyPressed;
3246
- }, CardWrapper$2 = styled(Flex).withConfig({
3251
+ }, ASSET_DRAG_TYPE = "application/x-sanity-media-assets";
3252
+ /**
3253
+ * Write the dragged asset ids onto the drag event.
3254
+ */
3255
+ function setDragAssetIds(event, assetIds) {
3256
+ event.dataTransfer.setData(ASSET_DRAG_TYPE, JSON.stringify(assetIds)), event.dataTransfer.effectAllowed = "move";
3257
+ }
3258
+ /**
3259
+ * Whether a drag event carries asset ids written by `setDragAssetIds`.
3260
+ *
3261
+ * During `dragover`, browsers hide the data payload but still expose the type list.
3262
+ */
3263
+ function isAssetDrag(event) {
3264
+ return Array.prototype.includes.call(event.dataTransfer.types, ASSET_DRAG_TYPE);
3265
+ }
3266
+ /**
3267
+ * Read the dragged asset ids from a `drop` event. Returns an empty array when the
3268
+ * payload is missing or malformed.
3269
+ */
3270
+ function getDragAssetIds(event) {
3271
+ let raw = event.dataTransfer.getData(ASSET_DRAG_TYPE);
3272
+ if (!raw) return [];
3273
+ try {
3274
+ let parsed = JSON.parse(raw);
3275
+ return Array.isArray(parsed) ? parsed.filter((id) => typeof id == "string") : [];
3276
+ } catch {
3277
+ return [];
3278
+ }
3279
+ }
3280
+ const CardWrapper$2 = styled(Flex).withConfig({
3247
3281
  displayName: "CardWrapper",
3248
- componentId: "sc-paw993-0"
3282
+ componentId: "sc-15kxr0-0"
3249
3283
  })`box-sizing:border-box;height:100%;overflow:hidden;position:relative;width:100%;`, CardContainer = /* @__PURE__ */ styled(Flex).withConfig({
3250
3284
  displayName: "CardContainer",
3251
- componentId: "sc-paw993-1"
3285
+ componentId: "sc-15kxr0-1"
3252
3286
  })(({ $picked, theme, $updating }) => css`border:1px solid transparent;height:100%;pointer-events:${$updating ? "none" : "auto"};position:relative;transition:all 300ms;user-select:none;width:100%;border:${$picked ? `1px solid ${theme.sanity.color.spot.orange} !important` : "1px solid inherit"};${!$updating && css`@media (hover:hover) and (pointer:fine){&:hover{border:1px solid var(--card-border-color);}}`}`), ContextActionContainer$2 = /* @__PURE__ */ styled(Flex).withConfig({
3253
3287
  displayName: "ContextActionContainer",
3254
- componentId: "sc-paw993-2"
3288
+ componentId: "sc-15kxr0-2"
3255
3289
  })(({ $scheme }) => css`cursor:pointer;height:${32}px;transition:all 300ms;@media (hover:hover) and (pointer:fine){&:hover{background:${getSchemeColor($scheme, "bg")};}}`), StyledWarningOutlineIcon = /* @__PURE__ */ styled(WarningFilledIcon).withConfig({
3256
3290
  displayName: "StyledWarningOutlineIcon",
3257
- componentId: "sc-paw993-3"
3291
+ componentId: "sc-15kxr0-3"
3258
3292
  })(({ theme }) => ({ color: theme.sanity.color.spot.red })), CardAsset = (props) => {
3259
- let $ = c(83), { id, selected, source } = props, scheme = useColorSchemeValue(), toast = useToast(), shiftPressed = useKeyPress("shift"), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$35), assetsPicked = useTypedSelector(selectAssetsPicked), t0;
3293
+ let $ = c(89), { id, selected, source } = props, scheme = useColorSchemeValue(), toast = useToast(), shiftPressed = useKeyPress("shift"), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$35), assetsPicked = useTypedSelector(selectAssetsPicked), t0;
3260
3294
  $[0] === id ? t0 = $[1] : (t0 = (state_0) => selectAssetById(state_0, id), $[0] = id, $[1] = t0);
3261
3295
  let item = useTypedSelector(t0), t1;
3262
3296
  $[2] === source ? t1 = $[3] : (t1 = (state_1) => {
@@ -3293,6 +3327,9 @@ const selectCombinedItems = createSelector([
3293
3327
  })) : dispatch(assetsActions.pick({
3294
3328
  assetId: asset._id,
3295
3329
  picked: !picked
3330
+ })) : e.ctrlKey || e.metaKey ? dispatch(assetsActions.pick({
3331
+ assetId: asset._id,
3332
+ picked: !picked
3296
3333
  })) : shiftPressed.current ? dispatch(picked ? assetsActions.pick({
3297
3334
  assetId: asset._id,
3298
3335
  picked: !picked
@@ -3315,23 +3352,27 @@ const selectCombinedItems = createSelector([
3315
3352
  picked: !picked
3316
3353
  })));
3317
3354
  }, $[23] = asset._id, $[24] = dispatch, $[25] = handleReplaceAsset, $[26] = isMultiSelect, $[27] = lastPicked, $[28] = onSelect, $[29] = picked, $[30] = selected, $[31] = shiftPressed, $[32] = source, $[33] = t5) : t5 = $[33];
3318
- let handleContextActionClick = t5, opacityContainer = updating ? .5 : 1, opacityPreview = selected || updating ? .25 : 1, t6 = selected ? "default" : "pointer", t7;
3319
- $[34] === t6 ? t7 = $[35] : (t7 = {
3320
- cursor: t6,
3355
+ let handleContextActionClick = t5, draggable = !selected && !updating && source !== "replace-asset", t6;
3356
+ $[34] !== asset._id || $[35] !== assetsPicked || $[36] !== picked ? (t6 = (e_1) => {
3357
+ setDragAssetIds(e_1, picked ? assetsPicked.map(_temp3$11) : [asset._id]);
3358
+ }, $[34] = asset._id, $[35] = assetsPicked, $[36] = picked, $[37] = t6) : t6 = $[37];
3359
+ let handleDragStart = t6, opacityContainer = updating ? .5 : 1, opacityPreview = selected || updating ? .25 : 1, t7 = draggable ? handleDragStart : void 0, t8 = selected ? "default" : "pointer", t9;
3360
+ $[38] === t8 ? t9 = $[39] : (t9 = {
3361
+ cursor: t8,
3321
3362
  position: "relative"
3322
- }, $[34] = t6, $[35] = t7);
3323
- let t8 = `media-asset-card-${asset._id}`, t9;
3324
- $[36] === opacityPreview ? t9 = $[37] : (t9 = {
3363
+ }, $[38] = t8, $[39] = t9);
3364
+ let t10 = `media-asset-card-${asset._id}`, t11;
3365
+ $[40] === opacityPreview ? t11 = $[41] : (t11 = {
3325
3366
  height: "100%",
3326
3367
  opacity: opacityPreview
3327
- }, $[36] = opacityPreview, $[37] = t9);
3328
- let t10;
3329
- $[38] === asset ? t10 = $[39] : (t10 = isFileAsset(asset) && /* @__PURE__ */ jsx(FileIcon$1, {
3368
+ }, $[40] = opacityPreview, $[41] = t11);
3369
+ let t12;
3370
+ $[42] === asset ? t12 = $[43] : (t12 = isFileAsset(asset) && /* @__PURE__ */ jsx(FileIcon$1, {
3330
3371
  extension: asset.extension,
3331
3372
  width: "80px"
3332
- }), $[38] = asset, $[39] = t10);
3333
- let t11;
3334
- $[40] !== asset || $[41] !== isOpaque || $[42] !== scheme ? (t11 = isImageAsset(asset) && /* @__PURE__ */ jsx(Image$1, {
3373
+ }), $[42] = asset, $[43] = t12);
3374
+ let t13;
3375
+ $[44] !== asset || $[45] !== isOpaque || $[46] !== scheme ? (t13 = isImageAsset(asset) && /* @__PURE__ */ jsx(Image$1, {
3335
3376
  draggable: !1,
3336
3377
  $scheme: scheme,
3337
3378
  $showCheckerboard: !isOpaque,
@@ -3343,16 +3384,16 @@ const selectCombinedItems = createSelector([
3343
3384
  draggable: !1,
3344
3385
  transition: "opacity 1000ms"
3345
3386
  }
3346
- }), $[40] = asset, $[41] = isOpaque, $[42] = scheme, $[43] = t11) : t11 = $[43];
3347
- let t12;
3348
- $[44] !== handleAssetClick || $[45] !== t10 || $[46] !== t11 || $[47] !== t8 || $[48] !== t9 ? (t12 = /* @__PURE__ */ jsxs("div", {
3349
- "data-testid": t8,
3387
+ }), $[44] = asset, $[45] = isOpaque, $[46] = scheme, $[47] = t13) : t13 = $[47];
3388
+ let t14;
3389
+ $[48] !== handleAssetClick || $[49] !== t10 || $[50] !== t11 || $[51] !== t12 || $[52] !== t13 ? (t14 = /* @__PURE__ */ jsxs("div", {
3390
+ "data-testid": t10,
3350
3391
  onClick: handleAssetClick,
3351
- style: t9,
3352
- children: [t10, t11]
3353
- }), $[44] = handleAssetClick, $[45] = t10, $[46] = t11, $[47] = t8, $[48] = t9, $[49] = t12) : t12 = $[49];
3354
- let t13;
3355
- $[50] !== opacityContainer || $[51] !== selected || $[52] !== updating ? (t13 = selected && !updating && /* @__PURE__ */ jsx(Flex, {
3392
+ style: t11,
3393
+ children: [t12, t13]
3394
+ }), $[48] = handleAssetClick, $[49] = t10, $[50] = t11, $[51] = t12, $[52] = t13, $[53] = t14) : t14 = $[53];
3395
+ let t15;
3396
+ $[54] !== opacityContainer || $[55] !== selected || $[56] !== updating ? (t15 = selected && !updating && /* @__PURE__ */ jsx(Flex, {
3356
3397
  align: "center",
3357
3398
  justify: "center",
3358
3399
  style: {
@@ -3367,9 +3408,9 @@ const selectCombinedItems = createSelector([
3367
3408
  size: 2,
3368
3409
  children: /* @__PURE__ */ jsx(CheckmarkCircleIcon, {})
3369
3410
  })
3370
- }), $[50] = opacityContainer, $[51] = selected, $[52] = updating, $[53] = t13) : t13 = $[53];
3371
- let t14;
3372
- $[54] === updating ? t14 = $[55] : (t14 = updating && /* @__PURE__ */ jsx(Flex, {
3411
+ }), $[54] = opacityContainer, $[55] = selected, $[56] = updating, $[57] = t15) : t15 = $[57];
3412
+ let t16;
3413
+ $[58] === updating ? t16 = $[59] : (t16 = updating && /* @__PURE__ */ jsx(Flex, {
3373
3414
  align: "center",
3374
3415
  justify: "center",
3375
3416
  style: {
@@ -3380,21 +3421,21 @@ const selectCombinedItems = createSelector([
3380
3421
  width: "100%"
3381
3422
  },
3382
3423
  children: /* @__PURE__ */ jsx(Spinner, {})
3383
- }), $[54] = updating, $[55] = t14);
3384
- let t15;
3385
- $[56] !== t12 || $[57] !== t13 || $[58] !== t14 || $[59] !== t7 ? (t15 = /* @__PURE__ */ jsxs(Box, {
3424
+ }), $[58] = updating, $[59] = t16);
3425
+ let t17;
3426
+ $[60] !== t14 || $[61] !== t15 || $[62] !== t16 || $[63] !== t9 ? (t17 = /* @__PURE__ */ jsxs(Box, {
3386
3427
  flex: 1,
3387
- style: t7,
3428
+ style: t9,
3388
3429
  children: [
3389
- t12,
3390
- t13,
3391
- t14
3430
+ t14,
3431
+ t15,
3432
+ t16
3392
3433
  ]
3393
- }), $[56] = t12, $[57] = t13, $[58] = t14, $[59] = t7, $[60] = t15) : t15 = $[60];
3394
- let t16;
3395
- $[61] === opacityContainer ? t16 = $[62] : (t16 = { opacity: opacityContainer }, $[61] = opacityContainer, $[62] = t16);
3396
- let t17;
3397
- $[63] !== isMultiSelect || $[64] !== onSelect || $[65] !== picked ? (t17 = onSelect && !isMultiSelect ? /* @__PURE__ */ jsx(EditIcon, { style: {
3434
+ }), $[60] = t14, $[61] = t15, $[62] = t16, $[63] = t9, $[64] = t17) : t17 = $[64];
3435
+ let t18;
3436
+ $[65] === opacityContainer ? t18 = $[66] : (t18 = { opacity: opacityContainer }, $[65] = opacityContainer, $[66] = t18);
3437
+ let t19;
3438
+ $[67] !== isMultiSelect || $[68] !== onSelect || $[69] !== picked ? (t19 = onSelect && !isMultiSelect ? /* @__PURE__ */ jsx(EditIcon, { style: {
3398
3439
  flexShrink: 0,
3399
3440
  opacity: .5
3400
3441
  } }) : /* @__PURE__ */ jsx(Checkbox, {
@@ -3405,9 +3446,9 @@ const selectCombinedItems = createSelector([
3405
3446
  pointerEvents: "none",
3406
3447
  transform: "scale(0.8)"
3407
3448
  }
3408
- }), $[63] = isMultiSelect, $[64] = onSelect, $[65] = picked, $[66] = t17) : t17 = $[66];
3409
- let t18;
3410
- $[67] === asset.originalFilename ? t18 = $[68] : (t18 = /* @__PURE__ */ jsx(Box, {
3449
+ }), $[67] = isMultiSelect, $[68] = onSelect, $[69] = picked, $[70] = t19) : t19 = $[70];
3450
+ let t20;
3451
+ $[71] === asset.originalFilename ? t20 = $[72] : (t20 = /* @__PURE__ */ jsx(Box, {
3411
3452
  marginLeft: 2,
3412
3453
  children: /* @__PURE__ */ jsx(Text, {
3413
3454
  muted: !0,
@@ -3415,18 +3456,18 @@ const selectCombinedItems = createSelector([
3415
3456
  textOverflow: "ellipsis",
3416
3457
  children: asset.originalFilename
3417
3458
  })
3418
- }), $[67] = asset.originalFilename, $[68] = t18);
3419
- let t19;
3420
- $[69] !== handleContextActionClick || $[70] !== scheme || $[71] !== t16 || $[72] !== t17 || $[73] !== t18 ? (t19 = /* @__PURE__ */ jsxs(ContextActionContainer$2, {
3459
+ }), $[71] = asset.originalFilename, $[72] = t20);
3460
+ let t21;
3461
+ $[73] !== handleContextActionClick || $[74] !== scheme || $[75] !== t18 || $[76] !== t19 || $[77] !== t20 ? (t21 = /* @__PURE__ */ jsxs(ContextActionContainer$2, {
3421
3462
  align: "center",
3422
3463
  onClick: handleContextActionClick,
3423
3464
  paddingX: 1,
3424
3465
  $scheme: scheme,
3425
- style: t16,
3426
- children: [t17, t18]
3427
- }), $[69] = handleContextActionClick, $[70] = scheme, $[71] = t16, $[72] = t17, $[73] = t18, $[74] = t19) : t19 = $[74];
3428
- let t20;
3429
- $[75] === error ? t20 = $[76] : (t20 = error && /* @__PURE__ */ jsx(Box, {
3466
+ style: t18,
3467
+ children: [t19, t20]
3468
+ }), $[73] = handleContextActionClick, $[74] = scheme, $[75] = t18, $[76] = t19, $[77] = t20, $[78] = t21) : t21 = $[78];
3469
+ let t22;
3470
+ $[79] === error ? t22 = $[80] : (t22 = error && /* @__PURE__ */ jsx(Box, {
3430
3471
  padding: 3,
3431
3472
  style: {
3432
3473
  position: "absolute",
@@ -3450,21 +3491,23 @@ const selectCombinedItems = createSelector([
3450
3491
  children: /* @__PURE__ */ jsx(StyledWarningOutlineIcon, { color: "critical" })
3451
3492
  })
3452
3493
  })
3453
- }), $[75] = error, $[76] = t20);
3454
- let t21;
3455
- return $[77] !== item.updating || $[78] !== picked || $[79] !== t15 || $[80] !== t19 || $[81] !== t20 ? (t21 = /* @__PURE__ */ jsx(CardWrapper$2, {
3494
+ }), $[79] = error, $[80] = t22);
3495
+ let t23;
3496
+ return $[81] !== draggable || $[82] !== item.updating || $[83] !== picked || $[84] !== t17 || $[85] !== t21 || $[86] !== t22 || $[87] !== t7 ? (t23 = /* @__PURE__ */ jsx(CardWrapper$2, {
3456
3497
  padding: 1,
3457
3498
  children: /* @__PURE__ */ jsxs(CardContainer, {
3458
3499
  direction: "column",
3500
+ draggable,
3501
+ onDragStart: t7,
3459
3502
  $picked: picked,
3460
3503
  $updating: item.updating,
3461
3504
  children: [
3462
- t15,
3463
- t19,
3464
- t20
3505
+ t17,
3506
+ t21,
3507
+ t22
3465
3508
  ]
3466
3509
  })
3467
- }), $[77] = item.updating, $[78] = picked, $[79] = t15, $[80] = t19, $[81] = t20, $[82] = t21) : t21 = $[82], t21;
3510
+ }), $[81] = draggable, $[82] = item.updating, $[83] = picked, $[84] = t17, $[85] = t21, $[86] = t22, $[87] = t7, $[88] = t23) : t23 = $[88], t23;
3468
3511
  };
3469
3512
  var CardAsset_default = memo(CardAsset);
3470
3513
  function _temp$35(state) {
@@ -3473,6 +3516,9 @@ function _temp$35(state) {
3473
3516
  function _temp2$21(d) {
3474
3517
  return d.type === "dialogAllAssets";
3475
3518
  }
3519
+ function _temp3$11(pickedItem) {
3520
+ return pickedItem.asset._id;
3521
+ }
3476
3522
  const CardWrapper$1 = styled(Flex).withConfig({
3477
3523
  displayName: "CardWrapper",
3478
3524
  componentId: "sc-52xpdk-0"
@@ -3712,7 +3758,8 @@ const createThrottler = (concurrency = 4) => {
3712
3758
  currentFolderId: state.folders.currentFolderId,
3713
3759
  excludeTagSlugs: state.assets.excludeTagSlugs,
3714
3760
  searchFacets: state.search.facets,
3715
- searchQuery: state.search.query
3761
+ searchQuery: state.search.query,
3762
+ showMediaLibraryAssets: state.assets.showMediaLibraryAssets
3716
3763
  }), query = groq`
3717
3764
  *[${constructedFilter} && _id in $documentIds].sha1hash
3718
3765
  `;
@@ -3962,7 +4009,7 @@ function omitFacetId(facet) {
3962
4009
  return withoutId;
3963
4010
  }
3964
4011
  const ReplaceAssetsOverview = () => {
3965
- let $ = c(36), dispatch = useDispatch(), store = useStore(), combinedItems = useTypedSelector(selectCombinedItems), assetsById = useTypedSelector(_temp$33), fetchCount = useTypedSelector(_temp2$19), fetching = useTypedSelector(_temp3$9), fetchingError = useTypedSelector(_temp4$4), pageSize = useTypedSelector(_temp5$3), searchQuery = useTypedSelector(_temp6$1), searchFacets = useTypedSelector(_temp7), currentFolderId = useTypedSelector(_temp8), currentFolderUnfiled = useTypedSelector(_temp9), assetToReplaceId = useTypedSelector(_temp11), savedBrowserStateRef = useRef(null), t0;
4012
+ let $ = c(36), dispatch = useDispatch(), store = useStore(), combinedItems = useTypedSelector(selectCombinedItems), assetsById = useTypedSelector(_temp$33), fetchCount = useTypedSelector(_temp2$19), fetching = useTypedSelector(_temp3$10), fetchingError = useTypedSelector(_temp4$6), pageSize = useTypedSelector(_temp5$4), searchQuery = useTypedSelector(_temp6$2), searchFacets = useTypedSelector(_temp7), currentFolderId = useTypedSelector(_temp8), currentFolderUnfiled = useTypedSelector(_temp9), assetToReplaceId = useTypedSelector(_temp11), savedBrowserStateRef = useRef(null), t0;
3966
4013
  $[0] !== currentFolderId || $[1] !== currentFolderUnfiled || $[2] !== searchFacets || $[3] !== searchQuery.length ? (t0 = () => searchQuery.length > 0 || searchFacets.length > 0 || !!currentFolderId || currentFolderUnfiled, $[0] = currentFolderId, $[1] = currentFolderUnfiled, $[2] = searchFacets, $[3] = searchQuery.length, $[4] = t0) : t0 = $[4];
3967
4014
  let [awaitingRefetch, setAwaitingRefetch] = useState(t0), t1, t2;
3968
4015
  $[5] !== dispatch || $[6] !== store ? (t1 = () => {
@@ -4049,16 +4096,16 @@ function _temp$33(state) {
4049
4096
  function _temp2$19(state_0) {
4050
4097
  return state_0.assets.fetchCount;
4051
4098
  }
4052
- function _temp3$9(state_1) {
4099
+ function _temp3$10(state_1) {
4053
4100
  return state_1.assets.fetching;
4054
4101
  }
4055
- function _temp4$4(state_2) {
4102
+ function _temp4$6(state_2) {
4056
4103
  return state_2.assets.fetchingError;
4057
4104
  }
4058
- function _temp5$3(state_3) {
4105
+ function _temp5$4(state_3) {
4059
4106
  return state_3.assets.pageSize;
4060
4107
  }
4061
- function _temp6$1(state_4) {
4108
+ function _temp6$2(state_4) {
4062
4109
  return state_4.search.query;
4063
4110
  }
4064
4111
  function _temp7(state_5) {
@@ -4540,7 +4587,10 @@ const getExpandedIdSet = (folderId, byId) => {
4540
4587
  expanded.add(cursor), cursor = node.parentId;
4541
4588
  }
4542
4589
  return expanded;
4543
- }, FolderHeaderAction = (t0) => {
4590
+ }, DropTree = styled(Tree).withConfig({
4591
+ displayName: "DropTree",
4592
+ componentId: "sc-0bwz5x-0"
4593
+ })`[data-drop-target] > [data-ui='TreeItem__box']{box-shadow:inset 0 0 0 2px var(--card-focus-ring-color);}`, ROOT_DROP_TARGET_ID = "__all-assets", FolderHeaderAction = (t0) => {
4544
4594
  let $ = c(11), { disabled: t1, icon, onClick, tone: t2, tooltip } = t0, disabled = t1 !== void 0 && t1, tone = t2 === void 0 ? "default" : t2, t3;
4545
4595
  $[0] === tooltip ? t3 = $[1] : (t3 = /* @__PURE__ */ jsx(Container, {
4546
4596
  padding: 2,
@@ -4631,140 +4681,191 @@ const getExpandedIdSet = (folderId, byId) => {
4631
4681
  children: [t5, t7]
4632
4682
  }), $[9] = t5, $[10] = t7, $[11] = t8) : t8 = $[11], t8;
4633
4683
  }, FolderNode = (t0) => {
4634
- let $ = c(23), { currentFolderId, expandedIds, node, onSelect } = t0, hasChildren = node.children.length > 0, selected = currentFolderId === node.id, t1;
4684
+ let $ = c(30), { currentFolderId, dropTargetId, expandedIds, getDropTargetHandlers, node, onSelect } = t0, hasChildren = node.children.length > 0, selected = currentFolderId === node.id, isDropTarget = dropTargetId === node.id, t1;
4635
4685
  $[0] !== expandedIds || $[1] !== node.id ? (t1 = expandedIds.has(node.id), $[0] = expandedIds, $[1] = node.id, $[2] = t1) : t1 = $[2];
4636
- let t2;
4637
- $[3] !== node.id || $[4] !== onSelect ? (t2 = () => onSelect(node.id), $[3] = node.id, $[4] = onSelect, $[5] = t2) : t2 = $[5];
4638
- let t3;
4639
- $[6] !== node.name || $[7] !== node.totalCount ? (t3 = /* @__PURE__ */ jsx(FolderItemText, {
4686
+ let t2 = node.id, t3;
4687
+ $[3] !== node.id || $[4] !== onSelect ? (t3 = () => onSelect(node.id), $[3] = node.id, $[4] = onSelect, $[5] = t3) : t3 = $[5];
4688
+ let t4 = isDropTarget ? "" : void 0, t5;
4689
+ $[6] !== node.name || $[7] !== node.totalCount ? (t5 = /* @__PURE__ */ jsx(FolderItemText, {
4640
4690
  name: node.name,
4641
4691
  totalCount: node.totalCount
4642
- }), $[6] = node.name, $[7] = node.totalCount, $[8] = t3) : t3 = $[8];
4643
- let t4 = selected ? "semibold" : "medium", t5;
4644
- $[9] !== currentFolderId || $[10] !== expandedIds || $[11] !== hasChildren || $[12] !== node.children || $[13] !== onSelect ? (t5 = hasChildren && node.children.map((childNode) => /* @__PURE__ */ jsx(FolderNode, {
4692
+ }), $[6] = node.name, $[7] = node.totalCount, $[8] = t5) : t5 = $[8];
4693
+ let t6 = selected ? "semibold" : "medium", t7;
4694
+ $[9] !== getDropTargetHandlers || $[10] !== node.id ? (t7 = getDropTargetHandlers(node.id), $[9] = getDropTargetHandlers, $[10] = node.id, $[11] = t7) : t7 = $[11];
4695
+ let t8;
4696
+ $[12] !== currentFolderId || $[13] !== dropTargetId || $[14] !== expandedIds || $[15] !== getDropTargetHandlers || $[16] !== hasChildren || $[17] !== node.children || $[18] !== onSelect ? (t8 = hasChildren && node.children.map((childNode) => /* @__PURE__ */ jsx(FolderNode, {
4645
4697
  currentFolderId,
4698
+ dropTargetId,
4646
4699
  expandedIds,
4700
+ getDropTargetHandlers,
4647
4701
  node: childNode,
4648
4702
  onSelect
4649
- }, childNode.id)), $[9] = currentFolderId, $[10] = expandedIds, $[11] = hasChildren, $[12] = node.children, $[13] = onSelect, $[14] = t5) : t5 = $[14];
4650
- let t6;
4651
- return $[15] !== node.id || $[16] !== selected || $[17] !== t1 || $[18] !== t2 || $[19] !== t3 || $[20] !== t4 || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsx(TreeItem, {
4703
+ }, childNode.id)), $[12] = currentFolderId, $[13] = dropTargetId, $[14] = expandedIds, $[15] = getDropTargetHandlers, $[16] = hasChildren, $[17] = node.children, $[18] = onSelect, $[19] = t8) : t8 = $[19];
4704
+ let t9;
4705
+ return $[20] !== node.id || $[21] !== selected || $[22] !== t1 || $[23] !== t3 || $[24] !== t4 || $[25] !== t5 || $[26] !== t6 || $[27] !== t7 || $[28] !== t8 ? (t9 = /* @__PURE__ */ jsx(TreeItem, {
4652
4706
  expanded: t1,
4653
- id: node.id,
4654
- onClick: t2,
4707
+ id: t2,
4708
+ onClick: t3,
4709
+ "data-drop-target": t4,
4655
4710
  selected,
4656
- text: t3,
4657
- weight: t4,
4658
- children: t5
4659
- }), $[15] = node.id, $[16] = selected, $[17] = t1, $[18] = t2, $[19] = t3, $[20] = t4, $[21] = t5, $[22] = t6) : t6 = $[22], t6;
4711
+ text: t5,
4712
+ weight: t6,
4713
+ ...t7,
4714
+ children: t8
4715
+ }), $[20] = node.id, $[21] = selected, $[22] = t1, $[23] = t3, $[24] = t4, $[25] = t5, $[26] = t6, $[27] = t7, $[28] = t8, $[29] = t9) : t9 = $[29], t9;
4660
4716
  }, FolderView = () => {
4661
- let $ = c(63), dispatch = useDispatch(), currentFolderId = useTypedSelector(_temp$29), byId = useTypedSelector(_temp2$16), canDeleteFolder = useTypedSelector(selectCanDeleteFolder), fetching = useTypedSelector(_temp3$8), folderTree = useTypedSelector(selectFolderTree), currentFolder = currentFolderId ? byId[currentFolderId] : null, t0;
4717
+ let $ = c(114), dispatch = useDispatch(), currentFolderId = useTypedSelector(_temp$29), assetsById = useTypedSelector(_temp2$16), byId = useTypedSelector(_temp3$9), canDeleteFolder = useTypedSelector(selectCanDeleteFolder), fetching = useTypedSelector(_temp4$5), folderTree = useTypedSelector(selectFolderTree), currentFolder = currentFolderId ? byId[currentFolderId] : null, t0;
4662
4718
  $[0] !== byId || $[1] !== currentFolderId ? (t0 = getExpandedIdSet(currentFolderId, byId), $[0] = byId, $[1] = currentFolderId, $[2] = t0) : t0 = $[2];
4663
4719
  let expandedIds = t0, t1;
4664
4720
  $[3] === expandedIds ? t1 = $[4] : (t1 = Array.from(expandedIds).join("|") || "root", $[3] = expandedIds, $[4] = t1);
4665
- let treeKey = t1, hasFolders = folderTree.length > 0, t2;
4666
- $[5] === dispatch ? t2 = $[6] : (t2 = (folderId) => {
4667
- dispatch(foldersActions.currentFolderSet({ folderId }));
4668
- }, $[5] = dispatch, $[6] = t2);
4669
- let handleFolderSelect = t2, t3;
4670
- $[7] !== currentFolder || $[8] !== currentFolderId || $[9] !== dispatch ? (t3 = () => {
4671
- !currentFolderId || !currentFolder || dispatch(dialogActions.showConfirmDeleteFolder({
4672
- folderId: currentFolderId,
4673
- folderName: currentFolder.name
4674
- }));
4675
- }, $[7] = currentFolder, $[8] = currentFolderId, $[9] = dispatch, $[10] = t3) : t3 = $[10];
4676
- let handleFolderDelete = t3, t4;
4677
- $[11] === Symbol.for("react.memo_cache_sentinel") ? (t4 = {
4678
- borderBottom: "1px solid var(--card-border-color)",
4679
- flexShrink: 0,
4680
- height: "32px"
4681
- }, $[11] = t4) : t4 = $[11];
4721
+ let treeKey = t1, hasFolders = folderTree.length > 0, [dropTargetId, setDropTargetId] = useState(null), t2;
4722
+ $[5] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ new Map(), $[5] = t2) : t2 = $[5];
4723
+ let dragDepth = useRef(t2), t3, t4;
4724
+ $[6] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => {
4725
+ let handleDragEnd = () => {
4726
+ dragDepth.current.clear(), setDropTargetId(null);
4727
+ };
4728
+ return window.addEventListener("dragend", handleDragEnd), () => window.removeEventListener("dragend", handleDragEnd);
4729
+ }, t4 = [], $[6] = t3, $[7] = t4) : (t3 = $[6], t4 = $[7]), useEffect(t3, t4);
4682
4730
  let t5;
4683
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t5 = /* @__PURE__ */ jsx(Label, {
4684
- size: 0,
4685
- children: "Folders"
4686
- }), $[12] = t5) : t5 = $[12];
4687
- let t6;
4688
- $[13] === fetching ? t6 = $[14] : (t6 = fetching && /* @__PURE__ */ jsx(Label, {
4689
- size: 0,
4690
- style: { opacity: .3 },
4691
- children: "Loading..."
4692
- }), $[13] = fetching, $[14] = t6);
4693
- let t7;
4694
- $[15] === t6 ? t7 = $[16] : (t7 = /* @__PURE__ */ jsx(Box, {
4695
- flex: 1,
4696
- children: /* @__PURE__ */ jsxs(Inline, {
4697
- gap: 2,
4698
- children: [t5, t6]
4699
- })
4700
- }), $[15] = t6, $[16] = t7);
4701
- let t8;
4702
- $[17] !== currentFolderId || $[18] !== dispatch ? (t8 = currentFolderId && /* @__PURE__ */ jsx(FolderHeaderAction, {
4703
- icon: /* @__PURE__ */ jsx(EditIcon, {}),
4704
- onClick: () => dispatch(DIALOG_ACTIONS.showFolderRename({ folderId: currentFolderId })),
4705
- tone: "primary",
4706
- tooltip: "Rename folder"
4707
- }), $[17] = currentFolderId, $[18] = dispatch, $[19] = t8) : t8 = $[19];
4708
- let t9;
4709
- $[20] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsx(AddIcon, {}), $[20] = t9) : t9 = $[20];
4710
- let t10;
4711
- $[21] !== currentFolderId || $[22] !== dispatch ? (t10 = /* @__PURE__ */ jsx(FolderHeaderAction, {
4712
- icon: t9,
4713
- onClick: () => dispatch(DIALOG_ACTIONS.showFolderCreate({ parentFolderId: currentFolderId || null })),
4714
- tone: "primary",
4715
- tooltip: "Create folder"
4716
- }), $[21] = currentFolderId, $[22] = dispatch, $[23] = t10) : t10 = $[23];
4717
- let t11;
4718
- $[24] !== canDeleteFolder || $[25] !== currentFolderId || $[26] !== handleFolderDelete ? (t11 = currentFolderId && canDeleteFolder && /* @__PURE__ */ jsx(FolderHeaderAction, {
4719
- icon: /* @__PURE__ */ jsx(TrashIcon, {}),
4720
- onClick: handleFolderDelete,
4721
- tone: "critical",
4722
- tooltip: "Delete folder"
4723
- }), $[24] = canDeleteFolder, $[25] = currentFolderId, $[26] = handleFolderDelete, $[27] = t11) : t11 = $[27];
4724
- let t12;
4725
- $[28] !== t10 || $[29] !== t11 || $[30] !== t8 ? (t12 = /* @__PURE__ */ jsxs(Inline, {
4726
- gap: 1,
4727
- children: [
4728
- t8,
4729
- t10,
4730
- t11
4731
- ]
4732
- }), $[28] = t10, $[29] = t11, $[30] = t8, $[31] = t12) : t12 = $[31];
4733
- let t13;
4734
- $[32] !== t12 || $[33] !== t7 ? (t13 = /* @__PURE__ */ jsxs(Flex, {
4735
- align: "center",
4736
- justify: "space-between",
4737
- paddingX: 3,
4738
- style: t4,
4739
- children: [t7, t12]
4740
- }), $[32] = t12, $[33] = t7, $[34] = t13) : t13 = $[34];
4741
- let t14;
4742
- $[35] === dispatch ? t14 = $[36] : (t14 = () => dispatch(foldersActions.currentFolderClear()), $[35] = dispatch, $[36] = t14);
4743
- let t15 = currentFolderId === null, t16 = currentFolderId === null ? "semibold" : "medium", t17;
4744
- $[37] !== t14 || $[38] !== t15 || $[39] !== t16 ? (t17 = /* @__PURE__ */ jsx(TreeItem, {
4745
- id: "__all-assets",
4746
- onClick: t14,
4747
- selected: t15,
4748
- text: "All assets",
4749
- weight: t16
4750
- }), $[37] = t14, $[38] = t15, $[39] = t16, $[40] = t17) : t17 = $[40];
4751
- let t18;
4752
- if ($[41] !== currentFolderId || $[42] !== expandedIds || $[43] !== folderTree || $[44] !== handleFolderSelect) {
4753
- let t19;
4754
- $[46] !== currentFolderId || $[47] !== expandedIds || $[48] !== handleFolderSelect ? (t19 = (node) => /* @__PURE__ */ jsx(FolderNode, {
4731
+ $[8] === dispatch ? t5 = $[9] : (t5 = (folderId) => {
4732
+ dispatch(foldersActions.currentFolderSet({ folderId }));
4733
+ }, $[8] = dispatch, $[9] = t5);
4734
+ let handleFolderSelect = t5, T0, T1, T2, T3, T4, getDropTargetHandlers, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t6, t7, t8, t9;
4735
+ if ($[10] !== assetsById || $[11] !== canDeleteFolder || $[12] !== currentFolder || $[13] !== currentFolderId || $[14] !== dispatch || $[15] !== dropTargetId || $[16] !== fetching || $[17] !== treeKey) {
4736
+ getDropTargetHandlers = (folderId_0) => {
4737
+ let targetId = folderId_0 ?? ROOT_DROP_TARGET_ID;
4738
+ return {
4739
+ onDragEnter: (e) => {
4740
+ if (!isAssetDrag(e)) return;
4741
+ e.preventDefault(), e.stopPropagation();
4742
+ let depth = (dragDepth.current.get(targetId) ?? 0) + 1;
4743
+ dragDepth.current.set(targetId, depth), setDropTargetId(targetId);
4744
+ },
4745
+ onDragOver: _temp5$3,
4746
+ onDragLeave: (e_1) => {
4747
+ if (!isAssetDrag(e_1)) return;
4748
+ e_1.stopPropagation();
4749
+ let depth_0 = (dragDepth.current.get(targetId) ?? 0) - 1;
4750
+ if (depth_0 > 0) {
4751
+ dragDepth.current.set(targetId, depth_0);
4752
+ return;
4753
+ }
4754
+ dragDepth.current.delete(targetId), setDropTargetId((current) => current === targetId ? null : current);
4755
+ },
4756
+ onDrop: (e_2) => {
4757
+ if (!isAssetDrag(e_2)) return;
4758
+ e_2.preventDefault(), e_2.stopPropagation(), dragDepth.current.clear(), setDropTargetId(null);
4759
+ let assets = getDragAssetIds(e_2).map((assetId) => assetsById[assetId]).filter(_temp6$1).filter((item_0) => (item_0.asset.opt?.media?.folder?._ref ?? null) !== folderId_0);
4760
+ assets.length !== 0 && dispatch(assetsActions.folderSetRequest({
4761
+ assets,
4762
+ folderId: folderId_0
4763
+ }));
4764
+ }
4765
+ };
4766
+ };
4767
+ let t20;
4768
+ $[38] !== currentFolder || $[39] !== currentFolderId || $[40] !== dispatch ? (t20 = () => {
4769
+ !currentFolderId || !currentFolder || dispatch(dialogActions.showConfirmDeleteFolder({
4770
+ folderId: currentFolderId,
4771
+ folderName: currentFolder.name
4772
+ }));
4773
+ }, $[38] = currentFolder, $[39] = currentFolderId, $[40] = dispatch, $[41] = t20) : t20 = $[41];
4774
+ let handleFolderDelete = t20;
4775
+ T4 = Flex, t16 = "column", t17 = 1, t18 = "fill";
4776
+ let t21;
4777
+ $[42] === Symbol.for("react.memo_cache_sentinel") ? (t21 = {
4778
+ borderBottom: "1px solid var(--card-border-color)",
4779
+ flexShrink: 0,
4780
+ height: "32px"
4781
+ }, $[42] = t21) : t21 = $[42];
4782
+ let t22;
4783
+ $[43] === Symbol.for("react.memo_cache_sentinel") ? (t22 = /* @__PURE__ */ jsx(Label, {
4784
+ size: 0,
4785
+ children: "Folders"
4786
+ }), $[43] = t22) : t22 = $[43];
4787
+ let t23;
4788
+ $[44] === fetching ? t23 = $[45] : (t23 = fetching && /* @__PURE__ */ jsx(Label, {
4789
+ size: 0,
4790
+ style: { opacity: .3 },
4791
+ children: "Loading..."
4792
+ }), $[44] = fetching, $[45] = t23);
4793
+ let t24;
4794
+ $[46] === t23 ? t24 = $[47] : (t24 = /* @__PURE__ */ jsx(Box, {
4795
+ flex: 1,
4796
+ children: /* @__PURE__ */ jsxs(Inline, {
4797
+ gap: 2,
4798
+ children: [t22, t23]
4799
+ })
4800
+ }), $[46] = t23, $[47] = t24);
4801
+ let t25;
4802
+ $[48] !== currentFolderId || $[49] !== dispatch ? (t25 = currentFolderId && /* @__PURE__ */ jsx(FolderHeaderAction, {
4803
+ icon: /* @__PURE__ */ jsx(EditIcon, {}),
4804
+ onClick: () => dispatch(DIALOG_ACTIONS.showFolderRename({ folderId: currentFolderId })),
4805
+ tone: "primary",
4806
+ tooltip: "Rename folder"
4807
+ }), $[48] = currentFolderId, $[49] = dispatch, $[50] = t25) : t25 = $[50];
4808
+ let t26;
4809
+ $[51] === Symbol.for("react.memo_cache_sentinel") ? (t26 = /* @__PURE__ */ jsx(AddIcon, {}), $[51] = t26) : t26 = $[51];
4810
+ let t27;
4811
+ $[52] !== currentFolderId || $[53] !== dispatch ? (t27 = /* @__PURE__ */ jsx(FolderHeaderAction, {
4812
+ icon: t26,
4813
+ onClick: () => dispatch(DIALOG_ACTIONS.showFolderCreate({ parentFolderId: currentFolderId || null })),
4814
+ tone: "primary",
4815
+ tooltip: "Create folder"
4816
+ }), $[52] = currentFolderId, $[53] = dispatch, $[54] = t27) : t27 = $[54];
4817
+ let t28;
4818
+ $[55] !== canDeleteFolder || $[56] !== currentFolderId || $[57] !== handleFolderDelete ? (t28 = currentFolderId && canDeleteFolder && /* @__PURE__ */ jsx(FolderHeaderAction, {
4819
+ icon: /* @__PURE__ */ jsx(TrashIcon, {}),
4820
+ onClick: handleFolderDelete,
4821
+ tone: "critical",
4822
+ tooltip: "Delete folder"
4823
+ }), $[55] = canDeleteFolder, $[56] = currentFolderId, $[57] = handleFolderDelete, $[58] = t28) : t28 = $[58];
4824
+ let t29;
4825
+ $[59] !== t25 || $[60] !== t27 || $[61] !== t28 ? (t29 = /* @__PURE__ */ jsxs(Inline, {
4826
+ gap: 1,
4827
+ children: [
4828
+ t25,
4829
+ t27,
4830
+ t28
4831
+ ]
4832
+ }), $[59] = t25, $[60] = t27, $[61] = t28, $[62] = t29) : t29 = $[62], $[63] !== t24 || $[64] !== t29 ? (t19 = /* @__PURE__ */ jsxs(Flex, {
4833
+ align: "center",
4834
+ justify: "space-between",
4835
+ paddingX: 3,
4836
+ style: t21,
4837
+ children: [t24, t29]
4838
+ }), $[63] = t24, $[64] = t29, $[65] = t19) : t19 = $[65], T3 = Box, t15 = 2, T2 = Box, T1 = DropTree, t13 = 1, t14 = treeKey, T0 = TreeItem, t6 = dropTargetId === ROOT_DROP_TARGET_ID ? "" : void 0, t7 = ROOT_DROP_TARGET_ID, $[66] === dispatch ? t8 = $[67] : (t8 = () => dispatch(foldersActions.currentFolderClear()), $[66] = dispatch, $[67] = t8), t9 = currentFolderId === null, t10 = "All assets", t11 = currentFolderId === null ? "semibold" : "medium", t12 = getDropTargetHandlers(null), $[10] = assetsById, $[11] = canDeleteFolder, $[12] = currentFolder, $[13] = currentFolderId, $[14] = dispatch, $[15] = dropTargetId, $[16] = fetching, $[17] = treeKey, $[18] = T0, $[19] = T1, $[20] = T2, $[21] = T3, $[22] = T4, $[23] = getDropTargetHandlers, $[24] = t10, $[25] = t11, $[26] = t12, $[27] = t13, $[28] = t14, $[29] = t15, $[30] = t16, $[31] = t17, $[32] = t18, $[33] = t19, $[34] = t6, $[35] = t7, $[36] = t8, $[37] = t9;
4839
+ } else T0 = $[18], T1 = $[19], T2 = $[20], T3 = $[21], T4 = $[22], getDropTargetHandlers = $[23], t10 = $[24], t11 = $[25], t12 = $[26], t13 = $[27], t14 = $[28], t15 = $[29], t16 = $[30], t17 = $[31], t18 = $[32], t19 = $[33], t6 = $[34], t7 = $[35], t8 = $[36], t9 = $[37];
4840
+ let t20;
4841
+ $[68] !== T0 || $[69] !== t10 || $[70] !== t11 || $[71] !== t12 || $[72] !== t6 || $[73] !== t7 || $[74] !== t8 || $[75] !== t9 ? (t20 = /* @__PURE__ */ jsx(T0, {
4842
+ "data-drop-target": t6,
4843
+ id: t7,
4844
+ onClick: t8,
4845
+ selected: t9,
4846
+ text: t10,
4847
+ weight: t11,
4848
+ ...t12
4849
+ }), $[68] = T0, $[69] = t10, $[70] = t11, $[71] = t12, $[72] = t6, $[73] = t7, $[74] = t8, $[75] = t9, $[76] = t20) : t20 = $[76];
4850
+ let t21;
4851
+ if ($[77] !== currentFolderId || $[78] !== dropTargetId || $[79] !== expandedIds || $[80] !== folderTree || $[81] !== getDropTargetHandlers || $[82] !== handleFolderSelect) {
4852
+ let t22;
4853
+ $[84] !== currentFolderId || $[85] !== dropTargetId || $[86] !== expandedIds || $[87] !== getDropTargetHandlers || $[88] !== handleFolderSelect ? (t22 = (node) => /* @__PURE__ */ jsx(FolderNode, {
4755
4854
  currentFolderId,
4855
+ dropTargetId,
4756
4856
  expandedIds,
4857
+ getDropTargetHandlers,
4757
4858
  node,
4758
4859
  onSelect: handleFolderSelect
4759
- }, node.id), $[46] = currentFolderId, $[47] = expandedIds, $[48] = handleFolderSelect, $[49] = t19) : t19 = $[49], t18 = folderTree.map(t19), $[41] = currentFolderId, $[42] = expandedIds, $[43] = folderTree, $[44] = handleFolderSelect, $[45] = t18;
4760
- } else t18 = $[45];
4761
- let t19;
4762
- $[50] !== t17 || $[51] !== t18 || $[52] !== treeKey ? (t19 = /* @__PURE__ */ jsxs(Tree, {
4763
- gap: 1,
4764
- children: [t17, t18]
4765
- }, treeKey), $[50] = t17, $[51] = t18, $[52] = treeKey, $[53] = t19) : t19 = $[53];
4766
- let t20;
4767
- $[54] !== fetching || $[55] !== hasFolders ? (t20 = !hasFolders && !fetching && /* @__PURE__ */ jsx(Box, {
4860
+ }, node.id), $[84] = currentFolderId, $[85] = dropTargetId, $[86] = expandedIds, $[87] = getDropTargetHandlers, $[88] = handleFolderSelect, $[89] = t22) : t22 = $[89], t21 = folderTree.map(t22), $[77] = currentFolderId, $[78] = dropTargetId, $[79] = expandedIds, $[80] = folderTree, $[81] = getDropTargetHandlers, $[82] = handleFolderSelect, $[83] = t21;
4861
+ } else t21 = $[83];
4862
+ let t22;
4863
+ $[90] !== T1 || $[91] !== t13 || $[92] !== t14 || $[93] !== t20 || $[94] !== t21 ? (t22 = /* @__PURE__ */ jsxs(T1, {
4864
+ gap: t13,
4865
+ children: [t20, t21]
4866
+ }, t14), $[90] = T1, $[91] = t13, $[92] = t14, $[93] = t20, $[94] = t21, $[95] = t22) : t22 = $[95];
4867
+ let t23;
4868
+ $[96] !== fetching || $[97] !== hasFolders ? (t23 = !hasFolders && !fetching && /* @__PURE__ */ jsx(Box, {
4768
4869
  marginTop: 3,
4769
4870
  paddingX: 1,
4770
4871
  children: /* @__PURE__ */ jsx(Text, {
@@ -4772,28 +4873,39 @@ const getExpandedIdSet = (folderId, byId) => {
4772
4873
  size: 1,
4773
4874
  children: /* @__PURE__ */ jsx("em", { children: "No folders" })
4774
4875
  })
4775
- }), $[54] = fetching, $[55] = hasFolders, $[56] = t20) : t20 = $[56];
4776
- let t21;
4777
- $[57] !== t19 || $[58] !== t20 ? (t21 = /* @__PURE__ */ jsx(Box, {
4778
- padding: 2,
4779
- children: /* @__PURE__ */ jsxs(Box, { children: [t19, t20] })
4780
- }), $[57] = t19, $[58] = t20, $[59] = t21) : t21 = $[59];
4781
- let t22;
4782
- return $[60] !== t13 || $[61] !== t21 ? (t22 = /* @__PURE__ */ jsxs(Flex, {
4783
- direction: "column",
4784
- flex: 1,
4785
- height: "fill",
4786
- children: [t13, t21]
4787
- }), $[60] = t13, $[61] = t21, $[62] = t22) : t22 = $[62], t22;
4876
+ }), $[96] = fetching, $[97] = hasFolders, $[98] = t23) : t23 = $[98];
4877
+ let t24;
4878
+ $[99] !== T2 || $[100] !== t22 || $[101] !== t23 ? (t24 = /* @__PURE__ */ jsxs(T2, { children: [t22, t23] }), $[99] = T2, $[100] = t22, $[101] = t23, $[102] = t24) : t24 = $[102];
4879
+ let t25;
4880
+ $[103] !== T3 || $[104] !== t15 || $[105] !== t24 ? (t25 = /* @__PURE__ */ jsx(T3, {
4881
+ padding: t15,
4882
+ children: t24
4883
+ }), $[103] = T3, $[104] = t15, $[105] = t24, $[106] = t25) : t25 = $[106];
4884
+ let t26;
4885
+ return $[107] !== T4 || $[108] !== t16 || $[109] !== t17 || $[110] !== t18 || $[111] !== t19 || $[112] !== t25 ? (t26 = /* @__PURE__ */ jsxs(T4, {
4886
+ direction: t16,
4887
+ flex: t17,
4888
+ height: t18,
4889
+ children: [t19, t25]
4890
+ }), $[107] = T4, $[108] = t16, $[109] = t17, $[110] = t18, $[111] = t19, $[112] = t25, $[113] = t26) : t26 = $[113], t26;
4788
4891
  };
4789
4892
  function _temp$29(state) {
4790
4893
  return state.folders.currentFolderId;
4791
4894
  }
4792
4895
  function _temp2$16(state_0) {
4793
- return state_0.folders.byId;
4896
+ return state_0.assets.byIds;
4897
+ }
4898
+ function _temp3$9(state_1) {
4899
+ return state_1.folders.byId;
4794
4900
  }
4795
- function _temp3$8(state_1) {
4796
- return state_1.folders.fetching;
4901
+ function _temp4$5(state_2) {
4902
+ return state_2.folders.fetching;
4903
+ }
4904
+ function _temp5$3(e_0) {
4905
+ isAssetDrag(e_0) && (e_0.preventDefault(), e_0.stopPropagation(), e_0.dataTransfer.dropEffect = "move");
4906
+ }
4907
+ function _temp6$1(item) {
4908
+ return !!item;
4797
4909
  }
4798
4910
  const DialogFolders = (props) => {
4799
4911
  let $ = c(7), { children, dialog: t0 } = props, { id } = t0, dispatch = useDispatch(), t1;
@@ -5337,7 +5449,7 @@ const DialogFolders = (props) => {
5337
5449
  isDisabled: tagsFetching,
5338
5450
  isSearchable: !0,
5339
5451
  name: "tags",
5340
- noOptionsMessage: _temp3$7,
5452
+ noOptionsMessage: _temp3$8,
5341
5453
  onChange: (value) => handleChange(value),
5342
5454
  options: allTagOptions,
5343
5455
  placeholder: tagsFetching ? "Loading..." : "Select...",
@@ -5357,7 +5469,7 @@ function _temp$28(state) {
5357
5469
  function _temp2$15(state_0) {
5358
5470
  return state_0.tags.fetching;
5359
5471
  }
5360
- function _temp3$7() {
5472
+ function _temp3$8() {
5361
5473
  return "No tags";
5362
5474
  }
5363
5475
  const StackContainer = /* @__PURE__ */ styled(Flex).withConfig({
@@ -5396,11 +5508,11 @@ function _temp2$14(facet) {
5396
5508
  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;
5397
5509
  }
5398
5510
  const SearchFacetsControl = () => {
5399
- let $ = c(35), dispatch = useDispatch(), assetTypes = useTypedSelector(_temp$26), searchFacets = useTypedSelector(_temp2$13), selectedDocument = useTypedSelector(_temp3$6), popoverProps = usePortalPopoverProps(), { creditLine } = useToolOptions(), isTool = !selectedDocument, T0, T1, T2, t0, t1, t2;
5511
+ let $ = c(35), dispatch = useDispatch(), assetTypes = useTypedSelector(_temp$26), searchFacets = useTypedSelector(_temp2$13), selectedDocument = useTypedSelector(_temp3$7), popoverProps = usePortalPopoverProps(), { creditLine } = useToolOptions(), isTool = !selectedDocument, T0, T1, T2, t0, t1, t2;
5400
5512
  if ($[0] !== assetTypes || $[1] !== creditLine?.enabled || $[2] !== dispatch || $[3] !== isTool || $[4] !== searchFacets) {
5401
5513
  let t3;
5402
5514
  $[11] !== assetTypes || $[12] !== creditLine?.enabled || $[13] !== isTool ? (t3 = (facet) => !creditLine?.enabled && facet?.type === "string" && facet?.name === "creditLine" ? !1 : facet.type === "group" || facet.type === "divider" ? !0 : isTool ? !facet?.selectOnly : facet.assetTypes.filter((assetType) => assetTypes.includes(assetType)).length > 0, $[11] = assetTypes, $[12] = creditLine?.enabled, $[13] = isTool, $[14] = t3) : t3 = $[14];
5403
- let filteredFacets = FACETS.filter(t3).filter(_temp4$3), hasSearchFacets = filteredFacets.length > 0, renderMenuFacets = (facets_0, t4) => {
5515
+ let filteredFacets = FACETS.filter(t3).filter(_temp4$4), hasSearchFacets = filteredFacets.length > 0, renderMenuFacets = (facets_0, t4) => {
5404
5516
  let level = t4 === void 0 ? 0 : t4;
5405
5517
  return /* @__PURE__ */ jsx(Fragment, { children: facets_0?.map((facet_1, index_0) => {
5406
5518
  if (facet_1.type === "divider") return /* @__PURE__ */ jsx(MenuDivider, {}, index_0);
@@ -5464,10 +5576,10 @@ function _temp$26(state) {
5464
5576
  function _temp2$13(state_0) {
5465
5577
  return state_0.search.facets;
5466
5578
  }
5467
- function _temp3$6(state_1) {
5579
+ function _temp3$7(state_1) {
5468
5580
  return state_1.selected.document;
5469
5581
  }
5470
- function _temp4$3(facet_0, index, facets) {
5582
+ function _temp4$4(facet_0, index, facets) {
5471
5583
  let previousFacet = facets[index - 1];
5472
5584
  return !(facet_0.type === "divider" && (index === 0 || index === facets.length - 1) || facet_0.type === "divider" && previousFacet?.type === "divider");
5473
5585
  }
@@ -5898,7 +6010,7 @@ const TagContainer = styled(Flex).withConfig({
5898
6010
  let tagIdsSegmented = pickedTagIdsUnique.reduce(t1, {
5899
6011
  appliedToAll: [],
5900
6012
  appliedToSome: []
5901
- }), tagsAppliedToAll = tags.filter((tag_1) => tagIdsSegmented.appliedToAll.includes(tag_1.tag._id)).map(_temp3$5), tagsAppliedToSome = tags.filter((tag_2) => tagIdsSegmented.appliedToSome.includes(tag_2.tag._id)).map(_temp4$2), tagsUnused = tags.filter((tag_3) => !pickedTagIdsUnique.includes(tag_3.tag._id)).map(_temp5$2);
6013
+ }), tagsAppliedToAll = tags.filter((tag_1) => tagIdsSegmented.appliedToAll.includes(tag_1.tag._id)).map(_temp3$6), tagsAppliedToSome = tags.filter((tag_2) => tagIdsSegmented.appliedToSome.includes(tag_2.tag._id)).map(_temp4$3), tagsUnused = tags.filter((tag_3) => !pickedTagIdsUnique.includes(tag_3.tag._id)).map(_temp5$2);
5902
6014
  items = [], assetsPicked.length === 0 ? items = tags.map(_temp6) : (tagsAppliedToAll?.length > 0 && (items = [
5903
6015
  ...items,
5904
6016
  assetsPicked.length === 1 ? "Used" : "Used by all",
@@ -5945,7 +6057,7 @@ function _temp2$11(acc, val) {
5945
6057
  let assetTagIds = val?.asset?.opt?.media?.tags?.map(_temp$23) || [];
5946
6058
  return acc = acc.concat(assetTagIds), acc;
5947
6059
  }
5948
- function _temp3$5(tagItem) {
6060
+ function _temp3$6(tagItem) {
5949
6061
  return {
5950
6062
  ...tagItem,
5951
6063
  actions: [
@@ -5956,7 +6068,7 @@ function _temp3$5(tagItem) {
5956
6068
  ]
5957
6069
  };
5958
6070
  }
5959
- function _temp4$2(tagItem_0) {
6071
+ function _temp4$3(tagItem_0) {
5960
6072
  return {
5961
6073
  ...tagItem_0,
5962
6074
  actions: [
@@ -6311,7 +6423,8 @@ function createReduxStore(props) {
6311
6423
  assets: {
6312
6424
  ...initialState$1,
6313
6425
  assetTypes: isSupportedAssetType(props?.assetType) ? [props.assetType] : ["file", "image"],
6314
- excludeTagSlugs: props.excludeTagSlugs?.length ? [...props.excludeTagSlugs] : []
6426
+ excludeTagSlugs: props.excludeTagSlugs?.length ? [...props.excludeTagSlugs] : [],
6427
+ showMediaLibraryAssets: props.showMediaLibraryAssets ?? !0
6315
6428
  },
6316
6429
  debug: {
6317
6430
  badConnection: !1,
@@ -6626,7 +6739,7 @@ function _temp$15(state) {
6626
6739
  return state.search.query;
6627
6740
  }
6628
6741
  const Controls = () => {
6629
- let $ = c(62), dispatch = useDispatch(), fetching = useTypedSelector(_temp$14), foldersPanelVisible = useTypedSelector(_temp2$8), pageIndex = useTypedSelector(_temp3$4), searchFacets = useTypedSelector(_temp4$1), tagsPanelVisible = useTypedSelector(_temp5$1), mediaIndex = useMediaIndex(), t0;
6742
+ let $ = c(62), dispatch = useDispatch(), fetching = useTypedSelector(_temp$14), foldersPanelVisible = useTypedSelector(_temp2$8), pageIndex = useTypedSelector(_temp3$5), searchFacets = useTypedSelector(_temp4$2), tagsPanelVisible = useTypedSelector(_temp5$1), mediaIndex = useMediaIndex(), t0;
6630
6743
  $[0] === dispatch ? t0 = $[1] : (t0 = () => {
6631
6744
  dispatch(dialogActions.showSearchFacets());
6632
6745
  }, $[0] = dispatch, $[1] = t0);
@@ -6838,10 +6951,10 @@ function _temp$14(state) {
6838
6951
  function _temp2$8(state_0) {
6839
6952
  return state_0.folders.panelVisible;
6840
6953
  }
6841
- function _temp3$4(state_1) {
6954
+ function _temp3$5(state_1) {
6842
6955
  return state_1.assets.pageIndex;
6843
6956
  }
6844
- function _temp4$1(state_2) {
6957
+ function _temp4$2(state_2) {
6845
6958
  return state_2.search.facets;
6846
6959
  }
6847
6960
  function _temp5$1(state_3) {
@@ -7212,15 +7325,15 @@ function _temp$8(state) {
7212
7325
  }
7213
7326
  const ContainerGrid$1 = /* @__PURE__ */ styled(Grid).withConfig({
7214
7327
  displayName: "ContainerGrid",
7215
- componentId: "sc-mfq3ng-0"
7328
+ componentId: "sc-zsye3t-0"
7216
7329
  })(({ $scheme, $selected, $updating }) => css`align-items:center;cursor:${$selected ? "default" : "pointer"};height:100%;pointer-events:${$updating ? "none" : "auto"};user-select:none;white-space:nowrap;${!$updating && css`@media (hover:hover) and (pointer:fine){&:hover{background:${getSchemeColor($scheme, "bg")};}}`}`), ContextActionContainer = /* @__PURE__ */ styled(Flex).withConfig({
7217
7330
  displayName: "ContextActionContainer",
7218
- componentId: "sc-mfq3ng-1"
7331
+ componentId: "sc-zsye3t-1"
7219
7332
  })(({ $scheme }) => css`cursor:pointer;@media (hover:hover) and (pointer:fine){&:hover{background:${getSchemeColor($scheme, "bg2")};}}`), StyledWarningIcon = /* @__PURE__ */ styled(WarningFilledIcon).withConfig({
7220
7333
  displayName: "StyledWarningIcon",
7221
- componentId: "sc-mfq3ng-2"
7334
+ componentId: "sc-zsye3t-2"
7222
7335
  })(({ theme }) => ({ color: theme.sanity.color.spot.red })), TableRowAsset = (props) => {
7223
- let $ = c(150), { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = useState(!1), refCountVisibleTimeout = useRef(null), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$7), t0;
7336
+ let $ = c(156), { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = useState(!1), refCountVisibleTimeout = useRef(null), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$7), assetsPicked = useTypedSelector(selectAssetsPicked), t0;
7224
7337
  $[0] === id ? t0 = $[1] : (t0 = (state_0) => selectAssetById(state_0, id), $[0] = id, $[1] = t0);
7225
7338
  let item = useTypedSelector(t0), mediaIndex = useMediaIndex(), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, { isMultiSelect, onSelect } = useAssetSourceActions(), t1;
7226
7339
  $[2] !== asset || $[3] !== dispatch || $[4] !== isMultiSelect || $[5] !== lastPicked || $[6] !== onSelect || $[7] !== picked || $[8] !== selected || $[9] !== shiftPressed ? (t1 = (e) => {
@@ -7243,6 +7356,9 @@ const ContainerGrid$1 = /* @__PURE__ */ styled(Grid).withConfig({
7243
7356
  })) : dispatch(assetsActions.pick({
7244
7357
  assetId: asset._id,
7245
7358
  picked: !picked
7359
+ })) : e_0.ctrlKey || e_0.metaKey ? dispatch(assetsActions.pick({
7360
+ assetId: asset._id,
7361
+ picked: !picked
7246
7362
  })) : shiftPressed.current ? dispatch(picked ? assetsActions.pick({
7247
7363
  assetId: asset._id,
7248
7364
  picked: !picked
@@ -7251,19 +7367,23 @@ const ContainerGrid$1 = /* @__PURE__ */ styled(Grid).withConfig({
7251
7367
  endId: asset._id
7252
7368
  })) : dispatch(dialogActions.showAssetEdit({ assetId: asset._id }))));
7253
7369
  }, $[11] = asset, $[12] = dispatch, $[13] = isMultiSelect, $[14] = lastPicked, $[15] = onSelect, $[16] = picked, $[17] = selected, $[18] = shiftPressed, $[19] = t2) : t2 = $[19];
7254
- let handleClick = t2, opacityCell = updating ? .5 : 1, opacityPreview = selected || updating ? .1 : 1, t3, t4;
7255
- if ($[20] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => (refCountVisibleTimeout.current = setTimeout(() => setReferenceCountVisible(!0), 750), () => {
7370
+ let handleClick = t2, draggable = !selected && !updating, t3;
7371
+ $[20] !== asset || $[21] !== assetsPicked || $[22] !== picked ? (t3 = (e_1) => {
7372
+ asset && setDragAssetIds(e_1, picked ? assetsPicked.map(_temp2$5) : [asset._id]);
7373
+ }, $[20] = asset, $[21] = assetsPicked, $[22] = picked, $[23] = t3) : t3 = $[23];
7374
+ let handleDragStart = t3, opacityCell = updating ? .5 : 1, opacityPreview = selected || updating ? .1 : 1, t4, t5;
7375
+ if ($[24] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => (refCountVisibleTimeout.current = setTimeout(() => setReferenceCountVisible(!0), 750), () => {
7256
7376
  refCountVisibleTimeout.current && clearTimeout(refCountVisibleTimeout.current);
7257
- }), t4 = [], $[20] = t3, $[21] = t4) : (t3 = $[20], t4 = $[21]), useEffect(t3, t4), !asset) return null;
7258
- let t5 = selected ? void 0 : handleClick, t6 = mediaIndex < 3 ? 0 : "16px", t7 = mediaIndex < 3 ? GRID_TEMPLATE_COLUMNS.SMALL : GRID_TEMPLATE_COLUMNS.LARGE, t8 = mediaIndex < 3 ? "auto" : "1fr", t9;
7259
- $[22] !== t6 || $[23] !== t7 || $[24] !== t8 ? (t9 = {
7260
- columnGap: t6,
7377
+ }), t5 = [], $[24] = t4, $[25] = t5) : (t4 = $[24], t5 = $[25]), useEffect(t4, t5), !asset) return null;
7378
+ let t6 = selected ? void 0 : handleClick, t7 = draggable ? handleDragStart : void 0, t8 = mediaIndex < 3 ? 0 : "16px", t9 = mediaIndex < 3 ? GRID_TEMPLATE_COLUMNS.SMALL : GRID_TEMPLATE_COLUMNS.LARGE, t10 = mediaIndex < 3 ? "auto" : "1fr", t11;
7379
+ $[26] !== t10 || $[27] !== t8 || $[28] !== t9 ? (t11 = {
7380
+ columnGap: t8,
7261
7381
  rowGap: 0,
7262
- gridTemplateColumns: t7,
7263
- gridTemplateRows: t8
7264
- }, $[22] = t6, $[23] = t7, $[24] = t8, $[25] = t9) : t9 = $[25];
7265
- let t10 = item.updating, t11;
7266
- $[26] === opacityCell ? t11 = $[27] : (t11 = {
7382
+ gridTemplateColumns: t9,
7383
+ gridTemplateRows: t10
7384
+ }, $[26] = t10, $[27] = t8, $[28] = t9, $[29] = t11) : t11 = $[29];
7385
+ let t12 = item.updating, t13;
7386
+ $[30] === opacityCell ? t13 = $[31] : (t13 = {
7267
7387
  alignItems: "center",
7268
7388
  gridColumn: 1,
7269
7389
  gridRowStart: 1,
@@ -7272,9 +7392,9 @@ const ContainerGrid$1 = /* @__PURE__ */ styled(Grid).withConfig({
7272
7392
  justifyContent: "center",
7273
7393
  opacity: opacityCell,
7274
7394
  position: "relative"
7275
- }, $[26] = opacityCell, $[27] = t11);
7276
- let t12;
7277
- $[28] !== isMultiSelect || $[29] !== onSelect || $[30] !== picked ? (t12 = onSelect && !isMultiSelect ? /* @__PURE__ */ jsx(EditIcon, { style: {
7395
+ }, $[30] = opacityCell, $[31] = t13);
7396
+ let t14;
7397
+ $[32] !== isMultiSelect || $[33] !== onSelect || $[34] !== picked ? (t14 = onSelect && !isMultiSelect ? /* @__PURE__ */ jsx(EditIcon, { style: {
7278
7398
  flexShrink: 0,
7279
7399
  opacity: .5
7280
7400
  } }) : /* @__PURE__ */ jsx(Checkbox, {
@@ -7284,40 +7404,40 @@ const ContainerGrid$1 = /* @__PURE__ */ styled(Grid).withConfig({
7284
7404
  pointerEvents: "none",
7285
7405
  transform: "scale(0.8)"
7286
7406
  }
7287
- }), $[28] = isMultiSelect, $[29] = onSelect, $[30] = picked, $[31] = t12) : t12 = $[31];
7288
- let t13;
7289
- $[32] !== handleContextActionClick || $[33] !== scheme || $[34] !== t11 || $[35] !== t12 ? (t13 = /* @__PURE__ */ jsx(ContextActionContainer, {
7407
+ }), $[32] = isMultiSelect, $[33] = onSelect, $[34] = picked, $[35] = t14) : t14 = $[35];
7408
+ let t15;
7409
+ $[36] !== handleContextActionClick || $[37] !== scheme || $[38] !== t13 || $[39] !== t14 ? (t15 = /* @__PURE__ */ jsx(ContextActionContainer, {
7290
7410
  onClick: handleContextActionClick,
7291
7411
  $scheme: scheme,
7292
- style: t11,
7293
- children: t12
7294
- }), $[32] = handleContextActionClick, $[33] = scheme, $[34] = t11, $[35] = t12, $[36] = t13) : t13 = $[36];
7295
- let t14;
7296
- $[37] === Symbol.for("react.memo_cache_sentinel") ? (t14 = {
7412
+ style: t13,
7413
+ children: t14
7414
+ }), $[36] = handleContextActionClick, $[37] = scheme, $[38] = t13, $[39] = t14, $[40] = t15) : t15 = $[40];
7415
+ let t16;
7416
+ $[41] === Symbol.for("react.memo_cache_sentinel") ? (t16 = {
7297
7417
  gridColumn: 2,
7298
7418
  gridRowStart: 1,
7299
7419
  gridRowEnd: "span 5",
7300
7420
  height: "90px",
7301
7421
  width: "100px"
7302
- }, $[37] = t14) : t14 = $[37];
7303
- let t15;
7304
- $[38] === Symbol.for("react.memo_cache_sentinel") ? (t15 = {
7422
+ }, $[41] = t16) : t16 = $[41];
7423
+ let t17;
7424
+ $[42] === Symbol.for("react.memo_cache_sentinel") ? (t17 = {
7305
7425
  height: "100%",
7306
7426
  position: "relative"
7307
- }, $[38] = t15) : t15 = $[38];
7308
- let t16;
7309
- $[39] === opacityPreview ? t16 = $[40] : (t16 = {
7427
+ }, $[42] = t17) : t17 = $[42];
7428
+ let t18;
7429
+ $[43] === opacityPreview ? t18 = $[44] : (t18 = {
7310
7430
  height: "100%",
7311
7431
  opacity: opacityPreview,
7312
7432
  position: "relative"
7313
- }, $[39] = opacityPreview, $[40] = t16);
7314
- let t17;
7315
- $[41] === asset ? t17 = $[42] : (t17 = isFileAsset(asset) && /* @__PURE__ */ jsx(FileIcon$1, {
7433
+ }, $[43] = opacityPreview, $[44] = t18);
7434
+ let t19;
7435
+ $[45] === asset ? t19 = $[46] : (t19 = isFileAsset(asset) && /* @__PURE__ */ jsx(FileIcon$1, {
7316
7436
  extension: asset.extension,
7317
7437
  width: "40px"
7318
- }), $[41] = asset, $[42] = t17);
7319
- let t18;
7320
- $[43] !== asset || $[44] !== isOpaque || $[45] !== scheme ? (t18 = isImageAsset(asset) && /* @__PURE__ */ jsx(Image$1, {
7438
+ }), $[45] = asset, $[46] = t19);
7439
+ let t20;
7440
+ $[47] !== asset || $[48] !== isOpaque || $[49] !== scheme ? (t20 = isImageAsset(asset) && /* @__PURE__ */ jsx(Image$1, {
7321
7441
  draggable: !1,
7322
7442
  $scheme: scheme,
7323
7443
  $showCheckerboard: !isOpaque,
@@ -7325,14 +7445,14 @@ const ContainerGrid$1 = /* @__PURE__ */ styled(Grid).withConfig({
7325
7445
  height: 100,
7326
7446
  width: 100
7327
7447
  })
7328
- }), $[43] = asset, $[44] = isOpaque, $[45] = scheme, $[46] = t18) : t18 = $[46];
7329
- let t19;
7330
- $[47] !== t16 || $[48] !== t17 || $[49] !== t18 ? (t19 = /* @__PURE__ */ jsxs(Box, {
7331
- style: t16,
7332
- children: [t17, t18]
7333
- }), $[47] = t16, $[48] = t17, $[49] = t18, $[50] = t19) : t19 = $[50];
7334
- let t20;
7335
- $[51] === updating ? t20 = $[52] : (t20 = updating && /* @__PURE__ */ jsx(Flex, {
7448
+ }), $[47] = asset, $[48] = isOpaque, $[49] = scheme, $[50] = t20) : t20 = $[50];
7449
+ let t21;
7450
+ $[51] !== t18 || $[52] !== t19 || $[53] !== t20 ? (t21 = /* @__PURE__ */ jsxs(Box, {
7451
+ style: t18,
7452
+ children: [t19, t20]
7453
+ }), $[51] = t18, $[52] = t19, $[53] = t20, $[54] = t21) : t21 = $[54];
7454
+ let t22;
7455
+ $[55] === updating ? t22 = $[56] : (t22 = updating && /* @__PURE__ */ jsx(Flex, {
7336
7456
  align: "center",
7337
7457
  justify: "center",
7338
7458
  style: {
@@ -7343,9 +7463,9 @@ const ContainerGrid$1 = /* @__PURE__ */ styled(Grid).withConfig({
7343
7463
  width: "100%"
7344
7464
  },
7345
7465
  children: /* @__PURE__ */ jsx(Spinner, {})
7346
- }), $[51] = updating, $[52] = t20);
7347
- let t21;
7348
- $[53] !== selected || $[54] !== updating ? (t21 = selected && !updating && /* @__PURE__ */ jsx(Flex, {
7466
+ }), $[55] = updating, $[56] = t22);
7467
+ let t23;
7468
+ $[57] !== selected || $[58] !== updating ? (t23 = selected && !updating && /* @__PURE__ */ jsx(Flex, {
7349
7469
  align: "center",
7350
7470
  justify: "center",
7351
7471
  style: {
@@ -7359,174 +7479,174 @@ const ContainerGrid$1 = /* @__PURE__ */ styled(Grid).withConfig({
7359
7479
  size: 2,
7360
7480
  children: /* @__PURE__ */ jsx(CheckmarkCircleIcon, {})
7361
7481
  })
7362
- }), $[53] = selected, $[54] = updating, $[55] = t21) : t21 = $[55];
7363
- let t22;
7364
- $[56] !== t19 || $[57] !== t20 || $[58] !== t21 ? (t22 = /* @__PURE__ */ jsx(Box, {
7365
- style: t14,
7482
+ }), $[57] = selected, $[58] = updating, $[59] = t23) : t23 = $[59];
7483
+ let t24;
7484
+ $[60] !== t21 || $[61] !== t22 || $[62] !== t23 ? (t24 = /* @__PURE__ */ jsx(Box, {
7485
+ style: t16,
7366
7486
  children: /* @__PURE__ */ jsxs(Flex, {
7367
7487
  align: "center",
7368
7488
  justify: "center",
7369
- style: t15,
7489
+ style: t17,
7370
7490
  children: [
7371
- t19,
7372
- t20,
7373
- t21
7491
+ t21,
7492
+ t22,
7493
+ t23
7374
7494
  ]
7375
7495
  })
7376
- }), $[56] = t19, $[57] = t20, $[58] = t21, $[59] = t22) : t22 = $[59];
7377
- let t23 = mediaIndex < 3 ? 3 : 0, t24 = mediaIndex < 3 ? 2 : "auto", t25;
7378
- $[60] !== opacityCell || $[61] !== t24 ? (t25 = {
7496
+ }), $[60] = t21, $[61] = t22, $[62] = t23, $[63] = t24) : t24 = $[63];
7497
+ let t25 = mediaIndex < 3 ? 3 : 0, t26 = mediaIndex < 3 ? 2 : "auto", t27;
7498
+ $[64] !== opacityCell || $[65] !== t26 ? (t27 = {
7379
7499
  gridColumn: 3,
7380
- gridRow: t24,
7500
+ gridRow: t26,
7381
7501
  opacity: opacityCell
7382
- }, $[60] = opacityCell, $[61] = t24, $[62] = t25) : t25 = $[62];
7383
- let t26;
7384
- $[63] === Symbol.for("react.memo_cache_sentinel") ? (t26 = { lineHeight: "2em" }, $[63] = t26) : t26 = $[63];
7385
- let t27;
7386
- $[64] === asset.originalFilename ? t27 = $[65] : (t27 = /* @__PURE__ */ jsx(Text, {
7502
+ }, $[64] = opacityCell, $[65] = t26, $[66] = t27) : t27 = $[66];
7503
+ let t28;
7504
+ $[67] === Symbol.for("react.memo_cache_sentinel") ? (t28 = { lineHeight: "2em" }, $[67] = t28) : t28 = $[67];
7505
+ let t29;
7506
+ $[68] === asset.originalFilename ? t29 = $[69] : (t29 = /* @__PURE__ */ jsx(Text, {
7387
7507
  muted: !0,
7388
7508
  size: 1,
7389
- style: t26,
7509
+ style: t28,
7390
7510
  textOverflow: "ellipsis",
7391
7511
  children: asset.originalFilename
7392
- }), $[64] = asset.originalFilename, $[65] = t27);
7393
- let t28;
7394
- $[66] !== t23 || $[67] !== t25 || $[68] !== t27 ? (t28 = /* @__PURE__ */ jsx(Box, {
7395
- marginLeft: t23,
7396
- style: t25,
7397
- children: t27
7398
- }), $[66] = t23, $[67] = t25, $[68] = t27, $[69] = t28) : t28 = $[69];
7399
- let t29 = mediaIndex < 3 ? 3 : 0, t30 = mediaIndex < 3 ? 3 : 4, t31 = mediaIndex < 3 ? 3 : "auto", t32;
7400
- $[70] !== opacityCell || $[71] !== t30 || $[72] !== t31 ? (t32 = {
7401
- gridColumn: t30,
7402
- gridRow: t31,
7512
+ }), $[68] = asset.originalFilename, $[69] = t29);
7513
+ let t30;
7514
+ $[70] !== t25 || $[71] !== t27 || $[72] !== t29 ? (t30 = /* @__PURE__ */ jsx(Box, {
7515
+ marginLeft: t25,
7516
+ style: t27,
7517
+ children: t29
7518
+ }), $[70] = t25, $[71] = t27, $[72] = t29, $[73] = t30) : t30 = $[73];
7519
+ let t31 = mediaIndex < 3 ? 3 : 0, t32 = mediaIndex < 3 ? 3 : 4, t33 = mediaIndex < 3 ? 3 : "auto", t34;
7520
+ $[74] !== opacityCell || $[75] !== t32 || $[76] !== t33 ? (t34 = {
7521
+ gridColumn: t32,
7522
+ gridRow: t33,
7403
7523
  opacity: opacityCell
7404
- }, $[70] = opacityCell, $[71] = t30, $[72] = t31, $[73] = t32) : t32 = $[73];
7405
- let t33;
7406
- $[74] === Symbol.for("react.memo_cache_sentinel") ? (t33 = { lineHeight: "2em" }, $[74] = t33) : t33 = $[74];
7407
- let t34;
7408
- $[75] === asset ? t34 = $[76] : (t34 = isImageAsset(asset) && getAssetResolution(asset), $[75] = asset, $[76] = t34);
7524
+ }, $[74] = opacityCell, $[75] = t32, $[76] = t33, $[77] = t34) : t34 = $[77];
7409
7525
  let t35;
7410
- $[77] === t34 ? t35 = $[78] : (t35 = /* @__PURE__ */ jsx(Text, {
7526
+ $[78] === Symbol.for("react.memo_cache_sentinel") ? (t35 = { lineHeight: "2em" }, $[78] = t35) : t35 = $[78];
7527
+ let t36;
7528
+ $[79] === asset ? t36 = $[80] : (t36 = isImageAsset(asset) && getAssetResolution(asset), $[79] = asset, $[80] = t36);
7529
+ let t37;
7530
+ $[81] === t36 ? t37 = $[82] : (t37 = /* @__PURE__ */ jsx(Text, {
7411
7531
  muted: !0,
7412
7532
  size: 1,
7413
- style: t33,
7533
+ style: t35,
7414
7534
  textOverflow: "ellipsis",
7415
- children: t34
7416
- }), $[77] = t34, $[78] = t35);
7417
- let t36;
7418
- $[79] !== t29 || $[80] !== t32 || $[81] !== t35 ? (t36 = /* @__PURE__ */ jsx(Box, {
7419
- marginLeft: t29,
7420
- style: t32,
7421
- children: t35
7422
- }), $[79] = t29, $[80] = t32, $[81] = t35, $[82] = t36) : t36 = $[82];
7423
- let t37 = mediaIndex < 3 ? "none" : "block", t38;
7424
- $[83] !== opacityCell || $[84] !== t37 ? (t38 = {
7425
- display: t37,
7535
+ children: t36
7536
+ }), $[81] = t36, $[82] = t37);
7537
+ let t38;
7538
+ $[83] !== t31 || $[84] !== t34 || $[85] !== t37 ? (t38 = /* @__PURE__ */ jsx(Box, {
7539
+ marginLeft: t31,
7540
+ style: t34,
7541
+ children: t37
7542
+ }), $[83] = t31, $[84] = t34, $[85] = t37, $[86] = t38) : t38 = $[86];
7543
+ let t39 = mediaIndex < 3 ? "none" : "block", t40;
7544
+ $[87] !== opacityCell || $[88] !== t39 ? (t40 = {
7545
+ display: t39,
7426
7546
  gridColumn: 5,
7427
7547
  gridRow: "auto",
7428
7548
  opacity: opacityCell
7429
- }, $[83] = opacityCell, $[84] = t37, $[85] = t38) : t38 = $[85];
7430
- let t39;
7431
- $[86] === Symbol.for("react.memo_cache_sentinel") ? (t39 = { lineHeight: "2em" }, $[86] = t39) : t39 = $[86];
7432
- let t40;
7433
- $[87] === asset.mimeType ? t40 = $[88] : (t40 = /* @__PURE__ */ jsx(Text, {
7549
+ }, $[87] = opacityCell, $[88] = t39, $[89] = t40) : t40 = $[89];
7550
+ let t41;
7551
+ $[90] === Symbol.for("react.memo_cache_sentinel") ? (t41 = { lineHeight: "2em" }, $[90] = t41) : t41 = $[90];
7552
+ let t42;
7553
+ $[91] === asset.mimeType ? t42 = $[92] : (t42 = /* @__PURE__ */ jsx(Text, {
7434
7554
  muted: !0,
7435
7555
  size: 1,
7436
- style: t39,
7556
+ style: t41,
7437
7557
  textOverflow: "ellipsis",
7438
7558
  children: asset.mimeType
7439
- }), $[87] = asset.mimeType, $[88] = t40);
7440
- let t41;
7441
- $[89] !== t38 || $[90] !== t40 ? (t41 = /* @__PURE__ */ jsx(Box, {
7442
- style: t38,
7443
- children: t40
7444
- }), $[89] = t38, $[90] = t40, $[91] = t41) : t41 = $[91];
7445
- let t42 = mediaIndex < 3 ? "none" : "block", t43;
7446
- $[92] !== opacityCell || $[93] !== t42 ? (t43 = {
7447
- display: t42,
7559
+ }), $[91] = asset.mimeType, $[92] = t42);
7560
+ let t43;
7561
+ $[93] !== t40 || $[94] !== t42 ? (t43 = /* @__PURE__ */ jsx(Box, {
7562
+ style: t40,
7563
+ children: t42
7564
+ }), $[93] = t40, $[94] = t42, $[95] = t43) : t43 = $[95];
7565
+ let t44 = mediaIndex < 3 ? "none" : "block", t45;
7566
+ $[96] !== opacityCell || $[97] !== t44 ? (t45 = {
7567
+ display: t44,
7448
7568
  gridColumn: 6,
7449
7569
  gridRow: "auto",
7450
7570
  opacity: opacityCell
7451
- }, $[92] = opacityCell, $[93] = t42, $[94] = t43) : t43 = $[94];
7452
- let t44;
7453
- $[95] === Symbol.for("react.memo_cache_sentinel") ? (t44 = { lineHeight: "2em" }, $[95] = t44) : t44 = $[95];
7454
- let t45;
7455
- $[96] === asset.size ? t45 = $[97] : (t45 = filesize(asset.size, {
7571
+ }, $[96] = opacityCell, $[97] = t44, $[98] = t45) : t45 = $[98];
7572
+ let t46;
7573
+ $[99] === Symbol.for("react.memo_cache_sentinel") ? (t46 = { lineHeight: "2em" }, $[99] = t46) : t46 = $[99];
7574
+ let t47;
7575
+ $[100] === asset.size ? t47 = $[101] : (t47 = filesize(asset.size, {
7456
7576
  base: 10,
7457
7577
  round: 0
7458
- }), $[96] = asset.size, $[97] = t45);
7459
- let t46;
7460
- $[98] === t45 ? t46 = $[99] : (t46 = /* @__PURE__ */ jsx(Text, {
7578
+ }), $[100] = asset.size, $[101] = t47);
7579
+ let t48;
7580
+ $[102] === t47 ? t48 = $[103] : (t48 = /* @__PURE__ */ jsx(Text, {
7461
7581
  muted: !0,
7462
7582
  size: 1,
7463
- style: t44,
7583
+ style: t46,
7464
7584
  textOverflow: "ellipsis",
7465
- children: t45
7466
- }), $[98] = t45, $[99] = t46);
7467
- let t47;
7468
- $[100] !== t43 || $[101] !== t46 ? (t47 = /* @__PURE__ */ jsx(Box, {
7469
- style: t43,
7470
- children: t46
7471
- }), $[100] = t43, $[101] = t46, $[102] = t47) : t47 = $[102];
7472
- let t48 = mediaIndex < 3 ? 3 : 0, t49 = mediaIndex < 3 ? 3 : 7, t50 = mediaIndex < 3 ? 4 : "auto", t51;
7473
- $[103] !== opacityCell || $[104] !== t49 || $[105] !== t50 ? (t51 = {
7474
- gridColumn: t49,
7475
- gridRow: t50,
7585
+ children: t47
7586
+ }), $[102] = t47, $[103] = t48);
7587
+ let t49;
7588
+ $[104] !== t45 || $[105] !== t48 ? (t49 = /* @__PURE__ */ jsx(Box, {
7589
+ style: t45,
7590
+ children: t48
7591
+ }), $[104] = t45, $[105] = t48, $[106] = t49) : t49 = $[106];
7592
+ let t50 = mediaIndex < 3 ? 3 : 0, t51 = mediaIndex < 3 ? 3 : 7, t52 = mediaIndex < 3 ? 4 : "auto", t53;
7593
+ $[107] !== opacityCell || $[108] !== t51 || $[109] !== t52 ? (t53 = {
7594
+ gridColumn: t51,
7595
+ gridRow: t52,
7476
7596
  opacity: opacityCell
7477
- }, $[103] = opacityCell, $[104] = t49, $[105] = t50, $[106] = t51) : t51 = $[106];
7478
- let t52;
7479
- $[107] === Symbol.for("react.memo_cache_sentinel") ? (t52 = { lineHeight: "2em" }, $[107] = t52) : t52 = $[107];
7480
- let t53;
7481
- $[108] === asset._updatedAt ? t53 = $[109] : (t53 = formatRelative(new Date(asset._updatedAt), /* @__PURE__ */ new Date()), $[108] = asset._updatedAt, $[109] = t53);
7597
+ }, $[107] = opacityCell, $[108] = t51, $[109] = t52, $[110] = t53) : t53 = $[110];
7482
7598
  let t54;
7483
- $[110] === t53 ? t54 = $[111] : (t54 = /* @__PURE__ */ jsx(Text, {
7599
+ $[111] === Symbol.for("react.memo_cache_sentinel") ? (t54 = { lineHeight: "2em" }, $[111] = t54) : t54 = $[111];
7600
+ let t55;
7601
+ $[112] === asset._updatedAt ? t55 = $[113] : (t55 = formatRelative(new Date(asset._updatedAt), /* @__PURE__ */ new Date()), $[112] = asset._updatedAt, $[113] = t55);
7602
+ let t56;
7603
+ $[114] === t55 ? t56 = $[115] : (t56 = /* @__PURE__ */ jsx(Text, {
7484
7604
  muted: !0,
7485
7605
  size: 1,
7486
- style: t52,
7606
+ style: t54,
7487
7607
  textOverflow: "ellipsis",
7488
- children: t53
7489
- }), $[110] = t53, $[111] = t54);
7490
- let t55;
7491
- $[112] !== t48 || $[113] !== t51 || $[114] !== t54 ? (t55 = /* @__PURE__ */ jsx(Box, {
7492
- marginLeft: t48,
7493
- style: t51,
7494
- children: t54
7495
- }), $[112] = t48, $[113] = t51, $[114] = t54, $[115] = t55) : t55 = $[115];
7496
- let t56 = mediaIndex < 3 ? "none" : "block", t57;
7497
- $[116] !== opacityCell || $[117] !== t56 ? (t57 = {
7498
- display: t56,
7608
+ children: t55
7609
+ }), $[114] = t55, $[115] = t56);
7610
+ let t57;
7611
+ $[116] !== t50 || $[117] !== t53 || $[118] !== t56 ? (t57 = /* @__PURE__ */ jsx(Box, {
7612
+ marginLeft: t50,
7613
+ style: t53,
7614
+ children: t56
7615
+ }), $[116] = t50, $[117] = t53, $[118] = t56, $[119] = t57) : t57 = $[119];
7616
+ let t58 = mediaIndex < 3 ? "none" : "block", t59;
7617
+ $[120] !== opacityCell || $[121] !== t58 ? (t59 = {
7618
+ display: t58,
7499
7619
  gridColumn: 8,
7500
7620
  gridRow: "auto",
7501
7621
  opacity: opacityCell
7502
- }, $[116] = opacityCell, $[117] = t56, $[118] = t57) : t57 = $[118];
7503
- let t58;
7504
- $[119] === Symbol.for("react.memo_cache_sentinel") ? (t58 = { lineHeight: "2em" }, $[119] = t58) : t58 = $[119];
7505
- let t59;
7506
- $[120] !== id || $[121] !== referenceCountVisible ? (t59 = /* @__PURE__ */ jsx(Text, {
7622
+ }, $[120] = opacityCell, $[121] = t58, $[122] = t59) : t59 = $[122];
7623
+ let t60;
7624
+ $[123] === Symbol.for("react.memo_cache_sentinel") ? (t60 = { lineHeight: "2em" }, $[123] = t60) : t60 = $[123];
7625
+ let t61;
7626
+ $[124] !== id || $[125] !== referenceCountVisible ? (t61 = /* @__PURE__ */ jsx(Text, {
7507
7627
  muted: !0,
7508
7628
  size: 1,
7509
- style: t58,
7629
+ style: t60,
7510
7630
  textOverflow: "ellipsis",
7511
7631
  children: referenceCountVisible ? /* @__PURE__ */ jsx(WithReferringDocuments, {
7512
7632
  id,
7513
- children: _temp2$5
7633
+ children: _temp3$4
7514
7634
  }) : /* @__PURE__ */ jsx(Fragment, { children: "-" })
7515
- }), $[120] = id, $[121] = referenceCountVisible, $[122] = t59) : t59 = $[122];
7516
- let t60;
7517
- $[123] !== t57 || $[124] !== t59 ? (t60 = /* @__PURE__ */ jsx(Box, {
7518
- style: t57,
7519
- children: t59
7520
- }), $[123] = t57, $[124] = t59, $[125] = t60) : t60 = $[125];
7521
- let t61 = mediaIndex < 3 ? 4 : 9, t62 = mediaIndex < 3 ? "span 5" : "auto", t63;
7522
- $[126] !== opacityCell || $[127] !== t61 || $[128] !== t62 ? (t63 = {
7523
- gridColumn: t61,
7635
+ }), $[124] = id, $[125] = referenceCountVisible, $[126] = t61) : t61 = $[126];
7636
+ let t62;
7637
+ $[127] !== t59 || $[128] !== t61 ? (t62 = /* @__PURE__ */ jsx(Box, {
7638
+ style: t59,
7639
+ children: t61
7640
+ }), $[127] = t59, $[128] = t61, $[129] = t62) : t62 = $[129];
7641
+ let t63 = mediaIndex < 3 ? 4 : 9, t64 = mediaIndex < 3 ? "span 5" : "auto", t65;
7642
+ $[130] !== opacityCell || $[131] !== t63 || $[132] !== t64 ? (t65 = {
7643
+ gridColumn: t63,
7524
7644
  gridRowStart: "1",
7525
- gridRowEnd: t62,
7645
+ gridRowEnd: t64,
7526
7646
  opacity: opacityCell
7527
- }, $[126] = opacityCell, $[127] = t61, $[128] = t62, $[129] = t63) : t63 = $[129];
7528
- let t64;
7529
- $[130] === error ? t64 = $[131] : (t64 = error && /* @__PURE__ */ jsx(Box, {
7647
+ }, $[130] = opacityCell, $[131] = t63, $[132] = t64, $[133] = t65) : t65 = $[133];
7648
+ let t66;
7649
+ $[134] === error ? t66 = $[135] : (t66 = error && /* @__PURE__ */ jsx(Box, {
7530
7650
  padding: 2,
7531
7651
  children: /* @__PURE__ */ jsx(Tooltip, {
7532
7652
  animate: !0,
@@ -7545,39 +7665,44 @@ const ContainerGrid$1 = /* @__PURE__ */ styled(Grid).withConfig({
7545
7665
  children: /* @__PURE__ */ jsx(StyledWarningIcon, { color: "critical" })
7546
7666
  })
7547
7667
  })
7548
- }), $[130] = error, $[131] = t64);
7549
- let t65;
7550
- $[132] !== t63 || $[133] !== t64 ? (t65 = /* @__PURE__ */ jsx(Flex, {
7668
+ }), $[134] = error, $[135] = t66);
7669
+ let t67;
7670
+ $[136] !== t65 || $[137] !== t66 ? (t67 = /* @__PURE__ */ jsx(Flex, {
7551
7671
  align: "center",
7552
7672
  justify: "center",
7553
- style: t63,
7554
- children: t64
7555
- }), $[132] = t63, $[133] = t64, $[134] = t65) : t65 = $[134];
7556
- let t66;
7557
- return $[135] !== item.updating || $[136] !== scheme || $[137] !== selected || $[138] !== t13 || $[139] !== t22 || $[140] !== t28 || $[141] !== t36 || $[142] !== t41 || $[143] !== t47 || $[144] !== t5 || $[145] !== t55 || $[146] !== t60 || $[147] !== t65 || $[148] !== t9 ? (t66 = /* @__PURE__ */ jsxs(ContainerGrid$1, {
7558
- onClick: t5,
7673
+ style: t65,
7674
+ children: t66
7675
+ }), $[136] = t65, $[137] = t66, $[138] = t67) : t67 = $[138];
7676
+ let t68;
7677
+ return $[139] !== draggable || $[140] !== item.updating || $[141] !== scheme || $[142] !== selected || $[143] !== t11 || $[144] !== t15 || $[145] !== t24 || $[146] !== t30 || $[147] !== t38 || $[148] !== t43 || $[149] !== t49 || $[150] !== t57 || $[151] !== t6 || $[152] !== t62 || $[153] !== t67 || $[154] !== t7 ? (t68 = /* @__PURE__ */ jsxs(ContainerGrid$1, {
7678
+ draggable,
7679
+ onClick: t6,
7680
+ onDragStart: t7,
7559
7681
  $scheme: scheme,
7560
7682
  $selected: selected,
7561
- style: t9,
7562
- $updating: t10,
7683
+ style: t11,
7684
+ $updating: t12,
7563
7685
  children: [
7564
- t13,
7565
- t22,
7566
- t28,
7567
- t36,
7568
- t41,
7569
- t47,
7570
- t55,
7571
- t60,
7572
- t65
7686
+ t15,
7687
+ t24,
7688
+ t30,
7689
+ t38,
7690
+ t43,
7691
+ t49,
7692
+ t57,
7693
+ t62,
7694
+ t67
7573
7695
  ]
7574
- }), $[135] = item.updating, $[136] = scheme, $[137] = selected, $[138] = t13, $[139] = t22, $[140] = t28, $[141] = t36, $[142] = t41, $[143] = t47, $[144] = t5, $[145] = t55, $[146] = t60, $[147] = t65, $[148] = t9, $[149] = t66) : t66 = $[149], t66;
7696
+ }), $[139] = draggable, $[140] = item.updating, $[141] = scheme, $[142] = selected, $[143] = t11, $[144] = t15, $[145] = t24, $[146] = t30, $[147] = t38, $[148] = t43, $[149] = t49, $[150] = t57, $[151] = t6, $[152] = t62, $[153] = t67, $[154] = t7, $[155] = t68) : t68 = $[155], t68;
7575
7697
  };
7576
7698
  var TableRowAsset_default = memo(TableRowAsset);
7577
7699
  function _temp$7(state) {
7578
7700
  return state.assets.lastPicked;
7579
7701
  }
7580
- function _temp2$5(t0) {
7702
+ function _temp2$5(pickedItem) {
7703
+ return pickedItem.asset._id;
7704
+ }
7705
+ function _temp3$4(t0) {
7581
7706
  let { isLoading, referringDocuments } = t0, uniqueDocuments = getUniqueDocuments(referringDocuments);
7582
7707
  return isLoading ? /* @__PURE__ */ jsx(Fragment, { children: "-" }) : /* @__PURE__ */ jsx(Fragment, { children: Array.isArray(uniqueDocuments) ? uniqueDocuments.length : 0 });
7583
7708
  }
@@ -7924,7 +8049,7 @@ function _temp3$3() {
7924
8049
  return /* @__PURE__ */ jsx(TableHeader, {});
7925
8050
  }
7926
8051
  const Items = () => {
7927
- let $ = c(15), dispatch = useDispatch(), fetchCount = useTypedSelector(_temp$5), fetching = useTypedSelector(_temp2$3), foldersPanelVisible = useTypedSelector(_temp3$2), tagsPanelVisible = useTypedSelector(_temp4), view = useTypedSelector(_temp5), combinedItems = useTypedSelector(selectCombinedItems), mediaIndex = useMediaIndex(), hasFetchedOnce = fetchCount >= 0, hasItems = combinedItems.length > 0, t0;
8052
+ let $ = c(15), dispatch = useDispatch(), fetchCount = useTypedSelector(_temp$5), fetching = useTypedSelector(_temp2$3), foldersPanelVisible = useTypedSelector(_temp3$2), tagsPanelVisible = useTypedSelector(_temp4$1), view = useTypedSelector(_temp5), combinedItems = useTypedSelector(selectCombinedItems), mediaIndex = useMediaIndex(), hasFetchedOnce = fetchCount >= 0, hasItems = combinedItems.length > 0, t0;
7928
8053
  $[0] !== dispatch || $[1] !== fetching ? (t0 = () => {
7929
8054
  fetching || dispatch(assetsActions.loadNextPage());
7930
8055
  }, $[0] = dispatch, $[1] = fetching, $[2] = t0) : t0 = $[2];
@@ -7968,7 +8093,7 @@ function _temp2$3(state_0) {
7968
8093
  function _temp3$2(state_1) {
7969
8094
  return state_1.folders.panelVisible;
7970
8095
  }
7971
- function _temp4(state_2) {
8096
+ function _temp4$1(state_2) {
7972
8097
  return state_2.tags.panelVisible;
7973
8098
  }
7974
8099
  function _temp5(state_3) {
@@ -8317,26 +8442,27 @@ function createTagHandler(dispatch) {
8317
8442
  };
8318
8443
  }
8319
8444
  function useBrowserInit(client, schemaType) {
8320
- let $ = c(16), dispatch = useDispatch(), tagsByIds = useSelector(_temp$1), tagsFetchCount = useSelector(_temp2), t0;
8445
+ let $ = c(17), dispatch = useDispatch(), tagsByIds = useSelector(_temp$1), tagsFetchCount = useSelector(_temp2), showMediaLibraryAssets = useSelector(_temp3), t0;
8321
8446
  $[0] === schemaType ? t0 = $[1] : (t0 = getMediaTagNames(schemaType), $[0] = schemaType, $[1] = t0);
8322
8447
  let tagNames = t0, hasMediaTags = tagNames.length > 0, t1, t2;
8323
- $[2] !== client || $[3] !== dispatch || $[4] !== hasMediaTags ? (t1 = () => {
8448
+ $[2] !== client || $[3] !== dispatch || $[4] !== hasMediaTags || $[5] !== showMediaLibraryAssets ? (t1 = () => {
8324
8449
  hasMediaTags || dispatch(searchActions.facetsClear()), dispatch(tagsActions.fetchRequest()), dispatch(foldersActions.fetchRequest());
8325
- let assetSubscription = client.listen(groq`*[_type in ["sanity.fileAsset", "sanity.imageAsset"] && !(_id in path("drafts.**"))]`).subscribe(createAssetHandler(dispatch)), tagSubscription = client.listen(groq`*[_type == "${TAG_DOCUMENT_NAME}" && !(_id in path("drafts.**"))]`).subscribe(createTagHandler(dispatch)), folderSubscription = client.listen(groq`*[_type == "${FOLDER_DOCUMENT_NAME}" && !(_id in path("drafts.**"))]`).subscribe(() => dispatch(foldersActions.fetchRequest()));
8450
+ let excludeMediaLibraryFragment = buildExcludeMediaLibraryFragment(showMediaLibraryAssets), excludeMediaLibraryClause = excludeMediaLibraryFragment ? ` && ${excludeMediaLibraryFragment}` : "", assetSubscription = client.listen(groq`*[_type in ["sanity.fileAsset", "sanity.imageAsset"] && !(_id in path("drafts.**"))${excludeMediaLibraryClause}]`).subscribe(createAssetHandler(dispatch)), tagSubscription = client.listen(groq`*[_type == "${TAG_DOCUMENT_NAME}" && !(_id in path("drafts.**"))]`).subscribe(createTagHandler(dispatch)), folderSubscription = client.listen(groq`*[_type == "${FOLDER_DOCUMENT_NAME}" && !(_id in path("drafts.**"))]`).subscribe(() => dispatch(foldersActions.fetchRequest()));
8326
8451
  return () => {
8327
8452
  assetSubscription.unsubscribe(), tagSubscription.unsubscribe(), folderSubscription.unsubscribe();
8328
8453
  };
8329
8454
  }, t2 = [
8330
8455
  client,
8331
8456
  dispatch,
8332
- hasMediaTags
8333
- ], $[2] = client, $[3] = dispatch, $[4] = hasMediaTags, $[5] = t1, $[6] = t2) : (t1 = $[5], t2 = $[6]), useEffect(t1, t2);
8457
+ hasMediaTags,
8458
+ showMediaLibraryAssets
8459
+ ], $[2] = client, $[3] = dispatch, $[4] = hasMediaTags, $[5] = showMediaLibraryAssets, $[6] = t1, $[7] = t2) : (t1 = $[6], t2 = $[7]), useEffect(t1, t2);
8334
8460
  let t3;
8335
- $[7] !== dispatch || $[8] !== hasMediaTags || $[9] !== tagNames || $[10] !== tagsByIds || $[11] !== tagsFetchCount ? (t3 = () => {
8461
+ $[8] !== dispatch || $[9] !== hasMediaTags || $[10] !== tagNames || $[11] !== tagsByIds || $[12] !== tagsFetchCount ? (t3 = () => {
8336
8462
  if (!hasMediaTags || tagsFetchCount < 0) return;
8337
8463
  let tagFacetInput = inputs.tag;
8338
8464
  if (tagFacetInput.type !== "searchable") return;
8339
- let resolvedTags = tagNames.map((name) => Object.values(tagsByIds).find((item) => item.tag.name.current === name)).filter(_temp3);
8465
+ let resolvedTags = tagNames.map((name) => Object.values(tagsByIds).find((item) => item.tag.name.current === name)).filter(_temp4);
8340
8466
  dispatch(searchActions.facetsClear());
8341
8467
  for (let tagItem of resolvedTags) dispatch(searchActions.facetsAdd({ facet: {
8342
8468
  ...tagFacetInput,
@@ -8346,13 +8472,16 @@ function useBrowserInit(client, schemaType) {
8346
8472
  value: tagItem.tag._id
8347
8473
  }
8348
8474
  } }));
8349
- }, $[7] = dispatch, $[8] = hasMediaTags, $[9] = tagNames, $[10] = tagsByIds, $[11] = tagsFetchCount, $[12] = t3) : t3 = $[12];
8475
+ }, $[8] = dispatch, $[9] = hasMediaTags, $[10] = tagNames, $[11] = tagsByIds, $[12] = tagsFetchCount, $[13] = t3) : t3 = $[13];
8350
8476
  let t4;
8351
- $[13] !== hasMediaTags || $[14] !== tagsFetchCount ? (t4 = [tagsFetchCount, hasMediaTags], $[13] = hasMediaTags, $[14] = tagsFetchCount, $[15] = t4) : t4 = $[15], useEffect(t3, t4);
8477
+ $[14] !== hasMediaTags || $[15] !== tagsFetchCount ? (t4 = [tagsFetchCount, hasMediaTags], $[14] = hasMediaTags, $[15] = tagsFetchCount, $[16] = t4) : t4 = $[16], useEffect(t3, t4);
8352
8478
  }
8353
- function _temp3(item_0) {
8479
+ function _temp4(item_0) {
8354
8480
  return !!item_0;
8355
8481
  }
8482
+ function _temp3(state_1) {
8483
+ return state_1.assets.showMediaLibraryAssets;
8484
+ }
8356
8485
  function _temp2(state_0) {
8357
8486
  return state_0.tags.fetchCount;
8358
8487
  }
@@ -8413,7 +8542,7 @@ const BrowserContent = (t0) => {
8413
8542
  children: t9
8414
8543
  }), $[11] = portalElement, $[12] = t9, $[13] = t10) : t10 = $[13], t10;
8415
8544
  }, Browser = (props) => {
8416
- let $ = c(15), client = useVersionedClient(), { excludeTagSlugs } = useToolOptions(), t0 = props?.assetType, t1 = props?.document, t2 = props?.selectedAssets, t3 = props?.isMultiSelect, t4 = props?.onSelect, t5;
8545
+ let $ = c(16), client = useVersionedClient(), { excludeTagSlugs, showMediaLibraryAssets } = useToolOptions(), t0 = props?.assetType, t1 = props?.document, t2 = props?.selectedAssets, t3 = props?.isMultiSelect, t4 = props?.onSelect, t5;
8417
8546
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t5 = /* @__PURE__ */ jsx(GlobalStyle, {}), $[0] = t5) : t5 = $[0];
8418
8547
  let t6 = props?.onClose, t7 = props?.schemaType, t8;
8419
8548
  $[1] !== t6 || $[2] !== t7 ? (t8 = /* @__PURE__ */ jsx(BrowserContent, {
@@ -8427,14 +8556,15 @@ const BrowserContent = (t0) => {
8427
8556
  children: [t5, t8]
8428
8557
  }), $[4] = t3, $[5] = t4, $[6] = t8, $[7] = t9) : t9 = $[7];
8429
8558
  let t10;
8430
- return $[8] !== client || $[9] !== excludeTagSlugs || $[10] !== t0 || $[11] !== t1 || $[12] !== t2 || $[13] !== t9 ? (t10 = /* @__PURE__ */ jsx(ReduxProvider, {
8559
+ return $[8] !== client || $[9] !== excludeTagSlugs || $[10] !== showMediaLibraryAssets || $[11] !== t0 || $[12] !== t1 || $[13] !== t2 || $[14] !== t9 ? (t10 = /* @__PURE__ */ jsx(ReduxProvider, {
8431
8560
  assetType: t0,
8432
8561
  client,
8433
8562
  document: t1,
8434
8563
  excludeTagSlugs,
8435
8564
  selectedAssets: t2,
8565
+ showMediaLibraryAssets,
8436
8566
  children: t9
8437
- }), $[8] = client, $[9] = excludeTagSlugs, $[10] = t0, $[11] = t1, $[12] = t2, $[13] = t9, $[14] = t10) : t10 = $[14], t10;
8567
+ }), $[8] = client, $[9] = excludeTagSlugs, $[10] = showMediaLibraryAssets, $[11] = t0, $[12] = t1, $[13] = t2, $[14] = t9, $[15] = t10) : t10 = $[15], t10;
8438
8568
  }, FormBuilderTool = (props) => {
8439
8569
  let $ = c(13), { onClose } = props, portalElement = useRootPortalElement(), t0;
8440
8570
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [], $[0] = t0) : t0 = $[0];