ai-helper-agent 2.8.9 → 2.8.11

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.
@@ -1,4 +1,4 @@
1
- import{a as e,c as t,l as n}from"./i18n-DvmxOw8q.js";import{C as r,S as i,Y as a,b as o,h as s}from"./version-DUmOB_mV.js";import{AlignmentType as c,BorderStyle as l,Document as u,ExternalHyperlink as d,HeadingLevel as f,ImageRun as p,LevelFormat as m,Packer as h,Paragraph as g,Table as ee,TableCell as te,TableRow as ne,TextRun as _,WidthType as v,convertInchesToTwip as y}from"./dist-BUuoW_84.js";var re=40,b=3e3,x=/^\s{0,3}(`{3,}|~{3,})/,S=/^\s{0,3}(#{1,6})[ \t]+(.*)$/,C=/^\s{0,3}=+\s*$/,w=/^\s{0,3}([-*_])(?:\s*\1){2,}\s*$/,T=/^\s*\|.*\|\s*$/,E=/^\s*(?:\d+(?:\.\d+)+[.、))]?\s*|\d+[.、))]\s*|[一二三四五六七八九十]+[、.]\s*|[((][一二三四五六七八九十\d]+[))]\s*)/,D=/[/\\:*?"<>|]/g,ie=/[\u0000-\u001f\u007f\u200b-\u200f\u2028\u2029\ufeff]/g,O=`
1
+ import{a as e,c as t,l as n}from"./i18n-DvmxOw8q.js";import{C as r,S as i,Y as a,b as o,h as s}from"./version-kRemUQxx.js";import{AlignmentType as c,BorderStyle as l,Document as u,ExternalHyperlink as d,HeadingLevel as f,ImageRun as p,LevelFormat as m,Packer as h,Paragraph as g,Table as ee,TableCell as te,TableRow as ne,TextRun as _,WidthType as v,convertInchesToTwip as y}from"./dist-BUuoW_84.js";var re=40,b=3e3,x=/^\s{0,3}(`{3,}|~{3,})/,S=/^\s{0,3}(#{1,6})[ \t]+(.*)$/,C=/^\s{0,3}=+\s*$/,w=/^\s{0,3}([-*_])(?:\s*\1){2,}\s*$/,T=/^\s*\|.*\|\s*$/,E=/^\s*(?:\d+(?:\.\d+)+[.、))]?\s*|\d+[.、))]\s*|[一二三四五六七八九十]+[、.]\s*|[((][一二三四五六七八九十\d]+[))]\s*)/,D=/[/\\:*?"<>|]/g,ie=/[\u0000-\u001f\u007f\u200b-\u200f\u2028\u2029\ufeff]/g,O=`
2
2
  `;function ae(e){return typeof e==`string`?e.replace(/\r\n?/g,O).replace(/\n{3,}/g,`
3
3
 
4
4
  `):``}function oe(e){return(e.length>b?e.slice(0,b):e).split(O).slice(0,re).join(O)}function se(e){return String(e).replace(/!\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/`+/g,``).replace(/(\*\*|__|\*|_|~~)/g,``).replace(/https?:\/\/\S+/gi,``).replace(/<[^>]+>/g,``)}function k(e){if(typeof e!=`string`||!e.trim())return``;let t=se(e);return t=t.replace(ie,``),t=t.replace(E,``),t=t.replace(D,`_`),t=t.replace(/\s+/g,`-`).replace(/-{2,}/g,`-`),t=t.replace(/^[-_.\s]+/,``).replace(/[-_.\s]+$/,``),t}function A(e,t=40){let n=Array.from(e);return(n.length>t?n.slice(0,t).join(``):e).replace(/[-_.,;:、,。;:\s]+$/u,``)}function ce(e){if(typeof e!=`string`||!e.trim())return``;let t=oe(e).split(O),n=[],r=``;for(let e=0;e<t.length;e++){let i=t[e],a=i.match(x);if(r){a&&a[1][0]===r&&(r=``);continue}if(a){r=a[1][0];continue}let o=i.match(S);if(o){let e=o[2].replace(/[ \t]+#+[ \t]*$/,``).trim();e&&n.push({level:o[1].length,text:e});continue}let s=t[e+1];s&&C.test(s)&&i.trim()&&!w.test(i)&&!T.test(i)&&(n.push({level:1,text:i.trim()}),e++)}return n.length===0?``:A(k((n.find(e=>e.level===1)||n[0]).text))}function le({title:e=``,kind:t,timestamp:n,ext:r}){let i=`${t}-${n}.${r}`,a=A(k(e));return a?`${a}-${i}`:i}function j(e,{kind:t,ext:n,timestamp:r=Date.now()}){return le({title:ce(e),kind:t,timestamp:r,ext:n})}e(`zh`,{chatExport:{exportFailed:`导出失败:{message}`,pdfLibNotLoaded:`PDF 库未加载,无法导出`,noContent:`没有可导出的内容`,imageLibNotLoaded:`图片库未加载,无法导出为图片`,imagePlaceholder:`[图片: {name}]`,canvasFailed:`Canvas 转 DataURL 失败:{message}`,svgLoadFailed:`SVG 图片加载失败`}}),e(`en`,{chatExport:{exportFailed:`Export failed: {message}`,pdfLibNotLoaded:`PDF library not loaded, cannot export`,noContent:`No content to export`,imageLibNotLoaded:`Image library not loaded, cannot export as image`,imagePlaceholder:`[Image: {name}]`,canvasFailed:`Canvas to DataURL failed: {message}`,svgLoadFailed:`SVG image loading failed`}});var M=new Map,N=/Mac|iPhone|iPad|iPod/i.test(typeof navigator<`u`?navigator.userAgent:``)?`Apple Color Emoji`:`Segoe UI Emoji`,P=RegExp(`(?:\\p{Regional_Indicator}{2})|(?:\\p{Emoji_Presentation}|\\p{Extended_Pictographic}\\uFE0F)(?:[\\u{1F3FB}-\\u{1F3FF}]|\\u200D(?:\\p{Emoji_Presentation}|\\p{Extended_Pictographic}\\uFE0F))*`,`gu`),F=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\uFFFE\uFFFF]/g,I=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;function L(e){return e==null||e===``?e:String(e).replace(F,``).replace(I,`�`)}var R=0;function z(){return R+=1,R}var B=new Set([`png`,`jpg`,`jpeg`,`gif`,`bmp`]);function V(e){return B.has(String(e||``).toLowerCase())}function H(e,t={}){if(!e)return[];let n=[];return String(e).split(/\r?\n/).forEach((e,r)=>{r>0&&n.push(new _({...t,break:1}));let i=0;for(let r of e.matchAll(P))r.index>i&&n.push(new _({...t,text:e.slice(i,r.index)})),n.push(new _({...t,text:r[0],font:{name:N}})),i=r.index+r[0].length;i<e.length&&n.push(new _({...t,text:e.slice(i)}))}),n}function U(e){if(!e)return[];let r=/(\*\*(.+?)\*\*|(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)|__(.+?)__|(?<!_)_(?!_)(.+?)(?<!_)_(?!_)|`([^`]+)`|\[([^\]]+)\]\(([^)]+)\)|!\[([^\]]*)\]\(([^)]+)\))/,i=[],a=e;for(;a.length>0;){let e=a.match(r);if(!e){i.push(...H(a));break}let o=e.index;o>0&&i.push(...H(a.slice(0,o)));let s=e[1];if(e[2]!==void 0)i.push(...H(e[2],{bold:!0}));else if(e[3]!==void 0)i.push(...H(e[3],{italics:!0}));else if(e[4]!==void 0)i.push(...H(e[4],{bold:!0}));else if(e[5]!==void 0)i.push(...H(e[5],{italics:!0}));else if(e[6]!==void 0)i.push(new _({text:e[6],font:`Consolas`,size:20}));else if(e[7]!==void 0)i.push(new d({children:[new _({text:e[7],style:`Hyperlink`})],link:e[8]}));else if(e[9]!==void 0){let r=e[10];if(r.startsWith(`data:`))try{let[n,a]=r.split(`,`),o=n.match(/data:(image\/(\w+))/);if(o&&a&&V(o[2])){let t=atob(a),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);let r=o[2],s=ue(n,r),c=s.width,l=s.height;if(c>567){let e=567/c;c=Math.round(c*e),l=Math.round(l*e)}i.push(new p({data:n,transformation:{width:c,height:l},type:r,altText:{id:z(),name:e[9]||`image`}}))}else i.push(new _({text:t(`chatExport.imagePlaceholder`,{name:e[9]||`image`}),italics:!0,color:`999999`}))}catch(r){n.warn(`[ChatExport] ImageRun create failed:`,r.message),i.push(new _({text:t(`chatExport.imagePlaceholder`,{name:e[9]||`image`}),italics:!0,color:`999999`}))}else i.push(new _({text:t(`chatExport.imagePlaceholder`,{name:e[9]||r}),italics:!0,color:`999999`}))}a=a.slice(o+s.length)}return i}function ue(e,t){if(t===`png`&&e.length>24){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{width:t.getUint32(16),height:t.getUint32(20)}}if((t===`jpeg`||t===`jpg`)&&e.length>100){let t=2;for(;t<e.length-9;)if(e[t]===255){let n=e[t+1];if(n>=192&&n<=195){let n=new DataView(e.buffer,e.byteOffset,e.byteLength);return{height:n.getUint16(t+5),width:n.getUint16(t+7)}}t+=2+(e[t+2]<<8|e[t+3])}else t++}return{width:600,height:400}}async function W(e){if(!e||!e.trim())return[new g({children:[new _({text:``})]})];let t=[],n=L(e),r=[];n=n.replace(/```(\w*)\n([\s\S]*?)```/g,(e,t,n)=>{let i=r.length;return r.push({lang:t||``,code:n.trimEnd()}),`\n\n%%CODEBLOCK_${i}%%\n\n`});let i=[];n=n.replace(/<table[\s\S]*?<\/table>/gi,e=>{let t=i.length;return i.push(e),`\n\n%%HTMLTABLE_${t}%%\n\n`});let a=[];n=n.replace(/(?:^\|.+\|\s*$\n)+^\|[\s\-:|]+\|\s*$\n(?:^\|.+\|\s*$\n?)+/gm,e=>{let t=a.length;return a.push(e),`\n\n%%MDTABLE_${t}%%\n\n`});let o=n.split(/\n{2,}/).filter(e=>e.trim());for(let e of o){let n=e.trim(),o=n.match(/^%%CODEBLOCK_(\d+)%%$/);if(o){let{lang:e,code:n}=r[parseInt(o[1])],i=e?`${e} code`:`code`;t.push(new g({children:[new _({text:i,bold:!0,font:`Consolas`,size:18})]}));let a=n.split(`