@sw7d/paper-renderer 0.5.6 → 0.5.7

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.
@@ -11453,31 +11453,59 @@ function ka(e, t, n) {
11453
11453
  async function Aa(e, t) {
11454
11454
  let n = t.apiUrl;
11455
11455
  if (!n) throw Error("未配置 LLM 调用地址(AIConfig.apiUrl)");
11456
- let r = t.timeoutMs ?? 12e4, i = new AbortController(), a = setTimeout(() => i.abort(), r), o = {
11457
- system: e.system,
11458
- user: e.user,
11459
- ...e.imageDataUrl ? { imageDataUrl: e.imageDataUrl } : {}
11460
- };
11456
+ let r = t.timeoutMs ?? 12e4, i = {
11457
+ method: "POST",
11458
+ headers: {
11459
+ "Content-Type": "application/json",
11460
+ ...t.headers || {}
11461
+ },
11462
+ body: JSON.stringify({
11463
+ system: e.system,
11464
+ user: e.user,
11465
+ ...e.imageDataUrl ? { imageDataUrl: e.imageDataUrl } : {}
11466
+ })
11467
+ }, a = typeof AbortController < "u" ? new AbortController() : null, o = setTimeout(() => a?.abort(), r);
11461
11468
  try {
11462
- let e = await fetch(n, {
11463
- method: "POST",
11464
- headers: {
11465
- "Content-Type": "application/json",
11466
- ...t.headers || {}
11467
- },
11468
- body: JSON.stringify(o),
11469
- signal: i.signal
11470
- });
11469
+ let e = await ja(n, i, r, t, a?.signal);
11471
11470
  if (!e.ok) {
11472
11471
  let t = await e.text().catch(() => ""), n = e.status === 401 || e.status === 403 || /api key|unauthorized|authentication|invalid.?key|invalid_request_error/i.test(t) ? ";请检查 LLM 鉴权配置(宿主后端 .env 的 LLM_API_KEY)" : "";
11473
11472
  throw Error(`LLM 调用异常(${e.status})${t ? `: ${t.slice(0, 200)}` : ""}${n}`);
11474
11473
  }
11475
- return { content: ja(await e.json()) };
11474
+ return { content: Ma(await e.json()) };
11476
11475
  } finally {
11477
- clearTimeout(a);
11476
+ clearTimeout(o);
11478
11477
  }
11479
11478
  }
11480
- function ja(e) {
11479
+ async function ja(e, t, n, r, i) {
11480
+ if (r.fetcher) return r.fetcher(e, t);
11481
+ let a = globalThis;
11482
+ if (typeof a.fetch == "function") return a.fetch(e, {
11483
+ ...t,
11484
+ signal: i
11485
+ });
11486
+ if (typeof a.XMLHttpRequest == "function") return new Promise((r, o) => {
11487
+ let s = new a.XMLHttpRequest();
11488
+ s.open(t.method, e);
11489
+ for (let [e, n] of Object.entries(t.headers)) s.setRequestHeader(e, n);
11490
+ s.timeout = n, i?.addEventListener("abort", () => s.abort(), { once: !0 }), s.onload = () => {
11491
+ let e = s.responseText;
11492
+ r({
11493
+ ok: s.status >= 200 && s.status < 300,
11494
+ status: s.status,
11495
+ text: async () => e,
11496
+ json: async () => {
11497
+ try {
11498
+ return JSON.parse(e);
11499
+ } catch {
11500
+ return null;
11501
+ }
11502
+ }
11503
+ });
11504
+ }, s.onerror = () => o(/* @__PURE__ */ Error(`网络请求失败(${e})`)), s.ontimeout = () => o(/* @__PURE__ */ Error(`LLM 调用超时(${n}ms)`)), s.onabort = () => o(/* @__PURE__ */ Error("请求已取消")), s.send(t.body);
11505
+ });
11506
+ throw Error("当前环境不支持 fetch 或 XMLHttpRequest,请在 configureAI 传入 fetcher 或引入 polyfill");
11507
+ }
11508
+ function Ma(e) {
11481
11509
  if (typeof e == "string") return e;
11482
11510
  if (!e || typeof e != "object") return null;
11483
11511
  let t = e;
@@ -11489,11 +11517,11 @@ function ja(e) {
11489
11517
  }
11490
11518
  return typeof t.result == "string" ? t.result : t.result && typeof t.result == "object" && typeof t.result.content == "string" ? t.result.content : null;
11491
11519
  }
11492
- function Ma(e, t, n) {
11520
+ function Na(e, t, n) {
11493
11521
  let r = xa(n);
11494
11522
  return e === "score-rule" ? wa(t, r) : Ca(t, r);
11495
11523
  }
11496
- function Na(e, t, n) {
11524
+ function Pa(e, t, n) {
11497
11525
  let r = [];
11498
11526
  if (Array.isArray(t?.underlines)) {
11499
11527
  let i = sa(e);
@@ -11523,7 +11551,7 @@ function Na(e, t, n) {
11523
11551
  t?.answer && (i.answer = t.answer), t?.subAnswers && Object.keys(t.subAnswers).length > 0 && (i.subAnswers = t.subAnswers), Object.keys(i).length > 0 && r.push(() => n.updateMetadata(e.id, i));
11524
11552
  for (let e of r) e();
11525
11553
  }
11526
- async function Pa(e, t) {
11554
+ async function Fa(e, t) {
11527
11555
  if (!Ta) return {
11528
11556
  ok: !1,
11529
11557
  error: "AI 未配置"
@@ -11534,8 +11562,8 @@ async function Pa(e, t) {
11534
11562
  ok: !1,
11535
11563
  error: "AI 未返回内容"
11536
11564
  };
11537
- let i = Ma("analyze", n.topicId, r);
11538
- return Na(e, i, t), {
11565
+ let i = Na("analyze", n.topicId, r);
11566
+ return Pa(e, i, t), {
11539
11567
  ok: !0,
11540
11568
  result: i
11541
11569
  };
@@ -11546,7 +11574,7 @@ async function Pa(e, t) {
11546
11574
  };
11547
11575
  }
11548
11576
  }
11549
- async function Fa(e, t) {
11577
+ async function Ia(e, t) {
11550
11578
  if (!Ta) return {
11551
11579
  ok: !1,
11552
11580
  error: "AI 未配置"
@@ -11557,7 +11585,7 @@ async function Fa(e, t) {
11557
11585
  ok: !1,
11558
11586
  error: "AI 未返回内容"
11559
11587
  };
11560
- let i = Ma("score-rule", n.topicId, r);
11588
+ let i = Na("score-rule", n.topicId, r);
11561
11589
  return i.scoreRule && t.updateScoreRule(e.id, i.scoreRule), {
11562
11590
  ok: !0,
11563
11591
  result: i
@@ -11571,19 +11599,19 @@ async function Fa(e, t) {
11571
11599
  }
11572
11600
  //#endregion
11573
11601
  //#region src/engine/svg/headerRenderer.ts
11574
- function Ia() {
11602
+ function La() {
11575
11603
  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";
11576
11604
  }
11577
11605
  //#endregion
11578
11606
  //#region src/components/headers/HeaderSchoolInfo.vue?vue&type=script&setup=true&lang.ts
11579
- var La = ["transform"], Ra = ["width"], za = {
11607
+ var Ra = ["transform"], za = ["width"], Ba = {
11580
11608
  xmlns: "http://www.w3.org/1999/xhtml",
11581
11609
  class: "swed-header-school-info"
11582
- }, Ba = ["contenteditable"], Va = {
11610
+ }, Va = ["contenteditable"], Ha = {
11583
11611
  key: 0,
11584
11612
  class: "swed-score",
11585
11613
  "data-region": "score"
11586
- }, Ha = /* @__PURE__ */ l({
11614
+ }, Ua = /* @__PURE__ */ l({
11587
11615
  __name: "HeaderSchoolInfo",
11588
11616
  props: {
11589
11617
  schoolName: {},
@@ -11604,19 +11632,19 @@ var La = ["transform"], Ra = ["width"], za = {
11604
11632
  height: "30",
11605
11633
  "data-region": "header-desc",
11606
11634
  opacity: "1"
11607
- }, [a("div", za, [a("div", {
11635
+ }, [a("div", Ba, [a("div", {
11608
11636
  contenteditable: e.editable,
11609
11637
  class: m(["swed-headerDesc", { "swed-editable-dashed": e.editable }]),
11610
11638
  "data-editable": "schoolName"
11611
- }, E(e.schoolName), 11, Ba), o.value ? (y(), i("span", Va, E(o.value), 1)) : r("", !0)])], 8, Ra))], 8, La));
11639
+ }, E(e.schoolName), 11, Va), o.value ? (y(), i("span", Ha, E(o.value), 1)) : r("", !0)])], 8, za))], 8, Ra));
11612
11640
  }
11613
- }), Ua = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1785121196510'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='6669'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M524.8%20748.8%20320%20896c-12.8%206.4%2012.8%206.4%2012.8%206.4l377.6%200c19.2%200%200-25.6%200-25.6-57.6-83.2-108.8-115.2-140.8-134.4C537.6%20723.2%20524.8%20748.8%20524.8%20748.8z'%20p-id='6670'%3e%3c/path%3e%3cpath%20d='M684.8%20179.2%20364.8%20179.2c0%200-25.6%2083.2%2096%20166.4%200%200%2051.2%2032%2064%20115.2l0%206.4c0%200%200%200%200%200%200%200%200%200%200%200L524.8%20460.8c6.4-83.2%2064-115.2%2064-115.2C710.4%20262.4%20684.8%20179.2%20684.8%20179.2z'%20p-id='6671'%3e%3c/path%3e%3cpath%20d='M659.2%20396.8c134.4-102.4%20153.6-243.2%20153.6-307.2l32%200c25.6%200%2044.8-19.2%2044.8-44.8l0%200c0-25.6-19.2-44.8-44.8-44.8L217.6%200C192%200%20172.8%2019.2%20172.8%2044.8l0%200c0%2025.6%2019.2%2044.8%2044.8%2044.8l32%200c0%2064%2019.2%20204.8%20153.6%20307.2C448%20428.8%20473.6%20467.2%20473.6%20512c0%2070.4-64%20121.6-70.4%20121.6-12.8%206.4-153.6%20108.8-153.6%20300.8L217.6%20934.4c-25.6%200-44.8%2019.2-44.8%2044.8l0%200C172.8%201004.8%20192%201024%20217.6%201024l627.2%200c25.6%200%2044.8-19.2%2044.8-44.8l0%200c0-25.6-19.2-44.8-44.8-44.8l-32%200c0-192-147.2-294.4-153.6-300.8C652.8%20627.2%20588.8%20576%20588.8%20512%20588.8%20467.2%20608%20428.8%20659.2%20396.8zM556.8%20512c0%2083.2%2076.8%20140.8%2083.2%20147.2l0%200c0%200%20140.8%2096%20140.8%20275.2l-512%200c0-179.2%20140.8-275.2%20140.8-275.2l0%200c6.4%200%2083.2-64%2083.2-147.2%200-51.2-25.6-96-83.2-134.4C294.4%20281.6%20275.2%20147.2%20275.2%2089.6l505.6%200c0%2057.6-19.2%20185.6-140.8%20281.6C588.8%20416%20556.8%20460.8%20556.8%20512z'%20p-id='6672'%3e%3c/path%3e%3c/svg%3e", Wa = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1785121254384'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='1222'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M920.9%20332.9c-22.6-53.4-55-101.5-96.2-142.7-41.2-41.3-89.1-73.7-142.7-96.2-55.4-23.4-114.1-35.3-174.8-35.3-60.6%200-119.4%2011.9-174.8%2035.3-53.4%2022.5-101.4%2054.9-142.7%2096.2-41.2%2041.2-73.6%2089.2-96.2%20142.7-23.2%2055.4-35.1%20114.2-35.1%20174.8%200%2060.6%2011.9%20119.4%2035.3%20174.8%2022.6%2053.4%2054.9%20101.5%2096.2%20142.7%2041.2%2041.2%2089.2%2073.6%20142.7%2096.2%2055.4%2023.4%20114.1%2035.3%20174.8%2035.3%2060.6%200%20119.4-11.9%20174.8-35.3%2053.4-22.6%20101.5-55%20142.7-96.2%2041.2-41.2%2073.6-89.2%2096.2-142.7%2023.4-55.4%2035.3-114.1%2035.3-174.8%200.1-60.7-12-119.4-35.5-174.8zM507.4%20891.8c-211.8%200-384.1-172.3-384.1-384.1s172.3-384.1%20384.1-384.1%20384.1%20172.3%20384.1%20384.1-172.3%20384.1-384.1%20384.1z'%20p-id='1223'%3e%3c/path%3e%3cpath%20d='M350.8%20438.1c31%200%2056.2-25.1%2056.2-56.2%200-31-25.1-56.2-56.2-56.2-31%200-56.2%2025.1-56.2%2056.2%200.1%2031.1%2025.2%2056.2%2056.2%2056.2zM664.1%20438.1c31%200%2056.2-25.1%2056.2-56.2%200-31-25.1-56.2-56.2-56.2-31%200-56.2%2025.1-56.2%2056.2s25.2%2056.2%2056.2%2056.2zM330.1%20687c10.7%200%2020.6-5.3%2026.7-14.1%2033.1-47.5%2088.2-78.7%20150.5-78.7s117.4%2031.2%20150.6%2078.7c6.1%208.7%2016%2014%2026.7%2014h0.2c26.1%200%2041.6-29.4%2026.6-50.8-8.4-12-17.9-23.3-28.4-33.9-46.9-46.9-109.2-72.7-175.5-72.7S378.8%20555.3%20332%20602.2c-10.6%2010.6-20.1%2021.9-28.4%2033.9-15%2021.5%200.4%2050.9%2026.5%2050.9z'%20p-id='1224'%3e%3c/path%3e%3c/svg%3e", Ga = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1785121261852'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='1386'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M919.3%20332.2c-22.6-53.4-55-101.5-96.2-142.7-41.2-41.2-89.2-73.6-142.7-96.2C625%2069.9%20566.2%2058%20505.6%2058%20445%2058%20386.2%2069.9%20330.8%2093.3c-53.4%2022.6-101.5%2054.9-142.7%2096.2-41.2%2041.2-73.6%2089.2-96.2%20142.7C68.7%20387.6%2056.8%20446.4%2056.8%20507c0%2060.6%2011.9%20119.4%2035.3%20174.8%2022.6%2053.4%2054.9%20101.5%2096.2%20142.7%2041.2%2041.2%2089.2%2073.6%20142.7%2096.2%2055.4%2023.4%20114.1%2035.3%20174.8%2035.3%2060.6%200%20119.4-11.9%20174.8-35.3%2053.4-22.6%20101.5-55%20142.7-96.2%2041.2-41.2%2073.6-89.2%2096.2-142.7%2023.4-55.4%2035.3-114.1%2035.3-174.8%200-60.7-12.1-119.4-35.5-174.8zM505.7%20891.1c-211.8%200-384.1-172.3-384.1-384.1s172.3-384.1%20384.1-384.1S889.8%20295.2%20889.8%20507%20717.5%20891.1%20505.7%20891.1z'%20p-id='1387'%3e%3c/path%3e%3cpath%20d='M719.2%20527.9c-16%200-29.7%2011.7-32%2027.6-13.2%2088.2-89.4%20156-181.3%20156s-168.2-67.8-181.5-156c-2.4-15.8-16-27.5-32-27.5-19.9%200-35%2017.7-32%2037.4%207.8%2052.1%2032%20100.2%2069.9%20138.1%2046.9%2046.9%20109.2%2072.7%20175.5%2072.7s128.7-25.8%20175.5-72.7c38-37.9%2062.1-86%2069.9-138.1%203-19.8-12.1-37.5-32-37.5zM349.2%20438.4c31%200%2056.2-25.1%2056.2-56.2%200-31-25.1-56.2-56.2-56.2-31%200-56.2%2025.1-56.2%2056.2s25.1%2056.2%2056.2%2056.2zM662.4%20438.4c31%200%2056.2-25.1%2056.2-56.2%200-31-25.1-56.2-56.2-56.2-31%200-56.2%2025.1-56.2%2056.2s25.2%2056.2%2056.2%2056.2z'%20p-id='1388'%3e%3c/path%3e%3c/svg%3e", Ka = { class: "swed-header-embeds" }, qa = ["width"], Ja = {
11641
+ }), Wa = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1785121196510'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='6669'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M524.8%20748.8%20320%20896c-12.8%206.4%2012.8%206.4%2012.8%206.4l377.6%200c19.2%200%200-25.6%200-25.6-57.6-83.2-108.8-115.2-140.8-134.4C537.6%20723.2%20524.8%20748.8%20524.8%20748.8z'%20p-id='6670'%3e%3c/path%3e%3cpath%20d='M684.8%20179.2%20364.8%20179.2c0%200-25.6%2083.2%2096%20166.4%200%200%2051.2%2032%2064%20115.2l0%206.4c0%200%200%200%200%200%200%200%200%200%200%200L524.8%20460.8c6.4-83.2%2064-115.2%2064-115.2C710.4%20262.4%20684.8%20179.2%20684.8%20179.2z'%20p-id='6671'%3e%3c/path%3e%3cpath%20d='M659.2%20396.8c134.4-102.4%20153.6-243.2%20153.6-307.2l32%200c25.6%200%2044.8-19.2%2044.8-44.8l0%200c0-25.6-19.2-44.8-44.8-44.8L217.6%200C192%200%20172.8%2019.2%20172.8%2044.8l0%200c0%2025.6%2019.2%2044.8%2044.8%2044.8l32%200c0%2064%2019.2%20204.8%20153.6%20307.2C448%20428.8%20473.6%20467.2%20473.6%20512c0%2070.4-64%20121.6-70.4%20121.6-12.8%206.4-153.6%20108.8-153.6%20300.8L217.6%20934.4c-25.6%200-44.8%2019.2-44.8%2044.8l0%200C172.8%201004.8%20192%201024%20217.6%201024l627.2%200c25.6%200%2044.8-19.2%2044.8-44.8l0%200c0-25.6-19.2-44.8-44.8-44.8l-32%200c0-192-147.2-294.4-153.6-300.8C652.8%20627.2%20588.8%20576%20588.8%20512%20588.8%20467.2%20608%20428.8%20659.2%20396.8zM556.8%20512c0%2083.2%2076.8%20140.8%2083.2%20147.2l0%200c0%200%20140.8%2096%20140.8%20275.2l-512%200c0-179.2%20140.8-275.2%20140.8-275.2l0%200c6.4%200%2083.2-64%2083.2-147.2%200-51.2-25.6-96-83.2-134.4C294.4%20281.6%20275.2%20147.2%20275.2%2089.6l505.6%200c0%2057.6-19.2%20185.6-140.8%20281.6C588.8%20416%20556.8%20460.8%20556.8%20512z'%20p-id='6672'%3e%3c/path%3e%3c/svg%3e", Ga = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1785121254384'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='1222'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M920.9%20332.9c-22.6-53.4-55-101.5-96.2-142.7-41.2-41.3-89.1-73.7-142.7-96.2-55.4-23.4-114.1-35.3-174.8-35.3-60.6%200-119.4%2011.9-174.8%2035.3-53.4%2022.5-101.4%2054.9-142.7%2096.2-41.2%2041.2-73.6%2089.2-96.2%20142.7-23.2%2055.4-35.1%20114.2-35.1%20174.8%200%2060.6%2011.9%20119.4%2035.3%20174.8%2022.6%2053.4%2054.9%20101.5%2096.2%20142.7%2041.2%2041.2%2089.2%2073.6%20142.7%2096.2%2055.4%2023.4%20114.1%2035.3%20174.8%2035.3%2060.6%200%20119.4-11.9%20174.8-35.3%2053.4-22.6%20101.5-55%20142.7-96.2%2041.2-41.2%2073.6-89.2%2096.2-142.7%2023.4-55.4%2035.3-114.1%2035.3-174.8%200.1-60.7-12-119.4-35.5-174.8zM507.4%20891.8c-211.8%200-384.1-172.3-384.1-384.1s172.3-384.1%20384.1-384.1%20384.1%20172.3%20384.1%20384.1-172.3%20384.1-384.1%20384.1z'%20p-id='1223'%3e%3c/path%3e%3cpath%20d='M350.8%20438.1c31%200%2056.2-25.1%2056.2-56.2%200-31-25.1-56.2-56.2-56.2-31%200-56.2%2025.1-56.2%2056.2%200.1%2031.1%2025.2%2056.2%2056.2%2056.2zM664.1%20438.1c31%200%2056.2-25.1%2056.2-56.2%200-31-25.1-56.2-56.2-56.2-31%200-56.2%2025.1-56.2%2056.2s25.2%2056.2%2056.2%2056.2zM330.1%20687c10.7%200%2020.6-5.3%2026.7-14.1%2033.1-47.5%2088.2-78.7%20150.5-78.7s117.4%2031.2%20150.6%2078.7c6.1%208.7%2016%2014%2026.7%2014h0.2c26.1%200%2041.6-29.4%2026.6-50.8-8.4-12-17.9-23.3-28.4-33.9-46.9-46.9-109.2-72.7-175.5-72.7S378.8%20555.3%20332%20602.2c-10.6%2010.6-20.1%2021.9-28.4%2033.9-15%2021.5%200.4%2050.9%2026.5%2050.9z'%20p-id='1224'%3e%3c/path%3e%3c/svg%3e", Ka = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1785121261852'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='1386'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M919.3%20332.2c-22.6-53.4-55-101.5-96.2-142.7-41.2-41.2-89.2-73.6-142.7-96.2C625%2069.9%20566.2%2058%20505.6%2058%20445%2058%20386.2%2069.9%20330.8%2093.3c-53.4%2022.6-101.5%2054.9-142.7%2096.2-41.2%2041.2-73.6%2089.2-96.2%20142.7C68.7%20387.6%2056.8%20446.4%2056.8%20507c0%2060.6%2011.9%20119.4%2035.3%20174.8%2022.6%2053.4%2054.9%20101.5%2096.2%20142.7%2041.2%2041.2%2089.2%2073.6%20142.7%2096.2%2055.4%2023.4%20114.1%2035.3%20174.8%2035.3%2060.6%200%20119.4-11.9%20174.8-35.3%2053.4-22.6%20101.5-55%20142.7-96.2%2041.2-41.2%2073.6-89.2%2096.2-142.7%2023.4-55.4%2035.3-114.1%2035.3-174.8%200-60.7-12.1-119.4-35.5-174.8zM505.7%20891.1c-211.8%200-384.1-172.3-384.1-384.1s172.3-384.1%20384.1-384.1S889.8%20295.2%20889.8%20507%20717.5%20891.1%20505.7%20891.1z'%20p-id='1387'%3e%3c/path%3e%3cpath%20d='M719.2%20527.9c-16%200-29.7%2011.7-32%2027.6-13.2%2088.2-89.4%20156-181.3%20156s-168.2-67.8-181.5-156c-2.4-15.8-16-27.5-32-27.5-19.9%200-35%2017.7-32%2037.4%207.8%2052.1%2032%20100.2%2069.9%20138.1%2046.9%2046.9%20109.2%2072.7%20175.5%2072.7s128.7-25.8%20175.5-72.7c38-37.9%2062.1-86%2069.9-138.1%203-19.8-12.1-37.5-32-37.5zM349.2%20438.4c31%200%2056.2-25.1%2056.2-56.2%200-31-25.1-56.2-56.2-56.2-31%200-56.2%2025.1-56.2%2056.2s25.1%2056.2%2056.2%2056.2zM662.4%20438.4c31%200%2056.2-25.1%2056.2-56.2%200-31-25.1-56.2-56.2-56.2-31%200-56.2%2025.1-56.2%2056.2s25.2%2056.2%2056.2%2056.2z'%20p-id='1388'%3e%3c/path%3e%3c/svg%3e", qa = { class: "swed-header-embeds" }, Ja = ["width"], Ya = {
11614
11642
  xmlns: "http://www.w3.org/1999/xhtml",
11615
11643
  class: "swed-header-paper-name"
11616
- }, Ya = { class: "swed-input-box" }, Xa = { class: "swed-input-box__label" }, Za = ["contenteditable"], Qa = ["width"], $a = {
11644
+ }, Xa = { class: "swed-input-box" }, Za = { class: "swed-input-box__label" }, Qa = ["contenteditable"], $a = ["width"], eo = {
11617
11645
  xmlns: "http://www.w3.org/1999/xhtml",
11618
11646
  class: "swed-header-student-info"
11619
- }, eo = {
11647
+ }, to = {
11620
11648
  "data-region": "qr-code",
11621
11649
  style: {
11622
11650
  display: "flex",
@@ -11625,13 +11653,13 @@ var La = ["transform"], Ra = ["width"], za = {
11625
11653
  "flex-shrink": "0",
11626
11654
  border: "1px solid #000"
11627
11655
  }
11628
- }, to = ["src"], no = { class: "swed-student-fields" }, ro = { class: "swed-student-code" }, io = { "data-region": "student-code" }, ao = {
11656
+ }, no = ["src"], ro = { class: "swed-student-fields" }, io = { class: "swed-student-code" }, ao = { "data-region": "student-code" }, oo = {
11629
11657
  "student-code-num": "8",
11630
11658
  class: "swed-student-code-table studyNo"
11631
- }, oo = {
11659
+ }, so = {
11632
11660
  class: "swed-student-code-filler",
11633
11661
  "data-region": "student-code-filler"
11634
- }, so = { class: "swed-filler-time" }, co = ["src"], lo = { class: "swed-filler-self-eval" }, uo = ["src"], fo = ["src"], po = "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", mo = /* @__PURE__ */ l({
11662
+ }, co = { class: "swed-filler-time" }, lo = ["src"], uo = { class: "swed-filler-self-eval" }, fo = ["src"], po = ["src"], mo = "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", ho = /* @__PURE__ */ l({
11635
11663
  __name: "HeaderEvenPage",
11636
11664
  props: {
11637
11665
  schoolName: {},
@@ -11644,8 +11672,8 @@ var La = ["transform"], Ra = ["width"], za = {
11644
11672
  editable: { type: Boolean }
11645
11673
  },
11646
11674
  setup(t) {
11647
- return (n, r) => (y(), i("g", Ka, [
11648
- c(Ha, {
11675
+ return (n, r) => (y(), i("g", qa, [
11676
+ c(Ua, {
11649
11677
  "school-name": t.schoolName,
11650
11678
  "total-score": t.totalScore,
11651
11679
  "content-x": 0,
@@ -11667,7 +11695,7 @@ var La = ["transform"], Ra = ["width"], za = {
11667
11695
  height: "40",
11668
11696
  "data-region": "paper-name",
11669
11697
  opacity: "1"
11670
- }, [a("div", Ja, [a("div", Ya, [a("label", Xa, E(t.paperName), 1), a("div", {
11698
+ }, [a("div", Ya, [a("div", Xa, [a("label", Za, E(t.paperName), 1), a("div", {
11671
11699
  id: "paperName",
11672
11700
  contenteditable: t.editable,
11673
11701
  class: m([
@@ -11676,49 +11704,49 @@ var La = ["transform"], Ra = ["width"], za = {
11676
11704
  { "swed-editable-dashed": t.editable }
11677
11705
  ]),
11678
11706
  "data-editable": "paperName"
11679
- }, E(t.paperName), 11, Za)])])], 8, qa)),
11707
+ }, E(t.paperName), 11, Qa)])])], 8, Ja)),
11680
11708
  (y(), i("foreignObject", {
11681
11709
  class: "swed-header-block swed-header-block--student-info",
11682
11710
  transform: "translate(0, 70)",
11683
11711
  width: t.contentWidth,
11684
11712
  height: "100",
11685
11713
  opacity: "1"
11686
- }, [a("div", $a, [a("div", eo, [a("img", {
11687
- src: t.qrCodeImage || po,
11714
+ }, [a("div", eo, [a("div", to, [a("img", {
11715
+ src: t.qrCodeImage || mo,
11688
11716
  style: {
11689
11717
  width: "60px",
11690
11718
  height: "60px",
11691
11719
  display: "block"
11692
11720
  }
11693
- }, null, 8, to), r[0] ||= a("span", { style: {
11721
+ }, null, 8, no), r[0] ||= a("span", { style: {
11694
11722
  "font-size": "10px",
11695
11723
  "line-height": "12px",
11696
11724
  color: "#000",
11697
11725
  "font-family": "'simsun','PingFang SC',sans-serif",
11698
11726
  "white-space": "nowrap"
11699
- } }, "旺豆老师", -1)]), a("div", no, [r[4] ||= o("<div class=\"swed-student-fields-row\"><div class=\"swed-student-field\" data-region=\"student-name\"><span class=\"swed-label\">姓名:</span><div class=\"swed-underline\"></div></div><div class=\"swed-student-field\" data-region=\"student-class\"><span class=\"swed-label\">班级:</span><div class=\"swed-underline\"></div></div></div>", 1), a("div", ro, [a("span", io, [r[1] ||= s("准考证号: ", -1), a("table", ao, [a("tbody", null, [a("tr", null, [(y(), i(e, null, C(8, (e) => a("td", {
11727
+ } }, "旺豆老师", -1)]), a("div", ro, [r[4] ||= o("<div class=\"swed-student-fields-row\"><div class=\"swed-student-field\" data-region=\"student-name\"><span class=\"swed-label\">姓名:</span><div class=\"swed-underline\"></div></div><div class=\"swed-student-field\" data-region=\"student-class\"><span class=\"swed-label\">班级:</span><div class=\"swed-underline\"></div></div></div>", 1), a("div", io, [a("span", ao, [r[1] ||= s("准考证号: ", -1), a("table", oo, [a("tbody", null, [a("tr", null, [(y(), i(e, null, C(8, (e) => a("td", {
11700
11728
  key: e,
11701
11729
  class: "swed-student-code-cell"
11702
- })), 64))])])])]), a("div", oo, [a("div", so, [a("img", {
11703
- src: D(Ua),
11730
+ })), 64))])])])]), a("div", so, [a("div", co, [a("img", {
11731
+ src: D(Wa),
11704
11732
  class: "swed-filler-icon",
11705
11733
  alt: "用时"
11706
- }, null, 8, co), r[2] ||= a("span", { class: "swed-filler-text" }, "用时:______分", -1)]), a("div", lo, [
11734
+ }, null, 8, lo), r[2] ||= a("span", { class: "swed-filler-text" }, "用时:______分", -1)]), a("div", uo, [
11707
11735
  r[3] ||= a("span", { class: "swed-filler-label" }, "自评:", -1),
11708
11736
  a("img", {
11709
- src: D(Wa),
11737
+ src: D(Ga),
11710
11738
  class: "swed-filler-icon",
11711
11739
  alt: "不满意"
11712
- }, null, 8, uo),
11740
+ }, null, 8, fo),
11713
11741
  a("img", {
11714
- src: D(Ga),
11742
+ src: D(Ka),
11715
11743
  class: "swed-filler-icon",
11716
11744
  alt: "满意"
11717
- }, null, 8, fo)
11718
- ])])])])])], 8, Qa))
11745
+ }, null, 8, po)
11746
+ ])])])])])], 8, $a))
11719
11747
  ]));
11720
11748
  }
11721
- }), ho = { class: "swed-header-embeds" }, go = { xmlns: "http://www.w3.org/1999/xhtml" }, _o = ["src"], vo = 30, yo = 5, bo = /* @__PURE__ */ l({
11749
+ }), go = { class: "swed-header-embeds" }, _o = { xmlns: "http://www.w3.org/1999/xhtml" }, vo = ["src"], yo = 30, bo = 5, xo = /* @__PURE__ */ l({
11722
11750
  __name: "HeaderOddPage",
11723
11751
  props: {
11724
11752
  schoolName: {},
@@ -11730,12 +11758,12 @@ var La = ["transform"], Ra = ["width"], za = {
11730
11758
  editable: { type: Boolean }
11731
11759
  },
11732
11760
  setup(e) {
11733
- return (t, n) => (y(), i("g", ho, [(y(), i("foreignObject", {
11761
+ return (t, n) => (y(), i("g", go, [(y(), i("foreignObject", {
11734
11762
  transform: "translate(0, -4)",
11735
- width: vo,
11763
+ width: yo,
11736
11764
  height: "30",
11737
11765
  opacity: "1"
11738
- }, [a("div", go, [a("img", {
11766
+ }, [a("div", _o, [a("img", {
11739
11767
  src: e.qrCodeImage || "",
11740
11768
  style: {
11741
11769
  width: "30px",
@@ -11743,11 +11771,11 @@ var La = ["transform"], Ra = ["width"], za = {
11743
11771
  border: "1px solid #000",
11744
11772
  display: "block"
11745
11773
  }
11746
- }, null, 8, _o)])])), c(Ha, {
11774
+ }, null, 8, vo)])])), c(Ua, {
11747
11775
  "school-name": e.schoolName,
11748
11776
  "total-score": e.totalScore,
11749
- "content-x": e.contentX + vo + yo,
11750
- "content-width": e.contentWidth - vo - yo,
11777
+ "content-x": e.contentX + yo + bo,
11778
+ "content-width": e.contentWidth - yo - bo,
11751
11779
  "offset-y": 0,
11752
11780
  "show-score": e.showScore,
11753
11781
  editable: e.editable
@@ -11760,14 +11788,14 @@ var La = ["transform"], Ra = ["width"], za = {
11760
11788
  "editable"
11761
11789
  ])]));
11762
11790
  }
11763
- }), xo = { class: "swed-footer-embeds" }, So = {
11791
+ }), So = { class: "swed-footer-embeds" }, Co = {
11764
11792
  class: "swed-paragraph",
11765
11793
  transform: "translate(0, 0)"
11766
- }, Co = {
11794
+ }, wo = {
11767
11795
  class: "swed-line",
11768
11796
  transform: "translate(0, 0)",
11769
11797
  baseline: "19.6"
11770
- }, wo = ["x"], To = /* @__PURE__ */ l({
11798
+ }, To = ["x"], Eo = /* @__PURE__ */ l({
11771
11799
  __name: "FooterPageNumber",
11772
11800
  props: {
11773
11801
  pageIndex: {},
@@ -11779,10 +11807,10 @@ var La = ["transform"], Ra = ["width"], za = {
11779
11807
  let e = r.value.split(""), t = n.contentWidth / 2 - e.length * 6;
11780
11808
  return e.map((e, n) => (t + n * 12).toFixed(2)).join(" ");
11781
11809
  });
11782
- return (e, t) => (y(), i("g", xo, [t[0] ||= a("g", {
11810
+ return (e, t) => (y(), i("g", So, [t[0] ||= a("g", {
11783
11811
  class: "swed-anchor",
11784
11812
  transform: "translate(0, 0)"
11785
- }, null, -1), a("g", So, [a("g", Co, [a("text", {
11813
+ }, null, -1), a("g", Co, [a("g", wo, [a("text", {
11786
11814
  class: "swed-text",
11787
11815
  "data-region": "page-number",
11788
11816
  "xml:space": "preserve",
@@ -11793,12 +11821,12 @@ var La = ["transform"], Ra = ["width"], za = {
11793
11821
  "fill-opacity": "1",
11794
11822
  x: o.value,
11795
11823
  y: "19.6"
11796
- }, E(r.value), 9, wo)])])]));
11824
+ }, E(r.value), 9, To)])])]));
11797
11825
  }
11798
11826
  });
11799
11827
  //#endregion
11800
11828
  //#region src/composables/useVueRenderer.ts
11801
- function Eo(e, t, n, r, i, a, o, s, c, l, u, d = 1) {
11829
+ function Do(e, t, n, r, i, a, o, s, c, l, u, d = 1) {
11802
11830
  let f = e.width, p = e.height, [m, h, g, _] = i.margins || [
11803
11831
  56,
11804
11832
  55.5,
@@ -11809,7 +11837,7 @@ function Eo(e, t, n, r, i, a, o, s, c, l, u, d = 1) {
11809
11837
  let E = Array.from(T.entries()).sort(([e], [t]) => e - t).map(([, e]) => e), D = "";
11810
11838
  D += `<svg xmlns="http://www.w3.org/2000/svg" width="${f * d}" height="${p * d}" viewBox="0 0 ${f} ${p}" class="paper-page">\n`, D += "<defs><g id=\"enter\"><path d=\"M810.667 213.333a42.667 42.667 0 0 1 42.368 37.675l0.298 4.992v274.304c0 79.275-50.944 147.499-120.49 152.107l-7.51 0.256H273.707l97.792 97.834a42.667 42.667 0 0 1-56.32 63.872l-4.011-3.541-170.667-170.667a42.667 42.667 0 0 1 0-60.33l170.667-170.667a42.667 42.667 0 0 1 63.872 56.32l-3.541 4.01-97.792 97.835h451.626c19.584 0 39.936-24.618 42.411-59.861l0.256-7.168V256a42.667 42.667 0 0 1 42.667-42.667z\" fill=\"currentColor\"/></g></defs>\n", D += " <g class=\"swed-background\"></g>\n", D += ` <g class="swed-header" transform="translate(${_}, ${i.headerTop ?? 18})">\n`, D += " <g class=\"swed-header-content\"></g>\n";
11811
11839
  let O = c[t] || s || "", k = e.width > e.height && x > 1 ? S : y;
11812
- t % 2 == 0 ? D += Do(mo, {
11840
+ t % 2 == 0 ? D += Oo(ho, {
11813
11841
  schoolName: o,
11814
11842
  paperName: a,
11815
11843
  totalScore: l,
@@ -11818,7 +11846,7 @@ function Eo(e, t, n, r, i, a, o, s, c, l, u, d = 1) {
11818
11846
  showScore: i.showScore ?? !0,
11819
11847
  qrCodeImage: O,
11820
11848
  editable: u === "edit"
11821
- }) : D += Do(bo, {
11849
+ }) : D += Oo(xo, {
11822
11850
  schoolName: o,
11823
11851
  totalScore: l,
11824
11852
  contentWidth: k,
@@ -11826,11 +11854,11 @@ function Eo(e, t, n, r, i, a, o, s, c, l, u, d = 1) {
11826
11854
  showScore: i.showScore ?? !0,
11827
11855
  qrCodeImage: O,
11828
11856
  editable: u === "edit"
11829
- }), D += " </g>\n", D += " </g>\n", D += ` <g class="swed-footer" transform="translate(${_}, ${C.toFixed(2)})">\n`, D += " <g class=\"swed-footer-content\">\n", D += Do(To, {
11857
+ }), D += " </g>\n", D += " </g>\n", D += ` <g class="swed-footer" transform="translate(${_}, ${C.toFixed(2)})">\n`, D += " <g class=\"swed-footer-content\">\n", D += Oo(Eo, {
11830
11858
  pageIndex: t,
11831
11859
  totalPages: n,
11832
11860
  contentWidth: y
11833
- }), D += " </g>\n", D += " <g class=\"swed-footer-embeds\">\n", D += Ia(), D += " </g>\n", D += " </g>\n", D += " <g class=\"swed-layout\">\n";
11861
+ }), D += " </g>\n", D += " <g class=\"swed-footer-embeds\">\n", D += La(), D += " </g>\n", D += " </g>\n", D += " <g class=\"swed-layout\">\n";
11834
11862
  for (let t of e.cornerMarks) {
11835
11863
  let [e, n, r, i] = t.bbox;
11836
11864
  D += ` <rect fill="black" x="${e}" y="${n}" width="${r}" height="${i}"></rect>\n`;
@@ -11861,7 +11889,7 @@ function Eo(e, t, n, r, i, a, o, s, c, l, u, d = 1) {
11861
11889
  pageBlock: a,
11862
11890
  blocks: r
11863
11891
  };
11864
- D += Do(o.component, {
11892
+ D += Oo(o.component, {
11865
11893
  block: e,
11866
11894
  ctx: s
11867
11895
  });
@@ -11897,7 +11925,7 @@ function Eo(e, t, n, r, i, a, o, s, c, l, u, d = 1) {
11897
11925
  }
11898
11926
  return D += " </g>\n", D += " </g>\n", D += " </g>\n", D += "</svg>\n", D;
11899
11927
  }
11900
- function Do(e, t) {
11928
+ function Oo(e, t) {
11901
11929
  let n = document.createElement("div");
11902
11930
  try {
11903
11931
  S(d(e, t), n);
@@ -11907,27 +11935,27 @@ function Do(e, t) {
11907
11935
  return "";
11908
11936
  }
11909
11937
  }
11910
- function Oo(e, n = {}) {
11938
+ function ko(e, n = {}) {
11911
11939
  return t(() => {
11912
11940
  e.renderMode.value;
11913
11941
  let t = e.pages.value;
11914
11942
  if (t.length === 0) return [];
11915
11943
  let r = n.zoom, i = typeof r == "number" ? r : r?.value ?? 1, a = t.length, o = e.blocks.value, s = e.settings.value;
11916
- return t.map((t, n) => Eo(t, n, a, o, s, e.paperName.value, e.schoolName.value, e.qrCodeImage.value, e.qrCodeImages.value, e.totalScore.value, e.renderMode.value, i));
11944
+ return t.map((t, n) => Do(t, n, a, o, s, e.paperName.value, e.schoolName.value, e.qrCodeImage.value, e.qrCodeImages.value, e.totalScore.value, e.renderMode.value, i));
11917
11945
  });
11918
11946
  }
11919
- function ko(e) {
11947
+ function Ao(e) {
11920
11948
  let t = e.pages.value;
11921
11949
  if (t.length === 0) return [];
11922
11950
  let n = e.blocks.value, r = e.settings.value;
11923
- return t.map((i, a) => Eo(i, a, t.length, n, r, e.paperName.value, e.schoolName.value, e.qrCodeImage.value, e.qrCodeImages.value, e.totalScore.value, "view", 1));
11951
+ return t.map((i, a) => Do(i, a, t.length, n, r, e.paperName.value, e.schoolName.value, e.qrCodeImage.value, e.qrCodeImages.value, e.totalScore.value, "view", 1));
11924
11952
  }
11925
- function Ao(e) {
11953
+ function jo(e) {
11926
11954
  let t = e.pages.value;
11927
11955
  if (t.length === 0) return "";
11928
11956
  let n = e.blocks.value, r = e.settings.value, i = t[0].width, a = t[0].height, o = t.length * a;
11929
11957
  var s = t.map(function(i, a) {
11930
- return Eo(i, a, t.length, n, r, e.paperName.value, e.schoolName.value, e.qrCodeImage.value, e.qrCodeImages.value, e.totalScore.value, "view", 1);
11958
+ return Do(i, a, t.length, n, r, e.paperName.value, e.schoolName.value, e.qrCodeImage.value, e.qrCodeImages.value, e.totalScore.value, "view", 1);
11931
11959
  }).map(function(e, t) {
11932
11960
  var n = t * a, r = e.match(/<svg[^>]*>([\s\S]*)<\/svg>/), i = r ? r[1] : e;
11933
11961
  return "<g class=\"swed-page\" transform=\"translate(0, " + n + ")\">\n" + i + "</g>";
@@ -11936,8 +11964,8 @@ function Ao(e) {
11936
11964
  }
11937
11965
  //#endregion
11938
11966
  //#region src/composables/usePaperCursor.ts
11939
- var jo = 0;
11940
- function Mo(e, t, n, r) {
11967
+ var Mo = 0;
11968
+ function No(e, t, n, r) {
11941
11969
  let i = x({
11942
11970
  blockId: null,
11943
11971
  paraIndex: 0,
@@ -12369,7 +12397,7 @@ function Mo(e, t, n, r) {
12369
12397
  let e = U(t.value);
12370
12398
  return {
12371
12399
  type: "underline",
12372
- id: `ul-cursor-${Date.now()}-${++jo}`,
12400
+ id: `ul-cursor-${Date.now()}-${++Mo}`,
12373
12401
  width: 80,
12374
12402
  height: e * 1.4,
12375
12403
  placeholder: "空",
@@ -12497,13 +12525,13 @@ function Mo(e, t, n, r) {
12497
12525
  }
12498
12526
  //#endregion
12499
12527
  //#region src/components/PaperEditor.vue?vue&type=script&setup=true&lang.ts
12500
- var No = { class: "pe-root" }, Po = { class: "pe-main" }, Fo = { class: "pe-editor" }, Io = { class: "pe-editor-pages" }, Lo = ["onClick"], Ro = ["innerHTML"], zo = { class: "pe-editor-controllers" }, Bo = {
12528
+ var Po = { class: "pe-root" }, Fo = { class: "pe-main" }, Io = { class: "pe-editor" }, Lo = { class: "pe-editor-pages" }, Ro = ["onClick"], zo = ["innerHTML"], Bo = { class: "pe-editor-controllers" }, Vo = {
12501
12529
  key: 0,
12502
12530
  class: "pe-ctrl-sub"
12503
- }, Vo = {
12531
+ }, Ho = {
12504
12532
  key: 1,
12505
12533
  class: "pe-ctrl-sub"
12506
- }, Ho = ["title"], Uo = /*#__PURE__*/ Mn(/* @__PURE__ */ l({
12534
+ }, Uo = ["title"], Wo = /*#__PURE__*/ Mn(/* @__PURE__ */ l({
12507
12535
  __name: "PaperEditor",
12508
12536
  props: {
12509
12537
  initialData: {},
@@ -12525,7 +12553,7 @@ var No = { class: "pe-root" }, Po = { class: "pe-main" }, Fo = { class: "pe-edit
12525
12553
  "loaded"
12526
12554
  ],
12527
12555
  setup(n, { expose: o, emit: s }) {
12528
- let c = n, l = s, u = ta({ renderMode: c.renderMode }), d = Mo(u.blocks, u.settings, () => {
12556
+ let c = n, l = s, u = ta({ renderMode: c.renderMode }), d = No(u.blocks, u.settings, () => {
12529
12557
  u.reflowAllBlocks(), u.relayout(), p(() => w.value?.focus());
12530
12558
  }, () => {
12531
12559
  u.isDirty.value = !0;
@@ -12653,14 +12681,14 @@ var No = { class: "pe-root" }, Po = { class: "pe-main" }, Fo = { class: "pe-edit
12653
12681
  for (let e = n; e <= r; e++) i.push(e);
12654
12682
  u.toggleAnswerArea(e.blockId, i);
12655
12683
  }
12656
- let I = Oo(u, {
12684
+ let I = ko(u, {
12657
12685
  zoom: f,
12658
12686
  selectedBlockId: u.selectedBlockId
12659
12687
  });
12660
12688
  function le() {
12661
- return ko(u);
12689
+ return Ao(u);
12662
12690
  }
12663
- let ue = t(() => Ao(u));
12691
+ let ue = t(() => jo(u));
12664
12692
  function de() {
12665
12693
  u.relayout(), h.value >= u.pages.value.length && (h.value = Math.max(0, u.pages.value.length - 1)), L();
12666
12694
  }
@@ -13521,8 +13549,8 @@ var No = { class: "pe-root" }, Po = { class: "pe-main" }, Fo = { class: "pe-edit
13521
13549
  u.patchBlock(e, { metadata: t }), l("change");
13522
13550
  },
13523
13551
  configureAI: (e) => Ea(e),
13524
- analyzeQuestion: (e) => Pa(e, ct),
13525
- generateScoreRule: (e) => Fa(e, ct)
13552
+ analyzeQuestion: (e) => Fa(e, ct),
13553
+ generateScoreRule: (e) => Ia(e, ct)
13526
13554
  },
13527
13555
  layout: {
13528
13556
  setPaperSize: (e) => {
@@ -13596,7 +13624,7 @@ var No = { class: "pe-root" }, Po = { class: "pe-main" }, Fo = { class: "pe-edit
13596
13624
  qrCodeImages: u.qrCodeImages.value,
13597
13625
  showScore: u.settings.value.showScore
13598
13626
  }))
13599
- }), (t, n) => (y(), i("div", No, [a("div", Po, [a("div", Fo, [a("div", {
13627
+ }), (t, n) => (y(), i("div", Po, [a("div", Fo, [a("div", Io, [a("div", {
13600
13628
  class: "pe-editor-surface",
13601
13629
  ref_key: "saberEditorRef",
13602
13630
  ref: S
@@ -13605,7 +13633,7 @@ var No = { class: "pe-root" }, Po = { class: "pe-main" }, Fo = { class: "pe-edit
13605
13633
  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",
13606
13634
  fill: "currentColor"
13607
13635
  })])])], -1),
13608
- a("div", Io, [(y(!0), i(e, null, C(D(I), (e, t) => (y(), i("div", {
13636
+ a("div", Lo, [(y(!0), i(e, null, C(D(I), (e, t) => (y(), i("div", {
13609
13637
  key: t,
13610
13638
  class: m(["pe-editor-page", { active: t === h.value }]),
13611
13639
  onClick: j((e) => h.value = t, ["stop"])
@@ -13614,8 +13642,8 @@ var No = { class: "pe-root" }, Po = { class: "pe-main" }, Fo = { class: "pe-edit
13614
13642
  innerHTML: e,
13615
13643
  onClick: me,
13616
13644
  onFocusout: he
13617
- }, null, 40, Ro)], 10, Lo))), 128))]),
13618
- a("div", zo, [
13645
+ }, null, 40, zo)], 10, Ro))), 128))]),
13646
+ a("div", Bo, [
13619
13647
  R.value ? (y(), i("div", {
13620
13648
  key: 0,
13621
13649
  class: "pe-ctrl-block",
@@ -13634,11 +13662,11 @@ var No = { class: "pe-root" }, Po = { class: "pe-main" }, Fo = { class: "pe-edit
13634
13662
  "fill-rule": "evenodd",
13635
13663
  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"
13636
13664
  })], -1)]], 32),
13637
- B.value ? (y(), i("div", Bo, [a("button", {
13665
+ B.value ? (y(), i("div", Vo, [a("button", {
13638
13666
  class: "pe-merge-btn",
13639
13667
  onMousedown: j(ye, ["stop"])
13640
13668
  }, "合并子题", 32)])) : r("", !0),
13641
- ve.value ? (y(), i("div", Vo, [a("button", {
13669
+ ve.value ? (y(), i("div", Ho, [a("button", {
13642
13670
  class: "pe-split-btn",
13643
13671
  onMousedown: j(be, ["stop"])
13644
13672
  }, "拆分子题", 32)])) : r("", !0)
@@ -13744,16 +13772,16 @@ var No = { class: "pe-root" }, Po = { class: "pe-main" }, Fo = { class: "pe-edit
13744
13772
  class: "pe-align-btn pe-aa-cancel-btn",
13745
13773
  onMousedown: j(ce, ["prevent", "stop"]),
13746
13774
  title: P.value ? "取消作答区(变普通空行)" : "恢复为作答区"
13747
- }, E(P.value ? "非作答位" : "恢复作答"), 41, Ho)) : r("", !0)], 4)) : r("", !0)
13775
+ }, E(P.value ? "非作答位" : "恢复作答"), 41, Uo)) : r("", !0)], 4)) : r("", !0)
13748
13776
  ], 512)])])]));
13749
13777
  }
13750
- }), [["__scopeId", "data-v-090d561e"]]), Wo = { class: "pe-preview__pages" }, Go = ["innerHTML"], Ko = {
13778
+ }), [["__scopeId", "data-v-090d561e"]]), Go = { class: "pe-preview__pages" }, Ko = ["innerHTML"], qo = {
13751
13779
  key: 0,
13752
13780
  class: "pe-preview__helpers"
13753
- }, qo = {
13781
+ }, Jo = {
13754
13782
  key: 1,
13755
13783
  class: "pe-preview__page-num"
13756
- }, Jo = /*#__PURE__*/ Mn(/* @__PURE__ */ l({
13784
+ }, Yo = /*#__PURE__*/ Mn(/* @__PURE__ */ l({
13757
13785
  __name: "PaperPreview",
13758
13786
  props: {
13759
13787
  document: {},
@@ -13787,7 +13815,7 @@ var No = { class: "pe-root" }, Po = { class: "pe-main" }, Fo = { class: "pe-edit
13787
13815
  c(), k(() => o.document, c), k(() => o.pureMode, (e) => {
13788
13816
  s.setRenderMode(e ? "view" : "edit");
13789
13817
  }, { immediate: !0 });
13790
- let l = Oo(s), u = x(), d = x(0), f = null;
13818
+ let l = ko(s), u = x(), d = x(0), f = null;
13791
13819
  _(() => {
13792
13820
  d.value = u.value?.clientWidth ?? 0, f = new ResizeObserver((e) => {
13793
13821
  for (let t of e) d.value = Math.floor(t.contentRect.width);
@@ -13976,7 +14004,7 @@ var No = { class: "pe-root" }, Po = { class: "pe-main" }, Fo = { class: "pe-edit
13976
14004
  class: m(["pe-preview", { "pe-preview--print": n.mode === "print" }]),
13977
14005
  ref_key: "previewRef",
13978
14006
  ref: u
13979
- }, [a("div", Wo, [(y(!0), i(e, null, C(D(l), (t, o) => (y(), i("div", {
14007
+ }, [a("div", Go, [(y(!0), i(e, null, C(D(l), (t, o) => (y(), i("div", {
13980
14008
  key: o,
13981
14009
  class: "pe-preview__page",
13982
14010
  style: g(A(o))
@@ -13990,8 +14018,8 @@ var No = { class: "pe-root" }, Po = { class: "pe-main" }, Fo = { class: "pe-edit
13990
14018
  width: "100%",
13991
14019
  height: "100%"
13992
14020
  }
13993
- }, null, 8, Go)], 4),
13994
- n.showHelpers ? (y(), i("div", Ko, [n.showCornerMarks ? (y(!0), i(e, { key: 0 }, C(T(o), (e, t) => (y(), i("span", {
14021
+ }, null, 8, Ko)], 4),
14022
+ n.showHelpers ? (y(), i("div", qo, [n.showCornerMarks ? (y(!0), i(e, { key: 0 }, C(T(o), (e, t) => (y(), i("span", {
13995
14023
  key: "cm-" + t,
13996
14024
  class: m(["pe-preview__helper-box", e.className]),
13997
14025
  style: g(M(e))
@@ -14000,9 +14028,9 @@ var No = { class: "pe-root" }, Po = { class: "pe-main" }, Fo = { class: "pe-edit
14000
14028
  class: m(["pe-preview__helper-box", e.className]),
14001
14029
  style: g(M(e))
14002
14030
  }, null, 6))), 128)) : r("", !0)])) : r("", !0),
14003
- n.showPageNumbers ? (y(), i("div", qo, E(o + 1) + " / " + E(D(s).pages.value.length), 1)) : r("", !0)
14031
+ n.showPageNumbers ? (y(), i("div", Jo, E(o + 1) + " / " + E(D(s).pages.value.length), 1)) : r("", !0)
14004
14032
  ], 4))), 128))])], 2));
14005
14033
  }
14006
14034
  }), [["__scopeId", "data-v-4c12d2f4"]]);
14007
14035
  //#endregion
14008
- export { ht as AutoLayout, Ie as FONT_SIZE_MAP, oe as PAPER_DIMENSIONS, F as PAPER_MM, Uo as PaperEditor, gt as PaperLayout, Jo as PaperPreview, Pa as analyzeQuestion, Na as applyAIRaw, ka as buildAIRequest, Oa as buildAnalyzeInput, Zr as buildAnswerHtml, Yr as buildPaperHtml, ve as calcCharPositions, B as calcTextWidth, Aa as callLLM, H as clearFormulaCache, V as clearWidthCache, Ea as configureAI, Sr as deserializeDocument, qr as extractBaseTitle, Le as fontSizeLabelToPx, Re as fontSizePxToLabel, qe as formatQuestionNo, Kr as formatSectionTitle, Je as formatSubLabel, Fa as generateScoreRule, Y as getAIConfig, z as getCharWidth, ce as getPaperPreset, ko as getVueRendererCleanSvgs, Qi as hasTablePlaceholder, Da as isAIReady, we as latexToSvg, Ae as latexToSvgBatch, Ma as parseAIRaw, Dr as parseQuestionHtml, Br as parseQuestionJson, Hn as registerDefaultRenderers, Ao as renderAllPagesAsSingleSvg, Xi as renderTablePlaceholders, xr as serializeDocument, le as toBBox, Gr as toChineseOrdinal, ta as usePaperCore, Oo as useVueRenderer, Gi as whenTablesReady };
14036
+ export { ht as AutoLayout, Ie as FONT_SIZE_MAP, oe as PAPER_DIMENSIONS, F as PAPER_MM, Wo as PaperEditor, gt as PaperLayout, Yo as PaperPreview, Fa as analyzeQuestion, Pa as applyAIRaw, ka as buildAIRequest, Oa as buildAnalyzeInput, Zr as buildAnswerHtml, Yr as buildPaperHtml, ve as calcCharPositions, B as calcTextWidth, Aa as callLLM, H as clearFormulaCache, V as clearWidthCache, Ea as configureAI, Sr as deserializeDocument, qr as extractBaseTitle, Le as fontSizeLabelToPx, Re as fontSizePxToLabel, qe as formatQuestionNo, Kr as formatSectionTitle, Je as formatSubLabel, Ia as generateScoreRule, Y as getAIConfig, z as getCharWidth, ce as getPaperPreset, Ao as getVueRendererCleanSvgs, Qi as hasTablePlaceholder, Da as isAIReady, we as latexToSvg, Ae as latexToSvgBatch, Na as parseAIRaw, Dr as parseQuestionHtml, Br as parseQuestionJson, Hn as registerDefaultRenderers, jo as renderAllPagesAsSingleSvg, Xi as renderTablePlaceholders, xr as serializeDocument, le as toBBox, Gr as toChineseOrdinal, ta as usePaperCore, ko as useVueRenderer, Gi as whenTablesReady };
@@ -13,7 +13,7 @@
13
13
  */
14
14
  import type { ContentBlock } from '../types/paper';
15
15
  import type { AIConfig, AIRequest, AIResult, AnalyzeQuestionInput, AnalyzeQuestionResult, EditorMutations, GenerateScoreRuleResult, QuestionInput } from './types';
16
- export type { AIConfig, AIRequest, AIResult, EditorMutations } from './types';
16
+ export type { AIConfig, AIFetcher, AIFetchInit, AIFetcherResponse, AIRequest, AIResult, EditorMutations } from './types';
17
17
  /** 初始化:配置 OpenAI 兼容 LLM 网关地址(宿主初始化时调用一次即可) */
18
18
  export declare function configureAI(config: AIConfig): void;
19
19
  /** 是否已配置 AI 网关 */
@@ -6,6 +6,21 @@
6
6
  * 全部由内核完成。
7
7
  */
8
8
  import type { ContentBlock, UnderlineInline } from '../types/paper';
9
+ /** 请求执行器返回的最小响应接口(原生 Response / 宿主包装对象均满足) */
10
+ export interface AIFetcherResponse {
11
+ ok: boolean;
12
+ status: number;
13
+ text(): Promise<string>;
14
+ json(): Promise<unknown>;
15
+ }
16
+ /** 请求执行器入参(与 fetch init 对齐的轻量子集,不依赖 DOM lib) */
17
+ export interface AIFetchInit {
18
+ method: string;
19
+ headers: Record<string, string>;
20
+ body: string;
21
+ }
22
+ /** 自定义请求执行器签名(axios / undici 等包装) */
23
+ export type AIFetcher = (url: string, init: AIFetchInit) => Promise<AIFetcherResponse>;
9
24
  export interface AIConfig {
10
25
  /**
11
26
  * 宿主普通 HTTP API 地址(唯一模式)。
@@ -19,6 +34,12 @@ export interface AIConfig {
19
34
  timeoutMs?: number;
20
35
  /** 是否支持多模态图片(imageDataUrl 透传),默认 true */
21
36
  imageEnabled?: boolean;
37
+ /**
38
+ * 自定义请求执行器(可选)。
39
+ * 默认使用全局 fetch,缺失时自动降级 XMLHttpRequest(旧浏览器 / 老 WebView);
40
+ * SSR 等既无 fetch 也无 XHR 的环境需传入 axios/undici 包装。
41
+ */
42
+ fetcher?: AIFetcher;
22
43
  }
23
44
  /** 一次 AI 调用所需的完整请求(含系统提示词与用户提示词) */
24
45
  export interface AIRequest {
@@ -40,4 +40,4 @@ export { default as PaperPreview } from './components/PaperPreview.vue';
40
40
  export { useVueRenderer, getVueRendererCleanSvgs, renderAllPagesAsSingleSvg } from './composables/useVueRenderer';
41
41
  export type { VueRendererOptions } from './composables/useVueRenderer';
42
42
  export { configureAI, isAIReady, getAIConfig, buildAnalyzeInput, buildAIRequest, callLLM, parseAIRaw, applyAIRaw, analyzeQuestion, generateScoreRule, } from './ai';
43
- export type { AIConfig, AIRequest, AIResult, QuestionInput, AnalyzeQuestionInput, GenerateScoreRuleInput, QuestionSnapshotLine, SnapshotUnit, NewAnswerSpot, UnderlineInput, UnderlineResult, AnalyzeQuestionResult, GenerateScoreRuleResult, EditorMutations, } from './ai/types';
43
+ export type { AIConfig, AIRequest, AIResult, AIFetcher, AIFetchInit, AIFetcherResponse, QuestionInput, AnalyzeQuestionInput, GenerateScoreRuleInput, QuestionSnapshotLine, SnapshotUnit, NewAnswerSpot, UnderlineInput, UnderlineResult, AnalyzeQuestionResult, GenerateScoreRuleResult, EditorMutations, } from './ai/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sw7d/paper-renderer",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "题卡设计器核心组件 - 纯编辑表面",
5
5
  "type": "module",
6
6
  "main": "./dist/paper-renderer.js",