@w100n/documents 0.3.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/SheetView-3XTEV2VT.css +319 -0
  2. package/dist/SheetView-3XTEV2VT.css.map +1 -0
  3. package/dist/SheetView-JYH2ZUZF.js +928 -0
  4. package/dist/SheetView-JYH2ZUZF.js.map +1 -0
  5. package/dist/TextEditor-X3X62R46.js +982 -0
  6. package/dist/TextEditor-X3X62R46.js.map +1 -0
  7. package/dist/caveat-cyrillic-XVO43JCM.woff2 +0 -0
  8. package/dist/caveat-latin-IUBKKMHQ.woff2 +0 -0
  9. package/dist/caveat-latin-ext-5S7R5SZN.woff2 +0 -0
  10. package/dist/chunk-CE3AADY6.js +3447 -0
  11. package/dist/chunk-CE3AADY6.js.map +1 -0
  12. package/dist/chunk-ISOOUYLI.js +150 -0
  13. package/dist/chunk-ISOOUYLI.js.map +1 -0
  14. package/dist/{chunk-KEV4R7W5.js → chunk-K364NAYP.js} +4 -1
  15. package/dist/chunk-K364NAYP.js.map +1 -0
  16. package/dist/chunk-QDH7EZAF.js +27 -0
  17. package/dist/chunk-QDH7EZAF.js.map +1 -0
  18. package/dist/chunk-SVRYWMES.js +196 -0
  19. package/dist/chunk-SVRYWMES.js.map +1 -0
  20. package/dist/chunk-TDP6OJET.js +31 -0
  21. package/dist/chunk-TDP6OJET.js.map +1 -0
  22. package/dist/chunk-TNSN4ZQ5.js +2909 -0
  23. package/dist/chunk-TNSN4ZQ5.js.map +1 -0
  24. package/dist/collab.cjs +6312 -0
  25. package/dist/collab.cjs.map +1 -0
  26. package/dist/collab.d.cts +39 -0
  27. package/dist/collab.d.ts +39 -0
  28. package/dist/collab.js +30 -0
  29. package/dist/collab.js.map +1 -0
  30. package/dist/grid-EI5JNZAA.js +88 -0
  31. package/dist/grid-EI5JNZAA.js.map +1 -0
  32. package/dist/index.cjs +12265 -407
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.css +3448 -214
  35. package/dist/index.css.map +1 -1
  36. package/dist/index.d.cts +145 -7
  37. package/dist/index.d.ts +145 -7
  38. package/dist/index.js +3469 -340
  39. package/dist/index.js.map +1 -1
  40. package/dist/memory.cjs +59 -7
  41. package/dist/memory.cjs.map +1 -1
  42. package/dist/memory.d.cts +7 -2
  43. package/dist/memory.d.ts +7 -2
  44. package/dist/memory.js +57 -8
  45. package/dist/memory.js.map +1 -1
  46. package/dist/pdfWrite-EM6GJDBF.js +76 -0
  47. package/dist/pdfWrite-EM6GJDBF.js.map +1 -0
  48. package/dist/types-B5oF25dn.d.cts +165 -0
  49. package/dist/types-B5oF25dn.d.ts +165 -0
  50. package/dist/write-DaVtTJCS.d.cts +6 -0
  51. package/dist/write-DaVtTJCS.d.ts +6 -0
  52. package/package.json +45 -3
  53. package/dist/chunk-KEV4R7W5.js.map +0 -1
  54. package/dist/types-DiEpNWSu.d.cts +0 -59
  55. package/dist/types-DiEpNWSu.d.ts +0 -59
