wi-chat 0.3.0 → 0.4.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.
@@ -0,0 +1,43 @@
1
+ import { AiAnswerReport } from '../../answer';
2
+ import { StreamChunk } from '../../sse';
3
+ import { AnswerParser } from '../../registry';
4
+ import { OutputFileValue } from './types';
5
+
6
+ /** output_file 类型的历史分发键 / 实时载荷有效类型 */
7
+ export declare const OUTPUT_FILE_ANSWER_TYPE = "output_file";
8
+ /**
9
+ * 防御性读取 output_file 载荷,兼容两种服务端形态:
10
+ * - 实时链路:`{ values: { file_id, file_name }, answer_type: 'output_file' }`;
11
+ * - 历史接口:`{ file_id, file_name, answer_type: 'output_file' }`(顶层字段)。
12
+ * 嵌套优先、顶层兜底;两者都取不到时返回空对象。
13
+ * @param value result chunk 载荷(或历史 report 元素)
14
+ * @returns 只含非空 file_id / file_name 的取值结构
15
+ */
16
+ export declare const readOutputFilePayload: (value: any) => OutputFileValue;
17
+ /**
18
+ * 处理实时流的 `result` chunk:有效类型为 `output_file` 时把载荷归一成 `values`
19
+ * 并追加为新报告。
20
+ * `result` 是所有非流式答案类型的通用载体,故严格按有效类型 `=== 'output_file'` 门控;
21
+ * 载荷没有 file_id / file_name 时消费但不产生空报告。
22
+ * @param chunk 流式数据块
23
+ * @param reports 回答 reports 数组(registry 预取的 `answerValues.answer.reports` 同一引用,push 即累积)
24
+ * @returns 是否消费了该 chunk:`result` 且有效类型为 `output_file` 时 true,其余 false
25
+ */
26
+ export declare const applyOutputFileChunk: (chunk: StreamChunk, reports: AiAnswerReport<any>[]) => boolean;
27
+ /**
28
+ * 把历史接口返回的单个 `output_file` report 元素标准化成渲染层结构:
29
+ * 渲染层只读 `values`,故把顶层 file_id / file_name 收拢进 values。
30
+ *
31
+ * 幂等:values 已有 file_id / file_name(实时累积或此前已标准化)时原样跳过;
32
+ * 两处都取不到时不改写 values(不造空结构)。
33
+ * @param report 历史 reports 中的一个 `output_file` 元素(就地修改并返回)
34
+ * @returns 标准化后的同一 report 引用
35
+ */
36
+ export declare const normalizeOutputFileReport: (report: AiAnswerReport<OutputFileValue>) => AiAnswerReport<OutputFileValue>;
37
+ /**
38
+ * output_file 答案类型的注册表条目(registry 内置):
39
+ * - 实时链路:`applyChunk` 复用 `applyOutputFileChunk`(只消费 `result`/`output_file` 载荷);
40
+ * - 历史链路:`answerType` 命中 `output_file` 时由 `normalizeReport` 复用
41
+ * `normalizeOutputFileReport` 把服务端原始形态映射成 values。
42
+ */
43
+ export declare const outputFileParser: AnswerParser<OutputFileValue>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * output_file 答案类型的类型定义
3
+ *
4
+ * 后端在本地电脑模式下执行 sys_write_file 等操作后,会下发
5
+ * `answer_type = 'output_file'` 的 result 报告:
6
+ * `{ values: { file_id, file_name }, answer_type: 'output_file', ... }`。
7
+ * 渲染层据此展示文件卡片,点击后按文件类型预览(文本 / 图片 / PDF / HTML / 音视频)。
8
+ */
9
+ /** output_file 回答的渲染层取值结构 */
10
+ export interface OutputFileValue {
11
+ /** 后端文件 id,用于按 id 下载文件二进制 */
12
+ file_id?: string;
13
+ /** 文件名(含扩展名),用于展示与判断预览类型 */
14
+ file_name?: string;
15
+ /** 其余字段原样保留 */
16
+ [key: string]: any;
17
+ }
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=()=>({answer_type:"knowledge_stream_result",values:[{answer:""}]}),M=e=>(e.answer_type="knowledge_stream_result",(!Array.isArray(e.values)||!e.values.length)&&(e.values=[{answer:""}]),e),P=(e="",t="")=>({id:e,question:t,answer:{reports:[]}}),oe=["knowledge_stream_begin","knowledge_stream","knowledge_stream_result","knowledge_stream_end"],z=(e,t,n,r)=>{var u;if(!e.mode||!oe.includes(e.mode))return!1;if(e.mode==="knowledge_stream_result"||e.mode==="knowledge_stream_end")return!0;const s=r==null?void 0:r.beforeKnowledgeRender,o=l=>s?s(l):l;if(e.mode==="knowledge_stream_begin"){const l=t.at(-1);return(l==null?void 0:l.answer_type)==="knowledge_stream_result"?(l.values=l.values??[],l.values.push({answer:""}),!0):l&&!l.answer_type?(M(l),!0):(t.push($()),!0)}if(e.mode!=="knowledge_stream")return!1;let i=t.at(-1);i&&!i.answer_type?i=M(i):(!i||i.answer_type!=="knowledge_stream_result")&&(i=$(),t.push(i)),i.values=(u=i.values)!=null&&u.length?i.values:[{answer:""}];const a=i.values[i.values.length-1],c=`${a.raw??""}${e.value||""}`;return a.raw=c,a.answer=o(c),!0},O=(e,t)=>{if(Array.isArray(e.values)&&e.values.length)return e;const n=t==null?void 0:t.beforeKnowledgeRender,r=o=>n?n(o):o;let s=[];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},x={id:"knowledge_stream",answerType:"knowledge_stream_result",applyChunk:z,normalizeReport:O},N=["begin","begin_stream","send_stream","end_stream"],L=(e,t)=>{if(!N.includes(e.mode||""))return!1;let n=t.at(-1);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},H=e=>{const t=[];let n="",r=!1;for(const s of(e.exec_process??[]).filter(o=>N.includes(o.mode||""))){const o=typeof s.value=="string"?s.value:"";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="")}return r&&n.trim()&&t.push(n.trim()),t},S=e=>{var t;return(((t=e.answer)==null?void 0:t.reports)??[]).flatMap(H)},D={id:"deep_thinking",applyChunk:L},B='/**\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',se="iframe-resizer/child 5.1.5",ie=B,b=`<script>${B}<\/script>`,ae=e=>!e||typeof e!="object"?"":String(e.type||e.answer_type||""),U=e=>{if(!e||typeof e!="object")return{};const t=e.values,n=o=>{const i=t&&typeof t=="object"?t[o]:void 0;if(typeof i=="string"&&i)return i;const a=e[o];return typeof a=="string"&&a?a:void 0},r=n("url"),s=n("srcdoc");return{...r?{url:r}:{},...s?{srcdoc:s}:{}}},_=e=>e&&(e.includes("</head>")?e.replace("</head>",`${b}</head>`):e.includes("<body")?e.replace("<body",`${b}<body`):b+e),ce=e=>!e||typeof e!="object"||Array.isArray(e)||!e.url&&!e.srcdoc?!1:!e.srcdoc||e.srcdoc.includes(se),W=(e,t)=>{if(e.mode!=="result"||ae(e.value)!=="url")return!1;const n=U(e.value);return!n.url&&!n.srcdoc||(n.srcdoc&&(n.srcdoc=_(n.srcdoc)),t.push({answer_type:"url",values:n})),!0},G=e=>{if(ce(e.values))return e;const t=U(e);return!t.url&&!t.srcdoc||(t.srcdoc&&(t.srcdoc=_(t.srcdoc)),e.values=t),e},K={id:"iframe_page",answerType:"url",applyChunk:W,normalizeReport:G},y="recordset",le=["cols","values","chart","title","max_cols","parent_link_col","agent_key"],ue=e=>!e||typeof e!="object"?"":String(e.type||e.answer_type||""),g=e=>!!e&&typeof e=="object"&&!Array.isArray(e)&&(Array.isArray(e.cols)||Array.isArray(e.values)),q=e=>{if(!e||typeof e!="object"||Array.isArray(e))return;const t=e.values;if(g(t))return t;if(g(e))return e},X=(e,t)=>{if(e.mode!=="result"||ue(e.value)!==y)return!1;const n=q(e.value);return n&&t.push({answer_type:y,values:n}),!0},V=e=>{if(g(e.values))return e;const t=e;if(!g(t))return e;const n={};for(const r of le)n[r]=t[r];return e.values=n,e},J={id:"recordset",answerType:y,applyChunk:X,normalizeReport:V},w=[D,x,K,J],de=e=>{const t=(e==null?void 0:e.parsers)??[];return t.length?[...w,...t]:w},me=(e,t,n)=>{var i;const r=(i=e.answer)==null?void 0:i.reports;if(!r)return[];const s=new Set(((n==null?void 0:n.parsers)??[]).filter(a=>a.applyChunk&&a.answerType).map(a=>a.answerType)),o=[];for(const a of de(n))a.applyChunk&&(w.includes(a)&&a.answerType&&s.has(a.answerType)||a.applyChunk(t,r,e,n)&&o.push(a.id));return o},Z=(e,t)=>{var o;const n=e.answer_type;if(!n)return;const s=((t==null?void 0:t.parsers)??[]).find(i=>i.answerType===n&&!!i.normalizeReport)??w.find(i=>i.answerType===n&&!!i.normalizeReport);(o=s==null?void 0:s.normalizeReport)==null||o.call(s,e,t)},A=(e,t="",n="",r)=>{var i;const s=(e==null?void 0:e.values)??e;if((i=s==null?void 0:s.answer)!=null&&i.reports){const a=s;for(const c of a.answer.reports)Z(c,r);return a}const o=P(t,n);return typeof s=="string"&&z({mode:"knowledge_stream",value:s},o.answer.reports,o,r),o},fe={User:"user",Assistant:"assistant"};let pe=0;const E=(e="msg")=>`${e}-${++pe}`,Y=e=>{const t=e.trim();if(!t||t==="[DONE]")return null;const n=t.replace(/^data:\s*/,"");try{return JSON.parse(n)}catch{try{return JSON.parse(decodeURIComponent(n))}catch{return null}}},Q=()=>{let e="";return{push(t){const n=(e+t).split(`
2
- `);return e=n.pop()||"",n},flush(){const t=e;return e="",t?[t]:[]}}},he=async(e,t)=>{const n=e.getReader(),r=new TextDecoder,s=Q(),o=i=>{const a=Y(i);a&&t(a)};try{for(;;){const{done:i,value:a}=await n.read();if(i)break;s.push(r.decode(a,{stream:!0})).forEach(o)}s.flush().forEach(o)}catch(i){throw await n.cancel().catch(()=>{}),i}finally{n.releaseLock()}},h=new Set(["png","jpg","jpeg","gif","webp","svg","bmp"]),C=e=>!e||isNaN(e)?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,ye=e=>{var r;if(e.type&&e.type!=="file")return!1;const t=e.attachContent||{};if(t.groupType==="image")return!0;const n=(t.suffix||((r=e.name)!=null&&r.includes(".")?e.name.split(".").pop():"")||"").toLowerCase();return!!(h.has(n)||t.raw&&typeof t.raw.type=="string"&&t.raw.type.startsWith("image/"))},F=(e,t,n)=>e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:`${(t||"").replace(/\/$/,"")}${n}?file_id=${e}`,ee=(e,t="",n)=>e?n?n(e):F(e,t,"/file/download_file"):"",ge=(e,t="",n)=>{const r=e.attachContent||{};return r.url?r.url:typeof r.fileContent=="string"&&r.fileContent.startsWith("data:image/")?r.fileContent:r.fileId?ee(r.fileId,t,n):""},v=e=>{var a;const t=(e==null?void 0:e.name)||"",n=t.includes(".")&&((a=t.split(".").pop())==null?void 0:a.toLowerCase())||"",r=h.has(n)||(e==null?void 0:e.type)&&typeof e.type=="string"&&e.type.startsWith("image/");let s;if(r&&typeof window<"u"&&typeof URL<"u"&&e instanceof Blob)try{s=URL.createObjectURL(e)}catch{s=void 0}const o=C(e==null?void 0:e.size),i=[n.toUpperCase(),o].filter(Boolean).join(" · ");return{type:"file",name:t,description:i,attachContent:{file_name:t,size:e==null?void 0:e.size,suffix:n,raw:e,url:s,groupType:r?"image":"file"}}},R=e=>{var o;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=h.has(n)||(e==null?void 0:e.groupType)==="image",s=n?n.toUpperCase():"";return{type:"file",name:t,description:s,attachContent:{file_name:(e==null?void 0:e.file_name)??t,fileId:(e==null?void 0:e.file_id)??(e==null?void 0:e.id),fileContent:e==null?void 0:e.file_content,suffix:n,groupType:r?"image":"file"}}},te=e=>{var r,s,o,i;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)??[];return!Array.isArray(n)||n.length===0?[]:n.map(a=>R(a))},we=e=>{var r,s;if(!e)return{type:"file",name:"",description:"",attachContent:{}};if(typeof Blob<"u"&&e instanceof Blob)return v(e);if(typeof e=="object"&&e.attachContent){const o=e.type||"file",i=e.name||e.attachContent.file_name||e.attachContent.name||"";let a=e.description||"";const c={...e.attachContent};if(o==="file"&&(!c.suffix&&i.includes(".")&&(c.suffix=((r=i.split(".").pop())==null?void 0:r.toLowerCase())||""),(c.groupType==="image"||c.suffix&&h.has(c.suffix.toLowerCase())||c.raw&&typeof c.raw.type=="string"&&c.raw.type.startsWith("image/"))&&(c.groupType="image"),!a)){const l=typeof c.size=="number"?C(c.size):c.size||"";a=[c.suffix?c.suffix.toUpperCase():"",l].filter(Boolean).join(" · ")}return{...e,type:o,name:i,description:a,attachContent:c}}if(e.file_id||e.fileId)return R(e);if(e.raw&&typeof Blob<"u"&&e.raw instanceof Blob){const o=v(e.raw);return{...o,...e,attachContent:{...o.attachContent,...e.attachContent}}}const t=e.name||e.title||"",n=t.includes(".")&&((s=t.split(".").pop())==null?void 0:s.toLowerCase())||"";return{type:e.type||"file",name:t,description:e.description||(n?n.toUpperCase():""),attachContent:{file_name:t,suffix:n,...e}}},T=e=>te(e),be=async e=>[...(await e.getHistoryGroups()).groups??[]].sort((r,s)=>String(s.create_time??"").localeCompare(String(r.create_time??""))),ve=async(e,t)=>{const n=await e.createHistoryGroup(t),r=(n==null?void 0:n.group_id)??(n==null?void 0:n.history_group_id)??"";if(!r)throw new Error("创建对话分组失败");return r},ze=(e,t)=>e.deleteHistoryGroup(t),Se=(e,t,n)=>e.setHistoryGroupTitle(t,n),ne=5,re=async(e,t,n)=>{const r=new Array(e.length);let s=0;const o=Array.from({length:Math.min(t,e.length)},async()=>{for(;s<e.length;){const i=s++;r[i]=await n(e[i],i)}});return await Promise.all(o),r},_e=async(e,t,n=10,r=0,s)=>{if(!t)return[];const i=[...await e.getHistoryDetail(t,r,n)].sort((u,l)=>String(u.create_time||"").localeCompare(String(l.create_time||""))),a=await re(i,ne,async u=>{try{return await e.getHistoryAnswer(u.history_id||"")}catch{return null}}),c=[];return i.forEach((u,l)=>{const p=u.history_id||E("h"),d=a[l],m=d!=null?T(d):[];if(c.push({id:p,historyId:u.history_id,role:"user",content:u.question??"",attachments:m.length>0?m:void 0}),d!=null){const f=A(d,p,u.question??"",s);c.push({id:`${p}-answer`,historyId:u.history_id,role:"assistant",answer:f,error:!1,stopped:!1,thinking:{steps:S(f),expanded:!1}})}}),c},Ae=async(e,t,n=10,r,s=0,o)=>{if(!t)return r==null||r({type:"users",users:[]}),[];const a=[...await e.getHistoryDetail(t,s,n)].sort((d,m)=>String(d.create_time||"").localeCompare(String(m.create_time||""))),c=a.map(d=>d.history_id||E("h")),u=a.map((d,m)=>({id:c[m],historyId:d.history_id,role:"user",content:d.question??""}));r==null||r({type:"users",users:u});const l=new Array(a.length).fill(null);await re(a,ne,async(d,m)=>{let f=null;try{f=await e.getHistoryAnswer(d.history_id||"")}catch{f=null}if(f==null)return;const I=T(f);I.length>0&&(u[m].attachments=I);const j=A(f,c[m],d.question??"",o),k={id:`${c[m]}-answer`,historyId:d.history_id,role:"assistant",answer:j,error:!1,stopped:!1,thinking:{steps:S(j),expanded:!1}};l[m]=k,r==null||r({type:"assistant",index:m,user:u[m],assistant:k})});const p=[];return a.forEach((d,m)=>{p.push(u[m]);const f=l[m];f&&p.push(f)}),p};exports.IFRAME_RESIZER_CHILD_SCRIPT=ie;exports.IMAGE_EXTENSIONS=h;exports.RECORDSET_ANSWER_TYPE=y;exports.RoleEnum=fe;exports.applyAnswerChunk=me;exports.applyDeepThinkingChunk=L;exports.applyIframePageChunk=W;exports.applyKnowledgeStreamChunk=z;exports.applyRecordsetChunk=X;exports.collectDeepThinkingSteps=H;exports.collectThinkingSteps=S;exports.consumeStream=he;exports.createEmptyAnswerValues=P;exports.createHistoryGroup=ve;exports.createLineSplitter=Q;exports.deepThinkingParser=D;exports.deleteHistoryGroup=ze;exports.extractAttachmentsFromHistory=T;exports.extractHistoryAttachments=te;exports.formatFileSize=C;exports.getHistoryGroups=be;exports.iframePageParser=K;exports.injectIframeResizerScript=_;exports.isImageAttachment=ye;exports.knowledgeStreamParser=x;exports.loadGroupMessages=_e;exports.loadGroupMessagesByStep=Ae;exports.nextLocalMessageId=E;exports.normalizeAnswer=A;exports.normalizeAnswerReport=Z;exports.normalizeAttachment=we;exports.normalizeIframePageReport=G;exports.normalizeKnowledgeStreamReport=O;exports.normalizeRecordsetReport=V;exports.parseHistoryAttachment=R;exports.parseRealtimeAttachment=v;exports.parseSseLine=Y;exports.readRecordsetPayload=q;exports.recordsetParser=J;exports.resolveAttachDownloadUrl=ee;exports.resolveAttachPreviewUrl=ge;exports.resolveRemoteFileUrl=F;exports.setHistoryGroupTitle=Se;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=()=>({answer_type:"knowledge_stream_result",values:[{answer:""}]}),x=e=>(e.answer_type="knowledge_stream_result",(!Array.isArray(e.values)||!e.values.length)&&(e.values=[{answer:""}]),e),N=(e="",t="")=>({id:e,question:t,answer:{reports:[]}}),ue=["knowledge_stream_begin","knowledge_stream","knowledge_stream_result","knowledge_stream_end"],_=(e,t,n,r)=>{var u;if(!e.mode||!ue.includes(e.mode))return!1;if(e.mode==="knowledge_stream_result"||e.mode==="knowledge_stream_end")return!0;const i=r==null?void 0:r.beforeKnowledgeRender,o=l=>i?i(l):l;if(e.mode==="knowledge_stream_begin"){const l=t.at(-1);return(l==null?void 0:l.answer_type)==="knowledge_stream_result"?(l.values=l.values??[],l.values.push({answer:""}),!0):l&&!l.answer_type?(x(l),!0):(t.push(M()),!0)}if(e.mode!=="knowledge_stream")return!1;let s=t.at(-1);s&&!s.answer_type?s=x(s):(!s||s.answer_type!=="knowledge_stream_result")&&(s=M(),t.push(s)),s.values=(u=s.values)!=null&&u.length?s.values:[{answer:""}];const a=s.values[s.values.length-1],c=`${a.raw??""}${e.value||""}`;return a.raw=c,a.answer=o(c),!0},L=(e,t)=>{if(Array.isArray(e.values)&&e.values.length)return e;const n=t==null?void 0:t.beforeKnowledgeRender,r=o=>n?n(o):o;let i=[];return Array.isArray(e.knowledge)&&(i=e.knowledge.map(o=>typeof o=="string"?o:o==null?void 0:o.answer).filter(o=>typeof o=="string"&&o!=="")),i.length===0&&typeof e.answer=="string"&&e.answer!==""&&(i=[e.answer]),i.length&&(e.values=i.map(o=>({answer:r(o),raw:o}))),e},H={id:"knowledge_stream",answerType:"knowledge_stream_result",applyChunk:_,normalizeReport:L},U=["begin","begin_stream","send_stream","end_stream"],D=(e,t)=>{if(!U.includes(e.mode||""))return!1;let n=t.at(-1);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},B=e=>{const t=[];let n="",r=!1;for(const i of(e.exec_process??[]).filter(o=>U.includes(o.mode||""))){const o=typeof i.value=="string"?i.value:"";i.mode==="begin"?(r&&n.trim()&&t.push(n.trim()),r=!1,n="",o.trim()&&t.push(o.trim())):i.mode==="begin_stream"?(r&&n.trim()&&t.push(n.trim()),r=!0,n=o):i.mode==="send_stream"&&r?n+=o:i.mode==="end_stream"&&r&&(n+=o,n.trim()&&t.push(n.trim()),r=!1,n="")}return r&&n.trim()&&t.push(n.trim()),t},A=e=>{var t;return(((t=e.answer)==null?void 0:t.reports)??[]).flatMap(B)},W={id:"deep_thinking",applyChunk:D},G='/**\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',de="iframe-resizer/child 5.1.5",fe=G,z=`<script>${G}<\/script>`,me=e=>!e||typeof e!="object"?"":String(e.type||e.answer_type||""),K=e=>{if(!e||typeof e!="object")return{};const t=e.values,n=o=>{const s=t&&typeof t=="object"?t[o]:void 0;if(typeof s=="string"&&s)return s;const a=e[o];return typeof a=="string"&&a?a:void 0},r=n("url"),i=n("srcdoc");return{...r?{url:r}:{},...i?{srcdoc:i}:{}}},E=e=>e&&(e.includes("</head>")?e.replace("</head>",`${z}</head>`):e.includes("<body")?e.replace("<body",`${z}<body`):z+e),pe=e=>!e||typeof e!="object"||Array.isArray(e)||!e.url&&!e.srcdoc?!1:!e.srcdoc||e.srcdoc.includes(de),q=(e,t)=>{if(e.mode!=="result"||me(e.value)!=="url")return!1;const n=K(e.value);return!n.url&&!n.srcdoc||(n.srcdoc&&(n.srcdoc=E(n.srcdoc)),t.push({answer_type:"url",values:n})),!0},X=e=>{if(pe(e.values))return e;const t=K(e);return!t.url&&!t.srcdoc||(t.srcdoc&&(t.srcdoc=E(t.srcdoc)),e.values=t),e},V={id:"iframe_page",answerType:"url",applyChunk:q,normalizeReport:X},w="recordset",ye=["cols","values","chart","title","max_cols","parent_link_col","agent_key"],he=e=>!e||typeof e!="object"?"":String(e.type||e.answer_type||""),b=e=>!!e&&typeof e=="object"&&!Array.isArray(e)&&(Array.isArray(e.cols)||Array.isArray(e.values)),Y=e=>{if(!e||typeof e!="object"||Array.isArray(e))return;const t=e.values;if(b(t))return t;if(b(e))return e},J=(e,t)=>{if(e.mode!=="result"||he(e.value)!==w)return!1;const n=Y(e.value);return n&&t.push({answer_type:w,values:n}),!0},Z=e=>{if(b(e.values))return e;const t=e;if(!b(t))return e;const n={};for(const r of ye)n[r]=t[r];return e.values=n,e},Q={id:"recordset",answerType:w,applyChunk:J,normalizeReport:Z},y="output_file",ge=e=>!e||typeof e!="object"?"":String(e.type||e.answer_type||""),g=(e,t)=>{if(!e||typeof e!="object")return;const n=e[t];return typeof n=="string"&&n?n:void 0},R=e=>{if(!e||typeof e!="object")return{};const t=e.values&&typeof e.values=="object"?e.values:void 0,n=g(t,"file_id")??g(e,"file_id"),r=g(t,"file_name")??g(e,"file_name");return{...n?{file_id:n}:{},...r?{file_name:r}:{}}},F=(e,t)=>{if(e.mode!=="result"||ge(e.value)!==y)return!1;const n=R(e.value);return!n.file_id&&!n.file_name||t.push({answer_type:y,values:n}),!0},ee=e=>{const t=R(e);if(!t.file_id&&!t.file_name)return e;const n=e.values&&typeof e.values=="object"&&!Array.isArray(e.values)?e.values:{};return(!t.file_id||n.file_id)&&(!t.file_name||n.file_name)||(e.values={...n,...t}),e},te={id:y,answerType:y,applyChunk:F,normalizeReport:ee},v=[W,H,V,Q,te],we=e=>{const t=(e==null?void 0:e.parsers)??[];return t.length?[...v,...t]:v},be=(e,t,n)=>{var s;const r=(s=e.answer)==null?void 0:s.reports;if(!r)return[];const i=new Set(((n==null?void 0:n.parsers)??[]).filter(a=>a.applyChunk&&a.answerType).map(a=>a.answerType)),o=[];for(const a of we(n))a.applyChunk&&(v.includes(a)&&a.answerType&&i.has(a.answerType)||a.applyChunk(t,r,e,n)&&o.push(a.id));return o},ne=(e,t)=>{var o;const n=e.answer_type;if(!n)return;const i=((t==null?void 0:t.parsers)??[]).find(s=>s.answerType===n&&!!s.normalizeReport)??v.find(s=>s.answerType===n&&!!s.normalizeReport);(o=i==null?void 0:i.normalizeReport)==null||o.call(i,e,t)},C=(e,t="",n="",r)=>{var s;const i=(e==null?void 0:e.values)??e;if((s=i==null?void 0:i.answer)!=null&&s.reports){const a=i;for(const c of a.answer.reports)ne(c,r);return a}const o=N(t,n);return typeof i=="string"&&_({mode:"knowledge_stream",value:i},o.answer.reports,o,r),o},ve={User:"user",Assistant:"assistant"};let ze=0;const T=(e="msg")=>`${e}-${++ze}`,re=e=>{const t=e.trim();if(!t||t==="[DONE]")return null;const n=t.replace(/^data:\s*/,"");try{return JSON.parse(n)}catch{try{return JSON.parse(decodeURIComponent(n))}catch{return null}}},oe=()=>{let e="";return{push(t){const n=(e+t).split(`
2
+ `);return e=n.pop()||"",n},flush(){const t=e;return e="",t?[t]:[]}}},Se=async(e,t)=>{const n=e.getReader(),r=new TextDecoder,i=oe(),o=s=>{const a=re(s);a&&t(a)};try{for(;;){const{done:s,value:a}=await n.read();if(s)break;i.push(r.decode(a,{stream:!0})).forEach(o)}i.flush().forEach(o)}catch(s){throw await n.cancel().catch(()=>{}),s}finally{n.releaseLock()}},h=new Set(["png","jpg","jpeg","gif","webp","svg","bmp"]),I=e=>!e||isNaN(e)?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,_e=e=>{var r;if(e.type&&e.type!=="file")return!1;const t=e.attachContent||{};if(t.groupType==="image")return!0;const n=(t.suffix||((r=e.name)!=null&&r.includes(".")?e.name.split(".").pop():"")||"").toLowerCase();return!!(h.has(n)||t.raw&&typeof t.raw.type=="string"&&t.raw.type.startsWith("image/"))},ie=(e,t,n)=>e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:`${(t||"").replace(/\/$/,"")}${n}?file_id=${e}`,se=(e,t="",n)=>e?n?n(e):ie(e,t,"/file/download_file"):"",Ae=(e,t="",n)=>{const r=e.attachContent||{};return r.url?r.url:typeof r.fileContent=="string"&&r.fileContent.startsWith("data:image/")?r.fileContent:r.fileId?se(r.fileId,t,n):""},S=e=>{var a;const t=(e==null?void 0:e.name)||"",n=t.includes(".")&&((a=t.split(".").pop())==null?void 0:a.toLowerCase())||"",r=h.has(n)||(e==null?void 0:e.type)&&typeof e.type=="string"&&e.type.startsWith("image/");let i;if(r&&typeof window<"u"&&typeof URL<"u"&&e instanceof Blob)try{i=URL.createObjectURL(e)}catch{i=void 0}const o=I(e==null?void 0:e.size),s=[n.toUpperCase(),o].filter(Boolean).join(" · ");return{type:"file",name:t,description:s,attachContent:{file_name:t,size:e==null?void 0:e.size,suffix:n,raw:e,url:i,groupType:r?"image":"file"}}},j=e=>{var o;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=h.has(n)||(e==null?void 0:e.groupType)==="image",i=n?n.toUpperCase():"";return{type:"file",name:t,description:i,attachContent:{file_name:(e==null?void 0:e.file_name)??t,fileId:(e==null?void 0:e.file_id)??(e==null?void 0:e.id),fileContent:e==null?void 0:e.file_content,suffix:n,groupType:r?"image":"file"}}},ae=e=>{var r,i,o,s;const t=(e==null?void 0:e.values)??e,n=((r=t==null?void 0:t.attach)==null?void 0:r.files)??((o=(i=t==null?void 0:t.answer)==null?void 0:i.attach)==null?void 0:o.files)??(t==null?void 0:t.attach_files)??((s=t==null?void 0:t.answer)==null?void 0:s.attach_files)??[];return!Array.isArray(n)||n.length===0?[]:n.map(a=>j(a))},Ee=e=>{var r,i;if(!e)return{type:"file",name:"",description:"",attachContent:{}};if(typeof Blob<"u"&&e instanceof Blob)return S(e);if(typeof e=="object"&&e.attachContent){const o=e.type||"file",s=e.name||e.attachContent.file_name||e.attachContent.name||"";let a=e.description||"";const c={...e.attachContent};if(o==="file"&&(!c.suffix&&s.includes(".")&&(c.suffix=((r=s.split(".").pop())==null?void 0:r.toLowerCase())||""),(c.groupType==="image"||c.suffix&&h.has(c.suffix.toLowerCase())||c.raw&&typeof c.raw.type=="string"&&c.raw.type.startsWith("image/"))&&(c.groupType="image"),!a)){const l=typeof c.size=="number"?I(c.size):c.size||"";a=[c.suffix?c.suffix.toUpperCase():"",l].filter(Boolean).join(" · ")}return{...e,type:o,name:s,description:a,attachContent:c}}if(e.file_id||e.fileId)return j(e);if(e.raw&&typeof Blob<"u"&&e.raw instanceof Blob){const o=S(e.raw);return{...o,...e,attachContent:{...o.attachContent,...e.attachContent}}}const t=e.name||e.title||"",n=t.includes(".")&&((i=t.split(".").pop())==null?void 0:i.toLowerCase())||"";return{type:e.type||"file",name:t,description:e.description||(n?n.toUpperCase():""),attachContent:{file_name:t,suffix:n,...e}}},k=e=>ae(e),Re=async e=>[...(await e.getHistoryGroups()).groups??[]].sort((r,i)=>String(i.create_time??"").localeCompare(String(r.create_time??""))),Ce=async(e,t)=>{const n=await e.createHistoryGroup(t),r=(n==null?void 0:n.group_id)??(n==null?void 0:n.history_group_id)??"";if(!r)throw new Error("创建对话分组失败");return r},Te=(e,t)=>e.deleteHistoryGroup(t),Ie=(e,t,n)=>e.setHistoryGroupTitle(t,n),ce=5,le=async(e,t,n)=>{const r=new Array(e.length);let i=0;const o=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){const s=i++;r[s]=await n(e[s],s)}});return await Promise.all(o),r},je=async(e,t,n=10,r=0,i)=>{if(!t)return[];const s=[...await e.getHistoryDetail(t,r,n)].sort((u,l)=>String(u.create_time||"").localeCompare(String(l.create_time||""))),a=await le(s,ce,async u=>{try{return await e.getHistoryAnswer(u.history_id||"")}catch{return null}}),c=[];return s.forEach((u,l)=>{const p=u.history_id||T("h"),d=a[l],f=d!=null?k(d):[];if(c.push({id:p,historyId:u.history_id,role:"user",content:u.question??"",attachments:f.length>0?f:void 0}),d!=null){const m=C(d,p,u.question??"",i);c.push({id:`${p}-answer`,historyId:u.history_id,role:"assistant",answer:m,error:!1,stopped:!1,thinking:{steps:A(m),expanded:!1}})}}),c},ke=async(e,t,n=10,r,i=0,o)=>{if(!t)return r==null||r({type:"users",users:[]}),[];const a=[...await e.getHistoryDetail(t,i,n)].sort((d,f)=>String(d.create_time||"").localeCompare(String(f.create_time||""))),c=a.map(d=>d.history_id||T("h")),u=a.map((d,f)=>({id:c[f],historyId:d.history_id,role:"user",content:d.question??""}));r==null||r({type:"users",users:u});const l=new Array(a.length).fill(null);await le(a,ce,async(d,f)=>{let m=null;try{m=await e.getHistoryAnswer(d.history_id||"")}catch{m=null}if(m==null)return;const $=k(m);$.length>0&&(u[f].attachments=$);const P=C(m,c[f],d.question??"",o),O={id:`${c[f]}-answer`,historyId:d.history_id,role:"assistant",answer:P,error:!1,stopped:!1,thinking:{steps:A(P),expanded:!1}};l[f]=O,r==null||r({type:"assistant",index:f,user:u[f],assistant:O})});const p=[];return a.forEach((d,f)=>{p.push(u[f]);const m=l[f];m&&p.push(m)}),p};exports.IFRAME_RESIZER_CHILD_SCRIPT=fe;exports.IMAGE_EXTENSIONS=h;exports.OUTPUT_FILE_ANSWER_TYPE=y;exports.RECORDSET_ANSWER_TYPE=w;exports.RoleEnum=ve;exports.applyAnswerChunk=be;exports.applyDeepThinkingChunk=D;exports.applyIframePageChunk=q;exports.applyKnowledgeStreamChunk=_;exports.applyOutputFileChunk=F;exports.applyRecordsetChunk=J;exports.collectDeepThinkingSteps=B;exports.collectThinkingSteps=A;exports.consumeStream=Se;exports.createEmptyAnswerValues=N;exports.createHistoryGroup=Ce;exports.createLineSplitter=oe;exports.deepThinkingParser=W;exports.deleteHistoryGroup=Te;exports.extractAttachmentsFromHistory=k;exports.extractHistoryAttachments=ae;exports.formatFileSize=I;exports.getHistoryGroups=Re;exports.iframePageParser=V;exports.injectIframeResizerScript=E;exports.isImageAttachment=_e;exports.knowledgeStreamParser=H;exports.loadGroupMessages=je;exports.loadGroupMessagesByStep=ke;exports.nextLocalMessageId=T;exports.normalizeAnswer=C;exports.normalizeAnswerReport=ne;exports.normalizeAttachment=Ee;exports.normalizeIframePageReport=X;exports.normalizeKnowledgeStreamReport=L;exports.normalizeOutputFileReport=ee;exports.normalizeRecordsetReport=Z;exports.outputFileParser=te;exports.parseHistoryAttachment=j;exports.parseRealtimeAttachment=S;exports.parseSseLine=re;exports.readOutputFilePayload=R;exports.readRecordsetPayload=Y;exports.recordsetParser=Q;exports.resolveAttachDownloadUrl=se;exports.resolveAttachPreviewUrl=Ae;exports.resolveRemoteFileUrl=ie;exports.setHistoryGroupTitle=Ie;
3
3
  //# sourceMappingURL=index.cjs.map
