@axiom-lattice/web 0.1.26 → 0.1.27
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/assets/{_baseUniq-DoJxRyD6.js → _baseUniq-D8AF7k46.js} +1 -1
- package/dist/assets/{architectureDiagram-VXUJARFQ-DC1wGJpu.js → architectureDiagram-VXUJARFQ-k2yzEaNE.js} +1 -1
- package/dist/assets/{blockDiagram-VD42YOAC-D9HR-QTD.js → blockDiagram-VD42YOAC-BWIn2k4t.js} +1 -1
- package/dist/assets/{c4Diagram-YG6GDRKO-9N3GW9y4.js → c4Diagram-YG6GDRKO-DfUFegEj.js} +1 -1
- package/dist/assets/channel-dRRwCmAZ.js +1 -0
- package/dist/assets/{chunk-4BX2VUAB-BZuUAWSd.js → chunk-4BX2VUAB-vwdOppU4.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-Dsnd62Ph.js → chunk-55IACEB6-DU-aYuy8.js} +1 -1
- package/dist/assets/{chunk-B4BG7PRW-DKz_1OF8.js → chunk-B4BG7PRW-B0ODPW1J.js} +1 -1
- package/dist/assets/{chunk-DI55MBZ5-wUqgjrCj.js → chunk-DI55MBZ5-ZM6eFDdu.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-B1Ne4K95.js → chunk-FMBD7UC4-D724kkNC.js} +1 -1
- package/dist/assets/{chunk-QN33PNHL-CAVe4Tv5.js → chunk-QN33PNHL-CZ75pSGa.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-DU9TCEzq.js → chunk-QZHKN3VN-BzLBJ1V0.js} +1 -1
- package/dist/assets/{chunk-TZMSLE5B-ChAr_dng.js → chunk-TZMSLE5B-Ck8T0rOh.js} +1 -1
- package/dist/assets/classDiagram-2ON5EDUG-C3w1GI_o.js +1 -0
- package/dist/assets/classDiagram-v2-WZHVMYZB-C3w1GI_o.js +1 -0
- package/dist/assets/clone-R45P-F80.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-CHL73KBA.js → cose-bilkent-S5V4N54A-CFbMqBgM.js} +1 -1
- package/dist/assets/{dagre-6UL2VRFP-BFh4kInU.js → dagre-6UL2VRFP-C-4lD_2h.js} +1 -1
- package/dist/assets/{diagram-PSM6KHXK-0yqlilPy.js → diagram-PSM6KHXK-Bj0tpv06.js} +1 -1
- package/dist/assets/{diagram-QEK2KX5R-Cpx-GfMP.js → diagram-QEK2KX5R-BOzzQPyz.js} +1 -1
- package/dist/assets/{diagram-S2PKOQOG-BkrHRfIA.js → diagram-S2PKOQOG-Byzz8kW8.js} +1 -1
- package/dist/assets/{erDiagram-Q2GNP2WA-9UtlesZ3.js → erDiagram-Q2GNP2WA-D5OYBVOE.js} +1 -1
- package/dist/assets/{flowDiagram-NV44I4VS-CW6csTDL.js → flowDiagram-NV44I4VS-Il65Z8oM.js} +1 -1
- package/dist/assets/{ganttDiagram-JELNMOA3-Dv1X21K5.js → ganttDiagram-JELNMOA3-D3PI2X9U.js} +1 -1
- package/dist/assets/{gitGraphDiagram-NY62KEGX-CbtSKlc4.js → gitGraphDiagram-NY62KEGX-Da4HD2jD.js} +1 -1
- package/dist/assets/{graph-qlOz0de_.js → graph-RqQOSaeG.js} +1 -1
- package/dist/assets/{index-BP01939L.js → index-BRSS6-tX.js} +12 -12
- package/dist/assets/{index.es-CX2xj_c7.js → index.es-CwT_wmDL.js} +1 -1
- package/dist/assets/{infoDiagram-WHAUD3N6-S1olwTif.js → infoDiagram-WHAUD3N6-Dxw7y4_K.js} +1 -1
- package/dist/assets/{journeyDiagram-XKPGCS4Q-D0-QDxtE.js → journeyDiagram-XKPGCS4Q-Cg7jkpem.js} +1 -1
- package/dist/assets/{kanban-definition-3W4ZIXB7-aNSHVzFL.js → kanban-definition-3W4ZIXB7-BuxgvsXS.js} +1 -1
- package/dist/assets/{layout-BiCprc9S.js → layout-DOYOrWF2.js} +1 -1
- package/dist/assets/{min-BTZUHSQ8.js → min-CK9EjUfT.js} +1 -1
- package/dist/assets/{mindmap-definition-VGOIOE7T-D-bnIFlF.js → mindmap-definition-VGOIOE7T-BO7gTipu.js} +1 -1
- package/dist/assets/{ordinal-Cb-T23CS.js → ordinal-D2ulBrhf.js} +1 -1
- package/dist/assets/{pieDiagram-ADFJNKIX-DWi23KHH.js → pieDiagram-ADFJNKIX-B-qSQ09J.js} +1 -1
- package/dist/assets/{quadrantDiagram-AYHSOK5B-uPtZeeG_.js → quadrantDiagram-AYHSOK5B-CvfAabcF.js} +1 -1
- package/dist/assets/{requirementDiagram-UZGBJVZJ-4xecvY7v.js → requirementDiagram-UZGBJVZJ-pGOLYhl9.js} +1 -1
- package/dist/assets/{sankeyDiagram-TZEHDZUN-aU8DgNl5.js → sankeyDiagram-TZEHDZUN-2kndlWR2.js} +1 -1
- package/dist/assets/{sequenceDiagram-WL72ISMW-G1wr7ABo.js → sequenceDiagram-WL72ISMW-BKxhtXwf.js} +1 -1
- package/dist/assets/{stateDiagram-FKZM4ZOC-BLS4o-64.js → stateDiagram-FKZM4ZOC-BIhFcMdb.js} +1 -1
- package/dist/assets/stateDiagram-v2-4FDKWEC3-CL6NeXsN.js +1 -0
- package/dist/assets/{timeline-definition-IT6M3QCI-BhUzvd84.js → timeline-definition-IT6M3QCI-lBLs5BSY.js} +1 -1
- package/dist/assets/{treemap-KMMF4GRG-BjwxW903.js → treemap-KMMF4GRG-DIh3qhWO.js} +1 -1
- package/dist/assets/{xychartDiagram-PRI3JC2R-CLIPXsGI.js → xychartDiagram-PRI3JC2R-D7RswEkD.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +2 -2
- package/dist/assets/channel-C8ovYQlR.js +0 -1
- package/dist/assets/classDiagram-2ON5EDUG-Bl00Hoqo.js +0 -1
- package/dist/assets/classDiagram-v2-WZHVMYZB-Bl00Hoqo.js +0 -1
- package/dist/assets/clone-B-0CLl8i.js +0 -1
- package/dist/assets/stateDiagram-v2-4FDKWEC3-CAaXzgOB.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-6UL2VRFP-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-6UL2VRFP-C-4lD_2h.js","assets/graph-RqQOSaeG.js","assets/_baseUniq-D8AF7k46.js","assets/layout-DOYOrWF2.js","assets/min-CK9EjUfT.js","assets/clone-R45P-F80.js","assets/cose-bilkent-S5V4N54A-CFbMqBgM.js","assets/cytoscape.esm-BQaXIfA_.js","assets/c4Diagram-YG6GDRKO-DfUFegEj.js","assets/chunk-TZMSLE5B-Ck8T0rOh.js","assets/flowDiagram-NV44I4VS-Il65Z8oM.js","assets/chunk-FMBD7UC4-D724kkNC.js","assets/chunk-55IACEB6-DU-aYuy8.js","assets/chunk-QN33PNHL-CZ75pSGa.js","assets/channel-dRRwCmAZ.js","assets/erDiagram-Q2GNP2WA-D5OYBVOE.js","assets/gitGraphDiagram-NY62KEGX-Da4HD2jD.js","assets/chunk-4BX2VUAB-vwdOppU4.js","assets/chunk-QZHKN3VN-BzLBJ1V0.js","assets/treemap-KMMF4GRG-DIh3qhWO.js","assets/infoDiagram-WHAUD3N6-Dxw7y4_K.js","assets/pieDiagram-ADFJNKIX-B-qSQ09J.js","assets/ordinal-D2ulBrhf.js","assets/xychartDiagram-PRI3JC2R-D7RswEkD.js","assets/requirementDiagram-UZGBJVZJ-pGOLYhl9.js","assets/sequenceDiagram-WL72ISMW-BKxhtXwf.js","assets/classDiagram-2ON5EDUG-C3w1GI_o.js","assets/chunk-B4BG7PRW-B0ODPW1J.js","assets/classDiagram-v2-WZHVMYZB-C3w1GI_o.js","assets/stateDiagram-FKZM4ZOC-BIhFcMdb.js","assets/chunk-DI55MBZ5-ZM6eFDdu.js","assets/stateDiagram-v2-4FDKWEC3-CL6NeXsN.js","assets/journeyDiagram-XKPGCS4Q-Cg7jkpem.js","assets/mindmap-definition-VGOIOE7T-BO7gTipu.js","assets/kanban-definition-3W4ZIXB7-BuxgvsXS.js","assets/sankeyDiagram-TZEHDZUN-2kndlWR2.js","assets/diagram-S2PKOQOG-Byzz8kW8.js","assets/diagram-QEK2KX5R-BOzzQPyz.js","assets/blockDiagram-VD42YOAC-BWIn2k4t.js","assets/architectureDiagram-VXUJARFQ-k2yzEaNE.js","assets/diagram-PSM6KHXK-Bj0tpv06.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var sAt=Object.defineProperty;var cAt=(e,t,n)=>t in e?sAt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var kn=(e,t,n)=>cAt(e,typeof t!="symbol"?t+"":t,n);function TGe(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(r,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var pT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var GF={exports:{}},H_={},VF={exports:{}},li={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.min.js
|
|
@@ -1201,8 +1201,8 @@ Please report this to https://github.com/markedjs/marked.`,t){let a="<p>An error
|
|
|
1201
1201
|
node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const r=e.x,a=e.y,i=Math.abs(r-n.x),o=e.width/2;let l=n.x<t.x?o-i:o+i;const s=e.height/2,c=Math.abs(t.y-n.y),u=Math.abs(t.x-n.x);if(Math.abs(a-t.y)*o>Math.abs(r-t.x)*s){let d=n.y<t.y?t.y-s-a:a-s-t.y;l=u*d/c;const f={x:n.x<t.x?n.x+l:n.x-u+l,y:n.y<t.y?n.y+c-d:n.y-c+d};return l===0&&(f.x=t.x,f.y=t.y),u===0&&(f.x=t.x),c===0&&(f.y=t.y),cn.debug(`abc89 top/bottom calc, Q ${c}, q ${d}, R ${u}, r ${l}`,f),f}else{n.x<t.x?l=t.x-o-r:l=r-o-t.x;let d=c*l/u,f=n.x<t.x?n.x+u-l:n.x-u+l,p=n.y<t.y?n.y+d:n.y-d;return cn.debug(`sides calc abc89, Q ${c}, q ${d}, R ${u}, r ${l}`,{_x:f,_y:p}),l===0&&(f=t.x,p=t.y),u===0&&(f=t.x),c===0&&(p=t.y),{x:f,y:p}}},"intersection"),RCe=Ae((e,t)=>{cn.warn("abc88 cutPathAtIntersect",e,t);let n=[],r=e[0],a=!1;return e.forEach(i=>{if(cn.info("abc88 checking point",i,t),!K2n(t,i)&&!a){const o=X2n(t,r,i);cn.debug("abc88 inside",i,r,o),cn.debug("abc88 intersection",o,t);let l=!1;n.forEach(s=>{l=l||s.x===o.x&&s.y===o.y}),n.some(s=>s.x===o.x&&s.y===o.y)?cn.warn("abc88 no intersect",o,n):n.push(o),a=!0}else cn.warn("abc88 outside",i,r),r=i,a||n.push(i)}),cn.debug("returning points",n),n},"cutPathAtIntersect");function Pit(e){const t=[],n=[];for(let r=1;r<e.length-1;r++){const a=e[r-1],i=e[r],o=e[r+1];(a.x===i.x&&i.y===o.y&&Math.abs(i.x-o.x)>5&&Math.abs(i.y-a.y)>5||a.y===i.y&&i.x===o.x&&Math.abs(i.x-a.x)>5&&Math.abs(i.y-o.y)>5)&&(t.push(i),n.push(r))}return{cornerPoints:t,cornerPointPositions:n}}Ae(Pit,"extractCornerPoints");var NCe=Ae(function(e,t,n){const r=t.x-e.x,a=t.y-e.y,i=Math.sqrt(r*r+a*a),o=n/i;return{x:t.x-o*r,y:t.y-o*a}},"findAdjacentPoint"),Z2n=Ae(function(e){const{cornerPointPositions:t}=Pit(e),n=[];for(let r=0;r<e.length;r++)if(t.includes(r)){const a=e[r-1],i=e[r+1],o=e[r],l=NCe(a,o,5),s=NCe(i,o,5),c=s.x-l.x,u=s.y-l.y;n.push(l);const d=Math.sqrt(2)*2;let f={x:o.x,y:o.y};if(Math.abs(i.x-a.x)>10&&Math.abs(i.y-a.y)>=10){cn.debug("Corner point fixing",Math.abs(i.x-a.x),Math.abs(i.y-a.y));const p=5;o.x===l.x?f={x:c<0?l.x-p+d:l.x+p-d,y:u<0?l.y-d:l.y+d}:f={x:c<0?l.x-d:l.x+d,y:u<0?l.y-p+d:l.y+p-d}}else cn.debug("Corner point skipping fixing",Math.abs(i.x-a.x),Math.abs(i.y-a.y));n.push(f,s)}else n.push(e[r]);return n},"fixCorners"),J2n=Ae((e,t,n)=>{const r=e-t-n,a=2,i=2,o=a+i,l=Math.floor(r/o),s=Array(l).fill(`${a} ${i}`).join(" ");return`0 ${t} ${s} ${n}`},"generateDashArray"),egn=Ae(function(e,t,n,r,a,i,o,l=!1){var M;const{handDrawnSeed:s}=so();let c=t.points,u=!1;const d=a;var f=i;const p=[];for(const B in t.cssCompiledStyles)urt(B)||p.push(t.cssCompiledStyles[B]);cn.debug("UIO intersect check",t.points,f.x,d.x),f.intersect&&d.intersect&&!l&&(c=c.slice(1,t.points.length-1),c.unshift(d.intersect(c[0])),cn.debug("Last point UIO",t.start,"-->",t.end,c[c.length-1],f,f.intersect(c[c.length-1])),c.push(f.intersect(c[c.length-1])));const h=btoa(JSON.stringify(c));t.toCluster&&(cn.info("to cluster abc88",n.get(t.toCluster)),c=RCe(t.points,n.get(t.toCluster).node),u=!0),t.fromCluster&&(cn.debug("from cluster abc88",n.get(t.fromCluster),JSON.stringify(c,null,2)),c=RCe(c.reverse(),n.get(t.fromCluster).node).reverse(),u=!0);let g=c.filter(B=>!Number.isNaN(B.y));g=Z2n(g);let m=uO;switch(m=$x,t.curve){case"linear":m=$x;break;case"basis":m=uO;break;case"cardinal":m=ftt;break;case"bumpX":m=ltt;break;case"bumpY":m=stt;break;case"catmullRom":m=htt;break;case"monotoneX":m=btt;break;case"monotoneY":m=_tt;break;case"natural":m=xtt;break;case"step":m=Ett;break;case"stepAfter":m=Ctt;break;case"stepBefore":m=wtt;break;default:m=uO}const{x:A,y:v}=ldn(t),y=itt().x(A).y(v).curve(m);let _;switch(t.thickness){case"normal":_="edge-thickness-normal";break;case"thick":_="edge-thickness-thick";break;case"invisible":_="edge-thickness-invisible";break;default:_="edge-thickness-normal"}switch(t.pattern){case"solid":_+=" edge-pattern-solid";break;case"dotted":_+=" edge-pattern-dotted";break;case"dashed":_+=" edge-pattern-dashed";break;default:_+=" edge-pattern-solid"}let x,S=t.curve==="rounded"?$it(Fit(g,t),5):y(g);const E=Array.isArray(t.style)?t.style:[t.style];let w=E.find(B=>B==null?void 0:B.startsWith("stroke:")),I=!1;if(t.look==="handDrawn"){const B=vr.svg(e);Object.assign([],g);const D=B.path(S,{roughness:.3,seed:s});_+=" transition",x=ba(D).select("path").attr("id",t.id).attr("class"," "+_+(t.classes?" "+t.classes:"")).attr("style",E?E.reduce((P,U)=>P+";"+U,""):"");let $=x.attr("d");x.attr("d",$),e.node().appendChild(x.node())}else{const B=p.join(";"),D=E?E.reduce((H,q)=>H+q+";",""):"";let $="";t.animate&&($=" edge-animation-fast"),t.animation&&($=" edge-animation-"+t.animation);const P=(B?B+";"+D+";":D)+";"+(E?E.reduce((H,q)=>H+";"+q,""):"");x=e.append("path").attr("d",S).attr("id",t.id).attr("class"," "+_+(t.classes?" "+t.classes:"")+($??"")).attr("style",P),w=(M=P.match(/stroke:([^;]+)/))==null?void 0:M[1],I=t.animate===!0||!!t.animation||B.includes("animation");const U=x.node(),j=typeof U.getTotalLength=="function"?U.getTotalLength():0,G=Qwe[t.arrowTypeStart]||0,F=Qwe[t.arrowTypeEnd]||0;if(t.look==="neo"&&!I){const q=`stroke-dasharray: ${t.pattern==="dotted"||t.pattern==="dashed"?J2n(j,G,F):`0 ${G} ${j-G-F} ${F}`}; stroke-dashoffset: 0;`;x.attr("style",q+x.attr("style"))}}x.attr("data-edge",!0),x.attr("data-et","edge"),x.attr("data-id",t.id),x.attr("data-points",h),t.showPoints&&g.forEach(B=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",B.x).attr("cy",B.y)});let N="";(so().flowchart.arrowMarkerAbsolute||so().state.arrowMarkerAbsolute)&&(N=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,N=N.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),cn.info("arrowTypeStart",t.arrowTypeStart),cn.info("arrowTypeEnd",t.arrowTypeEnd),W2n(x,t,N,o,r,w);const R=Math.floor(c.length/2),L=c[R];Sh.isLabelCoordinateInPath(L,x.attr("d"))||(u=!0);let O={};return u&&(O.updatedPath=c),O.originalPath=t.points,O},"insertEdge");function $it(e,t){if(e.length<2)return"";let n="";const r=e.length,a=1e-5;for(let i=0;i<r;i++){const o=e[i],l=e[i-1],s=e[i+1];if(i===0)n+=`M${o.x},${o.y}`;else if(i===r-1)n+=`L${o.x},${o.y}`;else{const c=o.x-l.x,u=o.y-l.y,d=s.x-o.x,f=s.y-o.y,p=Math.hypot(c,u),h=Math.hypot(d,f);if(p<a||h<a){n+=`L${o.x},${o.y}`;continue}const g=c/p,m=u/p,A=d/h,v=f/h,y=g*A+m*v,_=Math.max(-1,Math.min(1,y)),x=Math.acos(_);if(x<a||Math.abs(Math.PI-x)<a){n+=`L${o.x},${o.y}`;continue}const S=Math.min(t/Math.sin(x/2),p/2,h/2),E=o.x-g*S,w=o.y-m*S,I=o.x+A*S,N=o.y+v*S;n+=`L${E},${w}`,n+=`Q${o.x},${o.y} ${I},${N}`}}return n}Ae($it,"generateRoundedPath");function rle(e,t){if(!e||!t)return{angle:0,deltaX:0,deltaY:0};const n=t.x-e.x,r=t.y-e.y;return{angle:Math.atan2(r,n),deltaX:n,deltaY:r}}Ae(rle,"calculateDeltaAndAngle");function Fit(e,t){const n=e.map(a=>({...a}));if(e.length>=2&&nu[t.arrowTypeStart]){const a=nu[t.arrowTypeStart],i=e[0],o=e[1],{angle:l}=rle(i,o),s=a*Math.cos(l),c=a*Math.sin(l);n[0].x=i.x+s,n[0].y=i.y+c}const r=e.length;if(r>=2&&nu[t.arrowTypeEnd]){const a=nu[t.arrowTypeEnd],i=e[r-1],o=e[r-2],{angle:l}=rle(o,i),s=a*Math.cos(l),c=a*Math.sin(l);n[r-1].x=i.x-s,n[r-1].y=i.y-c}return n}Ae(Fit,"applyMarkerOffsetsToPoints");var tgn=Ae((e,t,n,r)=>{t.forEach(a=>{Agn[a](e,n,r)})},"insertMarkers"),ngn=Ae((e,t,n)=>{cn.trace("Making markers for ",n),e.append("defs").append("marker").attr("id",n+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",n+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),rgn=Ae((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),agn=Ae((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),ign=Ae((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),ogn=Ae((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",n+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),lgn=Ae((e,t,n)=>{e.append("marker").attr("id",n+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),sgn=Ae((e,t,n)=>{e.append("marker").attr("id",n+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),cgn=Ae((e,t,n)=>{e.append("marker").attr("id",n+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),ugn=Ae((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),dgn=Ae((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",n+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),fgn=Ae((e,t,n)=>{const r=e.append("defs").append("marker").attr("id",n+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");r.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),r.append("path").attr("d","M9,0 L9,18");const a=e.append("defs").append("marker").attr("id",n+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");a.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),a.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),pgn=Ae((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",n+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),hgn=Ae((e,t,n)=>{const r=e.append("defs").append("marker").attr("id",n+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");r.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),r.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const a=e.append("defs").append("marker").attr("id",n+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");a.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),a.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),ggn=Ae((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
|
|
1202
1202
|
L20,10
|
|
1203
1203
|
M20,10
|
|
1204
|
-
L0,20`)},"requirement_arrow"),mgn=Ae((e,t,n)=>{const r=e.append("defs").append("marker").attr("id",n+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");r.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),r.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),r.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),Agn={extension:ngn,composition:rgn,aggregation:agn,dependency:ign,lollipop:ogn,point:lgn,circle:sgn,cross:cgn,barb:ugn,only_one:dgn,zero_or_one:fgn,one_or_more:pgn,zero_or_more:hgn,requirement_arrow:ggn,requirement_contains:mgn},vgn=tgn,ygn={common:V8,getConfig:du,insertCluster:T2n,insertEdge:egn,insertEdgeLabel:Q2n,insertMarkers:vgn,insertNode:Bit,interpolateToCurve:k1e,labelHelper:ia,log:cn,positionEdgeLabel:Y2n},Wx={},Uit=Ae(e=>{for(const t of e)Wx[t.name]=t},"registerLayoutLoaders"),bgn=Ae(()=>{Uit([{name:"dagre",loader:Ae(async()=>await Bi(()=>import("./dagre-6UL2VRFP-
|
|
1205
|
-
`);const r=Jcn(t),a=r.append("g");r.attr("viewBox","0 0 2412 512"),yet(r,100,512,!0),a.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),a.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),a.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),a.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),a.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),a.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),a.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),a.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${n}`)},"draw"),iot={draw:W0n},q0n=iot,Q0n={db:{},renderer:iot,parser:{parse:Ae(()=>{},"parse")}},Y0n=Q0n,oot="flowchart-elk",K0n=Ae((e,t={})=>{var n;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),X0n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-
|
|
1204
|
+
L0,20`)},"requirement_arrow"),mgn=Ae((e,t,n)=>{const r=e.append("defs").append("marker").attr("id",n+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");r.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),r.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),r.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),Agn={extension:ngn,composition:rgn,aggregation:agn,dependency:ign,lollipop:ogn,point:lgn,circle:sgn,cross:cgn,barb:ugn,only_one:dgn,zero_or_one:fgn,one_or_more:pgn,zero_or_more:hgn,requirement_arrow:ggn,requirement_contains:mgn},vgn=tgn,ygn={common:V8,getConfig:du,insertCluster:T2n,insertEdge:egn,insertEdgeLabel:Q2n,insertMarkers:vgn,insertNode:Bit,interpolateToCurve:k1e,labelHelper:ia,log:cn,positionEdgeLabel:Y2n},Wx={},Uit=Ae(e=>{for(const t of e)Wx[t.name]=t},"registerLayoutLoaders"),bgn=Ae(()=>{Uit([{name:"dagre",loader:Ae(async()=>await Bi(()=>import("./dagre-6UL2VRFP-C-4lD_2h.js"),__vite__mapDeps([0,1,2,3,4,5])),"loader")},{name:"cose-bilkent",loader:Ae(async()=>await Bi(()=>import("./cose-bilkent-S5V4N54A-CFbMqBgM.js"),__vite__mapDeps([6,7])),"loader")}])},"registerDefaultLayoutLoaders");bgn();var Bdr=Ae(async(e,t)=>{if(!(e.layoutAlgorithm in Wx))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const n=Wx[e.layoutAlgorithm];return(await n.loader()).render(e,t,ygn,{algorithm:n.algorithm})},"render"),Pdr=Ae((e="",{fallback:t="dagre"}={})=>{if(e in Wx)return e;if(t in Wx)return cn.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),_gn=Art(Object.keys,Object),Sgn=Object.prototype,xgn=Sgn.hasOwnProperty;function zit(e){if(!VB(e))return _gn(e);var t=[];for(var n in Object(e))xgn.call(e,n)&&n!="constructor"&&t.push(n);return t}var ale=d5(wg,"DataView"),ile=d5(wg,"Promise"),ole=d5(wg,"Set"),lle=d5(wg,"WeakMap"),OCe="[object Map]",Egn="[object Object]",MCe="[object Promise]",LCe="[object Set]",kCe="[object WeakMap]",DCe="[object DataView]",wgn=u5(ale),Cgn=u5(Gx),Tgn=u5(ile),Ign=u5(ole),Rgn=u5(lle),H2=c5;(ale&&H2(new ale(new ArrayBuffer(1)))!=DCe||Gx&&H2(new Gx)!=OCe||ile&&H2(ile.resolve())!=MCe||ole&&H2(new ole)!=LCe||lle&&H2(new lle)!=kCe)&&(H2=function(e){var t=c5(e),n=t==Egn?e.constructor:void 0,r=n?u5(n):"";if(r)switch(r){case wgn:return DCe;case Cgn:return OCe;case Tgn:return MCe;case Ign:return LCe;case Rgn:return kCe}return t});var Ngn="[object Map]",Ogn="[object Set]",Mgn=Object.prototype,Lgn=Mgn.hasOwnProperty;function BCe(e){if(e==null)return!0;if(Bw(e)&&(V0(e)||typeof e=="string"||typeof e.splice=="function"||WB(e)||M1e(e)||mL(e)))return!e.length;var t=H2(e);if(t==Ngn||t==Ogn)return!e.size;if(VB(e))return!zit(e).length;for(var n in e)if(Lgn.call(e,n))return!1;return!0}var Hit="c4",kgn=Ae(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),Dgn=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./c4Diagram-YG6GDRKO-DfUFegEj.js");return{diagram:t}},__vite__mapDeps([8,9]));return{id:Hit,diagram:e}},"loader"),Bgn={id:Hit,detector:kgn,loader:Dgn},Pgn=Bgn,jit="flowchart",$gn=Ae((e,t)=>{var n,r;return((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="dagre-wrapper"||((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),Fgn=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-Il65Z8oM.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:jit,diagram:e}},"loader"),Ugn={id:jit,detector:$gn,loader:Fgn},zgn=Ugn,Git="flowchart-v2",Hgn=Ae((e,t)=>{var n,r,a;return((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="dagre-d3"?!1:(((r=t==null?void 0:t.flowchart)==null?void 0:r.defaultRenderer)==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&((a=t==null?void 0:t.flowchart)==null?void 0:a.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),jgn=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-Il65Z8oM.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:Git,diagram:e}},"loader"),Ggn={id:Git,detector:Hgn,loader:jgn},Vgn=Ggn,Vit="er",Wgn=Ae(e=>/^\s*erDiagram/.test(e),"detector"),qgn=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./erDiagram-Q2GNP2WA-D5OYBVOE.js");return{diagram:t}},__vite__mapDeps([15,12,13,14]));return{id:Vit,diagram:e}},"loader"),Qgn={id:Vit,detector:Wgn,loader:qgn},Ygn=Qgn,Wit="gitGraph",Kgn=Ae(e=>/^\s*gitGraph/.test(e),"detector"),Xgn=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./gitGraphDiagram-NY62KEGX-Da4HD2jD.js");return{diagram:t}},__vite__mapDeps([16,17,18,19,4,2]));return{id:Wit,diagram:e}},"loader"),Zgn={id:Wit,detector:Kgn,loader:Xgn},Jgn=Zgn,qit="gantt",e0n=Ae(e=>/^\s*gantt/.test(e),"detector"),t0n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./ganttDiagram-JELNMOA3-D3PI2X9U.js");return{diagram:t}},[]);return{id:qit,diagram:e}},"loader"),n0n={id:qit,detector:e0n,loader:t0n},r0n=n0n,Qit="info",a0n=Ae(e=>/^\s*info/.test(e),"detector"),i0n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./infoDiagram-WHAUD3N6-Dxw7y4_K.js");return{diagram:t}},__vite__mapDeps([20,19,4,2]));return{id:Qit,diagram:e}},"loader"),o0n={id:Qit,detector:a0n,loader:i0n},Yit="pie",l0n=Ae(e=>/^\s*pie/.test(e),"detector"),s0n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./pieDiagram-ADFJNKIX-B-qSQ09J.js");return{diagram:t}},__vite__mapDeps([21,17,19,4,2,22]));return{id:Yit,diagram:e}},"loader"),c0n={id:Yit,detector:l0n,loader:s0n},Kit="quadrantChart",u0n=Ae(e=>/^\s*quadrantChart/.test(e),"detector"),d0n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./quadrantDiagram-AYHSOK5B-CvfAabcF.js");return{diagram:t}},[]);return{id:Kit,diagram:e}},"loader"),f0n={id:Kit,detector:u0n,loader:d0n},p0n=f0n,Xit="xychart",h0n=Ae(e=>/^\s*xychart(-beta)?/.test(e),"detector"),g0n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./xychartDiagram-PRI3JC2R-D7RswEkD.js");return{diagram:t}},__vite__mapDeps([23,22]));return{id:Xit,diagram:e}},"loader"),m0n={id:Xit,detector:h0n,loader:g0n},A0n=m0n,Zit="requirement",v0n=Ae(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),y0n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./requirementDiagram-UZGBJVZJ-pGOLYhl9.js");return{diagram:t}},__vite__mapDeps([24,12,13]));return{id:Zit,diagram:e}},"loader"),b0n={id:Zit,detector:v0n,loader:y0n},_0n=b0n,Jit="sequence",S0n=Ae(e=>/^\s*sequenceDiagram/.test(e),"detector"),x0n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./sequenceDiagram-WL72ISMW-BKxhtXwf.js");return{diagram:t}},__vite__mapDeps([25,9,18]));return{id:Jit,diagram:e}},"loader"),E0n={id:Jit,detector:S0n,loader:x0n},w0n=E0n,eot="class",C0n=Ae((e,t)=>{var n;return((n=t==null?void 0:t.class)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),T0n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./classDiagram-2ON5EDUG-C3w1GI_o.js");return{diagram:t}},__vite__mapDeps([26,27,11,12,13]));return{id:eot,diagram:e}},"loader"),I0n={id:eot,detector:C0n,loader:T0n},R0n=I0n,tot="classDiagram",N0n=Ae((e,t)=>{var n;return/^\s*classDiagram/.test(e)&&((n=t==null?void 0:t.class)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),O0n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./classDiagram-v2-WZHVMYZB-C3w1GI_o.js");return{diagram:t}},__vite__mapDeps([28,27,11,12,13]));return{id:tot,diagram:e}},"loader"),M0n={id:tot,detector:N0n,loader:O0n},L0n=M0n,not="state",k0n=Ae((e,t)=>{var n;return((n=t==null?void 0:t.state)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),D0n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./stateDiagram-FKZM4ZOC-BIhFcMdb.js");return{diagram:t}},__vite__mapDeps([29,30,12,13,1,2,3,4]));return{id:not,diagram:e}},"loader"),B0n={id:not,detector:k0n,loader:D0n},P0n=B0n,rot="stateDiagram",$0n=Ae((e,t)=>{var n;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((n=t==null?void 0:t.state)==null?void 0:n.defaultRenderer)==="dagre-wrapper")},"detector"),F0n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./stateDiagram-v2-4FDKWEC3-CL6NeXsN.js");return{diagram:t}},__vite__mapDeps([31,30,12,13]));return{id:rot,diagram:e}},"loader"),U0n={id:rot,detector:$0n,loader:F0n},z0n=U0n,aot="journey",H0n=Ae(e=>/^\s*journey/.test(e),"detector"),j0n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./journeyDiagram-XKPGCS4Q-Cg7jkpem.js");return{diagram:t}},__vite__mapDeps([32,9,11]));return{id:aot,diagram:e}},"loader"),G0n={id:aot,detector:H0n,loader:j0n},V0n=G0n,W0n=Ae((e,t,n)=>{cn.debug(`rendering svg for syntax error
|
|
1205
|
+
`);const r=Jcn(t),a=r.append("g");r.attr("viewBox","0 0 2412 512"),yet(r,100,512,!0),a.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),a.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),a.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),a.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),a.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),a.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),a.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),a.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${n}`)},"draw"),iot={draw:W0n},q0n=iot,Q0n={db:{},renderer:iot,parser:{parse:Ae(()=>{},"parse")}},Y0n=Q0n,oot="flowchart-elk",K0n=Ae((e,t={})=>{var n;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((n=t==null?void 0:t.flowchart)==null?void 0:n.defaultRenderer)==="elk"?(t.layout="elk",!0):!1},"detector"),X0n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-Il65Z8oM.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:oot,diagram:e}},"loader"),Z0n={id:oot,detector:K0n,loader:X0n},J0n=Z0n,lot="timeline",e1n=Ae(e=>/^\s*timeline/.test(e),"detector"),t1n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./timeline-definition-IT6M3QCI-lBLs5BSY.js");return{diagram:t}},[]);return{id:lot,diagram:e}},"loader"),n1n={id:lot,detector:e1n,loader:t1n},r1n=n1n,sot="mindmap",a1n=Ae(e=>/^\s*mindmap/.test(e),"detector"),i1n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./mindmap-definition-VGOIOE7T-BO7gTipu.js");return{diagram:t}},__vite__mapDeps([33,12,13]));return{id:sot,diagram:e}},"loader"),o1n={id:sot,detector:a1n,loader:i1n},l1n=o1n,cot="kanban",s1n=Ae(e=>/^\s*kanban/.test(e),"detector"),c1n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./kanban-definition-3W4ZIXB7-BuxgvsXS.js");return{diagram:t}},__vite__mapDeps([34,11]));return{id:cot,diagram:e}},"loader"),u1n={id:cot,detector:s1n,loader:c1n},d1n=u1n,uot="sankey",f1n=Ae(e=>/^\s*sankey(-beta)?/.test(e),"detector"),p1n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./sankeyDiagram-TZEHDZUN-2kndlWR2.js");return{diagram:t}},__vite__mapDeps([35,22]));return{id:uot,diagram:e}},"loader"),h1n={id:uot,detector:f1n,loader:p1n},g1n=h1n,dot="packet",m1n=Ae(e=>/^\s*packet(-beta)?/.test(e),"detector"),A1n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./diagram-S2PKOQOG-Byzz8kW8.js");return{diagram:t}},__vite__mapDeps([36,17,19,4,2]));return{id:dot,diagram:e}},"loader"),v1n={id:dot,detector:m1n,loader:A1n},fot="radar",y1n=Ae(e=>/^\s*radar-beta/.test(e),"detector"),b1n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./diagram-QEK2KX5R-BOzzQPyz.js");return{diagram:t}},__vite__mapDeps([37,17,19,4,2]));return{id:fot,diagram:e}},"loader"),_1n={id:fot,detector:y1n,loader:b1n},pot="block",S1n=Ae(e=>/^\s*block(-beta)?/.test(e),"detector"),x1n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./blockDiagram-VD42YOAC-BWIn2k4t.js");return{diagram:t}},__vite__mapDeps([38,11,5,1,2,14]));return{id:pot,diagram:e}},"loader"),E1n={id:pot,detector:S1n,loader:x1n},w1n=E1n,hot="architecture",C1n=Ae(e=>/^\s*architecture/.test(e),"detector"),T1n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./architectureDiagram-VXUJARFQ-k2yzEaNE.js");return{diagram:t}},__vite__mapDeps([39,17,19,4,2,7]));return{id:hot,diagram:e}},"loader"),I1n={id:hot,detector:C1n,loader:T1n},R1n=I1n,got="treemap",N1n=Ae(e=>/^\s*treemap/.test(e),"detector"),O1n=Ae(async()=>{const{diagram:e}=await Bi(async()=>{const{diagram:t}=await import("./diagram-PSM6KHXK-Bj0tpv06.js");return{diagram:t}},__vite__mapDeps([40,13,17,19,4,2,22]));return{id:got,diagram:e}},"loader"),M1n={id:got,detector:N1n,loader:O1n},PCe=!1,tP=Ae(()=>{PCe||(PCe=!0,QM("error",Y0n,e=>e.toLowerCase().trim()==="error"),QM("---",{db:{clear:Ae(()=>{},"clear")},styles:{},renderer:{draw:Ae(()=>{},"draw")},parser:{parse:Ae(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:Ae(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),poe(J0n,l1n,R1n),poe(Pgn,d1n,L0n,R0n,Ygn,r0n,o0n,c0n,_0n,w0n,Vgn,zgn,r1n,Jgn,z0n,P0n,V0n,p0n,g1n,v1n,A0n,w1n,_1n,M1n))},"addDiagrams"),L1n=Ae(async()=>{cn.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(D4).map(async([n,{detector:r,loader:a}])=>{if(a)try{Aoe(n)}catch{try{const{diagram:i,id:o}=await a();QM(o,i,r)}catch(i){throw cn.error(`Failed to load external diagram with key ${n}. Removing from detectors.`),delete D4[n],i}}}))).filter(n=>n.status==="rejected");if(t.length>0){cn.error(`Failed to load ${t.length} external diagrams`);for(const n of t)cn.error(n);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),k1n="graphics-document document";function mot(e,t){e.attr("role",k1n),t!==""&&e.attr("aria-roledescription",t)}Ae(mot,"setA11yDiagramInfo");function Aot(e,t,n,r){if(e.insert!==void 0){if(n){const a=`chart-desc-${r}`;e.attr("aria-describedby",a),e.insert("desc",":first-child").attr("id",a).text(n)}if(t){const a=`chart-title-${r}`;e.attr("aria-labelledby",a),e.insert("title",":first-child").attr("id",a).text(t)}}}Ae(Aot,"addSVGa11yTitleDescription");var v4,sle=(v4=class{constructor(t,n,r,a,i){this.type=t,this.text=n,this.db=r,this.parser=a,this.renderer=i}static async fromText(t,n={}){var c,u;const r=du(),a=X0e(t,r);t=Ypn(t)+`
|
|
1206
1206
|
`;try{Aoe(a)}catch{const d=_rn(a);if(!d)throw new oet(`Diagram ${a} not found.`);const{id:f,diagram:p}=await d();QM(f,p)}const{db:i,parser:o,renderer:l,init:s}=Aoe(a);return o.parser&&(o.parser.yy=i),(c=i.clear)==null||c.call(i),s==null||s(r),n.title&&((u=i.setDiagramTitle)==null||u.call(i,n.title)),await o.parse(t),new v4(a,t,i,o,l)}async render(t,n){await this.renderer.draw(this.text,t,n,this)}getParser(){return this.parser}getType(){return this.type}},Ae(v4,"Diagram"),v4),$Ce=[],D1n=Ae(()=>{$Ce.forEach(e=>{e()}),$Ce=[]},"attachFunctions"),B1n=Ae(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function vot(e){const t=e.match(iet);if(!t)return{text:e,metadata:{}};let n=odn(t[1],{schema:idn})??{};n=typeof n=="object"&&!Array.isArray(n)?n:{};const r={};return n.displayMode&&(r.displayMode=n.displayMode.toString()),n.title&&(r.title=n.title.toString()),n.config&&(r.config=n.config),{text:e.slice(t[0].length),metadata:r}}Ae(vot,"extractFrontMatter");var P1n=Ae(e=>e.replace(/\r\n?/g,`
|
|
1207
1207
|
`).replace(/<(\w+)([^>]*)>/g,(t,n,r)=>"<"+n+r.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),$1n=Ae(e=>{const{text:t,metadata:n}=vot(e),{displayMode:r,title:a,config:i={}}=n;return r&&(i.gantt||(i.gantt={}),i.gantt.displayMode=r),{title:a,config:i,text:t}},"processFrontmatter"),F1n=Ae(e=>{const t=Sh.detectInit(e)??{},n=Sh.detectDirective(e,"wrap");return Array.isArray(n)?t.wrap=n.some(({type:r})=>r==="wrap"):(n==null?void 0:n.type)==="wrap"&&(t.wrap=!0),{text:Bpn(e),directive:t}},"processDirectives");function eme(e){const t=P1n(e),n=$1n(t),r=F1n(n.text),a=F1e(n.config,r.directive);return e=B1n(r.text),{code:e,title:n.title,config:a}}Ae(eme,"preprocessDiagram");function yot(e){const t=new TextEncoder().encode(e),n=Array.from(t,r=>String.fromCodePoint(r)).join("");return btoa(n)}Ae(yot,"toBase64");var U1n=5e4,z1n="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",H1n="sandbox",j1n="loose",G1n="http://www.w3.org/2000/svg",V1n="http://www.w3.org/1999/xlink",W1n="http://www.w3.org/1999/xhtml",q1n="100%",Q1n="100%",Y1n="border:0;margin:0;",K1n="margin:0",X1n="allow-top-navigation-by-user-activation allow-popups",Z1n='The "iframe" tag is not supported by your browser.',J1n=["foreignobject"],emn=["dominant-baseline"];function tme(e){const t=eme(e);return WM(),Prn(t.config??{}),t}Ae(tme,"processAndSetConfigs");async function bot(e,t){tP();try{const{code:n,config:r}=tme(e);return{diagramType:(await Sot(n)).type,config:r}}catch(n){if(t!=null&&t.suppressErrors)return!1;throw n}}Ae(bot,"parse");var FCe=Ae((e,t,n=[])=>`
|
|
1208
1208
|
.${e} ${t} { ${n.join(" !important; ")} !important; }`,"cssImportantStyles"),tmn=Ae((e,t=new Map)=>{var r;let n="";if(e.themeCSS!==void 0&&(n+=`
|
|
@@ -1999,7 +1999,7 @@ endobj\r
|
|
|
1999
1999
|
* http://opensource.org/licenses/mit-license
|
|
2000
2000
|
*/function nh(e,t){if(this.pos=0,this.buffer=e,this.datav=new DataView(e.buffer),this.is_with_alpha=!!t,this.bottom_up=!0,this.flag=String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1]),this.pos+=2,["BM","BA","CI","CP","IC","PT"].indexOf(this.flag)===-1)throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}function Hze(e){function t(w){if(!w)throw Error("assert :P")}function n(w,I,N){for(var R=0;4>R;R++)if(w[I+R]!=N.charCodeAt(R))return!0;return!1}function r(w,I,N,R,L){for(var O=0;O<L;O++)w[I+O]=N[R+O]}function a(w,I,N,R){for(var L=0;L<R;L++)w[I+L]=N}function i(w){return new Int32Array(w)}function o(w,I){for(var N=[],R=0;R<w;R++)N.push(new I);return N}function l(w,I){var N=[];return(function R(L,O,M){for(var B=M[O],D=0;D<B&&(L.push(M.length>O+1?[]:new I),!(M.length<O+1));D++)R(L[D],O+1,M)})(N,0,w),N}var s=function(){var w=this;function I(W,ee){for(var ce=1<<ee-1>>>0;W&ce;)ce>>>=1;return ce?(W&ce-1)+ce:W}function N(W,ee,ce,ye,Ce){t(!(ye%ce));do W[ee+(ye-=ce)]=Ce;while(0<ye)}function R(W,ee,ce,ye,Ce){if(t(2328>=Ce),512>=Ce)var Oe=i(512);else if((Oe=i(Ce))==null)return 0;return(function(Le,De,Be,He,ct,It){var Rt,_t,an=De,Gt=1<<Be,pt=i(16),gt=i(16);for(t(ct!=0),t(He!=null),t(Le!=null),t(0<Be),_t=0;_t<ct;++_t){if(15<He[_t])return 0;++pt[He[_t]]}if(pt[0]==ct)return 0;for(gt[1]=0,Rt=1;15>Rt;++Rt){if(pt[Rt]>1<<Rt)return 0;gt[Rt+1]=gt[Rt]+pt[Rt]}for(_t=0;_t<ct;++_t)Rt=He[_t],0<He[_t]&&(It[gt[Rt]++]=_t);if(gt[15]==1)return(He=new L).g=0,He.value=It[0],N(Le,an,1,Gt,He),Gt;var Xt,Kt=-1,en=Gt-1,Jn=0,$n=1,Gr=1,zn=1<<Be;for(_t=0,Rt=1,ct=2;Rt<=Be;++Rt,ct<<=1){if($n+=Gr<<=1,0>(Gr-=pt[Rt]))return 0;for(;0<pt[Rt];--pt[Rt])(He=new L).g=Rt,He.value=It[_t++],N(Le,an+Jn,ct,zn,He),Jn=I(Jn,Rt)}for(Rt=Be+1,ct=2;15>=Rt;++Rt,ct<<=1){if($n+=Gr<<=1,0>(Gr-=pt[Rt]))return 0;for(;0<pt[Rt];--pt[Rt]){if(He=new L,(Jn&en)!=Kt){for(an+=zn,Xt=1<<(Kt=Rt)-Be;15>Kt&&!(0>=(Xt-=pt[Kt]));)++Kt,Xt<<=1;Gt+=zn=1<<(Xt=Kt-Be),Le[De+(Kt=Jn&en)].g=Xt+Be,Le[De+Kt].value=an-De-Kt}He.g=Rt-Be,He.value=It[_t++],N(Le,an+(Jn>>Be),ct,zn,He),Jn=I(Jn,Rt)}}return $n!=2*gt[15]-1?0:Gt})(W,ee,ce,ye,Ce,Oe)}function L(){this.value=this.g=0}function O(){this.value=this.g=0}function M(){this.G=o(5,L),this.H=i(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=o(el,O)}function B(W,ee,ce,ye){t(W!=null),t(ee!=null),t(2147483648>ye),W.Ca=254,W.I=0,W.b=-8,W.Ka=0,W.oa=ee,W.pa=ce,W.Jd=ee,W.Yc=ce+ye,W.Zc=4<=ye?ce+ye-4+1:ce,K(W)}function D(W,ee){for(var ce=0;0<ee--;)ce|=X(W,128)<<ee;return ce}function $(W,ee){var ce=D(W,ee);return Q(W)?-ce:ce}function P(W,ee,ce,ye){var Ce,Oe=0;for(t(W!=null),t(ee!=null),t(4294967288>ye),W.Sb=ye,W.Ra=0,W.u=0,W.h=0,4<ye&&(ye=4),Ce=0;Ce<ye;++Ce)Oe+=ee[ce+Ce]<<8*Ce;W.Ra=Oe,W.bb=ye,W.oa=ee,W.pa=ce}function U(W){for(;8<=W.u&&W.bb<W.Sb;)W.Ra>>>=8,W.Ra+=W.oa[W.pa+W.bb]<<R1-8>>>0,++W.bb,W.u-=8;q(W)&&(W.h=1,W.u=0)}function j(W,ee){if(t(0<=ee),!W.h&&ee<=I1){var ce=H(W)&T1[ee];return W.u+=ee,U(W),ce}return W.h=1,W.u=0}function G(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function F(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function H(W){return W.Ra>>>(W.u&R1-1)>>>0}function q(W){return t(W.bb<=W.Sb),W.h||W.bb==W.Sb&&W.u>R1}function V(W,ee){W.u=ee,W.h=q(W)}function Y(W){W.u>=N1&&(t(W.u>=N1),U(W))}function K(W){t(W!=null&&W.oa!=null),W.pa<W.Zc?(W.I=(W.oa[W.pa++]|W.I<<8)>>>0,W.b+=8):(t(W!=null&&W.oa!=null),W.pa<W.Yc?(W.b+=8,W.I=W.oa[W.pa++]|W.I<<8):W.Ka?W.b=0:(W.I<<=8,W.b+=8,W.Ka=1))}function Q(W){return D(W,1)}function X(W,ee){var ce=W.Ca;0>W.b&&K(W);var ye=W.b,Ce=ce*ee>>>8,Oe=(W.I>>>ye>Ce)+0;for(Oe?(ce-=Ce,W.I-=Ce+1<<ye>>>0):ce=Ce+1,ye=ce,Ce=0;256<=ye;)Ce+=8,ye>>=8;return ye=7^Ce+dc[ye],W.b-=ye,W.Ca=(ce<<ye)-1,Oe}function re(W,ee,ce){W[ee+0]=ce>>24&255,W[ee+1]=ce>>16&255,W[ee+2]=ce>>8&255,W[ee+3]=ce>>0&255}function te(W,ee){return W[ee+0]<<0|W[ee+1]<<8}function ne(W,ee){return te(W,ee)|W[ee+2]<<16}function oe(W,ee){return te(W,ee)|te(W,ee+2)<<16}function de(W,ee){var ce=1<<ee;return t(W!=null),t(0<ee),W.X=i(ce),W.X==null?0:(W.Mb=32-ee,W.Xa=ee,1)}function ue(W,ee){t(W!=null),t(ee!=null),t(W.Xa==ee.Xa),r(ee.X,0,W.X,0,1<<ee.Xa)}function ie(){this.X=[],this.Xa=this.Mb=0}function be(W,ee,ce,ye){t(ce!=null),t(ye!=null);var Ce=ce[0],Oe=ye[0];return Ce==0&&(Ce=(W*Oe+ee/2)/ee),Oe==0&&(Oe=(ee*Ce+W/2)/W),0>=Ce||0>=Oe?0:(ce[0]=Ce,ye[0]=Oe,1)}function fe(W,ee){return W+(1<<ee)-1>>>ee}function ve(W,ee){return((4278255360&W)+(4278255360&ee)>>>0&4278255360)+((16711935&W)+(16711935&ee)>>>0&16711935)>>>0}function ge(W,ee){w[ee]=function(ce,ye,Ce,Oe,Le,De,Be){var He;for(He=0;He<Le;++He){var ct=w[W](De[Be+He-1],Ce,Oe+He);De[Be+He]=ve(ce[ye+He],ct)}}}function pe(){this.ud=this.hd=this.jd=0}function me(W,ee){return((4278124286&(W^ee))>>>1)+(W&ee)>>>0}function Se(W){return 0<=W&&256>W?W:0>W?0:255<W?255:void 0}function xe(W,ee){return Se(W+(W-ee+.5>>1))}function Pe(W,ee,ce){return Math.abs(ee-ce)-Math.abs(W-ce)}function $e(W,ee,ce,ye,Ce,Oe,Le){for(ye=Oe[Le-1],ce=0;ce<Ce;++ce)Oe[Le+ce]=ye=ve(W[ee+ce],ye)}function rt(W,ee,ce,ye,Ce){var Oe;for(Oe=0;Oe<ce;++Oe){var Le=W[ee+Oe],De=Le>>8&255,Be=16711935&(Be=(Be=16711935&Le)+((De<<16)+De));ye[Ce+Oe]=(4278255360&Le)+Be>>>0}}function at(W,ee){ee.jd=W>>0&255,ee.hd=W>>8&255,ee.ud=W>>16&255}function Ve(W,ee,ce,ye,Ce,Oe){var Le;for(Le=0;Le<ye;++Le){var De=ee[ce+Le],Be=De>>>8,He=De,ct=255&(ct=(ct=De>>>16)+((W.jd<<24>>24)*(Be<<24>>24)>>>5));He=255&(He=(He=He+((W.hd<<24>>24)*(Be<<24>>24)>>>5))+((W.ud<<24>>24)*(ct<<24>>24)>>>5)),Ce[Oe+Le]=(4278255360&De)+(ct<<16)+He}}function dt(W,ee,ce,ye,Ce){w[ee]=function(Oe,Le,De,Be,He,ct,It,Rt,_t){for(Be=It;Be<Rt;++Be)for(It=0;It<_t;++It)He[ct++]=Ce(De[ye(Oe[Le++])])},w[W]=function(Oe,Le,De,Be,He,ct,It){var Rt=8>>Oe.b,_t=Oe.Ea,an=Oe.K[0],Gt=Oe.w;if(8>Rt)for(Oe=(1<<Oe.b)-1,Gt=(1<<Rt)-1;Le<De;++Le){var pt,gt=0;for(pt=0;pt<_t;++pt)pt&Oe||(gt=ye(Be[He++])),ct[It++]=Ce(an[gt&Gt]),gt>>=Rt}else w["VP8LMapColor"+ce](Be,He,an,Gt,ct,It,Le,De,_t)}}function ke(W,ee,ce,ye,Ce){for(ce=ee+ce;ee<ce;){var Oe=W[ee++];ye[Ce++]=Oe>>16&255,ye[Ce++]=Oe>>8&255,ye[Ce++]=Oe>>0&255}}function je(W,ee,ce,ye,Ce){for(ce=ee+ce;ee<ce;){var Oe=W[ee++];ye[Ce++]=Oe>>16&255,ye[Ce++]=Oe>>8&255,ye[Ce++]=Oe>>0&255,ye[Ce++]=Oe>>24&255}}function Ge(W,ee,ce,ye,Ce){for(ce=ee+ce;ee<ce;){var Oe=(Le=W[ee++])>>16&240|Le>>12&15,Le=Le>>0&240|Le>>28&15;ye[Ce++]=Oe,ye[Ce++]=Le}}function Ke(W,ee,ce,ye,Ce){for(ce=ee+ce;ee<ce;){var Oe=(Le=W[ee++])>>16&248|Le>>13&7,Le=Le>>5&224|Le>>3&31;ye[Ce++]=Oe,ye[Ce++]=Le}}function it(W,ee,ce,ye,Ce){for(ce=ee+ce;ee<ce;){var Oe=W[ee++];ye[Ce++]=Oe>>0&255,ye[Ce++]=Oe>>8&255,ye[Ce++]=Oe>>16&255}}function qe(W,ee,ce,ye,Ce,Oe){if(Oe==0)for(ce=ee+ce;ee<ce;)re(ye,((Oe=W[ee++])[0]>>24|Oe[1]>>8&65280|Oe[2]<<8&16711680|Oe[3]<<24)>>>0),Ce+=32;else r(ye,Ce,W,ee,ce)}function ze(W,ee){w[ee][0]=w[W+"0"],w[ee][1]=w[W+"1"],w[ee][2]=w[W+"2"],w[ee][3]=w[W+"3"],w[ee][4]=w[W+"4"],w[ee][5]=w[W+"5"],w[ee][6]=w[W+"6"],w[ee][7]=w[W+"7"],w[ee][8]=w[W+"8"],w[ee][9]=w[W+"9"],w[ee][10]=w[W+"10"],w[ee][11]=w[W+"11"],w[ee][12]=w[W+"12"],w[ee][13]=w[W+"13"],w[ee][14]=w[W+"0"],w[ee][15]=w[W+"0"]}function Re(W){return W==B1||W==qg||W==dA||W==fA}function Ue(){this.eb=[],this.size=this.A=this.fb=0}function We(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function ot(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new Ue,this.f.kb=new We,this.sd=null}function lt(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function Ot(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function vt(W){return alert("todo:WebPSamplerProcessPlane"),W.T}function nt(W,ee){var ce=W.T,ye=ee.ba.f.RGBA,Ce=ye.eb,Oe=ye.fb+W.ka*ye.A,Le=Fc[ee.ba.S],De=W.y,Be=W.O,He=W.f,ct=W.N,It=W.ea,Rt=W.W,_t=ee.cc,an=ee.dc,Gt=ee.Mc,pt=ee.Nc,gt=W.ka,Xt=W.ka+W.T,Kt=W.U,en=Kt+1>>1;for(gt==0?Le(De,Be,null,null,He,ct,It,Rt,He,ct,It,Rt,Ce,Oe,null,null,Kt):(Le(ee.ec,ee.fc,De,Be,_t,an,Gt,pt,He,ct,It,Rt,Ce,Oe-ye.A,Ce,Oe,Kt),++ce);gt+2<Xt;gt+=2)_t=He,an=ct,Gt=It,pt=Rt,ct+=W.Rc,Rt+=W.Rc,Oe+=2*ye.A,Le(De,(Be+=2*W.fa)-W.fa,De,Be,_t,an,Gt,pt,He,ct,It,Rt,Ce,Oe-ye.A,Ce,Oe,Kt);return Be+=W.fa,W.j+Xt<W.o?(r(ee.ec,ee.fc,De,Be,Kt),r(ee.cc,ee.dc,He,ct,en),r(ee.Mc,ee.Nc,It,Rt,en),ce--):1&Xt||Le(De,Be,null,null,He,ct,It,Rt,He,ct,It,Rt,Ce,Oe+ye.A,null,null,Kt),ce}function ut(W,ee,ce){var ye=W.F,Ce=[W.J];if(ye!=null){var Oe=W.U,Le=ee.ba.S,De=Le==uA||Le==dA;ee=ee.ba.f.RGBA;var Be=[0],He=W.ka;Be[0]=W.T,W.Kb&&(He==0?--Be[0]:(--He,Ce[0]-=W.width),W.j+W.ka+W.T==W.o&&(Be[0]=W.o-W.j-He));var ct=ee.eb;He=ee.fb+He*ee.A,W=Vi(ye,Ce[0],W.width,Oe,Be,ct,He+(De?0:3),ee.A),t(ce==Be),W&&Re(Le)&&Pc(ct,He,De,Oe,Be,ee.A)}return 0}function ht(W){var ee=W.ma,ce=ee.ba.S,ye=11>ce,Ce=ce==d2||ce==cA||ce==uA||ce==ho||ce==12||Re(ce);if(ee.memory=null,ee.Ib=null,ee.Jb=null,ee.Nd=null,!w1(ee.Oa,W,Ce?11:12))return 0;if(Ce&&Re(ce)&&gn(),W.da)alert("todo:use_scaling");else{if(ye){if(ee.Ib=vt,W.Kb){if(ce=W.U+1>>1,ee.memory=i(W.U+2*ce),ee.memory==null)return 0;ee.ec=ee.memory,ee.fc=0,ee.cc=ee.ec,ee.dc=ee.fc+W.U,ee.Mc=ee.cc,ee.Nc=ee.dc+ce,ee.Ib=nt,gn()}}else alert("todo:EmitYUV");Ce&&(ee.Jb=ut,ye&&Ct())}if(ye&&!_s){for(W=0;256>W;++W)Uc[W]=89858*(W-128)+Yd>>zp,zc[W]=-22014*(W-128)+Yd,U1[W]=-45773*(W-128),Xg[W]=113618*(W-128)+Yd>>zp;for(W=Wi;W<to;++W)ee=76283*(W-16)+Yd>>zp,G5[W-Wi]=Su(ee,255),$C[W-Wi]=Su(ee+8>>4,15);_s=1}return 1}function At(W){var ee=W.ma,ce=W.U,ye=W.T;return t(!(1&W.ka)),0>=ce||0>=ye?0:(ce=ee.Ib(W,ee),ee.Jb!=null&&ee.Jb(W,ee,ce),ee.Dc+=ce,1)}function Et(W){W.ma.memory=null}function wt(W,ee,ce,ye){return j(W,8)!=47?0:(ee[0]=j(W,14)+1,ce[0]=j(W,14)+1,ye[0]=j(W,1),j(W,3)!=0?0:!W.h)}function Dt(W,ee){if(4>W)return W+1;var ce=W-2>>1;return(2+(1&W)<<ce)+j(ee,ce)+1}function Lt(W,ee){return 120<ee?ee-120:1<=(ce=((ce=iF[ee-1])>>4)*W+(8-(15&ce)))?ce:1;var ce}function zt(W,ee,ce){var ye=H(ce),Ce=W[ee+=255&ye].g-8;return 0<Ce&&(V(ce,ce.u+8),ye=H(ce),ee+=W[ee].value,ee+=ye&(1<<Ce)-1),V(ce,ce.u+W[ee].g),W[ee].value}function Tt(W,ee,ce){return ce.g+=W.g,ce.value+=W.value<<ee>>>0,t(8>=ce.g),W.g}function $t(W,ee,ce){var ye=W.xc;return t((ee=ye==0?0:W.vc[W.md*(ce>>ye)+(ee>>ye)])<W.Wb),W.Ya[ee]}function dn(W,ee,ce,ye){var Ce=W.ab,Oe=W.c*ee,Le=W.C;ee=Le+ee;var De=ce,Be=ye;for(ye=W.Ta,ce=W.Ua;0<Ce--;){var He=W.gc[Ce],ct=Le,It=ee,Rt=De,_t=Be,an=(Be=ye,De=ce,He.Ea);switch(t(ct<It),t(It<=He.nc),He.hc){case 2:F5(Rt,_t,(It-ct)*an,Be,De);break;case 0:var Gt=ct,pt=It,gt=Be,Xt=De,Kt=(zn=He).Ea;Gt==0&&(zg(Rt,_t,null,null,1,gt,Xt),$e(Rt,_t+1,0,0,Kt-1,gt,Xt+1),_t+=Kt,Xt+=Kt,++Gt);for(var en=1<<zn.b,Jn=en-1,$n=fe(Kt,zn.b),Gr=zn.K,zn=zn.w+(Gt>>zn.b)*$n;Gt<pt;){var wi=Gr,Ci=zn,fi=1;for(Lp(Rt,_t,gt,Xt-Kt,1,gt,Xt);fi<Kt;){var za=(fi&~Jn)+en;za>Kt&&(za=Kt),(0,Mf[wi[Ci++]>>8&15])(Rt,_t+ +fi,gt,Xt+fi-Kt,za-fi,gt,Xt+fi),fi=za}_t+=Kt,Xt+=Kt,++Gt&Jn||(zn+=$n)}It!=He.nc&&r(Be,De-an,Be,De+(It-ct-1)*an,an);break;case 1:for(an=Rt,pt=_t,Kt=(Rt=He.Ea)-(Xt=Rt&~(gt=(_t=1<<He.b)-1)),Gt=fe(Rt,He.b),en=He.K,He=He.w+(ct>>He.b)*Gt;ct<It;){for(Jn=en,$n=He,Gr=new pe,zn=pt+Xt,wi=pt+Rt;pt<zn;)at(Jn[$n++],Gr),s2(Gr,an,pt,_t,Be,De),pt+=_t,De+=_t;pt<wi&&(at(Jn[$n++],Gr),s2(Gr,an,pt,Kt,Be,De),pt+=Kt,De+=Kt),++ct>||(He+=Gt)}break;case 3:if(Rt==Be&&_t==De&&0<He.b){for(pt=Be,Rt=an=De+(It-ct)*an-(Xt=(It-ct)*fe(He.Ea,He.b)),_t=Be,gt=De,Gt=[],Xt=(Kt=Xt)-1;0<=Xt;--Xt)Gt[Xt]=_t[gt+Xt];for(Xt=Kt-1;0<=Xt;--Xt)pt[Rt+Xt]=Gt[Xt];fc(He,ct,It,Be,an,Be,De)}else fc(He,ct,It,Rt,_t,Be,De)}De=ye,Be=ce}Be!=ce&&r(ye,ce,De,Be,Oe)}function fn(W,ee){var ce=W.V,ye=W.Ba+W.c*W.C,Ce=ee-W.C;if(t(ee<=W.l.o),t(16>=Ce),0<Ce){var Oe=W.l,Le=W.Ta,De=W.Ua,Be=Oe.width;if(dn(W,Ce,ce,ye),Ce=De=[De],t((ce=W.C)<(ye=ee)),t(Oe.v<Oe.va),ye>Oe.o&&(ye=Oe.o),ce<Oe.j){var He=Oe.j-ce;ce=Oe.j,Ce[0]+=He*Be}if(ce>=ye?ce=0:(Ce[0]+=4*Oe.v,Oe.ka=ce-Oe.j,Oe.U=Oe.va-Oe.v,Oe.T=ye-ce,ce=1),ce){if(De=De[0],11>(ce=W.ca).S){var ct=ce.f.RGBA,It=(ye=ce.S,Ce=Oe.U,Oe=Oe.T,He=ct.eb,ct.A),Rt=Oe;for(ct=ct.fb+W.Ma*ct.A;0<Rt--;){var _t=Le,an=De,Gt=Ce,pt=He,gt=ct;switch(ye){case U5:pc(_t,an,Gt,pt,gt);break;case d2:Gs(_t,an,Gt,pt,gt);break;case B1:Gs(_t,an,Gt,pt,gt),Pc(pt,gt,0,Gt,1,0);break;case LC:Dp(_t,an,Gt,pt,gt);break;case cA:qe(_t,an,Gt,pt,gt,1);break;case qg:qe(_t,an,Gt,pt,gt,1),Pc(pt,gt,0,Gt,1,0);break;case uA:qe(_t,an,Gt,pt,gt,0);break;case dA:qe(_t,an,Gt,pt,gt,0),Pc(pt,gt,1,Gt,1,0);break;case ho:c2(_t,an,Gt,pt,gt);break;case fA:c2(_t,an,Gt,pt,gt),po(pt,gt,Gt,1,0);break;case z5:kp(_t,an,Gt,pt,gt);break;default:t(0)}De+=Be,ct+=It}W.Ma+=Oe}else alert("todo:EmitRescaledRowsYUVA");t(W.Ma<=ce.height)}}W.C=ee,t(W.C<=W.i)}function Jt(W){var ee;if(0<W.ua)return 0;for(ee=0;ee<W.Wb;++ee){var ce=W.Ya[ee].G,ye=W.Ya[ee].H;if(0<ce[1][ye[1]+0].g||0<ce[2][ye[2]+0].g||0<ce[3][ye[3]+0].g)return 0}return 1}function rn(W,ee,ce,ye,Ce,Oe){if(W.Z!=0){var Le=W.qd,De=W.rd;for(t(Ws[W.Z]!=null);ee<ce;++ee)Ws[W.Z](Le,De,ye,Ce,ye,Ce,Oe),Le=ye,De=Ce,Ce+=Oe;W.qd=Le,W.rd=De}}function bn(W,ee){var ce=W.l.ma,ye=ce.Z==0||ce.Z==1?W.l.j:W.C;if(ye=W.C<ye?ye:W.C,t(ee<=W.l.o),ee>ye){var Ce=W.l.width,Oe=ce.ca,Le=ce.tb+Ce*ye,De=W.V,Be=W.Ba+W.c*ye,He=W.gc;t(W.ab==1),t(He[0].hc==3),oA(He[0],ye,ee,De,Be,Oe,Le),rn(ce,ye,ee,Oe,Le,Ce)}W.C=W.Ma=ee}function Cn(W,ee,ce,ye,Ce,Oe,Le){var De=W.$/ye,Be=W.$%ye,He=W.m,ct=W.s,It=ce+W.$,Rt=It;Ce=ce+ye*Ce;var _t=ce+ye*Oe,an=280+ct.ua,Gt=W.Pb?De:16777216,pt=0<ct.ua?ct.Wa:null,gt=ct.wc,Xt=It<_t?$t(ct,Be,De):null;t(W.C<Oe),t(_t<=Ce);var Kt=!1;e:for(;;){for(;Kt||It<_t;){var en=0;if(De>=Gt){var Jn=It-ce;t((Gt=W).Pb),Gt.wd=Gt.m,Gt.xd=Jn,0<Gt.s.ua&&ue(Gt.s.Wa,Gt.s.vb),Gt=De+j5}if(Be>||(Xt=$t(ct,Be,De)),t(Xt!=null),Xt.Qb&&(ee[It]=Xt.qb,Kt=!0),!Kt)if(Y(He),Xt.jc){en=He,Jn=ee;var $n=It,Gr=Xt.pd[H(en)&el-1];t(Xt.jc),256>Gr.g?(V(en,en.u+Gr.g),Jn[$n]=Gr.value,en=0):(V(en,en.u+Gr.g-256),t(256<=Gr.value),en=Gr.value),en==0&&(Kt=!0)}else en=zt(Xt.G[0],Xt.H[0],He);if(He.h)break;if(Kt||256>en){if(!Kt)if(Xt.nd)ee[It]=(Xt.qb|en<<8)>>>0;else{if(Y(He),Kt=zt(Xt.G[1],Xt.H[1],He),Y(He),Jn=zt(Xt.G[2],Xt.H[2],He),$n=zt(Xt.G[3],Xt.H[3],He),He.h)break;ee[It]=($n<<24|Kt<<16|en<<8|Jn)>>>0}if(Kt=!1,++It,++Be>=ye&&(Be=0,++De,Le!=null&&De<=Oe&&!(De%16)&&Le(W,De),pt!=null))for(;Rt<It;)en=ee[Rt++],pt.X[(506832829*en&4294967295)>>>pt.Mb]=en}else if(280>en){if(en=Dt(en-256,He),Jn=zt(Xt.G[4],Xt.H[4],He),Y(He),Jn=Lt(ye,Jn=Dt(Jn,He)),He.h)break;if(It-ce<Jn||Ce-It<en)break e;for($n=0;$n<en;++$n)ee[It+$n]=ee[It+$n-Jn];for(It+=en,Be+=en;Be>=ye;)Be-=ye,++De,Le!=null&&De<=Oe&&!(De%16)&&Le(W,De);if(t(It<=Ce),Be>&&(Xt=$t(ct,Be,De)),pt!=null)for(;Rt<It;)en=ee[Rt++],pt.X[(506832829*en&4294967295)>>>pt.Mb]=en}else{if(!(en<an))break e;for(Kt=en-280,t(pt!=null);Rt<It;)en=ee[Rt++],pt.X[(506832829*en&4294967295)>>>pt.Mb]=en;en=It,t(!(Kt>>>(Jn=pt).Xa)),ee[en]=Jn.X[Kt],Kt=!0}Kt||t(He.h==q(He))}if(W.Pb&&He.h&&It<Ce)t(W.m.h),W.a=5,W.m=W.wd,W.$=W.xd,0<W.s.ua&&ue(W.s.vb,W.s.Wa);else{if(He.h)break e;Le!=null&&Le(W,De>Oe?Oe:De),W.a=0,W.$=It-ce}return 1}return W.a=3,0}function ar(W){t(W!=null),W.vc=null,W.yc=null,W.Ya=null;var ee=W.Wa;ee!=null&&(ee.X=null),W.vb=null,t(W!=null)}function lr(){var W=new E_;return W==null?null:(W.a=0,W.xb=$1,ze("Predictor","VP8LPredictors"),ze("Predictor","VP8LPredictors_C"),ze("PredictorAdd","VP8LPredictorsAdd"),ze("PredictorAdd","VP8LPredictorsAdd_C"),F5=rt,s2=Ve,pc=ke,Gs=je,c2=Ge,kp=Ke,Dp=it,w.VP8LMapColor32b=O1,w.VP8LMapColor8b=M1,W)}function Cr(W,ee,ce,ye,Ce){var Oe=1,Le=[W],De=[ee],Be=ye.m,He=ye.s,ct=null,It=0;e:for(;;){if(ce)for(;Oe&&j(Be,1);){var Rt=Le,_t=De,an=ye,Gt=1,pt=an.m,gt=an.gc[an.ab],Xt=j(pt,2);if(an.Oc&1<<Xt)Oe=0;else{switch(an.Oc|=1<<Xt,gt.hc=Xt,gt.Ea=Rt[0],gt.nc=_t[0],gt.K=[null],++an.ab,t(4>=an.ab),Xt){case 0:case 1:gt.b=j(pt,3)+2,Gt=Cr(fe(gt.Ea,gt.b),fe(gt.nc,gt.b),0,an,gt.K),gt.K=gt.K[0];break;case 3:var Kt,en=j(pt,8)+1,Jn=16<en?0:4<en?1:2<en?2:3;if(Rt[0]=fe(gt.Ea,Jn),gt.b=Jn,Kt=Gt=Cr(en,1,0,an,gt.K)){var $n,Gr=en,zn=gt,wi=1<<(8>>zn.b),Ci=i(wi);if(Ci==null)Kt=0;else{var fi=zn.K[0],za=zn.w;for(Ci[0]=zn.K[0][0],$n=1;$n<1*Gr;++$n)Ci[$n]=ve(fi[za+$n],Ci[$n-1]);for(;$n<4*wi;++$n)Ci[$n]=0;zn.K[0]=null,zn.K[0]=Ci,Kt=1}}Gt=Kt;break;case 2:break;default:t(0)}Oe=Gt}}if(Le=Le[0],De=De[0],Oe&&j(Be,1)&&!(Oe=1<=(It=j(Be,4))&&11>=It)){ye.a=3;break e}var qi;if(qi=Oe)t:{var no,ha,zo,mc=ye,hl=Le,Pl=De,$i=It,qs=ce,Qs=mc.m,Ho=mc.s,$l=[null],Ss=1,Hc=0,fd=DC[$i];n:for(;;){if(qs&&j(Qs,1)){var jo=j(Qs,3)+2,xl=fe(hl,jo),wu=fe(Pl,jo),h2=xl*wu;if(!Cr(xl,wu,0,mc,$l))break n;for($l=$l[0],Ho.xc=jo,no=0;no<h2;++no){var jp=$l[no]>>8&65535;$l[no]=jp,jp>=Ss&&(Ss=jp+1)}}if(Qs.h)break n;for(ha=0;5>ha;++ha){var Fi=Qg[ha];!ha&&0<$i&&(Fi+=1<<$i),Hc<Fi&&(Hc=Fi)}var Pf=o(Ss*fd,L),V5=Ss,N_=o(V5,M);if(N_==null)var pd=null;else t(65536>=V5),pd=N_;var hd=i(Hc);if(pd==null||hd==null||Pf==null){mc.a=1;break n}var Jg=Pf;for(no=zo=0;no<Ss;++no){var gd=pd[no],Gp=gd.G,e0=gd.H,z1=0,Cu=1,H1=0;for(ha=0;5>ha;++ha){Fi=Qg[ha],Gp[ha]=Jg,e0[ha]=zo,!ha&&0<$i&&(Fi+=1<<$i);a:{var g2,Vp=Fi,j1=mc,$f=hd,UC=Jg,O_=zo,To=0,Kd=j1.m,M_=j(Kd,1);if(a($f,0,0,Vp),M_){var L_=j(Kd,1)+1,W5=j(Kd,1),q5=j(Kd,W5==0?1:8);$f[q5]=1,L_==2&&($f[q5=j(Kd,8)]=1);var Ff=1}else{var Oo=i(19),El=j(Kd,4)+4;if(19<El){j1.a=3;var gl=0;break a}for(g2=0;g2<El;++g2)Oo[aF[g2]]=j(Kd,3);var G1=void 0,Wp=void 0,V1=j1,uF=Oo,Fl=Vp,Q5=$f,AA=0,Uf=V1.m,Xd=8,Tu=o(128,L);r:for(;R(Tu,0,7,uF,19);){if(j(Uf,1)){var vA=2+2*j(Uf,3);if((G1=2+j(Uf,vA))>Fl)break r}else G1=Fl;for(Wp=0;Wp<Fl&&G1--;){Y(Uf);var Y5=Tu[0+(127&H(Uf))];V(Uf,Uf.u+Y5.g);var m2=Y5.value;if(16>m2)Q5[Wp++]=m2,m2!=0&&(Xd=m2);else{var zC=m2==16,k_=m2-16,HC=H5[k_],D_=j(Uf,pA[k_])+HC;if(Wp+D_>Fl)break r;for(var jC=zC?Xd:0;0<D_--;)Q5[Wp++]=jC}}AA=1;break r}AA||(V1.a=3),Ff=AA}(Ff=Ff&&!Kd.h)&&(To=R(UC,O_,8,$f,Vp)),Ff&&To!=0?gl=To:(j1.a=3,gl=0)}if(gl==0)break n;if(Cu&&kC[ha]==1&&(Cu=Jg[zo].g==0),z1+=Jg[zo].g,zo+=gl,3>=ha){var W1,K5=hd[0];for(W1=1;W1<Fi;++W1)hd[W1]>K5&&(K5=hd[W1]);H1+=K5}}if(gd.nd=Cu,gd.Qb=0,Cu&&(gd.qb=(Gp[3][e0[3]+0].value<<24|Gp[1][e0[1]+0].value<<16|Gp[2][e0[2]+0].value)>>>0,z1==0&&256>Gp[0][e0[0]+0].value&&(gd.Qb=1,gd.qb+=Gp[0][e0[0]+0].value<<8)),gd.jc=!gd.Qb&&6>H1,gd.jc){var yA,Iu=gd;for(yA=0;yA<el;++yA){var qp=yA,Zd=Iu.pd[qp],t0=Iu.G[0][Iu.H[0]+qp];256<=t0.value?(Zd.g=t0.g+256,Zd.value=t0.value):(Zd.g=0,Zd.value=0,qp>>=Tt(t0,8,Zd),qp>>=Tt(Iu.G[1][Iu.H[1]+qp],16,Zd),qp>>=Tt(Iu.G[2][Iu.H[2]+qp],0,Zd),Tt(Iu.G[3][Iu.H[3]+qp],24,Zd))}}}Ho.vc=$l,Ho.Wb=Ss,Ho.Ya=pd,Ho.yc=Pf,qi=1;break t}qi=0}if(!(Oe=qi)){ye.a=3;break e}if(0<It){if(He.ua=1<<It,!de(He.Wa,It)){ye.a=1,Oe=0;break e}}else He.ua=0;var X5=ye,Z5=Le,GC=De,J5=X5.s,ey=J5.xc;if(X5.c=Z5,X5.i=GC,J5.md=fe(Z5,ey),J5.wc=ey==0?-1:(1<<ey)-1,ce){ye.xb=Bf;break e}if((ct=i(Le*De))==null){ye.a=1,Oe=0;break e}Oe=(Oe=Cn(ye,ct,0,Le,De,De,null))&&!Be.h;break e}return Oe?(Ce!=null?Ce[0]=ct:(t(ct==null),t(ce)),ye.$=0,ce||ar(He)):ar(He),Oe}function sn(W,ee){var ce=W.c*W.i,ye=ce+ee+16*ee;return t(W.c<=ee),W.V=i(ye),W.V==null?(W.Ta=null,W.Ua=0,W.a=1,0):(W.Ta=W.V,W.Ua=W.Ba+ce+ee,1)}function tt(W,ee){var ce=W.C,ye=ee-ce,Ce=W.V,Oe=W.Ba+W.c*ce;for(t(ee<=W.l.o);0<ye;){var Le=16<ye?16:ye,De=W.l.ma,Be=W.l.width,He=Be*Le,ct=De.ca,It=De.tb+Be*ce,Rt=W.Ta,_t=W.Ua;dn(W,Le,Ce,Oe),tl(Rt,_t,ct,It,He),rn(De,ce,ce+Le,ct,It,Be),ye-=Le,Ce+=Le*W.c,ce+=Le}t(ce==ee),W.C=W.Ma=ee}function Qe(){this.ub=this.yd=this.td=this.Rb=0}function Je(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function St(){this.Fb=this.Bb=this.Cb=0,this.Zb=i(4),this.Lb=i(4)}function Vt(){this.Yb=(function(){var W=[];return(function ee(ce,ye,Ce){for(var Oe=Ce[ye],Le=0;Le<Oe&&(ce.push(Ce.length>ye+1?[]:0),!(Ce.length<ye+1));Le++)ee(ce[Le],ye+1,Ce)})(W,0,[3,11]),W})()}function jt(){this.jb=i(3),this.Wc=l([4,8],Vt),this.Xc=l([4,17],Vt)}function Ft(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new i(4),this.od=new i(4)}function Wt(){this.ld=this.La=this.dd=this.tc=0}function ln(){this.Na=this.la=0}function Qn(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Zt(){this.ad=i(384),this.Za=0,this.Ob=i(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function yt(){this.uc=this.M=this.Nb=0,this.wa=Array(new Wt),this.Y=0,this.ya=Array(new Zt),this.aa=0,this.l=new Vn}function Ht(){this.y=i(16),this.f=i(8),this.ea=i(8)}function Pn(){this.cb=this.a=0,this.sc="",this.m=new G,this.Od=new Qe,this.Kc=new Je,this.ed=new Ft,this.Qa=new St,this.Ic=this.$c=this.Aa=0,this.D=new yt,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=o(8,G),this.ia=0,this.pb=o(4,Qn),this.Pa=new jt,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Ht),this.Hd=0,this.rb=Array(new ln),this.sb=0,this.wa=Array(new Wt),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new Zt),this.L=this.aa=0,this.gd=l([4,2],Wt),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function Vn(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function Mr(){var W=new Pn;return W!=null&&(W.a=0,W.sc="OK",W.cb=0,W.Xb=0,Yg||(Yg=qa)),W}function qr(W,ee,ce){return W.a==0&&(W.a=ee,W.sc=ce,W.cb=0),0}function Ga(W,ee,ce){return 3<=ce&&W[ee+0]==157&&W[ee+1]==1&&W[ee+2]==42}function ei(W,ee){if(W==null)return 0;if(W.a=0,W.sc="OK",ee==null)return qr(W,2,"null VP8Io passed to VP8GetHeaders()");var ce=ee.data,ye=ee.w,Ce=ee.ha;if(4>Ce)return qr(W,7,"Truncated header.");var Oe=ce[ye+0]|ce[ye+1]<<8|ce[ye+2]<<16,Le=W.Od;if(Le.Rb=!(1&Oe),Le.td=Oe>>1&7,Le.yd=Oe>>4&1,Le.ub=Oe>>5,3<Le.td)return qr(W,3,"Incorrect keyframe parameters.");if(!Le.yd)return qr(W,4,"Frame not displayable.");ye+=3,Ce-=3;var De=W.Kc;if(Le.Rb){if(7>Ce)return qr(W,7,"cannot parse picture header");if(!Ga(ce,ye,Ce))return qr(W,3,"Bad code word");De.c=16383&(ce[ye+4]<<8|ce[ye+3]),De.Td=ce[ye+4]>>6,De.i=16383&(ce[ye+6]<<8|ce[ye+5]),De.Ud=ce[ye+6]>>6,ye+=7,Ce-=7,W.za=De.c+15>>4,W.Ub=De.i+15>>4,ee.width=De.c,ee.height=De.i,ee.Da=0,ee.j=0,ee.v=0,ee.va=ee.width,ee.o=ee.height,ee.da=0,ee.ib=ee.width,ee.hb=ee.height,ee.U=ee.width,ee.T=ee.height,a((Oe=W.Pa).jb,0,255,Oe.jb.length),t((Oe=W.Qa)!=null),Oe.Cb=0,Oe.Bb=0,Oe.Fb=1,a(Oe.Zb,0,0,Oe.Zb.length),a(Oe.Lb,0,0,Oe.Lb)}if(Le.ub>Ce)return qr(W,7,"bad partition length");B(Oe=W.m,ce,ye,Le.ub),ye+=Le.ub,Ce-=Le.ub,Le.Rb&&(De.Ld=Q(Oe),De.Kd=Q(Oe)),De=W.Qa;var Be,He=W.Pa;if(t(Oe!=null),t(De!=null),De.Cb=Q(Oe),De.Cb){if(De.Bb=Q(Oe),Q(Oe)){for(De.Fb=Q(Oe),Be=0;4>Be;++Be)De.Zb[Be]=Q(Oe)?$(Oe,7):0;for(Be=0;4>Be;++Be)De.Lb[Be]=Q(Oe)?$(Oe,6):0}if(De.Bb)for(Be=0;3>Be;++Be)He.jb[Be]=Q(Oe)?D(Oe,8):255}else De.Bb=0;if(Oe.Ka)return qr(W,3,"cannot parse segment header");if((De=W.ed).zd=Q(Oe),De.Tb=D(Oe,6),De.wb=D(Oe,3),De.Pc=Q(Oe),De.Pc&&Q(Oe)){for(He=0;4>He;++He)Q(Oe)&&(De.vd[He]=$(Oe,6));for(He=0;4>He;++He)Q(Oe)&&(De.od[He]=$(Oe,6))}if(W.L=De.Tb==0?0:De.zd?1:2,Oe.Ka)return qr(W,3,"cannot parse filter header");var ct=Ce;if(Ce=Be=ye,ye=Be+ct,De=ct,W.Xb=(1<<D(W.m,2))-1,ct<3*(He=W.Xb))ce=7;else{for(Be+=3*He,De-=3*He,ct=0;ct<He;++ct){var It=ce[Ce+0]|ce[Ce+1]<<8|ce[Ce+2]<<16;It>De&&(It=De),B(W.Jc[+ct],ce,Be,It),Be+=It,De-=It,Ce+=3}B(W.Jc[+He],ce,Be,De),ce=Be<ye?0:5}if(ce!=0)return qr(W,ce,"cannot parse partitions");for(ce=D(Be=W.m,7),Ce=Q(Be)?$(Be,4):0,ye=Q(Be)?$(Be,4):0,De=Q(Be)?$(Be,4):0,He=Q(Be)?$(Be,4):0,Be=Q(Be)?$(Be,4):0,ct=W.Qa,It=0;4>It;++It){if(ct.Cb){var Rt=ct.Zb[It];ct.Fb||(Rt+=ce)}else{if(0<It){W.pb[It]=W.pb[0];continue}Rt=ce}var _t=W.pb[It];_t.Sc[0]=P1[Su(Rt+Ce,127)],_t.Sc[1]=hA[Su(Rt+0,127)],_t.Eb[0]=2*P1[Su(Rt+ye,127)],_t.Eb[1]=101581*hA[Su(Rt+De,127)]>>16,8>_t.Eb[1]&&(_t.Eb[1]=8),_t.Qc[0]=P1[Su(Rt+He,117)],_t.Qc[1]=hA[Su(Rt+Be,127)],_t.lc=Rt+Be}if(!Le.Rb)return qr(W,4,"Not a key frame.");for(Q(Oe),Le=W.Pa,ce=0;4>ce;++ce){for(Ce=0;8>Ce;++Ce)for(ye=0;3>ye;++ye)for(De=0;11>De;++De)He=X(Oe,lF[ce][Ce][ye][De])?D(Oe,8):PC[ce][Ce][ye][De],Le.Wc[ce][Ce].Yb[ye][De]=He;for(Ce=0;17>Ce;++Ce)Le.Xc[ce][Ce]=Le.Wc[ce][T_[Ce]]}return W.kc=Q(Oe),W.kc&&(W.Bd=D(Oe,8)),W.cb=1}function qa(W,ee,ce,ye,Ce,Oe,Le){var De=ee[Ce].Yb[ce];for(ce=0;16>Ce;++Ce){if(!X(W,De[ce+0]))return Ce;for(;!X(W,De[ce+1]);)if(De=ee[++Ce].Yb[0],ce=0,Ce==16)return 16;var Be=ee[Ce+1].Yb;if(X(W,De[ce+2])){var He=W,ct=0;if(X(He,(Rt=De)[(It=ce)+3]))if(X(He,Rt[It+6])){for(De=0,It=2*(ct=X(He,Rt[It+8]))+(Rt=X(He,Rt[It+9+ct])),ct=0,Rt=w_[It];Rt[De];++De)ct+=ct+X(He,Rt[De]);ct+=3+(8<<It)}else X(He,Rt[It+7])?(ct=7+2*X(He,165),ct+=X(He,145)):ct=5+X(He,159);else ct=X(He,Rt[It+4])?3+X(He,Rt[It+5]):2;De=Be[2]}else ct=1,De=Be[1];Be=Le+C_[Ce],0>(He=W).b&&K(He);var It,Rt=He.b,_t=(It=He.Ca>>1)-(He.I>>Rt)>>31;--He.b,He.Ca+=_t,He.Ca|=1,He.I-=(It+1&_t)<<Rt,Oe[Be]=((ct^_t)-_t)*ye[(0<Ce)+0]}return 16}function Qa(W){var ee=W.rb[W.sb-1];ee.la=0,ee.Na=0,a(W.zc,0,0,W.zc.length),W.ja=0}function Pi(W,ee){if(W==null)return 0;if(ee==null)return qr(W,2,"NULL VP8Io parameter in VP8Decode().");if(!W.cb&&!ei(W,ee))return 0;if(t(W.cb),ee.ac==null||ee.ac(ee)){ee.ob&&(W.L=0);var ce=Zg[W.L];if(W.L==2?(W.yb=0,W.zb=0):(W.yb=ee.v-ce>>4,W.zb=ee.j-ce>>4,0>W.yb&&(W.yb=0),0>W.zb&&(W.zb=0)),W.Va=ee.o+15+ce>>4,W.Hb=ee.va+15+ce>>4,W.Hb>W.za&&(W.Hb=W.za),W.Va>W.Ub&&(W.Va=W.Ub),0<W.L){var ye=W.ed;for(ce=0;4>ce;++ce){var Ce;if(W.Qa.Cb){var Oe=W.Qa.Lb[ce];W.Qa.Fb||(Oe+=ye.Tb)}else Oe=ye.Tb;for(Ce=0;1>=Ce;++Ce){var Le=W.gd[ce][Ce],De=Oe;if(ye.Pc&&(De+=ye.vd[0],Ce&&(De+=ye.od[0])),0<(De=0>De?0:63<De?63:De)){var Be=De;0<ye.wb&&(Be=4<ye.wb?Be>>2:Be>>1)>9-ye.wb&&(Be=9-ye.wb),1>Be&&(Be=1),Le.dd=Be,Le.tc=2*De+Be,Le.ld=40<=De?2:15<=De?1:0}else Le.tc=0;Le.La=Ce}}}ce=0}else qr(W,6,"Frame setup failed"),ce=W.a;if(ce=ce==0){if(ce){W.$c=0,0<W.Aa||(W.Ic=Hp);e:{ce=W.Ic,ye=4*(Be=W.za);var He=32*Be,ct=Be+1,It=0<W.L?Be*(0<W.Aa?2:1):0,Rt=(W.Aa==2?2:1)*Be;if((Le=ye+832+(Ce=3*(16*ce+Zg[W.L])/2*He)+(Oe=W.Fa!=null&&0<W.Fa.length?W.Kc.c*W.Kc.i:0))!=Le)ce=0;else{if(Le>W.Vb){if(W.Vb=0,W.Ec=i(Le),W.Fc=0,W.Ec==null){ce=qr(W,1,"no memory during frame initialization.");break e}W.Vb=Le}Le=W.Ec,De=W.Fc,W.Ac=Le,W.Bc=De,De+=ye,W.Gd=o(He,Ht),W.Hd=0,W.rb=o(ct+1,ln),W.sb=1,W.wa=It?o(It,Wt):null,W.Y=0,W.D.Nb=0,W.D.wa=W.wa,W.D.Y=W.Y,0<W.Aa&&(W.D.Y+=Be),t(!0),W.oc=Le,W.pc=De,De+=832,W.ya=o(Rt,Zt),W.aa=0,W.D.ya=W.ya,W.D.aa=W.aa,W.Aa==2&&(W.D.aa+=Be),W.R=16*Be,W.B=8*Be,Be=(He=Zg[W.L])*W.R,He=He/2*W.B,W.sa=Le,W.ta=De+Be,W.qa=W.sa,W.ra=W.ta+16*ce*W.R+He,W.Ha=W.qa,W.Ia=W.ra+8*ce*W.B+He,W.$c=0,De+=Ce,W.mb=Oe?Le:null,W.nb=Oe?De:null,t(De+Oe<=W.Fc+W.Vb),Qa(W),a(W.Ac,W.Bc,0,ye),ce=1}}if(ce){if(ee.ka=0,ee.y=W.sa,ee.O=W.ta,ee.f=W.qa,ee.N=W.ra,ee.ea=W.Ha,ee.Vd=W.Ia,ee.fa=W.R,ee.Rc=W.B,ee.F=null,ee.J=0,!sA){for(ce=-255;255>=ce;++ce)Sl[255+ce]=0>ce?-ce:ce;for(ce=-1020;1020>=ce;++ce)kf[1020+ce]=-128>ce?-128:127<ce?127:ce;for(ce=-112;112>=ce;++ce)k1[112+ce]=-16>ce?-16:15<ce?15:ce;for(ce=-255;510>=ce;++ce)Wg[255+ce]=0>ce?0:255<ce?255:ce;sA=1}L1=Dr,Bp=pa,Pp=Ta,Vs=Ei,xu=sr,Li=na,Hg=b1,lA=Bl,jg=Pg,Gg=nA,Vg=r2,Eu=a2,$p=$g,Lf=_1,Fp=Wd,Up=ld,u2=sd,bs=P5,dd[0]=uc,dd[1]=ma,dd[2]=vs,dd[3]=ys,dd[4]=Nf,dd[5]=Pr,dd[6]=Yn,dd[7]=Mi,dd[8]=fo,dd[9]=bo,gc[0]=Wn,gc[1]=ir,gc[2]=Ua,gc[3]=Oi,gc[4]=Un,gc[5]=yr,gc[6]=Aa,$c[0]=ns,$c[1]=mr,$c[2]=t2,$c[3]=_u,$c[4]=Dg,$c[5]=v1,$c[6]=eA,ce=1}else ce=0}ce&&(ce=(function(_t,an){for(_t.M=0;_t.M<_t.Va;++_t.M){var Gt,pt=_t.Jc[_t.M&_t.Xb],gt=_t.m,Xt=_t;for(Gt=0;Gt<Xt.za;++Gt){var Kt=gt,en=Xt,Jn=en.Ac,$n=en.Bc+4*Gt,Gr=en.zc,zn=en.ya[en.aa+Gt];if(en.Qa.Bb?zn.$b=X(Kt,en.Pa.jb[0])?2+X(Kt,en.Pa.jb[2]):X(Kt,en.Pa.jb[1]):zn.$b=0,en.kc&&(zn.Ad=X(Kt,en.Bd)),zn.Za=!X(Kt,145)+0,zn.Za){var wi=zn.Ob,Ci=0;for(en=0;4>en;++en){var fi,za=Gr[0+en];for(fi=0;4>fi;++fi){za=oF[Jn[$n+fi]][za];for(var qi=BC[X(Kt,za[0])];0<qi;)qi=BC[2*qi+X(Kt,za[qi])];za=-qi,Jn[$n+fi]=za}r(wi,Ci,Jn,$n,4),Ci+=4,Gr[0+en]=za}}else za=X(Kt,156)?X(Kt,128)?1:3:X(Kt,163)?2:0,zn.Ob[0]=za,a(Jn,$n,za,4),a(Gr,0,za,4);zn.Dd=X(Kt,142)?X(Kt,114)?X(Kt,183)?1:3:2:0}if(Xt.m.Ka)return qr(_t,7,"Premature end-of-partition0 encountered.");for(;_t.ja<_t.za;++_t.ja){if(Xt=pt,Kt=(gt=_t).rb[gt.sb-1],Jn=gt.rb[gt.sb+gt.ja],Gt=gt.ya[gt.aa+gt.ja],$n=gt.kc?Gt.Ad:0)Kt.la=Jn.la=0,Gt.Za||(Kt.Na=Jn.Na=0),Gt.Hc=0,Gt.Gc=0,Gt.ia=0;else{var no,ha;if(Kt=Jn,Jn=Xt,$n=gt.Pa.Xc,Gr=gt.ya[gt.aa+gt.ja],zn=gt.pb[Gr.$b],en=Gr.ad,wi=0,Ci=gt.rb[gt.sb-1],za=fi=0,a(en,wi,0,384),Gr.Za)var zo=0,mc=$n[3];else{qi=i(16);var hl=Kt.Na+Ci.Na;if(hl=Yg(Jn,$n[1],hl,zn.Eb,0,qi,0),Kt.Na=Ci.Na=(0<hl)+0,1<hl)L1(qi,0,en,wi);else{var Pl=qi[0]+3>>3;for(qi=0;256>qi;qi+=16)en[wi+qi]=Pl}zo=1,mc=$n[0]}var $i=15&Kt.la,qs=15&Ci.la;for(qi=0;4>qi;++qi){var Qs=1&qs;for(Pl=ha=0;4>Pl;++Pl)$i=$i>>1|(Qs=(hl=Yg(Jn,mc,hl=Qs+(1&$i),zn.Sc,zo,en,wi))>zo)<<7,ha=ha<<2|(3<hl?3:1<hl?2:en[wi+0]!=0),wi+=16;$i>>=4,qs=qs>>1|Qs<<7,fi=(fi<<8|ha)>>>0}for(mc=$i,zo=qs>>4,no=0;4>no;no+=2){for(ha=0,$i=Kt.la>>4+no,qs=Ci.la>>4+no,qi=0;2>qi;++qi){for(Qs=1&qs,Pl=0;2>Pl;++Pl)hl=Qs+(1&$i),$i=$i>>1|(Qs=0<(hl=Yg(Jn,$n[2],hl,zn.Qc,0,en,wi)))<<3,ha=ha<<2|(3<hl?3:1<hl?2:en[wi+0]!=0),wi+=16;$i>>=2,qs=qs>>1|Qs<<5}za|=ha<<4*no,mc|=$i<<4<<no,zo|=(240&qs)<<no}Kt.la=mc,Ci.la=zo,Gr.Hc=fi,Gr.Gc=za,Gr.ia=43690&za?0:zn.ia,$n=!(fi|za)}if(0<gt.L&&(gt.wa[gt.Y+gt.ja]=gt.gd[Gt.$b][Gt.Za],gt.wa[gt.Y+gt.ja].La|=!$n),Xt.Ka)return qr(_t,7,"Premature end-of-file encountered.")}if(Qa(_t),gt=an,Xt=1,Gt=(pt=_t).D,Kt=0<pt.L&&pt.M>=pt.zb&&pt.M<=pt.Va,pt.Aa==0)e:{if(Gt.M=pt.M,Gt.uc=Kt,E1(pt,Gt),Xt=1,Gt=(ha=pt.D).Nb,Kt=(za=Zg[pt.L])*pt.R,Jn=za/2*pt.B,qi=16*Gt*pt.R,Pl=8*Gt*pt.B,$n=pt.sa,Gr=pt.ta-Kt+qi,zn=pt.qa,en=pt.ra-Jn+Pl,wi=pt.Ha,Ci=pt.Ia-Jn+Pl,qs=($i=ha.M)==0,fi=$i>=pt.Va-1,pt.Aa==2&&E1(pt,ha),ha.uc)for(Qs=(hl=pt).D.M,t(hl.D.uc),ha=hl.yb;ha<hl.Hb;++ha){zo=ha,mc=Qs;var Ho=($l=(Fi=hl).D).Nb;no=Fi.R;var $l=$l.wa[$l.Y+zo],Ss=Fi.sa,Hc=Fi.ta+16*Ho*no+16*zo,fd=$l.dd,jo=$l.tc;if(jo!=0)if(t(3<=jo),Fi.L==1)0<zo&&Up(Ss,Hc,no,jo+4),$l.La&&bs(Ss,Hc,no,jo),0<mc&&Fp(Ss,Hc,no,jo+4),$l.La&&u2(Ss,Hc,no,jo);else{var xl=Fi.B,wu=Fi.qa,h2=Fi.ra+8*Ho*xl+8*zo,jp=Fi.Ha,Fi=Fi.Ia+8*Ho*xl+8*zo;Ho=$l.ld,0<zo&&(lA(Ss,Hc,no,jo+4,fd,Ho),Gg(wu,h2,jp,Fi,xl,jo+4,fd,Ho)),$l.La&&(Eu(Ss,Hc,no,jo,fd,Ho),Lf(wu,h2,jp,Fi,xl,jo,fd,Ho)),0<mc&&(Hg(Ss,Hc,no,jo+4,fd,Ho),jg(wu,h2,jp,Fi,xl,jo+4,fd,Ho)),$l.La&&(Vg(Ss,Hc,no,jo,fd,Ho),$p(wu,h2,jp,Fi,xl,jo,fd,Ho))}}if(pt.ia&&alert("todo:DitherRow"),gt.put!=null){if(ha=16*$i,$i=16*($i+1),qs?(gt.y=pt.sa,gt.O=pt.ta+qi,gt.f=pt.qa,gt.N=pt.ra+Pl,gt.ea=pt.Ha,gt.W=pt.Ia+Pl):(ha-=za,gt.y=$n,gt.O=Gr,gt.f=zn,gt.N=en,gt.ea=wi,gt.W=Ci),fi||($i-=za),$i>gt.o&&($i=gt.o),gt.F=null,gt.J=null,pt.Fa!=null&&0<pt.Fa.length&&ha<$i&&(gt.J=aA(pt,gt,ha,$i-ha),gt.F=pt.mb,gt.F==null&>.F.length==0)){Xt=qr(pt,3,"Could not decode alpha data.");break e}ha<gt.j&&(za=gt.j-ha,ha=gt.j,t(!(1&za)),gt.O+=pt.R*za,gt.N+=pt.B*(za>>1),gt.W+=pt.B*(za>>1),gt.F!=null&&(gt.J+=gt.width*za)),ha<$i&&(gt.O+=gt.v,gt.N+=gt.v>>1,gt.W+=gt.v>>1,gt.F!=null&&(gt.J+=gt.v),gt.ka=ha-gt.j,gt.U=gt.va-gt.v,gt.T=$i-ha,Xt=gt.put(gt))}Gt+1!=pt.Ic||fi||(r(pt.sa,pt.ta-Kt,$n,Gr+16*pt.R,Kt),r(pt.qa,pt.ra-Jn,zn,en+8*pt.B,Jn),r(pt.Ha,pt.Ia-Jn,wi,Ci+8*pt.B,Jn))}if(!Xt)return qr(_t,6,"Output aborted.")}return 1})(W,ee)),ee.bc!=null&&ee.bc(ee),ce&=1}return ce?(W.cb=0,ce):0}function Hr(W,ee,ce,ye,Ce){Ce=W[ee+ce+32*ye]+(Ce>>3),W[ee+ce+32*ye]=-256&Ce?0>Ce?0:255:Ce}function Dn(W,ee,ce,ye,Ce,Oe){Hr(W,ee,0,ce,ye+Ce),Hr(W,ee,1,ce,ye+Oe),Hr(W,ee,2,ce,ye-Oe),Hr(W,ee,3,ce,ye-Ce)}function xn(W){return(20091*W>>16)+W}function jr(W,ee,ce,ye){var Ce,Oe=0,Le=i(16);for(Ce=0;4>Ce;++Ce){var De=W[ee+0]+W[ee+8],Be=W[ee+0]-W[ee+8],He=(35468*W[ee+4]>>16)-xn(W[ee+12]),ct=xn(W[ee+4])+(35468*W[ee+12]>>16);Le[Oe+0]=De+ct,Le[Oe+1]=Be+He,Le[Oe+2]=Be-He,Le[Oe+3]=De-ct,Oe+=4,ee++}for(Ce=Oe=0;4>Ce;++Ce)De=(W=Le[Oe+0]+4)+Le[Oe+8],Be=W-Le[Oe+8],He=(35468*Le[Oe+4]>>16)-xn(Le[Oe+12]),Hr(ce,ye,0,0,De+(ct=xn(Le[Oe+4])+(35468*Le[Oe+12]>>16))),Hr(ce,ye,1,0,Be+He),Hr(ce,ye,2,0,Be-He),Hr(ce,ye,3,0,De-ct),Oe++,ye+=32}function na(W,ee,ce,ye){var Ce=W[ee+0]+4,Oe=35468*W[ee+4]>>16,Le=xn(W[ee+4]),De=35468*W[ee+1]>>16;Dn(ce,ye,0,Ce+Le,W=xn(W[ee+1]),De),Dn(ce,ye,1,Ce+Oe,W,De),Dn(ce,ye,2,Ce-Oe,W,De),Dn(ce,ye,3,Ce-Le,W,De)}function pa(W,ee,ce,ye,Ce){jr(W,ee,ce,ye),Ce&&jr(W,ee+16,ce,ye+4)}function Ta(W,ee,ce,ye){Bp(W,ee+0,ce,ye,1),Bp(W,ee+32,ce,ye+128,1)}function Ei(W,ee,ce,ye){var Ce;for(W=W[ee+0]+4,Ce=0;4>Ce;++Ce)for(ee=0;4>ee;++ee)Hr(ce,ye,ee,Ce,W)}function sr(W,ee,ce,ye){W[ee+0]&&Vs(W,ee+0,ce,ye),W[ee+16]&&Vs(W,ee+16,ce,ye+4),W[ee+32]&&Vs(W,ee+32,ce,ye+128),W[ee+48]&&Vs(W,ee+48,ce,ye+128+4)}function Dr(W,ee,ce,ye){var Ce,Oe=i(16);for(Ce=0;4>Ce;++Ce){var Le=W[ee+0+Ce]+W[ee+12+Ce],De=W[ee+4+Ce]+W[ee+8+Ce],Be=W[ee+4+Ce]-W[ee+8+Ce],He=W[ee+0+Ce]-W[ee+12+Ce];Oe[0+Ce]=Le+De,Oe[8+Ce]=Le-De,Oe[4+Ce]=He+Be,Oe[12+Ce]=He-Be}for(Ce=0;4>Ce;++Ce)Le=(W=Oe[0+4*Ce]+3)+Oe[3+4*Ce],De=Oe[1+4*Ce]+Oe[2+4*Ce],Be=Oe[1+4*Ce]-Oe[2+4*Ce],He=W-Oe[3+4*Ce],ce[ye+0]=Le+De>>3,ce[ye+16]=He+Be>>3,ce[ye+32]=Le-De>>3,ce[ye+48]=He-Be>>3,ye+=64}function xa(W,ee,ce){var ye,Ce=ee-32,Oe=hc,Le=255-W[Ce-1];for(ye=0;ye<ce;++ye){var De,Be=Oe,He=Le+W[ee-1];for(De=0;De<ce;++De)W[ee+De]=Be[He+W[Ce+De]];ee+=32}}function ma(W,ee){xa(W,ee,4)}function mr(W,ee){xa(W,ee,8)}function ir(W,ee){xa(W,ee,16)}function Ua(W,ee){var ce;for(ce=0;16>ce;++ce)r(W,ee+32*ce,W,ee-32,16)}function Oi(W,ee){var ce;for(ce=16;0<ce;--ce)a(W,ee,W[ee-1],16),ee+=32}function vn(W,ee,ce){var ye;for(ye=0;16>ye;++ye)a(ee,ce+32*ye,W,16)}function Wn(W,ee){var ce,ye=16;for(ce=0;16>ce;++ce)ye+=W[ee-1+32*ce]+W[ee+ce-32];vn(ye>>5,W,ee)}function Un(W,ee){var ce,ye=8;for(ce=0;16>ce;++ce)ye+=W[ee-1+32*ce];vn(ye>>4,W,ee)}function yr(W,ee){var ce,ye=8;for(ce=0;16>ce;++ce)ye+=W[ee+ce-32];vn(ye>>4,W,ee)}function Aa(W,ee){vn(128,W,ee)}function cr(W,ee,ce){return W+2*ee+ce+2>>2}function vs(W,ee){var ce,ye=ee-32;for(ye=new Uint8Array([cr(W[ye-1],W[ye+0],W[ye+1]),cr(W[ye+0],W[ye+1],W[ye+2]),cr(W[ye+1],W[ye+2],W[ye+3]),cr(W[ye+2],W[ye+3],W[ye+4])]),ce=0;4>ce;++ce)r(W,ee+32*ce,ye,0,ye.length)}function ys(W,ee){var ce=W[ee-1],ye=W[ee-1+32],Ce=W[ee-1+64],Oe=W[ee-1+96];re(W,ee+0,16843009*cr(W[ee-1-32],ce,ye)),re(W,ee+32,16843009*cr(ce,ye,Ce)),re(W,ee+64,16843009*cr(ye,Ce,Oe)),re(W,ee+96,16843009*cr(Ce,Oe,Oe))}function uc(W,ee){var ce,ye=4;for(ce=0;4>ce;++ce)ye+=W[ee+ce-32]+W[ee-1+32*ce];for(ye>>=3,ce=0;4>ce;++ce)a(W,ee+32*ce,ye,4)}function Nf(W,ee){var ce=W[ee-1+0],ye=W[ee-1+32],Ce=W[ee-1+64],Oe=W[ee-1-32],Le=W[ee+0-32],De=W[ee+1-32],Be=W[ee+2-32],He=W[ee+3-32];W[ee+0+96]=cr(ye,Ce,W[ee-1+96]),W[ee+1+96]=W[ee+0+64]=cr(ce,ye,Ce),W[ee+2+96]=W[ee+1+64]=W[ee+0+32]=cr(Oe,ce,ye),W[ee+3+96]=W[ee+2+64]=W[ee+1+32]=W[ee+0+0]=cr(Le,Oe,ce),W[ee+3+64]=W[ee+2+32]=W[ee+1+0]=cr(De,Le,Oe),W[ee+3+32]=W[ee+2+0]=cr(Be,De,Le),W[ee+3+0]=cr(He,Be,De)}function Yn(W,ee){var ce=W[ee+1-32],ye=W[ee+2-32],Ce=W[ee+3-32],Oe=W[ee+4-32],Le=W[ee+5-32],De=W[ee+6-32],Be=W[ee+7-32];W[ee+0+0]=cr(W[ee+0-32],ce,ye),W[ee+1+0]=W[ee+0+32]=cr(ce,ye,Ce),W[ee+2+0]=W[ee+1+32]=W[ee+0+64]=cr(ye,Ce,Oe),W[ee+3+0]=W[ee+2+32]=W[ee+1+64]=W[ee+0+96]=cr(Ce,Oe,Le),W[ee+3+32]=W[ee+2+64]=W[ee+1+96]=cr(Oe,Le,De),W[ee+3+64]=W[ee+2+96]=cr(Le,De,Be),W[ee+3+96]=cr(De,Be,Be)}function Pr(W,ee){var ce=W[ee-1+0],ye=W[ee-1+32],Ce=W[ee-1+64],Oe=W[ee-1-32],Le=W[ee+0-32],De=W[ee+1-32],Be=W[ee+2-32],He=W[ee+3-32];W[ee+0+0]=W[ee+1+64]=Oe+Le+1>>1,W[ee+1+0]=W[ee+2+64]=Le+De+1>>1,W[ee+2+0]=W[ee+3+64]=De+Be+1>>1,W[ee+3+0]=Be+He+1>>1,W[ee+0+96]=cr(Ce,ye,ce),W[ee+0+64]=cr(ye,ce,Oe),W[ee+0+32]=W[ee+1+96]=cr(ce,Oe,Le),W[ee+1+32]=W[ee+2+96]=cr(Oe,Le,De),W[ee+2+32]=W[ee+3+96]=cr(Le,De,Be),W[ee+3+32]=cr(De,Be,He)}function Mi(W,ee){var ce=W[ee+0-32],ye=W[ee+1-32],Ce=W[ee+2-32],Oe=W[ee+3-32],Le=W[ee+4-32],De=W[ee+5-32],Be=W[ee+6-32],He=W[ee+7-32];W[ee+0+0]=ce+ye+1>>1,W[ee+1+0]=W[ee+0+64]=ye+Ce+1>>1,W[ee+2+0]=W[ee+1+64]=Ce+Oe+1>>1,W[ee+3+0]=W[ee+2+64]=Oe+Le+1>>1,W[ee+0+32]=cr(ce,ye,Ce),W[ee+1+32]=W[ee+0+96]=cr(ye,Ce,Oe),W[ee+2+32]=W[ee+1+96]=cr(Ce,Oe,Le),W[ee+3+32]=W[ee+2+96]=cr(Oe,Le,De),W[ee+3+64]=cr(Le,De,Be),W[ee+3+96]=cr(De,Be,He)}function bo(W,ee){var ce=W[ee-1+0],ye=W[ee-1+32],Ce=W[ee-1+64],Oe=W[ee-1+96];W[ee+0+0]=ce+ye+1>>1,W[ee+2+0]=W[ee+0+32]=ye+Ce+1>>1,W[ee+2+32]=W[ee+0+64]=Ce+Oe+1>>1,W[ee+1+0]=cr(ce,ye,Ce),W[ee+3+0]=W[ee+1+32]=cr(ye,Ce,Oe),W[ee+3+32]=W[ee+1+64]=cr(Ce,Oe,Oe),W[ee+3+64]=W[ee+2+64]=W[ee+0+96]=W[ee+1+96]=W[ee+2+96]=W[ee+3+96]=Oe}function fo(W,ee){var ce=W[ee-1+0],ye=W[ee-1+32],Ce=W[ee-1+64],Oe=W[ee-1+96],Le=W[ee-1-32],De=W[ee+0-32],Be=W[ee+1-32],He=W[ee+2-32];W[ee+0+0]=W[ee+2+32]=ce+Le+1>>1,W[ee+0+32]=W[ee+2+64]=ye+ce+1>>1,W[ee+0+64]=W[ee+2+96]=Ce+ye+1>>1,W[ee+0+96]=Oe+Ce+1>>1,W[ee+3+0]=cr(De,Be,He),W[ee+2+0]=cr(Le,De,Be),W[ee+1+0]=W[ee+3+32]=cr(ce,Le,De),W[ee+1+32]=W[ee+3+64]=cr(ye,ce,Le),W[ee+1+64]=W[ee+3+96]=cr(Ce,ye,ce),W[ee+1+96]=cr(Oe,Ce,ye)}function t2(W,ee){var ce;for(ce=0;8>ce;++ce)r(W,ee+32*ce,W,ee-32,8)}function _u(W,ee){var ce;for(ce=0;8>ce;++ce)a(W,ee,W[ee-1],8),ee+=32}function Dc(W,ee,ce){var ye;for(ye=0;8>ye;++ye)a(ee,ce+32*ye,W,8)}function ns(W,ee){var ce,ye=8;for(ce=0;8>ce;++ce)ye+=W[ee+ce-32]+W[ee-1+32*ce];Dc(ye>>4,W,ee)}function v1(W,ee){var ce,ye=4;for(ce=0;8>ce;++ce)ye+=W[ee+ce-32];Dc(ye>>3,W,ee)}function Dg(W,ee){var ce,ye=4;for(ce=0;8>ce;++ce)ye+=W[ee-1+32*ce];Dc(ye>>3,W,ee)}function eA(W,ee){Dc(128,W,ee)}function n2(W,ee,ce){var ye=W[ee-ce],Ce=W[ee+0],Oe=3*(Ce-ye)+Df[1020+W[ee-2*ce]-W[ee+ce]],Le=D1[112+(Oe+4>>3)];W[ee-ce]=hc[255+ye+D1[112+(Oe+3>>3)]],W[ee+0]=hc[255+Ce-Le]}function Bg(W,ee,ce,ye){var Ce=W[ee+0],Oe=W[ee+ce];return ud[255+W[ee-2*ce]-W[ee-ce]]>ye||ud[255+Oe-Ce]>ye}function y1(W,ee,ce,ye){return 4*ud[255+W[ee-ce]-W[ee+0]]+ud[255+W[ee-2*ce]-W[ee+ce]]<=ye}function tA(W,ee,ce,ye,Ce){var Oe=W[ee-3*ce],Le=W[ee-2*ce],De=W[ee-ce],Be=W[ee+0],He=W[ee+ce],ct=W[ee+2*ce],It=W[ee+3*ce];return 4*ud[255+De-Be]+ud[255+Le-He]>ye?0:ud[255+W[ee-4*ce]-Oe]<=Ce&&ud[255+Oe-Le]<=Ce&&ud[255+Le-De]<=Ce&&ud[255+It-ct]<=Ce&&ud[255+ct-He]<=Ce&&ud[255+He-Be]<=Ce}function Wd(W,ee,ce,ye){var Ce=2*ye+1;for(ye=0;16>ye;++ye)y1(W,ee+ye,ce,Ce)&&n2(W,ee+ye,ce)}function ld(W,ee,ce,ye){var Ce=2*ye+1;for(ye=0;16>ye;++ye)y1(W,ee+ye*ce,1,Ce)&&n2(W,ee+ye*ce,1)}function sd(W,ee,ce,ye){var Ce;for(Ce=3;0<Ce;--Ce)Wd(W,ee+=4*ce,ce,ye)}function P5(W,ee,ce,ye){var Ce;for(Ce=3;0<Ce;--Ce)ld(W,ee+=4,ce,ye)}function qd(W,ee,ce,ye,Ce,Oe,Le,De){for(Oe=2*Oe+1;0<Ce--;){if(tA(W,ee,ce,Oe,Le))if(Bg(W,ee,ce,De))n2(W,ee,ce);else{var Be=W,He=ee,ct=ce,It=Be[He-2*ct],Rt=Be[He-ct],_t=Be[He+0],an=Be[He+ct],Gt=Be[He+2*ct],pt=27*(Xt=Df[1020+3*(_t-Rt)+Df[1020+It-an]])+63>>7,gt=18*Xt+63>>7,Xt=9*Xt+63>>7;Be[He-3*ct]=hc[255+Be[He-3*ct]+Xt],Be[He-2*ct]=hc[255+It+gt],Be[He-ct]=hc[255+Rt+pt],Be[He+0]=hc[255+_t-pt],Be[He+ct]=hc[255+an-gt],Be[He+2*ct]=hc[255+Gt-Xt]}ee+=ye}}function Bc(W,ee,ce,ye,Ce,Oe,Le,De){for(Oe=2*Oe+1;0<Ce--;){if(tA(W,ee,ce,Oe,Le))if(Bg(W,ee,ce,De))n2(W,ee,ce);else{var Be=W,He=ee,ct=ce,It=Be[He-ct],Rt=Be[He+0],_t=Be[He+ct],an=D1[112+((Gt=3*(Rt-It))+4>>3)],Gt=D1[112+(Gt+3>>3)],pt=an+1>>1;Be[He-2*ct]=hc[255+Be[He-2*ct]+pt],Be[He-ct]=hc[255+It+Gt],Be[He+0]=hc[255+Rt-an],Be[He+ct]=hc[255+_t-pt]}ee+=ye}}function b1(W,ee,ce,ye,Ce,Oe){qd(W,ee,ce,1,16,ye,Ce,Oe)}function Bl(W,ee,ce,ye,Ce,Oe){qd(W,ee,1,ce,16,ye,Ce,Oe)}function r2(W,ee,ce,ye,Ce,Oe){var Le;for(Le=3;0<Le;--Le)Bc(W,ee+=4*ce,ce,1,16,ye,Ce,Oe)}function a2(W,ee,ce,ye,Ce,Oe){var Le;for(Le=3;0<Le;--Le)Bc(W,ee+=4,1,ce,16,ye,Ce,Oe)}function Pg(W,ee,ce,ye,Ce,Oe,Le,De){qd(W,ee,Ce,1,8,Oe,Le,De),qd(ce,ye,Ce,1,8,Oe,Le,De)}function nA(W,ee,ce,ye,Ce,Oe,Le,De){qd(W,ee,1,Ce,8,Oe,Le,De),qd(ce,ye,1,Ce,8,Oe,Le,De)}function $g(W,ee,ce,ye,Ce,Oe,Le,De){Bc(W,ee+4*Ce,Ce,1,8,Oe,Le,De),Bc(ce,ye+4*Ce,Ce,1,8,Oe,Le,De)}function _1(W,ee,ce,ye,Ce,Oe,Le,De){Bc(W,ee+4,1,Ce,8,Oe,Le,De),Bc(ce,ye+4,1,Ce,8,Oe,Le,De)}function Of(){this.ba=new ot,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new Ot,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function i2(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function S1(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function $5(){this.ua=0,this.Wa=new ie,this.vb=new ie,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new M,this.yc=new L}function E_(){this.xb=this.a=0,this.l=new Vn,this.ca=new ot,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new F,this.Pb=0,this.wd=new F,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new $5,this.ab=0,this.gc=o(4,S1),this.Oc=0}function x1(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new Vn,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function Mp(W,ee,ce,ye,Ce,Oe,Le){for(W=W==null?0:W[ee+0],ee=0;ee<Le;++ee)Ce[Oe+ee]=W+ce[ye+ee]&255,W=Ce[Oe+ee]}function rA(W,ee,ce,ye,Ce,Oe,Le){var De;if(W==null)Mp(null,null,ce,ye,Ce,Oe,Le);else for(De=0;De<Le;++De)Ce[Oe+De]=W[ee+De]+ce[ye+De]&255}function o2(W,ee,ce,ye,Ce,Oe,Le){if(W==null)Mp(null,null,ce,ye,Ce,Oe,Le);else{var De,Be=W[ee+0],He=Be,ct=Be;for(De=0;De<Le;++De)He=ct+(Be=W[ee+De])-He,ct=ce[ye+De]+(-256&He?0>He?0:255:He)&255,He=Be,Ce[Oe+De]=ct}}function aA(W,ee,ce,ye){var Ce=ee.width,Oe=ee.o;if(t(W!=null&&ee!=null),0>ce||0>=ye||ce+ye>Oe)return null;if(!W.Cc){if(W.ga==null){var Le;if(W.ga=new x1,(Le=W.ga==null)||(Le=ee.width*ee.o,t(W.Gb.length==0),W.Gb=i(Le),W.Uc=0,W.Gb==null?Le=0:(W.mb=W.Gb,W.nb=W.Uc,W.rc=null,Le=1),Le=!Le),!Le){Le=W.ga;var De=W.Fa,Be=W.P,He=W.qc,ct=W.mb,It=W.nb,Rt=Be+1,_t=He-1,an=Le.l;if(t(De!=null&&ct!=null&&ee!=null),Ws[0]=null,Ws[1]=Mp,Ws[2]=rA,Ws[3]=o2,Le.ca=ct,Le.tb=It,Le.c=ee.width,Le.i=ee.height,t(0<Le.c&&0<Le.i),1>=He)ee=0;else if(Le.$a=De[Be+0]>>0&3,Le.Z=De[Be+0]>>2&3,Le.Lc=De[Be+0]>>4&3,Be=De[Be+0]>>6&3,0>Le.$a||1<Le.$a||4<=Le.Z||1<Le.Lc||Be)ee=0;else if(an.put=At,an.ac=ht,an.bc=Et,an.ma=Le,an.width=ee.width,an.height=ee.height,an.Da=ee.Da,an.v=ee.v,an.va=ee.va,an.j=ee.j,an.o=ee.o,Le.$a)e:{t(Le.$a==1),ee=lr();t:for(;;){if(ee==null){ee=0;break e}if(t(Le!=null),Le.mc=ee,ee.c=Le.c,ee.i=Le.i,ee.l=Le.l,ee.l.ma=Le,ee.l.width=Le.c,ee.l.height=Le.i,ee.a=0,P(ee.m,De,Rt,_t),!Cr(Le.c,Le.i,1,ee,null)||(ee.ab==1&&ee.gc[0].hc==3&&Jt(ee.s)?(Le.ic=1,De=ee.c*ee.i,ee.Ta=null,ee.Ua=0,ee.V=i(De),ee.Ba=0,ee.V==null?(ee.a=1,ee=0):ee=1):(Le.ic=0,ee=sn(ee,Le.c)),!ee))break t;ee=1;break e}Le.mc=null,ee=0}else ee=_t>=Le.c*Le.i;Le=!ee}if(Le)return null;W.ga.Lc!=1?W.Ga=0:ye=Oe-ce}t(W.ga!=null),t(ce+ye<=Oe);e:{if(ee=(De=W.ga).c,Oe=De.l.o,De.$a==0){if(Rt=W.rc,_t=W.Vc,an=W.Fa,Be=W.P+1+ce*ee,He=W.mb,ct=W.nb+ce*ee,t(Be<=W.P+W.qc),De.Z!=0)for(t(Ws[De.Z]!=null),Le=0;Le<ye;++Le)Ws[De.Z](Rt,_t,an,Be,He,ct,ee),Rt=He,_t=ct,ct+=ee,Be+=ee;else for(Le=0;Le<ye;++Le)r(He,ct,an,Be,ee),Rt=He,_t=ct,ct+=ee,Be+=ee;W.rc=Rt,W.Vc=_t}else{if(t(De.mc!=null),ee=ce+ye,t((Le=De.mc)!=null),t(ee<=Le.i),Le.C>=ee)ee=1;else if(De.ic||Ct(),De.ic){De=Le.V,Rt=Le.Ba,_t=Le.c;var Gt=Le.i,pt=(an=1,Be=Le.$/_t,He=Le.$%_t,ct=Le.m,It=Le.s,Le.$),gt=_t*Gt,Xt=_t*ee,Kt=It.wc,en=pt<Xt?$t(It,He,Be):null;t(pt<=gt),t(ee<=Gt),t(Jt(It));t:for(;;){for(;!ct.h&&pt<Xt;){if(He&Kt||(en=$t(It,He,Be)),t(en!=null),Y(ct),256>(Gt=zt(en.G[0],en.H[0],ct)))De[Rt+pt]=Gt,++pt,++He>=_t&&(He=0,++Be<=ee&&!(Be%16)&&bn(Le,Be));else{if(!(280>Gt)){an=0;break t}Gt=Dt(Gt-256,ct);var Jn,$n=zt(en.G[4],en.H[4],ct);if(Y(ct),!(pt>=($n=Lt(_t,$n=Dt($n,ct)))&>-pt>=Gt)){an=0;break t}for(Jn=0;Jn<Gt;++Jn)De[Rt+pt+Jn]=De[Rt+pt+Jn-$n];for(pt+=Gt,He+=Gt;He>=_t;)He-=_t,++Be<=ee&&!(Be%16)&&bn(Le,Be);pt<Xt&&He&Kt&&(en=$t(It,He,Be))}t(ct.h==q(ct))}bn(Le,Be>ee?ee:Be);break t}!an||ct.h&&pt<gt?(an=0,Le.a=ct.h?5:3):Le.$=pt,ee=an}else ee=Cn(Le,Le.V,Le.Ba,Le.c,Le.i,ee,tt);if(!ee){ye=0;break e}}ce+ye>=Oe&&(W.Cc=1),ye=1}if(!ye)return null;if(W.Cc&&((ye=W.ga)!=null&&(ye.mc=null),W.ga=null,0<W.Ga))return alert("todo:WebPDequantizeLevels"),null}return W.nb+ce*Ce}function ae(W,ee,ce,ye,Ce,Oe){for(;0<Ce--;){var Le,De=W,Be=ee+(ce?1:0),He=W,ct=ee+(ce?0:3);for(Le=0;Le<ye;++Le){var It=He[ct+4*Le];It!=255&&(It*=32897,De[Be+4*Le+0]=De[Be+4*Le+0]*It>>23,De[Be+4*Le+1]=De[Be+4*Le+1]*It>>23,De[Be+4*Le+2]=De[Be+4*Le+2]*It>>23)}ee+=Oe}}function Te(W,ee,ce,ye,Ce){for(;0<ye--;){var Oe;for(Oe=0;Oe<ce;++Oe){var Le=W[ee+2*Oe+0],De=15&(He=W[ee+2*Oe+1]),Be=4369*De,He=(240&He|He>>4)*Be>>16;W[ee+2*Oe+0]=(240&Le|Le>>4)*Be>>16&240|(15&Le|Le<<4)*Be>>16>>4&15,W[ee+2*Oe+1]=240&He|De}ee+=Ce}}function Ye(W,ee,ce,ye,Ce,Oe,Le,De){var Be,He,ct=255;for(He=0;He<Ce;++He){for(Be=0;Be<ye;++Be){var It=W[ee+Be];Oe[Le+4*Be]=It,ct&=It}ee+=ce,Le+=De}return ct!=255}function st(W,ee,ce,ye,Ce){var Oe;for(Oe=0;Oe<Ce;++Oe)ce[ye+Oe]=W[ee+Oe]>>8}function Ct(){Pc=ae,po=Te,Vi=Ye,tl=st}function Yt(W,ee,ce){w[W]=function(ye,Ce,Oe,Le,De,Be,He,ct,It,Rt,_t,an,Gt,pt,gt,Xt,Kt){var en,Jn=Kt-1>>1,$n=De[Be+0]|He[ct+0]<<16,Gr=It[Rt+0]|_t[an+0]<<16;t(ye!=null);var zn=3*$n+Gr+131074>>2;for(ee(ye[Ce+0],255&zn,zn>>16,Gt,pt),Oe!=null&&(zn=3*Gr+$n+131074>>2,ee(Oe[Le+0],255&zn,zn>>16,gt,Xt)),en=1;en<=Jn;++en){var wi=De[Be+en]|He[ct+en]<<16,Ci=It[Rt+en]|_t[an+en]<<16,fi=$n+wi+Gr+Ci+524296,za=fi+2*(wi+Gr)>>3;zn=za+$n>>1,$n=(fi=fi+2*($n+Ci)>>3)+wi>>1,ee(ye[Ce+2*en-1],255&zn,zn>>16,Gt,pt+(2*en-1)*ce),ee(ye[Ce+2*en-0],255&$n,$n>>16,Gt,pt+(2*en-0)*ce),Oe!=null&&(zn=fi+Gr>>1,$n=za+Ci>>1,ee(Oe[Le+2*en-1],255&zn,zn>>16,gt,Xt+(2*en-1)*ce),ee(Oe[Le+2*en+0],255&$n,$n>>16,gt,Xt+(2*en+0)*ce)),$n=wi,Gr=Ci}1&Kt||(zn=3*$n+Gr+131074>>2,ee(ye[Ce+Kt-1],255&zn,zn>>16,Gt,pt+(Kt-1)*ce),Oe!=null&&(zn=3*Gr+$n+131074>>2,ee(Oe[Le+Kt-1],255&zn,zn>>16,gt,Xt+(Kt-1)*ce)))}}function gn(){Fc[U5]=sF,Fc[d2]=f2,Fc[LC]=cF,Fc[cA]=F1,Fc[uA]=Kg,Fc[ho]=gA,Fc[z5]=I_,Fc[B1]=f2,Fc[qg]=F1,Fc[dA]=Kg,Fc[fA]=gA}function Kn(W){return W&-16384?0>W?0:255:W>>p2}function $r(W,ee){return Kn((19077*W>>8)+(26149*ee>>8)-14234)}function Ia(W,ee,ce){return Kn((19077*W>>8)-(6419*ee>>8)-(13320*ce>>8)+8708)}function Ea(W,ee){return Kn((19077*W>>8)+(33050*ee>>8)-17685)}function ci(W,ee,ce,ye,Ce){ye[Ce+0]=$r(W,ce),ye[Ce+1]=Ia(W,ee,ce),ye[Ce+2]=Ea(W,ee)}function Uo(W,ee,ce,ye,Ce){ye[Ce+0]=Ea(W,ee),ye[Ce+1]=Ia(W,ee,ce),ye[Ce+2]=$r(W,ce)}function Jo(W,ee,ce,ye,Ce){var Oe=Ia(W,ee,ce);ee=Oe<<3&224|Ea(W,ee)>>3,ye[Ce+0]=248&$r(W,ce)|Oe>>5,ye[Ce+1]=ee}function _l(W,ee,ce,ye,Ce){var Oe=240&Ea(W,ee)|15;ye[Ce+0]=240&$r(W,ce)|Ia(W,ee,ce)>>4,ye[Ce+1]=Oe}function js(W,ee,ce,ye,Ce){ye[Ce+0]=255,ci(W,ee,ce,ye,Ce+1)}function rs(W,ee,ce,ye,Ce){Uo(W,ee,ce,ye,Ce),ye[Ce+3]=255}function Qd(W,ee,ce,ye,Ce){ci(W,ee,ce,ye,Ce),ye[Ce+3]=255}function Su(W,ee){return 0>W?0:W>ee?ee:W}function cd(W,ee,ce){w[W]=function(ye,Ce,Oe,Le,De,Be,He,ct,It){for(var Rt=ct+(-2&It)*ce;ct!=Rt;)ee(ye[Ce+0],Oe[Le+0],De[Be+0],He,ct),ee(ye[Ce+1],Oe[Le+0],De[Be+0],He,ct+ce),Ce+=2,++Le,++Be,ct+=2*ce;1&It&&ee(ye[Ce+0],Oe[Le+0],De[Be+0],He,ct)}}function l2(W,ee,ce){return ce==0?W==0?ee==0?6:5:ee==0?4:0:ce}function iA(W,ee,ce,ye,Ce){switch(W>>>30){case 3:Bp(ee,ce,ye,Ce,0);break;case 2:Li(ee,ce,ye,Ce);break;case 1:Vs(ee,ce,ye,Ce)}}function E1(W,ee){var ce,ye,Ce=ee.M,Oe=ee.Nb,Le=W.oc,De=W.pc+40,Be=W.oc,He=W.pc+584,ct=W.oc,It=W.pc+600;for(ce=0;16>ce;++ce)Le[De+32*ce-1]=129;for(ce=0;8>ce;++ce)Be[He+32*ce-1]=129,ct[It+32*ce-1]=129;for(0<Ce?Le[De-1-32]=Be[He-1-32]=ct[It-1-32]=129:(a(Le,De-32-1,127,21),a(Be,He-32-1,127,9),a(ct,It-32-1,127,9)),ye=0;ye<W.za;++ye){var Rt=ee.ya[ee.aa+ye];if(0<ye){for(ce=-1;16>ce;++ce)r(Le,De+32*ce-4,Le,De+32*ce+12,4);for(ce=-1;8>ce;++ce)r(Be,He+32*ce-4,Be,He+32*ce+4,4),r(ct,It+32*ce-4,ct,It+32*ce+4,4)}var _t=W.Gd,an=W.Hd+ye,Gt=Rt.ad,pt=Rt.Hc;if(0<Ce&&(r(Le,De-32,_t[an].y,0,16),r(Be,He-32,_t[an].f,0,8),r(ct,It-32,_t[an].ea,0,8)),Rt.Za){var gt=Le,Xt=De-32+16;for(0<Ce&&(ye>=W.za-1?a(gt,Xt,_t[an].y[15],4):r(gt,Xt,_t[an+1].y,0,4)),ce=0;4>ce;ce++)gt[Xt+128+ce]=gt[Xt+256+ce]=gt[Xt+384+ce]=gt[Xt+0+ce];for(ce=0;16>ce;++ce,pt<<=2)gt=Le,Xt=De+R_[ce],dd[Rt.Ob[ce]](gt,Xt),iA(pt,Gt,16*+ce,gt,Xt)}else if(gt=l2(ye,Ce,Rt.Ob[0]),gc[gt](Le,De),pt!=0)for(ce=0;16>ce;++ce,pt<<=2)iA(pt,Gt,16*+ce,Le,De+R_[ce]);for(ce=Rt.Gc,gt=l2(ye,Ce,Rt.Dd),$c[gt](Be,He),$c[gt](ct,It),pt=Gt,gt=Be,Xt=He,255&(Rt=ce>>0)&&(170&Rt?Pp(pt,256,gt,Xt):xu(pt,256,gt,Xt)),Rt=ct,pt=It,255&(ce>>=8)&&(170&ce?Pp(Gt,320,Rt,pt):xu(Gt,320,Rt,pt)),Ce<W.Ub-1&&(r(_t[an].y,0,Le,De+480,16),r(_t[an].f,0,Be,He+224,8),r(_t[an].ea,0,ct,It+224,8)),ce=8*Oe*W.B,_t=W.sa,an=W.ta+16*ye+16*Oe*W.R,Gt=W.qa,Rt=W.ra+8*ye+ce,pt=W.Ha,gt=W.Ia+8*ye+ce,ce=0;16>ce;++ce)r(_t,an+ce*W.R,Le,De+32*ce,16);for(ce=0;8>ce;++ce)r(Gt,Rt+ce*W.B,Be,He+32*ce,8),r(pt,gt+ce*W.B,ct,It+32*ce,8)}}function Fg(W,ee,ce,ye,Ce,Oe,Le,De,Be){var He=[0],ct=[0],It=0,Rt=Be!=null?Be.kd:0,_t=Be??new i2;if(W==null||12>ce)return 7;_t.data=W,_t.w=ee,_t.ha=ce,ee=[ee],ce=[ce],_t.gb=[_t.gb];e:{var an=ee,Gt=ce,pt=_t.gb;if(t(W!=null),t(Gt!=null),t(pt!=null),pt[0]=0,12<=Gt[0]&&!n(W,an[0],"RIFF")){if(n(W,an[0]+8,"WEBP")){pt=3;break e}var gt=oe(W,an[0]+4);if(12>gt||4294967286<gt){pt=3;break e}if(Rt&>>Gt[0]-8){pt=7;break e}pt[0]=gt,an[0]+=12,Gt[0]-=12}pt=0}if(pt!=0)return pt;for(gt=0<_t.gb[0],ce=ce[0];;){e:{var Xt=W;Gt=ee,pt=ce;var Kt=He,en=ct,Jn=an=[0];if((zn=It=[It])[0]=0,8>pt[0])pt=7;else{if(!n(Xt,Gt[0],"VP8X")){if(oe(Xt,Gt[0]+4)!=10){pt=3;break e}if(18>pt[0]){pt=7;break e}var $n=oe(Xt,Gt[0]+8),Gr=1+ne(Xt,Gt[0]+12);if(2147483648<=Gr*(Xt=1+ne(Xt,Gt[0]+15))){pt=3;break e}Jn!=null&&(Jn[0]=$n),Kt!=null&&(Kt[0]=Gr),en!=null&&(en[0]=Xt),Gt[0]+=18,pt[0]-=18,zn[0]=1}pt=0}}if(It=It[0],an=an[0],pt!=0)return pt;if(Gt=!!(2&an),!gt&&It)return 3;if(Oe!=null&&(Oe[0]=!!(16&an)),Le!=null&&(Le[0]=Gt),De!=null&&(De[0]=0),Le=He[0],an=ct[0],It&&Gt&&Be==null){pt=0;break}if(4>ce){pt=7;break}if(gt&&It||!gt&&!It&&!n(W,ee[0],"ALPH")){ce=[ce],_t.na=[_t.na],_t.P=[_t.P],_t.Sa=[_t.Sa];e:{$n=W,pt=ee,gt=ce;var zn=_t.gb;Kt=_t.na,en=_t.P,Jn=_t.Sa,Gr=22,t($n!=null),t(gt!=null),Xt=pt[0];var wi=gt[0];for(t(Kt!=null),t(Jn!=null),Kt[0]=null,en[0]=null,Jn[0]=0;;){if(pt[0]=Xt,gt[0]=wi,8>wi){pt=7;break e}var Ci=oe($n,Xt+4);if(4294967286<Ci){pt=3;break e}var fi=8+Ci+1&-2;if(Gr+=fi,0<zn&&Gr>zn){pt=3;break e}if(!n($n,Xt,"VP8 ")||!n($n,Xt,"VP8L")){pt=0;break e}if(wi[0]<fi){pt=7;break e}n($n,Xt,"ALPH")||(Kt[0]=$n,en[0]=Xt+8,Jn[0]=Ci),Xt+=fi,wi-=fi}}if(ce=ce[0],_t.na=_t.na[0],_t.P=_t.P[0],_t.Sa=_t.Sa[0],pt!=0)break}ce=[ce],_t.Ja=[_t.Ja],_t.xa=[_t.xa];e:if(zn=W,pt=ee,gt=ce,Kt=_t.gb[0],en=_t.Ja,Jn=_t.xa,$n=pt[0],Xt=!n(zn,$n,"VP8 "),Gr=!n(zn,$n,"VP8L"),t(zn!=null),t(gt!=null),t(en!=null),t(Jn!=null),8>gt[0])pt=7;else{if(Xt||Gr){if(zn=oe(zn,$n+4),12<=Kt&&zn>Kt-12){pt=3;break e}if(Rt&&zn>gt[0]-8){pt=7;break e}en[0]=zn,pt[0]+=8,gt[0]-=8,Jn[0]=Gr}else Jn[0]=5<=gt[0]&&zn[$n+0]==47&&!(zn[$n+4]>>5),en[0]=gt[0];pt=0}if(ce=ce[0],_t.Ja=_t.Ja[0],_t.xa=_t.xa[0],ee=ee[0],pt!=0)break;if(4294967286<_t.Ja)return 3;if(De==null||Gt||(De[0]=_t.xa?2:1),Le=[Le],an=[an],_t.xa){if(5>ce){pt=7;break}De=Le,Rt=an,Gt=Oe,W==null||5>ce?W=0:5<=ce&&W[ee+0]==47&&!(W[ee+4]>>5)?(gt=[0],zn=[0],Kt=[0],P(en=new F,W,ee,ce),wt(en,gt,zn,Kt)?(De!=null&&(De[0]=gt[0]),Rt!=null&&(Rt[0]=zn[0]),Gt!=null&&(Gt[0]=Kt[0]),W=1):W=0):W=0}else{if(10>ce){pt=7;break}De=an,W==null||10>ce||!Ga(W,ee+3,ce-3)?W=0:(Rt=W[ee+0]|W[ee+1]<<8|W[ee+2]<<16,Gt=16383&(W[ee+7]<<8|W[ee+6]),W=16383&(W[ee+9]<<8|W[ee+8]),1&Rt||3<(Rt>>1&7)||!(Rt>>4&1)||Rt>>5>=_t.Ja||!Gt||!W?W=0:(Le&&(Le[0]=Gt),De&&(De[0]=W),W=1))}if(!W||(Le=Le[0],an=an[0],It&&(He[0]!=Le||ct[0]!=an)))return 3;Be!=null&&(Be[0]=_t,Be.offset=ee-Be.w,t(4294967286>ee-Be.w),t(Be.offset==Be.ha-ce));break}return pt==0||pt==7&&It&&Be==null?(Oe!=null&&(Oe[0]|=_t.na!=null&&0<_t.na.length),ye!=null&&(ye[0]=Le),Ce!=null&&(Ce[0]=an),0):pt}function w1(W,ee,ce){var ye=ee.width,Ce=ee.height,Oe=0,Le=0,De=ye,Be=Ce;if(ee.Da=W!=null&&0<W.Da,ee.Da&&(De=W.cd,Be=W.bd,Oe=W.v,Le=W.j,11>ce||(Oe&=-2,Le&=-2),0>Oe||0>Le||0>=De||0>=Be||Oe+De>ye||Le+Be>Ce))return 0;if(ee.v=Oe,ee.j=Le,ee.va=Oe+De,ee.o=Le+Be,ee.U=De,ee.T=Be,ee.da=W!=null&&0<W.da,ee.da){if(!be(De,Be,ce=[W.ib],Oe=[W.hb]))return 0;ee.ib=ce[0],ee.hb=Oe[0]}return ee.ob=W!=null&&W.ob,ee.Kb=W==null||!W.Sd,ee.da&&(ee.ob=ee.ib<3*ye/4&&ee.hb<3*Ce/4,ee.Kb=0),1}function C1(W){if(W==null)return 2;if(11>W.S){var ee=W.f.RGBA;ee.fb+=(W.height-1)*ee.A,ee.A=-ee.A}else ee=W.f.kb,W=W.height,ee.O+=(W-1)*ee.fa,ee.fa=-ee.fa,ee.N+=(W-1>>1)*ee.Ab,ee.Ab=-ee.Ab,ee.W+=(W-1>>1)*ee.Db,ee.Db=-ee.Db,ee.F!=null&&(ee.J+=(W-1)*ee.lb,ee.lb=-ee.lb);return 0}function Ug(W,ee,ce,ye){if(ye==null||0>=W||0>=ee)return 2;if(ce!=null){if(ce.Da){var Ce=ce.cd,Oe=ce.bd,Le=-2&ce.v,De=-2&ce.j;if(0>Le||0>De||0>=Ce||0>=Oe||Le+Ce>W||De+Oe>ee)return 2;W=Ce,ee=Oe}if(ce.da){if(!be(W,ee,Ce=[ce.ib],Oe=[ce.hb]))return 2;W=Ce[0],ee=Oe[0]}}ye.width=W,ye.height=ee;e:{var Be=ye.width,He=ye.height;if(W=ye.S,0>=Be||0>=He||!(W>=U5&&13>W))W=2;else{if(0>=ye.Rd&&ye.sd==null){Le=Oe=Ce=ee=0;var ct=(De=Be*mA[W])*He;if(11>W||(Oe=(He+1)/2*(ee=(Be+1)/2),W==12&&(Le=(Ce=Be)*He)),(He=i(ct+2*Oe+Le))==null){W=1;break e}ye.sd=He,11>W?((Be=ye.f.RGBA).eb=He,Be.fb=0,Be.A=De,Be.size=ct):((Be=ye.f.kb).y=He,Be.O=0,Be.fa=De,Be.Fd=ct,Be.f=He,Be.N=0+ct,Be.Ab=ee,Be.Cd=Oe,Be.ea=He,Be.W=0+ct+Oe,Be.Db=ee,Be.Ed=Oe,W==12&&(Be.F=He,Be.J=0+ct+2*Oe),Be.Tc=Le,Be.lb=Ce)}if(ee=1,Ce=ye.S,Oe=ye.width,Le=ye.height,Ce>=U5&&13>Ce)if(11>Ce)W=ye.f.RGBA,ee&=(De=Math.abs(W.A))*(Le-1)+Oe<=W.size,ee&=De>=Oe*mA[Ce],ee&=W.eb!=null;else{W=ye.f.kb,De=(Oe+1)/2,ct=(Le+1)/2,Be=Math.abs(W.fa),He=Math.abs(W.Ab);var It=Math.abs(W.Db),Rt=Math.abs(W.lb),_t=Rt*(Le-1)+Oe;ee&=Be*(Le-1)+Oe<=W.Fd,ee&=He*(ct-1)+De<=W.Cd,ee=(ee&=It*(ct-1)+De<=W.Ed)&Be>=Oe&He>=De&It>=De,ee&=W.y!=null,ee&=W.f!=null,ee&=W.ea!=null,Ce==12&&(ee&=Rt>=Oe,ee&=_t<=W.Tc,ee&=W.F!=null)}else ee=0;W=ee?0:2}}return W!=0||ce!=null&&ce.fd&&(W=C1(ye)),W}var el=64,T1=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],I1=24,R1=32,N1=8,dc=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];ge("Predictor0","PredictorAdd0"),w.Predictor0=function(){return 4278190080},w.Predictor1=function(W){return W},w.Predictor2=function(W,ee,ce){return ee[ce+0]},w.Predictor3=function(W,ee,ce){return ee[ce+1]},w.Predictor4=function(W,ee,ce){return ee[ce-1]},w.Predictor5=function(W,ee,ce){return me(me(W,ee[ce+1]),ee[ce+0])},w.Predictor6=function(W,ee,ce){return me(W,ee[ce-1])},w.Predictor7=function(W,ee,ce){return me(W,ee[ce+0])},w.Predictor8=function(W,ee,ce){return me(ee[ce-1],ee[ce+0])},w.Predictor9=function(W,ee,ce){return me(ee[ce+0],ee[ce+1])},w.Predictor10=function(W,ee,ce){return me(me(W,ee[ce-1]),me(ee[ce+0],ee[ce+1]))},w.Predictor11=function(W,ee,ce){var ye=ee[ce+0];return 0>=Pe(ye>>24&255,W>>24&255,(ee=ee[ce-1])>>24&255)+Pe(ye>>16&255,W>>16&255,ee>>16&255)+Pe(ye>>8&255,W>>8&255,ee>>8&255)+Pe(255&ye,255&W,255&ee)?ye:W},w.Predictor12=function(W,ee,ce){var ye=ee[ce+0];return(Se((W>>24&255)+(ye>>24&255)-((ee=ee[ce-1])>>24&255))<<24|Se((W>>16&255)+(ye>>16&255)-(ee>>16&255))<<16|Se((W>>8&255)+(ye>>8&255)-(ee>>8&255))<<8|Se((255&W)+(255&ye)-(255&ee)))>>>0},w.Predictor13=function(W,ee,ce){var ye=ee[ce-1];return(xe((W=me(W,ee[ce+0]))>>24&255,ye>>24&255)<<24|xe(W>>16&255,ye>>16&255)<<16|xe(W>>8&255,ye>>8&255)<<8|xe(W>>0&255,ye>>0&255))>>>0};var zg=w.PredictorAdd0;w.PredictorAdd1=$e,ge("Predictor2","PredictorAdd2"),ge("Predictor3","PredictorAdd3"),ge("Predictor4","PredictorAdd4"),ge("Predictor5","PredictorAdd5"),ge("Predictor6","PredictorAdd6"),ge("Predictor7","PredictorAdd7"),ge("Predictor8","PredictorAdd8"),ge("Predictor9","PredictorAdd9"),ge("Predictor10","PredictorAdd10"),ge("Predictor11","PredictorAdd11"),ge("Predictor12","PredictorAdd12"),ge("Predictor13","PredictorAdd13");var Lp=w.PredictorAdd2;dt("ColorIndexInverseTransform","MapARGB","32b",(function(W){return W>>8&255}),(function(W){return W})),dt("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",(function(W){return W}),(function(W){return W>>8&255}));var F5,fc=w.ColorIndexInverseTransform,O1=w.MapARGB,oA=w.VP8LColorIndexInverseTransformAlpha,M1=w.MapAlpha,Mf=w.VP8LPredictorsAdd=[];Mf.length=16,(w.VP8LPredictors=[]).length=16,(w.VP8LPredictorsAdd_C=[]).length=16,(w.VP8LPredictors_C=[]).length=16;var s2,pc,Gs,c2,kp,Dp,L1,Bp,Li,Pp,Vs,xu,Hg,lA,jg,Gg,Vg,Eu,$p,Lf,Fp,Up,u2,bs,Pc,po,Vi,tl,Sl=i(511),kf=i(2041),k1=i(225),Wg=i(767),sA=0,Df=kf,D1=k1,hc=Wg,ud=Sl,U5=0,d2=1,LC=2,cA=3,uA=4,ho=5,z5=6,B1=7,qg=8,dA=9,fA=10,pA=[2,3,7],H5=[3,3,11],Qg=[280,256,256,256,40],kC=[0,1,1,1,0],aF=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],iF=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],DC=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],j5=8,P1=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],hA=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],Yg=null,w_=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],C_=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],BC=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],PC=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],oF=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],lF=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],T_=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],gc=[],dd=[],$c=[],Bf=1,$1=2,Ws=[],Fc=[];Yt("UpsampleRgbLinePair",ci,3),Yt("UpsampleBgrLinePair",Uo,3),Yt("UpsampleRgbaLinePair",Qd,4),Yt("UpsampleBgraLinePair",rs,4),Yt("UpsampleArgbLinePair",js,4),Yt("UpsampleRgba4444LinePair",_l,2),Yt("UpsampleRgb565LinePair",Jo,2);var sF=w.UpsampleRgbLinePair,cF=w.UpsampleBgrLinePair,f2=w.UpsampleRgbaLinePair,F1=w.UpsampleBgraLinePair,Kg=w.UpsampleArgbLinePair,gA=w.UpsampleRgba4444LinePair,I_=w.UpsampleRgb565LinePair,zp=16,Yd=1<<zp-1,Wi=-227,to=482,p2=6,_s=0,Uc=i(256),Xg=i(256),U1=i(256),zc=i(256),G5=i(to-Wi),$C=i(to-Wi);cd("YuvToRgbRow",ci,3),cd("YuvToBgrRow",Uo,3),cd("YuvToRgbaRow",Qd,4),cd("YuvToBgraRow",rs,4),cd("YuvToArgbRow",js,4),cd("YuvToRgba4444Row",_l,2),cd("YuvToRgb565Row",Jo,2);var R_=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Zg=[0,2,8],FC=[8,7,6,4,4,2,2,2,1,1,1,1],Hp=1;this.WebPDecodeRGBA=function(W,ee,ce,ye,Ce){var Oe=d2,Le=new Of,De=new ot;Le.ba=De,De.S=Oe,De.width=[De.width],De.height=[De.height];var Be=De.width,He=De.height,ct=new lt;if(ct==null||W==null)var It=2;else t(ct!=null),It=Fg(W,ee,ce,ct.width,ct.height,ct.Pd,ct.Qd,ct.format,null);if(It!=0?Be=0:(Be!=null&&(Be[0]=ct.width[0]),He!=null&&(He[0]=ct.height[0]),Be=1),Be){De.width=De.width[0],De.height=De.height[0],ye!=null&&(ye[0]=De.width),Ce!=null&&(Ce[0]=De.height);e:{if(ye=new Vn,(Ce=new i2).data=W,Ce.w=ee,Ce.ha=ce,Ce.kd=1,ee=[0],t(Ce!=null),((W=Fg(Ce.data,Ce.w,Ce.ha,null,null,null,ee,null,Ce))==0||W==7)&&ee[0]&&(W=4),(ee=W)==0){if(t(Le!=null),ye.data=Ce.data,ye.w=Ce.w+Ce.offset,ye.ha=Ce.ha-Ce.offset,ye.put=At,ye.ac=ht,ye.bc=Et,ye.ma=Le,Ce.xa){if((W=lr())==null){Le=1;break e}if((function(Rt,_t){var an=[0],Gt=[0],pt=[0];t:for(;;){if(Rt==null)return 0;if(_t==null)return Rt.a=2,0;if(Rt.l=_t,Rt.a=0,P(Rt.m,_t.data,_t.w,_t.ha),!wt(Rt.m,an,Gt,pt)){Rt.a=3;break t}if(Rt.xb=$1,_t.width=an[0],_t.height=Gt[0],!Cr(an[0],Gt[0],1,Rt,null))break t;return 1}return t(Rt.a!=0),0})(W,ye)){if(ye=(ee=Ug(ye.width,ye.height,Le.Oa,Le.ba))==0){t:{ye=W;n:for(;;){if(ye==null){ye=0;break t}if(t(ye.s.yc!=null),t(ye.s.Ya!=null),t(0<ye.s.Wb),t((ce=ye.l)!=null),t((Ce=ce.ma)!=null),ye.xb!=0){if(ye.ca=Ce.ba,ye.tb=Ce.tb,t(ye.ca!=null),!w1(Ce.Oa,ce,cA)){ye.a=2;break n}if(!sn(ye,ce.width)||ce.da)break n;if((ce.da||Re(ye.ca.S))&&Ct(),11>ye.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),ye.ca.f.kb.F!=null&&Ct()),ye.Pb&&0<ye.s.ua&&ye.s.vb.X==null&&!de(ye.s.vb,ye.s.Wa.Xa)){ye.a=1;break n}ye.xb=0}if(!Cn(ye,ye.V,ye.Ba,ye.c,ye.i,ce.o,fn))break n;Ce.Dc=ye.Ma,ye=1;break t}t(ye.a!=0),ye=0}ye=!ye}ye&&(ee=W.a)}else ee=W.a}else{if((W=new Mr)==null){Le=1;break e}if(W.Fa=Ce.na,W.P=Ce.P,W.qc=Ce.Sa,ei(W,ye)){if((ee=Ug(ye.width,ye.height,Le.Oa,Le.ba))==0){if(W.Aa=0,ce=Le.Oa,t((Ce=W)!=null),ce!=null){if(0<(Be=0>(Be=ce.Md)?0:100<Be?255:255*Be/100)){for(He=ct=0;4>He;++He)12>(It=Ce.pb[He]).lc&&(It.ia=Be*FC[0>It.lc?0:It.lc]>>3),ct|=It.ia;ct&&(alert("todo:VP8InitRandom"),Ce.ia=1)}Ce.Ga=ce.Id,100<Ce.Ga?Ce.Ga=100:0>Ce.Ga&&(Ce.Ga=0)}Pi(W,ye)||(ee=W.a)}}else ee=W.a}ee==0&&Le.Oa!=null&&Le.Oa.fd&&(ee=C1(Le.ba))}Le=ee}Oe=Le!=0?null:11>Oe?De.f.RGBA.eb:De.f.kb.y}else Oe=null;return Oe};var mA=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function c(w,I){for(var N="",R=0;R<4;R++)N+=String.fromCharCode(w[I++]);return N}function u(w,I){return(w[I+0]<<0|w[I+1]<<8|w[I+2]<<16)>>>0}function d(w,I){return(w[I+0]<<0|w[I+1]<<8|w[I+2]<<16|w[I+3]<<24)>>>0}new s;var f=[0],p=[0],h=[],g=new s,m=e,A=(function(w,I){var N={},R=0,L=!1,O=0,M=0;if(N.frames=[],!(function(H,q,V,Y){for(var K=0;K<Y;K++)if(H[q+K]!=V.charCodeAt(K))return!0;return!1})(w,I,"RIFF",4)){var B,D;for(d(w,I+=4),I+=8;I<w.length;){var $=c(w,I),P=d(w,I+=4);I+=4;var U=P+(1&P);switch($){case"VP8 ":case"VP8L":N.frames[R]===void 0&&(N.frames[R]={}),(F=N.frames[R]).src_off=L?M:I-8,F.src_size=O+P+8,R++,L&&(L=!1,O=0,M=0);break;case"VP8X":(F=N.header={}).feature_flags=w[I];var j=I+4;F.canvas_width=1+u(w,j),j+=3,F.canvas_height=1+u(w,j),j+=3;break;case"ALPH":L=!0,O=U+8,M=I-8;break;case"ANIM":(F=N.header).bgcolor=d(w,I),j=I+4,F.loop_count=(B=w)[(D=j)+0]<<0|B[D+1]<<8,j+=2;break;case"ANMF":var G,F;(F=N.frames[R]={}).offset_x=2*u(w,I),I+=3,F.offset_y=2*u(w,I),I+=3,F.width=1+u(w,I),I+=3,F.height=1+u(w,I),I+=3,F.duration=u(w,I),I+=3,G=w[I++],F.dispose=1&G,F.blend=G>>1&1}$!="ANMF"&&(I+=U)}return N}})(m,0);A.response=m,A.rgbaoutput=!0,A.dataurl=!1;var v=A.header?A.header:null,y=A.frames?A.frames:null;if(v){v.loop_counter=v.loop_count,f=[v.canvas_height],p=[v.canvas_width];for(var _=0;_<y.length&&y[_].blend!=0;_++);}var x=y[0],S=g.WebPDecodeRGBA(m,x.src_off,x.src_size,p,f);x.rgba=S,x.imgwidth=p[0],x.imgheight=f[0];for(var E=0;E<p[0]*f[0]*4;E++)h[E]=S[E];return this.width=p,this.height=f,this.data=h,this}(function(e){var t=function(){return typeof Bce=="function"},n=function(f,p,h,g){var m=4,A=o;switch(g){case e.image_compression.FAST:m=1,A=i;break;case e.image_compression.MEDIUM:m=6,A=l;break;case e.image_compression.SLOW:m=9,A=s}f=r(f,p,h,A);var v=Bce(f,{level:m});return e.__addimage__.arrayBufferToBinaryString(v)},r=function(f,p,h,g){for(var m,A,v,y=f.length/p,_=new Uint8Array(f.length+y),x=u(),S=0;S<y;S+=1){if(v=S*p,m=f.subarray(v,v+p),g)_.set(g(m,h,A),v+S);else{for(var E,w=x.length,I=[];E<w;E+=1)I[E]=x[E](m,h,A);var N=d(I.concat());_.set(I[N],v+S)}A=m}return _},a=function(f){var p=Array.apply([],f);return p.unshift(0),p},i=function(f,p){var h,g=[],m=f.length;g[0]=1;for(var A=0;A<m;A+=1)h=f[A-p]||0,g[A+1]=f[A]-h+256&255;return g},o=function(f,p,h){var g,m=[],A=f.length;m[0]=2;for(var v=0;v<A;v+=1)g=h&&h[v]||0,m[v+1]=f[v]-g+256&255;return m},l=function(f,p,h){var g,m,A=[],v=f.length;A[0]=3;for(var y=0;y<v;y+=1)g=f[y-p]||0,m=h&&h[y]||0,A[y+1]=f[y]+256-(g+m>>>1)&255;return A},s=function(f,p,h){var g,m,A,v,y=[],_=f.length;y[0]=4;for(var x=0;x<_;x+=1)g=f[x-p]||0,m=h&&h[x]||0,A=h&&h[x-p]||0,v=c(g,m,A),y[x+1]=f[x]-v+256&255;return y},c=function(f,p,h){if(f===p&&p===h)return f;var g=Math.abs(p-h),m=Math.abs(f-h),A=Math.abs(f+p-h-h);return g<=m&&g<=A?f:m<=A?p:h},u=function(){return[a,i,o,l,s]},d=function(f){var p=f.map((function(h){return h.reduce((function(g,m){return g+Math.abs(m)}),0)}));return p.indexOf(Math.min.apply(null,p))};e.processPNG=function(f,p,h,g){var m,A,v,y,_,x,S,E,w,I,N,R,L,O,M,B=this.decode.FLATE_DECODE,D="";if(this.__addimage__.isArrayBuffer(f)&&(f=new Uint8Array(f)),this.__addimage__.isArrayBufferView(f)){if(f=(v=new YKn(f)).imgData,A=v.bits,m=v.colorSpace,_=v.colors,[4,6].indexOf(v.colorType)!==-1){if(v.bits===8){w=(E=v.pixelBitlength==32?new Uint32Array(v.decodePixels().buffer):v.pixelBitlength==16?new Uint16Array(v.decodePixels().buffer):new Uint8Array(v.decodePixels().buffer)).length,N=new Uint8Array(w*v.colors),I=new Uint8Array(w);var $,P=v.pixelBitlength-v.bits;for(O=0,M=0;O<w;O++){for(L=E[O],$=0;$<P;)N[M++]=L>>>$&255,$+=v.bits;I[O]=L>>>$&255}}if(v.bits===16){w=(E=new Uint32Array(v.decodePixels().buffer)).length,N=new Uint8Array(w*(32/v.pixelBitlength)*v.colors),I=new Uint8Array(w*(32/v.pixelBitlength)),R=v.colors>1,O=0,M=0;for(var U=0;O<w;)L=E[O++],N[M++]=L>>>0&255,R&&(N[M++]=L>>>16&255,L=E[O++],N[M++]=L>>>0&255),I[U++]=L>>>16&255;A=8}g!==e.image_compression.NONE&&t()?(f=n(N,v.width*v.colors,v.colors,g),S=n(I,v.width,1,g)):(f=N,S=I,B=void 0)}if(v.colorType===3&&(m=this.color_spaces.INDEXED,x=v.palette,v.transparency.indexed)){var j=v.transparency.indexed,G=0;for(O=0,w=j.length;O<w;++O)G+=j[O];if((G/=255)===w-1&&j.indexOf(0)!==-1)y=[j.indexOf(0)];else if(G!==w){for(E=v.decodePixels(),I=new Uint8Array(E.length),O=0,w=E.length;O<w;O++)I[O]=j[E[O]];S=n(I,v.width,1)}}var F=(function(H){var q;switch(H){case e.image_compression.FAST:q=11;break;case e.image_compression.MEDIUM:q=13;break;case e.image_compression.SLOW:q=14;break;default:q=12}return q})(g);return B===this.decode.FLATE_DECODE&&(D="/Predictor "+F+" "),D+="/Colors "+_+" /BitsPerComponent "+A+" /Columns "+v.width,(this.__addimage__.isArrayBuffer(f)||this.__addimage__.isArrayBufferView(f))&&(f=this.__addimage__.arrayBufferToBinaryString(f)),(S&&this.__addimage__.isArrayBuffer(S)||this.__addimage__.isArrayBufferView(S))&&(S=this.__addimage__.arrayBufferToBinaryString(S)),{alias:h,data:f,index:p,filter:B,decodeParameters:D,transparency:y,palette:x,sMask:S,predictor:F,width:v.width,height:v.height,bitsPerComponent:A,colorSpace:m}}}})(oa.API),(function(e){e.processGIF89A=function(t,n,r,a){var i=new KKn(t),o=i.width,l=i.height,s=[];i.decodeAndBlitFrameRGBA(0,s);var c={data:s,width:o,height:l},u=new dte(100).encode(c,100);return e.processJPEG.call(this,u,n,r,a)},e.processGIF87A=e.processGIF89A})(oa.API),nh.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var e=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(e);for(var t=0;t<e;t++){var n=this.datav.getUint8(this.pos++,!0),r=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0);this.palette[t]={red:a,green:r,blue:n,quad:i}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},nh.prototype.parseBGR=function(){this.pos=this.offset;try{var e="bit"+this.bitPP,t=this.width*this.height*4;this.data=new Uint8Array(t),this[e]()}catch(n){Io.log("bit decode error:"+n)}},nh.prototype.bit1=function(){var e,t=Math.ceil(this.width/8),n=t%4;for(e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,a=0;a<t;a++)for(var i=this.datav.getUint8(this.pos++,!0),o=r*this.width*4+8*a*4,l=0;l<8&&8*a+l<this.width;l++){var s=this.palette[i>>7-l&1];this.data[o+4*l]=s.blue,this.data[o+4*l+1]=s.green,this.data[o+4*l+2]=s.red,this.data[o+4*l+3]=255}n!==0&&(this.pos+=4-n)}},nh.prototype.bit4=function(){for(var e=Math.ceil(this.width/2),t=e%4,n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,a=0;a<e;a++){var i=this.datav.getUint8(this.pos++,!0),o=r*this.width*4+2*a*4,l=i>>4,s=15&i,c=this.palette[l];if(this.data[o]=c.blue,this.data[o+1]=c.green,this.data[o+2]=c.red,this.data[o+3]=255,2*a+1>=this.width)break;c=this.palette[s],this.data[o+4]=c.blue,this.data[o+4+1]=c.green,this.data[o+4+2]=c.red,this.data[o+4+3]=255}t!==0&&(this.pos+=4-t)}},nh.prototype.bit8=function(){for(var e=this.width%4,t=this.height-1;t>=0;t--){for(var n=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var a=this.datav.getUint8(this.pos++,!0),i=n*this.width*4+4*r;if(a<this.palette.length){var o=this.palette[a];this.data[i]=o.red,this.data[i+1]=o.green,this.data[i+2]=o.blue,this.data[i+3]=255}else this.data[i]=255,this.data[i+1]=255,this.data[i+2]=255,this.data[i+3]=255}e!==0&&(this.pos+=4-e)}},nh.prototype.bit15=function(){for(var e=this.width%3,t=parseInt("11111",2),n=this.height-1;n>=0;n--){for(var r=this.bottom_up?n:this.height-1-n,a=0;a<this.width;a++){var i=this.datav.getUint16(this.pos,!0);this.pos+=2;var o=(i&t)/t*255|0,l=(i>>5&t)/t*255|0,s=(i>>10&t)/t*255|0,c=i>>15?255:0,u=r*this.width*4+4*a;this.data[u]=s,this.data[u+1]=l,this.data[u+2]=o,this.data[u+3]=c}this.pos+=e}},nh.prototype.bit16=function(){for(var e=this.width%3,t=parseInt("11111",2),n=parseInt("111111",2),r=this.height-1;r>=0;r--){for(var a=this.bottom_up?r:this.height-1-r,i=0;i<this.width;i++){var o=this.datav.getUint16(this.pos,!0);this.pos+=2;var l=(o&t)/t*255|0,s=(o>>5&n)/n*255|0,c=(o>>11)/t*255|0,u=a*this.width*4+4*i;this.data[u]=c,this.data[u+1]=s,this.data[u+2]=l,this.data[u+3]=255}this.pos+=e}},nh.prototype.bit24=function(){for(var e=this.height-1;e>=0;e--){for(var t=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var r=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),o=t*this.width*4+4*n;this.data[o]=i,this.data[o+1]=a,this.data[o+2]=r,this.data[o+3]=255}this.pos+=this.width%4}},nh.prototype.bit32=function(){for(var e=this.height-1;e>=0;e--)for(var t=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var r=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),l=t*this.width*4+4*n;this.data[l]=i,this.data[l+1]=a,this.data[l+2]=r,this.data[l+3]=o}},nh.prototype.getData=function(){return this.data},(function(e){e.processBMP=function(t,n,r,a){var i=new nh(t,!1),o=i.width,l=i.height,s={data:i.getData(),width:o,height:l},c=new dte(100).encode(s,100);return e.processJPEG.call(this,c,n,r,a)}})(oa.API),Hze.prototype.getData=function(){return this.data},(function(e){e.processWEBP=function(t,n,r,a){var i=new Hze(t),o=i.width,l=i.height,s={data:i.getData(),width:o,height:l},c=new dte(100).encode(s,100);return e.processJPEG.call(this,c,n,r,a)}})(oa.API),oa.API.processRGBA=function(e,t,n){for(var r=e.data,a=r.length,i=new Uint8Array(a/4*3),o=new Uint8Array(a/4),l=0,s=0,c=0;c<a;c+=4){var u=r[c],d=r[c+1],f=r[c+2],p=r[c+3];i[l++]=u,i[l++]=d,i[l++]=f,o[s++]=p}var h=this.__addimage__.arrayBufferToBinaryString(i);return{alpha:this.__addimage__.arrayBufferToBinaryString(o),data:h,index:t,alias:n,colorSpace:"DeviceRGB",bitsPerComponent:8,width:e.width,height:e.height}},oa.API.setLanguage=function(e){return this.internal.languageSettings===void 0&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),{af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PY":"Spanish (Paraguay)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-ES":"Spanish (Spain)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",sx:"Sutu",sw:"Swahili",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SV":"Swedish (Sweden)",ta:"Tamil",tt:"Tatar",te:"Teluga",th:"Thai",tig:"Tigre",ts:"Tsonga",tn:"Tswana",tr:"Turkish",tk:"Turkmen",uk:"Ukrainian",hsb:"Upper Sorbian",ur:"Urdu",ve:"Venda",vi:"Vietnamese",vo:"Volapuk",wa:"Walloon",cy:"Welsh",xh:"Xhosa",ji:"Yiddish",zu:"Zulu"}[e]!==void 0&&(this.internal.languageSettings.languageCode=e,this.internal.languageSettings.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",(function(){this.internal.write("/Lang ("+this.internal.languageSettings.languageCode+")")})),this.internal.languageSettings.isSubscribed=!0)),this},Zy=oa.API,qR=Zy.getCharWidthsArray=function(e,t){var n,r,a=(t=t||{}).font||this.internal.getFont(),i=t.fontSize||this.internal.getFontSize(),o=t.charSpace||this.internal.getCharSpace(),l=t.widths?t.widths:a.metadata.Unicode.widths,s=l.fof?l.fof:1,c=t.kerning?t.kerning:a.metadata.Unicode.kerning,u=c.fof?c.fof:1,d=t.doKerning!==!1,f=0,p=e.length,h=0,g=l[0]||s,m=[];for(n=0;n<p;n++)r=e.charCodeAt(n),typeof a.metadata.widthOfString=="function"?m.push((a.metadata.widthOfGlyph(a.metadata.characterToGlyph(r))+o*(1e3/i)||0)/1e3):(f=d&&ii(c[r])==="object"&&!isNaN(parseInt(c[r][h],10))?c[r][h]/u:0,m.push((l[r]||g)/s+f)),h=r;return m},$ze=Zy.getStringUnitWidth=function(e,t){var n=(t=t||{}).fontSize||this.internal.getFontSize(),r=t.font||this.internal.getFont(),a=t.charSpace||this.internal.getCharSpace();return Zy.processArabic&&(e=Zy.processArabic(e)),typeof r.metadata.widthOfString=="function"?r.metadata.widthOfString(e,n,a)/n:qR.apply(this,arguments).reduce((function(i,o){return i+o}),0)},Fze=function(e,t,n,r){for(var a=[],i=0,o=e.length,l=0;i!==o&&l+t[i]<n;)l+=t[i],i++;a.push(e.slice(0,i));var s=i;for(l=0;i!==o;)l+t[i]>r&&(a.push(e.slice(s,i)),l=0,s=i),l+=t[i],i++;return s!==i&&a.push(e.slice(s,i)),a},Uze=function(e,t,n){n||(n={});var r,a,i,o,l,s,c,u=[],d=[u],f=n.textIndent||0,p=0,h=0,g=e.split(" "),m=qR.apply(this,[" ",n])[0];if(s=n.lineIndent===-1?g[0].length+2:n.lineIndent||0){var A=Array(s).join(" "),v=[];g.map((function(_){(_=_.split(/\s*\n/)).length>1?v=v.concat(_.map((function(x,S){return(S&&x.length?`
|
|
2001
2001
|
`:"")+x}))):v.push(_[0])})),g=v,s=$ze.apply(this,[A,n])}for(i=0,o=g.length;i<o;i++){var y=0;if(r=g[i],s&&r[0]==`
|
|
2002
|
-
`&&(r=r.substr(1),y=1),f+p+(h=(a=qR.apply(this,[r,n])).reduce((function(_,x){return _+x}),0))>t||y){if(h>t){for(l=Fze.apply(this,[r,a,t-(f+p),t]),u.push(l.shift()),u=[l.pop()];l.length;)d.push([l.shift()]);h=a.slice(r.length-(u[0]?u[0].length:0)).reduce((function(_,x){return _+x}),0)}else u=[r];d.push(u),f=h+s,p=m}else u.push(r),f+=p+h,p=m}return c=s?function(_,x){return(x?A:"")+_.join(" ")}:function(_){return _.join(" ")},d.map(c)},Zy.splitTextToSize=function(e,t,n){var r,a=(n=n||{}).fontSize||this.internal.getFontSize(),i=(function(u){if(u.widths&&u.kerning)return{widths:u.widths,kerning:u.kerning};var d=this.internal.getFont(u.fontName,u.fontStyle);return d.metadata.Unicode?{widths:d.metadata.Unicode.widths||{0:1},kerning:d.metadata.Unicode.kerning||{}}:{font:d.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,n);r=Array.isArray(e)?e:String(e).split(/\r?\n/);var o=1*this.internal.scaleFactor*t/a;i.textIndent=n.textIndent?1*n.textIndent*this.internal.scaleFactor/a:0,i.lineIndent=n.lineIndent;var l,s,c=[];for(l=0,s=r.length;l<s;l++)c=c.concat(Uze.apply(this,[r[l],o,i]));return c},(function(e){e.__fontmetrics__=e.__fontmetrics__||{};for(var t="klmnopqrstuvwxyz",n={},r={},a=0;a<t.length;a++)n[t[a]]="0123456789abcdef"[a],r["0123456789abcdef"[a]]=t[a];var i=function(d){return"0x"+parseInt(d,10).toString(16)},o=e.__fontmetrics__.compress=function(d){var f,p,h,g,m=["{"];for(var A in d){if(f=d[A],isNaN(parseInt(A,10))?p="'"+A+"'":(A=parseInt(A,10),p=(p=i(A).slice(2)).slice(0,-1)+r[p.slice(-1)]),typeof f=="number")f<0?(h=i(f).slice(3),g="-"):(h=i(f).slice(2),g=""),h=g+h.slice(0,-1)+r[h.slice(-1)];else{if(ii(f)!=="object")throw new Error("Don't know what to do with value type "+ii(f)+".");h=o(f)}m.push(p+h)}return m.push("}"),m.join("")},l=e.__fontmetrics__.uncompress=function(d){if(typeof d!="string")throw new Error("Invalid argument passed to uncompress.");for(var f,p,h,g,m={},A=1,v=m,y=[],_="",x="",S=d.length-1,E=1;E<S;E+=1)(g=d[E])=="'"?f?(h=f.join(""),f=void 0):f=[]:f?f.push(g):g=="{"?(y.push([v,h]),v={},h=void 0):g=="}"?((p=y.pop())[0][p[1]]=v,h=void 0,v=p[0]):g=="-"?A=-1:h===void 0?n.hasOwnProperty(g)?(_+=n[g],h=parseInt(_,16)*A,A=1,_=""):_+=g:n.hasOwnProperty(g)?(x+=n[g],v[h]=parseInt(x,16)*A,A=1,h=void 0,x=""):x+=g;return m},s={codePages:["WinAnsiEncoding"],WinAnsiEncoding:l("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},c={Unicode:{Courier:s,"Courier-Bold":s,"Courier-BoldOblique":s,"Courier-Oblique":s,Helvetica:s,"Helvetica-Bold":s,"Helvetica-BoldOblique":s,"Helvetica-Oblique":s,"Times-Roman":s,"Times-Bold":s,"Times-BoldItalic":s,"Times-Italic":s}},u={Unicode:{"Courier-Oblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":l("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":l("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:l("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:l("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":l("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":l("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};e.events.push(["addFont",function(d){var f=d.font,p=u.Unicode[f.postScriptName];p&&(f.metadata.Unicode={},f.metadata.Unicode.widths=p.widths,f.metadata.Unicode.kerning=p.kerning);var h=c.Unicode[f.postScriptName];h&&(f.metadata.Unicode.encoding=h,f.encoding=h.codePages[0])}])})(oa.API),(function(e){var t=function(n){for(var r=n.length,a=new Uint8Array(r),i=0;i<r;i++)a[i]=n.charCodeAt(i);return a};e.API.events.push(["addFont",function(n){var r=void 0,a=n.font,i=n.instance;if(!a.isStandardFont){if(i===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+a.postScriptName+"').");if(typeof(r=i.existsFileInVFS(a.postScriptName)===!1?i.loadFile(a.postScriptName):i.getFileFromVFS(a.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+a.postScriptName+"').");(function(o,l){l=/^\x00\x01\x00\x00/.test(l)?t(l):t(WS(l)),o.metadata=e.API.TTFFont.open(l),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(a,r)}}])})(oa),(function(e){function t(){return(ua.canvg?Promise.resolve(ua.canvg):Bi(()=>import("./index.es-CX2xj_c7.js"),[])).catch((function(n){return Promise.reject(new Error("Could not load canvg: "+n))})).then((function(n){return n.default?n.default:n}))}oa.API.addSvgAsImage=function(n,r,a,i,o,l,s,c){if(isNaN(r)||isNaN(a))throw Io.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(i)||isNaN(o))throw Io.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var u=document.createElement("canvas");u.width=i,u.height=o;var d=u.getContext("2d");d.fillStyle="#fff",d.fillRect(0,0,u.width,u.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},p=this;return t().then((function(h){return h.fromString(d,n,f)}),(function(){return Promise.reject(new Error("Could not load canvg."))})).then((function(h){return h.render(f)})).then((function(){p.addImage(u.toDataURL("image/jpeg",1),r,a,i,o,s,c)}))}})(),oa.API.putTotalPages=function(e){var t,n=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(e,"g"),n=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(e,this.internal.getFont()),"g"),n=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var r=1;r<=this.internal.getNumberOfPages();r++)for(var a=0;a<this.internal.pages[r].length;a++)this.internal.pages[r][a]=this.internal.pages[r][a].replace(t,n);return this},oa.API.viewerPreferences=function(e,t){var n;e=e||{},t=t||!1;var r,a,i,o={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},l=Object.keys(o),s=[],c=0,u=0,d=0;function f(h,g){var m,A=!1;for(m=0;m<h.length;m+=1)h[m]===g&&(A=!0);return A}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,e==="reset"||t===!0){var p=l.length;for(d=0;d<p;d+=1)n[l[d]].value=n[l[d]].defaultValue,n[l[d]].explicitSet=!1}if(ii(e)==="object"){for(a in e)if(i=e[a],f(l,a)&&i!==void 0){if(n[a].type==="boolean"&&typeof i=="boolean")n[a].value=i;else if(n[a].type==="name"&&f(n[a].valueSet,i))n[a].value=i;else if(n[a].type==="integer"&&Number.isInteger(i))n[a].value=i;else if(n[a].type==="array"){for(c=0;c<i.length;c+=1)if(r=!0,i[c].length===1&&typeof i[c][0]=="number")s.push(String(i[c]-1));else if(i[c].length>1){for(u=0;u<i[c].length;u+=1)typeof i[c][u]!="number"&&(r=!1);r===!0&&s.push([i[c][0]-1,i[c][1]-1].join(" "))}n[a].value="["+s.join(" ")+"]"}else n[a].value=n[a].defaultValue;n[a].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",(function(){var h,g=[];for(h in n)n[h].explicitSet===!0&&(n[h].type==="name"?g.push("/"+h+" /"+n[h].value):g.push("/"+h+" "+n[h].value));g.length!==0&&this.internal.write(`/ViewerPreferences
|
|
2002
|
+
`&&(r=r.substr(1),y=1),f+p+(h=(a=qR.apply(this,[r,n])).reduce((function(_,x){return _+x}),0))>t||y){if(h>t){for(l=Fze.apply(this,[r,a,t-(f+p),t]),u.push(l.shift()),u=[l.pop()];l.length;)d.push([l.shift()]);h=a.slice(r.length-(u[0]?u[0].length:0)).reduce((function(_,x){return _+x}),0)}else u=[r];d.push(u),f=h+s,p=m}else u.push(r),f+=p+h,p=m}return c=s?function(_,x){return(x?A:"")+_.join(" ")}:function(_){return _.join(" ")},d.map(c)},Zy.splitTextToSize=function(e,t,n){var r,a=(n=n||{}).fontSize||this.internal.getFontSize(),i=(function(u){if(u.widths&&u.kerning)return{widths:u.widths,kerning:u.kerning};var d=this.internal.getFont(u.fontName,u.fontStyle);return d.metadata.Unicode?{widths:d.metadata.Unicode.widths||{0:1},kerning:d.metadata.Unicode.kerning||{}}:{font:d.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,n);r=Array.isArray(e)?e:String(e).split(/\r?\n/);var o=1*this.internal.scaleFactor*t/a;i.textIndent=n.textIndent?1*n.textIndent*this.internal.scaleFactor/a:0,i.lineIndent=n.lineIndent;var l,s,c=[];for(l=0,s=r.length;l<s;l++)c=c.concat(Uze.apply(this,[r[l],o,i]));return c},(function(e){e.__fontmetrics__=e.__fontmetrics__||{};for(var t="klmnopqrstuvwxyz",n={},r={},a=0;a<t.length;a++)n[t[a]]="0123456789abcdef"[a],r["0123456789abcdef"[a]]=t[a];var i=function(d){return"0x"+parseInt(d,10).toString(16)},o=e.__fontmetrics__.compress=function(d){var f,p,h,g,m=["{"];for(var A in d){if(f=d[A],isNaN(parseInt(A,10))?p="'"+A+"'":(A=parseInt(A,10),p=(p=i(A).slice(2)).slice(0,-1)+r[p.slice(-1)]),typeof f=="number")f<0?(h=i(f).slice(3),g="-"):(h=i(f).slice(2),g=""),h=g+h.slice(0,-1)+r[h.slice(-1)];else{if(ii(f)!=="object")throw new Error("Don't know what to do with value type "+ii(f)+".");h=o(f)}m.push(p+h)}return m.push("}"),m.join("")},l=e.__fontmetrics__.uncompress=function(d){if(typeof d!="string")throw new Error("Invalid argument passed to uncompress.");for(var f,p,h,g,m={},A=1,v=m,y=[],_="",x="",S=d.length-1,E=1;E<S;E+=1)(g=d[E])=="'"?f?(h=f.join(""),f=void 0):f=[]:f?f.push(g):g=="{"?(y.push([v,h]),v={},h=void 0):g=="}"?((p=y.pop())[0][p[1]]=v,h=void 0,v=p[0]):g=="-"?A=-1:h===void 0?n.hasOwnProperty(g)?(_+=n[g],h=parseInt(_,16)*A,A=1,_=""):_+=g:n.hasOwnProperty(g)?(x+=n[g],v[h]=parseInt(x,16)*A,A=1,h=void 0,x=""):x+=g;return m},s={codePages:["WinAnsiEncoding"],WinAnsiEncoding:l("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},c={Unicode:{Courier:s,"Courier-Bold":s,"Courier-BoldOblique":s,"Courier-Oblique":s,Helvetica:s,"Helvetica-Bold":s,"Helvetica-BoldOblique":s,"Helvetica-Oblique":s,"Times-Roman":s,"Times-Bold":s,"Times-BoldItalic":s,"Times-Italic":s}},u={Unicode:{"Courier-Oblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":l("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":l("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:l("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:l("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":l("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":l("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};e.events.push(["addFont",function(d){var f=d.font,p=u.Unicode[f.postScriptName];p&&(f.metadata.Unicode={},f.metadata.Unicode.widths=p.widths,f.metadata.Unicode.kerning=p.kerning);var h=c.Unicode[f.postScriptName];h&&(f.metadata.Unicode.encoding=h,f.encoding=h.codePages[0])}])})(oa.API),(function(e){var t=function(n){for(var r=n.length,a=new Uint8Array(r),i=0;i<r;i++)a[i]=n.charCodeAt(i);return a};e.API.events.push(["addFont",function(n){var r=void 0,a=n.font,i=n.instance;if(!a.isStandardFont){if(i===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+a.postScriptName+"').");if(typeof(r=i.existsFileInVFS(a.postScriptName)===!1?i.loadFile(a.postScriptName):i.getFileFromVFS(a.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+a.postScriptName+"').");(function(o,l){l=/^\x00\x01\x00\x00/.test(l)?t(l):t(WS(l)),o.metadata=e.API.TTFFont.open(l),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(a,r)}}])})(oa),(function(e){function t(){return(ua.canvg?Promise.resolve(ua.canvg):Bi(()=>import("./index.es-CwT_wmDL.js"),[])).catch((function(n){return Promise.reject(new Error("Could not load canvg: "+n))})).then((function(n){return n.default?n.default:n}))}oa.API.addSvgAsImage=function(n,r,a,i,o,l,s,c){if(isNaN(r)||isNaN(a))throw Io.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(i)||isNaN(o))throw Io.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var u=document.createElement("canvas");u.width=i,u.height=o;var d=u.getContext("2d");d.fillStyle="#fff",d.fillRect(0,0,u.width,u.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},p=this;return t().then((function(h){return h.fromString(d,n,f)}),(function(){return Promise.reject(new Error("Could not load canvg."))})).then((function(h){return h.render(f)})).then((function(){p.addImage(u.toDataURL("image/jpeg",1),r,a,i,o,s,c)}))}})(),oa.API.putTotalPages=function(e){var t,n=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(e,"g"),n=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(e,this.internal.getFont()),"g"),n=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var r=1;r<=this.internal.getNumberOfPages();r++)for(var a=0;a<this.internal.pages[r].length;a++)this.internal.pages[r][a]=this.internal.pages[r][a].replace(t,n);return this},oa.API.viewerPreferences=function(e,t){var n;e=e||{},t=t||!1;var r,a,i,o={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},l=Object.keys(o),s=[],c=0,u=0,d=0;function f(h,g){var m,A=!1;for(m=0;m<h.length;m+=1)h[m]===g&&(A=!0);return A}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,e==="reset"||t===!0){var p=l.length;for(d=0;d<p;d+=1)n[l[d]].value=n[l[d]].defaultValue,n[l[d]].explicitSet=!1}if(ii(e)==="object"){for(a in e)if(i=e[a],f(l,a)&&i!==void 0){if(n[a].type==="boolean"&&typeof i=="boolean")n[a].value=i;else if(n[a].type==="name"&&f(n[a].valueSet,i))n[a].value=i;else if(n[a].type==="integer"&&Number.isInteger(i))n[a].value=i;else if(n[a].type==="array"){for(c=0;c<i.length;c+=1)if(r=!0,i[c].length===1&&typeof i[c][0]=="number")s.push(String(i[c]-1));else if(i[c].length>1){for(u=0;u<i[c].length;u+=1)typeof i[c][u]!="number"&&(r=!1);r===!0&&s.push([i[c][0]-1,i[c][1]-1].join(" "))}n[a].value="["+s.join(" ")+"]"}else n[a].value=n[a].defaultValue;n[a].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",(function(){var h,g=[];for(h in n)n[h].explicitSet===!0&&(n[h].type==="name"?g.push("/"+h+" /"+n[h].value):g.push("/"+h+" "+n[h].value));g.length!==0&&this.internal.write(`/ViewerPreferences
|
|
2003
2003
|
<<
|
|
2004
2004
|
`+g.join(`
|
|
2005
2005
|
`)+`
|
|
@@ -3187,7 +3187,7 @@ data
|
|
|
3187
3187
|
font-weight: 500;
|
|
3188
3188
|
`,pending:t`
|
|
3189
3189
|
opacity: 0.8;
|
|
3190
|
-
`})),oD=({data:e,component_key:t,interactive:n=!0,focusMode:r=!1})=>{const{styles:
|
|
3190
|
+
`})),oD=({data:e,component_key:t,interactive:n=!0,focusMode:r=!1,smartCollapse:a=!0})=>{const{styles:i}=Nlr(),o=()=>{if(!e||!Array.isArray(e)||e.length<=3)return!0;const g=e.every(A=>A.status==="pending"),m=e.every(A=>A.status==="completed");return g||m},[l,s]=b.useState(()=>a?o():!1);b.useEffect(()=>{a&&s(o())},[e,a]);const c=g=>{switch(g){case"completed":return C.jsx(a5,{style:{color:"#52c41a"}});case"in_progress":return C.jsx(fFt,{style:{fontWeight:"500"}});case"pending":return C.jsx(Qb,{style:{color:"gray"}});default:return null}},u=g=>{switch(g){case"completed":return i.completed;case"in_progress":return i.inProgress;case"pending":return i.pending;default:return""}},d=()=>{if(!e||!Array.isArray(e))return[];if(!r||e.length<=3)return e;const g=e.findIndex(A=>A.status==="in_progress");return g!==-1?e.slice(g,g+3):e.every(A=>A.status==="completed")?e.slice(-3):e.slice(0,3)};if(!e||!Array.isArray(e))return C.jsx(Ti,{size:"small",className:`shadow-sm ${i.card}`,bordered:!1,children:C.jsx(Gte,{type:"secondary",children:"No todo items available"})});const f=d(),p=f.length<e.length,h=l?e:f;return C.jsx(Ti,{size:"small",className:`shadow-sm ${i.card}`,bordered:!1,children:C.jsxs(tr,{direction:"vertical",style:{width:"100%"},children:[C.jsx(Ha,{size:"small",dataSource:h,renderItem:(g,m)=>C.jsx(Ha.Item,{className:`${i.todoItem} ${u(g.status)}`,children:C.jsxs(tr,{align:"center",style:{width:"100%"},children:[c(g.status),C.jsx(Gte,{style:{flex:1},children:g.content})]})})}),p&&C.jsx(tn,{type:"link",size:"small",icon:l?C.jsx($Xe,{}):C.jsx(wXe,{}),onClick:()=>s(!l),style:{padding:0,height:"auto"},children:l?"Collapse":`Show all ${e.length} items (${e.length-f.length} hidden)`}),C.jsxs(Gte,{type:"secondary",style:{fontSize:12},children:["Total items: ",e.length," | Completed:"," ",e.filter(g=>g.status==="completed").length," | In Progress:"," ",e.filter(g=>g.status==="in_progress").length," | Pending: ",e.filter(g=>g.status==="pending").length]})]})})},{Text:Fje}=Ar,Olr=({data:e,component_key:t,interactive:n=!0})=>{var c;const r=e,a=((c=r==null?void 0:r.args)==null?void 0:c.todos)||[],i=a.length,o=a.filter(u=>u.status==="completed").length,l=()=>C.jsx(Ojt,{}),s=C.jsxs(tr,{children:[C.jsx(Fje,{strong:!0,children:"TODOs"}),C.jsxs(Fje,{style:{fontSize:12},type:"secondary",children:[o,"/",i," Done"]})]});return r?C.jsx(n5,{size:"small",bordered:!1,defaultActiveKey:[r.id],expandIcon:l,children:C.jsx(VE,{header:s,style:{minWidth:400},children:C.jsx(oD,{data:e.args.todos,component_key:t,interactive:n,focusMode:!0})},r.id)}):null},OC=e=>{var r,a;const t=(a=(r=e==null?void 0:e.split("."))==null?void 0:r.pop())==null?void 0:a.toLowerCase(),n={fontSize:14,marginRight:4,verticalAlign:"middle"};switch(t){case"ts":case"tsx":return C.jsx(ff,{style:{...n,color:"#3178c6"}});case"js":case"jsx":return C.jsx(ff,{style:{...n,color:"#f7df1e"}});case"html":return C.jsx(Xzt,{style:{...n,color:"#e34c26"}});case"css":case"less":case"scss":case"sass":return C.jsx(nB,{style:{...n,color:"#563d7c"}});case"py":case"python":return C.jsx(ff,{style:{...n,color:"#3776ab"}});case"java":return C.jsx(ff,{style:{...n,color:"#007396"}});case"go":return C.jsx(ff,{style:{...n,color:"#00add8"}});case"rs":case"rust":return C.jsx(ff,{style:{...n,color:"#dea584"}});case"cpp":case"c":case"h":return C.jsx(ff,{style:{...n,color:"#555555"}});case"md":case"markdown":return C.jsx(CXe,{style:{...n,color:"#083fa1"}});case"txt":return C.jsx(j2,{style:{...n,color:"#9e9e9e"}});case"rtf":return C.jsx(j2,{style:{...n,color:"#6d6d6d"}});case"doc":case"docx":return C.jsx(gfe,{style:{...n,color:"#2b579a"}});case"xls":case"xlsx":case"csv":return C.jsx(pfe,{style:{...n,color:"#217346"}});case"ppt":case"pptx":return C.jsx(TXe,{style:{...n,color:"#d24726"}});case"pdf":return C.jsx(tB,{style:{...n,color:"#ff3b30"}});case"zip":case"rar":case"7z":case"tar":case"gz":case"bz2":return C.jsx(mfe,{style:{...n,color:"#f4a460"}});case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":case"bmp":case"ico":case"tiff":return C.jsx(hfe,{style:{...n,color:"#4caf50"}});case"json":return C.jsx(j2,{style:{...n,color:"#fbc02d"}});case"xml":case"yaml":case"yml":return C.jsx(j2,{style:{...n,color:"#ff7043"}});case"sql":return C.jsx(j2,{style:{...n,color:"#00796b"}});default:return C.jsx(czt,{style:{...n,color:"#9e9e9e"}})}},Mlr=Ni(({token:e,css:t})=>({container:t`
|
|
3191
3191
|
height: 100%;
|
|
3192
3192
|
background: ${e.colorBgContainer};
|
|
3193
3193
|
border: 1px solid ${e.colorBorder};
|
|
@@ -3451,7 +3451,7 @@ data
|
|
|
3451
3451
|
background: ${e.colorFillAlter};
|
|
3452
3452
|
border-radius: 8px;
|
|
3453
3453
|
border: 1px solid ${e.colorBorderSecondary};
|
|
3454
|
-
`})),jlr=({data:e,component_key:t,interactive:n=!0})=>{const{styles:r}=Hlr(),a=e,{openSideApp:i}=Dl();if(!a)return null;const{description:o,subagent_type:l,assignee:s}=(a==null?void 0:a.args)||{},c=a.status||"pending",u=a.response||null,{threadId:d}=od()
|
|
3454
|
+
`})),jlr=({data:e,component_key:t,interactive:n=!0})=>{const{styles:r}=Hlr(),a=e,{openSideApp:i}=Dl();if(!a)return null;const{description:o,subagent_type:l,assignee:s}=(a==null?void 0:a.args)||{},c=a.status||"pending",u=a.response||null,{threadId:d,assistantId:f}=od();let p=f;l==="general-purpose"&&(p=f+"-general-purpose");const h=(d||"")+"____"+p+"_"+a.id,m=(y=>{switch(y){case"success":return{icon:C.jsx(a5,{style:{fontSize:16}}),color:"success",text:"Completed",bgColor:"rgba(82, 196, 26, 0.1)"};case"error":return{icon:C.jsx(ufe,{style:{fontSize:16}}),color:"error",text:"Failed",bgColor:"rgba(255, 77, 79, 0.1)"};case"pending":default:return{icon:C.jsx(rB,{style:{fontSize:16}}),color:"processing",text:"In Progress",bgColor:"rgba(24, 144, 255, 0.1)"}}})(c),A=c==="success"&&u,v=()=>{i({component_key:"task",message:l,data:{thread_id:h,description:o,subagent_type:p}})};return C.jsx(Ti,{size:"small",className:r.card,bordered:!1,onClick:v,hoverable:n,bodyStyle:{padding:0},children:C.jsxs("div",{className:r.cardBody,children:[C.jsx("div",{className:r.header,children:C.jsxs("div",{className:r.titleSection,children:[C.jsx("div",{className:r.iconWrapper,children:C.jsx(PFt,{style:{fontSize:20,color:"#1890ff"}})}),C.jsxs("div",{className:r.titleContent,children:[l&&C.jsx("div",{className:r.taskType,children:l}),o&&C.jsx(Vte,{className:r.description,children:o})]})]})}),C.jsxs("div",{className:r.footer,children:[C.jsxs("div",{className:r.footerLeft,children:[s&&C.jsxs("div",{className:r.assigneeContainer,children:[C.jsx(z3,{size:24,icon:C.jsx(aB,{}),className:r.assigneeAvatar}),C.jsx(Vte,{className:r.assigneeName,children:s})]}),C.jsx(Yr,{icon:m.icon,color:m.color,style:{margin:0,padding:"4px 12px",borderRadius:"12px",fontSize:"12px",fontWeight:500,border:"none",background:m.bgColor},children:m.text})]}),n&&C.jsx(LXe,{className:r.actionIcon})]}),A&&C.jsxs("div",{className:r.responseSection,onClick:y=>y.stopPropagation(),children:[C.jsx(Vte,{className:r.responseHeader,children:"Response"}),C.jsx("div",{className:r.responseContent,children:C.jsx(zd,{content:u})})]})]})})},Glr=({message:e,renderContent:t,autoLoadRightPanel:n})=>{const r=b.useRef(null),[a,i]=b.useState(!1),[o,l]=b.useState(!1);b.useEffect(()=>{const c=new IntersectionObserver(([u])=>{const d=u.isIntersecting;i(d),d&&!o&&l(!0)},{threshold:.1});return r.current&&c.observe(r.current),()=>{r.current&&c.unobserve(r.current)}},[o]),b.useEffect(()=>{n==null||n()},[]);const s=()=>{const c=e.content?Math.min(100,e.content.length/5):100;return C.jsx("div",{style:{height:`${c}px`,minHeight:"50px"}})};return C.jsx(rWe,{children:C.jsx("div",{ref:r,style:{width:"100%"},children:a||o?t(e):s()})})},v3t=b.memo(({items:e,role:t,className:n})=>C.jsx(o5.List,{autoScroll:!0,items:e,role:t,className:n},"messages"));v3t.displayName="MemoizedBubbleList";var Vlr=({messages:e,className:t})=>{const{styles:n}=eF(),{openSideApp:r}=Dl(),a=b.useRef((e==null?void 0:e.length)??0);b.useEffect(()=>{e!=null&&e.length&&(a.current=e==null?void 0:e.length)},[e==null?void 0:e.length]);const i=b.useCallback(s=>{var f;const{content:c}=s;try{const p=JSON.parse(c);if(p.action&&p.message)return C.jsx(zd,{content:p.message})}catch{}const u=((f=s.tool_calls)==null?void 0:f.map(p=>`\`\`\`tool_call
|
|
3455
3455
|
${JSON.stringify(p)}
|
|
3456
3456
|
\`\`\``))||[],d=[c,...u].join(`
|
|
3457
3457
|
`);return C.jsx(tr,{direction:"vertical",style:{width:"100%"},children:C.jsx(zd,{content:d})})},[]),o=b.useMemo(()=>e.map((s,c)=>({key:s.id,role:s.role,typing:!1,content:C.jsx(Glr,{message:s,renderContent:i,autoLoadRightPanel:()=>{const{content:u,role:d}=s,f=a.current>1&&a.current+1===e.length;if(c===e.length-1&&f&&d==="ai")try{const p=u==null?void 0:u.match(/```([\w_]*)\n({.*?}|[^`]*)\n```/m),h=p==null?void 0:p[1],g=p==null?void 0:p[2],m=g?JSON.parse(g):{};if(h){const A=rF(h);A!=null&&A.side_app_view?r({component_key:h,data:m}):A!=null&&A.action&&A.action(m)}}catch(p){console.error(p)}}})})),[e,i]),l={ai:{placement:"start",typing:!1,variant:"filled",styles:{content:{background:"transparent",padding:0}}},human:{placement:"end",variant:"filled",styles:{content:{background:"linear-gradient(1777deg, rgba(153, 164, 255, 0.38), rgb(231 243 248 / 38%) 27%)"}}}};return o.length===0?C.jsx("div",{style:{flex:1}}):C.jsx(v3t,{items:o,role:l,className:n.messages||t})},{Text:Vdr}=Ar,Wlr=Ni(({token:e,css:t})=>({card:t`
|
|
@@ -3470,7 +3470,7 @@ ${JSON.stringify(p)}
|
|
|
3470
3470
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
3471
3471
|
transform: translateY(-1px);
|
|
3472
3472
|
}
|
|
3473
|
-
`})),qlr=()=>{const{styles:e}=Wlr(),{interrupts:t}=od();return t&&t.length>0?C.jsx(n5,{className:e.card,size:"small",bordered:!1,defaultActiveKey:["hitl"],children:C.jsx(VE,{showArrow:!1,header:C.jsx(Yr,{bordered:!1,color:"orange",style:{fontSize:14,fontWeight:"bold",background:"#ffffff8f",padding:4,borderRadius:8},children:"Pending Feedback"}),children:C.jsx(tr,{direction:"vertical",style:{width:"100%"},children:t.map(n=>C.jsx(zd,{content:n.value},n.id))})},"hitl")}):null},Gje=({})=>{const{openSideApp:e}=Dl(),{todos:t}=od();if(!t||t.length===0)return C.jsx(hx,{content:C.jsx("div",{style:{width:400},children:C.jsx(oD,{data:[],component_key:"header_todos"})}),title:"Todos",trigger:"click",placement:"bottomRight",children:C.jsx(Or,{title:"No tasks",children:C.jsxs("div",{style:{cursor:"pointer",display:"inline-flex",alignItems:"center",gap:8},children:[C.jsx(I4,{type:"circle",strokeColor:{"0%":"#91caff","100%":"#003eb3"},percent:0,width:30,format:()=>C.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:1},children:C.jsx("span",{style:{fontSize:8},children:"0/0"})})}),C.jsx("span",{style:{fontSize:12,color:"#999",maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:"No tasks"})]})})});const n=t.filter(c=>c.status==="completed").length,r=t.length,a=t.some(c=>c.status==="in_progress"),i=t.filter(c=>c.status==="in_progress"),o=Math.round(n/r*100),s=i.length>0?i.length===1?i[0].content:`${i.length} in progress`:n>0?`${n} completed`:"No tasks";return C.jsx(hx,{content:C.jsx("div",{style:{width:400},children:C.jsx(oD,{data:t,component_key:"header_todos"})}),title:"Todos",trigger:"click",placement:"bottomRight",children:C.jsx(Or,{title:`${n} / ${r} tasks completed`,children:C.jsxs("div",{style:{cursor:"pointer",display:"inline-flex",alignItems:"center",gap:8},children:[C.jsx(I4,{type:"circle",strokeColor:{"0%":"#91caff","100%":"#003eb3"},percent:o,status:a?"active":"normal",width:22,format:()=>C.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:1},children:C.jsxs("span",{style:{fontSize:8},children:[n,"/",r]})})}),C.jsx("span",{style:{fontSize:12,color:a?"#1890ff":"#666",fontWeight:a?500:400,maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s})]})})})},Qlr=({})=>{const{tasks:e}=od(),{openSideApp:t}=Dl();if(!e||e.length===0)return C.jsx(Or,{title:"No tasks",children:C.jsxs("div",{style:{cursor:"pointer",display:"inline-flex",alignItems:"center",gap:8,padding:"0px 4px"},onClick:()=>t({component_key:"task_board",message:"Tasks",data:{}}),children:[C.jsx(I4,{type:"circle",strokeColor:{"0%":"#91caff","100%":"#003eb3"},percent:0,width:30,format:()=>C.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:1},children:C.jsx("span",{style:{fontSize:8},children:"0/0"})})}),C.jsx("span",{style:{fontSize:12,color:"#999",maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:"No tasks"})]})});const n=e.filter(c=>c.status==="completed").length,r=e.length,a=e.some(c=>c.status==="in_progress"),i=e.filter(c=>c.status==="in_progress"),o=Math.round(n/r*100),s=i.length>0?i.length===1?i[0].title:`${i.length} in progress`:n>0?`${n} completed`:"No tasks";return C.jsx(Or,{title:`${n} / ${r} tasks completed`,children:C.jsxs("div",{style:{cursor:"pointer",display:"inline-flex",alignItems:"center",gap:8},onClick:()=>t({component_key:"task_board",message:"Tasks",data:{}}),children:[C.jsx(I4,{type:"circle",strokeColor:{"0%":"#91caff","100%":"#003eb3"},percent:o,status:a?"active":"normal",width:22,format:()=>C.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:1},children:C.jsxs("span",{style:{fontSize:8},children:[n,"/",r]})})}),C.jsx("span",{style:{fontSize:12,color:a?"#1890ff":"#666",fontWeight:a?500:400,maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s})]})})},Vje=()=>{const{todos:e,tasks:t}=od();return e&&e.length>0?C.jsx(Gje,{}):t&&t.length>0?C.jsx(Qlr,{}):C.jsx(Gje,{})},Wje=({})=>{var a;const{agentState:e}=od(),{openSideApp:t}=Dl(),n=((a=e==null?void 0:e.values)==null?void 0:a.files)||[],r=Object.keys(n).length;return C.jsx(Or,{title:"File Explorer",children:C.jsx(tn,{style:{fontSize:12,color:r>0?"#1890ff":"#666",fontWeight:r>0?500:400,maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},type:"text",size:"small",icon:C.jsx(WUt,{}),onClick:()=>t({component_key:"file_explorer",message:"File Explorer",data:{files:n}}),children:r===0?"No files":`${r} files`})})},Ylr=({tooltipText:e="Agenda"})=>{const{threadId:t,assistantId:n}=od(),{openSideApp:r}=Dl(),a=m1(n||""),[i,o]=b.useState([]),[l,s]=b.useState(!1),[c,u]=b.useState(0),d=b.useCallback(async()=>{if(t){s(!0);try{const g=await a.schedules.getByThread({threadId:t});o(g);const m=g.filter(A=>A.status===Is.PENDING||A.status===Is.PAUSED).length;u(m)}catch(g){console.error("Failed to fetch scheduled tasks:",g),o([]),u(0)}finally{s(!1)}}},[a,t]);if(b.useEffect(()=>{d()},[d]),!t)return null;const f=()=>{r({component_key:"schedule_viewer",message:"Agenda Viewer",data:{threadId:t,assistantId:n,tasks:i,onRefresh:d}})},h=i.length===0?"No schedules":c>0?`${c} scheduled`:`${i.length} total`;return C.jsx(Or,{title:e,children:C.jsx("div",{style:{cursor:"pointer",display:"inline-flex",alignItems:"center",gap:8},children:C.jsx(tn,{style:{fontSize:12,color:c>0?"#1890ff":"#666",fontWeight:c>0?500:400,maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},type:"text",size:"small",icon:l?C.jsx(ul,{size:"small"}):C.jsx(MFt,{}),onClick:f,disabled:l,children:h})})})},qje=()=>{var
|
|
3473
|
+
`})),qlr=()=>{const{styles:e}=Wlr(),{interrupts:t}=od();return t&&t.length>0?C.jsx(n5,{className:e.card,size:"small",bordered:!1,defaultActiveKey:["hitl"],children:C.jsx(VE,{showArrow:!1,header:C.jsx(Yr,{bordered:!1,color:"orange",style:{fontSize:14,fontWeight:"bold",background:"#ffffff8f",padding:4,borderRadius:8},children:"Pending Feedback"}),children:C.jsx(tr,{direction:"vertical",style:{width:"100%"},children:t.map(n=>C.jsx(zd,{content:n.value},n.id))})},"hitl")}):null},Gje=({})=>{const{openSideApp:e}=Dl(),{todos:t}=od();if(!t||t.length===0)return C.jsx(hx,{content:C.jsx("div",{style:{width:400},children:C.jsx(oD,{data:[],component_key:"header_todos"})}),title:"Todos",trigger:"click",placement:"bottomRight",children:C.jsx(Or,{title:"No tasks",children:C.jsxs("div",{style:{cursor:"pointer",display:"inline-flex",alignItems:"center",gap:8},children:[C.jsx(I4,{type:"circle",strokeColor:{"0%":"#91caff","100%":"#003eb3"},percent:0,width:30,format:()=>C.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:1},children:C.jsx("span",{style:{fontSize:8},children:"0/0"})})}),C.jsx("span",{style:{fontSize:12,color:"#999",maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:"No tasks"})]})})});const n=t.filter(c=>c.status==="completed").length,r=t.length,a=t.some(c=>c.status==="in_progress"),i=t.filter(c=>c.status==="in_progress"),o=Math.round(n/r*100),s=i.length>0?i.length===1?i[0].content:`${i.length} in progress`:n>0?`${n} completed`:"No tasks";return C.jsx(hx,{content:C.jsx("div",{style:{width:400},children:C.jsx(oD,{data:t,component_key:"header_todos"})}),title:"Todos",trigger:"click",placement:"bottomRight",children:C.jsx(Or,{title:`${n} / ${r} tasks completed`,children:C.jsxs("div",{style:{cursor:"pointer",display:"inline-flex",alignItems:"center",gap:8},children:[C.jsx(I4,{type:"circle",strokeColor:{"0%":"#91caff","100%":"#003eb3"},percent:o,status:a?"active":"normal",width:22,format:()=>C.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:1},children:C.jsxs("span",{style:{fontSize:8},children:[n,"/",r]})})}),C.jsx("span",{style:{fontSize:12,color:a?"#1890ff":"#666",fontWeight:a?500:400,maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s})]})})})},Qlr=({})=>{const{tasks:e}=od(),{openSideApp:t}=Dl();if(!e||e.length===0)return C.jsx(Or,{title:"No tasks",children:C.jsxs("div",{style:{cursor:"pointer",display:"inline-flex",alignItems:"center",gap:8,padding:"0px 4px"},onClick:()=>t({component_key:"task_board",message:"Tasks",data:{}}),children:[C.jsx(I4,{type:"circle",strokeColor:{"0%":"#91caff","100%":"#003eb3"},percent:0,width:30,format:()=>C.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:1},children:C.jsx("span",{style:{fontSize:8},children:"0/0"})})}),C.jsx("span",{style:{fontSize:12,color:"#999",maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:"No tasks"})]})});const n=e.filter(c=>c.status==="completed").length,r=e.length,a=e.some(c=>c.status==="in_progress"),i=e.filter(c=>c.status==="in_progress"),o=Math.round(n/r*100),s=i.length>0?i.length===1?i[0].title:`${i.length} in progress`:n>0?`${n} completed`:"No tasks";return C.jsx(Or,{title:`${n} / ${r} tasks completed`,children:C.jsxs("div",{style:{cursor:"pointer",display:"inline-flex",alignItems:"center",gap:8},onClick:()=>t({component_key:"task_board",message:"Tasks",data:{}}),children:[C.jsx(I4,{type:"circle",strokeColor:{"0%":"#91caff","100%":"#003eb3"},percent:o,status:a?"active":"normal",width:22,format:()=>C.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",lineHeight:1},children:C.jsxs("span",{style:{fontSize:8},children:[n,"/",r]})})}),C.jsx("span",{style:{fontSize:12,color:a?"#1890ff":"#666",fontWeight:a?500:400,maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s})]})})},Vje=()=>{const{todos:e,tasks:t}=od();return e&&e.length>0?C.jsx(Gje,{}):t&&t.length>0?C.jsx(Qlr,{}):C.jsx(Gje,{})},Wje=({})=>{var a;const{agentState:e}=od(),{openSideApp:t}=Dl(),n=((a=e==null?void 0:e.values)==null?void 0:a.files)||[],r=Object.keys(n).length;return C.jsx(Or,{title:"File Explorer",children:C.jsx(tn,{style:{fontSize:12,color:r>0?"#1890ff":"#666",fontWeight:r>0?500:400,maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},type:"text",size:"small",icon:C.jsx(WUt,{}),onClick:()=>t({component_key:"file_explorer",message:"File Explorer",data:{files:n}}),children:r===0?"No files":`${r} files`})})},Ylr=({tooltipText:e="Agenda"})=>{const{threadId:t,assistantId:n}=od(),{openSideApp:r}=Dl(),a=m1(n||""),[i,o]=b.useState([]),[l,s]=b.useState(!1),[c,u]=b.useState(0),d=b.useCallback(async()=>{if(t){s(!0);try{const g=await a.schedules.getByThread({threadId:t});o(g);const m=g.filter(A=>A.status===Is.PENDING||A.status===Is.PAUSED).length;u(m)}catch(g){console.error("Failed to fetch scheduled tasks:",g),o([]),u(0)}finally{s(!1)}}},[a,t]);if(b.useEffect(()=>{d()},[d]),!t)return null;const f=()=>{r({component_key:"schedule_viewer",message:"Agenda Viewer",data:{threadId:t,assistantId:n,tasks:i,onRefresh:d}})},h=i.length===0?"No schedules":c>0?`${c} scheduled`:`${i.length} total`;return C.jsx(Or,{title:e,children:C.jsx("div",{style:{cursor:"pointer",display:"inline-flex",alignItems:"center",gap:8},children:C.jsx(tn,{style:{fontSize:12,color:c>0?"#1890ff":"#666",fontWeight:c>0?500:400,maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},type:"text",size:"small",icon:l?C.jsx(ul,{size:"small"}):C.jsx(MFt,{}),onClick:f,disabled:l,children:h})})})},qje=()=>{var l;const{agentState:e,threadId:t,assistantId:n}=od(),{openSideApp:r}=Dl(),a=(l=e==null?void 0:e.values)==null?void 0:l.team,i=(a==null?void 0:a.teammates)||[];if(!a||i.length===0)return null;const o=()=>{r({component_key:"team_workspace",message:"Teammates",data:{teamId:a.teamId,teammates:i.map(s=>({name:s.name,role:s.role,description:s.description})),parent_thread_id:t},context:{thread_id:t,assistant_id:n}})};return C.jsx(Or,{title:"Team Workspace",children:C.jsx(tn,{type:"text",size:"small",icon:C.jsx(PXe,{}),onClick:o,style:{fontSize:12,color:"#666"},children:i.length===1?"1 member":`${i.length} members`})})},Qje=()=>{var o,l;const{agentState:e}=od(),{openSideApp:t}=Dl(),n=(o=e==null?void 0:e.values)==null?void 0:o.team_mailbox,r=(n==null?void 0:n.length)??0;if(!!!((l=e==null?void 0:e.values)!=null&&l.team))return null;const i=()=>{var s;t({component_key:"mailbox",message:"Team Mailbox",data:{teamMailbox:n||[],team:(s=e==null?void 0:e.values)==null?void 0:s.team}})};return C.jsx(Or,{title:"Team Mailbox",children:C.jsx(tn,{type:"text",size:"small",icon:C.jsx(Afe,{}),onClick:i,style:{fontSize:12,color:"#666"},children:r>0?`${r} mails`:"Mailbox"})})},Klr=({variant:e="compact"})=>{var u,d,f;const{agentState:t,todos:n,tasks:r}=od(),a=((u=t==null?void 0:t.values)==null?void 0:u.files)||{},i=Object.keys(a).length,o=n&&n.length>0||r&&r.length>0,l=!!((d=t==null?void 0:t.values)!=null&&d.team),s=(f=t==null?void 0:t.values)==null?void 0:f.team_mailbox,c=l&&((s==null?void 0:s.length)??0)>0;return e==="compact"?o||i>0||l||c?C.jsxs(tr,{size:4,children:[o&&C.jsx(Vje,{}),i>0&&C.jsx(Wje,{}),l&&C.jsx(qje,{}),c&&C.jsx(Qje,{})]}):null:C.jsxs(tr,{size:8,children:[C.jsx(Vje,{}),C.jsx(Wje,{}),C.jsx(Ylr,{}),C.jsx(qje,{}),C.jsx(Qje,{})]})},Xlr=({onNewThread:e,onRefresh:t,onViewHistory:n})=>C.jsxs(tr,{size:4,children:[C.jsx(Or,{title:"New Thread",children:C.jsx(tn,{type:"text",size:"small",icon:C.jsx(j3,{}),onClick:e,style:{fontSize:14,color:"#666"}})}),C.jsx(Or,{title:"Refresh",children:C.jsx(tn,{type:"text",size:"small",icon:C.jsx(Kb,{}),onClick:t,style:{fontSize:14,color:"#666"}})}),C.jsx(Or,{title:"Thread History",children:C.jsx(tn,{type:"text",size:"small",icon:C.jsx(Qzt,{}),onClick:n,style:{fontSize:14,color:"#666"}})})]}),Zlr=({open:e,onCancel:t,onCreate:n})=>{const[r]=ra.useForm(),[a,i]=b.useState(!1),o=async s=>{i(!0);try{await n(s.name,s.description),r.resetFields()}finally{i(!1)}},l=()=>{r.resetFields(),t()};return C.jsx(ji,{title:"New Project",open:e,onCancel:l,onOk:()=>r.submit(),confirmLoading:a,okText:"Create",cancelText:"Cancel",width:420,centered:!0,children:C.jsxs(ra,{form:r,layout:"vertical",onFinish:o,autoComplete:"off",style:{marginTop:16},children:[C.jsx(ra.Item,{name:"name",label:"Project name",rules:[{required:!0,message:"Please enter a project name"},{max:50,message:"Project name must be less than 50 characters"}],children:C.jsx(Zn,{placeholder:"Enter project name",autoFocus:!0})}),C.jsx(ra.Item,{name:"description",label:"Description (optional)",children:C.jsx(Zn.TextArea,{placeholder:"Enter project description",rows:3})})]})})},{radius:df,spacing:Ed}=Wo,{Text:Jlr}=Ar,esr=Ni(({css:e,token:t})=>({container:e`
|
|
3474
3474
|
display: flex;
|
|
3475
3475
|
flex-direction: column;
|
|
3476
3476
|
height: 100%;
|
|
@@ -4045,7 +4045,7 @@ ${JSON.stringify(p)}
|
|
|
4045
4045
|
`})),Esr=e=>{switch(e){case Is.PENDING:return"processing";case Is.RUNNING:return"blue";case Is.COMPLETED:return"success";case Is.FAILED:return"error";case Is.CANCELLED:return"default";case Is.PAUSED:return"warning";default:return"default"}},wsr=e=>{switch(e){case Is.PENDING:return C.jsx(Qb,{});case Is.RUNNING:return C.jsx(BXe,{spin:!0});case Is.COMPLETED:return C.jsx(a5,{});case Is.FAILED:return C.jsx(ufe,{});case Is.CANCELLED:return C.jsx(DXe,{});case Is.PAUSED:return C.jsx(OXe,{});default:return C.jsx(Qb,{})}},rGe=e=>e?UD(e).format("YYYY-MM-DD HH:mm:ss"):"-",aGe=e=>e?UD(e).fromNow():"",Csr=({data:e})=>{const{styles:t}=xsr(),{threadId:n,assistantId:r,tasks:a,onRefresh:i}=e??{},o=m1(r||""),[l,s]=b.useState(a||[]),[c,u]=b.useState(!1),[d,f]=b.useState(null),p=b.useCallback(async()=>{if(n){u(!0);try{const y=await o.schedules.getByThread({threadId:n});s(y),i==null||i()}catch(y){console.error("Failed to refresh tasks:",y),hn.error("Failed to refresh scheduled tasks")}finally{u(!1)}}},[o,n,i]),h=b.useCallback(async y=>{f(y);try{await o.schedules.cancel(y),hn.success("Task cancelled successfully"),await p()}catch(_){console.error("Failed to cancel task:",_),hn.error("Failed to cancel task")}finally{f(null)}},[o,p]),g=b.useCallback(async y=>{f(y);try{await o.schedules.pause(y),hn.success("Task paused successfully"),await p()}catch(_){console.error("Failed to pause task:",_),hn.error("Failed to pause task")}finally{f(null)}},[o,p]),m=b.useCallback(async y=>{f(y);try{await o.schedules.resume(y),hn.success("Task resumed successfully"),await p()}catch(_){console.error("Failed to resume task:",_),hn.error("Failed to resume task")}finally{f(null)}},[o,p]);b.useEffect(()=>{n&&(!a||a.length===0)&&p()},[n]),b.useEffect(()=>{a&&s(a)},[a]);const A=y=>{const _=d===y.taskId,x=y.status===Is.PENDING,S=y.status===Is.PAUSED,E=y.executionType===Ere.CRON;return C.jsxs(tr,{className:t.actions,children:[x&&E&&C.jsx(Or,{title:"Pause",children:C.jsx(tn,{type:"text",size:"small",icon:C.jsx(OXe,{}),onClick:()=>g(y.taskId),loading:_})}),S&&C.jsx(Or,{title:"Resume",children:C.jsx(tn,{type:"text",size:"small",icon:C.jsx(MXe,{}),onClick:()=>m(y.taskId),loading:_})}),(x||S)&&C.jsx(fw,{title:"Cancel this scheduled task?",description:"This action cannot be undone.",onConfirm:()=>h(y.taskId),okText:"Yes",cancelText:"No",children:C.jsx(Or,{title:"Cancel",children:C.jsx(tn,{type:"text",size:"small",danger:!0,icon:C.jsx(DXe,{}),loading:_})})})]})},v=y=>{const _=y.status===Is.PENDING||y.status===Is.PAUSED;return C.jsxs(Ti,{className:t.taskCard,size:"small",bordered:!0,children:[C.jsxs("div",{className:t.taskHeader,children:[C.jsxs("div",{children:[C.jsx("div",{className:t.taskType,children:y.taskType}),C.jsx("div",{className:t.taskId,children:y.taskId})]}),C.jsx(Yr,{color:Esr(y.status),icon:wsr(y.status),children:y.status.toUpperCase()})]}),C.jsxs("div",{className:t.metaRow,children:[C.jsx(Or,{title:"Execution Type",children:C.jsxs("div",{className:t.metaItem,children:[C.jsx(jUt,{}),C.jsx("span",{children:y.executionType===Ere.CRON?"Recurring":"One-time"})]})}),y.cronExpression&&C.jsx(Or,{title:"Cron Expression",children:C.jsxs("div",{className:t.metaItem,children:[C.jsx(Qb,{}),C.jsx("code",{className:t.cronExpression,children:y.cronExpression})]})}),y.nextRunAt&&C.jsx(Or,{title:`Next run: ${rGe(y.nextRunAt)}`,children:C.jsxs("div",{className:t.metaItem,children:[C.jsx(Qb,{}),C.jsxs("span",{children:["Next: ",aGe(y.nextRunAt)]})]})}),y.executeAt&&!y.cronExpression&&C.jsx(Or,{title:`Execute at: ${rGe(y.executeAt)}`,children:C.jsxs("div",{className:t.metaItem,children:[C.jsx(Qb,{}),C.jsxs("span",{children:["At: ",aGe(y.executeAt)]})]})}),y.runCount>0&&C.jsx(Or,{title:"Run count",children:C.jsxs("div",{className:t.metaItem,children:[C.jsx(BXe,{}),C.jsxs("span",{children:["Runs: ",y.runCount,y.maxRuns?` / ${y.maxRuns}`:""]})]})})]}),y.lastError&&C.jsx("div",{style:{marginTop:8},children:C.jsxs(nGe,{type:"danger",style:{fontSize:12},children:[C.jsx(kUt,{style:{marginRight:4}}),y.lastError]})}),y.metadata&&Object.keys(y.metadata).length>0&&C.jsx(_Ye,{size:"small",column:1,style:{marginTop:12},items:Object.entries(y.metadata).map(([x,S])=>({key:x,label:x,children:typeof S=="object"?JSON.stringify(S):String(S)}))}),_&&A(y)]},y.taskId)};return C.jsxs("div",{className:t.container,children:[C.jsxs("div",{className:t.header,children:[C.jsx(Ssr,{level:5,style:{margin:0},children:"Scheduled Tasks"}),C.jsx(Or,{title:"Refresh",children:C.jsx(tn,{type:"text",icon:C.jsx(Kb,{spin:c}),onClick:p,loading:c})})]}),c&&l.length===0?C.jsxs("div",{className:t.emptyContainer,children:[C.jsx(ul,{size:"large"}),C.jsx(nGe,{type:"secondary",style:{marginTop:16},children:"Loading scheduled tasks..."})]}):l.length===0?C.jsx("div",{className:t.emptyContainer,children:C.jsx(ai,{image:ai.PRESENTED_IMAGE_SIMPLE,description:"No scheduled tasks for this thread"})}):C.jsx("div",{children:l.map(v)})]})},{Text:qdr}=Ar,Tsr=({data:e,component_key:t,interactive:n=!0})=>{const r=e,{threadId:a,assistantId:i}=A1(),{config:o}=Zo(),l=`/sandbox/assistants/${i}/threads/${a}/sandbox/websockify`;let s=`/api/assistants/${i}/threads/${a}/sandbox?autoconnect=true&resize=scale&reconnect=1&path${l}`;o.globalSharedSandboxURL&&(s=`${o.globalSharedSandboxURL}/vnc/index.html?autoconnect=true&resize=scale&reconnect=1&path=/sandbox/global/websockify`);function c(g){switch(g){case"success":return C.jsx(a5,{style:{color:"#52c41a"}});case"error":return C.jsx(Sx,{style:{color:"#ff4d4f"}});default:return C.jsx(rB,{style:{color:"#1890ff"}})}}const u=g=>g?g.replace(/([a-z])([A-Z])/g,"$1 $2").split(/[_-]/).map(m=>m.charAt(0).toUpperCase()+m.slice(1)).join(" "):"",d=g=>{try{const m=Object.values(g).map(v=>typeof v=="object"?JSON.stringify(v).substring(0,50)+(JSON.stringify(v).length>50?"...":""):String(v).substring(0,50)+(String(v).length>50?"...":"")).join(" ");return(m.length>100?m.substring(0,100)+"...":m).replaceAll(`
|
|
4046
4046
|
`," ")}catch{return"Error parsing args"}},f=C.jsxs(Af,{align:"center",wrap:"wrap",children:[C.jsx(Ar.Text,{strong:!0,children:u(r.name)}),C.jsx(Ar.Text,{type:"secondary",style:{fontSize:"12px",marginLeft:"8px"},children:d(r.args)})]}),{openSideApp:p}=Dl();if(!r)return null;const h=g=>{p({component_key:"browser_viewer",message:"View Browser",data:{url:s}})};return C.jsx(MC,{panelKey:r.id,header:f,expandIcon:()=>c(r.status),extra:C.jsx(tn,{type:"link",size:"small",onClick:g=>{g.stopPropagation(),h()},children:"View Browser"}),children:C.jsx(zd,{content:r.response||""})})},{Text:Isr}=Ar,Rsr=({data:e,component_key:t,interactive:n=!0})=>{const r=e,{language:a,code:i}=(r==null?void 0:r.args)||{},{openSideApp:o}=Dl();if(!r)return null;const l=C.jsx(tr,{children:C.jsx(Isr,{strong:!0,children:"Execute Code"})}),s=u=>{o({component_key:"file_content_diff_view",message:"Code View",data:{old_code:"",new_code:i}})},c=`\`\`\`${a}
|
|
4047
4047
|
${i}
|
|
4048
|
-
\`\`\``;return C.jsxs(MC,{panelKey:r.id,header:l,expandIcon:()=>m3t(r.status),extra:C.jsx(tn,{type:"link",size:"small",onClick:u=>{u.stopPropagation(),s()},children:"Code View"}),children:[C.jsx(zd,{content:c}),r.response&&C.jsx(zd,{content:r.response||""})]})},{Text:ob}=Ar,Gve=e=>{if(!e)return null;const t=e.match(/```json\n([\s\S]*?)\n```/);if(t&&t[1])try{const n=JSON.parse(t[1]);return{teamId:n==null?void 0:n.teamId,teamLeadId:n==null?void 0:n.teamLeadId,teammates:Array.isArray(n==null?void 0:n.teammates)?n.teammates:[],tasks:Array.isArray(n==null?void 0:n.tasks)?n.tasks:[]}}catch{return null}return null},Nsr=e=>{if(!e)return[];const t=Gve(e.response);if(t!=null&&t.teammates&&Array.isArray(t.teammates))return t.teammates.filter(r=>r&&r.name);const n=e.args;return n!=null&&n.teammates&&Array.isArray(n.teammates)?n.teammates.filter(r=>r&&r.name):[]},Osr=e=>{var n;if(!e)return"";const t=Gve(e.response);return t!=null&&t.teamId?t.teamId:((n=e.args)==null?void 0:n.teamName)||""},Msr=e=>{if(!e)return[];const t=Gve(e.response);if(t!=null&&t.tasks&&Array.isArray(t.tasks))return t.tasks.filter(r=>r&&r.id);const n=e.args;return n!=null&&n.tasks&&Array.isArray(n.tasks)?n.tasks.filter(r=>r&&r.id):[]},Lsr=({data:e})=>{const t=Nsr(e),n=Msr(e),r=Osr(e),{openSideApp:a}=Dl(),{threadId:i}=od(),
|
|
4048
|
+
\`\`\``;return C.jsxs(MC,{panelKey:r.id,header:l,expandIcon:()=>m3t(r.status),extra:C.jsx(tn,{type:"link",size:"small",onClick:u=>{u.stopPropagation(),s()},children:"Code View"}),children:[C.jsx(zd,{content:c}),r.response&&C.jsx(zd,{content:r.response||""})]})},{Text:ob}=Ar,Gve=e=>{if(!e)return null;const t=e.match(/```json\n([\s\S]*?)\n```/);if(t&&t[1])try{const n=JSON.parse(t[1]);return{teamId:n==null?void 0:n.teamId,teamLeadId:n==null?void 0:n.teamLeadId,teammates:Array.isArray(n==null?void 0:n.teammates)?n.teammates:[],tasks:Array.isArray(n==null?void 0:n.tasks)?n.tasks:[]}}catch{return null}return null},Nsr=e=>{if(!e)return[];const t=Gve(e.response);if(t!=null&&t.teammates&&Array.isArray(t.teammates))return t.teammates.filter(r=>r&&r.name);const n=e.args;return n!=null&&n.teammates&&Array.isArray(n.teammates)?n.teammates.filter(r=>r&&r.name):[]},Osr=e=>{var n;if(!e)return"";const t=Gve(e.response);return t!=null&&t.teamId?t.teamId:((n=e.args)==null?void 0:n.teamName)||""},Msr=e=>{if(!e)return[];const t=Gve(e.response);if(t!=null&&t.tasks&&Array.isArray(t.tasks))return t.tasks.filter(r=>r&&r.id);const n=e.args;return n!=null&&n.tasks&&Array.isArray(n.tasks)?n.tasks.filter(r=>r&&r.id):[]},Lsr=({data:e})=>{const t=Nsr(e),n=Msr(e),r=Osr(e),{openSideApp:a}=Dl(),{threadId:i,assistantId:o}=od(),l=["#1890ff","#52c41a","#faad14","#f5222d","#722ed1","#13c2c2","#eb2f96","#fa8c16"],s=f=>{let p=0;for(let h=0;h<f.length;h++)p=f.charCodeAt(h)+((p<<5)-p);return l[Math.abs(p)%l.length]},c=f=>f.split(" ").map(p=>p.charAt(0)).join("").toUpperCase().slice(0,2),u=()=>{r&&a({component_key:"team_workspace",message:"Teammates",data:{teamId:r,teammates:t,parent_thread_id:i},context:{thread_id:i,assistant_id:o}})},d=!!r&&t.length>0;return t.length===0?C.jsx(Ti,{style:{width:"100%"},bodyStyle:{padding:12},children:C.jsx(Cp,{active:!0})}):C.jsxs(Ti,{style:{width:"100%"},bodyStyle:{padding:12},title:C.jsxs(tr,{children:[C.jsx(PXe,{}),C.jsx("span",{children:"Team Members"})]}),extra:d?C.jsx(tn,{type:"text",icon:C.jsx(GGt,{size:16}),onClick:u,children:"Workbench"}):null,children:[C.jsx(Ha,{dataSource:t,renderItem:f=>C.jsxs(Ha.Item,{style:{display:"block"},children:[C.jsxs(tr,{align:"center",size:12,children:[C.jsx(z3,{size:40,icon:C.jsx(aB,{}),src:f==null?void 0:f.avatar,style:{backgroundColor:s((f==null?void 0:f.name)||""),color:"#fff",fontSize:14,fontWeight:600},children:c((f==null?void 0:f.name)||"")}),C.jsxs("div",{style:{flex:1},children:[C.jsx(ob,{strong:!0,style:{display:"block"},children:(f==null?void 0:f.name)||"Unnamed"}),C.jsx(Yr,{color:"blue",style:{margin:0,marginTop:4},children:(f==null?void 0:f.role)||"unknown"})]})]}),(f==null?void 0:f.description)&&C.jsx(ob,{type:"secondary",style:{display:"block",marginTop:8,fontSize:12,marginLeft:52},children:f.description})]})}),n.length>0&&C.jsxs("div",{style:{marginTop:16,paddingTop:16,borderTop:"1px solid #f0f0f0"},children:[C.jsxs(ob,{strong:!0,style:{display:"block",marginBottom:8},children:["Pending Tasks (",n.filter(f=>f.status==="pending").length,")"]}),C.jsx(Ha,{size:"small",dataSource:n.filter(f=>f.status==="pending"),renderItem:f=>C.jsx(Ha.Item,{style:{padding:"8px 0"},children:C.jsxs("div",{children:[C.jsx(ob,{style:{fontSize:12,color:"#7A7A7A"},children:f.id}),C.jsx(ob,{strong:!0,style:{display:"block",fontSize:13},children:f.title}),f.description&&C.jsx(ob,{type:"secondary",style:{fontSize:11},children:f.description.length>100?f.description.slice(0,100)+"...":f.description})]})})})]})]})},ksr=Lsr,Dsr=Ni(({token:e,css:t})=>({container:t`
|
|
4049
4049
|
display: flex;
|
|
4050
4050
|
flex-direction: column;
|
|
4051
4051
|
height: 100%;
|
|
@@ -4147,7 +4147,7 @@ ${i}
|
|
|
4147
4147
|
font-weight: 600;
|
|
4148
4148
|
color: #fff;
|
|
4149
4149
|
flex-shrink: 0;
|
|
4150
|
-
`})),Bsr=e=>e.split(/[\s_-]/).map(t=>t.charAt(0)).join("").toUpperCase().slice(0,2),Psr=e=>{const t=["#1890ff","#52c41a","#faad14","#f5222d","#722ed1","#13c2c2","#eb2f96","#fa8c16"];let n=0;for(let r=0;r<e.length;r++)n=e.charCodeAt(r)+((n<<5)-n);return t[Math.abs(n)%t.length]},$sr=e=>{if(e.icon)return e.icon;switch(e.type){case"dashboard":return C.jsx(kGt,{size:20});case"inbox":return C.jsx(MGt,{size:20});case"issues":return C.jsx(AGt,{size:20});case"org":return C.jsx(WGt,{size:20});case"teammate":return e.data?C.jsx("div",{style:{width:20,height:20,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:600,color:"#fff",background:Psr(e.data.name)},children:Bsr(e.data.name)}):C.jsx(S8e,{size:20});default:return C.jsx(S8e,{size:20})}},Fsr=({items:e,activeItem:t,onItemClick:n})=>{const{styles:r}=Dsr(),[a,i]=b.useState(!1),o=e.filter(d=>!d.group),l=e.filter(d=>d.group==="Teammates"),s=e.filter(d=>d.group==="Team"),c=(d,f)=>{const p=C.jsxs("div",{className:`${r.menuItem} ${a?"":r.menuItemCollapsed} ${t===d.id?"active":""}`,onClick:()=>n(d),children:[C.jsx("span",{className:r.menuIcon,children:$sr(d)}),a&&C.jsx("span",{className:r.menuLabel,children:d.name}),d.badge&&C.jsx(nw,{count:d.badge,size:"small",className:r.badge,style:{backgroundColor:"#ff4d4f"}})]});return a?C.jsx(le.Fragment,{children:p},d.id):C.jsx(Or,{title:d.name,placement:"right",children:p},d.id)},u=(d,f,p)=>d.length===0?null:C.jsxs(C.Fragment,{children:[p&&C.jsx("div",{className:r.groupDivider}),C.jsxs("div",{className:r.menuGroup,children:[a&&f&&C.jsx("div",{className:r.groupLabel,children:f}),d.map(h=>c(h))]})]});return C.jsxs("div",{className:`${r.container} ${a?r.containerExpanded:r.containerCollapsed}`,children:[C.jsx("button",{className:r.toggleButton,onClick:()=>i(!a),title:a?"Collapse":"Expand",children:a?C.jsx(bfe,{size:16}):C.jsx(O4,{size:16})}),C.jsxs("div",{className:r.menuContent,children:[u(o,null,!1),u(l,"Teammates",o.length>0),u(s,"Team",o.length>0||l.length>0)]})]})};function Usr(e){const{agentState:
|
|
4150
|
+
`})),Bsr=e=>e.split(/[\s_-]/).map(t=>t.charAt(0)).join("").toUpperCase().slice(0,2),Psr=e=>{const t=["#1890ff","#52c41a","#faad14","#f5222d","#722ed1","#13c2c2","#eb2f96","#fa8c16"];let n=0;for(let r=0;r<e.length;r++)n=e.charCodeAt(r)+((n<<5)-n);return t[Math.abs(n)%t.length]},$sr=e=>{if(e.icon)return e.icon;switch(e.type){case"dashboard":return C.jsx(kGt,{size:20});case"inbox":return C.jsx(MGt,{size:20});case"issues":return C.jsx(AGt,{size:20});case"org":return C.jsx(WGt,{size:20});case"teammate":return e.data?C.jsx("div",{style:{width:20,height:20,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:600,color:"#fff",background:Psr(e.data.name)},children:Bsr(e.data.name)}):C.jsx(S8e,{size:20});default:return C.jsx(S8e,{size:20})}},Fsr=({items:e,activeItem:t,onItemClick:n})=>{const{styles:r}=Dsr(),[a,i]=b.useState(!1),o=e.filter(d=>!d.group),l=e.filter(d=>d.group==="Teammates"),s=e.filter(d=>d.group==="Team"),c=(d,f)=>{const p=C.jsxs("div",{className:`${r.menuItem} ${a?"":r.menuItemCollapsed} ${t===d.id?"active":""}`,onClick:()=>n(d),children:[C.jsx("span",{className:r.menuIcon,children:$sr(d)}),a&&C.jsx("span",{className:r.menuLabel,children:d.name}),d.badge&&C.jsx(nw,{count:d.badge,size:"small",className:r.badge,style:{backgroundColor:"#ff4d4f"}})]});return a?C.jsx(le.Fragment,{children:p},d.id):C.jsx(Or,{title:d.name,placement:"right",children:p},d.id)},u=(d,f,p)=>d.length===0?null:C.jsxs(C.Fragment,{children:[p&&C.jsx("div",{className:r.groupDivider}),C.jsxs("div",{className:r.menuGroup,children:[a&&f&&C.jsx("div",{className:r.groupLabel,children:f}),d.map(h=>c(h))]})]});return C.jsxs("div",{className:`${r.container} ${a?r.containerExpanded:r.containerCollapsed}`,children:[C.jsx("button",{className:r.toggleButton,onClick:()=>i(!a),title:a?"Collapse":"Expand",children:a?C.jsx(bfe,{size:16}):C.jsx(O4,{size:16})}),C.jsxs("div",{className:r.menuContent,children:[u(o,null,!1),u(l,"Teammates",o.length>0),u(s,"Team",o.length>0||l.length>0)]})]})};function Usr(e,t){const{agentState:n,isLoading:r,error:a,refresh:i}=For(e,t,{pollingInterval:5e3,autoStart:!0});return{...b.useMemo(()=>{var p,h,g;const l=((p=n==null?void 0:n.values)==null?void 0:p.team)||null,s=((h=n==null?void 0:n.values)==null?void 0:h.tasks)||[],c=((g=n==null?void 0:n.values)==null?void 0:g.team_mailbox)||[],u={totalTasks:s.length,pendingTasks:s.filter(m=>m.status==="pending").length,inProgressTasks:s.filter(m=>m.status==="claimed"||m.status==="in_progress").length,completedTasks:s.filter(m=>m.status==="completed").length,failedTasks:s.filter(m=>m.status==="failed").length,totalActivities:c.length,unreadMessages:c.filter(m=>!m.read).length},d=s.slice().sort((m,A)=>new Date(A.updatedAt).getTime()-new Date(m.updatedAt).getTime()).slice(0,10),f=c.slice().sort((m,A)=>new Date(A.timestamp).getTime()-new Date(m.timestamp).getTime()).slice(0,10);return{team:l,tasks:s,mailbox:c,stats:u,recentTasks:d,recentActivities:f}},[n]),isLoading:r,error:a,refresh:i}}var{Title:zsr,Text:Hsr}=Ar,jsr=Ni(({token:e,css:t})=>({container:t`
|
|
4151
4151
|
padding: ${e.paddingLG}px;
|
|
4152
4152
|
`,header:t`
|
|
4153
4153
|
margin-bottom: ${e.marginLG}px;
|
|
@@ -5000,7 +5000,7 @@ ${i}
|
|
|
5000
5000
|
align-items: center;
|
|
5001
5001
|
justify-content: center;
|
|
5002
5002
|
height: 100%;
|
|
5003
|
-
`})),Mcr=(e,t,n)=>e?`${e}____${t}_${n}`:`standalone_${t}_${n}`,Lcr=(e,t)=>`team:${e}:${t}`,kcr=({data:e})=>{const{styles:t}=Ocr(),{teamId:n,teammates:r,parent_thread_id:a}=e||{},{team:i,tasks:o,mailbox:l,stats:s,recentTasks:c,recentActivities:u,isLoading:d,refresh:f}=Usr(a||null),[p,h]=b.useState("dashboard"),g=b.useMemo(()=>{const v=[{id:"dashboard",type:"dashboard",name:"Dashboard"},{id:"inbox",type:"inbox",name:"Inbox",badge:s.unreadMessages>0?s.unreadMessages:void 0},{id:"issues",type:"issues",name:"Issues",badge:s.pendingTasks>0?s.pendingTasks:void 0}];return r==null||r.forEach((y,_)=>{v.push({id:`teammate-${_}`,type:"teammate",name:y.name,group:"Teammates",data:y})}),v.push({id:"org",type:"org",name:"Org",group:"Team"}),v},[r,s]),m=v=>{h(v.id)},A=()=>{if(d)return C.jsx("div",{className:t.loadingContainer,children:C.jsx(ul,{size:"large"})});const v=g.find(y=>y.id===p);switch(v==null?void 0:v.type){case"dashboard":return C.jsx(qsr,{stats:s,recentTasks:c,recentActivities:u,team:i});case"inbox":return C.jsx(T3t,{data:{teamMailbox:l,team:{teamId:(i==null?void 0:i.teamId)||n||"",teamLeadId:(i==null?void 0:i.teamLeadId)||"team_lead",teammates:r||[]}}});case"issues":return C.jsx(icr,{tasks:o,teamId:n||"",teammates:r||[]});case"teammate":if(v.data&&n){const y=Mcr(a,n,v.data.name),_=Lcr(n,v.data.name);return C.jsx(mcr,{teammate:v.data,threadId:y,assistantId:_})}return null;case"org":return C.jsx(ucr,{team:i,teammates:r||[],tasks:o});default:return null}};return C.jsxs("div",{className:t.container,children:[C.jsx(Fsr,{items:g,activeItem:p,onItemClick:m}),C.jsxs(Ncr,{className:t.content,children:[C.jsx(tn,{className:t.refreshButton,icon:C.jsx(ZGt,{size:16}),onClick:f,loading:d,type:"text",children:"Refresh"}),C.jsx("div",{className:t.contentInner,children:A()})]})]})},Dcr=(e,t)=>({card:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px",background:t?"#FAFAFA":"#FFFFFF",border:"1px solid #E8E8E8",borderRadius:"0px",cursor:"pointer",transition:"border-color 0.2s ease",maxWidth:"100%",overflow:"hidden"},header:{display:"flex",justifyContent:"space-between",alignItems:"center"},taskId:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"12px",fontWeight:500,color:"#7A7A7A"},assignee:{fontFamily:"'Inter', sans-serif",fontSize:"11px",fontWeight:500,color:e==="completed"?"#22C55E":"#E42313"},title:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"14px",fontWeight:500,color:"#0D0D0D",margin:0,lineHeight:1.4},description:{fontFamily:"'Inter', sans-serif",fontSize:"12px",color:"#7A7A7A",margin:0,lineHeight:1.4},depRow:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px",marginTop:"4px"},depLabel:{fontFamily:"'Inter', sans-serif",fontSize:"11px",color:"#B0B0B0"},depBadge:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 6px",fontSize:"10px",borderRadius:"0px"},depBadgeCompleted:{background:"#22C55E",border:"1px solid #22C55E",color:"#FFFFFF"},depBadgePending:{background:"transparent",border:"1px solid #E8E8E8",color:"#7A7A7A"},depBadgeInvalid:{background:"transparent",border:"1px solid #f5222d",color:"#f5222d"},checkIcon:{width:"10px",height:"10px",display:"flex",alignItems:"center",justifyContent:"center"},circleIcon:{width:"8px",height:"8px",borderRadius:"50%",background:"#7A7A7A"}}),Bcr=()=>C.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:C.jsx("polyline",{points:"20 6 9 17 4 12"})}),Pcr=()=>C.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"currentColor",children:C.jsx("circle",{cx:"12",cy:"12",r:"10"})}),$cr=({task:e,allTaskIds:t,getDependencyStatus:n})=>{const r=e.status==="completed",a=Dcr(e.status,r),i=()=>!e.dependencies||e.dependencies.length===0?C.jsx("span",{style:{...a.depLabel,color:"#7A7A7A"},children:"none"}):e.dependencies.map(o=>{const l=t.has(o),s=l?n(o):!1;let c=a.depBadgePending;return l?s&&(c=a.depBadgeCompleted):c=a.depBadgeInvalid,C.jsxs("span",{style:{...a.depBadge,...c,marginRight:"4px"},children:[C.jsx("span",{style:a.checkIcon,children:l&&s?C.jsx(Bcr,{}):l?C.jsx(Pcr,{}):null}),o]},o)});return C.jsxs("div",{style:a.card,children:[C.jsxs("div",{style:a.header,children:[C.jsx("span",{style:a.taskId,children:e.id}),e.assignee&&C.jsxs("span",{style:a.assignee,children:["@",e.assignee]})]}),C.jsx("h3",{style:a.title,children:e.title}),e.description&&C.jsx("p",{style:a.description,children:e.description}),C.jsxs("div",{style:a.depRow,children:[C.jsx("span",{style:a.depLabel,children:"Deps:"}),i()]})]})},Fcr=[{id:"pending",title:"Pending",color:"#7A7A7A"},{id:"in_progress",title:"In Progress",color:"#E42313"},{id:"completed",title:"Completed",color:"#22C55E"},{id:"failed",title:"Failed",color:"#f5222d"}],Ucr=()=>({container:{background:"#FFFFFF",padding:"40px 48px",gap:"32px",display:"flex",flexDirection:"column",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",height:"80px"},titleSection:{display:"flex",flexDirection:"column",gap:"4px"},pageTitle:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"40px",fontWeight:500,color:"#0D0D0D",letterSpacing:"-1px",margin:0},pageSubtitle:{fontFamily:"'Inter', sans-serif",fontSize:"14px",color:"#7A7A7A",margin:0},actions:{display:"flex",gap:"12px"},addButton:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",width:"120px",height:"40px",background:"#0D0D0D",color:"#FFFFFF",border:"none",borderRadius:"0px",fontFamily:"'Space Grotesk', sans-serif",fontSize:"13px",fontWeight:500,cursor:"pointer"},boardContainer:{display:"flex",gap:"24px",overflowX:"auto",paddingBottom:"16px"},column:{display:"flex",flexDirection:"column",gap:"16px",minWidth:"320px",maxWidth:"320px"},columnHeader:{display:"flex",justifyContent:"space-between",alignItems:"center",height:"40px"},columnTitle:{display:"flex",alignItems:"center",gap:"8px"},statusDot:{width:"8px",height:"8px",borderRadius:"0px"},columnLabel:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"14px",fontWeight:600,color:"#0D0D0D",margin:0},columnCount:{fontFamily:"'Inter', sans-serif",fontSize:"12px",color:"#7A7A7A"},emptyColumn:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"120px",border:"1px dashed #E8E8E8",color:"#B0B0B0",fontSize:"13px"}}),sGe=({data:e})=>{const t=Ucr(),{tasks:n}=od(),{tasks:r,onAddTask:a,teammates:i}=e||{},o=n||r||[],l=b.useMemo(()=>{const f={pending:[],in_progress:[],completed:[],failed:[]};return o==null||o.forEach(p=>{f[p.status]&&f[p.status].push(p)}),f},[o]),c=new Set((o==null?void 0:o.map(f=>f.id))||[]),u=f=>{const p=o==null?void 0:o.find(h=>h.id===f);return(p==null?void 0:p.status)==="completed"},d=()=>{a&&a()};return C.jsxs("div",{style:t.container,children:[C.jsxs("div",{style:t.header,children:[C.jsxs("div",{style:t.titleSection,children:[C.jsx("h1",{style:t.pageTitle,children:"Task Board"}),C.jsx("p",{style:t.pageSubtitle,children:"Track team progress and task status"})]}),C.jsx("div",{style:t.actions,children:C.jsxs("button",{style:t.addButton,onClick:d,children:[C.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[C.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),C.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add Task"]})})]}),C.jsx("div",{style:t.boardContainer,children:Fcr.map(f=>{const p=l[f.id]||[];return C.jsxs("div",{style:t.column,children:[C.jsxs("div",{style:t.columnHeader,children:[C.jsxs("div",{style:t.columnTitle,children:[C.jsx("div",{style:{...t.statusDot,background:f.color}}),C.jsx("span",{style:t.columnLabel,children:f.title})]}),C.jsx("span",{style:t.columnCount,children:p.length})]}),p.length>0?p.map(h=>C.jsx($cr,{task:h,allTaskIds:c,getDependencyStatus:u},h.id)):C.jsx("div",{style:t.emptyColumn,children:"No tasks"})]},f.id)})})]})},zcr=()=>({container:{display:"flex",flexDirection:"column",height:"100%",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",background:"#FFFFFF"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",height:"60px",padding:"0 24px",borderBottom:"1px solid #E8E8E8"},titleSection:{display:"flex",flexDirection:"column",gap:"2px"},teamName:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"18px",fontWeight:600,color:"#0D0D0D",margin:0},teamDesc:{fontFamily:"'Inter', sans-serif",fontSize:"12px",color:"#7A7A7A",margin:0},mainContainer:{display:"flex",flex:1,overflow:"hidden"},sidebar:{display:"flex",flexDirection:"column",width:"260px",borderRight:"1px solid #E8E8E8",background:"#FAFAFA",overflow:"auto"},sidebarHeader:{padding:"16px",borderBottom:"1px solid #E8E8E8"},sidebarTitle:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"14px",fontWeight:600,color:"#0D0D0D",margin:0},member:{display:"flex",alignItems:"center",gap:"12px",padding:"8px 16px",cursor:"pointer"},memberHover:{background:"#F0F0F0"},avatar:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",flexShrink:0},avatarText:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"11px",fontWeight:600,color:"#FFFFFF"},memberInfo:{display:"flex",flexDirection:"column",gap:"0px",minWidth:0},memberName:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"13px",fontWeight:500,color:"#0D0D0D",margin:0},memberRole:{fontFamily:"'Inter', sans-serif",fontSize:"11px",color:"#7A7A7A",margin:0},statusDot:{width:"8px",height:"8px",marginLeft:"auto"},chatArea:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden"},messages:{display:"flex",flexDirection:"column",gap:"16px",padding:"24px",flex:1,overflow:"auto"},message:{display:"flex",gap:"12px",alignItems:"flex-start"},messageSelf:{justifyContent:"flex-end"},messageBubble:{maxWidth:"400px",padding:"12px"},messageContent:{display:"flex",flexDirection:"column",gap:"4px",flex:1},messageHeader:{display:"flex",gap:"8px",alignItems:"center"},senderName:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"13px",fontWeight:600,color:"#0D0D0D",margin:0},senderNameSelf:{color:"#FFFFFF"},messageTime:{fontFamily:"'Inter', sans-serif",fontSize:"11px",color:"#7A7A7A",margin:0},messageTimeSelf:{color:"#B0B0B0"},messageText:{fontFamily:"'Inter', sans-serif",fontSize:"13px",color:"#0D0D0D",lineHeight:1.5,margin:0},messageTextSelf:{color:"#FFFFFF"},inputArea:{display:"flex",alignItems:"center",gap:"12px",padding:"12px 24px",borderTop:"1px solid #E8E8E8",background:"#FFFFFF"},input:{display:"flex",alignItems:"center",flex:1,height:"40px",padding:"0 16px",gap:"8px",border:"1px solid #E8E8E8"},inputText:{flex:1,border:"none",outline:"none",fontFamily:"'Inter', sans-serif",fontSize:"13px",background:"transparent"},placeholder:{color:"#B0B0B0",fontFamily:"'Inter', sans-serif",fontSize:"13px"},sendButton:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",width:"80px",height:"40px",background:"#0D0D0D",border:"none",cursor:"pointer"},sendText:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"13px",fontWeight:500,color:"#FFFFFF"},mention:{color:"#E42313",fontWeight:500}}),cGe=["#1890ff","#52c41a","#faad14","#f5222d","#722ed1","#13c2c2","#eb2f96","#fa8c16"],uGe={online:"#22C55E",away:"#faad14",offline:"#7A7A7A"},dGe=e=>{let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return cGe[Math.abs(t)%cGe.length]},fGe=e=>e.split(/[\s_-]/).map(t=>t.charAt(0)).join("").toUpperCase().slice(0,2),Hcr=e=>new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),pGe=(e,t,n)=>{if(t.length===0)return C.jsx("span",{style:n.messageText,children:e});const r=[];let a=0;return t.forEach(i=>{const o=e.indexOf(`@${i}`);o!==-1&&(o>a&&r.push(e.slice(a,o)),r.push(C.jsxs("span",{style:n.mention,children:["@",i]},i)),a=o+i.length+1)}),a<e.length&&r.push(e.slice(a)),C.jsx("span",{style:n.messageText,children:r})},jcr=({data:e})=>{const t=zcr(),{teamName:n,currentUser:r,teammates:a,messages:i,onSendMessage:o}=e||{},[l,s]=b.useState(""),c=b.useRef(null),u=b.useMemo(()=>[...i||[]].sort((g,m)=>new Date(g.timestamp).getTime()-new Date(m.timestamp).getTime()),[i]),d=b.useMemo(()=>(a==null?void 0:a.map(g=>g.name))||[],[a]);b.useEffect(()=>{var g;(g=c.current)==null||g.scrollIntoView({behavior:"smooth"})},[u]);const f=()=>{l.trim()&&o&&(o(l.trim()),s(""))},p=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),f())},h=g=>uGe[g]||uGe.offline;return C.jsxs("div",{style:t.container,children:[C.jsx("div",{style:t.header,children:C.jsxs("div",{style:t.titleSection,children:[C.jsx("h2",{style:t.teamName,children:n||"Team Chat"}),C.jsxs("p",{style:t.teamDesc,children:[(a==null?void 0:a.length)||0," member",(a==null?void 0:a.length)!==1?"s":""]})]})}),C.jsxs("div",{style:t.mainContainer,children:[C.jsxs("div",{style:t.sidebar,children:[C.jsx("div",{style:t.sidebarHeader,children:C.jsx("p",{style:t.sidebarTitle,children:"Team Members"})}),a==null?void 0:a.map(g=>C.jsxs("div",{style:t.member,children:[C.jsx("div",{style:{...t.avatar,background:dGe(g.name)},children:C.jsx("span",{style:t.avatarText,children:fGe(g.name)})}),C.jsxs("div",{style:t.memberInfo,children:[C.jsxs("p",{style:t.memberName,children:[g.name,g.name===r&&" (You)"]}),C.jsx("p",{style:t.memberRole,children:g.role})]}),C.jsx("div",{style:{...t.statusDot,background:h(g.status)}})]},g.name))]}),C.jsxs("div",{style:t.chatArea,children:[C.jsxs("div",{style:t.messages,children:[u.map(g=>{const m=g.from===r;return C.jsxs("div",{style:{...t.message,...m?t.messageSelf:{}},children:[!m&&C.jsx("div",{style:{...t.avatar,background:dGe(g.from)},children:C.jsx("span",{style:t.avatarText,children:fGe(g.from)})}),C.jsxs("div",{style:{...t.messageContent,...m?{alignItems:"flex-end"}:{}},children:[C.jsxs("div",{style:t.messageHeader,children:[C.jsx("span",{style:{...t.senderName,...m?t.senderNameSelf:{}},children:m?"You":g.from}),C.jsx("span",{style:{...t.messageTime,...m?t.messageTimeSelf:{}},children:Hcr(g.timestamp)})]}),m?C.jsx("div",{style:{...t.messageBubble,...t.messageTextSelf,background:"#0D0D0D"},children:pGe(g.content,d,t)}):pGe(g.content,d,t)]})]},g.id)}),C.jsx("div",{ref:c})]}),C.jsxs("div",{style:t.inputArea,children:[C.jsx("div",{style:t.input,children:C.jsx("input",{type:"text",value:l,onChange:g=>s(g.target.value),onKeyPress:p,placeholder:"Type a message... (@mention someone)",style:t.inputText})}),C.jsxs("button",{style:t.sendButton,onClick:f,children:[C.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[C.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),C.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]}),C.jsx("span",{style:t.sendText,children:"Send"})]})]})]})]})]})},Sue={action_show_attachments_uploader:{card_view:()=>null,action:e=>{console.log(e)}},generic_data_table:{card_view:x_,side_app_view:Clr},confirm:{card_view:Elr},clarify:{card_view:wlr},tool_call:{card_view:Rlr},tool_card:{card_view:g3t},todo_list:{card_view:oD},write_todos:{card_view:Olr},internet_search:{card_view:_sr},write_file:{card_view:Ulr},edit_file:{card_view:zlr},file_explorer:{card_view:()=>null,side_app_view:Dlr},attachments:{card_view:bue,side_app_view:Uje},file_content_diff_view:{card_view:Hje,side_app_view:Hje},task:{card_view:jlr,side_app_view:msr},schedule_viewer:{card_view:()=>null,side_app_view:Csr},browser_viewer:{card_view:Tsr,side_app_view:Uje},execute_code:{card_view:Rsr},create_team:{card_view:ksr},team_workspace:{card_view:()=>null,side_app_view:kcr},task_board:{card_view:sGe,side_app_view:sGe},mailbox:{card_view:jcr,side_app_view:T3t}},rF=e=>e&&Sue[e]?Sue[e]:null,Gcr=(e,t)=>(console.log("regsiterElement",e,t),Sue[e]=t,t),Vcr=Ni(({token:e,css:t})=>({container:t`
|
|
5003
|
+
`})),Mcr=(e,t,n)=>e?`${e}____${t}_${n}`:`standalone_${t}_${n}`,Lcr=(e,t)=>`team:${e}:${t}`,kcr=({data:e,context:t})=>{const{styles:n}=Ocr(),{teamId:r,teammates:a,parent_thread_id:i}=e||{},o=(t==null?void 0:t.assistant_id)||"",{team:l,tasks:s,mailbox:c,stats:u,recentTasks:d,recentActivities:f,isLoading:p,refresh:h}=Usr(i||null,o),[g,m]=b.useState("dashboard"),A=b.useMemo(()=>{const _=[{id:"dashboard",type:"dashboard",name:"Dashboard"},{id:"inbox",type:"inbox",name:"Inbox",badge:u.unreadMessages>0?u.unreadMessages:void 0},{id:"issues",type:"issues",name:"Issues",badge:u.pendingTasks>0?u.pendingTasks:void 0}];return a==null||a.forEach((x,S)=>{_.push({id:`teammate-${S}`,type:"teammate",name:x.name,group:"Teammates",data:x})}),_.push({id:"org",type:"org",name:"Org",group:"Team"}),_},[a,u]),v=_=>{m(_.id)},y=()=>{if(p)return C.jsx("div",{className:n.loadingContainer,children:C.jsx(ul,{size:"large"})});const _=A.find(x=>x.id===g);switch(_==null?void 0:_.type){case"dashboard":return C.jsx(qsr,{stats:u,recentTasks:d,recentActivities:f,team:l});case"inbox":return C.jsx(T3t,{data:{teamMailbox:c,team:{teamId:(l==null?void 0:l.teamId)||r||"",teamLeadId:(l==null?void 0:l.teamLeadId)||"team_lead",teammates:a||[]}}});case"issues":return C.jsx(icr,{tasks:s,teamId:r||"",teammates:a||[]});case"teammate":if(_.data&&r){const x=Mcr(i,r,_.data.name),S=Lcr(r,_.data.name);return C.jsx(mcr,{teammate:_.data,threadId:x,assistantId:S})}return null;case"org":return C.jsx(ucr,{team:l,teammates:a||[],tasks:s});default:return null}};return C.jsxs("div",{className:n.container,children:[C.jsx(Fsr,{items:A,activeItem:g,onItemClick:v}),C.jsxs(Ncr,{className:n.content,children:[C.jsx(tn,{className:n.refreshButton,icon:C.jsx(ZGt,{size:16}),onClick:h,loading:p,type:"text",children:"Refresh"}),C.jsx("div",{className:n.contentInner,children:y()})]})]})},Dcr=(e,t)=>({card:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px",background:t?"#FAFAFA":"#FFFFFF",border:"1px solid #E8E8E8",borderRadius:"0px",cursor:"pointer",transition:"border-color 0.2s ease",maxWidth:"100%",overflow:"hidden"},header:{display:"flex",justifyContent:"space-between",alignItems:"center"},taskId:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"12px",fontWeight:500,color:"#7A7A7A"},assignee:{fontFamily:"'Inter', sans-serif",fontSize:"11px",fontWeight:500,color:e==="completed"?"#22C55E":"#E42313"},title:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"14px",fontWeight:500,color:"#0D0D0D",margin:0,lineHeight:1.4},description:{fontFamily:"'Inter', sans-serif",fontSize:"12px",color:"#7A7A7A",margin:0,lineHeight:1.4},depRow:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px",marginTop:"4px"},depLabel:{fontFamily:"'Inter', sans-serif",fontSize:"11px",color:"#B0B0B0"},depBadge:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 6px",fontSize:"10px",borderRadius:"0px"},depBadgeCompleted:{background:"#22C55E",border:"1px solid #22C55E",color:"#FFFFFF"},depBadgePending:{background:"transparent",border:"1px solid #E8E8E8",color:"#7A7A7A"},depBadgeInvalid:{background:"transparent",border:"1px solid #f5222d",color:"#f5222d"},checkIcon:{width:"10px",height:"10px",display:"flex",alignItems:"center",justifyContent:"center"},circleIcon:{width:"8px",height:"8px",borderRadius:"50%",background:"#7A7A7A"}}),Bcr=()=>C.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:C.jsx("polyline",{points:"20 6 9 17 4 12"})}),Pcr=()=>C.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"currentColor",children:C.jsx("circle",{cx:"12",cy:"12",r:"10"})}),$cr=({task:e,allTaskIds:t,getDependencyStatus:n})=>{const r=e.status==="completed",a=Dcr(e.status,r),i=()=>!e.dependencies||e.dependencies.length===0?C.jsx("span",{style:{...a.depLabel,color:"#7A7A7A"},children:"none"}):e.dependencies.map(o=>{const l=t.has(o),s=l?n(o):!1;let c=a.depBadgePending;return l?s&&(c=a.depBadgeCompleted):c=a.depBadgeInvalid,C.jsxs("span",{style:{...a.depBadge,...c,marginRight:"4px"},children:[C.jsx("span",{style:a.checkIcon,children:l&&s?C.jsx(Bcr,{}):l?C.jsx(Pcr,{}):null}),o]},o)});return C.jsxs("div",{style:a.card,children:[C.jsxs("div",{style:a.header,children:[C.jsx("span",{style:a.taskId,children:e.id}),e.assignee&&C.jsxs("span",{style:a.assignee,children:["@",e.assignee]})]}),C.jsx("h3",{style:a.title,children:e.title}),e.description&&C.jsx("p",{style:a.description,children:e.description}),C.jsxs("div",{style:a.depRow,children:[C.jsx("span",{style:a.depLabel,children:"Deps:"}),i()]})]})},Fcr=[{id:"pending",title:"Pending",color:"#7A7A7A"},{id:"in_progress",title:"In Progress",color:"#E42313"},{id:"completed",title:"Completed",color:"#22C55E"},{id:"failed",title:"Failed",color:"#f5222d"}],Ucr=()=>({container:{background:"#FFFFFF",padding:"40px 48px",gap:"32px",display:"flex",flexDirection:"column",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",height:"80px"},titleSection:{display:"flex",flexDirection:"column",gap:"4px"},pageTitle:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"40px",fontWeight:500,color:"#0D0D0D",letterSpacing:"-1px",margin:0},pageSubtitle:{fontFamily:"'Inter', sans-serif",fontSize:"14px",color:"#7A7A7A",margin:0},actions:{display:"flex",gap:"12px"},addButton:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",width:"120px",height:"40px",background:"#0D0D0D",color:"#FFFFFF",border:"none",borderRadius:"0px",fontFamily:"'Space Grotesk', sans-serif",fontSize:"13px",fontWeight:500,cursor:"pointer"},boardContainer:{display:"flex",gap:"24px",overflowX:"auto",paddingBottom:"16px"},column:{display:"flex",flexDirection:"column",gap:"16px",minWidth:"320px",maxWidth:"320px"},columnHeader:{display:"flex",justifyContent:"space-between",alignItems:"center",height:"40px"},columnTitle:{display:"flex",alignItems:"center",gap:"8px"},statusDot:{width:"8px",height:"8px",borderRadius:"0px"},columnLabel:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"14px",fontWeight:600,color:"#0D0D0D",margin:0},columnCount:{fontFamily:"'Inter', sans-serif",fontSize:"12px",color:"#7A7A7A"},emptyColumn:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"120px",border:"1px dashed #E8E8E8",color:"#B0B0B0",fontSize:"13px"}}),sGe=({data:e})=>{const t=Ucr(),{tasks:n}=od(),{tasks:r,onAddTask:a,teammates:i}=e||{},o=n||r||[],l=b.useMemo(()=>{const f={pending:[],in_progress:[],completed:[],failed:[]};return o==null||o.forEach(p=>{f[p.status]&&f[p.status].push(p)}),f},[o]),c=new Set((o==null?void 0:o.map(f=>f.id))||[]),u=f=>{const p=o==null?void 0:o.find(h=>h.id===f);return(p==null?void 0:p.status)==="completed"},d=()=>{a&&a()};return C.jsxs("div",{style:t.container,children:[C.jsxs("div",{style:t.header,children:[C.jsxs("div",{style:t.titleSection,children:[C.jsx("h1",{style:t.pageTitle,children:"Task Board"}),C.jsx("p",{style:t.pageSubtitle,children:"Track team progress and task status"})]}),C.jsx("div",{style:t.actions,children:C.jsxs("button",{style:t.addButton,onClick:d,children:[C.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[C.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),C.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add Task"]})})]}),C.jsx("div",{style:t.boardContainer,children:Fcr.map(f=>{const p=l[f.id]||[];return C.jsxs("div",{style:t.column,children:[C.jsxs("div",{style:t.columnHeader,children:[C.jsxs("div",{style:t.columnTitle,children:[C.jsx("div",{style:{...t.statusDot,background:f.color}}),C.jsx("span",{style:t.columnLabel,children:f.title})]}),C.jsx("span",{style:t.columnCount,children:p.length})]}),p.length>0?p.map(h=>C.jsx($cr,{task:h,allTaskIds:c,getDependencyStatus:u},h.id)):C.jsx("div",{style:t.emptyColumn,children:"No tasks"})]},f.id)})})]})},zcr=()=>({container:{display:"flex",flexDirection:"column",height:"100%",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",background:"#FFFFFF"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",height:"60px",padding:"0 24px",borderBottom:"1px solid #E8E8E8"},titleSection:{display:"flex",flexDirection:"column",gap:"2px"},teamName:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"18px",fontWeight:600,color:"#0D0D0D",margin:0},teamDesc:{fontFamily:"'Inter', sans-serif",fontSize:"12px",color:"#7A7A7A",margin:0},mainContainer:{display:"flex",flex:1,overflow:"hidden"},sidebar:{display:"flex",flexDirection:"column",width:"260px",borderRight:"1px solid #E8E8E8",background:"#FAFAFA",overflow:"auto"},sidebarHeader:{padding:"16px",borderBottom:"1px solid #E8E8E8"},sidebarTitle:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"14px",fontWeight:600,color:"#0D0D0D",margin:0},member:{display:"flex",alignItems:"center",gap:"12px",padding:"8px 16px",cursor:"pointer"},memberHover:{background:"#F0F0F0"},avatar:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",flexShrink:0},avatarText:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"11px",fontWeight:600,color:"#FFFFFF"},memberInfo:{display:"flex",flexDirection:"column",gap:"0px",minWidth:0},memberName:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"13px",fontWeight:500,color:"#0D0D0D",margin:0},memberRole:{fontFamily:"'Inter', sans-serif",fontSize:"11px",color:"#7A7A7A",margin:0},statusDot:{width:"8px",height:"8px",marginLeft:"auto"},chatArea:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden"},messages:{display:"flex",flexDirection:"column",gap:"16px",padding:"24px",flex:1,overflow:"auto"},message:{display:"flex",gap:"12px",alignItems:"flex-start"},messageSelf:{justifyContent:"flex-end"},messageBubble:{maxWidth:"400px",padding:"12px"},messageContent:{display:"flex",flexDirection:"column",gap:"4px",flex:1},messageHeader:{display:"flex",gap:"8px",alignItems:"center"},senderName:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"13px",fontWeight:600,color:"#0D0D0D",margin:0},senderNameSelf:{color:"#FFFFFF"},messageTime:{fontFamily:"'Inter', sans-serif",fontSize:"11px",color:"#7A7A7A",margin:0},messageTimeSelf:{color:"#B0B0B0"},messageText:{fontFamily:"'Inter', sans-serif",fontSize:"13px",color:"#0D0D0D",lineHeight:1.5,margin:0},messageTextSelf:{color:"#FFFFFF"},inputArea:{display:"flex",alignItems:"center",gap:"12px",padding:"12px 24px",borderTop:"1px solid #E8E8E8",background:"#FFFFFF"},input:{display:"flex",alignItems:"center",flex:1,height:"40px",padding:"0 16px",gap:"8px",border:"1px solid #E8E8E8"},inputText:{flex:1,border:"none",outline:"none",fontFamily:"'Inter', sans-serif",fontSize:"13px",background:"transparent"},placeholder:{color:"#B0B0B0",fontFamily:"'Inter', sans-serif",fontSize:"13px"},sendButton:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",width:"80px",height:"40px",background:"#0D0D0D",border:"none",cursor:"pointer"},sendText:{fontFamily:"'Space Grotesk', sans-serif",fontSize:"13px",fontWeight:500,color:"#FFFFFF"},mention:{color:"#E42313",fontWeight:500}}),cGe=["#1890ff","#52c41a","#faad14","#f5222d","#722ed1","#13c2c2","#eb2f96","#fa8c16"],uGe={online:"#22C55E",away:"#faad14",offline:"#7A7A7A"},dGe=e=>{let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return cGe[Math.abs(t)%cGe.length]},fGe=e=>e.split(/[\s_-]/).map(t=>t.charAt(0)).join("").toUpperCase().slice(0,2),Hcr=e=>new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),pGe=(e,t,n)=>{if(t.length===0)return C.jsx("span",{style:n.messageText,children:e});const r=[];let a=0;return t.forEach(i=>{const o=e.indexOf(`@${i}`);o!==-1&&(o>a&&r.push(e.slice(a,o)),r.push(C.jsxs("span",{style:n.mention,children:["@",i]},i)),a=o+i.length+1)}),a<e.length&&r.push(e.slice(a)),C.jsx("span",{style:n.messageText,children:r})},jcr=({data:e})=>{const t=zcr(),{teamName:n,currentUser:r,teammates:a,messages:i,onSendMessage:o}=e||{},[l,s]=b.useState(""),c=b.useRef(null),u=b.useMemo(()=>[...i||[]].sort((g,m)=>new Date(g.timestamp).getTime()-new Date(m.timestamp).getTime()),[i]),d=b.useMemo(()=>(a==null?void 0:a.map(g=>g.name))||[],[a]);b.useEffect(()=>{var g;(g=c.current)==null||g.scrollIntoView({behavior:"smooth"})},[u]);const f=()=>{l.trim()&&o&&(o(l.trim()),s(""))},p=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),f())},h=g=>uGe[g]||uGe.offline;return C.jsxs("div",{style:t.container,children:[C.jsx("div",{style:t.header,children:C.jsxs("div",{style:t.titleSection,children:[C.jsx("h2",{style:t.teamName,children:n||"Team Chat"}),C.jsxs("p",{style:t.teamDesc,children:[(a==null?void 0:a.length)||0," member",(a==null?void 0:a.length)!==1?"s":""]})]})}),C.jsxs("div",{style:t.mainContainer,children:[C.jsxs("div",{style:t.sidebar,children:[C.jsx("div",{style:t.sidebarHeader,children:C.jsx("p",{style:t.sidebarTitle,children:"Team Members"})}),a==null?void 0:a.map(g=>C.jsxs("div",{style:t.member,children:[C.jsx("div",{style:{...t.avatar,background:dGe(g.name)},children:C.jsx("span",{style:t.avatarText,children:fGe(g.name)})}),C.jsxs("div",{style:t.memberInfo,children:[C.jsxs("p",{style:t.memberName,children:[g.name,g.name===r&&" (You)"]}),C.jsx("p",{style:t.memberRole,children:g.role})]}),C.jsx("div",{style:{...t.statusDot,background:h(g.status)}})]},g.name))]}),C.jsxs("div",{style:t.chatArea,children:[C.jsxs("div",{style:t.messages,children:[u.map(g=>{const m=g.from===r;return C.jsxs("div",{style:{...t.message,...m?t.messageSelf:{}},children:[!m&&C.jsx("div",{style:{...t.avatar,background:dGe(g.from)},children:C.jsx("span",{style:t.avatarText,children:fGe(g.from)})}),C.jsxs("div",{style:{...t.messageContent,...m?{alignItems:"flex-end"}:{}},children:[C.jsxs("div",{style:t.messageHeader,children:[C.jsx("span",{style:{...t.senderName,...m?t.senderNameSelf:{}},children:m?"You":g.from}),C.jsx("span",{style:{...t.messageTime,...m?t.messageTimeSelf:{}},children:Hcr(g.timestamp)})]}),m?C.jsx("div",{style:{...t.messageBubble,...t.messageTextSelf,background:"#0D0D0D"},children:pGe(g.content,d,t)}):pGe(g.content,d,t)]})]},g.id)}),C.jsx("div",{ref:c})]}),C.jsxs("div",{style:t.inputArea,children:[C.jsx("div",{style:t.input,children:C.jsx("input",{type:"text",value:l,onChange:g=>s(g.target.value),onKeyPress:p,placeholder:"Type a message... (@mention someone)",style:t.inputText})}),C.jsxs("button",{style:t.sendButton,onClick:f,children:[C.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[C.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),C.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]}),C.jsx("span",{style:t.sendText,children:"Send"})]})]})]})]})]})},Sue={action_show_attachments_uploader:{card_view:()=>null,action:e=>{console.log(e)}},generic_data_table:{card_view:x_,side_app_view:Clr},confirm:{card_view:Elr},clarify:{card_view:wlr},tool_call:{card_view:Rlr},tool_card:{card_view:g3t},todo_list:{card_view:oD},write_todos:{card_view:Olr},internet_search:{card_view:_sr},write_file:{card_view:Ulr},edit_file:{card_view:zlr},file_explorer:{card_view:()=>null,side_app_view:Dlr},attachments:{card_view:bue,side_app_view:Uje},file_content_diff_view:{card_view:Hje,side_app_view:Hje},task:{card_view:jlr,side_app_view:msr},schedule_viewer:{card_view:()=>null,side_app_view:Csr},browser_viewer:{card_view:Tsr,side_app_view:Uje},execute_code:{card_view:Rsr},create_team:{card_view:ksr},team_workspace:{card_view:()=>null,side_app_view:kcr},task_board:{card_view:sGe,side_app_view:sGe},mailbox:{card_view:jcr,side_app_view:T3t}},rF=e=>e&&Sue[e]?Sue[e]:null,Gcr=(e,t)=>(console.log("regsiterElement",e,t),Sue[e]=t,t),Vcr=Ni(({token:e,css:t})=>({container:t`
|
|
5004
5004
|
display: flex;
|
|
5005
5005
|
flex-direction: column;
|
|
5006
5006
|
height: 100%;
|
|
@@ -5158,7 +5158,7 @@ ${i}
|
|
|
5158
5158
|
transform: translateY(0);
|
|
5159
5159
|
}
|
|
5160
5160
|
}
|
|
5161
|
-
`})),Wcr=({component_key:e,data:t})=>t!=null&&t.component?C.jsx(C.Fragment,{children:t.component}):C.jsxs("div",{children:[C.jsx("p",{children:"Component view not found"}),C.jsx("pre",{children:JSON.stringify({component_key:e,data:t},null,2)})]}),hGe=e=>C.jsx(bXe,{style:{fontSize:12,opacity:.6}}),qcr=()=>{const{styles:e}=Vcr(),{sideAppSelectedCard:t,closeSideApp:n}=Dl(),[r,a]=b.useState(JSON.stringify(t)),[i,o]=b.useState(null),[l,s]=b.useState([]),c=(h,g,m,A)=>{const v=[...l,{label:g,children:m,key:h,componentKey:A}];s(v),a(h)},u=h=>{let g=r;const m=l.findIndex(v=>v.key===h),A=l.filter(v=>v.key!==h);if(A.length===0){n();return}g===h&&(m>0?g=l[m-1].key:g=A[0].key),s(A),a(g)},d=h=>{a(h)};b.useEffect(()=>{var m,A;if(!t)return;const h=JSON.stringify(t);if(l.find(v=>v.key===h)){a(h),setTimeout(()=>{const v=document.querySelector(`[data-tab-key="${h}"]`);v==null||v.scrollIntoView({behavior:"smooth",inline:"center"})},100);return}const g=((m=rF(t==null?void 0:t.component_key))==null?void 0:m.side_app_view)||Wcr;c(h,(t==null?void 0:t.message)||((A=t==null?void 0:t.data)==null?void 0:A.message)||"Unnamed",C.jsx(g,{component_key:(t==null?void 0:t.component_key)||"",data:t==null?void 0:t.data}),t==null?void 0:t.component_key)},[t]);const f=l.find(h=>h.key===r),p=l.map(h=>({key:h.key,label:C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"4px 0"},children:[hGe(h.componentKey),C.jsx("span",{style:{flex:1},children:h.label}),C.jsx(Yb,{style:{fontSize:10,opacity:.5},onClick:g=>{g.stopPropagation(),u(h.key)}})]}),onClick:()=>d(h.key)}));return C.jsxs("div",{className:e.container,children:[C.jsxs("div",{className:e.header,children:[C.jsx("div",{className:e.tabsStrip,children:l.map(h=>C.jsx(Or,{title:h.label,placement:"bottom",children:C.jsxs("div",{"data-tab-key":h.key,className:`${e.tab} ${h.key===r?"active":""}`,onClick:()=>d(h.key),onMouseEnter:()=>o(h.key),onMouseLeave:()=>o(null),children:[hGe(h.componentKey),C.jsx("span",{className:e.tabLabel,children:h.label}),C.jsx("span",{className:`${e.closeIndicator} ${i===h.key||h.key===r?"always-visible":""}`,onClick:g=>{g.stopPropagation(),u(h.key)},children:C.jsx(Yb,{style:{fontSize:10}})})]})},h.key))}),C.jsxs("div",{className:e.actions,children:[l.length>0&&C.jsx("div",{className:e.tabCounter,children:l.length}),l.length>1&&C.jsx(T8,{menu:{items:p},placement:"bottomRight",trigger:["click"],children:C.jsx("button",{className:e.actionBtn,title:"All tabs",children:C.jsx(vfe,{})})}),C.jsx(Or,{title:"Close",children:C.jsx("button",{className:e.actionBtn,onClick:n,children:C.jsx(Yb,{})})})]})]}),C.jsx("div",{className:e.content,children:f?C.jsx("div",{className:e.contentWrapper,children:f.children},f.key):C.jsxs("div",{className:e.emptyState,children:[C.jsx(bXe,{className:"icon"}),C.jsx("span",{children:"Select an app to start"})]})})]})},Qcr=e=>{const{assistant_id:t,thread_id:n="",menu:r,header:a,...i}=e;return C.jsx(Uve,{assistantId:t,threadId:n,options:{streaming:!0,enableReturnStateWhenStreamCompleted:!0,enableResumeStream:!0},children:C.jsx(Xor,{children:C.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%"},children:[a,C.jsx(Zor,{menu:r,left:n?C.jsx(jve,{...i}):C.jsx("div",{children:"Please create a conversation first"}),right:C.jsx(qcr,{})})]})})})},{Text:Lo,Title:Ycr}=Ar,{TextArea:Kcr}=Zn,{useToken:I3t}=Zl,Xcr=()=>{var x;const{config:e}=Zo();I3t();const{get:t,post:n,del:r}=kl(),[a,i]=b.useState([]),[o,l]=b.useState(!1),[s,c]=b.useState(null),[u,d]=b.useState(!1),[f,p]=b.useState(null),h=((x=e.headers)==null?void 0:x["x-tenant-id"])||"default";b.useEffect(()=>{g()},[h]);const g=async()=>{l(!0);try{const S=await t("/api/metrics-configs");S.success?i(S.data.records):(hn.error(S.message||"Failed to load metrics configurations"),i([]))}catch(S){console.error("Failed to load metrics configs:",S),hn.error("Failed to load metrics configurations"),i([])}finally{l(!1)}},m=async S=>{var E,w;c(S.id);try{const I=await n(`/api/metrics-configs/${S.key}/test`,{});I.success&&((E=I.data)!=null&&E.connected)?hn.success(`Successfully connected to ${S.config.serverUrl} (${I.data.latency}ms)`):I.success&&((w=I.data)!=null&&w.error)?hn.error(`Connection failed: ${I.data.error}`):hn.error(I.message||"Failed to test connection")}catch(I){console.error("Test connection error:",I),hn.error("Failed to test connection")}finally{c(null)}},A=S=>{p(S),d(!0)},v=async S=>{if(!(S!=null&&S.id)){hn.error("Cannot delete: configuration id is missing");return}try{const E=await r(`/api/metrics-configs/${S.id}`);E.success?(i(w=>w.filter(I=>I.id!==S.id)),hn.success("Configuration deleted")):hn.error(E.message||"Failed to delete configuration")}catch(E){console.error("Failed to delete config:",E),hn.error("Failed to delete configuration")}},y=()=>{p(null),d(!0)},_=S=>{switch(S){case"prometheus":return"📊";case"grafana":return"📈";case"custom":return"🔧";case"semantic":return"🧠";default:return"📊"}};return C.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},children:[C.jsx("div",{style:{padding:16},children:C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[C.jsx(Ycr,{level:5,style:{margin:0},children:"Metrics Server Connections"}),C.jsx(tn,{type:"primary",icon:C.jsx(q2,{size:16}),onClick:y,children:"Add Connection"})]})}),C.jsx("div",{style:{flex:1,overflowY:"auto",padding:16},children:a.length===0?C.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"48px 16px"},children:[C.jsx(iB,{size:48,style:{marginBottom:16,opacity:.5}}),C.jsx(Lo,{strong:!0,style:{fontSize:15},children:"No metrics configurations"}),C.jsx(Lo,{type:"secondary",style:{marginTop:8},children:'Click "Add Connection" to create one'})]}):C.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:a.map(S=>C.jsxs(Ti,{size:"small",children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:10},children:[C.jsxs(Lo,{strong:!0,style:{fontSize:15,display:"flex",alignItems:"center",gap:8},children:[_(S.config.type),S.name||S.key]}),C.jsx(Yr,{color:"blue",children:S.config.type})]}),C.jsxs(Lo,{type:"secondary",style:{fontSize:12,marginBottom:10,fontFamily:"monospace",display:"block"},children:["Key: ",S.key||"undefined"," | ID: ",S.id]}),S.description&&C.jsx(Lo,{style:{fontSize:13,marginBottom:12,lineHeight:1.5,display:"block"},children:S.description}),C.jsxs("div",{style:{marginBottom:12},children:[C.jsx(Lo,{code:!0,style:{fontSize:12},children:S.config.serverUrl||"http://localhost:9090"}),S.config.timeout&&C.jsxs(Yr,{style:{fontSize:11,marginLeft:8},children:["Timeout: ",S.config.timeout,"ms"]})]}),C.jsxs("div",{style:{display:"flex",gap:8,paddingTop:12},children:[C.jsx(tn,{icon:s===S.id?C.jsx(ug,{size:14,className:"spin"}):C.jsx(Efe,{size:14}),onClick:E=>{E.stopPropagation(),m(S)},disabled:s===S.id||s!==null&&s!==S.id,loading:s===S.id,children:s===S.id?"Testing...":"Test"}),C.jsx(tn,{icon:C.jsx(Sfe,{size:14}),onClick:E=>{E.stopPropagation(),A(S)},children:"Edit"}),C.jsx(fw,{title:"Delete Metrics Configuration",description:`Are you sure you want to delete "${S.name||S.key}"?`,onConfirm:E=>{E==null||E.stopPropagation(),v(S)},onCancel:E=>{E==null||E.stopPropagation()},okText:"Delete",okType:"danger",cancelText:"Cancel",children:C.jsx(tn,{danger:!0,icon:C.jsx(sB,{size:14}),onClick:E=>E.stopPropagation(),children:"Delete"})})]})]},S.id))})}),u&&C.jsx(Zcr,{open:u,config:f,onCancel:()=>{d(!1),p(null)},onSave:S=>{g(),p(null),d(!1)}})]})},Zcr=({open:e,config:t,onCancel:n,onSave:r})=>{var P,U;const{config:a}=Zo();I3t();const{get:i,post:o,put:l}=kl();(P=a.headers)!=null&&P["x-tenant-id"];const[s,c]=b.useState(0),[u,d]=b.useState(!1),[f,p]=b.useState(!1),[h,g]=b.useState([]),[m,A]=b.useState(null),[v,y]=b.useState([]),[_,x]=b.useState(!1),[S,E]=b.useState({key:(t==null?void 0:t.key)||"",name:(t==null?void 0:t.name)||"",description:(t==null?void 0:t.description)||"",type:(t==null?void 0:t.config.type)||"semantic",serverUrl:(t==null?void 0:t.config.serverUrl)||"",apiKey:(t==null?void 0:t.config.apiKey)||"",username:(t==null?void 0:t.config.username)||"",password:(t==null?void 0:t.config.password)||"",timeout:(t==null?void 0:t.config.timeout)||3e4,selectedDataSources:((U=t==null?void 0:t.config)==null?void 0:U.selectedDataSources)||[]}),w=[{title:"Basic Info",icon:C.jsx(xfe,{size:16})},{title:"Select Data Sources",icon:C.jsx(j0,{size:16})}],I=()=>{var j;c(0),g([]),y([]),A(null),E({key:(t==null?void 0:t.key)||"",name:(t==null?void 0:t.name)||"",description:(t==null?void 0:t.description)||"",type:(t==null?void 0:t.config.type)||"semantic",serverUrl:(t==null?void 0:t.config.serverUrl)||"",apiKey:(t==null?void 0:t.config.apiKey)||"",username:(t==null?void 0:t.config.username)||"",password:(t==null?void 0:t.config.password)||"",timeout:(t==null?void 0:t.config.timeout)||3e4,selectedDataSources:((j=t==null?void 0:t.config)==null?void 0:j.selectedDataSources)||[]})};b.useEffect(()=>{e&&I()},[e,t]),b.useEffect(()=>{s===1&&h.length===0&&!f&&N()},[s]);const N=async()=>{var j;if(!S.serverUrl){hn.error("Please enter the server URL");return}p(!0);try{const G=await o("/api/metrics-configs/test-datasources",{serverUrl:S.serverUrl,apiKey:S.apiKey||void 0,username:S.username||void 0,password:S.password||void 0});if(G.success&&((j=G.data)!=null&&j.datasources)){if(g(G.data.datasources),G.data.datasources.length>0){const F=String(G.data.datasources[0].id);A(F),R(F)}}else hn.error(G.message||"Failed to fetch data sources")}catch(G){console.error("Failed to fetch datasources:",G),hn.error("Failed to fetch data sources")}finally{p(!1)}},R=async j=>{var G,F,H,q;if(!v.some(V=>String(V.datasourceId)===j)){x(!0);try{if(t){const V=await i(`/api/metrics-configs/${S.key}/datasources/${j}/meta`);V.success&&((F=(G=V.data)==null?void 0:G.index)!=null&&F.metrics)&&y(Y=>[...Y,{datasourceId:j,metrics:V.data.index.metrics}])}else{const V=await o(`/api/metrics-configs/test-datasources/${encodeURIComponent(j)}/meta`,{serverUrl:S.serverUrl,apiKey:S.apiKey,username:S.username,password:S.password});V.success&&((q=(H=V.data)==null?void 0:H.index)!=null&&q.metrics)&&y(Y=>[...Y,{datasourceId:j,metrics:V.data.index.metrics}])}}catch(V){console.error(`Failed to fetch metrics for datasource ${j}:`,V)}finally{x(!1)}}},L=async()=>{d(!0);try{const j={id:t==null?void 0:t.id,key:S.key,name:S.name,description:S.description,selectedDataSources:S.selectedDataSources,config:{type:S.type,serverUrl:S.serverUrl,apiKey:S.apiKey||void 0,username:S.username||void 0,password:S.password||void 0,timeout:S.timeout}};let G;t?G=await l(`/api/metrics-configs/${t.key}`,j):G=await o("/api/metrics-configs",j),G.success?(r(G.data),hn.success(t?"Configuration updated":"Configuration created")):hn.error(G.message||"Failed to save configuration")}catch(j){console.error("Failed to save config:",j),hn.error("Failed to save configuration")}finally{d(!1)}},O=j=>{const G=String(j);E(F=>F.selectedDataSources.includes(G)?{...F,selectedDataSources:F.selectedDataSources.filter(q=>q!==G)}:{...F,selectedDataSources:[...F.selectedDataSources,G]})},M=()=>{switch(s){case 0:return S.key&&S.name&&S.serverUrl;case 1:return!0;default:return!0}},B=()=>{switch(s){case 0:return C.jsxs(tr,{direction:"vertical",style:{width:"100%"},size:"large",children:[C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"Connection Key"}),C.jsx(Zn,{value:S.key,onChange:j=>E({...S,key:j.target.value}),placeholder:"e.g., semantic-demo",style:{width:"100%",marginTop:8},disabled:!!t})]}),C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"Name"}),C.jsx(Zn,{value:S.name,onChange:j=>E({...S,name:j.target.value}),placeholder:"e.g., Demo Semantic Server",style:{width:"100%",marginTop:8}})]}),C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"Description"}),C.jsx(Kcr,{value:S.description,onChange:j=>E({...S,description:j.target.value}),placeholder:"Optional description",rows:2,style:{width:"100%",marginTop:8}})]}),C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"Server Type"}),C.jsx(Vh,{value:S.type,onChange:j=>E({...S,type:j}),options:[{value:"semantic",label:"Semantic"}],style:{width:"100%",marginTop:8}})]}),C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"Server URL"}),C.jsx(Zn,{value:S.serverUrl,onChange:j=>E({...S,serverUrl:j.target.value}),placeholder:"e.g., https://api.example.com/metrics/api/v1/",style:{width:"100%",marginTop:8}})]}),C.jsx(Ti,{title:"Authentication",extra:C.jsx(Yr,{color:"success",children:"Optional"}),style:{marginTop:16},children:C.jsxs(tr,{direction:"vertical",style:{width:"100%"},size:"middle",children:[C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"API Key"}),C.jsx(Zn.Password,{value:S.apiKey,onChange:j=>E({...S,apiKey:j.target.value}),placeholder:"Optional API key for authentication",style:{width:"100%",marginTop:8}})]}),C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"Username"}),C.jsx(Zn,{value:S.username,onChange:j=>E({...S,username:j.target.value}),placeholder:"Optional username for basic auth",style:{width:"100%",marginTop:8}})]}),C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"Password"}),C.jsx(Zn.Password,{value:S.password,onChange:j=>E({...S,password:j.target.value}),placeholder:"Optional password for basic auth",style:{width:"100%",marginTop:8}})]})]})})]});case 1:return f?C.jsxs("div",{style:{textAlign:"center",padding:"60px 0"},children:[C.jsx(ul,{size:"large"}),C.jsx("div",{style:{marginTop:16},children:C.jsx(Lo,{children:"Fetching data sources..."})})]}):C.jsxs("div",{style:{display:"flex",gap:24,height:"550px"},children:[C.jsxs("div",{style:{width:"300px",minWidth:"280px",paddingRight:16,flexShrink:0},children:[C.jsxs("div",{style:{marginBottom:12},children:[C.jsx(Lo,{strong:!0,children:"Data Sources"}),C.jsx("div",{style:{marginTop:4},children:C.jsxs(Lo,{type:"secondary",style:{fontSize:12},children:["Selected: ",S.selectedDataSources.length]})})]}),C.jsx("div",{style:{overflowY:"auto",maxHeight:"420px"},children:h.map(j=>{const G=S.selectedDataSources.includes(String(j.id));return String(j.id),C.jsx(Ti,{size:"small",onClick:()=>{const F=String(j.id);A(F),R(F)},style:{marginBottom:8,cursor:"pointer"},bodyStyle:{padding:12},children:C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[C.jsx(Rc,{checked:G,onClick:F=>{F.stopPropagation(),O(j.id)}}),C.jsxs("div",{style:{flex:1,minWidth:0},children:[C.jsx(Lo,{strong:!0,style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:j.name}),j.schemaName&&C.jsx(Lo,{type:"secondary",style:{fontSize:11,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:j.schemaName})]}),j.connected&&C.jsx(Yr,{color:"success",style:{fontSize:10},children:"Connected"})]})},j.id)})})]}),C.jsx("div",{style:{flex:1,paddingLeft:16,overflow:"hidden"},children:m?(()=>{const j=v.find(F=>String(F.datasourceId)===m),G=h.find(F=>String(F.id)===m);return C.jsxs("div",{children:[C.jsxs("div",{style:{marginBottom:16,paddingBottom:12},children:[C.jsx(Lo,{strong:!0,style:{fontSize:16},children:G==null?void 0:G.name}),C.jsx("div",{style:{marginTop:4},children:C.jsxs(Lo,{type:"secondary",style:{fontSize:12},children:[(j==null?void 0:j.metrics.length)||0," metrics available"]})})]}),_&&!j?C.jsxs("div",{style:{textAlign:"center",padding:40},children:[C.jsx(ul,{}),C.jsx("div",{style:{marginTop:8},children:C.jsx(Lo,{children:"Loading metrics..."})})]}):j?C.jsx("div",{style:{overflowY:"auto",maxHeight:"400px"},children:j.metrics.map(F=>C.jsxs(Ti,{size:"small",style:{marginBottom:8},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[C.jsx(Lo,{strong:!0,children:F.displayName||F.metricName}),F.domain&&C.jsx(Yr,{children:F.domain})]}),F.shortDesc&&C.jsx(Lo,{type:"secondary",style:{fontSize:12,marginTop:4,display:"block"},children:F.shortDesc})]},F.metricName))}):C.jsx("div",{style:{textAlign:"center",padding:40},children:C.jsx(Lo,{type:"secondary",children:"Failed to load metrics"})})]})})():C.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:C.jsxs("div",{style:{textAlign:"center"},children:[C.jsx(j0,{size:48,style:{opacity:.3,marginBottom:16}}),C.jsx(Lo,{type:"secondary",children:"Click a data source on the left to view its metrics"})]})})})]});default:return null}},D=()=>{s===1?L():c(j=>j+1)},$=()=>{c(j=>j-1)};return C.jsx(ji,{title:t?"Edit Metrics Configuration":"Add Metrics Configuration",open:e,onCancel:n,width:900,style:{top:50},footer:null,children:C.jsxs("div",{children:[C.jsx(Yde,{current:s,items:w,style:{marginBottom:24}}),C.jsx("div",{style:{padding:"24px 0",minHeight:300},children:B()}),C.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12,paddingTop:16,marginTop:24},children:[C.jsx(tn,{onClick:n,children:"Cancel"}),s>0&&C.jsx(tn,{icon:C.jsx(bfe,{size:16}),onClick:$,children:"Previous"}),C.jsx(tn,{type:"primary",onClick:D,disabled:!M()||u||f||_,icon:s===1?u?C.jsx(ug,{size:16,className:"spin"}):C.jsx(oB,{size:16}):C.jsx(O4,{size:16}),children:s===1?u?"Saving...":t?"Save Changes":"Create":"Next"})]})]})})},{Text:I2}=Ar,Jcr=e=>{const t=["#1890ff","#52c41a","#faad14","#f5222d","#722ed1","#13c2c2","#eb2f96","#fa8c16"];let n=0;for(let r=0;r<e.length;r++)n=e.charCodeAt(r)+((n<<5)-n);return t[Math.abs(n)%t.length]},eur=({data:e,selected:t})=>{var g;const{token:n}=Zl.useToken();if(!e)return null;const{assistant:r,onConfigure:a,onChat:i}=e;if(!r)return null;const o=Jcr(r.id),l=((g=r.name)==null?void 0:g.split(" ").map(m=>m.charAt(0)).join("").toUpperCase().slice(0,2))||"A",{modelKey:s,tools:c,agentType:u,prompt:d,subAgents:f}=b.useMemo(()=>{if(!r.graphDefinition)return{modelKey:void 0,tools:[],agentType:void 0,prompt:void 0,subAgents:[]};try{const m=typeof r.graphDefinition=="string"?JSON.parse(r.graphDefinition):r.graphDefinition;return{modelKey:m.modelKey||m.model,tools:m.tools||[],agentType:m.type,prompt:m.prompt,subAgents:m.subAgents||[]}}catch{return{modelKey:void 0,tools:[],agentType:void 0,prompt:void 0,subAgents:[]}}},[r.graphDefinition]),p=m=>m?{react:"Executor",deep_agent:"Orchestrator",plan_execute:"PLAN EXECUTE",sequential:"SEQUENTIAL"}[m]||m.toUpperCase():"",h=C.jsxs("div",{style:{maxWidth:400,maxHeight:"60vh",overflowY:"auto"},children:[C.jsx("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:12},children:C.jsxs("div",{style:{flex:1},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(I2,{strong:!0,style:{fontSize:16,fontWeight:600,color:n.colorText},children:r.name}),u&&C.jsx(Yr,{color:"purple",style:{margin:0,fontSize:10,padding:"2px 8px",fontWeight:600},children:p(u)})]}),C.jsx("div",{style:{display:"flex",alignItems:"center",gap:6},children:C.jsx(I2,{style:{fontSize:11,color:n.colorTextTertiary,fontFamily:"monospace"},children:`>_ ${r.id}`})})]})}),r.description&&C.jsx("div",{style:{marginBottom:12},children:C.jsxs(I2,{style:{fontSize:12,color:n.colorText,lineHeight:1.6,fontStyle:"italic"},children:['"',r.description,'"']})}),s&&C.jsxs("div",{style:{marginBottom:12},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(bie,{style:{fontSize:14,color:n.colorTextSecondary}}),C.jsx(I2,{style:{fontSize:12,color:n.colorTextSecondary,fontWeight:500},children:"Model Engine"})]}),C.jsx(Yr,{color:"blue",style:{fontSize:11,padding:"4px 12px"},children:s})]}),d&&C.jsxs("div",{style:{marginBottom:12},children:[C.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8,justifyContent:"space-between"},children:C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[C.jsx(ff,{style:{fontSize:14,color:n.colorTextSecondary}}),C.jsx(I2,{style:{fontSize:12,color:n.colorTextSecondary,fontWeight:600,letterSpacing:.5},children:"SYSTEM PROMPT"})]})}),C.jsx("div",{style:{padding:12,background:n.colorFillTertiary,border:`1px solid ${n.colorBorderSecondary}`,borderRadius:4,maxHeight:150,overflowY:"auto"},children:C.jsx(I2,{style:{fontSize:11,color:n.colorText,lineHeight:1.6,whiteSpace:"pre-wrap"},children:d.length>300?d.slice(0,300)+"...":d})})]}),c&&c.length>0&&C.jsxs("div",{style:{marginBottom:12},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(gw,{style:{fontSize:14,color:n.colorTextSecondary}}),C.jsxs(I2,{style:{fontSize:12,color:n.colorTextSecondary,fontWeight:500},children:["Available Tools (",c.length,")"]})]}),C.jsxs(tr,{size:[8,8],wrap:!0,children:[c.slice(0,5).map((m,A)=>C.jsx(Yr,{color:"blue",style:{fontSize:11,padding:"4px 12px"},children:m.replace(/_/g," ")},A)),c.length>5&&C.jsxs(Yr,{style:{fontSize:11,padding:"4px 12px",backgroundColor:n.colorFillTertiary,color:n.colorTextSecondary},children:["+",c.length-5," more"]})]})]}),f&&f.length>0&&C.jsxs("div",{style:{marginBottom:8},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(Ure,{style:{fontSize:14,color:n.colorTextSecondary}}),C.jsxs(I2,{style:{fontSize:12,color:n.colorTextSecondary,fontWeight:500},children:["Sub-Agent Architecture (",f.length,")"]})]}),C.jsxs(tr,{size:[8,8],wrap:!0,children:[f.slice(0,3).map((m,A)=>C.jsx(Yr,{style:{fontSize:11,padding:"4px 12px",backgroundColor:n.colorFillTertiary,color:n.colorText,border:`1px solid ${n.colorBorderSecondary}`},children:`> ${m}`},A)),f.length>3&&C.jsxs(Yr,{style:{fontSize:11,padding:"4px 12px",backgroundColor:n.colorFillTertiary,color:n.colorTextSecondary},children:["+",f.length-3," more"]})]})]})]});return C.jsxs("div",{style:{padding:4},children:[C.jsx(P3,{type:"target",position:Br.Top}),C.jsxs("div",{style:{width:260,minHeight:180,background:n.colorBgContainer,borderRadius:8,boxShadow:"0 1px 4px rgba(0, 0, 0, 0.08)",overflow:"hidden",transition:"all 0.2s ease",position:"relative",border:t?`2px solid ${n.colorPrimary}`:`1px solid ${n.colorBorder}`,display:"flex",flexDirection:"column"},onMouseEnter:m=>{m.currentTarget.style.transform="translateY(-2px)",m.currentTarget.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.12)"},onMouseLeave:m=>{m.currentTarget.style.transform="translateY(0)",m.currentTarget.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.08)"},children:[C.jsxs("div",{style:{padding:12,display:"flex",flexDirection:"column",gap:10,flex:1},children:[C.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[C.jsx(Or,{title:h,placement:"rightTop",mouseEnterDelay:.5,overlayStyle:{maxWidth:"none"},color:n.colorBgContainer,children:C.jsxs("div",{style:{position:"relative",flexShrink:0,cursor:"pointer"},children:[C.jsx(z3,{size:44,icon:C.jsx(aB,{}),style:{backgroundColor:o,color:"#fff",fontSize:16,fontWeight:600},children:l}),C.jsx("div",{style:{position:"absolute",bottom:0,right:0,width:10,height:10,borderRadius:"50%",background:"#52c41a",border:`2px solid ${n.colorBgContainer}`}})]})}),C.jsxs("div",{style:{flex:1,minWidth:0,paddingRight:32},children:[C.jsx(I2,{strong:!0,style:{fontSize:14,fontWeight:600,display:"block",marginBottom:3,color:n.colorText,lineHeight:1.3},ellipsis:{tooltip:r.name},children:r.name}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[C.jsx(eHt,{style:{fontSize:9,color:n.colorTextTertiary}}),C.jsx(I2,{style:{fontSize:9,color:n.colorTextTertiary},ellipsis:{tooltip:r.id},children:r.id})]})]})]}),r.description&&C.jsx("div",{style:{padding:8,background:n.colorFillTertiary,border:`1px solid ${n.colorBorderSecondary}`,borderRadius:4,borderLeft:`2px solid ${o}`},children:C.jsx(Or,{title:r.description.length>150?r.description:void 0,placement:"top",children:C.jsxs("div",{style:{fontSize:10,color:n.colorText,lineHeight:1.5,fontStyle:"italic",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",cursor:r.description.length>150?"help":"default"},children:['"',r.description,'"']})})}),C.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,padding:"4px 0",marginTop:"auto",alignItems:"center",justifyContent:"space-between"},children:[C.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[u&&C.jsx(Yr,{style:{margin:0,fontSize:7,padding:"2px 6px",borderRadius:6,backgroundColor:n.colorPrimaryBg,color:n.colorPrimary,border:`1px solid ${n.colorPrimaryBorder}`,fontWeight:500,lineHeight:"14px"},children:p(u)}),c&&c.length>0&&C.jsxs(Yr,{style:{margin:0,fontSize:7,padding:"2px 6px",borderRadius:6,backgroundColor:n.colorSuccessBg,color:n.colorSuccess,border:`1px solid ${n.colorSuccessBorder}`,fontWeight:500,lineHeight:"14px"},children:[c.length," Tools"]}),s&&C.jsx(Yr,{style:{margin:0,fontSize:7,padding:"2px 6px",borderRadius:6,backgroundColor:n.colorWarningBg,color:n.colorWarning,border:`1px solid ${n.colorWarningBorder}`,fontWeight:500,lineHeight:"14px"},title:s,children:s.length>12?`${s.slice(0,12)}...`:s})]}),i&&C.jsxs("div",{onMouseDown:m=>{m.stopPropagation()},onClick:m=>{m.stopPropagation(),i(r)},style:{display:"flex",alignItems:"center",gap:2,padding:"2px 6px",borderRadius:4,backgroundColor:n.colorPrimary,color:"#fff",cursor:"pointer",fontSize:10,fontWeight:500,transition:"all 0.2s ease"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=n.colorPrimaryHover},onMouseLeave:m=>{m.currentTarget.style.backgroundColor=n.colorPrimary},children:[C.jsx(RHt,{style:{fontSize:10}}),C.jsx("span",{children:"Chat"})]})]})]}),C.jsx(P3,{type:"source",position:Br.Bottom})]})]})},tur=eur,{TextArea:nur}=Zn,{Text:Do,Title:Qdr}=Ar,Qte=({title:e,icon:t,badge:n,children:r,defaultExpanded:a=!0})=>{const{token:i}=Zl.useToken(),[o,l]=b.useState(a);return C.jsxs(Ti,{size:"small",style:{marginBottom:16,border:`1px solid ${i.colorBorderSecondary}`,backgroundColor:`${i.colorBgContainer}d0`,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},bodyStyle:{padding:0},children:[C.jsxs("div",{onClick:()=>l(!o),style:{padding:"10px 14px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:o?`1px solid ${i.colorBorderSecondary}`:"none",backgroundColor:`${i.colorFillQuaternary}d0`},children:[C.jsxs(tr,{size:"small",children:[t,C.jsx(Do,{strong:!0,style:{fontSize:14},children:e}),n!==void 0&&n>0&&C.jsx(nw,{count:n,style:{backgroundColor:i.colorPrimary}})]}),C.jsx("div",{style:{transform:o?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:C.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{color:i.colorTextSecondary},children:C.jsx("path",{d:"M6 8L1 3h10L6 8z",fill:"currentColor"})})})]}),o&&C.jsx("div",{style:{padding:16},children:r})]})},rur=(e,t,n,r,a)=>{var o;const i=C.jsxs("span",{children:[t.title||e,t.description&&C.jsxs(C.Fragment,{children:[" ",C.jsx(Or,{title:t.description,children:C.jsx(YHt,{style:{color:a.colorTextSecondary,cursor:"pointer"}})})]})]});if(t.widget==="segmented"||t.enum&&!t.widget){const l=((o=t.enum)==null?void 0:o.map(s=>({value:s,label:{global:"Global",agent:"Per Agent",thread:"Per Thread"}[s]||s})))||[];return C.jsx(ra.Item,{label:i,style:{marginBottom:0},children:C.jsx(Ax,{size:"small",value:n,onChange:r,options:l,block:!0})},e)}return t.widget==="switch"?C.jsx(ra.Item,{label:i,style:{marginBottom:8},children:C.jsx(pw,{checked:n,onChange:r})},e):t.widget==="numberInput"||t.type==="number"||t.type==="integer"?C.jsx(ra.Item,{label:i,style:{marginBottom:8},children:C.jsx(Zn,{size:"small",type:"number",value:n,onChange:l=>r(parseFloat(l.target.value)||t.default),min:t.minimum,max:t.maximum,style:{width:"100%"}})},e):t.widget==="textarea"?C.jsx(ra.Item,{label:i,style:{marginBottom:8},children:C.jsx(Zn.TextArea,{size:"small",value:n,onChange:l=>r(l.target.value),placeholder:t.default,autoSize:{minRows:2,maxRows:4}})},e):t.widget==="skillSelect"?C.jsx(iur,{propertyKey:e,label:i,value:n,onChange:r,token:a}):t.widget==="databaseSelect"?C.jsx(our,{propertyKey:e,label:i,value:n,onChange:r,token:a}):t.widget==="metricsSelect"?C.jsx(lur,{propertyKey:e,label:i,value:n,onChange:r,token:a}):C.jsx(ra.Item,{label:i,style:{marginBottom:8},children:C.jsx(Zn,{size:"small",value:n,onChange:l=>r(l.target.value),placeholder:t.default})},e)},aur=(e,t)=>t==null?void 0:t.find(n=>n.type===e),iur=({propertyKey:e,label:t,value:n,onChange:r,token:a})=>{const[i,o]=b.useState([]),[l,s]=b.useState(!1),{get:c}=kl(),u=b.useRef(!1);b.useEffect(()=>{if(u.current)return;u.current=!0,(async()=>{s(!0);try{const h=await c("/api/skills");h.success&&h.data&&Array.isArray(h.data.records)&&o(h.data.records)}catch(h){console.error("Failed to fetch skills:",h)}finally{s(!1)}})()},[c]);const d=Array.isArray(n)?n:[],f=p=>C.jsx(Ha.Item,{style:{padding:"8px 0",cursor:"pointer",borderRadius:a.borderRadius,backgroundColor:d.includes(p.id)?a.colorSuccessBg:"transparent",border:`1px solid ${d.includes(p.id)?a.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.2s ease",paddingLeft:8,paddingRight:8},onClick:()=>{const h=d.includes(p.id)?d.filter(g=>g!==p.id):[...d,p.id];r(h)},children:C.jsx(Ha.Item.Meta,{avatar:C.jsx(Rc,{checked:d.includes(p.id),onChange:()=>{const h=d.includes(p.id)?d.filter(g=>g!==p.id):[...d,p.id];r(h)},onClick:h=>h.stopPropagation()}),title:C.jsx(Do,{strong:d.includes(p.id),children:p.name}),description:C.jsx(Do,{type:"secondary",style:{fontSize:12},children:p.description})})},p.id);return C.jsx("div",{children:C.jsxs(ra.Item,{label:t,style:{marginBottom:8},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[C.jsxs(Do,{type:"secondary",style:{fontSize:12},children:[d.length," of ",i.length," selected"]}),C.jsx(tn,{type:"link",size:"small",onClick:()=>r(d.length===i.length?[]:i.map(p=>p.id)),children:d.length===i.length?"Deselect All":"Select All"})]}),l?C.jsx("div",{style:{textAlign:"center",padding:20},children:C.jsx(ul,{size:"small"})}):i.length===0?C.jsx(ai,{description:"No skills available",image:ai.PRESENTED_IMAGE_SIMPLE}):C.jsx(Ha,{dataSource:i,renderItem:f,style:{maxHeight:"40vh",overflowY:"auto"},split:!1})]},e)})},our=({propertyKey:e,label:t,value:n,onChange:r,token:a})=>{const[i,o]=b.useState([]),[l,s]=b.useState(!1),{get:c}=kl(),u=b.useRef(!1);b.useEffect(()=>{if(u.current)return;u.current=!0,(async()=>{s(!0);try{const h=await c("/api/database-configs");h.success&&h.data&&Array.isArray(h.data.records)&&o(h.data.records)}catch(h){console.error("Failed to fetch database configs:",h)}finally{s(!1)}})()},[c]);const d=Array.isArray(n)?n:[],f=p=>{const h=p.name||p.key,g=d.includes(p.key);return C.jsx(Ha.Item,{style:{padding:"8px 0",cursor:"pointer",borderRadius:a.borderRadius,backgroundColor:g?a.colorSuccessBg:"transparent",border:`1px solid ${g?a.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.2s ease",paddingLeft:8,paddingRight:8},onClick:()=>{const m=g?d.filter(A=>A!==p.key):[...d,p.key];r(m)},children:C.jsx(Ha.Item.Meta,{avatar:C.jsx(Rc,{checked:g,onChange:()=>{const m=g?d.filter(A=>A!==p.key):[...d,p.key];r(m)},onClick:m=>m.stopPropagation()}),title:C.jsx(Do,{strong:g,children:h}),description:p.description&&C.jsx(Do,{type:"secondary",style:{fontSize:12},children:p.description})})},p.key)};return C.jsx("div",{children:C.jsxs(ra.Item,{label:t,style:{marginBottom:8},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[C.jsxs(Do,{type:"secondary",style:{fontSize:12},children:[d.length," of ",i.length," selected"]}),C.jsx(tn,{type:"link",size:"small",onClick:()=>r(d.length===i.length?[]:i.map(p=>p.key)),children:d.length===i.length?"Deselect All":"Select All"})]}),l?C.jsx("div",{style:{textAlign:"center",padding:20},children:C.jsx(ul,{size:"small"})}):i.length===0?C.jsx(ai,{description:"No databases available",image:ai.PRESENTED_IMAGE_SIMPLE}):C.jsx(Ha,{dataSource:i,renderItem:f,style:{maxHeight:"40vh",overflowY:"auto"},split:!1})]},e)})},lur=({propertyKey:e,label:t,value:n,onChange:r,token:a})=>{const[i,o]=b.useState([]),[l,s]=b.useState(!1),{get:c}=kl(),u=b.useRef(!1);b.useEffect(()=>{if(u.current)return;u.current=!0,(async()=>{s(!0);try{const h=await c("/api/metrics-configs");h.success&&h.data&&Array.isArray(h.data.records)&&o(h.data.records)}catch(h){console.error("Failed to fetch metrics configs:",h)}finally{s(!1)}})()},[c]);const d=Array.isArray(n)?n:[],f=p=>{const h=p.name||p.key,g=d.includes(p.key);return C.jsx(Ha.Item,{style:{padding:"8px 0",cursor:"pointer",borderRadius:a.borderRadius,backgroundColor:g?a.colorSuccessBg:"transparent",border:`1px solid ${g?a.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.2s ease",paddingLeft:8,paddingRight:8},onClick:()=>{const m=g?d.filter(A=>A!==p.key):[...d,p.key];r(m)},children:C.jsx(Ha.Item.Meta,{avatar:C.jsx(Rc,{checked:g,onChange:()=>{const m=g?d.filter(A=>A!==p.key):[...d,p.key];r(m)},onClick:m=>m.stopPropagation()}),title:C.jsx(Do,{strong:g,children:h}),description:p.description&&C.jsx(Do,{type:"secondary",style:{fontSize:12},children:p.description})})},p.key)};return C.jsx("div",{children:C.jsxs(ra.Item,{label:t,style:{marginBottom:8},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[C.jsxs(Do,{type:"secondary",style:{fontSize:12},children:[d.length," of ",i.length," selected"]}),C.jsx(tn,{type:"link",size:"small",onClick:()=>r(d.length===i.length?[]:i.map(p=>p.key)),children:d.length===i.length?"Deselect All":"Select All"})]}),l?C.jsx("div",{style:{textAlign:"center",padding:20},children:C.jsx(ul,{size:"small"})}):i.length===0?C.jsx(ai,{description:"No metrics servers available",image:ai.PRESENTED_IMAGE_SIMPLE}):C.jsx(Ha,{dataSource:i,renderItem:f,style:{maxHeight:"40vh",overflowY:"auto"},split:!1})]},e)})},sur=({middleware:e,middlewareType:t,onToggle:n,onConfigChange:r,token:a})=>{const[i,o]=b.useState(e.enabled),l=()=>{switch(e.type){case"browser":return C.jsx(NXe,{style:{color:a.colorPrimary}});case"sql":return C.jsx(dfe,{style:{color:a.colorWarning}});case"skill":return C.jsx(vjt,{style:{color:a.colorSuccess}});case"filesystem":return C.jsx(IXe,{style:{color:a.colorInfo}});case"code_eval":return C.jsx(ff,{style:{color:a.colorError}});case"metrics":return C.jsx(iB,{size:16,style:{color:a.colorWarning}});default:return C.jsx(Sx,{style:{color:a.colorWarning}})}},s=()=>{if(e.type==="browser")return C.jsxs("div",{style:{marginTop:12,paddingTop:12,borderTop:`1px solid ${a.colorBorderSecondary}`},children:[C.jsx(Do,{strong:!0,style:{fontSize:12,display:"block",marginBottom:8},children:"Provided Tools"}),C.jsx(tr,{size:4,wrap:!0,children:["Navigate","Click","Fill","Get Text","Markdown","Screenshot","Scroll","Evaluate"].map(u=>C.jsx(Yr,{color:"green",style:{fontSize:10,margin:0},children:u},u))})]});if(e.type==="sql"||e.type==="skill"){const u=(t==null?void 0:t.tools)||[];return C.jsxs("div",{style:{marginTop:12,paddingTop:12,borderTop:`1px solid ${a.colorBorderSecondary}`},children:[C.jsx(Do,{strong:!0,style:{fontSize:12,display:"block",marginBottom:8},children:"Provided Tools"}),C.jsx(tr,{size:4,wrap:!0,children:u.map(d=>C.jsx(Yr,{color:e.type==="sql"?"orange":"blue",style:{fontSize:10,margin:0},children:d.name},d.id))})]})}return null},c=()=>{var f;if(!((f=t==null?void 0:t.schema)!=null&&f.properties))return null;const u=t.schema.properties,d=Object.keys(u);return C.jsx("div",{style:{marginTop:8},children:d.map(p=>{const h=u[p];return p==="skills"&&e.config.readAll===!0||p==="serverKeys"&&e.config.connectAll===!0?null:rur(p,h,e.config[p]??h.default,g=>r({[p]:g}),a)})})};return C.jsxs(Ti,{size:"small",style:{marginBottom:16,border:`1px solid ${e.enabled?a.colorPrimary:a.colorBorderSecondary}`,backgroundColor:`${a.colorBgContainer}d0`,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",opacity:e.enabled?1:.7},bodyStyle:{padding:0},children:[C.jsxs("div",{style:{padding:"10px 14px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:i?`1px solid ${a.colorBorderSecondary}`:"none",backgroundColor:`${a.colorFillQuaternary}d0`},onClick:()=>e.enabled&&o(!i),children:[C.jsxs(tr,{size:"small",children:[l(),C.jsx(Do,{strong:!0,style:{fontSize:14},children:e.name})]}),C.jsxs(tr,{size:"small",onClick:u=>u.stopPropagation(),children:[C.jsx(pw,{checked:e.enabled,onChange:u=>{n(),u&&o(!0)},size:"small"}),C.jsx("div",{style:{transform:i?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s",opacity:e.enabled?1:.3},children:C.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{color:a.colorTextSecondary},children:C.jsx("path",{d:"M6 8L1 3h10L6 8z",fill:"currentColor"})})})]})]}),e.enabled&&i&&C.jsxs("div",{style:{padding:16},children:[C.jsx(Do,{type:"secondary",style:{fontSize:11,display:"block",marginBottom:12},children:e.description}),c(),s()]})]})},cur=({assistant:e,allAssistants:t,visible:n,onClose:r,onSave:a,onDelete:i})=>{const[o]=ra.useForm(),{token:l}=Zl.useToken(),{config:s}=Zo(),{get:c}=kl(),[u,d]=b.useState(!1),[f,p]=b.useState(!1),[h,g]=b.useState(!1),[m,A]=b.useState(!1),[v,y]=b.useState([]),[_,x]=b.useState([]),[S,E]=b.useState([]),[w,I]=b.useState(""),[N,R]=b.useState(!1),[L,O]=b.useState("react"),[M,B]=b.useState([]),D=b.useMemo(()=>{if(!(e!=null&&e.graphDefinition))return null;try{const Q=typeof e.graphDefinition=="string"?JSON.parse(e.graphDefinition):e.graphDefinition;return{tools:Q.tools||[],prompt:Q.prompt||"",subAgents:Q.subAgents||[],type:Q.type||"react",middleware:Q.middleware||[]}}catch{return null}},[e]),$=b.useCallback(Q=>(Q||[]).map((re,te)=>({id:`${re.type}-${te+1}`,type:re.type,name:re.name,description:re.description,enabled:!1,config:{}})),[]),P=b.useCallback((Q,X)=>{const re=X||[],te=new Map((Q==null?void 0:Q.map(ne=>[ne.type,ne]))||[]);return re.map((ne,oe)=>{const de=te.get(ne.type);return de?{...de,name:ne.name,description:ne.description}:{id:`${ne.type}-${oe+1}`,type:ne.type,name:ne.name,description:ne.description,enabled:!1,config:{}}})},[]),U=b.useCallback(async()=>{var Q;if(n){d(!0);try{const X=await c("/api/tools");X.success&&((Q=X.data)!=null&&Q.records)&&y(X.data.records)}catch(X){console.error("Failed to fetch tools:",X)}finally{d(!1)}}},[c,n]);b.useEffect(()=>{if(n&&e)if(U(),D){x(D.tools),E(D.subAgents),I(D.prompt),O(D.type);const Q=D.middleware;B(Q!==void 0?P(Q,s.availableMiddlewareTypes||[]):$(s.availableMiddlewareTypes||[])),o.setFieldsValue({name:e.name,description:e.description,prompt:D.prompt,type:D.type})}else x([]),E([]),I(""),O("react"),B($(s.availableMiddlewareTypes||[])),o.resetFields()},[n,e,D,o,U,$,s.availableMiddlewareTypes]);const j=Q=>{x(X=>X.includes(Q)?X.filter(re=>re!==Q):[...X,Q])},G=Q=>{E(X=>X.includes(Q)?X.filter(re=>re!==Q):[...X,Q])},F=async()=>{if(e)try{p(!0);const X={...await o.validateFields(),tools:_,subAgents:S,prompt:w,middleware:M};await(a==null?void 0:a(e,X))}catch(Q){throw Q instanceof Error&&hn.error(Q.message),Q}finally{p(!1)}},H=async()=>{if(e){g(!0);try{await(i==null?void 0:i(e)),A(!1),r()}catch(Q){A(!1),hn.error(Q instanceof Error?Q.message:"Failed to delete assistant")}finally{g(!1)}}},q=Q=>{B(X=>X.map(re=>{var te;if(re.id!==Q)return re;if(re.enabled)return{...re,enabled:!1};{const ne=(te=s.availableMiddlewareTypes)==null?void 0:te.find(oe=>oe.type===re.type);return{...re,enabled:!0,config:(ne==null?void 0:ne.defaultConfig)||{}}}}))},V=(Q,X)=>{B(re=>re.map(te=>te.id===Q?{...te,config:{...te.config,...X}}:te))},Y=Q=>C.jsx(Ha.Item,{style:{padding:"8px 0",cursor:"pointer",borderRadius:l.borderRadius,backgroundColor:_.includes(Q.id)?l.colorPrimaryBg:"transparent",border:`1px solid ${_.includes(Q.id)?l.colorPrimary:"transparent"}`,marginBottom:4,transition:"all 0.2s ease",paddingLeft:8,paddingRight:8},onClick:()=>j(Q.id),children:C.jsx(Ha.Item.Meta,{avatar:C.jsx(Rc,{checked:_.includes(Q.id),onChange:()=>j(Q.id),onClick:X=>X.stopPropagation()}),title:C.jsxs(tr,{size:"small",children:[C.jsx(Do,{strong:_.includes(Q.id),children:Q.name}),Q.needUserApprove&&C.jsx(Yr,{color:"warning",style:{fontSize:10,padding:"0 4px",margin:0},children:"Approve"})]}),description:C.jsx(Do,{type:"secondary",style:{fontSize:12},children:Q.description})})},Q.id),K=Q=>{var X;return C.jsx(Ha.Item,{style:{padding:"8px 0",cursor:"pointer",borderRadius:l.borderRadius,backgroundColor:S.includes(Q.id)?l.colorInfoBg:"transparent",border:`1px solid ${S.includes(Q.id)?l.colorInfo:"transparent"}`,marginBottom:4,transition:"all 0.2s ease",paddingLeft:8,paddingRight:8},onClick:()=>G(Q.id),children:C.jsx(Ha.Item.Meta,{avatar:C.jsx(Rc,{checked:S.includes(Q.id),onChange:()=>G(Q.id),onClick:re=>re.stopPropagation()}),title:C.jsxs(tr,{size:"small",children:[C.jsx(z3,{size:"small",style:{backgroundColor:l.colorSuccess,fontSize:12},children:((X=Q.name)==null?void 0:X.charAt(0).toUpperCase())||"A"}),C.jsx(Do,{strong:S.includes(Q.id),children:Q.name})]}),description:C.jsx(Do,{type:"secondary",style:{fontSize:12},children:Q.description||"No description"})})},Q.id)};return!n||!e?null:C.jsxs("div",{style:{width:380,height:"100%",backgroundColor:`${l.colorBgContainer}f0`,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",borderLeft:`1px solid ${l.colorBorderSecondary}`,display:"flex",flexDirection:"column",boxShadow:"-2px 0 8px rgba(0, 0, 0, 0.05)"},children:[C.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${l.colorBorderSecondary}`,display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:`${l.colorFillQuaternary}e0`,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[C.jsxs(tr,{size:"small",children:[C.jsx(bie,{style:{color:l.colorPrimary,fontSize:16}}),C.jsx(Do,{strong:!0,style:{fontSize:14},children:e.name}),C.jsx(Yr,{color:"blue",style:{margin:0,fontSize:10},children:"Config"})]}),C.jsxs(tr,{children:[i&&C.jsx(Or,{title:"Delete Assistant",children:C.jsx(tn,{type:"text",size:"small",danger:!0,icon:C.jsx(gUt,{}),onClick:()=>A(!0)})}),C.jsx(tn,{type:"text",size:"small",icon:C.jsx(Yb,{}),onClick:r})]})]}),C.jsx("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:C.jsxs(ra,{form:o,layout:"vertical",autoComplete:"off",children:[C.jsxs(Qte,{title:"Basic Settings",icon:C.jsx(bie,{style:{color:l.colorPrimary}}),defaultExpanded:!0,children:[C.jsx(ra.Item,{name:"name",label:"Name",rules:[{required:!0,message:"Please enter agent name"}],style:{marginBottom:8},children:C.jsx(Zn,{placeholder:"Enter agent name..."})}),C.jsx(ra.Item,{name:"description",label:"Description",rules:[{required:!0,message:"Please enter agent description"}],style:{marginBottom:8},children:C.jsx(Zn.TextArea,{placeholder:"Enter agent description...",autoSize:{minRows:2,maxRows:4}})}),C.jsxs(ra.Item,{name:"type",label:"Agent Type",rules:[{required:!0}],style:{marginBottom:8},children:[C.jsx(Ax,{value:L,onChange:Q=>O(Q),options:[{value:"react",label:"Executor"},{value:"deep_agent",label:"Orchestrator"},{value:"team",label:"Team"}],block:!0}),C.jsx(Do,{type:"secondary",style:{fontSize:11,marginTop:6,display:"block",lineHeight:1.4},children:L==="react"?"Executor: Directly executes tasks using tools. Best for single-step operations like search, code execution, and data retrieval.":L==="deep_agent"?"Orchestrator: Manages a sequential todo list to plan and assign todo items to sub-agents. Best for structured multi-step workflows.":"Team: Creates tasks with dependencies and dynamically spawns teammates. Like a swarm, teammates communicate via mailbox. Best for tasks requiring exploration and divergent thinking."})]}),C.jsxs(ra.Item,{label:C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[C.jsx("span",{children:"System Prompt"}),C.jsxs("div",{onClick:()=>R(!0),style:{cursor:"pointer",padding:"2px 8px",borderRadius:4,fontSize:11,color:l.colorPrimary,background:l.colorPrimaryBg,border:`1px solid ${l.colorPrimaryBorder}`,display:"flex",alignItems:"center",gap:4},children:[C.jsx(UUt,{style:{fontSize:10}}),C.jsx("span",{children:"Expand"})]})]}),children:[C.jsx(nur,{value:w,onChange:Q=>I(Q.target.value),placeholder:"Enter the system prompt for this agent...",autoSize:{minRows:4,maxRows:8},style:{fontFamily:"monospace",fontSize:13,lineHeight:1.6}}),C.jsx(Do,{type:"secondary",style:{fontSize:12,marginTop:4,display:"block"},children:"Define the agent's behavior, capabilities, and constraints"})]})]}),M.map(Q=>C.jsx(sur,{middleware:Q,middlewareType:aur(Q.type,s.availableMiddlewareTypes),onToggle:()=>q(Q.id),onConfigChange:X=>V(Q.id,X),token:l},Q.id)),C.jsx(Qte,{title:"Common Tools",icon:C.jsx(gw,{style:{color:l.colorPrimary}}),badge:_.length,defaultExpanded:!1,children:u?C.jsx("div",{style:{textAlign:"center",padding:20},children:C.jsx(ul,{size:"small"})}):v.length===0?C.jsx(ai,{description:"No tools available",image:ai.PRESENTED_IMAGE_SIMPLE}):C.jsxs(C.Fragment,{children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[C.jsxs(Do,{type:"secondary",style:{fontSize:12},children:[_.length," of ",v.length," selected"]}),C.jsx(tn,{type:"link",size:"small",onClick:()=>x(_.length===v.length?[]:v.map(Q=>Q.id)),children:_.length===v.length?"Deselect All":"Select All"})]}),C.jsx(Ha,{dataSource:v,renderItem:Y,style:{maxHeight:"40vh",overflowY:"auto"},split:!1})]})}),C.jsx(Qte,{title:"Sub-Agents",icon:C.jsx(ejt,{style:{color:l.colorInfo}}),badge:S.length,defaultExpanded:!1,children:t.filter(Q=>Q.id!==e.id).length===0?C.jsx(ai,{description:"No other agents available",image:ai.PRESENTED_IMAGE_SIMPLE}):C.jsxs(C.Fragment,{children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[C.jsxs(Do,{type:"secondary",style:{fontSize:12},children:[S.length," of"," ",t.filter(Q=>Q.id!==e.id).length," ","selected"]}),C.jsx(tn,{type:"link",size:"small",onClick:()=>{const Q=t.filter(X=>X.id!==e.id).map(X=>X.id);E(S.length===Q.length?[]:Q)},children:S.length===t.filter(Q=>Q.id!==e.id).length?"Deselect All":"Select All"})]}),C.jsx(Ha,{dataSource:t.filter(Q=>Q.id!==e.id),renderItem:K,style:{maxHeight:"40vh",overflowY:"auto"},split:!1})]})})]})}),C.jsxs("div",{style:{padding:"12px 20px",borderTop:`1px solid ${l.colorBorderSecondary}`,backgroundColor:l.colorFillQuaternary,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[C.jsx(Do,{type:"secondary",style:{fontSize:12},children:a?"Changes will be saved to the agent":"Viewing agent configuration"}),C.jsxs(tr,{children:[C.jsx(tn,{onClick:r,size:"small",children:"Close"}),a&&C.jsx(tn,{type:"primary",icon:C.jsx(kXe,{}),loading:f,onClick:F,size:"small",children:"Save"})]})]}),C.jsxs(ji,{title:"System Prompt",open:N,onCancel:()=>R(!1),width:700,footer:null,styles:{body:{padding:"16px 24px"}},children:[C.jsx(Zn.TextArea,{value:w,onChange:Q=>I(Q.target.value),rows:12,style:{width:"100%",fontFamily:"monospace",fontSize:12,resize:"vertical",minHeight:200}}),C.jsxs("div",{style:{marginTop:12,display:"flex",justifyContent:"flex-end",gap:8},children:[C.jsx("div",{onClick:()=>R(!1),style:{padding:"6px 16px",borderRadius:4,cursor:"pointer",fontSize:12,border:`1px solid ${l.colorBorder}`,background:l.colorBgContainer},children:"Cancel"}),C.jsx("div",{onClick:()=>R(!1),style:{padding:"6px 16px",borderRadius:4,cursor:"pointer",fontSize:12,background:l.colorPrimary,color:"#fff"},children:"Done"})]})]}),C.jsx(ji,{title:"Delete Assistant",open:m,onCancel:()=>A(!1),footer:[C.jsx(tn,{onClick:()=>A(!1),children:"Cancel"},"cancel"),C.jsx(tn,{type:"primary",danger:!0,loading:h,onClick:H,children:"Delete"},"delete")],children:C.jsxs(Do,{children:["Are you sure you want to delete ",C.jsx(Do,{strong:!0,children:e.name}),"? This action cannot be undone."]})})]})},uur=cur,{Text:dur}=Ar,fur=({onSelect:e,value:t,placeholder:n="Select a parent agent to extend..."})=>{const[r,a]=b.useState([]),[i,o]=b.useState(!1),{get:l}=kl();b.useEffect(()=>{(async()=>{var u;o(!0);try{const d=await l("/api/assistants");d.success&&a(((u=d.data)==null?void 0:u.records)||[])}catch(d){console.error("Failed to fetch assistants:",d)}finally{o(!1)}})()},[l]);const s=c=>{if(!c){e(null);return}const u=r.find(d=>d.id===c);e(u||null)};return C.jsx(Vh,{showSearch:!0,allowClear:!0,value:t,placeholder:n,loading:i,onChange:s,optionFilterProp:"label",style:{width:"100%"},options:r.map(c=>({value:c.id,label:c.name||c.id,description:c.description})),optionRender:c=>C.jsxs("div",{children:[C.jsx("div",{children:c.label}),c.data.description&&C.jsx(dur,{type:"secondary",style:{fontSize:12},children:c.data.description})]})})},{Text:gGe}=Ar,pur=({subAgentKeys:e,decisions:t,onChange:n})=>{const{token:r}=Zl.useToken(),a=(o,l)=>{const s=t.map(c=>c.originalKey===o?{...c,clone:l,cloneKey:l?`${o}_clone`:void 0}:c);n(s)},i=(o,l)=>{const s=t.map(c=>c.originalKey===o?{...c,cloneKey:l}:c);n(s)};return e.length===0?null:C.jsxs("div",{children:[C.jsx(gGe,{type:"secondary",style:{display:"block",marginBottom:8},children:"Choose how to handle each sub-agent from the parent:"}),C.jsx(Ha,{size:"small",bordered:!0,dataSource:t,style:{borderRadius:r.borderRadius},renderItem:o=>C.jsxs(Ha.Item,{style:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:8,padding:"8px 16px"},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[o.clone?C.jsx(RXe,{style:{color:r.colorPrimary}}):C.jsx(HN,{style:{color:r.colorTextSecondary}}),C.jsx(gGe,{style:{fontFamily:"monospace"},children:o.originalKey})]}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[C.jsx(Yr,{color:o.clone?"blue":"default",children:o.clone?"Clone as new":"Reuse"}),C.jsx(pw,{size:"small",checked:o.clone,onChange:l=>a(o.originalKey,l)})]})]}),o.clone&&C.jsx(Zn,{size:"small",placeholder:"Enter key for the cloned agent",value:o.cloneKey,onChange:l=>i(o.originalKey,l.target.value),style:{fontFamily:"monospace",fontSize:12},addonBefore:"Key"})]})})]})},{TextArea:mGe}=Zn,{Text:g7}=Ar,hur=({open:e,onCancel:t,onSuccess:n})=>{var E;const[r]=ra.useForm(),[a,i]=b.useState(!1),[o,l]=b.useState("scratch"),[s,c]=b.useState(null),[u,d]=b.useState([]),{get:f,post:p}=kl();Zl.useToken();const h=b.useCallback(()=>{c(null),d([])},[]),g=b.useCallback(w=>{if(c(w),!w){r.resetFields(["key","name","description","type","prompt"]),d([]);return}const I=typeof w.graphDefinition=="object"&&w.graphDefinition!==null?w.graphDefinition:{},N=I.key||w.id,R=w.name||I.name||"";r.setFieldsValue({key:`${N}_ext`,name:R?`${R} (Extended)`:"",description:w.description||I.description||"",type:I.type||"react",prompt:I.prompt||""});const L=I.subAgents||[];d(L.map(O=>({originalKey:O,clone:!1})))},[r]),m=b.useCallback(w=>{l(w),w==="scratch"&&(h(),r.resetFields())},[r,h]),A=async(w,I)=>{const N=await f(`/api/assistants/${w}`);if(!N.success)throw new Error(`Failed to fetch sub-agent "${w}" for cloning`);const R=N.data,L=typeof R.graphDefinition=="object"?R.graphDefinition:{},O={id:I,name:`${R.name} (Clone)`,description:R.description||"",graphDefinition:{...L,key:I,name:`${R.name} (Clone)`}},M=await p("/api/assistants",O);if(!M.success)throw new Error(M.message||`Failed to clone sub-agent "${w}"`);return M.data},v=w=>({id:w.key,name:w.name,description:w.description||"",graphDefinition:{key:w.key,name:w.name,description:w.description||"",type:w.type,prompt:w.prompt||"",tools:[],skills:[],subAgents:w.type==="deep_agent"?[]:void 0,middleware:[]}}),y=async(w,I)=>{if(!s)throw new Error("No parent agent selected");const N=u.filter(M=>M.clone);for(const M of N){if(!M.cloneKey||!M.cloneKey.trim())throw new Error(`Please provide a key for the cloned sub-agent "${M.originalKey}"`);if(!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(M.cloneKey))throw new Error(`Invalid key "${M.cloneKey}" for cloned sub-agent "${M.originalKey}". Key must start with a letter and contain only letters, numbers, underscores, or hyphens.`)}const R=[];for(const M of u)if(M.clone){const B=await A(M.originalKey,M.cloneKey);I.push(B),R.push(M.cloneKey)}else R.push(M.originalKey);const L=typeof s.graphDefinition=="object"?s.graphDefinition:{},O={key:w.key,name:w.name,description:w.description||"",extendsAgent:s.id,type:w.type||L.type};return w.prompt&&w.prompt!==L.prompt&&(O.prompt=w.prompt),(R.length>0||L.subAgents&&L.subAgents.length>0)&&(O.subAgents=R),{id:w.key,name:w.name,description:w.description||"",graphDefinition:O}},_=async()=>{try{const w=await r.validateFields();i(!0);const I=[],N=o==="scratch"?v(w):await y(w,I),R=await p("/api/assistants",N);if(R.success){hp.success({message:"Created",description:o==="extend"?`Assistant created by extending "${s==null?void 0:s.name}"`:"Assistant created successfully"}),r.resetFields(),h(),l("scratch");for(const L of I)n==null||n(L);n==null||n(R.data),t()}else hn.error(R.message||"Failed to create assistant")}catch(w){if(w.errorFields)return;hn.error(w.message||"An error occurred while creating the assistant")}finally{i(!1)}},x=((E=s==null?void 0:s.graphDefinition)==null?void 0:E.subAgents)||[],S=o==="extend"&&s&&x.length>0;return C.jsxs(ji,{title:"Create New Assistant",open:e,onCancel:()=>{h(),l("scratch"),t()},footer:[C.jsx(tn,{onClick:()=>{h(),l("scratch"),t()},children:"Cancel"},"cancel"),C.jsx(tn,{type:"primary",icon:o==="extend"?C.jsx(RXe,{}):C.jsx(j3,{}),loading:a,onClick:_,children:o==="extend"?"Create (Extend)":"Create"},"submit")],width:600,children:[C.jsxs("div",{style:{marginBottom:20},children:[C.jsx(g7,{type:"secondary",style:{display:"block",marginBottom:8},children:"Creation Mode"}),C.jsx(Ax,{value:o,onChange:m,options:[{value:"scratch",label:"From Scratch"},{value:"extend",label:"Extend Existing Agent"}],block:!0})]}),o==="extend"&&C.jsxs("div",{style:{marginBottom:20},children:[C.jsx(g7,{type:"secondary",style:{display:"block",marginBottom:8},children:"Parent Agent"}),C.jsx(fur,{value:s==null?void 0:s.id,onSelect:g}),s&&C.jsx(g7,{type:"secondary",style:{display:"block",marginTop:4,fontSize:12},children:"Fields left unchanged will be inherited from the parent agent."})]}),o==="extend"&&s&&C.jsx(T4,{style:{margin:"12px 0"}}),C.jsxs(ra,{form:r,layout:"vertical",autoComplete:"off",initialValues:{type:"react"},children:[C.jsx(ra.Item,{name:"key",label:"Key (ID)",rules:[{required:!0,message:"Please enter a unique key"},{pattern:/^[a-zA-Z][a-zA-Z0-9_-]*$/,message:"Key must start with a letter and contain only letters, numbers, underscores, or hyphens"}],style:{marginBottom:16},children:C.jsx(Zn,{placeholder:"e.g., my_assistant"})}),C.jsx(ra.Item,{name:"name",label:"Name",rules:[{required:!0,message:"Please enter a name"}],style:{marginBottom:16},children:C.jsx(Zn,{placeholder:"e.g., My Assistant"})}),C.jsx(ra.Item,{name:"description",label:"Description",rules:[{required:!0,message:"Please enter a description"}],style:{marginBottom:16},children:C.jsx(mGe,{placeholder:"Enter a description for this assistant...",autoSize:{minRows:2,maxRows:4}})}),C.jsx(ra.Item,{name:"type",label:"Agent Type",rules:[{required:!0}],style:{marginBottom:16},children:C.jsx(Ax,{options:[{value:"react",label:"Executor"},{value:"deep_agent",label:"Orchestrator"},{value:"team",label:"Team"}],block:!0})}),C.jsx(ra.Item,{noStyle:!0,shouldUpdate:(w,I)=>w.type!==I.type,children:()=>{const w=r.getFieldValue("type"),I={react:"Executor: Directly executes tasks using tools. Best for single-step operations like search, code execution, and data retrieval.",deep_agent:"Orchestrator: Manages a sequential todo list to plan and assign todo items to sub-agents. Best for structured multi-step workflows.",team:"Team: Creates tasks with dependencies and dynamically spawns teammates. Like a swarm, teammates communicate via mailbox. Best for tasks requiring exploration and divergent thinking."};return C.jsx(g7,{type:"secondary",style:{fontSize:12,display:"block",marginTop:-12,marginBottom:16,lineHeight:1.5},children:I[w]||I.react})}}),C.jsx(ra.Item,{name:"prompt",label:o==="extend"&&s?"System Prompt (leave unchanged to inherit from parent)":"System Prompt",rules:o==="scratch"?[{required:!0,message:"Please enter a system prompt"}]:[],children:C.jsx(mGe,{placeholder:o==="extend"&&s?"Leave empty to inherit parent's prompt, or enter a new prompt to override...":"Enter the system prompt for this agent...",autoSize:{minRows:4,maxRows:8},style:{fontFamily:"monospace",fontSize:13,lineHeight:1.6}})})]}),S&&C.jsxs(C.Fragment,{children:[C.jsx(T4,{style:{margin:"12px 0"}}),C.jsx(g7,{strong:!0,style:{display:"block",marginBottom:8},children:"Sub-Agents"}),C.jsx(pur,{subAgentKeys:x,decisions:u,onChange:d})]})]})},gur=hur,mur=({onChat:e})=>{const{setCenter:t,fitView:n}=RC(),[r,a,i]=Lve([]),[o,l,s]=kve([]),[c,u]=b.useState([]),[d,f]=b.useState(!1),[p,h]=b.useState(!1),[g,m]=b.useState(null),[A,v]=b.useState(!1),{get:y,del:_,put:x}=kl(),{config:S}=Zo(),{token:E}=Zl.useToken(),{enableAssistantCreation:w=!0,enableAssistantEditing:I=!0}=S,N=b.useMemo(()=>({assistant:tur}),[]),R=b.useCallback(U=>{m(U),h(!0)},[]),L=b.useCallback(()=>{h(!1),m(null)},[]),O=b.useCallback(({nodes:U})=>{if(U.length===1&&I){const j=U[0].data;j!=null&&j.assistant&&(m(j.assistant),h(!0))}else U.length===0&&(h(!1),m(null))},[I]),M=async()=>{f(!0);try{const U=await y("/api/assistants");U.success&&U.data&&Array.isArray(U.data.records)&&u(U.data.records)}catch(U){console.error("Failed to fetch assistants:",U),u([])}finally{f(!1)}};b.useEffect(()=>{M()},[]),b.useEffect(()=>{if(!c||c.length===0){a([]),l([]);return}const U=[],j=[],G=320,F=300,H=Math.ceil(Math.sqrt(c.length)),q=new Map,V=[];if(c.forEach(K=>{q.set(K.id,K)}),c.forEach(K=>{if(K.graphDefinition)try{const Q=typeof K.graphDefinition=="string"?JSON.parse(K.graphDefinition):K.graphDefinition;Q.subAgents&&Array.isArray(Q.subAgents)&&Q.subAgents.forEach(X=>{const re=c.find(te=>te.id===X||te.id===String(X));re&&re.id!==K.id&&V.push({source:K.id,target:re.id})}),Q.internalSubAgents&&Array.isArray(Q.internalSubAgents)&&Q.internalSubAgents.forEach(X=>{if(X.key){const re=c.find(te=>te.id===X.key||te.id===String(X.key));re&&re.id!==K.id&&V.push({source:K.id,target:re.id})}}),Q.nodes&&Array.isArray(Q.nodes)&&Q.nodes.forEach(X=>{if(X.assistantId&&X.assistantId!==K.id){const re=c.find(te=>te.id===X.assistantId||te.id===String(X.assistantId));re&&V.push({source:K.id,target:re.id})}}),Q.edges&&Array.isArray(Q.edges)&&Q.edges.forEach(X=>{if(X.source&&X.target){const re=typeof X.source=="string"?X.source:X.source.id||X.source.assistantId,te=typeof X.target=="string"?X.target:X.target.id||X.target.assistantId,ne=c.find(de=>de.id===re||de.id===String(re)),oe=c.find(de=>de.id===te||de.id===String(te));ne&&oe&&V.push({source:ne.id,target:oe.id})}})}catch(Q){console.warn(`Failed to parse graphDefinition for assistant ${K.id}:`,Q)}}),V.length>0){const K=new Set,Q=new Map,X=new Map;V.forEach(oe=>{X.has(oe.source)||X.set(oe.source,[]),X.get(oe.source).push(oe.target)});const re=[],te=c.filter(oe=>!V.some(de=>de.target===oe.id));for(te.length===0&&c.length>0?re.push({id:c[0].id,level:0}):te.forEach(oe=>{re.push({id:oe.id,level:0})});re.length>0;){const{id:oe,level:de}=re.shift();if(K.has(oe))continue;K.add(oe),Q.set(oe,de),(X.get(oe)||[]).forEach(ie=>{K.has(ie)||re.push({id:ie,level:de+1})})}c.forEach(oe=>{Q.has(oe.id)||Q.set(oe.id,0)});const ne=new Map;c.forEach(oe=>{const de=Q.get(oe.id)||0;ne.has(de)||ne.set(de,[]),ne.get(de).push(oe)}),ne.forEach((oe,de)=>{const ue=de*F,be=-((oe.length-1)*G)/2;oe.forEach((fe,ve)=>{const ge=be+ve*G;U.push({id:fe.id,type:"assistant",data:{assistant:fe,onConfigure:I?()=>R(fe):void 0,onChat:e},position:{x:ge,y:ue}})})}),V.forEach(oe=>{q.has(oe.source)&&q.has(oe.target)&&j.push({id:`e${oe.source}-${oe.target}`,source:oe.source,target:oe.target,animated:!0,style:{stroke:"#1677ff"},type:"smoothstep"})})}else c.forEach((K,Q)=>{const X=Math.floor(Q/H),te=Q%H*G-(H-1)*G/2,ne=X*F;U.push({id:K.id,type:"assistant",data:{assistant:K,onConfigure:I?()=>R(K):void 0,onChat:e},position:{x:te,y:ne}})});a(U),l(j)},[c,a,l,R,e]);const B=async(U,j)=>{try{const F={...typeof U.graphDefinition=="string"?JSON.parse(U.graphDefinition||"{}"):U.graphDefinition||{},...j},H=await x(`/api/assistants/${U.id}`,{name:j.name??U.name,description:j.description??U.description,graphDefinition:F});if(H.success)u(q=>q.map(V=>V.id===U.id?{...V,name:j.name??U.name,description:j.description??U.description,graphDefinition:F}:V)),hp.success({message:"Saved",description:H.message||"Agent configuration saved successfully"});else throw hn.error(H.message||"Failed to save agent configuration"),new Error(H.message||"Failed to save agent configuration")}catch(G){throw console.error("Failed to save agent configuration:",G),hn.error(G instanceof Error?G.message:"Failed to save agent configuration"),G}},D=async U=>{try{const j=await _(`/api/assistants/${U.id}`);if(j.success)u(G=>G.filter(F=>F.id!==U.id)),(g==null?void 0:g.id)===U.id&&(m(null),h(!1)),hp.success({message:"Deleted",description:"Assistant deleted successfully"});else throw hn.error(j.message||"Failed to delete assistant"),new Error(j.message||"Failed to delete assistant")}catch(j){throw console.error("Failed to delete assistant:",j),hn.error(j instanceof Error?j.message:"Failed to delete assistant"),j}},$=U=>{u(j=>j.some(F=>F.id===U.id)?j.map(F=>F.id===U.id?U:F):[...j,U]),P.current=U};b.useEffect(()=>{if(g){const U=r.find(j=>j.id===g.id);U&&t(U.position.x+140,U.position.y+100,{zoom:1,duration:800})}},[g,r,t]),b.useEffect(()=>{c.length>0&&g&&c.find(j=>j.id===g.id)&&!p&&h(!0)},[c,g,p]);const P=b.useRef(null);return b.useEffect(()=>{if(P.current&&!c.find(U=>{var j;return U.id===((j=P.current)==null?void 0:j.id)})&&(P.current=null),P.current){const U=r.find(j=>j.id===P.current.id);U&&(t(U.position.x+140,U.position.y+100,{zoom:1,duration:800}),m(P.current),h(!0),P.current=null)}},[r,t]),d?C.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"#fafafa"},children:"Loading assistants..."}):C.jsxs("div",{style:{width:"100%",height:"100%",display:"flex"},children:[C.jsxs("div",{style:{flex:1,height:"100%",background:"#fafafa",position:"relative"},children:[C.jsxs(Mve,{nodes:r,edges:o,onNodesChange:i,onEdgesChange:s,onSelectionChange:O,nodeTypes:N,fitView:!0,children:[C.jsx(Dve,{color:"#eee",gap:20}),C.jsx(Bve,{})]}),w&&C.jsx("div",{style:{position:"absolute",top:20,right:20,zIndex:10},children:C.jsx(tn,{type:"primary",size:"large",icon:C.jsx(j3,{}),onClick:()=>v(!0),style:{height:48,width:48,borderRadius:"50%",boxShadow:E.boxShadowTertiary,display:"flex",alignItems:"center",justifyContent:"center",padding:0}})})]}),C.jsx(uur,{visible:p,assistant:g,allAssistants:c,onClose:L,onSave:B,onDelete:D}),C.jsx(gur,{open:A,onCancel:()=>v(!1),onSuccess:$})]})},Aur=e=>C.jsx(J$,{children:C.jsx(mur,{...e})}),vur=Aur,{Text:Js}=Ar,{TextArea:AGe}=Zn,yur=e=>{const t=["#1890ff","#52c41a","#faad14","#f5222d","#722ed1","#13c2c2","#eb2f96","#fa8c16"];let n=0;for(let r=0;r<e.length;r++)n=e.charCodeAt(r)+((n<<5)-n);return t[Math.abs(n)%t.length]},bur=({data:e})=>{var j;const{token:t}=Zl.useToken(),{config:n}=Zo(),{put:r}=kl(),a=m1("__GLOBAL__");if(!e)return null;const{skill:i,onClick:o,onDelete:l}=e;if(!i)return null;const[s,c]=b.useState(i),u=yur(s.name),d=((j=s.name)==null?void 0:j.split("-").map(G=>G.charAt(0)).join("").toUpperCase().slice(0,2))||"SK",f=s.subSkills&&s.subSkills.length>0,p=s.metadata&&s.metadata.category||"global",h=b.useMemo(()=>s.metadata?Object.entries(s.metadata).filter(([G,F])=>G&&F):[],[s.metadata]),g=G=>{if(!G)return"";const F=G instanceof Date?G:new Date(G);return Number.isNaN(F.getTime())?"":F.toLocaleString()},m=G=>{navigator.clipboard.writeText(G)},[A,v]=b.useState(!1),[y,_]=b.useState({...i,id:i.name}),[x,S]=b.useState(h.map(([G,F])=>({key:G,value:F}))),[E,w]=b.useState(!1),[I,N]=b.useState(!1);b.useEffect(()=>{v(!1),c(i),_({...i,id:i.name}),S(Object.entries(i.metadata||{}).map(([G,F])=>({key:G,value:F})))},[i]);const R=(G,F)=>{if(G==="name"){_(H=>({...H,name:F,id:F}));return}_(H=>({...H,[G]:F}))},L=async G=>{G==null||G.stopPropagation(),G==null||G.preventDefault();try{const F=s.id||s.name;if(!F){hn.error("Skill ID is missing");return}await a.skills.delete(F),hp.success({message:"Deleted",description:"Skill deleted successfully"}),w(!1),l&&await l()}catch(F){hn.error((F==null?void 0:F.message)||"An error occurred while deleting the skill")}},O=G=>{S(G);const F=G.reduce((H,q)=>(q.key&&(H[q.key]=q.value),H),{});_(H=>({...H,metadata:F}))},M=(G,F,H)=>{const q=[...x];q[G]={...q[G],[F]:H},O(q)},B=()=>{O([...x,{key:"",value:""}])},D=async()=>{try{N(!0);const G={"Content-Type":"application/json"};n.apiKey&&(G.Authorization=`Bearer ${n.apiKey}`);const F={name:y.name,description:y.description,license:y.license||void 0,compatibility:y.compatibility||void 0,metadata:y.metadata||void 0,content:y.content||void 0,subSkills:y.subSkills||void 0},H=await r(`/api/skills/${s.id}`,F);if(H.success){hp.success({message:"Saved",description:"Skill updated successfully"});const q=H.data||y;c(q),_({...q,id:q.name}),S(Object.entries(q.metadata||{}).map(([V,Y])=>({key:V,value:Y}))),v(!1),o==null||o(q)}else hn.error(H.message||"Failed to update skill")}catch(G){hn.error(G.message||"An error occurred while updating the skill")}finally{N(!1)}},$=C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(Js,{style:{fontSize:12,color:t.colorTextSecondary},children:"Description"}),C.jsx(AGe,{value:y.description,onChange:G=>R("description",G.target.value),placeholder:"Description",autoSize:{minRows:2,maxRows:4}})]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(Js,{style:{fontSize:12,color:t.colorTextSecondary},children:"License"}),C.jsx(Zn,{value:y.license,onChange:G=>R("license",G.target.value),placeholder:"License"})]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(Js,{style:{fontSize:12,color:t.colorTextSecondary},children:"Compatibility"}),C.jsx(Zn,{value:y.compatibility,onChange:G=>R("compatibility",G.target.value),placeholder:"Compatibility"})]}),C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[C.jsx(Js,{style:{fontSize:12,color:t.colorTextSecondary,fontWeight:500},children:"Metadata"}),C.jsx(tn,{size:"small",icon:C.jsx(j3,{}),onClick:B,children:"Add"})]}),C.jsxs(tr,{direction:"vertical",size:8,style:{width:"100%"},children:[x.length===0&&C.jsx(Js,{style:{fontSize:11,color:t.colorTextTertiary},children:"No metadata yet. Use Add to create one."}),x.map((G,F)=>C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[C.jsxs(Js,{style:{fontSize:11,color:t.colorTextSecondary},children:["Meta ",F+1]}),C.jsxs(tr,{style:{width:"100%"},size:8,wrap:!0,children:[C.jsx(Zn,{value:G.key,placeholder:"Key",style:{width:140},onChange:H=>M(F,"key",H.target.value)}),C.jsx(Zn,{value:G.value,placeholder:"Value",style:{flex:1,minWidth:200},onChange:H=>M(F,"value",H.target.value)})]})]},F))]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(Js,{style:{fontSize:12,color:t.colorTextSecondary},children:"Content"}),C.jsx(AGe,{value:y.content,onChange:G=>R("content",G.target.value),placeholder:"Content",autoSize:{minRows:4,maxRows:8}})]})]}),P=C.jsxs("div",{style:{width:480,maxHeight:"80vh",overflowY:"auto",padding:16},children:[C.jsx("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:16},children:C.jsxs("div",{style:{flex:1},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(Js,{strong:!0,style:{fontSize:18,fontWeight:600,color:t.colorText},children:s.name}),C.jsx(Yr,{style:{margin:0,fontSize:10,padding:"2px 8px",fontWeight:600},color:"geekblue",children:p.toUpperCase()})]}),C.jsx("div",{style:{display:"flex",alignItems:"center",gap:6},children:C.jsx(Js,{style:{fontSize:11,color:t.colorTextTertiary,fontFamily:"monospace"},children:`>_ ${s.id}`})})]})}),A?$:C.jsxs(C.Fragment,{children:[s.description&&C.jsx("div",{style:{marginBottom:16},children:C.jsxs(Js,{style:{fontSize:12,color:t.colorText,lineHeight:1.6,fontStyle:"italic"},children:['"',s.description,'"']})}),h.length>0&&C.jsxs("div",{style:{marginBottom:16},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(Sx,{style:{fontSize:14,color:t.colorTextSecondary}}),C.jsxs(Js,{style:{fontSize:12,color:t.colorTextSecondary,fontWeight:500},children:["Metadata (",h.length,")"]})]}),C.jsx("div",{style:{border:`1px solid ${t.colorBorderSecondary}`,borderRadius:6,overflow:"hidden"},children:h.map(([G,F],H)=>C.jsxs("div",{style:{display:"flex",alignItems:"stretch",borderBottom:H===h.length-1?"none":`1px solid ${t.colorBorderSecondary}`},children:[C.jsx("div",{style:{width:140,padding:"8px 10px",background:t.colorFillTertiary,borderRight:`1px solid ${t.colorBorderSecondary}`,fontSize:11,color:t.colorTextSecondary,fontWeight:600,textTransform:"capitalize"},children:G}),C.jsx("div",{style:{flex:1,padding:"8px 10px",fontSize:11,color:t.colorText,wordBreak:"break-word"},children:F})]},G))})]}),f&&C.jsxs("div",{style:{marginBottom:16},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(Ure,{style:{fontSize:14,color:t.colorTextSecondary}}),C.jsxs(Js,{style:{fontSize:12,color:t.colorTextSecondary,fontWeight:500},children:["Sub-Skills (",s.subSkills.length,")"]})]}),C.jsx(tr,{size:[8,8],wrap:!0,children:s.subSkills.map((G,F)=>C.jsx(Yr,{style:{fontSize:11,padding:"4px 12px",backgroundColor:t.colorFillTertiary,color:t.colorText,border:`1px solid ${t.colorBorderSecondary}`},children:G},F))})]}),(s.license||s.compatibility)&&C.jsx("div",{style:{marginBottom:16},children:C.jsxs(tr,{size:[8,8],wrap:!0,children:[s.license&&C.jsx(Yr,{icon:C.jsx(v8e,{}),style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:t.colorInfoBg,color:t.colorInfo,border:`1px solid ${t.colorInfoBorder}`,fontWeight:500,lineHeight:"16px"},children:s.license}),s.compatibility&&C.jsx(Yr,{style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:t.colorSuccessBg,color:t.colorSuccess,border:`1px solid ${t.colorSuccessBorder}`,fontWeight:500,lineHeight:"16px",display:"inline-flex",alignItems:"center",gap:4},children:s.compatibility})]})}),(s.createdAt||s.updatedAt)&&C.jsx("div",{style:{marginBottom:16},children:C.jsxs(tr,{direction:"vertical",size:4,children:[s.createdAt&&C.jsxs(Js,{style:{fontSize:11,color:t.colorTextTertiary,fontFamily:"monospace"},children:["Created: ",g(s.createdAt)]}),s.updatedAt&&C.jsxs(Js,{style:{fontSize:11,color:t.colorTextTertiary,fontFamily:"monospace"},children:["Updated: ",g(s.updatedAt)]})]})}),s.content&&C.jsxs("div",{style:{marginBottom:0},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(j2,{style:{fontSize:14,color:t.colorTextSecondary}}),C.jsx(Js,{style:{fontSize:12,color:t.colorTextSecondary,fontWeight:600,letterSpacing:.5},children:"CONTENT"})]}),C.jsx("div",{style:{padding:12,background:t.colorFillTertiary,border:`1px solid ${t.colorBorderSecondary}`,borderRadius:4,maxHeight:200,overflowY:"auto"},children:C.jsx(Js,{style:{fontSize:11,color:t.colorText,lineHeight:1.6,whiteSpace:"pre-wrap"},children:s.content})})]})]}),C.jsx(T4,{style:{margin:"16px 0"}}),C.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:A?C.jsxs(C.Fragment,{children:[C.jsx(tn,{block:!0,onClick:()=>{v(!1),_(i)},style:{flex:1},children:"Cancel"}),C.jsx(tn,{type:"primary",block:!0,onClick:D,loading:I,style:{flex:1},children:"Save"})]}):C.jsxs(C.Fragment,{children:[C.jsx(tn,{type:"primary",block:!0,onClick:()=>v(!0),style:{flex:1},children:"Edit Skill"}),C.jsx(tn,{danger:!0,onClick:G=>{G.stopPropagation(),L(G)},children:"Delete"}),C.jsx(tn,{icon:C.jsx(EXe,{}),onClick:()=>m(s.id),title:"Copy ID"})]})})]}),U={opacity:0,background:"transparent",border:"none",width:0,height:0,pointerEvents:"none"};return C.jsxs("div",{style:{padding:4},children:[C.jsx(P3,{type:"target",position:Br.Top,style:U,isConnectable:!1}),C.jsx("div",{onClick:()=>{w(!0)},style:{width:280,minHeight:200,background:t.colorBgContainer,borderRadius:8,boxShadow:"0 1px 6px rgba(0, 0, 0, 0.08)",cursor:o?"pointer":"default",overflow:"hidden",transition:"all 0.2s ease",position:"relative",border:`1px solid ${t.colorBorder}`,display:"flex",flexDirection:"column"},onMouseEnter:G=>{o&&(G.currentTarget.style.transform="translateY(-2px)",G.currentTarget.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.12)")},onMouseLeave:G=>{G.currentTarget.style.transform="translateY(0)",G.currentTarget.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.08)"},children:C.jsxs("div",{style:{padding:12,display:"flex",flexDirection:"column",gap:10},children:[C.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[C.jsxs("div",{style:{position:"relative",flexShrink:0},children:[C.jsx(z3,{size:44,icon:C.jsx(CFt,{}),style:{backgroundColor:u,color:"#fff",fontSize:16,fontWeight:600},children:d}),f&&C.jsx("div",{style:{position:"absolute",bottom:-2,right:-2,width:18,height:18,borderRadius:"50%",background:t.colorPrimary,border:`2px solid ${t.colorBgContainer}`,display:"flex",alignItems:"center",justifyContent:"center"},children:C.jsx(Ure,{style:{fontSize:10,color:"#fff"}})})]}),C.jsxs("div",{style:{flex:1,minWidth:0},children:[C.jsx(Js,{strong:!0,style:{fontSize:14,fontWeight:600,display:"block",marginBottom:3,color:t.colorText,lineHeight:1.3},ellipsis:{tooltip:s.name},children:s.name}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[C.jsx(j2,{style:{fontSize:9,color:t.colorTextTertiary}}),C.jsx(Js,{style:{fontSize:9,color:t.colorTextTertiary},ellipsis:{tooltip:s.id},children:s.id})]})]})]}),s.description&&C.jsx("div",{style:{padding:8,background:t.colorFillTertiary,border:`1px solid ${t.colorBorderSecondary}`,borderRadius:4,borderLeft:`2px solid ${u}`},children:C.jsx(Or,{title:s.description.length>150?s.description:void 0,placement:"top",children:C.jsxs("div",{style:{fontSize:10,color:t.colorText,lineHeight:1.5,fontStyle:"italic",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",cursor:s.description.length>150?"help":"default"},children:['"',s.description,'"']})})}),C.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,padding:"4px 0",marginTop:"auto"},children:[C.jsx(Yr,{style:{margin:0,fontSize:8,padding:"2px 6px",borderRadius:6,backgroundColor:t.colorPrimaryBg,color:t.colorPrimary,border:`1px solid ${t.colorPrimaryBorder}`,fontWeight:600,lineHeight:"14px",textTransform:"capitalize"},children:p.toUpperCase()}),f&&C.jsxs(Yr,{style:{margin:0,fontSize:8,padding:"2px 6px",borderRadius:6,backgroundColor:t.colorSuccessBg,color:t.colorSuccess,border:`1px solid ${t.colorSuccessBorder}`,fontWeight:500,lineHeight:"14px",display:"inline-flex",alignItems:"center"},children:["SUB-SKILLS (",s.subSkills.length,")"]}),s.license&&C.jsx(Yr,{style:{margin:0,fontSize:7,padding:"2px 6px",borderRadius:6,backgroundColor:t.colorInfoBg,color:t.colorInfo,border:`1px solid ${t.colorInfoBorder}`,fontWeight:500,lineHeight:"14px"},icon:C.jsx(v8e,{}),children:s.license}),s.compatibility&&C.jsx(Yr,{style:{margin:0,fontSize:7,padding:"2px 6px",borderRadius:6,backgroundColor:t.colorSuccessBg,color:t.colorSuccess,border:`1px solid ${t.colorSuccessBorder}`,fontWeight:500,lineHeight:"14px"},icon:C.jsx(Sx,{}),children:s.compatibility})]})]})}),C.jsx(ji,{open:E,onCancel:()=>{w(!1),v(!1),_({...s,id:s.name})},footer:null,width:520,destroyOnClose:!0,title:null,styles:{body:{padding:0}},children:P}),C.jsx(P3,{type:"source",position:Br.Bottom,style:U,isConnectable:!1})]})},_ur=bur,{TextArea:vGe}=Zn,{Text:vm}=Ar,Sur=({open:e,onCancel:t,onSuccess:n})=>{const[r]=ra.useForm(),[a,i]=b.useState(!1),{post:o}=kl(),{token:l}=Zl.useToken(),s=[{key:"category",value:"global"}],[c,u]=b.useState(s),d=async()=>{try{const g=await r.validateFields();i(!0);const m=c.length>0?c.reduce((y,_)=>(_.key&&(y[_.key]=_.value),y),{}):void 0,A={id:g.name,name:g.name,description:g.description,license:g.license||void 0,compatibility:g.compatibility||void 0,metadata:m,content:g.content||void 0,subSkills:void 0},v=await o("/api/skills",A);v.success?(hp.success({message:"Created",description:"Skill created successfully"}),r.resetFields(),u(s),n==null||n(),t()):hn.error(v.message||"Failed to create skill")}catch(g){if(g.errorFields)return;hn.error(g.message||"An error occurred while creating the skill")}finally{i(!1)}},f=()=>{r.resetFields(),u(s),t()},p=(g,m,A)=>{const v=[...c];v[g]={...v[g],[m]:A},u(v)},h=()=>{u([...c,{key:"",value:""}])};return C.jsx(ji,{title:"Create New Skill",open:e,onCancel:f,footer:null,width:520,destroyOnClose:!0,styles:{body:{padding:16}},children:C.jsx(ra,{form:r,layout:"vertical",onFinish:d,autoComplete:"off",children:C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(vm,{style:{fontSize:12,color:l.colorTextSecondary},children:"Name"}),C.jsx(ra.Item,{name:"name",rules:[{required:!0,message:"Please enter skill name"},{pattern:/^[a-z0-9]+(-[a-z0-9]+)*$/,message:"Name must be lowercase alphanumeric with single hyphens (e.g., 'my-skill')"},{min:1,max:64,message:"Name must be 1-64 characters"}],style:{marginBottom:0},children:C.jsx(Zn,{placeholder:"e.g., data-analysis"})})]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(vm,{style:{fontSize:12,color:l.colorTextSecondary},children:"Description"}),C.jsx(ra.Item,{name:"description",rules:[{required:!0,message:"Please enter skill description"}],style:{marginBottom:0},children:C.jsx(vGe,{placeholder:"Description",autoSize:{minRows:2,maxRows:4}})})]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(vm,{style:{fontSize:12,color:l.colorTextSecondary},children:"License"}),C.jsx(ra.Item,{name:"license",style:{marginBottom:0},children:C.jsx(Zn,{placeholder:"License"})})]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(vm,{style:{fontSize:12,color:l.colorTextSecondary},children:"Compatibility"}),C.jsx(ra.Item,{name:"compatibility",style:{marginBottom:0},children:C.jsx(Zn,{placeholder:"Compatibility"})})]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[C.jsx(vm,{style:{fontSize:12,color:l.colorTextSecondary,fontWeight:500},children:"Metadata"}),C.jsx(tn,{size:"small",icon:C.jsx(j3,{}),onClick:h,children:"Add"})]}),C.jsxs(tr,{direction:"vertical",size:8,style:{width:"100%"},children:[c.length===0&&C.jsx(vm,{style:{fontSize:11,color:l.colorTextTertiary},children:"No metadata yet. Use Add to create one."}),c.map((g,m)=>C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[C.jsxs(vm,{style:{fontSize:11,color:l.colorTextSecondary},children:["Meta ",m+1]}),C.jsxs(tr,{style:{width:"100%"},size:8,wrap:!0,children:[C.jsx(Zn,{value:g.key,placeholder:"Key",style:{width:140},onChange:A=>p(m,"key",A.target.value)}),C.jsx(Zn,{value:g.value,placeholder:"Value",style:{flex:1,minWidth:200},onChange:A=>p(m,"value",A.target.value)})]})]},m))]})]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(vm,{style:{fontSize:12,color:l.colorTextSecondary},children:"Content"}),C.jsx(ra.Item,{name:"content",style:{marginBottom:0},children:C.jsx(vGe,{placeholder:"Content",autoSize:{minRows:4,maxRows:8}})})]}),C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,marginTop:8},children:[C.jsx(tn,{onClick:f,children:"Cancel"}),C.jsx(tn,{type:"primary",htmlType:"submit",loading:a,children:"Create Skill"})]})]})})})},xur=Sur,Eur=({onNodeClick:e})=>{const[t,n,r]=Lve([]),[a,i,o]=kve([]),[l,s]=b.useState(!1),[c,u]=b.useState([]),[d,f]=b.useState(!1),{token:p}=Zl.useToken(),{get:h}=kl(),g=b.useMemo(()=>({skill:_ur}),[]),m=async()=>{f(!0);try{const v=await h("/api/skills");v.success&&v.data&&Array.isArray(v.data.records)&&u(v.data.records)}catch(v){console.error("Failed to fetch skills:",v),u([])}finally{f(!1)}};b.useEffect(()=>{m()},[]),b.useEffect(()=>{if(!c||c.length===0){n([]),i([]);return}const v=[],y=[],_=320,x=300,S=new Map,E=[],w=new Map;if(c.forEach(N=>{S.set(N.name,N),N.subSkills&&N.subSkills.length>0&&(w.has(N.name)||w.set(N.name,[]),N.subSkills.forEach(R=>{c.find(O=>O.name===R)&&(E.push({source:N.name,target:R}),w.get(N.name).push(R))}))}),E.length>0){const N=new Set,R=new Map,L=new Map;E.forEach(D=>{L.set(D.target,D.source)});const O=[],M=c.filter(D=>!L.has(D.name));for(M.length===0&&c.length>0?O.push({id:c[0].name,level:0}):M.forEach(D=>{O.push({id:D.name,level:0})});O.length>0;){const{id:D,level:$}=O.shift();if(N.has(D))continue;N.add(D),R.set(D,$),(w.get(D)||[]).forEach(U=>{N.has(U)||O.push({id:U,level:$+1})})}c.forEach(D=>{R.has(D.name)||R.set(D.name,0)});const B=new Map;c.forEach(D=>{const $=R.get(D.name)||0;B.has($)||B.set($,[]),B.get($).push(D)}),B.forEach((D,$)=>{const P=$*x,j=-((D.length-1)*_)/2;D.forEach((G,F)=>{const H=j+F*_;v.push({id:G.name,type:"skill",data:{skill:G,onClick:()=>e==null?void 0:e(G),onDelete:m},position:{x:H,y:P}})})}),E.forEach(D=>{S.has(D.source)&&S.has(D.target)&&y.push({id:`e${D.source}-${D.target}`,source:D.source,target:D.target,style:{stroke:"#1677ff",strokeWidth:2},type:"smoothstep"})})}else{const N=Math.ceil(Math.sqrt(c.length));c.forEach((R,L)=>{const O=Math.floor(L/N),B=L%N*_-(N-1)*_/2,D=O*x;v.push({id:R.name,type:"skill",data:{skill:R,onClick:()=>e==null?void 0:e(R)},position:{x:B,y:D}})})}n(v),i(y)},[c,n,i,e]);const A=async()=>{await m()};return d?C.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"#fafafa"},children:"Loading skills..."}):C.jsxs("div",{style:{width:"100%",height:"100%",background:"#fafafa",position:"relative"},children:[C.jsxs(Mve,{nodes:t,edges:a,onNodesChange:r,onEdgesChange:o,nodeTypes:g,fitView:!0,children:[C.jsx(Dve,{color:"#eee",gap:20}),C.jsx(Bve,{})]}),C.jsx("div",{style:{position:"absolute",top:20,right:20,zIndex:10},children:C.jsx(tn,{type:"primary",size:"large",icon:C.jsx(j3,{}),onClick:()=>s(!0),style:{height:48,width:48,borderRadius:"50%",boxShadow:p.boxShadowTertiary,display:"flex",alignItems:"center",justifyContent:"center",padding:0}})}),C.jsx(xur,{open:l,onCancel:()=>s(!1),onSuccess:A})]})},wur=e=>C.jsx(J$,{children:C.jsx(Eur,{...e})}),Cur=wur,Tur=({onToolSelect:e,autoLoad:t=!0})=>{const{token:n}=Zl.useToken(),{get:r}=kl(),[a,i]=b.useState({tools:[],isLoading:!1,error:null}),[o,l]=b.useState(null),s=b.useCallback(async()=>{i(f=>({...f,isLoading:!0,error:null}));try{const f=await r("/api/tools");if(f.success&&f.data&&Array.isArray(f.data.records))i(p=>({...p,tools:f.data.records,isLoading:!1}));else throw new Error("Invalid response format")}catch(f){i(p=>({...p,tools:[],isLoading:!1,error:f instanceof Error?f:new Error(String(f))}))}},[r]),c=b.useCallback(f=>{l(f.id),e==null||e(f)},[e]),u=b.useCallback(()=>{s()},[s]);b.useEffect(()=>{t&&s()},[t,s]);const d={width:"100%",height:"100%",background:"transparent",borderRadius:n.borderRadius,padding:n.paddingSM};return a.error?C.jsx("div",{style:d,children:C.jsx(U0,{message:"Error Loading Tools",description:a.error.message,type:"error",showIcon:!0,action:C.jsx(tn,{size:"small",icon:C.jsx(Kb,{}),onClick:u,children:"Retry"})})}):C.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[C.jsx("div",{style:{position:"absolute",top:n.paddingSM,right:n.paddingSM,zIndex:1},children:C.jsx(tn,{type:"text",size:"small",icon:C.jsx(Kb,{}),onClick:u,title:"Refresh tools",style:{color:n.colorTextSecondary}})}),C.jsx("div",{style:{width:"100%",height:"100%",overflowY:"auto",overflowX:"hidden",paddingTop:n.paddingLG},children:C.jsx(Ha,{dataSource:a.tools,loading:a.isLoading,locale:{emptyText:C.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:n.marginSM,padding:n.paddingLG},children:[C.jsx("div",{style:{color:n.colorTextSecondary},children:"No tools available"}),C.jsx(tn,{icon:C.jsx(Kb,{}),onClick:u,type:"dashed",size:"small",children:"Refresh"})]})},style:{...d,paddingTop:0},renderItem:f=>C.jsx(Ha.Item,{onClick:()=>c(f),style:{cursor:"pointer",padding:n.paddingSM,borderRadius:n.borderRadius,backgroundColor:o===f.id?n.colorFillSecondary:"transparent",transition:"background-color 0.2s"},onMouseEnter:p=>{o!==f.id&&(p.currentTarget.style.backgroundColor=n.colorFillTertiary)},onMouseLeave:p=>{o!==f.id&&(p.currentTarget.style.backgroundColor="transparent")},children:C.jsx(Ha.Item.Meta,{avatar:C.jsx(z3,{size:"small",style:{backgroundColor:n.colorFillSecondary,color:n.colorText},children:f.name.charAt(0).toUpperCase()}),title:C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:n.marginXS},children:[C.jsx("span",{children:f.name}),f.needUserApprove&&C.jsx(Yr,{color:"warning",style:{fontSize:"10px",padding:"2px 6px",margin:0,lineHeight:"1.2"},children:"Requires approval"})]}),description:C.jsx("div",{style:{color:n.colorTextSecondary,fontSize:n.fontSizeSM,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.description})})},f.id)})})]})},Yte=50,Iur=Ni(({token:e,css:t})=>({container:t`
|
|
5161
|
+
`})),Wcr=({component_key:e,data:t})=>t!=null&&t.component?C.jsx(C.Fragment,{children:t.component}):C.jsxs("div",{children:[C.jsx("p",{children:"Component view not found"}),C.jsx("pre",{children:JSON.stringify({component_key:e,data:t},null,2)})]}),hGe=e=>C.jsx(bXe,{style:{fontSize:12,opacity:.6}}),qcr=()=>{const{styles:e}=Vcr(),{sideAppSelectedCard:t,closeSideApp:n}=Dl(),[r,a]=b.useState(JSON.stringify(t)),[i,o]=b.useState(null),[l,s]=b.useState([]),c=(h,g,m,A)=>{const v=[...l,{label:g,children:m,key:h,componentKey:A}];s(v),a(h)},u=h=>{let g=r;const m=l.findIndex(v=>v.key===h),A=l.filter(v=>v.key!==h);if(A.length===0){n();return}g===h&&(m>0?g=l[m-1].key:g=A[0].key),s(A),a(g)},d=h=>{a(h)};b.useEffect(()=>{var m,A;if(!t)return;const h=JSON.stringify(t);if(l.find(v=>v.key===h)){a(h),setTimeout(()=>{const v=document.querySelector(`[data-tab-key="${h}"]`);v==null||v.scrollIntoView({behavior:"smooth",inline:"center"})},100);return}const g=((m=rF(t==null?void 0:t.component_key))==null?void 0:m.side_app_view)||Wcr;c(h,(t==null?void 0:t.message)||((A=t==null?void 0:t.data)==null?void 0:A.message)||"Unnamed",C.jsx(g,{component_key:(t==null?void 0:t.component_key)||"",data:t==null?void 0:t.data,context:t==null?void 0:t.context}),t==null?void 0:t.component_key)},[t]);const f=l.find(h=>h.key===r),p=l.map(h=>({key:h.key,label:C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"4px 0"},children:[hGe(h.componentKey),C.jsx("span",{style:{flex:1},children:h.label}),C.jsx(Yb,{style:{fontSize:10,opacity:.5},onClick:g=>{g.stopPropagation(),u(h.key)}})]}),onClick:()=>d(h.key)}));return C.jsxs("div",{className:e.container,children:[C.jsxs("div",{className:e.header,children:[C.jsx("div",{className:e.tabsStrip,children:l.map(h=>C.jsx(Or,{title:h.label,placement:"bottom",children:C.jsxs("div",{"data-tab-key":h.key,className:`${e.tab} ${h.key===r?"active":""}`,onClick:()=>d(h.key),onMouseEnter:()=>o(h.key),onMouseLeave:()=>o(null),children:[hGe(h.componentKey),C.jsx("span",{className:e.tabLabel,children:h.label}),C.jsx("span",{className:`${e.closeIndicator} ${i===h.key||h.key===r?"always-visible":""}`,onClick:g=>{g.stopPropagation(),u(h.key)},children:C.jsx(Yb,{style:{fontSize:10}})})]})},h.key))}),C.jsxs("div",{className:e.actions,children:[l.length>0&&C.jsx("div",{className:e.tabCounter,children:l.length}),l.length>1&&C.jsx(T8,{menu:{items:p},placement:"bottomRight",trigger:["click"],children:C.jsx("button",{className:e.actionBtn,title:"All tabs",children:C.jsx(vfe,{})})}),C.jsx(Or,{title:"Close",children:C.jsx("button",{className:e.actionBtn,onClick:n,children:C.jsx(Yb,{})})})]})]}),C.jsx("div",{className:e.content,children:f?C.jsx("div",{className:e.contentWrapper,children:f.children},f.key):C.jsxs("div",{className:e.emptyState,children:[C.jsx(bXe,{className:"icon"}),C.jsx("span",{children:"Select an app to start"})]})})]})},Qcr=e=>{const{assistant_id:t,thread_id:n="",menu:r,header:a,...i}=e;return C.jsx(Uve,{assistantId:t,threadId:n,options:{streaming:!0,enableReturnStateWhenStreamCompleted:!0,enableResumeStream:!0},children:C.jsx(Xor,{children:C.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%"},children:[a,C.jsx(Zor,{menu:r,left:n?C.jsx(jve,{...i}):C.jsx("div",{children:"Please create a conversation first"}),right:C.jsx(qcr,{})})]})})})},{Text:Lo,Title:Ycr}=Ar,{TextArea:Kcr}=Zn,{useToken:I3t}=Zl,Xcr=()=>{var x;const{config:e}=Zo();I3t();const{get:t,post:n,del:r}=kl(),[a,i]=b.useState([]),[o,l]=b.useState(!1),[s,c]=b.useState(null),[u,d]=b.useState(!1),[f,p]=b.useState(null),h=((x=e.headers)==null?void 0:x["x-tenant-id"])||"default";b.useEffect(()=>{g()},[h]);const g=async()=>{l(!0);try{const S=await t("/api/metrics-configs");S.success?i(S.data.records):(hn.error(S.message||"Failed to load metrics configurations"),i([]))}catch(S){console.error("Failed to load metrics configs:",S),hn.error("Failed to load metrics configurations"),i([])}finally{l(!1)}},m=async S=>{var E,w;c(S.id);try{const I=await n(`/api/metrics-configs/${S.key}/test`,{});I.success&&((E=I.data)!=null&&E.connected)?hn.success(`Successfully connected to ${S.config.serverUrl} (${I.data.latency}ms)`):I.success&&((w=I.data)!=null&&w.error)?hn.error(`Connection failed: ${I.data.error}`):hn.error(I.message||"Failed to test connection")}catch(I){console.error("Test connection error:",I),hn.error("Failed to test connection")}finally{c(null)}},A=S=>{p(S),d(!0)},v=async S=>{if(!(S!=null&&S.id)){hn.error("Cannot delete: configuration id is missing");return}try{const E=await r(`/api/metrics-configs/${S.id}`);E.success?(i(w=>w.filter(I=>I.id!==S.id)),hn.success("Configuration deleted")):hn.error(E.message||"Failed to delete configuration")}catch(E){console.error("Failed to delete config:",E),hn.error("Failed to delete configuration")}},y=()=>{p(null),d(!0)},_=S=>{switch(S){case"prometheus":return"📊";case"grafana":return"📈";case"custom":return"🔧";case"semantic":return"🧠";default:return"📊"}};return C.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},children:[C.jsx("div",{style:{padding:16},children:C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[C.jsx(Ycr,{level:5,style:{margin:0},children:"Metrics Server Connections"}),C.jsx(tn,{type:"primary",icon:C.jsx(q2,{size:16}),onClick:y,children:"Add Connection"})]})}),C.jsx("div",{style:{flex:1,overflowY:"auto",padding:16},children:a.length===0?C.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"48px 16px"},children:[C.jsx(iB,{size:48,style:{marginBottom:16,opacity:.5}}),C.jsx(Lo,{strong:!0,style:{fontSize:15},children:"No metrics configurations"}),C.jsx(Lo,{type:"secondary",style:{marginTop:8},children:'Click "Add Connection" to create one'})]}):C.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:a.map(S=>C.jsxs(Ti,{size:"small",children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:10},children:[C.jsxs(Lo,{strong:!0,style:{fontSize:15,display:"flex",alignItems:"center",gap:8},children:[_(S.config.type),S.name||S.key]}),C.jsx(Yr,{color:"blue",children:S.config.type})]}),C.jsxs(Lo,{type:"secondary",style:{fontSize:12,marginBottom:10,fontFamily:"monospace",display:"block"},children:["Key: ",S.key||"undefined"," | ID: ",S.id]}),S.description&&C.jsx(Lo,{style:{fontSize:13,marginBottom:12,lineHeight:1.5,display:"block"},children:S.description}),C.jsxs("div",{style:{marginBottom:12},children:[C.jsx(Lo,{code:!0,style:{fontSize:12},children:S.config.serverUrl||"http://localhost:9090"}),S.config.timeout&&C.jsxs(Yr,{style:{fontSize:11,marginLeft:8},children:["Timeout: ",S.config.timeout,"ms"]})]}),C.jsxs("div",{style:{display:"flex",gap:8,paddingTop:12},children:[C.jsx(tn,{icon:s===S.id?C.jsx(ug,{size:14,className:"spin"}):C.jsx(Efe,{size:14}),onClick:E=>{E.stopPropagation(),m(S)},disabled:s===S.id||s!==null&&s!==S.id,loading:s===S.id,children:s===S.id?"Testing...":"Test"}),C.jsx(tn,{icon:C.jsx(Sfe,{size:14}),onClick:E=>{E.stopPropagation(),A(S)},children:"Edit"}),C.jsx(fw,{title:"Delete Metrics Configuration",description:`Are you sure you want to delete "${S.name||S.key}"?`,onConfirm:E=>{E==null||E.stopPropagation(),v(S)},onCancel:E=>{E==null||E.stopPropagation()},okText:"Delete",okType:"danger",cancelText:"Cancel",children:C.jsx(tn,{danger:!0,icon:C.jsx(sB,{size:14}),onClick:E=>E.stopPropagation(),children:"Delete"})})]})]},S.id))})}),u&&C.jsx(Zcr,{open:u,config:f,onCancel:()=>{d(!1),p(null)},onSave:S=>{g(),p(null),d(!1)}})]})},Zcr=({open:e,config:t,onCancel:n,onSave:r})=>{var P,U;const{config:a}=Zo();I3t();const{get:i,post:o,put:l}=kl();(P=a.headers)!=null&&P["x-tenant-id"];const[s,c]=b.useState(0),[u,d]=b.useState(!1),[f,p]=b.useState(!1),[h,g]=b.useState([]),[m,A]=b.useState(null),[v,y]=b.useState([]),[_,x]=b.useState(!1),[S,E]=b.useState({key:(t==null?void 0:t.key)||"",name:(t==null?void 0:t.name)||"",description:(t==null?void 0:t.description)||"",type:(t==null?void 0:t.config.type)||"semantic",serverUrl:(t==null?void 0:t.config.serverUrl)||"",apiKey:(t==null?void 0:t.config.apiKey)||"",username:(t==null?void 0:t.config.username)||"",password:(t==null?void 0:t.config.password)||"",timeout:(t==null?void 0:t.config.timeout)||3e4,selectedDataSources:((U=t==null?void 0:t.config)==null?void 0:U.selectedDataSources)||[]}),w=[{title:"Basic Info",icon:C.jsx(xfe,{size:16})},{title:"Select Data Sources",icon:C.jsx(j0,{size:16})}],I=()=>{var j;c(0),g([]),y([]),A(null),E({key:(t==null?void 0:t.key)||"",name:(t==null?void 0:t.name)||"",description:(t==null?void 0:t.description)||"",type:(t==null?void 0:t.config.type)||"semantic",serverUrl:(t==null?void 0:t.config.serverUrl)||"",apiKey:(t==null?void 0:t.config.apiKey)||"",username:(t==null?void 0:t.config.username)||"",password:(t==null?void 0:t.config.password)||"",timeout:(t==null?void 0:t.config.timeout)||3e4,selectedDataSources:((j=t==null?void 0:t.config)==null?void 0:j.selectedDataSources)||[]})};b.useEffect(()=>{e&&I()},[e,t]),b.useEffect(()=>{s===1&&h.length===0&&!f&&N()},[s]);const N=async()=>{var j;if(!S.serverUrl){hn.error("Please enter the server URL");return}p(!0);try{const G=await o("/api/metrics-configs/test-datasources",{serverUrl:S.serverUrl,apiKey:S.apiKey||void 0,username:S.username||void 0,password:S.password||void 0});if(G.success&&((j=G.data)!=null&&j.datasources)){if(g(G.data.datasources),G.data.datasources.length>0){const F=String(G.data.datasources[0].id);A(F),R(F)}}else hn.error(G.message||"Failed to fetch data sources")}catch(G){console.error("Failed to fetch datasources:",G),hn.error("Failed to fetch data sources")}finally{p(!1)}},R=async j=>{var G,F,H,q;if(!v.some(V=>String(V.datasourceId)===j)){x(!0);try{if(t){const V=await i(`/api/metrics-configs/${S.key}/datasources/${j}/meta`);V.success&&((F=(G=V.data)==null?void 0:G.index)!=null&&F.metrics)&&y(Y=>[...Y,{datasourceId:j,metrics:V.data.index.metrics}])}else{const V=await o(`/api/metrics-configs/test-datasources/${encodeURIComponent(j)}/meta`,{serverUrl:S.serverUrl,apiKey:S.apiKey,username:S.username,password:S.password});V.success&&((q=(H=V.data)==null?void 0:H.index)!=null&&q.metrics)&&y(Y=>[...Y,{datasourceId:j,metrics:V.data.index.metrics}])}}catch(V){console.error(`Failed to fetch metrics for datasource ${j}:`,V)}finally{x(!1)}}},L=async()=>{d(!0);try{const j={id:t==null?void 0:t.id,key:S.key,name:S.name,description:S.description,selectedDataSources:S.selectedDataSources,config:{type:S.type,serverUrl:S.serverUrl,apiKey:S.apiKey||void 0,username:S.username||void 0,password:S.password||void 0,timeout:S.timeout}};let G;t?G=await l(`/api/metrics-configs/${t.key}`,j):G=await o("/api/metrics-configs",j),G.success?(r(G.data),hn.success(t?"Configuration updated":"Configuration created")):hn.error(G.message||"Failed to save configuration")}catch(j){console.error("Failed to save config:",j),hn.error("Failed to save configuration")}finally{d(!1)}},O=j=>{const G=String(j);E(F=>F.selectedDataSources.includes(G)?{...F,selectedDataSources:F.selectedDataSources.filter(q=>q!==G)}:{...F,selectedDataSources:[...F.selectedDataSources,G]})},M=()=>{switch(s){case 0:return S.key&&S.name&&S.serverUrl;case 1:return!0;default:return!0}},B=()=>{switch(s){case 0:return C.jsxs(tr,{direction:"vertical",style:{width:"100%"},size:"large",children:[C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"Connection Key"}),C.jsx(Zn,{value:S.key,onChange:j=>E({...S,key:j.target.value}),placeholder:"e.g., semantic-demo",style:{width:"100%",marginTop:8},disabled:!!t})]}),C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"Name"}),C.jsx(Zn,{value:S.name,onChange:j=>E({...S,name:j.target.value}),placeholder:"e.g., Demo Semantic Server",style:{width:"100%",marginTop:8}})]}),C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"Description"}),C.jsx(Kcr,{value:S.description,onChange:j=>E({...S,description:j.target.value}),placeholder:"Optional description",rows:2,style:{width:"100%",marginTop:8}})]}),C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"Server Type"}),C.jsx(Vh,{value:S.type,onChange:j=>E({...S,type:j}),options:[{value:"semantic",label:"Semantic"}],style:{width:"100%",marginTop:8}})]}),C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"Server URL"}),C.jsx(Zn,{value:S.serverUrl,onChange:j=>E({...S,serverUrl:j.target.value}),placeholder:"e.g., https://api.example.com/metrics/api/v1/",style:{width:"100%",marginTop:8}})]}),C.jsx(Ti,{title:"Authentication",extra:C.jsx(Yr,{color:"success",children:"Optional"}),style:{marginTop:16},children:C.jsxs(tr,{direction:"vertical",style:{width:"100%"},size:"middle",children:[C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"API Key"}),C.jsx(Zn.Password,{value:S.apiKey,onChange:j=>E({...S,apiKey:j.target.value}),placeholder:"Optional API key for authentication",style:{width:"100%",marginTop:8}})]}),C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"Username"}),C.jsx(Zn,{value:S.username,onChange:j=>E({...S,username:j.target.value}),placeholder:"Optional username for basic auth",style:{width:"100%",marginTop:8}})]}),C.jsxs("div",{children:[C.jsx(Lo,{strong:!0,children:"Password"}),C.jsx(Zn.Password,{value:S.password,onChange:j=>E({...S,password:j.target.value}),placeholder:"Optional password for basic auth",style:{width:"100%",marginTop:8}})]})]})})]});case 1:return f?C.jsxs("div",{style:{textAlign:"center",padding:"60px 0"},children:[C.jsx(ul,{size:"large"}),C.jsx("div",{style:{marginTop:16},children:C.jsx(Lo,{children:"Fetching data sources..."})})]}):C.jsxs("div",{style:{display:"flex",gap:24,height:"550px"},children:[C.jsxs("div",{style:{width:"300px",minWidth:"280px",paddingRight:16,flexShrink:0},children:[C.jsxs("div",{style:{marginBottom:12},children:[C.jsx(Lo,{strong:!0,children:"Data Sources"}),C.jsx("div",{style:{marginTop:4},children:C.jsxs(Lo,{type:"secondary",style:{fontSize:12},children:["Selected: ",S.selectedDataSources.length]})})]}),C.jsx("div",{style:{overflowY:"auto",maxHeight:"420px"},children:h.map(j=>{const G=S.selectedDataSources.includes(String(j.id));return String(j.id),C.jsx(Ti,{size:"small",onClick:()=>{const F=String(j.id);A(F),R(F)},style:{marginBottom:8,cursor:"pointer"},bodyStyle:{padding:12},children:C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[C.jsx(Rc,{checked:G,onClick:F=>{F.stopPropagation(),O(j.id)}}),C.jsxs("div",{style:{flex:1,minWidth:0},children:[C.jsx(Lo,{strong:!0,style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:j.name}),j.schemaName&&C.jsx(Lo,{type:"secondary",style:{fontSize:11,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:j.schemaName})]}),j.connected&&C.jsx(Yr,{color:"success",style:{fontSize:10},children:"Connected"})]})},j.id)})})]}),C.jsx("div",{style:{flex:1,paddingLeft:16,overflow:"hidden"},children:m?(()=>{const j=v.find(F=>String(F.datasourceId)===m),G=h.find(F=>String(F.id)===m);return C.jsxs("div",{children:[C.jsxs("div",{style:{marginBottom:16,paddingBottom:12},children:[C.jsx(Lo,{strong:!0,style:{fontSize:16},children:G==null?void 0:G.name}),C.jsx("div",{style:{marginTop:4},children:C.jsxs(Lo,{type:"secondary",style:{fontSize:12},children:[(j==null?void 0:j.metrics.length)||0," metrics available"]})})]}),_&&!j?C.jsxs("div",{style:{textAlign:"center",padding:40},children:[C.jsx(ul,{}),C.jsx("div",{style:{marginTop:8},children:C.jsx(Lo,{children:"Loading metrics..."})})]}):j?C.jsx("div",{style:{overflowY:"auto",maxHeight:"400px"},children:j.metrics.map(F=>C.jsxs(Ti,{size:"small",style:{marginBottom:8},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[C.jsx(Lo,{strong:!0,children:F.displayName||F.metricName}),F.domain&&C.jsx(Yr,{children:F.domain})]}),F.shortDesc&&C.jsx(Lo,{type:"secondary",style:{fontSize:12,marginTop:4,display:"block"},children:F.shortDesc})]},F.metricName))}):C.jsx("div",{style:{textAlign:"center",padding:40},children:C.jsx(Lo,{type:"secondary",children:"Failed to load metrics"})})]})})():C.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:C.jsxs("div",{style:{textAlign:"center"},children:[C.jsx(j0,{size:48,style:{opacity:.3,marginBottom:16}}),C.jsx(Lo,{type:"secondary",children:"Click a data source on the left to view its metrics"})]})})})]});default:return null}},D=()=>{s===1?L():c(j=>j+1)},$=()=>{c(j=>j-1)};return C.jsx(ji,{title:t?"Edit Metrics Configuration":"Add Metrics Configuration",open:e,onCancel:n,width:900,style:{top:50},footer:null,children:C.jsxs("div",{children:[C.jsx(Yde,{current:s,items:w,style:{marginBottom:24}}),C.jsx("div",{style:{padding:"24px 0",minHeight:300},children:B()}),C.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12,paddingTop:16,marginTop:24},children:[C.jsx(tn,{onClick:n,children:"Cancel"}),s>0&&C.jsx(tn,{icon:C.jsx(bfe,{size:16}),onClick:$,children:"Previous"}),C.jsx(tn,{type:"primary",onClick:D,disabled:!M()||u||f||_,icon:s===1?u?C.jsx(ug,{size:16,className:"spin"}):C.jsx(oB,{size:16}):C.jsx(O4,{size:16}),children:s===1?u?"Saving...":t?"Save Changes":"Create":"Next"})]})]})})},{Text:I2}=Ar,Jcr=e=>{const t=["#1890ff","#52c41a","#faad14","#f5222d","#722ed1","#13c2c2","#eb2f96","#fa8c16"];let n=0;for(let r=0;r<e.length;r++)n=e.charCodeAt(r)+((n<<5)-n);return t[Math.abs(n)%t.length]},eur=({data:e,selected:t})=>{var g;const{token:n}=Zl.useToken();if(!e)return null;const{assistant:r,onConfigure:a,onChat:i}=e;if(!r)return null;const o=Jcr(r.id),l=((g=r.name)==null?void 0:g.split(" ").map(m=>m.charAt(0)).join("").toUpperCase().slice(0,2))||"A",{modelKey:s,tools:c,agentType:u,prompt:d,subAgents:f}=b.useMemo(()=>{if(!r.graphDefinition)return{modelKey:void 0,tools:[],agentType:void 0,prompt:void 0,subAgents:[]};try{const m=typeof r.graphDefinition=="string"?JSON.parse(r.graphDefinition):r.graphDefinition;return{modelKey:m.modelKey||m.model,tools:m.tools||[],agentType:m.type,prompt:m.prompt,subAgents:m.subAgents||[]}}catch{return{modelKey:void 0,tools:[],agentType:void 0,prompt:void 0,subAgents:[]}}},[r.graphDefinition]),p=m=>m?{react:"Executor",deep_agent:"Orchestrator",plan_execute:"PLAN EXECUTE",sequential:"SEQUENTIAL"}[m]||m.toUpperCase():"",h=C.jsxs("div",{style:{maxWidth:400,maxHeight:"60vh",overflowY:"auto"},children:[C.jsx("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:12},children:C.jsxs("div",{style:{flex:1},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(I2,{strong:!0,style:{fontSize:16,fontWeight:600,color:n.colorText},children:r.name}),u&&C.jsx(Yr,{color:"purple",style:{margin:0,fontSize:10,padding:"2px 8px",fontWeight:600},children:p(u)})]}),C.jsx("div",{style:{display:"flex",alignItems:"center",gap:6},children:C.jsx(I2,{style:{fontSize:11,color:n.colorTextTertiary,fontFamily:"monospace"},children:`>_ ${r.id}`})})]})}),r.description&&C.jsx("div",{style:{marginBottom:12},children:C.jsxs(I2,{style:{fontSize:12,color:n.colorText,lineHeight:1.6,fontStyle:"italic"},children:['"',r.description,'"']})}),s&&C.jsxs("div",{style:{marginBottom:12},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(bie,{style:{fontSize:14,color:n.colorTextSecondary}}),C.jsx(I2,{style:{fontSize:12,color:n.colorTextSecondary,fontWeight:500},children:"Model Engine"})]}),C.jsx(Yr,{color:"blue",style:{fontSize:11,padding:"4px 12px"},children:s})]}),d&&C.jsxs("div",{style:{marginBottom:12},children:[C.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8,justifyContent:"space-between"},children:C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[C.jsx(ff,{style:{fontSize:14,color:n.colorTextSecondary}}),C.jsx(I2,{style:{fontSize:12,color:n.colorTextSecondary,fontWeight:600,letterSpacing:.5},children:"SYSTEM PROMPT"})]})}),C.jsx("div",{style:{padding:12,background:n.colorFillTertiary,border:`1px solid ${n.colorBorderSecondary}`,borderRadius:4,maxHeight:150,overflowY:"auto"},children:C.jsx(I2,{style:{fontSize:11,color:n.colorText,lineHeight:1.6,whiteSpace:"pre-wrap"},children:d.length>300?d.slice(0,300)+"...":d})})]}),c&&c.length>0&&C.jsxs("div",{style:{marginBottom:12},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(gw,{style:{fontSize:14,color:n.colorTextSecondary}}),C.jsxs(I2,{style:{fontSize:12,color:n.colorTextSecondary,fontWeight:500},children:["Available Tools (",c.length,")"]})]}),C.jsxs(tr,{size:[8,8],wrap:!0,children:[c.slice(0,5).map((m,A)=>C.jsx(Yr,{color:"blue",style:{fontSize:11,padding:"4px 12px"},children:m.replace(/_/g," ")},A)),c.length>5&&C.jsxs(Yr,{style:{fontSize:11,padding:"4px 12px",backgroundColor:n.colorFillTertiary,color:n.colorTextSecondary},children:["+",c.length-5," more"]})]})]}),f&&f.length>0&&C.jsxs("div",{style:{marginBottom:8},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(Ure,{style:{fontSize:14,color:n.colorTextSecondary}}),C.jsxs(I2,{style:{fontSize:12,color:n.colorTextSecondary,fontWeight:500},children:["Sub-Agent Architecture (",f.length,")"]})]}),C.jsxs(tr,{size:[8,8],wrap:!0,children:[f.slice(0,3).map((m,A)=>C.jsx(Yr,{style:{fontSize:11,padding:"4px 12px",backgroundColor:n.colorFillTertiary,color:n.colorText,border:`1px solid ${n.colorBorderSecondary}`},children:`> ${m}`},A)),f.length>3&&C.jsxs(Yr,{style:{fontSize:11,padding:"4px 12px",backgroundColor:n.colorFillTertiary,color:n.colorTextSecondary},children:["+",f.length-3," more"]})]})]})]});return C.jsxs("div",{style:{padding:4},children:[C.jsx(P3,{type:"target",position:Br.Top}),C.jsxs("div",{style:{width:260,minHeight:180,background:n.colorBgContainer,borderRadius:8,boxShadow:"0 1px 4px rgba(0, 0, 0, 0.08)",overflow:"hidden",transition:"all 0.2s ease",position:"relative",border:t?`2px solid ${n.colorPrimary}`:`1px solid ${n.colorBorder}`,display:"flex",flexDirection:"column"},onMouseEnter:m=>{m.currentTarget.style.transform="translateY(-2px)",m.currentTarget.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.12)"},onMouseLeave:m=>{m.currentTarget.style.transform="translateY(0)",m.currentTarget.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.08)"},children:[C.jsxs("div",{style:{padding:12,display:"flex",flexDirection:"column",gap:10,flex:1},children:[C.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[C.jsx(Or,{title:h,placement:"rightTop",mouseEnterDelay:.5,overlayStyle:{maxWidth:"none"},color:n.colorBgContainer,children:C.jsxs("div",{style:{position:"relative",flexShrink:0,cursor:"pointer"},children:[C.jsx(z3,{size:44,icon:C.jsx(aB,{}),style:{backgroundColor:o,color:"#fff",fontSize:16,fontWeight:600},children:l}),C.jsx("div",{style:{position:"absolute",bottom:0,right:0,width:10,height:10,borderRadius:"50%",background:"#52c41a",border:`2px solid ${n.colorBgContainer}`}})]})}),C.jsxs("div",{style:{flex:1,minWidth:0,paddingRight:32},children:[C.jsx(I2,{strong:!0,style:{fontSize:14,fontWeight:600,display:"block",marginBottom:3,color:n.colorText,lineHeight:1.3},ellipsis:{tooltip:r.name},children:r.name}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[C.jsx(eHt,{style:{fontSize:9,color:n.colorTextTertiary}}),C.jsx(I2,{style:{fontSize:9,color:n.colorTextTertiary},ellipsis:{tooltip:r.id},children:r.id})]})]})]}),r.description&&C.jsx("div",{style:{padding:8,background:n.colorFillTertiary,border:`1px solid ${n.colorBorderSecondary}`,borderRadius:4,borderLeft:`2px solid ${o}`},children:C.jsx(Or,{title:r.description.length>150?r.description:void 0,placement:"top",children:C.jsxs("div",{style:{fontSize:10,color:n.colorText,lineHeight:1.5,fontStyle:"italic",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",cursor:r.description.length>150?"help":"default"},children:['"',r.description,'"']})})}),C.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,padding:"4px 0",marginTop:"auto",alignItems:"center",justifyContent:"space-between"},children:[C.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[u&&C.jsx(Yr,{style:{margin:0,fontSize:7,padding:"2px 6px",borderRadius:6,backgroundColor:n.colorPrimaryBg,color:n.colorPrimary,border:`1px solid ${n.colorPrimaryBorder}`,fontWeight:500,lineHeight:"14px"},children:p(u)}),c&&c.length>0&&C.jsxs(Yr,{style:{margin:0,fontSize:7,padding:"2px 6px",borderRadius:6,backgroundColor:n.colorSuccessBg,color:n.colorSuccess,border:`1px solid ${n.colorSuccessBorder}`,fontWeight:500,lineHeight:"14px"},children:[c.length," Tools"]}),s&&C.jsx(Yr,{style:{margin:0,fontSize:7,padding:"2px 6px",borderRadius:6,backgroundColor:n.colorWarningBg,color:n.colorWarning,border:`1px solid ${n.colorWarningBorder}`,fontWeight:500,lineHeight:"14px"},title:s,children:s.length>12?`${s.slice(0,12)}...`:s})]}),i&&C.jsxs("div",{onMouseDown:m=>{m.stopPropagation()},onClick:m=>{m.stopPropagation(),i(r)},style:{display:"flex",alignItems:"center",gap:2,padding:"2px 6px",borderRadius:4,backgroundColor:n.colorPrimary,color:"#fff",cursor:"pointer",fontSize:10,fontWeight:500,transition:"all 0.2s ease"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=n.colorPrimaryHover},onMouseLeave:m=>{m.currentTarget.style.backgroundColor=n.colorPrimary},children:[C.jsx(RHt,{style:{fontSize:10}}),C.jsx("span",{children:"Chat"})]})]})]}),C.jsx(P3,{type:"source",position:Br.Bottom})]})]})},tur=eur,{TextArea:nur}=Zn,{Text:Do,Title:Qdr}=Ar,Qte=({title:e,icon:t,badge:n,children:r,defaultExpanded:a=!0})=>{const{token:i}=Zl.useToken(),[o,l]=b.useState(a);return C.jsxs(Ti,{size:"small",style:{marginBottom:16,border:`1px solid ${i.colorBorderSecondary}`,backgroundColor:`${i.colorBgContainer}d0`,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},bodyStyle:{padding:0},children:[C.jsxs("div",{onClick:()=>l(!o),style:{padding:"10px 14px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:o?`1px solid ${i.colorBorderSecondary}`:"none",backgroundColor:`${i.colorFillQuaternary}d0`},children:[C.jsxs(tr,{size:"small",children:[t,C.jsx(Do,{strong:!0,style:{fontSize:14},children:e}),n!==void 0&&n>0&&C.jsx(nw,{count:n,style:{backgroundColor:i.colorPrimary}})]}),C.jsx("div",{style:{transform:o?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:C.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{color:i.colorTextSecondary},children:C.jsx("path",{d:"M6 8L1 3h10L6 8z",fill:"currentColor"})})})]}),o&&C.jsx("div",{style:{padding:16},children:r})]})},rur=(e,t,n,r,a)=>{var o;const i=C.jsxs("span",{children:[t.title||e,t.description&&C.jsxs(C.Fragment,{children:[" ",C.jsx(Or,{title:t.description,children:C.jsx(YHt,{style:{color:a.colorTextSecondary,cursor:"pointer"}})})]})]});if(t.widget==="segmented"||t.enum&&!t.widget){const l=((o=t.enum)==null?void 0:o.map(s=>({value:s,label:{global:"Global",agent:"Per Agent",thread:"Per Thread"}[s]||s})))||[];return C.jsx(ra.Item,{label:i,style:{marginBottom:0},children:C.jsx(Ax,{size:"small",value:n,onChange:r,options:l,block:!0})},e)}return t.widget==="switch"?C.jsx(ra.Item,{label:i,style:{marginBottom:8},children:C.jsx(pw,{checked:n,onChange:r})},e):t.widget==="numberInput"||t.type==="number"||t.type==="integer"?C.jsx(ra.Item,{label:i,style:{marginBottom:8},children:C.jsx(Zn,{size:"small",type:"number",value:n,onChange:l=>r(parseFloat(l.target.value)||t.default),min:t.minimum,max:t.maximum,style:{width:"100%"}})},e):t.widget==="textarea"?C.jsx(ra.Item,{label:i,style:{marginBottom:8},children:C.jsx(Zn.TextArea,{size:"small",value:n,onChange:l=>r(l.target.value),placeholder:t.default,autoSize:{minRows:2,maxRows:4}})},e):t.widget==="skillSelect"?C.jsx(iur,{propertyKey:e,label:i,value:n,onChange:r,token:a}):t.widget==="databaseSelect"?C.jsx(our,{propertyKey:e,label:i,value:n,onChange:r,token:a}):t.widget==="metricsSelect"?C.jsx(lur,{propertyKey:e,label:i,value:n,onChange:r,token:a}):C.jsx(ra.Item,{label:i,style:{marginBottom:8},children:C.jsx(Zn,{size:"small",value:n,onChange:l=>r(l.target.value),placeholder:t.default})},e)},aur=(e,t)=>t==null?void 0:t.find(n=>n.type===e),iur=({propertyKey:e,label:t,value:n,onChange:r,token:a})=>{const[i,o]=b.useState([]),[l,s]=b.useState(!1),{get:c}=kl(),u=b.useRef(!1);b.useEffect(()=>{if(u.current)return;u.current=!0,(async()=>{s(!0);try{const h=await c("/api/skills");h.success&&h.data&&Array.isArray(h.data.records)&&o(h.data.records)}catch(h){console.error("Failed to fetch skills:",h)}finally{s(!1)}})()},[c]);const d=Array.isArray(n)?n:[],f=p=>C.jsx(Ha.Item,{style:{padding:"8px 0",cursor:"pointer",borderRadius:a.borderRadius,backgroundColor:d.includes(p.id)?a.colorSuccessBg:"transparent",border:`1px solid ${d.includes(p.id)?a.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.2s ease",paddingLeft:8,paddingRight:8},onClick:()=>{const h=d.includes(p.id)?d.filter(g=>g!==p.id):[...d,p.id];r(h)},children:C.jsx(Ha.Item.Meta,{avatar:C.jsx(Rc,{checked:d.includes(p.id),onChange:()=>{const h=d.includes(p.id)?d.filter(g=>g!==p.id):[...d,p.id];r(h)},onClick:h=>h.stopPropagation()}),title:C.jsx(Do,{strong:d.includes(p.id),children:p.name}),description:C.jsx(Do,{type:"secondary",style:{fontSize:12},children:p.description})})},p.id);return C.jsx("div",{children:C.jsxs(ra.Item,{label:t,style:{marginBottom:8},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[C.jsxs(Do,{type:"secondary",style:{fontSize:12},children:[d.length," of ",i.length," selected"]}),C.jsx(tn,{type:"link",size:"small",onClick:()=>r(d.length===i.length?[]:i.map(p=>p.id)),children:d.length===i.length?"Deselect All":"Select All"})]}),l?C.jsx("div",{style:{textAlign:"center",padding:20},children:C.jsx(ul,{size:"small"})}):i.length===0?C.jsx(ai,{description:"No skills available",image:ai.PRESENTED_IMAGE_SIMPLE}):C.jsx(Ha,{dataSource:i,renderItem:f,style:{maxHeight:"40vh",overflowY:"auto"},split:!1})]},e)})},our=({propertyKey:e,label:t,value:n,onChange:r,token:a})=>{const[i,o]=b.useState([]),[l,s]=b.useState(!1),{get:c}=kl(),u=b.useRef(!1);b.useEffect(()=>{if(u.current)return;u.current=!0,(async()=>{s(!0);try{const h=await c("/api/database-configs");h.success&&h.data&&Array.isArray(h.data.records)&&o(h.data.records)}catch(h){console.error("Failed to fetch database configs:",h)}finally{s(!1)}})()},[c]);const d=Array.isArray(n)?n:[],f=p=>{const h=p.name||p.key,g=d.includes(p.key);return C.jsx(Ha.Item,{style:{padding:"8px 0",cursor:"pointer",borderRadius:a.borderRadius,backgroundColor:g?a.colorSuccessBg:"transparent",border:`1px solid ${g?a.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.2s ease",paddingLeft:8,paddingRight:8},onClick:()=>{const m=g?d.filter(A=>A!==p.key):[...d,p.key];r(m)},children:C.jsx(Ha.Item.Meta,{avatar:C.jsx(Rc,{checked:g,onChange:()=>{const m=g?d.filter(A=>A!==p.key):[...d,p.key];r(m)},onClick:m=>m.stopPropagation()}),title:C.jsx(Do,{strong:g,children:h}),description:p.description&&C.jsx(Do,{type:"secondary",style:{fontSize:12},children:p.description})})},p.key)};return C.jsx("div",{children:C.jsxs(ra.Item,{label:t,style:{marginBottom:8},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[C.jsxs(Do,{type:"secondary",style:{fontSize:12},children:[d.length," of ",i.length," selected"]}),C.jsx(tn,{type:"link",size:"small",onClick:()=>r(d.length===i.length?[]:i.map(p=>p.key)),children:d.length===i.length?"Deselect All":"Select All"})]}),l?C.jsx("div",{style:{textAlign:"center",padding:20},children:C.jsx(ul,{size:"small"})}):i.length===0?C.jsx(ai,{description:"No databases available",image:ai.PRESENTED_IMAGE_SIMPLE}):C.jsx(Ha,{dataSource:i,renderItem:f,style:{maxHeight:"40vh",overflowY:"auto"},split:!1})]},e)})},lur=({propertyKey:e,label:t,value:n,onChange:r,token:a})=>{const[i,o]=b.useState([]),[l,s]=b.useState(!1),{get:c}=kl(),u=b.useRef(!1);b.useEffect(()=>{if(u.current)return;u.current=!0,(async()=>{s(!0);try{const h=await c("/api/metrics-configs");h.success&&h.data&&Array.isArray(h.data.records)&&o(h.data.records)}catch(h){console.error("Failed to fetch metrics configs:",h)}finally{s(!1)}})()},[c]);const d=Array.isArray(n)?n:[],f=p=>{const h=p.name||p.key,g=d.includes(p.key);return C.jsx(Ha.Item,{style:{padding:"8px 0",cursor:"pointer",borderRadius:a.borderRadius,backgroundColor:g?a.colorSuccessBg:"transparent",border:`1px solid ${g?a.colorSuccess:"transparent"}`,marginBottom:4,transition:"all 0.2s ease",paddingLeft:8,paddingRight:8},onClick:()=>{const m=g?d.filter(A=>A!==p.key):[...d,p.key];r(m)},children:C.jsx(Ha.Item.Meta,{avatar:C.jsx(Rc,{checked:g,onChange:()=>{const m=g?d.filter(A=>A!==p.key):[...d,p.key];r(m)},onClick:m=>m.stopPropagation()}),title:C.jsx(Do,{strong:g,children:h}),description:p.description&&C.jsx(Do,{type:"secondary",style:{fontSize:12},children:p.description})})},p.key)};return C.jsx("div",{children:C.jsxs(ra.Item,{label:t,style:{marginBottom:8},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[C.jsxs(Do,{type:"secondary",style:{fontSize:12},children:[d.length," of ",i.length," selected"]}),C.jsx(tn,{type:"link",size:"small",onClick:()=>r(d.length===i.length?[]:i.map(p=>p.key)),children:d.length===i.length?"Deselect All":"Select All"})]}),l?C.jsx("div",{style:{textAlign:"center",padding:20},children:C.jsx(ul,{size:"small"})}):i.length===0?C.jsx(ai,{description:"No metrics servers available",image:ai.PRESENTED_IMAGE_SIMPLE}):C.jsx(Ha,{dataSource:i,renderItem:f,style:{maxHeight:"40vh",overflowY:"auto"},split:!1})]},e)})},sur=({middleware:e,middlewareType:t,onToggle:n,onConfigChange:r,token:a})=>{const[i,o]=b.useState(e.enabled),l=()=>{switch(e.type){case"browser":return C.jsx(NXe,{style:{color:a.colorPrimary}});case"sql":return C.jsx(dfe,{style:{color:a.colorWarning}});case"skill":return C.jsx(vjt,{style:{color:a.colorSuccess}});case"filesystem":return C.jsx(IXe,{style:{color:a.colorInfo}});case"code_eval":return C.jsx(ff,{style:{color:a.colorError}});case"metrics":return C.jsx(iB,{size:16,style:{color:a.colorWarning}});default:return C.jsx(Sx,{style:{color:a.colorWarning}})}},s=()=>{if(e.type==="browser")return C.jsxs("div",{style:{marginTop:12,paddingTop:12,borderTop:`1px solid ${a.colorBorderSecondary}`},children:[C.jsx(Do,{strong:!0,style:{fontSize:12,display:"block",marginBottom:8},children:"Provided Tools"}),C.jsx(tr,{size:4,wrap:!0,children:["Navigate","Click","Fill","Get Text","Markdown","Screenshot","Scroll","Evaluate"].map(u=>C.jsx(Yr,{color:"green",style:{fontSize:10,margin:0},children:u},u))})]});if(e.type==="sql"||e.type==="skill"){const u=(t==null?void 0:t.tools)||[];return C.jsxs("div",{style:{marginTop:12,paddingTop:12,borderTop:`1px solid ${a.colorBorderSecondary}`},children:[C.jsx(Do,{strong:!0,style:{fontSize:12,display:"block",marginBottom:8},children:"Provided Tools"}),C.jsx(tr,{size:4,wrap:!0,children:u.map(d=>C.jsx(Yr,{color:e.type==="sql"?"orange":"blue",style:{fontSize:10,margin:0},children:d.name},d.id))})]})}return null},c=()=>{var f;if(!((f=t==null?void 0:t.schema)!=null&&f.properties))return null;const u=t.schema.properties,d=Object.keys(u);return C.jsx("div",{style:{marginTop:8},children:d.map(p=>{const h=u[p];return p==="skills"&&e.config.readAll===!0||p==="serverKeys"&&e.config.connectAll===!0?null:rur(p,h,e.config[p]??h.default,g=>r({[p]:g}),a)})})};return C.jsxs(Ti,{size:"small",style:{marginBottom:16,border:`1px solid ${e.enabled?a.colorPrimary:a.colorBorderSecondary}`,backgroundColor:`${a.colorBgContainer}d0`,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",opacity:e.enabled?1:.7},bodyStyle:{padding:0},children:[C.jsxs("div",{style:{padding:"10px 14px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:i?`1px solid ${a.colorBorderSecondary}`:"none",backgroundColor:`${a.colorFillQuaternary}d0`},onClick:()=>e.enabled&&o(!i),children:[C.jsxs(tr,{size:"small",children:[l(),C.jsx(Do,{strong:!0,style:{fontSize:14},children:e.name})]}),C.jsxs(tr,{size:"small",onClick:u=>u.stopPropagation(),children:[C.jsx(pw,{checked:e.enabled,onChange:u=>{n(),u&&o(!0)},size:"small"}),C.jsx("div",{style:{transform:i?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s",opacity:e.enabled?1:.3},children:C.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{color:a.colorTextSecondary},children:C.jsx("path",{d:"M6 8L1 3h10L6 8z",fill:"currentColor"})})})]})]}),e.enabled&&i&&C.jsxs("div",{style:{padding:16},children:[C.jsx(Do,{type:"secondary",style:{fontSize:11,display:"block",marginBottom:12},children:e.description}),c(),s()]})]})},cur=({assistant:e,allAssistants:t,visible:n,onClose:r,onSave:a,onDelete:i})=>{const[o]=ra.useForm(),{token:l}=Zl.useToken(),{config:s}=Zo(),{get:c}=kl(),[u,d]=b.useState(!1),[f,p]=b.useState(!1),[h,g]=b.useState(!1),[m,A]=b.useState(!1),[v,y]=b.useState([]),[_,x]=b.useState([]),[S,E]=b.useState([]),[w,I]=b.useState(""),[N,R]=b.useState(!1),[L,O]=b.useState("react"),[M,B]=b.useState([]),D=b.useMemo(()=>{if(!(e!=null&&e.graphDefinition))return null;try{const Q=typeof e.graphDefinition=="string"?JSON.parse(e.graphDefinition):e.graphDefinition;return{tools:Q.tools||[],prompt:Q.prompt||"",subAgents:Q.subAgents||[],type:Q.type||"react",middleware:Q.middleware||[]}}catch{return null}},[e]),$=b.useCallback(Q=>(Q||[]).map((re,te)=>({id:`${re.type}-${te+1}`,type:re.type,name:re.name,description:re.description,enabled:!1,config:{}})),[]),P=b.useCallback((Q,X)=>{const re=X||[],te=new Map((Q==null?void 0:Q.map(ne=>[ne.type,ne]))||[]);return re.map((ne,oe)=>{const de=te.get(ne.type);return de?{...de,name:ne.name,description:ne.description}:{id:`${ne.type}-${oe+1}`,type:ne.type,name:ne.name,description:ne.description,enabled:!1,config:{}}})},[]),U=b.useCallback(async()=>{var Q;if(n){d(!0);try{const X=await c("/api/tools");X.success&&((Q=X.data)!=null&&Q.records)&&y(X.data.records)}catch(X){console.error("Failed to fetch tools:",X)}finally{d(!1)}}},[c,n]);b.useEffect(()=>{if(n&&e)if(U(),D){x(D.tools),E(D.subAgents),I(D.prompt),O(D.type);const Q=D.middleware;B(Q!==void 0?P(Q,s.availableMiddlewareTypes||[]):$(s.availableMiddlewareTypes||[])),o.setFieldsValue({name:e.name,description:e.description,prompt:D.prompt,type:D.type})}else x([]),E([]),I(""),O("react"),B($(s.availableMiddlewareTypes||[])),o.resetFields()},[n,e,D,o,U,$,s.availableMiddlewareTypes]);const j=Q=>{x(X=>X.includes(Q)?X.filter(re=>re!==Q):[...X,Q])},G=Q=>{E(X=>X.includes(Q)?X.filter(re=>re!==Q):[...X,Q])},F=async()=>{if(e)try{p(!0);const X={...await o.validateFields(),type:L,tools:_,subAgents:S,prompt:w,middleware:M};await(a==null?void 0:a(e,X))}catch(Q){throw Q instanceof Error&&hn.error(Q.message),Q}finally{p(!1)}},H=async()=>{if(e){g(!0);try{await(i==null?void 0:i(e)),A(!1),r()}catch(Q){A(!1),hn.error(Q instanceof Error?Q.message:"Failed to delete assistant")}finally{g(!1)}}},q=Q=>{B(X=>X.map(re=>{var te;if(re.id!==Q)return re;if(re.enabled)return{...re,enabled:!1};{const ne=(te=s.availableMiddlewareTypes)==null?void 0:te.find(oe=>oe.type===re.type);return{...re,enabled:!0,config:(ne==null?void 0:ne.defaultConfig)||{}}}}))},V=(Q,X)=>{B(re=>re.map(te=>te.id===Q?{...te,config:{...te.config,...X}}:te))},Y=Q=>C.jsx(Ha.Item,{style:{padding:"8px 0",cursor:"pointer",borderRadius:l.borderRadius,backgroundColor:_.includes(Q.id)?l.colorPrimaryBg:"transparent",border:`1px solid ${_.includes(Q.id)?l.colorPrimary:"transparent"}`,marginBottom:4,transition:"all 0.2s ease",paddingLeft:8,paddingRight:8},onClick:()=>j(Q.id),children:C.jsx(Ha.Item.Meta,{avatar:C.jsx(Rc,{checked:_.includes(Q.id),onChange:()=>j(Q.id),onClick:X=>X.stopPropagation()}),title:C.jsxs(tr,{size:"small",children:[C.jsx(Do,{strong:_.includes(Q.id),children:Q.name}),Q.needUserApprove&&C.jsx(Yr,{color:"warning",style:{fontSize:10,padding:"0 4px",margin:0},children:"Approve"})]}),description:C.jsx(Do,{type:"secondary",style:{fontSize:12},children:Q.description})})},Q.id),K=Q=>{var X;return C.jsx(Ha.Item,{style:{padding:"8px 0",cursor:"pointer",borderRadius:l.borderRadius,backgroundColor:S.includes(Q.id)?l.colorInfoBg:"transparent",border:`1px solid ${S.includes(Q.id)?l.colorInfo:"transparent"}`,marginBottom:4,transition:"all 0.2s ease",paddingLeft:8,paddingRight:8},onClick:()=>G(Q.id),children:C.jsx(Ha.Item.Meta,{avatar:C.jsx(Rc,{checked:S.includes(Q.id),onChange:()=>G(Q.id),onClick:re=>re.stopPropagation()}),title:C.jsxs(tr,{size:"small",children:[C.jsx(z3,{size:"small",style:{backgroundColor:l.colorSuccess,fontSize:12},children:((X=Q.name)==null?void 0:X.charAt(0).toUpperCase())||"A"}),C.jsx(Do,{strong:S.includes(Q.id),children:Q.name})]}),description:C.jsx(Do,{type:"secondary",style:{fontSize:12},children:Q.description||"No description"})})},Q.id)};return!n||!e?null:C.jsxs("div",{style:{width:380,height:"100%",backgroundColor:`${l.colorBgContainer}f0`,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",borderLeft:`1px solid ${l.colorBorderSecondary}`,display:"flex",flexDirection:"column",boxShadow:"-2px 0 8px rgba(0, 0, 0, 0.05)"},children:[C.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${l.colorBorderSecondary}`,display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:`${l.colorFillQuaternary}e0`,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[C.jsxs(tr,{size:"small",children:[C.jsx(bie,{style:{color:l.colorPrimary,fontSize:16}}),C.jsx(Do,{strong:!0,style:{fontSize:14},children:e.name}),C.jsx(Yr,{color:"blue",style:{margin:0,fontSize:10},children:"Config"})]}),C.jsxs(tr,{children:[i&&C.jsx(Or,{title:"Delete Assistant",children:C.jsx(tn,{type:"text",size:"small",danger:!0,icon:C.jsx(gUt,{}),onClick:()=>A(!0)})}),C.jsx(tn,{type:"text",size:"small",icon:C.jsx(Yb,{}),onClick:r})]})]}),C.jsx("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:C.jsxs(ra,{form:o,layout:"vertical",autoComplete:"off",children:[C.jsxs(Qte,{title:"Basic Settings",icon:C.jsx(bie,{style:{color:l.colorPrimary}}),defaultExpanded:!0,children:[C.jsx(ra.Item,{name:"name",label:"Name",rules:[{required:!0,message:"Please enter agent name"}],style:{marginBottom:8},children:C.jsx(Zn,{placeholder:"Enter agent name..."})}),C.jsx(ra.Item,{name:"description",label:"Description",rules:[{required:!0,message:"Please enter agent description"}],style:{marginBottom:8},children:C.jsx(Zn.TextArea,{placeholder:"Enter agent description...",autoSize:{minRows:2,maxRows:4}})}),C.jsxs(ra.Item,{name:"type",label:"Agent Type",rules:[{required:!0}],style:{marginBottom:8},children:[C.jsx(Ax,{value:L,onChange:Q=>O(Q),options:[{value:"react",label:"Executor"},{value:"deep_agent",label:"Orchestrator"},{value:"team",label:"Team"}],block:!0}),C.jsx(Do,{type:"secondary",style:{fontSize:11,marginTop:6,display:"block",lineHeight:1.4},children:L==="react"?"Executor: Directly executes tasks using tools. Best for single-step operations like search, code execution, and data retrieval.":L==="deep_agent"?"Orchestrator: Manages a sequential todo list to plan and assign todo items to sub-agents. Best for structured multi-step workflows.":"Team: Creates tasks with dependencies and dynamically spawns teammates. Like a swarm, teammates communicate via mailbox. Best for tasks requiring exploration and divergent thinking."})]}),C.jsxs(ra.Item,{label:C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[C.jsx("span",{children:"System Prompt"}),C.jsxs("div",{onClick:()=>R(!0),style:{cursor:"pointer",padding:"2px 8px",borderRadius:4,fontSize:11,color:l.colorPrimary,background:l.colorPrimaryBg,border:`1px solid ${l.colorPrimaryBorder}`,display:"flex",alignItems:"center",gap:4},children:[C.jsx(UUt,{style:{fontSize:10}}),C.jsx("span",{children:"Expand"})]})]}),children:[C.jsx(nur,{value:w,onChange:Q=>I(Q.target.value),placeholder:"Enter the system prompt for this agent...",autoSize:{minRows:4,maxRows:8},style:{fontFamily:"monospace",fontSize:13,lineHeight:1.6}}),C.jsx(Do,{type:"secondary",style:{fontSize:12,marginTop:4,display:"block"},children:"Define the agent's behavior, capabilities, and constraints"})]})]}),M.map(Q=>C.jsx(sur,{middleware:Q,middlewareType:aur(Q.type,s.availableMiddlewareTypes),onToggle:()=>q(Q.id),onConfigChange:X=>V(Q.id,X),token:l},Q.id)),C.jsx(Qte,{title:"Common Tools",icon:C.jsx(gw,{style:{color:l.colorPrimary}}),badge:_.length,defaultExpanded:!1,children:u?C.jsx("div",{style:{textAlign:"center",padding:20},children:C.jsx(ul,{size:"small"})}):v.length===0?C.jsx(ai,{description:"No tools available",image:ai.PRESENTED_IMAGE_SIMPLE}):C.jsxs(C.Fragment,{children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[C.jsxs(Do,{type:"secondary",style:{fontSize:12},children:[_.length," of ",v.length," selected"]}),C.jsx(tn,{type:"link",size:"small",onClick:()=>x(_.length===v.length?[]:v.map(Q=>Q.id)),children:_.length===v.length?"Deselect All":"Select All"})]}),C.jsx(Ha,{dataSource:v,renderItem:Y,style:{maxHeight:"40vh",overflowY:"auto"},split:!1})]})}),C.jsx(Qte,{title:"Sub-Agents",icon:C.jsx(ejt,{style:{color:l.colorInfo}}),badge:S.length,defaultExpanded:!1,children:t.filter(Q=>Q.id!==e.id).length===0?C.jsx(ai,{description:"No other agents available",image:ai.PRESENTED_IMAGE_SIMPLE}):C.jsxs(C.Fragment,{children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[C.jsxs(Do,{type:"secondary",style:{fontSize:12},children:[S.length," of"," ",t.filter(Q=>Q.id!==e.id).length," ","selected"]}),C.jsx(tn,{type:"link",size:"small",onClick:()=>{const Q=t.filter(X=>X.id!==e.id).map(X=>X.id);E(S.length===Q.length?[]:Q)},children:S.length===t.filter(Q=>Q.id!==e.id).length?"Deselect All":"Select All"})]}),C.jsx(Ha,{dataSource:t.filter(Q=>Q.id!==e.id),renderItem:K,style:{maxHeight:"40vh",overflowY:"auto"},split:!1})]})})]})}),C.jsxs("div",{style:{padding:"12px 20px",borderTop:`1px solid ${l.colorBorderSecondary}`,backgroundColor:l.colorFillQuaternary,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[C.jsx(Do,{type:"secondary",style:{fontSize:12},children:a?"Changes will be saved to the agent":"Viewing agent configuration"}),C.jsxs(tr,{children:[C.jsx(tn,{onClick:r,size:"small",children:"Close"}),a&&C.jsx(tn,{type:"primary",icon:C.jsx(kXe,{}),loading:f,onClick:F,size:"small",children:"Save"})]})]}),C.jsxs(ji,{title:"System Prompt",open:N,onCancel:()=>R(!1),width:700,footer:null,styles:{body:{padding:"16px 24px"}},children:[C.jsx(Zn.TextArea,{value:w,onChange:Q=>I(Q.target.value),rows:12,style:{width:"100%",fontFamily:"monospace",fontSize:12,resize:"vertical",minHeight:200}}),C.jsxs("div",{style:{marginTop:12,display:"flex",justifyContent:"flex-end",gap:8},children:[C.jsx("div",{onClick:()=>R(!1),style:{padding:"6px 16px",borderRadius:4,cursor:"pointer",fontSize:12,border:`1px solid ${l.colorBorder}`,background:l.colorBgContainer},children:"Cancel"}),C.jsx("div",{onClick:()=>R(!1),style:{padding:"6px 16px",borderRadius:4,cursor:"pointer",fontSize:12,background:l.colorPrimary,color:"#fff"},children:"Done"})]})]}),C.jsx(ji,{title:"Delete Assistant",open:m,onCancel:()=>A(!1),footer:[C.jsx(tn,{onClick:()=>A(!1),children:"Cancel"},"cancel"),C.jsx(tn,{type:"primary",danger:!0,loading:h,onClick:H,children:"Delete"},"delete")],children:C.jsxs(Do,{children:["Are you sure you want to delete ",C.jsx(Do,{strong:!0,children:e.name}),"? This action cannot be undone."]})})]})},uur=cur,{Text:dur}=Ar,fur=({onSelect:e,value:t,placeholder:n="Select a parent agent to extend..."})=>{const[r,a]=b.useState([]),[i,o]=b.useState(!1),{get:l}=kl();b.useEffect(()=>{(async()=>{var u;o(!0);try{const d=await l("/api/assistants");d.success&&a(((u=d.data)==null?void 0:u.records)||[])}catch(d){console.error("Failed to fetch assistants:",d)}finally{o(!1)}})()},[l]);const s=c=>{if(!c){e(null);return}const u=r.find(d=>d.id===c);e(u||null)};return C.jsx(Vh,{showSearch:!0,allowClear:!0,value:t,placeholder:n,loading:i,onChange:s,optionFilterProp:"label",style:{width:"100%"},options:r.map(c=>({value:c.id,label:c.name||c.id,description:c.description})),optionRender:c=>C.jsxs("div",{children:[C.jsx("div",{children:c.label}),c.data.description&&C.jsx(dur,{type:"secondary",style:{fontSize:12},children:c.data.description})]})})},{Text:gGe}=Ar,pur=({subAgentKeys:e,decisions:t,onChange:n})=>{const{token:r}=Zl.useToken(),a=(o,l)=>{const s=t.map(c=>c.originalKey===o?{...c,clone:l,cloneKey:l?`${o}_clone`:void 0}:c);n(s)},i=(o,l)=>{const s=t.map(c=>c.originalKey===o?{...c,cloneKey:l}:c);n(s)};return e.length===0?null:C.jsxs("div",{children:[C.jsx(gGe,{type:"secondary",style:{display:"block",marginBottom:8},children:"Choose how to handle each sub-agent from the parent:"}),C.jsx(Ha,{size:"small",bordered:!0,dataSource:t,style:{borderRadius:r.borderRadius},renderItem:o=>C.jsxs(Ha.Item,{style:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:8,padding:"8px 16px"},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[o.clone?C.jsx(RXe,{style:{color:r.colorPrimary}}):C.jsx(HN,{style:{color:r.colorTextSecondary}}),C.jsx(gGe,{style:{fontFamily:"monospace"},children:o.originalKey})]}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[C.jsx(Yr,{color:o.clone?"blue":"default",children:o.clone?"Clone as new":"Reuse"}),C.jsx(pw,{size:"small",checked:o.clone,onChange:l=>a(o.originalKey,l)})]})]}),o.clone&&C.jsx(Zn,{size:"small",placeholder:"Enter key for the cloned agent",value:o.cloneKey,onChange:l=>i(o.originalKey,l.target.value),style:{fontFamily:"monospace",fontSize:12},addonBefore:"Key"})]})})]})},{TextArea:mGe}=Zn,{Text:g7}=Ar,hur=({open:e,onCancel:t,onSuccess:n})=>{var E;const[r]=ra.useForm(),[a,i]=b.useState(!1),[o,l]=b.useState("scratch"),[s,c]=b.useState(null),[u,d]=b.useState([]),{get:f,post:p}=kl();Zl.useToken();const h=b.useCallback(()=>{c(null),d([])},[]),g=b.useCallback(w=>{if(c(w),!w){r.resetFields(["key","name","description","type","prompt"]),d([]);return}const I=typeof w.graphDefinition=="object"&&w.graphDefinition!==null?w.graphDefinition:{},N=I.key||w.id,R=w.name||I.name||"";r.setFieldsValue({key:`${N}_ext`,name:R?`${R} (Extended)`:"",description:w.description||I.description||"",type:I.type||"react",prompt:I.prompt||""});const L=I.subAgents||[];d(L.map(O=>({originalKey:O,clone:!1})))},[r]),m=b.useCallback(w=>{l(w),w==="scratch"&&(h(),r.resetFields())},[r,h]),A=async(w,I)=>{const N=await f(`/api/assistants/${w}`);if(!N.success)throw new Error(`Failed to fetch sub-agent "${w}" for cloning`);const R=N.data,L=typeof R.graphDefinition=="object"?R.graphDefinition:{},O={id:I,name:`${R.name} (Clone)`,description:R.description||"",graphDefinition:{...L,key:I,name:`${R.name} (Clone)`}},M=await p("/api/assistants",O);if(!M.success)throw new Error(M.message||`Failed to clone sub-agent "${w}"`);return M.data},v=w=>({id:w.key,name:w.name,description:w.description||"",graphDefinition:{key:w.key,name:w.name,description:w.description||"",type:w.type,prompt:w.prompt||"",tools:[],skills:[],subAgents:w.type==="deep_agent"?[]:void 0,middleware:[]}}),y=async(w,I)=>{if(!s)throw new Error("No parent agent selected");const N=u.filter(M=>M.clone);for(const M of N){if(!M.cloneKey||!M.cloneKey.trim())throw new Error(`Please provide a key for the cloned sub-agent "${M.originalKey}"`);if(!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(M.cloneKey))throw new Error(`Invalid key "${M.cloneKey}" for cloned sub-agent "${M.originalKey}". Key must start with a letter and contain only letters, numbers, underscores, or hyphens.`)}const R=[];for(const M of u)if(M.clone){const B=await A(M.originalKey,M.cloneKey);I.push(B),R.push(M.cloneKey)}else R.push(M.originalKey);const L=typeof s.graphDefinition=="object"?s.graphDefinition:{},O={key:w.key,name:w.name,description:w.description||"",extendsAgent:s.id,type:w.type||L.type};return w.prompt&&w.prompt!==L.prompt&&(O.prompt=w.prompt),(R.length>0||L.subAgents&&L.subAgents.length>0)&&(O.subAgents=R),{id:w.key,name:w.name,description:w.description||"",graphDefinition:O}},_=async()=>{try{const w=await r.validateFields();i(!0);const I=[],N=o==="scratch"?v(w):await y(w,I),R=await p("/api/assistants",N);if(R.success){hp.success({message:"Created",description:o==="extend"?`Assistant created by extending "${s==null?void 0:s.name}"`:"Assistant created successfully"}),r.resetFields(),h(),l("scratch");for(const L of I)n==null||n(L);n==null||n(R.data),t()}else hn.error(R.message||"Failed to create assistant")}catch(w){if(w.errorFields)return;hn.error(w.message||"An error occurred while creating the assistant")}finally{i(!1)}},x=((E=s==null?void 0:s.graphDefinition)==null?void 0:E.subAgents)||[],S=o==="extend"&&s&&x.length>0;return C.jsxs(ji,{title:"Create New Assistant",open:e,onCancel:()=>{h(),l("scratch"),t()},footer:[C.jsx(tn,{onClick:()=>{h(),l("scratch"),t()},children:"Cancel"},"cancel"),C.jsx(tn,{type:"primary",icon:o==="extend"?C.jsx(RXe,{}):C.jsx(j3,{}),loading:a,onClick:_,children:o==="extend"?"Create (Extend)":"Create"},"submit")],width:600,children:[C.jsxs("div",{style:{marginBottom:20},children:[C.jsx(g7,{type:"secondary",style:{display:"block",marginBottom:8},children:"Creation Mode"}),C.jsx(Ax,{value:o,onChange:m,options:[{value:"scratch",label:"From Scratch"},{value:"extend",label:"Extend Existing Agent"}],block:!0})]}),o==="extend"&&C.jsxs("div",{style:{marginBottom:20},children:[C.jsx(g7,{type:"secondary",style:{display:"block",marginBottom:8},children:"Parent Agent"}),C.jsx(fur,{value:s==null?void 0:s.id,onSelect:g}),s&&C.jsx(g7,{type:"secondary",style:{display:"block",marginTop:4,fontSize:12},children:"Fields left unchanged will be inherited from the parent agent."})]}),o==="extend"&&s&&C.jsx(T4,{style:{margin:"12px 0"}}),C.jsxs(ra,{form:r,layout:"vertical",autoComplete:"off",initialValues:{type:"react"},children:[C.jsx(ra.Item,{name:"key",label:"Key (ID)",rules:[{required:!0,message:"Please enter a unique key"},{pattern:/^[a-zA-Z][a-zA-Z0-9_-]*$/,message:"Key must start with a letter and contain only letters, numbers, underscores, or hyphens"}],style:{marginBottom:16},children:C.jsx(Zn,{placeholder:"e.g., my_assistant"})}),C.jsx(ra.Item,{name:"name",label:"Name",rules:[{required:!0,message:"Please enter a name"}],style:{marginBottom:16},children:C.jsx(Zn,{placeholder:"e.g., My Assistant"})}),C.jsx(ra.Item,{name:"description",label:"Description",rules:[{required:!0,message:"Please enter a description"}],style:{marginBottom:16},children:C.jsx(mGe,{placeholder:"Enter a description for this assistant...",autoSize:{minRows:2,maxRows:4}})}),C.jsx(ra.Item,{name:"type",label:"Agent Type",rules:[{required:!0}],style:{marginBottom:16},children:C.jsx(Ax,{options:[{value:"react",label:"Executor"},{value:"deep_agent",label:"Orchestrator"},{value:"team",label:"Team"}],block:!0})}),C.jsx(ra.Item,{noStyle:!0,shouldUpdate:(w,I)=>w.type!==I.type,children:()=>{const w=r.getFieldValue("type"),I={react:"Executor: Directly executes tasks using tools. Best for single-step operations like search, code execution, and data retrieval.",deep_agent:"Orchestrator: Manages a sequential todo list to plan and assign todo items to sub-agents. Best for structured multi-step workflows.",team:"Team: Creates tasks with dependencies and dynamically spawns teammates. Like a swarm, teammates communicate via mailbox. Best for tasks requiring exploration and divergent thinking."};return C.jsx(g7,{type:"secondary",style:{fontSize:12,display:"block",marginTop:-12,marginBottom:16,lineHeight:1.5},children:I[w]||I.react})}}),C.jsx(ra.Item,{name:"prompt",label:o==="extend"&&s?"System Prompt (leave unchanged to inherit from parent)":"System Prompt",rules:o==="scratch"?[{required:!0,message:"Please enter a system prompt"}]:[],children:C.jsx(mGe,{placeholder:o==="extend"&&s?"Leave empty to inherit parent's prompt, or enter a new prompt to override...":"Enter the system prompt for this agent...",autoSize:{minRows:4,maxRows:8},style:{fontFamily:"monospace",fontSize:13,lineHeight:1.6}})})]}),S&&C.jsxs(C.Fragment,{children:[C.jsx(T4,{style:{margin:"12px 0"}}),C.jsx(g7,{strong:!0,style:{display:"block",marginBottom:8},children:"Sub-Agents"}),C.jsx(pur,{subAgentKeys:x,decisions:u,onChange:d})]})]})},gur=hur,mur=({onChat:e})=>{const{setCenter:t,fitView:n}=RC(),[r,a,i]=Lve([]),[o,l,s]=kve([]),[c,u]=b.useState([]),[d,f]=b.useState(!1),[p,h]=b.useState(!1),[g,m]=b.useState(null),[A,v]=b.useState(!1),{get:y,del:_,put:x}=kl(),{config:S}=Zo(),{token:E}=Zl.useToken(),{enableAssistantCreation:w=!0,enableAssistantEditing:I=!0}=S,N=b.useMemo(()=>({assistant:tur}),[]),R=b.useCallback(U=>{m(U),h(!0)},[]),L=b.useCallback(()=>{h(!1),m(null)},[]),O=b.useCallback(({nodes:U})=>{if(U.length===1&&I){const j=U[0].data;j!=null&&j.assistant&&(m(j.assistant),h(!0))}else U.length===0&&(h(!1),m(null))},[I]),M=async()=>{f(!0);try{const U=await y("/api/assistants");U.success&&U.data&&Array.isArray(U.data.records)&&u(U.data.records)}catch(U){console.error("Failed to fetch assistants:",U),u([])}finally{f(!1)}};b.useEffect(()=>{M()},[]),b.useEffect(()=>{if(!c||c.length===0){a([]),l([]);return}const U=[],j=[],G=320,F=300,H=Math.ceil(Math.sqrt(c.length)),q=new Map,V=[];if(c.forEach(K=>{q.set(K.id,K)}),c.forEach(K=>{if(K.graphDefinition)try{const Q=typeof K.graphDefinition=="string"?JSON.parse(K.graphDefinition):K.graphDefinition;Q.subAgents&&Array.isArray(Q.subAgents)&&Q.subAgents.forEach(X=>{const re=c.find(te=>te.id===X||te.id===String(X));re&&re.id!==K.id&&V.push({source:K.id,target:re.id})}),Q.internalSubAgents&&Array.isArray(Q.internalSubAgents)&&Q.internalSubAgents.forEach(X=>{if(X.key){const re=c.find(te=>te.id===X.key||te.id===String(X.key));re&&re.id!==K.id&&V.push({source:K.id,target:re.id})}}),Q.nodes&&Array.isArray(Q.nodes)&&Q.nodes.forEach(X=>{if(X.assistantId&&X.assistantId!==K.id){const re=c.find(te=>te.id===X.assistantId||te.id===String(X.assistantId));re&&V.push({source:K.id,target:re.id})}}),Q.edges&&Array.isArray(Q.edges)&&Q.edges.forEach(X=>{if(X.source&&X.target){const re=typeof X.source=="string"?X.source:X.source.id||X.source.assistantId,te=typeof X.target=="string"?X.target:X.target.id||X.target.assistantId,ne=c.find(de=>de.id===re||de.id===String(re)),oe=c.find(de=>de.id===te||de.id===String(te));ne&&oe&&V.push({source:ne.id,target:oe.id})}})}catch(Q){console.warn(`Failed to parse graphDefinition for assistant ${K.id}:`,Q)}}),V.length>0){const K=new Set,Q=new Map,X=new Map;V.forEach(oe=>{X.has(oe.source)||X.set(oe.source,[]),X.get(oe.source).push(oe.target)});const re=[],te=c.filter(oe=>!V.some(de=>de.target===oe.id));for(te.length===0&&c.length>0?re.push({id:c[0].id,level:0}):te.forEach(oe=>{re.push({id:oe.id,level:0})});re.length>0;){const{id:oe,level:de}=re.shift();if(K.has(oe))continue;K.add(oe),Q.set(oe,de),(X.get(oe)||[]).forEach(ie=>{K.has(ie)||re.push({id:ie,level:de+1})})}c.forEach(oe=>{Q.has(oe.id)||Q.set(oe.id,0)});const ne=new Map;c.forEach(oe=>{const de=Q.get(oe.id)||0;ne.has(de)||ne.set(de,[]),ne.get(de).push(oe)}),ne.forEach((oe,de)=>{const ue=de*F,be=-((oe.length-1)*G)/2;oe.forEach((fe,ve)=>{const ge=be+ve*G;U.push({id:fe.id,type:"assistant",data:{assistant:fe,onConfigure:I?()=>R(fe):void 0,onChat:e},position:{x:ge,y:ue}})})}),V.forEach(oe=>{q.has(oe.source)&&q.has(oe.target)&&j.push({id:`e${oe.source}-${oe.target}`,source:oe.source,target:oe.target,animated:!0,style:{stroke:"#1677ff"},type:"smoothstep"})})}else c.forEach((K,Q)=>{const X=Math.floor(Q/H),te=Q%H*G-(H-1)*G/2,ne=X*F;U.push({id:K.id,type:"assistant",data:{assistant:K,onConfigure:I?()=>R(K):void 0,onChat:e},position:{x:te,y:ne}})});a(U),l(j)},[c,a,l,R,e]);const B=async(U,j)=>{try{const F={...typeof U.graphDefinition=="string"?JSON.parse(U.graphDefinition||"{}"):U.graphDefinition||{},...j},H=await x(`/api/assistants/${U.id}`,{name:j.name??U.name,description:j.description??U.description,graphDefinition:F});if(H.success)u(q=>q.map(V=>V.id===U.id?{...V,name:j.name??U.name,description:j.description??U.description,graphDefinition:F}:V)),hp.success({message:"Saved",description:H.message||"Agent configuration saved successfully"});else throw hn.error(H.message||"Failed to save agent configuration"),new Error(H.message||"Failed to save agent configuration")}catch(G){throw console.error("Failed to save agent configuration:",G),hn.error(G instanceof Error?G.message:"Failed to save agent configuration"),G}},D=async U=>{try{const j=await _(`/api/assistants/${U.id}`);if(j.success)u(G=>G.filter(F=>F.id!==U.id)),(g==null?void 0:g.id)===U.id&&(m(null),h(!1)),hp.success({message:"Deleted",description:"Assistant deleted successfully"});else throw hn.error(j.message||"Failed to delete assistant"),new Error(j.message||"Failed to delete assistant")}catch(j){throw console.error("Failed to delete assistant:",j),hn.error(j instanceof Error?j.message:"Failed to delete assistant"),j}},$=U=>{u(j=>j.some(F=>F.id===U.id)?j.map(F=>F.id===U.id?U:F):[...j,U]),P.current=U};b.useEffect(()=>{if(g){const U=r.find(j=>j.id===g.id);U&&t(U.position.x+140,U.position.y+100,{zoom:1,duration:800})}},[g,r,t]),b.useEffect(()=>{c.length>0&&g&&c.find(j=>j.id===g.id)&&!p&&h(!0)},[c,g,p]);const P=b.useRef(null);return b.useEffect(()=>{if(P.current&&!c.find(U=>{var j;return U.id===((j=P.current)==null?void 0:j.id)})&&(P.current=null),P.current){const U=r.find(j=>j.id===P.current.id);U&&(t(U.position.x+140,U.position.y+100,{zoom:1,duration:800}),m(P.current),h(!0),P.current=null)}},[r,t]),d?C.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"#fafafa"},children:"Loading assistants..."}):C.jsxs("div",{style:{width:"100%",height:"100%",display:"flex"},children:[C.jsxs("div",{style:{flex:1,height:"100%",background:"#fafafa",position:"relative"},children:[C.jsxs(Mve,{nodes:r,edges:o,onNodesChange:i,onEdgesChange:s,onSelectionChange:O,nodeTypes:N,fitView:!0,children:[C.jsx(Dve,{color:"#eee",gap:20}),C.jsx(Bve,{})]}),w&&C.jsx("div",{style:{position:"absolute",top:20,right:20,zIndex:10},children:C.jsx(tn,{type:"primary",size:"large",icon:C.jsx(j3,{}),onClick:()=>v(!0),style:{height:48,width:48,borderRadius:"50%",boxShadow:E.boxShadowTertiary,display:"flex",alignItems:"center",justifyContent:"center",padding:0}})})]}),C.jsx(uur,{visible:p,assistant:g,allAssistants:c,onClose:L,onSave:B,onDelete:D}),C.jsx(gur,{open:A,onCancel:()=>v(!1),onSuccess:$})]})},Aur=e=>C.jsx(J$,{children:C.jsx(mur,{...e})}),vur=Aur,{Text:Js}=Ar,{TextArea:AGe}=Zn,yur=e=>{const t=["#1890ff","#52c41a","#faad14","#f5222d","#722ed1","#13c2c2","#eb2f96","#fa8c16"];let n=0;for(let r=0;r<e.length;r++)n=e.charCodeAt(r)+((n<<5)-n);return t[Math.abs(n)%t.length]},bur=({data:e})=>{var j;const{token:t}=Zl.useToken(),{config:n}=Zo(),{put:r}=kl(),a=m1("__GLOBAL__");if(!e)return null;const{skill:i,onClick:o,onDelete:l}=e;if(!i)return null;const[s,c]=b.useState(i),u=yur(s.name),d=((j=s.name)==null?void 0:j.split("-").map(G=>G.charAt(0)).join("").toUpperCase().slice(0,2))||"SK",f=s.subSkills&&s.subSkills.length>0,p=s.metadata&&s.metadata.category||"global",h=b.useMemo(()=>s.metadata?Object.entries(s.metadata).filter(([G,F])=>G&&F):[],[s.metadata]),g=G=>{if(!G)return"";const F=G instanceof Date?G:new Date(G);return Number.isNaN(F.getTime())?"":F.toLocaleString()},m=G=>{navigator.clipboard.writeText(G)},[A,v]=b.useState(!1),[y,_]=b.useState({...i,id:i.name}),[x,S]=b.useState(h.map(([G,F])=>({key:G,value:F}))),[E,w]=b.useState(!1),[I,N]=b.useState(!1);b.useEffect(()=>{v(!1),c(i),_({...i,id:i.name}),S(Object.entries(i.metadata||{}).map(([G,F])=>({key:G,value:F})))},[i]);const R=(G,F)=>{if(G==="name"){_(H=>({...H,name:F,id:F}));return}_(H=>({...H,[G]:F}))},L=async G=>{G==null||G.stopPropagation(),G==null||G.preventDefault();try{const F=s.id||s.name;if(!F){hn.error("Skill ID is missing");return}await a.skills.delete(F),hp.success({message:"Deleted",description:"Skill deleted successfully"}),w(!1),l&&await l()}catch(F){hn.error((F==null?void 0:F.message)||"An error occurred while deleting the skill")}},O=G=>{S(G);const F=G.reduce((H,q)=>(q.key&&(H[q.key]=q.value),H),{});_(H=>({...H,metadata:F}))},M=(G,F,H)=>{const q=[...x];q[G]={...q[G],[F]:H},O(q)},B=()=>{O([...x,{key:"",value:""}])},D=async()=>{try{N(!0);const G={"Content-Type":"application/json"};n.apiKey&&(G.Authorization=`Bearer ${n.apiKey}`);const F={name:y.name,description:y.description,license:y.license||void 0,compatibility:y.compatibility||void 0,metadata:y.metadata||void 0,content:y.content||void 0,subSkills:y.subSkills||void 0},H=await r(`/api/skills/${s.id}`,F);if(H.success){hp.success({message:"Saved",description:"Skill updated successfully"});const q=H.data||y;c(q),_({...q,id:q.name}),S(Object.entries(q.metadata||{}).map(([V,Y])=>({key:V,value:Y}))),v(!1),o==null||o(q)}else hn.error(H.message||"Failed to update skill")}catch(G){hn.error(G.message||"An error occurred while updating the skill")}finally{N(!1)}},$=C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(Js,{style:{fontSize:12,color:t.colorTextSecondary},children:"Description"}),C.jsx(AGe,{value:y.description,onChange:G=>R("description",G.target.value),placeholder:"Description",autoSize:{minRows:2,maxRows:4}})]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(Js,{style:{fontSize:12,color:t.colorTextSecondary},children:"License"}),C.jsx(Zn,{value:y.license,onChange:G=>R("license",G.target.value),placeholder:"License"})]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(Js,{style:{fontSize:12,color:t.colorTextSecondary},children:"Compatibility"}),C.jsx(Zn,{value:y.compatibility,onChange:G=>R("compatibility",G.target.value),placeholder:"Compatibility"})]}),C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[C.jsx(Js,{style:{fontSize:12,color:t.colorTextSecondary,fontWeight:500},children:"Metadata"}),C.jsx(tn,{size:"small",icon:C.jsx(j3,{}),onClick:B,children:"Add"})]}),C.jsxs(tr,{direction:"vertical",size:8,style:{width:"100%"},children:[x.length===0&&C.jsx(Js,{style:{fontSize:11,color:t.colorTextTertiary},children:"No metadata yet. Use Add to create one."}),x.map((G,F)=>C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[C.jsxs(Js,{style:{fontSize:11,color:t.colorTextSecondary},children:["Meta ",F+1]}),C.jsxs(tr,{style:{width:"100%"},size:8,wrap:!0,children:[C.jsx(Zn,{value:G.key,placeholder:"Key",style:{width:140},onChange:H=>M(F,"key",H.target.value)}),C.jsx(Zn,{value:G.value,placeholder:"Value",style:{flex:1,minWidth:200},onChange:H=>M(F,"value",H.target.value)})]})]},F))]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(Js,{style:{fontSize:12,color:t.colorTextSecondary},children:"Content"}),C.jsx(AGe,{value:y.content,onChange:G=>R("content",G.target.value),placeholder:"Content",autoSize:{minRows:4,maxRows:8}})]})]}),P=C.jsxs("div",{style:{width:480,maxHeight:"80vh",overflowY:"auto",padding:16},children:[C.jsx("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:16},children:C.jsxs("div",{style:{flex:1},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(Js,{strong:!0,style:{fontSize:18,fontWeight:600,color:t.colorText},children:s.name}),C.jsx(Yr,{style:{margin:0,fontSize:10,padding:"2px 8px",fontWeight:600},color:"geekblue",children:p.toUpperCase()})]}),C.jsx("div",{style:{display:"flex",alignItems:"center",gap:6},children:C.jsx(Js,{style:{fontSize:11,color:t.colorTextTertiary,fontFamily:"monospace"},children:`>_ ${s.id}`})})]})}),A?$:C.jsxs(C.Fragment,{children:[s.description&&C.jsx("div",{style:{marginBottom:16},children:C.jsxs(Js,{style:{fontSize:12,color:t.colorText,lineHeight:1.6,fontStyle:"italic"},children:['"',s.description,'"']})}),h.length>0&&C.jsxs("div",{style:{marginBottom:16},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(Sx,{style:{fontSize:14,color:t.colorTextSecondary}}),C.jsxs(Js,{style:{fontSize:12,color:t.colorTextSecondary,fontWeight:500},children:["Metadata (",h.length,")"]})]}),C.jsx("div",{style:{border:`1px solid ${t.colorBorderSecondary}`,borderRadius:6,overflow:"hidden"},children:h.map(([G,F],H)=>C.jsxs("div",{style:{display:"flex",alignItems:"stretch",borderBottom:H===h.length-1?"none":`1px solid ${t.colorBorderSecondary}`},children:[C.jsx("div",{style:{width:140,padding:"8px 10px",background:t.colorFillTertiary,borderRight:`1px solid ${t.colorBorderSecondary}`,fontSize:11,color:t.colorTextSecondary,fontWeight:600,textTransform:"capitalize"},children:G}),C.jsx("div",{style:{flex:1,padding:"8px 10px",fontSize:11,color:t.colorText,wordBreak:"break-word"},children:F})]},G))})]}),f&&C.jsxs("div",{style:{marginBottom:16},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(Ure,{style:{fontSize:14,color:t.colorTextSecondary}}),C.jsxs(Js,{style:{fontSize:12,color:t.colorTextSecondary,fontWeight:500},children:["Sub-Skills (",s.subSkills.length,")"]})]}),C.jsx(tr,{size:[8,8],wrap:!0,children:s.subSkills.map((G,F)=>C.jsx(Yr,{style:{fontSize:11,padding:"4px 12px",backgroundColor:t.colorFillTertiary,color:t.colorText,border:`1px solid ${t.colorBorderSecondary}`},children:G},F))})]}),(s.license||s.compatibility)&&C.jsx("div",{style:{marginBottom:16},children:C.jsxs(tr,{size:[8,8],wrap:!0,children:[s.license&&C.jsx(Yr,{icon:C.jsx(v8e,{}),style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:t.colorInfoBg,color:t.colorInfo,border:`1px solid ${t.colorInfoBorder}`,fontWeight:500,lineHeight:"16px"},children:s.license}),s.compatibility&&C.jsx(Yr,{style:{margin:0,fontSize:11,padding:"4px 12px",borderRadius:6,backgroundColor:t.colorSuccessBg,color:t.colorSuccess,border:`1px solid ${t.colorSuccessBorder}`,fontWeight:500,lineHeight:"16px",display:"inline-flex",alignItems:"center",gap:4},children:s.compatibility})]})}),(s.createdAt||s.updatedAt)&&C.jsx("div",{style:{marginBottom:16},children:C.jsxs(tr,{direction:"vertical",size:4,children:[s.createdAt&&C.jsxs(Js,{style:{fontSize:11,color:t.colorTextTertiary,fontFamily:"monospace"},children:["Created: ",g(s.createdAt)]}),s.updatedAt&&C.jsxs(Js,{style:{fontSize:11,color:t.colorTextTertiary,fontFamily:"monospace"},children:["Updated: ",g(s.updatedAt)]})]})}),s.content&&C.jsxs("div",{style:{marginBottom:0},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[C.jsx(j2,{style:{fontSize:14,color:t.colorTextSecondary}}),C.jsx(Js,{style:{fontSize:12,color:t.colorTextSecondary,fontWeight:600,letterSpacing:.5},children:"CONTENT"})]}),C.jsx("div",{style:{padding:12,background:t.colorFillTertiary,border:`1px solid ${t.colorBorderSecondary}`,borderRadius:4,maxHeight:200,overflowY:"auto"},children:C.jsx(Js,{style:{fontSize:11,color:t.colorText,lineHeight:1.6,whiteSpace:"pre-wrap"},children:s.content})})]})]}),C.jsx(T4,{style:{margin:"16px 0"}}),C.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:A?C.jsxs(C.Fragment,{children:[C.jsx(tn,{block:!0,onClick:()=>{v(!1),_(i)},style:{flex:1},children:"Cancel"}),C.jsx(tn,{type:"primary",block:!0,onClick:D,loading:I,style:{flex:1},children:"Save"})]}):C.jsxs(C.Fragment,{children:[C.jsx(tn,{type:"primary",block:!0,onClick:()=>v(!0),style:{flex:1},children:"Edit Skill"}),C.jsx(tn,{danger:!0,onClick:G=>{G.stopPropagation(),L(G)},children:"Delete"}),C.jsx(tn,{icon:C.jsx(EXe,{}),onClick:()=>m(s.id),title:"Copy ID"})]})})]}),U={opacity:0,background:"transparent",border:"none",width:0,height:0,pointerEvents:"none"};return C.jsxs("div",{style:{padding:4},children:[C.jsx(P3,{type:"target",position:Br.Top,style:U,isConnectable:!1}),C.jsx("div",{onClick:()=>{w(!0)},style:{width:280,minHeight:200,background:t.colorBgContainer,borderRadius:8,boxShadow:"0 1px 6px rgba(0, 0, 0, 0.08)",cursor:o?"pointer":"default",overflow:"hidden",transition:"all 0.2s ease",position:"relative",border:`1px solid ${t.colorBorder}`,display:"flex",flexDirection:"column"},onMouseEnter:G=>{o&&(G.currentTarget.style.transform="translateY(-2px)",G.currentTarget.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.12)")},onMouseLeave:G=>{G.currentTarget.style.transform="translateY(0)",G.currentTarget.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.08)"},children:C.jsxs("div",{style:{padding:12,display:"flex",flexDirection:"column",gap:10},children:[C.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[C.jsxs("div",{style:{position:"relative",flexShrink:0},children:[C.jsx(z3,{size:44,icon:C.jsx(CFt,{}),style:{backgroundColor:u,color:"#fff",fontSize:16,fontWeight:600},children:d}),f&&C.jsx("div",{style:{position:"absolute",bottom:-2,right:-2,width:18,height:18,borderRadius:"50%",background:t.colorPrimary,border:`2px solid ${t.colorBgContainer}`,display:"flex",alignItems:"center",justifyContent:"center"},children:C.jsx(Ure,{style:{fontSize:10,color:"#fff"}})})]}),C.jsxs("div",{style:{flex:1,minWidth:0},children:[C.jsx(Js,{strong:!0,style:{fontSize:14,fontWeight:600,display:"block",marginBottom:3,color:t.colorText,lineHeight:1.3},ellipsis:{tooltip:s.name},children:s.name}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[C.jsx(j2,{style:{fontSize:9,color:t.colorTextTertiary}}),C.jsx(Js,{style:{fontSize:9,color:t.colorTextTertiary},ellipsis:{tooltip:s.id},children:s.id})]})]})]}),s.description&&C.jsx("div",{style:{padding:8,background:t.colorFillTertiary,border:`1px solid ${t.colorBorderSecondary}`,borderRadius:4,borderLeft:`2px solid ${u}`},children:C.jsx(Or,{title:s.description.length>150?s.description:void 0,placement:"top",children:C.jsxs("div",{style:{fontSize:10,color:t.colorText,lineHeight:1.5,fontStyle:"italic",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",cursor:s.description.length>150?"help":"default"},children:['"',s.description,'"']})})}),C.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,padding:"4px 0",marginTop:"auto"},children:[C.jsx(Yr,{style:{margin:0,fontSize:8,padding:"2px 6px",borderRadius:6,backgroundColor:t.colorPrimaryBg,color:t.colorPrimary,border:`1px solid ${t.colorPrimaryBorder}`,fontWeight:600,lineHeight:"14px",textTransform:"capitalize"},children:p.toUpperCase()}),f&&C.jsxs(Yr,{style:{margin:0,fontSize:8,padding:"2px 6px",borderRadius:6,backgroundColor:t.colorSuccessBg,color:t.colorSuccess,border:`1px solid ${t.colorSuccessBorder}`,fontWeight:500,lineHeight:"14px",display:"inline-flex",alignItems:"center"},children:["SUB-SKILLS (",s.subSkills.length,")"]}),s.license&&C.jsx(Yr,{style:{margin:0,fontSize:7,padding:"2px 6px",borderRadius:6,backgroundColor:t.colorInfoBg,color:t.colorInfo,border:`1px solid ${t.colorInfoBorder}`,fontWeight:500,lineHeight:"14px"},icon:C.jsx(v8e,{}),children:s.license}),s.compatibility&&C.jsx(Yr,{style:{margin:0,fontSize:7,padding:"2px 6px",borderRadius:6,backgroundColor:t.colorSuccessBg,color:t.colorSuccess,border:`1px solid ${t.colorSuccessBorder}`,fontWeight:500,lineHeight:"14px"},icon:C.jsx(Sx,{}),children:s.compatibility})]})]})}),C.jsx(ji,{open:E,onCancel:()=>{w(!1),v(!1),_({...s,id:s.name})},footer:null,width:520,destroyOnClose:!0,title:null,styles:{body:{padding:0}},children:P}),C.jsx(P3,{type:"source",position:Br.Bottom,style:U,isConnectable:!1})]})},_ur=bur,{TextArea:vGe}=Zn,{Text:vm}=Ar,Sur=({open:e,onCancel:t,onSuccess:n})=>{const[r]=ra.useForm(),[a,i]=b.useState(!1),{post:o}=kl(),{token:l}=Zl.useToken(),s=[{key:"category",value:"global"}],[c,u]=b.useState(s),d=async()=>{try{const g=await r.validateFields();i(!0);const m=c.length>0?c.reduce((y,_)=>(_.key&&(y[_.key]=_.value),y),{}):void 0,A={id:g.name,name:g.name,description:g.description,license:g.license||void 0,compatibility:g.compatibility||void 0,metadata:m,content:g.content||void 0,subSkills:void 0},v=await o("/api/skills",A);v.success?(hp.success({message:"Created",description:"Skill created successfully"}),r.resetFields(),u(s),n==null||n(),t()):hn.error(v.message||"Failed to create skill")}catch(g){if(g.errorFields)return;hn.error(g.message||"An error occurred while creating the skill")}finally{i(!1)}},f=()=>{r.resetFields(),u(s),t()},p=(g,m,A)=>{const v=[...c];v[g]={...v[g],[m]:A},u(v)},h=()=>{u([...c,{key:"",value:""}])};return C.jsx(ji,{title:"Create New Skill",open:e,onCancel:f,footer:null,width:520,destroyOnClose:!0,styles:{body:{padding:16}},children:C.jsx(ra,{form:r,layout:"vertical",onFinish:d,autoComplete:"off",children:C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(vm,{style:{fontSize:12,color:l.colorTextSecondary},children:"Name"}),C.jsx(ra.Item,{name:"name",rules:[{required:!0,message:"Please enter skill name"},{pattern:/^[a-z0-9]+(-[a-z0-9]+)*$/,message:"Name must be lowercase alphanumeric with single hyphens (e.g., 'my-skill')"},{min:1,max:64,message:"Name must be 1-64 characters"}],style:{marginBottom:0},children:C.jsx(Zn,{placeholder:"e.g., data-analysis"})})]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(vm,{style:{fontSize:12,color:l.colorTextSecondary},children:"Description"}),C.jsx(ra.Item,{name:"description",rules:[{required:!0,message:"Please enter skill description"}],style:{marginBottom:0},children:C.jsx(vGe,{placeholder:"Description",autoSize:{minRows:2,maxRows:4}})})]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(vm,{style:{fontSize:12,color:l.colorTextSecondary},children:"License"}),C.jsx(ra.Item,{name:"license",style:{marginBottom:0},children:C.jsx(Zn,{placeholder:"License"})})]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(vm,{style:{fontSize:12,color:l.colorTextSecondary},children:"Compatibility"}),C.jsx(ra.Item,{name:"compatibility",style:{marginBottom:0},children:C.jsx(Zn,{placeholder:"Compatibility"})})]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[C.jsx(vm,{style:{fontSize:12,color:l.colorTextSecondary,fontWeight:500},children:"Metadata"}),C.jsx(tn,{size:"small",icon:C.jsx(j3,{}),onClick:h,children:"Add"})]}),C.jsxs(tr,{direction:"vertical",size:8,style:{width:"100%"},children:[c.length===0&&C.jsx(vm,{style:{fontSize:11,color:l.colorTextTertiary},children:"No metadata yet. Use Add to create one."}),c.map((g,m)=>C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[C.jsxs(vm,{style:{fontSize:11,color:l.colorTextSecondary},children:["Meta ",m+1]}),C.jsxs(tr,{style:{width:"100%"},size:8,wrap:!0,children:[C.jsx(Zn,{value:g.key,placeholder:"Key",style:{width:140},onChange:A=>p(m,"key",A.target.value)}),C.jsx(Zn,{value:g.value,placeholder:"Value",style:{flex:1,minWidth:200},onChange:A=>p(m,"value",A.target.value)})]})]},m))]})]}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[C.jsx(vm,{style:{fontSize:12,color:l.colorTextSecondary},children:"Content"}),C.jsx(ra.Item,{name:"content",style:{marginBottom:0},children:C.jsx(vGe,{placeholder:"Content",autoSize:{minRows:4,maxRows:8}})})]}),C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,marginTop:8},children:[C.jsx(tn,{onClick:f,children:"Cancel"}),C.jsx(tn,{type:"primary",htmlType:"submit",loading:a,children:"Create Skill"})]})]})})})},xur=Sur,Eur=({onNodeClick:e})=>{const[t,n,r]=Lve([]),[a,i,o]=kve([]),[l,s]=b.useState(!1),[c,u]=b.useState([]),[d,f]=b.useState(!1),{token:p}=Zl.useToken(),{get:h}=kl(),g=b.useMemo(()=>({skill:_ur}),[]),m=async()=>{f(!0);try{const v=await h("/api/skills");v.success&&v.data&&Array.isArray(v.data.records)&&u(v.data.records)}catch(v){console.error("Failed to fetch skills:",v),u([])}finally{f(!1)}};b.useEffect(()=>{m()},[]),b.useEffect(()=>{if(!c||c.length===0){n([]),i([]);return}const v=[],y=[],_=320,x=300,S=new Map,E=[],w=new Map;if(c.forEach(N=>{S.set(N.name,N),N.subSkills&&N.subSkills.length>0&&(w.has(N.name)||w.set(N.name,[]),N.subSkills.forEach(R=>{c.find(O=>O.name===R)&&(E.push({source:N.name,target:R}),w.get(N.name).push(R))}))}),E.length>0){const N=new Set,R=new Map,L=new Map;E.forEach(D=>{L.set(D.target,D.source)});const O=[],M=c.filter(D=>!L.has(D.name));for(M.length===0&&c.length>0?O.push({id:c[0].name,level:0}):M.forEach(D=>{O.push({id:D.name,level:0})});O.length>0;){const{id:D,level:$}=O.shift();if(N.has(D))continue;N.add(D),R.set(D,$),(w.get(D)||[]).forEach(U=>{N.has(U)||O.push({id:U,level:$+1})})}c.forEach(D=>{R.has(D.name)||R.set(D.name,0)});const B=new Map;c.forEach(D=>{const $=R.get(D.name)||0;B.has($)||B.set($,[]),B.get($).push(D)}),B.forEach((D,$)=>{const P=$*x,j=-((D.length-1)*_)/2;D.forEach((G,F)=>{const H=j+F*_;v.push({id:G.name,type:"skill",data:{skill:G,onClick:()=>e==null?void 0:e(G),onDelete:m},position:{x:H,y:P}})})}),E.forEach(D=>{S.has(D.source)&&S.has(D.target)&&y.push({id:`e${D.source}-${D.target}`,source:D.source,target:D.target,style:{stroke:"#1677ff",strokeWidth:2},type:"smoothstep"})})}else{const N=Math.ceil(Math.sqrt(c.length));c.forEach((R,L)=>{const O=Math.floor(L/N),B=L%N*_-(N-1)*_/2,D=O*x;v.push({id:R.name,type:"skill",data:{skill:R,onClick:()=>e==null?void 0:e(R)},position:{x:B,y:D}})})}n(v),i(y)},[c,n,i,e]);const A=async()=>{await m()};return d?C.jsx("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",background:"#fafafa"},children:"Loading skills..."}):C.jsxs("div",{style:{width:"100%",height:"100%",background:"#fafafa",position:"relative"},children:[C.jsxs(Mve,{nodes:t,edges:a,onNodesChange:r,onEdgesChange:o,nodeTypes:g,fitView:!0,children:[C.jsx(Dve,{color:"#eee",gap:20}),C.jsx(Bve,{})]}),C.jsx("div",{style:{position:"absolute",top:20,right:20,zIndex:10},children:C.jsx(tn,{type:"primary",size:"large",icon:C.jsx(j3,{}),onClick:()=>s(!0),style:{height:48,width:48,borderRadius:"50%",boxShadow:p.boxShadowTertiary,display:"flex",alignItems:"center",justifyContent:"center",padding:0}})}),C.jsx(xur,{open:l,onCancel:()=>s(!1),onSuccess:A})]})},wur=e=>C.jsx(J$,{children:C.jsx(Eur,{...e})}),Cur=wur,Tur=({onToolSelect:e,autoLoad:t=!0})=>{const{token:n}=Zl.useToken(),{get:r}=kl(),[a,i]=b.useState({tools:[],isLoading:!1,error:null}),[o,l]=b.useState(null),s=b.useCallback(async()=>{i(f=>({...f,isLoading:!0,error:null}));try{const f=await r("/api/tools");if(f.success&&f.data&&Array.isArray(f.data.records))i(p=>({...p,tools:f.data.records,isLoading:!1}));else throw new Error("Invalid response format")}catch(f){i(p=>({...p,tools:[],isLoading:!1,error:f instanceof Error?f:new Error(String(f))}))}},[r]),c=b.useCallback(f=>{l(f.id),e==null||e(f)},[e]),u=b.useCallback(()=>{s()},[s]);b.useEffect(()=>{t&&s()},[t,s]);const d={width:"100%",height:"100%",background:"transparent",borderRadius:n.borderRadius,padding:n.paddingSM};return a.error?C.jsx("div",{style:d,children:C.jsx(U0,{message:"Error Loading Tools",description:a.error.message,type:"error",showIcon:!0,action:C.jsx(tn,{size:"small",icon:C.jsx(Kb,{}),onClick:u,children:"Retry"})})}):C.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[C.jsx("div",{style:{position:"absolute",top:n.paddingSM,right:n.paddingSM,zIndex:1},children:C.jsx(tn,{type:"text",size:"small",icon:C.jsx(Kb,{}),onClick:u,title:"Refresh tools",style:{color:n.colorTextSecondary}})}),C.jsx("div",{style:{width:"100%",height:"100%",overflowY:"auto",overflowX:"hidden",paddingTop:n.paddingLG},children:C.jsx(Ha,{dataSource:a.tools,loading:a.isLoading,locale:{emptyText:C.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:n.marginSM,padding:n.paddingLG},children:[C.jsx("div",{style:{color:n.colorTextSecondary},children:"No tools available"}),C.jsx(tn,{icon:C.jsx(Kb,{}),onClick:u,type:"dashed",size:"small",children:"Refresh"})]})},style:{...d,paddingTop:0},renderItem:f=>C.jsx(Ha.Item,{onClick:()=>c(f),style:{cursor:"pointer",padding:n.paddingSM,borderRadius:n.borderRadius,backgroundColor:o===f.id?n.colorFillSecondary:"transparent",transition:"background-color 0.2s"},onMouseEnter:p=>{o!==f.id&&(p.currentTarget.style.backgroundColor=n.colorFillTertiary)},onMouseLeave:p=>{o!==f.id&&(p.currentTarget.style.backgroundColor="transparent")},children:C.jsx(Ha.Item.Meta,{avatar:C.jsx(z3,{size:"small",style:{backgroundColor:n.colorFillSecondary,color:n.colorText},children:f.name.charAt(0).toUpperCase()}),title:C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:n.marginXS},children:[C.jsx("span",{children:f.name}),f.needUserApprove&&C.jsx(Yr,{color:"warning",style:{fontSize:"10px",padding:"2px 6px",margin:0,lineHeight:"1.2"},children:"Requires approval"})]}),description:C.jsx("div",{style:{color:n.colorTextSecondary,fontSize:n.fontSizeSM,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.description})})},f.id)})})]})},Yte=50,Iur=Ni(({token:e,css:t})=>({container:t`
|
|
5162
5162
|
height: 100%;
|
|
5163
5163
|
display: flex;
|
|
5164
5164
|
flex-direction: column;
|
|
@@ -6447,4 +6447,4 @@ ${i}
|
|
|
6447
6447
|
QUEUE_SERVICE_TYPE=redis
|
|
6448
6448
|
REDIS_URL=redis://localhost:6379
|
|
6449
6449
|
REDIS_PASSWORD=
|
|
6450
|
-
QUEUE_NAME=tasks`,rows:18,className:n.textArea,style:{fontFamily:"SF Mono, Monaco, Inconsolata, Roboto Mono, monospace",fontSize:13,padding:"16px",lineHeight:1.6}})]})},G=Y=>{const K=l[Y]||{models:[{key:"",model:"",provider:"openai",streaming:!1,apiKey:"",baseURL:""}]},Q=(te,ne,oe)=>{const de=[...K.models];de[te]={...de[te],[ne]:oe},s(ue=>({...ue,[Y]:{...ue[Y],models:de}}))},X=()=>{s(te=>({...te,[Y]:{...te[Y],models:[...K.models,{key:"",model:"",provider:"openai",streaming:!1,apiKey:"",baseURL:""}]}}))},re=te=>{K.models.length>1&&s(ne=>({...ne,[Y]:{...ne[Y],models:K.models.filter((oe,de)=>de!==te)}}))};return C.jsxs("div",{className:n.formContainer,children:[C.jsx("div",{style:{marginBottom:32},children:C.jsx(rl,{type:"secondary",style:{fontSize:14,lineHeight:1.6},children:"Configure model lattices. Each model will be registered with the provided key and can be used by agents."})}),K.models.map((te,ne)=>C.jsxs("div",{className:n.card,children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24,paddingBottom:20,borderBottom:"1px solid rgba(0, 0, 0, 0.06)"},children:[C.jsxs("div",{children:[C.jsxs(rl,{strong:!0,style:{fontSize:16},children:["Model ",ne+1]}),te.key&&C.jsxs(rl,{type:"secondary",style:{marginLeft:8,fontSize:12},children:["(",te.key,")"]})]}),K.models.length>1&&C.jsx(tn,{type:"text",danger:!0,size:"small",onClick:()=>re(ne),style:{borderRadius:6,transition:"all 0.2s"},children:"Remove"})]}),C.jsxs(tr,{direction:"vertical",style:{width:"100%"},size:"large",children:[C.jsxs("div",{children:[C.jsx(rl,{className:n.formLabel,children:"Key *"}),C.jsx(Zn,{placeholder:"e.g., default, gpt-4, claude",value:te.key,onChange:oe=>Q(ne,"key",oe.target.value),style:{height:40}}),C.jsx(rl,{className:n.formDescription,children:"Unique identifier for this model"})]}),C.jsxs("div",{children:[C.jsx(rl,{className:n.formLabel,children:"Provider *"}),C.jsx(Vh,{style:{width:"100%",height:40},value:te.provider,onChange:oe=>Q(ne,"provider",oe),options:[{label:"OpenAI",value:"openai"},{label:"Azure",value:"azure"},{label:"DeepSeek",value:"deepseek"},{label:"SiliconCloud",value:"siliconcloud"},{label:"VolcEngine",value:"volcengine"}]})]}),C.jsxs("div",{children:[C.jsx(rl,{className:n.formLabel,children:"Model Name *"}),C.jsx(Zn,{placeholder:"e.g., gpt-4, claude-3-opus, kimi-k2-250905",value:te.model,onChange:oe=>Q(ne,"model",oe.target.value),style:{height:40}})]}),C.jsxs("div",{children:[C.jsx(rl,{className:n.formLabel,children:"API Key"}),C.jsx(Zn.Password,{placeholder:"Enter your API key",value:te.apiKey,onChange:oe=>Q(ne,"apiKey",oe.target.value),style:{height:40}}),C.jsx(rl,{className:n.formDescription,children:"API key for the model provider. Leave empty to use environment variable."})]}),C.jsxs("div",{children:[C.jsx(rl,{className:n.formLabel,children:"Base URL"}),C.jsx(Zn,{placeholder:"e.g., https://api.openai.com/v1",value:te.baseURL,onChange:oe=>Q(ne,"baseURL",oe.target.value),style:{height:40}}),C.jsx(rl,{className:n.formDescription,children:"Optional custom base URL for the API"})]}),C.jsx("div",{children:C.jsxs(tr,{children:[C.jsx(pw,{checked:te.streaming,onChange:oe=>Q(ne,"streaming",oe)}),C.jsx(rl,{children:"Enable Streaming"})]})}),C.jsxs("div",{style:{display:"flex",gap:20},children:[C.jsxs("div",{style:{flex:1},children:[C.jsx(rl,{className:n.formLabel,children:"Max Tokens"}),C.jsx(Zn,{type:"number",placeholder:"e.g., 4096",value:te.maxTokens,onChange:oe=>Q(ne,"maxTokens",oe.target.value?Number(oe.target.value):void 0),style:{height:40}})]}),C.jsxs("div",{style:{flex:1},children:[C.jsx(rl,{className:n.formLabel,children:"Temperature"}),C.jsx(Zn,{type:"number",step:"0.1",placeholder:"e.g., 0.7",value:te.temperature,onChange:oe=>Q(ne,"temperature",oe.target.value?Number(oe.target.value):void 0),style:{height:40}})]})]})]})]},ne)),C.jsx(tn,{type:"dashed",onClick:X,block:!0,size:"large",style:{marginTop:24,height:48},children:"+ Add Model"})]})},F=Y=>{switch(f){case"environment":return j(Y);case"models":return G(Y);default:return null}},H=xGe.find(Y=>Y.key===f);i.find(Y=>Y.id===u);const q=Y=>C.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[C.jsx(eUt,{style:{marginRight:8,color:Y.connected?"#52c41a":Y.connecting?"#1890ff":"#d9d9d9"}}),C.jsx("span",{children:Y.name}),Y.connected&&C.jsx(FFt,{style:{color:"#52c41a",fontSize:12,marginLeft:8}}),Y.error&&!Y.connecting&&C.jsx(xXe,{style:{color:"#ff4d4f",fontSize:12,marginLeft:8}})]}),V=i.map(Y=>({key:Y.id,label:q(Y),children:C.jsx("div",{className:n.tabContent,children:Y.connected?C.jsx(C.Fragment,{children:C.jsxs("div",{style:{display:"flex",height:"100%"},children:[C.jsx("div",{className:n.sidebar,children:xGe.map(K=>C.jsxs("div",{className:`${n.menuItem} ${f===K.key?"active":""}`,onClick:()=>p(K.key),children:[C.jsx("span",{className:n.menuItemIcon,children:K.icon}),C.jsx("span",{className:n.menuItemText,children:K.label})]},K.key))}),C.jsxs("div",{className:n.content,children:[C.jsxs("div",{className:n.contentHeader,children:[C.jsxs("div",{className:n.contentHeaderLeft,children:[C.jsx(Xte,{level:3,className:n.contentTitle,children:H==null?void 0:H.label}),C.jsxs(rl,{className:n.contentDescription,children:[f==="environment"&&"Manage environment variables for the gateway server",f==="models"&&"Configure and register model lattices for use by agents"]})]}),C.jsxs("div",{className:n.contentHeaderRight,children:[C.jsx(tn,{onClick:t,children:"Cancel"}),C.jsx(tn,{type:"primary",icon:C.jsx(kXe,{}),onClick:U,loading:h,children:"Save Configuration"})]})]}),C.jsx("div",{className:n.contentBody,children:F(Y.id)})]})]})}):C.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:16,padding:48},children:Y.connecting?C.jsxs(C.Fragment,{children:[C.jsx(HN,{style:{fontSize:64,color:"#1890ff"},spin:!0}),C.jsx(Xte,{level:4,children:"Connecting..."}),C.jsxs(rl,{type:"secondary",style:{textAlign:"center"},children:["Connecting to ",Y.url]})]}):C.jsxs(C.Fragment,{children:[C.jsx(HN,{style:{fontSize:64,color:"#d9d9d9"}}),C.jsx(Xte,{level:4,type:"secondary",children:Y.error||"Not Connected"}),C.jsx(rl,{type:"secondary",style:{textAlign:"center",maxWidth:400},children:Y.error?`Failed to connect to ${Y.url}. Please check the server URL and try again.`:`Click "Reconnect" to connect to ${Y.url}`}),C.jsx(tn,{type:"primary",icon:C.jsx(HN,{}),onClick:()=>L(Y.id),loading:Y.connecting,style:{marginTop:16},children:"Reconnect"})]})})}),closable:i.length>1}));return C.jsxs(C.Fragment,{children:[C.jsx(ji,{open:e,onCancel:t,height:"70%",width:"80%",footer:null,title:"Settings",children:C.jsx("div",{children:C.jsx(lw,{activeKey:u,onChange:P,type:"editable-card",onEdit:(Y,K)=>{K==="add"?A(!0):K==="remove"&&$(Y)},items:V,addIcon:C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px"},children:[C.jsx(j3,{}),C.jsx("span",{children:"Add Server"})]})})})}),C.jsx(ji,{title:"Add New Server",open:m,onOk:D,onCancel:()=>{A(!1),y(""),x(""),E("")},confirmLoading:w,className:n.addServerModal,children:C.jsxs(tr,{direction:"vertical",style:{width:"100%"},size:"large",children:[C.jsxs("div",{children:[C.jsx(rl,{strong:!0,style:{display:"block",marginBottom:8},children:"Server Name"}),C.jsx(Zn,{placeholder:"e.g., Production Server",value:_,onChange:Y=>x(Y.target.value),onPressEnter:D}),C.jsx(rl,{type:"secondary",style:{fontSize:12,marginTop:4},children:"Optional: Leave empty to use URL as name"})]}),C.jsxs("div",{children:[C.jsx(rl,{strong:!0,style:{display:"block",marginBottom:8},children:"Server URL *"}),C.jsx(Zn,{placeholder:"e.g., http://localhost:4001",value:v,onChange:Y=>y(Y.target.value),onPressEnter:D}),C.jsx(rl,{type:"secondary",style:{fontSize:12,marginTop:4},children:"Enter the full URL of the gateway server"})]}),C.jsxs("div",{children:[C.jsx(rl,{strong:!0,style:{display:"block",marginBottom:8},children:"API Key"}),C.jsx(Zn.Password,{placeholder:"Optional: Enter API key for authentication",value:S,onChange:Y=>E(Y.target.value),onPressEnter:D}),C.jsx(rl,{type:"secondary",style:{fontSize:12,marginTop:4},children:"Optional: API key for server authentication"})]})]})})]})},EGe=()=>{const{settingsModalOpen:e,setSettingsModalOpen:t}=Zo();return C.jsx(Yur,{open:e,onClose:()=>t(!1)})},Kur=({initialAssistantId:e,enableWorkspace:t})=>{const{currentTenant:n}=B5(),r=n==null?void 0:n.id;return C.jsx(C.Fragment,{children:t?C.jsxs(nsr,{tenantId:r,children:[C.jsx(Dje,{autoLoad:!0,initialAssistantId:e,children:C.jsx(Bje,{children:C.jsx(SGe,{})})}),C.jsx(EGe,{})]}):C.jsxs(C.Fragment,{children:[C.jsx(Dje,{autoLoad:!0,initialAssistantId:e,children:C.jsx(Bje,{children:C.jsx(SGe,{})})}),C.jsx(EGe,{})]})})},Xur=e=>{var o,l;const{enableAssistantCreation:t,enableAssistantEditing:n,enableWorkspace:r,...a}=e,i=r??((o=a.initialConfig)==null?void 0:o.enableWorkspace)??!1;return C.jsx(Bor,{initialConfig:{enableAssistantCreation:t,enableAssistantEditing:n,enableWorkspace:i,...a.initialConfig},children:C.jsx(Kur,{initialAssistantId:(l=a.initialConfig)==null?void 0:l.assistantId,enableWorkspace:i})})};const wGe=({width:e=48,height:t=48,className:n=""})=>C.jsx("div",{style:{width:64,height:64,display:"flex",alignItems:"center",justifyContent:"center",padding:8,boxSizing:"border-box",margin:"0 auto"},children:C.jsx("img",{src:"/logo.png",alt:"Logo",width:e,height:t,className:n,style:{objectFit:"contain"}})});function Zte(e,t){const n=parseInt(e.replace("#",""),16),r=Math.round(2.55*t),a=(n>>16)+r,i=(n>>8&255)+r,o=(n&255)+r;return"#"+(16777216+(a<255?a<1?0:a:255)*65536+(i<255?i<1?0:i:255)*256+(o<255?o<1?0:o:255)).toString(16).slice(1)}function Zur(e){return{...JS,token:{...JS.token,colorPrimary:e,colorPrimaryHover:Zte(e,20),colorPrimaryActive:Zte(e,-15),colorPrimaryBg:Zte(e,45)+"20"}}}function Jur(){const e=new URL(window.location.href);if(e.port&&e.port!=="80"&&e.port!=="443"){const t=parseInt(e.port)+1;return`${e.protocol}//${e.hostname}:${t}`}return`${e.protocol}//${e.hostname}/api`}const edr=Zur("#5b50c6"),xue=Jur();function tdr(){return C.jsx(kor,{baseURL:xue,onLoginSuccess:(e,t)=>{console.log("Logged in:",e.name,"Tenants:",t.length)},onTenantSelected:e=>{console.log("Selected tenant:",e.name)},onLogout:()=>{console.log("Logged out")},children:C.jsx(ndr,{})})}function ndr(){const{isAuthenticated:e,user:t,tenants:n,currentTenant:r,selectTenant:a,logout:i}=B5(),[o,l]=le.useState(!1);return e?n.length===0?C.jsxs("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#ffffff",flexDirection:"column",gap:"20px"},children:[C.jsxs("div",{style:{textAlign:"center"},children:[C.jsxs("h2",{children:["Welcome, ",t==null?void 0:t.name,"!"]}),C.jsx("p",{style:{color:"#666",marginTop:"10px"},children:"You don't have access to any tenants yet."}),C.jsx("p",{style:{color:"#999",fontSize:"14px",marginTop:"5px"},children:"Please contact your administrator to be assigned to a tenant."})]}),C.jsx("button",{onClick:i,style:{padding:"10px 20px",background:"#f0f0f0",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Logout"})]}):!r&&n.length>0?C.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#ffffff"},children:C.jsx(Kor,{tenants:n.map(s=>s.tenant).filter(Boolean),onSelect:async s=>{await a(s.id)},title:"Select Your Tenant",description:`Welcome, ${t==null?void 0:t.name}! Choose a tenant to continue`})}):C.jsx(i3t,{config:{baseURL:xue,apiKey:localStorage.getItem("lattice_token")||"",assistantId:"",transport:"sse",headers:{"x-tenant-id":(r==null?void 0:r.id)||""}},children:C.jsx("div",{style:{width:"100vw",height:"100vh",overflow:"hidden"},children:C.jsx(Xur,{initialConfig:{enableSkillSlot:!1,enableDatabaseSlot:!1,resourceFolders:[{name:"tmp",displayName:"Working Directory",allowUpload:!0},{name:"artifacts",displayName:"artifacts",allowUpload:!1}],enableWorkspace:!0,enableThreadCreation:!0,enableThreadList:!0,baseURL:xue,globalSharedSandboxURL:"https://demo.alphafina.cn/sandbox/global",sidebarMode:"expanded",sidebarDefaultExpanded:!0,sidebarShowToggle:!0,sidebarShowNewAnalysis:!1,sidebarLogoText:"agentall.ai",sidebarLogoIcon:C.jsx(wGe,{width:28,height:28}),assistantId:"new-data-agent"}})})}):o?C.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#ffffff"},children:C.jsx(qor,{onSuccess:()=>l(!1),onCancel:()=>l(!1),footer:C.jsxs("p",{style:{textAlign:"center",marginTop:"20px"},children:["Already have an account?"," ",C.jsx("button",{onClick:()=>l(!1),style:{background:"none",border:"none",color:"#1890ff",cursor:"pointer",textDecoration:"underline"},children:"Sign in"})]})})}):C.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#ffffff"},children:C.jsx(Wor,{title:"agentall.ai",logo:C.jsx(wGe,{}),footer:C.jsxs("p",{style:{textAlign:"center",marginTop:"20px"},children:["Don't have an account?"," ",C.jsx("button",{onClick:()=>l(!0),style:{background:"none",border:"none",color:"#1890ff",cursor:"pointer",textDecoration:"underline"},children:"Create one"})]})})})}const rdr=document.getElementById("root"),adr=AAt.createRoot(rdr);adr.render(C.jsx(Hd,{theme:edr,children:C.jsx(tdr,{})}));export{Rw as $,_S as A,frn as B,fan as C,F1e as D,du as E,det as F,zpn as G,Jcn as H,lwe as I,idn as J,qB as K,_9 as L,$cn as M,Trn as N,kw as O,F6 as P,udr as Q,Wrn as R,Z0e as S,dwe as T,itt as U,uO as V,Upn as W,Nw as X,ean as Y,Mpn as Z,Ae as _,oan as a,HB as a$,Sr as a0,Vr as a1,bet as a2,T2n as a3,Bit as a4,kdr as a5,ldn as a6,Bs as a7,W3 as a8,C1e as a9,V0 as aA,mP as aB,Irt as aC,Fs as aD,Uw as aE,e2n as aF,Jhn as aG,ett as aH,h1e as aI,wr as aJ,urt as aK,kd as aL,_on as aM,o1e as aN,$et as aO,Lw as aP,zet as aQ,pdr as aR,_et as aS,Ean as aT,xcn as aU,_cn as aV,drn as aW,_3 as aX,mL as aY,blt as aZ,G3 as a_,sat as aa,p5 as ab,krt as ac,ya as ad,dg as ae,mO as af,gcn as ag,vgn as ah,Ldr as ai,Ddr as aj,Odr as ak,Rr as al,Mdr as am,egn as an,Y2n as ao,Q2n as ap,n2n as aq,cdr as ar,avn as as,fme as at,Rpn as au,wfn as av,Spn as aw,T1e as ax,BCe as ay,Bw as az,ian as b,nCe as b0,Z4n as b1,H2 as b2,WB as b3,f5 as b4,M1e as b5,V3 as b6,pg as b7,Svn as b8,xvn as b9,brt as ba,wrt as bb,mvn as bc,ylt as bd,Evn as be,Afn as bf,pvn as bg,W4n as bh,Jvn as bi,ole as bj,XW as bk,Ipn as bl,_pn as bm,Npn as bn,$w as bo,I1e as bp,Ert as bq,O1e as br,Vw as bs,DTe as bt,L1e as bu,pT as bv,zu as bw,Ee as bx,Bi as by,so as c,ba as d,yet as e,Ns as f,san as g,W0 as h,xp as i,pdn as j,V8 as k,cn as l,Brt as m,ddr as n,Pdr as o,can as p,uan as q,Bdr as r,lan as s,odn as t,Sh as u,V2n as v,Gpn as w,gdr as x,aan as y,fdr as z};
|
|
6450
|
+
QUEUE_NAME=tasks`,rows:18,className:n.textArea,style:{fontFamily:"SF Mono, Monaco, Inconsolata, Roboto Mono, monospace",fontSize:13,padding:"16px",lineHeight:1.6}})]})},G=Y=>{const K=l[Y]||{models:[{key:"",model:"",provider:"openai",streaming:!1,apiKey:"",baseURL:""}]},Q=(te,ne,oe)=>{const de=[...K.models];de[te]={...de[te],[ne]:oe},s(ue=>({...ue,[Y]:{...ue[Y],models:de}}))},X=()=>{s(te=>({...te,[Y]:{...te[Y],models:[...K.models,{key:"",model:"",provider:"openai",streaming:!1,apiKey:"",baseURL:""}]}}))},re=te=>{K.models.length>1&&s(ne=>({...ne,[Y]:{...ne[Y],models:K.models.filter((oe,de)=>de!==te)}}))};return C.jsxs("div",{className:n.formContainer,children:[C.jsx("div",{style:{marginBottom:32},children:C.jsx(rl,{type:"secondary",style:{fontSize:14,lineHeight:1.6},children:"Configure model lattices. Each model will be registered with the provided key and can be used by agents."})}),K.models.map((te,ne)=>C.jsxs("div",{className:n.card,children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24,paddingBottom:20,borderBottom:"1px solid rgba(0, 0, 0, 0.06)"},children:[C.jsxs("div",{children:[C.jsxs(rl,{strong:!0,style:{fontSize:16},children:["Model ",ne+1]}),te.key&&C.jsxs(rl,{type:"secondary",style:{marginLeft:8,fontSize:12},children:["(",te.key,")"]})]}),K.models.length>1&&C.jsx(tn,{type:"text",danger:!0,size:"small",onClick:()=>re(ne),style:{borderRadius:6,transition:"all 0.2s"},children:"Remove"})]}),C.jsxs(tr,{direction:"vertical",style:{width:"100%"},size:"large",children:[C.jsxs("div",{children:[C.jsx(rl,{className:n.formLabel,children:"Key *"}),C.jsx(Zn,{placeholder:"e.g., default, gpt-4, claude",value:te.key,onChange:oe=>Q(ne,"key",oe.target.value),style:{height:40}}),C.jsx(rl,{className:n.formDescription,children:"Unique identifier for this model"})]}),C.jsxs("div",{children:[C.jsx(rl,{className:n.formLabel,children:"Provider *"}),C.jsx(Vh,{style:{width:"100%",height:40},value:te.provider,onChange:oe=>Q(ne,"provider",oe),options:[{label:"OpenAI",value:"openai"},{label:"Azure",value:"azure"},{label:"DeepSeek",value:"deepseek"},{label:"SiliconCloud",value:"siliconcloud"},{label:"VolcEngine",value:"volcengine"}]})]}),C.jsxs("div",{children:[C.jsx(rl,{className:n.formLabel,children:"Model Name *"}),C.jsx(Zn,{placeholder:"e.g., gpt-4, claude-3-opus, kimi-k2-250905",value:te.model,onChange:oe=>Q(ne,"model",oe.target.value),style:{height:40}})]}),C.jsxs("div",{children:[C.jsx(rl,{className:n.formLabel,children:"API Key"}),C.jsx(Zn.Password,{placeholder:"Enter your API key",value:te.apiKey,onChange:oe=>Q(ne,"apiKey",oe.target.value),style:{height:40}}),C.jsx(rl,{className:n.formDescription,children:"API key for the model provider. Leave empty to use environment variable."})]}),C.jsxs("div",{children:[C.jsx(rl,{className:n.formLabel,children:"Base URL"}),C.jsx(Zn,{placeholder:"e.g., https://api.openai.com/v1",value:te.baseURL,onChange:oe=>Q(ne,"baseURL",oe.target.value),style:{height:40}}),C.jsx(rl,{className:n.formDescription,children:"Optional custom base URL for the API"})]}),C.jsx("div",{children:C.jsxs(tr,{children:[C.jsx(pw,{checked:te.streaming,onChange:oe=>Q(ne,"streaming",oe)}),C.jsx(rl,{children:"Enable Streaming"})]})}),C.jsxs("div",{style:{display:"flex",gap:20},children:[C.jsxs("div",{style:{flex:1},children:[C.jsx(rl,{className:n.formLabel,children:"Max Tokens"}),C.jsx(Zn,{type:"number",placeholder:"e.g., 4096",value:te.maxTokens,onChange:oe=>Q(ne,"maxTokens",oe.target.value?Number(oe.target.value):void 0),style:{height:40}})]}),C.jsxs("div",{style:{flex:1},children:[C.jsx(rl,{className:n.formLabel,children:"Temperature"}),C.jsx(Zn,{type:"number",step:"0.1",placeholder:"e.g., 0.7",value:te.temperature,onChange:oe=>Q(ne,"temperature",oe.target.value?Number(oe.target.value):void 0),style:{height:40}})]})]})]})]},ne)),C.jsx(tn,{type:"dashed",onClick:X,block:!0,size:"large",style:{marginTop:24,height:48},children:"+ Add Model"})]})},F=Y=>{switch(f){case"environment":return j(Y);case"models":return G(Y);default:return null}},H=xGe.find(Y=>Y.key===f);i.find(Y=>Y.id===u);const q=Y=>C.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[C.jsx(eUt,{style:{marginRight:8,color:Y.connected?"#52c41a":Y.connecting?"#1890ff":"#d9d9d9"}}),C.jsx("span",{children:Y.name}),Y.connected&&C.jsx(FFt,{style:{color:"#52c41a",fontSize:12,marginLeft:8}}),Y.error&&!Y.connecting&&C.jsx(xXe,{style:{color:"#ff4d4f",fontSize:12,marginLeft:8}})]}),V=i.map(Y=>({key:Y.id,label:q(Y),children:C.jsx("div",{className:n.tabContent,children:Y.connected?C.jsx(C.Fragment,{children:C.jsxs("div",{style:{display:"flex",height:"100%"},children:[C.jsx("div",{className:n.sidebar,children:xGe.map(K=>C.jsxs("div",{className:`${n.menuItem} ${f===K.key?"active":""}`,onClick:()=>p(K.key),children:[C.jsx("span",{className:n.menuItemIcon,children:K.icon}),C.jsx("span",{className:n.menuItemText,children:K.label})]},K.key))}),C.jsxs("div",{className:n.content,children:[C.jsxs("div",{className:n.contentHeader,children:[C.jsxs("div",{className:n.contentHeaderLeft,children:[C.jsx(Xte,{level:3,className:n.contentTitle,children:H==null?void 0:H.label}),C.jsxs(rl,{className:n.contentDescription,children:[f==="environment"&&"Manage environment variables for the gateway server",f==="models"&&"Configure and register model lattices for use by agents"]})]}),C.jsxs("div",{className:n.contentHeaderRight,children:[C.jsx(tn,{onClick:t,children:"Cancel"}),C.jsx(tn,{type:"primary",icon:C.jsx(kXe,{}),onClick:U,loading:h,children:"Save Configuration"})]})]}),C.jsx("div",{className:n.contentBody,children:F(Y.id)})]})]})}):C.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:16,padding:48},children:Y.connecting?C.jsxs(C.Fragment,{children:[C.jsx(HN,{style:{fontSize:64,color:"#1890ff"},spin:!0}),C.jsx(Xte,{level:4,children:"Connecting..."}),C.jsxs(rl,{type:"secondary",style:{textAlign:"center"},children:["Connecting to ",Y.url]})]}):C.jsxs(C.Fragment,{children:[C.jsx(HN,{style:{fontSize:64,color:"#d9d9d9"}}),C.jsx(Xte,{level:4,type:"secondary",children:Y.error||"Not Connected"}),C.jsx(rl,{type:"secondary",style:{textAlign:"center",maxWidth:400},children:Y.error?`Failed to connect to ${Y.url}. Please check the server URL and try again.`:`Click "Reconnect" to connect to ${Y.url}`}),C.jsx(tn,{type:"primary",icon:C.jsx(HN,{}),onClick:()=>L(Y.id),loading:Y.connecting,style:{marginTop:16},children:"Reconnect"})]})})}),closable:i.length>1}));return C.jsxs(C.Fragment,{children:[C.jsx(ji,{open:e,onCancel:t,height:"70%",width:"80%",footer:null,title:"Settings",children:C.jsx("div",{children:C.jsx(lw,{activeKey:u,onChange:P,type:"editable-card",onEdit:(Y,K)=>{K==="add"?A(!0):K==="remove"&&$(Y)},items:V,addIcon:C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px"},children:[C.jsx(j3,{}),C.jsx("span",{children:"Add Server"})]})})})}),C.jsx(ji,{title:"Add New Server",open:m,onOk:D,onCancel:()=>{A(!1),y(""),x(""),E("")},confirmLoading:w,className:n.addServerModal,children:C.jsxs(tr,{direction:"vertical",style:{width:"100%"},size:"large",children:[C.jsxs("div",{children:[C.jsx(rl,{strong:!0,style:{display:"block",marginBottom:8},children:"Server Name"}),C.jsx(Zn,{placeholder:"e.g., Production Server",value:_,onChange:Y=>x(Y.target.value),onPressEnter:D}),C.jsx(rl,{type:"secondary",style:{fontSize:12,marginTop:4},children:"Optional: Leave empty to use URL as name"})]}),C.jsxs("div",{children:[C.jsx(rl,{strong:!0,style:{display:"block",marginBottom:8},children:"Server URL *"}),C.jsx(Zn,{placeholder:"e.g., http://localhost:4001",value:v,onChange:Y=>y(Y.target.value),onPressEnter:D}),C.jsx(rl,{type:"secondary",style:{fontSize:12,marginTop:4},children:"Enter the full URL of the gateway server"})]}),C.jsxs("div",{children:[C.jsx(rl,{strong:!0,style:{display:"block",marginBottom:8},children:"API Key"}),C.jsx(Zn.Password,{placeholder:"Optional: Enter API key for authentication",value:S,onChange:Y=>E(Y.target.value),onPressEnter:D}),C.jsx(rl,{type:"secondary",style:{fontSize:12,marginTop:4},children:"Optional: API key for server authentication"})]})]})})]})},EGe=()=>{const{settingsModalOpen:e,setSettingsModalOpen:t}=Zo();return C.jsx(Yur,{open:e,onClose:()=>t(!1)})},Kur=({initialAssistantId:e,enableWorkspace:t})=>{const{currentTenant:n}=B5(),r=n==null?void 0:n.id;return C.jsx(C.Fragment,{children:t?C.jsxs(nsr,{tenantId:r,children:[C.jsx(Dje,{autoLoad:!0,initialAssistantId:e,children:C.jsx(Bje,{children:C.jsx(SGe,{})})}),C.jsx(EGe,{})]}):C.jsxs(C.Fragment,{children:[C.jsx(Dje,{autoLoad:!0,initialAssistantId:e,children:C.jsx(Bje,{children:C.jsx(SGe,{})})}),C.jsx(EGe,{})]})})},Xur=e=>{var o,l;const{enableAssistantCreation:t,enableAssistantEditing:n,enableWorkspace:r,...a}=e,i=r??((o=a.initialConfig)==null?void 0:o.enableWorkspace)??!1;return C.jsx(Bor,{initialConfig:{enableAssistantCreation:t,enableAssistantEditing:n,enableWorkspace:i,...a.initialConfig},children:C.jsx(Kur,{initialAssistantId:(l=a.initialConfig)==null?void 0:l.assistantId,enableWorkspace:i})})};const wGe=({width:e=48,height:t=48,className:n=""})=>C.jsx("div",{style:{width:64,height:64,display:"flex",alignItems:"center",justifyContent:"center",padding:8,boxSizing:"border-box",margin:"0 auto"},children:C.jsx("img",{src:"/logo.png",alt:"Logo",width:e,height:t,className:n,style:{objectFit:"contain"}})});function Zte(e,t){const n=parseInt(e.replace("#",""),16),r=Math.round(2.55*t),a=(n>>16)+r,i=(n>>8&255)+r,o=(n&255)+r;return"#"+(16777216+(a<255?a<1?0:a:255)*65536+(i<255?i<1?0:i:255)*256+(o<255?o<1?0:o:255)).toString(16).slice(1)}function Zur(e){return{...JS,token:{...JS.token,colorPrimary:e,colorPrimaryHover:Zte(e,20),colorPrimaryActive:Zte(e,-15),colorPrimaryBg:Zte(e,45)+"20"}}}function Jur(){const e=new URL(window.location.href);if(e.port&&e.port!=="80"&&e.port!=="443"){const t=parseInt(e.port)+1;return`${e.protocol}//${e.hostname}:${t}`}return`${e.protocol}//${e.hostname}/api`}const edr=Zur("#5b50c6"),xue=Jur();function tdr(){return C.jsx(kor,{baseURL:xue,onLoginSuccess:(e,t)=>{console.log("Logged in:",e.name,"Tenants:",t.length)},onTenantSelected:e=>{console.log("Selected tenant:",e.name)},onLogout:()=>{console.log("Logged out")},children:C.jsx(ndr,{})})}function ndr(){const{isAuthenticated:e,user:t,tenants:n,currentTenant:r,selectTenant:a,logout:i}=B5(),[o,l]=le.useState(!1);return e?n.length===0?C.jsxs("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#ffffff",flexDirection:"column",gap:"20px"},children:[C.jsxs("div",{style:{textAlign:"center"},children:[C.jsxs("h2",{children:["Welcome, ",t==null?void 0:t.name,"!"]}),C.jsx("p",{style:{color:"#666",marginTop:"10px"},children:"You don't have access to any tenants yet."}),C.jsx("p",{style:{color:"#999",fontSize:"14px",marginTop:"5px"},children:"Please contact your administrator to be assigned to a tenant."})]}),C.jsx("button",{onClick:i,style:{padding:"10px 20px",background:"#f0f0f0",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Logout"})]}):!r&&n.length>0?C.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#ffffff"},children:C.jsx(Kor,{tenants:n.map(s=>s.tenant).filter(Boolean),onSelect:async s=>{await a(s.id)},title:"Select Your Tenant",description:`Welcome, ${t==null?void 0:t.name}! Choose a tenant to continue`})}):C.jsx(i3t,{config:{baseURL:xue,apiKey:localStorage.getItem("lattice_token")||"",assistantId:"",transport:"sse",headers:{"x-tenant-id":(r==null?void 0:r.id)||""}},children:C.jsx("div",{style:{width:"100vw",height:"100vh",overflow:"hidden"},children:C.jsx(Xur,{initialConfig:{enableSkillSlot:!1,enableDatabaseSlot:!1,resourceFolders:[{name:"/",displayName:"root",allowUpload:!1},{name:"tmp",displayName:"Working Directory",allowUpload:!0},{name:"artifacts",displayName:"artifacts",allowUpload:!1}],enableWorkspace:!0,enableThreadCreation:!0,enableThreadList:!0,baseURL:xue,globalSharedSandboxURL:"https://demo.alphafina.cn/sandbox/global",sidebarMode:"expanded",sidebarDefaultExpanded:!0,sidebarShowToggle:!0,sidebarShowNewAnalysis:!1,sidebarLogoText:"agentall.ai",sidebarLogoIcon:C.jsx(wGe,{width:28,height:28}),assistantId:"new-data-agent"}})})}):o?C.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#ffffff"},children:C.jsx(qor,{onSuccess:()=>l(!1),onCancel:()=>l(!1),footer:C.jsxs("p",{style:{textAlign:"center",marginTop:"20px"},children:["Already have an account?"," ",C.jsx("button",{onClick:()=>l(!1),style:{background:"none",border:"none",color:"#1890ff",cursor:"pointer",textDecoration:"underline"},children:"Sign in"})]})})}):C.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#ffffff"},children:C.jsx(Wor,{title:"agentall.ai",logo:C.jsx(wGe,{}),footer:C.jsxs("p",{style:{textAlign:"center",marginTop:"20px"},children:["Don't have an account?"," ",C.jsx("button",{onClick:()=>l(!0),style:{background:"none",border:"none",color:"#1890ff",cursor:"pointer",textDecoration:"underline"},children:"Create one"})]})})})}const rdr=document.getElementById("root"),adr=AAt.createRoot(rdr);adr.render(C.jsx(Hd,{theme:edr,children:C.jsx(tdr,{})}));export{Rw as $,_S as A,frn as B,fan as C,F1e as D,du as E,det as F,zpn as G,Jcn as H,lwe as I,idn as J,qB as K,_9 as L,$cn as M,Trn as N,kw as O,F6 as P,udr as Q,Wrn as R,Z0e as S,dwe as T,itt as U,uO as V,Upn as W,Nw as X,ean as Y,Mpn as Z,Ae as _,oan as a,HB as a$,Sr as a0,Vr as a1,bet as a2,T2n as a3,Bit as a4,kdr as a5,ldn as a6,Bs as a7,W3 as a8,C1e as a9,V0 as aA,mP as aB,Irt as aC,Fs as aD,Uw as aE,e2n as aF,Jhn as aG,ett as aH,h1e as aI,wr as aJ,urt as aK,kd as aL,_on as aM,o1e as aN,$et as aO,Lw as aP,zet as aQ,pdr as aR,_et as aS,Ean as aT,xcn as aU,_cn as aV,drn as aW,_3 as aX,mL as aY,blt as aZ,G3 as a_,sat as aa,p5 as ab,krt as ac,ya as ad,dg as ae,mO as af,gcn as ag,vgn as ah,Ldr as ai,Ddr as aj,Odr as ak,Rr as al,Mdr as am,egn as an,Y2n as ao,Q2n as ap,n2n as aq,cdr as ar,avn as as,fme as at,Rpn as au,wfn as av,Spn as aw,T1e as ax,BCe as ay,Bw as az,ian as b,nCe as b0,Z4n as b1,H2 as b2,WB as b3,f5 as b4,M1e as b5,V3 as b6,pg as b7,Svn as b8,xvn as b9,brt as ba,wrt as bb,mvn as bc,ylt as bd,Evn as be,Afn as bf,pvn as bg,W4n as bh,Jvn as bi,ole as bj,XW as bk,Ipn as bl,_pn as bm,Npn as bn,$w as bo,I1e as bp,Ert as bq,O1e as br,Vw as bs,DTe as bt,L1e as bu,pT as bv,zu as bw,Ee as bx,Bi as by,so as c,ba as d,yet as e,Ns as f,san as g,W0 as h,xp as i,pdn as j,V8 as k,cn as l,Brt as m,ddr as n,Pdr as o,can as p,uan as q,Bdr as r,lan as s,odn as t,Sh as u,V2n as v,Gpn as w,gdr as x,aan as y,fdr as z};
|