sanity-plugin-media 6.4.0 → 6.6.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
@@ -86,7 +86,7 @@ function _temp$38() {
86
86
  const useTypedSelector = useSelector, useVersionedClient = () => {
87
87
  let $ = c(1), t0;
88
88
  return $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { apiVersion: "2025-10-02" }, $[0] = t0) : t0 = $[0], useClient(t0);
89
- }, ORDER_DICTIONARY = {
89
+ }, LOCALIZED_ORDER_FIELDS = /* @__PURE__ */ new Set(["title"]), ORDER_DICTIONARY = {
90
90
  _createdAt: {
91
91
  asc: "Last created: Oldest first",
92
92
  desc: "Last created: Newest first"
@@ -103,11 +103,23 @@ const useTypedSelector = useSelector, useVersionedClient = () => {
103
103
  asc: "File name: A to Z",
104
104
  desc: "File name: Z to A"
105
105
  },
106
+ title: {
107
+ asc: "Title: A to Z",
108
+ desc: "Title: Z to A"
109
+ },
106
110
  size: {
107
111
  asc: "File size: Smallest first",
108
112
  desc: "File size: Largest first"
109
113
  }
110
- }, getOrderTitle = (field, direction) => ORDER_DICTIONARY[field][direction], divider = { type: "divider" }, inputs = {
114
+ }, getOrderTitle = (field, direction) => ORDER_DICTIONARY[field][direction], getOrderField = (field, localeIds) => {
115
+ if (localeIds.length === 0 || !LOCALIZED_ORDER_FIELDS.has(field)) return field;
116
+ let localizedFieldAccessors = localeIds.map((localeId) => groq`${field}[${JSON.stringify(localeId)}]`);
117
+ return groq`coalesce(${localizedFieldAccessors.join(", ")})`;
118
+ }, getOrderValue = (value, field, localeIds) => {
119
+ if (localeIds.length === 0 || !LOCALIZED_ORDER_FIELDS.has(field) || typeof value != "object" || !value) return value;
120
+ let localizedValues = value;
121
+ return localeIds.map((localeId) => localizedValues[localeId]).find((v) => v != null);
122
+ }, divider = { type: "divider" }, inputs = {
111
123
  altText: {
112
124
  assetTypes: ["file", "image"],
113
125
  field: "altText",
@@ -378,9 +390,20 @@ const useTypedSelector = useSelector, useVersionedClient = () => {
378
390
  type: "number",
379
391
  value: 400
380
392
  }
381
- }, operators = {
393
+ };
394
+ /**
395
+ * Wildcard `match` pattern for text the user typed.
396
+ *
397
+ * `JSON.stringify` produces a GROQ string literal, the same way folder ids are
398
+ * embedded. Interpolating into `'*...*'` lets `'` or `\` end or rewrite the
399
+ * literal, so the query no longer parses.
400
+ */
401
+ function groqWildcardMatch(term) {
402
+ return JSON.stringify(`*${term}*`);
403
+ }
404
+ const operators = {
382
405
  doesNotInclude: {
383
- fn: (value, field) => value ? `!(${field} match '*${value}*')` : void 0,
406
+ fn: (value, field) => value ? `!(${field} match ${groqWildcardMatch(String(value))})` : void 0,
384
407
  label: "does not include"
385
408
  },
386
409
  doesNotReference: {
@@ -405,7 +428,7 @@ const useTypedSelector = useSelector, useVersionedClient = () => {
405
428
  label: "is greater than or equal to"
406
429
  },
407
430
  includes: {
408
- fn: (value, field) => value ? `${field} match '*${value}*'` : void 0,
431
+ fn: (value, field) => value ? `${field} match ${groqWildcardMatch(String(value))}` : void 0,
409
432
  label: "includes"
410
433
  },
411
434
  is: {
@@ -461,6 +484,15 @@ const useTypedSelector = useSelector, useVersionedClient = () => {
461
484
  field: "originalFilename"
462
485
  },
463
486
  null,
487
+ {
488
+ direction: "asc",
489
+ field: "title"
490
+ },
491
+ {
492
+ direction: "desc",
493
+ field: "title"
494
+ },
495
+ null,
464
496
  {
465
497
  direction: "desc",
466
498
  field: "size"
@@ -527,7 +559,7 @@ const useTypedSelector = useSelector, useVersionedClient = () => {
527
559
  baseFilter,
528
560
  ...excludeMediaLibraryFragment ? [excludeMediaLibraryFragment] : [],
529
561
  ...excludeTagsFragment ? [excludeTagsFragment] : [],
530
- ...searchQuery ? [groq`[_id, altText, assetId, creditLine, description, originalFilename, title, url] match '*${searchQuery.trim()}*'`] : [],
562
+ ...searchQuery ? [groq`[_id, altText, assetId, creditLine, description, originalFilename, title, url] match ${groqWildcardMatch(searchQuery.trim())}`] : [],
531
563
  ...folderFilter ? [folderFilter] : [],
532
564
  ...searchFacetFragments
533
565
  ].join(" && ");
@@ -908,6 +940,7 @@ const UPLOADS_ACTIONS = { uploadComplete: createAction("uploads/uploadComplete",
908
940
  fetching: !1,
909
941
  fetchingError: void 0,
910
942
  lastPicked: void 0,
943
+ localeIds: [],
911
944
  order: {
912
945
  direction: defaultOrder.direction,
913
946
  field: defaultOrder.field,
@@ -1126,7 +1159,7 @@ const UPLOADS_ACTIONS = { uploadComplete: createAction("uploads/uploadComplete",
1126
1159
  },
1127
1160
  sort(state) {
1128
1161
  state.allIds.sort((a, b) => {
1129
- let tagA = state.byIds[a].asset[state.order.field], tagB = state.byIds[b].asset[state.order.field];
1162
+ let { field } = state.order, tagA = getOrderValue(state.byIds[a].asset[field], field, state.localeIds), tagB = getOrderValue(state.byIds[b].asset[field], field, state.localeIds);
1130
1163
  return tagA < tagB ? state.order.direction === "asc" ? -1 : 1 : tagA > tagB ? state.order.direction === "asc" ? 1 : -1 : 0;
1131
1164
  });
1132
1165
  },
@@ -1185,7 +1218,7 @@ const UPLOADS_ACTIONS = { uploadComplete: createAction("uploads/uploadComplete",
1185
1218
  params,
1186
1219
  queryFilter: constructedFilter,
1187
1220
  selector: groq`[${start}...${end}]`,
1188
- sort: groq`order(${state.assets?.order?.field} ${state.assets?.order?.direction})`
1221
+ sort: groq`order(${getOrderField(state.assets.order.field, state.assets.localeIds)} ${state.assets.order.direction})`
1189
1222
  }));
1190
1223
  })), assetsFetchNextPageEpic = (action$, state$) => action$.pipe(filter(assetsActions.loadNextPage.match), withLatestFrom(state$), switchMap(([_action, state]) => of(assetsActions.loadPageIndex({ pageIndex: state.assets.pageIndex + 1 })))), assetsFetchAfterDeleteAllEpic = (action$, state$) => action$.pipe(filter(assetsActions.deleteComplete.match), withLatestFrom(state$), switchMap(([_action, state]) => {
1191
1224
  if (state.assets.allIds.length === 0) {
@@ -1910,38 +1943,42 @@ const ButtonAssetCopy = (t0) => {
1910
1943
  children: t5
1911
1944
  }), $[8] = popoverProps, $[9] = popoverVisible, $[10] = t5, $[11] = t6) : t6 = $[11], t6;
1912
1945
  }, Row = (t0) => {
1913
- let $ = c(9), { label, value } = t0, t1;
1914
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = {
1946
+ let $ = c(15), { label, value, wrap: t1 } = t0, wrap = t1 !== void 0 && t1, t2 = wrap ? "flex-start" : "center", t3;
1947
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {
1915
1948
  opacity: .8,
1916
1949
  width: "40%"
1917
- }, $[0] = t1) : t1 = $[0];
1918
- let t2;
1919
- $[1] === label ? t2 = $[2] : (t2 = /* @__PURE__ */ jsx(Text, {
1950
+ }, $[0] = t3) : t3 = $[0];
1951
+ let t4;
1952
+ $[1] === label ? t4 = $[2] : (t4 = /* @__PURE__ */ jsx(Text, {
1920
1953
  size: 1,
1921
- style: t1,
1954
+ style: t3,
1922
1955
  textOverflow: "ellipsis",
1923
1956
  children: label
1924
- }), $[1] = label, $[2] = t2);
1925
- let t3;
1926
- $[3] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {
1957
+ }), $[1] = label, $[2] = t4);
1958
+ let t5 = wrap ? "anywhere" : void 0, t6 = wrap ? "all" : void 0, t7;
1959
+ $[3] !== t5 || $[4] !== t6 ? (t7 = {
1927
1960
  opacity: .4,
1961
+ overflowWrap: t5,
1928
1962
  textAlign: "right",
1963
+ userSelect: t6,
1929
1964
  width: "60%"
1930
- }, $[3] = t3) : t3 = $[3];
1931
- let t4;
1932
- $[4] === value ? t4 = $[5] : (t4 = /* @__PURE__ */ jsx(Text, {
1965
+ }, $[3] = t5, $[4] = t6, $[5] = t7) : t7 = $[5];
1966
+ let t8 = wrap ? void 0 : "ellipsis", t9 = typeof value == "string" ? value : void 0, t10;
1967
+ $[6] !== t7 || $[7] !== t8 || $[8] !== t9 || $[9] !== value ? (t10 = /* @__PURE__ */ jsx(Text, {
1933
1968
  size: 1,
1934
- style: t3,
1935
- textOverflow: "ellipsis",
1969
+ style: t7,
1970
+ textOverflow: t8,
1971
+ title: t9,
1936
1972
  children: value
1937
- }), $[4] = value, $[5] = t4);
1938
- let t5;
1939
- return $[6] !== t2 || $[7] !== t4 ? (t5 = /* @__PURE__ */ jsxs(Flex, {
1973
+ }), $[6] = t7, $[7] = t8, $[8] = t9, $[9] = value, $[10] = t10) : t10 = $[10];
1974
+ let t11;
1975
+ return $[11] !== t10 || $[12] !== t2 || $[13] !== t4 ? (t11 = /* @__PURE__ */ jsxs(Flex, {
1976
+ align: t2,
1940
1977
  justify: "space-between",
1941
- children: [t2, t4]
1942
- }), $[6] = t2, $[7] = t4, $[8] = t5) : t5 = $[8], t5;
1978
+ children: [t4, t10]
1979
+ }), $[11] = t10, $[12] = t2, $[13] = t4, $[14] = t11) : t11 = $[14], t11;
1943
1980
  }, AssetMetadata = (props) => {
1944
- let $ = c(40), { asset, item } = props, exif = asset?.metadata?.exif, t0;
1981
+ let $ = c(43), { asset, item } = props, exif = asset?.metadata?.exif, t0;
1945
1982
  $[0] !== asset.originalFilename || $[1] !== asset.url ? (t0 = () => {
1946
1983
  window.location.href = `${asset.url}?dl=${asset.originalFilename}`;
1947
1984
  }, $[0] = asset.originalFilename, $[1] = asset.url, $[2] = t0) : t0 = $[2];
@@ -1980,18 +2017,25 @@ const ButtonAssetCopy = (t0) => {
1980
2017
  value: t9
1981
2018
  }), $[17] = t9, $[18] = t10);
1982
2019
  let t11;
1983
- $[19] !== t10 || $[20] !== t3 || $[21] !== t5 || $[22] !== t7 || $[23] !== t8 ? (t11 = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, {
2020
+ $[19] === asset._id ? t11 = $[20] : (t11 = /* @__PURE__ */ jsx(Row, {
2021
+ label: "Asset ID",
2022
+ value: asset._id,
2023
+ wrap: !0
2024
+ }), $[19] = asset._id, $[20] = t11);
2025
+ let t12;
2026
+ $[21] !== t10 || $[22] !== t11 || $[23] !== t3 || $[24] !== t5 || $[25] !== t7 || $[26] !== t8 ? (t12 = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Stack, {
1984
2027
  gap: 3,
1985
2028
  children: [
1986
2029
  t3,
1987
2030
  t5,
1988
2031
  t7,
1989
2032
  t8,
1990
- t10
2033
+ t10,
2034
+ t11
1991
2035
  ]
1992
- }) }), $[19] = t10, $[20] = t3, $[21] = t5, $[22] = t7, $[23] = t8, $[24] = t11) : t11 = $[24];
1993
- let t12;
1994
- $[25] === exif ? t12 = $[26] : (t12 = exif && (exif.DateTimeOriginal || exif.FNumber || exif.FocalLength || exif.ExposureTime || exif.ISO) && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Box, {
2036
+ }) }), $[21] = t10, $[22] = t11, $[23] = t3, $[24] = t5, $[25] = t7, $[26] = t8, $[27] = t12) : t12 = $[27];
2037
+ let t13;
2038
+ $[28] === exif ? t13 = $[29] : (t13 = exif && (exif.DateTimeOriginal || exif.FNumber || exif.FocalLength || exif.ExposureTime || exif.ISO) && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Box, {
1995
2039
  marginY: 4,
1996
2040
  style: {
1997
2041
  background: "var(--card-border-color)",
@@ -2022,38 +2066,38 @@ const ButtonAssetCopy = (t0) => {
2022
2066
  value: format(new Date(exif.DateTimeOriginal), "PPp")
2023
2067
  })
2024
2068
  ]
2025
- }) })] }), $[25] = exif, $[26] = t12);
2026
- let t13 = !item || item?.updating, t14;
2027
- $[27] !== handleDownload || $[28] !== t13 ? (t14 = /* @__PURE__ */ jsx(Button, {
2028
- disabled: t13,
2069
+ }) })] }), $[28] = exif, $[29] = t13);
2070
+ let t14 = !item || item?.updating, t15;
2071
+ $[30] !== handleDownload || $[31] !== t14 ? (t15 = /* @__PURE__ */ jsx(Button, {
2072
+ disabled: t14,
2029
2073
  fontSize: 1,
2030
2074
  icon: DownloadIcon,
2031
2075
  mode: "ghost",
2032
2076
  onClick: handleDownload,
2033
2077
  text: "Download"
2034
- }), $[27] = handleDownload, $[28] = t13, $[29] = t14) : t14 = $[29];
2035
- let t15 = !item || item?.updating, t16;
2036
- $[30] !== asset.url || $[31] !== t15 ? (t16 = /* @__PURE__ */ jsx(ButtonAssetCopy, {
2037
- disabled: t15,
2078
+ }), $[30] = handleDownload, $[31] = t14, $[32] = t15) : t15 = $[32];
2079
+ let t16 = !item || item?.updating, t17;
2080
+ $[33] !== asset.url || $[34] !== t16 ? (t17 = /* @__PURE__ */ jsx(ButtonAssetCopy, {
2081
+ disabled: t16,
2038
2082
  url: asset.url
2039
- }), $[30] = asset.url, $[31] = t15, $[32] = t16) : t16 = $[32];
2040
- let t17;
2041
- $[33] !== t14 || $[34] !== t16 ? (t17 = /* @__PURE__ */ jsx(Box, {
2083
+ }), $[33] = asset.url, $[34] = t16, $[35] = t17) : t17 = $[35];
2084
+ let t18;
2085
+ $[36] !== t15 || $[37] !== t17 ? (t18 = /* @__PURE__ */ jsx(Box, {
2042
2086
  marginTop: 5,
2043
2087
  children: /* @__PURE__ */ jsxs(Inline, {
2044
2088
  gap: 2,
2045
- children: [t14, t16]
2089
+ children: [t15, t17]
2046
2090
  })
2047
- }), $[33] = t14, $[34] = t16, $[35] = t17) : t17 = $[35];
2048
- let t18;
2049
- return $[36] !== t11 || $[37] !== t12 || $[38] !== t17 ? (t18 = /* @__PURE__ */ jsxs(Box, {
2091
+ }), $[36] = t15, $[37] = t17, $[38] = t18) : t18 = $[38];
2092
+ let t19;
2093
+ return $[39] !== t12 || $[40] !== t13 || $[41] !== t18 ? (t19 = /* @__PURE__ */ jsxs(Box, {
2050
2094
  marginTop: 3,
2051
2095
  children: [
2052
- t11,
2053
2096
  t12,
2054
- t17
2097
+ t13,
2098
+ t18
2055
2099
  ]
2056
- }), $[36] = t11, $[37] = t12, $[38] = t17, $[39] = t18) : t18 = $[39], t18;
2100
+ }), $[39] = t12, $[40] = t13, $[41] = t18, $[42] = t19) : t19 = $[42], t19;
2057
2101
  }, Dialog$1 = (props) => {
2058
2102
  let $ = c(3), t0;
2059
2103
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { position: "fixed" }, $[0] = t0) : t0 = $[0];
@@ -4216,7 +4260,7 @@ const DialogAllAssets = (props) => {
4216
4260
  children: [t8, children]
4217
4261
  }), $[25] = children, $[26] = handleClose, $[27] = t4, $[28] = t5, $[29] = t8, $[30] = t9) : t9 = $[30], t9;
