@sw7d/paper-renderer 0.2.1 → 0.2.3

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.
@@ -1,15 +1,15 @@
1
1
  import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, defineComponent as a, nextTick as o, normalizeClass as s, normalizeStyle as c, onMounted as l, onUnmounted as u, openBlock as d, ref as f, renderList as p, shallowRef as m, toDisplayString as h, unref as g, vShow as _, watch as v, withDirectives as y, withModifiers as b } from "vue";
2
2
  //#region \0rolldown/runtime.js
3
- var x = Object.create, S = Object.defineProperty, C = Object.getOwnPropertyDescriptor, w = Object.getOwnPropertyNames, T = Object.getPrototypeOf, E = Object.prototype.hasOwnProperty, D = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), ee = (e, t, n, r) => {
3
+ var x = Object.create, S = Object.defineProperty, C = Object.getOwnPropertyDescriptor, w = Object.getOwnPropertyNames, T = Object.getPrototypeOf, E = Object.prototype.hasOwnProperty, D = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), O = (e, t, n, r) => {
4
4
  if (t && typeof t == "object" || typeof t == "function") for (var i = w(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !E.call(e, s) && s !== n && S(e, s, {
5
5
  get: ((e) => t[e]).bind(null, s),
6
6
  enumerable: !(r = C(t, s)) || r.enumerable
7
7
  });
8
8
  return e;
9
- }, O = (e, t, n) => (n = e == null ? {} : x(T(e)), ee(t || !e || !e.__esModule ? S(n, "default", {
9
+ }, k = (e, t, n) => (n = e == null ? {} : x(T(e)), O(t || !e || !e.__esModule ? S(n, "default", {
10
10
  value: e,
11
11
  enumerable: !0
12
- }) : n, e)), k = {
12
+ }) : n, e)), A = {
13
13
  A4: {
14
14
  width: 793,
15
15
  height: 1123,
@@ -30,7 +30,7 @@ var x = Object.create, S = Object.defineProperty, C = Object.getOwnPropertyDescr
30
30
  height: 779,
31
31
  label: "16K"
32
32
  }
33
- }, A = {
33
+ }, j = {
34
34
  A4: {
35
35
  w: 210,
36
36
  h: 297
@@ -47,9 +47,9 @@ var x = Object.create, S = Object.defineProperty, C = Object.getOwnPropertyDescr
47
47
  w: 260,
48
48
  h: 184
49
49
  }
50
- }, j = {
50
+ }, M = {
51
51
  A4: {
52
- columns: 1,
52
+ columns: 2,
53
53
  margins: [
54
54
  50,
55
55
  56,
@@ -101,13 +101,13 @@ var x = Object.create, S = Object.defineProperty, C = Object.getOwnPropertyDescr
101
101
  bodyTopOdd: 50
102
102
  }
103
103
  };
104
- function M(e) {
105
- return j[e];
104
+ function ee(e) {
105
+ return M[e];
106
106
  }
107
107
  function N(e) {
108
108
  if (!e) return {
109
109
  size: "A4",
110
- columns: 1
110
+ columns: 2
111
111
  };
112
112
  let t = e.match(/_(\d+)$/), n = t ? parseInt(t[1]) : 1, r = t ? e.replace(/_\d+$/, "") : e;
113
113
  return {
@@ -155,9 +155,9 @@ var te = class {
155
155
  getDefaultSettings() {
156
156
  return {
157
157
  paperSize: "A4",
158
- columns: 1,
159
- fontSize: 14,
160
- lineSpacing: 1.5,
158
+ columns: 2,
159
+ fontSize: 16,
160
+ lineSpacing: 1,
161
161
  margins: [
162
162
  50,
163
163
  56,
@@ -174,7 +174,7 @@ var te = class {
174
174
  };
175
175
  }
176
176
  updateDimensions() {
177
- let e = k[this.settings.paperSize];
177
+ let e = A[this.settings.paperSize];
178
178
  this.pageWidth = e.width, this.pageHeight = e.height;
179
179
  let [t, n, r, i] = this.settings.margins;
180
180
  this.contentWidth = e.width - i - n, this.contentHeight = e.height - t - r, this.columnGap = this.settings.columnGap, this.columnWidth = this.settings.columns > 1 ? (this.contentWidth - this.columnGap * (this.settings.columns - 1)) / this.settings.columns : this.contentWidth;
@@ -360,7 +360,10 @@ function re() {
360
360
  }
361
361
  }
362
362
  function ie(e, t, n, r) {
363
- return `${r ? "italic" : "normal"} ${n ? "bold" : "normal"} ${t}px ${e.includes(" ") && !e.includes("\"") && !e.includes("'") ? `"${e}"` : e}`;
363
+ return `${r ? "italic" : "normal"} ${n ? "bold" : "normal"} ${t}px ${e.split(",").map((e) => {
364
+ let t = e.trim();
365
+ return t.includes(" ") && !t.includes("\"") && !t.includes("'") ? `"${t}"` : t;
366
+ }).join(", ")}`;
364
367
  }
365
368
  function ae(e) {
366
369
  let t = e.charCodeAt(0);
@@ -435,11 +438,11 @@ function le() {
435
438
  function V(e) {
436
439
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
437
440
  }
438
- function ue(e, t, n, r, i, a, o, s) {
441
+ function H(e, t, n, r, i, a, o, s) {
439
442
  let c = "", l = 0;
440
- return c += de(t, i, n, l, o, s), l += 30, c += fe(e, r, l, s), l += 40, c += pe(e, l, a), c;
443
+ return c += ue(t, i, n, l, o, s), l += 30, c += de(e, r, l, s), l += 40, c += U(e, l, a), c;
441
444
  }
442
- function de(e, t, n, r, i, a) {
445
+ function ue(e, t, n, r, i, a) {
443
446
  let o = i && n > 0 ? `满分: ${n} 分` : "", s = o ? `<span class="swed-score" data-region="score">${V(o)}</span>` : "", { contentWidth: c, contentX: l } = e, u = a === "edit";
444
447
  return ` <foreignObject class="swed-header-block swed-header-block--school-info" transform="translate(${l}, ${r})" width="${c}" height="30" data-region="header-desc" opacity="1">
445
448
  <div class="swed-header-school-info">
@@ -448,7 +451,7 @@ function de(e, t, n, r, i, a) {
448
451
  </div>
449
452
  </foreignObject>\n`;
450
453
  }
451
- function fe(e, t, n, r) {
454
+ function de(e, t, n, r) {
452
455
  let { contentWidth: i, contentX: a } = e, o = r === "edit";
453
456
  return ` <foreignObject class="swed-header-block swed-header-block--paper-name" transform="translate(${a}, ${n})" width="${i}" height="40" data-region="paper-name" opacity="1">
454
457
  <div class="swed-header-paper-name">
@@ -459,42 +462,37 @@ function fe(e, t, n, r) {
459
462
  </div>
460
463
  </foreignObject>\n`;
461
464
  }
462
- function pe(e, t, n) {
465
+ function U(e, t, n) {
463
466
  let { contentWidth: r, contentX: i } = e;
464
467
  return ` <foreignObject class="swed-header-block swed-header-block--student-info" transform="translate(${i}, ${t})" width="${r}" height="100" opacity="1">
465
468
  <div class="swed-header-student-info">
466
469
  <div answer-sheet-edit-personal-element="qrCode" class="swed-qr-code-img" data-region="qr-code">
467
- <img src="${n || "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Crect width='60' height='60' fill='%23ddd'/%3E%3Ctext x='30' y='35' text-anchor='middle' font-size='10' fill='%23999'%3EQR%3C/text%3E%3C/svg%3E"}" style="width:65px;height:65px;" />
470
+ <img src="${n || "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Crect width='60' height='60' fill='%23ddd'/%3E%3Ctext x='30' y='35' text-anchor='middle' font-size='10' fill='%23999'%3EQR%3C/text%3E%3C/svg%3E"}" style="width:65px;height:65px;border:1px solid #000;" />
468
471
  </div>
469
472
  <div class="swed-student-fields">
470
473
  <div class="swed-student-fields-row">
471
474
  <div class="swed-student-field" data-region="student-name"><span class="swed-label">姓名:</span><div class="swed-underline swed-studentName"></div></div>
472
475
  <div class="swed-student-field" data-region="student-class"><span class="swed-label">班级:</span><div class="swed-underline swed-clazzName"></div></div>
473
476
  </div>
474
- <div class="swed-student-code" data-region="student-code">准考证号: <table student-code-num="8" class="swed-student-code-table studyNo"><tbody><tr>${"<td class=\"swed-student-code-cell\"></td>".repeat(8)}</tr></tbody></table></div>
477
+ <div class="swed-student-code"><span data-region="student-code">准考证号: <table student-code-num="8" class="swed-student-code-table studyNo"><tbody><tr>${"<td class=\"swed-student-code-cell\"></td>".repeat(8)}</tr></tbody></table></span><div class="swed-student-code-filler" data-region="student-code-filler"></div></div>
475
478
  </div>
476
479
  </div>
477
480
  </foreignObject>\n`;
478
481
  }
479
- function me(e, t, n, r, i) {
480
- let a = r && t > 0 ? `满分: ${t} 分` : "", o = a ? `<span class="swed-score" data-region="score">${V(a)}</span>` : "", { contentWidth: s, contentX: c } = e, l = i === "edit";
481
- return ` <foreignObject class="swed-header-block swed-header-block--school-info" transform="translate(${c}, 0)" width="${s}" height="30" opacity="1">
482
- <div class="swed-header-school-info swed-header-school-info--simple">
483
- <div contenteditable="${l ? "true" : "false"}" class="swed-headerDesc${l ? " swed-editable-dashed" : ""}" data-editable="schoolName" data-region="header-desc">${V(n)}</div>
484
- ${o}
485
- </div>
486
- </foreignObject>\n`;
482
+ function fe(e, t, n, r, i, a) {
483
+ let o = i && t > 0 ? `满分: ${t} 分` : "", s = o ? `<span class="swed-score" data-region="score">${V(o)}</span>` : "", { contentWidth: c, contentX: l } = e, u = a === "edit";
484
+ return ` <foreignObject transform="translate(${l}, 0)" width="30" height="30" opacity="1">\n <img src="${r || "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30'%3E%3Crect width='30' height='30' fill='%23ddd'/%3E%3Ctext x='15' y='20' text-anchor='middle' font-size='8' fill='%23999'%3EQR%3C/text%3E%3C/svg%3E"}" style="width:30px;height:30px;border:1px solid #000;display:block;" />\n </foreignObject>\n <foreignObject class="swed-header-block swed-header-block--school-info" transform="translate(${l + 30 + 5}, 0)" width="${c - 30 - 5}" height="30" opacity="1">\n <div class="swed-header-school-info swed-header-school-info--simple">\n <div contenteditable="${u ? "true" : "false"}" class="swed-headerDesc${u ? " swed-editable-dashed" : ""}" data-editable="schoolName" data-region="header-desc">${V(n)}</div>\n ${s}\n </div>\n </foreignObject>\n`;
487
485
  }
488
- function he() {
486
+ function pe() {
489
487
  return " <foreignObject class=\"swed-vueplug\" transform=\"translate(0, 0)\" width=\"681\" height=\"50\">\n <div class=\"swed-tail-time-wrapper\">\n <div class=\"swed-answer-wrapper\" style=\"display:none;\">\n <div class=\"swed-tail-col\"><p class=\"swed-text\">作答时长</p><p class=\"swed-text swed-text-second\">请在框内填涂</p></div>\n <div class=\"swed-tail-col swed-center-col\">\n <i class=\"swed-el-icon swed-tail-label swed-triangle\"><svg viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\" style=\"width:14px;height:14px;\"><path fill=\"currentColor\" d=\"M384 192v640l384-320.064z\"></path></svg></i>\n <div class=\"swed-rect swed-rect-fill swed-text-second\"></div>\n </div>\n <div class=\"swed-tail-col swed-center-col swed-tail-col-item\"><p class=\"swed-tail-label swed-text\">10分钟以内</p><div class=\"swed-rect swed-rect-stroke swed-text-second swed-tail-time\" time=\"0\"></div></div>\n <div class=\"swed-tail-col swed-center-col swed-tail-col-item\"><p class=\"swed-tail-label swed-text\">10-20分钟</p><div class=\"swed-rect swed-rect-stroke swed-text-second swed-tail-time\" time=\"10\"></div></div>\n <div class=\"swed-tail-col swed-center-col swed-tail-col-item\"><p class=\"swed-tail-label swed-text\">20-30分钟</p><div class=\"swed-rect swed-rect-stroke swed-text-second swed-tail-time\" time=\"20\"></div></div>\n <div class=\"swed-tail-col swed-center-col swed-tail-col-item\"><p class=\"swed-tail-label swed-text\">&gt;30分钟</p><div class=\"swed-rect swed-rect-stroke swed-text-second swed-tail-time\" time=\"30\"></div></div>\n </div>\n <div class=\"swed-tail-col swed-revise-wrapper\" style=\"display:none;\">\n <p class=\"swed-text\">订正情况</p>\n <i class=\"swed-el-icon swed-triangle\" style=\"font-size:14px;margin:0 8px;\"><svg viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\" style=\"width:14px;height:14px;\"><path fill=\"currentColor\" d=\"M384 192v640l384-320.064z\"></path></svg></i>\n <div class=\"swed-revise-area swed-center-col\"><p class=\"swed-revise-area-label\">已订正</p><div class=\"swed-revise-area-rect\"></div></div>\n </div>\n </div>\n </foreignObject>\n";
490
488
  }
491
- function ge() {
489
+ function me() {
492
490
  return "<defs>\n<polygon id=\"break\" fill=\"#6B8AB8\" points=\"12 0 12 60 0 52 15.5 90 30 52 18 60 18 0\"></polygon>\n<polygon id=\"enter\" fill=\"#6B8AB8\" points=\"44 0 52 0 52 45 16 45 29 62 25.5 66 0 41 25.5 17 29 20.5 16 37 44 37\"></polygon>\n</defs>\n";
493
491
  }
494
492
  //#endregion
495
493
  //#region src/engine/svg/optionsRenderer.ts
496
- function H(e, t, n, r, i) {
497
- let a = t - 20, o = ` <g class="swed-option" transform="translate(0, ${n})">\n`, s = e.map((e) => _e(e, 20, a)), c = e.map((e) => e.paragraphs.reduce((e, t) => e + (t.height || 26), 0)), l = e.length, u = Math.max(...s);
494
+ function he(e, t, n, r, i) {
495
+ let a = t - 20, o = ` <g class="swed-option" transform="translate(0, ${n})">\n`, s = e.map((e) => ge(e, 20, a)), c = e.map((e) => e.paragraphs.reduce((e, t) => e + (t.height || 26), 0)), l = e.length, u = Math.max(...s);
498
496
  if (l > 0 && u * l <= t) {
499
497
  let n = t / l, a = n - 20;
500
498
  for (let t = 0; t < l; t++) {
@@ -503,7 +501,7 @@ function H(e, t, n, r, i) {
503
501
  let c = e[t].paragraphs[0]?.lines[0]?.baseline || r * 1.56;
504
502
  o += ` <text class="swed-text" xml:space="preserve" font-size="${r}" font-weight="normal" font-family="Times New Roman" font-style="normal" fill="#000000" fill-opacity="1" y="${c.toFixed(3)}">${V(e[t].label)}.</text>\n`, o += " <g>\n";
505
503
  let l = 0;
506
- for (let n of e[t].paragraphs) o += xe(n, a, l, !1, "", r, i, 20), l += n.height || 26;
504
+ for (let n of e[t].paragraphs) o += be(n, a, l, !1, "", r, i, 20), l += n.height || 26;
507
505
  o += " </g>\n", o += " </g>\n";
508
506
  }
509
507
  return o += " </g>\n", o;
@@ -514,12 +512,12 @@ function H(e, t, n, r, i) {
514
512
  let n = e[t].paragraphs[0]?.lines[0]?.baseline || r * 1.56;
515
513
  o += ` <text class="swed-text" xml:space="preserve" font-size="${r}" font-weight="normal" font-family="Times New Roman" font-style="normal" fill="#000000" fill-opacity="1" y="${n.toFixed(3)}">${V(e[t].label)}.</text>\n`, o += " <g>\n";
516
514
  let s = 0;
517
- for (let n of e[t].paragraphs) o += xe(n, a, s, !1, "", r, i, 20), s += n.height || 26;
515
+ for (let n of e[t].paragraphs) o += be(n, a, s, !1, "", r, i, 20), s += n.height || 26;
518
516
  o += " </g>\n", o += " </g>\n", d += c[t];
519
517
  }
520
518
  return o += " </g>\n", o;
521
519
  }
522
- function _e(e, t, n) {
520
+ function ge(e, t, n) {
523
521
  let r = 0;
524
522
  for (let t of e.paragraphs) for (let e of t.lines) {
525
523
  let t = 0;
@@ -528,9 +526,9 @@ function _e(e, t, n) {
528
526
  }
529
527
  return t + Math.min(r, n);
530
528
  }
531
- function U(e, t) {
529
+ function _e(e, t) {
532
530
  if (e.length === 0) return 0;
533
- let n = e.map((e) => _e(e, 20, t)), r = e.map((e) => e.paragraphs.reduce((e, t) => e + (t.height || 26), 0)), i = e.length;
531
+ let n = e.map((e) => ge(e, 20, t)), r = e.map((e) => e.paragraphs.reduce((e, t) => e + (t.height || 26), 0)), i = e.length;
534
532
  return Math.max(...n) * i <= t ? Math.max(...r) : r.reduce((e, t) => e + t, 0);
535
533
  }
536
534
  //#endregion
@@ -538,9 +536,9 @@ function U(e, t) {
538
536
  function ve(e, t) {
539
537
  return e.baseline > 0 ? e.baseline : t * 1.56;
540
538
  }
541
- function ye(e, t, n, r, i, a, o, s, c, l) {
539
+ function W(e, t, n, r, i, a, o, s, c, l) {
542
540
  let u = t.metadata?.topicId || t.id, d = e.width || 333.5, f = e.height || 100, p = "";
543
- r && (p += ` <rect x="0.5" y="${n - .5}" width="${d}" height="${f}" fill="none" stroke="rgba(85,165,255,0.4)" stroke-width="0.5" stroke-dasharray="4,4" />\n`), i && l === "edit" && (p += ` <rect x="0" y="${n - 1}" width="${d + 2}" height="${f + 2}" fill="none" stroke="#409eff" stroke-width="1.5" rx="2" />\n`), p += ` <g class="swed-question" transform="translate(0, ${n})" topicid="${u}" data-block-id="${t.id}">\n`;
541
+ r && (p += ` <rect x="0.5" y="${n - .5}" width="${d}" height="${f}" fill="none" stroke="rgba(85,165,255,0.4)" stroke-width="0.5" stroke-dasharray="4,4" />\n`), p += ` <g class="swed-question" transform="translate(0, ${n})" topicid="${u}" data-block-id="${t.id}">\n`;
544
542
  let m = t.type === "question" && t.metadata?.questionNo || "", h = t.paragraphs[0]?.lines[0], g = h ? ve(h, s) : 20, _ = 0;
545
543
  t.type === "question" ? _ = m.length > 2 ? 26.25 : 17.5 : t.type === "sub-question" && (_ = 26.25);
546
544
  let v = e.paragraphStart, y = Math.min(v + e.paragraphCount, t.paragraphs.length), b = 0;
@@ -549,29 +547,29 @@ function ye(e, t, n, r, i, a, o, s, c, l) {
549
547
  b += n.height || n.lines.reduce((e, t) => e + t.lineHeight, 0) || 26;
550
548
  }
551
549
  let x = 0;
552
- t.options && t.options.length > 0 && o && (x = U(t.options, d - _), b += x);
550
+ t.options && t.options.length > 0 && o && (x = _e(t.options, d - _), b += x);
553
551
  let S = Math.max(b, e.height), C = (t.type === "question" || t.type === "sub-question") && e.paragraphCount > 0;
554
552
  C && l === "edit" && (p += ` <rect class="swed-question-hitarea" x="0" y="0" width="${d}" height="${S}" fill="transparent" />\n`), p += " <g>\n", p += ` <g class="swed-question-stem" transform="translate(${_}, 0)">\n`;
555
553
  let w = a && c && t.metadata?.score || "", T = 0, E = !1;
556
554
  for (let e = v; e < y; e++) {
557
555
  let n = t.paragraphs[e], r = !(n.lines.length > 0 && n.lines.every((e) => e.elements.length > 0 && e.elements.every((e) => e.type === "enter"))) && !E;
558
- p += xe(n, d - _, T, r, w, s, l), r && (E = !0), T += n.height || n.lines.reduce((e, t) => e + t.lineHeight, 0) || 26;
556
+ p += be(n, d - _, T, r, w, s, l), r && (E = !0), T += n.height || n.lines.reduce((e, t) => e + t.lineHeight, 0) || 26;
559
557
  }
560
558
  if (t.options && t.options.length > 0 && o) {
561
559
  let e = d - _;
562
- p += H(t.options, e, T, s, l), T += x;
560
+ p += he(t.options, e, T, s, l), T += x;
563
561
  }
564
562
  if (p += " </g>\n", p += " </g>\n", C && l === "edit" && (p += ` <path class="swed-question-border" d="M 0.5 0 L ${d - .5} 0 L ${d - .5} ${S} L 0.5 ${S} Z" stroke="#231815" stroke-dasharray="2,5" transform="translate(0.5, 0)" stroke-width="0.5" fill="none" pointer-events="none"></path>\n`), a) {
565
563
  if (m) {
566
564
  let e = m.length > 2;
567
- p += ` <text class="swed-topic-no" font-size="14" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(0, ${g.toFixed(2)})" x="4">${V(m)}</text>\n`, e ? p += ` <text class="swed-topic-no" font-size="14" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(20.25, ${g.toFixed(2)})"></text>\n` : p += ` <text class="swed-topic-no" font-size="14" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(11.5, ${g.toFixed(2)})"></text>\n`;
565
+ p += ` <text class="swed-topic-no" font-size="${s}" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(0, ${g.toFixed(2)})" x="4">${V(m)}</text>\n`, e ? p += ` <text class="swed-topic-no" font-size="${s}" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(20.25, ${g.toFixed(2)})"></text>\n` : p += ` <text class="swed-topic-no" font-size="${s}" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(11.5, ${g.toFixed(2)})"></text>\n`;
568
566
  }
569
567
  let e = t.metadata?.subLabel || "";
570
- e && (p += ` <text class="swed-topic-no" font-size="14" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(4, ${g.toFixed(2)})">${V(e)}</text>\n`, p += ` <text class="swed-topic-no" font-size="14" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(20.25, ${g.toFixed(2)})"></text>\n`);
568
+ e && (p += ` <text class="swed-topic-no" font-size="${s}" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(4, ${g.toFixed(2)})">${V(e)}</text>\n`, p += ` <text class="swed-topic-no" font-size="${s}" font-weight="normal" font-family="SimSun,STSong" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(20.25, ${g.toFixed(2)})"></text>\n`);
571
569
  }
572
570
  return p += " </g>\n", p;
573
571
  }
574
- function be(e, t, n, r = 0, i = !0, a = !1, o = "edit") {
572
+ function ye(e, t, n, r = 0, i = !0, a = !1, o = "edit") {
575
573
  let s = e.metadata?.label || "", c = e.height || 40;
576
574
  if (!s) return "";
577
575
  let l = i && e.metadata?.score || "", u = "";
@@ -583,7 +581,7 @@ function be(e, t, n, r = 0, i = !0, a = !1, o = "edit") {
583
581
  </div>
584
582
  </foreignObject>\n`, u;
585
583
  }
586
- function xe(e, t, n, r, i = "", a, o, s = 0) {
584
+ function be(e, t, n, r, i = "", a, o, s = 0) {
587
585
  let c = "", l = 0;
588
586
  for (let n = 0; n < e.lines.length; n++) {
589
587
  let s = e.lines[n], u = ve(s, a), d = r && n === 0, f = s.elements.length > 0 && s.elements.every((e) => e.type === "enter"), p = s.lineHeight;
@@ -605,7 +603,7 @@ function xe(e, t, n, r, i = "", a, o, s = 0) {
605
603
  e.justification === "center" ? r = Math.max(0, (i - n) / 2) : e.justification === "right" && (r = Math.max(0, i - n));
606
604
  }
607
605
  let i = s.elements.length > 0 && s.elements.every((e) => e.type === "image");
608
- for (let e of s.elements) c += Se(e, m + r + (s.offsetX || 0), u, s.lineHeight, f, o, e.type === "image" ? e.id : void 0, e.type === "image" ? i : void 0), m += e.width;
606
+ for (let e of s.elements) c += xe(e, m + r + (s.offsetX || 0), u, s.lineHeight, f, o, a, e.type === "image" ? e.id : void 0, e.type === "image" ? i : void 0), m += e.width;
609
607
  if (o === "edit" && n === e.lines.length - 1) {
610
608
  let e = m + r + (s.offsetX || 0) + 2;
611
609
  c += ` <g class="swed-enter" transform="translate(${e.toFixed(2)}, ${(u - 10).toFixed(2)})">\n`, c += " <use href=\"#enter\" transform=\"scale(0.013)\" fill=\"#c8c8c8\" opacity=\"0.5\"></use>\n", c += " </g>\n";
@@ -615,7 +613,7 @@ function xe(e, t, n, r, i = "", a, o, s = 0) {
615
613
  }
616
614
  return ` <g class="swed-paragraph" transform="translate(${s}, ${n})">\n${c} </g>\n`;
617
615
  }
618
- function Se(e, t, n, r, i, a, o, s) {
616
+ function xe(e, t, n, r, i, a, o, s, c) {
619
617
  switch (e.type) {
620
618
  case "text": {
621
619
  let r = e, i = r.italic ? "italic" : "normal", a = r.bold ? "bold" : "normal", o = n + (r.verticalAlign || 0), s = r.value.split(""), c = r.xPositions.length === s.length ? r.xPositions.map((e) => (e + t).toFixed(2)).join(" ") : B(r.value, r.fontSize, r.fontFamily, r.bold, r.italic).map((e) => (e + t).toFixed(2)).join(" "), l = "";
@@ -650,7 +648,12 @@ function Se(e, t, n, r, i, a, o, s) {
650
648
  return l;
651
649
  }
652
650
  case "formula": {
653
- let r = e, i = r.svgContent.match(/vertical-align:\s*([-\d.]+)ex/), a = i ? parseFloat(i[1]) * 7 : -(r.height || 20), o = Math.round(n + a);
651
+ let r = e, i = r.svgContent.match(/vertical-align:\s*([-\d.]+)(px|ex)/), a;
652
+ if (i) {
653
+ let e = parseFloat(i[1]);
654
+ a = i[2] === "ex" ? e * 7 : e;
655
+ } else a = -(r.height || 20);
656
+ let o = Math.round(n + a);
654
657
  return ` <g class="swed-formula" transform="translate(${t.toFixed(2)}, ${o})">\n${r.svgContent} </g>\n`;
655
658
  }
656
659
  case "underline": {
@@ -668,11 +671,11 @@ function Se(e, t, n, r, i, a, o, s) {
668
671
  case "image": {
669
672
  let r = e;
670
673
  if (r.rawHtml && !r.src) {
671
- let e = o ? ` data-image-id="${o}"` : "", i = (r.width / 2).toFixed(2), a = (r.height / 2).toFixed(2), c = s ? "0" : (n - r.height / 2).toFixed(2);
672
- return ` <g class="swed-image swed-image-placeholder" transform="translate(${t.toFixed(2)}, ${c})"${e}>\n <rect x="0" y="0" width="${r.width}" height="${r.height}" fill="#f5f5f5" stroke="#999" stroke-width="1" stroke-dasharray="4,3" rx="4" ry="4" />\n <text x="${i}" y="${a}" text-anchor="middle" dominant-baseline="central" font-size="13" fill="#999">[表格加载中…]</text>\n </g>\n`;
674
+ let e = s ? ` data-image-id="${s}"` : "", i = (r.width / 2).toFixed(2), a = (r.height / 2).toFixed(2), o = c ? "0" : (n - r.height / 2).toFixed(2);
675
+ return ` <g class="swed-image swed-image-placeholder" transform="translate(${t.toFixed(2)}, ${o})"${e}>\n <rect x="0" y="0" width="${r.width}" height="${r.height}" fill="#f5f5f5" stroke="#999" stroke-width="1" stroke-dasharray="4,3" rx="4" ry="4" />\n <text x="${i}" y="${a}" text-anchor="middle" dominant-baseline="central" font-size="13" fill="#999">[表格加载中…]</text>\n </g>\n`;
673
676
  }
674
- let i = s ? "0" : (n - r.height / 2).toFixed(2), c = o ? ` data-image-id="${o}"` : "", l = a === "edit" ? " style=\"cursor:move\"" : "";
675
- return ` <g class="swed-image" transform="translate(${t.toFixed(2)}, ${i})"${c}${l}>\n <image href="${r.src}" width="${r.width}" height="${r.height}" preserveAspectRatio="xMidYMid meet" />\n </g>\n`;
677
+ let i = c ? "0" : (n - r.height / 2).toFixed(2), o = s ? ` data-image-id="${s}"` : "", l = a === "edit" ? " style=\"cursor:move\"" : "";
678
+ return ` <g class="swed-image" transform="translate(${t.toFixed(2)}, ${i})"${o}${l}>\n <image href="${r.src}" width="${r.width}" height="${r.height}" preserveAspectRatio="xMidYMid meet" />\n </g>\n`;
676
679
  }
677
680
  case "enter": {
678
681
  let r = e, i = .013;
@@ -683,7 +686,7 @@ function Se(e, t, n, r, i, a, o, s) {
683
686
  }
684
687
  //#endregion
685
688
  //#region src/engine/SvgRenderer.ts
686
- var Ce = class {
689
+ var Se = class {
687
690
  FOOTER_EXTRA_GAP = 9.2;
688
691
  renderMode;
689
692
  constructor(e) {
@@ -723,19 +726,20 @@ var Ce = class {
723
726
  }
724
727
  renderAllPages(e, t, n, r) {
725
728
  if (e.length === 0) return "";
726
- let { showBBoxes: i = !1, selectedBlockId: a = null, totalScore: o = 0, paperName: s = "", qrCodeImage: c = "" } = r || {}, l = e[0].width, u = e[0].height, d = e.length * u, f = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${l}" height="${d}" viewBox="0 0 ${l} ${d}">\n`;
727
- f += ge();
729
+ let { showBBoxes: i = !1, selectedBlockId: a = null, totalScore: o = 0, paperName: s = "", qrCodeImage: c = "", qrCodeImages: l } = r || {}, u = e[0].width, d = e[0].height, f = e.length * d, p = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${u}" height="${f}" viewBox="0 0 ${u} ${f}">\n`;
730
+ p += me();
728
731
  for (let r = 0; r < e.length; r++) {
729
- let l = e[r], d = r % 2 == 0 ? n.bodyTopEven ?? 173 : n.bodyTopOdd ?? 50, p = r * u;
730
- f += `<g class="swed-page" transform="translate(0, ${p})">\n`, f += this.renderPageContent(l, t, d, n, r, e.length, {
732
+ let u = e[r], f = r % 2 == 0 ? n.bodyTopEven ?? 173 : n.bodyTopOdd ?? 50, m = r * d;
733
+ p += `<g class="swed-page" transform="translate(0, ${m})">\n`, p += this.renderPageContent(u, t, f, n, r, e.length, {
731
734
  showBBoxes: i,
732
735
  selectedBlockId: a,
733
736
  totalScore: o,
734
737
  paperName: s,
738
+ qrCodeImages: l,
735
739
  qrCodeImage: c
736
- }), f += "</g>\n";
740
+ }), p += "</g>\n";
737
741
  }
738
- return f += "</svg>", f;
742
+ return p += "</svg>", p;
739
743
  }
740
744
  renderPage(e, t, n, r, i = {
741
745
  showBBoxes: !1,
@@ -743,14 +747,15 @@ var Ce = class {
743
747
  totalScore: 0,
744
748
  paperName: ""
745
749
  }, a = 1, o = !0) {
746
- let { totalScore: s = 0, paperName: c = "", schoolName: l = "", qrCodeImage: u = "" } = i, d = "";
747
- return o && (d += ge()), d += this.renderPageContent(e, t, n, r, e.index, a, {
750
+ let { totalScore: s = 0, paperName: c = "", schoolName: l = "", qrCodeImage: u = "", qrCodeImages: d } = i, f = "";
751
+ return o && (f += me()), f += this.renderPageContent(e, t, n, r, e.index, a, {
748
752
  ...i,
749
753
  totalScore: s,
750
754
  paperName: c,
751
755
  schoolName: l,
756
+ qrCodeImages: d,
752
757
  qrCodeImage: u
753
- }), d;
758
+ }), f;
754
759
  }
755
760
  computePageRegions(e, t, n, r, i = 1) {
756
761
  let [a, o, s, c] = r.margins || [
@@ -758,7 +763,7 @@ var Ce = class {
758
763
  55.5,
759
764
  56,
760
765
  56
761
- ], l = c, u = e.width - l - o, d = r.columnGap ?? 15.5, f = r.columns || 1, p = f > 1 ? (u - d * (f - 1)) / f : u, m = e.height - s - this.FOOTER_EXTRA_GAP, h = typeof r.fontSize == "number" ? r.fontSize : 14, g = [], _ = this.groupBlocksByColumn(e.blocks);
766
+ ], l = c, u = e.width - l - o, d = r.columnGap ?? 15.5, f = r.columns || 1, p = f > 1 ? (u - d * (f - 1)) / f : u, m = e.height - s - this.FOOTER_EXTRA_GAP, h = typeof r.fontSize == "number" ? r.fontSize : 16, g = [], _ = this.groupBlocksByColumn(e.blocks);
762
767
  for (let e = 0; e < _.length; e++) for (let r of _[e]) {
763
768
  let e = t.find((e) => e.id === r.blockId);
764
769
  if (!e) continue;
@@ -779,7 +784,7 @@ var Ce = class {
779
784
  let u = o + r.paragraphCount >= e.paragraphs.length;
780
785
  if (e.options && e.options.length > 0 && u) {
781
786
  let t = r.width || p, n = e.type === "question" && e.metadata?.questionNo || "", i = e.type === "question" ? n.length > 2 ? 26.25 : 17.5 : 26.25;
782
- c += U(e.options, t - i);
787
+ c += _e(e.options, t - i);
783
788
  }
784
789
  let d = Math.max(c, r.height);
785
790
  g.push({
@@ -791,9 +796,9 @@ var Ce = class {
791
796
  }
792
797
  });
793
798
  }
794
- if (_.length > 1) {
799
+ if (f > 1) {
795
800
  let e = m - n;
796
- for (let t = 1; t < _.length; t++) {
801
+ for (let t = 1; t < f; t++) {
797
802
  let r = t * (p + d) - d / 2;
798
803
  g.push({
799
804
  type: "column-separator",
@@ -872,7 +877,7 @@ var Ce = class {
872
877
  }
873
878
  }
874
879
  getOptionsHeight(e, t) {
875
- return U(e, t);
880
+ return _e(e, t);
876
881
  }
877
882
  renderPageContent(e, t, n, r, i, a, o) {
878
883
  let [s, c, l, u] = r.margins || [
@@ -880,33 +885,33 @@ var Ce = class {
880
885
  55.5,
881
886
  56,
882
887
  56
883
- ], d = u, f = c, p = e.width - d - f, m = r.columnGap ?? 15.5, h = r.columns || 1, g = h > 1 ? (p - m * (h - 1)) / h : p, _ = e.height - l - this.FOOTER_EXTRA_GAP, v = r.fontSize, y = typeof v == "number" ? v : 14, b = "";
888
+ ], d = u, f = c, p = e.width - d - f, m = r.columnGap ?? 15.5, h = r.columns || 1, g = h > 1 ? (p - m * (h - 1)) / h : p, _ = e.height - l - this.FOOTER_EXTRA_GAP, v = r.fontSize, y = typeof v == "number" ? v : 16, b = "";
884
889
  b += " <g class=\"swed-background\"></g>\n";
885
- let x = this.computeHeaderLayout(r, e), S = {
890
+ let x = o.qrCodeImages?.[i] || o.qrCodeImage || "", S = this.computeHeaderLayout(r, e), C = {
886
891
  mode: "portrait",
887
892
  contentWidth: p,
888
893
  contentX: 0
889
894
  };
890
- b += ` <g class="swed-header" transform="translate(${d}, ${r.headerTop ?? 18})">\n`, b += " <g class=\"swed-header-content\"></g>\n", b += " <g class=\"swed-header-embeds\">\n", i % 2 == 0 ? b += ue(x, S, o.totalScore ?? 0, o.paperName || "", o.schoolName || "", o.qrCodeImage || "", r.showScore ?? !0, this.renderMode) : b += me(S, o.totalScore ?? 0, o.schoolName || "", r.showScore ?? !0, this.renderMode), b += " </g>\n", b += " </g>\n", b += ` <g class="swed-footer" transform="translate(${d}, ${_.toFixed(2)})">\n`, b += " <g class=\"swed-footer-content\">\n", b += " <g class=\"swed-anchor\" transform=\"translate(0, 0)\"></g>\n", b += " <g class=\"swed-paragraph\" transform=\"translate(0, 0)\">\n", b += " <g class=\"swed-line\" transform=\"translate(0, 0)\" baseline=\"19.6\">\n";
891
- let C = `${i + 1}/${a}`, w = p / 2 - C.length * 6, T = C.split("").map((e, t) => (w + t * 12).toFixed(2)).join(" ");
892
- b += ` <text class="swed-text" data-region="page-number" xml:space="preserve" font-size="12" font-weight="bold" font-family="&quot;Times New Roman&quot;, SimSun,'Cambria Math'" font-style="normal" fill="#898989" fill-opacity="1" x="${T}" y="19.6">${V(C)}</text>\n`, b += ` <line x1="0" y1="28.2" x2="${p.toFixed(2)}" y2="28.2" style="fill:#000;stroke-width:1;stroke:#000;" opacity="0"></line>\n`, b += " </g>\n", b += " </g>\n", b += " </g>\n", b += " <g class=\"swed-footer-embeds\">\n", b += he(), b += " </g>\n", b += " </g>\n", b += " <g class=\"swed-layout\">\n";
895
+ b += ` <g class="swed-header" transform="translate(${d}, ${r.headerTop ?? 18})">\n`, b += " <g class=\"swed-header-content\"></g>\n", b += " <g class=\"swed-header-embeds\">\n", i % 2 == 0 ? b += H(S, C, o.totalScore ?? 0, o.paperName || "", o.schoolName || "", x, r.showScore ?? !0, this.renderMode) : b += fe(C, o.totalScore ?? 0, o.schoolName || "", x, r.showScore ?? !0, this.renderMode), b += " </g>\n", b += " </g>\n", b += ` <g class="swed-footer" transform="translate(${d}, ${_.toFixed(2)})">\n`, b += " <g class=\"swed-footer-content\">\n", b += " <g class=\"swed-anchor\" transform=\"translate(0, 0)\"></g>\n", b += " <g class=\"swed-paragraph\" transform=\"translate(0, 0)\">\n", b += " <g class=\"swed-line\" transform=\"translate(0, 0)\" baseline=\"19.6\">\n";
896
+ let w = `${i + 1}/${a}`, T = p / 2 - w.length * 6, E = w.split("").map((e, t) => (T + t * 12).toFixed(2)).join(" ");
897
+ b += ` <text class="swed-text" data-region="page-number" xml:space="preserve" font-size="12" font-weight="bold" font-family="&quot;Times New Roman&quot;, SimSun,'Cambria Math'" font-style="normal" fill="#898989" fill-opacity="1" x="${E}" y="19.6">${V(w)}</text>\n`, b += ` <line x1="0" y1="28.2" x2="${p.toFixed(2)}" y2="28.2" style="fill:#000;stroke-width:1;stroke:#000;" opacity="0"></line>\n`, b += " </g>\n", b += " </g>\n", b += " </g>\n", b += " <g class=\"swed-footer-embeds\">\n", b += pe(), b += " </g>\n", b += " </g>\n", b += " <g class=\"swed-layout\">\n";
893
898
  for (let t of e.cornerMarks) b += this.renderCornerMark(t);
894
899
  b += " </g>\n", b += ` <g class="swed-body" transform="translate(${d}, ${n})">\n`, b += " <g class=\"swed-content\">\n", b += " <g class=\"swed-column\" transform=\"translate(0, 0)\">\n";
895
- let E = this.groupBlocksByColumn(e.blocks);
896
- for (let e = 0; e < E.length; e++) {
897
- let n = E[e][0], i = n ? n.x : e === 0 ? 0 : g + m;
900
+ let D = this.groupBlocksByColumn(e.blocks);
901
+ for (let e = 0; e < D.length; e++) {
902
+ let n = D[e][0], i = n ? n.x : e === 0 ? 0 : g + m;
898
903
  b += ` <g class="col" transform="translate(${i}, 0)">\n`;
899
- for (let n of E[e]) {
904
+ for (let n of D[e]) {
900
905
  let e = t.find((e) => e.id === n.blockId);
901
906
  if (!e || e.type === "title") continue;
902
907
  let i = n.blockId === o.selectedBlockId, a = n.paragraphStart === 0, s = n.paragraphStart + n.paragraphCount >= e.paragraphs.length;
903
- b += ye(n, e, n.y, o.showBBoxes, i, a, s, y, r.showScore ?? !0, this.renderMode);
908
+ b += W(n, e, n.y, o.showBBoxes, i, a, s, y, r.showScore ?? !0, this.renderMode);
904
909
  }
905
910
  b += " </g>\n";
906
911
  }
907
- if (E.length > 1) {
912
+ if (h > 1) {
908
913
  let e = (_ - n).toFixed(1);
909
- for (let t = 1; t < E.length; t++) {
914
+ for (let t = 1; t < h; t++) {
910
915
  let n = t * (g + m) - m / 2;
911
916
  b += ` <path fill="none" stroke="#D1D3D4" stroke-width="0.5" stroke-dasharray="8,8" d="M ${n.toFixed(1)} 0 L ${n.toFixed(1)} ${e}"></path>\n`;
912
917
  }
@@ -914,7 +919,7 @@ var Ce = class {
914
919
  b += " </g>\n", b += " </g>\n", b += " <g class=\"embeds\">\n";
915
920
  for (let n of e.blocks) {
916
921
  let e = t.find((e) => e.id === n.blockId);
917
- !e || e.type !== "title" || (b += be(e, n.y, n.width || g, n.x || 0, r.showScore, o.selectedBlockId === e.id, this.renderMode));
922
+ !e || e.type !== "title" || (b += ye(e, n.y, n.width || g, n.x || 0, r.showScore, o.selectedBlockId === e.id, this.renderMode));
918
923
  }
919
924
  return b += " </g>\n", b += " </g>\n", b += " <g class=\"selection\">\n", b += " <path class=\"selcetion-path\" fill=\"rgb(85,165,255)\" fill-opacity=\"0.5\" paint-order=\"stroke fill markers\" stroke=\"none\" d=\"\"></path>\n", b += " </g>\n", b;
920
925
  }
@@ -927,28 +932,28 @@ var Ce = class {
927
932
  let [t, n, r, i] = e.bbox;
928
933
  return ` <rect fill="black" x="${t}" y="${n}" width="${r}" height="${i}"></rect>\n`;
929
934
  }
930
- }, W = /* @__PURE__ */ new Map(), we = 500;
931
- function Te(e, t, n) {
932
- let r = `${t}:${n}:${e}`, i = W.get(r);
933
- return i && (W.delete(r), W.set(r, i)), i;
935
+ }, G = /* @__PURE__ */ new Map(), Ce = 500;
936
+ function we(e, t, n) {
937
+ let r = `${t}:${n}:${e}`, i = G.get(r);
938
+ return i && (G.delete(r), G.set(r, i)), i;
934
939
  }
935
- function Ee(e, t, n, r) {
940
+ function Te(e, t, n, r) {
936
941
  let i = `${t}:${n}:${e}`;
937
- if (W.set(i, r), W.size > we) {
938
- let e = W.keys().next().value;
939
- e && W.delete(e);
942
+ if (G.set(i, r), G.size > Ce) {
943
+ let e = G.keys().next().value;
944
+ e && G.delete(e);
940
945
  }
941
946
  }
942
- function De() {
943
- W.clear();
947
+ function Ee() {
948
+ G.clear();
944
949
  }
945
- function G(e, t = 14, n = !1) {
946
- let r = Te(e, t, n);
950
+ function K(e, t = 14, n = !1) {
951
+ let r = we(e, t, n);
947
952
  if (r) return r;
948
- let i = Oe(e, t, n);
949
- return Ee(e, t, n, i), i;
953
+ let i = De(e, t, n);
954
+ return Te(e, t, n, i), i;
950
955
  }
951
- function Oe(e, t = 14, n = !1) {
956
+ function De(e, t = 14, n = !1) {
952
957
  try {
953
958
  let r = window.MathJax;
954
959
  if (!r?.tex2svg) throw Error("MathJax 尚未加载完成");
@@ -973,22 +978,22 @@ function Oe(e, t = 14, n = !1) {
973
978
  };
974
979
  } catch {
975
980
  return {
976
- svg: `<svg xmlns="http://www.w3.org/2000/svg" width="50" height="20" viewBox="0 0 50 20"><text x="2" y="16" font-size="11" font-family="Times New Roman,serif" fill="#999">${ke(e)}</text></svg>`,
981
+ svg: `<svg xmlns="http://www.w3.org/2000/svg" width="50" height="20" viewBox="0 0 50 20"><text x="2" y="16" font-size="11" font-family="Times New Roman,serif" fill="#999">${Oe(e)}</text></svg>`,
977
982
  width: 50,
978
983
  height: 20
979
984
  };
980
985
  }
981
986
  }
982
- function ke(e) {
987
+ function Oe(e) {
983
988
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
984
989
  }
985
- var K = /* @__PURE__ */ new Map(), Ae = 200;
986
- function je(e, t = 14, n = !1) {
990
+ var q = /* @__PURE__ */ new Map(), ke = 200;
991
+ function Ae(e, t = 14, n = !1) {
987
992
  let r = e;
988
993
  try {
989
994
  r = decodeURIComponent(e);
990
995
  } catch {}
991
- let i = `${t}:${n}:${r}`, a = K.get(i);
996
+ let i = `${t}:${n}:${r}`, a = q.get(i);
992
997
  if (a) return a;
993
998
  try {
994
999
  let e = window.MathJax;
@@ -1012,9 +1017,9 @@ function je(e, t = 14, n = !1) {
1012
1017
  width: s,
1013
1018
  height: c
1014
1019
  };
1015
- if (K.set(i, d), K.size > Ae) {
1016
- let e = K.keys().next().value;
1017
- e && K.delete(e);
1020
+ if (q.set(i, d), q.size > ke) {
1021
+ let e = q.keys().next().value;
1022
+ e && q.delete(e);
1018
1023
  }
1019
1024
  return d;
1020
1025
  } catch {
@@ -1025,14 +1030,14 @@ function je(e, t = 14, n = !1) {
1025
1030
  };
1026
1031
  }
1027
1032
  }
1028
- function Me(e, t = 20) {
1033
+ function je(e, t = 20) {
1029
1034
  return new Promise((n) => {
1030
1035
  let r = Array(e.length), i = 0;
1031
1036
  function a() {
1032
1037
  let o = Math.min(i + t, e.length);
1033
1038
  for (; i < o; i++) {
1034
1039
  let t = e[i];
1035
- r[i] = G(t.latex, t.fontSize ?? 14, t.display ?? !1);
1040
+ r[i] = K(t.latex, t.fontSize ?? 14, t.display ?? !1);
1036
1041
  }
1037
1042
  i < e.length ? requestAnimationFrame(a) : n(r);
1038
1043
  }
@@ -1041,7 +1046,7 @@ function Me(e, t = 20) {
1041
1046
  }
1042
1047
  //#endregion
1043
1048
  //#region src/utils/serialization/shared.ts
1044
- var Ne = {
1049
+ var Me = {
1045
1050
  clrScheme: {
1046
1051
  accent1: "4472C4",
1047
1052
  accent2: "ED7D31",
@@ -1098,9 +1103,9 @@ var Ne = {
1098
1103
  latin: "等线"
1099
1104
  }
1100
1105
  }
1101
- }, Pe = { docDefaults: { textPropsDefault: { runfonts: { hint: "eastAsia" } } } }, Fe = 26.46, Ie = 17.5, Le = 26.25;
1102
- function q(e) {
1103
- let t = Fe;
1106
+ }, Ne = { docDefaults: { textPropsDefault: { runfonts: { hint: "eastAsia" } } } }, Pe = 26.46, Fe = 17.5, Ie = 26.25;
1107
+ function Le(e) {
1108
+ let t = Pe;
1104
1109
  return {
1105
1110
  tl: {
1106
1111
  top: t,
@@ -1153,25 +1158,25 @@ function Be(e) {
1153
1158
  function Ve(e) {
1154
1159
  return e.replace(/-([a-z])/g, (e, t) => t.toUpperCase());
1155
1160
  }
1156
- function He(e) {
1161
+ function J(e) {
1157
1162
  return /_Block_\d+$/.test(e);
1158
1163
  }
1159
- function Ue(e) {
1164
+ function He(e) {
1160
1165
  let t = e.match(/^(.+)_Block_\d+$/);
1161
1166
  return t ? t[1] : "";
1162
1167
  }
1163
- function We(e) {
1168
+ function Ue(e) {
1164
1169
  let t = [];
1165
1170
  for (let n of e.paragraphs) for (let e of n.lines) for (let n of e.elements) n.type === "text" && t.push(n.value);
1166
1171
  let n = t.join("").trim();
1167
1172
  return !n && e.metadata?.label ? e.metadata.label : n;
1168
1173
  }
1169
- function Ge(e) {
1174
+ function We(e) {
1170
1175
  let t = [], n = null;
1171
1176
  for (let r of e) {
1172
1177
  if (r.type === "title") {
1173
1178
  n &&= (t.push(n), null);
1174
- let e = We(r);
1179
+ let e = Ue(r);
1175
1180
  t.push({
1176
1181
  type: "title-section",
1177
1182
  name: e || "题目",
@@ -1190,9 +1195,9 @@ function Ge(e) {
1190
1195
  }
1191
1196
  //#endregion
1192
1197
  //#region src/utils/serialization/buildQuestions.ts
1193
- function Ke(e, t) {
1198
+ function Ge(e, t) {
1194
1199
  if (e.type === "title" || e.type === "info-line") return null;
1195
- let n = e.type === "sub-question" ? Le : Ie, r = k[t.paperSize], [, , i, a] = t.margins || [
1200
+ let n = e.type === "sub-question" ? Ie : Fe, r = A[t.paperSize], [, , i, a] = t.margins || [
1196
1201
  50,
1197
1202
  56,
1198
1203
  50,
@@ -1231,7 +1236,7 @@ function Ke(e, t) {
1231
1236
  })()
1232
1237
  }, f = {
1233
1238
  type: "question-stem",
1234
- children: e.paragraphs.map((e) => Je(e)),
1239
+ children: e.paragraphs.map((e) => qe(e)),
1235
1240
  props: {
1236
1241
  split: !0,
1237
1242
  anchorOverflow: !1,
@@ -1260,13 +1265,13 @@ function Ke(e, t) {
1260
1265
  isLongScoreBar: !0
1261
1266
  }
1262
1267
  }, m = [f];
1263
- return e.options && e.options.length > 0 && m.push(qe(e.options, e.metadata?.topicId || e.id)), m.push(p), (e.questionType === "single_chose" || e.questionType === "multi_chose") && (d.choiceMarkingType = e.questionType === "single_chose" ? 2 : 3), {
1268
+ return e.options && e.options.length > 0 && m.push(Ke(e.options, e.metadata?.topicId || e.id)), m.push(p), (e.questionType === "single_chose" || e.questionType === "multi_chose") && (d.choiceMarkingType = e.questionType === "single_chose" ? 2 : 3), {
1264
1269
  type: "question",
1265
1270
  props: d,
1266
1271
  children: m
1267
1272
  };
1268
1273
  }
1269
- function qe(e, t) {
1274
+ function Ke(e, t) {
1270
1275
  return {
1271
1276
  type: "option",
1272
1277
  props: {
@@ -1275,7 +1280,7 @@ function qe(e, t) {
1275
1280
  keepNext: !1
1276
1281
  },
1277
1282
  children: e.map((e, t) => {
1278
- let n = e.paragraphs.map((e) => Je(e));
1283
+ let n = e.paragraphs.map((e) => qe(e));
1279
1284
  return {
1280
1285
  type: "option-item",
1281
1286
  props: {
@@ -1289,10 +1294,10 @@ function qe(e, t) {
1289
1294
  })
1290
1295
  };
1291
1296
  }
1292
- function Je(e) {
1297
+ function qe(e) {
1293
1298
  let t = [];
1294
1299
  for (let n of e.lines) for (let e of n.elements) {
1295
- let r = Ye(e, n);
1300
+ let r = Je(e, n);
1296
1301
  r && t.push(r);
1297
1302
  }
1298
1303
  return {
@@ -1308,7 +1313,7 @@ function Je(e) {
1308
1313
  children: t
1309
1314
  };
1310
1315
  }
1311
- function Ye(e, t) {
1316
+ function Je(e, t) {
1312
1317
  switch (e.type) {
1313
1318
  case "text": {
1314
1319
  let t = e;
@@ -1473,8 +1478,8 @@ function Ye(e, t) {
1473
1478
  }
1474
1479
  //#endregion
1475
1480
  //#region src/utils/serialization/buildBody.ts
1476
- function Xe(e, t) {
1477
- let n = k[t.paperSize], [r, i, a, o] = t.margins || [
1481
+ function Ye(e, t) {
1482
+ let n = A[t.paperSize], [r, i, a, o] = t.margins || [
1478
1483
  50,
1479
1484
  56,
1480
1485
  50,
@@ -1484,15 +1489,15 @@ function Xe(e, t) {
1484
1489
  type: `${t.paperSize}${t.columns > 1 ? "_" + t.columns : ""}`,
1485
1490
  width: n.width,
1486
1491
  height: n.height,
1487
- width2mm: A[t.paperSize]?.w ?? 210,
1488
- height2mm: A[t.paperSize]?.h ?? 297,
1492
+ width2mm: j[t.paperSize]?.w ?? 210,
1493
+ height2mm: j[t.paperSize]?.h ?? 297,
1489
1494
  padding: {
1490
1495
  top: r,
1491
1496
  right: i,
1492
1497
  bottom: a,
1493
1498
  left: o
1494
1499
  },
1495
- point: q(n),
1500
+ point: Le(n),
1496
1501
  headerTop: t.headerTop ?? 18,
1497
1502
  footerBottom: 13.2,
1498
1503
  showScore: t.showScore,
@@ -1519,7 +1524,7 @@ function Xe(e, t) {
1519
1524
  colorType: "rgb",
1520
1525
  colorValue: "7030A0"
1521
1526
  } } }
1522
- }, u = Ze(e, t);
1527
+ }, u = Xe(e, t);
1523
1528
  return {
1524
1529
  type: "document",
1525
1530
  props: l,
@@ -1536,16 +1541,16 @@ function Xe(e, t) {
1536
1541
  }]
1537
1542
  };
1538
1543
  }
1539
- function Ze(e, t) {
1540
- let n = [], r = Ge(e);
1541
- for (let e of r) if (e.type === "title-section") n.push(Qe(e.name, e.blocks));
1544
+ function Xe(e, t) {
1545
+ let n = [], r = We(e);
1546
+ for (let e of r) if (e.type === "title-section") n.push(Ze(e.name, e.blocks));
1542
1547
  else for (let r of e.blocks) {
1543
- let e = Ke(r, t);
1548
+ let e = Ge(r, t);
1544
1549
  e && n.push(e);
1545
1550
  }
1546
1551
  return n;
1547
1552
  }
1548
- function Qe(e, t) {
1553
+ function Ze(e, t) {
1549
1554
  let n = t.filter((e) => e.metadata?.score).map((e) => parseInt(e.metadata.score) || 0).reduce((e, t) => e + t, 0), r = t[0], i = r?.metadata?.title || e, a = r?.metadata?.label || e;
1550
1555
  return {
1551
1556
  type: "vueplug",
@@ -1576,22 +1581,23 @@ function Qe(e, t) {
1576
1581
  }
1577
1582
  //#endregion
1578
1583
  //#region src/utils/serialization/buildPagesExport.ts
1579
- var $e = new Set([
1584
+ var Qe = new Set([
1580
1585
  "header-desc",
1581
1586
  "score",
1582
1587
  "paper-name",
1583
1588
  "qr-code",
1584
1589
  "student-name",
1585
1590
  "student-class",
1586
- "student-code"
1591
+ "student-code",
1592
+ "student-code-filler"
1587
1593
  ]);
1588
- function et(e, t, n = !0) {
1594
+ function $e(e, t, n = !0) {
1589
1595
  let r = ze(t), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1590
1596
  for (let t of e) for (let e of t.renderedRegions || []) {
1591
1597
  let t = Re(e.meta?.blockId || e.meta?.topicId || "");
1592
1598
  t && e.type === "question-border" && i.add(t);
1593
1599
  }
1594
- for (let e of i) He(e) && a.add(Ue(e));
1600
+ for (let e of i) J(e) && a.add(He(e));
1595
1601
  let o = /* @__PURE__ */ new Map(), s = 0;
1596
1602
  for (let e of t) {
1597
1603
  let t = e.metadata?.topicId || (e.id.startsWith("sw-") ? e.id.slice(3) : e.id);
@@ -1613,7 +1619,7 @@ function et(e, t, n = !0) {
1613
1619
  questions: []
1614
1620
  }, c = {}, l = [], u, d = /* @__PURE__ */ new Map();
1615
1621
  for (let e of i) {
1616
- if ($e.has(e.type)) {
1622
+ if (Qe.has(e.type)) {
1617
1623
  if (e.type === "score" && !n) continue;
1618
1624
  c[Ve(e.type)] = e.bbox;
1619
1625
  continue;
@@ -1653,11 +1659,11 @@ function et(e, t, n = !0) {
1653
1659
  sortIndex: o.get(t) ?? 9999,
1654
1660
  bbox: d[0]
1655
1661
  };
1656
- if (d.length > 1 && (f.bboxes = d), i?.metadata?.qid && (f.qid = i.metadata.qid), i?.metadata?.answer && (f.answer = i.metadata.answer), l !== void 0 && l !== "" && l !== null) {
1662
+ if (d.length > 1 && (f.bboxes = d), i?.metadata?.qid && (f.qid = i.metadata.qid), i?.metadata?.answer && (f.answer = i.metadata.answer), i?.metadata?.subAnswers && (f.subAnswers = i.metadata.subAnswers), l !== void 0 && l !== "" && l !== null) {
1657
1663
  let e = parseFloat(String(l));
1658
1664
  isNaN(e) || (f.score = e);
1659
1665
  }
1660
- He(t) && (f.parentTopicId = Ue(t)), u && (f.hasSubQuestions = !0), n.underlines.length > 0 && (f.underlines = n.underlines.map((e) => {
1666
+ J(t) && (f.parentTopicId = He(t)), u && (f.hasSubQuestions = !0), n.underlines.length > 0 && (f.underlines = n.underlines.map((e) => {
1661
1667
  let t = { bbox: e.bbox }, n = e.meta;
1662
1668
  return n?.correctAnswer && (t.correctAnswer = n.correctAnswer), n?.blankType && (t.blankType = n.blankType), n?.index != null && (t.index = n.index), n?.underlineId && (t.underlineId = n.underlineId), n?.isSplitPart && (t.isSplitPart = n.isSplitPart), t;
1663
1669
  })), e.filter((e) => e.renderedRegions.some((e) => {
@@ -1670,11 +1676,16 @@ function et(e, t, n = !0) {
1670
1676
  }
1671
1677
  //#endregion
1672
1678
  //#region src/utils/textWrap.ts
1673
- var tt = ",。、;:?!…)】》'\"'\"…·", nt = "(【《'\"'\"";
1674
- function rt(e, t) {
1679
+ var et = ",。、;:?!…)】》'\"'\"…·", tt = "(【《'\"'\"";
1680
+ function nt(e, t) {
1675
1681
  let n = t, r = t * .5;
1676
1682
  for (let t of e) if (t.type === "formula") {
1677
- let e = t, i = e.svgContent.match(/vertical-align:\s*([-\d.]+)ex/), a = i ? parseFloat(i[1]) * 7 : -(e.height || 20), o = e.height || 20, s = r + a + o;
1683
+ let e = t, i = e.svgContent.match(/vertical-align:\s*([-\d.]+)(px|ex)/), a;
1684
+ if (i) {
1685
+ let e = parseFloat(i[1]);
1686
+ a = i[2] === "ex" ? e * 7 : e;
1687
+ } else a = -(e.height || 20);
1688
+ let o = e.height || 20, s = r + a + o;
1678
1689
  s > n && (n = s);
1679
1690
  let c = r + a;
1680
1691
  c < 0 && (n = Math.max(n, s - c));
@@ -1689,7 +1700,7 @@ function rt(e, t) {
1689
1700
  y: 0
1690
1701
  };
1691
1702
  }
1692
- function it(e, t, n, r = 0) {
1703
+ function rt(e, t, n, r = 0) {
1693
1704
  let i = [], a = [], o = 0;
1694
1705
  for (let n = 0; n < e.length; n++) {
1695
1706
  let s = e[n];
@@ -1755,12 +1766,12 @@ function it(e, t, n, r = 0) {
1755
1766
  continue;
1756
1767
  }
1757
1768
  }
1758
- let u = s.type === "text" && tt.includes(s.value) && a.length > 0 && o + s.width <= l;
1769
+ let u = s.type === "text" && et.includes(s.value) && a.length > 0 && o + s.width <= l;
1759
1770
  if (o + s.width > l && a.length > 0 && !u) {
1760
1771
  let e = a.length;
1761
1772
  if (a.length > 0) {
1762
1773
  let t = a[a.length - 1];
1763
- t.type === "text" && nt.includes(t.value) && a.length > 1 && (e = a.length - 1);
1774
+ t.type === "text" && tt.includes(t.value) && a.length > 1 && (e = a.length - 1);
1764
1775
  }
1765
1776
  i.push(a.slice(0, e)), a = [...a.slice(e), s], o = a.reduce((e, t) => e + t.width, 0);
1766
1777
  } else a.push(s), o += s.width;
@@ -1768,21 +1779,21 @@ function it(e, t, n, r = 0) {
1768
1779
  return a.length > 0 && i.push(a), i.length > 0 ? i.map((e, i) => {
1769
1780
  let a = t;
1770
1781
  return i === 0 && r > 0 && (a -= r), {
1771
- ...rt(e, n),
1782
+ ...nt(e, n),
1772
1783
  availableWidth: a
1773
1784
  };
1774
1785
  }) : [{
1775
- ...rt(e, n),
1786
+ ...nt(e, n),
1776
1787
  availableWidth: t
1777
1788
  }];
1778
1789
  }
1779
- function at(e, t, n) {
1780
- return it(e, t, n, 0);
1790
+ function it(e, t, n) {
1791
+ return rt(e, t, n, 0);
1781
1792
  }
1782
1793
  //#endregion
1783
1794
  //#region src/utils/deserialization/parseInlines.ts
1784
- var ot = 0;
1785
- function st(e) {
1795
+ var at = 0;
1796
+ function ot(e) {
1786
1797
  switch (e.type) {
1787
1798
  case "text": {
1788
1799
  let t = e;
@@ -1802,7 +1813,7 @@ function st(e) {
1802
1813
  return t.props.dotAbove && (c.dotAbove = !0), t.props.wavyLine && (c.wavyLine = !0), t.props.underline && (c.underline = !0), t.props.strikethrough && (c.strikethrough = !0), t.props.backgroundColor && (c.backgroundColor = t.props.backgroundColor), t.props.verticalAlign !== void 0 && t.props.verticalAlign !== 0 && (c.verticalAlign = t.props.verticalAlign), t.props.color?.val && (c.color = t.props.color.val), c;
1803
1814
  }
1804
1815
  case "latex": {
1805
- let t = e, n = t.value || t.props.raw || "", { svg: r, width: i, height: a } = G(n);
1816
+ let t = e, n = t.value || t.props.raw || "", { svg: r, width: i, height: a } = K(n);
1806
1817
  return {
1807
1818
  type: "formula",
1808
1819
  width: i,
@@ -1812,7 +1823,7 @@ function st(e) {
1812
1823
  };
1813
1824
  }
1814
1825
  case "mathml": {
1815
- let t = e, n = t.value || t.props.raw || "", { svg: r, width: i, height: a } = je(n);
1826
+ let t = e, n = t.value || t.props.raw || "", { svg: r, width: i, height: a } = Ae(n);
1816
1827
  return {
1817
1828
  type: "formula",
1818
1829
  width: i,
@@ -1826,7 +1837,7 @@ function st(e) {
1826
1837
  let t = e, n = t.props.rect?.width || 80;
1827
1838
  return {
1828
1839
  type: "underline",
1829
- id: t.props.ulId || `ul-${++ot}`,
1840
+ id: t.props.ulId || `ul-${++at}`,
1830
1841
  width: n,
1831
1842
  height: 20,
1832
1843
  placeholder: t.props.placeholder || "空",
@@ -1896,22 +1907,22 @@ function st(e) {
1896
1907
  }
1897
1908
  //#endregion
1898
1909
  //#region src/utils/deserialization/parseQuestions.ts
1899
- var ct = 0;
1900
- function lt(e, t, n, r) {
1910
+ var st = 0;
1911
+ function ct(e, t, n, r) {
1901
1912
  let i = [], a = e.props, o = e.children.find((e) => e.type === "question-stem");
1902
1913
  if (!o) return i;
1903
- let s = a.topicId.includes("_Block_"), c = t ? t - (s ? Le : Ie) : void 0, l = [];
1904
- for (let e of o.children) e.type === "paragraph" && l.push(dt(e, c, n, r));
1905
- ct++;
1914
+ let s = a.topicId.includes("_Block_"), c = t ? t - (s ? Ie : Fe) : void 0, l = [];
1915
+ for (let e of o.children) e.type === "paragraph" && l.push(ut(e, c, n, r));
1916
+ st++;
1906
1917
  let u = {
1907
- id: `sw-${a.topicId}-${ct}`,
1918
+ id: `sw-${a.topicId}-${st}`,
1908
1919
  type: s ? "sub-question" : "question",
1909
1920
  paragraphs: l,
1910
1921
  height: l.reduce((e, t) => e + (t.height || 26), 0),
1911
1922
  metadata: {
1912
1923
  questionNo: s ? "" : a.topicIndex,
1913
1924
  subLabel: s ? a.topicIndex : "",
1914
- score: ut(e),
1925
+ score: lt(e),
1915
1926
  topicId: a.topicId,
1916
1927
  label: a.topicIndex,
1917
1928
  blockGroup: a.isMaterial ? a.topicId.split("_Block_")[0] : void 0,
@@ -1920,7 +1931,7 @@ function lt(e, t, n, r) {
1920
1931
  }, d = e.children.find((e) => e.type === "option");
1921
1932
  if (d && d.children && d.children.length > 0 && (u.questionType = a.choiceMarkingType === 2 ? "single_chose" : "multi_chose", u.options = d.children.map((e) => {
1922
1933
  let t = [];
1923
- for (let i of e.children) i.type === "paragraph" && t.push(dt(i, c, n, r));
1934
+ for (let i of e.children) i.type === "paragraph" && t.push(ut(i, c, n, r));
1924
1935
  return {
1925
1936
  label: e.props.oriLabel || e.props.label?.replace(".", "") || "",
1926
1937
  contentHtml: "",
@@ -1932,17 +1943,17 @@ function lt(e, t, n, r) {
1932
1943
  } catch {}
1933
1944
  return i.push(u), i;
1934
1945
  }
1935
- function ut(e) {
1946
+ function lt(e) {
1936
1947
  for (let t of e.children) if (t.type === "question-stem") {
1937
1948
  for (let e of t.children) for (let t of e.children) if (t.type === "question-score") return `${t.props.score}`;
1938
1949
  }
1939
1950
  for (let t of e.children) if (t.type === "correction-box") return `${t.props.score}`;
1940
1951
  return "";
1941
1952
  }
1942
- function dt(e, t, n, r) {
1953
+ function ut(e, t, n, r) {
1943
1954
  let i = [];
1944
1955
  for (let t of e.children) {
1945
- let e = st(t);
1956
+ let e = ot(t);
1946
1957
  e && i.push(e);
1947
1958
  }
1948
1959
  i.length === 0 && i.push({
@@ -1952,7 +1963,7 @@ function dt(e, t, n, r) {
1952
1963
  });
1953
1964
  let a = r ?? Math.round((n ?? 14) * 1.5 * 35 / (14 * 1.5));
1954
1965
  if (t && t > 0 && i.length > 0) {
1955
- let n = at(i, t, a), r = n.reduce((e, t) => e + t.lineHeight, 0) + 4, o = e.props?.justification, s = e.props?.split;
1966
+ let n = it(i, t, a), r = n.reduce((e, t) => e + t.lineHeight, 0) + 4, o = e.props?.justification, s = e.props?.split;
1956
1967
  return {
1957
1968
  lines: n,
1958
1969
  y: 0,
@@ -1977,7 +1988,7 @@ function dt(e, t, n, r) {
1977
1988
  }
1978
1989
  //#endregion
1979
1990
  //#region src/utils/deserialization/parseDocument.ts
1980
- function ft(e) {
1991
+ function dt(e) {
1981
1992
  let t;
1982
1993
  try {
1983
1994
  t = JSON.parse(e);
@@ -1988,9 +1999,9 @@ function ft(e) {
1988
1999
  if (!t.body || typeof t.body != "object") throw Error("[documentSerializer] 文档格式错误: 缺少 body 字段");
1989
2000
  if (!t.body.props || !t.body.props.paper) throw Error("[documentSerializer] 文档格式错误: 缺少 body.props.paper");
1990
2001
  if (!Array.isArray(t.body.children)) throw Error("[documentSerializer] 文档格式错误: body.children 应为数组");
1991
- return delete t._pages, delete t._regions, pt(t);
2002
+ return delete t._pages, delete t._regions, ft(t);
1992
2003
  }
1993
- function pt(e) {
2004
+ function ft(e) {
1994
2005
  let t = e.body, n = t.props.paper, r = n.padding || {
1995
2006
  top: 50,
1996
2007
  right: 56,
@@ -1999,8 +2010,8 @@ function pt(e) {
1999
2010
  }, i = N(n.type), a = {
2000
2011
  paperSize: i.size,
2001
2012
  columns: i.columns,
2002
- fontSize: n.fontSize ?? 14,
2003
- lineSpacing: n.lineSpacing ?? 1.5,
2013
+ fontSize: n.fontSize ?? 16,
2014
+ lineSpacing: n.lineSpacing ?? 1,
2004
2015
  margins: [
2005
2016
  r.top ?? 50,
2006
2017
  r.right ?? 56,
@@ -2024,10 +2035,10 @@ function pt(e) {
2024
2035
  }
2025
2036
  let m = n.width - n.padding.left - n.padding.right, h = i.columns > 1 ? a.columnGap || 16 : 0, g = i.columns > 1 ? (m - h * (i.columns - 1)) / i.columns : m, _ = [];
2026
2037
  for (let e of t.children) for (let t of e.children) if (t.type === "vueplug") {
2027
- let e = mt(t);
2038
+ let e = pt(t);
2028
2039
  e && _.push(e);
2029
2040
  } else if (t.type === "question") {
2030
- let e = lt(t, g, o, c);
2041
+ let e = ct(t, g, o, c);
2031
2042
  _.push(...e);
2032
2043
  }
2033
2044
  return {
@@ -2040,7 +2051,7 @@ function pt(e) {
2040
2051
  totalScore: p
2041
2052
  };
2042
2053
  }
2043
- function mt(e) {
2054
+ function pt(e) {
2044
2055
  let t = e.props?.bind || {}, n = t?.topicTitle || t?.title || t?.input || "";
2045
2056
  if (!n) return null;
2046
2057
  let r = {
@@ -2048,7 +2059,7 @@ function mt(e) {
2048
2059
  isTitle: !0
2049
2060
  };
2050
2061
  return t.topicTitle && (r.title = String(t.title || "")), {
2051
- id: `title-${e.props.id}-${++ht}`,
2062
+ id: `title-${e.props.id}-${++mt}`,
2052
2063
  type: "title",
2053
2064
  paragraphs: [],
2054
2065
  height: e.props.rect?.height || 40,
@@ -2056,11 +2067,11 @@ function mt(e) {
2056
2067
  keepNext: e.props.keepNext ?? !1
2057
2068
  };
2058
2069
  }
2059
- var ht = 0;
2070
+ var mt = 0;
2060
2071
  //#endregion
2061
2072
  //#region src/utils/documentSerializer.ts
2062
- function gt(e, t, n = {}) {
2063
- let r = Xe(e, t), i = {
2073
+ function ht(e, t, n = {}) {
2074
+ let r = Ye(e, t), i = {
2064
2075
  info: {
2065
2076
  author: "",
2066
2077
  created: "",
@@ -2313,22 +2324,22 @@ function gt(e, t, n = {}) {
2313
2324
  }]
2314
2325
  }
2315
2326
  },
2316
- theme: Ne,
2317
- styles: Pe,
2327
+ theme: Me,
2328
+ styles: Ne,
2318
2329
  version: "1.3",
2319
2330
  mode: 1,
2320
2331
  lastUpdateTime: Date.now()
2321
2332
  };
2322
- return n.pages && n.pages.length > 0 && (i._pages = et(n.pages, n.blocks || [], t.showScore)), JSON.stringify(i, null, 2);
2333
+ return n.pages && n.pages.length > 0 && (i._pages = $e(n.pages, n.blocks || [], t.showScore)), JSON.stringify(i, null, 2);
2323
2334
  }
2324
- function _t(e) {
2325
- return ft(e);
2335
+ function gt(e) {
2336
+ return dt(e);
2326
2337
  }
2327
2338
  //#endregion
2328
2339
  //#region src/utils/questionHtmlParser.ts
2329
- var vt = 0, yt = 0, bt = 0, xt = .5;
2330
- function St(e, t = {}) {
2331
- let { questionNo: n = "", score: r = "", contentWidth: i = 600, fontSize: a = 14, lineSpacing: o = 1.5, skipAnswerArea: s = !1, protectContent: c = !1 } = t, l = new DOMParser().parseFromString(e, "text/html"), u = [], d = Math.round(a * o * 1.67), f = n.length > 2 ? 26.25 : 17.5, p = new Set([
2340
+ var _t = 0, vt = 0, yt = 0, bt = .5;
2341
+ function xt(e, t = {}) {
2342
+ let { questionNo: n = "", score: r = "", contentWidth: i = 600, fontSize: a = 16, lineSpacing: o = 1, skipAnswerArea: s = !1, protectContent: c = !1 } = t, l = new DOMParser().parseFromString(e, "text/html"), u = [], d = Math.round(a * o * 1.67), f = n.length > 2 ? 26.25 : 17.5, p = new Set([
2332
2343
  "p",
2333
2344
  "h1",
2334
2345
  "h2",
@@ -2367,14 +2378,31 @@ function St(e, t = {}) {
2367
2378
  continue;
2368
2379
  }
2369
2380
  if (!p.has(r)) continue;
2370
- let o = n, s = o.getAttribute("style") || "", c = J(o, a, s, i, f);
2381
+ if (r === "div") {
2382
+ let e = Array.from(n.children).filter((e) => e.tagName.toLowerCase() === "p");
2383
+ if (e.length > 0) {
2384
+ for (let t of e) {
2385
+ let e = t.getAttribute("style") || "", n = Y(t, a, e, i, f);
2386
+ if (n.length === 0) continue;
2387
+ let r = rt(n, i, d), o = r.reduce((e, t) => e + t.lineHeight, 0) + 4;
2388
+ u.push({
2389
+ lines: r,
2390
+ y: 0,
2391
+ height: o,
2392
+ justification: Ct(n, e)
2393
+ });
2394
+ }
2395
+ continue;
2396
+ }
2397
+ }
2398
+ let o = n, s = o.getAttribute("style") || "", c = Y(o, a, s, i, f);
2371
2399
  if (c.length === 0) continue;
2372
- let m = it(c, i, d), h = m.reduce((e, t) => e + t.lineHeight, 0) + 4, g = Tt(s), _ = g === "center" ? "center" : g === "right" ? "right" : void 0;
2400
+ let m = rt(c, i, d), h = m.reduce((e, t) => e + t.lineHeight, 0) + 4;
2373
2401
  u.push({
2374
2402
  lines: m,
2375
2403
  y: 0,
2376
2404
  height: h,
2377
- justification: _
2405
+ justification: Ct(c, s)
2378
2406
  });
2379
2407
  }
2380
2408
  if (!s) for (let e = 0; e < 2; e++) u.push({
@@ -2391,7 +2419,7 @@ function St(e, t = {}) {
2391
2419
  y: 0,
2392
2420
  height: d + 4
2393
2421
  });
2394
- let m = u.reduce((e, t) => e + (t.height || 26), 0), h = `topic-html-${++yt}`;
2422
+ let m = u.reduce((e, t) => e + (t.height || 26), 0), h = `topic-html-${++vt}`;
2395
2423
  return [{
2396
2424
  id: `q-html-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
2397
2425
  type: "question",
@@ -2407,7 +2435,7 @@ function St(e, t = {}) {
2407
2435
  }
2408
2436
  }];
2409
2437
  }
2410
- function J(e, t, n, r, i) {
2438
+ function Y(e, t, n, r, i) {
2411
2439
  let a = [];
2412
2440
  for (let o = 0; o < e.childNodes.length; o++) {
2413
2441
  let s = e.childNodes[o];
@@ -2432,11 +2460,11 @@ function J(e, t, n, r, i) {
2432
2460
  let e = c.getAttribute("data-latex") || "", t = e, n, r;
2433
2461
  if (e) {
2434
2462
  let n = e.replace(/\\style\{[^}]*\}\{/, "{").replace(/^\\style\{[^}]*\}/, "") || e;
2435
- t = n, r = G(n);
2463
+ t = n, r = K(n);
2436
2464
  } else {
2437
2465
  let e = c.getAttribute("data-mathml") || "";
2438
2466
  if (e) {
2439
- r = je(e), t = "";
2467
+ r = Ae(e), t = "";
2440
2468
  try {
2441
2469
  n = decodeURIComponent(e);
2442
2470
  } catch {
@@ -2464,14 +2492,14 @@ function J(e, t, n, r, i) {
2464
2492
  }
2465
2493
  a.push({
2466
2494
  type: "image",
2467
- id: `inline-img-${++bt}`,
2495
+ id: `inline-img-${++yt}`,
2468
2496
  src: e,
2469
2497
  width: l,
2470
2498
  height: d
2471
2499
  });
2472
2500
  continue;
2473
2501
  }
2474
- let f = Ct(d);
2502
+ let f = St(d);
2475
2503
  if (l === "span" && f) {
2476
2504
  let e = c.textContent || "", { blankType: t, isEmpty: n } = f, r;
2477
2505
  if (t === "tiankong") {
@@ -2480,7 +2508,7 @@ function J(e, t, n, r, i) {
2480
2508
  } else r = Math.max(40, e.length * 14 + 10);
2481
2509
  a.push({
2482
2510
  type: "underline",
2483
- id: `ul-html-${++vt}`,
2511
+ id: `ul-html-${++_t}`,
2484
2512
  width: r,
2485
2513
  height: 20,
2486
2514
  placeholder: t === "tiankong" ? "空" : t === "xuanze" ? "选" : "判",
@@ -2517,23 +2545,23 @@ function J(e, t, n, r, i) {
2517
2545
  continue;
2518
2546
  }
2519
2547
  if (l === "strong" || l === "b") {
2520
- let e = J(c, t, u ? u + ";font-weight:bold" : "font-weight:bold", r, i);
2548
+ let e = Y(c, t, u ? u + ";font-weight:bold" : "font-weight:bold", r, i);
2521
2549
  a.push(...e);
2522
2550
  continue;
2523
2551
  }
2524
2552
  if (l === "em" || l === "i") {
2525
- let e = J(c, t, u ? u + ";font-style:italic" : "font-style:italic", r, i);
2553
+ let e = Y(c, t, u ? u + ";font-style:italic" : "font-style:italic", r, i);
2526
2554
  a.push(...e);
2527
2555
  continue;
2528
2556
  }
2529
2557
  if (l === "u" || l === "ins") {
2530
- let e = J(c, t, u || n, r, i);
2558
+ let e = Y(c, t, u || n, r, i);
2531
2559
  for (let t of e) t.type === "text" && (t.underline = !0);
2532
2560
  a.push(...e);
2533
2561
  continue;
2534
2562
  }
2535
2563
  if (l === "s" || l === "strike" || l === "del") {
2536
- let e = J(c, t, u || n, r, i);
2564
+ let e = Y(c, t, u || n, r, i);
2537
2565
  for (let t of e) t.type === "text" && (t.strikethrough = !0);
2538
2566
  a.push(...e);
2539
2567
  continue;
@@ -2542,7 +2570,7 @@ function J(e, t, n, r, i) {
2542
2570
  let e = c.outerHTML, t = parseInt(u.match(/width:\s*(\d+)px/)?.[1] || "0"), n = u.match(/width:\s*([\d.]+)%/), i = c.querySelectorAll("tr").length, o = Math.max(60, i * 30 + 40), s = n ? Math.round(parseFloat(n[1]) / 100 * r) : t || r;
2543
2571
  a.push({
2544
2572
  type: "image",
2545
- id: `inline-img-${++bt}`,
2573
+ id: `inline-img-${++yt}`,
2546
2574
  src: "",
2547
2575
  width: Math.min(s, r),
2548
2576
  height: o,
@@ -2556,20 +2584,20 @@ function J(e, t, n, r, i) {
2556
2584
  let t = e.outerHTML, n = e.getAttribute("style") || "", i = parseInt(n.match(/width:\s*(\d+)px/)?.[1] || "0"), o = n.match(/width:\s*([\d.]+)%/), s = e.querySelectorAll("tr").length, c = Math.max(60, s * 30 + 40), l = o ? Math.round(parseFloat(o[1]) / 100 * r) : i || r;
2557
2585
  a.push({
2558
2586
  type: "image",
2559
- id: `inline-img-${++bt}`,
2587
+ id: `inline-img-${++yt}`,
2560
2588
  src: "",
2561
2589
  width: Math.min(l, r),
2562
2590
  height: c,
2563
2591
  rawHtml: t
2564
2592
  });
2565
2593
  } else {
2566
- let e = J(c, t, u || n, r, i);
2594
+ let e = Y(c, t, u || n, r, i);
2567
2595
  a.push(...e);
2568
2596
  }
2569
2597
  continue;
2570
2598
  }
2571
2599
  if (l === "sub" || l === "sup") {
2572
- let e = Math.round(t * xt), o = J(c, e, (u || n).replace(/font-size:\s*[^;]+;?/, "") + `;font-size:${e}px`, r, i), s = Math.round(l === "sub" ? t * .52 : -t * .25);
2600
+ let e = Math.round(t * bt), o = Y(c, e, (u || n).replace(/font-size:\s*[^;]+;?/, "") + `;font-size:${e}px`, r, i), s = Math.round(l === "sub" ? t * .52 : -t * .25);
2573
2601
  for (let e of o) e.type === "text" && (e.verticalAlign = s);
2574
2602
  a.push(...o);
2575
2603
  continue;
@@ -2577,7 +2605,7 @@ function J(e, t, n, r, i) {
2577
2605
  if (l === "span" || l === "a" || l === "div" || l === "font") {
2578
2606
  let e = u || n, o = /font-weight:\s*(bold|700|[89]\d\d)/.test(u), s = /font-style:\s*(italic|oblique)/.test(u);
2579
2607
  o && !/font-weight/.test(e) && (e += ";font-weight:bold"), s && !/font-style/.test(e) && (e += ";font-style:italic");
2580
- let l = J(c, t, e, r, i), d = u.match(/text-decoration:\s*([^;]+)/);
2608
+ let l = Y(c, t, e, r, i), d = u.match(/text-decoration:\s*([^;]+)/);
2581
2609
  if (d) {
2582
2610
  let e = d[1];
2583
2611
  for (let t of l) if (t.type === "text") {
@@ -2593,12 +2621,21 @@ function J(e, t, n, r, i) {
2593
2621
  a.push(...l);
2594
2622
  continue;
2595
2623
  }
2596
- let p = J(c, t, u || n, r, i);
2624
+ if (l === "p") {
2625
+ let e = Y(c, t, u || n, r, i);
2626
+ if (e.length > 0 && e.every((e) => e.type === "image" && !e.rawHtml)) for (let t of e) {
2627
+ let e = t, n = e.height / e.width || .6;
2628
+ e.width = r, e.height = Math.round(r * n);
2629
+ }
2630
+ a.push(...e);
2631
+ continue;
2632
+ }
2633
+ let p = Y(c, t, u || n, r, i);
2597
2634
  a.push(...p);
2598
2635
  }
2599
2636
  return a;
2600
2637
  }
2601
- function Ct(e) {
2638
+ function St(e) {
2602
2639
  return e.includes("blank-tiankong") || e.includes("blank_tiankong") ? {
2603
2640
  blankType: "tiankong",
2604
2641
  isEmpty: !0
@@ -2610,6 +2647,11 @@ function Ct(e) {
2610
2647
  isEmpty: !1
2611
2648
  } : null;
2612
2649
  }
2650
+ function Ct(e, t) {
2651
+ if (e.length > 0 && e.every((e) => e.type === "image" && !e.rawHtml)) return "right";
2652
+ let n = Tt(t);
2653
+ return n === "center" ? "center" : n === "right" ? "right" : void 0;
2654
+ }
2613
2655
  function wt(e, t, n, r, i, a) {
2614
2656
  let o = e.split(""), s = B(e, t, n, r, a || !1), c = s.length > 0 ? s[s.length - 1] + z(o[o.length - 1], t, n, r, a || !1) : 0;
2615
2657
  return {
@@ -2686,12 +2728,12 @@ function jt(e) {
2686
2728
  function Mt(e, t, n) {
2687
2729
  let r = e.outerHTML, i = e.getAttribute("style") || "", a = parseInt(i.match(/width:\s*(\d+)px/)?.[1] || "0"), o = i.match(/width:\s*([\d.]+)%/), s = e.querySelectorAll("tr").length, c = Math.max(60, s * 30 + 40), l = o ? Math.round(parseFloat(o[1]) / 100 * t) : a || t, u = Math.min(l, t), d = c;
2688
2730
  return u <= 0 || d <= 0 ? [{
2689
- ...rt([], n),
2731
+ ...nt([], n),
2690
2732
  availableWidth: t
2691
2733
  }] : [{
2692
- ...rt([{
2734
+ ...nt([{
2693
2735
  type: "image",
2694
- id: `inline-img-${++bt}`,
2736
+ id: `inline-img-${++yt}`,
2695
2737
  src: "",
2696
2738
  width: u,
2697
2739
  height: d,
@@ -2703,7 +2745,25 @@ function Mt(e, t, n) {
2703
2745
  //#endregion
2704
2746
  //#region src/utils/questionJsonParser.ts
2705
2747
  function Nt(e, t = {}) {
2706
- let { questionNo: n = "", score: r = "", contentWidth: i = 600, fontSize: a = 14, lineSpacing: o = 1.5, protectContent: s = !1 } = t, c = e.extra_json?.quest_type || "answer_question", l = c === "single_chose" || c === "multi_chose", u = Math.round(a * o * 1.67), d = St(e.question, {
2748
+ let { questionNo: n = "", score: r = "", contentWidth: i = 600, fontSize: a = 16, lineSpacing: o = 1, protectContent: s = !1 } = t;
2749
+ return e.children && e.children.length > 0 ? Ft(e, {
2750
+ questionNo: n,
2751
+ score: r,
2752
+ contentWidth: i,
2753
+ fontSize: a,
2754
+ lineSpacing: o,
2755
+ protectContent: s
2756
+ }) : Pt(e, {
2757
+ questionNo: n,
2758
+ score: r,
2759
+ contentWidth: i,
2760
+ fontSize: a,
2761
+ lineSpacing: o,
2762
+ protectContent: s
2763
+ });
2764
+ }
2765
+ function Pt(e, t) {
2766
+ let { questionNo: n, score: r, contentWidth: i, fontSize: a, lineSpacing: o, protectContent: s } = t, c = e.extra_json?.quest_type || "answer_question", l = c === "single_chose" || c === "multi_chose", u = Math.round(a * o * 1.67), d = xt(e.question, {
2707
2767
  questionNo: n,
2708
2768
  score: r,
2709
2769
  contentWidth: i,
@@ -2730,14 +2790,69 @@ function Nt(e, t = {}) {
2730
2790
  tags: e.tags
2731
2791
  }
2732
2792
  };
2733
- if (l && e.extra_json?.options && e.extra_json.options.length > 0) p.options = Pt(e.extra_json.options, i, a, o), p.paragraphs.push(Ft(u));
2734
- else for (let e = 0; e < 2; e++) p.paragraphs.push(Ft(u));
2793
+ if (l && e.extra_json?.options && e.extra_json.options.length > 0) p.options = It(e.extra_json.options, i, a, o), p.paragraphs.push(Lt(u));
2794
+ else for (let e = 0; e < 2; e++) p.paragraphs.push(Lt(u));
2735
2795
  return p.height = p.paragraphs.reduce((e, t) => e + (t.height || 26), 0), [p];
2736
2796
  }
2737
- function Pt(e, t, n, r) {
2797
+ function Ft(e, t) {
2798
+ let { questionNo: n, score: r, contentWidth: i, fontSize: a, lineSpacing: o, protectContent: s } = t, c = "answer_question", l = Math.round(a * o * 1.67), u = Date.now(), d = Math.random().toString(36).slice(2, 8), f = e.id ? `group-${e.id}-${u}-${d}` : `group-${e.qid || u}-${d}`, p = Math.max(100, i - 26.25), m = [], h = xt(e.question, {
2799
+ questionNo: n,
2800
+ score: r || "",
2801
+ contentWidth: i,
2802
+ fontSize: a,
2803
+ lineSpacing: o,
2804
+ skipAnswerArea: !0,
2805
+ protectContent: s
2806
+ });
2807
+ if (h.length > 0) {
2808
+ let t = h[0];
2809
+ t.type = "question", t.metadata = {
2810
+ ...t.metadata,
2811
+ qid: e.qid,
2812
+ questType: c,
2813
+ answer: e.extra_json?.answer || e.answer || "",
2814
+ tenantId: e.tenant_id,
2815
+ tags: e.tags,
2816
+ blockGroup: f,
2817
+ hasSubQuestions: !0,
2818
+ score: r || ""
2819
+ }, t.keepNext = !0;
2820
+ for (let e = 0; e < 2; e++) t.paragraphs.push(Lt(l));
2821
+ t.height = t.paragraphs.reduce((e, t) => e + (t.height || 26), 0), m.push(t);
2822
+ }
2823
+ if (e.children) for (let t = 0; t < e.children.length; t++) {
2824
+ let n = e.children[t], r = `(${t + 1})`, i = xt(n.question, {
2825
+ contentWidth: p,
2826
+ fontSize: a,
2827
+ lineSpacing: o,
2828
+ skipAnswerArea: !0,
2829
+ protectContent: s
2830
+ });
2831
+ if (i.length === 0) continue;
2832
+ let u = i[0];
2833
+ u.type = "sub-question", u.metadata = {
2834
+ ...u.metadata,
2835
+ questionNo: "",
2836
+ subLabel: r,
2837
+ label: `子题${r}`,
2838
+ topicId: `${f}-sub${t + 1}`,
2839
+ blockGroup: f,
2840
+ qid: n.qid,
2841
+ answer: n.answer || n.extra_json?.answer || "",
2842
+ questType: c,
2843
+ tenantId: n.tenant_id,
2844
+ tags: n.tags,
2845
+ score: ""
2846
+ };
2847
+ for (let e = 0; e < 2; e++) u.paragraphs.push(Lt(l));
2848
+ u.height = u.paragraphs.reduce((e, t) => e + (t.height || 26), 0), m.push(u);
2849
+ }
2850
+ return m;
2851
+ }
2852
+ function It(e, t, n, r) {
2738
2853
  let i = Math.max(100, t - 20);
2739
2854
  return e.map((e) => {
2740
- let t = St(e.content, {
2855
+ let t = xt(e.content, {
2741
2856
  contentWidth: i,
2742
2857
  fontSize: n,
2743
2858
  lineSpacing: r,
@@ -2763,7 +2878,7 @@ function Pt(e, t, n, r) {
2763
2878
  };
2764
2879
  });
2765
2880
  }
2766
- function Ft(e) {
2881
+ function Lt(e) {
2767
2882
  return {
2768
2883
  lines: [{
2769
2884
  elements: [{
@@ -2781,7 +2896,7 @@ function Ft(e) {
2781
2896
  }
2782
2897
  //#endregion
2783
2898
  //#region src/utils/chineseNumber.ts
2784
- var It = [
2899
+ var Rt = [
2785
2900
  "",
2786
2901
  "一",
2787
2902
  "二",
@@ -2794,35 +2909,35 @@ var It = [
2794
2909
  "九",
2795
2910
  "十"
2796
2911
  ];
2797
- function Lt(e) {
2912
+ function zt(e) {
2798
2913
  if (e <= 0) return "";
2799
- if (e <= 10) return It[e];
2914
+ if (e <= 10) return Rt[e];
2800
2915
  if (e < 20) {
2801
2916
  let t = e % 10;
2802
- return "十" + (t > 0 ? It[t] : "");
2917
+ return "十" + (t > 0 ? Rt[t] : "");
2803
2918
  }
2804
2919
  if (e < 100) {
2805
2920
  let t = Math.floor(e / 10), n = e % 10;
2806
- return It[t] + "十" + (n > 0 ? It[n] : "");
2921
+ return Rt[t] + "十" + (n > 0 ? Rt[n] : "");
2807
2922
  }
2808
2923
  if (e < 1e3) {
2809
- let t = Math.floor(e / 100), n = e % 100, r = It[t] + "百";
2810
- return n === 0 ? r : n < 10 ? r + "零" + It[n] : r + Lt(n);
2924
+ let t = Math.floor(e / 100), n = e % 100, r = Rt[t] + "百";
2925
+ return n === 0 ? r : n < 10 ? r + "零" + Rt[n] : r + zt(n);
2811
2926
  }
2812
2927
  return String(e);
2813
2928
  }
2814
- function Rt(e, t) {
2815
- let n = Lt(t);
2929
+ function Bt(e, t) {
2930
+ let n = zt(t);
2816
2931
  return n ? n + "、" + e : e;
2817
2932
  }
2818
- function zt(e) {
2933
+ function Vt(e) {
2819
2934
  let t = e.match(/^[一二三四五六七八九十百零]+、(.+)$/);
2820
2935
  return t ? t[1] : e;
2821
2936
  }
2822
2937
  //#endregion
2823
2938
  //#region src/utils/paperHtmlBuilder.ts
2824
- function Bt(e) {
2825
- let t = A[e];
2939
+ function Ht(e) {
2940
+ let t = j[e];
2826
2941
  return `
2827
2942
  /* ---------- Reset & Base ---------- */
2828
2943
  *, *::before, *::after {
@@ -3054,6 +3169,7 @@ text.swed-question-score {
3054
3169
  color: #000;
3055
3170
  display: flex;
3056
3171
  align-items: center;
3172
+ width: 100%;
3057
3173
  }
3058
3174
  .swed-student-code-table {
3059
3175
  border-collapse: collapse;
@@ -3068,6 +3184,13 @@ text.swed-question-score {
3068
3184
  text-align: center;
3069
3185
  font-size: 14px;
3070
3186
  }
3187
+ .swed-student-code-filler {
3188
+ height: 30px;
3189
+ border: 1px solid #000;
3190
+ margin-left: 8px;
3191
+ flex: 1;
3192
+ min-width: 20px;
3193
+ }
3071
3194
 
3072
3195
  /* ---------- foreignObject 尾部样式 ---------- */
3073
3196
  .swed-tail-time-wrapper {
@@ -3142,7 +3265,7 @@ text.swed-question-score {
3142
3265
  }
3143
3266
  `;
3144
3267
  }
3145
- function Vt(e) {
3268
+ function Ut(e) {
3146
3269
  let { svgs: t, paperName: n = "试卷", paperSize: r = "A4" } = e, i = t.map((e) => {
3147
3270
  let t = e.match(/viewBox="0 0 (\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)"/), [, n, r] = t ? [
3148
3271
  null,
@@ -3162,24 +3285,24 @@ function Vt(e) {
3162
3285
  <head>
3163
3286
  <meta charset="UTF-8">
3164
3287
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
3165
- <title>${Ht(n)}</title>
3166
- <style>${Bt(r)}</style>
3288
+ <title>${Wt(n)}</title>
3289
+ <style>${Ht(r)}</style>
3167
3290
  </head>
3168
3291
  <body>
3169
3292
  ${i}
3170
3293
  </body>
3171
3294
  </html>`;
3172
3295
  }
3173
- function Ht(e) {
3296
+ function Wt(e) {
3174
3297
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
3175
3298
  }
3176
3299
  //#endregion
3177
3300
  //#region ../node_modules/qrcode/lib/can-promise.js
3178
- var Ut = /* @__PURE__ */ D(((e, t) => {
3301
+ var Gt = /* @__PURE__ */ D(((e, t) => {
3179
3302
  t.exports = function() {
3180
3303
  return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
3181
3304
  };
3182
- })), Y = /* @__PURE__ */ D(((e) => {
3305
+ })), X = /* @__PURE__ */ D(((e) => {
3183
3306
  var t, n = [
3184
3307
  0,
3185
3308
  26,
@@ -3241,7 +3364,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3241
3364
  }, e.toSJIS = function(e) {
3242
3365
  return t(e);
3243
3366
  };
3244
- })), Wt = /* @__PURE__ */ D(((e) => {
3367
+ })), Kt = /* @__PURE__ */ D(((e) => {
3245
3368
  e.L = { bit: 1 }, e.M = { bit: 0 }, e.Q = { bit: 3 }, e.H = { bit: 2 };
3246
3369
  function t(t) {
3247
3370
  if (typeof t != "string") throw Error("Param is not a string");
@@ -3267,7 +3390,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3267
3390
  return r;
3268
3391
  }
3269
3392
  };
3270
- })), Gt = /* @__PURE__ */ D(((e, t) => {
3393
+ })), qt = /* @__PURE__ */ D(((e, t) => {
3271
3394
  function n() {
3272
3395
  this.buffer = [], this.length = 0;
3273
3396
  }
@@ -3287,7 +3410,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3287
3410
  this.buffer.length <= t && this.buffer.push(0), e && (this.buffer[t] |= 128 >>> this.length % 8), this.length++;
3288
3411
  }
3289
3412
  }, t.exports = n;
3290
- })), Kt = /* @__PURE__ */ D(((e, t) => {
3413
+ })), Jt = /* @__PURE__ */ D(((e, t) => {
3291
3414
  function n(e) {
3292
3415
  if (!e || e < 1) throw Error("BitMatrix size must be defined and greater than 0");
3293
3416
  this.size = e, this.data = new Uint8Array(e * e), this.reservedBit = new Uint8Array(e * e);
@@ -3302,8 +3425,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3302
3425
  }, n.prototype.isReserved = function(e, t) {
3303
3426
  return this.reservedBit[e * this.size + t];
3304
3427
  }, t.exports = n;
3305
- })), qt = /* @__PURE__ */ D(((e) => {
3306
- var t = Y().getSymbolSize;
3428
+ })), Yt = /* @__PURE__ */ D(((e) => {
3429
+ var t = X().getSymbolSize;
3307
3430
  e.getRowColCoords = function(e) {
3308
3431
  if (e === 1) return [];
3309
3432
  let n = Math.floor(e / 7) + 2, r = t(e), i = r === 145 ? 26 : Math.ceil((r - 13) / (2 * n - 2)) * 2, a = [r - 7];
@@ -3314,8 +3437,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3314
3437
  for (let e = 0; e < i; e++) for (let t = 0; t < i; t++) e === 0 && t === 0 || e === 0 && t === i - 1 || e === i - 1 && t === 0 || n.push([r[e], r[t]]);
3315
3438
  return n;
3316
3439
  };
3317
- })), Jt = /* @__PURE__ */ D(((e) => {
3318
- var t = Y().getSymbolSize, n = 7;
3440
+ })), Xt = /* @__PURE__ */ D(((e) => {
3441
+ var t = X().getSymbolSize, n = 7;
3319
3442
  e.getPositions = function(e) {
3320
3443
  let r = t(e);
3321
3444
  return [
@@ -3324,7 +3447,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3324
3447
  [0, r - n]
3325
3448
  ];
3326
3449
  };
3327
- })), Yt = /* @__PURE__ */ D(((e) => {
3450
+ })), Zt = /* @__PURE__ */ D(((e) => {
3328
3451
  e.Patterns = {
3329
3452
  PATTERN000: 0,
3330
3453
  PATTERN001: 1,
@@ -3400,8 +3523,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3400
3523
  }
3401
3524
  return i;
3402
3525
  };
3403
- })), Xt = /* @__PURE__ */ D(((e) => {
3404
- var t = Wt(), n = [
3526
+ })), Qt = /* @__PURE__ */ D(((e) => {
3527
+ var t = Kt(), n = [
3405
3528
  1,
3406
3529
  1,
3407
3530
  1,
@@ -3741,7 +3864,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3741
3864
  default: return;
3742
3865
  }
3743
3866
  };
3744
- })), Zt = /* @__PURE__ */ D(((e) => {
3867
+ })), $t = /* @__PURE__ */ D(((e) => {
3745
3868
  var t = new Uint8Array(512), n = new Uint8Array(256);
3746
3869
  (function() {
3747
3870
  let e = 1;
@@ -3755,8 +3878,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3755
3878
  }, e.mul = function(e, r) {
3756
3879
  return e === 0 || r === 0 ? 0 : t[n[e] + n[r]];
3757
3880
  };
3758
- })), Qt = /* @__PURE__ */ D(((e) => {
3759
- var t = Zt();
3881
+ })), en = /* @__PURE__ */ D(((e) => {
3882
+ var t = $t();
3760
3883
  e.mul = function(e, n) {
3761
3884
  let r = new Uint8Array(e.length + n.length - 1);
3762
3885
  for (let i = 0; i < e.length; i++) for (let a = 0; a < n.length; a++) r[i + a] ^= t.mul(e[i], n[a]);
@@ -3776,8 +3899,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3776
3899
  for (let i = 0; i < n; i++) r = e.mul(r, new Uint8Array([1, t.exp(i)]));
3777
3900
  return r;
3778
3901
  };
3779
- })), $t = /* @__PURE__ */ D(((e, t) => {
3780
- var n = Qt();
3902
+ })), tn = /* @__PURE__ */ D(((e, t) => {
3903
+ var n = en();
3781
3904
  function r(e) {
3782
3905
  this.genPoly = void 0, this.degree = e, this.degree && this.initialize(this.degree);
3783
3906
  }
@@ -3794,11 +3917,11 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3794
3917
  }
3795
3918
  return r;
3796
3919
  }, t.exports = r;
3797
- })), en = /* @__PURE__ */ D(((e) => {
3920
+ })), nn = /* @__PURE__ */ D(((e) => {
3798
3921
  e.isValid = function(e) {
3799
3922
  return !isNaN(e) && e >= 1 && e <= 40;
3800
3923
  };
3801
- })), tn = /* @__PURE__ */ D(((e) => {
3924
+ })), rn = /* @__PURE__ */ D(((e) => {
3802
3925
  var t = "[0-9]+", n = "[A-Z $%*+\\-./:]+", r = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
3803
3926
  r = r.replace(/u/g, "\\u");
3804
3927
  var i = "(?:(?![A-Z0-9 $%*+\\-./:]|" + r + ")(?:.|[\r\n]))+";
@@ -3811,8 +3934,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3811
3934
  }, e.testAlphanumeric = function(e) {
3812
3935
  return s.test(e);
3813
3936
  };
3814
- })), X = /* @__PURE__ */ D(((e) => {
3815
- var t = en(), n = tn();
3937
+ })), an = /* @__PURE__ */ D(((e) => {
3938
+ var t = nn(), n = rn();
3816
3939
  e.NUMERIC = {
3817
3940
  id: "Numeric",
3818
3941
  bit: 1,
@@ -3875,8 +3998,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3875
3998
  return n;
3876
3999
  }
3877
4000
  };
3878
- })), nn = /* @__PURE__ */ D(((e) => {
3879
- var t = Y(), n = Xt(), r = Wt(), i = X(), a = en(), o = 7973, s = t.getBCHDigit(o);
4001
+ })), on = /* @__PURE__ */ D(((e) => {
4002
+ var t = X(), n = Qt(), r = Kt(), i = an(), a = nn(), o = 7973, s = t.getBCHDigit(o);
3880
4003
  function c(t, n, r) {
3881
4004
  for (let i = 1; i <= 40; i++) if (n <= e.getCapacity(i, r, t)) return i;
3882
4005
  }
@@ -3922,15 +4045,15 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3922
4045
  for (; t.getBCHDigit(n) - s >= 0;) n ^= o << t.getBCHDigit(n) - s;
3923
4046
  return e << 12 | n;
3924
4047
  };
3925
- })), rn = /* @__PURE__ */ D(((e) => {
3926
- var t = Y(), n = 1335, r = 21522, i = t.getBCHDigit(n);
4048
+ })), sn = /* @__PURE__ */ D(((e) => {
4049
+ var t = X(), n = 1335, r = 21522, i = t.getBCHDigit(n);
3927
4050
  e.getEncodedBits = function(e, a) {
3928
4051
  let o = e.bit << 3 | a, s = o << 10;
3929
4052
  for (; t.getBCHDigit(s) - i >= 0;) s ^= n << t.getBCHDigit(s) - i;
3930
4053
  return (o << 10 | s) ^ r;
3931
4054
  };
3932
- })), an = /* @__PURE__ */ D(((e, t) => {
3933
- var n = X();
4055
+ })), cn = /* @__PURE__ */ D(((e, t) => {
4056
+ var n = an();
3934
4057
  function r(e) {
3935
4058
  this.mode = n.NUMERIC, this.data = e.toString();
3936
4059
  }
@@ -3946,8 +4069,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3946
4069
  let i = this.data.length - t;
3947
4070
  i > 0 && (n = this.data.substr(t), r = parseInt(n, 10), e.put(r, i * 3 + 1));
3948
4071
  }, t.exports = r;
3949
- })), on = /* @__PURE__ */ D(((e, t) => {
3950
- var n = X(), r = /* @__PURE__ */ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");
4072
+ })), ln = /* @__PURE__ */ D(((e, t) => {
4073
+ var n = an(), r = /* @__PURE__ */ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");
3951
4074
  function i(e) {
3952
4075
  this.mode = n.ALPHANUMERIC, this.data = e;
3953
4076
  }
@@ -3965,8 +4088,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3965
4088
  }
3966
4089
  this.data.length % 2 && e.put(r.indexOf(this.data[t]), 6);
3967
4090
  }, t.exports = i;
3968
- })), sn = /* @__PURE__ */ D(((e, t) => {
3969
- var n = X();
4091
+ })), un = /* @__PURE__ */ D(((e, t) => {
4092
+ var n = an();
3970
4093
  function r(e) {
3971
4094
  this.mode = n.BYTE, typeof e == "string" ? this.data = new TextEncoder().encode(e) : this.data = new Uint8Array(e);
3972
4095
  }
@@ -3979,8 +4102,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3979
4102
  }, r.prototype.write = function(e) {
3980
4103
  for (let t = 0, n = this.data.length; t < n; t++) e.put(this.data[t], 8);
3981
4104
  }, t.exports = r;
3982
- })), cn = /* @__PURE__ */ D(((e, t) => {
3983
- var n = X(), r = Y();
4105
+ })), dn = /* @__PURE__ */ D(((e, t) => {
4106
+ var n = an(), r = X();
3984
4107
  function i(e) {
3985
4108
  this.mode = n.KANJI, this.data = e;
3986
4109
  }
@@ -4000,7 +4123,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
4000
4123
  n = (n >>> 8 & 255) * 192 + (n & 255), e.put(n, 13);
4001
4124
  }
4002
4125
  }, t.exports = i;
4003
- })), ln = /* @__PURE__ */ D(((e, t) => {
4126
+ })), fn = /* @__PURE__ */ D(((e, t) => {
4004
4127
  var n = {
4005
4128
  single_source_shortest_paths: function(e, t, r) {
4006
4129
  var i = {}, a = {};
@@ -4053,8 +4176,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
4053
4176
  }
4054
4177
  };
4055
4178
  t !== void 0 && (t.exports = n);
4056
- })), un = /* @__PURE__ */ D(((e) => {
4057
- var t = X(), n = an(), r = on(), i = sn(), a = cn(), o = tn(), s = Y(), c = ln();
4179
+ })), pn = /* @__PURE__ */ D(((e) => {
4180
+ var t = an(), n = cn(), r = ln(), i = un(), a = dn(), o = rn(), s = X(), c = fn();
4058
4181
  function l(e) {
4059
4182
  return unescape(encodeURIComponent(e)).length;
4060
4183
  }
@@ -4181,8 +4304,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
4181
4304
  }, e.rawSplit = function(t) {
4182
4305
  return e.fromArray(d(t, s.isKanjiModeEnabled()));
4183
4306
  };
4184
- })), dn = /* @__PURE__ */ D(((e) => {
4185
- var t = Y(), n = Wt(), r = Gt(), i = Kt(), a = qt(), o = Jt(), s = Yt(), c = Xt(), l = $t(), u = nn(), d = rn(), f = X(), p = un();
4307
+ })), mn = /* @__PURE__ */ D(((e) => {
4308
+ var t = X(), n = Kt(), r = qt(), i = Jt(), a = Yt(), o = Xt(), s = Zt(), c = Qt(), l = tn(), u = on(), d = sn(), f = an(), p = pn();
4186
4309
  function m(e, t) {
4187
4310
  let n = e.size, r = o.getPositions(t);
4188
4311
  for (let t = 0; t < r.length; t++) {
@@ -4277,7 +4400,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
4277
4400
  let i = n.M, a, o;
4278
4401
  return r !== void 0 && (i = n.from(r.errorCorrectionLevel, n.M), a = u.from(r.version), o = s.from(r.maskPattern), r.toSJISFunc && t.setToSJISFunction(r.toSJISFunc)), S(e, a, i, o);
4279
4402
  };
4280
- })), fn = /* @__PURE__ */ D(((e) => {
4403
+ })), hn = /* @__PURE__ */ D(((e) => {
4281
4404
  function t(e) {
4282
4405
  if (typeof e == "number" && (e = e.toString()), typeof e != "string") throw Error("Color should be defined as hex string");
4283
4406
  let t = e.slice().replace("#", "").split("");
@@ -4324,8 +4447,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
4324
4447
  t[u++] = d.r, t[u++] = d.g, t[u++] = d.b, t[u] = d.a;
4325
4448
  }
4326
4449
  };
4327
- })), pn = /* @__PURE__ */ D(((e) => {
4328
- var t = fn();
4450
+ })), gn = /* @__PURE__ */ D(((e) => {
4451
+ var t = hn();
4329
4452
  function n(e, t, n) {
4330
4453
  e.clearRect(0, 0, t.width, t.height), t.style ||= {}, t.height = n, t.width = n, t.style.height = n + "px", t.style.width = n + "px";
4331
4454
  }
@@ -4347,8 +4470,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
4347
4470
  let a = e.render(t, n, i), o = i.type || "image/png", s = i.rendererOpts || {};
4348
4471
  return a.toDataURL(o, s.quality);
4349
4472
  };
4350
- })), mn = /* @__PURE__ */ D(((e) => {
4351
- var t = fn();
4473
+ })), _n = /* @__PURE__ */ D(((e) => {
4474
+ var t = hn();
4352
4475
  function n(e, t) {
4353
4476
  let n = e.a / 255, r = t + "=\"" + e.hex + "\"";
4354
4477
  return n < 1 ? r + " " + t + "-opacity=\"" + n.toFixed(2).slice(1) + "\"" : r;
@@ -4369,8 +4492,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
4369
4492
  let o = t.getOptions(r), s = e.modules.size, c = e.modules.data, l = s + o.margin * 2, u = o.color.light.a ? "<path " + n(o.color.light, "fill") + " d=\"M0 0h" + l + "v" + l + "H0z\"/>" : "", d = "<path " + n(o.color.dark, "stroke") + " d=\"" + i(c, s, o.margin) + "\"/>", f = "viewBox=\"0 0 " + l + " " + l + "\"", p = "<svg xmlns=\"http://www.w3.org/2000/svg\" " + (o.width ? "width=\"" + o.width + "\" height=\"" + o.width + "\" " : "") + f + " shape-rendering=\"crispEdges\">" + u + d + "</svg>\n";
4370
4493
  return typeof a == "function" && a(null, p), p;
4371
4494
  };
4372
- })), hn = /* @__PURE__ */ O((/* @__PURE__ */ D(((e) => {
4373
- var t = Ut(), n = dn(), r = pn(), i = mn();
4495
+ })), vn = /* @__PURE__ */ k((/* @__PURE__ */ D(((e) => {
4496
+ var t = Gt(), n = mn(), r = gn(), i = _n();
4374
4497
  function a(e, r, i, a, o) {
4375
4498
  let s = [].slice.call(arguments, 1), c = s.length, l = typeof s[c - 1] == "function";
4376
4499
  if (!l && !t()) throw Error("Callback required as last argument");
@@ -4398,10 +4521,10 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
4398
4521
  return i.render(e, n);
4399
4522
  });
4400
4523
  })))(), 1);
4401
- async function gn(e, t = 200) {
4524
+ async function yn(e, t = 200) {
4402
4525
  if (!e || e.trim() === "") return "";
4403
4526
  try {
4404
- return await hn.toDataURL(e, {
4527
+ return await vn.toDataURL(e, {
4405
4528
  width: t,
4406
4529
  margin: 1,
4407
4530
  color: {
@@ -4416,13 +4539,13 @@ async function gn(e, t = 200) {
4416
4539
  }
4417
4540
  //#endregion
4418
4541
  //#region src/composables/usePaperSelection.ts
4419
- function _n(e) {
4542
+ function bn(e) {
4420
4543
  let n = f(null), r = f(null), i = f(null), a = t(() => n.value && e.value.find((e) => e.id === n.value) || null), o = t(() => r.value ? d(r.value) : null), s = t(() => i.value ? p(i.value) : null);
4421
4544
  function c(e) {
4422
- n.value = e, e && (r.value = null);
4545
+ n.value = e, e && (r.value = null, i.value = null);
4423
4546
  }
4424
4547
  function l(e) {
4425
- r.value = e, e && (n.value = null);
4548
+ r.value = e, e && (n.value = null, i.value = null);
4426
4549
  }
4427
4550
  function u(e) {
4428
4551
  i.value = e, e && (n.value = null, r.value = null);
@@ -4481,7 +4604,7 @@ function _n(e) {
4481
4604
  }
4482
4605
  //#endregion
4483
4606
  //#region src/composables/paperHelpers.ts
4484
- var vn = {
4607
+ var xn = {
4485
4608
  三号: 21,
4486
4609
  小三: 20,
4487
4610
  四号: 19,
@@ -4489,24 +4612,24 @@ var vn = {
4489
4612
  五号: 14,
4490
4613
  小五: 12
4491
4614
  };
4492
- function yn(e) {
4493
- return vn[e] ?? 14;
4615
+ function Sn(e) {
4616
+ return xn[e] ?? 16;
4494
4617
  }
4495
- function bn(e) {
4496
- for (let [t, n] of Object.entries(vn)) if (n === e) return t;
4618
+ function Cn(e) {
4619
+ for (let [t, n] of Object.entries(xn)) if (n === e) return t;
4497
4620
  return "五号";
4498
4621
  }
4499
4622
  function Z(e) {
4500
- return typeof e.fontSize == "number" ? e.fontSize : yn(e.fontSize || "五号");
4623
+ return typeof e.fontSize == "number" ? e.fontSize : Sn(e.fontSize || "小四");
4501
4624
  }
4502
4625
  function Q(e) {
4503
- return e.lineSpacing ?? 1.5;
4626
+ return e.lineSpacing ?? 1;
4504
4627
  }
4505
- function xn(e, t) {
4628
+ function wn(e, t) {
4506
4629
  return Math.round(e * t * 35 / (14 * 1.5));
4507
4630
  }
4508
4631
  function $(e, t) {
4509
- let n = xn(e, t);
4632
+ let n = wn(e, t);
4510
4633
  return {
4511
4634
  lines: [{
4512
4635
  elements: [{
@@ -4522,15 +4645,15 @@ function $(e, t) {
4522
4645
  height: n
4523
4646
  };
4524
4647
  }
4525
- function Sn(e, t, n, r, i = 0) {
4526
- let a = xn(t, n), o = r && r > 0 ? it(e, r, a, i) : [rt(e, a)];
4648
+ function Tn(e, t, n, r, i = 0) {
4649
+ let a = wn(t, n), o = r && r > 0 ? rt(e, r, a, i) : [nt(e, a)];
4527
4650
  return {
4528
4651
  lines: o,
4529
4652
  y: 0,
4530
4653
  height: o.reduce((e, t) => e + t.lineHeight, 0) + 4
4531
4654
  };
4532
4655
  }
4533
- function Cn(e) {
4656
+ function En(e) {
4534
4657
  let t = e.paragraphs.length;
4535
4658
  for (; t > 0;) {
4536
4659
  let n = e.paragraphs[t - 1];
@@ -4539,14 +4662,14 @@ function Cn(e) {
4539
4662
  }
4540
4663
  return t;
4541
4664
  }
4542
- var wn = 0, Tn = 0;
4543
- function En(e) {
4665
+ var Dn = 0, On = 0;
4666
+ function kn(e) {
4544
4667
  return e.type === "question" ? (e.metadata?.questionNo || "").length > 2 ? 26.25 : 17.5 : e.type === "sub-question" ? 26.25 : 0;
4545
4668
  }
4546
- function Dn(e, t) {
4547
- return t - En(e);
4669
+ function An(e, t) {
4670
+ return t - kn(e);
4548
4671
  }
4549
- function On(e) {
4672
+ function jn(e) {
4550
4673
  let t = [], n = 0;
4551
4674
  for (; n < e.length;) {
4552
4675
  if (e[n] === "\\" && e.substring(n, n + 2) === "\\(") {
@@ -4577,11 +4700,11 @@ function On(e) {
4577
4700
  }
4578
4701
  return t;
4579
4702
  }
4580
- function kn(e, t) {
4581
- let n = [], r = On(e);
4582
- for (let e of r) if (e.type === "text") n.push(An(e.value, t, !1, "\"Times New Roman\", SimSun,'Cambria Math'", "#000"));
4703
+ function Mn(e, t) {
4704
+ let n = [], r = jn(e);
4705
+ for (let e of r) if (e.type === "text") n.push(Nn(e.value, t, !1, "\"Times New Roman\", SimSun,'Cambria Math'", "#000"));
4583
4706
  else if (e.type === "formula") {
4584
- let { svg: t, width: r, height: i } = G(e.value);
4707
+ let { svg: t, width: r, height: i } = K(e.value);
4585
4708
  n.push({
4586
4709
  type: "formula",
4587
4710
  width: r,
@@ -4591,7 +4714,7 @@ function kn(e, t) {
4591
4714
  });
4592
4715
  } else e.type === "blank" && n.push({
4593
4716
  type: "underline",
4594
- id: `ul-${++Tn}`,
4717
+ id: `ul-${++On}`,
4595
4718
  width: 80,
4596
4719
  height: 20,
4597
4720
  placeholder: "空",
@@ -4600,7 +4723,7 @@ function kn(e, t) {
4600
4723
  });
4601
4724
  return n;
4602
4725
  }
4603
- function An(e, t, n, r, i) {
4726
+ function Nn(e, t, n, r, i) {
4604
4727
  let a = e.split(""), o = B(e, t, r);
4605
4728
  return {
4606
4729
  type: "text",
@@ -4615,14 +4738,14 @@ function An(e, t, n, r, i) {
4615
4738
  xPositions: o
4616
4739
  };
4617
4740
  }
4618
- function jn(e, t, n, r, i, a, o = !1) {
4741
+ function Pn(e, t, n, r, i, a, o = !1) {
4619
4742
  let s = [];
4620
4743
  for (let e = 0; e < n.length; e++) {
4621
- let t = kn(n[e], r);
4622
- s.push(Sn(t, r, i, a && a > 0 ? a : void 0));
4744
+ let t = Mn(n[e], r);
4745
+ s.push(Tn(t, r, i, a && a > 0 ? a : void 0));
4623
4746
  }
4624
4747
  for (let e = 0; e < 2; e++) s.push($(r, i));
4625
- let c = s.reduce((e, t) => e + (t.height || 26), 0), l = `topic-${e.replace(".", "")}-${++wn}`;
4748
+ let c = s.reduce((e, t) => e + (t.height || 26), 0), l = `topic-${e.replace(".", "")}-${++Dn}`;
4626
4749
  return {
4627
4750
  id: `q-${e.replace(".", "")}-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
4628
4751
  type: "question",
@@ -4638,10 +4761,10 @@ function jn(e, t, n, r, i, a, o = !1) {
4638
4761
  }
4639
4762
  };
4640
4763
  }
4641
- function Mn(e, t, n, r, i, a, o = !1) {
4642
- let s = [], c = `group-${e.replace(".", "")}`, l = [], u = 0, d = (n, u) => {
4764
+ function Fn(e, t, n, r, i, a, o = !1) {
4765
+ let s = [], c = `group-${e.replace(".", "")}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, l = [], u = 0, d = (n, u) => {
4643
4766
  if (l.length === 0) return;
4644
- let d = l.map((e) => Sn(kn(e, r), r, i, a && a > 0 ? a : void 0));
4767
+ let d = l.map((e) => Tn(Mn(e, r), r, i, a && a > 0 ? a : void 0));
4645
4768
  if (!n) for (let e = 0; e < 2; e++) d.push($(r, i));
4646
4769
  let f = d.reduce((e, t) => e + (t.height || 26), 0), p = `${c}-${n ? "header" : `sub${u}`}`;
4647
4770
  s.push({
@@ -4667,7 +4790,7 @@ function Mn(e, t, n, r, i, a, o = !1) {
4667
4790
  }
4668
4791
  return d(s.length === 0, u), s;
4669
4792
  }
4670
- function Nn(e) {
4793
+ function In(e) {
4671
4794
  let t = [];
4672
4795
  for (let n of e.paragraphs) {
4673
4796
  if (n.lines.length > 0 && n.lines.every((e) => e.elements.length > 0 && e.elements.every((e) => e.type === "enter"))) continue;
@@ -4681,18 +4804,24 @@ function Nn(e) {
4681
4804
  }
4682
4805
  return t.join("\n");
4683
4806
  }
4684
- function Pn(e) {
4807
+ function Ln(e) {
4685
4808
  return e.metadata?.questionNo ? `第${e.metadata.questionNo.replace(".", "")}题` : e.metadata?.subLabel ? e.metadata.subLabel : e.metadata?.label || e.id;
4686
4809
  }
4687
4810
  //#endregion
4688
4811
  //#region src/composables/usePaperBlockOps.ts
4689
- function Fn(e) {
4690
- let { blocks: t, settings: n, pages: r, isDirty: i, layoutEngine: a, svgRenderer: o, paperName: s, schoolName: c, qrCodeContent: l, qrCodeImage: u, totalScore: d, selectedBlockId: f, findInlineImageById: p, findUnderlineById: m, relayout: h } = e;
4691
- function g() {
4812
+ function Rn(e) {
4813
+ let { blocks: t, settings: n, pages: r, isDirty: i, layoutEngine: a, svgRenderer: o, paperName: s, schoolName: c, qrCodeContent: l, qrCodeImage: u, totalScore: d, selectedBlockId: p, findInlineImageById: m, findUnderlineById: h, relayout: g } = e, _ = [], v = f(!1), y = !1;
4814
+ function b() {
4815
+ y || (_.push(H()), v.value = !0, i.value = !0);
4816
+ }
4817
+ function x() {
4818
+ _.length !== 0 && (y = !0, ue(_.pop()), y = !1, v.value = _.length > 0);
4819
+ }
4820
+ function S() {
4692
4821
  let e = Z(n.value), r = Q(n.value), s = a.value.columnWidth;
4693
4822
  s <= 0 || (t.value = t.value.map((t) => {
4694
4823
  if (!t.paragraphs || t.paragraphs.length === 0) return t;
4695
- let n = Dn(t, s), i = [], a = !1;
4824
+ let n = An(t, s), i = [], a = !1;
4696
4825
  for (let o = 0; o < t.paragraphs.length; o++) {
4697
4826
  let s = t.paragraphs[o];
4698
4827
  if (s.lines.length > 0 && s.lines.every((e) => e.elements.length > 0 && e.elements.every((e) => e.type === "enter"))) {
@@ -4700,21 +4829,21 @@ function Fn(e) {
4700
4829
  continue;
4701
4830
  }
4702
4831
  let c = [];
4703
- for (let e of s.lines) for (let t of e.elements) if (t.type === "text") {
4704
- let e = t, n = e.value.split("");
4705
- for (let t = 0; t < n.length; t++) {
4706
- let r = In(n[t], e.fontSize, e.fontFamily, e.bold, e.italic);
4832
+ for (let t of s.lines) for (let n of t.elements) if (n.type === "text") {
4833
+ let t = n, r = t.value.split("");
4834
+ for (let n = 0; n < r.length; n++) {
4835
+ let i = zn(r[n], e, t.fontFamily, t.bold, t.italic);
4707
4836
  c.push({
4708
- ...e,
4709
- value: n[t],
4710
- fontSize: e.fontSize,
4711
- width: r,
4712
- height: e.fontSize * 1.4,
4837
+ ...t,
4838
+ value: r[n],
4839
+ fontSize: e,
4840
+ width: i,
4841
+ height: e * 1.4,
4713
4842
  xPositions: [0]
4714
4843
  });
4715
4844
  }
4716
- } else if (t.type === "underline") {
4717
- let e = t;
4845
+ } else if (n.type === "underline") {
4846
+ let e = n;
4718
4847
  if (e.id) {
4719
4848
  let t = c.find((t) => t.type === "underline" && t.id === e.id);
4720
4849
  if (t) t.width += e.width;
@@ -4722,23 +4851,23 @@ function Fn(e) {
4722
4851
  let t = { ...e };
4723
4852
  delete t.isSplitPart, c.push(t);
4724
4853
  }
4725
- } else c.push(t);
4726
- } else c.push(t);
4854
+ } else c.push(n);
4855
+ } else c.push(n);
4727
4856
  let l;
4728
- if (a) l = Sn(c, e, r, n > 0 ? n : void 0, 0);
4857
+ if (a) l = Tn(c, e, r, n > 0 ? n : void 0, 0);
4729
4858
  else {
4730
4859
  let i = t.metadata?.score || "", o = i ? se(`(${i}分)`, e, "SimSun, STSong, serif") : 0;
4731
- l = Sn(c, e, r, n > 0 ? n : void 0, o), a = !0;
4860
+ l = Tn(c, e, r, n > 0 ? n : void 0, o), a = !0;
4732
4861
  }
4733
4862
  t.paragraphs[o].justification && (l.justification = t.paragraphs[o].justification), i.push(l);
4734
4863
  }
4735
4864
  let c = 0;
4736
- t.options && t.options.length > 0 && (c = o.value.getOptionsHeight(t.options, Dn(t, s)));
4865
+ t.options && t.options.length > 0 && (c = o.value.getOptionsHeight(t.options, An(t, s)));
4737
4866
  let l = t.metadata?.customHeight;
4738
4867
  if (l) {
4739
4868
  let t = i.reduce((e, t) => e + (t.height || 26), 0) + c;
4740
4869
  if (l > t) {
4741
- let n = l - t, a = xn(e, r) + 4, o = Math.round(n / a);
4870
+ let n = l - t, a = wn(e, r) + 4, o = Math.round(n / a);
4742
4871
  for (let t = 0; t < o; t++) i.push($(e, r));
4743
4872
  }
4744
4873
  }
@@ -4752,12 +4881,13 @@ function Fn(e) {
4752
4881
  originalContentWidth: n
4753
4882
  }
4754
4883
  };
4755
- }), i.value = !0, h());
4884
+ }), i.value = !0, g());
4756
4885
  }
4757
- function _(e) {
4758
- t.value = [...t.value, e], M(), i.value = !0, h();
4886
+ function C(e) {
4887
+ b(), t.value = [...t.value, e], I(), i.value = !0, g();
4759
4888
  }
4760
- function v(e, n) {
4889
+ function w(e, n) {
4890
+ b();
4761
4891
  let r = {
4762
4892
  id: `title-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
4763
4893
  type: "title",
@@ -4777,35 +4907,39 @@ function Fn(e) {
4777
4907
  ...t.value.slice(e)
4778
4908
  ] : t.value = [...t.value, r];
4779
4909
  } else t.value = [...t.value, r];
4780
- i.value = !0, M(), h();
4910
+ i.value = !0, I(), g();
4781
4911
  }
4782
- function y(e) {
4912
+ function T(e) {
4913
+ b();
4783
4914
  let n = new Map(t.value.map((e) => [e.id, e])), r = e.map((e) => n.get(e)).filter((e) => !!e);
4784
- r.length === t.value.length && (t.value = r, M(), i.value = !0, h());
4915
+ r.length === t.value.length && (t.value = r, I(), i.value = !0, g());
4785
4916
  }
4786
- function b(e) {
4787
- t.value = t.value.filter((t) => t.id !== e), f.value === e && (f.value = null), M(), i.value = !0, h();
4917
+ function E(e) {
4918
+ b(), t.value = t.value.filter((t) => t.id !== e), p.value === e && (p.value = null), I(), i.value = !0, g();
4788
4919
  }
4789
- function x(e, n) {
4920
+ function D(e, n) {
4921
+ b();
4790
4922
  let r = t.value.find((t) => t.id === e);
4791
4923
  r && (r.metadata = {
4792
4924
  ...r.metadata,
4793
4925
  label: n
4794
- }, i.value = !0, h());
4926
+ }, i.value = !0, g());
4795
4927
  }
4796
- function S(e, r) {
4928
+ function O(e, r) {
4929
+ b();
4797
4930
  let a = t.value.findIndex((t) => t.id === e);
4798
4931
  if (a === -1) return;
4799
- let o = t.value[a], s = Z(n.value), c = Q(n.value), l = Math.max(0, o.paragraphs.length - Cn(o)), u = [...r];
4932
+ let o = t.value[a], s = Z(n.value), c = Q(n.value), l = Math.max(0, o.paragraphs.length - En(o)), u = [...r];
4800
4933
  for (let e = 0; e < l; e++) u.push($(s, c));
4801
4934
  let d = u.reduce((e, t) => e + (t.height || 26), 0);
4802
4935
  t.value = t.value.map((e, t) => t === a ? {
4803
4936
  ...e,
4804
4937
  paragraphs: u,
4805
4938
  height: d
4806
- } : e), i.value = !0, h();
4939
+ } : e), i.value = !0, g();
4807
4940
  }
4808
- function C(e, n) {
4941
+ function k(e, n) {
4942
+ b();
4809
4943
  let r = t.value.findIndex((t) => t.id === e);
4810
4944
  r !== -1 && (t.value = t.value.map((e, t) => t === r ? {
4811
4945
  ...e,
@@ -4813,24 +4947,26 @@ function Fn(e) {
4813
4947
  ...e.metadata,
4814
4948
  score: n
4815
4949
  }
4816
- } : e), i.value = !0, h());
4950
+ } : e), i.value = !0, g());
4817
4951
  }
4818
- function w(e) {
4952
+ function A(e) {
4953
+ b();
4819
4954
  let n = t.value.findIndex((t) => t.id === e);
4820
4955
  if (n === -1) return;
4821
4956
  let r = t.value[n].protectContent === !0;
4822
4957
  t.value = t.value.map((e, t) => t === n ? {
4823
4958
  ...e,
4824
4959
  protectContent: !r
4825
- } : e), i.value = !0, h();
4960
+ } : e), i.value = !0, g();
4826
4961
  }
4827
- function T(e) {
4828
- n.value = {
4962
+ function j(e) {
4963
+ b(), n.value = {
4829
4964
  ...n.value,
4830
4965
  showScore: e
4831
- }, i.value = !0, h();
4966
+ }, i.value = !0, g();
4832
4967
  }
4833
- function E(e, n) {
4968
+ function M(e, n) {
4969
+ b();
4834
4970
  let r = t.value.findIndex((t) => t.id === e);
4835
4971
  r !== -1 && (t.value = t.value.map((e, t) => {
4836
4972
  if (t !== r) return e;
@@ -4841,32 +4977,35 @@ function Fn(e) {
4841
4977
  };
4842
4978
  }), i.value = !0);
4843
4979
  }
4844
- function D(e, r) {
4980
+ function ee(e, r) {
4981
+ b();
4845
4982
  let s = t.value.findIndex((t) => t.id === e);
4846
4983
  if (s === -1) return;
4847
- let c = t.value[s], l = Z(n.value), u = Q(n.value), d = xn(l, u) + 4, f = 0;
4848
- c.options && c.options.length > 0 && (f = o.value.getOptionsHeight(c.options, Dn(c, a.value.columnWidth)));
4849
- let p = Cn(c), m = c.paragraphs.slice(0, p), g = m.reduce((e, t) => e + (t.height || 26), 0) + f, _ = Math.max(0, r - g), v = Math.round(_ / d), y = [];
4984
+ let c = t.value[s], l = Z(n.value), u = Q(n.value), d = wn(l, u) + 4, f = 0;
4985
+ c.options && c.options.length > 0 && (f = o.value.getOptionsHeight(c.options, An(c, a.value.columnWidth)));
4986
+ let p = En(c), m = c.paragraphs.slice(0, p), h = m.reduce((e, t) => e + (t.height || 26), 0) + f, _ = Math.max(0, r - h), v = Math.round(_ / d), y = [];
4850
4987
  for (let e = 0; e < v; e++) y.push($(l, u));
4851
- let b = [...m, ...y], x = b.reduce((e, t) => e + (t.height || 26), 0);
4988
+ let x = [...m, ...y], S = x.reduce((e, t) => e + (t.height || 26), 0);
4852
4989
  t.value = t.value.map((e, t) => t === s ? {
4853
4990
  ...e,
4854
- paragraphs: b,
4855
- height: x,
4991
+ paragraphs: x,
4992
+ height: S,
4856
4993
  metadata: {
4857
4994
  ...e.metadata,
4858
- customHeight: x
4995
+ customHeight: S
4859
4996
  }
4860
- } : e), i.value = !0, h();
4997
+ } : e), i.value = !0, g();
4861
4998
  }
4862
- function ee(e, n) {
4999
+ function N(e, n) {
5000
+ b();
4863
5001
  let r = t.value.findIndex((t) => t.id === e);
4864
5002
  r !== -1 && (t.value = t.value.map((e, t) => t === r ? {
4865
5003
  ...e,
4866
5004
  questionType: n
4867
5005
  } : e), i.value = !0);
4868
5006
  }
4869
- function O(e, n) {
5007
+ function P(e, n) {
5008
+ b();
4870
5009
  let r = t.value.findIndex((t) => t.id === e);
4871
5010
  r !== -1 && (t.value = t.value.map((e, t) => {
4872
5011
  if (t !== r) return e;
@@ -4878,16 +5017,17 @@ function Fn(e) {
4878
5017
  ...e,
4879
5018
  paragraphs: i
4880
5019
  };
4881
- }), i.value = !0, h());
5020
+ }), i.value = !0, g());
4882
5021
  }
4883
- function k(e, n) {
5022
+ function F(e, n) {
5023
+ b();
4884
5024
  let r = t.value.findIndex((t) => t.id === e);
4885
5025
  r !== -1 && (t.value = t.value.map((e, t) => t === r ? {
4886
5026
  ...e,
4887
5027
  keepNext: n
4888
- } : e), i.value = !0, h());
5028
+ } : e), i.value = !0, g());
4889
5029
  }
4890
- function A(e, n) {
5030
+ function te(e, n) {
4891
5031
  let r = t.value.findIndex((t) => t.id === e);
4892
5032
  if (r === -1) {
4893
5033
  console.warn(`[usePaperCore] patchBlock: block ${e} not found`);
@@ -4908,7 +5048,7 @@ function Fn(e) {
4908
5048
  ...n
4909
5049
  } : e), i.value = !0;
4910
5050
  }
4911
- function j(e) {
5051
+ function ne(e) {
4912
5052
  let n = /* @__PURE__ */ new Map();
4913
5053
  for (let t of e) {
4914
5054
  let e = n.get(t.id) || [];
@@ -4930,17 +5070,17 @@ function Fn(e) {
4930
5070
  };
4931
5071
  }), i.value = !0;
4932
5072
  }
4933
- function M() {
5073
+ function I() {
4934
5074
  let e = 0, n = 0, r = [];
4935
5075
  for (let i of t.value) if (i.type === "title") {
4936
5076
  e++;
4937
- let t = i.metadata?.title || zt(i.metadata?.label || "") || "题组";
5077
+ let t = i.metadata?.title ?? (Vt(i.metadata?.label || "") || "题组");
4938
5078
  r.push({
4939
5079
  id: i.id,
4940
5080
  metadata: {
4941
5081
  title: t,
4942
5082
  ordinal: e,
4943
- label: Rt(t, e)
5083
+ label: Bt(t, e)
4944
5084
  }
4945
5085
  });
4946
5086
  } else if (i.type === "question") {
@@ -4954,25 +5094,27 @@ function Fn(e) {
4954
5094
  }
4955
5095
  });
4956
5096
  }
4957
- j(r);
5097
+ ne(r);
4958
5098
  }
4959
- function N(e, t) {
4960
- A(e, { metadata: { title: t } }), M(), i.value = !0, h();
5099
+ function L(e, t) {
5100
+ b(), te(e, { metadata: { title: t } }), I(), i.value = !0, g();
4961
5101
  }
4962
- function P(e, r = !1) {
5102
+ function re(e, r = !1) {
5103
+ b();
4963
5104
  let o = e.content.split("\n").filter((e) => e.trim());
4964
5105
  o.length === 0 && o.push("");
4965
- let s = e.score ? `(${e.score}分)` : "", c = o.some((e) => /^\(\d+\)\s*/.test(e)), l = Z(n.value), u = Q(n.value), d = a.value.columnWidth, p;
4966
- if (c) p = Mn(e.no, s, o, l, u, d - 26.25, r);
5106
+ let s = e.score ? `(${e.score}分)` : "", c = o.some((e) => /^\(\d+\)\s*/.test(e)), l = Z(n.value), u = Q(n.value), d = a.value.columnWidth, f;
5107
+ if (c) f = Fn(e.no, s, o, l, u, d - 26.25, r);
4967
5108
  else {
4968
5109
  let t = e.no.length > 2 ? 26.25 : 17.5;
4969
- p = [jn(e.no, s, o, l, u, d - t, r)];
5110
+ f = [Pn(e.no, s, o, l, u, d - t, r)];
4970
5111
  }
4971
- for (let e of p) t.value = [...t.value, e];
4972
- p.length > 0 && (f.value = p[p.length - 1].id), M(), i.value = !0, g();
5112
+ for (let e of f) t.value = [...t.value, e];
5113
+ f.length > 0 && (p.value = f[f.length - 1].id), I(), i.value = !0, S();
4973
5114
  }
4974
- function F(e, r, o, s = !1) {
4975
- let c = Z(n.value), l = Q(n.value), u = a.value.columnWidth, d = (r?.length || 0) > 2 ? 26.25 : 17.5, p = St(e, {
5115
+ function ie(e, r, o, s = !1) {
5116
+ b();
5117
+ let c = Z(n.value), l = Q(n.value), u = a.value.columnWidth, d = (r?.length || 0) > 2 ? 26.25 : 17.5, f = xt(e, {
4976
5118
  questionNo: r || "",
4977
5119
  score: o || "",
4978
5120
  contentWidth: u - d,
@@ -4980,17 +5122,18 @@ function Fn(e) {
4980
5122
  lineSpacing: l,
4981
5123
  protectContent: s
4982
5124
  });
4983
- for (let e of p) t.value = [...t.value, e];
4984
- p.length > 0 && (f.value = p[p.length - 1].id), M(), i.value = !0, g();
5125
+ for (let e of f) t.value = [...t.value, e];
5126
+ f.length > 0 && (p.value = f[f.length - 1].id), I(), i.value = !0, S();
4985
5127
  }
4986
- function te(e, r, o, s = !1) {
4987
- let c = Z(n.value), l = Q(n.value), u = a.value.columnWidth, d = (r?.length || 0) > 2 ? 26.25 : 17.5, p;
5128
+ function ae(e, r, o, s = !1) {
5129
+ b();
5130
+ let c = Z(n.value), l = Q(n.value), u = a.value.columnWidth, d = (r?.length || 0) > 2 ? 26.25 : 17.5, f;
4988
5131
  try {
4989
- p = JSON.parse(e);
5132
+ f = JSON.parse(e);
4990
5133
  } catch {
4991
5134
  throw Error("JSON 格式错误,请检查");
4992
5135
  }
4993
- let m = Nt(p, {
5136
+ let m = Nt(f, {
4994
5137
  questionNo: r || "",
4995
5138
  score: o || "",
4996
5139
  contentWidth: u - d,
@@ -4999,16 +5142,83 @@ function Fn(e) {
4999
5142
  protectContent: s
5000
5143
  });
5001
5144
  for (let e of m) t.value = [...t.value, e];
5002
- m.length > 0 && (f.value = m[m.length - 1].id), M(), i.value = !0, g();
5145
+ m.length > 0 && (p.value = m[m.length - 1].id), I(), i.value = !0, S();
5146
+ }
5147
+ function R(e) {
5148
+ b();
5149
+ let r = t.value.filter((t) => t.metadata?.blockGroup === e);
5150
+ if (r.length < 2) return;
5151
+ let a = r.find((e) => e.type === "question") || r[0], o = Z(n.value), s = Q(n.value), c = [];
5152
+ for (let e of r) {
5153
+ let t = En(e);
5154
+ c.push(...e.paragraphs.slice(0, t));
5155
+ }
5156
+ for (let e = 0; e < 2; e++) c.push($(o, s));
5157
+ let l = c.reduce((e, t) => e + (t.height || 26), 0), u = {}, d = a.metadata?.answer || "";
5158
+ for (let e of r) if (e.type === "sub-question" && e.metadata?.answer) {
5159
+ let t = e.metadata.subLabel || "", n = e.metadata.answer;
5160
+ t && (u[t] = n, d += (d ? "\n" : "") + t + n);
5161
+ }
5162
+ let f = {
5163
+ ...a,
5164
+ id: `merged-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
5165
+ paragraphs: c,
5166
+ height: l,
5167
+ metadata: {
5168
+ ...a.metadata,
5169
+ answer: d || a.metadata?.answer,
5170
+ blockGroup: void 0,
5171
+ hasSubQuestions: !0,
5172
+ subAnswers: Object.keys(u).length > 0 ? u : void 0,
5173
+ _splitBackup: JSON.stringify(r.map((e) => ({
5174
+ ...e,
5175
+ paragraphs: e.paragraphs.map((e) => ({
5176
+ ...e,
5177
+ lines: e.lines.map((e) => ({
5178
+ ...e,
5179
+ elements: e.elements.map((e) => ({ ...e }))
5180
+ }))
5181
+ }))
5182
+ })))
5183
+ }
5184
+ }, p = new Set(r.map((e) => e.id)), m = t.value.findIndex((e) => p.has(e.id));
5185
+ if (m === -1) t.value = [...t.value.filter((e) => !p.has(e.id)), f];
5186
+ else {
5187
+ let e = t.value.slice(0, m), n = t.value.slice(m).filter((e) => !p.has(e.id));
5188
+ t.value = [
5189
+ ...e,
5190
+ f,
5191
+ ...n
5192
+ ];
5193
+ }
5194
+ I(), i.value = !0, S();
5003
5195
  }
5004
- function ne(e, t, n) {
5005
- let r = p(e);
5196
+ function oe(e) {
5197
+ let n = t.value.find((t) => t.id === e);
5198
+ if (n?.metadata?._splitBackup) {
5199
+ b();
5200
+ try {
5201
+ let r = JSON.parse(n.metadata._splitBackup), a = t.value.findIndex((t) => t.id === e);
5202
+ if (a === -1) return;
5203
+ t.value = [
5204
+ ...t.value.slice(0, a),
5205
+ ...r,
5206
+ ...t.value.slice(a + 1)
5207
+ ], I(), i.value = !0, S();
5208
+ } catch (e) {
5209
+ console.warn("[splitMergedBlock] _splitBackup 解析失败", e);
5210
+ }
5211
+ }
5212
+ }
5213
+ function z(e, t, n) {
5214
+ b();
5215
+ let r = m(e);
5006
5216
  if (!r) return;
5007
- let o = Dn(r.block, a.value.columnWidth), s = Math.max(20, Math.min(Math.round(t), Math.max(20, o)));
5008
- r.image.width = s, n !== void 0 && (r.image.height = Math.max(12, Math.round(n))), i.value = !0, g();
5217
+ let o = An(r.block, a.value.columnWidth), s = Math.max(20, Math.min(Math.round(t), Math.max(20, o)));
5218
+ r.image.width = s, n !== void 0 && (r.image.height = Math.max(12, Math.round(n))), i.value = !0, S();
5009
5219
  }
5010
- function I(e) {
5011
- let t = p(e);
5220
+ function B(e) {
5221
+ let t = m(e);
5012
5222
  if (!t) return null;
5013
5223
  let n = t.block.paragraphs[t.paraIdx];
5014
5224
  return {
@@ -5016,22 +5226,24 @@ function Fn(e) {
5016
5226
  alignment: n.justification || "left"
5017
5227
  };
5018
5228
  }
5019
- function L(e, t) {
5020
- let n = p(e);
5229
+ function ce(e, t) {
5230
+ b();
5231
+ let n = m(e);
5021
5232
  if (!n) return;
5022
5233
  let r = n.block.paragraphs[n.paraIdx];
5023
- r.justification = t === "left" ? void 0 : t, i.value = !0, h();
5234
+ r.justification = t === "left" ? void 0 : t, i.value = !0, g();
5024
5235
  }
5025
- function re(e, t) {
5026
- let n = Math.max(30, Math.min(500, Math.round(t))), r = m(e);
5027
- r && (r.underline.width = n, g());
5236
+ function le(e, t) {
5237
+ b();
5238
+ let n = Math.max(30, Math.min(500, Math.round(t))), r = h(e);
5239
+ r && (r.underline.width = n, S());
5028
5240
  }
5029
- function ie(e, t, r, i) {
5241
+ function V(e, t, r, i) {
5030
5242
  let o = t ?? Z(n.value), s = r ?? Q(n.value), c = i ?? a.value.columnWidth - 17.5, l = e.split("\n").filter((e) => e.trim());
5031
- return l.length === 0 && l.push(""), l.map((e) => Sn(kn(e, o), o, s, c > 0 ? c : void 0));
5243
+ return l.length === 0 && l.push(""), l.map((e) => Tn(Mn(e, o), o, s, c > 0 ? c : void 0));
5032
5244
  }
5033
- function ae() {
5034
- return gt(t.value, n.value, {
5245
+ function H() {
5246
+ return ht(t.value, n.value, {
5035
5247
  paperName: s.value,
5036
5248
  schoolName: c.value,
5037
5249
  qrCodeContent: l.value,
@@ -5041,53 +5253,58 @@ function Fn(e) {
5041
5253
  blocks: t.value
5042
5254
  });
5043
5255
  }
5044
- function R(e, r) {
5045
- let o = _t(e);
5046
- t.value = o.blocks, o.settings && typeof o.settings.fontSize == "string" && (o.settings.fontSize = yn(o.settings.fontSize)), n.value = {
5256
+ function ue(e, r) {
5257
+ let o = gt(e);
5258
+ t.value = o.blocks, o.settings && typeof o.settings.fontSize == "string" && (o.settings.fontSize = Sn(o.settings.fontSize)), n.value = {
5047
5259
  ...n.value,
5048
5260
  ...o.settings
5049
- }, a.value.updateSettings(o.settings), o.paperName && (s.value = o.paperName), o.schoolName && (c.value = o.schoolName), o.qrCodeContent && (l.value = o.qrCodeContent), o.qrCodeImage && (u.value = o.qrCodeImage), M(), r ? h() : g(), i.value = !1;
5261
+ }, a.value.updateSettings(o.settings), o.paperName && (s.value = o.paperName), o.schoolName && (c.value = o.schoolName), o.qrCodeContent && (l.value = o.qrCodeContent), o.qrCodeImage && (u.value = o.qrCodeImage), I(), r ? g() : S(), i.value = !1;
5050
5262
  }
5051
5263
  return {
5052
- reflowAllBlocks: g,
5053
- addBlock: _,
5054
- addTitleBlock: v,
5055
- reorderBlocks: y,
5056
- removeBlock: b,
5057
- updateBlockLabel: x,
5058
- updateBlockContent: S,
5059
- updateBlockScore: C,
5060
- toggleContentProtection: w,
5061
- updateShowScore: T,
5062
- updateBlockQid: E,
5063
- updateBlockHeight: D,
5064
- updateBlockQuestionType: ee,
5065
- updateBlockSplit: O,
5066
- updateBlockKeepNext: k,
5067
- patchBlock: A,
5068
- patchBlocksMeta: j,
5069
- recalculateNumbering: M,
5070
- updateSectionTitle: N,
5071
- addNewQuestion: P,
5072
- addQuestionFromHtml: F,
5073
- addQuestionFromJson: te,
5074
- updateInlineImageSize: ne,
5075
- getImageParagraphInfo: I,
5076
- updateImageAlignment: L,
5077
- updateUnderlineWidth: re,
5078
- parseTextToParagraphs: ie,
5079
- saveDocument: ae,
5080
- loadDocument: R,
5081
- getBlockPlainText: Nn,
5082
- getBlockLabel: Pn,
5083
- getBlockAvailableWidth: Dn
5264
+ reflowAllBlocks: S,
5265
+ saveUndoSnapshot: b,
5266
+ undo: x,
5267
+ canUndo: v,
5268
+ addBlock: C,
5269
+ addTitleBlock: w,
5270
+ reorderBlocks: T,
5271
+ removeBlock: E,
5272
+ updateBlockLabel: D,
5273
+ updateBlockContent: O,
5274
+ updateBlockScore: k,
5275
+ toggleContentProtection: A,
5276
+ updateShowScore: j,
5277
+ updateBlockQid: M,
5278
+ updateBlockHeight: ee,
5279
+ updateBlockQuestionType: N,
5280
+ updateBlockSplit: P,
5281
+ updateBlockKeepNext: F,
5282
+ patchBlock: te,
5283
+ patchBlocksMeta: ne,
5284
+ recalculateNumbering: I,
5285
+ updateSectionTitle: L,
5286
+ addNewQuestion: re,
5287
+ addQuestionFromHtml: ie,
5288
+ addQuestionFromJson: ae,
5289
+ updateInlineImageSize: z,
5290
+ getImageParagraphInfo: B,
5291
+ updateImageAlignment: ce,
5292
+ updateUnderlineWidth: le,
5293
+ parseTextToParagraphs: V,
5294
+ saveDocument: H,
5295
+ loadDocument: ue,
5296
+ getBlockPlainText: In,
5297
+ getBlockLabel: Ln,
5298
+ getBlockAvailableWidth: An,
5299
+ mergeSubQuestionGroup: R,
5300
+ splitMergedBlock: oe
5084
5301
  };
5085
5302
  }
5086
- var In = z;
5303
+ var zn = z;
5087
5304
  //#endregion
5088
5305
  //#region src/composables/usePaperCore.ts
5089
- function Ln(e = {}) {
5090
- let n = f(e.renderMode ?? "edit"), r = m(new te()), i = m(new Ce({ renderMode: n.value })), a = m([]), o = f([]), s = f({ ...r.value.settings }), c = f(""), l = f(""), u = f(""), d = f(""), p = f(!1), h = f(0), g = t(() => {
5306
+ function Bn(e = {}) {
5307
+ let n = f(e.renderMode ?? "edit"), r = m(new te()), i = m(new Se({ renderMode: n.value })), a = m([]), o = f([]), s = f({ ...r.value.settings }), c = f(""), l = f(""), u = f(""), d = f([]), p = t(() => d.value[0] || ""), h = f(!1), g = f(0), _ = t(() => {
5091
5308
  let e = 0, t = /* @__PURE__ */ new Set();
5092
5309
  for (let n of a.value) {
5093
5310
  let r = n.metadata?.score || "";
@@ -5101,129 +5318,137 @@ function Ln(e = {}) {
5101
5318
  a && (e += parseInt(a[1]));
5102
5319
  }
5103
5320
  return e;
5104
- }), _ = _n(a), y = Fn({
5321
+ }), y = bn(a), b = Rn({
5105
5322
  blocks: a,
5106
5323
  settings: s,
5107
5324
  pages: o,
5108
- isDirty: p,
5325
+ isDirty: h,
5109
5326
  layoutEngine: r,
5110
5327
  svgRenderer: i,
5111
5328
  paperName: c,
5112
5329
  schoolName: l,
5113
5330
  qrCodeContent: u,
5114
- qrCodeImage: d,
5115
- totalScore: g,
5116
- selectedBlockId: _.selectedBlockId,
5117
- findInlineImageById: _.findInlineImageById,
5118
- findUnderlineById: _.findUnderlineById,
5119
- relayout: x
5331
+ qrCodeImage: p,
5332
+ qrCodeImages: d,
5333
+ totalScore: _,
5334
+ selectedBlockId: y.selectedBlockId,
5335
+ findInlineImageById: y.findInlineImageById,
5336
+ findUnderlineById: y.findUnderlineById,
5337
+ relayout: S
5120
5338
  });
5121
- v(u, async (e) => {
5122
- if (!e || e.trim() === "") {
5123
- d.value = "";
5339
+ v([u, () => o.value.length], async ([e]) => {
5340
+ let t = o.value.length;
5341
+ if (!e || e.trim() === "" || t === 0) {
5342
+ d.value = [];
5124
5343
  return;
5125
5344
  }
5126
- d.value = await gn(e);
5345
+ d.value = await Promise.all(Array.from({ length: t }, (t, n) => yn(e + String(n))));
5127
5346
  }, { immediate: !0 });
5128
- function b(e) {
5347
+ function x(e) {
5129
5348
  n.value = e, i.value.setRenderMode(e);
5130
5349
  }
5131
- function x() {
5350
+ function S() {
5132
5351
  o.value = r.value.layout(a.value);
5133
5352
  for (let e = 0; e < o.value.length; e++) {
5134
5353
  let t = o.value[e], n = e % 2 == 0 ? s.value.bodyTopEven ?? 173 : s.value.bodyTopOdd ?? 50;
5135
5354
  t.renderedRegions = i.value.computePageRegions(t, a.value, n, s.value, o.value.length);
5136
5355
  }
5137
- h.value++;
5138
- }
5139
- function S(e) {
5140
- Object.assign(s.value, e), r.value.updateSettings(e), y.reflowAllBlocks();
5356
+ g.value++;
5141
5357
  }
5142
5358
  function C(e) {
5143
- S({ paperSize: e });
5359
+ b.saveUndoSnapshot(), Object.assign(s.value, e), r.value.updateSettings(e), b.reflowAllBlocks();
5144
5360
  }
5145
5361
  function w(e) {
5146
- S({ columns: e });
5362
+ C({ paperSize: e });
5147
5363
  }
5148
5364
  function T(e) {
5149
- S({ fontSize: e });
5365
+ C({ columns: e });
5150
5366
  }
5151
5367
  function E(e) {
5152
- S({ lineSpacing: e });
5368
+ C({ fontSize: e });
5153
5369
  }
5154
5370
  function D(e) {
5155
- return y.getBlockAvailableWidth(e, r.value.columnWidth);
5371
+ C({ lineSpacing: e });
5372
+ }
5373
+ function O(e) {
5374
+ return b.getBlockAvailableWidth(e, r.value.columnWidth);
5156
5375
  }
5157
5376
  return {
5158
5377
  renderMode: n,
5159
5378
  blocks: a,
5160
5379
  pages: o,
5161
5380
  settings: s,
5162
- selectedBlockId: _.selectedBlockId,
5163
- selectedUnderlineId: _.selectedUnderlineId,
5164
- selectedImageId: _.selectedImageId,
5165
- selectedBlock: _.selectedBlock,
5166
- selectedUnderlineInfo: _.selectedUnderlineInfo,
5167
- selectedImageInfo: _.selectedImageInfo,
5168
- totalScore: g,
5381
+ selectedBlockId: y.selectedBlockId,
5382
+ selectedUnderlineId: y.selectedUnderlineId,
5383
+ selectedImageId: y.selectedImageId,
5384
+ selectedBlock: y.selectedBlock,
5385
+ selectedUnderlineInfo: y.selectedUnderlineInfo,
5386
+ selectedImageInfo: y.selectedImageInfo,
5387
+ totalScore: _,
5169
5388
  paperName: c,
5170
5389
  schoolName: l,
5171
5390
  qrCodeContent: u,
5172
- qrCodeImage: d,
5173
- isDirty: p,
5174
- layoutVersion: h,
5175
- setRenderMode: b,
5176
- relayout: x,
5177
- reflowAllBlocks: y.reflowAllBlocks,
5178
- updateSettings: S,
5179
- setPaperSize: C,
5180
- setColumns: w,
5181
- setFontSize: T,
5182
- setLineSpacing: E,
5183
- selectBlock: _.selectBlock,
5184
- selectUnderline: _.selectUnderline,
5185
- selectImage: _.selectImage,
5186
- findUnderlineById: _.findUnderlineById,
5187
- findInlineImageById: _.findInlineImageById,
5188
- updateUnderlineWidth: y.updateUnderlineWidth,
5189
- updateInlineImageSize: y.updateInlineImageSize,
5190
- getImageParagraphInfo: y.getImageParagraphInfo,
5191
- updateImageAlignment: y.updateImageAlignment,
5192
- addBlock: y.addBlock,
5193
- addTitleBlock: y.addTitleBlock,
5194
- reorderBlocks: y.reorderBlocks,
5195
- updateBlockLabel: y.updateBlockLabel,
5196
- removeBlock: y.removeBlock,
5197
- updateBlockContent: y.updateBlockContent,
5198
- updateBlockScore: y.updateBlockScore,
5199
- toggleContentProtection: y.toggleContentProtection,
5200
- updateShowScore: y.updateShowScore,
5201
- updateBlockQid: y.updateBlockQid,
5202
- updateBlockHeight: y.updateBlockHeight,
5203
- updateBlockQuestionType: y.updateBlockQuestionType,
5204
- updateBlockSplit: y.updateBlockSplit,
5205
- updateBlockKeepNext: y.updateBlockKeepNext,
5206
- addNewQuestion: y.addNewQuestion,
5207
- addQuestionFromHtml: y.addQuestionFromHtml,
5208
- addQuestionFromJson: y.addQuestionFromJson,
5209
- getBlockPlainText: y.getBlockPlainText,
5210
- parseTextToParagraphs: y.parseTextToParagraphs,
5211
- getBlockLabel: y.getBlockLabel,
5212
- getContentWidth: D,
5213
- recalculateNumbering: y.recalculateNumbering,
5214
- updateSectionTitle: y.updateSectionTitle,
5215
- patchBlock: y.patchBlock,
5216
- patchBlocksMeta: y.patchBlocksMeta,
5217
- saveDocument: y.saveDocument,
5218
- loadDocument: y.loadDocument,
5391
+ qrCodeImage: p,
5392
+ qrCodeImages: d,
5393
+ isDirty: h,
5394
+ layoutVersion: g,
5395
+ setRenderMode: x,
5396
+ relayout: S,
5397
+ reflowAllBlocks: b.reflowAllBlocks,
5398
+ saveUndoSnapshot: b.saveUndoSnapshot,
5399
+ undo: b.undo,
5400
+ canUndo: b.canUndo,
5401
+ updateSettings: C,
5402
+ setPaperSize: w,
5403
+ setColumns: T,
5404
+ setFontSize: E,
5405
+ setLineSpacing: D,
5406
+ selectBlock: y.selectBlock,
5407
+ selectUnderline: y.selectUnderline,
5408
+ selectImage: y.selectImage,
5409
+ findUnderlineById: y.findUnderlineById,
5410
+ findInlineImageById: y.findInlineImageById,
5411
+ updateUnderlineWidth: b.updateUnderlineWidth,
5412
+ updateInlineImageSize: b.updateInlineImageSize,
5413
+ getImageParagraphInfo: b.getImageParagraphInfo,
5414
+ updateImageAlignment: b.updateImageAlignment,
5415
+ addBlock: b.addBlock,
5416
+ addTitleBlock: b.addTitleBlock,
5417
+ reorderBlocks: b.reorderBlocks,
5418
+ updateBlockLabel: b.updateBlockLabel,
5419
+ removeBlock: b.removeBlock,
5420
+ updateBlockContent: b.updateBlockContent,
5421
+ updateBlockScore: b.updateBlockScore,
5422
+ toggleContentProtection: b.toggleContentProtection,
5423
+ updateShowScore: b.updateShowScore,
5424
+ updateBlockQid: b.updateBlockQid,
5425
+ updateBlockHeight: b.updateBlockHeight,
5426
+ updateBlockQuestionType: b.updateBlockQuestionType,
5427
+ updateBlockSplit: b.updateBlockSplit,
5428
+ updateBlockKeepNext: b.updateBlockKeepNext,
5429
+ addNewQuestion: b.addNewQuestion,
5430
+ addQuestionFromHtml: b.addQuestionFromHtml,
5431
+ addQuestionFromJson: b.addQuestionFromJson,
5432
+ getBlockPlainText: b.getBlockPlainText,
5433
+ parseTextToParagraphs: b.parseTextToParagraphs,
5434
+ getBlockLabel: b.getBlockLabel,
5435
+ getContentWidth: O,
5436
+ recalculateNumbering: b.recalculateNumbering,
5437
+ updateSectionTitle: b.updateSectionTitle,
5438
+ patchBlock: b.patchBlock,
5439
+ patchBlocksMeta: b.patchBlocksMeta,
5440
+ mergeSubQuestionGroup: b.mergeSubQuestionGroup,
5441
+ splitMergedBlock: b.splitMergedBlock,
5442
+ saveDocument: b.saveDocument,
5443
+ loadDocument: b.loadDocument,
5219
5444
  layoutEngine: r,
5220
5445
  svgRenderer: i
5221
5446
  };
5222
5447
  }
5223
5448
  //#endregion
5224
5449
  //#region src/composables/usePageSvgRenderer.ts
5225
- var Rn = "<defs><g id=\"enter\"><path d=\"M810.667 213.333a42.667 42.667 0 0 1 42.368 37.675l0.298 4.992v274.304c0 79.275-50.944 147.499-120.49 152.107l-7.51 0.256H273.707l97.792 97.834a42.667 42.667 0 0 1-56.32 63.872l-4.011-3.541-170.667-170.667a42.667 42.667 0 0 1 0-60.33l170.667-170.667a42.667 42.667 0 0 1 63.872 56.32l-3.541 4.01-97.792 97.835h451.626c19.584 0 39.936-24.618 42.411-59.861l0.256-7.168V256a42.667 42.667 0 0 1 42.667-42.667z\" fill=\"currentColor\"/></g></defs>";
5226
- function zn(e, n = {}) {
5450
+ var Vn = "<defs><g id=\"enter\"><path d=\"M810.667 213.333a42.667 42.667 0 0 1 42.368 37.675l0.298 4.992v274.304c0 79.275-50.944 147.499-120.49 152.107l-7.51 0.256H273.707l97.792 97.834a42.667 42.667 0 0 1-56.32 63.872l-4.011-3.541-170.667-170.667a42.667 42.667 0 0 1 0-60.33l170.667-170.667a42.667 42.667 0 0 1 63.872 56.32l-3.541 4.01-97.792 97.835h451.626c19.584 0 39.936-24.618 42.411-59.861l0.256-7.168V256a42.667 42.667 0 0 1 42.667-42.667z\" fill=\"currentColor\"/></g></defs>";
5451
+ function Hn(e, n = {}) {
5227
5452
  return t(() => {
5228
5453
  e.renderMode.value;
5229
5454
  let t = e.pages.value;
@@ -5236,15 +5461,16 @@ function zn(e, n = {}) {
5236
5461
  totalScore: e.totalScore.value,
5237
5462
  paperName: e.paperName.value,
5238
5463
  schoolName: e.schoolName.value,
5239
- qrCodeImage: e.qrCodeImage.value
5464
+ qrCodeImage: e.qrCodeImage.value,
5465
+ qrCodeImages: e.qrCodeImages.value
5240
5466
  }, t.length);
5241
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${r * o}" height="${i * o}" viewBox="0 0 ${r} ${i}" class="paper-page">\n${Rn}\n${l}</svg>`;
5467
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${r * o}" height="${i * o}" viewBox="0 0 ${r} ${i}" class="paper-page">\n${Vn}\n${l}</svg>`;
5242
5468
  });
5243
5469
  });
5244
5470
  }
5245
5471
  //#endregion
5246
5472
  //#region src/composables/useTableRenderer.ts
5247
- async function Bn(e, t, n = 2) {
5473
+ async function Un(e, t, n = 2) {
5248
5474
  let r = [];
5249
5475
  for (let t = 0; t < e.length; t++) {
5250
5476
  let n = e[t];
@@ -5271,7 +5497,7 @@ async function Bn(e, t, n = 2) {
5271
5497
  if (r.length !== 0) for (let i = 0; i < r.length; i++) {
5272
5498
  let a = r[i];
5273
5499
  try {
5274
- let r = await Vn(a.rawHtml, t, n);
5500
+ let r = await Wn(a.rawHtml, t, n);
5275
5501
  if (r) {
5276
5502
  let t = e[a.blockIdx].paragraphs[a.paraIdx].lines[a.lineIdx].elements[a.elemIdx];
5277
5503
  t.src = r, delete t.rawHtml;
@@ -5281,7 +5507,7 @@ async function Bn(e, t, n = 2) {
5281
5507
  }
5282
5508
  }
5283
5509
  }
5284
- async function Vn(e, t, n) {
5510
+ async function Wn(e, t, n) {
5285
5511
  let r = document.createElement("div");
5286
5512
  r.innerHTML = e, r.style.position = "absolute", r.style.left = "-9999px", r.style.top = "0", r.style.width = "auto", r.style.height = "auto";
5287
5513
  let i = document.createElement("style");
@@ -5302,7 +5528,7 @@ async function Vn(e, t, n) {
5302
5528
  document.body.removeChild(r);
5303
5529
  }
5304
5530
  }
5305
- function Hn(e) {
5531
+ function Gn(e) {
5306
5532
  for (let t of e) if (t.paragraphs) {
5307
5533
  for (let e of t.paragraphs) if (e.lines) {
5308
5534
  for (let t of e.lines) if (t.elements) {
@@ -5317,7 +5543,7 @@ function Hn(e) {
5317
5543
  }
5318
5544
  //#endregion
5319
5545
  //#region src/composables/usePaperCursor.ts
5320
- function Un(e, t, n, r) {
5546
+ function Kn(e, t, n, r) {
5321
5547
  let i = f({
5322
5548
  blockId: null,
5323
5549
  paraIndex: 0,
@@ -5385,7 +5611,7 @@ function Un(e, t, n, r) {
5385
5611
  }];
5386
5612
  }
5387
5613
  function p(e) {
5388
- let n = Z(t.value), r = Q(t.value), i = xn(n, r);
5614
+ let n = Z(t.value), r = Q(t.value), i = wn(n, r);
5389
5615
  return e.length === 0 || e.length === 1 && e[0].type === "enter" ? $(n, r) : {
5390
5616
  lines: [{
5391
5617
  elements: e,
@@ -5787,7 +6013,13 @@ function Un(e, t, n, r) {
5787
6013
  }
5788
6014
  //#endregion
5789
6015
  //#region src/components/PaperEditor.vue?vue&type=script&setup=true&lang.ts
5790
- var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-editor" }, qn = { class: "pe-editor-pages" }, Jn = ["onClick"], Yn = ["innerHTML"], Xn = { class: "pe-editor-controllers" }, Zn = /*@__PURE__*/ a({
6016
+ var qn = { class: "pe-root" }, Jn = { class: "pe-main" }, Yn = { class: "pe-editor" }, Xn = { class: "pe-editor-pages" }, Zn = ["onClick"], Qn = ["innerHTML"], $n = { class: "pe-editor-controllers" }, er = {
6017
+ key: 0,
6018
+ class: "pe-ctrl-sub"
6019
+ }, tr = {
6020
+ key: 1,
6021
+ class: "pe-ctrl-sub"
6022
+ }, nr = /*@__PURE__*/ a({
5791
6023
  __name: "PaperEditor",
5792
6024
  props: {
5793
6025
  initialData: {},
@@ -5808,28 +6040,28 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5808
6040
  "loaded"
5809
6041
  ],
5810
6042
  setup(a, { expose: m, emit: h }) {
5811
- let x = a, S = h, C = Ln({ renderMode: x.renderMode }), w = Un(C.blocks, C.settings, () => {
5812
- C.reflowAllBlocks(), o(() => O.value?.focus());
6043
+ let x = a, S = h, C = Bn({ renderMode: x.renderMode }), w = Kn(C.blocks, C.settings, () => {
6044
+ C.reflowAllBlocks(), o(() => k.value?.focus());
5813
6045
  }, () => {
5814
6046
  C.isDirty.value = !0;
5815
- }), T = f(1), E = f(0), D = f(!1), ee = f(null), O = f(null), k = f({
6047
+ }), T = f(1), E = f(0), D = f(!1), O = f(null), k = f(null), A = f({
5816
6048
  left: 0,
5817
6049
  top: 0
5818
- }), A = f({
6050
+ }), j = f({
5819
6051
  left: 0,
5820
6052
  top: 0,
5821
6053
  height: 21
5822
- }), j = t(() => ({
5823
- left: k.value.left + "px",
5824
- top: k.value.top + "px"
5825
- })), M = t(() => ({
6054
+ }), M = t(() => ({
5826
6055
  left: A.value.left + "px",
5827
- top: A.value.top + "px",
5828
- height: A.value.height + "px",
6056
+ top: A.value.top + "px"
6057
+ })), ee = t(() => ({
6058
+ left: j.value.left + "px",
6059
+ top: j.value.top + "px",
6060
+ height: j.value.height + "px",
5829
6061
  transform: "skewX(0deg)"
5830
- })), N = zn(C, {
6062
+ })), N = Hn(C, {
5831
6063
  zoom: T,
5832
- selectedBlockId: null
6064
+ selectedBlockId: C.selectedBlockId
5833
6065
  });
5834
6066
  function P() {
5835
6067
  if (C.pages.value.length === 0) return [];
@@ -5842,14 +6074,16 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5842
6074
  totalScore: C.totalScore.value,
5843
6075
  paperName: C.paperName.value,
5844
6076
  schoolName: C.schoolName.value,
5845
- qrCodeImage: C.qrCodeImage.value
6077
+ qrCodeImage: C.qrCodeImage.value,
6078
+ qrCodeImages: C.qrCodeImages.value
5846
6079
  }, C.pages.value.length)}</svg>`;
5847
6080
  }));
5848
6081
  }
5849
6082
  let F = t(() => C.svgRenderer.value.renderAllPages(C.pages.value, C.blocks.value, C.settings.value, {
5850
6083
  totalScore: C.totalScore.value,
5851
6084
  paperName: C.paperName.value,
5852
- schoolName: C.schoolName.value
6085
+ schoolName: C.schoolName.value,
6086
+ qrCodeImages: C.qrCodeImages.value
5853
6087
  }));
5854
6088
  function te() {
5855
6089
  C.relayout(), E.value >= C.pages.value.length && (E.value = Math.max(0, C.pages.value.length - 1)), L();
@@ -5910,7 +6144,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5910
6144
  y += t;
5911
6145
  }
5912
6146
  b === -1 && (b = v[v.length - 1] ?? g);
5913
- let x = i.paragraphs[b], S = 0, O = f.x + p, j = w.getTextStyle(x).fontSize, M = (x.lines[0]?.lineHeight || x.height || 21) * .5, N = f.y + y + M, P = j;
6147
+ let x = i.paragraphs[b], S = 0, k = f.x + p, M = w.getTextStyle(x).fontSize, ee = (x.lines[0]?.lineHeight || x.height || 21) * .5, N = f.y + y + ee, P = M;
5914
6148
  if (!w.isEmptyParagraph(x)) {
5915
6149
  let e = o - m - f.x - p, t = h - y, n = 0, r = -1;
5916
6150
  for (let e = 0; e < x.lines.length; e++) {
@@ -5936,7 +6170,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5936
6170
  for (let i = 0; i < t.value.length; i++) {
5937
6171
  let o = u + c + r[i];
5938
6172
  if (e < o + (i < r.length - 1 ? r[i + 1] - r[i] : t.width - r[i]) / 2) {
5939
- S = a, O = f.x + p + o, N = f.y + y + n + s.lineHeight * .5, P = j, d = !0;
6173
+ S = a, k = f.x + p + o, N = f.y + y + n + s.lineHeight * .5, P = M, d = !0;
5940
6174
  break;
5941
6175
  }
5942
6176
  a++;
@@ -5945,24 +6179,24 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5945
6179
  } else {
5946
6180
  let r = t.width || 12;
5947
6181
  if (e < u + c + r / 2) {
5948
- S = a, O = f.x + p + u + c, N = f.y + y + n + s.lineHeight * .5, P = j, d = !0;
6182
+ S = a, k = f.x + p + u + c, N = f.y + y + n + s.lineHeight * .5, P = M, d = !0;
5949
6183
  break;
5950
6184
  }
5951
6185
  u += r;
5952
6186
  }
5953
6187
  if (d) break;
5954
6188
  }
5955
- d || (S = a, O = f.x + p + u + c, N = f.y + y + n + s.lineHeight * .5, P = j);
6189
+ d || (S = a, k = f.x + p + u + c, N = f.y + y + n + s.lineHeight * .5, P = M);
5956
6190
  }
5957
6191
  w.setCursor(e, b, S);
5958
- let F = ee.value, te = document.querySelectorAll(".pe-editor-page")[c]?.querySelector("svg.paper-page");
6192
+ let F = O.value, te = document.querySelectorAll(".pe-editor-page")[c]?.querySelector("svg.paper-page");
5959
6193
  if (F && te && l) {
5960
- let e = te.getBoundingClientRect(), t = F.getBoundingClientRect(), n = l.width, r = l.height, i = O + m, a = N + d, o = e.left - t.left + F.scrollLeft + i / n * e.width, s = e.top - t.top + F.scrollTop + a / r * e.height;
5961
- A.value = {
6194
+ let e = te.getBoundingClientRect(), t = F.getBoundingClientRect(), n = l.width, r = l.height, i = k + m, a = N + d, o = e.left - t.left + F.scrollLeft + i / n * e.width, s = e.top - t.top + F.scrollTop + a / r * e.height;
6195
+ j.value = {
5962
6196
  left: o,
5963
6197
  top: s,
5964
6198
  height: P * T.value
5965
- }, k.value = {
6199
+ }, A.value = {
5966
6200
  left: o,
5967
6201
  top: s
5968
6202
  }, D.value = !0;
@@ -5996,20 +6230,20 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5996
6230
  if (c) {
5997
6231
  let t = c.getAttribute("data-block-id");
5998
6232
  if (t) {
5999
- C.selectBlock(t), n && re(t, e, n, i), o(() => O.value?.focus());
6233
+ C.selectBlock(t), n && re(t, e, n, i), o(() => k.value?.focus());
6000
6234
  let r = C.blocks.value.find((e) => e.id === t);
6001
6235
  r && S("block-click", {
6002
6236
  blockId: t,
6003
6237
  block: r
6004
6238
  });
6005
6239
  }
6006
- } else C.selectBlock(null), C.selectUnderline(null), D.value = !1, w.clearCursor(), S("empty-click");
6240
+ } else C.selectBlock(null), C.selectUnderline(null), C.selectImage(null), D.value = !1, w.clearCursor(), S("empty-click");
6007
6241
  }
6008
6242
  function ae(e) {
6009
6243
  let t = e.target;
6010
6244
  if (!t) return;
6011
6245
  let n = t.getAttribute("data-editable");
6012
- n && (n === "schoolName" ? C.schoolName.value = t.innerHTML : n === "paperName" && (C.paperName.value = t.textContent || ""));
6246
+ n && (C.saveUndoSnapshot(), n === "schoolName" ? C.schoolName.value = t.innerHTML : n === "paperName" && (C.paperName.value = t.textContent || ""));
6013
6247
  }
6014
6248
  let R = f(null), oe = t(() => R.value ? {
6015
6249
  position: "absolute",
@@ -6069,113 +6303,128 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6069
6303
  height: a.height / c * f.height
6070
6304
  };
6071
6305
  }
6072
- let B = f(null), ce = t(() => B.value ? {
6306
+ let B = t(() => {
6307
+ let e = C.selectedBlockId.value;
6308
+ return e && C.blocks.value.find((t) => t.id === e)?.metadata?.blockGroup || "";
6309
+ }), ce = t(() => {
6310
+ let e = C.selectedBlockId.value;
6311
+ return e ? !!C.blocks.value.find((t) => t.id === e)?.metadata?._splitBackup : !1;
6312
+ });
6313
+ function le() {
6314
+ let e = B.value;
6315
+ e && (C.mergeSubQuestionGroup(e), S("change"));
6316
+ }
6317
+ function V() {
6318
+ let e = C.selectedBlockId.value;
6319
+ e && (C.splitMergedBlock(e), S("change"));
6320
+ }
6321
+ let H = f(null), ue = t(() => H.value ? {
6073
6322
  position: "absolute",
6074
- left: B.value.left + "px",
6075
- top: B.value.top + "px",
6076
- width: B.value.width + "px",
6077
- height: B.value.height + "px",
6323
+ left: H.value.left + "px",
6324
+ top: H.value.top + "px",
6325
+ width: H.value.width + "px",
6326
+ height: H.value.height + "px",
6078
6327
  pointerEvents: "auto"
6079
6328
  } : {
6080
6329
  display: "none",
6081
6330
  position: "absolute"
6082
6331
  });
6083
- function le() {
6332
+ function de() {
6084
6333
  let e = C.selectedUnderlineId.value;
6085
6334
  if (!e) {
6086
- B.value = null;
6335
+ H.value = null;
6087
6336
  return;
6088
6337
  }
6089
6338
  let t = document.querySelector(".pe-editor-page.active");
6090
6339
  if (!t) {
6091
- B.value = null;
6340
+ H.value = null;
6092
6341
  return;
6093
6342
  }
6094
6343
  let n = t.querySelector(`[data-underline-id="${CSS.escape(e)}"]`);
6095
6344
  if (!n) {
6096
- B.value = null;
6345
+ H.value = null;
6097
6346
  return;
6098
6347
  }
6099
6348
  let r = t.closest(".pe-editor-surface");
6100
6349
  if (!r) {
6101
- B.value = null;
6350
+ H.value = null;
6102
6351
  return;
6103
6352
  }
6104
6353
  let i = n.getBoundingClientRect(), a = r.getBoundingClientRect();
6105
- B.value = {
6354
+ H.value = {
6106
6355
  left: i.left - a.left + r.scrollLeft,
6107
6356
  top: i.top - a.top + r.scrollTop,
6108
6357
  width: i.width,
6109
6358
  height: i.height
6110
6359
  };
6111
6360
  }
6112
- let V = f(null), ue = t(() => V.value ? {
6361
+ let U = f(null), fe = t(() => U.value ? {
6113
6362
  position: "absolute",
6114
- left: V.value.left + "px",
6115
- top: V.value.top + "px",
6116
- width: V.value.width + "px",
6117
- height: V.value.height + "px",
6363
+ left: U.value.left + "px",
6364
+ top: U.value.top + "px",
6365
+ width: U.value.width + "px",
6366
+ height: U.value.height + "px",
6118
6367
  pointerEvents: "auto"
6119
6368
  } : {
6120
6369
  display: "none",
6121
6370
  position: "absolute"
6122
6371
  });
6123
- function de() {
6372
+ function pe() {
6124
6373
  let e = C.selectedImageId.value;
6125
6374
  if (!e) {
6126
- V.value = null;
6375
+ U.value = null;
6127
6376
  return;
6128
6377
  }
6129
6378
  let t = document.querySelector(".pe-editor-page.active");
6130
6379
  if (!t) {
6131
- V.value = null;
6380
+ U.value = null;
6132
6381
  return;
6133
6382
  }
6134
6383
  let n = t.querySelector(`[data-image-id="${CSS.escape(e)}"]`);
6135
6384
  if (!n) {
6136
- V.value = null;
6385
+ U.value = null;
6137
6386
  return;
6138
6387
  }
6139
6388
  let r = n.querySelector("image") || n, i = t.closest(".pe-editor-surface");
6140
6389
  if (!i) {
6141
- V.value = null;
6390
+ U.value = null;
6142
6391
  return;
6143
6392
  }
6144
6393
  let a = r.getBoundingClientRect(), o = i.getBoundingClientRect();
6145
- V.value = {
6394
+ U.value = {
6146
6395
  left: a.left - o.left + i.scrollLeft,
6147
6396
  top: a.top - o.top + i.scrollTop,
6148
6397
  width: a.width,
6149
6398
  height: a.height
6150
6399
  };
6151
6400
  }
6152
- let fe = t(() => C.selectedImageId.value ? C.getImageParagraphInfo(C.selectedImageId.value) : null), pe = t(() => !!(fe.value?.isStandalone && V.value)), me = t(() => V.value ? {
6153
- left: V.value.left + "px",
6154
- top: V.value.top + V.value.height + 4 + "px",
6401
+ let me = t(() => C.selectedImageId.value ? C.getImageParagraphInfo(C.selectedImageId.value) : null), he = t(() => !!(me.value?.isStandalone && U.value)), ge = t(() => U.value ? {
6402
+ left: U.value.left + "px",
6403
+ top: U.value.top + U.value.height + 4 + "px",
6155
6404
  pointerEvents: "auto"
6156
6405
  } : null);
6157
- function he(e) {
6406
+ function _e(e) {
6158
6407
  let t = C.selectedImageId.value;
6159
- t && (C.updateImageAlignment(t, e), o(() => H()));
6408
+ t && (C.updateImageAlignment(t, e), o(() => W()));
6160
6409
  }
6161
- let ge = 0;
6162
- function H() {
6163
- ge && cancelAnimationFrame(ge), ge = requestAnimationFrame(() => {
6164
- ge = 0, z(), le(), de();
6410
+ let ve = 0;
6411
+ function W() {
6412
+ ve && cancelAnimationFrame(ve), ve = requestAnimationFrame(() => {
6413
+ ve = 0, z(), de(), pe();
6165
6414
  });
6166
6415
  }
6167
6416
  v(() => C.selectedBlockId.value, async () => {
6168
- await o(), H();
6417
+ await o(), W();
6169
6418
  }), v(() => T.value, async () => {
6170
- await o(), H();
6419
+ await o(), W();
6171
6420
  }), v(() => E.value, async () => {
6172
- await o(), H(), S("page-change", E.value);
6421
+ await o(), W(), S("page-change", E.value);
6173
6422
  }), v(() => C.layoutVersion.value, () => {
6174
- L(), o(() => H());
6423
+ L(), o(() => W());
6175
6424
  }), v(() => C.selectedUnderlineId.value, async () => {
6176
- await o(), H();
6425
+ await o(), W();
6177
6426
  }), v(() => C.selectedImageId.value, async () => {
6178
- await o(), H();
6427
+ await o(), W();
6179
6428
  }), v(() => [
6180
6429
  C.paperName.value,
6181
6430
  C.schoolName.value,
@@ -6183,63 +6432,77 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6183
6432
  ], () => {
6184
6433
  L();
6185
6434
  });
6186
- let _e = f(!1), U = f(null), ve = f(0), ye = f(0);
6187
- function be(e) {
6435
+ let ye = f(!1), be = f(null), xe = f(0), Se = f(0);
6436
+ function G(e) {
6188
6437
  let t = C.selectedBlockId.value;
6189
6438
  if (!t) return;
6190
6439
  let n = C.blocks.value.find((e) => e.id === t);
6191
- n && (e.stopPropagation(), _e.value = !0, U.value = t, ve.value = e.clientY, ye.value = n.height, document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", xe), document.addEventListener("mouseup", Se));
6440
+ n && (e.stopPropagation(), ye.value = !0, be.value = t, xe.value = e.clientY, Se.value = n.height, document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", Ce), document.addEventListener("mouseup", we));
6192
6441
  }
6193
- function xe(e) {
6194
- if (!_e.value || !U.value) return;
6195
- let t = (e.clientY - ve.value) / T.value;
6196
- C.updateBlockHeight(U.value, ye.value + t), o(() => z());
6442
+ function Ce(e) {
6443
+ if (!ye.value || !be.value) return;
6444
+ let t = (e.clientY - xe.value) / T.value;
6445
+ C.updateBlockHeight(be.value, Se.value + t), o(() => z());
6197
6446
  }
6198
- function Se(e) {
6199
- _e.value = !1, U.value = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", xe), document.removeEventListener("mouseup", Se), L();
6447
+ function we(e) {
6448
+ ye.value = !1, be.value = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", Ce), document.removeEventListener("mouseup", we), L();
6200
6449
  }
6201
- let Ce = f(!1), W = f(null), we = f(0), Te = f(0);
6202
- function Ee(e, t) {
6450
+ let Te = f(!1), Ee = f(null), K = f(0), De = f(0);
6451
+ function Oe(e, t) {
6203
6452
  let n = C.selectedUnderlineId.value;
6204
6453
  if (!n) return;
6205
6454
  let r = C.findUnderlineById(n);
6206
- r && (t.stopPropagation(), Ce.value = !0, W.value = e, we.value = t.clientX, Te.value = r.underline.width, document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", De), document.addEventListener("mouseup", G));
6455
+ r && (t.stopPropagation(), Te.value = !0, Ee.value = e, K.value = t.clientX, De.value = r.underline.width, document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", q), document.addEventListener("mouseup", ke));
6207
6456
  }
6208
- function De(e) {
6209
- if (!Ce.value || !W.value) return;
6457
+ function q(e) {
6458
+ if (!Te.value || !Ee.value) return;
6210
6459
  let t = C.selectedUnderlineId.value;
6211
6460
  if (!t) return;
6212
- let n = (e.clientX - we.value) / T.value, r = W.value === "right" ? n : -n;
6213
- C.updateUnderlineWidth(t, Te.value + r), o(() => le());
6461
+ let n = (e.clientX - K.value) / T.value, r = Ee.value === "right" ? n : -n;
6462
+ C.updateUnderlineWidth(t, De.value + r), o(() => de());
6214
6463
  }
6215
- function G(e) {
6216
- Ce.value = !1, W.value = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", De), document.removeEventListener("mouseup", G), L();
6464
+ function ke(e) {
6465
+ Te.value = !1, Ee.value = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", q), document.removeEventListener("mouseup", ke), L();
6217
6466
  }
6218
- let Oe = f(!1), ke = f(null), K = f(0), Ae = f(0), je = f(0), Me = f(0);
6219
- function Ne(e, t) {
6467
+ let Ae = f(!1), je = f(null), Me = f(0), Ne = f(0), Pe = f(0), Fe = f(0);
6468
+ function Ie(e, t) {
6220
6469
  if (t.button !== 0) return;
6221
6470
  let n = C.selectedImageId.value;
6222
6471
  if (!n) return;
6223
6472
  let r = C.findInlineImageById(n);
6224
- r && (t.stopPropagation(), Oe.value = !0, ke.value = e, K.value = t.clientX, Ae.value = t.clientY, je.value = r.image.width, Me.value = r.image.height, document.body.style.userSelect = "none", document.addEventListener("mousemove", Pe), document.addEventListener("mouseup", Fe));
6473
+ r && (t.stopPropagation(), Ae.value = !0, je.value = e, Me.value = t.clientX, Ne.value = t.clientY, Pe.value = r.image.width, Fe.value = r.image.height, document.body.style.userSelect = "none", document.addEventListener("mousemove", Le), document.addEventListener("mouseup", Re));
6225
6474
  }
6226
- function Pe(e) {
6227
- if (!Oe.value || !ke.value) return;
6475
+ function Le(e) {
6476
+ if (!Ae.value || !je.value) return;
6228
6477
  let t = C.selectedImageId.value;
6229
6478
  if (!t) return;
6230
- let n = (e.clientX - K.value) / T.value, r = ke.value, i = je.value;
6479
+ let n = (e.clientX - Me.value) / T.value, r = je.value, i = Pe.value;
6231
6480
  if (r.includes("e") ? i += n : r.includes("w") && (i -= n), !C.findInlineImageById(t)) return;
6232
- let a = Me.value / Math.max(1, je.value), s = Math.max(12, Math.round(i * a));
6233
- C.updateInlineImageSize(t, i, s), o(() => de());
6481
+ let a = Fe.value / Math.max(1, Pe.value), s = Math.max(12, Math.round(i * a));
6482
+ C.updateInlineImageSize(t, i, s), o(() => pe());
6234
6483
  }
6235
- function Fe(e) {
6236
- Oe.value = !1, ke.value = null, document.body.style.userSelect = "", document.removeEventListener("mousemove", Pe), document.removeEventListener("mouseup", Fe), L();
6484
+ function Re(e) {
6485
+ Ae.value = !1, je.value = null, document.body.style.userSelect = "", document.removeEventListener("mousemove", Le), document.removeEventListener("mouseup", Re), L();
6237
6486
  }
6238
- function Ie(e) {
6487
+ function ze(e) {
6239
6488
  C.loadDocument(e), L(), S("loaded"), S("change");
6240
6489
  }
6241
- let Le = f(!1);
6242
- function q() {
6490
+ function Be(e) {
6491
+ let t = -1;
6492
+ for (let n = 0; n < C.pages.value.length; n++) if (C.pages.value[n].blocks.some((t) => t.blockId === e)) {
6493
+ t = n;
6494
+ break;
6495
+ }
6496
+ t < 0 || (E.value = t, o(() => {
6497
+ let e = document.querySelectorAll(".pe-editor-page")[t];
6498
+ if (e && O.value) {
6499
+ let t = O.value, n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
6500
+ t.scrollTop += r.top - n.top - 20;
6501
+ }
6502
+ }));
6503
+ }
6504
+ let Ve = f(!1);
6505
+ function J() {
6243
6506
  let e = w.cursor.value;
6244
6507
  if (!e.blockId) return;
6245
6508
  let t = e.blockId, n = e.paraIndex, r = e.charOffset;
@@ -6311,73 +6574,73 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6311
6574
  }
6312
6575
  h || (_ = a.x + l + d + c, v = a.y + p + o + s.lineHeight * .5);
6313
6576
  }
6314
- let b = ee.value, x = document.querySelectorAll(".pe-editor-page")[c]?.querySelector("svg.paper-page");
6577
+ let b = O.value, x = document.querySelectorAll(".pe-editor-page")[c]?.querySelector("svg.paper-page");
6315
6578
  if (b && x && i) {
6316
6579
  let e = x.getBoundingClientRect(), t = b.getBoundingClientRect(), n = i.width, r = i.height, a = _ + s, c = v + o, l = e.left - t.left + b.scrollLeft + a / n * e.width, u = e.top - t.top + b.scrollTop + c / r * e.height;
6317
- A.value = {
6580
+ j.value = {
6318
6581
  left: l,
6319
6582
  top: u,
6320
6583
  height: y * T.value
6321
- }, k.value = {
6584
+ }, A.value = {
6322
6585
  left: l,
6323
6586
  top: u
6324
6587
  }, D.value = !0;
6325
6588
  }
6326
- O.value?.focus();
6589
+ k.value?.focus();
6327
6590
  });
6328
6591
  });
6329
6592
  }
6330
- function Re(e) {
6331
- if (w.cursor.value.blockId && !(Le.value && e.key === "Enter")) switch (e.key) {
6593
+ function He(e) {
6594
+ if (w.cursor.value.blockId && !(Ve.value && e.key === "Enter")) switch (e.key) {
6332
6595
  case "Enter":
6333
- e.preventDefault(), w.splitAtCursor(), q();
6596
+ e.preventDefault(), C.saveUndoSnapshot(), w.splitAtCursor(), J();
6334
6597
  break;
6335
6598
  case "Backspace":
6336
- e.preventDefault(), w.backspace(), q();
6599
+ e.preventDefault(), C.saveUndoSnapshot(), w.backspace(), J();
6337
6600
  break;
6338
6601
  case "Delete":
6339
- e.preventDefault(), w.deleteForward(), q();
6602
+ e.preventDefault(), C.saveUndoSnapshot(), w.deleteForward(), J();
6340
6603
  break;
6341
6604
  case "ArrowLeft":
6342
- e.preventDefault(), w.moveCursorLeft(), q();
6605
+ e.preventDefault(), w.moveCursorLeft(), J();
6343
6606
  break;
6344
6607
  case "ArrowRight":
6345
- e.preventDefault(), w.moveCursorRight(), q();
6608
+ e.preventDefault(), w.moveCursorRight(), J();
6346
6609
  break;
6347
6610
  case "Home":
6348
- e.preventDefault(), w.moveToParaStart(), q();
6611
+ e.preventDefault(), w.moveToParaStart(), J();
6349
6612
  break;
6350
6613
  case "End":
6351
- e.preventDefault(), w.moveToParaEnd(), q();
6614
+ e.preventDefault(), w.moveToParaEnd(), J();
6352
6615
  break;
6353
6616
  }
6354
6617
  }
6355
- function ze(e) {
6356
- if (Le.value) return;
6618
+ function Ue(e) {
6619
+ if (Ve.value) return;
6357
6620
  let t = e.target, n = t.value;
6358
- n && w.cursor.value.blockId && (w.insertText(n), t.value = "", q());
6621
+ n && w.cursor.value.blockId && (C.saveUndoSnapshot(), w.insertText(n), t.value = "", J());
6359
6622
  }
6360
- function Be() {
6361
- Le.value = !0;
6623
+ function We() {
6624
+ Ve.value = !0;
6362
6625
  }
6363
- function Ve(e) {
6364
- Le.value = !1;
6365
- let t = O.value;
6626
+ function Ge(e) {
6627
+ Ve.value = !1;
6628
+ let t = k.value;
6366
6629
  if (t) {
6367
6630
  let e = t.value;
6368
- e && w.cursor.value.blockId && (w.insertText(e), t.value = "", q());
6631
+ e && w.cursor.value.blockId && (C.saveUndoSnapshot(), w.insertText(e), t.value = "", J());
6369
6632
  }
6370
6633
  }
6371
6634
  return l(() => {
6372
- x.initialData ? Ie(x.initialData) : C.relayout(), x.paperName && (C.paperName.value = x.paperName), x.schoolName && (C.schoolName.value = x.schoolName), x.qrCodeContent && (C.qrCodeContent.value = x.qrCodeContent), S("ready");
6635
+ x.initialData ? ze(x.initialData) : C.relayout(), x.paperName && (C.paperName.value = x.paperName), x.schoolName && (C.schoolName.value = x.schoolName), x.qrCodeContent && (C.qrCodeContent.value = x.qrCodeContent), S("ready");
6373
6636
  }), u(() => {
6374
- document.removeEventListener("mousemove", xe), document.removeEventListener("mouseup", Se), document.removeEventListener("mousemove", De), document.removeEventListener("mouseup", G), document.removeEventListener("mousemove", Pe), document.removeEventListener("mouseup", Fe);
6637
+ document.removeEventListener("mousemove", Ce), document.removeEventListener("mouseup", we), document.removeEventListener("mousemove", q), document.removeEventListener("mouseup", ke), document.removeEventListener("mousemove", Le), document.removeEventListener("mouseup", Re);
6375
6638
  }), v(() => x.qrCodeContent, (e) => {
6376
6639
  C.qrCodeContent.value = e || "";
6377
6640
  }), m({
6378
6641
  document: {
6379
6642
  save: () => C.saveDocument(),
6380
- load: (e) => Ie(e),
6643
+ load: (e) => ze(e),
6381
6644
  getBlocks: () => C.blocks.value,
6382
6645
  isDirty: () => C.isDirty.value
6383
6646
  },
@@ -6433,6 +6696,12 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6433
6696
  },
6434
6697
  updateSplit: (e, t) => {
6435
6698
  C.updateBlockSplit(e, t), S("change");
6699
+ },
6700
+ mergeGroup: (e) => {
6701
+ C.mergeSubQuestionGroup(e), S("change");
6702
+ },
6703
+ splitBlock: (e) => {
6704
+ C.splitMergedBlock(e), S("change");
6436
6705
  }
6437
6706
  },
6438
6707
  layout: {
@@ -6464,7 +6733,8 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6464
6733
  },
6465
6734
  goToPage: (e) => {
6466
6735
  E.value = e;
6467
- }
6736
+ },
6737
+ scrollToBlock: (e) => Be(e)
6468
6738
  },
6469
6739
  render: {
6470
6740
  getPageSvgs: () => N.value,
@@ -6474,6 +6744,10 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6474
6744
  setQRCode: (e) => {
6475
6745
  C.qrCodeContent.value = e;
6476
6746
  },
6747
+ canUndo: C.canUndo,
6748
+ undo: () => {
6749
+ C.undo(), S("change");
6750
+ },
6477
6751
  state: t(() => ({
6478
6752
  blocks: C.blocks.value,
6479
6753
  pages: C.pages.value,
@@ -6484,7 +6758,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6484
6758
  selectedImageId: C.selectedImageId.value,
6485
6759
  selectedUnderlineInfo: C.selectedUnderlineInfo.value,
6486
6760
  selectedImageInfo: C.selectedImageInfo.value,
6487
- selectedImageAlignment: fe.value,
6761
+ selectedImageAlignment: me.value,
6488
6762
  totalScore: C.totalScore.value,
6489
6763
  zoom: T.value,
6490
6764
  currentPage: E.value,
@@ -6494,18 +6768,19 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6494
6768
  schoolName: C.schoolName.value,
6495
6769
  qrCodeContent: C.qrCodeContent.value,
6496
6770
  qrCodeImage: C.qrCodeImage.value,
6771
+ qrCodeImages: C.qrCodeImages.value,
6497
6772
  showScore: C.settings.value.showScore
6498
6773
  }))
6499
- }), (t, a) => (d(), r("div", Wn, [i("div", Gn, [i("div", Kn, [i("div", {
6774
+ }), (t, a) => (d(), r("div", qn, [i("div", Jn, [i("div", Yn, [i("div", {
6500
6775
  class: "pe-editor-surface",
6501
6776
  ref_key: "saberEditorRef",
6502
- ref: ee
6777
+ ref: O
6503
6778
  }, [
6504
6779
  a[12] ||= i("svg", { class: "pe-editor-defs" }, [i("defs", null, [i("g", { id: "enter" }, [i("path", {
6505
6780
  d: "M810.667 213.333a42.667 42.667 0 0 1 42.368 37.675l0.298 4.992v274.304c0 79.275-50.944 147.499-120.49 152.107l-7.51 0.256H273.707l97.792 97.834a42.667 42.667 0 0 1-56.32 63.872l-4.011-3.541-170.667-170.667a42.667 42.667 0 0 1 0-60.33l170.667-170.667a42.667 42.667 0 0 1 63.872 56.32l-3.541 4.01-97.792 97.835h451.626c19.584 0 39.936-24.618 42.411-59.861l0.256-7.168V256a42.667 42.667 0 0 1 42.667-42.667z",
6506
6781
  fill: "currentColor"
6507
6782
  })])])], -1),
6508
- i("div", qn, [(d(!0), r(e, null, p(g(N), (e, t) => (d(), r("div", {
6783
+ i("div", Xn, [(d(!0), r(e, null, p(g(N), (e, t) => (d(), r("div", {
6509
6784
  key: t,
6510
6785
  class: s(["pe-editor-page", { active: t === E.value }]),
6511
6786
  onClick: b((e) => E.value = t, ["stop"])
@@ -6514,32 +6789,42 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6514
6789
  innerHTML: e,
6515
6790
  onClick: ie,
6516
6791
  onFocusout: ae
6517
- }, null, 40, Yn)], 10, Jn))), 128))]),
6518
- i("div", Xn, [
6792
+ }, null, 40, Qn)], 10, Zn))), 128))]),
6793
+ i("div", $n, [
6519
6794
  R.value ? (d(), r("div", {
6520
6795
  key: 0,
6521
6796
  class: "pe-ctrl-block",
6522
6797
  style: c(oe.value)
6523
- }, [i("div", {
6524
- class: "pe-ctrl-height",
6525
- onMousedown: b(be, ["prevent"])
6526
- }, [...a[9] ||= [i("svg", {
6527
- xmlns: "http://www.w3.org/2000/svg",
6528
- width: "16",
6529
- height: "16",
6530
- viewBox: "0 0 16 16"
6531
- }, [i("path", {
6532
- fill: "currentColor",
6533
- "fill-rule": "evenodd",
6534
- d: "M14 8a.75.75 0 0 1-.75.75h-4.5V12h1.75l-2.519 3L5.5 12l1.75-.001v-3.25l-4.5.001a.75.75 0 1 1 0-1.5l4.5-.001v-3.25L5.5 4l2.519-3L10.5 4H8.75v3.25h4.5A.75.75 0 0 1 14 8"
6535
- })], -1)]], 32)], 4)) : n("", !0),
6536
- B.value ? (d(), r("div", {
6798
+ }, [
6799
+ i("div", {
6800
+ class: "pe-ctrl-height",
6801
+ onMousedown: b(G, ["prevent"])
6802
+ }, [...a[9] ||= [i("svg", {
6803
+ xmlns: "http://www.w3.org/2000/svg",
6804
+ width: "16",
6805
+ height: "16",
6806
+ viewBox: "0 0 16 16"
6807
+ }, [i("path", {
6808
+ fill: "currentColor",
6809
+ "fill-rule": "evenodd",
6810
+ d: "M14 8a.75.75 0 0 1-.75.75h-4.5V12h1.75l-2.519 3L5.5 12l1.75-.001v-3.25l-4.5.001a.75.75 0 1 1 0-1.5l4.5-.001v-3.25L5.5 4l2.519-3L10.5 4H8.75v3.25h4.5A.75.75 0 0 1 14 8"
6811
+ })], -1)]], 32),
6812
+ B.value ? (d(), r("div", er, [i("button", {
6813
+ class: "pe-merge-btn",
6814
+ onMousedown: b(le, ["stop"])
6815
+ }, "合并子题", 32)])) : n("", !0),
6816
+ ce.value ? (d(), r("div", tr, [i("button", {
6817
+ class: "pe-split-btn",
6818
+ onMousedown: b(V, ["stop"])
6819
+ }, "拆分子题", 32)])) : n("", !0)
6820
+ ], 4)) : n("", !0),
6821
+ H.value ? (d(), r("div", {
6537
6822
  key: 1,
6538
6823
  class: "pe-ctrlUnderline",
6539
- style: c(ce.value)
6824
+ style: c(ue.value)
6540
6825
  }, [i("div", {
6541
6826
  class: "pe-ctrl-ul-left",
6542
- onMousedown: a[0] ||= b((e) => Ee("left", e), ["prevent"])
6827
+ onMousedown: a[0] ||= b((e) => Oe("left", e), ["prevent"])
6543
6828
  }, [...a[10] ||= [i("svg", {
6544
6829
  xmlns: "http://www.w3.org/2000/svg",
6545
6830
  width: "12",
@@ -6550,7 +6835,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6550
6835
  d: "M10.5 4L7.5 8l3 4H2V4z"
6551
6836
  })], -1)]], 32), i("div", {
6552
6837
  class: "pe-ctrl-ul-right",
6553
- onMousedown: a[1] ||= b((e) => Ee("right", e), ["prevent"])
6838
+ onMousedown: a[1] ||= b((e) => Oe("right", e), ["prevent"])
6554
6839
  }, [...a[11] ||= [i("svg", {
6555
6840
  xmlns: "http://www.w3.org/2000/svg",
6556
6841
  width: "12",
@@ -6560,79 +6845,79 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6560
6845
  fill: "currentColor",
6561
6846
  d: "M5.5 4L8.5 8l-3 4H14V4z"
6562
6847
  })], -1)]], 32)], 4)) : n("", !0),
6563
- V.value ? (d(), r("div", {
6848
+ U.value ? (d(), r("div", {
6564
6849
  key: 2,
6565
6850
  class: "pe-ctrlAnchor",
6566
- style: c(ue.value)
6851
+ style: c(fe.value)
6567
6852
  }, [
6568
6853
  i("div", {
6569
6854
  class: "pe-resize-se",
6570
- onMousedown: a[2] ||= b((e) => Ne("se", e), ["prevent", "stop"])
6855
+ onMousedown: a[2] ||= b((e) => Ie("se", e), ["prevent", "stop"])
6571
6856
  }, null, 32),
6572
6857
  i("div", {
6573
6858
  class: "pe-resize-sw",
6574
- onMousedown: a[3] ||= b((e) => Ne("sw", e), ["prevent", "stop"])
6859
+ onMousedown: a[3] ||= b((e) => Ie("sw", e), ["prevent", "stop"])
6575
6860
  }, null, 32),
6576
6861
  i("div", {
6577
6862
  class: "pe-resize-ne",
6578
- onMousedown: a[4] ||= b((e) => Ne("ne", e), ["prevent", "stop"])
6863
+ onMousedown: a[4] ||= b((e) => Ie("ne", e), ["prevent", "stop"])
6579
6864
  }, null, 32),
6580
6865
  i("div", {
6581
6866
  class: "pe-resize-nw",
6582
- onMousedown: a[5] ||= b((e) => Ne("nw", e), ["prevent", "stop"])
6867
+ onMousedown: a[5] ||= b((e) => Ie("nw", e), ["prevent", "stop"])
6583
6868
  }, null, 32)
6584
6869
  ], 4)) : n("", !0),
6585
- pe.value ? (d(), r("div", {
6870
+ he.value ? (d(), r("div", {
6586
6871
  key: 3,
6587
6872
  class: "pe-img-align-bar",
6588
- style: c(me.value)
6873
+ style: c(ge.value)
6589
6874
  }, [
6590
6875
  i("button", {
6591
- class: s(["pe-align-btn", { active: fe.value?.alignment === "left" }]),
6592
- onClick: a[6] ||= (e) => he("left"),
6876
+ class: s(["pe-align-btn", { active: me.value?.alignment === "left" }]),
6877
+ onClick: a[6] ||= (e) => _e("left"),
6593
6878
  title: "左对齐"
6594
6879
  }, "左", 2),
6595
6880
  i("button", {
6596
- class: s(["pe-align-btn", { active: fe.value?.alignment === "center" }]),
6597
- onClick: a[7] ||= (e) => he("center"),
6881
+ class: s(["pe-align-btn", { active: me.value?.alignment === "center" }]),
6882
+ onClick: a[7] ||= (e) => _e("center"),
6598
6883
  title: "居中对齐"
6599
6884
  }, "中", 2),
6600
6885
  i("button", {
6601
- class: s(["pe-align-btn", { active: fe.value?.alignment === "right" }]),
6602
- onClick: a[8] ||= (e) => he("right"),
6886
+ class: s(["pe-align-btn", { active: me.value?.alignment === "right" }]),
6887
+ onClick: a[8] ||= (e) => _e("right"),
6603
6888
  title: "右对齐"
6604
6889
  }, "右", 2)
6605
6890
  ], 4)) : n("", !0)
6606
6891
  ]),
6607
6892
  i("div", {
6608
6893
  class: "pe-editor-input-wrapper",
6609
- style: c(j.value)
6894
+ style: c(M.value)
6610
6895
  }, [i("input", {
6611
6896
  class: "pe-editor-virtual-input",
6612
6897
  ref_key: "virtualInputRef",
6613
- ref: O,
6614
- onKeydown: Re,
6615
- onInput: ze,
6616
- onCompositionstart: Be,
6617
- onCompositionend: Ve
6898
+ ref: k,
6899
+ onKeydown: He,
6900
+ onInput: Ue,
6901
+ onCompositionstart: We,
6902
+ onCompositionend: Ge
6618
6903
  }, null, 544)], 4),
6619
6904
  y(i("div", {
6620
6905
  class: "pe-editor-cursor",
6621
- style: c(M.value)
6906
+ style: c(ee.value)
6622
6907
  }, null, 4), [[_, D.value]])
6623
6908
  ], 512)])])]));
6624
6909
  }
6625
- }), Qn = (e, t) => {
6910
+ }), rr = (e, t) => {
6626
6911
  let n = e.__vccOpts || e;
6627
6912
  for (let [e, r] of t) n[e] = r;
6628
6913
  return n;
6629
- }, $n = /*#__PURE__*/ Qn(Zn, [["__scopeId", "data-v-62a78c32"]]), er = { class: "pe-preview__pages" }, tr = ["innerHTML"], nr = {
6914
+ }, ir = /*#__PURE__*/ rr(nr, [["__scopeId", "data-v-b29566da"]]), ar = { class: "pe-preview__pages" }, or = ["innerHTML"], sr = {
6630
6915
  key: 0,
6631
6916
  class: "pe-preview__helpers"
6632
- }, rr = {
6917
+ }, cr = {
6633
6918
  key: 1,
6634
6919
  class: "pe-preview__page-num"
6635
- }, ir = /*#__PURE__*/ Qn(/* @__PURE__ */ a({
6920
+ }, lr = /*#__PURE__*/ rr(/* @__PURE__ */ a({
6636
6921
  __name: "PaperPreview",
6637
6922
  props: {
6638
6923
  document: {},
@@ -6659,14 +6944,14 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6659
6944
  }
6660
6945
  },
6661
6946
  setup(a) {
6662
- let o = a, m = Ln();
6947
+ let o = a, m = Bn();
6663
6948
  function _() {
6664
6949
  o.document && m.loadDocument(o.document);
6665
6950
  }
6666
6951
  _(), v(() => o.document, _), v(() => o.pureMode, (e) => {
6667
6952
  m.setRenderMode(e ? "view" : "edit");
6668
6953
  }, { immediate: !0 });
6669
- let y = zn(m, { selectedBlockId: null }), b = f(), x = f(0), S = null;
6954
+ let y = Hn(m, { selectedBlockId: null }), b = f(), x = f(0), S = null;
6670
6955
  l(() => {
6671
6956
  x.value = b.value?.clientWidth ?? 0, S = new ResizeObserver((e) => {
6672
6957
  for (let t of e) x.value = Math.floor(t.contentRect.width);
@@ -6682,7 +6967,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6682
6967
  return [];
6683
6968
  }
6684
6969
  }), w = t(() => {
6685
- let e = m.settings.value.paperSize || "A4", t = A[e] || A.A4, n = k[e] || k.A4, r = t.w / n.width, i = 1;
6970
+ let e = m.settings.value.paperSize || "A4", t = j[e] || j.A4, n = A[e] || A.A4, r = t.w / n.width, i = 1;
6686
6971
  if (x.value > 0) {
6687
6972
  let e = x.value - 32, n = t.w, r = e / 3.7795275590551185;
6688
6973
  n > r && (i = r / n);
@@ -6699,6 +6984,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6699
6984
  "student-name": "#3498db",
6700
6985
  "student-class": "#3498db",
6701
6986
  "student-code": "#3498db",
6987
+ "student-code-filler": "#e67e22",
6702
6988
  score: "#e74c3c",
6703
6989
  "page-number": "#95a5a6",
6704
6990
  "question-border": "#e74c3c",
@@ -6712,6 +6998,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6712
6998
  studentName: "student-name",
6713
6999
  studentClass: "student-class",
6714
7000
  studentCode: "student-code",
7001
+ studentCodeFiller: "student-code-filler",
6715
7002
  score: "score"
6716
7003
  };
6717
7004
  function D(e) {
@@ -6728,7 +7015,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6728
7015
  };
6729
7016
  });
6730
7017
  }
6731
- function ee(e) {
7018
+ function O(e) {
6732
7019
  let t = C.value[e];
6733
7020
  if (!t) return [];
6734
7021
  let n = [];
@@ -6802,21 +7089,21 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6802
7089
  }
6803
7090
  return n;
6804
7091
  }
6805
- function O(e) {
7092
+ function k(e) {
6806
7093
  let t = m.pages.value[0]?.width || 793, n = m.pages.value[0]?.height || 1123;
6807
7094
  return {
6808
7095
  width: `${(t * w.value.x).toFixed(1)}mm`,
6809
7096
  height: `${(n * w.value.y).toFixed(1)}mm`
6810
7097
  };
6811
7098
  }
6812
- function j(e) {
7099
+ function M(e) {
6813
7100
  let t = m.pages.value[0]?.width || 793, n = m.pages.value[0]?.height || 1123;
6814
7101
  return {
6815
7102
  width: `${(t * w.value.x).toFixed(1)}mm`,
6816
7103
  height: `${(n * w.value.y).toFixed(1)}mm`
6817
7104
  };
6818
7105
  }
6819
- function M(e) {
7106
+ function ee(e) {
6820
7107
  return {
6821
7108
  position: "absolute",
6822
7109
  outline: `1px solid ${e.color}`,
@@ -6832,33 +7119,33 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6832
7119
  class: s(["pe-preview", { "pe-preview--print": a.mode === "print" }]),
6833
7120
  ref_key: "previewRef",
6834
7121
  ref: b
6835
- }, [i("div", er, [(d(!0), r(e, null, p(g(y), (t, o) => (d(), r("div", {
7122
+ }, [i("div", ar, [(d(!0), r(e, null, p(g(y), (t, o) => (d(), r("div", {
6836
7123
  key: o,
6837
7124
  class: "pe-preview__page",
6838
- style: c(O(o))
7125
+ style: c(k(o))
6839
7126
  }, [
6840
7127
  i("div", {
6841
7128
  class: "pe-preview__page-col",
6842
- style: c(j(o))
7129
+ style: c(M(o))
6843
7130
  }, [i("div", {
6844
7131
  innerHTML: t,
6845
7132
  style: {
6846
7133
  width: "100%",
6847
7134
  height: "100%"
6848
7135
  }
6849
- }, null, 8, tr)], 4),
6850
- a.showHelpers ? (d(), r("div", nr, [a.showCornerMarks ? (d(!0), r(e, { key: 0 }, p(D(o), (e, t) => (d(), r("span", {
7136
+ }, null, 8, or)], 4),
7137
+ a.showHelpers ? (d(), r("div", sr, [a.showCornerMarks ? (d(!0), r(e, { key: 0 }, p(D(o), (e, t) => (d(), r("span", {
6851
7138
  key: "cm-" + t,
6852
7139
  class: s(["pe-preview__helper-box", e.className]),
6853
- style: c(M(e))
6854
- }, null, 6))), 128)) : n("", !0), a.showRegionBoxes ? (d(!0), r(e, { key: 1 }, p(ee(o), (e, t) => (d(), r("span", {
7140
+ style: c(ee(e))
7141
+ }, null, 6))), 128)) : n("", !0), a.showRegionBoxes ? (d(!0), r(e, { key: 1 }, p(O(o), (e, t) => (d(), r("span", {
6855
7142
  key: "rg-" + t,
6856
7143
  class: s(["pe-preview__helper-box", e.className]),
6857
- style: c(M(e))
7144
+ style: c(ee(e))
6858
7145
  }, null, 6))), 128)) : n("", !0)])) : n("", !0),
6859
- a.showPageNumbers ? (d(), r("div", rr, h(o + 1) + " / " + h(g(m).pages.value.length), 1)) : n("", !0)
7146
+ a.showPageNumbers ? (d(), r("div", cr, h(o + 1) + " / " + h(g(m).pages.value.length), 1)) : n("", !0)
6860
7147
  ], 4))), 128))])], 2));
6861
7148
  }
6862
- }), [["__scopeId", "data-v-1b638e19"]]);
7149
+ }), [["__scopeId", "data-v-e8f833b5"]]);
6863
7150
  //#endregion
6864
- export { vn as FONT_SIZE_MAP, k as PAPER_DIMENSIONS, A as PAPER_MM, $n as PaperEditor, te as PaperLayout, ir as PaperPreview, Ce as SvgRenderer, Vt as buildPaperHtml, B as calcCharPositions, se as calcTextWidth, De as clearFormulaCache, le as clearWidthCache, _t as deserializeDocument, zt as extractBaseTitle, yn as fontSizeLabelToPx, bn as fontSizePxToLabel, Rt as formatSectionTitle, z as getCharWidth, M as getPaperPreset, Hn as hasTablePlaceholder, G as latexToSvg, Me as latexToSvgBatch, St as parseQuestionHtml, Nt as parseQuestionJson, Bn as renderTablePlaceholders, gt as serializeDocument, P as toBBox, Lt as toChineseOrdinal, zn as usePageSvgRenderer, Ln as usePaperCore };
7151
+ export { xn as FONT_SIZE_MAP, A as PAPER_DIMENSIONS, j as PAPER_MM, ir as PaperEditor, te as PaperLayout, lr as PaperPreview, Se as SvgRenderer, Ut as buildPaperHtml, B as calcCharPositions, se as calcTextWidth, Ee as clearFormulaCache, le as clearWidthCache, gt as deserializeDocument, Vt as extractBaseTitle, Sn as fontSizeLabelToPx, Cn as fontSizePxToLabel, Bt as formatSectionTitle, z as getCharWidth, ee as getPaperPreset, Gn as hasTablePlaceholder, K as latexToSvg, je as latexToSvgBatch, xt as parseQuestionHtml, Nt as parseQuestionJson, Un as renderTablePlaceholders, ht as serializeDocument, P as toBBox, zt as toChineseOrdinal, Hn as usePageSvgRenderer, Bn as usePaperCore };