sanity 6.1.0-next.31 → 6.1.0-next.32

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.
@@ -1,4 +1,4 @@
1
- var version = "6.1.0-next.31+528b0c3105";
1
+ var version = "6.1.0-next.32+37e9ad1c1f";
2
2
  let buildVersion;
3
3
  try {
4
4
  buildVersion = process.env.PKG_BUILD_VERSION;
@@ -7,7 +7,7 @@ try {
7
7
  try {
8
8
  buildVersion = buildVersion || // This is replaced by `@sanity/pkg-utils` at build time
9
9
  // and must always be references by its full static name, e.g. no optional chaining, no `if (process && process.env)` etc.
10
- "6.1.0-next.31+528b0c3105";
10
+ "6.1.0-next.32+37e9ad1c1f";
11
11
  } catch {
12
12
  }
13
13
  const SANITY_VERSION = buildVersion || `${version}-dev`;
package/lib/index.js CHANGED
@@ -9803,7 +9803,7 @@ function useTimelineStore(t0) {
9803
9803
  $[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t10 = () => timelineStateRef.current, $[23] = t10) : t10 = $[23];
9804
9804
  let t11;
9805
9805
  $[24] !== onError || $[25] !== timelineController$ ? (t11 = (callback) => {
9806
- const subscription = timelineController$.pipe(map$1(_temp3$T), distinctUntilChanged$1(deepEquals), catchError$1((err_0) => (onError?.(err_0), of(INITIAL_TIMELINE_STATE))), tap$1((timelineState) => {
9806
+ const subscription = timelineController$.pipe(map$1(_temp3$U), distinctUntilChanged$1(deepEquals), catchError$1((err_0) => (onError?.(err_0), of(INITIAL_TIMELINE_STATE))), tap$1((timelineState) => {
9807
9807
  timelineStateRef.current = timelineState;
9808
9808
  }), tap$1(callback)).subscribe();
9809
9809
  return () => subscription.unsubscribe();
@@ -9817,7 +9817,7 @@ function useTimelineStore(t0) {
9817
9817
  subscribe: t11
9818
9818
  }, $[27] = t11, $[28] = t7, $[29] = t8, $[30] = t9, $[31] = t12) : t12 = $[31], t12;
9819
9819
  }
9820
- function _temp3$T(innerController_0) {
9820
+ function _temp3$U(innerController_0) {
9821
9821
  const chunks = innerController_0.timeline.mapChunks(_temp$4d), lastNonDeletedChunk = chunks.filter(_temp2$1O), hasMoreChunks = !innerController_0.timeline.reachedEarliestEntry;
9822
9822
  hasMoreChunks && chunks.length > 16 && innerController_0.setLoadMore(!1);
9823
9823
  const timelineReady = !["invalid", "loading"].includes(innerController_0.selectionState);
@@ -16900,7 +16900,7 @@ function useDivergenceNavigator(t0) {
16900
16900
  $[9] !== divergences ? (t102 = combineLatest({
16901
16901
  divergences,
16902
16902
  schemaType: schemaTypeContext.pipe(filter$1(_temp$3W)),
16903
- formState: formStateContext.pipe(filter$1(_temp2$1I), distinctUntilChanged$1(_temp3$S), map$1(_temp4$o))
16903
+ formState: formStateContext.pipe(filter$1(_temp2$1I), distinctUntilChanged$1(_temp3$T), map$1(_temp4$o))
16904
16904
  }), $[9] = divergences, $[10] = t102) : t102 = $[10], t9 = t102;
16905
16905
  }
16906
16906
  const context = t9;
@@ -16960,7 +16960,7 @@ function useDivergenceNavigator(t0) {
16960
16960
  function _temp4$o(state) {
16961
16961
  return state && pick(state, ["groups", "_allMembers"]);
16962
16962
  }
16963
- function _temp3$S(previous, current) {
16963
+ function _temp3$T(previous, current) {
16964
16964
  return previous.value?._id === current.value?._id;
16965
16965
  }
16966
16966
  function _temp2$1I(value_0) {
@@ -17832,7 +17832,7 @@ function useCollateDivergencesContext(t0) {
17832
17832
  let t14;
17833
17833
  $[32] !== context ? (t14 = (nextContext) => context.next(nextContext), $[32] = context, $[33] = t14) : t14 = $[33], t13 = combineLatest({
17834
17834
  upstreamHead: listenUpstreamHead.pipe(filter$1(_temp2$1H)),
17835
- subjectHead: listenSubjectHead.pipe(filter$1(_temp3$R)),
17835
+ subjectHead: listenSubjectHead.pipe(filter$1(_temp3$S)),
17836
17836
  resolutions: listenResolutions.pipe(map$1(_temp4$n)),
17837
17837
  upstreamAtFork: readUpstreamAtFork.pipe(filter$1(_temp5$d), map$1(_temp6$7), filter$1(_temp7$3))
17838
17838
  }).pipe(tap$1(t14)), $[29] = context, $[30] = readUpstreamAtFork, $[31] = t13;
@@ -17855,7 +17855,7 @@ function _temp5$d(revision) {
17855
17855
  function _temp4$n(nextResolutions) {
17856
17856
  return nextResolutions ?? [];
17857
17857
  }
17858
- function _temp3$R(document_0) {
17858
+ function _temp3$S(document_0) {
17859
17859
  return typeof document_0 < "u" && document_0 !== null;
17860
17860
  }
17861
17861
  function _temp2$1H(document2) {
@@ -18083,7 +18083,7 @@ function useDivergenceController(divergence, allDivergences, contextReadOnly) {
18083
18083
  }) : of(state).pipe(filter$1(_temp$3U), map$1(_temp2$1G), switchMap$1((document_0) => document_0 ? of(get$1(document_0, path)).pipe(map$1((value) => ({
18084
18084
  value,
18085
18085
  document: document_0
18086
- })), startWith$1(void 0)) : EMPTY$5), map$1(_temp3$Q)), $[10] = path, $[11] = t32) : t32 = $[11], t2 = getDocumentAtRevision({
18086
+ })), startWith$1(void 0)) : EMPTY$5), map$1(_temp3$R)), $[10] = path, $[11] = t32) : t32 = $[11], t2 = getDocumentAtRevision({
18087
18087
  client,
18088
18088
  documentId: upstreamId,
18089
18089
  revisionId: upstreamRevisionId
@@ -18170,7 +18170,7 @@ function _temp5$c(value_2) {
18170
18170
  function _temp4$m(document_1) {
18171
18171
  return document_1 !== null;
18172
18172
  }
18173
- function _temp3$Q(value_0) {
18173
+ function _temp3$R(value_0) {
18174
18174
  return {
18175
18175
  isLoading: !1,
18176
18176
  value: value_0
@@ -20384,13 +20384,13 @@ function HumanizedList(props2) {
20384
20384
  let T0, t1;
20385
20385
  if ($[1] !== listFormat || $[2] !== props2.values) {
20386
20386
  const parts = listFormat.formatToParts(props2.values);
20387
- T0 = Fragment, t1 = parts.map(_temp3$P), $[1] = listFormat, $[2] = props2.values, $[3] = T0, $[4] = t1;
20387
+ T0 = Fragment, t1 = parts.map(_temp3$Q), $[1] = listFormat, $[2] = props2.values, $[3] = T0, $[4] = t1;
20388
20388
  } else
20389
20389
  T0 = $[3], t1 = $[4];
20390
20390
  let t2;
20391
20391
  return $[5] !== T0 || $[6] !== t1 ? (t2 = /* @__PURE__ */ jsx(T0, { children: t1 }), $[5] = T0, $[6] = t1, $[7] = t2) : t2 = $[7], t2;
20392
20392
  }
20393
- function _temp3$P(segment) {
20393
+ function _temp3$Q(segment) {
20394
20394
  return segment.type === "element" ? /* @__PURE__ */ jsx("code", { children: segment.value }, segment.value) : segment.value;
20395
20395
  }
20396
20396
  const HeaderButton = styled.button.withConfig({
@@ -21064,7 +21064,7 @@ function ReferenceInput(props2) {
21064
21064
  !hadFocusAtRef && hasFocusAtRef && elementProps.ref.current?.focus();
21065
21065
  }, $[47] = elementProps, $[48] = t13) : t13 = $[48], useDidUpdate(focusPath?.[0] === "_ref", t13);
21066
21066
  let t14;
21067
- $[49] !== searchState.hits ? (t14 = searchState.hits.map(_temp3$O), $[49] = searchState.hits, $[50] = t14) : t14 = $[50];
21067
+ $[49] !== searchState.hits ? (t14 = searchState.hits.map(_temp3$P), $[49] = searchState.hits, $[50] = t14) : t14 = $[50];
21068
21068
  const hits_0 = t14, isEditing = focusPath.length === 1 && focusPath[0] === "_ref", {
21069
21069
  menuRef,
21070
21070
  menuButtonRef,
@@ -21109,7 +21109,7 @@ function ReferenceInput(props2) {
21109
21109
  let t30;
21110
21110
  return $[103] !== props2.elementProps.style || $[104] !== t29 ? (t30 = /* @__PURE__ */ jsx("div", { style: t17, children: t29 }), $[103] = props2.elementProps.style, $[104] = t29, $[105] = t30) : t30 = $[105], t30;
21111
21111
  }
21112
- function _temp3$O(hit_0) {
21112
+ function _temp3$P(hit_0) {
21113
21113
  return {
21114
21114
  value: hit_0.id,
21115
21115
  hit: hit_0
@@ -21281,7 +21281,7 @@ function StudioReferenceInput(props2) {
21281
21281
  schemaType,
21282
21282
  document: documentValue,
21283
21283
  valuePath: path
21284
- }).map(_temp3$N);
21284
+ }).map(_temp3$O);
21285
21285
  t92 = (initialValueTemplateItems || []).filter((i) => allowedTypes.includes(i.template?.schemaType ?? "")).map(_temp4$l).filter(isNonNullable$2), $[35] = documentValue, $[36] = initialValueTemplateItems, $[37] = path, $[38] = schemaType, $[39] = t92;
21286
21286
  } else
21287
21287
  t92 = $[39];
@@ -21311,7 +21311,7 @@ function _temp4$l(item) {
21311
21311
  }
21312
21312
  } : void 0;
21313
21313
  }
21314
- function _temp3$N(opt) {
21314
+ function _temp3$O(opt) {
21315
21315
  return opt.type;
21316
21316
  }
21317
21317
  function _temp2$1z(t0) {
@@ -22930,7 +22930,7 @@ function ArrayOfObjectsField(props2) {
22930
22930
  break bb183;
22931
22931
  }
22932
22932
  case "error": {
22933
- event_4.files.forEach(_temp3$M), toast.push({
22933
+ event_4.files.forEach(_temp3$N), toast.push({
22934
22934
  status: "error",
22935
22935
  description: t("asset-sources.common.uploader.upload-failed.description"),
22936
22936
  title: t("asset-sources.common.uploader.upload-failed.title")
@@ -23020,7 +23020,7 @@ function ArrayOfObjectsField(props2) {
23020
23020
  assetSourceUploadComponents
23021
23021
  ] }), $[141] = assetSourceUploadComponents, $[142] = handleChange, $[143] = onFieldGroupSelect, $[144] = onPathBlur, $[145] = onPathFocus, $[146] = onPathOpen, $[147] = onSetFieldSetCollapsed, $[148] = onSetPathCollapsed, $[149] = t33, $[150] = t34) : t34 = $[150], t34;
23022
23022
  }
23023
- function _temp3$M(_file) {
23023
+ function _temp3$N(_file) {
23024
23024
  console.error(_file.error);
23025
23025
  }
23026
23026
  function _temp2$1y(item) {
@@ -23556,7 +23556,7 @@ function PrimitiveField(props2) {
23556
23556
  }
23557
23557
  const validation2 = t14;
23558
23558
  let t15;
23559
- $[44] !== validation2 ? (t15 = validation2.filter(_temp2$1w).map(_temp3$L).join(`
23559
+ $[44] !== validation2 ? (t15 = validation2.filter(_temp2$1w).map(_temp3$M).join(`
23560
23560
  `) || void 0, $[44] = validation2, $[45] = t15) : t15 = $[45];
23561
23561
  const validationError = t15, t16 = member.field.value, t17 = member.field.schemaType, t18 = member.field.displayInlineChanges ?? !1;
23562
23562
  let t19;
@@ -23585,7 +23585,7 @@ function PrimitiveField(props2) {
23585
23585
  let t24;
23586
23586
  return $[67] !== fieldActions || $[68] !== member.field.changed || $[69] !== member.field.id || $[70] !== member.field.level || $[71] !== member.field.path || $[72] !== member.field.presence || $[73] !== member.field.schemaType.description || $[74] !== member.field.schemaType.title || $[75] !== member.index || $[76] !== member.name || $[77] !== renderField || $[78] !== t20 || $[79] !== t21 || $[80] !== t22 || $[81] !== t23 || $[82] !== validation2 ? (t24 = /* @__PURE__ */ jsx(RenderField, { actions: fieldActions, changed: member.field.changed, description: member.field.schemaType.description, index: member.index, inputId: member.field.id, inputProps: t20, level: member.field.level, name: member.name, path: member.field.path, presence: member.field.presence, schemaType: t21, title: member.field.schemaType.title, validation: validation2, value: t22, render: renderField, children: t23 }), $[67] = fieldActions, $[68] = member.field.changed, $[69] = member.field.id, $[70] = member.field.level, $[71] = member.field.path, $[72] = member.field.presence, $[73] = member.field.schemaType.description, $[74] = member.field.schemaType.title, $[75] = member.index, $[76] = member.name, $[77] = renderField, $[78] = t20, $[79] = t21, $[80] = t22, $[81] = t23, $[82] = validation2, $[83] = t24) : t24 = $[83], t24;
23587
23587
  }
23588
- function _temp3$L(item_1) {
23588
+ function _temp3$M(item_1) {
23589
23589
  return item_1.message;
23590
23590
  }
23591
23591
  function _temp2$1w(item_0) {
@@ -23870,7 +23870,7 @@ const InvalidValueInput = forwardRef((props2, ref) => {
23870
23870
  let t11;
23871
23871
  $[32] !== t || $[33] !== validTypes.length ? (t11 = validTypes.length !== 1 && /* @__PURE__ */ jsx(Text$1, { as: "p", muted: !0, size: 1, children: t("inputs.invalid-value.details.multi-type-description") }), $[32] = t, $[33] = validTypes.length, $[34] = t11) : t11 = $[34];
23872
23872
  let t12;
23873
- $[35] !== validTypes ? (t12 = validTypes.length !== 1 && /* @__PURE__ */ jsx(Stack, { as: "ul", space: 2, children: validTypes.map(_temp3$K) }), $[35] = validTypes, $[36] = t12) : t12 = $[36];
23873
+ $[35] !== validTypes ? (t12 = validTypes.length !== 1 && /* @__PURE__ */ jsx(Stack, { as: "ul", space: 2, children: validTypes.map(_temp3$L) }), $[35] = validTypes, $[36] = t12) : t12 = $[36];
23874
23874
  let t13;
23875
23875
  $[37] !== actualType ? (t13 = {
23876
23876
  actualType
@@ -23931,7 +23931,7 @@ function _temp2$1v() {
23931
23931
  focus: _temp$3y
23932
23932
  };
23933
23933
  }
23934
- function _temp3$K(validType) {
23934
+ function _temp3$L(validType) {
23935
23935
  return /* @__PURE__ */ jsx(Text$1, { as: "li", children: /* @__PURE__ */ jsx("code", { children: validType }) }, validType);
23936
23936
  }
23937
23937
  const FormCell = styled.div.withConfig({
@@ -24184,7 +24184,7 @@ function FormFieldValidationStatus(props2) {
24184
24184
  let t1;
24185
24185
  $[0] !== showSummary || $[1] !== validation2 ? (t1 = showSummary && /* @__PURE__ */ jsx(FormFieldValidationSummary, { validation: validation2 }), $[0] = showSummary, $[1] = validation2, $[2] = t1) : t1 = $[2];
24186
24186
  let t2;
24187
- $[3] !== showSummary || $[4] !== validation2 ? (t2 = !showSummary && /* @__PURE__ */ jsx(Fragment$1, { children: validation2.map(_temp3$J) }), $[3] = showSummary, $[4] = validation2, $[5] = t2) : t2 = $[5];
24187
+ $[3] !== showSummary || $[4] !== validation2 ? (t2 = !showSummary && /* @__PURE__ */ jsx(Fragment$1, { children: validation2.map(_temp3$K) }), $[3] = showSummary, $[4] = validation2, $[5] = t2) : t2 = $[5];
24188
24188
  let t3;
24189
24189
  $[6] !== t1 || $[7] !== t2 ? (t3 = /* @__PURE__ */ jsxs(StyledStack, { space: 3, children: [
24190
24190
  t1,
@@ -24199,7 +24199,7 @@ function FormFieldValidationStatus(props2) {
24199
24199
  let t7;
24200
24200
  return $[15] !== placement || $[16] !== t3 || $[17] !== t6 ? (t7 = /* @__PURE__ */ jsx(Tooltip, { content: t3, portal: !0, placement, fallbackPlacements: t4, children: t6 }), $[15] = placement, $[16] = t3, $[17] = t6, $[18] = t7) : t7 = $[18], t7;
24201
24201
  }
24202
- function _temp3$J(item, itemIndex) {
24202
+ function _temp3$K(item, itemIndex) {
24203
24203
  return /* @__PURE__ */ jsx(FormFieldValidationStatusItem, { validation: item }, itemIndex);
24204
24204
  }
24205
24205
  function _temp2$1u(v_0) {
@@ -26321,7 +26321,7 @@ function fileTarget(Component2) {
26321
26321
  }, t6 = [pasteTarget, handlePaste], $[16] = handlePaste, $[17] = pasteTarget, $[18] = t5, $[19] = t6) : (t5 = $[18], t6 = $[19]), useEffect(t5, t6);
26322
26322
  let t7;
26323
26323
  $[20] !== emitFiles || $[21] !== onFiles || $[22] !== onFilesOut ? (t7 = (event_2) => {
26324
- if (enteredElements.current = [], Array.from(event_2.dataTransfer.items).map(_temp2$1r).some(_temp3$I))
26324
+ if (enteredElements.current = [], Array.from(event_2.dataTransfer.items).map(_temp2$1r).some(_temp3$J))
26325
26325
  return;
26326
26326
  event_2.preventDefault(), event_2.stopPropagation();
26327
26327
  const dataTransfer = event_2.nativeEvent.dataTransfer;
@@ -26393,7 +26393,7 @@ function _temp2$1r(item) {
26393
26393
  kind: item.kind
26394
26394
  };
26395
26395
  }
26396
- function _temp3$I(item_0) {
26396
+ function _temp3$J(item_0) {
26397
26397
  return isPortableTextItem(item_0);
26398
26398
  }
26399
26399
  function _temp4$j(item_1) {
@@ -26524,7 +26524,7 @@ function uploadTarget$1(Component2) {
26524
26524
  title: t("inputs.array.error.cannot-upload-unable-to-convert", {
26525
26525
  count: rejected.length
26526
26526
  }),
26527
- description: rejected.map(_temp3$H)
26527
+ description: rejected.map(_temp3$I)
26528
26528
  });
26529
26529
  }, $[20] = pushToast, $[21] = t, $[22] = t6) : t6 = $[22];
26530
26530
  const alertRejectedFiles = t6;
@@ -26707,7 +26707,7 @@ function _temp$3m(type) {
26707
26707
  function _temp2$1q(type_0) {
26708
26708
  return type_0.options?.disableNew === !0;
26709
26709
  }
26710
- function _temp3$H(task, i) {
26710
+ function _temp3$I(task, i) {
26711
26711
  return /* @__PURE__ */ jsxs(Flex, { gap: 2, padding: 2, children: [
26712
26712
  /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text$1, { weight: "medium", children: task.file.name }) }),
26713
26713
  /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text$1, { size: 1, children: [
@@ -27742,7 +27742,7 @@ function GridItem(props2) {
27742
27742
  readOnly,
27743
27743
  hasErrors,
27744
27744
  hasWarnings
27745
- }), handleMouseDown = _temp3$G;
27745
+ }), handleMouseDown = _temp3$H;
27746
27746
  let t18;
27747
27747
  $[53] !== onOpen ? (t18 = (event_0) => {
27748
27748
  event_0.stopPropagation(), onOpen();
@@ -27788,7 +27788,7 @@ function GridItem(props2) {
27788
27788
  t23 = $[92];
27789
27789
  return t23;
27790
27790
  }
27791
- function _temp3$G(event) {
27791
+ function _temp3$H(event) {
27792
27792
  event.preventDefault();
27793
27793
  }
27794
27794
  function _temp2$1o(v_0) {
@@ -27823,7 +27823,7 @@ function GridArrayInput(props2) {
27823
27823
  t
27824
27824
  } = useTranslation(), errorTone = validation2?.some(_temp$3h) ? "critical" : void 0, sortable = schemaType.options?.sortable !== !1, renderItem2 = _temp2$1n;
27825
27825
  let t2;
27826
- $[0] !== members ? (t2 = members.map(_temp3$F), $[0] = members, $[1] = t2) : t2 = $[1];
27826
+ $[0] !== members ? (t2 = members.map(_temp3$G), $[0] = members, $[1] = t2) : t2 = $[1];
27827
27827
  const memberKeys = t2;
27828
27828
  let t3;
27829
27829
  $[2] !== errorTone || $[3] !== members.length || $[4] !== schemaType.placeholder || $[5] !== t ? (t3 = members?.length === 0 && /* @__PURE__ */ jsx(Card, { padding: 3, border: !0, radius: 2, tone: errorTone, children: /* @__PURE__ */ jsx(Text$1, { align: "center", muted: !0, size: 1, children: schemaType.placeholder || /* @__PURE__ */ jsx(Fragment$1, { children: t("inputs.array.no-items-label") }) }) }), $[2] = errorTone, $[3] = members.length, $[4] = schemaType.placeholder, $[5] = t, $[6] = t3) : t3 = $[6];
@@ -27849,7 +27849,7 @@ function GridArrayInput(props2) {
27849
27849
  let t9;
27850
27850
  return $[42] !== members.length || $[43] !== schemaType || $[44] !== t8 ? (t9 = /* @__PURE__ */ jsx(ArrayValidationProvider, { schemaType, itemCount: members.length, children: t8 }), $[42] = members.length, $[43] = schemaType, $[44] = t8, $[45] = t9) : t9 = $[45], t9;
27851
27851
  }
27852
- function _temp3$F(member) {
27852
+ function _temp3$G(member) {
27853
27853
  return member.key;
27854
27854
  }
27855
27855
  function _temp2$1n(itemProps) {
@@ -28530,7 +28530,7 @@ function uploadTarget(Component2) {
28530
28530
  title: t("inputs.array.error.cannot-upload-unable-to-convert", {
28531
28531
  count: rejected.length
28532
28532
  }),
28533
- description: rejected.map(_temp3$E)
28533
+ description: rejected.map(_temp3$F)
28534
28534
  }), ready.forEach((task_2) => {
28535
28535
  uploadFile2(task_2.file, sortBy(task_2.uploaderCandidates, _temp4$h)[0]);
28536
28536
  });
@@ -28597,7 +28597,7 @@ function _temp$3b(task) {
28597
28597
  function _temp2$1l(task_0) {
28598
28598
  return task_0.uploaderCandidates.length === 0;
28599
28599
  }
28600
- function _temp3$E(task_1, i) {
28600
+ function _temp3$F(task_1, i) {
28601
28601
  return /* @__PURE__ */ jsxs(Flex, { gap: 2, padding: 2, children: [
28602
28602
  /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text$1, { weight: "medium", children: task_1.file.name }) }),
28603
28603
  /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text$1, { size: 1, children: [
@@ -33134,7 +33134,7 @@ function Editor(props2) {
33134
33134
  }, $[0] = isFullscreen, $[1] = isTopLayer, $[2] = onToggleFullscreen, $[3] = t0) : t0 = $[3], useGlobalKeyDown(t0);
33135
33135
  let t1;
33136
33136
  $[4] !== t ? (t1 = () => /* @__PURE__ */ jsx(PlaceholderWrapper$1, { "data-testid": "pt-input-placeholder", children: t("inputs.portable-text.empty-placeholder") }), $[4] = t, $[5] = t1) : t1 = $[5];
33137
- const renderPlaceholder = t1, spellCheck = useSpellCheck(), renderDecorator = _temp$2V, renderStyle = _temp2$1e, renderListItem = _temp3$D, scrollSelectionIntoView = useScrollSelectionIntoView(scrollElement);
33137
+ const renderPlaceholder = t1, spellCheck = useSpellCheck(), renderDecorator = _temp$2V, renderStyle = _temp2$1e, renderListItem = _temp3$E, scrollSelectionIntoView = useScrollSelectionIntoView(scrollElement);
33138
33138
  let t2;
33139
33139
  $[6] !== ariaDescribedBy || $[7] !== elementRef || $[8] !== hotkeys || $[9] !== initialSelection || $[10] !== onCopy || $[11] !== onPaste || $[12] !== rangeDecorations || $[13] !== renderAnnotation || $[14] !== renderBlock2 || $[15] !== renderChild2 || $[16] !== renderPlaceholder || $[17] !== scrollSelectionIntoView || $[18] !== spellCheck ? (t2 = {
33140
33140
  "aria-describedby": ariaDescribedBy,
@@ -33186,7 +33186,7 @@ function Editor(props2) {
33186
33186
  t13
33187
33187
  ] }), $[53] = isFullscreen, $[54] = isOneLine, $[55] = t13, $[56] = t5, $[57] = t14) : t14 = $[57], t14;
33188
33188
  }
33189
- function _temp3$D(listItemProps) {
33189
+ function _temp3$E(listItemProps) {
33190
33190
  return /* @__PURE__ */ jsx(ListItem$1, { ...listItemProps });
33191
33191
  }
33192
33192
  function _temp2$1e(styleProps) {
@@ -33237,16 +33237,23 @@ function useHotkeys(hotkeys) {
33237
33237
  }, $[9] = initialHotkeys.custom, $[10] = t2, $[11] = t3) : t3 = $[11], t3;
33238
33238
  }
33239
33239
  function useTrackFocusPath(props2) {
33240
- const $ = c(15), {
33240
+ const $ = c(16), {
33241
33241
  focusPath,
33242
33242
  boundaryElement,
33243
33243
  onItemClose
33244
- } = props2, portableTextMemberItems = usePortableTextMemberItems(), elementRefs = usePortableTextMemberItemElementRefs(), editor2 = usePortableTextEditor(), selection = usePortableTextEditorSelection();
33245
- let t0;
33246
- $[0] !== boundaryElement || $[1] !== editor2 || $[2] !== elementRefs || $[3] !== focusPath || $[4] !== portableTextMemberItems || $[5] !== selection ? (t0 = () => {
33247
- if (focusPath.length === 0 || selection?.focus.path && isEqual$2(selection.focus.path, focusPath.slice(0, selection.focus.path.length)))
33244
+ } = props2, portableTextMemberItems = usePortableTextMemberItems(), elementRefs = usePortableTextMemberItemElementRefs(), editor2 = usePortableTextEditor(), selection = usePortableTextEditorSelection(), selectionRef = useRef(selection);
33245
+ let t0, t1;
33246
+ $[0] !== selection ? (t0 = () => {
33247
+ selectionRef.current = selection;
33248
+ }, t1 = [selection], $[0] = selection, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), useLayoutEffect(t0, t1);
33249
+ let t2;
33250
+ $[3] !== boundaryElement || $[4] !== editor2 || $[5] !== elementRefs || $[6] !== focusPath || $[7] !== portableTextMemberItems ? (t2 = () => {
33251
+ if (focusPath.length === 0)
33252
+ return;
33253
+ const editorHasDomFocus = !!boundaryElement?.ownerDocument.activeElement && boundaryElement.contains(boundaryElement.ownerDocument.activeElement), currentSelection = selectionRef.current, openItem = portableTextMemberItems.find(_temp$2U), openEditingItem = portableTextMemberItems.find(_temp2$1d);
33254
+ if (currentSelection?.focus.path && isEqual$2(currentSelection.focus.path, focusPath.slice(0, currentSelection.focus.path.length)) && (editorHasDomFocus || openEditingItem))
33248
33255
  return;
33249
- const focusedItem = portableTextMemberItems.find(_temp$2U), openItem = portableTextMemberItems.find(_temp2$1d), relatedEditorItem = focusedItem || openItem, elementRef = relatedEditorItem ? elementRefs[relatedEditorItem.member.key] : void 0;
33256
+ const relatedEditorItem = portableTextMemberItems.find(_temp3$D) || openItem, elementRef = relatedEditorItem ? elementRefs[relatedEditorItem.member.key] : void 0;
33250
33257
  if (relatedEditorItem && elementRef) {
33251
33258
  boundaryElement && (scrollIntoView$1(boundaryElement, {
33252
33259
  scrollMode: "if-needed",
@@ -33262,32 +33269,37 @@ function useTrackFocusPath(props2) {
33262
33269
  if (isTextBlock || isBlockFocusPath) {
33263
33270
  const textBlockChildKey = isTextBlock && isKeyedObject(focusPath[2]) ? focusPath[2]._key : void 0, child = textBlockChildKey && Array.isArray(relatedEditorItem.node.value?.children) ? relatedEditorItem.node.value?.children.find((c2) => c2._key === textBlockChildKey) : void 0, isSpanTextFocusPath = child && child._type === "span" && focusPath.length === 4 && focusPath[1] === "children" && focusPath[3] === "text" || !1, isTextChildFocusPath = isTextBlock && (focusPath.length === 3 && focusPath[1] === "children" || isSpanTextFocusPath);
33264
33271
  let path = [];
33265
- isTextChildFocusPath ? path = focusPath.slice(0, 3) : isTextBlock && isBlockFocusPath && Array.isArray(relatedEditorItem.node.value?.children) ? path = [focusPath[0], "children", {
33272
+ if (isTextChildFocusPath ? path = focusPath.slice(0, 3) : isTextBlock && isBlockFocusPath && Array.isArray(relatedEditorItem.node.value?.children) ? path = [focusPath[0], "children", {
33266
33273
  _key: relatedEditorItem.node.value?.children[0]._key
33267
33274
  }] : isBlockFocusPath && (path = [{
33268
33275
  _key: relatedEditorItem.key
33269
- }]), path.length && (PortableTextEditor.select(editor2, {
33270
- anchor: {
33271
- path,
33272
- offset: 0
33273
- },
33274
- focus: {
33275
- path,
33276
- offset: 0
33277
- }
33278
- }), isTextBlock && PortableTextEditor.focus(editor2));
33276
+ }]), path.length) {
33277
+ const isSameSelection = currentSelection?.focus.path && isEqual$2(currentSelection.focus.path.slice(0, path.length), path);
33278
+ isTextBlock && isSameSelection && PortableTextEditor.select(editor2, null), PortableTextEditor.select(editor2, {
33279
+ anchor: {
33280
+ path,
33281
+ offset: 0
33282
+ },
33283
+ focus: {
33284
+ path,
33285
+ offset: 0
33286
+ }
33287
+ }), isTextBlock && PortableTextEditor.focus(editor2);
33288
+ }
33279
33289
  }
33280
33290
  }
33281
- }, $[0] = boundaryElement, $[1] = editor2, $[2] = elementRefs, $[3] = focusPath, $[4] = portableTextMemberItems, $[5] = selection, $[6] = t0) : t0 = $[6];
33282
- const t1 = selection?.focus.path;
33283
- let t2;
33284
- $[7] !== boundaryElement || $[8] !== editor2 || $[9] !== elementRefs || $[10] !== focusPath || $[11] !== onItemClose || $[12] !== portableTextMemberItems || $[13] !== t1 ? (t2 = [boundaryElement, editor2, elementRefs, focusPath, onItemClose, portableTextMemberItems, t1], $[7] = boundaryElement, $[8] = editor2, $[9] = elementRefs, $[10] = focusPath, $[11] = onItemClose, $[12] = portableTextMemberItems, $[13] = t1, $[14] = t2) : t2 = $[14], useLayoutEffect(t0, t2);
33291
+ }, $[3] = boundaryElement, $[4] = editor2, $[5] = elementRefs, $[6] = focusPath, $[7] = portableTextMemberItems, $[8] = t2) : t2 = $[8];
33292
+ let t3;
33293
+ $[9] !== boundaryElement || $[10] !== editor2 || $[11] !== elementRefs || $[12] !== focusPath || $[13] !== onItemClose || $[14] !== portableTextMemberItems ? (t3 = [boundaryElement, editor2, elementRefs, focusPath, onItemClose, portableTextMemberItems], $[9] = boundaryElement, $[10] = editor2, $[11] = elementRefs, $[12] = focusPath, $[13] = onItemClose, $[14] = portableTextMemberItems, $[15] = t3) : t3 = $[15], useLayoutEffect(t2, t3);
33294
+ }
33295
+ function _temp3$D(m_1) {
33296
+ return m_1.member.item.focused;
33285
33297
  }
33286
33298
  function _temp2$1d(m_0) {
33287
- return m_0.member.open;
33299
+ return m_0.member.open && (m_0.kind === "annotation" || m_0.kind === "objectBlock" || m_0.kind === "inlineObject");
33288
33300
  }
33289
33301
  function _temp$2U(m) {
33290
- return m.member.item.focused;
33302
+ return m.member.open;
33291
33303
  }
33292
33304
  const POPOVER_FALLBACK_PLACEMENTS$6 = ["top", "bottom"];
33293
33305
  function CombinedAnnotationPopover(props2) {