@portabletext/editor 1.43.0 → 1.44.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/lib/_chunks-cjs/behavior.markdown.cjs +1 -1
- package/lib/_chunks-cjs/editor-provider.cjs +445 -623
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-cjs/parse-blocks.cjs +151 -0
- package/lib/_chunks-cjs/parse-blocks.cjs.map +1 -0
- package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs +2 -1
- package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs.map +1 -1
- package/lib/_chunks-cjs/{selector.is-active-style.cjs → selector.is-selecting-entire-blocks.cjs} +47 -11
- package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +1 -0
- package/lib/_chunks-cjs/util.merge-text-blocks.cjs +3 -3
- package/lib/_chunks-cjs/util.merge-text-blocks.cjs.map +1 -1
- package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs +0 -149
- package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs.map +1 -1
- package/lib/_chunks-es/behavior.markdown.js +1 -1
- package/lib/_chunks-es/editor-provider.js +434 -611
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/_chunks-es/parse-blocks.js +152 -0
- package/lib/_chunks-es/parse-blocks.js.map +1 -0
- package/lib/_chunks-es/selector.is-overlapping-selection.js +2 -1
- package/lib/_chunks-es/selector.is-overlapping-selection.js.map +1 -1
- package/lib/_chunks-es/{selector.is-active-style.js → selector.is-selecting-entire-blocks.js} +49 -12
- package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +1 -0
- package/lib/_chunks-es/util.merge-text-blocks.js +1 -1
- package/lib/_chunks-es/util.selection-point-to-block-offset.js +0 -149
- package/lib/_chunks-es/util.selection-point-to-block-offset.js.map +1 -1
- package/lib/behaviors/index.d.cts +1860 -5464
- package/lib/behaviors/index.d.ts +1860 -5464
- package/lib/index.cjs +4 -4
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1529 -5062
- package/lib/index.d.ts +1529 -5062
- package/lib/index.js +3 -3
- package/lib/plugins/index.cjs +1 -1
- package/lib/plugins/index.d.cts +1529 -5062
- package/lib/plugins/index.d.ts +1529 -5062
- package/lib/plugins/index.js +1 -1
- package/lib/selectors/index.cjs +12 -11
- package/lib/selectors/index.cjs.map +1 -1
- package/lib/selectors/index.d.cts +1508 -5064
- package/lib/selectors/index.d.ts +1508 -5064
- package/lib/selectors/index.js +2 -1
- package/lib/utils/index.d.cts +1491 -5057
- package/lib/utils/index.d.ts +1491 -5057
- package/package.json +1 -1
- package/src/behavior-actions/behavior.actions.ts +1 -131
- package/src/behaviors/behavior.default.ts +47 -50
- package/src/behaviors/behavior.internal.insert.ts +118 -0
- package/src/behaviors/behavior.internal.list-item.ts +61 -0
- package/src/behaviors/behavior.internal.select.ts +62 -0
- package/src/behaviors/behavior.internal.style.ts +54 -0
- package/src/behaviors/behavior.perform-event.ts +15 -13
- package/src/behaviors/behavior.types.event.ts +143 -100
- package/src/editor/create-editor.ts +2 -2
- package/src/editor/editor-machine.ts +3 -4
- package/src/editor/plugins/createWithEditableAPI.ts +1 -2
- package/src/editor/sync-machine.ts +1 -1
- package/src/internal-utils/slate-utils.ts +52 -0
- package/src/plugins/plugin.internal.editor-actor-ref.tsx +15 -0
- package/src/plugins/plugin.internal.slate-editor-ref.tsx +15 -0
- package/src/selectors/index.ts +2 -1
- package/src/selectors/selector.get-selected-text-blocks.ts +67 -0
- package/lib/_chunks-cjs/selector.is-active-style.cjs.map +0 -1
- package/lib/_chunks-es/selector.is-active-style.js.map +0 -1
- package/src/behavior-actions/behavior.action.data-transfer-set.ts +0 -7
- package/src/behavior-actions/behavior.action.deserialization.failure.ts +0 -9
- package/src/behavior-actions/behavior.action.deserialization.success.ts +0 -16
- package/src/behavior-actions/behavior.action.insert-blocks.ts +0 -140
- package/src/behavior-actions/behavior.action.list-item.ts +0 -100
- package/src/behavior-actions/behavior.action.select.next-block.ts +0 -44
- package/src/behavior-actions/behavior.action.select.previous-block.ts +0 -48
- package/src/behavior-actions/behavior.action.serialization.failure.ts +0 -9
- package/src/behavior-actions/behavior.action.serialization.success.ts +0 -17
- package/src/behavior-actions/behavior.action.style.ts +0 -108
package/lib/plugins/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import { coreBehaviors, defineBehavior, raise } from "../_chunks-es/behavior.cor
|
|
|
6
6
|
import { useActorRef } from "@xstate/react";
|
|
7
7
|
import isEqual from "lodash/isEqual.js";
|
|
8
8
|
import { setup, fromCallback, assign } from "xstate";
|
|
9
|
+
import { getFocusTextBlock, getSelectionStartPoint, getPreviousInlineObject, isSelectionExpanded } from "../_chunks-es/selector.is-overlapping-selection.js";
|
|
9
10
|
import { spanSelectionPointToBlockOffset } from "../_chunks-es/util.slice-blocks.js";
|
|
10
11
|
import { blockOffsetsToSelection, childSelectionPointToBlockOffset } from "../_chunks-es/util.selection-point-to-block-offset.js";
|
|
11
|
-
import { getFocusTextBlock, getSelectionStartPoint, getPreviousInlineObject, isSelectionExpanded } from "../_chunks-es/selector.is-overlapping-selection.js";
|
|
12
12
|
import { getBlockTextBefore } from "../_chunks-es/selector.get-text-before.js";
|
|
13
13
|
import { useEffectEvent } from "use-effect-event";
|
|
14
14
|
import { createMarkdownBehaviors } from "../_chunks-es/behavior.markdown.js";
|
package/lib/selectors/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var
|
|
3
|
+
var selector_isSelectingEntireBlocks = require("../_chunks-cjs/selector.is-selecting-entire-blocks.cjs"), util_sliceBlocks = require("../_chunks-cjs/util.slice-blocks.cjs"), types = require("@sanity/types"), selector_isOverlappingSelection = require("../_chunks-cjs/selector.is-overlapping-selection.cjs"), selector_getFocusInlineObject = require("../_chunks-cjs/selector.get-focus-inline-object.cjs"), selector_getTextBefore = require("../_chunks-cjs/selector.get-text-before.cjs");
|
|
4
4
|
const getAnchorBlock = (snapshot) => {
|
|
5
5
|
const key = snapshot.context.selection && util_sliceBlocks.isKeyedSegment(snapshot.context.selection.anchor.path[0]) ? snapshot.context.selection.anchor.path[0]._key : void 0, node = key ? snapshot.context.value.find((block) => block._key === key) : void 0;
|
|
6
6
|
return node && key ? {
|
|
@@ -50,16 +50,17 @@ const getAnchorBlock = (snapshot) => {
|
|
|
50
50
|
end
|
|
51
51
|
} : void 0;
|
|
52
52
|
}, getSelection = (snapshot) => snapshot.context.selection, getValue = (snapshot) => snapshot.context.value;
|
|
53
|
-
exports.getActiveAnnotations =
|
|
54
|
-
exports.getActiveListItem =
|
|
55
|
-
exports.getActiveStyle =
|
|
56
|
-
exports.getSelectedSpans =
|
|
57
|
-
exports.
|
|
58
|
-
exports.
|
|
59
|
-
exports.
|
|
60
|
-
exports.
|
|
61
|
-
exports.
|
|
62
|
-
exports.
|
|
53
|
+
exports.getActiveAnnotations = selector_isSelectingEntireBlocks.getActiveAnnotations;
|
|
54
|
+
exports.getActiveListItem = selector_isSelectingEntireBlocks.getActiveListItem;
|
|
55
|
+
exports.getActiveStyle = selector_isSelectingEntireBlocks.getActiveStyle;
|
|
56
|
+
exports.getSelectedSpans = selector_isSelectingEntireBlocks.getSelectedSpans;
|
|
57
|
+
exports.getSelectedTextBlocks = selector_isSelectingEntireBlocks.getSelectedTextBlocks;
|
|
58
|
+
exports.getTrimmedSelection = selector_isSelectingEntireBlocks.getTrimmedSelection;
|
|
59
|
+
exports.isActiveAnnotation = selector_isSelectingEntireBlocks.isActiveAnnotation;
|
|
60
|
+
exports.isActiveDecorator = selector_isSelectingEntireBlocks.isActiveDecorator;
|
|
61
|
+
exports.isActiveListItem = selector_isSelectingEntireBlocks.isActiveListItem;
|
|
62
|
+
exports.isActiveStyle = selector_isSelectingEntireBlocks.isActiveStyle;
|
|
63
|
+
exports.isSelectingEntireBlocks = selector_isSelectingEntireBlocks.isSelectingEntireBlocks;
|
|
63
64
|
exports.getCaretWordSelection = selector_isOverlappingSelection.getCaretWordSelection;
|
|
64
65
|
exports.getFirstBlock = selector_isOverlappingSelection.getFirstBlock;
|
|
65
66
|
exports.getFocusBlock = selector_isOverlappingSelection.getFocusBlock;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/selectors/selector.get-anchor-block.ts","../../src/selectors/selector.get-anchor-text-block.ts","../../src/selectors/selector.get-anchor-child.ts","../../src/selectors/selector.get-anchor-span.ts","../../src/selectors/selector.get-block-offsets.ts","../../src/selectors/selector.get-selection.ts","../../src/selectors/selector.get-value.ts"],"sourcesContent":["import type {KeyedSegment, PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isKeyedSegment} from '../utils'\n\n/**\n * @public\n */\nexport const getAnchorBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const key = snapshot.context.selection\n ? isKeyedSegment(snapshot.context.selection.anchor.path[0])\n ? snapshot.context.selection.anchor.path[0]._key\n : undefined\n : undefined\n\n const node = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n return node && key ? {node, path: [{_key: key}]} : undefined\n}\n","import {\n isPortableTextTextBlock,\n type KeyedSegment,\n type PortableTextTextBlock,\n} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getAnchorBlock} from './selector.get-anchor-block'\n\n/**\n * @public\n */\nexport const getAnchorTextBlock: EditorSelector<\n {node: PortableTextTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const anchorBlock = getAnchorBlock(snapshot)\n\n return anchorBlock && isPortableTextTextBlock(anchorBlock.node)\n ? {node: anchorBlock.node, path: anchorBlock.path}\n : undefined\n}\n","import type {KeyedSegment} from '@portabletext/patches'\nimport type {PortableTextObject, PortableTextSpan} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isKeyedSegment} from '../utils'\nimport {getAnchorTextBlock} from './selector.get-anchor-text-block'\n\n/**\n * @public\n */\nexport const getAnchorChild: EditorSelector<\n | {\n node: PortableTextObject | PortableTextSpan\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n const anchorBlock = getAnchorTextBlock(snapshot)\n\n if (!anchorBlock) {\n return undefined\n }\n\n const key = snapshot.context.selection\n ? isKeyedSegment(snapshot.context.selection.anchor.path[2])\n ? snapshot.context.selection.anchor.path[2]._key\n : undefined\n : undefined\n\n const node = key\n ? anchorBlock.node.children.find((span) => span._key === key)\n : undefined\n\n return node && key\n ? {node, path: [...anchorBlock.path, 'children', {_key: key}]}\n : undefined\n}\n","import type {KeyedSegment} from '@portabletext/patches'\nimport {isPortableTextSpan, type PortableTextSpan} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getAnchorChild} from './selector.get-anchor-child'\n\n/**\n * @public\n */\nexport const getAnchorSpan: EditorSelector<\n | {node: PortableTextSpan; path: [KeyedSegment, 'children', KeyedSegment]}\n | undefined\n> = (snapshot) => {\n const anchorChild = getAnchorChild(snapshot)\n\n return anchorChild && isPortableTextSpan(anchorChild.node)\n ? {node: anchorChild.node, path: anchorChild.path}\n : undefined\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport type {BlockOffset} from '../types/block-offset'\nimport * as utils from '../utils'\nimport {getSelectionEndPoint} from './selector.get-selection-end-point'\nimport {getSelectionStartPoint} from './selector.get-selection-start-point'\n\n/**\n * @public\n */\nexport const getBlockOffsets: EditorSelector<\n {start: BlockOffset; end: BlockOffset} | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n const selectionStartPoint = getSelectionStartPoint(snapshot)\n const selectionEndPoint = getSelectionEndPoint(snapshot)\n\n if (!selectionStartPoint || !selectionEndPoint) {\n return undefined\n }\n\n const start = utils.spanSelectionPointToBlockOffset({\n value: snapshot.context.value,\n selectionPoint: selectionStartPoint,\n })\n const end = utils.spanSelectionPointToBlockOffset({\n value: snapshot.context.value,\n selectionPoint: selectionEndPoint,\n })\n\n return start && end ? {start, end} : undefined\n}\n","import type {EditorSelection} from '..'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getSelection: EditorSelector<EditorSelection> = (snapshot) => {\n return snapshot.context.selection\n}\n","import type {PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getValue: EditorSelector<Array<PortableTextBlock>> = (\n snapshot,\n) => {\n return snapshot.context.value\n}\n"],"names":["getAnchorBlock","snapshot","key","context","selection","isKeyedSegment","anchor","path","_key","undefined","node","value","find","block","getAnchorTextBlock","anchorBlock","isPortableTextTextBlock","getAnchorChild","children","span","getAnchorSpan","anchorChild","isPortableTextSpan","getBlockOffsets","selectionStartPoint","getSelectionStartPoint","selectionEndPoint","getSelectionEndPoint","start","utils","selectionPoint","end","getSelection","getValue"],"mappings":";;;AAOO,MAAMA,iBAERC,CAAa,aAAA;AAChB,QAAMC,MAAMD,SAASE,QAAQC,aACzBC,iBAAAA,eAAeJ,SAASE,QAAQC,UAAUE,OAAOC,KAAK,CAAC,CAAC,IACtDN,SAASE,QAAQC,UAAUE,OAAOC,KAAK,CAAC,EAAEC,OAE5CC,QAEEC,OAAOR,MACTD,SAASE,QAAQQ,MAAMC,KAAMC,CAAAA,UAAUA,MAAML,SAASN,GAAG,IACzDO;AAEJ,SAAOC,QAAQR,MAAM;AAAA,IAACQ;AAAAA,IAAMH,MAAM,CAAC;AAAA,MAACC,MAAMN;AAAAA,IAAI,CAAA;AAAA,EAAA,IAAKO;AACrD,GCVaK,qBAERb,CAAa,aAAA;AACVc,QAAAA,cAAcf,eAAeC,QAAQ;AAE3C,SAAOc,eAAeC,MAAAA,wBAAwBD,YAAYL,IAAI,IAC1D;AAAA,IAACA,MAAMK,YAAYL;AAAAA,IAAMH,MAAMQ,YAAYR;AAAAA,EAAAA,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,eAAiD/B,CACrDA,aAAAA,SAASE,QAAQC,WCDb6B,WACXhC,CAEOA,aAAAA,SAASE,QAAQQ
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/selectors/selector.get-anchor-block.ts","../../src/selectors/selector.get-anchor-text-block.ts","../../src/selectors/selector.get-anchor-child.ts","../../src/selectors/selector.get-anchor-span.ts","../../src/selectors/selector.get-block-offsets.ts","../../src/selectors/selector.get-selection.ts","../../src/selectors/selector.get-value.ts"],"sourcesContent":["import type {KeyedSegment, PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isKeyedSegment} from '../utils'\n\n/**\n * @public\n */\nexport const getAnchorBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const key = snapshot.context.selection\n ? isKeyedSegment(snapshot.context.selection.anchor.path[0])\n ? snapshot.context.selection.anchor.path[0]._key\n : undefined\n : undefined\n\n const node = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n return node && key ? {node, path: [{_key: key}]} : undefined\n}\n","import {\n isPortableTextTextBlock,\n type KeyedSegment,\n type PortableTextTextBlock,\n} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getAnchorBlock} from './selector.get-anchor-block'\n\n/**\n * @public\n */\nexport const getAnchorTextBlock: EditorSelector<\n {node: PortableTextTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const anchorBlock = getAnchorBlock(snapshot)\n\n return anchorBlock && isPortableTextTextBlock(anchorBlock.node)\n ? {node: anchorBlock.node, path: anchorBlock.path}\n : undefined\n}\n","import type {KeyedSegment} from '@portabletext/patches'\nimport type {PortableTextObject, PortableTextSpan} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isKeyedSegment} from '../utils'\nimport {getAnchorTextBlock} from './selector.get-anchor-text-block'\n\n/**\n * @public\n */\nexport const getAnchorChild: EditorSelector<\n | {\n node: PortableTextObject | PortableTextSpan\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n const anchorBlock = getAnchorTextBlock(snapshot)\n\n if (!anchorBlock) {\n return undefined\n }\n\n const key = snapshot.context.selection\n ? isKeyedSegment(snapshot.context.selection.anchor.path[2])\n ? snapshot.context.selection.anchor.path[2]._key\n : undefined\n : undefined\n\n const node = key\n ? anchorBlock.node.children.find((span) => span._key === key)\n : undefined\n\n return node && key\n ? {node, path: [...anchorBlock.path, 'children', {_key: key}]}\n : undefined\n}\n","import type {KeyedSegment} from '@portabletext/patches'\nimport {isPortableTextSpan, type PortableTextSpan} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getAnchorChild} from './selector.get-anchor-child'\n\n/**\n * @public\n */\nexport const getAnchorSpan: EditorSelector<\n | {node: PortableTextSpan; path: [KeyedSegment, 'children', KeyedSegment]}\n | undefined\n> = (snapshot) => {\n const anchorChild = getAnchorChild(snapshot)\n\n return anchorChild && isPortableTextSpan(anchorChild.node)\n ? {node: anchorChild.node, path: anchorChild.path}\n : undefined\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport type {BlockOffset} from '../types/block-offset'\nimport * as utils from '../utils'\nimport {getSelectionEndPoint} from './selector.get-selection-end-point'\nimport {getSelectionStartPoint} from './selector.get-selection-start-point'\n\n/**\n * @public\n */\nexport const getBlockOffsets: EditorSelector<\n {start: BlockOffset; end: BlockOffset} | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n const selectionStartPoint = getSelectionStartPoint(snapshot)\n const selectionEndPoint = getSelectionEndPoint(snapshot)\n\n if (!selectionStartPoint || !selectionEndPoint) {\n return undefined\n }\n\n const start = utils.spanSelectionPointToBlockOffset({\n value: snapshot.context.value,\n selectionPoint: selectionStartPoint,\n })\n const end = utils.spanSelectionPointToBlockOffset({\n value: snapshot.context.value,\n selectionPoint: selectionEndPoint,\n })\n\n return start && end ? {start, end} : undefined\n}\n","import type {EditorSelection} from '..'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getSelection: EditorSelector<EditorSelection> = (snapshot) => {\n return snapshot.context.selection\n}\n","import type {PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getValue: EditorSelector<Array<PortableTextBlock>> = (\n snapshot,\n) => {\n return snapshot.context.value\n}\n"],"names":["getAnchorBlock","snapshot","key","context","selection","isKeyedSegment","anchor","path","_key","undefined","node","value","find","block","getAnchorTextBlock","anchorBlock","isPortableTextTextBlock","getAnchorChild","children","span","getAnchorSpan","anchorChild","isPortableTextSpan","getBlockOffsets","selectionStartPoint","getSelectionStartPoint","selectionEndPoint","getSelectionEndPoint","start","utils","selectionPoint","end","getSelection","getValue"],"mappings":";;;AAOO,MAAMA,iBAERC,CAAa,aAAA;AAChB,QAAMC,MAAMD,SAASE,QAAQC,aACzBC,iBAAAA,eAAeJ,SAASE,QAAQC,UAAUE,OAAOC,KAAK,CAAC,CAAC,IACtDN,SAASE,QAAQC,UAAUE,OAAOC,KAAK,CAAC,EAAEC,OAE5CC,QAEEC,OAAOR,MACTD,SAASE,QAAQQ,MAAMC,KAAMC,CAAAA,UAAUA,MAAML,SAASN,GAAG,IACzDO;AAEJ,SAAOC,QAAQR,MAAM;AAAA,IAACQ;AAAAA,IAAMH,MAAM,CAAC;AAAA,MAACC,MAAMN;AAAAA,IAAI,CAAA;AAAA,EAAA,IAAKO;AACrD,GCVaK,qBAERb,CAAa,aAAA;AACVc,QAAAA,cAAcf,eAAeC,QAAQ;AAE3C,SAAOc,eAAeC,MAAAA,wBAAwBD,YAAYL,IAAI,IAC1D;AAAA,IAACA,MAAMK,YAAYL;AAAAA,IAAMH,MAAMQ,YAAYR;AAAAA,EAAAA,IAC3CE;AACN,GCVaQ,iBAMRhB,CAAa,aAAA;AACVc,QAAAA,cAAcD,mBAAmBb,QAAQ;AAE/C,MAAI,CAACc;AACH;AAGF,QA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