@sw7d/paper-renderer 0.2.0 → 0.2.2

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,7 +47,7 @@ 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
52
  columns: 1,
53
53
  margins: [
@@ -101,10 +101,10 @@ 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];
106
- }
107
104
  function N(e) {
105
+ return M[e];
106
+ }
107
+ function P(e) {
108
108
  if (!e) return {
109
109
  size: "A4",
110
110
  columns: 1
@@ -120,20 +120,20 @@ function N(e) {
120
120
  columns: n
121
121
  };
122
122
  }
123
- function P(e, t, n, r) {
123
+ function F(e, t, n, r) {
124
124
  return [
125
- F(e),
126
- F(t),
127
- F(n),
128
- F(r)
125
+ I(e),
126
+ I(t),
127
+ I(n),
128
+ I(r)
129
129
  ];
130
130
  }
131
- function F(e) {
131
+ function I(e) {
132
132
  return Math.round(e * 100) / 100;
133
133
  }
134
134
  //#endregion
135
135
  //#region src/engine/PaperLayout.ts
136
- var te = class {
136
+ var ee = class {
137
137
  settings;
138
138
  pageWidth = 0;
139
139
  pageHeight = 0;
@@ -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;
@@ -348,72 +348,72 @@ var te = class {
348
348
  }
349
349
  ];
350
350
  }
351
- }, ne = null, I = /* @__PURE__ */ new Map(), L = 5e3;
352
- function re() {
353
- if (ne) return ne;
351
+ }, te = null, L = /* @__PURE__ */ new Map(), R = 5e3;
352
+ function ne() {
353
+ if (te) return te;
354
354
  try {
355
355
  if (typeof document > "u") return null;
356
356
  let e = document.createElement("canvas");
357
- return e.width = 1, e.height = 1, ne = e.getContext("2d"), ne;
357
+ return e.width = 1, e.height = 1, te = e.getContext("2d"), te;
358
358
  } catch {
359
359
  return null;
360
360
  }
361
361
  }
362
- function ie(e, t, n, r) {
362
+ function re(e, t, n, r) {
363
363
  return `${r ? "italic" : "normal"} ${n ? "bold" : "normal"} ${t}px ${e.includes(" ") && !e.includes("\"") && !e.includes("'") ? `"${e}"` : e}`;
364
364
  }
365
- function ae(e) {
365
+ function ie(e) {
366
366
  let t = e.charCodeAt(0);
367
367
  return t >= 19968 && t <= 40959 || t >= 13312 && t <= 19903 || t >= 63744 && t <= 64255 || t >= 194560 && t <= 195103 || t >= 11904 && t <= 12031 || t >= 12288 && t <= 12351;
368
368
  }
369
- function R(e) {
369
+ function z(e) {
370
370
  let t = e.charCodeAt(0);
371
371
  return t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
372
372
  }
373
- function oe(e, t) {
374
- return ae(e) || R(e) || e === " " ? t : e === " " ? t * .25 : t * .6;
373
+ function ae(e, t) {
374
+ return ie(e) || z(e) || e === " " ? t : e === " " ? t * .25 : t * .6;
375
375
  }
376
- function z(e, t, n, r, i) {
377
- let a = re();
376
+ function B(e, t, n, r, i) {
377
+ let a = ne();
378
378
  if (a) {
379
- let o = n || "\"Times New Roman\", SimSun, STSong, serif", s = `${e}|${o}|${t}|${r}|${i}`, c = I.get(s);
379
+ let o = n || "\"Times New Roman\", SimSun, STSong, serif", s = `${e}|${o}|${t}|${r}|${i}`, c = L.get(s);
380
380
  if (c !== void 0) return c;
381
- a.font = ie(o, t, !!r, !!i);
381
+ a.font = re(o, t, !!r, !!i);
382
382
  let l = a.measureText(e).width;
383
- if (I.size > L) {
384
- let e = Array.from(I.keys()).slice(0, L / 2);
385
- for (let t of e) I.delete(t);
383
+ if (L.size > R) {
384
+ let e = Array.from(L.keys()).slice(0, R / 2);
385
+ for (let t of e) L.delete(t);
386
386
  }
387
- return I.set(s, l), l;
387
+ return L.set(s, l), l;
388
388
  }
389
- return oe(e, t);
389
+ return ae(e, t);
390
390
  }
391
- function se(e, t, n, r, i) {
392
- let a = re();
391
+ function oe(e, t, n, r, i) {
392
+ let a = ne();
393
393
  if (a) {
394
- let o = n || "\"Times New Roman\", SimSun, STSong, serif", s = `T|${e}|${o}|${t}|${r}|${i}`, c = I.get(s);
394
+ let o = n || "\"Times New Roman\", SimSun, STSong, serif", s = `T|${e}|${o}|${t}|${r}|${i}`, c = L.get(s);
395
395
  if (c !== void 0) return c;
396
- a.font = ie(o, t, !!r, !!i);
396
+ a.font = re(o, t, !!r, !!i);
397
397
  let l = a.measureText(e).width;
398
- if (I.size > L) {
399
- let e = Array.from(I.keys()).slice(0, L / 2);
400
- for (let t of e) I.delete(t);
398
+ if (L.size > R) {
399
+ let e = Array.from(L.keys()).slice(0, R / 2);
400
+ for (let t of e) L.delete(t);
401
401
  }
402
- return I.set(s, l), l;
402
+ return L.set(s, l), l;
403
403
  }
404
404
  let o = 0;
405
- for (let n of e) o += oe(n, t);
405
+ for (let n of e) o += ae(n, t);
406
406
  return o;
407
407
  }
408
- function B(e, t, n, r, i) {
408
+ function V(e, t, n, r, i) {
409
409
  let a = [], o = 0;
410
- for (let s of e) a.push(o), o += z(s, t, n, r, i);
410
+ for (let s of e) a.push(o), o += B(s, t, n, r, i);
411
411
  return a;
412
412
  }
413
- function ce(e, t, n, r, i) {
414
- let a = re();
413
+ function se(e, t, n, r, i) {
414
+ let a = ne();
415
415
  if (a) {
416
- a.font = ie(n || "\"Times New Roman\", SimSun, STSong, serif", t, !!r, !!i);
416
+ a.font = re(n || "\"Times New Roman\", SimSun, STSong, serif", t, !!r, !!i);
417
417
  let o = a.measureText(e);
418
418
  return {
419
419
  ascent: o.actualBoundingBoxAscent,
@@ -427,44 +427,44 @@ function ce(e, t, n, r, i) {
427
427
  height: t
428
428
  };
429
429
  }
430
- function le() {
431
- I.clear();
430
+ function ce() {
431
+ L.clear();
432
432
  }
433
433
  //#endregion
434
434
  //#region src/engine/svg/headerRenderer.ts
435
- function V(e) {
435
+ function H(e) {
436
436
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
437
437
  }
438
- function ue(e, t, n, r, i, a, o, s) {
438
+ function le(e, t, n, r, i, a, o, s) {
439
439
  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;
440
+ return c += ue(t, i, n, l, o, s), l += 30, c += de(e, r, l, s), l += 40, c += fe(e, l, a), c;
441
441
  }
442
- function de(e, t, n, r, i, a) {
443
- 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";
442
+ function ue(e, t, n, r, i, a) {
443
+ let o = i && n > 0 ? `满分: ${n} 分` : "", s = o ? `<span class="swed-score" data-region="score">${H(o)}</span>` : "", { contentWidth: c, contentX: l } = e, u = a === "edit";
444
444
  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
445
  <div class="swed-header-school-info">
446
- <div contenteditable="${u ? "true" : "false"}" class="swed-headerDesc${u ? " swed-editable-dashed" : ""}" data-editable="schoolName">${V(t)}</div>
446
+ <div contenteditable="${u ? "true" : "false"}" class="swed-headerDesc${u ? " swed-editable-dashed" : ""}" data-editable="schoolName">${H(t)}</div>
447
447
  ${s}
448
448
  </div>
449
449
  </foreignObject>\n`;
450
450
  }
451
- function fe(e, t, n, r) {
451
+ function de(e, t, n, r) {
452
452
  let { contentWidth: i, contentX: a } = e, o = r === "edit";
453
453
  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
454
  <div class="swed-header-paper-name">
455
455
  <div class="swed-input-box">
456
- <label class="swed-input-box__label">${V(t)}</label>
457
- <div class="swed-input-box__input swed-textarea${o ? " swed-editable-dashed" : ""}" id="paperName" contenteditable="${o ? "true" : "false"}" data-editable="paperName">${V(t)}</div>
456
+ <label class="swed-input-box__label">${H(t)}</label>
457
+ <div class="swed-input-box__input swed-textarea${o ? " swed-editable-dashed" : ""}" id="paperName" contenteditable="${o ? "true" : "false"}" data-editable="paperName">${H(t)}</div>
458
458
  </div>
459
459
  </div>
460
460
  </foreignObject>\n`;
461
461
  }
462
- function pe(e, t, n) {
462
+ function fe(e, t, n) {
463
463
  let { contentWidth: r, contentX: i } = e;
464
464
  return ` <foreignObject class="swed-header-block swed-header-block--student-info" transform="translate(${i}, ${t})" width="${r}" height="100" opacity="1">
465
465
  <div class="swed-header-student-info">
466
466
  <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;" />
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;border:1px solid #000;" />
468
468
  </div>
469
469
  <div class="swed-student-fields">
470
470
  <div class="swed-student-fields-row">
@@ -476,34 +476,29 @@ function pe(e, t, n) {
476
476
  </div>
477
477
  </foreignObject>\n`;
478
478
  }
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`;
479
+ function pe(e, t, n, r, i, a) {
480
+ let o = i && t > 0 ? `满分: ${t} 分` : "", s = o ? `<span class="swed-score" data-region="score">${H(o)}</span>` : "", { contentWidth: c, contentX: l } = e, u = a === "edit";
481
+ 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">${H(n)}</div>\n ${s}\n </div>\n </foreignObject>\n`;
487
482
  }
488
- function he() {
483
+ function me() {
489
484
  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
485
  }
491
- function ge() {
486
+ function he() {
492
487
  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
488
  }
494
489
  //#endregion
495
490
  //#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);
491
+ function U(e, t, n, r, i) {
492
+ 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
493
  if (l > 0 && u * l <= t) {
499
494
  let n = t / l, a = n - 20;
500
495
  for (let t = 0; t < l; t++) {
501
496
  let s = n * t;
502
497
  o += ` <g class="swed-option-item" transform="translate(${s}, 0)">\n`;
503
498
  let c = e[t].paragraphs[0]?.lines[0]?.baseline || r * 1.56;
504
- 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";
499
+ 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)}">${H(e[t].label)}.</text>\n`, o += " <g>\n";
505
500
  let l = 0;
506
- for (let n of e[t].paragraphs) o += xe(n, a, l, !1, "", r, i, 20), l += n.height || 26;
501
+ for (let n of e[t].paragraphs) o += be(n, a, l, !1, "", r, i, 20), l += n.height || 26;
507
502
  o += " </g>\n", o += " </g>\n";
508
503
  }
509
504
  return o += " </g>\n", o;
@@ -512,14 +507,14 @@ function H(e, t, n, r, i) {
512
507
  for (let t = 0; t < l; t++) {
513
508
  o += ` <g class="swed-option-item" transform="translate(0, ${d})">\n`;
514
509
  let n = e[t].paragraphs[0]?.lines[0]?.baseline || r * 1.56;
515
- 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";
510
+ 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)}">${H(e[t].label)}.</text>\n`, o += " <g>\n";
516
511
  let s = 0;
517
- for (let n of e[t].paragraphs) o += xe(n, a, s, !1, "", r, i, 20), s += n.height || 26;
512
+ for (let n of e[t].paragraphs) o += be(n, a, s, !1, "", r, i, 20), s += n.height || 26;
518
513
  o += " </g>\n", o += " </g>\n", d += c[t];
519
514
  }
520
515
  return o += " </g>\n", o;
521
516
  }
522
- function _e(e, t, n) {
517
+ function ge(e, t, n) {
523
518
  let r = 0;
524
519
  for (let t of e.paragraphs) for (let e of t.lines) {
525
520
  let t = 0;
@@ -528,20 +523,20 @@ function _e(e, t, n) {
528
523
  }
529
524
  return t + Math.min(r, n);
530
525
  }
531
- function U(e, t) {
526
+ function W(e, t) {
532
527
  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;
528
+ 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
529
  return Math.max(...n) * i <= t ? Math.max(...r) : r.reduce((e, t) => e + t, 0);
535
530
  }
536
531
  //#endregion
537
532
  //#region src/engine/svg/questionRenderer.ts
538
- function ve(e, t) {
533
+ function _e(e, t) {
539
534
  return e.baseline > 0 ? e.baseline : t * 1.56;
540
535
  }
541
- function ye(e, t, n, r, i, a, o, s, c, l) {
536
+ function ve(e, t, n, r, i, a, o, s, c, l) {
542
537
  let u = t.metadata?.topicId || t.id, d = e.width || 333.5, f = e.height || 100, p = "";
543
538
  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`;
544
- let m = t.type === "question" && t.metadata?.questionNo || "", h = t.paragraphs[0]?.lines[0], g = h ? ve(h, s) : 20, _ = 0;
539
+ let m = t.type === "question" && t.metadata?.questionNo || "", h = t.paragraphs[0]?.lines[0], g = h ? _e(h, s) : 20, _ = 0;
545
540
  t.type === "question" ? _ = m.length > 2 ? 26.25 : 17.5 : t.type === "sub-question" && (_ = 26.25);
546
541
  let v = e.paragraphStart, y = Math.min(v + e.paragraphCount, t.paragraphs.length), b = 0;
547
542
  for (let e = v; e < y; e++) {
@@ -549,49 +544,49 @@ function ye(e, t, n, r, i, a, o, s, c, l) {
549
544
  b += n.height || n.lines.reduce((e, t) => e + t.lineHeight, 0) || 26;
550
545
  }
551
546
  let x = 0;
552
- t.options && t.options.length > 0 && o && (x = U(t.options, d - _), b += x);
547
+ t.options && t.options.length > 0 && o && (x = W(t.options, d - _), b += x);
553
548
  let S = Math.max(b, e.height), C = (t.type === "question" || t.type === "sub-question") && e.paragraphCount > 0;
554
549
  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
550
  let w = a && c && t.metadata?.score || "", T = 0, E = !1;
556
551
  for (let e = v; e < y; e++) {
557
552
  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;
553
+ 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
554
  }
560
555
  if (t.options && t.options.length > 0 && o) {
561
556
  let e = d - _;
562
- p += H(t.options, e, T, s, l), T += x;
557
+ p += U(t.options, e, T, s, l), T += x;
563
558
  }
564
559
  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
560
  if (m) {
566
561
  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`;
562
+ 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">${H(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`;
568
563
  }
569
564
  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`);
565
+ 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)})">${H(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`);
571
566
  }
572
567
  return p += " </g>\n", p;
573
568
  }
574
- function be(e, t, n, r = 0, i = !0, a = !1, o = "edit") {
569
+ function ye(e, t, n, r = 0, i = !0, a = !1, o = "edit") {
575
570
  let s = e.metadata?.label || "", c = e.height || 40;
576
571
  if (!s) return "";
577
572
  let l = i && e.metadata?.score || "", u = "";
578
- return a && o === "edit" && (u += ` <rect x="${r}" y="${t}" width="${n.toFixed(1)}" height="${c}" fill="none" stroke="#409eff" stroke-width="1.5" rx="2" />\n`), u += ` <foreignObject class="swed-vueplug" data-block-id="${e.id}" transform="translate(${r}, ${t})" width="${n.toFixed(1)}" height="${c}" rendered="true" opacity="1">\n <div class="swed-title_wrapper" topictitle="${V(s)}" topicgroupinfo="">
573
+ return a && o === "edit" && (u += ` <rect x="${r}" y="${t}" width="${n.toFixed(1)}" height="${c}" fill="none" stroke="#409eff" stroke-width="1.5" rx="2" />\n`), u += ` <foreignObject class="swed-vueplug" data-block-id="${e.id}" transform="translate(${r}, ${t})" width="${n.toFixed(1)}" height="${c}" rendered="true" opacity="1">\n <div class="swed-title_wrapper" topictitle="${H(s)}" topicgroupinfo="">
579
574
  <div class="swed-title-content">
580
- <span class="swed-title-text">${V(s)}</span>
581
- ${l ? `<span class="swed-title-score">(${V(l)})</span>` : ""}
575
+ <span class="swed-title-text">${H(s)}</span>
576
+ ${l ? `<span class="swed-title-score">(${H(l)})</span>` : ""}
582
577
  </div>
583
578
  </div>
584
579
  </foreignObject>\n`, u;
585
580
  }
586
- function xe(e, t, n, r, i = "", a, o, s = 0) {
581
+ function be(e, t, n, r, i = "", a, o, s = 0) {
587
582
  let c = "", l = 0;
588
583
  for (let n = 0; n < e.lines.length; n++) {
589
- 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;
584
+ let s = e.lines[n], u = _e(s, a), d = r && n === 0, f = s.elements.length > 0 && s.elements.every((e) => e.type === "enter"), p = s.lineHeight;
590
585
  c += ` <g class="swed-line" transform="translate(0, ${l})" baseline="${u.toFixed(2)}">\n`;
591
586
  let m = 0;
592
587
  if (d && i) {
593
588
  let e = `(${i}分)`, t = u - a;
594
- c += ` <text class="swed-question-score" font-size="${a}" font-weight="normal" font-family="SimSun, STSong, serif" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(0, ${t.toFixed(2)})" y="${a}">${V(e)}</text>\n`, m += se(e, a, "SimSun, STSong, serif");
589
+ c += ` <text class="swed-question-score" font-size="${a}" font-weight="normal" font-family="SimSun, STSong, serif" font-style="normal" fill="#000000" fill-opacity="1" transform="translate(0, ${t.toFixed(2)})" y="${a}">${H(e)}</text>\n`, m += oe(e, a, "SimSun, STSong, serif");
595
590
  }
596
591
  if (f) {
597
592
  if (o === "edit") {
@@ -605,7 +600,7 @@ function xe(e, t, n, r, i = "", a, o, s = 0) {
605
600
  e.justification === "center" ? r = Math.max(0, (i - n) / 2) : e.justification === "right" && (r = Math.max(0, i - n));
606
601
  }
607
602
  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;
603
+ for (let e of s.elements) c += xe(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;
609
604
  if (o === "edit" && n === e.lines.length - 1) {
610
605
  let e = m + r + (s.offsetX || 0) + 2;
611
606
  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,19 +610,19 @@ function xe(e, t, n, r, i = "", a, o, s = 0) {
615
610
  }
616
611
  return ` <g class="swed-paragraph" transform="translate(${s}, ${n})">\n${c} </g>\n`;
617
612
  }
618
- function Se(e, t, n, r, i, a, o, s) {
613
+ function xe(e, t, n, r, i, a, o, s) {
619
614
  switch (e.type) {
620
615
  case "text": {
621
- 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 = "";
616
+ 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(" ") : V(r.value, r.fontSize, r.fontFamily, r.bold, r.italic).map((e) => (e + t).toFixed(2)).join(" "), l = "";
622
617
  if (r.backgroundColor) {
623
618
  let e = o + r.fontSize * .1, n = r.fontSize * 1.1;
624
619
  l += ` <rect x="${t.toFixed(2)}" y="${e.toFixed(2)}" width="${r.width.toFixed(2)}" height="${n.toFixed(2)}" fill="${r.backgroundColor}" fill-opacity="0.3"></rect>\n`;
625
620
  }
626
- let u = r.italic ? -r.fontSize * .02 : 0, d = r.fontFamily ? V(r.fontFamily) : "&quot;Times New Roman&quot;, SimSun";
627
- if (l += ` <text class="swed-text" xml:space="preserve" font-size="${r.fontSize}" font-weight="${a}" font-family="${d}" font-style="${i}" fill="${r.color}" fill-opacity="1" x="${c}" y="${(o + u).toFixed(2)}" dominant-baseline="hanging">${V(r.value)}</text>\n`, r.dotAbove) {
621
+ let u = r.italic ? -r.fontSize * .02 : 0, d = r.fontFamily ? H(r.fontFamily) : "&quot;Times New Roman&quot;, SimSun";
622
+ if (l += ` <text class="swed-text" xml:space="preserve" font-size="${r.fontSize}" font-weight="${a}" font-family="${d}" font-style="${i}" fill="${r.color}" fill-opacity="1" x="${c}" y="${(o + u).toFixed(2)}" dominant-baseline="hanging">${H(r.value)}</text>\n`, r.dotAbove) {
628
623
  let e = Math.max(1.5, r.fontSize * .1), n = o + r.fontSize * .9 + e;
629
624
  for (let i = 0; i < s.length; i++) {
630
- let a = r.xPositions.length === s.length ? r.xPositions[i] + t + z(s[i], r.fontSize, r.fontFamily, r.bold, r.italic) / 2 : t + i * r.fontSize * .6 + r.fontSize * .3;
625
+ let a = r.xPositions.length === s.length ? r.xPositions[i] + t + B(s[i], r.fontSize, r.fontFamily, r.bold, r.italic) / 2 : t + i * r.fontSize * .6 + r.fontSize * .3;
631
626
  l += ` <circle cx="${a.toFixed(2)}" cy="${n.toFixed(2)}" r="${e.toFixed(2)}" fill="${r.color}"></circle>\n`;
632
627
  }
633
628
  }
@@ -644,7 +639,7 @@ function Se(e, t, n, r, i, a, o, s) {
644
639
  l += ` <line x1="${t.toFixed(2)}" y1="${e.toFixed(2)}" x2="${(t + r.width).toFixed(2)}" y2="${e.toFixed(2)}" style="stroke:${r.color};stroke-width:0.8"></line>\n`;
645
640
  }
646
641
  if (r.strikethrough) {
647
- let e = o + ce(r.value, r.fontSize, r.fontFamily, r.bold, r.italic).ascent * .5;
642
+ let e = o + se(r.value, r.fontSize, r.fontFamily, r.bold, r.italic).ascent * .5;
648
643
  l += ` <line x1="${t.toFixed(2)}" y1="${e.toFixed(2)}" x2="${(t + r.width).toFixed(2)}" y2="${e.toFixed(2)}" style="stroke:${r.color};stroke-width:0.8"></line>\n`;
649
644
  }
650
645
  return l;
@@ -654,14 +649,14 @@ function Se(e, t, n, r, i, a, o, s) {
654
649
  return ` <g class="swed-formula" transform="translate(${t.toFixed(2)}, ${o})">\n${r.svgContent} </g>\n`;
655
650
  }
656
651
  case "underline": {
657
- let r = e, i = (n - 30 / 2).toFixed(2), o = 30 .toFixed(2), s = r.topicId ? ` topicid="${r.topicId}" real-index="${r.realIndex ?? 0}" id="${r.topicId}-${r.realIndex ?? 0}"` : "", c = r.id ? ` data-underline-id="${r.id}"` : "", l = r.blankType ? ` data-blank-type="${r.blankType}"` : "", u = a === "edit" ? `<rect class="swed-underline-hitarea" x="0" y="0" width="${r.width.toFixed(2)}" height="30" fill="transparent" opacity="0"></rect>\n` : "";
658
- if ((r.isEmpty || r.blankType) && !r.isSplitPart) {
659
- let e = (42 / 2).toFixed(2), n = a === "edit" ? `<rect x="0" y="0" width="${r.width.toFixed(2)}" height="30" fill="rgb(245,245,245)" opacity="1"></rect>\n` : "", d = a === "edit" ? `<text font-size="12" text-anchor="middle" font-family="'Times New Roman',SimSun,STSong" fill="#aaa" fill-opacity="1" x="${(r.width / 2).toFixed(2)}" y="${e}">${V(r.placeholder)}</text>\n` : "";
660
- return ` <g class="swed-underline" transform="translate(${t.toFixed(2)}, ${i})"${s}${c}${l}>\n ${u} ${n} ${d} <line x1="2" y1="${o}" x2="${(r.width - 2).toFixed(2)}" y2="${o}" style="stroke:#000;stroke-width:0.7"></line>\n </g>\n`;
652
+ let r = e, i = (n - 30 / 2).toFixed(2), o = 30 .toFixed(2), s = r.topicId ? ` topicid="${r.topicId}" real-index="${r.realIndex ?? 0}" id="${r.topicId}-${r.realIndex ?? 0}"` : "", c = r.id ? ` data-underline-id="${r.id}"` : "", l = r.blankType ? ` data-blank-type="${r.blankType}"` : "", u = a === "edit" ? `<rect class="swed-underline-hitarea" x="0" y="0" width="${r.width.toFixed(2)}" height="30" fill="transparent" opacity="0"></rect>\n` : "", d = (r.isEmpty || !!r.blankType) && !r.isSplitPart, f = !r.blankType || r.blankType === "tiankong";
653
+ if (d) {
654
+ let e = (42 / 2).toFixed(2), n = a === "edit" ? `<rect x="0" y="0" width="${r.width.toFixed(2)}" height="30" fill="rgb(245,245,245)" opacity="1"></rect>\n` : "", d = a === "edit" ? `<text font-size="12" text-anchor="middle" font-family="'Times New Roman',SimSun,STSong" fill="#aaa" fill-opacity="1" x="${(r.width / 2).toFixed(2)}" y="${e}">${H(r.placeholder)}</text>\n` : "";
655
+ return ` <g class="swed-underline" transform="translate(${t.toFixed(2)}, ${i})"${s}${c}${l}>\n ${u} ${n} ${d}` + (f ? ` <line x1="2" y1="${o}" x2="${(r.width - 2).toFixed(2)}" y2="${o}" style="stroke:#000;stroke-width:0.7"></line>\n` : "") + " </g>\n";
661
656
  }
662
657
  if (r.isSplitPart && (r.isEmpty || r.blankType) && a === "edit") {
663
658
  let e = `<rect x="0" y="0" width="${r.width.toFixed(2)}" height="30" fill="rgb(245,245,245)" opacity="0.6"></rect>\n`;
664
- return ` <g class="swed-underline" transform="translate(${t.toFixed(2)}, ${i})"${s}${c}${l}>\n ${u} ${e} <line x1="2" y1="${o}" x2="${(r.width - 2).toFixed(2)}" y2="${o}" style="stroke:#000;stroke-width:${r.lineWidth}"></line>\n </g>\n`;
659
+ return ` <g class="swed-underline" transform="translate(${t.toFixed(2)}, ${i})"${s}${c}${l}>\n ${u} ${e}` + (f ? ` <line x1="2" y1="${o}" x2="${(r.width - 2).toFixed(2)}" y2="${o}" style="stroke:#000;stroke-width:${r.lineWidth}"></line>\n` : "") + " </g>\n";
665
660
  }
666
661
  return ` <g class="swed-underline" transform="translate(${t.toFixed(2)}, ${i})"${s}${c}${l}>\n ${u} <line x1="2" y1="${o}" x2="${(r.width - 2).toFixed(2)}" y2="${o}" style="stroke:#000;stroke-width:${r.lineWidth}"></line>\n </g>\n`;
667
662
  }
@@ -683,7 +678,7 @@ function Se(e, t, n, r, i, a, o, s) {
683
678
  }
684
679
  //#endregion
685
680
  //#region src/engine/SvgRenderer.ts
686
- var Ce = class {
681
+ var Se = class {
687
682
  FOOTER_EXTRA_GAP = 9.2;
688
683
  renderMode;
689
684
  constructor(e) {
@@ -723,19 +718,20 @@ var Ce = class {
723
718
  }
724
719
  renderAllPages(e, t, n, r) {
725
720
  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();
721
+ 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`;
722
+ p += he();
728
723
  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, {
724
+ let u = e[r], f = r % 2 == 0 ? n.bodyTopEven ?? 173 : n.bodyTopOdd ?? 50, m = r * d;
725
+ p += `<g class="swed-page" transform="translate(0, ${m})">\n`, p += this.renderPageContent(u, t, f, n, r, e.length, {
731
726
  showBBoxes: i,
732
727
  selectedBlockId: a,
733
728
  totalScore: o,
734
729
  paperName: s,
730
+ qrCodeImages: l,
735
731
  qrCodeImage: c
736
- }), f += "</g>\n";
732
+ }), p += "</g>\n";
737
733
  }
738
- return f += "</svg>", f;
734
+ return p += "</svg>", p;
739
735
  }
740
736
  renderPage(e, t, n, r, i = {
741
737
  showBBoxes: !1,
@@ -743,14 +739,15 @@ var Ce = class {
743
739
  totalScore: 0,
744
740
  paperName: ""
745
741
  }, 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, {
742
+ let { totalScore: s = 0, paperName: c = "", schoolName: l = "", qrCodeImage: u = "", qrCodeImages: d } = i, f = "";
743
+ return o && (f += he()), f += this.renderPageContent(e, t, n, r, e.index, a, {
748
744
  ...i,
749
745
  totalScore: s,
750
746
  paperName: c,
751
747
  schoolName: l,
748
+ qrCodeImages: d,
752
749
  qrCodeImage: u
753
- }), d;
750
+ }), f;
754
751
  }
755
752
  computePageRegions(e, t, n, r, i = 1) {
756
753
  let [a, o, s, c] = r.margins || [
@@ -766,7 +763,7 @@ var Ce = class {
766
763
  if (e.type === "title") {
767
764
  g.push({
768
765
  type: "title-embed",
769
- bbox: P(i, a, r.width || p, e.height || 40),
766
+ bbox: F(i, a, r.width || p, e.height || 40),
770
767
  meta: { label: e.metadata?.label }
771
768
  });
772
769
  continue;
@@ -779,12 +776,12 @@ var Ce = class {
779
776
  let u = o + r.paragraphCount >= e.paragraphs.length;
780
777
  if (e.options && e.options.length > 0 && u) {
781
778
  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);
779
+ c += W(e.options, t - i);
783
780
  }
784
781
  let d = Math.max(c, r.height);
785
782
  g.push({
786
783
  type: "question-border",
787
- bbox: P(i, a, r.width, d),
784
+ bbox: F(i, a, r.width, d),
788
785
  meta: {
789
786
  blockId: r.blockId,
790
787
  blockType: r.blockType
@@ -797,7 +794,7 @@ var Ce = class {
797
794
  let r = t * (p + d) - d / 2;
798
795
  g.push({
799
796
  type: "column-separator",
800
- bbox: P(c + r, n, .5, e)
797
+ bbox: F(c + r, n, .5, e)
801
798
  });
802
799
  }
803
800
  }
@@ -813,12 +810,12 @@ var Ce = class {
813
810
  }
814
811
  let a = 0, l = !p && u === 0;
815
812
  for (let t of n.lines) {
816
- let u = ve(t, h), d = 0;
813
+ let u = _e(t, h), d = 0;
817
814
  if (l && r.showScore && !p) {
818
815
  let t = e.metadata?.score || "";
819
816
  if (t) {
820
817
  let e = `(${t}分)`;
821
- d += se(e, h, "SimSun, STSong, serif");
818
+ d += oe(e, h, "SimSun, STSong, serif");
822
819
  }
823
820
  p = !0, l = !1;
824
821
  }
@@ -832,7 +829,7 @@ var Ce = class {
832
829
  let n = e;
833
830
  g.push({
834
831
  type: "underline",
835
- bbox: P(s + m + (t.offsetX || 0) + d, c + f + a + u - 30 / 2, n.width, 30),
832
+ bbox: F(s + m + (t.offsetX || 0) + d, c + f + a + u - 30 / 2, n.width, 30),
836
833
  meta: {
837
834
  placeholder: n.placeholder,
838
835
  isEmpty: n.isEmpty,
@@ -867,12 +864,12 @@ var Ce = class {
867
864
  let t = e.getAttribute("data-region"), r = e.getBoundingClientRect();
868
865
  n.push({
869
866
  type: t,
870
- bbox: P((r.left - a.left) * c, (r.top - a.top) * l, r.width * c, r.height * l)
867
+ bbox: F((r.left - a.left) * c, (r.top - a.top) * l, r.width * c, r.height * l)
871
868
  });
872
869
  }
873
870
  }
874
871
  getOptionsHeight(e, t) {
875
- return U(e, t);
872
+ return W(e, t);
876
873
  }
877
874
  renderPageContent(e, t, n, r, i, a, o) {
878
875
  let [s, c, l, u] = r.margins || [
@@ -882,31 +879,31 @@ var Ce = class {
882
879
  56
883
880
  ], 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 = "";
884
881
  b += " <g class=\"swed-background\"></g>\n";
885
- let x = this.computeHeaderLayout(r, e), S = {
882
+ let x = o.qrCodeImages?.[i] || o.qrCodeImage || "", S = this.computeHeaderLayout(r, e), C = {
886
883
  mode: "portrait",
887
884
  contentWidth: p,
888
885
  contentX: 0
889
886
  };
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";
887
+ 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 += le(S, C, o.totalScore ?? 0, o.paperName || "", o.schoolName || "", x, r.showScore ?? !0, this.renderMode) : b += pe(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";
888
+ let w = `${i + 1}/${a}`, T = p / 2 - w.length * 6, E = w.split("").map((e, t) => (T + t * 12).toFixed(2)).join(" ");
889
+ 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">${H(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 += me(), b += " </g>\n", b += " </g>\n", b += " <g class=\"swed-layout\">\n";
893
890
  for (let t of e.cornerMarks) b += this.renderCornerMark(t);
894
891
  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;
892
+ let D = this.groupBlocksByColumn(e.blocks);
893
+ for (let e = 0; e < D.length; e++) {
894
+ let n = D[e][0], i = n ? n.x : e === 0 ? 0 : g + m;
898
895
  b += ` <g class="col" transform="translate(${i}, 0)">\n`;
899
- for (let n of E[e]) {
896
+ for (let n of D[e]) {
900
897
  let e = t.find((e) => e.id === n.blockId);
901
898
  if (!e || e.type === "title") continue;
902
899
  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);
900
+ b += ve(n, e, n.y, o.showBBoxes, i, a, s, y, r.showScore ?? !0, this.renderMode);
904
901
  }
905
902
  b += " </g>\n";
906
903
  }
907
- if (E.length > 1) {
904
+ if (D.length > 1) {
908
905
  let e = (_ - n).toFixed(1);
909
- for (let t = 1; t < E.length; t++) {
906
+ for (let t = 1; t < D.length; t++) {
910
907
  let n = t * (g + m) - m / 2;
911
908
  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
909
  }
@@ -914,7 +911,7 @@ var Ce = class {
914
911
  b += " </g>\n", b += " </g>\n", b += " <g class=\"embeds\">\n";
915
912
  for (let n of e.blocks) {
916
913
  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));
914
+ !e || e.type !== "title" || (b += ye(e, n.y, n.width || g, n.x || 0, r.showScore, o.selectedBlockId === e.id, this.renderMode));
918
915
  }
919
916
  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
917
  }
@@ -927,28 +924,28 @@ var Ce = class {
927
924
  let [t, n, r, i] = e.bbox;
928
925
  return ` <rect fill="black" x="${t}" y="${n}" width="${r}" height="${i}"></rect>\n`;
929
926
  }
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;
927
+ }, G = /* @__PURE__ */ new Map(), Ce = 500;
928
+ function we(e, t, n) {
929
+ let r = `${t}:${n}:${e}`, i = G.get(r);
930
+ return i && (G.delete(r), G.set(r, i)), i;
934
931
  }
935
- function Ee(e, t, n, r) {
932
+ function Te(e, t, n, r) {
936
933
  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);
934
+ if (G.set(i, r), G.size > Ce) {
935
+ let e = G.keys().next().value;
936
+ e && G.delete(e);
940
937
  }
941
938
  }
942
- function De() {
943
- W.clear();
939
+ function Ee() {
940
+ G.clear();
944
941
  }
945
- function G(e, t = 14, n = !1) {
946
- let r = Te(e, t, n);
942
+ function K(e, t = 14, n = !1) {
943
+ let r = we(e, t, n);
947
944
  if (r) return r;
948
- let i = Oe(e, t, n);
949
- return Ee(e, t, n, i), i;
945
+ let i = De(e, t, n);
946
+ return Te(e, t, n, i), i;
950
947
  }
951
- function Oe(e, t = 14, n = !1) {
948
+ function De(e, t = 14, n = !1) {
952
949
  try {
953
950
  let r = window.MathJax;
954
951
  if (!r?.tex2svg) throw Error("MathJax 尚未加载完成");
@@ -973,22 +970,22 @@ function Oe(e, t = 14, n = !1) {
973
970
  };
974
971
  } catch {
975
972
  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>`,
973
+ 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
974
  width: 50,
978
975
  height: 20
979
976
  };
980
977
  }
981
978
  }
982
- function ke(e) {
979
+ function Oe(e) {
983
980
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
984
981
  }
985
- var K = /* @__PURE__ */ new Map(), Ae = 200;
986
- function je(e, t = 14, n = !1) {
982
+ var q = /* @__PURE__ */ new Map(), ke = 200;
983
+ function Ae(e, t = 14, n = !1) {
987
984
  let r = e;
988
985
  try {
989
986
  r = decodeURIComponent(e);
990
987
  } catch {}
991
- let i = `${t}:${n}:${r}`, a = K.get(i);
988
+ let i = `${t}:${n}:${r}`, a = q.get(i);
992
989
  if (a) return a;
993
990
  try {
994
991
  let e = window.MathJax;
@@ -1012,9 +1009,9 @@ function je(e, t = 14, n = !1) {
1012
1009
  width: s,
1013
1010
  height: c
1014
1011
  };
1015
- if (K.set(i, d), K.size > Ae) {
1016
- let e = K.keys().next().value;
1017
- e && K.delete(e);
1012
+ if (q.set(i, d), q.size > ke) {
1013
+ let e = q.keys().next().value;
1014
+ e && q.delete(e);
1018
1015
  }
1019
1016
  return d;
1020
1017
  } catch {
@@ -1025,14 +1022,14 @@ function je(e, t = 14, n = !1) {
1025
1022
  };
1026
1023
  }
1027
1024
  }
1028
- function Me(e, t = 20) {
1025
+ function je(e, t = 20) {
1029
1026
  return new Promise((n) => {
1030
1027
  let r = Array(e.length), i = 0;
1031
1028
  function a() {
1032
1029
  let o = Math.min(i + t, e.length);
1033
1030
  for (; i < o; i++) {
1034
1031
  let t = e[i];
1035
- r[i] = G(t.latex, t.fontSize ?? 14, t.display ?? !1);
1032
+ r[i] = K(t.latex, t.fontSize ?? 14, t.display ?? !1);
1036
1033
  }
1037
1034
  i < e.length ? requestAnimationFrame(a) : n(r);
1038
1035
  }
@@ -1041,7 +1038,7 @@ function Me(e, t = 20) {
1041
1038
  }
1042
1039
  //#endregion
1043
1040
  //#region src/utils/serialization/shared.ts
1044
- var Ne = {
1041
+ var Me = {
1045
1042
  clrScheme: {
1046
1043
  accent1: "4472C4",
1047
1044
  accent2: "ED7D31",
@@ -1098,9 +1095,9 @@ var Ne = {
1098
1095
  latin: "等线"
1099
1096
  }
1100
1097
  }
1101
- }, Pe = { docDefaults: { textPropsDefault: { runfonts: { hint: "eastAsia" } } } }, Fe = 26.46, Ie = 17.5, Le = 26.25;
1102
- function q(e) {
1103
- let t = Fe;
1098
+ }, Ne = { docDefaults: { textPropsDefault: { runfonts: { hint: "eastAsia" } } } }, Pe = 26.46, Fe = 17.5, Ie = 26.25;
1099
+ function J(e) {
1100
+ let t = Pe;
1104
1101
  return {
1105
1102
  tl: {
1106
1103
  top: t,
@@ -1128,11 +1125,11 @@ function q(e) {
1128
1125
  }
1129
1126
  };
1130
1127
  }
1131
- function Re(e) {
1128
+ function Le(e) {
1132
1129
  let t = e.startsWith("sw-") ? e.slice(3) : e, n = t.lastIndexOf("-");
1133
1130
  return n > 0 && /^\d+$/.test(t.slice(n + 1)) && (t = t.slice(0, n)), t;
1134
1131
  }
1135
- function ze(e) {
1132
+ function Re(e) {
1136
1133
  let t = /* @__PURE__ */ new Map();
1137
1134
  for (let n of e) {
1138
1135
  t.set(n.id, n);
@@ -1141,7 +1138,7 @@ function ze(e) {
1141
1138
  }
1142
1139
  return t;
1143
1140
  }
1144
- function Be(e) {
1141
+ function ze(e) {
1145
1142
  let t = e?.questionType;
1146
1143
  if (t) {
1147
1144
  if (t.includes("chose")) return "choice";
@@ -1150,28 +1147,28 @@ function Be(e) {
1150
1147
  }
1151
1148
  return e?.options?.length ? "choice" : "fill";
1152
1149
  }
1153
- function Ve(e) {
1150
+ function Be(e) {
1154
1151
  return e.replace(/-([a-z])/g, (e, t) => t.toUpperCase());
1155
1152
  }
1156
- function He(e) {
1153
+ function Ve(e) {
1157
1154
  return /_Block_\d+$/.test(e);
1158
1155
  }
1159
- function Ue(e) {
1156
+ function He(e) {
1160
1157
  let t = e.match(/^(.+)_Block_\d+$/);
1161
1158
  return t ? t[1] : "";
1162
1159
  }
1163
- function We(e) {
1160
+ function Ue(e) {
1164
1161
  let t = [];
1165
1162
  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
1163
  let n = t.join("").trim();
1167
1164
  return !n && e.metadata?.label ? e.metadata.label : n;
1168
1165
  }
1169
- function Ge(e) {
1166
+ function We(e) {
1170
1167
  let t = [], n = null;
1171
1168
  for (let r of e) {
1172
1169
  if (r.type === "title") {
1173
1170
  n &&= (t.push(n), null);
1174
- let e = We(r);
1171
+ let e = Ue(r);
1175
1172
  t.push({
1176
1173
  type: "title-section",
1177
1174
  name: e || "题目",
@@ -1190,9 +1187,9 @@ function Ge(e) {
1190
1187
  }
1191
1188
  //#endregion
1192
1189
  //#region src/utils/serialization/buildQuestions.ts
1193
- function Ke(e, t) {
1190
+ function Ge(e, t) {
1194
1191
  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 || [
1192
+ let n = e.type === "sub-question" ? Ie : Fe, r = A[t.paperSize], [, , i, a] = t.margins || [
1196
1193
  50,
1197
1194
  56,
1198
1195
  50,
@@ -1231,7 +1228,7 @@ function Ke(e, t) {
1231
1228
  })()
1232
1229
  }, f = {
1233
1230
  type: "question-stem",
1234
- children: e.paragraphs.map((e) => Je(e)),
1231
+ children: e.paragraphs.map((e) => qe(e)),
1235
1232
  props: {
1236
1233
  split: !0,
1237
1234
  anchorOverflow: !1,
@@ -1260,13 +1257,13 @@ function Ke(e, t) {
1260
1257
  isLongScoreBar: !0
1261
1258
  }
1262
1259
  }, 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), {
1260
+ 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
1261
  type: "question",
1265
1262
  props: d,
1266
1263
  children: m
1267
1264
  };
1268
1265
  }
1269
- function qe(e, t) {
1266
+ function Ke(e, t) {
1270
1267
  return {
1271
1268
  type: "option",
1272
1269
  props: {
@@ -1275,7 +1272,7 @@ function qe(e, t) {
1275
1272
  keepNext: !1
1276
1273
  },
1277
1274
  children: e.map((e, t) => {
1278
- let n = e.paragraphs.map((e) => Je(e));
1275
+ let n = e.paragraphs.map((e) => qe(e));
1279
1276
  return {
1280
1277
  type: "option-item",
1281
1278
  props: {
@@ -1289,10 +1286,10 @@ function qe(e, t) {
1289
1286
  })
1290
1287
  };
1291
1288
  }
1292
- function Je(e) {
1289
+ function qe(e) {
1293
1290
  let t = [];
1294
1291
  for (let n of e.lines) for (let e of n.elements) {
1295
- let r = Ye(e, n);
1292
+ let r = Je(e, n);
1296
1293
  r && t.push(r);
1297
1294
  }
1298
1295
  return {
@@ -1308,7 +1305,7 @@ function Je(e) {
1308
1305
  children: t
1309
1306
  };
1310
1307
  }
1311
- function Ye(e, t) {
1308
+ function Je(e, t) {
1312
1309
  switch (e.type) {
1313
1310
  case "text": {
1314
1311
  let t = e;
@@ -1473,8 +1470,8 @@ function Ye(e, t) {
1473
1470
  }
1474
1471
  //#endregion
1475
1472
  //#region src/utils/serialization/buildBody.ts
1476
- function Xe(e, t) {
1477
- let n = k[t.paperSize], [r, i, a, o] = t.margins || [
1473
+ function Ye(e, t) {
1474
+ let n = A[t.paperSize], [r, i, a, o] = t.margins || [
1478
1475
  50,
1479
1476
  56,
1480
1477
  50,
@@ -1484,15 +1481,15 @@ function Xe(e, t) {
1484
1481
  type: `${t.paperSize}${t.columns > 1 ? "_" + t.columns : ""}`,
1485
1482
  width: n.width,
1486
1483
  height: n.height,
1487
- width2mm: A[t.paperSize]?.w ?? 210,
1488
- height2mm: A[t.paperSize]?.h ?? 297,
1484
+ width2mm: j[t.paperSize]?.w ?? 210,
1485
+ height2mm: j[t.paperSize]?.h ?? 297,
1489
1486
  padding: {
1490
1487
  top: r,
1491
1488
  right: i,
1492
1489
  bottom: a,
1493
1490
  left: o
1494
1491
  },
1495
- point: q(n),
1492
+ point: J(n),
1496
1493
  headerTop: t.headerTop ?? 18,
1497
1494
  footerBottom: 13.2,
1498
1495
  showScore: t.showScore,
@@ -1519,7 +1516,7 @@ function Xe(e, t) {
1519
1516
  colorType: "rgb",
1520
1517
  colorValue: "7030A0"
1521
1518
  } } }
1522
- }, u = Ze(e, t);
1519
+ }, u = Xe(e, t);
1523
1520
  return {
1524
1521
  type: "document",
1525
1522
  props: l,
@@ -1536,16 +1533,16 @@ function Xe(e, t) {
1536
1533
  }]
1537
1534
  };
1538
1535
  }
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));
1536
+ function Xe(e, t) {
1537
+ let n = [], r = We(e);
1538
+ for (let e of r) if (e.type === "title-section") n.push(Ze(e.name, e.blocks));
1542
1539
  else for (let r of e.blocks) {
1543
- let e = Ke(r, t);
1540
+ let e = Ge(r, t);
1544
1541
  e && n.push(e);
1545
1542
  }
1546
1543
  return n;
1547
1544
  }
1548
- function Qe(e, t) {
1545
+ function Ze(e, t) {
1549
1546
  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
1547
  return {
1551
1548
  type: "vueplug",
@@ -1576,7 +1573,7 @@ function Qe(e, t) {
1576
1573
  }
1577
1574
  //#endregion
1578
1575
  //#region src/utils/serialization/buildPagesExport.ts
1579
- var $e = new Set([
1576
+ var Qe = new Set([
1580
1577
  "header-desc",
1581
1578
  "score",
1582
1579
  "paper-name",
@@ -1585,20 +1582,20 @@ var $e = new Set([
1585
1582
  "student-class",
1586
1583
  "student-code"
1587
1584
  ]);
1588
- function et(e, t, n = !0) {
1589
- let r = ze(t), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1585
+ function $e(e, t, n = !0) {
1586
+ let r = Re(t), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1590
1587
  for (let t of e) for (let e of t.renderedRegions || []) {
1591
- let t = Re(e.meta?.blockId || e.meta?.topicId || "");
1588
+ let t = Le(e.meta?.blockId || e.meta?.topicId || "");
1592
1589
  t && e.type === "question-border" && i.add(t);
1593
1590
  }
1594
- for (let e of i) He(e) && a.add(Ue(e));
1591
+ for (let e of i) Ve(e) && a.add(He(e));
1595
1592
  let o = /* @__PURE__ */ new Map(), s = 0;
1596
1593
  for (let e of t) {
1597
1594
  let t = e.metadata?.topicId || (e.id.startsWith("sw-") ? e.id.slice(3) : e.id);
1598
1595
  o.has(t) || o.set(t, s++);
1599
1596
  }
1600
1597
  for (let t of e) for (let e of t.renderedRegions || []) {
1601
- let t = Re(e.meta?.blockId || e.meta?.topicId || "");
1598
+ let t = Le(e.meta?.blockId || e.meta?.topicId || "");
1602
1599
  t && e.type === "question-border" && !o.has(t) && o.set(t, s++);
1603
1600
  }
1604
1601
  return e.map((t) => {
@@ -1613,9 +1610,9 @@ function et(e, t, n = !0) {
1613
1610
  questions: []
1614
1611
  }, c = {}, l = [], u, d = /* @__PURE__ */ new Map();
1615
1612
  for (let e of i) {
1616
- if ($e.has(e.type)) {
1613
+ if (Qe.has(e.type)) {
1617
1614
  if (e.type === "score" && !n) continue;
1618
- c[Ve(e.type)] = e.bbox;
1615
+ c[Be(e.type)] = e.bbox;
1619
1616
  continue;
1620
1617
  }
1621
1618
  if (e.type === "page-number") {
@@ -1630,7 +1627,7 @@ function et(e, t, n = !0) {
1630
1627
  continue;
1631
1628
  }
1632
1629
  if (e.type === "column-separator") continue;
1633
- let t = Re(e.meta?.blockId || e.meta?.topicId || "");
1630
+ let t = Le(e.meta?.blockId || e.meta?.topicId || "");
1634
1631
  if (!t) continue;
1635
1632
  d.has(t) || d.set(t, {
1636
1633
  borders: [],
@@ -1649,7 +1646,7 @@ function et(e, t, n = !0) {
1649
1646
  let i = r.get(t), c = i?.metadata?.questionNo || i?.metadata?.subLabel || "", l = i?.metadata?.score, u = a.has(t), d = n.borders.map((e) => e.bbox), f = {
1650
1647
  topicId: t,
1651
1648
  questionNo: c,
1652
- questionType: Be(i),
1649
+ questionType: ze(i),
1653
1650
  sortIndex: o.get(t) ?? 9999,
1654
1651
  bbox: d[0]
1655
1652
  };
@@ -1657,12 +1654,12 @@ function et(e, t, n = !0) {
1657
1654
  let e = parseFloat(String(l));
1658
1655
  isNaN(e) || (f.score = e);
1659
1656
  }
1660
- He(t) && (f.parentTopicId = Ue(t)), u && (f.hasSubQuestions = !0), n.underlines.length > 0 && (f.underlines = n.underlines.map((e) => {
1657
+ Ve(t) && (f.parentTopicId = He(t)), u && (f.hasSubQuestions = !0), n.underlines.length > 0 && (f.underlines = n.underlines.map((e) => {
1661
1658
  let t = { bbox: e.bbox }, n = e.meta;
1662
1659
  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
1660
  })), e.filter((e) => e.renderedRegions.some((e) => {
1664
1661
  let n = e.meta?.blockId || e.meta?.topicId || "";
1665
- return n && Re(n) === t;
1662
+ return n && Le(n) === t;
1666
1663
  })).length > 1 && (f.isCrossPage = !0), s.questions.push(f);
1667
1664
  }
1668
1665
  return s;
@@ -1670,8 +1667,8 @@ function et(e, t, n = !0) {
1670
1667
  }
1671
1668
  //#endregion
1672
1669
  //#region src/utils/textWrap.ts
1673
- var tt = ",。、;:?!…)】》'\"'\"…·", nt = "(【《'\"'\"";
1674
- function rt(e, t) {
1670
+ var et = ",。、;:?!…)】》'\"'\"…·", tt = "(【《'\"'\"";
1671
+ function nt(e, t) {
1675
1672
  let n = t, r = t * .5;
1676
1673
  for (let t of e) if (t.type === "formula") {
1677
1674
  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;
@@ -1689,7 +1686,7 @@ function rt(e, t) {
1689
1686
  y: 0
1690
1687
  };
1691
1688
  }
1692
- function it(e, t, n, r = 0) {
1689
+ function rt(e, t, n, r = 0) {
1693
1690
  let i = [], a = [], o = 0;
1694
1691
  for (let n = 0; n < e.length; n++) {
1695
1692
  let s = e[n];
@@ -1755,12 +1752,12 @@ function it(e, t, n, r = 0) {
1755
1752
  continue;
1756
1753
  }
1757
1754
  }
1758
- let u = s.type === "text" && tt.includes(s.value) && a.length > 0 && o + s.width <= l;
1755
+ let u = s.type === "text" && et.includes(s.value) && a.length > 0 && o + s.width <= l;
1759
1756
  if (o + s.width > l && a.length > 0 && !u) {
1760
1757
  let e = a.length;
1761
1758
  if (a.length > 0) {
1762
1759
  let t = a[a.length - 1];
1763
- t.type === "text" && nt.includes(t.value) && a.length > 1 && (e = a.length - 1);
1760
+ t.type === "text" && tt.includes(t.value) && a.length > 1 && (e = a.length - 1);
1764
1761
  }
1765
1762
  i.push(a.slice(0, e)), a = [...a.slice(e), s], o = a.reduce((e, t) => e + t.width, 0);
1766
1763
  } else a.push(s), o += s.width;
@@ -1768,26 +1765,26 @@ function it(e, t, n, r = 0) {
1768
1765
  return a.length > 0 && i.push(a), i.length > 0 ? i.map((e, i) => {
1769
1766
  let a = t;
1770
1767
  return i === 0 && r > 0 && (a -= r), {
1771
- ...rt(e, n),
1768
+ ...nt(e, n),
1772
1769
  availableWidth: a
1773
1770
  };
1774
1771
  }) : [{
1775
- ...rt(e, n),
1772
+ ...nt(e, n),
1776
1773
  availableWidth: t
1777
1774
  }];
1778
1775
  }
1779
- function at(e, t, n) {
1780
- return it(e, t, n, 0);
1776
+ function it(e, t, n) {
1777
+ return rt(e, t, n, 0);
1781
1778
  }
1782
1779
  //#endregion
1783
1780
  //#region src/utils/deserialization/parseInlines.ts
1784
- var ot = 0;
1785
- function st(e) {
1781
+ var at = 0;
1782
+ function ot(e) {
1786
1783
  switch (e.type) {
1787
1784
  case "text": {
1788
1785
  let t = e;
1789
1786
  if (!t.text) return null;
1790
- let n = t.props.fontSize || 14, r = t.props.fontFamily || t.props.runfonts?.eastAsia || "SimSun", i = t.props.bold === "bold", a = t.props.italic === "italic", o = B(t.text, n, r, i, a), s = o.length > 0 ? o[o.length - 1] + z(t.text[t.text.length - 1], n, r, i, a) : 0, c = {
1787
+ let n = t.props.fontSize || 14, r = t.props.fontFamily || t.props.runfonts?.eastAsia || "SimSun", i = t.props.bold === "bold", a = t.props.italic === "italic", o = V(t.text, n, r, i, a), s = o.length > 0 ? o[o.length - 1] + B(t.text[t.text.length - 1], n, r, i, a) : 0, c = {
1791
1788
  type: "text",
1792
1789
  value: t.text,
1793
1790
  fontFamily: r,
@@ -1802,7 +1799,7 @@ function st(e) {
1802
1799
  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
1800
  }
1804
1801
  case "latex": {
1805
- let t = e, n = t.value || t.props.raw || "", { svg: r, width: i, height: a } = G(n);
1802
+ let t = e, n = t.value || t.props.raw || "", { svg: r, width: i, height: a } = K(n);
1806
1803
  return {
1807
1804
  type: "formula",
1808
1805
  width: i,
@@ -1812,7 +1809,7 @@ function st(e) {
1812
1809
  };
1813
1810
  }
1814
1811
  case "mathml": {
1815
- let t = e, n = t.value || t.props.raw || "", { svg: r, width: i, height: a } = je(n);
1812
+ let t = e, n = t.value || t.props.raw || "", { svg: r, width: i, height: a } = Ae(n);
1816
1813
  return {
1817
1814
  type: "formula",
1818
1815
  width: i,
@@ -1826,7 +1823,7 @@ function st(e) {
1826
1823
  let t = e, n = t.props.rect?.width || 80;
1827
1824
  return {
1828
1825
  type: "underline",
1829
- id: t.props.ulId || `ul-${++ot}`,
1826
+ id: t.props.ulId || `ul-${++at}`,
1830
1827
  width: n,
1831
1828
  height: 20,
1832
1829
  placeholder: t.props.placeholder || "空",
@@ -1896,22 +1893,22 @@ function st(e) {
1896
1893
  }
1897
1894
  //#endregion
1898
1895
  //#region src/utils/deserialization/parseQuestions.ts
1899
- var ct = 0;
1900
- function lt(e, t, n, r) {
1896
+ var st = 0;
1897
+ function ct(e, t, n, r) {
1901
1898
  let i = [], a = e.props, o = e.children.find((e) => e.type === "question-stem");
1902
1899
  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++;
1900
+ let s = a.topicId.includes("_Block_"), c = t ? t - (s ? Ie : Fe) : void 0, l = [];
1901
+ for (let e of o.children) e.type === "paragraph" && l.push(ut(e, c, n, r));
1902
+ st++;
1906
1903
  let u = {
1907
- id: `sw-${a.topicId}-${ct}`,
1904
+ id: `sw-${a.topicId}-${st}`,
1908
1905
  type: s ? "sub-question" : "question",
1909
1906
  paragraphs: l,
1910
1907
  height: l.reduce((e, t) => e + (t.height || 26), 0),
1911
1908
  metadata: {
1912
1909
  questionNo: s ? "" : a.topicIndex,
1913
1910
  subLabel: s ? a.topicIndex : "",
1914
- score: ut(e),
1911
+ score: lt(e),
1915
1912
  topicId: a.topicId,
1916
1913
  label: a.topicIndex,
1917
1914
  blockGroup: a.isMaterial ? a.topicId.split("_Block_")[0] : void 0,
@@ -1920,7 +1917,7 @@ function lt(e, t, n, r) {
1920
1917
  }, d = e.children.find((e) => e.type === "option");
1921
1918
  if (d && d.children && d.children.length > 0 && (u.questionType = a.choiceMarkingType === 2 ? "single_chose" : "multi_chose", u.options = d.children.map((e) => {
1922
1919
  let t = [];
1923
- for (let i of e.children) i.type === "paragraph" && t.push(dt(i, c, n, r));
1920
+ for (let i of e.children) i.type === "paragraph" && t.push(ut(i, c, n, r));
1924
1921
  return {
1925
1922
  label: e.props.oriLabel || e.props.label?.replace(".", "") || "",
1926
1923
  contentHtml: "",
@@ -1932,17 +1929,17 @@ function lt(e, t, n, r) {
1932
1929
  } catch {}
1933
1930
  return i.push(u), i;
1934
1931
  }
1935
- function ut(e) {
1932
+ function lt(e) {
1936
1933
  for (let t of e.children) if (t.type === "question-stem") {
1937
1934
  for (let e of t.children) for (let t of e.children) if (t.type === "question-score") return `${t.props.score}`;
1938
1935
  }
1939
1936
  for (let t of e.children) if (t.type === "correction-box") return `${t.props.score}`;
1940
1937
  return "";
1941
1938
  }
1942
- function dt(e, t, n, r) {
1939
+ function ut(e, t, n, r) {
1943
1940
  let i = [];
1944
1941
  for (let t of e.children) {
1945
- let e = st(t);
1942
+ let e = ot(t);
1946
1943
  e && i.push(e);
1947
1944
  }
1948
1945
  i.length === 0 && i.push({
@@ -1952,7 +1949,7 @@ function dt(e, t, n, r) {
1952
1949
  });
1953
1950
  let a = r ?? Math.round((n ?? 14) * 1.5 * 35 / (14 * 1.5));
1954
1951
  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;
1952
+ 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
1953
  return {
1957
1954
  lines: n,
1958
1955
  y: 0,
@@ -1977,7 +1974,7 @@ function dt(e, t, n, r) {
1977
1974
  }
1978
1975
  //#endregion
1979
1976
  //#region src/utils/deserialization/parseDocument.ts
1980
- function ft(e) {
1977
+ function dt(e) {
1981
1978
  let t;
1982
1979
  try {
1983
1980
  t = JSON.parse(e);
@@ -1988,15 +1985,15 @@ function ft(e) {
1988
1985
  if (!t.body || typeof t.body != "object") throw Error("[documentSerializer] 文档格式错误: 缺少 body 字段");
1989
1986
  if (!t.body.props || !t.body.props.paper) throw Error("[documentSerializer] 文档格式错误: 缺少 body.props.paper");
1990
1987
  if (!Array.isArray(t.body.children)) throw Error("[documentSerializer] 文档格式错误: body.children 应为数组");
1991
- return delete t._pages, delete t._regions, pt(t);
1988
+ return delete t._pages, delete t._regions, ft(t);
1992
1989
  }
1993
- function pt(e) {
1990
+ function ft(e) {
1994
1991
  let t = e.body, n = t.props.paper, r = n.padding || {
1995
1992
  top: 50,
1996
1993
  right: 56,
1997
1994
  bottom: 50,
1998
1995
  left: 56
1999
- }, i = N(n.type), a = {
1996
+ }, i = P(n.type), a = {
2000
1997
  paperSize: i.size,
2001
1998
  columns: i.columns,
2002
1999
  fontSize: n.fontSize ?? 14,
@@ -2024,10 +2021,10 @@ function pt(e) {
2024
2021
  }
2025
2022
  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
2023
  for (let e of t.children) for (let t of e.children) if (t.type === "vueplug") {
2027
- let e = mt(t);
2024
+ let e = pt(t);
2028
2025
  e && _.push(e);
2029
2026
  } else if (t.type === "question") {
2030
- let e = lt(t, g, o, c);
2027
+ let e = ct(t, g, o, c);
2031
2028
  _.push(...e);
2032
2029
  }
2033
2030
  return {
@@ -2040,7 +2037,7 @@ function pt(e) {
2040
2037
  totalScore: p
2041
2038
  };
2042
2039
  }
2043
- function mt(e) {
2040
+ function pt(e) {
2044
2041
  let t = e.props?.bind || {}, n = t?.topicTitle || t?.title || t?.input || "";
2045
2042
  if (!n) return null;
2046
2043
  let r = {
@@ -2048,7 +2045,7 @@ function mt(e) {
2048
2045
  isTitle: !0
2049
2046
  };
2050
2047
  return t.topicTitle && (r.title = String(t.title || "")), {
2051
- id: `title-${e.props.id}-${++ht}`,
2048
+ id: `title-${e.props.id}-${++mt}`,
2052
2049
  type: "title",
2053
2050
  paragraphs: [],
2054
2051
  height: e.props.rect?.height || 40,
@@ -2056,11 +2053,11 @@ function mt(e) {
2056
2053
  keepNext: e.props.keepNext ?? !1
2057
2054
  };
2058
2055
  }
2059
- var ht = 0;
2056
+ var mt = 0;
2060
2057
  //#endregion
2061
2058
  //#region src/utils/documentSerializer.ts
2062
- function gt(e, t, n = {}) {
2063
- let r = Xe(e, t), i = {
2059
+ function ht(e, t, n = {}) {
2060
+ let r = Ye(e, t), i = {
2064
2061
  info: {
2065
2062
  author: "",
2066
2063
  created: "",
@@ -2313,21 +2310,21 @@ function gt(e, t, n = {}) {
2313
2310
  }]
2314
2311
  }
2315
2312
  },
2316
- theme: Ne,
2317
- styles: Pe,
2313
+ theme: Me,
2314
+ styles: Ne,
2318
2315
  version: "1.3",
2319
2316
  mode: 1,
2320
2317
  lastUpdateTime: Date.now()
2321
2318
  };
2322
- return n.pages && n.pages.length > 0 && (i._pages = et(n.pages, n.blocks || [], t.showScore)), JSON.stringify(i, null, 2);
2319
+ return n.pages && n.pages.length > 0 && (i._pages = $e(n.pages, n.blocks || [], t.showScore)), JSON.stringify(i, null, 2);
2323
2320
  }
2324
- function _t(e) {
2325
- return ft(e);
2321
+ function gt(e) {
2322
+ return dt(e);
2326
2323
  }
2327
2324
  //#endregion
2328
2325
  //#region src/utils/questionHtmlParser.ts
2329
- var vt = 0, yt = 0, bt = 0, xt = .5;
2330
- function St(e, t = {}) {
2326
+ var _t = 0, vt = 0, yt = 0, bt = .5;
2327
+ function xt(e, t = {}) {
2331
2328
  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([
2332
2329
  "p",
2333
2330
  "h1",
@@ -2346,7 +2343,7 @@ function St(e, t = {}) {
2346
2343
  if (t.nodeType !== Node.ELEMENT_NODE) continue;
2347
2344
  let n = t, r = n.tagName.toLowerCase();
2348
2345
  if (r === "table") {
2349
- let e = Mt(n, i, d), t = e.reduce((e, t) => e + t.lineHeight, 0) + 4;
2346
+ let e = jt(n, i, d), t = e.reduce((e, t) => e + t.lineHeight, 0) + 4;
2350
2347
  u.push({
2351
2348
  lines: e,
2352
2349
  y: 0,
@@ -2357,7 +2354,7 @@ function St(e, t = {}) {
2357
2354
  if (r === "figure") {
2358
2355
  let e = n.querySelector("table");
2359
2356
  if (e) {
2360
- let t = Mt(e, i, d), n = t.reduce((e, t) => e + t.lineHeight, 0) + 4;
2357
+ let t = jt(e, i, d), n = t.reduce((e, t) => e + t.lineHeight, 0) + 4;
2361
2358
  u.push({
2362
2359
  lines: t,
2363
2360
  y: 0,
@@ -2367,9 +2364,9 @@ function St(e, t = {}) {
2367
2364
  continue;
2368
2365
  }
2369
2366
  if (!p.has(r)) continue;
2370
- let o = n, s = o.getAttribute("style") || "", c = J(o, a, s, i, f);
2367
+ let o = n, s = o.getAttribute("style") || "", c = Y(o, a, s, i, f);
2371
2368
  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;
2369
+ let m = rt(c, i, d), h = m.reduce((e, t) => e + t.lineHeight, 0) + 4, g = wt(s), _ = g === "center" ? "center" : g === "right" ? "right" : void 0;
2373
2370
  u.push({
2374
2371
  lines: m,
2375
2372
  y: 0,
@@ -2391,7 +2388,7 @@ function St(e, t = {}) {
2391
2388
  y: 0,
2392
2389
  height: d + 4
2393
2390
  });
2394
- let m = u.reduce((e, t) => e + (t.height || 26), 0), h = `topic-html-${++yt}`;
2391
+ let m = u.reduce((e, t) => e + (t.height || 26), 0), h = `topic-html-${++vt}`;
2395
2392
  return [{
2396
2393
  id: `q-html-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
2397
2394
  type: "question",
@@ -2407,7 +2404,7 @@ function St(e, t = {}) {
2407
2404
  }
2408
2405
  }];
2409
2406
  }
2410
- function J(e, t, n, r, i) {
2407
+ function Y(e, t, n, r, i) {
2411
2408
  let a = [];
2412
2409
  for (let o = 0; o < e.childNodes.length; o++) {
2413
2410
  let s = e.childNodes[o];
@@ -2417,13 +2414,13 @@ function J(e, t, n, r, i) {
2417
2414
  let r = e.replace(/\u00A0/g, " ").replace(/\n/g, "").replace(/\s+/g, " ");
2418
2415
  if (!r.trim()) {
2419
2416
  if (a.length > 0) {
2420
- let e = Et(n) || t, r = Dt(n) || "\"Times New Roman\", SimSun", i = Ot(n) || "#000", o = /font-style:\s*(italic|oblique)/.test(n);
2421
- a.push(wt("\xA0", e, r, !1, i, o));
2417
+ let e = Tt(n) || t, r = Et(n) || "\"Times New Roman\", SimSun", i = Dt(n) || "#000", o = /font-style:\s*(italic|oblique)/.test(n);
2418
+ a.push(Ct("\xA0", e, r, !1, i, o));
2422
2419
  }
2423
2420
  continue;
2424
2421
  }
2425
- let i = r.startsWith(" ") && a.length > 0, o = r.endsWith(" "), c = r.trim(), l = (i ? "\xA0" : "") + c + (o ? "\xA0" : ""), u = Et(n) || t, d = Dt(n) || "\"Times New Roman\", SimSun", f = Ot(n) || "#000", p = /font-weight:\s*(bold|700|[89]\d\d)/.test(n), m = /font-style:\s*(italic|oblique)/.test(n);
2426
- a.push(wt(l, u, d, p, f, m));
2422
+ let i = r.startsWith(" ") && a.length > 0, o = r.endsWith(" "), c = r.trim(), l = (i ? "\xA0" : "") + c + (o ? "\xA0" : ""), u = Tt(n) || t, d = Et(n) || "\"Times New Roman\", SimSun", f = Dt(n) || "#000", p = /font-weight:\s*(bold|700|[89]\d\d)/.test(n), m = /font-style:\s*(italic|oblique)/.test(n);
2423
+ a.push(Ct(l, u, d, p, f, m));
2427
2424
  continue;
2428
2425
  }
2429
2426
  if (s.nodeType !== Node.ELEMENT_NODE) continue;
@@ -2432,11 +2429,11 @@ function J(e, t, n, r, i) {
2432
2429
  let e = c.getAttribute("data-latex") || "", t = e, n, r;
2433
2430
  if (e) {
2434
2431
  let n = e.replace(/\\style\{[^}]*\}\{/, "{").replace(/^\\style\{[^}]*\}/, "") || e;
2435
- t = n, r = G(n);
2432
+ t = n, r = K(n);
2436
2433
  } else {
2437
2434
  let e = c.getAttribute("data-mathml") || "";
2438
2435
  if (e) {
2439
- r = je(e), t = "";
2436
+ r = Ae(e), t = "";
2440
2437
  try {
2441
2438
  n = decodeURIComponent(e);
2442
2439
  } catch {
@@ -2464,14 +2461,14 @@ function J(e, t, n, r, i) {
2464
2461
  }
2465
2462
  a.push({
2466
2463
  type: "image",
2467
- id: `inline-img-${++bt}`,
2464
+ id: `inline-img-${++yt}`,
2468
2465
  src: e,
2469
2466
  width: l,
2470
2467
  height: d
2471
2468
  });
2472
2469
  continue;
2473
2470
  }
2474
- let f = Ct(d);
2471
+ let f = St(d);
2475
2472
  if (l === "span" && f) {
2476
2473
  let e = c.textContent || "", { blankType: t, isEmpty: n } = f, r;
2477
2474
  if (t === "tiankong") {
@@ -2480,7 +2477,7 @@ function J(e, t, n, r, i) {
2480
2477
  } else r = Math.max(40, e.length * 14 + 10);
2481
2478
  a.push({
2482
2479
  type: "underline",
2483
- id: `ul-html-${++vt}`,
2480
+ id: `ul-html-${++_t}`,
2484
2481
  width: r,
2485
2482
  height: 20,
2486
2483
  placeholder: t === "tiankong" ? "空" : t === "xuanze" ? "选" : "判",
@@ -2494,7 +2491,7 @@ function J(e, t, n, r, i) {
2494
2491
  if (l === "span" && d.includes("under-point")) {
2495
2492
  let e = c.textContent || "";
2496
2493
  if (e.trim()) {
2497
- let r = Et(u) || Et(n) || t, i = Dt(u) || Dt(n) || "\"Times New Roman\", SimSun", o = Ot(u) || Ot(n) || "#000", s = /font-style:\s*(italic|oblique)/.test(u) || /font-style:\s*(italic|oblique)/.test(n), c = wt(e.trim(), r, i, !1, o, s);
2494
+ let r = Tt(u) || Tt(n) || t, i = Et(u) || Et(n) || "\"Times New Roman\", SimSun", o = Dt(u) || Dt(n) || "#000", s = /font-style:\s*(italic|oblique)/.test(u) || /font-style:\s*(italic|oblique)/.test(n), c = Ct(e.trim(), r, i, !1, o, s);
2498
2495
  c.dotAbove = !0, a.push(c);
2499
2496
  }
2500
2497
  continue;
@@ -2502,7 +2499,7 @@ function J(e, t, n, r, i) {
2502
2499
  if (l === "span" && d.includes("wavy-line")) {
2503
2500
  let e = c.textContent || "";
2504
2501
  if (e.trim()) {
2505
- let r = Et(u) || Et(n) || t, i = Dt(u) || Dt(n) || "\"Times New Roman\", SimSun", o = Ot(u) || Ot(n) || "#000", s = /font-style:\s*(italic|oblique)/.test(u) || /font-style:\s*(italic|oblique)/.test(n), c = wt(e.trim(), r, i, !1, o, s);
2502
+ let r = Tt(u) || Tt(n) || t, i = Et(u) || Et(n) || "\"Times New Roman\", SimSun", o = Dt(u) || Dt(n) || "#000", s = /font-style:\s*(italic|oblique)/.test(u) || /font-style:\s*(italic|oblique)/.test(n), c = Ct(e.trim(), r, i, !1, o, s);
2506
2503
  c.wavyLine = !0, a.push(c);
2507
2504
  }
2508
2505
  continue;
@@ -2517,23 +2514,23 @@ function J(e, t, n, r, i) {
2517
2514
  continue;
2518
2515
  }
2519
2516
  if (l === "strong" || l === "b") {
2520
- let e = J(c, t, u ? u + ";font-weight:bold" : "font-weight:bold", r, i);
2517
+ let e = Y(c, t, u ? u + ";font-weight:bold" : "font-weight:bold", r, i);
2521
2518
  a.push(...e);
2522
2519
  continue;
2523
2520
  }
2524
2521
  if (l === "em" || l === "i") {
2525
- let e = J(c, t, u ? u + ";font-style:italic" : "font-style:italic", r, i);
2522
+ let e = Y(c, t, u ? u + ";font-style:italic" : "font-style:italic", r, i);
2526
2523
  a.push(...e);
2527
2524
  continue;
2528
2525
  }
2529
2526
  if (l === "u" || l === "ins") {
2530
- let e = J(c, t, u || n, r, i);
2527
+ let e = Y(c, t, u || n, r, i);
2531
2528
  for (let t of e) t.type === "text" && (t.underline = !0);
2532
2529
  a.push(...e);
2533
2530
  continue;
2534
2531
  }
2535
2532
  if (l === "s" || l === "strike" || l === "del") {
2536
- let e = J(c, t, u || n, r, i);
2533
+ let e = Y(c, t, u || n, r, i);
2537
2534
  for (let t of e) t.type === "text" && (t.strikethrough = !0);
2538
2535
  a.push(...e);
2539
2536
  continue;
@@ -2542,7 +2539,7 @@ function J(e, t, n, r, i) {
2542
2539
  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
2540
  a.push({
2544
2541
  type: "image",
2545
- id: `inline-img-${++bt}`,
2542
+ id: `inline-img-${++yt}`,
2546
2543
  src: "",
2547
2544
  width: Math.min(s, r),
2548
2545
  height: o,
@@ -2556,20 +2553,20 @@ function J(e, t, n, r, i) {
2556
2553
  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
2554
  a.push({
2558
2555
  type: "image",
2559
- id: `inline-img-${++bt}`,
2556
+ id: `inline-img-${++yt}`,
2560
2557
  src: "",
2561
2558
  width: Math.min(l, r),
2562
2559
  height: c,
2563
2560
  rawHtml: t
2564
2561
  });
2565
2562
  } else {
2566
- let e = J(c, t, u || n, r, i);
2563
+ let e = Y(c, t, u || n, r, i);
2567
2564
  a.push(...e);
2568
2565
  }
2569
2566
  continue;
2570
2567
  }
2571
2568
  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);
2569
+ 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
2570
  for (let e of o) e.type === "text" && (e.verticalAlign = s);
2574
2571
  a.push(...o);
2575
2572
  continue;
@@ -2577,7 +2574,7 @@ function J(e, t, n, r, i) {
2577
2574
  if (l === "span" || l === "a" || l === "div" || l === "font") {
2578
2575
  let e = u || n, o = /font-weight:\s*(bold|700|[89]\d\d)/.test(u), s = /font-style:\s*(italic|oblique)/.test(u);
2579
2576
  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*([^;]+)/);
2577
+ let l = Y(c, t, e, r, i), d = u.match(/text-decoration:\s*([^;]+)/);
2581
2578
  if (d) {
2582
2579
  let e = d[1];
2583
2580
  for (let t of l) if (t.type === "text") {
@@ -2587,18 +2584,18 @@ function J(e, t, n, r, i) {
2587
2584
  }
2588
2585
  let f = u.match(/background-color:\s*([^;]+)/);
2589
2586
  if (f && f[1] && f[1] !== "transparent") {
2590
- let e = jt(f[1]);
2587
+ let e = At(f[1]);
2591
2588
  if (e) for (let t of l) t.type === "text" && (t.backgroundColor = e);
2592
2589
  }
2593
2590
  a.push(...l);
2594
2591
  continue;
2595
2592
  }
2596
- let p = J(c, t, u || n, r, i);
2593
+ let p = Y(c, t, u || n, r, i);
2597
2594
  a.push(...p);
2598
2595
  }
2599
2596
  return a;
2600
2597
  }
2601
- function Ct(e) {
2598
+ function St(e) {
2602
2599
  return e.includes("blank-tiankong") || e.includes("blank_tiankong") ? {
2603
2600
  blankType: "tiankong",
2604
2601
  isEmpty: !0
@@ -2610,8 +2607,8 @@ function Ct(e) {
2610
2607
  isEmpty: !1
2611
2608
  } : null;
2612
2609
  }
2613
- function wt(e, t, n, r, i, a) {
2614
- 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;
2610
+ function Ct(e, t, n, r, i, a) {
2611
+ let o = e.split(""), s = V(e, t, n, r, a || !1), c = s.length > 0 ? s[s.length - 1] + B(o[o.length - 1], t, n, r, a || !1) : 0;
2615
2612
  return {
2616
2613
  type: "text",
2617
2614
  value: e,
@@ -2625,19 +2622,19 @@ function wt(e, t, n, r, i, a) {
2625
2622
  xPositions: s
2626
2623
  };
2627
2624
  }
2628
- function Tt(e) {
2625
+ function wt(e) {
2629
2626
  let t = e.match(/text-align:\s*(right|center|left)/);
2630
2627
  return t ? t[1] : "left";
2631
2628
  }
2632
- function Et(e) {
2629
+ function Tt(e) {
2633
2630
  let t = e.match(/font-size:\s*(\d+)px/);
2634
2631
  return t ? parseInt(t[1]) : null;
2635
2632
  }
2636
- function Dt(e) {
2633
+ function Et(e) {
2637
2634
  let t = e.match(/font-family:\s*([^;]+)/);
2638
2635
  return t ? t[1].trim().replace(/["']/g, "") : null;
2639
2636
  }
2640
- function Ot(e) {
2637
+ function Dt(e) {
2641
2638
  let t = e.match(/color:\s*rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);
2642
2639
  if (t) return `#${parseInt(t[1]).toString(16).padStart(2, "0")}${parseInt(t[2]).toString(16).padStart(2, "0")}${parseInt(t[3]).toString(16).padStart(2, "0")}`;
2643
2640
  let n = e.match(/color:\s*rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,[^)]+\)/);
@@ -2645,9 +2642,9 @@ function Ot(e) {
2645
2642
  let r = e.match(/color:\s*(#[0-9a-fA-F]{3,6})/);
2646
2643
  if (r) return r[1];
2647
2644
  let i = e.match(/color:\s*([a-zA-Z]+)/);
2648
- return i && At(i[1]) || null;
2645
+ return i && kt(i[1]) || null;
2649
2646
  }
2650
- var kt = {
2647
+ var Ot = {
2651
2648
  red: "#ff0000",
2652
2649
  green: "#008000",
2653
2650
  blue: "#0000ff",
@@ -2674,24 +2671,24 @@ var kt = {
2674
2671
  lightgrey: "#d3d3d3",
2675
2672
  transparent: "#000000"
2676
2673
  };
2677
- function At(e) {
2678
- return kt[e.toLowerCase()];
2674
+ function kt(e) {
2675
+ return Ot[e.toLowerCase()];
2679
2676
  }
2680
- function jt(e) {
2677
+ function At(e) {
2681
2678
  let t = e.trim(), n = t.match(/^#[0-9a-fA-F]{3,6}$/);
2682
2679
  if (n) return n[0];
2683
2680
  let r = t.match(/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);
2684
- return r ? `#${parseInt(r[1]).toString(16).padStart(2, "0")}${parseInt(r[2]).toString(16).padStart(2, "0")}${parseInt(r[3]).toString(16).padStart(2, "0")}` : At(t) || null;
2681
+ return r ? `#${parseInt(r[1]).toString(16).padStart(2, "0")}${parseInt(r[2]).toString(16).padStart(2, "0")}${parseInt(r[3]).toString(16).padStart(2, "0")}` : kt(t) || null;
2685
2682
  }
2686
- function Mt(e, t, n) {
2683
+ function jt(e, t, n) {
2687
2684
  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
2685
  return u <= 0 || d <= 0 ? [{
2689
- ...rt([], n),
2686
+ ...nt([], n),
2690
2687
  availableWidth: t
2691
2688
  }] : [{
2692
- ...rt([{
2689
+ ...nt([{
2693
2690
  type: "image",
2694
- id: `inline-img-${++bt}`,
2691
+ id: `inline-img-${++yt}`,
2695
2692
  src: "",
2696
2693
  width: u,
2697
2694
  height: d,
@@ -2702,8 +2699,8 @@ function Mt(e, t, n) {
2702
2699
  }
2703
2700
  //#endregion
2704
2701
  //#region src/utils/questionJsonParser.ts
2705
- 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, {
2702
+ function Mt(e, t = {}) {
2703
+ 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 = xt(e.question, {
2707
2704
  questionNo: n,
2708
2705
  score: r,
2709
2706
  contentWidth: i,
@@ -2730,14 +2727,14 @@ function Nt(e, t = {}) {
2730
2727
  tags: e.tags
2731
2728
  }
2732
2729
  };
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));
2730
+ if (l && e.extra_json?.options && e.extra_json.options.length > 0) p.options = Nt(e.extra_json.options, i, a, o), p.paragraphs.push(Pt(u));
2731
+ else for (let e = 0; e < 2; e++) p.paragraphs.push(Pt(u));
2735
2732
  return p.height = p.paragraphs.reduce((e, t) => e + (t.height || 26), 0), [p];
2736
2733
  }
2737
- function Pt(e, t, n, r) {
2734
+ function Nt(e, t, n, r) {
2738
2735
  let i = Math.max(100, t - 20);
2739
2736
  return e.map((e) => {
2740
- let t = St(e.content, {
2737
+ let t = xt(e.content, {
2741
2738
  contentWidth: i,
2742
2739
  fontSize: n,
2743
2740
  lineSpacing: r,
@@ -2763,7 +2760,7 @@ function Pt(e, t, n, r) {
2763
2760
  };
2764
2761
  });
2765
2762
  }
2766
- function Ft(e) {
2763
+ function Pt(e) {
2767
2764
  return {
2768
2765
  lines: [{
2769
2766
  elements: [{
@@ -2781,7 +2778,7 @@ function Ft(e) {
2781
2778
  }
2782
2779
  //#endregion
2783
2780
  //#region src/utils/chineseNumber.ts
2784
- var It = [
2781
+ var Ft = [
2785
2782
  "",
2786
2783
  "一",
2787
2784
  "二",
@@ -2794,35 +2791,35 @@ var It = [
2794
2791
  "九",
2795
2792
  "十"
2796
2793
  ];
2797
- function Lt(e) {
2794
+ function It(e) {
2798
2795
  if (e <= 0) return "";
2799
- if (e <= 10) return It[e];
2796
+ if (e <= 10) return Ft[e];
2800
2797
  if (e < 20) {
2801
2798
  let t = e % 10;
2802
- return "十" + (t > 0 ? It[t] : "");
2799
+ return "十" + (t > 0 ? Ft[t] : "");
2803
2800
  }
2804
2801
  if (e < 100) {
2805
2802
  let t = Math.floor(e / 10), n = e % 10;
2806
- return It[t] + "十" + (n > 0 ? It[n] : "");
2803
+ return Ft[t] + "十" + (n > 0 ? Ft[n] : "");
2807
2804
  }
2808
2805
  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);
2806
+ let t = Math.floor(e / 100), n = e % 100, r = Ft[t] + "百";
2807
+ return n === 0 ? r : n < 10 ? r + "零" + Ft[n] : r + It(n);
2811
2808
  }
2812
2809
  return String(e);
2813
2810
  }
2814
- function Rt(e, t) {
2815
- let n = Lt(t);
2811
+ function Lt(e, t) {
2812
+ let n = It(t);
2816
2813
  return n ? n + "、" + e : e;
2817
2814
  }
2818
- function zt(e) {
2815
+ function Rt(e) {
2819
2816
  let t = e.match(/^[一二三四五六七八九十百零]+、(.+)$/);
2820
2817
  return t ? t[1] : e;
2821
2818
  }
2822
2819
  //#endregion
2823
2820
  //#region src/utils/paperHtmlBuilder.ts
2824
- function Bt(e) {
2825
- let t = A[e];
2821
+ function zt(e) {
2822
+ let t = j[e];
2826
2823
  return `
2827
2824
  /* ---------- Reset & Base ---------- */
2828
2825
  *, *::before, *::after {
@@ -3142,7 +3139,7 @@ text.swed-question-score {
3142
3139
  }
3143
3140
  `;
3144
3141
  }
3145
- function Vt(e) {
3142
+ function Bt(e) {
3146
3143
  let { svgs: t, paperName: n = "试卷", paperSize: r = "A4" } = e, i = t.map((e) => {
3147
3144
  let t = e.match(/viewBox="0 0 (\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)"/), [, n, r] = t ? [
3148
3145
  null,
@@ -3162,24 +3159,24 @@ function Vt(e) {
3162
3159
  <head>
3163
3160
  <meta charset="UTF-8">
3164
3161
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
3165
- <title>${Ht(n)}</title>
3166
- <style>${Bt(r)}</style>
3162
+ <title>${Vt(n)}</title>
3163
+ <style>${zt(r)}</style>
3167
3164
  </head>
3168
3165
  <body>
3169
3166
  ${i}
3170
3167
  </body>
3171
3168
  </html>`;
3172
3169
  }
3173
- function Ht(e) {
3170
+ function Vt(e) {
3174
3171
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
3175
3172
  }
3176
3173
  //#endregion
3177
3174
  //#region ../node_modules/qrcode/lib/can-promise.js
3178
- var Ut = /* @__PURE__ */ D(((e, t) => {
3175
+ var Ht = /* @__PURE__ */ D(((e, t) => {
3179
3176
  t.exports = function() {
3180
3177
  return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
3181
3178
  };
3182
- })), Y = /* @__PURE__ */ D(((e) => {
3179
+ })), X = /* @__PURE__ */ D(((e) => {
3183
3180
  var t, n = [
3184
3181
  0,
3185
3182
  26,
@@ -3241,7 +3238,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3241
3238
  }, e.toSJIS = function(e) {
3242
3239
  return t(e);
3243
3240
  };
3244
- })), Wt = /* @__PURE__ */ D(((e) => {
3241
+ })), Ut = /* @__PURE__ */ D(((e) => {
3245
3242
  e.L = { bit: 1 }, e.M = { bit: 0 }, e.Q = { bit: 3 }, e.H = { bit: 2 };
3246
3243
  function t(t) {
3247
3244
  if (typeof t != "string") throw Error("Param is not a string");
@@ -3267,7 +3264,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3267
3264
  return r;
3268
3265
  }
3269
3266
  };
3270
- })), Gt = /* @__PURE__ */ D(((e, t) => {
3267
+ })), Wt = /* @__PURE__ */ D(((e, t) => {
3271
3268
  function n() {
3272
3269
  this.buffer = [], this.length = 0;
3273
3270
  }
@@ -3287,7 +3284,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3287
3284
  this.buffer.length <= t && this.buffer.push(0), e && (this.buffer[t] |= 128 >>> this.length % 8), this.length++;
3288
3285
  }
3289
3286
  }, t.exports = n;
3290
- })), Kt = /* @__PURE__ */ D(((e, t) => {
3287
+ })), Gt = /* @__PURE__ */ D(((e, t) => {
3291
3288
  function n(e) {
3292
3289
  if (!e || e < 1) throw Error("BitMatrix size must be defined and greater than 0");
3293
3290
  this.size = e, this.data = new Uint8Array(e * e), this.reservedBit = new Uint8Array(e * e);
@@ -3302,8 +3299,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3302
3299
  }, n.prototype.isReserved = function(e, t) {
3303
3300
  return this.reservedBit[e * this.size + t];
3304
3301
  }, t.exports = n;
3305
- })), qt = /* @__PURE__ */ D(((e) => {
3306
- var t = Y().getSymbolSize;
3302
+ })), Kt = /* @__PURE__ */ D(((e) => {
3303
+ var t = X().getSymbolSize;
3307
3304
  e.getRowColCoords = function(e) {
3308
3305
  if (e === 1) return [];
3309
3306
  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 +3311,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3314
3311
  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
3312
  return n;
3316
3313
  };
3317
- })), Jt = /* @__PURE__ */ D(((e) => {
3318
- var t = Y().getSymbolSize, n = 7;
3314
+ })), qt = /* @__PURE__ */ D(((e) => {
3315
+ var t = X().getSymbolSize, n = 7;
3319
3316
  e.getPositions = function(e) {
3320
3317
  let r = t(e);
3321
3318
  return [
@@ -3324,7 +3321,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3324
3321
  [0, r - n]
3325
3322
  ];
3326
3323
  };
3327
- })), Yt = /* @__PURE__ */ D(((e) => {
3324
+ })), Jt = /* @__PURE__ */ D(((e) => {
3328
3325
  e.Patterns = {
3329
3326
  PATTERN000: 0,
3330
3327
  PATTERN001: 1,
@@ -3400,8 +3397,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3400
3397
  }
3401
3398
  return i;
3402
3399
  };
3403
- })), Xt = /* @__PURE__ */ D(((e) => {
3404
- var t = Wt(), n = [
3400
+ })), Yt = /* @__PURE__ */ D(((e) => {
3401
+ var t = Ut(), n = [
3405
3402
  1,
3406
3403
  1,
3407
3404
  1,
@@ -3741,7 +3738,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3741
3738
  default: return;
3742
3739
  }
3743
3740
  };
3744
- })), Zt = /* @__PURE__ */ D(((e) => {
3741
+ })), Xt = /* @__PURE__ */ D(((e) => {
3745
3742
  var t = new Uint8Array(512), n = new Uint8Array(256);
3746
3743
  (function() {
3747
3744
  let e = 1;
@@ -3755,8 +3752,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3755
3752
  }, e.mul = function(e, r) {
3756
3753
  return e === 0 || r === 0 ? 0 : t[n[e] + n[r]];
3757
3754
  };
3758
- })), Qt = /* @__PURE__ */ D(((e) => {
3759
- var t = Zt();
3755
+ })), Zt = /* @__PURE__ */ D(((e) => {
3756
+ var t = Xt();
3760
3757
  e.mul = function(e, n) {
3761
3758
  let r = new Uint8Array(e.length + n.length - 1);
3762
3759
  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 +3773,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3776
3773
  for (let i = 0; i < n; i++) r = e.mul(r, new Uint8Array([1, t.exp(i)]));
3777
3774
  return r;
3778
3775
  };
3779
- })), $t = /* @__PURE__ */ D(((e, t) => {
3780
- var n = Qt();
3776
+ })), Qt = /* @__PURE__ */ D(((e, t) => {
3777
+ var n = Zt();
3781
3778
  function r(e) {
3782
3779
  this.genPoly = void 0, this.degree = e, this.degree && this.initialize(this.degree);
3783
3780
  }
@@ -3794,11 +3791,11 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3794
3791
  }
3795
3792
  return r;
3796
3793
  }, t.exports = r;
3797
- })), en = /* @__PURE__ */ D(((e) => {
3794
+ })), $t = /* @__PURE__ */ D(((e) => {
3798
3795
  e.isValid = function(e) {
3799
3796
  return !isNaN(e) && e >= 1 && e <= 40;
3800
3797
  };
3801
- })), tn = /* @__PURE__ */ D(((e) => {
3798
+ })), en = /* @__PURE__ */ D(((e) => {
3802
3799
  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
3800
  r = r.replace(/u/g, "\\u");
3804
3801
  var i = "(?:(?![A-Z0-9 $%*+\\-./:]|" + r + ")(?:.|[\r\n]))+";
@@ -3811,8 +3808,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3811
3808
  }, e.testAlphanumeric = function(e) {
3812
3809
  return s.test(e);
3813
3810
  };
3814
- })), X = /* @__PURE__ */ D(((e) => {
3815
- var t = en(), n = tn();
3811
+ })), tn = /* @__PURE__ */ D(((e) => {
3812
+ var t = $t(), n = en();
3816
3813
  e.NUMERIC = {
3817
3814
  id: "Numeric",
3818
3815
  bit: 1,
@@ -3876,7 +3873,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3876
3873
  }
3877
3874
  };
3878
3875
  })), nn = /* @__PURE__ */ D(((e) => {
3879
- var t = Y(), n = Xt(), r = Wt(), i = X(), a = en(), o = 7973, s = t.getBCHDigit(o);
3876
+ var t = X(), n = Yt(), r = Ut(), i = tn(), a = $t(), o = 7973, s = t.getBCHDigit(o);
3880
3877
  function c(t, n, r) {
3881
3878
  for (let i = 1; i <= 40; i++) if (n <= e.getCapacity(i, r, t)) return i;
3882
3879
  }
@@ -3923,14 +3920,14 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3923
3920
  return e << 12 | n;
3924
3921
  };
3925
3922
  })), rn = /* @__PURE__ */ D(((e) => {
3926
- var t = Y(), n = 1335, r = 21522, i = t.getBCHDigit(n);
3923
+ var t = X(), n = 1335, r = 21522, i = t.getBCHDigit(n);
3927
3924
  e.getEncodedBits = function(e, a) {
3928
3925
  let o = e.bit << 3 | a, s = o << 10;
3929
3926
  for (; t.getBCHDigit(s) - i >= 0;) s ^= n << t.getBCHDigit(s) - i;
3930
3927
  return (o << 10 | s) ^ r;
3931
3928
  };
3932
3929
  })), an = /* @__PURE__ */ D(((e, t) => {
3933
- var n = X();
3930
+ var n = tn();
3934
3931
  function r(e) {
3935
3932
  this.mode = n.NUMERIC, this.data = e.toString();
3936
3933
  }
@@ -3947,7 +3944,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3947
3944
  i > 0 && (n = this.data.substr(t), r = parseInt(n, 10), e.put(r, i * 3 + 1));
3948
3945
  }, t.exports = r;
3949
3946
  })), on = /* @__PURE__ */ D(((e, t) => {
3950
- var n = X(), r = /* @__PURE__ */ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");
3947
+ var n = tn(), r = /* @__PURE__ */ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");
3951
3948
  function i(e) {
3952
3949
  this.mode = n.ALPHANUMERIC, this.data = e;
3953
3950
  }
@@ -3966,7 +3963,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3966
3963
  this.data.length % 2 && e.put(r.indexOf(this.data[t]), 6);
3967
3964
  }, t.exports = i;
3968
3965
  })), sn = /* @__PURE__ */ D(((e, t) => {
3969
- var n = X();
3966
+ var n = tn();
3970
3967
  function r(e) {
3971
3968
  this.mode = n.BYTE, typeof e == "string" ? this.data = new TextEncoder().encode(e) : this.data = new Uint8Array(e);
3972
3969
  }
@@ -3980,7 +3977,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
3980
3977
  for (let t = 0, n = this.data.length; t < n; t++) e.put(this.data[t], 8);
3981
3978
  }, t.exports = r;
3982
3979
  })), cn = /* @__PURE__ */ D(((e, t) => {
3983
- var n = X(), r = Y();
3980
+ var n = tn(), r = X();
3984
3981
  function i(e) {
3985
3982
  this.mode = n.KANJI, this.data = e;
3986
3983
  }
@@ -4054,7 +4051,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
4054
4051
  };
4055
4052
  t !== void 0 && (t.exports = n);
4056
4053
  })), un = /* @__PURE__ */ D(((e) => {
4057
- var t = X(), n = an(), r = on(), i = sn(), a = cn(), o = tn(), s = Y(), c = ln();
4054
+ var t = tn(), n = an(), r = on(), i = sn(), a = cn(), o = en(), s = X(), c = ln();
4058
4055
  function l(e) {
4059
4056
  return unescape(encodeURIComponent(e)).length;
4060
4057
  }
@@ -4182,7 +4179,7 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
4182
4179
  return e.fromArray(d(t, s.isKanjiModeEnabled()));
4183
4180
  };
4184
4181
  })), 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();
4182
+ var t = X(), n = Ut(), r = Wt(), i = Gt(), a = Kt(), o = qt(), s = Jt(), c = Yt(), l = Qt(), u = nn(), d = rn(), f = tn(), p = un();
4186
4183
  function m(e, t) {
4187
4184
  let n = e.size, r = o.getPositions(t);
4188
4185
  for (let t = 0; t < r.length; t++) {
@@ -4369,8 +4366,8 @@ var Ut = /* @__PURE__ */ D(((e, t) => {
4369
4366
  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
4367
  return typeof a == "function" && a(null, p), p;
4371
4368
  };
4372
- })), hn = /* @__PURE__ */ O((/* @__PURE__ */ D(((e) => {
4373
- var t = Ut(), n = dn(), r = pn(), i = mn();
4369
+ })), hn = /* @__PURE__ */ k((/* @__PURE__ */ D(((e) => {
4370
+ var t = Ht(), n = dn(), r = pn(), i = mn();
4374
4371
  function a(e, r, i, a, o) {
4375
4372
  let s = [].slice.call(arguments, 1), c = s.length, l = typeof s[c - 1] == "function";
4376
4373
  if (!l && !t()) throw Error("Callback required as last argument");
@@ -4523,7 +4520,7 @@ function $(e, t) {
4523
4520
  };
4524
4521
  }
4525
4522
  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)];
4523
+ let a = xn(t, n), o = r && r > 0 ? rt(e, r, a, i) : [nt(e, a)];
4527
4524
  return {
4528
4525
  lines: o,
4529
4526
  y: 0,
@@ -4581,7 +4578,7 @@ function kn(e, t) {
4581
4578
  let n = [], r = On(e);
4582
4579
  for (let e of r) if (e.type === "text") n.push(An(e.value, t, !1, "\"Times New Roman\", SimSun,'Cambria Math'", "#000"));
4583
4580
  else if (e.type === "formula") {
4584
- let { svg: t, width: r, height: i } = G(e.value);
4581
+ let { svg: t, width: r, height: i } = K(e.value);
4585
4582
  n.push({
4586
4583
  type: "formula",
4587
4584
  width: r,
@@ -4601,7 +4598,7 @@ function kn(e, t) {
4601
4598
  return n;
4602
4599
  }
4603
4600
  function An(e, t, n, r, i) {
4604
- let a = e.split(""), o = B(e, t, r);
4601
+ let a = e.split(""), o = V(e, t, r);
4605
4602
  return {
4606
4603
  type: "text",
4607
4604
  value: e,
@@ -4610,7 +4607,7 @@ function An(e, t, n, r, i) {
4610
4607
  bold: n,
4611
4608
  italic: !1,
4612
4609
  color: i,
4613
- width: o.length > 0 ? o[o.length - 1] + z(a[a.length - 1], t, r) : 0,
4610
+ width: o.length > 0 ? o[o.length - 1] + B(a[a.length - 1], t, r) : 0,
4614
4611
  height: t * 1.4,
4615
4612
  xPositions: o
4616
4613
  };
@@ -4727,7 +4724,7 @@ function Fn(e) {
4727
4724
  let l;
4728
4725
  if (a) l = Sn(c, e, r, n > 0 ? n : void 0, 0);
4729
4726
  else {
4730
- let i = t.metadata?.score || "", o = i ? se(`(${i}分)`, e, "SimSun, STSong, serif") : 0;
4727
+ let i = t.metadata?.score || "", o = i ? oe(`(${i}分)`, e, "SimSun, STSong, serif") : 0;
4731
4728
  l = Sn(c, e, r, n > 0 ? n : void 0, o), a = !0;
4732
4729
  }
4733
4730
  t.paragraphs[o].justification && (l.justification = t.paragraphs[o].justification), i.push(l);
@@ -4755,7 +4752,7 @@ function Fn(e) {
4755
4752
  }), i.value = !0, h());
4756
4753
  }
4757
4754
  function _(e) {
4758
- t.value = [...t.value, e], M(), i.value = !0, h();
4755
+ t.value = [...t.value, e], N(), i.value = !0, h();
4759
4756
  }
4760
4757
  function v(e, n) {
4761
4758
  let r = {
@@ -4777,14 +4774,14 @@ function Fn(e) {
4777
4774
  ...t.value.slice(e)
4778
4775
  ] : t.value = [...t.value, r];
4779
4776
  } else t.value = [...t.value, r];
4780
- i.value = !0, M(), h();
4777
+ i.value = !0, N(), h();
4781
4778
  }
4782
4779
  function y(e) {
4783
4780
  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());
4781
+ r.length === t.value.length && (t.value = r, N(), i.value = !0, h());
4785
4782
  }
4786
4783
  function b(e) {
4787
- t.value = t.value.filter((t) => t.id !== e), f.value === e && (f.value = null), M(), i.value = !0, h();
4784
+ t.value = t.value.filter((t) => t.id !== e), f.value === e && (f.value = null), N(), i.value = !0, h();
4788
4785
  }
4789
4786
  function x(e, n) {
4790
4787
  let r = t.value.find((t) => t.id === e);
@@ -4859,14 +4856,14 @@ function Fn(e) {
4859
4856
  }
4860
4857
  } : e), i.value = !0, h();
4861
4858
  }
4862
- function ee(e, n) {
4859
+ function O(e, n) {
4863
4860
  let r = t.value.findIndex((t) => t.id === e);
4864
4861
  r !== -1 && (t.value = t.value.map((e, t) => t === r ? {
4865
4862
  ...e,
4866
4863
  questionType: n
4867
4864
  } : e), i.value = !0);
4868
4865
  }
4869
- function O(e, n) {
4866
+ function k(e, n) {
4870
4867
  let r = t.value.findIndex((t) => t.id === e);
4871
4868
  r !== -1 && (t.value = t.value.map((e, t) => {
4872
4869
  if (t !== r) return e;
@@ -4880,14 +4877,14 @@ function Fn(e) {
4880
4877
  };
4881
4878
  }), i.value = !0, h());
4882
4879
  }
4883
- function k(e, n) {
4880
+ function A(e, n) {
4884
4881
  let r = t.value.findIndex((t) => t.id === e);
4885
4882
  r !== -1 && (t.value = t.value.map((e, t) => t === r ? {
4886
4883
  ...e,
4887
4884
  keepNext: n
4888
4885
  } : e), i.value = !0, h());
4889
4886
  }
4890
- function A(e, n) {
4887
+ function j(e, n) {
4891
4888
  let r = t.value.findIndex((t) => t.id === e);
4892
4889
  if (r === -1) {
4893
4890
  console.warn(`[usePaperCore] patchBlock: block ${e} not found`);
@@ -4908,7 +4905,7 @@ function Fn(e) {
4908
4905
  ...n
4909
4906
  } : e), i.value = !0;
4910
4907
  }
4911
- function j(e) {
4908
+ function M(e) {
4912
4909
  let n = /* @__PURE__ */ new Map();
4913
4910
  for (let t of e) {
4914
4911
  let e = n.get(t.id) || [];
@@ -4930,17 +4927,17 @@ function Fn(e) {
4930
4927
  };
4931
4928
  }), i.value = !0;
4932
4929
  }
4933
- function M() {
4930
+ function N() {
4934
4931
  let e = 0, n = 0, r = [];
4935
4932
  for (let i of t.value) if (i.type === "title") {
4936
4933
  e++;
4937
- let t = i.metadata?.title || zt(i.metadata?.label || "") || "题组";
4934
+ let t = i.metadata?.title || Rt(i.metadata?.label || "") || "题组";
4938
4935
  r.push({
4939
4936
  id: i.id,
4940
4937
  metadata: {
4941
4938
  title: t,
4942
4939
  ordinal: e,
4943
- label: Rt(t, e)
4940
+ label: Lt(t, e)
4944
4941
  }
4945
4942
  });
4946
4943
  } else if (i.type === "question") {
@@ -4954,12 +4951,12 @@ function Fn(e) {
4954
4951
  }
4955
4952
  });
4956
4953
  }
4957
- j(r);
4954
+ M(r);
4958
4955
  }
4959
- function N(e, t) {
4960
- A(e, { metadata: { title: t } }), M(), i.value = !0, h();
4956
+ function P(e, t) {
4957
+ j(e, { metadata: { title: t } }), N(), i.value = !0, h();
4961
4958
  }
4962
- function P(e, r = !1) {
4959
+ function F(e, r = !1) {
4963
4960
  let o = e.content.split("\n").filter((e) => e.trim());
4964
4961
  o.length === 0 && o.push("");
4965
4962
  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;
@@ -4969,10 +4966,10 @@ function Fn(e) {
4969
4966
  p = [jn(e.no, s, o, l, u, d - t, r)];
4970
4967
  }
4971
4968
  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();
4969
+ p.length > 0 && (f.value = p[p.length - 1].id), N(), i.value = !0, g();
4973
4970
  }
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, {
4971
+ function I(e, r, o, s = !1) {
4972
+ let c = Z(n.value), l = Q(n.value), u = a.value.columnWidth, d = (r?.length || 0) > 2 ? 26.25 : 17.5, p = xt(e, {
4976
4973
  questionNo: r || "",
4977
4974
  score: o || "",
4978
4975
  contentWidth: u - d,
@@ -4981,16 +4978,16 @@ function Fn(e) {
4981
4978
  protectContent: s
4982
4979
  });
4983
4980
  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();
4981
+ p.length > 0 && (f.value = p[p.length - 1].id), N(), i.value = !0, g();
4985
4982
  }
4986
- function te(e, r, o, s = !1) {
4983
+ function ee(e, r, o, s = !1) {
4987
4984
  let c = Z(n.value), l = Q(n.value), u = a.value.columnWidth, d = (r?.length || 0) > 2 ? 26.25 : 17.5, p;
4988
4985
  try {
4989
4986
  p = JSON.parse(e);
4990
4987
  } catch {
4991
4988
  throw Error("JSON 格式错误,请检查");
4992
4989
  }
4993
- let m = Nt(p, {
4990
+ let m = Mt(p, {
4994
4991
  questionNo: r || "",
4995
4992
  score: o || "",
4996
4993
  contentWidth: u - d,
@@ -4999,15 +4996,15 @@ function Fn(e) {
4999
4996
  protectContent: s
5000
4997
  });
5001
4998
  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();
4999
+ m.length > 0 && (f.value = m[m.length - 1].id), N(), i.value = !0, g();
5003
5000
  }
5004
- function ne(e, t, n) {
5001
+ function te(e, t, n) {
5005
5002
  let r = p(e);
5006
5003
  if (!r) return;
5007
5004
  let o = Dn(r.block, a.value.columnWidth), s = Math.max(20, Math.min(Math.round(t), Math.max(20, o)));
5008
5005
  r.image.width = s, n !== void 0 && (r.image.height = Math.max(12, Math.round(n))), i.value = !0, g();
5009
5006
  }
5010
- function I(e) {
5007
+ function L(e) {
5011
5008
  let t = p(e);
5012
5009
  if (!t) return null;
5013
5010
  let n = t.block.paragraphs[t.paraIdx];
@@ -5016,22 +5013,22 @@ function Fn(e) {
5016
5013
  alignment: n.justification || "left"
5017
5014
  };
5018
5015
  }
5019
- function L(e, t) {
5016
+ function R(e, t) {
5020
5017
  let n = p(e);
5021
5018
  if (!n) return;
5022
5019
  let r = n.block.paragraphs[n.paraIdx];
5023
5020
  r.justification = t === "left" ? void 0 : t, i.value = !0, h();
5024
5021
  }
5025
- function re(e, t) {
5022
+ function ne(e, t) {
5026
5023
  let n = Math.max(30, Math.min(500, Math.round(t))), r = m(e);
5027
5024
  r && (r.underline.width = n, g());
5028
5025
  }
5029
- function ie(e, t, r, i) {
5026
+ function re(e, t, r, i) {
5030
5027
  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
5028
  return l.length === 0 && l.push(""), l.map((e) => Sn(kn(e, o), o, s, c > 0 ? c : void 0));
5032
5029
  }
5033
- function ae() {
5034
- return gt(t.value, n.value, {
5030
+ function ie() {
5031
+ return ht(t.value, n.value, {
5035
5032
  paperName: s.value,
5036
5033
  schoolName: c.value,
5037
5034
  qrCodeContent: l.value,
@@ -5041,12 +5038,12 @@ function Fn(e) {
5041
5038
  blocks: t.value
5042
5039
  });
5043
5040
  }
5044
- function R(e, r) {
5045
- let o = _t(e);
5041
+ function z(e, r) {
5042
+ let o = gt(e);
5046
5043
  t.value = o.blocks, o.settings && typeof o.settings.fontSize == "string" && (o.settings.fontSize = yn(o.settings.fontSize)), n.value = {
5047
5044
  ...n.value,
5048
5045
  ...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;
5046
+ }, 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), N(), r ? h() : g(), i.value = !1;
5050
5047
  }
5051
5048
  return {
5052
5049
  reflowAllBlocks: g,
@@ -5061,33 +5058,33 @@ function Fn(e) {
5061
5058
  updateShowScore: T,
5062
5059
  updateBlockQid: E,
5063
5060
  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,
5061
+ updateBlockQuestionType: O,
5062
+ updateBlockSplit: k,
5063
+ updateBlockKeepNext: A,
5064
+ patchBlock: j,
5065
+ patchBlocksMeta: M,
5066
+ recalculateNumbering: N,
5067
+ updateSectionTitle: P,
5068
+ addNewQuestion: F,
5069
+ addQuestionFromHtml: I,
5070
+ addQuestionFromJson: ee,
5071
+ updateInlineImageSize: te,
5072
+ getImageParagraphInfo: L,
5073
+ updateImageAlignment: R,
5074
+ updateUnderlineWidth: ne,
5075
+ parseTextToParagraphs: re,
5076
+ saveDocument: ie,
5077
+ loadDocument: z,
5081
5078
  getBlockPlainText: Nn,
5082
5079
  getBlockLabel: Pn,
5083
5080
  getBlockAvailableWidth: Dn
5084
5081
  };
5085
5082
  }
5086
- var In = z;
5083
+ var In = B;
5087
5084
  //#endregion
5088
5085
  //#region src/composables/usePaperCore.ts
5089
5086
  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(() => {
5087
+ let n = f(e.renderMode ?? "edit"), r = m(new ee()), 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
5088
  let e = 0, t = /* @__PURE__ */ new Set();
5092
5089
  for (let n of a.value) {
5093
5090
  let r = n.metadata?.score || "";
@@ -5101,121 +5098,124 @@ function Ln(e = {}) {
5101
5098
  a && (e += parseInt(a[1]));
5102
5099
  }
5103
5100
  return e;
5104
- }), _ = _n(a), y = Fn({
5101
+ }), y = _n(a), b = Fn({
5105
5102
  blocks: a,
5106
5103
  settings: s,
5107
5104
  pages: o,
5108
- isDirty: p,
5105
+ isDirty: h,
5109
5106
  layoutEngine: r,
5110
5107
  svgRenderer: i,
5111
5108
  paperName: c,
5112
5109
  schoolName: l,
5113
5110
  qrCodeContent: u,
5114
- qrCodeImage: d,
5115
- totalScore: g,
5116
- selectedBlockId: _.selectedBlockId,
5117
- findInlineImageById: _.findInlineImageById,
5118
- findUnderlineById: _.findUnderlineById,
5119
- relayout: x
5111
+ qrCodeImage: p,
5112
+ qrCodeImages: d,
5113
+ totalScore: _,
5114
+ selectedBlockId: y.selectedBlockId,
5115
+ findInlineImageById: y.findInlineImageById,
5116
+ findUnderlineById: y.findUnderlineById,
5117
+ relayout: S
5120
5118
  });
5121
- v(u, async (e) => {
5122
- if (!e || e.trim() === "") {
5123
- d.value = "";
5119
+ v([u, () => o.value.length], async ([e]) => {
5120
+ let t = o.value.length;
5121
+ if (!e || e.trim() === "" || t === 0) {
5122
+ d.value = [];
5124
5123
  return;
5125
5124
  }
5126
- d.value = await gn(e);
5125
+ d.value = await Promise.all(Array.from({ length: t }, (t, n) => gn(e + String(n))));
5127
5126
  }, { immediate: !0 });
5128
- function b(e) {
5127
+ function x(e) {
5129
5128
  n.value = e, i.value.setRenderMode(e);
5130
5129
  }
5131
- function x() {
5130
+ function S() {
5132
5131
  o.value = r.value.layout(a.value);
5133
5132
  for (let e = 0; e < o.value.length; e++) {
5134
5133
  let t = o.value[e], n = e % 2 == 0 ? s.value.bodyTopEven ?? 173 : s.value.bodyTopOdd ?? 50;
5135
5134
  t.renderedRegions = i.value.computePageRegions(t, a.value, n, s.value, o.value.length);
5136
5135
  }
5137
- h.value++;
5138
- }
5139
- function S(e) {
5140
- Object.assign(s.value, e), r.value.updateSettings(e), y.reflowAllBlocks();
5136
+ g.value++;
5141
5137
  }
5142
5138
  function C(e) {
5143
- S({ paperSize: e });
5139
+ Object.assign(s.value, e), r.value.updateSettings(e), b.reflowAllBlocks();
5144
5140
  }
5145
5141
  function w(e) {
5146
- S({ columns: e });
5142
+ C({ paperSize: e });
5147
5143
  }
5148
5144
  function T(e) {
5149
- S({ fontSize: e });
5145
+ C({ columns: e });
5150
5146
  }
5151
5147
  function E(e) {
5152
- S({ lineSpacing: e });
5148
+ C({ fontSize: e });
5153
5149
  }
5154
5150
  function D(e) {
5155
- return y.getBlockAvailableWidth(e, r.value.columnWidth);
5151
+ C({ lineSpacing: e });
5152
+ }
5153
+ function O(e) {
5154
+ return b.getBlockAvailableWidth(e, r.value.columnWidth);
5156
5155
  }
5157
5156
  return {
5158
5157
  renderMode: n,
5159
5158
  blocks: a,
5160
5159
  pages: o,
5161
5160
  settings: s,
5162
- selectedBlockId: _.selectedBlockId,
5163
- selectedUnderlineId: _.selectedUnderlineId,
5164
- selectedImageId: _.selectedImageId,
5165
- selectedBlock: _.selectedBlock,
5166
- selectedUnderlineInfo: _.selectedUnderlineInfo,
5167
- selectedImageInfo: _.selectedImageInfo,
5168
- totalScore: g,
5161
+ selectedBlockId: y.selectedBlockId,
5162
+ selectedUnderlineId: y.selectedUnderlineId,
5163
+ selectedImageId: y.selectedImageId,
5164
+ selectedBlock: y.selectedBlock,
5165
+ selectedUnderlineInfo: y.selectedUnderlineInfo,
5166
+ selectedImageInfo: y.selectedImageInfo,
5167
+ totalScore: _,
5169
5168
  paperName: c,
5170
5169
  schoolName: l,
5171
5170
  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,
5171
+ qrCodeImage: p,
5172
+ qrCodeImages: d,
5173
+ isDirty: h,
5174
+ layoutVersion: g,
5175
+ setRenderMode: x,
5176
+ relayout: S,
5177
+ reflowAllBlocks: b.reflowAllBlocks,
5178
+ updateSettings: C,
5179
+ setPaperSize: w,
5180
+ setColumns: T,
5181
+ setFontSize: E,
5182
+ setLineSpacing: D,
5183
+ selectBlock: y.selectBlock,
5184
+ selectUnderline: y.selectUnderline,
5185
+ selectImage: y.selectImage,
5186
+ findUnderlineById: y.findUnderlineById,
5187
+ findInlineImageById: y.findInlineImageById,
5188
+ updateUnderlineWidth: b.updateUnderlineWidth,
5189
+ updateInlineImageSize: b.updateInlineImageSize,
5190
+ getImageParagraphInfo: b.getImageParagraphInfo,
5191
+ updateImageAlignment: b.updateImageAlignment,
5192
+ addBlock: b.addBlock,
5193
+ addTitleBlock: b.addTitleBlock,
5194
+ reorderBlocks: b.reorderBlocks,
5195
+ updateBlockLabel: b.updateBlockLabel,
5196
+ removeBlock: b.removeBlock,
5197
+ updateBlockContent: b.updateBlockContent,
5198
+ updateBlockScore: b.updateBlockScore,
5199
+ toggleContentProtection: b.toggleContentProtection,
5200
+ updateShowScore: b.updateShowScore,
5201
+ updateBlockQid: b.updateBlockQid,
5202
+ updateBlockHeight: b.updateBlockHeight,
5203
+ updateBlockQuestionType: b.updateBlockQuestionType,
5204
+ updateBlockSplit: b.updateBlockSplit,
5205
+ updateBlockKeepNext: b.updateBlockKeepNext,
5206
+ addNewQuestion: b.addNewQuestion,
5207
+ addQuestionFromHtml: b.addQuestionFromHtml,
5208
+ addQuestionFromJson: b.addQuestionFromJson,
5209
+ getBlockPlainText: b.getBlockPlainText,
5210
+ parseTextToParagraphs: b.parseTextToParagraphs,
5211
+ getBlockLabel: b.getBlockLabel,
5212
+ getContentWidth: O,
5213
+ recalculateNumbering: b.recalculateNumbering,
5214
+ updateSectionTitle: b.updateSectionTitle,
5215
+ patchBlock: b.patchBlock,
5216
+ patchBlocksMeta: b.patchBlocksMeta,
5217
+ saveDocument: b.saveDocument,
5218
+ loadDocument: b.loadDocument,
5219
5219
  layoutEngine: r,
5220
5220
  svgRenderer: i
5221
5221
  };
@@ -5236,7 +5236,8 @@ function zn(e, n = {}) {
5236
5236
  totalScore: e.totalScore.value,
5237
5237
  paperName: e.paperName.value,
5238
5238
  schoolName: e.schoolName.value,
5239
- qrCodeImage: e.qrCodeImage.value
5239
+ qrCodeImage: e.qrCodeImage.value,
5240
+ qrCodeImages: e.qrCodeImages.value
5240
5241
  }, t.length);
5241
5242
  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>`;
5242
5243
  });
@@ -5370,7 +5371,7 @@ function Un(e, t, n, r) {
5370
5371
  }
5371
5372
  function d(e, t) {
5372
5373
  if (!e) return [];
5373
- let n = e.split(""), r = B(e, t.fontSize, t.fontFamily, t.bold, t.italic), i = r.length > 0 ? r[r.length - 1] + z(n[n.length - 1], t.fontSize, t.fontFamily, t.bold, t.italic) : 0;
5374
+ let n = e.split(""), r = V(e, t.fontSize, t.fontFamily, t.bold, t.italic), i = r.length > 0 ? r[r.length - 1] + B(n[n.length - 1], t.fontSize, t.fontFamily, t.bold, t.italic) : 0;
5374
5375
  return [{
5375
5376
  type: "text",
5376
5377
  value: e,
@@ -5429,7 +5430,7 @@ function Un(e, t, n, r) {
5429
5430
  else {
5430
5431
  let e = t - i, c = o.value.substring(0, e), l = o.value.substring(e);
5431
5432
  if (c) {
5432
- let e = B(c, o.fontSize, o.fontFamily, o.bold, o.italic), t = e.length > 0 ? e[e.length - 1] + z(c[c.length - 1], o.fontSize, o.fontFamily, o.bold, o.italic) : 0;
5433
+ let e = V(c, o.fontSize, o.fontFamily, o.bold, o.italic), t = e.length > 0 ? e[e.length - 1] + B(c[c.length - 1], o.fontSize, o.fontFamily, o.bold, o.italic) : 0;
5433
5434
  n.push({
5434
5435
  ...o,
5435
5436
  value: c,
@@ -5438,7 +5439,7 @@ function Un(e, t, n, r) {
5438
5439
  });
5439
5440
  }
5440
5441
  if (l) {
5441
- let e = B(l, o.fontSize, o.fontFamily, o.bold, o.italic), t = e.length > 0 ? e[e.length - 1] + z(l[l.length - 1], o.fontSize, o.fontFamily, o.bold, o.italic) : 0;
5442
+ let e = V(l, o.fontSize, o.fontFamily, o.bold, o.italic), t = e.length > 0 ? e[e.length - 1] + B(l[l.length - 1], o.fontSize, o.fontFamily, o.bold, o.italic) : 0;
5442
5443
  r.push({
5443
5444
  ...o,
5444
5445
  value: l,
@@ -5481,7 +5482,7 @@ function Un(e, t, n, r) {
5481
5482
  let e = r[a], n = e.value.substring(0, s) + e.value.substring(s + 1);
5482
5483
  for (let t = 0; t < r.length; t++) if (t === a) {
5483
5484
  if (n) {
5484
- let t = B(n, e.fontSize, e.fontFamily, e.bold, e.italic), r = t.length > 0 ? t[t.length - 1] + z(n[n.length - 1], e.fontSize, e.fontFamily, e.bold, e.italic) : 0;
5485
+ let t = V(n, e.fontSize, e.fontFamily, e.bold, e.italic), r = t.length > 0 ? t[t.length - 1] + B(n[n.length - 1], e.fontSize, e.fontFamily, e.bold, e.italic) : 0;
5485
5486
  c.push({
5486
5487
  ...e,
5487
5488
  value: n,
@@ -5519,7 +5520,7 @@ function Un(e, t, n, r) {
5519
5520
  let e = n[i], r = e.value.substring(0, o) + e.value.substring(o + 1), a = [];
5520
5521
  for (let t = 0; t < n.length; t++) if (t === i) {
5521
5522
  if (r) {
5522
- let t = B(r, e.fontSize, e.fontFamily, e.bold, e.italic), n = t.length > 0 ? t[t.length - 1] + z(r[r.length - 1], e.fontSize, e.fontFamily, e.bold, e.italic) : 0;
5523
+ let t = V(r, e.fontSize, e.fontFamily, e.bold, e.italic), n = t.length > 0 ? t[t.length - 1] + B(r[r.length - 1], e.fontSize, e.fontFamily, e.bold, e.italic) : 0;
5523
5524
  a.push({
5524
5525
  ...e,
5525
5526
  value: r,
@@ -5809,29 +5810,29 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5809
5810
  ],
5810
5811
  setup(a, { expose: m, emit: h }) {
5811
5812
  let x = a, S = h, C = Ln({ renderMode: x.renderMode }), w = Un(C.blocks, C.settings, () => {
5812
- C.reflowAllBlocks(), o(() => O.value?.focus());
5813
+ C.reflowAllBlocks(), o(() => k.value?.focus());
5813
5814
  }, () => {
5814
5815
  C.isDirty.value = !0;
5815
- }), T = f(1), E = f(0), D = f(!1), ee = f(null), O = f(null), k = f({
5816
+ }), T = f(1), E = f(0), D = f(!1), O = f(null), k = f(null), A = f({
5816
5817
  left: 0,
5817
5818
  top: 0
5818
- }), A = f({
5819
+ }), j = f({
5819
5820
  left: 0,
5820
5821
  top: 0,
5821
5822
  height: 21
5822
- }), j = t(() => ({
5823
- left: k.value.left + "px",
5824
- top: k.value.top + "px"
5825
- })), M = t(() => ({
5823
+ }), M = t(() => ({
5826
5824
  left: A.value.left + "px",
5827
- top: A.value.top + "px",
5828
- height: A.value.height + "px",
5825
+ top: A.value.top + "px"
5826
+ })), N = t(() => ({
5827
+ left: j.value.left + "px",
5828
+ top: j.value.top + "px",
5829
+ height: j.value.height + "px",
5829
5830
  transform: "skewX(0deg)"
5830
- })), N = zn(C, {
5831
+ })), P = zn(C, {
5831
5832
  zoom: T,
5832
5833
  selectedBlockId: null
5833
5834
  });
5834
- function P() {
5835
+ function F() {
5835
5836
  if (C.pages.value.length === 0) return [];
5836
5837
  let e = C.pages.value[0].width, t = C.pages.value[0].height;
5837
5838
  return C.svgRenderer.value.withRenderMode("view", () => C.pages.value.map((n, r) => {
@@ -5842,19 +5843,21 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5842
5843
  totalScore: C.totalScore.value,
5843
5844
  paperName: C.paperName.value,
5844
5845
  schoolName: C.schoolName.value,
5845
- qrCodeImage: C.qrCodeImage.value
5846
+ qrCodeImage: C.qrCodeImage.value,
5847
+ qrCodeImages: C.qrCodeImages.value
5846
5848
  }, C.pages.value.length)}</svg>`;
5847
5849
  }));
5848
5850
  }
5849
- let F = t(() => C.svgRenderer.value.renderAllPages(C.pages.value, C.blocks.value, C.settings.value, {
5851
+ let I = t(() => C.svgRenderer.value.renderAllPages(C.pages.value, C.blocks.value, C.settings.value, {
5850
5852
  totalScore: C.totalScore.value,
5851
5853
  paperName: C.paperName.value,
5852
- schoolName: C.schoolName.value
5854
+ schoolName: C.schoolName.value,
5855
+ qrCodeImages: C.qrCodeImages.value
5853
5856
  }));
5854
- function te() {
5855
- C.relayout(), E.value >= C.pages.value.length && (E.value = Math.max(0, C.pages.value.length - 1)), L();
5857
+ function ee() {
5858
+ C.relayout(), E.value >= C.pages.value.length && (E.value = Math.max(0, C.pages.value.length - 1)), R();
5856
5859
  }
5857
- let ne = new Set([
5860
+ let te = new Set([
5858
5861
  "header-desc",
5859
5862
  "paper-name",
5860
5863
  "qr-code",
@@ -5864,22 +5867,22 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5864
5867
  "score",
5865
5868
  "page-number"
5866
5869
  ]);
5867
- function I() {
5870
+ function L() {
5868
5871
  for (let e = 0; e < C.pages.value.length; e++) {
5869
5872
  let t = C.pages.value[e];
5870
- t.renderedRegions ||= [], t.renderedRegions = t.renderedRegions.filter((e) => !ne.has(e.type)), C.svgRenderer.value.measureRegionsFromDOM(e, t, t.renderedRegions);
5873
+ t.renderedRegions ||= [], t.renderedRegions = t.renderedRegions.filter((e) => !te.has(e.type)), C.svgRenderer.value.measureRegionsFromDOM(e, t, t.renderedRegions);
5871
5874
  }
5872
5875
  }
5873
- function L() {
5876
+ function R() {
5874
5877
  o(() => {
5875
5878
  o(() => {
5876
5879
  requestAnimationFrame(() => {
5877
- I();
5880
+ L();
5878
5881
  });
5879
5882
  });
5880
5883
  });
5881
5884
  }
5882
- function re(e, t, n, r) {
5885
+ function ne(e, t, n, r) {
5883
5886
  let i = C.blocks.value.find((t) => t.id === e);
5884
5887
  if (!i || !n) return;
5885
5888
  let a = n.getBoundingClientRect(), o = (t.clientX - a.left) / T.value, s = (t.clientY - a.top) / T.value, c = r ?? E.value, l = C.pages.value[c];
@@ -5910,7 +5913,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5910
5913
  y += t;
5911
5914
  }
5912
5915
  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;
5916
+ let x = i.paragraphs[b], S = 0, k = f.x + p, M = w.getTextStyle(x).fontSize, N = (x.lines[0]?.lineHeight || x.height || 21) * .5, P = f.y + y + N, F = M;
5914
5917
  if (!w.isEmptyParagraph(x)) {
5915
5918
  let e = o - m - f.x - p, t = h - y, n = 0, r = -1;
5916
5919
  for (let e = 0; e < x.lines.length; e++) {
@@ -5927,7 +5930,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5927
5930
  let s = x.lines[r], c = s.offsetX || 0, l = 0;
5928
5931
  if (f.paragraphStart === 0 && i.metadata?.score && r === 0 && b === (v[0] ?? 0)) {
5929
5932
  let e = C.settings.value.fontSize, t = typeof e == "number" ? e : 14;
5930
- l = se(`(${i.metadata.score}分)`, t, "SimSun, STSong, serif");
5933
+ l = oe(`(${i.metadata.score}分)`, t, "SimSun, STSong, serif");
5931
5934
  }
5932
5935
  let u = l, d = !1;
5933
5936
  for (let t of s.elements) {
@@ -5936,7 +5939,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5936
5939
  for (let i = 0; i < t.value.length; i++) {
5937
5940
  let o = u + c + r[i];
5938
5941
  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;
5942
+ S = a, k = f.x + p + o, P = f.y + y + n + s.lineHeight * .5, F = M, d = !0;
5940
5943
  break;
5941
5944
  }
5942
5945
  a++;
@@ -5945,30 +5948,30 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5945
5948
  } else {
5946
5949
  let r = t.width || 12;
5947
5950
  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;
5951
+ S = a, k = f.x + p + u + c, P = f.y + y + n + s.lineHeight * .5, F = M, d = !0;
5949
5952
  break;
5950
5953
  }
5951
5954
  u += r;
5952
5955
  }
5953
5956
  if (d) break;
5954
5957
  }
5955
- d || (S = a, O = f.x + p + u + c, N = f.y + y + n + s.lineHeight * .5, P = j);
5958
+ d || (S = a, k = f.x + p + u + c, P = f.y + y + n + s.lineHeight * .5, F = M);
5956
5959
  }
5957
5960
  w.setCursor(e, b, S);
5958
- let F = ee.value, te = document.querySelectorAll(".pe-editor-page")[c]?.querySelector("svg.paper-page");
5959
- 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 = {
5961
+ let I = O.value, ee = document.querySelectorAll(".pe-editor-page")[c]?.querySelector("svg.paper-page");
5962
+ if (I && ee && l) {
5963
+ let e = ee.getBoundingClientRect(), t = I.getBoundingClientRect(), n = l.width, r = l.height, i = k + m, a = P + d, o = e.left - t.left + I.scrollLeft + i / n * e.width, s = e.top - t.top + I.scrollTop + a / r * e.height;
5964
+ j.value = {
5962
5965
  left: o,
5963
5966
  top: s,
5964
- height: P * T.value
5965
- }, k.value = {
5967
+ height: F * T.value
5968
+ }, A.value = {
5966
5969
  left: o,
5967
5970
  top: s
5968
5971
  }, D.value = !0;
5969
5972
  }
5970
5973
  }
5971
- function ie(e) {
5974
+ function re(e) {
5972
5975
  let t = e.target, n = e.currentTarget, r = n.closest(".pe-editor-page"), i = E.value;
5973
5976
  if (r) {
5974
5977
  let e = r.parentElement?.querySelectorAll(":scope > .pe-editor-page");
@@ -5996,7 +5999,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
5996
5999
  if (c) {
5997
6000
  let t = c.getAttribute("data-block-id");
5998
6001
  if (t) {
5999
- C.selectBlock(t), n && re(t, e, n, i), o(() => O.value?.focus());
6002
+ C.selectBlock(t), n && ne(t, e, n, i), o(() => k.value?.focus());
6000
6003
  let r = C.blocks.value.find((e) => e.id === t);
6001
6004
  r && S("block-click", {
6002
6005
  blockId: t,
@@ -6005,18 +6008,18 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6005
6008
  }
6006
6009
  } else C.selectBlock(null), C.selectUnderline(null), D.value = !1, w.clearCursor(), S("empty-click");
6007
6010
  }
6008
- function ae(e) {
6011
+ function ie(e) {
6009
6012
  let t = e.target;
6010
6013
  if (!t) return;
6011
6014
  let n = t.getAttribute("data-editable");
6012
6015
  n && (n === "schoolName" ? C.schoolName.value = t.innerHTML : n === "paperName" && (C.paperName.value = t.textContent || ""));
6013
6016
  }
6014
- let R = f(null), oe = t(() => R.value ? {
6017
+ let z = f(null), ae = t(() => z.value ? {
6015
6018
  position: "absolute",
6016
- left: R.value.left + "px",
6017
- top: R.value.top + "px",
6018
- width: R.value.width + "px",
6019
- height: R.value.height + "px",
6019
+ left: z.value.left + "px",
6020
+ top: z.value.top + "px",
6021
+ width: z.value.width + "px",
6022
+ height: z.value.height + "px",
6020
6023
  pointerEvents: "none",
6021
6024
  border: "1.5px solid #409eff",
6022
6025
  borderRadius: "2px",
@@ -6025,221 +6028,221 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6025
6028
  display: "none",
6026
6029
  position: "absolute"
6027
6030
  });
6028
- function z() {
6031
+ function B() {
6029
6032
  let e = C.selectedBlockId.value;
6030
6033
  if (!e) {
6031
- R.value = null;
6034
+ z.value = null;
6032
6035
  return;
6033
6036
  }
6034
6037
  let t = C.blocks.value.find((t) => t.id === e);
6035
6038
  if (!t || t.type === "title") {
6036
- R.value = null;
6039
+ z.value = null;
6037
6040
  return;
6038
6041
  }
6039
6042
  let n = document.querySelector(".pe-editor-page.active");
6040
6043
  if (!n) {
6041
- R.value = null;
6044
+ z.value = null;
6042
6045
  return;
6043
6046
  }
6044
6047
  let r = n.querySelector("svg.paper-page");
6045
6048
  if (!r) {
6046
- R.value = null;
6049
+ z.value = null;
6047
6050
  return;
6048
6051
  }
6049
6052
  let i = C.pages.value.find((e) => e.index === E.value);
6050
6053
  if (!i) {
6051
- R.value = null;
6054
+ z.value = null;
6052
6055
  return;
6053
6056
  }
6054
6057
  let a = i.blocks.find((t) => t.blockId === e);
6055
6058
  if (!a) {
6056
- R.value = null;
6059
+ z.value = null;
6057
6060
  return;
6058
6061
  }
6059
6062
  let o = n.closest(".pe-editor-surface");
6060
6063
  if (!o) {
6061
- R.value = null;
6064
+ z.value = null;
6062
6065
  return;
6063
6066
  }
6064
6067
  let s = i.width, c = i.height, l = E.value % 2 == 0 ? C.settings.value.bodyTopEven ?? 173 : C.settings.value.bodyTopOdd ?? 50, u = (C.settings.value.margins[3] ?? 56) + a.x, d = l + a.y, f = r.getBoundingClientRect(), p = o.getBoundingClientRect();
6065
- R.value = {
6068
+ z.value = {
6066
6069
  left: f.left - p.left + o.scrollLeft + u / s * f.width,
6067
6070
  top: f.top - p.top + o.scrollTop + d / c * f.height,
6068
6071
  width: a.width / s * f.width,
6069
6072
  height: a.height / c * f.height
6070
6073
  };
6071
6074
  }
6072
- let B = f(null), ce = t(() => B.value ? {
6075
+ let V = f(null), se = t(() => V.value ? {
6073
6076
  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",
6077
+ left: V.value.left + "px",
6078
+ top: V.value.top + "px",
6079
+ width: V.value.width + "px",
6080
+ height: V.value.height + "px",
6078
6081
  pointerEvents: "auto"
6079
6082
  } : {
6080
6083
  display: "none",
6081
6084
  position: "absolute"
6082
6085
  });
6083
- function le() {
6086
+ function ce() {
6084
6087
  let e = C.selectedUnderlineId.value;
6085
6088
  if (!e) {
6086
- B.value = null;
6089
+ V.value = null;
6087
6090
  return;
6088
6091
  }
6089
6092
  let t = document.querySelector(".pe-editor-page.active");
6090
6093
  if (!t) {
6091
- B.value = null;
6094
+ V.value = null;
6092
6095
  return;
6093
6096
  }
6094
6097
  let n = t.querySelector(`[data-underline-id="${CSS.escape(e)}"]`);
6095
6098
  if (!n) {
6096
- B.value = null;
6099
+ V.value = null;
6097
6100
  return;
6098
6101
  }
6099
6102
  let r = t.closest(".pe-editor-surface");
6100
6103
  if (!r) {
6101
- B.value = null;
6104
+ V.value = null;
6102
6105
  return;
6103
6106
  }
6104
6107
  let i = n.getBoundingClientRect(), a = r.getBoundingClientRect();
6105
- B.value = {
6108
+ V.value = {
6106
6109
  left: i.left - a.left + r.scrollLeft,
6107
6110
  top: i.top - a.top + r.scrollTop,
6108
6111
  width: i.width,
6109
6112
  height: i.height
6110
6113
  };
6111
6114
  }
6112
- let V = f(null), ue = t(() => V.value ? {
6115
+ let H = f(null), le = t(() => H.value ? {
6113
6116
  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",
6117
+ left: H.value.left + "px",
6118
+ top: H.value.top + "px",
6119
+ width: H.value.width + "px",
6120
+ height: H.value.height + "px",
6118
6121
  pointerEvents: "auto"
6119
6122
  } : {
6120
6123
  display: "none",
6121
6124
  position: "absolute"
6122
6125
  });
6123
- function de() {
6126
+ function ue() {
6124
6127
  let e = C.selectedImageId.value;
6125
6128
  if (!e) {
6126
- V.value = null;
6129
+ H.value = null;
6127
6130
  return;
6128
6131
  }
6129
6132
  let t = document.querySelector(".pe-editor-page.active");
6130
6133
  if (!t) {
6131
- V.value = null;
6134
+ H.value = null;
6132
6135
  return;
6133
6136
  }
6134
6137
  let n = t.querySelector(`[data-image-id="${CSS.escape(e)}"]`);
6135
6138
  if (!n) {
6136
- V.value = null;
6139
+ H.value = null;
6137
6140
  return;
6138
6141
  }
6139
6142
  let r = n.querySelector("image") || n, i = t.closest(".pe-editor-surface");
6140
6143
  if (!i) {
6141
- V.value = null;
6144
+ H.value = null;
6142
6145
  return;
6143
6146
  }
6144
6147
  let a = r.getBoundingClientRect(), o = i.getBoundingClientRect();
6145
- V.value = {
6148
+ H.value = {
6146
6149
  left: a.left - o.left + i.scrollLeft,
6147
6150
  top: a.top - o.top + i.scrollTop,
6148
6151
  width: a.width,
6149
6152
  height: a.height
6150
6153
  };
6151
6154
  }
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",
6155
+ let de = t(() => C.selectedImageId.value ? C.getImageParagraphInfo(C.selectedImageId.value) : null), fe = t(() => !!(de.value?.isStandalone && H.value)), pe = t(() => H.value ? {
6156
+ left: H.value.left + "px",
6157
+ top: H.value.top + H.value.height + 4 + "px",
6155
6158
  pointerEvents: "auto"
6156
6159
  } : null);
6157
- function he(e) {
6160
+ function me(e) {
6158
6161
  let t = C.selectedImageId.value;
6159
- t && (C.updateImageAlignment(t, e), o(() => H()));
6162
+ t && (C.updateImageAlignment(t, e), o(() => U()));
6160
6163
  }
6161
- let ge = 0;
6162
- function H() {
6163
- ge && cancelAnimationFrame(ge), ge = requestAnimationFrame(() => {
6164
- ge = 0, z(), le(), de();
6164
+ let he = 0;
6165
+ function U() {
6166
+ he && cancelAnimationFrame(he), he = requestAnimationFrame(() => {
6167
+ he = 0, B(), ce(), ue();
6165
6168
  });
6166
6169
  }
6167
6170
  v(() => C.selectedBlockId.value, async () => {
6168
- await o(), H();
6171
+ await o(), U();
6169
6172
  }), v(() => T.value, async () => {
6170
- await o(), H();
6173
+ await o(), U();
6171
6174
  }), v(() => E.value, async () => {
6172
- await o(), H(), S("page-change", E.value);
6175
+ await o(), U(), S("page-change", E.value);
6173
6176
  }), v(() => C.layoutVersion.value, () => {
6174
- L(), o(() => H());
6177
+ R(), o(() => U());
6175
6178
  }), v(() => C.selectedUnderlineId.value, async () => {
6176
- await o(), H();
6179
+ await o(), U();
6177
6180
  }), v(() => C.selectedImageId.value, async () => {
6178
- await o(), H();
6181
+ await o(), U();
6179
6182
  }), v(() => [
6180
6183
  C.paperName.value,
6181
6184
  C.schoolName.value,
6182
6185
  C.totalScore.value
6183
6186
  ], () => {
6184
- L();
6187
+ R();
6185
6188
  });
6186
- let _e = f(!1), U = f(null), ve = f(0), ye = f(0);
6187
- function be(e) {
6189
+ let ge = f(!1), W = f(null), _e = f(0), ve = f(0);
6190
+ function ye(e) {
6188
6191
  let t = C.selectedBlockId.value;
6189
6192
  if (!t) return;
6190
6193
  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));
6194
+ n && (e.stopPropagation(), ge.value = !0, W.value = t, _e.value = e.clientY, ve.value = n.height, document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", be), document.addEventListener("mouseup", xe));
6192
6195
  }
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());
6196
+ function be(e) {
6197
+ if (!ge.value || !W.value) return;
6198
+ let t = (e.clientY - _e.value) / T.value;
6199
+ C.updateBlockHeight(W.value, ve.value + t), o(() => B());
6197
6200
  }
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();
6201
+ function xe(e) {
6202
+ ge.value = !1, W.value = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", be), document.removeEventListener("mouseup", xe), R();
6200
6203
  }
6201
- let Ce = f(!1), W = f(null), we = f(0), Te = f(0);
6202
- function Ee(e, t) {
6204
+ let Se = f(!1), G = f(null), Ce = f(0), we = f(0);
6205
+ function Te(e, t) {
6203
6206
  let n = C.selectedUnderlineId.value;
6204
6207
  if (!n) return;
6205
6208
  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));
6209
+ r && (t.stopPropagation(), Se.value = !0, G.value = e, Ce.value = t.clientX, we.value = r.underline.width, document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", Ee), document.addEventListener("mouseup", K));
6207
6210
  }
6208
- function De(e) {
6209
- if (!Ce.value || !W.value) return;
6211
+ function Ee(e) {
6212
+ if (!Se.value || !G.value) return;
6210
6213
  let t = C.selectedUnderlineId.value;
6211
6214
  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());
6215
+ let n = (e.clientX - Ce.value) / T.value, r = G.value === "right" ? n : -n;
6216
+ C.updateUnderlineWidth(t, we.value + r), o(() => ce());
6214
6217
  }
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();
6218
+ function K(e) {
6219
+ Se.value = !1, G.value = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", Ee), document.removeEventListener("mouseup", K), R();
6217
6220
  }
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) {
6221
+ let De = f(!1), Oe = f(null), q = f(0), ke = f(0), Ae = f(0), je = f(0);
6222
+ function Me(e, t) {
6220
6223
  if (t.button !== 0) return;
6221
6224
  let n = C.selectedImageId.value;
6222
6225
  if (!n) return;
6223
6226
  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));
6227
+ r && (t.stopPropagation(), De.value = !0, Oe.value = e, q.value = t.clientX, ke.value = t.clientY, Ae.value = r.image.width, je.value = r.image.height, document.body.style.userSelect = "none", document.addEventListener("mousemove", Ne), document.addEventListener("mouseup", Pe));
6225
6228
  }
6226
- function Pe(e) {
6227
- if (!Oe.value || !ke.value) return;
6229
+ function Ne(e) {
6230
+ if (!De.value || !Oe.value) return;
6228
6231
  let t = C.selectedImageId.value;
6229
6232
  if (!t) return;
6230
- let n = (e.clientX - K.value) / T.value, r = ke.value, i = je.value;
6233
+ let n = (e.clientX - q.value) / T.value, r = Oe.value, i = Ae.value;
6231
6234
  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());
6235
+ let a = je.value / Math.max(1, Ae.value), s = Math.max(12, Math.round(i * a));
6236
+ C.updateInlineImageSize(t, i, s), o(() => ue());
6234
6237
  }
6235
- function Fe(e) {
6236
- Oe.value = !1, ke.value = null, document.body.style.userSelect = "", document.removeEventListener("mousemove", Pe), document.removeEventListener("mouseup", Fe), L();
6238
+ function Pe(e) {
6239
+ De.value = !1, Oe.value = null, document.body.style.userSelect = "", document.removeEventListener("mousemove", Ne), document.removeEventListener("mouseup", Pe), R();
6237
6240
  }
6238
- function Ie(e) {
6239
- C.loadDocument(e), L(), S("loaded"), S("change");
6241
+ function Fe(e) {
6242
+ C.loadDocument(e), R(), S("loaded"), S("change");
6240
6243
  }
6241
- let Le = f(!1);
6242
- function q() {
6244
+ let Ie = f(!1);
6245
+ function J() {
6243
6246
  let e = w.cursor.value;
6244
6247
  if (!e.blockId) return;
6245
6248
  let t = e.blockId, n = e.paraIndex, r = e.charOffset;
@@ -6287,7 +6290,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6287
6290
  let s = m.lines[i], c = s.offsetX || 0, u = 0;
6288
6291
  if (a.paragraphStart === 0 && e.metadata?.score && i === 0 && n === (f[0] ?? 0)) {
6289
6292
  let t = C.settings.value.fontSize, n = typeof t == "number" ? t : 14;
6290
- u = se(`(${e.metadata.score}分)`, n, "SimSun, STSong, serif");
6293
+ u = oe(`(${e.metadata.score}分)`, n, "SimSun, STSong, serif");
6291
6294
  }
6292
6295
  let d = u, h = !1;
6293
6296
  for (let e of s.elements) {
@@ -6311,73 +6314,73 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6311
6314
  }
6312
6315
  h || (_ = a.x + l + d + c, v = a.y + p + o + s.lineHeight * .5);
6313
6316
  }
6314
- let b = ee.value, x = document.querySelectorAll(".pe-editor-page")[c]?.querySelector("svg.paper-page");
6317
+ let b = O.value, x = document.querySelectorAll(".pe-editor-page")[c]?.querySelector("svg.paper-page");
6315
6318
  if (b && x && i) {
6316
6319
  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 = {
6320
+ j.value = {
6318
6321
  left: l,
6319
6322
  top: u,
6320
6323
  height: y * T.value
6321
- }, k.value = {
6324
+ }, A.value = {
6322
6325
  left: l,
6323
6326
  top: u
6324
6327
  }, D.value = !0;
6325
6328
  }
6326
- O.value?.focus();
6329
+ k.value?.focus();
6327
6330
  });
6328
6331
  });
6329
6332
  }
6330
- function Re(e) {
6331
- if (w.cursor.value.blockId && !(Le.value && e.key === "Enter")) switch (e.key) {
6333
+ function Le(e) {
6334
+ if (w.cursor.value.blockId && !(Ie.value && e.key === "Enter")) switch (e.key) {
6332
6335
  case "Enter":
6333
- e.preventDefault(), w.splitAtCursor(), q();
6336
+ e.preventDefault(), w.splitAtCursor(), J();
6334
6337
  break;
6335
6338
  case "Backspace":
6336
- e.preventDefault(), w.backspace(), q();
6339
+ e.preventDefault(), w.backspace(), J();
6337
6340
  break;
6338
6341
  case "Delete":
6339
- e.preventDefault(), w.deleteForward(), q();
6342
+ e.preventDefault(), w.deleteForward(), J();
6340
6343
  break;
6341
6344
  case "ArrowLeft":
6342
- e.preventDefault(), w.moveCursorLeft(), q();
6345
+ e.preventDefault(), w.moveCursorLeft(), J();
6343
6346
  break;
6344
6347
  case "ArrowRight":
6345
- e.preventDefault(), w.moveCursorRight(), q();
6348
+ e.preventDefault(), w.moveCursorRight(), J();
6346
6349
  break;
6347
6350
  case "Home":
6348
- e.preventDefault(), w.moveToParaStart(), q();
6351
+ e.preventDefault(), w.moveToParaStart(), J();
6349
6352
  break;
6350
6353
  case "End":
6351
- e.preventDefault(), w.moveToParaEnd(), q();
6354
+ e.preventDefault(), w.moveToParaEnd(), J();
6352
6355
  break;
6353
6356
  }
6354
6357
  }
6355
- function ze(e) {
6356
- if (Le.value) return;
6358
+ function Re(e) {
6359
+ if (Ie.value) return;
6357
6360
  let t = e.target, n = t.value;
6358
- n && w.cursor.value.blockId && (w.insertText(n), t.value = "", q());
6361
+ n && w.cursor.value.blockId && (w.insertText(n), t.value = "", J());
6359
6362
  }
6360
- function Be() {
6361
- Le.value = !0;
6363
+ function ze() {
6364
+ Ie.value = !0;
6362
6365
  }
6363
- function Ve(e) {
6364
- Le.value = !1;
6365
- let t = O.value;
6366
+ function Be(e) {
6367
+ Ie.value = !1;
6368
+ let t = k.value;
6366
6369
  if (t) {
6367
6370
  let e = t.value;
6368
- e && w.cursor.value.blockId && (w.insertText(e), t.value = "", q());
6371
+ e && w.cursor.value.blockId && (w.insertText(e), t.value = "", J());
6369
6372
  }
6370
6373
  }
6371
6374
  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");
6375
+ x.initialData ? Fe(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
6376
  }), 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);
6377
+ document.removeEventListener("mousemove", be), document.removeEventListener("mouseup", xe), document.removeEventListener("mousemove", Ee), document.removeEventListener("mouseup", K), document.removeEventListener("mousemove", Ne), document.removeEventListener("mouseup", Pe);
6375
6378
  }), v(() => x.qrCodeContent, (e) => {
6376
6379
  C.qrCodeContent.value = e || "";
6377
6380
  }), m({
6378
6381
  document: {
6379
6382
  save: () => C.saveDocument(),
6380
- load: (e) => Ie(e),
6383
+ load: (e) => Fe(e),
6381
6384
  getBlocks: () => C.blocks.value,
6382
6385
  isDirty: () => C.isDirty.value
6383
6386
  },
@@ -6437,21 +6440,21 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6437
6440
  },
6438
6441
  layout: {
6439
6442
  setPaperSize: (e) => {
6440
- C.updateSettings({ paperSize: e }), L();
6443
+ C.updateSettings({ paperSize: e }), R();
6441
6444
  },
6442
6445
  setColumns: (e) => {
6443
- C.updateSettings({ columns: e }), L();
6446
+ C.updateSettings({ columns: e }), R();
6444
6447
  },
6445
6448
  setFontSize: (e) => {
6446
- C.updateSettings({ fontSize: e }), L();
6449
+ C.updateSettings({ fontSize: e }), R();
6447
6450
  },
6448
6451
  setLineSpacing: (e) => {
6449
- C.updateSettings({ lineSpacing: e }), L();
6452
+ C.updateSettings({ lineSpacing: e }), R();
6450
6453
  },
6451
6454
  updateSettings: (e) => {
6452
- C.updateSettings(e), L();
6455
+ C.updateSettings(e), R();
6453
6456
  },
6454
- reflow: () => te()
6457
+ reflow: () => ee()
6455
6458
  },
6456
6459
  selection: {
6457
6460
  selectBlock: (e) => C.selectBlock(e),
@@ -6467,9 +6470,9 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6467
6470
  }
6468
6471
  },
6469
6472
  render: {
6470
- getPageSvgs: () => N.value,
6471
- getCleanPageSvgs: () => P(),
6472
- getAllPagesSvg: () => F.value
6473
+ getPageSvgs: () => P.value,
6474
+ getCleanPageSvgs: () => F(),
6475
+ getAllPagesSvg: () => I.value
6473
6476
  },
6474
6477
  setQRCode: (e) => {
6475
6478
  C.qrCodeContent.value = e;
@@ -6484,7 +6487,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6484
6487
  selectedImageId: C.selectedImageId.value,
6485
6488
  selectedUnderlineInfo: C.selectedUnderlineInfo.value,
6486
6489
  selectedImageInfo: C.selectedImageInfo.value,
6487
- selectedImageAlignment: fe.value,
6490
+ selectedImageAlignment: de.value,
6488
6491
  totalScore: C.totalScore.value,
6489
6492
  zoom: T.value,
6490
6493
  currentPage: E.value,
@@ -6494,35 +6497,36 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6494
6497
  schoolName: C.schoolName.value,
6495
6498
  qrCodeContent: C.qrCodeContent.value,
6496
6499
  qrCodeImage: C.qrCodeImage.value,
6500
+ qrCodeImages: C.qrCodeImages.value,
6497
6501
  showScore: C.settings.value.showScore
6498
6502
  }))
6499
6503
  }), (t, a) => (d(), r("div", Wn, [i("div", Gn, [i("div", Kn, [i("div", {
6500
6504
  class: "pe-editor-surface",
6501
6505
  ref_key: "saberEditorRef",
6502
- ref: ee
6506
+ ref: O
6503
6507
  }, [
6504
6508
  a[12] ||= i("svg", { class: "pe-editor-defs" }, [i("defs", null, [i("g", { id: "enter" }, [i("path", {
6505
6509
  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
6510
  fill: "currentColor"
6507
6511
  })])])], -1),
6508
- i("div", qn, [(d(!0), r(e, null, p(g(N), (e, t) => (d(), r("div", {
6512
+ i("div", qn, [(d(!0), r(e, null, p(g(P), (e, t) => (d(), r("div", {
6509
6513
  key: t,
6510
6514
  class: s(["pe-editor-page", { active: t === E.value }]),
6511
6515
  onClick: b((e) => E.value = t, ["stop"])
6512
6516
  }, [i("div", {
6513
6517
  class: "pe-editor-viewport",
6514
6518
  innerHTML: e,
6515
- onClick: ie,
6516
- onFocusout: ae
6519
+ onClick: re,
6520
+ onFocusout: ie
6517
6521
  }, null, 40, Yn)], 10, Jn))), 128))]),
6518
6522
  i("div", Xn, [
6519
- R.value ? (d(), r("div", {
6523
+ z.value ? (d(), r("div", {
6520
6524
  key: 0,
6521
6525
  class: "pe-ctrl-block",
6522
- style: c(oe.value)
6526
+ style: c(ae.value)
6523
6527
  }, [i("div", {
6524
6528
  class: "pe-ctrl-height",
6525
- onMousedown: b(be, ["prevent"])
6529
+ onMousedown: b(ye, ["prevent"])
6526
6530
  }, [...a[9] ||= [i("svg", {
6527
6531
  xmlns: "http://www.w3.org/2000/svg",
6528
6532
  width: "16",
@@ -6533,13 +6537,13 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6533
6537
  "fill-rule": "evenodd",
6534
6538
  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
6539
  })], -1)]], 32)], 4)) : n("", !0),
6536
- B.value ? (d(), r("div", {
6540
+ V.value ? (d(), r("div", {
6537
6541
  key: 1,
6538
6542
  class: "pe-ctrlUnderline",
6539
- style: c(ce.value)
6543
+ style: c(se.value)
6540
6544
  }, [i("div", {
6541
6545
  class: "pe-ctrl-ul-left",
6542
- onMousedown: a[0] ||= b((e) => Ee("left", e), ["prevent"])
6546
+ onMousedown: a[0] ||= b((e) => Te("left", e), ["prevent"])
6543
6547
  }, [...a[10] ||= [i("svg", {
6544
6548
  xmlns: "http://www.w3.org/2000/svg",
6545
6549
  width: "12",
@@ -6550,7 +6554,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6550
6554
  d: "M10.5 4L7.5 8l3 4H2V4z"
6551
6555
  })], -1)]], 32), i("div", {
6552
6556
  class: "pe-ctrl-ul-right",
6553
- onMousedown: a[1] ||= b((e) => Ee("right", e), ["prevent"])
6557
+ onMousedown: a[1] ||= b((e) => Te("right", e), ["prevent"])
6554
6558
  }, [...a[11] ||= [i("svg", {
6555
6559
  xmlns: "http://www.w3.org/2000/svg",
6556
6560
  width: "12",
@@ -6560,65 +6564,65 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6560
6564
  fill: "currentColor",
6561
6565
  d: "M5.5 4L8.5 8l-3 4H14V4z"
6562
6566
  })], -1)]], 32)], 4)) : n("", !0),
6563
- V.value ? (d(), r("div", {
6567
+ H.value ? (d(), r("div", {
6564
6568
  key: 2,
6565
6569
  class: "pe-ctrlAnchor",
6566
- style: c(ue.value)
6570
+ style: c(le.value)
6567
6571
  }, [
6568
6572
  i("div", {
6569
6573
  class: "pe-resize-se",
6570
- onMousedown: a[2] ||= b((e) => Ne("se", e), ["prevent", "stop"])
6574
+ onMousedown: a[2] ||= b((e) => Me("se", e), ["prevent", "stop"])
6571
6575
  }, null, 32),
6572
6576
  i("div", {
6573
6577
  class: "pe-resize-sw",
6574
- onMousedown: a[3] ||= b((e) => Ne("sw", e), ["prevent", "stop"])
6578
+ onMousedown: a[3] ||= b((e) => Me("sw", e), ["prevent", "stop"])
6575
6579
  }, null, 32),
6576
6580
  i("div", {
6577
6581
  class: "pe-resize-ne",
6578
- onMousedown: a[4] ||= b((e) => Ne("ne", e), ["prevent", "stop"])
6582
+ onMousedown: a[4] ||= b((e) => Me("ne", e), ["prevent", "stop"])
6579
6583
  }, null, 32),
6580
6584
  i("div", {
6581
6585
  class: "pe-resize-nw",
6582
- onMousedown: a[5] ||= b((e) => Ne("nw", e), ["prevent", "stop"])
6586
+ onMousedown: a[5] ||= b((e) => Me("nw", e), ["prevent", "stop"])
6583
6587
  }, null, 32)
6584
6588
  ], 4)) : n("", !0),
6585
- pe.value ? (d(), r("div", {
6589
+ fe.value ? (d(), r("div", {
6586
6590
  key: 3,
6587
6591
  class: "pe-img-align-bar",
6588
- style: c(me.value)
6592
+ style: c(pe.value)
6589
6593
  }, [
6590
6594
  i("button", {
6591
- class: s(["pe-align-btn", { active: fe.value?.alignment === "left" }]),
6592
- onClick: a[6] ||= (e) => he("left"),
6595
+ class: s(["pe-align-btn", { active: de.value?.alignment === "left" }]),
6596
+ onClick: a[6] ||= (e) => me("left"),
6593
6597
  title: "左对齐"
6594
6598
  }, "左", 2),
6595
6599
  i("button", {
6596
- class: s(["pe-align-btn", { active: fe.value?.alignment === "center" }]),
6597
- onClick: a[7] ||= (e) => he("center"),
6600
+ class: s(["pe-align-btn", { active: de.value?.alignment === "center" }]),
6601
+ onClick: a[7] ||= (e) => me("center"),
6598
6602
  title: "居中对齐"
6599
6603
  }, "中", 2),
6600
6604
  i("button", {
6601
- class: s(["pe-align-btn", { active: fe.value?.alignment === "right" }]),
6602
- onClick: a[8] ||= (e) => he("right"),
6605
+ class: s(["pe-align-btn", { active: de.value?.alignment === "right" }]),
6606
+ onClick: a[8] ||= (e) => me("right"),
6603
6607
  title: "右对齐"
6604
6608
  }, "右", 2)
6605
6609
  ], 4)) : n("", !0)
6606
6610
  ]),
6607
6611
  i("div", {
6608
6612
  class: "pe-editor-input-wrapper",
6609
- style: c(j.value)
6613
+ style: c(M.value)
6610
6614
  }, [i("input", {
6611
6615
  class: "pe-editor-virtual-input",
6612
6616
  ref_key: "virtualInputRef",
6613
- ref: O,
6614
- onKeydown: Re,
6615
- onInput: ze,
6616
- onCompositionstart: Be,
6617
- onCompositionend: Ve
6617
+ ref: k,
6618
+ onKeydown: Le,
6619
+ onInput: Re,
6620
+ onCompositionstart: ze,
6621
+ onCompositionend: Be
6618
6622
  }, null, 544)], 4),
6619
6623
  y(i("div", {
6620
6624
  class: "pe-editor-cursor",
6621
- style: c(M.value)
6625
+ style: c(N.value)
6622
6626
  }, null, 4), [[_, D.value]])
6623
6627
  ], 512)])])]));
6624
6628
  }
@@ -6626,7 +6630,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6626
6630
  let n = e.__vccOpts || e;
6627
6631
  for (let [e, r] of t) n[e] = r;
6628
6632
  return n;
6629
- }, $n = /*#__PURE__*/ Qn(Zn, [["__scopeId", "data-v-62a78c32"]]), er = { class: "pe-preview__pages" }, tr = ["innerHTML"], nr = {
6633
+ }, $n = /*#__PURE__*/ Qn(Zn, [["__scopeId", "data-v-152f108d"]]), er = { class: "pe-preview__pages" }, tr = ["innerHTML"], nr = {
6630
6634
  key: 0,
6631
6635
  class: "pe-preview__helpers"
6632
6636
  }, rr = {
@@ -6682,7 +6686,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6682
6686
  return [];
6683
6687
  }
6684
6688
  }), 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;
6689
+ 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
6690
  if (x.value > 0) {
6687
6691
  let e = x.value - 32, n = t.w, r = e / 3.7795275590551185;
6688
6692
  n > r && (i = r / n);
@@ -6728,7 +6732,7 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6728
6732
  };
6729
6733
  });
6730
6734
  }
6731
- function ee(e) {
6735
+ function O(e) {
6732
6736
  let t = C.value[e];
6733
6737
  if (!t) return [];
6734
6738
  let n = [];
@@ -6802,21 +6806,21 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6802
6806
  }
6803
6807
  return n;
6804
6808
  }
6805
- function O(e) {
6809
+ function k(e) {
6806
6810
  let t = m.pages.value[0]?.width || 793, n = m.pages.value[0]?.height || 1123;
6807
6811
  return {
6808
6812
  width: `${(t * w.value.x).toFixed(1)}mm`,
6809
6813
  height: `${(n * w.value.y).toFixed(1)}mm`
6810
6814
  };
6811
6815
  }
6812
- function j(e) {
6816
+ function M(e) {
6813
6817
  let t = m.pages.value[0]?.width || 793, n = m.pages.value[0]?.height || 1123;
6814
6818
  return {
6815
6819
  width: `${(t * w.value.x).toFixed(1)}mm`,
6816
6820
  height: `${(n * w.value.y).toFixed(1)}mm`
6817
6821
  };
6818
6822
  }
6819
- function M(e) {
6823
+ function N(e) {
6820
6824
  return {
6821
6825
  position: "absolute",
6822
6826
  outline: `1px solid ${e.color}`,
@@ -6835,11 +6839,11 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6835
6839
  }, [i("div", er, [(d(!0), r(e, null, p(g(y), (t, o) => (d(), r("div", {
6836
6840
  key: o,
6837
6841
  class: "pe-preview__page",
6838
- style: c(O(o))
6842
+ style: c(k(o))
6839
6843
  }, [
6840
6844
  i("div", {
6841
6845
  class: "pe-preview__page-col",
6842
- style: c(j(o))
6846
+ style: c(M(o))
6843
6847
  }, [i("div", {
6844
6848
  innerHTML: t,
6845
6849
  style: {
@@ -6850,15 +6854,15 @@ var Wn = { class: "pe-root" }, Gn = { class: "pe-main" }, Kn = { class: "pe-edit
6850
6854
  a.showHelpers ? (d(), r("div", nr, [a.showCornerMarks ? (d(!0), r(e, { key: 0 }, p(D(o), (e, t) => (d(), r("span", {
6851
6855
  key: "cm-" + t,
6852
6856
  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", {
6857
+ style: c(N(e))
6858
+ }, null, 6))), 128)) : n("", !0), a.showRegionBoxes ? (d(!0), r(e, { key: 1 }, p(O(o), (e, t) => (d(), r("span", {
6855
6859
  key: "rg-" + t,
6856
6860
  class: s(["pe-preview__helper-box", e.className]),
6857
- style: c(M(e))
6861
+ style: c(N(e))
6858
6862
  }, null, 6))), 128)) : n("", !0)])) : n("", !0),
6859
6863
  a.showPageNumbers ? (d(), r("div", rr, h(o + 1) + " / " + h(g(m).pages.value.length), 1)) : n("", !0)
6860
6864
  ], 4))), 128))])], 2));
6861
6865
  }
6862
6866
  }), [["__scopeId", "data-v-1b638e19"]]);
6863
6867
  //#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 };
6868
+ export { vn as FONT_SIZE_MAP, A as PAPER_DIMENSIONS, j as PAPER_MM, $n as PaperEditor, ee as PaperLayout, ir as PaperPreview, Se as SvgRenderer, Bt as buildPaperHtml, V as calcCharPositions, oe as calcTextWidth, Ee as clearFormulaCache, ce as clearWidthCache, gt as deserializeDocument, Rt as extractBaseTitle, yn as fontSizeLabelToPx, bn as fontSizePxToLabel, Lt as formatSectionTitle, B as getCharWidth, N as getPaperPreset, Hn as hasTablePlaceholder, K as latexToSvg, je as latexToSvgBatch, xt as parseQuestionHtml, Mt as parseQuestionJson, Bn as renderTablePlaceholders, ht as serializeDocument, F as toBBox, It as toChineseOrdinal, zn as usePageSvgRenderer, Ln as usePaperCore };