sanity-plugin-media
6.1.56.1.6
dist/index.js~
dist/index.jsModified+192−177
Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -74,14 +74,14 @@
let context = useContext(AssetSourceDispatchContext);
if (context === void 0) throw Error("useAssetSourceActions must be used within an AssetSourceDispatchProvider");
return context;
}, useRootPortalElement = () => {
- let $ = c(3), [container] = useState(_temp$37), t0, t1;
+ let $ = c(3), [container] = useState(_temp$38), t0, t1;
return $[0] === container ? (t0 = $[1], t1 = $[2]) : (t0 = () => (container.classList.add("media-portal"), document.body.appendChild(container), () => {
document.body.removeChild(container);
}), t1 = [container], $[0] = container, $[1] = t0, $[2] = t1), useEffect(t0, t1), container;
};
-function _temp$37() {
+function _temp$38() {
return document.createElement("div");
}
const useTypedSelector = useSelector, useVersionedClient = () => {
let $ = c(1), t0;
@@ -2109,9 +2109,9 @@
})
}), $[2] = doc, $[3] = onClick, $[4] = schemaType, $[5] = t1) : t1 = $[5], t1;
}, Container$2 = /* @__PURE__ */ styled(Box).withConfig({
displayName: "Container",
- componentId: "sc-ov4bwf-0"
+ componentId: "sc-91y0jf-0"
})(({ theme }) => css`text{font-family:${theme.sanity.fonts.text.family} !important;font-size:8px !important;font-weight:500 !important;}`), FileIcon$1 = (props) => {
let $ = c(11), { extension, onClick, width } = props, t0;
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { height: "100%" }, $[0] = t0) : t0 = $[0];
let t1;
@@ -2255,12 +2255,12 @@
return SCHEME_COLORS[colorKey]?.[scheme];
}
const Image$1 = styled.img.attrs({ crossOrigin: "anonymous" }).withConfig({
displayName: "Image",
- componentId: "sc-nu8r0m-0"
+ componentId: "sc-ms5kkw-0"
})`--checkerboard-color:${(props) => props.$scheme ? getSchemeColor(props.$scheme, "bg2") : "inherit"};display:block;width:100%;height:100%;object-fit:contain;${(props) => props.$showCheckerboard && css`background-image:linear-gradient(45deg,var(--checkerboard-color) 25%,transparent 25%),linear-gradient(-45deg,var(--checkerboard-color) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--checkerboard-color) 75%),linear-gradient(-45deg,transparent 75%,var(--checkerboard-color) 75%);background-size:20px 20px;background-position:0 0,0 10px,10px -10px,-10px 0;`}`, StyledErrorOutlineIcon = /* @__PURE__ */ styled(ErrorOutlineIcon).withConfig({
displayName: "StyledErrorOutlineIcon",
- componentId: "sc-ec70oi-0"
+ componentId: "sc-3yqi4g-0"
})(({ theme }) => ({ color: theme.sanity.color.spot.red })), FormFieldInputLabel = (props) => {
let $ = c(14), { description, error, label, name } = props, t0;
$[0] !== label || $[1] !== name ? (t0 = /* @__PURE__ */ jsx(Text, {
as: "label",
@@ -2476,9 +2476,9 @@
MultiValueLabel,
MultiValueRemove,
Option: Option$1
}, FormFieldInputTags = (props) => {
- let $ = c(23), { control, description, disabled, error, label, name, onCreateTag, options, placeholder, value } = props, scheme = useColorSchemeValue(), creating = useTypedSelector(_temp$36), tagsFetching = useTypedSelector(_temp2$22), t0;
+ let $ = c(23), { control, description, disabled, error, label, name, onCreateTag, options, placeholder, value } = props, scheme = useColorSchemeValue(), creating = useTypedSelector(_temp$37), tagsFetching = useTypedSelector(_temp2$23), t0;
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { zIndex: 2 }, $[0] = t0) : t0 = $[0];
let t1;
$[1] !== description || $[2] !== error || $[3] !== label || $[4] !== name ? (t1 = /* @__PURE__ */ jsx(FormFieldInputLabel, {
description,
@@ -2496,9 +2496,9 @@
isDisabled: creating || disabled || tagsFetching,
isLoading: creating,
isMulti: !0,
name,
- noOptionsMessage: _temp3$10,
+ noOptionsMessage: _temp3$11,
onBlur,
onChange,
onCreateOption: onCreateTag,
options,
@@ -2519,15 +2519,15 @@
style: t0,
children: [t1, t3]
}), $[20] = t1, $[21] = t3, $[22] = t4) : t4 = $[22], t4;
};
-function _temp$36(state) {
+function _temp$37(state) {
return state.tags.creating;
}
-function _temp2$22(state_0) {
+function _temp2$23(state_0) {
return state_0.tags.fetching;
}
-function _temp3$10() {
+function _temp3$11() {
return "No tags";
}
const FormFieldInputText = (props) => {
let $ = c(29), description, disabled, error, label, name, onBlur, onChange, placeholder, ref, rest, value;
@@ -2685,47 +2685,47 @@
selected: activeLocaleTab === idx,
onClick: () => setActiveLocaleTab(idx),
label: locale.title
}, locale.id))
- }), locales.map((locale_0, idx_0) => /* @__PURE__ */ jsx(TabPanel, {
- id: `locale-panel-${locale_0.id}`,
- "aria-labelledby": `locale-tab-${locale_0.id}`,
- hidden: activeLocaleTab !== idx_0,
+ }), locales.map((locale, idx) => /* @__PURE__ */ jsx(TabPanel, {
+ id: `locale-panel-${locale.id}`,
+ "aria-labelledby": `locale-tab-${locale.id}`,
+ hidden: activeLocaleTab !== idx,
children: /* @__PURE__ */ jsxs(Stack, {
gap: 3,
children: [
/* @__PURE__ */ jsx(FormFieldInputText, {
- ...register(`title.${locale_0.id}`),
+ ...register(`title.${locale.id}`),
disabled: formUpdating,
- error: (errors?.title)?.[locale_0.id]?.message,
+ error: (errors?.title)?.[locale.id]?.message,
label: "Title",
- name: `title.${locale_0.id}`
+ name: `title.${locale.id}`
}),
/* @__PURE__ */ jsx(FormFieldInputText, {
- ...register(`altText.${locale_0.id}`),
+ ...register(`altText.${locale.id}`),
disabled: formUpdating,
- error: (errors?.altText)?.[locale_0.id]?.message,
+ error: (errors?.altText)?.[locale.id]?.message,
label: "Alt Text",
- name: `altText.${locale_0.id}`
+ name: `altText.${locale.id}`
}),
/* @__PURE__ */ jsx(FormFieldInputTextarea, {
- ...register(`description.${locale_0.id}`),
+ ...register(`description.${locale.id}`),
disabled: formUpdating,
- error: (errors?.description)?.[locale_0.id]?.message,
+ error: (errors?.description)?.[locale.id]?.message,
label: "Description",
- name: `description.${locale_0.id}`,
+ name: `description.${locale.id}`,
rows: 5
}),
creditLine?.enabled && /* @__PURE__ */ jsx(FormFieldInputText, {
- ...register(`creditLine.${locale_0.id}`),
- error: (errors?.creditLine)?.[locale_0.id]?.message,
+ ...register(`creditLine.${locale.id}`),
+ error: (errors?.creditLine)?.[locale.id]?.message,
label: "Credit",
- name: `creditLine.${locale_0.id}`,
+ name: `creditLine.${locale.id}`,
disabled: formUpdating || creditLine?.excludeSources?.includes(currentAsset?.source?.name)
})
]
})
- }, locale_0.id))]
+ }, locale.id))]
})
}) : /* @__PURE__ */ jsxs(Fragment, { children: [
/* @__PURE__ */ jsx(FormFieldInputText, {
...register("title"),
@@ -2801,9 +2801,9 @@
opt: { media: { tags: assetTagOptions } },
title: makeLocaleObj(asset?.title)
};
}
- let flattenField = _temp2$21;
+ let flattenField = _temp2$22;
return {
altText: flattenField(asset?.altText),
creditLine: flattenField(asset?.creditLine),
description: flattenField(asset?.description, imageDescription),
@@ -2867,9 +2867,9 @@
if (!currentAsset) {
t19 = !1;
break bb0;
}
- let isLocaleObj = _temp3$9, fields = [
+ let isLocaleObj = _temp3$10, fields = [
currentAsset.title,
currentAsset.altText,
currentAsset.description,
...currentAsset._type === "sanity.imageAsset" ? [currentAsset.creditLine] : []
@@ -3179,16 +3179,16 @@
width: 3,
children: [t52, children]
}), $[144] = children, $[145] = footer, $[146] = handleClose, $[147] = id, $[148] = t52, $[149] = t53) : t53 = $[149], t53;
};
-function _temp$35(v) {
+function _temp$36(v) {
return v;
}
-function _temp2$21(field_0, t0) {
+function _temp2$22(field_0, t0) {
let fallback_0 = t0 === void 0 ? "" : t0;
- return typeof field_0 == "string" ? field_0 : typeof field_0 == "object" && field_0 && Object.values(field_0).find(_temp$35) || fallback_0;
+ return typeof field_0 == "string" ? field_0 : typeof field_0 == "object" && field_0 && Object.values(field_0).find(_temp$36) || fallback_0;
}
-function _temp3$9(v_0) {
+function _temp3$10(v_0) {
return typeof v_0 == "object" && !!v_0 && !Array.isArray(v_0);
}
function _temp4$5(l) {
return l.id;
@@ -3244,25 +3244,25 @@
window.removeEventListener("keydown", downHandler), window.removeEventListener("keyup", upHandler);
}), t3 = [downHandler, upHandler], $[4] = downHandler, $[5] = t2, $[6] = t3), useEffect(t2, t3), keyPressed;
}, CardWrapper$2 = styled(Flex).withConfig({
displayName: "CardWrapper",
- componentId: "sc-e6odx5-0"
+ componentId: "sc-paw993-0"
})`box-sizing:border-box;height:100%;overflow:hidden;position:relative;width:100%;`, CardContainer = /* @__PURE__ */ styled(Flex).withConfig({
displayName: "CardContainer",
- componentId: "sc-e6odx5-1"
+ componentId: "sc-paw993-1"
})(({ $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({
displayName: "ContextActionContainer",
- componentId: "sc-e6odx5-2"
+ componentId: "sc-paw993-2"
})(({ $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({
displayName: "StyledWarningOutlineIcon",
- componentId: "sc-e6odx5-3"
+ componentId: "sc-paw993-3"
})(({ theme }) => ({ color: theme.sanity.color.spot.red })), CardAsset = (props) => {
- let $ = c(83), { id, selected, source } = props, scheme = useColorSchemeValue(), toast = useToast(), shiftPressed = useKeyPress("shift"), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$34), assetsPicked = useTypedSelector(selectAssetsPicked), t0;
+ let $ = c(83), { id, selected, source } = props, scheme = useColorSchemeValue(), toast = useToast(), shiftPressed = useKeyPress("shift"), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$35), assetsPicked = useTypedSelector(selectAssetsPicked), t0;
$[0] === id ? t0 = $[1] : (t0 = (state_0) => selectAssetById(state_0, id), $[0] = id, $[1] = t0);
let item = useTypedSelector(t0), t1;
$[2] === source ? t1 = $[3] : (t1 = (state_1) => {
if (source !== "replace-asset") return;
- let dialog = state_1.dialog.items.find(_temp2$20);
+ let dialog = state_1.dialog.items.find(_temp2$21);
return dialog?.type === "dialogAllAssets" ? dialog.assetId : void 0;
}, $[2] = source, $[3] = t1);
let dialogReplaceAssetId = useTypedSelector(t1), asset = item?.asset, error = item?.error, isOpaque = item?.asset?.metadata?.isOpaque, picked = item?.picked, updating = item?.updating, assetToReplaceId = dialogReplaceAssetId ?? (source === "replace-asset" && assetsPicked.length === 1 ? assetsPicked[0]?.asset._id : void 0), t2;
$[4] === assetToReplaceId ? t2 = $[5] : (t2 = (state_2) => assetToReplaceId ? selectAssetById(state_2, assetToReplaceId) : void 0, $[4] = assetToReplaceId, $[5] = t2);
@@ -3466,23 +3466,23 @@
})
}), $[77] = item.updating, $[78] = picked, $[79] = t15, $[80] = t19, $[81] = t20, $[82] = t21) : t21 = $[82], t21;
};
var CardAsset_default = memo(CardAsset);
-function _temp$34(state) {
+function _temp$35(state) {
return state.assets.lastPicked;
}
-function _temp2$20(d) {
+function _temp2$21(d) {
return d.type === "dialogAllAssets";
}
const CardWrapper$1 = styled(Flex).withConfig({
displayName: "CardWrapper",
- componentId: "sc-l04v0k-0"
+ componentId: "sc-52xpdk-0"
})`box-sizing:border-box;height:100%;overflow:hidden;position:relative;width:100%;`, FolderCard = styled(Card).withConfig({
displayName: "FolderCard",
- componentId: "sc-l04v0k-1"
+ componentId: "sc-52xpdk-1"
})`cursor:pointer;height:100%;transition:border-color 200ms ease;width:100%;@media (hover:hover) and (pointer:fine){&:hover{border-color:var(--card-border-color);}}`, FolderGlyph = /* @__PURE__ */ styled(Box).withConfig({
displayName: "FolderGlyph",
- componentId: "sc-l04v0k-2"
+ componentId: "sc-52xpdk-2"
})(({ theme }) => css`align-items:flex-end;background:linear-gradient( 180deg,${theme.sanity.color.spot.yellow} 0%,${theme.sanity.color.spot.yellow} 100% );border-radius:8px;display:flex;height:72px;position:relative;width:96px;&::before{background:${theme.sanity.color.spot.yellow};border-radius:8px 8px 0 0;content:'';height:18px;left:0;position:absolute;top:-8px;width:38px;}`), CardFolder = (t0) => {
let $ = c(22), { folderId, name, totalCount } = t0, dispatch = useDispatch(), scheme = useColorSchemeValue(), t1;
$[0] !== dispatch || $[1] !== folderId ? (t1 = () => dispatch(foldersActions.currentFolderSet({ folderId })), $[0] = dispatch, $[1] = folderId, $[2] = t1) : t1 = $[2];
let t2;
@@ -3723,9 +3723,9 @@
})), selectUploadById = createSelector([(state) => state.uploads.byIds, (_state, uploadId) => uploadId], (byIds, uploadId) => byIds[uploadId]), uploadsActions = { ...uploadsSlice.actions };
var uploads_default = uploadsSlice.reducer;
const CardWrapper = styled(Flex).withConfig({
displayName: "CardWrapper",
- componentId: "sc-wucbwn-0"
+ componentId: "sc-2pwgvh-0"
})`box-sizing:border-box;height:100%;overflow:hidden;position:relative;width:100%;`, CardUpload = (props) => {
let $ = c(43), { id } = props, scheme = useColorSchemeValue(), dispatch = useDispatch(), t0;
$[0] === id ? t0 = $[1] : (t0 = (state) => selectUploadById(state, id), $[0] = id, $[1] = t0);
let item = useTypedSelector(t0);
@@ -3886,9 +3886,9 @@
}
return null;
}), StyledItemContainer = styled.div.withConfig({
displayName: "StyledItemContainer",
- componentId: "sc-oxt31n-0"
+ componentId: "sc-2rsg9t-0"
})`height:${220}px;width:${240}px;`, ItemContainer = (props) => {
let $ = c(6), ref, rest;
if ($[0] !== props) {
let { context, ref: t0, ...t1 } = props;
@@ -3900,9 +3900,9 @@
...rest
}), $[3] = ref, $[4] = rest, $[5] = t0) : t0 = $[5], t0;
}, StyledListContainer = styled.div.withConfig({
displayName: "StyledListContainer",
- componentId: "sc-oxt31n-1"
+ componentId: "sc-2rsg9t-1"
})`display:grid;grid-template-columns:repeat(auto-fill,${240}px);grid-template-rows:repeat(auto-fill,${220}px);justify-content:center;margin:0 auto;`, ListContainer = (props) => {
let $ = c(6), ref, rest;
if ($[0] !== props) {
let { context, ref: t0, ...t1 } = props;
@@ -3913,10 +3913,10 @@
ref,
...rest
}), $[3] = ref, $[4] = rest, $[5] = t0) : t0 = $[5], t0;
}, AssetGridVirtualized = (props) => {
- let $ = c(15), { items, onLoadMore, source } = props, selectedAssets = useTypedSelector(_temp$33), t0;
- $[0] === selectedAssets ? t0 = $[1] : (t0 = selectedAssets && selectedAssets.map(_temp2$19) || [], $[0] = selectedAssets, $[1] = t0);
+ let $ = c(15), { items, onLoadMore, source } = props, selectedAssets = useTypedSelector(_temp$34), t0;
+ $[0] === selectedAssets ? t0 = $[1] : (t0 = selectedAssets && selectedAssets.map(_temp2$20) || [], $[0] = selectedAssets, $[1] = t0);
let selectedIds = t0, totalCount = items?.length;
if (totalCount === 0) return null;
let t1;
$[2] === items ? t1 = $[3] : (t1 = (index) => items[index]?.id ?? index, $[2] = items, $[3] = t1);
@@ -3950,24 +3950,24 @@
style: t4,
totalCount
}), $[10] = onLoadMore, $[11] = t1, $[12] = t3, $[13] = totalCount, $[14] = t5) : t5 = $[14], t5;
};
-function _temp$33(state) {
+function _temp$34(state) {
return state.selected.assets;
}
-function _temp2$19(asset) {
+function _temp2$20(asset) {
return asset._id;
}
function omitFacetId(facet) {
let { id: _id, ...withoutId } = facet;
return withoutId;
}
const ReplaceAssetsOverview = () => {
- let $ = c(36), dispatch = useDispatch(), store = useStore(), combinedItems = useTypedSelector(selectCombinedItems), assetsById = useTypedSelector(_temp$32), fetchCount = useTypedSelector(_temp2$18), fetching = useTypedSelector(_temp3$8), fetchingError = useTypedSelector(_temp4$4), pageSize = useTypedSelector(_temp5$3), searchQuery = useTypedSelector(_temp6$1), searchFacets = useTypedSelector(_temp7), currentFolderId = useTypedSelector(_temp8), currentFolderUnfiled = useTypedSelector(_temp9), assetToReplaceId = useTypedSelector(_temp1), savedBrowserStateRef = useRef(null), t0;
+ 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;
$[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];
let [awaitingRefetch, setAwaitingRefetch] = useState(t0), t1, t2;
$[5] !== dispatch || $[6] !== store ? (t1 = () => {
- let { dialog: dialog_0, folders, search } = store.getState(), { query, facets } = search, dialogItem = dialog_0.items.find(_temp10);
+ let { dialog: dialog_0, folders, search } = store.getState(), { query, facets } = search, dialogItem = dialog_0.items.find(_temp12);
return savedBrowserStateRef.current = {
assetId: dialogItem?.type === "dialogAllAssets" ? dialogItem.assetId : void 0,
query,
facets,
@@ -4042,15 +4042,15 @@
})
})
}), $[32] = handleLoadMoreItems, $[33] = isEmpty, $[34] = reducedItems, $[35] = t9) : t9 = $[35], t9;
};
-function _temp$32(state) {
+function _temp$33(state) {
return state.assets.byIds;
}
-function _temp2$18(state_0) {
+function _temp2$19(state_0) {
return state_0.assets.fetchCount;
}
-function _temp3$8(state_1) {
+function _temp3$9(state_1) {
return state_1.assets.fetching;
}
function _temp4$4(state_2) {
return state_2.assets.fetchingError;
@@ -4069,16 +4069,16 @@
}
function _temp9(state_7) {
return state_7.folders.currentFolderUnfiled;
}
-function _temp0(item) {
+function _temp10(item) {
return item.type === "dialogAllAssets";
}
-function _temp1(state_8) {
- let dialog = state_8.dialog.items.find(_temp0);
+function _temp11(state_8) {
+ let dialog = state_8.dialog.items.find(_temp10);
return dialog?.type === "dialogAllAssets" ? dialog.assetId : void 0;
}
-function _temp10(item_0) {
+function _temp12(item_0) {
return item_0.type === "dialogAllAssets";
}
const DialogAllAssets = (props) => {
let $ = c(7), { children, dialog: t0 } = props, { id } = t0, dispatch = useDispatch(), t1;
@@ -4171,9 +4171,9 @@
width: 1,
children: [t8, children]
}), $[25] = children, $[26] = handleClose, $[27] = t4, $[28] = t5, $[29] = t8, $[30] = t9) : t9 = $[30], t9;
}, DialogFolderCreate = (props) => {
- let $ = c(43), { children, dialog: t0 } = props, { parentFolderId, id } = t0, dispatch = useDispatch(), creating = useTypedSelector(_temp$31), creatingError = useTypedSelector(_temp2$17), t1;
+ let $ = c(43), { children, dialog: t0 } = props, { parentFolderId, id } = t0, dispatch = useDispatch(), creating = useTypedSelector(_temp$32), creatingError = useTypedSelector(_temp2$18), t1;
$[0] === parentFolderId ? t1 = $[1] : (t1 = (state_1) => selectFolderPathById(state_1, parentFolderId), $[0] = parentFolderId, $[1] = t1);
let parentPath = useTypedSelector(t1), t2;
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = { name: "" }, $[2] = t2) : t2 = $[2];
let t3;
@@ -4260,12 +4260,12 @@
width: 1,
children: [t17, children]
}), $[37] = children, $[38] = handleClose, $[39] = id, $[40] = t10, $[41] = t17, $[42] = t18) : t18 = $[42], t18;
};
-function _temp$31(state) {
+function _temp$32(state) {
return state.folders.creating;
}
-function _temp2$17(state_0) {
+function _temp2$18(state_0) {
return state_0.folders.creatingError;
}
const getExpandedIdSet$1 = (folderId, byId) => {
let expanded = /* @__PURE__ */ new Set(), cursor = folderId;
@@ -4313,9 +4313,9 @@
gap: 1,
children: t1
}), $[9] = t1, $[10] = t2), t2;
}, DialogFolderMove = (t0) => {
- let $ = c(49), { children, dialog } = t0, dispatch = useDispatch(), folderTree = useTypedSelector(selectFolderTree), byId = useTypedSelector(_temp$30), { assets, folderId, id } = dialog, [selectedId, setSelectedId] = useState(folderId || null), selectedFolder = selectedId ? byId[selectedId] : null, t1 = folderId || null, t2;
+ let $ = c(49), { children, dialog } = t0, dispatch = useDispatch(), folderTree = useTypedSelector(selectFolderTree), byId = useTypedSelector(_temp$31), { assets, folderId, id } = dialog, [selectedId, setSelectedId] = useState(folderId || null), selectedFolder = selectedId ? byId[selectedId] : null, t1 = folderId || null, t2;
$[0] !== byId || $[1] !== t1 ? (t2 = getExpandedIdSet$1(t1, byId), $[0] = byId, $[1] = t1, $[2] = t2) : t2 = $[2];
let expandedIds = t2, t3;
$[3] !== dispatch || $[4] !== id ? (t3 = () => {
dispatch(dialogActions.remove({ id }));
@@ -4426,13 +4426,13 @@
width: 1,
children: [t20, children]
}), $[43] = children, $[44] = handleClose, $[45] = id, $[46] = t11, $[47] = t20, $[48] = t21) : t21 = $[48], t21;
};
-function _temp$30(state) {
+function _temp$31(state) {
return state.folders.byId;
}
const DialogFolderRename = (t0) => {
- let $ = c(50), { children, dialog } = t0, { folderId, id } = dialog, dispatch = useDispatch(), renaming = useTypedSelector(_temp$29), renameError = useTypedSelector(_temp2$16), t1;
+ let $ = c(50), { children, dialog } = t0, { folderId, id } = dialog, dispatch = useDispatch(), renaming = useTypedSelector(_temp$30), renameError = useTypedSelector(_temp2$17), t1;
$[0] === folderId ? t1 = $[1] : (t1 = (state_1) => state_1.folders.byId[folderId], $[0] = folderId, $[1] = t1);
let folder = useTypedSelector(t1), t2;
$[2] === folderId ? t2 = $[3] : (t2 = (state_2) => selectFolderPathById(state_2, folderId), $[2] = folderId, $[3] = t2);
let folderPath = useTypedSelector(t2), currentName = folder?.name || "", t3;
@@ -4525,12 +4525,12 @@
width: 1,
children: [t22, children]
}), $[44] = children, $[45] = handleClose, $[46] = id, $[47] = t14, $[48] = t22, $[49] = t23) : t23 = $[49], t23;
};
-function _temp$29(state) {
+function _temp$30(state) {
return state.folders.renaming;
}
-function _temp2$16(state_0) {
+function _temp2$17(state_0) {
return state_0.folders.renameError;
}
const getExpandedIdSet = (folderId, byId) => {
let expanded = /* @__PURE__ */ new Set(), cursor = folderId;
@@ -4657,9 +4657,9 @@
weight: t4,
children: t5
}), $[15] = node.id, $[16] = selected, $[17] = t1, $[18] = t2, $[19] = t3, $[20] = t4, $[21] = t5, $[22] = t6) : t6 = $[22], t6;
}, FolderView = () => {
- let $ = c(63), dispatch = useDispatch(), currentFolderId = useTypedSelector(_temp$28), byId = useTypedSelector(_temp2$15), canDeleteFolder = useTypedSelector(selectCanDeleteFolder), fetching = useTypedSelector(_temp3$7), folderTree = useTypedSelector(selectFolderTree), currentFolder = currentFolderId ? byId[currentFolderId] : null, t0;
+ 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;
$[0] !== byId || $[1] !== currentFolderId ? (t0 = getExpandedIdSet(currentFolderId, byId), $[0] = byId, $[1] = currentFolderId, $[2] = t0) : t0 = $[2];
let expandedIds = t0, t1;
$[3] === expandedIds ? t1 = $[4] : (t1 = Array.from(expandedIds).join("|") || "root", $[3] = expandedIds, $[4] = t1);
let treeKey = t1, hasFolders = folderTree.length > 0, t2;
@@ -4785,15 +4785,15 @@
height: "fill",
children: [t13, t21]
}), $[60] = t13, $[61] = t21, $[62] = t22) : t22 = $[62], t22;
};
-function _temp$28(state) {
+function _temp$29(state) {
return state.folders.currentFolderId;
}
-function _temp2$15(state_0) {
+function _temp2$16(state_0) {
return state_0.folders.byId;
}
-function _temp3$7(state_1) {
+function _temp3$8(state_1) {
return state_1.folders.fetching;
}
const DialogFolders = (props) => {
let $ = c(7), { children, dialog: t0 } = props, { id } = t0, dispatch = useDispatch(), t1;
@@ -4818,9 +4818,9 @@
children: [t2, children]
}), $[3] = children, $[4] = handleClose, $[5] = id, $[6] = t3) : t3 = $[6], t3;
}, Container$1 = /* @__PURE__ */ styled(Box).withConfig({
displayName: "Container",
- componentId: "sc-iuc26f-0"
+ componentId: "sc-ash7y6-0"
})(({ $scheme, theme }) => css`background:${getSchemeColor($scheme, "bg")};border-radius:${rem(theme.sanity.radius[2])};`), SearchFacet = (props) => {
let $ = c(22), { children, facet } = props, scheme = useColorSchemeValue(), dispatch = useDispatch(), t0;
$[0] !== dispatch || $[1] !== facet.id ? (t0 = () => {
dispatch(searchActions.facetsRemoveById({ facetId: facet.id }));
@@ -5287,11 +5287,11 @@
NoOptionsMessage,
Option,
SingleValue
}, SearchFacetTags = (t0) => {
- let $ = c(27), { facet } = t0, scheme = useColorSchemeValue(), dispatch = useDispatch(), { excludeTagSlugs } = useToolOptions(), tagsAll = useTypedSelector(_temp$27), t1;
+ let $ = c(27), { facet } = t0, scheme = useColorSchemeValue(), dispatch = useDispatch(), { excludeTagSlugs } = useToolOptions(), tagsAll = useTypedSelector(_temp$28), t1;
$[0] !== excludeTagSlugs || $[1] !== tagsAll ? (t1 = excludeTagSlugs.length > 0 ? tagsAll.filter((t) => !excludeTagSlugs.includes(t.tag.name.current)) : tagsAll, $[0] = excludeTagSlugs, $[1] = tagsAll, $[2] = t1) : t1 = $[2];
- let tags = t1, tagsFetching = useTypedSelector(_temp2$14), t2;
+ let tags = t1, tagsFetching = useTypedSelector(_temp2$15), t2;
$[3] === tags ? t2 = $[4] : (t2 = getTagSelectOptions(tags), $[3] = tags, $[4] = t2);
let allTagOptions = t2, popoverProps = usePortalPopoverProps(), t3;
$[5] !== dispatch || $[6] !== facet.id ? (t3 = (option) => {
dispatch(searchActions.facetsUpdateById({
@@ -5336,9 +5336,9 @@
isClearable: !0,
isDisabled: tagsFetching,
isSearchable: !0,
name: "tags",
- noOptionsMessage: _temp3$6,
+ noOptionsMessage: _temp3$7,
onChange: (value) => handleChange(value),
options: allTagOptions,
placeholder: tagsFetching ? "Loading..." : "Select...",
styles: reactSelectStyles(scheme),
@@ -5350,23 +5350,23 @@
facet,
children: [t5, t6]
}), $[23] = facet, $[24] = t5, $[25] = t6, $[26] = t7) : t7 = $[26], t7;
};
-function _temp$27(state) {
+function _temp$28(state) {
return selectTags(state);
}
-function _temp2$14(state_0) {
+function _temp2$15(state_0) {
return state_0.tags.fetching;
}
-function _temp3$6() {
+function _temp3$7() {
return "No tags";
}
const StackContainer = /* @__PURE__ */ styled(Flex).withConfig({
displayName: "StackContainer",
- componentId: "sc-g9phkp-0"
+ componentId: "sc-2rtdyq-0"
})(({ theme }) => css`> *{margin-bottom:${rem(theme.sanity.space[2])};}`), SearchFacets = (props) => {
- let $ = c(6), { layout: t0 } = props, layout = t0 === void 0 ? "inline" : t0, searchFacets = useTypedSelector(_temp$26), t1;
- $[0] === searchFacets ? t1 = $[1] : (t1 = searchFacets.map(_temp2$13), $[0] = searchFacets, $[1] = t1);
+ let $ = c(6), { layout: t0 } = props, layout = t0 === void 0 ? "inline" : t0, searchFacets = useTypedSelector(_temp$27), t1;
+ $[0] === searchFacets ? t1 = $[1] : (t1 = searchFacets.map(_temp2$14), $[0] = searchFacets, $[1] = t1);
let Items = t1;
if (layout === "inline") {
if (searchFacets.length === 0) return null;
let t2;
@@ -5387,17 +5387,17 @@
}), $[4] = Items, $[5] = t2), t2;
}
throw Error("Invalid layout");
};
-function _temp$26(state) {
+function _temp$27(state) {
return state.search.facets;
}
-function _temp2$13(facet) {
+function _temp2$14(facet) {
let key = facet.id;
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;
}
const SearchFacetsControl = () => {
- let $ = c(35), dispatch = useDispatch(), assetTypes = useTypedSelector(_temp$25), searchFacets = useTypedSelector(_temp2$12), selectedDocument = useTypedSelector(_temp3$5), popoverProps = usePortalPopoverProps(), { creditLine } = useToolOptions(), isTool = !selectedDocument, T0, T1, T2, t0, t1, t2;
+ 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;
if ($[0] !== assetTypes || $[1] !== creditLine?.enabled || $[2] !== dispatch || $[3] !== isTool || $[4] !== searchFacets) {
let t3;
$[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];
let filteredFacets = FACETS.filter(t3).filter(_temp4$3), hasSearchFacets = filteredFacets.length > 0, renderMenuFacets = (facets_0, t4) => {
@@ -5457,15 +5457,15 @@
}), $[28] = dispatch, $[29] = searchFacets.length, $[30] = t6) : t6 = $[30];
let t7;
return $[31] !== T2 || $[32] !== t5 || $[33] !== t6 ? (t7 = /* @__PURE__ */ jsxs(T2, { children: [t5, t6] }), $[31] = T2, $[32] = t5, $[33] = t6, $[34] = t7) : t7 = $[34], t7;
};
-function _temp$25(state) {
+function _temp$26(state) {
return state.assets.assetTypes;
}
-function _temp2$12(state_0) {
+function _temp2$13(state_0) {
return state_0.search.facets;
}
-function _temp3$5(state_1) {
+function _temp3$6(state_1) {
return state_1.selected.document;
}
function _temp4$3(facet_0, index, facets) {
let previousFacet = facets[index - 1];
@@ -5490,9 +5490,9 @@
width: 1,
children: [t2, children]
}), $[3] = children, $[4] = handleClose, $[5] = id, $[6] = t3) : t3 = $[6], t3;
}, DialogTagCreate = (props) => {
- let $ = c(37), { children, dialog: t0 } = props, { id } = t0, dispatch = useDispatch(), creating = useTypedSelector(_temp$24), creatingError = useTypedSelector(_temp2$11), t1;
+ let $ = c(37), { children, dialog: t0 } = props, { id } = t0, dispatch = useDispatch(), creating = useTypedSelector(_temp$25), creatingError = useTypedSelector(_temp2$12), t1;
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = { name: "" }, $[0] = t1) : t1 = $[0];
let t2;
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {
defaultValues: t1,
@@ -5561,18 +5561,18 @@
width: 1,
children: [t15, children]
}), $[31] = children, $[32] = handleClose, $[33] = id, $[34] = t15, $[35] = t9, $[36] = t16) : t16 = $[36], t16;
};
-function _temp$24(state) {
+function _temp$25(state) {
return state.tags.creating;
}
-function _temp2$11(state_0) {
+function _temp2$12(state_0) {
return state_0.tags.creatingError;
}
const DialogTagEdit = (props) => {
let $ = c(64), { children, dialog: t0 } = props, { id, tagId } = t0, client = useVersionedClient(), dispatch = useDispatch(), t1;
$[0] === tagId ? t1 = $[1] : (t1 = (state) => selectTagById(state, String(tagId)), $[0] = tagId, $[1] = t1);
- let tagItem = useTypedSelector(t1), [tagSnapshot, setTagSnapshot] = useState(tagItem?.tag), currentTag = tagItem ? tagItem?.tag : tagSnapshot, generateDefaultValues = _temp$23, t2 = tagItem?.tag, t3;
+ let tagItem = useTypedSelector(t1), [tagSnapshot, setTagSnapshot] = useState(tagItem?.tag), currentTag = tagItem ? tagItem?.tag : tagSnapshot, generateDefaultValues = _temp$24, t2 = tagItem?.tag, t3;
$[2] === t2 ? t3 = $[3] : (t3 = generateDefaultValues(t2), $[2] = t2, $[3] = t3);
let t4;
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t4 = zodFormResolver(tagFormSchema), $[4] = t4) : t4 = $[4];
let t5;
@@ -5705,17 +5705,17 @@
width: 1,
children: [t25, children]
}), $[58] = children, $[59] = handleClose, $[60] = id, $[61] = t18, $[62] = t25, $[63] = t26) : t26 = $[63], t26;
};
-function _temp$23(tag) {
+function _temp$24(tag) {
return { name: tag?.name?.current || "" };
}
const TagContainer = styled(Flex).withConfig({
displayName: "TagContainer",
- componentId: "sc-wgczkj-0"
+ componentId: "sc-3v39jc-0"
})`height:${32}px;`, ButtonContainer = styled(Flex).withConfig({
displayName: "ButtonContainer",
- componentId: "sc-wgczkj-1"
+ componentId: "sc-3v39jc-1"
})`@media (pointer:fine){visibility:hidden;}@media (hover:hover) and (pointer:fine){${TagContainer}:hover &{visibility:visible;}}`, TagButton = (props) => {
let $ = c(10), { disabled, icon, onClick, tone, tooltip } = props, t0;
$[0] === tooltip ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Container, {
padding: 2,
@@ -5892,14 +5892,14 @@
}, t2), $[6] = item, $[7] = t1, $[8] = t2, $[9] = t3) : t3 = $[9], t3;
}), TagsVirtualized = (t0) => {
let $ = c(15), { tags } = t0, assetsPicked = useTypedSelector(selectAssetsPicked), [isScrolling, setIsScrolling] = useState(!1), items;
if ($[0] !== assetsPicked || $[1] !== tags) {
- let pickedTagIds = assetsPicked?.reduce(_temp2$10, []), pickedTagIdsUnique = [...new Set(pickedTagIds)], t1;
+ let pickedTagIds = assetsPicked?.reduce(_temp2$11, []), pickedTagIdsUnique = [...new Set(pickedTagIds)], t1;
$[3] === assetsPicked ? t1 = $[4] : (t1 = (acc_0, tagId) => (assetsPicked.every((assetItem) => (assetItem.asset.opt?.media?.tags?.findIndex((tag_0) => tag_0._ref === tagId) ?? -1) >= 0) ? acc_0.appliedToAll.push(tagId) : acc_0.appliedToSome.push(tagId), acc_0), $[3] = assetsPicked, $[4] = t1);
let tagIdsSegmented = pickedTagIdsUnique.reduce(t1, {
appliedToAll: [],
appliedToSome: []
- }), tagsAppliedToAll = tags.filter((tag_1) => tagIdsSegmented.appliedToAll.includes(tag_1.tag._id)).map(_temp3$4), 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);
+ }), 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);
items = [], assetsPicked.length === 0 ? items = tags.map(_temp6) : (tagsAppliedToAll?.length > 0 && (items = [
...items,
assetsPicked.length === 1 ? "Used" : "Used by all",
...tagsAppliedToAll
@@ -5937,16 +5937,16 @@
style: t3,
totalCount: items.length
}), $[11] = items.length, $[12] = t1, $[13] = t2, $[14] = t4) : t4 = $[14], t4;
};
-function _temp$22(tag) {
+function _temp$23(tag) {
return tag._ref;
}
-function _temp2$10(acc, val) {
- let assetTagIds = val?.asset?.opt?.media?.tags?.map(_temp$22) || [];
+function _temp2$11(acc, val) {
+ let assetTagIds = val?.asset?.opt?.media?.tags?.map(_temp$23) || [];
return acc = acc.concat(assetTagIds), acc;
}
-function _temp3$4(tagItem) {
+function _temp3$5(tagItem) {
return {
...tagItem,
actions: [
"delete",
@@ -5989,9 +5989,9 @@
]
};
}
const TagViewHeader = (t0) => {
- let $ = c(22), { allowCreate, light, title } = t0, scheme = useColorSchemeValue(), dispatch = useDispatch(), tagsCreating = useTypedSelector(_temp$21), tagsFetching = useTypedSelector(_temp2$9), t1;
+ let $ = c(22), { allowCreate, light, title } = t0, scheme = useColorSchemeValue(), dispatch = useDispatch(), tagsCreating = useTypedSelector(_temp$22), tagsFetching = useTypedSelector(_temp2$10), t1;
$[0] === dispatch ? t1 = $[1] : (t1 = () => {
dispatch(DIALOG_ACTIONS.showTagCreate());
}, $[0] = dispatch, $[1] = t1);
let handleTagCreate = t1, t2;
@@ -6042,18 +6042,18 @@
style: t3,
children: [t6, t7]
}) }), $[18] = t3, $[19] = t6, $[20] = t7, $[21] = t8) : t8 = $[21], t8;
};
-function _temp$21(state) {
+function _temp$22(state) {
return state.tags.creating;
}
-function _temp2$9(state_0) {
+function _temp2$10(state_0) {
return state_0.tags.fetching;
}
const TagView = () => {
let $ = c(16), numPickedAssets = useTypedSelector(selectAssetsPickedLength), { excludeTagSlugs } = useToolOptions(), tagsAll = useTypedSelector(selectTags), t0;
$[0] !== excludeTagSlugs || $[1] !== tagsAll ? (t0 = excludeTagSlugs.length > 0 ? tagsAll.filter((t) => !excludeTagSlugs.includes(t.tag.name.current)) : tagsAll, $[0] = excludeTagSlugs, $[1] = tagsAll, $[2] = t0) : t0 = $[2];
- let tags = t0, fetching = useTypedSelector(_temp$20), fetchComplete = useTypedSelector(_temp2$8) !== -1, hasTags = !fetching && tags?.length > 0, hasPicked = numPickedAssets > 0, t1 = hasPicked ? "Tags (in selection)" : "Tags", t2;
+ let tags = t0, fetching = useTypedSelector(_temp$21), fetchComplete = useTypedSelector(_temp2$9) !== -1, hasTags = !fetching && tags?.length > 0, hasPicked = numPickedAssets > 0, t1 = hasPicked ? "Tags (in selection)" : "Tags", t2;
$[3] !== hasPicked || $[4] !== t1 ? (t2 = /* @__PURE__ */ jsx(TagViewHeader, {
allowCreate: !0,
light: hasPicked,
title: t1
@@ -6080,12 +6080,12 @@
t4
]
}), $[12] = t2, $[13] = t3, $[14] = t4, $[15] = t5) : t5 = $[15], t5;
};
-function _temp$20(state) {
+function _temp$21(state) {
return state.tags.fetching;
}
-function _temp2$8(state_0) {
+function _temp2$9(state_0) {
return state_0.tags.fetchCount;
}
const DialogTags = (props) => {
let $ = c(7), { children, dialog: t0 } = props, { id } = t0, dispatch = useDispatch(), t1;
@@ -6109,9 +6109,9 @@
width: 1,
children: [t2, children]
}), $[3] = children, $[4] = handleClose, $[5] = id, $[6] = t3) : t3 = $[6], t3;
}, Dialogs = () => {
- let $ = c(2), currentDialogs = useTypedSelector(_temp$19), t0;
+ let $ = c(2), currentDialogs = useTypedSelector(_temp$20), t0;
if ($[0] !== currentDialogs) {
let renderDialogs = (dialogs, index) => {
if (dialogs.length === 0 || index >= dialogs.length) return null;
let dialog = dialogs[index], childDialogs = renderDialogs(dialogs, index + 1);
@@ -6153,13 +6153,13 @@
t0 = renderDialogs(currentDialogs, 0), $[0] = currentDialogs, $[1] = t0;
} else t0 = $[1];
return t0;
};
-function _temp$19(state) {
+function _temp$20(state) {
return state.dialog.items;
}
const Notifications = () => {
- let $ = c(4), items = useTypedSelector(_temp$18), toast = useToast(), t0, t1;
+ let $ = c(4), items = useTypedSelector(_temp$19), toast = useToast(), t0, t1;
return $[0] !== items || $[1] !== toast ? (t0 = () => {
if (items.length > 0) {
let lastItem = items[items.length - 1];
toast.push({
@@ -6169,9 +6169,9 @@
});
}
}, t1 = [items, toast], $[0] = items, $[1] = toast, $[2] = t0, $[3] = t1) : (t0 = $[2], t1 = $[3]), useEffect(t0, t1), null;
};
-function _temp$18(state) {
+function _temp$19(state) {
return state.notifications.items;
}
const debugSlice = createSlice({
name: "debug",
@@ -6376,9 +6376,9 @@
* this the source would stay mounted (showing nothing) and could not be opened
* a second time.
*/
const EditAssetDialog = (t0) => {
- let $ = c(9), { assetId, onClose } = t0, dispatch = useDispatch(), openDialogCount = useTypedSelector(_temp$17), hasOpenedRef = useRef(!1), t1, t2;
+ let $ = c(9), { assetId, onClose } = t0, dispatch = useDispatch(), openDialogCount = useTypedSelector(_temp$18), hasOpenedRef = useRef(!1), t1, t2;
$[0] !== assetId || $[1] !== dispatch ? (t1 = () => {
let queryFilter = `${constructFilter({
assetTypes: ["file", "image"],
searchFacets: []
@@ -6426,13 +6426,13 @@
selectedAssets,
children: t7
}), $[15] = client, $[16] = props.assetType, $[17] = selectedAssets, $[18] = t3, $[19] = t7, $[20] = t8) : t8 = $[20], t8;
};
-function _temp$17(state) {
+function _temp$18(state) {
return state.dialog.items.length;
}
const ButtonViewGroup = () => {
- let $ = c(16), dispatch = useDispatch(), view = useTypedSelector(_temp$16), t0;
+ let $ = c(16), dispatch = useDispatch(), view = useTypedSelector(_temp$17), t0;
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { whiteSpace: "nowrap" }, $[0] = t0) : t0 = $[0];
let t1 = view === "grid" ? "default" : "ghost", t2;
$[1] === dispatch ? t2 = $[2] : (t2 = () => dispatch(assetsActions.viewSet({ view: "grid" })), $[1] = dispatch, $[2] = t2);
let t3;
@@ -6469,13 +6469,13 @@
style: t0,
children: [t4, t8]
}), $[13] = t4, $[14] = t8, $[15] = t9) : t9 = $[15], t9;
};
-function _temp$16(state) {
+function _temp$17(state) {
return state.assets.view;
}
const OrderSelect = () => {
- let $ = c(15), dispatch = useDispatch(), order = useTypedSelector(_temp$15), popoverProps = usePortalPopoverProps(), t0;
+ let $ = c(15), dispatch = useDispatch(), order = useTypedSelector(_temp$16), popoverProps = usePortalPopoverProps(), t0;
$[0] !== order.direction || $[1] !== order.field ? (t0 = getOrderTitle(order.field, order.direction), $[0] = order.direction, $[1] = order.field, $[2] = t0) : t0 = $[2];
let t1;
$[3] === t0 ? t1 = $[4] : (t1 = /* @__PURE__ */ jsx(Button, {
fontSize: 1,
@@ -6514,9 +6514,9 @@
menu: t3,
popover: popoverProps
}), $[11] = popoverProps, $[12] = t1, $[13] = t3, $[14] = t4) : t4 = $[14], t4;
};
-function _temp$15(state) {
+function _temp$16(state) {
return state.assets.order;
}
const Progress = (props) => {
let $ = c(11), { loading } = props, t0;
@@ -6562,9 +6562,9 @@
strokeWidth: "32"
}), /* @__PURE__ */ jsx("path", { d: "M384 160a32 32 0 1132-32 32 32 0 01-32 32z" })]
}), $[0] = t0) : t0 = $[0], t0;
}, TextInputSearch = () => {
- let $ = c(14), searchQuery = useTypedSelector(_temp$14), dispatch = useDispatch(), t0;
+ let $ = c(14), searchQuery = useTypedSelector(_temp$15), dispatch = useDispatch(), t0;
$[0] === dispatch ? t0 = $[1] : (t0 = (e) => {
dispatch(searchActions.querySet({ searchQuery: e.currentTarget.value }));
}, $[0] = dispatch, $[1] = t0);
let handleChange = t0, t1;
@@ -6604,13 +6604,13 @@
style: t2,
children: [t3, t4]
}), $[11] = t3, $[12] = t4, $[13] = t5) : t5 = $[13], t5;
};
-function _temp$14(state) {
+function _temp$15(state) {
return state.search.query;
}
const Controls = () => {
- let $ = c(62), dispatch = useDispatch(), fetching = useTypedSelector(_temp$13), foldersPanelVisible = useTypedSelector(_temp2$7), pageIndex = useTypedSelector(_temp3$3), searchFacets = useTypedSelector(_temp4$1), tagsPanelVisible = useTypedSelector(_temp5$1), mediaIndex = useMediaIndex(), t0;
+ 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;
$[0] === dispatch ? t0 = $[1] : (t0 = () => {
dispatch(dialogActions.showSearchFacets());
}, $[0] = dispatch, $[1] = t0);
let handleShowSearchFacetDialog = t0, t1;
@@ -6813,15 +6813,15 @@
t35
]
}), $[58] = t20, $[59] = t34, $[60] = t35, $[61] = t36) : t36 = $[61], t36;
};
-function _temp$13(state) {
+function _temp$14(state) {
return state.assets.fetching;
}
-function _temp2$7(state_0) {
+function _temp2$8(state_0) {
return state_0.folders.panelVisible;
}
-function _temp3$3(state_1) {
+function _temp3$4(state_1) {
return state_1.assets.pageIndex;
}
function _temp4$1(state_2) {
return state_2.search.facets;
@@ -6829,9 +6829,9 @@
function _temp5$1(state_3) {
return state_3.tags.panelVisible;
}
const DebugControls = () => {
- let $ = c(16), dispatch = useDispatch(), badConnection = useTypedSelector(_temp$12), debugEnabled = useTypedSelector(_temp2$6), t0;
+ let $ = c(16), dispatch = useDispatch(), badConnection = useTypedSelector(_temp$13), debugEnabled = useTypedSelector(_temp2$7), t0;
$[0] === dispatch ? t0 = $[1] : (t0 = (e) => {
let checked = e.target.checked;
dispatch(debugActions.setBadConnection(checked));
}, $[0] = dispatch, $[1] = t0);
@@ -6891,16 +6891,16 @@
})]
})
}), $[13] = t5, $[14] = t8, $[15] = t9) : t9 = $[15], t9;
};
-function _temp$12(state) {
+function _temp$13(state) {
return state.debug.badConnection;
}
-function _temp2$6(state_0) {
+function _temp2$7(state_0) {
return state_0.debug.enabled;
}
const FolderBreadcrumbs = () => {
- let $ = c(13), dispatch = useDispatch(), currentFolderId = useTypedSelector(_temp$11), segments = useTypedSelector(selectCurrentFolderSegments);
+ let $ = c(13), dispatch = useDispatch(), currentFolderId = useTypedSelector(_temp$12), segments = useTypedSelector(selectCurrentFolderSegments);
if (!currentFolderId) return null;
let t0;
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [
"block",
@@ -6942,14 +6942,14 @@
children: [t1, t2]
})
}), $[10] = t1, $[11] = t2, $[12] = t3) : t3 = $[12], t3;
};
-function _temp$11(state) {
+function _temp$12(state) {
return state.folders.currentFolderId;
}
const FolderPanel = () => {
let $ = c(2);
- if (!useTypedSelector(_temp$10)) return null;
+ if (!useTypedSelector(_temp$11)) return null;
let t0;
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = {
position: "relative",
width: 260
@@ -6972,9 +6972,9 @@
children: /* @__PURE__ */ jsx(FolderView, {})
})
}), $[1] = t1) : t1 = $[1], t1;
};
-function _temp$10(state) {
+function _temp$11(state) {
return state.folders.panelVisible;
}
const DropzoneDispatchContext = createContext(void 0), DropzoneDispatchProvider = (props) => {
let $ = c(5), { children, open } = props, t0;
@@ -6988,9 +6988,9 @@
let context = useContext(DropzoneDispatchContext);
if (context === void 0) throw Error("useDropzoneActions must be used within an DropzoneDispatchProvider");
return context;
}, Header = (props) => {
- let $ = c(23), { onClose } = props, { open } = useDropzoneActions(), { onSelect } = useAssetSourceActions(), assetTypes = useTypedSelector(_temp$9), selectedDocument = useTypedSelector(_temp2$5), { directUploads } = useToolOptions(), t0;
+ let $ = c(23), { onClose } = props, { open } = useDropzoneActions(), { onSelect } = useAssetSourceActions(), assetTypes = useTypedSelector(_temp$10), selectedDocument = useTypedSelector(_temp2$6), { directUploads } = useToolOptions(), t0;
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { whiteSpace: "nowrap" }, $[0] = t0) : t0 = $[0];
let t1;
$[1] !== assetTypes || $[2] !== onSelect ? (t1 = onSelect ? `Insert ${assetTypes.join(" or ")}` : "Browse Assets", $[1] = assetTypes, $[2] = onSelect, $[3] = t1) : t1 = $[3];
let t2;
@@ -7056,16 +7056,16 @@
children: [t4, t7]
})
}), $[20] = t4, $[21] = t7, $[22] = t8) : t8 = $[22], t8;
};
-function _temp$9(state) {
+function _temp$10(state) {
return state.assets.assetTypes;
}
-function _temp2$5(state_0) {
+function _temp2$6(state_0) {
return state_0.selected.document;
}
const TableHeaderItem = (props) => {
- let $ = c(26), { field, title } = props, dispatch = useDispatch(), order = useTypedSelector(_temp$8), isActive = order.field === field, t0;
+ let $ = c(26), { field, title } = props, dispatch = useDispatch(), order = useTypedSelector(_temp$9), isActive = order.field === field, t0;
$[0] !== dispatch || $[1] !== field || $[2] !== isActive || $[3] !== order.direction || $[4] !== title ? (t0 = () => {
if (!(!field || !title)) {
if (isActive) {
let direction = order.direction === "asc" ? "desc" : "asc";
@@ -7112,16 +7112,16 @@
size: 0,
children: t9
}), $[23] = t1, $[24] = t9, $[25] = t10) : t10 = $[25], t10;
};
-function _temp$8(state) {
+function _temp$9(state) {
return state.assets.order;
}
const ContextActionContainer$1 = /* @__PURE__ */ styled(Flex).withConfig({
displayName: "ContextActionContainer",
- componentId: "sc-00jl3m-0"
+ componentId: "sc-r1w061-0"
})(({ $scheme }) => css`cursor:pointer;@media (hover:hover) and (pointer:fine){&:hover{background:${getSchemeColor($scheme, "bg")};}}`), TableHeader = () => {
- let $ = c(24), scheme = useColorSchemeValue(), dispatch = useDispatch(), fetching = useTypedSelector(_temp$7), itemsLength = useTypedSelector(selectAssetsLength), numPickedAssets = useTypedSelector(selectAssetsPickedLength), mediaIndex = useMediaIndex(), { onSelect } = useAssetSourceActions(), allSelected = numPickedAssets === itemsLength, t0;
+ let $ = c(24), scheme = useColorSchemeValue(), dispatch = useDispatch(), fetching = useTypedSelector(_temp$8), itemsLength = useTypedSelector(selectAssetsLength), numPickedAssets = useTypedSelector(selectAssetsPickedLength), mediaIndex = useMediaIndex(), { onSelect } = useAssetSourceActions(), allSelected = numPickedAssets === itemsLength, t0;
$[0] !== allSelected || $[1] !== dispatch ? (t0 = (e) => {
e.stopPropagation(), dispatch(allSelected ? assetsActions.pickClear() : assetsActions.pickAll());
}, $[0] = allSelected, $[1] = dispatch, $[2] = t0) : t0 = $[2];
let handleContextActionClick = t0, t1 = mediaIndex < 3 ? 0 : "16px", t2 = mediaIndex < 3 ? 0 : "32px", t3 = mediaIndex < 3 ? "hidden" : "visible", t4;
@@ -7188,22 +7188,22 @@
t13
]
}), $[21] = t4, $[22] = t5, $[23] = t14) : t14 = $[23], t14;
};
-function _temp$7(state) {
+function _temp$8(state) {
return state.assets.fetching;
}
const ContainerGrid$1 = /* @__PURE__ */ styled(Grid).withConfig({
displayName: "ContainerGrid",
- componentId: "sc-phlfmf-0"
+ componentId: "sc-mfq3ng-0"
})(({ $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({
displayName: "ContextActionContainer",
- componentId: "sc-phlfmf-1"
+ componentId: "sc-mfq3ng-1"
})(({ $scheme }) => css`cursor:pointer;@media (hover:hover) and (pointer:fine){&:hover{background:${getSchemeColor($scheme, "bg2")};}}`), StyledWarningIcon = /* @__PURE__ */ styled(WarningFilledIcon).withConfig({
displayName: "StyledWarningIcon",
- componentId: "sc-phlfmf-2"
+ componentId: "sc-mfq3ng-2"
})(({ theme }) => ({ color: theme.sanity.color.spot.red })), TableRowAsset = (props) => {
- let $ = c(150), { id, selected } = props, scheme = useColorSchemeValue(), shiftPressed = useKeyPress("shift"), [referenceCountVisible, setReferenceCountVisible] = useState(!1), refCountVisibleTimeout = useRef(null), dispatch = useDispatch(), lastPicked = useTypedSelector(_temp$6), t0;
+ 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;
$[0] === id ? t0 = $[1] : (t0 = (state_0) => selectAssetById(state_0, id), $[0] = id, $[1] = t0);
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;
$[2] !== asset || $[3] !== dispatch || $[4] !== isMultiSelect || $[5] !== lastPicked || $[6] !== onSelect || $[7] !== picked || $[8] !== selected || $[9] !== shiftPressed ? (t1 = (e) => {
e.stopPropagation(), asset && (selected || (onSelect && !isMultiSelect ? dispatch(dialogActions.showAssetEdit({ assetId: asset._id })) : shiftPressed.current && !picked ? dispatch(assetsActions.pickRange({
@@ -7491,9 +7491,9 @@
style: t58,
textOverflow: "ellipsis",
children: referenceCountVisible ? /* @__PURE__ */ jsx(WithReferringDocuments, {
id,
- children: _temp2$4
+ children: _temp2$5
}) : /* @__PURE__ */ jsx(Fragment, { children: "-" })
}), $[120] = id, $[121] = referenceCountVisible, $[122] = t59) : t59 = $[122];
let t60;
$[123] !== t57 || $[124] !== t59 ? (t60 = /* @__PURE__ */ jsx(Box, {
@@ -7555,21 +7555,21 @@
]
}), $[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;
};
var TableRowAsset_default = memo(TableRowAsset);
-function _temp$6(state) {
+function _temp$7(state) {
return state.assets.lastPicked;
}
-function _temp2$4(t0) {
+function _temp2$5(t0) {
let { isLoading, referringDocuments } = t0, uniqueDocuments = getUniqueDocuments(referringDocuments);
return isLoading ? /* @__PURE__ */ jsx(Fragment, { children: "-" }) : /* @__PURE__ */ jsx(Fragment, { children: Array.isArray(uniqueDocuments) ? uniqueDocuments.length : 0 });
}
const ContainerGrid = /* @__PURE__ */ styled(Grid).withConfig({
displayName: "ContainerGrid",
- componentId: "sc-j0br29-0"
+ componentId: "sc-ezmovx-0"
})(({ theme }) => css`align-items:center;cursor:pointer;height:100%;user-select:none;white-space:nowrap;@media (hover:hover) and (pointer:fine){&:hover{background:${theme.sanity.color.card.enabled.bg};}}`), FolderBadge = /* @__PURE__ */ styled(Box).withConfig({
displayName: "FolderBadge",
- componentId: "sc-j0br29-1"
+ componentId: "sc-ezmovx-1"
})(({ theme }) => css`background:${theme.sanity.color.spot.yellow};border-radius:6px;height:42px;position:relative;width:52px;&::before{background:${theme.sanity.color.spot.yellow};border-radius:6px 6px 0 0;content:'';height:12px;left:0;position:absolute;top:-6px;width:18px;}`), TableRowFolder = (t0) => {
let $ = c(45), { folderId, name, totalCount } = t0, dispatch = useDispatch(), mediaIndex = useMediaIndex(), scheme = useColorSchemeValue(), t1;
$[0] !== dispatch || $[1] !== folderId ? (t1 = () => dispatch(foldersActions.currentFolderSet({ folderId })), $[0] = dispatch, $[1] = folderId, $[2] = t1) : t1 = $[2];
let t2;
@@ -7866,10 +7866,10 @@
}), $[10] = item.id, $[11] = t2), t2;
}
return null;
}), AssetTableVirtualized = (props) => {
- let $ = c(15), { items, onLoadMore } = props, selectedAssets = useTypedSelector(_temp$5), t0;
- $[0] === selectedAssets ? t0 = $[1] : (t0 = selectedAssets && selectedAssets.map(_temp2$3) || [], $[0] = selectedAssets, $[1] = t0);
+ let $ = c(15), { items, onLoadMore } = props, selectedAssets = useTypedSelector(_temp$6), t0;
+ $[0] === selectedAssets ? t0 = $[1] : (t0 = selectedAssets && selectedAssets.map(_temp2$4) || [], $[0] = selectedAssets, $[1] = t0);
let selectedIds = t0, totalCount = items?.length;
if (totalCount === 0) return null;
let t1;
$[2] === items ? t1 = $[3] : (t1 = (index) => items[index]?.id || index, $[2] = items, $[3] = t1);
@@ -7890,24 +7890,24 @@
className: "media__custom-scrollbar",
computeItemKey: t1,
endReached: onLoadMore,
groupCounts: t2,
- groupContent: _temp3$2,
+ groupContent: _temp3$3,
itemContent: t3,
style: t4
}), $[10] = onLoadMore, $[11] = t1, $[12] = t2, $[13] = t3, $[14] = t5) : t5 = $[14], t5;
};
-function _temp$5(state) {
+function _temp$6(state) {
return state.selected.assets;
}
-function _temp2$3(asset) {
+function _temp2$4(asset) {
return asset._id;
}
-function _temp3$2() {
+function _temp3$3() {
return /* @__PURE__ */ jsx(TableHeader, {});
}
const Items = () => {
- let $ = c(15), dispatch = useDispatch(), fetchCount = useTypedSelector(_temp$4), fetching = useTypedSelector(_temp2$2), foldersPanelVisible = useTypedSelector(_temp3$1), tagsPanelVisible = useTypedSelector(_temp4), view = useTypedSelector(_temp5), combinedItems = useTypedSelector(selectCombinedItems), mediaIndex = useMediaIndex(), hasFetchedOnce = fetchCount >= 0, hasItems = combinedItems.length > 0, t0;
+ 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;
$[0] !== dispatch || $[1] !== fetching ? (t0 = () => {
fetching || dispatch(assetsActions.loadNextPage());
}, $[0] = dispatch, $[1] = fetching, $[2] = t0) : t0 = $[2];
let handleLoadMoreItems = t0, t1, t2;
@@ -7940,15 +7940,15 @@
onLoadMore: handleLoadMoreItems
})] })
}), $[10] = combinedItems, $[11] = handleLoadMoreItems, $[12] = isEmpty, $[13] = view, $[14] = t4) : t4 = $[14], t4;
};
-function _temp$4(state) {
+function _temp$5(state) {
return state.assets.fetchCount;
}
-function _temp2$2(state_0) {
+function _temp2$3(state_0) {
return state_0.assets.fetching;
}
-function _temp3$1(state_1) {
+function _temp3$2(state_1) {
return state_1.folders.panelVisible;
}
function _temp4(state_2) {
return state_2.tags.panelVisible;
@@ -7956,9 +7956,9 @@
function _temp5(state_3) {
return state_3.assets.view;
}
const PickedBar = () => {
- let $ = c(57), scheme = useColorSchemeValue(), dispatch = useDispatch(), assetsPicked = useTypedSelector(selectAssetsPicked), currentFolderId = useTypedSelector(_temp$3), { isMultiSelect, onSelect } = useAssetSourceActions(), t0;
+ let $ = c(57), scheme = useColorSchemeValue(), dispatch = useDispatch(), assetsPicked = useTypedSelector(selectAssetsPicked), currentFolderId = useTypedSelector(_temp$4), { isMultiSelect, onSelect } = useAssetSourceActions(), t0;
$[0] !== assetsPicked[0] || $[1] !== assetsPicked.length ? (t0 = assetsPicked.length === 1 && !!assetsPicked[0] && isImageAsset(assetsPicked[0].asset), $[0] = assetsPicked[0], $[1] = assetsPicked.length, $[2] = t0) : t0 = $[2];
let canReplace = t0, t1;
$[3] === dispatch ? t1 = $[4] : (t1 = () => {
dispatch(assetsActions.pickClear());
@@ -7984,9 +7984,9 @@
})), $[15] = assetsPicked, $[16] = dispatch, $[17] = t5) : t5 = $[17];
let handleRemovePickedFromFolder = t5, t6;
$[18] !== assetsPicked || $[19] !== onSelect ? (t6 = () => {
if (!onSelect) return;
- let pickedAssetIds = assetsPicked.map(_temp2$1);
+ let pickedAssetIds = assetsPicked.map(_temp2$2);
pickedAssetIds.length !== 0 && onSelect(pickedAssetIds);
}, $[18] = assetsPicked, $[19] = onSelect, $[20] = t6) : t6 = $[20];
let handleInsertPicked = t6;
if (assetsPicked.length === 0) return null;
@@ -8127,20 +8127,20 @@
style: t8,
children: t19
}), $[54] = t19, $[55] = t8, $[56] = t20) : t20 = $[56], t20;
};
-function _temp$3(state) {
+function _temp$4(state) {
return state.folders.currentFolderId;
}
-function _temp2$1(item) {
+function _temp2$2(item) {
return {
kind: "assetDocumentId",
value: item.asset._id
};
}
const TagsPanel = () => {
let $ = c(2);
- if (!useTypedSelector(_temp$2)) return null;
+ if (!useTypedSelector(_temp$3)) return null;
let t0;
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = {
position: "relative",
width: 250
@@ -8163,17 +8163,17 @@
children: /* @__PURE__ */ jsx(TagView, {})
})
}), $[1] = t1) : t1 = $[1], t1;
};
-function _temp$2(state) {
+function _temp$3(state) {
return state.tags.panelVisible;
}
const UploadContainer = styled.div.withConfig({
displayName: "UploadContainer",
- componentId: "sc-2pwjx1-0"
+ componentId: "sc-cm6qls-0"
})`color:white;height:100%;min-height:100%;right:0;top:0;width:100%;&:focus{outline:none;}`, DragActiveContainer = styled.div.withConfig({
displayName: "DragActiveContainer",
- componentId: "sc-2pwjx1-1"
+ componentId: "sc-cm6qls-1"
})`align-items:center;background:rgba(0,0,0,0.75);display:flex;height:100%;justify-content:center;position:absolute;right:0;top:0;width:100%;z-index:3;`;
async function filterFiles(fileList) {
let files = Array.from(fileList), filteredFiles = [];
for (let file of files) try {
@@ -8181,18 +8181,18 @@
} catch {}
return filteredFiles;
}
const UploadDropzone = (props) => {
- let $ = c(32), { children } = props, { dropzone: t0, directUploads } = useToolOptions(), { maxSize } = t0, { onSelect } = useAssetSourceActions(), dispatch = useDispatch(), assetTypes = useTypedSelector(_temp$1), isImageAssetType = assetTypes.length === 1 && assetTypes[0] === "image", t1;
+ let $ = c(32), { children } = props, { dropzone: t0, directUploads } = useToolOptions(), { maxSize } = t0, { onSelect } = useAssetSourceActions(), dispatch = useDispatch(), assetTypes = useTypedSelector(_temp$2), isImageAssetType = assetTypes.length === 1 && assetTypes[0] === "image", t1;
$[0] !== assetTypes[0] || $[1] !== assetTypes.length || $[2] !== dispatch ? (t1 = async (acceptedFiles) => {
acceptedFiles.forEach((file) => dispatch(uploadsActions.uploadRequest({
file,
forceAsAssetType: assetTypes.length === 1 ? assetTypes[0] : void 0
})));
}, $[0] = assetTypes[0], $[1] = assetTypes.length, $[2] = dispatch, $[3] = t1) : t1 = $[3];
let handleDrop = t1, t2;
$[4] === dispatch ? t2 = $[5] : (t2 = (rejections) => {
- rejections.flatMap(_temp3).includes("file-too-large") && dispatch(notificationsActions.add({
+ rejections.flatMap(_temp3$1).includes("file-too-large") && dispatch(notificationsActions.add({
status: "error",
title: "One or more files exceed the maximum upload size."
}));
}, $[4] = dispatch, $[5] = t2);
@@ -8252,18 +8252,18 @@
open,
children: t12
}), $[29] = open, $[30] = t12, $[31] = t13) : t13 = $[31], t13;
};
-function _temp$1(state) {
+function _temp$2(state) {
return state.assets.assetTypes;
}
-function _temp2(t0) {
+function _temp2$1(t0) {
let { code } = t0;
return code;
}
-function _temp3(t0) {
+function _temp3$1(t0) {
let { errors } = t0;
- return errors.map(_temp2);
+ return errors.map(_temp2$1);
}
function getMediaTagNames(schemaType) {
let mediaTags = schemaType?.options?.mediaTags;
if (!mediaTags?.length) return [];
@@ -8298,24 +8298,28 @@
}
};
}
function useBrowserInit(client, schemaType) {
- let dispatch = useDispatch(), tagsByIds = useSelector((state) => state.tags.byIds), tagsFetchCount = useSelector((state_0) => state_0.tags.fetchCount), tagNames = getMediaTagNames(schemaType), hasMediaTags = tagNames.length > 0;
- useEffect(() => {
+ let $ = c(16), dispatch = useDispatch(), tagsByIds = useSelector(_temp$1), tagsFetchCount = useSelector(_temp2), t0;
+ $[0] === schemaType ? t0 = $[1] : (t0 = getMediaTagNames(schemaType), $[0] = schemaType, $[1] = t0);
+ let tagNames = t0, hasMediaTags = tagNames.length > 0, t1, t2;
+ $[2] !== client || $[3] !== dispatch || $[4] !== hasMediaTags ? (t1 = () => {
hasMediaTags || dispatch(searchActions.facetsClear()), dispatch(tagsActions.fetchRequest()), dispatch(foldersActions.fetchRequest());
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()));
return () => {
assetSubscription.unsubscribe(), tagSubscription.unsubscribe(), folderSubscription.unsubscribe();
};
- }, [
+ }, t2 = [
client,
dispatch,
hasMediaTags
- ]), useEffect(() => {
+ ], $[2] = client, $[3] = dispatch, $[4] = hasMediaTags, $[5] = t1, $[6] = t2) : (t1 = $[5], t2 = $[6]), useEffect(t1, t2);
+ let t3;
+ $[7] !== dispatch || $[8] !== hasMediaTags || $[9] !== tagNames || $[10] !== tagsByIds || $[11] !== tagsFetchCount ? (t3 = () => {
if (!hasMediaTags || tagsFetchCount < 0) return;
let tagFacetInput = inputs.tag;
if (tagFacetInput.type !== "searchable") return;
- let resolvedTags = tagNames.map((name) => Object.values(tagsByIds).find((item) => item.tag.name.current === name)).filter((item_0) => !!item_0);
+ let resolvedTags = tagNames.map((name) => Object.values(tagsByIds).find((item) => item.tag.name.current === name)).filter(_temp3);
dispatch(searchActions.facetsClear());
for (let tagItem of resolvedTags) dispatch(searchActions.facetsAdd({ facet: {
...tagFacetInput,
operatorType: "references",
@@ -8323,10 +8327,21 @@
label: tagItem.tag.name.current,
value: tagItem.tag._id
}
} }));
- }, [tagsFetchCount, hasMediaTags]);
+ }, $[7] = dispatch, $[8] = hasMediaTags, $[9] = tagNames, $[10] = tagsByIds, $[11] = tagsFetchCount, $[12] = t3) : t3 = $[12];
+ let t4;
+ $[13] !== hasMediaTags || $[14] !== tagsFetchCount ? (t4 = [tagsFetchCount, hasMediaTags], $[13] = hasMediaTags, $[14] = tagsFetchCount, $[15] = t4) : t4 = $[15], useEffect(t3, t4);
}
+function _temp3(item_0) {
+ return !!item_0;
+}
+function _temp2(state_0) {
+ return state_0.tags.fetchCount;
+}
+function _temp$1(state) {
+ return state.tags.byIds;
+}
const BrowserContent = (t0) => {
let $ = c(14), { onClose, schemaType } = t0, client = useVersionedClient(), [portalElement, setPortalElement] = useState(null);
useBrowserInit(client, schemaType);
let t1, t2;