11 lines
329 KiB
JavaScript
11 lines
329 KiB
JavaScript
|
|
import{u as WA,g as Oo,i as Ro,s as Re,a as Vo}from"./conversation-C4tqOoff.js";import{a as ln,u as Yt,b as No,v as Go,c as Po}from"./agent-WRYR5BAs.js";import{v as cn,r as M,x as N,d as CA,i as z,b as w,c as y,y as eA,f as l,t as E,e as G,F as aA,z as dA,A as Me,n as iA,p as EA,w as D,h as P,m as pA,u as nA,o as zt,g as x,B as Qe,E as q,T as $o,C as Xo,D as JA,G as Jo,H as Er,I as Wo,J as ot,s as Yo,a as Bn,K as Ir,L as zo,M as Zo,N as qo,O as jo,l as mn,P as Ai}from"./index-B1u3nieA.js";import{a as te}from"./index-ChNUjLLo.js";import{u as ei,A as ti}from"./AiAssistantPanel-31-Ys6Rc.js";async function si(t){const A={};return await te.get("/quick-replies",{params:A})}async function ni(t){return await te.post("/quick-replies",t)}async function ri(t,A){return await te.put(`/quick-replies/${t}`,A)}async function oi(t){await te.delete(`/quick-replies/${t}`)}const ii=cn("quickReply",()=>{const t=M([]),A=M(!1),e=N(()=>{const B={};for(const c of t.value)B[c.category]||(B[c.category]=[]),B[c.category].push(c);return B}),s=N(()=>Object.keys(e.value));async function n(){try{A.value=!0;const B=await si();t.value=B.items}catch(B){console.error("获取快速回复模板失败:",B)}finally{A.value=!1}}async function r(B){try{const c=await ni(B);return await n(),c}catch(c){return console.error("创建快速回复模板失败:",c),null}}async function o(B,c){try{const u=await ri(B,c);return await n(),u}catch(u){return console.error("更新快速回复模板失败:",u),null}}async function i(B){try{await oi(B),await n()}catch(c){console.error("删除快速回复模板失败:",c)}}function a(B,c){let u=B;for(const[Q,d]of Object.entries(c))u=u.replaceAll(`{${Q}}`,d);return u}return{templates:t,loading:A,templatesByCategory:e,categories:s,fetchTemplates:n,addTemplate:r,editTemplate:o,removeTemplate:i,replaceVariables:a}}),Hr="it_desk_theme";function kt(t){document.documentElement.setAttribute("data-theme",t),localStorage.setItem(Hr,t)}function Ms(){const t=localStorage.getItem(Hr);return t==="dark"||t==="light"?t:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ai(){const t=Ms();return kt(t),{applyTheme:kt,getInitialTheme:Ms}}const br=cn("theme",()=>{const t=M("light");function A(){const s=t.value==="light"?"dark":"light";t.value=s,kt(s)}function e(){const s=Ms();t.value=s,kt(s)}return{currentTheme:t,toggleTheme:A,initTheme:e}});async function li(t){return await te.get("/todo-items",{params:t})}async function ci(t,A){return await te.put(`/todo-items/${t}/status`,{status:A})}const un=cn("todo",()=>{const t=M([]),A=M(null),e=M(!1),s=N(()=>t.value.filter(B=>B.priority==="urgent").length),n=N(()=>t.value.filter(B=>B.priority==="high").length),r=N(()=>t.value.filter(B=>B.status==="pending"||B.status==="processing"));async function o(){try{e.value=!0;const B=await li();t.value=B.items}catch(B){console.error("获取待办列表失败:",B)}finally{e.value=!1}}function i(B){A.value=B}async function a(B,c){try{await ci(B,c),await o()}catch(u){console.error("更新待办状态失败:",u)}}return{todoList:t,currentTodoItem:A,loading:e,urgentCount:s,highCount:n,pendingTodos:r,fetchTodoList:o,selectTodoItem:i,updateTodoItemStatus:a}}),Bi={class:"conv-avatar-wrap"},ui=["src"],di=["title"],gi={class:"conversation-info"},fi={class:"conversation-name"},wi={key:0,title:"已置顶"},hi={key:1,title:"代办"},Qi={class:"text-ellipsis"},Ci={key:2,class:"tag-badge tag-badge-vip"},pi={key:3,class:"tag-badge tag-badge-hand-raise"},mi={key:4,class:"tag-badge tag-badge-need-intervene"},Ui={key:6,class:"tag-badge tag-badge-agent"},Fi={class:"priority-icons"},vi=["title"],yi={class:"conversation-summary-row"},Ei={class:"conversation-summary"},Ii={class:"conversation-time"},Hi={class:"conversation-meta"},bi={class:"urgency-stars"},xi=["title"],Li=CA({__name:"ConversationItem",props:{conversation:{},active:{type:Boolean},showGrab:{type:Boolean,default:!1},showLeave:{type:Boolean,default:!1},section:{default:"my"}},emits:["click","grab","leave"],setup(t){const A=[{key:"is_blocking",icon:"⛔",cssClass:"pi-blocked",bg:"v
|
||
|
|
* html2canvas-pro 2.0.4 <https://yorickshan.github.io/html2canvas-pro/>
|
||
|
|
* Copyright (c) 2024-present yorickshan and html2canvas-pro contributors
|
||
|
|
* Released under MIT License
|
||
|
|
*/class xA{constructor(A,e,s,n){this.left=A,this.top=e,this.width=s,this.height=n}add(A,e,s,n){return new xA(this.left+A,this.top+e,this.width+s,this.height+n)}static fromClientRect(A,e){return new xA(e.left+A.windowBounds.left,e.top+A.windowBounds.top,e.width,e.height)}static fromDOMRectList(A,e){const s=Array.from(e);let n=s.find(r=>r.width!==0);return n||(n=s.find(r=>r.height!==0)),!n&&s.length>0&&(n=s[0]),n?new xA(n.left+A.windowBounds.left,n.top+A.windowBounds.top,n.width,n.height):xA.EMPTY}}xA.EMPTY=new xA(0,0,0,0);const Zt=(t,A)=>xA.fromClientRect(t,A.getBoundingClientRect()),ka=t=>{const A=t.body,e=t.documentElement;if(!A||!e)throw new Error("Unable to get document size");const s=Math.max(Math.max(A.scrollWidth,e.scrollWidth),Math.max(A.offsetWidth,e.offsetWidth),Math.max(A.clientWidth,e.clientWidth)),n=Math.max(Math.max(A.scrollHeight,e.scrollHeight),Math.max(A.offsetHeight,e.offsetHeight),Math.max(A.clientHeight,e.clientHeight));return new xA(0,0,s,n)};var qt=function(t){for(var A=[],e=0,s=t.length;e<s;){var n=t.charCodeAt(e++);if(n>=55296&&n<=56319&&e<s){var r=t.charCodeAt(e++);(r&64512)===56320?A.push(((n&1023)<<10)+(r&1023)+65536):(A.push(n),e--)}else A.push(n)}return A},UA=function(){for(var t=[],A=0;A<arguments.length;A++)t[A]=arguments[A];if(String.fromCodePoint)return String.fromCodePoint.apply(String,t);var e=t.length;if(!e)return"";for(var s=[],n=-1,r="";++n<e;){var o=t[n];o<=65535?s.push(o):(o-=65536,s.push((o>>10)+55296,o%1024+56320)),(n+1===e||s.length>16384)&&(r+=String.fromCharCode.apply(String,s),s.length=0)}return r},Un="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Oa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var gt=0;gt<Un.length;gt++)Oa[Un.charCodeAt(gt)]=gt;var Fn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Je=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var ft=0;ft<Fn.length;ft++)Je[Fn.charCodeAt(ft)]=ft;var Ra=function(t){var A=t.length*.75,e=t.length,s,n=0,r,o,i,a;t[t.length-1]==="="&&(A--,t[t.length-2]==="="&&A--);var B=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(A):new Array(A),c=Array.isArray(B)?B:new Uint8Array(B);for(s=0;s<e;s+=4)r=Je[t.charCodeAt(s)],o=Je[t.charCodeAt(s+1)],i=Je[t.charCodeAt(s+2)],a=Je[t.charCodeAt(s+3)],c[n++]=r<<2|o>>4,c[n++]=(o&15)<<4|i>>2,c[n++]=(i&3)<<6|a&63;return B},Va=function(t){for(var A=t.length,e=[],s=0;s<A;s+=2)e.push(t[s+1]<<8|t[s]);return e},Na=function(t){for(var A=t.length,e=[],s=0;s<A;s+=4)e.push(t[s+3]<<24|t[s+2]<<16|t[s+1]<<8|t[s]);return e},Ce=5,dn=11,ds=2,Ga=dn-Ce,xr=65536>>Ce,Pa=1<<Ce,gs=Pa-1,$a=1024>>Ce,Xa=xr+$a,Ja=Xa,Wa=32,Ya=Ja+Wa,za=65536>>dn,Za=1<<Ga,qa=Za-1,vn=function(t,A,e){return t.slice?t.slice(A,e):new Uint16Array(Array.prototype.slice.call(t,A,e))},ja=function(t,A,e){return t.slice?t.slice(A,e):new Uint32Array(Array.prototype.slice.call(t,A,e))},Al=function(t,A){var e=Ra(t),s=Array.isArray(e)?Na(e):new Uint32Array(e),n=Array.isArray(e)?Va(e):new Uint16Array(e),r=24,o=vn(n,r/2,s[4]/2),i=s[5]===2?vn(n,(r+s[4])/2):ja(s,Math.ceil((r+s[4])/4));return new el(s[0],s[1],s[2],s[3],o,i)},el=function(){function t(A,e,s,n,r,o){this.initialValue=A,this.errorValue=e,this.highStart=s,this.highValueIndex=n,this.index=r,this.data=o}return t.prototype.get=function(A){var e;if(A>=0){if(A<55296||A>56319&&A<=65535)return e=this.index[A>>Ce],e=(e<<ds)+(A&gs),this.data[e];if(A<=65535)return e=this.index[xr+(A-55296>>Ce)],e=(e<<ds)+(A&gs),this.data[e];if(A<this.highStart)return e=Ya-za+(A>>dn),e=this.index[e],e+=A>>Ce&qa,e=this.index[e],e=(e<<ds)+(A&gs),this.data[e];if(A<=1114111)return this.data[this.highValueIndex]}return this.errorValue},t}(),yn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tl=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var wt=0;wt<yn.length;wt++)tl[yn.charCodeAt(wt)]=wt;var sl="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4B
|
||
|
|
content: "" !important;
|
||
|
|
display: none !important;
|
||
|
|
}`,Mg=(t,A)=>{kg(t,`.${rn}${Kg}${pr}
|
||
|
|
.${on}${Dg}${pr}`,A)},kg=(t,A,e)=>{const s=t.ownerDocument;if(s){const n=s.createElement("style");n.textContent=A,e&&(n.nonce=e),t.appendChild(n)}},Og=(t,A)=>{const e=t.ownerDocument.createElement("base");e.href=A;const s=t.getElementsByTagName("head").item(0);s==null||s.insertBefore(e,(s==null?void 0:s.firstChild)??null)};class V{constructor(A,e){this.type=0,this.x=A,this.y=e}add(A,e){return new V(this.x+A,this.y+e)}}const He=(t,A,e)=>new V(t.x+(A.x-t.x)*e,t.y+(A.y-t.y)*e);class ee{constructor(A,e,s,n){this.type=1,this.start=A,this.startControl=e,this.endControl=s,this.end=n}subdivide(A,e){const s=He(this.start,this.startControl,A),n=He(this.startControl,this.endControl,A),r=He(this.endControl,this.end,A),o=He(s,n,A),i=He(n,r,A),a=He(o,i,A);return e?new ee(this.start,s,o,a):new ee(a,i,r,this.end)}add(A,e){return new ee(this.start.add(A,e),this.startControl.add(A,e),this.endControl.add(A,e),this.end.add(A,e))}reverse(){return new ee(this.end,this.endControl,this.startControl,this.start)}}const _A=t=>t.type===1;class Rg{constructor(A){const e=A.styles,s=A.bounds;let[n,r]=Ze(e.borderTopLeftRadius,s.width,s.height),[o,i]=Ze(e.borderTopRightRadius,s.width,s.height),[a,B]=Ze(e.borderBottomRightRadius,s.width,s.height),[c,u]=Ze(e.borderBottomLeftRadius,s.width,s.height);const Q=[];Q.push((n+o)/s.width),Q.push((c+a)/s.width),Q.push((r+u)/s.height),Q.push((i+B)/s.height);const d=Math.max(...Q);d>1&&(n/=d,r/=d,o/=d,i/=d,a/=d,B/=d,c/=d,u/=d);const h=s.width-o,f=s.height-B,g=s.width-a,F=s.height-u,p=e.borderTopWidth,C=e.borderRightWidth,m=e.borderBottomWidth,_=e.borderLeftWidth,L=j(e.paddingTop,A.bounds.width),H=j(e.paddingRight,A.bounds.width),R=j(e.paddingBottom,A.bounds.width),J=j(e.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||r>0?fA(s.left+_/3,s.top+p/3,n-_/3,r-p/3,lA.TOP_LEFT):new V(s.left+_/3,s.top+p/3),this.topRightBorderDoubleOuterBox=n>0||r>0?fA(s.left+h,s.top+p/3,o-C/3,i-p/3,lA.TOP_RIGHT):new V(s.left+s.width-C/3,s.top+p/3),this.bottomRightBorderDoubleOuterBox=a>0||B>0?fA(s.left+g,s.top+f,a-C/3,B-m/3,lA.BOTTOM_RIGHT):new V(s.left+s.width-C/3,s.top+s.height-m/3),this.bottomLeftBorderDoubleOuterBox=c>0||u>0?fA(s.left+_/3,s.top+F,c-_/3,u-m/3,lA.BOTTOM_LEFT):new V(s.left+_/3,s.top+s.height-m/3),this.topLeftBorderDoubleInnerBox=n>0||r>0?fA(s.left+_*2/3,s.top+p*2/3,n-_*2/3,r-p*2/3,lA.TOP_LEFT):new V(s.left+_*2/3,s.top+p*2/3),this.topRightBorderDoubleInnerBox=n>0||r>0?fA(s.left+h,s.top+p*2/3,o-C*2/3,i-p*2/3,lA.TOP_RIGHT):new V(s.left+s.width-C*2/3,s.top+p*2/3),this.bottomRightBorderDoubleInnerBox=a>0||B>0?fA(s.left+g,s.top+f,a-C*2/3,B-m*2/3,lA.BOTTOM_RIGHT):new V(s.left+s.width-C*2/3,s.top+s.height-m*2/3),this.bottomLeftBorderDoubleInnerBox=c>0||u>0?fA(s.left+_*2/3,s.top+F,c-_*2/3,u-m*2/3,lA.BOTTOM_LEFT):new V(s.left+_*2/3,s.top+s.height-m*2/3),this.topLeftBorderStroke=n>0||r>0?fA(s.left+_/2,s.top+p/2,n-_/2,r-p/2,lA.TOP_LEFT):new V(s.left+_/2,s.top+p/2),this.topRightBorderStroke=n>0||r>0?fA(s.left+h,s.top+p/2,o-C/2,i-p/2,lA.TOP_RIGHT):new V(s.left+s.width-C/2,s.top+p/2),this.bottomRightBorderStroke=a>0||B>0?fA(s.left+g,s.top+f,a-C/2,B-m/2,lA.BOTTOM_RIGHT):new V(s.left+s.width-C/2,s.top+s.height-m/2),this.bottomLeftBorderStroke=c>0||u>0?fA(s.left+_/2,s.top+F,c-_/2,u-m/2,lA.BOTTOM_LEFT):new V(s.left+_/2,s.top+s.height-m/2),this.topLeftBorderBox=n>0||r>0?fA(s.left,s.top,n,r,lA.TOP_LEFT):new V(s.left,s.top),this.topRightBorderBox=o>0||i>0?fA(s.left+h,s.top,o,i,lA.TOP_RIGHT):new V(s.left+s.width,s.top),this.bottomRightBorderBox=a>0||B>0?fA(s.left+g,s.top+f,a,B,lA.BOTTOM_RIGHT):new V(s.left+s.width,s.top+s.height),this.bottomLeftBorderBox=c>0||u>0?fA(s.left,s.top+F,c,u,lA.BOTTOM_LEFT):new V(s.left,s.top+s.height),this.topLeftPaddingBox=n>0||r>0?fA(s.left+_,s.top+p,Math.max(0,n-_),Math.max(0,r-p),lA.TOP_LEFT):new V(s.left+_,s.top+p),this.topRightPaddingBox=o>0||i>0?fA(s.left+Math.min(h,s.width-C),s.top+p,h>s.width+C?0:Math.max(0,o-C),Math.max(0,i-p),lA.TOP_RIGHT):new V(s.left+s.width-C,s.top+p),this.bottomRightPaddingBox=a>0||B>0?fA(s.left+Math.min(g,s.width-_),s.top+Math.min(f,s.height-m),Math.max(0,a-C)
|
||
|
|
📊 Performance Summary (Total: ${A.totalDuration.toFixed(2)}ms):`),A.breakdown.sort((e,s)=>s.duration-e.duration).forEach(e=>{this.context.logger.info(` ${e.name.padEnd(20)} ${e.duration.toFixed(2).padStart(8)}ms ${e.percentage.padStart(6)}`)})}clear(){this.activeMetrics.clear(),this.completedMetrics.splice(0)}isEnabled(){return this.enabled}getActiveMetrics(){return Array.from(this.activeMetrics.keys())}}const pn=(t,A={},e)=>{const s=e||ut.fromElement(t,{cspNonce:A.cspNonce,cache:A.cache});return Sf(t,A,s)},Lf=t=>{console.warn('[html2canvas-pro] setCspNonce is deprecated. Pass cspNonce in options instead: html2canvas(element, { cspNonce: "..." })'),typeof window<"u"&&If(new ut({window,cspNonce:t}))};pn.setCspNonce=Lf;const _f=t=>{["scale","width","height","imageTimeout","x","y","windowWidth","windowHeight","scrollX","scrollY"].forEach(e=>{const s=t[e];if(s!=null&&typeof s!="number"){const n=Number(s);Number.isNaN(n)||(t[e]=n)}})},Sf=async(t,A,e)=>{if(_f(A),!A.skipValidation){const b=A.validator||bf(),U=b.validateElement(t);if(!U.valid)throw new Error(U.error);const I=b.validateOptions(A);if(!I.valid)throw new Error(`Invalid options: ${I.error}`)}if(!t||typeof t!="object")throw new Error("Invalid element provided as first argument");const s=t.ownerDocument;if(!s)throw new Error("Element is not attached to a Document");const n=s.defaultView;if(!n)throw new Error("Document is not attached to a Window");const r={allowTaint:A.allowTaint??!1,imageTimeout:A.imageTimeout??15e3,proxy:A.proxy,useCORS:A.useCORS??!1,customIsSameOrigin:A.customIsSameOrigin},o={logging:A.logging??!0,cache:A.cache??e.cache,...r},i=800,a=600,B=0,c=n,u={windowWidth:A.windowWidth??c.innerWidth??i,windowHeight:A.windowHeight??c.innerHeight??a,scrollX:A.scrollX??c.pageXOffset??B,scrollY:A.scrollY??c.pageYOffset??B},Q=new xA(u.scrollX,u.scrollY,u.windowWidth,u.windowHeight),d=new Bs(o,Q,e),h=A.enablePerformanceMonitoring??A.logging??!1,f=new xf(d,h);f.start("total",{width:u.windowWidth,height:u.windowHeight});const g=A.foreignObjectRendering??!1,F={allowTaint:A.allowTaint??!1,onclone:A.onclone,ignoreElements:A.ignoreElements,iframeContainer:A.iframeContainer,inlineImages:g,copyStyles:g,cspNonce:A.cspNonce??e.cspNonce};d.logger.debug(`Starting document clone with size ${Q.width}x${Q.height} scrolled to ${-Q.left},${-Q.top}`),f.start("clone");const p=new Cr(d,t,F),C=p.clonedReferenceElement;if(!C)throw new Error("Unable to find element in cloned iframe");const m=await p.toIFrame(s,Q);f.end("clone");const{width:_,height:L,left:H,top:R}=Qn(C)||Ug(C)?ka(C.ownerDocument):Zt(d,C),J=Tf(d,C,A.backgroundColor),AA={canvas:A.canvas,backgroundColor:J,scale:A.scale??n.devicePixelRatio??1,x:(A.x??0)+H,y:(A.y??0)+R,width:A.width??Math.ceil(_),height:A.height??Math.ceil(L),imageSmoothing:A.imageSmoothing,imageSmoothingQuality:A.imageSmoothingQuality};let cA,$;try{return g?(d.logger.debug("Document cloned, using foreign object rendering"),f.start("render-foreignobject"),cA=await new hf(d,AA).render(C),f.end("render-foreignobject")):(d.logger.debug(`Document cloned, element located at ${H},${R} with size ${_}x${L} using computed rendering`),d.logger.debug("Starting DOM parsing"),f.start("parse"),$=Eo(d,C),f.end("parse"),J===$.styles.backgroundColor&&($.styles.backgroundColor=XA.TRANSPARENT),d.logger.debug(`Starting renderer for element at ${AA.x},${AA.y} with size ${AA.width}x${AA.height}`),f.start("render"),cA=await new Cn(d,AA).render($),f.end("render")),f.start("cleanup"),(A.removeContainer??!0)&&(Cr.destroy(m)||d.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),f.end("cleanup"),f.end("total"),d.logger.debug("Finished rendering"),h&&f.logSummary(),cA}finally{$&&$.restoreTree()}},Tf=(t,A,e)=>{const s=A.ownerDocument,n=s.documentElement?Te(t,getComputedStyle(s.documentElement).backgroundColor):XA.TRANSPARENT,r=s.body?Te(t,getComputedStyle(s.body).backgroundColor):XA.TRANSPARENT,o=typeof e=="string"?Te(t,e):e===null?XA.TRANSPARENT:4294967295;return A===s.documentElement?le(n)?le(r)?o:r:n:o},Kf={class:"search-area"},Df={key:0,class:"empty-hint"
|