ooxml-core 1.37.1 → 1.38.1
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/README.md +7 -0
- package/dist/{PptxHandler-3T5DTNKA.mjs → PptxHandler-EB2WFF7F.mjs} +2 -2
- package/dist/PptxHandler-GOCSIX7N.cjs +14 -0
- package/dist/PptxHandler-IAKU53YW.mjs +5 -0
- package/dist/{PresentationBuilder-XHKNDJMD.mjs → PresentationBuilder-T2B5PPZA.mjs} +2 -2
- package/dist/{PresentationBuilder-HCMXZQDK.cjs → PresentationBuilder-TS4MR6KG.cjs} +6 -6
- package/dist/{PresentationBuilder-D6ZICJWN.mjs → PresentationBuilder-VMUWJF2X.mjs} +3 -3
- package/dist/automation/index.cjs +213 -208
- package/dist/automation/index.mjs +213 -208
- package/dist/{chunk-J43V3QOA.mjs → chunk-6XLWR7R6.mjs} +126 -42
- package/dist/{chunk-4YBSHQ76.mjs → chunk-7YOCVZRH.mjs} +2 -2
- package/dist/{chunk-GZOYXHDF.cjs → chunk-JXNUXGX3.cjs} +1266 -1266
- package/dist/{chunk-2TQJHNVU.mjs → chunk-LWNNHK2S.mjs} +259 -175
- package/dist/{chunk-OEM2ECAJ.mjs → chunk-RDMUNMGT.mjs} +1 -1
- package/dist/{chunk-RHQQS6LJ.mjs → chunk-SN5R5YNF.mjs} +2 -2
- package/dist/{chunk-CNIKTXAV.mjs → chunk-U54ZCZKG.mjs} +1 -1
- package/dist/{chunk-H2Q42P6P.mjs → chunk-UOEYAYAH.mjs} +1 -1
- package/dist/{chunk-SNID2FDY.cjs → chunk-WF4USSCT.cjs} +259 -175
- package/dist/{chunk-M2DFN3SP.mjs → chunk-XFLXQUTC.mjs} +645 -58
- package/dist/{chunk-AFALJ5TA.cjs → chunk-ZTX5YCSW.cjs} +3 -3
- package/dist/collab/merge-values.d.ts +14 -0
- package/dist/collab/merge-values.d.ts.map +1 -0
- package/dist/docx/embedded.cjs +476 -474
- package/dist/docx/embedded.mjs +476 -474
- package/dist/docx/index.cjs +1094 -719
- package/dist/docx/index.d.ts +1 -0
- package/dist/docx/index.d.ts.map +1 -1
- package/dist/docx/index.mjs +1094 -720
- package/dist/docx/layout/index.cjs +4 -0
- package/dist/docx/layout/index.mjs +4 -0
- package/dist/docx/load/index.cjs +164 -164
- package/dist/docx/load/index.mjs +164 -164
- package/dist/docx/merge-snapshots.d.ts +9 -0
- package/dist/docx/merge-snapshots.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +155 -155
- package/dist/docx/ui/index.mjs +155 -155
- package/dist/embedding/index.cjs +207 -0
- package/dist/embedding/index.d.ts +3 -0
- package/dist/embedding/index.d.ts.map +1 -1
- package/dist/embedding/index.mjs +205 -1
- package/dist/embedding/onedrive/client.d.ts +4 -0
- package/dist/embedding/onedrive/client.d.ts.map +1 -0
- package/dist/embedding/onedrive/index.cjs +617 -0
- package/dist/embedding/onedrive/index.d.ts +6 -0
- package/dist/embedding/onedrive/index.d.ts.map +1 -0
- package/dist/embedding/onedrive/index.mjs +611 -0
- package/dist/embedding/onedrive/metadata.d.ts +6 -0
- package/dist/embedding/onedrive/metadata.d.ts.map +1 -0
- package/dist/embedding/onedrive/requests.d.ts +8 -0
- package/dist/embedding/onedrive/requests.d.ts.map +1 -0
- package/dist/embedding/onedrive/session.d.ts +4 -0
- package/dist/embedding/onedrive/session.d.ts.map +1 -0
- package/dist/embedding/onedrive/transport.d.ts +9 -0
- package/dist/embedding/onedrive/transport.d.ts.map +1 -0
- package/dist/embedding/onedrive/types.d.ts +86 -0
- package/dist/embedding/onedrive/types.d.ts.map +1 -0
- package/dist/embedding/onedrive/upload.d.ts +3 -0
- package/dist/embedding/onedrive/upload.d.ts.map +1 -0
- package/dist/embedding/storage-merge.d.ts +8 -0
- package/dist/embedding/storage-merge.d.ts.map +1 -0
- package/dist/embedding/storage-session.d.ts +7 -0
- package/dist/embedding/storage-session.d.ts.map +1 -0
- package/dist/embedding/versioned-storage.d.ts +67 -0
- package/dist/embedding/versioned-storage.d.ts.map +1 -0
- package/dist/index.cjs +1032 -340
- package/dist/index.mjs +1032 -340
- package/dist/opc/index.cjs +699 -216
- package/dist/opc/index.d.ts +1 -0
- package/dist/opc/index.d.ts.map +1 -1
- package/dist/opc/index.mjs +699 -217
- package/dist/opc/merge-snapshots.d.ts +26 -0
- package/dist/opc/merge-snapshots.d.ts.map +1 -0
- package/dist/pptx/automation/index.cjs +165 -47
- package/dist/pptx/automation/index.d.ts +1 -1
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-DC5m1m_8.d.ts → index-uDL5LUSK.d.ts} +20 -6
- package/dist/pptx/chunks/index-uDL5LUSK.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +165 -47
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +7 -0
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/custom-show-operations.cjs +2 -2
- package/dist/pptx/editor/render/custom-show-operations.mjs +1 -1
- package/dist/pptx/editor/render/find-replace.cjs +15 -15
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- package/dist/pptx/editor/render/find-replace.mjs +2 -2
- package/dist/pptx/editor/render/slide-operations.cjs +9 -9
- package/dist/pptx/editor/render/slide-operations.mjs +3 -3
- package/dist/pptx/index.cjs +6156 -5428
- package/dist/pptx/index.d.ts +2 -2
- package/dist/pptx/index.mjs +5 -5
- package/dist/teams/index.cjs +215 -201
- package/dist/teams/index.mjs +215 -201
- package/dist/text/index.cjs +193 -0
- package/dist/text/index.d.ts +1 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.mjs +193 -1
- package/dist/text/merge-three-way.d.ts +9 -0
- package/dist/text/merge-three-way.d.ts.map +1 -0
- package/dist/visio/collab/index.cjs +226 -7
- package/dist/visio/collab/index.d.ts +1 -0
- package/dist/visio/collab/index.d.ts.map +1 -1
- package/dist/visio/collab/index.mjs +225 -7
- package/dist/visio/collab/merge-snapshots.d.ts +14 -0
- package/dist/visio/collab/merge-snapshots.d.ts.map +1 -0
- package/dist/visio/edit-shape-data-commands.d.ts.map +1 -1
- package/dist/visio/index.cjs +15 -10
- package/dist/visio/index.mjs +15 -10
- package/dist/visio/ui/index.cjs +19 -12
- package/dist/visio/ui/index.mjs +19 -12
- package/dist/visio/ui/text-dialog.d.ts.map +1 -1
- package/dist/xlsx/collab/index.cjs +49985 -507
- package/dist/xlsx/collab/index.d.ts +1 -0
- package/dist/xlsx/collab/index.d.ts.map +1 -1
- package/dist/xlsx/collab/index.mjs +49980 -507
- package/dist/xlsx/collab/merge-residual.d.ts +16 -0
- package/dist/xlsx/collab/merge-residual.d.ts.map +1 -0
- package/dist/xlsx/collab/merge-snapshots.d.ts +8 -0
- package/dist/xlsx/collab/merge-snapshots.d.ts.map +1 -0
- package/dist/xlsx/index.cjs +202 -202
- package/dist/xlsx/index.mjs +202 -202
- package/dist/xlsx/load/index.cjs +155 -155
- package/dist/xlsx/load/index.mjs +155 -155
- package/dist/xlsx/ui/index.cjs +202 -202
- package/dist/xlsx/ui/index.mjs +202 -202
- package/dist/xml/index.cjs +406 -22
- package/dist/xml/index.d.ts +1 -0
- package/dist/xml/index.d.ts.map +1 -1
- package/dist/xml/index.mjs +406 -23
- package/dist/xml/merge-three-way.d.ts +18 -0
- package/dist/xml/merge-three-way.d.ts.map +1 -0
- package/package.json +6 -1
- package/dist/PptxHandler-2JSQ22VD.cjs +0 -14
- package/dist/PptxHandler-7T7ZS7IK.mjs +0 -5
- package/dist/pptx/chunks/index-DC5m1m_8.d.ts.map +0 -1
package/dist/teams/index.mjs
CHANGED
|
@@ -518,6 +518,172 @@ var init_xml = __esm({
|
|
|
518
518
|
}
|
|
519
519
|
});
|
|
520
520
|
|
|
521
|
+
// text/text-diff.ts
|
|
522
|
+
function shortestEdit(n, m, same8, maxEdits) {
|
|
523
|
+
const max = Math.min(n + m, maxEdits);
|
|
524
|
+
const offset2 = max + 1;
|
|
525
|
+
const v = new Int32Array(2 * max + 3);
|
|
526
|
+
const trace = [];
|
|
527
|
+
for (let d = 0; d <= max; d++) {
|
|
528
|
+
for (let k = -d; k <= d; k += 2) {
|
|
529
|
+
const down = k === -d || k !== d && v[offset2 + k - 1] < v[offset2 + k + 1];
|
|
530
|
+
let x = down ? v[offset2 + k + 1] : v[offset2 + k - 1] + 1;
|
|
531
|
+
let y = x - k;
|
|
532
|
+
while (x < n && y < m && same8(x, y)) {
|
|
533
|
+
x++;
|
|
534
|
+
y++;
|
|
535
|
+
}
|
|
536
|
+
v[offset2 + k] = x;
|
|
537
|
+
if (x >= n && y >= m) return backtrack(trace, n, m, d);
|
|
538
|
+
}
|
|
539
|
+
trace.push(v.slice(offset2 - d, offset2 + d + 1));
|
|
540
|
+
}
|
|
541
|
+
return void 0;
|
|
542
|
+
}
|
|
543
|
+
function backtrack(trace, n, m, d) {
|
|
544
|
+
const edits = [];
|
|
545
|
+
let x = n;
|
|
546
|
+
let y = m;
|
|
547
|
+
for (let step = d; step > 0; step--) {
|
|
548
|
+
const previous = trace[step - 1];
|
|
549
|
+
const at = (k2) => previous[k2 + step - 1];
|
|
550
|
+
const k = x - y;
|
|
551
|
+
const down = k === -step || k !== step && at(k - 1) < at(k + 1);
|
|
552
|
+
const before = down ? k + 1 : k - 1;
|
|
553
|
+
const startX = at(before);
|
|
554
|
+
const startY = startX - before;
|
|
555
|
+
edits.push(down ? [startX, startY, true] : [startX, startY, false]);
|
|
556
|
+
x = startX;
|
|
557
|
+
y = startY;
|
|
558
|
+
}
|
|
559
|
+
return edits.reverse();
|
|
560
|
+
}
|
|
561
|
+
function changesOf(edits) {
|
|
562
|
+
const changes = [];
|
|
563
|
+
for (const [x, y, inserts] of edits) {
|
|
564
|
+
const last = changes.at(-1);
|
|
565
|
+
if (last && last.fromEnd === x && last.toEnd === y) {
|
|
566
|
+
if (inserts) last.toEnd++;
|
|
567
|
+
else last.fromEnd++;
|
|
568
|
+
} else
|
|
569
|
+
changes.push({
|
|
570
|
+
fromStart: x,
|
|
571
|
+
fromEnd: inserts ? x : x + 1,
|
|
572
|
+
toStart: y,
|
|
573
|
+
toEnd: inserts ? y + 1 : y
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
return changes;
|
|
577
|
+
}
|
|
578
|
+
function characterChanges(a2, b, maxEdits) {
|
|
579
|
+
const edits = shortestEdit(
|
|
580
|
+
a2.length,
|
|
581
|
+
b.length,
|
|
582
|
+
(x, y) => a2.charCodeAt(x) === b.charCodeAt(y),
|
|
583
|
+
maxEdits
|
|
584
|
+
);
|
|
585
|
+
return edits && changesOf(edits);
|
|
586
|
+
}
|
|
587
|
+
function tokensOf(text, ids) {
|
|
588
|
+
const tokens2 = [];
|
|
589
|
+
const starts = [];
|
|
590
|
+
for (const match2 of text.matchAll(TOKEN)) {
|
|
591
|
+
let id = ids.get(match2[0]);
|
|
592
|
+
if (id === void 0) ids.set(match2[0], id = ids.size);
|
|
593
|
+
tokens2.push(id);
|
|
594
|
+
starts.push(match2.index);
|
|
595
|
+
}
|
|
596
|
+
starts.push(text.length);
|
|
597
|
+
return { tokens: tokens2, starts };
|
|
598
|
+
}
|
|
599
|
+
function tokenChanges(a2, b, maxEdits) {
|
|
600
|
+
const ids = /* @__PURE__ */ new Map();
|
|
601
|
+
const from = tokensOf(a2, ids);
|
|
602
|
+
const to = tokensOf(b, ids);
|
|
603
|
+
const edits = shortestEdit(
|
|
604
|
+
from.tokens.length,
|
|
605
|
+
to.tokens.length,
|
|
606
|
+
(x, y) => from.tokens[x] === to.tokens[y],
|
|
607
|
+
maxEdits
|
|
608
|
+
);
|
|
609
|
+
if (!edits) return void 0;
|
|
610
|
+
let budget = maxEdits;
|
|
611
|
+
return changesOf(edits).flatMap((stretch) => {
|
|
612
|
+
const change = {
|
|
613
|
+
fromStart: from.starts[stretch.fromStart],
|
|
614
|
+
fromEnd: from.starts[stretch.fromEnd],
|
|
615
|
+
toStart: to.starts[stretch.toStart],
|
|
616
|
+
toEnd: to.starts[stretch.toEnd]
|
|
617
|
+
};
|
|
618
|
+
const inner = change.fromEnd > change.fromStart && change.toEnd > change.toStart ? characterChanges(
|
|
619
|
+
a2.slice(change.fromStart, change.fromEnd),
|
|
620
|
+
b.slice(change.toStart, change.toEnd),
|
|
621
|
+
budget
|
|
622
|
+
) : void 0;
|
|
623
|
+
if (!inner) return [change];
|
|
624
|
+
for (const found of inner)
|
|
625
|
+
budget -= found.fromEnd - found.fromStart + found.toEnd - found.toStart;
|
|
626
|
+
return inner.map((found) => ({
|
|
627
|
+
fromStart: found.fromStart + change.fromStart,
|
|
628
|
+
fromEnd: found.fromEnd + change.fromStart,
|
|
629
|
+
toStart: found.toStart + change.toStart,
|
|
630
|
+
toEnd: found.toEnd + change.toStart
|
|
631
|
+
}));
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
function diffText(from, to, maxEdits = 500) {
|
|
635
|
+
let start = 0;
|
|
636
|
+
while (start < from.length && start < to.length && from.charCodeAt(start) === to.charCodeAt(start))
|
|
637
|
+
start++;
|
|
638
|
+
let end = 0;
|
|
639
|
+
while (end < from.length - start && end < to.length - start && from.charCodeAt(from.length - 1 - end) === to.charCodeAt(to.length - 1 - end))
|
|
640
|
+
end++;
|
|
641
|
+
const a2 = from.slice(start, from.length - end);
|
|
642
|
+
const b = to.slice(start, to.length - end);
|
|
643
|
+
if (!a2.length && !b.length) return [];
|
|
644
|
+
const found = a2.length && b.length ? characterChanges(a2, b, maxEdits) ?? tokenChanges(a2, b, maxEdits) : void 0;
|
|
645
|
+
const changes = found ?? [{ fromStart: 0, fromEnd: a2.length, toStart: 0, toEnd: b.length }];
|
|
646
|
+
const result2 = [];
|
|
647
|
+
for (const change of changes) {
|
|
648
|
+
const placed = {
|
|
649
|
+
fromStart: change.fromStart + start,
|
|
650
|
+
fromEnd: change.fromEnd + start,
|
|
651
|
+
toStart: change.toStart + start,
|
|
652
|
+
toEnd: change.toEnd + start
|
|
653
|
+
};
|
|
654
|
+
if (placed.fromStart > 0 && placed.toStart > 0 && (isLowSurrogate(from, placed.fromStart) || isLowSurrogate(to, placed.toStart))) {
|
|
655
|
+
placed.fromStart--;
|
|
656
|
+
placed.toStart--;
|
|
657
|
+
}
|
|
658
|
+
if (isLowSurrogate(from, placed.fromEnd) || isLowSurrogate(to, placed.toEnd)) {
|
|
659
|
+
placed.fromEnd++;
|
|
660
|
+
placed.toEnd++;
|
|
661
|
+
}
|
|
662
|
+
const last = result2.at(-1);
|
|
663
|
+
if (last && placed.fromStart <= last.fromEnd) {
|
|
664
|
+
last.fromEnd = Math.max(last.fromEnd, placed.fromEnd);
|
|
665
|
+
last.toEnd = Math.max(last.toEnd, placed.toEnd);
|
|
666
|
+
} else result2.push(placed);
|
|
667
|
+
}
|
|
668
|
+
return result2;
|
|
669
|
+
}
|
|
670
|
+
var isLowSurrogate, TOKEN;
|
|
671
|
+
var init_text_diff = __esm({
|
|
672
|
+
"text/text-diff.ts"() {
|
|
673
|
+
isLowSurrogate = (text, at) => {
|
|
674
|
+
const code = text.charCodeAt(at);
|
|
675
|
+
return code >= 56320 && code <= 57343;
|
|
676
|
+
};
|
|
677
|
+
TOKEN = /[\p{L}\p{N}\p{M}]+|\s+|[\s\S]/gu;
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
// xml/merge-three-way.ts
|
|
682
|
+
var init_merge_three_way = __esm({
|
|
683
|
+
"xml/merge-three-way.ts"() {
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
|
|
521
687
|
// xml/lite.ts
|
|
522
688
|
var init_lite = __esm({
|
|
523
689
|
"xml/lite.ts"() {
|
|
@@ -542,6 +708,7 @@ var init_xml2 = __esm({
|
|
|
542
708
|
"xml/index.ts"() {
|
|
543
709
|
init_namespaces();
|
|
544
710
|
init_xml();
|
|
711
|
+
init_merge_three_way();
|
|
545
712
|
init_lite();
|
|
546
713
|
init_xpath();
|
|
547
714
|
}
|
|
@@ -641,6 +808,16 @@ var init_package = __esm({
|
|
|
641
808
|
"opc/package.ts"() {
|
|
642
809
|
}
|
|
643
810
|
});
|
|
811
|
+
var init_zip_limits = __esm({
|
|
812
|
+
"opc/zip-limits.ts"() {
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
var init_merge_snapshots = __esm({
|
|
816
|
+
"opc/merge-snapshots.ts"() {
|
|
817
|
+
new TextDecoder("utf-8", { fatal: true });
|
|
818
|
+
new TextEncoder();
|
|
819
|
+
}
|
|
820
|
+
});
|
|
644
821
|
|
|
645
822
|
// opc/clone-part-graph.ts
|
|
646
823
|
var init_clone_part_graph = __esm({
|
|
@@ -656,10 +833,6 @@ var init_safe_href = __esm({
|
|
|
656
833
|
/* @__PURE__ */ new Set([...OPEN_SCHEMES, "ftp", "file"]);
|
|
657
834
|
}
|
|
658
835
|
});
|
|
659
|
-
var init_zip_limits = __esm({
|
|
660
|
-
"opc/zip-limits.ts"() {
|
|
661
|
-
}
|
|
662
|
-
});
|
|
663
836
|
var init_embedded_packages = __esm({
|
|
664
837
|
"opc/embedded-packages.ts"() {
|
|
665
838
|
}
|
|
@@ -1137,6 +1310,7 @@ var init_opc = __esm({
|
|
|
1137
1310
|
init_relationships();
|
|
1138
1311
|
init_content_types();
|
|
1139
1312
|
init_package();
|
|
1313
|
+
init_merge_snapshots();
|
|
1140
1314
|
init_clone_part_graph();
|
|
1141
1315
|
init_safe_href();
|
|
1142
1316
|
init_embedded_packages();
|
|
@@ -1613,166 +1787,6 @@ var init_comment_ids = __esm({
|
|
|
1613
1787
|
}
|
|
1614
1788
|
});
|
|
1615
1789
|
|
|
1616
|
-
// text/text-diff.ts
|
|
1617
|
-
function shortestEdit(n, m, same8, maxEdits) {
|
|
1618
|
-
const max = Math.min(n + m, maxEdits);
|
|
1619
|
-
const offset2 = max + 1;
|
|
1620
|
-
const v = new Int32Array(2 * max + 3);
|
|
1621
|
-
const trace = [];
|
|
1622
|
-
for (let d = 0; d <= max; d++) {
|
|
1623
|
-
for (let k = -d; k <= d; k += 2) {
|
|
1624
|
-
const down = k === -d || k !== d && v[offset2 + k - 1] < v[offset2 + k + 1];
|
|
1625
|
-
let x = down ? v[offset2 + k + 1] : v[offset2 + k - 1] + 1;
|
|
1626
|
-
let y = x - k;
|
|
1627
|
-
while (x < n && y < m && same8(x, y)) {
|
|
1628
|
-
x++;
|
|
1629
|
-
y++;
|
|
1630
|
-
}
|
|
1631
|
-
v[offset2 + k] = x;
|
|
1632
|
-
if (x >= n && y >= m) return backtrack(trace, n, m, d);
|
|
1633
|
-
}
|
|
1634
|
-
trace.push(v.slice(offset2 - d, offset2 + d + 1));
|
|
1635
|
-
}
|
|
1636
|
-
return void 0;
|
|
1637
|
-
}
|
|
1638
|
-
function backtrack(trace, n, m, d) {
|
|
1639
|
-
const edits = [];
|
|
1640
|
-
let x = n;
|
|
1641
|
-
let y = m;
|
|
1642
|
-
for (let step = d; step > 0; step--) {
|
|
1643
|
-
const previous = trace[step - 1];
|
|
1644
|
-
const at = (k2) => previous[k2 + step - 1];
|
|
1645
|
-
const k = x - y;
|
|
1646
|
-
const down = k === -step || k !== step && at(k - 1) < at(k + 1);
|
|
1647
|
-
const before = down ? k + 1 : k - 1;
|
|
1648
|
-
const startX = at(before);
|
|
1649
|
-
const startY = startX - before;
|
|
1650
|
-
edits.push(down ? [startX, startY, true] : [startX, startY, false]);
|
|
1651
|
-
x = startX;
|
|
1652
|
-
y = startY;
|
|
1653
|
-
}
|
|
1654
|
-
return edits.reverse();
|
|
1655
|
-
}
|
|
1656
|
-
function changesOf(edits) {
|
|
1657
|
-
const changes = [];
|
|
1658
|
-
for (const [x, y, inserts] of edits) {
|
|
1659
|
-
const last = changes.at(-1);
|
|
1660
|
-
if (last && last.fromEnd === x && last.toEnd === y) {
|
|
1661
|
-
if (inserts) last.toEnd++;
|
|
1662
|
-
else last.fromEnd++;
|
|
1663
|
-
} else
|
|
1664
|
-
changes.push({
|
|
1665
|
-
fromStart: x,
|
|
1666
|
-
fromEnd: inserts ? x : x + 1,
|
|
1667
|
-
toStart: y,
|
|
1668
|
-
toEnd: inserts ? y + 1 : y
|
|
1669
|
-
});
|
|
1670
|
-
}
|
|
1671
|
-
return changes;
|
|
1672
|
-
}
|
|
1673
|
-
function characterChanges(a2, b, maxEdits) {
|
|
1674
|
-
const edits = shortestEdit(
|
|
1675
|
-
a2.length,
|
|
1676
|
-
b.length,
|
|
1677
|
-
(x, y) => a2.charCodeAt(x) === b.charCodeAt(y),
|
|
1678
|
-
maxEdits
|
|
1679
|
-
);
|
|
1680
|
-
return edits && changesOf(edits);
|
|
1681
|
-
}
|
|
1682
|
-
function tokensOf(text, ids) {
|
|
1683
|
-
const tokens2 = [];
|
|
1684
|
-
const starts = [];
|
|
1685
|
-
for (const match2 of text.matchAll(TOKEN)) {
|
|
1686
|
-
let id = ids.get(match2[0]);
|
|
1687
|
-
if (id === void 0) ids.set(match2[0], id = ids.size);
|
|
1688
|
-
tokens2.push(id);
|
|
1689
|
-
starts.push(match2.index);
|
|
1690
|
-
}
|
|
1691
|
-
starts.push(text.length);
|
|
1692
|
-
return { tokens: tokens2, starts };
|
|
1693
|
-
}
|
|
1694
|
-
function tokenChanges(a2, b, maxEdits) {
|
|
1695
|
-
const ids = /* @__PURE__ */ new Map();
|
|
1696
|
-
const from = tokensOf(a2, ids);
|
|
1697
|
-
const to = tokensOf(b, ids);
|
|
1698
|
-
const edits = shortestEdit(
|
|
1699
|
-
from.tokens.length,
|
|
1700
|
-
to.tokens.length,
|
|
1701
|
-
(x, y) => from.tokens[x] === to.tokens[y],
|
|
1702
|
-
maxEdits
|
|
1703
|
-
);
|
|
1704
|
-
if (!edits) return void 0;
|
|
1705
|
-
let budget = maxEdits;
|
|
1706
|
-
return changesOf(edits).flatMap((stretch) => {
|
|
1707
|
-
const change = {
|
|
1708
|
-
fromStart: from.starts[stretch.fromStart],
|
|
1709
|
-
fromEnd: from.starts[stretch.fromEnd],
|
|
1710
|
-
toStart: to.starts[stretch.toStart],
|
|
1711
|
-
toEnd: to.starts[stretch.toEnd]
|
|
1712
|
-
};
|
|
1713
|
-
const inner = change.fromEnd > change.fromStart && change.toEnd > change.toStart ? characterChanges(
|
|
1714
|
-
a2.slice(change.fromStart, change.fromEnd),
|
|
1715
|
-
b.slice(change.toStart, change.toEnd),
|
|
1716
|
-
budget
|
|
1717
|
-
) : void 0;
|
|
1718
|
-
if (!inner) return [change];
|
|
1719
|
-
for (const found of inner)
|
|
1720
|
-
budget -= found.fromEnd - found.fromStart + found.toEnd - found.toStart;
|
|
1721
|
-
return inner.map((found) => ({
|
|
1722
|
-
fromStart: found.fromStart + change.fromStart,
|
|
1723
|
-
fromEnd: found.fromEnd + change.fromStart,
|
|
1724
|
-
toStart: found.toStart + change.toStart,
|
|
1725
|
-
toEnd: found.toEnd + change.toStart
|
|
1726
|
-
}));
|
|
1727
|
-
});
|
|
1728
|
-
}
|
|
1729
|
-
function diffText(from, to, maxEdits = 500) {
|
|
1730
|
-
let start = 0;
|
|
1731
|
-
while (start < from.length && start < to.length && from.charCodeAt(start) === to.charCodeAt(start))
|
|
1732
|
-
start++;
|
|
1733
|
-
let end = 0;
|
|
1734
|
-
while (end < from.length - start && end < to.length - start && from.charCodeAt(from.length - 1 - end) === to.charCodeAt(to.length - 1 - end))
|
|
1735
|
-
end++;
|
|
1736
|
-
const a2 = from.slice(start, from.length - end);
|
|
1737
|
-
const b = to.slice(start, to.length - end);
|
|
1738
|
-
if (!a2.length && !b.length) return [];
|
|
1739
|
-
const found = a2.length && b.length ? characterChanges(a2, b, maxEdits) ?? tokenChanges(a2, b, maxEdits) : void 0;
|
|
1740
|
-
const changes = found ?? [{ fromStart: 0, fromEnd: a2.length, toStart: 0, toEnd: b.length }];
|
|
1741
|
-
const result2 = [];
|
|
1742
|
-
for (const change of changes) {
|
|
1743
|
-
const placed = {
|
|
1744
|
-
fromStart: change.fromStart + start,
|
|
1745
|
-
fromEnd: change.fromEnd + start,
|
|
1746
|
-
toStart: change.toStart + start,
|
|
1747
|
-
toEnd: change.toEnd + start
|
|
1748
|
-
};
|
|
1749
|
-
if (placed.fromStart > 0 && placed.toStart > 0 && (isLowSurrogate(from, placed.fromStart) || isLowSurrogate(to, placed.toStart))) {
|
|
1750
|
-
placed.fromStart--;
|
|
1751
|
-
placed.toStart--;
|
|
1752
|
-
}
|
|
1753
|
-
if (isLowSurrogate(from, placed.fromEnd) || isLowSurrogate(to, placed.toEnd)) {
|
|
1754
|
-
placed.fromEnd++;
|
|
1755
|
-
placed.toEnd++;
|
|
1756
|
-
}
|
|
1757
|
-
const last = result2.at(-1);
|
|
1758
|
-
if (last && placed.fromStart <= last.fromEnd) {
|
|
1759
|
-
last.fromEnd = Math.max(last.fromEnd, placed.fromEnd);
|
|
1760
|
-
last.toEnd = Math.max(last.toEnd, placed.toEnd);
|
|
1761
|
-
} else result2.push(placed);
|
|
1762
|
-
}
|
|
1763
|
-
return result2;
|
|
1764
|
-
}
|
|
1765
|
-
var isLowSurrogate, TOKEN;
|
|
1766
|
-
var init_text_diff = __esm({
|
|
1767
|
-
"text/text-diff.ts"() {
|
|
1768
|
-
isLowSurrogate = (text, at) => {
|
|
1769
|
-
const code = text.charCodeAt(at);
|
|
1770
|
-
return code >= 56320 && code <= 57343;
|
|
1771
|
-
};
|
|
1772
|
-
TOKEN = /[\p{L}\p{N}\p{M}]+|\s+|[\s\S]/gu;
|
|
1773
|
-
}
|
|
1774
|
-
});
|
|
1775
|
-
|
|
1776
1790
|
// xlsx/write/comment-mentions.ts
|
|
1777
1791
|
function patchCommentMentions(node2, before, message, ids, commentId, preserveIds) {
|
|
1778
1792
|
const container = first(node2, "mentions", NS.tc);
|
|
@@ -52126,12 +52140,12 @@ function icsUtc(ms) {
|
|
|
52126
52140
|
}
|
|
52127
52141
|
var icsEscape = (text) => text.replace(/\\/gu, "\\\\").replace(/\r\n|\r|\n/gu, "\\n").replace(/;/gu, "\\;").replace(/,/gu, "\\,");
|
|
52128
52142
|
function icsFold(line3) {
|
|
52129
|
-
const
|
|
52143
|
+
const encoder2 = new TextEncoder();
|
|
52130
52144
|
const out = [];
|
|
52131
52145
|
let current = "";
|
|
52132
52146
|
let bytes = 0;
|
|
52133
52147
|
for (const ch of line3) {
|
|
52134
|
-
const size =
|
|
52148
|
+
const size = encoder2.encode(ch).length;
|
|
52135
52149
|
const limit2 = out.length === 0 ? 75 : 74;
|
|
52136
52150
|
if (bytes + size > limit2) {
|
|
52137
52151
|
out.push(current);
|
|
@@ -52956,25 +52970,25 @@ function createTransportProvider({ doc, awareness }, { transport, maxMessageByte
|
|
|
52956
52970
|
events.emit("synced", next);
|
|
52957
52971
|
};
|
|
52958
52972
|
const fail3 = (reason) => events.emit("error", new Error(reason));
|
|
52959
|
-
const send = (
|
|
52960
|
-
if (open) transport.send(encoding.toUint8Array(
|
|
52973
|
+
const send = (encoder2) => {
|
|
52974
|
+
if (open) transport.send(encoding.toUint8Array(encoder2));
|
|
52961
52975
|
};
|
|
52962
52976
|
const sendStep1 = () => {
|
|
52963
|
-
const
|
|
52964
|
-
encoding.writeVarUint(
|
|
52965
|
-
encoding.writeVarUint(
|
|
52966
|
-
encoding.writeVarUint8Array(
|
|
52967
|
-
send(
|
|
52977
|
+
const encoder2 = encoding.createEncoder();
|
|
52978
|
+
encoding.writeVarUint(encoder2, MESSAGE_SYNC);
|
|
52979
|
+
encoding.writeVarUint(encoder2, SYNC_STEP1);
|
|
52980
|
+
encoding.writeVarUint8Array(encoder2, Y15.encodeStateVector(doc));
|
|
52981
|
+
send(encoder2);
|
|
52968
52982
|
};
|
|
52969
52983
|
const sendAwareness = (clients) => {
|
|
52970
52984
|
if (clients.length === 0) return;
|
|
52971
|
-
const
|
|
52972
|
-
encoding.writeVarUint(
|
|
52985
|
+
const encoder2 = encoding.createEncoder();
|
|
52986
|
+
encoding.writeVarUint(encoder2, MESSAGE_AWARENESS);
|
|
52973
52987
|
encoding.writeVarUint8Array(
|
|
52974
|
-
|
|
52988
|
+
encoder2,
|
|
52975
52989
|
awarenessProtocol.encodeAwarenessUpdate(awareness, clients)
|
|
52976
52990
|
);
|
|
52977
|
-
send(
|
|
52991
|
+
send(encoder2);
|
|
52978
52992
|
};
|
|
52979
52993
|
const handshake = () => {
|
|
52980
52994
|
sendStep1();
|
|
@@ -52982,11 +52996,11 @@ function createTransportProvider({ doc, awareness }, { transport, maxMessageByte
|
|
|
52982
52996
|
if (local !== null) awareness.setLocalState(local);
|
|
52983
52997
|
};
|
|
52984
52998
|
const sendUpdate = (update) => {
|
|
52985
|
-
const
|
|
52986
|
-
encoding.writeVarUint(
|
|
52987
|
-
encoding.writeVarUint(
|
|
52988
|
-
encoding.writeVarUint8Array(
|
|
52989
|
-
send(
|
|
52999
|
+
const encoder2 = encoding.createEncoder();
|
|
53000
|
+
encoding.writeVarUint(encoder2, MESSAGE_SYNC);
|
|
53001
|
+
encoding.writeVarUint(encoder2, SYNC_UPDATE);
|
|
53002
|
+
encoding.writeVarUint8Array(encoder2, update);
|
|
53003
|
+
send(encoder2);
|
|
52990
53004
|
};
|
|
52991
53005
|
const onDocUpdate = (update, updateOrigin) => {
|
|
52992
53006
|
if (updateOrigin !== origin && open) sendUpdate(update);
|
|
@@ -52995,22 +53009,22 @@ function createTransportProvider({ doc, awareness }, { transport, maxMessageByte
|
|
|
52995
53009
|
if (updateOrigin === origin) return;
|
|
52996
53010
|
sendAwareness([...change.added, ...change.updated, ...change.removed]);
|
|
52997
53011
|
};
|
|
52998
|
-
const readSync = (
|
|
52999
|
-
const kind = decoding.readVarUint(
|
|
53000
|
-
const payload = decoding.readVarUint8Array(
|
|
53012
|
+
const readSync = (decoder2) => {
|
|
53013
|
+
const kind = decoding.readVarUint(decoder2);
|
|
53014
|
+
const payload = decoding.readVarUint8Array(decoder2);
|
|
53001
53015
|
if (kind === SYNC_STEP1) {
|
|
53002
53016
|
if (awareness.getLocalState() !== null) sendAwareness([doc.clientID]);
|
|
53003
|
-
const
|
|
53004
|
-
encoding.writeVarUint(
|
|
53005
|
-
encoding.writeVarUint(
|
|
53017
|
+
const encoder2 = encoding.createEncoder();
|
|
53018
|
+
encoding.writeVarUint(encoder2, MESSAGE_SYNC);
|
|
53019
|
+
encoding.writeVarUint(encoder2, SYNC_STEP2);
|
|
53006
53020
|
let diff;
|
|
53007
53021
|
try {
|
|
53008
53022
|
diff = Y15.encodeStateAsUpdate(doc, payload);
|
|
53009
53023
|
} catch {
|
|
53010
53024
|
return fail3("malformed state vector");
|
|
53011
53025
|
}
|
|
53012
|
-
encoding.writeVarUint8Array(
|
|
53013
|
-
return send(
|
|
53026
|
+
encoding.writeVarUint8Array(encoder2, diff);
|
|
53027
|
+
return send(encoder2);
|
|
53014
53028
|
}
|
|
53015
53029
|
if (kind !== SYNC_STEP2 && kind !== SYNC_UPDATE) return fail3(`unknown sync message ${kind}`);
|
|
53016
53030
|
const result2 = applyUpdateSafe(doc, payload, origin, { maxBytes: maxMessageBytes });
|
|
@@ -53022,13 +53036,13 @@ function createTransportProvider({ doc, awareness }, { transport, maxMessageByte
|
|
|
53022
53036
|
if (!(data instanceof Uint8Array) || data.byteLength === 0 || data.byteLength > maxMessageBytes)
|
|
53023
53037
|
return fail3("message is empty, not binary, or too large");
|
|
53024
53038
|
try {
|
|
53025
|
-
const
|
|
53026
|
-
const type = decoding.readVarUint(
|
|
53027
|
-
if (type === MESSAGE_SYNC) readSync(
|
|
53039
|
+
const decoder2 = decoding.createDecoder(data);
|
|
53040
|
+
const type = decoding.readVarUint(decoder2);
|
|
53041
|
+
if (type === MESSAGE_SYNC) readSync(decoder2);
|
|
53028
53042
|
else if (type === MESSAGE_AWARENESS)
|
|
53029
53043
|
awarenessProtocol.applyAwarenessUpdate(
|
|
53030
53044
|
awareness,
|
|
53031
|
-
decoding.readVarUint8Array(
|
|
53045
|
+
decoding.readVarUint8Array(decoder2),
|
|
53032
53046
|
origin
|
|
53033
53047
|
);
|
|
53034
53048
|
else if (type === MESSAGE_QUERY_AWARENESS) sendAwareness([...awareness.getStates().keys()]);
|
|
@@ -53180,9 +53194,9 @@ function readOnlyTransport(inner, isReadOnly) {
|
|
|
53180
53194
|
var SYNC_STEP12 = 0;
|
|
53181
53195
|
function carriesDocumentChanges(data) {
|
|
53182
53196
|
try {
|
|
53183
|
-
const
|
|
53184
|
-
if (decoding.readVarUint(
|
|
53185
|
-
return decoding.readVarUint(
|
|
53197
|
+
const decoder2 = decoding.createDecoder(data);
|
|
53198
|
+
if (decoding.readVarUint(decoder2) !== MESSAGE_SYNC) return false;
|
|
53199
|
+
return decoding.readVarUint(decoder2) !== SYNC_STEP12;
|
|
53186
53200
|
} catch {
|
|
53187
53201
|
return true;
|
|
53188
53202
|
}
|
|
@@ -56170,11 +56184,11 @@ function validateTeamsUpdate(doc, update, actor, options = {}) {
|
|
|
56170
56184
|
function validateTeamsSyncMessage(doc, message, actor, options = {}) {
|
|
56171
56185
|
let payload;
|
|
56172
56186
|
try {
|
|
56173
|
-
const
|
|
56174
|
-
if (decoding.readVarUint(
|
|
56175
|
-
const kind = decoding.readVarUint(
|
|
56187
|
+
const decoder2 = decoding.createDecoder(message);
|
|
56188
|
+
if (decoding.readVarUint(decoder2) !== MESSAGE_SYNC) return OK;
|
|
56189
|
+
const kind = decoding.readVarUint(decoder2);
|
|
56176
56190
|
if (kind !== 1 && kind !== 2) return OK;
|
|
56177
|
-
payload = decoding.readVarUint8Array(
|
|
56191
|
+
payload = decoding.readVarUint8Array(decoder2);
|
|
56178
56192
|
} catch {
|
|
56179
56193
|
return fail2({ code: "invalid-update" });
|
|
56180
56194
|
}
|