4218
4262
  }, DialogFolderCreate = (props) => {
4219
- let $ = c(43), { children, dialog: t0 } = props, { parentFolderId, id } = t0, dispatch = useDispatch(), creating = useTypedSelector(_temp$32), creatingError = useTypedSelector(_temp2$18), t1;
4263
+ let $ = c(42), { children, dialog: t0 } = props, { parentFolderId, id } = t0, dispatch = useDispatch(), creating = useTypedSelector(_temp$32), creatingError = useTypedSelector(_temp2$18), t1;
4220
4264
  $[0] === parentFolderId ? t1 = $[1] : (t1 = (state_1) => selectFolderPathById(state_1, parentFolderId), $[0] = parentFolderId, $[1] = t1);
4221
4265
  let parentPath = useTypedSelector(t1), t2;
4222
4266
  $[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = { name: "" }, $[2] = t2) : t2 = $[2];
@@ -4242,68 +4286,68 @@ const DialogAllAssets = (props) => {
4242
4286
  $[9] !== creatingError || $[10] !== setError ? (t7 = () => {
4243
4287
  creatingError && setError("name", { message: creatingError.message });
4244
4288
  }, t8 = [creatingError, setError], $[9] = creatingError, $[10] = setError, $[11] = t7, $[12] = t8) : (t7 = $[11], t8 = $[12]), useEffect(t7, t8);
4245
- let t9;
4246
- $[13] !== creating || $[14] !== handleSubmit || $[15] !== isDirty || $[16] !== isValid || $[17] !== onSubmit ? (t9 = () => /* @__PURE__ */ jsx(Box, {
4289
+ let t9 = creating || !isDirty || !isValid, t10;
4290
+ $[13] !== handleSubmit || $[14] !== onSubmit ? (t10 = handleSubmit(onSubmit), $[13] = handleSubmit, $[14] = onSubmit, $[15] = t10) : t10 = $[15];
4291
+ let t11;
4292
+ $[16] !== isValid || $[17] !== t10 || $[18] !== t9 ? (t11 = /* @__PURE__ */ jsx(Box, {
4247
4293
  padding: 3,
4248
4294
  children: /* @__PURE__ */ jsx(Flex, {
4249
4295
  justify: "flex-end",
4250
4296
  children: /* @__PURE__ */ jsx(FormSubmitButton, {
4251
- disabled: creating || !isDirty || !isValid,
4297
+ disabled: t9,
4252
4298
  isValid,
4253
- onClick: handleSubmit(onSubmit)
4299
+ onClick: t10
4254
4300
  })
4255
4301
  })
4256
- }), $[13] = creating, $[14] = handleSubmit, $[15] = isDirty, $[16] = isValid, $[17] = onSubmit, $[18] = t9) : t9 = $[18];
4257
- let Footer = t9, t10;
4258
- $[19] === Footer ? t10 = $[20] : (t10 = /* @__PURE__ */ jsx(Footer, {}), $[19] = Footer, $[20] = t10);
4259
- let t11;
4260
- $[21] !== handleSubmit || $[22] !== onSubmit ? (t11 = handleSubmit(onSubmit), $[21] = handleSubmit, $[22] = onSubmit, $[23] = t11) : t11 = $[23];
4261
- let t12;
4262
- $[24] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsx("button", {
4302
+ }), $[16] = isValid, $[17] = t10, $[18] = t9, $[19] = t11) : t11 = $[19];
4303
+ let footer = t11, t12;
4304
+ $[20] !== handleSubmit || $[21] !== onSubmit ? (t12 = handleSubmit(onSubmit), $[20] = handleSubmit, $[21] = onSubmit, $[22] = t12) : t12 = $[22];
4305
+ let t13;
4306
+ $[23] === Symbol.for("react.memo_cache_sentinel") ? (t13 = /* @__PURE__ */ jsx("button", {
4263
4307
  style: { display: "none" },
4264
4308
  tabIndex: -1,
4265
4309
  type: "submit"
4266
- }), $[24] = t12) : t12 = $[24];
4267
- let t13;
4268
- $[25] === parentPath ? t13 = $[26] : (t13 = parentPath && /* @__PURE__ */ jsx(Box, {
4310
+ }), $[23] = t13) : t13 = $[23];
4311
+ let t14;
4312
+ $[24] === parentPath ? t14 = $[25] : (t14 = parentPath && /* @__PURE__ */ jsx(Box, {
4269
4313
  marginBottom: 3,
4270
4314
  children: /* @__PURE__ */ jsxs(Text, {
4271
4315
  muted: !0,
4272
4316
  size: 1,
4273
4317
  children: ["Creating inside ", parentPath]
4274
4318
  })
4275
- }), $[25] = parentPath, $[26] = t13);
4276
- let t14;
4277
- $[27] === register ? t14 = $[28] : (t14 = register("name"), $[27] = register, $[28] = t14);
4278
- let t15 = errors?.name?.message, t16;
4279
- $[29] !== creating || $[30] !== t14 || $[31] !== t15 ? (t16 = /* @__PURE__ */ jsx(FormFieldInputText, {
4280
- ...t14,
4319
+ }), $[24] = parentPath, $[25] = t14);
4320
+ let t15;
4321
+ $[26] === register ? t15 = $[27] : (t15 = register("name"), $[26] = register, $[27] = t15);
4322
+ let t16 = errors?.name?.message, t17;
4323
+ $[28] !== creating || $[29] !== t15 || $[30] !== t16 ? (t17 = /* @__PURE__ */ jsx(FormFieldInputText, {
4324
+ ...t15,
4281
4325
  disabled: creating,
4282
- error: t15,
4326
+ error: t16,
4283
4327
  label: "Folder name",
4284
4328
  name: "name"
4285
- }), $[29] = creating, $[30] = t14, $[31] = t15, $[32] = t16) : t16 = $[32];
4286
- let t17;
4287
- $[33] !== t11 || $[34] !== t13 || $[35] !== t16 ? (t17 = /* @__PURE__ */ jsxs(Box, {
4329
+ }), $[28] = creating, $[29] = t15, $[30] = t16, $[31] = t17) : t17 = $[31];
4330
+ let t18;
4331
+ $[32] !== t12 || $[33] !== t14 || $[34] !== t17 ? (t18 = /* @__PURE__ */ jsxs(Box, {
4288
4332
  as: "form",
4289
4333
  padding: 4,
4290
- onSubmit: t11,
4334
+ onSubmit: t12,
4291
4335
  children: [
4292
- t12,
4293
4336
  t13,
4294
- t16
4337
+ t14,
4338
+ t17
4295
4339
  ]
4296
- }), $[33] = t11, $[34] = t13, $[35] = t16, $[36] = t17) : t17 = $[36];
4297
- let t18;
4298
- return $[37] !== children || $[38] !== handleClose || $[39] !== id || $[40] !== t10 || $[41] !== t17 ? (t18 = /* @__PURE__ */ jsxs(Dialog$1, {
4340
+ }), $[32] = t12, $[33] = t14, $[34] = t17, $[35] = t18) : t18 = $[35];
4341
+ let t19;
4342
+ return $[36] !== children || $[37] !== footer || $[38] !== handleClose || $[39] !== id || $[40] !== t18 ? (t19 = /* @__PURE__ */ jsxs(Dialog$1, {
4299
4343
  animate: !0,
4300
- footer: t10,
4344
+ footer,
4301
4345
  header: "Create Folder",
4302
4346
  id,
4303
4347
  onClose: handleClose,
4304
4348
  width: 1,
4305
- children: [t17, children]
4306
- }), $[37] = children, $[38] = handleClose, $[39] = id, $[40] = t10, $[41] = t17, $[42] = t18) : t18 = $[42], t18;
4349
+ children: [t18, children]
4350
+ }), $[36] = children, $[37] = footer, $[38] = handleClose, $[39] = id, $[40] = t18, $[41] = t19) : t19 = $[41], t19;
4307
4351
  };
