@guodun/antdv 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/es/components/contract-signing-location/src/ContractSigningLocation.vue.mjs +241 -236
  2. package/dist/es/components/pro-contract-signing-flow/src/ContractSigningFlowCanvas.vue.mjs +22 -19
  3. package/dist/es/components/pro-contract-signing-flow/src/ContractSigningFlowInspector.vue.mjs +173 -147
  4. package/dist/es/components/pro-contract-signing-flow/src/ProContractSigningFlow.vue.mjs +83 -74
  5. package/dist/es/components/pro-contract-signing-flow/src/composables/use-contract-signing-flow.mjs +32 -32
  6. package/dist/es/components/pro-contract-signing-flow/style/index.css +1 -1
  7. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +8 -4
  8. package/dist/es/components/pro-contract-template-designer/src/extensions/word-paste.mjs +24 -20
  9. package/dist/es/components/pro-contract-template-designer/src/utils/word-paste.mjs +112 -112
  10. package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
  11. package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
  12. package/dist/lib/components/pro-contract-signing-flow/src/ContractSigningFlowCanvas.vue.cjs +1 -1
  13. package/dist/lib/components/pro-contract-signing-flow/src/ContractSigningFlowInspector.vue.cjs +1 -1
  14. package/dist/lib/components/pro-contract-signing-flow/src/ProContractSigningFlow.vue.cjs +1 -1
  15. package/dist/lib/components/pro-contract-signing-flow/src/composables/use-contract-signing-flow.cjs +1 -1
  16. package/dist/lib/components/pro-contract-signing-flow/style/index.css +1 -1
  17. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
  18. package/dist/lib/components/pro-contract-template-designer/src/extensions/word-paste.cjs +1 -1
  19. package/dist/lib/components/pro-contract-template-designer/src/utils/word-paste.cjs +2 -2
  20. package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
  21. package/dist/theme/icon.css +1 -1
  22. package/dist/theme/index.css +1 -1
  23. package/dist/theme/pro-contract-signing-flow.css +1 -1
  24. package/dist/types/components/contract-signing-location/src/ContractSigningLocation.vue.d.ts +1 -0
  25. package/dist/types/components/contract-signing-location/src/types.d.ts +5 -0
  26. package/dist/types/components/pro-contract-signing-flow/src/ContractSigningFlowCanvas.vue.d.ts +24 -1
  27. package/dist/types/components/pro-contract-signing-flow/src/ContractSigningFlowInspector.vue.d.ts +1 -0
  28. package/dist/types/components/pro-contract-signing-flow/src/ProContractSigningFlow.vue.d.ts +25 -1
  29. package/dist/types/components/pro-contract-signing-flow/src/composables/use-contract-signing-flow.d.ts +6 -2
  30. package/dist/types/components/pro-contract-signing-flow/src/types.d.ts +5 -0
  31. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererHeader.vue.d.ts +1 -1
  32. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.d.ts +1 -1
  33. package/dist/types/components/pro-contract-template-designer/src/extensions/word-paste.d.ts +1 -1
  34. package/dist/types/components/pro-contract-template-designer/src/types.d.ts +1 -1
  35. package/dist/types/components/pro-contract-template-designer/src/utils/word-paste.d.ts +2 -0
  36. package/package.json +1 -1