@@ -13,6 +13,7 @@
13
13
  * - `./answerCom/knowledgeStream`:知识流(applyKnowledgeStreamChunk / createEmptyAnswerValues / types)
14
14
  * - `./answerCom/iframePage`:iframe 页面(applyIframePageChunk / 注入 child 脚本 / types)
15
15
  * - `./answerCom/recordset`:记录集表格(applyRecordsetChunk / normalizeRecordsetReport / types)
16
+ * - `./answerCom/outputFile`:输出文件(applyOutputFileChunk / normalizeOutputFileReport / types)
16
17
  * - `./deepThinking`:思考(applyDeepThinkingChunk / collectDeepThinkingSteps / types)
17
18
  * - `./history`:历史分组与会话的业务逻辑(依赖 wi-chat-request)
18
19
  *
@@ -36,6 +37,8 @@ export { IFRAME_RESIZER_CHILD_SCRIPT, injectIframeResizerScript, applyIframePage
36
37
  export type { IframePageValue } from './answerCom/iframePage/types';
37
38
  export { RECORDSET_ANSWER_TYPE, readRecordsetPayload, applyRecordsetChunk, normalizeRecordsetReport, recordsetParser } from './answerCom/recordset/parseRecordset';
38
39
  export type { RecordsetColumn, RecordsetValue } from './answerCom/recordset/types';
40
+ export { OUTPUT_FILE_ANSWER_TYPE, readOutputFilePayload, applyOutputFileChunk, normalizeOutputFileReport, outputFileParser } from './answerCom/outputFile/parseOutputFile';
41
+ export type { OutputFileValue } from './answerCom/outputFile/types';
39
42
  export { applyDeepThinkingChunk, collectDeepThinkingSteps, collectThinkingSteps, deepThinkingParser } from './deepThinking/parseDeepThinking';
40
43
  export type { ExecProcessItem } from './deepThinking/types';
41
44
  export { extractAttachmentsFromHistory, getHistoryGroups, createHistoryGroup, deleteHistoryGroup, setHistoryGroupTitle, loadGroupMessages, loadGroupMessagesByStep } from './history';