wi-chat 0.6.2 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.js +921 -342
- package/dist/core/useAnswerActions.d.ts +61 -0
- package/dist/core/useChat.d.ts +29 -3
- package/dist/core/useChatAuth.d.ts +175 -0
- package/dist/core/useChatRooms.d.ts +66 -0
- package/dist/core/useKeepAlive.d.ts +41 -0
- package/dist/core/useLlm.d.ts +73 -0
- package/dist/core/useRunningGroups.d.ts +58 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +119 -108
- package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +3 -3
- package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +1 -1
- package/dist/parser/answerCom/generic/parseGeneric.d.ts +52 -0
- package/dist/parser/answerCom/generic/types.d.ts +75 -0
- package/dist/parser/answerCom/outputFile/parseOutputFile.d.ts +7 -6
- package/dist/parser/answerCom/outputFile/types.d.ts +15 -5
- package/dist/parser/answerCom/presentFiles/parsePresentFiles.d.ts +58 -0
- package/dist/parser/answerCom/presentFiles/types.d.ts +27 -0
- package/dist/parser/answerMeta.d.ts +71 -0
- package/dist/parser/deepThinking/parseDeepThinking.d.ts +8 -0
- package/dist/parser/history/history.d.ts +9 -0
- package/dist/parser/history/index.d.ts +1 -1
- package/dist/parser/index.cjs +6 -2
- package/dist/parser/index.d.ts +11 -2
- package/dist/parser/index.js +591 -366
- package/dist/parser/message.d.ts +9 -0
- package/dist/parser/runTime.d.ts +29 -0
- package/dist/renderers/TextAnswer-BgKGvG_o.cjs +2 -0
- package/dist/renderers/TextAnswer-PQwV3K7v.js +5 -0
- package/dist/renderers/answerCard/AnswerCard.vue.d.ts +65 -0
- package/dist/renderers/answerCard/AnswerToolbar.vue.d.ts +42 -0
- package/dist/renderers/answerConfig.d.ts +33 -0
- package/dist/renderers/deviceLastValue/DeviceLastValue.vue.d.ts +37 -0
- package/dist/renderers/index.cjs +6 -1
- package/dist/renderers/index.d.ts +14 -0
- package/dist/renderers/index.js +1485 -574
- package/dist/renderers/media/MediaAnswer.vue.d.ts +19 -0
- package/dist/renderers/outputFile/OutputFileLink.vue.d.ts +19 -0
- package/dist/renderers/outputFile/localFile.d.ts +46 -0
- package/dist/renderers/outputFile/useOutputFile.d.ts +32 -3
- package/dist/renderers/presentFiles/PresentFiles.vue.d.ts +19 -0
- package/dist/renderers/recordset/RecordsetView.vue.d.ts +19 -0
- package/dist/renderers/sqlQuery/SqlQuery.vue.d.ts +19 -0
- package/dist/renderers/style.css +1 -1
- package/dist/renderers/text/TextAnswer.vue.d.ts +19 -0
- package/dist/request/api.d.ts +121 -1
- package/dist/request/client.d.ts +12 -0
- package/dist/request/index.cjs +4 -2
- package/dist/request/index.d.ts +6 -4
- package/dist/request/index.js +780 -179
- package/dist/request/login.d.ts +36 -0
- package/dist/request/ws.d.ts +11 -86
- package/dist/request/wsCore.d.ts +104 -0
- package/dist/request/wsSession.d.ts +353 -0
- package/dist/right-panel/RightPanelTabs.vue.d.ts +4 -0
- package/dist/right-panel/index.cjs +1 -1
- package/dist/right-panel/index.d.ts +1 -1
- package/dist/right-panel/index.js +598 -499
- package/dist/right-panel/style.css +1 -1
- package/dist/right-panel/types.d.ts +10 -0
- package/dist/tools/index.cjs +5 -5
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +323 -208
- package/dist/tools/markdown/index.d.ts +2 -0
- package/dist/tools/markdown/interactions.d.ts +39 -0
- package/dist/tools/markdown/sanitize.d.ts +6 -0
- package/dist/tools/style.css +1 -1
- package/dist/web-ui/attach/AttachmentCard.vue.d.ts +1 -1
- package/dist/web-ui/attach/AttachmentList.vue.d.ts +1 -1
- package/dist/web-ui/chat/ChatContainer.vue.d.ts +5 -5
- package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +1 -1
- package/dist/web-ui/index.cjs +1 -1
- package/dist/web-ui/index.js +1 -1
- package/dist/web-ui/inputbox/Inputbox.vue.d.ts +5 -5
- package/dist/web-ui/style.css +1 -1
- package/package.json +2 -2
package/dist/parser/index.js
CHANGED
|
@@ -1,172 +1,285 @@
|
|
|
1
|
-
const
|
|
1
|
+
const q = () => ({
|
|
2
2
|
answer_type: "knowledge_stream_result",
|
|
3
3
|
values: [{ answer: "" }]
|
|
4
|
-
}),
|
|
4
|
+
}), B = (e) => (e.answer_type = "knowledge_stream_result", (!Array.isArray(e.values) || !e.values.length) && (e.values = [{ answer: "" }]), e), ue = (e = "", t = "") => ({
|
|
5
5
|
id: e,
|
|
6
6
|
question: t,
|
|
7
7
|
answer: { reports: [] }
|
|
8
|
-
}),
|
|
8
|
+
}), de = [
|
|
9
9
|
"knowledge_stream_begin",
|
|
10
10
|
"knowledge_stream",
|
|
11
11
|
"knowledge_stream_result",
|
|
12
12
|
"knowledge_stream_end"
|
|
13
|
-
],
|
|
13
|
+
], Y = (e, t, n, r) => {
|
|
14
14
|
var l;
|
|
15
|
-
if (!e.mode || !
|
|
15
|
+
if (!e.mode || !de.includes(e.mode)) return !1;
|
|
16
16
|
if (e.mode === "knowledge_stream_result" || e.mode === "knowledge_stream_end")
|
|
17
17
|
return !0;
|
|
18
|
-
const
|
|
18
|
+
const s = r == null ? void 0 : r.beforeKnowledgeRender, o = (u) => s ? s(u) : u;
|
|
19
19
|
if (e.mode === "knowledge_stream_begin") {
|
|
20
20
|
const u = t.at(-1);
|
|
21
|
-
return (u == null ? void 0 : u.answer_type) === "knowledge_stream_result" ? (u.values = u.values ?? [], u.values.push({ answer: "" }), !0) : u && !u.answer_type ? (
|
|
21
|
+
return (u == null ? void 0 : u.answer_type) === "knowledge_stream_result" ? (u.values = u.values ?? [], u.values.push({ answer: "" }), !0) : u && !u.answer_type ? (B(u), !0) : (t.push(q()), !0);
|
|
22
22
|
}
|
|
23
23
|
if (e.mode !== "knowledge_stream") return !1;
|
|
24
24
|
let i = t.at(-1);
|
|
25
|
-
i && !i.answer_type ? i =
|
|
25
|
+
i && !i.answer_type ? i = B(i) : (!i || i.answer_type !== "knowledge_stream_result") && (i = q(), t.push(i)), i.values = (l = i.values) != null && l.length ? i.values : [{ answer: "" }];
|
|
26
26
|
const a = i.values[i.values.length - 1], c = `${a.raw ?? ""}${e.value || ""}`;
|
|
27
|
-
return a.raw = c, a.answer =
|
|
28
|
-
},
|
|
27
|
+
return a.raw = c, a.answer = o(c), !0;
|
|
28
|
+
}, fe = (e, t) => {
|
|
29
29
|
if (Array.isArray(e.values) && e.values.length) return e;
|
|
30
|
-
const n = t == null ? void 0 : t.beforeKnowledgeRender, r = (
|
|
31
|
-
let
|
|
32
|
-
return Array.isArray(e.knowledge) && (
|
|
33
|
-
},
|
|
30
|
+
const n = t == null ? void 0 : t.beforeKnowledgeRender, r = (o) => n ? n(o) : o;
|
|
31
|
+
let s = [];
|
|
32
|
+
return Array.isArray(e.knowledge) && (s = e.knowledge.map((o) => typeof o == "string" ? o : o == null ? void 0 : o.answer).filter((o) => typeof o == "string" && o !== "")), s.length === 0 && typeof e.answer == "string" && e.answer !== "" && (s = [e.answer]), s.length && (e.values = s.map((o) => ({ answer: r(o), raw: o }))), e;
|
|
33
|
+
}, pe = {
|
|
34
34
|
id: "knowledge_stream",
|
|
35
35
|
answerType: "knowledge_stream_result",
|
|
36
|
-
applyChunk:
|
|
37
|
-
normalizeReport:
|
|
38
|
-
},
|
|
39
|
-
if (!
|
|
36
|
+
applyChunk: Y,
|
|
37
|
+
normalizeReport: fe
|
|
38
|
+
}, G = ["begin", "begin_stream", "send_stream", "end_stream"], me = (e, t) => {
|
|
39
|
+
if (!G.includes(e.mode || "")) return !1;
|
|
40
40
|
let n = t.at(-1);
|
|
41
41
|
return (!n || n.answer_type) && (n = { exec_process: [] }, t.push(n)), n.exec_process = n.exec_process ?? [], n.exec_process.push({ mode: e.mode, type: e.type, value: e.value }), !0;
|
|
42
|
-
},
|
|
42
|
+
}, ye = (e) => {
|
|
43
43
|
const t = [];
|
|
44
44
|
let n = "", r = !1;
|
|
45
|
-
for (const
|
|
46
|
-
(
|
|
45
|
+
for (const s of (e.exec_process ?? []).filter(
|
|
46
|
+
(o) => G.includes(o.mode || "")
|
|
47
47
|
)) {
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
const o = typeof s.value == "string" ? s.value : "";
|
|
49
|
+
s.mode === "begin" ? (r && n.trim() && t.push(n.trim()), r = !1, n = "", o.trim() && t.push(o.trim())) : s.mode === "begin_stream" ? (r && n.trim() && t.push(n.trim()), r = !0, n = o) : s.mode === "send_stream" && r ? n += o : s.mode === "end_stream" && r && (n += o, n.trim() && t.push(n.trim()), r = !1, n = "");
|
|
50
50
|
}
|
|
51
51
|
return r && n.trim() && t.push(n.trim()), t;
|
|
52
|
-
},
|
|
52
|
+
}, M = (e) => {
|
|
53
53
|
var t;
|
|
54
|
-
return (((t = e.answer) == null ? void 0 : t.reports) ?? []).flatMap(
|
|
55
|
-
},
|
|
54
|
+
return (((t = e.answer) == null ? void 0 : t.reports) ?? []).flatMap(ye).map(ge).filter((n) => n.trim() && !he.test(n.trim()));
|
|
55
|
+
}, he = /^(分析结束|已完成|思考结束|开始|结束|分析完成|任务结束)$/, ge = (e) => e.replace(/^ {0,3}(?:={2,}|-{2,})[ \t]*\r?$/gm, "").trim(), we = {
|
|
56
56
|
id: "deep_thinking",
|
|
57
|
-
applyChunk:
|
|
58
|
-
}, U = '/**\n * Skipped minification because the original files appears to be already minified.\n * Original file: /npm/@iframe-resizer/child@5.1.5/index.umd.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n/*!\n * @preserve\n * \n * @module iframe-resizer/child 5.1.5 (umd) - 2024-07-09\n *\n * @license GPL-3.0 for non-commercial use only.\n * For commercial use, you must purchase a license from\n * https://iframe-resizer.com/pricing\n * \n * @desciption Keep same and cross domain iFrames sized to their content \n *\n * @author David J. Bradshaw <info@iframe-resizer.com>\n * \n * @see {@link https://iframe-resizer.com}\n * \n * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.\n */\n\n\n!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.1.5",t=10,n="data-iframe-size",o=(e,t,n,o)=>e.addEventListener(t,n,o||!1),i=(e,t,n)=>e.removeEventListener(t,n,!1),r=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const a=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(r[e]),l={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},c={height:()=>(de("Custom height calculation function not defined"),He.auto()),width:()=>(de("Custom width calculation function not defined"),Ue.auto())},s={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},u=128,d={},m="checkVisibility"in window,f="auto",p="[iFrameSizer]",h=p.length,y={max:1,min:1,bodyScroll:1,documentElementScroll:1},g=["body"],v="scroll";let b,w,z=!0,S="",$=0,j="",E=null,P="",O=!0,M=!1,A=null,C=!0,T=!1,k=1,I=f,x=!0,N="",R={},B=!0,q=!1,L=0,W=!1,D="",H="child",U=null,F=!1,V="",J=window.parent,Z="*",Q=0,X=!1,Y="",G=1,K=v,_=window,ee=()=>{de("onMessage function not defined")},te=()=>{},ne=null,oe=null;const ie=e=>""!=`${e}`&&void 0!==e,re=new WeakSet,ae=e=>"object"==typeof e&&re.add(e);function le(e){switch(!0){case!ie(e):return"";case ie(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case ie(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(ie(e.className)?`.${e.className}`:"")}}function ce(e,t=30){const n=e?.outerHTML?.toString();return n?n.length<t?n:`${n.slice(0,t).replaceAll("\\n"," ")}...`:e}const se=(...e)=>[`[iframe-resizer][${D}]`,...e].join(" "),ue=(...e)=>console?.info(se(...e)),de=(...e)=>console?.warn(se(...e)),me=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\\n").replaceAll("<rb>","\x1B[31;1m").replaceAll("</>","\x1B[m").replaceAll("<b>","\x1B[1m").replaceAll("<i>","\x1B[3m").replaceAll("<u>","\x1B[4m")):e(t.replaceAll("<br>","\\n").replaceAll(/<[/a-z]+>/gi,"")))(se)(...e)),fe=e=>me(e);function pe(){!function(){try{F="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=N.slice(h).split(":");D=t[0],$=void 0===t[1]?$:Number(t[1]),M=void 0===t[2]?M:e(t[2]),q=void 0===t[3]?q:e(t[3]),z=void 0===t[6]?z:e(t[6]),j=t[7],I=void 0===t[8]?I:t[8],S=t[9],P=t[10],Q=void 0===t[11]?Q:Number(t[11]),R.enable=void 0!==t[12]&&e(t[12]),H=void 0===t[13]?H:t[13],K=void 0===t[14]?K:t[14],W=void 0===t[15]?W:e(t[15]),b=void 0===t[16]?b:Number(t[16]),w=void 0===t[17]?w:Number(t[17]),O=void 0===t[18]?O:e(t[18]),t[19],Y=t[20]||Y,L=void 0===t[21]?L:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;ee=e?.onMessage||ee,te=e?.onReady||te,"number"==typeof e?.offset&&(O&&(b=e?.offset),M&&(w=e?.offset)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(V=e.sizeSelector),Z=e?.targetOrigin||Z,I=e?.heightCalculationMethod||I,K=e?.widthCalculationMethod||K}function t(e,t){return"function"==typeof e&&(c[t]=e,e="custom"),e}if(1===L)return;"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),I=t(I,"height"),K=t(K,"width"))}(),function(){void 0===j&&(j=`${$}px`);he("margin",function(e,t){t.includes("-")&&(de(`Negative CSS value ignored for ${e}`),t="");return t}("margin",j))}(),he("background",S),he("padding",P),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body)}(),ye(),L<0?fe(`${a(L+2)}${a(2)}`):Y.codePointAt(0)>4||L<2&&fe(a(3)),function(){if(!Y||""===Y||"false"===Y)return void me("<rb>Legacy version detected on parent page</>\\n\\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\\n\\nSee <u>https://iframe-resizer.com/setup/</> for more details.\\n");Y!==e&&me(`<rb>Version mismatch</>\\n\\nThe parent and child pages are running different versions of <i>iframe resizer</>.\\n\\nParent page: ${Y} - Child page: ${e}.\\n`)}(),ze(),Se(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.setAttribute(n,null)}));t("data-iframe-height"),t("data-iframe-width"),e&&me("<rb>Deprecated Attributes</>\\n \\nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),document.querySelectorAll(`[${n}]`).length>0&&("auto"===I&&(I="autoOverflow"),"auto"===K&&(K="autoOverflow")),be(),function(){if(1===L)return;_.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===z?(z=!0,$e()):!1===e&&!0===z&&(z=!1,ve("remove"),U?.disconnect(),E?.disconnect()),Xe(0,0,"autoResize",JSON.stringify(z)),z),close(){Xe(0,0,"close")},getId:()=>D,getPageInfo(e){if("function"==typeof e)return ne=e,Xe(0,0,"pageInfo"),void me("<rb>Deprecated Method</>\\n \\nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\\n");ne=null,Xe(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return oe=e,Xe(0,0,"parentInfo"),()=>{oe=null,Xe(0,0,"parentInfoStop")}},getParentProperties(e){me("<rb>Renamed Method</>\\n \\nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\\n"),this.getParentProps(e)},moveToAnchor(e){R.findTarget(e)},reset(){Qe()},scrollBy(e,t){Xe(t,e,"scrollBy")},scrollTo(e,t){Xe(t,e,"scrollTo")},scrollToOffset(e,t){Xe(t,e,"scrollToOffset")},sendMessage(e,t){Xe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){I=e,ze()},setWidthCalculationMethod(e){K=e,Se()},setTargetOrigin(e){Z=e},resize(e,t){Ve("size",`parentIFrame.size(${`${e||""}${t?`,${t}`:""}`})`,e,t)},size(e,t){me("<rb>Deprecated Method</>\\n \\nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\\n"),this.resize(e,t)}}),_.parentIFrame=_.parentIframe}(),function(){if(!0!==W)return;function e(e){Xe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){o(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),$e(),R=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function i(e){function t(e){const t=n(e);Xe(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?Xe(0,0,"inPageLink",`#${o}`):t(r)}function r(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&i(t)}function a(){function e(e){function t(e){e.preventDefault(),i(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&o(e,"click",t)}document.querySelectorAll(\'a[href^="#"]\').forEach(e)}function l(){o(window,"hashchange",r)}function c(){setTimeout(r,u)}function s(){a(),l(),c()}R.enable&&(1===L?me("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):s());return{findTarget:i}}(),ae(document.documentElement),ae(document.body),Ve("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Xe(0,0,"title",document.title),te(),B=!1}function he(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function ye(){""!==V&&document.querySelectorAll(V).forEach((e=>{e.dataset.iframeSize=!0}))}function ge(e){({add(t){function n(){Ve(e.eventName,e.eventType)}d[t]=n,o(window,t,n,{passive:!0})},remove(e){const t=d[e];delete d[e],i(window,e,t)}})[e.method](e.eventName)}function ve(e){ge({method:e,eventType:"After Print",eventName:"afterprint"}),ge({method:e,eventType:"Before Print",eventName:"beforeprint"}),ge({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function be(){const e=document.querySelectorAll(`[${n}]`);T=e.length>0,A=T?e:Re(document)()}function we(e,t,n,o){return t!==e&&(e in n||(de(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in s&&me(`<rb>Deprecated ${o}CalculationMethod (${e})</>\\n\\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function ze(){I=we(I,f,He,"height")}function Se(){K=we(K,v,Ue,"width")}function $e(){!0===z&&(ve("add"),E=function(){function e(e){e.forEach(Te),ye(),be()}function t(){const t=new window.MutationObserver(e),n=document.querySelector("body"),o={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return t.observe(n,o),t}const n=t();return{disconnect(){n.disconnect()}}}(),U=new ResizeObserver(Ee),Ce(window.document))}let je;function Ee(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;je=()=>Ve("resizeObserver",`Resize Observed: ${le(t)}`),setTimeout((()=>{je&&je(),je=void 0}),0)}const Pe=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},Oe=()=>[...Re(document)()].filter(Pe),Me=new WeakSet;function Ae(e){e&&(Me.has(e)||(U.observe(e),Me.add(e)))}function Ce(e){[...Oe(),...g.flatMap((t=>e.querySelector(t)))].forEach(Ae)}function Te(e){"childList"===e.type&&Ce(e.target)}let ke=4,Ie=4;function xe(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o=0,i=A.length,r=document.documentElement,a=T?0:document.documentElement.getBoundingClientRect().bottom,c=performance.now();var s;A.forEach((t=>{T||!m||t.checkVisibility(l)?(o=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),o>a&&(a=o,r=t)):i-=1})),c=performance.now()-c,i>1&&(s=r,re.has(s)||(ae(s),ue(`\\nHeight calculated from: ${le(s)} (${ce(s)})`)));const u=`\\nParsed ${i} element${1===i?"":"s"} in ${c.toPrecision(3)}ms\\n${t} ${T?"tagged ":""}element found at: ${a}px\\nPosition calculated from HTML element: ${le(r)} (${ce(r,100)})`;return c<4||i<99||T||B||ke<c&&ke<Ie&&(ke=1.2*c,me(`<rb>Performance Warning</>\\n\\nCalculating the page size took an excessive amount of time. To improve performance add the <b>data-iframe-size</> attribute to the ${e} most element on the page.\\n${u}`)),Ie=c,a}const Ne=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Re=e=>()=>e.querySelectorAll("* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)");let Be=!1;function qe({ceilBoundingSize:e,dimension:t,getDimension:n,isHeight:o,scrollSize:i}){if(!Be)return Be=!0,n.taggedElement();const r=o?"bottom":"right";return me(`<rb>Detected content overflowing html element</>\\n \\nThis causes <i>iframe-resizer</> to fall back to checking the position of every element on the page in order to calculate the correct dimensions of the iframe. Inspecting the size, ${r} margin, and position of every visible HTML element will have a performance impact on more complex pages. \\n\\nTo fix this issue, and remove this warning, you can either ensure the content of the page does not overflow the <b><HTML></> element or alternatively you can add the attribute <b>data-iframe-size</> to the elements on the page that you want <i>iframe-resizer</> to use when calculating the dimensions of the iframe. \\n \\nWhen present the ${r} margin of the ${o?"lowest":"right most"} element with a <b>data-iframe-size</> attribute will be used to set the ${t} of the iframe.\\n\\nMore info: https://iframe-resizer.com/performance.\\n\\n(Page size: ${i} > document size: ${e})`),o?I="autoOverflow":K="autoOverflow",n.taggedElement()}const Le={height:0,width:0},We={height:0,width:0};function De(e,t){function n(){return We[i]=r,Le[i]=c,r}const o=e===He,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return c;case!t&&0===We[i]&&0===Le[i]:if(e.taggedElement(!0)<=a)return n();break;case X&&r===We[i]&&c===Le[i]:return Math.max(r,c);case 0===r:return c;case!t&&r!==We[i]&&c<=Le[i]:return n();case!o:return t?e.taggedElement():qe({ceilBoundingSize:a,dimension:i,getDimension:e,isHeight:o,scrollSize:c});case!t&&r<We[i]:case c===l||c===a:case r>c:return n();case!t:return qe({ceilBoundingSize:a,dimension:i,getDimension:e,isHeight:o,scrollSize:c})}return Math.max(e.taggedElement(),n())}const He={enabled:()=>O,getOffset:()=>b,type:"height",auto:()=>De(He,!1),autoOverflow:()=>De(He,!0),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>He.bodyOffset(),custom:()=>c.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Ne(He)),min:()=>Math.min(...Ne(He)),grow:()=>He.max(),lowestElement:()=>xe("bottom"),taggedElement:()=>xe("bottom")},Ue={enabled:()=>M,getOffset:()=>w,type:"width",auto:()=>De(Ue,!1),autoOverflow:()=>De(Ue,!0),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>c.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Ne(Ue)),min:()=>Math.min(...Ne(Ue)),rightMostElement:()=>xe("right"),scroll:()=>Math.max(Ue.bodyScroll(),Ue.documentElementScroll()),taggedElement:()=>xe("right")};function Fe(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=Q);return r=void 0===n?He[I]():n,a=void 0===o?Ue[K]():o,O&&e(k,r)||M&&e(G,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(O&&I in y||M&&K in y)&&Qe():(Je(),k=r,G=a,Xe(k,G,e,i))}function Ve(e,t,n,o,i){document.hidden||Fe(e,0,n,o,i)}function Je(){X||(X=!0,requestAnimationFrame((()=>{X=!1})))}function Ze(e){k=He[I](),G=Ue[K](),Xe(k,G,e)}function Qe(e){const t=I;I=f,Je(),Ze("reset"),I=t}function Xe(e,t,n,o,i){L<-1||(void 0!==i||(i=Z),function(){const r=`${D}:${`${e+(b||0)}:${t+(w||0)}`}:${n}${void 0===o?"":`:${o}`}`;F?window.parent.iframeParentListener(p+r):J.postMessage(p+r,i)}())}function Ye(e){const t={init:function(){N=e.data,J=e.source,pe(),C=!1,setTimeout((()=>{x=!1}),u)},reset(){x||Ze("resetPage")},resize(){Ve("resizeParent")},moveToAnchor(){R.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();ne?ne(JSON.parse(e)):Xe(0,0,"pageInfoStop")},parentInfo(){const e=o();oe?oe(Object.freeze(JSON.parse(e))):Xe(0,0,"parentInfoStop")},message(){const e=o();ee(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};p===`${e.data}`.slice(0,h)&&(!1!==C?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||de(`Unexpected message (${e.data})`)}())}function Ge(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"undefined"!=typeof window&&(window.iframeChildListener=e=>Ye({data:e,sameDomain:!0}),o(window,"message",Ye),o(window,"readystatechange",Ge),Ge())}));\n', le = "iframe-resizer/child 5.1.5", st = U, A = `<script>${U}<\/script>`, ue = (e) => !e || typeof e != "object" ? "" : String(e.type || e.answer_type || ""), W = (e) => {
|
|
57
|
+
applyChunk: me
|
|
58
|
+
}, be = /* @__PURE__ */ new Set(["answer_type", "type", "exec_process", "json_ok", "json_msg", "values"]), v = (e) => !e || typeof e != "object" ? "" : String(e.type || e.answer_type || ""), V = (e) => {
|
|
59
|
+
if (!e || typeof e != "object") return;
|
|
60
|
+
if (e.values !== void 0 && e.values !== null) return e.values;
|
|
61
|
+
const t = {};
|
|
62
|
+
return Object.keys(e).forEach((n) => {
|
|
63
|
+
be.has(n) || (t[n] = e[n]);
|
|
64
|
+
}), Object.keys(t).length ? t : void 0;
|
|
65
|
+
}, g = (e) => {
|
|
66
|
+
const { answerType: t } = e, n = e.readPayload ?? V;
|
|
67
|
+
return {
|
|
68
|
+
id: t,
|
|
69
|
+
answerType: t,
|
|
70
|
+
applyChunk: (r, s) => {
|
|
71
|
+
if (r.mode !== "result" || v(r.value) !== t) return !1;
|
|
72
|
+
const o = n(r.value);
|
|
73
|
+
return o !== void 0 && s.push({ answer_type: t, values: o }), !0;
|
|
74
|
+
},
|
|
75
|
+
normalizeReport: (r) => {
|
|
76
|
+
r.answer_type = t;
|
|
77
|
+
const s = n(r);
|
|
78
|
+
s !== void 0 && (r.values = s);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}, _e = g({
|
|
82
|
+
answerType: "text",
|
|
83
|
+
readPayload: (e) => {
|
|
84
|
+
if (typeof (e == null ? void 0 : e.values) == "string") return e.values;
|
|
85
|
+
if (typeof (e == null ? void 0 : e.answer) == "string") return e.answer;
|
|
86
|
+
}
|
|
87
|
+
}), ve = g({
|
|
88
|
+
answerType: "sql_query",
|
|
89
|
+
readPayload: (e) => {
|
|
90
|
+
var n;
|
|
91
|
+
const t = ((n = e == null ? void 0 : e.values) == null ? void 0 : n.sql) !== void 0 ? e.values : (e == null ? void 0 : e.sql_query) ?? e;
|
|
92
|
+
if (!(!t || typeof t.sql != "string"))
|
|
93
|
+
return { sql: t.sql, ds_id: t.ds_id };
|
|
94
|
+
}
|
|
95
|
+
}), ze = g({
|
|
96
|
+
answerType: "device_last_value",
|
|
97
|
+
readPayload: (e) => {
|
|
98
|
+
const t = Array.isArray(e == null ? void 0 : e.rows) ? e : e == null ? void 0 : e.values;
|
|
99
|
+
if (!(!t || !Array.isArray(t.rows)))
|
|
100
|
+
return { title: t.title, rows: t.rows, values: Array.isArray(t.values) ? t.values : [] };
|
|
101
|
+
}
|
|
102
|
+
}), Ee = g({
|
|
103
|
+
answerType: "camera",
|
|
104
|
+
readPayload: (e) => {
|
|
105
|
+
const t = e != null && e.values && typeof e.values == "object" && !Array.isArray(e.values) ? e.values : e;
|
|
106
|
+
if (!t || !t.res_id && !Array.isArray(t.cameras)) return;
|
|
107
|
+
const n = Array.isArray(t.cameras) ? t.cameras : [];
|
|
108
|
+
return { res_id: t.res_id, cameras: n };
|
|
109
|
+
}
|
|
110
|
+
}), Se = g({
|
|
111
|
+
answerType: "video",
|
|
112
|
+
readPayload: (e) => {
|
|
113
|
+
var n, r;
|
|
114
|
+
const t = (n = e == null ? void 0 : e.values) != null && n.file_id || (r = e == null ? void 0 : e.values) != null && r.model_id ? e.values : e;
|
|
115
|
+
if (!(!t || !t.file_id && !t.model_id))
|
|
116
|
+
return { model_id: t.model_id, file_id: t.file_id };
|
|
117
|
+
}
|
|
118
|
+
}), Ae = g({
|
|
119
|
+
answerType: "wav",
|
|
120
|
+
readPayload: (e) => {
|
|
121
|
+
var n, r;
|
|
122
|
+
const t = (n = e == null ? void 0 : e.values) != null && n.noise_id || (r = e == null ? void 0 : e.values) != null && r.file_id ? e.values : e;
|
|
123
|
+
if (!(!t || !t.noise_id && !t.file_id))
|
|
124
|
+
return { noise_id: t.noise_id, file_id: t.file_id };
|
|
125
|
+
}
|
|
126
|
+
}), Ce = g({
|
|
127
|
+
answerType: "script",
|
|
128
|
+
readPayload: V
|
|
129
|
+
}), Te = [
|
|
130
|
+
_e,
|
|
131
|
+
ve,
|
|
132
|
+
ze,
|
|
133
|
+
Ee,
|
|
134
|
+
Se,
|
|
135
|
+
Ae,
|
|
136
|
+
Ce
|
|
137
|
+
], J = '/**\n * Skipped minification because the original files appears to be already minified.\n * Original file: /npm/@iframe-resizer/child@5.1.5/index.umd.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n/*!\n * @preserve\n * \n * @module iframe-resizer/child 5.1.5 (umd) - 2024-07-09\n *\n * @license GPL-3.0 for non-commercial use only.\n * For commercial use, you must purchase a license from\n * https://iframe-resizer.com/pricing\n * \n * @desciption Keep same and cross domain iFrames sized to their content \n *\n * @author David J. Bradshaw <info@iframe-resizer.com>\n * \n * @see {@link https://iframe-resizer.com}\n * \n * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.\n */\n\n\n!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.1.5",t=10,n="data-iframe-size",o=(e,t,n,o)=>e.addEventListener(t,n,o||!1),i=(e,t,n)=>e.removeEventListener(t,n,!1),r=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const a=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(r[e]),l={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},c={height:()=>(de("Custom height calculation function not defined"),He.auto()),width:()=>(de("Custom width calculation function not defined"),Ue.auto())},s={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},u=128,d={},m="checkVisibility"in window,f="auto",p="[iFrameSizer]",h=p.length,y={max:1,min:1,bodyScroll:1,documentElementScroll:1},g=["body"],v="scroll";let b,w,z=!0,S="",$=0,j="",E=null,P="",O=!0,M=!1,A=null,C=!0,T=!1,k=1,I=f,x=!0,N="",R={},B=!0,q=!1,L=0,W=!1,D="",H="child",U=null,F=!1,V="",J=window.parent,Z="*",Q=0,X=!1,Y="",G=1,K=v,_=window,ee=()=>{de("onMessage function not defined")},te=()=>{},ne=null,oe=null;const ie=e=>""!=`${e}`&&void 0!==e,re=new WeakSet,ae=e=>"object"==typeof e&&re.add(e);function le(e){switch(!0){case!ie(e):return"";case ie(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case ie(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(ie(e.className)?`.${e.className}`:"")}}function ce(e,t=30){const n=e?.outerHTML?.toString();return n?n.length<t?n:`${n.slice(0,t).replaceAll("\\n"," ")}...`:e}const se=(...e)=>[`[iframe-resizer][${D}]`,...e].join(" "),ue=(...e)=>console?.info(se(...e)),de=(...e)=>console?.warn(se(...e)),me=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\\n").replaceAll("<rb>","\x1B[31;1m").replaceAll("</>","\x1B[m").replaceAll("<b>","\x1B[1m").replaceAll("<i>","\x1B[3m").replaceAll("<u>","\x1B[4m")):e(t.replaceAll("<br>","\\n").replaceAll(/<[/a-z]+>/gi,"")))(se)(...e)),fe=e=>me(e);function pe(){!function(){try{F="iframeParentListener"in window.parent}catch(e){}}(),function(){const e=e=>"true"===e,t=N.slice(h).split(":");D=t[0],$=void 0===t[1]?$:Number(t[1]),M=void 0===t[2]?M:e(t[2]),q=void 0===t[3]?q:e(t[3]),z=void 0===t[6]?z:e(t[6]),j=t[7],I=void 0===t[8]?I:t[8],S=t[9],P=t[10],Q=void 0===t[11]?Q:Number(t[11]),R.enable=void 0!==t[12]&&e(t[12]),H=void 0===t[13]?H:t[13],K=void 0===t[14]?K:t[14],W=void 0===t[15]?W:e(t[15]),b=void 0===t[16]?b:Number(t[16]),w=void 0===t[17]?w:Number(t[17]),O=void 0===t[18]?O:e(t[18]),t[19],Y=t[20]||Y,L=void 0===t[21]?L:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;ee=e?.onMessage||ee,te=e?.onReady||te,"number"==typeof e?.offset&&(O&&(b=e?.offset),M&&(w=e?.offset)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(V=e.sizeSelector),Z=e?.targetOrigin||Z,I=e?.heightCalculationMethod||I,K=e?.widthCalculationMethod||K}function t(e,t){return"function"==typeof e&&(c[t]=e,e="custom"),e}if(1===L)return;"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),I=t(I,"height"),K=t(K,"width"))}(),function(){void 0===j&&(j=`${$}px`);he("margin",function(e,t){t.includes("-")&&(de(`Negative CSS value ignored for ${e}`),t="");return t}("margin",j))}(),he("background",S),he("padding",P),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body)}(),ye(),L<0?fe(`${a(L+2)}${a(2)}`):Y.codePointAt(0)>4||L<2&&fe(a(3)),function(){if(!Y||""===Y||"false"===Y)return void me("<rb>Legacy version detected on parent page</>\\n\\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\\n\\nSee <u>https://iframe-resizer.com/setup/</> for more details.\\n");Y!==e&&me(`<rb>Version mismatch</>\\n\\nThe parent and child pages are running different versions of <i>iframe resizer</>.\\n\\nParent page: ${Y} - Child page: ${e}.\\n`)}(),ze(),Se(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.setAttribute(n,null)}));t("data-iframe-height"),t("data-iframe-width"),e&&me("<rb>Deprecated Attributes</>\\n \\nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),document.querySelectorAll(`[${n}]`).length>0&&("auto"===I&&(I="autoOverflow"),"auto"===K&&(K="autoOverflow")),be(),function(){if(1===L)return;_.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===z?(z=!0,$e()):!1===e&&!0===z&&(z=!1,ve("remove"),U?.disconnect(),E?.disconnect()),Xe(0,0,"autoResize",JSON.stringify(z)),z),close(){Xe(0,0,"close")},getId:()=>D,getPageInfo(e){if("function"==typeof e)return ne=e,Xe(0,0,"pageInfo"),void me("<rb>Deprecated Method</>\\n \\nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\\n");ne=null,Xe(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return oe=e,Xe(0,0,"parentInfo"),()=>{oe=null,Xe(0,0,"parentInfoStop")}},getParentProperties(e){me("<rb>Renamed Method</>\\n \\nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\\n"),this.getParentProps(e)},moveToAnchor(e){R.findTarget(e)},reset(){Qe()},scrollBy(e,t){Xe(t,e,"scrollBy")},scrollTo(e,t){Xe(t,e,"scrollTo")},scrollToOffset(e,t){Xe(t,e,"scrollToOffset")},sendMessage(e,t){Xe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){I=e,ze()},setWidthCalculationMethod(e){K=e,Se()},setTargetOrigin(e){Z=e},resize(e,t){Ve("size",`parentIFrame.size(${`${e||""}${t?`,${t}`:""}`})`,e,t)},size(e,t){me("<rb>Deprecated Method</>\\n \\nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\\n"),this.resize(e,t)}}),_.parentIFrame=_.parentIframe}(),function(){if(!0!==W)return;function e(e){Xe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){o(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),$e(),R=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function i(e){function t(e){const t=n(e);Xe(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?Xe(0,0,"inPageLink",`#${o}`):t(r)}function r(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&i(t)}function a(){function e(e){function t(e){e.preventDefault(),i(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&o(e,"click",t)}document.querySelectorAll(\'a[href^="#"]\').forEach(e)}function l(){o(window,"hashchange",r)}function c(){setTimeout(r,u)}function s(){a(),l(),c()}R.enable&&(1===L?me("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):s());return{findTarget:i}}(),ae(document.documentElement),ae(document.body),Ve("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Xe(0,0,"title",document.title),te(),B=!1}function he(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function ye(){""!==V&&document.querySelectorAll(V).forEach((e=>{e.dataset.iframeSize=!0}))}function ge(e){({add(t){function n(){Ve(e.eventName,e.eventType)}d[t]=n,o(window,t,n,{passive:!0})},remove(e){const t=d[e];delete d[e],i(window,e,t)}})[e.method](e.eventName)}function ve(e){ge({method:e,eventType:"After Print",eventName:"afterprint"}),ge({method:e,eventType:"Before Print",eventName:"beforeprint"}),ge({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function be(){const e=document.querySelectorAll(`[${n}]`);T=e.length>0,A=T?e:Re(document)()}function we(e,t,n,o){return t!==e&&(e in n||(de(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in s&&me(`<rb>Deprecated ${o}CalculationMethod (${e})</>\\n\\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function ze(){I=we(I,f,He,"height")}function Se(){K=we(K,v,Ue,"width")}function $e(){!0===z&&(ve("add"),E=function(){function e(e){e.forEach(Te),ye(),be()}function t(){const t=new window.MutationObserver(e),n=document.querySelector("body"),o={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return t.observe(n,o),t}const n=t();return{disconnect(){n.disconnect()}}}(),U=new ResizeObserver(Ee),Ce(window.document))}let je;function Ee(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;je=()=>Ve("resizeObserver",`Resize Observed: ${le(t)}`),setTimeout((()=>{je&&je(),je=void 0}),0)}const Pe=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},Oe=()=>[...Re(document)()].filter(Pe),Me=new WeakSet;function Ae(e){e&&(Me.has(e)||(U.observe(e),Me.add(e)))}function Ce(e){[...Oe(),...g.flatMap((t=>e.querySelector(t)))].forEach(Ae)}function Te(e){"childList"===e.type&&Ce(e.target)}let ke=4,Ie=4;function xe(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o=0,i=A.length,r=document.documentElement,a=T?0:document.documentElement.getBoundingClientRect().bottom,c=performance.now();var s;A.forEach((t=>{T||!m||t.checkVisibility(l)?(o=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),o>a&&(a=o,r=t)):i-=1})),c=performance.now()-c,i>1&&(s=r,re.has(s)||(ae(s),ue(`\\nHeight calculated from: ${le(s)} (${ce(s)})`)));const u=`\\nParsed ${i} element${1===i?"":"s"} in ${c.toPrecision(3)}ms\\n${t} ${T?"tagged ":""}element found at: ${a}px\\nPosition calculated from HTML element: ${le(r)} (${ce(r,100)})`;return c<4||i<99||T||B||ke<c&&ke<Ie&&(ke=1.2*c,me(`<rb>Performance Warning</>\\n\\nCalculating the page size took an excessive amount of time. To improve performance add the <b>data-iframe-size</> attribute to the ${e} most element on the page.\\n${u}`)),Ie=c,a}const Ne=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Re=e=>()=>e.querySelectorAll("* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)");let Be=!1;function qe({ceilBoundingSize:e,dimension:t,getDimension:n,isHeight:o,scrollSize:i}){if(!Be)return Be=!0,n.taggedElement();const r=o?"bottom":"right";return me(`<rb>Detected content overflowing html element</>\\n \\nThis causes <i>iframe-resizer</> to fall back to checking the position of every element on the page in order to calculate the correct dimensions of the iframe. Inspecting the size, ${r} margin, and position of every visible HTML element will have a performance impact on more complex pages. \\n\\nTo fix this issue, and remove this warning, you can either ensure the content of the page does not overflow the <b><HTML></> element or alternatively you can add the attribute <b>data-iframe-size</> to the elements on the page that you want <i>iframe-resizer</> to use when calculating the dimensions of the iframe. \\n \\nWhen present the ${r} margin of the ${o?"lowest":"right most"} element with a <b>data-iframe-size</> attribute will be used to set the ${t} of the iframe.\\n\\nMore info: https://iframe-resizer.com/performance.\\n\\n(Page size: ${i} > document size: ${e})`),o?I="autoOverflow":K="autoOverflow",n.taggedElement()}const Le={height:0,width:0},We={height:0,width:0};function De(e,t){function n(){return We[i]=r,Le[i]=c,r}const o=e===He,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return c;case!t&&0===We[i]&&0===Le[i]:if(e.taggedElement(!0)<=a)return n();break;case X&&r===We[i]&&c===Le[i]:return Math.max(r,c);case 0===r:return c;case!t&&r!==We[i]&&c<=Le[i]:return n();case!o:return t?e.taggedElement():qe({ceilBoundingSize:a,dimension:i,getDimension:e,isHeight:o,scrollSize:c});case!t&&r<We[i]:case c===l||c===a:case r>c:return n();case!t:return qe({ceilBoundingSize:a,dimension:i,getDimension:e,isHeight:o,scrollSize:c})}return Math.max(e.taggedElement(),n())}const He={enabled:()=>O,getOffset:()=>b,type:"height",auto:()=>De(He,!1),autoOverflow:()=>De(He,!0),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>He.bodyOffset(),custom:()=>c.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Ne(He)),min:()=>Math.min(...Ne(He)),grow:()=>He.max(),lowestElement:()=>xe("bottom"),taggedElement:()=>xe("bottom")},Ue={enabled:()=>M,getOffset:()=>w,type:"width",auto:()=>De(Ue,!1),autoOverflow:()=>De(Ue,!0),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>c.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Ne(Ue)),min:()=>Math.min(...Ne(Ue)),rightMostElement:()=>xe("right"),scroll:()=>Math.max(Ue.bodyScroll(),Ue.documentElementScroll()),taggedElement:()=>xe("right")};function Fe(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=Q);return r=void 0===n?He[I]():n,a=void 0===o?Ue[K]():o,O&&e(k,r)||M&&e(G,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(O&&I in y||M&&K in y)&&Qe():(Je(),k=r,G=a,Xe(k,G,e,i))}function Ve(e,t,n,o,i){document.hidden||Fe(e,0,n,o,i)}function Je(){X||(X=!0,requestAnimationFrame((()=>{X=!1})))}function Ze(e){k=He[I](),G=Ue[K](),Xe(k,G,e)}function Qe(e){const t=I;I=f,Je(),Ze("reset"),I=t}function Xe(e,t,n,o,i){L<-1||(void 0!==i||(i=Z),function(){const r=`${D}:${`${e+(b||0)}:${t+(w||0)}`}:${n}${void 0===o?"":`:${o}`}`;F?window.parent.iframeParentListener(p+r):J.postMessage(p+r,i)}())}function Ye(e){const t={init:function(){N=e.data,J=e.source,pe(),C=!1,setTimeout((()=>{x=!1}),u)},reset(){x||Ze("resetPage")},resize(){Ve("resizeParent")},moveToAnchor(){R.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();ne?ne(JSON.parse(e)):Xe(0,0,"pageInfoStop")},parentInfo(){const e=o();oe?oe(Object.freeze(JSON.parse(e))):Xe(0,0,"parentInfoStop")},message(){const e=o();ee(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};p===`${e.data}`.slice(0,h)&&(!1!==C?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||de(`Unexpected message (${e.data})`)}())}function Ge(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"undefined"!=typeof window&&(window.iframeChildListener=e=>Ye({data:e,sameDomain:!0}),o(window,"message",Ye),o(window,"readystatechange",Ge),Ge())}));\n', Re = "iframe-resizer/child 5.1.5", $t = J, j = `<script>${J}<\/script>`, Z = (e) => {
|
|
59
138
|
if (!e || typeof e != "object") return {};
|
|
60
|
-
const t = e.values, n = (
|
|
61
|
-
const i = t && typeof t == "object" ? t[
|
|
139
|
+
const t = e.values, n = (o) => {
|
|
140
|
+
const i = t && typeof t == "object" ? t[o] : void 0;
|
|
62
141
|
if (typeof i == "string" && i) return i;
|
|
63
|
-
const a = e[
|
|
142
|
+
const a = e[o];
|
|
64
143
|
return typeof a == "string" && a ? a : void 0;
|
|
65
|
-
}, r = n("url"),
|
|
144
|
+
}, r = n("url"), s = n("srcdoc");
|
|
66
145
|
return {
|
|
67
146
|
...r ? { url: r } : {},
|
|
68
|
-
...
|
|
147
|
+
...s ? { srcdoc: s } : {}
|
|
69
148
|
};
|
|
70
|
-
},
|
|
71
|
-
if (e.mode !== "result" ||
|
|
72
|
-
const n =
|
|
73
|
-
return !n.url && !n.srcdoc || (n.srcdoc && (n.srcdoc =
|
|
74
|
-
},
|
|
75
|
-
if (
|
|
76
|
-
const t =
|
|
77
|
-
return !t.url && !t.srcdoc || (t.srcdoc && (t.srcdoc =
|
|
78
|
-
},
|
|
149
|
+
}, F = (e) => e && (e.includes("</head>") ? e.replace("</head>", `${j}</head>`) : e.includes("<body") ? e.replace("<body", `${j}<body`) : j + e), $e = (e) => !e || typeof e != "object" || Array.isArray(e) || !e.url && !e.srcdoc ? !1 : !e.srcdoc || e.srcdoc.includes(Re), je = (e, t) => {
|
|
150
|
+
if (e.mode !== "result" || v(e.value) !== "url") return !1;
|
|
151
|
+
const n = Z(e.value);
|
|
152
|
+
return !n.url && !n.srcdoc || (n.srcdoc && (n.srcdoc = F(n.srcdoc)), t.push({ answer_type: "url", values: n })), !0;
|
|
153
|
+
}, Pe = (e) => {
|
|
154
|
+
if ($e(e.values)) return e;
|
|
155
|
+
const t = Z(e);
|
|
156
|
+
return !t.url && !t.srcdoc || (t.srcdoc && (t.srcdoc = F(t.srcdoc)), e.values = t), e;
|
|
157
|
+
}, xe = {
|
|
79
158
|
id: "iframe_page",
|
|
80
159
|
answerType: "url",
|
|
81
|
-
applyChunk:
|
|
82
|
-
normalizeReport:
|
|
83
|
-
},
|
|
160
|
+
applyChunk: je,
|
|
161
|
+
normalizeReport: Pe
|
|
162
|
+
}, x = "recordset", Ie = ["cols", "values", "chart", "title", "max_cols", "parent_link_col", "agent_key"], z = (e) => !!e && typeof e == "object" && !Array.isArray(e) && (Array.isArray(e.cols) || Array.isArray(e.values)), Me = (e) => {
|
|
84
163
|
if (!e || typeof e != "object" || Array.isArray(e)) return;
|
|
85
164
|
const t = e.values;
|
|
86
|
-
if (
|
|
87
|
-
if (
|
|
88
|
-
},
|
|
89
|
-
if (e.mode !== "result" ||
|
|
90
|
-
const n =
|
|
91
|
-
return n && t.push({ answer_type:
|
|
92
|
-
},
|
|
93
|
-
if (
|
|
165
|
+
if (z(t)) return t;
|
|
166
|
+
if (z(e)) return e;
|
|
167
|
+
}, Oe = (e, t) => {
|
|
168
|
+
if (e.mode !== "result" || v(e.value) !== x) return !1;
|
|
169
|
+
const n = Me(e.value);
|
|
170
|
+
return n && t.push({ answer_type: x, values: n }), !0;
|
|
171
|
+
}, Ne = (e) => {
|
|
172
|
+
if (z(e.values)) return e;
|
|
94
173
|
const t = e;
|
|
95
|
-
if (!
|
|
174
|
+
if (!z(t)) return e;
|
|
96
175
|
const n = {};
|
|
97
|
-
for (const r of
|
|
176
|
+
for (const r of Ie)
|
|
98
177
|
n[r] = t[r];
|
|
99
178
|
return e.values = n, e;
|
|
100
|
-
},
|
|
179
|
+
}, ke = {
|
|
101
180
|
id: "recordset",
|
|
102
|
-
answerType:
|
|
103
|
-
applyChunk:
|
|
104
|
-
normalizeReport:
|
|
105
|
-
},
|
|
181
|
+
answerType: x,
|
|
182
|
+
applyChunk: Oe,
|
|
183
|
+
normalizeReport: Ne
|
|
184
|
+
}, E = "output_file", U = (e, t) => {
|
|
106
185
|
if (!e || typeof e != "object") return;
|
|
107
186
|
const n = e[t];
|
|
108
187
|
return typeof n == "string" && n ? n : void 0;
|
|
109
|
-
},
|
|
188
|
+
}, Q = ["file_id", "file_name", "file_path"], ee = (e) => {
|
|
110
189
|
if (!e || typeof e != "object") return {};
|
|
111
|
-
const t = e.values && typeof e.values == "object" ? e.values : void 0, n =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
190
|
+
const t = e.values && typeof e.values == "object" ? e.values : void 0, n = {};
|
|
191
|
+
for (const r of Q) {
|
|
192
|
+
const s = U(t, r) ?? U(e, r);
|
|
193
|
+
s && (n[r] = s);
|
|
194
|
+
}
|
|
195
|
+
return n;
|
|
196
|
+
}, Le = (e, t) => {
|
|
197
|
+
if (e.mode !== "result" || v(e.value) !== E) return !1;
|
|
198
|
+
const n = ee(e.value);
|
|
199
|
+
return !n.file_id && !n.file_name && !n.file_path || t.push({ answer_type: E, values: n }), !0;
|
|
200
|
+
}, De = (e) => {
|
|
201
|
+
const t = ee(e);
|
|
202
|
+
if (!t.file_id && !t.file_name && !t.file_path) return e;
|
|
203
|
+
const n = e.values && typeof e.values == "object" && !Array.isArray(e.values) ? e.values : {}, r = Q.filter((s) => t[s] && !n[s]);
|
|
204
|
+
return r.length === 0 || (e.values = { ...n, ...Object.fromEntries(r.map((s) => [s, t[s]])) }), e;
|
|
205
|
+
}, He = {
|
|
206
|
+
id: E,
|
|
207
|
+
answerType: E,
|
|
208
|
+
applyChunk: Le,
|
|
209
|
+
normalizeReport: De
|
|
210
|
+
}, S = "present_files", h = (e, t) => {
|
|
211
|
+
if (!e || typeof e != "object") return;
|
|
212
|
+
const n = e[t];
|
|
213
|
+
return typeof n == "string" && n.trim() ? n.trim() : void 0;
|
|
214
|
+
}, qe = (e) => {
|
|
215
|
+
const t = String(e || "").replace(/\\/g, "/"), n = t.split("/").filter(Boolean);
|
|
216
|
+
return n[n.length - 1] || t;
|
|
217
|
+
}, Be = (e) => {
|
|
218
|
+
if (!e || typeof e != "object") return null;
|
|
219
|
+
const t = h(e, "id") ?? h(e, "file_id"), n = h(e, "file_path") ?? h(e, "path") ?? h(e, "name"), r = h(e, "file_name");
|
|
220
|
+
if (!t && !n && !r) return null;
|
|
221
|
+
const s = {};
|
|
222
|
+
return t && (s.file_id = t), n && (s.file_path = n), r ? s.file_name = r : n && (s.file_name = qe(n)), s;
|
|
223
|
+
}, te = (e) => {
|
|
224
|
+
if (!e || typeof e != "object") return { files: [] };
|
|
225
|
+
const t = e.values && typeof e.values == "object" && !Array.isArray(e.values) ? e.values : void 0, s = { files: (Array.isArray(t == null ? void 0 : t.files) ? t.files : Array.isArray(e.files) ? e.files : []).map((i) => Be(i)).filter((i) => !!i) }, o = h(t, "explanation") ?? h(e, "explanation");
|
|
226
|
+
return o && (s.explanation = o), s;
|
|
227
|
+
}, Ue = (e, t) => {
|
|
228
|
+
if (e.mode !== "result" || v(e.value) !== S) return !1;
|
|
229
|
+
const n = te(e.value);
|
|
230
|
+
return n.files.length && t.push({ answer_type: S, values: n }), !0;
|
|
231
|
+
}, We = (e) => {
|
|
232
|
+
const t = e.values && typeof e.values == "object" && !Array.isArray(e.values) ? e.values : void 0;
|
|
233
|
+
if (Array.isArray(t == null ? void 0 : t.files) && t.files.every(
|
|
234
|
+
(s) => s && typeof s == "object" && (s.file_id || s.file_name || s.file_path)
|
|
235
|
+
)) return e;
|
|
236
|
+
const r = te(e);
|
|
237
|
+
return r.files.length && (e.values = { ...t ?? {}, files: r.files, ...r.explanation ? { explanation: r.explanation } : {} }), e;
|
|
238
|
+
}, Xe = {
|
|
239
|
+
id: S,
|
|
240
|
+
answerType: S,
|
|
241
|
+
applyChunk: Ue,
|
|
242
|
+
normalizeReport: We
|
|
243
|
+
}, b = (e) => ({
|
|
131
244
|
success: !1,
|
|
132
245
|
message: e,
|
|
133
246
|
data: null
|
|
134
|
-
}),
|
|
247
|
+
}), Ke = (e) => {
|
|
135
248
|
if (typeof e != "string") return e;
|
|
136
249
|
try {
|
|
137
250
|
return JSON.parse(e);
|
|
138
251
|
} catch {
|
|
139
252
|
throw new Error("执行指令不是合法的 JSON");
|
|
140
253
|
}
|
|
141
|
-
},
|
|
142
|
-
const t =
|
|
254
|
+
}, Ye = (e) => {
|
|
255
|
+
const t = Ke(e);
|
|
143
256
|
if (!t || typeof t != "object") throw new Error("执行指令格式无效");
|
|
144
|
-
const { type: n, executor: r, action:
|
|
257
|
+
const { type: n, executor: r, action: s } = t;
|
|
145
258
|
if (n !== "action_execute") throw new Error(`不支持的指令类型:${String(n ?? "")}`);
|
|
146
259
|
if (r !== "host" && r !== "agent")
|
|
147
260
|
throw new Error(`不支持的执行端:${String(r ?? "")}`);
|
|
148
|
-
if (!
|
|
261
|
+
if (!s || typeof s != "object" || typeof s.name != "string" || !s.name.trim())
|
|
149
262
|
throw new Error("执行指令缺少合法的 action.name");
|
|
150
|
-
if (!
|
|
263
|
+
if (!s.arguments || typeof s.arguments != "object" || Array.isArray(s.arguments))
|
|
151
264
|
throw new Error("执行指令的 action.arguments 必须是对象");
|
|
152
265
|
return {
|
|
153
266
|
type: n,
|
|
154
267
|
executor: r,
|
|
155
268
|
action: {
|
|
156
|
-
name:
|
|
157
|
-
arguments:
|
|
269
|
+
name: s.name,
|
|
270
|
+
arguments: s.arguments
|
|
158
271
|
}
|
|
159
272
|
};
|
|
160
|
-
},
|
|
273
|
+
}, Ge = (e, t = "执行端未返回有效的执行结果") => {
|
|
161
274
|
if (!e || typeof e != "object")
|
|
162
|
-
return
|
|
275
|
+
return b(t);
|
|
163
276
|
const n = e;
|
|
164
|
-
return typeof n.success != "boolean" ?
|
|
277
|
+
return typeof n.success != "boolean" ? b("执行端返回的 success 必须是布尔值") : {
|
|
165
278
|
success: n.success,
|
|
166
279
|
message: typeof n.message == "string" ? n.message : n.success ? "操作成功" : "操作失败",
|
|
167
280
|
data: Object.prototype.hasOwnProperty.call(n, "data") ? n.data ?? null : null
|
|
168
281
|
};
|
|
169
|
-
},
|
|
282
|
+
}, jt = (e) => {
|
|
170
283
|
if (e && typeof e == "object") {
|
|
171
284
|
const t = e;
|
|
172
285
|
if (typeof t.success == "boolean")
|
|
@@ -180,10 +293,10 @@ const k = () => ({
|
|
|
180
293
|
data: e
|
|
181
294
|
};
|
|
182
295
|
}
|
|
183
|
-
return
|
|
184
|
-
},
|
|
296
|
+
return b("系统操作返回了无法识别的报文帧");
|
|
297
|
+
}, Ve = (e) => typeof e.reply_id == "string" || typeof e.reply_id == "number" ? e.reply_id : void 0, ne = (e) => {
|
|
185
298
|
if ((e == null ? void 0 : e.mode) !== "front_reply") return { kind: "ignored" };
|
|
186
|
-
const t =
|
|
299
|
+
const t = Ve(e), n = e.values ?? e.value;
|
|
187
300
|
let r = n;
|
|
188
301
|
if (typeof n == "string")
|
|
189
302
|
try {
|
|
@@ -194,21 +307,21 @@ const k = () => ({
|
|
|
194
307
|
if (!r || typeof r != "object" || Array.isArray(r) || r.type !== "action_execute")
|
|
195
308
|
return { kind: "ignored" };
|
|
196
309
|
try {
|
|
197
|
-
return { kind: "ok", replyId: t, command:
|
|
198
|
-
} catch (
|
|
310
|
+
return { kind: "ok", replyId: t, command: Ye(r) };
|
|
311
|
+
} catch (s) {
|
|
199
312
|
return {
|
|
200
313
|
kind: "invalid",
|
|
201
314
|
replyId: t,
|
|
202
|
-
error:
|
|
315
|
+
error: s instanceof Error ? s : new Error("执行指令解析失败")
|
|
203
316
|
};
|
|
204
317
|
}
|
|
205
|
-
},
|
|
206
|
-
let
|
|
207
|
-
const
|
|
318
|
+
}, O = "collect_clarifications", N = "host_action", Je = ["single_select", "multi_select", "date", "text"], y = /* @__PURE__ */ new Map();
|
|
319
|
+
let W = 0;
|
|
320
|
+
const _ = (e) => !!e && typeof e == "object" && !Array.isArray(e), w = (e) => typeof e == "string" && e.trim() ? e : void 0, Ze = (e, t) => {
|
|
208
321
|
if (!Array.isArray(e) || e.length === 0)
|
|
209
322
|
throw new Error(`确认项 ${t} 缺少可选项`);
|
|
210
323
|
return e.map((n, r) => {
|
|
211
|
-
if (!
|
|
324
|
+
if (!_(n) || typeof n.label != "string" || !n.label.trim())
|
|
212
325
|
throw new Error(`确认项 ${t} 的第 ${r + 1} 个选项格式无效`);
|
|
213
326
|
if (!Object.prototype.hasOwnProperty.call(n, "value"))
|
|
214
327
|
throw new Error(`确认项 ${t} 的第 ${r + 1} 个选项缺少 value`);
|
|
@@ -217,68 +330,68 @@ const w = (e) => !!e && typeof e == "object" && !Array.isArray(e), h = (e) => ty
|
|
|
217
330
|
value: n.value
|
|
218
331
|
};
|
|
219
332
|
});
|
|
220
|
-
},
|
|
333
|
+
}, Fe = (e) => {
|
|
221
334
|
if (e === void 0) return;
|
|
222
|
-
if (!
|
|
335
|
+
if (!_(e)) throw new Error("确认项的 binding 必须是对象");
|
|
223
336
|
const t = {};
|
|
224
337
|
return typeof e.actionIndex == "number" && (t.actionIndex = e.actionIndex), typeof e.actionName == "string" && (t.actionName = e.actionName), typeof e.parameterPath == "string" && (t.parameterPath = e.parameterPath), t;
|
|
225
|
-
},
|
|
226
|
-
if (!
|
|
338
|
+
}, Qe = (e, t) => {
|
|
339
|
+
if (!_(e) || !Je.includes(e.type))
|
|
227
340
|
throw new Error(`确认项 ${t} 的 input.type 无效`);
|
|
228
341
|
const n = e.type, r = {
|
|
229
342
|
type: n,
|
|
230
|
-
placeholder:
|
|
343
|
+
placeholder: w(e.placeholder)
|
|
231
344
|
};
|
|
232
|
-
if ((n === "single_select" || n === "multi_select") && (r.options =
|
|
345
|
+
if ((n === "single_select" || n === "multi_select") && (r.options = Ze(e.options, t)), n === "date") {
|
|
233
346
|
if (e.format !== void 0 && e.format !== "YYYY-MM-DD")
|
|
234
347
|
throw new Error(`确认项 ${t} 暂不支持日期格式 ${String(e.format)}`);
|
|
235
348
|
r.format = "YYYY-MM-DD";
|
|
236
349
|
}
|
|
237
350
|
if (e.textInput !== void 0) {
|
|
238
|
-
if (!
|
|
351
|
+
if (!_(e.textInput)) throw new Error(`确认项 ${t} 的 textInput 必须是对象`);
|
|
239
352
|
r.textInput = {
|
|
240
|
-
placeholder:
|
|
353
|
+
placeholder: w(e.textInput.placeholder)
|
|
241
354
|
};
|
|
242
355
|
}
|
|
243
356
|
return r;
|
|
244
|
-
},
|
|
357
|
+
}, et = (e) => {
|
|
245
358
|
if (!Array.isArray(e.items) || e.items.length === 0)
|
|
246
359
|
throw new Error("collect_clarifications 至少需要一个确认项");
|
|
247
|
-
const t = /* @__PURE__ */ new Set(), n = e.items.map((r,
|
|
248
|
-
if (!
|
|
249
|
-
const
|
|
250
|
-
if (!
|
|
251
|
-
if (t.has(
|
|
252
|
-
if (!i) throw new Error(`确认项 ${
|
|
253
|
-
return t.add(
|
|
254
|
-
id:
|
|
360
|
+
const t = /* @__PURE__ */ new Set(), n = e.items.map((r, s) => {
|
|
361
|
+
if (!_(r)) throw new Error(`第 ${s + 1} 个确认项格式无效`);
|
|
362
|
+
const o = typeof r.id == "string" ? r.id.trim() : "", i = typeof r.question == "string" ? r.question.trim() : "";
|
|
363
|
+
if (!o) throw new Error(`第 ${s + 1} 个确认项缺少 id`);
|
|
364
|
+
if (t.has(o)) throw new Error(`确认项 id 重复:${o}`);
|
|
365
|
+
if (!i) throw new Error(`确认项 ${o} 缺少 question`);
|
|
366
|
+
return t.add(o), {
|
|
367
|
+
id: o,
|
|
255
368
|
question: i,
|
|
256
|
-
description:
|
|
369
|
+
description: w(r.description),
|
|
257
370
|
required: r.required !== !1,
|
|
258
371
|
default: r.default,
|
|
259
|
-
binding:
|
|
260
|
-
input:
|
|
372
|
+
binding: Fe(r.binding),
|
|
373
|
+
input: Qe(r.input, o)
|
|
261
374
|
};
|
|
262
375
|
});
|
|
263
376
|
return {
|
|
264
|
-
title:
|
|
265
|
-
description:
|
|
377
|
+
title: w(e.title) ?? "需要你确认几项信息",
|
|
378
|
+
description: w(e.description) ?? "请补充以下信息,我会据此继续完成操作。",
|
|
266
379
|
items: n
|
|
267
380
|
};
|
|
268
|
-
},
|
|
381
|
+
}, tt = (e) => e !== void 0 ? String(e) : (W += 1, `clarification-${Date.now()}-${W}`), nt = (e) => {
|
|
269
382
|
y.set(e.reportId, e);
|
|
270
|
-
},
|
|
383
|
+
}, Pt = (e) => y.has(e), C = (e, t) => {
|
|
271
384
|
const n = e.reports.findIndex(
|
|
272
385
|
(r) => {
|
|
273
|
-
var
|
|
274
|
-
return r.answer_type ===
|
|
386
|
+
var s;
|
|
387
|
+
return r.answer_type === O && ((s = r.values) == null ? void 0 : s.requestId) === e.reportId;
|
|
275
388
|
}
|
|
276
389
|
);
|
|
277
390
|
n < 0 || e.reports.splice(n, 1, {
|
|
278
391
|
...e.reports[n],
|
|
279
392
|
values: { ...e.reports[n].values, ...t }
|
|
280
393
|
});
|
|
281
|
-
},
|
|
394
|
+
}, re = (e, t) => {
|
|
282
395
|
var n;
|
|
283
396
|
if (!e.reply) return !1;
|
|
284
397
|
try {
|
|
@@ -290,188 +403,227 @@ const w = (e) => !!e && typeof e == "object" && !Array.isArray(e), h = (e) => ty
|
|
|
290
403
|
} catch (r) {
|
|
291
404
|
return (n = e.onError) == null || n.call(e, r), !1;
|
|
292
405
|
}
|
|
293
|
-
},
|
|
406
|
+
}, xt = (e, t) => {
|
|
294
407
|
const n = y.get(e);
|
|
295
408
|
if (!n) return !1;
|
|
296
409
|
y.delete(e);
|
|
297
|
-
const r =
|
|
410
|
+
const r = re(n, {
|
|
298
411
|
success: !0,
|
|
299
412
|
message: "用户已提交补充信息",
|
|
300
413
|
data: { answers: t }
|
|
301
414
|
});
|
|
302
|
-
return
|
|
415
|
+
return C(n, {
|
|
303
416
|
status: "submitted",
|
|
304
417
|
resultMessage: r ? "补充信息已提交" : "补充信息已提交,但结果回传失败(连接已关闭)",
|
|
305
418
|
answers: t
|
|
306
419
|
}), !0;
|
|
307
|
-
},
|
|
420
|
+
}, It = (e) => {
|
|
308
421
|
const t = y.get(e);
|
|
309
422
|
if (!t) return !1;
|
|
310
423
|
y.delete(e);
|
|
311
|
-
const n =
|
|
424
|
+
const n = re(t, {
|
|
312
425
|
success: !1,
|
|
313
426
|
message: "用户取消了补充信息",
|
|
314
427
|
data: null
|
|
315
428
|
});
|
|
316
|
-
return
|
|
429
|
+
return C(t, {
|
|
317
430
|
status: "cancelled",
|
|
318
431
|
resultMessage: n ? "已取消补充信息" : "已取消补充信息,但结果回传失败(连接已关闭)"
|
|
319
432
|
}), !0;
|
|
320
|
-
},
|
|
433
|
+
}, Mt = (e) => {
|
|
321
434
|
y.forEach((t, n) => {
|
|
322
|
-
e && t.reply !== e || (
|
|
435
|
+
e && t.reply !== e || (C(t, {
|
|
323
436
|
status: "expired",
|
|
324
437
|
resultMessage: "本次补充信息已失效(回答已结束)"
|
|
325
438
|
}), y.delete(n));
|
|
326
439
|
});
|
|
327
|
-
},
|
|
440
|
+
}, Ot = (e) => {
|
|
328
441
|
y.forEach((t, n) => {
|
|
329
|
-
t.reply === e && (
|
|
442
|
+
t.reply === e && (C(t, {
|
|
330
443
|
status: "expired",
|
|
331
444
|
resultMessage: "本次补充信息已失效(连接已关闭)"
|
|
332
445
|
}), y.delete(n));
|
|
333
446
|
});
|
|
334
|
-
},
|
|
447
|
+
}, se = (e, t, n) => {
|
|
335
448
|
var r;
|
|
336
449
|
if (!(e != null && e.reply)) return !1;
|
|
337
450
|
try {
|
|
338
|
-
const
|
|
339
|
-
return e.reply(
|
|
340
|
-
} catch (
|
|
341
|
-
return (r = e.onError) == null || r.call(e,
|
|
451
|
+
const s = { type: "wait_reply", reply_id: t, values: n };
|
|
452
|
+
return e.reply(s) !== !1;
|
|
453
|
+
} catch (s) {
|
|
454
|
+
return (r = e.onError) == null || r.call(e, s), !1;
|
|
342
455
|
}
|
|
343
|
-
},
|
|
344
|
-
|
|
345
|
-
},
|
|
346
|
-
var
|
|
347
|
-
const
|
|
348
|
-
if (
|
|
349
|
-
const { command:
|
|
350
|
-
if (
|
|
456
|
+
}, I = (e, t, n) => {
|
|
457
|
+
se(e, t, b(n));
|
|
458
|
+
}, rt = (e, t, n, r) => {
|
|
459
|
+
var m;
|
|
460
|
+
const s = ne(e);
|
|
461
|
+
if (s.kind !== "ok") return !1;
|
|
462
|
+
const { command: o, replyId: i } = s;
|
|
463
|
+
if (o.executor !== "agent" || o.action.name !== "collect_clarifications") return !1;
|
|
351
464
|
const a = r == null ? void 0 : r.actionExecute;
|
|
352
465
|
let c;
|
|
353
466
|
try {
|
|
354
|
-
c =
|
|
467
|
+
c = et(o.action.arguments);
|
|
355
468
|
} catch (d) {
|
|
356
|
-
return (
|
|
469
|
+
return (m = a == null ? void 0 : a.onError) == null || m.call(a, d), I(a, i, d instanceof Error ? d.message : "确认项参数无效"), !0;
|
|
357
470
|
}
|
|
358
|
-
const l =
|
|
471
|
+
const l = tt(i), u = {
|
|
359
472
|
requestId: l,
|
|
360
473
|
...c,
|
|
361
474
|
status: "pending",
|
|
362
475
|
resultMessage: ""
|
|
363
476
|
};
|
|
364
|
-
return
|
|
477
|
+
return nt({
|
|
365
478
|
reportId: l,
|
|
366
479
|
replyId: i,
|
|
367
480
|
reports: t,
|
|
368
481
|
reply: a == null ? void 0 : a.reply,
|
|
369
482
|
onError: a == null ? void 0 : a.onError
|
|
370
|
-
}), t.push({ answer_type:
|
|
371
|
-
},
|
|
483
|
+
}), t.push({ answer_type: O, values: u }), !0;
|
|
484
|
+
}, st = (e) => {
|
|
372
485
|
const t = e.values;
|
|
373
486
|
!t || typeof t != "object" || t.status === "pending" && (t.status = "expired", t.resultMessage = "本次补充信息已失效(回答已结束)");
|
|
374
|
-
},
|
|
487
|
+
}, ot = {
|
|
375
488
|
id: "collect_clarifications",
|
|
376
|
-
answerType:
|
|
377
|
-
applyChunk:
|
|
378
|
-
normalizeReport:
|
|
489
|
+
answerType: O,
|
|
490
|
+
applyChunk: rt,
|
|
491
|
+
normalizeReport: st
|
|
379
492
|
};
|
|
380
|
-
let
|
|
381
|
-
const
|
|
382
|
-
const r = e.findIndex((
|
|
383
|
-
var
|
|
384
|
-
return
|
|
493
|
+
let X = 0;
|
|
494
|
+
const it = (e) => e !== void 0 ? String(e) : (X += 1, `host-action-${Date.now()}-${X}`), at = (e, t, n) => {
|
|
495
|
+
const r = e.findIndex((s) => {
|
|
496
|
+
var o;
|
|
497
|
+
return s.answer_type === N && ((o = s.values) == null ? void 0 : o.id) === t;
|
|
385
498
|
});
|
|
386
499
|
r < 0 || e.splice(r, 1, {
|
|
387
500
|
...e[r],
|
|
388
501
|
values: { ...e[r].values, ...n }
|
|
389
502
|
});
|
|
390
|
-
},
|
|
503
|
+
}, ct = async (e, t, n, r, s, o) => {
|
|
391
504
|
var a, c;
|
|
392
505
|
let i;
|
|
393
506
|
try {
|
|
394
|
-
i =
|
|
507
|
+
i = Ge(await o(e), `宿主未返回 ${e.name} 的执行结果`);
|
|
395
508
|
} catch (l) {
|
|
396
|
-
(a =
|
|
509
|
+
(a = s.onError) == null || a.call(s, l), i = b(l instanceof Error ? l.message : `${e.name} 执行失败`);
|
|
397
510
|
}
|
|
398
|
-
|
|
511
|
+
at(r, t, {
|
|
399
512
|
status: i.success ? "success" : "error",
|
|
400
513
|
message: i.message,
|
|
401
514
|
data: i.data ?? void 0
|
|
402
|
-
}),
|
|
403
|
-
},
|
|
515
|
+
}), se(s, n, i) || (c = s.onError) == null || c.call(s, new Error(`${e.name} 已执行,但 wait_reply 回传失败(连接已关闭)`));
|
|
516
|
+
}, lt = (e, t, n, r) => {
|
|
404
517
|
var u;
|
|
405
|
-
const
|
|
406
|
-
if (
|
|
407
|
-
const
|
|
408
|
-
if (
|
|
409
|
-
return
|
|
410
|
-
const { command: i, replyId: a } =
|
|
518
|
+
const s = ne(e);
|
|
519
|
+
if (s.kind === "ignored") return !1;
|
|
520
|
+
const o = r == null ? void 0 : r.actionExecute;
|
|
521
|
+
if (s.kind === "invalid")
|
|
522
|
+
return o != null && o.reply ? ((u = o.onError) == null || u.call(o, s.error), I(o, s.replyId, s.error.message), !0) : !1;
|
|
523
|
+
const { command: i, replyId: a } = s;
|
|
411
524
|
if (i.executor !== "host") return !1;
|
|
412
|
-
if (!(
|
|
413
|
-
return
|
|
414
|
-
const c =
|
|
525
|
+
if (!(o != null && o.execute))
|
|
526
|
+
return o != null && o.reply ? (I(o, a, "当前页面不支持该操作"), !0) : !1;
|
|
527
|
+
const c = it(a), l = {
|
|
415
528
|
id: c,
|
|
416
529
|
name: i.action.name,
|
|
417
530
|
arguments: i.action.arguments,
|
|
418
531
|
status: "running",
|
|
419
532
|
message: "执行中…"
|
|
420
533
|
};
|
|
421
|
-
return t.push({ answer_type:
|
|
422
|
-
},
|
|
534
|
+
return t.push({ answer_type: N, values: l }), ct(i.action, c, a, t, o, o.execute), !0;
|
|
535
|
+
}, ut = (e) => {
|
|
423
536
|
const t = e.values;
|
|
424
537
|
!t || typeof t != "object" || t.status === "running" && (t.status = "unknown", t.message = "执行状态未知(回答已结束)");
|
|
425
|
-
},
|
|
538
|
+
}, dt = {
|
|
426
539
|
id: "host_action",
|
|
427
|
-
answerType:
|
|
428
|
-
applyChunk:
|
|
429
|
-
normalizeReport:
|
|
430
|
-
},
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
540
|
+
answerType: N,
|
|
541
|
+
applyChunk: lt,
|
|
542
|
+
normalizeReport: ut
|
|
543
|
+
}, T = (e) => {
|
|
544
|
+
var i;
|
|
545
|
+
const t = e ?? {}, n = ((i = t.answer) == null ? void 0 : i.state) ?? t.state ?? null, r = n === "1" || n === 1 ? "1" : n === "0" || n === 0 ? "0" : null, s = Array.isArray(t.context_history) ? [...t.context_history].sort((a, c) => Number((c == null ? void 0 : c.ratio) ?? 0) - Number((a == null ? void 0 : a.ratio) ?? 0)) : [], o = t.run_ms != null && t.run_ms !== "" && Number.isFinite(Number(t.run_ms)) ? Number(t.run_ms) : null;
|
|
546
|
+
return {
|
|
547
|
+
state: r,
|
|
548
|
+
conclusion: Array.isArray(t.conclusion) ? t.conclusion.filter((a) => a && a.report) : [],
|
|
549
|
+
contextHistory: s,
|
|
550
|
+
entry: t.entry && typeof t.entry == "object" ? t.entry : null,
|
|
551
|
+
err: t.err && typeof t.err == "object" && (t.err.code || t.err.msg) ? t.err : null,
|
|
552
|
+
runMs: o
|
|
553
|
+
};
|
|
554
|
+
}, ft = ["conclusion", "context_history", "entry", "err", "run_ms", "attach"], Nt = (e, t) => {
|
|
555
|
+
const n = (t == null ? void 0 : t.values) ?? t;
|
|
556
|
+
!n || typeof n != "object" || (ft.forEach((r) => {
|
|
557
|
+
const s = n[r], o = e[r], i = o == null || Array.isArray(o) && o.length === 0;
|
|
558
|
+
s != null && i && (e[r] = s);
|
|
559
|
+
}), n.answer && "state" in n.answer && e.answer && (e.answer.state = n.answer.state));
|
|
560
|
+
}, pt = {
|
|
561
|
+
id: "conclusion",
|
|
562
|
+
applyChunk: (e, t, n) => {
|
|
563
|
+
if (e.mode !== "conclusion") return !1;
|
|
564
|
+
const r = e.value, s = Array.isArray(r) ? r : r && typeof r == "object" ? [r] : [];
|
|
565
|
+
return s.length && (n.conclusion = s), !0;
|
|
566
|
+
}
|
|
567
|
+
}, kt = (e) => {
|
|
568
|
+
var n;
|
|
569
|
+
const t = [];
|
|
570
|
+
return (((n = e == null ? void 0 : e.answer) == null ? void 0 : n.reports) ?? []).forEach((r) => {
|
|
571
|
+
r.answer_type === "knowledge_stream_result" && Array.isArray(r.values) ? r.values.forEach((s) => (s == null ? void 0 : s.answer) && t.push(s.answer)) : r.answer_type === "text" && typeof r.values == "string" && t.push(r.values);
|
|
572
|
+
}), T(e).conclusion.forEach((r) => r.report && t.push(r.report)), t.join(`
|
|
573
|
+
|
|
574
|
+
`).trim();
|
|
575
|
+
}, Lt = (e) => e.replace(/```[\s\S]*?\n([\s\S]*?)```/g, "$1").replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/^\s{0,3}#{1,6}\s+/gm, "").replace(/^\s{0,3}>\s?/gm, "").replace(/(\*\*|__)(?=\S)[\s\S]*?\1/g, (t, n) => t.split(n).join("")).replace(new RegExp("(?<![*_\\w])\\*([^*\\n]+?)\\*(?!\\*)", "g"), "$1").replace(new RegExp("(?<![_\\w])_([^_\\n]+?)_(?![_\\w])", "g"), "$1").replace(/~~(?=\S)[\s\S]*?~~/g, (t) => t.split("~~").join("")).replace(/`([^`]*)`/g, "$1").replace(/^\s*[-*+]\s+/gm, "").replace(/\n{3,}/g, `
|
|
576
|
+
|
|
577
|
+
`).trim(), A = [
|
|
578
|
+
we,
|
|
579
|
+
pe,
|
|
580
|
+
xe,
|
|
581
|
+
ke,
|
|
582
|
+
He,
|
|
583
|
+
Xe,
|
|
436
584
|
// action_execute 按执行端拆成两个 parser,各自只认自己那一种组合(其余 return false)
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
585
|
+
ot,
|
|
586
|
+
dt,
|
|
587
|
+
// result 整包下发的通用类型:text / sql_query / device_last_value / camera / video / wav / script
|
|
588
|
+
...Te,
|
|
589
|
+
// 回答级元信息:conclusion 帧写入 answerValues.conclusion(不产出 report)
|
|
590
|
+
pt
|
|
591
|
+
], mt = (e) => {
|
|
440
592
|
const t = (e == null ? void 0 : e.parsers) ?? [];
|
|
441
|
-
return t.length ? [...
|
|
442
|
-
},
|
|
593
|
+
return t.length ? [...A, ...t] : A;
|
|
594
|
+
}, Dt = (e, t, n) => {
|
|
443
595
|
var i;
|
|
444
596
|
const r = (i = e.answer) == null ? void 0 : i.reports;
|
|
445
597
|
if (!r) return [];
|
|
446
|
-
const
|
|
598
|
+
const s = new Set(
|
|
447
599
|
((n == null ? void 0 : n.parsers) ?? []).filter((a) => a.applyChunk && a.answerType).map((a) => a.answerType)
|
|
448
|
-
),
|
|
449
|
-
for (const a of
|
|
450
|
-
a.applyChunk && (
|
|
451
|
-
return
|
|
452
|
-
},
|
|
453
|
-
var
|
|
600
|
+
), o = [];
|
|
601
|
+
for (const a of mt(n))
|
|
602
|
+
a.applyChunk && (A.includes(a) && a.answerType && s.has(a.answerType) || a.applyChunk(t, r, e, n) && o.push(a.id));
|
|
603
|
+
return o;
|
|
604
|
+
}, yt = (e, t) => {
|
|
605
|
+
var o;
|
|
454
606
|
const n = e.answer_type;
|
|
455
607
|
if (!n) return;
|
|
456
|
-
const
|
|
457
|
-
(
|
|
458
|
-
},
|
|
608
|
+
const s = ((t == null ? void 0 : t.parsers) ?? []).find((i) => i.answerType === n && !!i.normalizeReport) ?? A.find((i) => i.answerType === n && !!i.normalizeReport);
|
|
609
|
+
(o = s == null ? void 0 : s.normalizeReport) == null || o.call(s, e, t);
|
|
610
|
+
}, k = (e, t = "", n = "", r) => {
|
|
459
611
|
var i;
|
|
460
|
-
const
|
|
461
|
-
if ((i =
|
|
462
|
-
const a =
|
|
612
|
+
const s = (e == null ? void 0 : e.values) ?? e;
|
|
613
|
+
if ((i = s == null ? void 0 : s.answer) != null && i.reports) {
|
|
614
|
+
const a = s;
|
|
463
615
|
for (const c of a.answer.reports)
|
|
464
|
-
|
|
616
|
+
yt(c, r);
|
|
465
617
|
return a;
|
|
466
618
|
}
|
|
467
|
-
const
|
|
468
|
-
return typeof
|
|
469
|
-
},
|
|
619
|
+
const o = ue(t, n);
|
|
620
|
+
return typeof s == "string" && Y({ mode: "knowledge_stream", value: s }, o.answer.reports, o, r), o;
|
|
621
|
+
}, Ht = {
|
|
470
622
|
User: "user",
|
|
471
623
|
Assistant: "assistant"
|
|
472
624
|
};
|
|
473
|
-
let
|
|
474
|
-
const
|
|
625
|
+
let ht = 0;
|
|
626
|
+
const oe = (e = "msg") => `${e}-${++ht}`, gt = (e) => {
|
|
475
627
|
const t = e.trim();
|
|
476
628
|
if (!t || t === "[DONE]") return null;
|
|
477
629
|
const n = t.replace(/^data:\s*/, "");
|
|
@@ -484,7 +636,7 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
484
636
|
return null;
|
|
485
637
|
}
|
|
486
638
|
}
|
|
487
|
-
},
|
|
639
|
+
}, wt = () => {
|
|
488
640
|
let e = "";
|
|
489
641
|
return {
|
|
490
642
|
push(t) {
|
|
@@ -497,56 +649,56 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
497
649
|
return e = "", t ? [t] : [];
|
|
498
650
|
}
|
|
499
651
|
};
|
|
500
|
-
},
|
|
652
|
+
}, bt = 30, _t = /[A-Za-z]:[\\/][^\s"'`,。;;、,()()【】\[\]<>|?*]*/g, vt = /\\\\[^\s"'`,。;;、,()()【】\[\]<>|?*]+/g, zt = /(^|[\s"'`((【\[::,,、])((?:\/[^\s"'`,。;;、,()()【】\[\]<>|?*\/]+){2,})/g, Et = /^(?:请帮忙|请帮我|帮我看看|帮我把|帮我|帮忙|请把|麻烦你|麻烦|劳驾|请你|请问|帮(?!助))\s*[::,,、\-—]?\s*/, P = (e) => {
|
|
501
653
|
const t = e.split(/[\\/]+/).filter(Boolean);
|
|
502
654
|
return t.length ? t[t.length - 1] : "";
|
|
503
|
-
},
|
|
655
|
+
}, St = (e) => e.replace(vt, (t) => P(t)).replace(_t, (t) => P(t)).replace(zt, (t, n, r) => n + P(r)), qt = (e) => {
|
|
504
656
|
let t = String(e ?? "").replace(/\r\n|\r|\n/g, " ").replace(/\s+/g, " ").trim();
|
|
505
657
|
if (!t) return "";
|
|
506
|
-
t =
|
|
658
|
+
t = St(t).replace(/\s+/g, " ").trim();
|
|
507
659
|
let n = "";
|
|
508
660
|
for (; n !== t; )
|
|
509
|
-
n = t, t = t.replace(
|
|
510
|
-
return t.slice(0,
|
|
511
|
-
},
|
|
512
|
-
const n = e.getReader(), r = new TextDecoder(),
|
|
513
|
-
const a =
|
|
661
|
+
n = t, t = t.replace(Et, "").trim(), t = t.replace(/^[::,,、\-—\s]+/, "").trim();
|
|
662
|
+
return t.slice(0, bt);
|
|
663
|
+
}, Bt = async (e, t) => {
|
|
664
|
+
const n = e.getReader(), r = new TextDecoder(), s = wt(), o = (i) => {
|
|
665
|
+
const a = gt(i);
|
|
514
666
|
a && t(a);
|
|
515
667
|
};
|
|
516
668
|
try {
|
|
517
669
|
for (; ; ) {
|
|
518
670
|
const { done: i, value: a } = await n.read();
|
|
519
671
|
if (i) break;
|
|
520
|
-
|
|
672
|
+
s.push(r.decode(a, { stream: !0 })).forEach(o);
|
|
521
673
|
}
|
|
522
|
-
|
|
674
|
+
s.flush().forEach(o);
|
|
523
675
|
} catch (i) {
|
|
524
676
|
throw await n.cancel().catch(() => {
|
|
525
677
|
}), i;
|
|
526
678
|
} finally {
|
|
527
679
|
n.releaseLock();
|
|
528
680
|
}
|
|
529
|
-
},
|
|
681
|
+
}, R = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "svg", "bmp"]), ie = (e) => !e || isNaN(e) ? "" : e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`, Ut = (e) => {
|
|
530
682
|
var r;
|
|
531
683
|
if (e.type && e.type !== "file") return !1;
|
|
532
684
|
const t = e.attachContent || {};
|
|
533
685
|
if (t.groupType === "image") return !0;
|
|
534
686
|
const n = (t.suffix || ((r = e.name) != null && r.includes(".") ? e.name.split(".").pop() : "") || "").toLowerCase();
|
|
535
|
-
return !!(
|
|
536
|
-
},
|
|
687
|
+
return !!(R.has(n) || t.raw && typeof t.raw.type == "string" && t.raw.type.startsWith("image/"));
|
|
688
|
+
}, At = (e, t, n) => e.startsWith("http://") || e.startsWith("https://") || e.startsWith("/") ? e : `${(t || "").replace(/\/$/, "")}${n}?file_id=${e}`, Ct = (e, t = "", n) => e ? n ? n(e) : At(e, t, "/file/download_file") : "", Wt = (e, t = "", n) => {
|
|
537
689
|
const r = e.attachContent || {};
|
|
538
|
-
return r.url ? r.url : typeof r.fileContent == "string" && r.fileContent.startsWith("data:image/") ? r.fileContent : r.fileId ?
|
|
539
|
-
},
|
|
690
|
+
return r.url ? r.url : typeof r.fileContent == "string" && r.fileContent.startsWith("data:image/") ? r.fileContent : r.fileId ? Ct(r.fileId, t, n) : "";
|
|
691
|
+
}, K = (e) => {
|
|
540
692
|
var a;
|
|
541
|
-
const t = (e == null ? void 0 : e.name) || "", n = t.includes(".") && ((a = t.split(".").pop()) == null ? void 0 : a.toLowerCase()) || "", r =
|
|
542
|
-
let
|
|
693
|
+
const t = (e == null ? void 0 : e.name) || "", n = t.includes(".") && ((a = t.split(".").pop()) == null ? void 0 : a.toLowerCase()) || "", r = R.has(n) || (e == null ? void 0 : e.type) && typeof e.type == "string" && e.type.startsWith("image/");
|
|
694
|
+
let s;
|
|
543
695
|
if (r && typeof window < "u" && typeof URL < "u" && e instanceof Blob)
|
|
544
696
|
try {
|
|
545
|
-
|
|
697
|
+
s = URL.createObjectURL(e);
|
|
546
698
|
} catch {
|
|
547
|
-
|
|
699
|
+
s = void 0;
|
|
548
700
|
}
|
|
549
|
-
const
|
|
701
|
+
const o = ie(e == null ? void 0 : e.size), i = [n.toUpperCase(), o].filter(Boolean).join(" · ");
|
|
550
702
|
return {
|
|
551
703
|
type: "file",
|
|
552
704
|
name: t,
|
|
@@ -556,17 +708,17 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
556
708
|
size: e == null ? void 0 : e.size,
|
|
557
709
|
suffix: n,
|
|
558
710
|
raw: e,
|
|
559
|
-
url:
|
|
711
|
+
url: s,
|
|
560
712
|
groupType: r ? "image" : "file"
|
|
561
713
|
}
|
|
562
714
|
};
|
|
563
|
-
},
|
|
564
|
-
var
|
|
565
|
-
const t = (e == null ? void 0 : e.file_name) ?? (e == null ? void 0 : e.name) ?? (e == null ? void 0 : e.title) ?? "", n = t.includes(".") && ((
|
|
715
|
+
}, ae = (e) => {
|
|
716
|
+
var o;
|
|
717
|
+
const t = (e == null ? void 0 : e.file_name) ?? (e == null ? void 0 : e.name) ?? (e == null ? void 0 : e.title) ?? "", n = t.includes(".") && ((o = t.split(".").pop()) == null ? void 0 : o.toLowerCase()) || "", r = R.has(n) || (e == null ? void 0 : e.groupType) === "image", s = n ? n.toUpperCase() : "";
|
|
566
718
|
return {
|
|
567
719
|
type: "file",
|
|
568
720
|
name: t,
|
|
569
|
-
description:
|
|
721
|
+
description: s,
|
|
570
722
|
attachContent: {
|
|
571
723
|
file_name: (e == null ? void 0 : e.file_name) ?? t,
|
|
572
724
|
fileId: (e == null ? void 0 : e.file_id) ?? (e == null ? void 0 : e.id),
|
|
@@ -575,46 +727,46 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
575
727
|
groupType: r ? "image" : "file"
|
|
576
728
|
}
|
|
577
729
|
};
|
|
578
|
-
},
|
|
579
|
-
var r,
|
|
580
|
-
const t = (e == null ? void 0 : e.values) ?? e, n = ((r = t == null ? void 0 : t.attach) == null ? void 0 : r.files) ?? ((
|
|
581
|
-
return !Array.isArray(n) || n.length === 0 ? [] : n.map((a) =>
|
|
582
|
-
},
|
|
583
|
-
var r,
|
|
730
|
+
}, Tt = (e) => {
|
|
731
|
+
var r, s, o, i;
|
|
732
|
+
const t = (e == null ? void 0 : e.values) ?? e, n = ((r = t == null ? void 0 : t.attach) == null ? void 0 : r.files) ?? ((o = (s = t == null ? void 0 : t.answer) == null ? void 0 : s.attach) == null ? void 0 : o.files) ?? (t == null ? void 0 : t.attach_files) ?? ((i = t == null ? void 0 : t.answer) == null ? void 0 : i.attach_files) ?? [];
|
|
733
|
+
return !Array.isArray(n) || n.length === 0 ? [] : n.map((a) => ae(a));
|
|
734
|
+
}, Xt = (e) => {
|
|
735
|
+
var r, s;
|
|
584
736
|
if (!e)
|
|
585
737
|
return { type: "file", name: "", description: "", attachContent: {} };
|
|
586
738
|
if (typeof Blob < "u" && e instanceof Blob)
|
|
587
|
-
return
|
|
739
|
+
return K(e);
|
|
588
740
|
if (typeof e == "object" && e.attachContent) {
|
|
589
|
-
const
|
|
741
|
+
const o = e.type || "file", i = e.name || e.attachContent.file_name || e.attachContent.name || "";
|
|
590
742
|
let a = e.description || "";
|
|
591
743
|
const c = { ...e.attachContent };
|
|
592
|
-
if (
|
|
593
|
-
const u = typeof c.size == "number" ?
|
|
744
|
+
if (o === "file" && (!c.suffix && i.includes(".") && (c.suffix = ((r = i.split(".").pop()) == null ? void 0 : r.toLowerCase()) || ""), (c.groupType === "image" || c.suffix && R.has(c.suffix.toLowerCase()) || c.raw && typeof c.raw.type == "string" && c.raw.type.startsWith("image/")) && (c.groupType = "image"), !a)) {
|
|
745
|
+
const u = typeof c.size == "number" ? ie(c.size) : c.size || "";
|
|
594
746
|
a = [c.suffix ? c.suffix.toUpperCase() : "", u].filter(Boolean).join(" · ");
|
|
595
747
|
}
|
|
596
748
|
return {
|
|
597
749
|
...e,
|
|
598
|
-
type:
|
|
750
|
+
type: o,
|
|
599
751
|
name: i,
|
|
600
752
|
description: a,
|
|
601
753
|
attachContent: c
|
|
602
754
|
};
|
|
603
755
|
}
|
|
604
756
|
if (e.file_id || e.fileId)
|
|
605
|
-
return
|
|
757
|
+
return ae(e);
|
|
606
758
|
if (e.raw && typeof Blob < "u" && e.raw instanceof Blob) {
|
|
607
|
-
const
|
|
759
|
+
const o = K(e.raw);
|
|
608
760
|
return {
|
|
609
|
-
...
|
|
761
|
+
...o,
|
|
610
762
|
...e,
|
|
611
763
|
attachContent: {
|
|
612
|
-
...
|
|
764
|
+
...o.attachContent,
|
|
613
765
|
...e.attachContent
|
|
614
766
|
}
|
|
615
767
|
};
|
|
616
768
|
}
|
|
617
|
-
const t = e.name || e.title || "", n = t.includes(".") && ((
|
|
769
|
+
const t = e.name || e.title || "", n = t.includes(".") && ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
|
|
618
770
|
return {
|
|
619
771
|
type: e.type || "file",
|
|
620
772
|
name: t,
|
|
@@ -625,23 +777,41 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
625
777
|
...e
|
|
626
778
|
}
|
|
627
779
|
};
|
|
628
|
-
},
|
|
780
|
+
}, Rt = 24 * 60 * 60 * 1e3, Kt = (e, t, n = Date.now()) => {
|
|
781
|
+
let r;
|
|
782
|
+
if (typeof e == "number")
|
|
783
|
+
r = e;
|
|
784
|
+
else if (typeof e == "string") {
|
|
785
|
+
const s = e.trim();
|
|
786
|
+
if (!s) return null;
|
|
787
|
+
r = /^\d+$/.test(s) ? Number(s) : Date.parse(s.replace(" ", "T"));
|
|
788
|
+
} else
|
|
789
|
+
return null;
|
|
790
|
+
return !Number.isFinite(r) || r < 1e12 || r > n + 60 * 1e3 || typeof t == "number" && (r > t || t - r > Rt) ? null : r;
|
|
791
|
+
}, Yt = (e) => typeof e == "number" && Number.isFinite(e) && e >= 0, Gt = (e) => {
|
|
792
|
+
const t = typeof e == "number" && Number.isFinite(e) && e > 0 ? e : 0;
|
|
793
|
+
if (t < 1e3) return `${Math.round(t)}毫秒`;
|
|
794
|
+
const n = Math.round(t / 1e3);
|
|
795
|
+
if (n < 60) return `${n}秒`;
|
|
796
|
+
const r = Math.floor(n % 60), s = Math.floor(n / 60);
|
|
797
|
+
return s < 60 ? `${s}分${String(r).padStart(2, "0")}秒` : `${Math.floor(s / 60)}时${String(s % 60).padStart(2, "0")}分`;
|
|
798
|
+
}, L = (e) => Tt(e), Vt = async (e) => [...(await e.getHistoryGroups()).groups ?? []].sort((r, s) => String(s.create_time ?? "").localeCompare(String(r.create_time ?? ""))), Jt = async (e, t) => {
|
|
629
799
|
const n = await e.createHistoryGroup(t), r = (n == null ? void 0 : n.group_id) ?? (n == null ? void 0 : n.history_group_id) ?? "";
|
|
630
800
|
if (!r) throw new Error("创建对话分组失败");
|
|
631
801
|
return r;
|
|
632
|
-
},
|
|
802
|
+
}, Zt = (e, t) => e.deleteHistoryGroup(t), Ft = (e, t, n) => e.setHistoryGroupTitle(t, n), ce = 5, le = async (e, t, n) => {
|
|
633
803
|
const r = new Array(e.length);
|
|
634
|
-
let
|
|
635
|
-
const
|
|
636
|
-
for (;
|
|
637
|
-
const i =
|
|
804
|
+
let s = 0;
|
|
805
|
+
const o = Array.from({ length: Math.min(t, e.length) }, async () => {
|
|
806
|
+
for (; s < e.length; ) {
|
|
807
|
+
const i = s++;
|
|
638
808
|
r[i] = await n(e[i], i);
|
|
639
809
|
}
|
|
640
810
|
});
|
|
641
|
-
return await Promise.all(
|
|
642
|
-
},
|
|
811
|
+
return await Promise.all(o), r;
|
|
812
|
+
}, Qt = async (e, t, n = 10, r = 0, s) => {
|
|
643
813
|
if (!t) return [];
|
|
644
|
-
const i = [...await e.getHistoryDetail(t, r, n)].sort((l, u) => String(l.create_time || "").localeCompare(String(u.create_time || ""))), a = await
|
|
814
|
+
const i = [...await e.getHistoryDetail(t, r, n)].sort((l, u) => String(l.create_time || "").localeCompare(String(u.create_time || ""))), a = await le(i, ce, async (l) => {
|
|
645
815
|
try {
|
|
646
816
|
return await e.getHistoryAnswer(l.history_id || "");
|
|
647
817
|
} catch {
|
|
@@ -649,30 +819,31 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
649
819
|
}
|
|
650
820
|
}), c = [];
|
|
651
821
|
return i.forEach((l, u) => {
|
|
652
|
-
const
|
|
822
|
+
const m = l.history_id || oe("h"), d = a[u], f = d != null ? L(d) : [];
|
|
653
823
|
if (c.push({
|
|
654
|
-
id:
|
|
824
|
+
id: m,
|
|
655
825
|
historyId: l.history_id,
|
|
656
826
|
role: "user",
|
|
657
827
|
content: l.question ?? "",
|
|
658
828
|
attachments: f.length > 0 ? f : void 0
|
|
659
829
|
}), d != null) {
|
|
660
|
-
const
|
|
830
|
+
const p = k(d, m, l.question ?? "", s);
|
|
661
831
|
c.push({
|
|
662
|
-
id: `${
|
|
832
|
+
id: `${m}-answer`,
|
|
663
833
|
historyId: l.history_id,
|
|
664
834
|
role: "assistant",
|
|
665
|
-
answer:
|
|
835
|
+
answer: p,
|
|
666
836
|
error: !1,
|
|
667
837
|
stopped: !1,
|
|
668
|
-
|
|
838
|
+
runMs: T(p).runMs,
|
|
839
|
+
thinking: { steps: M(p), expanded: !1 }
|
|
669
840
|
});
|
|
670
841
|
}
|
|
671
842
|
}), c;
|
|
672
|
-
},
|
|
843
|
+
}, en = async (e, t, n = 10, r, s = 0, o) => {
|
|
673
844
|
if (!t)
|
|
674
845
|
return r == null || r({ type: "users", users: [] }), [];
|
|
675
|
-
const a = [...await e.getHistoryDetail(t,
|
|
846
|
+
const a = [...await e.getHistoryDetail(t, s, n)].sort((d, f) => String(d.create_time || "").localeCompare(String(f.create_time || ""))), c = a.map((d) => d.history_id || oe("h")), l = a.map((d, f) => ({
|
|
676
847
|
id: c[f],
|
|
677
848
|
historyId: d.history_id,
|
|
678
849
|
role: "user",
|
|
@@ -680,110 +851,164 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
680
851
|
}));
|
|
681
852
|
r == null || r({ type: "users", users: l });
|
|
682
853
|
const u = new Array(a.length).fill(null);
|
|
683
|
-
await
|
|
684
|
-
let
|
|
854
|
+
await le(a, ce, async (d, f) => {
|
|
855
|
+
let p = null;
|
|
685
856
|
try {
|
|
686
|
-
|
|
857
|
+
p = await e.getHistoryAnswer(d.history_id || "");
|
|
687
858
|
} catch {
|
|
688
|
-
|
|
859
|
+
p = null;
|
|
689
860
|
}
|
|
690
|
-
if (
|
|
691
|
-
const
|
|
692
|
-
|
|
693
|
-
const
|
|
861
|
+
if (p == null) return;
|
|
862
|
+
const D = L(p);
|
|
863
|
+
D.length > 0 && (l[f].attachments = D);
|
|
864
|
+
const $ = k(p, c[f], d.question ?? "", o), H = {
|
|
694
865
|
id: `${c[f]}-answer`,
|
|
695
866
|
historyId: d.history_id,
|
|
696
867
|
role: "assistant",
|
|
697
|
-
answer:
|
|
868
|
+
answer: $,
|
|
698
869
|
error: !1,
|
|
699
870
|
stopped: !1,
|
|
700
|
-
|
|
871
|
+
runMs: T($).runMs,
|
|
872
|
+
thinking: { steps: M($), expanded: !1 }
|
|
701
873
|
};
|
|
702
|
-
u[f] =
|
|
874
|
+
u[f] = H, r == null || r({
|
|
703
875
|
type: "assistant",
|
|
704
876
|
index: f,
|
|
705
877
|
user: l[f],
|
|
706
|
-
assistant:
|
|
878
|
+
assistant: H
|
|
707
879
|
});
|
|
708
880
|
});
|
|
709
|
-
const
|
|
881
|
+
const m = [];
|
|
710
882
|
return a.forEach((d, f) => {
|
|
711
|
-
|
|
712
|
-
const
|
|
713
|
-
|
|
714
|
-
}),
|
|
883
|
+
m.push(l[f]);
|
|
884
|
+
const p = u[f];
|
|
885
|
+
p && m.push(p);
|
|
886
|
+
}), m;
|
|
887
|
+
}, tn = async (e, t, n) => {
|
|
888
|
+
if (!t || !e.getShareChatJson) return [];
|
|
889
|
+
const r = await e.getShareChatJson(t);
|
|
890
|
+
if (!r) return [];
|
|
891
|
+
const s = String(r.id ?? r.history_id ?? t), o = typeof r.question == "string" ? r.question : "", i = k(r, s, o, n), a = [];
|
|
892
|
+
if (o) {
|
|
893
|
+
const c = L({ values: r });
|
|
894
|
+
a.push({
|
|
895
|
+
id: s,
|
|
896
|
+
historyId: s,
|
|
897
|
+
role: "user",
|
|
898
|
+
content: o,
|
|
899
|
+
attachments: c.length ? c : void 0
|
|
900
|
+
});
|
|
901
|
+
}
|
|
902
|
+
return a.push({
|
|
903
|
+
id: `${s}-answer`,
|
|
904
|
+
historyId: s,
|
|
905
|
+
role: "assistant",
|
|
906
|
+
answer: i,
|
|
907
|
+
error: !1,
|
|
908
|
+
stopped: !1,
|
|
909
|
+
runMs: T(i).runMs,
|
|
910
|
+
thinking: { steps: M(i), expanded: !1 }
|
|
911
|
+
}), a;
|
|
715
912
|
};
|
|
716
913
|
export {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
914
|
+
bt as CHAT_TITLE_MAX_LENGTH,
|
|
915
|
+
O as COLLECT_CLARIFICATIONS_ANSWER_TYPE,
|
|
916
|
+
Te as GENERIC_PARSERS,
|
|
917
|
+
N as HOST_ACTION_ANSWER_TYPE,
|
|
918
|
+
$t as IFRAME_RESIZER_CHILD_SCRIPT,
|
|
919
|
+
R as IMAGE_EXTENSIONS,
|
|
920
|
+
E as OUTPUT_FILE_ANSWER_TYPE,
|
|
921
|
+
S as PRESENT_FILES_ANSWER_TYPE,
|
|
922
|
+
x as RECORDSET_ANSWER_TYPE,
|
|
923
|
+
Ht as RoleEnum,
|
|
924
|
+
Dt as applyAnswerChunk,
|
|
925
|
+
rt as applyCollectClarificationsChunk,
|
|
926
|
+
me as applyDeepThinkingChunk,
|
|
927
|
+
lt as applyHostActionChunk,
|
|
928
|
+
je as applyIframePageChunk,
|
|
929
|
+
Y as applyKnowledgeStreamChunk,
|
|
930
|
+
Le as applyOutputFileChunk,
|
|
931
|
+
Ue as applyPresentFilesChunk,
|
|
932
|
+
Oe as applyRecordsetChunk,
|
|
933
|
+
qe as basenameOf,
|
|
934
|
+
qt as buildChatTitle,
|
|
935
|
+
Ee as cameraParser,
|
|
936
|
+
It as cancelClarification,
|
|
937
|
+
Mt as clearPendingClarifications,
|
|
938
|
+
kt as collectAnswerMarkdown,
|
|
939
|
+
ot as collectClarificationsParser,
|
|
940
|
+
ye as collectDeepThinkingSteps,
|
|
941
|
+
M as collectThinkingSteps,
|
|
942
|
+
pt as conclusionParser,
|
|
943
|
+
Bt as consumeStream,
|
|
944
|
+
ue as createEmptyAnswerValues,
|
|
945
|
+
b as createFailureResult,
|
|
946
|
+
Jt as createHistoryGroup,
|
|
947
|
+
wt as createLineSplitter,
|
|
948
|
+
g as createPassThroughParser,
|
|
949
|
+
we as deepThinkingParser,
|
|
950
|
+
Zt as deleteHistoryGroup,
|
|
951
|
+
ze as deviceLastValueParser,
|
|
952
|
+
Ot as expirePendingClarificationsForReply,
|
|
953
|
+
L as extractAttachmentsFromHistory,
|
|
954
|
+
Tt as extractHistoryAttachments,
|
|
955
|
+
Gt as formatDuration,
|
|
956
|
+
ie as formatFileSize,
|
|
957
|
+
v as getEffectiveAnswerType,
|
|
958
|
+
Vt as getHistoryGroups,
|
|
959
|
+
Pt as hasPendingClarification,
|
|
960
|
+
dt as hostActionParser,
|
|
961
|
+
xe as iframePageParser,
|
|
962
|
+
F as injectIframeResizerScript,
|
|
963
|
+
Ut as isImageAttachment,
|
|
964
|
+
Yt as isValidDuration,
|
|
965
|
+
pe as knowledgeStreamParser,
|
|
966
|
+
Qt as loadGroupMessages,
|
|
967
|
+
en as loadGroupMessagesByStep,
|
|
968
|
+
tn as loadSharedMessages,
|
|
969
|
+
Lt as markdownToPlainText,
|
|
970
|
+
Nt as mergeAnswerMeta,
|
|
971
|
+
tt as nextClarificationRequestId,
|
|
972
|
+
oe as nextLocalMessageId,
|
|
973
|
+
Ge as normalizeActionResult,
|
|
974
|
+
k as normalizeAnswer,
|
|
975
|
+
yt as normalizeAnswerReport,
|
|
976
|
+
Xt as normalizeAttachment,
|
|
977
|
+
st as normalizeCollectClarificationsReport,
|
|
978
|
+
ut as normalizeHostActionReport,
|
|
979
|
+
Pe as normalizeIframePageReport,
|
|
980
|
+
fe as normalizeKnowledgeStreamReport,
|
|
981
|
+
De as normalizeOutputFileReport,
|
|
982
|
+
We as normalizePresentFilesReport,
|
|
983
|
+
Ne as normalizeRecordsetReport,
|
|
984
|
+
He as outputFileParser,
|
|
985
|
+
Ye as parseActionExecuteCommand,
|
|
986
|
+
et as parseClarificationArguments,
|
|
987
|
+
ae as parseHistoryAttachment,
|
|
988
|
+
K as parseRealtimeAttachment,
|
|
989
|
+
Kt as parseServerStartTime,
|
|
990
|
+
gt as parseSseLine,
|
|
991
|
+
Xe as presentFilesParser,
|
|
992
|
+
T as readAnswerMeta,
|
|
993
|
+
V as readDefaultPayload,
|
|
994
|
+
ne as readFrontReplyAction,
|
|
995
|
+
ee as readOutputFilePayload,
|
|
996
|
+
te as readPresentFilesPayload,
|
|
997
|
+
Me as readRecordsetPayload,
|
|
998
|
+
ke as recordsetParser,
|
|
999
|
+
nt as registerClarification,
|
|
1000
|
+
Ct as resolveAttachDownloadUrl,
|
|
1001
|
+
Wt as resolveAttachPreviewUrl,
|
|
1002
|
+
At as resolveRemoteFileUrl,
|
|
1003
|
+
Ce as scriptParser,
|
|
1004
|
+
Ft as setHistoryGroupTitle,
|
|
1005
|
+
ve as sqlQueryParser,
|
|
1006
|
+
ge as stripSetextUnderline,
|
|
1007
|
+
xt as submitClarification,
|
|
1008
|
+
_e as textParser,
|
|
1009
|
+
Be as toOutputFileValue,
|
|
1010
|
+
Se as videoParser,
|
|
1011
|
+
Ae as wavParser,
|
|
1012
|
+
jt as wrapActionFrame
|
|
788
1013
|
};
|
|
789
1014
|
//# sourceMappingURL=index.js.map
|