@@ -7,7 +7,9 @@ var n = 4 * 1024 * 1024, r = new Set([
7
7
  "image/gif",
8
8
  "image/webp",
9
9
  "image/bmp"
10
- ]), i = /* @__PURE__ */ "p.div.span.br.hr.h1.h2.h3.h4.h5.h6.strong.b.em.i.u.s.strike.del.sup.sub.blockquote.pre.code.a.ul.ol.li.table.thead.tbody.tfoot.tr.th.td.img".split("."), a = [
10
+ ]), i = "(?:file:|cid:|mhtml:|wordml:|blob:)", a = RegExp(`^${i}`, "i");
11
+ RegExp(`<(?:img|v:imagedata)\\b[^>]+\\bsrc\\s*=\\s*["']\\s*${i}`, "i");
12
+ var o = /* @__PURE__ */ "p.div.span.br.hr.h1.h2.h3.h4.h5.h6.strong.b.em.i.u.s.strike.del.sup.sub.blockquote.pre.code.a.ul.ol.li.table.thead.tbody.tfoot.tr.th.td.img".split("."), s = [
11
13
  "style",
12
14
  "href",
13
15
  "target",
@@ -22,7 +24,7 @@ var n = 4 * 1024 * 1024, r = new Set([
22
24
  "title",
23
25
  "width",
24
26
  "height"
25
- ], o = new Set(a), s = new Set([
27
+ ], c = new Set(s), l = new Set([
26
28
  "script",
27
29
  "style",
28
30
  "meta",
@@ -48,7 +50,7 @@ var n = 4 * 1024 * 1024, r = new Set([
48
50
  "math",
49
51
  "xml",
50
52
  "template"
51
- ]), c = new Set([
53
+ ]), u = new Set([
52
54
  "font-weight",
53
55
  "font-style",
54
56
  "text-decoration",
@@ -58,7 +60,7 @@ var n = 4 * 1024 * 1024, r = new Set([
58
60
  "font-size",
59
61
  "font-family",
60
62
  "vertical-align"
61
- ]), l = new Set([
63
+ ]), d = new Set([
62
64
  "font-weight",
63
65
  "font-style",
64
66
  "text-decoration",
@@ -75,7 +77,7 @@ var n = 4 * 1024 * 1024, r = new Set([
75
77
  "padding-left",
76
78
  "text-indent",
77
79
  "direction"
78
- ]), u = new Set([
80
+ ]), f = new Set([
79
81
  "font-weight",
80
82
  "font-style",
81
83
  "text-decoration",
@@ -93,7 +95,7 @@ var n = 4 * 1024 * 1024, r = new Set([
93
95
  "text-indent",
94
96
  "direction",
95
97
  "list-style-type"
96
- ]), d = new Set([
98
+ ]), p = new Set([
97
99
  "width",
98
100
  "max-width",
99
101
  "min-width",
@@ -101,31 +103,31 @@ var n = 4 * 1024 * 1024, r = new Set([
101
103
  "border-collapse",
102
104
  "margin-left",
103
105
  "margin-right"
104
- ]), f = new Set(/* @__PURE__ */ "font-weight.font-style.text-decoration.text-decoration-line.color.background-color.font-size.font-family.text-align.line-height.margin-top.margin-bottom.margin-left.text-indent.direction.width.height.min-width.vertical-align.padding.padding-top.padding-right.padding-bottom.padding-left.border.border-top.border-right.border-bottom.border-left".split(".")), p = [
106
+ ]), m = new Set(/* @__PURE__ */ "font-weight.font-style.text-decoration.text-decoration-line.color.background-color.font-size.font-family.text-align.line-height.margin-top.margin-bottom.margin-left.text-indent.direction.width.height.min-width.vertical-align.padding.padding-top.padding-right.padding-bottom.padding-left.border.border-top.border-right.border-bottom.border-left".split(".")), h = [
105
107
  /urn:schemas-microsoft-com:office/i,
106
108
  /xmlns:(?:o|w|m)\s*=/i,
107
109
  /class\s*=\s*["'][^"']*\bMso/i,
108
110
  /\bmso-[\w-]+\s*:/i,
109
111
  /\[if\s+(?:gte\s+)?mso/i,
110
112
  /Microsoft Word/i
111
- ], m = [
113
+ ], g = [
112
114
  /\bListContainerWrapper\b/i,
113
115
  /\bdata-listid\s*=/i,
114
116
  /\bdata-list-defn-props\s*=/i,
115
117
  /\bdata-ccp-props\s*=/i,
116
118
  /\bdata-contrast\s*=/i
117
- ], h = [
119
+ ], ee = [
118
120
  /\b(?:WPS Office|Kingsoft)\b/i,
119
121
  /\bwpsoffice\b/i,
120
122
  /\bwps-(?:office|list|paragraph)\b/i
121
123
  ];
122
- function g(e) {
123
- return /\bdata-pm-slice\s*=/i.test(e) ? "internal" : h.some((t) => t.test(e)) ? "wps" : m.some((t) => t.test(e)) ? "word-online" : p.some((t) => t.test(e)) ? /Microsoft Word|Mso|xmlns:w/i.test(e) ? "word" : "office" : "generic";
124
- }
125
124
  function _(e) {
125
+ return /\bdata-pm-slice\s*=/i.test(e) ? "internal" : ee.some((t) => t.test(e)) ? "wps" : g.some((t) => t.test(e)) ? "word-online" : h.some((t) => t.test(e)) ? /Microsoft Word|Mso|xmlns:w/i.test(e) ? "word" : "office" : "generic";
126
+ }
127
+ function v(e) {
126
128
  return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;").split(/\r?\n\r?\n/).map((e) => `<p>${e.replace(/\r?\n/g, "<br>") || "<br>"}</p>`).join("");
127
129
  }
128
- function ee(e) {
130
+ function te(e) {
129
131
  let t = /(?:^|;)\s*mso-list\s*:\s*(?:l(\d+)\s+)?level(\d+)(?:\s+lfo(\d+))?/i.exec(e);
130
132
  if (t) return {
131
133
  id: t[1] ?? "0",
@@ -133,8 +135,8 @@ function ee(e) {
133
135
  lfo: t[3] ?? "0"
134
136
  };
135
137
  }
136
- function v(e, t = "span") {
137
- let n = t.toLowerCase(), r = n === "td" || n === "th" ? f : n === "table" ? d : n === "ul" || n === "ol" ? u : /^(?:p|div|h[1-6]|blockquote|li)$/.test(n) ? l : c, i = C(e), a = i.find(([e]) => e.trim().toLowerCase() === "direction")?.[1]?.trim().toLowerCase() === "rtl" ? "rtl" : "ltr", o = /* @__PURE__ */ new Map();
138
+ function y(e, t = "span") {
139
+ let n = t.toLowerCase(), r = n === "td" || n === "th" ? m : n === "table" ? p : n === "ul" || n === "ol" ? f : /^(?:p|div|h[1-6]|blockquote|li)$/.test(n) ? d : u, i = C(e), a = i.find(([e]) => e.trim().toLowerCase() === "direction")?.[1]?.trim().toLowerCase() === "rtl" ? "rtl" : "ltr", o = /* @__PURE__ */ new Map();
138
140
  for (let [e, t] of i) {
139
141
  let n = e.toLowerCase().trim(), i = t.trim().replace(/\s*!important\s*$/i, "");
140
142
  if (n === "mso-highlight" || n === "background") n = "background-color";
@@ -146,26 +148,26 @@ function v(e, t = "span") {
146
148
  }
147
149
  return Array.from(o.entries()).map(([e, t]) => `${e}: ${t}`).join("; ");
148
150
  }
149
- function y(e) {
151
+ function b(e) {
150
152
  if (!e || e.length > 12582912 * 3) return [];
151
153
  let t = [], n = 0, r = 0;
152
154
  for (; r < e.length;) {
153
155
  let i = e.indexOf("{\\pict", r);
154
156
  if (i < 0) break;
155
- let a = de(e, i);
157
+ let a = fe(e, i);
156
158
  if (a < 0) break;
157
159
  let o = e.slice(i, a + 1);
158
160
  r = i + 6;
159
- let s = fe(o), c = /\\pngblip\b/i.test(s) ? "image/png" : /\\jpe?gblip\b/i.test(s) ? "image/jpeg" : "";
161
+ let s = pe(o), c = /\\pngblip\b/i.test(s) ? "image/png" : /\\jpe?gblip\b/i.test(s) ? "image/jpeg" : "";
160
162
  if (!c) continue;
161
163
  let l = s.replace(/^\{\\pict\b/i, "").replace(/\\[a-z]+-?\d*\s?/gi, "").replace(/\\[^a-z]/gi, "").replace(/[{}\s]/g, "");
162
164
  if (!l || l.length % 2 || /[^\da-f]/i.test(l)) continue;
163
165
  let u = l.length / 2;
164
- u > 5242880 || n + u > 12582912 || me(l, c) && (n += u, t.push(`data:${c};base64,${pe(l)}`));
166
+ u > 5242880 || n + u > 12582912 || he(l, c) && (n += u, t.push(`data:${c};base64,${me(l)}`));
165
167
  }
166
168
  return t;
167
169
  }
168
- async function b(e, t) {
170
+ async function x(e, t) {
169
171
  let n = [], i = 0;
170
172
  for (let a of e) {
171
173
  let e = a.type.toLowerCase();
@@ -177,69 +179,67 @@ async function b(e, t) {
177
179
  n.push(Promise.resolve(null));
178
180
  continue;
179
181
  }
180
- i += a.size, n.push((t ? t(a) : he(a)).then((e) => e && Y(e) ? e : null).catch(() => null));
182
+ i += a.size, n.push((t ? t(a) : ge(a)).then((e) => e && Y(e) ? e : null).catch(() => null));
181
183
  }
182
184
  return Promise.all(n);
183
185
  }
184
- function x(e) {
185
- return /<(?:img|v:imagedata)\b[^>]+\bsrc\s*=\s*["']\s*(?:file:|cid:|mhtml:|wordml:)/i.test(e);
186
- }
187
186
  function S(e, r = {}) {
188
- let o = g(e);
189
- if (o === "internal" && r.trustedInternal) return {
187
+ let i = _(e);
188
+ if (i === "internal" && r.trustedInternal) return {
190
189
  html: e,
191
- source: o,
190
+ source: i,
192
191
  converted: !1,
193
192
  fallback: !1,
194
193
  recoveredImageCount: 0
195
194
  };
196
- let s = _(r.plainText ?? re(e));
195
+ let a = v(r.plainText ?? ie(e));
197
196
  if (!e || e.length > n || typeof window > "u" || typeof DOMParser > "u") return {
198
- html: s,
199
- source: o,
197
+ html: a,
198
+ source: i,
200
199
  converted: !0,
201
200
  fallback: !0,
202
201
  recoveredImageCount: 0
203
202
  };
204
203
  try {
205
- let n = o !== "generic" && o !== "internal", c = te(e), l = new DOMParser().parseFromString(n ? ne(c) : c, "text/html"), u = oe(l), d = u.size > 0 || A(l);
206
- (n || d) && k(l, u), n && (j(l), M(l));
207
- let f = n ? y(r.rtf ?? "") : [], p = H(l, {
204
+ let n = i !== "generic" && i !== "internal", c = ne(e), l = new DOMParser().parseFromString(n ? re(c) : c, "text/html"), u = k(l), d = u.size > 0 || j(l);
205
+ (n || d) && A(l, u), n && (M(l), N(l));
206
+ let f = n ? b(r.rtf ?? "") : [], p = !!r.preferClipboardImages && f.length === 0, m = U(l, {
208
207
  office: n,
209
208
  replacementImages: f.length ? f : r.clipboardImages ?? [],
210
- appendClipboardImages: f.length === 0 ? r.clipboardImages ?? [] : []
211
- }), m = t(window), h = String(m.sanitize(l.body.innerHTML, {
212
- ALLOWED_TAGS: i,
213
- ALLOWED_ATTR: a,
209
+ appendClipboardImages: f.length === 0 ? r.clipboardImages ?? [] : [],
210
+ preferClipboardImages: p
211
+ }), h = t(window), g = String(h.sanitize(l.body.innerHTML, {
212
+ ALLOWED_TAGS: o,
213
+ ALLOWED_ATTR: s,
214
214
  ALLOW_DATA_ATTR: !1,
215
215
  ALLOW_ARIA_ATTR: !1,
216
216
  KEEP_CONTENT: !0,
217
217
  RETURN_TRUSTED_TYPE: !1
218
218
  }));
219
219
  return {
220
- html: h || s,
221
- source: o,
220
+ html: g || a,
221
+ source: i,
222
222
  converted: !0,
223
- fallback: !h,
224
- recoveredImageCount: p
223
+ fallback: !g,
224
+ recoveredImageCount: m
225
225
  };
226
226
  } catch {
227
227
  return {
228
- html: s,
229
- source: o,
228
+ html: a,
229
+ source: i,
230
230
  converted: !0,
231
231
  fallback: !0,
232
232
  recoveredImageCount: 0
233
233
  };
234
234
  }
235
235
  }
236
- function te(e) {
236
+ function ne(e) {
237
237
  return /<!--StartFragment-->([\s\S]*?)<!--EndFragment-->/i.exec(e)?.[1] ?? e;
238
238
  }
239
- function ne(e) {
239
+ function re(e) {
240
240
  return e.replace(/<!--\s*\[if\s+!supportLists\]\s*>([\s\S]*?)<!\s*\[endif\]\s*-->/gi, "$1").replace(/<!\s*\[if\s+!supportLists\]\s*>([\s\S]*?)<!\s*\[endif\]\s*>/gi, "$1");
241
241
  }
242
- function re(e) {
242
+ function ie(e) {
243
243
  return e.replace(/<br\s*\/?>/gi, "\n").replace(/<\/(?:p|div|li|h[1-6]|tr)>/gi, "\n").replace(/<[^>]*>/g, "").replace(/&nbsp;/gi, " ").replace(/&amp;/gi, "&").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").trim();
244
244
  }
245
245
  function C(e) {
@@ -272,7 +272,7 @@ function w(e, t) {
272
272
  convertPt: !0,
273
273
  allowPercent: !0
274
274
  });
275
- if (e === "padding") return ae(n);
275
+ if (e === "padding") return oe(n);
276
276
  if (/^(?:margin-(?:top|bottom|left|right)|text-indent)$/.test(e)) return E(n, {
277
277
  min: -2e3,
278
278
  max: 2e3,
@@ -292,7 +292,7 @@ function w(e, t) {
292
292
  allowPercent: !0
293
293
  });
294
294
  }
295
- return e === "color" || e === "background-color" ? O(n) : e === "font-family" ? /^[\w\s,'"\-\u00A0-\uFFFF]+$/.test(n) ? n : "" : e === "font-weight" ? /^(?:normal|bold|bolder|lighter|[1-9]00)$/i.test(n) ? n.toLowerCase() : "" : e === "font-style" ? /^(?:normal|italic|oblique)$/i.test(n) ? n.toLowerCase() : "" : e === "text-decoration" ? /^(?:(?:none|underline|line-through|overline)\s*)+$/i.test(n) ? n.toLowerCase() : "" : e === "text-align" ? /^(?:left|right|center|justify|start|end)$/i.test(n) ? T(n, "ltr") : "" : e === "vertical-align" ? /^(?:top|middle|bottom|baseline|sub|super)$/i.test(n) ? n.toLowerCase() : "" : e === "direction" ? /^(?:ltr|rtl)$/i.test(n) ? n.toLowerCase() : "" : e === "list-style-type" ? /^(?:disc|circle|square|decimal|lower-alpha|upper-alpha|lower-roman|upper-roman|cjk-ideographic)$/i.test(n) ? n.toLowerCase() : "" : e === "table-layout" ? /^(?:auto|fixed)$/i.test(n) ? n.toLowerCase() : "" : e === "border-collapse" ? /^(?:collapse|separate)$/i.test(n) ? n.toLowerCase() : "" : /^border(?:-(?:top|right|bottom|left))?$/.test(e) ? ie(n) : "";
295
+ return e === "color" || e === "background-color" ? O(n) : e === "font-family" ? /^[\w\s,'"\-\u00A0-\uFFFF]+$/.test(n) ? n : "" : e === "font-weight" ? /^(?:normal|bold|bolder|lighter|[1-9]00)$/i.test(n) ? n.toLowerCase() : "" : e === "font-style" ? /^(?:normal|italic|oblique)$/i.test(n) ? n.toLowerCase() : "" : e === "text-decoration" ? /^(?:(?:none|underline|line-through|overline)\s*)+$/i.test(n) ? n.toLowerCase() : "" : e === "text-align" ? /^(?:left|right|center|justify|start|end)$/i.test(n) ? T(n, "ltr") : "" : e === "vertical-align" ? /^(?:top|middle|bottom|baseline|sub|super)$/i.test(n) ? n.toLowerCase() : "" : e === "direction" ? /^(?:ltr|rtl)$/i.test(n) ? n.toLowerCase() : "" : e === "list-style-type" ? /^(?:disc|circle|square|decimal|lower-alpha|upper-alpha|lower-roman|upper-roman|cjk-ideographic)$/i.test(n) ? n.toLowerCase() : "" : e === "table-layout" ? /^(?:auto|fixed)$/i.test(n) ? n.toLowerCase() : "" : e === "border-collapse" ? /^(?:collapse|separate)$/i.test(n) ? n.toLowerCase() : "" : /^border(?:-(?:top|right|bottom|left))?$/.test(e) ? ae(n) : "";
296
296
  }
297
297
  function T(e, t) {
298
298
  let n = e.toLowerCase();
@@ -313,7 +313,7 @@ function D(e) {
313
313
  function O(e) {
314
314
  return /^(?:windowtext|buttontext|canvastext)$/i.test(e) ? "black" : /^(?:window|buttonface|canvas)$/i.test(e) ? "white" : /^(?:transparent|currentcolor|black|white|red|green|blue|gray|grey|yellow|orange|purple|navy|teal|maroon|silver|fuchsia|aqua|lime)$/i.test(e) || /^#[\da-f]{3,8}$/i.test(e) ? e.toLowerCase() : /^(?:rgb|rgba|hsl|hsla)\(\s*[-\d.%]+(?:\s*[,/]\s*[-\d.%]+){2,3}\s*\)$/i.test(e) ? e : "";
315
315
  }
316
- function ie(e) {
316
+ function ae(e) {
317
317
  if (/^none$/i.test(e)) return "none";
318
318
  let t = /^((?:\d+(?:\.\d+)?|\.\d+)(?:px|pt))\s+(solid|dashed|dotted|double)\s+(.+)$/i.exec(e), n = /^(solid|dashed|dotted|double)\s+(.+?)\s+((?:\d+(?:\.\d+)?|\.\d+)(?:px|pt))$/i.exec(e), r = t?.[1] ?? n?.[3], i = t?.[2] ?? n?.[1], a = t?.[3] ?? n?.[2];
319
319
  if (!r || !i || !a) return "";
@@ -324,7 +324,7 @@ function ie(e) {
324
324
  }), s = O(a.trim());
325
325
  return o && s ? `${o} ${i.toLowerCase()} ${s}` : "";
326
326
  }
327
- function ae(e) {
327
+ function oe(e) {
328
328
  let t = e.trim().split(/\s+/);
329
329
  if (t.length < 1 || t.length > 4) return "";
330
330
  let n = t.map((e) => E(e, {
@@ -334,7 +334,7 @@ function ae(e) {
334
334
  }));
335
335
  return n.every(Boolean) ? n.join(" ") : "";
336
336
  }
337
- function oe(e) {
337
+ function k(e) {
338
338
  let t = /* @__PURE__ */ new Map();
339
339
  for (let n of Array.from(e.querySelectorAll("style"))) {
340
340
  let e = n.textContent ?? "", r = /([^{}]+)\{([^{}]*)\}/g, i = r.exec(e);
@@ -348,26 +348,26 @@ function oe(e) {
348
348
  }
349
349
  return t;
350
350
  }
351
- function k(e, t) {
351
+ function A(e, t) {
352
352
  for (let n of Array.from(e.body.querySelectorAll("[class]"))) {
353
353
  let e = Array.from(n.classList).map((e) => t.get(e) ?? "").filter(Boolean).join(";");
354
354
  e && n.setAttribute("style", `${e};${n.getAttribute("style") ?? ""}`);
355
355
  }
356
356
  }
357
- function A(e) {
357
+ function j(e) {
358
358
  return !!e.body.querySelector("p[align],div[align],h1[align],h2[align],h3[align],h4[align],h5[align],h6[align],center,font");
359
359
  }
360
- function j(e) {
360
+ function M(e) {
361
361
  for (let t of Array.from(e.body.querySelectorAll("p,div"))) {
362
362
  let n = t.className, r = t.getAttribute("style") ?? "", i = /(?:Mso)?Heading\s*([1-6])|MsoHeading([1-6])/i.exec(`${n};${r}`), a = i ? Number(i[1] ?? i[2]) : /MsoTitle/i.test(n) ? 1 : /MsoSubtitle/i.test(n) ? 2 : 0;
363
- a && V(e, t, `h${a}`);
363
+ a && H(e, t, `h${a}`);
364
364
  }
365
365
  }
366
- function M(e) {
366
+ function N(e) {
367
367
  let t = [e.body, ...Array.from(e.body.querySelectorAll("td,th,div,blockquote"))];
368
- for (let n of t.reverse()) N(e, n);
368
+ for (let n of t.reverse()) P(e, n);
369
369
  }
370
- function N(e, t) {
370
+ function P(e, t) {
371
371
  let n = Array.from(t.childNodes), r = [];
372
372
  for (let i of n) {
373
373
  if (i.nodeType === 3 && !(i.textContent ?? "").trim()) continue;
@@ -375,7 +375,7 @@ function N(e, t) {
375
375
  r = [];
376
376
  continue;
377
377
  }
378
- let n = i, a = P(n);
378
+ let n = i, a = F(n);
379
379
  if (!a) {
380
380
  r = [];
381
381
  continue;
@@ -397,15 +397,15 @@ function N(e, t) {
397
397
  }, r[o - 1] = s;
398
398
  }
399
399
  let c = e.createElement("li");
400
- for (R(n); n.firstChild;) c.appendChild(n.firstChild);
400
+ for (z(n); n.firstChild;) c.appendChild(n.firstChild);
401
401
  s.list.appendChild(c), s.lastItem = c, s.expectedStart = a.kind === "ol" ? (a.start ?? s.expectedStart ?? 1) + 1 : void 0, n.remove();
402
402
  }
403
403
  }
404
- function P(e) {
404
+ function F(e) {
405
405
  if (!/^(?:p|div)$/i.test(e.tagName)) return;
406
- let t = ee(e.getAttribute("style") ?? "");
406
+ let t = te(e.getAttribute("style") ?? "");
407
407
  if (!t) return;
408
- let n = z(e), r = n.text, i = n.font;
408
+ let n = B(e), r = n.text, i = n.font;
409
409
  if (/[•·●○■□◆◇▪▫]/.test(r) || /(?:Symbol|Wingdings|Webdings)/i.test(i)) {
410
410
  let e = /[○◇▫]/.test(r) ? "circle" : /[■□▪]/.test(r) ? "square" : "disc";
411
411
  return {
@@ -415,7 +415,7 @@ function P(e) {
415
415
  listStyleType: e
416
416
  };
417
417
  }
418
- let a = F(r);
418
+ let a = I(r);
419
419
  return {
420
420
  ...t,
421
421
  session: `${t.id}:${t.lfo}`,
@@ -425,7 +425,7 @@ function P(e) {
425
425
  start: a?.start
426
426
  };
427
427
  }
428
- function F(e) {
428
+ function I(e) {
429
429
  let t = e.trim().replace(/^[((]/, "").replace(/[))\..、]\s*$/, "").trim();
430
430
  if (/^\d+$/.test(t)) return {
431
431
  start: Math.max(1, Number(t)),
@@ -435,7 +435,7 @@ function F(e) {
435
435
  if (/^[ivxlcdm]+$/i.test(t)) {
436
436
  let e = t === t.toUpperCase();
437
437
  return {
438
- start: L(t),
438
+ start: R(t),
439
439
  type: e ? "I" : "i",
440
440
  listStyleType: e ? "upper-roman" : "lower-roman"
441
441
  };
@@ -449,12 +449,12 @@ function F(e) {
449
449
  };
450
450
  }
451
451
  if (/^[零〇一二三四五六七八九十百千万]+$/.test(t)) return {
452
- start: I(t),
452
+ start: L(t),
453
453
  type: void 0,
454
454
  listStyleType: "cjk-ideographic"
455
455
  };
456
456
  }
457
- function I(e) {
457
+ function L(e) {
458
458
  let t = {
459
459
  零: 0,
460
460
  〇: 0,
@@ -483,7 +483,7 @@ function I(e) {
483
483
  }
484
484
  return Math.max(1, r + i + a);
485
485
  }
486
- function L(e) {
486
+ function R(e) {
487
487
  let t = {
488
488
  i: 1,
489
489
  v: 5,
@@ -499,17 +499,17 @@ function L(e) {
499
499
  }
500
500
  return Math.max(1, n);
501
501
  }
502
- function R(e) {
503
- z(e).element?.remove(), e.firstChild?.nodeType === 3 && (e.firstChild.textContent = e.firstChild.textContent?.replace(/^[\s\u00A0]+/, "") ?? "");
504
- }
505
502
  function z(e) {
503
+ B(e).element?.remove(), e.firstChild?.nodeType === 3 && (e.firstChild.textContent = e.firstChild.textContent?.replace(/^[\s\u00A0]+/, "") ?? "");
504
+ }
505
+ function B(e) {
506
506
  let t = Array.from(e.querySelectorAll("span")).find((e) => /mso-list\s*:\s*ignore/i.test(e.getAttribute("style") ?? ""));
507
507
  if (t) return {
508
508
  element: t,
509
- text: B(t.textContent ?? ""),
509
+ text: V(t.textContent ?? ""),
510
510
  font: t.style.fontFamily
511
511
  };
512
- let n = e.querySelector("span"), r = B(n?.textContent ?? ""), i = n?.style.fontFamily ?? "";
512
+ let n = e.querySelector("span"), r = V(n?.textContent ?? ""), i = n?.style.fontFamily ?? "";
513
513
  return /[•·●○■□◆◇▪▫]/.test(r) || /(?:Symbol|Wingdings|Webdings)/i.test(i) || /^(?:\d+|[a-z]|[ivxlcdm]+)[.)、]$/i.test(r) || /^[((]?[零〇一二三四五六七八九十百千万]+[))\..、]$/.test(r) ? {
514
514
  element: n ?? void 0,
515
515
  text: r,
@@ -519,37 +519,37 @@ function z(e) {
519
519
  font: ""
520
520
  };
521
521
  }
522
- function B(e) {
522
+ function V(e) {
523
523
  return e.replace(/[\u00A0\s]+/g, " ").trim();
524
524
  }
525
- function V(e, t, n) {
525
+ function H(e, t, n) {
526
526
  let r = e.createElement(n);
527
527
  for (let e of Array.from(t.attributes)) r.setAttribute(e.name, e.value);
528
528
  for (; t.firstChild;) r.appendChild(t.firstChild);
529
529
  return t.replaceWith(r), r;
530
530
  }
531
- function H(e, t) {
532
- $(e.body), G(e), K(e), U(e);
531
+ function U(e, t) {
532
+ $(e.body), K(e), ce(e), W(e);
533
533
  let n = 0, r = 0, i = 0;
534
534
  for (let a of Array.from(e.body.querySelectorAll("*"))) {
535
- let c = a.tagName.toLowerCase();
536
- if (s.has(c)) {
535
+ let o = a.tagName.toLowerCase();
536
+ if (l.has(o)) {
537
537
  a.remove();
538
538
  continue;
539
539
  }
540
- if (q(a), c === "img") {
541
- let e = n < t.replacementImages.length, o = ce(a, t.replacementImages[n], e);
540
+ if (q(a), o === "img") {
541
+ let e = n < t.replacementImages.length, o = le(a, t.replacementImages[n], e, t.preferClipboardImages === !0);
542
542
  if (o.consumedReplacement && n++, o.usedReplacement && r++, !o.kept) continue;
543
543
  i++;
544
- } else c === "a" && le(a);
545
- let l = v(a.getAttribute("style") ?? "", c);
546
- l ? a.setAttribute("style", l) : a.removeAttribute("style"), W(e, a), se(e, a), Z(a);
544
+ } else o === "a" && ue(a);
545
+ let s = y(a.getAttribute("style") ?? "", o);
546
+ s ? a.setAttribute("style", s) : a.removeAttribute("style"), G(e, a), se(e, a), Z(a);
547
547
  for (let e of Array.from(a.attributes)) {
548
548
  let t = e.name.toLowerCase();
549
- (!o.has(t) || t.startsWith("on") || t.startsWith("data-") || t === "class" || t === "id" || t === "lang" || t.includes(":")) && a.removeAttribute(e.name);
549
+ (!c.has(t) || t.startsWith("on") || t.startsWith("data-") || t === "class" || t === "id" || t === "lang" || t.includes(":")) && a.removeAttribute(e.name);
550
550
  }
551
551
  let u = a.style.verticalAlign;
552
- (u === "super" || u === "sub") && c === "span" && V(e, a, u === "super" ? "sup" : "sub");
552
+ (u === "super" || u === "sub") && o === "span" && H(e, a, u === "super" ? "sup" : "sub");
553
553
  }
554
554
  if (!i && t.appendClipboardImages.length) for (let n of t.appendClipboardImages) {
555
555
  if (!n || !Y(n)) continue;
@@ -558,9 +558,9 @@ function H(e, t) {
558
558
  }
559
559
  return r;
560
560
  }
561
- function U(e) {
562
- for (let t of Array.from(e.body.querySelectorAll("font"))) q(t), V(e, t, "span");
563
- for (let t of Array.from(e.body.querySelectorAll("center"))) t.setAttribute("style", `${t.getAttribute("style") ?? ""};text-align:center`), V(e, t, "div");
561
+ function W(e) {
562
+ for (let t of Array.from(e.body.querySelectorAll("font"))) q(t), H(e, t, "span");
563
+ for (let t of Array.from(e.body.querySelectorAll("center"))) t.setAttribute("style", `${t.getAttribute("style") ?? ""};text-align:center`), H(e, t, "div");
564
564
  }
565
565
  function se(e, t) {
566
566
  let n = t.tagName.toLowerCase();
@@ -576,13 +576,13 @@ function se(e, t) {
576
576
  for (o.setAttribute("style", i.join("; ")); t.firstChild;) o.appendChild(t.firstChild);
577
577
  t.appendChild(o);
578
578
  }
579
- function W(e, t) {
579
+ function G(e, t) {
580
580
  let n = t.tagName.toLowerCase();
581
581
  if (!/^(?:p|div|h[1-6]|blockquote|li|td|th)$/.test(n)) return;
582
582
  let r = C(t.getAttribute("style") ?? ""), i = [], a = [];
583
583
  for (let [e, t] of r) {
584
584
  let r = e.trim().toLowerCase(), o = t.trim();
585
- (c.has(r) && r !== "vertical-align" && !((n === "td" || n === "th") && r === "background-color") ? i : a).push(`${r}: ${o}`);
585
+ (u.has(r) && r !== "vertical-align" && !((n === "td" || n === "th") && r === "background-color") ? i : a).push(`${r}: ${o}`);
586
586
  }
587
587
  if (!i.length) return;
588
588
  a.length ? t.setAttribute("style", a.join("; ")) : t.removeAttribute("style");
@@ -590,7 +590,7 @@ function W(e, t) {
590
590
  for (o.setAttribute("style", i.join("; ")); t.firstChild;) o.appendChild(t.firstChild);
591
591
  t.appendChild(o);
592
592
  }
593
- function G(e) {
593
+ function K(e) {
594
594
  for (let t of Array.from(e.body.querySelectorAll("*"))) {
595
595
  if (t.tagName.toLowerCase() !== "v:imagedata") continue;
596
596
  let n = e.createElement("img");
@@ -602,7 +602,7 @@ function G(e) {
602
602
  } else t.replaceWith(n);
603
603
  }
604
604
  }
605
- function K(e) {
605
+ function ce(e) {
606
606
  for (let t of Array.from(e.body.querySelectorAll("*")).reverse()) {
607
607
  let e = t.tagName.toLowerCase();
608
608
  if (e.includes(":")) {
@@ -623,19 +623,19 @@ function q(e) {
623
623
  function J(e) {
624
624
  return e ? /^\d+(?:\.\d+)?$/.test(e.trim()) ? `${e.trim()}px` : e.trim() : "";
625
625
  }
626
- function ce(e, t, n = !1) {
627
- let r = e.getAttribute("src") ?? "", i = /^(?:file:|cid:|mhtml:|wordml:)/i.test(r.trim()), a = i && t ? t : r;
628
- if (!Y(a)) return e.remove(), {
626
+ function le(e, t, n = !1, r = !1) {
627
+ let i = e.getAttribute("src") ?? "", o = a.test(i.trim()), s = (r || o) && n, c = !!(t && Y(t)), l = s && c, u = l && t ? t : i;
628
+ if (a.test(u.trim()) || !Y(u)) return e.remove(), {
629
629
  kept: !1,
630
630
  usedReplacement: !1,
631
- consumedReplacement: i && n
631
+ consumedReplacement: s
632
632
  };
633
- e.setAttribute("src", a.trim());
634
- let o = X(e.getAttribute("width") ?? e.style.width), s = X(e.getAttribute("height") ?? e.style.height);
635
- return o ? e.setAttribute("width", o) : e.removeAttribute("width"), s ? e.setAttribute("height", s) : e.removeAttribute("height"), e.setAttribute("alt", (e.getAttribute("alt") ?? "").slice(0, 500)), e.hasAttribute("title") && e.setAttribute("title", (e.getAttribute("title") ?? "").slice(0, 500)), {
633
+ e.setAttribute("src", u.trim());
634
+ let d = X(e.getAttribute("width") ?? e.style.width), f = X(e.getAttribute("height") ?? e.style.height);
635
+ return d ? e.setAttribute("width", d) : e.removeAttribute("width"), f ? e.setAttribute("height", f) : e.removeAttribute("height"), e.setAttribute("alt", (e.getAttribute("alt") ?? "").slice(0, 500)), e.hasAttribute("title") && e.setAttribute("title", (e.getAttribute("title") ?? "").slice(0, 500)), {
636
636
  kept: !0,
637
- usedReplacement: i && !!t,
638
- consumedReplacement: i && n
637
+ usedReplacement: l,
638
+ consumedReplacement: s
639
639
  };
640
640
  }
641
641
  function Y(t) {
@@ -648,15 +648,15 @@ function X(e) {
648
648
  let n = Number(t[1]), r = D((t[2] ?? "px").toLowerCase()), i = Math.round(n * r);
649
649
  return i >= 1 && i <= 2400 ? String(i) : "";
650
650
  }
651
- function le(e) {
651
+ function ue(e) {
652
652
  let t = (e.getAttribute("href") ?? "").trim();
653
- if (!ue(t)) {
653
+ if (!de(t)) {
654
654
  e.removeAttribute("href"), e.removeAttribute("target"), e.removeAttribute("rel");
655
655
  return;
656
656
  }
657
657
  e.setAttribute("href", t), e.getAttribute("target") === "_blank" ? e.setAttribute("rel", "noopener noreferrer") : (e.removeAttribute("target"), e.removeAttribute("rel"));
658
658
  }
659
- function ue(e) {
659
+ function de(e) {
660
660
  if (!e) return !1;
661
661
  let t = e.replace(/[\u0000-\u0020\u007F]+/g, "");
662
662
  return /^(?:javascript|vbscript|data|file):/i.test(t) ? !1 : /^(?:https?:|mailto:|tel:|#|\/|\.\/|\.\.\/)/i.test(t) || !/^[a-z][a-z\d+.-]*:/i.test(t);
@@ -684,7 +684,7 @@ function Q(e, t, n, r) {
684
684
  function $(e) {
685
685
  for (let t of Array.from(e.childNodes)) t.nodeType === 8 ? t.remove() : $(t);
686
686
  }
687
- function de(e, t) {
687
+ function fe(e, t) {
688
688
  let n = 0;
689
689
  for (let r = t; r < e.length; r++) {
690
690
  if (e[r] === "\\") {
@@ -696,7 +696,7 @@ function de(e, t) {
696
696
  }
697
697
  return -1;
698
698
  }
699
- function fe(e) {
699
+ function pe(e) {
700
700
  let t = 0, n = "";
701
701
  for (let r = 0; r < e.length; r++) {
702
702
  let i = e[r];
@@ -718,20 +718,20 @@ function fe(e) {
718
718
  }
719
719
  return n;
720
720
  }
721
- function pe(e) {
721
+ function me(e) {
722
722
  let t = [], n = new Uint8Array(e.length / 2);
723
723
  for (let t = 0; t < n.length; t++) n[t] = Number.parseInt(e.slice(t * 2, t * 2 + 2), 16);
724
724
  for (let e = 0; e < n.length; e += 32768) t.push(String.fromCharCode(...Array.from(n.subarray(e, e + 32768))));
725
725
  return btoa(t.join(""));
726
726
  }
727
- function me(e, t) {
727
+ function he(e, t) {
728
728
  return t === "image/png" ? e.toLowerCase().startsWith("89504e470d0a1a0a") : t === "image/jpeg" ? e.toLowerCase().startsWith("ffd8ff") : !1;
729
729
  }
730
- function he(e) {
730
+ function ge(e) {
731
731
  return new Promise((t, n) => {
732
732
  let r = new FileReader();
733
733
  r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("clipboard image read failed")), r.onload = () => t(typeof r.result == "string" ? r.result : ""), r.readAsDataURL(e);
734
734
  });
735
735
  }
736
736
  //#endregion
737
- export { g as detectClipboardHtmlSource, y as extractRtfImageDataUrls, x as hasLocalOfficeImageSource, v as normalizeOfficeStyle, S as normalizeWordClipboardHtml, _ as plainTextToSafeHtml, b as readClipboardImageFiles };
737
+ export { _ as detectClipboardHtmlSource, b as extractRtfImageDataUrls, y as normalizeOfficeStyle, S as normalizeWordClipboardHtml, v as plainTextToSafeHtml, x as readClipboardImageFiles };