@makhmudov.kay/az-editor 0.1.0-beta.8 → 0.1.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/az-editor.js +203 -142
- package/dist/library/hujjat/xml.d.ts +7 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Изменения
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.9
|
|
4
|
+
|
|
5
|
+
- E01: явные `strike=0`, `caps=0` и `vertAlign=baseline` у фрагмента сбрасывают унаследованное оформление. Подчёркивание и зачёркивание разрешаются независимо. Для `caps`/`strike` учитывается различие между переключателями стилей и прямым форматированием.
|
|
6
|
+
- HTML-импорт сохраняет `text-decoration` в Chromium, где CSSOM раскрывает это свойство в longhand-свойства. Простое подчёркивание/зачёркивание больше не вызывает ложные предупреждения о потере стиля.
|
|
7
|
+
- E02: группы абзацев с `page-break-inside:avoid` преобразуются в `keepLines` и связь `keepNext` внутри группы. Вложенные группы не захватывают соседние абзацы; принудительные разрывы страниц имеют приоритет.
|
|
8
|
+
- Непредставимые группы с таблицами дают адресную диагностику `keep-group-not-representable` уровня `loss`. Строгий импорт отклоняется; принятие импорта не разрешает автоматически экспорт отредактированного документа с потерями.
|
|
9
|
+
- Публичные методы и серверный HTML/JSON-контракт не изменены.
|
|
10
|
+
|
|
3
11
|
## 0.1.0-beta.8
|
|
4
12
|
|
|
5
13
|
- HTML → DOCX сохраняет шрифт знака абзаца и наследуемый шрифт `<br>`. Обратный экспорт сохраняет семейство и размер знака абзаца отдельно от текста. Авторские пустые строки не удаляются.
|
package/dist/az-editor.js
CHANGED
|
@@ -582,12 +582,12 @@ async function G(e, t) {
|
|
|
582
582
|
}), r.resume();
|
|
583
583
|
})) : null;
|
|
584
584
|
}
|
|
585
|
-
function K(e) {
|
|
586
|
-
let
|
|
587
|
-
B(e, "vanish") && (
|
|
588
|
-
let
|
|
589
|
-
|
|
590
|
-
for (let [
|
|
585
|
+
function K(e, t = {}) {
|
|
586
|
+
let n = { ...t };
|
|
587
|
+
B(e, "vanish") && (n["--az-hidden"] = U(B(e, "vanish")) ? "1" : "0");
|
|
588
|
+
let r = B(e, "rFonts"), i = V(r, "ascii") || V(r, "hAnsi") || V(r, "cs");
|
|
589
|
+
i && (n["font-family"] = i), H(e, "sz") && (n["font-size"] = `${Number(H(e, "sz")) / 2}pt`);
|
|
590
|
+
for (let [t, r, i, a] of [[
|
|
591
591
|
"b",
|
|
592
592
|
"font-weight",
|
|
593
593
|
"bold",
|
|
@@ -597,15 +597,55 @@ function K(e) {
|
|
|
597
597
|
"font-style",
|
|
598
598
|
"italic",
|
|
599
599
|
"normal"
|
|
600
|
-
]]) B(e,
|
|
601
|
-
let
|
|
602
|
-
|
|
600
|
+
]]) B(e, t) && (n[r] = U(B(e, t)) ? i : a);
|
|
601
|
+
for (let t of [
|
|
602
|
+
"u",
|
|
603
|
+
"strike",
|
|
604
|
+
"dstrike"
|
|
605
|
+
]) {
|
|
606
|
+
let r = B(e, t);
|
|
607
|
+
r && (n[`--az-decoration-${t}`] = U(r) ? "1" : "0");
|
|
608
|
+
}
|
|
609
|
+
if ([
|
|
610
|
+
"u",
|
|
611
|
+
"strike",
|
|
612
|
+
"dstrike"
|
|
613
|
+
].some((e) => n[`--az-decoration-${e}`] !== void 0)) {
|
|
614
|
+
let e = [];
|
|
615
|
+
n["--az-decoration-u"] === "1" && e.push("underline"), (n["--az-decoration-strike"] === "1" || n["--az-decoration-dstrike"] === "1") && e.push("line-through"), n["text-decoration"] = e.join(" ") || "none";
|
|
616
|
+
}
|
|
603
617
|
let a = H(e, "color");
|
|
604
|
-
/^[\da-f]{6}$/i.test(a) && (
|
|
618
|
+
/^[\da-f]{6}$/i.test(a) && (n.color = `#${a}`);
|
|
605
619
|
let o = V(B(e, "shd"), "fill");
|
|
606
|
-
|
|
620
|
+
/^[\da-f]{6}$/i.test(o) ? n["background-color"] = `#${o}` : H(e, "highlight") && H(e, "highlight") !== "none" && (n["background-color"] = H(e, "highlight"));
|
|
621
|
+
let s = H(e, "vertAlign");
|
|
622
|
+
return [
|
|
623
|
+
"superscript",
|
|
624
|
+
"subscript",
|
|
625
|
+
"baseline"
|
|
626
|
+
].includes(s) && (n["vertical-align"] = {
|
|
627
|
+
superscript: "super",
|
|
628
|
+
subscript: "sub",
|
|
629
|
+
baseline: "baseline"
|
|
630
|
+
}[s]), B(e, "caps") && (n["text-transform"] = U(B(e, "caps")) ? "uppercase" : "none"), H(e, "spacing") && (n["letter-spacing"] = W(H(e, "spacing"))), H(e, "position") && (n["--az-position"] = H(e, "position")), n;
|
|
631
|
+
}
|
|
632
|
+
function pe(e, t) {
|
|
633
|
+
let n = t.reduce((e, t) => K(t, e), {}), r = {
|
|
634
|
+
...e,
|
|
635
|
+
...n
|
|
636
|
+
};
|
|
637
|
+
for (let [t, i, a] of [[
|
|
638
|
+
"text-transform",
|
|
639
|
+
"uppercase",
|
|
640
|
+
"none"
|
|
641
|
+
], [
|
|
642
|
+
"--az-decoration-strike",
|
|
643
|
+
"1",
|
|
644
|
+
"0"
|
|
645
|
+
]]) n[t] !== void 0 && (r[t] = e[t] === i == (n[t] === i) ? a : i);
|
|
646
|
+
return K(null, r);
|
|
607
647
|
}
|
|
608
|
-
function
|
|
648
|
+
function me(e) {
|
|
609
649
|
let t = {}, n = H(e, "jc");
|
|
610
650
|
n && (t["text-align"] = {
|
|
611
651
|
both: "justify",
|
|
@@ -645,7 +685,7 @@ function pe(e) {
|
|
|
645
685
|
}
|
|
646
686
|
return t;
|
|
647
687
|
}
|
|
648
|
-
function
|
|
688
|
+
function he(e) {
|
|
649
689
|
if (!e) return;
|
|
650
690
|
if (["nil", "none"].includes(V(e))) return "none";
|
|
651
691
|
let t = {
|
|
@@ -657,7 +697,7 @@ function me(e) {
|
|
|
657
697
|
}
|
|
658
698
|
//#endregion
|
|
659
699
|
//#region src/library/hujjat/page-layout.ts
|
|
660
|
-
function
|
|
700
|
+
function ge(e) {
|
|
661
701
|
let t = E().page, n = B(e, "pgSz"), r = B(e, "pgMar"), i = (e, t, n) => V(e, t) === "" ? n : Number(V(e, t)), a = i(n, "w", t.widthTwips), o = i(n, "h", t.heightTwips);
|
|
662
702
|
return E({ page: {
|
|
663
703
|
widthTwips: a,
|
|
@@ -666,10 +706,10 @@ function he(e) {
|
|
|
666
706
|
margins: Object.fromEntries(Object.entries(t.margins).map(([e, t]) => [e, i(r, e, t)]))
|
|
667
707
|
} }).page;
|
|
668
708
|
}
|
|
669
|
-
function
|
|
709
|
+
function _e(e, t, n, r) {
|
|
670
710
|
let i = E(t), a = Array.from(e.getElementsByTagNameNS(R, "sectPr")), o;
|
|
671
711
|
try {
|
|
672
|
-
o = a.map(
|
|
712
|
+
o = a.map(ge);
|
|
673
713
|
} catch (e) {
|
|
674
714
|
M(n, "unsupported-page-layout", e instanceof Error ? e.message : "Неподдерживаемые параметры страницы.", "loss", {
|
|
675
715
|
stage: "export",
|
|
@@ -702,7 +742,7 @@ function ge(e, t, n, r) {
|
|
|
702
742
|
}
|
|
703
743
|
//#endregion
|
|
704
744
|
//#region src/library/hujjat/paragraph-format.ts
|
|
705
|
-
function
|
|
745
|
+
function ve(e) {
|
|
706
746
|
let t, n = "auto";
|
|
707
747
|
for (let r of e) {
|
|
708
748
|
let e = B(r, "spacing");
|
|
@@ -715,10 +755,10 @@ function _e(e) {
|
|
|
715
755
|
rule: n
|
|
716
756
|
} : void 0;
|
|
717
757
|
}
|
|
718
|
-
function
|
|
758
|
+
function ye(e) {
|
|
719
759
|
return e.rule === "auto" ? String(e.value / 240) : `${e.value / 20}pt`;
|
|
720
760
|
}
|
|
721
|
-
function
|
|
761
|
+
function be(e) {
|
|
722
762
|
let t = 0, n = 0;
|
|
723
763
|
for (let r of e) {
|
|
724
764
|
if (r["--az-hidden"] === "1") continue;
|
|
@@ -729,7 +769,7 @@ function ye(e) {
|
|
|
729
769
|
}
|
|
730
770
|
//#endregion
|
|
731
771
|
//#region src/library/hujjat/docx-chrome.ts
|
|
732
|
-
async function
|
|
772
|
+
async function xe(e, t, n, r, i) {
|
|
733
773
|
let a = Object.keys(e.files).filter((e) => /^word\/(header|footer)[^/]*\.xml$/.test(e)), o = Array.from(t.getElementsByTagNameNS(R, "sectPr")).flatMap((e) => z(e).filter((e) => ["headerReference", "footerReference"].includes(e.localName)));
|
|
734
774
|
if (n === void 0) {
|
|
735
775
|
(a.length || o.length) && M(r, "header-footer-removed", "Для сохранения колонтитулов передайте page (или locales с page) в exportHujjat.", "loss", { stage: "export" });
|
|
@@ -772,8 +812,8 @@ async function be(e, t, n, r, i) {
|
|
|
772
812
|
}
|
|
773
813
|
//#endregion
|
|
774
814
|
//#region src/library/hujjat/server-page.ts
|
|
775
|
-
var
|
|
776
|
-
function
|
|
815
|
+
var Se = 102400;
|
|
816
|
+
function Ce(e) {
|
|
777
817
|
if (e == null) return;
|
|
778
818
|
let t = (e) => {
|
|
779
819
|
throw new A(`Некорректное поле page.${e} в контракте Hujjat.`);
|
|
@@ -810,8 +850,8 @@ function Se(e) {
|
|
|
810
850
|
e in n && r !== null && ((!r || typeof r != "object" || Array.isArray(r) || typeof r.html != "string") && t(`${e}.html`), new TextEncoder().encode(r.html).length > 102400 && t(`${e}.html (100 КиБ)`));
|
|
811
851
|
}
|
|
812
852
|
}
|
|
813
|
-
function
|
|
814
|
-
if (
|
|
853
|
+
function we(e, t) {
|
|
854
|
+
if (Ce(e), !e) return e;
|
|
815
855
|
let n = structuredClone(e);
|
|
816
856
|
for (let e of ["header", "footer"]) {
|
|
817
857
|
let r = n[e];
|
|
@@ -825,9 +865,9 @@ function Ce(e, t) {
|
|
|
825
865
|
}
|
|
826
866
|
})));
|
|
827
867
|
}
|
|
828
|
-
return
|
|
868
|
+
return Ce(n), n;
|
|
829
869
|
}
|
|
830
|
-
function
|
|
870
|
+
function Te(e, t = {}) {
|
|
831
871
|
let n = E();
|
|
832
872
|
return e?.orientation === "landscape" && ([n.page.widthTwips, n.page.heightTwips] = [n.page.heightTwips, n.page.widthTwips], n.page.orientation = "landscape"), E({
|
|
833
873
|
...t,
|
|
@@ -836,7 +876,7 @@ function we(e, t = {}) {
|
|
|
836
876
|
}
|
|
837
877
|
//#endregion
|
|
838
878
|
//#region src/library/hujjat/docx-to-html.ts
|
|
839
|
-
async function
|
|
879
|
+
async function Ee(e, t = {}, n) {
|
|
840
880
|
if (e.byteLength > 31457280) throw new A("DOCX превышает 30 МиБ.");
|
|
841
881
|
let r;
|
|
842
882
|
try {
|
|
@@ -851,7 +891,7 @@ async function Te(e, t = {}, n) {
|
|
|
851
891
|
if (!Array.from(a?.getElementsByTagNameNS("*", "Override") ?? []).some((e) => e.getAttribute("PartName") === "/word/document.xml" && e.getAttribute("ContentType") === "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml")) throw new A("Файл не является обычным DOCX.");
|
|
852
892
|
let o = await G(r, "word/document.xml"), s = await G(r, "word/styles.xml"), c = await G(r, "word/numbering.xml"), l = B(o?.documentElement, "body");
|
|
853
893
|
if (!l) throw new A("В DOCX нет поддерживаемой структуры документа.");
|
|
854
|
-
let u = [], d =
|
|
894
|
+
let u = [], d = _e(l, t, u, n === void 0 ? void 0 : Te(n).page), f, m = (e, t, n = "warning", r, i) => M(u, e, t, n, {
|
|
855
895
|
stage: "export",
|
|
856
896
|
location: f ? { ...f } : void 0,
|
|
857
897
|
before: r,
|
|
@@ -861,7 +901,7 @@ async function Te(e, t = {}, n) {
|
|
|
861
901
|
let b = B(s?.documentElement, "docDefaults"), x = {
|
|
862
902
|
"margin-top": "0pt",
|
|
863
903
|
"margin-bottom": "8px",
|
|
864
|
-
...
|
|
904
|
+
...me(B(B(b, "pPrDefault"), "pPr"))
|
|
865
905
|
}, S = {
|
|
866
906
|
"font-family": "freeserif",
|
|
867
907
|
"font-size": "12pt",
|
|
@@ -894,7 +934,7 @@ async function Te(e, t = {}, n) {
|
|
|
894
934
|
...f,
|
|
895
935
|
runIndex: y++
|
|
896
936
|
};
|
|
897
|
-
let r = B(e, "rPr"), i =
|
|
937
|
+
let r = B(e, "rPr"), i = K(r, pe(t, w(H(r, "rStyle")).map((e) => B(e, "rPr"))));
|
|
898
938
|
if (i["--az-hidden"] === "1") return h("hidden-text-removed", "Скрытый текст Word исключён из HTML."), "";
|
|
899
939
|
Number(i["--az-position"]) && m("baseline-shift-lost", "Вертикальное смещение фрагмента Word не представлено в HTML.", "loss", Number(i["--az-position"]) / 2, 0);
|
|
900
940
|
let a = Object.fromEntries(Object.entries(i).filter(([e]) => !e.startsWith("--az-")));
|
|
@@ -945,24 +985,24 @@ async function Te(e, t = {}, n) {
|
|
|
945
985
|
"pageBreakBefore",
|
|
946
986
|
"spacing"
|
|
947
987
|
].includes(e.localName)) && V(a, "before") === "0" && V(a, "after") === "0" && V(a, "line") === "1" && V(a, "lineRule") === "exact" && Array.from(e.children).every((e) => e === r)) return { html: "<div style=\"page-break-before:always\"></div>" };
|
|
948
|
-
let o = [...i.map((e) => B(e, "pPr")), r], s = Object.assign({}, x, ...o.map(
|
|
988
|
+
let o = [...i.map((e) => B(e, "pPr")), r], s = Object.assign({}, x, ...o.map(me)), c = o.map((e) => B(e, "numPr")).filter(Boolean).at(-1), l = H(c, "numId"), d = Number(H(c, "ilvl") || 0), p = H(r, "pStyle") === "AzHujjatListContinuation";
|
|
949
989
|
if (l && l !== "0" || p) {
|
|
950
|
-
let e = E.get(l), t =
|
|
990
|
+
let e = E.get(l), t = me(B(z(D.get(H(e, "abstractNumId")), "lvl").find((e) => V(e, "ilvl") === String(d)), "pPr"));
|
|
951
991
|
s["margin-left"] = W((parseFloat(s["margin-left"] ?? t["margin-left"] ?? "0") || 0) * 20 - 360), s["text-indent"] ??= t["text-indent"] ?? "0pt";
|
|
952
992
|
}
|
|
953
993
|
parseFloat(s["text-indent"] ?? "0") < 0 && parseFloat(s["margin-left"] ?? "0") >= 0 && (s["padding-left"] = s["margin-left"] ?? "0pt", s["margin-left"] = "0pt");
|
|
954
|
-
let _ =
|
|
955
|
-
_ && (s["line-height"] =
|
|
956
|
-
let C =
|
|
994
|
+
let _ = ve([B(B(b, "pPrDefault"), "pPr"), ...o]);
|
|
995
|
+
_ && (s["line-height"] = ye(_));
|
|
996
|
+
let C = pe(S, i.map((e) => B(e, "rPr"))), O = K(B(r, "rPr"), C);
|
|
957
997
|
O["--az-hidden"] === "1" && (m("hidden-paragraph-mark-lost", "Скрытый знак абзаца нельзя представить в HTML; его отдельный шрифт заменён стилем абзаца.", "loss", "hidden", "visible paragraph style"), O = {
|
|
958
998
|
...C,
|
|
959
999
|
"--az-hidden": "0"
|
|
960
1000
|
}), s["font-family"] = O["font-family"], s["font-size"] = O["font-size"];
|
|
961
1001
|
let A = Array.from(e.getElementsByTagNameNS(R, "r")).map((e) => {
|
|
962
1002
|
let t = B(e, "rPr");
|
|
963
|
-
return
|
|
1003
|
+
return K(t, pe(C, w(H(t, "rStyle")).map((e) => B(e, "rPr"))));
|
|
964
1004
|
}), j = s["line-height"];
|
|
965
|
-
j && (/^\d*\.?\d+$/.test(j) ? Number(j) < 1 : j.endsWith("pt") && parseFloat(j) <
|
|
1005
|
+
j && (/^\d*\.?\d+$/.test(j) ? Number(j) < 1 : j.endsWith("pt") && parseFloat(j) < be([O, ...A])) && (t.lineSpacingPolicy === "preserve" ? m("line-height-overlap-risk", "Авторский тесный интервал сохранён; строки могут перекрываться. Фактические метрики шрифта требуют проверки.", "warning", j, j) : (s["line-height"] = /^\d*\.?\d+$/.test(j) ? "1" : "normal", m("line-height-normalized", "Тесный межстрочный интервал нормализован по размерам фрагментов. Проверьте переносы на используемых шрифтах.", "warning", j, s["line-height"]))), j?.endsWith("pt") && t.lineSpacingPolicy !== "preserve" && m("line-height-metrics-estimated", "Проверка интервала использует размеры и смещения фрагментов, а не метрики установленного шрифта. Результат нормализации требует проверки на используемых шрифтах.", "warning", j, s["line-height"]), _ && _.rule !== "auto" && m("line-rule-lost", "CSS line-height не сохраняет различие правил Word exact и atLeast.", "warning", _.rule, "CSS line-height"), o.some((e) => B(e, "tabs")) && h("tab-stops-removed", "Позиции, типы и заполнители табуляции не поддерживаются HTML-блоком.");
|
|
966
1006
|
let N = [B(B(b, "pPrDefault"), "pPr"), ...o].map((e) => B(e, "widowControl")).filter(Boolean).at(-1);
|
|
967
1007
|
N && M(u, "widow-control-lost", "Правило висячих строк Word не представлено в HTML-контракте.", "loss", {
|
|
968
1008
|
stage: "export",
|
|
@@ -1048,7 +1088,7 @@ async function Te(e, t = {}, n) {
|
|
|
1048
1088
|
"bottom",
|
|
1049
1089
|
"left"
|
|
1050
1090
|
]) {
|
|
1051
|
-
let i = B(B(e, "tcBorders"), t), o = t === "top" && r > 0 || t === "bottom" && r < c.length - 1 ? "insideH" : t === "left" && x > 0 || t === "right" && x + f < d ? "insideV" : t, s = B(a, o), l =
|
|
1091
|
+
let i = B(B(e, "tcBorders"), t), o = t === "top" && r > 0 || t === "bottom" && r < c.length - 1 ? "insideH" : t === "left" && x > 0 || t === "right" && x + f < d ? "insideV" : t, s = B(a, o), l = he(i ?? s);
|
|
1052
1092
|
l && (g[`border-${t}`] = l);
|
|
1053
1093
|
let u = B(B(e, "tcMar"), t) ?? B(B(n, "tblCellMar"), t);
|
|
1054
1094
|
u && V(u, "w") && (g[`padding-${t}`] = W(V(u, "w")));
|
|
@@ -1101,7 +1141,7 @@ async function Te(e, t = {}, n) {
|
|
|
1101
1141
|
].includes(a.localName) || (i(), h("unsupported-block", `Блок Word ${a.localName} не поддерживается HTML-адаптером.`)));
|
|
1102
1142
|
return i(), n;
|
|
1103
1143
|
}
|
|
1104
|
-
let ee = L(l, 0) || "<p><br></p>", te = await
|
|
1144
|
+
let ee = L(l, 0) || "<p><br></p>", te = await xe(r, l, n, u, (e, t) => (v = t, O.clear(), g = new Map(Array.from(e.getElementsByTagNameNS(R, "p")).map((e, t) => [e, t])), _ = new Map(Array.from(e.getElementsByTagNameNS(R, "tbl")).map((e, t) => [e, t])), L(e, 0) || "<p><br></p>"));
|
|
1105
1145
|
return d && n !== void 0 && d.page.orientation !== (te?.orientation ?? "portrait") ? {
|
|
1106
1146
|
html: ee,
|
|
1107
1147
|
warnings: u,
|
|
@@ -1120,7 +1160,7 @@ async function Te(e, t = {}, n) {
|
|
|
1120
1160
|
//#endregion
|
|
1121
1161
|
//#region src/library/hujjat/table-grid.ts
|
|
1122
1162
|
var q = 1e-7;
|
|
1123
|
-
function
|
|
1163
|
+
function De(e, t, n) {
|
|
1124
1164
|
let r = Array.from({ length: e + 1 }, () => []), i = (e, t, n) => {
|
|
1125
1165
|
r[e].push({
|
|
1126
1166
|
to: t,
|
|
@@ -1185,7 +1225,7 @@ function J(e, t) {
|
|
|
1185
1225
|
}
|
|
1186
1226
|
return null;
|
|
1187
1227
|
}
|
|
1188
|
-
function
|
|
1228
|
+
function Oe(e) {
|
|
1189
1229
|
if (!e) return null;
|
|
1190
1230
|
let t = (t) => ({
|
|
1191
1231
|
...e,
|
|
@@ -1203,7 +1243,7 @@ function De(e) {
|
|
|
1203
1243
|
}
|
|
1204
1244
|
return r > q ? a : null;
|
|
1205
1245
|
}
|
|
1206
|
-
function
|
|
1246
|
+
function ke(e) {
|
|
1207
1247
|
let t = J(e), n = J(e, 0);
|
|
1208
1248
|
if (n) return n;
|
|
1209
1249
|
let r = 0, i = Math.max(...t.map((t, n) => Math.max(e.low[n] - t, t - e.high[n]))) + 1;
|
|
@@ -1213,20 +1253,20 @@ function Oe(e) {
|
|
|
1213
1253
|
}
|
|
1214
1254
|
return t;
|
|
1215
1255
|
}
|
|
1216
|
-
function
|
|
1256
|
+
function Ae(e, t, n, r) {
|
|
1217
1257
|
let i = (e) => Number.isFinite(e) && e > 0 && e < (2 ** 53 - 1) / 4;
|
|
1218
1258
|
if (!Number.isInteger(e) || e < 1 || e > 1e3 || !i(t) || Math.round(t) < e) throw new A("Некорректный размер сетки таблицы.");
|
|
1219
1259
|
for (let t of n) if (!Number.isInteger(t.column) || !Number.isInteger(t.span) || t.column < 0 || t.span < 1 || t.column + t.span > e || !i(t.width)) throw new A("Некорректное ограничение ширины таблицы.");
|
|
1220
|
-
let a = (e) => e.source === "column" ? 0 : e.span === 1 ? 1 : 2, o = (e) => JSON.stringify(Object.entries(e.location ?? {}).sort(([e], [t]) => e < t ? -1 : +(e > t))), s = [...n].sort((e, t) => a(e) - a(t) || e.column - t.column || e.span - t.span || e.width - t.width || o(e).localeCompare(o(t), "en")), c = s.filter((e, t) => !t || a(e) !== a(s[t - 1]) || e.column !== s[t - 1].column || e.span !== s[t - 1].span || e.width !== s[t - 1].width), l = De(
|
|
1260
|
+
let a = (e) => e.source === "column" ? 0 : e.span === 1 ? 1 : 2, o = (e) => JSON.stringify(Object.entries(e.location ?? {}).sort(([e], [t]) => e < t ? -1 : +(e > t))), s = [...n].sort((e, t) => a(e) - a(t) || e.column - t.column || e.span - t.span || e.width - t.width || o(e).localeCompare(o(t), "en")), c = s.filter((e, t) => !t || a(e) !== a(s[t - 1]) || e.column !== s[t - 1].column || e.span !== s[t - 1].span || e.width !== s[t - 1].width), l = Oe(De(e, t, c));
|
|
1221
1261
|
if (!l) {
|
|
1222
1262
|
let n = [];
|
|
1223
|
-
l = De(
|
|
1263
|
+
l = Oe(De(e, t, []));
|
|
1224
1264
|
for (let r of c) {
|
|
1225
|
-
let i = De(
|
|
1265
|
+
let i = Oe(De(e, t, [...n, r]));
|
|
1226
1266
|
i && (i.groups < l.groups && n.push(r), l = i);
|
|
1227
1267
|
}
|
|
1228
1268
|
}
|
|
1229
|
-
let u =
|
|
1269
|
+
let u = ke(l), d = l.offset.map((e, t) => e + u[l.component[t]]), f = Math.round(t), p = d.map((e) => Math.round(e));
|
|
1230
1270
|
p[0] = 0, p[e] = f;
|
|
1231
1271
|
let m = d.map((e) => Math.floor(e + 1 + q));
|
|
1232
1272
|
m[e] = f;
|
|
@@ -1251,7 +1291,7 @@ function ke(e, t, n, r) {
|
|
|
1251
1291
|
}
|
|
1252
1292
|
//#endregion
|
|
1253
1293
|
//#region src/library/hujjat/html-to-docx.ts
|
|
1254
|
-
var
|
|
1294
|
+
var je = /^(font-|color$|text-align$|text-indent$|text-transform$|line-height$|letter-spacing$|white-space$|text-decoration$|vertical-align$)/, Me = new Set("p div h1 h2 h3 h4 h5 h6 ul ol li table hr".split(" ")), Ne = {
|
|
1255
1295
|
black: "000000",
|
|
1256
1296
|
white: "FFFFFF",
|
|
1257
1297
|
red: "FF0000",
|
|
@@ -1275,7 +1315,7 @@ function Y(e) {
|
|
|
1275
1315
|
if (/^#[\da-f]{6}$/i.test(e)) return e.slice(1);
|
|
1276
1316
|
if (/^#[\da-f]{3}$/i.test(e)) return e.slice(1).split("").map((e) => e + e).join("");
|
|
1277
1317
|
let t = e.match(/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
|
|
1278
|
-
return t ? t.slice(1).map((e) => Math.min(255, Number(e)).toString(16).padStart(2, "0")).join("") :
|
|
1318
|
+
return t ? t.slice(1).map((e) => Math.min(255, Number(e)).toString(16).padStart(2, "0")).join("") : Ne[e.toLowerCase()];
|
|
1279
1319
|
}
|
|
1280
1320
|
function X(e) {
|
|
1281
1321
|
if (e === "0") return 0;
|
|
@@ -1292,10 +1332,11 @@ function X(e) {
|
|
|
1292
1332
|
var Z = (e) => {
|
|
1293
1333
|
let t = X(e);
|
|
1294
1334
|
return t === void 0 ? void 0 : Math.round(t * 20);
|
|
1295
|
-
},
|
|
1335
|
+
}, Pe = (e, t) => (Z(e[`margin-${t}`]) ?? 0) + Math.max(0, Z(e[`padding-${t}`]) ?? 0);
|
|
1296
1336
|
function Q(e, t) {
|
|
1297
1337
|
let n = { ...t }, r = e.style;
|
|
1298
1338
|
for (let e of Array.from(r)) n[e] = r.getPropertyValue(e).trim();
|
|
1339
|
+
r.textDecoration && (n["text-decoration"] = r.textDecoration);
|
|
1299
1340
|
for (let e of [
|
|
1300
1341
|
"before",
|
|
1301
1342
|
"after",
|
|
@@ -1320,8 +1361,8 @@ function Q(e, t) {
|
|
|
1320
1361
|
h3: "12pt"
|
|
1321
1362
|
}[i] ?? "12pt"), r.fontWeight || (n["font-weight"] = "bold")), n;
|
|
1322
1363
|
}
|
|
1323
|
-
var
|
|
1324
|
-
async function
|
|
1364
|
+
var Fe = (e) => Object.fromEntries(Object.entries(e).filter(([e]) => je.test(e)));
|
|
1365
|
+
async function Ie(e, t, n = E(), r) {
|
|
1325
1366
|
let i = {
|
|
1326
1367
|
width: T(n.page),
|
|
1327
1368
|
cell: !1
|
|
@@ -1359,7 +1400,7 @@ async function Fe(e, t, n = E(), r) {
|
|
|
1359
1400
|
n || d.push(e);
|
|
1360
1401
|
return;
|
|
1361
1402
|
}
|
|
1362
|
-
let r = e instanceof Element ? e : null, i = r && (
|
|
1403
|
+
let r = e instanceof Element ? e : null, i = r && (Me.has(r.localName) || [
|
|
1363
1404
|
"br",
|
|
1364
1405
|
"td",
|
|
1365
1406
|
"th",
|
|
@@ -1415,7 +1456,7 @@ async function Fe(e, t, n = E(), r) {
|
|
|
1415
1456
|
}
|
|
1416
1457
|
};
|
|
1417
1458
|
i(r), a(s, r);
|
|
1418
|
-
let c = Z(p) / 20 <
|
|
1459
|
+
let c = Z(p) / 20 < be(e), l = n.lineSpacingPolicy === "normalize";
|
|
1419
1460
|
c && M(t, l ? "line-height-normalized" : "line-height-overlap-risk", l ? "Тесный абсолютный интервал заменён естественным одинарным интервалом." : "Тесный абсолютный интервал сохранён; проверьте наложение строк.", "warning", {
|
|
1420
1461
|
stage: "import",
|
|
1421
1462
|
location: { htmlPath: o.htmlPath },
|
|
@@ -1496,7 +1537,7 @@ async function Fe(e, t, n = E(), r) {
|
|
|
1496
1537
|
let d = [], f = o.parentElement;
|
|
1497
1538
|
for (; f && f !== e;) d.unshift(f), f = f.parentElement;
|
|
1498
1539
|
let p = (e) => ({
|
|
1499
|
-
...
|
|
1540
|
+
...Fe(e),
|
|
1500
1541
|
...e["background-color"] ? { "background-color": e["background-color"] } : {}
|
|
1501
1542
|
}), g = Q(o, p(d.reduce((e, t) => Q(t, p(e)), n)));
|
|
1502
1543
|
o.localName === "th" && (g["font-weight"] = "bold");
|
|
@@ -1548,7 +1589,7 @@ async function Fe(e, t, n = E(), r) {
|
|
|
1548
1589
|
}
|
|
1549
1590
|
}
|
|
1550
1591
|
if (_ > o) throw new A("Число явных колонок превышает логическую сетку ячеек.");
|
|
1551
|
-
let v =
|
|
1592
|
+
let v = Ae(o, p, s, t), b = "<w:p><w:pPr><w:spacing w:before=\"0\" w:after=\"0\"/></w:pPr></w:p>", x = !0, S = g.map((e, n) => {
|
|
1552
1593
|
let r = i[n], a = Q(r, {}), o = Z(a.height), s = o !== void 0 && o >= 0 ? `<w:trHeight w:val="${o}" w:hRule="atLeast"/>` : "";
|
|
1553
1594
|
["avoid", "auto"].includes(a["page-break-inside"]) && (s += `<w:cantSplit w:val="${a["page-break-inside"] === "avoid" ? "1" : "0"}"/>`);
|
|
1554
1595
|
let c = r.parentElement?.localName === "thead";
|
|
@@ -1573,7 +1614,7 @@ async function Fe(e, t, n = E(), r) {
|
|
|
1573
1614
|
l && (o += `<w:tcBorders>${l}</w:tcBorders>`);
|
|
1574
1615
|
let u = c.map((e) => Z(i[`padding-${e}`]) === void 0 ? "" : `<w:${e} w:w="${Math.max(0, Z(i[`padding-${e}`]))}" w:type="dxa"/>`).join("");
|
|
1575
1616
|
u && (o += `<w:tcMar>${u}</w:tcMar>`);
|
|
1576
|
-
let d = Math.max(1, a - Math.max(0, Z(i["padding-left"]) ?? 0) - Math.max(0, Z(i["padding-right"]) ?? 0)), f = C(
|
|
1617
|
+
let d = Math.max(1, a - Math.max(0, Z(i["padding-left"]) ?? 0) - Math.max(0, Z(i["padding-right"]) ?? 0)), f = w(C(e.childNodes, Fe(i), void 0, {
|
|
1577
1618
|
width: d,
|
|
1578
1619
|
cell: !0
|
|
1579
1620
|
}));
|
|
@@ -1585,12 +1626,30 @@ async function Fe(e, t, n = E(), r) {
|
|
|
1585
1626
|
"bottom",
|
|
1586
1627
|
"right"
|
|
1587
1628
|
].map((t) => y(e, t)).join(""), O = n["table-layout"] === "auto" ? "autofit" : "fixed";
|
|
1588
|
-
return `<w:tbl><w:tblPr>${E}${u ? `<w:tblInd w:w="${u}" w:type="dxa"/>` : ""}${D ? `<w:tblBorders>${D}</w:tblBorders>` : ""}<w:tblLayout w:type="${O}"/></w:tblPr><w:tblGrid>${T}</w:tblGrid>${
|
|
1629
|
+
return `<w:tbl><w:tblPr>${E}${u ? `<w:tblInd w:w="${u}" w:type="dxa"/>` : ""}${D ? `<w:tblBorders>${D}</w:tblBorders>` : ""}<w:tblLayout w:type="${O}"/></w:tblPr><w:tblGrid>${T}</w:tblGrid>${S}</w:tbl>`;
|
|
1589
1630
|
}
|
|
1590
1631
|
function x(e, t) {
|
|
1591
1632
|
return e.length && (e[0].before ||= t["page-break-before"] === "always", e[e.length - 1].after ||= t["page-break-after"] === "always"), e;
|
|
1592
1633
|
}
|
|
1593
|
-
function S(e, n,
|
|
1634
|
+
function S(e, n, r) {
|
|
1635
|
+
if (n["page-break-inside"] !== "avoid") return e;
|
|
1636
|
+
if (e.some((e) => e.table)) return M(t, "keep-group-not-representable", "Группа с таблицей не может быть целиком удержана на странице текущим HTML/DOCX-адаптером.", "loss", {
|
|
1637
|
+
stage: "import",
|
|
1638
|
+
location: { htmlPath: r },
|
|
1639
|
+
before: "page-break-inside:avoid",
|
|
1640
|
+
after: null
|
|
1641
|
+
}), e;
|
|
1642
|
+
let i = (e, t, n) => e.replace(/<w:pPr>(.*?)<\/w:pPr>/s, (e, r) => `<w:pPr>${r.replace(RegExp(`<w:${t}\\b[^>]*\\/>`, "g"), "")}<w:${t} w:val="${n ? "1" : "0"}"/></w:pPr>`);
|
|
1643
|
+
return e.map((t, n) => {
|
|
1644
|
+
if (t.marker) return t;
|
|
1645
|
+
let r = i(t.xml, "keepLines", !0), a = e[n + 1];
|
|
1646
|
+
return a && (r = i(r, "keepNext", !t.after && !a.marker && !a.before)), {
|
|
1647
|
+
...t,
|
|
1648
|
+
xml: r
|
|
1649
|
+
};
|
|
1650
|
+
});
|
|
1651
|
+
}
|
|
1652
|
+
function C(e, n, a, c = i) {
|
|
1594
1653
|
let u = [], d = [], f = 0, p = Array.from(e).filter((e) => e.nodeType !== 3 || e.textContent), m = (e, t = e) => ({
|
|
1595
1654
|
...c,
|
|
1596
1655
|
before: e === 0 ? c.before : void 0,
|
|
@@ -1599,19 +1658,19 @@ async function Fe(e, t, n = E(), r) {
|
|
|
1599
1658
|
d.length && u.push(...x([{ xml: v(d, n, a, m(f, e)) }], n)), d = [];
|
|
1600
1659
|
};
|
|
1601
1660
|
for (let [e, i] of p.entries()) {
|
|
1602
|
-
if (!(i instanceof Element) || !
|
|
1661
|
+
if (!(i instanceof Element) || !Me.has(i.localName)) {
|
|
1603
1662
|
d.length || (f = e), d.push(i);
|
|
1604
1663
|
continue;
|
|
1605
1664
|
}
|
|
1606
1665
|
h(e - 1);
|
|
1607
|
-
let p = Q(i,
|
|
1666
|
+
let p = Q(i, Fe(n)), g = {
|
|
1608
1667
|
...m(e),
|
|
1609
1668
|
htmlPath: l.get(i)
|
|
1610
1669
|
};
|
|
1611
|
-
if (i.localName === "p" && r?.paragraph_spacing !== void 0 && (p["margin-bottom"] ??= `${r.paragraph_spacing}pt`), r !== void 0 && i.localName === "h1" && (p["margin-bottom"] ??= "7.5pt"), i.localName === "table") u.push(...x([{
|
|
1670
|
+
if (i.localName === "p" && r?.paragraph_spacing !== void 0 && (p["margin-bottom"] ??= `${r.paragraph_spacing}pt`), r !== void 0 && i.localName === "h1" && (p["margin-bottom"] ??= "7.5pt"), i.localName === "table") u.push(...x(S([{
|
|
1612
1671
|
xml: b(i, p, g),
|
|
1613
1672
|
table: !0
|
|
1614
|
-
}], p));
|
|
1673
|
+
}], p, g.htmlPath), p));
|
|
1615
1674
|
else if (i.localName === "ol" || i.localName === "ul") {
|
|
1616
1675
|
let e = o++;
|
|
1617
1676
|
s.push({
|
|
@@ -1623,30 +1682,30 @@ async function Fe(e, t, n = E(), r) {
|
|
|
1623
1682
|
let a = {
|
|
1624
1683
|
id: e,
|
|
1625
1684
|
pending: !0
|
|
1626
|
-
}, o = Q(i,
|
|
1685
|
+
}, o = Q(i, Fe(p)), s = {
|
|
1627
1686
|
...g,
|
|
1628
1687
|
before: Math.max(t === 0 ? g.before ?? 0 : 0, Z(o["margin-top"]) ?? 0),
|
|
1629
1688
|
after: Math.max(t === n.length - 1 ? g.after ?? 0 : 0, Z(o["margin-bottom"]) ?? 0),
|
|
1630
|
-
left: (g.left ?? 0) +
|
|
1631
|
-
right: (g.right ?? 0) +
|
|
1632
|
-
}, c = Object.fromEntries(Object.entries(o).filter(([e]) => !/^(margin|padding)(-|$)/.test(e))),
|
|
1633
|
-
r.push(...x(
|
|
1689
|
+
left: (g.left ?? 0) + Pe(p, "left") + Pe(o, "left"),
|
|
1690
|
+
right: (g.right ?? 0) + Pe(p, "right") + Pe(o, "right")
|
|
1691
|
+
}, c = Object.fromEntries(Object.entries(o).filter(([e]) => !/^(margin|padding)(-|$)/.test(e))), u = C(i.childNodes, c, a, s);
|
|
1692
|
+
r.push(...x(S(u.length ? u : [{ xml: v([], c, a, s) }], o, l.get(i)), o));
|
|
1634
1693
|
}
|
|
1635
|
-
u.push(...x(r, p));
|
|
1636
|
-
} else i.localName === "div" && Array.from(i.children).some((e) =>
|
|
1694
|
+
u.push(...x(S(r, p, g.htmlPath), p));
|
|
1695
|
+
} else i.localName === "div" && Array.from(i.children).some((e) => Me.has(e.localName)) ? u.push(...x(S(C(i.childNodes, Fe(p), a, {
|
|
1637
1696
|
...g,
|
|
1638
|
-
left: (g.left ?? 0) +
|
|
1639
|
-
right: (g.right ?? 0) +
|
|
1697
|
+
left: (g.left ?? 0) + Pe(p, "left"),
|
|
1698
|
+
right: (g.right ?? 0) + Pe(p, "right"),
|
|
1640
1699
|
before: Math.max(g.before ?? 0, Z(p["margin-top"]) ?? 0),
|
|
1641
1700
|
after: Math.max(g.after ?? 0, Z(p["margin-bottom"]) ?? 0)
|
|
1642
|
-
}), p)) : i.localName === "div" && !i.children.length && !i.textContent && p["page-break-before"] === "always" && Array.from(i.style).every((e) => ["page-break-before", "break-before"].includes(e)) ? u.push({
|
|
1701
|
+
}), p, g.htmlPath), p)) : i.localName === "div" && !i.children.length && !i.textContent && p["page-break-before"] === "always" && Array.from(i.style).every((e) => ["page-break-before", "break-before"].includes(e)) ? u.push({
|
|
1643
1702
|
xml: "",
|
|
1644
1703
|
marker: !0
|
|
1645
1704
|
}) : i.localName === "hr" ? (M(t, "rule-normalized", "Разделитель HTML преобразован в строку."), u.push(...x([{ xml: v([document.createTextNode("────────────────")], p, void 0, c) }], p))) : u.push(...x([{ xml: v(i.childNodes, p, a, g) }], p));
|
|
1646
1705
|
}
|
|
1647
1706
|
return h(p.length - 1), u;
|
|
1648
1707
|
}
|
|
1649
|
-
function
|
|
1708
|
+
function w(e) {
|
|
1650
1709
|
let t = "<w:p><w:pPr><w:pStyle w:val=\"AzHujjatPageBoundary\"/><w:pageBreakBefore/><w:spacing w:before=\"0\" w:after=\"0\" w:line=\"1\" w:lineRule=\"exact\"/></w:pPr></w:p>", n = "", r = !1, i = 0;
|
|
1651
1710
|
for (let a of e) {
|
|
1652
1711
|
if (a.marker) {
|
|
@@ -1658,14 +1717,16 @@ async function Fe(e, t, n = E(), r) {
|
|
|
1658
1717
|
}
|
|
1659
1718
|
return n + t.repeat(i);
|
|
1660
1719
|
}
|
|
1661
|
-
let
|
|
1720
|
+
let D = w(C(a.childNodes, h)) || "<w:p/>", O = c.map((e) => ({
|
|
1662
1721
|
...e,
|
|
1663
|
-
xml: C(
|
|
1722
|
+
xml: w(C(e.root.childNodes, h)) || "<w:p/>"
|
|
1664
1723
|
}));
|
|
1665
|
-
if (new TextEncoder().encode(
|
|
1666
|
-
let
|
|
1724
|
+
if (new TextEncoder().encode(D + O.map((e) => e.xml).join("")).byteLength > 8387584) throw new A("После преобразования HTML документ превышает допустимый размер XML (8 МиБ).");
|
|
1725
|
+
let k = new Set("font-family font-size font-weight font-style color background-color text-align text-decoration text-transform vertical-align letter-spacing line-height margin margin-top margin-bottom margin-left margin-right text-indent width border border-style border-width border-color border-top border-right border-bottom border-left border-collapse table-layout padding padding-top padding-right padding-bottom padding-left page-break-before page-break-after page-break-inside break-before break-after break-inside".split(" "));
|
|
1667
1726
|
for (let e of [a, ...c.map((e) => e.root)]) for (let n of e.querySelectorAll("[style]")) for (let e of Array.from(n.style)) {
|
|
1668
|
-
let r = n.style.getPropertyValue(e)
|
|
1727
|
+
let r = n.style.getPropertyValue(e);
|
|
1728
|
+
if (e === "text-decoration-line" && /^(none|underline|line-through|underline line-through|line-through underline)$/.test(r) || e === "text-decoration-style" && ["initial", "solid"].includes(r) || e === "text-decoration-color" && ["initial", "currentcolor"].includes(r) || e === "text-decoration-thickness" && ["initial", "auto"].includes(r)) continue;
|
|
1729
|
+
let i = ["td", "th"].includes(n.localName);
|
|
1669
1730
|
e === "vertical-align" && !i && ![
|
|
1670
1731
|
"baseline",
|
|
1671
1732
|
"sub",
|
|
@@ -1676,39 +1737,39 @@ async function Fe(e, t, n = E(), r) {
|
|
|
1676
1737
|
before: r,
|
|
1677
1738
|
after: "baseline"
|
|
1678
1739
|
});
|
|
1679
|
-
let a =
|
|
1680
|
-
(o || !s && !
|
|
1740
|
+
let a = Me.has(n.localName) && !["table", "hr"].includes(n.localName), o = e.startsWith("padding") && !i && (!a || !["padding-left", "padding-right"].includes(e)) || e.startsWith("border") && !i && n.localName !== "table" || e === "font-size" && X(r) === void 0 || ["color", "background-color"].includes(e) && Y(r) === void 0, s = n.localName === "tr" && e === "height" && Z(r) !== void 0 && Z(r) >= 0;
|
|
1741
|
+
(o || !s && !k.has(e) && !/^border-(top|right|bottom|left)-(width|style|color)$/.test(e)) && M(t, "html-style-approximation", `Стиль ${e} может измениться при открытии HTML в DOCX-редакторе.`, "warning", {
|
|
1681
1742
|
stage: "import",
|
|
1682
1743
|
location: { htmlPath: l.get(n) },
|
|
1683
1744
|
before: r
|
|
1684
1745
|
});
|
|
1685
1746
|
}
|
|
1686
|
-
let
|
|
1687
|
-
|
|
1688
|
-
let
|
|
1689
|
-
for (let { kind: e, xml: t } of
|
|
1690
|
-
let
|
|
1691
|
-
|
|
1692
|
-
let
|
|
1693
|
-
return
|
|
1747
|
+
let j = new p();
|
|
1748
|
+
j.file("[Content_Types].xml", "<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\"><Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/><Default Extension=\"xml\" ContentType=\"application/xml\"/><Override PartName=\"/word/document.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml\"/><Override PartName=\"/word/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml\"/><Override PartName=\"/word/numbering.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml\"/></Types>"), j.file("_rels/.rels", "<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\" Target=\"word/document.xml\"/></Relationships>"), j.file("word/_rels/document.xml.rels", "<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rIdStyles\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/><Relationship Id=\"rIdNumbering\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering\" Target=\"numbering.xml\"/></Relationships>");
|
|
1749
|
+
let N = n.page, P = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", F = O.map(({ kind: e }) => `<w:${e}Reference w:type="default" r:id="rId${e}"/>`).join("");
|
|
1750
|
+
for (let { kind: e, xml: t } of O) j.file(`word/${e}1.xml`, `<w:${e === "header" ? "hdr" : "ftr"} xmlns:w="${R}">${t}</w:${e === "header" ? "hdr" : "ftr"}>`);
|
|
1751
|
+
let I = await j.file("[Content_Types].xml").async("string");
|
|
1752
|
+
j.file("[Content_Types].xml", I.replace("</Types>", O.map(({ kind: e }) => `<Override PartName="/word/${e}1.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.${e}+xml"/>`).join("") + "</Types>"));
|
|
1753
|
+
let L = await j.file("word/_rels/document.xml.rels").async("string");
|
|
1754
|
+
return j.file("word/_rels/document.xml.rels", L.replace("</Relationships>", O.map(({ kind: e }) => `<Relationship Id="rId${e}" Type="${P}/${e}" Target="${e}1.xml"/>`).join("") + "</Relationships>")), j.file("word/document.xml", `<w:document xmlns:w="${R}" xmlns:r="${P}"><w:body>${D}<w:sectPr>${F}<w:pgSz w:w="${N.widthTwips}" w:h="${N.heightTwips}" w:orient="${N.orientation}"/><w:pgMar ${Object.entries(N.margins).map(([e, t]) => `w:${e}="${t}"`).join(" ")}/></w:sectPr></w:body></w:document>`), j.file("word/styles.xml", `<w:styles xmlns:w="${R}"><w:docDefaults><w:rPrDefault><w:rPr>${g(h)}</w:rPr></w:rPrDefault></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:pPr><w:spacing w:after="120"/></w:pPr></w:style><w:style w:type="paragraph" w:styleId="AzHujjatListContinuation"><w:name w:val="List continuation"/><w:basedOn w:val="Normal"/></w:style><w:style w:type="paragraph" w:styleId="AzHujjatPageBoundary"><w:name w:val="Page boundary"/><w:basedOn w:val="Normal"/></w:style></w:styles>`), j.file("word/numbering.xml", `<w:numbering xmlns:w="${R}">${s.map(({ id: e, tag: t }) => `<w:abstractNum w:abstractNumId="${e}"><w:multiLevelType w:val="singleLevel"/><w:lvl w:ilvl="0"><w:start w:val="1"/><w:numFmt w:val="${t === "ol" ? "decimal" : "bullet"}"/><w:lvlText w:val="${t === "ol" ? "%1." : "•"}"/><w:pPr><w:ind w:left="360" w:hanging="180"/></w:pPr></w:lvl></w:abstractNum><w:num w:numId="${e}"><w:abstractNumId w:val="${e}"/></w:num>`).join("")}</w:numbering>`), new Uint8Array(await j.generateAsync({
|
|
1694
1755
|
type: "arraybuffer",
|
|
1695
1756
|
compression: "DEFLATE"
|
|
1696
1757
|
}));
|
|
1697
1758
|
}
|
|
1698
1759
|
//#endregion
|
|
1699
1760
|
//#region src/library/hujjat/docx.ts
|
|
1700
|
-
async function
|
|
1761
|
+
async function Le(e, t) {
|
|
1701
1762
|
let n = t.page === void 0 ? t.locales?.[t.locale]?.page : t.page;
|
|
1702
|
-
|
|
1703
|
-
let r = await
|
|
1704
|
-
return i.warnings.unshift(...r.warnings), i.layout = r.layout, i.page =
|
|
1763
|
+
Ce(n);
|
|
1764
|
+
let r = await Ee(e, t.layout, n), i = le(t.locales ?? {}, t.locale, r.html);
|
|
1765
|
+
return i.warnings.unshift(...r.warnings), i.layout = r.layout, i.page = we(r.page, i), i.page !== void 0 && (i.locales[t.locale].page = structuredClone(i.page)), N(i.warnings, t.allowLossy), i;
|
|
1705
1766
|
}
|
|
1706
|
-
async function
|
|
1767
|
+
async function Re(e, t, n = {}) {
|
|
1707
1768
|
let r = oe(ce(e, t));
|
|
1708
|
-
r.page =
|
|
1709
|
-
let i =
|
|
1710
|
-
D(i.page,
|
|
1711
|
-
let a = await
|
|
1769
|
+
r.page = we(e[t]?.page, r);
|
|
1770
|
+
let i = Te(r.page, n.layout);
|
|
1771
|
+
D(i.page, Te(r.page).page) || M(r.warnings, "layout-not-carried-by-html", "Геометрия layout отличается от настроек page на сервере. Текущий PDF-контракт поддерживает только ориентацию A4 и фиксированные поля.", "warning", { stage: "import" });
|
|
1772
|
+
let a = await Ie(r.html, r.warnings, i, r.page);
|
|
1712
1773
|
return N(r.warnings, n.allowLossy), {
|
|
1713
1774
|
...r,
|
|
1714
1775
|
document: a,
|
|
@@ -1717,7 +1778,7 @@ async function Le(e, t, n = {}) {
|
|
|
1717
1778
|
}
|
|
1718
1779
|
//#endregion
|
|
1719
1780
|
//#region src/library/document-diagnostics.ts
|
|
1720
|
-
async function
|
|
1781
|
+
async function ze(e) {
|
|
1721
1782
|
if (e.byteLength > 31457280) throw new A("DOCX превышает 30 МиБ.");
|
|
1722
1783
|
let t = await p.loadAsync(e);
|
|
1723
1784
|
if (Object.keys(t.files).length > 2e3) throw new A("В DOCX более 2000 частей.");
|
|
@@ -1745,13 +1806,13 @@ async function Re(e) {
|
|
|
1745
1806
|
let n = {
|
|
1746
1807
|
part: "word/document.xml",
|
|
1747
1808
|
paragraphIndex: t
|
|
1748
|
-
}, r = B(e, "pPr"), i = d(H(r, "pStyle") || V(u, "styleId")), o =
|
|
1809
|
+
}, r = B(e, "pPr"), i = d(H(r, "pStyle") || V(u, "styleId")), o = ve([
|
|
1749
1810
|
s,
|
|
1750
1811
|
...i.map((e) => B(e, "pPr")),
|
|
1751
1812
|
r
|
|
1752
|
-
]), l =
|
|
1813
|
+
]), l = pe(c, i.map((e) => B(e, "rPr"))), f = [K(B(r, "rPr"), l)];
|
|
1753
1814
|
Array.from(e.getElementsByTagNameNS(R, "r")).forEach((e, t) => {
|
|
1754
|
-
let r = B(e, "rPr"), i =
|
|
1815
|
+
let r = B(e, "rPr"), i = K(r, pe(l, d(H(r, "rStyle")).map((e) => B(e, "rPr"))));
|
|
1755
1816
|
i["--az-hidden"] !== "1" && (f.push(i), Number(i["--az-position"]) && M(a, "source-baseline-shift", "Исходный фрагмент смещён по вертикали; сохранён без нормализации.", "warning", {
|
|
1756
1817
|
stage: "import",
|
|
1757
1818
|
location: {
|
|
@@ -1761,7 +1822,7 @@ async function Re(e) {
|
|
|
1761
1822
|
before: Number(i["--az-position"]) / 2,
|
|
1762
1823
|
after: Number(i["--az-position"]) / 2
|
|
1763
1824
|
}));
|
|
1764
|
-
}), o && (o.rule === "auto" ? o.value < 240 : o.value / 20 <
|
|
1825
|
+
}), o && (o.rule === "auto" ? o.value < 240 : o.value / 20 < be(f)) && M(a, "source-tight-spacing", "Авторский тесный интервал сохранён. Проверьте наложение строк на используемых шрифтах.", "warning", {
|
|
1765
1826
|
stage: "import",
|
|
1766
1827
|
location: n,
|
|
1767
1828
|
before: `${o.rule}:${o.value}`,
|
|
@@ -1774,7 +1835,7 @@ async function Re(e) {
|
|
|
1774
1835
|
}
|
|
1775
1836
|
//#endregion
|
|
1776
1837
|
//#region src/library/font-diagnostics.ts
|
|
1777
|
-
function
|
|
1838
|
+
function Be(e) {
|
|
1778
1839
|
let t = 0, n = !1, r = !1, i = 0, a = [], o = /* @__PURE__ */ new Set(), s = {
|
|
1779
1840
|
state: typeof e == "function" ? "loading" : "unknown",
|
|
1780
1841
|
warnings: []
|
|
@@ -1829,8 +1890,8 @@ function ze(e) {
|
|
|
1829
1890
|
}
|
|
1830
1891
|
//#endregion
|
|
1831
1892
|
//#region src/library/AzDocumentEditor.tsx
|
|
1832
|
-
var
|
|
1833
|
-
function
|
|
1893
|
+
var Ve = () => {};
|
|
1894
|
+
function He({ onStatusChange: e, fonts: t }) {
|
|
1834
1895
|
let r = o(e);
|
|
1835
1896
|
i(() => {
|
|
1836
1897
|
r.current = e;
|
|
@@ -1866,8 +1927,8 @@ function Ve({ onStatusChange: e, fonts: t }) {
|
|
|
1866
1927
|
f
|
|
1867
1928
|
]), null;
|
|
1868
1929
|
}
|
|
1869
|
-
var
|
|
1870
|
-
let u = o(null), p = o(null), m = o(null), [v, y] = s(""), b = a(() => f(), []), C = d(b), w = e.fonts ?? C, T = a(() =>
|
|
1930
|
+
var Ue = e(function(e, t) {
|
|
1931
|
+
let u = o(null), p = o(null), m = o(null), [v, y] = s(""), b = a(() => f(), []), C = d(b), w = e.fonts ?? C, T = a(() => Be(w), [w]), E = c(T.subscribe, T.snapshot, T.snapshot), D = o(e), O = o(0), k = o(!1), j = o(T);
|
|
1871
1932
|
i(() => {
|
|
1872
1933
|
D.current = e, j.current = T;
|
|
1873
1934
|
}), i(() => {
|
|
@@ -1877,7 +1938,7 @@ var He = e(function(e, t) {
|
|
|
1877
1938
|
if (!D.current.onDiagnostics) return;
|
|
1878
1939
|
let n;
|
|
1879
1940
|
try {
|
|
1880
|
-
n = await
|
|
1941
|
+
n = await ze(e);
|
|
1881
1942
|
} catch {
|
|
1882
1943
|
n = [{
|
|
1883
1944
|
code: "diagnostics-unavailable",
|
|
@@ -1928,7 +1989,7 @@ var He = e(function(e, t) {
|
|
|
1928
1989
|
async exportHujjat(e) {
|
|
1929
1990
|
let t = await u.current?.save();
|
|
1930
1991
|
if (!t) throw new A("Документ ещё не готов к экспорту.");
|
|
1931
|
-
return
|
|
1992
|
+
return Le(t, e);
|
|
1932
1993
|
},
|
|
1933
1994
|
insertVariable(e) {
|
|
1934
1995
|
if (!P(e)) throw new A("Некорректный ключ переменной. Используйте client.name, ASCII, до 100 символов.");
|
|
@@ -1999,8 +2060,8 @@ var He = e(function(e, t) {
|
|
|
1999
2060
|
},
|
|
2000
2061
|
menu: N("menu") && {
|
|
2001
2062
|
reportIssue: !1,
|
|
2002
|
-
onOpen:
|
|
2003
|
-
onSave:
|
|
2063
|
+
onOpen: Ve,
|
|
2064
|
+
onSave: Ve,
|
|
2004
2065
|
children: /* @__PURE__ */ g(l.Menu.File, {
|
|
2005
2066
|
preset: !1,
|
|
2006
2067
|
children: [
|
|
@@ -2036,7 +2097,7 @@ var He = e(function(e, t) {
|
|
|
2036
2097
|
]
|
|
2037
2098
|
})
|
|
2038
2099
|
},
|
|
2039
|
-
children: /* @__PURE__ */ h(
|
|
2100
|
+
children: /* @__PURE__ */ h(He, {
|
|
2040
2101
|
onStatusChange: e.onStatusChange,
|
|
2041
2102
|
fonts: E
|
|
2042
2103
|
})
|
|
@@ -2045,12 +2106,12 @@ var He = e(function(e, t) {
|
|
|
2045
2106
|
});
|
|
2046
2107
|
//#endregion
|
|
2047
2108
|
//#region src/library/AzHtmlEditor.tsx
|
|
2048
|
-
function
|
|
2109
|
+
function We(...e) {
|
|
2049
2110
|
let t = /* @__PURE__ */ new Map();
|
|
2050
2111
|
for (let n of e.flat()) t.set(JSON.stringify(n), n);
|
|
2051
2112
|
return [...t.values()];
|
|
2052
2113
|
}
|
|
2053
|
-
var
|
|
2114
|
+
var Ge = e(function(e, a) {
|
|
2054
2115
|
let { initialHtml: c, layout: l, page: u, onChange: d, onStatusChange: f, renderFallback: p, ...m } = e, [_] = s(c), [v] = s(() => structuredClone(u)), [y] = s(() => l ? {
|
|
2055
2116
|
...l,
|
|
2056
2117
|
page: l.page ? {
|
|
@@ -2079,7 +2140,7 @@ var We = e(function(e, a) {
|
|
|
2079
2140
|
error: null
|
|
2080
2141
|
});
|
|
2081
2142
|
try {
|
|
2082
|
-
let n = await
|
|
2143
|
+
let n = await Re({ uz: {
|
|
2083
2144
|
blocks: [{
|
|
2084
2145
|
type: "html",
|
|
2085
2146
|
props: { html: _.trim() ? _ : "<p><br></p>" }
|
|
@@ -2147,7 +2208,7 @@ var We = e(function(e, a) {
|
|
|
2147
2208
|
page: t.page
|
|
2148
2209
|
});
|
|
2149
2210
|
if (!D.current || r !== O.current || i !== k.current) throw new A("Черновик изменился или закрыт во время экспорта. Повторите экспорт актуального документа.");
|
|
2150
|
-
let a =
|
|
2211
|
+
let a = We(t.warnings, n.warnings);
|
|
2151
2212
|
return M({ warnings: a }), N(a, e.allowLossy), {
|
|
2152
2213
|
html: n.html,
|
|
2153
2214
|
variables: n.variables,
|
|
@@ -2182,7 +2243,7 @@ var We = e(function(e, a) {
|
|
|
2182
2243
|
P,
|
|
2183
2244
|
M,
|
|
2184
2245
|
L
|
|
2185
|
-
]), b ? /* @__PURE__ */ h(
|
|
2246
|
+
]), b ? /* @__PURE__ */ h(Ue, {
|
|
2186
2247
|
...m,
|
|
2187
2248
|
ref: T,
|
|
2188
2249
|
document: b,
|
|
@@ -2203,18 +2264,18 @@ var We = e(function(e, a) {
|
|
|
2203
2264
|
children: [S.error ?? "Загрузка документа…", S.warnings.length > 0 && /* @__PURE__ */ h("ul", { children: S.warnings.map((e, t) => /* @__PURE__ */ h("li", { children: e.message }, t)) })]
|
|
2204
2265
|
})
|
|
2205
2266
|
});
|
|
2206
|
-
}),
|
|
2207
|
-
function
|
|
2267
|
+
}), Ke = 31457280, qe = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", Je = `${qe}.main+xml`, Ye = 8388608, $ = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
2268
|
+
function Xe(e) {
|
|
2208
2269
|
let t = new DOMParser().parseFromString(e, "application/xml");
|
|
2209
2270
|
if (t.getElementsByTagName("parsererror").length || /<!DOCTYPE/i.test(e)) throw Error("XML документа повреждён или содержит неподдерживаемую структуру.");
|
|
2210
2271
|
return t;
|
|
2211
2272
|
}
|
|
2212
|
-
function
|
|
2273
|
+
function Ze(e, t) {
|
|
2213
2274
|
let n = e.file(t);
|
|
2214
2275
|
return n ? new Promise((e, t) => {
|
|
2215
2276
|
let r = n.internalStream("uint8array"), i = [], a = 0;
|
|
2216
2277
|
r.on("data", (e) => {
|
|
2217
|
-
a += e.byteLength, a >
|
|
2278
|
+
a += e.byteLength, a > Ye ? (r.pause(), t(/* @__PURE__ */ Error("Структура документа слишком большая для этого прототипа."))) : i.push(e);
|
|
2218
2279
|
}), r.on("error", t), r.on("end", () => {
|
|
2219
2280
|
let t = new Uint8Array(a), n = 0;
|
|
2220
2281
|
for (let e of i) t.set(e, n), n += e.byteLength;
|
|
@@ -2222,7 +2283,7 @@ function Xe(e, t) {
|
|
|
2222
2283
|
}), r.resume();
|
|
2223
2284
|
}) : Promise.resolve("");
|
|
2224
2285
|
}
|
|
2225
|
-
async function
|
|
2286
|
+
async function Qe(e) {
|
|
2226
2287
|
if (!/\.docx$/i.test(e.name)) throw Error("Откройте файл DOCX. Форматы DOC, DOCM и PDF здесь не поддерживаются.");
|
|
2227
2288
|
if (!e.size) throw Error("Файл DOCX пуст.");
|
|
2228
2289
|
if (e.size > 31457280) throw Error("Максимальный размер DOCX — 30 МБ.");
|
|
@@ -2235,14 +2296,14 @@ async function Ze(e) {
|
|
|
2235
2296
|
let r = Object.keys(n.files);
|
|
2236
2297
|
if (r.length > 2e3) throw Error("Слишком много вложенных частей в DOCX для этого прототипа.");
|
|
2237
2298
|
if (!n.file("[Content_Types].xml") || !n.file("word/document.xml")) throw Error("Файл не содержит структуру DOCX.");
|
|
2238
|
-
let i =
|
|
2239
|
-
if (Array.from(i.getElementsByTagNameNS("*", "Override")).find((e) => e.getAttribute("PartName") === "/word/document.xml")?.getAttribute("ContentType") !==
|
|
2240
|
-
let a =
|
|
2299
|
+
let i = Xe(await Ze(n, "[Content_Types].xml"));
|
|
2300
|
+
if (Array.from(i.getElementsByTagNameNS("*", "Override")).find((e) => e.getAttribute("PartName") === "/word/document.xml")?.getAttribute("ContentType") !== Je || r.some((e) => /vbaProject\.bin$/i.test(e))) throw Error("Поддерживается только обычный DOCX без макросов.");
|
|
2301
|
+
let a = Xe(await Ze(n, "word/document.xml"));
|
|
2241
2302
|
if (a.documentElement.localName !== "document" || !a.getElementsByTagNameNS($, "body").length) throw Error("XML документа повреждён или использует неподдерживаемую разновидность DOCX.");
|
|
2242
2303
|
let o = /* @__PURE__ */ new Set(), s = [a];
|
|
2243
2304
|
for (let e of ["word/styles.xml", "word/fontTable.xml"]) {
|
|
2244
|
-
let t = await
|
|
2245
|
-
t && s.push(
|
|
2305
|
+
let t = await Ze(n, e);
|
|
2306
|
+
t && s.push(Xe(t));
|
|
2246
2307
|
}
|
|
2247
2308
|
for (let e of s) {
|
|
2248
2309
|
for (let t of e.getElementsByTagNameNS($, "rFonts")) for (let e of [
|
|
@@ -2259,7 +2320,7 @@ async function Ze(e) {
|
|
|
2259
2320
|
e && o.add(e);
|
|
2260
2321
|
}
|
|
2261
2322
|
}
|
|
2262
|
-
let c = await
|
|
2323
|
+
let c = await Ze(n, "docProps/app.xml"), l = c ? Number(Xe(c).getElementsByTagNameNS("*", "Pages")[0]?.textContent) : 0, { openDocumentForExport: u } = await import("@docx-editor.dev/core/export"), d = u(t.slice());
|
|
2263
2324
|
if (!d.ok) throw Error("Не удалось открыть структуру DOCX. Текущий документ сохранён в редакторе.");
|
|
2264
2325
|
return d.session.dispose(), {
|
|
2265
2326
|
name: e.name,
|
|
@@ -2276,16 +2337,16 @@ async function Ze(e) {
|
|
|
2276
2337
|
}
|
|
2277
2338
|
};
|
|
2278
2339
|
}
|
|
2279
|
-
function
|
|
2340
|
+
function $e(e) {
|
|
2280
2341
|
return `${(e.replace(/\.docx$/i, "").replace(/[<>:"/\\|?*\x00-\x1f]/g, "_").trim() || "Документ").replace(/ — редакция$/, "")} — редакция.docx`;
|
|
2281
2342
|
}
|
|
2282
|
-
function
|
|
2283
|
-
let n = URL.createObjectURL(new Blob([e], { type:
|
|
2343
|
+
function et(e, t) {
|
|
2344
|
+
let n = URL.createObjectURL(new Blob([e], { type: qe })), r = document.createElement("a");
|
|
2284
2345
|
r.href = n, r.download = t, document.body.append(r), r.click(), r.remove(), window.setTimeout(() => URL.revokeObjectURL(n), 3e4);
|
|
2285
2346
|
}
|
|
2286
2347
|
//#endregion
|
|
2287
2348
|
//#region src/library/pdf-export.ts
|
|
2288
|
-
async function
|
|
2349
|
+
async function tt(e, t, n, r = {}) {
|
|
2289
2350
|
let i = AbortSignal.any([AbortSignal.timeout(95e3), ...r.signal ? [r.signal] : []]);
|
|
2290
2351
|
i.throwIfAborted();
|
|
2291
2352
|
let a = new FormData();
|
|
@@ -2314,13 +2375,13 @@ async function et(e, t, n, r = {}) {
|
|
|
2314
2375
|
warnings: (o.headers.get("x-pdf-warnings") ?? "").split(",").filter(Boolean)
|
|
2315
2376
|
};
|
|
2316
2377
|
}
|
|
2317
|
-
function
|
|
2378
|
+
function nt(e) {
|
|
2318
2379
|
let t = URL.createObjectURL(e.blob), n = document.createElement("a");
|
|
2319
2380
|
n.href = t, n.download = e.filename, document.body.append(n), n.click(), n.remove(), setTimeout(() => URL.revokeObjectURL(t), 6e4);
|
|
2320
2381
|
}
|
|
2321
2382
|
//#endregion
|
|
2322
2383
|
//#region src/library/pdf-profile.ts
|
|
2323
|
-
var
|
|
2384
|
+
var rt = {
|
|
2324
2385
|
id: "az-editor-pdf-a0c6eaaeb90716f0",
|
|
2325
2386
|
protocolVersion: 1,
|
|
2326
2387
|
core: "2.27.0",
|
|
@@ -2467,18 +2528,18 @@ var nt = {
|
|
|
2467
2528
|
};
|
|
2468
2529
|
//#endregion
|
|
2469
2530
|
//#region src/library/hujjat/api.ts
|
|
2470
|
-
function
|
|
2531
|
+
function it(e) {
|
|
2471
2532
|
if (!e || !Object.keys(e).length) throw new A("Нет локалей шаблона.");
|
|
2472
2533
|
for (let [t, n] of Object.entries(e)) {
|
|
2473
|
-
if (se(t),
|
|
2534
|
+
if (se(t), Ce(n?.page), !n || !Array.isArray(n.blocks) || !n.blocks.length) throw new A(`Нет блоков для ${t}.`);
|
|
2474
2535
|
for (let e of n.blocks) if (e.type === "html") {
|
|
2475
2536
|
if (typeof e.props?.html != "string" || !e.props.html.trim()) throw new A(`Пустой HTML для ${t}.`);
|
|
2476
2537
|
if (new TextEncoder().encode(e.props.html).length > 1048576) throw new A(`HTML для ${t} превышает 1 МБ.`);
|
|
2477
2538
|
}
|
|
2478
2539
|
}
|
|
2479
2540
|
}
|
|
2480
|
-
function
|
|
2481
|
-
if (
|
|
2541
|
+
function at(e, t) {
|
|
2542
|
+
if (it(t), !t.uz) throw new A("Для создания шаблона обязательна локаль uz.");
|
|
2482
2543
|
if (!e.productId || !e.name.trim() || e.name.length > 255) throw new A("Укажите продукт и название шаблона до 255 символов.");
|
|
2483
2544
|
return {
|
|
2484
2545
|
product_id: e.productId,
|
|
@@ -2487,9 +2548,9 @@ function it(e, t) {
|
|
|
2487
2548
|
locales: structuredClone(t)
|
|
2488
2549
|
};
|
|
2489
2550
|
}
|
|
2490
|
-
async function
|
|
2551
|
+
async function ot(e) {
|
|
2491
2552
|
let t = AbortSignal.any([AbortSignal.timeout(95e3), ...e.signal ? [e.signal] : []]);
|
|
2492
|
-
t.throwIfAborted(),
|
|
2553
|
+
t.throwIfAborted(), it(e.locales);
|
|
2493
2554
|
let n = e.locale ?? "uz";
|
|
2494
2555
|
se(n);
|
|
2495
2556
|
let r = new Headers(e.headers);
|
|
@@ -2519,4 +2580,4 @@ async function at(e) {
|
|
|
2519
2580
|
};
|
|
2520
2581
|
}
|
|
2521
2582
|
//#endregion
|
|
2522
|
-
export {
|
|
2583
|
+
export { Ue as AzDocumentEditor, Ge as AzHtmlEditor, qe as DOCX_MIME, O as HUJJAT_LOCALES, Se as HUJJAT_MAX_CHROME_BYTES, k as HUJJAT_MAX_HTML_BYTES, C as HUJJAT_PAGE, A as HujjatCompatibilityError, Ke as MAX_DOCX_BYTES, ze as analyzeDocxFormatting, at as createHujjatTemplatePayload, et as downloadDocx, nt as downloadPdf, $e as exportFilename, Le as exportHujjatDocx, Re as importHujjatTemplate, rt as pdfRenderProfile, Qe as readDocxFile, ce as readHujjatHtml, ot as requestHujjatPreview, tt as requestPdf, E as resolveHtmlLayout, oe as sanitizeHujjatHtml, Ce as validateHujjatPage, P as validateHujjatVariable, le as withHujjatLocale };
|
|
@@ -12,6 +12,12 @@ export declare const styleAttr: (css: Css) => string;
|
|
|
12
12
|
export declare function parseXml(text: string): XMLDocument;
|
|
13
13
|
/** Stream the parts we actually consume; never decompress arbitrary media for HTML export. */
|
|
14
14
|
export declare function readPart(zip: JSZip, path: string): Promise<XMLDocument | null>;
|
|
15
|
-
|
|
15
|
+
/** Resolve a layer against its inherited properties before projecting compound CSS. */
|
|
16
|
+
export declare function runCss(pr: Element | null, inherited?: Css): Css;
|
|
17
|
+
/** Resolve one style type's basedOn chain, then combine it with earlier levels.
|
|
18
|
+
* caps/strike are toggle properties (17.7.3); direct runCss calls are absolute.
|
|
19
|
+
* Underline, dstrike and vertAlign are ordinary properties, not toggles.
|
|
20
|
+
*/
|
|
21
|
+
export declare function cascadeRunCss(base: Css, properties: (Element | null)[]): Css;
|
|
16
22
|
export declare function paragraphCss(pr: Element | null): Css;
|
|
17
23
|
export declare function borderCss(edge: Element | null): string | undefined;
|