@@ -0,0 +1,2909 @@
1
+ 'use client';
2
+
3
+ // src/docx/xml.ts
4
+ function parse(s) {
5
+ const root = { name: "", start: 0, open: 0, close: s.length, end: s.length, kids: [] };
6
+ const stack = [root];
7
+ const n = s.length;
8
+ let i = s.indexOf("<");
9
+ while (i !== -1 && i < n) {
10
+ const c = s.charCodeAt(i + 1);
11
+ let next;
12
+ if (c === 63) next = s.indexOf("?>", i) + 2;
13
+ else if (c === 33) {
14
+ if (s.startsWith("<!--", i)) next = s.indexOf("-->", i) + 3;
15
+ else if (s.startsWith("<![CDATA[", i)) next = s.indexOf("]]>", i) + 3;
16
+ else next = s.indexOf(">", i) + 1;
17
+ } else if (c === 47) {
18
+ next = s.indexOf(">", i) + 1;
19
+ if (stack.length > 1) {
20
+ const top = stack.pop();
21
+ top.close = i;
22
+ top.end = next;
23
+ }
24
+ } else {
25
+ let j = i + 1;
26
+ while (j < n) {
27
+ const d = s.charCodeAt(j);
28
+ if (d === 32 || d === 62 || d === 47 || d === 9 || d === 10 || d === 13) break;
29
+ j++;
30
+ }
31
+ let k = j;
32
+ for (; k < n; k++) {
33
+ const d = s.charCodeAt(k);
34
+ if (d === 34 || d === 39) {
35
+ k = s.indexOf(d === 34 ? '"' : "'", k + 1);
36
+ if (k === -1) k = n;
37
+ } else if (d === 62) break;
38
+ }
39
+ const self = s.charCodeAt(k - 1) === 47;
40
+ const el = { name: s.slice(i + 1, j), start: i, open: k + 1, close: k + 1, end: k + 1, kids: [] };
41
+ stack[stack.length - 1].kids.push(el);
42
+ if (!self) stack.push(el);
43
+ next = k + 1;
44
+ }
45
+ if (next <= i) break;
46
+ i = s.indexOf("<", next);
47
+ }
48
+ return root;
49
+ }
50
+ function attr(s, el, name) {
51
+ const tag = s.slice(el.start, el.open);
52
+ const key = name + "=";
53
+ let i = tag.indexOf(key);
54
+ while (i > 0) {
55
+ const before = tag.charCodeAt(i - 1);
56
+ if (before === 32 || before === 9 || before === 10 || before === 13) {
57
+ const q = tag[i + key.length];
58
+ return unescape(tag.slice(i + key.length + 1, tag.indexOf(q, i + key.length + 1)));
59
+ }
60
+ i = tag.indexOf(key, i + 1);
61
+ }
62
+ return null;
63
+ }
64
+ function attrs(tag) {
65
+ const out = [];
66
+ const re = /([\w:.-]+)\s*=\s*("([^"]*)"|'([^']*)')/g;
67
+ const body = tag.slice(tag.search(/[\s/>]/));
68
+ for (let m = re.exec(body); m; m = re.exec(body)) out.push([m[1], unescape(m[3] ?? m[4])]);
69
+ return out;
70
+ }
71
+ function kid(el, name) {
72
+ for (const k of el.kids) if (k.name === name) return k;
73
+ return void 0;
74
+ }
75
+ function find(el, name) {
76
+ for (const k of el.kids) {
77
+ if (k.name === name) return k;
78
+ const deep = find(k, name);
79
+ if (deep) return deep;
80
+ }
81
+ return void 0;
82
+ }
83
+ function inner(s, el) {
84
+ return unescape(s.slice(el.open, el.close));
85
+ }
86
+ function on(s, el, name = "w:val") {
87
+ if (!el) return false;
88
+ const v = attr(s, el, name);
89
+ return v === null || !/^(0|false|off|none)$/.test(v);
90
+ }
91
+ var named = { lt: "<", gt: ">", amp: "&", quot: '"', apos: "'" };
92
+ function unescape(s) {
93
+ if (s.indexOf("&") === -1) return s;
94
+ return s.replace(/&(#x[0-9a-fA-F]+|#\d+|\w+);/g, (m, e) => {
95
+ if (e[0] !== "#") return named[e] ?? m;
96
+ const code = e[1] === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10);
97
+ return String.fromCodePoint(code);
98
+ });
99
+ }
100
+ function escape(s) {
101
+ return s.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\uFFFE\uFFFF]/g, "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
102
+ }
103
+ function opened(s, el) {
104
+ const tag = s.slice(el.start, el.open);
105
+ return el.end === el.open ? tag.replace(/\s*\/>$/, ">") : tag;
106
+ }
107
+ function rebuild(pr, tag, order, set) {
108
+ const root = parse(pr).kids[0];
109
+ const parts = root ? root.kids.map((k) => ({ name: k.name, xml: pr.slice(k.start, k.end) })) : [];
110
+ const seen = /* @__PURE__ */ new Set();
111
+ const out = [];
112
+ for (const p of parts) {
113
+ if (!(p.name in set)) out.push(p);
114
+ else if (!seen.has(p.name)) {
115
+ seen.add(p.name);
116
+ if (set[p.name] !== null) out.push({ name: p.name, xml: set[p.name] });
117
+ }
118
+ }
119
+ for (const name in set) if (!seen.has(name) && set[name] !== null) out.push({ name, xml: set[name] });
120
+ if (!out.length) return "";
121
+ const rank = (name) => {
122
+ const i = order.indexOf(name);
123
+ return i === -1 ? order.length : i;
124
+ };
125
+ const sorted = out.map((p, i) => ({ p, i })).sort((a, b) => rank(a.p.name) - rank(b.p.name) || a.i - b.i);
126
+ const open = root ? opened(pr, root) : `<${tag}>`;
127
+ return open + sorted.map((x) => x.p.xml).join("") + `</${tag}>`;
128
+ }
129
+
130
+ // src/docx/zip.ts
131
+ import { deflateSync, inflateSync } from "fflate";
132
+ function unzip(buf) {
133
+ const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
134
+ let eocd = buf.length - 22;
135
+ while (eocd >= 0 && view.getUint32(eocd, true) !== 101010256) eocd--;
136
+ if (eocd < 0) throw new Error("Not a DOCX file");
137
+ const count = view.getUint16(eocd + 10, true);
138
+ let at = view.getUint32(eocd + 16, true);
139
+ if (count === 65535 || at === 4294967295) throw new Error("ZIP64 DOCX files are not supported");
140
+ const names = new TextDecoder();
141
+ const out = [];
142
+ for (let n = 0; n < count; n++) {
143
+ if (view.getUint32(at, true) !== 33639248) throw new Error("Broken DOCX file");
144
+ const length = view.getUint16(at + 28, true);
145
+ const extra = view.getUint16(at + 30, true);
146
+ const note = view.getUint16(at + 32, true);
147
+ const local = view.getUint32(at + 42, true);
148
+ const csize = view.getUint32(at + 20, true);
149
+ const path = buf.subarray(at + 46, at + 46 + length);
150
+ const begin = local + 30 + view.getUint16(local + 26, true) + view.getUint16(local + 28, true);
151
+ out.push({
152
+ name: names.decode(path),
153
+ path,
154
+ made: view.getUint16(at + 4, true),
155
+ version: view.getUint16(at + 6, true),
156
+ flags: view.getUint16(at + 8, true),
157
+ method: view.getUint16(at + 10, true),
158
+ time: view.getUint16(at + 12, true),
159
+ date: view.getUint16(at + 14, true),
160
+ crc: view.getUint32(at + 16, true),
161
+ size: view.getUint32(at + 24, true),
162
+ inner: view.getUint16(at + 36, true),
163
+ outer: view.getUint32(at + 38, true),
164
+ raw: buf.subarray(begin, begin + csize)
165
+ });
166
+ at += 46 + length + extra + note;
167
+ }
168
+ return out;
169
+ }
170
+ function inflate(e) {
171
+ if (e.method === 0) return e.raw;
172
+ if (e.method !== 8) throw new Error(`Unsupported compression in ${e.name}`);
173
+ return inflateSync(e.raw, { out: new Uint8Array(e.size) });
174
+ }
175
+ var table = (() => {
176
+ const t = new Int32Array(256);
177
+ for (let n = 0; n < 256; n++) {
178
+ let c = n;
179
+ for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
180
+ t[n] = c;
181
+ }
182
+ return t;
183
+ })();
184
+ function crc32(bytes) {
185
+ let c = -1;
186
+ for (let i = 0; i < bytes.length; i++) c = table[(c ^ bytes[i]) & 255] ^ c >>> 8;
187
+ return (c ^ -1) >>> 0;
188
+ }
189
+ function entry(name, bytes, like) {
190
+ const path = new TextEncoder().encode(name);
191
+ return { ...like, name, path, method: 8, version: Math.max(like.version, 20), flags: like.flags & ~8, crc: crc32(bytes), size: bytes.length, raw: deflateSync(bytes, { level: 6 }) };
192
+ }
193
+ function zip(entries) {
194
+ let total = 22;
195
+ for (const e of entries) total += 30 + 46 + e.path.length * 2 + e.raw.length;
196
+ const buf = new Uint8Array(total);
197
+ const view = new DataView(buf.buffer);
198
+ const offsets = [];
199
+ let at = 0;
200
+ for (const e of entries) {
201
+ offsets.push(at);
202
+ view.setUint32(at, 67324752, true);
203
+ view.setUint16(at + 4, e.version, true);
204
+ view.setUint16(at + 6, e.flags & ~8, true);
205
+ view.setUint16(at + 8, e.method, true);
206
+ view.setUint16(at + 10, e.time, true);
207
+ view.setUint16(at + 12, e.date, true);
208
+ view.setUint32(at + 14, e.crc, true);
209
+ view.setUint32(at + 18, e.raw.length, true);
210
+ view.setUint32(at + 22, e.size, true);
211
+ view.setUint16(at + 26, e.path.length, true);
212
+ view.setUint16(at + 28, 0, true);
213
+ buf.set(e.path, at + 30);
214
+ buf.set(e.raw, at + 30 + e.path.length);
215
+ at += 30 + e.path.length + e.raw.length;
216
+ }
217
+ const start = at;
218
+ entries.forEach((e, n) => {
219
+ view.setUint32(at, 33639248, true);
220
+ view.setUint16(at + 4, e.made, true);
221
+ view.setUint16(at + 6, e.version, true);
222
+ view.setUint16(at + 8, e.flags & ~8, true);
223
+ view.setUint16(at + 10, e.method, true);
224
+ view.setUint16(at + 12, e.time, true);
225
+ view.setUint16(at + 14, e.date, true);
226
+ view.setUint32(at + 16, e.crc, true);
227
+ view.setUint32(at + 20, e.raw.length, true);
228
+ view.setUint32(at + 24, e.size, true);
229
+ view.setUint16(at + 28, e.path.length, true);
230
+ view.setUint16(at + 36, e.inner, true);
231
+ view.setUint32(at + 38, e.outer, true);
232
+ view.setUint32(at + 42, offsets[n], true);
233
+ buf.set(e.path, at + 46);
234
+ at += 46 + e.path.length;
235
+ });
236
+ view.setUint32(at, 101010256, true);
237
+ view.setUint16(at + 8, entries.length, true);
238
+ view.setUint16(at + 10, entries.length, true);
239
+ view.setUint32(at + 12, at - start, true);
240
+ view.setUint32(at + 16, start, true);
241
+ return buf.subarray(0, at + 22);
242
+ }
243
+
244
+ // src/docx/pkg.ts
245
+ var plain = { b: false, i: false, u: false, s: false, code: false, link: null, hl: null, color: null, size: null, font: null, rev: null };
246
+ var highlights = {
247
+ yellow: "ffff00",
248
+ green: "00ff00",
249
+ cyan: "00ffff",
250
+ magenta: "ff00ff",
251
+ blue: "0000ff",
252
+ red: "ff0000",
253
+ darkBlue: "000080",
254
+ darkCyan: "008080",
255
+ darkGreen: "008000",
256
+ darkMagenta: "800080",
257
+ darkRed: "800000",
258
+ darkYellow: "808000",
259
+ darkGray: "808080",
260
+ lightGray: "c0c0c0",
261
+ black: "000000",
262
+ white: "ffffff"
263
+ };
264
+ var linkStyle = /^(hyperlink|followedhyperlink|internet link|visited internet link)$/i;
265
+ var headingName = /^(heading|заголовок|überschrift|titre|título|titolo|nagłówek|kop|rubrik|overskrift|otsikko|nadpis|başlık|címsor|naslov|заглавие|見出し|제목|标题|標題)\s*(\d)$/i;
266
+ function color(v) {
267
+ if (typeof v !== "string") return null;
268
+ const t = v.trim().toLowerCase();
269
+ let m = /^#?([0-9a-f]{6})$/.exec(t);
270
+ if (m) return "#" + m[1];
271
+ m = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(t);
272
+ if (m) return "#" + m[1] + m[1] + m[2] + m[2] + m[3] + m[3];
273
+ m = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(t);
274
+ if (m) return "#" + [m[1], m[2], m[3]].map((x) => Math.min(255, +x).toString(16).padStart(2, "0")).join("");
275
+ return highlights[v.trim()] ? "#" + highlights[v.trim()] : null;
276
+ }
277
+ function size(v) {
278
+ const m = /^\s*([\d.]+)\s*(pt|px)?\s*$/.exec(String(v ?? ""));
279
+ if (!m || !+m[1]) return null;
280
+ const pt = m[2] === "px" ? +m[1] * 0.75 : +m[1];
281
+ return `${Math.round(pt * 2) / 2}pt`;
282
+ }
283
+ function family(v) {
284
+ if (typeof v !== "string") return null;
285
+ const first = v.split(",")[0].trim().replace(/^["']|["']$/g, "");
286
+ return first || null;
287
+ }
288
+ function fmtOf(marks) {
289
+ const f = { ...plain };
290
+ for (const m of marks ?? []) {
291
+ const a = m.attrs ?? {};
292
+ if (m.type === "bold") f.b = true;
293
+ else if (m.type === "italic") f.i = true;
294
+ else if (m.type === "underline") f.u = true;
295
+ else if (m.type === "strike") f.s = true;
296
+ else if (m.type === "code") f.code = true;
297
+ else if (m.type === "link" && typeof a.href === "string" && a.href) f.link = a.href;
298
+ else if (m.type === "highlight") f.hl = color(a.color) ?? "#ffff00";
299
+ else if (m.type === "textStyle") {
300
+ f.color = color(a.color);
301
+ f.size = size(a.fontSize);
302
+ f.font = family(a.fontFamily);
303
+ } else if (m.type === "insertion" || m.type === "deletion") f.rev = JSON.stringify([m.type === "insertion" ? "ins" : "del", String(a.id ?? ""), String(a.author ?? ""), String(a.date ?? "")]);
304
+ }
305
+ if (f.code) f.font = null;
306
+ return f;
307
+ }
308
+ function marksOf(f) {
309
+ const out = [];
310
+ if (f.b) out.push({ type: "bold" });
311
+ if (f.i) out.push({ type: "italic" });
312
+ if (f.u) out.push({ type: "underline" });
313
+ if (f.s) out.push({ type: "strike" });
314
+ if (f.code) out.push({ type: "code" });
315
+ if (f.link) out.push({ type: "link", attrs: { href: f.link } });
316
+ if (f.hl) out.push({ type: "highlight", attrs: { color: f.hl } });
317
+ if (f.color || f.size || f.font) out.push({ type: "textStyle", attrs: { color: f.color, fontSize: f.size, fontFamily: f.font } });
318
+ if (f.rev) {
319
+ const [kind, id, author, date] = JSON.parse(f.rev);
320
+ out.push({ type: kind === "ins" ? "insertion" : "deletion", attrs: { id, author, date } });
321
+ }
322
+ return out.length ? out : void 0;
323
+ }
324
+ function keyOf(f) {
325
+ return `${+f.b}${+f.i}${+f.u}${+f.s}${+f.code}|${f.link ?? ""}|${f.hl ?? ""}|${f.color ?? ""}|${f.size ?? ""}|${f.font ?? ""}|${f.rev ?? ""}`;
326
+ }
327
+ var Styles = class {
328
+ constructor(s, fonts) {
329
+ this.s = s;
330
+ this.fonts = fonts;
331
+ this.byId = /* @__PURE__ */ new Map();
332
+ this.paragraph = null;
333
+ this.memo = /* @__PURE__ */ new Map();
334
+ const root = find(parse(s), "w:styles");
335
+ for (const el of root?.kids ?? []) {
336
+ if (el.name !== "w:style") continue;
337
+ const id = attr(s, el, "w:styleId");
338
+ if (id === null) continue;
339
+ this.byId.set(id, el);
340
+ if (attr(s, el, "w:type") === "paragraph" && on(s, el, "w:default") && attr(s, el, "w:default") !== null) this.paragraph = id;
341
+ }
342
+ }
343
+ cached(key, make) {
344
+ if (!this.memo.has(key)) this.memo.set(key, make());
345
+ return this.memo.get(key);
346
+ }
347
+ type(id) {
348
+ const el = this.byId.get(id);
349
+ return el ? attr(this.s, el, "w:type") : null;
350
+ }
351
+ name(id) {
352
+ const el = this.byId.get(id);
353
+ const n = el && kid(el, "w:name");
354
+ return n ? attr(this.s, n, "w:val") ?? id : id;
355
+ }
356
+ chain(id) {
357
+ const out = [];
358
+ const seen = /* @__PURE__ */ new Set();
359
+ while (id && !seen.has(id)) {
360
+ seen.add(id);
361
+ const el = this.byId.get(id);
362
+ if (!el) break;
363
+ out.push(el);
364
+ const base = kid(el, "w:basedOn");
365
+ id = base ? attr(this.s, base, "w:val") : null;
366
+ }
367
+ return out;
368
+ }
369
+ pPr(id, pick) {
370
+ for (const el of this.chain(id ?? this.paragraph)) {
371
+ const pPr = kid(el, "w:pPr");
372
+ const v = pPr && pick(pPr);
373
+ if (v !== void 0) return v;
374
+ }
375
+ return void 0;
376
+ }
377
+ heading(id) {
378
+ if (!id) return null;
379
+ return this.cached("h" + id, () => {
380
+ for (const el of this.chain(id)) {
381
+ const n = kid(el, "w:name");
382
+ const name = n ? attr(this.s, n, "w:val") ?? "" : "";
383
+ const m = headingName.exec(name.trim());
384
+ if (m) return +m[2] >= 1 ? Math.min(6, +m[2]) : null;
385
+ if (/^title$/i.test(name.trim())) return 1;
386
+ const lvl = kid(el, "w:pPr") && kid(kid(el, "w:pPr"), "w:outlineLvl");
387
+ if (lvl) return outline(attr(this.s, lvl, "w:val"));
388
+ }
389
+ return null;
390
+ });
391
+ }
392
+ numPr(id) {
393
+ return this.cached("n" + id, () => {
394
+ const pr = this.pPr(id, (p) => kid(p, "w:numPr"));
395
+ if (!pr) return null;
396
+ const num = kid(pr, "w:numId");
397
+ const lvl = kid(pr, "w:ilvl");
398
+ return { num: num ? +(attr(this.s, num, "w:val") ?? 0) : 0, lvl: lvl ? +(attr(this.s, lvl, "w:val") ?? 0) : 0 };
399
+ });
400
+ }
401
+ jc(id) {
402
+ return this.cached("j" + id, () => this.pPr(id, (p) => kid(p, "w:jc") && attr(this.s, kid(p, "w:jc"), "w:val")) ?? null);
403
+ }
404
+ left(id) {
405
+ return this.cached("l" + id, () => this.pPr(id, (p) => {
406
+ const ind = kid(p, "w:ind");
407
+ const v = ind && (attr(this.s, ind, "w:left") ?? attr(this.s, ind, "w:start"));
408
+ return v === null || v === void 0 ? void 0 : +v;
409
+ }) ?? 0);
410
+ }
411
+ char(id) {
412
+ return this.cached("c" + id, () => {
413
+ const name = this.name(id);
414
+ if (linkStyle.test(name) || linkStyle.test(id)) return {};
415
+ const out = {};
416
+ for (const el of this.chain(id).reverse()) Object.assign(out, props(this.s, kid(el, "w:rPr"), this.fonts));
417
+ return out;
418
+ });
419
+ }
420
+ isLink(id) {
421
+ return !!id && (linkStyle.test(this.name(id)) || linkStyle.test(id));
422
+ }
423
+ find(test, type = "paragraph") {
424
+ for (const [id, el] of this.byId) if (attr(this.s, el, "w:type") === type && test(this.name(id), id)) return id;
425
+ return null;
426
+ }
427
+ headingId(level) {
428
+ return this.find((name) => headingName.test(name.trim()) && +headingName.exec(name.trim())[2] === level) ?? this.find((_, id) => this.heading(id) === level && !/^title$/i.test(this.name(id)));
429
+ }
430
+ list() {
431
+ const out = [];
432
+ for (const [id, el] of this.byId) if (attr(this.s, el, "w:type") === "paragraph") out.push({ name: this.name(id), id, heading: this.heading(id) });
433
+ return out;
434
+ }
435
+ };
436
+ function outline(v) {
437
+ const n = Number(v);
438
+ return v !== null && n >= 0 && n < 9 ? Math.min(6, n + 1) : null;
439
+ }
440
+ function props(s, rPr, fonts) {
441
+ const out = {};
442
+ if (!rPr) return out;
443
+ for (const k of rPr.kids) {
444
+ switch (k.name) {
445
+ case "w:rStyle":
446
+ out.style = attr(s, k, "w:val") ?? void 0;
447
+ break;
448
+ case "w:b":
449
+ out.b = on(s, k);
450
+ break;
451
+ case "w:i":
452
+ out.i = on(s, k);
453
+ break;
454
+ case "w:u":
455
+ out.u = on(s, k);
456
+ break;
457
+ case "w:strike":
458
+ case "w:dstrike":
459
+ out.s = on(s, k) || !!out.s;
460
+ break;
461
+ case "w:vanish":
462
+ out.hidden = on(s, k);
463
+ break;
464
+ case "w:color": {
465
+ const v = attr(s, k, "w:val");
466
+ out.color = v && v !== "auto" ? color(v) : null;
467
+ break;
468
+ }
469
+ case "w:sz":
470
+ out.size = size(+(attr(s, k, "w:val") ?? 0) / 2);
471
+ break;
472
+ case "w:highlight": {
473
+ const v = attr(s, k, "w:val") ?? "none";
474
+ out.hl = highlights[v] ? "#" + highlights[v] : null;
475
+ break;
476
+ }
477
+ case "w:shd": {
478
+ const v = attr(s, k, "w:fill");
479
+ if (v && v !== "auto" && out.hl === void 0) out.hl = color(v);
480
+ break;
481
+ }
482
+ case "w:rFonts": {
483
+ const theme = attr(s, k, "w:asciiTheme") ?? attr(s, k, "w:hAnsiTheme");
484
+ const font = attr(s, k, "w:ascii") ?? attr(s, k, "w:hAnsi") ?? (theme ? theme.startsWith("major") ? fonts.major : fonts.minor : null);
485
+ if (font) out.font = font;
486
+ break;
487
+ }
488
+ }
489
+ }
490
+ return out;
491
+ }
492
+ var Numbering = class {
493
+ constructor(s, styles) {
494
+ this.s = s;
495
+ this.nums = /* @__PURE__ */ new Map();
496
+ this.abs = /* @__PURE__ */ new Map();
497
+ this.maxNum = 0;
498
+ this.maxAbs = -1;
499
+ const root = find(parse(s), "w:numbering");
500
+ const links = /* @__PURE__ */ new Map();
501
+ for (const el of root?.kids ?? []) {
502
+ if (el.name === "w:abstractNum") {
503
+ const id = +(attr(s, el, "w:abstractNumId") ?? -1);
504
+ this.maxAbs = Math.max(this.maxAbs, id);
505
+ const lvls = /* @__PURE__ */ new Map();
506
+ for (const l of el.kids) {
507
+ if (l.name !== "w:lvl") continue;
508
+ const fmt = kid(l, "w:numFmt");
509
+ const start = kid(l, "w:start");
510
+ const ind = kid(l, "w:pPr") && kid(kid(l, "w:pPr"), "w:ind");
511
+ const left = ind && (attr(s, ind, "w:left") ?? attr(s, ind, "w:start"));
512
+ lvls.set(+(attr(s, l, "w:ilvl") ?? 0), { fmt: fmt ? attr(s, fmt, "w:val") ?? "decimal" : "decimal", start: start ? +(attr(s, start, "w:val") ?? 1) : 1, left: left ? +left : null });
513
+ }
514
+ this.abs.set(id, lvls);
515
+ const link = kid(el, "w:numStyleLink");
516
+ if (link) links.set(id, attr(s, link, "w:val") ?? "");
517
+ } else if (el.name === "w:num") {
518
+ const id = +(attr(s, el, "w:numId") ?? 0);
519
+ this.maxNum = Math.max(this.maxNum, id);
520
+ const a = kid(el, "w:abstractNumId");
521
+ const starts = /* @__PURE__ */ new Map();
522
+ for (const o of el.kids) {
523
+ const so = o.name === "w:lvlOverride" ? kid(o, "w:startOverride") : void 0;
524
+ if (so) starts.set(+(attr(s, o, "w:ilvl") ?? 0), +(attr(s, so, "w:val") ?? 1));
525
+ }
526
+ this.nums.set(id, { abs: a ? +(attr(s, a, "w:val") ?? -1) : -1, starts });
527
+ }
528
+ }
529
+ for (const [id, style] of links) {
530
+ const pr = styles.numPr(style);
531
+ const target = pr && this.nums.get(pr.num);
532
+ if (target && this.abs.has(target.abs)) this.abs.set(id, this.abs.get(target.abs));
533
+ }
534
+ }
535
+ level(num, lvl) {
536
+ const n = this.nums.get(num);
537
+ return n ? this.abs.get(n.abs)?.get(lvl) : void 0;
538
+ }
539
+ kind(num, lvl) {
540
+ const l = this.level(num, lvl);
541
+ if (!l || l.fmt === "none") return null;
542
+ return l.fmt === "bullet" ? "bulletList" : "orderedList";
543
+ }
544
+ start(num, lvl) {
545
+ return this.nums.get(num)?.starts.get(lvl) ?? this.level(num, lvl)?.start ?? 1;
546
+ }
547
+ };
548
+ var Pkg = class {
549
+ constructor(bytes) {
550
+ this.bytes = bytes;
551
+ this.files = /* @__PURE__ */ new Map();
552
+ this.rels = /* @__PURE__ */ new Map();
553
+ this.texts = /* @__PURE__ */ new Map();
554
+ this.entries = unzip(bytes);
555
+ for (const e of this.entries) this.files.set(e.name, e);
556
+ const root = this.relsOf("");
557
+ const office = [...root.values()].find((r) => r.type.endsWith("/officeDocument"));
558
+ this.main = office ? office.target : "word/document.xml";
559
+ const doc = this.text(this.main);
560
+ if (doc === null) throw new Error("DOCX file has no document part");
561
+ this.doc = doc;
562
+ if (!/xmlns:w="http:\/\/schemas\.openxmlformats\.org\/wordprocessingml\/2006\/main"/.test(doc.slice(0, doc.indexOf(">", doc.indexOf("<w:document")) + 1))) throw new Error("DOCX document does not use the w: prefix");
563
+ this.fp = this.files.get(this.main).crc.toString(36);
564
+ this.rels = this.relsOf(this.main);
565
+ const theme = this.byType("/theme");
566
+ const t = theme ? this.text(theme.target) ?? "" : "";
567
+ const fonts = { major: /<a:majorFont>\s*<a:latin typeface="([^"]*)"/.exec(t)?.[1] ?? null, minor: /<a:minorFont>\s*<a:latin typeface="([^"]*)"/.exec(t)?.[1] ?? null };
568
+ const styles = this.byType("/styles");
569
+ this.styles = new Styles((styles && this.text(styles.target)) ?? "", fonts);
570
+ const nums = this.byType("/numbering");
571
+ this.nums = new Numbering((nums && this.text(nums.target)) ?? "", this.styles);
572
+ }
573
+ part(name) {
574
+ return inflate(this.files.get(name));
575
+ }
576
+ text(name) {
577
+ if (!this.texts.has(name)) {
578
+ const e = this.files.get(name);
579
+ this.texts.set(name, e ? new TextDecoder("utf-8", { ignoreBOM: true }).decode(inflate(e)) : null);
580
+ }
581
+ return this.texts.get(name);
582
+ }
583
+ byType(suffix) {
584
+ for (const r of this.rels.values()) if (r.type.endsWith(suffix) && !r.external) return r;
585
+ return void 0;
586
+ }
587
+ relsPath(part) {
588
+ const slash = part.lastIndexOf("/");
589
+ return `${part.slice(0, slash + 1)}_rels/${part.slice(slash + 1)}.rels`;
590
+ }
591
+ relsOf(part) {
592
+ const out = /* @__PURE__ */ new Map();
593
+ const s = this.text(this.relsPath(part));
594
+ if (!s) return out;
595
+ const dir = part.slice(0, part.lastIndexOf("/") + 1);
596
+ for (const el of find(parse(s), "Relationships")?.kids ?? []) {
597
+ const id = attr(s, el, "Id");
598
+ const target = attr(s, el, "Target") ?? "";
599
+ const external = attr(s, el, "TargetMode") === "External";
600
+ if (id) out.set(id, { id, type: attr(s, el, "Type") ?? "", target: external ? target : resolve(dir, target), external });
601
+ }
602
+ return out;
603
+ }
604
+ };
605
+ function resolve(dir, target) {
606
+ const parts = (target.startsWith("/") ? target.slice(1) : dir + target).split("/");
607
+ const out = [];
608
+ for (const p of parts) {
609
+ if (p === "..") out.pop();
610
+ else if (p !== ".") out.push(p);
611
+ }
612
+ return out.join("/");
613
+ }
614
+
615
+ // src/docx/read.ts
616
+ var blank = () => ({ align: null, indent: 0, ref: null });
617
+ var mimes = { png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg", gif: "image/gif", bmp: "image/bmp", webp: "image/webp", svg: "image/svg+xml" };
618
+ function align(v) {
619
+ if (v === "center") return "center";
620
+ if (v === "right" || v === "end") return "right";
621
+ if (v === "both" || v === "distribute" || v && /Kashida|thaiDistribute/.test(v)) return "justify";
622
+ return null;
623
+ }
624
+ function base64(bytes) {
625
+ let bin = "";
626
+ for (let i = 0; i < bytes.length; i += 32768) bin += String.fromCharCode(...bytes.subarray(i, i + 32768));
627
+ return btoa(bin);
628
+ }
629
+ var Reader = class {
630
+ constructor(pkg) {
631
+ this.pkg = pkg;
632
+ this.n = 0;
633
+ this.refs = /* @__PURE__ */ new Map();
634
+ this.counters = /* @__PURE__ */ new Map();
635
+ this.fmts = /* @__PURE__ */ new Map();
636
+ this.media = /* @__PURE__ */ new Map();
637
+ this.s = pkg.doc;
638
+ }
639
+ ref() {
640
+ return `${this.pkg.fp}.${(this.n++).toString(36)}`;
641
+ }
642
+ body() {
643
+ const body = find(parse(this.s), "w:body");
644
+ if (!body) throw new Error("DOCX document has no body");
645
+ const { list, tail } = this.blocks(body);
646
+ return { body, list, tail, sect: kid(body, "w:sectPr") };
647
+ }
648
+ fmt(rPr) {
649
+ const key = rPr ? this.s.slice(rPr.start, rPr.end) : "";
650
+ let f = this.fmts.get(key);
651
+ if (!f) {
652
+ const direct = props(this.s, rPr, this.pkg.styles.fonts);
653
+ const style = direct.style ? this.pkg.styles.char(direct.style) : {};
654
+ f = { ...plain, ...style, ...direct };
655
+ this.fmts.set(key, f);
656
+ }
657
+ return f;
658
+ }
659
+ blocks(parent) {
660
+ const s = this.s;
661
+ const list = [];
662
+ let prev = parent.open;
663
+ let group = null;
664
+ let depth = 0;
665
+ for (const k of parent.kids) {
666
+ if (k.name === "w:tcPr") {
667
+ prev = k.end;
668
+ continue;
669
+ }
670
+ if (k.name === "w:sectPr") break;
671
+ if (group) {
672
+ group.end = k.end;
673
+ depth += net(s.slice(k.start, k.end));
674
+ if (depth <= 0) {
675
+ if (/<w:instrText\b[^>]*>\s*TOC\b/.test(s.slice(group.start, group.el.end))) {
676
+ const toc = this.toc(group.el, group.end);
677
+ toc.lead = group.lead;
678
+ list[list.length - 1] = toc;
679
+ }
680
+ group = null;
681
+ }
682
+ prev = k.end;
683
+ continue;
684
+ }
685
+ let b = null;
686
+ if (k.name === "w:p") b = this.paragraph(k);
687
+ else if (k.name === "w:tbl") b = this.table(k);
688
+ else if (k.name === "w:sdt" && sdtLabel(s, k) === "Table of contents") b = this.toc(k);
689
+ else if (k.name === "w:sdt" || k.name === "w:customXml" || k.name === "w:altChunk") b = this.lock(k, sdtLabel(s, k));
690
+ if (!b) continue;
691
+ b.lead = s.slice(prev, k.start);
692
+ prev = k.end;
693
+ list.push(b);
694
+ if (b.kind === "lock" && k.name === "w:p") {
695
+ depth = net(s.slice(k.start, k.end));
696
+ if (depth > 0) group = b;
697
+ }
698
+ }
699
+ return { list, tail: prev };
700
+ }
701
+ block(kind, el, node, ref) {
702
+ const b = { ref, kind, el, start: el.start, end: el.end, lead: "", node, pieces: [], list: null, ctx: null, task: null, quote: false, level: null, rows: [], cols: 0 };
703
+ this.refs.set(ref, b);
704
+ return b;
705
+ }
706
+ toc(el, end = el.end) {
707
+ const ref = this.ref();
708
+ const { entries, title } = contents(this.s.slice(el.start, end), this.pkg.styles);
709
+ const b = this.block("toc", el, { type: "toc", attrs: { entries: JSON.stringify(entries), title, align: null, indent: 0, ref } }, ref);
710
+ b.end = end;
711
+ return b;
712
+ }
713
+ lock(el, label, ref = "lock:" + this.ref()) {
714
+ return this.block("lock", el, { type: "paragraph", attrs: { align: null, indent: 0, ref }, content: [{ type: "text", text: `[${label}]` }] }, ref);
715
+ }
716
+ paragraph(el) {
717
+ const s = this.s;
718
+ const st = { lock: null, task: null, box: false, open: false };
719
+ const pieces = [];
720
+ this.walk(el.kids, [], el, pieces, st);
721
+ const fields = this.fields(pieces, st);
722
+ if (st.lock || st.open || !fields) {
723
+ const label = st.lock ?? (/\bTOC\b/.test(pieces.map((p) => p.instr ?? "").join("")) ? "Table of contents" : "Field");
724
+ const text = st.open ? "" : pieces.map((p) => p.text ?? "").join("");
725
+ const b2 = this.lock(el, label);
726
+ if (text.trim()) b2.node.content[0].text += " " + text.trim();
727
+ return b2;
728
+ }
729
+ const final = fields;
730
+ for (const p of final) {
731
+ const src = p.pic && this.src(p.pic.embed);
732
+ if (!src) continue;
733
+ const meta2 = Object.fromEntries(attrs(/<wp:docPr\b[^>]*>/.exec(p.raw)?.[0] ?? "<x>"));
734
+ p.img = { src, alt: meta2.descr ?? null, title: meta2.title ?? null, width: Math.round(p.pic.cx / 9525), height: Math.round(p.pic.cy / 9525) };
735
+ }
736
+ const pPr = kid(el, "w:pPr");
737
+ const styles = this.pkg.styles;
738
+ const sEl = pPr && kid(pPr, "w:pStyle");
739
+ const style = sEl ? attr(s, sEl, "w:val") : null;
740
+ const jc = pPr && kid(pPr, "w:jc");
741
+ const visible = final.some((p) => p.text !== null || p.img);
742
+ if (!visible && final.some((p) => p.pic)) return this.lock(el, "Picture");
743
+ const ref = this.ref();
744
+ if (!visible && final.some((p) => p.brk === "page")) return this.block("pb", el, { type: "pageBreak", attrs: { align: null, indent: 0, ref } }, ref);
745
+ const bdr = pPr && kid(pPr, "w:pBdr");
746
+ if (!visible && (final.some((p) => p.brk === "hr") || bdr && kid(bdr, "w:bottom") && !kid(bdr, "w:top"))) return this.block("hr", el, { type: "horizontalRule", attrs: { align: null, indent: 0, ref } }, ref);
747
+ const ol = pPr && kid(pPr, "w:outlineLvl");
748
+ const level = ol ? outline(attr(s, ol, "w:val")) : styles.heading(style);
749
+ const np = pPr && kid(pPr, "w:numPr");
750
+ let num = null;
751
+ if (np) {
752
+ const id = kid(np, "w:numId");
753
+ const lv = kid(np, "w:ilvl");
754
+ const fromStyle = styles.numPr(style);
755
+ num = { num: id ? +(attr(s, id, "w:val") ?? 0) : fromStyle?.num ?? 0, lvl: lv ? +(attr(s, lv, "w:val") ?? 0) : fromStyle?.lvl ?? 0 };
756
+ } else num = styles.numPr(style);
757
+ const type = num && num.num ? this.pkg.nums.kind(num.num, num.lvl) : null;
758
+ const isList = !!type && st.task === null && level === null;
759
+ const ind = pPr && kid(pPr, "w:ind");
760
+ const left = ind && (attr(s, ind, "w:left") ?? attr(s, ind, "w:start"));
761
+ const indent = isList ? 0 : Math.max(0, Math.round((left !== null && left !== void 0 ? +left : styles.left(style)) / 720));
762
+ const base = { align: align(jc ? attr(s, jc, "w:val") : styles.jc(style)), indent, ref };
763
+ const node = level ? { type: "heading", attrs: { level, ...base } } : { type: "paragraph", attrs: base };
764
+ const content = inline(final);
765
+ if (content.length) node.content = content;
766
+ const b = this.block("p", el, node, ref);
767
+ b.pieces = final;
768
+ b.level = level;
769
+ b.task = level === null ? st.task : null;
770
+ b.quote = !isList && b.task === null && level === null && !!style && /quote|block text|цитата/i.test(styles.name(style));
771
+ if (isList) {
772
+ const counts = this.counters.get(num.num) ?? [];
773
+ counts[num.lvl] = counts[num.lvl] === void 0 ? this.pkg.nums.start(num.num, num.lvl) : counts[num.lvl] + 1;
774
+ counts.length = num.lvl + 1;
775
+ this.counters.set(num.num, counts);
776
+ b.list = { num: num.num, lvl: num.lvl, type, start: counts[num.lvl] };
777
+ }
778
+ return b;
779
+ }
780
+ src(embed) {
781
+ if (!this.media.has(embed)) {
782
+ const rel = this.pkg.rels.get(embed);
783
+ const ext = rel && !rel.external ? rel.target.split(".").pop().toLowerCase() : "";
784
+ const e = rel && this.pkg.files.get(rel.target);
785
+ this.media.set(embed, e && mimes[ext] ? `data:${mimes[ext]};base64,${base64(this.pkg.part(rel.target))}` : null);
786
+ }
787
+ return this.media.get(embed);
788
+ }
789
+ walk(kids, ctx, parent, out, st) {
790
+ const s = this.s;
791
+ for (const k of kids) {
792
+ const name = k.name;
793
+ if (name === "w:pPr") continue;
794
+ if (name === "w:r") this.run(k, ctx, parent, out, st);
795
+ else if (name === "w:hyperlink" && k.end !== k.open) {
796
+ const id = attr(s, k, "r:id");
797
+ const anchor = attr(s, k, "w:anchor");
798
+ const rel = id ? this.pkg.rels.get(id) : void 0;
799
+ const href = (rel ? rel.target : "") + (anchor ? "#" + anchor : "") || null;
800
+ this.walk(k.kids, [...ctx, { open: s.slice(k.start, k.open), close: "</w:hyperlink>", link: href, ins: false }], k, out, st);
801
+ } else if ((name === "w:ins" || name === "w:moveTo" || name === "w:del" || name === "w:moveFrom") && k.end !== k.open) {
802
+ const rev = JSON.stringify([name === "w:ins" || name === "w:moveTo" ? "ins" : "del", attr(s, k, "w:id") ?? "", attr(s, k, "w:author") ?? "", attr(s, k, "w:date") ?? ""]);
803
+ this.walk(k.kids, [...ctx, { open: s.slice(k.start, k.open), close: `</${name}>`, link: null, ins: true, rev }], k, out, st);
804
+ } else if ((name === "w:smartTag" || name === "w:customXml" || name === "w:dir" || name === "w:bdo") && k.end !== k.open) {
805
+ const pr = k.kids[0] && /Pr$/.test(k.kids[0].name) ? k.kids[0] : null;
806
+ this.walk(pr ? k.kids.slice(1) : k.kids, [...ctx, { open: s.slice(k.start, pr ? pr.end : k.open), close: `</${name}>`, link: null, ins: false }], k, out, st);
807
+ } else if (name === "w:sdt") {
808
+ const pr = kid(k, "w:sdtPr");
809
+ const box = pr && find(pr, "w14:checkbox");
810
+ if (box && st.task === null && !out.some((p) => p.text !== null)) {
811
+ const c = find(box, "w14:checked");
812
+ st.task = !!c && on(s, c, "w14:val");
813
+ st.box = true;
814
+ out.push({ text: null, raw: s.slice(k.start, k.end), run: null, ctx, span: null, box: true });
815
+ } else {
816
+ const content = kid(k, "w:sdtContent");
817
+ const inside = [];
818
+ if (content) this.walk(content.kids, ctx, content, inside, { lock: null, task: false, box: false });
819
+ this.span(s.slice(k.start, k.end), inside, out, ctx, null);
820
+ }
821
+ } else if (name === "w:fldSimple") {
822
+ const inside = [];
823
+ this.walk(k.kids, ctx, k, inside, { lock: null, task: false, box: false });
824
+ this.span(s.slice(k.start, k.end), inside, out, ctx, hyperlink(attr(s, k, "w:instr") ?? ""));
825
+ } else if (name === "m:oMath") {
826
+ const text = s.slice(k.start, k.end).match(/<m:t(?:\s[^>]*)?>[^<]*<\/m:t>/g)?.map((t) => inner(t, parse(t).kids[0])).join("") ?? "";
827
+ this.span(s.slice(k.start, k.end), text ? [{ text, raw: null, run: null, ctx, span: null }] : [], out, ctx, null);
828
+ } else if (name === "m:oMathPara") st.lock = "Equation";
829
+ else out.push({ text: null, raw: s.slice(k.start, k.end), run: null, ctx, span: null });
830
+ }
831
+ }
832
+ span(xml, inside, out, ctx, link) {
833
+ const shown = inside.filter((p) => p.text !== null);
834
+ if (!shown.length) {
835
+ out.push({ text: null, raw: xml, run: null, ctx, span: null });
836
+ return;
837
+ }
838
+ const span = { xml, link };
839
+ for (const p of shown) out.push({ ...p, span });
840
+ }
841
+ run(k, ctx, parent, out, st) {
842
+ const s = this.s;
843
+ const rPrEl = kid(k, "w:rPr");
844
+ const f = this.fmt(rPrEl);
845
+ if (f.hidden || k.end === k.open) {
846
+ out.push({ text: null, raw: s.slice(k.start, k.end), run: null, ctx, span: null });
847
+ return;
848
+ }
849
+ const run = { open: opened(s, k), rPr: rPrEl ? s.slice(rPrEl.start, rPrEl.end) : "", fmt: f, el: k, parent };
850
+ const push = (text, raw, extra) => {
851
+ if (text !== null && st.box) {
852
+ st.box = false;
853
+ if (text.startsWith(" ") && raw === null) {
854
+ out.push({ text: null, raw: '<w:t xml:space="preserve"> </w:t>', run, ctx, span: null, box: true });
855
+ text = text.slice(1);
856
+ if (!text) return;
857
+ }
858
+ }
859
+ out.push({ text, raw, run, ctx, span: null, ...extra });
860
+ };
861
+ for (const c of k.kids) {
862
+ const raw = s.slice(c.start, c.end);
863
+ switch (c.name) {
864
+ case "w:rPr":
865
+ break;
866
+ case "w:t":
867
+ case "w:delText": {
868
+ const text = inner(s, c).replace(/[\r\n]/g, " ");
869
+ if (text) push(text, null);
870
+ break;
871
+ }
872
+ case "w:tab":
873
+ case "w:ptab":
874
+ push(" ", raw);
875
+ break;
876
+ case "w:cr":
877
+ push("\n", raw);
878
+ break;
879
+ case "w:noBreakHyphen":
880
+ push("\u2011", raw);
881
+ break;
882
+ case "w:softHyphen":
883
+ push("\xAD", raw);
884
+ break;
885
+ case "w:br": {
886
+ const type = attr(s, c, "w:type");
887
+ if (type === "page") push(null, raw, { brk: "page" });
888
+ else if (type === "column") push(null, raw);
889
+ else push("\n", raw);
890
+ break;
891
+ }
892
+ case "w:fldChar":
893
+ push(null, raw, { fld: attr(s, c, "w:fldCharType") ?? "" });
894
+ break;
895
+ case "w:instrText":
896
+ push(null, raw, { instr: inner(s, c) });
897
+ break;
898
+ case "w:drawing": {
899
+ const pic = picture(raw);
900
+ if (pic) push(null, raw, { pic });
901
+ else st.lock = shape(raw);
902
+ break;
903
+ }
904
+ case "w:pict": {
905
+ const pic = /textbox/.test(raw) ? null : vml(raw);
906
+ if (/o:hr="t"/.test(raw)) push(null, raw, { brk: "hr" });
907
+ else if (pic) push(null, raw, { pic });
908
+ else st.lock = /textbox/.test(raw) ? "Text box" : "Shape";
909
+ break;
910
+ }
911
+ case "mc:AlternateContent":
912
+ st.lock = shape(raw);
913
+ break;
914
+ case "w:object":
915
+ st.lock = "Object";
916
+ break;
917
+ default:
918
+ push(null, raw);
919
+ }
920
+ }
921
+ }
922
+ fields(pieces, st) {
923
+ if (!pieces.some((p) => p.fld)) return pieces;
924
+ const out = [];
925
+ let depth = 0;
926
+ let begin = -1;
927
+ for (let i = 0; i < pieces.length; i++) {
928
+ const p = pieces[i];
929
+ if (p.fld === "begin") {
930
+ if (depth++ === 0) begin = i;
931
+ } else if (p.fld === "end" && depth > 0 && --depth === 0) {
932
+ const a = pieces[begin].run;
933
+ const z = p.run;
934
+ if (a.parent !== z.parent) return null;
935
+ let first = begin;
936
+ while (first > 0 && pieces[first - 1].run === a) first--;
937
+ let last = i;
938
+ while (last + 1 < pieces.length && pieces[last + 1].run === z) last++;
939
+ out.length -= begin - first;
940
+ const shown = [];
941
+ const code = [];
942
+ let hidden = 0;
943
+ let instr = "";
944
+ for (let j = first; j <= last; j++) {
945
+ const q = pieces[j];
946
+ if (q.fld === "begin") {
947
+ code.push(true);
948
+ hidden++;
949
+ } else if (q.fld === "separate" && code[code.length - 1]) {
950
+ code[code.length - 1] = false;
951
+ hidden--;
952
+ } else if (q.fld === "end") {
953
+ if (code.pop()) hidden--;
954
+ } else if (q.instr && code.length === 1) instr += q.instr;
955
+ else if (q.text !== null && hidden === 0) shown.push(q);
956
+ }
957
+ this.span(this.s.slice(a.el.start, z.el.end), shown, out, pieces[first].ctx, hyperlink(instr));
958
+ i = last;
959
+ } else if (depth === 0) out.push(p);
960
+ }
961
+ if (depth > 0) st.open = true;
962
+ return out;
963
+ }
964
+ table(el) {
965
+ const s = this.s;
966
+ if (el.kids.some((k) => k.name === "w:sdt" || k.name === "w:customXml" || k.name === "w:tr" && k.kids.some((c) => c.name === "w:sdt" || c.name === "w:customXml"))) return this.lock(el, "Table");
967
+ const ref = this.ref();
968
+ const pr = kid(el, "w:tblPr");
969
+ const jc = pr && kid(pr, "w:jc");
970
+ const node = { type: "table", attrs: { align: align(jc ? attr(s, jc, "w:val") : null), indent: 0, ref }, content: [] };
971
+ const b = this.block("tbl", el, node, ref);
972
+ const grid2 = kid(el, "w:tblGrid");
973
+ b.cols = grid2 ? grid2.kids.filter((k) => k.name === "w:gridCol").length : 0;
974
+ const open = [];
975
+ let prev = grid2 ? grid2.end : pr ? pr.end : el.open;
976
+ for (const tr of el.kids) {
977
+ if (tr.name !== "w:tr") continue;
978
+ const rref = this.ref();
979
+ const row = { ref: rref, el: tr, lead: s.slice(prev, tr.start), head: "", cells: [], node: { type: "tableRow", attrs: { align: null, indent: 0, ref: rref }, content: [] } };
980
+ this.refs.set(rref, row);
981
+ prev = tr.end;
982
+ const trPr = kid(tr, "w:trPr");
983
+ const header = !!trPr && on(s, kid(trPr, "w:tblHeader"));
984
+ const before = trPr && kid(trPr, "w:gridBefore");
985
+ let col = before ? +(attr(s, before, "w:val") ?? 0) : 0;
986
+ let last = tr.open;
987
+ for (const c of tr.kids) {
988
+ if (c.name === "w:tc") break;
989
+ if (c.name === "w:trPr" || c.name === "w:tblPrEx") last = c.end;
990
+ }
991
+ row.head = s.slice(tr.open, last);
992
+ for (const tc of tr.kids) {
993
+ if (tc.name !== "w:tc") continue;
994
+ const tcPr = kid(tc, "w:tcPr");
995
+ const gs = tcPr && kid(tcPr, "w:gridSpan");
996
+ const vmEl = tcPr && kid(tcPr, "w:vMerge");
997
+ const vmVal = vmEl ? attr(s, vmEl, "w:val") : null;
998
+ const span = gs ? Math.max(1, +(attr(s, gs, "w:val") ?? 1)) : 1;
999
+ let vm = vmEl ? vmVal === "restart" ? "restart" : "continue" : null;
1000
+ if (vm === "continue" && !open[col]) vm = null;
1001
+ const cref = this.ref();
1002
+ const inside = this.blocks(tc);
1003
+ const cell = { ref: cref, el: tc, lead: s.slice(last, tc.start), col, span, vm, blocks: inside.list, tail: s.slice(inside.tail, tc.close), node: null };
1004
+ last = tc.end;
1005
+ this.refs.set(cref, cell);
1006
+ if (vm === "continue") open[col].attrs.rowspan++;
1007
+ else {
1008
+ const content = assemble(inside.list);
1009
+ cell.node = { type: header ? "tableHeader" : "tableCell", attrs: { colspan: span, rowspan: 1, align: null, indent: 0, ref: cref }, content: content.length ? content : [{ type: "paragraph", attrs: blank() }] };
1010
+ row.node.content.push(cell.node);
1011
+ for (let c = col; c < col + span; c++) open[c] = null;
1012
+ if (vm === "restart") open[col] = cell.node;
1013
+ }
1014
+ col += span;
1015
+ row.cells.push(cell);
1016
+ }
1017
+ b.rows.push(row);
1018
+ node.content.push(row.node);
1019
+ }
1020
+ return b;
1021
+ }
1022
+ };
1023
+ function net(xml) {
1024
+ let n = 0;
1025
+ if (xml.indexOf("w:fldCharType") === -1) return 0;
1026
+ for (const m of xml.matchAll(/w:fldCharType="(begin|end)"/g)) n += m[1] === "begin" ? 1 : -1;
1027
+ return n;
1028
+ }
1029
+ function hyperlink(instr) {
1030
+ const m = /^\s*HYPERLINK\s+(?:"([^"]*)")?(?:.*?\\l\s+"([^"]*)")?/.exec(instr);
1031
+ if (!m || !m[1] && !m[2]) return null;
1032
+ return (m[1] ?? "") + (m[2] ? "#" + m[2] : "");
1033
+ }
1034
+ function contents(xml, styles) {
1035
+ const entries = [];
1036
+ let title = null;
1037
+ let begun = false;
1038
+ for (const p of xml.match(/<w:p\b(?:[^>]*\/>|[\s\S]*?<\/w:p>)/g) ?? []) {
1039
+ const id = /<w:pStyle w:val="([^"]*)"/.exec(p)?.[1] ?? "";
1040
+ const level = Number(/^toc ?(\d)$/i.exec(styles.name(id).trim())?.[1] ?? /^TOC(\d)$/i.exec(id)?.[1] ?? 0);
1041
+ begun || (begun = level > 0 || /w:fldCharType="begin"/.test(p));
1042
+ const text = (p.replace(/<w:instrText\b[\s\S]*?<\/w:instrText>/g, "").match(/<w:t(?:\s[^>]*)?>[^<]*<\/w:t>|<w:tab\/>/g) ?? []).map((m) => m === "<w:tab/>" ? " " : unescape(m.replace(/<[^>]*>/g, ""))).join("");
1043
+ const shown = (text.includes(" ") ? text.slice(0, text.lastIndexOf(" ")) : text).trim();
1044
+ if (!shown) continue;
1045
+ if (begun) entries.push([level || 1, shown]);
1046
+ else title ?? (title = shown);
1047
+ }
1048
+ return { entries, title };
1049
+ }
1050
+ function sdtLabel(s, el) {
1051
+ if (el.name === "w:altChunk") return "Imported content";
1052
+ const xml = s.slice(el.start, Math.min(el.end, el.start + 4e3));
1053
+ if (/w:docPartGallery w:val="Table of Contents"/.test(xml) || /TOC \\/.test(s.slice(el.start, el.end))) return "Table of contents";
1054
+ const alias = /<w:alias w:val="([^"]*)"/.exec(xml);
1055
+ return alias ? alias[1] : "Content control";
1056
+ }
1057
+ function picture(raw) {
1058
+ if (!/drawingml\/2006\/picture"/.test(raw) || /wps:|wpg:|wpc:|c:chart|dgm:|txbxContent/.test(raw)) return null;
1059
+ const embed = /<a:blip\b[^>]*\br:embed="([^"]*)"/.exec(raw);
1060
+ const ext = /<wp:extent\b[^>]*\bcx="(\d+)"[^>]*\bcy="(\d+)"/.exec(raw);
1061
+ return embed && ext ? { embed: embed[1], cx: +ext[1], cy: +ext[2] } : null;
1062
+ }
1063
+ function vml(raw) {
1064
+ const embed = /<v:imagedata\b[^>]*\br:id="([^"]*)"/.exec(raw);
1065
+ const style = /<v:shape\b[^>]*\bstyle="([^"]*)"/.exec(raw)?.[1] ?? "";
1066
+ const emu = (key) => {
1067
+ const m = new RegExp(`(?:^|;)\\s*${key}:\\s*([\\d.]+)(pt|px|in|cm|mm)?`).exec(style);
1068
+ return m ? Math.round(+m[1] * ({ px: 9525, in: 914400, cm: 36e4, mm: 36e3 }[m[2]] ?? 12700)) : 0;
1069
+ };
1070
+ return embed ? { embed: embed[1], cx: emu("width"), cy: emu("height") } : null;
1071
+ }
1072
+ function shape(raw) {
1073
+ if (/txbxContent|v:textbox/.test(raw)) return "Text box";
1074
+ if (/c:chart/.test(raw)) return "Chart";
1075
+ if (/dgm:/.test(raw)) return "Diagram";
1076
+ if (/m:oMath/.test(raw)) return "Equation";
1077
+ return /drawingml\/2006\/picture"/.test(raw) ? "Picture" : "Shape";
1078
+ }
1079
+ function fmtAt(p) {
1080
+ const f = p.run ? p.run.fmt : plain;
1081
+ let link = null;
1082
+ let rev = null;
1083
+ for (const w of p.ctx) {
1084
+ if (w.link) link = w.link;
1085
+ if (w.rev) rev = w.rev;
1086
+ }
1087
+ link ?? (link = p.span?.link ?? null);
1088
+ return link === f.link && rev === f.rev ? f : { ...f, link, rev };
1089
+ }
1090
+ function inline(pieces) {
1091
+ const out = [];
1092
+ let key = "";
1093
+ for (const p of pieces) {
1094
+ if (p.img) {
1095
+ out.push({ type: "image", attrs: { ...p.img } });
1096
+ key = "";
1097
+ continue;
1098
+ }
1099
+ if (p.text === null) continue;
1100
+ if (p.text === "\n") {
1101
+ out.push({ type: "hardBreak" });
1102
+ key = "";
1103
+ continue;
1104
+ }
1105
+ const f = fmtAt(p);
1106
+ const k = keyOf(f);
1107
+ const last = out[out.length - 1];
1108
+ if (last && last.type === "text" && k === key) last.text += p.text;
1109
+ else {
1110
+ const node = { type: "text", text: p.text };
1111
+ const marks = marksOf(f);
1112
+ if (marks) node.marks = marks;
1113
+ out.push(node);
1114
+ key = k;
1115
+ }
1116
+ }
1117
+ return out;
1118
+ }
1119
+ function assemble(list) {
1120
+ const out = [];
1121
+ for (let i = 0; i < list.length; ) {
1122
+ const b = list[i];
1123
+ let j = i + 1;
1124
+ if (b.list) {
1125
+ while (j < list.length && list[j].list && !(list[j].list.num !== b.list.num && list[j].list.lvl <= b.list.lvl)) j++;
1126
+ out.push(nest(list.slice(i, j)));
1127
+ } else if (b.task !== null) {
1128
+ while (j < list.length && list[j].task !== null) j++;
1129
+ out.push({ type: "taskList", attrs: blank(), content: list.slice(i, j).map((t) => ({ type: "taskItem", attrs: { checked: t.task, ...blank() }, content: [t.node] })) });
1130
+ } else if (b.quote) {
1131
+ while (j < list.length && list[j].quote) j++;
1132
+ out.push({ type: "blockquote", attrs: blank(), content: list.slice(i, j).map((q) => q.node) });
1133
+ } else out.push(b.node);
1134
+ i = j;
1135
+ }
1136
+ return out;
1137
+ }
1138
+ function nest(list) {
1139
+ const make = (b) => ({ type: b.list.type, attrs: b.list.type === "orderedList" ? { start: b.list.start, ...blank() } : blank(), content: [] });
1140
+ const root = make(list[0]);
1141
+ const stack = [{ list: root, lvl: list[0].list.lvl }];
1142
+ for (const b of list) {
1143
+ let top = stack[stack.length - 1];
1144
+ while (b.list.lvl < top.lvl && stack.length > 1) {
1145
+ stack.pop();
1146
+ top = stack[stack.length - 1];
1147
+ }
1148
+ if (b.list.lvl > top.lvl && top.list.content.length) {
1149
+ const sub = make(b);
1150
+ top.list.content[top.list.content.length - 1].content.push(sub);
1151
+ stack.push({ list: sub, lvl: b.list.lvl });
1152
+ top = stack[stack.length - 1];
1153
+ }
1154
+ b.ctx = { type: top.list.type, depth: stack.length - 1 };
1155
+ top.list.content.push({ type: "listItem", attrs: blank(), content: [b.node] });
1156
+ }
1157
+ return root;
1158
+ }
1159
+
1160
+ // src/docx/diff.ts
1161
+ function diff(a, b) {
1162
+ const map = new Int32Array(b.length).fill(-1);
1163
+ let p = 0;
1164
+ while (p < a.length && p < b.length && a[p] === b[p]) map[p] = p++;
1165
+ let q = 0;
1166
+ while (q < a.length - p && q < b.length - p && a[a.length - 1 - q] === b[b.length - 1 - q]) {
1167
+ map[b.length - 1 - q] = a.length - 1 - q;
1168
+ q++;
1169
+ }
1170
+ const n = a.length - p - q;
1171
+ const m = b.length - p - q;
1172
+ if (!n || !m) return map;
1173
+ const max = Math.min(n + m, 1200);
1174
+ const off = max + 1;
1175
+ const v = new Int32Array(2 * max + 3);
1176
+ const trace = [];
1177
+ for (let d = 0; d <= max; d++) {
1178
+ trace.push(v.slice(off - d - 1, off + d + 2));
1179
+ for (let k = -d; k <= d; k += 2) {
1180
+ let x = k === -d || k !== d && v[off + k - 1] < v[off + k + 1] ? v[off + k + 1] : v[off + k - 1] + 1;
1181
+ let y = x - k;
1182
+ while (x < n && y < m && a[p + x] === b[p + y]) {
1183
+ x++;
1184
+ y++;
1185
+ }
1186
+ v[off + k] = x;
1187
+ if (x >= n && y >= m) {
1188
+ for (let e = d; e > 0; e--) {
1189
+ const t = trace[e];
1190
+ const at = (j) => t[j + e + 1];
1191
+ const down = k === -e || k !== e && at(k - 1) < at(k + 1);
1192
+ const pk = down ? k + 1 : k - 1;
1193
+ const px = at(pk);
1194
+ const py = px - pk;
1195
+ while (x > px && y > py) map[p + --y] = p + --x;
1196
+ x = px;
1197
+ y = py;
1198
+ k = pk;
1199
+ }
1200
+ while (x > 0 && y > 0) map[p + --y] = p + --x;
1201
+ return map;
1202
+ }
1203
+ }
1204
+ }
1205
+ return map;
1206
+ }
1207
+
1208
+ // src/docx/write.ts
1209
+ var P = ["w:pStyle", "w:keepNext", "w:keepLines", "w:pageBreakBefore", "w:framePr", "w:widowControl", "w:numPr", "w:suppressLineNumbers", "w:pBdr", "w:shd", "w:tabs", "w:suppressAutoHyphens", "w:kinsoku", "w:wordWrap", "w:overflowPunct", "w:topLinePunct", "w:autoSpaceDE", "w:autoSpaceDN", "w:bidi", "w:adjustRightInd", "w:snapToGrid", "w:spacing", "w:ind", "w:contextualSpacing", "w:mirrorIndents", "w:suppressOverlap", "w:jc", "w:textDirection", "w:textAlignment", "w:textboxTightWrap", "w:outlineLvl", "w:divId", "w:cnfStyle", "w:rPr", "w:sectPr", "w:pPrChange"];
1210
+ var R = ["w:rStyle", "w:rFonts", "w:b", "w:bCs", "w:i", "w:iCs", "w:caps", "w:smallCaps", "w:strike", "w:dstrike", "w:outline", "w:shadow", "w:emboss", "w:imprint", "w:noProof", "w:snapToGrid", "w:vanish", "w:webHidden", "w:color", "w:spacing", "w:w", "w:kern", "w:position", "w:sz", "w:szCs", "w:highlight", "w:u", "w:effect", "w:bdr", "w:shd", "w:fitText", "w:vertAlign", "w:rtl", "w:cs", "w:em", "w:lang", "w:eastAsianLayout", "w:specVanish", "w:oMath"];
1211
+ var TC = ["w:cnfStyle", "w:tcW", "w:gridSpan", "w:hMerge", "w:vMerge", "w:tcBorders", "w:shd", "w:noWrap", "w:tcMar", "w:textDirection", "w:tcFitText", "w:vAlign", "w:hideMark", "w:headers", "w:cellIns", "w:cellDel", "w:cellMerge", "w:tcPrChange"];
1212
+ var REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
1213
+ var special = { " ": "<w:tab/>", "\n": "<w:br/>", "\u2011": "<w:noBreakHyphen/>", "\xAD": "<w:softHyphen/>" };
1214
+ var keys = {
1215
+ paragraph: [["align", null], ["indent", 0]],
1216
+ heading: [["level", 1], ["align", null], ["indent", 0]],
1217
+ table: [["align", null]],
1218
+ tableCell: [["colspan", 1], ["rowspan", 1]],
1219
+ tableHeader: [["colspan", 1], ["rowspan", 1]],
1220
+ orderedList: [["start", 1]],
1221
+ taskItem: [["checked", false]],
1222
+ codeBlock: [["language", null]],
1223
+ toc: [["entries", "[]"], ["title", null]]
1224
+ };
1225
+ function value(key, v) {
1226
+ if (v === void 0 || v === "" || v === null) return null;
1227
+ if (key === "align") return v === "left" ? null : v;
1228
+ if (key === "width" || key === "height") return Math.round(Number(v)) || null;
1229
+ if (key === "indent" || key === "level" || key === "colspan" || key === "rowspan" || key === "start") return Number(v) || 0;
1230
+ if (key === "checked") return !!v;
1231
+ return v;
1232
+ }
1233
+ function sig(n) {
1234
+ if (n.type === "text" || n.type === "hardBreak") return inlineSig([n]);
1235
+ const a = n.attrs ?? {};
1236
+ let out = `${n.type}(${(keys[n.type ?? ""] ?? []).map(([k, d]) => {
1237
+ const v = value(k, a[k]);
1238
+ return v === value(k, d) ? "" : `${k}=${JSON.stringify(v)}`;
1239
+ }).join(",")}${a.ref ? "#" + a.ref : ""})`;
1240
+ const kids = n.content ?? [];
1241
+ if (kids.length && (kids[0].type === "text" || kids[0].type === "hardBreak" || kids.some((k) => k.type === "text"))) return out + inlineSig(kids);
1242
+ out += "[" + kids.map(sig).join(",") + "]";
1243
+ return out;
1244
+ }
1245
+ function inlineSig(kids) {
1246
+ let out = "";
1247
+ let key = null;
1248
+ for (const k of kids) {
1249
+ if (k.type === "text") {
1250
+ if (!k.text) continue;
1251
+ const next = keyOf(fmtOf(k.marks));
1252
+ out += (next === key ? "" : `${next}`) + k.text;
1253
+ key = next;
1254
+ } else {
1255
+ out += `${k.type}${k.type === "image" ? picture2(k.attrs ?? {}) : ""}`;
1256
+ key = null;
1257
+ }
1258
+ }
1259
+ return out;
1260
+ }
1261
+ function picture2(a) {
1262
+ return JSON.stringify([a.src ?? null, a.alt || null, a.title || null, Math.round(Number(a.width)) || null, Math.round(Number(a.height)) || null]);
1263
+ }
1264
+ var groups = 0;
1265
+ function flatten(content, out = [], quote = false) {
1266
+ for (const node of content) {
1267
+ const t = node.type;
1268
+ const add = (kind, extra = {}) => out.push({ kind, node, list: null, task: null, quote, cont: null, ...extra });
1269
+ if (t === "paragraph" || t === "heading") add("p");
1270
+ else if (t === "bulletList" || t === "orderedList") listed(node, 0, ++groups, out, quote);
1271
+ else if (t === "taskList") {
1272
+ for (const li of node.content ?? []) {
1273
+ (li.content ?? []).forEach((c, i) => {
1274
+ if (i === 0 && (c.type === "paragraph" || c.type === "heading")) out.push({ kind: "p", node: c, list: null, task: !!li.attrs?.checked, quote, cont: null });
1275
+ else flatten([c], out, quote);
1276
+ });
1277
+ }
1278
+ } else if (t === "blockquote") flatten(node.content ?? [], out, true);
1279
+ else if (t === "table") add("tbl");
1280
+ else if (t === "image") out.push({ kind: "p", node: { type: "paragraph", attrs: { align: null, indent: 0, ref: null }, content: [node] }, list: null, task: null, quote, cont: null });
1281
+ else if (t === "pageBreak") add("pb");
1282
+ else if (t === "toc") add("toc");
1283
+ else if (t === "horizontalRule") add("hr");
1284
+ else if (t === "codeBlock") add("code");
1285
+ else if (node.content) flatten(node.content, out, quote);
1286
+ }
1287
+ return out;
1288
+ }
1289
+ function listed(list, depth, group, out, quote) {
1290
+ for (const li of list.content ?? []) {
1291
+ (li.content ?? []).forEach((c, i) => {
1292
+ if (i === 0 && (c.type === "paragraph" || c.type === "heading")) out.push({ kind: "p", node: c, list: { type: list.type, depth, group, start: Number(list.attrs?.start ?? 1) || 1 }, task: null, quote, cont: null });
1293
+ else if (c.type === "bulletList" || c.type === "orderedList") listed(c, depth + 1, group, out, quote);
1294
+ else if (c.type === "paragraph" || c.type === "heading") out.push({ kind: "p", node: c, list: null, task: null, quote, cont: { depth, group } });
1295
+ else flatten([c], out, quote);
1296
+ });
1297
+ }
1298
+ }
1299
+ function grid(rows) {
1300
+ const taken = [];
1301
+ const from = [];
1302
+ const span = (c) => Math.max(1, Number(c.attrs?.colspan ?? 1) || 1);
1303
+ return rows.map((row) => {
1304
+ const cells = row.content ?? [];
1305
+ const slots = [];
1306
+ let col = 0;
1307
+ let i = 0;
1308
+ while (i < cells.length || taken.some((t, k) => k >= col && t > 0)) {
1309
+ if ((taken[col] ?? 0) > 0) {
1310
+ const f = from[col];
1311
+ const n2 = span(f);
1312
+ for (let k = col; k < col + n2; k++) taken[k]--;
1313
+ slots.push({ col, span: n2, cell: null, from: f });
1314
+ col += n2;
1315
+ continue;
1316
+ }
1317
+ if (i >= cells.length) {
1318
+ col++;
1319
+ continue;
1320
+ }
1321
+ const c = cells[i++];
1322
+ const n = span(c);
1323
+ const rs = Math.max(1, Number(c.attrs?.rowspan ?? 1) || 1);
1324
+ slots.push({ col, span: n, cell: c, from: null });
1325
+ if (rs > 1) for (let k = col; k < col + n; k++) {
1326
+ taken[k] = rs - 1;
1327
+ from[k] = c;
1328
+ }
1329
+ col += n;
1330
+ }
1331
+ return slots;
1332
+ });
1333
+ }
1334
+ function dims(bytes) {
1335
+ const v = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
1336
+ if (bytes[0] === 137 && bytes[1] === 80) return [v.getUint32(16), v.getUint32(20)];
1337
+ if (bytes[0] === 71 && bytes[1] === 73) return [v.getUint16(6, true), v.getUint16(8, true)];
1338
+ if (bytes[0] === 255 && bytes[1] === 216) {
1339
+ for (let i = 2; i + 9 < bytes.length; ) {
1340
+ if (bytes[i] !== 255) return null;
1341
+ const m = bytes[i + 1];
1342
+ if (m >= 192 && m <= 207 && m !== 196 && m !== 200 && m !== 204) return [v.getUint16(i + 7), v.getUint16(i + 5)];
1343
+ i += 2 + v.getUint16(i + 2);
1344
+ }
1345
+ }
1346
+ return null;
1347
+ }
1348
+ function meta(tag, img) {
1349
+ const extra = `${img.alt ? ` descr="${escape(String(img.alt))}"` : ""}${img.title ? ` title="${escape(String(img.title))}"` : ""}`;
1350
+ return tag.replace(/\s(descr|title)="[^"]*"/g, "").replace(/\s*\/?>$/, (end) => extra + end);
1351
+ }
1352
+ function checked(xml, on2) {
1353
+ const yes = /w14:checkedState\b[^>]*w14:val="([0-9A-Fa-f]+)"/.exec(xml)?.[1] ?? "2612";
1354
+ const no = /w14:uncheckedState\b[^>]*w14:val="([0-9A-Fa-f]+)"/.exec(xml)?.[1] ?? "2610";
1355
+ const [from, to] = on2 ? [no, yes] : [yes, no];
1356
+ let out = /<w14:checked\b/.test(xml) ? xml.replace(/(<w14:checked\b[^>]*w14:val=")[^"]*"/, `$1${on2 ? 1 : 0}"`) : xml.replace(/(<w14:checkbox\b[^>]*>)/, `$1<w14:checked w14:val="${on2 ? 1 : 0}"/>`);
1357
+ const at = out.indexOf("<w:sdtContent");
1358
+ if (at === -1) return out;
1359
+ const tail = out.slice(at).replace(new RegExp(`w:char="${from}"`, "i"), `w:char="${to}"`).replace(`>${String.fromCharCode(parseInt(from, 16))}<`, `>${String.fromCharCode(parseInt(to, 16))}<`);
1360
+ out = out.slice(0, at) + tail;
1361
+ return out;
1362
+ }
1363
+ var Writer = class {
1364
+ constructor(pkg, images2) {
1365
+ this.pkg = pkg;
1366
+ this.images = images2;
1367
+ this.claimed = /* @__PURE__ */ new Map();
1368
+ this.used = /* @__PURE__ */ new Set();
1369
+ this.carry = /* @__PURE__ */ new Map();
1370
+ this.left = /* @__PURE__ */ new Map();
1371
+ this.rels = [];
1372
+ this.relIds = /* @__PURE__ */ new Set();
1373
+ this.links = /* @__PURE__ */ new Map();
1374
+ this.media = [];
1375
+ this.types = /* @__PURE__ */ new Set();
1376
+ this.numbering = { abs: [], nums: [] };
1377
+ this.kinds = /* @__PURE__ */ new Map();
1378
+ this.styleXml = [];
1379
+ this.groupNum = /* @__PURE__ */ new Map();
1380
+ this.extra = /* @__PURE__ */ new Map();
1381
+ this.last = null;
1382
+ this.wraps = /* @__PURE__ */ new Map();
1383
+ this.srcs = null;
1384
+ this.tocs = false;
1385
+ this.revs = /* @__PURE__ */ new Map();
1386
+ this.r = new Reader(pkg);
1387
+ this.s = pkg.doc;
1388
+ for (const id of pkg.rels.keys()) this.relIds.add(id);
1389
+ this.nextNum = pkg.nums.maxNum + 1;
1390
+ this.nextAbs = pkg.nums.maxAbs + 1;
1391
+ let max = 0;
1392
+ for (const m of this.s.matchAll(/<wp:docPr\b[^>]*\bid="(\d+)"/g)) max = Math.max(max, +m[1]);
1393
+ this.docPr = max + 1;
1394
+ this.nextRev = Math.max(0, ...[...this.s.matchAll(/\bw:id="(\d+)"/g)].map((m) => +m[1])) + 1;
1395
+ }
1396
+ run(doc) {
1397
+ const s = this.s;
1398
+ this.body = this.r.body();
1399
+ const { list, tail, body } = this.body;
1400
+ assemble(list);
1401
+ this.claim(doc.content ?? []);
1402
+ let rest = "";
1403
+ this.carryOver(list, (x) => rest = x);
1404
+ let xml = this.container(flatten(doc.content ?? []), list, null);
1405
+ if (this.last === "tbl" && list[list.length - 1]?.kind !== "tbl") xml += "<w:p/>";
1406
+ const text = s.slice(0, body.open) + xml + rest + s.slice(tail);
1407
+ const changed = /* @__PURE__ */ new Map();
1408
+ if (text !== s) changed.set(this.pkg.main, text);
1409
+ if (this.rels.length) {
1410
+ const path = this.pkg.relsPath(this.pkg.main);
1411
+ const old = this.pkg.text(path) ?? `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1412
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`;
1413
+ changed.set(path, old.replace(/<\/Relationships>\s*$/, this.rels.join("") + "</Relationships>"));
1414
+ }
1415
+ if (this.numbering.abs.length || this.numbering.nums.length) {
1416
+ const rel = this.pkg.byType("/numbering");
1417
+ let n = rel ? this.pkg.text(rel.target) : null;
1418
+ const path = rel ? rel.target : "word/numbering.xml";
1419
+ if (n === null) {
1420
+ n = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1421
+ <w:numbering xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"></w:numbering>`;
1422
+ this.types.add(`<Override PartName="/${path}" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/>`);
1423
+ }
1424
+ const at = n.search(/<w:num\b[\s>]/);
1425
+ const abs = this.numbering.abs.join("");
1426
+ n = at === -1 ? n.replace(/(<w:numIdMacAtCleanup\b|<\/w:numbering>)/, abs + "$1") : n.slice(0, at) + abs + n.slice(at);
1427
+ n = n.replace(/(<w:numIdMacAtCleanup\b|<\/w:numbering>)/, this.numbering.nums.join("") + "$1");
1428
+ changed.set(path, n);
1429
+ if (!rel) {
1430
+ const id = this.relId();
1431
+ const path2 = this.pkg.relsPath(this.pkg.main);
1432
+ const old = changed.get(path2) ?? this.pkg.text(path2);
1433
+ changed.set(path2, old.replace(/<\/Relationships>\s*$/, `<Relationship Id="${id}" Type="${REL}/numbering" Target="numbering.xml"/></Relationships>`));
1434
+ }
1435
+ }
1436
+ const settings = this.tocs && this.pkg.byType("/settings");
1437
+ const listed2 = settings && this.pkg.text(settings.target);
1438
+ if (settings && listed2 && !/<w:updateFields\b/.test(listed2)) {
1439
+ const at = listed2.search(/<(?:w:hdrShapeDefaults|w:footnotePr|w:endnotePr|w:compat|w:docVars|w:rsids|m:mathPr|w:attachedSchema|w:themeFontLang|w:clrSchemeMapping|w:doNotIncludeSubdocsInStats|w:doNotAutoCompressPictures|w:forceUpgrade|w:captions|w:readModeInkLockDown|w:smartTagType|sl:schemaLibrary|w:shapeDefaults|w:doNotEmbedSmartTags|w:decimalSymbol|w:listSeparator)\b|<\/w:settings>/);
1440
+ changed.set(settings.target, listed2.slice(0, at) + '<w:updateFields w:val="true"/>' + listed2.slice(at));
1441
+ }
1442
+ if (this.styleXml.length) {
1443
+ const rel = this.pkg.byType("/styles");
1444
+ if (rel) changed.set(rel.target, this.pkg.text(rel.target).replace(/<\/w:styles>\s*$/, this.styleXml.join("") + "</w:styles>"));
1445
+ }
1446
+ for (const m of this.media) {
1447
+ changed.set(m.name, m.bytes);
1448
+ const ext = m.name.split(".").pop().toLowerCase();
1449
+ const ct = this.pkg.text("[Content_Types].xml") ?? "";
1450
+ if (!new RegExp(`<Default\\b[^>]*Extension="${ext}"`, "i").test(ct)) this.types.add(`<Default Extension="${ext}" ContentType="${{ jpg: "image/jpeg", svg: "image/svg+xml" }[ext] ?? "image/" + ext}"/>`);
1451
+ }
1452
+ if (this.types.size) changed.set("[Content_Types].xml", (this.pkg.text("[Content_Types].xml") ?? "").replace(/<\/Types>\s*$/, [...this.types].join("") + "</Types>"));
1453
+ if (!changed.size) return null;
1454
+ const enc = new TextEncoder();
1455
+ const main = this.pkg.files.get(this.pkg.main);
1456
+ const out = this.pkg.entries.map((e) => {
1457
+ const v = changed.get(e.name);
1458
+ if (v === void 0) return e;
1459
+ changed.delete(e.name);
1460
+ return entry(e.name, typeof v === "string" ? enc.encode(v) : v, e);
1461
+ });
1462
+ for (const [name, v] of changed) out.push(entry(name, typeof v === "string" ? enc.encode(v) : v, main));
1463
+ return zip(out);
1464
+ }
1465
+ claim(nodes) {
1466
+ for (const n of nodes) {
1467
+ const ref = n.attrs?.ref;
1468
+ const o = typeof ref === "string" ? this.r.refs.get(ref) : void 0;
1469
+ if (o && !this.used.has(o) && this.fits(n, o)) {
1470
+ this.used.add(o);
1471
+ this.claimed.set(n, o);
1472
+ }
1473
+ if (n.content) this.claim(n.content);
1474
+ }
1475
+ }
1476
+ fits(n, o) {
1477
+ if ("cells" in o) return n.type === "tableRow";
1478
+ if ("col" in o) return (n.type === "tableCell" || n.type === "tableHeader") && o.node !== null;
1479
+ if (o.kind === "p") return n.type === "paragraph" || n.type === "heading";
1480
+ if (o.kind === "lock") return n.type === "paragraph";
1481
+ if (o.kind === "toc") return n.type === "toc";
1482
+ return { pb: "pageBreak", hr: "horizontalRule", tbl: "table" }[o.kind] === n.type;
1483
+ }
1484
+ carryOver(list, end) {
1485
+ let pending = "";
1486
+ for (const b of list) {
1487
+ if (this.used.has(b)) {
1488
+ if (pending) this.carry.set(b, pending);
1489
+ pending = "";
1490
+ } else {
1491
+ if (b.lead.trim()) pending += b.lead;
1492
+ const pPr = b.el.name === "w:p" && kid(b.el, "w:pPr");
1493
+ if (pPr && kid(pPr, "w:sectPr")) pending += `<w:p>${this.s.slice(pPr.start, pPr.end)}</w:p>`;
1494
+ }
1495
+ for (const row of b.rows) for (const c of row.cells) this.carryOver(c.blocks, (x) => this.left.set(c, x));
1496
+ }
1497
+ if (pending) end(pending);
1498
+ }
1499
+ container(outs, list, fallback) {
1500
+ const pairs = outs.map((o) => ({ o, b: this.claimed.get(o.node) ?? null }));
1501
+ const lists = /* @__PURE__ */ new Map();
1502
+ for (const p of pairs) if (p.o.list) lists.get(p.o.list.group)?.push(p) ?? lists.set(p.o.list.group, [p]);
1503
+ for (const [group, mine] of lists) this.decide(group, mine);
1504
+ let xml = "";
1505
+ this.last = null;
1506
+ pairs.forEach(({ o, b }, i) => {
1507
+ const near = (test) => {
1508
+ for (let d = 1; d < pairs.length; d++) {
1509
+ const x = pairs[i - d]?.b;
1510
+ if (x && test(x)) return x;
1511
+ const y = pairs[i + d]?.b;
1512
+ if (y && test(y)) return y;
1513
+ }
1514
+ for (const x of list) if (test(x)) return x;
1515
+ return fallback && test(fallback) ? fallback : null;
1516
+ };
1517
+ const prefix = b ? (this.carry.get(b) ?? "") + b.lead : "";
1518
+ xml += prefix + this.emit(o, b, near, fallback);
1519
+ this.last = o.kind;
1520
+ });
1521
+ return xml;
1522
+ }
1523
+ emit(o, b, near, fallback) {
1524
+ const s = this.s;
1525
+ if (b && b.kind === "lock") return s.slice(b.start, b.end);
1526
+ if (o.kind === "p") return this.para(o, b, near, fallback);
1527
+ if (o.kind === "pb") return b ? s.slice(b.start, b.end) : '<w:p><w:r><w:br w:type="page"/></w:r></w:p>';
1528
+ if (o.kind === "hr") return b ? s.slice(b.start, b.end) : '<w:p><w:pPr><w:pBdr><w:bottom w:val="single" w:sz="6" w:space="1" w:color="auto"/></w:pBdr></w:pPr></w:p>';
1529
+ if (o.kind === "tbl") return this.table(o, b, near);
1530
+ if (o.kind === "toc") return b && sig(o.node) === sig(b.node) ? s.slice(b.start, b.end) : this.toc(o.node);
1531
+ return this.code(o);
1532
+ }
1533
+ toc(node) {
1534
+ this.tocs = true;
1535
+ const styles = this.pkg.styles;
1536
+ const sect = this.body.sect;
1537
+ const twips = (el, name, fallback) => Number((el && attr(this.s, el, name)) ?? fallback);
1538
+ const size2 = sect && kid(sect, "w:pgSz");
1539
+ const mar = sect && kid(sect, "w:pgMar");
1540
+ const width = twips(size2, "w:w", 12240) - twips(mar, "w:left", 1440) - twips(mar, "w:right", 1440);
1541
+ const list = JSON.parse(String(node.attrs?.entries ?? "[]"));
1542
+ const begin = '<w:r><w:fldChar w:fldCharType="begin"/></w:r><w:r><w:instrText xml:space="preserve"> TOC \\o "1-3" \\h \\z \\u </w:instrText></w:r><w:r><w:fldChar w:fldCharType="separate"/></w:r>';
1543
+ const end = '<w:r><w:fldChar w:fldCharType="end"/></w:r>';
1544
+ const style = (test, fallback) => escape(styles.find((name) => test.test(name.trim())) ?? fallback);
1545
+ const title = node.attrs?.title ? `<w:p><w:pPr><w:pStyle w:val="${style(/^toc heading$/i, "TOCHeading")}"/></w:pPr><w:r><w:t xml:space="preserve">${escape(String(node.attrs.title))}</w:t></w:r></w:p>` : "";
1546
+ const rows = list.length ? list.map(([level, text], i) => `<w:p><w:pPr><w:pStyle w:val="${style(new RegExp(`^toc ${level}$`, "i"), `TOC${level}`)}"/><w:tabs><w:tab w:val="right" w:leader="dot" w:pos="${width}"/></w:tabs></w:pPr>${i ? "" : begin}<w:r><w:t xml:space="preserve">${escape(text)}</w:t></w:r>${i === list.length - 1 ? end : ""}</w:p>`).join("") : `<w:p>${begin}<w:r><w:t>No table of contents entries found.</w:t></w:r>${end}</w:p>`;
1547
+ return `<w:sdt><w:sdtPr><w:docPartObj><w:docPartGallery w:val="Table of Contents"/><w:docPartUnique/></w:docPartObj></w:sdtPr><w:sdtContent>${title}${rows}</w:sdtContent></w:sdt>`;
1548
+ }
1549
+ decide(group, mine) {
1550
+ const top = mine.find((p) => p.o.list.depth === 0) ?? mine[0];
1551
+ const type = top.o.list.type;
1552
+ const hit = mine.find((p) => p.b?.list && p.b.ctx?.type === p.o.list.type && p.o.list.depth === 0 && this.kindOf(p.b.list.num, p.b.list.lvl) === type) ?? mine.find((p) => p.b?.list && p.b.ctx?.type === p.o.list.type);
1553
+ if (hit) this.groupNum.set(group, { num: hit.b.list.num, base: Math.max(0, hit.b.list.lvl - hit.o.list.depth) });
1554
+ else this.groupNum.set(group, { num: this.newNum(type, top.o.list.start), base: 0 });
1555
+ }
1556
+ kindOf(num, lvl) {
1557
+ return this.kinds.get(num) ?? this.pkg.nums.kind(num, lvl);
1558
+ }
1559
+ newNum(type, start) {
1560
+ let abs = -1;
1561
+ for (const b of this.r.refs.values()) if ("kind" in b && b.list && b.list.lvl === 0 && b.list.type === type) {
1562
+ abs = this.pkg.nums.nums.get(b.list.num)?.abs ?? -1;
1563
+ break;
1564
+ }
1565
+ if (abs === -1) {
1566
+ for (const [id, lvls] of this.pkg.nums.abs) if (lvls.get(0)?.fmt === "bullet" === (type === "bulletList") && lvls.get(0)?.fmt !== "none") {
1567
+ abs = id;
1568
+ break;
1569
+ }
1570
+ }
1571
+ if (abs === -1) {
1572
+ abs = this.nextAbs++;
1573
+ const fmts = type === "bulletList" ? ["bullet"] : ["decimal", "lowerLetter", "lowerRoman"];
1574
+ const lvls = Array.from({ length: 9 }, (_, l) => {
1575
+ const fmt = fmts[l % fmts.length];
1576
+ const text = fmt === "bullet" ? ["\u2022", "\u25E6", "\u25AA"][l % 3] : `%${l + 1}.`;
1577
+ return `<w:lvl w:ilvl="${l}"><w:start w:val="1"/><w:numFmt w:val="${fmt}"/><w:lvlText w:val="${text}"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="${720 * (l + 1)}" w:hanging="360"/></w:pPr></w:lvl>`;
1578
+ }).join("");
1579
+ this.numbering.abs.push(`<w:abstractNum w:abstractNumId="${abs}"><w:multiLevelType w:val="hybridMultilevel"/>${lvls}</w:abstractNum>`);
1580
+ }
1581
+ const num = this.nextNum++;
1582
+ this.kinds.set(num, type);
1583
+ this.numbering.nums.push(`<w:num w:numId="${num}"><w:abstractNumId w:val="${abs}"/>${type === "orderedList" ? `<w:lvlOverride w:ilvl="0"><w:startOverride w:val="${start}"/></w:lvlOverride>` : ""}</w:num>`);
1584
+ return num;
1585
+ }
1586
+ listPr(o, b) {
1587
+ if (!o.list) return null;
1588
+ const g = this.groupNum.get(o.list.group);
1589
+ if (b?.list && b.ctx && b.ctx.type === o.list.type && b.ctx.depth === o.list.depth && (o.list.depth > 0 || b.list.num === g.num)) return b.list;
1590
+ const lvl = Math.min(8, g.base + o.list.depth);
1591
+ if (this.kindOf(g.num, lvl) === o.list.type) return { num: g.num, lvl };
1592
+ const key = `${o.list.group}:${o.list.type}`;
1593
+ if (!this.extra.has(key)) this.extra.set(key, this.newNum(o.list.type, o.list.start));
1594
+ return { num: this.extra.get(key), lvl };
1595
+ }
1596
+ kindTest(o) {
1597
+ const level = o.node.type === "heading" ? Number(o.node.attrs?.level ?? 1) : null;
1598
+ if (o.task !== null) return (b) => b.kind === "p" && b.task !== null;
1599
+ if (level) return (b) => b.kind === "p" && b.level === level;
1600
+ if (o.list) return (b) => b.kind === "p" && !!b.list && b.ctx?.type === o.list.type;
1601
+ if (o.quote) return (b) => b.kind === "p" && b.quote;
1602
+ return (b) => b.kind === "p" && !b.list && b.task === null && !b.level && !b.quote;
1603
+ }
1604
+ para(o, b, near, fallback) {
1605
+ const pr = this.listPr(o, b);
1606
+ const same = b && o.cont === null && o.quote === b.quote && (o.task ?? null) === b.task && (pr ? !!b.list && pr.num === b.list.num && pr.lvl === b.list.lvl : !b.list);
1607
+ if (b && same && sig(o.node) === sig(b.node)) return this.s.slice(b.start, b.end);
1608
+ const src = b ?? near(this.kindTest(o)) ?? (fallback?.kind === "p" ? fallback : null);
1609
+ return (b ? opened(this.s, b.el) : "<w:p>") + this.pPr(o, b, src, pr) + this.inline(o, b, src, near) + "</w:p>";
1610
+ }
1611
+ pPr(o, b, src, pr) {
1612
+ const s = this.s;
1613
+ const styles = this.pkg.styles;
1614
+ const el = src && kid(src.el, "w:pPr");
1615
+ let xml = el ? s.slice(el.start, el.end) : "";
1616
+ const set = {};
1617
+ if (!b && xml) {
1618
+ const rPr = kid(el, "w:rPr");
1619
+ xml = rebuild(xml, "w:pPr", P, { "w:sectPr": null, "w:pPrChange": null, "w:rPr": rPr ? rebuild(s.slice(rPr.start, rPr.end), "w:rPr", R, { "w:ins": null, "w:del": null, "w:moveFrom": null, "w:moveTo": null, "w:rPrChange": null }) || null : null });
1620
+ }
1621
+ const root = xml ? parse(xml).kids[0] : void 0;
1622
+ const get = (name) => root && kid(root, name);
1623
+ const styleEl = get("w:pStyle");
1624
+ const was = { style: styleEl ? attr(xml, styleEl, "w:val") : null, level: src?.level ?? null, quote: src?.quote ?? false, list: src?.list ?? null };
1625
+ let style = was.style;
1626
+ const level = o.node.type === "heading" ? Math.min(6, Math.max(1, Number(o.node.attrs?.level ?? 1))) : null;
1627
+ if (level !== was.level) {
1628
+ set["w:outlineLvl"] = null;
1629
+ if (level) style = this.headingStyle(level);
1630
+ else if (styles.heading(style)) style = null;
1631
+ }
1632
+ if (!level && o.quote !== was.quote) style = o.quote ? this.quoteStyle() : null;
1633
+ if (pr) {
1634
+ if (!(was.list && was.list.num === pr.num && was.list.lvl === pr.lvl)) set["w:numPr"] = `<w:numPr><w:ilvl w:val="${pr.lvl}"/><w:numId w:val="${pr.num}"/></w:numPr>`;
1635
+ if (!was.list) {
1636
+ set["w:ind"] = null;
1637
+ if (!src) style = styles.find((name) => /^list paragraph$/i.test(name));
1638
+ }
1639
+ } else if (was.list || get("w:numPr")) {
1640
+ set["w:numPr"] = null;
1641
+ if (styles.numPr(style)) style = null;
1642
+ }
1643
+ if (style !== was.style) set["w:pStyle"] = style ? `<w:pStyle w:val="${escape(style)}"/>` : null;
1644
+ const jcEl = "w:jc" in set ? void 0 : get("w:jc");
1645
+ const direct = jcEl ? attr(xml, jcEl, "w:val") : null;
1646
+ const want = value("align", o.node.attrs?.align);
1647
+ if (align(direct ?? styles.jc(style)) !== want) {
1648
+ set["w:jc"] = align(styles.jc(style)) === want ? null : `<w:jc w:val="${{ center: "center", right: "right", justify: "both" }[want ?? ""] ?? "left"}"/>`;
1649
+ }
1650
+ if (!pr) {
1651
+ const indEl = "w:ind" in set ? void 0 : get("w:ind");
1652
+ const list = indEl ? attrs(xml.slice(indEl.start, indEl.open)).filter(([k]) => k !== "w:left" && k !== "w:start") : [];
1653
+ const left = indEl ? attr(xml, indEl, "w:left") ?? attr(xml, indEl, "w:start") : null;
1654
+ const target = o.cont !== null ? this.contLeft(o) : 720 * (Number(o.node.attrs?.indent ?? 0) || 0);
1655
+ const now = left !== null ? +left : styles.left(style);
1656
+ if (o.cont !== null ? now !== target : Math.max(0, Math.round(now / 720)) !== Math.round(target / 720)) {
1657
+ if (target !== styles.left(style)) list.unshift(["w:left", String(target)]);
1658
+ set["w:ind"] = list.length ? `<w:ind ${list.map(([k, v]) => `${k}="${escape(v)}"`).join(" ")}/>` : null;
1659
+ }
1660
+ }
1661
+ return Object.keys(set).length ? rebuild(xml, "w:pPr", P, set) : xml;
1662
+ }
1663
+ contLeft(o) {
1664
+ const g = this.groupNum.get(o.cont.group);
1665
+ const left = g ? this.pkg.nums.level(g.num, g.base + o.cont.depth)?.left : null;
1666
+ return left ?? 720 * (o.cont.depth + 1);
1667
+ }
1668
+ headingStyle(level) {
1669
+ const found = this.pkg.styles.headingId(level);
1670
+ if (found) return found;
1671
+ const id = this.pkg.styles.byId.has(`Heading${level}`) ? `Heading${level}W` : `Heading${level}`;
1672
+ if (!this.styleXml.some((x) => x.includes(`w:styleId="${id}"`))) {
1673
+ const base = this.pkg.styles.paragraph;
1674
+ const size2 = [32, 28, 26, 24, 22, 22][level - 1];
1675
+ this.styleXml.push(`<w:style w:type="paragraph" w:styleId="${id}"><w:name w:val="heading ${level}"/>${base ? `<w:basedOn w:val="${escape(base)}"/><w:next w:val="${escape(base)}"/>` : ""}<w:uiPriority w:val="9"/><w:qFormat/><w:pPr><w:keepNext/><w:keepLines/><w:spacing w:before="240" w:after="80"/><w:outlineLvl w:val="${level - 1}"/></w:pPr><w:rPr><w:b/><w:bCs/><w:sz w:val="${size2}"/><w:szCs w:val="${size2}"/></w:rPr></w:style>`);
1676
+ }
1677
+ return id;
1678
+ }
1679
+ quoteStyle() {
1680
+ const found = this.pkg.styles.find((name) => /^quote$/i.test(name)) ?? this.pkg.styles.find((name) => /quote/i.test(name));
1681
+ if (found) return found;
1682
+ const id = this.pkg.styles.byId.has("Quote") ? "QuoteW" : "Quote";
1683
+ if (!this.styleXml.some((x) => x.includes(`w:styleId="${id}"`))) {
1684
+ const base = this.pkg.styles.paragraph;
1685
+ this.styleXml.push(`<w:style w:type="paragraph" w:styleId="${id}"><w:name w:val="Quote"/>${base ? `<w:basedOn w:val="${escape(base)}"/><w:next w:val="${escape(base)}"/>` : ""}<w:uiPriority w:val="29"/><w:qFormat/><w:pPr><w:spacing w:before="200" w:after="160"/><w:ind w:left="864" w:right="864"/></w:pPr><w:rPr><w:i/><w:iCs/><w:color w:val="404040"/></w:rPr></w:style>`);
1686
+ }
1687
+ return id;
1688
+ }
1689
+ markRun(b) {
1690
+ const pPr = kid(b.el, "w:pPr");
1691
+ const rPr = pPr && kid(pPr, "w:rPr");
1692
+ if (!rPr) return { run: { open: "<w:r>", rPr: "", fmt: plain, el: null, parent: null }, fmt: plain };
1693
+ const xml = rebuild(this.s.slice(rPr.start, rPr.end), "w:rPr", R, { "w:ins": null, "w:del": null, "w:moveFrom": null, "w:moveTo": null, "w:rPrChange": null });
1694
+ const fmt = this.r.fmt(rPr);
1695
+ return { run: { open: "<w:r>", rPr: xml, fmt, el: null, parent: null }, fmt };
1696
+ }
1697
+ inline(o, b, src, near) {
1698
+ const units = [];
1699
+ const counts = /* @__PURE__ */ new Map();
1700
+ for (const p of b ? b.pieces : []) {
1701
+ let n = p.run ? counts.get(p.run) ?? 0 : 0;
1702
+ const fmt = fmtAt(p);
1703
+ const base = p.span ? fmtAt({ ...p, span: null }) : fmt;
1704
+ if (p.img) units.push({ ch: "\uFFFC", raw: p.raw, run: p.run, ctx: p.ctx, span: null, idx: n++, fmt, base, img: p.img });
1705
+ else if (p.text === null) units.push({ ch: null, raw: p.raw, run: p.run, ctx: p.ctx, span: null, idx: n++, fmt, base, box: p.box });
1706
+ else if (p.raw !== null) units.push({ ch: p.text, raw: p.raw, run: p.run, ctx: p.ctx, span: p.span, idx: n++, fmt, base });
1707
+ else for (const ch of p.text) units.push({ ch, raw: null, run: p.run, ctx: p.ctx, span: p.span, idx: n++, fmt, base });
1708
+ if (p.run) counts.set(p.run, n);
1709
+ }
1710
+ const A = units.filter((u) => u.ch !== null);
1711
+ const B = [];
1712
+ let lastFmt = plain;
1713
+ for (const n of o.node.content ?? []) {
1714
+ if (n.type === "text") {
1715
+ const f = fmtOf(n.marks);
1716
+ const k = keyOf(f);
1717
+ lastFmt = f;
1718
+ for (const ch of n.text ?? "") B.push({ ch: ch === "\r" ? "\n" : ch, fmt: f, key: k });
1719
+ } else if (n.type === "hardBreak") B.push({ ch: "\n", fmt: lastFmt, key: keyOf(lastFmt) });
1720
+ else if (n.type === "image") B.push({ ch: "\uFFFC", fmt: lastFmt, key: keyOf(lastFmt), img: n.attrs ?? {} });
1721
+ }
1722
+ const boxes = units.filter((u) => u.box);
1723
+ let box = null;
1724
+ if (o.task !== null && !boxes.some((u) => !u.run)) {
1725
+ const tpl = near((x) => x.task !== null) ?? [...this.r.refs.values()].find((x) => "kind" in x && x.task !== null) ?? null;
1726
+ const sdt = tpl?.pieces.find((p) => p.box && !p.run)?.raw;
1727
+ box = checked(sdt ?? '<w:sdt><w:sdtPr><w14:checkbox xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml"><w14:checked w14:val="0"/><w14:checkedState w14:val="2612" w14:font="MS Gothic"/><w14:uncheckedState w14:val="2610" w14:font="MS Gothic"/></w14:checkbox></w:sdtPr><w:sdtContent><w:r><w:rPr><w:rFonts w:ascii="MS Gothic" w:eastAsia="MS Gothic" w:hAnsi="MS Gothic" w:hint="eastAsia"/></w:rPr><w:t>\u2610</w:t></w:r></w:sdtContent></w:sdt>', o.task);
1728
+ B.unshift({ ch: " ", fmt: B[0]?.fmt ?? plain, key: B[0]?.key ?? keyOf(plain) });
1729
+ }
1730
+ const map = diff(A.map((u) => u.ch), B.map((x) => x.ch));
1731
+ const back = new Int32Array(A.length).fill(-1);
1732
+ map.forEach((i, j) => {
1733
+ if (i >= 0) back[i] = j;
1734
+ });
1735
+ const intact = /* @__PURE__ */ new Set();
1736
+ const spans = /* @__PURE__ */ new Map();
1737
+ A.forEach((u, i) => {
1738
+ if (u.span) spans.get(u.span)?.push(i) ?? spans.set(u.span, [i]);
1739
+ });
1740
+ for (const [sp, idx] of spans) {
1741
+ const j0 = back[idx[0]];
1742
+ if (idx.every((i, k) => back[i] === j0 + k && j0 >= 0 && B[back[i]].key === keyOf(A[i].fmt))) intact.add(sp);
1743
+ }
1744
+ const slot = new Int32Array(A.length + 1);
1745
+ for (let k = 1; k <= A.length; k++) slot[k] = back[k - 1] >= 0 ? back[k - 1] + 1 : slot[k - 1];
1746
+ const at = Array.from({ length: B.length + 1 }, () => []);
1747
+ let chars = 0;
1748
+ for (const u of units) {
1749
+ if (u.ch !== null) chars++;
1750
+ else if (!u.box || o.task !== null) at[slot[chars]].push(u);
1751
+ }
1752
+ const paraBase = b ? this.markRun(b) : this.firstRun(src);
1753
+ const out = [];
1754
+ if (box) out.push({ ch: null, raw: box, run: null, ctx: [], u: null, fmt: plain });
1755
+ this.wraps.clear();
1756
+ for (const u of units) for (const w of u.ctx) if (w.link && !this.wraps.has(w.link)) this.wraps.set(w.link, w);
1757
+ const lastChar = () => {
1758
+ for (let k = out.length - 1; k >= 0; k--) if (out[k].ch !== null) return out[k];
1759
+ return null;
1760
+ };
1761
+ const next = new Int32Array(B.length + 1).fill(-1);
1762
+ for (let k = B.length - 1; k >= 0; k--) next[k] = map[k] >= 0 ? map[k] : next[k + 1];
1763
+ for (let j = 0; j <= B.length; j++) {
1764
+ for (const u of at[j]) out.push({ ch: null, raw: u.box && !u.run && b && b.task !== o.task ? checked(u.raw, !!o.task) : u.raw, run: u.run, ctx: u.ctx, u, fmt: u.fmt });
1765
+ if (j === B.length) break;
1766
+ const i = map[j];
1767
+ const want = B[j];
1768
+ if (want.img) {
1769
+ const u = i >= 0 ? A[i] : null;
1770
+ if (u?.img) {
1771
+ const kept = picture2(u.img) === picture2(want.img);
1772
+ out.push({ ch: u.ch, raw: kept ? u.raw : this.patch(u.raw, u.img, want.img), run: u.run, ctx: u.ctx, u: kept ? u : null, fmt: u.fmt });
1773
+ } else out.push({ ch: want.ch, raw: this.drawing(want.img), run: { open: "<w:r>", rPr: "", fmt: plain, el: null, parent: null }, ctx: [], u: null, fmt: plain });
1774
+ continue;
1775
+ }
1776
+ if (i >= 0) {
1777
+ const u = A[i];
1778
+ if (u.span && intact.has(u.span)) {
1779
+ if (i === 0 || A[i - 1].span !== u.span) out.push({ ch: null, raw: null, run: null, ctx: u.ctx, u: null, fmt: u.fmt, xml: u.span.xml });
1780
+ continue;
1781
+ }
1782
+ const from = u.span ? u.base : u.fmt;
1783
+ const keep = u.ch === "\n" || keyOf(from) === want.key;
1784
+ const fmt = keep ? from : want.fmt;
1785
+ const run = keep && u.run ? u.run : this.derive(u.run ?? paraBase.run, from, want.fmt);
1786
+ out.push({ ch: u.ch, raw: u.raw, run, ctx: this.revised(this.linked(u.ctx, fmt.link, lastChar()), fmt.rev), u: keep && u.run ? u : null, fmt });
1787
+ } else {
1788
+ const left = lastChar();
1789
+ const right = next[j + 1] >= 0 ? A[next[j + 1]] : null;
1790
+ const base = left ? { run: left.run, fmt: left.fmt } : right ? { run: right.run ?? paraBase.run, fmt: right.span ? right.base : right.fmt } : paraBase;
1791
+ const run = keyOf(base.fmt) === want.key ? base.run : this.derive(base.run, base.fmt, want.fmt);
1792
+ const shared = [];
1793
+ if (left && right) {
1794
+ for (let k = 0; k < left.ctx.length && left.ctx[k] === right.ctx[k]; k++) if (!left.ctx[k].link) shared.push(left.ctx[k]);
1795
+ }
1796
+ out.push({ ch: want.ch, raw: null, run, ctx: this.revised(this.linked(shared, want.fmt.link, left), want.fmt.rev), u: null, fmt: want.fmt });
1797
+ }
1798
+ }
1799
+ let xml = "";
1800
+ let stack = [];
1801
+ let cur = null;
1802
+ const flush = () => {
1803
+ if (cur) xml += this.runXml(cur.run, cur.glyphs, counts);
1804
+ cur = null;
1805
+ };
1806
+ const sync = (ctx) => {
1807
+ let k = 0;
1808
+ while (k < stack.length && k < ctx.length && stack[k] === ctx[k]) k++;
1809
+ if (k === stack.length && k === ctx.length) return;
1810
+ flush();
1811
+ for (let x = stack.length - 1; x >= k; x--) xml += stack[x].close;
1812
+ for (let x = k; x < ctx.length; x++) xml += ctx[x].open;
1813
+ stack = ctx;
1814
+ };
1815
+ for (const g of out) {
1816
+ sync(g.ctx);
1817
+ if (g.xml || !g.run) {
1818
+ flush();
1819
+ xml += g.xml ?? g.raw ?? "";
1820
+ continue;
1821
+ }
1822
+ if (!cur || cur.run !== g.run) {
1823
+ flush();
1824
+ cur = { run: g.run, glyphs: [] };
1825
+ }
1826
+ cur.glyphs.push(g);
1827
+ }
1828
+ flush();
1829
+ sync([]);
1830
+ return xml;
1831
+ }
1832
+ firstRun(src) {
1833
+ const p = src?.pieces.find((x) => x.text !== null && x.run && !x.span);
1834
+ if (p) return { run: { ...p.run, open: "<w:r>", el: null }, fmt: p.run.fmt };
1835
+ return src ? this.markRun(src) : { run: { open: "<w:r>", rPr: "", fmt: plain, el: null, parent: null }, fmt: plain };
1836
+ }
1837
+ linked(ctx, link, left) {
1838
+ let cur = null;
1839
+ for (const w of ctx) if (w.link) cur = w.link;
1840
+ if (cur === link) return ctx;
1841
+ const out = ctx.filter((w) => !w.link);
1842
+ if (!link) return out;
1843
+ let wrap = left?.ctx.find((w) => w.link === link) ?? this.wraps.get(link);
1844
+ if (!wrap) {
1845
+ const tag = link.startsWith("#") ? `<w:hyperlink w:anchor="${escape(link.slice(1))}" w:history="1">` : `<w:hyperlink r:id="${this.link(link)}" w:history="1">`;
1846
+ wrap = { open: tag, close: "</w:hyperlink>", link, ins: false };
1847
+ this.wraps.set(link, wrap);
1848
+ }
1849
+ const at = out.findIndex((w) => w.ins);
1850
+ return at === -1 ? [...out, wrap] : [...out.slice(0, at), wrap, ...out.slice(at)];
1851
+ }
1852
+ revised(ctx, rev) {
1853
+ const out = ctx.filter((w) => !w.rev || w.rev === rev);
1854
+ if (!rev || out.some((w) => w.rev === rev)) return out;
1855
+ let wrap = this.revs.get(rev);
1856
+ if (!wrap) {
1857
+ const [kind, , author, date] = JSON.parse(rev);
1858
+ const tag = kind === "ins" ? "w:ins" : "w:del";
1859
+ wrap = { open: `<${tag} w:id="${this.nextRev++}" w:author="${escape(author || "Documents")}" w:date="${escape(date || (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d+Z$/, "Z"))}">`, close: `</${tag}>`, link: null, ins: true, rev };
1860
+ this.revs.set(rev, wrap);
1861
+ }
1862
+ return [...out, wrap];
1863
+ }
1864
+ link(href) {
1865
+ for (const r of this.pkg.rels.values()) if (r.external && r.target === href && r.type.endsWith("/hyperlink")) return r.id;
1866
+ if (!this.links.has(href)) {
1867
+ const id = this.relId();
1868
+ this.rels.push(`<Relationship Id="${id}" Type="${REL}/hyperlink" Target="${escape(href)}" TargetMode="External"/>`);
1869
+ this.links.set(href, id);
1870
+ }
1871
+ return this.links.get(href);
1872
+ }
1873
+ relId() {
1874
+ let n = this.relIds.size + 1;
1875
+ while (this.relIds.has(`rId${n}`)) n++;
1876
+ this.relIds.add(`rId${n}`);
1877
+ return `rId${n}`;
1878
+ }
1879
+ derive(run, from, to) {
1880
+ const cache = run.derived ?? (run.derived = /* @__PURE__ */ new Map());
1881
+ const key = keyOf(from) + ">" + keyOf(to);
1882
+ if (!cache.has(key)) cache.set(key, { open: run.open, rPr: this.delta(run.rPr, from, to), fmt: to, el: null, parent: null });
1883
+ return cache.get(key);
1884
+ }
1885
+ delta(rPr, from, to) {
1886
+ const root = rPr ? parse(rPr).kids[0] : void 0;
1887
+ const get = (name) => root && kid(root, name);
1888
+ const styleEl = get("w:rStyle");
1889
+ const style = styleEl ? attr(rPr, styleEl, "w:val") : null;
1890
+ const sf = style ? this.pkg.styles.char(style) : {};
1891
+ const set = {};
1892
+ const toggle = (on2, was, name, cs, given) => {
1893
+ if (on2 === was) return;
1894
+ set[name] = on2 ? `<${name}/>` : given ? `<${name} w:val="0"/>` : null;
1895
+ if (!on2) set[cs] = null;
1896
+ };
1897
+ toggle(to.b, from.b, "w:b", "w:bCs", sf.b);
1898
+ toggle(to.i, from.i, "w:i", "w:iCs", sf.i);
1899
+ if (to.u !== from.u) set["w:u"] = to.u ? '<w:u w:val="single"/>' : sf.u ? '<w:u w:val="none"/>' : null;
1900
+ if (to.s !== from.s) {
1901
+ set["w:strike"] = to.s ? "<w:strike/>" : sf.s ? '<w:strike w:val="0"/>' : null;
1902
+ if (!to.s) set["w:dstrike"] = null;
1903
+ }
1904
+ if (to.color !== from.color) set["w:color"] = to.color ? `<w:color w:val="${to.color.slice(1).toUpperCase()}"/>` : sf.color ? '<w:color w:val="auto"/>' : null;
1905
+ if (to.size !== from.size) {
1906
+ const hp = to.size ? Math.round(parseFloat(to.size) * 2) : 0;
1907
+ set["w:sz"] = hp ? `<w:sz w:val="${hp}"/>` : null;
1908
+ set["w:szCs"] = hp ? `<w:szCs w:val="${hp}"/>` : null;
1909
+ }
1910
+ if (to.hl !== from.hl) {
1911
+ const name = to.hl ? Object.keys(highlights).find((k) => "#" + highlights[k] === to.hl) : void 0;
1912
+ set["w:highlight"] = name ? `<w:highlight w:val="${name}"/>` : null;
1913
+ const shd = get("w:shd");
1914
+ if (to.hl && !name) set["w:shd"] = `<w:shd w:val="clear" w:color="auto" w:fill="${to.hl.slice(1).toUpperCase()}"/>`;
1915
+ else if (shd && color(attr(rPr, shd, "w:fill"))) set["w:shd"] = null;
1916
+ }
1917
+ if (to.font !== from.font || to.code !== from.code) {
1918
+ const want = to.code ? "Courier New" : to.font;
1919
+ const fonts = get("w:rFonts");
1920
+ const kept = fonts ? attrs(rPr.slice(fonts.start, fonts.open)).filter(([k]) => !/^w:(ascii|hAnsi|cs|asciiTheme|hAnsiTheme|cstheme)$/.test(k)) : [];
1921
+ if (want) kept.unshift(["w:ascii", want], ["w:hAnsi", want], ["w:cs", want]);
1922
+ set["w:rFonts"] = kept.length ? `<w:rFonts ${kept.map(([k, v]) => `${k}="${escape(v)}"`).join(" ")}/>` : null;
1923
+ }
1924
+ if (to.link && !from.link && !style) {
1925
+ const id = this.pkg.styles.find((name, id2) => /^hyperlink$/i.test(name) || id2 === "Hyperlink", "character");
1926
+ if (id) set["w:rStyle"] = `<w:rStyle w:val="${escape(id)}"/>`;
1927
+ } else if (!to.link && from.link && this.pkg.styles.isLink(style)) set["w:rStyle"] = null;
1928
+ return Object.keys(set).length ? rebuild(rPr, "w:rPr", R, set) : rPr;
1929
+ }
1930
+ runXml(run, glyphs, counts) {
1931
+ if (run.el && glyphs.length === counts.get(run) && glyphs.every((g, n) => g.u && g.u.run === run && g.u.idx === n)) return this.s.slice(run.el.start, run.el.end);
1932
+ let body = "";
1933
+ let text = "";
1934
+ const tag = glyphs[0]?.ctx.some((w) => w.rev?.startsWith('["del"')) ? "w:delText" : "w:t";
1935
+ const flush = () => {
1936
+ if (text) body += `<${tag}${/^\s|\s$/.test(text) ? ' xml:space="preserve"' : ""}>${escape(text)}</${tag}>`;
1937
+ text = "";
1938
+ };
1939
+ for (const g of glyphs) {
1940
+ if (g.ch === null || g.raw !== null || special[g.ch]) {
1941
+ flush();
1942
+ body += g.raw ?? special[g.ch];
1943
+ } else text += g.ch;
1944
+ }
1945
+ flush();
1946
+ return run.open + run.rPr + body + "</w:r>";
1947
+ }
1948
+ embed(src) {
1949
+ if (!this.srcs) {
1950
+ this.srcs = /* @__PURE__ */ new Map();
1951
+ for (const b of this.r.refs.values()) if ("pieces" in b) {
1952
+ for (const p of b.pieces) if (p.img && p.pic) this.srcs.set(String(p.img.src), p.pic.embed);
1953
+ }
1954
+ }
1955
+ const id = this.srcs.get(src);
1956
+ if (id) return { id, size: null };
1957
+ const added = this.addMedia(src);
1958
+ if (!added) throw new Error("Image could not be read");
1959
+ this.srcs.set(src, added.id);
1960
+ return added;
1961
+ }
1962
+ drawing(img) {
1963
+ const media = this.embed(String(img.src ?? ""));
1964
+ const max = Math.round(this.textWidth() / 15);
1965
+ let w = Math.round(Number(img.width)) || 0;
1966
+ let h = Math.round(Number(img.height)) || 0;
1967
+ const [nw, nh] = media.size ?? [w || 300, h || 200];
1968
+ if (!w && !h) [w, h] = nw > max ? [max, Math.round(nh * max / nw)] : [nw, nh];
1969
+ else if (!h) h = Math.round(w * nh / nw);
1970
+ else if (!w) w = Math.round(h * nw / nh);
1971
+ const id = this.docPr++;
1972
+ const ext = `cx="${Math.round(w * 9525)}" cy="${Math.round(h * 9525)}"`;
1973
+ return `<w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"><wp:extent ${ext}/><wp:effectExtent l="0" t="0" r="0" b="0"/>${meta(`<wp:docPr id="${id}" name="Picture ${id}"/>`, img)}<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr><a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:nvPicPr><pic:cNvPr id="${id}" name="Picture ${id}"/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${media.id}"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext ${ext}/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing>`;
1974
+ }
1975
+ patch(raw, old, img) {
1976
+ let xml = raw;
1977
+ const w = Math.round(Number(img.width)) || Number(old.width);
1978
+ const h = Math.round(Number(img.height)) || Number(old.height);
1979
+ if (w !== old.width || h !== old.height) {
1980
+ const ext = `cx="${Math.round(w * 9525)}" cy="${Math.round(h * 9525)}"`;
1981
+ xml = xml.replace(/<wp:extent\b[^>]*\/>/, `<wp:extent ${ext}/>`).replace(/(<a:xfrm\b[^>]*>[\s\S]*?<a:ext)\b[^>]*\/>/, `$1 ${ext}/>`);
1982
+ }
1983
+ if ((img.alt || null) !== (old.alt || null) || (img.title || null) !== (old.title || null)) xml = xml.replace(/<wp:docPr\b[^>]*>/, (tag) => meta(tag, img));
1984
+ if (img.src !== old.src) xml = xml.replace(/(<a:blip\b[^>]*\br:embed=")[^"]*"/, `$1${this.embed(String(img.src ?? "")).id}"`);
1985
+ return xml;
1986
+ }
1987
+ textWidth() {
1988
+ const sect = this.body.sect;
1989
+ const s = this.s;
1990
+ const sz = sect && kid(sect, "w:pgSz");
1991
+ const mar = sect && kid(sect, "w:pgMar");
1992
+ return (sz ? +(attr(s, sz, "w:w") ?? 12240) : 12240) - (mar ? +(attr(s, mar, "w:left") ?? 1440) + +(attr(s, mar, "w:right") ?? 1440) : 2880);
1993
+ }
1994
+ addMedia(src) {
1995
+ const m = /^data:([^;,]+)(;base64)?,(.*)$/s.exec(src);
1996
+ let img = this.images.get(src);
1997
+ if (m) {
1998
+ const raw = m[2] ? atob(m[3]) : decodeURIComponent(m[3]);
1999
+ const bytes = new Uint8Array(raw.length);
2000
+ for (let i = 0; i < raw.length; i++) bytes[i] = raw.charCodeAt(i);
2001
+ img = { bytes, mime: m[1] };
2002
+ }
2003
+ if (!img) return null;
2004
+ const ext = { "image/jpeg": "jpeg", "image/svg+xml": "svg" }[img.mime] ?? img.mime.split("/")[1] ?? "png";
2005
+ let n = this.media.length + 1;
2006
+ while (this.pkg.files.has(`word/media/w100n-${n}.${ext}`)) n++;
2007
+ const name = `w100n-${n}.${ext}`;
2008
+ const dir = this.pkg.main.slice(0, this.pkg.main.lastIndexOf("/") + 1);
2009
+ this.media.push({ name: `${dir}media/${name}`, bytes: img.bytes });
2010
+ const id = this.relId();
2011
+ this.rels.push(`<Relationship Id="${id}" Type="${REL}/image" Target="media/${name}"/>`);
2012
+ return { id, name, size: dims(img.bytes) };
2013
+ }
2014
+ code(o) {
2015
+ const style = this.pkg.styles.find((name) => /^(source code|html preformatted|code|plain text)$/i.test(name));
2016
+ const text = (o.node.content ?? []).map((n) => n.text ?? "").join("");
2017
+ const pPr = style ? `<w:pPr><w:pStyle w:val="${escape(style)}"/></w:pPr>` : '<w:pPr><w:spacing w:after="0"/></w:pPr>';
2018
+ const rPr = style ? "" : '<w:rPr><w:rFonts w:ascii="Courier New" w:hAnsi="Courier New" w:cs="Courier New"/></w:rPr>';
2019
+ return text.split("\n").map((line) => `<w:p>${pPr}${line ? `<w:r>${rPr}<w:t xml:space="preserve">${escape(line).replace(/\t/g, '</w:t><w:tab/><w:t xml:space="preserve">')}</w:t></w:r>` : ""}</w:p>`).join("");
2020
+ }
2021
+ table(o, b, near) {
2022
+ const s = this.s;
2023
+ if (b && sig(o.node) === sig(b.node)) return s.slice(b.start, b.end);
2024
+ const rows = o.node.content ?? [];
2025
+ const layout = grid(rows);
2026
+ const cols = Math.max(1, ...layout.map((r) => r.reduce((m, sl) => Math.max(m, sl.col + sl.span), 0)));
2027
+ let head;
2028
+ let tail = "";
2029
+ if (b) {
2030
+ const first = b.rows[0];
2031
+ const last = b.rows[b.rows.length - 1];
2032
+ head = opened(s, b.el) + s.slice(b.el.open, first ? first.el.start - first.lead.length : b.el.close);
2033
+ if (last) tail = s.slice(last.el.end, b.el.close);
2034
+ if (b.cols && cols !== b.cols) {
2035
+ head = head.replace(/(<w:tblGrid\b[^>]*>)([\s\S]*?)(<\/w:tblGrid>)/, (_, open, inside, close) => {
2036
+ const list = [...inside.match(/<w:gridCol\b[^>]*\/>/g) ?? []];
2037
+ while (list.length < cols) list.push(list[list.length - 1] ?? "<w:gridCol/>");
2038
+ return open + list.slice(0, cols).join("") + close;
2039
+ });
2040
+ }
2041
+ } else {
2042
+ const tpl = near((x) => x.kind === "tbl");
2043
+ const pr = tpl && kid(tpl.el, "w:tblPr");
2044
+ const style = this.pkg.styles.find((name) => /^(table grid|сітка таблиці|сетка таблицы)$/i.test(name), "table");
2045
+ const line = (side) => `<w:${side} w:val="single" w:sz="4" w:space="0" w:color="auto"/>`;
2046
+ const tblPr = pr ? s.slice(pr.start, pr.end) : `<w:tblPr>${style ? `<w:tblStyle w:val="${escape(style)}"/>` : ""}<w:tblW w:w="0" w:type="auto"/>${style ? "" : `<w:tblBorders>${["top", "left", "bottom", "right", "insideH", "insideV"].map(line).join("")}</w:tblBorders>`}<w:tblLook w:val="04A0" w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/></w:tblPr>`;
2047
+ head = `<w:tbl>${tblPr}<w:tblGrid>${`<w:gridCol w:w="${Math.floor(this.textWidth() / cols)}"/>`.repeat(cols)}</w:tblGrid>`;
2048
+ }
2049
+ const width = Math.floor(this.textWidth() / cols);
2050
+ let xml = head;
2051
+ let above = [];
2052
+ let aboveRow = null;
2053
+ const cover = /* @__PURE__ */ new Map();
2054
+ const firstRow = rows.map((r) => this.claimed.get(r)).find(Boolean) ?? null;
2055
+ rows.forEach((node, r) => {
2056
+ const R2 = this.claimed.get(node) ?? null;
2057
+ const slots = layout[r];
2058
+ const shape2 = (sl) => sl.cell ? `${this.claimed.get(sl.cell)?.ref ?? "-"}@${sl.col}` : `c${sl.col}`;
2059
+ const now = [];
2060
+ if (R2 && sig(node) === sig(R2.node) && R2.cells.map((c) => c.vm === "continue" ? `c${c.col}` : `${c.ref}@${c.col}`).join() === slots.map(shape2).join()) {
2061
+ xml += R2.lead + s.slice(R2.el.start, R2.el.end);
2062
+ for (const c of R2.cells) for (let k = c.col; k < c.col + c.span; k++) now[k] = c;
2063
+ for (const sl of slots) if (sl.cell && Number(sl.cell.attrs?.rowspan ?? 1) > 1) cover.set(sl.cell, this.claimed.get(sl.cell) ?? null);
2064
+ above = now;
2065
+ aboveRow = R2;
2066
+ return;
2067
+ }
2068
+ const srcRow = R2 ?? aboveRow ?? firstRow;
2069
+ const header = (node.content ?? []).length > 0 && (node.content ?? []).every((c) => c.type === "tableHeader");
2070
+ let rowHead = R2 ? R2.head : srcRow ? srcRow.head.replace(/<w:(ins|del)\b[^>]*\/>|<w:trPrChange\b[\s\S]*?<\/w:trPrChange>/g, "") : "";
2071
+ if (!R2) {
2072
+ if (!header) rowHead = rowHead.replace(/<w:tblHeader\b[^>]*\/>/g, "").replace(/<w:trPr><\/w:trPr>|<w:trPr\/>/, "");
2073
+ else if (!/<w:tblHeader\b/.test(rowHead)) rowHead = /<w:trPr>/.test(rowHead) ? rowHead.replace("<w:trPr>", "<w:trPr><w:tblHeader/>") : rowHead + "<w:trPr><w:tblHeader/></w:trPr>";
2074
+ }
2075
+ xml += (R2 ? R2.lead + opened(s, R2.el) : "<w:tr>") + rowHead;
2076
+ for (const sl of slots) {
2077
+ if (!sl.cell) {
2078
+ const cont = R2?.cells.find((c) => c.vm === "continue" && c.col === sl.col);
2079
+ if (cont) xml += cont.lead + s.slice(cont.el.start, cont.el.end);
2080
+ else xml += `<w:tc>${this.tcPr(cover.get(sl.from) ?? above[sl.col] ?? null, sl.span, "continue", width)}<w:p/></w:tc>`;
2081
+ now[sl.col] = cover.get(sl.from) ?? null;
2082
+ continue;
2083
+ }
2084
+ const C = this.claimed.get(sl.cell) ?? null;
2085
+ const vm = Number(sl.cell.attrs?.rowspan ?? 1) > 1 ? "restart" : null;
2086
+ const srcCell = C ?? above[sl.col] ?? (srcRow?.cells.find((c) => c.col === sl.col) ?? null);
2087
+ if (vm) cover.set(sl.cell, srcCell);
2088
+ for (let k = sl.col; k < sl.col + sl.span; k++) now[k] = srcCell;
2089
+ if (C && sig(sl.cell) === sig(C.node) && C.span === sl.span && C.vm === vm) {
2090
+ xml += C.lead + s.slice(C.el.start, C.el.end);
2091
+ continue;
2092
+ }
2093
+ const fallback = srcCell?.blocks.find((x) => x.kind === "p") ?? null;
2094
+ let inside = this.container(flatten(sl.cell.content ?? []), C ? C.blocks : [], fallback) + (C ? this.left.get(C) ?? "" : "");
2095
+ if (!this.last || this.last === "tbl") inside += "<w:p/>";
2096
+ xml += (C ? C.lead + opened(s, C.el) : "<w:tc>") + this.tcPr(srcCell, sl.span, vm, width, !C) + inside + (C ? C.tail : "") + "</w:tc>";
2097
+ }
2098
+ const lastCell = R2?.cells[R2.cells.length - 1];
2099
+ xml += (R2 && lastCell ? s.slice(lastCell.el.end, R2.el.close) : "") + "</w:tr>";
2100
+ above = now;
2101
+ aboveRow = srcRow;
2102
+ });
2103
+ return xml + tail + "</w:tbl>";
2104
+ }
2105
+ tcPr(src, span, vm, width, clone = true) {
2106
+ const s = this.s;
2107
+ const el = src && kid(src.el, "w:tcPr");
2108
+ const xml = el ? s.slice(el.start, el.end) : "";
2109
+ if (!clone && src && src.span === span && src.vm === vm) return xml;
2110
+ const set = { "w:gridSpan": span > 1 ? `<w:gridSpan w:val="${span}"/>` : null, "w:vMerge": vm === "restart" ? '<w:vMerge w:val="restart"/>' : vm ? "<w:vMerge/>" : null, "w:hMerge": null };
2111
+ if (clone) Object.assign(set, { "w:cellIns": null, "w:cellDel": null, "w:cellMerge": null, "w:tcPrChange": null });
2112
+ const tcW = el && kid(el, "w:tcW");
2113
+ if (!tcW && !src) set["w:tcW"] = `<w:tcW w:w="${width * span}" w:type="dxa"/>`;
2114
+ else if (tcW && src && src.span !== span && attr(xml, tcW, "w:type") === "dxa") set["w:tcW"] = `<w:tcW w:w="${Math.round(+(attr(xml, tcW, "w:w") ?? 0) * span / src.span)}" w:type="dxa"/>`;
2115
+ return rebuild(xml, "w:tcPr", TC, set);
2116
+ }
2117
+ };
2118
+ async function fetched(src) {
2119
+ const res = await fetch(src);
2120
+ if (!res.ok) throw new Error(`Image could not be read: ${src}`);
2121
+ return { bytes: new Uint8Array(await res.arrayBuffer()), mime: res.headers.get("content-type")?.split(";")[0] || "image/png" };
2122
+ }
2123
+ async function images(doc, load) {
2124
+ const out = /* @__PURE__ */ new Map();
2125
+ const walk = async (n) => {
2126
+ if (n.type === "image" && typeof n.attrs?.src === "string" && !out.has(n.attrs.src)) {
2127
+ const src = n.attrs.src;
2128
+ if (src && !src.startsWith("data:")) out.set(src, await load(src));
2129
+ }
2130
+ for (const k of n.content ?? []) await walk(k);
2131
+ };
2132
+ await walk(doc);
2133
+ return out;
2134
+ }
2135
+
2136
+ // src/docx/index.ts
2137
+ async function readDocx(bytes) {
2138
+ const pkg = new Pkg(new Uint8Array(bytes));
2139
+ const { list, sect } = new Reader(pkg).body();
2140
+ const content = assemble(list);
2141
+ const s = pkg.doc;
2142
+ const size2 = sect && kid(sect, "w:pgSz");
2143
+ const mar = sect && kid(sect, "w:pgMar");
2144
+ const px = (el, name, fallback) => Math.round(Math.abs(+((el && attr(s, el, name)) ?? fallback)) / 15 * 100) / 100;
2145
+ return {
2146
+ doc: { type: "doc", content: content.length ? content : [{ type: "paragraph", attrs: { align: null, indent: 0, ref: null } }] },
2147
+ styles: pkg.styles.list(),
2148
+ page: { width: px(size2, "w:w", 12240), height: px(size2, "w:h", 15840), margins: [px(mar, "w:top", 1440), px(mar, "w:right", 1440), px(mar, "w:bottom", 1440), px(mar, "w:left", 1440)] }
2149
+ };
2150
+ }
2151
+ async function writeDocx(original, doc, load = fetched) {
2152
+ const pkg = new Pkg(new Uint8Array(original));
2153
+ const out = new Writer(pkg, await images(doc, load)).run(doc);
2154
+ return out ? out.slice().buffer : original.slice(0);
2155
+ }
2156
+
2157
+ // src/text.ts
2158
+ var en = {
2159
+ documents: "Documents",
2160
+ loose: "Without a folder",
2161
+ search: "Search documents",
2162
+ all: "All",
2163
+ empty: "No documents here yet",
2164
+ nothing: "Nothing matches the search",
2165
+ pick: "Choose a document from the list",
2166
+ closeList: "Hide the list",
2167
+ openList: "Show the list",
2168
+ outline: "Outline",
2169
+ versions: "Versions",
2170
+ details: "Details",
2171
+ noOutline: "This document has no headings",
2172
+ current: "Current",
2173
+ size: "Size",
2174
+ updated: "Updated",
2175
+ by: "Updated by",
2176
+ kind: "Format",
2177
+ rights: "You can",
2178
+ view: "View",
2179
+ comment: "Comment",
2180
+ edit: "Edit",
2181
+ failed: "Could not load",
2182
+ retry: "Try again",
2183
+ loading: "Loading",
2184
+ unsupported: "This file cannot be shown yet",
2185
+ restore: "Restore this version",
2186
+ restoreFailed: "Could not restore",
2187
+ allProjects: "All projects",
2188
+ closePanel: "Hide the panel",
2189
+ openPanel: "Show the panel",
2190
+ zoomIn: "Zoom in",
2191
+ zoomOut: "Zoom out",
2192
+ fit: "Actual size",
2193
+ pdfTools: "PDF tools",
2194
+ pages: "Pages",
2195
+ page: "Page",
2196
+ fitWidth: "Fit to width",
2197
+ fitPage: "Fit to page",
2198
+ find: "Find in the document",
2199
+ previous: "Previous",
2200
+ next: "Next",
2201
+ close: "Close",
2202
+ searching: "Searching",
2203
+ noHits: "No results",
2204
+ selectText: "Select text",
2205
+ highlight: "Highlight",
2206
+ underline: "Underline",
2207
+ strike: "Strike out",
2208
+ note: "Note",
2209
+ draw: "Draw",
2210
+ eraser: "Eraser",
2211
+ sign: "Sign",
2212
+ colour: "Colour",
2213
+ lineWidth: "Line width",
2214
+ undo: "Undo",
2215
+ redo: "Redo",
2216
+ save: "Save",
2217
+ saving: "Saving",
2218
+ saved: "Saved",
2219
+ saveFailed: "Could not save",
2220
+ remove: "Remove",
2221
+ notePlaceholder: "Write a note",
2222
+ signature: "Signature",
2223
+ placeHint: "Click or tap where the signature goes",
2224
+ cancel: "Cancel",
2225
+ signTitle: "Add a signature",
2226
+ typed: "Type",
2227
+ drawn: "Draw",
2228
+ image: "Image",
2229
+ yourName: "Your name",
2230
+ drawHere: "Sign with the mouse or a finger",
2231
+ clear: "Clear",
2232
+ pickImage: "Choose a PNG or JPEG image",
2233
+ useSign: "Place the signature",
2234
+ marksNote: "Marks",
2235
+ formNote: "Form filled",
2236
+ signedNote: "Signed",
2237
+ signatures: "Signatures",
2238
+ noSignatures: "Nobody has signed this file yet",
2239
+ version: "Version",
2240
+ download: "Download",
2241
+ openInDocuments: "Open in Documents",
2242
+ textTools: "Text tools",
2243
+ home: "Home",
2244
+ insert: "Insert",
2245
+ layout: "Layout",
2246
+ review: "Review",
2247
+ viewTab: "View",
2248
+ paragraphStyle: "Paragraph style",
2249
+ normal: "Normal",
2250
+ heading: "Heading",
2251
+ quote: "Quote",
2252
+ code: "Code",
2253
+ bold: "Bold",
2254
+ italic: "Italic",
2255
+ textColour: "Text colour",
2256
+ automatic: "Automatic",
2257
+ noColour: "No colour",
2258
+ bullets: "Bulleted list",
2259
+ numbers: "Numbered list",
2260
+ tasks: "Task list",
2261
+ alignLeft: "Align left",
2262
+ alignCenter: "Centre",
2263
+ alignRight: "Align right",
2264
+ justify: "Justify",
2265
+ indent: "Increase indent",
2266
+ outdent: "Decrease indent",
2267
+ clearFormat: "Clear formatting",
2268
+ table: "Table",
2269
+ rowAbove: "Row above",
2270
+ rowBelow: "Row below",
2271
+ columnLeft: "Column on the left",
2272
+ columnRight: "Column on the right",
2273
+ deleteRow: "Delete row",
2274
+ deleteColumn: "Delete column",
2275
+ deleteTable: "Delete table",
2276
+ headerRow: "Header row",
2277
+ mergeCells: "Merge or split cells",
2278
+ imageLink: "Image address",
2279
+ chooseFile: "Choose a file",
2280
+ put: "Insert",
2281
+ link: "Link",
2282
+ linkAddress: "Link address",
2283
+ apply: "Apply",
2284
+ unlink: "Remove link",
2285
+ pageBreak: "Page break",
2286
+ rule: "Horizontal line",
2287
+ pageSize: "Page size",
2288
+ margins: "Margins",
2289
+ marginsNormal: "Normal",
2290
+ marginsNarrow: "Narrow",
2291
+ marginsWide: "Wide",
2292
+ addComment: "Add comment",
2293
+ comments: "Comments",
2294
+ noComments: "No comments yet",
2295
+ commentHint: "Select text and add a comment",
2296
+ writeComment: "Write a comment",
2297
+ post: "Post",
2298
+ reply: "Reply",
2299
+ resolve: "Resolve",
2300
+ reopen: "Reopen",
2301
+ resolved: "Resolved",
2302
+ showResolved: "Show resolved",
2303
+ commentFailed: "Could not send the comment",
2304
+ exportAs: "Export",
2305
+ exportFailed: "Could not export",
2306
+ editedNote: "Text edited",
2307
+ documentText: "Document text",
2308
+ locked: "Kept as in the file",
2309
+ references: "References",
2310
+ toc: "Table of contents",
2311
+ tocInsert: "Insert table of contents",
2312
+ tocGo: "Go to the table",
2313
+ tocRemove: "Remove the table",
2314
+ tocHint: "It follows the headings as you write",
2315
+ tocEmpty: "Add headings and they show here",
2316
+ suggest: "Suggest changes",
2317
+ suggesting: "Suggesting",
2318
+ suggestions: "Suggestions",
2319
+ acceptAll: "Accept all",
2320
+ rejectAll: "Reject all",
2321
+ accept: "Accept",
2322
+ reject: "Reject",
2323
+ added: "Added",
2324
+ removed: "Deleted",
2325
+ someone: "Someone",
2326
+ copyAs: "Make an XLSX copy",
2327
+ copyFailed: "Could not make the copy",
2328
+ editComment: "Edit",
2329
+ delete: "Delete",
2330
+ deleteAsk: "Delete this comment?",
2331
+ deleteThread: "Delete this comment and its replies?",
2332
+ changeFailed: "Could not change the comment",
2333
+ unsavedTitle: "Save your changes?",
2334
+ unsavedHint: "This document has changes that are not saved yet.",
2335
+ discard: "Discard",
2336
+ more: "More tools",
2337
+ offline: "Offline",
2338
+ offlineHint: "Your changes stay here and sync when the connection is back",
2339
+ liveOff: "Live editing is unavailable",
2340
+ people: "People in this document",
2341
+ you: "you",
2342
+ share: "Share",
2343
+ sharing: "Sharing",
2344
+ guestLinks: "Guest links",
2345
+ viewLink: "View link",
2346
+ commentLink: "Comment link",
2347
+ madeBy: "Made by {name}",
2348
+ endsOn: "Ends {date}",
2349
+ untilOff: "Until turned off",
2350
+ linkEnded: "Ended",
2351
+ downloadOn: "Download on",
2352
+ passwordOn: "Password",
2353
+ copy: "Copy",
2354
+ copied: "Copied",
2355
+ changeLink: "Change",
2356
+ turnOff: "Turn off",
2357
+ newLink: "New guest link",
2358
+ guestsCan: "Guests can",
2359
+ canRead: "Read",
2360
+ canComment: "Read and comment",
2361
+ badgeRead: "Read only",
2362
+ badgeComment: "Read and comment",
2363
+ linkWorks: "Link works",
2364
+ days7: "7 days",
2365
+ days30: "30 days",
2366
+ untilTurnOff: "Until I turn it off",
2367
+ pickDay: "Pick a day",
2368
+ passwordHint: "Guests type it once on their device",
2369
+ passwordPlaceholder: "Type the password",
2370
+ keepPassword: "Leave empty to keep the password",
2371
+ downloadFile: "Download the file",
2372
+ downloadHint: "The original file and a PDF copy",
2373
+ askName: "Ask the guest's name",
2374
+ askNameHint: "Shown to you in who opened it",
2375
+ lastSaved: "Guests see the last saved version. A new version reaches the link when someone saves.",
2376
+ makeLink: "Make the link",
2377
+ saveLink: "Save the link",
2378
+ inTeam: "Inside the team",
2379
+ peopleOf: "People of {space}",
2380
+ teamHint: "Everyone who sees Drive of this project reads it, people with edit rights change it.",
2381
+ noLinks: "No guest links yet. A link opens this document without an account.",
2382
+ unnamed: "Guests without a name",
2383
+ shareFailed: "The link did not save. Try again.",
2384
+ sharedBy: "Shared by {name}",
2385
+ openDoc: "Open",
2386
+ passwordAsk: "This document opens with a password. Type it to open the document on this device.",
2387
+ wrongPassword: "The password does not fit. Try again.",
2388
+ endedTitle: "This link has ended",
2389
+ endedText: "The person who shared this document turned the link off or it reached its last day. Ask them for a new link.",
2390
+ missingTitle: "This link opens nothing",
2391
+ missingText: "Check the address or ask for a new link.",
2392
+ nameAsk: "Type your name to read this document. The person who shared it sees who opened it.",
2393
+ nameHint: "The person who shared this document sees your name and comments. The name stays on this device.",
2394
+ nameNeeded: "Type your name to comment",
2395
+ guest: "Guest",
2396
+ pdfCopy: "PDF copy",
2397
+ tooMany: "Too many tries. Try again in a few minutes.",
2398
+ openForms: { one: "open", other: "opens" },
2399
+ commentForms: { one: "comment", other: "comments" },
2400
+ methods: { typed: "Typed", drawn: "Drawn", image: "Image" },
2401
+ kinds: { docx: "DOCX", markdown: "Markdown", pdf: "PDF", sheet: "Sheets", slides: "Slides" }
2402
+ };
2403
+ var pl = {
2404
+ documents: "Dokumenty",
2405
+ loose: "Bez folderu",
2406
+ search: "Szukaj dokument\xF3w",
2407
+ all: "Wszystkie",
2408
+ empty: "Nie ma tu jeszcze dokument\xF3w",
2409
+ nothing: "Nic nie pasuje do wyszukiwania",
2410
+ pick: "Wybierz dokument z listy",
2411
+ closeList: "Ukryj list\u0119",
2412
+ openList: "Poka\u017C list\u0119",
2413
+ outline: "Spis tre\u015Bci",
2414
+ versions: "Wersje",
2415
+ details: "Szczeg\xF3\u0142y",
2416
+ noOutline: "Ten dokument nie ma nag\u0142\xF3wk\xF3w",
2417
+ current: "Bie\u017C\u0105ca",
2418
+ size: "Rozmiar",
2419
+ updated: "Zmieniono",
2420
+ by: "Zmienione przez",
2421
+ kind: "Format",
2422
+ rights: "Mo\u017Cesz",
2423
+ view: "Przegl\u0105da\u0107",
2424
+ comment: "Komentowa\u0107",
2425
+ edit: "Edytowa\u0107",
2426
+ failed: "Nie uda\u0142o si\u0119 wczyta\u0107",
2427
+ retry: "Spr\xF3buj ponownie",
2428
+ loading: "Wczytywanie",
2429
+ unsupported: "Tego pliku nie da si\u0119 jeszcze pokaza\u0107",
2430
+ restore: "Przywr\xF3\u0107 t\u0119 wersj\u0119",
2431
+ restoreFailed: "Nie uda\u0142o si\u0119 przywr\xF3ci\u0107",
2432
+ allProjects: "Wszystkie projekty",
2433
+ closePanel: "Ukryj panel",
2434
+ openPanel: "Poka\u017C panel",
2435
+ zoomIn: "Powi\u0119ksz",
2436
+ zoomOut: "Pomniejsz",
2437
+ fit: "Rzeczywisty rozmiar",
2438
+ pdfTools: "Narz\u0119dzia PDF",
2439
+ pages: "Strony",
2440
+ page: "Strona",
2441
+ fitWidth: "Dopasuj do szeroko\u015Bci",
2442
+ fitPage: "Ca\u0142a strona",
2443
+ find: "Szukaj w dokumencie",
2444
+ previous: "Poprzedni",
2445
+ next: "Nast\u0119pny",
2446
+ close: "Zamknij",
2447
+ searching: "Wyszukiwanie",
2448
+ noHits: "Brak wynik\xF3w",
2449
+ selectText: "Zaznacz tekst",
2450
+ highlight: "Wyr\xF3\u017Cnij",
2451
+ underline: "Podkre\u015Bl",
2452
+ strike: "Przekre\u015Bl",
2453
+ note: "Notatka",
2454
+ draw: "Rysuj",
2455
+ eraser: "Gumka",
2456
+ sign: "Podpisz",
2457
+ colour: "Kolor",
2458
+ lineWidth: "Grubo\u015B\u0107 linii",
2459
+ undo: "Cofnij",
2460
+ redo: "Pon\xF3w",
2461
+ save: "Zapisz",
2462
+ saving: "Zapisywanie",
2463
+ saved: "Zapisano",
2464
+ saveFailed: "Nie uda\u0142o si\u0119 zapisa\u0107",
2465
+ remove: "Usu\u0144",
2466
+ notePlaceholder: "Napisz notatk\u0119",
2467
+ signature: "Podpis",
2468
+ placeHint: "Kliknij lub dotknij miejsca, gdzie ma by\u0107 podpis",
2469
+ cancel: "Anuluj",
2470
+ signTitle: "Dodaj podpis",
2471
+ typed: "Wpisz",
2472
+ drawn: "Narysuj",
2473
+ image: "Obraz",
2474
+ yourName: "Imi\u0119 i nazwisko",
2475
+ drawHere: "Podpisz mysz\u0105 lub palcem",
2476
+ clear: "Wyczy\u015B\u0107",
2477
+ pickImage: "Wybierz obraz PNG lub JPEG",
2478
+ useSign: "Wstaw podpis",
2479
+ marksNote: "Oznaczenia",
2480
+ formNote: "Wype\u0142niony formularz",
2481
+ signedNote: "Podpisano",
2482
+ signatures: "Podpisy",
2483
+ noSignatures: "Nikt jeszcze nie podpisa\u0142 tego pliku",
2484
+ version: "Wersja",
2485
+ download: "Pobierz",
2486
+ openInDocuments: "Otw\xF3rz w Dokumentach",
2487
+ textTools: "Narz\u0119dzia tekstowe",
2488
+ home: "Narz\u0119dzia g\u0142\xF3wne",
2489
+ insert: "Wstawianie",
2490
+ layout: "Uk\u0142ad",
2491
+ review: "Recenzja",
2492
+ viewTab: "Widok",
2493
+ paragraphStyle: "Styl akapitu",
2494
+ normal: "Normalny",
2495
+ heading: "Nag\u0142\xF3wek",
2496
+ quote: "Cytat",
2497
+ code: "Kod",
2498
+ bold: "Pogrubienie",
2499
+ italic: "Kursywa",
2500
+ textColour: "Kolor tekstu",
2501
+ automatic: "Automatyczny",
2502
+ noColour: "Bez koloru",
2503
+ bullets: "Lista punktowana",
2504
+ numbers: "Lista numerowana",
2505
+ tasks: "Lista zada\u0144",
2506
+ alignLeft: "Wyr\xF3wnaj do lewej",
2507
+ alignCenter: "Wy\u015Brodkuj",
2508
+ alignRight: "Wyr\xF3wnaj do prawej",
2509
+ justify: "Wyjustuj",
2510
+ indent: "Zwi\u0119ksz wci\u0119cie",
2511
+ outdent: "Zmniejsz wci\u0119cie",
2512
+ clearFormat: "Wyczy\u015B\u0107 formatowanie",
2513
+ table: "Tabela",
2514
+ rowAbove: "Wiersz powy\u017Cej",
2515
+ rowBelow: "Wiersz poni\u017Cej",
2516
+ columnLeft: "Kolumna po lewej",
2517
+ columnRight: "Kolumna po prawej",
2518
+ deleteRow: "Usu\u0144 wiersz",
2519
+ deleteColumn: "Usu\u0144 kolumn\u0119",
2520
+ deleteTable: "Usu\u0144 tabel\u0119",
2521
+ headerRow: "Wiersz nag\u0142\xF3wka",
2522
+ mergeCells: "Scal lub podziel kom\xF3rki",
2523
+ imageLink: "Adres obrazu",
2524
+ chooseFile: "Wybierz plik",
2525
+ put: "Wstaw",
2526
+ link: "Link",
2527
+ linkAddress: "Adres linku",
2528
+ apply: "Zastosuj",
2529
+ unlink: "Usu\u0144 link",
2530
+ pageBreak: "Podzia\u0142 strony",
2531
+ rule: "Linia pozioma",
2532
+ pageSize: "Rozmiar strony",
2533
+ margins: "Marginesy",
2534
+ marginsNormal: "Normalne",
2535
+ marginsNarrow: "W\u0105skie",
2536
+ marginsWide: "Szerokie",
2537
+ addComment: "Dodaj komentarz",
2538
+ comments: "Komentarze",
2539
+ noComments: "Nie ma jeszcze komentarzy",
2540
+ commentHint: "Zaznacz tekst i dodaj komentarz",
2541
+ writeComment: "Napisz komentarz",
2542
+ post: "Dodaj",
2543
+ reply: "Odpowiedz",
2544
+ resolve: "Rozwi\u0105\u017C",
2545
+ reopen: "Otw\xF3rz ponownie",
2546
+ resolved: "Rozwi\u0105zany",
2547
+ showResolved: "Poka\u017C rozwi\u0105zane",
2548
+ commentFailed: "Nie uda\u0142o si\u0119 wys\u0142a\u0107 komentarza",
2549
+ exportAs: "Eksport",
2550
+ exportFailed: "Nie uda\u0142o si\u0119 wyeksportowa\u0107",
2551
+ editedNote: "Edycja tekstu",
2552
+ documentText: "Tekst dokumentu",
2553
+ locked: "Zachowane jak w pliku",
2554
+ references: "Odwo\u0142ania",
2555
+ toc: "Spis tre\u015Bci",
2556
+ tocInsert: "Wstaw spis tre\u015Bci",
2557
+ tocGo: "Przejd\u017A do spisu",
2558
+ tocRemove: "Usu\u0144 spis",
2559
+ tocHint: "Sam pod\u0105\u017Ca za nag\u0142\xF3wkami",
2560
+ tocEmpty: "Dodaj nag\u0142\xF3wki, a pojawi\u0105 si\u0119 tutaj",
2561
+ suggest: "Sugeruj zmiany",
2562
+ suggesting: "Sugerowanie",
2563
+ suggestions: "Sugestie",
2564
+ acceptAll: "Akceptuj wszystkie",
2565
+ rejectAll: "Odrzu\u0107 wszystkie",
2566
+ accept: "Akceptuj",
2567
+ reject: "Odrzu\u0107",
2568
+ added: "Dodano",
2569
+ removed: "Usuni\u0119to",
2570
+ someone: "Kto\u015B",
2571
+ copyAs: "Zr\xF3b kopi\u0119 XLSX",
2572
+ copyFailed: "Nie uda\u0142o si\u0119 zrobi\u0107 kopii",
2573
+ editComment: "Edytuj",
2574
+ delete: "Usu\u0144",
2575
+ deleteAsk: "Usun\u0105\u0107 ten komentarz?",
2576
+ deleteThread: "Usun\u0105\u0107 ten komentarz razem z odpowiedziami?",
2577
+ changeFailed: "Nie uda\u0142o si\u0119 zmieni\u0107 komentarza",
2578
+ unsavedTitle: "Zapisa\u0107 zmiany?",
2579
+ unsavedHint: "Ten dokument ma niezapisane zmiany.",
2580
+ discard: "Nie zapisuj",
2581
+ more: "Wi\u0119cej narz\u0119dzi",
2582
+ offline: "Offline",
2583
+ offlineHint: "Zmiany zostaj\u0105 tutaj i zsynchronizuj\u0105 si\u0119 po powrocie po\u0142\u0105czenia",
2584
+ liveOff: "Wsp\xF3lna edycja jest niedost\u0119pna",
2585
+ people: "Osoby w tym dokumencie",
2586
+ you: "ty",
2587
+ share: "Udost\u0119pnij",
2588
+ sharing: "Udost\u0119pnianie",
2589
+ guestLinks: "Linki dla go\u015Bci",
2590
+ viewLink: "Link do czytania",
2591
+ commentLink: "Link do komentowania",
2592
+ madeBy: "Utworzono przez {name}",
2593
+ endsOn: "Dzia\u0142a do {date}",
2594
+ untilOff: "Do wy\u0142\u0105czenia",
2595
+ linkEnded: "Wygas\u0142",
2596
+ downloadOn: "Pobieranie w\u0142\u0105czone",
2597
+ passwordOn: "Has\u0142o",
2598
+ copy: "Kopiuj",
2599
+ copied: "Skopiowano",
2600
+ changeLink: "Zmie\u0144",
2601
+ turnOff: "Wy\u0142\u0105cz",
2602
+ newLink: "Nowy link dla go\u015Bci",
2603
+ guestsCan: "Go\u015Bcie mog\u0105",
2604
+ canRead: "Czyta\u0107",
2605
+ canComment: "Czyta\u0107 i komentowa\u0107",
2606
+ badgeRead: "Tylko do odczytu",
2607
+ badgeComment: "Czytanie i komentarze",
2608
+ linkWorks: "Link dzia\u0142a",
2609
+ days7: "7 dni",
2610
+ days30: "30 dni",
2611
+ untilTurnOff: "Dop\xF3ki go nie wy\u0142\u0105cz\u0119",
2612
+ pickDay: "Wybierz dzie\u0144",
2613
+ passwordHint: "Go\u015Bcie wpisuj\u0105 je raz na swoim urz\u0105dzeniu",
2614
+ passwordPlaceholder: "Wpisz has\u0142o",
2615
+ keepPassword: "Zostaw puste, aby zachowa\u0107 has\u0142o",
2616
+ downloadFile: "Pobieranie pliku",
2617
+ downloadHint: "Oryginalny plik i kopia PDF",
2618
+ askName: "Pytaj go\u015Bcia o imi\u0119",
2619
+ askNameHint: "Widzisz je na li\u015Bcie os\xF3b, kt\xF3re otworzy\u0142y link",
2620
+ lastSaved: "Go\u015Bcie widz\u0105 ostatni\u0105 zapisan\u0105 wersj\u0119. Nowa wersja trafia do linku, gdy kto\u015B zapisze.",
2621
+ makeLink: "Utw\xF3rz link",
2622
+ saveLink: "Zapisz link",
2623
+ inTeam: "W zespole",
2624
+ peopleOf: "Osoby z projektu {space}",
2625
+ teamHint: "Ka\u017Cdy, kto widzi Dysk tego projektu, czyta go, a osoby z prawem edycji go zmieniaj\u0105.",
2626
+ noLinks: "Nie ma jeszcze link\xF3w dla go\u015Bci. Link otwiera ten dokument bez konta.",
2627
+ unnamed: "Go\u015Bcie bez imienia",
2628
+ shareFailed: "Nie uda\u0142o si\u0119 zapisa\u0107 linku. Spr\xF3buj ponownie.",
2629
+ sharedBy: "Udost\u0119pnione przez {name}",
2630
+ openDoc: "Otw\xF3rz",
2631
+ passwordAsk: "Ten dokument otwiera si\u0119 has\u0142em. Wpisz je, aby otworzy\u0107 dokument na tym urz\u0105dzeniu.",
2632
+ wrongPassword: "Has\u0142o nie pasuje. Spr\xF3buj ponownie.",
2633
+ endedTitle: "Ten link wygas\u0142",
2634
+ endedText: "Osoba, kt\xF3ra udost\u0119pni\u0142a dokument, wy\u0142\u0105czy\u0142a link albo min\u0105\u0142 jego ostatni dzie\u0144. Popro\u015B j\u0105 o nowy link.",
2635
+ missingTitle: "Ten link niczego nie otwiera",
2636
+ missingText: "Sprawd\u017A adres albo popro\u015B o nowy link.",
2637
+ nameAsk: "Wpisz swoje imi\u0119, aby przeczyta\u0107 ten dokument. Osoba, kt\xF3ra go udost\u0119pni\u0142a, widzi, kto go otworzy\u0142.",
2638
+ nameHint: "Osoba, kt\xF3ra udost\u0119pni\u0142a dokument, widzi Twoje imi\u0119 i komentarze. Imi\u0119 zostaje na tym urz\u0105dzeniu.",
2639
+ nameNeeded: "Wpisz imi\u0119, aby komentowa\u0107",
2640
+ guest: "Go\u015B\u0107",
2641
+ pdfCopy: "Kopia PDF",
2642
+ tooMany: "Za du\u017Co pr\xF3b. Spr\xF3buj za kilka minut.",
2643
+ openForms: { one: "otwarcie", few: "otwarcia", many: "otwar\u0107", other: "otwarcia" },
2644
+ commentForms: { one: "komentarz", few: "komentarze", many: "komentarzy", other: "komentarza" },
2645
+ methods: { typed: "Wpisany", drawn: "Narysowany", image: "Obraz" },
2646
+ kinds: { docx: "DOCX", markdown: "Markdown", pdf: "PDF", sheet: "Arkusze", slides: "Slajdy" }
2647
+ };
2648
+ var uk = {
2649
+ documents: "\u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0438",
2650
+ loose: "\u0411\u0435\u0437 \u0442\u0435\u043A\u0438",
2651
+ search: "\u041F\u043E\u0448\u0443\u043A \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0456\u0432",
2652
+ all: "\u0423\u0441\u0456",
2653
+ empty: "\u0422\u0443\u0442 \u0449\u0435 \u043D\u0435\u043C\u0430\u0454 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0456\u0432",
2654
+ nothing: "\u041D\u0456\u0447\u043E\u0433\u043E \u043D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E",
2655
+ pick: "\u0412\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u0443 \u0441\u043F\u0438\u0441\u043A\u0443",
2656
+ closeList: "\u0421\u0445\u043E\u0432\u0430\u0442\u0438 \u0441\u043F\u0438\u0441\u043E\u043A",
2657
+ openList: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 \u0441\u043F\u0438\u0441\u043E\u043A",
2658
+ outline: "\u0417\u043C\u0456\u0441\u0442",
2659
+ versions: "\u0412\u0435\u0440\u0441\u0456\u0457",
2660
+ details: "\u0414\u0435\u0442\u0430\u043B\u0456",
2661
+ noOutline: "\u0423 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0456 \u043D\u0435\u043C\u0430\u0454 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0456\u0432",
2662
+ current: "\u041F\u043E\u0442\u043E\u0447\u043D\u0430",
2663
+ size: "\u0420\u043E\u0437\u043C\u0456\u0440",
2664
+ updated: "\u0417\u043C\u0456\u043D\u0435\u043D\u043E",
2665
+ by: "\u0425\u0442\u043E \u0437\u043C\u0456\u043D\u0438\u0432",
2666
+ kind: "\u0424\u043E\u0440\u043C\u0430\u0442",
2667
+ rights: "\u0412\u0438 \u043C\u043E\u0436\u0435\u0442\u0435",
2668
+ view: "\u0414\u0438\u0432\u0438\u0442\u0438\u0441\u044F",
2669
+ comment: "\u041A\u043E\u043C\u0435\u043D\u0442\u0443\u0432\u0430\u0442\u0438",
2670
+ edit: "\u041F\u0440\u0430\u0432\u0438\u0442\u0438",
2671
+ failed: "\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438",
2672
+ retry: "\u0421\u043F\u0440\u043E\u0431\u0443\u0432\u0430\u0442\u0438 \u0449\u0435",
2673
+ loading: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F",
2674
+ unsupported: "\u0426\u0435\u0439 \u0444\u0430\u0439\u043B \u043F\u043E\u043A\u0438 \u043D\u0435 \u043C\u043E\u0436\u043D\u0430 \u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438",
2675
+ restore: "\u0412\u0456\u0434\u043D\u043E\u0432\u0438\u0442\u0438 \u0446\u044E \u0432\u0435\u0440\u0441\u0456\u044E",
2676
+ restoreFailed: "\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043D\u043E\u0432\u0438\u0442\u0438",
2677
+ allProjects: "\u0423\u0441\u0456 \u043F\u0440\u043E\u0454\u043A\u0442\u0438",
2678
+ closePanel: "\u0421\u0445\u043E\u0432\u0430\u0442\u0438 \u043F\u0430\u043D\u0435\u043B\u044C",
2679
+ openPanel: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 \u043F\u0430\u043D\u0435\u043B\u044C",
2680
+ zoomIn: "\u0417\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438",
2681
+ zoomOut: "\u0417\u043C\u0435\u043D\u0448\u0438\u0442\u0438",
2682
+ fit: "\u0421\u043F\u0440\u0430\u0432\u0436\u043D\u0456\u0439 \u0440\u043E\u0437\u043C\u0456\u0440",
2683
+ pdfTools: "\u0406\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442\u0438 PDF",
2684
+ pages: "\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0438",
2685
+ page: "\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430",
2686
+ fitWidth: "\u0417\u0430 \u0448\u0438\u0440\u0438\u043D\u043E\u044E",
2687
+ fitPage: "\u0421\u0442\u043E\u0440\u0456\u043D\u043A\u0430 \u0446\u0456\u043B\u043A\u043E\u043C",
2688
+ find: "\u041F\u043E\u0448\u0443\u043A \u0443 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0456",
2689
+ previous: "\u041F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u0456\u0439",
2690
+ next: "\u041D\u0430\u0441\u0442\u0443\u043F\u043D\u0438\u0439",
2691
+ close: "\u0417\u0430\u043A\u0440\u0438\u0442\u0438",
2692
+ searching: "\u041F\u043E\u0448\u0443\u043A",
2693
+ noHits: "\u041D\u0456\u0447\u043E\u0433\u043E \u043D\u0435 \u0437\u043D\u0430\u0439\u0434\u0435\u043D\u043E",
2694
+ selectText: "\u0412\u0438\u0434\u0456\u043B\u0438\u0442\u0438 \u0442\u0435\u043A\u0441\u0442",
2695
+ highlight: "\u041C\u0430\u0440\u043A\u0435\u0440",
2696
+ underline: "\u041F\u0456\u0434\u043A\u0440\u0435\u0441\u043B\u0438\u0442\u0438",
2697
+ strike: "\u0417\u0430\u043A\u0440\u0435\u0441\u043B\u0438\u0442\u0438",
2698
+ note: "\u041D\u043E\u0442\u0430\u0442\u043A\u0430",
2699
+ draw: "\u041C\u0430\u043B\u044E\u0432\u0430\u0442\u0438",
2700
+ eraser: "\u0413\u0443\u043C\u043A\u0430",
2701
+ sign: "\u041F\u0456\u0434\u043F\u0438\u0441\u0430\u0442\u0438",
2702
+ colour: "\u041A\u043E\u043B\u0456\u0440",
2703
+ lineWidth: "\u0422\u043E\u0432\u0449\u0438\u043D\u0430 \u043B\u0456\u043D\u0456\u0457",
2704
+ undo: "\u0412\u0456\u0434\u043C\u0456\u043D\u0438\u0442\u0438",
2705
+ redo: "\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438",
2706
+ save: "\u0417\u0431\u0435\u0440\u0435\u0433\u0442\u0438",
2707
+ saving: "\u0417\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u043D\u044F",
2708
+ saved: "\u0417\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u043E",
2709
+ saveFailed: "\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0437\u0431\u0435\u0440\u0435\u0433\u0442\u0438",
2710
+ remove: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438",
2711
+ notePlaceholder: "\u041D\u0430\u043F\u0438\u0448\u0456\u0442\u044C \u043D\u043E\u0442\u0430\u0442\u043A\u0443",
2712
+ signature: "\u041F\u0456\u0434\u043F\u0438\u0441",
2713
+ placeHint: "\u041A\u043B\u0430\u0446\u043D\u0456\u0442\u044C \u0430\u0431\u043E \u0442\u043E\u0440\u043A\u043D\u0456\u0442\u044C\u0441\u044F \u043C\u0456\u0441\u0446\u044F, \u0434\u0435 \u043C\u0430\u0454 \u0431\u0443\u0442\u0438 \u043F\u0456\u0434\u043F\u0438\u0441",
2714
+ cancel: "\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438",
2715
+ signTitle: "\u0414\u043E\u0434\u0430\u0442\u0438 \u043F\u0456\u0434\u043F\u0438\u0441",
2716
+ typed: "\u0412\u0432\u0435\u0441\u0442\u0438",
2717
+ drawn: "\u041D\u0430\u043C\u0430\u043B\u044E\u0432\u0430\u0442\u0438",
2718
+ image: "\u0417\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F",
2719
+ yourName: "\u0412\u0430\u0448\u0435 \u0456\u043C\u2019\u044F",
2720
+ drawHere: "\u041F\u0456\u0434\u043F\u0438\u0448\u0456\u0442\u044C\u0441\u044F \u043C\u0438\u0448\u0435\u044E \u0430\u0431\u043E \u043F\u0430\u043B\u044C\u0446\u0435\u043C",
2721
+ clear: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u0438",
2722
+ pickImage: "\u0412\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F PNG \u0430\u0431\u043E JPEG",
2723
+ useSign: "\u041F\u043E\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u043F\u0456\u0434\u043F\u0438\u0441",
2724
+ marksNote: "\u041F\u043E\u0437\u043D\u0430\u0447\u043A\u0438",
2725
+ formNote: "\u0417\u0430\u043F\u043E\u0432\u043D\u0435\u043D\u0430 \u0444\u043E\u0440\u043C\u0430",
2726
+ signedNote: "\u041F\u0456\u0434\u043F\u0438\u0441\u0430\u043D\u043E",
2727
+ signatures: "\u041F\u0456\u0434\u043F\u0438\u0441\u0438",
2728
+ noSignatures: "\u0426\u0435\u0439 \u0444\u0430\u0439\u043B \u0449\u0435 \u043D\u0456\u0445\u0442\u043E \u043D\u0435 \u043F\u0456\u0434\u043F\u0438\u0441\u0430\u0432",
2729
+ version: "\u0412\u0435\u0440\u0441\u0456\u044F",
2730
+ download: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438",
2731
+ openInDocuments: "\u0412\u0456\u0434\u043A\u0440\u0438\u0442\u0438 \u0432 \u0414\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430\u0445",
2732
+ textTools: "\u0406\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442\u0438 \u0434\u043B\u044F \u0442\u0435\u043A\u0441\u0442\u0443",
2733
+ home: "\u041E\u0441\u043D\u043E\u0432\u043D\u0435",
2734
+ insert: "\u0412\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u043D\u044F",
2735
+ layout: "\u041C\u0430\u043A\u0435\u0442",
2736
+ review: "\u0420\u0435\u0446\u0435\u043D\u0437\u0443\u0432\u0430\u043D\u043D\u044F",
2737
+ viewTab: "\u0412\u0438\u0433\u043B\u044F\u0434",
2738
+ paragraphStyle: "\u0421\u0442\u0438\u043B\u044C \u0430\u0431\u0437\u0430\u0446\u0443",
2739
+ normal: "\u0417\u0432\u0438\u0447\u0430\u0439\u043D\u0438\u0439",
2740
+ heading: "\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A",
2741
+ quote: "\u0426\u0438\u0442\u0430\u0442\u0430",
2742
+ code: "\u041A\u043E\u0434",
2743
+ bold: "\u0416\u0438\u0440\u043D\u0438\u0439",
2744
+ italic: "\u041A\u0443\u0440\u0441\u0438\u0432",
2745
+ textColour: "\u041A\u043E\u043B\u0456\u0440 \u0442\u0435\u043A\u0441\u0442\u0443",
2746
+ automatic: "\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u043D\u043E",
2747
+ noColour: "\u0411\u0435\u0437 \u043A\u043E\u043B\u044C\u043E\u0440\u0443",
2748
+ bullets: "\u041C\u0430\u0440\u043A\u043E\u0432\u0430\u043D\u0438\u0439 \u0441\u043F\u0438\u0441\u043E\u043A",
2749
+ numbers: "\u041D\u0443\u043C\u0435\u0440\u043E\u0432\u0430\u043D\u0438\u0439 \u0441\u043F\u0438\u0441\u043E\u043A",
2750
+ tasks: "\u0421\u043F\u0438\u0441\u043E\u043A \u0437\u0430\u0432\u0434\u0430\u043D\u044C",
2751
+ alignLeft: "\u041F\u043E \u043B\u0456\u0432\u043E\u043C\u0443 \u043A\u0440\u0430\u044E",
2752
+ alignCenter: "\u041F\u043E \u0446\u0435\u043D\u0442\u0440\u0443",
2753
+ alignRight: "\u041F\u043E \u043F\u0440\u0430\u0432\u043E\u043C\u0443 \u043A\u0440\u0430\u044E",
2754
+ justify: "\u041F\u043E \u0448\u0438\u0440\u0438\u043D\u0456",
2755
+ indent: "\u0417\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438 \u0432\u0456\u0434\u0441\u0442\u0443\u043F",
2756
+ outdent: "\u0417\u043C\u0435\u043D\u0448\u0438\u0442\u0438 \u0432\u0456\u0434\u0441\u0442\u0443\u043F",
2757
+ clearFormat: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u0438 \u0444\u043E\u0440\u043C\u0430\u0442\u0443\u0432\u0430\u043D\u043D\u044F",
2758
+ table: "\u0422\u0430\u0431\u043B\u0438\u0446\u044F",
2759
+ rowAbove: "\u0420\u044F\u0434\u043E\u043A \u0432\u0438\u0449\u0435",
2760
+ rowBelow: "\u0420\u044F\u0434\u043E\u043A \u043D\u0438\u0436\u0447\u0435",
2761
+ columnLeft: "\u0421\u0442\u043E\u0432\u043F\u0435\u0446\u044C \u043B\u0456\u0432\u043E\u0440\u0443\u0447",
2762
+ columnRight: "\u0421\u0442\u043E\u0432\u043F\u0435\u0446\u044C \u043F\u0440\u0430\u0432\u043E\u0440\u0443\u0447",
2763
+ deleteRow: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0440\u044F\u0434\u043E\u043A",
2764
+ deleteColumn: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0441\u0442\u043E\u0432\u043F\u0435\u0446\u044C",
2765
+ deleteTable: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0442\u0430\u0431\u043B\u0438\u0446\u044E",
2766
+ headerRow: "\u0420\u044F\u0434\u043E\u043A \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0430",
2767
+ mergeCells: "\u041E\u0431\u2019\u0454\u0434\u043D\u0430\u0442\u0438 \u0430\u0431\u043E \u0440\u043E\u0437\u0434\u0456\u043B\u0438\u0442\u0438 \u043A\u043B\u0456\u0442\u0438\u043D\u043A\u0438",
2768
+ imageLink: "\u0410\u0434\u0440\u0435\u0441\u0430 \u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F",
2769
+ chooseFile: "\u0412\u0438\u0431\u0440\u0430\u0442\u0438 \u0444\u0430\u0439\u043B",
2770
+ put: "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438",
2771
+ link: "\u041F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F",
2772
+ linkAddress: "\u0410\u0434\u0440\u0435\u0441\u0430 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F",
2773
+ apply: "\u0417\u0430\u0441\u0442\u043E\u0441\u0443\u0432\u0430\u0442\u0438",
2774
+ unlink: "\u041F\u0440\u0438\u0431\u0440\u0430\u0442\u0438 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F",
2775
+ pageBreak: "\u0420\u043E\u0437\u0440\u0438\u0432 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438",
2776
+ rule: "\u0413\u043E\u0440\u0438\u0437\u043E\u043D\u0442\u0430\u043B\u044C\u043D\u0430 \u043B\u0456\u043D\u0456\u044F",
2777
+ pageSize: "\u0420\u043E\u0437\u043C\u0456\u0440 \u0441\u0442\u043E\u0440\u0456\u043D\u043A\u0438",
2778
+ margins: "\u041F\u043E\u043B\u044F",
2779
+ marginsNormal: "\u0417\u0432\u0438\u0447\u0430\u0439\u043D\u0456",
2780
+ marginsNarrow: "\u0412\u0443\u0437\u044C\u043A\u0456",
2781
+ marginsWide: "\u0428\u0438\u0440\u043E\u043A\u0456",
2782
+ addComment: "\u0414\u043E\u0434\u0430\u0442\u0438 \u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440",
2783
+ comments: "\u041A\u043E\u043C\u0435\u043D\u0442\u0430\u0440\u0456",
2784
+ noComments: "\u041A\u043E\u043C\u0435\u043D\u0442\u0430\u0440\u0456\u0432 \u0449\u0435 \u043D\u0435\u043C\u0430\u0454",
2785
+ commentHint: "\u0412\u0438\u0434\u0456\u043B\u0456\u0442\u044C \u0442\u0435\u043A\u0441\u0442 \u0456 \u0434\u043E\u0434\u0430\u0439\u0442\u0435 \u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440",
2786
+ writeComment: "\u041D\u0430\u043F\u0438\u0448\u0456\u0442\u044C \u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440",
2787
+ post: "\u0414\u043E\u0434\u0430\u0442\u0438",
2788
+ reply: "\u0412\u0456\u0434\u043F\u043E\u0432\u0456\u0441\u0442\u0438",
2789
+ resolve: "\u0412\u0438\u0440\u0456\u0448\u0438\u0442\u0438",
2790
+ reopen: "\u0412\u0456\u0434\u043A\u0440\u0438\u0442\u0438 \u0437\u043D\u043E\u0432\u0443",
2791
+ resolved: "\u0412\u0438\u0440\u0456\u0448\u0435\u043D\u043E",
2792
+ showResolved: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 \u0432\u0438\u0440\u0456\u0448\u0435\u043D\u0456",
2793
+ commentFailed: "\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u043D\u0430\u0434\u0456\u0441\u043B\u0430\u0442\u0438 \u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440",
2794
+ exportAs: "\u0415\u043A\u0441\u043F\u043E\u0440\u0442",
2795
+ exportFailed: "\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0435\u043A\u0441\u043F\u043E\u0440\u0442\u0443\u0432\u0430\u0442\u0438",
2796
+ editedNote: "\u041F\u0440\u0430\u0432\u043A\u0430 \u0442\u0435\u043A\u0441\u0442\u0443",
2797
+ documentText: "\u0422\u0435\u043A\u0441\u0442 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430",
2798
+ locked: "\u041B\u0438\u0448\u0430\u0454\u0442\u044C\u0441\u044F \u044F\u043A \u0443 \u0444\u0430\u0439\u043B\u0456",
2799
+ references: "\u041F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F",
2800
+ toc: "\u0417\u043C\u0456\u0441\u0442",
2801
+ tocInsert: "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u0437\u043C\u0456\u0441\u0442",
2802
+ tocGo: "\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u0434\u043E \u0437\u043C\u0456\u0441\u0442\u0443",
2803
+ tocRemove: "\u041F\u0440\u0438\u0431\u0440\u0430\u0442\u0438 \u0437\u043C\u0456\u0441\u0442",
2804
+ tocHint: "\u0421\u0430\u043C \u0456\u0434\u0435 \u0437\u0430 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0430\u043C\u0438",
2805
+ tocEmpty: "\u0414\u043E\u0434\u0430\u0439\u0442\u0435 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438, \u0456 \u0432\u043E\u043D\u0438 \u0437\u2019\u044F\u0432\u043B\u044F\u0442\u044C\u0441\u044F \u0442\u0443\u0442",
2806
+ suggest: "\u041F\u0440\u043E\u043F\u043E\u043D\u0443\u0432\u0430\u0442\u0438 \u0437\u043C\u0456\u043D\u0438",
2807
+ suggesting: "\u0420\u0435\u0436\u0438\u043C \u043F\u0440\u043E\u043F\u043E\u0437\u0438\u0446\u0456\u0439",
2808
+ suggestions: "\u041F\u0440\u043E\u043F\u043E\u0437\u0438\u0446\u0456\u0457",
2809
+ acceptAll: "\u041F\u0440\u0438\u0439\u043D\u044F\u0442\u0438 \u0432\u0441\u0456",
2810
+ rejectAll: "\u0412\u0456\u0434\u0445\u0438\u043B\u0438\u0442\u0438 \u0432\u0441\u0456",
2811
+ accept: "\u041F\u0440\u0438\u0439\u043D\u044F\u0442\u0438",
2812
+ reject: "\u0412\u0456\u0434\u0445\u0438\u043B\u0438\u0442\u0438",
2813
+ added: "\u0414\u043E\u0434\u0430\u043D\u043E",
2814
+ removed: "\u0412\u0438\u0434\u0430\u043B\u0435\u043D\u043E",
2815
+ someone: "\u0425\u0442\u043E\u0441\u044C",
2816
+ copyAs: "\u0417\u0440\u043E\u0431\u0438\u0442\u0438 \u043A\u043E\u043F\u0456\u044E XLSX",
2817
+ copyFailed: "\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0437\u0440\u043E\u0431\u0438\u0442\u0438 \u043A\u043E\u043F\u0456\u044E",
2818
+ editComment: "\u0417\u043C\u0456\u043D\u0438\u0442\u0438",
2819
+ delete: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438",
2820
+ deleteAsk: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0446\u0435\u0439 \u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440?",
2821
+ deleteThread: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0446\u0435\u0439 \u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440 \u0440\u0430\u0437\u043E\u043C \u0437 \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u044F\u043C\u0438?",
2822
+ changeFailed: "\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0437\u043C\u0456\u043D\u0438\u0442\u0438 \u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440",
2823
+ unsavedTitle: "\u0417\u0431\u0435\u0440\u0435\u0433\u0442\u0438 \u0437\u043C\u0456\u043D\u0438?",
2824
+ unsavedHint: "\u0423 \u0446\u044C\u043E\u043C\u0443 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0456 \u0454 \u043D\u0435\u0437\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u0456 \u0437\u043C\u0456\u043D\u0438.",
2825
+ discard: "\u041D\u0435 \u0437\u0431\u0435\u0440\u0456\u0433\u0430\u0442\u0438",
2826
+ more: "\u0411\u0456\u043B\u044C\u0448\u0435 \u0456\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442\u0456\u0432",
2827
+ offline: "\u041E\u0444\u043B\u0430\u0439\u043D",
2828
+ offlineHint: "\u0417\u043C\u0456\u043D\u0438 \u043B\u0438\u0448\u0430\u044E\u0442\u044C\u0441\u044F \u0442\u0443\u0442 \u0456 \u0441\u0438\u043D\u0445\u0440\u043E\u043D\u0456\u0437\u0443\u044E\u0442\u044C\u0441\u044F, \u043A\u043E\u043B\u0438 \u0437\u2019\u044F\u0432\u0438\u0442\u044C\u0441\u044F \u0437\u0432\u2019\u044F\u0437\u043E\u043A",
2829
+ liveOff: "\u0421\u043F\u0456\u043B\u044C\u043D\u0435 \u0440\u0435\u0434\u0430\u0433\u0443\u0432\u0430\u043D\u043D\u044F \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0435",
2830
+ people: "\u041B\u044E\u0434\u0438 \u0432 \u0446\u044C\u043E\u043C\u0443 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0456",
2831
+ you: "\u0432\u0438",
2832
+ share: "\u041F\u043E\u0434\u0456\u043B\u0438\u0442\u0438\u0441\u044F",
2833
+ sharing: "\u0414\u043E\u0441\u0442\u0443\u043F",
2834
+ guestLinks: "\u041F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u0434\u043B\u044F \u0433\u043E\u0441\u0442\u0435\u0439",
2835
+ viewLink: "\u041F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u0434\u043B\u044F \u0447\u0438\u0442\u0430\u043D\u043D\u044F",
2836
+ commentLink: "\u041F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u0434\u043B\u044F \u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440\u0456\u0432",
2837
+ madeBy: "\u0410\u0432\u0442\u043E\u0440: {name}",
2838
+ endsOn: "\u0414\u0456\u0454 \u0434\u043E {date}",
2839
+ untilOff: "\u0414\u043E\u043A\u0438 \u043D\u0435 \u0432\u0438\u043C\u043A\u043D\u0443\u0442\u044C",
2840
+ linkEnded: "\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043E",
2841
+ downloadOn: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u0432\u0432\u0456\u043C\u043A\u043D\u0435\u043D\u043E",
2842
+ passwordOn: "\u041F\u0430\u0440\u043E\u043B\u044C",
2843
+ copy: "\u041A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438",
2844
+ copied: "\u0421\u043A\u043E\u043F\u0456\u0439\u043E\u0432\u0430\u043D\u043E",
2845
+ changeLink: "\u0417\u043C\u0456\u043D\u0438\u0442\u0438",
2846
+ turnOff: "\u0412\u0438\u043C\u043A\u043D\u0443\u0442\u0438",
2847
+ newLink: "\u041D\u043E\u0432\u0435 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u0434\u043B\u044F \u0433\u043E\u0441\u0442\u0435\u0439",
2848
+ guestsCan: "\u0413\u043E\u0441\u0442\u0456 \u043C\u043E\u0436\u0443\u0442\u044C",
2849
+ canRead: "\u0427\u0438\u0442\u0430\u0442\u0438",
2850
+ canComment: "\u0427\u0438\u0442\u0430\u0442\u0438 \u0439 \u043A\u043E\u043C\u0435\u043D\u0442\u0443\u0432\u0430\u0442\u0438",
2851
+ badgeRead: "\u041B\u0438\u0448\u0435 \u0447\u0438\u0442\u0430\u043D\u043D\u044F",
2852
+ badgeComment: "\u0427\u0438\u0442\u0430\u043D\u043D\u044F \u0439 \u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440\u0456",
2853
+ linkWorks: "\u041F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u0434\u0456\u0454",
2854
+ days7: "7 \u0434\u043D\u0456\u0432",
2855
+ days30: "30 \u0434\u043D\u0456\u0432",
2856
+ untilTurnOff: "\u0414\u043E\u043A\u0438 \u043D\u0435 \u0432\u0438\u043C\u043A\u043D\u0443",
2857
+ pickDay: "\u0412\u0438\u0431\u0440\u0430\u0442\u0438 \u0434\u0435\u043D\u044C",
2858
+ passwordHint: "\u0413\u043E\u0441\u0442\u0456 \u0432\u0432\u043E\u0434\u044F\u0442\u044C \u0439\u043E\u0433\u043E \u043E\u0434\u0438\u043D \u0440\u0430\u0437 \u043D\u0430 \u0441\u0432\u043E\u0454\u043C\u0443 \u043F\u0440\u0438\u0441\u0442\u0440\u043E\u0457",
2859
+ passwordPlaceholder: "\u0412\u0432\u0435\u0434\u0456\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C",
2860
+ keepPassword: "\u041B\u0438\u0448\u0456\u0442\u044C \u043F\u043E\u0440\u043E\u0436\u043D\u0456\u043C, \u0449\u043E\u0431 \u0437\u0431\u0435\u0440\u0435\u0433\u0442\u0438 \u043F\u0430\u0440\u043E\u043B\u044C",
2861
+ downloadFile: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F \u0444\u0430\u0439\u043B\u0443",
2862
+ downloadHint: "\u041E\u0440\u0438\u0433\u0456\u043D\u0430\u043B\u044C\u043D\u0438\u0439 \u0444\u0430\u0439\u043B \u0456 \u043A\u043E\u043F\u0456\u044F PDF",
2863
+ askName: "\u041F\u0438\u0442\u0430\u0442\u0438 \u0456\u043C\u2019\u044F \u0433\u043E\u0441\u0442\u044F",
2864
+ askNameHint: "\u0412\u0438 \u0431\u0430\u0447\u0438\u0442\u0435 \u0439\u043E\u0433\u043E \u0441\u0435\u0440\u0435\u0434 \u0442\u0438\u0445, \u0445\u0442\u043E \u0432\u0456\u0434\u043A\u0440\u0438\u0432\u0430\u0432",
2865
+ lastSaved: "\u0413\u043E\u0441\u0442\u0456 \u0431\u0430\u0447\u0430\u0442\u044C \u043E\u0441\u0442\u0430\u043D\u043D\u044E \u0437\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u0443 \u0432\u0435\u0440\u0441\u0456\u044E. \u041D\u043E\u0432\u0430 \u0432\u0435\u0440\u0441\u0456\u044F \u043F\u043E\u0442\u0440\u0430\u043F\u043B\u044F\u0454 \u0437\u0430 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F\u043C, \u043A\u043E\u043B\u0438 \u0445\u0442\u043E\u0441\u044C \u0437\u0431\u0435\u0440\u0456\u0433\u0430\u0454.",
2866
+ makeLink: "\u0421\u0442\u0432\u043E\u0440\u0438\u0442\u0438 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F",
2867
+ saveLink: "\u0417\u0431\u0435\u0440\u0435\u0433\u0442\u0438 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F",
2868
+ inTeam: "\u0423 \u043A\u043E\u043C\u0430\u043D\u0434\u0456",
2869
+ peopleOf: "\u041B\u044E\u0434\u0438 \u043F\u0440\u043E\u0454\u043A\u0442\u0443 {space}",
2870
+ teamHint: "\u041A\u043E\u0436\u0435\u043D, \u0445\u0442\u043E \u0431\u0430\u0447\u0438\u0442\u044C Drive \u0446\u044C\u043E\u0433\u043E \u043F\u0440\u043E\u0454\u043A\u0442\u0443, \u0447\u0438\u0442\u0430\u0454 \u0439\u043E\u0433\u043E, \u0430 \u043B\u044E\u0434\u0438 \u0437 \u043F\u0440\u0430\u0432\u043E\u043C \u043F\u0440\u0430\u0432\u043A\u0438 \u0437\u043C\u0456\u043D\u044E\u044E\u0442\u044C.",
2871
+ noLinks: "\u041F\u043E\u0441\u0438\u043B\u0430\u043D\u044C \u0434\u043B\u044F \u0433\u043E\u0441\u0442\u0435\u0439 \u0449\u0435 \u043D\u0435\u043C\u0430\u0454. \u041F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0432\u0430\u0454 \u0446\u0435\u0439 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u0431\u0435\u0437 \u043E\u0431\u043B\u0456\u043A\u043E\u0432\u043E\u0433\u043E \u0437\u0430\u043F\u0438\u0441\u0443.",
2872
+ unnamed: "\u0413\u043E\u0441\u0442\u0456 \u0431\u0435\u0437 \u0456\u043C\u0435\u043D\u0456",
2873
+ shareFailed: "\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0437\u0431\u0435\u0440\u0435\u0433\u0442\u0438 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F. \u0421\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0449\u0435.",
2874
+ sharedBy: "\u0412\u0456\u0434 {name}",
2875
+ openDoc: "\u0412\u0456\u0434\u043A\u0440\u0438\u0442\u0438",
2876
+ passwordAsk: "\u0426\u0435\u0439 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u0432\u0456\u0434\u043A\u0440\u0438\u0432\u0430\u0454\u0442\u044C\u0441\u044F \u0437 \u043F\u0430\u0440\u043E\u043B\u0435\u043C. \u0412\u0432\u0435\u0434\u0456\u0442\u044C \u0439\u043E\u0433\u043E, \u0449\u043E\u0431 \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u043D\u0430 \u0446\u044C\u043E\u043C\u0443 \u043F\u0440\u0438\u0441\u0442\u0440\u043E\u0457.",
2877
+ wrongPassword: "\u041F\u0430\u0440\u043E\u043B\u044C \u043D\u0435 \u043F\u0456\u0434\u0445\u043E\u0434\u0438\u0442\u044C. \u0421\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0449\u0435.",
2878
+ endedTitle: "\u0426\u0435 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u0431\u0456\u043B\u044C\u0448\u0435 \u043D\u0435 \u0434\u0456\u0454",
2879
+ endedText: "\u0422\u043E\u0439, \u0445\u0442\u043E \u043F\u043E\u0434\u0456\u043B\u0438\u0432\u0441\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043C, \u0432\u0438\u043C\u043A\u043D\u0443\u0432 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u0430\u0431\u043E \u043C\u0438\u043D\u0443\u0432 \u0439\u043E\u0433\u043E \u043E\u0441\u0442\u0430\u043D\u043D\u0456\u0439 \u0434\u0435\u043D\u044C. \u041F\u043E\u043F\u0440\u043E\u0441\u0456\u0442\u044C \u043D\u043E\u0432\u0435 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F.",
2880
+ missingTitle: "\u0426\u0435 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F \u043D\u0456\u0447\u043E\u0433\u043E \u043D\u0435 \u0432\u0456\u0434\u043A\u0440\u0438\u0432\u0430\u0454",
2881
+ missingText: "\u041F\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435 \u0430\u0434\u0440\u0435\u0441\u0443 \u0430\u0431\u043E \u043F\u043E\u043F\u0440\u043E\u0441\u0456\u0442\u044C \u043D\u043E\u0432\u0435 \u043F\u043E\u0441\u0438\u043B\u0430\u043D\u043D\u044F.",
2882
+ nameAsk: "\u0412\u0432\u0435\u0434\u0456\u0442\u044C \u0441\u0432\u043E\u0454 \u0456\u043C\u2019\u044F, \u0449\u043E\u0431 \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u0438 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442. \u0422\u043E\u0439, \u0445\u0442\u043E \u043D\u0438\u043C \u043F\u043E\u0434\u0456\u043B\u0438\u0432\u0441\u044F, \u0431\u0430\u0447\u0438\u0442\u044C, \u0445\u0442\u043E \u0439\u043E\u0433\u043E \u0432\u0456\u0434\u043A\u0440\u0438\u0432\u0430\u0432.",
2883
+ nameHint: "\u0422\u043E\u0439, \u0445\u0442\u043E \u043F\u043E\u0434\u0456\u043B\u0438\u0432\u0441\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u043C, \u0431\u0430\u0447\u0438\u0442\u044C \u0432\u0430\u0448\u0435 \u0456\u043C\u2019\u044F \u0442\u0430 \u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440\u0456. \u0406\u043C\u2019\u044F \u043B\u0438\u0448\u0430\u0454\u0442\u044C\u0441\u044F \u043D\u0430 \u0446\u044C\u043E\u043C\u0443 \u043F\u0440\u0438\u0441\u0442\u0440\u043E\u0457.",
2884
+ nameNeeded: "\u0412\u0432\u0435\u0434\u0456\u0442\u044C \u0456\u043C\u2019\u044F, \u0449\u043E\u0431 \u043A\u043E\u043C\u0435\u043D\u0442\u0443\u0432\u0430\u0442\u0438",
2885
+ guest: "\u0413\u0456\u0441\u0442\u044C",
2886
+ pdfCopy: "\u041A\u043E\u043F\u0456\u044F PDF",
2887
+ tooMany: "\u0417\u0430\u0431\u0430\u0433\u0430\u0442\u043E \u0441\u043F\u0440\u043E\u0431. \u0421\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0437\u0430 \u043A\u0456\u043B\u044C\u043A\u0430 \u0445\u0432\u0438\u043B\u0438\u043D.",
2888
+ openForms: { one: "\u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0442\u044F", few: "\u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0442\u044F", many: "\u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0442\u0456\u0432", other: "\u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0442\u044F" },
2889
+ commentForms: { one: "\u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440", few: "\u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440\u0456", many: "\u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440\u0456\u0432", other: "\u043A\u043E\u043C\u0435\u043D\u0442\u0430\u0440\u044F" },
2890
+ methods: { typed: "\u0412\u0432\u0435\u0434\u0435\u043D\u0438\u0439", drawn: "\u041D\u0430\u043C\u0430\u043B\u044C\u043E\u0432\u0430\u043D\u0438\u0439", image: "\u0417\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u043D\u044F" },
2891
+ kinds: { docx: "DOCX", markdown: "Markdown", pdf: "PDF", sheet: "\u0422\u0430\u0431\u043B\u0438\u0446\u0456", slides: "\u0421\u043B\u0430\u0439\u0434\u0438" }
2892
+ };
2893
+ var texts = { en, pl, uk };
2894
+
2895
+ export {
2896
+ parse,
2897
+ attr,
2898
+ attrs,
2899
+ unescape,
2900
+ escape,
2901
+ unzip,
2902
+ inflate,
2903
+ entry,
2904
+ zip,
2905
+ readDocx,
2906
+ writeDocx,
2907
+ texts
2908
+ };
2909
+ //# sourceMappingURL=chunk-TNSN4ZQ5.js.map