@fluidframework/sequence 2.90.0 → 2.92.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/CHANGELOG.md +8 -0
- package/dist/IntervalCollectionValues.d.ts +3 -3
- package/dist/IntervalCollectionValues.d.ts.map +1 -1
- package/dist/IntervalCollectionValues.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/intervalCollection.d.ts +6 -5
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +10 -9
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervalCollectionMap.d.ts +4 -5
- package/dist/intervalCollectionMap.d.ts.map +1 -1
- package/dist/intervalCollectionMap.js +3 -3
- package/dist/intervalCollectionMap.js.map +1 -1
- package/dist/intervalCollectionMapInterfaces.d.ts +3 -3
- package/dist/intervalCollectionMapInterfaces.d.ts.map +1 -1
- package/dist/intervalCollectionMapInterfaces.js.map +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.d.ts +2 -2
- package/dist/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/dist/intervalIndex/endpointIndex.d.ts +2 -2
- package/dist/intervalIndex/endpointIndex.d.ts.map +1 -1
- package/dist/intervalIndex/endpointIndex.js.map +1 -1
- package/dist/intervalIndex/index.d.ts +7 -7
- package/dist/intervalIndex/index.d.ts.map +1 -1
- package/dist/intervalIndex/index.js.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +3 -3
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.d.ts +2 -2
- package/dist/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.d.ts +2 -2
- package/dist/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/dist/intervalTree.d.ts +3 -2
- package/dist/intervalTree.d.ts.map +1 -1
- package/dist/intervalTree.js.map +1 -1
- package/dist/intervals/index.d.ts +2 -2
- package/dist/intervals/index.d.ts.map +1 -1
- package/dist/intervals/index.js.map +1 -1
- package/dist/intervals/intervalUtils.d.ts +2 -1
- package/dist/intervals/intervalUtils.d.ts.map +1 -1
- package/dist/intervals/intervalUtils.js +0 -1
- package/dist/intervals/intervalUtils.js.map +1 -1
- package/dist/intervals/sequenceInterval.d.ts +5 -3
- package/dist/intervals/sequenceInterval.d.ts.map +1 -1
- package/dist/intervals/sequenceInterval.js.map +1 -1
- package/dist/legacy.d.ts +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +1 -1
- package/dist/revertibles.d.ts +5 -4
- package/dist/revertibles.d.ts.map +1 -1
- package/dist/revertibles.js +26 -20
- package/dist/revertibles.js.map +1 -1
- package/dist/sequence.d.ts +8 -6
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +9 -10
- package/dist/sequence.js.map +1 -1
- package/dist/sequenceDeltaEvent.d.ts +2 -1
- package/dist/sequenceDeltaEvent.d.ts.map +1 -1
- package/dist/sequenceDeltaEvent.js +2 -2
- package/dist/sequenceDeltaEvent.js.map +1 -1
- package/dist/sequenceFactory.d.ts +3 -2
- package/dist/sequenceFactory.d.ts.map +1 -1
- package/dist/sequenceFactory.js +3 -2
- package/dist/sequenceFactory.js.map +1 -1
- package/dist/sharedSequence.d.ts +3 -2
- package/dist/sharedSequence.d.ts.map +1 -1
- package/dist/sharedSequence.js.map +1 -1
- package/dist/sharedString.d.ts +3 -2
- package/dist/sharedString.d.ts.map +1 -1
- package/dist/sharedString.js.map +1 -1
- package/eslint.config.mts +16 -4
- package/internal.d.ts +1 -1
- package/legacy.d.ts +1 -1
- package/lib/IntervalCollectionValues.d.ts +3 -3
- package/lib/IntervalCollectionValues.d.ts.map +1 -1
- package/lib/IntervalCollectionValues.js +1 -1
- package/lib/IntervalCollectionValues.js.map +1 -1
- package/lib/index.d.ts +10 -10
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/intervalCollection.d.ts +6 -5
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +10 -9
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervalCollectionMap.d.ts +4 -5
- package/lib/intervalCollectionMap.d.ts.map +1 -1
- package/lib/intervalCollectionMap.js +3 -3
- package/lib/intervalCollectionMap.js.map +1 -1
- package/lib/intervalCollectionMapInterfaces.d.ts +3 -3
- package/lib/intervalCollectionMapInterfaces.d.ts.map +1 -1
- package/lib/intervalCollectionMapInterfaces.js.map +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.d.ts +2 -2
- package/lib/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.js +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/lib/intervalIndex/endpointIndex.d.ts +2 -2
- package/lib/intervalIndex/endpointIndex.d.ts.map +1 -1
- package/lib/intervalIndex/endpointIndex.js.map +1 -1
- package/lib/intervalIndex/index.d.ts +7 -7
- package/lib/intervalIndex/index.d.ts.map +1 -1
- package/lib/intervalIndex/index.js.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +3 -3
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.js +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.d.ts +2 -2
- package/lib/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.d.ts +2 -2
- package/lib/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.js +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/lib/intervalTree.d.ts +3 -2
- package/lib/intervalTree.d.ts.map +1 -1
- package/lib/intervalTree.js +1 -1
- package/lib/intervalTree.js.map +1 -1
- package/lib/intervals/index.d.ts +2 -2
- package/lib/intervals/index.d.ts.map +1 -1
- package/lib/intervals/index.js.map +1 -1
- package/lib/intervals/intervalUtils.d.ts +2 -1
- package/lib/intervals/intervalUtils.d.ts.map +1 -1
- package/lib/intervals/intervalUtils.js +0 -1
- package/lib/intervals/intervalUtils.js.map +1 -1
- package/lib/intervals/sequenceInterval.d.ts +5 -3
- package/lib/intervals/sequenceInterval.d.ts.map +1 -1
- package/lib/intervals/sequenceInterval.js.map +1 -1
- package/lib/legacy.d.ts +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +1 -1
- package/lib/revertibles.d.ts +5 -4
- package/lib/revertibles.d.ts.map +1 -1
- package/lib/revertibles.js +26 -20
- package/lib/revertibles.js.map +1 -1
- package/lib/sequence.d.ts +8 -6
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +11 -12
- package/lib/sequence.js.map +1 -1
- package/lib/sequenceDeltaEvent.d.ts +2 -1
- package/lib/sequenceDeltaEvent.d.ts.map +1 -1
- package/lib/sequenceDeltaEvent.js +2 -2
- package/lib/sequenceDeltaEvent.js.map +1 -1
- package/lib/sequenceFactory.d.ts +3 -2
- package/lib/sequenceFactory.d.ts.map +1 -1
- package/lib/sequenceFactory.js +3 -2
- package/lib/sequenceFactory.js.map +1 -1
- package/lib/sharedSequence.d.ts +3 -2
- package/lib/sharedSequence.d.ts.map +1 -1
- package/lib/sharedSequence.js +1 -1
- package/lib/sharedSequence.js.map +1 -1
- package/lib/sharedString.d.ts +3 -2
- package/lib/sharedString.d.ts.map +1 -1
- package/lib/sharedString.js +1 -1
- package/lib/sharedString.js.map +1 -1
- package/package.json +23 -23
- package/src/IntervalCollectionValues.ts +4 -6
- package/src/index.ts +25 -25
- package/src/intervalCollection.ts +25 -20
- package/src/intervalCollectionMap.ts +8 -8
- package/src/intervalCollectionMapInterfaces.ts +4 -4
- package/src/intervalIndex/endpointInRangeIndex.ts +7 -8
- package/src/intervalIndex/endpointIndex.ts +3 -2
- package/src/intervalIndex/index.ts +7 -7
- package/src/intervalIndex/overlappingIntervalsIndex.ts +8 -9
- package/src/intervalIndex/sequenceIntervalIndexes.ts +2 -2
- package/src/intervalIndex/startpointInRangeIndex.ts +7 -8
- package/src/intervalTree.ts +3 -3
- package/src/intervals/index.ts +6 -6
- package/src/intervals/intervalUtils.ts +2 -1
- package/src/intervals/sequenceInterval.ts +7 -6
- package/src/packageVersion.ts +1 -1
- package/src/revertibles.ts +35 -26
- package/src/sequence.ts +25 -26
- package/src/sequenceDeltaEvent.ts +6 -4
- package/src/sequenceFactory.ts +6 -4
- package/src/sharedSequence.ts +3 -7
- package/src/sharedString.ts +3 -5
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
/* eslint-disable no-bitwise */
|
|
6
5
|
import { SlidingPreference, Side } from "@fluidframework/merge-tree/internal";
|
|
7
6
|
/**
|
|
8
7
|
* Values are used in persisted formats (ops).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervalUtils.js","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"intervalUtils.js","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":"AAAA;;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AC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAEnF,iDAAiD;IACjD,OAAO,CAAC,UAAU,GAAG,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC;QACjD,CAAC,CAAC,iBAAiB,CAAC,QAAQ;QAC5B,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,yBAAyB,CACxC,QAA8C,EAC9C,SAAe,EACf,MAA4C,EAC5C,OAAa;IAEb,IAAI,UAAU,GAAuB,kBAAkB,CAAC,IAAI,CAAC;IAE7D,IAAI,SAAS,KAAK,IAAI,CAAC,KAAK,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACtD,UAAU,IAAI,kBAAkB,CAAC,KAAK,CAAC;IACxC,CAAC;IAED,IAAI,OAAO,KAAK,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACjD,UAAU,IAAI,kBAAkB,CAAC,GAAG,CAAC;IACtC,CAAC;IAED,OAAO,UAAgC,CAAC;AACzC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport type { PropertySet } from \"@fluidframework/merge-tree/internal\";\nimport { SlidingPreference, Side } from \"@fluidframework/merge-tree/internal\";\n\n/**\n * Basic interval abstraction\n * @legacy @beta\n */\nexport interface IInterval {\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: IInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: IInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: IInterval): number;\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Intervals are considered to overlap if their intersection is non-empty.\n\t */\n\toverlaps(b: IInterval): boolean;\n}\n\n/**\n * Values are used in persisted formats (ops).\n * @internal\n */\nexport const IntervalDeltaOpType = {\n\tADD: \"add\",\n\tDELETE: \"delete\",\n\tCHANGE: \"change\",\n} as const;\n\nexport type IntervalDeltaOpType =\n\t(typeof IntervalDeltaOpType)[keyof typeof IntervalDeltaOpType];\n\n/**\n * Values are used in revertibles.\n * @legacy @beta\n */\nexport const IntervalOpType = {\n\t...IntervalDeltaOpType,\n\tPROPERTY_CHANGED: \"propertyChanged\",\n\tPOSITION_REMOVE: \"positionRemove\",\n} as const;\n/**\n * @legacy @beta\n */\nexport type IntervalOpType = (typeof IntervalOpType)[keyof typeof IntervalOpType];\n\n/**\n * @legacy @beta\n */\nexport enum IntervalType {\n\tSimple = 0x0,\n\n\t/**\n\t * SlideOnRemove indicates that the ends of the interval will slide if the segment\n\t * they reference is removed and acked.\n\t * See `packages\\dds\\merge-tree\\docs\\REFERENCEPOSITIONS.md` for details\n\t * SlideOnRemove is the default interval behavior and does not need to be specified.\n\t */\n\tSlideOnRemove = 0x2, // SlideOnRemove is default behavior - all intervals are SlideOnRemove\n\n\t/**\n\t * A temporary interval, used internally\n\t * @internal\n\t */\n\tTransient = 0x4,\n}\n\n/**\n * Serialized object representation of an interval.\n * This representation is used for ops that create or change intervals.\n * @legacy @beta\n */\nexport interface ISerializedInterval {\n\t/**\n\t * Sequence number at which `start` and `end` should be interpreted\n\t *\n\t * @remarks It's unclear that this is necessary to store here.\n\t * This should just be the refSeq on the op that modified the interval, which should be available via other means.\n\t * At the time of writing, it's not plumbed through to the reconnect/rebase code, however, which does need it.\n\t */\n\tsequenceNumber: number;\n\t/** Start position of the interval */\n\tstart: number | \"start\" | \"end\";\n\t/** End position of the interval */\n\tend: number | \"start\" | \"end\";\n\t/** Interval type to create */\n\tintervalType: IntervalType;\n\t/**\n\t * The stickiness of this interval\n\t */\n\tstickiness?: IntervalStickiness;\n\tstartSide?: Side;\n\tendSide?: Side;\n\t/** Any properties the interval has */\n\tproperties?: PropertySet;\n}\n\nexport interface ISerializableInterval extends IInterval {\n\t/** Serializable bag of properties associated with the interval. */\n\tproperties: PropertySet;\n\n\t/**\n\t * Gets the id associated with this interval.\n\t * When the interval is used as part of an interval collection, this id can be used to modify or remove the\n\t * interval.\n\t */\n\tgetIntervalId(): string;\n\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t */\n\tclone(): ISerializableInterval;\n\n\t/**\n\t * Unions this interval with `b`, returning a new interval.\n\t * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n\t * intermediate values between the two intervals.\n\t */\n\tunion(b: IInterval): ISerializableInterval;\n}\n\n/**\n * Represents a change that should be applied to an existing interval.\n * Changes can modify any of start/end/properties, with `undefined` signifying no change should be made.\n * @internal\n */\nexport type SerializedIntervalDelta = Omit<\n\tISerializedInterval,\n\t\"start\" | \"end\" | \"properties\"\n> &\n\tPartial<Pick<ISerializedInterval, \"start\" | \"end\" | \"properties\">>;\n\n/**\n * A size optimization to avoid redundantly storing keys when serializing intervals\n * as JSON for summaries.\n *\n * Intervals are of the format:\n *\n * [\n * start,\n * end,\n * sequenceNumber,\n * intervalType,\n * properties,\n * stickiness?,\n * startSide?,\n * endSide?,\n * ]\n */\nexport type CompressedSerializedInterval =\n\t| [\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber,\n\t\t\tIntervalType,\n\t\t\tPropertySet,\n\t\t\tIntervalStickiness,\n\t ]\n\t| [number | \"start\" | \"end\", number | \"start\" | \"end\", number, IntervalType, PropertySet];\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n *\n * @legacy @beta\n */\nexport const IntervalStickiness = {\n\t/**\n\t * Interval does not expand to include adjacent segments\n\t */\n\tNONE: 0b00,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the start\n\t */\n\tSTART: 0b01,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the end\n\t *\n\t * This is the default stickiness\n\t */\n\tEND: 0b10,\n\n\t/**\n\t * Interval expands to include all segments inserted adjacent to it\n\t */\n\tFULL: 0b11,\n} as const;\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n * @legacy @beta\n */\nexport type IntervalStickiness = (typeof IntervalStickiness)[keyof typeof IntervalStickiness];\n\nexport function startReferenceSlidingPreference(\n\tstartPos: number | \"start\" | \"end\" | undefined,\n\tstartSide: Side,\n\tendPos: number | \"start\" | \"end\" | undefined,\n\tendSide: Side,\n): SlidingPreference {\n\tconst stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\t// if any start stickiness, prefer sliding backwards\n\treturn (stickiness & IntervalStickiness.START) === 0\n\t\t? SlidingPreference.FORWARD\n\t\t: SlidingPreference.BACKWARD;\n}\n\nexport function endReferenceSlidingPreference(\n\tstartPos: number | \"start\" | \"end\" | undefined,\n\tstartSide: Side,\n\tendPos: number | \"start\" | \"end\" | undefined,\n\tendSide: Side,\n): SlidingPreference {\n\tconst stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\n\t// if any end stickiness, prefer sliding forwards\n\treturn (stickiness & IntervalStickiness.END) === 0\n\t\t? SlidingPreference.BACKWARD\n\t\t: SlidingPreference.FORWARD;\n}\n\nexport function computeStickinessFromSide(\n\tstartPos: number | \"start\" | \"end\" | undefined,\n\tstartSide: Side,\n\tendPos: number | \"start\" | \"end\" | undefined,\n\tendSide: Side,\n): IntervalStickiness {\n\tlet stickiness: IntervalStickiness = IntervalStickiness.NONE;\n\n\tif (startSide === Side.After || startPos === \"start\") {\n\t\tstickiness |= IntervalStickiness.START;\n\t}\n\n\tif (endSide === Side.Before || endPos === \"end\") {\n\t\tstickiness |= IntervalStickiness.END;\n\t}\n\n\treturn stickiness as IntervalStickiness;\n}\n"]}
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { IDisposable } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
7
|
-
import { Client, ISegment, LocalReferencePosition, PropertySet,
|
|
6
|
+
import type { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import type { Client, ISegment, LocalReferencePosition, PropertySet, SequencePlace } from "@fluidframework/merge-tree/internal";
|
|
8
|
+
import { ReferenceType, SlidingPreference, Side } from "@fluidframework/merge-tree/internal";
|
|
8
9
|
import type { ISharedSegmentSequence } from "../sequence.js";
|
|
9
|
-
import { ISerializableInterval, ISerializedInterval
|
|
10
|
+
import type { ISerializableInterval, ISerializedInterval } from "./intervalUtils.js";
|
|
11
|
+
import { IntervalStickiness, IntervalType, type IInterval, type SerializedIntervalDelta } from "./intervalUtils.js";
|
|
10
12
|
export declare function getSerializedProperties(serializedInterval: ISerializedInterval | SerializedIntervalDelta): {
|
|
11
13
|
id: string;
|
|
12
14
|
labels: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceInterval.d.ts","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"sequenceInterval.d.ts","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,WAAW,EA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AAkB,EAAE,kBAAkB,IAAI,UAAU,KAAK,kBAAkB,CAAC,IAAI;QAChF,QAAQ;KACR,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG;QACjB,CAAC,sBAAsB,CAAC,EAAE,CAAC,KAAK,CAAC;KACjC,CAAC;IACF,SAAS,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAEjC,MAAM,IAAI,GAAG,IAAI,qBAAqB,CACrC,MAAM,EACN,EAAE,EACF,KAAK,EACL,SAAS,EACT,OAAO,EACP,YAAY,EACZ,KAAK,KAAK,SAAS;QAClB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,qBAAqB,CAAC,EAAE,SAAS,EAAE,CAAC,sBAAsB,CAAC,EAAE,SAAS,EAAE,EACxF,SAAS,EACT,OAAO,CACP,CAAC;IACF,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport type { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tClient,\n\tISegment,\n\tLocalReferencePosition,\n\tPropertiesManager,\n\tPropertySet,\n\tReferenceType,\n\tSlidingPreference,\n\tcompareReferencePositions,\n\tcreateDetachedLocalReferencePosition,\n\tcreateMap,\n\tgetSlideToSegoff,\n\tmaxReferencePosition,\n\tminReferencePosition,\n\trefTypeIncludesFlag,\n\treservedRangeLabelsKey,\n\tSequencePlace,\n\tSide,\n\tendpointPosAndSide,\n\taddProperties,\n\ttype ISegmentInternal,\n\tUnassignedSequenceNumber,\n\tUniversalSequenceNumber,\n} from \"@fluidframework/merge-tree/internal\";\nimport { LoggingError, UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type { ISharedSegmentSequence } from \"../sequence.js\";\n\nimport {\n\tISerializableInterval,\n\tISerializedInterval,\n\tIntervalStickiness,\n\tIntervalType,\n\tcomputeStickinessFromSide,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n\ttype IInterval,\n\ttype SerializedIntervalDelta,\n} from \"./intervalUtils.js\";\n\nfunction compareSides(sideA: Side, sideB: Side): number {\n\tif (sideA === sideB) {\n\t\treturn 0;\n\t}\n\n\tif (sideA === Side.Before) {\n\t\treturn 1;\n\t}\n\n\treturn -1;\n}\n\nfunction minSide(sideA: Side, sideB: Side): Side {\n\tif (sideA === Side.After && sideB === Side.After) {\n\t\treturn Side.After;\n\t}\n\n\treturn Side.Before;\n}\n\nfunction maxSide(sideA: Side, sideB: Side): Side {\n\tif (sideA === Side.Before && sideB === Side.Before) {\n\t\treturn Side.Before;\n\t}\n\n\treturn Side.After;\n}\n\nconst reservedIntervalIdKey = \"intervalId\";\n\nconst legacyIdPrefix = \"legacy\";\n\nexport function getSerializedProperties(\n\tserializedInterval: ISerializedInterval | SerializedIntervalDelta,\n): {\n\tid: string;\n\tlabels: string[];\n\tproperties: PropertySet;\n} {\n\tconst {\n\t\t[reservedIntervalIdKey]: maybeId,\n\t\t[reservedRangeLabelsKey]: labels,\n\t\t...properties\n\t} = serializedInterval.properties ?? {};\n\t// Create a non-unique ID based on start and end to be used on intervals that come from legacy clients\n\t// without ID's.\n\tconst id =\n\t\tmaybeId ?? `${legacyIdPrefix}${serializedInterval.start}-${serializedInterval.end}`;\n\n\treturn { id, labels, properties };\n}\n\n/**\n * Interval implementation whose ends are associated with positions in a mutatable sequence.\n * As such, when content is inserted into the middle of the interval, the interval expands to\n * include that content.\n *\n * @remarks The endpoints' positions should be treated exclusively to get\n * reasonable behavior. E.g., an interval referring to \"hello\" in \"hello world\"\n * should have a start position of 0 and an end position of 5.\n *\n * To see why, consider what happens if \"llo wor\" is removed from the string to make \"held\".\n * The interval's startpoint remains on the \"h\" (it isn't altered), but the interval's endpoint\n * slides forward to the next unremoved position, which is the \"l\" in \"held\".\n * Users would generally expect the interval to now refer to \"he\" (as it is the subset of content\n * remaining after the removal), hence the \"l\" should be excluded.\n * If the interval endpoint was treated inclusively, the interval would now refer to \"hel\", which\n * is undesirable.\n *\n * Since the endpoints of an interval are treated exclusively but cannot be greater\n * than or equal to the length of the associated sequence, there exist special\n * endpoint segments, \"start\" and \"end\", which represent the position immediately\n * before or immediately after the string respectively.\n *\n * If a `SequenceInterval` is created on a sequence with the\n * `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints\n * of the interval that are exclusive will have the ability to slide to these\n * special endpoint segments.\n * @legacy @beta\n */\nexport interface SequenceInterval extends IInterval {\n\treadonly start: LocalReferencePosition;\n\t/**\n\t * End endpoint of this interval.\n\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t */\n\treadonly end: LocalReferencePosition;\n\treadonly intervalType: IntervalType;\n\treadonly startSide: Side;\n\treadonly endSide: Side;\n\treadonly stickiness: IntervalStickiness;\n\n\t/** Serializable bag of properties associated with the interval. */\n\tproperties: PropertySet;\n\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: SequenceInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: SequenceInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: SequenceInterval): number;\n\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Intervals are considered to overlap if their intersection is non-empty.\n\t */\n\toverlaps(b: SequenceInterval): boolean;\n\n\t/**\n\t * @returns whether this interval overlaps two numerical positions.\n\t */\n\toverlapsPos(bstart: number, bend: number): boolean;\n\n\t/**\n\t * Gets the id associated with this interval.\n\t * When the interval is used as part of an interval collection, this id can be used to modify or remove the\n\t * interval.\n\t */\n\tgetIntervalId(): string;\n}\n\n/**\n * Lightweight interval for index queries (overlap, comparison).\n * Has no Client dependency; cannot serialize or be disposed.\n */\nexport class BaseSequenceInterval implements SequenceInterval, ISerializableInterval {\n\treadonly #id: string;\n\treadonly #properties: PropertySet = createMap<any>();\n\n\tconstructor(\n\t\tid: string,\n\t\t/**\n\t\t * Start endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic start: LocalReferencePosition,\n\t\t/**\n\t\t * End endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic end: LocalReferencePosition,\n\t\tpublic intervalType: IntervalType,\n\t\tpublic readonly startSide: Side = Side.Before,\n\t\tpublic readonly endSide: Side = Side.Before,\n\t) {\n\t\tthis.#id = id;\n\t}\n\n\tpublic get properties(): Readonly<PropertySet> {\n\t\treturn this.#properties;\n\t}\n\n\t/***/\n\tpublic get stickiness(): IntervalStickiness {\n\t\tthis.verifyNotDispose();\n\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\treturn computeStickinessFromSide(\n\t\t\tstartSegment?.endpointType,\n\t\t\tthis.startSide,\n\t\t\tendSegment?.endpointType,\n\t\t\tthis.endSide,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.getIntervalId}\n\t */\n\tpublic getIntervalId(): string {\n\t\treturn this.#id;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compare}\n\t */\n\tpublic compare(b: SequenceInterval) {\n\t\tconst startResult = this.compareStart(b);\n\t\tif (startResult === 0) {\n\t\t\tconst endResult = this.compareEnd(b);\n\t\t\tif (endResult === 0) {\n\t\t\t\tconst thisId = this.getIntervalId();\n\t\t\t\tif (thisId) {\n\t\t\t\t\tconst bId = b.getIntervalId();\n\t\t\t\t\tif (bId) {\n\t\t\t\t\t\treturn thisId > bId ? 1 : thisId < bId ? -1 : 0;\n\t\t\t\t\t}\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\treturn endResult;\n\t\t\t}\n\t\t} else {\n\t\t\treturn startResult;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareStart}\n\t */\n\tpublic compareStart(b: SequenceInterval) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst dist = compareReferencePositions(this.start, b.start);\n\n\t\tif (dist === 0) {\n\t\t\treturn compareSides(this.startSide, b.startSide);\n\t\t}\n\n\t\treturn dist;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareEnd}\n\t */\n\tpublic compareEnd(b: SequenceInterval): number {\n\t\tthis.verifyNotDispose();\n\n\t\tconst dist = compareReferencePositions(this.end, b.end);\n\n\t\tif (dist === 0) {\n\t\t\treturn compareSides(b.endSide, this.endSide);\n\t\t}\n\n\t\treturn dist;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.overlaps}\n\t */\n\tpublic overlaps(b: SequenceInterval) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst result =\n\t\t\tcompareReferencePositions(this.start, b.end) <= 0 &&\n\t\t\tcompareReferencePositions(this.end, b.start) >= 0;\n\t\treturn result;\n\t}\n\n\t/**\n\t * Whether this interval overlaps the provided numerical positions.\n\t */\n\tpublic overlapsPos(_bstart: number, _bend: number): boolean {\n\t\tassert(false, 0xcd7 /* overlapsPos not supported on BaseSequenceInterval */);\n\t}\n\n\tpublic clone(): BaseSequenceInterval {\n\t\tassert(false, 0xcd8 /* clone not supported on BaseSequenceInterval */);\n\t}\n\n\tpublic union(_b: BaseSequenceInterval): BaseSequenceInterval {\n\t\tassert(false, 0xcd9 /* union not supported on BaseSequenceInterval */);\n\t}\n\n\tprotected verifyNotDispose(): void {\n\t\t// No-op: transient intervals are not disposable.\n\t}\n}\n\nexport class SequenceIntervalClass\n\textends BaseSequenceInterval\n\timplements ISerializableInterval, IDisposable\n{\n\treadonly #props: {\n\t\tpropertyManager?: PropertiesManager;\n\t\tproperties: PropertySet;\n\t} = { properties: createMap<any>() };\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic override get properties(): Readonly<PropertySet> {\n\t\tthis.verifyNotDispose();\n\t\treturn this.#props.properties;\n\t}\n\n\tpublic changeProperties(\n\t\tprops: PropertySet | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\trollback?: boolean,\n\t) {\n\t\tthis.verifyNotDispose();\n\n\t\tif (props !== undefined) {\n\t\t\tthis.#props.propertyManager ??= new PropertiesManager();\n\t\t\treturn this.#props.propertyManager.handleProperties(\n\t\t\t\t{ props },\n\t\t\t\tthis.#props,\n\t\t\t\tthis.client.getCollabWindow().collaborating\n\t\t\t\t\t? (op?.sequenceNumber ?? UnassignedSequenceNumber)\n\t\t\t\t\t: UniversalSequenceNumber,\n\t\t\t\top?.minimumSequenceNumber ?? UniversalSequenceNumber,\n\t\t\t\tthis.client.getCollabWindow().collaborating,\n\t\t\t\trollback,\n\t\t\t);\n\t\t}\n\t}\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\tid: string,\n\t\tprivate readonly label: string,\n\t\tstart: LocalReferencePosition,\n\t\tend: LocalReferencePosition,\n\t\tintervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\tstartSide: Side = Side.Before,\n\t\tendSide: Side = Side.Before,\n\t) {\n\t\tsuper(id, start, end, intervalType, startSide, endSide);\n\t\tif (props) {\n\t\t\tthis.#props.properties = addProperties(this.#props.properties, props);\n\t\t}\n\t}\n\t#disposed = false;\n\tpublic get disposed() {\n\t\treturn this.#disposed;\n\t}\n\tpublic dispose(error?: Error): void {\n\t\tif (this.#disposed) return;\n\t\tthis.#disposed = true;\n\t\tthis.client.removeLocalReferencePosition(this.start);\n\t\tthis.client.removeLocalReferencePosition(this.end);\n\t\tthis.removePositionChangeListeners();\n\t\tthis.#props.propertyManager = undefined;\n\t}\n\n\tprotected override verifyNotDispose() {\n\t\tif (this.#disposed) {\n\t\t\tthrow new LoggingError(\"Invalid interval access after dispose\");\n\t\t}\n\t}\n\n\tprivate callbacks?: Record<\"beforePositionChange\" | \"afterPositionChange\", () => void>;\n\n\t/**\n\t * Subscribes to position change events on this interval if there are no current listeners.\n\t */\n\tpublic addPositionChangeListeners(\n\t\tbeforePositionChange: () => void,\n\t\tafterPositionChange: () => void,\n\t): void {\n\t\tthis.verifyNotDispose();\n\t\tif (this.callbacks === undefined) {\n\t\t\tthis.callbacks = {\n\t\t\t\tbeforePositionChange,\n\t\t\t\tafterPositionChange,\n\t\t\t};\n\n\t\t\tconst startCbs = (this.start.callbacks ??= {});\n\t\t\tconst endCbs = (this.end.callbacks ??= {});\n\t\t\tstartCbs.beforeSlide = endCbs.beforeSlide = beforePositionChange;\n\t\t\tstartCbs.afterSlide = endCbs.afterSlide = afterPositionChange;\n\t\t}\n\t}\n\n\t/**\n\t * Removes the currently subscribed position change listeners.\n\t */\n\tpublic removePositionChangeListeners(): void {\n\t\tif (this.callbacks) {\n\t\t\tthis.callbacks = undefined;\n\t\t\tthis.start.callbacks = undefined;\n\t\t\tthis.end.callbacks = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.serialize}\n\t */\n\tpublic serialize(): ISerializedInterval {\n\t\tthis.verifyNotDispose();\n\n\t\treturn this.serializeDelta({\n\t\t\tprops: this.properties,\n\t\t\tincludeEndpoints: true,\n\t\t}) as ISerializedInterval;\n\t}\n\n\tpublic serializeDelta({\n\t\tprops,\n\t\tincludeEndpoints,\n\t}: {\n\t\tprops: PropertySet | undefined;\n\t\tincludeEndpoints: boolean;\n\t}): SerializedIntervalDelta {\n\t\tthis.verifyNotDispose();\n\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\tconst startPosition = includeEndpoints\n\t\t\t? (startSegment?.endpointType ??\n\t\t\t\tthis.client.localReferencePositionToPosition(this.start))\n\t\t\t: undefined;\n\t\tconst endPosition = includeEndpoints\n\t\t\t? (endSegment?.endpointType ?? this.client.localReferencePositionToPosition(this.end))\n\t\t\t: undefined;\n\t\treturn {\n\t\t\tend: endPosition,\n\t\t\tintervalType: this.intervalType,\n\t\t\tsequenceNumber: this.client.getCurrentSeq(),\n\t\t\tstart: startPosition,\n\t\t\tstickiness: this.stickiness,\n\t\t\tstartSide: includeEndpoints ? this.startSide : undefined,\n\t\t\tendSide: includeEndpoints ? this.endSide : undefined,\n\t\t\tproperties: {\n\t\t\t\t...props,\n\t\t\t\t[reservedIntervalIdKey]: this.getIntervalId(),\n\t\t\t\t[reservedRangeLabelsKey]: [this.label],\n\t\t\t},\n\t\t} satisfies SerializedIntervalDelta;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone(): SequenceIntervalClass {\n\t\tthis.verifyNotDispose();\n\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tthis.getIntervalId(),\n\t\t\tthis.label,\n\t\t\tthis.start,\n\t\t\tthis.end,\n\t\t\tthis.intervalType,\n\t\t\tthis.properties,\n\t\t\tthis.startSide,\n\t\t\tthis.endSide,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.union}\n\t */\n\tpublic union(b: SequenceIntervalClass) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst newStart = minReferencePosition(this.start, b.start);\n\t\tconst newEnd = maxReferencePosition(this.end, b.end);\n\n\t\tlet startSide: Side;\n\n\t\tif (this.start === b.start) {\n\t\t\tstartSide = minSide(this.startSide, b.startSide);\n\t\t} else {\n\t\t\tstartSide = this.start === newStart ? this.startSide : b.startSide;\n\t\t}\n\n\t\tlet endSide: Side;\n\n\t\tif (this.end === b.end) {\n\t\t\tendSide = maxSide(this.endSide, b.endSide);\n\t\t} else {\n\t\t\tendSide = this.end === newEnd ? this.endSide : b.endSide;\n\t\t}\n\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tuuid(),\n\t\t\tthis.label,\n\t\t\tnewStart,\n\t\t\tnewEnd,\n\t\t\tthis.intervalType,\n\t\t\tundefined,\n\t\t\tstartSide,\n\t\t\tendSide,\n\t\t);\n\t}\n\n\t/**\n\t * Whether this interval overlaps the provided numerical positions.\n\t */\n\tpublic override overlapsPos(bstart: number, bend: number) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst startPos = this.client.localReferencePositionToPosition(this.start);\n\t\tconst endPos = this.client.localReferencePositionToPosition(this.end);\n\t\treturn endPos > bstart && startPos < bend;\n\t}\n\n\tpublic moveEndpointReferences(\n\t\trebased: Record<\"start\" | \"end\", { segment: ISegment; offset: number }>,\n\t) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst startRef = createPositionReferenceFromSegoff({\n\t\t\tclient: this.client,\n\t\t\tsegoff: rebased.start,\n\t\t\trefType: this.start.refType,\n\t\t\tslidingPreference: this.start.slidingPreference,\n\t\t\tcanSlideToEndpoint: this.start.canSlideToEndpoint,\n\t\t});\n\t\tif (this.start.properties) {\n\t\t\tstartRef.addProperties(this.start.properties);\n\t\t}\n\t\tthis.start = startRef;\n\n\t\tconst endRef = createPositionReferenceFromSegoff({\n\t\t\tclient: this.client,\n\t\t\tsegoff: rebased.end,\n\t\t\trefType: this.end.refType,\n\t\t\tslidingPreference: this.end.slidingPreference,\n\t\t\tcanSlideToEndpoint: this.end.canSlideToEndpoint,\n\t\t});\n\t\tif (this.end.properties) {\n\t\t\tendRef.addProperties(this.end.properties);\n\t\t}\n\t\tthis.end = endRef;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.modify}\n\t */\n\tpublic modify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tcanSlideToEndpoint: boolean = false,\n\t) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst { startSide, endSide, startPos, endPos } = endpointPosAndSide(start, end);\n\t\tconst getRefType = (baseType: ReferenceType): ReferenceType => {\n\t\t\tlet refType = baseType;\n\t\t\tif (op === undefined) {\n\t\t\t\trefType &= ~ReferenceType.SlideOnRemove;\n\t\t\t\trefType |= ReferenceType.StayOnRemove;\n\t\t\t} else {\n\t\t\t\trefType &= ~ReferenceType.StayOnRemove;\n\t\t\t\trefType |= ReferenceType.SlideOnRemove;\n\t\t\t}\n\t\t\treturn refType;\n\t\t};\n\n\t\tlet startRef = this.start;\n\t\tif (startPos !== undefined) {\n\t\t\tconst slidingPreference = startReferenceSlidingPreference(\n\t\t\t\tstartPos,\n\t\t\t\tstartSide ?? Side.Before,\n\t\t\t\tendPos,\n\t\t\t\tendSide ?? Side.Before,\n\t\t\t);\n\t\t\tstartRef = createPositionReference({\n\t\t\t\tclient: this.client,\n\t\t\t\tpos: startPos,\n\t\t\t\trefType: getRefType(this.start.refType),\n\t\t\t\top,\n\t\t\t\tlocalSeq,\n\t\t\t\tslidingPreference,\n\t\t\t\tcanSlideToEndpoint:\n\t\t\t\t\tcanSlideToEndpoint && slidingPreference === SlidingPreference.BACKWARD,\n\t\t\t});\n\t\t\tif (this.start.properties) {\n\t\t\t\tstartRef.addProperties(this.start.properties);\n\t\t\t}\n\t\t}\n\n\t\tlet endRef = this.end;\n\t\tif (endPos !== undefined) {\n\t\t\tconst slidingPreference = endReferenceSlidingPreference(\n\t\t\t\tstartPos,\n\t\t\t\tstartSide ?? Side.Before,\n\t\t\t\tendPos,\n\t\t\t\tendSide ?? Side.Before,\n\t\t\t);\n\t\t\tendRef = createPositionReference({\n\t\t\t\tclient: this.client,\n\t\t\t\tpos: endPos,\n\t\t\t\trefType: getRefType(this.end.refType),\n\t\t\t\top,\n\t\t\t\tlocalSeq,\n\t\t\t\tslidingPreference,\n\t\t\t\tcanSlideToEndpoint:\n\t\t\t\t\tcanSlideToEndpoint && slidingPreference === SlidingPreference.FORWARD,\n\t\t\t});\n\t\t\tif (this.end.properties) {\n\t\t\t\tendRef.addProperties(this.end.properties);\n\t\t\t}\n\t\t}\n\n\t\tconst newInterval = new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tthis.getIntervalId(),\n\t\t\tthis.label,\n\t\t\tstartRef,\n\t\t\tendRef,\n\t\t\tthis.intervalType,\n\t\t\tundefined,\n\t\t\tstartSide ?? this.startSide,\n\t\t\tendSide ?? this.endSide,\n\t\t);\n\t\tnewInterval.#props.propertyManager = this.#props.propertyManager ??=\n\t\t\tnew PropertiesManager();\n\t\tnewInterval.#props.properties = this.#props.properties;\n\t\treturn newInterval;\n\t}\n\n\tpublic ackPropertiesChange(newProps: PropertySet, op: ISequencedDocumentMessage) {\n\t\tthis.verifyNotDispose();\n\n\t\tif (Object.keys(newProps).length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(\n\t\t\tthis.#props.propertyManager !== undefined,\n\t\t\t0xbd5 /* must have property manager to ack */,\n\t\t);\n\t\t// Let the propertyManager prune its pending change-properties set.\n\t\tthis.#props.propertyManager.ack(op.sequenceNumber, op.minimumSequenceNumber, {\n\t\t\tprops: newProps,\n\t\t});\n\t}\n}\n\nexport function createPositionReferenceFromSegoff({\n\tclient,\n\tsegoff,\n\trefType,\n\top,\n\tlocalSeq,\n\tfromSnapshot,\n\tslidingPreference,\n\tcanSlideToEndpoint,\n\trollback,\n}: {\n\tclient: Client;\n\tsegoff: { segment: ISegment; offset: number } | undefined | \"start\" | \"end\";\n\trefType: ReferenceType;\n\top?: ISequencedDocumentMessage;\n\tlocalSeq?: number;\n\tfromSnapshot?: boolean;\n\tslidingPreference: SlidingPreference | undefined;\n\tcanSlideToEndpoint: boolean | undefined;\n\trollback?: boolean;\n}): LocalReferencePosition {\n\tif (segoff === \"start\" || segoff === \"end\") {\n\t\treturn client.createLocalReferencePosition(\n\t\t\tsegoff,\n\t\t\tundefined,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\n\tif (segoff?.segment) {\n\t\tconst ref = client.createLocalReferencePosition(\n\t\t\tsegoff.segment,\n\t\t\tsegoff.offset,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t\treturn ref;\n\t}\n\n\t// Creating references on detached segments is allowed for:\n\t// - Transient segments\n\t// - References coming from a remote client (location may have been concurrently removed)\n\t// - References being rebased to a new sequence number\n\t// (segment they originally referred to may have been removed with no suitable replacement)\n\tif (\n\t\t!op &&\n\t\t!localSeq &&\n\t\t!fromSnapshot &&\n\t\t!refTypeIncludesFlag(refType, ReferenceType.Transient) &&\n\t\t!rollback\n\t) {\n\t\tthrow new UsageError(\"Non-transient references need segment\");\n\t}\n\n\treturn createDetachedLocalReferencePosition(slidingPreference, refType);\n}\n\n/**\n * Resolves a position to a {@link LocalReferencePosition} using an\n * {@link ISharedSegmentSequence} (no Client or op context needed).\n */\nexport function resolvePositionRef(\n\tsequence: ISharedSegmentSequence<any>,\n\tpos: number | \"start\" | \"end\",\n\trefType: ReferenceType,\n\tslidingPreference: SlidingPreference,\n\tcanSlideToEndpoint?: boolean,\n): LocalReferencePosition {\n\tif (pos === \"start\" || pos === \"end\") {\n\t\treturn sequence.createLocalReferencePosition(\n\t\t\tpos,\n\t\t\tundefined,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\tconst segoff = sequence.getContainingSegment(pos);\n\tif (segoff?.segment !== undefined && segoff?.offset !== undefined) {\n\t\treturn sequence.createLocalReferencePosition(\n\t\t\tsegoff.segment,\n\t\t\tsegoff.offset,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\treturn createDetachedLocalReferencePosition(slidingPreference, refType);\n}\n\nfunction createPositionReference({\n\tclient,\n\tpos,\n\trefType,\n\top,\n\tfromSnapshot,\n\tlocalSeq,\n\tslidingPreference,\n\tcanSlideToEndpoint,\n\trollback,\n}: {\n\tclient: Client;\n\tpos: number | \"start\" | \"end\";\n\trefType: ReferenceType;\n\top?: ISequencedDocumentMessage;\n\tfromSnapshot?: boolean;\n\tlocalSeq?: number;\n\tslidingPreference: SlidingPreference;\n\tcanSlideToEndpoint: boolean;\n\trollback?: boolean;\n}): LocalReferencePosition {\n\tlet segoff;\n\n\tif (op) {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) !== 0,\n\t\t\t0x2f5 /* op create references must be SlideOnRemove */,\n\t\t);\n\t\tif (pos === \"start\" || pos === \"end\") {\n\t\t\tsegoff = pos;\n\t\t} else {\n\t\t\tsegoff = client.getContainingSegment(pos, {\n\t\t\t\treferenceSequenceNumber: op.referenceSequenceNumber,\n\t\t\t\tclientId: op.clientId,\n\t\t\t});\n\t\t\tsegoff = getSlideToSegoff(segoff, slidingPreference, undefined, canSlideToEndpoint);\n\t\t}\n\t} else {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) === 0 || !!fromSnapshot,\n\t\t\t0x2f6 /* SlideOnRemove references must be op created */,\n\t\t);\n\t\tsegoff =\n\t\t\tpos === \"start\" || pos === \"end\"\n\t\t\t\t? pos\n\t\t\t\t: client.getContainingSegment(pos, undefined, localSeq);\n\t}\n\n\treturn createPositionReferenceFromSegoff({\n\t\tclient,\n\t\tsegoff,\n\t\trefType,\n\t\top,\n\t\tlocalSeq,\n\t\tfromSnapshot,\n\t\tslidingPreference,\n\t\tcanSlideToEndpoint,\n\t\trollback,\n\t});\n}\n\n/**\n * Creates a transient interval using an `ISharedSegmentSequence` instead of a `Client`.\n * This avoids coupling index classes to merge-tree internals.\n */\nexport function createTransientIntervalFromSequence(\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tsequence: ISharedSegmentSequence<any>,\n): BaseSequenceInterval {\n\tconst { startPos, startSide, endPos, endSide } = endpointPosAndSide(\n\t\tstart ?? \"start\",\n\t\tend ?? \"end\",\n\t);\n\tassert(\n\t\tstartPos !== undefined &&\n\t\t\tendPos !== undefined &&\n\t\t\tstartSide !== undefined &&\n\t\t\tendSide !== undefined,\n\t\t0xcda /* start and end cannot be undefined because they were not passed in as undefined */,\n\t);\n\n\tconst startSlidingPref = startReferenceSlidingPreference(\n\t\tstartPos,\n\t\tstartSide,\n\t\tendPos,\n\t\tendSide,\n\t);\n\tconst endSlidingPref = endReferenceSlidingPreference(startPos, startSide, endPos, endSide);\n\n\tconst startLref = resolvePositionRef(\n\t\tsequence,\n\t\tstartPos,\n\t\tReferenceType.Transient,\n\t\tstartSlidingPref,\n\t);\n\tconst endLref = resolvePositionRef(\n\t\tsequence,\n\t\tendPos,\n\t\tReferenceType.Transient,\n\t\tendSlidingPref,\n\t);\n\n\tconst rangeProp = {\n\t\t[reservedRangeLabelsKey]: [\"transient\"],\n\t};\n\tstartLref.addProperties(rangeProp);\n\tendLref.addProperties(rangeProp);\n\n\treturn new BaseSequenceInterval(\n\t\tuuid(),\n\t\tstartLref,\n\t\tendLref,\n\t\tIntervalType.Transient,\n\t\tstartSide,\n\t\tendSide,\n\t);\n}\n\nexport function createSequenceInterval(\n\tlabel: string,\n\tid: string,\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tclient: Client,\n\tintervalType: IntervalType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tcanSlideToEndpoint: boolean = false,\n\tprops?: PropertySet,\n\trollback?: boolean,\n): SequenceIntervalClass {\n\tconst { startPos, startSide, endPos, endSide } = endpointPosAndSide(\n\t\tstart ?? \"start\",\n\t\tend ?? \"end\",\n\t);\n\tassert(\n\t\tstartPos !== undefined &&\n\t\t\tendPos !== undefined &&\n\t\t\tstartSide !== undefined &&\n\t\t\tendSide !== undefined,\n\t\t0x794 /* start and end cannot be undefined because they were not passed in as undefined */,\n\t);\n\tlet beginRefType = ReferenceType.RangeBegin;\n\tlet endRefType = ReferenceType.RangeEnd;\n\tif (intervalType === IntervalType.Transient) {\n\t\tbeginRefType = ReferenceType.Transient;\n\t\tendRefType = ReferenceType.Transient;\n\t} else {\n\t\t// All non-transient interval references must eventually be SlideOnRemove\n\t\t// To ensure eventual consistency, they must start as StayOnRemove when\n\t\t// pending (created locally and creation op is not acked)\n\t\tif (op ?? fromSnapshot) {\n\t\t\tbeginRefType |= ReferenceType.SlideOnRemove;\n\t\t\tendRefType |= ReferenceType.SlideOnRemove;\n\t\t} else {\n\t\t\tbeginRefType |= ReferenceType.StayOnRemove;\n\t\t\tendRefType |= ReferenceType.StayOnRemove;\n\t\t}\n\t}\n\n\tconst stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\n\tconst startSlidingPreference = startReferenceSlidingPreference(\n\t\tstartPos,\n\t\tstartSide,\n\t\tendPos,\n\t\tendSide,\n\t);\n\n\tconst endSlidingPreference = endReferenceSlidingPreference(\n\t\tstartPos,\n\t\tstartSide,\n\t\tendPos,\n\t\tendSide,\n\t);\n\n\tconst startLref = createPositionReference({\n\t\tclient,\n\t\tpos: startPos,\n\t\trefType: beginRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tslidingPreference: startSlidingPreference,\n\t\tcanSlideToEndpoint: canSlideToEndpoint && stickiness !== IntervalStickiness.NONE,\n\t\trollback,\n\t});\n\n\tconst endLref = createPositionReference({\n\t\tclient,\n\t\tpos: endPos,\n\t\trefType: endRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tslidingPreference: endSlidingPreference,\n\t\tcanSlideToEndpoint: canSlideToEndpoint && stickiness !== IntervalStickiness.NONE,\n\t\trollback,\n\t});\n\n\tconst rangeProp = {\n\t\t[reservedRangeLabelsKey]: [label],\n\t};\n\tstartLref.addProperties(rangeProp);\n\tendLref.addProperties(rangeProp);\n\n\tconst ival = new SequenceIntervalClass(\n\t\tclient,\n\t\tid,\n\t\tlabel,\n\t\tstartLref,\n\t\tendLref,\n\t\tintervalType,\n\t\tprops === undefined\n\t\t\t? undefined\n\t\t\t: { ...props, [reservedIntervalIdKey]: undefined, [reservedRangeLabelsKey]: undefined },\n\t\tstartSide,\n\t\tendSide,\n\t);\n\treturn ival;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sequenceInterval.js","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;AAKH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAS7D,OAAO,EACN,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EACzB,oCAAoC,EACpC,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,IAAI,EACJ,kBAAkB,EAClB,aAAa,EAEb,wBAAwB,EACxB,uBAAuB,GACvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAKlC,OAAO,EACN,kBAAkB,EAClB,YAAY,EACZ,yBAAyB,EACzB,6BAA6B,EAC7B,+BAA+B,GAG/B,MAAM,oBAAoB,CAAC;AAE5B,SAAS,YAAY,CAAC,KAAW,EAAE,KAAW;IAC7C,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,CAAC;IACV,CAAC;IAED,IAAI,KAAK,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,CAAC;IACV,CAAC;IAED,OAAO,CAAC,CAAC,CAAC;AACX,CAAC;AAED,SAAS,OAAO,CAAC,KAA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E,EACF,KAAK,EACL,SAAS,EACT,OAAO,EACP,YAAY,EACZ,KAAK,KAAK,SAAS;QAClB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,qBAAqB,CAAC,EAAE,SAAS,EAAE,CAAC,sBAAsB,CAAC,EAAE,SAAS,EAAE,EACxF,SAAS,EACT,OAAO,CACP,CAAC;IACF,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport type { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tClient,\n\tISegment,\n\tLocalReferencePosition,\n\tPropertySet,\n\tSequencePlace,\n} from \"@fluidframework/merge-tree/internal\";\nimport {\n\tPropertiesManager,\n\tReferenceType,\n\tSlidingPreference,\n\tcompareReferencePositions,\n\tcreateDetachedLocalReferencePosition,\n\tcreateMap,\n\tgetSlideToSegoff,\n\tmaxReferencePosition,\n\tminReferencePosition,\n\trefTypeIncludesFlag,\n\treservedRangeLabelsKey,\n\tSide,\n\tendpointPosAndSide,\n\taddProperties,\n\ttype ISegmentInternal,\n\tUnassignedSequenceNumber,\n\tUniversalSequenceNumber,\n} from \"@fluidframework/merge-tree/internal\";\nimport { LoggingError, UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type { ISharedSegmentSequence } from \"../sequence.js\";\n\nimport type { ISerializableInterval, ISerializedInterval } from \"./intervalUtils.js\";\nimport {\n\tIntervalStickiness,\n\tIntervalType,\n\tcomputeStickinessFromSide,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n\ttype IInterval,\n\ttype SerializedIntervalDelta,\n} from \"./intervalUtils.js\";\n\nfunction compareSides(sideA: Side, sideB: Side): number {\n\tif (sideA === sideB) {\n\t\treturn 0;\n\t}\n\n\tif (sideA === Side.Before) {\n\t\treturn 1;\n\t}\n\n\treturn -1;\n}\n\nfunction minSide(sideA: Side, sideB: Side): Side {\n\tif (sideA === Side.After && sideB === Side.After) {\n\t\treturn Side.After;\n\t}\n\n\treturn Side.Before;\n}\n\nfunction maxSide(sideA: Side, sideB: Side): Side {\n\tif (sideA === Side.Before && sideB === Side.Before) {\n\t\treturn Side.Before;\n\t}\n\n\treturn Side.After;\n}\n\nconst reservedIntervalIdKey = \"intervalId\";\n\nconst legacyIdPrefix = \"legacy\";\n\nexport function getSerializedProperties(\n\tserializedInterval: ISerializedInterval | SerializedIntervalDelta,\n): {\n\tid: string;\n\tlabels: string[];\n\tproperties: PropertySet;\n} {\n\tconst {\n\t\t[reservedIntervalIdKey]: maybeId,\n\t\t[reservedRangeLabelsKey]: labels,\n\t\t...properties\n\t} = serializedInterval.properties ?? {};\n\t// Create a non-unique ID based on start and end to be used on intervals that come from legacy clients\n\t// without ID's.\n\tconst id =\n\t\tmaybeId ?? `${legacyIdPrefix}${serializedInterval.start}-${serializedInterval.end}`;\n\n\treturn { id, labels, properties };\n}\n\n/**\n * Interval implementation whose ends are associated with positions in a mutatable sequence.\n * As such, when content is inserted into the middle of the interval, the interval expands to\n * include that content.\n *\n * @remarks The endpoints' positions should be treated exclusively to get\n * reasonable behavior. E.g., an interval referring to \"hello\" in \"hello world\"\n * should have a start position of 0 and an end position of 5.\n *\n * To see why, consider what happens if \"llo wor\" is removed from the string to make \"held\".\n * The interval's startpoint remains on the \"h\" (it isn't altered), but the interval's endpoint\n * slides forward to the next unremoved position, which is the \"l\" in \"held\".\n * Users would generally expect the interval to now refer to \"he\" (as it is the subset of content\n * remaining after the removal), hence the \"l\" should be excluded.\n * If the interval endpoint was treated inclusively, the interval would now refer to \"hel\", which\n * is undesirable.\n *\n * Since the endpoints of an interval are treated exclusively but cannot be greater\n * than or equal to the length of the associated sequence, there exist special\n * endpoint segments, \"start\" and \"end\", which represent the position immediately\n * before or immediately after the string respectively.\n *\n * If a `SequenceInterval` is created on a sequence with the\n * `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints\n * of the interval that are exclusive will have the ability to slide to these\n * special endpoint segments.\n * @legacy @beta\n */\nexport interface SequenceInterval extends IInterval {\n\treadonly start: LocalReferencePosition;\n\t/**\n\t * End endpoint of this interval.\n\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t */\n\treadonly end: LocalReferencePosition;\n\treadonly intervalType: IntervalType;\n\treadonly startSide: Side;\n\treadonly endSide: Side;\n\treadonly stickiness: IntervalStickiness;\n\n\t/** Serializable bag of properties associated with the interval. */\n\tproperties: PropertySet;\n\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: SequenceInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: SequenceInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: SequenceInterval): number;\n\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Intervals are considered to overlap if their intersection is non-empty.\n\t */\n\toverlaps(b: SequenceInterval): boolean;\n\n\t/**\n\t * @returns whether this interval overlaps two numerical positions.\n\t */\n\toverlapsPos(bstart: number, bend: number): boolean;\n\n\t/**\n\t * Gets the id associated with this interval.\n\t * When the interval is used as part of an interval collection, this id can be used to modify or remove the\n\t * interval.\n\t */\n\tgetIntervalId(): string;\n}\n\n/**\n * Lightweight interval for index queries (overlap, comparison).\n * Has no Client dependency; cannot serialize or be disposed.\n */\nexport class BaseSequenceInterval implements SequenceInterval, ISerializableInterval {\n\treadonly #id: string;\n\treadonly #properties: PropertySet = createMap<any>();\n\n\tconstructor(\n\t\tid: string,\n\t\t/**\n\t\t * Start endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic start: LocalReferencePosition,\n\t\t/**\n\t\t * End endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic end: LocalReferencePosition,\n\t\tpublic intervalType: IntervalType,\n\t\tpublic readonly startSide: Side = Side.Before,\n\t\tpublic readonly endSide: Side = Side.Before,\n\t) {\n\t\tthis.#id = id;\n\t}\n\n\tpublic get properties(): Readonly<PropertySet> {\n\t\treturn this.#properties;\n\t}\n\n\t/***/\n\tpublic get stickiness(): IntervalStickiness {\n\t\tthis.verifyNotDispose();\n\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\treturn computeStickinessFromSide(\n\t\t\tstartSegment?.endpointType,\n\t\t\tthis.startSide,\n\t\t\tendSegment?.endpointType,\n\t\t\tthis.endSide,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.getIntervalId}\n\t */\n\tpublic getIntervalId(): string {\n\t\treturn this.#id;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compare}\n\t */\n\tpublic compare(b: SequenceInterval) {\n\t\tconst startResult = this.compareStart(b);\n\t\tif (startResult === 0) {\n\t\t\tconst endResult = this.compareEnd(b);\n\t\t\tif (endResult === 0) {\n\t\t\t\tconst thisId = this.getIntervalId();\n\t\t\t\tif (thisId) {\n\t\t\t\t\tconst bId = b.getIntervalId();\n\t\t\t\t\tif (bId) {\n\t\t\t\t\t\treturn thisId > bId ? 1 : thisId < bId ? -1 : 0;\n\t\t\t\t\t}\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\treturn endResult;\n\t\t\t}\n\t\t} else {\n\t\t\treturn startResult;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareStart}\n\t */\n\tpublic compareStart(b: SequenceInterval) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst dist = compareReferencePositions(this.start, b.start);\n\n\t\tif (dist === 0) {\n\t\t\treturn compareSides(this.startSide, b.startSide);\n\t\t}\n\n\t\treturn dist;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareEnd}\n\t */\n\tpublic compareEnd(b: SequenceInterval): number {\n\t\tthis.verifyNotDispose();\n\n\t\tconst dist = compareReferencePositions(this.end, b.end);\n\n\t\tif (dist === 0) {\n\t\t\treturn compareSides(b.endSide, this.endSide);\n\t\t}\n\n\t\treturn dist;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.overlaps}\n\t */\n\tpublic overlaps(b: SequenceInterval) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst result =\n\t\t\tcompareReferencePositions(this.start, b.end) <= 0 &&\n\t\t\tcompareReferencePositions(this.end, b.start) >= 0;\n\t\treturn result;\n\t}\n\n\t/**\n\t * Whether this interval overlaps the provided numerical positions.\n\t */\n\tpublic overlapsPos(_bstart: number, _bend: number): boolean {\n\t\tassert(false, 0xcd7 /* overlapsPos not supported on BaseSequenceInterval */);\n\t}\n\n\tpublic clone(): BaseSequenceInterval {\n\t\tassert(false, 0xcd8 /* clone not supported on BaseSequenceInterval */);\n\t}\n\n\tpublic union(_b: BaseSequenceInterval): BaseSequenceInterval {\n\t\tassert(false, 0xcd9 /* union not supported on BaseSequenceInterval */);\n\t}\n\n\tprotected verifyNotDispose(): void {\n\t\t// No-op: transient intervals are not disposable.\n\t}\n}\n\nexport class SequenceIntervalClass\n\textends BaseSequenceInterval\n\timplements ISerializableInterval, IDisposable\n{\n\treadonly #props: {\n\t\tpropertyManager?: PropertiesManager;\n\t\tproperties: PropertySet;\n\t} = { properties: createMap<any>() };\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic override get properties(): Readonly<PropertySet> {\n\t\tthis.verifyNotDispose();\n\t\treturn this.#props.properties;\n\t}\n\n\tpublic changeProperties(\n\t\tprops: PropertySet | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\trollback?: boolean,\n\t) {\n\t\tthis.verifyNotDispose();\n\n\t\tif (props !== undefined) {\n\t\t\tthis.#props.propertyManager ??= new PropertiesManager();\n\t\t\treturn this.#props.propertyManager.handleProperties(\n\t\t\t\t{ props },\n\t\t\t\tthis.#props,\n\t\t\t\tthis.client.getCollabWindow().collaborating\n\t\t\t\t\t? (op?.sequenceNumber ?? UnassignedSequenceNumber)\n\t\t\t\t\t: UniversalSequenceNumber,\n\t\t\t\top?.minimumSequenceNumber ?? UniversalSequenceNumber,\n\t\t\t\tthis.client.getCollabWindow().collaborating,\n\t\t\t\trollback,\n\t\t\t);\n\t\t}\n\t}\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\tid: string,\n\t\tprivate readonly label: string,\n\t\tstart: LocalReferencePosition,\n\t\tend: LocalReferencePosition,\n\t\tintervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\tstartSide: Side = Side.Before,\n\t\tendSide: Side = Side.Before,\n\t) {\n\t\tsuper(id, start, end, intervalType, startSide, endSide);\n\t\tif (props) {\n\t\t\tthis.#props.properties = addProperties(this.#props.properties, props);\n\t\t}\n\t}\n\t#disposed = false;\n\tpublic get disposed() {\n\t\treturn this.#disposed;\n\t}\n\tpublic dispose(error?: Error): void {\n\t\tif (this.#disposed) return;\n\t\tthis.#disposed = true;\n\t\tthis.client.removeLocalReferencePosition(this.start);\n\t\tthis.client.removeLocalReferencePosition(this.end);\n\t\tthis.removePositionChangeListeners();\n\t\tthis.#props.propertyManager = undefined;\n\t}\n\n\tprotected override verifyNotDispose() {\n\t\tif (this.#disposed) {\n\t\t\tthrow new LoggingError(\"Invalid interval access after dispose\");\n\t\t}\n\t}\n\n\tprivate callbacks?: Record<\"beforePositionChange\" | \"afterPositionChange\", () => void>;\n\n\t/**\n\t * Subscribes to position change events on this interval if there are no current listeners.\n\t */\n\tpublic addPositionChangeListeners(\n\t\tbeforePositionChange: () => void,\n\t\tafterPositionChange: () => void,\n\t): void {\n\t\tthis.verifyNotDispose();\n\t\tif (this.callbacks === undefined) {\n\t\t\tthis.callbacks = {\n\t\t\t\tbeforePositionChange,\n\t\t\t\tafterPositionChange,\n\t\t\t};\n\n\t\t\tconst startCbs = (this.start.callbacks ??= {});\n\t\t\tconst endCbs = (this.end.callbacks ??= {});\n\t\t\tstartCbs.beforeSlide = endCbs.beforeSlide = beforePositionChange;\n\t\t\tstartCbs.afterSlide = endCbs.afterSlide = afterPositionChange;\n\t\t}\n\t}\n\n\t/**\n\t * Removes the currently subscribed position change listeners.\n\t */\n\tpublic removePositionChangeListeners(): void {\n\t\tif (this.callbacks) {\n\t\t\tthis.callbacks = undefined;\n\t\t\tthis.start.callbacks = undefined;\n\t\t\tthis.end.callbacks = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.serialize}\n\t */\n\tpublic serialize(): ISerializedInterval {\n\t\tthis.verifyNotDispose();\n\n\t\treturn this.serializeDelta({\n\t\t\tprops: this.properties,\n\t\t\tincludeEndpoints: true,\n\t\t}) as ISerializedInterval;\n\t}\n\n\tpublic serializeDelta({\n\t\tprops,\n\t\tincludeEndpoints,\n\t}: {\n\t\tprops: PropertySet | undefined;\n\t\tincludeEndpoints: boolean;\n\t}): SerializedIntervalDelta {\n\t\tthis.verifyNotDispose();\n\n\t\tconst startSegment: ISegmentInternal | undefined = this.start.getSegment();\n\t\tconst endSegment: ISegmentInternal | undefined = this.end.getSegment();\n\t\tconst startPosition = includeEndpoints\n\t\t\t? (startSegment?.endpointType ??\n\t\t\t\tthis.client.localReferencePositionToPosition(this.start))\n\t\t\t: undefined;\n\t\tconst endPosition = includeEndpoints\n\t\t\t? (endSegment?.endpointType ?? this.client.localReferencePositionToPosition(this.end))\n\t\t\t: undefined;\n\t\treturn {\n\t\t\tend: endPosition,\n\t\t\tintervalType: this.intervalType,\n\t\t\tsequenceNumber: this.client.getCurrentSeq(),\n\t\t\tstart: startPosition,\n\t\t\tstickiness: this.stickiness,\n\t\t\tstartSide: includeEndpoints ? this.startSide : undefined,\n\t\t\tendSide: includeEndpoints ? this.endSide : undefined,\n\t\t\tproperties: {\n\t\t\t\t...props,\n\t\t\t\t[reservedIntervalIdKey]: this.getIntervalId(),\n\t\t\t\t[reservedRangeLabelsKey]: [this.label],\n\t\t\t},\n\t\t} satisfies SerializedIntervalDelta;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone(): SequenceIntervalClass {\n\t\tthis.verifyNotDispose();\n\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tthis.getIntervalId(),\n\t\t\tthis.label,\n\t\t\tthis.start,\n\t\t\tthis.end,\n\t\t\tthis.intervalType,\n\t\t\tthis.properties,\n\t\t\tthis.startSide,\n\t\t\tthis.endSide,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.union}\n\t */\n\tpublic union(b: SequenceIntervalClass) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst newStart = minReferencePosition(this.start, b.start);\n\t\tconst newEnd = maxReferencePosition(this.end, b.end);\n\n\t\tlet startSide: Side;\n\n\t\tif (this.start === b.start) {\n\t\t\tstartSide = minSide(this.startSide, b.startSide);\n\t\t} else {\n\t\t\tstartSide = this.start === newStart ? this.startSide : b.startSide;\n\t\t}\n\n\t\tlet endSide: Side;\n\n\t\tif (this.end === b.end) {\n\t\t\tendSide = maxSide(this.endSide, b.endSide);\n\t\t} else {\n\t\t\tendSide = this.end === newEnd ? this.endSide : b.endSide;\n\t\t}\n\n\t\treturn new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tuuid(),\n\t\t\tthis.label,\n\t\t\tnewStart,\n\t\t\tnewEnd,\n\t\t\tthis.intervalType,\n\t\t\tundefined,\n\t\t\tstartSide,\n\t\t\tendSide,\n\t\t);\n\t}\n\n\t/**\n\t * Whether this interval overlaps the provided numerical positions.\n\t */\n\tpublic override overlapsPos(bstart: number, bend: number) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst startPos = this.client.localReferencePositionToPosition(this.start);\n\t\tconst endPos = this.client.localReferencePositionToPosition(this.end);\n\t\treturn endPos > bstart && startPos < bend;\n\t}\n\n\tpublic moveEndpointReferences(\n\t\trebased: Record<\"start\" | \"end\", { segment: ISegment; offset: number }>,\n\t) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst startRef = createPositionReferenceFromSegoff({\n\t\t\tclient: this.client,\n\t\t\tsegoff: rebased.start,\n\t\t\trefType: this.start.refType,\n\t\t\tslidingPreference: this.start.slidingPreference,\n\t\t\tcanSlideToEndpoint: this.start.canSlideToEndpoint,\n\t\t});\n\t\tif (this.start.properties) {\n\t\t\tstartRef.addProperties(this.start.properties);\n\t\t}\n\t\tthis.start = startRef;\n\n\t\tconst endRef = createPositionReferenceFromSegoff({\n\t\t\tclient: this.client,\n\t\t\tsegoff: rebased.end,\n\t\t\trefType: this.end.refType,\n\t\t\tslidingPreference: this.end.slidingPreference,\n\t\t\tcanSlideToEndpoint: this.end.canSlideToEndpoint,\n\t\t});\n\t\tif (this.end.properties) {\n\t\t\tendRef.addProperties(this.end.properties);\n\t\t}\n\t\tthis.end = endRef;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.modify}\n\t */\n\tpublic modify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tcanSlideToEndpoint: boolean = false,\n\t) {\n\t\tthis.verifyNotDispose();\n\n\t\tconst { startSide, endSide, startPos, endPos } = endpointPosAndSide(start, end);\n\t\tconst getRefType = (baseType: ReferenceType): ReferenceType => {\n\t\t\tlet refType = baseType;\n\t\t\tif (op === undefined) {\n\t\t\t\trefType &= ~ReferenceType.SlideOnRemove;\n\t\t\t\trefType |= ReferenceType.StayOnRemove;\n\t\t\t} else {\n\t\t\t\trefType &= ~ReferenceType.StayOnRemove;\n\t\t\t\trefType |= ReferenceType.SlideOnRemove;\n\t\t\t}\n\t\t\treturn refType;\n\t\t};\n\n\t\tlet startRef = this.start;\n\t\tif (startPos !== undefined) {\n\t\t\tconst slidingPreference = startReferenceSlidingPreference(\n\t\t\t\tstartPos,\n\t\t\t\tstartSide ?? Side.Before,\n\t\t\t\tendPos,\n\t\t\t\tendSide ?? Side.Before,\n\t\t\t);\n\t\t\tstartRef = createPositionReference({\n\t\t\t\tclient: this.client,\n\t\t\t\tpos: startPos,\n\t\t\t\trefType: getRefType(this.start.refType),\n\t\t\t\top,\n\t\t\t\tlocalSeq,\n\t\t\t\tslidingPreference,\n\t\t\t\tcanSlideToEndpoint:\n\t\t\t\t\tcanSlideToEndpoint && slidingPreference === SlidingPreference.BACKWARD,\n\t\t\t});\n\t\t\tif (this.start.properties) {\n\t\t\t\tstartRef.addProperties(this.start.properties);\n\t\t\t}\n\t\t}\n\n\t\tlet endRef = this.end;\n\t\tif (endPos !== undefined) {\n\t\t\tconst slidingPreference = endReferenceSlidingPreference(\n\t\t\t\tstartPos,\n\t\t\t\tstartSide ?? Side.Before,\n\t\t\t\tendPos,\n\t\t\t\tendSide ?? Side.Before,\n\t\t\t);\n\t\t\tendRef = createPositionReference({\n\t\t\t\tclient: this.client,\n\t\t\t\tpos: endPos,\n\t\t\t\trefType: getRefType(this.end.refType),\n\t\t\t\top,\n\t\t\t\tlocalSeq,\n\t\t\t\tslidingPreference,\n\t\t\t\tcanSlideToEndpoint:\n\t\t\t\t\tcanSlideToEndpoint && slidingPreference === SlidingPreference.FORWARD,\n\t\t\t});\n\t\t\tif (this.end.properties) {\n\t\t\t\tendRef.addProperties(this.end.properties);\n\t\t\t}\n\t\t}\n\n\t\tconst newInterval = new SequenceIntervalClass(\n\t\t\tthis.client,\n\t\t\tthis.getIntervalId(),\n\t\t\tthis.label,\n\t\t\tstartRef,\n\t\t\tendRef,\n\t\t\tthis.intervalType,\n\t\t\tundefined,\n\t\t\tstartSide ?? this.startSide,\n\t\t\tendSide ?? this.endSide,\n\t\t);\n\t\tnewInterval.#props.propertyManager = this.#props.propertyManager ??=\n\t\t\tnew PropertiesManager();\n\t\tnewInterval.#props.properties = this.#props.properties;\n\t\treturn newInterval;\n\t}\n\n\tpublic ackPropertiesChange(newProps: PropertySet, op: ISequencedDocumentMessage) {\n\t\tthis.verifyNotDispose();\n\n\t\tif (Object.keys(newProps).length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(\n\t\t\tthis.#props.propertyManager !== undefined,\n\t\t\t0xbd5 /* must have property manager to ack */,\n\t\t);\n\t\t// Let the propertyManager prune its pending change-properties set.\n\t\tthis.#props.propertyManager.ack(op.sequenceNumber, op.minimumSequenceNumber, {\n\t\t\tprops: newProps,\n\t\t});\n\t}\n}\n\nexport function createPositionReferenceFromSegoff({\n\tclient,\n\tsegoff,\n\trefType,\n\top,\n\tlocalSeq,\n\tfromSnapshot,\n\tslidingPreference,\n\tcanSlideToEndpoint,\n\trollback,\n}: {\n\tclient: Client;\n\tsegoff: { segment: ISegment; offset: number } | undefined | \"start\" | \"end\";\n\trefType: ReferenceType;\n\top?: ISequencedDocumentMessage;\n\tlocalSeq?: number;\n\tfromSnapshot?: boolean;\n\tslidingPreference: SlidingPreference | undefined;\n\tcanSlideToEndpoint: boolean | undefined;\n\trollback?: boolean;\n}): LocalReferencePosition {\n\tif (segoff === \"start\" || segoff === \"end\") {\n\t\treturn client.createLocalReferencePosition(\n\t\t\tsegoff,\n\t\t\tundefined,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\n\tif (segoff?.segment) {\n\t\tconst ref = client.createLocalReferencePosition(\n\t\t\tsegoff.segment,\n\t\t\tsegoff.offset,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t\treturn ref;\n\t}\n\n\t// Creating references on detached segments is allowed for:\n\t// - Transient segments\n\t// - References coming from a remote client (location may have been concurrently removed)\n\t// - References being rebased to a new sequence number\n\t// (segment they originally referred to may have been removed with no suitable replacement)\n\tif (\n\t\t!op &&\n\t\t!localSeq &&\n\t\t!fromSnapshot &&\n\t\t!refTypeIncludesFlag(refType, ReferenceType.Transient) &&\n\t\t!rollback\n\t) {\n\t\tthrow new UsageError(\"Non-transient references need segment\");\n\t}\n\n\treturn createDetachedLocalReferencePosition(slidingPreference, refType);\n}\n\n/**\n * Resolves a position to a {@link LocalReferencePosition} using an\n * {@link ISharedSegmentSequence} (no Client or op context needed).\n */\nexport function resolvePositionRef(\n\tsequence: ISharedSegmentSequence<any>,\n\tpos: number | \"start\" | \"end\",\n\trefType: ReferenceType,\n\tslidingPreference: SlidingPreference,\n\tcanSlideToEndpoint?: boolean,\n): LocalReferencePosition {\n\tif (pos === \"start\" || pos === \"end\") {\n\t\treturn sequence.createLocalReferencePosition(\n\t\t\tpos,\n\t\t\tundefined,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\tconst segoff = sequence.getContainingSegment(pos);\n\tif (segoff?.segment !== undefined && segoff?.offset !== undefined) {\n\t\treturn sequence.createLocalReferencePosition(\n\t\t\tsegoff.segment,\n\t\t\tsegoff.offset,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\treturn createDetachedLocalReferencePosition(slidingPreference, refType);\n}\n\nfunction createPositionReference({\n\tclient,\n\tpos,\n\trefType,\n\top,\n\tfromSnapshot,\n\tlocalSeq,\n\tslidingPreference,\n\tcanSlideToEndpoint,\n\trollback,\n}: {\n\tclient: Client;\n\tpos: number | \"start\" | \"end\";\n\trefType: ReferenceType;\n\top?: ISequencedDocumentMessage;\n\tfromSnapshot?: boolean;\n\tlocalSeq?: number;\n\tslidingPreference: SlidingPreference;\n\tcanSlideToEndpoint: boolean;\n\trollback?: boolean;\n}): LocalReferencePosition {\n\tlet segoff;\n\n\tif (op) {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) !== 0,\n\t\t\t0x2f5 /* op create references must be SlideOnRemove */,\n\t\t);\n\t\tif (pos === \"start\" || pos === \"end\") {\n\t\t\tsegoff = pos;\n\t\t} else {\n\t\t\tsegoff = client.getContainingSegment(pos, {\n\t\t\t\treferenceSequenceNumber: op.referenceSequenceNumber,\n\t\t\t\tclientId: op.clientId,\n\t\t\t});\n\t\t\tsegoff = getSlideToSegoff(segoff, slidingPreference, undefined, canSlideToEndpoint);\n\t\t}\n\t} else {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) === 0 || !!fromSnapshot,\n\t\t\t0x2f6 /* SlideOnRemove references must be op created */,\n\t\t);\n\t\tsegoff =\n\t\t\tpos === \"start\" || pos === \"end\"\n\t\t\t\t? pos\n\t\t\t\t: client.getContainingSegment(pos, undefined, localSeq);\n\t}\n\n\treturn createPositionReferenceFromSegoff({\n\t\tclient,\n\t\tsegoff,\n\t\trefType,\n\t\top,\n\t\tlocalSeq,\n\t\tfromSnapshot,\n\t\tslidingPreference,\n\t\tcanSlideToEndpoint,\n\t\trollback,\n\t});\n}\n\n/**\n * Creates a transient interval using an `ISharedSegmentSequence` instead of a `Client`.\n * This avoids coupling index classes to merge-tree internals.\n */\nexport function createTransientIntervalFromSequence(\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tsequence: ISharedSegmentSequence<any>,\n): BaseSequenceInterval {\n\tconst { startPos, startSide, endPos, endSide } = endpointPosAndSide(\n\t\tstart ?? \"start\",\n\t\tend ?? \"end\",\n\t);\n\tassert(\n\t\tstartPos !== undefined &&\n\t\t\tendPos !== undefined &&\n\t\t\tstartSide !== undefined &&\n\t\t\tendSide !== undefined,\n\t\t0xcda /* start and end cannot be undefined because they were not passed in as undefined */,\n\t);\n\n\tconst startSlidingPref = startReferenceSlidingPreference(\n\t\tstartPos,\n\t\tstartSide,\n\t\tendPos,\n\t\tendSide,\n\t);\n\tconst endSlidingPref = endReferenceSlidingPreference(startPos, startSide, endPos, endSide);\n\n\tconst startLref = resolvePositionRef(\n\t\tsequence,\n\t\tstartPos,\n\t\tReferenceType.Transient,\n\t\tstartSlidingPref,\n\t);\n\tconst endLref = resolvePositionRef(\n\t\tsequence,\n\t\tendPos,\n\t\tReferenceType.Transient,\n\t\tendSlidingPref,\n\t);\n\n\tconst rangeProp = {\n\t\t[reservedRangeLabelsKey]: [\"transient\"],\n\t};\n\tstartLref.addProperties(rangeProp);\n\tendLref.addProperties(rangeProp);\n\n\treturn new BaseSequenceInterval(\n\t\tuuid(),\n\t\tstartLref,\n\t\tendLref,\n\t\tIntervalType.Transient,\n\t\tstartSide,\n\t\tendSide,\n\t);\n}\n\nexport function createSequenceInterval(\n\tlabel: string,\n\tid: string,\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tclient: Client,\n\tintervalType: IntervalType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tcanSlideToEndpoint: boolean = false,\n\tprops?: PropertySet,\n\trollback?: boolean,\n): SequenceIntervalClass {\n\tconst { startPos, startSide, endPos, endSide } = endpointPosAndSide(\n\t\tstart ?? \"start\",\n\t\tend ?? \"end\",\n\t);\n\tassert(\n\t\tstartPos !== undefined &&\n\t\t\tendPos !== undefined &&\n\t\t\tstartSide !== undefined &&\n\t\t\tendSide !== undefined,\n\t\t0x794 /* start and end cannot be undefined because they were not passed in as undefined */,\n\t);\n\tlet beginRefType = ReferenceType.RangeBegin;\n\tlet endRefType = ReferenceType.RangeEnd;\n\tif (intervalType === IntervalType.Transient) {\n\t\tbeginRefType = ReferenceType.Transient;\n\t\tendRefType = ReferenceType.Transient;\n\t} else {\n\t\t// All non-transient interval references must eventually be SlideOnRemove\n\t\t// To ensure eventual consistency, they must start as StayOnRemove when\n\t\t// pending (created locally and creation op is not acked)\n\t\tif (op ?? fromSnapshot) {\n\t\t\tbeginRefType |= ReferenceType.SlideOnRemove;\n\t\t\tendRefType |= ReferenceType.SlideOnRemove;\n\t\t} else {\n\t\t\tbeginRefType |= ReferenceType.StayOnRemove;\n\t\t\tendRefType |= ReferenceType.StayOnRemove;\n\t\t}\n\t}\n\n\tconst stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\n\tconst startSlidingPreference = startReferenceSlidingPreference(\n\t\tstartPos,\n\t\tstartSide,\n\t\tendPos,\n\t\tendSide,\n\t);\n\n\tconst endSlidingPreference = endReferenceSlidingPreference(\n\t\tstartPos,\n\t\tstartSide,\n\t\tendPos,\n\t\tendSide,\n\t);\n\n\tconst startLref = createPositionReference({\n\t\tclient,\n\t\tpos: startPos,\n\t\trefType: beginRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tslidingPreference: startSlidingPreference,\n\t\tcanSlideToEndpoint: canSlideToEndpoint && stickiness !== IntervalStickiness.NONE,\n\t\trollback,\n\t});\n\n\tconst endLref = createPositionReference({\n\t\tclient,\n\t\tpos: endPos,\n\t\trefType: endRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tslidingPreference: endSlidingPreference,\n\t\tcanSlideToEndpoint: canSlideToEndpoint && stickiness !== IntervalStickiness.NONE,\n\t\trollback,\n\t});\n\n\tconst rangeProp = {\n\t\t[reservedRangeLabelsKey]: [label],\n\t};\n\tstartLref.addProperties(rangeProp);\n\tendLref.addProperties(rangeProp);\n\n\tconst ival = new SequenceIntervalClass(\n\t\tclient,\n\t\tid,\n\t\tlabel,\n\t\tstartLref,\n\t\tendLref,\n\t\tintervalType,\n\t\tprops === undefined\n\t\t\t? undefined\n\t\t\t: { ...props, [reservedIntervalIdKey]: undefined, [reservedRangeLabelsKey]: undefined },\n\t\tstartSide,\n\t\tendSide,\n\t);\n\treturn ival;\n}\n"]}
|
package/lib/legacy.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate entrypoints" in @fluid-tools/build-cli.
|
|
8
|
+
* Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**
|
package/lib/packageVersion.d.ts
CHANGED
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAClD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAClD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.92.0\";\n"]}
|
package/lib/public.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate entrypoints" in @fluid-tools/build-cli.
|
|
8
|
+
* Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**
|
package/lib/revertibles.d.ts
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { LocalReferencePosition, MergeTreeDeltaRevertible, PropertySet } from "@fluidframework/merge-tree/internal";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import type { LocalReferencePosition, MergeTreeDeltaRevertible, PropertySet } from "@fluidframework/merge-tree/internal";
|
|
6
|
+
import type { SequenceInterval } from "./intervals/index.js";
|
|
7
|
+
import { IntervalOpType } from "./intervals/index.js";
|
|
8
|
+
import type { SequenceDeltaEvent } from "./sequenceDeltaEvent.js";
|
|
9
|
+
import type { ISharedString } from "./sharedString.js";
|
|
9
10
|
/**
|
|
10
11
|
* Data for undoing edits on SharedStrings and Intervals.
|
|
11
12
|
* @legacy @beta
|
package/lib/revertibles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revertibles.d.ts","sourceRoot":"","sources":["../src/revertibles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,
|
|
1
|
+
{"version":3,"file":"revertibles.d.ts","sourceRoot":"","sources":["../src/revertibles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EACX,sBAAsB,EAEtB,wBAAwB,EACxB,WAAW,EAEX,MAAM,qCAAqC,CAAC;AAkB7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,s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,CAAC;AAeL;;;GAGG;AACH,wBAAgB,8BAA8B,CAC7C,QAAQ,EAAE,gBAAgB,EAC1B,WAAW,EAAE,sBAAsB,EAAE,4BAQrC;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,CAChD,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,gBAAgB,EAC1B,WAAW,EAAE,sBAAsB,EAAE,GACnC,sBAAsB,EAAE,CAwC1B;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,CAChD,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,gBAAgB,EAC7B,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,sBAAsB,EAAE,4BAsCrC;AAED;;;GAGG;AACH,wBAAgB,0CAA0C,CACzD,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,WAAW,EACnB,WAAW,EAAE,sBAAsB,EAAE,4BASrC;AA2CD;;;;GAIG;AACH,wBAAgB,oCAAoC,CACnD,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,kBAAkB,EACzB,WAAW,EAAE,sBAAsB,EAAE,QAwFrC;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC7C,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,sBAAsB,EAAE,QAUrC;AAwRD;;;GAGG;AACH,wBAAgB,6BAA6B,CAC5C,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,sBAAsB,EAAE,QAoCrC"}
|
package/lib/revertibles.js
CHANGED
|
@@ -162,7 +162,7 @@ export function appendSharedStringDeltaToRevertibles(string, delta, revertibles)
|
|
|
162
162
|
mergeTreeRevertible: removeRevertibles[0],
|
|
163
163
|
};
|
|
164
164
|
// add an interval for each startInterval, accounting for any corresponding endIntervals
|
|
165
|
-
|
|
165
|
+
for (const { interval, offset } of startIntervals) {
|
|
166
166
|
// find any corresponding end for this interval
|
|
167
167
|
const endIntervalIndex = endIntervals.findIndex((end) => {
|
|
168
168
|
return end.interval === interval;
|
|
@@ -178,15 +178,15 @@ export function appendSharedStringDeltaToRevertibles(string, delta, revertibles)
|
|
|
178
178
|
startOffset: offset,
|
|
179
179
|
endOffset,
|
|
180
180
|
});
|
|
181
|
-
}
|
|
181
|
+
}
|
|
182
182
|
// add any remaining endIntervals that aren't matched with a startInterval
|
|
183
|
-
|
|
183
|
+
for (const { interval, offset } of endIntervals) {
|
|
184
184
|
revertible.intervals.push({
|
|
185
185
|
intervalId: interval.getIntervalId(),
|
|
186
186
|
label: interval.start.properties?.referenceRangeLabels[0],
|
|
187
187
|
endOffset: offset,
|
|
188
188
|
});
|
|
189
|
-
}
|
|
189
|
+
}
|
|
190
190
|
revertibles.push(revertible);
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
@@ -206,7 +206,7 @@ export function appendSharedStringDeltaToRevertibles(string, delta, revertibles)
|
|
|
206
206
|
* @legacy @beta
|
|
207
207
|
*/
|
|
208
208
|
export function discardSharedStringRevertibles(sharedString, revertibles) {
|
|
209
|
-
|
|
209
|
+
for (const r of revertibles) {
|
|
210
210
|
if (isMergeTreeDeltaRevertible(r)) {
|
|
211
211
|
discardMergeTreeDeltaRevertible([r]);
|
|
212
212
|
}
|
|
@@ -214,7 +214,7 @@ export function discardSharedStringRevertibles(sharedString, revertibles) {
|
|
|
214
214
|
sharedString.removeLocalReferencePosition(r.start);
|
|
215
215
|
sharedString.removeLocalReferencePosition(r.end);
|
|
216
216
|
}
|
|
217
|
-
}
|
|
217
|
+
}
|
|
218
218
|
}
|
|
219
219
|
function getSlidePosition(string, lref, pos) {
|
|
220
220
|
const segment = lref.getSegment();
|
|
@@ -273,11 +273,11 @@ function revertLocalDelete(string, revertible) {
|
|
|
273
273
|
end: createSequencePlace(endSlidePos, revertible.end.slidingPreference),
|
|
274
274
|
props,
|
|
275
275
|
});
|
|
276
|
-
idMap.
|
|
276
|
+
for (const [oldId, newId] of idMap.entries()) {
|
|
277
277
|
if (intervalId === newId) {
|
|
278
278
|
idMap.set(oldId, getUpdatedIdFromInterval(int));
|
|
279
279
|
}
|
|
280
|
-
}
|
|
280
|
+
}
|
|
281
281
|
idMap.set(intervalId, int.getIntervalId());
|
|
282
282
|
}
|
|
283
283
|
string.removeLocalReferencePosition(revertible.start);
|
|
@@ -338,9 +338,9 @@ function revertLocalSequenceRemove(sharedString, revertible) {
|
|
|
338
338
|
const saveSegments = (event) => {
|
|
339
339
|
if (event.ranges.length > 0) {
|
|
340
340
|
let length = 0;
|
|
341
|
-
event.ranges
|
|
341
|
+
for (const range of event.ranges) {
|
|
342
342
|
length += range.segment.cachedLength;
|
|
343
|
-
}
|
|
343
|
+
}
|
|
344
344
|
restoredRanges.addOrUpdate({
|
|
345
345
|
ranges: event.ranges,
|
|
346
346
|
length,
|
|
@@ -351,7 +351,7 @@ function revertLocalSequenceRemove(sharedString, revertible) {
|
|
|
351
351
|
sharedString.on("sequenceDelta", saveSegments);
|
|
352
352
|
revertMergeTreeDeltaRevertibles(sharedString, [revertible.mergeTreeRevertible]);
|
|
353
353
|
sharedString.off("sequenceDelta", saveSegments);
|
|
354
|
-
revertible.intervals
|
|
354
|
+
for (const intervalInfo of revertible.intervals) {
|
|
355
355
|
const intervalCollection = sharedString.getIntervalCollection(intervalInfo.label);
|
|
356
356
|
const intervalId = getUpdatedId(intervalInfo.intervalId);
|
|
357
357
|
const interval = intervalCollection.getIntervalById(intervalId);
|
|
@@ -367,9 +367,9 @@ function revertLocalSequenceRemove(sharedString, revertible) {
|
|
|
367
367
|
});
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
}
|
|
370
|
+
}
|
|
371
371
|
// fix up the local references used by delete and change revertibles
|
|
372
|
-
revertible.revertibleRefs
|
|
372
|
+
for (const revertibleRef of revertible.revertibleRefs) {
|
|
373
373
|
assert(revertibleRef.revertible.event === IntervalOpType.CHANGE ||
|
|
374
374
|
revertibleRef.revertible.event === IntervalOpType.DELETE, 0x6c5 /* revertible is not delete or change */);
|
|
375
375
|
const pos = newPosition(revertibleRef.offset, restoredRanges);
|
|
@@ -385,7 +385,7 @@ function revertLocalSequenceRemove(sharedString, revertible) {
|
|
|
385
385
|
revertibleRef.revertible.end = newRef;
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
-
}
|
|
388
|
+
}
|
|
389
389
|
}
|
|
390
390
|
/**
|
|
391
391
|
* Invoke revertibles to reverse prior edits
|
|
@@ -398,23 +398,29 @@ export function revertSharedStringRevertibles(sharedString, revertibles) {
|
|
|
398
398
|
if ("event" in r) {
|
|
399
399
|
const event = r.event;
|
|
400
400
|
switch (event) {
|
|
401
|
-
case IntervalOpType.ADD:
|
|
401
|
+
case IntervalOpType.ADD: {
|
|
402
402
|
revertLocalAdd(sharedString, r);
|
|
403
403
|
break;
|
|
404
|
-
|
|
404
|
+
}
|
|
405
|
+
case IntervalOpType.DELETE: {
|
|
405
406
|
revertLocalDelete(sharedString, r);
|
|
406
407
|
break;
|
|
407
|
-
|
|
408
|
+
}
|
|
409
|
+
case IntervalOpType.CHANGE: {
|
|
408
410
|
revertLocalChange(sharedString, r);
|
|
409
411
|
break;
|
|
410
|
-
|
|
412
|
+
}
|
|
413
|
+
case IntervalOpType.PROPERTY_CHANGED: {
|
|
411
414
|
revertLocalPropertyChanged(sharedString, r);
|
|
412
415
|
break;
|
|
413
|
-
|
|
416
|
+
}
|
|
417
|
+
case IntervalOpType.POSITION_REMOVE: {
|
|
414
418
|
revertLocalSequenceRemove(sharedString, r);
|
|
415
419
|
break;
|
|
416
|
-
|
|
420
|
+
}
|
|
421
|
+
default: {
|
|
417
422
|
unreachableCase(event);
|
|
423
|
+
}
|
|
418
424
|
}
|
|
419
425
|
}
|
|
420
426
|
else {
|