4308
4352
  function _temp$32(state) {
4309
4353
  return state.folders.creating;
@@ -5596,7 +5640,7 @@ const DialogSearchFacets = (props) => {
5596
5640
  children: [t2, children]
5597
5641
  }), $[3] = children, $[4] = handleClose, $[5] = id, $[6] = t3) : t3 = $[6], t3;
5598
5642
  }, DialogTagCreate = (props) => {
5599
- let $ = c(37), { children, dialog: t0 } = props, { id } = t0, dispatch = useDispatch(), creating = useTypedSelector(_temp$25), creatingError = useTypedSelector(_temp2$12), t1;
5643
+ let $ = c(36), { children, dialog: t0 } = props, { id } = t0, dispatch = useDispatch(), creating = useTypedSelector(_temp$25), creatingError = useTypedSelector(_temp2$12), t1;
5600
5644
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = { name: "" }, $[0] = t1) : t1 = $[0];
5601
5645
  let t2;
5602
5646
  $[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {
@@ -5617,55 +5661,55 @@ const DialogSearchFacets = (props) => {
5617
5661
  $[6] !== creatingError || $[7] !== setError ? (t6 = () => {
5618
5662
  creatingError && setError("name", { message: creatingError?.message });
5619
5663
  }, t7 = [creatingError, setError], $[6] = creatingError, $[7] = setError, $[8] = t6, $[9] = t7) : (t6 = $[8], t7 = $[9]), useEffect(t6, t7);
5620
- let t8;
5621
- $[10] !== formUpdating || $[11] !== handleSubmit || $[12] !== isDirty || $[13] !== isValid || $[14] !== onSubmit ? (t8 = () => /* @__PURE__ */ jsx(Box, {
5664
+ let t8 = formUpdating || !isDirty || !isValid, t9;
5665
+ $[10] !== handleSubmit || $[11] !== onSubmit ? (t9 = handleSubmit(onSubmit), $[10] = handleSubmit, $[11] = onSubmit, $[12] = t9) : t9 = $[12];
5666
+ let t10;
5667
+ $[13] !== isValid || $[14] !== t8 || $[15] !== t9 ? (t10 = /* @__PURE__ */ jsx(Box, {
5622
5668
  padding: 3,
5623
5669
  children: /* @__PURE__ */ jsx(Flex, {
5624
5670
  justify: "flex-end",
5625
5671
  children: /* @__PURE__ */ jsx(FormSubmitButton, {
5626
- disabled: formUpdating || !isDirty || !isValid,
5672
+ disabled: t8,
5627
5673
  isValid,
5628
- onClick: handleSubmit(onSubmit)
5674
+ onClick: t9
5629
5675
  })
5630
5676
  })
5631
- }), $[10] = formUpdating, $[11] = handleSubmit, $[12] = isDirty, $[13] = isValid, $[14] = onSubmit, $[15] = t8) : t8 = $[15];
5632
- let Footer = t8, t9;
5633
- $[16] === Footer ? t9 = $[17] : (t9 = /* @__PURE__ */ jsx(Footer, {}), $[16] = Footer, $[17] = t9);
5634
- let t10;
5635
- $[18] !== handleSubmit || $[19] !== onSubmit ? (t10 = handleSubmit(onSubmit), $[18] = handleSubmit, $[19] = onSubmit, $[20] = t10) : t10 = $[20];
5636
- let t11;
5637
- $[21] === Symbol.for("react.memo_cache_sentinel") ? (t11 = /* @__PURE__ */ jsx("button", {
5677
+ }), $[13] = isValid, $[14] = t8, $[15] = t9, $[16] = t10) : t10 = $[16];
5678
+ let footer = t10, t11;
5679
+ $[17] !== handleSubmit || $[18] !== onSubmit ? (t11 = handleSubmit(onSubmit), $[17] = handleSubmit, $[18] = onSubmit, $[19] = t11) : t11 = $[19];
5680
+ let t12;
5681
+ $[20] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsx("button", {
5638
5682
  style: { display: "none" },
5639
5683
  tabIndex: -1,
5640
5684
  type: "submit"
5641
- }), $[21] = t11) : t11 = $[21];
5642
- let t12;
5643
- $[22] === register ? t12 = $[23] : (t12 = register("name"), $[22] = register, $[23] = t12);
5644
- let t13 = errors?.name?.message, t14;
5645
- $[24] !== formUpdating || $[25] !== t12 || $[26] !== t13 ? (t14 = /* @__PURE__ */ jsx(FormFieldInputText, {
5646
- ...t12,
5685
+ }), $[20] = t12) : t12 = $[20];
5686
+ let t13;
5687
+ $[21] === register ? t13 = $[22] : (t13 = register("name"), $[21] = register, $[22] = t13);
5688
+ let t14 = errors?.name?.message, t15;
5689
+ $[23] !== formUpdating || $[24] !== t13 || $[25] !== t14 ? (t15 = /* @__PURE__ */ jsx(FormFieldInputText, {
5690
+ ...t13,
5647
5691
  disabled: formUpdating,
5648
- error: t13,
5692
+ error: t14,
5649
5693
  label: "Name",
5650
5694
  name: "name"
5651
- }), $[24] = formUpdating, $[25] = t12, $[26] = t13, $[27] = t14) : t14 = $[27];
5652
- let t15;
5653
- $[28] !== t10 || $[29] !== t14 ? (t15 = /* @__PURE__ */ jsxs(Box, {
5695
+ }), $[23] = formUpdating, $[24] = t13, $[25] = t14, $[26] = t15) : t15 = $[26];
5696
+ let t16;
5697
+ $[27] !== t11 || $[28] !== t15 ? (t16 = /* @__PURE__ */ jsxs(Box, {
5654
5698
  as: "form",
5655
5699
  padding: 4,
5656
- onSubmit: t10,
5657
- children: [t11, t14]
5658
- }), $[28] = t10, $[29] = t14, $[30] = t15) : t15 = $[30];
5659
- let t16;
5660
- return $[31] !== children || $[32] !== handleClose || $[33] !== id || $[34] !== t15 || $[35] !== t9 ? (t16 = /* @__PURE__ */ jsxs(Dialog$1, {
5700
+ onSubmit: t11,
5701
+ children: [t12, t15]
5702
+ }), $[27] = t11, $[28] = t15, $[29] = t16) : t16 = $[29];
5703
+ let t17;
5704
+ return $[30] !== children || $[31] !== footer || $[32] !== handleClose || $[33] !== id || $[34] !== t16 ? (t17 = /* @__PURE__ */ jsxs(Dialog$1, {
5661
5705
  animate: !0,
5662
- footer: t9,
5706
+ footer,
5663
5707
  header: "Create Tag",
5664
5708
  id,
5665
5709
  onClose: handleClose,
5666
5710
  width: 1,
5667
- children: [t15, children]
5668
- }), $[31] = children, $[32] = handleClose, $[33] = id, $[34] = t15, $[35] = t9, $[36] = t16) : t16 = $[36], t16;
5711
+ children: [t16, children]
5712
+ }), $[30] = children, $[31] = footer, $[32] = handleClose, $[33] = id, $[34] = t16, $[35] = t17) : t17 = $[35], t17;
5669
5713
  };
5670
5714
  function _temp$25(state) {
5671
5715
  return state.tags.creating;
@@ -5674,7 +5718,7 @@ function _temp2$12(state_0) {
5674
5718
  return state_0.tags.creatingError;
5675
5719
  }
5676
5720
  const DialogTagEdit = (props) => {
5677
- let $ = c(64), { children, dialog: t0 } = props, { id, tagId } = t0, client = useVersionedClient(), dispatch = useDispatch(), t1;
5721
+ let $ = c(68), { children, dialog: t0 } = props, { id, tagId } = t0, client = useVersionedClient(), dispatch = useDispatch(), t1;
5678
5722
  $[0] === tagId ? t1 = $[1] : (t1 = (state) => selectTagById(state, String(tagId)), $[0] = tagId, $[1] = t1);
5679
5723
  let tagItem = useTypedSelector(t1), [tagSnapshot, setTagSnapshot] = useState(tagItem?.tag), currentTag = tagItem ? tagItem?.tag : tagSnapshot, generateDefaultValues = _temp$24, t2 = tagItem?.tag, t3;
5680
5724
  $[2] === t2 ? t3 = $[3] : (t3 = generateDefaultValues(t2), $[2] = t2, $[3] = t3);
@@ -5736,33 +5780,37 @@ const DialogTagEdit = (props) => {
5736
5780
  t15
5737
5781
  ], $[28] = client, $[29] = handleTagUpdate, $[30] = t15, $[31] = t16) : t16 = $[31], useEffect(t14, t16);
5738
5782
  let t17;
5739
- $[32] !== formUpdating || $[33] !== handleDelete || $[34] !== handleSubmit || $[35] !== isDirty || $[36] !== isValid || $[37] !== onSubmit || $[38] !== tagItem?.tag?._updatedAt ? (t17 = () => /* @__PURE__ */ jsx(Box, {
5783
+ $[32] !== formUpdating || $[33] !== handleDelete ? (t17 = /* @__PURE__ */ jsx(Button, {
5784
+ disabled: formUpdating,
5785
+ fontSize: 1,
5786
+ mode: "bleed",
5787
+ onClick: handleDelete,
5788
+ text: "Delete",
5789
+ tone: "critical"
5790
+ }), $[32] = formUpdating, $[33] = handleDelete, $[34] = t17) : t17 = $[34];
5791
+ let t18 = formUpdating || !isDirty || !isValid, t19 = tagItem?.tag?._updatedAt, t20;
5792
+ $[35] !== handleSubmit || $[36] !== onSubmit ? (t20 = handleSubmit(onSubmit), $[35] = handleSubmit, $[36] = onSubmit, $[37] = t20) : t20 = $[37];
5793
+ let t21;
5794
+ $[38] !== isValid || $[39] !== t18 || $[40] !== t19 || $[41] !== t20 ? (t21 = /* @__PURE__ */ jsx(FormSubmitButton, {
5795
+ disabled: t18,
5796
+ isValid,
5797
+ lastUpdated: t19,
5798
+ onClick: t20
5799
+ }), $[38] = isValid, $[39] = t18, $[40] = t19, $[41] = t20, $[42] = t21) : t21 = $[42];
5800
+ let t22;
5801
+ $[43] !== t17 || $[44] !== t21 ? (t22 = /* @__PURE__ */ jsx(Box, {
5740
5802
  padding: 3,
5741
5803
  children: /* @__PURE__ */ jsxs(Flex, {
5742
5804
  justify: "space-between",
5743
- children: [/* @__PURE__ */ jsx(Button, {
5744
- disabled: formUpdating,
5745
- fontSize: 1,
5746
- mode: "bleed",
5747
- onClick: handleDelete,
5748
- text: "Delete",
5749
- tone: "critical"
5750
- }), /* @__PURE__ */ jsx(FormSubmitButton, {
5751
- disabled: formUpdating || !isDirty || !isValid,
5752
- isValid,
5753
- lastUpdated: tagItem?.tag?._updatedAt,
5754
- onClick: handleSubmit(onSubmit)
5755
- })]
5805
+ children: [t17, t21]
5756
5806
  })
5757
- }), $[32] = formUpdating, $[33] = handleDelete, $[34] = handleSubmit, $[35] = isDirty, $[36] = isValid, $[37] = onSubmit, $[38] = tagItem?.tag?._updatedAt, $[39] = t17) : t17 = $[39];
5758
- let Footer = t17;
5807
+ }), $[43] = t17, $[44] = t21, $[45] = t22) : t22 = $[45];
5808
+ let footer = t22;
5759
5809
  if (!currentTag) return null;
5760
- let t18;
5761
- $[40] === Footer ? t18 = $[41] : (t18 = /* @__PURE__ */ jsx(Footer, {}), $[40] = Footer, $[41] = t18);
5762
- let t19;
5763
- $[42] !== handleSubmit || $[43] !== onSubmit ? (t19 = handleSubmit(onSubmit), $[42] = handleSubmit, $[43] = onSubmit, $[44] = t19) : t19 = $[44];
5764
- let t20;
5765
- $[45] === tagItem ? t20 = $[46] : (t20 = !tagItem && /* @__PURE__ */ jsx(Card, {
5810
+ let t23;
5811
+ $[46] !== handleSubmit || $[47] !== onSubmit ? (t23 = handleSubmit(onSubmit), $[46] = handleSubmit, $[47] = onSubmit, $[48] = t23) : t23 = $[48];
5812
+ let t24;
5813
+ $[49] === tagItem ? t24 = $[50] : (t24 = !tagItem && /* @__PURE__ */ jsx(Card, {
5766
5814
  marginBottom: 3,
5767
5815
  padding: 3,
5768
5816
  radius: 2,
@@ -5772,44 +5820,44 @@ const DialogTagEdit = (props) => {
5772
5820
  size: 1,
5773
5821
  children: "This tag cannot be found – it may have been deleted."
5774
5822
  })
5775
- }), $[45] = tagItem, $[46] = t20);
5776
- let t21;
5777
- $[47] === Symbol.for("react.memo_cache_sentinel") ? (t21 = /* @__PURE__ */ jsx("button", {
5823
+ }), $[49] = tagItem, $[50] = t24);
5824
+ let t25;
5825
+ $[51] === Symbol.for("react.memo_cache_sentinel") ? (t25 = /* @__PURE__ */ jsx("button", {
5778
5826
  style: { display: "none" },
5779
5827
  tabIndex: -1,
5780
5828
  type: "submit"
5781
- }), $[47] = t21) : t21 = $[47];
5782
- let t22;
5783
- $[48] === register ? t22 = $[49] : (t22 = register("name"), $[48] = register, $[49] = t22);
5784
- let t23 = errors?.name?.message, t24;
5785
- $[50] !== formUpdating || $[51] !== t22 || $[52] !== t23 ? (t24 = /* @__PURE__ */ jsx(FormFieldInputText, {
5786
- ...t22,
5829
+ }), $[51] = t25) : t25 = $[51];
5830
+ let t26;
5831
+ $[52] === register ? t26 = $[53] : (t26 = register("name"), $[52] = register, $[53] = t26);
5832
+ let t27 = errors?.name?.message, t28;
5833
+ $[54] !== formUpdating || $[55] !== t26 || $[56] !== t27 ? (t28 = /* @__PURE__ */ jsx(FormFieldInputText, {
5834
+ ...t26,
5787
5835
  disabled: formUpdating,
5788
- error: t23,
5836
+ error: t27,
5789
5837
  label: "Name",
5790
5838
  name: "name"
5791
- }), $[50] = formUpdating, $[51] = t22, $[52] = t23, $[53] = t24) : t24 = $[53];
5792
- let t25;
5793
- $[54] !== t19 || $[55] !== t20 || $[56] !== t24 ? (t25 = /* @__PURE__ */ jsxs(Box, {
5839
+ }), $[54] = formUpdating, $[55] = t26, $[56] = t27, $[57] = t28) : t28 = $[57];
5840
+ let t29;
5841
+ $[58] !== t23 || $[59] !== t24 || $[60] !== t28 ? (t29 = /* @__PURE__ */ jsxs(Box, {
5794
5842
  as: "form",
5795
5843
  padding: 4,
5796
- onSubmit: t19,
5844
+ onSubmit: t23,
5797
5845
  children: [
5798
- t20,
5799
- t21,
5800
- t24
5846
+ t24,
5847
+ t25,
5848
+ t28
5801
5849
  ]
5802
- }), $[54] = t19, $[55] = t20, $[56] = t24, $[57] = t25) : t25 = $[57];
5803
- let t26;
5804
- return $[58] !== children || $[59] !== handleClose || $[60] !== id || $[61] !== t18 || $[62] !== t25 ? (t26 = /* @__PURE__ */ jsxs(Dialog$1, {
5850
+ }), $[58] = t23, $[59] = t24, $[60] = t28, $[61] = t29) : t29 = $[61];
5851
+ let t30;
5852
+ return $[62] !== children || $[63] !== footer || $[64] !== handleClose || $[65] !== id || $[66] !== t29 ? (t30 = /* @__PURE__ */ jsxs(Dialog$1, {
5805
5853
  animate: !0,
5806
- footer: t18,
5854
+ footer,
5807
5855
  header: "Edit Tag",
5808
5856
  id,
5809
5857
  onClose: handleClose,
5810
5858
  width: 1,
5811
- children: [t25, children]
5812
- }), $[58] = children, $[59] = handleClose, $[60] = id, $[61] = t18, $[62] = t25, $[63] = t26) : t26 = $[63], t26;
5859
+ children: [t29, children]
5860
+ }), $[62] = children, $[63] = footer, $[64] = handleClose, $[65] = id, $[66] = t29, $[67] = t30) : t30 = $[67], t30;
5813
5861
  };
