wi-chat 0.6.1 → 0.7.0
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 +737 -322
- package/dist/core/useAnswerActions.d.ts +61 -0
- package/dist/core/useChat.d.ts +90 -15
- package/dist/core/useChatAuth.d.ts +96 -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 +4 -2
- package/dist/index.js +119 -108
- package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +8 -8
- package/dist/mobile-ui/chat/ChatMessagesView.vue.d.ts +6 -6
- package/dist/mobile-ui/index.cjs +1 -1
- package/dist/mobile-ui/index.js +104 -104
- package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +6 -6
- package/dist/page-context/index.js +2 -4
- package/dist/parser/answerCom/actionExecute/actionProtocol.d.ts +1 -7
- package/dist/parser/answerCom/actionExecute/clarification.d.ts +15 -3
- package/dist/parser/answerCom/actionExecute/constants.d.ts +10 -0
- package/dist/parser/answerCom/actionExecute/parseCollectClarifications.d.ts +3 -2
- package/dist/parser/answerCom/actionExecute/parseHostAction.d.ts +3 -2
- package/dist/parser/answerCom/actionExecute/types.d.ts +3 -3
- 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 +13 -4
- package/dist/parser/index.js +640 -457
- package/dist/parser/message.d.ts +9 -0
- package/dist/parser/registry.d.ts +1 -1
- 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/aiAnswer/AiAnswerBubble.vue.d.ts +4 -4
- 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/clarification/ClarificationCard.vue.d.ts +3 -3
- package/dist/renderers/deepThinking/DeepThinkingSteps.vue.d.ts +4 -4
- package/dist/renderers/deviceLastValue/DeviceLastValue.vue.d.ts +37 -0
- package/dist/renderers/hostAction/HostActionStatus.vue.d.ts +3 -3
- package/dist/renderers/iframePage/IframePage.vue.d.ts +3 -3
- package/dist/renderers/index.cjs +6 -1
- package/dist/renderers/index.d.ts +14 -0
- package/dist/renderers/index.js +1504 -607
- package/dist/renderers/knowledgeStream/KnowledgeStreamResult.vue.d.ts +3 -3
- package/dist/renderers/media/MediaAnswer.vue.d.ts +19 -0
- package/dist/renderers/outputFile/OutputFile.vue.d.ts +3 -3
- 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 +6 -0
- package/dist/request/index.cjs +4 -2
- package/dist/request/index.d.ts +4 -2
- package/dist/request/index.js +754 -181
- 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/RightPanel.vue.d.ts +6 -6
- package/dist/right-panel/RightPanelIcon.vue.d.ts +4 -4
- package/dist/right-panel/RightPanelTabs.vue.d.ts +9 -5
- package/dist/right-panel/index.cjs +1 -1
- package/dist/right-panel/index.d.ts +1 -1
- package/dist/right-panel/index.js +617 -537
- package/dist/right-panel/panels/newtab/NewTabPanel.vue.d.ts +4 -4
- package/dist/right-panel/panels/web/WebPanel.vue.d.ts +3 -3
- package/dist/right-panel/shared/BrowserToolbar.vue.d.ts +3 -3
- package/dist/right-panel/shared/RightPanelToolList.vue.d.ts +5 -5
- package/dist/right-panel/style.css +1 -1
- package/dist/right-panel/types.d.ts +10 -0
- package/dist/theme/index.js +2 -4
- package/dist/tools/index.cjs +5 -5
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +323 -217
- package/dist/tools/markdown/MarkdownContent.vue.d.ts +5 -5
- 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/tools/useAutoScroll.d.ts +3 -3
- package/dist/web-ui/attach/AttachmentCard.vue.d.ts +6 -6
- package/dist/web-ui/attach/AttachmentList.vue.d.ts +6 -6
- package/dist/web-ui/chat/ChatContainer.vue.d.ts +10 -10
- package/dist/web-ui/chat/ChatMessagesView.vue.d.ts +6 -6
- package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +6 -6
- package/dist/web-ui/index.cjs +1 -1
- package/dist/web-ui/index.js +630 -635
- package/dist/web-ui/inputbox/Inputbox.vue.d.ts +11 -11
- package/dist/web-ui/recordset/RecordsetTable.vue.d.ts +4 -4
- package/dist/web-ui/style.css +1 -1
- package/package.json +2 -1
package/dist/parser/index.js
CHANGED
|
@@ -1,193 +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
|
-
],
|
|
14
|
-
var
|
|
15
|
-
if (!e.mode || !
|
|
16
|
-
return !1;
|
|
13
|
+
], Y = (e, t, n, r) => {
|
|
14
|
+
var l;
|
|
15
|
+
if (!e.mode || !de.includes(e.mode)) return !1;
|
|
17
16
|
if (e.mode === "knowledge_stream_result" || e.mode === "knowledge_stream_end")
|
|
18
17
|
return !0;
|
|
19
|
-
const
|
|
18
|
+
const s = r == null ? void 0 : r.beforeKnowledgeRender, o = (u) => s ? s(u) : u;
|
|
20
19
|
if (e.mode === "knowledge_stream_begin") {
|
|
21
|
-
const
|
|
22
|
-
return (
|
|
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 ? (B(u), !0) : (t.push(q()), !0);
|
|
23
22
|
}
|
|
24
|
-
if (e.mode !== "knowledge_stream")
|
|
25
|
-
return !1;
|
|
23
|
+
if (e.mode !== "knowledge_stream") return !1;
|
|
26
24
|
let i = t.at(-1);
|
|
27
|
-
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: "" }];
|
|
28
26
|
const a = i.values[i.values.length - 1], c = `${a.raw ?? ""}${e.value || ""}`;
|
|
29
|
-
return a.raw = c, a.answer =
|
|
30
|
-
},
|
|
31
|
-
if (Array.isArray(e.values) && e.values.length)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, se = {
|
|
27
|
+
return a.raw = c, a.answer = o(c), !0;
|
|
28
|
+
}, fe = (e, t) => {
|
|
29
|
+
if (Array.isArray(e.values) && e.values.length) return e;
|
|
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 = {
|
|
37
34
|
id: "knowledge_stream",
|
|
38
35
|
answerType: "knowledge_stream_result",
|
|
39
|
-
applyChunk:
|
|
40
|
-
normalizeReport:
|
|
41
|
-
},
|
|
42
|
-
if (!
|
|
43
|
-
return !1;
|
|
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;
|
|
44
40
|
let n = t.at(-1);
|
|
45
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;
|
|
46
|
-
},
|
|
42
|
+
}, ye = (e) => {
|
|
47
43
|
const t = [];
|
|
48
44
|
let n = "", r = !1;
|
|
49
|
-
for (const
|
|
50
|
-
(
|
|
45
|
+
for (const s of (e.exec_process ?? []).filter(
|
|
46
|
+
(o) => G.includes(o.mode || "")
|
|
51
47
|
)) {
|
|
52
|
-
const
|
|
53
|
-
|
|
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 = "");
|
|
54
50
|
}
|
|
55
51
|
return r && n.trim() && t.push(n.trim()), t;
|
|
56
|
-
},
|
|
52
|
+
}, M = (e) => {
|
|
57
53
|
var t;
|
|
58
|
-
return (((t = e.answer) == null ? void 0 : t.reports) ?? []).flatMap(
|
|
59
|
-
},
|
|
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 = {
|
|
60
56
|
id: "deep_thinking",
|
|
61
|
-
applyChunk:
|
|
62
|
-
}, D = '/**\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 = D, S = `<script>${D}<\/script>`, ue = (e) => !e || typeof e != "object" ? "" : String(e.type || e.answer_type || ""), B = (e) => {
|
|
63
|
-
if (!e || typeof e != "object")
|
|
64
|
-
|
|
65
|
-
const t =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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) => {
|
|
138
|
+
if (!e || typeof e != "object") return {};
|
|
139
|
+
const t = e.values, n = (o) => {
|
|
140
|
+
const i = t && typeof t == "object" ? t[o] : void 0;
|
|
141
|
+
if (typeof i == "string" && i) return i;
|
|
142
|
+
const a = e[o];
|
|
70
143
|
return typeof a == "string" && a ? a : void 0;
|
|
71
|
-
}, r = n("url"),
|
|
144
|
+
}, r = n("url"), s = n("srcdoc");
|
|
72
145
|
return {
|
|
73
146
|
...r ? { url: r } : {},
|
|
74
|
-
...
|
|
147
|
+
...s ? { srcdoc: s } : {}
|
|
75
148
|
};
|
|
76
|
-
},
|
|
77
|
-
if (e.mode !== "result" ||
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return !t.url && !t.srcdoc || (t.srcdoc && (t.srcdoc = U(t.srcdoc)), e.values = t), e;
|
|
86
|
-
}, pe = {
|
|
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 = {
|
|
87
158
|
id: "iframe_page",
|
|
88
159
|
answerType: "url",
|
|
89
|
-
applyChunk:
|
|
90
|
-
normalizeReport:
|
|
91
|
-
},
|
|
92
|
-
if (!e || typeof e != "object" || Array.isArray(e))
|
|
93
|
-
return;
|
|
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) => {
|
|
163
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return;
|
|
94
164
|
const t = e.values;
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return n && t.push({ answer_type: C, values: n }), !0;
|
|
104
|
-
}, be = (e) => {
|
|
105
|
-
if (v(e.values))
|
|
106
|
-
return e;
|
|
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;
|
|
107
173
|
const t = e;
|
|
108
|
-
if (!
|
|
109
|
-
return e;
|
|
174
|
+
if (!z(t)) return e;
|
|
110
175
|
const n = {};
|
|
111
|
-
for (const r of
|
|
176
|
+
for (const r of Ie)
|
|
112
177
|
n[r] = t[r];
|
|
113
178
|
return e.values = n, e;
|
|
114
|
-
},
|
|
179
|
+
}, ke = {
|
|
115
180
|
id: "recordset",
|
|
116
|
-
answerType:
|
|
117
|
-
applyChunk:
|
|
118
|
-
normalizeReport:
|
|
119
|
-
},
|
|
120
|
-
if (!e || typeof e != "object")
|
|
121
|
-
return;
|
|
181
|
+
answerType: x,
|
|
182
|
+
applyChunk: Oe,
|
|
183
|
+
normalizeReport: Ne
|
|
184
|
+
}, E = "output_file", U = (e, t) => {
|
|
185
|
+
if (!e || typeof e != "object") return;
|
|
122
186
|
const n = e[t];
|
|
123
187
|
return typeof n == "string" && n ? n : void 0;
|
|
124
|
-
},
|
|
125
|
-
if (!e || typeof e != "object")
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
},
|
|
133
|
-
if (e.mode !== "result" ||
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
188
|
+
}, Q = ["file_id", "file_name", "file_path"], ee = (e) => {
|
|
189
|
+
if (!e || typeof e != "object") return {};
|
|
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) => ({
|
|
149
244
|
success: !1,
|
|
150
245
|
message: e,
|
|
151
246
|
data: null
|
|
152
|
-
}),
|
|
153
|
-
if (typeof e != "string")
|
|
154
|
-
return e;
|
|
247
|
+
}), Ke = (e) => {
|
|
248
|
+
if (typeof e != "string") return e;
|
|
155
249
|
try {
|
|
156
250
|
return JSON.parse(e);
|
|
157
251
|
} catch {
|
|
158
252
|
throw new Error("执行指令不是合法的 JSON");
|
|
159
253
|
}
|
|
160
|
-
},
|
|
161
|
-
const t =
|
|
162
|
-
if (!t || typeof t != "object")
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (n !== "action_execute")
|
|
166
|
-
throw new Error(`不支持的指令类型:${String(n ?? "")}`);
|
|
254
|
+
}, Ye = (e) => {
|
|
255
|
+
const t = Ke(e);
|
|
256
|
+
if (!t || typeof t != "object") throw new Error("执行指令格式无效");
|
|
257
|
+
const { type: n, executor: r, action: s } = t;
|
|
258
|
+
if (n !== "action_execute") throw new Error(`不支持的指令类型:${String(n ?? "")}`);
|
|
167
259
|
if (r !== "host" && r !== "agent")
|
|
168
260
|
throw new Error(`不支持的执行端:${String(r ?? "")}`);
|
|
169
|
-
if (!
|
|
261
|
+
if (!s || typeof s != "object" || typeof s.name != "string" || !s.name.trim())
|
|
170
262
|
throw new Error("执行指令缺少合法的 action.name");
|
|
171
|
-
if (!
|
|
263
|
+
if (!s.arguments || typeof s.arguments != "object" || Array.isArray(s.arguments))
|
|
172
264
|
throw new Error("执行指令的 action.arguments 必须是对象");
|
|
173
265
|
return {
|
|
174
266
|
type: n,
|
|
175
267
|
executor: r,
|
|
176
268
|
action: {
|
|
177
|
-
name:
|
|
178
|
-
arguments:
|
|
269
|
+
name: s.name,
|
|
270
|
+
arguments: s.arguments
|
|
179
271
|
}
|
|
180
272
|
};
|
|
181
|
-
},
|
|
273
|
+
}, Ge = (e, t = "执行端未返回有效的执行结果") => {
|
|
182
274
|
if (!e || typeof e != "object")
|
|
183
|
-
return
|
|
275
|
+
return b(t);
|
|
184
276
|
const n = e;
|
|
185
|
-
return typeof n.success != "boolean" ?
|
|
277
|
+
return typeof n.success != "boolean" ? b("执行端返回的 success 必须是布尔值") : {
|
|
186
278
|
success: n.success,
|
|
187
279
|
message: typeof n.message == "string" ? n.message : n.success ? "操作成功" : "操作失败",
|
|
188
280
|
data: Object.prototype.hasOwnProperty.call(n, "data") ? n.data ?? null : null
|
|
189
281
|
};
|
|
190
|
-
},
|
|
282
|
+
}, jt = (e) => {
|
|
191
283
|
if (e && typeof e == "object") {
|
|
192
284
|
const t = e;
|
|
193
285
|
if (typeof t.success == "boolean")
|
|
@@ -201,14 +293,10 @@ const x = () => ({
|
|
|
201
293
|
data: e
|
|
202
294
|
};
|
|
203
295
|
}
|
|
204
|
-
return
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}), Re = (e) => typeof e.reply_id == "string" || typeof e.reply_id == "number" ? e.reply_id : void 0, q = (e) => {
|
|
209
|
-
if ((e == null ? void 0 : e.mode) !== "front_reply")
|
|
210
|
-
return { kind: "ignored" };
|
|
211
|
-
const t = Re(e), n = e.values ?? e.value;
|
|
296
|
+
return b("系统操作返回了无法识别的报文帧");
|
|
297
|
+
}, Ve = (e) => typeof e.reply_id == "string" || typeof e.reply_id == "number" ? e.reply_id : void 0, ne = (e) => {
|
|
298
|
+
if ((e == null ? void 0 : e.mode) !== "front_reply") return { kind: "ignored" };
|
|
299
|
+
const t = Ve(e), n = e.values ?? e.value;
|
|
212
300
|
let r = n;
|
|
213
301
|
if (typeof n == "string")
|
|
214
302
|
try {
|
|
@@ -219,21 +307,21 @@ const x = () => ({
|
|
|
219
307
|
if (!r || typeof r != "object" || Array.isArray(r) || r.type !== "action_execute")
|
|
220
308
|
return { kind: "ignored" };
|
|
221
309
|
try {
|
|
222
|
-
return { kind: "ok", replyId: t, command:
|
|
223
|
-
} catch (
|
|
310
|
+
return { kind: "ok", replyId: t, command: Ye(r) };
|
|
311
|
+
} catch (s) {
|
|
224
312
|
return {
|
|
225
313
|
kind: "invalid",
|
|
226
314
|
replyId: t,
|
|
227
|
-
error:
|
|
315
|
+
error: s instanceof Error ? s : new Error("执行指令解析失败")
|
|
228
316
|
};
|
|
229
317
|
}
|
|
230
|
-
},
|
|
231
|
-
let
|
|
232
|
-
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) => {
|
|
233
321
|
if (!Array.isArray(e) || e.length === 0)
|
|
234
322
|
throw new Error(`确认项 ${t} 缺少可选项`);
|
|
235
323
|
return e.map((n, r) => {
|
|
236
|
-
if (!
|
|
324
|
+
if (!_(n) || typeof n.label != "string" || !n.label.trim())
|
|
237
325
|
throw new Error(`确认项 ${t} 的第 ${r + 1} 个选项格式无效`);
|
|
238
326
|
if (!Object.prototype.hasOwnProperty.call(n, "value"))
|
|
239
327
|
throw new Error(`确认项 ${t} 的第 ${r + 1} 个选项缺少 value`);
|
|
@@ -242,76 +330,70 @@ const w = (e) => !!e && typeof e == "object" && !Array.isArray(e), g = (e) => ty
|
|
|
242
330
|
value: n.value
|
|
243
331
|
};
|
|
244
332
|
});
|
|
245
|
-
},
|
|
246
|
-
if (e === void 0)
|
|
247
|
-
|
|
248
|
-
if (!w(e))
|
|
249
|
-
throw new Error("确认项的 binding 必须是对象");
|
|
333
|
+
}, Fe = (e) => {
|
|
334
|
+
if (e === void 0) return;
|
|
335
|
+
if (!_(e)) throw new Error("确认项的 binding 必须是对象");
|
|
250
336
|
const t = {};
|
|
251
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;
|
|
252
|
-
},
|
|
253
|
-
if (!
|
|
338
|
+
}, Qe = (e, t) => {
|
|
339
|
+
if (!_(e) || !Je.includes(e.type))
|
|
254
340
|
throw new Error(`确认项 ${t} 的 input.type 无效`);
|
|
255
341
|
const n = e.type, r = {
|
|
256
342
|
type: n,
|
|
257
|
-
placeholder:
|
|
343
|
+
placeholder: w(e.placeholder)
|
|
258
344
|
};
|
|
259
|
-
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") {
|
|
260
346
|
if (e.format !== void 0 && e.format !== "YYYY-MM-DD")
|
|
261
347
|
throw new Error(`确认项 ${t} 暂不支持日期格式 ${String(e.format)}`);
|
|
262
348
|
r.format = "YYYY-MM-DD";
|
|
263
349
|
}
|
|
264
350
|
if (e.textInput !== void 0) {
|
|
265
|
-
if (!
|
|
266
|
-
throw new Error(`确认项 ${t} 的 textInput 必须是对象`);
|
|
351
|
+
if (!_(e.textInput)) throw new Error(`确认项 ${t} 的 textInput 必须是对象`);
|
|
267
352
|
r.textInput = {
|
|
268
|
-
placeholder:
|
|
353
|
+
placeholder: w(e.textInput.placeholder)
|
|
269
354
|
};
|
|
270
355
|
}
|
|
271
356
|
return r;
|
|
272
|
-
},
|
|
357
|
+
}, et = (e) => {
|
|
273
358
|
if (!Array.isArray(e.items) || e.items.length === 0)
|
|
274
359
|
throw new Error("collect_clarifications 至少需要一个确认项");
|
|
275
|
-
const t = /* @__PURE__ */ new Set(), n = e.items.map((r,
|
|
276
|
-
if (!
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
if (
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
if (!i)
|
|
284
|
-
throw new Error(`确认项 ${s} 缺少 question`);
|
|
285
|
-
return t.add(s), {
|
|
286
|
-
id: s,
|
|
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,
|
|
287
368
|
question: i,
|
|
288
|
-
description:
|
|
369
|
+
description: w(r.description),
|
|
289
370
|
required: r.required !== !1,
|
|
290
371
|
default: r.default,
|
|
291
|
-
binding:
|
|
292
|
-
input:
|
|
372
|
+
binding: Fe(r.binding),
|
|
373
|
+
input: Qe(r.input, o)
|
|
293
374
|
};
|
|
294
375
|
});
|
|
295
376
|
return {
|
|
296
|
-
title:
|
|
297
|
-
description:
|
|
377
|
+
title: w(e.title) ?? "需要你确认几项信息",
|
|
378
|
+
description: w(e.description) ?? "请补充以下信息,我会据此继续完成操作。",
|
|
298
379
|
items: n
|
|
299
380
|
};
|
|
300
|
-
},
|
|
381
|
+
}, tt = (e) => e !== void 0 ? String(e) : (W += 1, `clarification-${Date.now()}-${W}`), nt = (e) => {
|
|
301
382
|
y.set(e.reportId, e);
|
|
302
|
-
},
|
|
303
|
-
const n = e.reports.findIndex(
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
383
|
+
}, Pt = (e) => y.has(e), C = (e, t) => {
|
|
384
|
+
const n = e.reports.findIndex(
|
|
385
|
+
(r) => {
|
|
386
|
+
var s;
|
|
387
|
+
return r.answer_type === O && ((s = r.values) == null ? void 0 : s.requestId) === e.reportId;
|
|
388
|
+
}
|
|
389
|
+
);
|
|
307
390
|
n < 0 || e.reports.splice(n, 1, {
|
|
308
391
|
...e.reports[n],
|
|
309
392
|
values: { ...e.reports[n].values, ...t }
|
|
310
393
|
});
|
|
311
|
-
},
|
|
394
|
+
}, re = (e, t) => {
|
|
312
395
|
var n;
|
|
313
|
-
if (!e.reply)
|
|
314
|
-
return !1;
|
|
396
|
+
if (!e.reply) return !1;
|
|
315
397
|
try {
|
|
316
398
|
return e.reply({
|
|
317
399
|
type: "wait_reply",
|
|
@@ -321,194 +403,229 @@ const w = (e) => !!e && typeof e == "object" && !Array.isArray(e), g = (e) => ty
|
|
|
321
403
|
} catch (r) {
|
|
322
404
|
return (n = e.onError) == null || n.call(e, r), !1;
|
|
323
405
|
}
|
|
324
|
-
},
|
|
406
|
+
}, xt = (e, t) => {
|
|
325
407
|
const n = y.get(e);
|
|
326
|
-
if (!n)
|
|
327
|
-
return !1;
|
|
408
|
+
if (!n) return !1;
|
|
328
409
|
y.delete(e);
|
|
329
|
-
const r =
|
|
410
|
+
const r = re(n, {
|
|
330
411
|
success: !0,
|
|
331
412
|
message: "用户已提交补充信息",
|
|
332
413
|
data: { answers: t }
|
|
333
414
|
});
|
|
334
|
-
return
|
|
415
|
+
return C(n, {
|
|
335
416
|
status: "submitted",
|
|
336
417
|
resultMessage: r ? "补充信息已提交" : "补充信息已提交,但结果回传失败(连接已关闭)",
|
|
337
418
|
answers: t
|
|
338
419
|
}), !0;
|
|
339
|
-
},
|
|
420
|
+
}, It = (e) => {
|
|
340
421
|
const t = y.get(e);
|
|
341
|
-
if (!t)
|
|
342
|
-
return !1;
|
|
422
|
+
if (!t) return !1;
|
|
343
423
|
y.delete(e);
|
|
344
|
-
const n =
|
|
424
|
+
const n = re(t, {
|
|
345
425
|
success: !1,
|
|
346
426
|
message: "用户取消了补充信息",
|
|
347
427
|
data: null
|
|
348
428
|
});
|
|
349
|
-
return
|
|
429
|
+
return C(t, {
|
|
350
430
|
status: "cancelled",
|
|
351
431
|
resultMessage: n ? "已取消补充信息" : "已取消补充信息,但结果回传失败(连接已关闭)"
|
|
352
432
|
}), !0;
|
|
353
|
-
},
|
|
354
|
-
y.forEach((
|
|
355
|
-
|
|
433
|
+
}, Mt = (e) => {
|
|
434
|
+
y.forEach((t, n) => {
|
|
435
|
+
e && t.reply !== e || (C(t, {
|
|
356
436
|
status: "expired",
|
|
357
437
|
resultMessage: "本次补充信息已失效(回答已结束)"
|
|
358
|
-
});
|
|
359
|
-
})
|
|
360
|
-
},
|
|
438
|
+
}), y.delete(n));
|
|
439
|
+
});
|
|
440
|
+
}, Ot = (e) => {
|
|
441
|
+
y.forEach((t, n) => {
|
|
442
|
+
t.reply === e && (C(t, {
|
|
443
|
+
status: "expired",
|
|
444
|
+
resultMessage: "本次补充信息已失效(连接已关闭)"
|
|
445
|
+
}), y.delete(n));
|
|
446
|
+
});
|
|
447
|
+
}, se = (e, t, n) => {
|
|
361
448
|
var r;
|
|
362
|
-
if (!(e != null && e.reply))
|
|
363
|
-
return !1;
|
|
449
|
+
if (!(e != null && e.reply)) return !1;
|
|
364
450
|
try {
|
|
365
|
-
const
|
|
366
|
-
return e.reply(
|
|
367
|
-
} catch (
|
|
368
|
-
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;
|
|
369
455
|
}
|
|
370
|
-
},
|
|
371
|
-
|
|
372
|
-
},
|
|
456
|
+
}, I = (e, t, n) => {
|
|
457
|
+
se(e, t, b(n));
|
|
458
|
+
}, rt = (e, t, n, r) => {
|
|
373
459
|
var m;
|
|
374
|
-
const
|
|
375
|
-
if (
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
if (s.executor !== "agent" || s.action.name !== "collect_clarifications")
|
|
379
|
-
return !1;
|
|
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;
|
|
380
464
|
const a = r == null ? void 0 : r.actionExecute;
|
|
381
465
|
let c;
|
|
382
466
|
try {
|
|
383
|
-
c =
|
|
467
|
+
c = et(o.action.arguments);
|
|
384
468
|
} catch (d) {
|
|
385
|
-
return (m = a == null ? void 0 : a.onError) == null || m.call(a, d),
|
|
469
|
+
return (m = a == null ? void 0 : a.onError) == null || m.call(a, d), I(a, i, d instanceof Error ? d.message : "确认项参数无效"), !0;
|
|
386
470
|
}
|
|
387
|
-
const
|
|
388
|
-
requestId:
|
|
471
|
+
const l = tt(i), u = {
|
|
472
|
+
requestId: l,
|
|
389
473
|
...c,
|
|
390
474
|
status: "pending",
|
|
391
475
|
resultMessage: ""
|
|
392
476
|
};
|
|
393
|
-
return
|
|
394
|
-
reportId:
|
|
477
|
+
return nt({
|
|
478
|
+
reportId: l,
|
|
395
479
|
replyId: i,
|
|
396
480
|
reports: t,
|
|
397
481
|
reply: a == null ? void 0 : a.reply,
|
|
398
482
|
onError: a == null ? void 0 : a.onError
|
|
399
|
-
}), t.push({ answer_type:
|
|
400
|
-
},
|
|
483
|
+
}), t.push({ answer_type: O, values: u }), !0;
|
|
484
|
+
}, st = (e) => {
|
|
401
485
|
const t = e.values;
|
|
402
486
|
!t || typeof t != "object" || t.status === "pending" && (t.status = "expired", t.resultMessage = "本次补充信息已失效(回答已结束)");
|
|
403
|
-
},
|
|
487
|
+
}, ot = {
|
|
404
488
|
id: "collect_clarifications",
|
|
405
|
-
answerType:
|
|
406
|
-
applyChunk:
|
|
407
|
-
normalizeReport:
|
|
408
|
-
}
|
|
409
|
-
let
|
|
410
|
-
const
|
|
411
|
-
const r = e.findIndex((
|
|
412
|
-
var
|
|
413
|
-
return
|
|
489
|
+
answerType: O,
|
|
490
|
+
applyChunk: rt,
|
|
491
|
+
normalizeReport: st
|
|
492
|
+
};
|
|
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;
|
|
414
498
|
});
|
|
415
499
|
r < 0 || e.splice(r, 1, {
|
|
416
500
|
...e[r],
|
|
417
501
|
values: { ...e[r].values, ...n }
|
|
418
502
|
});
|
|
419
|
-
},
|
|
420
|
-
var
|
|
421
|
-
let
|
|
503
|
+
}, ct = async (e, t, n, r, s, o) => {
|
|
504
|
+
var a, c;
|
|
505
|
+
let i;
|
|
506
|
+
try {
|
|
507
|
+
i = Ge(await o(e), `宿主未返回 ${e.name} 的执行结果`);
|
|
508
|
+
} catch (l) {
|
|
509
|
+
(a = s.onError) == null || a.call(s, l), i = b(l instanceof Error ? l.message : `${e.name} 执行失败`);
|
|
510
|
+
}
|
|
511
|
+
at(r, t, {
|
|
512
|
+
status: i.success ? "success" : "error",
|
|
513
|
+
message: i.message,
|
|
514
|
+
data: i.data ?? void 0
|
|
515
|
+
}), se(s, n, i) || (c = s.onError) == null || c.call(s, new Error(`${e.name} 已执行,但 wait_reply 回传失败(连接已关闭)`));
|
|
516
|
+
}, lt = (e, t, n, r) => {
|
|
517
|
+
var u;
|
|
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;
|
|
524
|
+
if (i.executor !== "host") return !1;
|
|
422
525
|
if (!(o != null && o.execute))
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
try {
|
|
426
|
-
s = Te(await o.execute(e), `宿主未返回 ${e.name} 的执行结果`);
|
|
427
|
-
} catch (c) {
|
|
428
|
-
(i = o.onError) == null || i.call(o, c), s = h(c instanceof Error ? c.message : `${e.name} 执行失败`);
|
|
429
|
-
}
|
|
430
|
-
De(r, t, {
|
|
431
|
-
status: s.success ? "success" : "error",
|
|
432
|
-
message: s.message,
|
|
433
|
-
data: s.data ?? void 0
|
|
434
|
-
}), K(o, n, s) || (a = o == null ? void 0 : o.onError) == null || a.call(o, new Error(`${e.name} 已执行,但 wait_reply 回传失败(连接已关闭)`));
|
|
435
|
-
}, Ue = (e, t, n, r) => {
|
|
436
|
-
var l;
|
|
437
|
-
const o = q(e);
|
|
438
|
-
if (o.kind === "ignored")
|
|
439
|
-
return !1;
|
|
440
|
-
const s = r == null ? void 0 : r.actionExecute;
|
|
441
|
-
if (o.kind === "invalid")
|
|
442
|
-
return (l = s == null ? void 0 : s.onError) == null || l.call(s, o.error), V(s, o.replyId, o.error.message), !0;
|
|
443
|
-
const { command: i, replyId: a } = o;
|
|
444
|
-
if (i.executor !== "host")
|
|
445
|
-
return !1;
|
|
446
|
-
const c = He(a), u = {
|
|
526
|
+
return o != null && o.reply ? (I(o, a, "当前页面不支持该操作"), !0) : !1;
|
|
527
|
+
const c = it(a), l = {
|
|
447
528
|
id: c,
|
|
448
529
|
name: i.action.name,
|
|
449
530
|
arguments: i.action.arguments,
|
|
450
531
|
status: "running",
|
|
451
532
|
message: "执行中…"
|
|
452
533
|
};
|
|
453
|
-
return t.push({ answer_type:
|
|
454
|
-
},
|
|
534
|
+
return t.push({ answer_type: N, values: l }), ct(i.action, c, a, t, o, o.execute), !0;
|
|
535
|
+
}, ut = (e) => {
|
|
455
536
|
const t = e.values;
|
|
456
537
|
!t || typeof t != "object" || t.status === "running" && (t.status = "unknown", t.message = "执行状态未知(回答已结束)");
|
|
457
|
-
},
|
|
538
|
+
}, dt = {
|
|
458
539
|
id: "host_action",
|
|
459
|
-
answerType:
|
|
460
|
-
applyChunk:
|
|
461
|
-
normalizeReport:
|
|
462
|
-
},
|
|
463
|
-
|
|
464
|
-
|
|
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,
|
|
465
579
|
pe,
|
|
466
|
-
|
|
467
|
-
|
|
580
|
+
xe,
|
|
581
|
+
ke,
|
|
582
|
+
He,
|
|
583
|
+
Xe,
|
|
468
584
|
// action_execute 按执行端拆成两个 parser,各自只认自己那一种组合(其余 return false)
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
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) => {
|
|
472
592
|
const t = (e == null ? void 0 : e.parsers) ?? [];
|
|
473
|
-
return t.length ? [...
|
|
474
|
-
},
|
|
593
|
+
return t.length ? [...A, ...t] : A;
|
|
594
|
+
}, Dt = (e, t, n) => {
|
|
475
595
|
var i;
|
|
476
596
|
const r = (i = e.answer) == null ? void 0 : i.reports;
|
|
477
|
-
if (!r)
|
|
478
|
-
|
|
479
|
-
const o = new Set(
|
|
597
|
+
if (!r) return [];
|
|
598
|
+
const s = new Set(
|
|
480
599
|
((n == null ? void 0 : n.parsers) ?? []).filter((a) => a.applyChunk && a.answerType).map((a) => a.answerType)
|
|
481
|
-
),
|
|
482
|
-
for (const a of
|
|
483
|
-
a.applyChunk && (
|
|
484
|
-
return
|
|
485
|
-
},
|
|
486
|
-
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;
|
|
487
606
|
const n = e.answer_type;
|
|
488
|
-
if (!n)
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
}, G = (e, t = "", n = "", r) => {
|
|
607
|
+
if (!n) return;
|
|
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) => {
|
|
493
611
|
var i;
|
|
494
|
-
const
|
|
495
|
-
if ((i =
|
|
496
|
-
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;
|
|
497
615
|
for (const c of a.answer.reports)
|
|
498
|
-
|
|
616
|
+
yt(c, r);
|
|
499
617
|
return a;
|
|
500
618
|
}
|
|
501
|
-
const
|
|
502
|
-
return typeof
|
|
503
|
-
},
|
|
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 = {
|
|
504
622
|
User: "user",
|
|
505
623
|
Assistant: "assistant"
|
|
506
624
|
};
|
|
507
|
-
let
|
|
508
|
-
const
|
|
625
|
+
let ht = 0;
|
|
626
|
+
const oe = (e = "msg") => `${e}-${++ht}`, gt = (e) => {
|
|
509
627
|
const t = e.trim();
|
|
510
|
-
if (!t || t === "[DONE]")
|
|
511
|
-
return null;
|
|
628
|
+
if (!t || t === "[DONE]") return null;
|
|
512
629
|
const n = t.replace(/^data:\s*/, "");
|
|
513
630
|
try {
|
|
514
631
|
return JSON.parse(n);
|
|
@@ -519,7 +636,7 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
519
636
|
return null;
|
|
520
637
|
}
|
|
521
638
|
}
|
|
522
|
-
},
|
|
639
|
+
}, wt = () => {
|
|
523
640
|
let e = "";
|
|
524
641
|
return {
|
|
525
642
|
push(t) {
|
|
@@ -532,60 +649,56 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
532
649
|
return e = "", t ? [t] : [];
|
|
533
650
|
}
|
|
534
651
|
};
|
|
535
|
-
},
|
|
652
|
+
}, bt = 30, _t = /[A-Za-z]:[\\/][^\s"'`,。;;、,()()【】\[\]<>|?*]*/g, vt = /\\\\[^\s"'`,。;;、,()()【】\[\]<>|?*]+/g, zt = /(^|[\s"'`((【\[::,,、])((?:\/[^\s"'`,。;;、,()()【】\[\]<>|?*\/]+){2,})/g, Et = /^(?:请帮忙|请帮我|帮我看看|帮我把|帮我|帮忙|请把|麻烦你|麻烦|劳驾|请你|请问|帮(?!助))\s*[::,,、\-—]?\s*/, P = (e) => {
|
|
536
653
|
const t = e.split(/[\\/]+/).filter(Boolean);
|
|
537
654
|
return t.length ? t[t.length - 1] : "";
|
|
538
|
-
},
|
|
655
|
+
}, St = (e) => e.replace(vt, (t) => P(t)).replace(_t, (t) => P(t)).replace(zt, (t, n, r) => n + P(r)), qt = (e) => {
|
|
539
656
|
let t = String(e ?? "").replace(/\r\n|\r|\n/g, " ").replace(/\s+/g, " ").trim();
|
|
540
|
-
if (!t)
|
|
541
|
-
|
|
542
|
-
t = tt(t).replace(/\s+/g, " ").trim();
|
|
657
|
+
if (!t) return "";
|
|
658
|
+
t = St(t).replace(/\s+/g, " ").trim();
|
|
543
659
|
let n = "";
|
|
544
660
|
for (; n !== t; )
|
|
545
|
-
n = t, t = t.replace(
|
|
546
|
-
return t.slice(0,
|
|
547
|
-
},
|
|
548
|
-
const n = e.getReader(), r = new TextDecoder(),
|
|
549
|
-
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);
|
|
550
666
|
a && t(a);
|
|
551
667
|
};
|
|
552
668
|
try {
|
|
553
669
|
for (; ; ) {
|
|
554
670
|
const { done: i, value: a } = await n.read();
|
|
555
|
-
if (i)
|
|
556
|
-
|
|
557
|
-
o.push(r.decode(a, { stream: !0 })).forEach(s);
|
|
671
|
+
if (i) break;
|
|
672
|
+
s.push(r.decode(a, { stream: !0 })).forEach(o);
|
|
558
673
|
}
|
|
559
|
-
|
|
674
|
+
s.flush().forEach(o);
|
|
560
675
|
} catch (i) {
|
|
561
676
|
throw await n.cancel().catch(() => {
|
|
562
677
|
}), i;
|
|
563
678
|
} finally {
|
|
564
679
|
n.releaseLock();
|
|
565
680
|
}
|
|
566
|
-
},
|
|
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) => {
|
|
567
682
|
var r;
|
|
568
|
-
if (e.type && e.type !== "file")
|
|
569
|
-
return !1;
|
|
683
|
+
if (e.type && e.type !== "file") return !1;
|
|
570
684
|
const t = e.attachContent || {};
|
|
571
|
-
if (t.groupType === "image")
|
|
572
|
-
return !0;
|
|
685
|
+
if (t.groupType === "image") return !0;
|
|
573
686
|
const n = (t.suffix || ((r = e.name) != null && r.includes(".") ? e.name.split(".").pop() : "") || "").toLowerCase();
|
|
574
|
-
return !!(
|
|
575
|
-
},
|
|
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) => {
|
|
576
689
|
const r = e.attachContent || {};
|
|
577
|
-
return r.url ? r.url : typeof r.fileContent == "string" && r.fileContent.startsWith("data:image/") ? r.fileContent : r.fileId ?
|
|
578
|
-
},
|
|
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) => {
|
|
579
692
|
var a;
|
|
580
|
-
const t = (e == null ? void 0 : e.name) || "", n = t.includes(".") && ((a = t.split(".").pop()) == null ? void 0 : a.toLowerCase()) || "", r =
|
|
581
|
-
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;
|
|
582
695
|
if (r && typeof window < "u" && typeof URL < "u" && e instanceof Blob)
|
|
583
696
|
try {
|
|
584
|
-
|
|
697
|
+
s = URL.createObjectURL(e);
|
|
585
698
|
} catch {
|
|
586
|
-
|
|
699
|
+
s = void 0;
|
|
587
700
|
}
|
|
588
|
-
const
|
|
701
|
+
const o = ie(e == null ? void 0 : e.size), i = [n.toUpperCase(), o].filter(Boolean).join(" · ");
|
|
589
702
|
return {
|
|
590
703
|
type: "file",
|
|
591
704
|
name: t,
|
|
@@ -595,17 +708,17 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
595
708
|
size: e == null ? void 0 : e.size,
|
|
596
709
|
suffix: n,
|
|
597
710
|
raw: e,
|
|
598
|
-
url:
|
|
711
|
+
url: s,
|
|
599
712
|
groupType: r ? "image" : "file"
|
|
600
713
|
}
|
|
601
714
|
};
|
|
602
|
-
},
|
|
603
|
-
var
|
|
604
|
-
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() : "";
|
|
605
718
|
return {
|
|
606
719
|
type: "file",
|
|
607
720
|
name: t,
|
|
608
|
-
description:
|
|
721
|
+
description: s,
|
|
609
722
|
attachContent: {
|
|
610
723
|
file_name: (e == null ? void 0 : e.file_name) ?? t,
|
|
611
724
|
fileId: (e == null ? void 0 : e.file_id) ?? (e == null ? void 0 : e.id),
|
|
@@ -614,46 +727,46 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
614
727
|
groupType: r ? "image" : "file"
|
|
615
728
|
}
|
|
616
729
|
};
|
|
617
|
-
},
|
|
618
|
-
var r,
|
|
619
|
-
const t = (e == null ? void 0 : e.values) ?? e, n = ((r = t == null ? void 0 : t.attach) == null ? void 0 : r.files) ?? ((
|
|
620
|
-
return !Array.isArray(n) || n.length === 0 ? [] : n.map((a) =>
|
|
621
|
-
},
|
|
622
|
-
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;
|
|
623
736
|
if (!e)
|
|
624
737
|
return { type: "file", name: "", description: "", attachContent: {} };
|
|
625
738
|
if (typeof Blob < "u" && e instanceof Blob)
|
|
626
|
-
return
|
|
739
|
+
return K(e);
|
|
627
740
|
if (typeof e == "object" && e.attachContent) {
|
|
628
|
-
const
|
|
741
|
+
const o = e.type || "file", i = e.name || e.attachContent.file_name || e.attachContent.name || "";
|
|
629
742
|
let a = e.description || "";
|
|
630
743
|
const c = { ...e.attachContent };
|
|
631
|
-
if (
|
|
632
|
-
const
|
|
633
|
-
a = [c.suffix ? c.suffix.toUpperCase() : "",
|
|
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 || "";
|
|
746
|
+
a = [c.suffix ? c.suffix.toUpperCase() : "", u].filter(Boolean).join(" · ");
|
|
634
747
|
}
|
|
635
748
|
return {
|
|
636
749
|
...e,
|
|
637
|
-
type:
|
|
750
|
+
type: o,
|
|
638
751
|
name: i,
|
|
639
752
|
description: a,
|
|
640
753
|
attachContent: c
|
|
641
754
|
};
|
|
642
755
|
}
|
|
643
756
|
if (e.file_id || e.fileId)
|
|
644
|
-
return
|
|
757
|
+
return ae(e);
|
|
645
758
|
if (e.raw && typeof Blob < "u" && e.raw instanceof Blob) {
|
|
646
|
-
const
|
|
759
|
+
const o = K(e.raw);
|
|
647
760
|
return {
|
|
648
|
-
...
|
|
761
|
+
...o,
|
|
649
762
|
...e,
|
|
650
763
|
attachContent: {
|
|
651
|
-
...
|
|
764
|
+
...o.attachContent,
|
|
652
765
|
...e.attachContent
|
|
653
766
|
}
|
|
654
767
|
};
|
|
655
768
|
}
|
|
656
|
-
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()) || "";
|
|
657
770
|
return {
|
|
658
771
|
type: e.type || "file",
|
|
659
772
|
name: t,
|
|
@@ -664,168 +777,238 @@ const J = (e = "msg") => `${e}-${++Ve}`, Ye = (e) => {
|
|
|
664
777
|
...e
|
|
665
778
|
}
|
|
666
779
|
};
|
|
667
|
-
},
|
|
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) => {
|
|
668
799
|
const n = await e.createHistoryGroup(t), r = (n == null ? void 0 : n.group_id) ?? (n == null ? void 0 : n.history_group_id) ?? "";
|
|
669
|
-
if (!r)
|
|
670
|
-
throw new Error("创建对话分组失败");
|
|
800
|
+
if (!r) throw new Error("创建对话分组失败");
|
|
671
801
|
return r;
|
|
672
|
-
},
|
|
802
|
+
}, Zt = (e, t) => e.deleteHistoryGroup(t), Ft = (e, t, n) => e.setHistoryGroupTitle(t, n), ce = 5, le = async (e, t, n) => {
|
|
673
803
|
const r = new Array(e.length);
|
|
674
|
-
let
|
|
675
|
-
const
|
|
676
|
-
for (;
|
|
677
|
-
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++;
|
|
678
808
|
r[i] = await n(e[i], i);
|
|
679
809
|
}
|
|
680
810
|
});
|
|
681
|
-
return await Promise.all(
|
|
682
|
-
},
|
|
683
|
-
if (!t)
|
|
684
|
-
|
|
685
|
-
const i = [...await e.getHistoryDetail(t, r, n)].sort((u, l) => String(u.create_time || "").localeCompare(String(l.create_time || ""))), a = await te(i, ee, async (u) => {
|
|
811
|
+
return await Promise.all(o), r;
|
|
812
|
+
}, Qt = async (e, t, n = 10, r = 0, s) => {
|
|
813
|
+
if (!t) return [];
|
|
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) => {
|
|
686
815
|
try {
|
|
687
|
-
return await e.getHistoryAnswer(
|
|
816
|
+
return await e.getHistoryAnswer(l.history_id || "");
|
|
688
817
|
} catch {
|
|
689
818
|
return null;
|
|
690
819
|
}
|
|
691
820
|
}), c = [];
|
|
692
|
-
return i.forEach((
|
|
693
|
-
const m =
|
|
821
|
+
return i.forEach((l, u) => {
|
|
822
|
+
const m = l.history_id || oe("h"), d = a[u], f = d != null ? L(d) : [];
|
|
694
823
|
if (c.push({
|
|
695
824
|
id: m,
|
|
696
|
-
historyId:
|
|
825
|
+
historyId: l.history_id,
|
|
697
826
|
role: "user",
|
|
698
|
-
content:
|
|
827
|
+
content: l.question ?? "",
|
|
699
828
|
attachments: f.length > 0 ? f : void 0
|
|
700
829
|
}), d != null) {
|
|
701
|
-
const p =
|
|
830
|
+
const p = k(d, m, l.question ?? "", s);
|
|
702
831
|
c.push({
|
|
703
832
|
id: `${m}-answer`,
|
|
704
|
-
historyId:
|
|
833
|
+
historyId: l.history_id,
|
|
705
834
|
role: "assistant",
|
|
706
835
|
answer: p,
|
|
707
836
|
error: !1,
|
|
708
837
|
stopped: !1,
|
|
709
|
-
|
|
838
|
+
runMs: T(p).runMs,
|
|
839
|
+
thinking: { steps: M(p), expanded: !1 }
|
|
710
840
|
});
|
|
711
841
|
}
|
|
712
842
|
}), c;
|
|
713
|
-
},
|
|
843
|
+
}, en = async (e, t, n = 10, r, s = 0, o) => {
|
|
714
844
|
if (!t)
|
|
715
845
|
return r == null || r({ type: "users", users: [] }), [];
|
|
716
|
-
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) => ({
|
|
717
847
|
id: c[f],
|
|
718
848
|
historyId: d.history_id,
|
|
719
849
|
role: "user",
|
|
720
850
|
content: d.question ?? ""
|
|
721
851
|
}));
|
|
722
|
-
r == null || r({ type: "users", users:
|
|
723
|
-
const
|
|
724
|
-
await
|
|
852
|
+
r == null || r({ type: "users", users: l });
|
|
853
|
+
const u = new Array(a.length).fill(null);
|
|
854
|
+
await le(a, ce, async (d, f) => {
|
|
725
855
|
let p = null;
|
|
726
856
|
try {
|
|
727
857
|
p = await e.getHistoryAnswer(d.history_id || "");
|
|
728
858
|
} catch {
|
|
729
859
|
p = null;
|
|
730
860
|
}
|
|
731
|
-
if (p == null)
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
const I = G(p, c[f], d.question ?? "", s), j = {
|
|
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 = {
|
|
736
865
|
id: `${c[f]}-answer`,
|
|
737
866
|
historyId: d.history_id,
|
|
738
867
|
role: "assistant",
|
|
739
|
-
answer:
|
|
868
|
+
answer: $,
|
|
740
869
|
error: !1,
|
|
741
870
|
stopped: !1,
|
|
742
|
-
|
|
871
|
+
runMs: T($).runMs,
|
|
872
|
+
thinking: { steps: M($), expanded: !1 }
|
|
743
873
|
};
|
|
744
|
-
|
|
874
|
+
u[f] = H, r == null || r({
|
|
745
875
|
type: "assistant",
|
|
746
876
|
index: f,
|
|
747
|
-
user:
|
|
748
|
-
assistant:
|
|
877
|
+
user: l[f],
|
|
878
|
+
assistant: H
|
|
749
879
|
});
|
|
750
880
|
});
|
|
751
881
|
const m = [];
|
|
752
882
|
return a.forEach((d, f) => {
|
|
753
|
-
m.push(
|
|
754
|
-
const p =
|
|
883
|
+
m.push(l[f]);
|
|
884
|
+
const p = u[f];
|
|
755
885
|
p && m.push(p);
|
|
756
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;
|
|
757
912
|
};
|
|
758
913
|
export {
|
|
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
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
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
|
|
830
1013
|
};
|
|
831
1014
|
//# sourceMappingURL=index.js.map
|