// ==UserScript== // @name 爱问答助手 // @namespace aiask/askHelper // @version 2.7.0 // @author aiask // @description 全平台网课答题助手,一键解析当前页面试题并获取答案,支持作业 / 考试 / 章节测验的自动收录与答题。已适配【超星学习通、知到智慧树、中国大学MOOC、职教云·智慧职教、云班课、国家开放大学、广东开放大学、上海开放大学、江苏开放大学、云南开放大学、四川开放大学、云上河开、安徽继续教育、河南继续教育、武汉理工继续教育、东北财经大学成教、芯位教育、青书学堂、优课在线UOOC、西财在线、华医网、麦能网、良师在线、川农在线、成教云、电大中专、京人平台、北京联大学堂、绎通继教云、继教云、继教在线、学起Plus、日照专业技术人员继续教育、亿学宝、文顶在线、柠檬文才、春风雨、出头系统、云幕学苑、21tb、168网校、learnin、广西自考助学】等 40+ 平台,更多平台持续适配中... // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAAXNSR0IArs4c6QAAAHVQTFRFR3BMgICBQD8/QUVHQ0ZIRUhKX2FiQD8/Tk1NP0VJPzs7Pz8/QD4+UE9QQD8/PVlnQD8/M6vj////n5+fN5C60NDQSl9qOXWSZL/qTFNXzOr4QWl8yMjItLS02traOIOnNZzN6OfnlJeZ9/f3PYGgpdrzmdXxgSBJqQAAABB0Uk5TAP5E6vys+7/Q0RhsfPFV/OwFarYAAAEESURBVHjapdHrboMgGIBhUHBaD/sAlTE8VOt2/5c4GlBMRZOl7w8j+kQQ0FaVwbG48IDq+piMPcgkO1bD/8DXvhD4/fb9ePDuGiqa2krV7pO1AxSLYIl2ABoeTLSvYMBi4N0sphOAlVaqg1aTPggmZYYaFvNMBYGQz6G6m2vbhEBvF81MxALFTDpbQQd3ZhvBgxqiFfBEO/CJ7ZxkNPcUbWBwn5DJw4KSsJHcHPCTLLDuQxpLkiMLbAIWJs1wBRVkyAFXT7Sa+AYQjTywNfOD74DNA18I9Ifjpg7Es/3Jj5eKyIEcBgNwhk5L8XMPonMQQcfNhBfRpIfbFbiRskCX5enFyz/07TSN9vGxKwAAAABJRU5ErkJggg== // @match *://*.chaoxing.com/* // @match *://*.hlju.edu.cn/* // @match *://*.ecust.edu.cn/* // @match *://lms.ouchn.cn/* // @match *://*.ouchn.cn/* // @match *://xczxzdbf.moodle.qwbx.ouchn.cn/* // @match *://study.ouchn.cn/* // @match *://moodle.syxy.ouchn.cn/* // @match *://moodle.qwbx.ouchn.cn/* // @match *://*.tongyi.com/* // @match *://chat.deepseek.com/* // @match *://*.zhihuishu.com/* // @match *://course.ougd.cn/* // @match *://elearning.bjou.edu.cn/* // @match *://whkpc.hnqtyq.cn:5678/* // @match *://www.51xinwei.com/* // @match *://*.w-ling.cn/* // @match *://*.edu-edu.com/* // @match *://xuexi.jsou.cn/* // @match *://*.icve.com.cn/* // @match *://zice.cnzx.info/* // @match *://any.cnzx.info:81/* // @match *://www.icourse163.org/* // @match *://*.shou.org.cn/* // @match *://*.ahjxjy.cn/* // @match *://*.chinaedu.net/* // @match *://*.qingshuxuetang.com/* // @match *://cce.org.uooconline.com/* // @match *://*.courshare.cn/* // @match *://*.cep.webtrn.cn/* // @match *://*.webtrn.cn/* // @match *://*.cj-edu.com/* // @match *://*.ytccr.com/* // @match *://*.exam-cloud.cn/* // @match *://gdrtvu.exam-cloud.cn/* // @match *://*.open.ha.cn/* // @match *://lhycjy.cloudwis.tech/* // @match *://*.sclecb.cn/* // @match *://*.web2.superchutou.com/* // @match *://*.ls365.net/* // @match *://*.jijiaox.com/* // @match *://*.wencaischool.net/* // @match *://sdrz.gxk.yxlearning.com/* // @match *://*.crjxjy.net/* // @match *://*.cjnep.net/* // @match *://*.91huayi.com/* // @match *://teach.ynou.edu.cn/* // @match *://*.edu-edu.com.cn/* // @match *://*.21tb.com/* // @match *://*.168wangxiao.com/* // @match *://*.mynep.com/* // @match *://www.mosoteach.cn/* // @match *://*.aufe.edu.cn/* // @match *://*.learnin.com.cn/* // @match *://*.ouchn.edu.cn/* // @match *://*.swufe-online.com/* // @match *://ks.cqsdx.cn/* // @match *://*.qau.edu.cn/* // @match *://*.gdufemooc.cn/* // @match *://*.telfri-edu.com/* // @match *://www.beeline-ai.com/* // @match *://*.wxic.edu.cn/* // @match *://*.yxbyun.com/* // @match *://*.wdjycj.com/* // @match *://*.hbcjpt.com/* // @match *://*.csmu.edu.cn/* // @match *://*.ketangx.net/* // @match *://*.cnzx.info/* // @match *://www.asklib.com/* // @match *://*.xust.edu.cn/* // @match *://*.whut.edu.cn/* // @match *://*.lut.edu.cn/* // @match *://*.wwwwsoft.com/* // @match *://*.dufe.edu.cn/* // @match *://*.lygtc.edu.cn/* // @match *://*.cfyedu.com/* // @match *://*.iwdjy.com/* // @match *://*.jijiaool.com/* // @match *://lms.cjzx.hblll.com/* // @match *://*.ouc-online.com.cn/* // @match *://*.lsedu.vip/* // @match *://*.jxjypt.cn/* // @match *://*.jsnu.edu.cn/* // @match *://*.geovisearth.com/* // @match *://*.bgzk-edu.cn/* // @match *://*.cqie.cn/* // @match *://mooc1.ceduacad.ahut.edu.cn/* // @require https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/vue/3.4.27/vue.global.min.js // @require https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/vue-demi/0.14.6/index.iife.js // @require data:application/javascript,%3Bwindow.Vue%3DVue%3B // @require https://fastly.jsdelivr.net/npm/@iconify/vue@5.0.0/dist/iconify.js // @require https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/jquery/3.6.0/jquery.min.js // @require https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/dompurify/3.1.6/purify.min.js // @require https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/crypto-js/4.2.0/crypto-js.min.js // @require https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/pinia/2.2.4/pinia.iife.prod.js // @connect 127.0.0.1 // @connect icodef.com // @connect wk66.top // @connect zhihuishu.com // @connect greasyfork.org // @connect chaoxing.com // @connect shou.org.cn // @connect jsdelivr.net // @connect jsdmirror.cn // @connect gitee.com // @connect vxo.im // @connect zeroai.chat // @connect forestpolice.org // @connect scriptcat.org // @connect api.github.com // @connect aiask.site // @connect api.deepseek.com // @connect dashscope.aliyuncs.com // @connect open.bigmodel.cn // @connect qianfan.baidubce.com // @connect ark.cn-beijing.volces.com // @connect api.hunyuan.cloud.tencent.com // @connect api.longcat.chat // @connect api.moonshot.ai // @connect api.siliconflow.cn // @connect api.openai.com // @connect api.anthropic.com // @connect generativelanguage.googleapis.com // @connect openrouter.ai // @connect api.groq.com // @connect api.together.ai // @connect api.mistral.ai // @connect hlju.edu.cn // @connect ecust.edu.cn // @connect lms.ouchn.cn // @connect ouchn.cn // @connect xczxzdbf.moodle.qwbx.ouchn.cn // @connect study.ouchn.cn // @connect moodle.syxy.ouchn.cn // @connect moodle.qwbx.ouchn.cn // @connect tongyi.com // @connect chat.deepseek.com // @connect course.ougd.cn // @connect elearning.bjou.edu.cn // @connect whkpc.hnqtyq.cn // @connect www.51xinwei.com // @connect w-ling.cn // @connect edu-edu.com // @connect xuexi.jsou.cn // @connect icve.com.cn // @connect zice.cnzx.info // @connect any.cnzx.info // @connect www.icourse163.org // @connect ahjxjy.cn // @connect chinaedu.net // @connect qingshuxuetang.com // @connect cce.org.uooconline.com // @connect courshare.cn // @connect cep.webtrn.cn // @connect webtrn.cn // @connect cj-edu.com // @connect ytccr.com // @connect exam-cloud.cn // @connect gdrtvu.exam-cloud.cn // @connect open.ha.cn // @connect lhycjy.cloudwis.tech // @connect sclecb.cn // @connect web2.superchutou.com // @connect ls365.net // @connect jijiaox.com // @connect wencaischool.net // @connect sdrz.gxk.yxlearning.com // @connect crjxjy.net // @connect cjnep.net // @connect 91huayi.com // @connect teach.ynou.edu.cn // @connect edu-edu.com.cn // @connect 21tb.com // @connect 168wangxiao.com // @connect mynep.com // @connect www.mosoteach.cn // @connect aufe.edu.cn // @connect learnin.com.cn // @connect ouchn.edu.cn // @connect swufe-online.com // @connect ks.cqsdx.cn // @connect qau.edu.cn // @connect gdufemooc.cn // @connect telfri-edu.com // @connect www.beeline-ai.com // @connect wxic.edu.cn // @connect yxbyun.com // @connect wdjycj.com // @connect hbcjpt.com // @connect csmu.edu.cn // @connect ketangx.net // @connect cnzx.info // @connect www.asklib.com // @connect xust.edu.cn // @connect whut.edu.cn // @connect lut.edu.cn // @connect wwwwsoft.com // @connect dufe.edu.cn // @connect lygtc.edu.cn // @connect cfyedu.com // @connect iwdjy.com // @connect jijiaool.com // @connect lms.cjzx.hblll.com // @connect ouc-online.com.cn // @connect lsedu.vip // @connect jxjypt.cn // @connect jsnu.edu.cn // @connect geovisearth.com // @connect bgzk-edu.cn // @connect cqie.cn // @connect mooc1.ceduacad.ahut.edu.cn // @grant GM.xmlHttpRequest // @grant GM_deleteValue // @grant GM_getValue // @grant GM_info // @grant GM_listValues // @grant GM_setValue // @grant GM_xmlhttpRequest // @grant unsafeWindow // @run-at document-start // ==/UserScript== // hello (function (vue, vue$1, pinia, M, j, O) { 'use strict'; var e = Object.defineProperty, __publicField = (t, n, a) => ((t, n, a) => n in t ? e(t, n, { enumerable: true, configurable: true, writable: true, value: a }) : t[n] = a)(t, "symbol" != typeof n ? n + "" : n, a); const z = new Set([ "preparing", "searching", "matched", "published", "rendering", "filling" ]), F = { todo: "\u672a\u7b54", run: "\u67e5\u627e\u4e2d", done: "\u5df2\u7b54", none: "\u65e0\u7b54\u6848", wait: "AI \u5f85\u786e\u8ba4" }; function tallyMarks(e) { const t = { done: 0, none: 0, wait: 0, todo: 0 }; for (const n of e) "run" === n ? t.todo++ : t[n]++; return t; } const D = "\u672c\u5730\u7f13\u5b58", isAiForm = (e = "") => /AI/i.test(e), hasAnswer = e => { if (e.needLogin) return false; const t = e.answer; return Array.isArray(t) ? t.length > 0 : t && "object" == typeof t ? Object.keys(t).length > 0 : "string" == typeof t ? t.trim().length > 0 : !!t; }; const N = [ "width", "height", "aria-label" ], R = { key: 0, cx: "7", cy: "7", r: "5.5", fill: "none", stroke: "currentColor", "stroke-width": "1.5", "stroke-dasharray": "2.2 1.8" }, B = vue.createElementVNode("circle", { cx: "7", cy: "7", r: "5.5", fill: "none", stroke: "currentColor", "stroke-opacity": "0.25", "stroke-width": "1.5" }, null, -1), G = vue.createElementVNode("path", { class: "status-glyph-arc", d: "M7 1.5a5.5 5.5 0 0 1 5.5 5.5", fill: "none", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }, null, -1), K = vue.createElementVNode("circle", { cx: "7", cy: "7", r: "6.25", fill: "currentColor" }, null, -1), V = vue.createElementVNode("path", { d: "M4.4 7.2l1.8 1.8 3.5-3.7", fill: "none", stroke: "var(--c-bg-surface)", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }, null, -1), W = vue.createElementVNode("circle", { cx: "7", cy: "7", r: "5.5", fill: "none", stroke: "currentColor", "stroke-width": "1.5" }, null, -1), Q = vue.createElementVNode("path", { d: "M5 5l4 4M9 5l-4 4", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }, null, -1), J = vue.createElementVNode("circle", { cx: "7", cy: "7", r: "5.5", fill: "none", stroke: "currentColor", "stroke-width": "1.5" }, null, -1), Y = vue.createElementVNode("path", { d: "M7 3.25a3.75 3.75 0 0 0 0 7.5z", fill: "currentColor" }, null, -1), X = vue.defineComponent({ __name: "StatusGlyph", props: { mark: {}, size: { default: 14 } }, setup: e => (e, t) => (vue.openBlock(), vue.createElementBlock("svg", { class: vue.normalizeClass([ "status-glyph", `is-${e.mark}` ]), width: e.size, height: e.size, viewBox: "0 0 14 14", role: "img", "aria-label": vue.unref(F)[e.mark] }, [ "todo" === e.mark ? (vue.openBlock(), vue.createElementBlock("circle", R)) : "run" === e.mark ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ B, G ], 64)) : "done" === e.mark ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [ K, V ], 64)) : "none" === e.mark ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [ W, Q ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 4 }, [ J, Y ], 64)) ], 10, N)) }); var Z = (() => "undefined" != typeof GM_deleteValue ? GM_deleteValue : void 0)(), ee = (() => "undefined" != typeof GM_getValue ? GM_getValue : void 0)(), te = (() => "undefined" != typeof GM_info ? GM_info : void 0)(), ne = (() => "undefined" != typeof GM_listValues ? GM_listValues : void 0)(), ae = (() => "undefined" != typeof GM_setValue ? GM_setValue : void 0)(), ie = (() => "undefined" != typeof GM_xmlhttpRequest ? GM_xmlhttpRequest : void 0)(), se = (() => "undefined" != typeof unsafeWindow ? unsafeWindow : void 0)(); const re = "AiAsk_"; class Cache { static set(e, t, n = 0) { e = re + e; const a = { value: t, expire: n > 0 ? Date.now() + 1e3 * n : 0 }; return ae(e, a), ee(e); } static get(e, t = null) { const n = ee(e = re + e); return n && n.expire && n.expire < Date.now() ? (Z(e), t) : n ? n.value : t; } static match(e) { return e = re + e, ne().filter((t => t.startsWith(e))); } static matchGet(e) { const t = re + e; let n = ne().filter((e => e.startsWith(t))).map((e => function(e, t, n) { if (t && t.expire && t.expire < Date.now()) return n(e), null; const a = t ? t.value : null; return a && (a.key = e.replace("AiAsk_", "")), a; }(e, ee(e, { value: null, expire: 0 }), Z))).filter((e => null !== e)); return n.sort(((e, t) => (t.createTime || 0) - (e.createTime || 0))), n; } static remove(e) { Z(re + e); } static clear() { ne().filter((e => e.startsWith(re))).forEach(Z); } static matchRemove(e) { e = re + e, ne().filter((t => t.startsWith(e))).forEach(Z); } } let oe = null; function log$1(...e) {} const addLog = (e, t = "info") => { try { const n = null == oe ? void 0 : oe(), a = (new Date).toLocaleString(); null == n || n.addLog({ time: a, type: t, content: e }), n || console.log(e); } catch (n) { console.log(e); } }, le = { success: '', error: '', warning: '', info: '' }, ce = { success: "\u6210\u529f", error: "\u9519\u8bef", warning: "\u63d0\u9192", info: "\u63d0\u793a" }; let ue = null; const systemTheme = () => { var e; return "undefined" != typeof window && (null == (e = window.matchMedia) ? void 0 : e.call(window, "(prefers-color-scheme: dark)").matches) ? "dark" : "light"; }; let pe = null; function getStack(e = true) { if (pe && pe.isConnected) return pe; if (!e) return null; const t = document.createElement("div"); t.id = "aah-toast-host"; const n = t.attachShadow({ mode: "closed" }), a = document.createElement("style"); a.textContent = "\n:host { all: initial; }\n.stack {\n --bg: #ffffff; --border: #e1e3e8; --text: #1d2129; --muted: #4b5260;\n --success: #1d8549; --danger: #c93030; --warning: #a86200; --info: #1672b8;\n --shadow: 0 8px 24px -6px rgba(20, 24, 33, 0.16), 0 2px 6px rgba(20, 24, 33, 0.06);\n position: fixed;\n top: 16px;\n right: 16px;\n z-index: 2147483647;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 8px;\n width: min(360px, calc(100vw - 32px));\n pointer-events: none;\n font: 13px/1.55 -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Segoe UI', sans-serif;\n -webkit-font-smoothing: antialiased;\n}\n.stack[data-theme='dark'] {\n --bg: #1f2024; --border: #2d3035; --text: #e6e7ea; --muted: #b4b8c0;\n --success: #4cc27e; --danger: #f0716b; --warning: #e8a73c; --info: #4da3e6;\n --shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);\n}\n.toast {\n display: grid;\n grid-template-columns: 16px minmax(0, 1fr);\n gap: 8px;\n align-items: start;\n box-sizing: border-box;\n max-width: 100%;\n padding: 10px 12px;\n border: 1px solid var(--border);\n border-radius: 8px;\n background: var(--bg);\n box-shadow: var(--shadow);\n color: var(--text);\n pointer-events: auto;\n cursor: default;\n animation: toast-in 220ms cubic-bezier(0.16, 1, 0.3, 1);\n transition: opacity 180ms ease-out, transform 180ms ease-out;\n}\n.toast svg { width: 16px; height: 16px; margin-top: 2px; }\n.toast[data-type='success'] svg { color: var(--success); }\n.toast[data-type='error'] svg { color: var(--danger); }\n.toast[data-type='warning'] svg { color: var(--warning); }\n.toast[data-type='info'] svg { color: var(--info); }\n.content { min-width: 0; overflow-wrap: anywhere; white-space: pre-line; }\n.content p { margin: 0 0 4px; }\n.content p:last-child { margin-bottom: 0; }\n.content a { color: var(--info); font-weight: 500; text-underline-offset: 2px; }\n.content strong { font-weight: 600; }\n.toast.leaving { opacity: 0; transform: translateY(-4px); }\n@keyframes toast-in {\n from { opacity: 0; transform: translateY(-6px); }\n to { opacity: 1; transform: none; }\n}\n@media (prefers-reduced-motion: reduce) {\n .toast { animation: none; transition: none; }\n}"; const i = document.createElement("div"); return i.className = "stack", i.setAttribute("role", "status"), i.setAttribute("aria-live", "polite"), i.dataset.theme = ue ?? systemTheme(), n.append(a, i), document.body.appendChild(t), pe = i, i; } function msg(e, t = "info") { try { const n = le[t] ? t : "info", a = getStack(), i = document.createElement("div"); i.className = "toast", i.dataset.type = n, i.setAttribute("aria-label", ce[n]), i.innerHTML = ``; const s = document.createElement("div"); s.className = "content", s.innerHTML = M.sanitize(e), i.appendChild(s), a.appendChild(i); const dismiss = () => { i.classList.add("leaving"), setTimeout((() => i.remove()), 200); }; let r = setTimeout(dismiss, 2800); i.addEventListener("mouseenter", (() => clearTimeout(r))), i.addEventListener("mouseleave", (() => { r = setTimeout(dismiss, 1500); })), addLog(e, t); } catch (n) { addLog(`\u6d88\u606f\u901a\u77e5\u5931\u8d25\u3010${e}\u3011`, "error"); } } async function encrypt(e = "", t = "asdgdfghfghfghfg", n = "1234567890123456") { try { if (!e) return ""; if (t = t.substring(0, 16), n = n.substring(0, 16), !window.crypto || !window.crypto.subtle) { const a = j.enc.Utf8.parse(t), i = j.enc.Utf8.parse(n); return j.AES.encrypt(e, a, { iv: i, mode: j.mode.CBC, padding: j.pad.Pkcs7 }).toString(); } const i = new TextEncoder, s = i.encode(e), r = i.encode(t), o = i.encode(n), l = await crypto.subtle.importKey("raw", r, { name: "AES-CBC" }, !1, [ "encrypt" ]), c = await crypto.subtle.encrypt({ name: "AES-CBC", iv: o }, l, s), u = new Uint8Array(c), p = 1024; let d, m = ""; for (let e = 0; e < u.length; e += p) { const t = u.slice(e, Math.min(e + p, u.length)); m += String.fromCharCode.apply(null, Array.from(t)); } try { d = btoa(m); } catch (a) { d = m.split("").map((e => ("0" + e.charCodeAt(0).toString(16)).slice(-2))).join(""); } return d; } catch (i) { return addLog(`\u52a0\u5bc6\u5f02\u5e38: ${i instanceof Error ? i.message : "\u672a\u77e5\u9519\u8bef"}`, "error"), ""; } } async function decrypt(e = "", t = "asdgdfghfghfghfg", n = "1234567890123456") { try { if (!e) return ""; if (t = t.substring(0, 16), n = n.substring(0, 16), !window.crypto || !window.crypto.subtle) { const a = j.enc.Utf8.parse(t), i = j.enc.Utf8.parse(n); return j.AES.decrypt(e, a, { iv: i, mode: j.mode.CBC, padding: j.pad.Pkcs7 }).toString(j.enc.Utf8); } /^[A-Za-z0-9+/]*={0,2}$/.test(e); const i = new TextEncoder, s = i.encode(t), r = i.encode(n); let o; try { o = atob(e); } catch (a) { throw new Error("Base64 \u89e3\u7801\u5931\u8d25\uff0c\u6570\u636e\u683c\u5f0f\u4e0d\u6b63\u786e"); } const l = new Uint8Array(o.length); for (let e = 0; e < o.length; e++) l[e] = o.charCodeAt(e); if (l.length % 16 != 0) throw new Error("\u52a0\u5bc6\u6570\u636e\u957f\u5ea6\u4e0d\u6b63\u786e\uff0c\u4e0d\u662f16\u7684\u500d\u6570"); const c = await crypto.subtle.importKey("raw", s, { name: "AES-CBC" }, !1, [ "decrypt" ]), u = await crypto.subtle.decrypt({ name: "AES-CBC", iv: r }, c, l); return new TextDecoder("utf-8", { fatal: !0 }).decode(u); } catch (i) { return addLog(`\u89e3\u5bc6\u5f02\u5e38: ${i instanceof Error ? i.message : "\u672a\u77e5\u9519\u8bef"}`, "error"), ""; } } function md5(e) { return j.MD5(e).toString(); } function somd5(e) { return md5(e); } const isPlainObject$1 = e => "object" == typeof e && null !== e && !Array.isArray(e), flattenForSignature = (e, t = "") => { const n = []; return Object.keys(e).sort().forEach((a => { if (!t && "html" === a) return; const i = t ? `${t}.${a}` : a, s = e[a]; (e => null == e || !(!Array.isArray(e) || 0 !== e.length) || !(!isPlainObject$1(e) || 0 !== Object.keys(e).length))(s) || (Array.isArray(s) ? n.push(`${i}=${(e => e.every((e => "object" != typeof e)) ? [ ...e ].sort().join(",") : JSON.stringify(e))(s)}`) : isPlainObject$1(s) ? n.push(...flattenForSignature(s, i)) : n.push(`${i}=${String(s)}`)); })), n; }; function get_t(e = {}) { return md5(flattenForSignature(e).join("&")); } const getImageSrc = e => { const t = String(e).match(/(?:^|\s)src\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i); return t && (t[1] || t[2] || t[3]) || ""; }, stripImageSrcQuery = e => e.replace(/[?#].*$/, ""), cleanQuestionText = e => String(e ?? "").replace(/]*)>/gi, ((e, t) => getImageSrc(t))).replace(//gi, "\n").replace(/<(\/)?(p|div).*?>/gi, "\n").replace(/<[^>]+>/g, "").replace(/[\t\r\xa0]/g, " ").replace(/[\u2000-\u200a]/g, " ").replace(/ {2,}/g, " ").replace(/\n{2,}/g, "\n").trim(), cleanQuestionTextWithImageHtml = e => { const t = []; return String(e ?? "").replace(/]*)>/gi, ((e, n) => { const a = getImageSrc(n); if (!a) return ""; const i = `\0AAH_IMAGE_PLACEHOLDER_${t.length}\0`; return t.push(`/g, ">"))(a)}">`), i; })).replace(//gi, "\n").replace(/<(\/)?(p|div).*?>/gi, "\n").replace(/<[^>]+>/g, "").replace(/\u0000AAH_IMAGE_PLACEHOLDER_(\d+)\u0000/g, ((e, n) => t[Number(n)] || "")).replace(/[\t\r\xa0]/g, " ").replace(/[\u2000-\u200a]/g, " ").replace(/ {2,}/g, " ").replace(/\n{2,}/g, "\n").trim(); }, cleanQuestionTitle = e => e.replace(/^[.*?]\s*/, "").replace(/^\u3010.*?\u3011\s*/, "").replace(/\s*[\uff08(]\s*\d+(?:\.\d+)?\s*\u5206?\s*[\uff09)]\s*$/, "").replace(/^\d+\./, "").trim().replace(/^\d+\uff0e/, "").trim(), normalizeComparableText = e => (e => { if (/^[+-]?\d+(\.\d+)?$/.test(e)) return e; const t = e.replace(/\s+/g, ""); return t.replace(new RegExp("\\p{P}", "gu"), "") || t; })((e => String(e ?? "").replace(/]*)>/gi, ((e, t) => stripImageSrcQuery(getImageSrc(t)))).replace(/<[^>]*>/g, ""))(e)).trim(), removeOptionPrefixes = (e, {removeBareLetter: t = false} = {}) => e.map(((e, n) => { const a = String.fromCharCode(65 + n), i = t ? `^${a}(?:\\s*[.\u3001\uff0e)\uff09:\uff1a]\\s*|\\s+)?` : `^${a}\\s*[.\u3001\uff0e)\uff09:\uff1a]\\s*`; return e.replace(new RegExp(i), "").trim(); })), normalizeHashText = e => String(e ?? "").replace(/]*)>/gi, ((e, t) => { const n = getImageSrc(t); return n ? `` : ""; })), questionHash = (e, t, n, a = true) => { if (("15" === e || 15 === e) && Array.isArray(n) && n.length > 0 && "object" == typeof n[0]) { const i = n.map((e => { if (e.question && e.options) { const t = Array.from(e.options).map(normalizeHashText); a && t.sort(); const n = t.join(""); return `${e.type || "0"}${normalizeHashText(e.question)}${n}`; } return ""; })).filter(Boolean); let s = `${e}${normalizeHashText(t)}${i.join("")}`; return s = s.replace(/\s/g, ""), md5(s); } const i = Array.from(n).map(normalizeHashText); a && i.sort(); const s = i.join(""); let r = `${e}${normalizeHashText(t)}${s}`; return r = r.replace(/\s/g, ""), md5(r); }, sanitizeHtml = (e, t, n) => { const a = M.sanitize; return "function" == typeof a ? a(e, { ALLOWED_TAGS: t, ALLOWED_ATTR: n, ALLOW_DATA_ATTR: false, KEEP_CONTENT: true }) : ((e, t, n) => { const a = new Set(t), i = new Set(n); return e.replace(/]*>[\s\S]*?<\/script>/gi, "").replace(/]*>[\s\S]*?<\/style>/gi, "").replace(/\son\w+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?/gi, "").replace(/<([/]?)([a-z][\w:-]*)([^>]*)>/gi, ((e, t, n, s) => { const r = String(n).toLowerCase(); if (!a.has(r)) return ""; if (t) return ``; const o = []; return String(s).replace(/([:\w-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g, ((e, t, n, a, s) => { const r = String(t).toLowerCase(), l = String(n ?? a ?? s ?? ""); return i.has(r) && ("href" !== r && "src" !== r || (c = l.trim(), /^(https?:|mailto:|tel:|data:image\/|\/|\.\/|\.\.\/|#)/i.test(c))) ? (o.push(`${r}="${l.replace(/"/g, """)}"`), "") : ""; var c; })), `<${r}${o.length ? ` ${o.join(" ")}` : ""}>`; })); })(e, t, n); }; function removeHtml(e, t = true) { if (e = (e = (e = (e = (e => { if ("undefined" != typeof document) { const t = document.createElement("textarea"); return t.innerHTML = e, t.value; } const t = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'", nbsp: " " }; return e.replace(/&(#\d+|#x[\da-f]+|[a-z]+);/gi, ((e, n) => { const a = String(n).toLowerCase(); return a.startsWith("#x") ? String.fromCharCode(parseInt(a.slice(2), 16)) : a.startsWith("#") ? String.fromCharCode(parseInt(a.slice(1), 10)) : t[a] ?? e; })); })(e)).replace(/[\t\r\xa0]/g, " ")).replace(/[\u2000-\u200a]/g, " ")).replace(//g, "\n"), t && (e = e.replace(/<(\/)?(p|div).*?>/g, "\n")), e = (e = (e = (e = e.replace(/ {2,}/g, " ")).replace(/\n{2,}/g, "\n")).replace(//g, "
")).replace(/<\/xmp>/g, "
"), e = sanitizeHtml(e, [ "img", "br", "sub", "sup" ], [ "src", "href" ]), "undefined" != typeof document && "undefined" != typeof location) { const t = //g, n = e.match(t); n && n.forEach((t => { const n = t.match(/src="(.*?)"/); if (n && -1 === n[1].indexOf("http") && !n[1].includes("data:image")) if (n[1].startsWith("/")) e = e.replace(n[1], location.origin + n[1]); else { const t = new URL(n[1], document.baseURI).href; e = e.replace(n[1], t); } })); } return e.trim(); } const escapeHtml = e => e.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'"); function createSafeMarkdownHtml(e) { if (!e) return ""; let t = e; const n = [], a = `AAHMDPLACEHOLDER${"undefined" != typeof crypto && "randomUUID" in crypto ? crypto.randomUUID().replace(/[^a-z0-9]/gi, "") : `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`.replace(/[^a-z0-9]/gi, "")}`, protect = e => { const t = `${a}X${n.length}Z`; return n.push(e), t; }; return t = t.replace(/```(\w*)\n([\s\S]*?)```/g, ((e, t, n) => protect(`
${escapeHtml(String(n).trim())}
`))), t = t.replace(/`([^`]+)`/g, ((e, t) => protect(`${escapeHtml(String(t))}`))), t = t.replace(/\[([^\]]+)\]\(([^)]+)\)/g, ((e, t, n) => { const a = String(n).trim(); return /^https?:\/\//i.test(a) ? protect(`${t}`) : t; })), t = t.replace(/\*\*(.+?)\*\*/g, "$1"), t = t.replace(/__(.+?)__/g, "$1"), t = t.replace(/\*(.+?)\*/g, "$1"), t = t.replace(/_(.+?)_/g, "$1"), t = t.replace(/^### (.+)$/gm, "

$1

"), t = t.replace(/^## (.+)$/gm, "

$1

"), t = t.replace(/^# (.+)$/gm, "

$1

"), t = t.replace(/^\- (.+)$/gm, "
  • $1
  • "), t = t.replace(/(
  • .*<\/li>\n?)+/g, "
      $&
    "), t = t.replace(/^\d+\. (.+)$/gm, "
  • $1
  • "), t = t.replace(/\n/g, "
    "), t = t.replace(/
    <(pre|h1|h2|h3|ul|ol)/g, "<$1"), t = t.replace(/<\/(pre|h1|h2|h3|ul|ol)>
    /g, ""), (e => sanitizeHtml(e, [ "a", "br", "code", "em", "h1", "h2", "h3", "img", "li", "ol", "pre", "strong", "sub", "sup", "ul" ], [ "class", "href", "rel", "src", "target" ]))(t.replace(new RegExp(`${(e => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))(a)}X(\\d+)Z`, "g"), ((e, t) => n[Number(t)] || ""))); } function titleClean(e) { return cleanQuestionTitle(e); } function isFalse(e) { return "string" == typeof e && /(\u4e0d\u6b63\u786e|\u9519\u8bef|\u5426|\u9519|\xd7|F|wr|false)/i.test(e); } function isTrue(e) { return "string" == typeof e && (!isFalse(e) && /(\u6b63\u786e|\u662f|\u5bf9|\u221a|T|ri|true)/i.test(e)); } function judgeAnswer(e) { return isTrue(e) ? [ "\u6b63\u786e" ] : isFalse(e) ? [ "\u9519\u8bef" ] : []; } function removeStartChar(e) { return removeOptionPrefixes(e, { removeBareLetter: true }); } function removeKnownOptionPrefix(e, t) { const n = String(e ?? "").trim(), a = String(t ?? "").trim(); return "" === a ? n : n.replace(new RegExp(`^${i = a, i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s*`), "").trim(); var i; } function removeOptionsStartChar(e) { for (let t = 0; t < e.length; t += 1) { const n = String.fromCharCode(65 + t) + ".", a = String.fromCharCode(65 + t) + "\u3001", i = String.fromCharCode(65 + t) + "\uff0e", s = String.fromCharCode(65 + t), r = new RegExp(`^${n}|^${a}|^${i}|^${s}`); if (!e[t].match(r)) return false; e[t] = e[t].replace(r, "").trim(); } return e; } const de = { "\u5355\u9009\u9898": "0", "\u591a\u9009\u9898": "1", "\u586b\u7a7a\u9898": "2", "\u5224\u65ad\u9898": "3", "\u7b80\u7b54\u9898": "4", "\u95ee\u7b54\u9898": "4", "\u540d\u8bcd\u89e3\u91ca": "5", "\u8bba\u8ff0\u9898": "6", "\u8ba1\u7b97\u9898": "7", "\u5206\u5f55\u9898": "9", "\u8d44\u6599\u9898": "10", "\u8fde\u7ebf\u9898": "11", "\u5339\u914d\u9898": "11", "\u6392\u5e8f\u9898": "13", "\u5b8c\u578b\u586b\u7a7a": "14", "\u5b8c\u5f62\u586b\u7a7a\u9898": "14", "\u9605\u8bfb\u7406\u89e3": "15", "\u7a0b\u5e8f\u9898": "17", "\u53e3\u8bed\u9898": "18", "\u542c\u529b\u9898": "19", "\u5171\u7528\u9009\u9879\u9898": "20", "\u6d4b\u8bc4\u9898": "21", "\u949f\u8868\u9898": "23", "\u9009\u8bcd\u586b\u7a7a": "24", "\u9009\u505a\u9898": "25", "\u5176\u5b83": "8" }; function typeConvert(e, t = true) { return t ? de[e] || "8" : Object.keys(de).find((t => de[t] === e)) || "\u5176\u5b83"; } function typeMatch(e) { const t = { 0: [ "\u5355\u9009", "\u5355\u9879\u9009\u62e9", "\u8bcd\u6c47\u4e0e\u7ed3\u6784", "A2", "A1" ], 1: [ "\u591a\u9009", "\u591a\u9879\u9009\u62e9" ], 2: [ "\u586b\u7a7a" ], 3: [ "\u5224\u65ad" ], 4: [ "\u7b80\u7b54", "\u95ee\u7b54", "\u7efc\u5408\u9898" ], 5: [ "\u540d\u8bcd\u89e3\u91ca" ], 6: [ "\u8bba\u8ff0", "\u4e3b\u89c2" ], 7: [ "\u8ba1\u7b97" ], 9: [ "\u5206\u5f55" ], 14: [ "\u5b8c\u5f62\u586b\u7a7a" ], 15: [ "\u9605\u8bfb\u7406\u89e3" ], 24: [ "\u9009\u8bcd\u586b\u7a7a" ] }; return Object.keys(t).find((n => t[n].some((t => e.includes(t))))) || "8"; } function sleep(e) { return new Promise((t => setTimeout(t, e))); } const waitUntil = (e, t) => { const n = void 0 === t || "number" == typeof t, a = "number" == typeof t ? { interval: t } : t ?? {}, i = a.interval ?? 100, s = !n && Object.prototype.hasOwnProperty.call(a, "timeout") && "number" == typeof a.timeout, r = a.timeout, o = a.timeoutMessage ?? "\u7b49\u5f85\u9875\u9762\u6761\u4ef6\u8d85\u65f6", l = Date.now(); return new Promise(((t, a) => { const c = setInterval((() => { try { if (e()) return clearInterval(c), void t(); } catch (i) { if (n) return; return clearInterval(c), void a(i); } s && Date.now() - l >= r && (clearInterval(c), a(new Error(o))); }), i); })); }; function isExist(e) { return O(e).length > 0; } function getUrl() { return location.href; } const me = [ "AI_CONFIG_MISSING", "AI_PROVIDER_DISABLED", "AI_CREDENTIAL_MISSING", "AI_AUTH_FAILED", "AI_REQUEST_TIMEOUT", "AI_NETWORK_FAILED", "AI_RESPONSE_PARSE_FAILED", "AI_SSE_PARSE_FAILED", "AI_OUTPUT_SCHEMA_INVALID", "AI_ANSWER_NOT_MATCHED", "AI_QUESTION_TYPE_UNSUPPORTED", "AI_IMAGE_UNSUPPORTED", "AI_PROXY_UNAVAILABLE", "AI_PROXY_RATE_LIMITED", "AI_PROXY_LOGIN_REQUIRED", "AI_CHANNEL_UNKNOWN", "AI_MODEL_REJECTED", "AI_DIRECT_BLOCKED" ], he = { AI_CONFIG_MISSING: "AI \u914d\u7f6e\u4e0d\u5b58\u5728\uff0c\u8bf7\u5148\u5b8c\u6210\u914d\u7f6e", AI_PROVIDER_DISABLED: "AI \u5e73\u53f0\u5df2\u505c\u7528\uff0c\u8bf7\u542f\u7528\u540e\u91cd\u8bd5", AI_CREDENTIAL_MISSING: "AI \u51ed\u8bc1\u7f3a\u5931\uff0c\u8bf7\u586b\u5199 API Key \u6216\u6388\u6743\u4fe1\u606f", AI_AUTH_FAILED: "AI \u9274\u6743\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u51ed\u8bc1\u662f\u5426\u6709\u6548", AI_REQUEST_TIMEOUT: "AI \u8bf7\u6c42\u8d85\u65f6\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5", AI_NETWORK_FAILED: "AI \u8bf7\u6c42\u7f51\u7edc\u5f02\u5e38\uff0c\u8bf7\u68c0\u67e5\u7f51\u7edc\u540e\u91cd\u8bd5", AI_RESPONSE_PARSE_FAILED: "AI \u54cd\u5e94\u89e3\u6790\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5", AI_SSE_PARSE_FAILED: "AI \u6d41\u5f0f\u54cd\u5e94\u89e3\u6790\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5", AI_OUTPUT_SCHEMA_INVALID: "AI \u8f93\u51fa\u683c\u5f0f\u4e0d\u7b26\u5408\u8981\u6c42\uff0c\u8bf7\u91cd\u8bd5", AI_ANSWER_NOT_MATCHED: "AI \u7b54\u6848\u672a\u80fd\u5339\u914d\u5f53\u524d\u9898\u76ee", AI_QUESTION_TYPE_UNSUPPORTED: "AI \u6682\u4e0d\u652f\u6301\u5f53\u524d\u9898\u578b", AI_IMAGE_UNSUPPORTED: "AI \u6682\u4e0d\u652f\u6301\u56fe\u7247\u9898\u76ee", AI_PROXY_UNAVAILABLE: "AI \u4ee3\u7406\u6682\u65f6\u4e0d\u53ef\u7528\uff0c\u6b63\u5728\u5c1d\u8bd5\u76f4\u8fde", AI_PROXY_RATE_LIMITED: "AI \u4ee3\u7406\u989d\u5ea6\u5df2\u7528\u5b8c\uff0c\u8bf7\u7a0d\u540e\u518d\u8bd5", AI_PROXY_LOGIN_REQUIRED: "\u4f7f\u7528 AI \u4ee3\u7406\u9700\u8981\u5148\u767b\u5f55\uff0c\u672a\u767b\u5f55\u53ef\u9009\u62e9\u652f\u6301\u76f4\u8fde\u7684\u6e20\u9053", AI_CHANNEL_UNKNOWN: "\u8be5 AI \u6e20\u9053\u5df2\u4e0b\u7ebf\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9", AI_MODEL_REJECTED: "\u6240\u9009\u6a21\u578b\u4e0d\u53ef\u7528\uff0c\u8bf7\u5728\u8bbe\u7f6e\u4e2d\u91cd\u9009", AI_DIRECT_BLOCKED: "\u8be5\u6e20\u9053\u65e0\u6cd5\u76f4\u8fde\u4e14\u4ee3\u7406\u6682\u4e0d\u53ef\u7528\uff1b\u6d77\u5916\u6e20\u9053\u9700\u81ea\u5907\u4ee3\u7406" }; function createAiError(e, t = {}) { const n = t.userMessage || he[e], a = new Error(`[${e}] ${n}`, void 0 === t.cause ? void 0 : { cause: t.cause }); return a.name = "AiError", a.code = e, a.userMessage = n, void 0 !== t.detail && (a.detail = t.detail), a; } const isAiError = e => "object" == typeof e && null !== e && "AiError" === e.name && "string" == typeof e.code && me.includes(e.code) && "string" == typeof e.message && "string" == typeof e.userMessage, getAiErrorMessage = e => isAiError(e) ? e.userMessage : e instanceof Error && e.message ? e.message : "AI \u8bf7\u6c42\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5", parseSsePackets = e => { const t = []; for (const a of e.split(/\r?\n/)) { const e = a.trim(); if (!e.startsWith("data:")) continue; const i = e.slice(5).trim(); if (i && "[DONE]" !== i) try { t.push(JSON.parse(i)); } catch (n) { throw createAiError("AI_SSE_PARSE_FAILED", { detail: { payload: i }, cause: n }); } } return t; }, createSsePacketParser = () => { let e = ""; return { push: t => (e += t, (() => { const t = [], n = e.split(/\r?\n\r?\n/); e = n.pop() || ""; for (const e of n) t.push(...parseSsePackets(e)); return t; })()), flush: () => { if (!e.trim()) return e = "", []; const t = e; return e = "", parseSsePackets(t); } }; }, getRuntime = () => globalThis, getRuntimeGmXmlhttpRequest = () => { var e; const t = "function" == typeof GM_xmlhttpRequest ? GM_xmlhttpRequest : "undefined" != typeof GM && "function" == typeof GM.xmlHttpRequest ? GM.xmlHttpRequest : void 0; if (t) return t; const n = getRuntime(); return n.GM_xmlhttpRequest || (null == (e = n.GM) ? void 0 : e.xmlHttpRequest); }, isHttpErrorStatus = e => !e || e < 200 || e >= 300, readStream = async (e, t) => { if (!e || "function" != typeof e.getReader) return; const n = e.getReader(), a = new TextDecoder; for (;;) { const {done: e, value: i} = await n.read(); if (e) break; i && t(a.decode(i, { stream: true })); } const i = a.decode(); i && t(i); }, truncate = e => e.length > 200 ? `${e.slice(0, 200)}\u2026` : e, createHttpStatusError = e => { const t = { status: e.status, statusText: e.statusText, responseText: e.responseText }; if (401 === e.status || 403 === e.status) return createAiError("AI_AUTH_FAILED", { detail: t }); if (isHttpErrorStatus(e.status)) { const n = (e => { if (!e) return ""; try { const t = JSON.parse(e), n = "object" == typeof t && null !== t ? t.error : void 0; if ("object" == typeof n && null !== n) { const e = n.message; if ("string" == typeof e && e.trim()) return truncate(e.trim()); } const a = "object" == typeof t && null !== t ? t.message : void 0; if ("string" == typeof a && a.trim()) return truncate(a.trim()); } catch { return truncate(e.trim()); } return ""; })(e.responseText), a = `AI \u63a5\u53e3\u8fd4\u56de ${e.status} ${e.statusText || ""}`.trim(); return createAiError("AI_NETWORK_FAILED", { detail: t, userMessage: n ? `${a}\uff1a${n}` : `${a}\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5` }); } }, stringifyHeaders = e => { const t = []; return e.forEach(((e, n) => t.push(`${n}: ${e}`))), t.join("\r\n"); }, createAiTransportRequest = e => { var t; const n = (null == (t = e.resolveGmXmlhttpRequest) ? void 0 : t.call(e)) || getRuntimeGmXmlhttpRequest(); if (!n) { const t = (() => { const e = getRuntime(); if ("function" == typeof e.fetch) return e.fetch.bind(e); })(); return t ? ((e, t) => { const n = "function" == typeof AbortController ? new AbortController : void 0; let i, s, rejectTransport = () => {}; const createBaseResponse = (t, n, a = "") => ({ finalUrl: t.url || e.url, response: n, responseHeaders: stringifyHeaders(t.headers), responseText: a, status: t.status, statusText: t.statusText }); return { promise: new Promise(((r, o) => { rejectTransport = o, e.timeout && n && (s = setTimeout((() => { i = "timeout", n.abort(); }), e.timeout)), (async () => { try { const i = await t(e.url, { method: e.method, headers: e.headers, body: e.data ?? void 0, signal: null == n ? void 0 : n.signal }); if (isHttpErrorStatus(i.status)) { const e = await i.text().catch((() => "")), t = createHttpStatusError(createBaseResponse(i, void 0, e)); if (t) return void o(t); } if ("stream" === e.responseType && e.onStreamChunk) { try { await readStream(i.body, e.onStreamChunk); } catch (a) { return void o(createAiError("AI_NETWORK_FAILED", { userMessage: "AI \u6d41\u5f0f\u54cd\u5e94\u8bfb\u53d6\u5931\u8d25", cause: a })); } return void r(createBaseResponse(i, i.body)); } if ("arraybuffer" === e.responseType) { const e = await i.arrayBuffer(); return void r(createBaseResponse(i, e)); } const s = await i.text(); r(createBaseResponse(i, s, s)); } catch (a) { if ("timeout" === i) return void o(createAiError("AI_REQUEST_TIMEOUT")); if ("manual" === i) return void o(createAiError("AI_NETWORK_FAILED", { userMessage: "AI \u8bf7\u6c42\u5df2\u53d6\u6d88" })); o(createAiError("AI_NETWORK_FAILED", { cause: a })); } finally { s && clearTimeout(s); } })(); })), abort: () => { i = "manual", null == n || n.abort(), rejectTransport(createAiError("AI_NETWORK_FAILED", { userMessage: "AI \u8bf7\u6c42\u5df2\u53d6\u6d88" })); } }; })(e, t) : (a = createAiError("AI_NETWORK_FAILED", { userMessage: "\u5f53\u524d\u8fd0\u884c\u73af\u5883\u4e0d\u652f\u6301 GM_xmlhttpRequest" }), { promise: Promise.reject(a), abort: () => {} }); } var a; let i, s, r, rejectTransport = () => {}, o = false, l = false, c = false, u = ""; const p = new Promise(((t, a) => { const rejectOnce = e => { o || (o = true, a(e)); }; rejectTransport = rejectOnce; const beginStreamRead = t => s || (s = readStream(t.response, (t => { var n; u.length < 8192 && (u += t), null == (n = e.onStreamChunk) || n.call(e, t); })).then((() => { l = true; })).catch((e => { l = true, c = true, r = e; })), s), rejectWithStatusError = e => { (s ? Promise.race([ s.then((() => u)), new Promise((e => setTimeout((() => e(u)), 500))) ]) : Promise.resolve("")).then((t => { const n = createHttpStatusError({ ...e, responseText: e.responseText || t }); rejectOnce(n || createAiError("AI_NETWORK_FAILED")); })); }, resolveOnce = e => { o || (isHttpErrorStatus(e.status) ? rejectWithStatusError(e) : (o = true, t(e))); }; i = n({ method: e.method, url: e.url, headers: e.headers, data: e.data, timeout: e.timeout, responseType: e.responseType, onloadstart: t => { "stream" === e.responseType && beginStreamRead(t); }, onload: t => { if (isHttpErrorStatus(t.status)) return void rejectWithStatusError(t); if ("stream" !== e.responseType || !e.onStreamChunk) return void resolveOnce(t); const n = beginStreamRead(t); if (l) return c ? void rejectOnce(createAiError("AI_NETWORK_FAILED", { userMessage: "AI \u6d41\u5f0f\u54cd\u5e94\u8bfb\u53d6\u5931\u8d25", cause: r })) : void resolveOnce(t); n.then((() => { c ? rejectOnce(createAiError("AI_NETWORK_FAILED", { userMessage: "AI \u6d41\u5f0f\u54cd\u5e94\u8bfb\u53d6\u5931\u8d25", cause: r })) : resolveOnce(t); })); }, onabort: () => rejectOnce(createAiError("AI_NETWORK_FAILED", { userMessage: "AI \u8bf7\u6c42\u5df2\u53d6\u6d88" })), ontimeout: () => rejectOnce(createAiError("AI_REQUEST_TIMEOUT")), onerror: e => rejectOnce(createAiError("AI_NETWORK_FAILED", { cause: e })) }); })); return { promise: p, abort: () => { null == i || i.abort(), rejectTransport(createAiError("AI_NETWORK_FAILED", { userMessage: "AI \u8bf7\u6c42\u5df2\u53d6\u6d88" })); } }; }, trimTrailingSlash = e => e.replace(/\/+$/, ""), contentToText = e => "string" == typeof e ? e : e.filter((e => "text" === e.type)).map((e => e.text)).join("\n"), assertConfigAvailable = e => { var t; if (!e.enabled) throw createAiError("AI_PROVIDER_DISABLED"); if (!(null == (t = e.credential) ? void 0 : t.value.trim())) throw createAiError("AI_CREDENTIAL_MISSING"); }, parseJsonResponse = e => { try { if ("string" == typeof e.response) { if (!e.response) return; return JSON.parse(e.response); } return void 0 !== e.response && null !== e.response ? e.response : e.responseText ? JSON.parse(e.responseText) : void 0; } catch (t) { throw createAiError("AI_RESPONSE_PARSE_FAILED", { cause: t }); } }, bindAbortSignal = (e, t) => { if (!e) return; const abortRequest = () => t(); if (!e.aborted) return e.addEventListener("abort", abortRequest, { once: true }), () => e.removeEventListener("abort", abortRequest); abortRequest(); }, createAnthropicBody = e => { const t = e.messages.filter((e => "system" === e.role)).map((e => contentToText(e.content))).join("\n"), n = { model: e.config.model, messages: e.messages.filter((e => "system" !== e.role)).map((e => ({ role: e.role, content: contentToText(e.content) }))), stream: false }; return t && (n.system = t), void 0 !== e.config.temperature && (n.temperature = e.config.temperature), n.max_tokens = e.config.maxTokens ?? 1024, n; }, isMultimodalContent = e => Array.isArray(e), hasMultimodalMessage = e => e.some((e => isMultimodalContent(e.content))), isLongCatConfig = e => "longcat" === e.providerId, toDataImageUrl = e => "url" === e.source ? e.data : `data:${e.mimeType || "image/png"};base64,${e.data}`, serializeMultimodalContent = (e, t) => e.map((e => isLongCatConfig(t) ? (e => "text" === e.type ? { type: "text", text: e.text } : { type: "input_image", input_image: { type: e.source, data: [ e.data ] } })(e) : (e => "text" === e.type ? { type: "text", text: e.text } : { type: "image_url", image_url: { url: toDataImageUrl(e) } })(e))), serializeOpenAiMessages = (e, t) => { if (isLongCatConfig(t) && hasMultimodalMessage(e)) { const n = e.filter((e => "system" === e.role)).map((e => contentToText(e.content))).filter(Boolean).join("\n"), a = []; for (const t of e.filter((e => "system" !== e.role))) "string" == typeof t.content ? a.push({ type: "text", text: t.content }) : a.push(...t.content.map((e => ({ ...e })))); if (n) { const e = a.find((e => "text" === e.type)); e ? e.text = `${n}\n\n${e.text}` : a.unshift({ type: "text", text: n }); } return [ { role: "user", content: serializeMultimodalContent(a, t) } ]; } return e.map((e => ({ role: e.role, content: isMultimodalContent(e.content) ? serializeMultimodalContent(e.content, t) : e.content }))); }, createOpenAiBody = (e, t = true) => { const n = { ...t ? e.config.disableThinkingParams : void 0, model: e.config.model, messages: serializeOpenAiMessages(e.messages, e.config), stream: e.stream }; return isLongCatConfig(e.config) && hasMultimodalMessage(e.messages) && (n.output_modalities = [ "text" ]), void 0 !== e.config.temperature && (n.temperature = e.config.temperature), void 0 !== e.config.maxTokens && (n.max_tokens = e.config.maxTokens), n; }, fe = [ 400, 422 ], normalizeOpenAiChunk = e => { const t = null == e ? void 0 : e.choices; return Array.isArray(t) ? t.map((e => { var t; return null == (t = e.delta) ? void 0 : t.content; })).filter((e => "string" == typeof e)).join("") : ""; }, ge = ((e = {}) => { const t = e.transport || createAiTransportRequest; return { id: e.id || "openai-compatible", chat: async e => { var n; assertConfigAvailable(e.config); const a = Date.now(), i = e.endpoint ?? { url: `${trimTrailingSlash(e.config.baseUrl)}/chat/completions`, headers: { Authorization: `Bearer ${(null == (n = e.config.credential) ? void 0 : n.value) || ""}`, "Content-Type": "application/json", Accept: "application/json" }, timeout: e.config.timeout }; let s = false; const attempt = async n => { let r = ""; const o = createSsePacketParser(), emit = t => { var n; r += t, s = true, null == (n = e.onToken) || n.call(e, t); }, l = t({ method: "POST", url: i.url, headers: i.headers, data: JSON.stringify(createOpenAiBody(e, n)), timeout: i.timeout, responseType: e.stream ? "stream" : "json", onStreamChunk: e.stream ? e => { const t = o; for (const n of t.push(e)) { const e = normalizeOpenAiChunk(n); e && emit(e); } } : void 0 }), c = bindAbortSignal(e.signal, l.abort); try { const t = await l.promise; if (e.stream) { for (const e of o.flush()) { const t = normalizeOpenAiChunk(e); t && emit(t); } if (!r) throw createAiError("AI_RESPONSE_PARSE_FAILED"); } else r = (e => { var t, n, a; const i = null == (a = null == (n = null == (t = null == e ? void 0 : e.choices) ? void 0 : t[0]) ? void 0 : n.message) ? void 0 : a.content; if ("string" != typeof i || !i) throw createAiError("AI_RESPONSE_PARSE_FAILED"); return i; })(parseJsonResponse(t)); return { text: r, raw: t.response, duration: Date.now() - a }; } finally { null == c || c(); } }; try { return await attempt(!0); } catch (r) { if (!((e, t, n) => { var a; if (n) return false; if (!t.config.disableThinkingParams) return false; if (!isAiError(e)) return false; const i = null == (a = e.detail) ? void 0 : a.status; return "number" == typeof i && fe.includes(i); })(r, e, s)) throw r; return attempt(false); } } }; })(), ve = ((e = {}) => { const t = e.transport || createAiTransportRequest; return { id: "anthropic-messages", chat: async e => { var n; assertConfigAvailable(e.config); const a = Date.now(), i = e.endpoint ?? { url: `${trimTrailingSlash(e.config.baseUrl)}/messages`, headers: { "x-api-key": (null == (n = e.config.credential) ? void 0 : n.value) || "", "anthropic-version": "2023-06-01", "Content-Type": "application/json" }, timeout: e.config.timeout }, s = t({ method: "POST", url: i.url, headers: i.headers, data: JSON.stringify(createAnthropicBody(e)), timeout: i.timeout, responseType: "json" }), r = bindAbortSignal(e.signal, s.abort); try { const e = await s.promise, t = (e => { const t = null == e ? void 0 : e.content; if (!Array.isArray(t)) throw createAiError("AI_RESPONSE_PARSE_FAILED"); const n = t.map((e => e.text)).filter((e => "string" == typeof e)).join(""); if (!n) throw createAiError("AI_RESPONSE_PARSE_FAILED"); return n; })(parseJsonResponse(e)); return { text: t, raw: e.response, duration: Date.now() - a }; } finally { null == r || r(); } } }; })(), ye = { 0: '\u4f60\u53ea\u4f5c\u4e3a\u201cJSON \u8f93\u51fa\u673a\u5668\u201d\u5de5\u4f5c\uff0c\u56de\u7b54\u65f6\u4ec5\u8f93\u51fa\u4e00\u884c JSON\uff0c\u7981\u6b62\u51fa\u73b0\u9664 JSON \u4ee5\u5916\u7684\u4efb\u4f55\u7b26\u53f7\u3001\u8bf4\u660e\u6216\u7a7a\u884c\u3002\n\n\u3010\u9898\u578b\u3011\u5355\u9009\u9898\n\n\u3010\u552f\u4e00\u5141\u8bb8\u7684\u8f93\u51fa\u683c\u5f0f\u3011\n{"answer":["\u9009\u9879\u5b57\u6bcd"]}\n\n\u3010\u5f3a\u5236\u89c4\u5219\u3011\n1. \u9009\u9879\u5b57\u6bcd\u5fc5\u987b\u5927\u5199\uff0c\u6570\u7ec4\u4e2d\u53ea\u80fd\u6709 1 \u4e2a\u5143\u7d20\u3002\n2. \u4e0d\u591f\u786e\u5b9a\u65f6\u8fd4\u56de\u7a7a\u6570\u7ec4\uff1a{"answer":[]}\n3. \u8f93\u51fa\u4f1a\u88ab JSON.parse \u76f4\u63a5\u89e3\u6790\uff0c\u51fa\u73b0\u4efb\u4f55\u975e JSON \u5185\u5bb9\u89c6\u4e3a\u5931\u8d25\u3002', 1: '\u4f60\u53ea\u4f5c\u4e3a\u201cJSON \u8f93\u51fa\u673a\u5668\u201d\u5de5\u4f5c\uff0c\u56de\u7b54\u65f6\u4ec5\u8f93\u51fa\u4e00\u884c JSON\uff0c\u7981\u6b62\u51fa\u73b0\u9664 JSON \u4ee5\u5916\u7684\u4efb\u4f55\u7b26\u53f7\u3001\u8bf4\u660e\u6216\u7a7a\u884c\u3002\n\n\u3010\u9898\u578b\u3011\u591a\u9009\u9898\n\n\u3010\u552f\u4e00\u5141\u8bb8\u7684\u8f93\u51fa\u683c\u5f0f\u3011\n{"answer":["\u9009\u9879\u5b57\u6bcd"]}\n\n\u3010\u5f3a\u5236\u89c4\u5219\u3011\n1. \u9009\u9879\u5b57\u6bcd\u5fc5\u987b\u5927\u5199\uff0c\u5e76\u6309\u5b57\u6bcd\u5347\u5e8f\u6392\u5e8f\u3002\n2. \u81f3\u5c11\u4e24\u4e2a\u9009\u9879\u624d\u7b97\u6709\u6548\uff0c\u4e0d\u786e\u5b9a\u65f6\u8fd4\u56de\u7a7a\u6570\u7ec4\uff1a{"answer":[]}\n3. \u8f93\u51fa\u4f1a\u88ab JSON.parse \u76f4\u63a5\u89e3\u6790\uff0c\u51fa\u73b0\u4efb\u4f55\u975e JSON \u5185\u5bb9\u89c6\u4e3a\u5931\u8d25\u3002', 2: '\u4f60\u53ea\u4f5c\u4e3a\u201cJSON \u8f93\u51fa\u673a\u5668\u201d\u5de5\u4f5c\uff0c\u56de\u7b54\u65f6\u4ec5\u8f93\u51fa\u4e00\u884c JSON\uff0c\u7981\u6b62\u51fa\u73b0\u9664 JSON \u4ee5\u5916\u7684\u4efb\u4f55\u7b26\u53f7\u3001\u8bf4\u660e\u6216\u7a7a\u884c\u3002\n\n\u3010\u9898\u578b\u3011\u586b\u7a7a\u9898\n\n\u3010\u552f\u4e00\u5141\u8bb8\u7684\u8f93\u51fa\u683c\u5f0f\u3011\n{"answer":["\u7b54\u68481","\u7b54\u68482"]}\n\n\u3010\u5f3a\u5236\u89c4\u5219\u3011\n1. \u7b54\u6848\u6570\u91cf\u5fc5\u987b\u5339\u914d\u9898\u76ee\u7a7a\u683c\u6570\uff0c\u4e0d\u5f97\u7f3a\u5931\u6216\u591a\u586b\u3002\n2. \u4e0d\u591f\u786e\u5b9a\u65f6\u8fd4\u56de\u7a7a\u6570\u7ec4\uff1a{"answer":[]}\n3. \u8f93\u51fa\u4f1a\u88ab JSON.parse \u76f4\u63a5\u89e3\u6790\uff0c\u51fa\u73b0\u4efb\u4f55\u975e JSON \u5185\u5bb9\u89c6\u4e3a\u5931\u8d25\u3002', 3: '\u4f60\u53ea\u4f5c\u4e3a\u201cJSON \u8f93\u51fa\u673a\u5668\u201d\u5de5\u4f5c\uff0c\u56de\u7b54\u65f6\u4ec5\u8f93\u51fa\u4e00\u884c JSON\uff0c\u7981\u6b62\u51fa\u73b0\u9664 JSON \u4ee5\u5916\u7684\u4efb\u4f55\u7b26\u53f7\u3001\u8bf4\u660e\u6216\u7a7a\u884c\u3002\n\n\u3010\u9898\u578b\u3011\u5224\u65ad\u9898\n\n\u3010\u552f\u4e00\u5141\u8bb8\u7684\u8f93\u51fa\u683c\u5f0f\u3011\n{"answer":"\u6b63\u786e"}\n\u6216\n{"answer":"\u9519\u8bef"}\n\n\u3010\u5f3a\u5236\u89c4\u5219\u3011\n1. answer \u53ea\u80fd\u662f\u201c\u6b63\u786e\u201d\u6216\u201c\u9519\u8bef\u201d\uff0c\u4e0d\u786e\u5b9a\u65f6\u8f93\u51fa\u7a7a\u5b57\u7b26\u4e32\uff1a{"answer":""}\n2. \u8f93\u51fa\u4f1a\u88ab JSON.parse \u76f4\u63a5\u89e3\u6790\uff0c\u51fa\u73b0\u4efb\u4f55\u975e JSON \u5185\u5bb9\u89c6\u4e3a\u5931\u8d25\u3002', 4: '\u4f60\u53ea\u4f5c\u4e3a\u201cJSON \u8f93\u51fa\u673a\u5668\u201d\u5de5\u4f5c\uff0c\u56de\u7b54\u65f6\u4ec5\u8f93\u51fa\u4e00\u884c JSON\uff0c\u7981\u6b62\u51fa\u73b0\u9664 JSON \u4ee5\u5916\u7684\u4efb\u4f55\u7b26\u53f7\u3001\u8bf4\u660e\u6216\u7a7a\u884c\u3002\n\n\u3010\u9898\u578b\u3011\u7b80\u7b54\u9898\n\n\u3010\u552f\u4e00\u5141\u8bb8\u7684\u8f93\u51fa\u683c\u5f0f\u3011\n{"answer":"\u7cbe\u7b80\u7684\u7b54\u6848"}\n\n\u3010\u5f3a\u5236\u89c4\u5219\u3011\n1. \u76f4\u63a5\u7ed9\u51fa\u7cbe\u7b80\u7b54\u6848\uff0c\u4e0d\u8981\u8d58\u8ff0\u3002\n2. \u4e0d\u591f\u786e\u5b9a\u65f6\u8f93\u51fa\u7a7a\u5b57\u7b26\u4e32\uff1a{"answer":""}\n3. \u8f93\u51fa\u4f1a\u88ab JSON.parse \u76f4\u63a5\u89e3\u6790\uff0c\u51fa\u73b0\u4efb\u4f55\u975e JSON \u5185\u5bb9\u89c6\u4e3a\u5931\u8d25\u3002', 15: '\u4f60\u53ea\u4f5c\u4e3a\u201cJSON \u8f93\u51fa\u673a\u5668\u201d\u5de5\u4f5c\uff0c\u56de\u7b54\u65f6\u4ec5\u8f93\u51fa\u4e00\u884c JSON\uff0c\u7981\u6b62\u51fa\u73b0\u9664 JSON \u4ee5\u5916\u7684\u4efb\u4f55\u7b26\u53f7\u3001\u8bf4\u660e\u6216\u7a7a\u884c\u3002\n\n\u3010\u9898\u578b\u3011\u9605\u8bfb\u7406\u89e3\n\n\u3010\u552f\u4e00\u5141\u8bb8\u7684\u8f93\u51fa\u683c\u5f0f\u3011\n{"answer":[["A"],["B"]]}\n\n\u3010\u5f3a\u5236\u89c4\u5219\u3011\n1. answer \u5fc5\u987b\u662f\u4e8c\u7ef4\u6570\u7ec4\uff0c\u5916\u5c42\u6570\u7ec4\u6570\u91cf\u5fc5\u987b\u7b49\u4e8e\u5b50\u9898\u6570\u91cf\u3002\n2. \u5355\u9009\u9898\u5b50\u9898\u586b\u5199 1 \u4e2a\u9009\u9879\u5b57\u6bcd\uff0c\u591a\u9009\u9898\u5b50\u9898\u53ef\u586b\u5199\u591a\u4e2a\u9009\u9879\u5b57\u6bcd\u3002\n3. \u5224\u65ad\u9898\u5b50\u9898\u586b\u5199\u201c\u6b63\u786e\u201d\u6216\u201c\u9519\u8bef\u201d\uff0c\u4e0d\u8981\u586b\u5199\u9009\u9879\u5b57\u6bcd\u3002\n4. \u9009\u9879\u5b57\u6bcd\u5fc5\u987b\u5927\u5199\uff0c\u591a\u9009\u9898\u6309\u5b57\u6bcd\u5347\u5e8f\u6392\u5e8f\u3002\n5. \u67d0\u4e2a\u5b50\u9898\u4e0d\u786e\u5b9a\u65f6\uff0c\u8be5\u5b50\u9898\u8fd4\u56de\u7a7a\u6570\u7ec4\uff0c\u4f8b\u5982 {"answer":[[],["B"]]}\u3002\n6. \u8f93\u51fa\u4f1a\u88ab JSON.parse \u76f4\u63a5\u89e3\u6790\uff0c\u51fa\u73b0\u4efb\u4f55\u975e JSON \u5185\u5bb9\u89c6\u4e3a\u5931\u8d25\u3002' }, be = [ "api.deepseek.com", "dashscope.aliyuncs.com", "open.bigmodel.cn", "qianfan.baidubce.com", "ark.cn-beijing.volces.com", "api.hunyuan.cloud.tencent.com", "api.longcat.chat", "api.moonshot.ai", "api.siliconflow.cn", "api.openai.com", "api.anthropic.com", "generativelanguage.googleapis.com", "openrouter.ai", "api.groq.com", "api.together.ai", "api.mistral.ai" ], canDirectConnect = e => { if (!e.directConnect) return false; let t; try { t = new URL(e.baseUrl).hostname; } catch { return false; } return be.some((e => t === e || t.endsWith(`.${e}`))); }, toThrownError = e => { const t = (e => e && me.includes(e) ? e : "AI_NETWORK_FAILED")(e.code); return isAiError(e.error) && e.error.code === t ? e.error : createAiError(t); }, we = "https://www.aiask.site", trimSlash = e => e.replace(/\/+$/, ""), xe = { "anthropic-messages": e => ({ "x-api-key": e, "anthropic-version": "2023-06-01", "Content-Type": "application/json" }), "openai-compatible": e => ({ Authorization: `Bearer ${e}`, "Content-Type": "application/json", Accept: "application/json" }) }, codeFor = (e, t) => "upstream" === e ? 401 === t || 403 === t ? "AI_AUTH_FAILED" : "AI_NETWORK_FAILED" : 401 === t ? "AI_PROXY_LOGIN_REQUIRED" : 429 === t ? "AI_PROXY_RATE_LIMITED" : "AI_PROXY_UNAVAILABLE"; function randomString(e) { let t = ""; for (;t.length < e; t += Math.random().toString(36).substring(2)) ; return t.substring(0, e); } const runAiScene = async (e, t, n, a = {}) => { var i; if (!t) return (() => { const e = createAiError("AI_CONFIG_MISSING", { userMessage: "AI \u914d\u7f6e\u7f3a\u5931\uff0c\u8bf7\u5148\u5b8c\u6210\u914d\u7f6e" }); return { success: false, text: "", duration: 0, error: e, displayMessage: getAiErrorMessage(e) }; })(); try { const s = a.provider || (null == (i = a.resolveProvider) ? void 0 : i.call(a, t)) || (e => { switch (e) { case "openai-compatible": return ge; case "anthropic-messages": return ve; } })(t.providerKind), r = ((e, t, n = "4") => [ { role: "system", content: "ask" === e ? ye[n] || ye[4] : "repair" === e ? "\u4f60\u662f\u4e00\u4e2a\u4e13\u4e1a\u7684\u7b54\u9898\u52a9\u624b\uff0c\u8bf7\u4fee\u590d\u7b54\u6848\u4e2d\u7f3a\u5931\u3001\u683c\u5f0f\u9519\u8bef\u6216\u8868\u8ff0\u4e0d\u6e05\u7684\u5185\u5bb9\u3002\u8f93\u51fa\u5e94\u4ee5\u4fee\u590d\u7b54\u6848\u4e3a\u4e3b\uff0c\u4fdd\u6301\u51c6\u786e\u3001\u7b80\u6d01\uff0c\u5e76\u907f\u514d\u65e0\u5173\u89e3\u91ca\u3002" : "\u4f60\u662f\u4e00\u4e2a\u4e13\u4e1a\u7684\u7b54\u9898\u52a9\u624b\uff0c\u8bf7\u6839\u636e\u7528\u6237\u63d0\u4f9b\u7684\u9898\u76ee\u8fdb\u884c\u89e3\u7b54\u3002\u56de\u7b54\u5e94\u51c6\u786e\u3001\u7b80\u6d01\uff0c\u5fc5\u8981\u65f6\u7ed9\u51fa\u7b80\u8981\u7406\u7531\u3002" }, { role: "user", content: t } ])(e, n, a.questionType), o = a.stream ?? t.stream; if (!a.route) { const e = await s.chat({ config: t, messages: r, stream: o, onToken: a.onToken, signal: a.signal }); return { success: !0, text: e.text, duration: e.duration }; } const l = Date.now(), c = await (async e => { const t = canDirectConnect(e.channel), runDirect = async t => { const n = await e.callDirect(e.channel, (t => { var n; return null == (n = e.onToken) ? void 0 : n.call(e, t); })); if (!n.ok) throw toThrownError(n); return { servedBy: "direct", fallbackUsed: t, text: n.text || "" }; }; if (!e.loggedIn || "auto" !== e.transport) { if (!t) throw createAiError("AI_DIRECT_BLOCKED"); return runDirect(!1); } let n = !1; const a = await e.callProxy(e.channel, (t => { var a; n = !0, null == (a = e.onToken) || a.call(e, t); })); if (a.ok) return { servedBy: "proxy", fallbackUsed: !1, text: a.text || "" }; if ("upstream" === a.stage) throw toThrownError(a); if (n) throw toThrownError(a); if (!t) throw createAiError("AI_DIRECT_BLOCKED"); return runDirect(!0); })({ channel: a.route.channel, loggedIn: Boolean(a.route.apiKey), transport: a.route.transport, onToken: a.onToken, callProxy: async (e, n) => { var i; const l = ((e, t, n) => ({ url: `${we}/ai/chat`, headers: { Authorization: `Bearer ${n.apiKey}`, "X-Ai-Channel": e.id, "X-Ai-Model": n.modelId || e.defaultModelId, "X-Ai-Credential": t, "X-Ai-Timestamp": String(n.now()), "X-Ai-Nonce": n.randomNonce(), "Content-Type": "application/json", Accept: "application/json" }, timeout: e.timeout }))(e, (null == (i = t.credential) ? void 0 : i.value) || "", { apiKey: a.route.apiKey, now: a.route.now ?? (() => Date.now()), randomNonce: a.route.randomNonce ?? (() => randomString(24)), modelId: a.route.modelId }); try { return { ok: !0, stage: "upstream", text: (await s.chat({ config: t, messages: r, stream: o, onToken: n, signal: a.signal, endpoint: l })).text }; } catch (c) { return ((e, t) => { const n = (e => { if (e) for (const t of e.split(/\r?\n/)) { const e = t.indexOf(":"); if (e < 0) continue; if ("x-ai-stage" !== t.slice(0, e).trim().toLowerCase()) continue; const n = t.slice(e + 1).trim().toLowerCase(); return "proxy" === n || "upstream" === n ? n : void 0; } })(null == t ? void 0 : t.responseHeaders) ?? "proxy"; return { ok: !1, stage: n, code: codeFor(n, (null == t ? void 0 : t.status) ?? 0), error: e }; })(c, null == c ? void 0 : c.detail); } }, callDirect: async (e, n) => { var i; const l = ((e, t) => ({ url: "anthropic-messages" === e.providerKind ? `${trimSlash(e.baseUrl)}/messages` : `${trimSlash(e.baseUrl)}/chat/completions`, headers: xe[e.providerKind](t), timeout: e.timeout }))(e, (null == (i = t.credential) ? void 0 : i.value) || ""); try { return { ok: !0, text: (await s.chat({ config: t, messages: r, stream: o, onToken: n, signal: a.signal, endpoint: l })).text }; } catch (c) { return { ok: !1, code: isAiError(c) ? c.code : void 0, error: c }; } } }); return { success: !0, text: c.text, duration: Date.now() - l, servedBy: c.servedBy, fallbackUsed: c.fallbackUsed }; } catch (s) { const e = isAiError(s) ? s : createAiError("AI_NETWORK_FAILED", { cause: s }); return { success: false, text: "", duration: 0, error: e, displayMessage: getAiErrorMessage(e) }; } }, ke = new Set([ "\u6682\u65e0KEY", "\u65e0KEY", "\u6682\u65e0APIKEY", "\u65e0APIKEY", "\u672a\u914d\u7f6eKEY", "\u672a\u914d\u7f6eAPIKEY", "\u672a\u586b\u5199KEY", "\u672a\u586b\u5199APIKEY", "APIKEY\u7f3a\u5931", "\u8bf7\u586b\u5199KEY", "\u8bf7\u586b\u5199APIKEY", "\u8bf7\u914d\u7f6eKEY", "\u8bf7\u914d\u7f6eAPIKEY", "\u6682\u65e0\u7b54\u6848", "\u6682\u65e0\u7b54\u6848\u4fe1\u606f", "\u65e0\u7b54\u6848", "\u6ca1\u6709\u7b54\u6848", "\u672a\u627e\u5230\u7b54\u6848", "\u672a\u67e5\u8be2\u5230\u7b54\u6848", "\u672a\u68c0\u7d22\u5230\u7b54\u6848", "\u67e5\u8be2\u4e0d\u5230\u7b54\u6848", "\u8bf7\u767b\u5f55", "\u8bf7\u5148\u767b\u5f55", "\u672a\u767b\u5f55", "\u9274\u6743\u5931\u8d25", "\u672a\u6388\u6743", "\u65e0\u6743\u9650", "\u8bf7\u6c42\u5931\u8d25", "\u7f51\u7edc\u5f02\u5e38", "\u7f51\u7edc\u8bf7\u6c42\u5931\u8d25", "\u54cd\u5e94\u89e3\u6790\u5931\u8d25", "\u63a5\u53e3\u5f02\u5e38", "\u63a5\u53e3\u8bf7\u6c42\u5931\u8d25", "\u63a5\u53e3\u8bf7\u6c42\u8d85\u65f6", "\u8bf7\u6c42\u8d85\u65f6", "\u6b21\u6570\u4e0d\u8db3", "\u4f59\u989d\u4e0d\u8db3", "\u989d\u5ea6\u4e0d\u8db3" ]), qe = [ /^\u6682\u672a(\u6536\u5f55|\u627e\u5230|\u67e5\u8be2\u5230|\u68c0\u7d22\u5230)(\u53c2\u8003)?\u7b54\u6848(\u4fe1\u606f)?$/, /^\u672a(\u627e\u5230|\u67e5\u8be2\u5230|\u68c0\u7d22\u5230)(\u53c2\u8003)?\u7b54\u6848(\u4fe1\u606f)?$/, /^\u6ca1\u6709(\u627e\u5230|\u67e5\u8be2\u5230|\u68c0\u7d22\u5230)?(\u53c2\u8003)?\u7b54\u6848(\u4fe1\u606f)?$/, /^\u8bf7(\u5148)?\u767b\u5f55\u540e(\u518d)?(\u67e5\u770b|\u4f7f\u7528|\u641c\u7d22|\u67e5\u8be2).*$/, /^\u767b\u5f55\u540e\u624d\u53ef\u4ee5\u4f7f\u7528.*$/, /^AI(\u51ed\u8bc1|\u914d\u7f6e|\u54cd\u5e94|\u8bf7\u6c42).*(\u7f3a\u5931|\u5f02\u5e38|\u5931\u8d25|\u9519\u8bef).*$/, /^API\s*KEY\s*(\u7f3a\u5931|\u672a\u586b\u5199|\u672a\u914d\u7f6e|\u65e0\u6548).*$/i, /^(\u8bf7\u6c42|\u63a5\u53e3|\u7f51\u7edc).*(\u5931\u8d25|\u5f02\u5e38|\u8d85\u65f6).*$/, /^(\u6b21\u6570|\u4f59\u989d|\u989d\u5ea6).*(\u4e0d\u8db3|\u5df2\u7528\u5b8c).*$/ ], isNonAnswerText = e => { if ("string" != typeof e) return false; const t = e.trim(); return !!t && (!!ke.has((e => e.trim().replace(/\s+/g, "").toUpperCase())(t)) || qe.some((e => e.test(t)))); }, findNonAnswerText = e => { if ("string" == typeof e && isNonAnswerText(e)) return e.trim(); if (Array.isArray(e)) for (const t of e) { const e = findNonAnswerText(t); if (e) return e; } }, _e = new Set([ "\u5bf9", "\u6b63\u786e", "true", "t", "\u221a", "\u2713", "1", "\u662f", "yes", "y", "right", "correct", "ri" ]), Ae = new Set([ "\u9519", "\u9519\u8bef", "\u4e0d\u6b63\u786e", "false", "f", "\xd7", "\u2715", "x", "0", "\u5426", "no", "n", "wrong", "incorrect", "wr" ]), splitAnswerText = (e, t) => e.split(t).map((e => e.trim())).filter(Boolean), normalizeJudgeAnswer = e => { const t = normalizeComparableText(e).toLowerCase(); return _e.has(t) ? "\u6b63\u786e" : Ae.has(t) ? "\u9519\u8bef" : null; }, flattenAnswerTexts = e => null == e ? [] : Array.isArray(e) ? e.flatMap(flattenAnswerTexts) : "object" == typeof e ? Object.values(e).flatMap(flattenAnswerTexts) : [ String(e) ], mapChoiceValueToOption = (e, t) => { var n; const a = ((e, t) => { var n; const a = e.trim().toUpperCase(); if (/^[A-Z]$/.test(a)) return (null == (n = t[a.charCodeAt(0) - 65]) ? void 0 : n.trim()) || void 0; })(e, t); if (a) return a; const i = e.trim(); return null == (n = t.find((e => e.trim() === i))) ? void 0 : n.trim(); }, Te = new Set([ "4", "5", "6", "7" ]), invalid = (e, t, n) => ({ valid: false, answer: [], raw: t, error: createAiError(e, { detail: n }) }), extractCodeBlockJson = e => { var t; const n = e.match(/```(?:json)?\s*([\s\S]*?)```/i); return null == (t = null == n ? void 0 : n[1]) ? void 0 : t.trim(); }, findJsonObjectText = e => { const t = e.indexOf("{"); if (t < 0) return; let n = 0, a = false, i = false; for (let s = t; s < e.length; s++) { const r = e[s]; if (i) i = false; else if ("\\" !== r) if ('"' !== r) { if (!a && ("{" === r && n++, "}" === r && n--, 0 === n)) return e.slice(t, s + 1); } else a = !a; else i = true; } return e.slice(t); }, normalizeTextAnswer = e => { if ("string" != typeof e) return; return e.trim() || void 0; }, normalizeTextArray = e => { if (!Array.isArray(e)) return; const t = e.map((e => "string" == typeof e ? e.trim() : "")).filter(Boolean); return t.length === e.length ? t : void 0; }, getChoiceOptions = e => e.filter((e => "string" == typeof e)), parseSingleChoice = (e, t, n) => { const a = Array.isArray(e) ? normalizeTextArray(e) : [ normalizeTextAnswer(e) ].filter((e => Boolean(e))); if (!a || 1 !== a.length) return invalid("AI_OUTPUT_SCHEMA_INVALID", t); const i = mapChoiceValueToOption(a[0], getChoiceOptions(n.options)); return i ? { valid: true, answer: [ i ], raw: t } : invalid("AI_ANSWER_NOT_MATCHED", t, { answer: a[0] }); }, parseMultipleChoice = (e, t, n) => { const a = normalizeTextArray(e) || (e => { const t = normalizeTextAnswer(e); if (!t) return; const n = splitAnswerText(t, /[\n,\uff0c\u3001;\uff1b]+/); return n.length > 1 ? n : void 0; })(e); if (!a || a.length < 2) return invalid("AI_OUTPUT_SCHEMA_INVALID", t); if (new Set(a.map((e => e.trim().toUpperCase()))).size !== a.length) return invalid("AI_ANSWER_NOT_MATCHED", t, { answer: a }); const i = a.map((e => mapChoiceValueToOption(e, getChoiceOptions(n.options)))); return i.some((e => !e)) ? invalid("AI_ANSWER_NOT_MATCHED", t, { answer: a }) : { valid: true, answer: i, raw: t }; }, parseBlank = (e, t, n) => { const a = normalizeTextArray(e); return a ? n.blankCount > 0 && a.length !== n.blankCount || 0 === n.blankCount && 0 === a.length || a.some(isNonAnswerText) ? invalid("AI_OUTPUT_SCHEMA_INVALID", t) : { valid: true, answer: a, raw: t } : invalid("AI_OUTPUT_SCHEMA_INVALID", t); }, parseJudgement = (e, t) => { const n = normalizeTextAnswer(e); return "\u6b63\u786e" !== n && "\u9519\u8bef" !== n ? invalid("AI_OUTPUT_SCHEMA_INVALID", t) : { valid: true, answer: [ n ], raw: t }; }, parseSubjective = (e, t) => { const n = normalizeTextAnswer(e); return n ? isNonAnswerText(n) ? invalid("AI_OUTPUT_SCHEMA_INVALID", t) : { valid: true, answer: [ n ], raw: t } : invalid("AI_OUTPUT_SCHEMA_INVALID", t); }, isSubQuestionMeta = e => "object" == typeof e && null !== e && Array.isArray(e.options), parseReadingChoice = (e, t, n) => { if (Array.isArray(e) && 0 === e.length) return { valid: true, answer: [], raw: t }; const a = { type: n.type || "0", options: n.options || [], blankCount: 0 }; if ("1" === a.type) return parseMultipleChoice(e, t, a); if ("3" === a.type) { const [n] = normalizeTextArray(e) || []; return parseJudgement(n, t); } if ("2" === a.type) return parseBlank(e, t, a); if (Te.has(a.type)) { const [n] = normalizeTextArray(e) || []; return parseSubjective(n, t); } return parseSingleChoice(e, t, a); }, parseAiAnswer = (e, t) => { const n = (e => { const t = [ e.trim(), extractCodeBlockJson(e), findJsonObjectText(e) ].filter((e => Boolean(e))); for (const a of t) try { return { ok: !0, value: JSON.parse(a) }; } catch (n) { if (a === t[t.length - 1]) return { ok: false, cause: n }; } return { ok: false }; })(e); if (!n.ok) return { valid: false, answer: [], error: createAiError("AI_RESPONSE_PARSE_FAILED", { cause: n.cause }) }; const a = n.value, i = (e => { if ("object" == typeof e && null !== e && "answer" in e) return e.answer; })(a); return void 0 === i ? invalid("AI_OUTPUT_SCHEMA_INVALID", a) : "0" === t.type ? parseSingleChoice(i, a, t) : "1" === t.type ? parseMultipleChoice(i, a, t) : "2" === t.type ? parseBlank(i, a, t) : "3" === t.type ? parseJudgement(i, a) : Te.has(t.type) ? parseSubjective(i, a) : "15" === t.type ? ((e, t, n) => { const a = n.options.filter(isSubQuestionMeta); if (!Array.isArray(e) || 0 === a.length || e.length !== a.length) return invalid("AI_OUTPUT_SCHEMA_INVALID", t); const i = []; for (let s = 0; s < a.length; s++) { const n = parseReadingChoice(e[s], t, a[s]); if (!n.valid) return n; if (n.answer.some(Array.isArray)) return invalid("AI_OUTPUT_SCHEMA_INVALID", t); i.push(n.answer); } return { valid: true, answer: i, raw: t }; })(i, a, t) : invalid("AI_QUESTION_TYPE_UNSUPPORTED", a, { type: t.type }); }, hasUnsupportedMedia = e => { const t = (e => e.replace(/<[^>]*>/g, " "))(e); return /<\s*img\b/i.test(e) || /<\s*(?:svg|image)\b/i.test(e) || /<\s*math\b/i.test(e) || /<\s*script\b[^>]*type\s*=\s*["']?math\/tex/i.test(e) || hasUnsupportedMathClass(e) || /!\[[^\]]*]\([^)]*\)/.test(t) || /\$\$/.test(t) || /(^|[^\w\d])\$[^\s$][^$\n]*\$(?!\d)/.test(t) || /\\\(/.test(t) || /\\\[/.test(t); }, hasUnsupportedMathClass = e => { for (const t of e.matchAll(/class\s*=\s*["']([^"']*)["']/g)) { if (t[1].split(/\s+/).filter(Boolean).some((e => "MathJax" === e || e.startsWith("MathJax_") || "katex" === e || e.startsWith("katex-") || e.startsWith("mjx-")))) return true; } return false; }, Ce = /^([A-Ha-h\uff21-\uff28\uff41-\uff48])(?:\s*[.\uff0e\u3002\u3001)\uff09]\s*|\s+)(.+)$/, Se = /^(\u7b54\u6848|\u89e3\u6790|\u63d0\u793a)\s*[:\uff1a]/, Ie = /^((\d+|[\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u767e\u5343\u4e07]+)[\s.\uff0e\u3002\u3001)\uff09]+)+/, cleanQuestionPrefix = e => e.replace(Ie, "").trim(), Ee = { thinking: { type: "disabled" } }, withKeyHelp = e => ({ ...e, keyHelp: e.keyHelp || `\u767b\u5f55 ${e.name} \u63a7\u5236\u53f0\uff0c\u5728 API Key \u9875\u9762\u521b\u5efa\u6216\u590d\u5236 API Key\u3002` }), Ue = [ withKeyHelp({ id: "deepseek", name: "DeepSeek", providerKind: "openai-compatible", baseUrl: "https://api.deepseek.com", defaultModel: "deepseek-v4-flash", models: [ "deepseek-v4-flash", "deepseek-v4-pro" ], stream: true, credentialType: "api-key", docUrl: "https://api-docs.deepseek.com/quick_start/pricing", keyUrl: "https://platform.deepseek.com/api_keys", region: "domestic" }), withKeyHelp({ id: "qwen-dashscope", name: "\u901a\u4e49\u5343\u95ee / \u767e\u70bc", providerKind: "openai-compatible", baseUrl: "https://dashscope.aliyuncs.com/compatible-mode/v1", defaultModel: "qwen3.7-plus", models: [ "qwen3.7-plus", "qwen3.7-flash", "qwen3.8-max", "qwen3.5-omni-plus" ], modelCapabilities: { "qwen3.7-plus": { text: true, image: true }, "qwen3.7-flash": { text: true, image: true }, "qwen3.8-max": { text: true, image: true }, "qwen3.5-omni-plus": { text: true, image: true } }, stream: true, credentialType: "api-key", docUrl: "https://help.aliyun.com/zh/model-studio/models", keyUrl: "https://help.aliyun.com/zh/model-studio/get-api-key", region: "domestic" }), withKeyHelp({ id: "zhipu-glm", name: "\u667a\u8c31 GLM", providerKind: "openai-compatible", baseUrl: "https://open.bigmodel.cn/api/paas/v4", defaultModel: "glm-4.7", models: [ "glm-4.7", "glm-4.7-flash", "glm-4.7-flashx", "glm-5", "glm-5-turbo", "glm-4.6", "glm-4.5-flash", "glm-4v-flash" ], modelCapabilities: { "glm-4v-flash": { text: true, image: true } }, stream: true, credentialType: "api-key", docUrl: "https://docs.bigmodel.cn/api-reference", keyUrl: "https://open.bigmodel.cn/usercenter/proj-mgmt/apikeys", region: "domestic", disableThinkingParams: Ee }), withKeyHelp({ id: "baidu-qianfan", name: "\u767e\u5ea6\u5343\u5e06", providerKind: "openai-compatible", baseUrl: "https://qianfan.baidubce.com/v2", defaultModel: "ernie-5.0", models: [ "ernie-5.0", "ernie-5.1", "ernie-5.0-thinking-latest", "ernie-x1.1", "ernie-4.5-turbo-128k", "deepseek-v3.2", "ernie-4.5-turbo-vl-32k" ], modelCapabilities: { "ernie-5.0": { text: true, image: true }, "ernie-4.5-turbo-vl-32k": { text: true, image: true } }, timeout: 6e4, stream: true, credentialType: "api-key", docUrl: "https://cloud.baidu.com/doc/qianfan-docs/s/7m95lyy43", keyUrl: "https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application", region: "domestic", disableThinkingParams: Ee }), withKeyHelp({ id: "volc-ark", name: "\u706b\u5c71\u65b9\u821f / \u8c46\u5305", providerKind: "openai-compatible", baseUrl: "https://ark.cn-beijing.volces.com/api/v3", defaultModel: "doubao-seed-2-0-pro-260215", models: [ "doubao-seed-2-0-pro-260215", "doubao-seed-2-0-mini-260428", "doubao-seed-2-0-lite-260428" ], modelCapabilities: { "doubao-seed-2-0-pro-260215": { text: true, image: true }, "doubao-seed-2-0-mini-260428": { text: true, image: true }, "doubao-seed-2-0-lite-260428": { text: true, image: true } }, timeout: 6e4, stream: true, credentialType: "api-key", docUrl: "https://www.volcengine.com/docs/82379/1330310", keyUrl: "https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey", keyHelp: "\u767b\u5f55\u706b\u5c71\u65b9\u821f\u63a7\u5236\u53f0\u521b\u5efa API Key\u3002\u82e5\u8c03\u7528\u62a5\u6a21\u578b\u4e0d\u5b58\u5728\uff0c\u9700\u5148\u5728\u300c\u5728\u7ebf\u63a8\u7406\u300d\u521b\u5efa\u63a8\u7406\u63a5\u5165\u70b9\uff0c\u5e76\u628a\u6a21\u578b\u540d\u6362\u6210\u63a5\u5165\u70b9 ID\uff08ep- \u5f00\u5934\uff09\u3002", region: "domestic", disableThinkingParams: Ee }), withKeyHelp({ id: "tencent-hunyuan", name: "\u817e\u8baf\u6df7\u5143", providerKind: "openai-compatible", baseUrl: "https://api.hunyuan.cloud.tencent.com/v1", defaultModel: "hunyuan-turbos-latest", models: [ "hunyuan-turbos-latest", "hunyuan-a13b", "hunyuan-t1-latest", "hunyuan-translation" ], stream: true, credentialType: "api-key", docUrl: "https://cloud.tencent.com/document/product/1729/111007", keyUrl: "https://console.cloud.tencent.com/hunyuan/api-key", region: "domestic" }), withKeyHelp({ id: "longcat", name: "LongCat", providerKind: "openai-compatible", baseUrl: "https://api.longcat.chat/openai/v1", defaultModel: "LongCat-2.0", models: [ "LongCat-2.0" ], stream: true, credentialType: "api-key", docUrl: "https://longcat.chat/platform/docs/zh/", keyUrl: "https://longcat.chat/platform/api_keys", keyHelp: "\u767b\u5f55 LongCat API \u5f00\u653e\u5e73\u53f0\uff0c\u5728 API Keys \u9875\u9762\u70b9\u51fb\u201c\u521b\u5efa API Key\u201d\u751f\u6210\u5bc6\u94a5\u3002", region: "domestic" }), withKeyHelp({ id: "kimi", name: "Kimi / Moonshot", providerKind: "openai-compatible", baseUrl: "https://api.moonshot.ai/v1", defaultModel: "kimi-k3", models: [ "kimi-k3", "kimi-k2.7-code", "kimi-k2.6", "kimi-k2.5", "moonshot-v1-128k" ], stream: true, credentialType: "api-key", docUrl: "https://platform.kimi.ai/docs/api/chat", keyUrl: "https://platform.kimi.ai/console/api-keys", keyHelp: "\u767b\u5f55 platform.kimi.ai \u521b\u5efa API Key\u3002\u6ce8\u610f\uff1a\u56fd\u5185\u7ad9 platform.moonshot.cn \u7684 Key \u5728 api.moonshot.ai \u4e0a\u4e0d\u53ef\u7528\uff0c\u4e24\u8fb9\u8d26\u53f7\u72ec\u7acb\u3002", region: "domestic" }), withKeyHelp({ id: "siliconflow", name: "SiliconFlow", providerKind: "openai-compatible", baseUrl: "https://api.siliconflow.cn/v1", defaultModel: "deepseek-ai/DeepSeek-V3.2", models: [ "deepseek-ai/DeepSeek-V3.2", "Pro/deepseek-ai/DeepSeek-V3.2", "zai-org/GLM-5.2", "Pro/zai-org/GLM-5.1", "Qwen/Qwen3.5-397B-A17B", "Qwen/Qwen3.5-35B-A3B", "zai-org/GLM-4.5V" ], modelCapabilities: { "Qwen/Qwen3.5-397B-A17B": { text: true, image: true }, "Qwen/Qwen3.5-35B-A3B": { text: true, image: true }, "zai-org/GLM-4.5V": { text: true, image: true } }, stream: true, credentialType: "api-key", docUrl: "https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions", keyUrl: "https://cloud.siliconflow.cn/account/ak", region: "domestic" }), withKeyHelp({ id: "openai", name: "OpenAI", providerKind: "openai-compatible", baseUrl: "https://api.openai.com/v1", defaultModel: "gpt-5.6", models: [ "gpt-5.6", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna" ], stream: true, credentialType: "api-key", docUrl: "https://developers.openai.com/api/docs/models", keyUrl: "https://platform.openai.com/api-keys", region: "global" }), withKeyHelp({ id: "anthropic", name: "Anthropic Claude", providerKind: "anthropic-messages", baseUrl: "https://api.anthropic.com/v1", defaultModel: "claude-sonnet-5", models: [ "claude-sonnet-5", "claude-opus-5", "claude-haiku-4-5-20251001", "claude-fable-5" ], stream: true, credentialType: "api-key", docUrl: "https://platform.claude.com/docs/en/about-claude/models/overview", keyUrl: "https://console.anthropic.com/settings/keys", region: "global" }), withKeyHelp({ id: "gemini", name: "Google Gemini", providerKind: "openai-compatible", baseUrl: "https://generativelanguage.googleapis.com/v1beta/openai", defaultModel: "gemini-3.7-flash", models: [ "gemini-3.7-flash", "gemini-3.6-flash", "gemini-3.1-pro-preview", "gemini-2.5-flash", "gemini-2.5-pro" ], stream: true, credentialType: "api-key", docUrl: "https://ai.google.dev/gemini-api/docs/models", keyUrl: "https://aistudio.google.com/app/apikey", region: "global" }), withKeyHelp({ id: "openrouter", name: "OpenRouter", providerKind: "openai-compatible", baseUrl: "https://openrouter.ai/api/v1", defaultModel: "openai/gpt-5.6-luna", models: [ "openai/gpt-5.6-luna", "openai/gpt-5.6-terra", "anthropic/claude-sonnet-5", "google/gemini-3.7-flash", "deepseek/deepseek-v4-flash-0731", "moonshotai/kimi-k3" ], stream: true, credentialType: "api-key", docUrl: "https://openrouter.ai/docs/api-reference/chat-completion", keyUrl: "https://openrouter.ai/settings/keys", region: "global" }), withKeyHelp({ id: "groq", name: "Groq", providerKind: "openai-compatible", baseUrl: "https://api.groq.com/openai/v1", defaultModel: "openai/gpt-oss-120b", models: [ "openai/gpt-oss-120b", "openai/gpt-oss-20b", "llama-3.3-70b-versatile", "llama-3.1-8b-instant" ], stream: true, credentialType: "api-key", docUrl: "https://console.groq.com/docs/models", keyUrl: "https://console.groq.com/keys", region: "global" }), withKeyHelp({ id: "together", name: "Together AI", providerKind: "openai-compatible", baseUrl: "https://api.together.ai/v1", defaultModel: "moonshotai/Kimi-K3", models: [ "moonshotai/Kimi-K3", "zai-org/GLM-5.2", "openai/gpt-oss-120b", "deepseek-ai/DeepSeek-V4-Flash-0731", "Qwen/Qwen3.7-Plus" ], stream: true, credentialType: "api-key", docUrl: "https://docs.together.ai/docs/serverless-models", keyUrl: "https://api.together.ai/settings/api-keys", region: "global" }), withKeyHelp({ id: "mistral", name: "Mistral AI", providerKind: "openai-compatible", baseUrl: "https://api.mistral.ai/v1", defaultModel: "mistral-medium-3-5-26-04", models: [ "mistral-medium-3-5-26-04", "mistral-large-3-25-12", "mistral-small-4-0-26-03", "ministral-3-8b-25-12" ], stream: true, credentialType: "api-key", docUrl: "https://docs.mistral.ai/models/overview", keyUrl: "https://console.mistral.ai/api-keys/", region: "global" }) ], getAiProviderPreset = e => Ue.find((t => t.id === e)), Pe = Ue.map(((e, t) => ({ id: e.id, name: e.name, providerKind: e.providerKind, baseUrl: e.baseUrl, models: e.models.map((t => { var n; return { id: t, capabilities: (null == (n = e.modelCapabilities) ? void 0 : n[t]) ?? { text: true, image: false } }; })), defaultModelId: e.defaultModel, stream: e.stream, timeout: e.timeout ?? 3e4, disableThinkingParams: e.disableThinkingParams, region: e.region, order: 10 * t, recommended: false, signupUrl: e.keyUrl, docUrl: e.docUrl, keyHelp: e.keyHelp, status: "active", directConnect: true }))), He = [ "openai-compatible", "anthropic-messages" ], isRecord$2 = e => "object" == typeof e && null !== e, str = e => "string" == typeof e ? e : "", normalizeModel = e => { if (!isRecord$2(e) || !str(e.id)) return null; const t = isRecord$2(e.capabilities) ? e.capabilities : {}; return { id: str(e.id), label: str(e.label) || void 0, capabilities: { text: "boolean" != typeof t.text || t.text, image: "boolean" == typeof t.image && t.image } }; }, $e = [ "model", "messages", "stream" ], normalizeRequestParams = e => { if (!isRecord$2(e) || Array.isArray(e)) return; const t = Object.entries(e).filter((([e]) => !$e.includes(e))); return t.length ? Object.fromEntries(t) : void 0; }, normalizeChannel = e => { if (!isRecord$2(e)) return null; const t = str(e.id), n = str(e.baseUrl), a = He.includes(e.providerKind) ? e.providerKind : null, i = Array.isArray(e.models) ? e.models.map(normalizeModel).filter((e => null !== e)) : [], s = str(e.defaultModelId); if (!(t && n && a && i.length)) return null; if (!i.some((e => e.id === s))) return null; const r = "deprecated" === e.status || "hidden" === e.status ? e.status : "active"; return { id: t, name: str(e.name) || t, providerKind: a, baseUrl: n, models: i, defaultModelId: s, stream: "boolean" != typeof e.stream || e.stream, timeout: "number" == typeof e.timeout && e.timeout > 0 ? e.timeout : 3e4, region: "global" === e.region ? "global" : "domestic", order: "number" == typeof e.order ? e.order : 0, recommended: true === e.recommended, promoText: str(e.promoText) || void 0, signupUrl: str(e.signupUrl), docUrl: str(e.docUrl), keyHelp: str(e.keyHelp), status: r, directConnect: true === e.directConnect, disableThinkingParams: normalizeRequestParams(e.disableThinkingParams) }; }, Le = "ai_channel_catalog", Me = "ai_channel_catalog_last_good", readState = e => { if (!isRecord$2(e) || !Array.isArray(e.channels)) return null; const t = e.channels.map(normalizeChannel).filter((e => null !== e)); return t.length ? { seq: "number" == typeof e.seq ? e.seq : 0, fetchedAt: "number" == typeof e.fetchedAt ? e.fetchedAt : 0, channels: t } : null; }, fetchCatalog = async e => { const t = readState(e.cacheGet(Le)); if (t && e.now() - t.fetchedAt < 216e5) return t; try { const t = await e.request(), n = isRecord$2(t) ? readState({ ...t, fetchedAt: e.now() }) : null; if (n) return e.cacheSet(Le, n), e.cacheSet(Me, n), n; } catch {} return readState(e.cacheGet(Me)) || t || { seq: 0, fetchedAt: 0, channels: Pe }; }, resolveChannel = (e, t, n) => e.channels.find((e => e.id === n)) || Pe.find((e => e.id === n)) || t.find((e => e.id === n)), je = { text: true, image: false }, Oe = [ "openai-compatible", "anthropic-messages" ], ze = [ "direct", "conservative", "preview" ], isRecord$1 = e => "object" == typeof e && null !== e, normalizeCapabilities = (e, t, n) => { const a = ((e, t) => { const n = e.toLowerCase(), a = t.toLowerCase(); return "longcat" === n && a.includes("omni") || a.includes("vision") || a.includes("vl"); })(t, n); return isRecord$1(e) ? { text: "boolean" != typeof e.text || e.text, image: "boolean" == typeof e.image ? e.image : a } : { text: true, image: a }; }, isRemovedCookieProviderValue = e => "glm-cookie" === e || "spark-cookie" === e || "cookie-glm" === e || "cookie-spark" === e || "legacy-glm" === e || "legacy-spark" === e, isAdoptionStrategy = e => "string" == typeof e && ze.includes(e), normalizeCredentialValue = e => { if ("string" != typeof e) return; const t = e.trim(); return t && !isNonAnswerText(t) ? t : void 0; }, normalizeCredential$1 = e => { if (!isRecord$1(e)) return; const t = normalizeCredentialValue(e.value); return t ? { type: "api-key", value: t, updatedAt: "number" == typeof e.updatedAt ? e.updatedAt : void 0 } : void 0; }, normalizeAiConfig = e => { if (!isRecord$1(e) || "string" != typeof e.id || !e.id) return null; if (isRemovedCookieProviderValue(e.id) || isRemovedCookieProviderValue(e.providerId) || isRemovedCookieProviderValue(e.providerKind)) return null; const t = "string" == typeof e.providerId ? getAiProviderPreset(e.providerId) : getAiProviderPreset(e.id), n = (e => "string" == typeof e && Oe.includes(e))(e.providerKind) ? e.providerKind : (null == t ? void 0 : t.providerKind) || "openai-compatible", a = (null == t ? void 0 : t.id) || "string" == typeof e.providerId && e.providerId || e.id, i = "string" == typeof e.model && e.model ? e.model : (null == t ? void 0 : t.defaultModel) || "", s = "number" == typeof e.timeout && Number.isFinite(e.timeout) && e.timeout > 0 ? e.timeout : 3e4; return { id: e.id, name: "string" == typeof e.name && e.name ? e.name : (null == t ? void 0 : t.name) || e.id, providerId: a, providerKind: n, baseUrl: "string" == typeof e.baseUrl && e.baseUrl ? e.baseUrl : (null == t ? void 0 : t.baseUrl) || "", model: i, enabled: "boolean" != typeof e.enabled || e.enabled, stream: "boolean" == typeof e.stream ? e.stream : (null == t ? void 0 : t.stream) ?? true, capabilities: normalizeCapabilities(e.capabilities, a, i), credential: normalizeCredential$1(e.credential), timeout: s, temperature: "number" == typeof e.temperature ? e.temperature : void 0, maxTokens: "number" == typeof e.maxTokens ? e.maxTokens : void 0 }; }, normalizeLegacyBaseUrl = e => e.trim().split(/[?#]/)[0].replace(/\/+$/, "").replace(/\/chat\/completions$/, "").replace(/\/+$/, ""), migrateLegacyAiSettings = e => { var t, n; const a = { configs: [], defaultConfigId: "", defaultVisionConfigId: "", enabledForAsk: false, adoptionStrategy: "conservative", sceneOverrides: { enabled: false } }; if (!(null == (t = e.gpt) ? void 0 : t.length)) return a; const i = {}, s = e.gpt.map(((e, t) => ({ item: e, index: t }))).filter((({item: e}) => !(e => /glm|spark|\u661f\u706b/i.test(e.name))(e))); if (!s.length) return { ...a, enabledForAsk: false }; const r = s.map((({item: e, index: t}) => { var n; const a = "deepseek", s = ((e, t) => { const n = t[e] || 0; return t[e] = n + 1, 0 === n ? e : `${e}-${n}`; })(((e, t) => `legacy-ai-${t}`)(0, t), i), r = normalizeCredentialValue(e.key); return ((e, t = {}) => { var n; const a = getAiProviderPreset(e); if (!a) throw new Error(`\u672a\u77e5 AI \u5e73\u53f0\u9884\u8bbe: ${e}`); return { id: t.id || a.id, name: t.name || a.name, providerId: a.id, providerKind: a.providerKind, baseUrl: t.baseUrl || a.baseUrl, model: t.model || a.defaultModel, enabled: t.enabled ?? true, stream: t.stream ?? a.stream, capabilities: (i = t.capabilities || (null == (n = a.modelCapabilities) ? void 0 : n[t.model || a.defaultModel]) || je, { text: i.text, image: i.image }), credential: t.credential, timeout: t.timeout || 3e4, temperature: t.temperature, maxTokens: t.maxTokens }; var i; })(a, { id: s, name: e.desc || e.name, baseUrl: normalizeLegacyBaseUrl(e.api) || (null == (n = getAiProviderPreset(a)) ? void 0 : n.baseUrl), model: e.model, enabled: true, credential: r ? { type: "api-key", value: r } : void 0 }); })), o = r[Math.min(Math.max(e.gptIndex || 0, 0), r.length - 1)]; return { configs: r, defaultConfigId: (null == o ? void 0 : o.id) || a.defaultConfigId, defaultVisionConfigId: "", enabledForAsk: !!e.askGpt && !!(null == (n = null == o ? void 0 : o.credential) ? void 0 : n.value), adoptionStrategy: "conservative", sceneOverrides: { enabled: false } }; }, matchChannel = (e, t) => { const n = normalizeLegacyBaseUrl(e.baseUrl || ""); return n ? t.find((e => normalizeLegacyBaseUrl(e.baseUrl) === n)) : t.find((t => t.id === e.providerId || t.id === e.id)); }, toCustomChannel = (e, t = "") => ({ id: `custom-${e.id}`, name: e.name, baseUrl: e.baseUrl || t, providerKind: e.providerKind, model: e.model }), Fe = "ai_settings", De = "ai_settings_backup_v1", isRecord = e => "object" == typeof e && null !== e, normalizeCredential = e => { if (!isRecord(e)) return; const t = "string" == typeof e.value ? e.value.trim() : ""; return t ? { type: "api-key", value: t, updatedAt: "number" == typeof e.updatedAt ? e.updatedAt : void 0 } : void 0; }, normalizeInstance = e => isRecord(e) && "string" == typeof e.channelId && e.channelId ? { channelId: e.channelId, credential: normalizeCredential(e.credential), enabled: false !== e.enabled, modelId: "string" == typeof e.modelId && e.modelId ? e.modelId : void 0 } : null, normalizeCustomChannel = e => isRecord(e) && "string" == typeof e.id && e.id && "string" == typeof e.baseUrl && e.baseUrl ? { id: e.id, name: "string" == typeof e.name ? e.name : e.id, baseUrl: e.baseUrl, providerKind: "anthropic-messages" === e.providerKind ? "anthropic-messages" : "openai-compatible", model: "string" == typeof e.model ? e.model : "" } : null, normalizeAiSettingsV2 = e => { if (!isRecord(e) || 2 !== e.version) return null; const t = Array.isArray(e.instances) ? e.instances.map(normalizeInstance).filter((e => null !== e)) : [], n = Array.isArray(e.customChannels) ? e.customChannels.map(normalizeCustomChannel).filter((e => null !== e)) : [], a = isRecord(e.sceneOverrides) ? e.sceneOverrides : {}; return { version: 2, instances: t, customChannels: n, defaultChannelId: "string" == typeof e.defaultChannelId ? e.defaultChannelId : "", defaultVisionChannelId: "string" == typeof e.defaultVisionChannelId ? e.defaultVisionChannelId : "", enabledForAsk: true === e.enabledForAsk, adoptionStrategy: "direct" === e.adoptionStrategy || "preview" === e.adoptionStrategy ? e.adoptionStrategy : "conservative", sceneOverrides: { enabled: true === a.enabled, search: "string" == typeof a.search ? a.search : void 0, ask: "string" == typeof a.ask ? a.ask : void 0, repair: "string" == typeof a.repair ? a.repair : void 0 }, transport: "direct" === e.transport ? "direct" : "auto" }; }, loadAiSettingsFrom = (e, t, n) => { const a = e.get(Fe), i = normalizeAiSettingsV2(a); if (i) return i; a && !e.get(De) && e.set(De, a); const s = (e => { var t, n; if (!isRecord$1(e) || !Array.isArray(e.configs)) return null; const a = e.configs.map(normalizeAiConfig).filter((e => null !== e)), i = "string" == typeof e.defaultConfigId && a.some((t => t.id === e.defaultConfigId)) ? e.defaultConfigId : (null == (t = a.find((e => e.enabled))) ? void 0 : t.id) || (null == (n = a[0]) ? void 0 : n.id) || "", s = "string" == typeof e.defaultVisionConfigId && a.some((t => { var n; return t.id === e.defaultVisionConfigId && (null == (n = t.capabilities) ? void 0 : n.image); })) ? e.defaultVisionConfigId : "", r = isRecord$1(e.sceneOverrides) ? e.sceneOverrides : {}; return { configs: a, defaultConfigId: i, defaultVisionConfigId: s, enabledForAsk: a.length > 0 && "boolean" == typeof e.enabledForAsk && e.enabledForAsk, adoptionStrategy: isAdoptionStrategy(e.adoptionStrategy) ? e.adoptionStrategy : "conservative", sceneOverrides: { enabled: "boolean" == typeof r.enabled && r.enabled, search: "string" == typeof r.search ? r.search : void 0, ask: "string" == typeof r.ask ? r.ask : void 0, repair: "string" == typeof r.repair ? r.repair : void 0 } }; })(a) ?? (() => { try { return migrateLegacyAiSettings(n()); } catch { return null; } })(), r = s ? ((e, t) => { var n, a, i, s, r, o, l; if ("object" == typeof (l = e) && null !== l && 2 === l.version) return e; const c = [], u = [], p = new Map, adoptCustom = (e, t) => { c.push({ channelId: e.id, credential: t.credential, enabled: t.enabled }); }; for (const d of e.configs) { const e = matchChannel(d, t); if (!e) { if (null == (n = d.credential) ? void 0 : n.value) { const e = toCustomChannel(d); u.push(e), adoptCustom(e, d), p.set(d.id, e.id); } continue; } const o = e.models.some((e => e.id === d.model)) ? d.model : void 0, l = c.find((t => t.channelId === e.id)); if (l) if ((null == (a = l.credential) ? void 0 : a.value) || !(null == (i = d.credential) ? void 0 : i.value)) { if ((null == (s = l.credential) ? void 0 : s.value) && (null == (r = d.credential) ? void 0 : r.value) && l.credential.value !== d.credential.value) { const t = toCustomChannel(d, e.baseUrl); u.push(t), adoptCustom(t, d), p.set(d.id, t.id); } } else p.set(d.id, e.id), l.credential = d.credential, l.enabled = d.enabled, l.modelId = o; else p.set(d.id, e.id), c.push({ channelId: e.id, credential: d.credential, enabled: d.enabled, modelId: o }); } return { version: 2, instances: c, customChannels: u, defaultChannelId: p.get(e.defaultConfigId) || (null == (o = c[0]) ? void 0 : o.channelId) || "", defaultVisionChannelId: p.get(e.defaultVisionConfigId) || "", enabledForAsk: e.enabledForAsk, adoptionStrategy: e.adoptionStrategy, sceneOverrides: e.sceneOverrides, transport: "auto" }; })(s, t) : { version: 2, instances: [], customChannels: [], defaultChannelId: "", defaultVisionChannelId: "", enabledForAsk: false, adoptionStrategy: "conservative", sceneOverrides: { enabled: false }, transport: "auto" }; return e.set(Fe, r), r; }, asChannel = e => (e => !("models" in e))(e) ? { id: e.id, name: e.name, providerKind: e.providerKind, baseUrl: e.baseUrl, models: [ { id: e.model, capabilities: { text: true, image: false } } ], defaultModelId: e.model, stream: true, timeout: 3e4, region: "domestic", order: 0, recommended: false, signupUrl: "", docUrl: "", keyHelp: "", status: "active", directConnect: true } : e, resolveModel = (e, t) => e.models.find((e => e.id === t.modelId)) ?? e.models.find((t => t.id === e.defaultModelId)) ?? e.models[0], synthesizeAiConfig = (e, t) => { const n = resolveModel(e, t); return { id: e.id, name: e.name, providerId: e.id, providerKind: e.providerKind, baseUrl: e.baseUrl, model: (null == n ? void 0 : n.id) ?? e.defaultModelId, enabled: t.enabled, stream: e.stream, capabilities: (null == n ? void 0 : n.capabilities) ?? { text: true, image: false }, credential: t.credential, timeout: e.timeout, disableThinkingParams: e.disableThinkingParams }; }, resolveAiTarget = (e, t, n, a = "text") => { var i; const build = n => { var i; if (!n.enabled || !(null == (i = n.credential) ? void 0 : i.value)) return; const s = resolveChannel(t, e.customChannels, n.channelId); if (!s) return; const r = asChannel(s); return ((e, t) => e.models.some((e => e.capabilities[t])))(r, a) ? { channel: r, instance: n, config: synthesizeAiConfig(r, n) } : void 0; }, pick = t => { const n = e.instances.find((e => e.channelId === t)); return n ? build(n) : void 0; }, s = (null == (i = e.sceneOverrides) ? void 0 : i.enabled) ? e.sceneOverrides[n] : void 0; if ("image" === a) { const t = e.defaultVisionChannelId && pick(e.defaultVisionChannelId); if (t) return t; } const r = s && pick(s); if (r) return r; const o = pick(e.defaultChannelId); if (o) return o; for (const l of e.instances) { const e = build(l); if (e) return e; } }, channelTags = e => { const t = []; return e.recommended && t.push({ label: "\u63a8\u8350", cls: "aah-tag-primary" }), e.promoText && t.push({ label: "\u6709\u514d\u8d39\u989d\u5ea6", cls: "aah-tag-success" }), "global" === e.region ? t.push({ label: "\u9700\u81ea\u5907\u4ee3\u7406", cls: "aah-tag-warning" }) : canDirectConnect(e) ? t.push({ label: "\u56fd\u5185\u76f4\u8fde", cls: "" }) : t.push({ label: "\u9700\u767b\u5f55\u4e2d\u8f6c", cls: "aah-tag-warning" }), hasVisionModel(e) && t.push({ label: "\u53ef\u9009\u89c6\u89c9\u6a21\u578b", cls: "" }), t; }, hasVisionModel = e => e.models.some((e => e.capabilities.image)), imageReadiness = (e, t) => { const n = resolveModel(e, t), a = (null == n ? void 0 : n.id) ?? e.defaultModelId; if (null == n ? void 0 : n.capabilities.image) return { state: "ready", modelId: a }; const i = e.models.find((e => e.capabilities.image)); return i ? { state: "switchable", modelId: a, suggestModelId: i.id } : { state: "unsupported", modelId: a }; }, Ne = /]*\bsrc\s*=\s*["']([^"']+)["'][^>]*>/gi, Re = /(?:spacer|blank|transparent)\.(?:gif|png|webp)(?:[?#].*)?$/i, Be = [ "data-src", "data-original", "data-lazy-src", "data-echo" ], resolveImageSrc = (e, t) => { if (!e) return ""; const n = e.trim().replace(/&/g, "&"); if (/^(?:data:|blob:)/i.test(n)) return n; const a = (e => { var t; return e || (null == (t = globalThis.location) ? void 0 : t.href) || ""; })(t); if (!a) return n; try { return new URL(n, a).href; } catch { return n; } }, shouldUseImageSrc = e => !!e && (!Re.test(e) && (!!/^(?:https?:|blob:)/i.test(e) || (/^data:/i.test(e) ? /^data:image\//i.test(e) : !/^[a-z][a-z0-9+.-]*:/i.test(e)))), getAttr = (e, t) => { const n = "function" == typeof (null == e ? void 0 : e.getAttribute) ? e.getAttribute(t) : null; return "string" == typeof n ? n : ""; }, pickElementSrc = e => { const t = (null == e ? void 0 : e.currentSrc) || (null == e ? void 0 : e.src) || getAttr(e, "src"); if (Number(null == e ? void 0 : e.naturalWidth) > 0) return t; for (const i of Be) { const t = getAttr(e, i); if (t) return t; } return (n = getAttr(e, "srcset")) && (null == (a = n.split(",").map((e => e.trim())).filter(Boolean).map((e => { const [t, n = ""] = e.split(/\s+/); return { url: t, weight: Number(n.replace(/[wx]$/i, "")) || 0 }; })).sort(((e, t) => t.weight - e.weight))[0]) ? void 0 : a.url) || "" || t; var n, a; }, extractRefsFromString = (e, t) => { const n = []; for (const a of e.matchAll(Ne)) { const e = resolveImageSrc(a[1], t); shouldUseImageSrc(e) && n.push({ src: e }); } return n; }, collectRefs = (e, t) => { return e ? "string" == typeof e ? extractRefsFromString(e, t) : (n = e) && "object" == typeof n && "function" == typeof n.querySelectorAll ? Array.from(e.querySelectorAll("img") || []).filter((e => !(e => { const t = Number(null == e ? void 0 : e.naturalWidth), n = Number(null == e ? void 0 : e.naturalHeight); return t > 0 && n > 0 && t < 32 && n < 32; })(e))).map((e => ({ src: resolveImageSrc(pickElementSrc(e), t), el: e }))).filter((e => shouldUseImageSrc(e.src))) : "string" == typeof e.outerHTML ? extractRefsFromString(e.outerHTML, t) : "string" == typeof e.innerHTML ? extractRefsFromString(e.innerHTML, t) : [] : []; var n; }, uniqueRefs = e => { const t = new Map; for (const n of e) { const e = t.get(n.src); (!e || !e.el && n.el) && t.set(n.src, n); } return Array.from(t.values()); }, extractQuestionImageRefs = (e, t = {}) => uniqueRefs([ ...collectRefs(e.question, t.baseUrl), ...collectRefs(e.html, t.baseUrl), ...Array.isArray(e.options) ? e.options.flatMap((e => collectRefs(e, t.baseUrl))) : [] ]), hasQuestionImages = (e, t = "") => { return (e => extractQuestionImageRefs(e).map((e => e.src)))(e).length > 0 || (n = t, uniqueRefs(collectRefs(n)).map((e => e.src))).length > 0; var n; }, toBytes = e => e instanceof ArrayBuffer ? new Uint8Array(e) : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : void 0, bytesToBase64 = e => { const t = toBytes(e); if (!t) throw createAiError("AI_RESPONSE_PARSE_FAILED"); if ("undefined" != typeof Buffer) return Buffer.from(t).toString("base64"); let n = ""; for (let a = 0; a < t.length; a += 8192) n += String.fromCharCode(...t.subarray(a, a + 8192)); return btoa(n); }, buildImagePart = (e, t, n, a = {}) => { const i = toBytes(t); if (!i || 0 === i.byteLength) throw new Error("\u56fe\u7247\u54cd\u5e94\u4f53\u4e3a\u7a7a"); const s = a.maxBytes || 4194304; if (i.byteLength > s) throw new Error(`\u56fe\u7247\u8fc7\u5927\uff08${Math.round(i.byteLength / 1024)}KB\uff0c\u4e0a\u9650 ${Math.round(s / 1024)}KB\uff09`); const r = (n || "").split(";")[0].trim().toLowerCase(); if (r && !r.startsWith("image/")) throw new Error(`\u54cd\u5e94\u4e0d\u662f\u56fe\u7247\uff08${r}\uff09\uff0c\u53ef\u80fd\u662f\u767b\u5f55\u6001\u5931\u6548\u8df3\u8f6c\u4e86\u767b\u5f55\u9875`); return { type: "image", source: "base64", data: bytesToBase64(i), mimeType: r || "image/png", url: e }; }, decodeDataUrl = e => { const t = e.match(/^data:([^;,]+);base64,(.+)$/i); if (!t) throw createAiError("AI_RESPONSE_PARSE_FAILED"); return { type: "image", source: "base64", data: t[2], mimeType: t[1], url: e }; }, defaultCreateCanvas = () => { if ("undefined" == typeof document) throw new Error("\u5f53\u524d\u73af\u5883\u6ca1\u6709 document\uff0c\u65e0\u6cd5\u4f7f\u7528\u753b\u5e03"); return document.createElement("canvas"); }, loadImagePartFromElement = async (e, t = {}) => { const n = e.el, a = Number(null == n ? void 0 : n.naturalWidth) || 0, i = Number(null == n ? void 0 : n.naturalHeight) || 0; if (!(a > 0 && i > 0)) throw new Error("\u56fe\u7247\u5c1a\u672a\u52a0\u8f7d\u5b8c\u6210"); const s = ((e, t, n = 1568) => { const a = Math.max(e, t); if (!(a > n)) return { width: e, height: t }; const i = n / a; return { width: Math.max(1, Math.round(e * i)), height: Math.max(1, Math.round(t * i)) }; })(a, i, t.maxEdge || 1568), r = (t.createCanvas || defaultCreateCanvas)(); r.width = s.width, r.height = s.height; const o = r.getContext("2d"); if (!o) throw new Error("\u753b\u5e03\u4e0a\u4e0b\u6587\u4e0d\u53ef\u7528"); o.fillStyle = "#ffffff", o.fillRect(0, 0, s.width, s.height), o.drawImage(n, 0, 0, s.width, s.height); const l = r.toDataURL(t.mimeType || "image/jpeg", t.quality ?? .85); if (!/^data:image\//i.test(l)) throw new Error("\u753b\u5e03\u5bfc\u51fa\u5931\u8d25"); return { ...decodeDataUrl(l), url: e.src }; }, loadImagePartFromFetch = async (e, t = {}) => { const n = t.fetchImpl || ("function" == typeof fetch ? fetch : void 0); if (!n) throw new Error("\u5f53\u524d\u73af\u5883\u4e0d\u652f\u6301 fetch"); return (async (e, t) => { const n = "function" == typeof AbortController ? new AbortController : void 0; let a; const i = new Promise(((e, i) => { a = setTimeout((() => { null == n || n.abort(), i(new Error(`\u53d6\u56fe\u8d85\u65f6\uff08${t}ms\uff09`)); }), t); })); try { return await Promise.race([ e(null == n ? void 0 : n.signal), i ]); } finally { clearTimeout(a); } })((async a => { var i, s; const r = await n(e, { credentials: "same-origin", signal: a }); if (!(null == r ? void 0 : r.ok)) throw new Error(`\u56fe\u7247\u8bf7\u6c42\u5931\u8d25 HTTP ${(null == r ? void 0 : r.status) ?? "\u672a\u77e5"}`); const o = await r.arrayBuffer(); return buildImagePart(e, o, (null == (s = null == (i = r.headers) ? void 0 : i.get) ? void 0 : s.call(i, "content-type")) || "", { maxBytes: t.maxBytes }); }), t.timeout || 2e4); }, loadQuestionImagePart = async (e, t = {}) => { if (/^data:/i.test(e.src)) return decodeDataUrl(e.src); const n = t.fromElement || (e => loadImagePartFromElement(e, t)), a = t.fromFetch || (e => loadImagePartFromFetch(e, t)), i = t.fromGm || (e => (async (e, t = {}) => { const n = t.transport || createAiTransportRequest, a = await n({ method: "GET", url: e, responseType: "arraybuffer", timeout: t.timeout || 2e4 }).promise; return buildImagePart(e, a.response, (e => { var t; const n = null == e ? void 0 : e.match(/content-type:\s*([^;\r\n]+)/i); return null == (t = null == n ? void 0 : n[1]) ? void 0 : t.trim(); })(a.responseHeaders), { maxBytes: t.maxBytes }); })(e, t)), s = []; e.el && s.push([ "canvas", () => n(e) ]), s.push([ "\u540c\u6e90\u8bf7\u6c42", () => a(e.src) ]), s.push([ "GM \u8bf7\u6c42", () => i(e.src) ]); const r = []; for (const [l, c] of s) try { return await c(); } catch (o) { r.push(`${l}\uff1a${(null == o ? void 0 : o.message) || o}`); } throw new Error(r.length ? r.join("\uff1b") : "\u6ca1\u6709\u53ef\u7528\u7684\u53d6\u56fe\u901a\u9053"); }, base64Bytes = e => { const t = e.endsWith("==") ? 2 : e.endsWith("=") ? 1 : 0; return Math.max(0, 3 * Math.floor(e.length / 4) - t); }, resolveQuestionImages = async (e, t = {}) => { const n = extractQuestionImageRefs(e, t); if (!n.length) return { parts: [], failures: [] }; const a = t.maxImages || 6, i = n.slice(0, a), s = n.slice(a).map((e => ({ src: e.src, reason: `\u8d85\u51fa\u5355\u9898\u56fe\u7247\u4e0a\u9650\uff08${a} \u5f20\uff09` }))), r = t.loadPart || (e => loadQuestionImagePart(e, t)), o = await (async (e, t, n) => { const a = new Array(e.length); let i = 0; const s = Array.from({ length: Math.max(1, Math.min(t, e.length)) }, (async () => { for (;i < e.length; ) { const t = i; i += 1, a[t] = await n(e[t]); } })); return await Promise.all(s), a; })(i, t.concurrency || 2, (async e => { try { return { ref: e, part: await r(e) }; } catch (t) { return { ref: e, reason: (null == t ? void 0 : t.message) || "\u53d6\u56fe\u5931\u8d25" }; } })), l = [], c = t.maxTotalBytes || 12582912; let u = 0; for (const p of o) { if (!p.part) { s.push({ src: p.ref.src, reason: p.reason || "\u53d6\u56fe\u5931\u8d25" }); continue; } const e = base64Bytes(p.part.data); u + e > c ? s.push({ src: p.ref.src, reason: `\u8d85\u51fa\u5355\u9898\u56fe\u7247\u603b\u91cf\u4e0a\u9650\uff08${Math.round(c / 1024)}KB\uff09` }) : (u += e, l.push(p.part)); } return { parts: l, failures: s }; }, Ge = { "\u5355\u9009\u9898": "0", "\u591a\u9009\u9898": "1", "\u586b\u7a7a\u9898": "2", "\u5224\u65ad\u9898": "3", "\u7b80\u7b54\u9898": "4", "\u95ee\u7b54\u9898": "4", "\u540d\u8bcd\u89e3\u91ca": "5", "\u8bba\u8ff0\u9898": "6", "\u8ba1\u7b97\u9898": "7", "\u5206\u5f55\u9898": "9", "\u8d44\u6599\u9898": "10", "\u8fde\u7ebf\u9898": "11", "\u5339\u914d\u9898": "11", "\u6392\u5e8f\u9898": "13", "\u5b8c\u578b\u586b\u7a7a": "14", "\u5b8c\u5f62\u586b\u7a7a\u9898": "14", "\u9605\u8bfb\u7406\u89e3": "15", "\u7a0b\u5e8f\u9898": "17", "\u53e3\u8bed\u9898": "18", "\u542c\u529b\u9898": "19", "\u5171\u7528\u9009\u9879\u9898": "20", "\u6d4b\u8bc4\u9898": "21", "\u949f\u8868\u9898": "23", "\u9009\u8bcd\u586b\u7a7a": "24", "\u9009\u505a\u9898": "25", "\u5176\u5b83": "8" }, Ke = randomString(9) + "_", Ve = te; function getAppStore() { return se[Ke + "app"]; } function getAskStore() { return se[Ke + "ask"]; } function isParentChecked(e) { return e.parent().parent().hasClass("is-checked"); } function qc(e) { O(e).find(".answerBg, .textDIV, .eidtDiv").each((function() { (O(this).find(".check_answer").length || O(this).find(".check_answer_dx").length) && O(this).click(); })), O(e).find(".answerBg, .textDIV, .eidtDiv").find("textarea").each((function() { se.UE.getEditor(O(this).attr("name")).ready((function() { this.setContent(""); })); })), O(e).find(":radio, :checkbox").prop("checked", false), O(e).find("textarea").each((function() { se.UE.getEditor(O(this).attr("name")).ready((function() { this.setContent(""); })); })); } function qc1(e) { O(e).find(".before-after,.before-after-checkbox, .textDIV, .eidtDiv").each((function() { (O(this).find(".check_answer").length || O(this).find(".check_answer_dx").length) && O(this).click(); })), O(e).find(".before-after, .textDIV, .eidtDiv").find("textarea").each((function() { se.UE.getEditor(O(this).attr("name")).ready((function() { this.setContent(""); })); })), O(e).find(":radio, :checkbox").prop("checked", false), O(e).find("textarea").each((function() { se.UE.getEditor(O(this).attr("name")).ready((function() { this.setContent(""); })); })); } se.ksv = md5(Ve.script.author + Ve.script.name.replace(/server:/, "").trim()), oe = getAppStore; const We = [ { type: "hook", name: "\u4e91\u5e55\u5b66\u82d1hook", match: location.host.includes("w-ling.cn"), main: e => { observeVuePageChange(O("#app")[0], (() => O("#app")[0].__vue__.$route.path), { beforeChange: async e => { "homework-detail-container" === e && await waitUntil((function() { return 0 !== O(".selectDan").length; })); } }); } }, { type: "save", name: "\u4e91\u5e55\u5b66\u82d1\u6536\u5f55", match: () => location.host.includes("w-ling.cn") && location.href.includes("practiceRecord"), question: { html: ".selectDan >div >div", question: ".title", options: ".selectItem label .tagbq", type: ".question-box .tag", workType: "yunmuxueyuan", pageType: "yunmuxueyuan" }, init: async () => { await waitUntil((function() { return isExist(".selectDan >div >div"); })); }, answerHook: e => { const t = O(e.html).parent().find("h3").text().split("\u3001")[1]; e.question = e.question.replace(/^\d+\u3001/, ""), e.question = e.question.replace(/\(\d+\u5206\)$/, ""); let n = O(e.html).find(".anaylize > span:eq(0)").text().replace("\u4f5c\u7b54\u6b63\u786e\uff1a", ""); switch ("" === n && (n = O(e.html).find(".falsanaly > span:eq(1)").text().replace("\u6b63\u786e\u7b54\u6848\uff1a", "")), t) { case "\u5355\u9009\u9898": case "\u591a\u9009\u9898": let t = n.split(""); if (e.answer = t.map((t => e.options[t.charCodeAt(0) - 65])), 0 === e.answer.length) return; e.answer.length > 1 ? e.type = "1" : e.type = "0"; break; case "\u5224\u65ad\u9898": e.type = "3", "T" == n && (e.answer = [ "\u6b63\u786e" ]), "F" == n && (e.answer = [ "\u9519\u8bef" ]); break; case "\u586b\u7a7a\u9898": e.answer = O(e.html).find(".riganswer > span").first().nextAll("span").map(((e, t) => removeHtml(O(t).text()))).get(), e.type = "2"; } return e; } }, { type: "ask", name: "\u4e91\u5e55\u5b66\u82d1", tips: "", match: () => location.host.includes("w-ling.cn") && (location.href.includes("practicePaper") || location.href.includes("examIndex")), types: [ "0", "1", "3" ], question: { html: ".selectDan >div >div", question: ".title", options: ".selectItem label .tagbq", type: ".question-box .tag", workType: "yunmuxueyuan", pageType: "yunmuxueyuan" }, init: async () => { await waitUntil((function() { return 0 !== O(".selectDan >div >div").length; })); }, ischecked: isParentChecked, questionHook: e => { e.question = e.question.replace(/^\d+\u3001/, ""), e.question = e.question.replace(/\(\d+\u5206\)$/, ""); switch (O(e.html).parent().find("h4").text().split("\u3001")[1]) { case "\u5355\u9009\u9898": e.type = "0"; break; case "\u591a\u9009\u9898": e.type = "1"; break; case "\u5224\u65ad\u9898": e.type = "3", e.$options = O(e.html).find(".selectItem label"), e.options = e.$options.map(((e, t) => removeHtml(O(t).text()))).get(), e.$options; break; case "\u586b\u7a7a\u9898": e.type = "2"; } return e; }, setAnswer: e => { switch (e.type) { case "3": break; case "2": return O(e.html).find(".tiankong input").each(((t, n) => { let a = O(n).parent()[0].__vue__; O(n).val(e.answer[t]); const i = new Event("input"); n.dispatchEvent(i), a.$emit("change", e.answer[t]); })), false; } return true; } } ], Qe = "\u7b54\u9898\u5df2\u53d6\u6d88", assertFillShouldContinue = e => { if ((null == e ? void 0 : e.shouldContinue) && !e.shouldContinue()) throw new Error(Qe); }, fillPlanToLegacyAnswerData = e => "choice" === e.kind ? [ "xx", e.indexes ] : "judge" === e.kind ? [ "pd", e.value ] : "blank" === e.kind ? [ "jd", e.values ] : "link" === e.kind ? [ "lx", e.value ] : "reading" === e.kind ? [ "ydlj", e.subPlans.map((e => "choice" === e.kind ? e.indexes : "judge" === e.kind ? [ e.value ] : "blank" === e.kind ? e.values : [])) ] : [ "", [] ], rawFormForLegacyMatch = e => { if (!e || "object" != typeof e) return {}; const t = { ...e }; var n; return !("match" in t) || (n = t.match, Array.isArray(n) && n.every((e => "number" == typeof e || Array.isArray(e)))) || delete t.match, t; }, createLegacyMatchResult = e => { if (!e.haveAnswer || !e.source || !e.fillPlan) return { res: e.displayAnswers.map((e => e.raw || e)), haveAnswer: false }; const [, t] = fillPlanToLegacyAnswerData(e.fillPlan); return { res: e.displayAnswers.map((e => e.raw || e)), form: { ...rawFormForLegacyMatch(e.source.raw), form: e.source.source, answer: e.source.answer, ...void 0 !== e.source.duration ? { duration: e.source.duration } : {}, ...void 0 !== e.source.msg ? { msg: e.source.msg } : {}, ...void 0 !== e.source.needLogin ? { needLogin: e.source.needLogin } : {}, ...(n = e.fillPlan, "choice" === n.kind || "reading" === n.kind ? { match: t } : {}) }, haveAnswer: true }; var n; }, applyFillPlan = async (e, t, n, a, i) => { const [s, r] = fillPlanToLegacyAnswerData(e); if (!s) return { success: false, reason: "unsupported" === e.kind ? e.reason : "\u5f53\u524d\u9898\u578b\u6682\u4e0d\u652f\u6301\u586b\u5145" }; const o = (null == i ? void 0 : i.shouldContinue) ? { shouldContinue: () => (assertFillShouldContinue(i), true) } : void 0; try { return assertFillShouldContinue(i), await a(s, r, t, n, o), assertFillShouldContinue(i), { success: !0 }; } catch (l) { if ((e => e instanceof Error && e.message === Qe)(l)) return { success: false, reason: Qe }; throw l; } }, isLoggedInUserCache = e => Boolean(e && e.user && e.api_key), isPlainObject = e => "object" == typeof e && null !== e && !Array.isArray(e), cloneValue = e => { if (Array.isArray(e)) return e.map((e => cloneValue(e))); if (!isPlainObject(e)) return e; const t = {}; return Object.entries(e).forEach((([e, n]) => { t[e] = cloneValue(n); })), t; }, cloneWithLegacySignatureArraySort = (e, t = true, n = true) => { if (Array.isArray(e)) return t && e.every((e => "object" != typeof e)) ? [ ...e ].sort() : e.map((e => cloneValue(e))); if (!isPlainObject(e)) return e; const a = {}; return Object.entries(e).forEach((([e, i]) => { a[e] = cloneWithLegacySignatureArraySort(i, t && !(n && "html" === e), false); })), a; }; class AnonymousIdentityOptimized { static generateShortId() { return Date.now().toString(36).padStart(8, "0").slice(-8) + Array.from({ length: 8 }, (() => "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[Math.floor(62 * Math.random())])).join(""); } static validateId(e) { return /^[0-9A-Za-z]{16}$/.test(e); } static getAnonymousId() { if (this.cachedAnonymousId) return this.cachedAnonymousId; let e = ee(this.STORAGE_KEY); return e && this.validateId(e) || (e = this.generateShortId(), ae(this.STORAGE_KEY, e)), this.cachedAnonymousId = e, e; } static getStableCanvasFingerprint() { try { const e = document.createElement("canvas"); e.width = 220, e.height = 30; const t = e.getContext("2d", { willReadFrequently: !0 }); if (!t) return ""; t.textBaseline = "alphabetic", t.fillStyle = "#000", t.font = "16px Arial", t.fillText("AiAsk,\ud83c\udf10.\ud83d\ude00", 2, 20); const n = t.getImageData(0, 0, 220, 30).data; let a = 0; for (let i = 0; i < n.length; i += 40) a = (a << 5) - a + n[i], a |= 0; return a.toString(36); } catch (e) { return ""; } } static getWebGLFingerprint() { try { const e = document.createElement("canvas"), t = e.getContext("webgl") || e.getContext("experimental-webgl"); if (!t) return ""; const n = t.getExtension("WEBGL_debug_renderer_info"); if (!n) return t.getParameter(t.VERSION) + "|" + t.getParameter(t.VENDOR); const a = t.getParameter(n.UNMASKED_VENDOR_WEBGL); return a + "|" + t.getParameter(n.UNMASKED_RENDERER_WEBGL); } catch (e) { return ""; } } static getDeviceFingerprint() { if (this.cachedFingerprint) return this.cachedFingerprint; const e = ee(this.FINGERPRINT_KEY); if (e && e.version === this.FP_VERSION && e.value) return this.cachedFingerprint = e.value, e.value, e.value; const t = [ this.normalizeUserAgent(navigator.userAgent), navigator.language, navigator.platform, screen.colorDepth, screen.pixelDepth || screen.colorDepth, (new Date).getTimezoneOffset(), navigator.hardwareConcurrency || 0, navigator.maxTouchPoints || 0, navigator.deviceMemory || 0, this.getWebGLFingerprint(), this.getStableCanvasFingerprint() ], n = md5(t.filter(Boolean).join("|")).substring(0, 12); return ae(this.FINGERPRINT_KEY, { value: n, version: this.FP_VERSION, createdAt: Date.now() }), this.cachedFingerprint = n, n; } static normalizeUserAgent(e) { return e.includes("Chrome") ? "Chrome" : e.includes("Firefox") ? "Firefox" : e.includes("Safari") ? "Safari" : e.includes("Edge") ? "Edge" : e.includes("Opera") ? "Opera" : "Unknown"; } static getIdentity() { return { anonymous_id: this.getAnonymousId(), device_fingerprint: this.getDeviceFingerprint() }; } static clear() { ae(this.STORAGE_KEY, null), ae(this.FINGERPRINT_KEY, null), this.cachedAnonymousId = null, this.cachedFingerprint = null; } static regenerateFingerprint() { return ae(this.FINGERPRINT_KEY, null), this.cachedFingerprint = null, this.getDeviceFingerprint(); } static getDebugInfo() { return { anonymous_id: this.getAnonymousId(), device_fingerprint: this.getDeviceFingerprint(), fingerprint_components: { browser: this.normalizeUserAgent(navigator.userAgent), language: navigator.language, platform: navigator.platform, screen_color: screen.colorDepth, timezone: (new Date).getTimezoneOffset(), hardware: navigator.hardwareConcurrency, webgl: this.getWebGLFingerprint() }, storage: { fp_stored: ee(this.FINGERPRINT_KEY), id_stored: ee(this.STORAGE_KEY) } }; } static async testStability(e = 10) { const t = []; for (let a = 0; a < e; a++) { this.cachedFingerprint = null; const e = this.getDeviceFingerprint(); t.push(e), await new Promise((e => setTimeout(e, 100))); } const n = new Set(t); n.size, n.size, Array.from(n), n.size, 1 === n.size ? t[0] : n.size; } } __publicField(AnonymousIdentityOptimized, "STORAGE_KEY", "anonymous_id"), __publicField(AnonymousIdentityOptimized, "FINGERPRINT_KEY", "device_fingerprint"), __publicField(AnonymousIdentityOptimized, "FP_VERSION", "v2"), __publicField(AnonymousIdentityOptimized, "cachedAnonymousId", null), __publicField(AnonymousIdentityOptimized, "cachedFingerprint", null); const Je = new Set([ "authorization", "api_key", "x-anonymous-id", "x-device-fp", "anonymous_id", "device_fingerprint", "x-ai-credential" ]), redactValue = (e, t) => Je.has(e.toLowerCase()) ? "***" : "string" == typeof t && /bearer\s+/i.test(t) ? "Bearer ***" : t, redactRequestLog = e => { if (Array.isArray(e)) return e.map((e => redactRequestLog(e))); if (!e || "object" != typeof e) return e; const t = {}; return Object.entries(e).forEach((([e, n]) => { if ("string" == typeof n && (n.trim().startsWith("{") || n.trim().startsWith("["))) try { return void (t[e] = JSON.stringify(redactRequestLog(JSON.parse(n)))); } catch { return void (t[e] = redactValue(e, n)); } t[e] = redactValue(e, redactRequestLog(n)); })), t; }; function requestApi(e, t, n = void 0, a = void 0, i = 5e3) { return "GET" === t && n && (e += `?${new URLSearchParams(n).toString()}`), new Promise((async (s, r) => { try { const o = Cache.get("user", {}), l = isLoggedInUserCache(o), c = AnonymousIdentityOptimized.getIdentity(), u = "POST" !== t || l ? n : { ...n, anonymous_id: c.anonymous_id, device_fingerprint: c.device_fingerprint }, p = await (async (e, t, n) => { if ("POST" === e) { const e = get_t(t), a = cloneWithLegacySignatureArraySort(t); return { aka: e, body: { data: await n(JSON.stringify(a), e) } }; } return { aka: get_t({}) }; })(t, u, encrypt), d = (e => { const t = { "User-Agent": e.userAgent, "Content-Type": "application/json", referer: e.referer, v: e.version, ...e.headers, aka: e.aka }; return isLoggedInUserCache(e.userCache) ? t.Authorization = `Bearer ${e.userCache.api_key}` : (t["X-Anonymous-ID"] = e.identity.anonymous_id, t["X-Device-FP"] = e.identity.device_fingerprint), t; })({ headers: a, userAgent: se.navigator.userAgent, referer: location.href, version: Ve.script.version, aka: p.aka, userCache: o, identity: c }), m = Date.now(); redactRequestLog({ url: e, method: t, data: JSON.stringify(u), headers: d }), ie({ method: t, url: e, headers: d, data: "GET" !== t ? JSON.stringify(p.body) : void 0, timeout: i, onload: async function(e) { const t = Date.now() - m; try { const n = await (async (e, t) => { let n; try { n = JSON.parse(e.responseText); } catch { throw new Error("\u63a5\u53e3\u54cd\u5e94\u4e0d\u662f\u6709\u6548 JSON"); } if (!(null == n ? void 0 : n.encrypted)) return e; const a = await t(String(n.data ?? "")); if (!a) throw new Error("\u63a5\u53e3\u54cd\u5e94\u89e3\u5bc6\u5931\u8d25"); return { ...e, responseText: a }; })(e, decrypt); JSON.parse(n.responseText), s([ n, t ]); } catch (n) { String(n), r(n); } }, ontimeout: () => r(new Error("\u63a5\u53e3\u8bf7\u6c42\u8d85\u65f6")), onerror: e => { r(e); } }); } catch (o) { r(o); } })); } const apiUrl = e => `https://www.aiask.site/v1/${e}`; function request(e, t, n = void 0, a = void 0, i = 5e3) { "GET" === t && n && (e += `?${new URLSearchParams(n).toString()}`), "POST" === t && (a = { ...a }); const s = { "User-Agent": se.navigator.userAgent, "Content-Type": "application/json", referer: location.href, ...a }; return new Promise(((a, r) => { const o = Date.now(); ie({ method: t, url: e, headers: s, data: "GET" !== t ? JSON.stringify(n) : void 0, timeout: i, onload: function(e) { const t = Date.now(); a([ e, t - o ]); }, ontimeout: () => r(new Error("\u63a5\u53e3\u8bf7\u6c42\u8d85\u65f6")), onerror: e => { r(e); } }); })); } const getNonAnswerMessage = e => { const t = findNonAnswerText(e); return t ? `\u63a5\u53e3\u8fd4\u56de\u975e\u7b54\u6848\u6587\u6848\uff1a${t}` : ""; }; class Answer { constructor() {} static score(e, t) { let n = Cache.get("api_" + e, { score: 0 }); n.score += t, Cache.set("api_" + e, n, 600); } static async getAnswersFree(e) { const t = [ this.getMainAnswer(e), this.getAnswer1(e) ]; return Promise.all(t); } static async getAnswer1(e) { let t = function() { let e = Array.from({ length: 4 }, (() => Math.floor(255 * Math.random()))).join("."); return { "X-Forwarded-For": e, "X-Real-IP": e }; }(); return new Promise((n => { request("http://cx.icodef.com/wyn-nb?v=4", "POST", { question: e.question }, t).then((e => { let t = e[1]; try { e = JSON.parse(e[0].responseText); } catch (s) { n({ form: "\u4e00\u4e4b\u9898\u5e93", answer: null, error: s, duration: t }); } let a = ""; if (1 === e.code) { let t = e.data.replace(/javascript:void\(0\);/g, "").trim().replace(/\n/g, ""); [ "\u53db\u9006", "\u516c\u4f17\u53f7", "\u674e\u6052\u96c5", "\u4e00\u4e4b" ].every((e => !t.includes(e))) && (a = t.split("#")); } const i = getNonAnswerMessage(a); n({ form: "\u4e00\u4e4b\u9898\u5e93", answer: i ? "" : a, duration: t, ...i ? { msg: i } : {} }); })).catch((e => { "timeout" === e && this.score("icodef", -1), n({ form: "\u4e00\u4e4b\u9898\u5e93", answer: "", msg: e, duration: 5e3 }); })); })); } static getTimestamp() { return Math.floor((new Date).getTime() / 1e3); } static cacheAnswer(e) { const t = { type: e.type, question: e.question, options: e.options, answer: e.answer }, n = findNonAnswerText(t.answer); if (n) return; const a = questionHash(t.type, t.question, t.options); t.createTime = this.getTimestamp(), Cache.set("ques1_" + a, t); } static async getCacheAnswer(e) { const t = questionHash(e.type, e.question, e.options); e.type, e.question, e.options; let n = Cache.get("ques1_" + t); return n ? { form: "\u672c\u5730\u7f13\u5b58", answer: n.answer, duration: 10 } : { form: "\u672c\u5730\u7f13\u5b58", answer: "", duration: 10, msg: "\u672a\u627e\u5230\u7f13\u5b58" }; } static getMainAnswer(e) { const t = (n = e.question, a = isLoggedInUserCache(Cache.get("user", {})), "string" != typeof n || "" === n.trim() ? { answer: "", duration: 0, msg: "\u9898\u5e72\u4e3a\u7a7a\uff0c\u672a\u67e5\u8be2\u9898\u5e93" } : a ? null : { answer: "", duration: 0, msg: "\u767b\u5f55\u540e\u624d\u53ef\u4ee5\u4f7f\u7528\u9898\u5e93\u641c\u9898\uff0c\u8bf7\u5148\u767b\u5f55", needLogin: true }); var n, a; if (t) return t.msg, Promise.resolve({ form: "\u7231\u95ee\u7b54\u9898\u5e93", ...t }); const i = { type: e.type, question: e.question, options: e.options.map((e => e)), workType: e.workType, pageType: e.pageType }, s = apiUrl("question/search"); return new Promise((e => { requestApi(s, "POST", i, {}, 6e3).then((t => { var n; let a = t[1]; t = JSON.parse(t[0].responseText); const i = getNonAnswerMessage(null == (n = t.data) ? void 0 : n.answer); 200 === t.code && t.data.answer && !i ? e({ form: "\u7231\u95ee\u7b54\u9898\u5e93", answer: t.data.answer, duration: a, msg: t.message }) : i ? e({ form: "\u7231\u95ee\u7b54\u9898\u5e93", answer: "", duration: a, msg: i }) : 401 === t.code ? e({ form: "\u7231\u95ee\u7b54\u9898\u5e93", answer: "", duration: a, msg: t.message, needLogin: true }) : e({ form: "\u7231\u95ee\u7b54\u9898\u5e93", answer: "", duration: a, msg: t.message }); })).catch((t => { e({ form: "\u7231\u95ee\u7b54\u9898\u5e93", answer: "", error: t, duration: 10, msg: "\u8bf7\u6c42\u5931\u8d25" }); })); })); } static async syncQuestionList(e) { return new Promise((t => { requestApi(apiUrl("question/sync"), "POST", e, {}).then((e => { e[0].responseText, t(e[0].responseText); })).catch((e => { t(e); })); })); } static async syncPaper(e) { return new Promise(((t, n) => { requestApi(apiUrl("question/courseSync"), "POST", e, {}).then((e => { try { const n = e[0].responseText, a = JSON.parse(n); a && (200 === a.code || 0 === a.code || a.success), t(a); } catch (n) { t({ code: -1, error: n, msg: "\u54cd\u5e94\u89e3\u6790\u5931\u8d25" }); } })).catch((e => { t({ code: -1, error: e, msg: "\u7f51\u7edc\u8bf7\u6c42\u5931\u8d25" }); })); })); } } const defaultSetAnswer = async (e, t, n, a, i) => { var s; switch (assertFillShouldContinue(i), e) { case "xx": { const optionClickDelay = () => a.optionDelay ? Math.floor(a.optionDelay + 500 * Math.random()) : Math.floor(300 * Math.random() + 200); let e = false; for (let s = 0; s < n.$options.length; s++) { assertFillShouldContinue(i); const r = !(!a.ischecked || !a.ischecked(n.$options.eq(s))); t.includes(s) !== r && (e && (await sleep(optionClickDelay()), assertFillShouldContinue(i)), n.$options.eq(s).click(), e = true); } break; } case "pd": let e = t; 0 == n.options.length ? n.$options.each(((t, n) => { assertFillShouldContinue(i), isTrue(e) && isTrue(removeHtml(O(n).html())) && O(n).click(), isFalse(e) && isFalse(removeHtml(O(n).html())) && O(n).click(); })) : n.$options.each(((t, a) => { assertFillShouldContinue(i), isTrue(e) && isTrue(n.options[t]) && O(a).click(), isFalse(e) && isFalse(n.options[t]) && O(a).click(); })); break; case "jd": O(n.html).find("textarea").each((function(e) { assertFillShouldContinue(i), se.UE.getEditor(O(this).attr("name")).ready((function() { this.setContent(t[e].replace(/\u7b2c.\u7a7a:/g, "")); })); })), null == (s = O(n.html).find(".savebtndiv>a")) || s.click(); break; case "ydlj": if (Array.isArray(t) && n.options) for (let s = 0; s < t.length && s < n.options.length; s++) { assertFillShouldContinue(i); let e = t[s], r = n.options[s]; if (Array.isArray(e) && e.length > 0 && r.$options) for (let t = 0; t < r.$options.length; t++) if (assertFillShouldContinue(i), e.includes(t)) { if (a.ischecked && a.ischecked(r.$options.eq(t))) continue; r.$options.eq(t).click(), await sleep(Math.floor(300 * Math.random() + 200)); } else a.ischecked && a.ischecked(r.$options.eq(t)) && (r.$options.eq(t).click(), await sleep(Math.floor(300 * Math.random() + 200))); } } }, applyAnswerResult = async (e, t, n, a, i) => { let s = true; assertFillShouldContinue(i), a.setAnswerHook && "function" == typeof a.setAnswerHook && await a.setAnswerHook({ type: n.type, answer: t, html: n.html, ques: n }), assertFillShouldContinue(i), a.setAnswer && "function" == typeof a.setAnswer && (s = await a.setAnswer({ type: n.type, answer: t, html: n.html, ques: n, rule: a })), assertFillShouldContinue(i), s && await defaultSetAnswer(e, t, n, a, i); }, Ye = class _Paper { static getPaper(e) { return Cache.get(`${_Paper.prefix}_${e}`); } static getLastSyncedHashes(e) { const t = Cache.get(`${_Paper.lastSyncedPrefix}_${e}`, { questions: [], chapters: [] }); return { questions: new Set(t.questions || []), chapters: new Set(t.chapters || []) }; } static setLastSyncedHashes(e, t, n) { Cache.set(`${_Paper.lastSyncedPrefix}_${e}`, { questions: t, chapters: n }); } static compareAndGetNewData(e, t) { const n = _Paper.getLastSyncedHashes(t), a = new Set, i = new Set, s = new Map, r = new Map; e.chapter && Array.isArray(e.chapter) && e.chapter.forEach((e => { const t = e.hash; i.add(t); const n = new Map; e.question && Array.isArray(e.question) && e.question.forEach((e => { const t = e.hash; a.add(t), s.set(t, e), n.set(t, e); })), r.set(t, { chapter: e, questions: n }); })); const o = [], l = []; a.forEach((e => { n.questions.has(e) || o.push(e); })), i.forEach((e => { n.chapters.has(e) || l.push(e); })); const c = { hash: e.hash, name: e.name, platform: e.platform, info: e.info, chapter: [] }; return r.forEach(((e, t) => { if (l.includes(t)) c.chapter.push({ hash: e.chapter.hash, name: e.chapter.name, question: Array.from(e.questions.values()) }); else { const t = []; e.questions.forEach(((e, n) => { o.includes(n) && t.push(e); })), t.length > 0 && c.chapter.push({ hash: e.chapter.hash, name: e.chapter.name, question: t }); } })), { newData: c, newQuestionHashes: o, newChapterHashes: l }; } static async setPaper(e, t, n = {}) { if (!e || !t) return; const a = _Paper.getPaper(e) || { chapter: [] }; t.chapter && t.chapter.forEach((e => { const t = a.chapter.find((t => t.hash === e.hash)); t ? (n.replaceQuestions ? t.question = e.question || [] : e.question.forEach((e => { const n = t.question.findIndex((t => t.hash === e.hash)); -1 !== n ? t.question[n] = e : t.question.push(e); })), Object.keys(e).forEach((n => { "question" !== n && (t[n] = e[n]); }))) : a.chapter.push(e); })), Object.keys(t).forEach((e => { "chapter" !== e && (a[e] = t[e]); })), Cache.set(`${_Paper.prefix}_${e}`, a); const {newData: i, newQuestionHashes: s, newChapterHashes: r} = _Paper.compareAndGetNewData(a, e); if (s.length > 0 || r.length > 0) { if (0 === i.chapter.length) return; s.length, r.length; try { const t = await Answer.syncPaper(i); let n; if ("string" == typeof t) try { n = JSON.parse(t); } catch (o) { return; } else n = t; if (!n || 200 !== n.code && 0 !== n.code && !0 !== n.success) JSON.stringify(n); else { const t = _Paper.getLastSyncedHashes(e), n = Array.from(new Set([ ...t.questions, ...s ])), a = Array.from(new Set([ ...t.chapters, ...r ])); _Paper.setLastSyncedHashes(e, n, a), s.length, r.length; } } catch (l) {} } } static hasChapter(e, t) { const n = _Paper.getPaper(e); return !(!n || !n.chapter) && n.chapter.some((e => e.hash === t)); } static getAllPapers() { return Cache.matchGet(`${_Paper.prefix}_`); } }; __publicField(Ye, "prefix", "paper_"), __publicField(Ye, "lastSyncedPrefix", "paper_last_synced_"); let Xe = Ye; function getDefaultExportFromCjs(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } var Ze, et; var tt = function() { if (et) return Ze; et = 1; var e = { parse: function(t) { var n = e._bin, a = new Uint8Array(t), i = 0; n.readFixed(a, i), i += 4; var s = n.readUshort(a, i); i += 2, n.readUshort(a, i), i += 2, n.readUshort(a, i), i += 2, n.readUshort(a, i), i += 2; for (var r = [ "cmap", "head", "hhea", "maxp", "hmtx", "name", "OS/2", "post", "loca", "glyf", "kern", "CFF ", "GPOS", "GSUB", "SVG " ], o = { _data: a }, l = {}, c = 0; c < s; c++) { var u = n.readASCII(a, i, 4); i += 4, n.readUint(a, i), i += 4; var p = n.readUint(a, i); i += 4; var d = n.readUint(a, i); i += 4, l[u] = { offset: p, length: d }; } for (c = 0; c < r.length; c++) { var m = r[c]; l[m] && (o[m.trim()] = e[m.trim()].parse(a, l[m].offset, l[m].length, o)); } return o; }, _tabOffset: function(t, n) { for (var a = e._bin, i = a.readUshort(t, 4), s = 12, r = 0; r < i; r++) { var o = a.readASCII(t, s, 4); s += 4, a.readUint(t, s), s += 4; var l = a.readUint(t, s); if (s += 4, a.readUint(t, s), s += 4, o == n) return l; } return 0; } }; return e._bin = { readFixed: function(e, t) { return (e[t] << 8 | e[t + 1]) + (e[t + 2] << 8 | e[t + 3]) / 65540; }, readF2dot14: function(t, n) { return e._bin.readShort(t, n) / 16384; }, readInt: function(t, n) { var a = e._bin.t.uint8; return a[0] = t[n + 3], a[1] = t[n + 2], a[2] = t[n + 1], a[3] = t[n], e._bin.t.int32[0]; }, readInt8: function(t, n) { return e._bin.t.uint8[0] = t[n], e._bin.t.int8[0]; }, readShort: function(t, n) { var a = e._bin.t.uint8; return a[1] = t[n], a[0] = t[n + 1], e._bin.t.int16[0]; }, readUshort: function(e, t) { return e[t] << 8 | e[t + 1]; }, readUshorts: function(t, n, a) { for (var i = [], s = 0; s < a; s++) i.push(e._bin.readUshort(t, n + 2 * s)); return i; }, readUint: function(t, n) { var a = e._bin.t.uint8; return a[3] = t[n], a[2] = t[n + 1], a[1] = t[n + 2], a[0] = t[n + 3], e._bin.t.uint32[0]; }, readUint64: function(t, n) { return 4294967296 * e._bin.readUint(t, n) + e._bin.readUint(t, n + 4); }, readASCII: function(e, t, n) { for (var a = "", i = 0; i < n; i++) a += String.fromCharCode(e[t + i]); return a; }, readUnicode: function(e, t, n) { for (var a = "", i = 0; i < n; i++) { var s = e[t++] << 8 | e[t++]; a += String.fromCharCode(s); } return a; }, _tdec: window.TextDecoder ? new window.TextDecoder : null, readUTF8: function(t, n, a) { var i = e._bin._tdec; return i && 0 == n && a == t.length ? i.decode(t) : e._bin.readASCII(t, n, a); }, readBytes: function(e, t, n) { for (var a = [], i = 0; i < n; i++) a.push(e[t + i]); return a; }, readASCIIArray: function(e, t, n) { for (var a = [], i = 0; i < n; i++) a.push(String.fromCharCode(e[t + i])); return a; } }, e._bin.t = { buff: new ArrayBuffer(8) }, e._bin.t.int8 = new Int8Array(e._bin.t.buff), e._bin.t.uint8 = new Uint8Array(e._bin.t.buff), e._bin.t.int16 = new Int16Array(e._bin.t.buff), e._bin.t.uint16 = new Uint16Array(e._bin.t.buff), e._bin.t.int32 = new Int32Array(e._bin.t.buff), e._bin.t.uint32 = new Uint32Array(e._bin.t.buff), e._lctf = {}, e._lctf.parse = function(t, n, a, i, s) { var r = e._bin, o = {}, l = n; r.readFixed(t, n), n += 4; var c = r.readUshort(t, n); n += 2; var u = r.readUshort(t, n); n += 2; var p = r.readUshort(t, n); return n += 2, o.scriptList = e._lctf.readScriptList(t, l + c), o.featureList = e._lctf.readFeatureList(t, l + u), o.lookupList = e._lctf.readLookupList(t, l + p, s), o; }, e._lctf.readLookupList = function(t, n, a) { var i = e._bin, s = n, r = [], o = i.readUshort(t, n); n += 2; for (var l = 0; l < o; l++) { var c = i.readUshort(t, n); n += 2; var u = e._lctf.readLookupTable(t, s + c, a); r.push(u); } return r; }, e._lctf.readLookupTable = function(t, n, a) { var i = e._bin, s = n, r = { tabs: [] }; r.ltype = i.readUshort(t, n), n += 2, r.flag = i.readUshort(t, n), n += 2; var o = i.readUshort(t, n); n += 2; for (var l = 0; l < o; l++) { var c = i.readUshort(t, n); n += 2; var u = a(t, r.ltype, s + c); r.tabs.push(u); } return r; }, e._lctf.numOfOnes = function(e) { for (var t = 0, n = 0; n < 32; n++) e >>> n & 1 && t++; return t; }, e._lctf.readClassDef = function(t, n) { var a = e._bin, i = [], s = a.readUshort(t, n); if (n += 2, 1 == s) { var r = a.readUshort(t, n); n += 2; var o = a.readUshort(t, n); n += 2; for (var l = 0; l < o; l++) i.push(r + l), i.push(r + l), i.push(a.readUshort(t, n)), n += 2; } if (2 == s) { var c = a.readUshort(t, n); n += 2; for (l = 0; l < c; l++) i.push(a.readUshort(t, n)), n += 2, i.push(a.readUshort(t, n)), n += 2, i.push(a.readUshort(t, n)), n += 2; } return i; }, e._lctf.getInterval = function(e, t) { for (var n = 0; n < e.length; n += 3) { var a = e[n], i = e[n + 1]; if (e[n + 2], a <= t && t <= i) return n; } return -1; }, e._lctf.readValueRecord = function(t, n, a) { var i = e._bin, s = []; return s.push(1 & a ? i.readShort(t, n) : 0), n += 1 & a ? 2 : 0, s.push(2 & a ? i.readShort(t, n) : 0), n += 2 & a ? 2 : 0, s.push(4 & a ? i.readShort(t, n) : 0), n += 4 & a ? 2 : 0, s.push(8 & a ? i.readShort(t, n) : 0), n += 8 & a ? 2 : 0, s; }, e._lctf.readCoverage = function(t, n) { var a = e._bin, i = {}; i.fmt = a.readUshort(t, n), n += 2; var s = a.readUshort(t, n); return n += 2, 1 == i.fmt && (i.tab = a.readUshorts(t, n, s)), 2 == i.fmt && (i.tab = a.readUshorts(t, n, 3 * s)), i; }, e._lctf.coverageIndex = function(t, n) { var a = t.tab; if (1 == t.fmt) return a.indexOf(n); if (2 == t.fmt) { var i = e._lctf.getInterval(a, n); if (-1 != i) return a[i + 2] + (n - a[i]); } return -1; }, e._lctf.readFeatureList = function(t, n) { var a = e._bin, i = n, s = [], r = a.readUshort(t, n); n += 2; for (var o = 0; o < r; o++) { var l = a.readASCII(t, n, 4); n += 4; var c = a.readUshort(t, n); n += 2, s.push({ tag: l.trim(), tab: e._lctf.readFeatureTable(t, i + c) }); } return s; }, e._lctf.readFeatureTable = function(t, n) { var a = e._bin; a.readUshort(t, n), n += 2; var i = a.readUshort(t, n); n += 2; for (var s = [], r = 0; r < i; r++) s.push(a.readUshort(t, n + 2 * r)); return s; }, e._lctf.readScriptList = function(t, n) { var a = e._bin, i = n, s = {}, r = a.readUshort(t, n); n += 2; for (var o = 0; o < r; o++) { var l = a.readASCII(t, n, 4); n += 4; var c = a.readUshort(t, n); n += 2, s[l.trim()] = e._lctf.readScriptTable(t, i + c); } return s; }, e._lctf.readScriptTable = function(t, n) { var a = e._bin, i = n, s = {}, r = a.readUshort(t, n); n += 2, s.default = e._lctf.readLangSysTable(t, i + r); var o = a.readUshort(t, n); n += 2; for (var l = 0; l < o; l++) { var c = a.readASCII(t, n, 4); n += 4; var u = a.readUshort(t, n); n += 2, s[c.trim()] = e._lctf.readLangSysTable(t, i + u); } return s; }, e._lctf.readLangSysTable = function(t, n) { var a = e._bin, i = {}; a.readUshort(t, n), n += 2, i.reqFeature = a.readUshort(t, n), n += 2; var s = a.readUshort(t, n); return n += 2, i.features = a.readUshorts(t, n, s), i; }, e.CFF = {}, e.CFF.parse = function(t, n, a) { var i = e._bin; (t = new Uint8Array(t.buffer, n, a))[n = 0], t[++n], t[++n], t[++n], n++; var s = []; n = e.CFF.readIndex(t, n, s); for (var r = [], o = 0; o < s.length - 1; o++) r.push(i.readASCII(t, n + s[o], s[o + 1] - s[o])); n += s[s.length - 1]; var l = []; n = e.CFF.readIndex(t, n, l); var c = []; for (o = 0; o < l.length - 1; o++) c.push(e.CFF.readDict(t, n + l[o], n + l[o + 1])); n += l[l.length - 1]; var u = c[0], p = []; n = e.CFF.readIndex(t, n, p); var d = []; for (o = 0; o < p.length - 1; o++) d.push(i.readASCII(t, n + p[o], p[o + 1] - p[o])); if (n += p[p.length - 1], e.CFF.readSubrs(t, n, u), u.CharStrings) { n = u.CharStrings; p = []; n = e.CFF.readIndex(t, n, p); var m = []; for (o = 0; o < p.length - 1; o++) m.push(i.readBytes(t, n + p[o], p[o + 1] - p[o])); u.CharStrings = m; } u.Encoding && (u.Encoding = e.CFF.readEncoding(t, u.Encoding, u.CharStrings.length)), u.charset && (u.charset = e.CFF.readCharset(t, u.charset, u.CharStrings.length)), u.Private && (n = u.Private[1], u.Private = e.CFF.readDict(t, n, n + u.Private[0]), u.Private.Subrs && e.CFF.readSubrs(t, n + u.Private.Subrs, u.Private)); var h = {}; for (var f in u) -1 != [ "FamilyName", "FullName", "Notice", "version", "Copyright" ].indexOf(f) ? h[f] = d[u[f] - 426 + 35] : h[f] = u[f]; return h; }, e.CFF.readSubrs = function(t, n, a) { var i = e._bin, s = []; n = e.CFF.readIndex(t, n, s); var r, o = s.length; r = o < 1240 ? 107 : o < 33900 ? 1131 : 32768, a.Bias = r, a.Subrs = []; for (var l = 0; l < s.length - 1; l++) a.Subrs.push(i.readBytes(t, n + s[l], s[l + 1] - s[l])); }, e.CFF.tableSE = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 0, 111, 112, 113, 114, 0, 115, 116, 117, 118, 119, 120, 121, 122, 0, 123, 0, 124, 125, 126, 127, 128, 129, 130, 131, 0, 132, 133, 0, 134, 135, 136, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 0, 139, 0, 0, 0, 0, 140, 141, 142, 143, 0, 0, 0, 0, 0, 144, 0, 0, 0, 145, 0, 0, 146, 147, 148, 149, 0, 0, 0, 0 ], e.CFF.glyphByUnicode = function(e, t) { for (var n = 0; n < e.charset.length; n++) if (e.charset[n] == t) return n; return -1; }, e.CFF.glyphBySE = function(t, n) { return n < 0 || n > 255 ? -1 : e.CFF.glyphByUnicode(t, e.CFF.tableSE[n]); }, e.CFF.readEncoding = function(t, n, a) { e._bin; var i = [ ".notdef" ], s = t[n]; if (n++, 0 != s) throw "error: unknown encoding format: " + s; var r = t[n]; n++; for (var o = 0; o < r; o++) i.push(t[n + o]); return i; }, e.CFF.readCharset = function(t, n, a) { var i = e._bin, s = [ ".notdef" ], r = t[n]; if (n++, 0 == r) for (var o = 0; o < a; o++) { var l = i.readUshort(t, n); n += 2, s.push(l); } else { if (1 != r && 2 != r) throw "error: format: " + r; for (;s.length < a; ) { l = i.readUshort(t, n); n += 2; var c = 0; 1 == r ? (c = t[n], n++) : (c = i.readUshort(t, n), n += 2); for (o = 0; o <= c; o++) s.push(l), l++; } } return s; }, e.CFF.readIndex = function(t, n, a) { var i = e._bin, s = i.readUshort(t, n), r = t[n += 2]; if (n++, 1 == r) for (var o = 0; o < s + 1; o++) a.push(t[n + o]); else if (2 == r) for (o = 0; o < s + 1; o++) a.push(i.readUshort(t, n + 2 * o)); else if (3 == r) for (o = 0; o < s + 1; o++) a.push(16777215 & i.readUint(t, n + 3 * o - 1)); else if (0 != s) throw "unsupported offset size: " + r + ", count: " + s; return (n += (s + 1) * r) - 1; }, e.CFF.getCharString = function(t, n, a) { var i = e._bin, s = t[n], r = t[n + 1]; t[n + 2], t[n + 3], t[n + 4]; var o = 1, l = null, c = null; s <= 20 && (l = s, o = 1), 12 == s && (l = 100 * s + r, o = 2), 21 <= s && s <= 27 && (l = s, o = 1), 28 == s && (c = i.readShort(t, n + 1), o = 3), 29 <= s && s <= 31 && (l = s, o = 1), 32 <= s && s <= 246 && (c = s - 139, o = 1), 247 <= s && s <= 250 && (c = 256 * (s - 247) + r + 108, o = 2), 251 <= s && s <= 254 && (c = 256 * -(s - 251) - r - 108, o = 2), 255 == s && (c = i.readInt(t, n + 1) / 65535, o = 5), a.val = null != c ? c : "o" + l, a.size = o; }, e.CFF.readCharString = function(t, n, a) { for (var i = n + a, s = e._bin, r = []; n < i; ) { var o = t[n], l = t[n + 1]; t[n + 2], t[n + 3], t[n + 4]; var c = 1, u = null, p = null; o <= 20 && (u = o, c = 1), 12 == o && (u = 100 * o + l, c = 2), 19 != o && 20 != o || (u = o, c = 2), 21 <= o && o <= 27 && (u = o, c = 1), 28 == o && (p = s.readShort(t, n + 1), c = 3), 29 <= o && o <= 31 && (u = o, c = 1), 32 <= o && o <= 246 && (p = o - 139, c = 1), 247 <= o && o <= 250 && (p = 256 * (o - 247) + l + 108, c = 2), 251 <= o && o <= 254 && (p = 256 * -(o - 251) - l - 108, c = 2), 255 == o && (p = s.readInt(t, n + 1) / 65535, c = 5), r.push(null != p ? p : "o" + u), n += c; } return r; }, e.CFF.readDict = function(t, n, a) { for (var i = e._bin, s = {}, r = []; n < a; ) { var o = t[n], l = t[n + 1]; t[n + 2], t[n + 3], t[n + 4]; var c = 1, u = null, p = null; if (28 == o && (p = i.readShort(t, n + 1), c = 3), 29 == o && (p = i.readInt(t, n + 1), c = 5), 32 <= o && o <= 246 && (p = o - 139, c = 1), 247 <= o && o <= 250 && (p = 256 * (o - 247) + l + 108, c = 2), 251 <= o && o <= 254 && (p = 256 * -(o - 251) - l - 108, c = 2), 255 == o) throw p = i.readInt(t, n + 1) / 65535, c = 5, "unknown number"; if (30 == o) { var d = []; for (c = 1; ;) { var m = t[n + c]; c++; var h = m >> 4, f = 15 & m; if (15 != h && d.push(h), 15 != f && d.push(f), 15 == f) break; } for (var g = "", v = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ".", "e", "e-", "reserved", "-", "endOfNumber" ], y = 0; y < d.length; y++) g += v[d[y]]; p = parseFloat(g); } if (o <= 21) if (u = [ "version", "Notice", "FullName", "FamilyName", "Weight", "FontBBox", "BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StdHW", "StdVW", "escape", "UniqueID", "XUID", "charset", "Encoding", "CharStrings", "Private", "Subrs", "defaultWidthX", "nominalWidthX" ][o], c = 1, 12 == o) u = [ "Copyright", "isFixedPitch", "ItalicAngle", "UnderlinePosition", "UnderlineThickness", "PaintType", "CharstringType", "FontMatrix", "StrokeWidth", "BlueScale", "BlueShift", "BlueFuzz", "StemSnapH", "StemSnapV", "ForceBold", 0, 0, "LanguageGroup", "ExpansionFactor", "initialRandomSeed", "SyntheticBase", "PostScript", "BaseFontName", "BaseFontBlend", 0, 0, 0, 0, 0, 0, "ROS", "CIDFontVersion", "CIDFontRevision", "CIDFontType", "CIDCount", "UIDBase", "FDArray", "FDSelect", "FontName" ][l], c = 2; null != u ? (s[u] = 1 == r.length ? r[0] : r, r = []) : r.push(p), n += c; } return s; }, e.cmap = {}, e.cmap.parse = function(t, n, a) { t = new Uint8Array(t.buffer, n, a), n = 0; var i = e._bin, s = {}; i.readUshort(t, n), n += 2; var r = i.readUshort(t, n); n += 2; var o = []; s.tables = []; for (var l = 0; l < r; l++) { var c = i.readUshort(t, n); n += 2; var u = i.readUshort(t, n); n += 2; var p = i.readUint(t, n); n += 4; var d = "p" + c + "e" + u, m = o.indexOf(p); if (-1 == m) { var h; m = s.tables.length, o.push(p); var f = i.readUshort(t, p); 0 == f ? h = e.cmap.parse0(t, p) : 4 == f ? h = e.cmap.parse4(t, p) : 6 == f ? h = e.cmap.parse6(t, p) : 12 == f ? h = e.cmap.parse12(t, p) : console.log("unknown format: " + f, c, u, p), s.tables.push(h); } if (null != s[d]) throw "multiple tables for one platform+encoding"; s[d] = m; } return s; }, e.cmap.parse0 = function(t, n) { var a = e._bin, i = {}; i.format = a.readUshort(t, n), n += 2; var s = a.readUshort(t, n); n += 2, a.readUshort(t, n), n += 2, i.map = []; for (var r = 0; r < s - 6; r++) i.map.push(t[n + r]); return i; }, e.cmap.parse4 = function(t, n) { var a = e._bin, i = n, s = {}; s.format = a.readUshort(t, n), n += 2; var r = a.readUshort(t, n); n += 2, a.readUshort(t, n), n += 2; var o = a.readUshort(t, n); n += 2; var l = o / 2; s.searchRange = a.readUshort(t, n), n += 2, s.entrySelector = a.readUshort(t, n), n += 2, s.rangeShift = a.readUshort(t, n), n += 2, s.endCount = a.readUshorts(t, n, l), n += 2 * l, n += 2, s.startCount = a.readUshorts(t, n, l), n += 2 * l, s.idDelta = []; for (var c = 0; c < l; c++) s.idDelta.push(a.readShort(t, n)), n += 2; for (s.idRangeOffset = a.readUshorts(t, n, l), n += 2 * l, s.glyphIdArray = []; n < i + r; ) s.glyphIdArray.push(a.readUshort(t, n)), n += 2; return s; }, e.cmap.parse6 = function(t, n) { var a = e._bin, i = {}; i.format = a.readUshort(t, n), n += 2, a.readUshort(t, n), n += 2, a.readUshort(t, n), n += 2, i.firstCode = a.readUshort(t, n), n += 2; var s = a.readUshort(t, n); n += 2, i.glyphIdArray = []; for (var r = 0; r < s; r++) i.glyphIdArray.push(a.readUshort(t, n)), n += 2; return i; }, e.cmap.parse12 = function(t, n) { var a = e._bin, i = {}; i.format = a.readUshort(t, n), n += 2, n += 2, a.readUint(t, n), n += 4, a.readUint(t, n), n += 4; var s = a.readUint(t, n); n += 4, i.groups = []; for (var r = 0; r < s; r++) { var o = n + 12 * r, l = a.readUint(t, o + 0), c = a.readUint(t, o + 4), u = a.readUint(t, o + 8); i.groups.push([ l, c, u ]); } return i; }, e.glyf = {}, e.glyf.parse = function(e, t, n, a) { for (var i = [], s = 0; s < a.maxp.numGlyphs; s++) i.push(null); return i; }, e.glyf._parseGlyf = function(t, n) { var a = e._bin, i = t._data, s = e._tabOffset(i, "glyf") + t.loca[n]; if (t.loca[n] == t.loca[n + 1]) return null; var r = {}; if (r.noc = a.readShort(i, s), s += 2, r.xMin = a.readShort(i, s), s += 2, r.yMin = a.readShort(i, s), s += 2, r.xMax = a.readShort(i, s), s += 2, r.yMax = a.readShort(i, s), s += 2, r.xMin >= r.xMax || r.yMin >= r.yMax) return null; if (r.noc > 0) { r.endPts = []; for (var o = 0; o < r.noc; o++) r.endPts.push(a.readUshort(i, s)), s += 2; var l = a.readUshort(i, s); if (s += 2, i.length - s < l) return null; r.instructions = a.readBytes(i, s, l), s += l; var c = r.endPts[r.noc - 1] + 1; r.flags = []; for (o = 0; o < c; o++) { var u = i[s]; if (s++, r.flags.push(u), 8 & u) { var p = i[s]; s++; for (var d = 0; d < p; d++) r.flags.push(u), o++; } } r.xs = []; for (o = 0; o < c; o++) { var m = !!(2 & r.flags[o]), h = !!(16 & r.flags[o]); m ? (r.xs.push(h ? i[s] : -i[s]), s++) : h ? r.xs.push(0) : (r.xs.push(a.readShort(i, s)), s += 2); } r.ys = []; for (o = 0; o < c; o++) { m = !!(4 & r.flags[o]), h = !!(32 & r.flags[o]); m ? (r.ys.push(h ? i[s] : -i[s]), s++) : h ? r.ys.push(0) : (r.ys.push(a.readShort(i, s)), s += 2); } var f = 0, g = 0; for (o = 0; o < c; o++) f += r.xs[o], g += r.ys[o], r.xs[o] = f, r.ys[o] = g; } else { var v; r.parts = []; do { v = a.readUshort(i, s), s += 2; var y = { m: { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 }, p1: -1, p2: -1 }; if (r.parts.push(y), y.glyphIndex = a.readUshort(i, s), s += 2, 1 & v) { var b = a.readShort(i, s); s += 2; var w = a.readShort(i, s); s += 2; } else { b = a.readInt8(i, s); s++; w = a.readInt8(i, s); s++; } 2 & v ? (y.m.tx = b, y.m.ty = w) : (y.p1 = b, y.p2 = w), 8 & v ? (y.m.a = y.m.d = a.readF2dot14(i, s), s += 2) : 64 & v ? (y.m.a = a.readF2dot14(i, s), s += 2, y.m.d = a.readF2dot14(i, s), s += 2) : 128 & v && (y.m.a = a.readF2dot14(i, s), s += 2, y.m.b = a.readF2dot14(i, s), s += 2, y.m.c = a.readF2dot14(i, s), s += 2, y.m.d = a.readF2dot14(i, s), s += 2); } while (32 & v); if (256 & v) { var x = a.readUshort(i, s); s += 2, r.instr = []; for (o = 0; o < x; o++) r.instr.push(i[s]), s++; } } return r; }, e.GPOS = {}, e.GPOS.parse = function(t, n, a, i) { return e._lctf.parse(t, n, a, i, e.GPOS.subt); }, e.GPOS.subt = function(t, n, a) { if (2 != n) return null; var i = e._bin, s = a, r = {}; r.format = i.readUshort(t, a), a += 2; var o = i.readUshort(t, a); a += 2, r.coverage = e._lctf.readCoverage(t, o + s), r.valFmt1 = i.readUshort(t, a), a += 2, r.valFmt2 = i.readUshort(t, a), a += 2; var l = e._lctf.numOfOnes(r.valFmt1), c = e._lctf.numOfOnes(r.valFmt2); if (1 == r.format) { r.pairsets = []; var u = i.readUshort(t, a); a += 2; for (var p = 0; p < u; p++) { var d = i.readUshort(t, a); a += 2, d += s; var m = i.readUshort(t, d); d += 2; for (var h = [], f = 0; f < m; f++) { var g = i.readUshort(t, d); d += 2, 0 != r.valFmt1 && (k = e._lctf.readValueRecord(t, d, r.valFmt1), d += 2 * l), 0 != r.valFmt2 && (q = e._lctf.readValueRecord(t, d, r.valFmt2), d += 2 * c), h.push({ gid2: g, val1: k, val2: q }); } r.pairsets.push(h); } } if (2 == r.format) { var v = i.readUshort(t, a); a += 2; var y = i.readUshort(t, a); a += 2; var b = i.readUshort(t, a); a += 2; var w = i.readUshort(t, a); a += 2, r.classDef1 = e._lctf.readClassDef(t, s + v), r.classDef2 = e._lctf.readClassDef(t, s + y), r.matrix = []; for (p = 0; p < b; p++) { var x = []; for (f = 0; f < w; f++) { var k = null, q = null; 0 != r.valFmt1 && (k = e._lctf.readValueRecord(t, a, r.valFmt1), a += 2 * l), 0 != r.valFmt2 && (q = e._lctf.readValueRecord(t, a, r.valFmt2), a += 2 * c), x.push({ val1: k, val2: q }); } r.matrix.push(x); } } return r; }, e.GSUB = {}, e.GSUB.parse = function(t, n, a, i) { return e._lctf.parse(t, n, a, i, e.GSUB.subt); }, e.GSUB.subt = function(t, n, a) { var i = e._bin, s = a, r = {}; if (1 != n && 4 != n && 5 != n) return null; r.fmt = i.readUshort(t, a), a += 2; var o = i.readUshort(t, a); if (a += 2, r.coverage = e._lctf.readCoverage(t, o + s), 1 == n) { if (1 == r.fmt) r.delta = i.readShort(t, a), a += 2; else if (2 == r.fmt) { var l = i.readUshort(t, a); a += 2, r.newg = i.readUshorts(t, a, l), a += 2 * r.newg.length; } } else if (4 == n) { r.vals = []; l = i.readUshort(t, a); a += 2; for (var c = 0; c < l; c++) { var u = i.readUshort(t, a); a += 2, r.vals.push(e.GSUB.readLigatureSet(t, s + u)); } } else if (5 == n) if (2 == r.fmt) { var p = i.readUshort(t, a); a += 2, r.cDef = e._lctf.readClassDef(t, s + p), r.scset = []; var d = i.readUshort(t, a); a += 2; for (c = 0; c < d; c++) { var m = i.readUshort(t, a); a += 2, r.scset.push(0 == m ? null : e.GSUB.readSubClassSet(t, s + m)); } } else console.log("unknown table format", r.fmt); return r; }, e.GSUB.readSubClassSet = function(t, n) { var a = e._bin.readUshort, i = n, s = [], r = a(t, n); n += 2; for (var o = 0; o < r; o++) { var l = a(t, n); n += 2, s.push(e.GSUB.readSubClassRule(t, i + l)); } return s; }, e.GSUB.readSubClassRule = function(t, n) { var a = e._bin.readUshort, i = {}, s = a(t, n), r = a(t, n += 2); n += 2, i.input = []; for (var o = 0; o < s - 1; o++) i.input.push(a(t, n)), n += 2; return i.substLookupRecords = e.GSUB.readSubstLookupRecords(t, n, r), i; }, e.GSUB.readSubstLookupRecords = function(t, n, a) { for (var i = e._bin.readUshort, s = [], r = 0; r < a; r++) s.push(i(t, n), i(t, n + 2)), n += 4; return s; }, e.GSUB.readChainSubClassSet = function(t, n) { var a = e._bin, i = n, s = [], r = a.readUshort(t, n); n += 2; for (var o = 0; o < r; o++) { var l = a.readUshort(t, n); n += 2, s.push(e.GSUB.readChainSubClassRule(t, i + l)); } return s; }, e.GSUB.readChainSubClassRule = function(t, n) { for (var a = e._bin, i = {}, s = [ "backtrack", "input", "lookahead" ], r = 0; r < s.length; r++) { var o = a.readUshort(t, n); n += 2, 1 == r && o--, i[s[r]] = a.readUshorts(t, n, o), n += 2 * i[s[r]].length; } o = a.readUshort(t, n); return n += 2, i.subst = a.readUshorts(t, n, 2 * o), n += 2 * i.subst.length, i; }, e.GSUB.readLigatureSet = function(t, n) { var a = e._bin, i = n, s = [], r = a.readUshort(t, n); n += 2; for (var o = 0; o < r; o++) { var l = a.readUshort(t, n); n += 2, s.push(e.GSUB.readLigature(t, i + l)); } return s; }, e.GSUB.readLigature = function(t, n) { var a = e._bin, i = { chain: [] }; i.nglyph = a.readUshort(t, n), n += 2; var s = a.readUshort(t, n); n += 2; for (var r = 0; r < s - 1; r++) i.chain.push(a.readUshort(t, n)), n += 2; return i; }, e.head = {}, e.head.parse = function(t, n, a) { var i = e._bin, s = {}; return i.readFixed(t, n), n += 4, s.fontRevision = i.readFixed(t, n), n += 4, i.readUint(t, n), n += 4, i.readUint(t, n), n += 4, s.flags = i.readUshort(t, n), n += 2, s.unitsPerEm = i.readUshort(t, n), n += 2, s.created = i.readUint64(t, n), n += 8, s.modified = i.readUint64(t, n), n += 8, s.xMin = i.readShort(t, n), n += 2, s.yMin = i.readShort(t, n), n += 2, s.xMax = i.readShort(t, n), n += 2, s.yMax = i.readShort(t, n), n += 2, s.macStyle = i.readUshort(t, n), n += 2, s.lowestRecPPEM = i.readUshort(t, n), n += 2, s.fontDirectionHint = i.readShort(t, n), n += 2, s.indexToLocFormat = i.readShort(t, n), n += 2, s.glyphDataFormat = i.readShort(t, n), n += 2, s; }, e.hhea = {}, e.hhea.parse = function(t, n, a) { var i = e._bin, s = {}; return i.readFixed(t, n), n += 4, s.ascender = i.readShort(t, n), n += 2, s.descender = i.readShort(t, n), n += 2, s.lineGap = i.readShort(t, n), n += 2, s.advanceWidthMax = i.readUshort(t, n), n += 2, s.minLeftSideBearing = i.readShort(t, n), n += 2, s.minRightSideBearing = i.readShort(t, n), n += 2, s.xMaxExtent = i.readShort(t, n), n += 2, s.caretSlopeRise = i.readShort(t, n), n += 2, s.caretSlopeRun = i.readShort(t, n), n += 2, s.caretOffset = i.readShort(t, n), n += 2, n += 8, s.metricDataFormat = i.readShort(t, n), n += 2, s.numberOfHMetrics = i.readUshort(t, n), n += 2, s; }, e.hmtx = {}, e.hmtx.parse = function(t, n, a, i) { for (var s = e._bin, r = { aWidth: [], lsBearing: [] }, o = 0, l = 0, c = 0; c < i.maxp.numGlyphs; c++) c < i.hhea.numberOfHMetrics && (o = s.readUshort(t, n), n += 2, l = s.readShort(t, n), n += 2), r.aWidth.push(o), r.lsBearing.push(l); return r; }, e.kern = {}, e.kern.parse = function(t, n, a, i) { var s = e._bin, r = s.readUshort(t, n); if (n += 2, 1 == r) return e.kern.parseV1(t, n - 2, a, i); var o = s.readUshort(t, n); n += 2; for (var l = { glyph1: [], rval: [] }, c = 0; c < o; c++) { n += 2; a = s.readUshort(t, n); n += 2; var u = s.readUshort(t, n); n += 2; var p = u >>> 8; if (0 != (p &= 15)) throw "unknown kern table format: " + p; n = e.kern.readFormat0(t, n, l); } return l; }, e.kern.parseV1 = function(t, n, a, i) { var s = e._bin; s.readFixed(t, n), n += 4; var r = s.readUint(t, n); n += 4; for (var o = { glyph1: [], rval: [] }, l = 0; l < r; l++) { s.readUint(t, n), n += 4; var c = s.readUshort(t, n); n += 2, s.readUshort(t, n), n += 2; var u = c >>> 8; if (0 != (u &= 15)) throw "unknown kern table format: " + u; n = e.kern.readFormat0(t, n, o); } return o; }, e.kern.readFormat0 = function(t, n, a) { var i = e._bin, s = -1, r = i.readUshort(t, n); n += 2, i.readUshort(t, n), n += 2, i.readUshort(t, n), n += 2, i.readUshort(t, n), n += 2; for (var o = 0; o < r; o++) { var l = i.readUshort(t, n); n += 2; var c = i.readUshort(t, n); n += 2; var u = i.readShort(t, n); n += 2, l != s && (a.glyph1.push(l), a.rval.push({ glyph2: [], vals: [] })); var p = a.rval[a.rval.length - 1]; p.glyph2.push(c), p.vals.push(u), s = l; } return n; }, e.loca = {}, e.loca.parse = function(t, n, a, i) { var s = e._bin, r = [], o = i.head.indexToLocFormat, l = i.maxp.numGlyphs + 1; if (0 == o) for (var c = 0; c < l; c++) r.push(s.readUshort(t, n + (c << 1)) << 1); if (1 == o) for (c = 0; c < l; c++) r.push(s.readUint(t, n + (c << 2))); return r; }, e.maxp = {}, e.maxp.parse = function(t, n, a) { var i = e._bin, s = {}, r = i.readUint(t, n); return n += 4, s.numGlyphs = i.readUshort(t, n), n += 2, 65536 == r && (s.maxPoints = i.readUshort(t, n), n += 2, s.maxContours = i.readUshort(t, n), n += 2, s.maxCompositePoints = i.readUshort(t, n), n += 2, s.maxCompositeContours = i.readUshort(t, n), n += 2, s.maxZones = i.readUshort(t, n), n += 2, s.maxTwilightPoints = i.readUshort(t, n), n += 2, s.maxStorage = i.readUshort(t, n), n += 2, s.maxFunctionDefs = i.readUshort(t, n), n += 2, s.maxInstructionDefs = i.readUshort(t, n), n += 2, s.maxStackElements = i.readUshort(t, n), n += 2, s.maxSizeOfInstructions = i.readUshort(t, n), n += 2, s.maxComponentElements = i.readUshort(t, n), n += 2, s.maxComponentDepth = i.readUshort(t, n), n += 2), s; }, e.name = {}, e.name.parse = function(t, n, a) { var i = e._bin, s = {}; i.readUshort(t, n), n += 2; var r = i.readUshort(t, n); n += 2, i.readUshort(t, n); for (var o, l = n += 2, c = 0; c < r; c++) { var u = i.readUshort(t, n); n += 2; var p = i.readUshort(t, n); n += 2; var d = i.readUshort(t, n); n += 2; var m = i.readUshort(t, n); n += 2; a = i.readUshort(t, n); n += 2; var h = i.readUshort(t, n); n += 2; var f = "p" + u; null == s[f] && (s[f] = {}); var g, v = [ "copyright", "fontFamily", "fontSubfamily", "ID", "fullName", "version", "postScriptName", "trademark", "manufacturer", "designer", "description", "urlVendor", "urlDesigner", "licence", "licenceURL", "---", "typoFamilyName", "typoSubfamilyName", "compatibleFull", "sampleText", "postScriptCID", "wwsFamilyName", "wwsSubfamilyName", "lightPalette", "darkPalette" ][m], y = l + 12 * r + h; if (0 == u) g = i.readUnicode(t, y, a / 2); else if (3 == u && 0 == p) g = i.readUnicode(t, y, a / 2); else if (0 == p) g = i.readASCII(t, y, a); else if (1 == p) g = i.readUnicode(t, y, a / 2); else if (3 == p) g = i.readUnicode(t, y, a / 2); else { if (1 != u) throw "unknown encoding " + p + ", platformID: " + u; g = i.readASCII(t, y, a), console.log("reading unknown MAC encoding " + p + " as ASCII"); } s[f][v] = g, s[f]._lang = d; } for (var b in s) if (null != s[b].postScriptName && 1033 == s[b]._lang) return s[b]; for (var b in s) if (null != s[b].postScriptName && 3084 == s[b]._lang) return s[b]; for (var b in s) if (null != s[b].postScriptName) return s[b]; for (var b in s) { o = b; break; } return console.log("returning name table with languageID " + s[o]._lang), s[o]; }, e["OS/2"] = {}, e["OS/2"].parse = function(t, n, a) { var i = e._bin.readUshort(t, n); n += 2; var s = {}; if (0 == i) e["OS/2"].version0(t, n, s); else if (1 == i) e["OS/2"].version1(t, n, s); else if (2 == i || 3 == i || 4 == i) e["OS/2"].version2(t, n, s); else { if (5 != i) throw "unknown OS/2 table version: " + i; e["OS/2"].version5(t, n, s); } return s; }, e["OS/2"].version0 = function(t, n, a) { var i = e._bin; return a.xAvgCharWidth = i.readShort(t, n), n += 2, a.usWeightClass = i.readUshort(t, n), n += 2, a.usWidthClass = i.readUshort(t, n), n += 2, a.fsType = i.readUshort(t, n), n += 2, a.ySubscriptXSize = i.readShort(t, n), n += 2, a.ySubscriptYSize = i.readShort(t, n), n += 2, a.ySubscriptXOffset = i.readShort(t, n), n += 2, a.ySubscriptYOffset = i.readShort(t, n), n += 2, a.ySuperscriptXSize = i.readShort(t, n), n += 2, a.ySuperscriptYSize = i.readShort(t, n), n += 2, a.ySuperscriptXOffset = i.readShort(t, n), n += 2, a.ySuperscriptYOffset = i.readShort(t, n), n += 2, a.yStrikeoutSize = i.readShort(t, n), n += 2, a.yStrikeoutPosition = i.readShort(t, n), n += 2, a.sFamilyClass = i.readShort(t, n), n += 2, a.panose = i.readBytes(t, n, 10), n += 10, a.ulUnicodeRange1 = i.readUint(t, n), n += 4, a.ulUnicodeRange2 = i.readUint(t, n), n += 4, a.ulUnicodeRange3 = i.readUint(t, n), n += 4, a.ulUnicodeRange4 = i.readUint(t, n), n += 4, a.achVendID = [ i.readInt8(t, n), i.readInt8(t, n + 1), i.readInt8(t, n + 2), i.readInt8(t, n + 3) ], n += 4, a.fsSelection = i.readUshort(t, n), n += 2, a.usFirstCharIndex = i.readUshort(t, n), n += 2, a.usLastCharIndex = i.readUshort(t, n), n += 2, a.sTypoAscender = i.readShort(t, n), n += 2, a.sTypoDescender = i.readShort(t, n), n += 2, a.sTypoLineGap = i.readShort(t, n), n += 2, a.usWinAscent = i.readUshort(t, n), n += 2, a.usWinDescent = i.readUshort(t, n), n += 2; }, e["OS/2"].version1 = function(t, n, a) { var i = e._bin; return n = e["OS/2"].version0(t, n, a), a.ulCodePageRange1 = i.readUint(t, n), n += 4, a.ulCodePageRange2 = i.readUint(t, n), n += 4; }, e["OS/2"].version2 = function(t, n, a) { var i = e._bin; return n = e["OS/2"].version1(t, n, a), a.sxHeight = i.readShort(t, n), n += 2, a.sCapHeight = i.readShort(t, n), n += 2, a.usDefault = i.readUshort(t, n), n += 2, a.usBreak = i.readUshort(t, n), n += 2, a.usMaxContext = i.readUshort(t, n), n += 2; }, e["OS/2"].version5 = function(t, n, a) { var i = e._bin; return n = e["OS/2"].version2(t, n, a), a.usLowerOpticalPointSize = i.readUshort(t, n), n += 2, a.usUpperOpticalPointSize = i.readUshort(t, n), n += 2; }, e.post = {}, e.post.parse = function(t, n, a) { var i = e._bin, s = {}; return s.version = i.readFixed(t, n), n += 4, s.italicAngle = i.readFixed(t, n), n += 4, s.underlinePosition = i.readShort(t, n), n += 2, s.underlineThickness = i.readShort(t, n), n += 2, s; }, e.SVG = {}, e.SVG.parse = function(t, n, a) { var i = e._bin, s = { entries: [] }, r = n; i.readUshort(t, n), n += 2; var o = i.readUint(t, n); n += 4, i.readUint(t, n), n += 4, n = o + r; var l = i.readUshort(t, n); n += 2; for (var c = 0; c < l; c++) { var u = i.readUshort(t, n); n += 2; var p = i.readUshort(t, n); n += 2; var d = i.readUint(t, n); n += 4; var m = i.readUint(t, n); n += 4; for (var h = new Uint8Array(t.buffer, r + d + o, m), f = i.readUTF8(h, 0, h.length), g = u; g <= p; g++) s.entries[g] = f; } return s; }, e.SVG.toPath = function(t) { var n = { cmds: [], crds: [] }; if (null == t) return n; for (var a = (new DOMParser).parseFromString(t, "image/svg+xml").firstChild; "svg" != a.tagName; ) a = a.nextSibling; var i = a.getAttribute("viewBox"); i = i ? i.trim().split(" ").map(parseFloat) : [ 0, 0, 1e3, 1e3 ], e.SVG._toPath(a.children, n); for (var s = 0; s < n.crds.length; s += 2) { var r = n.crds[s], o = n.crds[s + 1]; r -= i[0], o = -(o -= i[1]), n.crds[s] = r, n.crds[s + 1] = o; } return n; }, e.SVG._toPath = function(t, n, a) { for (var i = 0; i < t.length; i++) { var s = t[i], r = s.tagName, o = s.getAttribute("fill"); if (null == o && (o = a), "g" == r) e.SVG._toPath(s.children, n, o); else if ("path" == r) { n.cmds.push(o || "#000000"); var l = s.getAttribute("d"), c = e.SVG._tokens(l); e.SVG._toksToPath(c, n), n.cmds.push("X"); } else "defs" == r || console.log(r, s); } }, e.SVG._tokens = function(e) { for (var t = [], n = 0, a = false, i = ""; n < e.length; ) { var s = e.charCodeAt(n), r = e.charAt(n); n++; var o = 48 <= s && s <= 57 || "." == r || "-" == r; a ? "-" == r ? (t.push(parseFloat(i)), i = r) : o ? i += r : (t.push(parseFloat(i)), "," != r && " " != r && t.push(r), a = false) : o ? (i = r, a = true) : "," != r && " " != r && t.push(r); } return a && t.push(parseFloat(i)), t; }, e.SVG._toksToPath = function(t, n) { for (var a = 0, i = 0, s = 0, r = 0, o = 0, l = { M: 2, L: 2, H: 1, V: 1, S: 4, C: 6 }, c = n.cmds, u = n.crds; a < t.length; ) { var p = t[a]; if (a++, "z" == p) c.push("Z"), i = r, s = o; else for (var d = p.toUpperCase(), m = l[d], h = e.SVG._reps(t, a, m), f = 0; f < h; f++) { var g = 0, v = 0; if (p != d && (g = i, v = s), "M" == d) i = g + t[a++], s = v + t[a++], c.push("M"), u.push(i, s), r = i, o = s; else if ("L" == d) i = g + t[a++], s = v + t[a++], c.push("L"), u.push(i, s); else if ("H" == d) i = g + t[a++], c.push("L"), u.push(i, s); else if ("V" == d) s = v + t[a++], c.push("L"), u.push(i, s); else if ("C" == d) { var y = g + t[a++], b = v + t[a++], w = g + t[a++], x = v + t[a++], k = g + t[a++], q = v + t[a++]; c.push("C"), u.push(y, b, w, x, k, q), i = k, s = q; } else if ("S" == d) { var _ = Math.max(u.length - 4, 0); y = i + i - u[_], b = s + s - u[_ + 1], w = g + t[a++], x = v + t[a++], k = g + t[a++], q = v + t[a++]; c.push("C"), u.push(y, b, w, x, k, q), i = k, s = q; } else console.log("Unknown SVG command " + p); } } }, e.SVG._reps = function(e, t, n) { for (var a = t; a < e.length && "string" != typeof e[a]; ) a += n; return (a - t) / n; }, null == e && (e = {}), null == e.U && (e.U = {}), e.U.codeToGlyph = function(e, t) { var n = e.cmap, a = -1; if (null != n.p0e4 ? a = n.p0e4 : null != n.p3e1 ? a = n.p3e1 : null != n.p1e0 && (a = n.p1e0), -1 == a) throw "no familiar platform and encoding!"; var i = n.tables[a]; if (0 == i.format) return t >= i.map.length ? 0 : i.map[t]; if (4 == i.format) { for (var s = -1, r = 0; r < i.endCount.length; r++) if (t <= i.endCount[r]) { s = r; break; } if (-1 == s) return 0; if (i.startCount[s] > t) return 0; return 65535 & (0 != i.idRangeOffset[s] ? i.glyphIdArray[t - i.startCount[s] + (i.idRangeOffset[s] >> 1) - (i.idRangeOffset.length - s)] : t + i.idDelta[s]); } if (12 == i.format) { if (t > i.groups[i.groups.length - 1][1]) return 0; for (r = 0; r < i.groups.length; r++) { var o = i.groups[r]; if (o[0] <= t && t <= o[1]) return o[2] + (t - o[0]); } return 0; } throw "unknown cmap table format " + i.format; }, e.U.glyphToPath = function(t, n) { var a = { cmds: [], crds: [] }; if (t.SVG && t.SVG.entries[n]) { var i = t.SVG.entries[n]; return null == i ? a : ("string" == typeof i && (i = e.SVG.toPath(i), t.SVG.entries[n] = i), i); } if (t.CFF) { var s = { x: 0, y: 0, stack: [], nStems: 0, haveWidth: false, width: t.CFF.Private ? t.CFF.Private.defaultWidthX : 0, open: false }; e.U._drawCFF(t.CFF.CharStrings[n], s, t.CFF, a); } else t.glyf && e.U._drawGlyf(n, t, a); return a; }, e.U._drawGlyf = function(t, n, a) { var i = n.glyf[t]; null == i && (i = n.glyf[t] = e.glyf._parseGlyf(n, t)), null != i && (i.noc > -1 ? e.U._simpleGlyph(i, a) : e.U._compoGlyph(i, n, a)); }, e.U._simpleGlyph = function(t, n) { for (var a = 0; a < t.noc; a++) { for (var i = 0 == a ? 0 : t.endPts[a - 1] + 1, s = t.endPts[a], r = i; r <= s; r++) { var o = r == i ? s : r - 1, l = r == s ? i : r + 1, c = 1 & t.flags[r], u = 1 & t.flags[o], p = 1 & t.flags[l], d = t.xs[r], m = t.ys[r]; if (r == i) if (c) { if (!u) { e.U.P.moveTo(n, d, m); continue; } e.U.P.moveTo(n, t.xs[o], t.ys[o]); } else u ? e.U.P.moveTo(n, t.xs[o], t.ys[o]) : e.U.P.moveTo(n, (t.xs[o] + d) / 2, (t.ys[o] + m) / 2); c ? u && e.U.P.lineTo(n, d, m) : p ? e.U.P.qcurveTo(n, d, m, t.xs[l], t.ys[l]) : e.U.P.qcurveTo(n, d, m, (d + t.xs[l]) / 2, (m + t.ys[l]) / 2); } e.U.P.closePath(n); } }, e.U._compoGlyph = function(t, n, a) { for (var i = 0; i < t.parts.length; i++) { var s = { cmds: [], crds: [] }, r = t.parts[i]; e.U._drawGlyf(r.glyphIndex, n, s); for (var o = r.m, l = 0; l < s.crds.length; l += 2) { var c = s.crds[l], u = s.crds[l + 1]; a.crds.push(c * o.a + u * o.b + o.tx), a.crds.push(c * o.c + u * o.d + o.ty); } for (l = 0; l < s.cmds.length; l++) a.cmds.push(s.cmds[l]); } }, e.U._getGlyphClass = function(t, n) { var a = e._lctf.getInterval(n, t); return -1 == a ? 0 : n[a + 2]; }, e.U.getPairAdjustment = function(t, n, a) { if (t.GPOS) { for (var i = null, s = 0; s < t.GPOS.featureList.length; s++) { var r = t.GPOS.featureList[s]; if ("kern" == r.tag) for (var o = 0; o < r.tab.length; o++) 2 == t.GPOS.lookupList[r.tab[o]].ltype && (i = t.GPOS.lookupList[r.tab[o]]); } if (i) for (s = 0; s < i.tabs.length; s++) { var l = i.tabs[s], c = e._lctf.coverageIndex(l.coverage, n); if (-1 != c) { if (1 == l.format) { var u = l.pairsets[c]; for (o = 0; o < u.length; o++) u[o].gid2 == a && (m = u[o]); if (null == m) continue; } else if (2 == l.format) var p = e.U._getGlyphClass(n, l.classDef1), d = e.U._getGlyphClass(a, l.classDef2), m = l.matrix[p][d]; return m.val1[2]; } } } if (t.kern) { var h = t.kern.glyph1.indexOf(n); if (-1 != h) { var f = t.kern.rval[h].glyph2.indexOf(a); if (-1 != f) return t.kern.rval[h].vals[f]; } } return 0; }, e.U.stringToGlyphs = function(t, n) { for (var a = [], i = 0; i < n.length; i++) { var s = n.codePointAt(i); s > 65535 && i++, a.push(e.U.codeToGlyph(t, s)); } var r = t.GSUB; if (null == r) return a; for (var o = r.lookupList, l = r.featureList, c = '\n\t" ,.:;!?() \u060c', u = "\u0622\u0623\u0624\u0625\u0627\u0629\u062f\u0630\u0631\u0632\u0648\u0671\u0672\u0673\u0675\u0676\u0677\u0688\u0689\u068a\u068b\u068c\u068d\u068e\u068f\u0690\u0691\u0692\u0693\u0694\u0695\u0696\u0697\u0698\u0699\u06c0\u06c3\u06c4\u06c5\u06c6\u06c7\u06c8\u06c9\u06ca\u06cb\u06cd\u06cf\u06d2\u06d3\u06d5\u06ee\u06ef\u0710\u0715\u0716\u0717\u0718\u0719\u071e\u0728\u072a\u072c\u072f\u074d\u0759\u075a\u075b\u076b\u076c\u0771\u0773\u0774\u0778\u0779\u0840\u0846\u0847\u0849\u0854\u0867\u0869\u086a\u08aa\u08ab\u08ac\u08ae\u08b1\u08b2\u08b9\u0ac5\u0ac7\u0ac9\u0aca\u0ace\u0acf\u0ad0\u0ad1\u0ad2\u0add\u0ae1\u0ae4\u0aef\u0b81\u0b83\u0b84\u0b85\u0b89\u0b8c\u0b8e\u0b8f\u0b91\u0ba9\u0baa\u0bab\u0bac", p = 0; p < a.length; p++) { var d = a[p], m = 0 == p || -1 != c.indexOf(n[p - 1]), h = p == a.length - 1 || -1 != c.indexOf(n[p + 1]); m || -1 == u.indexOf(n[p - 1]) || (m = true), h || -1 == u.indexOf(n[p]) || (h = true), h || -1 == "\ua872\u0acd\u0ad7".indexOf(n[p + 1]) || (h = true), m || -1 == "\ua872\u0acd\u0ad7".indexOf(n[p]) || (m = true); var f = null; f = m ? h ? "isol" : "init" : h ? "fina" : "medi"; for (var g = 0; g < l.length; g++) if (l[g].tag == f) for (var v = 0; v < l[g].tab.length; v++) { 1 == (x = o[l[g].tab[v]]).ltype && e.U._applyType1(a, p, x); } } var y = [ "rlig", "liga", "mset" ]; for (p = 0; p < a.length; p++) { d = a[p]; var b = Math.min(3, a.length - p - 1); for (g = 0; g < l.length; g++) { var w = l[g]; if (-1 != y.indexOf(w.tag)) for (v = 0; v < w.tab.length; v++) for (var x = o[w.tab[v]], k = 0; k < x.tabs.length; k++) if (null != x.tabs[k]) { var q = e._lctf.coverageIndex(x.tabs[k].coverage, d); if (-1 != q) if (4 == x.ltype) for (var _ = x.tabs[k].vals[q], A = 0; A < _.length; A++) { var T = _[A], C = T.chain.length; if (!(C > b)) { for (var S = true, I = 0; I < C; I++) T.chain[I] != a[p + (1 + I)] && (S = false); if (S) { a[p] = T.nglyph; for (I = 0; I < C; I++) a[p + I + 1] = -1; } } } else if (5 == x.ltype) { var E = x.tabs[k]; if (2 != E.fmt) continue; var U = e._lctf.getInterval(E.cDef, d), P = E.cDef[U + 2], H = E.scset[P]; for (i = 0; i < H.length; i++) { var $ = H[i], L = $.input; if (!(L.length > b)) { for (S = true, I = 0; I < L.length; I++) { var M = e._lctf.getInterval(E.cDef, a[p + 1 + I]); if (-1 == U && E.cDef[M + 2] != L[I]) { S = false; break; } } if (S) { var j = $.substLookupRecords; for (A = 0; A < j.length; A += 2) j[A], j[A + 1]; } } } } } } } return a; }, e.U._applyType1 = function(t, n, a) { for (var i = t[n], s = 0; s < a.tabs.length; s++) { var r = a.tabs[s], o = e._lctf.coverageIndex(r.coverage, i); -1 != o && (1 == r.fmt ? t[n] = t[n] + r.delta : t[n] = r.newg[o]); } }, e.U.glyphsToPath = function(t, n, a) { for (var i = { cmds: [], crds: [] }, s = 0, r = 0; r < n.length; r++) { var o = n[r]; if (-1 != o) { for (var l = r < n.length - 1 && -1 != n[r + 1] ? n[r + 1] : 0, c = e.U.glyphToPath(t, o), u = 0; u < c.crds.length; u += 2) i.crds.push(c.crds[u] + s), i.crds.push(c.crds[u + 1]); a && i.cmds.push(a); for (u = 0; u < c.cmds.length; u++) i.cmds.push(c.cmds[u]); a && i.cmds.push("X"), s += t.hmtx.aWidth[o], r < n.length - 1 && (s += e.U.getPairAdjustment(t, o, l)); } } return i; }, e.U.pathToSVG = function(e, t) { null == t && (t = 5); for (var n = [], a = 0, i = { M: 2, L: 2, Q: 4, C: 6 }, s = 0; s < e.cmds.length; s++) { var r = e.cmds[s], o = a + (i[r] ? i[r] : 0); for (n.push(r); a < o; ) { var l = e.crds[a++]; n.push(parseFloat(l.toFixed(t)) + (a == o ? "" : " ")); } } return n.join(""); }, e.U.pathToContext = function(e, t) { for (var n = 0, a = e.crds, i = 0; i < e.cmds.length; i++) { var s = e.cmds[i]; "M" == s ? (t.moveTo(a[n], a[n + 1]), n += 2) : "L" == s ? (t.lineTo(a[n], a[n + 1]), n += 2) : "C" == s ? (t.bezierCurveTo(a[n], a[n + 1], a[n + 2], a[n + 3], a[n + 4], a[n + 5]), n += 6) : "Q" == s ? (t.quadraticCurveTo(a[n], a[n + 1], a[n + 2], a[n + 3]), n += 4) : "#" == s.charAt(0) ? (t.beginPath(), t.fillStyle = s) : "Z" == s ? t.closePath() : "X" == s && t.fill(); } }, e.U.P = {}, e.U.P.moveTo = function(e, t, n) { e.cmds.push("M"), e.crds.push(t, n); }, e.U.P.lineTo = function(e, t, n) { e.cmds.push("L"), e.crds.push(t, n); }, e.U.P.curveTo = function(e, t, n, a, i, s, r) { e.cmds.push("C"), e.crds.push(t, n, a, i, s, r); }, e.U.P.qcurveTo = function(e, t, n, a, i) { e.cmds.push("Q"), e.crds.push(t, n, a, i); }, e.U.P.closePath = function(e) { e.cmds.push("Z"); }, e.U._drawCFF = function(t, n, a, i) { for (var s = n.stack, r = n.nStems, o = n.haveWidth, l = n.width, c = n.open, u = 0, p = n.x, d = n.y, m = 0, h = 0, f = 0, g = 0, v = 0, y = 0, b = 0, w = 0, x = 0, k = 0, q = { val: 0, size: 0 }; u < t.length; ) { e.CFF.getCharString(t, u, q); var _ = q.val; if (u += q.size, "o1" == _ || "o18" == _) s.length % 2 != 0 && !o && (l = s.shift() + a.Private.nominalWidthX), r += s.length >> 1, s.length = 0, o = true; else if ("o3" == _ || "o23" == _) { s.length % 2 != 0 && !o && (l = s.shift() + a.Private.nominalWidthX), r += s.length >> 1, s.length = 0, o = true; } else if ("o4" == _) s.length > 1 && !o && (l = s.shift() + a.Private.nominalWidthX, o = true), c && e.U.P.closePath(i), d += s.pop(), e.U.P.moveTo(i, p, d), c = true; else if ("o5" == _) for (;s.length > 0; ) p += s.shift(), d += s.shift(), e.U.P.lineTo(i, p, d); else if ("o6" == _ || "o7" == _) for (var A = s.length, T = "o6" == _, C = 0; C < A; C++) { var S = s.shift(); T ? p += S : d += S, T = !T, e.U.P.lineTo(i, p, d); } else if ("o8" == _ || "o24" == _) { A = s.length; for (var I = 0; I + 6 <= A; ) m = p + s.shift(), h = d + s.shift(), f = m + s.shift(), g = h + s.shift(), p = f + s.shift(), d = g + s.shift(), e.U.P.curveTo(i, m, h, f, g, p, d), I += 6; "o24" == _ && (p += s.shift(), d += s.shift(), e.U.P.lineTo(i, p, d)); } else { if ("o11" == _) break; if ("o1234" == _ || "o1235" == _ || "o1236" == _ || "o1237" == _) "o1234" == _ && (h = d, f = (m = p + s.shift()) + s.shift(), k = g = h + s.shift(), y = g, w = d, p = (b = (v = (x = f + s.shift()) + s.shift()) + s.shift()) + s.shift(), e.U.P.curveTo(i, m, h, f, g, x, k), e.U.P.curveTo(i, v, y, b, w, p, d)), "o1235" == _ && (m = p + s.shift(), h = d + s.shift(), f = m + s.shift(), g = h + s.shift(), x = f + s.shift(), k = g + s.shift(), v = x + s.shift(), y = k + s.shift(), b = v + s.shift(), w = y + s.shift(), p = b + s.shift(), d = w + s.shift(), s.shift(), e.U.P.curveTo(i, m, h, f, g, x, k), e.U.P.curveTo(i, v, y, b, w, p, d)), "o1236" == _ && (m = p + s.shift(), h = d + s.shift(), f = m + s.shift(), k = g = h + s.shift(), y = g, b = (v = (x = f + s.shift()) + s.shift()) + s.shift(), w = y + s.shift(), p = b + s.shift(), e.U.P.curveTo(i, m, h, f, g, x, k), e.U.P.curveTo(i, v, y, b, w, p, d)), "o1237" == _ && (m = p + s.shift(), h = d + s.shift(), f = m + s.shift(), g = h + s.shift(), x = f + s.shift(), k = g + s.shift(), v = x + s.shift(), y = k + s.shift(), b = v + s.shift(), w = y + s.shift(), Math.abs(b - p) > Math.abs(w - d) ? p = b + s.shift() : d = w + s.shift(), e.U.P.curveTo(i, m, h, f, g, x, k), e.U.P.curveTo(i, v, y, b, w, p, d)); else if ("o14" == _) { if (s.length > 0 && !o && (l = s.shift() + a.nominalWidthX, o = true), 4 == s.length) { var E = s.shift(), U = s.shift(), P = s.shift(), H = s.shift(), $ = e.CFF.glyphBySE(a, P), L = e.CFF.glyphBySE(a, H); e.U._drawCFF(a.CharStrings[$], n, a, i), n.x = E, n.y = U, e.U._drawCFF(a.CharStrings[L], n, a, i); } c && (e.U.P.closePath(i), c = false); } else if ("o19" == _ || "o20" == _) { s.length % 2 != 0 && !o && (l = s.shift() + a.Private.nominalWidthX), r += s.length >> 1, s.length = 0, o = true, u += r + 7 >> 3; } else if ("o21" == _) s.length > 2 && !o && (l = s.shift() + a.Private.nominalWidthX, o = true), d += s.pop(), p += s.pop(), c && e.U.P.closePath(i), e.U.P.moveTo(i, p, d), c = true; else if ("o22" == _) s.length > 1 && !o && (l = s.shift() + a.Private.nominalWidthX, o = true), p += s.pop(), c && e.U.P.closePath(i), e.U.P.moveTo(i, p, d), c = true; else if ("o25" == _) { for (;s.length > 6; ) p += s.shift(), d += s.shift(), e.U.P.lineTo(i, p, d); m = p + s.shift(), h = d + s.shift(), f = m + s.shift(), g = h + s.shift(), p = f + s.shift(), d = g + s.shift(), e.U.P.curveTo(i, m, h, f, g, p, d); } else if ("o26" == _) for (s.length % 2 && (p += s.shift()); s.length > 0; ) m = p, h = d + s.shift(), p = f = m + s.shift(), d = (g = h + s.shift()) + s.shift(), e.U.P.curveTo(i, m, h, f, g, p, d); else if ("o27" == _) for (s.length % 2 && (d += s.shift()); s.length > 0; ) h = d, f = (m = p + s.shift()) + s.shift(), g = h + s.shift(), p = f + s.shift(), d = g, e.U.P.curveTo(i, m, h, f, g, p, d); else if ("o10" == _ || "o29" == _) { var M = "o10" == _ ? a.Private : a; if (0 == s.length) console.log("error: empty stack"); else { var j = s.pop(), O = M.Subrs[j + M.Bias]; n.x = p, n.y = d, n.nStems = r, n.haveWidth = o, n.width = l, n.open = c, e.U._drawCFF(O, n, a, i), p = n.x, d = n.y, r = n.nStems, o = n.haveWidth, l = n.width, c = n.open; } } else if ("o30" == _ || "o31" == _) { var z = s.length, F = (I = 0, "o31" == _); for (I += z - (A = -3 & z); I < A; ) F ? (h = d, f = (m = p + s.shift()) + s.shift(), d = (g = h + s.shift()) + s.shift(), A - I == 5 ? (p = f + s.shift(), I++) : p = f, F = false) : (m = p, h = d + s.shift(), f = m + s.shift(), g = h + s.shift(), p = f + s.shift(), A - I == 5 ? (d = g + s.shift(), I++) : d = g, F = true), e.U.P.curveTo(i, m, h, f, g, p, d), I += 4; } else { if ("o" == (_ + "").charAt(0)) throw console.log("Unknown operation: " + _, t), _; s.push(_); } } } n.x = p, n.y = d, n.nStems = r, n.haveWidth = o, n.width = l, n.open = c; }, Ze = e; }(); const nt = getDefaultExportFromCjs(tt), decode = async () => { var e; const t = se.document.querySelectorAll("style"); let n = null; if (t.forEach((e => { var t; -1 !== (null == (t = e.textContent) ? void 0 : t.indexOf("font-cxsecret")) && (n = e); })), !n) return true; const a = null == (e = n.textContent) ? void 0 : e.match(/base64,([\w\W]+?)'/); if (!a) return; const i = base64ToUint8Array(a[1]), s = nt.parse(i); let r = await ttfDownloadJson("https://www.forestpolice.org/ttf/2.0/table.json") || await ttfDownloadJson("https://jsd.vxo.im/gh/chengbianruan/staticfile/c.json") || await ttfDownloadJson("https://cdn.jsdelivr.net/gh/chengbianruan/staticfile/c.json"); if (!r) return false; let o = {}; for (let l = 19968; l < 40870; l++) { let e = nt.U.codeToGlyph(s, l); e && (e = nt.U.glyphToPath(s, e), e = somd5(JSON.stringify(e)).slice(24), o[l] = r[e]); } return se.document.querySelectorAll(".font-cxsecret").forEach((e => { let t = e.innerHTML; Object.keys(o).forEach((e => { const n = new RegExp(String.fromCharCode(e), "g"); t = t.replace(n, String.fromCharCode(o[e])); })), e.innerHTML = t, e.classList.remove("font-cxsecret"); })), true; }, base64ToUint8Array = e => { const t = atob(e), n = new Uint8Array(t.length); for (let a = 0; a < t.length; a++) n[a] = t.charCodeAt(a); return n; }, cleanChaoxingQuestionLiTitle = (e, t, n) => { const a = e || "", i = t || ""; return n(i && a.includes(i) ? a.split(i).slice(1).join(i).trim() : a).trim(); }, getChaoxingAnswerIndex = e => { const t = (e || "").trim().toUpperCase(); if (/^[A-Z]$/.test(t)) return t.charCodeAt(0) - 65; if (/^\d+$/.test(t)) { const e = Number.parseInt(t, 10) - 1; return e >= 0 ? e : null; } return null; }, mapChaoxingChoiceLettersToOptions = (e, t) => (e || "").trim().toUpperCase().split("").map((e => { const n = getChaoxingAnswerIndex(e); return null == n ? void 0 : t[n]; })).filter((e => void 0 !== e && "" !== e)), normalizeChaoxingSubjectiveAnswer = (e, t = 10) => { const n = (e || "").replace("\u6b63\u786e\u7b54\u6848\uff1a", "").trim(); return n.length < t ? null : [ n ]; }, getChaoxingExamOutLinkTarget = e => { let t; try { t = new URL(e); } catch { return ""; } if ("i.mooc.chaoxing.com" !== t.hostname) return ""; if (!t.pathname.includes("/space/out_link.shtml")) return ""; const n = t.searchParams.get("burl"); if (!n) return ""; try { const e = new URL(n), t = "chaoxing.com" === e.hostname || e.hostname.endsWith(".chaoxing.com"), a = e.pathname.includes("/exam-ans/exam/test/"); return t && a ? e.href : ""; } catch { return ""; } }, getChaoxingReviewLayout = e => e.querySelector(".TiMu .newAnswerBx") ? "modern" : e.querySelector(".TiMu .Py_answer") ? "classic" : null, redirectCurrentChaoxingExamOutLink = () => { ((e, t) => { const n = getChaoxingExamOutLinkTarget(e); !!n && t(n); })(location.href, (e => { se.location.href = e; })); }, at = [ { type: "hook", name: "\u5b66\u4e60\u901a\u8003\u8bd5\u5916\u94fe\u8df3\u8f6c", match: () => "" !== getChaoxingExamOutLinkTarget(location.href), hook: redirectCurrentChaoxingExamOutLink, main: redirectCurrentChaoxingExamOutLink }, { type: "ask", name: "\u5b66\u4e60\u901a\u968f\u5802\u7ec3\u4e60", match: () => location.href.includes("/page/quiz/stu/answerQuestion2"), types: [ "0", "1", "2", "3", "4", "5", "6", "7", "9" ], minDelay: 100, answerDelay: 1e3, question: { html: ".left-question-list>.question-item", question: ".html-content-box", options: "ul.option-list>li", type: ".grey-text", workType: "stlx", pageType: "cx" }, init: async () => {}, ischecked: isParentChecked, questionHook: e => (e.options = removeStartChar(e.options), e.type = typeMatch(O(e.html).find(".grey-text").text()), e) }, { type: "save", name: "\u5b66\u4e60\u901a\u8003\u8bd5\u65b0\u7248\u6536\u5f55", match: () => location.href.includes("work/view") || location.href.includes("test/reVersionPaperMarkContentNew"), question: { html: ".questionLi", question: "h3.mark_name", options: "ul.mark_letter.colorDeep > li", type: ".colorShallow", workType: "zj", pageType: "cx" }, answerHook: e => { let t = removeHtml(O(e.html).find('span[class="colorShallow"]').html()); if ("" === t) return null; let n = t.match(/^\((.+?)\)/); if (null === n) return null; e.type = n[1].split(",")[0], e.question = titleClean(e.question.split(t)[1].trim()).trim(), e.options = removeStartChar(e.options); const a = O(e.html).find(".mark_score>.totalScore>i").text(), i = t.match(/(\d+(\.\d+)?)/); let s, r = O(e.html).find(".marking_dui").length > 0 || Number(a) == ((null == i ? void 0 : i[0]) || 0) && 0 != Number(a), o = typeMatch(t); if (!r) switch (o) { case "0": case "1": case "3": 0 != Number(a) && (r = true); } switch (o) { case "0": case "1": e.type = o, e.answer = mapChaoxingChoiceLettersToOptions(O(e.html).find(".mark_answer>div>span.colorGreen:eq(0)").text().replace("\u6b63\u786e\u7b54\u6848:", ""), e.options), 0 === e.answer.length && r && (e.answer = mapChaoxingChoiceLettersToOptions(O(e.html).find(".mark_answer>div>span.colorDeep:eq(0)").text().replace("\u6211\u7684\u7b54\u6848:", ""), e.options)); break; case "3": if (e.type = "3", e.options = [], e.answer = judgeAnswer(O(e.html).find(".mark_answer>div>span.colorGreen:eq(0)").text().replace("\u6b63\u786e\u7b54\u6848", "")), e.answer, 0 === e.answer.length) { if (s = removeHtml(O(e.html).find(".mark_answer>div>span.colorDeep:eq(0)").html()), e.answer = judgeAnswer(s), 0 === e.answer.length) return null; if (0 == Number(a) && !r && "3" == o) return null; r || (e.answer = "\u6b63\u786e" === e.answer[0] ? [ "\u9519\u8bef" ] : [ "\u6b63\u786e" ]); } break; case "4": if (e.type = "4", e.answer = normalizeChaoxingSubjectiveAnswer(removeHtml(O(e.html).find(".mark_answer>div>.colorGreen:eq(0)").html())), null == e.answer) return null; break; case "5": if (e.type = "5", e.answer = normalizeChaoxingSubjectiveAnswer(removeHtml(O(e.html).find(".mark_answer>div>.colorGreen:eq(0)").html())), null == e.answer) return null; break; case "7": if (e.type = "7", e.answer = normalizeChaoxingSubjectiveAnswer(removeHtml(O(e.html).find(".mark_answer>div>.colorGreen:eq(0)").html())), null == e.answer) return null; break; case "6": if (e.type = "6", e.answer = normalizeChaoxingSubjectiveAnswer(removeHtml(O(e.html).find(".mark_answer>div>.colorGreen:eq(0)").html())), null == e.answer) return null; break; case "2": if (e.type = "2", e.answer = O(e.html).find(".mark_answer>div>.colorGreen:eq(0)>dd").map(((e, t) => removeHtml(O(t).html()).replace(`(${e + 1})`, "").trim())).get(), 0 == e.answer.length) { const t = O(e.html).find(".mark_answer>div>.colorDeep:eq(0)>dd").map(((e, t) => removeHtml(O(t).html()).replace(`(${e + 1})`, "").trim())).get(); O(e.html).find(".mark_answer>div>.colorDeep:eq(0)>dd>.marking_dui").length == t.length && (e.answer = t); } break; default: return null; } return e; }, paper: async e => { const t = { platform: "cx" }, n = O("#courseId").val(), a = (se.document.body.innerHTML.match(/(?:examId|relationId)=(\d+)/) || [])[1] || "", i = `https://mobilelearn.chaoxing.com/v2/apis/class/getClassDetail?courseId=${n}&classId=${O("#classId").val()}`; await request(i, "GET").then((e => { const n = JSON.parse(e[0].responseText).data.course.data[0]; t.name = n.name, t.info = {}, t.info.imageurl = n.imageurl; })), t.hash = n, t.info = {}, t.chapter = [ { hash: `${a}`, name: O(".mark_title").text().trim(), question: e } ], Xe.setPaper(t.hash, t); } }, { type: "save", name: "\u5b66\u4e60\u901a\u7ecf\u5178\u4f5c\u4e1a\u6536\u5f55", match: () => /\/work\/selectWorkQuestionYiPiYue$/.test(location.pathname) && "classic" === getChaoxingReviewLayout(document), question: { html: ".TiMu", question: ".Zy_TItle > .clearfix > div:first-child", options: "ul.Zy_ulTop > li > a.fl", type: ".newZy_TItle", workType: "zj", pageType: "cx" }, answerHook: e => { const t = ((e, t) => { var n, a, i, s, r; let o = "", l = e.previousElementSibling; for (let b = 200; l && b > 0; b--) { if (l.matches(".Cy_TItle1")) { o = (null == (n = l.textContent) ? void 0 : n.trim()) || ""; break; } l = l.previousElementSibling; } const c = null == (a = o.match(/^[\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\d]+[.\u3001\uff0e]\s*(\u5355\u9009\u9898|\u591a\u9009\u9898|\u5224\u65ad\u9898)/)) ? void 0 : a[1]; if (!c) return null; const u = e.querySelector(".Zy_TItle > .clearfix > div:first-child"), p = u ? cleanQuestionTitle(t(u.innerHTML)) : ""; if (!p) return null; const d = Array.from(e.querySelectorAll(".Py_answer > span")).map((e => { var t; return (null == (t = e.textContent) ? void 0 : t.trim()) || ""; })).filter((e => /^\u6b63\u786e\u7b54\u6848\s*[:\uff1a]/.test(e))); if (1 !== d.length) return null; const m = d[0].replace(/^\u6b63\u786e\u7b54\u6848\s*[:\uff1a]\s*/, "").trim(); if ("\u5224\u65ad\u9898" === c) return /^(\u6b63\u786e|\u9519\u8bef|\u5bf9|\u9519|\u221a|\xd7)$/.test(m) ? { question: p, options: [], type: "3", answer: judgeAnswer(m) } : null; const h = Array.from(e.querySelectorAll("ul.Zy_ulTop > li")); if (h.length < 2 || h.length > 26) return null; const f = [], g = new Map; for (const b of h) { const e = null == (r = null == (s = null == (i = b.querySelector("i.fl")) ? void 0 : i.textContent) ? void 0 : s.trim().match(/^([A-Z])[\u3001.\uff0e]$/)) ? void 0 : r[1], n = b.querySelector("a.fl"), a = n ? t(n.innerHTML).trim() : ""; if (!e || !a || g.has(e)) return null; f.push(a), g.set(e, a); } if (!/^[A-Z](?:[\s,\uff0c\u3001;\uff1b]*[A-Z])*$/.test(m)) return null; const v = m.replace(/[\s,\uff0c\u3001;\uff1b]/g, "").split(""); if ("\u5355\u9009\u9898" === c && 1 !== v.length || new Set(v).size !== v.length) return null; const y = []; for (const b of v) { const e = g.get(b); if (!e) return null; y.push(e); } return { question: p, options: f, type: "\u5355\u9009\u9898" === c ? "0" : "1", answer: y }; })(e.html, removeHtml); return t ? { ...e, ...t } : null; } }, { type: "hook", name: "hook", match: () => location.href.includes("work/selectWorkQuestionYiPiYue") && location.href.includes("mooc2=0") && "classic" !== getChaoxingReviewLayout(document), main: e => { location.href.includes("mooc2=0") ? se.location.href = location.href.replace("mooc2=0", "mooc2=1") : se.location.href = location.href + "&mooc2=1"; } }, { type: "save", name: "\u5b66\u4e60\u901a\u4f5c\u4e1a\u6536\u5f55\u65b0", match: () => location.href.includes("work/selectWorkQuestionYiPiYue") && "modern" === getChaoxingReviewLayout(document), question: { html: ".TiMu", question: ".Zy_TItle .clearfix", options: "ul.Zy_ulTop li", type: ".newZy_TItle", workType: "zj", pageType: "cx" }, answerHook: e => { e.type = O(e.html).find(".newZy_TItle").text().replace(/\u3010|\u3011/g, "").trim(); let t, n = O(e.html).find(".marking_dui").length > 0; switch (removeHtml(O(e.html).find(".Py_addpy:eq(0)").html()), e.question = titleClean(e.question).trim(), e.type) { case "\u5355\u9009\u9898": case "\u591a\u9009\u9898": e.type = "\u5355\u9009\u9898" === e.type ? "0" : "1", e.options = O(e.html).find("ul.Zy_ulTop li").map(((e, t) => { let n = O(t).find("i.fl").text().trim(), a = removeHtml(O(t).html()); return "" === n ? a.trim() : removeKnownOptionPrefix(a, n); })).get(), e.answer = mapChaoxingChoiceLettersToOptions(O(e.html).find(".correctAnswer >.fl.answerCon").text(), e.options), 0 === e.answer.length && n && (e.answer = mapChaoxingChoiceLettersToOptions(O(e.html).find(".myAnswer > .fl.answerCon").text(), e.options)); break; case "\u5224\u65ad\u9898": if (e.type = "3", e.answer = O(e.html).find(".correctAnswer > .fl.answerCon").text().trim().split("").map((e => e.includes("\u6b63\u786e") || e.includes("\u5bf9") || e.includes("\u221a") ? "\u6b63\u786e" : e.includes("\u9519\u8bef") || e.includes("\u9519") || e.includes("\xd7") ? "\u9519\u8bef" : null)).filter((e => null !== e)), 0 === e.answer.length) { t = removeHtml(O(e.html).find(".fl.answerCon").html()); let [n, a] = [ ".marking_dui", ".marking_cuo" ].map((t => O(e.html).find(t).length)); if (n + a === 0) return null; if (t.includes("\u6b63\u786e") || t.includes("\u5bf9") || t.includes("\u221a")) e.answer = [ "\u6b63\u786e" ]; else { if (!(t.includes("\u9519\u8bef") || t.includes("\u9519") || t.includes("\xd7"))) return null; e.answer = [ "\u9519\u8bef" ]; } 0 === n && 0 !== a && (e.answer = "\u6b63\u786e" === e.answer[0] ? "\u9519\u8bef" : "\u6b63\u786e"); } break; case "\u586b\u7a7a\u9898": e.type = "2", e.answer = O(e.html).find(".correctAnswerBx>.correctAnswer>p:not(.clear)").map(((e, t) => removeHtml(O(t).html()).replace(`(${e + 1})`, "").trim())).get().filter((e => "" !== e)), 0 == e.answer.length && (e.answer = O(e.html).find(".myAllAnswerBx>.myAnswerBx>.myAnswer").map(((e, t) => removeHtml(O(t).html()).replace(/\u7b2c[\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\u7a7a\uff1a/, "").trim())).get(), e.answer.length !== O(e.html).find(".marking_dui").length && (e.answer = [])); break; case "\u5206\u5f55\u9898": if (e.type = "9", e.answer = O(e.html).find(".correctAnswerBx>.correctAnswer>p:not(.clear)").map(((e, t) => removeHtml(O(t).html()))).get().filter((e => "" !== e)), e.answer.length != O(e.html).find(".CorrectOrNot").length) { if (O(e.html).find(".marking_cuo").length > 0) return null; if (e.answer = O(e.html).find(".myAnswerBx>.myAnswer>p:not(.clear)").map(((e, t) => removeHtml(O(t).html()))).get().filter((e => "" !== e)), e.answer.length != O(e.html).find(".CorrectOrNot").length) return null; } e.answer; break; case "\u8fde\u7ebf\u9898": e.type = "11"; let a = O(e.html).find("ul.firstUlList>li:not(.groupTitile)").map(((e, t) => { let n = O(t).clone(); return n.find(".fl").remove(), removeHtml(n.html()); })).get(), i = O(e.html).find("ul.secondUlList>li:not(.groupTitile)").map(((e, t) => { let n = O(t).clone(); return n.find(".fl").remove(), removeHtml(n.html()); })).get(); t = O(e.html).find(".correctAnswer >.fl.answerCon >.collectAnswer").map(((e, t) => removeHtml(O(t).text()))).get(), e.options = [ a, i ]; let s = {}; t.forEach((e => { let [t, n] = e.split("-"); const r = getChaoxingAnswerIndex(t), o = getChaoxingAnswerIndex(n); null != r && null != o && null != a[r] && null != i[o] && (s[a[r]] = i[o]); })), e.answer = s, e.answer; break; case "\u9009\u62e9\u9898": { const t = O(e.html).find("ul.Zy_ulTop > li"); if (0 === t.length) return null; const n = O(e.html).find(".correctAnswerBx .correctAnswer .answerCon").text(), a = {}; for (const e of n.matchAll(/\((\d+)\)\s*([A-Z]+)/g)) a[parseInt(e[1], 10)] = e[2]; const i = []; let s = false; if (t.each(((e, t) => { if (s) return; const n = O(t).find("label.selectLabel span.selectItem > p").map(((e, t) => removeHtml(O(t).html()))).get(), r = a[e + 1], o = n.length && r ? mapChaoxingChoiceLettersToOptions(r, n) : []; 0 !== o.length ? i.push({ type: "0", question: `\u7b2c${e + 1}\u7a7a`, options: n, answer: o }) : s = true; })), s || 0 === i.length) return null; e.answer = i.map((e => e.answer)), e.options = i.map((({answer: e, ...t}) => t)), e.type = "15", e.answer; break; } case "\u9605\u8bfb\u7406\u89e3": const r = O(e.html).find(".readCompreHensionItem").map(((e, t) => { let n = typeMatch(O(t).find("i.index").text()), a = removeHtml(O(t).find(".clearfix").html()), i = O(t).find("ul.Zy_ulTop>li").map(((e, t) => removeHtml(O(t).html()))).get(); i = removeOptionsStartChar(i); let s = removeHtml(O(t).find(".correctAnswerBx>.correctAnswer>.answerCon").text()), r = []; switch (n) { case "0": case "1": r = mapChaoxingChoiceLettersToOptions(s, i); break; default: return null; } return 0 === r.length ? null : { type: n, question: a, options: i, answer: r }; })).get(); if (null == r || 0 == r.length) return null; e.answer = r.map((e => e.answer)), e.options = r.map((e => (delete e.answer, e))), e.type = "15"; break; default: return e.type, null; } return e; }, paper: async e => { const t = { platform: "cx" }, n = se.courseId, a = se.jobid, i = `https://mobilelearn.chaoxing.com/v2/apis/class/getClassDetail?courseId=${n}&classId=${se.classId}`; await request(i, "GET").then((e => { const n = JSON.parse(e[0].responseText).data.course.data[0]; t.name = n.name, t.info = {}, t.info.imageurl = n.imageurl; })), t.hash = n, t.info = {}, t.chapter = [ { hash: `${a}`, name: O(".ceyan_name>h3").text().trim(), question: e } ], Xe.setPaper(t.hash, t); } }, { type: "ask", name: "\u5b66\u4e60\u901a\u65b0\u7248\u4f5c\u4e1a", match: () => /\/mooc2\/work\/dowork/i.test(location.pathname), types: [ "0", "1", "2", "3", "4", "5", "6", "7", "9" ], question: { html: ".questionLi", question: "h3", options: "ul:eq(0) li .after, .answer_p", type: "input[name^=answertype]:eq(0)", workType: "zy", pageType: "cx" }, questionHook: e => { const t = removeHtml(O(e.html).find(".colorShallow").html()); return e.question = cleanChaoxingQuestionLiTitle(e.question, t, titleClean), e.$options = O(e.html).find(".answerBg"), e; }, setAnswerHook: e => { qc(e.html), qc1(e.html); } }, { type: "ask", name: "\u5b66\u4e60\u901a\u65b0\u7248\u8003\u8bd5", match: () => /exam\/preview/i.test(location.pathname) || /exam\/test\/reVersionTestStartNew/i.test(location.pathname), types: [ "0", "1", "2", "3", "4", "5", "6", "7", "9" ], question: { html: ".questionLi", question: "h3", options: "ul:eq(0) li .after, .answer_p", type: "input[name^=type]:not([name=type])", workType: "ks", pageType: "cx" }, questionHook: e => { const t = removeHtml(O(e.html).find(".colorShallow").html()); if (e.question = cleanChaoxingQuestionLiTitle(e.question, t, titleClean), e.$options = O(e.html).find(".answerBg"), "3" === e.type) e.options = []; return e; }, setAnswerHook: e => { qc(e.html), qc1(e.html); }, next: () => { O('.nextDiv .jb_btn:contains("\u4e0b\u4e00\u9898")').click(); } }, { type: "ask", name: "\u5b66\u4e60\u901a\u65e7\u7248\u4f5c\u4e1a", match: () => /work\/doHomeWorkNew/i.test(location.pathname) && 0 == location.href.includes("mooc2=1"), types: [ "0", "1", "2", "3", "4", "5", "6", "7", "9" ], init: async () => { if (!(await decode())) return msg("\u9875\u9762\u89e3\u5bc6\u5931\u8d25\uff0c\u65e0\u6cd5\u7b54\u9898\uff0c\u8bf7\u5c1d\u8bd5\u5207\u6362\u7f51\u7edc\u6216\u53cd\u9988\u7ed9\u4f5c\u8005\u5427", "error"), false; }, question: { html: ".TiMu", question: ".clearfix.fontLabel", options: "ul:eq(0) li .after", type: "input[name^=answertype]:eq(0), .answer_p", workType: "zy", pageType: "cx" }, questionHook: e => { switch (e.question = titleClean(e.question).trim(), e.$options = O(e.html).find(".fl.before"), e.type) { case "3": e.options = O(e.html).find("ul:eq(0) li").map(((e, t) => O(t).find(".ri").length > 0 ? "\u6b63\u786e" : O(t).find(".wr").length > 0 ? "\u9519\u8bef" : isTrue(O(t).attr("aria-label") || "") ? "\u6b63\u786e" : isFalse(O(t).attr("aria-label") || "") ? "\u9519\u8bef" : void 0)).get(), e.$options = O(e.html).find("ul>li"); break; case "11": let t = O(e.html).find("ul.firstUlList>li:not(.groupTitile)").map(((e, t) => { let n = O(t).clone(); return n.find(".fl").remove(), removeHtml(n.html()); })).get(), n = O(e.html).find("ul.secondUlList>li:not(.groupTitile)").map(((e, t) => { let n = O(t).clone(); return n.find(".fl").remove(), removeHtml(n.html()); })).get(); e.options = [ t, n ], e.$options = O(e.html).find("ul.thirdUlList>li:not(.groupTitile)"); } return e; }, setAnswerHook: e => { qc(e.html), qc1(e.html); }, setAnswer: e => { switch (e.type) { case "11": return e.ques.$options.each(((t, n) => { var a, i, s; const r = null == (a = e.ques.options) ? void 0 : a[0], o = null == (i = e.ques.options) ? void 0 : i[1], l = null == (s = e.answer) ? void 0 : s[null == r ? void 0 : r[t]], c = Array.isArray(o) ? o.indexOf(l) : -1; if (c < 0) return void (null == r || r[t]); const u = String.fromCharCode(c + 65), p = O(n).find("select"); p.find("option").each(((e, t) => { O(t).prop("selected", O(t).val() == u); })), p.val(u).trigger("change"); })), e.answer, false; case "3": let t = e.answer; return e.ques.$options.each(((e, n) => { isTrue(t) && (isTrue(removeHtml(O(n).html())) || O(n).find(".ri").length > 0) && O(n).find("input").click(), isFalse(t) && (isFalse(removeHtml(O(n).html())) || O(n).find(".wr").length > 0) && O(n).find("input").click(); })), false; default: return true; } } }, { type: "ask", name: "\u5b66\u4e60\u901a\u65b0\u7248\u7ae0\u8282", match: () => /work\/doHomeWorkNew/i.test(location.pathname) && location.href.includes("mooc2=1"), types: [ "0", "1", "2", "3", "4", "5", "6", "7", "9" ], init: async () => { if (!(await decode())) return msg("\u9875\u9762\u89e3\u5bc6\u5931\u8d25\uff0c\u65e0\u6cd5\u7b54\u9898\uff0c\u8bf7\u5c1d\u8bd5\u5207\u6362\u7f51\u7edc\u6216\u53cd\u9988\u7ed9\u4f5c\u8005\u5427", "error"), false; }, question: { html: ".TiMu", question: ".clearfix.fontLabel", options: "ul:eq(0) li .after, .answer_p", type: "input[name^=answertype]:eq(0)", workType: "zj", pageType: "cx" }, questionHook: e => { switch (e.question = titleClean(e.question).trim(), e.type) { case "3": e.options = O(e.html).find("ul:eq(0) li").map(((e, t) => "true" === O(t).find(".num_option").attr("data") ? "\u6b63\u786e" : "false" === O(t).find(".num_option").attr("data") ? "\u9519\u8bef" : void 0)).get(), e.options = []; break; case "11": let t = O(e.html).find("ul.firstUlList>li:not(.groupTitile)").map(((e, t) => { let n = O(t).clone(); return n.find(".fl").remove(), removeHtml(n.html()); })).get(), n = O(e.html).find("ul.secondUlList>li:not(.groupTitile)").map(((e, t) => { let n = O(t).clone(); return n.find(".fl").remove(), removeHtml(n.html()); })).get(); e.options = [ t, n ], e.$options = O(e.html).find("ul.thirdUlList>li:not(.groupTitile)"); break; case "15": const a = O(e.html).find(".readCompreHensionItem").map(((e, t) => { let n = typeMatch(O(t).find("i.index").text()), a = removeHtml(O(t).find(".clearfix").html()), i = O(t).find("ul.Zy_ulTop>li").map(((e, t) => removeHtml(O(t).html()))).get(); return i = removeOptionsStartChar(i), { type: n, question: a, options: i, $options: O(t).find("ul.Zy_ulTop>li") }; })).get(); if (null == a || 0 == a.length) return null; e.options = a, e.$options = null; break; case "14": const i = O(e.html).find("ul.Zy_ulTop").map(((e, t) => { const n = O(t).children("li"); return { type: "0", question: `\u7b2c${e + 1}\u7a7a`, options: n.map(((e, t) => { const n = O(t).find(".after").html(); return removeHtml(null != n ? n : O(t).html()); })).get(), $options: n }; })).get(); if (null == i || 0 === i.length) return null; e.options = i, e.$options = null, e.type = "15"; break; default: e.type; } return e; }, setAnswerHook: e => { qc(e.html), qc1(e.html); }, setAnswer: e => (e.ques.options, "11" !== e.type || (e.ques.$options.each(((t, n) => { var a, i, s; const r = null == (a = e.ques.options) ? void 0 : a[0], o = null == (i = e.ques.options) ? void 0 : i[1], l = null == (s = e.answer) ? void 0 : s[null == r ? void 0 : r[t]], c = Array.isArray(o) ? o.indexOf(l) : -1; if (c < 0) return void (null == r || r[t]); const u = String.fromCharCode(c + 65); let p = se.$(n).find(".dept_select"); p.val(u).trigger("change"), p.chosen().val(u).trigger("chosen:updated"); })), e.answer, false)) } ], extractZhihuishuExamQuestions = e => (e => { var t, n, a; return (null == (n = null == (t = null == e ? void 0 : e.rt) ? void 0 : t.examBase) ? void 0 : n.workExamParts) || (null == (a = null == e ? void 0 : e.examBase) ? void 0 : a.workExamParts) || (null == e ? void 0 : e.workExamParts) || []; })(e).flatMap((e => e.questionDtos || [])).filter((e => Boolean(e))), it = [ { type: "ask", name: "\u667a\u6167\u6811\u7ae0\u8282", tips: "\u667a\u6167\u6811\u5fc5\u987b\u5f00\u81ea\u52a8\u8df3\u8f6c\uff0c\u5426\u5219\u7b54\u6848\u53ef\u80fd\u65e0\u6cd5\u4fdd\u5b58\u5bfc\u81f4\u4f4e\u5206\uff01", match: () => location.href.includes("zhihuishu.com") && !location.href.includes("checkHomework") && location.host.includes("zhihuishu") && ("/stuExamWeb.html" === location.pathname || location.href.includes("/webExamList/dohomework/") || location.href.includes("/webExamList/doexamination/")), types: [ "0", "1", "2", "3" ], question: { html: ".examPaper_box > div:eq(1) >div:not(.examPaper_partTit)", question: ".subject_describe.dynamic-fonts:eq(0) div:eq(0)", options: ".subject_node .nodeLab .label.clearfix .node_detail", type: ".subject_type span:first-child", workType: "zhs", pageType: "zhs" }, init: async () => { await waitUntil((function() { return !O(".yidun_popup").hasClass("yidun_popup--light") && extractZhihuishuExamQuestions(se.zhsques).length > 0; })); }, next: () => { O(".switch-btn-box button:eq(1)").click(); }, questionHook: (e, t) => { const n = extractZhihuishuExamQuestions(se.zhsques)[t]; if (!n) return e; const a = (e => { var t; const n = typeConvert((null == (t = e.questionType) ? void 0 : t.name) || e.questionTypeName || e.typeName || ""), a = e.questionOptions || e.options || [], i = "3" === n ? [] : removeStartChar(a.map((e => removeHtml(e.content || "")))); return { question: removeHtml(e.name || e.questionStem || e.questionName || ""), type: n, options: i }; })(n); return e.type = a.type, e.question = a.question, e.options = a.options, e; } }, { type: "save", name: "\u667a\u6167\u6811\u4f5c\u4e1a\u6536\u5f55", match: () => location.href.includes("zhihuishu.com") && location.href.includes("checkHomework") && location.host.includes("zhihuishu") && ("/stuExamWeb.html" === location.pathname || location.href.includes("/webExamList/checkHomework/")), question: { html: ".questionType", question: ".subject_describe", options: ".examquestions-answer", type: ".newZy_TItle", workType: "zhs", pageType: "zhs" }, init: async () => { await waitUntil((function() { return O(".questionType").length > 0 && O(".questionType:eq(0)")[0].__vue__.answerImgMap; })); }, answerHook: e => { const t = O(e.html)[0].__vue__, n = t.answerData[t.data.id], a = "1" === n.isCurrent ? n.answer.split(",") : [], i = t.data, s = t.answerImgMap[t.data.id] || ""; t.answerImgMap, t.data.id, somd5(s), e.type = typeMatch(i.questionType.name); const r = []; if (e.options = i.questionOptions.map((e => (a.includes(String(e.id)) && r.push(removeHtml(e.content)), removeHtml(e.content)))), e.answer = r, "3" === e.type) { e.options = []; const t = e.answer[0]; e.answer = isTrue(t) ? [ "\u6b63\u786e" ] : isFalse(t) ? [ "\u9519\u8bef" ] : []; } return e; } }, { type: "save", name: "\u667a\u6167\u6811\u8003\u8bd5\u6536\u5f55", match: () => location.href.includes("zhihuishu.com") && location.href.includes("/atHomeworkExam/stu/examQ/doExamnew"), question: { html: ".subjecttype-div.clearfloat", question: ".subjectTitle-p", options: ".TitleOptions-div label", type: ".subjecttopic-div", workType: "zhs", pageType: "zhs" }, init: async () => { await waitUntil((function() { return O(".subjecttype-div.clearfloat").length > 0; })); }, answerHook: e => { const t = O(e.html).find(".Referenceanswer-div.clearFloat>.Referenceanswer-r.fl").text(); return e.question = removeHtml(e.question), e.options = removeStartChar(e.options), e.type = typeMatch(O(e.html).find(".subjecttopic-div").text()), e.answer = t.split("").map((t => e.options[t.charCodeAt(0) - 65])), "3" == e.type && (e.options = [], e.answer = isTrue(e.answer[0]) ? [ "\u6b63\u786e" ] : isFalse(e.answer[0]) ? [ "\u9519\u8bef" ] : []), e; } } ], st = [ { type: "hook", name: "\u82af\u4f4d\u6559\u80b2hook", match: "www.beeline-ai.com" === location.host, main: async e => { const getPageIdentifier = () => O(".el-main > div:eq(0)").attr("class"); se.mainClass = getPageIdentifier(); const t = new MutationObserver((async e => { const n = getPageIdentifier(); se.mainClass !== n && (se.mainClass = n, "homework-detail-container" === n && await waitUntil((() => 0 === O(".el-loading-mask").length)), vuePageChange(), t.disconnect()); for (const a of e) if ("attributes" === a.type && "class" === a.attributeName) { const e = a.target.textContent; if (e && (e.includes("\u4e0b\u4e00\u9898") || e.includes("\u4e0a\u4e00\u9898"))) { vuePageChange(), t.disconnect(); break; } } })); O("body").length >= 1 && t.observe(O("body")[0], { subtree: true, attributes: true, childList: true }); } }, { type: "ask", name: "\u82af\u4f4d\u6559\u80b2\u4f5c\u4e1a", tips: "\u82af\u4f4d\u6559\u80b2\u4ec5\u652f\u6301\u9009\u62e9\u5224\u65ad\uff0c\u5176\u4ed6\u9898\u578b\u5f85\u9002\u914d", match: () => "www.beeline-ai.com" === location.host && (/student\/#\/courseInfo\/[A-Za-z0-9]+\/homework/i.test(location.href) || /student\/#\/courseInfo\/[A-Za-z0-9]+\/exam/i.test(location.href)), types: [ "0", "1", "3" ], question: { html: ".content-area > div.content", question: ".content", options: ".el-radio-group label .label,.el-checkbox-group label .label", type: ".question-box .tag", workType: "xinwei", pageType: "xinwei" }, init: async () => { await waitUntil((function() { return 0 !== O(".question-box").length; })); }, next: () => { O('.toggle-box > button:contains("\u4e0b\u4e00\u9898")').click(); }, ischecked: isParentChecked, questionHook: e => (e.type = typeMatch(O(e.html).find(".question-box>.tag").text()), e) }, { type: "save", name: "\u82af\u4f4d\u6559\u80b2\u6536\u5f55", match: () => "www.beeline-ai.com" === location.host && location.href.includes("/homeworkDetailPage"), question: { html: ".question-content-body", question: ".topic-title", options: ".el-radio-group label .label,.el-checkbox-group label .label", type: ".question-box .tag", workType: "xinwei", pageType: "xinwei" }, init: async () => { await waitUntil((function() { return 0 !== O(".question-content-body").length; })); }, answerHook: e => { e.type = typeMatch(O(e.html).find(".question-box>.tag").text()); let t = O(e.html).find(".answer-area > span:eq(1)").text(); switch (e.type) { case "0": case "1": let n = t.split(","); if (e.answer = n.map((t => e.options[t.charCodeAt(0) - 65])), 0 === e.answer.length) return; break; case "3": "T" == t && (e.answer = [ "\u6b63\u786e" ]), "F" == t && (e.answer = [ "\u9519\u8bef" ]); } return e; } } ], mergeMoodleReviewQuestionContext = (e, t) => { const n = e.trim(), a = t.trim(); return n && /^[\uff08(]\d+(?:\.\d+)*[)\uff09]/.test(a) ? `${n}\n${a}` : a; }, rt = { single_selection: "\u5355\u9009\u9898", multiple_selection: "\u591a\u9009\u9898", true_or_false: "\u5224\u65ad\u9898", fill_in_blank: "\u586b\u7a7a\u9898", short_answer: "\u7b80\u7b54\u9898", text: "\u6587\u672c", analysis: "\u7efc\u5408\u9898", matching: "\u5339\u914d\u9898", random: "\u968f\u673a\u9898", cloze: "\u5b8c\u5f62\u586b\u7a7a\u9898" }, buildAnalysisSubQuestion = e => { if (!e || "text" === e.type || "analysis" === e.type) return null; const t = parseFloat(e.point), n = parseFloat(e.score), a = 0 !== t && t === n; let i = false, s = []; if (e.correctOptions && e.correctOptions.length > 0 && (s = e.correctOptions.map((e => removeHtml(e.content))), i = true), e.correct_answers && e.correct_answers.length > 0 && (s = e.correct_answers.map((e => e.content)), i = true), !i && !a) return null; if (!i) if ("single_selection" === e.type || "multiple_selection" === e.type || "true_or_false" === e.type) { if (s = (e.options || []).filter((e => e.isChosen)).map((e => removeHtml(e.content))), 0 === s.length) return null; } else { if ("fill_in_blank" !== e.type) return null; if (s = (e.answers || []).map((e => e.content)), 0 === s.length) return null; } const r = O(`
    ${e.description || ""}
    `).clone(); r.find("span.__blank__").remove(); const o = removeHtml(r.html()); let l = (e.options || []).map((e => removeHtml(e.content))); const c = typeConvert(rt[e.type]); return "true_or_false" === e.type && (s = judgeAnswer(s[0]), l = [], 0 === s.length) ? null : { type: c, question: o, options: l, answer: s }; }, ot = [ { type: "hook", name: "\u56fd\u5f00hook", match: location.host.includes("ouchn.cn"), main: e => { observeVuePageChange(O("body")[0], getUrl, { beforeChange: async e => { "homework-detail-container" === e && await waitUntil((function() { return 0 !== O(".selectDan").length; })); } }); } }, { type: "save", name: "\u56fd\u5f00\u7b54\u6848\u6536\u5f55\u65e7", match: () => /\/exam\/([0-9]+)\/subjects#\/submission\/([0-9]+)/i.test(location.href), question: { html: "li.subject", question: ".summary-title .subject-description", options: ".subject-options li .option-content", type: ".subject-point > span:eq(0)", workType: "guokai", pageType: "guokai" }, init: async () => { await waitUntil((function() { return O(".loading-gif").hasClass("ng-hide"); })); }, answerHook: e => { const t = se.angular.element(e.html).scope().subject; if ("text" === t.type) return; if ("analysis" === t.type) { const n = (t.sub_subjects || []).map(buildAnalysisSubQuestion).filter(Boolean); if (0 === n.length) return; const a = O(`
    ${t.description || ""}
    `).clone(); return a.find("span.__blank__").remove(), e.question = removeHtml(a.html()), e.type = "15", e.options = n.map((e => ({ type: e.type, question: e.question, options: e.options }))), e.answer = n.map((e => e.answer)), e; } let n = false; const a = parseFloat(t.point), i = parseFloat(t.score), s = 0 !== a && a === i; let r = O(`
    ${t.description}
    `).clone(); if (r.find("span.__blank__").remove(), e.question = removeHtml(r.html()), e.options = t.options.map((e => removeHtml(e.content))), e.type = typeConvert(rt[t.type]), t.correctOptions && t.correctOptions.length > 0 && (e.answer = t.correctOptions.map((e => removeHtml(e.content))), n = true), t.correct_answers && t.correct_answers.length > 0 && (e.answer = t.correct_answers.map((e => e.content)), n = true), n || s) { switch (t.type) { case "single_selection": case "multiple_selection": case "true_or_false": if (n) "true_or_false" === t.type && (e.answer = judgeAnswer(e.answer[0]), e.options = []); else { if (t.options, e.answer = t.options.filter((e => e.isChosen)).map((e => removeHtml(e.content))), 0 === e.answer.length) return; "true_or_false" === t.type && (e.answer = judgeAnswer(e.answer[0]), e.options = []); } break; case "analysis": break; case "cloze": t.sub_subjects, e.options = t.sub_subjects.map((e => e.options.map((e => removeHtml(e.content))))); break; case "fill_in_blank": n || (e.answer = t.answers.map((e => e.content))); } return e; } }, paper: e => { const t = se.globalData.course, n = se.angular.element(O("body")).scope(), a = se.angular.element(O(".hd")).scope().exam, i = n.submissionData.id; if (!n.examSubmissions.find((e => (e.id, String(e.id) === String(i))))) return; const s = { platform: "guokai" }; s.hash = t.id, s.name = t.name, s.info = {}, s.info.school = t.orgName, s.chapter = [ { hash: `${a.id}`, name: a.title, question: e } ], Xe.setPaper(s.hash, s); } }, { type: "save", name: "\u5e7f\u5f00\u7b54\u6848\u6536\u5f55", match: () => /mod\/quiz\/review\.php/i.test(location.pathname), question: { html: ".que", question: ".qtext", options: ".answer > div", type: "", answer: ".rightanswer", workType: "ougd", pageType: "ougd" }, init: async () => { O(".specificfeedback").remove(); }, next: async () => { !O(".qn_buttons > a").last().hasClass("thispage") && O(".arrow_text").click(); }, answerHook: e => { e.preserveImageHtml = true; const t = O(e.html).find(".info .state").text(); e.type = (O(e.html).attr("class") || "").split(" ")[1], O(e.html).find(".qtext .accesshide").remove(), e.question = removeHtml(O(e.html).find(".qtext").html()); const n = removeHtml(O(e.html).prevAll(".que.description").first().find(".qtext").html() || ""); if (e.question = mergeMoodleReviewQuestionContext(n, e.question), e.question.includes("egg")) { let t = O(e.html).clone(); t.find("img").each((function() { var e; (null == (e = O(this).attr("src")) ? void 0 : e.includes("egg")) && O(this).remove(); })), e.question = removeHtml(t.find(".qtext").html()), e.question = mergeMoodleReviewQuestionContext(n, e.question); } switch (e.type, e.type) { case "truefalse": e.type = "3", e.$options = O(e.html).find("input[type=radio]"), e.options = O(e.html).find(".answer > div").map(((e, t) => removeHtml(O(t).html()).trim())).get(), e.answer = [], e.answer = O(e.html).find(".answer > div").map(((t, n) => e.$options.eq(t).prop("checked") ? e.options[t] : "")).get(), e.answer = e.answer.filter((e => "" !== e)), 0 === e.answer.length ? (e.temp = removeHtml(O(e.html).find(".rightanswer").html()).replace("\u6b63\u786e\u7b54\u6848\u662f", "").trim(), e.answer = [ e.temp ]) : t.includes("\u6b63\u786e") || (e.answer = e.options.filter((t => !t.includes(e.answer[0])))), isTrue(e.answer[0]) ? e.answer = [ "\u6b63\u786e" ] : isFalse(e.answer[0]) ? e.answer = [ "\u9519\u8bef" ] : e.answer = [], e.options = []; break; case "multichoice": case "multichoiceset": if (e.type = "1", e.$options = O(e.html).find("input[type=checkbox]"), 0 === e.$options.length && (e.type = "0", e.$options = O(e.html).find("input[type=radio]")), e.options = O(e.html).find(".answer > div").map(((e, t) => { let n = O(t).find(".answernumber").text().trim(), a = removeHtml(O(t).html()); return "" === n ? a.trim() : removeKnownOptionPrefix(a, n); })).get(), t.includes("\u6b63\u786e") && !t.includes("\u90e8\u5206\u6b63\u786e")) e.answer = [], e.answer = O(e.html).find(".answer > div").map(((t, n) => { let a = O(n).find(".answernumber").text().trim(), i = removeHtml(O(n).html()); return e.$options.eq(t).prop("checked") && O(n).find(".text-success").length > 0 ? "" === a ? i.trim() : removeKnownOptionPrefix(i, a) : ""; })).get(), e.answer = e.answer.filter((e => "" !== e)); else { e.temp = removeHtml(O(e.html).find(".rightanswer").html(), false).replace("\u6b63\u786e\u7b54\u6848\u662f\uff1a", "").trim(); const t = e.options.slice(0); t.sort(((e, t) => t.length - e.length)), e.answer = t.map((t => e.temp.includes(t) ? (e.temp = e.temp.replace(t, ""), t) : "")), e.answer = e.answer.filter((e => "" !== e)), e.answer.length; } break; case "shortanswer": e.type = "4", e.$options = O(e.html).find("input[type=text]"), e.answer = removeHtml(O(e.html).find(".rightanswer").html()).replace("\u6b63\u786e\u7b54\u6848\uff1a", "").trim(); break; case "match": e.type = "24", e.match = O(".answer tr td.text").map(((e, t) => removeHtml(O(t).html()))).get(), e.$options = O(".answer tr td.control select"), e.selects = O(".answer tr td.control select").map(((e, t) => [ O(t).find("option").map(((e, t) => ({ value: O(t).val(), text: O(t).text() }))).get() ])).get(); break; case "multianswer": e.type = "14"; let n = O(e.html).find(".formulation").clone(); n.find(".subquestion").remove(), n.find(".accesshide").remove(), e.question = removeHtml(n.html()); let a = [], i = []; O(e.html).find(".subquestion").map(((e, t) => { let n = O(t).find("select>option").map(((e, t) => removeHtml(O(t).html()))).get(); n = n.filter((e => "" !== e)), a.push(n); let s = O(t).find("select>option:selected").map(((e, t) => removeHtml(O(t).html()))).get(); i.push(s[0]); })), e.options = a; O(e.html).find(".text-success").length == e.options.length && (e.answer = i); break; case "description": return; } return e; }, paper: async e => { var t; const n = { platform: "ougd" }, a = se.document.body.outerHTML, i = ((e, t = {}) => { const n = String(t.courseId ?? t.courseid ?? "").trim(); return (/^\d+$/.test(n) ? n : "") || (e.match(new RegExp("(?:[\"']courseId[\"']|(? { try { const e = new URL(t).searchParams.get("cmid"); if (e) return e; } catch (n) {} return (e.match(/[?&]cmid=(\d+)/i) || [])[1] || (e.match(/\/mod\/quiz\/view\.php\?id=(\d+)/i) || [])[1] || ""; })(a, se.location.href); n.hash = i.trim(), "" !== n.hash && "" !== s && (n.info = {}, n.name = ((e, t) => { if (!t) return ""; const n = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), a = new RegExp(`]*href=["'][^"']*/course/view\\.php\\?id=${n}(?:[&#][^"']*)?["'][^>]*>([\\s\\S]*?)`, "i"); return (e => e.replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim())((e.match(a) || [])[1] || ""); })(a, i) || O("h1").text().trim() || se.document.title.trim(), n.chapter = [ { hash: `${s}`, name: se.document.title.trim(), question: e } ], Xe.setPaper(n.hash, n, { replaceQuestions: true })); } }, { type: "ask", name: "\u5e7f\u5f00\u5f62\u8003", tips: "\u5e7f\u5f00\u4ec5\u652f\u6301\u57fa\u7840\u9898\u578b\uff0c\u7279\u6b8a\u9898\u578b\u8bf7\u624b\u52a8\u5b8c\u6210", match: () => /mod\/quiz\/attempt\.php/i.test(location.pathname), types: [ "0", "1", "2", "3", "4", "5", "6", "7", "9", "14", "24" ], question: { html: ".que", question: ".qtext", options: ".answer > div", type: "", workType: "ougd", pageType: "ougd" }, ischecked: e => Boolean(e.prop("checked")), questionHook: e => { e.preserveImageHtml = true, e.type = (O(e.html).attr("class") || "").split(" ")[1], O(e.html).find(".qtext .accesshide").remove(), e.question = removeHtml(O(e.html).find(".qtext").html()); const t = removeHtml(O(e.html).prevAll(".que.description").first().find(".qtext").html() || ""); if (e.question = mergeMoodleReviewQuestionContext(t, e.question), e.question.includes("egg")) { let n = O(e.html).clone(); n.find("img").each((function() { var e; (null == (e = O(this).attr("src")) ? void 0 : e.includes("egg")) && O(this).remove(); })), e.question = removeHtml(n.find(".qtext").html()), e.question = mergeMoodleReviewQuestionContext(t, e.question); } switch (e.type) { case "truefalse": e.type = "3", e.$options = O(e.html).find("input[type=radio]"), e.options = []; break; case "multichoice": case "multichoiceset": e.type = "1", e.$options = O(e.html).find("input[type=checkbox]"), 0 === e.$options.length && (e.type = "0", e.$options = O(e.html).find("input[type=radio]")), e.options = O(e.html).find(".answer > div").map(((e, t) => { let n = O(t).find(".answernumber").text().trim(), a = removeHtml(O(t).html()); return "" === n ? a.trim() : removeKnownOptionPrefix(a, n); })).get(); break; case "shortanswer": e.type = "4", e.$options = O(e.html).find("input[type=text]"); break; case "match": e.type = "24", e.match = O(".answer tr td.text").map(((e, t) => removeHtml(O(t).html()))).get(), e.$options = O(".answer tr td.control select"), e.selects = O(".answer tr td.control select").map(((e, t) => [ O(t).find("option").map(((e, t) => ({ value: O(t).val(), text: O(t).text() }))).get() ])).get(); case "essay": e.type = "4", e.$options = O(e.html).find("iframe"); break; case "multianswer": e.type = "14"; let t = O(e.html).find(".formulation").clone(); t.find(".subquestion").remove(), t.find(".accesshide").remove(), e.question = removeHtml(t.html()); let n = []; O(e.html).find(".subquestion").map(((e, t) => { let a = O(t).find("select>option").map(((e, t) => removeHtml(O(t).html()))).get(); a = a.filter((e => "" !== e)), n.push(a), O(t).find("select>option:selected").map(((e, t) => removeHtml(O(t).html()))).get(); })), e.$options = O(e.html).find("select"), e.options = n; break; case "description": return; } return e; }, setAnswer: e => { switch (e.type) { case "4": return O(e.html).find("input.form-control").each((function(t, n) { O(n).val(e.answer[t]); })), O(e.html).find("iframe:eq(0)").contents().find("body").html(e.answer[0]), false; case "3": e.ques.$options.each(((t, n) => { const a = O(n).parent().find("label").text(); return "object" == typeof e.answer && (e.answer = e.answer[0]), isTrue(e.answer) && isTrue(a) ? (O(n).click(), false) : !isFalse(e.answer) || !isFalse(a) || (O(n).click(), false); })); case "14": return O(e.html).find("select").each(((t, n) => { const a = e.answer[t]; O(n).find(`option:contains("${a}")`).prop("selected", true); })), false; default: return true; } }, finish: e => { O(".submitbtns .btn-primary").click(); } }, { type: "ask", name: "\u56fd\u5f00\u4e13\u9898\u6d4b\u9a8c", match: () => /\/exam\/([0-9]+)\/subjects/i.test(location.pathname) && !/\/exam\/([0-9]+)\/subjects#\/submission\/([0-9]+)/i.test(location.href), types: [ "0", "1", "2", "3", "4", "5", "6", "7", "9", "14", "15", "24" ], question: { html: "li.subject", question: ".summary-title .subject-description", options: ".subject-options li .option-content", type: ".summary-sub-title span:eq(0)", workType: "guokai", pageType: "guokai" }, init: async () => { await waitUntil((function() { return O(".loading-gif").hasClass("ng-hide") && "" === O(".hd .examinee .submit-label").eq(0).text(); })), await waitUntil((function() { return 0 !== O("li.subject").length; })); }, ischecked: e => Boolean(e.parent().find("input").eq(-1).prop("checked")), questionHook: e => { const t = se.angular.element(e.html).scope(), n = t.subject; if ("text" === n.type) return; if ("analysis" === n.type) { const a = O(`
    ${n.description || ""}
    `).clone(); return a.find("span.__blank__").remove(), e.question = removeHtml(a.html()), e.type = "15", e.options = (n.sub_subjects || []).map((e => { const t = typeConvert(rt[e.type]), n = (e.options || []).map((e => removeHtml(e.content))), a = O(`
    ${e.description || ""}
    `).clone(); return a.find("span.__blank__").remove(), { type: t, question: removeHtml(a.html()), options: "true_or_false" === e.type ? [] : n }; })), e.$options = null, e.subject = n, e.scope = t, e; } e.type = typeConvert(rt[n.type]); let a = O(`
    ${n.description}
    `).clone(); switch (a.find("span.__blank__").remove(), e.question = removeHtml(a.html()), n.options = n.options.sort(((e, t) => e.sort - t.sort)), e.options = n.options.map((e => removeHtml(e.content))), e.type, n.type, n.type) { case "cloze": e.options = n.sub_subjects.map((e => e.options.map((e => removeHtml(e.content))))), e.$options = O(e.html).find("select"); case "true_or_false": e.options = []; } return e.subject = n, e.scope = t, e; }, setAnswer: e => { switch (e.ques, e.type) { case "2": return O(e.html).find(".___answer"), O(e.html).find(".___answer").each(((t, n) => { O(n).html(e.answer[t]), e.ques.scope.subject.answers[t].content = e.answer[t], e.ques.scope.onChangeSubmission(e.ques.subject); })), false; case "4": return O(e.html).find(".simditor-body.needsclick>p").each((function(t, n) { O(n).html(e.answer[t]), e.ques.subject.answered_content = e.answer[t]; })), e.ques.scope.onChangeSubmission(e.ques.subject), false; case "14": return e.ques.subject.sub_subjects.forEach(((t, n) => { let a = e.answer[n]; t.options.forEach(((i, s) => { i.content === a && (t.answeredOption = String(i.id), e.ques.scope.onChangeSubmission(t), O(e.html).find(`input[value="${i.id}"]`).click(), O(e.html).find(`button:eq(${n})>span:eq(1)`).text(a)); })); })), false; case "15": return e.ques.subject.sub_subjects.forEach(((t, n) => { const a = e.answer[n]; if (!a || 0 === a.length) return; const i = a[0], s = (t.options || []).find(((e, n) => { const a = removeHtml(e.content); return "number" == typeof i ? n === i : "true_or_false" === t.type ? isTrue(i) && isTrue(a) || isFalse(i) && isFalse(a) : a === i; })); s && (t.answeredOption = String(s.id), e.ques.scope.onChangeSubmission(t), O(e.html).find(`input[value="${s.id}"]`).click()); })), false; } return true; } }, { type: "save", name: "\u4e0a\u6d77\u5f00\u653e\u6536\u5f55", match: () => "l.shou.org.cn" === location.host && location.href.includes("assignment/history.aspx?homeWorkId"), question: { html: ".e-q-body", question: ".ErichText", options: "ul>li>.ErichText", type: ".question-box .tag", workType: "shou", pageType: "shou" }, init: async () => {}, answerHook: e => { e.$options = O(e.html).find("ul>li"); let t = O(e.html).find("ul>li.checked").map(((e, t) => removeHtml(O(t).find(".ErichText").html() || O(t).html()))).get(); const n = O(e.html).find(".e-q-right").length > 0; e.answer = t.filter((e => "" !== e)); let a = O(e.html).find(".e-ans-ref .e-ans-r").map(((e, t) => removeHtml(O(t).html()))).get().map((t => { let n = t.charCodeAt() - 65; return e.options[n]; })).filter((e => "" !== e && void 0 !== e)); switch (e.options = removeStartChar(e.options), O(e.html).attr("data-questiontype")) { case "2": e.type = "1"; break; case "1": e.type = "0"; break; case "3": e.type = "3", e.answer = O(e.html).find("ul>li.checked").map(((e, t) => removeHtml(O(t).html()))).get(), e.options = [], isTrue(e.answer[0]) ? e.answer = [ "\u6b63\u786e" ] : isFalse(e.answer[0]) ? e.answer = [ "\u9519\u8bef" ] : e.answer = []; break; case "8": e.type = "15"; const t = O(e.html).find(".e-q-quest form").map(((e, t) => { let n = removeHtml(O(t).find(".e-q-q .ErichText").html()), a = O(t).find("ul>li").map(((e, t) => removeHtml(O(t).find(".ErichText").html() || O(t).html()))).get(), i = "0"; a = removeStartChar(a); const s = O(t).find(".e-a-right").length > 0, r = O(t).find(".e-ans-ref .e-ans-r").map(((e, t) => removeHtml(O(t).html()))).get(); let o = r.map((e => { let t = e.charCodeAt() - 65; return a[t]; })).filter((e => "" !== e && void 0 !== e)); if (2 === a.length && 1 === r.length) { let e = judgeAnswer(r[0]); e.length > 0 && (o = e, a = [], i = "3"); } return o.length > 1 && (i = "1"), { question: n, options: a, answer: o, isT: s, type: i }; })).get(); if (t.some((e => !e.isT))) return; a = t.map((e => e.answer)).flat(), e.options = t.map((e => ({ question: e.question, options: e.options, type: e.type }))); break; case "11": e.type = "19"; const n = O(e.html).find("form").map(((e, t) => ({ type: "0", question: removeHtml(O(t).find(".e-q-q .ErichText").html()), options: O(t).find("ul li .ErichText").map(((e, t) => removeHtml(O(t).html()))).get() }))).get(); a = a.length > 0 ? judgeAnswer(a[0]) : [], e.options = n; break; default: return void O(e.html).attr("data-questiontype"); } return a.length > 0 ? (e.answer = a, e) : !n && "3" === e.type && e.answer.length > 0 || !n ? void 0 : e; }, paper: async e => { const t = { platform: "shou" }, n = O("input[name=CourseOpenId]").val(), a = O("input[name=WorkId]").val(); await request("https://l.shou.org.cn/student/CourseScoreNew-inside.aspx", "GET").then((e => { const a = O(e[0].responseText); t.name = a.find(`#courseSelect>option[data-xid="${n}"]`).text().trim(), t.info = {}; })), t.hash = n, t.info = {}, t.chapter = [ { hash: `${a}`, name: O(".mark_title").text().trim(), question: e } ], Xe.setPaper(t.hash, t); } }, { type: "ask", name: "\u4e0a\u6d77\u5f00\u653e\u4f5c\u4e1a", tips: "", match: () => "l.shou.org.cn" === location.host && (location.href.includes("assignment/preview.aspx?homeWorkId") || location.href.includes("study/assignment/continuation.aspx")), types: [ "0", "1", "3" ], question: { html: ".e-q-body", question: ".ErichText", options: "ul>li>.ErichText", type: ".question-box .tag", workType: "shou", pageType: "shou" }, init: async () => { await waitUntil((function() { return 0 !== O(".e-q-body").length; })); }, ischecked: isParentChecked, questionHook: e => { switch (O(e.html).attr("data-questiontype")) { case "2": e.type = "1"; break; case "1": e.type = "0"; break; case "3": e.type = "3", e.$options = O(e.html).find("ul>li"); break; case "8": e.type = "15", e.quesList = O(e.html).find("form").map(((e, t) => ({ type: "0", question: removeHtml(O(t).find(".e-q-q .ErichText").html()), options: O(t).find("ul li .ErichText").map(((e, t) => removeHtml(O(t).html()))).get() }))).get(); break; default: return void O(e.html).attr("data-questiontype"); } return e; } } ], lt = [ { type: "ask", name: "\u6210\u6559\u4e91\u8003\u8bd5", tips: "", match: () => location.href.includes("student/exam/resource/paper_card"), types: [ "0", "1", "3" ], question: { html: ".ui-question", question: ".ui-question-content-wrapper", options: ".ui-question-options li .ui-question-content-wrapper", type: ".ui-question-group-title", workType: "chengjiaoyun", pageType: "chengjiaoyun" }, init: async () => { if (await waitUntil((function() { return isExist(".ui-question"); })), !se.top.location.href.includes("student/exam2/doexam")) return false; }, toquestion: async e => { O(se.top.document).find(".ui-card-questions ul li:eq(" + e + ")").click(); }, next: async () => { O("#next-btn").click(); }, ischecked: e => e.hasClass("ui-option-selected"), questionHook: e => { if (e.type = typeMatch(O(e.html).parent().find(".ui-question-group-title").text()), e.$options = O(e.html).find(".ui-question-options li>span"), "3" === e.type) e.options = []; return e; }, setAnswer: e => { if ("3" === e.type) { let t = e.answer; return e.ques.$options.each(((e, n) => { isTrue(t) && isTrue(removeHtml(O(n).parent().html())) && O(n).click(), isFalse(t) && isFalse(removeHtml(O(n).parent().html())) && O(n).click(); })), false; } return true; } }, { type: "save", name: "\u6210\u6559\u4e91\u6536\u5f55", match: () => location.href.includes("student/exam/resource/paper_card"), question: { html: ".ui-question", question: ".ui-question-content-wrapper", options: ".ui-question-options li .ui-question-content-wrapper", type: ".ui-question-group-title", workType: "chengjiaoyun", pageType: "chengjiaoyun" }, init: async () => { if (await waitUntil((function() { return isExist(".ui-question"); })), se.top.location.href.includes("student/exam2/doexam")) return false; }, answerHook: e => { if (e.type = typeMatch(O(e.html).parent().find(".ui-question-group-title").text()), e.$options = O(e.html).find(".ui-question-options li>span"), e.answer = O(e.html).find(".ui-question-options li.ui-correct-answer .ui-question-content-wrapper").map(((e, t) => removeHtml(O(t).html()))).get(), "3" === e.type) e.options = [], e.answer = isTrue(e.answer[0]) ? [ "\u6b63\u786e" ] : isFalse(e.answer[0]) ? [ "\u9519\u8bef" ] : []; return e; } } ]; const ct = [ { type: "hook", name: "hook", match: () => "xuexi.jsou.cn" === location.host && location.href.includes("newHomework/showHomeworkByStatus") && location.href.includes("checked=true"), main: e => { se.mainClass = O("#homeworkHistory").find(".active").attr("id"); let t = new MutationObserver((async e => { se.mainClass !== O("#homeworkHistory").find(".active").attr("id") && (se.mainClass = O("#homeworkHistory").find(".active").attr("id"), await waitUntil((function() { return 0 === O(".layui-layer-shade").length; })), vuePageChange(), t.disconnect()); for (let n of e) "attributes" === n.type && "class" === n.attributeName && n.target.textContent && (n.target.textContent.includes("\u4e0b\u4e00\u9898") || n.target.textContent.includes("\u4e0a\u4e00\u9898")) && (t.disconnect(), vuePageChange()); })); O("body").length >= 1 && t.observe(O("body")[0], { subtree: true, attributes: true, childList: true }); } }, { type: "ask", name: "\u6c5f\u82cf\u5f00\u653e\u5927\u5b66\u7b54\u9898", tips: "", match: () => "xuexi.jsou.cn" === location.host && location.href.includes("/showHomeworkByStatus") && location.href.includes("checked=false"), types: [ "0", "1", "2", "3" ], question: { html: ".insert", question: ".window-title", options: ".questionId-option li > div:not(.numberCover)", type: ".questionDiv >div:eq(0)", workType: "jsou", pageType: "jsou" }, init: async () => { document.addEventListener("copy", (function(e) { e.stopImmediatePropagation(), layer.msg("\u590d\u5236\u6210\u529f", { icon: 4 }), e.clipboardData.setData("text/plain", window.getSelection().toString()); })), document.addEventListener("paste", (() => { event.stopImmediatePropagation(); let e = (event.clipboardData || window.clipboardData).getData("text"); layer.msg("\u7c98\u8d34\u6210\u529f", { icon: 4 }), document.execCommand("insertText", false, e); })); }, ischecked: function(e) { if (!e) return false; const hasSelectedClass = e => !(!(null == e ? void 0 : e.length) || "function" != typeof e.hasClass || !e.hasClass("is-checked") && !e.hasClass("answer-title")); if (hasSelectedClass(e)) return true; if (hasSelectedClass("function" == typeof e.closest ? e.closest(".default-option, li") : null)) return true; const t = "function" == typeof e.parent ? e.parent() : null; return !!hasSelectedClass(t) || hasSelectedClass("function" == typeof (null == t ? void 0 : t.parent) ? t.parent() : null); }, questionHook: e => (e.type = O(e.html).find(".questionDiv >div:eq(1)").text().trim(), e.type = typeConvert(e.type), e.$options = O(e.html).find(".questionId-option li .numberCover"), "3" == e.type && (e.options = []), e), setAnswer: e => { switch (e.type) { case "2": if (e.$options = O(e.html).find(".questionTitle input"), e.$options.length == e.answer.length) return e.$options.each(((t, n) => { O(n).val(e.answer[t]); })), false; break; case "3": let t = e.answer; return O(e.html).find(".questionId-option>.default-option").each(((e, n) => { isTrue(t) && isTrue(removeHtml(O(n).find(".option-title>div:eq(1)").html())) && O(n).find("div.numberCover").click(), isFalse(t) && isFalse(removeHtml(O(n).find(".option-title>div:eq(1)").html())) && O(n).find("div.numberCover").click(); })), false; case "4": const n = O(e.html).find(".jianda-answer>div").attr("id"); return se.UE.getEditor(`${n}`).setContent(e.answer), false; } return true; } }, { type: "save", name: "\u6c5f\u82cf\u5f00\u653e\u5927\u5b66\u6536\u5f55", match: () => "xuexi.jsou.cn" === location.host && location.href.includes("newHomework/showHomeworkByStatus") && location.href.includes("checked=true"), question: { html: ".insert", question: ".window-title", options: "#questionId-option li > div:not(.numberCover)", type: ".questionDiv >div:eq(0)", workType: "jsou", pageType: "jsou" }, init: async () => {}, answerHook: e => { const t = O(e.html).find(".questionDiv >div").text(), n = t.match(/\u5206\u503c(\d+)\u5206/), a = t.match(/\u5f97\u5206\uff1a(\d+)/); if (!n || !a) return null; e.type = typeConvert(O(e.html).find(".questionDiv >div:eq(1)").text()); if (!(n[1] === a[1] && "0" !== a[1]) && "3" !== e.type) return null; switch (e.type) { case "0": case "1": case "3": if (e.answer = O(e.html).find(".answer .correctAnswer").text().trim().split("\uff1b").map((t => e.options[t.charCodeAt(0) - 65])), e.answer = e.answer.filter((e => e)), 0 == e.answer.length && (e.answer = O(e.html).find(".answer .studentAnswer").text().trim().split("\uff1b").map((t => e.options[t.charCodeAt(0) - 65]))), e.answer = e.answer.filter((e => e)), 3 == e.type) { e.options = []; let t = e.answer[0]; if (isFalse(t)) e.answer = "\u9519\u8bef"; else { if (!isTrue(t)) return; e.answer = "\u6b63\u786e"; } } break; case "2": e.options = [], e.answer = O(e.html).find(".answer .correctAnswer").text().trim().split("\uff1b"), e.answer = e.answer.filter((e => e)), 0 == e.answer.length && (e.answer = O(e.html).find(".answer .studentAnswer").text().trim().split("\uff1b")), e.answer = e.answer.filter((e => e)); break; default: return; } return e; }, paper: e => { const t = se.homework, n = { platform: "jsou" }; n.hash = t.courseId, n.name = t.courseName, n.info = {}, n.chapter = [ { hash: `${t.homeworkId}`, name: t.title, question: e } ], Xe.setPaper(n.hash, n); } } ], parseZhijiaoyunTypeText = e => { const t = String(e ?? "").match(/\u3010(.*)\u3011/); return t ? t[1].trim().replace("\u586b\u7a7a\u9898(\u5ba2\u89c2)", "\u586b\u7a7a\u9898") : ""; }, ut = [ { type: "hook", name: "hook", match: "spoc-exam.icve.com.cn" === location.host || location.host.includes("exam.courshare.cn") || location.host.includes("webtrn.cn"), main: e => { se.mainClass = O(".q_content").first().attr("id"); let t = new MutationObserver((async e => { se.mainClass !== O(".q_content").first().attr("id") && (se.mainClass = O(".q_content").first().attr("id"), "homework-detail-container" === se.mainClass && await waitUntil((function() { return 0 !== O(".q_content").length; })), vuePageChange(), t.disconnect()); for (let n of e) "attributes" === n.type && "class" === n.attributeName && n.target.textContent && (n.target.textContent.includes("\u4e0b\u4e00\u9898") || n.target.textContent.includes("\u4e0a\u4e00\u9898")) && (t.disconnect(), vuePageChange()); })); O("#examPage").length >= 1 && t.observe(O("#examPage")[0], { subtree: true, attributes: true, childList: true }); } }, { type: "hook", name: "hook", match: "zjy2.icve.com.cn" === location.host || "zyk.icve.com.cn" === location.host || "ai.icve.com.cn" === location.host, main: e => { O(".minimized-dialog img").css({ "z-index": "999999" }); observeVuePageChange(O("#app")[0], (() => O("#app")[0].__vue__.$route.name), { beforeChange: async e => { "homework-detail-container" === e && await waitUntil((function() { return 0 !== O(".q_content").length; })); } }); } }, { type: "ask", name: "\u804c\u6559\u4e91\u4f5c\u4e1a", tips: "", match: () => location.href.includes("examflow_index.action"), types: [ "0", "2", "1", "3", "4" ], question: { html: ".q_content", question: ".divQuestionTitle", options: ".questionOptions > div", type: ".question-box .tag", workType: "zhijiaoyun", pageType: "zhijiaoyun" }, init: async () => { await waitUntil((function() { return 0 !== O(".q_content").length; })); }, finish: e => { O('.paging_next:contains("\u4e0b\u4e00\u9875")').click(); }, ischecked: e => 0 !== e.parent().find(".checkbox_on").length, questionHook: e => { var t, n; e.question = removeHtml(O(e.html).find(".divQuestionTitle").html()); let a = O(e.html).find("[name='quesId']").attr("id"), i = null == (n = null == (t = document.getElementById(`questionId[${a}]`)) ? void 0 : t.getAttribute("answertype")) ? void 0 : n.trim(), s = O(e.html).find("span[name^='questionIndex']").text().trim() + "\u3001", r = O(e.html).find(".q_score").text().trim(); var o; switch (e.question = (o = e.question.replace(s, "").replace(r, "").trim(), titleClean(String(o ?? "").replace(/\s*\u2691?\s*(?:\u6807\u8bb0\u5b58\u7591|\u53d6\u6d88\u5b58\u7591)\s*$/, "").replace(/\s*\uff08\d+(?:\.\d+)?\s*\u5206\uff09$/, "").trim())), e.options = O(e.html).find(".questionOptions>div").map(((e, t) => { let n = O(t).find(".option_index").text().trim(); return removeHtml(O(t).html()).replace(n, "").trim(); })).get(), e.$options = O(e.html).find(".questionOptions>div input"), i) { case "\u5355\u9879\u9009\u62e9\u9898": case "\u5355\u9009\u9898": case "singlechoice": e.type = "0"; break; case "\u591a\u9879\u9009\u62e9\u9898": case "\u591a\u9009\u9898": case "multichoice": e.type = "1"; break; case "\u5224\u65ad\u9898": case "bijudgement": e.type = "3", e.options = []; break; case "fillblank": e.type = "2", e.question = removeHtml(O(e.html).find("[name='fillblankTitle']").html()); break; case "cloze": e.type = "14", e.options = O(e.html).find(".questionOptions>.exam_cloze_choice").map(((e, t) => [ O(t).find(".optionContent").map(((e, t) => removeHtml(O(t).html()))).get() ])).get(); break; case "textarea": e.type = "4", e.options = []; } return e; }, setAnswer: e => { switch (e.type) { case "2": return O(e.html).find(".fillblank_input > input").each(((t, n) => { O(n).val(e.answer[t]); })), false; case "3": let t = e.answer; return e.ques.$options.each(((e, n) => { isTrue(t) && isTrue(removeHtml(O(n).parent().html())) && O(n).click(), isFalse(t) && isFalse(removeHtml(O(n).parent().html())) && O(n).click(); })), false; case "4": let n = O(e.html).find("[name='quesId']").attr("id"); return se.UE.getEditor(`_baidu_editor_${n}`).setContent(`

    ${e.answer}

    `), false; } return true; } }, { type: "save", name: "\u804c\u6559\u4e91\u6536\u5f55", match: () => location.href.includes("examrecord_recordDetail.action"), question: { html: ".q_content", question: ".divQuestionTitle", options: ".questionOptions>div.q_option_readonly", type: ".question-box .tag", workType: "zhijiaoyun", pageType: "zhijiaoyun" }, init: async () => { await waitUntil((function() { return 0 !== O(".q_content").length; })); }, answerHook: e => { const t = O(e.html).find(".exam.icon_examright").length, n = O(e.html).find("input[name='quesId']:not([id='']").attr("id"), a = O(`input#qId${n}`).attr("qtype"), i = O(e.html).find("span[name^='questionIndex']").text().trim() + "\u3001", s = O(e.html).find(".q_score").text().trim(); switch (e.question = e.question.replace(i, "").replace(s, "").trim(), e.options = O(e.html).find(".questionOptions>div.q_option_readonly").map(((e, t) => { let n = O(t).find("span[name='optionIndexName']").text().trim(); return removeHtml(O(t).html()).replace(n, "").trim(); })).get(), a) { case "\u5355\u9879\u9009\u62e9\u9898": case "\u5355\u9009\u9898": case "singlechoice": e.type = "0"; break; case "\u591a\u9879\u9009\u62e9\u9898": case "\u591a\u9009\u9898": case "multichoice": e.type = "1"; break; case "\u5224\u65ad\u9898": case "bijudgement": e.type = "3"; break; case "fillblank": case "\u586b\u7a7a\u9898": e.type = "2"; const t = O(e.html).find(".answerOption>span:eq(0)").clone(); t.find(".exam_answers").remove(), e.question = titleClean(removeHtml(t.html())).replace(/\uff08.*?\u5206\uff09/g, "").trim(); break; case "cloze": case "\u5b8c\u5f62\u586b\u7a7a": e.type = "14", e.options = O(e.html).find(".questionOptions>.exam_cloze_choice").map(((e, t) => [ O(t).find(".optionContent").map(((e, t) => removeHtml(O(t).html()))).get() ])).get(), e.answer = O(e.html).find(".exam_rightAnswer .answer_table .one_answer>span").map(((t, n) => { const a = O(n).text().trim(); return e.options[t][a.charCodeAt(0) - 65]; })).get(); break; case "textarea": e.type = "4", e.options = [], e.answer = removeHtml(O(e.html).find(".exam_rightAnswer .has_standard_answer").html()); } switch (e.type) { case "0": case "1": if (e.answer = O(e.html).find('.exam_rightAnswer .exam_answers_tit>span[name="rightAnswer"]').text().trim().split("").map((t => e.options[t.charCodeAt(0) - 65])), e.answer, 0 == e.answer.length) { if (0 == t) return; e.answer = O(e.html).find('.exam_stu_answer span[name="stuAnswer"]').text().trim().split("").map((t => e.options[t.charCodeAt(0) - 65])); } break; case "2": e.answer = 0 == t ? O(e.html).find(".exam_rightAnswer span.fillblank_answer").map(((e, t) => removeHtml(O(t).html()))).get() : O(e.html).find(".exam_stu_answer span.fillblank_answer").map(((e, t) => removeHtml(O(t).html()))).get(), e.answer; break; case "3": e.options = []; let n = O(e.html).find('.exam_stu_answer span[name="stuAnswer"]').text().trim(); [ "\u6b63\u786e", "\u9519\u8bef" ].includes(n) && t && (e.answer = [ n ]); } return e; } }, { type: "save", name: "\u667a\u6167\u804c\u6559\u6536\u5f55", match: () => "zjy2.icve.com.cn" === location.host && (location.href.includes("/spocviewsJob") || location.href.includes("/viewExam")), question: { html: ".subjectDet", question: ".seeTitle .htmlP.ql-editor", options: ".optionList .htmlP.ql-editor", type: ".question-box .tag", workType: "zhijiaoyun", pageType: "zhijiaoyun" }, init: async () => { await waitUntil((function() { return 0 !== O(".subjectDet").length; })); }, answerHook: e => { const t = O(e.html).find(".xvhao").text().trim(); e.type = typeConvert(parseZhijiaoyunTypeText(t)); let n = O(e.html).find(".answer").text().trim(); switch (e.answer = n.split(",").map((t => e.options[t.charCodeAt(0) - 65])), e.type) { case "2": e.options = [], e.answer = O(e.html).find(".answer>span").map(((e, t) => removeHtml(O(t).html()))).get(); break; case "3": e.options = O(e.html).find(".optionList>div").map(((e, t) => removeHtml(O(t).html()))).get(), e.answer = n.split(",").map((t => e.options[t.charCodeAt(0) - 65])), e.answer = judgeAnswer(e.answer[0]), e.options = []; break; case "11": const t = O(e.html).find(".optionList .matching>.htmlP.ql-editor").map(((e, t) => removeHtml(O(t).html()))).get(), a = O(e.html).find(".optionList>.text .htmlP.ql-editor").map(((e, t) => removeHtml(O(t).html()))).get(); e.options = [ t, a ]; let i = {}; n = O(e.html).find(".answer>span").map(((e, n) => { let [s, r] = O(n).text().trim().split("."); s.charCodeAt(0) >= 65 ? s = (s.charCodeAt(0) - 65).toString() : /^\d+$/.test(s) && (s = (parseInt(s) - 1).toString()), r.charCodeAt(0) >= 65 ? r = (r.charCodeAt(0) - 65).toString() : /^\d+$/.test(r) && (r = (parseInt(r) - 1).toString()), i[t[s]] = a[r]; })), e.answer = i; } return e; } }, { type: "ask", name: "\u667a\u6167\u804c\u6559+\u7b54\u9898", tips: "\u8be5\u5e73\u53f0\u95ee\u9898\u8f83\u591a\uff0c\u9047\u5230\u8bf7\u53cd\u9988\u7ed9\u4f5c\u8005", match: () => { return e = location.href, !/spockeepTestView|spocjobTestDocument/.test(e) && (e.includes("coursePreview/jobTest") || e.includes("spockeepTest") || e.includes("spocjobTest")); var e; }, types: [ "0", "1", "2", "3" ], question: { html: ".subjectDet", question: ".ql-editor", options: ".optionList .ql-editor", type: ".question-box .tag", workType: "zhijiaoyun", pageType: "zhijiaoyun" }, init: async () => { await waitUntil((function() { return 0 !== O(".subjectDet").length; })); }, ischecked: e => e.parent().parent().parent().hasClass("is-checked"), questionHook: e => { const t = O(e.html).find(".title.titleTwo").text().trim(); switch (e.type = typeConvert(parseZhijiaoyunTypeText(t)), e.type) { case "2": e.options = [], e.$options = O(e.html).find(".tkInput input"); break; case "3": e.options = [], e.$options = O(e.html).find(".optionList>div label"); } return e; }, setAnswer: e => "2" !== e.type || (((e, t) => { const n = Array.isArray(t) ? t : [ t ]; let a = 0; e.forEach(((e, t) => { const i = n[t]; null != i && (e.value = String(i), e.dispatchEvent(new Event("input", { bubbles: true })), a++); })); })(O(e.html).find(".tkInput input").get(), e.answer), false) }, { type: "save", name: "\u667a\u6167\u804c\u6559+\u6536\u5f55", match: () => "zyk.icve.com.cn" === location.host && (location.href.includes("/coursePreview/viewJob1") || location.href.includes("/viewExam")), question: { html: ".subjectDet", question: ".seeTitle>span:eq(1)", options: ".optionList>div", type: ".question-box .tag", workType: "zhijiaoyun", pageType: "zhijiaoyun" }, init: async () => { await waitUntil((function() { return 0 !== O(".subjectDet").length; })); }, answerHook: e => { e.options = removeStartChar(e.options); const t = O(e.html).find(".xvhao").text().trim(); e.type = typeConvert(parseZhijiaoyunTypeText(t)); let n = O(e.html).find(".answer").text().trim(); switch (e.answer = n.split(",").map((t => e.options[t.charCodeAt(0) - 65])), e.type) { case "2": e.options = [], e.answer = O(e.html).find(".answer>span").map(((e, t) => removeHtml(O(t).html()))).get(); break; case "3": e.options = O(e.html).find(".optionList>div").map(((e, t) => removeHtml(O(t).html()))).get(), e.answer = n.split(",").map((t => e.options[t.charCodeAt(0) - 65])), e.answer = judgeAnswer(e.answer[0]), e.options = []; } return e; } }, { type: "save", name: "ai\u4f18\u8bfe\u6536\u5f55\u65b0", match: () => "ai.icve.com.cn" === location.host && location.href.includes("/review-exam/"), question: { html: () => { let e = O(".examination-paper")[0].__vue__.sjAllInfo.questions, t = []; return e.sort(((e, t) => e.txdm - t.txdm)), e.forEach((e => { t.push(e); })), t; }, question: ".seeTitle>span:eq(1)", options: ".optionList>div", type: ".question-box .tag", workType: "zhijiaoyun", pageType: "zhijiaoyun" }, init: async () => { await waitUntil((function() { return 0 !== O(".examination-paper")[0].__vue__.sjAllInfo.questions.length; })); let e = O(".examination-paper")[0].__vue__.sjAllInfo.questions, t = []; e.sort(((e, t) => e.txdm - t.txdm)), e.forEach((e => { t.push(e); })), se.quesList = t; }, answerHook: (e, t) => { const n = e.html; e.type = typeMatch(n.type), e.question = titleClean(n.tmmc); let a = []; switch (e.type) { case "3": "1" == n.answer && (e.answer = [ "\u6b63\u786e" ]), "0" == n.answer && (e.answer = [ "\u9519\u8bef" ]); break; case "2": e.answer = n.answer.split(","); break; case "4": e.answer = n.answer; break; case "0": case "1": e.options = n.sjtmxxlist.map((e => ("1" == e.sfzqda && a.push(removeHtml(e.xxnr)), removeHtml(e.xxnr)))), e.answer = a; } return e; }, paper: async e => {} }, { type: "ask", name: "ai\u4f18\u8bfe\u7b54\u9898", tips: "", match: () => "ai.icve.com.cn" === location.host && location.href.includes("/preview-exam/"), types: [ "0", "1" ], question: { html: () => { let e = O(".examination-paper")[0].__vue__.tmActivelist, t = []; return e.sort(((e, t) => e.px - t.px)), e.forEach((e => { t.push(e); })), t; }, question: ".seeTitle>span:eq(1)", options: "label", type: ".question-box .tag", workType: "zhijiaoyun", pageType: "zhijiaoyun" }, init: async () => { await waitUntil((function() { return 0 !== O(".examination-paper")[0].__vue__.tmActivelist.length; })); }, toquestion: e => { O(".topic-zpx-list .topic-zpx-main span:eq(" + e + ")").click(); }, ischecked: e => e.hasClass("wrongXz"), questionHook: e => { var t; const n = e.html, a = O(".examination-paper")[0].__vue__.topList, i = []; Object.keys(a).forEach((e => { a[e].forEach((t => { i.push({ id: t.id, type: t.txdmmc || e }); })); })); const s = (null == (t = i.find((e => e.id === n.id))) ? void 0 : t.type) || "\u5176\u4ed6"; e.type = typeMatch(s), e.question = titleClean(n.title); const r = n.dataArr.map((e => removeHtml(e.Content))); return e.options = r, e.answer = [], e.html = O(".content-center"), e.$options = () => O("label"), e; } }, { type: "ask", name: "\u7f51\u68af\u81ea\u6d4b\u7b54\u9898", tips: "", match: () => location.href.includes("coursewareTest_intoTestPage.action"), types: [ "0", "1", "3", "2" ], question: { html: ".test_item", question: ".test_item_tit", options: ".test_item_theme li", type: ".test_item_type", workType: "webtrn", pageType: "webtrn" }, init: async () => { await waitUntil((function() { return 0 !== O(".test_item").length; })); }, ischecked: e => e.is(":checked"), questionHook: e => { const t = O(e.html), n = t.find(".test_item_tit").clone(); n.find(".tipNodo").remove(); let a = removeHtml(n.html() || "").replace(/^\s*\d+\s*[\.\u3001\uff0e]\s*/, "").replace(/\uff08\s*[\d.]+\s*\u5206\s*\uff09\s*$/, "").trim(); e.question = titleClean(a); let i = t.prevAll(".test_item_type").first().text().trim(); switch (i || (i = t.parent().prevAll(".test_item_type").first().text().trim()), i.includes("\u591a\u9009") ? e.type = "1" : i.includes("\u5224\u65ad") ? e.type = "3" : i.includes("\u586b\u7a7a") ? e.type = "2" : i.includes("\u7b80\u7b54") || i.includes("\u95ee\u7b54") || i.includes("\u8bba\u8ff0") ? e.type = "4" : e.type = "0", e.type) { case "3": e.options = [], e.$options = t.find(".test_item_theme input"); break; case "2": e.options = [], e.$options = t.find('input[type="text"], textarea'); break; case "4": e.options = [], e.$options = t.find("textarea"); break; default: e.options = t.find(".test_item_theme li").map(((e, t) => { const n = O(t), a = n.find(".zdh_op_con"); return (a.length ? removeHtml(a.html() || "") : removeHtml(n.html() || "").replace(/^[A-Z][\uff0e\.\u3001]?\s*/, "")).trim(); })).get(), e.$options = t.find(".test_item_theme li input"); } return e; }, setAnswer: e => { switch (e.type) { case "3": { const t = e.answer; return e.ques.$options.each(((e, n) => { const a = (O(n).attr("value") || "").toUpperCase(), i = O(n).parent().text(); (isTrue(t) && ("T" === a || /\u5bf9|\u6b63\u786e/.test(i)) || isFalse(t) && ("F" === a || /\u9519|\u9519\u8bef/.test(i))) && !n.checked && O(n).click(); })), false; } case "2": return e.ques.$options.each(((t, n) => { O(n).val(e.answer[t]).trigger("change"); })), false; case "4": return e.ques.$options.first().val(e.answer).trigger("change"), false; } return true; } }, { type: "save", name: "\u7f51\u68af\u81ea\u6d4b\u6536\u5f55", match: () => location.href.includes("coursewareTest_intoTestAnswerPage.action"), question: { html: ".test_item", question: ".test_item_tit", options: ".test_item_theme li", type: ".test_item_type", workType: "webtrn", pageType: "webtrn" }, init: async () => { await waitUntil((function() { return 0 !== O(".test_item").length; })); }, answerHook: e => { const t = O(e.html), n = t.find(".test_item_tit").clone(); n.find(".zdh_t_f, .test_item_key").remove(); let a = removeHtml(n.html() || "").replace(/^\s*\d+\s*[\.\u3001\uff0e]\s*/, "").replace(/\uff08\s*[\d.]+\s*\u5206\s*\uff09\s*$/, "").trim(); e.question = titleClean(a); let i = t.prevAll(".test_item_type").first().text().trim(); i || (i = t.parent().prevAll(".test_item_type").first().text().trim()), i.includes("\u591a\u9009") ? e.type = "1" : i.includes("\u5224\u65ad") ? e.type = "3" : i.includes("\u586b\u7a7a") ? e.type = "2" : i.includes("\u7b80\u7b54") || i.includes("\u95ee\u7b54") || i.includes("\u8bba\u8ff0") ? e.type = "4" : e.type = "0"; const s = t.find(".test_item_key_tit").text().replace(/^.*?[\uff1a:]\s*/, "").trim(); switch (e.type) { case "0": case "1": e.options = t.find(".test_item_theme ul li").map(((e, t) => { const n = O(t).find(".zdh_op_con"); return (n.length ? removeHtml(n.html() || "") : removeHtml(O(t).html() || "").replace(/^[A-Z][\uff0e\.\u3001]?\s*/, "")).trim(); })).get(), e.answer = s.split("").filter((e => /[A-Z]/.test(e))).map((t => e.options[t.charCodeAt(0) - 65])).filter((e => void 0 !== e)); break; case "3": e.options = [], e.answer = judgeAnswer(s); break; case "2": e.options = [], e.answer = s.split(/[,\uff0c;\uff1b\s]+/).filter(Boolean); break; case "4": e.options = [], e.answer = s; } return e; } } ], pt = [ { type: "ask", name: "\u5ddd\u519c\u5728\u7ebf\u7b54\u9898", tips: "", match: () => location.host.includes("cnzx.info") && location.href.includes("KaoShi/ShiTiYe.aspx"), types: [ "0", "1", "3" ], question: { html: "li.question", question: ".wenti >p.stem", options: ".wenti > ol > li", type: ".question_head > span:eq(0)", workType: "cnzx", pageType: "cnzx" }, init: async () => {}, ischecked: e => e.find("input").prop("checked"), questionHook: e => (e.$options = O(e.html).find(".wenti > ol > li input"), 0 !== e.options.length && (e.type = "radio" === e.$options.eq(0).attr("type") ? "0" : "1", 2 === e.options.length && e.options.includes("\u6b63\u786e") && e.options.includes("\u9519\u8bef") && (e.type = "3", e.options = [])), e), setAnswer: e => "3" !== e.type || (O(e.html).find(".wenti > ol > li").each(((t, n) => { isTrue(e.answer) && isTrue(removeHtml(O(n).html())) && e.ques.$options.eq(t).click(), isFalse(e.answer) && isFalse(removeHtml(O(n).html())) && e.ques.$options.eq(t).click(); })), false), finish: e => { O("li.paginationjs-next.J-paginationjs-next").click(); } }, { type: "save", name: "\u5ddd\u519c\u5728\u7ebf\u6536\u5f55", match: () => location.host.includes("cnzx.info") && location.href.includes("ZaiXianLianXi.aspx"), question: { html: ".ShiTi>.ShiTiMiaoShu", question: ".ShiTiMiaoShu", options: ".el-radio-group label .label,.el-checkbox-group label .label", type: ".question-box .tag", workType: "cnzx", pageType: "cnzx" }, init: async () => {}, answerHook: e => { O(e.html).text(), e.question = removeHtml(titleClean(removeHtml(O(e.html).html()))); let t = O("ul.TiXing>li.DangQianTiXing:eq(0)>a").text(), n = [], a = O(e.html).next(); switch (e.options = removeStartChar(a.find("ul li").map(((e, t) => (O(t).hasClass("DaAn1") && n.push(e), titleClean(removeHtml(O(t).html()))))).get()), e.answer = n.map((t => e.options[t])), t) { case "\u5355\u9009\u9898": case "\u8bcd\u6c47\u4e0e\u7ed3\u6784": case "\u4ea4\u9645\u7528\u8bed": e.type = "0"; break; case "\u591a\u9009\u9898": e.type = "1"; break; case "\u5224\u65ad\u9898": e.type = "3", e.options = [], e.answer = isTrue(e.answer[0]) ? [ "\u6b63\u786e" ] : isFalse(e.answer[0]) ? [ "\u9519\u8bef" ] : []; } return e; } } ], dt = [ { type: "ask", name: "\u5b89\u5fbd\u7ee7\u7eed\u6559\u80b2\u7b54\u9898(\u65e7\u7248)", tips: "", match: () => location.href.includes("study/html/content/studying/?courseOpenId=") || location.href.includes("study/html/content/sxsk/?courseOpenId=") || location.href.includes("study/html/content/tkOnline/?courseOpenId=") || location.href.includes("study/html/content/bkExam/?courseOpenId="), types: [ "0", "1", "3" ], question: { html: ".e-q-body>.e-q", question: ".ErichText", options: "ul>li>.ErichText", type: ".question-box .tag", workType: "ahjxjy", pageType: "ahjxjy" }, init: async () => { if (await waitUntil((function() { return isExist(".e-q-body>.e-q") && isExist(".e-item"); })), !isExist(".photo-time") && !isExist(".btn_save")) return false; }, ischecked: e => e.parent().hasClass("checked"), questionHook: e => { var t; const n = O(e.html).parent().parent(); switch (e.type = n ? null == (t = n.attr("id")) ? void 0 : t.trim() : "", e.type) { case "2": e.type = "1"; break; case "1": e.type = "0"; break; case "3": e.type = "3", e.$options = O(e.html).find("ul>li"); break; case "4": e.type = "2"; break; case "5": e.type = "4"; break; default: e.type, e.type = "8"; } return e; }, setAnswer: e => { switch (e.type) { case "4": case "2": return O(e.html).find("textarea.answer-input").focus(), O(e.html).find(" textarea.answer-input"), O(e.html).find(".answer-input.edui-default").each(((t, n) => { let a = O(n).attr("id"), i = se.UE.getEditor(a); i.ready((function() { i.setContent(`

    ${e.answer[t]}

    `); })); })), O(e.html).find(".answer-input").blur(), false; } return true; } }, { type: "save", name: "\u5b89\u5fbd\u7ee7\u7eed\u6559\u80b2\u6536\u5f55(\u65e7\u7248)", tips: "\u8be5\u5e73\u53f0\u4ec5\u652f\u6301\u5355\u9009\u3001\u591a\u9009\u3001\u5224\u65ad\u9898\u578b\uff0c\u5176\u4ed6\u9898\u578b\u6682\u4e0d\u652f\u6301", match: () => location.href.includes("study/html/content/studying/?courseOpenId=") || location.href.includes("study/html/content/sxsk/?courseOpenId=") || location.href.includes("study/html/content/tkOnline/?courseOpenId=") || location.href.includes("study/html/content/bkExam/?courseOpenId="), question: { html: ".e-q-body>.e-q", question: ".ErichText", options: "ul>li>.ErichText", type: ".question-box .tag", workType: "ahjxjy", pageType: "ahjxjy" }, init: async () => { if (await waitUntil((function() { return isExist(".e-save"), isExist(".e-q-body>.e-q") && isExist(".w_e-q-panel"); })), !isExist(".e-quest-review")) return false; }, answerHook: e => { var t; const n = O(e.html).parent().parent(); e.type = n ? null == (t = n.attr("id")) ? void 0 : t.trim() : "", e.$options = O(e.html).find("ul>li"); let a = O(e.html).find("ul>li.checked").map(((e, t) => removeHtml(O(t).find(".ErichText").html()))).get(); const i = O(e.html).find(".e-q-right").length > 0; e.answer = a.filter((e => "" !== e)); let s = O(e.html).find(".e-ans-ref .e-ans-r").map(((e, t) => removeHtml(O(t).html()))).get(); 1 === s.length && s[0].length > 1 && (s = s[0].split("\u3001")); let r = s.map((t => { let n = t.charCodeAt() - 65; return e.options[n]; })).filter((e => "" !== e && void 0 !== e)); switch (e.type) { case "2": e.type = "1"; break; case "1": e.type = "0"; break; case "3": e.type = "3", e.answer = O(e.html).find("ul>li.checked").map(((e, t) => removeHtml(O(t).html()))).get(), e.options = [], isTrue(e.answer[0]) ? e.answer = [ "\u6b63\u786e" ] : isFalse(e.answer[0]) ? e.answer = [ "\u9519\u8bef" ] : e.answer = []; break; case "4": e.type = "2", e.options = []; break; case "5": e.type = "4", r = [ removeHtml(O(e.html).find(".e-ans-ref>.e-ans-r").html()) ], e.options = []; break; case "11": e.type = "19"; const t = O(e.html).find("form").map(((e, t) => ({ type: "0", question: removeHtml(O(t).find(".e-q-q .ErichText").html()), options: O(t).find("ul li .ErichText").map(((e, t) => removeHtml(O(t).html()))).get() }))).get(); r = r.length > 0 ? judgeAnswer(r[0]) : [], e.options = t; default: return void e.type; } if (r.length > 0) return e.answer = r, e; if (!i && "3" === e.type && e.answer.length > 0) { if (e.answer = isTrue((o = e.answer)[0]) || isFalse(o[0]) ? isTrue(o[0]) ? [ "\u9519\u8bef" ] : [ "\u6b63\u786e" ] : [], 0 === e.answer.length) return; } else if (!i) return; var o; return e; }, paper: e => { const t = se.online, n = { platform: "ahjxjy" }; n.hash = t.courseOpenId, n.name = se.localStorage.courseNmae, n.info = {}, n.chapter = [ { hash: `${t.cell.id}`, name: t.cell.title, question: e } ], Xe.setPaper(n.hash, n); } }, { type: "save", name: "\u5b89\u5fbd\u7ee7\u7eed\u6559\u80b2\u6536\u5f55(\u65b0\u7248)", tips: "\u8be5\u5e73\u53f0\u4ec5\u652f\u6301\u5355\u9009\u3001\u591a\u9009\u3001\u5224\u65ad\u9898\u578b\uff0c\u5176\u4ed6\u9898\u578b\u6682\u4e0d\u652f\u6301", match: () => location.href.includes("/myHomework/answerRecord") || location.href.includes("/myHomework/assignment") || location.href.includes("/myExam/examDetails") || location.href.includes("/myExam/examHistory"), question: { html: ".option>div[id='answer-card-area']", question: ".ErichText", options: "ul>li>.ErichText", type: ".question-box .tag", workType: "ahjxjy", pageType: "ahjxjy" }, init: async () => { var e; await waitUntil((function() { return isExist(".option>div[id='answer-card-area']"); })); const t = null == (e = O("micro-app-body>#app>div")[0]) ? void 0 : e.__vue__; if (!(t && t.hierarchyList || []).some((e => (e.CourseQuestionOptionList || []).some((e => e.IsAnswer))))) return false; }, answerHook: (e, t) => { const n = O("micro-app-body>#app>div")[0].__vue__.hierarchyList[t]; e.type = typeMatch(n.name), e.question = titleClean(removeHtml(n.Content)); const {options: a, answer: i} = n.CourseQuestionOptionList.reduce(((e, t) => { const n = removeHtml(t.Content); return t.IsAnswer && e.answer.push(n), e.options.push(n), e; }), { options: [], answer: [] }); return e.options = a, e.answer = "3" === e.type ? [ judgeAnswer(i[0]) ] : i, "3" === e.type && (e.options = []), e; } }, { type: "ask", name: "\u5b89\u5fbd\u7ee7\u7eed\u6559\u80b2\u7b54\u9898(\u65b0\u7248)", tips: "\u5355\u9898\u95f4\u9694\u5fc5\u987b\u5927\u4e8e 3 \u79d2\uff01\uff01\u591a\u9009\u9898\u6bcf\u9009\u4e00\u9879\u90fd\u4f1a\u8bf7\u6c42\u63a5\u53e3\uff0c\u5df2\u81ea\u52a8\u653e\u6162\u9010\u9879\u70b9\u51fb\u901f\u5ea6\uff0c\u5426\u5219\u5bb9\u6613\u5f02\u5e38(403)\uff01\uff01", match: () => location.href.includes("/myHomework/assignment") || location.href.includes("/myExam/examDetails"), types: [ "0", "1", "3" ], minDelay: 3e3, answerDelay: 1e3, optionDelay: 2e3, question: { html: ".option>div[id='answer-card-area']", question: ".ErichText", options: "ul.answer-list>li", type: ".question-box .tag", workType: "ahjxjy", pageType: "ahjxjy" }, init: async () => { if (await waitUntil((function() { return isExist(".option>div[id='answer-card-area']"); })), !O(".submit-area").text().includes("\u63d0\u4ea4")) return false; const e = O("micro-app-body>#app>div")[0].__vue__, t = e.hierarchyList[0]; e.goAnchor(t.Id); }, toquestion: e => { const t = O("micro-app-body>#app>div")[0].__vue__, n = t.hierarchyList[e]; (null == n ? void 0 : n.Id) && t.goAnchor(n.Id); }, ischecked: e => e.hasClass("on"), questionHook: (e, t) => { const n = O("micro-app-body>#app>div")[0].__vue__.hierarchyList[t]; e.type = typeMatch(n.name), e.question = titleClean(removeHtml(n.Content)); let a = []; return n.CourseQuestionOptionList.forEach((e => { const t = removeHtml(e.Content); e.IsAnswer, a.push(t); })), e.options = a, e.html = "body", e.$options = () => O("ul.answer-list>li"), e; } }, { type: "ask", name: "\u5b89\u5fbd\u7ee7\u7eed\u6559\u80b2\u7b54\u9898(\u81ea\u8003)", tips: "", match: () => location.href.includes("/userinfo/testPaper"), types: [ "0", "1", "3" ], question: { html: ".item-card-area", question: ".desc", options: "ul>li", type: ".question-box .tag", workType: "ahjxjy", pageType: "ahjxjy" }, init: async () => { if (await waitUntil((function() { return isExist(".exam-paper-wrap"); })), isExist(".exam-process-area")) return false; const e = O(".exam-paper-wrap")[0].__vue__.topicList.map((e => e.getPaperList)).flat(); window.Zques = e; }, ischecked: e => e.parent().hasClass("checked"), questionHook: (e, t) => { const n = Zques[t]; e.type = typeMatch(n.questionTypeName), e.question = titleClean(removeHtml(n.content)); const {options: a, answer: i} = n.courseQuestionOptionList.reduce(((e, t) => { const n = removeHtml(t.content); return t.isAnswer && e.answer.push(n), e.options.push(n), e; }), { options: [], answer: [] }); return e.options = a, e.answer = "3" === e.type ? [ judgeAnswer(i[0]) ] : i, "3" === e.type && (e.options = []), e; }, setAnswer: e => { switch (e.type) { case "4": case "2": return O(e.html).find("textarea.answer-input").focus(), O(e.html).find(" textarea.answer-input"), O(e.html).find(".answer-input.edui-default").each(((t, n) => { let a = O(n).attr("id"), i = se.UE.getEditor(a); i.ready((function() { i.setContent(`

    ${e.answer[t]}

    `); })); })), O(e.html).find(".answer-input").blur(), false; } return true; } }, { type: "save", name: "\u5b89\u5fbd\u7ee7\u7eed\u6559\u80b2\u6536\u5f55(\u81ea\u8003)", tips: "\u8be5\u5e73\u53f0\u4ec5\u652f\u6301\u5355\u9009\u3001\u591a\u9009\u3001\u5224\u65ad\u9898\u578b\uff0c\u5176\u4ed6\u9898\u578b\u6682\u4e0d\u652f\u6301", match: () => location.href.includes("/userinfo/testPaper"), question: { html: ".item-card-area", question: ".ErichText", options: "ul>li>.ErichText", type: ".question-box .tag", workType: "ahjxjy", pageType: "ahjxjy" }, init: async () => { if (await waitUntil((function() { return isExist(".exam-paper-wrap"); })), !isExist(".score-describe")) return false; const e = O(".exam-paper-wrap")[0].__vue__.topicList.map((e => e.getPaperList)).flat(); window.Zques = e; }, answerHook: (e, t) => { const n = Zques[t]; e.type = typeMatch(n.questionTypeName), e.question = titleClean(removeHtml(n.content)); const {options: a, answer: i} = n.courseQuestionOptionList.reduce(((e, t) => { const n = removeHtml(t.content); return t.isAnswer && e.answer.push(n), e.options.push(n), e; }), { options: [], answer: [] }); return e.options = a, e.answer = "3" === e.type ? [ judgeAnswer(i[0]) ] : i, "3" === e.type && (e.options = []), e; } } ], lettersToOptions = (e, t) => e ? e.split("").map((e => t[e.charCodeAt(0) - 65])).filter((e => null != e)) : [], buildQingshuAnswer = (e, t, n) => { if ("15" === e) { const e = [], n = []; return (t.subQuestions ?? []).forEach((t => { const a = (t.options ?? []).map((e => removeHtml(e.description ?? ""))); n.push(lettersToOptions(t.solution, a)), e.push(a); })), { options: e, answer: n }; } if ("3" === e) { const [e] = lettersToOptions(t.solution, n); return { options: [], answer: [ isTrue(e ?? "") ? "\u6b63\u786e" : isFalse(e ?? "") ? "\u9519\u8bef" : "" ] }; } if ("0" === e || "1" === e) return { options: n, answer: lettersToOptions(t.solution, n) }; const a = removeHtml(t.solution ?? "").trim(); return { options: n, answer: a ? [ a ] : [] }; }, mt = [ { type: "save", name: "\u9752\u4e66\u4f5c\u4e1a\u7b54\u9898\u6536\u5f55", match: () => location.host.includes("qingshuxuetang.com") && (location.href.includes("Student/ExercisePaper?courseId=") || location.href.includes("Student/ViewQuiz?quizId=") || location.href.includes("Student/SimulationExercise/Detail?id=") || location.href.includes("Student/Quiz/Detail?id=")), question: { html: ".paper-container > .question-detail-container", question: ".question-detail-description", options: ".question-detail-options .question-detail-option .option-description-preview", type: ".question-detail-type-desc", workType: "qingshu", pageType: "qingshu" }, init: async () => { await waitUntil((function() { return isExist(".question-detail-container") && se.qsques; })); }, answerHook: (e, t) => { const n = se.qsques[t]; e.question = removeHtml(n.description); const a = n.options ? n.options.map((e => removeHtml(e.description))) : []; e.type = typeConvert(n.typeDesc); const i = buildQingshuAnswer(e.type, n, a); return e.options = i.options, e.answer = i.answer, e; } }, { type: "ask", name: "\u9752\u4e66\u5b66\u5802\u4f5c\u4e1a\u7b54\u9898", tips: "", match: () => location.host.includes("qingshuxuetang.com") && (location.href.includes("/Student/ExercisePaper") || location.href.includes("Student/ExamPaper") || location.href.includes("Student/ViewQuiz") || location.href.includes("Student/SimulationExercise/Detail") || location.href.includes("Student/Quiz/Detail")), types: [ "0", "1", "3" ], question: { html: ".paper-container > .question-detail-container", question: ".question-detail-description", options: ".question-detail-options .question-detail-option .option-description", type: ".question-detail-type-desc", workType: "qingshu", pageType: "qingshu" }, init: async () => { await waitUntil((function() { return isExist(".question-detail-container") && se.qsques; })); }, ischecked: e => e.parent().find("input").prop("checked"), toquestion: e => { O(`.group_item:eq(${e})`), O(`.group_item:eq(${e})`).click(); }, questionHook: (e, t) => { const n = se.qsques[t]; if (e.question = removeHtml(n.description), e.options = n.options ? n.options.map((e => removeHtml(e.description))) : [], e.type = typeConvert(n.typeDesc), "3" === e.type) e.options = []; return e; } } ], ht = [ { type: "save", name: "\u4f18\u8bfe\u5728\u7ebf\u6536\u5f55", match: () => "cce.org.uooconline.com" === location.host && (location.href.includes("/exam/paper") || location.href.includes("/exam/")), question: { html: ".queContainer", question: ".topic-title", options: ".el-radio-group label .label,.el-checkbox-group label .label", type: ".question-box .tag", workType: "uooc", pageType: "uooc" }, init: async () => { await waitUntil((function() { return 0 !== O(".queContainer").length; })); }, answerHook: e => { const t = se.angular.element(e.html).scope().question; if (e.type = typeConvert(t.type_text), e.question = t.question, e.options = t.options_app.map((e => e.value)), e.answer = t.answer.map((e => t.options[e])), "3" === e.type) e.options = [], e.answer = judgeAnswer(e.answer[0]); return e; } } ], ft = [ { type: "ask", name: "\u4eac\u4eba\u5e73\u53f0\u7b54\u9898", tips: "", match: () => location.host.includes("cj-edu.com") && (location.href.includes("/Examination") || location.href.includes("/ExamInfo")), types: [ "0", "1", "3" ], question: { html: ".el-main>.all_subject>div.el-row", question: "div.stem", options: "ul li > label > span.el-radio__label > div:nth-child(2),ul li > label > span.el-checkbox__label > div:nth-child(2)", type: ".question-box .tag", workType: "cjedu", pageType: "cjedu" }, init: async () => { await waitUntil((function() { return 0 !== O(".el-main>.all_subject>div.el-row").length; })); }, ischecked: isParentChecked, questionHook: e => { switch (O(e.html).prevAll("h1").first().text().trim()) { case "\u5355\u9009\u9898": e.type = "0"; break; case "\u591a\u9009\u9898": e.type = "1"; break; case "\u5224\u65ad\u9898": e.$options = O(e.html).find("ul li>label"), e.options = [], e.type = "3"; } return e; } }, { type: "save", name: "\u4eac\u4eba\u5e73\u53f0\u4f5c\u4e1a\u6536\u5f55", match: () => location.host.includes("cj-edu.com") && location.href.includes("/ViewAnswerSheet"), question: { html: ".el-main>.all_subject>div.el-row", question: "p.stem", options: "ul li > label > span.el-radio__label > div:nth-child(2),ul li > label > span.el-checkbox__label > div:nth-child(2)", type: ".question-box .tag", workType: "cjedu", pageType: "cjedu" }, init: async () => { await waitUntil((function() { return 0 !== O(".el-main>.all_subject>div.el-row").length; })); }, answerHook: e => { let t = O(e.html).find(".seeStudentAnswer>p.answer").text().replace("\u53c2\u8003\u7b54\u6848\uff1a", "").trim(), n = O(e.html).prevAll("h1").first().text().trim(); switch (e.options.length > 0 && (e.answer = t.split(",").map((t => e.options[t.charCodeAt(0) - 65]))), n) { case "\u5355\u9009\u9898": e.type = "0"; break; case "\u591a\u9009\u9898": e.type = "1"; break; case "\u5224\u65ad\u9898": e.options = [], e.answer = judgeAnswer(t), e.type = "3"; } return e; } } ], gt = [ { type: "hook", name: "hook", match: location.host.includes("ytccr.com"), main: e => { observeVuePageChange(O("#app")[0], (() => getUrl())); } }, { type: "ask", name: "\u7ece\u901a\u7ee7\u6559\u4e91\u7b54\u9898", tips: "", match: () => location.host.includes("ytccr.com") && location.href.includes("learning-work") && location.href.includes("type=3"), types: [ "0", "1", "3" ], question: { html: ".border-item", question: ".title.qa-title", options: ".opts-list .opt-title-cnt", type: ".question-box .tag", workType: "ytccr", pageType: "ytccr" }, init: async () => { await waitUntil((function() { return 0 !== O(".border-item").length; })); }, ischecked: isParentChecked, questionHook: e => { if (e.type = typeConvert(O(e.html).find(".qtype").text().trim()), "3" === e.type) e.options = []; return e; } }, { type: "save", name: "\u7ece\u901a\u7ee7\u6559\u4e91\u6536\u5f55", match: () => location.host.includes("ytccr.com") && location.href.includes("learning-work") && location.href.includes("type=5"), question: { html: ".border-item", question: ".title.qa-title", options: ".opts-list .opt-title-cnt", type: ".question-box .tag", workType: "ytccr", pageType: "ytccr" }, init: async () => { await waitUntil((function() { return 0 !== O(".border-item").length; })); }, answerHook: e => { e.type = typeConvert(O(e.html).find(".qtype").text().trim()); let t = O(e.html).find(".u-text-success,.u-text-danger").text().split("\uff0c")[0].trim(); if (t = t.match(/[A-Z]+$/)[0].trim(), e.answer = t.split("").map((t => e.options[t.charCodeAt(0) - 65])), 0 === e.answer.length) return e; if ("3" === e.type) e.options = [], e.answer = judgeAnswer(e.answer[0]); return e; } } ], vt = [ { type: "ask", name: "\u5b66\u8d77\u8003\u8bd5", tips: "", match: () => location.href.includes("oxer/page/ots/examIndex.html"), types: [ "0", "1", "3" ], question: { html: ".queItemClass", question: "dt > div.din:eq(1)", options: "dd > div", type: ".question-box .tag", workType: "xueqi", pageType: "xueqi" }, init: async () => { await waitUntil((function() { return isExist(".queItemClass"); })), se.document.onkeydown = null, se.oncontextmenu = null; }, ischecked: e => e.parent().hasClass("cur"), questionHook: e => { let t = O(e.html).parent().find("div .fb:eq(0)").text().split("\u3001")[1]; if (t.includes("\u5224\u65ad") && (t = "\u5224\u65ad\u9898"), e.type = typeMatch(t), "3" === e.type) e.options = [], e.$options = O(e.html).find("input"); return e; }, setAnswer: e => { if ("3" === e.type) { let t = e.answer; return e.ques.$options.each(((e, n) => { isTrue(t) && isTrue(removeHtml(O(n).val())) && O(n).click(), isFalse(t) && isFalse(removeHtml(O(n).val())) && O(n).click(); })), false; } return true; } }, { type: "save", name: "\u5b66\u671f\u8003\u8bd5\u6536\u5f55", match: () => location.href.includes("OTS-UniverDetail.html"), question: { html: ".dl_list", question: "dt > div.fl:eq(1)", options: "dd > var", type: ".question-box .tag", workType: "xueqi", pageType: "xueqi" }, init: async () => { await waitUntil((function() { return isExist(".dl_list"); })); }, answerHook: e => { var t, n, a; const i = O(e.html).attr("queid"), s = e.html._ms_context_.el.questions.find((e => e.id === i)); s.questionTypeName.includes("\u5224\u65ad") && (s.questionTypeName = "\u5224\u65ad\u9898"), e.type = typeMatch(s.questionTypeName), e.question = removeHtml(s.stem); const r = ((null == (t = s.answerArea) ? void 0 : t.optionList) || []).slice().sort(((e, t) => e.sequence - t.sequence)); e.options = r.map((e => removeHtml(e.content))); if (!!!((null == (n = s.answer) ? void 0 : n.ans) || Array.isArray(null == (a = s.answer) ? void 0 : a.ansL) && s.answer.ansL.length) && 0 === s.answerScore) return; const o = r.filter((e => e.isTrue)).map((e => removeHtml(e.content))), l = ((e, t, n, a) => { const i = t || {}, s = i.ans || (Array.isArray(i.ansL) ? i.ansL.join("") : ""); if ("3" === e) return { answer: judgeAnswer(String(s)), options: [] }; if ("0" === e || "1" === e) { if (s) { const e = String(s).split("").map((e => n[e.charCodeAt(0) - 65])).filter((e => void 0 !== e)); if (e.length > 0) return { answer: e, options: n }; } return { answer: a, options: n }; } return { answer: (Array.isArray(i.ansL) && i.ansL.length > 0 ? i.ansL : i.ans ? [ i.ans ] : []).map((e => removeHtml(String(e)))).filter(Boolean), options: n }; })(e.type, s.answer, e.options, o); return e.answer = l.answer, e.options = l.options, e; }, paper: e => { const t = O(".dl_list:eq(0)")[0]._ms_context_.loop.category, n = O(".dl_list:eq(0)")[0]._ms_context_.oAnswerDetailInfo, a = { platform: "xueqi" }; a.hash = t.code, a.name = t.value, a.info = {}, a.chapter = [ { hash: `${n.arrangementid}`, name: n.arrangementname, question: e } ], Xe.setPaper(a.hash, a); } } ], yt = [ { type: "hook", name: "hook", match: "gdrtvu.exam-cloud.cn" === location.host, main: e => { observeVuePageChange(O("#app")[0], getUrl); } }, { type: "ask", name: "\u7b54\u9898", tips: "\u516c\u544a", match: () => location.host.includes("exam-cloud.cn") && location.href.includes("oe-web/online-exam/exam"), types: [ "0", "1", "3" ], question: { html: ".question-container", question: ".question-body:first", options: ".option .question-options", type: ".question-header .container", workType: "guangkai", pageType: "guangkai" }, init: async () => { await waitUntil((function() { return isExist(".question-container"); })); }, ischecked: isParentChecked, questionHook: e => { let t = O(".list .current-question").parent().parent().find(".title").text(); if (console.log(t), t = t.split("\u3001")[1], t = t.replace(/\(.*\)/, "").trim(), console.log(t), e.type = typeConvert(t), "8" == e.type ? e.type = typeMatch(t) : e.type, "3" === e.type) e.options = []; return e; }, finish: e => { O(".next .qm-primary-button").length && O(".next .qm-primary-button")[0].click(); } } ], bt = [ { type: "hook", name: "hook", match: location.host.includes("open.ha.cn"), main: e => { const getHash = () => O(".stuHomeworkVersionId.active").attr("id"); se.mainClass = getHash(); let t = new MutationObserver((async e => { getHash(), se.mainClass !== getHash() && (se.mainClass = getHash(), vuePageChange(), t.disconnect()); })); O(".homeworkBody").length >= 1 && t.observe(O(".homeworkBody")[0], { subtree: true, attributes: true, childList: true }); } }, { type: "ask", name: "\u4e91\u4e0a\u6cb3\u5f00\u7b54\u9898", tips: "", match: () => location.host.includes("open.ha.cn") && location.href.includes("/homework/showHomeworkByStatus") && location.href.includes("checked=false"), types: [ "0", "1" ], question: { html: ".layui-colla-content > .insert", question: ".window-title", options: ".option-title", type: ".question-box .tag", workType: "openha", pageType: "openha" }, init: async () => { await waitUntil((function() { return isExist(".layui-colla-content > .insert"); })); }, ischecked: isParentChecked, questionHook: e => (e.options = e.$options.map(((t, n) => { let a = O(n).find(".numberCover").text().trim(); return removeHtml(e.$options.eq(t).html()).replace(a, "").trim(); })).get(), e.type = typeConvert(O(e.html).find(".questionDiv>.float-l:eq(1)").text().trim()), e.$options = O(e.html).find(".option-title .numberCover"), e) }, { type: "save", name: "\u4e91\u4e0a\u6cb3\u5f00\u6536\u5f55", match: () => location.host.includes("open.ha.cn") && location.href.includes("/homework/showHomeworkByStatus") && location.href.includes("checked=true"), question: { html: ".layui-colla-content > .insert", question: ".window-title", options: ".option-title", type: ".question-box .tag", workType: "openha", pageType: "openha" }, init: async () => { await waitUntil((function() { return isExist(".layui-colla-content > .insert"); })); }, answerHook: e => { let t = []; const n = 0 == O(e.html).find(".option-title.error2").length; if (e.options = e.$options.map(((n, a) => { let i = O(a).find(".numberCover").text().trim(), s = removeHtml(e.$options.eq(n).html()).replace(i, "").trim(); return O(a).hasClass("answer-title") && t.push(s), s; })).get(), e.type = typeConvert(O(e.html).find(".questionDiv>.float-l:eq(1)").text().trim()), n) return e.answer = t, O(e.html).find(".option-title.error2"), e; }, paper: e => { const t = se.homework, n = { platform: "openha" }; n.hash = t.courseId, n.name = t.courseName, n.info = {}, n.chapter = [ { hash: `${t.homeworkId}`, name: t.title, question: e } ], Xe.setPaper(n.hash, n); } } ], wt = [ { type: "ask", name: "\u6cb3\u5357\u7ee7\u7eed\u6559\u80b2\u7b54\u9898", tips: "", match: () => location.href.includes("uc/task/startTask"), types: [ "0", "1" ], answerDelay: 1e3, minDelay: 1e3, question: { html: ".carousel-inner>.item.changeless-box", question: ".exam-tg-txt__wrap.e-tg-box", options: ".ic-options-list address", type: ".question-box .tag", workType: "cloudwis", pageType: "cloudwis" }, init: async () => { if (await waitUntil((function() { return isExist(".carousel-inner>.item.changeless-box"); })), !isExist("#finish")) return false; await waitUntil((function() { let e = O(".carousel-inner>article").filter(((e, t) => O(t).hasClass("temporary-box"))).eq(0).index(); return e > 0 ? (O(".slide-tihao:eq(" + e + ")")[0].click(), !1) : (O(".slide-tihao:eq(0)")[0].click(), !0); })); }, toquestion: e => { O(".slide-tihao:eq(" + e + ")")[0].click(); }, ischecked: e => e.find(".checked").length > 0, questionHook: e => (e.type = typeConvert(O(e.html).attr("data-name") || ""), e.$options = O(e.html).find(".ic-options__wrap label"), e.question = e.question.replace(/^\(\d+\)/, "").trim(), e.question = e.question.replace(/\(\d+\u5206\)$/, "").trim(), e) }, { type: "ask", name: "\u6cb3\u5357\u7ee7\u7eed\u6559\u80b2\u8003\u8bd5\u7b54\u9898", tips: "", match: () => location.href.includes("uc/exam/record/startExamination"), types: [ "0", "1" ], question: { html: ".trunk-box", question: ".exam-tg-txt__wrap.e-tg-box", options: ".ic-options-list address", type: ".question-box .tag", workType: "cloudwis", pageType: "cloudwis" }, init: async () => { if (await waitUntil((function() { return isExist(".trunk-box") && isExist(".ic-ac-checkbox-ol"); })), await waitUntil((function() { return window.scrollTo(0, document.body.scrollHeight), O(".ic-ac-checkbox-ol li").length == O(".trunk-box").length; })), !isExist("#submit-btn")) return false; }, next: () => { O("#carousel-professional").carousel("next"); }, ischecked: e => e.find(".checked").length > 0, questionHook: e => { const t = O(e.html).attr("data-type"); switch (console.log(t), t) { case "1": e.type = "0"; break; case "2": e.type = "1"; break; case "3": e.type = "3", e.options = []; } return e.question = e.question.replace(/^\d+\u3001/, "").trim(), e.question = e.question.replace(/\(\d+\u5206\)$/, "").trim(), e.question = e.question.replace(/\[\S+\]$/, "").trim(), e.$options = O(e.html).find(".ic-options__wrap label"), e; } }, { type: "save", name: "\u6cb3\u5357\u7ee7\u7eed\u6559\u80b2\u6536\u5f55", match: () => location.href.includes("uc/task/startTask"), question: { html: ".carousel-inner>.item.changeless-box", question: ".exam-tg-txt__wrap.e-tg-box", options: ".ic-options-list address", type: ".question-box .tag", workType: "cloudwis", pageType: "cloudwis" }, init: async () => { if (await waitUntil((function() { return isExist(".carousel-inner>.item.changeless-box") && isExist(".slide-tihao"); })), isExist("#finish")) return false; await waitUntil((function() { let e = O(".carousel-inner>article").filter(((e, t) => O(t).hasClass("temporary-box"))).eq(0).index(); return e > 0 ? (O(".slide-tihao:eq(" + e + ")")[0].click(), !1) : (O(".slide-tihao:eq(0)")[0].click(), !0); })); }, answerHook: e => { const t = O(e.html).find(".analysis-box .fs20.c-primary.vam").text().trim().split(""); return e.type = typeConvert(O(e.html).attr("data-name") || ""), e.answer = t.map((t => e.options[t.charCodeAt(0) - 65])), e.question = e.question.replace(/^\(\d+\)/, "").trim(), e.question = e.question.replace(/\(\d+\u5206\)$/, "").trim(), e; } }, { type: "save", name: "\u6cb3\u5357\u7ee7\u7eed\u6559\u80b2\u8003\u8bd5\u6536\u5f55", match: () => location.href.includes("uc/exam/record/startExamination"), question: { html: ".trunk-box.answer-question", question: ".exam-tg-txt__wrap.e-tg-box", options: ".ic-options-list address", type: ".question-box .tag", workType: "cloudwis", pageType: "cloudwis" }, init: async () => { if (await waitUntil((function() { return isExist(".trunk-box") && isExist(".ic-ac-correct"); })), await waitUntil((function() { return window.scrollTo(0, document.body.scrollHeight), O(".ic-ac-correct,.ic-ac-error").length == O(".trunk-box").length; })), isExist("#submit-btn")) return false; }, next: () => { O(".next-slide").click(); }, answerHook: e => { const t = O(e.html).attr("data-type"); console.log(t); const n = O(e.html).find(".ic-options__wrap label").filter(((e, t) => O(t).find(".checked").length > 0)).map(((e, t) => removeHtml(O(t).html()))).get(); switch (e.answer = n.map((t => e.options[t.charCodeAt(0) - 65])), e.question = e.question.replace(/^\d+\u3001/, "").trim(), e.question = e.question.replace(/\(\d+\u5206\)$/, "").trim(), e.question = e.question.replace(/\[\S+\]$/, "").trim(), t) { case "1": e.type = "0"; break; case "2": e.type = "1"; break; case "3": e.type = "3", e.options = [], e.answer = judgeAnswer(e.answer[0]); } return e; } } ], xt = [ { type: "hook", name: "hook", match: location.host.includes("sclecb.cn"), main: e => { observeVuePageChange(O("#app")[0], (() => getUrl())); } }, { type: "ask", name: "\u56db\u5ddd\u5f00\u653e\u5927\u5b66\u7b54\u9898", tips: "", match: () => "study.sclecb.cn" === location.host && /\/[0-9]+\/show/i.test(location.href), types: [ "0", "1", "3" ], question: { html: ".testpaper-question.js-testpaper-question", question: ".testpaper-question-stem", options: ".testpaper-question-choices li", type: ".question-box .tag", workType: "sclecb", pageType: "sclecb" }, init: async () => { await waitUntil((function() { return isExist(".testpaper-question.js-testpaper-question"); })); }, ischecked: e => e.hasClass("checked"), questionHook: e => { switch (e.options = removeStartChar(e.options), e.$options = O(e.html).find(".testpaper-question-choice-inputs > label > input"), e.type = typeConvert(O(e.html).parent().parent().find(".panel-heading>strong").text().trim()), e.type, e.type) { case "0": case "1": break; case "3": e.$options = O(e.html).find(".radio-inline"); } return e; } }, { type: "ask", name: "\u56db\u5ddd\u5f00\u653e\u5927\u5b66\u7b54\u9898\u65e7", tips: "", match: () => location.host.includes("sclecb.cn") && /student\/course\/study\/[0-9a-zA-Z]+\/test\/redo/i.test(location.href), types: [ "0", "1" ], question: { html: ".questiono-item", question: ".clearfix.questiono-header h6", options: ".common_test_option .processing_img", type: ".question-box .tag", workType: "sclecb", pageType: "sclecb" }, init: async () => { await waitUntil((function() { return isExist(".questiono-item"); })); }, ischecked: e => e.hasClass("checked"), questionHook: e => { const t = O(e.html).parent().parent().find("div:eq(0)").text().trim(); switch (true) { case t.includes("\u5355\u9009\u9898"): e.type = "0"; break; case t.includes("\u591a\u9009\u9898"): e.type = "1"; break; case t.includes("\u5224\u65ad\u9898"): e.type = "3", e.options = [], e.$options = O(e.html).find(".common_test_option > label"); break; default: return; } return e; } }, { type: "save", name: "\u56db\u5ddd\u5f00\u653e\u5927\u5b66\u6536\u5f55", match: () => "study.sclecb.cn" === location.host && (/task\/[0-9]+\/activity_show/i.test(location.href) || /result\/[0-9]+\/show/i.test(location.href)), question: { html: ".testpaper-question.js-testpaper-question", question: ".testpaper-question-stem", options: ".testpaper-question-choices li", type: ".question-box .tag", workType: "sclecb", pageType: "sclecb" }, init: async () => { await waitUntil((function() { return isExist(".testpaper-question.js-testpaper-question"); })); }, answerHook: (e, t) => { let n = []; e.options = e.$options.map(((e, t) => { const a = removeHtml(O(t).clone().find(".testpaper-question-choice-index").remove().end().html()); return O(t).hasClass("testpaper-question-choice-right") && n.push(a), a; })).get(), e.answer = n, e.type = typeConvert(O(".js-panel-card>span").eq(t).prevAll("p").first().text().trim()); const a = O(".js-panel-card>span").eq(t).hasClass("bg-success"); switch (e.type) { case "0": case "1": break; case "3": let t = ""; t = O(e.html).find(".testpaper-question-result").text().replace("\u4f60\u7684\u7b54\u6848\u662f", "").trim(), e.answer = judgeAnswer(t); } if ((a || !(e.answer.length > 0) || "3" != e.type) && a) return e; } } ], kt = [ { type: "hook", name: "hook", match: location.host.includes("superchutou.com"), main: e => { observeVuePageChange(O("#root")[0], (() => getUrl())); } }, { type: "ask", name: "\u51fa\u5934\u7cfb\u7edf\u7b54\u9898", tips: "", match: () => location.host.includes("superchutou.com") && location.href.includes("onlineclass/exam/"), types: [ "0", "1" ], question: { html: "[class^='single_excer_item']", question: "[class^='title_content'] > [class^='title_content_text']:eq(1)", options: "[class^='options_content'] label", type: ".question-box .tag", workType: "chutou", pageType: "chutou" }, init: async () => { await waitUntil((function() { return isExist("[class^='single_excer_item']"); })); }, ischecked: isParentChecked, questionHook: e => { let t = O(e.html).find("[class^='title_content'] > span:eq(1)").text(); if (t = t.replace(/\u3010|\u3011/g, "").trim(), e.type = typeConvert(t), e.options = removeStartChar(e.options), "3" === e.type) e.options = []; return e; } }, { type: "save", name: "\u51fa\u5934\u6536\u5f55", match: () => location.host.includes("superchutou.com") && location.href.includes("/onlineclass/analysis/"), question: { html: "[class^='single_excer_item']", question: "[class^='title_content'] > [class^='title_content_text']:eq(1)", options: "[class^='options_content'] label", type: ".question-box .tag", workType: "chutou", pageType: "chutou" }, init: async () => { await waitUntil((function() { return isExist("dl>dd>span"); })); }, answerHook: e => { let t = O(e.html).find("[class^='title_content'] > span:eq(1)").text(); t = t.replace(/\u3010|\u3011/g, "").trim(), e.type = typeConvert(t), e.options = removeStartChar(e.options); const n = O(e.html).find(".ant-collapse-header>div.ant-row>div.ant-col.ant-col-18>div:eq(1)").text().replace("\u53c2\u8003\u7b54\u6848\uff1a", "").trim(); switch (e.type) { case "0": case "1": e.answer = n.split("").map((t => e.options[t.charCodeAt(0) - 65])); break; case "3": e.options = [], e.answer = judgeAnswer(n); } return e; } } ], qt = [ { type: "ask", name: "\u826f\u5e08\u5728\u7ebf\u7b54\u9898", tips: "", match: () => location.host.includes("ls365.net") && (location.href.includes("student/examing.aspx") || location.href.includes("Student/myhomework.aspx")), types: [ "0", "1" ], question: { html: ".exam_question", question: ".exam_question_title", options: ".question_select .select_detail", type: ".exam_question_title strong", workType: "ls365", pageType: "ls365" }, init: async () => { await waitUntil((function() { return isExist(".exam_question"); })); }, ischecked: isParentChecked, questionHook: e => { let t = O(e.html).find(".exam_question_title").clone(); t.find(".question_number").remove(), t.find("strong").remove(), t.find(".exam_feed_back").remove(), e.question = removeHtml(t.html()); let n = O(e.html).find(".exam_question_title strong").text(); return n = n.replace(/\[|\]/g, "").trim(), e.type = typeConvert(n), e; } }, { type: "save", name: "\u826f\u5e08\u5728\u7ebf\u8003\u8bd5\u6536\u5f55", match: () => location.host.includes("ls365.net") && location.href.includes("User/Student/ViewPaper.aspx"), question: { html: "[name^='anchor_']", question: ".title-img-ctr", options: ".pold .phtml", type: ".QuestionsType", workType: "ls365", pageType: "ls365" }, init: async () => { await waitUntil((function() { return isExist("[name^='anchor_']"); })); }, answerHook: e => { let t = O(e.html).find(".QuestionsType").text(); t = t.replace(/\[|\]/g, "").trim(), e.type = typeConvert(t); let n = O(e.html).find(".my-work-answer>p").filter(((e, t) => t.innerText.includes("\u53c2\u8003\u7b54\u6848"))).map(((e, t) => O(t).find(".two").text())).get(); if (0 !== n.length) return e.answer = n[0].split("").map((t => e.options[t.charCodeAt(0) - 65])), e; } }, { type: "save", name: "\u826f\u5e08\u5728\u7ebf\u4f5c\u4e1a\u6536\u5f55", match: () => location.host.includes("ls365.net") && location.href.includes("Student/myhomework_after.aspx"), question: { html: "[name^='anchor_']", question: ".my-work-nav>.col-md-10", options: ".pold .phtml", type: ".QuestionsType", workType: "ls365", pageType: "ls365" }, init: async () => { await waitUntil((function() { return isExist("[name^='anchor_']"); })); }, answerHook: e => { let t = O(e.html).find(".my-work-nav>div:eq(0)>span:eq(0)").text(); t = t.replace(/\[|\]/g, "").trim(), e.type = typeConvert(t); let n = O(e.html).find(".my-work-answer>p").filter(((e, t) => t.innerText.includes("\u53c2\u8003\u7b54\u6848"))).map(((e, t) => O(t).find(".two").text())).get(); if (0 !== n.length) return e.answer = n[0].split("").map((t => e.options[t.charCodeAt(0) - 65])), e; } }, { type: "hook", name: "hook", match: "hbnun.lsedu.vip" === location.host, main: e => { observeVuePageChange(O("#app")[0], (() => getUrl())); } }, { type: "ask", name: "\u826f\u5e08\u5728\u7ebf\u4f5c\u4e1a\u7b54\u9898", tips: "", match: () => location.href.includes("/#/homework/") && !location.href.includes("scene=history"), types: [ "0", "1" ], question: { html: "[id^='question-']", question: ".question-content", options: "button .flex-1.text-left", type: ".self-start.text-3.self-end", workType: "ls365", pageType: "ls365" }, init: async () => { await waitUntil((function() { return isExist("[id^='question-']"); })); }, ischecked: e => O(e).closest("button").hasClass("is-checked") || O(e).closest("button").hasClass("el-button--primary"), questionHook: e => { let t = O(e.html).find(".self-start.text-3.self-end").text(); return t && (t = t.replace(/\[|\]/g, "").trim(), e.type = typeMatch(t)), e; } }, { type: "save", name: "\u826f\u5e08\u5728\u7ebf\u4f5c\u4e1a\u6536\u5f55", match: () => location.href.includes("/#/homework/") && location.href.includes("scene=history"), question: { html: "[id^='question-']", question: ".question-content", options: ".flex.flex-col.space-y-2 .f-c-c.space-x-3 .flex-1", type: ".self-start.text-3.self-end", workType: "ls365", pageType: "ls365" }, init: async () => { await waitUntil((function() { return isExist("[id^='question-']"); })); }, answerHook: e => { let t = O(e.html).find(".self-start.text-3.self-end").text(); t && (t = t.replace(/\[|\]/g, "").trim(), e.type = typeMatch(t)); let n = ""; if (O(e.html).find("div").each(((e, t) => { const a = O(t); if ((a.find("span").filter(((e, t) => O(t).text().trim().includes("\u6807\u51c6\u7b54\u6848\uff1a"))).length > 0 || a.text().trim().includes("\u6807\u51c6\u7b54\u6848\uff1a")) && (n = a.find(".question-content").text().trim(), n)) return false; })), n) return e.answer = n.split("").map((t => { const n = t.charCodeAt(0) - 65; return e.options && e.options[n] ? e.options[n] : null; })).filter((e => null !== e)), e; } } ], _t = [ { type: "hook", name: "hook", match: location.host.includes("jijiaox.com"), main: e => { observeVuePageChange(O("#app")[0], (() => O("#app")[0].__vue__.$route.path)); } }, { type: "ask", name: "\u7ee7\u6559\u4e91\u8003\u8bd5\u7b54\u9898", tips: "", match: () => location.host.includes("jijiaox.com") && (location.href.includes("/mg/studentindexexam/") || !location.href.includes("examrec")), types: [ "0", "1", "3", "4" ], question: { html: ".question>div", question: ".topic-title", options: ".ml_2 label", type: ".question-box .tag", workType: "jijiaox", pageType: "jijiaox" }, init: async () => { await waitUntil((function() { return isExist(".question>div"); })); }, ischecked: e => e.hasClass("is-checked"), questionHook: (e, t) => { const n = O(".page")[0].__vue__.$data.testInfo.studentPraxisList[t]; switch (e.options = n.options ? n.options : [], "string" == typeof e.options && (e.options = []), e.question = removeHtml(n.title), n.type) { case "single": e.type = "0"; break; case "muti": e.type = "1"; break; case "charge": e.type = "3"; break; case "text": e.type = "4"; break; default: console.log(n.type, "\u672a\u77e5\u7c7b\u578b"); } return e; }, setAnswer: e => "4" !== e.type || (O(e.html).find(".editor")[0].__vue__.editor.txt.html(e.answer[0]), false) }, { type: "save", name: "\u7ee7\u6559\u4e91\u8003\u8bd5\u6536\u5f55", match: () => location.host.includes("jijiaox.com") && location.href.includes("/mg/studentindexexam/examrec/"), question: { html: ".question>div", question: ".topic-title", options: ".el-radio-group label .label,.el-checkbox-group label .label", type: ".question-box .tag", workType: "jijiaox", pageType: "jijiaox" }, init: async () => { await waitUntil((function() { return isExist(".question>div"); })); }, answerHook: (e, t) => { const n = O(".page")[0].__vue__.$data.testInfo.studentPraxisList[t], a = n.answer; switch (e.options = n.options ? n.options : [], "string" == typeof e.options && (e.options = []), e.question = removeHtml(n.title), n.type) { case "single": e.type = "0"; break; case "muti": e.type = "1"; break; case "charge": e.type = "3", e.answer = "1" == a ? [ "\u6b63\u786e" ] : "-1" == a ? [ "\u9519\u8bef" ] : []; break; case "text": e.type = "4", e.answer = [ removeHtml(a) ]; break; default: console.log(n.type, "\u672a\u77e5\u7c7b\u578b"); } switch (e.type) { case "0": case "1": console.log("________", a), e.answer = "string" == typeof a ? a.split("").map((t => e.options[t.charCodeAt(0) - 65])) : a.map((t => (console.log(t), e.options[t.charCodeAt(0) - 65]))); } return console.log(e), e; } } ], At = /^(?:\u5bf9|\u9519|\u6b63\u786e|\u9519\u8bef|\u662f|\u5426|\u221a|\xd7|true|false|T|F)$/i; function parseWencaiHomework(e, t) { var n, a; const i = e.querySelectorAll('table[isitem="1"]'); if (1 !== i.length) return null; const s = i[0], r = null == (n = s.rows[0]) ? void 0 : n.cells[0]; if (!r) return null; const o = r.cloneNode(true); o.querySelectorAll("script, input, textarea").forEach((e => e.remove())), o.querySelectorAll("font, nobr").forEach((e => { /\[\u53c2\u8003\u7b54\u6848[\uff1a:]/.test(e.textContent ?? "") && e.remove(); })); const l = t(o.innerHTML); if (!l) return null; const c = s.querySelectorAll('table[isitemoption="1"]'); if (c.length > 1) return null; const u = c[0], p = Array.from((null == u ? void 0 : u.querySelectorAll("label")) ?? []), d = p.map((e => t(e.innerHTML))), m = null == (a = null == u ? void 0 : u.getAttribute("optiontype")) ? void 0 : a.toLowerCase(), h = Array.from(r.querySelectorAll('input[type="text"], input:not([type])')); let f; if ("radio" === m || "checkbox" === m) { if (h.length || d.length < 2 || d.some((e => !e)) || new Set(d).size !== d.length) return null; const e = 2 === d.length && d.every((e => At.test(e))) && 2 === new Set(d.map((e => judgeAnswer(e)[0]))).size; f = "checkbox" === m ? "1" : e ? "3" : "0"; } else { if (u || !h.length) return null; f = "2"; } const g = p.map((e => { var t, n; const a = e.closest("tr"), i = null == a ? void 0 : a.querySelector('input[type="radio"],input[type="checkbox"]'); return (null == i ? void 0 : i.value) || (null == (n = null == (t = null == a ? void 0 : a.textContent) ? void 0 : t.match(/\(([A-Z])\)/)) ? void 0 : n[1]) || ""; })); return p.length && (g.some((e => !/^[A-Z]$/.test(e))) || new Set(g).size !== g.length) ? null : { question: l, options: "3" === f ? [] : d, type: f, labels: p, inputs: h, codes: g, optionTexts: d, table: s, title: r }; } const isJudgeOptions$1 = e => Array.isArray(e) && 2 === e.length && e.every((e => isTrue(e) || isFalse(e))), Tt = [ { type: "hook", name: "hook", match: location.host.includes("wencaischool.net") && O("#app").length, main: e => { observeVuePageChange(O("#app")[0], (() => O("#app")[0].__vue__.$route.path)); const t = document.createElement("style"); t.type = "text/css", t.innerHTML = "* {\n font-size: 13px !important;\n }", document.head.appendChild(t); } }, { type: "save", name: "\u67e0\u6aac\u6587\u624d\u8003\u8bd5\u6536\u5f55", match: () => location.host.includes("wencaischool.net") && location.href.includes("/separation/exam/index.html"), question: { html: ".tmList", question: ".tmTitleTxt", options: ".perRad .opCont", type: ".question-box .tag", workType: "wencai", pageType: "wencai" }, init: async () => { await waitUntil((function() { return isExist(".tmList") && O("#onlineExamArea")[0].__vue__._data.itemsList.length > 0; })); return !(true !== O("#onlineExamArea")[0].__vue__._data.ifShowResult); }, answerHook: (e, t) => { const n = O("#onlineExamArea")[0].__vue__._data.itemsList[t]; e.question = removeHtml(n.itemName), e.options = n.optionNodes.map((e => removeHtml(e.optionContent))); e.type = typeConvert({ 1: "\u586b\u7a7a\u9898", 2: "\u7b80\u7b54\u9898", 3: "\u5355\u9009\u9898", 4: "\u591a\u9009\u9898", 5: "\u9605\u8bfb\u7406\u89e3", 12: "\u5b8c\u5f62\u586b\u7a7a" }[n.itemType]); let a = n.itemAnswer[0].optionContent; if ("0" === e.type && isJudgeOptions$1(e.options)) { const t = e.options[a.charCodeAt(0) - 65]; return e.type = "3", e.answer = judgeAnswer(t), e.options = [], e; } switch (e.type) { case "0": case "1": e.answer = a.split("").map((t => e.options[t.charCodeAt(0) - 65])); break; case "4": e.answer = removeHtml(a); break; case "2": e.answer = n.itemAnswer.map((e => removeHtml(e.optionContent))); } return e; } }, { type: "ask", name: "\u67e0\u6aac\u6587\u624d\u8003\u8bd5\u7b54\u9898", tips: "\u6b64\u5e73\u53f0\u7b54\u9898\u95f4\u9694\u5c3d\u91cf3s\u5de6\u53f3\uff0c\u5426\u5219\u53ef\u80fd\u9009\u4e0d\u4e0a\u7b54\u6848", match: () => location.host.includes("wencaischool.net") && location.href.includes("/separation/exam/index.html"), types: [ "0", "1", "2", "3", "4", "5", "6", "7", "14" ], minDelay: 4e3, answerDelay: 1e3, question: { html: ".tmList", question: ".tmTitleTxt", options: ".perRad .opCont", type: ".question-box .tag", workType: "wencai", pageType: "wencai" }, init: async () => { await waitUntil((function() { return isExist(".tmList") && O("#onlineExamArea")[0].__vue__._data.itemsList.length > 0; })); }, ischecked: e => e[0].checked, questionHook: e => { let t = O(e.html).find(".tmc.tm").attr("ttype"); return e.type = typeConvert({ 1: "\u586b\u7a7a\u9898", 2: "\u7b80\u7b54\u9898", 3: "\u5355\u9009\u9898", 4: "\u591a\u9009\u9898", 5: "\u9605\u8bfb\u7406\u89e3", 12: "\u5b8c\u5f62\u586b\u7a7a" }[t]), e.$options = O(e.html).find(".perRad input"), "0" === e.type && isJudgeOptions$1(e.options) && (e.type = "3", e.options = []), e; }, setAnswer: async e => { const fillInput = (e, t) => { const n = null == t ? "" : String(t), a = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e), "value"); e.focus(), a && a.set ? a.set.call(e, n) : e.value = n, e.dispatchEvent(new Event("input", { bubbles: true })), e.dispatchEvent(new Event("change", { bubbles: true })), e.blur(); }; switch (e.type) { case "4": { const t = O(e.html).find("textarea")[0]; return t && fillInput(t, e.answer[0]), false; } case "2": { const t = O(e.html).find(".ansbox.inputAnswer input").toArray(), n = Array.isArray(e.answer) ? e.answer : [ e.answer ]; for (let e = 0; e < t.length; e++) { const a = n[e]; null != a && (fillInput(t[e], a), await sleep(300)); } return false; } case "3": { const t = Array.isArray(e.answer) ? e.answer[0] : e.answer; return O(e.html).find(".perRad").each(((e, n) => { const a = removeHtml(O(n).find(".opCont").html()), i = O(n).find("input")[0]; i && (isTrue(t) && isTrue(a) || isFalse(t) && isFalse(a)) && i.click(); })), false; } } return true; } }, { type: "ask", name: "\u67e0\u6aac\u6587\u624d\u4f5c\u4e1a\u7b54\u9898", tips: "", match: () => location.host.includes("wencaischool.net") && location.href.includes("/exam/portal/exam.jsp"), types: [ "0", "1", "2", "3" ], question: { html: "table[id^='tblItem_'][islabel='0']", question: "table>tbody>tr:eq(0)>td:eq(0)", options: "table>tbody>tr:eq(1)>td:eq(0) table>tbody>tr>td>label", type: ".question-box .tag", workType: "wencai", pageType: "wencai" }, init: async () => { await waitUntil((function() { return isExist("table[id^='tblItem_'][islabel=0]"); })), O(".aah_wrapper>div").css("z-index", 9999); }, ischecked: e => { var t; return (null == (t = e[0]) ? void 0 : t.control) && e[0].control.checked; }, questionHook: e => { const t = parseWencaiHomework(e.html, removeHtml); return t ? t.labels.some(((n, a) => { const i = n.control; return !i || i.disabled || !e.html.contains(i) || i.value !== t.codes[a] || i.type !== ("1" === t.type ? "checkbox" : "radio"); })) ? null : (e.question = t.question, e.options = t.options, e.type = t.type, e.$options = O(t.labels), e) : null; }, setAnswer: e => { if ("2" === e.type) { if (!function(e, t, n) { var a; const i = parseWencaiHomework(e, n); if (!i || "2" !== i.type || !Array.isArray(t) || i.inputs.length !== t.length || t.some((e => "string" != typeof e || !e.trim()))) return false; const s = e.ownerDocument.defaultView; if (!s) return false; const r = null == (a = Object.getOwnPropertyDescriptor(s.HTMLInputElement.prototype, "value")) ? void 0 : a.set; if (!r || i.inputs.some((e => e.disabled || e.readOnly || !e.isConnected))) return false; for (let o = 0; o < i.inputs.length; o++) r.call(i.inputs[o], t[o]), i.inputs[o].dispatchEvent(new s.Event("input", { bubbles: true })), i.inputs[o].dispatchEvent(new s.Event("change", { bubbles: true })); return true; }(e.html, e.answer, removeHtml)) throw new Error("\u586b\u7a7a\u7b54\u6848\u4e0e\u5f53\u524d\u7a7a\u4f4d\u4e0d\u5339\u914d\uff0c\u5df2\u62d2\u7edd\u56de\u586b"); return false; } return true; } }, { type: "save", name: "\u67e0\u6aac\u6587\u624d\u4f5c\u4e1a\u6536\u5f55", match: () => location.host.includes("wencaischool.net") && location.href.includes("/exam/portal/view_answer.jsp"), question: { html: "tr[id^='trScore_']", question: "table>tbody>tr:eq(0)>td:eq(0)", options: "table>tbody>tr:eq(1)>td:eq(0) table>tbody>tr>td>label", type: ".question-box .tag", workType: "wencai", pageType: "wencai" }, init: async () => {}, answerHook: e => { const t = function(e, t) { const n = parseWencaiHomework(e, t); if (!n) return null; const a = /^\[\u53c2\u8003\u7b54\u6848[\uff1a:]([^\[\]]*)\](?:\s*\u5206\u503c[\uff1a:]\s*\d+(?:\.\d+)?)?$/, i = Array.from(n.table.querySelectorAll("div, font")).filter((e => { var t; return !e.querySelector("div, font") && a.test((null == (t = e.textContent) ? void 0 : t.trim()) ?? ""); })).map((e => e.textContent.trim().match(a)[1].trim())); if ("2" === n.type) { const e = i.map(t); return e.length !== n.inputs.length || e.some((e => !e)) ? null : { ...n, answer: e }; } if (1 !== i.length || !/^[A-Z]+$/.test(i[0])) return null; const s = [ ...i[0] ]; if (new Set(s).size !== s.length || "1" !== n.type && 1 !== s.length) return null; const r = s.map((e => n.codes.indexOf(e))); if (r.some((e => e < 0))) return null; const o = r.map((e => n.optionTexts[e])); return { ...n, answer: "3" === n.type ? judgeAnswer(o[0]) : o }; }(e.html, removeHtml); return t ? { ...e, question: t.question, options: t.options, type: t.type, answer: t.answer } : null; } } ], Ct = [ { type: "save", name: "yxlearning\u6536\u5f55", match: () => location.host.includes("yxlearning.com") && location.href.includes("exam/start?myExamRecordId"), question: { html: ".subject>.mb20.sub", question: ".ls1.lh30.text-f666", options: "ul.options>li.cursor-p", type: ".question-box .tag", workType: "yxlearning", pageType: "yxlearning" }, init: async () => { if (await waitUntil((function() { return isExist(".mb20.sub"); })), !se.yxques) return false; }, answerHook: (e, t) => { const n = []; se.yxques.questionStemRPS.forEach(((e, t) => { e.listPaperQuestionRP.forEach(((e, t) => { n.push(e); })); })); const a = n[t]; e.question = titleClean(removeHtml(a.questionName)); const i = a.type, s = []; switch (e.options = removeStartChar(a.paperOptionRPS.map((e => removeHtml(e.context)))), a.paperOptionRPS.forEach(((t, n) => { 1 == t.standardAnswer && s.push(e.options[n]); })), e.answer = s, i) { case 1: e.type = "3", e.options = [], e.answer = judgeAnswer(e.answer[0]); break; case 2: e.type = "0"; break; case 3: e.type = "1"; } return e; } }, { type: "ask", name: "\u65e5\u7167\u4e13\u4e1a\u6280\u672f\u4eba\u5458\u7b54\u9898", tips: "", match: () => location.host.includes("yxlearning.com") && location.href.includes("exam/start?myExamRecordId"), types: [ "0", "1", "3" ], question: { html: ".mb20.sub", question: ".ls1.lh30.text-f666", options: ".cursor-p", type: ".question-box .tag", workType: "yxlearning", pageType: "yxlearning" }, init: async () => { await waitUntil((function() { return isExist(".mb20.sub"); })); }, ischecked: e => e.hasClass("active"), questionHook: e => { if (e.options = removeStartChar(O(e.html).find("ul>li").map(((e, t) => removeHtml(O(t).html()))).get()), e.$options = O(e.html).find("ul>li"), e.type = typeConvert(O(e.html).parent().prevAll(".title").first().find("[du-html='questionStemName']").text().trim()), "3" === e.type) e.options = [], e.$options = O(e.html).find("ul>li"); return e; } } ], St = [ { type: "ask", name: "\u9ea6\u80fd\u7f51\u7b54\u9898", tips: "", match: () => location.href.includes("lms/web/onlineexam/exambegin"), types: [ "0", "1", "3" ], question: { html: "#exam_form>.sdiv", question: ".eptimu_name", options: ".ansdiv > .optiondiv", type: ".eptimu_title", workType: "cjnep", pageType: "cjnep" }, init: async () => { await waitUntil((function() { return isExist(".sdiv"); })); }, toquestion: e => { O(`.controldiv > a:eq(${e})`), O(`.epcl_circle:eq(${e})`)[0].click(); }, ischecked: isParentChecked, questionHook: e => { if (e.question = e.question.replace(/^[0-9]+\u3001/, "").trim(), e.question = titleClean(e.question), e.options = removeStartChar(e.options), e.type = typeMatch(O(e.html).find(".eptimu_title").text().trim()), e.$options = O(e.html).find(".ansdiv input"), "3" === e.type) e.options = []; return e; }, setAnswer: e => { switch (e.type) { case "3": let t = e.answer; return O(e.html).find(".ansdiv input").each(((e, n) => { isTrue(t) && "1" == O(n).val() && O(n).click(), isFalse(t) && "0" == O(n).val() && O(n).click(); })), false; case "2": case "4": case "5": case "6": const n = O(e.html).find(".ansdiv textarea"), a = e.answer.join(";"); n.val(a), n.trigger("input"), n.trigger("keydown"), n.trigger("change"), n.trigger("blur"), n.trigger("focus"); const i = n[0]; if (i) { [ "input", "change", "blur", "focus" ].forEach((e => { const t = new Event(e, { bubbles: true }); i.dispatchEvent(t); })); } return false; } return true; } }, { type: "save", name: "\u9ea6\u80fd\u7f51\u7b54\u9898\u6536\u5f55", match: () => location.href.includes("lms/web/exam/examshow"), question: { html: "#exam_form>.sdiv", question: ".eptimu_name", options: ".ansdiv > .optiondiv", type: ".eptimu_title", workType: "cjnep", pageType: "cjnep" }, init: async () => { await waitUntil((function() { return isExist(".sdiv"); })); }, answerHook: e => { switch (e.type = typeMatch(O(e.html).find(".eptimu_title").text().trim()), e.question = e.question.replace(/^[0-9]+\u3001/, "").trim(), e.question = titleClean(e.question), e.options = removeStartChar(e.$options.map(((e, t) => { let n = O(t).clone(); return O(n).find("img").remove(), removeHtml(O(n).html()).trim(); })).get()), e.type) { case "0": case "1": e.answer = e.$options.map(((t, n) => { var a; return (null == (a = O(n).find("img").attr("src")) ? void 0 : a.includes("exam-yes")) && e.options[t]; })).get().filter((e => void 0 !== e)); break; case "3": e.answer = e.$options.map(((t, n) => { var a; return (null == (a = O(n).find("img").attr("src")) ? void 0 : a.includes("exam-yes")) && e.options[t]; })).get().filter((e => void 0 !== e)), e.answer = judgeAnswer(e.answer), e.options = []; break; case "4": e.options = []; let t = removeHtml(O(e.html).find(".eptimu_answer.ansdiv").html()).trim(); t.includes("\u6b63\u786e\u7b54\u6848\uff1a") ? e.answer = t.split("\u6b63\u786e\u7b54\u6848\uff1a")[1].trim() : e.answer = []; } return e; } } ], It = [ { type: "ask", name: "\u9ea6\u80fd\u7f51\u7b54\u9898", tips: "", match: () => location.host.includes("mynep.com") && location.href.includes("my-exam/exambegin"), types: [ "0", "1" ], question: { html: ".et_test", question: ".et_title", options: "ul>.et_answer>label", type: ".question-box .tag", workType: "mynep", pageType: "mynep" }, init: async () => {}, toquestion: e => { se.select_num(e + 1); }, ischecked: e => e.parent().find("input").prop("checked"), questionHook: e => { e.question = e.question.replace(/\u7b2c\d+\u9898\uff1a/, ""), e.options = removeStartChar(e.options); const t = O(e.html).find('input[id^="question-num-isdone"]').attr("question_num_type_id"); switch (t) { case "1": e.type = "0"; break; case "2": e.type = "1"; } return e; } }, { type: "save", name: "\u9ea6\u80fd\u7f51\u6536\u5f55", match: () => location.host.includes("mynep.com") && location.href.includes("web/my-exam/examshow"), question: { html: ".et_test", question: ".et_title", options: "ul>.et_answer>label", type: ".question-box .tag", workType: "mynep", pageType: "mynep" }, init: async () => {}, answerHook: e => { const t = O(e.html).find(".et_title").clone(); t.find(".exam-btn").remove(), t.find("div").remove(), e.question = removeHtml(t.html()).replace(/\u7b2c\d+\u9898\uff1a/, "").trim(), e.options = []; const n = []; O(e.html).find(".et_answer>.et_answer>.et_answer>label").map(((t, a) => { e.options.push(removeHtml(O(a).html()).trim()), O(a).parent().find("input").prop("checked") && n.push(t); })).get(), e.options = removeStartChar(e.options), e.answer = n.map((t => e.options[t])); const a = O(e.html).find('input[id^="question-num-isdone"]').attr("question_num_type_id"); switch (a) { case "1": e.type = "0"; break; case "2": e.type = "1"; break; default: return false; } return e; } } ], Et = [ { type: "hook", name: "hook", match: location.host.includes("91huayi.com"), main: e => { observeVuePageChange(O(".box")[0], (() => O(".dd_01").attr("questionid")), { beforeChange: async e => { "homework-detail-container" === e && await waitUntil((function() { return 0 === O(".el-loading-mask").length; })); } }); } }, { type: "ask", name: "\u534e\u533b\u7f51\u7b54\u9898", tips: "", match: () => location.host.includes("91huayi.com") && location.href.includes("/ExamInterface/ComputerExamIndex"), types: [ "0", "1" ], question: { html: "#exampage", question: ".dd_01", options: ".dd_02", type: ".big_type", workType: "huayi", pageType: "huayi" }, init: async () => {}, next: () => { var e; null == (e = O("#btnNext")) || e.click(); }, ischecked: e => e.prop("checked"), questionHook: e => { const t = O(e.html).find(".dd_01").clone(); return t.find(".dd_01_red").remove(), e.question = removeHtml(t.html()), e.options = removeStartChar(e.options), e.type = typeMatch(O(e.html).find(".big_type").text()), e.$options = O(e.html).find("dd.q-content input"), e; }, setAnswer: e => { switch (console.log(e), e.type) { case "0": case "1": return e.ques.$options.each(((t, n) => { if (e.answer.includes(t)) { if (e.rule.ischecked && e.rule.ischecked(O(n))) return; n.click(); } else e.rule.ischecked && e.rule.ischecked(O(n)) && n.click(); })), false; } return true; } }, { type: "ask", name: "\u534e\u533b\u7f51\u8003\u8bd5", tips: "", match: () => location.host.includes("91huayi.com") && location.href.includes("/pages/exam.aspx?cwid="), types: [ "0" ], question: { html: ".test>table", question: "thead", options: "tbody>tr>td>label", type: ".big_type", workType: "huayi", pageType: "huayi" }, init: async () => {}, next: () => { var e; null == (e = O("#btnNext")) || e.click(); }, ischecked: e => e.prop("checked"), questionHook: e => (e.question = titleClean(e.question), e.question = e.question.replace(/^\d+\u3001/, ""), e.options = removeStartChar(e.options), 0 !== e.options.length && (e.type = "0"), e) } ], Ut = [ { type: "ask", name: "\u4e91\u5357\u5f00\u653e\u5927\u5b66\u7b54\u9898", tips: "", match: () => location.href.includes("hw/student/studentStartHomework.action") && location.host.includes("teach.ynou.edu.cn"), types: [ "0", "1", "3" ], question: { html: ".e_juan02biaoti", question: ".qcontent > p:first", options: ".signDefault>.label", type: ".question-box .tag", workType: "ynou", pageType: "ynou" }, init: async () => { await waitUntil((function() { return 0 !== O(".e_juan02biaoti").length; })), O("body").css("text-align", "left"); }, ischecked: e => (e.find("input").is(":checked"), e.find("input").is(":checked")), questionHook: e => { e.options = []; const t = O(e.html).find(".e_juan02daan").clone(); t.find(".clear").nextAll().remove(); const n = removeHtml(t.html()), a = n.split(/[A][\u3001\.\uff0e]/)[0].trim(); null !== a && (e.question = a), e.question = a, e.question = a; const i = n.match(/(?:[A-G](?:[\u3001.]|\s)?\s?.*?)(?=\s*[A-G](?:[\u3001.]|\s)?|\s*$)/gs); if (null !== i) { const t = removeOptionsStartChar(i.map((e => e.trim()))); false !== t && (e.options = t); } const s = O(e.html).find(".signDefault").attr("answer_control"); return "radio" === s && e.options.length > 1 && (e.type = "0"), "checkbox" === s && e.options.length > 1 && (e.type = "1"), "radio" === s && 0 === e.options.length && (e.type = "3"), e; }, setAnswer: e => { if (console.log(e), "3" === e.type) { let t = e.answer; return e.ques.$options.each(((e, n) => { isTrue(t) && isTrue(removeHtml(O(n).html())) && O(n).click(), isFalse(t) && isFalse(removeHtml(O(n).html())) && O(n).click(); })), false; } return true; } }, { type: "save", name: "\u6536\u5f55", match: () => location.href.includes("/hw/student/studentViewHomework.action") && location.host.includes("teach.ynou.edu.cn"), question: { html: ".e_juan02biaoti", question: ".qcontent > p:first", options: ".signDefault>.label", type: ".question-box .tag", workType: "ynou", pageType: "ynou" }, init: async () => { await waitUntil((function() { return 0 !== O(".e_juan02biaoti").length; })), O("body").css("text-align", "left"); }, answerHook: e => { e.options = []; const t = O(e.html).find(".e_juan02daan").clone(); t.find(".clear").nextAll().remove(); const n = removeHtml(t.html()), a = n.split(/[A][\u3001\.\uff0e]/)[0].trim(); if (null === a) return null; e.question = a; const i = n.match(/(?:[A-G](?:[\u3001.]|\s)?\s?.*?)(?=\s*[A-G](?:[\u3001.]|\s)?|\s*$)/gs); if (null !== i) { const t = removeOptionsStartChar(i.map((e => e.trim()))); if (0 == t) return null; e.options = t; } const s = O(e.html).find(".signDefault").attr("answer_control"); "radio" === s && e.options.length > 1 && (e.type = "0"), "checkbox" === s && e.options.length > 1 && (e.type = "1"), "radio" === s && 0 === e.options.length && (e.type = "3"); const r = O(e.html).find(".right_answer>font").text(); switch (e.type) { case "0": case "1": e.answer = r.split("").map((t => e.options[t.charCodeAt(0) - 65])); break; case "3": e.answer = isTrue(r) ? "\u6b63\u786e" : isFalse(r) ? "\u9519\u8bef" : ""; } return e; } } ], Pt = [ { type: "hook", name: "hook", match: location.host.includes("21tb.com"), main: e => { observeVuePageChange(O("#examIngEmsRightPanel")[0], (() => O("#examIngEmsRightPanel").attr("class"))); } }, { type: "ask", name: "21tb\u7b54\u9898", tips: "", match: () => location.host.includes("21tb.com") && location.href.includes("exercise/newExercise.fullExerciseTemp.do"), types: [ "0", "1", "3" ], question: { html: ".paper-content > .question-panel-middle", question: ".question-stem>.name", options: "ul.question-options>li>label", type: ".question-box .tag", workType: "21tb", pageType: "21tb" }, init: async () => { if (O(".view-paper-content").length > 0) return false; }, ischecked: e => e.parent().find("input").prop("checked"), questionHook: e => { e.question = titleClean(e.question), e.question = e.question.replace(/\uff08\d+\u5206\uff09$/, "").trim(), e.options = e.options.map((e => e.replace(/^[A-Z]\s*\.\s*/, ""))), e.options = removeStartChar(e.options); const t = O(e.html).attr("class") || ""; switch (console.log(t), true) { case t.includes("SINGLE"): e.type = "0"; break; case t.includes("MULTIPLE"): e.type = "1"; break; case t.includes("JUDGMENT"): e.type = "3", e.options = []; } return e; } }, { type: "save", name: "21tb\u6536\u5f55", match: () => location.host.includes("21tb.com") && location.href.includes("exercise/newExercise.fullExerciseTemp.do"), question: { html: "form > .question-panel-middle", question: ".question-stem>.name", options: "ul.question-options>li>label", type: ".question-box .tag", workType: "21tb", pageType: "21tb" }, init: async () => { if (console.log(O(".view-paper-content").length), 0 == O(".view-paper-content").length) return false; }, answerHook: e => { e.question = titleClean(e.question), e.question = e.question.replace(/\uff08\d+\u5206\uff09$/, "").trim(), e.options = e.options.map((e => e.replace(/^[A-Z]\s*\.\s*/, ""))), e.options = removeStartChar(e.options); const t = O(e.html).attr("questtype") || "", n = O(e.html).find(".true-answer").text().split("\uff1a")[1].trim(); switch (true) { case t.includes("SINGLE"): e.type = "0", e.answer = n.split(", ").map((t => e.options[t.charCodeAt(0) - 65])); break; case t.includes("MULTIPLE"): e.type = "1", e.answer = n.split(", ").map((t => e.options[t.charCodeAt(0) - 65])); break; case t.includes("JUDGMENT"): e.type = "3", e.options = [], e.answer = judgeAnswer(n); } return console.log(e), e; } }, { type: "ask", name: "21tb\u8003\u8bd5\u7b54\u9898", tips: "", match: () => location.host.includes("21tb.com") && location.href.includes("ems/html/examCenter/fullExamTemp.do"), types: [ "0", "1", "3" ], question: { html: ".paper-content > .question-panel-middle", question: ".question-stem", options: "ul.question-options>li>label", type: ".question-box .tag", workType: "21tb", pageType: "21tb" }, init: async () => { if (O(".view-paper-content").length > 0) return false; }, ischecked: e => e.parent().find("input").prop("checked"), questionHook: e => { const t = O(e.html).find(".question-stem").clone(); t.find(".num").remove(), e.question = titleClean(removeHtml(t.html())).replace(/^\./, ""), e.question = e.question.replace(/\uff08\d+\u5206\uff09$/, "").trim(), e.options = e.options.map((e => e.replace(/^[A-Z]\s*\.\s*/, ""))), e.options = removeStartChar(e.options); const n = O(e.html).attr("class") || ""; switch (console.log(n), true) { case n.includes("SINGLE"): e.type = "0"; break; case n.includes("MULTIPLE"): e.type = "1"; break; case n.includes("JUDGMENT"): e.type = "3", e.options = []; } return e; } } ], setEditorText = (e, t) => { var n, a; const i = null == e ? void 0 : e.ownerDocument; if (null == i ? void 0 : i.createElement) { const n = i.createElement("p"); n.textContent = t, e.innerHTML = "", e.appendChild(n); } else e.textContent = t; null == (a = null == (n = null == e ? void 0 : e.classList) ? void 0 : n.remove) || a.call(n, "ql-blank"), ((e, t) => { var n, a, i, s; const r = null == (a = null == (n = null == e ? void 0 : e.ownerDocument) ? void 0 : n.defaultView) ? void 0 : a.InputEvent, o = r ? new r("input", { bubbles: true, inputType: "insertText", data: t }) : new Event("input", { bubbles: true }); null == (i = null == e ? void 0 : e.dispatchEvent) || i.call(e, o), null == (s = null == e ? void 0 : e.dispatchEvent) || s.call(e, new Event("change", { bubbles: true })); })(e, t); }, fill168WxRichTextAnswer = (e, t) => { var n; const a = (e => Array.isArray(e) ? String(e[0] ?? "") : String(e ?? ""))(t).trim(); if (!a) return false; const i = Array.from((null == (n = null == e ? void 0 : e.querySelectorAll) ? void 0 : n.call(e, ".quill-editor")) || []); return !i.length || (i.forEach(((e, n) => { var i, s; const r = String((null == t ? void 0 : t[n]) ?? a), o = null == (i = null == e ? void 0 : e.__vue__) ? void 0 : i.quill; if (null == o ? void 0 : o.setText) return void o.setText(r, "user"); const l = null == (s = null == e ? void 0 : e.querySelector) ? void 0 : s.call(e, ".ql-editor"); l && setEditorText(l, r); })), false); }, Ht = [ { type: "hook", name: "hook", match: location.host.includes("168wangxiao.com"), main: e => { observeVuePageChange(O("#app")[0], (() => (O(".question-submit-btn").text(), O(".question-submit-btn").text() || O(".listTit>span").text())), { beforeChange: async e => { "homework-detail-container" === e && await waitUntil((function() { return 0 === O(".el-loading-mask").length; })); } }), O("#app").length >= 1 && O("#app")[0]; } }, { type: "ask", name: "168\u7f51\u6821\u7b54\u9898", tips: "168\u7f51\u6821\u76ee\u524d\u652f\u6301\u9009\u62e9\u3001\u5224\u65ad\u3001\u586b\u7a7a\u3001\u7b80\u7b54\uff0c\u5176\u4ed6\u9898\u578b\u8bf7\u53cd\u9988\u7ed9\u4f5c\u8005", match: () => location.host.includes("168wangxiao.com") && location.href.includes("/web/learningCenter/details/"), types: [ "0", "1", "2", "3", "4" ], question: { html: ".question-item-container", question: ".title-content", options: ".options .opt-content", type: ".type", workType: "168wx", pageType: "168wx" }, init: async () => (await waitUntil((function() { return 0 !== O(".question-item-container").length; })), !O(".question-submit-btn").text().includes("\u91cd\u65b0\u7b54\u9898")), ischecked: isParentChecked, questionHook: e => { const t = O(e.html).find(".type").text(); return e.type = typeMatch(t), e; }, setAnswer: e => { switch (e.type) { case "2": return fill168WxRichTextAnswer(e.html, e.answer); case "4": return O(e.html).find(".ql-editor"), O(e.html).find(".ql-editor")[0].innerHTML = e.answer[0], false; } return true; } }, { type: "save", name: "168\u7f51\u6821\u7b54\u9898", match: () => location.host.includes("168wangxiao.com") && location.href.includes("/web/learningCenter/details/"), question: { html: ".question-item-container", question: ".title-content", options: ".options .opt-content", type: ".type", workType: "168wx", pageType: "168wx" }, init: async () => (await waitUntil((function() { return 0 !== O(".question-item-container").length; })), O(".question-submit-btn").text().includes("\u91cd\u65b0\u7b54\u9898")), answerHook: e => { const t = O(e.html).find(".type").text(); switch (e.type = typeMatch(t), e.answer = O(e.html).find(".options .opt-content.is-correct-answer").map(((e, t) => removeHtml(O(t).html()))).get(), e.type) { case "2": e.options = [], e.answer = O(e.html).find(".analyze-container>.answer>.text-container>p").map(((e, t) => removeHtml(O(t).html()))).get(); break; case "3": e.options = [], e.answer = [ judgeAnswer(e.answer[0]) ]; break; case "4": e.options = [], e.answer = O(e.html).find(".analyze-container>.answer>.text-container").map(((e, t) => removeHtml(O(t).html()))).get(); } return e; } }, { type: "ask", name: "168\u7f51\u6821\u8003\u8bd5", tips: "", match: () => location.host.includes("168wangxiao.com") && location.href.includes("/web/examination/answer"), types: [ "0", "1", "2", "3", "4" ], question: { html: ".Answer-area", question: ".listTit>span", options: ".el-checkbox-group>label", type: ".type", workType: "168wx", pageType: "168wx" }, init: async () => { await waitUntil((function() { return 0 !== O(".Answer-area").length; })); }, next: () => { O('button:contains("\u4e0b\u4e00\u9898")').click(); }, ischecked: isParentChecked, questionHook: e => (e.options = removeOptionsStartChar(e.options), e.type = typeMatch(O(".tit-type").text()), e), setAnswer: e => { switch (e.type) { case "2": return fill168WxRichTextAnswer(e.html, e.answer); case "4": return O(e.html).find(".ql-editor"), O(e.html).find(".ql-editor")[0].innerHTML = e.answer[0], false; } return true; } } ], $t = /^\/web\/cc-detail\/([^/]+)\/act\/quiz-answer\/([^/?#]+)/, Lt = /^\/web(?:-old)?\/index\.php$/, Mt = { SINGLE: "0", MULTI: "1", TF: "3" }, getMosoteachQuizIds = (e = location.href) => { try { const t = new URL(e); if ("www.mosoteach.cn" !== t.hostname) return null; const n = t.pathname.match($t); return n ? { ccId: n[1], quizId: n[2] } : null; } catch { return null; } }, isMosoteachQuizAnswerUrl = (e = location.href) => null !== getMosoteachQuizIds(e), isMosoteachLegacyQuizReplyUrl = (e = location.href) => { try { const t = new URL(e); return "www.mosoteach.cn" === t.hostname && (!!Lt.test(t.pathname) && ("interaction_quiz" === t.searchParams.get("c") && "reply" === t.searchParams.get("m"))); } catch { return false; } }, isMosoteachAskUrl = (e = location.href) => isMosoteachQuizAnswerUrl(e) || isMosoteachLegacyQuizReplyUrl(e), getOptionNo = e => e.itemNo ?? e.item_no ?? 0, getSortedOptions = e => [ ...e.options || [] ].sort(((e, t) => getOptionNo(e) - getOptionNo(t))), getMosoteachTopicOptions = (e, t) => t(getSortedOptions(e).map((e => e.content || ""))), jt = ".topic-answer-align,.t-option.t-item label,.t-judge.t-item label", Ot = ".v-chip__content,.t-type", zt = "__aiAskMosoteachRouteHook", Ft = "__aiAskMosoteachHref", Dt = "__aiAskMosoteachRouteTimer"; let Nt = []; const Rt = { cleanText: (e = "") => titleClean(removeHtml(e)), cleanOptions: e => removeStartChar(e.map((e => removeHtml(e)))), judgeAnswer: judgeAnswer }, getMosoteachQuestionType = (e = "", t = []) => ((e = "", t = []) => { const n = Mt[e.trim()]; return "0" === n && (e => 2 === e.length && e.every((e => /^(\u6b63\u786e|\u9519\u8bef|\u5bf9|\u9519|\u662f|\u5426|T|F|true|false)$/i.test(e.trim()))))(t) ? "3" : n || ""; })(e, t) || typeMatch(e), getMosoteachQuestionElements = () => isMosoteachLegacyQuizReplyUrl() ? O(".topic-item") : O(".pt-10.d-flex.list-item:has(.topic-subject):has(.topic-answer-align)"), getMosoteachLegacyTopics = () => { var e, t; const n = O("#app")[0], a = null == (t = null == (e = null == n ? void 0 : n.__vue__) ? void 0 : e.$data) ? void 0 : t.topics; return Array.isArray(a) ? a : []; }, cacheMosoteachAnswer = e => { const t = ((e, t, n, a) => { const i = a.cleanText(e), s = ((e, t) => t(e).sort().join("\n"))(t, a.cleanOptions); return n.find((e => { const t = getMosoteachTopicOptions(e, a.cleanOptions).sort().join("\n"); return a.cleanText(e.subject || "") === i && t === s; })); })(e.question, e.options, Nt, Rt); if (!t) return; const n = ((e, t) => { const n = t.cleanOptions(getSortedOptions(e).map((e => e.content || ""))); return Array.isArray(e.answers) && e.answers.length > 0 ? e.answers.map((e => n[e] || "")).filter(Boolean) : "TF" === e.type ? t.judgeAnswer(e.tfAnswer || "") : []; })(t, Rt); if (!n.length) return; const a = { type: e.type, question: e.question, options: "3" === e.type ? [] : e.options, answer: n }; Answer.cacheAnswer(a); }, parseMosoteachDomQuestion = e => { const t = O(e.html), n = t.find(".topic-subject").first().text(), a = t.find(".topic-answer-align"); if (!n || !a.length) return e; e.question = Rt.cleanText(n); const i = a.map(((e, t) => O(t).find(".topic-answer").first().text() || O(t).text())).get(); return e.options = Rt.cleanOptions(i), e.$options = (e => O(e.map(((e, t) => O(t).closest("label,.d-flex.align-start")[0] || t)).get()))(a), e.type = getMosoteachQuestionType(t.find(".v-chip__content").first().text(), e.options), cacheMosoteachAnswer(e), e; }, parseMosoteachLegacyQuestion = (e, t) => { const n = O(e.html), a = getMosoteachLegacyTopics()[t], i = n.find(jt), s = i.map(((e, t) => O(t).text())).get(); if (a) e.question = Rt.cleanText(a.subject || ""), e.options = ((e, t, n) => { const a = n(t); return a.length ? a : getMosoteachTopicOptions(e || {}, n); })(a, s, Rt.cleanOptions), e.type = getMosoteachQuestionType(a.type, e.options); else { const t = n.find(".t-subject").first().text(); e.question = Rt.cleanText(t || e.question), e.options = Rt.cleanOptions(s.length ? s : e.options), e.type = getMosoteachQuestionType(n.find(Ot).first().text() || e.type, e.options); } return i.length && (e.$options = i), cacheMosoteachAnswer(e), e; }, watchMosoteachRouteChange = () => { const e = se; if (e[zt]) return; e[zt] = true, e[Ft] = location.href; const checkRouteChange = () => { e[Ft] !== location.href && (e[Ft] = location.href, clearTimeout(e[Dt]), e[Dt] = setTimeout((() => vuePageChange()), 100)); }, bindHistoryChange = e => { const t = history[e]; history[e] = function(...e) { const n = t.apply(this, e); return setTimeout(checkRouteChange, 0), n; }; }; bindHistoryChange("pushState"), bindHistoryChange("replaceState"), window.addEventListener("popstate", (() => setTimeout(checkRouteChange, 0))); }, Bt = [ { type: "hook", name: "\u4e91\u73ed\u8bfe\u8def\u7531\u76d1\u542c", match: () => "www.mosoteach.cn" === location.host, main: () => { watchMosoteachRouteChange(); } }, { type: "ask", name: "\u4e91\u73ed\u8bfe\u7b54\u9898", tips: "", match: () => "www.mosoteach.cn" === location.host && isMosoteachAskUrl(), types: [ "0", "1", "3" ], question: { html: getMosoteachQuestionElements, question: ".topic-subject,.t-subject", options: jt, type: Ot, workType: "mosoteach", pageType: "mosoteach" }, init: async () => { if (await sleep(500), !isMosoteachAskUrl()) return Nt = [], false; return !!(await (async () => { for (let e = 0; e < 30; e++) { if (getMosoteachQuestionElements().length > 0) return true; await sleep(200); } return false; })()) && (Nt = isMosoteachQuizAnswerUrl() ? await (async () => { const e = getMosoteachQuizIds(), t = localStorage.getItem("teach_token") || ""; if (!e || !t) return []; try { const n = await fetch(`https://coreapi.mosoteach.cn/ccs/${e.ccId}/quizzes/${e.quizId}/topics?_ts=${Date.now()}`, { headers: { accept: "application/json, text/plain, */*", "x-client-app-id": "MTWEB", "x-client-version": "6.0.0", "x-security-type": "SECURITY_TYPE_TOKEN", "x-token": t }, credentials: "omit" }); if (!n.ok) return []; const a = await n.json(); return Array.isArray(null == a ? void 0 : a.topics) ? a.topics : []; } catch (n) { return []; } })() : getMosoteachLegacyTopics(), true); }, ischecked: e => { const t = e.find("input").add(e.closest("label,.d-flex.align-start").find("input")).first(); return e.hasClass("is-checked") || e.hasClass("v-item--active") || t.prop("checked") || "true" === t.attr("aria-checked"); }, questionHook: (e, t) => isMosoteachLegacyQuizReplyUrl() ? parseMosoteachLegacyQuestion(e, t) : parseMosoteachDomQuestion(e) } ], Gt = [ { type: "hook", name: "hook", match: "www.learnin.com.cn" === location.host, main: e => { observeVuePageChange(O("#app")[0], (() => { try { return O(".page-student-course-topic-do-container")[0].__vue__.$data.topic.studentTopic.id; } catch (e) { return ""; } })); } }, { type: "save", name: "learnin\u6536\u5f55", match: () => "www.learnin.com.cn" === location.host && location.href.includes("/user/#/user/student/course/") && 0 == O("button:contains('\u63d0\u4ea4\u4f5c\u4e1a')").length, question: { html: ".store-question-item-container", question: ".question-title", options: ".question-info>.question-option-list>.option-item", type: ".item-question-header>.header-left", workType: "learnin", pageType: "learnin" }, init: async () => { await waitUntil((function() { return isExist(".store-question-item-container"); })); }, answerHook: (e, t) => { const n = O(".store-question-item-container").eq(t)[0].__vue__.question; switch (n.questionTypeCode) { case "judgment": e.type = "3"; break; case "single": e.type = "0"; break; case "multiple": e.type = "1"; break; default: return e; } e.question = titleClean(removeHtml(n.questionTitle)); let a = [], i = []; return n.optionList.forEach((e => { const t = removeHtml(e.content); e.isAnswer && i.push(t), a.push(t); })), e.options = a, e.answer = i, "3" == e.type && (e.options = [], e.answer = judgeAnswer(i[0])), e; } }, { type: "ask", name: "learnin\u7b54\u9898", tips: "", match: () => "www.learnin.com.cn" === location.host && location.href.includes("/user/#/user/student/course/") && 1 == O("button:contains('\u63d0\u4ea4\u4f5c\u4e1a')").length, types: [ "0", "1", "3" ], question: { html: ".store-question-item-container", question: ".question-title", options: ".question-info>.question-option-list>.option-item>.option-index", type: ".item-question-header>.header-left", workType: "learnin", pageType: "learnin" }, init: async () => { await waitUntil((function() { return isExist(".store-question-item-container"); })); }, ischecked: e => e.hasClass("active"), questionHook: (e, t) => { const n = O(e.html)[0].__vue__.question; switch (n.questionTypeCode) { case "judgment": e.type = "3"; break; case "single": e.type = "0"; break; case "multiple": e.type = "1"; break; default: return e; } e.question = titleClean(removeHtml(n.questionTitle)); let a = []; return n.optionList.forEach((e => { const t = removeHtml(e.content); a.push(t); })), e.options = a, "3" == e.type && (e.options = []), e; } } ], Kt = [ { type: "hook", name: "hook", match: location.host.includes("ouchn.edu.cn"), main: e => { observeVuePageChange(O("#app")[0], (() => getUrl())); } }, { type: "ask", name: "\u7535\u5927\u7b54\u9898", tips: "", match: () => location.host.includes("ouchn.edu.cn") && location.href.includes("learningPlatform/#/myExamDetails/examQuestion"), types: [ "0" ], question: { html: ".everyQuest", question: ".topicTitle", options: ".optionList .topicTitle", type: ".question-box .tag", workType: "ouchn", pageType: "ouchn" }, init: async () => { await waitUntil((function() { return isExist(".everyQuest"); })); }, ischecked: isParentChecked, questionHook: e => (e.type = "0", e) }, { type: "save", name: "\u7535\u5927\u6536\u5f55", match: () => location.host.includes("ouchn.edu.cn") && location.href.includes("learningPlatform/#/myExamDetails/testPaper"), question: { html: ".everyQuest", question: ".topicTitle", options: ".optionList .topicTitle", type: ".question-box .tag", workType: "ouchn", pageType: "ouchn" }, init: async () => { await waitUntil((function() { return isExist(".everyQuest"); })); }, answerHook: e => { const t = O(e.html).find('.rightAndWrong>span:contains("\u6b63\u786e\u7b54\u6848")').text().replace("\u6b63\u786e\u7b54\u6848\uff1a", "").trim(), n = e.options; let a = []; return t.split("").forEach((e => { a.push(n[e.charCodeAt(0) - 65]); })), 1 == a.length ? e.type = "0" : e.type = "1", e.answer = a, e; } } ], Vt = [ { type: "hook", name: "mooc", match: "www.icourse163.org" === location.host, main: e => { observeVuePageChange(O("#courseLearn-inner-box")[0], (() => O("#courseLearn-inner-box > div:eq(0)").attr("class")), { beforeChange: async e => { "homework-detail-container" === e && await waitUntil((function() { return 0 === O(".el-loading-mask").length; })); } }); } }, { type: "ask", name: "mooc\u7b54\u9898", tips: "\u4e2d\u56fd\u5927\u5b66MOOC\u9650\u5236\u7b54\u9898\u901f\u5ea6\uff0c\u8bf7\u4e0d\u8981\u8fc7\u5feb", match: () => "www.icourse163.org" === location.host && location.href.includes("#/learn/quiz?id="), types: [ "0", "1", "2", "3" ], question: { html: ".u-questionItem", question: ".f-richEditorText", options: "ul.choices>li>input", type: ".qaCate.j-qacate.f-fl", workType: "mooc", pageType: "mooc" }, init: async () => { await waitUntil((function() { return O(".u-questionItem").length, 0 !== O(".u-questionItem").length; })); }, ischecked: isParentChecked, questionHook: (e, t) => { O(e.html).find(".qaCate.j-qacate.f-fl > span:eq(0)").attr("class"); const n = se.learnUtilQuestionList[t]; switch (e.question = removeHtml(n.title), e.options = n.options.map((e => removeHtml(e.content))), n.type) { case 1: e.type = "0"; break; case 2: e.type = "1"; break; case 3: e.type = "2"; break; case 4: e.type = "3", e.options = []; break; default: n.type, e.type = "8"; } return e; }, setAnswer: e => { switch (e.type) { case "2": return O(e.html).find(".u-baseinputui>textarea").each(((t, n) => { O(n).val(e.answer[t]), O(n).focus(), O(n).blur(); })), false; case "3": let t = e.answer; O(e.html).find("ul.choices>li").each(((e, n) => { isTrue(t) && O(n).find(".u-icon-correct").length > 0 && O(n).find("input").click(), isFalse(t) && O(n).find(".u-icon-wrong").length > 0 && O(n).find("input").click(); })); } return true; } }, { type: "save", name: "\u4e2d\u56fd\u5927\u5b66mooc\u6536\u5f55", match: () => "www.icourse163.org" === location.host && location.href.includes("#/learn/quizscore?id="), question: { html: ".u-questionItem", question: ".f-richEditorText", options: "ul.choices li>input", type: ".qaCate.j-qacate.f-fl", workType: "mooc", pageType: "mooc" }, init: async () => { await waitUntil((function() { return O(".u-questionItem").length, 0 !== O(".u-questionItem").length; })); }, answerHook: (e, t) => { const n = se.learnUtilQuestionList[t]; e.question = removeHtml(n.title); let a = [], i = []; switch (n.options.forEach((e => { a.push(removeHtml(e.content)), e.answer && i.push(removeHtml(e.content)); })), e.options = a, e.answer = i, n.type) { case 1: e.type = "0"; break; case 2: e.type = "1"; break; case 3: e.type = "2", e.answer = [ n.stdAnswer ]; break; case 4: e.type = "3", e.options = []; break; default: n.type; } return e; } } ], Wt = [ { host: "swufe-online.com", display: "\u897f\u8d22\u5728\u7ebf", key: "swufe" }, { host: "jsnu.edu.cn", display: "\u6c5f\u82cf\u5e08\u5927", key: "jsnu" } ], matchSite = () => Wt.find((e => location.host.includes(e.host))), siteDisplay = () => { var e; return (null == (e = matchSite()) ? void 0 : e.display) ?? "learnspace"; }, siteKey = () => { var e; return (null == (e = matchSite()) ? void 0 : e.key) ?? "learnspace"; }, Qt = [ "learnspace/course/test/coursewareTest_intoRedoTestPage.action", "learnspace/learn/learn/templateeight/index.action", "learnspace/course/test/coursewareTest_intoTestPage.action" ], Jt = [ "learnspace/course/test/coursewareTest_intoTestAnswerPage.action", "learnspace/learn/learn/templateeight/index.action" ], pathHit = e => e.some((e => location.href.includes(e))), titleCleanup = e => e.replace(/^[.*?]\s*/, "").replace(/^\u3010.*?\u3011\s*/, "").replace(/\s*\uff08\d+\.\d+\u5206\uff09$/, "").replace(/^\d+\./, "").trim().replace(/^\d+\uff0e/, "").trim().replace(/^\d+ ./, "").trim(), Yt = [ { type: "ask", get name() { return `${siteDisplay()}\u7b54\u9898`; }, tips: "", match: () => Boolean(matchSite()) && pathHit(Qt), types: [ "0", "1", "3" ], question: { html: ".bank_test > .test_item", question: ".test_item_tit", options: ".test_item_theme>ul>li>label, .test_item_theme>label", type: ".question-box .tag", get workType() { return siteKey(); }, get pageType() { return siteKey(); } }, init: async () => { await waitUntil((function() { return isExist(".bank_test > .test_item"); })); }, ischecked: isParentChecked, questionHook: e => { const t = O(e.html).find(".test_item_tit").clone(); if (t.find(".tipNodo").remove(), e.question = removeHtml(t.html()), e.question = titleClean(e.question), e.type = typeMatch(O(e.html).prevAll(".test_item_type").first().text()), e.question = titleCleanup(e.question), e.options = removeStartChar(e.options), "3" === e.type) e.options = []; return e; } }, { type: "save", get name() { return `${siteDisplay()}\u9636\u6bb5\u6d4b\u9a8c\u6536\u5f55`; }, match: () => Boolean(matchSite()) && pathHit(Jt), question: { html: ".bank_test > .test_item", question: ".test_item_tit", options: ".test_item_theme>ul>li>.zdh_op_con", type: ".question-box .tag", get workType() { return siteKey(); }, get pageType() { return siteKey(); } }, init: async () => {}, answerHook: e => { e.type = typeMatch(O(e.html).prevAll(".test_item_type").first().text()), e.question = titleCleanup(e.question), e.options = removeStartChar(e.options); const t = O(e.html).find(".test_item_key_tit").text().replace("\u53c2\u8003\u7b54\u6848\uff1a", "").trim(); switch (e.type) { case "0": case "1": e.answer = t.split("").map((t => { let n = t.charCodeAt() - 65; return e.options[n]; })); break; case "3": e.answer = judgeAnswer(t), e.options = []; } return e; } }, { type: "ask", name: "\u897f\u8d22\u5728\u7ebf\u7efc\u5408\u7ec3\u4e60\u7b54\u9898", tips: "\u897f\u8d22\u5728\u7ebf\u6536\u5f55\u8bf7\u91cd\u65b0\u70b9\u51fb\u9898\u578b\u5207\u6362\u89e6\u53d1", match: () => location.host.includes("swufe-online.com") && location.href.includes("/learnspace/userDefine/t_test.jsp?courseId="), types: [ "0", "1", "3" ], question: { html: ".timu_title", question: ".timu_title", options: ".test_item_theme>ul>li", type: ".question-box .tag", workType: "swufe", pageType: "swufe" }, init: async () => { if (await waitUntil((function() { return isExist(".timu_title"); })), !document.body.innerHTML.includes("\u63d0\u4ea4\u7b54\u9898\u540e\u663e\u793a")) return false; O(".layui-tab-title>li").on("click", (function() { vuePageChange(); })); }, ischecked: isParentChecked, questionHook: (e, t) => { const n = O(e.html).attr("id"); return e.type = typeMatch(O(".layui-this").text()), e.question = removeHtml(O(e.html).html()), e.options = O(`#${n}`).map((function() { let t = [], n = O(this).next(), a = []; for (;n.length && n.hasClass("question-item-opt"); ) a.push(removeHtml(n[0].outerHTML)), t.push(n), n = n.next(); return e.$options = O(t.map((e => e[0]))).find("label"), a; })).get(), e.options = removeStartChar(e.options), e; } }, { type: "save", name: "\u897f\u8d22\u5728\u7ebf\u7efc\u5408\u4f5c\u4e1a\u6536\u5f55", match: () => location.host.includes("swufe-online.com") && location.href.includes("/learnspace/userDefine/t_test.jsp?courseId="), question: { html: ".timu_title", question: ".timu_title", options: ".test_item_theme>ul>li", type: ".question-box .tag", workType: "swufe", pageType: "swufe" }, init: async () => { if (await waitUntil((function() { return isExist(".timu_title"); })), document.body.innerHTML.includes("\u63d0\u4ea4\u7b54\u9898\u540e\u663e\u793a")) return false; O(".layui-tab-title>li").on("click", (function() { vuePageChange(); })); }, answerHook: e => { const t = O(e.html).attr("id"); switch (e.type = typeMatch(O(".layui-this").text()), e.question = removeHtml(O(e.html).html()), e.options = O(`#${t}`).map((function() { let t = [], n = O(this).next(), a = []; for (;n.length && n.hasClass("question-item-opt"); ) a.push(removeHtml(n[0].outerHTML)), t.push(n), n = n.next(); return e.$options = O(t.map((e => e[0]))).find("label"), a; })).get(), e.options = removeStartChar(e.options), e.type) { case "0": case "1": const n = O(`#${t}`).nextAll(".ans").first().find("span:eq(0)").text(); e.answer = n.trim().split("").map((t => { let n = t.charCodeAt() - 65; return e.options[n]; })); break; case "3": e.answer = judgeAnswer(O(`#${t}`).nextAll(".ans").first().find("span:eq(0)").text().trim()), e.options = []; break; case "7": case "4": e.answer = removeHtml(O(`#${t}`).nextAll(".ans").first().html()).replace("\u6b63\u786e\u7b54\u6848\uff1a", "").trim(), e.options = []; break; default: e.type; } return e; } } ], Xt = [ { type: "ask", name: "\u91cd\u5e86\u6cd5\u6cbb\u8003\u8bd5\u7b54\u9898", tips: "\u672c\u5e73\u53f0\u65e0\u7b54\u6848\u6536\u5f55\uff0c\u9700\u8981\u81ea\u884c\u8865\u5145\u9898\u5e93\uff0c\u5efa\u8bae\u4f7f\u7528\u9898\u5e93\u5bfc\u5165\u529f\u80fd", match: () => "ks.cqsdx.cn" === location.host && location.pathname.includes("/exam/user/bind"), types: [ "0", "1", "3" ], question: { html: ".qlist", question: "span:eq(1)", options: "label", type: ".badge.badge-danger", workType: "cqsdx", pageType: "cqsdx" }, init: async () => { await waitUntil((function() { return isExist(".qlist"); })); }, toquestion: e => { O(`#question_card button:eq(${e})`).click(); }, ischecked: e => e.find("div").hasClass("checked"), questionHook: e => { const t = O(e.html).find(".badge.badge-danger").text(); if (e.type = typeMatch(t), e.question = e.question.replace(/\u206B/g, "").trim(), e.options = e.options.map((e => e.replace(/\u206B/g, "").trim())), "3" === e.type) e.options = []; return e; } } ], Zt = [ { type: "hook", name: "hook", match: location.host.includes("telfri-edu.com"), main: e => { observeVuePageChange(O("#app")[0], (() => getUrl())); } }, { type: "ask", name: "olearn\u7b54\u9898", tips: "", match: () => location.host.includes("telfri-edu.com") && location.href.includes("/learn/homework/do/"), types: [ "0", "1", "3" ], question: { html: ".topic-group>.topic-container", question: ".topic-title", options: ".topic-answer .radio-wrap .radio-text", type: ".question-box .tag", workType: "olearn", pageType: "olearn" }, init: async () => { await waitUntil((function() { return isExist(".topic-group>.topic-container"); })); }, ischecked: e => e.hasClass("is-active"), questionHook: e => { let t = O(e.html).prevAll(".topic-title").first().find(".title-bold").text().trim(); return e.$options = O(e.html).find(".topic-answer .radio-wrap>label"), e.type = typeMatch(t), e; } }, { type: "save", name: "olearn\u6536\u5f55", match: () => location.host.includes("telfri-edu.com") && location.href.includes("/learn/homework/show/"), question: { html: ".topic-group>.topic-container", question: ".topic-title", options: ".topic-answer .radio-wrap .radio-text", type: ".question-box .tag", workType: "olearn", pageType: "olearn" }, init: async () => { await waitUntil((function() { return isExist(".topic-group>.topic-container"); })); }, answerHook: e => { let t = O(e.html).prevAll(".topic-title").first().find(".title-bold").text().trim(); e.type = typeMatch(t); const n = O(e.html).find(".standard-answer>.analysis-text").text().trim(); switch (e.type) { case "0": case "1": e.answer = n.split("").map((t => e.options[t.charCodeAt(0) - 65])); break; case "3": e.options = [], e.answer = judgeAnswer(n); } return e; } } ], en = [ { type: "hook", name: "hook", match: () => location.host.includes("yxbyun.com") && !location.host.includes("yxb4student"), main: e => { observeVuePageChange(O("#app")[0], (() => O("#app")[0].__vue__.$route.path)); } }, { type: "hook", name: "\u4ebf\u5b66\u5b9d\u65b0\u7248hook", match: () => location.host.includes("yxb4student.yxbyun.com"), main: e => { O("#app")[0] && observeVuePageChange(O("#app")[0], (() => O(".danxuan .tm").map(((e, t) => t.id)).get().join(","))); } }, { type: "save", name: "\u4ebf\u5b66\u5b9d\u6536\u5f55", match: () => location.host.includes("yxbyun.com") && (location.href.includes("yxbstudent/#/testPaper") || location.href.includes("yxbstudent/#/finalExam")), question: { html: ".test_wrap", question: ".content", options: ".el-radio-group input", type: ".question-box .tag", workType: "yxbyun", pageType: "yxbyun" }, init: async () => { await waitUntil((function() { return isExist(".test_wrap"); })); }, answerHook: e => { var t; const n = O(e.html).find("div:eq(0)")[0].__vue__, a = (null == (t = n.pagerData) ? void 0 : t.question) || n.smallPaper.questionTopic; return e.type = typeMatch(n.queTypeName), e.question = titleClean(removeHtml(a.questionTitle)), e.options = (a.optionList || a.questionOptionList).map((e => removeHtml(e.questionContent))), [ "0", "1", "3" ].includes(e.type) && (e.answer = a.questionAnswer.split(",").map((t => e.options[t.charCodeAt(0) - 65]))), "3" === e.type && (e.options = [], e.answer = judgeAnswer(e.answer)), e; } }, { type: "save", name: "\u4ebf\u5b66\u5b9d\u8003\u8bd5\u6536\u5f55", match: () => location.host.includes("yxb4student.yxbyun.com") && location.pathname.includes("/kaoshicenter"), question: { html: ".danxuan", question: ".tm", options: ".xxbh", type: ".tx", workType: "yxbyun", pageType: "yxbyun" }, init: async () => { if (!isExist(".danxuan")) return false; try { return await waitUntil((() => isExist(".danxuan .yuejuanqu")), { timeout: 8e3 }), !0; } catch { return false; } }, answerHook: e => { const t = O(e.html); e.type = typeMatch(t.find(".tx").text()), e.question = titleClean(removeHtml(t.find(".tm").html())), e.options = e.$options.map(((e, t) => removeHtml(O(t).siblings(".xxnr").html()))).get(); let n = ""; t.find(".yuejuanqu > div").each(((e, t) => { const a = removeHtml(O(t).html()); a.startsWith("\u7b54\u6848\uff1a") && (n = a.replace("\u7b54\u6848\uff1a", "").trim()); })); const lettersToOptions2 = () => (n.match(/[A-Za-z]/g) || []).map((t => e.options[t.toUpperCase().charCodeAt(0) - 65])).filter((e => null != e && "" !== e)); switch (e.type) { case "0": case "1": e.answer = lettersToOptions2(); break; case "3": { const t = lettersToOptions2(); e.answer = judgeAnswer(t[0] || n), e.options = []; break; } default: e.answer = n ? [ n ] : []; } return e; } }, { type: "ask", name: "\u4ebf\u5b66\u5b9d\u7b54\u9898", match: () => location.host.includes("yxbyun.com") && (location.href.includes("yxbstudent/#/testPaper") || location.href.includes("yxbstudent/#/finalExam")), types: [ "0", "1", "3" ], question: { html: ".test_wrap", question: ".content", options: ".answer>.daan,.el-radio-group>label", type: ".question-box .tag", workType: "yxbyun", pageType: "yxbyun" }, init: async () => { await waitUntil((function() { return isExist(".test_wrap"); })); }, ischecked: e => e.hasClass("active"), questionHook: e => { var t; const n = O(e.html).find("div:eq(0)")[0].__vue__, a = (null == (t = n.pagerData) ? void 0 : t.question) || n.smallPaper.questionTopic; if (e.type = typeMatch(n.queTypeName), e.question = titleClean(removeHtml(a.questionTitle)), e.options = (a.optionList || a.questionOptionList).map((e => removeHtml(e.questionContent))), "3" === e.type) e.options = []; return e; }, setAnswer: e => { if ("3" === e.type) { let t = e.answer; return e.ques.$options.each(((e, n) => { isTrue(t) && isTrue(removeHtml(O(n).parent().html())) && O(n).click(), isFalse(t) && isFalse(removeHtml(O(n).parent().html())) && O(n).click(), removeHtml(O(n).parent().html()); })), false; } return true; } }, { type: "ask", name: "\u4ebf\u5b66\u5b9d\u4f5c\u4e1a/\u8003\u8bd5\u7b54\u9898", match: () => location.host.includes("yxb4student.yxbyun.com") && (location.pathname.includes("/zuoye") || location.pathname.includes("/exam")), types: [ "0", "1", "3" ], question: { html: ".danxuan", question: ".tm", options: ".xxbh", type: ".tx", workType: "yxbyun", pageType: "yxbyun" }, init: async () => { await waitUntil((function() { return isExist(".danxuan .xuanxiang"); })); }, ischecked: e => e.hasClass("active"), questionHook: e => (e.type = typeMatch(O(e.html).find(".tx").text()), e.options = e.$options.map(((e, t) => removeHtml(O(t).siblings(".xxnr").html()))).get(), "3" === e.type && (e.options = []), e), setAnswer: e => { if ("3" === e.type) { const t = e.answer; return e.ques.$options.each(((e, n) => { const a = removeHtml(O(n).siblings(".xxnr").html()); isTrue(t) && isTrue(a) && O(n).click(), isFalse(t) && isFalse(a) && O(n).click(); })), false; } return true; } } ], tn = [ { type: "hook", name: "hook", match: location.host.includes("wdjycj.com") || location.host.includes("iwdjy.com"), main: e => { observeVuePageChange(O("#app")[0], (() => getUrl())); } }, { type: "save", name: "\u6587\u9876\u5728\u7ebf\u6536\u5f55", match: () => location.href.includes("/testpaper-test-result?resultId=") || location.href.includes("/testpaper-test?id"), question: { html: ".st-item", question: ".st-title", options: ".st-main>p", type: ".question-box .tag", workType: "wdzx", pageType: "wdzx" }, init: async () => { await waitUntil((function() { return isExist(".st-item"); })); let e = []; try { O(".exam-html")[0].__vue__.test.lists.forEach(((t, n) => { t.question_lists.forEach(((t, n) => { e.push(t); })); })); } catch (t) {} unsafeWindow.ques = e; }, answerHook: (e, t) => { var n; const a = unsafeWindow.ques[t], i = []; switch (e.question = titleClean(removeHtml(a.content)), e.options = (null == (n = a.appanswer) ? void 0 : n.map((e => { const t = removeHtml(e.text); return e.right && i.push(t), removeHtml(t); }))) || [], a.tm_type) { case 4: e.type = "3", e.answer = judgeAnswer("1" == a.answer ? "\u6b63\u786e" : "0" == a.answer ? "\u9519\u8bef" : ""); break; case 5: e.type = "2", e.question = e.question.replace(/{#answer}/g, "_____"), e.answer = a.answer.split("|").map((e => e.includes("\u203b") ? e.split("\u203b")[0] : e)); break; case 2: e.type = "0", e.answer = i; break; case 3: e.type = "1", e.answer = i; break; case 1: e.type = "4", e.answer = removeHtml(a.answer); break; default: a.tm_type; } return e; } }, { type: "ask", name: "\u6587\u9876\u5728\u7ebf\u7b54\u9898", tips: "", match: () => location.href.includes("/testpaper-test?id=") || location.href.includes("/final-exam"), types: [ "0", "1", "2", "3" ], question: { html: ".st-item", question: ".st-title", options: ".st-main>p", type: ".question-box .tag", workType: "wdzx", pageType: "wdzx" }, init: async () => { await waitUntil((function() { return isExist(".st-item"); })); }, toquestion: e => { O(`.card-box .bj:eq(${e})`).click(); }, ischecked: e => O(e).find("input").prop("checked"), questionHook: (e, t) => { e.options = removeOptionsStartChar(e.options); const n = O(e.html).find(".st-title").clone(); O(n).find("strong").remove(), e.question = removeHtml(O(n).html()); let a = O(e.html).prevAll(".title").first().text().trim(); return e.type = typeMatch(a), e.$options = O(e.html).find(".answer-box>.answer>label"), e; }, setAnswer: e => { switch (e.type) { case "4": case "5": case "6": case "7": return O(e.html).find(".answer-text>div")[0].__vue__.msg.yourAnswer = e.answer[0], O(e.html).find(".quill-editor").map(((t, n) => { n.__vue__.value = e.answer[t]; })), false; case "2": let setYourAnswerById = function(e, t, n) { for (let a of e) if (Array.isArray(a.itemlists)) for (let e of a.itemlists) if (e.id === t) return e.yourAnswer = n, true; return false; }; const t = O(e.html).find("span.bj input").attr("name"); return setYourAnswerById(O(".exam-html")[0].__vue__.answerCard, Number(t), e.answer), e.answer, false; } return true; } } ], cleanOptionText = e => e.replace(/ /g, " ").replace(/\uff08\u60a8\u7684\u9009\u62e9\uff09/g, "").replace(/\uff08\u6b63\u786e\u7b54\u6848\uff09/g, "").replace(/^\s*[A-Z]\s*[\.\u3001\uff0e]\s*/, "").replace(/\s+/g, " ").trim(), getSectionType = e => { const t = O(e)[0]; if (!t) return typeMatch(""); const n = (t.closest(".exam-section") || document).querySelectorAll(".section-title, .exam-title"); let a = ""; for (let i = 0; i < n.length; i++) { const e = n[i]; if (!(e.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING)) break; a = e.textContent || ""; } return typeMatch(a); }, nn = [ { type: "ask", name: "\u6b66\u6c49\u7406\u5de5\u7ee7\u7eed\u6559\u80b2\u7b54\u9898", tips: "\u6b66\u6c49\u7406\u5de5\u7ee7\u7eed\u6559\u80b2\u4ec5\u652f\u6301\u9009\u62e9\u3001\u5224\u65ad\u9898\u5176\u4ed6\u9898\u578b\u6682\u4e0d\u652f\u6301\uff0c\u82e5\u6709\u9700\u8981\u8bf7\u53cd\u9988\u7ed9\u4f5c\u8005", match: () => location.href.includes("/student/study/examPage") && !location.href.includes("/student/study/examPageShow"), question: { html: ".question-item", question: ".question-content", options: ".answer-option .el-radio, .answer-option .el-checkbox", type: "", workType: "whut", pageType: "whut" }, init: async () => { await waitUntil((function() { return 0 !== O(".question-item").length; })); }, ischecked: e => e.find("input").is(":checked"), questionHook: e => { e.question = titleClean(e.question), e.question = e.question.replace(/^\d+\s*[\u3001.\uff09)]/, "").trim(); const t = []; return e.$options.each(((e, n) => { const a = O(n).clone(); a.find(".el-radio__input, .el-checkbox__input, input").remove(), t.push(cleanOptionText(a.text())); })), e.options = t, e.type = getSectionType(e.html), e.type, e; } }, { type: "save", name: "\u6b66\u6c49\u7406\u5de5\u7ee7\u7eed\u6559\u80b2\u6536\u5f55", match: () => location.href.includes("/student/study/examPageShow"), question: { html: ".question-item", question: ".question-content", options: ".option-item", type: "", workType: "whut", pageType: "whut" }, init: async () => { await waitUntil((function() { return 0 !== O(".question-item").length && 0 !== O(".question-item .correct-answer, .question-item .option-item.correct").length; })); }, answerHook: e => { e.question = titleClean(e.question), e.question = e.question.replace(/^\d+\s*[\u3001.\uff09)]/, "").trim(); const t = []; e.$options.each(((e, n) => { const a = O(n).clone(); a.find(".option-label, .user-choice, .correct-answer").remove(), t.push(cleanOptionText(a.text())); })), e.options = t, e.type = getSectionType(e.html); const n = []; return e.$options.each(((t, a) => { (O(a).hasClass("correct") || O(a).find(".correct-answer").length > 0) && n.push(e.options[t]); })), "3" === e.type ? (e.answer = n.length ? n[0] : "", e.options = []) : e.answer = n, e; } } ], an = [ { type: "save", name: "\u4e1c\u5317\u8d22\u7ecf\u5927\u5b66\u6210\u6559\u6536\u5f55", match: () => location.host.includes("dufe.edu.cn") && (location.href.includes("/HomeWorkPaper") || location.href.includes("/HomeWorkHistoryPaper") || location.href.includes("/ExercisesPaper")), question: { html: ".QuestTrunk,.HistoryQuestTrunk", question: ".CBTPaperMain-divInline", options: ".CBTPaperMain-options li", type: ".question-box .tag", workType: "dufe", pageType: "dufe" }, init: async () => { await waitUntil((function() { return isExist(".QuestTrunk,.HistoryQuestTrunk"); })); }, answerHook: e => { const t = e.html.vtree[0].vmodel._trunks[0], n = e.html.vtree[0].vmodel._type; let a = [], i = []; const getOption = () => { t.QUESTION_OPTIONS.forEach((e => { const t = removeHtml(e.OPTION_CONTENT); "1" === e.ISTRUE && a.push(t), i.push(t); })); }; switch (n) { case "001": e.type = "0", getOption(); break; case "002": e.type = "1", getOption(); break; case "004": e.type = "3", e.options = [], a = "1" === t.QUESTION_OPTIONS[0].ISTRUE ? [ "\u6b63\u786e" ] : "0" === t.QUESTION_OPTIONS[0].ISTRUE ? [ "\u9519\u8bef" ] : []; break; case "005": e.type = "4", a = [ removeHtml(t.QUESTION_OPTIONS[0].OPTION_CONTENT) ]; } return e.question = titleClean(t.QUESTION_TITLE), e.options = i, e.answer = a, e; } }, { type: "ask", name: "\u4e1c\u5317\u8d22\u7ecf\u5927\u5b66\u6210\u6559\u7b54\u9898", match: () => location.host.includes("dufe.edu.cn") && (location.href.includes("/HomeWorkPaper") || location.href.includes("/ExercisesPaper")), types: [ "0", "1", "3", "4" ], question: { html: ".QuestTrunk", question: ".CBTPaperMain-divInline", options: ".CBTPaperMain-options li>label", type: ".question-box .tag", workType: "dufe", pageType: "dufe" }, init: async () => {}, ischecked: e => e.parent().find("input").prop("checked"), questionHook: e => { const t = e.html.vtree[0].vmodel._trunks[0], n = e.html.vtree[0].vmodel._type; let a = [], i = []; const getOption = () => { t.QUESTION_OPTIONS.forEach((e => { const t = removeHtml(e.OPTION_CONTENT); "1" === e.ISTRUE && a.push(t), i.push(t); })); }; switch (n) { case "001": e.type = "0", getOption(); break; case "002": e.type = "1", getOption(); break; case "004": e.type = "3", e.options = [], a = "1" === t.QUESTION_OPTIONS[0].ISTRUE ? [ "\u6b63\u786e" ] : "0" === t.QUESTION_OPTIONS[0].ISTRUE ? [ "\u9519\u8bef" ] : []; break; case "005": e.type = "4", a = [ removeHtml(t.QUESTION_OPTIONS[0].OPTION_CONTENT) ]; } return e.question = titleClean(t.QUESTION_TITLE), e.options = i, e.answer = a, e; }, setAnswer: e => { if ("4" === e.type) { const t = O(e.html).find("textarea")[0]; return t._ms_context_._answer = e.answer[0], t._ms_context_._save(), false; } return true; } }, { type: "ask", name: "\u4e1c\u5317\u8d22\u7ecf\u5927\u5b66\u6210\u6559\u7b54\u9898(\u7efc\u5408)", match: () => location.host.includes("dufe.edu.cn") && location.href.includes("/CompHomeworkPaper"), types: [ "0", "1", "3", "4" ], question: { html: ".Question", question: ".CBTPaperMain-trunkTitle", options: "ul.Question-options>li", type: ".question-box .tag", workType: "dufe", pageType: "dufe" }, init: async () => {}, ischecked: e => e.parent().find("input").prop("checked"), questionHook: e => { const t = (e => { var t; if (e) { const n = Object.keys(e).find((e => e.startsWith("__reactEventHandlers"))); if (n) { const t = e[n]; return console.log("React \u4e8b\u4ef6\u5904\u7406\u5bf9\u8c61:", t), t; } if (!n) { const n = Object.keys(e).find((e => e.startsWith("__reactInternalInstance$") || e.startsWith("__reactFiber$"))); if (n && (null == (t = e[n]) ? void 0 : t.memoizedProps)) return console.log("React \u5185\u90e8\u6570\u636e:", e[n].memoizedProps), e[n].memoizedProps; } } else console.error("\u672a\u627e\u5230 .Question \u5143\u7d20"); })(e.html).children[0]._owner.memoizedProps; return e.type = { SingleChoice: "0", MultipleChoice: "1" }[t.type], e.options = removeStartChar(e.options), e; }, setAnswer: e => { if ("4" === e.type) { const t = O(e.html).find("textarea")[0]; return t._ms_context_._answer = e.answer[0], t._ms_context_._save(), false; } return true; } } ], sn = { single: "0", multiple: "1", judge: "3" }, parseCfyOptions = e => JSON.parse(e).map((e => removeHtml(e.content))), rn = [ { type: "hook", name: "hook", match: location.host.includes("lygtc.edu.cn") || location.host.includes("cfyedu.com"), main: () => { observeVuePageChange(O("#app")[0], (() => O("#app")[0].__vue__.$route.path)); } }, { type: "save", name: "\u6625\u98ce\u96e8\u6536\u5f55", match: () => location.host.includes("lygtc.edu.cn") && (location.href.includes("/student/#/my-study/homework/records/detail") || location.href.includes("/student/#/my-study/homework")), question: { html: ".questions>div>div[id],.question>div>div[id]", question: ".topic-title", options: ".el-radio-group label .label,.el-checkbox-group label .label", type: ".question-box .tag", workType: "cfy", pageType: "cfy" }, init: async () => { await waitUntil((() => 0 !== O(".questions>div>div[id],.question>div>div[id]").length)); }, answerHook: e => { const t = O(e.html).find(">div")[0].__vue__.question; return e.question = titleClean(removeHtml(t.title)), e.options = parseCfyOptions(t.options), e.answer = t.answer.split("").map((t => e.options[t.charCodeAt(0) - 65])).filter(Boolean), e.type = sn[t.type] || "", "judge" === t.type && (e.options = [], e.answer = [ judgeAnswer(t.answer) ]), t.type, e; } }, { type: "ask", name: "\u6625\u98ce\u96e8\u7b54\u9898", tips: "\u516c\u544a", match: () => location.host.includes("lygtc.edu.cn") && location.href.includes("/student/#/my-study/homework"), types: Object.values(sn), question: { html: ".question>div>div[id]", question: ".question-title>.title", options: ".radio-option", type: ".question-box .tag", workType: "cfy", pageType: "cfy" }, init: async () => { await waitUntil((() => 0 !== O(".question>div>div[id]").length)); }, ischecked: e => e.find(".el-radio__input.is-checked").length > 0, questionHook: e => { const t = O(e.html).find(">div")[0].__vue__.question; return e.question = titleClean(removeHtml(t.title)), e.options = parseCfyOptions(t.options), e.type = sn[t.type] || "", "judge" === t.type && (e.options = [], e.answer = [ judgeAnswer(t.answer) ]), e; } }, { type: "save", name: "\u6625\u98ce\u96e8\u6d4b\u9a8c\u6536\u5f55", match: () => location.host.includes("cfyedu.com") && location.href.includes("/student/#/my-exam/detail"), question: { html: ".questions>div>div[id]", question: ".question-title>.title", options: ".radio-option,.checkbox-option", type: ".question-box .tag", workType: "cfy", pageType: "cfy" }, init: async () => { await waitUntil((() => 0 !== O(".questions>div>div[id]").length)); }, answerHook: e => { const t = O(e.html).find(">div")[0].__vue__.question; return e.question = titleClean(removeHtml(t.title)), e.options = parseCfyOptions(t.options), e.answer = t.answer.split("").map((t => e.options[t.charCodeAt(0) - 65])).filter(Boolean), e.type = sn[t.type] || "", "judge" === t.type && (e.options = [], e.answer = [ judgeAnswer(t.answer) ]), t.type, e; } }, { type: "ask", name: "\u6625\u98ce\u96e8\u6d4b\u9a8c\u7b54\u9898", tips: "\u516c\u544a", match: () => location.host.includes("cfyedu.com") && location.href.includes("/student/#/my-test/do-test"), types: Object.values(sn), question: { html: ".answer div[id]", question: ".question-title>.title", options: ".radio-option,.checkbox-option", type: ".question-box .tag", workType: "cfy", pageType: "cfy" }, init: async () => { await waitUntil((() => 0 !== O(".answer div[id]").length)); }, ischecked: e => e.find(".el-radio__input.is-checked,.el-checkbox__input.is-checked").length > 0, questionHook: e => { const t = O(e.html).find(">div")[0].__vue__.question; return e.question = titleClean(removeHtml(t.title)), e.options = parseCfyOptions(t.options), e.type = sn[t.type] || "", "judge" === t.type && (e.options = [], e.answer = [ judgeAnswer(t.answer) ]), e; } } ], on = [ { type: "hook", name: "hook", match: location.host.includes("jijiaool.com"), main: e => { observeVuePageChange(O(".contentIframe")[0], (() => O(".contentIframe").attr("src"))); } }, { type: "ask", name: "\u7ee7\u6559\u5728\u7ebf\u7b54\u9898", match: () => location.href.includes("jijiaool.com") && location.href.includes("/Learning/CourseOnlineExamination"), types: [ "0", "1" ], question: { html: ".bank_test>.test_item", question: ".test_item_tit", options: ".test_item_theme>ul>li>label", type: ".question-box .tag", workType: "jijiaool", pageType: "jijiaool" }, init: async () => { await waitUntil((function() { return isExist(".bank_test>.test_item"); })); }, ischecked: isParentChecked, questionHook: e => { const t = O(e.html).find(".test_item_tit").clone(); t.find(".tipNodo").remove(), e.question = titleClean(removeHtml(t.html())); const n = removeOptionsStartChar(e.options); n && (e.options = n); const a = O(e.html).prevAll(".test_item_type").first().text().trim(); return e.type = typeMatch(a), e; } }, { type: "save", name: "\u7ee7\u6559\u5728\u7ebf\u6536\u5f55", match: () => location.href.includes("jijiaool.com") && location.href.includes("/Learning/CourseExamWorkPageDetail"), question: { html: ".bank_test>.test_item", question: ".test_item_tit", options: ".test_item_theme>ul>li>label", type: ".question-box .tag", workType: "jijiaool", pageType: "jijiaool" }, init: async () => { await waitUntil((function() { return isExist(".bank_test>.test_item"); })); }, answerHook: e => { const t = O(e.html).find(".test_item_tit").clone(); t.find(".tipNodo").remove(), e.question = titleClean(removeHtml(t.html())); const n = removeOptionsStartChar(e.options); n && (e.options = n); const a = O(e.html).prevAll(".test_item_type").first().text().trim(); e.type = typeMatch(a); const i = O(e.html).find(".test_item_tit:eq(1)"), s = i.length ? removeHtml(i.html()).replace(/\u6b63\u786e\u7b54\u6848\uff1a/g, "").trim() : ""; if (s) switch (e.type) { case "0": case "1": e.answer = s.split("").map((t => e.options[t.charCodeAt(0) - 65])).filter(Boolean); break; case "3": e.answer = judgeAnswer(s), e.options = []; } else switch (e.type) { case "0": case "1": { const t = []; O(e.html).find(".test_item_theme>ul>li").each(((e, n) => { O(n).find("input:checked").length && t.push(e); })), e.answer = t.map((t => e.options[t])).filter(Boolean); break; } case "3": e.answer = judgeAnswer(O(e.html).find(".test_item_theme input:checked").attr("value") || ""), e.options = []; } return e.answer, e; } } ], ln = [ { type: "save", name: "\u5317\u4eac\u8054\u5927\u5b66\u5802\u6536\u5f55", match: () => location.host.includes("jxjypt.cn") && location.href.includes("/paper/start?pid="), question: { html: "#questionModule>ul>li", question: ".sub-dotitle>pre", options: "dl.sub-answer>dd", type: ".sub-dotitle>i", workType: "jhjypt", pageType: "jhjypt" }, init: async () => {}, answerHook: e => { let t = removeHtml(O(e.html).find(".refer-answer>span>em.right ,.solution .so-timu .wenzi:eq(0)").html()); if (void 0 === t || "undefined" == t) return null; switch (e.options = removeStartChar(e.options), e.type = typeMatch(removeHtml(O(e.html).find(".sub-dotitle>i").text().replace("\n", "").replace(" ", ""))), e.type) { case "0": case "1": e.answer = [], t.split("").forEach((t => { e.answer.push(e.options[t.charCodeAt() - 65]); })); break; case "2": case "4": case "5": case "6": case "7": e.answer = t; } return e; } }, { type: "ask", name: "\u5317\u4eac\u8054\u5927\u5b66\u5802\u7b54\u9898", tips: "\u516c\u544a", match: () => location.host.includes("jxjypt.cn") && location.href.includes("/paper/start?pid="), types: [ "0", "1", "2", "3", "4", "5", "6", "7" ], minDelay: 1e3, answerDelay: 1e3, question: { html: "#questionModule>ul>li", question: ".sub-dotitle>pre", options: "dl.sub-answer>dd", type: ".sub-dotitle>i", workType: "jhjypt", pageType: "jhjypt" }, init: async () => { if (await waitUntil((function() { return 0 !== O("#questionModule>ul>li").length; })), !isExist("#btn_submit")) return false; try { const e = se.addEventListener; se.addEventListener = function(t, n, a) { if ("visibilitychange" !== t) return e.call(this, t, n, a); }, se.paper && void 0 !== se.paper.isCut && (se.paper.isCut = 0), Object.defineProperty(se.document, "visibilityState", { get: function() { return "visible"; }, configurable: !0 }), Object.defineProperty(se.document, "hidden", { get: function() { return !1; }, configurable: !0 }); } catch (e) {} }, ischecked: e => e.hasClass("cho-this"), questionHook: e => (e.options = removeStartChar(e.options), e.type = typeMatch(removeHtml(O(e.html).find(".sub-dotitle>i").text().replace("\n", "").replace(" ", ""))), e), setAnswer: e => { switch (e.type) { case "2": case "4": case "5": case "6": case "7": const t = O(e.html).find(".e__textarea"); if (t.length > 0) { const n = t[0]; n.value = e.answer, t.focus(); [ "input", "change", "keyup", "keydown", "blur", "paste" ].forEach((e => { const t = new Event(e, { bubbles: true, cancelable: true }); n.dispatchEvent(t); })), t.trigger("input").trigger("change").trigger("keyup").trigger("blur"), setTimeout((() => { t.trigger("change"); }), 100), e.answer; } return false; } return true; } } ], cloneOptions = e => Array.isArray(e) ? e.map((e => e && "object" == typeof e ? { ...e } : e)) : [], normalizeFlatOptions = (e, t = true) => { const n = t ? cleanQuestionTextWithImageHtml : cleanQuestionText, a = e.map((e => n(e))); return removeOptionPrefixes(a).map((e => e.trim())).filter(Boolean); }, normalizeBaseQuestion = e => { const t = false !== e.preserveImageHtml, n = t ? cleanQuestionTextWithImageHtml : cleanQuestionText, a = { ...e, question: cleanQuestionTitle(n(e.question)), options: cloneOptions(e.options) }; return "15" == a.type ? (a.options = ((e, t = true) => { const n = t ? cleanQuestionTextWithImageHtml : cleanQuestionText; return e.map((e => e && "object" == typeof e ? { ...e, question: cleanQuestionTitle(n(e.question)), options: normalizeFlatOptions(cloneOptions(e.options), t) } : e)); })(a.options, t), a) : "11" == a.type ? (a.options = (i = e.options, Array.isArray(i) ? i.map((e => Array.isArray(e) ? e.slice() : e)) : i), a) : (a.options = normalizeFlatOptions(a.options, t), a); var i; }, normalizeQuestionForAsk = e => { const t = normalizeBaseQuestion(e); return "3" == t.type && (t.options = []), t; }, normalizeQuestionForSave = e => { const t = normalizeBaseQuestion(e); return "11" != t.type && "15" != t.type && ((e, t) => { if (!Array.isArray(e.options) || 0 === e.options.length) return; if (!Array.isArray(t.options) || t.options.some((e => "string" != typeof e))) return; const n = false !== e.preserveImageHtml ? cleanQuestionTextWithImageHtml : cleanQuestionText, a = e.options.map((e => n(e))), i = removeOptionPrefixes(a).map((e => e.trim())), s = new Map; a.forEach(((e, t) => { const n = normalizeComparableText(e); n && i[t] && !s.has(n) && s.set(n, i[t]); })); const remap = e => "string" != typeof e ? e : s.get(normalizeComparableText(e)) ?? e; "string" == typeof t.answer ? t.answer = remap(t.answer) : Array.isArray(t.answer) && (t.answer = t.answer.map(remap)); })(e, t), null !== t.answer && void 0 !== t.answer && "object" != typeof t.answer && (t.answer = [ String(t.answer) ]), t; }, parseAntaiQuestion = e => { const t = "string" == typeof e.options ? e.options : "", n = []; t.split(/[;\uff1b]/).map((e => e.trim())).filter(Boolean).forEach((e => { const t = e.match(/^([A-Za-z])\s*[:\uff1a]\s*([\s\S]*)$/); n.push(removeHtml(t ? t[2] : e).trim()); })); const a = (("string" == typeof e.answer ? e.answer : "").toUpperCase().match(/[A-Z]/g) || []).map((e => e.charCodeAt(0) - 65)).filter((e => e >= 0 && e < n.length)), i = a.map((e => n[e])); let s; 1 === e.type ? s = "0" : 2 === e.type ? s = "3" : (s = i.length > 1 ? "1" : "0", e.type); const r = { question: titleClean(removeHtml(e.content || "")), options: n, answer: i, answerIndexes: a, type: s }; return "3" === s && (r.options = [], r.answer = judgeAnswer(i[0] || ""), r.answerIndexes = []), r; }, isAntai = () => "antai.geovisearth.com" === location.host, cn = [ { type: "save", name: "\u5b89\u6cf0\u5b89\u57f9\u6536\u5f55", match: () => isAntai() && !!se.antaiques, question: { html: () => se.antaiques || [], question: "", options: "", type: "", workType: "antai", pageType: "antai" }, init: async () => { await waitUntil((() => !!se.antaiques)); }, answerHook: e => { const t = e.html; if (!t || "object" != typeof t) return null; const n = parseAntaiQuestion(t); return e.question = n.question, e.options = n.options, e.answer = n.answer, e.type = n.type, e; } }, { type: "ask", name: "\u5b89\u6cf0\u5b89\u57f9\u7b54\u9898", tips: "", match: () => isAntai() && !!se.antaiques && O(".n-card.n-modal .el-carousel__item").length > 0, types: [ "0", "1", "3" ], question: { html: ".n-card.n-modal .el-carousel__item", question: ".el-tag", options: ".el-radio", type: ".el-tag__content", workType: "antai", pageType: "antai" }, init: async () => { await waitUntil((() => O(".n-card.n-modal .el-carousel__item").length > 0 && !!se.antaiques)); }, ischecked: e => e.hasClass("is-checked"), toquestion: e => { const t = String(e + 1); O(".n-card.n-modal button").filter((function() { return O(this).text().trim() === t; })).first().click(); }, questionHook: (e, t) => { const n = (se.antaiques || [])[t]; if (!n) return null; const a = parseAntaiQuestion(n); e.question = a.question, e.options = a.options, e.type = a.type, e.$options = O(e.html).find(".el-radio"), "3" === a.type && (e.options = []); const i = normalizeQuestionForAsk({ type: a.type, question: titleClean(a.question), options: "3" === a.type ? [] : a.options }), s = "3" === a.type ? a.answer : a.answerIndexes.map((e => i.options[e])).filter((e => null != e && "" !== e)); return s.length > 0 && Answer.cacheAnswer({ type: i.type, question: i.question, options: i.options, answer: s }), e; } } ], un = { 1: "0", 2: "1", 3: "4", 4: "15", 5: "2", 6: "3", 7: "5", 8: "4", 9: "7", 11: "6", 14: "14" }, parseBgzkQuestion = e => { const t = (e => un[Number(e.questionType)] || "8")(e), n = e.options ?? [], a = n.map((e => (null == e ? void 0 : e.description) ?? "")), i = ((e, t) => { const n = []; return e.forEach(((e, a) => { const i = String((null == e ? void 0 : e.label) ?? "").trim().toUpperCase(), s = /^[A-Z]$/.test(i) ? i.charCodeAt(0) - 65 : a; n[s] = t[a]; })), n; })(n, a), s = buildQingshuAnswer(t, e, i), r = "0" === t || "1" === t ? (o = e.solution, o ? o.split("").filter((e => /^[A-Za-z]$/.test(e))) : []).map((e => n.findIndex((t => String((null == t ? void 0 : t.label) ?? "").trim().toUpperCase() === e.toUpperCase())))).filter((e => e >= 0)) : []; var o; return { question: e.description ?? "", options: "3" === t ? [] : a, answer: s.answer, answerIndexes: r, type: t }; }, hasBgzkSolution = e => !!(null == e ? void 0 : e.solution) || ((null == e ? void 0 : e.subQuestions) ?? []).some((e => !!(null == e ? void 0 : e.solution))), pn = [ 2, 3, 4 ], dn = [ -1, 0, 1 ], mn = [ /\/Student\/Course\/Quiz\/Detail/i, /\/Student\/course\/resource\/quizDetail/i, /\/Student\/exam\/quiz/i ], hn = ".question-quiz > .question-detail-container", isQuizPage = () => location.host.endsWith("bgzk-edu.cn") && mn.some((e => e.test(location.pathname))), getQuestions = () => se.bgzkques || [], hasSolutions = () => getQuestions().some(hasBgzkSolution), isAnalysisMode = () => (e => { if (!e) return false; const t = Number(e.answerStatus); return !!pn.includes(t) || 2 === Number(e.quizStatus) && dn.includes(t); })(se.bgzkquiz || null), questionsLoaded = () => getQuestions().length > 0, containersReady = () => isExist(hn) && questionsLoaded(), waitOrSkip = async e => { try { return await waitUntil(e, { timeout: 3e4 }), !0; } catch { return false; } }; let fn = false; const gn = [ { type: "hook", name: "\u5e7f\u897f\u81ea\u8003\u52a9\u5b66hook", match: () => isQuizPage(), main: () => { if (fn) return; fn = true; const getHash = () => `${getQuestions().map((e => (null == e ? void 0 : e.questionId) ?? "")).join(",")}|${hasSolutions()}|${isAnalysisMode()}`; waitUntil(questionsLoaded, { timeout: 6e4 }).then((() => { const e = O("#app")[0]; e ? observeVuePageChange(e, getHash, { beforeChange: () => { fn = false; } }) : fn = false; })).catch((() => { fn = false; })); } }, { type: "save", name: "\u5e7f\u897f\u81ea\u8003\u52a9\u5b66\u6536\u5f55", match: () => isQuizPage(), question: { html: () => getQuestions(), question: "", options: "", type: "", workType: "bgzk", pageType: "bgzk" }, init: async () => !!(await waitOrSkip(questionsLoaded)) && hasSolutions(), answerHook: e => { const t = e.html; if (!t || "object" != typeof t) return null; const n = parseBgzkQuestion(t); return e.question = n.question, e.options = n.options, e.answer = n.answer, e.type = n.type, e; } }, { type: "ask", name: "\u5e7f\u897f\u81ea\u8003\u52a9\u5b66\u7b54\u9898", tips: "", match: () => isQuizPage(), types: [ "0", "1", "3" ], question: { html: hn, question: ".question-detail-description", options: ".question-detail-options .question-detail-option > label, .question-detail-judgment .el-radio", type: ".question-detail-type-desc", workType: "bgzk", pageType: "bgzk" }, init: async () => !!(await waitOrSkip(questionsLoaded)) && (!isAnalysisMode() && await waitOrSkip(containersReady)), ischecked: e => e.hasClass("choice-active") || e.hasClass("is-checked"), toquestion: e => { O(".question-card .question-item").eq(e).click(); }, questionHook: (e, t) => { const n = getQuestions()[t]; if (!n) return null; const a = parseBgzkQuestion(n); return e.question = a.question, e.options = a.options, e.type = a.type, e; } } ], vn = Object.freeze(Object.defineProperty({ __proto__: null, a21tb: Pt, ahjxjy: dt, antai: cn, bgzk: gn, cfy: rn, chaoxing: at, chengjiaoyun: lt, chutou: kt, cjedu: ft, cjnep: St, cloudwis: wt, cnzx: pt, cqsdx: Xt, dufe: an, gkks: yt, guokai: ot, huayi: Et, jhjypt: ln, jijiaool: on, jijiaox: _t, jsou: ct, learnin: Gt, learnspace: Yt, ls365: qt, mooc: Vt, mosoteach: Bt, mynep: It, olearn: Zt, openha: bt, ouchn: Kt, qingshu: mt, sclecb: xt, uooc: ht, wdjycj: tn, wencai: Tt, whut: nn, wx168: Ht, xinwei: st, xueqi: vt, ynou: Ut, ytccr: gt, yunmuxueyuan: We, yxbyun: en, yxlearning: Ct, zhihuishu: it, zhijiaoyun: ut }, Symbol.toStringTag, { value: "Module" })), resolveRuleHtml = e => "function" == typeof e ? e() : e; const createQuestionData = (e, t) => { const n = O(t), a = removeHtml(n.find(e.question).html()), i = n.find(e.options).map(((e, t) => removeHtml(O(t).html()))).get(); return { question: titleClean(a ?? ""), options: i, $options: n.find(e.options), type: n.find(e.type).val(), html: n[0], workType: e.workType, pageType: e.pageType }; }, yn = []; for (const zm in vn) yn.push(...vn[zm]); const isRuleMatched = e => "function" == typeof e.match ? e.match() : Boolean(e.match), parseRule = async e => { await waitUntil((() => void 0 !== se[Ke + "app"])); const t = e.filter(isRuleMatched), n = getAppStore(), a = { app: n, ask: getAskStore(), ai: se[Ke + "ai"] }; if (!t.length) return n.app.alert = "\u5f53\u524d\u6ca1\u6709\u4efb\u52a1", console.log("\u6ca1\u6709\u5339\u914d\u5230\u89c4\u5219", "error"), void addLog("\u6ca1\u6709\u5339\u914d\u5230\u89c4\u5219", "error"); for (const i of t) { if (console.log(`\u5339\u914d\u5230\u89c4\u5219\uff1a${i.name}`, "success"), addLog(`\u5339\u914d\u5230\u89c4\u5219\uff1a${i.name}`, "success"), i.init) { let e = await i.init(); if ("boolean" == typeof e && false === e) continue; } n.alert = `\u5f53\u524d\u4efb\u52a1:${i.name}`, "hook" === i.type && i.main(a), "ask" === i.type && askParser(i, a), "save" === i.type && await saveParser(i, a); } }, saveParser = async (e, t) => { const n = t.app, a = t.ask; a.rule = e, e.tips && (a.tips = e.tips); const i = questionSaveParser(e.question, e.answerHook || null).filter((e => { return !(null == e || (t = e.answer, !flattenAnswerTexts(t).some((e => "" !== e.trim()))) || "8" == e.type); var t; })).map((e => (e.question = titleClean(e.question), e))); a.saveQuestionData = i, i.forEach((e => { Answer.cacheAnswer(e); })), await async function({questionList: e, pageType: t, paper: n, onPaperError: a, beforeSync: i, syncQuestionList: s}) { if (n) try { await n(e); } catch (o) { null == a || a(o); } const r = { questionList: e, pageType: t }; return null == i || i(r), e.length && await s(r), r; }({ questionList: i, pageType: e.question.pageType, paper: e.paper && "function" == typeof e.paper ? e.paper : void 0, onPaperError: () => addLog("\u6574\u5377\u7f13\u5b58\u5f02\u5e38", "error"), beforeSync: () => n.setPage("library", "saved"), syncQuestionList: e => Answer.syncQuestionList(e) }), n.app.alert = `\u9898\u5e93\u6536\u5f55\u5b8c\u6210\uff0c\u5171\u7f13\u5b58${i.length}\u9053\u9898\u76ee`, msg(`\u9898\u5e93\u6536\u5f55\u5b8c\u6210\uff0c\u5171\u7f13\u5b58${i.length}\u9053\u9898\u76ee`, "success"), e.next && e.next(); }, askParser = (e, t) => { const n = t.app, a = t.ask; a.rule = e, e.minDelay && (a.minDelay = e.minDelay, a.delay < a.minDelay && (a.delay = a.minDelay)), e.optionDelay && (a.optionMinDelay = e.optionDelay, a.optionDelay < a.optionMinDelay && (a.optionDelay = a.optionMinDelay), e.optionDelay = a.optionDelay), e.tips && (a.tips = e.tips), n.app.showFloat = !n.app.hideFloat, n.setPage("ask"), a.clearQuestion(); var i, s; (i = questionParser(e.question, e.questionHook || null), s = titleClean, i.filter((e => null != e)).map((e => (e.question = s(e.question), "3" == e.type && (e.options = []), e)))).map((e => normalizeQuestionForAsk(e))).forEach((e => { a.addQuestion(e); })), a.autoAnswer && a.toggleStart(); }, questionSaveParser = (e, t) => { const n = resolveRuleHtml(e.html); return O(n).map(((n, a) => { let i = { ...createQuestionData(e, a), $answer: O(a).find(e.answer), answer: [] }; try { t && (i = t(i, n)); } catch (r) { console.log("\u6536\u5f55hook\u62a5\u9519", r); } if (null == i || null == i) return null; const s = normalizeQuestionForSave(i); return { question: s.question, options: s.options, answer: s.answer, type: s.type, hash: questionHash(s.type, s.question, s.options) }; })).get(); }, questionParser = (e, t) => { const n = resolveRuleHtml(e.html), a = O(n).map(((n, a) => ((e, t, n, a = () => {}) => { if (!t) return e; try { return t(e, n) || null; } catch (i) { return a(i), null; } })(createQuestionData(e, a), t, n, (e => { console.log("\u7b54\u9898hook\u62a5\u9519", e); })))); return a.get(); }, vuePageChange = async () => { if (se.vuePageChangeLock) return; se.vuePageChangeLock = true; const e = getAppStore(), t = getAskStore(); t.questionInx = 0, e.app.showFloat = false, e.setPage("ask"), t.clearQuestion(), await parseRule(yn), se.vuePageChangeLock = false; }, observeVuePageChange = (e, t, n = {}) => { if (se.mainClass = t(), !e) return; const a = new MutationObserver((async () => { const e = t(); se.mainClass !== e && (se.mainClass = e, n.beforeChange && await n.beforeChange(e), await vuePageChange(), a.disconnect()); })); a.observe(e, { subtree: true, attributes: true, childList: true }); }, formatUpdateDate = e => new Date(e).toISOString().replace("T", " ").substring(0, 19), normalizeVersionParts = e => { var t; return ((null == (t = e.trim().replace(/^v/i, "").match(/\d+(?:\.\d+)*/)) ? void 0 : t[0]) || "0").split(".").map((e => Number(e) || 0)); }, compareVersionOrder = (e, t) => { const n = normalizeVersionParts(e), a = normalizeVersionParts(t), i = Math.max(n.length, a.length); for (let s = 0; s < i; s++) { const e = n[s] || 0, t = a[s] || 0; if (e > t) return 1; if (e < t) return -1; } return 0; }, compareVersions = (e, t) => compareVersionOrder(e, t) < 0, bn = 864e5, formatDate = e => formatUpdateDate(e), wn = [ { id: "492563", name: "GreasyFork", home: "https://greasyfork.org/zh-CN/scripts/492563-%E7%88%B1%E9%97%AE%E7%AD%94%E5%8A%A9%E6%89%8B", updateurl: "https://greasyfork.org/zh-CN/scripts/492563.json", getdata: e => { const t = JSON.parse(e[0].responseText); return { version: t.version, code_updated_at: formatDate(t.code_updated_at) }; } }, { id: "2384", name: "\u811a\u672c\u732b", home: "https://scriptcat.org/zh-CN/script-show-page/2384", updateurl: "https://scriptcat.org/api/v2/scripts/2384", getdata: e => { const t = JSON.parse(e[0].responseText); return { version: t.data.script.version, code_updated_at: formatDate(new Date(1e3 * t.data.updatetime).toISOString()) }; } }, { id: "ai-ask-helper-dist", name: "GitHub Releases", home: "https://github.com/aiaskhelper/ai-ask-helper-dist/releases", updateurl: "https://api.github.com/repos/aiaskhelper/ai-ask-helper-dist/releases/latest", getdata: e => (e => { const t = JSON.parse(e); return { version: t.tag_name || t.name || "", code_updated_at: formatUpdateDate(t.published_at || t.created_at) }; })(e[0].responseText) } ], updateFn = async (e = true) => { const t = Cache.get("app", {}); if (e && !t.checkUpdate) return; const n = Cache.get("lastCheckTime"); if (e && n && Date.now() - n < bn) { new Date(n + bn).toLocaleString(); } else try { const t = await Promise.allSettled(wn.map((async e => { try { e.name, e.updateurl, addLog(`[${e.name}] \u5f00\u59cb\u68c0\u6d4b\u66f4\u65b0`, "info"); const t = await request(e.updateurl, "GET", {}, {}), n = e.getdata(t); return e.name, { script: e, updateInfo: n }; } catch (t) { throw e.name, String(t), addLog(`[${e.name}] \u66f4\u65b0\u68c0\u6d4b\u5931\u8d25: ${String(t)}`, "error"), t; } }))); Cache.set("lastCheckTime", Date.now()); const n = t.filter((e => "fulfilled" === e.status)); if (0 === n.length) return void (e || msg("\u6240\u6709\u66f4\u65b0\u6e90\u68c0\u6d4b\u5931\u8d25\uff0c\u8bf7\u53cd\u9988\u7ed9\u4f5c\u8005\u3002", "error")); const a = ((e, t) => { const n = [ ...t ].sort(((e, t) => compareVersionOrder(t.updateInfo.version, e.updateInfo.version))), a = n[0]; if (!a) return { hasUpdate: !1, latestVersion: e, latestUpdatedAt: "", sourceNames: [], home: "", checkedCount: 0 }; const i = a.updateInfo.version, s = n.filter((e => 0 === compareVersionOrder(e.updateInfo.version, i))); return { hasUpdate: compareVersions(e, i), latestVersion: i, latestUpdatedAt: a.updateInfo.code_updated_at, sourceNames: s.map((e => e.script.name)), home: a.script.home, checkedCount: t.length }; })(Ve.script.version, n.map((e => e.value))); if (a.hasUpdate) { return msg(`\n
    \n

    \u68c0\u6d4b\u5230\u65b0\u7248\u672c\uff1a${a.latestVersion}

    \n

    \u5f53\u524d\u7248\u672c\uff1a${Ve.script.version}

    \n

    \u53ef\u7528\u6765\u6e90\uff1a${a.sourceNames.join("\u3001")}

    \n

    \u66f4\u65b0\u65f6\u95f4\uff1a${a.latestUpdatedAt}

    \n

    >> \u70b9\u6211\u5feb\u6377\u8df3\u8f6c\u66f4\u65b0 <<

    \n
    `, "warning"), void addLog(`[\u66f4\u65b0\u68c0\u6d4b] \u68c0\u6d4b\u5230\u65b0\u7248\u672c\uff1a${a.latestVersion}\uff0c\u6765\u6e90\uff1a${a.sourceNames.join("\u3001")}`, "warning"); } a.latestVersion, a.checkedCount, addLog(`[\u66f4\u65b0\u68c0\u6d4b] \u5df2\u662f\u6700\u65b0\u7248\uff1a${a.latestVersion}`, "info"), e || msg("\u5f53\u524d\u5df2\u662f\u6700\u65b0\u7248", "success"); } catch (a) { console.error("\u66f4\u65b0\u68c0\u6d4b\u6d41\u7a0b\u5f02\u5e38", a), addLog(`\u66f4\u65b0\u68c0\u6d4b\u5931\u8d25: ${String(a)}`, "error"), e || msg("\u6240\u6709\u66f4\u65b0\u6e90\u5747\u68c0\u6d4b\u5931\u8d25\uff0c\u8bf7\u5c1d\u8bd5\u5207\u6362\u7f51\u7edc\u6216\u8005\u53cd\u9988\u7ed9\u4f5c\u8005", "error"); } }, ttfDownloadJson = async e => new Promise((t => { ie({ method: "GET", url: e, onload: function(e) { try { const n = e.responseText, a = JSON.parse(n); t(a); } catch (n) { msg("\u5b57\u4f53\u6587\u4ef6\u4e0b\u8f7d\u5931\u8d25", "error"), t(null); } }, onerror: function(e) { msg("\u5b57\u4f53\u6587\u4ef6\u4e0b\u8f7d\u5931\u8d25", "error"), t(null); } }); })), randomIndex = (e, t) => Math.floor(t() * e), defaultResolveOptions = e => { const resolveTarget = e => { (null == e ? void 0 : e.$options) && "function" == typeof e.$options && (e.$options = e.$options()); }; return resolveTarget(e), Array.isArray(null == e ? void 0 : e.options) && e.options.forEach((e => { e && "object" == typeof e && resolveTarget(e); })), e; }; function getPreviewResumeAction(e, t) { const n = Math.max(t - 1, 0); return e >= n ? { shouldFinish: true, nextIndex: n } : { shouldFinish: false, nextIndex: e + 1 }; } function createNextRunToken(e) { return e.runToken = (e.runToken || 0) + 1, e.runToken; } function isRunTokenCurrent(e, t) { return e.runToken === t; } const xn = new Set([ "2", "4", "5", "6", "7", "9", "14" ]), answerAsArray = e => Array.isArray(e) ? e : "string" == typeof e && e.trim() ? [ e.trim() ] : [], answerAsTextArray = e => answerAsArray(e).map((e => "string" == typeof e ? e.trim() : String(e ?? "").trim())).filter(Boolean), getLength = e => { if ("function" == typeof e) try { return getLength(e()); } catch { return 0; } if (Array.isArray(e)) return e.length; if (e && "object" == typeof e && "length" in e) { const t = e.length; return "number" == typeof t ? t : 0; } return 0; }, getBlankCount$1 = e => { var t; const n = getLength(e.$options); if (n > 0) return n; if (Array.isArray(e.options) && e.options.length > 0) return e.options.every((e => "string" == typeof e)) ? e.options.length : 0; const a = e.html; return a && "object" == typeof a && "function" == typeof a.querySelectorAll ? a.querySelectorAll("textarea").length : "string" == typeof a && (null == (t = a.match(/ { const n = answerAsTextArray(e.answer); if (0 === n.length || !Array.isArray(t.options)) return; if (!t.options.every((e => "string" == typeof e))) return; const a = ((e, t) => { const n = e.map(normalizeComparableText); if (0 === n.length || n.some((e => "" === e))) return []; const a = t.map(normalizeComparableText), findIndexFor = e => { const t = a.findIndex((t => t === e)); if (-1 !== t) return t; const n = a.reduce(((t, n, a) => (n.includes(e) && t.push(a), t)), []); return 1 === n.length ? n[0] : -1; }, i = n.map(((t, n) => { const a = findIndexFor(t); if (-1 !== a) return a; const i = e[n].replace(/^\s*[A-Z]\s*[.\u3001\uff0e)\uff09:\uff1a]\s*/, ""); if (i === e[n]) return -1; const s = normalizeComparableText(i); return s ? findIndexFor(s) : -1; })); return i.includes(-1) ? [] : i; })(n, t.options); return 0 !== a.length ? { kind: "choice", indexes: a } : void 0; }, matchJudgeCandidate = e => { const [t] = answerAsArray(e.answer); return (e => "\u6b63\u786e" === normalizeJudgeAnswer(e))(t) ? { kind: "judge", value: "\u6b63\u786e" } : (e => "\u9519\u8bef" === normalizeJudgeAnswer(e))(t) ? { kind: "judge", value: "\u9519\u8bef" } : void 0; }, matchBlankCandidate = (e, t) => { const n = answerAsTextArray(e.answer); if (0 === n.length) return; const a = getBlankCount$1(t); return a > 0 && n.length !== a ? void 0 : { kind: "blank", values: n }; }, findPlan = (e, t) => { if (e.valid) return "0" === t.type || "1" === t.type ? matchChoiceCandidate(e, t) : "3" === t.type ? matchJudgeCandidate(e) : xn.has(t.type) || "8" === t.type && getBlankCount$1(t) > 0 ? matchBlankCandidate(e, t) : "11" === t.type ? (e => { if (e.answer && "object" == typeof e.answer && !Array.isArray(e.answer)) return { kind: "link", value: e.answer }; })(e) : "15" === t.type ? ((e, t) => { if (!Array.isArray(e.answer) || !Array.isArray(t.options)) return; if (0 === t.options.length || e.answer.length !== t.options.length) return; const n = []; let a = 0; for (let i = 0; i < t.options.length; i++) { const s = t.options[i]; if (!s || "object" != typeof s || !("options" in s)) { n.push({ kind: "unsupported", reason: "\u5b50\u9898\u65e0\u6cd5\u5339\u914d" }); continue; } const r = { ...e, answer: e.answer[i] }, o = "3" === s.type ? matchJudgeCandidate(r) : xn.has(s.type) ? matchBlankCandidate(r, s) : matchChoiceCandidate(r, s); o ? (a++, n.push(o)) : n.push({ kind: "unsupported", reason: "\u5b50\u9898\u65e0\u7b54\u6848" }); } return a > 0 ? { kind: "reading", subPlans: n } : void 0; })(e, t) : void 0; }, matchAnswerCandidates = (e, t) => { for (const n of e) { const a = findPlan(n, t); if (a) return { haveAnswer: true, source: n, fillPlan: a, displayAnswers: e }; } return ((e, t = "\u7b54\u6848\u6570\u91cf\u6216\u5185\u5bb9\u65e0\u6cd5\u5339\u914d\u5f53\u524d\u9898\u76ee") => ({ haveAnswer: false, displayAnswers: e, reason: t }))(e); }, isBlankAnswer = e => null == e || ("string" == typeof e ? "" === e.trim() : !!Array.isArray(e) && (0 === e.length || e.every(isBlankAnswer))), normalizeAnswerArray = e => e.map((e => Array.isArray(e) ? normalizeAnswerArray(e) : "string" == typeof e ? e.trim() : e)).filter((e => !isBlankAnswer(e))), normalizeAnswerCandidates = e => e.map(((e, t) => { const n = findNonAnswerText(null == e ? void 0 : e.answer), a = n ? [] : (e => { if (null == e) return []; if ("string" == typeof e) { return e.trim() || []; } return Array.isArray(e) ? e.map((e => Array.isArray(e) ? normalizeAnswerArray(e) : "string" == typeof e ? e.trim() : e)).filter((e => Array.isArray(e) || !isBlankAnswer(e))) : e; })(null == e ? void 0 : e.answer); return { source: (null == e ? void 0 : e.form) || (null == e ? void 0 : e.source) || "\u672a\u77e5\u6765\u6e90", answer: a, valid: !n && !isBlankAnswer(a), duration: null == e ? void 0 : e.duration, msg: n ? (null == e ? void 0 : e.msg) || `\u63a5\u53e3\u8fd4\u56de\u975e\u7b54\u6848\u6587\u6848\uff1a${n}` : null == e ? void 0 : e.msg, needLogin: null == e ? void 0 : e.needLogin, raw: (null == e ? void 0 : e.raw) ?? e, priority: "number" == typeof (null == e ? void 0 : e.priority) ? e.priority : t }; })), createManualAiDisplayMessage = (e, t, n) => e && t.trim() ? t : n, appendOptionLines = e => e.map(((e, t) => `${String.fromCharCode(65 + t)}\u3001${String(e)}`)).join("\n"), noAnswerMatch = e => ({ res: [ e ], haveAnswer: false }), createFallbackResult = (e, t, n = 0, a = "") => { const i = { action: "mark-no-answer", answer: [] }, s = { form: e, answer: [], msg: t, duration: n, aiStatus: i.action, rawText: a }; return { res: s, matchResult: noAnswerMatch(s), action: i }; }, getBlankCount = e => { var t, n; const a = e.$options, i = "function" == typeof a ? a() : a; return Array.isArray(i) ? i.length : (null == (t = e.html) ? void 0 : t.querySelectorAll) ? e.html.querySelectorAll("textarea").length : "string" == typeof e.html && (null == (n = e.html.match(/ e.html ? "string" == typeof e.html ? e.html : "string" == typeof e.html.outerHTML ? e.html.outerHTML : "string" == typeof e.html.innerHTML ? e.html.innerHTML : "" : "", stripImageTags = e => e.replace(/<\s*img\b[^>]*>/gi, ""), describeImageFailures = e => e.map((e => e.src ? `${e.src}\uff08${e.reason}\uff09` : e.reason)).join("\uff1b"), isTextAnswerUnknownQuestion = e => { var t, n; if ("8" !== e.type) return false; const a = getQuestionHtmlText(e); return /]*>/gi, qn = /\bsrc\s*=\s*["']([^"']+)["']/i, runAskAiFallback = async ({route: e, text: t, type: n, question: a, config: i, adoptionStrategy: s, usePureMatcher: r = false, runScene: o = runAiScene, matchAnswer: l, resolveImages: c = resolveQuestionImages}) => { const u = (null == i ? void 0 : i.name) || "AI", p = ((e, t) => hasQuestionImages(t, e))(t, a); if (p && !((e, t) => !!(null == e ? void 0 : e.enabled) && true === (e.capabilities || je)[t])(i, "image")) return createFallbackResult(u, "\u5f53\u524d AI \u914d\u7f6e\u4e0d\u652f\u6301\u56fe\u7247\u9898\u76ee\uff0c\u8bf7\u5728 AI \u8bbe\u7f6e\u4e2d\u9009\u62e9\u56fe\u7247\u9898\u6a21\u578b"); if (hasUnsupportedMedia(stripImageTags(t)) || hasUnsupportedMedia(stripImageTags(getQuestionHtmlText(a)))) return createFallbackResult(u, getAiErrorMessage(createAiError("AI_IMAGE_UNSUPPORTED"))); let d = [], m = []; if (p) { try { const e = await c({ ...a, question: `${a.question}\n${t}` }); d = (null == e ? void 0 : e.parts) || [], m = (null == e ? void 0 : e.failures) || []; } catch (k) { m = [ { src: "", reason: (null == k ? void 0 : k.message) || "\u56fe\u7247\u83b7\u53d6\u5931\u8d25" } ]; } if (!d.length && !(e => stripImageTags(e).replace(/<[^>]*>/g, " ").replace(/\[[^\]]*\]/g, " ").replace(/\s+/g, "").length > 0)(t)) return createFallbackResult(u, `\u9898\u76ee\u56fe\u7247\u83b7\u53d6\u5931\u8d25\uff1a${describeImageFailures(m)}`); } const h = m.length ? `\u90e8\u5206\u9898\u76ee\u56fe\u7247\u672a\u53d6\u5230\uff1a${describeImageFailures(m)}` : "", f = p ? ((e, t) => { const n = t.parts || [], a = t.failures || []; if (!n.length && !a.length) return { text: e.replace(kn, ""), parts: [], markers: new Map }; const i = new Set(a.map((e => resolveImageSrc(e.src)))), s = new Map; n.forEach((e => { e.url && s.set(resolveImageSrc(e.url), e); })); const r = [], o = new Map, l = e.replace(kn, (e => { var t; const n = resolveImageSrc((null == (t = e.match(qn)) ? void 0 : t[1]) || ""); if (!n) return ""; if (o.has(n)) return `[\u56fe${o.get(n)}]`; const a = s.get(n); return a ? (s.delete(n), r.push(a), o.set(n, r.length), `[\u56fe${r.length}]`) : i.has(n) ? "[\u56fe\u7247\u83b7\u53d6\u5931\u8d25]" : ""; })), c = n.filter((e => !r.includes(e))); if (!c.length) return { text: l, parts: r, markers: o }; const u = c.map(((e, t) => `[\u56fe${r.length + t + 1}]`)).join(""); return r.push(...c), { text: `${l}\n\uff08\u53e6\u9644\u672a\u5b9a\u4f4d\u7684\u9898\u76ee\u56fe\u7247\uff1a${u}\uff09`, parts: r, markers: o }; })(t, { parts: d, failures: m }) : { text: t, parts: d, markers: new Map }, g = p ? ((e, t) => { if (Array.isArray(e) && e.every((e => "string" == typeof e))) return e.map((e => e.replace(kn, (e => { var n; const a = resolveImageSrc((null == (n = e.match(qn)) ? void 0 : n[1]) || ""), i = t.get(a); return i ? `[\u56fe${i}]` : ""; })))); })(a.options, f.markers) : void 0, v = ((e, t) => "8" === e && isTextAnswerUnknownQuestion(t) ? "4" : e)(n, a), y = await o("ask", i, ((e, t) => t.length ? [ { type: "text", text: e }, ...t ] : e)(f.text, f.parts), { questionType: v, stream: false, route: e }); if (!y.success) { const e = [ y.displayMessage || "AI \u672a\u8fd4\u56de\u53ef\u7528\u7b54\u6848", h ].filter(Boolean).join("\uff1b"); return createFallbackResult(u, e, y.duration, y.text); } const b = ((e, t, n) => t && Array.isArray(n) && Array.isArray(e.answer) ? { ...e, answer: e.answer.map((e => { if ("string" != typeof e) return e; const a = t.indexOf(e); return a >= 0 ? n[a] : e; })) } : e)(parseAiAnswer(y.text, { type: v, options: g || a.options || [], blankCount: getBlankCount(a) }), g, a.options), w = ((e, t) => "preview" === e ? t.valid ? { action: "preview", answer: t.answer } : { action: "mark-no-answer", answer: [] } : "conservative" === e ? t.valid ? { action: "fill", answer: t.answer } : { action: "mark-no-answer", answer: [] } : t.answer.length > 0 ? { action: "fill", answer: t.answer } : { action: "mark-no-answer", answer: [] })(s, b), x = { form: u, answer: b.answer, msg: [ b.error ? getAiErrorMessage(b.error) : "", h ].filter(Boolean).join("\uff1b"), duration: y.duration, aiStatus: w.action, rawText: y.text }; if ("fill" !== w.action) return { res: x, matchResult: noAnswerMatch(x), action: w }; try { return { res: x, matchResult: r || !l ? matchAnswerCandidates(normalizeAnswerCandidates([ x ]), { ...a, type: v }) : await l([ x ], a, !1), action: w }; } catch (k) { return createFallbackResult(u, "AI \u7b54\u6848\u586b\u5145\u5931\u8d25\uff0c\u8bf7\u624b\u52a8\u6838\u5bf9\u540e\u91cd\u8bd5", y.duration, y.text); } }, getErrorMessage = (e, t) => e instanceof Error && e.message ? `${t}\uff1a${e.message}` : "string" == typeof e && e ? `${t}\uff1a${e}` : t, runQuestionPipelineFromSources = async ({task: e, question: t, runToken: n, isCurrentRun: a, askAiEnabled: i, randomAnswerEnabled: s, sources: r}) => { if ("confirm-ai-preview" === e.kind) return ((e, t) => { var n, a; const i = { form: "AI \u9884\u89c8", answer: (null == (n = e.preview) ? void 0 : n.answer) || [], duration: 0, msg: "", aiStatus: "confirmed", rawText: (null == (a = e.preview) ? void 0 : a.rawText) || "" }, s = normalizeAnswerCandidates([ i ]), r = matchAnswerCandidates(s, t); return r.haveAnswer && r.source && r.fillPlan ? { status: "answered", displayAnswers: s, adoptedSource: r.source, fillPlan: r.fillPlan } : { status: "failed", displayAnswers: s, failureReason: "AI \u5efa\u8bae\u65e0\u6cd5\u5339\u914d\u5f53\u524d\u9898\u76ee" }; })(e, t); const o = "manual-ai" === e.kind, l = "random" === e.kind; return (async ({question: e, runToken: t, isCurrentRun: n, askAiEnabled: a, randomAnswerEnabled: i, getCacheAnswer: s, getRemoteAnswers: r, getAiAnswer: o, getRandomFillPlan: l}) => { var c, u, p, d; let m = "", h = "", f = []; try { const a = await s(e); if (!n(t)) return { status: "stale", displayAnswers: [] }; f = normalizeAnswerCandidates([ a ]); const i = matchAnswerCandidates(f, e); if (i.haveAnswer && i.source && i.fillPlan) return { status: "answered", displayAnswers: f, adoptedSource: i.source, fillPlan: i.fillPlan }; } catch (w) { if (!n(t)) return { status: "stale", displayAnswers: [] }; m = getErrorMessage(w, "\u7f13\u5b58\u7b54\u6848\u8bfb\u53d6\u5931\u8d25"); } let g = []; try { const a = await r(e); if (!n(t)) return { status: "stale", displayAnswers: [] }; g = normalizeAnswerCandidates(a); const i = matchAnswerCandidates(g, e); if (i.haveAnswer && i.source && i.fillPlan) return { status: "answered", displayAnswers: g, adoptedSource: i.source, fillPlan: i.fillPlan }; h = (null == (c = g.find((e => e.msg))) ? void 0 : c.msg) || h; } catch (w) { if (!n(t)) return { status: "stale", displayAnswers: [] }; m = getErrorMessage(w, "\u8fdc\u7aef\u9898\u5e93\u8bf7\u6c42\u5931\u8d25"); } let v = g.length ? g : f; if (a && o) try { const a = await o(e); if (!n(t)) return { status: "stale", displayAnswers: [] }; if ((e => { var t; return !!e && "object" == typeof e && "preview" === (null == (t = e.action) ? void 0 : t.action); })(a)) return { status: "preview", displayAnswers: v, preview: { answer: (null == (u = a.res) ? void 0 : u.answer) || [], rawText: (null == (p = a.res) ? void 0 : p.rawText) || "", reason: "\u7b49\u5f85\u7528\u6237\u786e\u8ba4 AI \u5efa\u8bae" } }; const i = normalizeAnswerCandidates([ (y = a, y && "object" == typeof y && "res" in y ? y.res : y) ]); v = [ ...v, ...i ]; const s = matchAnswerCandidates(i, e); if (s.haveAnswer && s.source && s.fillPlan) return { status: "answered", displayAnswers: v, adoptedSource: s.source, fillPlan: s.fillPlan }; h = (null == (d = i.find((e => e.msg))) ? void 0 : d.msg) || h; } catch (w) { if (!n(t)) return { status: "stale", displayAnswers: [] }; m = getErrorMessage(w, "AI \u7b54\u6848\u83b7\u53d6\u5931\u8d25"); } var y, b; if (i && l) { const t = l(e); if (t) return { status: "no-answer", displayAnswers: v, adoptedSource: { source: "\u968f\u673a\u7b54\u9898", answer: [], valid: true, priority: 999 }, fillPlan: t, failureReason: "\u968f\u673a\u7b54\u9898\uff0c\u4e0d\u4ee3\u8868\u6b63\u786e\u7b54\u6848" }; } return { status: m && !h ? "failed" : "no-answer", displayAnswers: v, failureReason: (b = h || m || "\u672a\u627e\u5230\u53ef\u5339\u914d\u7b54\u6848", cleanQuestionText(b).replace(/\s*\n\s*/g, " ").trim()) }; })({ question: t, runToken: n, isCurrentRun: a, askAiEnabled: !!o || i, randomAnswerEnabled: !!l || s, getCacheAnswer: o || l ? async () => ({ form: "\u672c\u5730\u7f13\u5b58", answer: "", duration: 0, msg: "\u624b\u52a8\u4efb\u52a1\u8df3\u8fc7\u7f13\u5b58" }) : r.getCacheAnswer, getRemoteAnswers: o || l ? async () => [] : r.getRemoteAnswers, getAiAnswer: l ? void 0 : r.getAiAnswer, getRandomFillPlan: r.getRandomFillPlan }); }; let _n = 0; const createQuestionTaskId = (e, t, n, a) => `${e}:${t}:${n}:${a}`, createQuestionTask = ({kind: e, index: t, runToken: n, preview: a, now: i = Date.now, nextSeq: s = () => ++_n}) => { const r = s(); return { id: createQuestionTaskId(e, t, n, r), kind: e, index: t, runToken: n, createdAt: i(), preview: a }; }, phaseToLegacyStatus = e => "done" === e ? 1 : "no-answer" === e || "failed" === e ? 2 : 0, finishWithPhase = (e, t, n, a) => (e.setPhase(t.index, n, t, a), { phase: n, reason: a }), runQuestionTask = async (e, t) => { if (!t.isCurrentRun(e.runToken)) return { phase: "cancelled", reason: "\u7b54\u9898\u5df2\u53d6\u6d88" }; const n = t.getQuestion(e.index); if (!n) return finishWithPhase(t, e, "failed", "\u9898\u76ee\u4e0d\u5b58\u5728"); if (t.setPhase(e.index, "preparing", e), t.setLoadingText("\u52a0\u8f7d\u4e2d...."), !t.isCurrentRun(e.runToken)) return { phase: "cancelled", reason: "\u7b54\u9898\u5df2\u53d6\u6d88" }; t.setPhase(e.index, "searching", e); const a = await t.runPipeline(e, n); if ("stale" === a.status || !t.isCurrentRun(e.runToken)) return { phase: "cancelled", reason: "\u7b54\u9898\u5df2\u53d6\u6d88" }; const i = (e => e.displayAnswers.map((e => e.raw || e)))(a); if ("preview" === a.status && a.preview) return t.publishQuestion(e.index, { answer: i, phase: "preview", status: 0, taskId: e.id }), t.publishPreview(e.index, a.preview), t.setPhase(e.index, "preview", e), t.stopAutoRun(), { phase: "preview", reason: a.preview.reason }; const s = a.adoptedSource && a.fillPlan ? createLegacyMatchResult({ haveAnswer: true, source: a.adoptedSource, fillPlan: a.fillPlan, displayAnswers: a.displayAnswers }) : createLegacyMatchResult({ haveAnswer: false, displayAnswers: a.displayAnswers }); if (a.fillPlan && t.setPhase(e.index, "matched", e), t.publishQuestion(e.index, { answer: i, form: s.form, error: a.failureReason || "", phase: "published", status: 0, taskId: e.id }), t.setPhase(e.index, "published", e), await t.waitForRender(), !t.isCurrentRun(e.runToken)) return { phase: "cancelled", reason: "\u7b54\u9898\u5df2\u53d6\u6d88" }; if (t.setPhase(e.index, "rendering", e), a.fillPlan) { t.setPhase(e.index, "filling", e); const i = await t.fillAnswer(a.fillPlan, n); if (!t.isCurrentRun(e.runToken)) return { phase: "cancelled", reason: "\u7b54\u9898\u5df2\u53d6\u6d88" }; if (!i.success) return finishWithPhase(t, e, "failed", i.reason || "\u7b54\u6848\u586b\u5145\u5931\u8d25"); } return "answered" === a.status ? finishWithPhase(t, e, "done") : "failed" === a.status ? finishWithPhase(t, e, "failed", a.failureReason || "\u7b54\u6848\u83b7\u53d6\u5931\u8d25") : finishWithPhase(t, e, "no-answer", a.failureReason || "\u672a\u627e\u5230\u53ef\u5339\u914d\u7b54\u6848"); }, An = [ "ask", "library", "settings" ], Tn = { page: "ask", subPage: "" }, Cn = { home: { page: "ask", subPage: "" }, overview: { page: "ask", subPage: "" }, ai: { page: "ask", subPage: "" }, Base: { page: "settings", subPage: "" }, question: { page: "library", subPage: "" }, preview: { page: "library", subPage: "" }, questionTool: { page: "library", subPage: "" }, log: { page: "settings", subPage: "about" }, user: { page: "settings", subPage: "account" } }, Sn = { settings: "", logs: "about", account: "account" }, In = { display: "general", hotkey: "general", system: "general", data: "general", logs: "about" }, En = new Set([ "manage", "preview", "tool" ]); function resolveNextPage(e, t) { return void 0 !== Cn[e] ? Cn[e] : "system" === e ? { page: "settings", subPage: Sn[t ?? ""] ?? "" } : "settings" === e && void 0 !== In[t ?? ""] ? { page: "settings", subPage: In[t ?? ""] } : "library" === e && En.has(t ?? "") ? { page: "library", subPage: "" } : An.includes(e) ? { page: e, subPage: t ?? "" } : Tn; } function normalizeDialogWidth(e) { const t = "number" == typeof e ? e : Number(e); return Number.isFinite(t) ? Math.max(480, Math.min(1200, Math.round(t))) : 760; } const Un = { debug: true, searchApi: [], defaultShowFloat: false, showFloat: false, showBoard: true, checkUpdate: true, hideFloat: false, alert: "\u70b9\u6211\u6709\u60ca\u559c", alertBubble: true, iframe: false, key: "", gpt: [], gptIndex: 0, askGpt: false, hotkey: "Ctrl+Shift+H", hotkeyEnabled: true, theme: "auto", page: "ask", subPage: "", dialogWidth: 760 }; const Pn = function() { const e = Cache.get("app") || {}, t = { ...Un }; for (const [n, a] of Object.entries(e)) "gpt" !== n && "alert" !== n && void 0 !== a && (t[n] = a); if (e.gpt) { const n = new Map; e.gpt.forEach((e => { n.set(e.name, e.key); })), t.gpt = Un.gpt.map((e => ({ ...e, key: n.get(e.name) || "" }))); } return t.alert = Un.alert, t.gptIndex >= t.gpt.length && (t.gptIndex = 0), t.dialogWidth = normalizeDialogWidth(t.dialogWidth), t; }(); function getApp() { return Cache.get("app") || Un; } !function(e) { const t = { ...Cache.get("app"), ...e }; Cache.set("app", t); }(Pn); const Hn = { display: [ { type: "switch", label: "\u9ed8\u8ba4\u663e\u793a\u60ac\u6d6e", name: "defaultShowFloat", value: Pn.defaultShowFloat, desc: "\u6253\u5f00\u9875\u9762\u65f6\u662f\u5426\u663e\u793a\u60ac\u6d6e\u7a97", options: [] }, { type: "switch", label: "\u5f3a\u5236\u9690\u85cf", name: "hideFloat", value: Pn.hideFloat, desc: "\u4ec5\u70ed\u952e\u6216\u70b9\u51fb\u53f3\u4e0b\u89d2\u56fe\u7247\u624d\u663e\u793a\u60ac\u6d6e\u7a97", options: [] }, { type: "switch", label: "\u6c14\u6ce1\u63d0\u793a", name: "alertBubble", value: Pn.alertBubble, desc: "\u53f3\u4e0b\u89d2\u6c14\u6ce1\u63d0\u793a\u662f\u5426\u5f00\u542f", options: [] } ], system: [ { type: "switch", label: "\u68c0\u6d4b\u66f4\u65b0", name: "checkUpdate", value: Pn.checkUpdate, desc: "\u6253\u5f00\u9875\u9762\u65f6\u662f\u5426\u68c0\u6d4b\u66f4\u65b0", options: [] }, { type: "switch", label: "iframe\u4f18\u5316(\u6d4b\u8bd5)", name: "iframe", value: Pn.iframe, desc: "\u9488\u5bf9\u6df1\u5ea6\u5d4c\u5957\u7f51\u9875\u7684\u4f18\u5316\uff0c\u9002\u5408\u5355\u4efb\u52a1\u9875\u4f7f\u7528\uff0c\u591a\u4efb\u52a1\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5f39\u7a97\u8fc7\u591a\u3002\n \u6ce8\u610f\uff1a\u8be5\u529f\u80fd\u4e3a\u6d4b\u8bd5\u529f\u80fd\uff0c\u53ef\u80fd\u5b58\u5728\u672a\u77e5\u95ee\u9898\uff0c\u8bf7\u8c28\u614e\u4f7f\u7528", options: [] } ], ai: [], hotkey: [ { type: "switch", label: "\u542f\u7528\u5feb\u6377\u952e", name: "hotkeyEnabled", value: Pn.hotkeyEnabled, desc: "\u662f\u5426\u542f\u7528\u5feb\u6377\u952e\u663e\u9690\u60ac\u6d6e\u7a97", options: [] }, { type: "hotkey", label: "\u5feb\u6377\u952e\u8bbe\u7f6e", name: "hotkey", value: Pn.hotkey, desc: "\u70b9\u51fb\u8f93\u5165\u6846\u540e\u6309\u4e0b\u60f3\u8981\u8bbe\u7f6e\u7684\u5feb\u6377\u952e\u7ec4\u5408\uff08\u652f\u6301Ctrl\u3001Shift\u3001Alt\u7ec4\u5408\u952e\uff09", options: [] } ] }, $n = pinia.defineStore("app", { state: () => { const e = resolveNextPage(Pn.page, Pn.subPage); return { app: Pn, script: Ve.script, page: e.page, subPage: e.subPage, ConfigInput: Hn, searchOpen: false, logs: [ { time: (new Date).toLocaleString(), type: "success", content: "\u521d\u59cb\u5316\u65e5\u5fd7\u6210\u529f" } ] }; }, actions: { setConfig(e) { const t = { ...this.app, ...e }; "dialogWidth" in e && (t.dialogWidth = normalizeDialogWidth(e.dialogWidth)), this.app = t, Cache.set("app", this.app); }, setPage(e, t) { const n = resolveNextPage(e, t); this.page = n.page, this.subPage = n.subPage, this.app = { ...this.app, page: n.page, subPage: n.subPage }, Cache.set("app", this.app); }, openSearch() { this.searchOpen = true; }, closeSearch() { this.searchOpen = false; }, setDialogWidth(e) { const t = normalizeDialogWidth(e); this.app.dialogWidth = t, Cache.set("app", this.app); }, addLog(e) { this.logs.length > 100 && this.logs.shift(), this.logs.push(e); } } }); function getCachedNoticeResult(e, t = Date.now(), n = {}) { return function(e, t = Date.now(), n = {}) { if (n.force) return true; if (!e.noticeLoaded) return true; const a = n.cacheTtl ?? 3e5; return t - e.noticeFetchedAt >= a; }(e, t, n) ? null : { success: true, notice: e.notice }; } const Ln = Cache.get("user", {}), Mn = pinia.defineStore("user", { state: () => ({ user: Ln.user || null, notice: "", noticeLoaded: false, noticeFetchedAt: 0, apiKey: Ln.api_key || "", isLoggedIn: !!Ln.user, loginTime: Ln.login_time || 0 }), getters: { username: e => { var t; return (null == (t = e.user) ? void 0 : t.username) || "\u672a\u767b\u5f55"; }, nickname: e => { var t; return (null == (t = e.user) ? void 0 : t.nickname) || "\u6e38\u5ba2"; }, avatar: () => "", score: e => { var t; return (null == (t = e.user) ? void 0 : t.score) || 0; } }, actions: { async loginByPassword(e, t) { try { const n = apiUrl("user/login"), [a] = await requestApi(n, "POST", { username: e, password: t, login_type: "password" }), i = JSON.parse(a.responseText); return 200 === i.code ? (this.user = i.data.user, this.apiKey = i.data.api_key, this.isLoggedIn = !0, this.loginTime = Date.now(), this.saveToCache(), await this.fetchUserInfo(), i.data, { success: !0, message: "\u767b\u5f55\u6210\u529f" }) : { success: !1, message: i.message || "\u767b\u5f55\u5931\u8d25" }; } catch (n) { return { success: false, message: n.message || "\u767b\u5f55\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u7f51\u7edc\u8fde\u63a5" }; } }, async loginByApiKey(e) { try { const t = apiUrl("user/login"), [n] = await requestApi(t, "POST", { api_key: e, login_type: "apikey" }), a = JSON.parse(n.responseText); return 200 === a.code ? (this.user = a.data.user, this.apiKey = a.data.api_key, this.isLoggedIn = !0, this.loginTime = Date.now(), this.saveToCache(), await this.fetchUserInfo(), a.data, { success: !0, message: "\u767b\u5f55\u6210\u529f" }) : { success: !1, message: a.message || "API Key \u767b\u5f55\u5931\u8d25" }; } catch (t) { return { success: false, message: t.message || "API Key \u767b\u5f55\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u7f51\u7edc\u8fde\u63a5" }; } }, async fetchUserInfo() { if (this.isLoggedIn) try { const e = apiUrl("user/info"), [t] = await requestApi(e, "GET", void 0, { Authorization: `Bearer ${this.apiKey}` }), n = JSON.parse(t.responseText); 200 === n.code && (this.user = n.data.user, this.saveToCache(), n.data); } catch (e) {} }, async logout() { try { if (this.apiKey) { const e = apiUrl("user/logout"); await requestApi(e, "POST", void 0, { Authorization: `Bearer ${this.apiKey}` }); } } catch (e) {} finally { this.user = null, this.apiKey = "", this.isLoggedIn = false, this.loginTime = 0, Cache.remove("user"); } }, async refreshApiKey() { try { const e = apiUrl("user/refresh-apikey"), [t] = await requestApi(e, "POST", void 0, { Authorization: `Bearer ${this.apiKey}` }), n = JSON.parse(t.responseText); return 200 === n.code ? (this.apiKey = n.data.api_key, this.saveToCache(), n.data.api_key, { success: !0, message: "API Key \u5237\u65b0\u6210\u529f", api_key: n.data.api_key }) : { success: !1, message: n.message || "API Key \u5237\u65b0\u5931\u8d25" }; } catch (e) { return { success: false, message: e.message || "API Key \u5237\u65b0\u5931\u8d25" }; } }, async fuzzySearchQuestion(e) { var t; try { const t = apiUrl("question/fuzzy"), n = { question: e.question, type: e.type ?? 8, options: e.options ?? [] }, [a] = await requestApi(t, "POST", n), i = JSON.parse(a.responseText), s = 401 === i.code || 401 === a.status; return 200 === i.code ? { success: !0, message: i.message || "success", data: i.data || [] } : s ? { success: !1, message: i.message || "\u767b\u5f55\u540e\u624d\u53ef\u4ee5\u4f7f\u7528\u5b98\u65b9\u9898\u5e93\uff0c\u8bf7\u5148\u767b\u5f55", data: [], needLogin: !0 } : { success: !1, message: i.message || "\u5b98\u65b9\u9898\u5e93\u641c\u7d22\u5931\u8d25", data: [] }; } catch (n) { const e = 401 === (null == n ? void 0 : n.status) || 401 === (null == (t = null == n ? void 0 : n.response) ? void 0 : t.status); return { success: false, message: e ? "\u767b\u5f55\u540e\u624d\u53ef\u4ee5\u4f7f\u7528\u5b98\u65b9\u9898\u5e93\uff0c\u8bf7\u5148\u767b\u5f55" : (null == n ? void 0 : n.message) || "\u5b98\u65b9\u9898\u5e93\u641c\u7d22\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5", data: [], needLogin: e }; } }, async fetchNotice(e = {}) { var t; const n = getCachedNoticeResult(this, Date.now(), e); if (n) return n; try { const [e] = await requestApi(apiUrl("aiAskNotice"), "GET"), n = JSON.parse(e.responseText), a = (null == (t = null == n ? void 0 : n.data) ? void 0 : t.notice) ?? (null == n ? void 0 : n.data); return 200 === n.code ? (this.notice = a || "", { success: !0, notice: this.notice, message: n.message }) : { success: !1, message: n.message || "\u516c\u544a\u83b7\u53d6\u5931\u8d25" }; } catch (a) { return this.notice ? { success: true, notice: this.notice } : { success: false, message: (null == a ? void 0 : a.message) || "\u516c\u544a\u83b7\u53d6\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u518d\u8bd5" }; } finally { this.noticeLoaded = true, this.noticeFetchedAt = Date.now(); } }, saveToCache() { const e = { user: this.user || void 0, api_key: this.apiKey || void 0, login_time: this.loginTime || void 0 }; Cache.set("user", e); }, loadFromCache() { const e = Cache.get("user", {}); e.user && (this.user = e.user, this.apiKey = e.api_key || "", this.loginTime = e.login_time || 0, this.isLoggedIn = true); } } }), jn = { get: e => Cache.get(e), set: (e, t) => Cache.set(e, t) }; const On = pinia.defineStore("ai", { state: () => ({ aiMsg: "", aiLoading: false, settings: loadAiSettingsFrom(jn, Pe, getApp), catalog: { seq: 0, fetchedAt: 0, channels: Pe }, catalogLoading: false, connectionTestingId: "", connectionMessage: "", connectionTestingIds: {}, connectionMessages: {}, connectionRequestTokens: {}, latestConnectionRequestToken: "" }), actions: { selectTargetById(e) { if (this.settings.instances.find((t => t.channelId === e))) return resolveAiTarget({ ...this.settings, defaultChannelId: e, sceneOverrides: { enabled: false } }, this.catalog, "search", "text"); }, currentAiMd() { return createSafeMarkdownHtml(this.aiMsg); }, resetAi() { this.aiMsg = "", this.aiLoading = false; }, saveSettings() { this.settings = ((e, t) => { const n = normalizeAiSettingsV2(t) ?? t; return e.set(Fe, n), n; })(jn, this.settings); }, async loadCatalog() { if (!this.catalogLoading) { this.catalogLoading = true; try { this.catalog = await fetchCatalog({ cacheGet: e => Cache.get(e), cacheSet: (e, t) => Cache.set(e, t), now: () => Date.now(), request: async () => { const e = await createAiTransportRequest({ method: "GET", url: `${we}/ai/channels`, headers: { Accept: "application/json" }, timeout: 15e3, responseType: "json" }).promise; return "string" == typeof e.response ? JSON.parse(e.response) : e.response ?? JSON.parse(e.responseText || "{}"); } }); } finally { this.catalogLoading = false; } } }, selectTarget(e, t = "text") { return resolveAiTarget(this.settings, this.catalog, e, t); }, routeContextFor(e) { if (!this.settings.customChannels.some((t => t.id === e.channel.id))) return { channel: e.channel, apiKey: Mn().apiKey || "", transport: this.settings.transport, modelId: e.instance.modelId }; }, catalogForDisplay() { return this.catalog.channels.filter((e => "active" === e.status)).sort(((e, t) => e.recommended !== t.recommended ? e.recommended ? -1 : 1 : e.order - t.order)); }, updateCredential(e, t) { const n = this.settings.instances.find((t => t.channelId === e)); n ? n.credential = { ...t, updatedAt: Date.now() } : this.settings.instances.push({ channelId: e, credential: { ...t, updatedAt: Date.now() }, enabled: true }), this.saveSettings(); }, addChannel(e) { this.settings.instances.some((t => t.channelId === e)) || (this.settings.instances.push({ channelId: e, enabled: true }), this.settings.defaultChannelId || (this.settings.defaultChannelId = e), this.saveSettings()); }, removeInstance(e) { var t; this.settings.instances = this.settings.instances.filter((t => t.channelId !== e)), this.settings.customChannels = this.settings.customChannels.filter((t => t.id !== e)), this.settings.defaultChannelId === e && (this.settings.defaultChannelId = (null == (t = this.settings.instances[0]) ? void 0 : t.channelId) || ""), this.settings.defaultVisionChannelId === e && (this.settings.defaultVisionChannelId = ""), delete this.connectionTestingIds[e], delete this.connectionMessages[e], delete this.connectionRequestTokens[e], this.connectionTestingId === e && (this.connectionTestingId = ""), this.saveSettings(); }, async testConfig(e) { var t; const n = null == (t = this.selectTargetById(e)) ? void 0 : t.config, a = `${Date.now()}-${Math.random()}`; this.connectionTestingId = e, this.connectionMessage = "", this.connectionTestingIds[e] = true, this.connectionMessages[e] = "", this.connectionRequestTokens[e] = a, this.latestConnectionRequestToken = a; const updateConnectionMessage = t => { const n = t.success ? `\u8fde\u63a5\u6210\u529f\uff0c\u8017\u65f6 ${t.duration}ms` : t.displayMessage || "\u8fde\u63a5\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u914d\u7f6e"; this.connectionRequestTokens[e] === a && (this.connectionMessages[e] = n), this.latestConnectionRequestToken === a && (this.connectionMessage = n); }; try { const e = await (async e => runAiScene("search", e, "\u8bf7\u53ea\u56de\u590d\u201c\u8fde\u63a5\u6210\u529f\u201d", { stream: !1 }))(n); return updateConnectionMessage(e), e; } catch (i) { const e = { success: false, text: "", duration: 0, displayMessage: "\u8fde\u63a5\u6d4b\u8bd5\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5" }; return updateConnectionMessage(e), e; } finally { this.connectionRequestTokens[e] === a && (delete this.connectionTestingIds[e], delete this.connectionRequestTokens[e]), this.latestConnectionRequestToken === a && (this.connectionTestingId = "", this.latestConnectionRequestToken = ""); } } } }), waitForAnswerRender = async () => { await vue.nextTick(), await function(e = {}, t = 120) { var n; const a = e.requestAnimationFrame ?? (null == (n = globalThis.requestAnimationFrame) ? void 0 : n.bind(globalThis)), i = e.setTimeout ?? globalThis.setTimeout.bind(globalThis), s = e.clearTimeout ?? globalThis.clearTimeout.bind(globalThis); return new Promise((e => { let n, r = false; const finish = () => { r || (r = true, e()); }; n = i(finish, t), a && a((() => { void 0 !== n && s(n), finish(); })); })); }(); }, zn = pinia.defineStore("ask", { state: () => ({ questionList: [], questionInx: 0, inx: 0, Interval: 0, start: false, skipFinish: Cache.get("skipFinish", false), autoNext: Cache.get("autoNext", false), autoAnswer: Cache.get("autoAnswer", true), freeFirst: true, randomAnswer: Cache.get("randomAnswer", false), lock: false, runToken: 0, formMap: {}, type: "cx", loading: false, loadingText: "\u52a0\u8f7d\u4e2d....", loadingRunToken: 0, aiLoadingIndex: -1, aiPreview: null, aiFailureMap: {}, restartPending: false, tips: "\u672c\u811a\u672c\u4ec5\u4f9b\u5b66\u4e60\u7814\u7a76\uff0c\u8bf7\u52ff\u7528\u4e8e\u975e\u6cd5\u7528\u9014", delay: Cache.get("delay", 1e3), minDelay: Cache.get("minDelay", 0), optionDelay: Cache.get("optionDelay", 0), optionMinDelay: 0, saveQuestionData: [] }), actions: { addQuestion(e) { this.questionList.push({ ...e, answer: [], status: 0, phase: "idle", error: "", taskId: "", aiMsg: "" }); }, clearQuestion() { this.questionList = []; }, getQuestion() { return this.questionList[this.questionInx]; }, nextQuestion() { if (this.questionInx === this.questionList.length - 1) return clearInterval(this.Interval), void (this.start = false); this.questionInx++; }, prevQuestion() { 0 !== this.questionInx && this.questionInx--; }, toQuestion(e) { this.questionInx = e; let t = this.questionList[e]; this.rule.toquestion && this.rule.toquestion(e); try { if (t.html.scrollIntoView({ block: "center" }), se.self !== se.top) { let n = document.querySelector(".el-dialog"); if (n) { n.style.transform = "none"; let a = t.html.getBoundingClientRect(); n.style.top = a.top - 700 + "px", 0 === e && (n.style.top = "0px"), e === this.questionList.length - 1 && document.documentElement.scrollHeight > 2e3 && (n.style.top = a.top - 900 + "px"); } } t.html.style.boxShadow = "0 0 10px rgba(0, 0, 0, 0.15)", setTimeout((() => { t.html.style.boxShadow = ""; }), 500); } catch (n) {} }, setQuestionStatus(e, t) { this.questionList[e] && null != this.questionList[e].status && (this.questionList[e].status = t); }, async toggleStart() { const e = getAppStore(); let t = 0; try { const n = await async function(e, t) { const n = function(e) { return e.lock ? "noop" : e.start ? "stop" : "start"; }(e); if ("noop" === n) return n; if ("stop" === n) return e.start = !1, n; e.start = !0, e.lock = !0; try { return await t(), e.start ? n : "stop"; } finally { e.start = !1, e.lock = !1; } }(this, (async () => { var n; const a = createNextRunToken(this); t = a; for (let t = this.questionInx; t < this.questionList.length && this.start; t++) { if (this.skipFinish && 1 === this.questionList[t].status) continue; this.questionInx = t; let i = this.questionList[t]; if ("8" !== i.type || isTextAnswerUnknownQuestion(i)) { if ((null == (n = this.rule) ? void 0 : n.answerDelay) && (await sleep(this.rule.answerDelay), !isRunTokenCurrent(this, a))) { this.start = !1; break; } if (await this.reAnswer(t, a), !isRunTokenCurrent(this, a)) { this.start = !1; break; } if (!this.start) break; if (e.app.alert = `\u5f53\u524d\u8fdb\u5ea6:${t + 1}/${this.questionList.length}`, await sleep(this.delay + 1e3 * Math.random()), !isRunTokenCurrent(this, a)) { this.start = !1; break; } this.rule.toquestion && this.rule.toquestion(this.questionInx + 1), this.autoNext && this.rule.next && this.rule.next(); } else this.setQuestionStatus(t, 2); } })); if (this.restartPending && "noop" !== n) return this.restartPending = !1, this.loadingRunToken === t && (this.loading = !1), void (await this.toggleStart()); if ("start" !== n) return; this.finishRun(e); } catch (n) { e.app.alert = "\u7b54\u9898\u4e2d\u65ad\uff0c\u8bf7\u91cd\u8bd5"; } finally { if (this.restartPending && !this.lock) return this.restartPending = false, this.loadingRunToken === t && (this.loading = false), void (await this.toggleStart()); this.lock || this.start || this.loadingRunToken !== t || (this.loading = false); } }, finishRun(e = getAppStore()) { this.autoNext && this.rule.finish && this.rule.finish({ question: this.questionList }), this.formMap = {}, this.questionList.forEach((t => { var n; if (null == (n = t.form) ? void 0 : n.form) { let e = t.form.form; e && (this.formMap[e] = this.formMap[e] ? this.formMap[e] + 1 : 1); } else this.formMap["\u65e0\u7b54\u6848"] = this.formMap["\u65e0\u7b54\u6848"] ? this.formMap["\u65e0\u7b54\u6848"] + 1 : 1; e.app.alert = "\u7b54\u9898\u5b8c\u6210~"; })); }, setQuestionPhase(e, t, n, a = "") { const i = this.questionList[e]; i && (i.phase = t, i.status = phaseToLegacyStatus(t), i.error = a, n && (i.taskId = n.id), a ? this.aiFailureMap[e] = a : "failed" !== t && "no-answer" !== t && delete this.aiFailureMap[e]); }, publishQuestionTaskResult(e, t) { const n = this.questionList[e]; n && (t.answer && (n.answer = t.answer), "form" in t && (n.form = t.form), t.phase && (n.phase = t.phase), void 0 !== t.status && (n.status = t.status), t.taskId && (n.taskId = t.taskId), n.error = t.error || "", t.error && (this.aiFailureMap[e] = t.error)); }, publishQuestionTaskPreview(e, t) { this.aiPreview = t ? { index: e, answer: t.answer, rawText: t.rawText, reason: t.reason } : null; }, createQuestionRunnerDeps(e) { return getAppStore(), { getQuestion: e => this.questionList[e], isCurrentRun: e => isRunTokenCurrent(this, e), runPipeline: (t, n) => runQuestionPipelineFromSources({ task: t, question: n, runToken: e, isCurrentRun: e => isRunTokenCurrent(this, e), askAiEnabled: On().settings.enabledForAsk, randomAnswerEnabled: this.randomAnswer, sources: { getCacheAnswer: e => Answer.getCacheAnswer(e), getRemoteAnswers: e => (this.loadingText = "\u6b63\u5728\u4ece\u63a5\u53e3\u4e2d\u83b7\u53d6\u7b54\u6848", Answer.getAnswersFree(e)), getAiAnswer: async e => { this.loadingText = "\u6b63\u5728\u4eceAI\u4e2d\u83b7\u53d6\u7b54\u6848"; const t = this.buildAIQuestionText(e); return this.fetchAIAnswer(t, n); }, getRandomFillPlan: e => ((e, t = Math.random) => { switch (e.type) { case "0": case "1": if (!Array.isArray(e.options) || 0 === e.options.length) return; return { kind: "choice", indexes: [ randomIndex(e.options.length, t) ] }; case "3": return { kind: "judge", value: t() > .5 ? "\u6b63\u786e" : "\u9519\u8bef" }; case "15": if (!Array.isArray(e.options) || 0 === e.options.length) return; const n = e.options.map((e => Array.isArray(null == e ? void 0 : e.options) && 0 !== e.options.length ? { kind: "choice", indexes: [ randomIndex(e.options.length, t) ] } : { kind: "unsupported", reason: "\u5b50\u9898\u9009\u9879\u4e3a\u7a7a\uff0c\u65e0\u6cd5\u968f\u673a\u7b54\u9898" })); return n.some((e => "choice" === e.kind)) ? { kind: "reading", subPlans: n } : void 0; default: return; } })(e) } }), fillAnswer: (t, n) => (async (e, t, n, a) => { try { return assertFillShouldContinue(a), (a.resolveOptions || defaultResolveOptions)(t), assertFillShouldContinue(a), await applyFillPlan(e, t, n, a.applyLegacyAnswer, { shouldContinue: a.shouldContinue }); } catch (i) { if (i instanceof Error && "\u7b54\u9898\u5df2\u53d6\u6d88" === i.message) return { success: false, reason: "\u7b54\u9898\u5df2\u53d6\u6d88" }; throw i; } })(t, n, this.rule, { applyLegacyAnswer: applyAnswerResult, shouldContinue: () => isRunTokenCurrent(this, e) }), publishQuestion: (e, t) => this.publishQuestionTaskResult(e, t), publishPreview: (e, t) => this.publishQuestionTaskPreview(e, t), setPhase: (e, t, n, a) => this.setQuestionPhase(e, t, n, a), setLoadingText: e => { this.loadingText = e; }, stopAutoRun: () => { this.start = false; }, waitForRender: waitForAnswerRender, log: log$1 }; }, async reAnswer(e, t) { var n; const a = t ?? createNextRunToken(this), i = createQuestionTask({ kind: void 0 === t ? "retry" : "auto", index: e, runToken: a }), s = this.questionList[e]; if (s) { delete this.aiFailureMap[e], (null == (n = this.aiPreview) ? void 0 : n.index) === e && (this.aiPreview = null), this.loading = true, this.loadingRunToken = a; try { await runQuestionTask(i, this.createQuestionRunnerDeps(a)); } finally { this.loadingRunToken === a && (this.loading = false); } } }, buildAIQuestionText: e => (e => { var t; let n = `[${typeConvert(e.type, false)}]${e.question}\n`; if ("15" === e.type && Array.isArray(e.options)) return e.options.forEach(((e, t) => { e && "object" == typeof e && (n += `\n\u5b50\u9898${t + 1}[${typeConvert(e.type, false)}]${e.question || ""}\n`, Array.isArray(e.options) && e.options.length > 0 ? n += `${appendOptionLines(e.options)}\n` : "3" === e.type && (n += "\u8bf7\u56de\u7b54\uff1a\u6b63\u786e \u6216 \u9519\u8bef\n")); })), n; if (Array.isArray(e.options)) { const t = e.options.filter((e => "object" != typeof e)); t.length > 0 && (n += `${appendOptionLines(t)}\n`); } return "24" === e.type && (e.match.forEach((e => { n += `\u7b2c\u4e00\u5217${e}\n`; })), null == (t = e.selects[0]) || t.forEach((e => { n += `\u7b2c\u4e8c\u5217${e.text}\n`; }))), n; })(e), async fetchAIAnswer(e, t) { const n = On(), a = hasQuestionImages(t, e) ? "image" : "text", i = n.selectTarget("ask", a), s = await runAskAiFallback({ text: e, type: t.type, question: t, config: null == i ? void 0 : i.config, route: i ? n.routeContextFor(i) : void 0, adoptionStrategy: n.settings.adoptionStrategy, usePureMatcher: true }); return s; }, async confirmAiPreview() { if (!this.aiPreview) return; const e = this.aiPreview; if (!this.questionList[e.index]) return void (this.aiPreview = null); const t = createNextRunToken(this), n = createQuestionTask({ kind: "confirm-ai-preview", index: e.index, runToken: t, preview: { answer: e.answer, rawText: e.rawText, reason: e.reason } }); this.loading = true, this.loadingRunToken = t, this.aiPreview = null; try { await runQuestionTask(n, this.createQuestionRunnerDeps(t)); } finally { this.loadingRunToken === t && (this.loading = false); } const a = getPreviewResumeAction(e.index, this.questionList.length); this.questionInx = a.nextIndex, a.shouldFinish ? this.finishRun() : this.toggleStart(); }, skipAiPreview() { if (!this.aiPreview) return; const e = this.aiPreview, t = this.questionList[e.index]; t && (t.phase = "no-answer", t.status = phaseToLegacyStatus("no-answer"), t.error = "\u7528\u6237\u8df3\u8fc7 AI \u5efa\u8bae", this.aiFailureMap[e.index] = "\u7528\u6237\u8df3\u8fc7 AI \u5efa\u8bae"), this.aiPreview = null; const n = getPreviewResumeAction(e.index, this.questionList.length); this.questionInx = n.nextIndex, n.shouldFinish ? this.finishRun() : this.toggleStart(); }, async aiAnswer(e) { var t, n; const a = createNextRunToken(this), i = createQuestionTask({ kind: "manual-ai", index: e, runToken: a }), s = this.questionList[e]; if (s) { this.loadingText = "AI\u601d\u8003\u4e2d.....", this.loading = true, this.loadingRunToken = a, this.aiLoadingIndex = e, s.aiMsg = ""; try { const r = await runQuestionTask(i, this.createQuestionRunnerDeps(a)); if ("preview" === r.phase && (null == (t = this.aiPreview) ? void 0 : t.index) === e) return void (s.aiMsg = this.aiPreview.rawText || r.reason || ""); if (r.reason) s.aiMsg = createManualAiDisplayMessage(!1, "", r.reason); else if (null == (n = s.answer) ? void 0 : n.length) { const e = s.answer[s.answer.length - 1], t = (null == e ? void 0 : e.rawText) || (Array.isArray(null == e ? void 0 : e.answer) ? e.answer.join("\u3001") : ""); s.aiMsg = createManualAiDisplayMessage("done" === r.phase, t, "AI \u672a\u91c7\u7eb3\u8be5\u7b54\u6848"); } } catch { const t = "AI\u54cd\u5e94\u5f02\u5e38\uff0c\u8bf7\u5148\u5728 AI \u8bbe\u7f6e\u4e2d\u586b\u5199 API Key\u3001\u6a21\u578b\u548c Base URL"; s.aiMsg = t, this.aiFailureMap[e] = t, this.setQuestionPhase(e, "failed", i, t); } finally { this.loadingRunToken === a && (this.loading = false), this.aiLoadingIndex = -1; } } }, pause() { this.start = false, createNextRunToken(this); }, restart() { const e = { questionInx: 0, start: false }; this.questionInx = e.questionInx, this.start = e.start, this.aiPreview = null, createNextRunToken(this), this.lock ? this.restartPending = true : this.toggleStart(); } }, getters: { current() { return this.questionList[this.questionInx]; }, currentAiMd() { return createSafeMarkdownHtml(this.questionList[this.questionInx].aiMsg); }, tipsMd() { const e = this.rule; if (!e) return '\u8be5\u9875\u9762\u6682\u65e0\u89c4\u5219'; const t = []; return t.push(`${e.name}${e.tips || "\u6709\u95ee\u9898\u53ef\u4ee5\u53cd\u9988\u7ed9\u4f5c\u8005"}`), t.join("
    "); }, typesMd() { const e = this.rule; if (!e || !e.types) return '\u8be5\u9875\u9762\u6682\u65e0\u89c4\u5219'; const t = e.types, n = []; for (const a in t) { const e = t[a]; n.push(`${typeConvert(e, false)} \u2705`); } return n.push('\u4e0d\u652f\u6301\u7684\u9898\u578b\u53ef\u4ee5\u53cd\u9988\u7ed9\u4f5c\u8005\u517c\u5bb9'), n.join("
    "); } } }); function useAskOverview() { const e = zn(); return vue.computed((() => { const t = e.aiPreview ? e.aiPreview.index : -1, n = e.questionList.map(((e, n) => function(e, t = false) { return t || "preview" === e.phase ? "wait" : e.phase && z.has(e.phase) ? "run" : "done" === e.phase || 1 === e.status ? "done" : "no-answer" === e.phase || "failed" === e.phase || 2 === e.status ? "none" : "todo"; }(e, n === t))); return { marks: n, tally: tallyMarks(n), firstNone: n.indexOf("none"), firstWait: n.indexOf("wait") }; })); } const Fn = [ "data-index", "aria-current", "onClick" ], Dn = { class: "ask-row-num num" }, Nn = { class: "ask-row-stem" }, Rn = { class: "ask-row-src" }, Bn = { class: "ask-strip", open: "" }, Gn = vue.createElementVNode("span", null, "\u9898\u53f7", -1), Kn = { class: "ask-strip-meta num" }, Vn = { class: "ask-cells" }, Wn = [ "aria-label", "onClick" ], Qn = { class: "ask-detail scroll", "aria-live": "polite" }, Jn = { class: "ask-detail-head" }, Yn = { class: "ask-detail-num num" }, Xn = { class: "aah-tag" }, Zn = { class: "ask-detail-actions" }, ea = [ "innerHTML" ], ta = [ "innerHTML" ], na = { class: "ask-option-key" }, aa = [ "innerHTML" ], ia = [ "innerHTML" ], sa = { class: "ask-option-key" }, ra = [ "innerHTML" ], oa = { key: 0, class: "ask-match-table" }, la = [ "innerHTML" ], ca = { class: "aah-select" }, ua = [ "value" ], pa = { key: 2, class: "aah-alert aah-alert-danger" }, da = { key: 3, class: "ask-preview" }, ma = { class: "ask-preview-head" }, ha = vue.createElementVNode("strong", null, "AI \u5efa\u8bae", -1), fa = { class: "ask-preview-reason" }, ga = vue.createElementVNode("p", { class: "ask-preview-note" }, "AI \u7ed3\u679c\u4ec5\u4f9b\u53c2\u8003\uff0c\u786e\u8ba4\u540e\u624d\u4f1a\u586b\u5165\u9875\u9762\u3002", -1), va = { class: "ask-preview-actions" }, ya = { key: 4, class: "aah-alert aah-alert-warning" }, ba = { class: "ask-sources" }, wa = vue.createElementVNode("h3", { class: "aah-section-title" }, "\u7b54\u6848\u6765\u6e90", -1), xa = { class: "ask-chain", "aria-label": "\u67e5\u627e\u94fe" }, ka = vue.createElementVNode("span", { class: "ask-chain-dot", "aria-hidden": "true" }, null, -1), qa = { class: "ask-chain-label" }, _a = { class: "ask-chain-state" }, Aa = { key: 0, class: "ask-source-empty ask-chain-hint" }, Ta = { key: 1, class: "ask-source-table" }, Ca = { class: "ask-source-name" }, Sa = { key: 0, class: "aah-tag aah-tag-primary" }, Ia = { class: "ask-source-answer" }, Ea = [ "innerHTML" ], Ua = [ "innerHTML" ], Pa = [ "innerHTML" ], Ha = [ "innerHTML" ], $a = { class: "ask-source-time num" }, La = { key: 2, class: "ask-source-empty" }, Ma = { key: 5, class: "ask-ai" }, ja = { class: "aah-section-title" }, Oa = { key: 0, class: "ask-ai-streaming" }, za = [ "innerHTML" ], Fa = { key: 1, class: "ask-source-empty" }, Da = { key: 1, class: "ask-empty" }, Na = vue.createElementVNode("h2", null, "\u5f53\u524d\u9875\u9762\u672a\u8bc6\u522b\u5230\u9898\u76ee", -1), Ra = vue.createElementVNode("p", null, "\u6253\u5f00\u4f5c\u4e1a\u3001\u8003\u8bd5\u6216\u7ae0\u8282\u6d4b\u9a8c\u9875\u9762\u540e\u4f1a\u81ea\u52a8\u8bc6\u522b\u5e76\u5f00\u59cb\u67e5\u627e\u7b54\u6848\u3002", -1), Ba = vue.createElementVNode("li", null, "\u786e\u8ba4\u5f53\u524d\u7f51\u7ad9\u5728\u652f\u6301\u7684\u5e73\u53f0\u5217\u8868\u91cc", -1), Ga = vue.createElementVNode("li", null, "\u9898\u76ee\u5728 iframe \u91cc\u65f6\uff0c\u7b49\u9875\u9762\u5b8c\u5168\u52a0\u8f7d\u540e\u518d\u6253\u5f00\u9762\u677f", -1), Ka = vue.createElementVNode("li", null, "\u8bc6\u522b\u4e0d\u5230\u53ef\u4ee5\u5148\u7528\u300c\u641c\u9898\u300d\uff0c\u5e76\u628a\u9875\u9762\u5730\u5740\u53cd\u9988\u7ed9\u4f5c\u8005", -1), Va = { class: "ask-empty-actions" }, Wa = [ "innerHTML" ], Qa = { key: 2, class: "area-foot" }, Ja = { class: "ask-tally num" }, Ya = { class: "is-done", title: "\u5df2\u7b54" }, Xa = vue.createElementVNode("i", null, "\u5df2\u7b54", -1), Za = { class: "is-none", title: "\u65e0\u7b54\u6848" }, ei = vue.createElementVNode("i", null, "\u65e0\u7b54\u6848", -1), ti = { key: 0, class: "is-wait", title: "AI \u5f85\u786e\u8ba4" }, ni = vue.createElementVNode("i", null, "\u5f85\u786e\u8ba4", -1), ai = { class: "is-todo", title: "\u672a\u7b54" }, ii = vue.createElementVNode("i", null, "\u672a\u7b54", -1), si = vue.createElementVNode("span", { class: "area-foot-spacer" }, null, -1), ri = { class: "area-foot-pop" }, oi = [ "aria-expanded" ], li = { key: 0, class: "ask-tips aah-menu scroll", role: "note" }, ci = [ "innerHTML" ], ui = { key: 0, class: "ask-tips-forms" }, pi = vue.createElementVNode("summary", null, "\u652f\u6301\u7684\u9898\u578b", -1), di = [ "innerHTML" ], mi = vue.defineComponent({ __name: "Ask", setup(e) { const t = zn(), y = $n(), b = On(), w = useAskOverview(), x = vue.ref(null), k = vue.ref(false), q = vue.computed((() => t.questionList.map((e => (e => { const t = document.createElement("div"); return t.innerHTML = e ?? "", (t.textContent || "").replace(/\s+/g, " ").trim(); })(e.question))))), sourceLabel = (e, n) => { var a, i; return "done" === n ? (null == (i = null == (a = t.questionList[e]) ? void 0 : a.form) ? void 0 : i.form) || "\u5df2\u4f5c\u7b54" : "todo" === n ? "" : F[n]; }, _ = vue.computed((() => w.value.marks[t.questionInx] ?? "todo")), A = vue.computed((() => t.aiLoadingIndex === t.questionInx)), T = vue.computed((() => Boolean(t.current && (t.current.aiMsg || A.value)))), C = vue.computed((() => !!t.aiPreview && t.aiPreview.index === t.questionInx)), S = vue.computed((() => !(!t.current || "8" != t.current.type && t.current.type))), I = vue.computed((() => t.current ? typeConvert(t.current.type ?? "", false) : "")), E = vue.computed((() => { var e, n; return (null == (n = null == (e = t.current) ? void 0 : e.form) ? void 0 : n.form) ?? ""; })), U = vue.computed((() => { var e; return function(e) { const t = e.answers.filter((e => e.form === D)), n = e.answers.filter((e => isAiForm(e.form))), a = e.answers.filter((e => e.form !== D && !isAiForm(e.form))), settled = e => e.length ? e.some(hasAnswer) ? "hit" : "miss" : null, i = [ { key: "cache", label: "\u672c\u5730\u7f13\u5b58", state: settled(t) ?? "pending" }, { key: "remote", label: a.length > 1 ? `\u5728\u7ebf\u9898\u5e93 \xb7 ${a.length} \u4e2a` : "\u5728\u7ebf\u9898\u5e93", state: settled(a) ?? "pending" }, { key: "ai", label: "AI", state: "pending" } ]; "wait" === e.mark ? i[2].state = "wait" : e.aiStreaming ? i[2].state = "run" : e.aiFailed ? i[2].state = "miss" : i[2].state = settled(n) ?? (e.aiEnabled ? "pending" : "off"); const s = i.findIndex((e => "hit" === e.state)); if (s >= 0) for (let r = s + 1; r < i.length; r++) "pending" === i[r].state && (i[r].state = "off"); if ("run" === e.mark) { const e = i.find((e => "pending" === e.state)); e && (e.state = "run"); } else if ("todo" !== e.mark) for (const r of i) "pending" === r.state && (r.state = "off"); return i; }({ answers: (null == (e = t.current) ? void 0 : e.answer) ?? [], mark: _.value, aiEnabled: !!b.settings.enabledForAsk, aiStreaming: A.value, aiFailed: !!t.aiFailureMap[t.questionInx] }); })), P = { pending: "\u5f85\u67e5", run: "\u67e5\u627e\u4e2d", hit: "\u547d\u4e2d", miss: "\u672a\u547d\u4e2d", wait: "\u5f85\u786e\u8ba4", off: "\u4e0d\u67e5" }, $ = vue.computed((() => "off" === U.value[2].state && U.value.every((e => "hit" !== e.state)) ? "AI \u672a\u5f00\u542f\uff1a\u53ef\u5728 \u8bbe\u7f6e \u2192 \u7b54\u9898 \u4e2d\u542f\u7528\uff0c\u7ed3\u679c\u9700\u8981\u4f60\u786e\u8ba4\u540e\u624d\u586b\u5165" : "")), L = vue.computed((() => { var e, n; const a = null == (n = null == (e = t.current) ? void 0 : e.form) ? void 0 : n.match; return Array.isArray(a) ? a : []; })), optionKey = e => String.fromCharCode(65 + e), pad = e => String(e).padStart(2, "0"), toggleRun = () => t.start ? t.pause() : t.toggleStart(); return vue.watch((() => t.questionInx), (async e => { var t, n; await vue.nextTick(), null == (n = null == (t = x.value) ? void 0 : t.querySelector(`[data-index="${e}"]`)) || n.scrollIntoView({ block: "nearest" }); })), (e, l) => { var c; return vue.openBlock(), vue.createElementBlock("div", { class: vue.normalizeClass([ "area ask-area", { "is-empty": !vue.unref(t).questionList.length } ]) }, [ vue.unref(t).questionList.length && vue.unref(t).current ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ vue.createElementVNode("ol", { ref_key: "listRef", ref: x, class: "ask-list scroll", "aria-label": "\u9898\u76ee\u6e05\u5355" }, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(t).questionList, ((e, r) => (vue.openBlock(), vue.createElementBlock("li", { key: r, "data-index": r, class: vue.normalizeClass([ "ask-row", [ `is-${vue.unref(w).marks[r]}`, { "is-current": r === vue.unref(t).questionInx } ] ]), "aria-current": r === vue.unref(t).questionInx ? "true" : void 0, onClick: e => vue.unref(t).toQuestion(r) }, [ vue.createElementVNode("span", Dn, vue.toDisplayString(pad(r + 1)), 1), vue.createVNode(X, { mark: vue.unref(w).marks[r] }, null, 8, [ "mark" ]), vue.createElementVNode("span", Nn, vue.toDisplayString(q.value[r] || "\uff08\u65e0\u9898\u5e72\uff09"), 1), vue.createElementVNode("span", Rn, vue.toDisplayString(sourceLabel(r, vue.unref(w).marks[r])), 1) ], 10, Fn)))), 128)) ], 512), vue.createElementVNode("details", Bn, [ vue.createElementVNode("summary", null, [ Gn, vue.createElementVNode("span", Kn, "\u7b2c " + vue.toDisplayString(vue.unref(t).questionInx + 1) + " / " + vue.toDisplayString(vue.unref(t).questionList.length) + " \u9898", 1) ]), vue.createElementVNode("div", Vn, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(t).questionList, ((e, r) => (vue.openBlock(), vue.createElementBlock("button", { key: r, type: "button", class: vue.normalizeClass([ "ask-cell num", [ `is-${vue.unref(w).marks[r]}`, { "is-current": r === vue.unref(t).questionInx } ] ]), "aria-label": `\u7b2c ${r + 1} \u9898\uff0c${vue.unref(F)[vue.unref(w).marks[r]]}`, onClick: e => vue.unref(t).toQuestion(r) }, [ vue.createVNode(X, { mark: vue.unref(w).marks[r], size: 11 }, null, 8, [ "mark" ]), vue.createTextVNode(vue.toDisplayString(r + 1), 1) ], 10, Wn)))), 128)) ]) ]), vue.createElementVNode("section", Qn, [ vue.createElementVNode("header", Jn, [ vue.createElementVNode("span", Yn, vue.toDisplayString(pad(vue.unref(t).questionInx + 1)), 1), vue.createElementVNode("span", Xn, vue.toDisplayString("15" == vue.unref(t).current.type ? "\u9605\u8bfb\u7406\u89e3" : I.value || "\u672a\u77e5\u9898\u578b"), 1), vue.createElementVNode("span", { class: vue.normalizeClass([ "ask-detail-state", `is-${_.value}` ]) }, [ vue.createVNode(X, { mark: _.value }, null, 8, [ "mark" ]), vue.createTextVNode(" " + vue.toDisplayString(vue.unref(t).loading && "run" === _.value ? vue.unref(t).loadingText : vue.unref(F)[_.value]), 1) ], 2), vue.createElementVNode("span", Zn, [ vue.createElementVNode("button", { class: "aah-btn aah-btn-small", type: "button", onClick: l[0] || (l[0] = e => vue.unref(t).reAnswer(vue.unref(t).questionInx)) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:refresh" }), vue.createTextVNode("\u91cd\u7b54 ") ]), vue.createElementVNode("button", { class: "aah-btn aah-btn-small", type: "button", onClick: l[1] || (l[1] = e => vue.unref(t).aiAnswer(vue.unref(t).questionInx)) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:creation-outline" }), vue.createTextVNode("AI \u4f5c\u7b54 ") ]) ]) ]), "15" == vue.unref(t).current.type ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ vue.createElementVNode("div", { class: "ask-stem reading-passage", innerHTML: vue.unref(t).current.question }, null, 8, ea), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(t).current.options, ((e, l) => (vue.openBlock(), vue.createElementBlock("div", { key: l, class: "ask-sub" }, [ vue.createElementVNode("div", { class: "ask-sub-title", innerHTML: l + 1 + ". " + e.question }, null, 8, ta), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(e.options, ((e, r) => { var c, u, p, d, h, f; return vue.openBlock(), vue.createElementBlock("div", { key: r, class: vue.normalizeClass([ "ask-option", { "is-hit": null == (p = null == (u = null == (c = vue.unref(t).current.form) ? void 0 : c.match) ? void 0 : u[l]) ? void 0 : p.includes(r) } ]) }, [ vue.createElementVNode("span", na, vue.toDisplayString(optionKey(r)), 1), vue.createElementVNode("span", { class: "ask-option-text", innerHTML: e }, null, 8, aa), (null == (f = null == (h = null == (d = vue.unref(t).current.form) ? void 0 : d.match) ? void 0 : h[l]) ? void 0 : f.includes(r)) ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), { key: 0, icon: "mdi:check", class: "ask-option-check" })) : vue.createCommentVNode("", true) ], 2); })), 128)) ])))), 128)) ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ vue.createElementVNode("div", { class: "ask-stem", innerHTML: vue.unref(t).current.question }, null, 8, ia), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(t).current.options, ((e, t) => (vue.openBlock(), vue.createElementBlock("div", { key: t, class: vue.normalizeClass([ "ask-option", { "is-hit": L.value.includes(t) } ]) }, [ vue.createElementVNode("span", sa, vue.toDisplayString(optionKey(t)), 1), vue.createElementVNode("span", { class: "ask-option-text", innerHTML: e }, null, 8, ra), L.value.includes(t) ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), { key: 0, icon: "mdi:check", class: "ask-option-check" })) : vue.createCommentVNode("", true) ], 2)))), 128)), "24" == vue.unref(t).current.type ? (vue.openBlock(), vue.createElementBlock("table", oa, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(t).current.match, ((e, s) => (vue.openBlock(), vue.createElementBlock("tr", { key: s }, [ vue.createElementVNode("td", { innerHTML: e }, null, 8, la), vue.createElementVNode("td", null, [ vue.createElementVNode("select", ca, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(t).current.selects[s], (e => (vue.openBlock(), vue.createElementBlock("option", { key: e.value, value: e.value }, vue.toDisplayString(e.text), 9, ua)))), 128)) ]) ]) ])))), 128)) ])) : vue.createCommentVNode("", true) ], 64)), S.value ? (vue.openBlock(), vue.createElementBlock("div", pa, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:alert-circle-outline" }), vue.createTextVNode("\u5f53\u524d\u9898\u578b\u6682\u4e0d\u652f\u6301\uff0c\u8bf7\u628a\u9875\u9762\u5730\u5740\u53cd\u9988\u7ed9\u4f5c\u8005 ") ])) : vue.createCommentVNode("", true), C.value && vue.unref(t).aiPreview ? (vue.openBlock(), vue.createElementBlock("div", da, [ vue.createElementVNode("div", ma, [ vue.createVNode(X, { mark: "wait" }), ha, vue.createElementVNode("span", fa, vue.toDisplayString(vue.unref(t).aiPreview.reason), 1) ]), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(t).aiPreview.answer, ((e, t) => (vue.openBlock(), vue.createElementBlock("div", { class: "ask-preview-answer", key: t }, vue.toDisplayString(e), 1)))), 128)), ga, vue.createElementVNode("div", va, [ vue.createElementVNode("button", { class: "aah-btn aah-btn-primary aah-btn-small", type: "button", onClick: l[2] || (l[2] = e => vue.unref(t).confirmAiPreview()) }, "\u786e\u8ba4\u586b\u5165"), vue.createElementVNode("button", { class: "aah-btn aah-btn-small", type: "button", onClick: l[3] || (l[3] = e => vue.unref(t).skipAiPreview()) }, "\u8df3\u8fc7") ]) ])) : vue.createCommentVNode("", true), vue.unref(t).aiFailureMap[vue.unref(t).questionInx] ? (vue.openBlock(), vue.createElementBlock("div", ya, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:alert-outline" }), vue.createTextVNode(vue.toDisplayString(vue.unref(t).aiFailureMap[vue.unref(t).questionInx]), 1) ])) : vue.createCommentVNode("", true), vue.createElementVNode("section", ba, [ wa, vue.createElementVNode("ol", xa, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(U.value, (e => (vue.openBlock(), vue.createElementBlock("li", { key: e.key, class: vue.normalizeClass([ "ask-chain-step", `is-${e.state}` ]) }, [ ka, vue.createElementVNode("span", qa, vue.toDisplayString(e.label), 1), vue.createElementVNode("span", _a, vue.toDisplayString(P[e.state]), 1) ], 2)))), 128)) ]), $.value ? (vue.openBlock(), vue.createElementBlock("p", Aa, vue.toDisplayString($.value), 1)) : vue.createCommentVNode("", true), (null == (c = vue.unref(t).current.answer) ? void 0 : c.length) ? (vue.openBlock(), vue.createElementBlock("div", Ta, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(t).current.answer, ((e, t) => (vue.openBlock(), vue.createElementBlock("div", { key: t, class: vue.normalizeClass([ "ask-source-row", { "is-used": e.form && e.form === E.value } ]) }, [ vue.createElementVNode("span", Ca, [ vue.createTextVNode(vue.toDisplayString(e.form) + " ", 1), e.form && e.form === E.value ? (vue.openBlock(), vue.createElementBlock("span", Sa, "\u91c7\u7528")) : vue.createCommentVNode("", true) ]), vue.createElementVNode("div", Ia, [ "object" == typeof e.answer && e.answer ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(e.answer, ((e, t) => { return vue.openBlock(), vue.createElementBlock("div", { key: t, class: "answer-field-html", innerHTML: (i = e, createSafeMarkdownHtml("string" == typeof i ? i : String(i ?? ""))) }, null, 8, Ea); var i; })), 128)) : e.needLogin ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ vue.createElementVNode("span", { innerHTML: e.msg }, null, 8, Ua), vue.createElementVNode("button", { class: "aah-btn aah-btn-small aah-btn-primary", type: "button", onClick: l[4] || (l[4] = e => vue.unref(y).setPage("settings", "account")) }, "\u53bb\u767b\u5f55") ], 64)) : e.answer ? (vue.openBlock(), vue.createElementBlock("span", { key: 2, innerHTML: e.answer }, null, 8, Pa)) : (vue.openBlock(), vue.createElementBlock("span", { key: 3, class: "ask-source-miss", innerHTML: e.msg ?? "\u672a\u547d\u4e2d" }, null, 8, Ha)) ]), vue.createElementVNode("span", $a, vue.toDisplayString(e.duration ? `${e.duration}ms` : ""), 1) ], 2)))), 128)) ])) : (vue.openBlock(), vue.createElementBlock("p", La, vue.toDisplayString("run" === _.value ? "\u6b63\u5728\u67e5\u627e\uff0c\u5404\u6765\u6e90\u7684\u7ed3\u679c\u4f1a\u9010\u6761\u51fa\u73b0\u5728\u8fd9\u91cc\u3002" : "\u8fd8\u6ca1\u6709\u67e5\u8be2\u8fd9\u9053\u9898\u3002\u70b9\u300c\u5f00\u59cb\u7b54\u9898\u300d\u6216\u300c\u91cd\u7b54\u300d\u5f00\u59cb\u67e5\u627e\u3002"), 1)) ]), T.value ? (vue.openBlock(), vue.createElementBlock("section", Ma, [ vue.createElementVNode("h3", ja, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:creation-outline" }), vue.createTextVNode("AI \u89e3\u6790 "), A.value ? (vue.openBlock(), vue.createElementBlock("span", Oa, "\u751f\u6210\u4e2d\u2026")) : vue.createCommentVNode("", true) ]), vue.unref(t).current.aiMsg ? (vue.openBlock(), vue.createElementBlock("div", { key: 0, innerHTML: vue.unref(t).currentAiMd, class: "ai-answer-markdown" }, null, 8, za)) : (vue.openBlock(), vue.createElementBlock("p", Fa, "AI \u6b63\u5728\u601d\u8003\uff0c\u5185\u5bb9\u4f1a\u5b9e\u65f6\u51fa\u73b0\u5728\u8fd9\u91cc\u3002")) ])) : vue.createCommentVNode("", true) ]) ], 64)) : (vue.openBlock(), vue.createElementBlock("div", Da, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:text-box-search-outline", class: "ask-empty-icon" }), Na, Ra, vue.createElementVNode("ul", null, [ vue.createElementVNode("li", null, [ vue.createTextVNode("\u6309 "), vue.createElementVNode("kbd", null, vue.toDisplayString(vue.unref(y).app.hotkey), 1), vue.createTextVNode(" \u53ef\u4ee5\u968f\u65f6\u547c\u51fa\u6216\u6536\u8d77\u9762\u677f") ]), Ba, Ga, Ka ]), vue.createElementVNode("div", Va, [ vue.createElementVNode("button", { class: "aah-btn aah-btn-primary", type: "button", onClick: l[5] || (l[5] = e => vue.unref(y).openSearch()) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:magnify" }), vue.createTextVNode("\u641c\u9898 ") ]), vue.createElementVNode("button", { class: "aah-btn", type: "button", onClick: l[6] || (l[6] = e => k.value = !k.value) }, "\u652f\u6301\u7684\u9898\u578b") ]), k.value ? (vue.openBlock(), vue.createElementBlock("div", { key: 0, class: "ask-empty-types", innerHTML: vue.unref(t).typesMd }, null, 8, Wa)) : vue.createCommentVNode("", true) ])), vue.unref(t).questionList.length ? (vue.openBlock(), vue.createElementBlock("footer", Qa, [ vue.createElementVNode("div", Ja, [ vue.createElementVNode("span", Ya, [ vue.createVNode(X, { mark: "done", size: 12 }), Xa, vue.createTextVNode(), vue.createElementVNode("b", null, vue.toDisplayString(vue.unref(w).tally.done), 1) ]), vue.createElementVNode("span", Za, [ vue.createVNode(X, { mark: "none", size: 12 }), ei, vue.createTextVNode(), vue.createElementVNode("b", null, vue.toDisplayString(vue.unref(w).tally.none), 1) ]), vue.unref(w).tally.wait ? (vue.openBlock(), vue.createElementBlock("span", ti, [ vue.createVNode(X, { mark: "wait", size: 12 }), ni, vue.createTextVNode(), vue.createElementVNode("b", null, vue.toDisplayString(vue.unref(w).tally.wait), 1) ])) : vue.createCommentVNode("", true), vue.createElementVNode("span", ai, [ vue.createVNode(X, { mark: "todo", size: 12 }), ii, vue.createTextVNode(), vue.createElementVNode("b", null, vue.toDisplayString(vue.unref(w).tally.todo), 1) ]) ]), si, vue.createElementVNode("div", ri, [ vue.createElementVNode("button", { class: "aah-btn aah-btn-plain aah-btn-icon", type: "button", "aria-label": "\u4f7f\u7528\u63d0\u793a", title: "\u4f7f\u7528\u63d0\u793a", "aria-expanded": k.value, onClick: l[7] || (l[7] = e => k.value = !k.value) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:help-circle-outline" }) ], 8, oi), k.value ? (vue.openBlock(), vue.createElementBlock("div", li, [ vue.createElementVNode("div", { class: "ask-tips-body", innerHTML: vue.unref(t).tipsMd }, null, 8, ci), Object.keys(vue.unref(t).formMap || {}).length ? (vue.openBlock(), vue.createElementBlock("div", ui, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(t).formMap, ((e, t) => (vue.openBlock(), vue.createElementBlock("span", { class: "aah-tag", key: t }, vue.toDisplayString(t) + " \xb7 " + vue.toDisplayString(e) + " \u6b21", 1)))), 128)) ])) : vue.createCommentVNode("", true), vue.createElementVNode("details", null, [ pi, vue.createElementVNode("div", { innerHTML: vue.unref(t).typesMd }, null, 8, di) ]) ])) : vue.createCommentVNode("", true) ]), vue.createElementVNode("button", { class: "aah-btn", type: "button", onClick: l[8] || (l[8] = e => vue.unref(t).restart()) }, "\u91cd\u65b0\u7b54\u9898"), vue.createElementVNode("button", { class: "aah-btn aah-btn-primary ask-run-btn", type: "button", onClick: toggleRun }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: vue.unref(t).start ? "mdi:pause" : "mdi:play" }, null, 8, [ "icon" ]), vue.createTextVNode(vue.toDisplayString(vue.unref(t).start ? "\u6682\u505c\u7b54\u9898" : "\u5f00\u59cb\u7b54\u9898"), 1) ]), vue.createElementVNode("button", { class: "aah-btn aah-btn-icon", type: "button", "aria-label": "\u7b54\u9898\u8bbe\u7f6e", title: "\u7b54\u9898\u8bbe\u7f6e", onClick: l[9] || (l[9] = e => vue.unref(y).setPage("settings", "ask")) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:tune-variant" }) ]) ])) : vue.createCommentVNode("", true) ], 2); }; } }); const hi = [ { value: "0", label: "\u5355\u9009" }, { value: "1", label: "\u591a\u9009" }, { value: "3", label: "\u5224\u65ad" }, { value: "2", label: "\u586b\u7a7a" }, { value: "15", label: "\u9605\u8bfb\u7406\u89e3" } ], fi = [ "\u5bf9", "\u9519" ], withNoReferrer = e => e && e.trim() ? e.replace(/]*>/gi, (e => e.replace(/\/?>$/, ' referrerPolicy="no-referrer">'))) : e, normalizeAnswer$1 = e => null == e ? [] : Array.isArray(e) ? e.length > 0 && Array.isArray(e[0]) ? [] : e.map((e => String(e))) : [ String(e) ], visibleOptions = e => "3" === e.type ? Array.isArray(e.options) && 2 === e.options.length && "string" == typeof e.options[0] ? e.options : fi : "2" === e.type ? [] : Array.isArray(e.options) && e.options.length > 0 && "string" == typeof e.options[0] ? e.options : [], isCorrectOption = (e, t, n) => { const a = normalizeAnswer$1(e.answer); return 0 !== a.length && (!!a.includes(String(t)) || (!!a.includes(n) || a.includes(String.fromCharCode(65 + t)))); }, answerSummary = e => { if (!e || null == e.answer) return ""; if (Array.isArray(e.answer) && e.answer.length > 0 && Array.isArray(e.answer[0])) return e.answer.map(((e, t) => `${t + 1}.${Array.isArray(e) ? e.join(",") : e}`)).join(" "); const t = visibleOptions(e), n = normalizeAnswer$1(e.answer); return t.length > 0 && n.length > 0 ? n.map((e => { const n = Number(e); if (!Number.isNaN(n) && n >= 0 && n < t.length) return String.fromCharCode(65 + n); if (/^[A-Z]$/.test(e)) return e; const a = t.indexOf(e); return a >= 0 ? String.fromCharCode(65 + a) : e; })).join(" ") : n.join(" / "); }, typeLabel = e => "15" === (null == e ? void 0 : e.type) ? "\u9605\u8bfb\u7406\u89e3" : typeConvert((null == e ? void 0 : e.type) ?? "", false) || "\u672a\u77e5", formatOptionsForExport = e => e ? Array.isArray(e) && e.length > 0 && "string" == typeof e[0] ? function(e) { return Array.isArray(e) ? e.map(((e, t) => String.fromCharCode(65 + t) + "." + String(e))).join("
    ") : ""; }(e) : Array.isArray(e) && e.length > 0 && "object" == typeof e[0] ? e.map(((e, t) => { let n = `

    ${t + 1}. ${e.question || ""}

    `; return e.options && Array.isArray(e.options) && e.options.forEach(((e, t) => { n += `

    ${String.fromCharCode(65 + t)}. ${e}

    `; })), e.answer && Array.isArray(e.answer) && (n += `

    \u7b54\u6848: ${e.answer.join(", ")}

    `), n; })).join("
    ") : Array.isArray(e) ? e.join("
    ") : String(e) : "", exportQuestionsAsDoc = e => { const t = (() => { let e; try { e = Ve.script.updateURL.match(/scripts\/(\d+)/)[1]; } catch (t) { e = "492563"; } return `https://greasyfork.org/zh-CN/scripts/${e}`; })(), n = e.map(((e, n) => { return `\n

    \u7231\u95ee\u7b54\u52a9\u624b

    \n

    ${n + 1}\u3001[${typeConvert(e.type, false)}]${e.question}

    \n

    ${formatOptionsForExport(e.options)}

    \n

    \u7b54\u6848\uff1a${a = e.answer, a ? Array.isArray(a) && a.length > 0 && Array.isArray(a[0]) ? a.map(((e, t) => `${t + 1}. ${Array.isArray(e) ? e.join(", ") : String(e)}`)).join("
    ") : Array.isArray(a) ? a.join("
    ") : String(a) : ""}

    \n `; var a; })).join("
    "), a = new Blob([ ` \u7231\u95ee\u7b54\u52a9\u624b\u7b54\u6848\u5bfc\u51fa ${n} ` ], { type: "text/html" }), i = document.createElement("a"); i.href = URL.createObjectURL(a), i.download = "\u7231\u95ee\u7b54\u52a9\u624b.html", i.click(); }; let gi = null; const getFuseWorker = () => gi || (gi = function(e) { const t = new Blob([ `(${e.toString()})()` ], { type: "application/javascript" }), n = URL.createObjectURL(t); return new Worker(n); }((() => { self.importScripts("https://cdn.bootcdn.net/ajax/libs/fuse.js/7.1.0/fuse.min.js"), self.onmessage = function(e) { const {data: t, options: n} = e.data, a = new Fuse(t, n).search(e.data.keyword).map((e => e.item)); a.forEach((t => { t.question1 = t.question, e.data.keyword.split("").forEach((e => { /[\u4e00-\u9fa5a-zA-Z0-9]/.test(e) && (t.question1 = t.question1.replace(new RegExp(e, "g"), `${e}`)); })); })), self.postMessage(a); }; })), gi), vi = { class: "lib-detail" }, yi = { class: "lib-detail-head" }, bi = { class: "aah-tag" }, wi = vue.createElementVNode("span", { class: "lib-detail-spacer" }, null, -1), xi = [ "innerHTML" ], ki = [ "innerHTML" ], qi = { class: "ask-option-key" }, _i = [ "innerHTML" ], Ai = { key: 1, class: "aah-alert aah-alert-info" }, Ti = { class: "ask-option-key" }, Ci = [ "innerHTML" ], Si = { class: "lib-detail-answer" }, Ii = vue.createElementVNode("h3", { class: "aah-section-title" }, "\u7b54\u6848", -1), Ei = { key: 0, class: "lib-detail-answer-list" }, Ui = [ "innerHTML" ], Pi = { key: 2, class: "ask-source-empty" }, Hi = vue.defineComponent({ __name: "LibraryDetail", props: { item: {}, deletable: { type: Boolean } }, emits: [ "edit", "remove" ], setup(e) { const optionKey = e => String.fromCharCode(65 + e); return (e, t) => (vue.openBlock(), vue.createElementBlock("div", vi, [ vue.createElementVNode("header", yi, [ vue.createElementVNode("span", bi, vue.toDisplayString(vue.unref(typeLabel)(e.item)), 1), wi, vue.createElementVNode("button", { type: "button", class: "aah-btn aah-btn-small", onClick: t[0] || (t[0] = t => e.$emit("edit")) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:pencil-outline" }), vue.createTextVNode("\u7f16\u8f91 ") ]), e.deletable ? (vue.openBlock(), vue.createElementBlock("button", { key: 0, type: "button", class: "aah-btn aah-btn-small aah-btn-danger", onClick: t[1] || (t[1] = t => e.$emit("remove")) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:trash-can-outline" }), vue.createTextVNode("\u5220\u9664 ") ])) : vue.createCommentVNode("", true) ]), vue.createElementVNode("div", { class: "lib-detail-stem", innerHTML: vue.unref(withNoReferrer)(e.item.question1 || e.item.question) }, null, 8, xi), "15" === e.item.type && Array.isArray(e.item.options) && "object" == typeof e.item.options[0] ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(e.item.options, ((e, t) => (vue.openBlock(), vue.createElementBlock("div", { key: t, class: "lib-detail-sub" }, [ vue.createElementVNode("div", { class: "lib-detail-sub-title", innerHTML: vue.unref(withNoReferrer)(`${t + 1}. ${e.question ?? ""}`) }, null, 8, ki), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(e.options || [], ((t, r) => (vue.openBlock(), vue.createElementBlock("div", { key: r, class: vue.normalizeClass([ "ask-option", { "is-hit": vue.unref(isCorrectOption)(e, r, t) } ]) }, [ vue.createElementVNode("span", qi, vue.toDisplayString(optionKey(r)), 1), vue.createElementVNode("span", { class: "ask-option-text", innerHTML: vue.unref(withNoReferrer)(t) }, null, 8, _i) ], 2)))), 128)) ])))), 128)) : Array.isArray(e.item.options) && "object" == typeof e.item.options[0] ? (vue.openBlock(), vue.createElementBlock("div", Ai, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:information-outline" }), vue.createTextVNode("\u590d\u5408\u9898\u578b\uff0c\u70b9\u300c\u7f16\u8f91\u300d\u67e5\u770b\u5b8c\u6574\u5185\u5bb9 ") ])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 2 }, vue.renderList(vue.unref(visibleOptions)(e.item), ((t, r) => (vue.openBlock(), vue.createElementBlock("div", { key: r, class: vue.normalizeClass([ "ask-option", { "is-hit": vue.unref(isCorrectOption)(e.item, r, t) } ]) }, [ vue.createElementVNode("span", Ti, vue.toDisplayString(optionKey(r)), 1), vue.createElementVNode("span", { class: "ask-option-text", innerHTML: vue.unref(withNoReferrer)(t) }, null, 8, Ci), vue.unref(isCorrectOption)(e.item, r, t) ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), { key: 0, icon: "mdi:check", class: "ask-option-check" })) : vue.createCommentVNode("", true) ], 2)))), 128)), vue.createElementVNode("section", Si, [ Ii, Array.isArray(e.item.answer) && e.item.answer.length ? (vue.openBlock(), vue.createElementBlock("div", Ei, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(e.item.answer, ((e, t) => (vue.openBlock(), vue.createElementBlock("span", { key: t, class: "lib-answer-chip" }, vue.toDisplayString(Array.isArray(e) ? e.join(", ") : e), 1)))), 128)) ])) : e.item.answer && !Array.isArray(e.item.answer) ? (vue.openBlock(), vue.createElementBlock("div", { key: 1, innerHTML: vue.unref(withNoReferrer)(String(e.item.answer)) }, null, 8, Ui)) : (vue.openBlock(), vue.createElementBlock("p", Pi, "\u6682\u65e0\u7b54\u6848")) ]) ])); } }), $i = { class: "modal-panel" }, Li = { class: "modal-header" }, Mi = vue.createElementVNode("h3", null, "\u7f16\u8f91\u9898\u76ee", -1), ji = { class: "modal-body" }, Oi = { class: "form-row" }, zi = vue.createElementVNode("label", null, "\u9898\u578b", -1), Fi = [ "value" ], Di = { class: "form-row" }, Ni = vue.createElementVNode("label", null, "\u9898\u5e72", -1), Ri = { key: 0, class: "form-row" }, Bi = vue.createElementVNode("label", null, [ vue.createTextVNode("\u9009\u9879 "), vue.createElementVNode("small", null, "\u70b9\u5b57\u6bcd\u6807\u8bb0\u6b63\u786e\u7b54\u6848") ], -1), Gi = { class: "option-list" }, Ki = [ "onClick" ], Vi = [ "onUpdate:modelValue" ], Wi = [ "onClick" ], Qi = { key: 1, class: "form-row" }, Ji = vue.createElementVNode("label", null, "\u7b54\u6848", -1), Yi = { class: "option-list" }, Xi = [ "onUpdate:modelValue" ], Zi = [ "onClick" ], es = vue.defineComponent({ __name: "QuestionEdit", props: { ques: {}, visible: { type: Boolean } }, emits: [ "handleClose" ], setup(e, {emit: t}) { const l = e, c = vue.ref(l.visible); vue.watch((() => l.visible), (e => { c.value = e; })); const f = t, closeDialog = () => { c.value = false, f("handleClose"); }, handleCancel = () => { closeDialog(); }, handleSave = () => { Answer.cacheAnswer(l.ques), Cache.matchRemove(l.ques.key), msg("\u9898\u76ee\u4fee\u6539\u6210\u529f", "success"), closeDialog(); }, handleDelete = e => { l.ques.options.splice(e, 1), l.ques.answer.includes(l.ques.options[e]) && (l.ques.answer = l.ques.answer.filter((t => t !== l.ques.options[e]))); }, handleAdd = () => { l.ques.options.push(""); }; return (e, t) => c.value ? (vue.openBlock(), vue.createElementBlock("div", { key: 0, class: "modal-mask", onClick: vue.withModifiers(handleCancel, [ "self" ]) }, [ vue.createElementVNode("div", $i, [ vue.createElementVNode("div", Li, [ Mi, vue.createElementVNode("button", { class: "aah-btn aah-btn-plain aah-btn-icon", type: "button", "aria-label": "\u5173\u95ed", onClick: handleCancel }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:close" }) ]) ]), vue.createElementVNode("div", ji, [ vue.createElementVNode("div", Oi, [ zi, vue.withDirectives(vue.createElementVNode("select", { "onUpdate:modelValue": t[0] || (t[0] = t => e.ques.type = t), class: "base-select" }, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(Ge), ((e, t) => (vue.openBlock(), vue.createElementBlock("option", { key: e, value: e }, vue.toDisplayString(t), 9, Fi)))), 128)) ], 512), [ [ vue.vModelSelect, e.ques.type ] ]) ]), vue.createElementVNode("div", Di, [ Ni, vue.withDirectives(vue.createElementVNode("textarea", { "onUpdate:modelValue": t[1] || (t[1] = t => e.ques.question = t), class: "base-input", rows: "5" }, null, 512), [ [ vue.vModelText, e.ques.question ] ]) ]), e.ques.options && Array.isArray(e.ques.options) && e.ques.options.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", Ri, [ Bi, vue.createElementVNode("div", Gi, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(e.ques.options, ((t, r) => (vue.openBlock(), vue.createElementBlock("div", { key: r, class: "option-row" }, [ vue.createElementVNode("button", { type: "button", class: vue.normalizeClass([ "option-selector", { active: e.ques.answer.includes(t) } ]), onClick: e => (e => { l.ques.answer = l.ques.answer.includes(e) ? l.ques.answer.filter((t => t !== e)) : [ ...l.ques.answer, e ], l.ques.answer.sort(((e, t) => l.ques.options.indexOf(e) - l.ques.options.indexOf(t))); })(t) }, vue.toDisplayString(String.fromCharCode(65 + r)), 11, Ki), vue.withDirectives(vue.createElementVNode("input", { "onUpdate:modelValue": t => e.ques.options[r] = t, class: "base-input flex-grow" }, null, 8, Vi), [ [ vue.vModelText, e.ques.options[r] ] ]), vue.createElementVNode("button", { class: "aah-btn aah-btn-small", type: "button", onClick: e => 0 !== r ? handleDelete(r) : handleAdd() }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: 0 !== r ? "mdi:minus" : "mdi:plus" }, null, 8, [ "icon" ]) ], 8, Wi) ])))), 128)) ]) ])) : Array.isArray(e.ques.answer) && 0 === e.ques.options.length ? (vue.openBlock(), vue.createElementBlock("div", Qi, [ Ji, vue.createElementVNode("div", Yi, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(e.ques.answer, ((t, s) => (vue.openBlock(), vue.createElementBlock("div", { key: s, class: "option-row" }, [ vue.withDirectives(vue.createElementVNode("input", { "onUpdate:modelValue": t => e.ques.answer[s] = t, class: "base-input flex-grow" }, null, 8, Xi), [ [ vue.vModelText, e.ques.answer[s] ] ]), vue.createElementVNode("button", { class: "aah-btn aah-btn-small", type: "button", onClick: e => 0 !== s ? handleDelete(s) : handleAdd() }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: 0 !== s ? "mdi:minus" : "mdi:plus" }, null, 8, [ "icon" ]) ], 8, Zi) ])))), 128)) ]) ])) : vue.createCommentVNode("", true) ]), vue.createElementVNode("div", { class: "modal-footer" }, [ vue.createElementVNode("button", { class: "aah-btn", type: "button", onClick: handleCancel }, "\u53d6\u6d88"), vue.createElementVNode("button", { class: "aah-btn aah-btn-primary", type: "button", onClick: handleSave }, "\u4fdd\u5b58") ]) ]) ])) : vue.createCommentVNode("", true); } }), ts = { class: "modal-panel modal-panel-large" }, ns = { class: "modal-header" }, as = vue.createElementVNode("h3", null, "\u7f16\u8f91\u9605\u8bfb\u7406\u89e3\u9898", -1), is = { class: "modal-body" }, ss = { class: "reading-form-section" }, rs = { class: "reading-section-header" }, os = vue.createElementVNode("h4", null, "\u9605\u8bfb\u6750\u6599", -1), ls = { class: "form-row" }, cs = vue.createElementVNode("label", null, "\u9898\u5e72\u5185\u5bb9", -1), us = { class: "reading-form-section" }, ps = { class: "reading-section-header" }, ds = vue.createElementVNode("h4", null, "\u5b50\u9898\u76ee\u5217\u8868", -1), ms = { class: "reading-sub-questions-editor" }, hs = { class: "reading-sub-question-header" }, fs = { class: "reading-sub-question-number" }, gs = [ "onUpdate:modelValue" ], vs = [ "value" ], ys = [ "onClick", "disabled" ], bs = { class: "form-row" }, ws = vue.createElementVNode("label", null, "\u9898\u76ee\u5185\u5bb9", -1), xs = [ "onUpdate:modelValue", "placeholder" ], ks = { key: 0, class: "form-row" }, qs = vue.createElementVNode("label", null, "\u9009\u9879\u8bbe\u7f6e", -1), _s = { class: "option-list" }, As = [ "onClick" ], Ts = [ "onUpdate:modelValue", "placeholder" ], Cs = [ "onClick" ], Ss = { key: 1, class: "form-row" }, Is = vue.createElementVNode("label", null, "\u53c2\u8003\u7b54\u6848", -1), Es = { class: "reading-answer-list" }, Us = [ "onUpdate:modelValue", "placeholder" ], Ps = [ "onClick" ], Hs = vue.defineComponent({ __name: "ReadingComprehensionEdit", props: { ques: {}, visible: { type: Boolean } }, emits: [ "handleClose" ], setup(e, {emit: t}) { const l = e, c = t, g = vue.ref(l.visible), k = vue.ref(JSON.parse(JSON.stringify(l.ques || {}))); vue.watch((() => l.visible), (e => { g.value = e, e && l.ques && (k.value = JSON.parse(JSON.stringify(l.ques)), k.value.options || (k.value.options = []), k.value.options.forEach((e => { e.answer || (e.answer = []), e.options || (e.options = []), e.type || (e.type = "0"); }))); })); const closeDialog = () => { g.value = false, c("handleClose"); }, handleCancel = () => { closeDialog(); }, handleSave = () => { if (k.value.question.trim()) if (0 !== k.value.options.length) { for (let e = 0; e < k.value.options.length; e++) { const t = k.value.options[e]; if (!t.question.trim()) return void msg(`\u7b2c ${e + 1} \u9898\u7684\u9898\u76ee\u5185\u5bb9\u4e0d\u80fd\u4e3a\u7a7a`, "error"); if ([ "0", "1" ].includes(t.type) && t.options.length < 2) return void msg(`\u7b2c ${e + 1} \u9898\u81f3\u5c11\u9700\u89812\u4e2a\u9009\u9879`, "error"); if (0 === t.answer.length) return void msg(`\u7b2c ${e + 1} \u9898\u5fc5\u987b\u8bbe\u7f6e\u7b54\u6848`, "error"); } Object.assign(l.ques, k.value), Answer.cacheAnswer(l.ques), Cache.matchRemove(l.ques.key), msg("\u9605\u8bfb\u7406\u89e3\u9898\u76ee\u4fee\u6539\u6210\u529f", "success"), closeDialog(); } else msg("\u81f3\u5c11\u9700\u8981\u6dfb\u52a0\u4e00\u4e2a\u5b50\u9898\u76ee", "error"); else msg("\u8bf7\u586b\u5199\u9605\u8bfb\u6750\u6599\u5185\u5bb9", "error"); }, addSubQuestion = () => { k.value.options.push({ type: "0", question: "", options: [ "", "" ], answer: [] }); }; return (e, t) => g.value ? (vue.openBlock(), vue.createElementBlock("div", { key: 0, class: "modal-mask", onClick: vue.withModifiers(handleCancel, [ "self" ]) }, [ vue.createElementVNode("div", ts, [ vue.createElementVNode("div", ns, [ as, vue.createElementVNode("button", { class: "aah-btn aah-btn-plain aah-btn-icon", type: "button", "aria-label": "\u5173\u95ed", onClick: handleCancel }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:close" }) ]) ]), vue.createElementVNode("div", is, [ vue.createElementVNode("div", ss, [ vue.createElementVNode("div", rs, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:book-open-variant", class: "reading-section-icon" }), os ]), vue.createElementVNode("div", ls, [ cs, vue.withDirectives(vue.createElementVNode("textarea", { "onUpdate:modelValue": t[0] || (t[0] = e => k.value.question = e), class: "base-input", rows: "8", placeholder: "\u8bf7\u8f93\u5165\u9605\u8bfb\u7406\u89e3\u7684\u4e3b\u8981\u6750\u6599\u5185\u5bb9..." }, "\n ", 512), [ [ vue.vModelText, k.value.question ] ]) ]) ]), vue.createElementVNode("div", us, [ vue.createElementVNode("div", ps, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:help-circle", class: "reading-section-icon" }), ds, vue.createElementVNode("button", { class: "aah-btn aah-btn-primary aah-btn-small", type: "button", onClick: addSubQuestion }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:plus" }), vue.createTextVNode(" \u6dfb\u52a0\u9898\u76ee ") ]) ]), vue.createElementVNode("div", ms, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(k.value.options, ((e, t) => (vue.openBlock(), vue.createElementBlock("div", { key: t, class: "reading-sub-question-editor" }, [ vue.createElementVNode("div", hs, [ vue.createElementVNode("span", fs, vue.toDisplayString(t + 1), 1), vue.withDirectives(vue.createElementVNode("select", { "onUpdate:modelValue": t => e.type = t, class: "base-select reading-base-select-small" }, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(Ge), ((e, t) => (vue.openBlock(), vue.createElementBlock("option", { key: e, value: e }, vue.toDisplayString(t), 9, vs)))), 128)) ], 8, gs), [ [ vue.vModelSelect, e.type ] ]), vue.createElementVNode("button", { class: "aah-btn aah-btn-danger aah-btn-small", type: "button", onClick: e => (e => { k.value.options.length > 1 && k.value.options.splice(e, 1); })(t), disabled: k.value.options.length <= 1 }, " \u5220\u9664 ", 8, ys) ]), vue.createElementVNode("div", bs, [ ws, vue.withDirectives(vue.createElementVNode("textarea", { "onUpdate:modelValue": t => e.question = t, class: "base-input", rows: "3", placeholder: `\u8bf7\u8f93\u5165\u7b2c ${t + 1} \u9898\u7684\u9898\u76ee\u5185\u5bb9...` }, "\n ", 8, xs), [ [ vue.vModelText, e.question ] ]) ]), [ "0", "1" ].includes(e.type) ? (vue.openBlock(), vue.createElementBlock("div", ks, [ qs, vue.createElementVNode("div", _s, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(e.options, ((r, l) => (vue.openBlock(), vue.createElementBlock("div", { key: l, class: "option-row" }, [ vue.createElementVNode("button", { type: "button", class: vue.normalizeClass([ "option-selector", { active: e.answer.includes(r) } ]), onClick: e => ((e, t) => { const n = k.value.options[e], a = n.answer.indexOf(t); a > -1 ? n.answer.splice(a, 1) : "0" === n.type ? n.answer = [ t ] : (n.answer.push(t), n.answer.sort(((e, t) => n.options.indexOf(e) - n.options.indexOf(t)))); })(t, r) }, vue.toDisplayString(String.fromCharCode(65 + l)), 11, As), vue.withDirectives(vue.createElementVNode("input", { "onUpdate:modelValue": t => e.options[l] = t, class: "base-input flex-grow", placeholder: `\u9009\u9879 ${String.fromCharCode(65 + l)}` }, null, 8, Ts), [ [ vue.vModelText, e.options[l] ] ]), vue.createElementVNode("button", { class: "aah-btn aah-btn-small", type: "button", onClick: e => { return 0 === l ? (n = t, void k.value.options[n].options.push("")) : ((e, t) => { const n = k.value.options[e], a = n.options[t]; n.options.splice(t, 1); const i = n.answer.indexOf(a); i > -1 && n.answer.splice(i, 1); })(t, l); var n; } }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: 0 === l ? "mdi:plus" : "mdi:minus" }, null, 8, [ "icon" ]) ], 8, Cs) ])))), 128)) ]) ])) : (vue.openBlock(), vue.createElementBlock("div", Ss, [ Is, vue.createElementVNode("div", Es, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(e.answer, ((s, r) => (vue.openBlock(), vue.createElementBlock("div", { key: r, class: "reading-answer-row" }, [ vue.withDirectives(vue.createElementVNode("input", { "onUpdate:modelValue": t => e.answer[r] = t, class: "base-input flex-grow", placeholder: `\u7b54\u6848 ${r + 1}` }, null, 8, Us), [ [ vue.vModelText, e.answer[r] ] ]), vue.createElementVNode("button", { class: "aah-btn aah-btn-small", type: "button", onClick: e => { return 0 === r ? (n = t, void k.value.options[n].answer.push("")) : ((e, t) => { k.value.options[e].answer.length > 1 && k.value.options[e].answer.splice(t, 1); })(t, r); var n; } }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: 0 === r ? "mdi:plus" : "mdi:minus" }, null, 8, [ "icon" ]) ], 8, Ps) ])))), 128)) ]) ])) ])))), 128)) ]) ]) ]), vue.createElementVNode("div", { class: "modal-footer" }, [ vue.createElementVNode("button", { class: "aah-btn", type: "button", onClick: handleCancel }, "\u53d6\u6d88"), vue.createElementVNode("button", { class: "aah-btn aah-btn-primary", type: "button", onClick: handleSave }, "\u4fdd\u5b58\u4fee\u6539") ]) ]) ])) : vue.createCommentVNode("", true); } }), $s = { 0: "\u5355\u9009\u9898", 1: "\u591a\u9009\u9898", 2: "\u586b\u7a7a\u9898", 3: "\u5224\u65ad\u9898", 4: "\u7b80\u7b54\u9898", 8: "\u5176\u5b83" }, Ls = /^\s*(?:(\d+)[.\u3001\uff0e)]|[\uff08(](\d+)[\uff09)])\s*(.*)$/, Ms = /^(?:[\[\u3010]\s*)?(?:\u53c2\u8003\u7b54\u6848|\u6807\u51c6\u7b54\u6848|\u6b63\u786e\u7b54\u6848|\u7b54\u6848)(?:\s*[\]\u3011])?\s*[\uff1a:]\s*(.*)$/, js = /^\s*([\[\u3010]\s*([^\]\u3011]+?)\s*[\]\u3011])\s*/, Os = /^\s*(\u5355\u9009\u9898|\u5355\u9879\u9009\u62e9\u9898|\u591a\u9009\u9898|\u591a\u9879\u9009\u62e9\u9898|\u5224\u65ad\u9898|\u586b\u7a7a\u9898|\u7b80\u7b54\u9898|\u7b80\u7b54|\u95ee\u7b54\u9898|\u95ee\u7b54|\u5176\u5b83|\u5176\u4ed6)\s*[\uff1a:]\s*/, zs = /([A-Za-z])\s*[.\u3001\uff0e)\uff09]\s*/g, splitQuestionBlocks = e => { var t; const n = []; let a = null; const pushCurrent = () => { if (!a) return; const e = a.lines.map((e => e.trim())).filter(Boolean); e.length > 0 && n.push({ titleNo: a.titleNo, lines: e }), a = null; }; for (const i of e.replace(/\r\n?/g, "\n").split("\n")) { const e = i.trim(); if (!e) { (null == a ? void 0 : a.lines.some((e => Ms.test(e)))) && pushCurrent(); continue; } const n = e.match(Ls); n ? (pushCurrent(), a = { titleNo: n[1] || n[2] || "", lines: [ (null == (t = n[3]) ? void 0 : t.trim()) || "" ] }) : (a ? a.lines.some((e => Ms.test(e))) && (pushCurrent(), a = { titleNo: "", lines: [] }) : a = { titleNo: "", lines: [] }, a.lines.push(e)); } return pushCurrent(), n; }, parseQuestionBlock = (e, t) => { const n = [], a = [], i = []; let s = "", r = { type: null, label: "" }; e.lines.forEach(((e, t) => { var n; const o = e.match(Ms); if (o) return void (s = (null == (n = o[1]) ? void 0 : n.trim()) || ""); let l = e; if (0 === t) { const e = extractTypeLabel(l); r = e.typeInfo, l = e.content; } !r.type || isChoiceType$1(r.type) ? appendQuestionAndOptions(l, i, a) : i.push(l); })); const o = normalizeSpaces(i.join(" ")), l = r.type || inferQuestionType(o, a, s), c = normalizeAnswer(l, s, a, n); return validateParsedQuestion(o, l, a, c, n), s || n.push("\u7f3a\u5c11\u7b54\u6848"), { id: `question-import-${t + 1}`, sourceIndex: t, titleNo: e.titleNo, type: l, typeLabel: r.label || $s[l], question: o, options: a, answer: c, rawAnswer: s, errors: n }; }, validateParsedQuestion = (e, t, n, a, i) => { if (e || i.push("\u7f3a\u5c11\u9898\u5e72"), ("0" === t || "1" === t) && n.length < 2 && i.push("\u9009\u62e9\u9898\u9009\u9879\u5c11\u4e8e 2 \u4e2a"), "8" === t && i.push("\u6682\u4e0d\u652f\u6301\u8be5\u9898\u578b"), "2" === t) { const t = countBlankPlaceholders(e); t > 0 && a.length !== t && i.push("\u586b\u7a7a\u7b54\u6848\u6570\u91cf\u4e0e\u7a7a\u6570\u91cf\u4e0d\u4e00\u81f4"); } }, extractTypeLabel = e => { let t = e.trim(); const n = []; for (;t; ) { const e = t.match(js); if (e) { const a = (e[2] || "").trim(), i = typeFromLabel(a); if (t = t.slice(e[0].length).trim(), i) return { content: joinQuestionParts(n, t), typeInfo: { type: i, label: a } }; n.push((e[1] || "").trim()); continue; } const a = t.match(Os); if (a) { const e = (a[1] || "").trim(), i = typeFromLabel(e); if (t = t.slice(a[0].length).trim(), i) return { content: joinQuestionParts(n, t), typeInfo: { type: i, label: e } }; } break; } return { content: e.trim(), typeInfo: { type: null, label: "" } }; }, joinQuestionParts = (e, t) => [ ...e, t ].filter(Boolean).join(" ").trim(), typeFromLabel = e => /\u591a\u9009|\u591a\u9879/.test(e) ? "1" : /\u5355\u9009|\u5355\u9879/.test(e) ? "0" : /\u586b\u7a7a/.test(e) ? "2" : /\u5224\u65ad/.test(e) ? "3" : /\u7b80\u7b54|\u95ee\u7b54/.test(e) ? "4" : /\u5176\u5b83|\u5176\u4ed6/.test(e) ? "8" : null, isChoiceType$1 = e => "0" === e || "1" === e, appendQuestionAndOptions = (e, t, n) => { const a = parseOptionsFromLine(e); if (0 === a.length) return void t.push(e); const i = a[0], s = e.slice(0, i.start).trim(); s && t.push(s), a.forEach((e => { e.value && n.push({ label: e.label, value: e.value }); })); }, parseOptionsFromLine = e => { const t = Array.from(e.matchAll(zs)).filter((t => { const n = t.index || 0; return 0 === n || !/[A-Za-z0-9]/.test(e[n - 1] || ""); })); return 0 === t.length ? [] : t.map(((n, a) => { const i = n.index || 0, s = (n.index || 0) + n[0].length, r = a + 1 < t.length && t[a + 1].index || e.length; return { label: (n[1] || "").toUpperCase(), value: e.slice(s, r).trim(), start: i }; })); }, inferQuestionType = (e, t, n) => t.length > 0 ? countChoiceAnswers(n, t) > 1 ? "1" : "0" : normalizeJudgeAnswer(n) ? "3" : hasBlankPlaceholder(e) || n.includes("|") ? "2" : "4", normalizeAnswer = (e, t, n, a) => { const i = t.trim(); if (!i) return []; if ("3" === e) { const e = normalizeJudgeAnswer(i); return e ? [ e ] : (a.push("\u5224\u65ad\u9898\u7b54\u6848\u4e0d\u6b63\u786e"), []); } if ("0" === e || "1" === e) { const t = normalizeChoiceAnswer(i, n, a); return "0" === e && t.length > 1 && a.push("\u5355\u9009\u9898\u7b54\u6848\u53ea\u80fd\u6709\u4e00\u4e2a"), t; } return "2" === e ? splitAnswerText(i, /\|/) : [ i ]; }, normalizeChoiceAnswer = (e, t, n) => { const a = matchChoiceAnswerTexts(e, t); if (a.length > 0) return a; const i = parseChoiceAnswerLabels(e), s = []; return i.length > 0 ? (i.forEach((e => { const a = t.find((t => t.label === e)); a ? s.push(a.value) : n.push(`\u7b54\u6848\u4e0d\u5728\u9009\u9879\u4e2d\uff1a${e}`); })), s) : (splitAnswerText(e, /[|,\uff0c\u3001;\uff1b]/).forEach((e => { const a = t.find((t => t.value === e)); a ? s.push(a.value) : n.push(`\u7b54\u6848\u4e0d\u5728\u9009\u9879\u4e2d\uff1a${e}`); })), s); }, countChoiceAnswers = (e, t) => { const n = matchChoiceAnswerTexts(e, t); if (n.length > 0) return n.length; const a = parseChoiceAnswerLabels(e); return a.length > 0 ? a.length : splitAnswerText(e, /[|,\uff0c\u3001;\uff1b]/).filter((e => t.some((t => t.value === e)))).length; }, matchChoiceAnswerTexts = (e, t) => { const n = e.trim(), a = t.find((e => e.value === n)); if (a) return [ a.value ]; const i = splitAnswerText(e, /[|,\uff0c\u3001;\uff1b]/); if (0 === i.length) return []; const s = []; for (const r of i) { const e = t.find((e => e.value === r)); if (!e) return []; s.push(e.value); } return s; }, parseChoiceAnswerLabels = e => { const t = e.trim().toUpperCase(); if (!t) return []; if (/^[A-Z]+$/.test(t)) return Array.from(t); const n = t.split(/[\s|,\uff0c\u3001;\uff1b]+/).map((e => e.trim())).filter(Boolean); return n.every((e => /^[A-Z]$/.test(e))) ? n : []; }, hasBlankPlaceholder = e => countBlankPlaceholders(e) > 0, countBlankPlaceholders = e => Array.from(e.matchAll(/\uff08\s*\uff09|\(\s*\)|_{2,}|-{2,}|\[\s*\]/g)).length, normalizeSpaces = e => e.replace(/\s+/g, " ").trim(), isChoiceType = e => "0" === e || "1" === e, normalizeImportText = e => e.replace(/<[^>]*>/g, "").replace(/ /gi, " ").replace(/\s+/g, " ").trim(), Fs = "ques1_", Ds = "AiAsk_ques1_", buildQuestionImportPlan = (e, t, n) => { const a = new Set(t.map(getHashFromCacheKey).filter(Boolean)), i = { total: e.length, valid: 0, error: 0, create: 0, overwrite: 0, skip: 0 }, s = e.map((e => { const t = (e => { if (e.errors.length > 0) return null; const t = normalizeImportText(e.question), n = isChoiceType(e.type) ? e.options.map((e => normalizeImportText(e.value))).filter(Boolean) : [], a = e.answer.map((e => normalizeImportText(e))).filter(Boolean); return t && 0 !== a.length ? { type: e.type, question: t, options: n, answer: a } : null; })(e); if (!t) return i.error += 1, { parsed: e, question: t, cacheKey: "", status: "error", errors: e.errors.length > 0 ? e.errors : [ "\u9898\u5e72\u6216\u7b54\u6848\u4e3a\u7a7a" ] }; i.valid += 1; const s = (e => { const t = Array.from(e.options); return t.sort(), md5(`${e.type}${e.question}${t.join("")}`.replace(/\s/g, "")); })(t), r = `${Fs}${s}`, o = a.has(s) ? n : "create"; return i[o] += 1, a.add(s), { parsed: e, question: t, cacheKey: r, status: o, errors: [] }; })); return { strategy: n, items: s, stats: i }; }, getHashFromCacheKey = e => e.startsWith(Ds) ? e.slice(12) : e.startsWith(Fs) ? e.slice(6) : "", Ns = { class: "question-tool" }, Rs = vue.createElementVNode("p", { class: "qt-hint" }, "\u7c98\u8d34\u9898\u76ee\u6587\u672c\uff0c\u53f3\u4fa7\u5b9e\u65f6\u9884\u89c8\u89e3\u6790\u7ed3\u679c\uff1b\u5bfc\u5165\u540e\u5199\u5165\u672c\u5730\u9898\u5e93\uff0c\u7b54\u9898\u65f6\u4f18\u5148\u5339\u914d\u3002\u9898\u5e72\u8981\u548c\u5e73\u53f0\u4e0a\u7684\u4e00\u81f4\u624d\u80fd\u5339\u914d\u4e0a\u3002", -1), Bs = { class: "qt-toolbar" }, Gs = { class: "qt-strategy", role: "radiogroup", "aria-label": "\u91cd\u590d\u9898\u5904\u7406" }, Ks = vue.createElementVNode("span", { class: "qt-strategy-label" }, "\u5df2\u5b58\u5728\u7684\u9898", -1), Vs = { class: "qt-radio" }, Ws = { class: "qt-radio" }, Qs = { class: "qt-stats num" }, Js = { class: "qt-stat-error" }, Ys = vue.createElementVNode("span", { class: "area-foot-spacer" }, null, -1), Xs = [ "disabled" ], Zs = [ "disabled" ], er = { class: "qt-grid" }, tr = { class: "qt-preview scroll", "aria-label": "\u89e3\u6790\u9884\u89c8" }, nr = { key: 0, class: "qt-empty" }, ar = { class: "qt-row-head" }, ir = { class: "qt-title-no num" }, sr = { class: "aah-tag" }, rr = { class: "qt-status" }, or = { class: "qt-question" }, lr = { key: 0, class: "qt-options" }, cr = { key: 1, class: "qt-answer" }, ur = { key: 2, class: "qt-error" }, pr = vue.defineComponent({ __name: "QuestionTool", setup(e) { const t = vue.ref(""), i = On(), l = vue.ref(false), p = vue.ref("overwrite"), h = vue.ref(Cache.match("ques1_")), g = vue.computed((() => (e => splitQuestionBlocks(e).map(((e, t) => parseQuestionBlock(e, t))))(t.value))), y = vue.computed((() => buildQuestionImportPlan(g.value, h.value, p.value))), w = vue.computed((() => y.value.items.filter((e => e.question && "skip" !== e.status)))), q = { create: "\u5c06\u65b0\u589e", overwrite: "\u5c06\u8986\u76d6", skip: "\u5c06\u8df3\u8fc7", error: "\u9519\u8bef" }, formatOptions = e => e.parsed.options.map((t => ({ label: `${t.label}. ${t.value}`, isTrue: e.parsed.answer.includes(t.value) }))), repairQuestionText = async () => { var e; const n = t.value.trim(); if (n) { l.value = true; try { const a = await (async ({text: e, config: t, runScene: n = runAiScene}) => { const a = e.trim(); if (!a) return { success: !1, text: e, message: "\u8bf7\u5148\u8f93\u5165\u9700\u8981\u6574\u7406\u7684\u9898\u5e93\u6587\u672c", duration: 0 }; const i = await n("repair", t, (e => `\u8bf7\u5c06\u4e0b\u9762\u7684\u539f\u59cb\u9898\u5e93\u6587\u672c\u6574\u7406\u4e3a\u201c\u9898\u5e93\u5bfc\u5165\u683c\u5f0f\u201d\uff0c\u53ea\u8f93\u51fa\u6574\u7406\u540e\u7684\u9898\u5e93\u6587\u672c\uff0c\u4e0d\u8981\u89e3\u91ca\u3002\n\n\u9898\u5e93\u5bfc\u5165\u683c\u5f0f\u8981\u6c42\uff1a\n1. \u6bcf\u9898\u72ec\u7acb\u7f16\u53f7\uff0c\u4f8b\u5982\uff1a1. [\u5355\u9009\u9898] \u9898\u5e72\n2. \u652f\u6301\u9898\u578b\uff1a\u5355\u9009\u9898\u3001\u591a\u9009\u9898\u3001\u5224\u65ad\u9898\u3001\u586b\u7a7a\u9898\u3001\u7b80\u7b54\u9898\n3. \u9009\u62e9\u9898\u9009\u9879\u4f7f\u7528 A. B. C. D. \u683c\u5f0f\uff0c\u6bcf\u4e2a\u9009\u9879\u72ec\u5360\u4e00\u884c\n4. \u7b54\u6848\u884c\u652f\u6301\u56fa\u5b9a\u5199\u6cd5\uff1a\u7b54\u6848:A \u6216 \u7b54\u6848:A|C \u6216 \u7b54\u6848:\u6b63\u786e\n5. \u586b\u7a7a\u9898\u591a\u4e2a\u7b54\u6848\u7528 | \u5206\u9694\n6. \u65e0\u6cd5\u786e\u5b9a\u7b54\u6848\u65f6\u4fdd\u7559\u9898\u5e72\u548c\u9009\u9879\uff0c\u5e76\u5199\uff1a\u7b54\u6848:\n7. \u5224\u65ad\u9898\u4e0d\u8981\u4fdd\u7559 A/B \u9009\u9879\uff0c\u5373\u4f7f\u539f\u6587\u5305\u542b A. \u5bf9 B. \u9519\u3001A. \u9519 B. \u5bf9\u3001A. \u6b63\u786e B. \u9519\u8bef\n8. \u5224\u65ad\u9898\u7b54\u6848\u53ea\u80fd\u5199\u4e3a\uff1a\u7b54\u6848:\u6b63\u786e \u6216 \u7b54\u6848:\u9519\u8bef\n9. \u5224\u65ad\u9898\u539f\u6587\u7b54\u6848\u662f\u201c\u5bf9\u3001\u6b63\u786e\u3001\u662f\u3001\u221a\u3001T\u3001true\u201d\u65f6\u8f93\u51fa \u7b54\u6848:\u6b63\u786e\uff1b\u539f\u6587\u7b54\u6848\u662f\u201c\u9519\u3001\u9519\u8bef\u3001\u5426\u3001\xd7\u3001F\u3001false\u201d\u65f6\u8f93\u51fa \u7b54\u6848:\u9519\u8bef\n10. \u5224\u65ad\u9898\u539f\u6587\u7b54\u6848\u662f\u9009\u9879\u5b57\u6bcd\u65f6\uff0c\u5148\u6309\u539f\u6587 A/B \u9009\u9879\u6620\u5c04\u5230\u201c\u5bf9/\u9519/\u6b63\u786e/\u9519\u8bef\u201d\uff0c\u518d\u8f93\u51fa \u7b54\u6848:\u6b63\u786e \u6216 \u7b54\u6848:\u9519\u8bef\n11. \u539f\u6587\u4f7f\u7528 #9\u3001#10 \u8fd9\u7c7b\u7f16\u53f7\u65f6\uff0c\u6574\u7406\u4e3a 9.\u300110.\n12. \u9898\u5e72\u524d\u7684\u201c\u9898\u76ee:\u201d\u53ea\u4f5c\u4e3a\u5b57\u6bb5\u6807\u8bb0\uff0c\u8f93\u51fa\u65f6\u5220\u9664\n13. \u4e0d\u8981\u8f93\u51fa Markdown \u4ee3\u7801\u5757\uff0c\u4e0d\u8981\u8f93\u51fa\u8bf4\u660e\u6587\u5b57\n\n\u5224\u65ad\u9898\u6574\u7406\u793a\u4f8b\uff1a\n\u539f\u6587\uff1a\n#9\n\u5224\u65ad\u9898\n\u9519\u8bef\n\u9898\u76ee:\u7ecf\u7eb1\u6307\u7684\u662f\u7ec7\u7269\u7684\u5e03\u8fb9\u5230\u53e6\u4e00\u4e2a\u5e03\u8fb9\u7684\u7eb1\u7ebf\uff0c\u662f\u673a\u7ec7\u7269\u7684\u6a2a\u5411\u7eb1\u7ebf\uff0c\u4e5f\u4fd7\u79f0\u4e3a\u6a2a\u7eb1\u3002 A. \u5bf9 B. \u9519\n\n\u8f93\u51fa\uff1a\n9. [\u5224\u65ad\u9898] \u7ecf\u7eb1\u6307\u7684\u662f\u7ec7\u7269\u7684\u5e03\u8fb9\u5230\u53e6\u4e00\u4e2a\u5e03\u8fb9\u7684\u7eb1\u7ebf\uff0c\u662f\u673a\u7ec7\u7269\u7684\u6a2a\u5411\u7eb1\u7ebf\uff0c\u4e5f\u4fd7\u79f0\u4e3a\u6a2a\u7eb1\u3002\n\u7b54\u6848:\u9519\u8bef\n\n\u539f\u6587\uff1a\n#10\n\u5224\u65ad\u9898\n\u9519\u8bef\n\u9898\u76ee:\u7acb\u4f53\u88c1\u526a\u64cd\u4f5c\u6b65\u9aa4\uff1a\u6b3e\u5f0f\u5206\u6790\u2014\u80da\u5e03\u6574\u7406\u2014\u522b\u6837\u2014\u70b9\u5f71\u2014\u4fee\u7248\u2014\u7ec4\u88c5\u8bd5\u7a7f\u2014\u62d3\u677f\u3002 A. \u9519 B. \u5bf9\n\n\u8f93\u51fa\uff1a\n10. [\u5224\u65ad\u9898] \u7acb\u4f53\u88c1\u526a\u64cd\u4f5c\u6b65\u9aa4\uff1a\u6b3e\u5f0f\u5206\u6790\u2014\u80da\u5e03\u6574\u7406\u2014\u522b\u6837\u2014\u70b9\u5f71\u2014\u4fee\u7248\u2014\u7ec4\u88c5\u8bd5\u7a7f\u2014\u62d3\u677f\u3002\n\u7b54\u6848:\u9519\u8bef\n\n\u539f\u59cb\u9898\u5e93\u6587\u672c\uff1a\n${e.trim()}`)(a), { stream: !1 }); if (!i.success) return { success: !1, text: e, message: i.displayMessage || "AI \u6574\u7406\u9898\u5e93\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5", duration: i.duration }; const s = (e => { const t = e.trim(), n = t.match(/^```(?:\w+)?\s*([\s\S]*?)\s*```$/); return ((null == n ? void 0 : n[1]) || t).trim(); })(i.text); return s ? { success: !0, text: s, message: "", duration: i.duration } : { success: !1, text: e, message: "AI \u672a\u8fd4\u56de\u53ef\u7528\u9898\u5e93\u6587\u672c", duration: i.duration }; })({ text: n, config: null == (e = i.selectTarget("repair")) ? void 0 : e.config }); if (!a.success) return void msg(a.message || "AI \u6574\u7406\u9898\u5e93\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5", "warning"); t.value = a.text, msg(`AI \u6574\u7406\u5b8c\u6210\uff0c\u8017\u65f6 ${a.duration}ms\uff0c\u8bf7\u6838\u5bf9\u9884\u89c8\u540e\u518d\u5bfc\u5165`, "success"); } catch (a) { msg((null == a ? void 0 : a.message) || "AI \u6574\u7406\u9898\u5e93\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5", "error"); } finally { l.value = false; } } else msg("\u8bf7\u5148\u8f93\u5165\u9700\u8981\u6574\u7406\u7684\u9898\u5e93\u6587\u672c", "warning"); }, importQuestion = () => { const e = y.value, t = e.items.filter((e => e.question && "skip" !== e.status)); if (0 === t.length) return void msg("\u6682\u65e0\u53ef\u5bfc\u5165\u9898\u76ee\uff0c\u8bf7\u5148\u4fee\u6b63\u9519\u8bef\u9898\u6216\u8c03\u6574\u91cd\u590d\u9898\u7b56\u7565", "warning"); t.forEach((e => { e.question && Answer.cacheAnswer(e.question); })), h.value = Cache.match("ques1_"); const n = e.stats; msg(`\u5bfc\u5165\u5b8c\u6210\uff1a\u65b0\u589e ${n.create} \u9898\uff0c\u8986\u76d6 ${n.overwrite} \u9898\uff0c\u8df3\u8fc7 ${n.skip} \u9898\uff0c\u9519\u8bef ${n.error} \u9898`, "success"); }; return (e, i) => (vue.openBlock(), vue.createElementBlock("div", Ns, [ Rs, vue.createElementVNode("div", Bs, [ vue.createElementVNode("div", Gs, [ Ks, vue.createElementVNode("label", Vs, [ vue.withDirectives(vue.createElementVNode("input", { "onUpdate:modelValue": i[0] || (i[0] = e => p.value = e), type: "radio", value: "overwrite" }, null, 512), [ [ vue.vModelRadio, p.value ] ]), vue.createTextVNode("\u8986\u76d6") ]), vue.createElementVNode("label", Ws, [ vue.withDirectives(vue.createElementVNode("input", { "onUpdate:modelValue": i[1] || (i[1] = e => p.value = e), type: "radio", value: "skip" }, null, 512), [ [ vue.vModelRadio, p.value ] ]), vue.createTextVNode("\u8df3\u8fc7") ]) ]), vue.createElementVNode("span", Qs, [ vue.createTextVNode(" \u5171 "), vue.createElementVNode("b", null, vue.toDisplayString(y.value.stats.total), 1), vue.createTextVNode(" \xb7 \u65b0\u589e "), vue.createElementVNode("b", null, vue.toDisplayString(y.value.stats.create), 1), vue.createTextVNode(" \xb7 \u8986\u76d6 "), vue.createElementVNode("b", null, vue.toDisplayString(y.value.stats.overwrite), 1), vue.createTextVNode(" \xb7 \u8df3\u8fc7 "), vue.createElementVNode("b", null, vue.toDisplayString(y.value.stats.skip), 1), y.value.stats.error ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ vue.createTextVNode(" \xb7 "), vue.createElementVNode("b", Js, "\u9519\u8bef " + vue.toDisplayString(y.value.stats.error), 1) ], 64)) : vue.createCommentVNode("", true) ]), Ys, vue.createElementVNode("button", { class: "aah-btn", type: "button", disabled: l.value || !t.value.trim(), onClick: repairQuestionText }, vue.toDisplayString(l.value ? "AI \u6574\u7406\u4e2d\u2026" : "AI \u6574\u7406\u683c\u5f0f"), 9, Xs), vue.createElementVNode("button", { class: "aah-btn aah-btn-primary", type: "button", disabled: 0 === w.value.length, onClick: importQuestion }, vue.toDisplayString(w.value.length ? `\u5bfc\u5165 ${w.value.length} \u9898` : "\u5bfc\u5165"), 9, Zs) ]), vue.createElementVNode("div", er, [ vue.withDirectives(vue.createElementVNode("textarea", { "onUpdate:modelValue": i[2] || (i[2] = e => t.value = e), class: "qt-textarea", placeholder: "\u652f\u6301\u9898\u578b\uff1a\u5355\u9009\u3001\u591a\u9009\u3001\u5224\u65ad\u3001\u586b\u7a7a\u3001\u7b80\u7b54\n\n\u57fa\u7840\u89c4\u5219\uff1a\n1. \u63a8\u8350\u4f7f\u7528\u9898\u53f7\uff0c\u5982 1. 1\u30011\uff0e\uff081\uff09\u6216 (1)\n2. \u65e0\u9898\u53f7\u65f6\uff0c\u7cfb\u7edf\u4f1a\u6309\u7a7a\u884c\u548c\u7b54\u6848\u884c\u63a8\u65ad\u9898\u5757\n3. \u7b54\u6848\u884c\u652f\u6301\uff1a\u7b54\u6848\uff1a\u53c2\u8003\u7b54\u6848\uff1a\u6b63\u786e\u7b54\u6848\uff1a\u6807\u51c6\u7b54\u6848\uff1a\n4. \u9009\u9879\u652f\u6301\uff1aA. A\u3001A\uff0eA) A\uff09\n5. \u652f\u6301\u884c\u5185\u9009\u9879\uff1aA.\u7532 B.\u4e59 C.\u4e19 D.\u4e01\n6. \u586b\u7a7a\u9898\u591a\u4e2a\u7b54\u6848\u7528 | \u5206\u9694\n7. \u5224\u65ad\u9898\u652f\u6301\uff1a\u6b63\u786e\u3001\u9519\u8bef\u3001\u5bf9\u3001\u9519\u3001\u662f\u3001\u5426\u3001\u221a\u3001\xd7\u3001T\u3001F\n\n\u793a\u4f8b\uff1a\n1. [\u5355\u9009\u9898] \u9a7e\u9a76\u4eba\u6709\u4e0b\u5217\u54ea\u79cd\u8fdd\u6cd5\u884c\u4e3a\u4e00\u6b21\u8bb06\u5206\uff1f\nA\u3001\u4f7f\u7528\u5176\u4ed6\u8f66\u8f86\u884c\u9a76\u8bc1\nB\u3001\u996e\u9152\u540e\u9a7e\u9a76\u673a\u52a8\u8f66\nC\u3001\u8f66\u901f\u8d85\u8fc7\u89c4\u5b9a\u65f6\u901f50%\u4ee5\u4e0a\nD\u3001\u8fdd\u6cd5\u5360\u7528\u5e94\u6025\u8f66\u9053\u884c\u9a76\n\u7b54\u6848:D\n\n2\u3001\u3010\u591a\u9009\u9898\u3011 \u4e0b\u5217\u5c5e\u4e8e\u6625\u5b63\u7684\u6708\u4efd\u662f\uff1f\nA.\u4e00\u6708 B.\u4e09\u6708 C.\u56db\u6708 D.\u5341\u4e8c\u6708\n\u53c2\u8003\u7b54\u6848\uff1aBC\n\n3\uff0e\u56fd\u9645\u8c61\u68cb\u8d77\u6e90\u4e8e\u82f1\u56fd\u5417\uff1f\n\u7b54\u6848: \u5bf9\n\n\uff084\uff09\u6211\u56fd\u53e4\u5178\u56db\u5927\u540d\u8457\u662f\uff08\uff09\uff08\uff09\uff08\uff09\uff08\uff09\n\u7b54\u6848: \u7ea2\u697c\u68a6|\u6c34\u6d52\u4f20|\u4e09\u56fd\u6f14\u4e49|\u897f\u6e38\u8bb0\n\n(5) \u5982\u4f55\u4fdd\u6301\u8eab\u4f53\u5065\u5eb7\uff1f\n\u6807\u51c6\u7b54\u6848: \u89c4\u5f8b\u996e\u98df\u3001\u575a\u6301\u953b\u70bc\uff0c\u65e9\u7761\u65e9\u8d77\uff0c\u5b9a\u671f\u4f53\u68c0\u3002", "aria-label": "\u9898\u76ee\u6587\u672c" }, null, 512), [ [ vue.vModelText, t.value ] ]), vue.createElementVNode("ol", tr, [ 0 === y.value.items.length ? (vue.openBlock(), vue.createElementBlock("li", nr, "\u8f93\u5165\u9898\u76ee\u540e\u4f1a\u5728\u8fd9\u91cc\u9010\u9898\u9884\u89c8")) : vue.createCommentVNode("", true), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(y.value.items, (e => (vue.openBlock(), vue.createElementBlock("li", { key: e.parsed.id, class: vue.normalizeClass([ "qt-row", `is-${e.status}` ]) }, [ vue.createElementVNode("div", ar, [ vue.createElementVNode("span", ir, vue.toDisplayString(e.parsed.titleNo || e.parsed.sourceIndex + 1), 1), vue.createElementVNode("span", sr, vue.toDisplayString(e.parsed.typeLabel), 1), vue.createElementVNode("span", rr, vue.toDisplayString(q[e.status]), 1) ]), vue.createElementVNode("p", or, vue.toDisplayString(e.parsed.question), 1), e.parsed.options.length ? (vue.openBlock(), vue.createElementBlock("div", lr, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(formatOptions(e), (e => (vue.openBlock(), vue.createElementBlock("span", { key: e.label, class: vue.normalizeClass({ "is-true": e.isTrue }) }, vue.toDisplayString(e.label), 3)))), 128)) ])) : vue.createCommentVNode("", true), e.parsed.answer.length ? (vue.openBlock(), vue.createElementBlock("p", cr, "\u7b54\u6848\uff1a" + vue.toDisplayString(e.parsed.answer.join(" | ")), 1)) : vue.createCommentVNode("", true), e.errors.length ? (vue.openBlock(), vue.createElementBlock("ul", ur, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(e.errors, (e => (vue.openBlock(), vue.createElementBlock("li", { key: e }, vue.toDisplayString(e), 1)))), 128)) ])) : vue.createCommentVNode("", true) ], 2)))), 128)) ]) ]) ])); } }), dr = Cache.get("apiList", []), mr = [ { name: "\u4e00\u4e4b\u9898\u5e93", url: "http://cx.icodef.com/wyn-nb?v=4", method: "POST", type: "json", headers: {}, params: [], data: { question: "$question", options: "$options", type: "$type" }, response: { type: "field", value: "data" }, weight: 0 } ], hr = pinia.defineStore("api", { state: () => ({ apiList: dr, defApiList: mr }), actions: {}, getters: { getApiList() { return this.apiList.forEach(((e, t) => { e.name === this.defApiList[t].name && (this.defApiList[t] = e); })), this.apiList.concat(this.defApiList); } } }), fr = vue.ref(Cache.match("ques1_").length); function refreshLibraryCount() { fr.value = Cache.match("ques1_").length; } function useLibraryCount() { return fr; } const gr = vue.reactive({ open: false, title: "", message: "", confirmText: "\u786e\u5b9a", danger: false, resolve: null }); function confirmAction(e) { var t; return null == (t = gr.resolve) || t.call(gr, false), new Promise((t => { Object.assign(gr, { open: true, title: e.title, message: e.message ?? "", confirmText: e.confirmText ?? "\u786e\u5b9a", danger: !!e.danger, resolve: t }); })); } function settleConfirm(e) { const t = gr.resolve; gr.open = false, gr.resolve = null, null == t || t(e); } const vr = { class: "lib-toolbar" }, yr = { class: "lib-search" }, br = { key: 0, class: "lib-search-state" }, wr = { class: "lib-chips", role: "group", "aria-label": "\u7b5b\u9009" }, xr = [ "aria-pressed" ], kr = { class: "num" }, qr = [ "onClick" ], _r = { class: "lib-split" }, Ar = { class: "lib-list scroll" }, Tr = [ "onClick" ], Cr = { class: "lib-row-type" }, Sr = { class: "lib-row-stem" }, Ir = { class: "lib-row-answer" }, Er = { key: 1, class: "lib-empty" }, Ur = vue.createElementVNode("p", null, "\u6ca1\u6709\u5339\u914d\u7684\u9898\u76ee", -1), Pr = vue.createElementVNode("p", null, "\u672c\u5730\u9898\u5e93\u8fd8\u662f\u7a7a\u7684", -1), Hr = vue.createElementVNode("span", null, "\u5728\u652f\u6301\u6536\u5f55\u7684\u5e73\u53f0\u505a\u5b8c\u9898\u3001\u67e5\u770b\u7b54\u6848\u540e\u4f1a\u81ea\u52a8\u6536\u5f55\uff0c\u4e5f\u53ef\u4ee5\u4ece\u5e95\u680f\u300c\u5bfc\u5165\u300d\u3002", -1), $r = { class: "lib-pane scroll" }, Lr = { key: 1, class: "lib-pane-empty" }, Mr = { class: "area-foot" }, jr = { class: "lib-count num" }, Or = { key: 2, class: "lib-uploading" }, zr = vue.createElementVNode("span", { class: "area-foot-spacer" }, null, -1), Fr = { class: "lib-menu-wrap" }, Dr = [ "aria-expanded" ], Nr = { key: 0, class: "aah-menu lib-menu", role: "menu" }, Rr = [ "disabled" ], Br = vue.createElementVNode("small", null, "\u4e5f\u53ef\u4ee5\u76f4\u63a5\u628a\u6587\u4ef6\u62d6\u8fdb\u9875\u9762", -1), Gr = vue.createElementVNode("small", null, "\u7c98\u8d34\u9898\u76ee\u6587\u672c\uff0c\u53ef\u7528 AI \u6574\u7406\u683c\u5f0f", -1), Kr = { class: "lib-menu-wrap" }, Vr = [ "aria-expanded" ], Wr = { key: 0, class: "aah-menu lib-menu", role: "menu" }, Qr = vue.createElementVNode("small", null, "\u52a0\u5bc6\u6587\u4ef6\uff0c\u53ef\u5728\u5176\u4ed6\u6d4f\u89c8\u5668\u5bfc\u5165", -1), Jr = { key: 0, class: "area-sheet", role: "dialog", "aria-label": "\u6587\u672c\u5bfc\u5165" }, Yr = { class: "area-sheet-head" }, Xr = vue.createElementVNode("h2", null, "\u6587\u672c\u5bfc\u5165", -1), Zr = { class: "area-sheet-body scroll" }, eo = { key: 1, class: "lib-drop" }, to = vue.createElementVNode("p", null, "\u677e\u5f00\u5bfc\u5165\u5907\u4efd\u6587\u4ef6\uff08.bak\uff09", -1), no = 100, ao = vue.defineComponent({ __name: "Library", setup(e) { const t = $n(), l = zn(), y = useLibraryCount(), w = vue.shallowRef(Cache.matchGet("ques1_") || []), k = vue.shallowRef(null), q = vue.ref(""), C = vue.ref(false), S = vue.ref(""), I = vue.ref(no), E = vue.ref(0), U = vue.ref(""), P = vue.ref(false), $ = vue.ref(false), L = vue.ref(null), M = vue.ref(false); let j = 0; const O = vue.computed((() => l.saveQuestionData.length > 0)), z = vue.ref("saved" === t.subPage && O.value ? "saved" : "all"); vue.watch(O, (e => { e || (z.value = "all"); })), vue.watch((() => t.subPage), (e => { "saved" === e && O.value && (z.value = "saved"); })); const reload = () => { w.value = Cache.matchGet("ques1_") || [], refreshLibraryCount(), q.value.trim() && runSearch(); }, F = vue.computed((() => "saved" === z.value ? l.saveQuestionData : w.value)), runSearch = async () => { const e = q.value.trim(); if (!e) return void (k.value = null); if ("saved" === z.value) return void (k.value = ((e, t) => { const n = t.toLowerCase(), hit = e => ("string" == typeof e ? e : JSON.stringify(e)).toLowerCase().includes(n); return e.filter((e => { var t; return (null == (t = e.question) ? void 0 : t.toLowerCase().includes(n)) || Array.isArray(e.options) && e.options.some(hit) || Array.isArray(e.answer) && e.answer.some(hit); })); })(l.saveQuestionData, e)); C.value = true; const t = e, n = await ((e, t) => new Promise((n => { const a = getFuseWorker(); a.onmessage = e => n(e.data), a.postMessage({ data: e, options: { keys: [ "question" ], threshold: .3 }, keyword: t }); })))(w.value, e); q.value.trim() === t && (k.value = n), C.value = false; }; vue.watch([ q, z ], (() => { I.value = no, E.value = 0, runSearch(); })), vue.watch(S, (() => { I.value = no, E.value = 0; })); const D = vue.computed((() => { const e = k.value ?? F.value; return S.value ? e.filter((e => e.type === S.value)) : e; })), N = vue.computed((() => D.value.slice(0, I.value))), R = vue.computed((() => D.value[E.value] ?? null)), stemText = e => { const t = document.createElement("div"); return t.innerHTML = e ?? "", (t.textContent || "").replace(/\s+/g, " ").trim(); }, B = vue.ref(null), G = vue.ref(false), K = vue.ref(false), editItem = e => { B.value = e, "15" === e.type ? K.value = true : G.value = true; }, closeEdit = () => { G.value = false, K.value = false, reload(); }, removeItem = async e => { if (!(null == e ? void 0 : e.key)) return; await confirmAction({ title: "\u5220\u9664\u8fd9\u9053\u9898\uff1f", message: "\u53ea\u5220\u9664\u672c\u5730\u9898\u5e93\u91cc\u7684\u8fd9\u4e00\u6761\uff0c\u5220\u9664\u540e\u65e0\u6cd5\u6062\u590d\u3002", confirmText: "\u5220\u9664", danger: true }) && (Cache.matchRemove(e.key), reload()); }, V = vue.ref(0), onSecretKey = e => { "`" === e.key && V.value++; }, startImportFile = () => { var e; U.value = "", null == (e = L.value) || e.click(); }, importFile = e => { $.value = true, ((e, t) => { const n = new FileReader; n.onload = async e => { var n; const a = null == (n = e.target) ? void 0 : n.result; let i = 0; try { const e = JSON.parse(await decrypt(a)); e.forEach((e => { Answer.cacheAnswer(e); })), i = e.length, msg(`\u9898\u5e93\u5bfc\u5165\u6210\u529f\uff0c\u5171\u8ba1${e.length}\u9898\n \u8fc7\u591a\u9898\u76ee\u5bfc\u5165\u540e\u9875\u9762\u4f1a\u5361\u4e3b\u8bf7\u76f4\u63a5\u5173\u95ed\u9875\u9762\u91cd\u65b0\u6253\u5f00`, "success"); } catch (s) { msg("\u6587\u4ef6\u683c\u5f0f\u9519\u8bef", "error"); } t(i); }, n.onerror = () => { msg("\u8bfb\u53d6\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5", "error"), t(0); }, n.readAsText(e); })(e, (() => { $.value = false, reload(); })); }, handleFileChange = e => { var t; const n = null == (t = e.target.files) ? void 0 : t[0]; n && importFile(n), L.value && (L.value.value = ""); }, openTool = () => { U.value = "", P.value = true; }, closeTool = () => { P.value = false, reload(); }, doExport = e => { U.value = "", "backup" === e ? (async () => { try { const e = Cache.matchGet("ques1_") || []; if (0 === e.length) return void msg("\u6682\u65e0\u9898\u76ee\u53ef\u5bfc\u51fa", "warning"); msg(`\u6b63\u5728\u6253\u5305${e.length}\u9898\uff0c\u8bf7\u7a0d\u540e...`, "info"); const t = await encrypt(JSON.stringify(e)); if (!t) return void msg("\u52a0\u5bc6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u6216\u8054\u7cfb\u5f00\u53d1\u8005", "error"); const n = new Blob([ t ], { type: "application/text" }); msg(`\u6253\u5305\u5b8c\u6210\uff0c\u5171\u8ba1${e.length}\u9898\uff0c\u51c6\u5907\u4e0b\u8f7d`, "success"); const a = document.createElement("a"); a.href = URL.createObjectURL(n); const i = (new Date).toLocaleDateString().replace(/\//g, "-"); a.download = `\u7231\u95ee\u7b54\u52a9\u624b\u5907\u4efd-${i}.bak`, a.click(), setTimeout((() => URL.revokeObjectURL(a.href)), 100); } catch (e) { msg(`\u5bfc\u51fa\u5931\u8d25\uff1a${e}`, "error"); } })() : exportQuestionsAsDoc("doc-current" === e ? D.value : w.value); }, onDragEnter = e => { var t, n; (null == (n = null == (t = e.dataTransfer) ? void 0 : t.types) ? void 0 : n.includes("Files")) && (j++, M.value = true); }, onDragLeave = () => { j = Math.max(0, j - 1), 0 === j && (M.value = false); }, onDragOver = e => { M.value && e.preventDefault(); }, onDrop = e => { var t, n; if (!M.value) return; e.preventDefault(), j = 0, M.value = false; const a = null == (n = null == (t = e.dataTransfer) ? void 0 : t.files) ? void 0 : n[0]; a && importFile(a); }, closeMenus = e => { var t, n; (null == (n = null == (t = e.target) ? void 0 : t.closest) ? void 0 : n.call(t, ".lib-menu-wrap")) || (U.value = ""); }; return vue.onMounted((() => { window.addEventListener("keydown", onSecretKey), window.addEventListener("dragenter", onDragEnter), window.addEventListener("dragleave", onDragLeave), window.addEventListener("dragover", onDragOver), window.addEventListener("drop", onDrop); })), vue.onBeforeUnmount((() => { window.removeEventListener("keydown", onSecretKey), window.removeEventListener("dragenter", onDragEnter), window.removeEventListener("dragleave", onDragLeave), window.removeEventListener("dragover", onDragOver), window.removeEventListener("drop", onDrop); })), (e, c) => (vue.openBlock(), vue.createElementBlock("div", { class: "area lib-area", onClick: closeMenus }, [ vue.createVNode(es, { visible: G.value, ques: B.value, onHandleClose: closeEdit }, null, 8, [ "visible", "ques" ]), vue.createVNode(Hs, { visible: K.value, ques: B.value, onHandleClose: closeEdit }, null, 8, [ "visible", "ques" ]), vue.createElementVNode("div", vr, [ vue.createElementVNode("label", yr, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:magnify" }), vue.withDirectives(vue.createElementVNode("input", { "onUpdate:modelValue": c[0] || (c[0] = e => q.value = e), type: "search", placeholder: "\u641c\u7d22\u9898\u5e72\u3001\u9009\u9879\u6216\u7b54\u6848", "aria-label": "\u641c\u7d22\u9898\u5e93" }, null, 512), [ [ vue.vModelText, q.value ] ]), C.value ? (vue.openBlock(), vue.createElementBlock("span", br, "\u641c\u7d22\u4e2d\u2026")) : vue.createCommentVNode("", true) ]), vue.createElementVNode("div", wr, [ O.value ? (vue.openBlock(), vue.createElementBlock("button", { key: 0, type: "button", class: vue.normalizeClass([ "lib-chip is-scope", { "is-on": "saved" === z.value } ]), "aria-pressed": "saved" === z.value, onClick: c[1] || (c[1] = e => { return n = "saved" === z.value ? "all" : "saved", z.value = n, void t.setPage("library", "saved" === n ? "saved" : ""); var n; }) }, [ vue.createTextVNode("\u672c\u9875\u6536\u5f55 "), vue.createElementVNode("span", kr, vue.toDisplayString(vue.unref(l).saveQuestionData.length), 1) ], 10, xr)) : vue.createCommentVNode("", true), vue.createElementVNode("button", { type: "button", class: vue.normalizeClass([ "lib-chip", { "is-on": !S.value } ]), onClick: c[2] || (c[2] = e => S.value = "") }, "\u5168\u90e8", 2), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(hi), (e => (vue.openBlock(), vue.createElementBlock("button", { key: e.value, type: "button", class: vue.normalizeClass([ "lib-chip", { "is-on": S.value === e.value } ]), onClick: t => S.value = S.value === e.value ? "" : e.value }, vue.toDisplayString(e.label), 11, qr)))), 128)) ]) ]), vue.createElementVNode("div", _r, [ vue.createElementVNode("div", Ar, [ N.value.length ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(N.value, ((e, t) => (vue.openBlock(), vue.createElementBlock("div", { key: e.key || t, class: vue.normalizeClass([ "lib-row", { "is-current": t === E.value } ]) }, [ vue.createElementVNode("button", { type: "button", class: "lib-row-main", onClick: e => E.value = t }, [ vue.createElementVNode("span", Cr, vue.toDisplayString(vue.unref(typeLabel)(e)), 1), vue.createElementVNode("span", Sr, vue.toDisplayString(stemText(e.question) || "\uff08\u65e0\u9898\u5e72\uff09"), 1), vue.createElementVNode("span", Ir, vue.toDisplayString(vue.unref(answerSummary)(e) || "\u6682\u65e0\u7b54\u6848"), 1) ], 8, Tr), t === E.value ? (vue.openBlock(), vue.createBlock(Hi, { key: 0, class: "lib-row-inline", item: e, deletable: !!e.key, onEdit: t => editItem(e), onRemove: t => removeItem(e) }, null, 8, [ "item", "deletable", "onEdit", "onRemove" ])) : vue.createCommentVNode("", true) ], 2)))), 128)), D.value.length > N.value.length ? (vue.openBlock(), vue.createElementBlock("button", { key: 0, type: "button", class: "aah-btn aah-btn-plain lib-more", onClick: c[3] || (c[3] = e => I.value += no) }, "\u518d\u663e\u793a " + vue.toDisplayString(Math.min(no, D.value.length - N.value.length)) + " \u6761\uff08\u8fd8\u5269 " + vue.toDisplayString(D.value.length - N.value.length) + " \u6761\uff09", 1)) : vue.createCommentVNode("", true) ], 64)) : (vue.openBlock(), vue.createElementBlock("div", Er, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:database-search-outline", class: "lib-empty-icon" }), q.value || S.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ Ur, vue.createElementVNode("button", { type: "button", class: "aah-btn aah-btn-small", onClick: c[4] || (c[4] = e => { q.value = "", S.value = ""; }) }, "\u6e05\u9664\u7b5b\u9009") ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ Pr, Hr ], 64)) ])) ]), vue.createElementVNode("aside", $r, [ R.value ? (vue.openBlock(), vue.createBlock(Hi, { key: 0, item: R.value, deletable: !!R.value.key, onEdit: c[5] || (c[5] = e => editItem(R.value)), onRemove: c[6] || (c[6] = e => removeItem(R.value)) }, null, 8, [ "item", "deletable" ])) : (vue.openBlock(), vue.createElementBlock("p", Lr, "\u5728\u5de6\u4fa7\u9009\u4e00\u9053\u9898\u67e5\u770b\u8be6\u60c5")) ]) ]), vue.createElementVNode("footer", Mr, [ vue.createElementVNode("div", jr, [ vue.createTextVNode(" \u5171 "), vue.createElementVNode("b", null, vue.toDisplayString(vue.unref(y).toLocaleString()), 1), vue.createTextVNode(" \u9898 "), "saved" === z.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ vue.createTextVNode(" \xb7 \u672c\u9875\u6536\u5f55 "), vue.createElementVNode("b", null, vue.toDisplayString(vue.unref(l).saveQuestionData.length), 1) ], 64)) : vue.createCommentVNode("", true), q.value || S.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ vue.createTextVNode(" \xb7 \u7b5b\u9009\u540e "), vue.createElementVNode("b", null, vue.toDisplayString(D.value.length), 1) ], 64)) : vue.createCommentVNode("", true), $.value ? (vue.openBlock(), vue.createElementBlock("span", Or, "\u5bfc\u5165\u4e2d\u2026")) : vue.createCommentVNode("", true) ]), zr, vue.createElementVNode("input", { ref_key: "uploadInput", ref: L, type: "file", accept: ".bak", class: "lib-file-input", onChange: handleFileChange }, null, 544), vue.createElementVNode("div", Fr, [ vue.createElementVNode("button", { type: "button", class: "aah-btn", "aria-expanded": "import" === U.value, onClick: c[7] || (c[7] = e => U.value = "import" === U.value ? "" : "import") }, [ vue.createTextVNode(" \u5bfc\u5165"), vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:chevron-down" }) ], 8, Dr), "import" === U.value ? (vue.openBlock(), vue.createElementBlock("div", Nr, [ vue.createElementVNode("button", { type: "button", class: "aah-menu-item", role: "menuitem", disabled: $.value, onClick: startImportFile }, [ vue.createTextVNode(" \u5907\u4efd\u6587\u4ef6\uff08.bak\uff09"), Br ], 8, Rr), vue.createElementVNode("button", { type: "button", class: "aah-menu-item", role: "menuitem", onClick: openTool }, [ vue.createTextVNode(" \u6587\u672c\u5bfc\u5165"), Gr ]) ])) : vue.createCommentVNode("", true) ]), vue.createElementVNode("div", Kr, [ vue.createElementVNode("button", { type: "button", class: "aah-btn", "aria-expanded": "export" === U.value, onClick: c[8] || (c[8] = e => U.value = "export" === U.value ? "" : "export") }, [ vue.createTextVNode(" \u5bfc\u51fa"), vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:chevron-down" }) ], 8, Vr), "export" === U.value ? (vue.openBlock(), vue.createElementBlock("div", Wr, [ vue.createElementVNode("button", { type: "button", class: "aah-menu-item", role: "menuitem", onClick: c[9] || (c[9] = e => doExport("backup")) }, [ vue.createTextVNode(" \u5bfc\u51fa\u5907\u4efd\uff08.bak\uff09"), Qr ]), V.value > 10 ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ vue.createElementVNode("button", { type: "button", class: "aah-menu-item", role: "menuitem", onClick: c[10] || (c[10] = e => doExport("doc-current")) }, "\u5bfc\u51fa Word \xb7 \u5f53\u524d\u7b5b\u9009"), vue.createElementVNode("button", { type: "button", class: "aah-menu-item", role: "menuitem", onClick: c[11] || (c[11] = e => doExport("doc-all")) }, "\u5bfc\u51fa Word \xb7 \u5168\u90e8") ], 64)) : vue.createCommentVNode("", true) ])) : vue.createCommentVNode("", true) ]) ]), P.value ? (vue.openBlock(), vue.createElementBlock("section", Jr, [ vue.createElementVNode("header", Yr, [ vue.createElementVNode("button", { type: "button", class: "aah-btn aah-btn-plain aah-btn-small", onClick: closeTool }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:arrow-left" }), vue.createTextVNode("\u8fd4\u56de\u9898\u5e93 ") ]), Xr ]), vue.createElementVNode("div", Zr, [ vue.createVNode(pr) ]) ])) : vue.createCommentVNode("", true), M.value ? (vue.openBlock(), vue.createElementBlock("div", eo, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:tray-arrow-down" }), to ])) : vue.createCommentVNode("", true) ])); } }), io = { class: "segmented", role: "tablist" }, so = [ "aria-selected", "onClick" ], ro = vue.defineComponent({ __name: "SegmentedControl", props: { segments: {}, modelValue: {} }, emits: [ "update:modelValue" ], setup: e => (e, t) => (vue.openBlock(), vue.createElementBlock("div", io, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(e.segments, (t => (vue.openBlock(), vue.createElementBlock("button", { key: t.key, type: "button", role: "tab", "aria-selected": e.modelValue === t.key, class: vue.normalizeClass([ "segment-item", { active: e.modelValue === t.key } ]), onClick: n => e.$emit("update:modelValue", t.key) }, vue.toDisplayString(t.label), 11, so)))), 128)) ])) }), oo = [ "checked", "disabled" ], lo = vue.createElementVNode("span", { class: "switch-slider", "aria-hidden": "true" }, null, -1), co = vue.defineComponent({ __name: "Switch", props: { modelValue: { type: Boolean }, disabled: { type: Boolean } }, emits: [ "update:modelValue" ], setup: e => (e, t) => (vue.openBlock(), vue.createElementBlock("label", { class: vue.normalizeClass([ "switch", { disabled: e.disabled } ]) }, [ vue.createElementVNode("input", { type: "checkbox", checked: e.modelValue, disabled: e.disabled, onChange: t[0] || (t[0] = t => e.$emit("update:modelValue", t.target.checked)) }, null, 40, oo), lo ], 2)) }), uo = { class: "config-item" }, po = { class: "config-item-content" }, mo = { class: "config-label" }, ho = { class: "label-wrapper" }, fo = { class: "label-text" }, go = { key: 0, class: "label-desc" }, vo = { class: "config-control" }, yo = [ "value" ], bo = { key: 4, class: "hotkey-input-wrapper" }, wo = [ "value", "placeholder" ], xo = { key: 0, class: "hotkey-hint danger" }, ko = { key: 1, class: "hotkey-hint" }, qo = { key: 5, class: "checkbox-group" }, _o = [ "value" ], Ao = { key: 6, class: "radio-group" }, To = [ "value" ], Co = [ "min", "max", "step" ], So = vue.defineComponent({ __name: "ConfigItem", props: { item: {}, recordingHotkey: {} }, emits: [ "start-recording", "hotkey-keydown" ], setup(e, {emit: t}) { const i = e, l = t, u = vue.computed((() => i.item.kind ?? i.item.type)), handleStartRecording = () => { "hotkey" === u.value && l("start-recording", i.item.name); }, handleHotkeyKeydown = e => { l("hotkey-keydown", e, i.item); }; return (e, t) => (vue.openBlock(), vue.createElementBlock("div", uo, [ vue.createElementVNode("div", po, [ vue.createElementVNode("div", mo, [ vue.createElementVNode("div", ho, [ vue.createElementVNode("span", fo, vue.toDisplayString(e.item.label), 1), e.item.desc ? (vue.openBlock(), vue.createElementBlock("span", go, vue.toDisplayString(e.item.desc), 1)) : vue.createCommentVNode("", true) ]) ]), vue.createElementVNode("div", vo, [ "switch" === u.value ? (vue.openBlock(), vue.createBlock(co, { key: 0, modelValue: e.item.value, "onUpdate:modelValue": t[0] || (t[0] = t => e.item.value = t) }, null, 8, [ "modelValue" ])) : "input" === u.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", { key: 1, "onUpdate:modelValue": t[1] || (t[1] = t => e.item.value = t), class: "aah-input", type: "text" }, null, 512)), [ [ vue.vModelText, e.item.value ] ]) : "number" === u.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", { key: 2, "onUpdate:modelValue": t[2] || (t[2] = t => e.item.value = t), class: "aah-input", type: "number" }, null, 512)), [ [ vue.vModelText, e.item.value, void 0, { number: true } ] ]) : "select" === u.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("select", { key: 3, "onUpdate:modelValue": t[3] || (t[3] = t => e.item.value = t), class: "aah-select" }, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(e.item.options, (e => (vue.openBlock(), vue.createElementBlock("option", { key: e.value, value: e.value }, vue.toDisplayString(e.label), 9, yo)))), 128)) ], 512)), [ [ vue.vModelSelect, e.item.value ] ]) : "hotkey" === u.value ? (vue.openBlock(), vue.createElementBlock("div", bo, [ vue.createElementVNode("input", { class: vue.normalizeClass([ "aah-input", { recording: e.recordingHotkey === e.item.name } ]), value: e.item.value, placeholder: e.recordingHotkey === e.item.name ? "\u8bf7\u6309\u4e0b\u5feb\u6377\u952e..." : "\u70b9\u51fb\u540e\u6309\u4e0b\u5feb\u6377\u952e\u7ec4\u5408", readonly: "", onFocus: handleStartRecording, onKeydown: handleHotkeyKeydown }, null, 42, wo), e.recordingHotkey === e.item.name ? (vue.openBlock(), vue.createElementBlock("span", xo, "\u5f55\u5236\u4e2d...")) : (vue.openBlock(), vue.createElementBlock("span", ko, "\u70b9\u51fb\u5f55\u5236")) ])) : "checkbox" === u.value ? (vue.openBlock(), vue.createElementBlock("div", qo, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(e.item.options, (i => (vue.openBlock(), vue.createElementBlock("label", { key: i.value, class: "checkbox-item" }, [ vue.withDirectives(vue.createElementVNode("input", { type: "checkbox", value: i.value, "onUpdate:modelValue": t[4] || (t[4] = t => e.item.value = t) }, null, 8, _o), [ [ vue.vModelCheckbox, e.item.value ] ]), vue.createElementVNode("span", null, vue.toDisplayString(i.label), 1) ])))), 128)) ])) : "radio" === u.value ? (vue.openBlock(), vue.createElementBlock("div", Ao, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(e.item.options, (i => (vue.openBlock(), vue.createElementBlock("label", { key: i.value, class: "radio-item" }, [ vue.withDirectives(vue.createElementVNode("input", { type: "radio", value: i.value, "onUpdate:modelValue": t[5] || (t[5] = t => e.item.value = t) }, null, 8, To), [ [ vue.vModelRadio, e.item.value ] ]), vue.createElementVNode("span", null, vue.toDisplayString(i.label), 1) ])))), 128)) ])) : "segment" === u.value ? (vue.openBlock(), vue.createBlock(ro, { key: 7, modelValue: e.item.value, "onUpdate:modelValue": t[6] || (t[6] = t => e.item.value = t), segments: (e.item.options ?? []).map((e => ({ key: String(e.value), label: e.label }))) }, null, 8, [ "modelValue", "segments" ])) : "slider" === u.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", { key: 8, type: "range", "onUpdate:modelValue": t[7] || (t[7] = t => e.item.value = t), min: e.item.min ?? 0, max: e.item.max ?? 100, step: e.item.step ?? 1, class: "aah-slider" }, null, 8, Co)), [ [ vue.vModelText, e.item.value, void 0, { number: true } ] ]) : vue.createCommentVNode("", true) ]) ]) ])); } }), Io = { class: "ai-config-panel" }, Eo = { key: 0, class: "aah-card ai-wizard" }, Uo = { class: "ai-wizard-head" }, Po = vue.createElementVNode("div", null, [ vue.createElementVNode("h4", null, "\u5f00\u59cb\u4f7f\u7528 AI"), vue.createElementVNode("p", null, "\u4e09\u6b65\u914d\u597d\uff0c\u4e4b\u540e\u968f\u65f6\u80fd\u6539") ], -1), Ho = { class: "ai-wizard-count" }, $o = { class: "ai-wizard-steps", "aria-label": "\u914d\u7f6e\u8fdb\u5ea6" }, Lo = vue.createElementVNode("span", { class: "ai-wizard-dot", "aria-hidden": "true" }, null, -1), Mo = { key: 0, class: "ai-wizard-body" }, jo = vue.createElementVNode("p", { class: "ai-config-field-help" }, " \u4efb\u9009\u4e00\u5bb6\uff0c\u7528\u5b83\u81ea\u5df1\u7684 API Key\u3002\u5e26\u300c\u6709\u514d\u8d39\u989d\u5ea6\u300d\u7684\u6ce8\u518c\u540e\u5373\u53ef\u9886\u53d6\uff0c\u4e0d\u7528\u5145\u503c\u3002 ", -1), Oo = { class: "ai-config-channel-grid" }, zo = [ "onClick" ], Fo = { class: "ai-config-card-head" }, Do = { class: "ai-config-card-tags" }, No = { key: 0, class: "ai-config-card-promo" }, Ro = { class: "ai-wizard-actions" }, Bo = { key: 1, class: "ai-wizard-body" }, Go = { class: "ai-wizard-subject" }, Ko = { class: "ai-config-field-help" }, Vo = { key: 0, class: "ai-config-card-promo" }, Wo = [ "href" ], Qo = { class: "ai-wizard-actions" }, Jo = { key: 2, class: "ai-wizard-body" }, Yo = { class: "ai-wizard-subject" }, Xo = { class: "ai-config-field" }, Zo = vue.createElementVNode("span", null, "\u628a API Key \u7c98\u5230\u8fd9\u91cc", -1), el = [ "value" ], tl = { class: "ai-wizard-actions" }, nl = [ "disabled" ], al = [ "disabled" ], il = { key: 0, class: "aah-alert aah-alert-info" }, sl = { key: 1, class: "ai-config-manager" }, rl = { class: "ai-config-side" }, ol = { class: "aah-card ai-config-list-panel" }, ll = vue.createElementVNode("header", { class: "ai-config-section-head" }, [ vue.createElementVNode("h4", null, "\u6211\u7684\u6e20\u9053") ], -1), cl = { key: 0, class: "ai-config-channel-list" }, ul = [ "onClick" ], pl = { class: "ai-config-channel-text" }, dl = { key: 0 }, ml = { key: 1 }, hl = { key: 2 }, fl = { key: 3 }, gl = { key: 0, class: "aah-tag aah-tag-primary" }, vl = { key: 1, class: "ai-config-field-help" }, yl = { class: "ai-config-side-actions" }, bl = { class: "aah-card ai-config-global" }, wl = [ "aria-expanded" ], xl = vue.createElementVNode("span", null, "\u5168\u5c40\u8bbe\u7f6e", -1), kl = { key: 0, class: "ai-config-global-body" }, ql = { class: "native-checkbox" }, _l = vue.createElementVNode("span", null, [ vue.createTextVNode("\u542f\u7528 AI \u8f85\u52a9\u7b54\u9898 "), vue.createElementVNode("small", null, "\uff08AI \u6b63\u786e\u7387\u4e0d\u4fdd\u8bc1\uff09") ], -1), Al = { class: "ai-config-field" }, Tl = vue.createElementVNode("span", null, "AI \u91c7\u7eb3\u7b56\u7565", -1), Cl = [ vue.createElementVNode("option", { value: "conservative" }, "\u4fdd\u5b88\u586b", -1), vue.createElementVNode("option", { value: "direct" }, "\u76f4\u63a5\u586b", -1), vue.createElementVNode("option", { value: "preview" }, "\u9884\u89c8\u786e\u8ba4", -1) ], Sl = { class: "ai-config-field" }, Il = vue.createElementVNode("span", null, "\u56fe\u7247\u9898\u6e20\u9053", -1), El = vue.createElementVNode("option", { value: "" }, "\u81ea\u52a8\u9009\u62e9", -1), Ul = [ "value" ], Pl = { key: 0, class: "ai-config-field-help" }, Hl = { class: "ai-config-field" }, $l = vue.createElementVNode("span", null, "\u8c03\u7528\u65b9\u5f0f", -1), Ll = [ vue.createElementVNode("option", { value: "auto" }, "\u81ea\u52a8\uff08\u4f18\u5148\u7ecf\u7231\u95ee\u7b54\u4e2d\u8f6c\uff0c\u5931\u8d25\u56de\u843d\u76f4\u8fde\uff09", -1), vue.createElementVNode("option", { value: "direct" }, "\u4ec5\u76f4\u8fde\uff08\u4e0d\u7ecf\u7231\u95ee\u7b54\u670d\u52a1\u5668\uff09", -1) ], Ml = vue.createElementVNode("p", { class: "ai-config-field-help" }, " \u9009\u300c\u81ea\u52a8\u300d\u65f6\uff0c\u4f60\u7684 API Key \u4f1a\u7ecf\u7231\u95ee\u7b54\u670d\u52a1\u5668\u8f6c\u53d1\u7ed9\u5382\u5546\uff1b\u6211\u4eec\u4e0d\u4fdd\u5b58\u5b83\u3002 \u4ecb\u610f\u7684\u8bdd\u9009\u300c\u4ec5\u76f4\u8fde\u300d\u3002 ", -1), jl = { key: 0, class: "aah-card ai-config-detail" }, Ol = { class: "ai-config-section-head" }, zl = { class: "ai-config-card-tags" }, Fl = { key: 0, class: "aah-tag aah-tag-success" }, Dl = { key: 1, class: "aah-tag" }, Nl = { class: "ai-config-field" }, Rl = vue.createElementVNode("span", null, "API Key", -1), Bl = [ "value" ], Gl = { class: "ai-config-field-help" }, Kl = [ "href" ], Vl = { class: "ai-config-field" }, Wl = vue.createElementVNode("span", null, "\u6a21\u578b", -1), Ql = [ "value" ], Jl = [ "value" ], Yl = { key: 0, class: "ai-config-field-help" }, Xl = { key: 1, class: "ai-config-field-help" }, Zl = { class: "native-checkbox" }, ec = [ "checked" ], tc = vue.createElementVNode("span", null, "\u542f\u7528\u8be5\u6e20\u9053", -1), nc = { key: 0, class: "ai-config-field-help" }, ac = { key: 1, class: "ai-config-field-help" }, ic = { class: "ai-config-instance-actions" }, sc = [ "disabled" ], rc = { key: 2, class: "aah-alert aah-alert-info" }, oc = { key: 1, class: "aah-card ai-config-detail ai-config-detail-empty" }, lc = { class: "ai-config-field-help" }, cc = { class: "modal-panel ai-config-add-modal" }, uc = { class: "modal-header" }, pc = vue.createElementVNode("h3", { id: "ai-add-channel-title" }, "\u6dfb\u52a0\u6e20\u9053", -1), dc = { class: "modal-body" }, mc = { class: "ai-config-channel-grid" }, hc = { class: "ai-config-card-head" }, fc = { class: "ai-config-card-tags" }, gc = { key: 0, class: "ai-config-card-promo" }, vc = { class: "ai-config-card-actions" }, yc = [ "href" ], bc = [ "onClick" ], wc = { key: 0, class: "ai-config-field-help" }, xc = { class: "modal-footer" }, kc = [ "disabled" ], _c = { class: "modal-panel ai-config-delete-modal" }, Ac = { class: "modal-header" }, Tc = vue.createElementVNode("h3", { id: "ai-channel-delete-title" }, "\u786e\u8ba4\u79fb\u9664", -1), Cc = { class: "modal-body" }, Sc = { class: "ai-config-delete-text" }, Ic = { class: "modal-footer" }, Ec = vue.defineComponent({ __name: "AiConfigPanel", setup(e) { const t = On(), l = vue.ref(!t.settings.instances.some((e => { var t; return null == (t = e.credential) ? void 0 : t.value; }))); const p = t.settings.instances[0], g = vue.ref(p ? 2 : 1), x = vue.ref((null == p ? void 0 : p.channelId) ?? ""), k = vue.ref(false), q = vue.ref(t.settings.defaultChannelId || (null == p ? void 0 : p.channelId) || ""), _ = vue.ref(false), T = vue.ref(false), S = vue.ref(null), channelOf = e => { const n = resolveChannel(t.catalog, t.settings.customChannels, e); return n ? asChannel(n) : void 0; }, I = vue.computed((() => t.catalogForDisplay().filter((e => !t.settings.instances.some((t => t.channelId === e.id)))))), E = vue.computed((() => k.value ? I.value : I.value.slice(0, 6))), U = vue.computed((() => t.settings.instances.map((e => ({ instance: e, channel: channelOf(e.channelId) }))))), P = vue.computed((() => t.settings.instances.find((e => e.channelId === q.value)))), $ = vue.computed((() => channelOf(q.value))), L = vue.computed((() => channelOf(x.value))), M = vue.computed((() => t.settings.instances.find((e => e.channelId === x.value)))), j = vue.computed((() => { var e, t; return Boolean(null == (t = null == (e = M.value) ? void 0 : e.credential) ? void 0 : t.value); })), O = vue.computed((() => U.value.filter((e => e.channel && hasVisionModel(e.channel))).map((e => ({ ...e, readiness: imageReadiness(e.channel, e.instance) }))))), z = vue.computed((() => $.value && P.value ? imageReadiness($.value, P.value) : void 0)), useSuggestedVisionModel = () => { const e = P.value, t = z.value; e && "switchable" === (null == t ? void 0 : t.state) && (e.modelId = t.suggestModelId, save(), msg(`\u5df2\u5207\u6362\u5230 ${t.suggestModelId}`, "success")); }, testingFor = e => Boolean(t.connectionTestingIds[e]), messageFor = e => t.connectionMessages[e] || "", save = () => t.saveSettings(), setCredential = (e, n) => { e && t.updateCredential(e, { type: "api-key", value: n }); }, backToPick = () => { var e; const n = M.value; n && !(null == (e = n.credential) ? void 0 : e.value) && t.removeInstance(n.channelId), x.value = "", g.value = 1; }, finishWizard = () => { x.value && (t.settings.defaultChannelId = x.value, q.value = x.value, save()), l.value = false; }, skipWizard = () => { l.value = false; }, restartWizard = () => { x.value = "", g.value = 1, k.value = false, l.value = true; }, updateModel = e => { const t = P.value; t && (t.modelId = e.target.value, save()); }, toggleEnabled = e => { const t = P.value; t && (t.enabled = e.target.checked, save()); }, setDefault = () => { q.value && (t.settings.defaultChannelId = q.value, save(), msg("\u5df2\u8bbe\u4e3a\u9ed8\u8ba4\u6e20\u9053", "success")); }, confirmDelete = () => { var e; const n = S.value; n && (t.removeInstance(n.id), q.value === n.id && (q.value = (null == (e = t.settings.instances[0]) ? void 0 : e.channelId) || ""), S.value = null, msg("\u6e20\u9053\u5df2\u79fb\u9664", "success")); }; return vue.onMounted((() => { t.loadCatalog(); })), (e, c) => { var u, p, A, F, D, N, R, B, G; return vue.openBlock(), vue.createElementBlock("div", Io, [ l.value ? (vue.openBlock(), vue.createElementBlock("section", Eo, [ vue.createElementVNode("header", Uo, [ Po, vue.createElementVNode("span", Ho, vue.toDisplayString(g.value) + " / 3", 1) ]), vue.createElementVNode("ol", $o, [ (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList([ "\u9009\u5e73\u53f0", "\u9886 Key", "\u7c98\u56de\u6765" ], ((e, t) => vue.createElementVNode("li", { key: e, class: vue.normalizeClass({ done: g.value > t + 1, current: g.value === t + 1 }) }, [ Lo, vue.createElementVNode("span", null, vue.toDisplayString(e), 1) ], 2))), 64)) ]), 1 === g.value ? (vue.openBlock(), vue.createElementBlock("div", Mo, [ jo, vue.createElementVNode("div", Oo, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(E.value, (e => (vue.openBlock(), vue.createElementBlock("button", { key: e.id, type: "button", class: vue.normalizeClass([ "ai-config-card ai-config-card-pick", { recommended: e.recommended } ]), onClick: n => { return a = e.id, t.addChannel(a), x.value = a, q.value = a, void (g.value = 2); var a; } }, [ vue.createElementVNode("span", Fo, [ vue.createElementVNode("strong", null, vue.toDisplayString(e.name), 1) ]), vue.createElementVNode("span", Do, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(channelTags)(e), (e => (vue.openBlock(), vue.createElementBlock("span", { key: e.label, class: vue.normalizeClass([ "aah-tag", e.cls ]) }, vue.toDisplayString(e.label), 3)))), 128)) ]), e.promoText ? (vue.openBlock(), vue.createElementBlock("span", No, vue.toDisplayString(e.promoText), 1)) : vue.createCommentVNode("", true) ], 10, zo)))), 128)) ]), vue.createElementVNode("div", Ro, [ !k.value && I.value.length > E.value.length ? (vue.openBlock(), vue.createElementBlock("button", { key: 0, class: "aah-btn aah-btn-plain", type: "button", onClick: c[0] || (c[0] = e => k.value = true) }, " \u5c55\u5f00\u5168\u90e8 " + vue.toDisplayString(I.value.length) + " \u5bb6 ", 1)) : vue.createCommentVNode("", true), vue.createElementVNode("button", { class: "aah-btn aah-btn-plain aah-btn-small", type: "button", onClick: skipWizard }, " \u8df3\u8fc7\uff0c\u76f4\u63a5\u8fdb\u8bbe\u7f6e ") ]) ])) : 2 === g.value && L.value ? (vue.openBlock(), vue.createElementBlock("div", Bo, [ vue.createElementVNode("h5", Go, vue.toDisplayString(L.value.name), 1), vue.createElementVNode("p", Ko, vue.toDisplayString(L.value.keyHelp), 1), L.value.promoText ? (vue.openBlock(), vue.createElementBlock("p", Vo, vue.toDisplayString(L.value.promoText), 1)) : vue.createCommentVNode("", true), L.value.signupUrl ? (vue.openBlock(), vue.createElementBlock("a", { key: 1, class: "aah-btn aah-btn-primary", href: L.value.signupUrl, target: "_blank", rel: "noopener noreferrer" }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:open-in-new", class: "icon-inline" }), vue.createTextVNode("\u53bb " + vue.toDisplayString(L.value.name) + " \u9886\u53d6 API Key ", 1) ], 8, Wo)) : vue.createCommentVNode("", true), vue.createElementVNode("div", Qo, [ vue.createElementVNode("button", { class: "aah-btn aah-btn-plain", type: "button", onClick: backToPick }, "\u6362\u4e00\u5bb6"), vue.createElementVNode("button", { class: "aah-btn", type: "button", onClick: c[1] || (c[1] = e => g.value = 3) }, "\u6211\u5df2\u7ecf\u6709 Key \u4e86") ]) ])) : 3 === g.value && L.value ? (vue.openBlock(), vue.createElementBlock("div", Jo, [ vue.createElementVNode("h5", Yo, vue.toDisplayString(L.value.name), 1), vue.createElementVNode("label", Xo, [ Zo, vue.createElementVNode("input", { value: (null == (p = null == (u = M.value) ? void 0 : u.credential) ? void 0 : p.value) || "", class: "aah-input", type: "password", autocomplete: "off", placeholder: "\u7c98\u8d34\u540e\u4f1a\u81ea\u52a8\u4fdd\u5b58\u5230\u672c\u5730", onInput: c[2] || (c[2] = e => setCredential(x.value, e.target.value)) }, null, 40, el) ]), vue.createElementVNode("div", tl, [ vue.createElementVNode("button", { class: "aah-btn aah-btn-plain", type: "button", onClick: c[3] || (c[3] = e => g.value = 2) }, "\u4e0a\u4e00\u6b65"), vue.createElementVNode("button", { class: "aah-btn", type: "button", disabled: !j.value || testingFor(x.value), onClick: c[4] || (c[4] = e => vue.unref(t).testConfig(x.value)) }, vue.toDisplayString(testingFor(x.value) ? "\u6d4b\u8bd5\u4e2d..." : "\u6d4b\u8bd5\u8fde\u63a5"), 9, nl), vue.createElementVNode("button", { class: "aah-btn aah-btn-primary", type: "button", disabled: !j.value, onClick: finishWizard }, " \u5b8c\u6210 ", 8, al) ]), messageFor(x.value) ? (vue.openBlock(), vue.createElementBlock("div", il, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:information-outline", class: "alert-icon" }), vue.createElementVNode("span", null, vue.toDisplayString(messageFor(x.value)), 1) ])) : vue.createCommentVNode("", true) ])) : vue.createCommentVNode("", true) ])) : (vue.openBlock(), vue.createElementBlock("div", sl, [ vue.createElementVNode("aside", rl, [ vue.createElementVNode("section", ol, [ ll, U.value.length ? (vue.openBlock(), vue.createElementBlock("div", cl, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(U.value, (e => { var r, l; return vue.openBlock(), vue.createElementBlock("button", { key: e.instance.channelId, type: "button", class: vue.normalizeClass([ "ai-config-channel-item", { active: e.instance.channelId === q.value, orphan: !e.channel } ]), onClick: t => q.value = e.instance.channelId }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:robot", class: "icon-inline" }), vue.createElementVNode("span", pl, [ vue.createElementVNode("strong", null, vue.toDisplayString((null == (r = e.channel) ? void 0 : r.name) ?? e.instance.channelId), 1), e.channel ? (null == (l = e.instance.credential) ? void 0 : l.value) ? e.instance.enabled ? (vue.openBlock(), vue.createElementBlock("small", fl, vue.toDisplayString(e.instance.modelId || e.channel.defaultModelId), 1)) : (vue.openBlock(), vue.createElementBlock("small", hl, "\u5df2\u505c\u7528")) : (vue.openBlock(), vue.createElementBlock("small", ml, "\u5f85\u586b API Key")) : (vue.openBlock(), vue.createElementBlock("small", dl, "\u6e20\u9053\u5df2\u4e0b\u7ebf\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9")) ]), e.instance.channelId === vue.unref(t).settings.defaultChannelId ? (vue.openBlock(), vue.createElementBlock("span", gl, "\u9ed8\u8ba4")) : vue.createCommentVNode("", true) ], 10, ul); })), 128)) ])) : (vue.openBlock(), vue.createElementBlock("p", vl, "\u8fd8\u6ca1\u6709\u4efb\u4f55\u6e20\u9053\u3002")), vue.createElementVNode("div", yl, [ vue.createElementVNode("button", { class: "aah-btn aah-btn-primary aah-btn-small", type: "button", onClick: c[5] || (c[5] = e => _.value = true) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:plus", class: "icon-inline" }), vue.createTextVNode("\u6dfb\u52a0\u6e20\u9053 ") ]), U.value.length ? vue.createCommentVNode("", true) : (vue.openBlock(), vue.createElementBlock("button", { key: 0, class: "aah-btn aah-btn-plain aah-btn-small", type: "button", onClick: restartWizard }, " \u8ddf\u7740\u5f15\u5bfc\u8d70 ")) ]) ]), vue.createElementVNode("section", bl, [ vue.createElementVNode("button", { type: "button", class: "ai-config-collapse", "aria-expanded": T.value, onClick: c[6] || (c[6] = e => T.value = !T.value) }, [ xl, vue.createVNode(vue.unref(vue$1.Icon), { icon: T.value ? "mdi:chevron-up" : "mdi:chevron-down", class: "icon-inline" }, null, 8, [ "icon" ]) ], 8, wl), T.value ? (vue.openBlock(), vue.createElementBlock("div", kl, [ vue.createElementVNode("label", ql, [ vue.withDirectives(vue.createElementVNode("input", { type: "checkbox", "onUpdate:modelValue": c[7] || (c[7] = e => vue.unref(t).settings.enabledForAsk = e), onChange: save }, null, 544), [ [ vue.vModelCheckbox, vue.unref(t).settings.enabledForAsk ] ]), _l ]), vue.createElementVNode("label", Al, [ Tl, vue.withDirectives(vue.createElementVNode("select", { "onUpdate:modelValue": c[8] || (c[8] = e => vue.unref(t).settings.adoptionStrategy = e), class: "aah-select", onChange: save }, Cl, 544), [ [ vue.vModelSelect, vue.unref(t).settings.adoptionStrategy ] ]) ]), vue.createElementVNode("label", Sl, [ Il, vue.withDirectives(vue.createElementVNode("select", { "onUpdate:modelValue": c[9] || (c[9] = e => vue.unref(t).settings.defaultVisionChannelId = e), class: "aah-select", onChange: save }, [ El, (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(O.value, (e => { var t; return vue.openBlock(), vue.createElementBlock("option", { key: e.instance.channelId, value: e.instance.channelId }, vue.toDisplayString(null == (t = e.channel) ? void 0 : t.name) + vue.toDisplayString("switchable" === e.readiness.state ? "\uff08\u5f53\u524d\u6a21\u578b\u4e0d\u652f\u6301\u56fe\u7247\uff09" : ""), 9, Ul); })), 128)) ], 544), [ [ vue.vModelSelect, vue.unref(t).settings.defaultVisionChannelId ] ]), O.value.length ? vue.createCommentVNode("", true) : (vue.openBlock(), vue.createElementBlock("p", Pl, " \u5df2\u6dfb\u52a0\u7684\u6e20\u9053\u90fd\u6ca1\u6709\u89c6\u89c9\u6a21\u578b\uff0c\u56fe\u7247\u9898\u4f1a\u9000\u56de\u7eaf\u6587\u672c\u3002 ")) ]), vue.createElementVNode("label", Hl, [ $l, vue.withDirectives(vue.createElementVNode("select", { "onUpdate:modelValue": c[10] || (c[10] = e => vue.unref(t).settings.transport = e), class: "aah-select", onChange: save }, Ll, 544), [ [ vue.vModelSelect, vue.unref(t).settings.transport ] ]), Ml ]) ])) : vue.createCommentVNode("", true) ]) ]), $.value && P.value ? (vue.openBlock(), vue.createElementBlock("section", jl, [ vue.createElementVNode("header", Ol, [ vue.createElementVNode("div", null, [ vue.createElementVNode("h4", null, vue.toDisplayString($.value.name), 1), vue.createElementVNode("p", null, vue.toDisplayString($.value.providerKind) + " \xb7 " + vue.toDisplayString($.value.baseUrl), 1) ]), vue.createElementVNode("span", { class: vue.normalizeClass([ "aah-tag", (null == (A = P.value.credential) ? void 0 : A.value) ? "aah-tag-success" : "aah-tag-warning" ]) }, vue.toDisplayString((null == (F = P.value.credential) ? void 0 : F.value) ? "\u53ef\u7528" : "\u5f85\u586b API Key"), 3) ]), vue.createElementVNode("div", zl, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(channelTags)($.value), (e => (vue.openBlock(), vue.createElementBlock("span", { key: e.label, class: vue.normalizeClass([ "aah-tag", e.cls ]) }, vue.toDisplayString(e.label), 3)))), 128)), "ready" === (null == (D = z.value) ? void 0 : D.state) ? (vue.openBlock(), vue.createElementBlock("span", Fl, " \u5f53\u524d\u6a21\u578b\u53ef\u505a\u56fe\u7247\u9898 ")) : vue.createCommentVNode("", true), (G = $.value.id, t.settings.customChannels.some((e => e.id === G)) ? (vue.openBlock(), vue.createElementBlock("span", Dl, "\u81ea\u5efa\u63a5\u53e3")) : vue.createCommentVNode("", true)) ]), vue.createElementVNode("label", Nl, [ Rl, vue.createElementVNode("input", { value: (null == (N = P.value.credential) ? void 0 : N.value) || "", class: "aah-input", type: "password", autocomplete: "off", onInput: c[11] || (c[11] = e => setCredential(q.value, e.target.value)) }, null, 40, Bl), vue.createElementVNode("p", Gl, [ vue.createTextVNode(vue.toDisplayString($.value.keyHelp) + " ", 1), $.value.signupUrl ? (vue.openBlock(), vue.createElementBlock("a", { key: 0, href: $.value.signupUrl, target: "_blank", rel: "noopener noreferrer" }, " \u53bb\u83b7\u53d6 API Key ", 8, Kl)) : vue.createCommentVNode("", true) ]) ]), vue.createElementVNode("label", Vl, [ Wl, vue.createElementVNode("select", { class: "aah-select", value: P.value.modelId || $.value.defaultModelId, onChange: updateModel }, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($.value.models, (e => (vue.openBlock(), vue.createElementBlock("option", { key: e.id, value: e.id }, vue.toDisplayString(e.label || e.id) + vue.toDisplayString(e.capabilities.image ? "\uff08\u652f\u6301\u56fe\u7247\uff09" : ""), 9, Jl)))), 128)) ], 40, Ql), "switchable" === (null == (R = z.value) ? void 0 : R.state) ? (vue.openBlock(), vue.createElementBlock("p", Yl, [ vue.createTextVNode(" \u5f53\u524d\u6a21\u578b\u4e0d\u652f\u6301\u56fe\u7247\u9898\u3002 "), vue.createElementVNode("button", { type: "button", class: "ai-config-inline-action", onClick: useSuggestedVisionModel }, " \u5207\u6362\u5230 " + vue.toDisplayString(z.value.suggestModelId), 1) ])) : "unsupported" === (null == (B = z.value) ? void 0 : B.state) ? (vue.openBlock(), vue.createElementBlock("p", Xl, " \u8be5\u6e20\u9053\u6ca1\u6709\u89c6\u89c9\u6a21\u578b\uff0c\u56fe\u7247\u9898\u9700\u53e6\u52a0\u4e00\u4e2a\u5e26\u300c\u53ef\u9009\u89c6\u89c9\u6a21\u578b\u300d\u7684\u6e20\u9053\u3002 ")) : vue.createCommentVNode("", true) ]), vue.createElementVNode("label", Zl, [ vue.createElementVNode("input", { type: "checkbox", checked: P.value.enabled, onChange: toggleEnabled }, null, 40, ec), tc ]), "global" === $.value.region ? (vue.openBlock(), vue.createElementBlock("p", nc, " \u8be5\u5e73\u53f0\u670d\u52a1\u5668\u5728\u5883\u5916\uff0c\u56fd\u5185\u7f51\u7edc\u901a\u5e38\u65e0\u6cd5\u76f4\u8fde\uff0c\u9700\u81ea\u5907\u4ee3\u7406\u540e\u518d\u4f7f\u7528\u3002 ")) : vue.unref(canDirectConnect)($.value) ? vue.createCommentVNode("", true) : (vue.openBlock(), vue.createElementBlock("p", ac, " \u8be5\u6e20\u9053\u4e0d\u5728\u672c\u7248\u672c\u7684\u76f4\u8fde\u767d\u540d\u5355\u91cc\uff0c\u53ea\u80fd\u7ecf\u7231\u95ee\u7b54\u4e2d\u8f6c\u2014\u2014\u9700\u8981\u5148\u767b\u5f55\u3002 ")), vue.createElementVNode("div", ic, [ vue.createElementVNode("button", { class: "aah-btn aah-btn-plain", type: "button", onClick: setDefault }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:star-outline", class: "icon-inline" }), vue.createTextVNode("\u8bbe\u4e3a\u9ed8\u8ba4 ") ]), vue.createElementVNode("button", { class: "aah-btn aah-btn-primary", type: "button", disabled: testingFor(q.value), onClick: c[12] || (c[12] = e => vue.unref(t).testConfig(q.value)) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:connection", class: "icon-inline" }), vue.createTextVNode(vue.toDisplayString(testingFor(q.value) ? "\u6d4b\u8bd5\u4e2d..." : "\u6d4b\u8bd5\u8fde\u63a5"), 1) ], 8, sc) ]), messageFor(q.value) ? (vue.openBlock(), vue.createElementBlock("div", rc, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:information-outline", class: "alert-icon" }), vue.createElementVNode("span", null, vue.toDisplayString(messageFor(q.value)), 1) ])) : vue.createCommentVNode("", true), vue.createElementVNode("button", { class: "aah-btn aah-btn-danger aah-btn-small ai-config-instance-remove", type: "button", onClick: c[13] || (c[13] = e => S.value = { id: $.value.id, name: $.value.name }) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:delete-outline", class: "icon-inline" }), vue.createTextVNode("\u79fb\u9664\u8be5\u6e20\u9053 ") ]) ])) : (vue.openBlock(), vue.createElementBlock("section", oc, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:robot-outline", class: "ai-config-empty-icon" }), vue.createElementVNode("p", lc, vue.toDisplayString(U.value.length ? "\u5728\u5de6\u4fa7\u9009\u4e00\u4e2a\u6e20\u9053\u8fdb\u884c\u914d\u7f6e" : "\u8fd8\u6ca1\u6709\u6e20\u9053\uff0c\u5148\u6dfb\u52a0\u4e00\u4e2a"), 1) ])) ])), _.value ? (vue.openBlock(), vue.createElementBlock("div", { key: 2, class: "modal-mask", role: "dialog", "aria-modal": "true", "aria-labelledby": "ai-add-channel-title", onClick: c[17] || (c[17] = vue.withModifiers((e => _.value = false), [ "self" ])) }, [ vue.createElementVNode("div", cc, [ vue.createElementVNode("div", uc, [ pc, vue.createElementVNode("button", { class: "aah-btn aah-btn-plain aah-btn-icon", type: "button", "aria-label": "\u5173\u95ed", onClick: c[14] || (c[14] = e => _.value = false) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:close" }) ]) ]), vue.createElementVNode("div", dc, [ vue.createElementVNode("div", mc, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(I.value, (e => (vue.openBlock(), vue.createElementBlock("article", { key: e.id, class: vue.normalizeClass([ "ai-config-card", { recommended: e.recommended } ]) }, [ vue.createElementVNode("div", hc, [ vue.createElementVNode("strong", null, vue.toDisplayString(e.name), 1) ]), vue.createElementVNode("div", fc, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(channelTags)(e), (e => (vue.openBlock(), vue.createElementBlock("span", { key: e.label, class: vue.normalizeClass([ "aah-tag", e.cls ]) }, vue.toDisplayString(e.label), 3)))), 128)) ]), e.promoText ? (vue.openBlock(), vue.createElementBlock("p", gc, vue.toDisplayString(e.promoText), 1)) : vue.createCommentVNode("", true), vue.createElementVNode("div", vc, [ e.signupUrl ? (vue.openBlock(), vue.createElementBlock("a", { key: 0, class: "aah-btn aah-btn-small", href: e.signupUrl, target: "_blank", rel: "noopener noreferrer" }, "\u53bb\u9886\u53d6", 8, yc)) : vue.createCommentVNode("", true), vue.createElementVNode("button", { class: "aah-btn aah-btn-primary aah-btn-small", type: "button", onClick: n => (e => { t.addChannel(e), q.value = e, _.value = false; })(e.id) }, "\u6dfb\u52a0", 8, bc) ]) ], 2)))), 128)) ]), I.value.length ? vue.createCommentVNode("", true) : (vue.openBlock(), vue.createElementBlock("p", wc, "\u5168\u90e8\u6e20\u9053\u90fd\u5df2\u6dfb\u52a0\u3002")) ]), vue.createElementVNode("div", xc, [ vue.createElementVNode("button", { class: "aah-btn aah-btn-plain aah-btn-small", type: "button", disabled: vue.unref(t).catalogLoading, onClick: c[15] || (c[15] = e => vue.unref(t).loadCatalog()) }, vue.toDisplayString(vue.unref(t).catalogLoading ? "\u5237\u65b0\u4e2d..." : "\u5237\u65b0\u5217\u8868"), 9, kc), vue.createElementVNode("button", { class: "aah-btn", type: "button", onClick: c[16] || (c[16] = e => _.value = false) }, "\u5173\u95ed") ]) ]) ])) : vue.createCommentVNode("", true), S.value ? (vue.openBlock(), vue.createElementBlock("div", { key: 3, class: "modal-mask", role: "dialog", "aria-modal": "true", "aria-labelledby": "ai-channel-delete-title", onClick: c[20] || (c[20] = vue.withModifiers((e => S.value = null), [ "self" ])) }, [ vue.createElementVNode("div", _c, [ vue.createElementVNode("div", Ac, [ Tc, vue.createElementVNode("button", { class: "aah-btn aah-btn-plain aah-btn-icon", type: "button", "aria-label": "\u5173\u95ed", onClick: c[18] || (c[18] = e => S.value = null) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:close" }) ]) ]), vue.createElementVNode("div", Cc, [ vue.createElementVNode("p", Sc, " \u786e\u5b9a\u8981\u79fb\u9664\u6e20\u9053\u300c" + vue.toDisplayString(S.value.name) + "\u300d\u5417\uff1f\u4fdd\u5b58\u5728\u672c\u5730\u7684 API Key \u4f1a\u4e00\u5e76\u5220\u9664\u3002 ", 1) ]), vue.createElementVNode("div", Ic, [ vue.createElementVNode("button", { class: "aah-btn", type: "button", onClick: c[19] || (c[19] = e => S.value = null) }, "\u53d6\u6d88"), vue.createElementVNode("button", { class: "aah-btn aah-btn-danger", type: "button", onClick: confirmDelete }, "\u79fb\u9664") ]) ]) ])) : vue.createCommentVNode("", true) ]); }; } }), Uc = { class: "settings-rows" }, Pc = { class: "config-item-content" }, Hc = { class: "config-label" }, $c = { class: "label-wrapper" }, Lc = { class: "label-text" }, Mc = { class: "label-desc" }, jc = { class: "config-control" }, Oc = { class: "config-item" }, zc = { class: "config-item-content" }, Fc = vue.createElementVNode("div", { class: "config-label" }, [ vue.createElementVNode("div", { class: "label-wrapper" }, [ vue.createElementVNode("span", { class: "label-text" }, "\u7b54\u9898\u65f6\u542f\u7528 AI"), vue.createElementVNode("span", { class: "label-desc" }, "\u5404\u9898\u5e93\u90fd\u6ca1\u67e5\u5230\u65f6\u8ba9 AI \u4f5c\u7b54\uff0c\u7ed3\u679c\u9700\u8981\u4f60\u786e\u8ba4\u3002\u5148\u5728\u300cAI \u6e20\u9053\u300d\u914d\u597d\u53ef\u7528\u6e20\u9053\u3002") ]) ], -1), Dc = { class: "config-control" }, Nc = { class: "config-item" }, Rc = { class: "config-item-content" }, Bc = vue.createElementVNode("div", { class: "config-label" }, [ vue.createElementVNode("div", { class: "label-wrapper" }, [ vue.createElementVNode("span", { class: "label-text" }, "\u9898\u95f4\u95f4\u9694"), vue.createElementVNode("span", { class: "label-desc" }, "\u4e24\u9898\u4e4b\u95f4\u7b49\u5f85\u7684\u65f6\u95f4\u3002\u95f4\u9694\u592a\u77ed\u5bb9\u6613\u88ab\u5e73\u53f0\u5224\u5b9a\u5f02\u5e38\u3002") ]) ], -1), Gc = { class: "config-control settings-range" }, Kc = [ "min" ], Vc = { class: "num" }, Wc = { key: 0, class: "aah-alert aah-alert-warning" }, Qc = { key: 1, class: "config-item" }, Jc = { class: "config-item-content" }, Yc = vue.createElementVNode("div", { class: "config-label" }, [ vue.createElementVNode("div", { class: "label-wrapper" }, [ vue.createElementVNode("span", { class: "label-text" }, "\u591a\u9009\u9010\u9879\u95f4\u9694"), vue.createElementVNode("span", { class: "label-desc" }, "\u5f53\u524d\u5e73\u53f0\u591a\u9009\u9898\u6bcf\u9009\u4e00\u9879\u90fd\u4f1a\u8bf7\u6c42\u63a5\u53e3\uff0c\u8fc7\u5feb\u5bb9\u6613\u89e6\u53d1 403") ]) ], -1), Xc = { class: "config-control settings-range" }, Zc = [ "min" ], eu = { class: "num" }, tu = vue.defineComponent({ __name: "AskSettings", setup(e) { const t = zn(), s = $n(), l = On(), persist = (e, t) => Cache.set(e, t), setAskGpt = e => { e && msg("\u8bf7\u5148\u5728\u300c\u641c\u9898\u300d\u91cc\u786e\u8ba4 AI \u80fd\u6b63\u5e38\u56de\u7b54\uff0c\u518d\u542f\u7528\u7b54\u9898\u65f6 AI\uff1bAI \u6b63\u786e\u7387\u65e0\u6cd5\u4fdd\u8bc1"), s.app.askGpt = e, l.settings.enabledForAsk = e, l.saveSettings(), s.setConfig({ askGpt: e }), Cache.set("askGpt", e); }, setDelay = () => persist("delay", t.delay), setOptionDelay = () => { t.optionDelay < t.optionMinDelay && (t.optionDelay = t.optionMinDelay), Cache.set("optionDelay", t.optionDelay); const e = t.rule; e && (e.optionDelay = t.optionDelay); }, c = [ { key: "autoAnswer", label: "\u81ea\u52a8\u7b54\u9898", desc: "\u8bc6\u522b\u5230\u9898\u76ee\u540e\u81ea\u52a8\u5f00\u59cb\u67e5\u627e\u5e76\u586b\u5199" }, { key: "autoNext", label: "\u81ea\u52a8\u8df3\u8f6c", desc: "\u7b54\u5b8c\u5f53\u524d\u9898\u540e\u81ea\u52a8\u5207\u5230\u4e0b\u4e00\u9898" }, { key: "skipFinish", label: "\u8df3\u8fc7\u5df2\u4f5c\u7b54", desc: "\u9875\u9762\u4e0a\u5df2\u7ecf\u6709\u7b54\u6848\u7684\u9898\u4e0d\u518d\u586b\u5199" }, { key: "randomAnswer", label: "\u65e0\u7b54\u6848\u65f6\u968f\u673a\u4f5c\u7b54", desc: "\u6240\u6709\u6765\u6e90\u90fd\u6ca1\u67e5\u5230\u65f6\u968f\u673a\u9009\u62e9\u4e00\u4e2a\u9009\u9879" } ]; return (e, l) => (vue.openBlock(), vue.createElementBlock("div", Uc, [ (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(c, (e => vue.createElementVNode("div", { key: e.key, class: "config-item" }, [ vue.createElementVNode("div", Pc, [ vue.createElementVNode("div", Hc, [ vue.createElementVNode("div", $c, [ vue.createElementVNode("span", Lc, vue.toDisplayString(e.label), 1), vue.createElementVNode("span", Mc, vue.toDisplayString(e.desc), 1) ]) ]), vue.createElementVNode("div", jc, [ vue.createVNode(co, { "model-value": vue.unref(t)[e.key], "onUpdate:modelValue": n => { vue.unref(t)[e.key] = n, persist(e.key, n); } }, null, 8, [ "model-value", "onUpdate:modelValue" ]) ]) ]) ]))), 64)), vue.createElementVNode("div", Oc, [ vue.createElementVNode("div", zc, [ Fc, vue.createElementVNode("div", Dc, [ vue.createVNode(co, { "model-value": vue.unref(s).app.askGpt, "onUpdate:modelValue": setAskGpt }, null, 8, [ "model-value" ]) ]) ]) ]), vue.createElementVNode("div", Nc, [ vue.createElementVNode("div", Rc, [ Bc, vue.createElementVNode("div", Gc, [ vue.withDirectives(vue.createElementVNode("input", { "onUpdate:modelValue": l[0] || (l[0] = e => vue.unref(t).delay = e), type: "range", min: vue.unref(t).minDelay, max: "5000", step: "100", class: "aah-slider", "aria-label": "\u9898\u95f4\u95f4\u9694", onInput: setDelay }, null, 40, Kc), [ [ vue.vModelText, vue.unref(t).delay, void 0, { number: true } ] ]), vue.createElementVNode("span", Vc, vue.toDisplayString(vue.unref(t).delay) + "ms", 1) ]) ]) ]), vue.unref(t).minDelay > 0 ? (vue.openBlock(), vue.createElementBlock("div", Wc, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:alert-outline" }), vue.createTextVNode("\u5f53\u524d\u5e73\u53f0\u89c4\u5219\u8981\u6c42\u9898\u95f4\u95f4\u9694\u4e0d\u5c11\u4e8e " + vue.toDisplayString(vue.unref(t).minDelay) + "ms ", 1) ])) : vue.createCommentVNode("", true), vue.unref(t).optionMinDelay > 0 ? (vue.openBlock(), vue.createElementBlock("div", Qc, [ vue.createElementVNode("div", Jc, [ Yc, vue.createElementVNode("div", Xc, [ vue.withDirectives(vue.createElementVNode("input", { "onUpdate:modelValue": l[1] || (l[1] = e => vue.unref(t).optionDelay = e), type: "range", min: vue.unref(t).optionMinDelay, max: "8000", step: "500", class: "aah-slider", "aria-label": "\u591a\u9009\u9010\u9879\u95f4\u9694", onInput: setOptionDelay }, null, 40, Zc), [ [ vue.vModelText, vue.unref(t).optionDelay, void 0, { number: true } ] ]), vue.createElementVNode("span", eu, vue.toDisplayString(vue.unref(t).optionDelay) + "ms", 1) ]) ]) ])) : vue.createCommentVNode("", true) ])); } }), nu = vue.defineComponent({ __name: "ThemeSwitcher", props: { compact: { type: Boolean, default: false } }, setup(e) { const t = e, i = $n(), r = [ { key: "light", label: "\u6d45\u8272" }, { key: "dark", label: "\u6df1\u8272" }, { key: "auto", label: "\u8ddf\u968f\u7cfb\u7edf" } ], o = [ { key: "light", label: "\u6d45" }, { key: "dark", label: "\u6df1" }, { key: "auto", label: "\u7cfb\u7edf" } ], l = vue.computed((() => t.compact ? o : r)), u = vue.computed({ get: () => i.app.theme, set: e => i.setConfig({ theme: e }) }); return (e, t) => (vue.openBlock(), vue.createElementBlock("div", { class: vue.normalizeClass([ "theme-switcher", { "theme-switcher-compact": e.compact } ]) }, [ vue.createVNode(ro, { modelValue: u.value, "onUpdate:modelValue": t[0] || (t[0] = e => u.value = e), segments: l.value }, null, 8, [ "modelValue", "segments" ]) ], 2)); } }), au = "https://www.aiask.site", iu = { account: `${au}/account.html`, register: `${au}/account.html#register`, reset: `${au}/reset.html`, feedback: `${au}/feedback.html` }, su = { class: "user-page" }, ru = { class: "user-page__tabs", role: "tablist", "aria-label": "\u767b\u5f55\u65b9\u5f0f" }, ou = [ "aria-selected" ], lu = [ "aria-selected" ], cu = { class: "user-page__field" }, uu = vue.createElementVNode("span", null, "\u7528\u6237\u540d", -1), pu = { class: "user-page__field" }, du = vue.createElementVNode("span", null, "\u5bc6\u7801", -1), mu = { key: 1, class: "user-page__field" }, hu = vue.createElementVNode("span", null, "API Key", -1), fu = vue.createElementVNode("small", { class: "user-page__helper" }, "\u5bc6\u7801\u767b\u5f55\u540e\u53ef\u5728\u672c\u9875\u300c\u5237\u65b0 API Key\u300d\u53d6\u5f97\uff0c\u6362\u8bbe\u5907\u65f6\u7c98\u8d34\u4f7f\u7528", -1), gu = { class: "user-page__form-actions" }, vu = [ "disabled" ], yu = { class: "user-page__helper" }, bu = { key: 1, class: "settings-rows" }, wu = { class: "config-item" }, xu = { class: "config-item-content" }, ku = { class: "config-label" }, qu = [ "src" ], _u = { class: "label-wrapper" }, Au = { class: "label-text" }, Tu = { class: "label-desc" }, Cu = { class: "config-item" }, Su = { class: "config-item-content" }, Iu = { class: "config-label" }, Eu = { class: "label-wrapper" }, Uu = { class: "label-text" }, Pu = { class: "user-page__score num" }, Hu = vue.createElementVNode("span", { class: "label-desc" }, "\u7528\u4e8e\u5b98\u65b9\u9898\u5e93\u641c\u9898\uff1b\u4f59\u989d\u3001\u5361\u5bc6\u5151\u6362\u4e0e\u6d88\u8d39\u6d41\u6c34\u5728\u5b98\u7f51\u300c\u6211\u7684\u8d26\u6237\u300d", -1), $u = { class: "config-control" }, Lu = { class: "config-item" }, Mu = { class: "config-item-content" }, ju = { class: "config-label" }, Ou = { class: "label-wrapper" }, zu = vue.createElementVNode("span", { class: "label-text" }, "API Key", -1), Fu = vue.createElementVNode("span", { class: "label-desc" }, "\u7528\u4e8e API Key \u767b\u5f55\u548c\u5b98\u65b9\u9898\u5e93\u8bf7\u6c42\u9274\u6743\uff0c\u8bf7\u52ff\u6cc4\u9732\u7ed9\u4ed6\u4eba", -1), Du = { class: "user-page__apikey num" }, Nu = { class: "config-control" }, Ru = [ "disabled" ], Bu = { class: "user-page__tips" }, Gu = vue.defineComponent({ __name: "User", setup(e) { const t = Mn(), l = vue.ref("password"), p = vue.ref({ username: "", password: "" }), d = vue.ref(""), h = vue.ref(false), v = vue.ref(false), w = vue.computed((() => t.isLoggedIn)), k = vue.computed((() => { const e = t.apiKey || ""; return e ? e.length <= 12 ? e : `${e.slice(0, 6)}...${e.slice(-6)}` : "\u672a\u83b7\u53d6"; })), handleLogin = async () => { h.value = true; try { if ("password" === l.value) { if (!p.value.username || !p.value.password) return void msg("\u8bf7\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801", "warning"); const e = await t.loginByPassword(p.value.username, p.value.password); e.success ? (msg(e.message, "success"), p.value = { username: "", password: "" }) : msg(e.message, "error"); } else { if (!d.value) return void msg("\u8bf7\u8f93\u5165 API Key", "warning"); const e = await t.loginByApiKey(d.value.trim()); e.success ? (msg(e.message, "success"), d.value = "") : msg(e.message, "error"); } } finally { h.value = false; } }, handleLogout = async () => { await confirmAction({ title: "\u9000\u51fa\u767b\u5f55\uff1f", message: "\u9000\u51fa\u540e\u5b98\u65b9\u9898\u5e93\u5c06\u4e0d\u80fd\u4f7f\u7528\uff0c\u9700\u8981\u91cd\u65b0\u767b\u5f55\u3002", confirmText: "\u9000\u51fa\u767b\u5f55" }) && (await t.logout(), msg("\u5df2\u9000\u51fa\u767b\u5f55", "success")); }, handleRefreshApiKey = async () => { if (await confirmAction({ title: "\u5237\u65b0 API Key\uff1f", message: "\u65e7 Key \u4f1a\u7acb\u5373\u5931\u6548\uff0c\u5176\u4ed6\u8bbe\u5907\u4e0a\u7528\u65e7 Key \u767b\u5f55\u7684\u811a\u672c\u9700\u8981\u91cd\u65b0\u586b\u5199\u3002", confirmText: "\u5237\u65b0", danger: true })) { v.value = true; try { const e = await t.refreshApiKey(); msg(e.message, e.success ? "success" : "error"); } finally { v.value = false; } } }, openSite = e => { window.open(e, "_blank"); }, switchMethod = e => { l.value = e; }; return vue.onMounted((() => { w.value && t.fetchUserInfo(); })), (e, c) => (vue.openBlock(), vue.createElementBlock("div", su, [ w.value ? (vue.openBlock(), vue.createElementBlock("div", bu, [ vue.createElementVNode("div", wu, [ vue.createElementVNode("div", xu, [ vue.createElementVNode("div", ku, [ vue.unref(t).avatar ? (vue.openBlock(), vue.createElementBlock("img", { key: 0, src: vue.unref(t).avatar, alt: "", class: "user-page__avatar" }, null, 8, qu)) : (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), { key: 1, icon: "mdi:account-circle", class: "user-page__avatar" })), vue.createElementVNode("div", _u, [ vue.createElementVNode("span", Au, vue.toDisplayString(vue.unref(t).nickname), 1), vue.createElementVNode("span", Tu, "@" + vue.toDisplayString(vue.unref(t).username), 1) ]) ]), vue.createElementVNode("div", { class: "config-control" }, [ vue.createElementVNode("button", { class: "aah-btn aah-btn-danger aah-btn-small", type: "button", onClick: handleLogout }, "\u9000\u51fa\u767b\u5f55") ]) ]) ]), vue.createElementVNode("div", Cu, [ vue.createElementVNode("div", Su, [ vue.createElementVNode("div", Iu, [ vue.createElementVNode("div", Eu, [ vue.createElementVNode("span", Uu, [ vue.createTextVNode("\u79ef\u5206 "), vue.createElementVNode("b", Pu, vue.toDisplayString(vue.unref(t).score), 1) ]), Hu ]) ]), vue.createElementVNode("div", $u, [ vue.createElementVNode("button", { class: "aah-btn aah-btn-small", type: "button", onClick: c[7] || (c[7] = e => openSite(vue.unref(iu).account)) }, "\u79ef\u5206\u660e\u7ec6") ]) ]) ]), vue.createElementVNode("div", Lu, [ vue.createElementVNode("div", Mu, [ vue.createElementVNode("div", ju, [ vue.createElementVNode("div", Ou, [ zu, Fu, vue.createElementVNode("code", Du, vue.toDisplayString(k.value), 1) ]) ]), vue.createElementVNode("div", Nu, [ vue.createElementVNode("button", { class: "aah-btn aah-btn-small", type: "button", disabled: v.value, onClick: handleRefreshApiKey }, vue.toDisplayString(v.value ? "\u5237\u65b0\u4e2d\u2026" : "\u5237\u65b0 API Key"), 9, Ru) ]) ]) ]) ])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ vue.createElementVNode("div", ru, [ vue.createElementVNode("button", { type: "button", role: "tab", class: vue.normalizeClass([ "user-page__tab", { "is-active": "password" === l.value } ]), "aria-selected": "password" === l.value, onClick: c[0] || (c[0] = e => switchMethod("password")) }, "\u8d26\u53f7\u5bc6\u7801", 10, ou), vue.createElementVNode("button", { type: "button", role: "tab", class: vue.normalizeClass([ "user-page__tab", { "is-active": "apikey" === l.value } ]), "aria-selected": "apikey" === l.value, onClick: c[1] || (c[1] = e => switchMethod("apikey")) }, "API Key", 10, lu) ]), vue.createElementVNode("form", { class: "user-page__form", onSubmit: vue.withModifiers(handleLogin, [ "prevent" ]) }, [ "password" === l.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ vue.createElementVNode("label", cu, [ uu, vue.withDirectives(vue.createElementVNode("input", { "onUpdate:modelValue": c[2] || (c[2] = e => p.value.username = e), class: "aah-input", type: "text", autocomplete: "username", placeholder: "\u7231\u95ee\u7b54\u8d26\u53f7\u7528\u6237\u540d" }, null, 512), [ [ vue.vModelText, p.value.username ] ]) ]), vue.createElementVNode("label", pu, [ du, vue.withDirectives(vue.createElementVNode("input", { "onUpdate:modelValue": c[3] || (c[3] = e => p.value.password = e), class: "aah-input", type: "password", autocomplete: "current-password", placeholder: "\u5bc6\u7801", onKeyup: vue.withKeys(handleLogin, [ "enter" ]) }, null, 544), [ [ vue.vModelText, p.value.password ] ]) ]) ], 64)) : (vue.openBlock(), vue.createElementBlock("label", mu, [ hu, vue.withDirectives(vue.createElementVNode("input", { "onUpdate:modelValue": c[4] || (c[4] = e => d.value = e), class: "aah-input", type: "text", placeholder: "\u7c98\u8d34 API Key" }, null, 512), [ [ vue.vModelText, d.value ] ]), fu ])), vue.createElementVNode("div", gu, [ vue.createElementVNode("button", { class: "aah-btn aah-btn-primary", type: "submit", disabled: h.value }, vue.toDisplayString(h.value ? "\u767b\u5f55\u4e2d\u2026" : "\u767b\u5f55"), 9, vu), vue.createElementVNode("span", yu, [ vue.createTextVNode(" \u6ca1\u6709\u8d26\u53f7\uff1f"), vue.createElementVNode("button", { class: "user-page__link-btn", type: "button", onClick: c[5] || (c[5] = e => openSite(vue.unref(iu).register)) }, "\u524d\u5f80\u5b98\u7f51\u6ce8\u518c"), vue.createTextVNode(" \xb7 \u5fd8\u8bb0\u5bc6\u7801\uff1f"), vue.createElementVNode("button", { class: "user-page__link-btn", type: "button", onClick: c[6] || (c[6] = e => openSite(vue.unref(iu).reset)) }, "\u5728\u5b98\u7f51\u627e\u56de") ]) ]) ], 32) ], 64)), vue.createElementVNode("p", Bu, [ vue.createTextVNode(" \u9047\u5230\u95ee\u9898\u6216\u60f3\u63d0\u5efa\u8bae\uff0c\u53ef\u5728"), vue.createElementVNode("button", { class: "user-page__link-btn", type: "button", onClick: c[8] || (c[8] = e => openSite(vue.unref(iu).feedback)) }, "\u610f\u89c1\u53cd\u9988"), vue.createTextVNode("\u9875\u767b\u5f55\u540e\u63d0\u4ea4\u3002 ") ]) ])); } }), Ku = { class: "log-page" }, Vu = { class: "log-toolbar" }, Wu = { class: "lib-chips", role: "group", "aria-label": "\u6309\u7ea7\u522b\u7b5b\u9009" }, Qu = [ "aria-pressed", "onClick" ], Ju = { class: "log-count num" }, Yu = vue.createElementVNode("span", { class: "area-foot-spacer" }, null, -1), Xu = [ "disabled" ], Zu = [ "disabled" ], ep = { key: 0, class: "log-list" }, tp = { class: "log-time num" }, np = { class: "log-level" }, ap = vue.createElementVNode("i", { "aria-hidden": "true" }, null, -1), ip = { class: "log-msg" }, sp = { key: 1, class: "log-empty" }, rp = vue.defineComponent({ __name: "Log", setup(e) { const t = $n(), l = [ { key: "all", label: "\u5168\u90e8", tone: "primary" }, { key: "success", label: "\u4fe1\u606f", tone: "success" }, { key: "warning", label: "\u8b66\u544a", tone: "warning" }, { key: "error", label: "\u9519\u8bef", tone: "danger" } ], p = { success: "\u6210\u529f", info: "\u4fe1\u606f", warning: "\u8b66\u544a", error: "\u9519\u8bef" }, h = vue.ref("all"), g = vue.computed((() => "all" === h.value ? t.logs : t.logs.filter((e => e.type === h.value)))), v = vue.computed((() => { var e; return (null == (e = l.find((e => e.key === h.value))) ? void 0 : e.label) || "\u5168\u90e8"; })), y = vue.computed((() => t.logs.length)), exportLogs = () => { const e = new Blob([ JSON.stringify(t.logs, null, 2) ], { type: "application/json" }), n = URL.createObjectURL(e), a = document.createElement("a"); a.href = n, a.download = `aiask-logs-${Date.now()}.json`, a.click(), URL.revokeObjectURL(n); }; return (e, c) => (vue.openBlock(), vue.createElementBlock("div", Ku, [ vue.createElementVNode("div", Vu, [ vue.createElementVNode("div", Wu, [ (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(l, (e => vue.createElementVNode("button", { key: e.key, type: "button", class: vue.normalizeClass([ "lib-chip", { "is-on": h.value === e.key } ]), "aria-pressed": h.value === e.key, onClick: t => h.value = e.key }, vue.toDisplayString(e.label), 11, Qu))), 64)) ]), vue.createElementVNode("span", Ju, "\u5171 " + vue.toDisplayString(y.value) + " \u6761", 1), Yu, vue.createElementVNode("button", { class: "aah-btn aah-btn-small", type: "button", disabled: !y.value, onClick: exportLogs }, "\u5bfc\u51fa", 8, Xu), vue.createElementVNode("button", { class: "aah-btn aah-btn-small", type: "button", disabled: !y.value, onClick: c[0] || (c[0] = e => vue.unref(t).logs = []) }, "\u6e05\u7a7a", 8, Zu) ]), g.value.length ? (vue.openBlock(), vue.createElementBlock("ol", ep, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(g.value, ((e, t) => (vue.openBlock(), vue.createElementBlock("li", { key: t, class: vue.normalizeClass([ "log-row", `log-row-${e.type}` ]) }, [ vue.createElementVNode("span", tp, vue.toDisplayString(e.time), 1), vue.createElementVNode("span", np, [ ap, vue.createTextVNode(vue.toDisplayString(p[e.type] ?? e.type), 1) ]), vue.createElementVNode("span", ip, vue.toDisplayString(e.content), 1) ], 2)))), 128)) ])) : (vue.openBlock(), vue.createElementBlock("p", sp, vue.toDisplayString("all" === h.value ? "\u8fd8\u6ca1\u6709\u65e5\u5fd7" : `\u6ca1\u6709\u300c${v.value}\u300d\u7ea7\u522b\u7684\u65e5\u5fd7`), 1)) ])); } }), op = { class: "settings-nav scroll", "aria-label": "\u8bbe\u7f6e\u5206\u8282" }, lp = { class: "lib-search settings-search" }, cp = [ "aria-current", "onClick" ], up = { key: 0, class: "settings-nav-empty" }, pp = { class: "settings-pane scroll" }, dp = { class: "settings-pane-head" }, mp = { key: 0 }, hp = vue.createElementVNode("h3", { class: "aah-section-title settings-group-title" }, "\u5916\u89c2", -1), fp = { class: "settings-rows" }, gp = { class: "config-item" }, vp = { class: "config-item-content" }, yp = vue.createElementVNode("div", { class: "config-label" }, [ vue.createElementVNode("div", { class: "label-wrapper" }, [ vue.createElementVNode("span", { class: "label-text" }, "\u4e3b\u9898"), vue.createElementVNode("span", { class: "label-desc" }, "\u4e5f\u53ef\u4ee5\u70b9\u9762\u677f\u53f3\u4e0a\u89d2\u7684\u4e3b\u9898\u6309\u94ae\u5207\u6362") ]) ], -1), bp = { class: "config-control" }, wp = { class: "config-item" }, xp = { class: "config-item-content" }, kp = vue.createElementVNode("div", { class: "config-label" }, [ vue.createElementVNode("div", { class: "label-wrapper" }, [ vue.createElementVNode("span", { class: "label-text" }, "\u9762\u677f\u5bbd\u5ea6"), vue.createElementVNode("span", { class: "label-desc" }, "720px \u4ee5\u4e0a\u5de6\u53f3\u5206\u680f\u663e\u793a\uff1b\u4e5f\u53ef\u4ee5\u62d6\u9762\u677f\u53f3\u4e0b\u89d2\u8c03\u6574") ]) ], -1), qp = { class: "config-control settings-range" }, _p = [ "value" ], Ap = { class: "num" }, Tp = vue.createElementVNode("h3", { class: "aah-section-title settings-group-title" }, "\u5feb\u6377\u952e", -1), Cp = { class: "settings-rows" }, Sp = vue.createElementVNode("h3", { class: "aah-section-title settings-group-title" }, "\u8fd0\u884c", -1), Ip = { class: "settings-rows" }, Ep = vue.createElementVNode("h3", { class: "aah-section-title settings-group-title" }, "\u672c\u5730\u6570\u636e", -1), Up = { class: "settings-rows" }, Pp = { class: "config-item" }, Hp = { class: "config-item-content" }, $p = { class: "config-label" }, Lp = { class: "label-wrapper" }, Mp = vue.createElementVNode("span", { class: "label-text" }, "\u6e05\u7a7a\u672c\u5730\u9898\u5e93", -1), jp = { class: "label-desc" }, Op = { class: "num" }, zp = { class: "config-control" }, Fp = [ "disabled" ], Dp = { class: "settings-rows" }, Np = { class: "config-item" }, Rp = { class: "config-item-content" }, Bp = { class: "config-label" }, Gp = { class: "label-wrapper" }, Kp = { class: "label-text" }, Vp = { class: "num" }, Wp = vue.createElementVNode("span", { class: "label-desc" }, "\u624b\u52a8\u68c0\u67e5\u4e0d\u53d7\u4e0b\u9762\u5f00\u5173\u548c\u51b7\u5374\u65f6\u95f4\u9650\u5236", -1), Qp = { class: "config-control" }, Jp = [ "disabled" ], Yp = vue.createElementVNode("h3", { class: "aah-section-title settings-group-title" }, "\u5f53\u524d\u516c\u544a", -1), Xp = [ "innerHTML" ], Zp = { key: 1, class: "ask-source-empty" }, ed = vue.createElementVNode("h3", { class: "aah-section-title settings-group-title" }, "\u8fd0\u884c\u65e5\u5fd7", -1), td = vue.defineComponent({ __name: "Settings", setup(e) { const t = $n(), l = Mn(), y = useLibraryCount(), w = [ { id: "ask", label: "\u7b54\u9898", icon: "mdi:play-circle-outline", keywords: "\u81ea\u52a8\u7b54\u9898 \u81ea\u52a8\u8df3\u8f6c \u8df3\u8fc7\u5df2\u4f5c\u7b54 \u968f\u673a \u95f4\u9694 \u5ef6\u65f6 \u591a\u9009 ai \u8f85\u52a9", configKeys: [] }, { id: "ai", label: "AI \u6e20\u9053", icon: "mdi:creation-outline", keywords: "ai \u6a21\u578b \u5e73\u53f0 api key base url \u51ed\u8bc1 \u6e20\u9053 \u6d4b\u8bd5\u8fde\u63a5", configKeys: [] }, { id: "account", label: "\u8d26\u53f7", icon: "mdi:account-circle-outline", keywords: "\u767b\u5f55 \u6ce8\u518c \u79ef\u5206 api key \u9000\u51fa", configKeys: [] }, { id: "general", label: "\u901a\u7528", icon: "mdi:tune-variant", keywords: "\u5916\u89c2 \u4e3b\u9898 \u6df1\u8272 \u6d45\u8272 \u5bbd\u5ea6 \u60ac\u6d6e \u6c14\u6ce1 \u5f3a\u5236\u9690\u85cf \u5feb\u6377\u952e \u70ed\u952e iframe \u6e05\u9664 \u6e05\u7a7a \u7f13\u5b58 \u9898\u5e93 \u6570\u636e", configKeys: [ "display", "hotkey", "system" ] }, { id: "about", label: "\u5173\u4e8e", icon: "mdi:information-outline", keywords: "\u7248\u672c \u66f4\u65b0 \u516c\u544a \u65e5\u5fd7 \u8fd0\u884c \u5bfc\u51fa", configKeys: [] } ], k = { ask: "\u4fee\u6539\u540e\u7acb\u5373\u751f\u6548\uff0c\u5bf9\u5f53\u524d\u9875\u9762\u7684\u7b54\u9898\u4e5f\u8d77\u4f5c\u7528\u3002", ai: "\u641c\u9898\u548c\u7b54\u9898\u65f6 AI \u7528\u5230\u7684\u6e20\u9053\u4e0e\u51ed\u8bc1\u3002", account: "\u767b\u5f55\u540e\u53ef\u67e5\u8be2\u5b98\u65b9\u9898\u5e93\u3001\u540c\u6b65\u79ef\u5206\u3002", general: "\u9762\u677f\u5916\u89c2\u3001\u5feb\u6377\u952e\u4e0e\u672c\u5730\u6570\u636e\u3002", about: "" }, q = new Set([ "checkUpdate" ]), isSection = e => w.some((t => t.id === e)), _ = vue.computed((() => isSection(t.subPage) ? t.subPage : "ask")), A = vue.ref(isSection(t.subPage)), T = vue.ref(""), normalized = e => e.toLowerCase().replace(/\s+/g, ""), C = vue.computed((() => { const e = normalized(T.value); return e ? w.filter((n => { const a = n.configKeys.flatMap((e => t.ConfigInput[e] || [])); return normalized(n.label + n.keywords).includes(e) || a.some((t => normalized(`${t.label}${t.desc ?? ""}`).includes(e))); })) : w; })), S = vue.computed((() => w.find((e => e.id === _.value)))), I = vue.ref(null), startRecording = e => { I.value = e; }, handleHotkeyKeydown = (e, t) => { if (e.preventDefault(), e.stopPropagation(), [ "Control", "Shift", "Alt", "Meta" ].includes(e.key)) return; const n = []; e.ctrlKey && n.push("Ctrl"), e.shiftKey && n.push("Shift"), e.altKey && n.push("Alt"); let a = e.key; a = " " === a ? "Space" : e.code.startsWith("Key") ? e.code.replace("Key", "") : e.code.startsWith("Digit") ? e.code.replace("Digit", "") : e.code.startsWith("Arrow") ? e.code : e.key.toUpperCase(), n.push(a); const i = n.join("+"); t.value = i, I.value = null, msg(`\u5feb\u6377\u952e\u5df2\u8bbe\u7f6e\u4e3a: ${i}`, "success"); }; vue.watch(t.ConfigInput, (e => { for (const n in e) for (const a in e[n]) { const i = e[n][a]; t.app[i.name] = i.value; } t.setConfig(t.app), msg("\u914d\u7f6e\u4fee\u6539\u6210\u529f", "success"); })); const configGroup = e => t.ConfigInput[e] || [], E = vue.computed((() => configGroup("system").filter((e => !q.has(e.name))))), U = vue.computed((() => configGroup("system").filter((e => q.has(e.name))))), previewWidth = e => { t.app.dialogWidth = Number(e.target.value); }, commitWidth = e => t.setDialogWidth(Number(e.target.value)), clearCache = async () => { await confirmAction({ title: "\u6e05\u7a7a\u672c\u5730\u9898\u5e93\uff1f", message: `\u5171 ${y.value} \u9898\uff0c\u6e05\u7a7a\u540e\u65e0\u6cd5\u6062\u590d\u3002\u5efa\u8bae\u5148\u5728\u300c\u9898\u5e93 \u2192 \u5bfc\u51fa\u300d\u5907\u4efd\u3002`, confirmText: "\u6e05\u7a7a", danger: true }) && (Cache.matchRemove("ques1_"), msg("\u6e05\u9664\u6210\u529f", "success"), refreshLibraryCount()); }, P = vue.computed((() => l.notice ? M.sanitize(l.notice) : "")), $ = vue.ref(false), checkUpdate = async () => { $.value = true; try { await updateFn(!1); } finally { $.value = false; } }; return (e, l) => (vue.openBlock(), vue.createElementBlock("div", { class: vue.normalizeClass([ "area settings-area", { "is-drilled": A.value } ]) }, [ vue.createElementVNode("nav", op, [ vue.createElementVNode("label", lp, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:magnify" }), vue.withDirectives(vue.createElementVNode("input", { "onUpdate:modelValue": l[0] || (l[0] = e => T.value = e), type: "search", placeholder: "\u641c\u7d22\u8bbe\u7f6e", "aria-label": "\u641c\u7d22\u8bbe\u7f6e" }, null, 512), [ [ vue.vModelText, T.value ] ]) ]), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(C.value, (e => (vue.openBlock(), vue.createElementBlock("button", { key: e.id, type: "button", class: vue.normalizeClass([ "settings-nav-item", { "is-active": e.id === _.value } ]), "aria-current": e.id === _.value ? "page" : void 0, onClick: n => { return a = e.id, t.setPage("settings", a), A.value = true, void (T.value = ""); var a; } }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: e.icon }, null, 8, [ "icon" ]), vue.createElementVNode("span", null, vue.toDisplayString(e.label), 1), vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:chevron-right", class: "settings-nav-chevron" }) ], 10, cp)))), 128)), C.value.length ? vue.createCommentVNode("", true) : (vue.openBlock(), vue.createElementBlock("p", up, "\u6ca1\u6709\u627e\u5230\u300c" + vue.toDisplayString(T.value) + "\u300d\u76f8\u5173\u7684\u8bbe\u7f6e", 1)) ]), vue.createElementVNode("main", pp, [ vue.createElementVNode("button", { type: "button", class: "aah-btn aah-btn-plain aah-btn-small settings-back", onClick: l[1] || (l[1] = e => A.value = false) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:arrow-left" }), vue.createTextVNode("\u5168\u90e8\u8bbe\u7f6e ") ]), vue.createElementVNode("header", dp, [ vue.createElementVNode("h2", null, vue.toDisplayString(S.value.label), 1), k[_.value] ? (vue.openBlock(), vue.createElementBlock("p", mp, vue.toDisplayString(k[_.value]), 1)) : vue.createCommentVNode("", true) ]), "ask" === _.value ? (vue.openBlock(), vue.createBlock(tu, { key: 0 })) : "ai" === _.value ? (vue.openBlock(), vue.createBlock(Ec, { key: 1 })) : "account" === _.value ? (vue.openBlock(), vue.createBlock(Gu, { key: 2 })) : "general" === _.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [ hp, vue.createElementVNode("div", fp, [ vue.createElementVNode("div", gp, [ vue.createElementVNode("div", vp, [ yp, vue.createElementVNode("div", bp, [ vue.createVNode(nu) ]) ]) ]), vue.createElementVNode("div", wp, [ vue.createElementVNode("div", xp, [ kp, vue.createElementVNode("div", qp, [ vue.createElementVNode("input", { type: "range", min: "480", max: "1200", step: "10", class: "aah-slider", value: vue.unref(t).app.dialogWidth, "aria-label": "\u9762\u677f\u5bbd\u5ea6", onInput: previewWidth, onChange: commitWidth }, null, 40, _p), vue.createElementVNode("span", Ap, vue.toDisplayString(vue.unref(t).app.dialogWidth) + "px", 1) ]) ]) ]), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(configGroup("display"), ((e, t) => (vue.openBlock(), vue.createBlock(So, { key: `display-${t}`, item: e }, null, 8, [ "item" ])))), 128)) ]), Tp, vue.createElementVNode("div", Cp, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(configGroup("hotkey"), ((e, t) => (vue.openBlock(), vue.createBlock(So, { key: `hotkey-${t}`, item: e, "recording-hotkey": I.value, onStartRecording: startRecording, onHotkeyKeydown: handleHotkeyKeydown }, null, 8, [ "item", "recording-hotkey" ])))), 128)) ]), E.value.length ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ Sp, vue.createElementVNode("div", Ip, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(E.value, ((e, t) => (vue.openBlock(), vue.createBlock(So, { key: `runtime-${t}`, item: e }, null, 8, [ "item" ])))), 128)) ]) ], 64)) : vue.createCommentVNode("", true), Ep, vue.createElementVNode("div", Up, [ vue.createElementVNode("div", Pp, [ vue.createElementVNode("div", Hp, [ vue.createElementVNode("div", $p, [ vue.createElementVNode("div", Lp, [ Mp, vue.createElementVNode("span", jp, [ vue.createTextVNode("\u5f53\u524d\u5171 "), vue.createElementVNode("b", Op, vue.toDisplayString(vue.unref(y).toLocaleString()), 1), vue.createTextVNode(" \u9898\uff0c\u4fdd\u5b58\u5728\u8fd9\u4e2a\u6d4f\u89c8\u5668\u91cc\u3002\u6e05\u7a7a\u540e\u65e0\u6cd5\u6062\u590d\uff0c\u6362\u6d4f\u89c8\u5668\u6216\u6e05\u7a7a\u524d\u5148\u5728\u300c\u9898\u5e93 \u2192 \u5bfc\u51fa\u300d\u5907\u4efd\u3002") ]) ]) ]), vue.createElementVNode("div", zp, [ vue.createElementVNode("button", { type: "button", class: "aah-btn aah-btn-danger", disabled: !vue.unref(y), onClick: clearCache }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:trash-can-outline" }), vue.createTextVNode("\u6e05\u7a7a ") ], 8, Fp) ]) ]) ]) ]) ], 64)) : "about" === _.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 4 }, [ vue.createElementVNode("div", Dp, [ vue.createElementVNode("div", Np, [ vue.createElementVNode("div", Rp, [ vue.createElementVNode("div", Bp, [ vue.createElementVNode("div", Gp, [ vue.createElementVNode("span", Kp, [ vue.createTextVNode(vue.toDisplayString(vue.unref(Ve).script.name) + " ", 1), vue.createElementVNode("span", Vp, "v" + vue.toDisplayString(vue.unref(Ve).script.version), 1) ]), Wp ]) ]), vue.createElementVNode("div", Qp, [ vue.createElementVNode("button", { type: "button", class: "aah-btn", disabled: $.value, onClick: checkUpdate }, vue.toDisplayString($.value ? "\u68c0\u67e5\u4e2d\u2026" : "\u68c0\u67e5\u66f4\u65b0"), 9, Jp) ]) ]) ]), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(U.value, ((e, t) => (vue.openBlock(), vue.createBlock(So, { key: `update-${t}`, item: e }, null, 8, [ "item" ])))), 128)) ]), Yp, P.value ? (vue.openBlock(), vue.createElementBlock("div", { key: 0, class: "settings-notice-body", innerHTML: P.value }, null, 8, Xp)) : (vue.openBlock(), vue.createElementBlock("p", Zp, "\u6682\u65e0\u516c\u544a")), ed, vue.createVNode(rp) ], 64)) : vue.createCommentVNode("", true) ]) ], 2)); } }); const nd = { class: "notice-row" }, ad = { class: "notice-text" }, id = [ "aria-expanded" ], sd = [ "innerHTML" ], rd = vue.defineComponent({ __name: "NoticeBar", setup(e) { const t = Mn(), r = vue.ref(false), l = vue.ref(Cache.get("noticeDismissed", "")), p = vue.computed((() => t.notice ? M.sanitize(t.notice) : "")), d = vue.computed((() => { const e = document.createElement("div"); return e.innerHTML = p.value, (e.textContent || "").replace(/\s+/g, " ").trim(); })), f = vue.computed((() => d.value ? function(e) { let t = 2166136261; for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619); return (t >>> 0).toString(16); }(d.value) : "")), g = vue.computed((() => !!f.value && f.value !== l.value)), dismiss = () => { l.value = f.value, Cache.set("noticeDismissed", f.value), r.value = false; }; return vue.onMounted((async () => { const e = await t.fetchNotice(); !e.success && e.message && addLog(`\u516c\u544a\u62c9\u53d6\u5931\u8d25\uff1a${e.message}`, "warning"); })), (e, t) => g.value ? (vue.openBlock(), vue.createElementBlock("div", { key: 0, class: vue.normalizeClass([ "notice-bar", { "is-expanded": r.value } ]) }, [ vue.createElementVNode("div", nd, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:bullhorn-outline", class: "notice-icon" }), vue.createElementVNode("span", ad, vue.toDisplayString(d.value), 1), vue.createElementVNode("button", { type: "button", class: "aah-btn aah-btn-plain aah-btn-small", "aria-expanded": r.value, onClick: t[0] || (t[0] = e => r.value = !r.value) }, vue.toDisplayString(r.value ? "\u6536\u8d77" : "\u67e5\u770b"), 9, id), vue.createElementVNode("button", { type: "button", class: "aah-btn aah-btn-plain aah-btn-small aah-btn-icon", "aria-label": "\u5173\u95ed\u516c\u544a", title: "\u5173\u95ed\u540e\u540c\u4e00\u6761\u516c\u544a\u4e0d\u518d\u663e\u793a", onClick: dismiss }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:close" }) ]) ]), r.value ? (vue.openBlock(), vue.createElementBlock("div", { key: 0, class: "notice-full custom-scroll", innerHTML: p.value }, null, 8, sd)) : vue.createCommentVNode("", true) ], 2)) : vue.createCommentVNode("", true); } }), od = { class: "mini-ball-dock" }, ld = { key: 0 }, cd = [ "aria-label" ], ud = [ "src" ], pd = { key: 0, class: "mini-ball-value num" }, dd = { key: 1, class: "mini-ball-badge num" }, md = vue.defineComponent({ __name: "MiniBall", setup(e) { const t = $n(), r = zn(), l = useAskOverview(), u = vue.computed((() => r.questionList.length)), p = vue.computed((() => u.value - l.value.tally.todo)), d = vue.computed((() => u.value ? Math.round(p.value / u.value * 100) : 0)), h = vue.computed((() => l.value.tally.none + l.value.tally.wait)), g = vue.computed((() => r.questionList.findIndex((e => Array.isArray(e.answer) && e.answer.some((e => null == e ? void 0 : e.needLogin)))))), y = vue.computed((() => { const {firstWait: e, firstNone: n, tally: a} = l.value; if (e >= 0) return { title: `\u7b2c ${e + 1} \u9898 AI \u5efa\u8bae\u5f85\u786e\u8ba4`, detail: "\u786e\u8ba4\u540e\u624d\u4f1a\u586b\u5165\u9875\u9762\uff0c\u70b9\u6b64\u67e5\u770b", index: e }; if (n >= 0) { return { title: `\u7b2c ${n + 1} \u9898\u65e0\u7b54\u6848`, detail: `\u5404\u6765\u6e90\u90fd\u6ca1\u67e5\u5230${a.none > 1 ? `\uff0c\u5171 ${a.none} \u9898\u65e0\u7b54\u6848` : ""}\uff0c\u70b9\u6b64\u67e5\u770b`, index: n }; } return g.value >= 0 ? { title: "\u5b98\u65b9\u9898\u5e93\u9700\u8981\u767b\u5f55", detail: "\u767b\u5f55\u540e\u53ef\u67e5\u8be2\u66f4\u591a\u9898\u76ee\uff0c\u70b9\u6b64\u5904\u7406", index: g.value } : t.app.alert ? { title: t.app.alert, detail: "", index: -1 } : null; })), expand = (e = -1) => { t.app.showFloat = true, e >= 0 && (t.closeSearch(), t.setPage("ask"), r.toQuestion(e)); }; return (e, l) => (vue.openBlock(), vue.createElementBlock("div", od, [ y.value && vue.unref(t).app.alertBubble ? (vue.openBlock(), vue.createElementBlock("button", { key: 0, type: "button", class: "mini-bubble", onClick: l[0] || (l[0] = e => expand(y.value.index)) }, [ vue.createElementVNode("strong", null, vue.toDisplayString(y.value.title), 1), y.value.detail ? (vue.openBlock(), vue.createElementBlock("span", ld, vue.toDisplayString(y.value.detail), 1)) : vue.createCommentVNode("", true) ])) : vue.createCommentVNode("", true), vue.createElementVNode("button", { type: "button", class: vue.normalizeClass([ "mini-ball", { "has-progress": u.value > 0, "is-running": vue.unref(r).start } ]), style: vue.normalizeStyle({ "--p": d.value }), "aria-label": u.value ? `\u5c55\u5f00\u9762\u677f\uff0c\u5df2\u7b54 ${p.value}/${u.value}` : "\u5c55\u5f00\u9762\u677f", onClick: l[1] || (l[1] = e => expand()) }, [ vue.createElementVNode("img", { src: vue.unref("data:image/svg+xml,%3csvg%20class='icon'%20viewBox='0%200%201024%201024'%20xmlns='http://www.w3.org/2000/svg'%20width='200'%20height='200'%3e%3cpath%20d='m253.36%201024-115.278-58.836v-53.206c-64.889-68.266-62.918-94.729%2014.075-153.424-23.506-17.594-63.762%202.675-77.275-36.315%2047.435-42.93%2070.378-101.063%2087.973-162.01a326.695%20326.695%200%200%201%20208.037-226.617c4.645-89.38%2086.847-143.43%20178.479-112.605l-35.612%2090.365c105.145%207.32%20192.414%2045.042%20256.317%20123.303%2040.538%2015.483%2038.849-34.767%2069.252-40.82l11.964%2058.273%2050.391-27.306c28.151%2018.72-5.208%2031.951-10.416%2052.22%2014.78%2020.128%2028.996%2040.538%2044.479%2060.244a142.867%20142.867%200%200%201%2028.996%20114.153c-12.528%2077.838-30.263%20154.831-41.101%20233.092A1276.939%201276.939%200%200%200%20918.433%201024H897.32l-89.24-70.378%209.994-10.416-17.735%2036.878-68.408-20.128-39.411%2023.788-42.227-21.114c-28.151%2014.076-52.502%2036.034-86.565%2027.307l-9.009-37.863H332.747L306.144%201024zm-9.993-380.041-.844.985%20126.68%2019.706%2010.838%2010.979c-29.277%2032.374-19.846%2074.178-29.7%20110.493l34.064%2030.263-35.19%2094.87a412.274%20412.274%200%200%200%20233.515%202.11l9.712-26.602%2012.809%2015.905-11.824%2050.672%205.35%204.645c16.749-11.682%2033.218-24.21%2050.812-34.626a84.454%2084.454%200%200%201%2026.04-5.348l7.46%2033.922%2048.842-23.788%2052.925%2014.076c-1.83-43.212-2.956-80.935-5.912-118.517%200-4.926-9.853-9.29-15.061-14.075l-5.63-23.225%2014.075-100.922h18.72l3.238-1.267c-11.964%20106.412%208.023%20202.266%2087.128%20281.512%208.727-48.842%2016.61-93.321%2024.632-137.66%207.46-40.96%2015.061-81.92%2022.521-122.88%2010.557-48.42%2025.477-97.262-10.979-140.755l-30.825%2038.004c0-16.469%201.126-33.078%201.126-49.546%200-70.378-53.206-104.723-115.983-76.29a232.951%20232.951%200%200%201-32.937%209.43c16.046-32.373-3.519-52.924-25.477-70.377a292.21%20292.21%200%200%200-209.304-70.378c-11.401.703-22.802%200-40.256%200l45.183-104.582c-40.397%2010.979-74.038%2014.78-94.73%2045.464s14.92%2045.886%2020.833%2069.674c-110.212%204.364-202.69%2080.513-236.611%20193.117l-70.378%20172.708%2049.124%203.519%205.63%2054.191c32.514-26.04%2026.04-61.088%2030.262-92.899h17.876v58.414l30.967%206.334c1.407-6.616%202.393-11.683%203.66-16.469%209.148-34.626-19.706-59.117-22.38-91.491zm-37.863%20178.9-6.475%2020.833-25.336%2084.453c1.548%208.868%200%2023.225%205.067%2025.477%2032.374%2016.046%2065.733%2029.277%20104.16%2045.746%2021.113-65.452%2063.621-114.435%2069.533-180.872-37.3-16.187-70.941-31.53-104.722-44.338-17.032-6.756-36.315-10.979-35.049%2019.002zm121.754-38.848%2010.556-90.225-48.138-6.193v78.964zm-168.907%2096.98%2023.084-73.474c-28.152-10.416-47.576-9.29-56.303%2015.483s2.674%2042.79%2032.937%2057.992z'%20fill='%23353947'/%3e%3cpath%20d='M198.607%20548.948c33.922-112.604%20126.68-188.472%20235.907-192.272-5.912-23.788-41.1-39.553-20.832-69.674s54.332-34.486%2094.729-45.465L463.228%20346.12h40.256a292.21%20292.21%200%200%201%20209.304%2070.378c21.958%2017.735%2042.227%2038.286%2025.477%2070.378l.986-.985c-30.967%2026.743-32.797%2059.399-19.847%2095.15L744.599%20622l-40.819-6.192-103.174-14.076-62.214-93.04-31.67%2050.672c-19.425-5.63-26.603.845-20.691%2020.692l-21.536-.845a165.67%20165.67%200%200%200-100.078-17.172l-10.416-86.565-37.44%2031.248-44.339%2042.226zm255.19-62.917-10.556-10.557c-17.173-17.032-35.049-15.061-47.294%203.378s-4.786%2036.737%2012.105%2050.25c20.128%2016.046%2034.907%209.712%2045.745-11.542%2014.217-10.838%2015.202-21.395%200-31.811z'%20fill='%23F5F5F6'%20data-spm-anchor-id='a313x.search_index.0.i5.dc0f3a810XA6r8'%20class='selected'/%3e%3cpath%20d='m592.442%20886.763-9.712%2026.603a412.274%20412.274%200%200%201-233.514-2.112l35.189-94.87-34.063-30.543c9.853-36.315%200-78.12%2029.7-110.494a198.184%20198.184%200%200%200%20105.425-94.87c16.328%202.394%2026.04-1.688%2020.692-20.69l31.67-4.927%2063.058%2078.542c0%207.882-1.97%2018.017%201.971%2023.084%2030.966%2038.708%2023.788%2080.935%2014.076%20123.865-8.587%2036.034-16.469%2071.364-24.492%20106.412zm-149.624-223.24c0%2014.076-2.815%2023.648%200%2026.885%2020.27%2020.691%2020.832%2045.605%2019.566%2071.927a96.84%2096.84%200%200%200%203.237%2031.107c5.912%2020.41%2012.668%2041.382%2038.426%2044.056a48.56%2048.56%200%200%200%2053.347-35.189%20696.602%20696.602%200%200%200%2018.58-80.371c6.052-6.475%2035.47-2.534%2018.157-36.597z'%20fill='%23F5F5F6'/%3e%3cpath%20d='M600.606%20602.013%20703.78%20616.09l40.82%205.349c37.863%209.993%2022.943%2041.241%2026.461%2065.17L756.986%20787.53l-49.828%2078.12-21.395%2031.529-10.134%2021.395a84.454%2084.454%200%200%200-26.04%205.348c-17.594%2010.416-34.063%2022.944-50.813%2034.626v-5.208h-5.067l11.823-50.672c16.047-61.932%2032.937-123.724%2047.717-185.938%205.348-22.662-25.477-68.267-51.94-82.624zM927.3%20706.736c-7.46%2040.96-15.061%2081.92-22.521%20122.88-8.023%2044.338-15.906%2088.817-24.633%20137.66-79.105-79.387-98.529-175.242-87.128-281.513z'%20fill='%23B3DCF8'/%3e%3cpath%20d='m199.029%20843.692%206.475-20.832h45.605c2.111-39.271-20.973-30.263-38.427-30.122-1.548-29.981%2018.017-25.758%2035.049-18.58%2034.063%2013.231%2067.422%2028.151%20104.722%2044.479-5.912%2066.437-48.42%20115.42-69.533%20180.871-38.427-16.186-71.927-29.418-104.16-45.182-4.786-2.252-3.519-16.61-5.067-25.477h33.5l26.321-70.378z'%20fill='%2387BC85'/%3e%3cpath%20d='M738.265%20486.03a232.951%20232.951%200%200%200%2032.937-9.43c62.777-28.151%20116.405%206.615%20115.983%2076.29%200%2016.468-.704%2033.077-1.126%2049.546l1.126-.986-12.105-2.674-21.536%2016.75-29.98%208.305a86.565%2086.565%200%200%201-91.633-59.259c2.393-26.462%204.645-52.924%207.038-79.527zm113.731%2061.792-61.37-52.502c-3.94%2035.752-6.615%2059.822-10.275%2093.18z'%20fill='%23F5F5F6'%20data-spm-anchor-id='a313x.search_index.0.i3.dc0f3a810XA6r8'/%3e%3cpath%20d='M198.607%20548.948h73.615c-28.151%2042.227-74.178%2076.853-59.117%20137.66-4.223%2031.81%202.252%2066.859-30.263%2092.899l-6.052-54.473-49.124-3.519z'%20fill='%23AED4EF'/%3e%3cpath%20d='m927.3%20706.736-134.28-21.113-3.238%201.266%206.897-37.863%2027.025-7.742%2031.248-8.867%2029.84-20.691%202.393-10.276-.422.986%2030.262-36.738c35.752%2043.776%2020.832%2092.618%2010.276%20141.038zm-557.675-42.79-126.68-19.706a171.3%20171.3%200%200%201%2016.75-41.1c21.817-29.278%2046.168-56.303%2069.533-84.454%203.238%209.15%206.757%2018.157%209.572%2027.307q15.624%2049.123%2030.966%2098.529z'%20fill='%23F5F5F6'/%3e%3cpath%20d='M763.18%20810.473c5.207%204.645%2014.075%209.009%2015.06%2014.076%202.956%2037.582%204.082%2075.304%205.912%20118.516l-52.925-14.075-47.997%2023.787-7.601-34.766c14.075-1.97%2020.55-7.883%2010.979-21.817%2021.395%2011.682%2023.788-9.994%2033.359-19.003z'%20fill='%23AED4EF'/%3e%3cpath%20d='M601.169%20634.106c26.462%2014.075%2057.288%2059.962%2051.939%2082.624-14.076%2062.214-31.67%20124.006-47.716%20185.938l-12.95-15.905c8.023-35.33%2015.905-70.378%2024.35-105.99%2010.135-42.93%2017.314-85.157-14.075-123.865-3.519-4.785-.985-14.92-1.548-22.802zM328.806%20518.404c-23.365%2028.152-47.716%2055.458-69.533%2084.454a171.3%20171.3%200%200%200-16.75%2041.1l.844-.985-12.386%2043.072h-17.876c-15.061-60.385%2030.403-94.87%2059.117-137.097l44.338-42.226z'%20fill='%23484F5E'/%3e%3cpath%20d='m327.258%20784.011-37.582-17.454v-78.964l48.138%206.193z'%20fill='%23D55375'/%3e%3cpath%20d='m823.704%20641.284-27.025%207.742-6.897%2037.863h-18.72c-3.52-23.928%2011.4-55.176-26.463-65.17l-25.195-40.96%2012.527-16.187a86.565%2086.565%200%200%200%2091.35%2059.259zm-454.079%2022.662V644.1l12.246-12.95c8.445%201.267%2020.41%206.897%2024.773%203.237%2020.55-17.031%2038.99-36.455%2058.132-55.176l20.973%201.548a198.184%20198.184%200%200%201-105.708%2094.87z'%20fill='%23484F5E'/%3e%3cpath%20d='m199.029%20843.692%2034.485%2014.075-26.321%2070.378h-33.5z'%20fill='%23CAE7AF'/%3e%3cpath%20d='m230.98%20686.326%2012.387-43.071c2.675%2031.67%2031.53%2056.302%2022.24%2091.35-1.267%204.786-2.252%209.854-3.66%2016.47l-30.966-6.335z'%20fill='%23F5F5F6'/%3e%3cpath%20d='m763.18%20810.473-44.058%2067.704-11.964-12.528%2050.39-78.4z'%20fill='%23484F5E'/%3e%3cpath%20d='M212.682%20792.738c17.454%200%2040.538-9.15%2038.427%2030.122h-45.605z'%20fill='%23CDEAB1'/%3e%3cpath%20d='m598.917%20957.985-5.349-4.645h5.067z'%20fill='%23484F5E'/%3e%3cpath%20d='M464.495%20579.211c-19.143%2018.72-37.582%2038.145-58.132%2055.176-4.364%203.66-16.328-1.97-24.773-3.237l-17.173-69.111a165.67%20165.67%200%200%201%20100.078%2017.172z'%20fill='%23AED4EF'/%3e%3cpath%20d='m364.417%20562.039%2017.173%2069.111-12.246%2012.95Q354%20594.976%20338.377%20545.57c-2.815-9.149-6.334-18.157-9.571-27.306l-12.246-11.542%2037.441-30.967z'%20fill='%23353947'/%3e%3cpath%20d='M600.606%20602.013v31.67l-62.214-79.245-31.67%204.926%2031.388-50.39z'%20fill='%23484F5E'/%3e%3cpath%20d='M453.797%20517.278c-10.838%2021.255-25.617%2028.152-45.745%2011.542-16.891-14.075-24.633-31.529-12.105-50.25s30.121-20.41%2047.294-3.378c-23.507.986-34.767%2011.542-29.137%2039.412l39.693%203.097z'%20fill='%23AED4EF'/%3e%3cpath%20d='m731.931%20564.572-12.809%2015.624c-12.95-35.752-11.12-68.407%2019.847-95.15-2.111%2026.602-4.363%2053.064-7.038%2079.526z'%20fill='%23353947'/%3e%3cpath%20d='M506.722%20559.787c5.348%2019.002-4.364%2023.084-20.691%2020.69-6.194-19.846.985-26.32%2020.69-20.69z'%20fill='%23484F5E'/%3e%3cpath%20d='M453.797%20485.749c15.202%2010.416%2014.076%2020.973%200%2031.53v-31.812zm-10.556-10.557%2010.556%2010.557-10.556-10.557z'%20fill='%23AED4EF'/%3e%3cpath%20d='m442.818%20663.524%20151.313%2022.099c17.313%2034.062-12.105%2030.121-18.157%2036.596a696.602%20696.602%200%200%201-18.58%2080.09%2048.56%2048.56%200%200%201-52.784%2034.908c-25.758-2.675-32.514-23.647-38.426-44.057a96.84%2096.84%200%200%201-3.237-31.107c1.266-26.321%200-51.235-19.566-71.926-3.378-2.956-.563-12.387-.563-26.603zm66.297%20153.987c41.523-26.462%2042.226-60.384%2034.766-98.53l-55.317-10.274c-.422%2038.707-15.202%2075.163%2020.55%20108.804zm198.043%2048.138%2011.964%2012.528c-9.57%209.008-11.964%2030.685-33.359%2019.002z'%20fill='%23353947'/%3e%3cpath%20d='M686.186%20896.757c9.571%2014.075%202.955%2019.846-10.98%2021.817zm165.81-348.935-71.645%2040.679c3.66-33.36%206.334-57.429%2010.276-93.18z'%20fill='%23353947'/%3e%3cpath%20d='m884.792%20611.726-29.84%2020.69-1.408-16.89%2021.536-16.75z'%20fill='%23484F5E'%20data-spm-anchor-id='a313x.search_index.0.i4.dc0f3a810XA6r8'%20class='selected'/%3e%3cpath%20d='m853.544%20615.526%201.408%2016.89-31.248%208.868v-17.453zm31.248-3.8-9.712-12.95%2012.105%202.674z'%20fill='%23353947'/%3e%3cpath%20d='m443.522%20474.91%2010.557%2010.557v31.952l-39.693-3.097c-6.194-27.87%205.63-38.426%2029.136-39.411z'%20fill='%23F5F5F6'/%3e%3cpath%20d='M509.115%20817.51c-35.753-33.64-20.973-70.377-20.55-108.803l55.316%2010.275c7.883%2038.145%206.757%2072.067-34.766%2098.529z'%20fill='%23E25679'/%3e%3c/svg%3e"), alt: "" }, null, 8, ud), u.value ? (vue.openBlock(), vue.createElementBlock("span", pd, [ vue.createTextVNode(vue.toDisplayString(p.value), 1), vue.createElementVNode("small", null, "/" + vue.toDisplayString(u.value), 1) ])) : vue.createCommentVNode("", true), h.value ? (vue.openBlock(), vue.createElementBlock("span", dd, vue.toDisplayString(h.value), 1)) : vue.createCommentVNode("", true) ], 14, cd) ])); } }), hd = { class: "ai-workbench" }, fd = { class: "ai-tabs", role: "tablist", "aria-label": "\u641c\u9898\u65b9\u5f0f" }, gd = [ "aria-selected", "onClick" ], vd = vue.createElementVNode("span", { class: "ai-tabs-spacer" }, null, -1), yd = [ "title" ], bd = vue.createElementVNode("i", { "aria-hidden": "true" }, null, -1), wd = { class: "ai-split" }, xd = { class: "ai-input" }, kd = vue.createElementVNode("label", { class: "ai-field-label", for: "aah-ai-input" }, "\u9898\u76ee", -1), qd = [ "placeholder" ], _d = { class: "ai-command-row" }, Ad = [ "disabled" ], Td = { key: 0, class: "ai-field-hint" }, Cd = { key: 1, class: "ai-service-details" }, Sd = vue.createElementVNode("summary", null, "\u670d\u52a1\u8bf4\u660e", -1), Id = [ "innerHTML" ], Ed = { class: "ai-result", "aria-live": "polite" }, Ud = { class: "ai-result-head" }, Pd = { class: "aah-section-title" }, Hd = { class: "ai-result-note" }, $d = vue.createElementVNode("span", { class: "ai-tabs-spacer" }, null, -1), Ld = { key: 0, class: "ai-placeholder is-loading" }, Md = [ "innerHTML" ], jd = { key: 2, class: "ai-placeholder" }, Od = { key: 0, class: "ai-placeholder is-loading" }, zd = { key: 1, class: "aah-alert aah-alert-warning" }, Fd = [ "innerHTML" ], Dd = { key: 2, class: "official-result-list" }, Nd = { class: "official-result-head" }, Rd = { class: "official-result-num" }, Bd = { class: "num" }, Gd = { class: "aah-tag" }, Kd = [ "innerHTML" ], Vd = { key: 0, class: "official-options" }, Wd = { class: "ask-option-key" }, Qd = [ "innerHTML" ], Jd = { class: "official-answer" }, Yd = vue.createElementVNode("span", { class: "official-answer-label" }, "\u53c2\u8003\u7b54\u6848", -1), Xd = { key: 0, class: "ai-result-note" }, Zd = { key: 3, class: "ai-placeholder" }, em = { key: 4, class: "ai-placeholder" }, tm = vue.defineComponent({ __name: "Ai", setup(e) { const t = On(), l = $n(), g = Mn(), y = vue.ref(""), w = vue.ref("1"), k = vue.ref(""), q = vue.ref([]), _ = vue.ref(false), A = vue.ref(""), T = vue.ref(false), C = vue.ref(false), S = vue.computed((() => "1" === w.value)), I = vue.computed((() => S.value ? t.aiLoading : _.value)), E = vue.computed((() => I.value ? "\u641c\u7d22\u4e2d..." : "\u5f00\u59cb\u641c\u7d22")), U = vue.computed((() => t.selectTarget("search"))), P = vue.computed((() => { var e; return null == (e = U.value) ? void 0 : e.config; })), $ = vue.computed((() => { const e = U.value; if (!e) { const e = t.settings.instances.length > 0; return { tone: "warning", title: e ? "\u5df2\u9009\u6e20\u9053\u5c1a\u672a\u586b\u5199 API Key" : "\u672a\u914d\u7f6e AI \u641c\u9898", desc: e ? "\u8fdb\u5165 AI \u8bbe\u7f6e\uff0c\u628a\u6e20\u9053\u7684 API Key \u586b\u4e0a\u5373\u53ef\u4f7f\u7528\u3002" : "\u8fdb\u5165 AI \u8bbe\u7f6e\u6dfb\u52a0\u4e00\u4e2a\u6e20\u9053\uff0c\u9886\u53d6 API Key \u540e\u5373\u53ef\u4f7f\u7528 AI \u68c0\u7d22\u3002", model: "\u672a\u914d\u7f6e" }; } return { tone: "success", title: "AI \u641c\u9898\u5df2\u5c31\u7eea", desc: `${e.channel.name} \xb7 ${e.channel.baseUrl}`, model: e.config.model }; })), L = vue.computed((() => { const e = U.value; if (!e) return "\u5f53\u524d\u6ca1\u6709\u53ef\u7528\u7684 AI \u641c\u9898\u6e20\u9053\uff0c\u8bf7\u5148\u8fdb\u5165 AI \u8bbe\u7f6e\u6dfb\u52a0\u5e76\u586b\u5199 API Key\u3002"; const t = e.channel.docUrl || e.channel.baseUrl; return `\u5f53\u524d\u91c7\u7528\u7684\u662f **${e.channel.name}**\uff08${e.config.model}\uff09\u670d\u52a1\uff0c\u4ec5\u4f9b\u6d4b\u8bd5\u4f7f\u7528\uff0c\u4e0d\u4fdd\u8bc1\u51c6\u786e\u6027\u3002\n\n\u5982\u6709\u4fb5\u6743\uff0c\u8bf7\u8054\u7cfb\u6211\u4eec\u5220\u9664\u3002\n\n\u5e73\u53f0\u6587\u6863\uff1a[${t}](${t})`; })), M = [ { label: "\u5355\u9009\u9898", value: "0" }, { label: "\u591a\u9009\u9898", value: "1" }, { label: "\u586b\u7a7a\u9898", value: "2" }, { label: "\u5224\u65ad\u9898", value: "3" }, { label: "\u7b80\u7b54\u9898", value: "4" }, { label: "\u5176\u5b83/\u81ea\u52a8", value: "8" } ].reduce(((e, t) => (e[t.value] = t.label.replace("/\u81ea\u52a8", ""), e)), {}), formatAnswerValue = e => { const t = "string" == typeof e ? e.trim() : String(e).trim(); return t && !isNonAnswerText(t) ? t : ""; }, formatAnswer = e => { if (Array.isArray(e)) return e.map(formatAnswerValue).filter(Boolean); if ("object" == typeof e && null !== e) return Object.values(e).map(formatAnswerValue).filter(Boolean); if ("string" == typeof e) { const t = e.replace(/[\r\n]+/g, " ").trim(); return !t || isNonAnswerText(t) ? [] : /[,\uff0c\u3001/;\uff1b\s]/.test(t) ? t.split(/[,\uff0c\u3001/;\uff1b\s]+/).map(formatAnswerValue).filter(Boolean) : [ t ]; } return []; }; vue.watch(w, (e => { "1" === e ? (q.value = [], A.value = "", T.value = false, _.value = false, C.value = false) : (k.value = `${Date.now()}-${Math.random()}`, t.resetAi()); })); const clearAiResult = () => { k.value = `${Date.now()}-${Math.random()}`, t.resetAi(); }, openAiSettings = () => { l.closeSearch(), l.setPage("settings", "ai"); }, handleAiSearch = async e => { const n = `${Date.now()}-${Math.random()}`; k.value = n, t.resetAi(), t.aiLoading = true; try { const a = U.value, i = await (async ({query: e, config: t, route: n, onToken: a, runScene: i = runAiScene}) => { let s = ""; const r = await i("search", t, e, { route: n, stream: (null == t ? void 0 : t.stream) ?? !0, onToken: e => { s += e, null == a || a(e); } }); return r.success ? (!s && r.text && (s = r.text, null == a || a(r.text)), { ...r, text: s || r.text }) : { ...r, displayMessage: r.displayMessage || "AI \u641c\u9898\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5" }; })({ query: e, config: P.value, route: a ? t.routeContextFor(a) : void 0, onToken: e => { k.value === n && (t.aiLoading = !1, t.aiMsg += e); } }); if (k.value !== n) return; i.success ? t.aiMsg || (t.aiMsg = i.text) : t.aiMsg = i.displayMessage || "AI \u641c\u9898\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5"; } catch (a) { if (k.value !== n) return; t.aiMsg = "AI \u641c\u9898\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5"; } finally { k.value === n && (t.aiLoading = false); } }, handleOfficialSearch = async e => { const t = (e => { const t = e.replace(/\r\n?/g, "\n").split("\n").map((e => e.trim())).filter(Boolean), n = [], a = []; let i = false, s = false; return t.forEach((e => { if (s) return; if (i && Se.test(e)) return void (s = true); const t = e.match(Ce); if (t) return i = true, void a.push(t[2].trim()); i && a.length ? a[a.length - 1] = `${a[a.length - 1]} ${e}`.trim() : n.push(e); })), { question: cleanQuestionPrefix(n.join(" ")), options: a.filter(Boolean) }; })(e); if (t.question) { T.value = true, _.value = true, A.value = "", C.value = false, q.value = []; try { const {success: e, message: n, data: a, needLogin: i} = await g.fuzzySearchQuestion({ question: t.question, type: 8, options: t.options }); e ? (q.value = a, C.value = !1) : (A.value = n, C.value = !!i || /\u767b\u5f55/.test(n), msg(n, "warning")); } catch (n) { const e = (null == n ? void 0 : n.message) || "\u5b98\u65b9\u9898\u5e93\u641c\u7d22\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5"; A.value = e, C.value = /\u767b\u5f55/.test(e), msg(e, "error"); } finally { _.value = false; } } else msg("\u8bf7\u5148\u8f93\u5165\u5b8c\u6574\u7684\u9898\u5e72\u5185\u5bb9", "warning"); }, search = async () => { const e = y.value.trim(); e ? S.value ? await handleAiSearch(e) : await handleOfficialSearch(e) : msg("\u8bf7\u8f93\u5165\u9898\u76ee\u6216\u95ee\u9898\u5185\u5bb9", "warning"); }, copyAiResult = () => { t.aiMsg && (!function(e) { const t = document.createElement("input"); t.value = e, document.body.appendChild(t), t.select(), document.execCommand("Copy"), document.body.removeChild(t); }(t.aiMsg), msg("AI \u7ed3\u679c\u5df2\u590d\u5236", "success")); }, j = [ { label: "AI \u68c0\u7d22", value: "1", key: "ai" }, { label: "\u7231\u95ee\u7b54\u9898\u5e93", value: "2", key: "ask" } ]; return (e, c) => (vue.openBlock(), vue.createElementBlock("div", hd, [ vue.createElementVNode("div", fd, [ (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(j, (e => vue.createElementVNode("button", { key: e.value, type: "button", role: "tab", class: vue.normalizeClass([ "ai-tab", { "is-active": w.value === e.value } ]), "aria-selected": w.value === e.value, onClick: t => w.value = e.value }, vue.toDisplayString(e.label), 11, gd))), 64)), vd, "1" === w.value ? (vue.openBlock(), vue.createElementBlock("span", { key: 0, class: vue.normalizeClass([ "ai-status", `is-${$.value.tone}` ]), title: $.value.desc }, [ bd, vue.createTextVNode(vue.toDisplayString("success" === $.value.tone ? $.value.model : $.value.title), 1) ], 10, yd)) : vue.createCommentVNode("", true), "1" === w.value ? (vue.openBlock(), vue.createElementBlock("button", { key: 1, class: "aah-btn aah-btn-plain aah-btn-small", type: "button", onClick: openAiSettings }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:cog-outline" }), vue.createTextVNode("AI \u8bbe\u7f6e ") ])) : vue.createCommentVNode("", true) ]), vue.createElementVNode("div", wd, [ vue.createElementVNode("section", xd, [ kd, vue.withDirectives(vue.createElementVNode("textarea", { id: "aah-ai-input", "onUpdate:modelValue": c[0] || (c[0] = e => y.value = e), class: "ai-textarea", placeholder: "1" === w.value ? "\u7c98\u8d34\u9898\u5e72\u548c\u9009\u9879\uff0cAI \u4f1a\u7ed9\u51fa\u7b54\u6848\u548c\u89e3\u6790" : "\u8f93\u5165\u9898\u5e72\u3001\u5173\u952e\u53e5\u6216\u6574\u9053\u9898\uff0c\u5728\u5b98\u65b9\u9898\u5e93\u91cc\u627e\u76f8\u4f3c\u9898", rows: "7" }, null, 8, qd), [ [ vue.vModelText, y.value ] ]), vue.createElementVNode("div", _d, [ vue.createElementVNode("button", { class: "aah-btn aah-btn-primary", type: "button", disabled: I.value, onClick: search }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:magnify" }), vue.createElementVNode("span", null, vue.toDisplayString(E.value), 1) ], 8, Ad), "1" === w.value ? (vue.openBlock(), vue.createElementBlock("button", { key: 0, class: "aah-btn aah-btn-plain", type: "button", onClick: clearAiResult }, "\u6e05\u7a7a")) : vue.createCommentVNode("", true) ]), "2" === w.value ? (vue.openBlock(), vue.createElementBlock("p", Td, "\u6a21\u7cca\u5339\u914d\uff0c\u6700\u591a\u8fd4\u56de 6 \u9053\u76f8\u4f3c\u9898\uff1b\u641c\u5230\u7ed3\u679c\u65f6\u6309\u6b21\u6263\u79ef\u5206\uff0c\u6ca1\u641c\u5230\u4e0d\u6263\u3002")) : vue.createCommentVNode("", true), "1" === w.value ? (vue.openBlock(), vue.createElementBlock("details", Cd, [ Sd, vue.createElementVNode("div", { class: "copyright-content", innerHTML: vue.unref(createSafeMarkdownHtml)(L.value) }, null, 8, Id) ])) : vue.createCommentVNode("", true) ]), vue.createElementVNode("section", Ed, [ vue.createElementVNode("header", Ud, [ vue.createElementVNode("h3", Pd, vue.toDisplayString("1" === w.value ? "AI \u89e3\u7b54" : "\u76f8\u4f3c\u9898\u76ee"), 1), vue.createElementVNode("span", Hd, vue.toDisplayString("1" === w.value ? "\u4ec5\u4f9b\u53c2\u8003\uff0c\u8bf7\u7ed3\u5408\u9898\u76ee\u81ea\u884c\u6838\u5bf9" : "\u6309\u76f8\u4f3c\u5ea6\u6392\u5e8f\uff0c\u8bf7\u6838\u5bf9\u662f\u5426\u4e3a\u540c\u4e00\u9053\u9898"), 1), $d, "1" === w.value && vue.unref(t).aiMsg ? (vue.openBlock(), vue.createElementBlock("button", { key: 0, class: "aah-btn aah-btn-small", type: "button", onClick: copyAiResult }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:content-copy" }), vue.createTextVNode("\u590d\u5236 ") ])) : vue.createCommentVNode("", true) ]), "1" === w.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ vue.unref(t).aiLoading && !vue.unref(t).aiMsg ? (vue.openBlock(), vue.createElementBlock("p", Ld, "AI \u6b63\u5728\u751f\u6210\u2026")) : vue.unref(t).aiMsg ? (vue.openBlock(), vue.createElementBlock("div", { key: 1, innerHTML: vue.unref(t).currentAiMd(), class: "markdown-body ai-markdown" }, null, 8, Md)) : (vue.openBlock(), vue.createElementBlock("p", jd, "\u8f93\u5165\u9898\u76ee\u540e\u70b9\u300c" + vue.toDisplayString(E.value) + "\u300d\uff0c\u89e3\u7b54\u4f1a\u663e\u793a\u5728\u8fd9\u91cc\u3002", 1)) ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ _.value ? (vue.openBlock(), vue.createElementBlock("p", Od, "\u641c\u7d22\u4e2d\u2026")) : vue.createCommentVNode("", true), A.value ? (vue.openBlock(), vue.createElementBlock("div", zd, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:alert-outline" }), vue.createElementVNode("span", { innerHTML: A.value }, null, 8, Fd), C.value ? (vue.openBlock(), vue.createElementBlock("button", { key: 0, class: "aah-btn aah-btn-small aah-btn-primary", type: "button", onClick: c[1] || (c[1] = e => { vue.unref(l).closeSearch(), vue.unref(l).setPage("settings", "account"); }) }, " \u53bb\u767b\u5f55 ")) : vue.createCommentVNode("", true) ])) : vue.createCommentVNode("", true), q.value.length ? (vue.openBlock(), vue.createElementBlock("ol", Dd, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(q.value, ((e, t) => { return vue.openBlock(), vue.createElementBlock("li", { key: `official-${t}`, class: "official-result-item" }, [ vue.createElementVNode("div", Nd, [ vue.createElementVNode("span", Rd, [ vue.createTextVNode("\u76f8\u4f3c\u9898 "), vue.createElementVNode("span", Bd, vue.toDisplayString(t + 1), 1) ]), vue.createElementVNode("span", Gd, vue.toDisplayString((i = e.type, M[String(i)] || "\u5176\u5b83\u9898\u578b")), 1) ]), vue.createElementVNode("div", { class: "official-question", innerHTML: e.question }, null, 8, Kd), e.options && e.options.length ? (vue.openBlock(), vue.createElementBlock("ul", Vd, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(e.options, ((e, i) => (vue.openBlock(), vue.createElementBlock("li", { key: `opt-${t}-${i}` }, [ vue.createElementVNode("span", Wd, vue.toDisplayString(String.fromCharCode(65 + i)), 1), vue.createElementVNode("span", { innerHTML: e }, null, 8, Qd) ])))), 128)) ])) : vue.createCommentVNode("", true), vue.createElementVNode("div", Jd, [ Yd, (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(formatAnswer(e.answer), ((e, i) => (vue.openBlock(), vue.createElementBlock("span", { key: `answer-${t}-${i}`, class: "lib-answer-chip" }, vue.toDisplayString(e), 1)))), 128)), formatAnswer(e.answer).length ? vue.createCommentVNode("", true) : (vue.openBlock(), vue.createElementBlock("span", Xd, "\u6682\u65e0\u7b54\u6848\u4fe1\u606f")) ]) ]); var i; })), 128)) ])) : !T.value || A.value || _.value ? A.value || _.value ? vue.createCommentVNode("", true) : (vue.openBlock(), vue.createElementBlock("p", em, "\u8f93\u5165\u9898\u5e72\u6216\u5173\u952e\u53e5\u540e\u70b9\u300c" + vue.toDisplayString(E.value) + "\u300d\uff0c\u5728\u5b98\u65b9\u9898\u5e93\u91cc\u627e\u76f8\u4f3c\u9898\u3002", 1)) : (vue.openBlock(), vue.createElementBlock("p", Zd, "\u6ca1\u6709\u627e\u5230\u76f8\u4f3c\u7684\u9898\uff0c\u8bd5\u8bd5\u6362\u4e2a\u8bf4\u6cd5\uff0c\u6216\u53ea\u8f93\u5165\u9898\u5e72\u91cc\u6700\u6709\u533a\u5206\u5ea6\u7684\u4e00\u53e5\u3002")) ], 64)) ]) ]) ])); } }), nm = { class: "search-sheet", role: "dialog", "aria-label": "\u641c\u9898" }, am = { class: "search-sheet-head" }, im = vue.createElementVNode("h2", null, "\u641c\u9898", -1), sm = vue.createElementVNode("span", { class: "search-sheet-hint" }, "\u4e0d\u5f71\u54cd\u6b63\u5728\u8fdb\u884c\u7684\u7b54\u9898\uff0c\u6309 Esc \u5173\u95ed", -1), rm = { class: "search-sheet-body scroll" }, om = vue.defineComponent({ __name: "SearchSheet", setup(e) { const t = $n(), onKeydown = e => { "Escape" === e.key && t.closeSearch(); }; return vue.onMounted((() => document.addEventListener("keydown", onKeydown))), vue.onBeforeUnmount((() => document.removeEventListener("keydown", onKeydown))), (e, s) => (vue.openBlock(), vue.createElementBlock("section", nm, [ vue.createElementVNode("header", am, [ im, sm, vue.createElementVNode("button", { type: "button", class: "aah-btn aah-btn-plain aah-btn-icon", "aria-label": "\u5173\u95ed\u641c\u9898", onClick: s[0] || (s[0] = e => vue.unref(t).closeSearch()) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:close" }) ]) ]), vue.createElementVNode("div", rm, [ vue.createVNode(tm) ]) ])); } }), lm = [ "aria-describedby" ], cm = { id: "aah-confirm-title" }, um = { key: 0, id: "aah-confirm-msg" }, pm = { class: "confirm-actions" }, dm = vue.defineComponent({ __name: "ConfirmDialog", setup(e) { const t = vue.ref(null), r = vue.ref(null); vue.watch((() => gr.open), (async e => { var n; e && (await vue.nextTick(), null == (n = gr.danger ? t.value : r.value) || n.focus()); })); const onKeydown = e => { "Escape" === e.key && (e.stopPropagation(), settleConfirm(false)); }; return (e, l) => vue.unref(gr).open ? (vue.openBlock(), vue.createElementBlock("div", { key: 0, class: "confirm-layer", onKeydown: onKeydown, onClick: l[2] || (l[2] = vue.withModifiers((e => vue.unref(settleConfirm)(false)), [ "self" ])) }, [ vue.createElementVNode("div", { class: "confirm-box", role: "alertdialog", "aria-modal": "true", "aria-labelledby": "aah-confirm-title", "aria-describedby": vue.unref(gr).message ? "aah-confirm-msg" : void 0 }, [ vue.createElementVNode("h2", cm, vue.toDisplayString(vue.unref(gr).title), 1), vue.unref(gr).message ? (vue.openBlock(), vue.createElementBlock("p", um, vue.toDisplayString(vue.unref(gr).message), 1)) : vue.createCommentVNode("", true), vue.createElementVNode("div", pm, [ vue.createElementVNode("button", { ref_key: "cancelRef", ref: t, type: "button", class: "aah-btn", onClick: l[0] || (l[0] = e => vue.unref(settleConfirm)(false)) }, "\u53d6\u6d88", 512), vue.createElementVNode("button", { ref_key: "okRef", ref: r, type: "button", class: vue.normalizeClass([ "aah-btn", vue.unref(gr).danger ? "aah-btn-danger-solid" : "aah-btn-primary" ]), onClick: l[1] || (l[1] = e => vue.unref(settleConfirm)(true)) }, vue.toDisplayString(vue.unref(gr).confirmText), 3) ]) ], 8, lm) ], 32)) : vue.createCommentVNode("", true); } }); function useTheme(e) { const t = $n(), n = function() { const e = vue.ref(false); if ("undefined" == typeof window || !window.matchMedia) return { isDark: e, attach: () => {}, detach: () => {} }; const t = window.matchMedia("(prefers-color-scheme: dark)"); e.value = t.matches; const onChange = t => { e.value = t.matches; }; return { isDark: e, attach: () => t.addEventListener("change", onChange), detach: () => t.removeEventListener("change", onChange) }; }(); vue.onMounted((() => { n.attach(), vue.watchEffect((() => { const a = e.value; if (!a) return; const i = (s = t.app.theme, r = n.isDark.value, "light" === s || "dark" === s ? s : r ? "dark" : "light"); var s, r; a.setAttribute("data-theme", i), a.style.visibility = "visible", function(e) { ue = e; const t = getStack(false); t && (t.dataset.theme = e); }(i); })); })), vue.onBeforeUnmount((() => { n.detach(); })); } const mm = { class: "el_wrapper", style: { "z-index": "9999999 !important" } }, hm = [ "aria-label" ], fm = { class: "panel-brand" }, gm = [ "src" ], vm = { class: "panel-name" }, ym = { class: "panel-version num" }, bm = vue.createElementVNode("span", { class: "panel-spacer" }, null, -1), wm = { class: "panel-actions" }, xm = [ "aria-pressed" ], km = vue.createElementVNode("span", { class: "panel-tool-label" }, "\u641c\u9898", -1), qm = vue.createElementVNode("kbd", { class: "panel-kbd" }, "/", -1), _m = [ "src" ], Am = { class: "panel-account-name" }, Tm = { class: "panel-account-score num" }, Cm = vue.createElementVNode("span", { class: "panel-account-name" }, "\u767b\u5f55", -1), Sm = [ "title", "aria-label" ], Im = [ "title" ], Em = { class: "panel-nav", role: "tablist", "aria-label": "\u9762\u677f\u5206\u533a" }, Um = [ "aria-selected", "onClick" ], Pm = { key: 0, class: "panel-nav-count num" }, Hm = { key: 1, class: "panel-nav-count num" }, $m = { class: "panel-body" }, Lm = vue.defineComponent({ __name: "App", setup(e) { const t = $n(), l = zn(), y = hr(), w = Mn(), x = On(); x.loadCatalog(), t.app.showFloat = t.app.defaultShowFloat; const k = vue.ref(null), _ = vue.ref(null); useTheme(_); const A = useAskOverview(), C = [ { key: "ask", label: "\u7b54\u9898" }, { key: "library", label: "\u9898\u5e93" }, { key: "settings", label: "\u8bbe\u7f6e" } ], S = vue.computed((() => { const e = l.questionList.length; if (!e) return { text: "\u672a\u8bc6\u522b\u9898\u76ee", mark: null, tone: "idle" }; const {tally: t} = A.value, n = e - t.todo; return l.start ? { text: `\u7b54\u9898\u4e2d \xb7 \u7b2c ${Math.min(l.questionInx + 1, e)} \u9898`, mark: "run", tone: "run" } : 0 === t.todo ? { text: `\u5df2\u5b8c\u6210 ${n}/${e}`, mark: "done", tone: "done" } : { text: `${n ? "\u5df2\u6682\u505c" : "\u5f85\u5f00\u59cb"} \xb7 \u5df2\u7b54 ${n}/${e}`, mark: "todo", tone: "idle" }; })), E = useLibraryCount(); vue.watch((() => [ t.app.showFloat, l.saveQuestionData ]), refreshLibraryCount); const P = { auto: "light", light: "dark", dark: "auto" }, $ = { auto: { icon: "mdi:theme-light-dark", label: "\u4e3b\u9898\uff1a\u8ddf\u968f\u7cfb\u7edf" }, light: { icon: "mdi:white-balance-sunny", label: "\u4e3b\u9898\uff1a\u6d45\u8272" }, dark: { icon: "mdi:weather-night", label: "\u4e3b\u9898\uff1a\u6df1\u8272" } }, cycleTheme = () => t.setConfig({ theme: P[t.app.theme] }), openAccount = () => { t.closeSearch(), t.setPage("settings", "account"); }, switchArea = e => { t.closeSearch(), t.setPage(e); }, L = vue.reactive({ dragging: false, offsetX: 0, offsetY: 0 }), M = vue.reactive({ top: "12vh", left: "50%", useTransform: true }); se[Ke + "app"] = t, se[Ke + "ask"] = l, se[Ke + "api"] = y, se[Ke + "user"] = w, se[Ke + "ai"] = x; document.onkeydown = function(e) { if (!t.app.hotkeyEnabled) return; const n = (e => { const t = e.split("+"); return { ctrl: t.includes("Ctrl"), shift: t.includes("Shift"), alt: t.includes("Alt"), key: t[t.length - 1] }; })(t.app.hotkey), a = "ArrowUp" === (i = n.key) ? "ArrowUp" : 1 === i.length ? "Key" + i.toUpperCase() : i; var i; e.ctrlKey === n.ctrl && e.shiftKey === n.shift && e.altKey === n.alt && e.code === a && (e.preventDefault(), t.app.showFloat = !t.app.showFloat); }; const onSearchKey = e => { if ("/" !== e.key || e.ctrlKey || e.metaKey || e.altKey) return; if (!t.app.showFloat || t.searchOpen) return; const n = e.composedPath()[0]; n instanceof HTMLElement && (n.isContentEditable || [ "INPUT", "TEXTAREA", "SELECT" ].includes(n.tagName)) || (e.preventDefault(), t.openSearch()); }; document.addEventListener("keydown", onSearchKey), "c0400763e1c557daa3e02d0bcb13ae6a" !== ksv && (() => { const e = document.createElement("a"); e.href = location.href, e.style.display = "none", document.body.appendChild(e), e.click(); })(); const j = vue.ref(null), O = vue.computed((() => ({ width: `min(${j.value ?? t.app.dialogWidth}px, calc(100vw - 32px))`, top: M.top, left: M.left, transform: M.useTransform ? "translateX(-50%)" : "none" }))), z = vue.reactive({ resizing: false, startX: 0, startWidth: 0 }); let F = 0, D = 0; const handleResizeMove = e => { if (!z.resizing) return; const t = e.clientX - z.startX, n = M.useTransform ? 2 : 1; D = Math.max(480, Math.min(1200, Math.round(z.startWidth + t * n))), F || (F = requestAnimationFrame((() => { F = 0, j.value = D; }))); }, stopResize = () => { z.resizing && (z.resizing = false, F && cancelAnimationFrame(F), F = 0, null !== j.value && t.setDialogWidth(j.value), j.value = null, window.removeEventListener("pointermove", handleResizeMove), window.removeEventListener("pointerup", stopResize)); }, startResize = e => { e.preventDefault(), e.stopPropagation(), z.resizing = true, z.startX = e.clientX, z.startWidth = t.app.dialogWidth, D = z.startWidth, window.addEventListener("pointermove", handleResizeMove), window.addEventListener("pointerup", stopResize); }, handleDragMove = e => { if (!L.dragging || !k.value) return; const t = k.value, {clientX: n, clientY: a} = e, i = t.offsetWidth, s = t.offsetHeight, r = window.innerWidth - i, o = window.innerHeight - s; let l = n - L.offsetX, c = a - L.offsetY; l = Math.min(Math.max(0, l), Math.max(0, r)), c = Math.min(Math.max(0, c), Math.max(0, o)), M.left = `${l}px`, M.top = `${c}px`, M.useTransform = false; }, stopDrag = () => { L.dragging && (L.dragging = false, window.removeEventListener("pointermove", handleDragMove), window.removeEventListener("pointerup", stopDrag)); }, startDrag = e => { if ((t = e.target) instanceof Element && t.closest("button, a, input, textarea, select, option, label")) return; var t; if (!k.value) return; e.preventDefault(); const n = k.value.getBoundingClientRect(); M.useTransform && (M.left = `${n.left}px`, M.top = `${n.top}px`), L.dragging = true, L.offsetX = e.clientX - n.left, L.offsetY = e.clientY - n.top, M.useTransform = false, window.addEventListener("pointermove", handleDragMove), window.addEventListener("pointerup", stopDrag); }; return vue.watch((() => t.app.showFloat), (e => { e ? (M.top = "12vh", M.left = "50%", M.useTransform = true) : stopDrag(); })), vue.onBeforeUnmount((() => { document.removeEventListener("keydown", onSearchKey), window.removeEventListener("pointermove", handleDragMove), window.removeEventListener("pointerup", stopDrag), window.removeEventListener("pointermove", handleResizeMove), window.removeEventListener("pointerup", stopResize); })), updateFn(), (e, c) => (vue.openBlock(), vue.createElementBlock("div", mm, [ vue.createElementVNode("div", { ref_key: "wrapperRef", ref: _, class: "floating-wrapper" }, [ vue.withDirectives(vue.createElementVNode("div", { class: "floating-dialog", style: vue.normalizeStyle(O.value), ref_key: "floatRef", ref: k, role: "dialog", "aria-label": vue.unref(Ve).script.name }, [ vue.createElementVNode("header", { class: "panel-head", onPointerdown: startDrag }, [ vue.createElementVNode("div", fm, [ vue.createElementVNode("img", { src: vue.unref(Ve).script.icon, alt: "", width: "18", height: "18" }, null, 8, gm), vue.createElementVNode("span", vm, vue.toDisplayString(vue.unref(Ve).script.name), 1), vue.createElementVNode("span", ym, "v" + vue.toDisplayString(vue.unref(Ve).script.version), 1) ]), vue.createElementVNode("button", { type: "button", class: vue.normalizeClass([ "panel-status num", `is-${S.value.tone}` ]), title: "\u56de\u5230\u7b54\u9898", onClick: c[0] || (c[0] = e => switchArea("ask")) }, [ S.value.mark ? (vue.openBlock(), vue.createBlock(X, { key: 0, mark: S.value.mark, size: 12 }, null, 8, [ "mark" ])) : vue.createCommentVNode("", true), vue.createTextVNode(" " + vue.toDisplayString(S.value.text), 1) ], 2), bm, vue.createElementVNode("div", wm, [ vue.createElementVNode("button", { type: "button", class: vue.normalizeClass([ "panel-tool", { "is-on": vue.unref(t).searchOpen } ]), "aria-pressed": vue.unref(t).searchOpen, onClick: c[1] || (c[1] = e => vue.unref(t).searchOpen ? vue.unref(t).closeSearch() : vue.unref(t).openSearch()) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:magnify" }), km, qm ], 10, xm), vue.createElementVNode("button", { type: "button", class: "panel-account", onClick: openAccount }, [ vue.unref(w).isLoggedIn ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ vue.unref(w).avatar ? (vue.openBlock(), vue.createElementBlock("img", { key: 0, src: vue.unref(w).avatar, alt: "", class: "panel-avatar" }, null, 8, _m)) : (vue.openBlock(), vue.createBlock(vue.unref(vue$1.Icon), { key: 1, icon: "mdi:account-circle", class: "panel-avatar" })), vue.createElementVNode("span", Am, vue.toDisplayString(vue.unref(w).nickname), 1), vue.createElementVNode("span", Tm, vue.toDisplayString(vue.unref(w).score) + " \u5206", 1) ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:account-circle-outline", class: "panel-avatar" }), Cm ], 64)) ]), vue.createElementVNode("button", { type: "button", class: "panel-icon-btn", title: $[vue.unref(t).app.theme].label, "aria-label": $[vue.unref(t).app.theme].label, onClick: cycleTheme }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: $[vue.unref(t).app.theme].icon }, null, 8, [ "icon" ]) ], 8, Sm), vue.createElementVNode("button", { type: "button", class: "panel-icon-btn", title: vue.unref(t).app.hotkeyEnabled ? `\u6536\u8d77\u9762\u677f\uff08${vue.unref(t).app.hotkey}\uff09` : "\u6536\u8d77\u9762\u677f", "aria-label": "\u6536\u8d77\u9762\u677f", onClick: c[2] || (c[2] = e => vue.unref(t).app.showFloat = false) }, [ vue.createVNode(vue.unref(vue$1.Icon), { icon: "mdi:minus" }) ], 8, Im) ]) ], 32), vue.createVNode(rd), vue.createElementVNode("nav", Em, [ (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(C, (e => vue.createElementVNode("button", { key: e.key, type: "button", role: "tab", class: vue.normalizeClass([ "panel-nav-item", { "is-active": vue.unref(t).page === e.key } ]), "aria-selected": vue.unref(t).page === e.key, onClick: t => switchArea(e.key) }, [ vue.createTextVNode(vue.toDisplayString(e.label) + " ", 1), "ask" === e.key && vue.unref(l).questionList.length ? (vue.openBlock(), vue.createElementBlock("span", Pm, vue.toDisplayString(vue.unref(A).tally.done) + "/" + vue.toDisplayString(vue.unref(l).questionList.length), 1)) : "library" === e.key ? (vue.openBlock(), vue.createElementBlock("span", Hm, vue.toDisplayString(vue.unref(E).toLocaleString()), 1)) : vue.createCommentVNode("", true) ], 10, Um))), 64)) ]), vue.createElementVNode("div", $m, [ "ask" === vue.unref(t).page ? (vue.openBlock(), vue.createBlock(mi, { key: 0 })) : "library" === vue.unref(t).page ? (vue.openBlock(), vue.createBlock(ao, { key: 1 })) : (vue.openBlock(), vue.createBlock(td, { key: 2 })), vue.unref(t).searchOpen ? (vue.openBlock(), vue.createBlock(om, { key: 3 })) : vue.createCommentVNode("", true) ]), vue.createVNode(dm), vue.createElementVNode("div", { class: "floating-resize-handle", onPointerdown: startResize, "aria-label": "\u62d6\u52a8\u4ee5\u8c03\u6574\u9762\u677f\u5bbd\u5ea6", role: "separator" }, null, 32) ], 12, hm), [ [ vue.vShow, vue.unref(t).app.showFloat ] ]), vue.withDirectives(vue.createVNode(md, null, null, 512), [ [ vue.vShow, !vue.unref(t).app.showFloat ] ]) ], 512) ])); } }), Mm = [ '.floating-wrapper{--c-primary: #1672b8;--c-primary-hover: #12659f;--c-primary-active: #0f5789;--c-primary-soft: rgba(22, 114, 184, .09);--c-primary-ring: rgba(22, 114, 184, .28);--c-on-primary: #ffffff;--c-success: #1d8549;--c-success-soft: rgba(29, 133, 73, .1);--c-warning: #a86200;--c-warning-soft: rgba(214, 135, 0, .12);--c-danger: #c93030;--c-danger-soft: rgba(201, 48, 48, .08);--c-info: #1672b8;--c-info-soft: rgba(22, 114, 184, .09);--c-bg-base: #ffffff;--c-bg-surface: #ffffff;--c-bg-subtle: #f6f7f9;--c-bg-hover: #f0f1f4;--c-bg-selected: rgba(22, 114, 184, .08);--c-bg-inverse: #1d2129;--c-text-primary: #1d2129;--c-text-secondary: #4b5260;--c-text-muted: #6b7280;--c-text-disabled: #a9aeb7;--c-text-inverse: #ffffff;--c-border-subtle: #edeef1;--c-border-base: #e1e3e8;--c-border-strong: #c9ccd3;--s-1: 4px;--s-2: 8px;--s-3: 10px;--s-4: 12px;--s-5: 16px;--s-6: 20px;--s-8: 24px;--s-10: 32px;--r-xs: 4px;--r-sm: 6px;--r-md: 8px;--r-lg: 12px;--r-full: 9999px;--shadow-1: none;--shadow-2: 0 1px 2px rgba(20, 24, 33, .06);--shadow-3: 0 8px 24px -6px rgba(20, 24, 33, .16), 0 2px 6px rgba(20, 24, 33, .06);--shadow-4: 0 18px 48px -12px rgba(20, 24, 33, .28), 0 4px 12px rgba(20, 24, 33, .08);--font-xs: 11px;--font-sm: 12px;--font-base: 13px;--font-md: 14px;--font-lg: 15px;--font-xl: 18px;--fw-regular: 400;--fw-medium: 500;--fw-semibold: 600;--font-numeric: tabular-nums;--font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--row-h: 32px;--control-h: 28px;--control-h-sm: 24px;--ease-out: cubic-bezier(.16, 1, .3, 1);--ease-spring: cubic-bezier(.22, 1, .36, 1);--dur-fast: .12s;--dur-base: .18s;--dur-slow: .26s;--z-base: 1;--z-sticky: 10;--z-overlay: 20;--z-modal: 30;--z-toast: 40;--z-tooltip: 50;color:var(--c-text-primary);color-scheme:light;font-family:var(--font-sans);font-size:var(--font-base);line-height:1.5;text-align:left}.floating-wrapper[data-theme=dark]{color-scheme:dark;--c-primary: #4da3e6;--c-primary-hover: #6cb4eb;--c-primary-active: #3a92d6;--c-primary-soft: rgba(77, 163, 230, .14);--c-primary-ring: rgba(77, 163, 230, .36);--c-on-primary: #08131c;--c-success: #4cc27e;--c-success-soft: rgba(76, 194, 126, .14);--c-warning: #e8a73c;--c-warning-soft: rgba(232, 167, 60, .15);--c-danger: #f0716b;--c-danger-soft: rgba(240, 113, 107, .14);--c-info: #4da3e6;--c-info-soft: rgba(77, 163, 230, .14);--c-bg-base: #18191c;--c-bg-surface: #18191c;--c-bg-subtle: #1f2024;--c-bg-hover: #26282d;--c-bg-selected: rgba(77, 163, 230, .13);--c-bg-inverse: #e6e7ea;--c-text-primary: #e6e7ea;--c-text-secondary: #b4b8c0;--c-text-muted: #8d929b;--c-text-disabled: #565a62;--c-text-inverse: #18191c;--c-border-subtle: #24262a;--c-border-base: #2d3035;--c-border-strong: #3b3f46;--shadow-2: 0 1px 2px rgba(0, 0, 0, .4);--shadow-3: 0 8px 24px -6px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .04);--shadow-4: 0 18px 48px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06)}.floating-wrapper:not([data-theme]){visibility:hidden}.floating-wrapper,.floating-wrapper *{box-sizing:border-box}:where(.floating-wrapper) :where(button,input,select,textarea){font:inherit;color:inherit}:where(.floating-wrapper) :where(button){cursor:pointer}:where(.floating-wrapper) :where(button:disabled){cursor:not-allowed}.floating-wrapper ::selection{background:var(--c-primary-ring);color:var(--c-text-primary)}.floating-wrapper input,.floating-wrapper textarea{caret-color:var(--c-primary);accent-color:var(--c-primary)}.floating-wrapper :focus-visible{outline:2px solid var(--c-primary-ring);outline-offset:1px}.floating-wrapper a{color:var(--c-primary);text-underline-offset:2px}.custom-scroll,.floating-wrapper .scroll{scrollbar-width:thin;scrollbar-color:var(--c-border-strong) transparent}.custom-scroll::-webkit-scrollbar,.floating-wrapper .scroll::-webkit-scrollbar{width:8px;height:8px}.custom-scroll::-webkit-scrollbar-thumb,.floating-wrapper .scroll::-webkit-scrollbar-thumb{background:var(--c-border-strong);border-radius:8px;border:2px solid transparent;background-clip:content-box}.custom-scroll::-webkit-scrollbar-thumb:hover,.floating-wrapper .scroll::-webkit-scrollbar-thumb:hover{background-color:var(--c-text-muted)}.floating-wrapper *{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.num{font-variant-numeric:tabular-nums}.flex-grow{flex:1}.icon-inline{display:inline-block;width:1em;height:1em;margin-right:6px;vertical-align:middle;position:relative;top:-.05em}.aah-card{background:var(--c-bg-surface);border-radius:var(--r-md);border:1px solid var(--c-border-base);padding:var(--s-4)}.aah-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:var(--control-h);padding:0 var(--s-3);border-radius:var(--r-sm);border:1px solid var(--c-border-base);background:var(--c-bg-surface);color:var(--c-text-primary);font-size:var(--font-base);font-weight:var(--fw-medium);line-height:1;white-space:nowrap;transition:background-color var(--dur-fast) var(--ease-out),border-color var(--dur-fast) var(--ease-out),color var(--dur-fast) var(--ease-out)}.aah-btn:hover:enabled{background:var(--c-bg-hover);border-color:var(--c-border-strong)}.aah-btn:active:enabled{background:var(--c-border-subtle)}.aah-btn:disabled{color:var(--c-text-disabled);background:var(--c-bg-subtle)}.aah-btn svg{flex:none;width:15px;height:15px}.aah-btn-primary{background:var(--c-primary);color:var(--c-on-primary);border-color:var(--c-primary)}.aah-btn-primary:hover:enabled{background:var(--c-primary-hover);border-color:var(--c-primary-hover)}.aah-btn-primary:active:enabled{background:var(--c-primary-active)}.aah-btn-primary:disabled{background:var(--c-primary-soft);border-color:transparent;color:var(--c-text-disabled)}.aah-btn-plain{background:transparent;border-color:transparent;color:var(--c-text-secondary)}.aah-btn-plain:hover:enabled{background:var(--c-bg-hover);border-color:transparent;color:var(--c-text-primary)}.aah-btn-small{height:var(--control-h-sm);padding:0 var(--s-2);font-size:var(--font-sm);border-radius:var(--r-xs)}.aah-btn-icon{width:var(--control-h);padding:0}.aah-btn-small.aah-btn-icon{width:var(--control-h-sm)}.aah-btn-danger{color:var(--c-danger)}.aah-btn-danger:hover:enabled{background:var(--c-danger-soft);border-color:var(--c-danger)}.aah-btn-danger-solid{background:var(--c-danger);border-color:var(--c-danger);color:#fff}.aah-btn-danger-solid:hover:enabled{filter:brightness(.94);background:var(--c-danger);border-color:var(--c-danger)}.aah-tag{display:inline-flex;align-items:center;gap:var(--s-1);height:20px;padding:0 6px;border-radius:var(--r-xs);font-size:var(--font-sm);font-weight:var(--fw-medium);line-height:1;white-space:nowrap;color:var(--c-text-secondary);background:var(--c-bg-subtle);border:1px solid var(--c-border-base)}button.aah-tag:hover{border-color:var(--c-border-strong);color:var(--c-text-primary)}.aah-tag-primary{background:var(--c-primary-soft);color:var(--c-primary);border-color:transparent}.aah-tag-success{background:var(--c-success-soft);color:var(--c-success);border-color:transparent}.aah-tag-warning{background:var(--c-warning-soft);color:var(--c-warning);border-color:transparent}.aah-tag-danger{background:var(--c-danger-soft);color:var(--c-danger);border-color:transparent}.aah-input,.aah-select{width:100%;min-height:var(--control-h);padding:4px var(--s-3);border-radius:var(--r-sm);border:1px solid var(--c-border-base);background:var(--c-bg-surface);color:var(--c-text-primary);font-size:var(--font-base);transition:border-color var(--dur-fast) var(--ease-out),box-shadow var(--dur-fast) var(--ease-out)}.aah-input::placeholder,.floating-wrapper textarea::placeholder,.floating-wrapper input::placeholder{color:var(--c-text-muted)}.aah-input:hover:enabled,.aah-select:hover:enabled{border-color:var(--c-border-strong)}.aah-input:focus,.aah-select:focus{outline:none;border-color:var(--c-primary);box-shadow:0 0 0 3px var(--c-primary-soft)}.aah-input:disabled,.aah-select:disabled{color:var(--c-text-disabled);background:var(--c-bg-subtle)}.aah-input.recording{border-color:var(--c-primary);box-shadow:0 0 0 3px var(--c-primary-ring)}.aah-select{cursor:pointer}.aah-alert{display:flex;align-items:flex-start;gap:var(--s-2);padding:var(--s-2) var(--s-3);border-radius:var(--r-sm);font-size:var(--font-sm);line-height:1.6;color:var(--c-text-primary);background:var(--c-bg-subtle)}.aah-alert-info{background:var(--c-info-soft)}.aah-alert-success{background:var(--c-success-soft)}.aah-alert-warning{background:var(--c-warning-soft)}.aah-alert-danger{background:var(--c-danger-soft)}.aah-alert-warning svg{color:var(--c-warning)}.aah-alert-danger svg{color:var(--c-danger)}.aah-alert-info svg{color:var(--c-info)}.aah-section-title{display:flex;align-items:center;gap:6px;margin:0 0 var(--s-2);font-size:var(--font-sm);font-weight:var(--fw-semibold);color:var(--c-text-secondary)}.aah-section-title svg{width:14px;height:14px;color:var(--c-text-muted)}.aah-menu{position:absolute;z-index:var(--z-overlay);min-width:200px;padding:var(--s-1);background:var(--c-bg-surface);border:1px solid var(--c-border-base);border-radius:var(--r-md);box-shadow:var(--shadow-3)}.aah-menu-item{display:flex;flex-direction:column;align-items:flex-start;gap:1px;width:100%;padding:6px var(--s-3);border:0;border-radius:var(--r-xs);background:none;text-align:left;color:var(--c-text-primary)}.aah-menu-item:hover{background:var(--c-bg-hover)}.aah-menu-item small{color:var(--c-text-muted);font-size:var(--font-xs)}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}.aah-slider{width:100%;accent-color:var(--c-primary)}.radio-group{display:flex;gap:var(--s-3)}.radio-item{display:inline-flex;align-items:center;gap:var(--s-1);cursor:pointer}.floating-wrapper[data-theme=dark] .aah-btn-danger-solid{color:#1f0b0a}.floating-wrapper[data-theme=dark] :is(.panel-body,.notice-full) img:not(.panel-avatar,.user-page__avatar){padding:2px;border-radius:var(--r-xs);background-color:#fff}', '.floating-wrapper{position:fixed;top:0;right:0;bottom:0;left:0;pointer-events:none;z-index:999999}.el_wrapper>.floating-wrapper,.el_wrapper>div,.el_wrapper>div>div{pointer-events:none;z-index:999999!important}.floating-dialog{position:fixed;display:flex;flex-direction:column;height:min(720px,calc(100vh - 80px));max-width:calc(100vw - 32px);pointer-events:auto!important;overflow:hidden;background:var(--c-bg-base);border:1px solid var(--c-border-base);border-radius:var(--r-lg);box-shadow:var(--shadow-4);container:panel / inline-size;z-index:999999}.panel-head{display:flex;align-items:center;gap:var(--s-2);height:44px;flex:none;padding:0 var(--s-2) 0 var(--s-4);cursor:move;-webkit-user-select:none;user-select:none}.panel-brand{display:flex;align-items:center;gap:7px;min-width:0;flex:none}.panel-brand img{width:18px;height:18px;border-radius:4px}.panel-name{font-size:var(--font-md);font-weight:var(--fw-semibold);letter-spacing:-.01em;white-space:nowrap}.panel-version{font-size:var(--font-xs);color:var(--c-text-muted)}.panel-status{display:inline-flex;align-items:center;gap:5px;height:22px;padding:0 8px;margin-left:var(--s-1);border:1px solid var(--c-border-base);border-radius:var(--r-full);background:var(--c-bg-surface);font-size:var(--font-sm);color:var(--c-text-secondary);white-space:nowrap}.panel-status:hover{border-color:var(--c-border-strong);color:var(--c-text-primary)}.panel-status.is-run{color:var(--c-primary);border-color:var(--c-primary-ring);background:var(--c-primary-soft)}.panel-status.is-done{color:var(--c-success)}.panel-status.is-idle{color:var(--c-text-muted)}.panel-spacer{flex:1}.panel-actions{display:flex;align-items:center;gap:2px;flex:none}.panel-tool,.panel-account,.panel-icon-btn{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 8px;border:0;border-radius:var(--r-sm);background:transparent;color:var(--c-text-secondary);white-space:nowrap;transition:background-color var(--dur-fast) var(--ease-out),color var(--dur-fast) var(--ease-out)}.panel-tool:hover,.panel-account:hover,.panel-icon-btn:hover{background:var(--c-bg-hover);color:var(--c-text-primary)}.panel-tool svg,.panel-icon-btn svg{width:16px;height:16px}.panel-tool.is-on{background:var(--c-primary-soft);color:var(--c-primary)}.panel-icon-btn{width:28px;padding:0;justify-content:center}.panel-avatar{width:20px;height:20px;border-radius:50%;object-fit:cover;color:var(--c-text-muted)}.panel-account-name{max-width:96px;overflow:hidden;text-overflow:ellipsis;color:var(--c-text-primary)}.panel-account-score{font-size:var(--font-sm);color:var(--c-text-muted)}@container panel (max-width: 639px){.panel-version,.panel-tool-label,.panel-account-name{display:none}.panel-tool{width:28px;padding:0;justify-content:center}}@container panel (max-width: 519px){.panel-account-score{display:none}}.notice-bar{flex:none;margin:0 var(--s-3) var(--s-2);border-radius:var(--r-sm);background:var(--c-bg-subtle)}.notice-row{display:flex;align-items:center;gap:var(--s-2);height:32px;padding:0 4px 0 var(--s-3)}.notice-icon{flex:none;width:15px;height:15px;color:var(--c-primary)}.notice-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--font-sm);color:var(--c-text-secondary)}.notice-full{max-height:180px;overflow:auto;padding:0 var(--s-3) var(--s-3) 33px;font-size:var(--font-sm);line-height:1.7;color:var(--c-text-secondary)}.notice-full img{max-width:100%;height:auto}.panel-nav{display:flex;gap:var(--s-1);flex:none;padding:0 var(--s-3);border-bottom:1px solid var(--c-border-base)}.panel-nav-item{position:relative;display:inline-flex;align-items:center;gap:6px;height:36px;padding:0 var(--s-2);border:0;background:none;color:var(--c-text-muted);font-size:var(--font-md);font-weight:var(--fw-medium)}.panel-nav-item:hover{color:var(--c-text-primary)}.panel-nav-item:after{content:"";position:absolute;left:var(--s-2);right:var(--s-2);bottom:-1px;height:2px;border-radius:2px 2px 0 0;background:transparent;transition:background-color var(--dur-base) var(--ease-out)}.panel-nav-item.is-active{color:var(--c-text-primary)}.panel-nav-item.is-active:after{background:var(--c-primary)}.panel-nav-count{font-size:var(--font-xs);font-weight:var(--fw-regular);color:var(--c-text-muted)}.panel-body{position:relative;flex:1 1 auto;min-height:0}.area{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;min-height:0}.area .scroll{min-height:0;overflow:auto;overscroll-behavior:contain}.area-foot{display:flex;align-items:center;gap:var(--s-2);min-height:48px;padding:var(--s-2) var(--s-3) var(--s-2) var(--s-4);border-top:1px solid var(--c-border-base);background:var(--c-bg-base)}.area-foot-spacer{flex:1}.area-foot-pop,.lib-menu-wrap{position:relative}.area-foot-pop .aah-menu,.lib-menu-wrap .aah-menu{right:0;bottom:calc(100% + 6px)}.search-sheet,.area-sheet{position:absolute;top:0;right:0;bottom:0;left:0;z-index:var(--z-overlay);display:flex;flex-direction:column;background:var(--c-bg-base);animation:sheet-in var(--dur-slow) var(--ease-out)}.search-sheet-head,.area-sheet-head{display:flex;align-items:center;gap:var(--s-2);flex:none;height:44px;padding:0 var(--s-2) 0 var(--s-4);border-bottom:1px solid var(--c-border-subtle)}.area-sheet-head{padding-left:var(--s-2)}.search-sheet-head h2,.area-sheet-head h2{margin:0;font-size:var(--font-md);font-weight:var(--fw-semibold)}.search-sheet-hint{flex:1;font-size:var(--font-sm);color:var(--c-text-muted)}.search-sheet-body,.area-sheet-body{flex:1;min-height:0;overflow:auto}@keyframes sheet-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}.floating-resize-handle{position:absolute;right:2px;bottom:2px;z-index:var(--z-overlay);width:14px;height:14px;cursor:nwse-resize;-webkit-user-select:none;user-select:none;background-image:linear-gradient(135deg,transparent 45%,var(--c-border-strong) 45%,var(--c-border-strong) 55%,transparent 55%),linear-gradient(135deg,transparent 70%,var(--c-border-strong) 70%,var(--c-border-strong) 80%,transparent 80%);opacity:.8}.floating-resize-handle:hover{opacity:1}.mini-ball-dock{position:fixed;right:20px;bottom:20px;z-index:9999999;display:flex;align-items:center;gap:var(--s-3);pointer-events:none}.mini-ball,.mini-bubble{pointer-events:auto}.mini-ball{--p: 0;position:relative;display:grid;place-items:center;width:56px;height:56px;padding:0;border:0;border-radius:50%;background:transparent;transition:transform var(--dur-base) var(--ease-out)}.mini-ball:hover{transform:translateY(-2px)}.mini-ball img{width:52px;height:52px;filter:drop-shadow(0 2px 6px rgba(20,24,33,.25))}.mini-ball.has-progress:before{content:"";position:absolute;top:-3px;right:-3px;bottom:-3px;left:-3px;border-radius:50%;background:conic-gradient(var(--c-primary) calc(var(--p) * 1%),rgba(20,24,33,.18) 0);-webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 3px),#000 calc(100% - 2.5px));mask:radial-gradient(farthest-side,transparent calc(100% - 3px),#000 calc(100% - 2.5px))}.mini-ball-value{position:absolute;left:50%;bottom:-10px;transform:translate(-50%);padding:0 6px;border-radius:var(--r-full);background:var(--c-bg-surface);box-shadow:var(--shadow-3);font-size:var(--font-xs);font-weight:var(--fw-semibold);line-height:16px;color:var(--c-text-primary);white-space:nowrap}.mini-ball-value small{font-size:var(--font-xs);font-weight:var(--fw-regular);color:var(--c-text-muted)}.mini-ball-badge{position:absolute;top:-2px;right:-2px;min-width:18px;height:18px;padding:0 5px;border-radius:var(--r-full);border:2px solid var(--c-bg-surface);background:var(--c-danger);color:#fff;font-size:var(--font-xs);font-weight:var(--fw-semibold);line-height:14px}.mini-bubble{display:flex;flex-direction:column;gap:2px;max-width:240px;padding:var(--s-2) var(--s-3);border:1px solid var(--c-border-base);border-radius:var(--r-md);background:var(--c-bg-surface);box-shadow:var(--shadow-3);text-align:left;font-size:var(--font-sm);color:var(--c-text-secondary);animation:sheet-in var(--dur-slow) var(--ease-out)}.mini-bubble strong{font-size:var(--font-base);font-weight:var(--fw-semibold);color:var(--c-text-primary)}.mini-bubble:hover{border-color:var(--c-border-strong)}.panel-kbd{margin-left:2px}@container panel (max-width: 639px){.panel-tool .panel-kbd{display:none}}', ".modal-mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--z-modal);display:grid;place-items:center;padding:var(--s-4);background:#14182147;animation:sheet-in var(--dur-base) var(--ease-out)}.floating-wrapper[data-theme=dark] .modal-mask{background:#00000080}.modal-panel{display:flex;flex-direction:column;width:min(600px,100%);max-height:100%;border:1px solid var(--c-border-base);border-radius:var(--r-lg);background:var(--c-bg-surface);box-shadow:var(--shadow-4)}.modal-header{display:flex;align-items:center;justify-content:space-between;flex:none;height:48px;padding:0 var(--s-2) 0 var(--s-5);border-bottom:1px solid var(--c-border-subtle)}.modal-header h3{margin:0;font-size:var(--font-lg);font-weight:var(--fw-semibold)}.modal-body{display:flex;flex-direction:column;gap:var(--s-4);padding:var(--s-4) var(--s-5);overflow-y:auto}.modal-footer{display:flex;justify-content:flex-end;gap:var(--s-2);flex:none;padding:var(--s-3) var(--s-5);border-top:1px solid var(--c-border-subtle)}.modal-panel-large{width:min(760px,100%)}.form-row{display:flex;flex-direction:column;gap:6px}.form-row label{font-size:var(--font-sm);font-weight:var(--fw-medium);color:var(--c-text-secondary)}.form-row label small{margin-left:6px;font-weight:var(--fw-regular);color:var(--c-text-muted)}.option-list{display:flex;flex-direction:column;gap:6px}.option-row{display:flex;align-items:center;gap:var(--s-2)}.option-selector{display:inline-flex;align-items:center;justify-content:center;flex:none;width:var(--control-h);height:var(--control-h);border:1px solid var(--c-border-base);border-radius:var(--r-sm);background:var(--c-bg-surface);color:var(--c-text-muted);font-weight:var(--fw-semibold);transition:background-color var(--dur-fast) var(--ease-out),border-color var(--dur-fast) var(--ease-out),color var(--dur-fast) var(--ease-out)}.option-selector:hover{border-color:var(--c-border-strong);color:var(--c-text-primary)}.option-selector.active{border-color:var(--c-primary);background:var(--c-bg-selected);color:var(--c-primary)}.reading-form-section+.reading-form-section{padding-top:var(--s-4);border-top:1px solid var(--c-border-base)}.reading-section-header{display:flex;align-items:center;gap:var(--s-2);margin-bottom:var(--s-3)}.reading-section-icon{width:16px;height:16px;color:var(--c-text-muted)}.reading-section-header h4{flex:1;margin:0;font-size:var(--font-md);font-weight:var(--fw-semibold)}.reading-sub-questions-editor{display:flex;flex-direction:column}.reading-sub-question-editor{display:flex;flex-direction:column;gap:var(--s-3);padding:var(--s-3) 0;border-bottom:1px solid var(--c-border-subtle)}.reading-sub-question-header{display:flex;align-items:center;gap:var(--s-2)}.reading-sub-question-number{min-width:22px;font-size:var(--font-md);font-weight:var(--fw-semibold);font-variant-numeric:tabular-nums}.reading-base-select-small{width:auto;min-width:120px}.reading-answer-list{display:flex;flex-direction:column;gap:6px}.reading-answer-row{display:flex;align-items:center;gap:var(--s-2)}.confirm-layer{position:absolute;top:0;right:0;bottom:0;left:0;z-index:var(--z-modal);display:grid;place-items:center;padding:var(--s-5);background:#14182147;animation:sheet-in var(--dur-base) var(--ease-out)}.floating-wrapper[data-theme=dark] .confirm-layer{background:#00000080}.confirm-box{width:min(360px,100%);padding:var(--s-5);border:1px solid var(--c-border-base);border-radius:var(--r-lg);background:var(--c-bg-surface);box-shadow:var(--shadow-4)}.confirm-box h2{margin:0;font-size:var(--font-lg);font-weight:var(--fw-semibold)}.confirm-box p{margin:var(--s-2) 0 0;font-size:var(--font-base);line-height:1.6;color:var(--c-text-secondary)}.confirm-actions{display:flex;justify-content:flex-end;gap:var(--s-2);margin-top:var(--s-5)}", ".hljs{display:block;overflow-x:auto;padding:var(--s-3);border-radius:var(--r-sm);font-family:ui-monospace,SF Mono,Consolas,monospace;font-size:var(--font-sm);line-height:1.5}.floating-wrapper:not([data-theme=dark]) .hljs{background:#f6f8fa;color:#24292f;box-shadow:var(--shadow-1)}.floating-wrapper:not([data-theme=dark]) .hljs-keyword,.floating-wrapper:not([data-theme=dark]) .hljs-selector-tag,.floating-wrapper:not([data-theme=dark]) .hljs-built_in{color:#cf222e}.floating-wrapper:not([data-theme=dark]) .hljs-string,.floating-wrapper:not([data-theme=dark]) .hljs-attr{color:#0a3069}.floating-wrapper:not([data-theme=dark]) .hljs-number,.floating-wrapper:not([data-theme=dark]) .hljs-literal{color:#0550ae}.floating-wrapper:not([data-theme=dark]) .hljs-comment{color:#6e7781;font-style:italic}.floating-wrapper:not([data-theme=dark]) .hljs-title,.floating-wrapper:not([data-theme=dark]) .hljs-name{color:#8250df}.floating-wrapper[data-theme=dark] .hljs{background:#1f1f23;color:#f0f6fc;box-shadow:var(--shadow-1)}.floating-wrapper[data-theme=dark] .hljs-keyword,.floating-wrapper[data-theme=dark] .hljs-selector-tag,.floating-wrapper[data-theme=dark] .hljs-built_in{color:#ff7b72}.floating-wrapper[data-theme=dark] .hljs-string,.floating-wrapper[data-theme=dark] .hljs-attr{color:#a5d6ff}.floating-wrapper[data-theme=dark] .hljs-number,.floating-wrapper[data-theme=dark] .hljs-literal{color:#79c0ff}.floating-wrapper[data-theme=dark] .hljs-comment{color:#8b949e;font-style:italic}.floating-wrapper[data-theme=dark] .hljs-title,.floating-wrapper[data-theme=dark] .hljs-name{color:#d2a8ff}", ".segmented{display:inline-flex;padding:2px;gap:2px;background:var(--c-bg-base);border:1px solid var(--c-border-subtle);border-radius:var(--r-sm)}.segment-item{padding:var(--s-1) var(--s-3);border:none;border-radius:calc(var(--r-sm) - 2px);background:transparent;color:var(--c-text-muted);font-size:var(--font-sm);font-weight:var(--fw-medium);cursor:pointer;transition:background-color var(--dur-fast) var(--ease-out),color var(--dur-fast) var(--ease-out)}.segment-item.active{background:var(--c-bg-surface);color:var(--c-primary);box-shadow:var(--shadow-1)}.segment-item:focus-visible{outline:2px solid var(--c-primary-ring);outline-offset:2px}", '.switch{position:relative;display:inline-block;width:32px;height:18px;flex:none;cursor:pointer}.switch.disabled{cursor:not-allowed;opacity:.5}.switch input{position:absolute;opacity:0;width:0;height:0}.switch-slider{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--c-border-strong);border-radius:var(--r-full);transition:background-color var(--dur-base) var(--ease-out)}.switch-slider:before{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;background:#fff;border-radius:50%;box-shadow:0 1px 2px #14182133;transition:transform var(--dur-base) var(--ease-spring)}.switch input:checked+.switch-slider{background:var(--c-primary)}.switch input:checked+.switch-slider:before{transform:translate(14px)}.switch input:focus-visible+.switch-slider{box-shadow:0 0 0 3px var(--c-primary-ring)}', '.settings-rows{display:flex;flex-direction:column}.config-item{padding:12px 0;border-bottom:1px solid var(--c-border-subtle)}.config-item:last-child{border-bottom:0}.config-item-content{display:flex;justify-content:space-between;align-items:center;gap:16px}.config-label{display:flex;align-items:flex-start;gap:8px;flex:1;min-width:0}.label-wrapper{display:flex;flex-direction:column;gap:2px}.label-text{font-size:var(--font-base);font-weight:var(--fw-medium);color:var(--c-text-primary)}.label-desc{font-size:var(--font-sm);color:var(--c-text-muted);line-height:1.5;white-space:pre-line}.settings-range{min-width:220px}.settings-range .aah-slider{width:150px}.settings-range .num{min-width:56px;text-align:right;color:var(--c-text-secondary);font-size:var(--font-sm)}.config-control{display:flex;align-items:center;flex-shrink:0;gap:10px;flex-wrap:wrap;justify-content:flex-end}.checkbox-group{display:flex;flex-wrap:wrap;gap:10px}.alert-icon{flex:none;width:16px;height:16px}.base-input,.base-select{min-width:180px;min-height:var(--control-h);padding:4px 10px;border:1px solid var(--c-border-base);border-radius:var(--r-sm);background:var(--c-bg-surface);color:var(--c-text-primary);font-size:var(--font-base);transition:border-color .2s ease,box-shadow .2s ease}.base-input:focus,.base-select:focus{outline:none;border-color:var(--c-primary);box-shadow:0 0 0 3px var(--c-primary-soft)}.base-select{min-width:160px}.checkbox-item{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:var(--r-sm);background:var(--c-bg-subtle);border:1px solid var(--c-border-subtle)}.hotkey-input-wrapper{position:relative;display:inline-flex;align-items:center;gap:8px}.hotkey-input-wrapper .hotkey-hint{font-size:var(--font-sm);color:var(--c-text-muted);background:var(--c-bg-subtle);padding:2px 8px;border-radius:var(--r-xs)}.hotkey-input-wrapper .hotkey-hint.danger{color:var(--c-danger);background:var(--c-danger-soft)}.hotkey-input-wrapper .base-input.recording{border-color:var(--c-danger);box-shadow:0 0 0 3px var(--c-danger-soft)}.hotkey-input-wrapper .base-input{cursor:pointer}.ai-config-panel{container-type:inline-size;container-name:aipanel;display:flex;flex-direction:column;gap:var(--s-4)}.ai-config-panel .aah-card{padding:0;border:0;border-radius:0;background:none}.ai-config-section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--s-2);flex-wrap:wrap}.ai-config-section-head h4{margin:0;font-size:var(--font-md);font-weight:var(--fw-semibold)}.ai-config-section-head p{margin:2px 0 0;color:var(--c-text-muted);font-size:var(--font-sm)}.ai-wizard{display:flex;flex-direction:column;gap:var(--s-4)}.ai-wizard-head{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--s-2)}.ai-wizard-head h4{margin:0;font-size:var(--font-md);font-weight:var(--fw-semibold)}.ai-wizard-head p{margin:2px 0 0;color:var(--c-text-muted);font-size:var(--font-sm)}.ai-wizard-count{color:var(--c-text-muted);font-size:var(--font-sm);font-variant-numeric:tabular-nums}.ai-wizard-steps{display:flex;align-items:center;gap:var(--s-5);margin:0;padding:0 0 var(--s-3);list-style:none;border-bottom:1px solid var(--c-border-base);color:var(--c-text-muted);font-size:var(--font-sm)}.ai-wizard-steps li{position:relative;display:flex;align-items:center;gap:6px}.ai-wizard-steps li+li:before{content:"";position:absolute;left:calc(-1 * var(--s-5) + 4px);width:calc(var(--s-5) - 8px);height:1px;background:var(--c-border-strong)}.ai-wizard-dot{width:8px;height:8px;border-radius:var(--r-full);border:1.5px solid var(--c-text-disabled)}.ai-wizard-steps li.done .ai-wizard-dot{border-color:var(--c-success);background:var(--c-success)}.ai-wizard-steps li.current{color:var(--c-text-primary);font-weight:var(--fw-medium)}.ai-wizard-steps li.current .ai-wizard-dot{border-color:var(--c-primary);background:var(--c-primary)}.ai-wizard-body{display:flex;flex-direction:column;gap:var(--s-3)}.ai-wizard-subject{margin:0;font-size:var(--font-md);font-weight:var(--fw-semibold)}.ai-wizard-actions{display:flex;align-items:center;gap:var(--s-2);flex-wrap:wrap}.ai-config-card-pick{width:100%;text-align:left;cursor:pointer;font:inherit;color:inherit}.ai-config-card-pick:hover{background:var(--c-bg-hover)}.ai-config-card-tags{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.ai-config-channel-list{display:flex;flex-direction:column;gap:1px}.ai-config-channel-item{width:100%;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:var(--s-2);min-height:40px;padding:6px var(--s-2);border:0;border-radius:var(--r-sm);background:none;color:var(--c-text-secondary);text-align:left;cursor:pointer}.ai-config-channel-item:hover{background:var(--c-bg-hover)}.ai-config-channel-item.active{background:var(--c-bg-selected);color:var(--c-text-primary)}.ai-config-channel-item.orphan{opacity:.6}.ai-config-channel-text{min-width:0;display:flex;flex-direction:column;gap:1px}.ai-config-channel-text strong,.ai-config-channel-text small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ai-config-channel-text strong{font-weight:var(--fw-medium)}.ai-config-channel-text small{color:var(--c-text-muted);font-size:var(--font-xs)}.ai-config-channel-grid{display:flex;flex-direction:column;border-top:1px solid var(--c-border-subtle)}.ai-config-card{display:flex;flex-direction:column;gap:6px;padding:var(--s-3) var(--s-2);border:0;border-bottom:1px solid var(--c-border-subtle);border-radius:0;background:none}.ai-config-card.recommended{background:var(--c-bg-selected)}.ai-config-card-head{display:flex;align-items:center;gap:var(--s-2);flex-wrap:wrap;font-weight:var(--fw-medium)}.ai-config-card-promo{margin:0;color:var(--c-text-muted);font-size:var(--font-sm)}.ai-config-card-actions,.ai-config-instance-actions{display:flex;align-items:center;gap:var(--s-2);flex-wrap:wrap}.ai-config-instance-remove{align-self:flex-start}@container aipanel (min-width: 560px){.ai-config-channel-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:var(--s-4)}}@container aipanel (min-width: 820px){.ai-config-channel-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}.ai-config-manager{display:flex;flex-direction:column;gap:var(--s-4)}.ai-config-side{min-width:0;display:flex;flex-direction:column;gap:var(--s-4)}.ai-config-list-panel,.ai-config-global,.ai-config-detail{min-width:0;display:flex;flex-direction:column;gap:var(--s-3)}.ai-config-global{padding-top:var(--s-3);border-top:1px solid var(--c-border-base)}.ai-config-side-actions{display:flex;align-items:center;gap:var(--s-2);flex-wrap:wrap}.ai-config-inline-action{padding:0;border:none;background:none;color:var(--c-primary);font:inherit;font-weight:var(--fw-medium);cursor:pointer;text-decoration:underline;text-underline-offset:2px}.ai-config-collapse{width:100%;display:flex;align-items:center;justify-content:space-between;gap:var(--s-2);padding:0;border:none;background:none;color:var(--c-text-primary);font:inherit;font-weight:var(--fw-semibold);cursor:pointer}.ai-config-global-body{display:flex;flex-direction:column;gap:var(--s-3)}.ai-config-detail-empty{min-height:200px;align-items:center;justify-content:center;text-align:center}.ai-config-empty-icon{width:28px;height:28px;color:var(--c-text-muted)}.ai-config-add-modal{width:min(760px,100%)}@container aipanel (min-width: 720px){.ai-config-manager{display:grid;grid-template-columns:minmax(200px,240px) minmax(0,1fr);gap:0;align-items:start}.ai-config-side{padding-right:var(--s-4)}.ai-config-detail{min-height:100%;padding-left:var(--s-5);border-left:1px solid var(--c-border-base)}}.ai-config-delete-modal{width:min(420px,100%)}.ai-config-delete-text{margin:0;color:var(--c-text-secondary);line-height:1.6}.ai-config-field{min-width:0;display:flex;flex-direction:column;gap:6px}.ai-config-field span{color:var(--c-text-secondary);font-size:var(--font-sm);font-weight:var(--fw-medium)}.ai-config-field-help{margin:0;color:var(--c-text-muted);font-size:var(--font-sm);line-height:1.55}.ai-config-field-help a{margin-left:var(--s-1);color:var(--c-primary);font-weight:var(--fw-medium);text-decoration:none}.ai-config-field-help a:hover{text-decoration:underline}@container panel (max-width: 519px){.config-item-content{flex-direction:column;align-items:flex-start}.config-control{width:100%;justify-content:flex-start}}', '.user-page{display:flex;flex-direction:column;gap:var(--s-4);max-width:560px}.user-page__tabs{display:flex;gap:var(--s-4);border-bottom:1px solid var(--c-border-base)}.user-page__tab{position:relative;height:32px;padding:0;border:0;background:none;color:var(--c-text-muted);font-weight:var(--fw-medium)}.user-page__tab:hover,.user-page__tab.is-active{color:var(--c-text-primary)}.user-page__tab.is-active:after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:2px;border-radius:2px 2px 0 0;background:var(--c-primary)}.user-page__form{display:flex;flex-direction:column;gap:var(--s-3)}.user-page__field{display:flex;flex-direction:column;gap:4px}.user-page__field>span{font-size:var(--font-sm);font-weight:var(--fw-medium);color:var(--c-text-secondary)}.user-page__form-actions{display:flex;flex-wrap:wrap;align-items:center;gap:var(--s-2) var(--s-4);margin-top:var(--s-1)}.user-page__form-actions .aah-btn{min-width:96px}.user-page__helper{font-size:var(--font-sm);color:var(--c-text-muted)}.user-page__link-btn{padding:0;border:0;background:none;color:var(--c-primary);font-size:inherit}.user-page__link-btn:hover{text-decoration:underline;text-underline-offset:2px}.user-page__avatar{flex:none;width:32px;height:32px;border-radius:50%;object-fit:cover;color:var(--c-text-muted)}.user-page__score{margin-left:6px;font-size:var(--font-lg);font-weight:var(--fw-semibold);color:var(--c-text-primary)}.user-page__apikey{margin-top:4px;font-family:var(--font-mono);font-size:var(--font-sm);color:var(--c-text-secondary);word-break:break-all}.user-page__tips{margin:0;font-size:var(--font-sm);color:var(--c-text-muted)}', '.ai-workbench{display:flex;flex-direction:column;min-height:100%}.ai-tabs{display:flex;align-items:center;gap:var(--s-4);padding:0 var(--s-3) 0 var(--s-4);border-bottom:1px solid var(--c-border-base)}.ai-tab{position:relative;height:36px;padding:0;border:0;background:none;color:var(--c-text-muted);font-weight:var(--fw-medium)}.ai-tab:hover,.ai-tab.is-active{color:var(--c-text-primary)}.ai-tab.is-active:after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:2px;border-radius:2px 2px 0 0;background:var(--c-primary)}.ai-tabs-spacer{flex:1}.ai-status{display:inline-flex;align-items:center;gap:6px;max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--font-sm);color:var(--c-text-secondary)}.ai-status i{flex:none;width:6px;height:6px;border-radius:50%;background:var(--c-success)}.ai-status.is-warning i{background:var(--c-warning)}.ai-split{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);flex:1;min-height:0}.ai-input{display:flex;flex-direction:column;gap:var(--s-3);padding:var(--s-4);border-right:1px solid var(--c-border-base)}.ai-field-label{font-size:var(--font-sm);font-weight:var(--fw-medium);color:var(--c-text-secondary)}.ai-textarea{width:100%;min-height:160px;padding:var(--s-2) var(--s-3);border:1px solid var(--c-border-base);border-radius:var(--r-sm);background:var(--c-bg-surface);color:var(--c-text-primary);line-height:1.6;resize:vertical}.ai-textarea:focus{outline:none;border-color:var(--c-primary);box-shadow:0 0 0 3px var(--c-primary-soft)}.ai-field-hint{margin:0;font-size:var(--font-sm);color:var(--c-text-muted)}.ai-command-row{display:flex;gap:var(--s-2)}.ai-service-details{margin-top:auto;font-size:var(--font-sm);color:var(--c-text-muted)}.ai-service-details summary{cursor:pointer}.ai-service-details .copyright-content{margin-top:var(--s-2);line-height:1.7}.ai-result{min-width:0;padding:var(--s-4) var(--s-5) var(--s-6)}.ai-result-head{display:flex;align-items:center;gap:var(--s-2);margin-bottom:var(--s-3)}.ai-result-head .aah-section-title{margin:0}.ai-result-note{font-size:var(--font-sm);color:var(--c-text-muted)}.ai-placeholder{margin:var(--s-6) 0;text-align:center;font-size:var(--font-sm);color:var(--c-text-muted)}.ai-placeholder.is-loading{color:var(--c-primary);animation:streaming-pulse 1.4s ease-in-out infinite}.ai-markdown{font-size:var(--font-base);line-height:1.75;overflow-wrap:anywhere}.ai-result>.aah-alert{margin-bottom:var(--s-3);align-items:center}.official-options li{display:flex;gap:var(--s-2)}.official-result-list{margin:0;padding:0;list-style:none}.official-result-item{display:flex;flex-direction:column;gap:var(--s-2);padding:var(--s-3) 0;border-bottom:1px solid var(--c-border-subtle)}.official-result-head{display:flex;align-items:center;gap:var(--s-2)}.official-result-num{font-weight:var(--fw-semibold);color:var(--c-text-muted)}.official-question{line-height:1.65;overflow-wrap:anywhere}.official-options{display:flex;flex-direction:column;gap:2px;margin:0;padding:0;list-style:none;font-size:var(--font-sm);color:var(--c-text-secondary)}.official-answer{display:flex;flex-wrap:wrap;align-items:center;gap:4px var(--s-2)}.official-answer-label{font-size:var(--font-sm);color:var(--c-text-muted)}@container panel (max-width: 719px){.ai-split{grid-template-columns:1fr}.ai-input{border-right:0;border-bottom:1px solid var(--c-border-base)}.ai-status{display:none}}', '.ask-area{grid-template-columns:minmax(240px,300px) 1fr;grid-template-rows:minmax(0,1fr) auto;grid-template-areas:"list detail" "foot foot"}.ask-area.is-empty{grid-template-columns:1fr;grid-template-rows:1fr;grid-template-areas:"detail"}.ask-list{grid-area:list}.ask-detail{grid-area:detail}.ask-strip{display:none}.ask-area>.area-foot{grid-area:foot}@container panel (max-width: 719px){.ask-area{grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr) auto;grid-template-areas:"strip" "detail" "foot"}.ask-list{display:none}.ask-strip{display:block;grid-area:strip}}.status-glyph{flex:none;display:block}.status-glyph.is-todo{color:var(--c-text-disabled)}.status-glyph.is-run{color:var(--c-primary)}.status-glyph.is-done{color:var(--c-success)}.status-glyph.is-none{color:var(--c-danger)}.status-glyph.is-wait{color:var(--c-warning)}.status-glyph-arc{transform-origin:7px 7px;animation:glyph-spin .9s linear infinite}@keyframes glyph-spin{to{transform:rotate(360deg)}}.ask-list{margin:0;padding:var(--s-1) 0;list-style:none;border-right:1px solid var(--c-border-base)}.ask-row{display:grid;grid-template-columns:22px 14px minmax(0,1fr) auto;align-items:center;gap:var(--s-2);height:var(--row-h);margin:0 var(--s-1);padding:0 var(--s-2);border-radius:var(--r-sm);cursor:pointer}.ask-row:hover{background:var(--c-bg-hover)}.ask-row.is-current{background:var(--c-bg-selected)}.ask-row-num{font-size:var(--font-sm);color:var(--c-text-muted)}.ask-row.is-current .ask-row-num{color:var(--c-primary);font-weight:var(--fw-semibold)}.ask-row-stem{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--c-text-secondary)}.ask-row.is-current .ask-row-stem{color:var(--c-text-primary)}.ask-row.is-todo .ask-row-stem{color:var(--c-text-muted)}.ask-row-src{max-width:84px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--font-xs);color:var(--c-text-muted)}.ask-row.is-none .ask-row-src{color:var(--c-danger)}.ask-row.is-wait .ask-row-src{color:var(--c-warning)}.ask-strip{max-height:166px;overflow:auto;-webkit-mask-image:linear-gradient(to bottom,#000 calc(100% - 14px),transparent);mask-image:linear-gradient(to bottom,#000 calc(100% - 14px),transparent);padding:var(--s-2) var(--s-4) var(--s-3);border-bottom:1px solid var(--c-border-base)}.ask-strip summary{display:flex;align-items:center;justify-content:space-between;cursor:pointer;font-size:var(--font-sm);font-weight:var(--fw-medium);color:var(--c-text-secondary);list-style:none}.ask-strip summary::-webkit-details-marker{display:none}.ask-strip-meta{font-weight:var(--fw-regular);color:var(--c-text-muted)}.ask-cells{display:grid;grid-template-columns:repeat(auto-fill,minmax(42px,1fr));gap:4px;margin-top:var(--s-2)}.ask-cell{display:inline-flex;align-items:center;justify-content:center;gap:3px;height:26px;padding:0;border:1px solid var(--c-border-subtle);border-radius:var(--r-xs);background:var(--c-bg-surface);font-size:var(--font-xs);color:var(--c-text-secondary)}.ask-cell:hover{border-color:var(--c-border-strong)}.ask-cell.is-current{border-color:var(--c-primary);background:var(--c-bg-selected);color:var(--c-primary);font-weight:var(--fw-semibold)}.ask-detail{padding:var(--s-4) var(--s-6) var(--s-6)}.ask-detail-head{display:flex;align-items:center;flex-wrap:wrap;gap:var(--s-2);margin-bottom:var(--s-4)}.ask-detail-num{font-size:var(--font-xl);font-weight:var(--fw-semibold);letter-spacing:-.02em;line-height:1}.ask-detail-state{display:inline-flex;align-items:center;gap:5px;font-size:var(--font-sm);color:var(--c-text-secondary)}.ask-detail-state.is-none{color:var(--c-danger)}.ask-detail-state.is-wait{color:var(--c-warning)}.ask-detail-actions{display:inline-flex;gap:var(--s-1);margin-left:auto}.ask-stem{margin-bottom:var(--s-3);font-size:var(--font-md);line-height:1.7;color:var(--c-text-primary);overflow-wrap:anywhere}.ask-stem img,.ask-option-text img{max-width:100%;height:auto;vertical-align:middle;border-radius:var(--r-xs)}.reading-passage{max-height:220px;overflow:auto;padding:var(--s-3);border-radius:var(--r-sm);background:var(--c-bg-subtle);font-size:var(--font-base)}.ask-sub{margin-top:var(--s-4)}.ask-sub-title{margin-bottom:var(--s-2);font-weight:var(--fw-medium)}.ask-option{display:flex;align-items:flex-start;gap:var(--s-2);padding:7px var(--s-3);margin-bottom:4px;border:1px solid var(--c-border-base);border-radius:var(--r-sm);line-height:1.55;overflow-wrap:anywhere}.ask-option-key{flex:none;width:14px;color:var(--c-text-muted);font-weight:var(--fw-medium)}.ask-option-text{flex:1;min-width:0}.ask-option.is-hit{border-color:var(--c-primary);background:var(--c-bg-selected)}.ask-option.is-hit .ask-option-key{color:var(--c-primary)}.ask-option-check{flex:none;width:16px;height:16px;margin-top:2px;color:var(--c-primary)}.ask-match-table{width:100%;margin-top:var(--s-2);border-collapse:collapse}.ask-match-table td{padding:6px var(--s-2);border-bottom:1px solid var(--c-border-subtle);vertical-align:middle}.ask-detail>.aah-alert{margin-top:var(--s-3)}.ask-preview{margin-top:var(--s-4);padding:var(--s-3) var(--s-4);border:1px dashed var(--c-warning);border-radius:var(--r-md);background:var(--c-warning-soft)}.ask-preview-head{display:flex;align-items:center;gap:6px;margin-bottom:var(--s-2)}.ask-preview-reason{font-size:var(--font-sm);color:var(--c-text-secondary)}.ask-preview-answer{font-size:var(--font-md);font-weight:var(--fw-semibold)}.ask-preview-note{margin:var(--s-2) 0;font-size:var(--font-sm);color:var(--c-text-secondary)}.ask-preview-actions{display:flex;gap:var(--s-2)}.ask-sources,.ask-ai{margin-top:var(--s-6)}.ask-source-table{border:1px solid var(--c-border-base);border-radius:var(--r-md);overflow:hidden}.ask-source-row{display:grid;grid-template-columns:minmax(92px,auto) minmax(0,1fr) auto;align-items:baseline;gap:var(--s-3);padding:8px var(--s-3);border-bottom:1px solid var(--c-border-subtle);font-size:var(--font-sm)}.ask-source-row:last-child{border-bottom:0}.ask-source-row.is-used{background:var(--c-bg-selected)}.ask-source-name{display:inline-flex;align-items:center;gap:6px;font-weight:var(--fw-medium);color:var(--c-text-primary);white-space:nowrap}.ask-source-name .aah-tag{height:18px;font-size:var(--font-xs)}.ask-source-answer{min-width:0;color:var(--c-text-primary);overflow-wrap:anywhere}.ask-source-answer .aah-btn{margin-left:var(--s-2)}.ask-source-miss{color:var(--c-text-muted)}.ask-source-time{font-size:var(--font-xs);color:var(--c-text-muted)}.ask-source-empty{margin:0;font-size:var(--font-sm);color:var(--c-text-muted)}.answer-field-html+.answer-field-html{margin-top:2px}.answer-field-html p{margin:0}.ask-ai-streaming{margin-left:var(--s-1);font-weight:var(--fw-regular);color:var(--c-primary);animation:streaming-pulse 1.4s ease-in-out infinite}@keyframes streaming-pulse{50%{opacity:.45}}.ai-answer-markdown{font-size:var(--font-base);color:var(--c-text-primary);line-height:1.7}.ask-empty{grid-area:detail;align-self:center;justify-self:center;max-width:420px;padding:var(--s-8);color:var(--c-text-secondary)}.ask-empty-icon{width:32px;height:32px;color:var(--c-text-muted)}.ask-empty h2{margin:var(--s-3) 0 var(--s-1);font-size:var(--font-lg);font-weight:var(--fw-semibold);color:var(--c-text-primary)}.ask-empty p{margin:0 0 var(--s-3)}.ask-empty ul{margin:0 0 var(--s-5);padding-left:18px;font-size:var(--font-sm);line-height:1.9;color:var(--c-text-muted)}.ask-empty-actions{display:flex;gap:var(--s-2)}.ask-empty-types{margin-top:var(--s-4);font-size:var(--font-sm);color:var(--c-text-secondary)}.ask-tally{display:flex;flex-wrap:wrap;gap:4px var(--s-4);font-size:var(--font-sm);color:var(--c-text-muted)}.ask-tally span{display:inline-flex;align-items:center;gap:5px}.ask-tally b{font-weight:var(--fw-semibold);color:var(--c-text-primary)}.ask-tally .is-none b{color:var(--c-danger)}.ask-tally .is-wait b{color:var(--c-warning)}.ask-run-btn{min-width:104px}.ask-tips{width:320px;max-height:360px;padding:var(--s-3) var(--s-4);font-size:var(--font-sm);line-height:1.7;color:var(--c-text-secondary)}.ask-tips-forms{display:flex;flex-wrap:wrap;gap:4px;margin:var(--s-2) 0}.ask-tips summary{cursor:pointer;color:var(--c-text-primary)}@container panel (max-width: 599px){.ask-tally{flex-wrap:nowrap;gap:var(--s-3)}.ask-tally i{display:none}.ask-detail{padding:var(--s-3) var(--s-4) var(--s-5)}}.native-checkbox{display:inline-flex;align-items:center;gap:var(--s-1);font-size:var(--font-sm);color:var(--c-text-primary);cursor:pointer}.native-checkbox input{width:16px;height:16px;accent-color:var(--c-primary)}.ask-chain{display:flex;flex-wrap:wrap;gap:4px var(--s-5);margin:0 0 var(--s-2);padding:0;list-style:none;font-size:var(--font-sm)}.ask-chain-step{position:relative;display:inline-flex;align-items:center;gap:6px;color:var(--c-text-secondary)}.ask-chain-step+.ask-chain-step:before{content:"";position:absolute;left:calc(-1 * var(--s-5) + 4px);width:calc(var(--s-5) - 8px);height:1px;background:var(--c-border-strong)}.ask-chain-dot{width:8px;height:8px;border-radius:50%;border:1.5px solid var(--c-text-disabled);transition:background-color var(--dur-base) var(--ease-out),border-color var(--dur-base) var(--ease-out)}.ask-chain-state{color:var(--c-text-muted)}.ask-chain-step.is-run .ask-chain-dot{border-color:var(--c-primary);background:var(--c-primary-soft);animation:streaming-pulse 1.2s ease-in-out infinite}.ask-chain-step.is-run .ask-chain-state{color:var(--c-primary)}.ask-chain-step.is-hit .ask-chain-dot{border-color:var(--c-success);background:var(--c-success)}.ask-chain-step.is-hit .ask-chain-state{color:var(--c-success);font-weight:var(--fw-medium)}.ask-chain-step.is-miss .ask-chain-dot{border-color:var(--c-danger)}.ask-chain-step.is-wait .ask-chain-dot{border-color:var(--c-warning);background:linear-gradient(90deg,var(--c-warning) 50%,transparent 50%)}.ask-chain-step.is-wait .ask-chain-state{color:var(--c-warning)}.ask-chain-step.is-off{color:var(--c-text-muted)}.ask-chain-step.is-off .ask-chain-dot{border-style:dashed}.ask-chain-hint{margin-bottom:var(--s-2)}.ask-tally i{font-style:normal}.floating-wrapper kbd{display:inline-flex;align-items:center;min-width:18px;height:18px;padding:0 4px;border:1px solid var(--c-border-base);border-bottom-width:2px;border-radius:var(--r-xs);background:var(--c-bg-subtle);font-family:var(--font-mono);font-size:var(--font-xs);color:var(--c-text-secondary)}', ".question-tool{display:flex;flex-direction:column;gap:var(--s-3);height:100%}.qt-hint{margin:0;font-size:var(--font-sm);color:var(--c-text-muted)}.qt-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--s-2) var(--s-4)}.qt-strategy{display:inline-flex;align-items:center;gap:var(--s-3);font-size:var(--font-sm)}.qt-strategy-label{color:var(--c-text-secondary)}.qt-radio{display:inline-flex;align-items:center;gap:4px;cursor:pointer}.qt-stats{font-size:var(--font-sm);color:var(--c-text-muted)}.qt-stats b{font-weight:var(--fw-semibold);color:var(--c-text-primary)}.qt-stats .qt-stat-error{color:var(--c-danger)}.qt-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);flex:1;min-height:360px;border:1px solid var(--c-border-base);border-radius:var(--r-md);overflow:hidden}.qt-textarea{width:100%;min-height:100%;padding:var(--s-3);border:0;border-right:1px solid var(--c-border-base);background:var(--c-bg-surface);color:var(--c-text-primary);font-family:var(--font-mono);font-size:var(--font-sm);line-height:1.7;resize:none}.qt-textarea:focus{outline:none;box-shadow:inset 0 0 0 2px var(--c-primary-soft)}.qt-preview{margin:0;padding:0 var(--s-3);list-style:none;overflow:auto;background:var(--c-bg-subtle)}.qt-empty{padding:var(--s-8) 0;text-align:center;font-size:var(--font-sm);color:var(--c-text-muted)}.qt-row{display:flex;flex-direction:column;gap:4px;padding:var(--s-3) 0;border-bottom:1px solid var(--c-border-base);font-size:var(--font-sm)}.qt-row-head{display:flex;align-items:center;gap:var(--s-2)}.qt-title-no{min-width:20px;font-weight:var(--fw-semibold);color:var(--c-text-muted)}.qt-status{margin-left:auto;color:var(--c-text-muted)}.qt-row.is-create .qt-status{color:var(--c-success)}.qt-row.is-overwrite .qt-status{color:var(--c-warning)}.qt-row.is-error .qt-status{color:var(--c-danger);font-weight:var(--fw-medium)}.qt-question{margin:0;color:var(--c-text-primary);line-height:1.6;overflow-wrap:anywhere}.qt-options{display:flex;flex-wrap:wrap;gap:2px var(--s-3);color:var(--c-text-secondary)}.qt-options .is-true{color:var(--c-primary);font-weight:var(--fw-medium)}.qt-answer{margin:0;color:var(--c-text-secondary)}.qt-error{margin:0;padding-left:16px;color:var(--c-danger)}@container panel (max-width: 719px){.qt-grid{grid-template-columns:1fr}.qt-textarea{min-height:220px;border-right:0;border-bottom:1px solid var(--c-border-base)}}", ".log-page{display:flex;flex-direction:column;gap:var(--s-2)}.log-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:var(--s-2);padding-bottom:var(--s-2);border-bottom:1px solid var(--c-border-base)}.log-count{font-size:var(--font-sm);color:var(--c-text-muted)}.log-list{margin:0;padding:0;list-style:none}.log-row{display:grid;grid-template-columns:148px 52px minmax(0,1fr);align-items:baseline;gap:var(--s-3);padding:6px 0;border-bottom:1px solid var(--c-border-subtle);font-size:var(--font-sm)}.log-time{color:var(--c-text-muted)}.log-level{display:inline-flex;align-items:center;gap:5px;color:var(--c-text-secondary)}.log-level i{width:6px;height:6px;border-radius:50%;background:var(--c-text-disabled)}.log-row-success .log-level i{background:var(--c-success)}.log-row-warning .log-level{color:var(--c-warning)}.log-row-warning .log-level i{background:var(--c-warning)}.log-row-error .log-level{color:var(--c-danger)}.log-row-error .log-level i{background:var(--c-danger)}.log-msg{min-width:0;color:var(--c-text-primary);line-height:1.5;overflow-wrap:anywhere}.log-empty{margin:var(--s-6) 0;text-align:center;font-size:var(--font-sm);color:var(--c-text-muted)}@container panel (max-width: 719px){.log-row{grid-template-columns:52px minmax(0,1fr)}.log-time{grid-column:1 / -1}}", ".lib-area{grid-template-rows:auto minmax(0,1fr) auto}.lib-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--s-2) var(--s-3);padding:var(--s-3) var(--s-4);border-bottom:1px solid var(--c-border-base)}.lib-search{display:flex;align-items:center;gap:6px;flex:1 1 220px;min-width:0;height:var(--control-h);padding:0 var(--s-3);border:1px solid var(--c-border-base);border-radius:var(--r-sm);background:var(--c-bg-surface);color:var(--c-text-muted);transition:border-color var(--dur-fast) var(--ease-out),box-shadow var(--dur-fast) var(--ease-out)}.lib-search:focus-within{border-color:var(--c-primary);box-shadow:0 0 0 3px var(--c-primary-soft)}.lib-search svg{flex:none;width:15px;height:15px}.lib-search input{flex:1;min-width:0;height:100%;border:0;outline:none;background:transparent;color:var(--c-text-primary)}.lib-search-state{font-size:var(--font-xs);white-space:nowrap}.lib-chips{display:flex;flex-wrap:wrap;gap:4px}.lib-chip{display:inline-flex;align-items:center;gap:4px;height:24px;padding:0 var(--s-2);border:1px solid var(--c-border-base);border-radius:var(--r-full);background:var(--c-bg-surface);font-size:var(--font-sm);color:var(--c-text-secondary)}.lib-chip:hover{border-color:var(--c-border-strong);color:var(--c-text-primary)}.lib-chip.is-on{border-color:var(--c-text-primary);background:var(--c-text-primary);color:var(--c-text-inverse)}.lib-chip.is-scope{border-style:dashed;border-color:var(--c-primary);color:var(--c-primary)}.lib-chip.is-scope.is-on{border-style:solid;background:var(--c-primary);border-color:var(--c-primary);color:var(--c-on-primary)}.lib-split{display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,1fr);min-height:0}.lib-list{padding:var(--s-1) 0}.lib-row{margin:0 var(--s-1)}.lib-row-main{display:grid;grid-template-columns:52px minmax(0,1fr);gap:1px var(--s-2);width:100%;padding:7px var(--s-2);border:0;border-radius:var(--r-sm);background:none;text-align:left}.lib-row-main:hover{background:var(--c-bg-hover)}.lib-row.is-current>.lib-row-main{background:var(--c-bg-selected)}.lib-row-type{grid-row:span 2;padding-top:1px;font-size:var(--font-xs);color:var(--c-text-muted)}.lib-row-stem{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--c-text-primary)}.lib-row-answer{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--font-sm);color:var(--c-text-muted)}.lib-row-inline{display:none}.lib-more{display:flex;width:calc(100% - 16px);margin:var(--s-2) var(--s-2) var(--s-3)}.lib-pane{padding:var(--s-4) var(--s-6) var(--s-6);border-left:1px solid var(--c-border-base)}.lib-pane-empty{margin:var(--s-8) 0;text-align:center;color:var(--c-text-muted)}@container panel (max-width: 719px){.lib-split{grid-template-columns:1fr}.lib-pane{display:none}.lib-row.is-current .lib-row-inline{display:block;padding:var(--s-2) var(--s-3) var(--s-4) calc(52px + var(--s-4))}}.lib-detail-head{display:flex;align-items:center;gap:var(--s-1);margin-bottom:var(--s-3)}.lib-detail-spacer{flex:1}.lib-detail-stem img{max-width:100%;height:auto;vertical-align:middle;border-radius:var(--r-xs)}.lib-detail-stem{margin-bottom:var(--s-3);font-size:var(--font-md);line-height:1.7;overflow-wrap:anywhere}.lib-detail-sub{margin-bottom:var(--s-3)}.lib-detail-sub-title{margin-bottom:6px;font-weight:var(--fw-medium)}.lib-detail-answer{margin-top:var(--s-5)}.lib-detail-answer-list{display:flex;flex-wrap:wrap;gap:4px}.lib-answer-chip{padding:2px var(--s-2);border-radius:var(--r-xs);background:var(--c-bg-selected);color:var(--c-primary);font-weight:var(--fw-medium)}.floating-wrapper .highlight{padding:0 1px;border-radius:2px;background:var(--c-warning-soft);color:inherit}.lib-empty{display:flex;flex-direction:column;align-items:center;gap:var(--s-2);padding:var(--s-10) var(--s-6);text-align:center;color:var(--c-text-muted)}.lib-empty p{margin:0;font-weight:var(--fw-medium);color:var(--c-text-primary)}.lib-empty span{max-width:320px;font-size:var(--font-sm)}.lib-empty-icon{width:28px;height:28px}.lib-count{font-size:var(--font-sm);color:var(--c-text-muted)}.lib-count b{color:var(--c-text-primary);font-weight:var(--fw-semibold)}.lib-uploading{margin-left:var(--s-2);color:var(--c-primary)}.lib-file-input{display:none}.lib-menu{min-width:240px}.lib-drop{position:absolute;inset:var(--s-2);z-index:var(--z-overlay);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--s-2);border:2px dashed var(--c-primary);border-radius:var(--r-md);background:color-mix(in srgb,var(--c-bg-base) 88%,transparent);color:var(--c-primary);pointer-events:none}.lib-drop svg{width:28px;height:28px}.lib-drop p{margin:0;font-weight:var(--fw-medium)}.lib-area .area-sheet-body .question-tool{padding:var(--s-4)}", ".settings-area{grid-template-columns:200px minmax(0,1fr)}.settings-nav{display:flex;flex-direction:column;gap:1px;padding:var(--s-3) var(--s-2);border-right:1px solid var(--c-border-base);background:var(--c-bg-subtle)}.settings-search{flex:none;margin-bottom:var(--s-2)}.settings-nav-item{display:flex;align-items:center;gap:var(--s-2);height:30px;padding:0 var(--s-2);border:0;border-radius:var(--r-sm);background:none;color:var(--c-text-secondary);text-align:left}.settings-nav-item svg{flex:none;width:16px;height:16px;color:var(--c-text-muted)}.settings-nav-item span{flex:1}.settings-nav-item:hover{background:var(--c-bg-hover);color:var(--c-text-primary)}.settings-nav-item.is-active{background:var(--c-bg-surface);color:var(--c-text-primary);font-weight:var(--fw-medium);box-shadow:inset 0 0 0 1px var(--c-border-base)}.settings-nav-item.is-active svg{color:var(--c-primary)}.settings-nav-chevron{display:none}.settings-nav-empty{margin:var(--s-3) var(--s-2);font-size:var(--font-sm);color:var(--c-text-muted)}.settings-pane{padding:var(--s-5) var(--s-6) var(--s-8)}.settings-back{display:none;margin:0 0 var(--s-2) -6px}.settings-pane-head{margin-bottom:var(--s-3)}.settings-pane-head h2{margin:0;font-size:var(--font-lg);font-weight:var(--fw-semibold)}.settings-pane-head p{margin:2px 0 0;font-size:var(--font-sm);color:var(--c-text-muted)}.settings-group-title{margin-top:var(--s-6);padding-bottom:var(--s-1);border-bottom:1px solid var(--c-border-base)}.settings-pane-head+.settings-group-title{margin-top:var(--s-2)}.settings-notice-body{font-size:var(--font-sm);line-height:1.7;color:var(--c-text-secondary)}.settings-notice-body img{max-width:100%;height:auto}@container panel (max-width: 719px){.settings-area{grid-template-columns:1fr}.settings-nav{border-right:0;background:var(--c-bg-base);padding:var(--s-3) var(--s-3)}.settings-nav-item{height:40px;border-bottom:1px solid var(--c-border-subtle);border-radius:0}.settings-nav-item.is-active{background:none;box-shadow:none;font-weight:var(--fw-regular)}.settings-nav-chevron{display:block}.settings-area.is-drilled .settings-nav{display:none}.settings-area:not(.is-drilled) .settings-pane{display:none}.settings-back{display:inline-flex}.settings-pane{padding:var(--s-3) var(--s-4) var(--s-6)}}" ].join("\n"), jm = "__aiAskHookedXHRSend", installXHRHook = (e, t) => { const n = Object.getOwnPropertyDescriptor(e.prototype, "send"), a = (null == n ? void 0 : n.value) ?? e.prototype.send; if ("function" == typeof (i = a) && true === i[jm]) return false; var i; if ("function" != typeof a) return false; if (false === (null == n ? void 0 : n.configurable) && false === n.writable) return false; const s = a, hookedSend = function(e) { return this.addEventListener("readystatechange", (function() { t.call(this, this); })), s.call(this, e); }; return Object.defineProperty(hookedSend, jm, { value: true }), Object.defineProperty(e.prototype, "send", { configurable: false, writable: false, value: hookedSend }), true; }, get_href = () => location.href, comHook = () => { if (hookXHR(), /onlineexamh5new.zhihuishu.com/i.test(get_href())) { const e = se.yxyz; se.yxyz = function(t, n) { !se.yxyzpush && (se.yxyzpush = []); let a = e(t, n); return se.yxyzpush.push({ ...t, data: a }), a; }; } if (/icve.com.cn/i.test(get_href()) || /courshare.cn/i.test(get_href()) || /webtrn.cn/i.test(get_href())) { const e = se.open; se.open = function() { return arguments[2] = "", e.apply(this, arguments); }; } if (/ytccr.com/i.test(get_href())) { const e = localStorage.getItem; localStorage.getItem = function(t) { if ("_debugger" === t) return true; return e.apply(this, arguments); }; } if (/91huayi.com/i.test(get_href())) { const e = se.$.cookie; se.$.cookie = function(t, n, a) { return console.log("Cookie\u64cd\u4f5c:", t, n, a), t.startsWith("switchTime") && void 0 !== n ? (n = void 0, e.apply(this, [ t, n, a ])) : e.apply(this, arguments); }; } }, hookXHR = () => { installXHRHook(XMLHttpRequest, (function() { var e; switch (true) { case /geovisearth\.com/i.test(location.host): if (4 === this.readyState && this.responseURL && this.responseURL.includes("/education/exam/startExam")) try { const e = "string" == typeof this.response ? this.response : this.responseText, t = JSON.parse(e), n = t && t.data ? Object.values(t.data) : []; n.length > 0 && (se.antaiques = n, n.length, waitUntil((() => O(".n-card.n-modal .el-carousel__item").length > 0), { timeout: 15e3 }).then((() => vuePageChange())).catch((() => {}))); } catch (t) {} break; case /onlineexamh5new.zhihuishu.com/i.test(get_href()): if (4 === this.readyState && this.responseURL && /\/student\/(doHomework|doExam)/i.test(this.responseURL)) try { const e = "string" == typeof this.response ? this.response : this.responseText; if (!e || !e.includes("workExamParts")) break; const t = JSON.parse(e), n = t.rt || t, a = extractZhihuishuExamQuestions(n).length; a > 0 && (se.zhsques = n); } catch (t) {} break; case /icve.com.cn/i.test(location.host): 4 === this.readyState && this.responseURL && (this.responseURL.includes("examRecordPaperList") || this.responseURL.includes("queryXsDtjgSjInfo")) && JSON.parse(this.response); break; case /qingshuxuetang.com/i.test(get_href()): if (4 === this.readyState && (this.responseURL.includes("Student/DetailData") || this.responseURL.includes("Student/SimulationExercise/DetailData") || this.responseURL.includes("Student/Quiz/DetailData"))) { const e = JSON.parse(this.response); se.qsques = e.data.paperDetail.questions, e.data.paperDetail.questions; } break; case /bgzk-edu\.cn/i.test(location.host): if (4 === this.readyState && this.responseURL && this.responseURL.includes("/student/course/quiz/detail")) try { const t = "string" == typeof this.response ? this.response : this.responseText, n = JSON.parse(t), a = null == (e = null == n ? void 0 : n.data) ? void 0 : e.studentQuestions; Array.isArray(a) && a.length > 0 && (se.bgzkquiz = n.data, se.bgzkques = a, a.length); } catch (t) {} break; case /cce.org.uooconline.com/i.test(get_href()): if (4 === this.readyState && this.responseURL.includes("/exam/view?cid=")) { const e = JSON.parse(this.response); se.cceques = e.data.questions, e.data.questions; } break; case /cj-edu.com/i.test(get_href()): if (4 === this.readyState && this.responseURL.includes("api/student/getHomeworkStudentInfo.do")) { const e = JSON.parse(this.response); se.cjques = e.data, e.data; } break; case /gxk.yxlearning.com/i.test(get_href()): if (4 === this.readyState && this.responseURL.includes("cms/paper/start-do-paper-or-test.gson")) { const e = JSON.parse(this.response); se.yxques = e.attribute.data, e.data; } } })); }, Om = "data-aiask-line", isPageClaimedByNewLine = e => { var t; return "new" === (null == (t = e.documentElement) ? void 0 : t.getAttribute(Om)); }; (e => { if ("function" != typeof e) return; const t = e, n = getRuntime(); "function" != typeof n.GM_xmlhttpRequest && (n.GM_xmlhttpRequest = t), n.GM || (n.GM = {}), "function" != typeof n.GM.xmlHttpRequest && (n.GM.xmlHttpRequest = t); })(ie); const run = async () => { if (isPageClaimedByNewLine(document)) return; var e; (e = document.createElement("iframe")).style.display = "none", document.body.appendChild(e), window.console = e.contentWindow.console; if (se !== se.top && ![ /\/work\/doHomeWorkNew/i, /selectWorkQuestionYiPiYue/i, /page\/quiz\/stu\/answerQuestion2/i, /page\/active\/stuActiveList/i, /uooconline.com/i, /edu-edu.com/i, /hblearning\/exam\/portal\/exam.jsp/i ].some((e => e.test(location.href))) && !yn.some((e => "hook" !== e.type && isRuleMatched(e)))) return; const t = (() => { var e; const t = pinia.createPinia(), n = vue.createApp(Lm); n.use(t); const a = document.createElement("div"), i = document.createElement("div"); i.id = "AiAskApp", (e => { var t, n; if (!Pn.iframe || e.self === e.top) return false; try { return (null == (n = null == (t = e.top) ? void 0 : t.location) ? void 0 : n.origin) === e.location.origin; } catch { return false; } })(window) ? (i.id = "AiAskAppTop", null == (e = window.top) || e.document.body.appendChild(a)) : document.body.append(a); const s = a.attachShadow({ mode: "closed" }); s.appendChild(i); try { const e = document.createElement("style"); e.textContent = Mm, s.appendChild(e); } catch (r) { console.error("\u5e94\u7528\u6837\u5f0f\u8868\u65f6\u51fa\u9519:", r); } return n.mount(i), { app: n, main_root: a }; })(); ((e, t, n = ("undefined" == typeof MutationObserver ? void 0 : MutationObserver)) => { if (isPageClaimedByNewLine(e)) return t(), () => {}; const a = e.documentElement; if (!a || !n) return () => {}; let i = false; const s = new n((() => { !i && isPageClaimedByNewLine(e) && (i = true, s.disconnect(), t()); })); s.observe(a, { attributes: true, attributeFilter: [ Om ] }); })(document, (() => { try { null == t || t.app.unmount(), null == t || t.main_root.remove(); } catch (e) { console.error("\u6536\u8d77\u65e7\u7248\u9762\u677f\u65f6\u51fa\u9519:", e); } })), parseRule(yn); }; isPageClaimedByNewLine(document) || (comHook(), yn.filter((e => isRuleMatched(e) && e.hook)).forEach((e => { e.hook(); }))), "complete" === document.readyState ? run() : window.addEventListener("load", run); })(Vue, Icon, Pinia, DOMPurify, CryptoJS, $);