5814
5862
  function _temp$24(tag) {
5815
5863
  return { name: tag?.name?.current || "" };
@@ -6417,6 +6465,7 @@ function createReduxStore(props) {
6417
6465
  ...initialState$1,
6418
6466
  assetTypes: isSupportedAssetType(props?.assetType) ? [props.assetType] : ["file", "image"],
6419
6467
  excludeTagSlugs: props.excludeTagSlugs?.length ? [...props.excludeTagSlugs] : [],
6468
+ localeIds: props.locales?.length ? props.locales.map((locale) => locale.id) : [],
6420
6469
  showMediaLibraryAssets: props.showMediaLibraryAssets ?? !0
6421
6470
  },
6422
6471
  debug: {
@@ -8535,7 +8584,7 @@ const BrowserContent = (t0) => {
8535
8584
  children: t9
8536
8585
  }), $[11] = portalElement, $[12] = t9, $[13] = t10) : t10 = $[13], t10;
8537
8586
  }, Browser = (props) => {
8538
- let $ = c(16), client = useVersionedClient(), { excludeTagSlugs, showMediaLibraryAssets } = useToolOptions(), t0 = props?.assetType, t1 = props?.document, t2 = props?.selectedAssets, t3 = props?.isMultiSelect, t4 = props?.onSelect, t5;
8587
+ let $ = c(17), client = useVersionedClient(), { excludeTagSlugs, locales, showMediaLibraryAssets } = useToolOptions(), t0 = props?.assetType, t1 = props?.document, t2 = props?.selectedAssets, t3 = props?.isMultiSelect, t4 = props?.onSelect, t5;
8539
8588
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t5 = /* @__PURE__ */ jsx(GlobalStyle, {}), $[0] = t5) : t5 = $[0];
8540
8589
  let t6 = props?.onClose, t7 = props?.schemaType, t8;
