@univerjs/drawing 0.3.0-alpha.1 → 0.3.0-nightly.202410101606
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/cjs/index.js +1 -1
- package/lib/es/index.js +1 -2043
- package/lib/types/services/drawing-manager-impl.service.d.ts +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +5 -6
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,2043 +1 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { Subject } from "rxjs";
|
|
6
|
-
import { sortRules, sortRulesByDesc, createIdentifier, Tools, Inject, Injector, Plugin, mergeOverrideWithDependencies, IConfigService } from "@univerjs/core";
|
|
7
|
-
const DRAWING_IMAGE_WIDTH_LIMIT = 500, DRAWING_IMAGE_HEIGHT_LIMIT = 500, DRAWING_IMAGE_COUNT_LIMIT = 10, DRAWING_IMAGE_ALLOW_SIZE = 5 * 1024 * 1024, DRAWING_IMAGE_ALLOW_IMAGE_LIST = ["image/png", "image/jpeg", "image/jpg", "image/gif", "image/bmp"];
|
|
8
|
-
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, dist$1 = {}, json1_release = {}, deepEqual$1 = {};
|
|
9
|
-
Object.defineProperty(deepEqual$1, "__esModule", { value: !0 });
|
|
10
|
-
function eqObj(a, b) {
|
|
11
|
-
if (Array.isArray(b))
|
|
12
|
-
return !1;
|
|
13
|
-
for (let k in a)
|
|
14
|
-
if (!deepEqual(a[k], b[k]))
|
|
15
|
-
return !1;
|
|
16
|
-
for (let k in b)
|
|
17
|
-
if (a[k] === void 0)
|
|
18
|
-
return !1;
|
|
19
|
-
return !0;
|
|
20
|
-
}
|
|
21
|
-
__name(eqObj, "eqObj");
|
|
22
|
-
function eqArr(a, b) {
|
|
23
|
-
if (!Array.isArray(b) || a.length !== b.length)
|
|
24
|
-
return !1;
|
|
25
|
-
for (let i = 0; i < a.length; i++)
|
|
26
|
-
if (!deepEqual(a[i], b[i]))
|
|
27
|
-
return !1;
|
|
28
|
-
return !0;
|
|
29
|
-
}
|
|
30
|
-
__name(eqArr, "eqArr");
|
|
31
|
-
function deepEqual(a, b) {
|
|
32
|
-
return a === b ? !0 : a === null || b === null || typeof a != "object" || typeof b != "object" ? !1 : Array.isArray(a) ? eqArr(a, b) : eqObj(a, b);
|
|
33
|
-
}
|
|
34
|
-
__name(deepEqual, "deepEqual");
|
|
35
|
-
deepEqual$1.default = deepEqual;
|
|
36
|
-
var deepClone$1 = {};
|
|
37
|
-
Object.defineProperty(deepClone$1, "__esModule", { value: !0 });
|
|
38
|
-
function deepClone(old) {
|
|
39
|
-
if (old === null)
|
|
40
|
-
return null;
|
|
41
|
-
if (Array.isArray(old))
|
|
42
|
-
return old.map(deepClone);
|
|
43
|
-
if (typeof old == "object") {
|
|
44
|
-
const o = {};
|
|
45
|
-
for (let k in old)
|
|
46
|
-
o[k] = deepClone(old[k]);
|
|
47
|
-
return o;
|
|
48
|
-
} else
|
|
49
|
-
return old;
|
|
50
|
-
}
|
|
51
|
-
__name(deepClone, "deepClone");
|
|
52
|
-
deepClone$1.default = deepClone;
|
|
53
|
-
var cursor = {};
|
|
54
|
-
(function(exports) {
|
|
55
|
-
Object.defineProperty(exports, "__esModule", { value: !0 }), exports.eachChildOf = exports.advancer = exports.readCursor = exports.writeCursor = exports.WriteCursor = exports.ReadCursor = exports.isValidPathItem = void 0;
|
|
56
|
-
function assert(pred, msg) {
|
|
57
|
-
if (!pred)
|
|
58
|
-
throw new Error(msg);
|
|
59
|
-
}
|
|
60
|
-
__name(assert, "assert");
|
|
61
|
-
const isObject = /* @__PURE__ */ __name((o) => o != null && typeof o == "object" && !Array.isArray(o), "isObject"), isGreaterKey = /* @__PURE__ */ __name((a, b) => (
|
|
62
|
-
// All the numbers, then all the letters. Just as the gods of ascii intended.
|
|
63
|
-
typeof a == typeof b ? a > b : typeof a == "string" && typeof b == "number"
|
|
64
|
-
), "isGreaterKey");
|
|
65
|
-
function copyAll(c, w) {
|
|
66
|
-
for (let _k in c) {
|
|
67
|
-
const k = _k;
|
|
68
|
-
w.write(k, c[k]);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
__name(copyAll, "copyAll"), exports.isValidPathItem = (k) => typeof k == "number" || typeof k == "string" && k !== "__proto__";
|
|
72
|
-
const _Cursor = class _Cursor {
|
|
73
|
-
constructor(op = null) {
|
|
74
|
-
this.parents = [], this.indexes = [], this.lcIdx = -1, this.idx = -1, this.container = op;
|
|
75
|
-
}
|
|
76
|
-
ascend() {
|
|
77
|
-
assert(this.parents.length === this.indexes.length / 2), this.idx === 0 ? this.parents.length ? (this.lcIdx = this.indexes.pop(), this.container = this.parents.pop(), this.idx = this.indexes.pop()) : (this.lcIdx = 0, this.idx = -1) : (assert(this.idx > 0), this.idx--, isObject(this.container[this.idx]) && this.idx--);
|
|
78
|
-
}
|
|
79
|
-
getPath() {
|
|
80
|
-
const path = [];
|
|
81
|
-
let c = this.container, p = this.parents.length - 1, i = this.idx;
|
|
82
|
-
for (; i >= 0; )
|
|
83
|
-
path.unshift(c[i]), i === 0 ? (i = this.indexes[p * 2], c = this.parents[p--]) : i -= isObject(c[i - 1]) ? 2 : 1;
|
|
84
|
-
return path;
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
__name(_Cursor, "Cursor");
|
|
88
|
-
let Cursor = _Cursor;
|
|
89
|
-
const _ReadCursor = class _ReadCursor extends Cursor {
|
|
90
|
-
get() {
|
|
91
|
-
return this.container ? this.container.slice(this.idx + 1) : null;
|
|
92
|
-
}
|
|
93
|
-
// Its only valid to call this after descending into a child.
|
|
94
|
-
getKey() {
|
|
95
|
-
return assert(this.container != null, "Invalid call to getKey before cursor descended"), this.container[this.idx];
|
|
96
|
-
}
|
|
97
|
-
getComponent() {
|
|
98
|
-
let c;
|
|
99
|
-
return this.container && this.container.length > this.idx + 1 && isObject(c = this.container[this.idx + 1]) ? c : null;
|
|
100
|
-
}
|
|
101
|
-
descendFirst() {
|
|
102
|
-
let i = this.idx + 1;
|
|
103
|
-
if (!this.container || i >= this.container.length || isObject(this.container[i]) && i + 1 >= this.container.length)
|
|
104
|
-
return !1;
|
|
105
|
-
isObject(this.container[i]) && i++;
|
|
106
|
-
const firstChild = this.container[i];
|
|
107
|
-
return Array.isArray(firstChild) ? (this.indexes.push(this.idx), this.parents.push(this.container), this.indexes.push(i), this.idx = 0, this.container = firstChild) : this.idx = i, !0;
|
|
108
|
-
}
|
|
109
|
-
nextSibling() {
|
|
110
|
-
if (assert(this.parents.length === this.indexes.length / 2), this.idx > 0 || this.parents.length === 0)
|
|
111
|
-
return !1;
|
|
112
|
-
const i = this.indexes[this.indexes.length - 1] + 1, c = this.parents[this.parents.length - 1];
|
|
113
|
-
return i >= c.length ? !1 : (assert(!isNaN(i)), this.indexes[this.indexes.length - 1] = i, this.container = c[i], !0);
|
|
114
|
-
}
|
|
115
|
-
_init(_container, _idx, _parents, _indexes) {
|
|
116
|
-
this.container = _container, this.idx = _idx, this.parents = _parents.slice(), this.indexes = _indexes.slice();
|
|
117
|
-
}
|
|
118
|
-
clone() {
|
|
119
|
-
const c = new _ReadCursor();
|
|
120
|
-
return c._init(this.container, this.idx, this.parents, this.indexes), c;
|
|
121
|
-
}
|
|
122
|
-
*[Symbol.iterator]() {
|
|
123
|
-
if (this.descendFirst()) {
|
|
124
|
-
do
|
|
125
|
-
yield this.getKey();
|
|
126
|
-
while (this.nextSibling());
|
|
127
|
-
this.ascend();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
// TODO(cleanup): Consider moving these functions out of cursor, since
|
|
131
|
-
// they're really just helper methods.
|
|
132
|
-
// It'd be really nice to do this using generators.
|
|
133
|
-
traverse(w, fn) {
|
|
134
|
-
const c = this.getComponent();
|
|
135
|
-
c && fn(c, w);
|
|
136
|
-
for (const key of this)
|
|
137
|
-
w && w.descend(key), this.traverse(w, fn), w && w.ascend();
|
|
138
|
-
}
|
|
139
|
-
eachPick(w, fn) {
|
|
140
|
-
this.traverse(w, (c, w2) => {
|
|
141
|
-
c.p != null && fn(c.p, w2);
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
eachDrop(w, fn) {
|
|
145
|
-
this.traverse(w, (c, w2) => {
|
|
146
|
-
c.d != null && fn(c.d, w2);
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
__name(_ReadCursor, "ReadCursor");
|
|
151
|
-
let ReadCursor = _ReadCursor;
|
|
152
|
-
exports.ReadCursor = ReadCursor;
|
|
153
|
-
const _WriteCursor = class _WriteCursor extends Cursor {
|
|
154
|
-
constructor(op = null) {
|
|
155
|
-
super(op), this.pendingDescent = [], this._op = op;
|
|
156
|
-
}
|
|
157
|
-
flushDescent() {
|
|
158
|
-
assert(this.parents.length === this.indexes.length / 2), this.container === null && (this._op = this.container = []);
|
|
159
|
-
for (let j = 0; j < this.pendingDescent.length; j++) {
|
|
160
|
-
const k = this.pendingDescent[j];
|
|
161
|
-
let i = this.idx + 1;
|
|
162
|
-
if (i < this.container.length && isObject(this.container[i]) && i++, assert(i === this.container.length || !isObject(this.container[i])), i === this.container.length)
|
|
163
|
-
this.container.push(k), this.idx = i;
|
|
164
|
-
else if (this.container[i] === k)
|
|
165
|
-
this.idx = i;
|
|
166
|
-
else {
|
|
167
|
-
if (!Array.isArray(this.container[i])) {
|
|
168
|
-
const oldChild = this.container.splice(i, this.container.length - i);
|
|
169
|
-
this.container.push(oldChild), this.lcIdx > -1 && (this.lcIdx = i);
|
|
170
|
-
}
|
|
171
|
-
for (this.indexes.push(this.idx), this.parents.push(this.container), this.lcIdx !== -1 && (assert(isGreaterKey(k, this.container[this.lcIdx][0])), i = this.lcIdx + 1, this.lcIdx = -1); i < this.container.length && isGreaterKey(k, this.container[i][0]); )
|
|
172
|
-
i++;
|
|
173
|
-
if (this.indexes.push(i), this.idx = 0, i < this.container.length && this.container[i][0] === k)
|
|
174
|
-
this.container = this.container[i];
|
|
175
|
-
else {
|
|
176
|
-
const child = [k];
|
|
177
|
-
this.container.splice(i, 0, child), this.container = child;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
this.pendingDescent.length = 0;
|
|
182
|
-
}
|
|
183
|
-
reset() {
|
|
184
|
-
this.lcIdx = -1;
|
|
185
|
-
}
|
|
186
|
-
// Creates and returns a component, creating one if need be. You should
|
|
187
|
-
// probably write to it immediately - ops are not valid with empty
|
|
188
|
-
// components.
|
|
189
|
-
getComponent() {
|
|
190
|
-
this.flushDescent();
|
|
191
|
-
const i = this.idx + 1;
|
|
192
|
-
if (i < this.container.length && isObject(this.container[i]))
|
|
193
|
-
return this.container[i];
|
|
194
|
-
{
|
|
195
|
-
const component = {};
|
|
196
|
-
return this.container.splice(i, 0, component), component;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
write(key, value) {
|
|
200
|
-
const component = this.getComponent();
|
|
201
|
-
assert(component[key] == null || component[key] === value, "Internal consistency error: Overwritten component. File a bug"), component[key] = value;
|
|
202
|
-
}
|
|
203
|
-
get() {
|
|
204
|
-
return this._op;
|
|
205
|
-
}
|
|
206
|
-
descend(key) {
|
|
207
|
-
if (!exports.isValidPathItem(key))
|
|
208
|
-
throw Error("Invalid JSON key");
|
|
209
|
-
this.pendingDescent.push(key);
|
|
210
|
-
}
|
|
211
|
-
descendPath(path) {
|
|
212
|
-
return this.pendingDescent.push(...path), this;
|
|
213
|
-
}
|
|
214
|
-
ascend() {
|
|
215
|
-
this.pendingDescent.length ? this.pendingDescent.pop() : super.ascend();
|
|
216
|
-
}
|
|
217
|
-
mergeTree(data, mergeFn = copyAll) {
|
|
218
|
-
if (data === null)
|
|
219
|
-
return;
|
|
220
|
-
if (assert(Array.isArray(data)), data === this._op)
|
|
221
|
-
throw Error("Cannot merge into my own tree");
|
|
222
|
-
const _lcIdx = this.lcIdx, oldDepth = this.parents.length;
|
|
223
|
-
let depth = 0;
|
|
224
|
-
for (let i = 0; i < data.length; i++) {
|
|
225
|
-
const c = data[i];
|
|
226
|
-
typeof c == "string" || typeof c == "number" ? (depth++, this.descend(c)) : Array.isArray(c) ? this.mergeTree(c, mergeFn) : typeof c == "object" && mergeFn(c, this);
|
|
227
|
-
}
|
|
228
|
-
for (; depth--; )
|
|
229
|
-
this.ascend();
|
|
230
|
-
this.lcIdx = this.parents.length === oldDepth ? _lcIdx : -1;
|
|
231
|
-
}
|
|
232
|
-
at(path, fn) {
|
|
233
|
-
this.descendPath(path), fn(this);
|
|
234
|
-
for (let i = 0; i < path.length; i++)
|
|
235
|
-
this.ascend();
|
|
236
|
-
return this;
|
|
237
|
-
}
|
|
238
|
-
// This is used by helpers, so the strict ordering guarantees are
|
|
239
|
-
// relaxed.
|
|
240
|
-
writeAtPath(path, key, value) {
|
|
241
|
-
return this.at(path, () => this.write(key, value)), this.reset(), this;
|
|
242
|
-
}
|
|
243
|
-
writeMove(path1, path2, slot = 0) {
|
|
244
|
-
return this.writeAtPath(path1, "p", slot).writeAtPath(path2, "d", slot);
|
|
245
|
-
}
|
|
246
|
-
getPath() {
|
|
247
|
-
const path = super.getPath();
|
|
248
|
-
return path.push(...this.pendingDescent), path;
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
__name(_WriteCursor, "WriteCursor");
|
|
252
|
-
let WriteCursor = _WriteCursor;
|
|
253
|
-
exports.WriteCursor = WriteCursor, exports.writeCursor = () => new WriteCursor(), exports.readCursor = (op) => new ReadCursor(op);
|
|
254
|
-
function advancer(r, listMap, listAdv) {
|
|
255
|
-
let didDescend, valid;
|
|
256
|
-
valid = didDescend = r ? r.descendFirst() : !1;
|
|
257
|
-
function adv(ktarget) {
|
|
258
|
-
let k2_;
|
|
259
|
-
for (; valid; ) {
|
|
260
|
-
const k2 = k2_ = r.getKey();
|
|
261
|
-
if (ktarget != null) {
|
|
262
|
-
let skip = !1;
|
|
263
|
-
if (listMap && typeof k2 == "number" && (k2_ = listMap(k2, r.getComponent()), k2_ < 0 && (k2_ = ~k2_, skip = !0)), isGreaterKey(k2_, ktarget))
|
|
264
|
-
return null;
|
|
265
|
-
if (k2_ === ktarget && !skip)
|
|
266
|
-
return r;
|
|
267
|
-
}
|
|
268
|
-
listAdv && typeof k2_ == "number" && listAdv(k2_, r.getComponent()), valid = r.nextSibling();
|
|
269
|
-
}
|
|
270
|
-
return null;
|
|
271
|
-
}
|
|
272
|
-
return __name(adv, "adv"), adv.end = () => {
|
|
273
|
-
didDescend && r.ascend();
|
|
274
|
-
}, adv;
|
|
275
|
-
}
|
|
276
|
-
__name(advancer, "advancer"), exports.advancer = advancer;
|
|
277
|
-
function eachChildOf(r1, r2, fn) {
|
|
278
|
-
let hasChild1, descended1, hasChild2, descended2;
|
|
279
|
-
for (hasChild1 = descended1 = r1 && r1.descendFirst(), hasChild2 = descended2 = r2 && r2.descendFirst(); hasChild1 || hasChild2; ) {
|
|
280
|
-
let k1 = hasChild1 ? r1.getKey() : null, k2 = hasChild2 ? r2.getKey() : null;
|
|
281
|
-
k1 !== null && k2 !== null && (isGreaterKey(k2, k1) ? k2 = null : k1 !== k2 && (k1 = null)), fn(k1 == null ? k2 : k1, k1 != null ? r1 : null, k2 != null ? r2 : null), k1 != null && hasChild1 && (hasChild1 = r1.nextSibling()), k2 != null && hasChild2 && (hasChild2 = r2.nextSibling());
|
|
282
|
-
}
|
|
283
|
-
descended1 && r1.ascend(), descended2 && r2.ascend();
|
|
284
|
-
}
|
|
285
|
-
__name(eachChildOf, "eachChildOf"), exports.eachChildOf = eachChildOf;
|
|
286
|
-
})(cursor);
|
|
287
|
-
var types = {};
|
|
288
|
-
(function(exports) {
|
|
289
|
-
Object.defineProperty(exports, "__esModule", { value: !0 }), exports.ConflictType = void 0, function(ConflictType) {
|
|
290
|
-
ConflictType[ConflictType.RM_UNEXPECTED_CONTENT = 1] = "RM_UNEXPECTED_CONTENT", ConflictType[ConflictType.DROP_COLLISION = 2] = "DROP_COLLISION", ConflictType[ConflictType.BLACKHOLE = 3] = "BLACKHOLE";
|
|
291
|
-
}(exports.ConflictType || (exports.ConflictType = {}));
|
|
292
|
-
})(types);
|
|
293
|
-
var dist = {}, unicount = {}, hasRequiredUnicount;
|
|
294
|
-
function requireUnicount() {
|
|
295
|
-
return hasRequiredUnicount || (hasRequiredUnicount = 1, Object.defineProperty(unicount, "__esModule", { value: !0 }), unicount.uniToStrPos = unicount.strPosToUni = void 0, unicount.strPosToUni = (s, strOffset = s.length) => {
|
|
296
|
-
let pairs = 0, i = 0;
|
|
297
|
-
for (; i < strOffset; i++) {
|
|
298
|
-
const code = s.charCodeAt(i);
|
|
299
|
-
code >= 55296 && code <= 57343 && (pairs++, i++);
|
|
300
|
-
}
|
|
301
|
-
if (i !== strOffset)
|
|
302
|
-
throw Error("Invalid offset - splits unicode bytes");
|
|
303
|
-
return i - pairs;
|
|
304
|
-
}, unicount.uniToStrPos = (s, uniOffset) => {
|
|
305
|
-
let pos = 0;
|
|
306
|
-
for (; uniOffset > 0; uniOffset--) {
|
|
307
|
-
const code = s.charCodeAt(pos);
|
|
308
|
-
pos += code >= 55296 && code <= 57343 ? 2 : 1;
|
|
309
|
-
}
|
|
310
|
-
return pos;
|
|
311
|
-
}), unicount;
|
|
312
|
-
}
|
|
313
|
-
__name(requireUnicount, "requireUnicount");
|
|
314
|
-
var type = {}, hasRequiredType;
|
|
315
|
-
function requireType() {
|
|
316
|
-
return hasRequiredType || (hasRequiredType = 1, function(exports) {
|
|
317
|
-
Object.defineProperty(exports, "__esModule", { value: !0 }), exports.uniSlice = exports.dlen = exports.eachOp = void 0;
|
|
318
|
-
const unicount_1 = requireUnicount(), checkOp = /* @__PURE__ */ __name((op) => {
|
|
319
|
-
if (!Array.isArray(op))
|
|
320
|
-
throw Error("Op must be an array of components");
|
|
321
|
-
let last = null;
|
|
322
|
-
for (let i = 0; i < op.length; i++) {
|
|
323
|
-
const c = op[i];
|
|
324
|
-
switch (typeof c) {
|
|
325
|
-
case "object":
|
|
326
|
-
if (typeof c.d != "number" && typeof c.d != "string")
|
|
327
|
-
throw Error("Delete must be number or string");
|
|
328
|
-
if (exports.dlen(c.d) <= 0)
|
|
329
|
-
throw Error("Deletes must not be empty");
|
|
330
|
-
break;
|
|
331
|
-
case "string":
|
|
332
|
-
if (!(c.length > 0))
|
|
333
|
-
throw Error("Inserts cannot be empty");
|
|
334
|
-
break;
|
|
335
|
-
case "number":
|
|
336
|
-
if (!(c > 0))
|
|
337
|
-
throw Error("Skip components must be >0");
|
|
338
|
-
if (typeof last == "number")
|
|
339
|
-
throw Error("Adjacent skip components should be combined");
|
|
340
|
-
break;
|
|
341
|
-
}
|
|
342
|
-
last = c;
|
|
343
|
-
}
|
|
344
|
-
if (typeof last == "number")
|
|
345
|
-
throw Error("Op has a trailing skip");
|
|
346
|
-
}, "checkOp");
|
|
347
|
-
function eachOp(op, fn) {
|
|
348
|
-
let prePos = 0, postPos = 0;
|
|
349
|
-
for (let i = 0; i < op.length; i++) {
|
|
350
|
-
const c = op[i];
|
|
351
|
-
switch (fn(c, prePos, postPos), typeof c) {
|
|
352
|
-
case "object":
|
|
353
|
-
prePos += exports.dlen(c.d);
|
|
354
|
-
break;
|
|
355
|
-
case "string":
|
|
356
|
-
postPos += unicount_1.strPosToUni(c);
|
|
357
|
-
break;
|
|
358
|
-
case "number":
|
|
359
|
-
prePos += c, postPos += c;
|
|
360
|
-
break;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
__name(eachOp, "eachOp"), exports.eachOp = eachOp;
|
|
365
|
-
function mapOp(op, fn) {
|
|
366
|
-
const newOp = [], append = makeAppend(newOp);
|
|
367
|
-
return eachOp(op, (c, prePos, postPos) => {
|
|
368
|
-
append(fn(c, prePos, postPos));
|
|
369
|
-
}), trim(newOp);
|
|
370
|
-
}
|
|
371
|
-
__name(mapOp, "mapOp");
|
|
372
|
-
const id = /* @__PURE__ */ __name((x) => x, "id"), normalize = /* @__PURE__ */ __name((op) => mapOp(op, id), "normalize");
|
|
373
|
-
exports.dlen = (d) => typeof d == "number" ? d : unicount_1.strPosToUni(d);
|
|
374
|
-
const makeAppend = /* @__PURE__ */ __name((op) => (component) => {
|
|
375
|
-
if (!(!component || component.d === 0 || component.d === "")) if (op.length === 0)
|
|
376
|
-
op.push(component);
|
|
377
|
-
else if (typeof component == typeof op[op.length - 1])
|
|
378
|
-
if (typeof component == "object") {
|
|
379
|
-
const last = op[op.length - 1];
|
|
380
|
-
last.d = typeof last.d == "string" && typeof component.d == "string" ? last.d + component.d : exports.dlen(last.d) + exports.dlen(component.d);
|
|
381
|
-
} else
|
|
382
|
-
op[op.length - 1] += component;
|
|
383
|
-
else
|
|
384
|
-
op.push(component);
|
|
385
|
-
}, "makeAppend"), componentLength = /* @__PURE__ */ __name((c) => typeof c == "number" ? c : typeof c == "string" ? unicount_1.strPosToUni(c) : typeof c.d == "number" ? c.d : unicount_1.strPosToUni(c.d), "componentLength");
|
|
386
|
-
exports.uniSlice = (s, startUni, endUni) => {
|
|
387
|
-
const start = unicount_1.uniToStrPos(s, startUni), end = endUni == null ? 1 / 0 : unicount_1.uniToStrPos(s, endUni);
|
|
388
|
-
return s.slice(start, end);
|
|
389
|
-
};
|
|
390
|
-
const dslice = /* @__PURE__ */ __name((d, start, end) => typeof d == "number" ? end == null ? d - start : Math.min(d, end) - start : exports.uniSlice(d, start, end), "dslice"), makeTake = /* @__PURE__ */ __name((op) => {
|
|
391
|
-
let idx = 0, offset = 0;
|
|
392
|
-
return { take: /* @__PURE__ */ __name((n, indivisableField) => {
|
|
393
|
-
if (idx === op.length)
|
|
394
|
-
return n === -1 ? null : n;
|
|
395
|
-
const c = op[idx];
|
|
396
|
-
let part;
|
|
397
|
-
if (typeof c == "number")
|
|
398
|
-
return n === -1 || c - offset <= n ? (part = c - offset, ++idx, offset = 0, part) : (offset += n, n);
|
|
399
|
-
if (typeof c == "string") {
|
|
400
|
-
if (n === -1 || indivisableField === "i" || unicount_1.strPosToUni(c.slice(offset)) <= n)
|
|
401
|
-
return part = c.slice(offset), ++idx, offset = 0, part;
|
|
402
|
-
{
|
|
403
|
-
const offset2 = offset + unicount_1.uniToStrPos(c.slice(offset), n);
|
|
404
|
-
return part = c.slice(offset, offset2), offset = offset2, part;
|
|
405
|
-
}
|
|
406
|
-
} else {
|
|
407
|
-
if (n === -1 || indivisableField === "d" || exports.dlen(c.d) - offset <= n)
|
|
408
|
-
return part = { d: dslice(c.d, offset) }, ++idx, offset = 0, part;
|
|
409
|
-
{
|
|
410
|
-
let result = dslice(c.d, offset, offset + n);
|
|
411
|
-
return offset += n, { d: result };
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}, "take"), peek: /* @__PURE__ */ __name(() => op[idx], "peek") };
|
|
415
|
-
}, "makeTake"), trim = /* @__PURE__ */ __name((op) => (op.length > 0 && typeof op[op.length - 1] == "number" && op.pop(), op), "trim");
|
|
416
|
-
function transform(op1, op2, side) {
|
|
417
|
-
if (side !== "left" && side !== "right")
|
|
418
|
-
throw Error("side (" + side + ") must be 'left' or 'right'");
|
|
419
|
-
checkOp(op1), checkOp(op2);
|
|
420
|
-
const newOp = [], append = makeAppend(newOp), { take, peek } = makeTake(op1);
|
|
421
|
-
for (let i = 0; i < op2.length; i++) {
|
|
422
|
-
const c2 = op2[i];
|
|
423
|
-
let length, c1;
|
|
424
|
-
switch (typeof c2) {
|
|
425
|
-
case "number":
|
|
426
|
-
for (length = c2; length > 0; )
|
|
427
|
-
c1 = take(length, "i"), append(c1), typeof c1 != "string" && (length -= componentLength(c1));
|
|
428
|
-
break;
|
|
429
|
-
case "string":
|
|
430
|
-
side === "left" && typeof peek() == "string" && append(take(-1)), append(unicount_1.strPosToUni(c2));
|
|
431
|
-
break;
|
|
432
|
-
case "object":
|
|
433
|
-
for (length = exports.dlen(c2.d); length > 0; )
|
|
434
|
-
switch (c1 = take(length, "i"), typeof c1) {
|
|
435
|
-
case "number":
|
|
436
|
-
length -= c1;
|
|
437
|
-
break;
|
|
438
|
-
case "string":
|
|
439
|
-
append(c1);
|
|
440
|
-
break;
|
|
441
|
-
case "object":
|
|
442
|
-
length -= exports.dlen(c1.d);
|
|
443
|
-
}
|
|
444
|
-
break;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
let c;
|
|
448
|
-
for (; c = take(-1); )
|
|
449
|
-
append(c);
|
|
450
|
-
return trim(newOp);
|
|
451
|
-
}
|
|
452
|
-
__name(transform, "transform");
|
|
453
|
-
function compose(op1, op2) {
|
|
454
|
-
checkOp(op1), checkOp(op2);
|
|
455
|
-
const result = [], append = makeAppend(result), { take } = makeTake(op1);
|
|
456
|
-
for (let i = 0; i < op2.length; i++) {
|
|
457
|
-
const component = op2[i];
|
|
458
|
-
let length, chunk;
|
|
459
|
-
switch (typeof component) {
|
|
460
|
-
case "number":
|
|
461
|
-
for (length = component; length > 0; )
|
|
462
|
-
chunk = take(length, "d"), append(chunk), typeof chunk != "object" && (length -= componentLength(chunk));
|
|
463
|
-
break;
|
|
464
|
-
case "string":
|
|
465
|
-
append(component);
|
|
466
|
-
break;
|
|
467
|
-
case "object":
|
|
468
|
-
length = exports.dlen(component.d);
|
|
469
|
-
let offset = 0;
|
|
470
|
-
for (; offset < length; )
|
|
471
|
-
switch (chunk = take(length - offset, "d"), typeof chunk) {
|
|
472
|
-
case "number":
|
|
473
|
-
append({ d: dslice(component.d, offset, offset + chunk) }), offset += chunk;
|
|
474
|
-
break;
|
|
475
|
-
case "string":
|
|
476
|
-
offset += unicount_1.strPosToUni(chunk);
|
|
477
|
-
break;
|
|
478
|
-
case "object":
|
|
479
|
-
append(chunk);
|
|
480
|
-
}
|
|
481
|
-
break;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
let c;
|
|
485
|
-
for (; c = take(-1); )
|
|
486
|
-
append(c);
|
|
487
|
-
return trim(result);
|
|
488
|
-
}
|
|
489
|
-
__name(compose, "compose");
|
|
490
|
-
const transformPosition = /* @__PURE__ */ __name((cursor2, op) => {
|
|
491
|
-
let pos = 0;
|
|
492
|
-
for (let i = 0; i < op.length && cursor2 > pos; i++) {
|
|
493
|
-
const c = op[i];
|
|
494
|
-
switch (typeof c) {
|
|
495
|
-
case "number": {
|
|
496
|
-
pos += c;
|
|
497
|
-
break;
|
|
498
|
-
}
|
|
499
|
-
case "string":
|
|
500
|
-
const offset = unicount_1.strPosToUni(c);
|
|
501
|
-
pos += offset, cursor2 += offset;
|
|
502
|
-
break;
|
|
503
|
-
case "object":
|
|
504
|
-
cursor2 -= Math.min(exports.dlen(c.d), cursor2 - pos);
|
|
505
|
-
break;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
return cursor2;
|
|
509
|
-
}, "transformPosition"), transformSelection = /* @__PURE__ */ __name((selection, op) => typeof selection == "number" ? transformPosition(selection, op) : selection.map((s) => transformPosition(s, op)), "transformSelection");
|
|
510
|
-
function makeInvertible(op, doc, ropeImpl) {
|
|
511
|
-
return mapOp(op, (c, prePos) => typeof c == "object" && typeof c.d == "number" ? { d: ropeImpl.slice(doc, prePos, prePos + c.d) } : c);
|
|
512
|
-
}
|
|
513
|
-
__name(makeInvertible, "makeInvertible");
|
|
514
|
-
function invert(op) {
|
|
515
|
-
return mapOp(op, (c) => {
|
|
516
|
-
switch (typeof c) {
|
|
517
|
-
case "object":
|
|
518
|
-
if (typeof c.d == "number")
|
|
519
|
-
throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");
|
|
520
|
-
return c.d;
|
|
521
|
-
case "string":
|
|
522
|
-
return { d: c };
|
|
523
|
-
case "number":
|
|
524
|
-
return c;
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
__name(invert, "invert");
|
|
529
|
-
function stripInvertible(op) {
|
|
530
|
-
return mapOp(op, (c) => typeof c == "object" && typeof c.d == "string" ? { d: unicount_1.strPosToUni(c.d) } : c);
|
|
531
|
-
}
|
|
532
|
-
__name(stripInvertible, "stripInvertible");
|
|
533
|
-
function isInvertible(op) {
|
|
534
|
-
let invertible = !0;
|
|
535
|
-
return eachOp(op, (c) => {
|
|
536
|
-
typeof c == "object" && typeof c.d == "number" && (invertible = !1);
|
|
537
|
-
}), invertible;
|
|
538
|
-
}
|
|
539
|
-
__name(isInvertible, "isInvertible");
|
|
540
|
-
function makeType(ropeImpl) {
|
|
541
|
-
return {
|
|
542
|
-
name: "text-unicode",
|
|
543
|
-
uri: "http://sharejs.org/types/text-unicode",
|
|
544
|
-
trim,
|
|
545
|
-
normalize,
|
|
546
|
-
checkOp,
|
|
547
|
-
/** Create a new text snapshot.
|
|
548
|
-
*
|
|
549
|
-
* @param {string} initial - initial snapshot data. Optional. Defaults to ''.
|
|
550
|
-
* @returns {Snap} Initial document snapshot object
|
|
551
|
-
*/
|
|
552
|
-
create(initial = "") {
|
|
553
|
-
if (typeof initial != "string")
|
|
554
|
-
throw Error("Initial data must be a string");
|
|
555
|
-
return ropeImpl.create(initial);
|
|
556
|
-
},
|
|
557
|
-
/** Apply an operation to a document snapshot
|
|
558
|
-
*/
|
|
559
|
-
apply(str, op) {
|
|
560
|
-
checkOp(op);
|
|
561
|
-
const builder = ropeImpl.builder(str);
|
|
562
|
-
for (let i = 0; i < op.length; i++) {
|
|
563
|
-
const component = op[i];
|
|
564
|
-
switch (typeof component) {
|
|
565
|
-
case "number":
|
|
566
|
-
builder.skip(component);
|
|
567
|
-
break;
|
|
568
|
-
case "string":
|
|
569
|
-
builder.append(component);
|
|
570
|
-
break;
|
|
571
|
-
case "object":
|
|
572
|
-
builder.del(exports.dlen(component.d));
|
|
573
|
-
break;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
return builder.build();
|
|
577
|
-
},
|
|
578
|
-
transform,
|
|
579
|
-
compose,
|
|
580
|
-
transformPosition,
|
|
581
|
-
transformSelection,
|
|
582
|
-
isInvertible,
|
|
583
|
-
makeInvertible(op, doc) {
|
|
584
|
-
return makeInvertible(op, doc, ropeImpl);
|
|
585
|
-
},
|
|
586
|
-
stripInvertible,
|
|
587
|
-
invert,
|
|
588
|
-
invertWithDoc(op, doc) {
|
|
589
|
-
return invert(makeInvertible(op, doc, ropeImpl));
|
|
590
|
-
},
|
|
591
|
-
isNoop: /* @__PURE__ */ __name((op) => op.length === 0, "isNoop")
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
__name(makeType, "makeType"), exports.default = makeType;
|
|
595
|
-
}(type)), type;
|
|
596
|
-
}
|
|
597
|
-
__name(requireType, "requireType");
|
|
598
|
-
var api = {}, hasRequiredApi;
|
|
599
|
-
function requireApi() {
|
|
600
|
-
if (hasRequiredApi) return api;
|
|
601
|
-
hasRequiredApi = 1, Object.defineProperty(api, "__esModule", { value: !0 });
|
|
602
|
-
const type_1 = requireType(), unicount_1 = requireUnicount();
|
|
603
|
-
function api$1(getSnapshot, submitOp) {
|
|
604
|
-
return {
|
|
605
|
-
// Returns the text content of the document
|
|
606
|
-
get: getSnapshot,
|
|
607
|
-
// Returns the number of characters in the string
|
|
608
|
-
getLength() {
|
|
609
|
-
return getSnapshot().length;
|
|
610
|
-
},
|
|
611
|
-
// Insert the specified text at the given position in the document
|
|
612
|
-
insert(pos, text, callback) {
|
|
613
|
-
const uniPos = unicount_1.strPosToUni(getSnapshot(), pos);
|
|
614
|
-
return submitOp([uniPos, text], callback);
|
|
615
|
-
},
|
|
616
|
-
remove(pos, lengthOrContent, callback) {
|
|
617
|
-
const uniPos = unicount_1.strPosToUni(getSnapshot(), pos);
|
|
618
|
-
return submitOp([uniPos, { d: lengthOrContent }], callback);
|
|
619
|
-
},
|
|
620
|
-
// When you use this API, you should implement these two methods
|
|
621
|
-
// in your editing context.
|
|
622
|
-
//onInsert: function(pos, text) {},
|
|
623
|
-
//onRemove: function(pos, removedLength) {},
|
|
624
|
-
_onOp(op) {
|
|
625
|
-
type_1.eachOp(op, (component, prePos, postPos) => {
|
|
626
|
-
switch (typeof component) {
|
|
627
|
-
case "string":
|
|
628
|
-
this.onInsert && this.onInsert(postPos, component);
|
|
629
|
-
break;
|
|
630
|
-
case "object":
|
|
631
|
-
const dl = type_1.dlen(component.d);
|
|
632
|
-
this.onRemove && this.onRemove(postPos, dl);
|
|
633
|
-
}
|
|
634
|
-
});
|
|
635
|
-
},
|
|
636
|
-
onInsert: null,
|
|
637
|
-
onRemove: null
|
|
638
|
-
};
|
|
639
|
-
}
|
|
640
|
-
return __name(api$1, "api$1"), api.default = api$1, api$1.provides = { text: !0 }, api;
|
|
641
|
-
}
|
|
642
|
-
__name(requireApi, "requireApi");
|
|
643
|
-
var hasRequiredDist;
|
|
644
|
-
function requireDist() {
|
|
645
|
-
return hasRequiredDist || (hasRequiredDist = 1, function(exports) {
|
|
646
|
-
var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
647
|
-
k2 === void 0 && (k2 = k), Object.defineProperty(o, k2, { enumerable: !0, get: /* @__PURE__ */ __name(function() {
|
|
648
|
-
return m[k];
|
|
649
|
-
}, "get") });
|
|
650
|
-
} : function(o, m, k, k2) {
|
|
651
|
-
k2 === void 0 && (k2 = k), o[k2] = m[k];
|
|
652
|
-
}), __setModuleDefault = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(o, v) {
|
|
653
|
-
Object.defineProperty(o, "default", { enumerable: !0, value: v });
|
|
654
|
-
} : function(o, v) {
|
|
655
|
-
o.default = v;
|
|
656
|
-
}), __importStar = commonjsGlobal && commonjsGlobal.__importStar || function(mod) {
|
|
657
|
-
if (mod && mod.__esModule) return mod;
|
|
658
|
-
var result = {};
|
|
659
|
-
if (mod != null) for (var k in mod) Object.hasOwnProperty.call(mod, k) && __createBinding(result, mod, k);
|
|
660
|
-
return __setModuleDefault(result, mod), result;
|
|
661
|
-
}, __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) {
|
|
662
|
-
return mod && mod.__esModule ? mod : { default: mod };
|
|
663
|
-
};
|
|
664
|
-
Object.defineProperty(exports, "__esModule", { value: !0 }), exports.type = exports.remove = exports.insert = void 0;
|
|
665
|
-
const unicount_1 = requireUnicount(), type_1 = __importStar(requireType()), api_1 = __importDefault(requireApi()), ropeImplUnicodeString = {
|
|
666
|
-
create(s) {
|
|
667
|
-
return s;
|
|
668
|
-
},
|
|
669
|
-
toString(s) {
|
|
670
|
-
return s;
|
|
671
|
-
},
|
|
672
|
-
builder(oldDoc) {
|
|
673
|
-
if (typeof oldDoc != "string")
|
|
674
|
-
throw Error("Invalid document snapshot: " + oldDoc);
|
|
675
|
-
const newDoc = [];
|
|
676
|
-
return {
|
|
677
|
-
skip(n) {
|
|
678
|
-
let offset = unicount_1.uniToStrPos(oldDoc, n);
|
|
679
|
-
if (offset > oldDoc.length)
|
|
680
|
-
throw Error("The op is too long for this document");
|
|
681
|
-
newDoc.push(oldDoc.slice(0, offset)), oldDoc = oldDoc.slice(offset);
|
|
682
|
-
},
|
|
683
|
-
append(s) {
|
|
684
|
-
newDoc.push(s);
|
|
685
|
-
},
|
|
686
|
-
del(n) {
|
|
687
|
-
oldDoc = oldDoc.slice(unicount_1.uniToStrPos(oldDoc, n));
|
|
688
|
-
},
|
|
689
|
-
build() {
|
|
690
|
-
return newDoc.join("") + oldDoc;
|
|
691
|
-
}
|
|
692
|
-
};
|
|
693
|
-
},
|
|
694
|
-
slice: type_1.uniSlice
|
|
695
|
-
}, textString = type_1.default(ropeImplUnicodeString), type2 = Object.assign(Object.assign({}, textString), { api: api_1.default });
|
|
696
|
-
exports.type = type2, exports.insert = (pos, text) => text.length === 0 ? [] : pos === 0 ? [text] : [pos, text], exports.remove = (pos, textOrLen) => type_1.dlen(textOrLen) === 0 ? [] : pos === 0 ? [{ d: textOrLen }] : [pos, { d: textOrLen }];
|
|
697
|
-
var type_2 = requireType();
|
|
698
|
-
Object.defineProperty(exports, "makeType", { enumerable: !0, get: /* @__PURE__ */ __name(function() {
|
|
699
|
-
return type_2.default;
|
|
700
|
-
}, "get") });
|
|
701
|
-
}(dist)), dist;
|
|
702
|
-
}
|
|
703
|
-
__name(requireDist, "requireDist");
|
|
704
|
-
(function(exports) {
|
|
705
|
-
var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) {
|
|
706
|
-
return mod && mod.__esModule ? mod : {
|
|
707
|
-
default: mod
|
|
708
|
-
};
|
|
709
|
-
};
|
|
710
|
-
Object.defineProperty(exports, "__esModule", {
|
|
711
|
-
value: !0
|
|
712
|
-
}), exports.editOp = exports.replaceOp = exports.insertOp = exports.moveOp = exports.removeOp = exports.type = void 0;
|
|
713
|
-
const deepEqual_js_1 = __importDefault(deepEqual$1), deepClone_js_1 = __importDefault(deepClone$1), cursor_js_1 = cursor, types_js_1 = types;
|
|
714
|
-
function assert(pred, msg) {
|
|
715
|
-
if (!pred) throw new Error(msg);
|
|
716
|
-
}
|
|
717
|
-
__name(assert, "assert"), exports.type = {
|
|
718
|
-
name: "json1",
|
|
719
|
-
uri: "http://sharejs.org/types/JSONv1",
|
|
720
|
-
readCursor: cursor_js_1.readCursor,
|
|
721
|
-
writeCursor: cursor_js_1.writeCursor,
|
|
722
|
-
create: /* @__PURE__ */ __name((data) => data, "create"),
|
|
723
|
-
isNoop: /* @__PURE__ */ __name((op) => op == null, "isNoop"),
|
|
724
|
-
setDebug(val) {
|
|
725
|
-
},
|
|
726
|
-
registerSubtype,
|
|
727
|
-
checkValidOp,
|
|
728
|
-
normalize,
|
|
729
|
-
apply,
|
|
730
|
-
transformPosition,
|
|
731
|
-
compose,
|
|
732
|
-
tryTransform,
|
|
733
|
-
transform,
|
|
734
|
-
makeInvertible,
|
|
735
|
-
invert,
|
|
736
|
-
invertWithDoc,
|
|
737
|
-
RM_UNEXPECTED_CONTENT: types_js_1.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
738
|
-
DROP_COLLISION: types_js_1.ConflictType.DROP_COLLISION,
|
|
739
|
-
BLACKHOLE: types_js_1.ConflictType.BLACKHOLE,
|
|
740
|
-
transformNoConflict: /* @__PURE__ */ __name((op1, op2, side) => transformWithConflictsPred(() => !0, op1, op2, side), "transformNoConflict"),
|
|
741
|
-
typeAllowingConflictsPred: /* @__PURE__ */ __name((allowConflict) => Object.assign(Object.assign({}, exports.type), {
|
|
742
|
-
transform: /* @__PURE__ */ __name((op1, op2, side) => transformWithConflictsPred(allowConflict, op1, op2, side), "transform")
|
|
743
|
-
}), "typeAllowingConflictsPred")
|
|
744
|
-
};
|
|
745
|
-
const getComponent = /* @__PURE__ */ __name((r) => r ? r.getComponent() : null, "getComponent");
|
|
746
|
-
function isObject(o) {
|
|
747
|
-
return o && typeof o == "object" && !Array.isArray(o);
|
|
748
|
-
}
|
|
749
|
-
__name(isObject, "isObject");
|
|
750
|
-
const shallowClone = /* @__PURE__ */ __name((obj) => Array.isArray(obj) ? obj.slice() : obj !== null && typeof obj == "object" ? Object.assign({}, obj) : obj, "shallowClone"), hasPick = /* @__PURE__ */ __name((c) => c && (c.p != null || c.r !== void 0), "hasPick"), hasDrop = /* @__PURE__ */ __name((c) => c && (c.d != null || c.i !== void 0), "hasDrop");
|
|
751
|
-
function removeChild(container, key) {
|
|
752
|
-
return assert(container != null), typeof key == "number" ? (assert(Array.isArray(container), "Invalid key - child is not an array"), (container = container.slice()).splice(key, 1)) : (assert(isObject(container), "Invalid key - child is not an object"), delete (container = Object.assign({}, container))[key]), container;
|
|
753
|
-
}
|
|
754
|
-
__name(removeChild, "removeChild");
|
|
755
|
-
function insertChildMut(container, key, value) {
|
|
756
|
-
return typeof key == "number" ? (assert(container != null, "Container is missing for key"), assert(Array.isArray(container), "Cannot use numerical key for object container"), assert(container.length >= key, "Cannot insert into out of bounds index"), container.splice(key, 0, value)) : (assert(isObject(container), "Cannot insert into missing item"), assert(container[key] === void 0, "Trying to overwrite value at key. Your op needs to remove it first"), container[key] = value), value;
|
|
757
|
-
}
|
|
758
|
-
__name(insertChildMut, "insertChildMut"), exports.removeOp = (path, value = !0) => cursor_js_1.writeCursor().writeAtPath(path, "r", value).get(), exports.moveOp = (from, to) => cursor_js_1.writeCursor().writeMove(from, to).get(), exports.insertOp = (path, value) => cursor_js_1.writeCursor().writeAtPath(path, "i", value).get(), exports.replaceOp = (path, oldVal, newVal) => cursor_js_1.writeCursor().at(path, (w) => {
|
|
759
|
-
w.write("r", oldVal), w.write("i", newVal);
|
|
760
|
-
}).get(), exports.editOp = (path, type2, subOp, preserveNoop = !1) => cursor_js_1.writeCursor().at(path, (w) => writeEdit(w, type2, subOp, preserveNoop)).get();
|
|
761
|
-
const isValidKey = /* @__PURE__ */ __name((container, key) => container != null && (typeof key == "number" ? Array.isArray(container) : typeof container == "object"), "isValidKey"), maybeGetChild = /* @__PURE__ */ __name((container, key) => isValidKey(container, key) ? container[key] : void 0, "maybeGetChild"), subtypes = {};
|
|
762
|
-
function registerSubtype(subtype) {
|
|
763
|
-
let _subtype = subtype.type ? subtype.type : subtype;
|
|
764
|
-
_subtype.name && (subtypes[_subtype.name] = _subtype), _subtype.uri && (subtypes[_subtype.uri] = _subtype);
|
|
765
|
-
}
|
|
766
|
-
__name(registerSubtype, "registerSubtype");
|
|
767
|
-
const typeOrThrow = /* @__PURE__ */ __name((name) => {
|
|
768
|
-
const type2 = subtypes[name];
|
|
769
|
-
if (type2) return type2;
|
|
770
|
-
throw Error("Missing type: " + name);
|
|
771
|
-
}, "typeOrThrow");
|
|
772
|
-
registerSubtype(requireDist());
|
|
773
|
-
const add = /* @__PURE__ */ __name((a, b) => a + b, "add");
|
|
774
|
-
registerSubtype({
|
|
775
|
-
name: "number",
|
|
776
|
-
apply: add,
|
|
777
|
-
compose: add,
|
|
778
|
-
invert: /* @__PURE__ */ __name((n) => -n, "invert"),
|
|
779
|
-
transform: /* @__PURE__ */ __name((a) => a, "transform")
|
|
780
|
-
});
|
|
781
|
-
const getEditType = /* @__PURE__ */ __name((c) => c == null ? null : c.et ? typeOrThrow(c.et) : c.es ? subtypes["text-unicode"] : c.ena != null ? subtypes.number : null, "getEditType"), getEdit = /* @__PURE__ */ __name((c) => c.es ? c.es : c.ena != null ? c.ena : c.e, "getEdit"), writeEdit = /* @__PURE__ */ __name((w, typeOrName, edit, preserveNoop = !1) => {
|
|
782
|
-
const [type2, name] = typeof typeOrName == "string" ? [typeOrThrow(typeOrName), typeOrName] : [typeOrName, typeOrName.name];
|
|
783
|
-
!preserveNoop && type2.isNoop && type2.isNoop(edit) || (name === "number" ? w.write("ena", edit) : name === "text-unicode" ? w.write("es", edit) : (w.write("et", name), w.write("e", edit)));
|
|
784
|
-
}, "writeEdit");
|
|
785
|
-
function checkNonNegInteger(n) {
|
|
786
|
-
assert(typeof n == "number"), assert(n >= 0), assert(n === (0 | n));
|
|
787
|
-
}
|
|
788
|
-
__name(checkNonNegInteger, "checkNonNegInteger");
|
|
789
|
-
function checkScalar(s) {
|
|
790
|
-
typeof s == "number" ? checkNonNegInteger(s) : assert(typeof s == "string");
|
|
791
|
-
}
|
|
792
|
-
__name(checkScalar, "checkScalar");
|
|
793
|
-
function checkValidOp(op) {
|
|
794
|
-
if (op === null) return;
|
|
795
|
-
const pickedSlots = /* @__PURE__ */ new Set(), droppedSlots = /* @__PURE__ */ new Set(), checkComponent = /* @__PURE__ */ __name((e) => {
|
|
796
|
-
let empty = !0, hasEdit = !1;
|
|
797
|
-
for (let k in e) {
|
|
798
|
-
const v = e[k];
|
|
799
|
-
if (empty = !1, assert(k === "p" || k === "r" || k === "d" || k === "i" || k === "e" || k === "es" || k === "ena" || k === "et", "Invalid component item '" + k + "'"), k === "p") checkNonNegInteger(v), assert(!pickedSlots.has(v)), pickedSlots.add(v), assert(e.r === void 0);
|
|
800
|
-
else if (k === "d") checkNonNegInteger(v), assert(!droppedSlots.has(v)), droppedSlots.add(v), assert(e.i === void 0);
|
|
801
|
-
else if (k === "e" || k === "es" || k === "ena") {
|
|
802
|
-
assert(!hasEdit), hasEdit = !0;
|
|
803
|
-
const t = getEditType(e);
|
|
804
|
-
assert(t, "Missing type in edit"), t.checkValidOp && t.checkValidOp(getEdit(e));
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
assert(!empty);
|
|
808
|
-
}, "checkComponent"), checkDescent = /* @__PURE__ */ __name((descent, isRoot, removed) => {
|
|
809
|
-
if (!Array.isArray(descent)) throw Error("Op must be null or a list");
|
|
810
|
-
if (descent.length === 0) throw Error("Empty descent");
|
|
811
|
-
isRoot || checkScalar(descent[0]);
|
|
812
|
-
let last = 1, numDescents = 0, lastKey = 0;
|
|
813
|
-
for (let i = 0; i < descent.length; i++) {
|
|
814
|
-
const d = descent[i];
|
|
815
|
-
if (assert(d != null), Array.isArray(d)) {
|
|
816
|
-
const key = checkDescent(d, !1);
|
|
817
|
-
if (numDescents) {
|
|
818
|
-
const t1 = typeof lastKey, t2 = typeof key;
|
|
819
|
-
t1 === t2 ? assert(lastKey < key, "descent keys are not in order") : assert(t1 === "number" && t2 === "string");
|
|
820
|
-
}
|
|
821
|
-
lastKey = key, numDescents++, last = 3;
|
|
822
|
-
} else typeof d == "object" ? (assert(last === 1, `Prev not scalar - instead ${last}`), checkComponent(d), last = 2) : (assert(last !== 3), checkScalar(d), assert(cursor_js_1.isValidPathItem(d), "Invalid path key"), last = 1);
|
|
823
|
-
}
|
|
824
|
-
return assert(numDescents !== 1, "Operation makes multiple descents. Remove some []"), assert(last === 2 || last === 3), descent[0];
|
|
825
|
-
}, "checkDescent");
|
|
826
|
-
checkDescent(op, !0), assert(pickedSlots.size === droppedSlots.size, "Mismatched picks and drops in op");
|
|
827
|
-
for (let i = 0; i < pickedSlots.size; i++) assert(pickedSlots.has(i)), assert(droppedSlots.has(i));
|
|
828
|
-
}
|
|
829
|
-
__name(checkValidOp, "checkValidOp");
|
|
830
|
-
function normalize(op) {
|
|
831
|
-
let nextSlot = 0, slotMap = [];
|
|
832
|
-
const w = cursor_js_1.writeCursor();
|
|
833
|
-
return w.mergeTree(op, (c, w2) => {
|
|
834
|
-
const t = getEditType(c);
|
|
835
|
-
if (t) {
|
|
836
|
-
const op2 = getEdit(c);
|
|
837
|
-
writeEdit(w2, t, t.normalize ? t.normalize(op2) : op2);
|
|
838
|
-
}
|
|
839
|
-
for (const k of ["r", "p", "i", "d"]) if (c[k] !== void 0) {
|
|
840
|
-
const r = k === "p" || k === "d" ? (inSlot = c[k], slotMap[inSlot] == null && (slotMap[inSlot] = nextSlot++), slotMap[inSlot]) : c[k];
|
|
841
|
-
w2.write(k, r);
|
|
842
|
-
}
|
|
843
|
-
var inSlot;
|
|
844
|
-
}), w.get();
|
|
845
|
-
}
|
|
846
|
-
__name(normalize, "normalize");
|
|
847
|
-
function apply(snapshot, op) {
|
|
848
|
-
if (checkValidOp(op), op === null) return snapshot;
|
|
849
|
-
const held = [];
|
|
850
|
-
return (/* @__PURE__ */ __name(function drop(root, descent) {
|
|
851
|
-
let subDoc = root, i = 0, rootContainer = {
|
|
852
|
-
root
|
|
853
|
-
}, m = 0, container = rootContainer, key = "root";
|
|
854
|
-
function mut() {
|
|
855
|
-
for (; m < i; m++) {
|
|
856
|
-
let d = descent[m];
|
|
857
|
-
typeof d != "object" && (assert(isValidKey(container, key)), container = container[key] = shallowClone(container[key]), key = d);
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
for (__name(mut, "mut"); i < descent.length; i++) {
|
|
861
|
-
const d = descent[i];
|
|
862
|
-
if (Array.isArray(d)) {
|
|
863
|
-
const child = drop(subDoc, d);
|
|
864
|
-
child !== subDoc && child !== void 0 && (mut(), subDoc = container[key] = child);
|
|
865
|
-
} else if (typeof d == "object") {
|
|
866
|
-
d.d != null ? (mut(), subDoc = insertChildMut(container, key, held[d.d])) : d.i !== void 0 && (mut(), subDoc = insertChildMut(container, key, d.i));
|
|
867
|
-
const t = getEditType(d);
|
|
868
|
-
if (t) mut(), subDoc = container[key] = t.apply(subDoc, getEdit(d));
|
|
869
|
-
else if (d.e !== void 0) throw Error("Subtype " + d.et + " undefined");
|
|
870
|
-
} else subDoc = maybeGetChild(subDoc, d);
|
|
871
|
-
}
|
|
872
|
-
return rootContainer.root;
|
|
873
|
-
}, "drop"))(snapshot = (/* @__PURE__ */ __name(function pick(subDoc, descent) {
|
|
874
|
-
const stack = [];
|
|
875
|
-
let i = 0;
|
|
876
|
-
for (; i < descent.length; i++) {
|
|
877
|
-
const d = descent[i];
|
|
878
|
-
if (Array.isArray(d)) break;
|
|
879
|
-
typeof d != "object" && (stack.push(subDoc), subDoc = maybeGetChild(subDoc, d));
|
|
880
|
-
}
|
|
881
|
-
for (let j = descent.length - 1; j >= i; j--) subDoc = pick(subDoc, descent[j]);
|
|
882
|
-
for (--i; i >= 0; i--) {
|
|
883
|
-
const d = descent[i];
|
|
884
|
-
if (typeof d != "object") {
|
|
885
|
-
const container = stack.pop();
|
|
886
|
-
subDoc = subDoc === maybeGetChild(container, d) ? container : subDoc === void 0 ? removeChild(container, d) : (k = d, v = subDoc, (obj = shallowClone(obj = container))[k] = v, obj);
|
|
887
|
-
} else hasPick(d) && (assert(subDoc !== void 0, "Cannot pick up or remove undefined"), d.p != null && (held[d.p] = subDoc), subDoc = void 0);
|
|
888
|
-
}
|
|
889
|
-
var obj, k, v;
|
|
890
|
-
return subDoc;
|
|
891
|
-
}, "pick"))(snapshot, op), op);
|
|
892
|
-
}
|
|
893
|
-
__name(apply, "apply");
|
|
894
|
-
function transformPosition(path, op) {
|
|
895
|
-
path = path.slice(), checkValidOp(op);
|
|
896
|
-
const r = cursor_js_1.readCursor(op);
|
|
897
|
-
let pickedAtSlot, pickIndex, removed = !1;
|
|
898
|
-
const advStack = [];
|
|
899
|
-
for (let i = 0; ; i++) {
|
|
900
|
-
const k = path[i], c = r.getComponent();
|
|
901
|
-
if (c && (c.r !== void 0 ? removed = !0 : c.p != null && (removed = !1, pickedAtSlot = c.p, pickIndex = i)), i >= path.length) break;
|
|
902
|
-
let pickOffset = 0;
|
|
903
|
-
const pickAdv = cursor_js_1.advancer(r, void 0, (k2, c2) => {
|
|
904
|
-
hasPick(c2) && pickOffset++;
|
|
905
|
-
});
|
|
906
|
-
advStack.unshift(pickAdv);
|
|
907
|
-
const hasNext = pickAdv(k);
|
|
908
|
-
if (typeof k == "number" && (path[i] -= pickOffset), !hasNext) break;
|
|
909
|
-
}
|
|
910
|
-
if (advStack.forEach((pickAdv) => pickAdv.end()), removed) return null;
|
|
911
|
-
const handleDrop = /* @__PURE__ */ __name(() => {
|
|
912
|
-
let i = 0;
|
|
913
|
-
if (pickedAtSlot != null) {
|
|
914
|
-
const rPath = r.getPath();
|
|
915
|
-
i = rPath.length, path = rPath.concat(path.slice(pickIndex));
|
|
916
|
-
}
|
|
917
|
-
for (; i < path.length; i++) {
|
|
918
|
-
const k = path[i], c = getComponent(r), et = getEditType(c);
|
|
919
|
-
if (et) {
|
|
920
|
-
const e = getEdit(c);
|
|
921
|
-
et.transformPosition && (path[i] = et.transformPosition(path[i], e));
|
|
922
|
-
break;
|
|
923
|
-
}
|
|
924
|
-
let dropOffset = 0;
|
|
925
|
-
const hasNext = cursor_js_1.advancer(r, (k2, c2) => hasDrop(c2) ? ~(k2 - dropOffset) : k2 - dropOffset, (k2, c2) => {
|
|
926
|
-
hasDrop(c2) && dropOffset++;
|
|
927
|
-
})(k);
|
|
928
|
-
if (typeof k == "number" && (path[i] += dropOffset), !hasNext) break;
|
|
929
|
-
}
|
|
930
|
-
}, "handleDrop");
|
|
931
|
-
return pickedAtSlot != null ? r.eachDrop(null, (slot) => {
|
|
932
|
-
slot === pickedAtSlot && handleDrop();
|
|
933
|
-
}) : handleDrop(), path;
|
|
934
|
-
}
|
|
935
|
-
__name(transformPosition, "transformPosition");
|
|
936
|
-
function compose(op1, op2) {
|
|
937
|
-
if (checkValidOp(op1), checkValidOp(op2), op1 == null) return op2;
|
|
938
|
-
if (op2 == null) return op1;
|
|
939
|
-
let nextSlot = 0;
|
|
940
|
-
const r1 = cursor_js_1.readCursor(op1), r2 = cursor_js_1.readCursor(op2), w = cursor_js_1.writeCursor(), heldPickWrites = [], heldDropWrites = [], held1Pick = [], held2Drop = [], p1SlotMap = [], p2SlotMap = [], visitedOp2EditCs = /* @__PURE__ */ new Set();
|
|
941
|
-
r1.traverse(null, (c) => {
|
|
942
|
-
c.p != null && (held1Pick[c.p] = r1.clone());
|
|
943
|
-
}), r2.traverse(null, (c) => {
|
|
944
|
-
c.d != null && (held2Drop[c.d] = r2.clone());
|
|
945
|
-
});
|
|
946
|
-
const w2 = cursor_js_1.writeCursor();
|
|
947
|
-
return (/* @__PURE__ */ __name(function xfBoundary(r1Pick, r1Drop, r2Pick, r2Drop, litIn, rmParent, wd, wp) {
|
|
948
|
-
assert(r1Drop || r2Pick);
|
|
949
|
-
const c1d = getComponent(r1Drop), c2p = getComponent(r2Pick), rmHere = !!c2p && c2p.r !== void 0, insHere = !!c1d && c1d.i !== void 0, drop1Slot = c1d ? c1d.d : null, pick2Slot = c2p ? c2p.p : null, rmChildren = (rmParent || rmHere) && pick2Slot == null;
|
|
950
|
-
if (pick2Slot != null) r2Drop = held2Drop[pick2Slot], wd = heldDropWrites[pick2Slot] = new cursor_js_1.WriteCursor();
|
|
951
|
-
else if (c2p && c2p.r !== void 0) r2Drop = null;
|
|
952
|
-
else {
|
|
953
|
-
const c2d2 = getComponent(r2Drop);
|
|
954
|
-
c2d2 && c2d2.d != null && (r2Drop = null);
|
|
955
|
-
}
|
|
956
|
-
const c2d = getComponent(r2Drop);
|
|
957
|
-
if (drop1Slot != null) if (r1Pick = held1Pick[drop1Slot], wp = heldPickWrites[drop1Slot] = new cursor_js_1.WriteCursor(), rmChildren) rmParent && !rmHere && wp.write("r", !0);
|
|
958
|
-
else {
|
|
959
|
-
const slot = p1SlotMap[drop1Slot] = nextSlot++;
|
|
960
|
-
wd.write("d", slot);
|
|
961
|
-
}
|
|
962
|
-
else if (c1d && c1d.i !== void 0) r1Pick = null;
|
|
963
|
-
else {
|
|
964
|
-
const c1p = getComponent(r1Pick);
|
|
965
|
-
c1p && c1p.p != null && (r1Pick = null);
|
|
966
|
-
}
|
|
967
|
-
let litOut;
|
|
968
|
-
insHere ? (assert(litIn === void 0), litOut = c1d.i) : litOut = litIn;
|
|
969
|
-
const insComponent = (pick2Slot == null ? !insHere || rmParent || rmHere : litOut === void 0) ? null : wd.getComponent();
|
|
970
|
-
if (pick2Slot != null) {
|
|
971
|
-
if (!(litIn !== void 0 || insHere)) {
|
|
972
|
-
const slot = drop1Slot != null ? p1SlotMap[drop1Slot] : nextSlot++;
|
|
973
|
-
p2SlotMap[pick2Slot] = slot, wp.write("p", slot);
|
|
974
|
-
}
|
|
975
|
-
} else rmHere && (insHere || litIn !== void 0 || (c2p.r, wp.write("r", c2p.r)));
|
|
976
|
-
const type1 = rmChildren ? null : getEditType(c1d), type2 = getEditType(c2d);
|
|
977
|
-
if ((type1 || type2) && (type1 && type1.name, type2 && type2.name), type1 && type2) {
|
|
978
|
-
assert(type1 === type2);
|
|
979
|
-
const e1 = getEdit(c1d), e2 = getEdit(c2d), r = type1.compose(e1, e2);
|
|
980
|
-
writeEdit(wd, type1, r), visitedOp2EditCs.add(c2d);
|
|
981
|
-
} else type1 ? writeEdit(wd, type1, getEdit(c1d)) : type2 && (writeEdit(wd, type2, getEdit(c2d)), visitedOp2EditCs.add(c2d));
|
|
982
|
-
const hasContainerLiteral = typeof litOut == "object" && litOut != null;
|
|
983
|
-
let isCloned = !1, p1PickOff = 0, p1DropOff = 0, p2PickOff = 0, p2DropOff = 0, litOff = 0;
|
|
984
|
-
const p2DropAdv = cursor_js_1.advancer(r2Drop, (k, c) => hasDrop(c) ? p2DropOff - k - 1 : k - p2DropOff, (k, c) => {
|
|
985
|
-
hasDrop(c) && p2DropOff++;
|
|
986
|
-
}), p1PickAdv = cursor_js_1.advancer(r1Pick, (k, c) => hasPick(c) ? p1PickOff - k - 1 : k - p1PickOff, (k, c) => {
|
|
987
|
-
hasPick(c) && p1PickOff++;
|
|
988
|
-
});
|
|
989
|
-
if (cursor_js_1.eachChildOf(r1Drop, r2Pick, (inKey, _p1Drop, _p2Pick) => {
|
|
990
|
-
let _p1Pick, _p2Drop, p1PickKey = inKey, p2DropKey = inKey, litKey = inKey;
|
|
991
|
-
if (typeof inKey == "number") {
|
|
992
|
-
let p2Mid = inKey + p2PickOff;
|
|
993
|
-
_p2Drop = p2DropAdv(p2Mid), p2DropKey = p2Mid + p2DropOff;
|
|
994
|
-
let p1Mid = inKey + p1DropOff;
|
|
995
|
-
_p1Pick = p1PickAdv(p1Mid), hasDrop(getComponent(_p2Drop)) && (_p1Pick = null), p1PickKey = p1Mid + p1PickOff, litKey = inKey + litOff, assert(p1PickKey >= 0, "p1PickKey is negative"), assert(p2DropKey >= 0, "p2DropKey is negative");
|
|
996
|
-
const hd1 = hasDrop(getComponent(_p1Drop)), hp2 = hasPick(getComponent(_p2Pick));
|
|
997
|
-
(hd1 || hp2 && !rmChildren) && litOff--, hd1 && p1DropOff--, hp2 && p2PickOff--;
|
|
998
|
-
} else _p1Pick = p1PickAdv(inKey), _p2Drop = p2DropAdv(inKey);
|
|
999
|
-
wp.descend(p1PickKey), wd.descend(p2DropKey);
|
|
1000
|
-
const _lit = hasContainerLiteral && !hasDrop(getComponent(_p1Drop)) ? litOut[litKey] : void 0, _litResult = xfBoundary(_p1Pick, _p1Drop, _p2Pick, _p2Drop, _lit, rmChildren, wd, wp);
|
|
1001
|
-
var container, key, child;
|
|
1002
|
-
hasContainerLiteral && !rmChildren ? _lit !== _litResult && (isCloned || (litOut = Array.isArray(litOut) ? litOut.slice() : Object.assign({}, litOut), isCloned = !0), container = litOut, child = _litResult, typeof (key = litKey) == "number" ? (assert(Array.isArray(container)), assert(key < container.length)) : (assert(!Array.isArray(container)), assert(container[key] !== void 0)), child === void 0 ? typeof key == "number" ? container.splice(key, 1) : delete container[key] : container[key] = child) : assert(_litResult === void 0), wd.ascend(), wp.ascend();
|
|
1003
|
-
}), p1PickAdv.end(), p2DropAdv.end(), insComponent != null) insComponent.i = litOut;
|
|
1004
|
-
else if (!rmParent && !rmHere && pick2Slot == null) return litOut;
|
|
1005
|
-
}, "xfBoundary"))(r1, r1.clone(), r2, r2.clone(), void 0, !1, w, w2), w.reset(), w.mergeTree(w2.get()), w.reset(), w.get(), heldPickWrites.map((w3) => w3.get()), heldDropWrites.map((w3) => w3.get()), r1.traverse(w, (c, w3) => {
|
|
1006
|
-
const slot1 = c.p;
|
|
1007
|
-
if (slot1 != null) {
|
|
1008
|
-
const slot = p1SlotMap[slot1];
|
|
1009
|
-
slot != null && w3.write("p", slot);
|
|
1010
|
-
const _w = heldPickWrites[slot1];
|
|
1011
|
-
_w && _w.get(), _w && w3.mergeTree(_w.get());
|
|
1012
|
-
} else c.r !== void 0 && w3.write("r", c.r);
|
|
1013
|
-
}), w.reset(), w.get(), r2.traverse(w, (c, w3) => {
|
|
1014
|
-
const slot2 = c.d;
|
|
1015
|
-
if (slot2 != null) {
|
|
1016
|
-
const slot = p2SlotMap[slot2];
|
|
1017
|
-
slot != null && w3.write("d", slot);
|
|
1018
|
-
const _w = heldDropWrites[slot2];
|
|
1019
|
-
_w && w3.mergeTree(_w.get());
|
|
1020
|
-
} else c.i !== void 0 && w3.write("i", c.i);
|
|
1021
|
-
const t = getEditType(c);
|
|
1022
|
-
t && !visitedOp2EditCs.has(c) && writeEdit(w3, t, getEdit(c));
|
|
1023
|
-
}), w.get();
|
|
1024
|
-
}
|
|
1025
|
-
__name(compose, "compose");
|
|
1026
|
-
function invert(op) {
|
|
1027
|
-
if (op == null) return null;
|
|
1028
|
-
const r = new cursor_js_1.ReadCursor(op), w = new cursor_js_1.WriteCursor();
|
|
1029
|
-
let editsToTransform;
|
|
1030
|
-
const heldPick = [], heldWrites = [];
|
|
1031
|
-
return (/* @__PURE__ */ __name(function invertSimple(r2, w2, subDoc) {
|
|
1032
|
-
const c = r2.getComponent();
|
|
1033
|
-
let insertHere, subdocModified = !1;
|
|
1034
|
-
if (c) {
|
|
1035
|
-
c.p != null && (w2.write("d", c.p), heldPick[c.p] = r2.clone()), c.r !== void 0 && w2.write("i", c.r), c.d != null && (w2.write("p", c.d), subDoc = void 0), c.i !== void 0 && (subDoc = insertHere = c.i);
|
|
1036
|
-
const t = getEditType(c);
|
|
1037
|
-
t && (subDoc === void 0 ? (editsToTransform || (editsToTransform = /* @__PURE__ */ new Set()), editsToTransform.add(c)) : (getEdit(c), subDoc = t.apply(subDoc, getEdit(c)), subdocModified = !0));
|
|
1038
|
-
}
|
|
1039
|
-
let dropOff = 0;
|
|
1040
|
-
for (const key of r2) {
|
|
1041
|
-
w2.descend(key);
|
|
1042
|
-
const raw = typeof key == "number" ? key - dropOff : key, childIn = maybeGetChild(subDoc, raw);
|
|
1043
|
-
hasDrop(r2.getComponent()) && dropOff++;
|
|
1044
|
-
const childOut = invertSimple(r2, w2, childIn);
|
|
1045
|
-
if (subDoc !== void 0 && childOut !== void 0) {
|
|
1046
|
-
if (subdocModified || (subdocModified = !0, subDoc = shallowClone(subDoc)), !isValidKey(subDoc, raw)) throw Error("Cannot modify child - invalid operation");
|
|
1047
|
-
subDoc[raw] = childOut;
|
|
1048
|
-
}
|
|
1049
|
-
w2.ascend();
|
|
1050
|
-
}
|
|
1051
|
-
if (insertHere === void 0) return subdocModified ? subDoc : void 0;
|
|
1052
|
-
w2.write("r", subDoc);
|
|
1053
|
-
}, "invertSimple"))(r, w, void 0), editsToTransform && (w.reset(), (/* @__PURE__ */ __name(function transformEdits(rPick, rDrop, w2) {
|
|
1054
|
-
const cd = rDrop.getComponent();
|
|
1055
|
-
if (cd) {
|
|
1056
|
-
const dropSlot = cd.d;
|
|
1057
|
-
if (dropSlot != null && (rPick = heldPick[dropSlot], w2 = heldWrites[dropSlot] = cursor_js_1.writeCursor()), editsToTransform.has(cd)) {
|
|
1058
|
-
const t = getEditType(cd);
|
|
1059
|
-
if (!t.invert) throw Error(`Cannot invert subtype ${t.name}`);
|
|
1060
|
-
writeEdit(w2, t, t.invert(getEdit(cd)));
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
let pickOff = 0, dropOff = 0;
|
|
1064
|
-
const ap = cursor_js_1.advancer(rPick, (k, c) => hasPick(c) ? pickOff - k - 1 : k - pickOff, (k, c) => {
|
|
1065
|
-
hasPick(c) && pickOff++;
|
|
1066
|
-
});
|
|
1067
|
-
for (const key of rDrop) if (typeof key == "number") {
|
|
1068
|
-
const mid = key - dropOff, _rPick = ap(mid), raw = mid + pickOff;
|
|
1069
|
-
w2.descend(raw), transformEdits(_rPick, rDrop, w2), hasDrop(rDrop.getComponent()) && dropOff++, w2.ascend();
|
|
1070
|
-
} else w2.descend(key), transformEdits(ap(key), rDrop, w2), w2.ascend();
|
|
1071
|
-
ap.end();
|
|
1072
|
-
}, "transformEdits"))(r.clone(), r, w), heldWrites.length && (w.reset(), r.traverse(w, (c, w2) => {
|
|
1073
|
-
const slot = c.p;
|
|
1074
|
-
if (slot != null) {
|
|
1075
|
-
const _w = heldWrites[slot];
|
|
1076
|
-
_w && _w.get(), _w && w2.mergeTree(_w.get());
|
|
1077
|
-
}
|
|
1078
|
-
}))), w.get();
|
|
1079
|
-
}
|
|
1080
|
-
__name(invert, "invert");
|
|
1081
|
-
const anyComponent = /* @__PURE__ */ __name((op, fn) => op.some((c) => typeof c == "object" && (Array.isArray(c) ? anyComponent(c, fn) : fn(c))), "anyComponent");
|
|
1082
|
-
function makeInvertible(op, doc) {
|
|
1083
|
-
if (op == null || !anyComponent(op, (c) => {
|
|
1084
|
-
var _a2;
|
|
1085
|
-
return c.r !== void 0 || ((_a2 = getEditType(c)) === null || _a2 === void 0 ? void 0 : _a2.makeInvertible) != null;
|
|
1086
|
-
})) return op;
|
|
1087
|
-
const r = new cursor_js_1.ReadCursor(op), w = new cursor_js_1.WriteCursor();
|
|
1088
|
-
let hasEdits = !1;
|
|
1089
|
-
const heldPick = [], heldDoc = [], traversePick = /* @__PURE__ */ __name((r2, w2, subDoc) => {
|
|
1090
|
-
const c = r2.getComponent();
|
|
1091
|
-
let modified = !1;
|
|
1092
|
-
if (c) {
|
|
1093
|
-
c.d != null && w2.write("d", c.d), c.i !== void 0 && w2.write("i", c.i);
|
|
1094
|
-
const pickSlot = c.p;
|
|
1095
|
-
if (pickSlot != null && (heldPick[pickSlot] = r2.clone(), assert(subDoc !== void 0, "Operation picks up at an invalid key"), heldDoc[pickSlot] = subDoc, w2.write("p", c.p)), c.r !== void 0 && subDoc === void 0) throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");
|
|
1096
|
-
const t = getEditType(c);
|
|
1097
|
-
t && (t.makeInvertible ? hasEdits = !0 : writeEdit(w2, t, getEdit(c), !0));
|
|
1098
|
-
}
|
|
1099
|
-
let listOff = 0;
|
|
1100
|
-
for (const key of r2) {
|
|
1101
|
-
w2.descend(key);
|
|
1102
|
-
const keyRaw = typeof key == "number" ? key - listOff : key, childIn = maybeGetChild(subDoc, keyRaw), childOut = traversePick(r2, w2, childIn);
|
|
1103
|
-
childIn !== childOut && (modified || (modified = !0, subDoc = shallowClone(subDoc)), childOut === void 0 ? (subDoc = removeChild(subDoc, keyRaw), typeof key == "number" && listOff++) : subDoc[keyRaw] = childOut), w2.ascend();
|
|
1104
|
-
}
|
|
1105
|
-
return c && (c.r !== void 0 ? (w2.write("r", deepClone_js_1.default(subDoc)), subDoc = void 0) : c.p != null && (subDoc = void 0)), subDoc;
|
|
1106
|
-
}, "traversePick");
|
|
1107
|
-
return traversePick(r, w, doc), w.get(), hasEdits && (w.reset(), (/* @__PURE__ */ __name(function traverseDrop(rPick, rDrop, w2, subDoc, isLiteral) {
|
|
1108
|
-
const c = rDrop.getComponent();
|
|
1109
|
-
if (c) {
|
|
1110
|
-
c.i !== void 0 ? (subDoc = c.i, isLiteral = !0) : c.d != null && (subDoc = heldDoc[c.d], rPick = heldPick[c.d], isLiteral = !1, c.d);
|
|
1111
|
-
let t = getEditType(c);
|
|
1112
|
-
if (t && t.makeInvertible) {
|
|
1113
|
-
const edit = getEdit(c);
|
|
1114
|
-
writeEdit(w2, t, t.makeInvertible(edit, subDoc), !0);
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
let pickOff = 0, dropOff = 0;
|
|
1118
|
-
const ap = cursor_js_1.advancer(rPick, (k, c2) => hasPick(c2) ? pickOff - k - 1 : k - pickOff, (k, c2) => {
|
|
1119
|
-
hasPick(c2) && pickOff++;
|
|
1120
|
-
});
|
|
1121
|
-
for (const key of rDrop) if (typeof key == "number") {
|
|
1122
|
-
const mid = key - dropOff, _rPick = ap(mid), raw = mid + pickOff, child = maybeGetChild(subDoc, isLiteral ? mid : raw);
|
|
1123
|
-
w2.descend(key), traverseDrop(_rPick, rDrop, w2, child, isLiteral), hasDrop(rDrop.getComponent()) && dropOff++, w2.ascend();
|
|
1124
|
-
} else {
|
|
1125
|
-
const child = maybeGetChild(subDoc, key);
|
|
1126
|
-
w2.descend(key), traverseDrop(ap(key), rDrop, w2, child, isLiteral), w2.ascend();
|
|
1127
|
-
}
|
|
1128
|
-
ap.end();
|
|
1129
|
-
}, "traverseDrop"))(r.clone(), r, w, doc, !1)), w.get();
|
|
1130
|
-
}
|
|
1131
|
-
__name(makeInvertible, "makeInvertible");
|
|
1132
|
-
function invertWithDoc(op, doc) {
|
|
1133
|
-
return invert(makeInvertible(op, doc));
|
|
1134
|
-
}
|
|
1135
|
-
__name(invertWithDoc, "invertWithDoc");
|
|
1136
|
-
const shallowCloneOp = /* @__PURE__ */ __name((op) => {
|
|
1137
|
-
if (op == null) return null;
|
|
1138
|
-
const result = op.slice();
|
|
1139
|
-
for (let i = 0; i < op.length; i++) {
|
|
1140
|
-
const c = result[i];
|
|
1141
|
-
Array.isArray(c) && (result[i] = shallowCloneOp(c));
|
|
1142
|
-
}
|
|
1143
|
-
return result;
|
|
1144
|
-
}, "shallowCloneOp");
|
|
1145
|
-
function tryTransform(op1, op2, direction) {
|
|
1146
|
-
assert(direction === "left" || direction === "right", "Direction must be left or right");
|
|
1147
|
-
const side = direction === "left" ? 0 : 1;
|
|
1148
|
-
if (op2 == null) return {
|
|
1149
|
-
ok: !0,
|
|
1150
|
-
result: op1
|
|
1151
|
-
};
|
|
1152
|
-
checkValidOp(op1), checkValidOp(op2);
|
|
1153
|
-
let conflict = null;
|
|
1154
|
-
const heldOp1PickByOp1 = [], heldOp1DropByOp1 = [], heldOp2PickByOp2 = [], heldOp2DropByOp2 = [], heldOp1PickByOp2 = [], heldOp2PickByOp1 = [], heldOp2DropByOp1 = [], heldOp2RmForOp1 = [], heldOp1RmForOp2 = [], cancelledOp2 = [], discardedOp2Drop = [], heldPickWrites = [], heldDropWrites = [], op1PickAtOp2Pick = [], op1PicksOp2DropSlots = [];
|
|
1155
|
-
let nextSlot = 0;
|
|
1156
|
-
const r1 = cursor_js_1.readCursor(op1), r2 = cursor_js_1.readCursor(op2), w = cursor_js_1.writeCursor();
|
|
1157
|
-
if ((/* @__PURE__ */ __name(function scanOp2Pick(r2Pick, r1Pick = null, removed1) {
|
|
1158
|
-
const c1 = getComponent(r1Pick);
|
|
1159
|
-
c1 && (c1.r !== void 0 ? removed1 = r1Pick.clone() : c1.p != null && (removed1 = null, heldOp2PickByOp1[c1.p] = r2Pick.clone()));
|
|
1160
|
-
const c2 = r2Pick.getComponent();
|
|
1161
|
-
let slot2;
|
|
1162
|
-
c2 && (slot2 = c2.p) != null && (heldOp1PickByOp2[slot2] = r1Pick ? r1Pick.clone() : null, heldOp2PickByOp2[slot2] = r2Pick.clone(), removed1 && (cancelledOp2[slot2] = !0, heldOp1RmForOp2[slot2] = removed1), c1 && c1.p != null && (op1PickAtOp2Pick[slot2] = c1.p));
|
|
1163
|
-
const ap1 = cursor_js_1.advancer(r1Pick);
|
|
1164
|
-
for (const key of r2Pick) scanOp2Pick(r2Pick, ap1(key), removed1);
|
|
1165
|
-
ap1.end();
|
|
1166
|
-
}, "scanOp2Pick"))(r2, r1, null), (/* @__PURE__ */ __name(function scanOp2Drop(r1Pick, r2Pick, r2Drop, pickSlot1, removed1) {
|
|
1167
|
-
const c2d = r2Drop.getComponent();
|
|
1168
|
-
let slot2, droppedHere = !1;
|
|
1169
|
-
c2d && ((slot2 = c2d.d) != null ? (heldOp2DropByOp2[slot2] = r2Drop.clone(), pickSlot1 != null && (op1PicksOp2DropSlots[pickSlot1] == null && (op1PicksOp2DropSlots[pickSlot1] = []), op1PicksOp2DropSlots[pickSlot1].push(slot2)), r1Pick = heldOp1PickByOp2[slot2] || null, r2Pick = heldOp2PickByOp2[slot2] || null, cancelledOp2[slot2] ? (removed1 && (discardedOp2Drop[slot2] = !0), removed1 = heldOp1RmForOp2[slot2] || null) : !removed1 || side !== 1 && op1PickAtOp2Pick[slot2] != null || conflict == null && (conflict = {
|
|
1170
|
-
type: types_js_1.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
1171
|
-
op1: exports.removeOp(removed1.getPath()),
|
|
1172
|
-
op2: exports.moveOp(r2Pick.getPath(), r2Drop.getPath())
|
|
1173
|
-
}), droppedHere = !0) : c2d.i !== void 0 && (r1Pick = r2Pick = null, droppedHere = !0, removed1 && conflict == null && (conflict = {
|
|
1174
|
-
type: types_js_1.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
1175
|
-
op1: exports.removeOp(removed1.getPath()),
|
|
1176
|
-
op2: exports.insertOp(r2Drop.getPath(), c2d.i)
|
|
1177
|
-
})));
|
|
1178
|
-
const c1p = getComponent(r1Pick);
|
|
1179
|
-
c1p && (c1p.r !== void 0 ? removed1 = r1Pick.clone() : c1p.p != null && (c1p.p, pickSlot1 = c1p.p, removed1 = null));
|
|
1180
|
-
const t2 = getEditType(c2d);
|
|
1181
|
-
t2 && removed1 && conflict == null && (conflict = {
|
|
1182
|
-
type: types_js_1.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
1183
|
-
op1: exports.removeOp(removed1.getPath()),
|
|
1184
|
-
op2: exports.editOp(r2Drop.getPath(), t2, getEdit(c2d), !0)
|
|
1185
|
-
});
|
|
1186
|
-
let p2PickOff = 0, p2DropOff = 0;
|
|
1187
|
-
const ap2 = cursor_js_1.advancer(r2Pick, (k, c) => hasPick(c) ? p2PickOff - k - 1 : k - p2PickOff, (k, c) => {
|
|
1188
|
-
hasPick(c) && p2PickOff++;
|
|
1189
|
-
}), ap1 = cursor_js_1.advancer(r1Pick);
|
|
1190
|
-
for (const key of r2Drop) if (typeof key == "number") {
|
|
1191
|
-
const p2Mid = key - p2DropOff, _p2Pick = ap2(p2Mid);
|
|
1192
|
-
p2DropOff += +scanOp2Drop(ap1(p2Mid + p2PickOff), _p2Pick, r2Drop, pickSlot1, removed1);
|
|
1193
|
-
} else {
|
|
1194
|
-
const _p2Pick = ap2(key);
|
|
1195
|
-
scanOp2Drop(ap1(key), _p2Pick, r2Drop, pickSlot1, removed1);
|
|
1196
|
-
}
|
|
1197
|
-
return ap2.end(), ap1.end(), droppedHere;
|
|
1198
|
-
}, "scanOp2Drop"))(r1, r2, r2.clone(), null, null), heldOp2DropByOp2.map((x) => x && x.get()), conflict) return {
|
|
1199
|
-
ok: !1,
|
|
1200
|
-
conflict
|
|
1201
|
-
};
|
|
1202
|
-
discardedOp2Drop.map((x) => !!x);
|
|
1203
|
-
const pickComponents = [];
|
|
1204
|
-
let cancelledRemoves = null;
|
|
1205
|
-
(/* @__PURE__ */ __name(function writeOp1Pick(r1Pick, r2Pick, r2Drop, w2, removed2) {
|
|
1206
|
-
let iAmMoved = !1;
|
|
1207
|
-
const c2p = getComponent(r2Pick);
|
|
1208
|
-
if (hasPick(c2p)) {
|
|
1209
|
-
const slot2 = c2p.p;
|
|
1210
|
-
slot2 != null ? (r2Drop = heldOp2DropByOp2[slot2], w2 = heldPickWrites[slot2] = cursor_js_1.writeCursor(), iAmMoved = !0, removed2 = null) : (r2Drop = null, removed2 = r2Pick.clone());
|
|
1211
|
-
} else hasDrop(getComponent(r2Drop)) && (r2Drop = null);
|
|
1212
|
-
const c1 = r1Pick.getComponent();
|
|
1213
|
-
if (c1) {
|
|
1214
|
-
const slot1 = c1.p;
|
|
1215
|
-
slot1 != null ? (removed2 && (heldOp2RmForOp1[slot1] = removed2), pickComponents[slot1] = removed2 || side === 1 && iAmMoved ? null : w2.getComponent(), heldOp1PickByOp1[slot1] = r1Pick.clone(), r2Drop && (heldOp2DropByOp1[slot1] = r2Drop.clone())) : c1.r !== void 0 && (removed2 || w2.write("r", !0), (removed2 || iAmMoved) && (cancelledRemoves == null && (cancelledRemoves = /* @__PURE__ */ new Set()), cancelledRemoves.add(c1)));
|
|
1216
|
-
}
|
|
1217
|
-
let p2PickOff = 0, p2DropOff = 0;
|
|
1218
|
-
const ap2Pick = cursor_js_1.advancer(r2Pick, void 0, (k, c) => {
|
|
1219
|
-
hasPick(c) && p2PickOff++;
|
|
1220
|
-
}), ap2Drop = cursor_js_1.advancer(r2Drop, (k, c) => hasDrop(c) ? ~(k - p2DropOff) : k - p2DropOff, (k, c) => {
|
|
1221
|
-
hasDrop(c) && p2DropOff++;
|
|
1222
|
-
});
|
|
1223
|
-
if (r1Pick) for (const key of r1Pick) if (typeof key == "string") {
|
|
1224
|
-
const p2Pick_ = ap2Pick(key), p2Drop_ = ap2Drop(key);
|
|
1225
|
-
w2.descend(key), writeOp1Pick(r1Pick, p2Pick_, p2Drop_, w2, removed2), w2.ascend();
|
|
1226
|
-
} else {
|
|
1227
|
-
const p2Pick_ = ap2Pick(key), p2Mid = key - p2PickOff, p2Drop_ = hasPick(getComponent(p2Pick_)) ? null : ap2Drop(p2Mid), finalKey = p2Mid + p2DropOff;
|
|
1228
|
-
assert(finalKey >= 0), w2.descend(finalKey), writeOp1Pick(r1Pick, p2Pick_, p2Drop_, w2, removed2), w2.ascend();
|
|
1229
|
-
}
|
|
1230
|
-
ap2Pick.end(), ap2Drop.end();
|
|
1231
|
-
}, "writeOp1Pick"))(r1, r2, r2.clone(), w, null), w.reset();
|
|
1232
|
-
let outputSlotMap = [];
|
|
1233
|
-
if ((/* @__PURE__ */ __name(function writeOp1Drop(p1Pick, p1Drop, p2Pick, p2Drop, w2, removed2) {
|
|
1234
|
-
assert(p1Drop);
|
|
1235
|
-
const c1d = p1Drop.getComponent();
|
|
1236
|
-
let c2d = getComponent(p2Drop), droppedHere = !1;
|
|
1237
|
-
const insOrMv = /* @__PURE__ */ __name((r12, r22, c) => r12 ? exports.moveOp(r12.getPath(), r22.getPath()) : exports.insertOp(r22.getPath(), c.i), "insOrMv");
|
|
1238
|
-
if (hasDrop(c1d)) {
|
|
1239
|
-
const slot1 = c1d.d;
|
|
1240
|
-
slot1 != null && (heldOp1DropByOp1[slot1] = p1Drop.clone());
|
|
1241
|
-
const pc = slot1 != null ? pickComponents[slot1] : null;
|
|
1242
|
-
let identical = !1;
|
|
1243
|
-
if (c1d.i !== void 0 || slot1 != null && pc) {
|
|
1244
|
-
let slot2;
|
|
1245
|
-
c2d && (c2d.i !== void 0 || (slot2 = c2d.d) != null && !cancelledOp2[slot2]) && (identical = slot2 != null ? slot1 != null && slot1 === op1PickAtOp2Pick[slot2] : deepEqual_js_1.default(c2d.i, c1d.i), identical || slot2 != null && side !== 1 && op1PickAtOp2Pick[slot2] != null || conflict == null && (conflict = {
|
|
1246
|
-
type: types_js_1.ConflictType.DROP_COLLISION,
|
|
1247
|
-
op1: insOrMv(slot1 != null ? heldOp1PickByOp1[slot1] : null, p1Drop, c1d),
|
|
1248
|
-
op2: insOrMv(slot2 != null ? heldOp2PickByOp2[slot2] : null, p2Drop, c2d)
|
|
1249
|
-
})), identical || (removed2 ? conflict == null && (conflict = {
|
|
1250
|
-
type: types_js_1.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
1251
|
-
op1: insOrMv(slot1 != null ? heldOp1PickByOp1[slot1] : null, p1Drop, c1d),
|
|
1252
|
-
op2: exports.removeOp(removed2.getPath())
|
|
1253
|
-
}) : (slot1 != null ? (outputSlotMap[nextSlot] = slot1, w2.write("d", pc.p = nextSlot++)) : w2.write("i", deepClone_js_1.default(c1d.i)), droppedHere = !0));
|
|
1254
|
-
} else if (slot1 != null && !pc) {
|
|
1255
|
-
const h = heldOp2RmForOp1[slot1];
|
|
1256
|
-
h && (removed2 = h.clone());
|
|
1257
|
-
}
|
|
1258
|
-
slot1 != null ? (p1Pick = heldOp1PickByOp1[slot1], p2Pick = heldOp2PickByOp1[slot1], p2Drop = heldOp2DropByOp1[slot1]) : c1d.i !== void 0 && (p1Pick = p2Pick = null, identical || (p2Drop = null));
|
|
1259
|
-
} else hasPick(getComponent(p1Pick)) && (p1Pick = p2Pick = p2Drop = null);
|
|
1260
|
-
const c1p = getComponent(p1Pick), c2p = getComponent(p2Pick);
|
|
1261
|
-
if (hasPick(c2p)) {
|
|
1262
|
-
const slot2 = c2p.p;
|
|
1263
|
-
c2p.r !== void 0 && (!c1p || c1p.r === void 0) || cancelledOp2[slot2] ? (p2Drop = null, removed2 = p2Pick.clone()) : slot2 != null && (p2Drop = heldOp2DropByOp2[slot2], side !== 1 && op1PickAtOp2Pick[slot2] != null || ((w2 = heldDropWrites[slot2]) || (w2 = heldDropWrites[slot2] = cursor_js_1.writeCursor()), w2.reset(), removed2 = null));
|
|
1264
|
-
} else !hasDrop(c1d) && hasDrop(c2d) && (p2Drop = null);
|
|
1265
|
-
c2d = p2Drop != null ? p2Drop.getComponent() : null;
|
|
1266
|
-
const t1 = getEditType(c1d);
|
|
1267
|
-
if (t1) {
|
|
1268
|
-
const e1 = getEdit(c1d);
|
|
1269
|
-
if (removed2) conflict == null && (conflict = {
|
|
1270
|
-
type: types_js_1.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
1271
|
-
op1: exports.editOp(p1Drop.getPath(), t1, e1, !0),
|
|
1272
|
-
op2: exports.removeOp(removed2.getPath())
|
|
1273
|
-
});
|
|
1274
|
-
else {
|
|
1275
|
-
const t2 = getEditType(c2d);
|
|
1276
|
-
let e;
|
|
1277
|
-
if (t2) {
|
|
1278
|
-
if (t1 !== t2) throw Error("Transforming incompatible types");
|
|
1279
|
-
const e2 = getEdit(c2d);
|
|
1280
|
-
e = t1.transform(e1, e2, direction);
|
|
1281
|
-
} else e = deepClone_js_1.default(e1);
|
|
1282
|
-
writeEdit(w2, t1, e);
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
let p1PickOff = 0, p1DropOff = 0, p2PickOff = 0, p2DropOff = 0, outPickOff = 0, outDropOff = 0, p1pValid = p1Pick != null && p1Pick.descendFirst(), p1pDidDescend = p1pValid;
|
|
1286
|
-
const ap2p = cursor_js_1.advancer(p2Pick, void 0, (k, c) => {
|
|
1287
|
-
hasPick(c) && p2PickOff++;
|
|
1288
|
-
});
|
|
1289
|
-
let p2dValid = p2Drop != null && p2Drop.descendFirst(), p2dDidDescend = p2dValid;
|
|
1290
|
-
for (const key of p1Drop) if (typeof key == "number") {
|
|
1291
|
-
let _p1Pick;
|
|
1292
|
-
const hd1 = hasDrop(p1Drop.getComponent()), k1Mid = key - p1DropOff;
|
|
1293
|
-
{
|
|
1294
|
-
let p1k;
|
|
1295
|
-
for (; p1pValid && typeof (p1k = p1Pick.getKey()) == "number"; ) {
|
|
1296
|
-
p1k += p1PickOff;
|
|
1297
|
-
const c = p1Pick.getComponent(), hp = hasPick(c);
|
|
1298
|
-
if (p1k > k1Mid || p1k === k1Mid && (!hp || side === 0 && hd1)) break;
|
|
1299
|
-
if (hp) {
|
|
1300
|
-
p1PickOff--;
|
|
1301
|
-
const slot1 = c.p;
|
|
1302
|
-
op1PickAtOp2Pick.includes(slot1), c.d, getComponent(heldDropWrites[c.d]), hasPick(getComponent(heldDropWrites[c.d])), (c.r === void 0 || cancelledRemoves && cancelledRemoves.has(c)) && (slot1 == null || !pickComponents[slot1] || side !== 1 && op1PickAtOp2Pick.includes(slot1)) || outPickOff--;
|
|
1303
|
-
}
|
|
1304
|
-
p1pValid = p1Pick.nextSibling();
|
|
1305
|
-
}
|
|
1306
|
-
_p1Pick = p1pValid && p1k === k1Mid ? p1Pick : null;
|
|
1307
|
-
}
|
|
1308
|
-
const raw = k1Mid - p1PickOff;
|
|
1309
|
-
let _p2Pick = ap2p(raw);
|
|
1310
|
-
const k2Mid = raw - p2PickOff;
|
|
1311
|
-
let _p2Drop = null;
|
|
1312
|
-
{
|
|
1313
|
-
let p2dk, op2Mid;
|
|
1314
|
-
for (; p2dValid && typeof (p2dk = p2Drop.getKey()) == "number"; ) {
|
|
1315
|
-
op2Mid = p2dk - p2DropOff;
|
|
1316
|
-
const c = p2Drop.getComponent(), hd2 = hasDrop(c);
|
|
1317
|
-
if (op2Mid > k2Mid) break;
|
|
1318
|
-
if (op2Mid === k2Mid) {
|
|
1319
|
-
if (!hd2) {
|
|
1320
|
-
_p2Drop = p2Drop;
|
|
1321
|
-
break;
|
|
1322
|
-
}
|
|
1323
|
-
{
|
|
1324
|
-
if (side === 0 && hd1) {
|
|
1325
|
-
_p2Drop = p2Drop;
|
|
1326
|
-
break;
|
|
1327
|
-
}
|
|
1328
|
-
const hp2 = _p2Pick && hasPick(_p2Pick.getComponent());
|
|
1329
|
-
if (side === 0 && hp2) break;
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
if (hd2) {
|
|
1333
|
-
const slot2 = c.d;
|
|
1334
|
-
op1PickAtOp2Pick[slot2], c.i === void 0 && (cancelledOp2[slot2] || op1PickAtOp2Pick[slot2] != null && side !== 1) ? (cancelledOp2[slot2] || op1PickAtOp2Pick[slot2] != null && side === 0) && (p2DropOff++, outDropOff--) : p2DropOff++;
|
|
1335
|
-
}
|
|
1336
|
-
p2dValid = p2Drop.nextSibling();
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
const descend = k2Mid + p2DropOff + outPickOff + outDropOff;
|
|
1340
|
-
assert(descend >= 0, "trying to descend to a negative index"), w2.descend(descend), hd1 && (_p1Pick = _p2Pick = _p2Drop = null, p1DropOff++), writeOp1Drop(_p1Pick, p1Drop, _p2Pick, _p2Drop, w2, removed2) && outDropOff++, w2.ascend();
|
|
1341
|
-
} else {
|
|
1342
|
-
let p1k;
|
|
1343
|
-
for (; p1pValid && (p1k = p1Pick.getKey(), typeof p1k != "string" || !(p1k > key || p1k === key)); ) p1pValid = p1Pick.nextSibling();
|
|
1344
|
-
const _p1Pick = p1pValid && p1k === key ? p1Pick : null, _p2Pick = ap2p(key);
|
|
1345
|
-
let p2dk;
|
|
1346
|
-
for (; p2dValid && (p2dk = p2Drop.getKey(), typeof p2dk != "string" || !(p2dk > key || p2dk === key)); ) p2dValid = p2Drop.nextSibling();
|
|
1347
|
-
const _p2Drop = p2dValid && p2dk === key ? p2Drop : null;
|
|
1348
|
-
w2.descend(key), writeOp1Drop(_p1Pick, p1Drop, _p2Pick, _p2Drop, w2, removed2), w2.ascend();
|
|
1349
|
-
}
|
|
1350
|
-
return ap2p.end(), p1pDidDescend && p1Pick.ascend(), p2dDidDescend && p2Drop.ascend(), droppedHere;
|
|
1351
|
-
}, "writeOp1Drop"))(r1, r1.clone(), r2, r2.clone(), w, null), conflict) return {
|
|
1352
|
-
ok: !1,
|
|
1353
|
-
conflict
|
|
1354
|
-
};
|
|
1355
|
-
w.reset();
|
|
1356
|
-
const eachDrop = /* @__PURE__ */ __name((r, w2, fn) => r.traverse(w2, (c, w3) => {
|
|
1357
|
-
c.d != null && fn(c.d, r, w3);
|
|
1358
|
-
}), "eachDrop");
|
|
1359
|
-
(cancelledOp2.length || heldPickWrites.length) && (eachDrop(r2, w, (slot2, r, w2) => {
|
|
1360
|
-
cancelledOp2[slot2] && !discardedOp2Drop[slot2] && w2.write("r", !0), heldPickWrites[slot2] && w2.mergeTree(heldPickWrites[slot2].get());
|
|
1361
|
-
}), w.reset());
|
|
1362
|
-
const heldOutDropRead = [], heldOutDropWrites = [];
|
|
1363
|
-
if ((heldDropWrites.length || cancelledOp2.length) && !conflict) {
|
|
1364
|
-
const rOut = cursor_js_1.readCursor(shallowCloneOp(w.get()));
|
|
1365
|
-
if (eachDrop(rOut, null, (slotOut, r) => {
|
|
1366
|
-
heldOutDropRead[slotOut] = r.clone();
|
|
1367
|
-
}), heldDropWrites.forEach((hdw) => {
|
|
1368
|
-
hdw && eachDrop(cursor_js_1.readCursor(hdw.get()), null, (slotOut, r) => {
|
|
1369
|
-
heldOutDropRead[slotOut] = r.clone();
|
|
1370
|
-
});
|
|
1371
|
-
}), (/* @__PURE__ */ __name(function writeHeldOp2Drop(p2Drop, outPick, outDrop, w2, parentC, removedOut) {
|
|
1372
|
-
const coutp = getComponent(outPick);
|
|
1373
|
-
if (coutp && hasPick(coutp)) if (coutp.p != null) {
|
|
1374
|
-
const slot = coutp.p;
|
|
1375
|
-
heldOutDropRead[slot].getPath(), outDrop = heldOutDropRead[slot], w2 = heldOutDropWrites[slot] = cursor_js_1.writeCursor();
|
|
1376
|
-
} else coutp.r !== void 0 && (outDrop = null);
|
|
1377
|
-
else hasDrop(getComponent(outDrop)) && (outDrop = null);
|
|
1378
|
-
const c2 = p2Drop.getComponent();
|
|
1379
|
-
if (c2) {
|
|
1380
|
-
let slot2;
|
|
1381
|
-
if ((slot2 = c2.d) != null) {
|
|
1382
|
-
const _w = heldDropWrites[slot2];
|
|
1383
|
-
_w && (_w.get(), w2.mergeTree(_w.get()), outDrop = cursor_js_1.readCursor(_w.get()));
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
let outPickOff = 0, outDropOff = 0;
|
|
1387
|
-
const oPickAdv = cursor_js_1.advancer(outPick, void 0, (k, c) => {
|
|
1388
|
-
hasPick(c) && outPickOff--;
|
|
1389
|
-
}), oDropAdv = cursor_js_1.advancer(outDrop, (k, c) => hasDrop(c) ? -(k - outDropOff) - 1 : k - outDropOff, (k, c) => {
|
|
1390
|
-
hasDrop(c) && outDropOff++;
|
|
1391
|
-
});
|
|
1392
|
-
for (const o2dk of p2Drop) if (typeof o2dk == "number") {
|
|
1393
|
-
const _outPick = oPickAdv(o2dk), rmid = o2dk + outPickOff, _outDrop = oDropAdv(rmid), rfinal = rmid + outDropOff;
|
|
1394
|
-
w2.descend(rfinal), writeHeldOp2Drop(p2Drop, _outPick, _outDrop, w2), w2.ascend();
|
|
1395
|
-
} else w2.descend(o2dk), writeHeldOp2Drop(p2Drop, oPickAdv(o2dk), oDropAdv(o2dk), w2), w2.ascend();
|
|
1396
|
-
oPickAdv.end(), oDropAdv.end();
|
|
1397
|
-
}, "writeHeldOp2Drop"))(r2, rOut, rOut.clone(), w), w.reset(), conflict) return {
|
|
1398
|
-
ok: !1,
|
|
1399
|
-
conflict
|
|
1400
|
-
};
|
|
1401
|
-
if (w.get(), heldOutDropWrites.length) {
|
|
1402
|
-
const heldOutDropContent = heldOutDropWrites.map((w2) => w2 ? w2.get() : null), rOut2 = cursor_js_1.readCursor(shallowCloneOp(w.get()));
|
|
1403
|
-
if (eachDrop(rOut2, w, (slotOut, r, w2) => {
|
|
1404
|
-
const data = heldOutDropContent[slotOut];
|
|
1405
|
-
data && (w2.mergeTree(data), heldOutDropContent[slotOut] = null);
|
|
1406
|
-
}), heldOutDropContent.find((x) => x)) {
|
|
1407
|
-
const w1 = cursor_js_1.writeCursor(), w2 = cursor_js_1.writeCursor();
|
|
1408
|
-
let nextSlot1 = 0, nextSlot2 = 0;
|
|
1409
|
-
heldOutDropContent.forEach((data) => {
|
|
1410
|
-
data != null && eachDrop(cursor_js_1.readCursor(data), null, (c) => {
|
|
1411
|
-
const slot1 = outputSlotMap[c];
|
|
1412
|
-
w1.writeMove(heldOp1PickByOp1[slot1].getPath(), heldOp1DropByOp1[slot1].getPath(), nextSlot1++);
|
|
1413
|
-
const slot2s = op1PicksOp2DropSlots[slot1];
|
|
1414
|
-
slot2s && slot2s.forEach((slot2) => {
|
|
1415
|
-
cancelledOp2[slot2] || side !== 1 && op1PickAtOp2Pick[slot2] != null || w2.writeMove(heldOp2PickByOp2[slot2].getPath(), heldOp2DropByOp2[slot2].getPath(), nextSlot2++);
|
|
1416
|
-
});
|
|
1417
|
-
});
|
|
1418
|
-
}), conflict = {
|
|
1419
|
-
type: types_js_1.ConflictType.BLACKHOLE,
|
|
1420
|
-
op1: w1.get(),
|
|
1421
|
-
op2: w2.get()
|
|
1422
|
-
};
|
|
1423
|
-
}
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
return conflict ? {
|
|
1427
|
-
ok: !1,
|
|
1428
|
-
conflict
|
|
1429
|
-
} : {
|
|
1430
|
-
ok: !0,
|
|
1431
|
-
result: w.get()
|
|
1432
|
-
};
|
|
1433
|
-
}
|
|
1434
|
-
__name(tryTransform, "tryTransform");
|
|
1435
|
-
const throwConflictErr = /* @__PURE__ */ __name((conflict) => {
|
|
1436
|
-
const err = new Error("Transform detected write conflict");
|
|
1437
|
-
throw err.conflict = conflict, err.type = err.name = "writeConflict", err;
|
|
1438
|
-
}, "throwConflictErr");
|
|
1439
|
-
function transform(op1, op2, side) {
|
|
1440
|
-
const res = tryTransform(op1, op2, side);
|
|
1441
|
-
if (res.ok) return res.result;
|
|
1442
|
-
throwConflictErr(res.conflict);
|
|
1443
|
-
}
|
|
1444
|
-
__name(transform, "transform");
|
|
1445
|
-
const opThatRemovesDE = /* @__PURE__ */ __name((op) => {
|
|
1446
|
-
const w = cursor_js_1.writeCursor();
|
|
1447
|
-
return cursor_js_1.readCursor(op).traverse(w, (c, w2) => {
|
|
1448
|
-
(hasDrop(c) || getEditType(c)) && w2.write("r", !0);
|
|
1449
|
-
}), w.get();
|
|
1450
|
-
}, "opThatRemovesDE"), resolveConflict = /* @__PURE__ */ __name((conflict, side) => {
|
|
1451
|
-
const { type: type2, op1, op2 } = conflict;
|
|
1452
|
-
switch (type2) {
|
|
1453
|
-
case types_js_1.ConflictType.DROP_COLLISION:
|
|
1454
|
-
return side === "left" ? [null, opThatRemovesDE(op2)] : [opThatRemovesDE(op1), null];
|
|
1455
|
-
case types_js_1.ConflictType.RM_UNEXPECTED_CONTENT:
|
|
1456
|
-
let op1HasRemove = !1;
|
|
1457
|
-
return cursor_js_1.readCursor(op1).traverse(null, (c) => {
|
|
1458
|
-
c.r !== void 0 && (op1HasRemove = !0);
|
|
1459
|
-
}), op1HasRemove ? [null, opThatRemovesDE(op2)] : [opThatRemovesDE(op1), null];
|
|
1460
|
-
case types_js_1.ConflictType.BLACKHOLE:
|
|
1461
|
-
return [opThatRemovesDE(op1), opThatRemovesDE(op2)];
|
|
1462
|
-
default:
|
|
1463
|
-
throw Error("Unrecognised conflict: " + type2);
|
|
1464
|
-
}
|
|
1465
|
-
}, "resolveConflict");
|
|
1466
|
-
function transformWithConflictsPred(allowConflict, op1, op2, side) {
|
|
1467
|
-
let r2Aggregate = null;
|
|
1468
|
-
for (; ; ) {
|
|
1469
|
-
const res = tryTransform(op1, op2, side);
|
|
1470
|
-
if (res.ok) return compose(r2Aggregate, res.result);
|
|
1471
|
-
{
|
|
1472
|
-
const { conflict } = res;
|
|
1473
|
-
allowConflict(conflict) || throwConflictErr(conflict);
|
|
1474
|
-
const [r1, r2] = resolveConflict(conflict, side);
|
|
1475
|
-
op1 = compose(normalize(op1), r1), op2 = compose(normalize(op2), r2), r2Aggregate = compose(r2Aggregate, r2);
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
__name(transformWithConflictsPred, "transformWithConflictsPred");
|
|
1480
|
-
})(json1_release);
|
|
1481
|
-
(function(exports) {
|
|
1482
|
-
var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
1483
|
-
k2 === void 0 && (k2 = k), Object.defineProperty(o, k2, { enumerable: !0, get: /* @__PURE__ */ __name(function() {
|
|
1484
|
-
return m[k];
|
|
1485
|
-
}, "get") });
|
|
1486
|
-
} : function(o, m, k, k2) {
|
|
1487
|
-
k2 === void 0 && (k2 = k), o[k2] = m[k];
|
|
1488
|
-
}), __exportStar = commonjsGlobal && commonjsGlobal.__exportStar || function(m, exports2) {
|
|
1489
|
-
for (var p in m) p !== "default" && !exports2.hasOwnProperty(p) && __createBinding(exports2, m, p);
|
|
1490
|
-
};
|
|
1491
|
-
Object.defineProperty(exports, "__esModule", { value: !0 }), __exportStar(json1_release, exports);
|
|
1492
|
-
var cursor_js_1 = cursor;
|
|
1493
|
-
Object.defineProperty(exports, "ReadCursor", { enumerable: !0, get: /* @__PURE__ */ __name(function() {
|
|
1494
|
-
return cursor_js_1.ReadCursor;
|
|
1495
|
-
}, "get") }), Object.defineProperty(exports, "WriteCursor", { enumerable: !0, get: /* @__PURE__ */ __name(function() {
|
|
1496
|
-
return cursor_js_1.WriteCursor;
|
|
1497
|
-
}, "get") });
|
|
1498
|
-
var types_1 = types;
|
|
1499
|
-
Object.defineProperty(exports, "ConflictType", { enumerable: !0, get: /* @__PURE__ */ __name(function() {
|
|
1500
|
-
return types_1.ConflictType;
|
|
1501
|
-
}, "get") });
|
|
1502
|
-
})(dist$1);
|
|
1503
|
-
const _UnitDrawingService = class _UnitDrawingService {
|
|
1504
|
-
constructor() {
|
|
1505
|
-
__publicField(this, "drawingManagerData", {});
|
|
1506
|
-
__publicField(this, "_oldDrawingManagerData", {});
|
|
1507
|
-
__publicField(this, "_focusDrawings", []);
|
|
1508
|
-
__publicField(this, "_remove$", new Subject());
|
|
1509
|
-
__publicField(this, "remove$", this._remove$.asObservable());
|
|
1510
|
-
__publicField(this, "_add$", new Subject());
|
|
1511
|
-
__publicField(this, "add$", this._add$.asObservable());
|
|
1512
|
-
__publicField(this, "_update$", new Subject());
|
|
1513
|
-
__publicField(this, "update$", this._update$.asObservable());
|
|
1514
|
-
__publicField(this, "_order$", new Subject());
|
|
1515
|
-
__publicField(this, "order$", this._order$.asObservable());
|
|
1516
|
-
__publicField(this, "_group$", new Subject());
|
|
1517
|
-
__publicField(this, "group$", this._group$.asObservable());
|
|
1518
|
-
__publicField(this, "_ungroup$", new Subject());
|
|
1519
|
-
__publicField(this, "ungroup$", this._ungroup$.asObservable());
|
|
1520
|
-
__publicField(this, "_refreshTransform$", new Subject());
|
|
1521
|
-
__publicField(this, "refreshTransform$", this._refreshTransform$.asObservable());
|
|
1522
|
-
__publicField(this, "_visible$", new Subject());
|
|
1523
|
-
__publicField(this, "visible$", this._visible$.asObservable());
|
|
1524
|
-
// private readonly _externalUpdate$ = new Subject<T[]>();
|
|
1525
|
-
// readonly externalUpdate$ = this._externalUpdate$.asObservable();
|
|
1526
|
-
__publicField(this, "_focus$", new Subject());
|
|
1527
|
-
__publicField(this, "focus$", this._focus$.asObservable());
|
|
1528
|
-
__publicField(this, "_featurePluginUpdate$", new Subject());
|
|
1529
|
-
__publicField(this, "featurePluginUpdate$", this._featurePluginUpdate$.asObservable());
|
|
1530
|
-
__publicField(this, "_featurePluginAdd$", new Subject());
|
|
1531
|
-
__publicField(this, "featurePluginAdd$", this._featurePluginAdd$.asObservable());
|
|
1532
|
-
__publicField(this, "_featurePluginRemove$", new Subject());
|
|
1533
|
-
__publicField(this, "featurePluginRemove$", this._featurePluginRemove$.asObservable());
|
|
1534
|
-
__publicField(this, "_featurePluginOrderUpdate$", new Subject());
|
|
1535
|
-
__publicField(this, "featurePluginOrderUpdate$", this._featurePluginOrderUpdate$.asObservable());
|
|
1536
|
-
__publicField(this, "_featurePluginGroupUpdate$", new Subject());
|
|
1537
|
-
__publicField(this, "featurePluginGroupUpdate$", this._featurePluginGroupUpdate$.asObservable());
|
|
1538
|
-
__publicField(this, "_featurePluginUngroupUpdate$", new Subject());
|
|
1539
|
-
__publicField(this, "featurePluginUngroupUpdate$", this._featurePluginUngroupUpdate$.asObservable());
|
|
1540
|
-
__publicField(this, "_visible", !0);
|
|
1541
|
-
__publicField(this, "_editable", !0);
|
|
1542
|
-
}
|
|
1543
|
-
dispose() {
|
|
1544
|
-
this._remove$.complete(), this._add$.complete(), this._update$.complete(), this._order$.complete(), this._focus$.complete(), this._featurePluginUpdate$.complete(), this._featurePluginAdd$.complete(), this._featurePluginRemove$.complete(), this._featurePluginOrderUpdate$.complete(), this.drawingManagerData = {}, this._oldDrawingManagerData = {};
|
|
1545
|
-
}
|
|
1546
|
-
visibleNotification(visibleParams) {
|
|
1547
|
-
this._visible$.next(visibleParams);
|
|
1548
|
-
}
|
|
1549
|
-
refreshTransform(updateParams) {
|
|
1550
|
-
updateParams.forEach((updateParam) => {
|
|
1551
|
-
const param = this._getCurrentBySearch(updateParam);
|
|
1552
|
-
param != null && (param.transform = updateParam.transform, param.transforms = updateParam.transforms, param.isMultiTransform = updateParam.isMultiTransform);
|
|
1553
|
-
}), this.refreshTransformNotification(updateParams);
|
|
1554
|
-
}
|
|
1555
|
-
getDrawingDataForUnit(unitId) {
|
|
1556
|
-
return this.drawingManagerData[unitId];
|
|
1557
|
-
}
|
|
1558
|
-
removeDrawingDataForUnit(unitId) {
|
|
1559
|
-
const subUnits = this.drawingManagerData[unitId];
|
|
1560
|
-
if (subUnits == null)
|
|
1561
|
-
return;
|
|
1562
|
-
delete this.drawingManagerData[unitId];
|
|
1563
|
-
const drawings = [];
|
|
1564
|
-
Object.keys(subUnits).forEach((subUnitId) => {
|
|
1565
|
-
const subUnit = subUnits[subUnitId];
|
|
1566
|
-
(subUnit == null ? void 0 : subUnit.data) != null && Object.keys(subUnit.data).forEach((drawingId) => {
|
|
1567
|
-
drawings.push({ unitId, subUnitId, drawingId });
|
|
1568
|
-
});
|
|
1569
|
-
}), drawings.length > 0 && this.removeNotification(drawings);
|
|
1570
|
-
}
|
|
1571
|
-
registerDrawingData(unitId, data) {
|
|
1572
|
-
this.drawingManagerData[unitId] = data;
|
|
1573
|
-
}
|
|
1574
|
-
initializeNotification(unitId) {
|
|
1575
|
-
const drawings = [], data = this.drawingManagerData[unitId];
|
|
1576
|
-
data != null && (Object.keys(data).forEach((subUnitId) => {
|
|
1577
|
-
this._establishDrawingMap(unitId, subUnitId);
|
|
1578
|
-
const subUnitData = data[subUnitId];
|
|
1579
|
-
Object.keys(subUnitData.data).forEach((drawingId) => {
|
|
1580
|
-
const drawing = subUnitData.data[drawingId];
|
|
1581
|
-
drawing.unitId = unitId, drawing.subUnitId = subUnitId, drawings.push(drawing);
|
|
1582
|
-
});
|
|
1583
|
-
}), drawings.length > 0 && this.addNotification(drawings));
|
|
1584
|
-
}
|
|
1585
|
-
getDrawingData(unitId, subUnitId) {
|
|
1586
|
-
return this._getDrawingData(unitId, subUnitId);
|
|
1587
|
-
}
|
|
1588
|
-
// Use in doc only.
|
|
1589
|
-
setDrawingData(unitId, subUnitId, data) {
|
|
1590
|
-
this.drawingManagerData[unitId][subUnitId].data = data;
|
|
1591
|
-
}
|
|
1592
|
-
getBatchAddOp(insertParams) {
|
|
1593
|
-
const objects = [], ops = [], invertOps = [];
|
|
1594
|
-
insertParams.forEach((insertParam) => {
|
|
1595
|
-
const { op: op2, invertOp: invertOp2 } = this._addByParam(insertParam);
|
|
1596
|
-
objects.push({ unitId: insertParam.unitId, subUnitId: insertParam.subUnitId, drawingId: insertParam.drawingId }), ops.push(op2), invertOps.push(invertOp2);
|
|
1597
|
-
});
|
|
1598
|
-
const op = ops.reduce(dist$1.type.compose, null), invertOp = invertOps.reduce(dist$1.type.compose, null), { unitId, subUnitId } = insertParams[0];
|
|
1599
|
-
return { undo: invertOp, redo: op, unitId, subUnitId, objects };
|
|
1600
|
-
}
|
|
1601
|
-
getBatchRemoveOp(removeParams) {
|
|
1602
|
-
const ops = [], invertOps = [];
|
|
1603
|
-
removeParams.forEach((removeParam) => {
|
|
1604
|
-
const { op: op2, invertOp: invertOp2 } = this._removeByParam(removeParam);
|
|
1605
|
-
ops.unshift(op2), invertOps.push(invertOp2);
|
|
1606
|
-
});
|
|
1607
|
-
const op = ops.reduce(dist$1.type.compose, null), invertOp = invertOps.reduce(dist$1.type.compose, null), { unitId, subUnitId } = removeParams[0];
|
|
1608
|
-
return { undo: invertOp, redo: op, unitId, subUnitId, objects: removeParams };
|
|
1609
|
-
}
|
|
1610
|
-
getBatchUpdateOp(updateParams) {
|
|
1611
|
-
const objects = [], ops = [], invertOps = [];
|
|
1612
|
-
updateParams.forEach((updateParam) => {
|
|
1613
|
-
const { op: op2, invertOp: invertOp2 } = this._updateByParam(updateParam);
|
|
1614
|
-
objects.push({ unitId: updateParam.unitId, subUnitId: updateParam.subUnitId, drawingId: updateParam.drawingId }), ops.push(op2), invertOps.push(invertOp2);
|
|
1615
|
-
});
|
|
1616
|
-
const op = ops.reduce(dist$1.type.compose, null), invertOp = invertOps.reduce(dist$1.type.compose, null), { unitId, subUnitId } = updateParams[0];
|
|
1617
|
-
return { undo: invertOp, redo: op, unitId, subUnitId, objects };
|
|
1618
|
-
}
|
|
1619
|
-
removeNotification(removeParams) {
|
|
1620
|
-
this._remove$.next(removeParams);
|
|
1621
|
-
}
|
|
1622
|
-
addNotification(insertParams) {
|
|
1623
|
-
this._add$.next(insertParams);
|
|
1624
|
-
}
|
|
1625
|
-
updateNotification(updateParams) {
|
|
1626
|
-
this._update$.next(updateParams);
|
|
1627
|
-
}
|
|
1628
|
-
orderNotification(orderParams) {
|
|
1629
|
-
this._order$.next(orderParams);
|
|
1630
|
-
}
|
|
1631
|
-
groupUpdateNotification(groupParams) {
|
|
1632
|
-
this._group$.next(groupParams);
|
|
1633
|
-
}
|
|
1634
|
-
ungroupUpdateNotification(groupParams) {
|
|
1635
|
-
this._ungroup$.next(groupParams);
|
|
1636
|
-
}
|
|
1637
|
-
refreshTransformNotification(refreshParams) {
|
|
1638
|
-
this._refreshTransform$.next(refreshParams);
|
|
1639
|
-
}
|
|
1640
|
-
getGroupDrawingOp(groupParams) {
|
|
1641
|
-
const ops = [], { unitId, subUnitId } = groupParams[0].parent;
|
|
1642
|
-
groupParams.forEach((groupParam) => {
|
|
1643
|
-
ops.push(this._getGroupDrawingOp(groupParam));
|
|
1644
|
-
});
|
|
1645
|
-
const op = ops.reduce(dist$1.type.compose, null);
|
|
1646
|
-
return { undo: dist$1.type.invertWithDoc(op, this.drawingManagerData), redo: op, unitId, subUnitId, objects: groupParams };
|
|
1647
|
-
}
|
|
1648
|
-
getUngroupDrawingOp(groupParams) {
|
|
1649
|
-
const ops = [], { unitId, subUnitId } = groupParams[0].parent;
|
|
1650
|
-
groupParams.forEach((groupParam) => {
|
|
1651
|
-
ops.push(this._getUngroupDrawingOp(groupParam));
|
|
1652
|
-
});
|
|
1653
|
-
const op = ops.reduce(dist$1.type.compose, null);
|
|
1654
|
-
return { undo: dist$1.type.invertWithDoc(op, this.drawingManagerData), redo: op, unitId, subUnitId, objects: groupParams };
|
|
1655
|
-
}
|
|
1656
|
-
getDrawingsByGroup(groupParam) {
|
|
1657
|
-
const { unitId, subUnitId, drawingId } = groupParam;
|
|
1658
|
-
if (this.getDrawingByParam({ unitId, subUnitId, drawingId }) == null)
|
|
1659
|
-
return [];
|
|
1660
|
-
const drawings = this._getDrawingData(unitId, subUnitId), children = [];
|
|
1661
|
-
return Object.keys(drawings).forEach((key) => {
|
|
1662
|
-
const drawing = drawings[key];
|
|
1663
|
-
drawing.groupId === drawingId && children.push(drawing);
|
|
1664
|
-
}), children;
|
|
1665
|
-
}
|
|
1666
|
-
_getGroupDrawingOp(groupParam) {
|
|
1667
|
-
const { parent, children } = groupParam, { unitId: groupUnitId, subUnitId: groupSubUnitId, drawingId: groupDrawingId } = parent, ops = [];
|
|
1668
|
-
ops.push(
|
|
1669
|
-
dist$1.insertOp([groupUnitId, groupSubUnitId, "data", groupDrawingId], parent)
|
|
1670
|
-
);
|
|
1671
|
-
let maxChildIndex = Number.NEGATIVE_INFINITY;
|
|
1672
|
-
return children.forEach((child) => {
|
|
1673
|
-
const { unitId, subUnitId, drawingId } = child, index = this._hasDrawingOrder({ unitId, subUnitId, drawingId });
|
|
1674
|
-
maxChildIndex = Math.max(maxChildIndex, index), ops.push(
|
|
1675
|
-
...this._getUpdateParamCompareOp(child, this.getDrawingByParam({ unitId, subUnitId, drawingId }))
|
|
1676
|
-
);
|
|
1677
|
-
}), maxChildIndex === Number.NEGATIVE_INFINITY && (maxChildIndex = this._getDrawingOrder(groupUnitId, groupSubUnitId).length), ops.push(
|
|
1678
|
-
dist$1.insertOp([groupUnitId, groupSubUnitId, "order", maxChildIndex], groupDrawingId)
|
|
1679
|
-
), ops.reduce(dist$1.type.compose, null);
|
|
1680
|
-
}
|
|
1681
|
-
_getUngroupDrawingOp(groupParam) {
|
|
1682
|
-
const { parent, children } = groupParam, { unitId: groupUnitId, subUnitId: groupSubUnitId, drawingId: groupDrawingId } = parent, ops = [];
|
|
1683
|
-
return children.forEach((child) => {
|
|
1684
|
-
const { unitId, subUnitId, drawingId } = child;
|
|
1685
|
-
ops.push(
|
|
1686
|
-
...this._getUpdateParamCompareOp(child, this.getDrawingByParam({ unitId, subUnitId, drawingId }))
|
|
1687
|
-
);
|
|
1688
|
-
}), ops.push(
|
|
1689
|
-
dist$1.removeOp([groupUnitId, groupSubUnitId, "data", groupDrawingId], !0)
|
|
1690
|
-
), ops.push(
|
|
1691
|
-
dist$1.removeOp([groupUnitId, groupSubUnitId, "order", this._getDrawingOrder(groupUnitId, groupSubUnitId).indexOf(groupDrawingId)], !0)
|
|
1692
|
-
), ops.reduce(dist$1.type.compose, null);
|
|
1693
|
-
}
|
|
1694
|
-
applyJson1(unitId, subUnitId, jsonOp) {
|
|
1695
|
-
this._establishDrawingMap(unitId, subUnitId), this._oldDrawingManagerData = { ...this.drawingManagerData }, this.drawingManagerData = dist$1.type.apply(this.drawingManagerData, jsonOp);
|
|
1696
|
-
}
|
|
1697
|
-
// private _fillMissingFields(jsonOp: JSONOp) {
|
|
1698
|
-
// if (jsonOp == null) {
|
|
1699
|
-
// return;
|
|
1700
|
-
// }
|
|
1701
|
-
// let object: { [key: string]: {} } = this.drawingManagerData;
|
|
1702
|
-
// for (let i = 0; i < jsonOp.length; i++) {
|
|
1703
|
-
// const op = jsonOp[i];
|
|
1704
|
-
// if (Array.isArray(op)) {
|
|
1705
|
-
// const opKey = op[0] as string;
|
|
1706
|
-
// if (!(opKey in object)) {
|
|
1707
|
-
// object[opKey] = null as unknown as never;
|
|
1708
|
-
// }
|
|
1709
|
-
// } else if (typeof op === 'string') {
|
|
1710
|
-
// object = object[op];
|
|
1711
|
-
// if (object == null) {
|
|
1712
|
-
// break;
|
|
1713
|
-
// }
|
|
1714
|
-
// }
|
|
1715
|
-
// }
|
|
1716
|
-
// }
|
|
1717
|
-
featurePluginUpdateNotification(updateParams) {
|
|
1718
|
-
this._featurePluginUpdate$.next(updateParams);
|
|
1719
|
-
}
|
|
1720
|
-
featurePluginOrderUpdateNotification(drawingOrderUpdateParam) {
|
|
1721
|
-
this._featurePluginOrderUpdate$.next(drawingOrderUpdateParam);
|
|
1722
|
-
}
|
|
1723
|
-
featurePluginAddNotification(insertParams) {
|
|
1724
|
-
this._featurePluginAdd$.next(insertParams);
|
|
1725
|
-
}
|
|
1726
|
-
featurePluginRemoveNotification(removeParams) {
|
|
1727
|
-
this._featurePluginRemove$.next(removeParams);
|
|
1728
|
-
}
|
|
1729
|
-
featurePluginGroupUpdateNotification(groupParams) {
|
|
1730
|
-
this._featurePluginGroupUpdate$.next(groupParams);
|
|
1731
|
-
}
|
|
1732
|
-
featurePluginUngroupUpdateNotification(groupParams) {
|
|
1733
|
-
this._featurePluginUngroupUpdate$.next(groupParams);
|
|
1734
|
-
}
|
|
1735
|
-
getDrawingByParam(param) {
|
|
1736
|
-
return this._getCurrentBySearch(param);
|
|
1737
|
-
}
|
|
1738
|
-
getOldDrawingByParam(param) {
|
|
1739
|
-
return this._getOldBySearch(param);
|
|
1740
|
-
}
|
|
1741
|
-
getDrawingOKey(oKey) {
|
|
1742
|
-
const [unitId, subUnitId, drawingId] = oKey.split("#-#");
|
|
1743
|
-
return this._getCurrentBySearch({ unitId, subUnitId, drawingId });
|
|
1744
|
-
}
|
|
1745
|
-
focusDrawing(params) {
|
|
1746
|
-
if (params == null) {
|
|
1747
|
-
this._focusDrawings = [], this._focus$.next([]);
|
|
1748
|
-
return;
|
|
1749
|
-
}
|
|
1750
|
-
const drawingParams = [];
|
|
1751
|
-
params.forEach((param) => {
|
|
1752
|
-
var _a2;
|
|
1753
|
-
const { unitId, subUnitId, drawingId } = param, item = (_a2 = this._getDrawingData(unitId, subUnitId)) == null ? void 0 : _a2[drawingId];
|
|
1754
|
-
item != null && drawingParams.push(item);
|
|
1755
|
-
}), drawingParams.length > 0 && (this._focusDrawings = drawingParams, this._focus$.next(drawingParams));
|
|
1756
|
-
}
|
|
1757
|
-
getFocusDrawings() {
|
|
1758
|
-
const drawingParams = [];
|
|
1759
|
-
return this._focusDrawings.forEach((param) => {
|
|
1760
|
-
var _a2;
|
|
1761
|
-
const { unitId, subUnitId, drawingId } = param, item = (_a2 = this._getDrawingData(unitId, subUnitId)) == null ? void 0 : _a2[drawingId];
|
|
1762
|
-
item != null && drawingParams.push(item);
|
|
1763
|
-
}), drawingParams;
|
|
1764
|
-
}
|
|
1765
|
-
getDrawingOrder(unitId, subUnitId) {
|
|
1766
|
-
return this._getDrawingOrder(unitId, subUnitId);
|
|
1767
|
-
}
|
|
1768
|
-
// Use in doc only.
|
|
1769
|
-
setDrawingOrder(unitId, subUnitId, order) {
|
|
1770
|
-
this.drawingManagerData[unitId][subUnitId].order = order;
|
|
1771
|
-
}
|
|
1772
|
-
orderUpdateNotification(orderParams) {
|
|
1773
|
-
this._order$.next(orderParams);
|
|
1774
|
-
}
|
|
1775
|
-
getForwardDrawingsOp(orderParams) {
|
|
1776
|
-
const { unitId, subUnitId, drawingIds } = orderParams, ops = [], orders = this.getDrawingOrder(unitId, subUnitId), newIds = [...drawingIds];
|
|
1777
|
-
drawingIds.forEach((drawingId) => {
|
|
1778
|
-
const index = this._hasDrawingOrder({ unitId, subUnitId, drawingId });
|
|
1779
|
-
if (index === -1 || index === orders.length - 1)
|
|
1780
|
-
return;
|
|
1781
|
-
const op2 = dist$1.moveOp([unitId, subUnitId, "order", index], [unitId, subUnitId, "order", index + 1]);
|
|
1782
|
-
ops.push(op2), newIds.includes(orders[index + 1]) || newIds.push(orders[index + 1]);
|
|
1783
|
-
});
|
|
1784
|
-
const op = ops.reduce(dist$1.type.compose, null);
|
|
1785
|
-
return { undo: dist$1.type.invertWithDoc(op, this.drawingManagerData), redo: op, unitId, subUnitId, objects: { ...orderParams, drawingIds: newIds } };
|
|
1786
|
-
}
|
|
1787
|
-
getBackwardDrawingOp(orderParams) {
|
|
1788
|
-
const { unitId, subUnitId, drawingIds } = orderParams, ops = [], orders = this.getDrawingOrder(unitId, subUnitId), newIds = [...drawingIds];
|
|
1789
|
-
drawingIds.forEach((drawingId) => {
|
|
1790
|
-
const index = this._hasDrawingOrder({ unitId, subUnitId, drawingId });
|
|
1791
|
-
if (index === -1 || index === 0)
|
|
1792
|
-
return;
|
|
1793
|
-
const op2 = dist$1.moveOp([unitId, subUnitId, "order", index], [unitId, subUnitId, "order", index - 1]);
|
|
1794
|
-
ops.push(op2), newIds.includes(orders[index - 1]) || newIds.push(orders[index - 1]);
|
|
1795
|
-
});
|
|
1796
|
-
const op = ops.reduce(dist$1.type.compose, null);
|
|
1797
|
-
return { undo: dist$1.type.invertWithDoc(op, this.drawingManagerData), redo: op, unitId, subUnitId, objects: { ...orderParams, drawingIds: newIds } };
|
|
1798
|
-
}
|
|
1799
|
-
getFrontDrawingsOp(orderParams) {
|
|
1800
|
-
const { unitId, subUnitId, drawingIds } = orderParams, orderDrawingIds = this._getOrderFromSearchParams(unitId, subUnitId, drawingIds), newIds = [...drawingIds], orders = this.getDrawingOrder(unitId, subUnitId), ops = [];
|
|
1801
|
-
orderDrawingIds.forEach((orderDrawingId) => {
|
|
1802
|
-
const { drawingId } = orderDrawingId, index = this._getDrawingCount(unitId, subUnitId) - 1, op2 = dist$1.moveOp([unitId, subUnitId, "order", this._getDrawingOrder(unitId, subUnitId).indexOf(drawingId)], [unitId, subUnitId, "order", index]);
|
|
1803
|
-
ops.push(op2), newIds.includes(orders[index]) || newIds.push(orders[index]);
|
|
1804
|
-
});
|
|
1805
|
-
const op = ops.reduce(dist$1.type.compose, null);
|
|
1806
|
-
return { undo: dist$1.type.invertWithDoc(op, this.drawingManagerData), redo: op, unitId, subUnitId, objects: { ...orderParams, drawingIds: newIds } };
|
|
1807
|
-
}
|
|
1808
|
-
getBackDrawingsOp(orderParams) {
|
|
1809
|
-
const { unitId, subUnitId, drawingIds } = orderParams, orderSearchParams = this._getOrderFromSearchParams(unitId, subUnitId, drawingIds, !0), newIds = [...drawingIds], orders = this.getDrawingOrder(unitId, subUnitId), ops = [];
|
|
1810
|
-
orderSearchParams.forEach((orderSearchParam) => {
|
|
1811
|
-
const { drawingId } = orderSearchParam, op2 = dist$1.moveOp([unitId, subUnitId, "order", this._getDrawingOrder(unitId, subUnitId).indexOf(drawingId)], [unitId, subUnitId, "order", 0]);
|
|
1812
|
-
ops.push(op2), newIds.includes(orders[0]) || newIds.push(orders[0]);
|
|
1813
|
-
});
|
|
1814
|
-
const op = ops.reduce(dist$1.type.compose, null);
|
|
1815
|
-
return { undo: dist$1.type.invertWithDoc(op, this.drawingManagerData), redo: op, unitId, subUnitId, objects: { ...orderParams, drawingIds: newIds } };
|
|
1816
|
-
}
|
|
1817
|
-
_getDrawingCount(unitId, subUnitId) {
|
|
1818
|
-
return this.getDrawingOrder(unitId, subUnitId).length || 0;
|
|
1819
|
-
}
|
|
1820
|
-
_getOrderFromSearchParams(unitId, subUnitId, drawingIds, isDesc = !1) {
|
|
1821
|
-
return drawingIds.map((drawingId) => {
|
|
1822
|
-
const zIndex = this._hasDrawingOrder({ unitId, subUnitId, drawingId });
|
|
1823
|
-
return { drawingId, zIndex };
|
|
1824
|
-
}).sort(isDesc === !1 ? sortRules : sortRulesByDesc);
|
|
1825
|
-
}
|
|
1826
|
-
_hasDrawingOrder(searchParam) {
|
|
1827
|
-
if (searchParam == null)
|
|
1828
|
-
return -1;
|
|
1829
|
-
const { unitId, subUnitId, drawingId } = searchParam;
|
|
1830
|
-
return this._establishDrawingMap(unitId, subUnitId), this._getDrawingOrder(unitId, subUnitId).indexOf(drawingId);
|
|
1831
|
-
}
|
|
1832
|
-
_getCurrentBySearch(searchParam) {
|
|
1833
|
-
var _a2, _b, _c;
|
|
1834
|
-
if (searchParam == null)
|
|
1835
|
-
return;
|
|
1836
|
-
const { unitId, subUnitId, drawingId } = searchParam;
|
|
1837
|
-
return (_c = (_b = (_a2 = this.drawingManagerData[unitId]) == null ? void 0 : _a2[subUnitId]) == null ? void 0 : _b.data) == null ? void 0 : _c[drawingId];
|
|
1838
|
-
}
|
|
1839
|
-
_getOldBySearch(searchParam) {
|
|
1840
|
-
var _a2, _b, _c;
|
|
1841
|
-
if (searchParam == null)
|
|
1842
|
-
return;
|
|
1843
|
-
const { unitId, subUnitId, drawingId } = searchParam;
|
|
1844
|
-
return (_c = (_b = (_a2 = this._oldDrawingManagerData[unitId]) == null ? void 0 : _a2[subUnitId]) == null ? void 0 : _b.data) == null ? void 0 : _c[drawingId];
|
|
1845
|
-
}
|
|
1846
|
-
_establishDrawingMap(unitId, subUnitId, drawingId) {
|
|
1847
|
-
var _a2;
|
|
1848
|
-
return this.drawingManagerData[unitId] || (this.drawingManagerData[unitId] = {}), this.drawingManagerData[unitId][subUnitId] || (this.drawingManagerData[unitId][subUnitId] = {
|
|
1849
|
-
data: {},
|
|
1850
|
-
order: []
|
|
1851
|
-
}), drawingId == null ? null : (_a2 = this.drawingManagerData[unitId][subUnitId].data) == null ? void 0 : _a2[drawingId];
|
|
1852
|
-
}
|
|
1853
|
-
_addByParam(insertParam) {
|
|
1854
|
-
const { unitId, subUnitId, drawingId } = insertParam;
|
|
1855
|
-
this._establishDrawingMap(unitId, subUnitId, drawingId);
|
|
1856
|
-
const op1 = dist$1.insertOp([unitId, subUnitId, "data", drawingId], insertParam), op2 = dist$1.insertOp([unitId, subUnitId, "order", this._getDrawingOrder(unitId, subUnitId).length], drawingId), op = [op1, op2].reduce(dist$1.type.compose, null), invertOp = dist$1.type.invertWithDoc(op, this.drawingManagerData);
|
|
1857
|
-
return { op, invertOp };
|
|
1858
|
-
}
|
|
1859
|
-
_removeByParam(searchParam) {
|
|
1860
|
-
if (searchParam == null)
|
|
1861
|
-
return { op: [], invertOp: [] };
|
|
1862
|
-
const { unitId, subUnitId, drawingId } = searchParam;
|
|
1863
|
-
if (this._establishDrawingMap(unitId, subUnitId, drawingId) == null)
|
|
1864
|
-
return { op: [], invertOp: [] };
|
|
1865
|
-
const op1 = dist$1.removeOp([unitId, subUnitId, "data", drawingId], !0), op2 = dist$1.removeOp([unitId, subUnitId, "order", this._getDrawingOrder(unitId, subUnitId).indexOf(drawingId)], !0), op = [op1, op2].reduce(dist$1.type.compose, null), invertOp = dist$1.type.invertWithDoc(op, this.drawingManagerData);
|
|
1866
|
-
return { op, invertOp };
|
|
1867
|
-
}
|
|
1868
|
-
_updateByParam(updateParam) {
|
|
1869
|
-
const { unitId, subUnitId, drawingId } = updateParam, object = this._establishDrawingMap(unitId, subUnitId, drawingId);
|
|
1870
|
-
if (object == null)
|
|
1871
|
-
return { op: [], invertOp: [] };
|
|
1872
|
-
const op = this._getUpdateParamCompareOp(updateParam, object).reduce(dist$1.type.compose, null), invertOp = dist$1.type.invertWithDoc(op, this.drawingManagerData);
|
|
1873
|
-
return { op, invertOp };
|
|
1874
|
-
}
|
|
1875
|
-
// private _initializeDrawingData(updateParam: T, oldParam: T) {
|
|
1876
|
-
// Object.keys(updateParam).forEach((key) => {
|
|
1877
|
-
// if (!(key in oldParam)) {
|
|
1878
|
-
// oldParam[key as keyof IDrawingParam] = null as unknown as never;
|
|
1879
|
-
// }
|
|
1880
|
-
// });
|
|
1881
|
-
// }
|
|
1882
|
-
_getUpdateParamCompareOp(newParam, oldParam) {
|
|
1883
|
-
const { unitId, subUnitId, drawingId } = newParam, ops = [];
|
|
1884
|
-
return Object.keys(newParam).forEach((key) => {
|
|
1885
|
-
const newVal = newParam[key], oldVal = oldParam[key];
|
|
1886
|
-
oldVal !== newVal && ops.push(
|
|
1887
|
-
dist$1.replaceOp([unitId, subUnitId, "data", drawingId, key], oldVal, newVal)
|
|
1888
|
-
);
|
|
1889
|
-
}), ops;
|
|
1890
|
-
}
|
|
1891
|
-
_getDrawingData(unitId, subUnitId) {
|
|
1892
|
-
var _a2, _b;
|
|
1893
|
-
return ((_b = (_a2 = this.drawingManagerData[unitId]) == null ? void 0 : _a2[subUnitId]) == null ? void 0 : _b.data) || {};
|
|
1894
|
-
}
|
|
1895
|
-
_getDrawingOrder(unitId, subUnitId) {
|
|
1896
|
-
var _a2, _b;
|
|
1897
|
-
return ((_b = (_a2 = this.drawingManagerData[unitId]) == null ? void 0 : _a2[subUnitId]) == null ? void 0 : _b.order) || [];
|
|
1898
|
-
}
|
|
1899
|
-
getDrawingVisible() {
|
|
1900
|
-
return this._visible;
|
|
1901
|
-
}
|
|
1902
|
-
getDrawingEditable() {
|
|
1903
|
-
return this._editable;
|
|
1904
|
-
}
|
|
1905
|
-
setDrawingVisible(visible) {
|
|
1906
|
-
this._visible = visible;
|
|
1907
|
-
}
|
|
1908
|
-
setDrawingEditable(editable) {
|
|
1909
|
-
this._editable = editable;
|
|
1910
|
-
}
|
|
1911
|
-
};
|
|
1912
|
-
__name(_UnitDrawingService, "UnitDrawingService");
|
|
1913
|
-
let UnitDrawingService = _UnitDrawingService;
|
|
1914
|
-
const _DrawingManagerService = class _DrawingManagerService extends UnitDrawingService {
|
|
1915
|
-
};
|
|
1916
|
-
__name(_DrawingManagerService, "DrawingManagerService");
|
|
1917
|
-
let DrawingManagerService = _DrawingManagerService;
|
|
1918
|
-
function getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId }, index) {
|
|
1919
|
-
return typeof index == "number" ? `${unitId}#-#${subUnitId}#-#${drawingId}#-#${index}` : `${unitId}#-#${subUnitId}#-#${drawingId}`;
|
|
1920
|
-
}
|
|
1921
|
-
__name(getDrawingShapeKeyByDrawingSearch, "getDrawingShapeKeyByDrawingSearch");
|
|
1922
|
-
const getImageSize = /* @__PURE__ */ __name(async (src) => new Promise((resolve, reject) => {
|
|
1923
|
-
const image = new Image();
|
|
1924
|
-
image.src = src, image.onload = () => {
|
|
1925
|
-
resolve({
|
|
1926
|
-
width: image.width,
|
|
1927
|
-
height: image.height,
|
|
1928
|
-
image
|
|
1929
|
-
});
|
|
1930
|
-
}, image.onerror = (error) => {
|
|
1931
|
-
reject(error);
|
|
1932
|
-
};
|
|
1933
|
-
}), "getImageSize");
|
|
1934
|
-
var ImageSourceType = /* @__PURE__ */ ((ImageSourceType2) => (ImageSourceType2.URL = "URL", ImageSourceType2.UUID = "UUID", ImageSourceType2.BASE64 = "BASE64", ImageSourceType2))(ImageSourceType || {}), ImageUploadStatusType = /* @__PURE__ */ ((ImageUploadStatusType2) => (ImageUploadStatusType2.SUCCUSS = "0", ImageUploadStatusType2.ERROR_EXCEED_SIZE = "1", ImageUploadStatusType2.ERROR_IMAGE_TYPE = "2", ImageUploadStatusType2.ERROR_UPLOAD_COUNT_LIMIT = "3", ImageUploadStatusType2.ERROR_IMAGE = "4", ImageUploadStatusType2))(ImageUploadStatusType || {});
|
|
1935
|
-
const IImageIoService = createIdentifier("core.image-io.service"), _ImageIoService = class _ImageIoService {
|
|
1936
|
-
constructor() {
|
|
1937
|
-
__publicField(this, "_waitCount", 0);
|
|
1938
|
-
__publicField(this, "_change$", new Subject());
|
|
1939
|
-
__publicField(this, "change$", this._change$);
|
|
1940
|
-
__publicField(this, "_imageSourceCache", /* @__PURE__ */ new Map());
|
|
1941
|
-
}
|
|
1942
|
-
setWaitCount(count) {
|
|
1943
|
-
this._waitCount = count, this._change$.next(count);
|
|
1944
|
-
}
|
|
1945
|
-
getImageSourceCache(source, imageSourceType) {
|
|
1946
|
-
if (imageSourceType === ImageSourceType.BASE64) {
|
|
1947
|
-
const image = new Image();
|
|
1948
|
-
return image.src = source, image;
|
|
1949
|
-
}
|
|
1950
|
-
return this._imageSourceCache.get(source);
|
|
1951
|
-
}
|
|
1952
|
-
addImageSourceCache(source, imageSourceType, imageSource) {
|
|
1953
|
-
imageSourceType === ImageSourceType.BASE64 || imageSource == null || this._imageSourceCache.set(source, imageSource);
|
|
1954
|
-
}
|
|
1955
|
-
async getImage(imageId) {
|
|
1956
|
-
return Promise.resolve(imageId);
|
|
1957
|
-
}
|
|
1958
|
-
async saveImage(imageFile) {
|
|
1959
|
-
return new Promise((resolve, reject) => {
|
|
1960
|
-
if (!DRAWING_IMAGE_ALLOW_IMAGE_LIST.includes(imageFile.type)) {
|
|
1961
|
-
reject(new Error(ImageUploadStatusType.ERROR_IMAGE_TYPE)), this._decreaseWaiting();
|
|
1962
|
-
return;
|
|
1963
|
-
}
|
|
1964
|
-
if (imageFile.size > DRAWING_IMAGE_ALLOW_SIZE) {
|
|
1965
|
-
reject(new Error(ImageUploadStatusType.ERROR_EXCEED_SIZE)), this._decreaseWaiting();
|
|
1966
|
-
return;
|
|
1967
|
-
}
|
|
1968
|
-
const reader = new FileReader();
|
|
1969
|
-
reader.readAsDataURL(imageFile), reader.onload = (evt) => {
|
|
1970
|
-
var _a2;
|
|
1971
|
-
const replaceSrc = (_a2 = evt.target) == null ? void 0 : _a2.result;
|
|
1972
|
-
if (replaceSrc == null) {
|
|
1973
|
-
reject(new Error(ImageUploadStatusType.ERROR_IMAGE)), this._decreaseWaiting();
|
|
1974
|
-
return;
|
|
1975
|
-
}
|
|
1976
|
-
const imageId = Tools.generateRandomId(6);
|
|
1977
|
-
resolve({
|
|
1978
|
-
imageId,
|
|
1979
|
-
imageSourceType: ImageSourceType.BASE64,
|
|
1980
|
-
source: replaceSrc,
|
|
1981
|
-
base64Cache: replaceSrc,
|
|
1982
|
-
status: ImageUploadStatusType.SUCCUSS
|
|
1983
|
-
}), this._decreaseWaiting();
|
|
1984
|
-
};
|
|
1985
|
-
});
|
|
1986
|
-
}
|
|
1987
|
-
_decreaseWaiting() {
|
|
1988
|
-
this._waitCount -= 1, this._change$.next(this._waitCount);
|
|
1989
|
-
}
|
|
1990
|
-
};
|
|
1991
|
-
__name(_ImageIoService, "ImageIoService");
|
|
1992
|
-
let ImageIoService = _ImageIoService;
|
|
1993
|
-
const DEFAULT_DOCUMENT_SUB_COMPONENT_ID = "__default_document_sub_component_id20231101__";
|
|
1994
|
-
var ArrangeTypeEnum = /* @__PURE__ */ ((ArrangeTypeEnum2) => (ArrangeTypeEnum2[ArrangeTypeEnum2.forward = 0] = "forward", ArrangeTypeEnum2[ArrangeTypeEnum2.backward = 1] = "backward", ArrangeTypeEnum2[ArrangeTypeEnum2.front = 2] = "front", ArrangeTypeEnum2[ArrangeTypeEnum2.back = 3] = "back", ArrangeTypeEnum2))(ArrangeTypeEnum || {}), DrawingTypeEnum = /* @__PURE__ */ ((DrawingTypeEnum2) => (DrawingTypeEnum2[DrawingTypeEnum2.UNRECOGNIZED = -1] = "UNRECOGNIZED", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_IMAGE = 0] = "DRAWING_IMAGE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_SHAPE = 1] = "DRAWING_SHAPE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_CHART = 2] = "DRAWING_CHART", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_TABLE = 3] = "DRAWING_TABLE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_SMART_ART = 4] = "DRAWING_SMART_ART", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_VIDEO = 5] = "DRAWING_VIDEO", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_GROUP = 6] = "DRAWING_GROUP", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_UNIT = 7] = "DRAWING_UNIT", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_DOM = 8] = "DRAWING_DOM", DrawingTypeEnum2))(DrawingTypeEnum || {});
|
|
1995
|
-
const IDrawingManagerService = createIdentifier("univer.drawing-manager.service"), PLUGIN_CONFIG_KEY = "drawing.config", defaultPluginConfig = {};
|
|
1996
|
-
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1997
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1998
|
-
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1999
|
-
return kind && result && __defProp2(target, key, result), result;
|
|
2000
|
-
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam");
|
|
2001
|
-
const PLUGIN_NAME = "UNIVER_DRAWING_PLUGIN";
|
|
2002
|
-
var _a;
|
|
2003
|
-
let UniverDrawingPlugin = (_a = class extends Plugin {
|
|
2004
|
-
constructor(_config = defaultPluginConfig, _injector, _configService) {
|
|
2005
|
-
super(), this._config = _config, this._injector = _injector, this._configService = _configService;
|
|
2006
|
-
const { ...rest } = this._config;
|
|
2007
|
-
this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
|
|
2008
|
-
}
|
|
2009
|
-
onStarting() {
|
|
2010
|
-
this._initDependencies();
|
|
2011
|
-
}
|
|
2012
|
-
_initDependencies() {
|
|
2013
|
-
var _a2;
|
|
2014
|
-
mergeOverrideWithDependencies([
|
|
2015
|
-
[IImageIoService, { useClass: ImageIoService }],
|
|
2016
|
-
[IDrawingManagerService, { useClass: DrawingManagerService }]
|
|
2017
|
-
], (_a2 = this._config) == null ? void 0 : _a2.override).forEach((d) => this._injector.add(d));
|
|
2018
|
-
}
|
|
2019
|
-
}, __name(_a, "UniverDrawingPlugin"), __publicField(_a, "pluginName", PLUGIN_NAME), _a);
|
|
2020
|
-
UniverDrawingPlugin = __decorateClass([
|
|
2021
|
-
__decorateParam(1, Inject(Injector)),
|
|
2022
|
-
__decorateParam(2, IConfigService)
|
|
2023
|
-
], UniverDrawingPlugin);
|
|
2024
|
-
export {
|
|
2025
|
-
ArrangeTypeEnum,
|
|
2026
|
-
DEFAULT_DOCUMENT_SUB_COMPONENT_ID,
|
|
2027
|
-
DRAWING_IMAGE_ALLOW_IMAGE_LIST,
|
|
2028
|
-
DRAWING_IMAGE_ALLOW_SIZE,
|
|
2029
|
-
DRAWING_IMAGE_COUNT_LIMIT,
|
|
2030
|
-
DRAWING_IMAGE_HEIGHT_LIMIT,
|
|
2031
|
-
DRAWING_IMAGE_WIDTH_LIMIT,
|
|
2032
|
-
DrawingManagerService,
|
|
2033
|
-
DrawingTypeEnum,
|
|
2034
|
-
IDrawingManagerService,
|
|
2035
|
-
IImageIoService,
|
|
2036
|
-
ImageIoService,
|
|
2037
|
-
ImageSourceType,
|
|
2038
|
-
ImageUploadStatusType,
|
|
2039
|
-
UnitDrawingService,
|
|
2040
|
-
UniverDrawingPlugin,
|
|
2041
|
-
getDrawingShapeKeyByDrawingSearch,
|
|
2042
|
-
getImageSize
|
|
2043
|
-
};
|
|
1
|
+
const _0x220c00=_0x4f99;(function(_0x5e4d76,_0x2b8030){const _0x4e0267=_0x4f99,_0x49ee73=_0x5e4d76();while(!![]){try{const _0x289576=-parseInt(_0x4e0267(0xff))/0x1*(-parseInt(_0x4e0267(0xd4))/0x2)+-parseInt(_0x4e0267(0x1b7))/0x3*(parseInt(_0x4e0267(0xb8))/0x4)+parseInt(_0x4e0267(0x1b2))/0x5*(parseInt(_0x4e0267(0x1f2))/0x6)+parseInt(_0x4e0267(0x196))/0x7*(parseInt(_0x4e0267(0x1dc))/0x8)+-parseInt(_0x4e0267(0x1ef))/0x9*(parseInt(_0x4e0267(0x14e))/0xa)+-parseInt(_0x4e0267(0x10e))/0xb+parseInt(_0x4e0267(0xe4))/0xc*(parseInt(_0x4e0267(0x110))/0xd);if(_0x289576===_0x2b8030)break;else _0x49ee73['push'](_0x49ee73['shift']());}catch(_0x27d8b9){_0x49ee73['push'](_0x49ee73['shift']());}}}(_0x1c60,0x4f331));var __defProp=Object[_0x220c00(0x1ae)],__defNormalProp=(_0x3cb4c0,_0x470a2d,_0x3cc095)=>_0x470a2d in _0x3cb4c0?__defProp(_0x3cb4c0,_0x470a2d,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x3cc095}):_0x3cb4c0[_0x470a2d]=_0x3cc095,__name=(_0x348b20,_0x2264e4)=>__defProp(_0x348b20,_0x220c00(0x1a9),{'value':_0x2264e4,'configurable':!0x0}),__publicField=(_0x16a525,_0x4036cc,_0x2eec23)=>__defNormalProp(_0x16a525,typeof _0x4036cc!=_0x220c00(0x91)?_0x4036cc+'':_0x4036cc,_0x2eec23);import{sortRules,sortRulesByDesc,createIdentifier,Tools,Inject,Injector,Plugin,mergeOverrideWithDependencies,IConfigService}from'@univerjs/core';import{Subject}from'rxjs';const DRAWING_IMAGE_WIDTH_LIMIT=0x1f4,DRAWING_IMAGE_HEIGHT_LIMIT=0x1f4,DRAWING_IMAGE_COUNT_LIMIT=0xa,DRAWING_IMAGE_ALLOW_SIZE=0x5*0x400*0x400,DRAWING_IMAGE_ALLOW_IMAGE_LIST=[_0x220c00(0x131),_0x220c00(0x1bc),_0x220c00(0x1b0),_0x220c00(0x1d4),'image/bmp'];var commonjsGlobal=typeof globalThis<'u'?globalThis:typeof window<'u'?window:typeof global<'u'?global:typeof self<'u'?self:{},dist$1={},json1_release={},deepEqual$1={};Object[_0x220c00(0x1ae)](deepEqual$1,_0x220c00(0x1fb),{'value':!0x0});function eqObj(_0x43c2a9,_0x3b18e6){const _0x5ab6f0=_0x220c00;if(Array[_0x5ab6f0(0x105)](_0x3b18e6))return!0x1;for(let _0x554085 in _0x43c2a9)if(!deepEqual(_0x43c2a9[_0x554085],_0x3b18e6[_0x554085]))return!0x1;for(let _0x3abe62 in _0x3b18e6)if(_0x43c2a9[_0x3abe62]===void 0x0)return!0x1;return!0x0;}__name(eqObj,_0x220c00(0x1dd));function eqArr(_0x524cf2,_0x37b7f7){const _0xb8b5ee=_0x220c00;if(!Array[_0xb8b5ee(0x105)](_0x37b7f7)||_0x524cf2[_0xb8b5ee(0x109)]!==_0x37b7f7[_0xb8b5ee(0x109)])return!0x1;for(let _0x5100a8=0x0;_0x5100a8<_0x524cf2[_0xb8b5ee(0x109)];_0x5100a8++)if(!deepEqual(_0x524cf2[_0x5100a8],_0x37b7f7[_0x5100a8]))return!0x1;return!0x0;}function _0x1c60(){const _0x12f864=['next','reduce','ERROR_IMAGE','onStarting','Invalid\x20component\x20item\x20\x27','DRAWING_UNIT','_getDrawingData','onload','back','includes','adv','_getGroupDrawingOp','trim','create','isValidKey','getForwardDrawingsOp','isMultiTransform','Invalid\x20key\x20-\x20child\x20is\x20not\x20an\x20array','DRAWING_CHART','add','scanOp2Pick','74bcJqLJ','focusDrawing','_getOrderFromSearchParams','refreshTransformNotification','transform','has','object','_getDrawingCount','drawingManagerData','_visible$','idx','handleDrop','DRAWING_SHAPE','traversePick','Cannot\x20modify\x20child\x20-\x20invalid\x20operation','getImageSourceCache','12yWTDQH','string','getDrawingsByGroup','transformPosition','pick','asObservable','insertChildMut','writeHeldOp2Drop','requireType','DRAWING_IMAGE','addImageSourceCache','_config','getGroupDrawingOp','drawing.config','push','checkValidOp','strPosToUni','WriteCursor','writeOp1Pick','__proto__','writeConflict','Adjacent\x20skip\x20components\x20should\x20be\x20combined','getBackwardDrawingOp','shallowCloneOp','_op','apply','Missing\x20type:\x20','4441aoRpTQ','ERROR_UPLOAD_COUNT_LIMIT','ena','_featurePluginUpdate$','writeMove','getFrontDrawingsOp','isArray','parents','SUCCUSS','nextSibling','length','eachDrop','getDrawingOKey','getUngroupDrawingOp','conflict','1816694LdMuFi','descendFirst','3793049rBABko','checkOp','makeType','Op\x20must\x20be\x20null\x20or\x20a\x20list','uniToStrPos','complete','transformNoConflict','orderUpdateNotification','indexes','typeOrThrow','__importDefault','_add$','forEach','change$','order','override','getImageSize','DRAWING_GROUP','onInsert','BASE64','get','__setModuleDefault','refreshTransform$','_focusDrawings','featurePluginGroupUpdateNotification','mergeTree','_getOldBySearch','anyComponent','keys','makeInvertible','call','descendPath','Mismatched\x20picks\x20and\x20drops\x20in\x20op','image/png','readCursor','URL','shallowClone','transforms','RM_UNEXPECTED_CONTENT','compose','uniSlice','_init','Cannot\x20invert\x20text\x20op:\x20Deleted\x20characters\x20missing\x20from\x20operation.\x20makeInvertible\x20must\x20be\x20called\x20first.','split','getDrawingDataForUnit','getEdit','ConflictType','_featurePluginOrderUpdate$','_featurePluginRemove$','_imageSourceCache','_waitCount','setDrawingEditable','transformWithConflictsPred','univer.drawing-manager.service','ungroupUpdateNotification','featurePluginAdd$','provides','Invalid\x20JSON\x20key','advancer','skip','getEditType','descend','2530lTWRYW','makeAppend','opThatRemovesDE','group$','registerDrawingData','container','dslice','checkComponent','ReadCursor','initializeNotification','Cannot\x20invert\x20subtype\x20','NEGATIVE_INFINITY','editOp','core.image-io.service','featurePluginUpdateNotification','deepClone','http://sharejs.org/types/text-unicode','orderNotification','getBackDrawingsOp','getOwnPropertyDescriptor','_focus$','_featurePluginAdd$','map','pendingDescent','drop','_establishDrawingMap','ERROR_EXCEED_SIZE','tryTransform','_group$','removeChild','invertSimple','Invalid\x20doc\x20/\x20op\x20in\x20makeInvertible:\x20removed\x20item\x20missing\x20from\x20doc','dispose','type','Op\x20must\x20be\x20an\x20array\x20of\x20components','featurePluginAddNotification','default','min','hasOwnProperty','eqArr','Container\x20is\x20missing\x20for\x20key','writeCursor','Subtype\x20','slice','Cannot\x20insert\x20into\x20out\x20of\x20bounds\x20index','mut','setWaitCount','_initDependencies','charCodeAt','indexOf','ascend','getBatchAddOp','updateNotification','Missing\x20type\x20in\x20edit','transformSelection','_removeByParam','moveOp','Prev\x20not\x20scalar\x20-\x20instead\x20','deepEqual','Cannot\x20merge\x20into\x20my\x20own\x20tree','addNotification','root','DRAWING_SMART_ART','number','reset','typeAllowingConflictsPred','ERROR_IMAGE_TYPE','clone','checkNonNegInteger','splice','_configService','_featurePluginUngroupUpdate$','987sRCHzA','json1','eachChildOf','build','copyAll','getImage','insOrMv','throwConflictErr','_getDrawingOrder','insert','_update$','stripInvertible','src','traverse','xfBoundary','getKey','transformEdits','descent\x20keys\x20are\x20not\x20in\x20order','Op\x20has\x20a\x20trailing\x20skip','name','resolveConflict','__importStar','onerror','_getCurrentBySearch','defineProperty','DROP_COLLISION','image/jpg','onRemove','805ugwRtU','_getUpdateParamCompareOp','_refreshTransform$','registerSubtype','featurePluginOrderUpdate$','27249mhDkVH','unshift','refreshTransform','pluginName','Cannot\x20insert\x20into\x20missing\x20item','image/jpeg','forward','parent','readAsDataURL','hasDrop','concat','dlen','getBatchUpdateOp','Invalid\x20document\x20snapshot:\x20','_decreaseWaiting','writeOp1Drop','DRAWING_TABLE','size','_hasDrawingOrder','DRAWING_VIDEO','invert','focus$','_featurePluginGroupUpdate$','Operation\x20picks\x20up\x20at\x20an\x20invalid\x20key','setDrawingOrder','_oldDrawingManagerData','_visible','_injector','Invalid\x20call\x20to\x20getKey\x20before\x20cursor\x20descended','image/gif','removeNotification','getOldDrawingByParam','backward','__default_document_sub_component_id20231101__','side\x20(','DrawingManagerService','featurePluginGroupUpdate$','17416rBVEPa','eqObj','Operation\x20makes\x20multiple\x20descents.\x20Remove\x20some\x20[]','_editable','generateRandomId','data','The\x20op\x20is\x20too\x20long\x20for\x20this\x20document','unitId','p1PickKey\x20is\x20negative','api$1','getDrawingData','isInvertible','take','getDrawingByParam','getDrawingOrder','trying\x20to\x20descend\x20to\x20a\x20negative\x20index','append','Direction\x20must\x20be\x20left\x20or\x20right','sort','5049LGzyWy','text-unicode','isObject','14730vYDjVh','UNRECOGNIZED','Deletes\x20must\x20not\x20be\x20empty','flushDescent','featurePluginRemoveNotification','applyJson1','replaceOp','write','DRAWING_DOM','__esModule','insertOp','subUnitId','uri',')\x20must\x20be\x20\x27left\x27\x20or\x20\x27right\x27','Cursor','isValidPathItem','scanOp2Drop','_remove$','pop','getDrawingShapeKeyByDrawingSearch','getPath','lcIdx','isGreaterKey','assign','visibleNotification','symbol','Inserts\x20cannot\x20be\x20empty','invertWithDoc','Transforming\x20incompatible\x20types','end','Initial\x20data\x20must\x20be\x20a\x20string','target','Trying\x20to\x20overwrite\x20value\x20at\x20key.\x20Your\x20op\x20needs\x20to\x20remove\x20it\x20first','BLACKHOLE','_updateByParam','featurePluginOrderUpdateNotification','makeTake','ImageIoService','removeOp','find','setDrawingData','\x20undefined','isNoop','http://sharejs.org/types/JSONv1','Transform\x20detected\x20write\x20conflict','componentLength','iterator','remove','result','__createBinding','_order$','front','max','normalize','writeAtPath','builder','#-#','UUID','drawingId','_ungroup$','setDrawingVisible','getComponent','removeDrawingDataForUnit','_getUngroupDrawingOp','232PbKzkp','Skip\x20components\x20must\x20be\x20>0','left','Invalid\x20path\x20key','maybeGetChild','__decorateParam','_change$'];_0x1c60=function(){return _0x12f864;};return _0x1c60();}__name(eqArr,_0x220c00(0x175));function deepEqual(_0x505f11,_0x5fc550){const _0x4e54a4=_0x220c00;return _0x505f11===_0x5fc550?!0x0:_0x505f11===null||_0x5fc550===null||typeof _0x505f11!='object'||typeof _0x5fc550!=_0x4e54a4(0xda)?!0x1:Array[_0x4e54a4(0x105)](_0x505f11)?eqArr(_0x505f11,_0x5fc550):eqObj(_0x505f11,_0x5fc550);}__name(deepEqual,_0x220c00(0x188)),deepEqual$1[_0x220c00(0x172)]=deepEqual;var deepClone$1={};Object[_0x220c00(0x1ae)](deepClone$1,'__esModule',{'value':!0x0});function deepClone(_0x2071ab){const _0xae4b14=_0x220c00;if(_0x2071ab===null)return null;if(Array[_0xae4b14(0x105)](_0x2071ab))return _0x2071ab['map'](deepClone);if(typeof _0x2071ab==_0xae4b14(0xda)){const _0x22433e={};for(let _0x59c41f in _0x2071ab)_0x22433e[_0x59c41f]=deepClone(_0x2071ab[_0x59c41f]);return _0x22433e;}else return _0x2071ab;}__name(deepClone,_0x220c00(0x15d)),deepClone$1[_0x220c00(0x172)]=deepClone;var cursor={};(function(_0x208db9){const _0x14959e=_0x220c00;Object[_0x14959e(0x1ae)](_0x208db9,_0x14959e(0x1fb),{'value':!0x0}),_0x208db9[_0x14959e(0x198)]=_0x208db9['advancer']=_0x208db9[_0x14959e(0x132)]=_0x208db9[_0x14959e(0x177)]=_0x208db9[_0x14959e(0xf5)]=_0x208db9[_0x14959e(0x156)]=_0x208db9['isValidPathItem']=void 0x0;function _0x261421(_0x595137,_0x3a08f9){if(!_0x595137)throw new Error(_0x3a08f9);}__name(_0x261421,'assert');const _0x6ec43f=__name(_0x53e012=>_0x53e012!=null&&typeof _0x53e012==_0x14959e(0xda)&&!Array[_0x14959e(0x105)](_0x53e012),'isObject'),_0x2c3034=__name((_0x2d85c7,_0x58b8a1)=>typeof _0x2d85c7==typeof _0x58b8a1?_0x2d85c7>_0x58b8a1:typeof _0x2d85c7==_0x14959e(0xe5)&&typeof _0x58b8a1=='number',_0x14959e(0x208));function _0x527b57(_0x4d11d1,_0x3958b0){const _0x505f47=_0x14959e;for(let _0x36c9fe in _0x4d11d1){const _0x301541=_0x36c9fe;_0x3958b0[_0x505f47(0x1f9)](_0x301541,_0x4d11d1[_0x301541]);}}__name(_0x527b57,_0x14959e(0x19a)),_0x208db9['isValidPathItem']=_0x4041b8=>typeof _0x4041b8==_0x14959e(0x18d)||typeof _0x4041b8==_0x14959e(0xe5)&&_0x4041b8!==_0x14959e(0xf7);const _0x469ab7=class _0x4cafea{constructor(_0x58390f=null){const _0x25d29c=_0x14959e;this['parents']=[],this[_0x25d29c(0x118)]=[],this['lcIdx']=-0x1,this[_0x25d29c(0xde)]=-0x1,this[_0x25d29c(0x153)]=_0x58390f;}[_0x14959e(0x180)](){const _0x54afa7=_0x14959e;_0x261421(this[_0x54afa7(0x106)][_0x54afa7(0x109)]===this['indexes'][_0x54afa7(0x109)]/0x2),this['idx']===0x0?this[_0x54afa7(0x106)]['length']?(this[_0x54afa7(0x207)]=this[_0x54afa7(0x118)][_0x54afa7(0x204)](),this[_0x54afa7(0x153)]=this[_0x54afa7(0x106)][_0x54afa7(0x204)](),this[_0x54afa7(0xde)]=this[_0x54afa7(0x118)][_0x54afa7(0x204)]()):(this[_0x54afa7(0x207)]=0x0,this[_0x54afa7(0xde)]=-0x1):(_0x261421(this['idx']>0x0),this[_0x54afa7(0xde)]--,_0x6ec43f(this['container'][this[_0x54afa7(0xde)]])&&this[_0x54afa7(0xde)]--);}[_0x14959e(0x206)](){const _0x427a6b=_0x14959e,_0x97d339=[];let _0x5baa37=this[_0x427a6b(0x153)],_0x5ec08f=this[_0x427a6b(0x106)][_0x427a6b(0x109)]-0x1,_0x4f2bef=this[_0x427a6b(0xde)];for(;_0x4f2bef>=0x0;)_0x97d339['unshift'](_0x5baa37[_0x4f2bef]),_0x4f2bef===0x0?(_0x4f2bef=this[_0x427a6b(0x118)][_0x5ec08f*0x2],_0x5baa37=this[_0x427a6b(0x106)][_0x5ec08f--]):_0x4f2bef-=_0x6ec43f(_0x5baa37[_0x4f2bef-0x1])?0x2:0x1;return _0x97d339;}};__name(_0x469ab7,_0x14959e(0x200));let _0xd7f70c=_0x469ab7;const _0x1b54ed=class _0x527b63 extends _0xd7f70c{[_0x14959e(0x124)](){const _0x194973=_0x14959e;return this[_0x194973(0x153)]?this[_0x194973(0x153)][_0x194973(0x179)](this[_0x194973(0xde)]+0x1):null;}[_0x14959e(0x1a5)](){const _0x5c0556=_0x14959e;return _0x261421(this[_0x5c0556(0x153)]!=null,_0x5c0556(0x1d3)),this['container'][this[_0x5c0556(0xde)]];}[_0x14959e(0xb5)](){const _0x2d8209=_0x14959e;let _0x4d8eae;return this[_0x2d8209(0x153)]&&this[_0x2d8209(0x153)][_0x2d8209(0x109)]>this['idx']+0x1&&_0x6ec43f(_0x4d8eae=this['container'][this['idx']+0x1])?_0x4d8eae:null;}['descendFirst'](){const _0x1c120e=_0x14959e;let _0x1b7e56=this['idx']+0x1;if(!this[_0x1c120e(0x153)]||_0x1b7e56>=this[_0x1c120e(0x153)][_0x1c120e(0x109)]||_0x6ec43f(this[_0x1c120e(0x153)][_0x1b7e56])&&_0x1b7e56+0x1>=this['container'][_0x1c120e(0x109)])return!0x1;_0x6ec43f(this[_0x1c120e(0x153)][_0x1b7e56])&&_0x1b7e56++;const _0x34507a=this[_0x1c120e(0x153)][_0x1b7e56];return Array[_0x1c120e(0x105)](_0x34507a)?(this[_0x1c120e(0x118)][_0x1c120e(0xf2)](this[_0x1c120e(0xde)]),this[_0x1c120e(0x106)][_0x1c120e(0xf2)](this['container']),this[_0x1c120e(0x118)][_0x1c120e(0xf2)](_0x1b7e56),this[_0x1c120e(0xde)]=0x0,this[_0x1c120e(0x153)]=_0x34507a):this['idx']=_0x1b7e56,!0x0;}[_0x14959e(0x108)](){const _0x3cb754=_0x14959e;if(_0x261421(this['parents'][_0x3cb754(0x109)]===this[_0x3cb754(0x118)][_0x3cb754(0x109)]/0x2),this[_0x3cb754(0xde)]>0x0||this[_0x3cb754(0x106)][_0x3cb754(0x109)]===0x0)return!0x1;const _0x41bae1=this[_0x3cb754(0x118)][this[_0x3cb754(0x118)][_0x3cb754(0x109)]-0x1]+0x1,_0x5f57c4=this[_0x3cb754(0x106)][this[_0x3cb754(0x106)][_0x3cb754(0x109)]-0x1];return _0x41bae1>=_0x5f57c4[_0x3cb754(0x109)]?!0x1:(_0x261421(!isNaN(_0x41bae1)),this[_0x3cb754(0x118)][this['indexes'][_0x3cb754(0x109)]-0x1]=_0x41bae1,this[_0x3cb754(0x153)]=_0x5f57c4[_0x41bae1],!0x0);}[_0x14959e(0x139)](_0x1e6dd4,_0x96bcc7,_0x2c140f,_0x2fb054){const _0x679e45=_0x14959e;this[_0x679e45(0x153)]=_0x1e6dd4,this[_0x679e45(0xde)]=_0x96bcc7,this[_0x679e45(0x106)]=_0x2c140f[_0x679e45(0x179)](),this[_0x679e45(0x118)]=_0x2fb054[_0x679e45(0x179)]();}[_0x14959e(0x191)](){const _0x11689a=_0x14959e,_0x4d8762=new _0x527b63();return _0x4d8762['_init'](this['container'],this[_0x11689a(0xde)],this[_0x11689a(0x106)],this[_0x11689a(0x118)]),_0x4d8762;}*[Symbol[_0x14959e(0xa6)]](){const _0x4d3afb=_0x14959e;if(this[_0x4d3afb(0x10f)]()){do yield this[_0x4d3afb(0x1a5)]();while(this[_0x4d3afb(0x108)]());this['ascend']();}}[_0x14959e(0x1a3)](_0x3aceb0,_0x2ab668){const _0x3499f1=_0x14959e,_0x5ea71a=this[_0x3499f1(0xb5)]();_0x5ea71a&&_0x2ab668(_0x5ea71a,_0x3aceb0);for(const _0x406be2 of this)_0x3aceb0&&_0x3aceb0['descend'](_0x406be2),this['traverse'](_0x3aceb0,_0x2ab668),_0x3aceb0&&_0x3aceb0[_0x3499f1(0x180)]();}['eachPick'](_0x399e81,_0x48139c){const _0x535f5b=_0x14959e;this[_0x535f5b(0x1a3)](_0x399e81,(_0x57cafc,_0x244077)=>{_0x57cafc['p']!=null&&_0x48139c(_0x57cafc['p'],_0x244077);});}[_0x14959e(0x10a)](_0x314ccd,_0x262e91){const _0x5d2419=_0x14959e;this[_0x5d2419(0x1a3)](_0x314ccd,(_0x593ccd,_0x27c51b)=>{_0x593ccd['d']!=null&&_0x262e91(_0x593ccd['d'],_0x27c51b);});}};__name(_0x1b54ed,'ReadCursor');let _0x1343eb=_0x1b54ed;_0x208db9[_0x14959e(0x156)]=_0x1343eb;const _0x51f620=class _0xacba6f extends _0xd7f70c{constructor(_0x2092bf=null){const _0x52e30c=_0x14959e;super(_0x2092bf),this[_0x52e30c(0x165)]=[],this[_0x52e30c(0xfc)]=_0x2092bf;}['flushDescent'](){const _0x3c3fc8=_0x14959e;_0x261421(this[_0x3c3fc8(0x106)][_0x3c3fc8(0x109)]===this[_0x3c3fc8(0x118)][_0x3c3fc8(0x109)]/0x2),this['container']===null&&(this[_0x3c3fc8(0xfc)]=this['container']=[]);for(let _0x47cbba=0x0;_0x47cbba<this[_0x3c3fc8(0x165)][_0x3c3fc8(0x109)];_0x47cbba++){const _0x53539e=this[_0x3c3fc8(0x165)][_0x47cbba];let _0xc1b0f=this['idx']+0x1;if(_0xc1b0f<this[_0x3c3fc8(0x153)]['length']&&_0x6ec43f(this['container'][_0xc1b0f])&&_0xc1b0f++,_0x261421(_0xc1b0f===this[_0x3c3fc8(0x153)][_0x3c3fc8(0x109)]||!_0x6ec43f(this['container'][_0xc1b0f])),_0xc1b0f===this[_0x3c3fc8(0x153)]['length'])this[_0x3c3fc8(0x153)][_0x3c3fc8(0xf2)](_0x53539e),this[_0x3c3fc8(0xde)]=_0xc1b0f;else{if(this[_0x3c3fc8(0x153)][_0xc1b0f]===_0x53539e)this['idx']=_0xc1b0f;else{if(!Array[_0x3c3fc8(0x105)](this[_0x3c3fc8(0x153)][_0xc1b0f])){const _0x4f9e0f=this[_0x3c3fc8(0x153)][_0x3c3fc8(0x193)](_0xc1b0f,this[_0x3c3fc8(0x153)]['length']-_0xc1b0f);this[_0x3c3fc8(0x153)]['push'](_0x4f9e0f),this['lcIdx']>-0x1&&(this[_0x3c3fc8(0x207)]=_0xc1b0f);}for(this[_0x3c3fc8(0x118)][_0x3c3fc8(0xf2)](this[_0x3c3fc8(0xde)]),this[_0x3c3fc8(0x106)][_0x3c3fc8(0xf2)](this[_0x3c3fc8(0x153)]),this[_0x3c3fc8(0x207)]!==-0x1&&(_0x261421(_0x2c3034(_0x53539e,this[_0x3c3fc8(0x153)][this[_0x3c3fc8(0x207)]][0x0])),_0xc1b0f=this[_0x3c3fc8(0x207)]+0x1,this[_0x3c3fc8(0x207)]=-0x1);_0xc1b0f<this[_0x3c3fc8(0x153)]['length']&&_0x2c3034(_0x53539e,this[_0x3c3fc8(0x153)][_0xc1b0f][0x0]);)_0xc1b0f++;if(this['indexes'][_0x3c3fc8(0xf2)](_0xc1b0f),this[_0x3c3fc8(0xde)]=0x0,_0xc1b0f<this[_0x3c3fc8(0x153)][_0x3c3fc8(0x109)]&&this[_0x3c3fc8(0x153)][_0xc1b0f][0x0]===_0x53539e)this[_0x3c3fc8(0x153)]=this['container'][_0xc1b0f];else{const _0x580e3d=[_0x53539e];this[_0x3c3fc8(0x153)]['splice'](_0xc1b0f,0x0,_0x580e3d),this['container']=_0x580e3d;}}}}this[_0x3c3fc8(0x165)][_0x3c3fc8(0x109)]=0x0;}[_0x14959e(0x18e)](){this['lcIdx']=-0x1;}[_0x14959e(0xb5)](){const _0x23baf7=_0x14959e;this[_0x23baf7(0x1f5)]();const _0x4bc5a3=this['idx']+0x1;if(_0x4bc5a3<this[_0x23baf7(0x153)][_0x23baf7(0x109)]&&_0x6ec43f(this['container'][_0x4bc5a3]))return this['container'][_0x4bc5a3];{const _0x1d36fd={};return this['container'][_0x23baf7(0x193)](_0x4bc5a3,0x0,_0x1d36fd),_0x1d36fd;}}[_0x14959e(0x1f9)](_0x3327bf,_0x2e5a50){const _0x43e133=_0x14959e,_0x5850d9=this[_0x43e133(0xb5)]();_0x261421(_0x5850d9[_0x3327bf]==null||_0x5850d9[_0x3327bf]===_0x2e5a50,'Internal\x20consistency\x20error:\x20Overwritten\x20component.\x20File\x20a\x20bug'),_0x5850d9[_0x3327bf]=_0x2e5a50;}[_0x14959e(0x124)](){const _0xcfde8a=_0x14959e;return this[_0xcfde8a(0xfc)];}['descend'](_0x4c31d9){const _0x28be9f=_0x14959e;if(!_0x208db9[_0x28be9f(0x201)](_0x4c31d9))throw Error(_0x28be9f(0x149));this[_0x28be9f(0x165)][_0x28be9f(0xf2)](_0x4c31d9);}[_0x14959e(0x12f)](_0x4b56c6){const _0x3e5ba8=_0x14959e;return this[_0x3e5ba8(0x165)][_0x3e5ba8(0xf2)](..._0x4b56c6),this;}[_0x14959e(0x180)](){const _0x2db4fd=_0x14959e;this[_0x2db4fd(0x165)][_0x2db4fd(0x109)]?this[_0x2db4fd(0x165)]['pop']():super[_0x2db4fd(0x180)]();}[_0x14959e(0x129)](_0x1a4fef,_0x11d3ef=_0x527b57){const _0x482982=_0x14959e;if(_0x1a4fef===null)return;if(_0x261421(Array[_0x482982(0x105)](_0x1a4fef)),_0x1a4fef===this['_op'])throw Error(_0x482982(0x189));const _0x1b6535=this[_0x482982(0x207)],_0x49225c=this['parents'][_0x482982(0x109)];let _0xd355f9=0x0;for(let _0x103e73=0x0;_0x103e73<_0x1a4fef[_0x482982(0x109)];_0x103e73++){const _0x1e0f51=_0x1a4fef[_0x103e73];typeof _0x1e0f51==_0x482982(0xe5)||typeof _0x1e0f51==_0x482982(0x18d)?(_0xd355f9++,this[_0x482982(0x14d)](_0x1e0f51)):Array[_0x482982(0x105)](_0x1e0f51)?this[_0x482982(0x129)](_0x1e0f51,_0x11d3ef):typeof _0x1e0f51==_0x482982(0xda)&&_0x11d3ef(_0x1e0f51,this);}for(;_0xd355f9--;)this[_0x482982(0x180)]();this[_0x482982(0x207)]=this['parents'][_0x482982(0x109)]===_0x49225c?_0x1b6535:-0x1;}['at'](_0x96fe62,_0x272e30){const _0x75f036=_0x14959e;this['descendPath'](_0x96fe62),_0x272e30(this);for(let _0x3b5e72=0x0;_0x3b5e72<_0x96fe62[_0x75f036(0x109)];_0x3b5e72++)this[_0x75f036(0x180)]();return this;}[_0x14959e(0xae)](_0xb19437,_0x396964,_0x5a0890){const _0x518499=_0x14959e;return this['at'](_0xb19437,()=>this[_0x518499(0x1f9)](_0x396964,_0x5a0890)),this[_0x518499(0x18e)](),this;}['writeMove'](_0x33e70d,_0x35122e,_0x5ca1ba=0x0){const _0xf483a7=_0x14959e;return this[_0xf483a7(0xae)](_0x33e70d,'p',_0x5ca1ba)[_0xf483a7(0xae)](_0x35122e,'d',_0x5ca1ba);}[_0x14959e(0x206)](){const _0x5b9868=_0x14959e,_0x49dcf5=super[_0x5b9868(0x206)]();return _0x49dcf5['push'](...this['pendingDescent']),_0x49dcf5;}};__name(_0x51f620,_0x14959e(0xf5));let _0x2f5d5e=_0x51f620;_0x208db9[_0x14959e(0xf5)]=_0x2f5d5e,_0x208db9['writeCursor']=()=>new _0x2f5d5e(),_0x208db9['readCursor']=_0x1a98bb=>new _0x1343eb(_0x1a98bb);function _0xae9161(_0x1cb2f8,_0x58972a,_0x3c7869){const _0x33db5e=_0x14959e;let _0x42ca0e,_0x5b107d;_0x5b107d=_0x42ca0e=_0x1cb2f8?_0x1cb2f8[_0x33db5e(0x10f)]():!0x1;function _0x1f5480(_0x59287a){const _0x1bcbb7=_0x33db5e;let _0x502d2d;for(;_0x5b107d;){const _0x1587c8=_0x502d2d=_0x1cb2f8[_0x1bcbb7(0x1a5)]();if(_0x59287a!=null){let _0x14db43=!0x1;if(_0x58972a&&typeof _0x1587c8==_0x1bcbb7(0x18d)&&(_0x502d2d=_0x58972a(_0x1587c8,_0x1cb2f8[_0x1bcbb7(0xb5)]()),_0x502d2d<0x0&&(_0x502d2d=~_0x502d2d,_0x14db43=!0x0)),_0x2c3034(_0x502d2d,_0x59287a))return null;if(_0x502d2d===_0x59287a&&!_0x14db43)return _0x1cb2f8;}_0x3c7869&&typeof _0x502d2d==_0x1bcbb7(0x18d)&&_0x3c7869(_0x502d2d,_0x1cb2f8[_0x1bcbb7(0xb5)]()),_0x5b107d=_0x1cb2f8[_0x1bcbb7(0x108)]();}return null;}return __name(_0x1f5480,_0x33db5e(0xc9)),_0x1f5480['end']=()=>{_0x42ca0e&&_0x1cb2f8['ascend']();},_0x1f5480;}__name(_0xae9161,_0x14959e(0x14a)),_0x208db9['advancer']=_0xae9161;function _0x1331b8(_0x29808a,_0x5f0d6b,_0x260cc6){const _0x48906d=_0x14959e;let _0x5a8598,_0x30af2a,_0x14cc7d,_0x1d3a90;for(_0x5a8598=_0x30af2a=_0x29808a&&_0x29808a[_0x48906d(0x10f)](),_0x14cc7d=_0x1d3a90=_0x5f0d6b&&_0x5f0d6b[_0x48906d(0x10f)]();_0x5a8598||_0x14cc7d;){let _0x441d14=_0x5a8598?_0x29808a[_0x48906d(0x1a5)]():null,_0x21ae11=_0x14cc7d?_0x5f0d6b[_0x48906d(0x1a5)]():null;_0x441d14!==null&&_0x21ae11!==null&&(_0x2c3034(_0x21ae11,_0x441d14)?_0x21ae11=null:_0x441d14!==_0x21ae11&&(_0x441d14=null)),_0x260cc6(_0x441d14==null?_0x21ae11:_0x441d14,_0x441d14!=null?_0x29808a:null,_0x21ae11!=null?_0x5f0d6b:null),_0x441d14!=null&&_0x5a8598&&(_0x5a8598=_0x29808a[_0x48906d(0x108)]()),_0x21ae11!=null&&_0x14cc7d&&(_0x14cc7d=_0x5f0d6b[_0x48906d(0x108)]());}_0x30af2a&&_0x29808a[_0x48906d(0x180)](),_0x1d3a90&&_0x5f0d6b[_0x48906d(0x180)]();}__name(_0x1331b8,_0x14959e(0x198)),_0x208db9['eachChildOf']=_0x1331b8;}(cursor));var types={};(function(_0x170b5a){const _0x5e1c89=_0x220c00;Object['defineProperty'](_0x170b5a,'__esModule',{'value':!0x0}),_0x170b5a[_0x5e1c89(0x13e)]=void 0x0,function(_0x3e6ebd){const _0x5d4c32=_0x5e1c89;_0x3e6ebd[_0x3e6ebd['RM_UNEXPECTED_CONTENT']=0x1]=_0x5d4c32(0x136),_0x3e6ebd[_0x3e6ebd['DROP_COLLISION']=0x2]=_0x5d4c32(0x1af),_0x3e6ebd[_0x3e6ebd[_0x5d4c32(0x99)]=0x3]='BLACKHOLE';}(_0x170b5a[_0x5e1c89(0x13e)]||(_0x170b5a[_0x5e1c89(0x13e)]={}));}(types));var dist={},unicount={},hasRequiredUnicount;function requireUnicount(){const _0x473112=_0x220c00;return hasRequiredUnicount||(hasRequiredUnicount=0x1,Object[_0x473112(0x1ae)](unicount,'__esModule',{'value':!0x0}),unicount[_0x473112(0x114)]=unicount[_0x473112(0xf4)]=void 0x0,unicount['strPosToUni']=(_0x4ec112,_0x416a80=_0x4ec112[_0x473112(0x109)])=>{let _0x3bcbc9=0x0,_0x591806=0x0;for(;_0x591806<_0x416a80;_0x591806++){const _0x4d4236=_0x4ec112['charCodeAt'](_0x591806);_0x4d4236>=0xd800&&_0x4d4236<=0xdfff&&(_0x3bcbc9++,_0x591806++);}if(_0x591806!==_0x416a80)throw Error('Invalid\x20offset\x20-\x20splits\x20unicode\x20bytes');return _0x591806-_0x3bcbc9;},unicount[_0x473112(0x114)]=(_0x33ffce,_0x42b70c)=>{const _0x588659=_0x473112;let _0xe2baa9=0x0;for(;_0x42b70c>0x0;_0x42b70c--){const _0x9b71e3=_0x33ffce[_0x588659(0x17e)](_0xe2baa9);_0xe2baa9+=_0x9b71e3>=0xd800&&_0x9b71e3<=0xdfff?0x2:0x1;}return _0xe2baa9;}),unicount;}__name(requireUnicount,'requireUnicount');var type={},hasRequiredType;function requireType(){return hasRequiredType||(hasRequiredType=0x1,function(_0x340334){const _0x453941=_0x4f99;Object['defineProperty'](_0x340334,'__esModule',{'value':!0x0}),_0x340334[_0x453941(0x138)]=_0x340334['dlen']=_0x340334['eachOp']=void 0x0;const _0x477683=requireUnicount(),_0x510af3=__name(_0x243867=>{const _0x58b447=_0x453941;if(!Array['isArray'](_0x243867))throw Error(_0x58b447(0x170));let _0x19a281=null;for(let _0x1d58d5=0x0;_0x1d58d5<_0x243867['length'];_0x1d58d5++){const _0xed84cb=_0x243867[_0x1d58d5];switch(typeof _0xed84cb){case'object':if(typeof _0xed84cb['d']!=_0x58b447(0x18d)&&typeof _0xed84cb['d']!=_0x58b447(0xe5))throw Error('Delete\x20must\x20be\x20number\x20or\x20string');if(_0x340334[_0x58b447(0x1c2)](_0xed84cb['d'])<=0x0)throw Error(_0x58b447(0x1f4));break;case _0x58b447(0xe5):if(!(_0xed84cb[_0x58b447(0x109)]>0x0))throw Error(_0x58b447(0x92));break;case _0x58b447(0x18d):if(!(_0xed84cb>0x0))throw Error(_0x58b447(0xb9));if(typeof _0x19a281==_0x58b447(0x18d))throw Error(_0x58b447(0xf9));break;}_0x19a281=_0xed84cb;}if(typeof _0x19a281==_0x58b447(0x18d))throw Error(_0x58b447(0x1a8));},_0x453941(0x111));function _0x456c51(_0x22f7ac,_0x3bb8ab){const _0x3f12f3=_0x453941;let _0x2960a4=0x0,_0x87106=0x0;for(let _0x161e7a=0x0;_0x161e7a<_0x22f7ac['length'];_0x161e7a++){const _0x73be2f=_0x22f7ac[_0x161e7a];switch(_0x3bb8ab(_0x73be2f,_0x2960a4,_0x87106),typeof _0x73be2f){case _0x3f12f3(0xda):_0x2960a4+=_0x340334[_0x3f12f3(0x1c2)](_0x73be2f['d']);break;case _0x3f12f3(0xe5):_0x87106+=_0x477683['strPosToUni'](_0x73be2f);break;case _0x3f12f3(0x18d):_0x2960a4+=_0x73be2f,_0x87106+=_0x73be2f;break;}}}__name(_0x456c51,'eachOp'),_0x340334['eachOp']=_0x456c51;function _0x3e32d4(_0xd3f4f,_0x616fa6){const _0x3c6a21=[],_0x26cd21=_0x105502(_0x3c6a21);return _0x456c51(_0xd3f4f,(_0x32289b,_0x4b098a,_0x335c48)=>{_0x26cd21(_0x616fa6(_0x32289b,_0x4b098a,_0x335c48));}),_0x5edc1c(_0x3c6a21);}__name(_0x3e32d4,'mapOp');const _0x14df95=__name(_0x4d499e=>_0x4d499e,'id'),_0x1ff9ce=__name(_0x1fcffc=>_0x3e32d4(_0x1fcffc,_0x14df95),_0x453941(0xad));_0x340334[_0x453941(0x1c2)]=_0x43ed76=>typeof _0x43ed76==_0x453941(0x18d)?_0x43ed76:_0x477683[_0x453941(0xf4)](_0x43ed76);const _0x105502=__name(_0x42cc5e=>_0x5ac8d9=>{const _0x43101d=_0x453941;if(!(!_0x5ac8d9||_0x5ac8d9['d']===0x0||_0x5ac8d9['d']==='')){if(_0x42cc5e['length']===0x0)_0x42cc5e[_0x43101d(0xf2)](_0x5ac8d9);else{if(typeof _0x5ac8d9==typeof _0x42cc5e[_0x42cc5e[_0x43101d(0x109)]-0x1]){if(typeof _0x5ac8d9==_0x43101d(0xda)){const _0x3be04f=_0x42cc5e[_0x42cc5e[_0x43101d(0x109)]-0x1];_0x3be04f['d']=typeof _0x3be04f['d']==_0x43101d(0xe5)&&typeof _0x5ac8d9['d']==_0x43101d(0xe5)?_0x3be04f['d']+_0x5ac8d9['d']:_0x340334[_0x43101d(0x1c2)](_0x3be04f['d'])+_0x340334['dlen'](_0x5ac8d9['d']);}else _0x42cc5e[_0x42cc5e[_0x43101d(0x109)]-0x1]+=_0x5ac8d9;}else _0x42cc5e[_0x43101d(0xf2)](_0x5ac8d9);}}},_0x453941(0x14f)),_0x47ef9c=__name(_0x51eadc=>typeof _0x51eadc==_0x453941(0x18d)?_0x51eadc:typeof _0x51eadc==_0x453941(0xe5)?_0x477683[_0x453941(0xf4)](_0x51eadc):typeof _0x51eadc['d']==_0x453941(0x18d)?_0x51eadc['d']:_0x477683[_0x453941(0xf4)](_0x51eadc['d']),_0x453941(0xa5));_0x340334[_0x453941(0x138)]=(_0x1b71cc,_0x1f4775,_0x95cee9)=>{const _0x2ce71=_0x453941,_0x15809c=_0x477683[_0x2ce71(0x114)](_0x1b71cc,_0x1f4775),_0x2a82e6=_0x95cee9==null?0x1/0x0:_0x477683['uniToStrPos'](_0x1b71cc,_0x95cee9);return _0x1b71cc['slice'](_0x15809c,_0x2a82e6);};const _0x328818=__name((_0x1df5f8,_0x4e55e7,_0x4548bd)=>typeof _0x1df5f8==_0x453941(0x18d)?_0x4548bd==null?_0x1df5f8-_0x4e55e7:Math['min'](_0x1df5f8,_0x4548bd)-_0x4e55e7:_0x340334[_0x453941(0x138)](_0x1df5f8,_0x4e55e7,_0x4548bd),_0x453941(0x154)),_0x229e13=__name(_0x1c2fc0=>{const _0x5184e8=_0x453941;let _0x4e6152=0x0,_0xd92924=0x0;return{'take':__name((_0x2274a9,_0xf890a3)=>{const _0xed8ea=_0x4f99;if(_0x4e6152===_0x1c2fc0[_0xed8ea(0x109)])return _0x2274a9===-0x1?null:_0x2274a9;const _0x53c5bc=_0x1c2fc0[_0x4e6152];let _0x2b5d8b;if(typeof _0x53c5bc==_0xed8ea(0x18d))return _0x2274a9===-0x1||_0x53c5bc-_0xd92924<=_0x2274a9?(_0x2b5d8b=_0x53c5bc-_0xd92924,++_0x4e6152,_0xd92924=0x0,_0x2b5d8b):(_0xd92924+=_0x2274a9,_0x2274a9);if(typeof _0x53c5bc==_0xed8ea(0xe5)){if(_0x2274a9===-0x1||_0xf890a3==='i'||_0x477683[_0xed8ea(0xf4)](_0x53c5bc[_0xed8ea(0x179)](_0xd92924))<=_0x2274a9)return _0x2b5d8b=_0x53c5bc[_0xed8ea(0x179)](_0xd92924),++_0x4e6152,_0xd92924=0x0,_0x2b5d8b;{const _0x2d84aa=_0xd92924+_0x477683[_0xed8ea(0x114)](_0x53c5bc[_0xed8ea(0x179)](_0xd92924),_0x2274a9);return _0x2b5d8b=_0x53c5bc[_0xed8ea(0x179)](_0xd92924,_0x2d84aa),_0xd92924=_0x2d84aa,_0x2b5d8b;}}else{if(_0x2274a9===-0x1||_0xf890a3==='d'||_0x340334[_0xed8ea(0x1c2)](_0x53c5bc['d'])-_0xd92924<=_0x2274a9)return _0x2b5d8b={'d':_0x328818(_0x53c5bc['d'],_0xd92924)},++_0x4e6152,_0xd92924=0x0,_0x2b5d8b;{let _0x3fabcd=_0x328818(_0x53c5bc['d'],_0xd92924,_0xd92924+_0x2274a9);return _0xd92924+=_0x2274a9,{'d':_0x3fabcd};}}},_0x5184e8(0x1e8)),'peek':__name(()=>_0x1c2fc0[_0x4e6152],'peek')};},_0x453941(0x9c)),_0x5edc1c=__name(_0x14599e=>(_0x14599e[_0x453941(0x109)]>0x0&&typeof _0x14599e[_0x14599e[_0x453941(0x109)]-0x1]=='number'&&_0x14599e[_0x453941(0x204)](),_0x14599e),_0x453941(0xcb));function _0x413c4a(_0x54728f,_0x3e4a2d,_0x2bd998){const _0x592f9e=_0x453941;if(_0x2bd998!==_0x592f9e(0xba)&&_0x2bd998!=='right')throw Error(_0x592f9e(0x1d9)+_0x2bd998+_0x592f9e(0x1ff));_0x510af3(_0x54728f),_0x510af3(_0x3e4a2d);const _0x47ccae=[],_0x590fb0=_0x105502(_0x47ccae),{take:_0x1ce98e,peek:_0x5e3f21}=_0x229e13(_0x54728f);for(let _0x1cbdcb=0x0;_0x1cbdcb<_0x3e4a2d[_0x592f9e(0x109)];_0x1cbdcb++){const _0x1613df=_0x3e4a2d[_0x1cbdcb];let _0xebbab5,_0x18ef36;switch(typeof _0x1613df){case _0x592f9e(0x18d):for(_0xebbab5=_0x1613df;_0xebbab5>0x0;)_0x18ef36=_0x1ce98e(_0xebbab5,'i'),_0x590fb0(_0x18ef36),typeof _0x18ef36!=_0x592f9e(0xe5)&&(_0xebbab5-=_0x47ef9c(_0x18ef36));break;case _0x592f9e(0xe5):_0x2bd998===_0x592f9e(0xba)&&typeof _0x5e3f21()==_0x592f9e(0xe5)&&_0x590fb0(_0x1ce98e(-0x1)),_0x590fb0(_0x477683[_0x592f9e(0xf4)](_0x1613df));break;case'object':for(_0xebbab5=_0x340334['dlen'](_0x1613df['d']);_0xebbab5>0x0;)switch(_0x18ef36=_0x1ce98e(_0xebbab5,'i'),typeof _0x18ef36){case _0x592f9e(0x18d):_0xebbab5-=_0x18ef36;break;case _0x592f9e(0xe5):_0x590fb0(_0x18ef36);break;case _0x592f9e(0xda):_0xebbab5-=_0x340334[_0x592f9e(0x1c2)](_0x18ef36['d']);}break;}}let _0x46c6c7;for(;_0x46c6c7=_0x1ce98e(-0x1);)_0x590fb0(_0x46c6c7);return _0x5edc1c(_0x47ccae);}__name(_0x413c4a,_0x453941(0xd8));function _0x3f07cf(_0x46bff3,_0x3891df){const _0x32c57f=_0x453941;_0x510af3(_0x46bff3),_0x510af3(_0x3891df);const _0x5e4180=[],_0x5b1bd9=_0x105502(_0x5e4180),{take:_0x5f07d1}=_0x229e13(_0x46bff3);for(let _0x424ee2=0x0;_0x424ee2<_0x3891df[_0x32c57f(0x109)];_0x424ee2++){const _0x49ea77=_0x3891df[_0x424ee2];let _0x34045f,_0x3ef010;switch(typeof _0x49ea77){case'number':for(_0x34045f=_0x49ea77;_0x34045f>0x0;)_0x3ef010=_0x5f07d1(_0x34045f,'d'),_0x5b1bd9(_0x3ef010),typeof _0x3ef010!=_0x32c57f(0xda)&&(_0x34045f-=_0x47ef9c(_0x3ef010));break;case _0x32c57f(0xe5):_0x5b1bd9(_0x49ea77);break;case'object':_0x34045f=_0x340334[_0x32c57f(0x1c2)](_0x49ea77['d']);let _0x5397a9=0x0;for(;_0x5397a9<_0x34045f;)switch(_0x3ef010=_0x5f07d1(_0x34045f-_0x5397a9,'d'),typeof _0x3ef010){case _0x32c57f(0x18d):_0x5b1bd9({'d':_0x328818(_0x49ea77['d'],_0x5397a9,_0x5397a9+_0x3ef010)}),_0x5397a9+=_0x3ef010;break;case _0x32c57f(0xe5):_0x5397a9+=_0x477683[_0x32c57f(0xf4)](_0x3ef010);break;case _0x32c57f(0xda):_0x5b1bd9(_0x3ef010);}break;}}let _0x11e8aa;for(;_0x11e8aa=_0x5f07d1(-0x1);)_0x5b1bd9(_0x11e8aa);return _0x5edc1c(_0x5e4180);}__name(_0x3f07cf,_0x453941(0x137));const _0x187932=__name((_0x144fbc,_0x3a9e1f)=>{const _0x36829d=_0x453941;let _0x5dadbc=0x0;for(let _0x98e12d=0x0;_0x98e12d<_0x3a9e1f[_0x36829d(0x109)]&&_0x144fbc>_0x5dadbc;_0x98e12d++){const _0x1a795c=_0x3a9e1f[_0x98e12d];switch(typeof _0x1a795c){case'number':{_0x5dadbc+=_0x1a795c;break;}case _0x36829d(0xe5):const _0x445979=_0x477683[_0x36829d(0xf4)](_0x1a795c);_0x5dadbc+=_0x445979,_0x144fbc+=_0x445979;break;case _0x36829d(0xda):_0x144fbc-=Math[_0x36829d(0x173)](_0x340334[_0x36829d(0x1c2)](_0x1a795c['d']),_0x144fbc-_0x5dadbc);break;}}return _0x144fbc;},_0x453941(0xe7)),_0x56a05f=__name((_0x120df0,_0x10ed91)=>typeof _0x120df0=='number'?_0x187932(_0x120df0,_0x10ed91):_0x120df0[_0x453941(0x164)](_0x1ff1c3=>_0x187932(_0x1ff1c3,_0x10ed91)),_0x453941(0x184));function _0x4d6152(_0xf38793,_0x2b26cd,_0x28209a){const _0x4c042c=_0x453941;return _0x3e32d4(_0xf38793,(_0x2eb831,_0x2b84bc)=>typeof _0x2eb831==_0x4c042c(0xda)&&typeof _0x2eb831['d']=='number'?{'d':_0x28209a['slice'](_0x2b26cd,_0x2b84bc,_0x2b84bc+_0x2eb831['d'])}:_0x2eb831);}__name(_0x4d6152,_0x453941(0x12d));function _0x328d5b(_0x55824f){return _0x3e32d4(_0x55824f,_0x58cf8f=>{const _0x26c82b=_0x4f99;switch(typeof _0x58cf8f){case'object':if(typeof _0x58cf8f['d']==_0x26c82b(0x18d))throw Error(_0x26c82b(0x13a));return _0x58cf8f['d'];case _0x26c82b(0xe5):return{'d':_0x58cf8f};case _0x26c82b(0x18d):return _0x58cf8f;}});}__name(_0x328d5b,'invert');function _0x53946c(_0x27a4a4){const _0x4ecf8c=_0x453941;return _0x3e32d4(_0x27a4a4,_0x4803ea=>typeof _0x4803ea==_0x4ecf8c(0xda)&&typeof _0x4803ea['d']==_0x4ecf8c(0xe5)?{'d':_0x477683[_0x4ecf8c(0xf4)](_0x4803ea['d'])}:_0x4803ea);}__name(_0x53946c,_0x453941(0x1a1));function _0x16cf34(_0x35a6f7){let _0x496855=!0x0;return _0x456c51(_0x35a6f7,_0x198ea0=>{const _0x271068=_0x4f99;typeof _0x198ea0=='object'&&typeof _0x198ea0['d']==_0x271068(0x18d)&&(_0x496855=!0x1);}),_0x496855;}__name(_0x16cf34,_0x453941(0x1e7));function _0x5c5116(_0x23222b){const _0x15dd22=_0x453941;return{'name':_0x15dd22(0x1f0),'uri':_0x15dd22(0x15e),'trim':_0x5edc1c,'normalize':_0x1ff9ce,'checkOp':_0x510af3,'create'(_0x5afbe6=''){const _0x35b6c6=_0x15dd22;if(typeof _0x5afbe6!='string')throw Error(_0x35b6c6(0x96));return _0x23222b[_0x35b6c6(0xcc)](_0x5afbe6);},'apply'(_0x58fd59,_0x54f8c6){const _0x2d1309=_0x15dd22;_0x510af3(_0x54f8c6);const _0xf2ee=_0x23222b[_0x2d1309(0xaf)](_0x58fd59);for(let _0x4d58ec=0x0;_0x4d58ec<_0x54f8c6[_0x2d1309(0x109)];_0x4d58ec++){const _0x3d4211=_0x54f8c6[_0x4d58ec];switch(typeof _0x3d4211){case _0x2d1309(0x18d):_0xf2ee[_0x2d1309(0x14b)](_0x3d4211);break;case'string':_0xf2ee[_0x2d1309(0x1ec)](_0x3d4211);break;case _0x2d1309(0xda):_0xf2ee['del'](_0x340334['dlen'](_0x3d4211['d']));break;}}return _0xf2ee[_0x2d1309(0x199)]();},'transform':_0x413c4a,'compose':_0x3f07cf,'transformPosition':_0x187932,'transformSelection':_0x56a05f,'isInvertible':_0x16cf34,'makeInvertible'(_0x288385,_0x510c9b){return _0x4d6152(_0x288385,_0x510c9b,_0x23222b);},'stripInvertible':_0x53946c,'invert':_0x328d5b,'invertWithDoc'(_0x4c16cc,_0x3f1d42){return _0x328d5b(_0x4d6152(_0x4c16cc,_0x3f1d42,_0x23222b));},'isNoop':__name(_0x13e540=>_0x13e540[_0x15dd22(0x109)]===0x0,'isNoop')};}__name(_0x5c5116,_0x453941(0x112)),_0x340334['default']=_0x5c5116;}(type)),type;}__name(requireType,_0x220c00(0xec));var api={},hasRequiredApi;function requireApi(){const _0x296645=_0x220c00;if(hasRequiredApi)return api;hasRequiredApi=0x1,Object[_0x296645(0x1ae)](api,'__esModule',{'value':!0x0});const _0xb2af35=requireType(),_0x104c03=requireUnicount();function _0x99ad8f(_0x32c714,_0x2b040a){return{'get':_0x32c714,'getLength'(){const _0x5cd495=_0x4f99;return _0x32c714()[_0x5cd495(0x109)];},'insert'(_0x1b346d,_0x412feb,_0x37a98b){const _0x1ac473=_0x4f99,_0x42409a=_0x104c03[_0x1ac473(0xf4)](_0x32c714(),_0x1b346d);return _0x2b040a([_0x42409a,_0x412feb],_0x37a98b);},'remove'(_0x14aedc,_0x2780d1,_0x1dd795){const _0x109665=_0x104c03['strPosToUni'](_0x32c714(),_0x14aedc);return _0x2b040a([_0x109665,{'d':_0x2780d1}],_0x1dd795);},'_onOp'(_0x2fc693){_0xb2af35['eachOp'](_0x2fc693,(_0x2d3214,_0x32f338,_0xf1e945)=>{const _0x505b71=_0x4f99;switch(typeof _0x2d3214){case'string':this[_0x505b71(0x122)]&&this[_0x505b71(0x122)](_0xf1e945,_0x2d3214);break;case _0x505b71(0xda):const _0x534eb7=_0xb2af35[_0x505b71(0x1c2)](_0x2d3214['d']);this[_0x505b71(0x1b1)]&&this['onRemove'](_0xf1e945,_0x534eb7);}});},'onInsert':null,'onRemove':null};}return __name(_0x99ad8f,_0x296645(0x1e5)),api[_0x296645(0x172)]=_0x99ad8f,_0x99ad8f[_0x296645(0x148)]={'text':!0x0},api;}__name(requireApi,'requireApi');var hasRequiredDist;function requireDist(){return hasRequiredDist||(hasRequiredDist=0x1,function(_0x212f9d){const _0x338cea=_0x4f99;var _0x340f3c=commonjsGlobal&&commonjsGlobal['__createBinding']||(Object['create']?function(_0x5530c8,_0x222094,_0x339f98,_0x4d7d6c){const _0x54b41c=_0x4f99;_0x4d7d6c===void 0x0&&(_0x4d7d6c=_0x339f98),Object[_0x54b41c(0x1ae)](_0x5530c8,_0x4d7d6c,{'enumerable':!0x0,'get':__name(function(){return _0x222094[_0x339f98];},'get')});}:function(_0x57d4cd,_0x8118b9,_0x17ffe9,_0x20e160){_0x20e160===void 0x0&&(_0x20e160=_0x17ffe9),_0x57d4cd[_0x20e160]=_0x8118b9[_0x17ffe9];}),_0x5368b1=commonjsGlobal&&commonjsGlobal[_0x338cea(0x125)]||(Object[_0x338cea(0xcc)]?function(_0xd5c28a,_0xa64e4){Object['defineProperty'](_0xd5c28a,'default',{'enumerable':!0x0,'value':_0xa64e4});}:function(_0x96f520,_0x46bcca){const _0x46ce2b=_0x338cea;_0x96f520[_0x46ce2b(0x172)]=_0x46bcca;}),_0x32470c=commonjsGlobal&&commonjsGlobal[_0x338cea(0x1ab)]||function(_0x1124bb){const _0x195941=_0x338cea;if(_0x1124bb&&_0x1124bb[_0x195941(0x1fb)])return _0x1124bb;var _0xe8ea18={};if(_0x1124bb!=null){for(var _0xdac02d in _0x1124bb)Object[_0x195941(0x174)][_0x195941(0x12e)](_0x1124bb,_0xdac02d)&&_0x340f3c(_0xe8ea18,_0x1124bb,_0xdac02d);}return _0x5368b1(_0xe8ea18,_0x1124bb),_0xe8ea18;},_0x1d6fb8=commonjsGlobal&&commonjsGlobal[_0x338cea(0x11a)]||function(_0x1f37b3){const _0x5b1f8c=_0x338cea;return _0x1f37b3&&_0x1f37b3[_0x5b1f8c(0x1fb)]?_0x1f37b3:{'default':_0x1f37b3};};Object['defineProperty'](_0x212f9d,_0x338cea(0x1fb),{'value':!0x0}),_0x212f9d[_0x338cea(0x16f)]=_0x212f9d['remove']=_0x212f9d[_0x338cea(0x19f)]=void 0x0;const _0xdd2b47=requireUnicount(),_0xeda576=_0x32470c(requireType()),_0x59bf9b=_0x1d6fb8(requireApi()),_0x54b6e8={'create'(_0x26ac16){return _0x26ac16;},'toString'(_0x23bc15){return _0x23bc15;},'builder'(_0x59b513){const _0x4cb2a9=_0x338cea;if(typeof _0x59b513!=_0x4cb2a9(0xe5))throw Error(_0x4cb2a9(0x1c4)+_0x59b513);const _0x268f8f=[];return{'skip'(_0x2703f2){const _0x48b7e5=_0x4cb2a9;let _0x337503=_0xdd2b47['uniToStrPos'](_0x59b513,_0x2703f2);if(_0x337503>_0x59b513['length'])throw Error(_0x48b7e5(0x1e2));_0x268f8f[_0x48b7e5(0xf2)](_0x59b513['slice'](0x0,_0x337503)),_0x59b513=_0x59b513[_0x48b7e5(0x179)](_0x337503);},'append'(_0x3e051e){const _0x76149f=_0x4cb2a9;_0x268f8f[_0x76149f(0xf2)](_0x3e051e);},'del'(_0x246cf9){const _0x406d6b=_0x4cb2a9;_0x59b513=_0x59b513['slice'](_0xdd2b47[_0x406d6b(0x114)](_0x59b513,_0x246cf9));},'build'(){return _0x268f8f['join']('')+_0x59b513;}};},'slice':_0xeda576[_0x338cea(0x138)]},_0x567ad9=_0xeda576[_0x338cea(0x172)](_0x54b6e8),_0xdfcb89=Object['assign'](Object[_0x338cea(0x209)]({},_0x567ad9),{'api':_0x59bf9b[_0x338cea(0x172)]});_0x212f9d['type']=_0xdfcb89,_0x212f9d['insert']=(_0x2a89bc,_0x254c0f)=>_0x254c0f[_0x338cea(0x109)]===0x0?[]:_0x2a89bc===0x0?[_0x254c0f]:[_0x2a89bc,_0x254c0f],_0x212f9d[_0x338cea(0xa7)]=(_0x57880a,_0x5a2b9e)=>_0xeda576[_0x338cea(0x1c2)](_0x5a2b9e)===0x0?[]:_0x57880a===0x0?[{'d':_0x5a2b9e}]:[_0x57880a,{'d':_0x5a2b9e}];var _0x3ff8cd=requireType();Object[_0x338cea(0x1ae)](_0x212f9d,_0x338cea(0x112),{'enumerable':!0x0,'get':__name(function(){const _0x3521c0=_0x338cea;return _0x3ff8cd[_0x3521c0(0x172)];},_0x338cea(0x124))});}(dist)),dist;}__name(requireDist,'requireDist'),function(_0x594807){const _0x176d80=_0x220c00;var _0x49de81=commonjsGlobal&&commonjsGlobal['__importDefault']||function(_0x4a3139){const _0x5e362e=_0x4f99;return _0x4a3139&&_0x4a3139[_0x5e362e(0x1fb)]?_0x4a3139:{'default':_0x4a3139};};Object['defineProperty'](_0x594807,_0x176d80(0x1fb),{'value':!0x0}),_0x594807['editOp']=_0x594807[_0x176d80(0x1f8)]=_0x594807[_0x176d80(0x1fc)]=_0x594807[_0x176d80(0x186)]=_0x594807[_0x176d80(0x9e)]=_0x594807['type']=void 0x0;const _0x992902=_0x49de81(deepEqual$1),_0x5a9c05=_0x49de81(deepClone$1),_0x44bf9f=cursor,_0x5a718e=types;function _0x27873f(_0x4636d6,_0x5efa55){if(!_0x4636d6)throw new Error(_0x5efa55);}__name(_0x27873f,'assert'),_0x594807[_0x176d80(0x16f)]={'name':_0x176d80(0x197),'uri':_0x176d80(0xa3),'readCursor':_0x44bf9f[_0x176d80(0x132)],'writeCursor':_0x44bf9f[_0x176d80(0x177)],'create':__name(_0x1217c0=>_0x1217c0,'create'),'isNoop':__name(_0x5b6866=>_0x5b6866==null,'isNoop'),'setDebug'(_0x1533b8){},'registerSubtype':_0x236573,'checkValidOp':_0x380baf,'normalize':_0x52aac9,'apply':_0x407572,'transformPosition':_0xbffed0,'compose':_0x33d6c4,'tryTransform':_0x78742,'transform':_0x45ca55,'makeInvertible':_0x121ef7,'invert':_0x2fe08b,'invertWithDoc':_0x549381,'RM_UNEXPECTED_CONTENT':_0x5a718e[_0x176d80(0x13e)][_0x176d80(0x136)],'DROP_COLLISION':_0x5a718e[_0x176d80(0x13e)][_0x176d80(0x1af)],'BLACKHOLE':_0x5a718e['ConflictType']['BLACKHOLE'],'transformNoConflict':__name((_0x523c2b,_0x1c67b3,_0x1a434c)=>_0x350104(()=>!0x0,_0x523c2b,_0x1c67b3,_0x1a434c),_0x176d80(0x116)),'typeAllowingConflictsPred':__name(_0x77af83=>Object[_0x176d80(0x209)](Object[_0x176d80(0x209)]({},_0x594807[_0x176d80(0x16f)]),{'transform':__name((_0x844398,_0x4fc48e,_0x184d7d)=>_0x350104(_0x77af83,_0x844398,_0x4fc48e,_0x184d7d),_0x176d80(0xd8))}),_0x176d80(0x18f))};const _0x12ab89=__name(_0x215321=>_0x215321?_0x215321[_0x176d80(0xb5)]():null,_0x176d80(0xb5));function _0x57cc97(_0x21972e){const _0xdd5b51=_0x176d80;return _0x21972e&&typeof _0x21972e==_0xdd5b51(0xda)&&!Array[_0xdd5b51(0x105)](_0x21972e);}__name(_0x57cc97,_0x176d80(0x1f1));const _0x541b63=__name(_0x15f996=>Array[_0x176d80(0x105)](_0x15f996)?_0x15f996[_0x176d80(0x179)]():_0x15f996!==null&&typeof _0x15f996==_0x176d80(0xda)?Object['assign']({},_0x15f996):_0x15f996,_0x176d80(0x134)),_0x45d182=__name(_0x424036=>_0x424036&&(_0x424036['p']!=null||_0x424036['r']!==void 0x0),'hasPick'),_0x2ecff3=__name(_0x3d2fc8=>_0x3d2fc8&&(_0x3d2fc8['d']!=null||_0x3d2fc8['i']!==void 0x0),_0x176d80(0x1c0));function _0x9f57f5(_0x54211a,_0x1b356e){const _0xdd12af=_0x176d80;return _0x27873f(_0x54211a!=null),typeof _0x1b356e=='number'?(_0x27873f(Array['isArray'](_0x54211a),_0xdd12af(0xd0)),(_0x54211a=_0x54211a[_0xdd12af(0x179)]())[_0xdd12af(0x193)](_0x1b356e,0x1)):(_0x27873f(_0x57cc97(_0x54211a),'Invalid\x20key\x20-\x20child\x20is\x20not\x20an\x20object'),delete(_0x54211a=Object['assign']({},_0x54211a))[_0x1b356e]),_0x54211a;}__name(_0x9f57f5,_0x176d80(0x16b));function _0x2a1af7(_0x53f0c6,_0x36e399,_0x2e5287){const _0x5d7c73=_0x176d80;return typeof _0x36e399==_0x5d7c73(0x18d)?(_0x27873f(_0x53f0c6!=null,_0x5d7c73(0x176)),_0x27873f(Array[_0x5d7c73(0x105)](_0x53f0c6),'Cannot\x20use\x20numerical\x20key\x20for\x20object\x20container'),_0x27873f(_0x53f0c6['length']>=_0x36e399,_0x5d7c73(0x17a)),_0x53f0c6[_0x5d7c73(0x193)](_0x36e399,0x0,_0x2e5287)):(_0x27873f(_0x57cc97(_0x53f0c6),_0x5d7c73(0x1bb)),_0x27873f(_0x53f0c6[_0x36e399]===void 0x0,_0x5d7c73(0x98)),_0x53f0c6[_0x36e399]=_0x2e5287),_0x2e5287;}__name(_0x2a1af7,_0x176d80(0xea)),_0x594807[_0x176d80(0x9e)]=(_0x4bcfd2,_0xe4454d=!0x0)=>_0x44bf9f['writeCursor']()[_0x176d80(0xae)](_0x4bcfd2,'r',_0xe4454d)['get'](),_0x594807[_0x176d80(0x186)]=(_0x419386,_0x546d0b)=>_0x44bf9f[_0x176d80(0x177)]()['writeMove'](_0x419386,_0x546d0b)[_0x176d80(0x124)](),_0x594807['insertOp']=(_0x323c57,_0x1d5681)=>_0x44bf9f[_0x176d80(0x177)]()[_0x176d80(0xae)](_0x323c57,'i',_0x1d5681)[_0x176d80(0x124)](),_0x594807[_0x176d80(0x1f8)]=(_0x9d9bd3,_0x49c976,_0x13a8c6)=>_0x44bf9f[_0x176d80(0x177)]()['at'](_0x9d9bd3,_0x3c13ad=>{const _0x4672fb=_0x176d80;_0x3c13ad[_0x4672fb(0x1f9)]('r',_0x49c976),_0x3c13ad[_0x4672fb(0x1f9)]('i',_0x13a8c6);})['get'](),_0x594807[_0x176d80(0x15a)]=(_0x29156d,_0x3ec523,_0x299686,_0x33e3f1=!0x1)=>_0x44bf9f[_0x176d80(0x177)]()['at'](_0x29156d,_0x871408=>_0x448bc7(_0x871408,_0x3ec523,_0x299686,_0x33e3f1))['get']();const _0x568931=__name((_0x5b732d,_0x25b006)=>_0x5b732d!=null&&(typeof _0x25b006==_0x176d80(0x18d)?Array[_0x176d80(0x105)](_0x5b732d):typeof _0x5b732d==_0x176d80(0xda)),_0x176d80(0xcd)),_0x888dd=__name((_0x394a4a,_0x4ba5fa)=>_0x568931(_0x394a4a,_0x4ba5fa)?_0x394a4a[_0x4ba5fa]:void 0x0,_0x176d80(0xbc)),_0x31220a={};function _0x236573(_0x5207d6){const _0x4ded5b=_0x176d80;let _0x59164a=_0x5207d6['type']?_0x5207d6[_0x4ded5b(0x16f)]:_0x5207d6;_0x59164a[_0x4ded5b(0x1a9)]&&(_0x31220a[_0x59164a[_0x4ded5b(0x1a9)]]=_0x59164a),_0x59164a[_0x4ded5b(0x1fe)]&&(_0x31220a[_0x59164a[_0x4ded5b(0x1fe)]]=_0x59164a);}__name(_0x236573,_0x176d80(0x1b5));const _0x2f2c98=__name(_0xd841e2=>{const _0x1e7ee9=_0x176d80,_0x2d94f8=_0x31220a[_0xd841e2];if(_0x2d94f8)return _0x2d94f8;throw Error(_0x1e7ee9(0xfe)+_0xd841e2);},_0x176d80(0x119));_0x236573(requireDist());const _0x4420db=__name((_0x803937,_0x3eac95)=>_0x803937+_0x3eac95,_0x176d80(0xd2));_0x236573({'name':'number','apply':_0x4420db,'compose':_0x4420db,'invert':__name(_0xc132bd=>-_0xc132bd,_0x176d80(0x1cb)),'transform':__name(_0x4cd8d9=>_0x4cd8d9,_0x176d80(0xd8))});const _0x4867f3=__name(_0x36c9af=>_0x36c9af==null?null:_0x36c9af['et']?_0x2f2c98(_0x36c9af['et']):_0x36c9af['es']?_0x31220a['text-unicode']:_0x36c9af[_0x176d80(0x101)]!=null?_0x31220a[_0x176d80(0x18d)]:null,_0x176d80(0x14c)),_0x3e74a8=__name(_0x258f67=>_0x258f67['es']?_0x258f67['es']:_0x258f67[_0x176d80(0x101)]!=null?_0x258f67['ena']:_0x258f67['e'],_0x176d80(0x13d)),_0x448bc7=__name((_0x52aae4,_0x23a7e2,_0xeb604f,_0x335a74=!0x1)=>{const _0x36b779=_0x176d80,[_0x40da4d,_0x1291a0]=typeof _0x23a7e2==_0x36b779(0xe5)?[_0x2f2c98(_0x23a7e2),_0x23a7e2]:[_0x23a7e2,_0x23a7e2[_0x36b779(0x1a9)]];!_0x335a74&&_0x40da4d[_0x36b779(0xa2)]&&_0x40da4d[_0x36b779(0xa2)](_0xeb604f)||(_0x1291a0===_0x36b779(0x18d)?_0x52aae4[_0x36b779(0x1f9)]('ena',_0xeb604f):_0x1291a0===_0x36b779(0x1f0)?_0x52aae4[_0x36b779(0x1f9)]('es',_0xeb604f):(_0x52aae4['write']('et',_0x1291a0),_0x52aae4[_0x36b779(0x1f9)]('e',_0xeb604f)));},'writeEdit');function _0x316f36(_0x3eff48){const _0x5abb24=_0x176d80;_0x27873f(typeof _0x3eff48==_0x5abb24(0x18d)),_0x27873f(_0x3eff48>=0x0),_0x27873f(_0x3eff48===(0x0|_0x3eff48));}__name(_0x316f36,_0x176d80(0x192));function _0x4cca41(_0x24e986){const _0x571bb8=_0x176d80;typeof _0x24e986==_0x571bb8(0x18d)?_0x316f36(_0x24e986):_0x27873f(typeof _0x24e986==_0x571bb8(0xe5));}__name(_0x4cca41,'checkScalar');function _0x380baf(_0x5d2070){const _0x151346=_0x176d80;if(_0x5d2070===null)return;const _0x3c3251=new Set(),_0x371128=new Set(),_0x35b8bc=__name(_0x2afc5c=>{const _0x384a97=_0x4f99;let _0x108187=!0x0,_0x1b4a0a=!0x1;for(let _0x2950ae in _0x2afc5c){const _0x6c4cff=_0x2afc5c[_0x2950ae];if(_0x108187=!0x1,_0x27873f(_0x2950ae==='p'||_0x2950ae==='r'||_0x2950ae==='d'||_0x2950ae==='i'||_0x2950ae==='e'||_0x2950ae==='es'||_0x2950ae===_0x384a97(0x101)||_0x2950ae==='et',_0x384a97(0xc3)+_0x2950ae+'\x27'),_0x2950ae==='p')_0x316f36(_0x6c4cff),_0x27873f(!_0x3c3251['has'](_0x6c4cff)),_0x3c3251['add'](_0x6c4cff),_0x27873f(_0x2afc5c['r']===void 0x0);else{if(_0x2950ae==='d')_0x316f36(_0x6c4cff),_0x27873f(!_0x371128[_0x384a97(0xd9)](_0x6c4cff)),_0x371128[_0x384a97(0xd2)](_0x6c4cff),_0x27873f(_0x2afc5c['i']===void 0x0);else{if(_0x2950ae==='e'||_0x2950ae==='es'||_0x2950ae===_0x384a97(0x101)){_0x27873f(!_0x1b4a0a),_0x1b4a0a=!0x0;const _0x214d6d=_0x4867f3(_0x2afc5c);_0x27873f(_0x214d6d,_0x384a97(0x183)),_0x214d6d[_0x384a97(0xf3)]&&_0x214d6d[_0x384a97(0xf3)](_0x3e74a8(_0x2afc5c));}}}}_0x27873f(!_0x108187);},_0x151346(0x155)),_0x17bb08=__name((_0x46d79c,_0xf207d6,_0x373d20)=>{const _0x3c09cc=_0x151346;if(!Array['isArray'](_0x46d79c))throw Error(_0x3c09cc(0x113));if(_0x46d79c[_0x3c09cc(0x109)]===0x0)throw Error('Empty\x20descent');_0xf207d6||_0x4cca41(_0x46d79c[0x0]);let _0x332078=0x1,_0x30007b=0x0,_0xdb7ec7=0x0;for(let _0x193467=0x0;_0x193467<_0x46d79c[_0x3c09cc(0x109)];_0x193467++){const _0x27d31d=_0x46d79c[_0x193467];if(_0x27873f(_0x27d31d!=null),Array[_0x3c09cc(0x105)](_0x27d31d)){const _0x4012de=_0x17bb08(_0x27d31d,!0x1);if(_0x30007b){const _0x1964a7=typeof _0xdb7ec7,_0x3be317=typeof _0x4012de;_0x1964a7===_0x3be317?_0x27873f(_0xdb7ec7<_0x4012de,_0x3c09cc(0x1a7)):_0x27873f(_0x1964a7===_0x3c09cc(0x18d)&&_0x3be317===_0x3c09cc(0xe5));}_0xdb7ec7=_0x4012de,_0x30007b++,_0x332078=0x3;}else typeof _0x27d31d==_0x3c09cc(0xda)?(_0x27873f(_0x332078===0x1,_0x3c09cc(0x187)+_0x332078),_0x35b8bc(_0x27d31d),_0x332078=0x2):(_0x27873f(_0x332078!==0x3),_0x4cca41(_0x27d31d),_0x27873f(_0x44bf9f[_0x3c09cc(0x201)](_0x27d31d),_0x3c09cc(0xbb)),_0x332078=0x1);}return _0x27873f(_0x30007b!==0x1,_0x3c09cc(0x1de)),_0x27873f(_0x332078===0x2||_0x332078===0x3),_0x46d79c[0x0];},'checkDescent');_0x17bb08(_0x5d2070,!0x0),_0x27873f(_0x3c3251['size']===_0x371128[_0x151346(0x1c8)],_0x151346(0x130));for(let _0x2c9f32=0x0;_0x2c9f32<_0x3c3251[_0x151346(0x1c8)];_0x2c9f32++)_0x27873f(_0x3c3251[_0x151346(0xd9)](_0x2c9f32)),_0x27873f(_0x371128[_0x151346(0xd9)](_0x2c9f32));}__name(_0x380baf,'checkValidOp');function _0x52aac9(_0x4b5f4f){const _0x52cb20=_0x176d80;let _0x5afaa7=0x0,_0x282788=[];const _0x4aec8a=_0x44bf9f['writeCursor']();return _0x4aec8a['mergeTree'](_0x4b5f4f,(_0x3d2bb8,_0x21566f)=>{const _0xd143f3=_0x4f99,_0x3e9d86=_0x4867f3(_0x3d2bb8);if(_0x3e9d86){const _0x522878=_0x3e74a8(_0x3d2bb8);_0x448bc7(_0x21566f,_0x3e9d86,_0x3e9d86[_0xd143f3(0xad)]?_0x3e9d86[_0xd143f3(0xad)](_0x522878):_0x522878);}for(const _0x2da143 of['r','p','i','d'])if(_0x3d2bb8[_0x2da143]!==void 0x0){const _0x3bbe8a=_0x2da143==='p'||_0x2da143==='d'?(_0x2e277a=_0x3d2bb8[_0x2da143],_0x282788[_0x2e277a]==null&&(_0x282788[_0x2e277a]=_0x5afaa7++),_0x282788[_0x2e277a]):_0x3d2bb8[_0x2da143];_0x21566f[_0xd143f3(0x1f9)](_0x2da143,_0x3bbe8a);}var _0x2e277a;}),_0x4aec8a[_0x52cb20(0x124)]();}__name(_0x52aac9,_0x176d80(0xad));function _0x407572(_0x5ab03c,_0x3a108b){const _0x175c31=_0x176d80;if(_0x380baf(_0x3a108b),_0x3a108b===null)return _0x5ab03c;const _0x24cc0e=[];return __name(function _0x22155f(_0x4930fb,_0x21b2f8){const _0x57e55e=_0x4f99;let _0xea2ee3=_0x4930fb,_0x291cf4=0x0,_0xdc032c={'root':_0x4930fb},_0x16e1f5=0x0,_0x31d833=_0xdc032c,_0x199742=_0x57e55e(0x18b);function _0x44493b(){const _0x289186=_0x57e55e;for(;_0x16e1f5<_0x291cf4;_0x16e1f5++){let _0x24ddb5=_0x21b2f8[_0x16e1f5];typeof _0x24ddb5!=_0x289186(0xda)&&(_0x27873f(_0x568931(_0x31d833,_0x199742)),_0x31d833=_0x31d833[_0x199742]=_0x541b63(_0x31d833[_0x199742]),_0x199742=_0x24ddb5);}}for(__name(_0x44493b,_0x57e55e(0x17b));_0x291cf4<_0x21b2f8[_0x57e55e(0x109)];_0x291cf4++){const _0x3c99cb=_0x21b2f8[_0x291cf4];if(Array[_0x57e55e(0x105)](_0x3c99cb)){const _0x27d793=_0x22155f(_0xea2ee3,_0x3c99cb);_0x27d793!==_0xea2ee3&&_0x27d793!==void 0x0&&(_0x44493b(),_0xea2ee3=_0x31d833[_0x199742]=_0x27d793);}else{if(typeof _0x3c99cb=='object'){_0x3c99cb['d']!=null?(_0x44493b(),_0xea2ee3=_0x2a1af7(_0x31d833,_0x199742,_0x24cc0e[_0x3c99cb['d']])):_0x3c99cb['i']!==void 0x0&&(_0x44493b(),_0xea2ee3=_0x2a1af7(_0x31d833,_0x199742,_0x3c99cb['i']));const _0x21f136=_0x4867f3(_0x3c99cb);if(_0x21f136)_0x44493b(),_0xea2ee3=_0x31d833[_0x199742]=_0x21f136[_0x57e55e(0xfd)](_0xea2ee3,_0x3e74a8(_0x3c99cb));else{if(_0x3c99cb['e']!==void 0x0)throw Error(_0x57e55e(0x178)+_0x3c99cb['et']+_0x57e55e(0xa1));}}else _0xea2ee3=_0x888dd(_0xea2ee3,_0x3c99cb);}}return _0xdc032c[_0x57e55e(0x18b)];},_0x175c31(0x166))(_0x5ab03c=__name(function _0x34660f(_0x4e1d0a,_0x2d0354){const _0x2f875a=_0x175c31,_0x4c825b=[];let _0x2bd60b=0x0;for(;_0x2bd60b<_0x2d0354[_0x2f875a(0x109)];_0x2bd60b++){const _0x48b052=_0x2d0354[_0x2bd60b];if(Array[_0x2f875a(0x105)](_0x48b052))break;typeof _0x48b052!=_0x2f875a(0xda)&&(_0x4c825b[_0x2f875a(0xf2)](_0x4e1d0a),_0x4e1d0a=_0x888dd(_0x4e1d0a,_0x48b052));}for(let _0xeae9f4=_0x2d0354['length']-0x1;_0xeae9f4>=_0x2bd60b;_0xeae9f4--)_0x4e1d0a=_0x34660f(_0x4e1d0a,_0x2d0354[_0xeae9f4]);for(--_0x2bd60b;_0x2bd60b>=0x0;_0x2bd60b--){const _0x1e69ab=_0x2d0354[_0x2bd60b];if(typeof _0x1e69ab!=_0x2f875a(0xda)){const _0x1eeea9=_0x4c825b[_0x2f875a(0x204)]();_0x4e1d0a=_0x4e1d0a===_0x888dd(_0x1eeea9,_0x1e69ab)?_0x1eeea9:_0x4e1d0a===void 0x0?_0x9f57f5(_0x1eeea9,_0x1e69ab):(_0x4acf4a=_0x1e69ab,_0x422363=_0x4e1d0a,(_0x4b01d7=_0x541b63(_0x4b01d7=_0x1eeea9))[_0x4acf4a]=_0x422363,_0x4b01d7);}else _0x45d182(_0x1e69ab)&&(_0x27873f(_0x4e1d0a!==void 0x0,'Cannot\x20pick\x20up\x20or\x20remove\x20undefined'),_0x1e69ab['p']!=null&&(_0x24cc0e[_0x1e69ab['p']]=_0x4e1d0a),_0x4e1d0a=void 0x0);}var _0x4b01d7,_0x4acf4a,_0x422363;return _0x4e1d0a;},_0x175c31(0xe8))(_0x5ab03c,_0x3a108b),_0x3a108b);}__name(_0x407572,'apply');function _0xbffed0(_0x46c50d,_0x55c777){const _0x511d3c=_0x176d80;_0x46c50d=_0x46c50d[_0x511d3c(0x179)](),_0x380baf(_0x55c777);const _0x3e9517=_0x44bf9f[_0x511d3c(0x132)](_0x55c777);let _0x2b5789,_0x4933a4,_0x3ab355=!0x1;const _0x55d444=[];for(let _0x1901d6=0x0;;_0x1901d6++){const _0x2ad91c=_0x46c50d[_0x1901d6],_0x17f52d=_0x3e9517[_0x511d3c(0xb5)]();if(_0x17f52d&&(_0x17f52d['r']!==void 0x0?_0x3ab355=!0x0:_0x17f52d['p']!=null&&(_0x3ab355=!0x1,_0x2b5789=_0x17f52d['p'],_0x4933a4=_0x1901d6)),_0x1901d6>=_0x46c50d[_0x511d3c(0x109)])break;let _0x2e7420=0x0;const _0x22daa8=_0x44bf9f[_0x511d3c(0x14a)](_0x3e9517,void 0x0,(_0x51d7d5,_0x2cda37)=>{_0x45d182(_0x2cda37)&&_0x2e7420++;});_0x55d444[_0x511d3c(0x1b8)](_0x22daa8);const _0x54fcc5=_0x22daa8(_0x2ad91c);if(typeof _0x2ad91c==_0x511d3c(0x18d)&&(_0x46c50d[_0x1901d6]-=_0x2e7420),!_0x54fcc5)break;}if(_0x55d444['forEach'](_0x228695=>_0x228695['end']()),_0x3ab355)return null;const _0x1cdf44=__name(()=>{const _0x2391d9=_0x511d3c;let _0x3aa281=0x0;if(_0x2b5789!=null){const _0x45e6aa=_0x3e9517['getPath']();_0x3aa281=_0x45e6aa[_0x2391d9(0x109)],_0x46c50d=_0x45e6aa[_0x2391d9(0x1c1)](_0x46c50d['slice'](_0x4933a4));}for(;_0x3aa281<_0x46c50d[_0x2391d9(0x109)];_0x3aa281++){const _0x5e768a=_0x46c50d[_0x3aa281],_0x509086=_0x12ab89(_0x3e9517),_0x12c717=_0x4867f3(_0x509086);if(_0x12c717){const _0x35fbcd=_0x3e74a8(_0x509086);_0x12c717['transformPosition']&&(_0x46c50d[_0x3aa281]=_0x12c717['transformPosition'](_0x46c50d[_0x3aa281],_0x35fbcd));break;}let _0x536c24=0x0;const _0x1985ef=_0x44bf9f[_0x2391d9(0x14a)](_0x3e9517,(_0x3fd8bd,_0x44b8e5)=>_0x2ecff3(_0x44b8e5)?~(_0x3fd8bd-_0x536c24):_0x3fd8bd-_0x536c24,(_0xffeae0,_0x37c812)=>{_0x2ecff3(_0x37c812)&&_0x536c24++;})(_0x5e768a);if(typeof _0x5e768a==_0x2391d9(0x18d)&&(_0x46c50d[_0x3aa281]+=_0x536c24),!_0x1985ef)break;}},_0x511d3c(0xdf));return _0x2b5789!=null?_0x3e9517[_0x511d3c(0x10a)](null,_0x49f90f=>{_0x49f90f===_0x2b5789&&_0x1cdf44();}):_0x1cdf44(),_0x46c50d;}__name(_0xbffed0,'transformPosition');function _0x33d6c4(_0x3d6a94,_0x477338){const _0x2fe1b8=_0x176d80;if(_0x380baf(_0x3d6a94),_0x380baf(_0x477338),_0x3d6a94==null)return _0x477338;if(_0x477338==null)return _0x3d6a94;let _0x521f75=0x0;const _0x3d1675=_0x44bf9f[_0x2fe1b8(0x132)](_0x3d6a94),_0x4e0f40=_0x44bf9f[_0x2fe1b8(0x132)](_0x477338),_0x5999b4=_0x44bf9f[_0x2fe1b8(0x177)](),_0x186e9a=[],_0x5ec6ea=[],_0x1f894e=[],_0x4aca9b=[],_0x45c546=[],_0x408c2a=[],_0x5f4c0b=new Set();_0x3d1675[_0x2fe1b8(0x1a3)](null,_0x32f890=>{_0x32f890['p']!=null&&(_0x1f894e[_0x32f890['p']]=_0x3d1675['clone']());}),_0x4e0f40[_0x2fe1b8(0x1a3)](null,_0x22469f=>{_0x22469f['d']!=null&&(_0x4aca9b[_0x22469f['d']]=_0x4e0f40['clone']());});const _0x55d7d5=_0x44bf9f['writeCursor']();return __name(function _0x5e90db(_0x30f4fd,_0x4dbd74,_0x51df24,_0x2c7a2f,_0x32917d,_0x46c03a,_0x56af7c,_0x1af63d){const _0x120e3a=_0x2fe1b8;_0x27873f(_0x4dbd74||_0x51df24);const _0x128e08=_0x12ab89(_0x4dbd74),_0x239d5a=_0x12ab89(_0x51df24),_0x4f4f43=!!_0x239d5a&&_0x239d5a['r']!==void 0x0,_0x4c76fa=!!_0x128e08&&_0x128e08['i']!==void 0x0,_0x5730c6=_0x128e08?_0x128e08['d']:null,_0x597db3=_0x239d5a?_0x239d5a['p']:null,_0x25c76e=(_0x46c03a||_0x4f4f43)&&_0x597db3==null;if(_0x597db3!=null)_0x2c7a2f=_0x4aca9b[_0x597db3],_0x56af7c=_0x5ec6ea[_0x597db3]=new _0x44bf9f[(_0x120e3a(0xf5))]();else{if(_0x239d5a&&_0x239d5a['r']!==void 0x0)_0x2c7a2f=null;else{const _0x2bb526=_0x12ab89(_0x2c7a2f);_0x2bb526&&_0x2bb526['d']!=null&&(_0x2c7a2f=null);}}const _0x69c177=_0x12ab89(_0x2c7a2f);if(_0x5730c6!=null){if(_0x30f4fd=_0x1f894e[_0x5730c6],_0x1af63d=_0x186e9a[_0x5730c6]=new _0x44bf9f[(_0x120e3a(0xf5))](),_0x25c76e)_0x46c03a&&!_0x4f4f43&&_0x1af63d[_0x120e3a(0x1f9)]('r',!0x0);else{const _0x2cf98f=_0x45c546[_0x5730c6]=_0x521f75++;_0x56af7c[_0x120e3a(0x1f9)]('d',_0x2cf98f);}}else{if(_0x128e08&&_0x128e08['i']!==void 0x0)_0x30f4fd=null;else{const _0x78deb8=_0x12ab89(_0x30f4fd);_0x78deb8&&_0x78deb8['p']!=null&&(_0x30f4fd=null);}}let _0x39f561;_0x4c76fa?(_0x27873f(_0x32917d===void 0x0),_0x39f561=_0x128e08['i']):_0x39f561=_0x32917d;const _0x4190d0=(_0x597db3==null?!_0x4c76fa||_0x46c03a||_0x4f4f43:_0x39f561===void 0x0)?null:_0x56af7c['getComponent']();if(_0x597db3!=null){if(!(_0x32917d!==void 0x0||_0x4c76fa)){const _0x180992=_0x5730c6!=null?_0x45c546[_0x5730c6]:_0x521f75++;_0x408c2a[_0x597db3]=_0x180992,_0x1af63d[_0x120e3a(0x1f9)]('p',_0x180992);}}else _0x4f4f43&&(_0x4c76fa||_0x32917d!==void 0x0||(_0x239d5a['r'],_0x1af63d[_0x120e3a(0x1f9)]('r',_0x239d5a['r'])));const _0x23914a=_0x25c76e?null:_0x4867f3(_0x128e08),_0x5257d9=_0x4867f3(_0x69c177);if((_0x23914a||_0x5257d9)&&(_0x23914a&&_0x23914a[_0x120e3a(0x1a9)],_0x5257d9&&_0x5257d9[_0x120e3a(0x1a9)]),_0x23914a&&_0x5257d9){_0x27873f(_0x23914a===_0x5257d9);const _0x5c60ed=_0x3e74a8(_0x128e08),_0x437b12=_0x3e74a8(_0x69c177),_0x5a568=_0x23914a[_0x120e3a(0x137)](_0x5c60ed,_0x437b12);_0x448bc7(_0x56af7c,_0x23914a,_0x5a568),_0x5f4c0b[_0x120e3a(0xd2)](_0x69c177);}else _0x23914a?_0x448bc7(_0x56af7c,_0x23914a,_0x3e74a8(_0x128e08)):_0x5257d9&&(_0x448bc7(_0x56af7c,_0x5257d9,_0x3e74a8(_0x69c177)),_0x5f4c0b[_0x120e3a(0xd2)](_0x69c177));const _0x458cca=typeof _0x39f561=='object'&&_0x39f561!=null;let _0xfe3ad5=!0x1,_0xf39884=0x0,_0xfe3dbc=0x0,_0x5cac42=0x0,_0x483f33=0x0,_0x5c9658=0x0;const _0x5205be=_0x44bf9f[_0x120e3a(0x14a)](_0x2c7a2f,(_0x398bac,_0x2a98fc)=>_0x2ecff3(_0x2a98fc)?_0x483f33-_0x398bac-0x1:_0x398bac-_0x483f33,(_0x1de041,_0x1d87af)=>{_0x2ecff3(_0x1d87af)&&_0x483f33++;}),_0x5aef42=_0x44bf9f['advancer'](_0x30f4fd,(_0x21394f,_0x595de6)=>_0x45d182(_0x595de6)?_0xf39884-_0x21394f-0x1:_0x21394f-_0xf39884,(_0x197955,_0x46f9d0)=>{_0x45d182(_0x46f9d0)&&_0xf39884++;});if(_0x44bf9f[_0x120e3a(0x198)](_0x4dbd74,_0x51df24,(_0x2bc8cb,_0x89c22c,_0x1f48a3)=>{const _0x2ba687=_0x120e3a;let _0x5f55f3,_0x3f06d0,_0x491a73=_0x2bc8cb,_0x756265=_0x2bc8cb,_0x12de6e=_0x2bc8cb;if(typeof _0x2bc8cb=='number'){let _0x1faabb=_0x2bc8cb+_0x5cac42;_0x3f06d0=_0x5205be(_0x1faabb),_0x756265=_0x1faabb+_0x483f33;let _0x141780=_0x2bc8cb+_0xfe3dbc;_0x5f55f3=_0x5aef42(_0x141780),_0x2ecff3(_0x12ab89(_0x3f06d0))&&(_0x5f55f3=null),_0x491a73=_0x141780+_0xf39884,_0x12de6e=_0x2bc8cb+_0x5c9658,_0x27873f(_0x491a73>=0x0,_0x2ba687(0x1e4)),_0x27873f(_0x756265>=0x0,'p2DropKey\x20is\x20negative');const _0x45a470=_0x2ecff3(_0x12ab89(_0x89c22c)),_0x27055b=_0x45d182(_0x12ab89(_0x1f48a3));(_0x45a470||_0x27055b&&!_0x25c76e)&&_0x5c9658--,_0x45a470&&_0xfe3dbc--,_0x27055b&&_0x5cac42--;}else _0x5f55f3=_0x5aef42(_0x2bc8cb),_0x3f06d0=_0x5205be(_0x2bc8cb);_0x1af63d[_0x2ba687(0x14d)](_0x491a73),_0x56af7c[_0x2ba687(0x14d)](_0x756265);const _0xb3a1a6=_0x458cca&&!_0x2ecff3(_0x12ab89(_0x89c22c))?_0x39f561[_0x12de6e]:void 0x0,_0x89eda9=_0x5e90db(_0x5f55f3,_0x89c22c,_0x1f48a3,_0x3f06d0,_0xb3a1a6,_0x25c76e,_0x56af7c,_0x1af63d);var _0x3f2d8f,_0x288433,_0x49c8af;_0x458cca&&!_0x25c76e?_0xb3a1a6!==_0x89eda9&&(_0xfe3ad5||(_0x39f561=Array[_0x2ba687(0x105)](_0x39f561)?_0x39f561[_0x2ba687(0x179)]():Object[_0x2ba687(0x209)]({},_0x39f561),_0xfe3ad5=!0x0),_0x3f2d8f=_0x39f561,_0x49c8af=_0x89eda9,typeof(_0x288433=_0x12de6e)==_0x2ba687(0x18d)?(_0x27873f(Array[_0x2ba687(0x105)](_0x3f2d8f)),_0x27873f(_0x288433<_0x3f2d8f[_0x2ba687(0x109)])):(_0x27873f(!Array[_0x2ba687(0x105)](_0x3f2d8f)),_0x27873f(_0x3f2d8f[_0x288433]!==void 0x0)),_0x49c8af===void 0x0?typeof _0x288433=='number'?_0x3f2d8f[_0x2ba687(0x193)](_0x288433,0x1):delete _0x3f2d8f[_0x288433]:_0x3f2d8f[_0x288433]=_0x49c8af):_0x27873f(_0x89eda9===void 0x0),_0x56af7c[_0x2ba687(0x180)](),_0x1af63d['ascend']();}),_0x5aef42[_0x120e3a(0x95)](),_0x5205be['end'](),_0x4190d0!=null)_0x4190d0['i']=_0x39f561;else{if(!_0x46c03a&&!_0x4f4f43&&_0x597db3==null)return _0x39f561;}},_0x2fe1b8(0x1a4))(_0x3d1675,_0x3d1675[_0x2fe1b8(0x191)](),_0x4e0f40,_0x4e0f40[_0x2fe1b8(0x191)](),void 0x0,!0x1,_0x5999b4,_0x55d7d5),_0x5999b4[_0x2fe1b8(0x18e)](),_0x5999b4['mergeTree'](_0x55d7d5['get']()),_0x5999b4['reset'](),_0x5999b4[_0x2fe1b8(0x124)](),_0x186e9a['map'](_0x465855=>_0x465855['get']()),_0x5ec6ea[_0x2fe1b8(0x164)](_0x2d734e=>_0x2d734e['get']()),_0x3d1675['traverse'](_0x5999b4,(_0x3acd7d,_0x15d33e)=>{const _0x4824ff=_0x2fe1b8,_0x3cb7bc=_0x3acd7d['p'];if(_0x3cb7bc!=null){const _0x13f63a=_0x45c546[_0x3cb7bc];_0x13f63a!=null&&_0x15d33e['write']('p',_0x13f63a);const _0x424deb=_0x186e9a[_0x3cb7bc];_0x424deb&&_0x424deb['get'](),_0x424deb&&_0x15d33e[_0x4824ff(0x129)](_0x424deb['get']());}else _0x3acd7d['r']!==void 0x0&&_0x15d33e['write']('r',_0x3acd7d['r']);}),_0x5999b4['reset'](),_0x5999b4[_0x2fe1b8(0x124)](),_0x4e0f40[_0x2fe1b8(0x1a3)](_0x5999b4,(_0x18f63b,_0x4862dd)=>{const _0x3567be=_0x2fe1b8,_0xafdc55=_0x18f63b['d'];if(_0xafdc55!=null){const _0x5c294f=_0x408c2a[_0xafdc55];_0x5c294f!=null&&_0x4862dd[_0x3567be(0x1f9)]('d',_0x5c294f);const _0x54bbc1=_0x5ec6ea[_0xafdc55];_0x54bbc1&&_0x4862dd['mergeTree'](_0x54bbc1[_0x3567be(0x124)]());}else _0x18f63b['i']!==void 0x0&&_0x4862dd[_0x3567be(0x1f9)]('i',_0x18f63b['i']);const _0x232eb2=_0x4867f3(_0x18f63b);_0x232eb2&&!_0x5f4c0b[_0x3567be(0xd9)](_0x18f63b)&&_0x448bc7(_0x4862dd,_0x232eb2,_0x3e74a8(_0x18f63b));}),_0x5999b4[_0x2fe1b8(0x124)]();}__name(_0x33d6c4,_0x176d80(0x137));function _0x2fe08b(_0xecfd35){const _0x3a15ec=_0x176d80;if(_0xecfd35==null)return null;const _0x120766=new _0x44bf9f[(_0x3a15ec(0x156))](_0xecfd35),_0x29be04=new _0x44bf9f['WriteCursor']();let _0x422d89;const _0xcacfae=[],_0x50aacc=[];return __name(function _0x42e022(_0xe8f388,_0xce0cc0,_0x12054b){const _0x5c73c4=_0x3a15ec,_0x45f618=_0xe8f388[_0x5c73c4(0xb5)]();let _0x17691a,_0x879bf7=!0x1;if(_0x45f618){_0x45f618['p']!=null&&(_0xce0cc0[_0x5c73c4(0x1f9)]('d',_0x45f618['p']),_0xcacfae[_0x45f618['p']]=_0xe8f388[_0x5c73c4(0x191)]()),_0x45f618['r']!==void 0x0&&_0xce0cc0[_0x5c73c4(0x1f9)]('i',_0x45f618['r']),_0x45f618['d']!=null&&(_0xce0cc0[_0x5c73c4(0x1f9)]('p',_0x45f618['d']),_0x12054b=void 0x0),_0x45f618['i']!==void 0x0&&(_0x12054b=_0x17691a=_0x45f618['i']);const _0x5afc96=_0x4867f3(_0x45f618);_0x5afc96&&(_0x12054b===void 0x0?(_0x422d89||(_0x422d89=new Set()),_0x422d89[_0x5c73c4(0xd2)](_0x45f618)):(_0x3e74a8(_0x45f618),_0x12054b=_0x5afc96['apply'](_0x12054b,_0x3e74a8(_0x45f618)),_0x879bf7=!0x0));}let _0x2d784a=0x0;for(const _0x323602 of _0xe8f388){_0xce0cc0[_0x5c73c4(0x14d)](_0x323602);const _0x469651=typeof _0x323602==_0x5c73c4(0x18d)?_0x323602-_0x2d784a:_0x323602,_0x35ac26=_0x888dd(_0x12054b,_0x469651);_0x2ecff3(_0xe8f388[_0x5c73c4(0xb5)]())&&_0x2d784a++;const _0x252fa4=_0x42e022(_0xe8f388,_0xce0cc0,_0x35ac26);if(_0x12054b!==void 0x0&&_0x252fa4!==void 0x0){if(_0x879bf7||(_0x879bf7=!0x0,_0x12054b=_0x541b63(_0x12054b)),!_0x568931(_0x12054b,_0x469651))throw Error(_0x5c73c4(0xe2));_0x12054b[_0x469651]=_0x252fa4;}_0xce0cc0[_0x5c73c4(0x180)]();}if(_0x17691a===void 0x0)return _0x879bf7?_0x12054b:void 0x0;_0xce0cc0['write']('r',_0x12054b);},_0x3a15ec(0x16c))(_0x120766,_0x29be04,void 0x0),_0x422d89&&(_0x29be04[_0x3a15ec(0x18e)](),__name(function _0x9f595c(_0x2772fb,_0x51586c,_0x353dc0){const _0x1a5bac=_0x3a15ec,_0x2ccfa8=_0x51586c[_0x1a5bac(0xb5)]();if(_0x2ccfa8){const _0x58ee58=_0x2ccfa8['d'];if(_0x58ee58!=null&&(_0x2772fb=_0xcacfae[_0x58ee58],_0x353dc0=_0x50aacc[_0x58ee58]=_0x44bf9f[_0x1a5bac(0x177)]()),_0x422d89[_0x1a5bac(0xd9)](_0x2ccfa8)){const _0x4f61ab=_0x4867f3(_0x2ccfa8);if(!_0x4f61ab[_0x1a5bac(0x1cb)])throw Error(_0x1a5bac(0x158)+_0x4f61ab[_0x1a5bac(0x1a9)]);_0x448bc7(_0x353dc0,_0x4f61ab,_0x4f61ab[_0x1a5bac(0x1cb)](_0x3e74a8(_0x2ccfa8)));}}let _0x4fbc6b=0x0,_0x3f71f1=0x0;const _0x1366f5=_0x44bf9f[_0x1a5bac(0x14a)](_0x2772fb,(_0x326bcf,_0x4b1ac2)=>_0x45d182(_0x4b1ac2)?_0x4fbc6b-_0x326bcf-0x1:_0x326bcf-_0x4fbc6b,(_0x272cf7,_0x6229f8)=>{_0x45d182(_0x6229f8)&&_0x4fbc6b++;});for(const _0x3e47eb of _0x51586c)if(typeof _0x3e47eb==_0x1a5bac(0x18d)){const _0x8a8dfb=_0x3e47eb-_0x3f71f1,_0x9518b6=_0x1366f5(_0x8a8dfb),_0x5e9bca=_0x8a8dfb+_0x4fbc6b;_0x353dc0[_0x1a5bac(0x14d)](_0x5e9bca),_0x9f595c(_0x9518b6,_0x51586c,_0x353dc0),_0x2ecff3(_0x51586c[_0x1a5bac(0xb5)]())&&_0x3f71f1++,_0x353dc0['ascend']();}else _0x353dc0[_0x1a5bac(0x14d)](_0x3e47eb),_0x9f595c(_0x1366f5(_0x3e47eb),_0x51586c,_0x353dc0),_0x353dc0[_0x1a5bac(0x180)]();_0x1366f5[_0x1a5bac(0x95)]();},_0x3a15ec(0x1a6))(_0x120766[_0x3a15ec(0x191)](),_0x120766,_0x29be04),_0x50aacc[_0x3a15ec(0x109)]&&(_0x29be04[_0x3a15ec(0x18e)](),_0x120766[_0x3a15ec(0x1a3)](_0x29be04,(_0x3cafc7,_0x3f436f)=>{const _0x1f34cf=_0x3a15ec,_0x4b1d82=_0x3cafc7['p'];if(_0x4b1d82!=null){const _0xd0e924=_0x50aacc[_0x4b1d82];_0xd0e924&&_0xd0e924[_0x1f34cf(0x124)](),_0xd0e924&&_0x3f436f[_0x1f34cf(0x129)](_0xd0e924['get']());}}))),_0x29be04[_0x3a15ec(0x124)]();}__name(_0x2fe08b,_0x176d80(0x1cb));const _0x5e967d=__name((_0x5679fe,_0x1d3396)=>_0x5679fe['some'](_0x449ab1=>typeof _0x449ab1==_0x176d80(0xda)&&(Array[_0x176d80(0x105)](_0x449ab1)?_0x5e967d(_0x449ab1,_0x1d3396):_0x1d3396(_0x449ab1))),_0x176d80(0x12b));function _0x121ef7(_0x41575c,_0x109991){const _0x35da04=_0x176d80;if(_0x41575c==null||!_0x5e967d(_0x41575c,_0x1d34fa=>{const _0x2f239e=_0x4f99;var _0x55ea7c;return _0x1d34fa['r']!==void 0x0||((_0x55ea7c=_0x4867f3(_0x1d34fa))===null||_0x55ea7c===void 0x0?void 0x0:_0x55ea7c[_0x2f239e(0x12d)])!=null;}))return _0x41575c;const _0x4597f4=new _0x44bf9f[(_0x35da04(0x156))](_0x41575c),_0x38b622=new _0x44bf9f[(_0x35da04(0xf5))]();let _0x56dbcd=!0x1;const _0x118820=[],_0x12b787=[],_0x1d853d=__name((_0x2d3fc7,_0x2c9a7a,_0x1cc7fb)=>{const _0x797e51=_0x35da04,_0x11f8e9=_0x2d3fc7[_0x797e51(0xb5)]();let _0x40c3c5=!0x1;if(_0x11f8e9){_0x11f8e9['d']!=null&&_0x2c9a7a[_0x797e51(0x1f9)]('d',_0x11f8e9['d']),_0x11f8e9['i']!==void 0x0&&_0x2c9a7a[_0x797e51(0x1f9)]('i',_0x11f8e9['i']);const _0x17c52a=_0x11f8e9['p'];if(_0x17c52a!=null&&(_0x118820[_0x17c52a]=_0x2d3fc7[_0x797e51(0x191)](),_0x27873f(_0x1cc7fb!==void 0x0,_0x797e51(0x1ce)),_0x12b787[_0x17c52a]=_0x1cc7fb,_0x2c9a7a[_0x797e51(0x1f9)]('p',_0x11f8e9['p'])),_0x11f8e9['r']!==void 0x0&&_0x1cc7fb===void 0x0)throw Error(_0x797e51(0x16d));const _0x118715=_0x4867f3(_0x11f8e9);_0x118715&&(_0x118715[_0x797e51(0x12d)]?_0x56dbcd=!0x0:_0x448bc7(_0x2c9a7a,_0x118715,_0x3e74a8(_0x11f8e9),!0x0));}let _0x238376=0x0;for(const _0x578ac3 of _0x2d3fc7){_0x2c9a7a['descend'](_0x578ac3);const _0xf8a5b4=typeof _0x578ac3=='number'?_0x578ac3-_0x238376:_0x578ac3,_0x3efd8d=_0x888dd(_0x1cc7fb,_0xf8a5b4),_0x5156d0=_0x1d853d(_0x2d3fc7,_0x2c9a7a,_0x3efd8d);_0x3efd8d!==_0x5156d0&&(_0x40c3c5||(_0x40c3c5=!0x0,_0x1cc7fb=_0x541b63(_0x1cc7fb)),_0x5156d0===void 0x0?(_0x1cc7fb=_0x9f57f5(_0x1cc7fb,_0xf8a5b4),typeof _0x578ac3==_0x797e51(0x18d)&&_0x238376++):_0x1cc7fb[_0xf8a5b4]=_0x5156d0),_0x2c9a7a['ascend']();}return _0x11f8e9&&(_0x11f8e9['r']!==void 0x0?(_0x2c9a7a['write']('r',_0x5a9c05[_0x797e51(0x172)](_0x1cc7fb)),_0x1cc7fb=void 0x0):_0x11f8e9['p']!=null&&(_0x1cc7fb=void 0x0)),_0x1cc7fb;},_0x35da04(0xe1));return _0x1d853d(_0x4597f4,_0x38b622,_0x109991),_0x38b622[_0x35da04(0x124)](),_0x56dbcd&&(_0x38b622[_0x35da04(0x18e)](),__name(function _0x3877d3(_0x39f195,_0x136fd5,_0x361f14,_0x23f097,_0x5693cc){const _0x43ac99=_0x35da04,_0x596343=_0x136fd5[_0x43ac99(0xb5)]();if(_0x596343){_0x596343['i']!==void 0x0?(_0x23f097=_0x596343['i'],_0x5693cc=!0x0):_0x596343['d']!=null&&(_0x23f097=_0x12b787[_0x596343['d']],_0x39f195=_0x118820[_0x596343['d']],_0x5693cc=!0x1,_0x596343['d']);let _0x34880a=_0x4867f3(_0x596343);if(_0x34880a&&_0x34880a[_0x43ac99(0x12d)]){const _0x21fa36=_0x3e74a8(_0x596343);_0x448bc7(_0x361f14,_0x34880a,_0x34880a[_0x43ac99(0x12d)](_0x21fa36,_0x23f097),!0x0);}}let _0x57e304=0x0,_0x343bea=0x0;const _0x2fd0cb=_0x44bf9f[_0x43ac99(0x14a)](_0x39f195,(_0x49bea9,_0x144448)=>_0x45d182(_0x144448)?_0x57e304-_0x49bea9-0x1:_0x49bea9-_0x57e304,(_0x1fb4ba,_0x5dbb11)=>{_0x45d182(_0x5dbb11)&&_0x57e304++;});for(const _0x25a349 of _0x136fd5)if(typeof _0x25a349=='number'){const _0x40ffd7=_0x25a349-_0x343bea,_0x4fdf0f=_0x2fd0cb(_0x40ffd7),_0x67e582=_0x40ffd7+_0x57e304,_0x5f4bd7=_0x888dd(_0x23f097,_0x5693cc?_0x40ffd7:_0x67e582);_0x361f14[_0x43ac99(0x14d)](_0x25a349),_0x3877d3(_0x4fdf0f,_0x136fd5,_0x361f14,_0x5f4bd7,_0x5693cc),_0x2ecff3(_0x136fd5[_0x43ac99(0xb5)]())&&_0x343bea++,_0x361f14[_0x43ac99(0x180)]();}else{const _0x333ac7=_0x888dd(_0x23f097,_0x25a349);_0x361f14['descend'](_0x25a349),_0x3877d3(_0x2fd0cb(_0x25a349),_0x136fd5,_0x361f14,_0x333ac7,_0x5693cc),_0x361f14[_0x43ac99(0x180)]();}_0x2fd0cb[_0x43ac99(0x95)]();},'traverseDrop')(_0x4597f4[_0x35da04(0x191)](),_0x4597f4,_0x38b622,_0x109991,!0x1)),_0x38b622['get']();}__name(_0x121ef7,'makeInvertible');function _0x549381(_0x36a3c8,_0x54e79c){return _0x2fe08b(_0x121ef7(_0x36a3c8,_0x54e79c));}__name(_0x549381,_0x176d80(0x93));const _0x59ca78=__name(_0x62691d=>{const _0x2badca=_0x176d80;if(_0x62691d==null)return null;const _0x47546b=_0x62691d[_0x2badca(0x179)]();for(let _0xd193bc=0x0;_0xd193bc<_0x62691d[_0x2badca(0x109)];_0xd193bc++){const _0x1e83d3=_0x47546b[_0xd193bc];Array[_0x2badca(0x105)](_0x1e83d3)&&(_0x47546b[_0xd193bc]=_0x59ca78(_0x1e83d3));}return _0x47546b;},_0x176d80(0xfb));function _0x78742(_0x249fd3,_0x4f98d7,_0x567cde){const _0x21c5c1=_0x176d80;_0x27873f(_0x567cde===_0x21c5c1(0xba)||_0x567cde==='right',_0x21c5c1(0x1ed));const _0x5aa72d=_0x567cde===_0x21c5c1(0xba)?0x0:0x1;if(_0x4f98d7==null)return{'ok':!0x0,'result':_0x249fd3};_0x380baf(_0x249fd3),_0x380baf(_0x4f98d7);let _0x2be87b=null;const _0x5ad8fb=[],_0x525dc9=[],_0x1d8e05=[],_0x47d07a=[],_0x4ae2df=[],_0x52545b=[],_0x24f3fc=[],_0x2c4442=[],_0x2f235d=[],_0x2b3b4f=[],_0x1844c9=[],_0xae4cc9=[],_0x2f3dd6=[],_0x9da33f=[],_0x4ef074=[];let _0x2d3c34=0x0;const _0x2cd7bc=_0x44bf9f[_0x21c5c1(0x132)](_0x249fd3),_0x583947=_0x44bf9f[_0x21c5c1(0x132)](_0x4f98d7),_0x49816f=_0x44bf9f[_0x21c5c1(0x177)]();if(__name(function _0x22f2d7(_0x329313,_0x43dd5d=null,_0x4c3531){const _0x31bb04=_0x21c5c1,_0x2b39f8=_0x12ab89(_0x43dd5d);_0x2b39f8&&(_0x2b39f8['r']!==void 0x0?_0x4c3531=_0x43dd5d[_0x31bb04(0x191)]():_0x2b39f8['p']!=null&&(_0x4c3531=null,_0x52545b[_0x2b39f8['p']]=_0x329313[_0x31bb04(0x191)]()));const _0x546952=_0x329313[_0x31bb04(0xb5)]();let _0x565d65;_0x546952&&(_0x565d65=_0x546952['p'])!=null&&(_0x4ae2df[_0x565d65]=_0x43dd5d?_0x43dd5d['clone']():null,_0x1d8e05[_0x565d65]=_0x329313[_0x31bb04(0x191)](),_0x4c3531&&(_0x2b3b4f[_0x565d65]=!0x0,_0x2f235d[_0x565d65]=_0x4c3531),_0x2b39f8&&_0x2b39f8['p']!=null&&(_0x9da33f[_0x565d65]=_0x2b39f8['p']));const _0x258d1f=_0x44bf9f[_0x31bb04(0x14a)](_0x43dd5d);for(const _0x198e80 of _0x329313)_0x22f2d7(_0x329313,_0x258d1f(_0x198e80),_0x4c3531);_0x258d1f[_0x31bb04(0x95)]();},_0x21c5c1(0xd3))(_0x583947,_0x2cd7bc,null),__name(function _0x339508(_0x4e9e50,_0xe68d6b,_0x4d73fc,_0x1b7fcf,_0x3c5f04){const _0x580cb8=_0x21c5c1,_0x3b6bd3=_0x4d73fc[_0x580cb8(0xb5)]();let _0xa9ae45,_0x390369=!0x1;_0x3b6bd3&&((_0xa9ae45=_0x3b6bd3['d'])!=null?(_0x47d07a[_0xa9ae45]=_0x4d73fc[_0x580cb8(0x191)](),_0x1b7fcf!=null&&(_0x4ef074[_0x1b7fcf]==null&&(_0x4ef074[_0x1b7fcf]=[]),_0x4ef074[_0x1b7fcf][_0x580cb8(0xf2)](_0xa9ae45)),_0x4e9e50=_0x4ae2df[_0xa9ae45]||null,_0xe68d6b=_0x1d8e05[_0xa9ae45]||null,_0x2b3b4f[_0xa9ae45]?(_0x3c5f04&&(_0x1844c9[_0xa9ae45]=!0x0),_0x3c5f04=_0x2f235d[_0xa9ae45]||null):!_0x3c5f04||_0x5aa72d!==0x1&&_0x9da33f[_0xa9ae45]!=null||_0x2be87b==null&&(_0x2be87b={'type':_0x5a718e[_0x580cb8(0x13e)][_0x580cb8(0x136)],'op1':_0x594807[_0x580cb8(0x9e)](_0x3c5f04['getPath']()),'op2':_0x594807['moveOp'](_0xe68d6b[_0x580cb8(0x206)](),_0x4d73fc[_0x580cb8(0x206)]())}),_0x390369=!0x0):_0x3b6bd3['i']!==void 0x0&&(_0x4e9e50=_0xe68d6b=null,_0x390369=!0x0,_0x3c5f04&&_0x2be87b==null&&(_0x2be87b={'type':_0x5a718e['ConflictType'][_0x580cb8(0x136)],'op1':_0x594807['removeOp'](_0x3c5f04[_0x580cb8(0x206)]()),'op2':_0x594807[_0x580cb8(0x1fc)](_0x4d73fc[_0x580cb8(0x206)](),_0x3b6bd3['i'])})));const _0x8315f1=_0x12ab89(_0x4e9e50);_0x8315f1&&(_0x8315f1['r']!==void 0x0?_0x3c5f04=_0x4e9e50[_0x580cb8(0x191)]():_0x8315f1['p']!=null&&(_0x8315f1['p'],_0x1b7fcf=_0x8315f1['p'],_0x3c5f04=null));const _0x35d720=_0x4867f3(_0x3b6bd3);_0x35d720&&_0x3c5f04&&_0x2be87b==null&&(_0x2be87b={'type':_0x5a718e[_0x580cb8(0x13e)]['RM_UNEXPECTED_CONTENT'],'op1':_0x594807[_0x580cb8(0x9e)](_0x3c5f04[_0x580cb8(0x206)]()),'op2':_0x594807[_0x580cb8(0x15a)](_0x4d73fc[_0x580cb8(0x206)](),_0x35d720,_0x3e74a8(_0x3b6bd3),!0x0)});let _0x2d4250=0x0,_0x7086fa=0x0;const _0x3cdde3=_0x44bf9f[_0x580cb8(0x14a)](_0xe68d6b,(_0x4800e4,_0x365561)=>_0x45d182(_0x365561)?_0x2d4250-_0x4800e4-0x1:_0x4800e4-_0x2d4250,(_0x3b22c5,_0x1907e9)=>{_0x45d182(_0x1907e9)&&_0x2d4250++;}),_0x4ff596=_0x44bf9f['advancer'](_0x4e9e50);for(const _0x46aa64 of _0x4d73fc)if(typeof _0x46aa64==_0x580cb8(0x18d)){const _0x9ae627=_0x46aa64-_0x7086fa,_0x289acc=_0x3cdde3(_0x9ae627);_0x7086fa+=+_0x339508(_0x4ff596(_0x9ae627+_0x2d4250),_0x289acc,_0x4d73fc,_0x1b7fcf,_0x3c5f04);}else{const _0x46663e=_0x3cdde3(_0x46aa64);_0x339508(_0x4ff596(_0x46aa64),_0x46663e,_0x4d73fc,_0x1b7fcf,_0x3c5f04);}return _0x3cdde3[_0x580cb8(0x95)](),_0x4ff596[_0x580cb8(0x95)](),_0x390369;},_0x21c5c1(0x202))(_0x2cd7bc,_0x583947,_0x583947[_0x21c5c1(0x191)](),null,null),_0x47d07a[_0x21c5c1(0x164)](_0x16d5de=>_0x16d5de&&_0x16d5de[_0x21c5c1(0x124)]()),_0x2be87b)return{'ok':!0x1,'conflict':_0x2be87b};_0x1844c9['map'](_0x27ca71=>!!_0x27ca71);const _0xeb917b=[];let _0xafd4a3=null;__name(function _0x2de2af(_0x32458f,_0x55f420,_0xee77e4,_0x1ec589,_0x4f14f0){const _0x56fa4f=_0x21c5c1;let _0x45521d=!0x1;const _0x5dfadb=_0x12ab89(_0x55f420);if(_0x45d182(_0x5dfadb)){const _0x2c40ef=_0x5dfadb['p'];_0x2c40ef!=null?(_0xee77e4=_0x47d07a[_0x2c40ef],_0x1ec589=_0xae4cc9[_0x2c40ef]=_0x44bf9f[_0x56fa4f(0x177)](),_0x45521d=!0x0,_0x4f14f0=null):(_0xee77e4=null,_0x4f14f0=_0x55f420[_0x56fa4f(0x191)]());}else _0x2ecff3(_0x12ab89(_0xee77e4))&&(_0xee77e4=null);const _0x30ecdc=_0x32458f[_0x56fa4f(0xb5)]();if(_0x30ecdc){const _0x180bb0=_0x30ecdc['p'];_0x180bb0!=null?(_0x4f14f0&&(_0x2c4442[_0x180bb0]=_0x4f14f0),_0xeb917b[_0x180bb0]=_0x4f14f0||_0x5aa72d===0x1&&_0x45521d?null:_0x1ec589[_0x56fa4f(0xb5)](),_0x5ad8fb[_0x180bb0]=_0x32458f[_0x56fa4f(0x191)](),_0xee77e4&&(_0x24f3fc[_0x180bb0]=_0xee77e4[_0x56fa4f(0x191)]())):_0x30ecdc['r']!==void 0x0&&(_0x4f14f0||_0x1ec589['write']('r',!0x0),(_0x4f14f0||_0x45521d)&&(_0xafd4a3==null&&(_0xafd4a3=new Set()),_0xafd4a3['add'](_0x30ecdc)));}let _0x4fd22e=0x0,_0x5d79e7=0x0;const _0x8e7135=_0x44bf9f[_0x56fa4f(0x14a)](_0x55f420,void 0x0,(_0x614723,_0x150330)=>{_0x45d182(_0x150330)&&_0x4fd22e++;}),_0x1b6713=_0x44bf9f[_0x56fa4f(0x14a)](_0xee77e4,(_0x50e5ca,_0x510660)=>_0x2ecff3(_0x510660)?~(_0x50e5ca-_0x5d79e7):_0x50e5ca-_0x5d79e7,(_0x14d1eb,_0x243095)=>{_0x2ecff3(_0x243095)&&_0x5d79e7++;});if(_0x32458f){for(const _0x42dd19 of _0x32458f)if(typeof _0x42dd19==_0x56fa4f(0xe5)){const _0x5ee536=_0x8e7135(_0x42dd19),_0x570400=_0x1b6713(_0x42dd19);_0x1ec589[_0x56fa4f(0x14d)](_0x42dd19),_0x2de2af(_0x32458f,_0x5ee536,_0x570400,_0x1ec589,_0x4f14f0),_0x1ec589[_0x56fa4f(0x180)]();}else{const _0xf3866f=_0x8e7135(_0x42dd19),_0x4fbb1e=_0x42dd19-_0x4fd22e,_0xa90d18=_0x45d182(_0x12ab89(_0xf3866f))?null:_0x1b6713(_0x4fbb1e),_0xeea2d=_0x4fbb1e+_0x5d79e7;_0x27873f(_0xeea2d>=0x0),_0x1ec589[_0x56fa4f(0x14d)](_0xeea2d),_0x2de2af(_0x32458f,_0xf3866f,_0xa90d18,_0x1ec589,_0x4f14f0),_0x1ec589[_0x56fa4f(0x180)]();}}_0x8e7135[_0x56fa4f(0x95)](),_0x1b6713[_0x56fa4f(0x95)]();},_0x21c5c1(0xf6))(_0x2cd7bc,_0x583947,_0x583947[_0x21c5c1(0x191)](),_0x49816f,null),_0x49816f[_0x21c5c1(0x18e)]();let _0x2995f1=[];if(__name(function _0x531773(_0x306045,_0x2d8a8a,_0x1f8ace,_0x19d9de,_0xf7145b,_0x352cb4){const _0x3f4c44=_0x21c5c1;_0x27873f(_0x2d8a8a);const _0x1f3d61=_0x2d8a8a['getComponent']();let _0xd2dcef=_0x12ab89(_0x19d9de),_0x5f1808=!0x1;const _0x2a6012=__name((_0x58fe04,_0x395e05,_0x927446)=>_0x58fe04?_0x594807[_0x3f4c44(0x186)](_0x58fe04[_0x3f4c44(0x206)](),_0x395e05[_0x3f4c44(0x206)]()):_0x594807[_0x3f4c44(0x1fc)](_0x395e05['getPath'](),_0x927446['i']),_0x3f4c44(0x19c));if(_0x2ecff3(_0x1f3d61)){const _0x5255a0=_0x1f3d61['d'];_0x5255a0!=null&&(_0x525dc9[_0x5255a0]=_0x2d8a8a[_0x3f4c44(0x191)]());const _0x1729ce=_0x5255a0!=null?_0xeb917b[_0x5255a0]:null;let _0x3b0436=!0x1;if(_0x1f3d61['i']!==void 0x0||_0x5255a0!=null&&_0x1729ce){let _0x4d7edb;_0xd2dcef&&(_0xd2dcef['i']!==void 0x0||(_0x4d7edb=_0xd2dcef['d'])!=null&&!_0x2b3b4f[_0x4d7edb])&&(_0x3b0436=_0x4d7edb!=null?_0x5255a0!=null&&_0x5255a0===_0x9da33f[_0x4d7edb]:_0x992902[_0x3f4c44(0x172)](_0xd2dcef['i'],_0x1f3d61['i']),_0x3b0436||_0x4d7edb!=null&&_0x5aa72d!==0x1&&_0x9da33f[_0x4d7edb]!=null||_0x2be87b==null&&(_0x2be87b={'type':_0x5a718e['ConflictType'][_0x3f4c44(0x1af)],'op1':_0x2a6012(_0x5255a0!=null?_0x5ad8fb[_0x5255a0]:null,_0x2d8a8a,_0x1f3d61),'op2':_0x2a6012(_0x4d7edb!=null?_0x1d8e05[_0x4d7edb]:null,_0x19d9de,_0xd2dcef)})),_0x3b0436||(_0x352cb4?_0x2be87b==null&&(_0x2be87b={'type':_0x5a718e['ConflictType']['RM_UNEXPECTED_CONTENT'],'op1':_0x2a6012(_0x5255a0!=null?_0x5ad8fb[_0x5255a0]:null,_0x2d8a8a,_0x1f3d61),'op2':_0x594807[_0x3f4c44(0x9e)](_0x352cb4['getPath']())}):(_0x5255a0!=null?(_0x2995f1[_0x2d3c34]=_0x5255a0,_0xf7145b['write']('d',_0x1729ce['p']=_0x2d3c34++)):_0xf7145b['write']('i',_0x5a9c05[_0x3f4c44(0x172)](_0x1f3d61['i'])),_0x5f1808=!0x0));}else{if(_0x5255a0!=null&&!_0x1729ce){const _0x49269c=_0x2c4442[_0x5255a0];_0x49269c&&(_0x352cb4=_0x49269c[_0x3f4c44(0x191)]());}}_0x5255a0!=null?(_0x306045=_0x5ad8fb[_0x5255a0],_0x1f8ace=_0x52545b[_0x5255a0],_0x19d9de=_0x24f3fc[_0x5255a0]):_0x1f3d61['i']!==void 0x0&&(_0x306045=_0x1f8ace=null,_0x3b0436||(_0x19d9de=null));}else _0x45d182(_0x12ab89(_0x306045))&&(_0x306045=_0x1f8ace=_0x19d9de=null);const _0x2e8364=_0x12ab89(_0x306045),_0x3b4c82=_0x12ab89(_0x1f8ace);if(_0x45d182(_0x3b4c82)){const _0x410eaf=_0x3b4c82['p'];_0x3b4c82['r']!==void 0x0&&(!_0x2e8364||_0x2e8364['r']===void 0x0)||_0x2b3b4f[_0x410eaf]?(_0x19d9de=null,_0x352cb4=_0x1f8ace[_0x3f4c44(0x191)]()):_0x410eaf!=null&&(_0x19d9de=_0x47d07a[_0x410eaf],_0x5aa72d!==0x1&&_0x9da33f[_0x410eaf]!=null||((_0xf7145b=_0x2f3dd6[_0x410eaf])||(_0xf7145b=_0x2f3dd6[_0x410eaf]=_0x44bf9f[_0x3f4c44(0x177)]()),_0xf7145b[_0x3f4c44(0x18e)](),_0x352cb4=null));}else!_0x2ecff3(_0x1f3d61)&&_0x2ecff3(_0xd2dcef)&&(_0x19d9de=null);_0xd2dcef=_0x19d9de!=null?_0x19d9de[_0x3f4c44(0xb5)]():null;const _0x322dea=_0x4867f3(_0x1f3d61);if(_0x322dea){const _0x16dffb=_0x3e74a8(_0x1f3d61);if(_0x352cb4)_0x2be87b==null&&(_0x2be87b={'type':_0x5a718e[_0x3f4c44(0x13e)][_0x3f4c44(0x136)],'op1':_0x594807[_0x3f4c44(0x15a)](_0x2d8a8a[_0x3f4c44(0x206)](),_0x322dea,_0x16dffb,!0x0),'op2':_0x594807[_0x3f4c44(0x9e)](_0x352cb4[_0x3f4c44(0x206)]())});else{const _0xd5a393=_0x4867f3(_0xd2dcef);let _0x4d7171;if(_0xd5a393){if(_0x322dea!==_0xd5a393)throw Error(_0x3f4c44(0x94));const _0x23688d=_0x3e74a8(_0xd2dcef);_0x4d7171=_0x322dea[_0x3f4c44(0xd8)](_0x16dffb,_0x23688d,_0x567cde);}else _0x4d7171=_0x5a9c05[_0x3f4c44(0x172)](_0x16dffb);_0x448bc7(_0xf7145b,_0x322dea,_0x4d7171);}}let _0x29eb2d=0x0,_0x540afa=0x0,_0x28833e=0x0,_0x25746a=0x0,_0x2deaed=0x0,_0x2209c3=0x0,_0x56083e=_0x306045!=null&&_0x306045['descendFirst'](),_0x5a1231=_0x56083e;const _0x5d4d0f=_0x44bf9f[_0x3f4c44(0x14a)](_0x1f8ace,void 0x0,(_0x151168,_0x1537ae)=>{_0x45d182(_0x1537ae)&&_0x28833e++;});let _0x55968e=_0x19d9de!=null&&_0x19d9de['descendFirst'](),_0x27bd5d=_0x55968e;for(const _0x2d3737 of _0x2d8a8a)if(typeof _0x2d3737=='number'){let _0xbc0ca2;const _0x4874d7=_0x2ecff3(_0x2d8a8a[_0x3f4c44(0xb5)]()),_0x4b18ea=_0x2d3737-_0x540afa;{let _0x11b1c1;for(;_0x56083e&&typeof(_0x11b1c1=_0x306045[_0x3f4c44(0x1a5)]())=='number';){_0x11b1c1+=_0x29eb2d;const _0x1c9233=_0x306045[_0x3f4c44(0xb5)](),_0x59989d=_0x45d182(_0x1c9233);if(_0x11b1c1>_0x4b18ea||_0x11b1c1===_0x4b18ea&&(!_0x59989d||_0x5aa72d===0x0&&_0x4874d7))break;if(_0x59989d){_0x29eb2d--;const _0x147110=_0x1c9233['p'];_0x9da33f[_0x3f4c44(0xc8)](_0x147110),_0x1c9233['d'],_0x12ab89(_0x2f3dd6[_0x1c9233['d']]),_0x45d182(_0x12ab89(_0x2f3dd6[_0x1c9233['d']])),(_0x1c9233['r']===void 0x0||_0xafd4a3&&_0xafd4a3[_0x3f4c44(0xd9)](_0x1c9233))&&(_0x147110==null||!_0xeb917b[_0x147110]||_0x5aa72d!==0x1&&_0x9da33f[_0x3f4c44(0xc8)](_0x147110))||_0x2deaed--;}_0x56083e=_0x306045[_0x3f4c44(0x108)]();}_0xbc0ca2=_0x56083e&&_0x11b1c1===_0x4b18ea?_0x306045:null;}const _0x315a86=_0x4b18ea-_0x29eb2d;let _0x4fde72=_0x5d4d0f(_0x315a86);const _0x104889=_0x315a86-_0x28833e;let _0x50b7bc=null;{let _0xe7fa8b,_0x3ca159;for(;_0x55968e&&typeof(_0xe7fa8b=_0x19d9de['getKey']())==_0x3f4c44(0x18d);){_0x3ca159=_0xe7fa8b-_0x25746a;const _0x565439=_0x19d9de[_0x3f4c44(0xb5)](),_0x3b0237=_0x2ecff3(_0x565439);if(_0x3ca159>_0x104889)break;if(_0x3ca159===_0x104889){if(!_0x3b0237){_0x50b7bc=_0x19d9de;break;}{if(_0x5aa72d===0x0&&_0x4874d7){_0x50b7bc=_0x19d9de;break;}const _0x170e5d=_0x4fde72&&_0x45d182(_0x4fde72['getComponent']());if(_0x5aa72d===0x0&&_0x170e5d)break;}}if(_0x3b0237){const _0x5290a2=_0x565439['d'];_0x9da33f[_0x5290a2],_0x565439['i']===void 0x0&&(_0x2b3b4f[_0x5290a2]||_0x9da33f[_0x5290a2]!=null&&_0x5aa72d!==0x1)?(_0x2b3b4f[_0x5290a2]||_0x9da33f[_0x5290a2]!=null&&_0x5aa72d===0x0)&&(_0x25746a++,_0x2209c3--):_0x25746a++;}_0x55968e=_0x19d9de['nextSibling']();}}const _0x3376b8=_0x104889+_0x25746a+_0x2deaed+_0x2209c3;_0x27873f(_0x3376b8>=0x0,_0x3f4c44(0x1eb)),_0xf7145b[_0x3f4c44(0x14d)](_0x3376b8),_0x4874d7&&(_0xbc0ca2=_0x4fde72=_0x50b7bc=null,_0x540afa++),_0x531773(_0xbc0ca2,_0x2d8a8a,_0x4fde72,_0x50b7bc,_0xf7145b,_0x352cb4)&&_0x2209c3++,_0xf7145b[_0x3f4c44(0x180)]();}else{let _0x491618;for(;_0x56083e&&(_0x491618=_0x306045[_0x3f4c44(0x1a5)](),typeof _0x491618!=_0x3f4c44(0xe5)||!(_0x491618>_0x2d3737||_0x491618===_0x2d3737));)_0x56083e=_0x306045[_0x3f4c44(0x108)]();const _0x56caa4=_0x56083e&&_0x491618===_0x2d3737?_0x306045:null,_0x188299=_0x5d4d0f(_0x2d3737);let _0x2e2d69;for(;_0x55968e&&(_0x2e2d69=_0x19d9de[_0x3f4c44(0x1a5)](),typeof _0x2e2d69!=_0x3f4c44(0xe5)||!(_0x2e2d69>_0x2d3737||_0x2e2d69===_0x2d3737));)_0x55968e=_0x19d9de[_0x3f4c44(0x108)]();const _0x498b0e=_0x55968e&&_0x2e2d69===_0x2d3737?_0x19d9de:null;_0xf7145b['descend'](_0x2d3737),_0x531773(_0x56caa4,_0x2d8a8a,_0x188299,_0x498b0e,_0xf7145b,_0x352cb4),_0xf7145b[_0x3f4c44(0x180)]();}return _0x5d4d0f['end'](),_0x5a1231&&_0x306045['ascend'](),_0x27bd5d&&_0x19d9de[_0x3f4c44(0x180)](),_0x5f1808;},_0x21c5c1(0x1c6))(_0x2cd7bc,_0x2cd7bc['clone'](),_0x583947,_0x583947['clone'](),_0x49816f,null),_0x2be87b)return{'ok':!0x1,'conflict':_0x2be87b};_0x49816f['reset']();const _0x21324e=__name((_0x26dba2,_0x46426b,_0x527010)=>_0x26dba2['traverse'](_0x46426b,(_0x3bc331,_0xb2300d)=>{_0x3bc331['d']!=null&&_0x527010(_0x3bc331['d'],_0x26dba2,_0xb2300d);}),'eachDrop');(_0x2b3b4f[_0x21c5c1(0x109)]||_0xae4cc9['length'])&&(_0x21324e(_0x583947,_0x49816f,(_0x35f69f,_0x1da748,_0x6f6a7e)=>{const _0x37b3a5=_0x21c5c1;_0x2b3b4f[_0x35f69f]&&!_0x1844c9[_0x35f69f]&&_0x6f6a7e['write']('r',!0x0),_0xae4cc9[_0x35f69f]&&_0x6f6a7e[_0x37b3a5(0x129)](_0xae4cc9[_0x35f69f][_0x37b3a5(0x124)]());}),_0x49816f[_0x21c5c1(0x18e)]());const _0x1d08b0=[],_0x15db0d=[];if((_0x2f3dd6[_0x21c5c1(0x109)]||_0x2b3b4f['length'])&&!_0x2be87b){const _0x323747=_0x44bf9f[_0x21c5c1(0x132)](_0x59ca78(_0x49816f[_0x21c5c1(0x124)]()));if(_0x21324e(_0x323747,null,(_0x3b9a3e,_0x2cbbc5)=>{_0x1d08b0[_0x3b9a3e]=_0x2cbbc5['clone']();}),_0x2f3dd6[_0x21c5c1(0x11c)](_0x1a0459=>{const _0x312eb9=_0x21c5c1;_0x1a0459&&_0x21324e(_0x44bf9f['readCursor'](_0x1a0459[_0x312eb9(0x124)]()),null,(_0x4219ba,_0xa24871)=>{_0x1d08b0[_0x4219ba]=_0xa24871['clone']();});}),__name(function _0xef4ce2(_0x482021,_0x10e075,_0x39ce8f,_0x5d86d0,_0x5f1d1f,_0xa1c8fc){const _0x32038b=_0x21c5c1,_0x18306a=_0x12ab89(_0x10e075);if(_0x18306a&&_0x45d182(_0x18306a)){if(_0x18306a['p']!=null){const _0x37f641=_0x18306a['p'];_0x1d08b0[_0x37f641]['getPath'](),_0x39ce8f=_0x1d08b0[_0x37f641],_0x5d86d0=_0x15db0d[_0x37f641]=_0x44bf9f['writeCursor']();}else _0x18306a['r']!==void 0x0&&(_0x39ce8f=null);}else _0x2ecff3(_0x12ab89(_0x39ce8f))&&(_0x39ce8f=null);const _0x2d6495=_0x482021[_0x32038b(0xb5)]();if(_0x2d6495){let _0x25e6af;if((_0x25e6af=_0x2d6495['d'])!=null){const _0x52c696=_0x2f3dd6[_0x25e6af];_0x52c696&&(_0x52c696['get'](),_0x5d86d0[_0x32038b(0x129)](_0x52c696[_0x32038b(0x124)]()),_0x39ce8f=_0x44bf9f[_0x32038b(0x132)](_0x52c696[_0x32038b(0x124)]()));}}let _0x269915=0x0,_0xacb13a=0x0;const _0x53ea19=_0x44bf9f[_0x32038b(0x14a)](_0x10e075,void 0x0,(_0x5bd756,_0x3ec789)=>{_0x45d182(_0x3ec789)&&_0x269915--;}),_0x241210=_0x44bf9f[_0x32038b(0x14a)](_0x39ce8f,(_0x6060bd,_0x370f00)=>_0x2ecff3(_0x370f00)?-(_0x6060bd-_0xacb13a)-0x1:_0x6060bd-_0xacb13a,(_0x576601,_0xf2ae41)=>{_0x2ecff3(_0xf2ae41)&&_0xacb13a++;});for(const _0xfb801f of _0x482021)if(typeof _0xfb801f==_0x32038b(0x18d)){const _0x2fc7fa=_0x53ea19(_0xfb801f),_0x23939e=_0xfb801f+_0x269915,_0x27f0f0=_0x241210(_0x23939e),_0x279326=_0x23939e+_0xacb13a;_0x5d86d0[_0x32038b(0x14d)](_0x279326),_0xef4ce2(_0x482021,_0x2fc7fa,_0x27f0f0,_0x5d86d0),_0x5d86d0[_0x32038b(0x180)]();}else _0x5d86d0[_0x32038b(0x14d)](_0xfb801f),_0xef4ce2(_0x482021,_0x53ea19(_0xfb801f),_0x241210(_0xfb801f),_0x5d86d0),_0x5d86d0[_0x32038b(0x180)]();_0x53ea19[_0x32038b(0x95)](),_0x241210[_0x32038b(0x95)]();},_0x21c5c1(0xeb))(_0x583947,_0x323747,_0x323747['clone'](),_0x49816f),_0x49816f[_0x21c5c1(0x18e)](),_0x2be87b)return{'ok':!0x1,'conflict':_0x2be87b};if(_0x49816f[_0x21c5c1(0x124)](),_0x15db0d[_0x21c5c1(0x109)]){const _0x3d35e4=_0x15db0d[_0x21c5c1(0x164)](_0x12a391=>_0x12a391?_0x12a391['get']():null),_0x70e0b2=_0x44bf9f[_0x21c5c1(0x132)](_0x59ca78(_0x49816f['get']()));if(_0x21324e(_0x70e0b2,_0x49816f,(_0x25c497,_0x24bff4,_0x232745)=>{const _0x1376eb=_0x21c5c1,_0xc85b4=_0x3d35e4[_0x25c497];_0xc85b4&&(_0x232745[_0x1376eb(0x129)](_0xc85b4),_0x3d35e4[_0x25c497]=null);}),_0x3d35e4[_0x21c5c1(0x9f)](_0x5749c0=>_0x5749c0)){const _0x58c008=_0x44bf9f[_0x21c5c1(0x177)](),_0x5c6746=_0x44bf9f[_0x21c5c1(0x177)]();let _0x23629e=0x0,_0x2f93c0=0x0;_0x3d35e4[_0x21c5c1(0x11c)](_0x1eef0a=>{const _0x24b74e=_0x21c5c1;_0x1eef0a!=null&&_0x21324e(_0x44bf9f[_0x24b74e(0x132)](_0x1eef0a),null,_0x3ca85c=>{const _0x39d340=_0x24b74e,_0x391c14=_0x2995f1[_0x3ca85c];_0x58c008['writeMove'](_0x5ad8fb[_0x391c14]['getPath'](),_0x525dc9[_0x391c14][_0x39d340(0x206)](),_0x23629e++);const _0x27fb0a=_0x4ef074[_0x391c14];_0x27fb0a&&_0x27fb0a[_0x39d340(0x11c)](_0x288d40=>{const _0x4f4e79=_0x39d340;_0x2b3b4f[_0x288d40]||_0x5aa72d!==0x1&&_0x9da33f[_0x288d40]!=null||_0x5c6746[_0x4f4e79(0x103)](_0x1d8e05[_0x288d40]['getPath'](),_0x47d07a[_0x288d40]['getPath'](),_0x2f93c0++);});});}),_0x2be87b={'type':_0x5a718e[_0x21c5c1(0x13e)][_0x21c5c1(0x99)],'op1':_0x58c008[_0x21c5c1(0x124)](),'op2':_0x5c6746[_0x21c5c1(0x124)]()};}}}return _0x2be87b?{'ok':!0x1,'conflict':_0x2be87b}:{'ok':!0x0,'result':_0x49816f[_0x21c5c1(0x124)]()};}__name(_0x78742,_0x176d80(0x169));const _0x5d9d17=__name(_0x141200=>{const _0x558478=_0x176d80,_0x3554fd=new Error(_0x558478(0xa4));throw _0x3554fd[_0x558478(0x10d)]=_0x141200,_0x3554fd[_0x558478(0x16f)]=_0x3554fd[_0x558478(0x1a9)]=_0x558478(0xf8),_0x3554fd;},_0x176d80(0x19d));function _0x45ca55(_0x45b783,_0x38af91,_0x1cdf3b){const _0x28bf09=_0x176d80,_0x3513ff=_0x78742(_0x45b783,_0x38af91,_0x1cdf3b);if(_0x3513ff['ok'])return _0x3513ff[_0x28bf09(0xa8)];_0x5d9d17(_0x3513ff['conflict']);}__name(_0x45ca55,_0x176d80(0xd8));const _0x51509b=__name(_0x3cfb84=>{const _0xb349fe=_0x176d80,_0x15b499=_0x44bf9f[_0xb349fe(0x177)]();return _0x44bf9f[_0xb349fe(0x132)](_0x3cfb84)[_0xb349fe(0x1a3)](_0x15b499,(_0x56444c,_0x2c402b)=>{const _0x18f4ae=_0xb349fe;(_0x2ecff3(_0x56444c)||_0x4867f3(_0x56444c))&&_0x2c402b[_0x18f4ae(0x1f9)]('r',!0x0);}),_0x15b499[_0xb349fe(0x124)]();},_0x176d80(0x150)),_0x381a86=__name((_0x2f086e,_0x4c75fb)=>{const _0x3fb6e2=_0x176d80,{type:_0xf3233,op1:_0x325ba8,op2:_0x44830a}=_0x2f086e;switch(_0xf3233){case _0x5a718e[_0x3fb6e2(0x13e)][_0x3fb6e2(0x1af)]:return _0x4c75fb===_0x3fb6e2(0xba)?[null,_0x51509b(_0x44830a)]:[_0x51509b(_0x325ba8),null];case _0x5a718e['ConflictType'][_0x3fb6e2(0x136)]:let _0x8c56d1=!0x1;return _0x44bf9f[_0x3fb6e2(0x132)](_0x325ba8)['traverse'](null,_0x33b7ad=>{_0x33b7ad['r']!==void 0x0&&(_0x8c56d1=!0x0);}),_0x8c56d1?[null,_0x51509b(_0x44830a)]:[_0x51509b(_0x325ba8),null];case _0x5a718e['ConflictType'][_0x3fb6e2(0x99)]:return[_0x51509b(_0x325ba8),_0x51509b(_0x44830a)];default:throw Error('Unrecognised\x20conflict:\x20'+_0xf3233);}},_0x176d80(0x1aa));function _0x350104(_0x3d06e6,_0x4ad7b8,_0x57af5d,_0x3efecd){const _0xa6b6ab=_0x176d80;let _0x242efb=null;for(;;){const _0x45b422=_0x78742(_0x4ad7b8,_0x57af5d,_0x3efecd);if(_0x45b422['ok'])return _0x33d6c4(_0x242efb,_0x45b422[_0xa6b6ab(0xa8)]);{const {conflict:_0x1027f9}=_0x45b422;_0x3d06e6(_0x1027f9)||_0x5d9d17(_0x1027f9);const [_0x3351ec,_0x100113]=_0x381a86(_0x1027f9,_0x3efecd);_0x4ad7b8=_0x33d6c4(_0x52aac9(_0x4ad7b8),_0x3351ec),_0x57af5d=_0x33d6c4(_0x52aac9(_0x57af5d),_0x100113),_0x242efb=_0x33d6c4(_0x242efb,_0x100113);}}}__name(_0x350104,_0x176d80(0x144));}(json1_release),function(_0x205cec){const _0x50c201=_0x220c00;var _0x11dd8d=commonjsGlobal&&commonjsGlobal[_0x50c201(0xa9)]||(Object[_0x50c201(0xcc)]?function(_0x126cc3,_0x589ba0,_0x39fb00,_0x1c0c2e){const _0x1cf25d=_0x50c201;_0x1c0c2e===void 0x0&&(_0x1c0c2e=_0x39fb00),Object['defineProperty'](_0x126cc3,_0x1c0c2e,{'enumerable':!0x0,'get':__name(function(){return _0x589ba0[_0x39fb00];},_0x1cf25d(0x124))});}:function(_0x1dfa40,_0x207b63,_0x2cf95b,_0x36394e){_0x36394e===void 0x0&&(_0x36394e=_0x2cf95b),_0x1dfa40[_0x36394e]=_0x207b63[_0x2cf95b];}),_0x1708d5=commonjsGlobal&&commonjsGlobal['__exportStar']||function(_0x3a9b31,_0x70b57){const _0x4929b0=_0x50c201;for(var _0x401c62 in _0x3a9b31)_0x401c62!==_0x4929b0(0x172)&&!_0x70b57[_0x4929b0(0x174)](_0x401c62)&&_0x11dd8d(_0x70b57,_0x3a9b31,_0x401c62);};Object[_0x50c201(0x1ae)](_0x205cec,'__esModule',{'value':!0x0}),_0x1708d5(json1_release,_0x205cec);var _0x3c575f=cursor;Object[_0x50c201(0x1ae)](_0x205cec,_0x50c201(0x156),{'enumerable':!0x0,'get':__name(function(){const _0x4f1c6e=_0x50c201;return _0x3c575f[_0x4f1c6e(0x156)];},_0x50c201(0x124))}),Object[_0x50c201(0x1ae)](_0x205cec,_0x50c201(0xf5),{'enumerable':!0x0,'get':__name(function(){const _0x6efa64=_0x50c201;return _0x3c575f[_0x6efa64(0xf5)];},_0x50c201(0x124))});var _0xc9c7e9=types;Object[_0x50c201(0x1ae)](_0x205cec,_0x50c201(0x13e),{'enumerable':!0x0,'get':__name(function(){const _0x4cb254=_0x50c201;return _0xc9c7e9[_0x4cb254(0x13e)];},_0x50c201(0x124))});}(dist$1);const _UnitDrawingService=class _UnitDrawingService{constructor(){const _0x459160=_0x220c00;__publicField(this,'drawingManagerData',{}),__publicField(this,'_oldDrawingManagerData',{}),__publicField(this,_0x459160(0x127),[]),__publicField(this,_0x459160(0x203),new Subject()),__publicField(this,'remove$',this[_0x459160(0x203)][_0x459160(0xe9)]()),__publicField(this,_0x459160(0x11b),new Subject()),__publicField(this,'add$',this[_0x459160(0x11b)][_0x459160(0xe9)]()),__publicField(this,_0x459160(0x1a0),new Subject()),__publicField(this,'update$',this['_update$'][_0x459160(0xe9)]()),__publicField(this,_0x459160(0xaa),new Subject()),__publicField(this,'order$',this[_0x459160(0xaa)][_0x459160(0xe9)]()),__publicField(this,_0x459160(0x16a),new Subject()),__publicField(this,_0x459160(0x151),this[_0x459160(0x16a)]['asObservable']()),__publicField(this,'_ungroup$',new Subject()),__publicField(this,'ungroup$',this[_0x459160(0xb3)][_0x459160(0xe9)]()),__publicField(this,_0x459160(0x1b4),new Subject()),__publicField(this,_0x459160(0x126),this['_refreshTransform$'][_0x459160(0xe9)]()),__publicField(this,_0x459160(0xdd),new Subject()),__publicField(this,'visible$',this[_0x459160(0xdd)][_0x459160(0xe9)]()),__publicField(this,'_focus$',new Subject()),__publicField(this,_0x459160(0x1cc),this[_0x459160(0x162)]['asObservable']()),__publicField(this,_0x459160(0x102),new Subject()),__publicField(this,'featurePluginUpdate$',this[_0x459160(0x102)][_0x459160(0xe9)]()),__publicField(this,_0x459160(0x163),new Subject()),__publicField(this,_0x459160(0x147),this[_0x459160(0x163)][_0x459160(0xe9)]()),__publicField(this,_0x459160(0x140),new Subject()),__publicField(this,'featurePluginRemove$',this[_0x459160(0x140)][_0x459160(0xe9)]()),__publicField(this,_0x459160(0x13f),new Subject()),__publicField(this,_0x459160(0x1b6),this[_0x459160(0x13f)][_0x459160(0xe9)]()),__publicField(this,_0x459160(0x1cd),new Subject()),__publicField(this,_0x459160(0x1db),this[_0x459160(0x1cd)]['asObservable']()),__publicField(this,_0x459160(0x195),new Subject()),__publicField(this,'featurePluginUngroupUpdate$',this[_0x459160(0x195)][_0x459160(0xe9)]()),__publicField(this,_0x459160(0x1d1),!0x0),__publicField(this,_0x459160(0x1df),!0x0);}[_0x220c00(0x16e)](){const _0x42973a=_0x220c00;this['_remove$'][_0x42973a(0x115)](),this[_0x42973a(0x11b)]['complete'](),this[_0x42973a(0x1a0)][_0x42973a(0x115)](),this[_0x42973a(0xaa)]['complete'](),this[_0x42973a(0x162)][_0x42973a(0x115)](),this[_0x42973a(0x102)][_0x42973a(0x115)](),this[_0x42973a(0x163)][_0x42973a(0x115)](),this['_featurePluginRemove$'][_0x42973a(0x115)](),this[_0x42973a(0x13f)][_0x42973a(0x115)](),this[_0x42973a(0xdc)]={},this['_oldDrawingManagerData']={};}[_0x220c00(0x20a)](_0x206fd3){const _0x500bcf=_0x220c00;this['_visible$'][_0x500bcf(0xbf)](_0x206fd3);}[_0x220c00(0x1b9)](_0x36cc92){const _0x497ff6=_0x220c00;_0x36cc92[_0x497ff6(0x11c)](_0x1e4184=>{const _0x32e785=_0x497ff6,_0x196d04=this['_getCurrentBySearch'](_0x1e4184);_0x196d04!=null&&(_0x196d04['transform']=_0x1e4184[_0x32e785(0xd8)],_0x196d04[_0x32e785(0x135)]=_0x1e4184[_0x32e785(0x135)],_0x196d04[_0x32e785(0xcf)]=_0x1e4184[_0x32e785(0xcf)]);}),this[_0x497ff6(0xd7)](_0x36cc92);}[_0x220c00(0x13c)](_0xacdc9){const _0x5b53e2=_0x220c00;return this[_0x5b53e2(0xdc)][_0xacdc9]||{};}[_0x220c00(0xb6)](_0x5146ce){const _0x52a226=_0x220c00,_0x37b9ca=this[_0x52a226(0xdc)][_0x5146ce];if(_0x37b9ca==null)return;delete this[_0x52a226(0xdc)][_0x5146ce];const _0x203873=[];Object[_0x52a226(0x12c)](_0x37b9ca)[_0x52a226(0x11c)](_0x1f3212=>{const _0x1d5ebd=_0x52a226,_0x5d9bd4=_0x37b9ca[_0x1f3212];(_0x5d9bd4==null?void 0x0:_0x5d9bd4[_0x1d5ebd(0x1e1)])!=null&&Object[_0x1d5ebd(0x12c)](_0x5d9bd4['data'])[_0x1d5ebd(0x11c)](_0x2b7946=>{const _0x40b0d7=_0x1d5ebd;_0x203873[_0x40b0d7(0xf2)]({'unitId':_0x5146ce,'subUnitId':_0x1f3212,'drawingId':_0x2b7946});});}),_0x203873[_0x52a226(0x109)]>0x0&&this[_0x52a226(0x1d5)](_0x203873);}[_0x220c00(0x152)](_0xef3eec,_0x307d94){this['drawingManagerData'][_0xef3eec]=_0x307d94;}[_0x220c00(0x157)](_0x1fe08d){const _0x26f9dc=_0x220c00,_0x2c30ed=[],_0x55e259=this[_0x26f9dc(0xdc)][_0x1fe08d];_0x55e259!=null&&(Object[_0x26f9dc(0x12c)](_0x55e259)[_0x26f9dc(0x11c)](_0x18b9c5=>{const _0x1f250f=_0x26f9dc;this[_0x1f250f(0x167)](_0x1fe08d,_0x18b9c5);const _0x3a31be=_0x55e259[_0x18b9c5];Object[_0x1f250f(0x12c)](_0x3a31be['data'])[_0x1f250f(0x11c)](_0x30d354=>{const _0x183b17=_0x1f250f,_0x2d1b25=_0x3a31be[_0x183b17(0x1e1)][_0x30d354];_0x2d1b25['unitId']=_0x1fe08d,_0x2d1b25['subUnitId']=_0x18b9c5,_0x2c30ed['push'](_0x2d1b25);});}),_0x2c30ed[_0x26f9dc(0x109)]>0x0&&this[_0x26f9dc(0x18a)](_0x2c30ed));}[_0x220c00(0x1e6)](_0x2f567f,_0x384e5c){const _0x5c154d=_0x220c00;return this[_0x5c154d(0xc5)](_0x2f567f,_0x384e5c);}[_0x220c00(0xa0)](_0x2041ae,_0x4b2104,_0x3721d0){const _0x465df2=_0x220c00;this[_0x465df2(0xdc)][_0x2041ae][_0x4b2104][_0x465df2(0x1e1)]=_0x3721d0;}[_0x220c00(0x181)](_0x8cd6be){const _0x523eba=_0x220c00,_0x32f4ed=[],_0x414b90=[],_0x593eb3=[];_0x8cd6be['forEach'](_0x2fe207=>{const _0x1e0054=_0x4f99,{op:_0x57cc21,invertOp:_0x3b90b1}=this['_addByParam'](_0x2fe207);_0x32f4ed[_0x1e0054(0xf2)]({'unitId':_0x2fe207[_0x1e0054(0x1e3)],'subUnitId':_0x2fe207[_0x1e0054(0x1fd)],'drawingId':_0x2fe207[_0x1e0054(0xb2)]}),_0x414b90[_0x1e0054(0xf2)](_0x57cc21),_0x593eb3['push'](_0x3b90b1);});const _0x34d4fe=_0x414b90[_0x523eba(0xc0)](dist$1[_0x523eba(0x16f)][_0x523eba(0x137)],null),_0x13d2eb=_0x593eb3[_0x523eba(0xc0)](dist$1[_0x523eba(0x16f)][_0x523eba(0x137)],null),{unitId:_0x289797,subUnitId:_0x366d3c}=_0x8cd6be[0x0];return{'undo':_0x13d2eb,'redo':_0x34d4fe,'unitId':_0x289797,'subUnitId':_0x366d3c,'objects':_0x32f4ed};}['getBatchRemoveOp'](_0x4e92f8){const _0x24aa71=_0x220c00,_0x30de21=[],_0x4c6697=[];_0x4e92f8[_0x24aa71(0x11c)](_0xdb828b=>{const _0x5efe25=_0x24aa71,{op:_0x17ca31,invertOp:_0xaccf7a}=this[_0x5efe25(0x185)](_0xdb828b);_0x30de21[_0x5efe25(0x1b8)](_0x17ca31),_0x4c6697['push'](_0xaccf7a);});const _0x2292b5=_0x30de21[_0x24aa71(0xc0)](dist$1[_0x24aa71(0x16f)]['compose'],null),_0x19c197=_0x4c6697[_0x24aa71(0xc0)](dist$1[_0x24aa71(0x16f)]['compose'],null),{unitId:_0x301f89,subUnitId:_0x404828}=_0x4e92f8[0x0];return{'undo':_0x19c197,'redo':_0x2292b5,'unitId':_0x301f89,'subUnitId':_0x404828,'objects':_0x4e92f8};}[_0x220c00(0x1c3)](_0x2eb25d){const _0x1a1cf0=_0x220c00,_0x5a4f8b=[],_0x3b1976=[],_0x2861e9=[];_0x2eb25d[_0x1a1cf0(0x11c)](_0x2d4f15=>{const _0x1c5932=_0x1a1cf0,{op:_0xd826d3,invertOp:_0x27798c}=this[_0x1c5932(0x9a)](_0x2d4f15);_0x5a4f8b[_0x1c5932(0xf2)]({'unitId':_0x2d4f15['unitId'],'subUnitId':_0x2d4f15['subUnitId'],'drawingId':_0x2d4f15['drawingId']}),_0x3b1976[_0x1c5932(0xf2)](_0xd826d3),_0x2861e9['push'](_0x27798c);});const _0x33a430=_0x3b1976['reduce'](dist$1['type'][_0x1a1cf0(0x137)],null),_0x57d4d7=_0x2861e9[_0x1a1cf0(0xc0)](dist$1[_0x1a1cf0(0x16f)]['compose'],null),{unitId:_0x45eb5d,subUnitId:_0x56a8a8}=_0x2eb25d[0x0];return{'undo':_0x57d4d7,'redo':_0x33a430,'unitId':_0x45eb5d,'subUnitId':_0x56a8a8,'objects':_0x5a4f8b};}[_0x220c00(0x1d5)](_0x3075b2){const _0x1ef780=_0x220c00;this['_remove$'][_0x1ef780(0xbf)](_0x3075b2);}[_0x220c00(0x18a)](_0x39cad3){const _0x39d752=_0x220c00;this['_add$'][_0x39d752(0xbf)](_0x39cad3);}[_0x220c00(0x182)](_0x2174c9){const _0x13c040=_0x220c00;this['_update$'][_0x13c040(0xbf)](_0x2174c9);}[_0x220c00(0x15f)](_0x23702c){const _0x11bdbc=_0x220c00;this[_0x11bdbc(0xaa)][_0x11bdbc(0xbf)](_0x23702c);}['groupUpdateNotification'](_0x25043c){const _0x47be67=_0x220c00;this[_0x47be67(0x16a)][_0x47be67(0xbf)](_0x25043c);}[_0x220c00(0x146)](_0x5cd134){const _0x198562=_0x220c00;this[_0x198562(0xb3)][_0x198562(0xbf)](_0x5cd134);}[_0x220c00(0xd7)](_0x4d7893){const _0x1b601f=_0x220c00;this[_0x1b601f(0x1b4)]['next'](_0x4d7893);}[_0x220c00(0xf0)](_0x53821a){const _0x5f2866=_0x220c00,_0x2e0e13=[],{unitId:_0x4061fb,subUnitId:_0x44392d}=_0x53821a[0x0]['parent'];_0x53821a[_0x5f2866(0x11c)](_0x3408ec=>{const _0xcbc353=_0x5f2866;_0x2e0e13[_0xcbc353(0xf2)](this[_0xcbc353(0xca)](_0x3408ec));});const _0x15eafb=_0x2e0e13[_0x5f2866(0xc0)](dist$1['type'][_0x5f2866(0x137)],null);return{'undo':dist$1[_0x5f2866(0x16f)]['invertWithDoc'](_0x15eafb,this[_0x5f2866(0xdc)]),'redo':_0x15eafb,'unitId':_0x4061fb,'subUnitId':_0x44392d,'objects':_0x53821a};}[_0x220c00(0x10c)](_0x254a0e){const _0x4a3f59=_0x220c00,_0x4a7077=[],{unitId:_0x14bb97,subUnitId:_0x4479e6}=_0x254a0e[0x0][_0x4a3f59(0x1be)];_0x254a0e['forEach'](_0x131a48=>{_0x4a7077['push'](this['_getUngroupDrawingOp'](_0x131a48));});const _0x1c8657=_0x4a7077[_0x4a3f59(0xc0)](dist$1[_0x4a3f59(0x16f)][_0x4a3f59(0x137)],null);return{'undo':dist$1[_0x4a3f59(0x16f)][_0x4a3f59(0x93)](_0x1c8657,this[_0x4a3f59(0xdc)]),'redo':_0x1c8657,'unitId':_0x14bb97,'subUnitId':_0x4479e6,'objects':_0x254a0e};}[_0x220c00(0xe6)](_0xd15a87){const _0x43a24e=_0x220c00,{unitId:_0x55632a,subUnitId:_0x278d1e,drawingId:_0x101d4c}=_0xd15a87;if(this[_0x43a24e(0x1e9)]({'unitId':_0x55632a,'subUnitId':_0x278d1e,'drawingId':_0x101d4c})==null)return[];const _0x46ad2e=this[_0x43a24e(0xc5)](_0x55632a,_0x278d1e),_0x24046e=[];return Object[_0x43a24e(0x12c)](_0x46ad2e)[_0x43a24e(0x11c)](_0x2f437c=>{const _0x5e41a3=_0x43a24e,_0x39edf0=_0x46ad2e[_0x2f437c];_0x39edf0['groupId']===_0x101d4c&&_0x24046e[_0x5e41a3(0xf2)](_0x39edf0);}),_0x24046e;}['_getGroupDrawingOp'](_0x179b1b){const _0x7ac1da=_0x220c00,{parent:_0x1e1a61,children:_0x3284ac}=_0x179b1b,{unitId:_0x2da914,subUnitId:_0x413c2e,drawingId:_0x18d1d5}=_0x1e1a61,_0x366bd5=[];_0x366bd5[_0x7ac1da(0xf2)](dist$1[_0x7ac1da(0x1fc)]([_0x2da914,_0x413c2e,'data',_0x18d1d5],_0x1e1a61));let _0x341bbb=Number[_0x7ac1da(0x159)];return _0x3284ac[_0x7ac1da(0x11c)](_0x375d17=>{const _0x433d77=_0x7ac1da,{unitId:_0x102767,subUnitId:_0x334140,drawingId:_0x2796cb}=_0x375d17,_0xa5db55=this['_hasDrawingOrder']({'unitId':_0x102767,'subUnitId':_0x334140,'drawingId':_0x2796cb});_0x341bbb=Math[_0x433d77(0xac)](_0x341bbb,_0xa5db55),_0x366bd5[_0x433d77(0xf2)](...this['_getUpdateParamCompareOp'](_0x375d17,this[_0x433d77(0x1e9)]({'unitId':_0x102767,'subUnitId':_0x334140,'drawingId':_0x2796cb})));}),_0x341bbb===Number[_0x7ac1da(0x159)]&&(_0x341bbb=this[_0x7ac1da(0x19e)](_0x2da914,_0x413c2e)[_0x7ac1da(0x109)]),_0x366bd5[_0x7ac1da(0xf2)](dist$1[_0x7ac1da(0x1fc)]([_0x2da914,_0x413c2e,_0x7ac1da(0x11e),_0x341bbb],_0x18d1d5)),_0x366bd5[_0x7ac1da(0xc0)](dist$1[_0x7ac1da(0x16f)][_0x7ac1da(0x137)],null);}[_0x220c00(0xb7)](_0x32a90c){const _0x174381=_0x220c00,{parent:_0x31f63f,children:_0x2692bf}=_0x32a90c,{unitId:_0x563cd8,subUnitId:_0x5a148e,drawingId:_0x191b2f}=_0x31f63f,_0x5bc60d=[];return _0x2692bf[_0x174381(0x11c)](_0x228ff4=>{const _0x56602b=_0x174381,{unitId:_0x2b33e6,subUnitId:_0x2afd32,drawingId:_0x428323}=_0x228ff4;_0x5bc60d[_0x56602b(0xf2)](...this[_0x56602b(0x1b3)](_0x228ff4,this[_0x56602b(0x1e9)]({'unitId':_0x2b33e6,'subUnitId':_0x2afd32,'drawingId':_0x428323})));}),_0x5bc60d[_0x174381(0xf2)](dist$1['removeOp']([_0x563cd8,_0x5a148e,_0x174381(0x1e1),_0x191b2f],!0x0)),_0x5bc60d['push'](dist$1[_0x174381(0x9e)]([_0x563cd8,_0x5a148e,_0x174381(0x11e),this[_0x174381(0x19e)](_0x563cd8,_0x5a148e)[_0x174381(0x17f)](_0x191b2f)],!0x0)),_0x5bc60d['reduce'](dist$1['type']['compose'],null);}[_0x220c00(0x1f7)](_0xa3aa9d,_0x1fab67,_0x4b5c5b){const _0x272b5e=_0x220c00;this[_0x272b5e(0x167)](_0xa3aa9d,_0x1fab67),this[_0x272b5e(0x1d0)]={...this[_0x272b5e(0xdc)]},this[_0x272b5e(0xdc)]=dist$1['type']['apply'](this[_0x272b5e(0xdc)],_0x4b5c5b);}[_0x220c00(0x15c)](_0x156e23){const _0x27992b=_0x220c00;this['_featurePluginUpdate$'][_0x27992b(0xbf)](_0x156e23);}[_0x220c00(0x9b)](_0x7fd750){const _0x3a140f=_0x220c00;this[_0x3a140f(0x13f)]['next'](_0x7fd750);}[_0x220c00(0x171)](_0x33e2a2){const _0x3abc4a=_0x220c00;this[_0x3abc4a(0x163)][_0x3abc4a(0xbf)](_0x33e2a2);}[_0x220c00(0x1f6)](_0x2b576a){const _0x5d4f14=_0x220c00;this[_0x5d4f14(0x140)][_0x5d4f14(0xbf)](_0x2b576a);}[_0x220c00(0x128)](_0x554102){const _0x26d02d=_0x220c00;this[_0x26d02d(0x1cd)][_0x26d02d(0xbf)](_0x554102);}['featurePluginUngroupUpdateNotification'](_0x2ccc8f){const _0x3aa696=_0x220c00;this['_featurePluginUngroupUpdate$'][_0x3aa696(0xbf)](_0x2ccc8f);}['getDrawingByParam'](_0x13dd4f){const _0x3e6417=_0x220c00;return this[_0x3e6417(0x1ad)](_0x13dd4f);}[_0x220c00(0x1d6)](_0x16daaf){const _0x1d0cd2=_0x220c00;return this[_0x1d0cd2(0x12a)](_0x16daaf);}[_0x220c00(0x10b)](_0x12383f){const _0x47b8f9=_0x220c00,[_0xc27d9e,_0x4e6d68,_0xd56cae]=_0x12383f[_0x47b8f9(0x13b)]('#-#');return this[_0x47b8f9(0x1ad)]({'unitId':_0xc27d9e,'subUnitId':_0x4e6d68,'drawingId':_0xd56cae});}[_0x220c00(0xd5)](_0x149a69){const _0x567de3=_0x220c00;if(_0x149a69==null){this['_focusDrawings']=[],this[_0x567de3(0x162)][_0x567de3(0xbf)]([]);return;}const _0x316468=[];_0x149a69['forEach'](_0x27756d=>{const _0x2772a3=_0x567de3;var _0x4b1cf0;const {unitId:_0x226541,subUnitId:_0x1a002c,drawingId:_0x5a5dc2}=_0x27756d,_0x34c55c=(_0x4b1cf0=this[_0x2772a3(0xc5)](_0x226541,_0x1a002c))==null?void 0x0:_0x4b1cf0[_0x5a5dc2];_0x34c55c!=null&&_0x316468[_0x2772a3(0xf2)](_0x34c55c);}),_0x316468[_0x567de3(0x109)]>0x0&&(this['_focusDrawings']=_0x316468,this[_0x567de3(0x162)]['next'](_0x316468));}['getFocusDrawings'](){const _0x31daa7=_0x220c00,_0x412645=[];return this[_0x31daa7(0x127)][_0x31daa7(0x11c)](_0x290ada=>{const _0x10beea=_0x31daa7;var _0x2e1802;const {unitId:_0x327f86,subUnitId:_0x3b1532,drawingId:_0x14e0ca}=_0x290ada,_0x11732c=(_0x2e1802=this[_0x10beea(0xc5)](_0x327f86,_0x3b1532))==null?void 0x0:_0x2e1802[_0x14e0ca];_0x11732c!=null&&_0x412645[_0x10beea(0xf2)](_0x11732c);}),_0x412645;}[_0x220c00(0x1ea)](_0x121ab6,_0x133686){const _0x5aa8b9=_0x220c00;return this[_0x5aa8b9(0x19e)](_0x121ab6,_0x133686);}[_0x220c00(0x1cf)](_0x1cb37e,_0x336a44,_0x190ff1){const _0x3038b8=_0x220c00;this[_0x3038b8(0xdc)][_0x1cb37e][_0x336a44][_0x3038b8(0x11e)]=_0x190ff1;}[_0x220c00(0x117)](_0x4a73e6){const _0x44ab24=_0x220c00;this['_order$'][_0x44ab24(0xbf)](_0x4a73e6);}[_0x220c00(0xce)](_0x5d3d4d){const _0x50cc91=_0x220c00,{unitId:_0x4d9fa4,subUnitId:_0x12077d,drawingIds:_0x20f5e8}=_0x5d3d4d,_0x5ca806=[],_0xe17a3c=this[_0x50cc91(0x1ea)](_0x4d9fa4,_0x12077d),_0x1cd782=[..._0x20f5e8];_0x20f5e8[_0x50cc91(0x11c)](_0x26add2=>{const _0x38f6d1=_0x50cc91,_0x498363=this[_0x38f6d1(0x1c9)]({'unitId':_0x4d9fa4,'subUnitId':_0x12077d,'drawingId':_0x26add2});if(_0x498363===-0x1||_0x498363===_0xe17a3c[_0x38f6d1(0x109)]-0x1)return;const _0xfa1a65=dist$1['moveOp']([_0x4d9fa4,_0x12077d,_0x38f6d1(0x11e),_0x498363],[_0x4d9fa4,_0x12077d,'order',_0x498363+0x1]);_0x5ca806['push'](_0xfa1a65),_0x1cd782[_0x38f6d1(0xc8)](_0xe17a3c[_0x498363+0x1])||_0x1cd782[_0x38f6d1(0xf2)](_0xe17a3c[_0x498363+0x1]);});const _0x3f5fe3=_0x5ca806[_0x50cc91(0xc0)](dist$1['type'][_0x50cc91(0x137)],null);return{'undo':dist$1[_0x50cc91(0x16f)][_0x50cc91(0x93)](_0x3f5fe3,this['drawingManagerData']),'redo':_0x3f5fe3,'unitId':_0x4d9fa4,'subUnitId':_0x12077d,'objects':{..._0x5d3d4d,'drawingIds':_0x1cd782}};}[_0x220c00(0xfa)](_0x36e575){const _0x16eb4c=_0x220c00,{unitId:_0x4297b9,subUnitId:_0xd98f64,drawingIds:_0x21f193}=_0x36e575,_0x3de8f4=[],_0x36333c=this['getDrawingOrder'](_0x4297b9,_0xd98f64),_0x4b87e3=[..._0x21f193];_0x21f193[_0x16eb4c(0x11c)](_0x47ed64=>{const _0x2830cc=_0x16eb4c,_0x363d81=this[_0x2830cc(0x1c9)]({'unitId':_0x4297b9,'subUnitId':_0xd98f64,'drawingId':_0x47ed64});if(_0x363d81===-0x1||_0x363d81===0x0)return;const _0x529d63=dist$1['moveOp']([_0x4297b9,_0xd98f64,'order',_0x363d81],[_0x4297b9,_0xd98f64,_0x2830cc(0x11e),_0x363d81-0x1]);_0x3de8f4[_0x2830cc(0xf2)](_0x529d63),_0x4b87e3[_0x2830cc(0xc8)](_0x36333c[_0x363d81-0x1])||_0x4b87e3['push'](_0x36333c[_0x363d81-0x1]);});const _0x1d729a=_0x3de8f4[_0x16eb4c(0xc0)](dist$1[_0x16eb4c(0x16f)]['compose'],null);return{'undo':dist$1[_0x16eb4c(0x16f)][_0x16eb4c(0x93)](_0x1d729a,this['drawingManagerData']),'redo':_0x1d729a,'unitId':_0x4297b9,'subUnitId':_0xd98f64,'objects':{..._0x36e575,'drawingIds':_0x4b87e3}};}[_0x220c00(0x104)](_0x24cb6e){const _0x253500=_0x220c00,{unitId:_0x486c9e,subUnitId:_0x295c0f,drawingIds:_0x268911}=_0x24cb6e,_0xbb0939=this['_getOrderFromSearchParams'](_0x486c9e,_0x295c0f,_0x268911),_0x3af4bc=[..._0x268911],_0x248d5d=this['getDrawingOrder'](_0x486c9e,_0x295c0f),_0x343474=[];_0xbb0939[_0x253500(0x11c)](_0x18b78f=>{const _0xcb7d26=_0x253500,{drawingId:_0x1229b8}=_0x18b78f,_0x8dac45=this[_0xcb7d26(0xdb)](_0x486c9e,_0x295c0f)-0x1,_0x4a41d3=dist$1[_0xcb7d26(0x186)]([_0x486c9e,_0x295c0f,'order',this['_getDrawingOrder'](_0x486c9e,_0x295c0f)['indexOf'](_0x1229b8)],[_0x486c9e,_0x295c0f,_0xcb7d26(0x11e),_0x8dac45]);_0x343474[_0xcb7d26(0xf2)](_0x4a41d3),_0x3af4bc[_0xcb7d26(0xc8)](_0x248d5d[_0x8dac45])||_0x3af4bc['push'](_0x248d5d[_0x8dac45]);});const _0x163f12=_0x343474[_0x253500(0xc0)](dist$1['type'][_0x253500(0x137)],null);return{'undo':dist$1['type'][_0x253500(0x93)](_0x163f12,this[_0x253500(0xdc)]),'redo':_0x163f12,'unitId':_0x486c9e,'subUnitId':_0x295c0f,'objects':{..._0x24cb6e,'drawingIds':_0x3af4bc}};}[_0x220c00(0x160)](_0x4f9fe5){const _0xc3f929=_0x220c00,{unitId:_0x4d438e,subUnitId:_0x26da69,drawingIds:_0x2e4114}=_0x4f9fe5,_0x11a214=this[_0xc3f929(0xd6)](_0x4d438e,_0x26da69,_0x2e4114,!0x0),_0x2e0039=[..._0x2e4114],_0x5ecb09=this['getDrawingOrder'](_0x4d438e,_0x26da69),_0x3f53c2=[];_0x11a214[_0xc3f929(0x11c)](_0x5d8616=>{const _0x5706bc=_0xc3f929,{drawingId:_0x5e621f}=_0x5d8616,_0x36b3a9=dist$1[_0x5706bc(0x186)]([_0x4d438e,_0x26da69,_0x5706bc(0x11e),this[_0x5706bc(0x19e)](_0x4d438e,_0x26da69)[_0x5706bc(0x17f)](_0x5e621f)],[_0x4d438e,_0x26da69,_0x5706bc(0x11e),0x0]);_0x3f53c2[_0x5706bc(0xf2)](_0x36b3a9),_0x2e0039[_0x5706bc(0xc8)](_0x5ecb09[0x0])||_0x2e0039[_0x5706bc(0xf2)](_0x5ecb09[0x0]);});const _0x150f95=_0x3f53c2[_0xc3f929(0xc0)](dist$1[_0xc3f929(0x16f)][_0xc3f929(0x137)],null);return{'undo':dist$1['type'][_0xc3f929(0x93)](_0x150f95,this['drawingManagerData']),'redo':_0x150f95,'unitId':_0x4d438e,'subUnitId':_0x26da69,'objects':{..._0x4f9fe5,'drawingIds':_0x2e0039}};}[_0x220c00(0xdb)](_0x1a9c63,_0x3dd809){const _0x5e22f8=_0x220c00;return this['getDrawingOrder'](_0x1a9c63,_0x3dd809)[_0x5e22f8(0x109)]||0x0;}[_0x220c00(0xd6)](_0x9566e4,_0x4aee83,_0xb72b55,_0x3d454a=!0x1){const _0x490b53=_0x220c00;return _0xb72b55[_0x490b53(0x164)](_0x19150d=>{const _0x7dbdb1=_0x490b53,_0x3eced6=this[_0x7dbdb1(0x1c9)]({'unitId':_0x9566e4,'subUnitId':_0x4aee83,'drawingId':_0x19150d});return{'drawingId':_0x19150d,'zIndex':_0x3eced6};})[_0x490b53(0x1ee)](_0x3d454a===!0x1?sortRules:sortRulesByDesc);}['_hasDrawingOrder'](_0x535029){const _0x532962=_0x220c00;if(_0x535029==null)return-0x1;const {unitId:_0x14c0b1,subUnitId:_0x3bbc5e,drawingId:_0x9cf603}=_0x535029;return this[_0x532962(0x167)](_0x14c0b1,_0x3bbc5e),this[_0x532962(0x19e)](_0x14c0b1,_0x3bbc5e)[_0x532962(0x17f)](_0x9cf603);}[_0x220c00(0x1ad)](_0x2b112f){const _0x5d45c7=_0x220c00;var _0x231f70,_0x55d52a,_0x54e828;if(_0x2b112f==null)return;const {unitId:_0x4bfd91,subUnitId:_0x238b00,drawingId:_0x9cac1c}=_0x2b112f;return(_0x54e828=(_0x55d52a=(_0x231f70=this[_0x5d45c7(0xdc)][_0x4bfd91])==null?void 0x0:_0x231f70[_0x238b00])==null?void 0x0:_0x55d52a[_0x5d45c7(0x1e1)])==null?void 0x0:_0x54e828[_0x9cac1c];}['_getOldBySearch'](_0x4160e1){const _0x4389f2=_0x220c00;var _0x1409ef,_0x3facfa,_0x22e38e;if(_0x4160e1==null)return;const {unitId:_0x1cabfa,subUnitId:_0x12c958,drawingId:_0x4d18f6}=_0x4160e1;return(_0x22e38e=(_0x3facfa=(_0x1409ef=this[_0x4389f2(0x1d0)][_0x1cabfa])==null?void 0x0:_0x1409ef[_0x12c958])==null?void 0x0:_0x3facfa[_0x4389f2(0x1e1)])==null?void 0x0:_0x22e38e[_0x4d18f6];}[_0x220c00(0x167)](_0x10767c,_0x4cb940,_0x334816){const _0x3248c2=_0x220c00;var _0x53b713;return this[_0x3248c2(0xdc)][_0x10767c]||(this[_0x3248c2(0xdc)][_0x10767c]={}),this['drawingManagerData'][_0x10767c][_0x4cb940]||(this['drawingManagerData'][_0x10767c][_0x4cb940]={'data':{},'order':[]}),_0x334816==null?null:(_0x53b713=this[_0x3248c2(0xdc)][_0x10767c][_0x4cb940][_0x3248c2(0x1e1)])==null?void 0x0:_0x53b713[_0x334816];}['_addByParam'](_0x12ba9e){const _0x36517e=_0x220c00,{unitId:_0x3f1de0,subUnitId:_0x1414dc,drawingId:_0x2ccdb7}=_0x12ba9e;this[_0x36517e(0x167)](_0x3f1de0,_0x1414dc,_0x2ccdb7);const _0x52f9bb=dist$1['insertOp']([_0x3f1de0,_0x1414dc,_0x36517e(0x1e1),_0x2ccdb7],_0x12ba9e),_0x3f1f96=dist$1[_0x36517e(0x1fc)]([_0x3f1de0,_0x1414dc,_0x36517e(0x11e),this['_getDrawingOrder'](_0x3f1de0,_0x1414dc)[_0x36517e(0x109)]],_0x2ccdb7),_0xe6192c=[_0x52f9bb,_0x3f1f96][_0x36517e(0xc0)](dist$1['type']['compose'],null),_0x3c6b5b=dist$1['type'][_0x36517e(0x93)](_0xe6192c,this['drawingManagerData']);return{'op':_0xe6192c,'invertOp':_0x3c6b5b};}[_0x220c00(0x185)](_0x421ae8){const _0x2b0b57=_0x220c00;if(_0x421ae8==null)return{'op':[],'invertOp':[]};const {unitId:_0x4cfb17,subUnitId:_0x4c763c,drawingId:_0x195b2a}=_0x421ae8;if(this['_establishDrawingMap'](_0x4cfb17,_0x4c763c,_0x195b2a)==null)return{'op':[],'invertOp':[]};const _0x29574e=dist$1['removeOp']([_0x4cfb17,_0x4c763c,_0x2b0b57(0x1e1),_0x195b2a],!0x0),_0x268a89=dist$1['removeOp']([_0x4cfb17,_0x4c763c,_0x2b0b57(0x11e),this['_getDrawingOrder'](_0x4cfb17,_0x4c763c)[_0x2b0b57(0x17f)](_0x195b2a)],!0x0),_0x340037=[_0x29574e,_0x268a89]['reduce'](dist$1['type'][_0x2b0b57(0x137)],null),_0x5f36fc=dist$1[_0x2b0b57(0x16f)]['invertWithDoc'](_0x340037,this['drawingManagerData']);return{'op':_0x340037,'invertOp':_0x5f36fc};}['_updateByParam'](_0x341c24){const _0x19de35=_0x220c00,{unitId:_0x5976d5,subUnitId:_0x23aa7f,drawingId:_0x2b408c}=_0x341c24,_0x4e0634=this[_0x19de35(0x167)](_0x5976d5,_0x23aa7f,_0x2b408c);if(_0x4e0634==null)return{'op':[],'invertOp':[]};const _0x2c703a=this['_getUpdateParamCompareOp'](_0x341c24,_0x4e0634)[_0x19de35(0xc0)](dist$1[_0x19de35(0x16f)][_0x19de35(0x137)],null),_0x5eb1df=dist$1[_0x19de35(0x16f)]['invertWithDoc'](_0x2c703a,this['drawingManagerData']);return{'op':_0x2c703a,'invertOp':_0x5eb1df};}[_0x220c00(0x1b3)](_0xc59a78,_0x4a6495){const _0x1041d1=_0x220c00,{unitId:_0x430281,subUnitId:_0x123398,drawingId:_0x494a10}=_0xc59a78,_0x5d5eda=[];return Object[_0x1041d1(0x12c)](_0xc59a78)[_0x1041d1(0x11c)](_0x4f336d=>{const _0x4c73a7=_0x1041d1,_0x44bc1a=_0xc59a78[_0x4f336d],_0x38b87f=_0x4a6495[_0x4f336d];_0x38b87f!==_0x44bc1a&&_0x5d5eda[_0x4c73a7(0xf2)](dist$1['replaceOp']([_0x430281,_0x123398,_0x4c73a7(0x1e1),_0x494a10,_0x4f336d],_0x38b87f,_0x44bc1a));}),_0x5d5eda;}[_0x220c00(0xc5)](_0x3424e4,_0x231a77){const _0xc8a2f0=_0x220c00;var _0x5a401a,_0x389b3f;return((_0x389b3f=(_0x5a401a=this[_0xc8a2f0(0xdc)][_0x3424e4])==null?void 0x0:_0x5a401a[_0x231a77])==null?void 0x0:_0x389b3f[_0xc8a2f0(0x1e1)])||{};}[_0x220c00(0x19e)](_0x158a5e,_0x397b32){const _0x51ba5b=_0x220c00;var _0x4910bc,_0xf18c65;return((_0xf18c65=(_0x4910bc=this[_0x51ba5b(0xdc)][_0x158a5e])==null?void 0x0:_0x4910bc[_0x397b32])==null?void 0x0:_0xf18c65[_0x51ba5b(0x11e)])||[];}['getDrawingVisible'](){const _0x4db621=_0x220c00;return this[_0x4db621(0x1d1)];}['getDrawingEditable'](){return this['_editable'];}[_0x220c00(0xb4)](_0x5b7c5c){const _0x27ec4b=_0x220c00;this[_0x27ec4b(0x1d1)]=_0x5b7c5c;}[_0x220c00(0x143)](_0x2a3f06){const _0x430556=_0x220c00;this[_0x430556(0x1df)]=_0x2a3f06;}};__name(_UnitDrawingService,'UnitDrawingService');let UnitDrawingService=_UnitDrawingService;const _DrawingManagerService=class _DrawingManagerService extends UnitDrawingService{};__name(_DrawingManagerService,_0x220c00(0x1da));let DrawingManagerService=_DrawingManagerService;function getDrawingShapeKeyByDrawingSearch({unitId:_0x5b9111,subUnitId:_0x1f000a,drawingId:_0x57559e},_0x24d3fb){const _0x12cc51=_0x220c00;return typeof _0x24d3fb==_0x12cc51(0x18d)?_0x5b9111+_0x12cc51(0xb0)+_0x1f000a+_0x12cc51(0xb0)+_0x57559e+_0x12cc51(0xb0)+_0x24d3fb:_0x5b9111+_0x12cc51(0xb0)+_0x1f000a+_0x12cc51(0xb0)+_0x57559e;}__name(getDrawingShapeKeyByDrawingSearch,_0x220c00(0x205));const getImageSize=__name(async _0x366587=>new Promise((_0x1a85c7,_0x59eff5)=>{const _0x5ec68a=_0x220c00,_0x19efcb=new Image();_0x19efcb['src']=_0x366587,_0x19efcb[_0x5ec68a(0xc6)]=()=>{_0x1a85c7({'width':_0x19efcb['width'],'height':_0x19efcb['height'],'image':_0x19efcb});},_0x19efcb[_0x5ec68a(0x1ac)]=_0x1f89d7=>{_0x59eff5(_0x1f89d7);};}),_0x220c00(0x120));var ImageSourceType=(_0x34aba9=>(_0x34aba9[_0x220c00(0x133)]=_0x220c00(0x133),_0x34aba9[_0x220c00(0xb1)]=_0x220c00(0xb1),_0x34aba9['BASE64']='BASE64',_0x34aba9))(ImageSourceType||{}),ImageUploadStatusType=(_0x153acb=>(_0x153acb[_0x220c00(0x107)]='0',_0x153acb[_0x220c00(0x168)]='1',_0x153acb['ERROR_IMAGE_TYPE']='2',_0x153acb[_0x220c00(0x100)]='3',_0x153acb[_0x220c00(0xc1)]='4',_0x153acb))(ImageUploadStatusType||{});const IImageIoService=createIdentifier(_0x220c00(0x15b)),_ImageIoService=class _ImageIoService{constructor(){const _0x16a862=_0x220c00;__publicField(this,'_waitCount',0x0),__publicField(this,'_change$',new Subject()),__publicField(this,_0x16a862(0x11d),this[_0x16a862(0xbe)]),__publicField(this,_0x16a862(0x141),new Map());}[_0x220c00(0x17c)](_0x31b11f){const _0xe079b=_0x220c00;this['_waitCount']=_0x31b11f,this['_change$'][_0xe079b(0xbf)](_0x31b11f);}[_0x220c00(0xe3)](_0x2fbedc,_0x17aabd){const _0x2ff402=_0x220c00;if(_0x17aabd===ImageSourceType[_0x2ff402(0x123)]){const _0x53d2c4=new Image();return _0x53d2c4[_0x2ff402(0x1a2)]=_0x2fbedc,_0x53d2c4;}return this[_0x2ff402(0x141)][_0x2ff402(0x124)](_0x2fbedc);}[_0x220c00(0xee)](_0x25faf7,_0x268a62,_0x38236b){const _0x50f058=_0x220c00;_0x268a62===ImageSourceType[_0x50f058(0x123)]||_0x38236b==null||this['_imageSourceCache']['set'](_0x25faf7,_0x38236b);}async[_0x220c00(0x19b)](_0x1d2743){return Promise['resolve'](_0x1d2743);}async['saveImage'](_0x557f7a){return new Promise((_0x5a3952,_0x460b6d)=>{const _0x3bc9d0=_0x4f99;if(!DRAWING_IMAGE_ALLOW_IMAGE_LIST['includes'](_0x557f7a[_0x3bc9d0(0x16f)])){_0x460b6d(new Error(ImageUploadStatusType[_0x3bc9d0(0x190)])),this['_decreaseWaiting']();return;}if(_0x557f7a[_0x3bc9d0(0x1c8)]>DRAWING_IMAGE_ALLOW_SIZE){_0x460b6d(new Error(ImageUploadStatusType[_0x3bc9d0(0x168)])),this['_decreaseWaiting']();return;}const _0x577c1f=new FileReader();_0x577c1f[_0x3bc9d0(0x1bf)](_0x557f7a),_0x577c1f[_0x3bc9d0(0xc6)]=_0x36139d=>{const _0x1c8343=_0x3bc9d0;var _0x5dda35;const _0xd36b4=(_0x5dda35=_0x36139d[_0x1c8343(0x97)])==null?void 0x0:_0x5dda35[_0x1c8343(0xa8)];if(_0xd36b4==null){_0x460b6d(new Error(ImageUploadStatusType[_0x1c8343(0xc1)])),this['_decreaseWaiting']();return;}const _0x289a69=Tools[_0x1c8343(0x1e0)](0x6);_0x5a3952({'imageId':_0x289a69,'imageSourceType':ImageSourceType[_0x1c8343(0x123)],'source':_0xd36b4,'base64Cache':_0xd36b4,'status':ImageUploadStatusType[_0x1c8343(0x107)]}),this[_0x1c8343(0x1c5)]();};});}['_decreaseWaiting'](){const _0x317131=_0x220c00;this[_0x317131(0x142)]-=0x1,this[_0x317131(0xbe)][_0x317131(0xbf)](this[_0x317131(0x142)]);}};__name(_ImageIoService,_0x220c00(0x9d));function _0x4f99(_0x24237a,_0x701460){const _0x1c60b8=_0x1c60();return _0x4f99=function(_0x4f99a0,_0x321c8e){_0x4f99a0=_0x4f99a0-0x91;let _0x535746=_0x1c60b8[_0x4f99a0];return _0x535746;},_0x4f99(_0x24237a,_0x701460);}let ImageIoService=_ImageIoService;const DEFAULT_DOCUMENT_SUB_COMPONENT_ID=_0x220c00(0x1d8);var ArrangeTypeEnum=(_0x388dae=>(_0x388dae[_0x388dae[_0x220c00(0x1bd)]=0x0]=_0x220c00(0x1bd),_0x388dae[_0x388dae['backward']=0x1]=_0x220c00(0x1d7),_0x388dae[_0x388dae[_0x220c00(0xab)]=0x2]=_0x220c00(0xab),_0x388dae[_0x388dae[_0x220c00(0xc7)]=0x3]=_0x220c00(0xc7),_0x388dae))(ArrangeTypeEnum||{}),DrawingTypeEnum=(_0x24ea42=>(_0x24ea42[_0x24ea42[_0x220c00(0x1f3)]=-0x1]=_0x220c00(0x1f3),_0x24ea42[_0x24ea42[_0x220c00(0xed)]=0x0]='DRAWING_IMAGE',_0x24ea42[_0x24ea42[_0x220c00(0xe0)]=0x1]=_0x220c00(0xe0),_0x24ea42[_0x24ea42[_0x220c00(0xd1)]=0x2]=_0x220c00(0xd1),_0x24ea42[_0x24ea42[_0x220c00(0x1c7)]=0x3]=_0x220c00(0x1c7),_0x24ea42[_0x24ea42['DRAWING_SMART_ART']=0x4]=_0x220c00(0x18c),_0x24ea42[_0x24ea42[_0x220c00(0x1ca)]=0x5]=_0x220c00(0x1ca),_0x24ea42[_0x24ea42[_0x220c00(0x121)]=0x6]='DRAWING_GROUP',_0x24ea42[_0x24ea42[_0x220c00(0xc4)]=0x7]='DRAWING_UNIT',_0x24ea42[_0x24ea42[_0x220c00(0x1fa)]=0x8]=_0x220c00(0x1fa),_0x24ea42))(DrawingTypeEnum||{});const IDrawingManagerService=createIdentifier(_0x220c00(0x145)),PLUGIN_CONFIG_KEY=_0x220c00(0xf1),defaultPluginConfig={};var __defProp2=Object[_0x220c00(0x1ae)],__getOwnPropDesc=Object[_0x220c00(0x161)],__decorateClass=__name((_0x46eb38,_0x4e6186,_0x584dd1,_0xc55ef4)=>{const _0x4c9f37=_0x220c00;for(var _0x1849e5=_0xc55ef4>0x1?void 0x0:_0xc55ef4?__getOwnPropDesc(_0x4e6186,_0x584dd1):_0x4e6186,_0x40c6f6=_0x46eb38[_0x4c9f37(0x109)]-0x1,_0x266f84;_0x40c6f6>=0x0;_0x40c6f6--)(_0x266f84=_0x46eb38[_0x40c6f6])&&(_0x1849e5=(_0xc55ef4?_0x266f84(_0x4e6186,_0x584dd1,_0x1849e5):_0x266f84(_0x1849e5))||_0x1849e5);return _0xc55ef4&&_0x1849e5&&__defProp2(_0x4e6186,_0x584dd1,_0x1849e5),_0x1849e5;},'__decorateClass'),__decorateParam=__name((_0x4b1966,_0x53ed25)=>(_0x3f893c,_0x3e48c4)=>_0x53ed25(_0x3f893c,_0x3e48c4,_0x4b1966),_0x220c00(0xbd));const PLUGIN_NAME='UNIVER_DRAWING_PLUGIN';var _a;let UniverDrawingPlugin=(_a=class extends Plugin{constructor(_0x490797=defaultPluginConfig,_0x2d05c3,_0x1fe9e8){const _0x310ecb=_0x220c00;super(),this['_config']=_0x490797,this['_injector']=_0x2d05c3,this[_0x310ecb(0x194)]=_0x1fe9e8;const {..._0x463178}=this[_0x310ecb(0xef)];this[_0x310ecb(0x194)]['setConfig'](PLUGIN_CONFIG_KEY,_0x463178);}[_0x220c00(0xc2)](){this['_initDependencies']();}[_0x220c00(0x17d)](){const _0x43b897=_0x220c00;var _0x1513c4;mergeOverrideWithDependencies([[IImageIoService,{'useClass':ImageIoService}],[IDrawingManagerService,{'useClass':DrawingManagerService}]],(_0x1513c4=this['_config'])==null?void 0x0:_0x1513c4[_0x43b897(0x11f)])[_0x43b897(0x11c)](_0x300021=>this[_0x43b897(0x1d2)][_0x43b897(0xd2)](_0x300021));}},__name(_a,'UniverDrawingPlugin'),__publicField(_a,_0x220c00(0x1ba),PLUGIN_NAME),_a);UniverDrawingPlugin=__decorateClass([__decorateParam(0x1,Inject(Injector)),__decorateParam(0x2,IConfigService)],UniverDrawingPlugin);export{ArrangeTypeEnum,DEFAULT_DOCUMENT_SUB_COMPONENT_ID,DRAWING_IMAGE_ALLOW_IMAGE_LIST,DRAWING_IMAGE_ALLOW_SIZE,DRAWING_IMAGE_COUNT_LIMIT,DRAWING_IMAGE_HEIGHT_LIMIT,DRAWING_IMAGE_WIDTH_LIMIT,DrawingManagerService,DrawingTypeEnum,IDrawingManagerService,IImageIoService,ImageIoService,ImageSourceType,ImageUploadStatusType,UnitDrawingService,UniverDrawingPlugin,getDrawingShapeKeyByDrawingSearch,getImageSize};
|