8541
8590
  $[1] !== t6 || $[2] !== t7 ? (t8 = /* @__PURE__ */ jsx(BrowserContent, {
@@ -8549,15 +8598,16 @@ const BrowserContent = (t0) => {
8549
8598
  children: [t5, t8]
8550
8599
  }), $[4] = t3, $[5] = t4, $[6] = t8, $[7] = t9) : t9 = $[7];
8551
8600
  let t10;
8552
- return $[8] !== client || $[9] !== excludeTagSlugs || $[10] !== showMediaLibraryAssets || $[11] !== t0 || $[12] !== t1 || $[13] !== t2 || $[14] !== t9 ? (t10 = /* @__PURE__ */ jsx(ReduxProvider, {
8601
+ return $[8] !== client || $[9] !== excludeTagSlugs || $[10] !== locales || $[11] !== showMediaLibraryAssets || $[12] !== t0 || $[13] !== t1 || $[14] !== t2 || $[15] !== t9 ? (t10 = /* @__PURE__ */ jsx(ReduxProvider, {
8553
8602
  assetType: t0,
8554
8603
  client,
8555
8604
  document: t1,
8556
8605
  excludeTagSlugs,
8606
+ locales,
8557
8607
  selectedAssets: t2,
8558
8608
  showMediaLibraryAssets,
8559
8609
  children: t9
8560
- }), $[8] = client, $[9] = excludeTagSlugs, $[10] = showMediaLibraryAssets, $[11] = t0, $[12] = t1, $[13] = t2, $[14] = t9, $[15] = t10) : t10 = $[15], t10;
8610
+ }), $[8] = client, $[9] = excludeTagSlugs, $[10] = locales, $[11] = showMediaLibraryAssets, $[12] = t0, $[13] = t1, $[14] = t2, $[15] = t9, $[16] = t10) : t10 = $[16], t10;
8561
8611
  }, FormBuilderTool = (props) => {
8562
8612
  let $ = c(13), { onClose } = props, portalElement = useRootPortalElement(), t0;
8563
8613
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [], $[0] = t0) : t0 = $[0];