1"use strict";(self.webpackChunkflowise_ui=self.webpackChunkflowise_ui||[]).push([[5702],{69662:(e,t,a)=>{a.d(t,{A:()=>o});var n=a(84738);const o={getAllAPIKeys:()=>n.A.get("/apikey"),createNewAPI:e=>n.A.post("/apikey",e),updateAPI:(e,t)=>n.A.put("/apikey/".concat(e),t),deleteAPI:e=>n.A.delete("/apikey/".concat(e))}},21070:(e,t,a)=>{a.d(t,{A:()=>o});var n=a(84738);const o={getAllChatflows:()=>n.A.get("/chatflows"),getSpecificChatflow:e=>n.A.get("/chatflows/".concat(e)),getSpecificChatflowFromPublicEndpoint:e=>n.A.get("/public-chatflows/".concat(e)),createNewChatflow:e=>n.A.post("/chatflows",e),updateChatflow:(e,t)=>n.A.put("/chatflows/".concat(e),t),deleteChatflow:e=>n.A.delete("/chatflows/".concat(e)),getIsChatflowStreaming:e=>n.A.get("/chatflows-streaming/".concat(e))}},87057:(e,t,a)=>{a.d(t,{A:()=>p});var n=a(43989),o=a(72176),s=a(42534),i=a(89611),r=a(27997),l=a(71987),c=a(41642),d=a(7003),u=a(53497),h=a(80812);const p=e=>{let{show:t,dialogProps:a,onCancel:p,onConfirm:m}=e;const g=document.getElementById("portal"),[f,x]=(0,o.useState)(""),[y,v]=(0,o.useState)(!1);(0,o.useEffect)((()=>{v(!!f)}),[f]);const w=t?(0,h.jsxs)(s.A,{open:t,fullWidth:!0,maxWidth:"xs",onClose:p,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,h.jsx)(i.A,{sx:{fontSize:"1rem"},id:"alert-dialog-title",children:a.title}),(0,h.jsx)(r.A,{children:(0,h.jsx)(l.A,{sx:{mt:1},id:"chatflow-name",type:"text",fullWidth:!0,placeholder:"My New Chatflow",value:f,onChange:e=>x(e.target.value)})}),(0,h.jsxs)(c.A,{children:[(0,h.jsx)(d.A,{onClick:p,children:a.cancelButtonName}),(0,h.jsx)(u.O,{disabled:!y,variant:"contained",onClick:()=>m(f),children:a.confirmButtonName})]})]}):null;return(0,n.createPortal)(w,g)}},85824:(e,t,a)=>{a.d(t,{A:()=>b});var n=a(43989),o=a(84139),s=a(72176),i=a(59423),r=a(7003),l=a(42534),c=a(89611),d=a(27997),u=a(92683),h=a(64124),p=a(71987),m=a(51754),g=a(65773),f=a(41642),x=a(75157),y=a(53497),v=a(96429),w=a(21070),j=a(80812);const b=e=>{let{show:t,dialogProps:a,onCancel:b,onConfirm:A}=e;const C=document.getElementById("portal"),S=(0,o.wA)();(0,v.A)();const k=function(){return S((0,i.M8)(...arguments))},D=function(){return S((0,i.mk)(...arguments))},[I,P]=(0,s.useState)([{prompt:""}
1]),[T,M]=(0,s.useState)({}),N=()=>{P([...I,{prompt:""}])};(0,s.useEffect)((()=>{if(a.chatflow&&a.chatflow.chatbotConfig)try{let e=JSON.parse(a.chatflow.chatbotConfig);if(M(e||{}),e.starterPrompts){let t=[];Object.getOwnPropertyNames(e.starterPrompts).forEach((a=>{e.starterPrompts[a]&&t.push(e.starterPrompts[a])})),P(t)}else P([{prompt:""}])}catch(e){P([{prompt:""}])}return()=>{}}),[a]),(0,s.useEffect)((()=>(S(t?{type:i.sC}:{type:i.dv}),()=>S({type:i.dv}))),[t,S]);const R=t?(0,j.jsxs)(l.A,{onClose:b,open:t,fullWidth:!0,maxWidth:"sm","aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,j.jsx)(c.A,{sx:{fontSize:"1rem"},id:"alert-dialog-title",children:a.title||"Conversation Starter Prompts"}),(0,j.jsxs)(d.A,{children:[(0,j.jsx)("div",{style:{display:"flex",flexDirection:"column",borderRadius:10,background:"#d8f3dc",padding:10},children:(0,j.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,j.jsx)(x.tBz,{size:30,color:"#2d6a4f"}),(0,j.jsx)("span",{style:{color:"#2d6a4f",marginLeft:10,fontWeight:500},children:"Starter prompts will only be shown when there is no messages on the chat"})]})}),(0,j.jsx)(u.A,{sx:{"& > :not(style)":{m:1},pt:2},children:(0,j.jsx)(h.A,{children:I.map(((e,t)=>(0,j.jsxs)("div",{style:{display:"flex",width:"100%"},children:[(0,j.jsx)(u.A,{sx:{width:"95%",mb:1},children:(0,j.jsx)(p.A,{sx:{width:"100%"},type:"text",onChange:e=>((e,t)=>{const{name:a,value:n}=t.target,o=[...I];o[e][a]=n,P(o)})(t,e),size:"small",value:e.prompt,name:"prompt",endAdornment:(0,j.jsx)(m.A,{position:"end",sx:{padding:"2px"},children:I.length>1&&(0,j.jsx)(g.A,{sx:{height:30,width:30},size:"small",color:"error",disabled:1===I.length,onClick:()=>(e=>{const t=[...I];t.splice(e,1),P(t)})(t),edge:"end",children:(0,j.jsx)(x.Eau,{})})})},t)}),(0,j.jsx)(u.A,{sx:{width:"5%",mb:1},children:t===I.length-1&&(0,j.jsx)(g.A,{color:"primary",onClick:N,children:(0,j.jsx)(x.uID,{})})})]},t)))})})]}),(0,j.jsxs)(f.A,{children:[(0,j.jsx)(r.A,{onClick:b,children:"Cancel"}),(0,j.jsx)(y.O,{variant:"contained",onClick:async()=>{try{let e={starterPrompts:{...I}};T.starterPrompts=e.starterPrompts;const t=await w.A.updateChatflow(a.chatflow.id,{chatbotConfig:JSON.stringify(T)});t.data&&(k({message:"Conversation Starter Prompts Saved",options:{key:(new Date).getTime()+Math.random(),variant:"success",action:e=>(0,j.jsx)(r.A,{style:{color:"white"},onClick:()=>D(e),children:(0,j.jsx)(x.MRt,{})})}}),S({type:i.wg,chatflow:t.data})),A()}catch(e){const t=e.response.data||"".concat(e.response.status,": ").concat(e.response.statusText);k({message:"Failed to save Conversation Starter Prompts: ".concat(t),options:{key:(new Date).getTime()+Math.random(),variant:"error",persist:!0,action:e=>(0,j.jsx)(r.A,{style:{color:"white"},onClick:()=>D(e),children:(0,j.jsx)(x.MRt,{})})}})}},children:"Save"})]})]}):null;return(0,n.createPortal)(R,C)}},9421:(e,t,a)=>{a.r(t),a.d(t,{default:()=>ha});var n=a(72176),o=a(19903),s=a(72486),i=a(62172),r=(a(14426),a(84139)),l=a(3998);function c(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];!function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{navigator:a}=(0,n.useContext)(l.jb);(0,n.useEffect)((()=>{if(!t)return;const n=a.block((t=>{const a={...t,retry(){n(),t.retry()}};e(a)}));return n}),[a,e,t])}((0,n.useCallback)((t=>{window.confirm(e)&&t.retry()}),[e]),t)}var d=a(59423),u=a(82747),h=a(7003),p=a(92683),m=a(37167),g=a(82834),f=a(14743),x=a(65773),y=a(96048),v=a(27923),w=a(24795),j=a(91306),b=a(36724),A=a(70214),C=a(98179),S=a(39345),k=a(43989),D=a(42534),I=a(89611),P=a(27997),T=a(77055),M=a(33505),N=a(30919),R=a(82531),E=a(84537),L=a(18991),O=a(25169),F=a(80812);const B=e=>{let{columns:t,rows:a,sx:n}=e;return(0,F.jsx)(F.Fragment,{children:(0,F.jsx)(T.A,{component:M.A,children:(0,F.jsxs)(N.A,{sx:{minWidth:650,...n},"aria-label":"simple table",children:[(0,F.jsx)(R.A,{children:(0,F.jsx)(E.A,{children:t.map(((e,t)=>(0,F.jsx)(L.A,{children:e.charAt(0).toUpperCase()+e.slice(1)},t)))})}),(0,F.jsx)(O.A,{children:a.map(((e,t)=>(0,F.jsx)(E.A,{sx:{"&:last-child td, &:last-child th":{border:0}},children:Object.keys(e).map(((t,a)=>(0,F.jsx)(L.A,{children:e[t]},a)))},t)))})]})})})};var z=a(13706),q=a(84738);const H=e=>q.A.get("/flow-config/".concat(e)),Y=e=>q.A.post("/node-config",e);var J=a(77616);const _=e=>{var t;let{show:a,dialogProps:o,onCancel:s}=e;const i=document.getElementById("portal"),l=(0,r.wA)(),c=(0,J.A)(Y);(0,n.useEffect)((()=>{o.data&&c.request(o.data)}),[o]),(0,n.useEffect)((()=>(l(a?{type:d.sC}:{type:d.dv}),()=>l({type:d.dv}))),[a,l]);const u=a?(0,F.jsxs)(D.A,{onClose:s,open:a,fullWidth:!0,maxWidth:"md","aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,F.jsx)(I.A,{sx:{fontSize:"1rem"},id:"alert-dialog-title",children:o.data&&o.data.name&&o.data.label&&(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,F.jsx)("div",{style:{width:50,height:50,marginRight:10,borderRadius:"50%",backgroundColor:"white"},children:(0,F.jsx)("img",{style:{width:"100%",height:"100%",padding:7,borderRadius:"50%",objectFit:"contain"},alt:o.data.name,src:"".concat(z.VY,"/api/v1/node-icon/").concat(o.data.name)})}),(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"column",marginLeft:10},children:[o.data.label,(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row"},children:[(0,F.jsx)("div",{style:{display:"flex",flexDirection:"row",width:"max-content",borderRadius:15,background:"rgb(254,252,191)",padding:5,paddingLeft:10,paddingRight:10,marginTop:5,marginBottom:5},children:(0,F.jsx)("span",{style:{color:"rgb(116,66,16)",fontSize:"0.825rem"},children:o.data.id})}),o.data.version&&(0,F.jsx)("div",{style:{display:"flex",flexDirection:"row",width:"max-content",borderRadius:15,background:"#e9edc9",padding:5,paddingLeft:10,paddingRight:10,marginTop:5,marginLeft:10,marginBottom:5},children:(0,F.jsxs)("span",{style:{color:"#606c38",fontSize:"0.825rem"},children:["version ",o.data.version]})}),o.data.badge&&(0,F.jsx)("div",{style:{display:"flex",flexDirection:"row",width:"max-content",borderRadius:15,background:"DEPRECATING"===o.data.badge?"#ffe57f":"#52b69a",padding:5,paddingLeft:10,paddingRight:10,marginTop:5,marginLeft:10,marginBottom:5},children:(0,F.jsx)("span",{style:{color:"DEPRECATING"!==o.data.badge?"white":"inherit",fontSize:"0.825rem"},children:o.data.badge})}),o.data.tags&&o.data.tags.length&&o.data.tags.map(((e,t)=>(0,F.jsx)("div",{style:{display:"flex",flexDirection:"row",width:"max-content",borderRadius:15,background:"#cae9ff",padding:5,paddingLeft:10,paddingRight:10,marginTop:5,marginLeft:10,marginBottom:5},children:(0,F.jsx)("span",{style:{color:"#023e7d",fontSize:"0.825rem"},children:e.toLowerCase()})},t)))]})]})]})}),(0,F.jsxs)(P.A,{children:[(null===(t=o.data)||void 0===t?void 0:t.description)&&(0,F.jsx)("div",{style:{padding:10,marginBottom:10},children:(0,F.jsx)("span",{children:o.data.description})}),c.data&&c.data.length>0&&(0,F.jsx)(B,{rows:c.data.map((e=>{const{node:t,nodeId:a,...n}=e;return n})),columns:Object.keys(c.data[0]).slice(-3)})]})]}):null;return(0,k.createPortal)(u,i)};var U=a(75157),V=a(65900),W=a(35278);const K=e=>{var t,a,o,s,i,l;let{data:c}=e;const d=(0,f.A)(),u=(0,r.d4)((e=>e.canvas)),{deleteNode:m,duplicateNode:g}
1=(0,n.useContext)(V.Y),[k,D]=(0,n.useState)(!1),[I,P]=(0,n.useState)({}),[T,M]=(0,n.useState)(!1),[N,R]=(0,n.useState)({}),[E,L]=(0,n.useState)(""),[O,B]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{const e=u.componentNodes.find((e=>e.name===c.name));var t;e&&(c.version?c.version&&e.version>c.version?L(((e,t)=>"Node version ".concat(e," outdated\nUpdate to latest version ").concat(t))(c.version,e.version)):"DEPRECATING"===e.badge&&L("This node will be deprecated in the next release. Change to a new node tagged with NEW"):L((t=e.version,"Node outdated\nUpdate to latest version ".concat(t))))}),[u.componentNodes,c.name,c.version]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(j.A,{content:!1,sx:{padding:0,borderColor:c.selected?d.palette.primary.main:d.palette.text.secondary},border:!1,children:(0,F.jsx)(b.A,{open:!u.canvasDialogShow&&O,onClose:()=>{B(!1)},onOpen:()=>{B(!0)},disableFocusListener:!0,title:(0,F.jsxs)("div",{style:{background:"transparent",display:"flex",flexDirection:"column"},children:[(0,F.jsx)(x.A,{title:"Duplicate",onClick:()=>{g(c.id)},sx:{height:"35px",width:"35px","&:hover":{color:null===d||void 0===d?void 0:d.palette.primary.main}},color:null!==d&&void 0!==d&&null!==(t=d.customization)&&void 0!==t&&t.isDarkMode?null===(a=d.colors)||void 0===a?void 0:a.paper:"inherit",children:(0,F.jsx)(U.bzS,{})}),(0,F.jsx)(x.A,{title:"Delete",onClick:()=>{m(c.id)},sx:{height:"35px",width:"35px","&:hover":{color:"red"}},color:null!==d&&void 0!==d&&null!==(o=d.customization)&&void 0!==o&&o.isDarkMode?null===(s=d.colors)||void 0===s?void 0:s.paper:"inherit",children:(0,F.jsx)(U.Eau,{})}),(0,F.jsx)(x.A,{title:"Info",onClick:()=>{R({data:c}),M(!0)},sx:{height:"35px",width:"35px","&:hover":{color:null===d||void 0===d?void 0:d.palette.secondary.main}},color:null!==d&&void 0!==d&&null!==(i=d.customization)&&void 0!==i&&i.isDarkMode?null===(l=d.colors)||void 0===l?void 0:l.paper:"inherit",children:(0,F.jsx)(U.aid,{})})]}),placement:"right-start",children:(0,F.jsxs)(p.A,{children:[(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,F.jsx)(p.A,{style:{width:50,marginRight:10,padding:5},children:(0,F.jsx)("div",{style:{...d.typography.commonAvatar,...d.typography.largeAvatar,borderRadius:"50%",backgroundColor:"white",cursor:"grab"},children:(0,F.jsx)("img",{style:{width:"100%",height:"100%",padding:5,objectFit:"contain"},src:"".concat(z.VY,"/api/v1/node-icon/").concat(c.name),alt:"Notification"})})}),(0,F.jsx)(p.A,{children:(0,F.jsx)(y.A,{sx:{fontSize:"1rem",fontWeight:500,mr:2},children:c.label})}),(0,F.jsx)("div",{style:{flexGrow:1}}),c.tags&&c.tags.includes("LlamaIndex")&&(0,F.jsx)(F.Fragment,{children:(0,F.jsx)("div",{style:{borderRadius:"50%",padding:15},children:(0,F.jsx)("img",{style:{width:"25px",height:"25px",borderRadius:"50%",objectFit:"contain"},src:W,alt:"LlamaIndex"})})}),E&&(0,F.jsx)(F.Fragment,{children:(0,F.jsx)(w.A,{title:(0,F.jsx)("span",{style:{whiteSpace:"pre-line"},children:E}),placement:"top",children:(0,F.jsx)(x.A,{sx:{height:35,width:35},children:(0,F.jsx)(U.QO,{size:35,color:"orange"})})})})]}),(c.inputAnchors.length>0||c.inputParams.length>0)&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(v.A,{}),(0,F.jsx)(p.A,{sx:{background:d.palette.asyncSelect.main,p:1},children:(0,F.jsx)(y.A,{sx:{fontWeight:500,textAlign:"center"},children:"Inputs"})}),(0,F.jsx)(v.A,{})]}),c.inputAnchors.map(((e,t)=>(0,F.jsx)(A.A,{inputAnchor:e,data:c},t))),c.inputParams.filter((e=>!e.hidden)).map(((e,t)=>(0,F.jsx)(A.A,{inputParam:e,data:c},t))),c.inputParams.find((e=>e.additionalParams))&&(0,F.jsx)("div",{style:{textAlign:"center",marginTop:c.inputParams.filter((e=>e.additionalParams)).length===c.inputParams.length+c.inputAnchors.length?20:0},children:(0,F.jsx)(h.A,{sx:{borderRadius:25,width:"90%",mb:2},variant:"outlined",onClick:()=>{const e={data:c,inputParams:c.inputParams.filter((e=>e.additionalParams)),confirmButtonName:"Save",cancelButtonName:"Cancel"};P(e),D(!0)},children:"Additional Parameters"})}),(0,F.jsx)(v.A,{}),(0,F.jsx)(p.A,{sx:{background:d.palette.asyncSelect.main,p:1}
1,children:(0,F.jsx)(y.A,{sx:{fontWeight:500,textAlign:"center"},children:"Output"})}),(0,F.jsx)(v.A,{}),c.outputAnchors.map(((e,t)=>(0,F.jsx)(C.A,{outputAnchor:e,data:c},t)))]})})}),(0,F.jsx)(S.A,{show:k,dialogProps:I,onCancel:()=>D(!1)}),(0,F.jsx)(_,{show:T,dialogProps:N,onCancel:()=>M(!1)})]})};a(94555);const G=e=>{let{id:t,sourceX:a,sourceY:s,targetX:i,targetY:l,sourcePosition:c,targetPosition:u,style:h={},data:p,markerEnd:m}=e;const[g,f,x]=(0,o.Fp)({sourceX:a,sourceY:s,sourcePosition:c,targetX:i,targetY:l,targetPosition:u}),{deleteEdge:y}=(0,n.useContext)(V.Y),v=(0,r.wA)();return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("path",{id:t,style:h,className:"react-flow__edge-path",d:g,markerEnd:m}),p&&p.label&&(0,F.jsx)(o.R5,{x:a+10,y:s+10,label:p.label,labelStyle:{fill:"black"},labelBgStyle:{fill:"transparent"},labelBgPadding:[2,4],labelBgBorderRadius:2}),(0,F.jsx)("foreignObject",{width:40,height:40,x:f-20,y:x-20,className:"edgebutton-foreignobject",requiredExtensions:"http://www.w3.org/1999/xhtml",children:(0,F.jsx)("div",{children:(0,F.jsx)("button",{className:"edgebutton",onClick:e=>((e,t)=>{e.stopPropagation(),y(t),v({type:d.w1})})(e,t),children:"\xd7"})})})]})};var X=a(26213),Q=a(99036),Z=a(63172),$=a(39806),ee=a(45862),te=a(98503),ae=a(45183),ne=a(64124),oe=a(40947),se=a.n(oe),ie=a(7885),re=a(40144),le=a(56613);const ce={IconTrash:U.Eau,IconFileUpload:U.LYb,IconFileExport:U.mSg,IconCopy:U.bzS,IconSearch:U.C0l,IconMessage:U.pjm,IconPictureInPictureOff:U.ad8},de={id:"settings",title:"",type:"group",children:[{id:"conversationStarters",title:"Starter Prompts",type:"item",url:"",icon:ce.IconPictureInPictureOff},{id:"viewMessages",title:"View Messages",type:"item",url:"",icon:ce.IconMessage},{id:"duplicateChatflow",title:"Duplicate Chatflow",type:"item",url:"",icon:ce.IconCopy},{id:"loadChatflow",title:"Load Chatflow",type:"item",url:"",icon:ce.IconFileUpload},{id:"exportChatflow",title:"Export Chatflow",type:"item",url:"",icon:ce.IconFileExport},{id:"analyseChatflow",title:"Analyse Chatflow",type:"item",url:"",icon:ce.IconSearch},{id:"deleteChatflow",title:"Delete Chatflow",type:"item",url:"",icon:ce.IconTrash}]},ue=e=>{let{chatflow:t,isSettingsOpen:a,anchorEl:o,onSettingsItemClick:s,onUploadFile:i,onClose:r}=e;const l=(0,f.A)(),[c,d]=(0,n.useState)([]),[u,h]=(0,n.useState)(!1);(0,n.useEffect)((()=>{if(t&&!t.id){const e=de.children.filter((e=>"loadChatflow"===e.id));d(e)}else if(t&&t.id){const e=de.children;d(e)}}),[t]),(0,n.useEffect)((()=>{h(a)}),[a]);const m=c.map((e=>(0,F.jsx)(le.A,{item:e,level:1,navType:"SETTINGS",onClick:e=>s(e),onUploadFile:i},e.id)));return(0,F.jsx)(F.Fragment,{children:(0,F.jsx)(te.A,{placement:"bottom-end",open:u,anchorEl:o,role:void 0,transition:!0,disablePortal:!0,popperOptions:{modifiers:[{name:"offset",options:{offset:[170,20]}}]},sx:{zIndex:1e3},children:e=>{let{TransitionProps:t}=e;return(0,F.jsx)(re.A,{in:u,...t,children:(0,F.jsx)(M.A,{children:(0,F.jsx)(ae.x,{onClickAway:r,children:(0,F.jsx)(ie.A,{border:!1,elevation:16,content:!1,boxShadow:!0,shadow:l.shadows[16],children:(0,F.jsx)(se(),{style:{height:"100%",maxHeight:"calc(100vh - 250px)",overflowX:"hidden"},children:(0,F.jsx)(p.A,{sx:{p:2},children:(0,F.jsx)(ne.A,{children:m})})})})})})})}})})};var he=a(87057),pe=a(30416),me=a(23537),ge=a(32852),fe=a(88172),xe=a(90343),ye=a(78306),ve=a(35188),we=a(21280),je=a(44273),be=a(97833),Ae=a(71987),Ce=a(86681),Se=a(53497),ke=a(62619),De=a(21070),Ie=a(96429);const Pe="#ffffff",Te=16,Me="#303235",Ne={backgroundColor:"#f7f8ff",textColor:"#303235"},Re={backgroundColor:"#3B81F6",textColor:"#ffffff"},Ee={backgroundColor:"#ffffff",textColor:"#303235",sendButtonColor:"#3B81F6"},Le=e=>{var t,a,o,s,i,l,c,u,m,g,v,w,j,b,A,C,S,k,D,I,P,T,M,N,R,E,L,O,B,q,H,Y;let{isSessionMemory:J}=e;const _=(0,r.wA)(),V=(0,f.A)(),W=(0,r.d4)((e=>e.canvas.chatflow)),K=W.id,G=W.chatbotConfig?JSON.parse(W.chatbotConfig):{};(0,Ie.A)();const X=function(){return _((0,d.M8)(...arguments))},Q=function(){return _((0,d.mk)(...arguments))}
1,[Z,ee]=(0,n.useState)(null!==(t=W.isPublic)&&void 0!==t&&t),[te,ae]=(0,n.useState)(null!==(a=null===G||void 0===G?void 0:G.generateNewSession)&&void 0!==a&&a),[ne,oe]=(0,n.useState)(null!==(o=null===G||void 0===G?void 0:G.title)&&void 0!==o?o:""),[se,ie]=(0,n.useState)(null!==(s=null===G||void 0===G?void 0:G.titleAvatarSrc)&&void 0!==s?s:""),[re,le]=(0,n.useState)(null!==(i=null===G||void 0===G?void 0:G.welcomeMessage)&&void 0!==i?i:""),[ce,de]=(0,n.useState)(null!==(l=null===G||void 0===G?void 0:G.backgroundColor)&&void 0!==l?l:Pe),[ue,he]=(0,n.useState)(null!==(c=null===G||void 0===G?void 0:G.fontSize)&&void 0!==c?c:Te),[pe,me]=(0,n.useState)(null!==(u=null===G||void 0===G?void 0:G.poweredByTextColor)&&void 0!==u?u:Me),[ge,fe]=(0,n.useState)(null!==(m=null===G||void 0===G||null===(g=G.botMessage)||void 0===g?void 0:g.backgroundColor)&&void 0!==m?m:Ne.backgroundColor),[xe,ye]=(0,n.useState)(null!==(v=null===G||void 0===G||null===(w=G.botMessage)||void 0===w?void 0:w.textColor)&&void 0!==v?v:Ne.textColor),[ve,we]=(0,n.useState)(null!==(j=null===G||void 0===G||null===(b=G.botMessage)||void 0===b?void 0:b.avatarSrc)&&void 0!==j?j:""),[Le,Oe]=(0,n.useState)(null!==(A=null===G||void 0===G||null===(C=G.botMessage)||void 0===C?void 0:C.showAvatar)&&void 0!==A&&A),[Fe,Be]=(0,n.useState)(null!==(S=null===G||void 0===G||null===(k=G.userMessage)||void 0===k?void 0:k.backgroundColor)&&void 0!==S?S:Re.backgroundColor),[ze,qe]=(0,n.use
1State)(null!==(D=null===G||void 0===G||null===(I=G.userMessage)||void 0===I?void 0:I.textColor)&&void 0!==D?D:Re.textColor),[He,Ye]=(0,n.useState)(null!==(P=null===G||void 0===G||null===(T=G.userMessage)||void 0===T?void 0:T.avatarSrc)&&void 0!==P?P:""),[Je,_e]=(0,n.useState)(null!==(M=null===G||void 0===G||null===(N=G.userMessage)||void 0===N?void 0:N.showAvatar)&&void 0!==M&&M),[Ue,Ve]=(0,n.useState)(null!==(R=null===G||void 0===G||null===(E=G.textInput)||void 0===E?void 0:E.backgroundColor)&&void 0!==R?R:Ee.backgroundColor),[We,Ke]=(0,n.useState)(null!==(L=null===G||void 0===G||null===(O=G.textInput)||void 0===O?void 0:O.textColor)&&void 0!==L?L:Ee.textColor),[Ge,Xe]=(0,n.useState)(null!==(B=null===G||void 0===G||null===(q=G.textInput)||void 0===q?void 0:q.placeholder)&&void 0!==B?B:""),[Qe,Ze]=(0,n.useState)(null!==(H=null===G||void 0===G||null===(Y=G.textInput)||void 0===Y?void 0:Y.sendButtonColor)&&void 0!==H?H:Ee.sendButtonColor),[$e,et]=(0,n.useState)(null),[tt,at]=(0,n.useState)(""),[nt,ot]=(0,n.useState)(""),st=Boolean($e),[it,rt]=(0,n.useState)(null),lt=Boolean(it),ct=()=>{const e={botMessage:{showAvatar:!1},userMessage:{showAvatar:!1},textInput:{},overrideConfig:{}};return ne&&(e.title=ne),se&&(e.titleAvatarSrc=se),re&&(e.welcomeMessage=re),ce&&(e.backgroundColor=ce),ue&&(e.fontSize=ue),pe&&(e.poweredByTextColor=pe),ge&&(e.botMessage.backgroundColor=ge),xe&&(e.botMessage.textColor=xe),ve&&(e.botMessage.avatarSrc=ve),Le&&(e.botMessage.showAvatar=Le),Fe&&(e.userMe
1ssage.backgroundColor=Fe),ze&&(e.userMessage.textColor=ze),He&&(e.userMessage.avatarSrc=He),Je&&(e.userMessage.showAvatar=Je),Ue&&(e.textInput.backgroundColor=Ue),We&&(e.textInput.textColor=We),Ge&&(e.textInput.placeholder=Ge),Qe&&(e.textInput.sendButtonColor=Qe),J&&(e.overrideConfig.generateNewSession=te),null!==G&&void 0!==G&&G.starterPrompts&&(e.starterPrompts=G.starterPrompts),e},dt=()=>{rt(null)},ut=(e,t,a)=>(0,F.jsx)(p.A,{sx:{pt:2,pb:2},children:(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[(0,F.jsx)(y.A,{sx:{mb:1},children:a}),(0,F.jsx)(p.A,{sx:{cursor:"pointer",width:"30px",height:"30px",border:"1px solid #616161",marginRight:"10px",backgroundColor:null!==e&&void 0!==e?e:"#ffffff",borderRadius:"5px"},onClick:a=>{at(t),ot(null!==e&&void 0!==e?e:"#ffffff"),et(a.currentTarget)}})]})}),ht=(e,t,a)=>(0,F.jsx)(p.A,{sx:{pt:2,pb:2},children:(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[(0,F.jsx)(y.A,{sx:{mb:1},children:a}),(0,F.jsx)(be.A,{id:t,checked:e,onChange:e=>{((e,t)=>{switch(t){case"botMessageShowAvatar":Oe(e);break;case"userMessageShowAvatar":_e(e);break;case"generateNewSession":ae(e)}})(e.target.checked,t)}})]})}),pt=function(e,t,a){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"string",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return(0,F.jsx)(p.A,{sx:{pt:2,pb:2},children:(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[(0,F.jsx)(y.A,{sx:{mb:1},children:a}),(0,F.jsx)(Ae.A,{id:t,type:n,fullWidth:!0,value:e,placeholder:o,name:t,onChange:e=>{((e,t)=>{switch(t){case"title":oe(e);break;case"titleAvatarSrc":ie(e);break;case"welcomeMessage":le(e);break;case"fontSize":he(e);break;case"botMessageAvatarSrc":we(e);break;case"userMessageAvatarSrc":Ye(e);break;case"textInputPlaceholder":Xe(e)}})(e.target.value,t)}})]})})};return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)($.A,{direction:"row",children:[(0,F.jsx)(y.A,{sx:{p:1,borderRadius:10,backgroundColor:V.palette.primary.light,width:"max-content",height:"max-content"},variant:"h5",children:"".concat(z.VY,"/chatbot/").concat(K)}),(0,F.jsx)(x.A,{title:"Copy Link",color:"success",onClick:e=>{navigator.clipboard.writeText("".concat(z.VY,"/chatbot/").concat(K)),rt(e.currentTarget),setTimeout((()=>{dt()}),1500)},children:(0,F.jsx)(U.bzS,{})}),(0,F.jsx)(x.A,{title:"Open New Tab",color:"primary",onClick:()=>window.open("".concat(z.VY,"/chatbot/").concat(K),"_blank"),children:(0,F.jsx)(U._HF,{})}),(0,F.jsx)("div",{style:{flex:1}}),(0,F.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,F.jsx)(be.A,{checked:Z,onChange:e=>{ee(e.target.checked),(async e=>{try{const t=await De.A.updateChatflow(K,{isPublic:e});t.data&&(X({message:"Chatbot Configuration Saved",options:{key:(new Date).getTime()+Math.random(),variant:"success",action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>Q(e),children:(0,F.jsx)(U.MRt,{})})}}),_({type:d.wg,chatflow:t.data}))}catch(t){console.error(t);const e=t.response.data||"".concat(t.response.status,": ").concat(t.response.statusText);X({message:"Failed to save Chatbot Configuration: ".concat(e),options:{key:(new Date).getTime()+Math.random(),variant:"error",persist:!0,action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>Q(e),children:(0,F.jsx)(U.MRt,{})})}})}})(e.target.checked)}}),(0,F.jsx)(y.A,{children:"Make Public"}),(0,F.jsx)(ke.J,{style:{marginLeft:10},title:"Making public will allow anyone to access the chatbot without username & password"})]})]}),pt(ne,"title","Title","string","Flowise Assistant"),pt(se,"titleAvatarSrc","Title Avatar Link","string","https://raw.githubusercontent.com/FlowiseAI/Flowise/main/assets/FloWiseAI_dark.png"),pt(re,"welcomeMessage","Welcome Message","string","Hello! This is custom welcome message"),ut(ce,"backgroundColor","Background Color"),pt(ue,"fontSize","Font Size","number"),ut(pe,"poweredByTextColor","PoweredBy TextColor"),(0,F.jsx)(y.A,{variant:"h4",sx:{mb:1,mt:2},children:"Bot Message"}
1),ut(ge,"botMessageBackgroundColor","Background Color"),ut(xe,"botMessageTextColor","Text Color"),pt(ve,"botMessageAvatarSrc","Avatar Link","string","https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/parroticon.png"),ht(Le,"botMessageShowAvatar","Show Avatar"),(0,F.jsx)(y.A,{variant:"h4",sx:{mb:1,mt:2},children:"User Message"}),ut(Fe,"userMessageBackgroundColor","Background Color"),ut(ze,"userMessageTextColor","Text Color"),pt(He,"userMessageAvatarSrc","Avatar Link","string","https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png"),ht(Je,"userMessageShowAvatar","Show Avatar"),(0,F.jsx)(y.A,{variant:"h4",sx:{mb:1,mt:2},children:"Text Input"}),ut(Ue,"textInputBackgroundColor","Background Color"),ut(We,"textInputTextColor","Text Color"),pt(Ge,"textInputPlaceholder","TextInput Placeholder","string","Type question.."),ut(Qe,"textInputSendButtonColor","TextIntput Send Button Color"),J&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(y.A,{variant:"h4",sx:{mb:1,mt:2},children:"Session Memory"}),ht(te,"generateNewSession","Start new session when chatbot link is opened or refreshed")]}),(0,F.jsx)(Se.O,{style:{marginBottom:10,marginTop:10},variant:"contained",onClick:()=>(async()=>{try{const e=await De.A.updateChatflow(K,{chatbotConfig:JSON.stringify(ct())});e.data&&(X({message:"Chatbot Configuration Saved",options:{key:(new Date).getTime()+Math.random(),variant:"success",action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>Q(e),children:(0,F.jsx)(U.MRt,{})})}}),_({type:d.wg,chatflow:e.data}))}catch(e){console.error(e);const t=e.response.data||"".concat(e.response.status,": ").concat(e.response.statusText);X({message:"Failed to save Chatbot Configuration: ".concat(t),options:{key:(new Date).getTime()+Math.random(),variant:"error",persist:!0,action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>Q(e),children:(0,F.jsx)(U.MRt,{})})}})}})(),children:"Save Changes"}),(0,F.jsx)(Ce.Ay,{open:st,anchorEl:$e,onClose:()=>{et(null)},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},children:(0,F.jsx)(je.Xq,{color:nt,onChange:e=>(e=>{switch(tt){case"backgroundColor":de(e);break;case"poweredByTextColor":me(e);break;
1case"botMessageBackgroundColor":fe(e);break;case"botMessageTextColor":ye(e);break;case"userMessageBackgroundColor":Be(e);break;case"userMessageTextColor":qe(e);break;case"textInputBackgroundColor":Ve(e);break;case"textInputTextColor":Ke(e);break;case"textInputSendButtonColor":Ze(e)}ot(e)})(e.hex)})}),(0,F.jsx)(Ce.Ay,{open:lt,anchorEl:it,onClose:dt,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},children:(0,F.jsx)(y.A,{variant:"h6",sx:{pl:1,pr:1,color:"white",background:V.palette.success.dark},children:"Copied!"})})]})};var Oe=a(6708),Fe=a(83931);const Be=e=>{let{value:t,label:a,onChange:o,disabled:s=!1}=e;const[i,r]=(0,n.useState)(t);return(0,F.jsx)(F.Fragment,{children:(0,F.jsx)(Oe.A,{sx:{mt:1,width:"100%"},size:"small",control:(0,F.jsx)(Fe.A,{disabled:s,checked:i,onChange:e=>{r(e.target.checked),o(e.target.checked)}}),label:a})})};function ze(e){const{children:t,value:a,index:n,...o}=e;return(0,F.jsx)("div",{role:"tabpanel",hidden:a!==n,id:"attachment-tabpanel-".concat(n),"aria-labelledby":"attachment-tab-".concat(n),...o,children:a===n&&(0,F.jsx)(p.A,{sx:{p:1},children:t})})}function qe(e){return{id:"attachment-tab-".concat(e),"aria-controls":"attachment-tabpanel-".concat(e)}}const He=function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?'button: {\n backgroundColor: "#3B81F6",\n right: 20,\n bottom: 20,\n size: "medium",\n iconColor: "white",\n customIconSrc: "https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg",\n }':'button: {\n backgroundColor: "#3B81F6",\n right: 20,\n bottom: 20,\n size: "medium",\n iconColor: "white",\n customIconSrc: "https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg",\n }'},Ye=function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?'chatWindow: {\n welcomeMessage: "Hello! This is custom welcome message",\n backgroundColor: "#ffffff",\n height: 700,\n width: 400,\n fontSize: 16,\n poweredByTextColor: "#303235",\n botMessage: {\n backgroundColor: "#f7f8ff",\n textColor: "#303235",\n showAvatar: true,\n avatarSrc: "https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/parroticon.png",\n },\n userMessage: {\n backgroundColor: "#3B81F6",\n textColor: "#ffffff",\n showAvatar: true,\n avatarSrc: "https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png",\n },\n textInput: {\n placeholder: "Type your question",\n backgroundColor: "#ffffff",\n textColor: "#303235",\n sendButtonColor: "#3B81F6",\n }\n }':'chatWindow: {\n welcomeMessage: "Hello! This is custom welcome message",\n backgroundColor: "#ffffff",\n height: 700,\n width: 400,\n fontSize: 16,\n poweredByTextColor: "#303235",\n botMessage: {\n backgroundColor: "#f7f8ff",\n textColor: "#303235",\n showAvatar: true,\n avatarSrc: "https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/parroticon.png",\n },\n userMessage: {\n backgroundColor: "#3B81F6",\n textColor: "#ffffff",\n showAvatar: true,\n avatarSrc: "https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png",\n },\n textInput: {\n placeholder: "Type your question",\n backgroundColor: "#ffffff",\n textColor: "#303235",\n sendButtonColor: "#3B81F6",\n }\n }'},Je=e=>{let{chatflowid:t}=e;const a=["Popup Html","Fullpage Html","Popup React","Fullpage React"],[o,s]=(0,n.use
1State)(0),[i,r]=(0,n.useState)(!1),l=e=>{r(e)},c=e=>{switch(e){case"Popup Html":return(e=>'<script type="module">\n import Chatbot from "https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js"\n Chatbot.init({\n chatflowid: "'.concat(e,'",\n apiHost: "').concat(z.VY,'",\n })\n<\/script>'))(t);case"Fullpage Html":return(e=>'<flowise-fullchatbot></flowise-fullchatbot>\n<script type="module">\n import Chatbot from "https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js"\n Chatbot.initFull({\n chatflowid: "'.concat(e,'",\n apiHost: "').concat(z.VY,'",\n })\n<\/script>'))(t);case"Popup React":return(e=>"import { BubbleChat } from 'flowise-embed-react'\n\nconst App = () => {\n return (\n <BubbleChat chatflowid=\"".concat(e,'" apiHost="').concat(z.VY,'" />\n );\n};'))(t);case"Fullpage React":return(e=>'import { FullPageChat } from "flowise-embed-react"\n\nconst App = () => {\n return (\n <FullPageChat\n chatflowid="'.concat(e,'"\n apiHost="').concat(z.VY,'"\n />\n );\n};'))(t);default:return""}},d=e=>{switch(e){case"Popup Html":return(e=>'<script type="module">\n import Chatbot from "https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js"\n Chatbot.init({\n chatflowid: "'.concat(e,'",\n apiHost: "').concat(z.VY,'",\n chatflowConfig: {\n // topK: 2\n },\n theme: {\n ').concat(He(),",\n ").concat(Ye(),"\n }\n })\n<\/script>"))(t);case"Fullpage Html":return(e=>'<flowise-fullchatbot></flowise-fullchatbot>\n<script type="module">\n import Chatbot from "https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js"\n Chatbot.initFull({\n chatflowid: "'.concat(e,'",\n apiHost: "').concat(z.VY,'",\n theme: {\n ').concat(Ye(),"\n }\n })\n<\/script>"))(t);case"Popup React":return(e=>"import { BubbleChat } from 'flowise-embed-react'\n\nconst App = () => {\n return (\n <BubbleChat\n chatflowid=\"".concat(e,'"\n apiHost="').concat(z.VY,'"\n theme={{\n ').concat(He(!0),",\n ").concat(Ye(!0),"\n }}\n />\n );\n};"))(t);case"Fullpage React":return(e=>'import { FullPageChat } from "flowise-embed-react"\n\nconst App = () => {\n return (\n <FullPageChat\n chatflowid="'.concat(e,'"\n apiHost="').concat(z.VY,'"\n theme={{\n ').concat(Ye(!0),"\n }}\n />\n );\n};"))(t);default:return""}};return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:(0,F.jsx)("div",{style:{flex:80},children:(0,F.jsx)(pe.A,{value:o,onChange:(e,t)=>
1{s(t)},"aria-label":"tabs",children:a.map(((e,t)=>(0,F.jsx)(me.A,{label:e,...qe(t)},t)))})})}),(0,F.jsx)("div",{style:{marginTop:10}}),a.map(((e,t)=>(0,F.jsxs)(ze,{value:o,index:t,children:[(0===o||1===o)&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("span",{children:["Paste this anywhere in the ",(0,F.jsx)("code",{children:"<body>"})," tag of your html file.",(0,F.jsxs)("p",{children:["You can also specify a\xa0",(0,F.jsx)("a",{rel:"noreferrer",target:"_blank",href:"https://www.npmjs.com/package/flowise-embed?activeTab=versions",children:"version"}),":\xa0",(0,F.jsx)("code",{children:"https://cdn.jsdelivr.net/npm/flowise-embed@<version>/dist/web.js"})]})]}),(0,F.jsx)("div",{style:{height:10}})]}),(0,F.jsx)(ye.Rc,{theme:ye.iC,text:c(e),language:"javascript",showLineNumbers:!1,wrapLines:!0}),(0,F.jsx)(Be,{label:"Show Embed Chat Config",value:i,onChange:l}),i&&(0,F.jsx)(ye.Rc,{theme:ye.iC,text:d(e),language:"javascript",showLineNumbers:!1,wrapLines:!0})]},t)))]})},_e=()=>{var e,t,a,o,s,i;const l=(0,r.wA)(),c=(0,r.d4)((e=>e.canvas.chatflow)),u=c.id,m=c.apiConfig?JSON.parse(c.apiConfig):{};(0,Ie.A)();const g=function(){return l((0,d.M8)(...arguments))},f=function(){return l((0,d.mk)(...arguments))}
1,[x,v]=(0,n.useState)(null!==(e=null===m||void 0===m||null===(t=m.rateLimit)||void 0===t?void 0:t.limitMax)&&void 0!==e?e:""),[w,j]=(0,n.useState)(null!==(a=null===m||void 0===m||null===(o=m.rateLimit)||void 0===o?void 0:o.limitDuration)&&void 0!==a?a:""),[b,A]=(0,n.useState)(null!==(s=null===m||void 0===m||null===(i=m.rateLimit)||void 0===i?void 0:i.limitMsg)&&void 0!==s?s:""),C=()=>{const e={rateLimit:{}},t=[!x,!w,!b].filter((e=>!1===e));if(t.length>=1&&t.length<=2)throw new Error("Need to fill all rate limit input fields");return 3===t.length&&(e.rateLimit={limitMax:x,limitDuration:w,limitMsg:b}),e},S=function(e,t,a){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"string",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return(0,F.jsx)(p.A,{sx:{pt:2,pb:2},children:(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[(0,F.jsx)(y.A,{sx:{mb:1},children:a}),(0,F.jsx)(Ae.A,{id:t,type:n,fullWidth:!0,value:e,placeholder:o,name:t,onChange:e=>{((e,t)=>{switch(t){case"limitMax":v(e);break;case"limitDuration":j(e);break;case"limitMsg":A(e)}})(e.target.value,t)}})]})})};return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(y.A,{variant:"h4",sx:{mb:1,mt:2},children:["Rate Limit"," ",(0,F.jsx)(ke.J,{style:{mb:1,mt:2,marginLeft:10},title:'Visit <a target="_blank" href="https://docs.flowiseai.com/rate-limit">Rate Limit Setup Guide</a> to set up Rate Limit correctly in your hosting environment.'})]}),S(x,"limitMax","Message Limit per Duration","number"),S(w,"limitDuration","Duration in Second","number"),S(b,"limitMsg","Limit Message","string"),(0,F.jsx)(Se.O,{style:{marginBottom:10,marginTop:10},variant:"contained",onClick:()=>(async()=>{try{const e=await De.A.updateChatflow(u,{apiConfig:JSON.stringify(C())});e.data&&(g({message:"API Configuration Saved",options:{key:(new Date).getTime()+Math.random(),variant:"success",action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>f(e),children:(0,F.jsx)(U.MRt,{})})}}),l({type:d.wg,chatflow:e.data}))}catch(e){console.error(e);const t=e.response?e.response.data||"".concat(e.response.status,": ").concat(e.response.statusText):e.message;g({message:"Failed to save API Configuration: ".concat(t),options:{key:(new Date).getTime()+Math.random(),variant:"error",persist:!0,action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>f(e),children:(0,F.jsx)(U.MRt,{})})}})}})(),children:"Save Changes"})]})};const Ue=a.p+"static/media/python.b0fd2326ee21d9c5524d0d243379c879.svg";const Ve=a.p+"static/media/javascript.0baf38b3d3f5b2d24e87fb5cc2fcfea0.svg";const We=a.p+"static/media/cURL.37eb8ccceafb9e8630a53aa0eb756128.svg";const Ke=a.p+"static/media/embed.289f71beedf481a4fab870e9fed16fec.svg",Ge=a.p+"static/media/sharing.932311c91d3fa05253cc.png";const Xe=a.p+"static/media/settings.09181fb470b6437d7de0fa70595c182a.svg";var Qe=a(69662),Ze=a(91597);function $e(e){const{children:t,value:a,index:n,...o}=e;return(0,F.jsx)("div",{role:"tabpanel",hidden:a!==n,id:"attachment-tabpanel-".concat(n),"aria-labelledby":"attachment-tab-".concat(n),...o,children:a===n&&(0,F.jsx)(p.A,{sx:{p:1},children:t})})}function et(e){return{id:"attachment-tab-".concat(e),"aria-controls":"attachment-tabpanel-".concat(e)}}const tt=e=>{var t,a;let{show:o,dialogProps:s,onCancel:i}=e;const c=document.getElementById("portal"),u=(0,l.Zp)(),h=(0,r.wA)(),p=["Embed","Python","JavaScript","cURL","Share Chatbot","Configuration"],[m,g]=(0,n.useState)(0),[f,x]=(0,n.useState)([]),[v,w]=(0,n.useState)([]),[j,b]=(0,n.useState)(""),[A,C]=(0,n.useState)({}
1),[S,T]=(0,n.useState)(!1),[M,N]=(0,n.useState)({}),[R,E]=(0,n.useState)({}),L=(0,J.A)(Qe.A.getAllAPIKeys),O=(0,J.A)(De.A.updateChatflow),q=(0,J.A)(De.A.getIsChatflowStreaming),Y=(0,J.A)(H),_=e=>{T(e),e&&Y.request(s.chatflowid)},V=e=>(t,a)=>{const n={...R};n[e]=a,E(n)};(0,n.useEffect)((()=>{O.data&&h({type:d.wg,chatflow:O.data})}),[O.data,h]),(0,n.useEffect)((()=>{Y.data&&function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const a={},n=e.reduce((function(e,n){return e[n.node]=e[n.node]||[],e[n.node].push(n),a[n.node]=!!t,e}),Object.create(null));N(n),E(a)}(Y.data)}),[Y.data]);const W=e=>"Python"===e?'import requests\n\nAPI_URL = "'.concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,'"\n\ndef query(payload):\n response = requests.post(API_URL, json=payload)\n return response.json()\n \noutput = query({\n "question": "Hey, how are you?",\n})\n'):"JavaScript"===e?'async function query(data) {\n const response = await fetch(\n "'.concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,'",\n {\n method: "POST",\n headers: {\n "Content-Type": "application/json"\n },\n body: JSON.stringify(data)\n }\n );\n const result = await response.json();\n return result;\n}\n\nquery({"question": "Hey, how are you?"}).then((response) => {\n console.log(response);\n});\n'):"cURL"===e?"curl ".concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,' \\\n -X POST \\\n -d \'{"question": "Hey, how are you?"}\' \\\n -H "Content-Type: application/json"'):"",K=e=>"Python"===e?'import requests\n\nAPI_URL = "'.concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,'"\nheaders = {"Authorization": "Bearer ').concat(null===A||void 0===A?void 0:A.apiKey,'"}\n\ndef query(payload):\n response = requests.post(API_URL, headers=headers, json=payload)\n return response.json()\n \noutput = query({\n "question": "Hey, how are you?",\n})\n'):"JavaScript"===e?'async function query(data) {\n const response = await fetch(\n "'.concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,'",\n {\n headers: {\n Authorization: "Bearer ').concat(null===A||void 0===A?void 0:A.apiKey,'",\n "Content-Type": "application/json"\n },\n method: "POST",\n body: JSON.stringify(data)\n }\n );\n const result = await response.json();\n return result;\n}\n\nquery({"question": "Hey, how are you?"}).then((response) => {\n console.log(response);\n});\n'):"cURL"===e?"curl ".concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,' \\\n -X POST \\\n -d \'{"question": "Hey, how are you?"}\' \\\n -H "Content-Type: application/json" \\\n -H "Authorization: Bearer ').concat(null===A||void 0===A?void 0:A.apiKey,'"'):"",G=e=>"Python"===e?"python":"JavaScript"===e?"javascript":"cURL"===e?"bash":"python",X=e=>"Python"===e?Ue:"JavaScript"===e?Ve:"Embed"===e?Ke:"cURL"===e?We:"Share Chatbot"===e?Ge:"Configuration"===e?Xe:Ue,Q=(e,t)=>{if("Python"===e){let e=(t=(0,Ze.Hn)(t))[0].type;return e.includes(",")&&(e=e.split(",")[0]),'import requests\n\nAPI_URL = "'.concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,'"\n\n# use form data to upload files\nform_data = {\n "files": ',"('example".concat(e,"', open('example").concat(e,"', 'rb'))"),"\n}\nbody_data = {").concat((0,Ze.FL)(t,"formData"),"}\n\ndef query(form_data):\n response = requests.post(API_URL, files=form_data, data=body_data)\n return response.json()\n\noutput = query(form_data)\n")}return"JavaScript"===e?"// use FormData to upload files\nlet formData = new FormData();\n".concat((0,Ze.Q6)(t,"formData"),'\nasync function query(formData) {\n const response = await fetch(\n "').concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,'",\n {\n method: "POST",\n body: formData\n }\n );\n const result = await response.json();\n return result;\n}\n\nquery(formData).then((response) => {\n console.log(response);\n});\n'):"cURL"===e?"curl ".concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid," \\\n -X POST \\").concat((0,Ze.hd)(t,"formData"),' \\\n -H "Content-Type: multipart/form-data"'):""},Z=(e,t)=>{if("Python"===e){let e=(t=(0,Ze.Hn)(t))[0].type;return e.includes(",")&&(e=e.split(",")[0]),'import requests\n\nAPI_URL = "'.concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,'"\nheaders = {"Authorization": "Bearer ').concat(null===A||void 0===A?void 0:A.apiKey,'"}\n\n# use form data to upload files\nform_data = {\n "files": ',"('example".concat(e,"', open('example").concat(e,"', 'rb'))"),"\n}\nbody_data = {").concat((0,Ze.FL)(t,"formData"),"}\n\ndef query(form_data):\n response = requests.post(API_URL, headers=headers, files=form_data, data=body_data)\n return response.json()\n\noutput = query(form_data)\n")}return"JavaScript"===e?"// use FormData to upload files\nlet formData = new FormData();\n".concat((0,Ze.Q6)(t,"formData"),'\nasync function query(formData) {\n const response = await fetch(\n "').concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,'",\n {\n headers: { Authorization: "Bearer ').concat(null===A||void 0===A?void 0:A.apiKey,'" },\n method: "POST",\n body: formData\n }\n );\n const result = await response.json();\n return result;\n}\n\nquery(formData).then((response) => {\n console.log(response);\n});\n'):"cURL"===e?"curl ".concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid," \\\n -X POST \\").concat((0,Ze.hd)(t,"formData"),' \\\n -H "Content-Type: multipart/form-data" \\\n -H "Authorization: Bearer ').concat(null===A||void 0===A?void 0:A.apiKey,'"'):""},$=(e,t)=>"Python"===e?'import requests\n\nAPI_URL = "'.concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,'"\n\ndef query(payload):\n response = requests.post(API_URL, json=payload)\n return response.json()\n\noutput = query({\n "question": "Hey, how are you?",\n "overrideConfig": {').concat((0,Ze.FL)(t,"json"),"\n }\n}
1)\n"):"JavaScript"===e?'async function query(data) {\n const response = await fetch(\n "'.concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,'",\n {\n method: "POST",\n headers: {\n "Content-Type": "application/json"\n },\n body: JSON.stringify(data)\n }\n );\n const result = await response.json();\n return result;\n}\n\nquery({\n "question": "Hey, how are you?",\n "overrideConfig": {').concat((0,Ze.Q6)(t,"json"),"\n }\n}).then((response) => {\n console.log(response);\n});\n"):"cURL"===e?"curl ".concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,' \\\n -X POST \\\n -d \'{"question": "Hey, how are you?", "overrideConfig": {').concat((0,Ze.hd)(t,"json"),'}\' \\\n -H "Content-Type: application/json"'):"",ee=(e,t)=>"Python"===e?'import requests\n\nAPI_URL = "'.concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,'"\nheaders = {"Authorization": "Bearer ').concat(null===A||void 0===A?void 0:A.apiKey,'"}\n\ndef query(payload):\n response = requests.post(API_URL, headers=headers, json=payload)\n return response.json()\n\noutput = query({\n "question": "Hey, how are you?",\n "overrideConfig": {').concat((0,Ze.FL)(t,"json"),"\n }\n})\n"):"JavaScript"===e?'async function query(data) {\n const response = await fetch(\n "'.concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,'",\n {\n headers: {\n Authorization: "Bearer ').concat(null===A||void 0===A?void 0:A.apiKey,'",\n "Content-Type": "application/json"\n },\n method: "POST",\n body: JSON.stringify(data)\n }\n );\n const result = await response.json();\n return result;\n}\n\nquery({\n "question": "Hey, how are you?",\n "overrideConfig": {').concat((0,Ze.Q6)(t,"json"),"\n }\n}).then((response) => {\n console.log(response);\n});\n"):"cURL"===e?"curl ".concat(z.VY,"/api/v1/prediction/").concat(s.chatflowid,' \\\n -X POST \\\n -d \'{"question": "Hey, how are you?", "overrideConfig": {').concat((0,Ze.hd)(t,"json"),'}\' \\\n -H "Content-Type: application/json" \\\n -H "Authorization: Bearer ').concat(null===A||void 0===A?void 0:A.apiKey,'"'):"",te=e=>"Python"===e?'body_data = {\n "openAIApiKey[chatOpenAI_0]": "sk-my-openai-1st-key",\n "openAIApiKey[openAIEmbeddings_0]": "sk-my-openai-2nd-key"\n}':"JavaScript"===e?'formData.append("openAIApiKey[chatOpenAI_0]", "sk-my-openai-1st-key")\nformData.append("openAIApiKey[openAIEmbeddings_0]", "sk-my-openai-2nd-key")':"cURL"===e?'-F "openAIApiKey[chatOpenAI_0]=sk-my-openai-1st-key" \\\n-F "openAIApiKey[openAIEmbeddings_0]=sk-my-openai-2nd-key" \\':void 0;(0,n.useEffect)((()=>{if(L.data){const e=[{label:"No Authorization",name:""}];for(const t of L.data)e.push({label:t.keyName,name:t.id});e.push({label:"- Add New Key -",name:"addnewkey"}),x(e),w(L.data),s.chatflowApiKeyId&&(b(s.chatflowApiKeyId),C(L.data.find((e=>e.id===s.chatflowApiKeyId))))}}),[s,L.data]),(0,n.useEffect)((()=>{o&&(L.request(),q.request(s.chatflowid))}),[o]);const ae=o?(0,F.jsxs)(D.A,{open:o,fullWidth:!0,maxWidth:"md",onClose:i,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,F.jsx)(I.A,{sx:{fontSize:"1rem"},id:"alert-dialog-title",children:s.title}),(0,F.jsxs)(P.A,{children:[(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,F.jsx)("div",{style:{flex:80},children:(0,F.jsx)(pe.A,{value:m,onChange:(e,t)=>
1{g(t)},"aria-label":"tabs",children:p.map(((e,t)=>(0,F.jsx)(me.A,{icon:(0,F.jsx)("img",{style:{objectFit:"cover",height:15,width:"auto"},src:X(e),alt:"code"}),iconPosition:"start",label:e,...et(t)},t)))})}),(0,F.jsx)("div",{style:{flex:20},children:(0,F.jsx)(we.m,{name:"SelectKey",disableClearable:!0,options:f,onSelect:e=>(e=>{if("addnewkey"===e)return void u("/apikey");b(e),C(v.find((t=>t.id===e)));const t={apikeyid:e};O.request(s.chatflowid,t)})(e),value:null!==(t=null!==(a=s.chatflowApiKeyId)&&void 0!==a?a:j)&&void 0!==t?t:"Choose an API key"})})]}),(0,F.jsx)("div",{style:{marginTop:10}}),p.map(((e,t)=>{var a;return(0,F.jsxs)($e,{value:m,index:t,children:[("Embed"===e||"Share Chatbot"===e)&&j&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("p",{children:"You cannot use API key while embedding/sharing chatbot."}),(0,F.jsxs)("p",{children:["Please select ",(0,F.jsx)("b",{children:'"No Authorization"'})," from the dropdown at the top right corner."]})]}),"Embed"===e&&!j&&(0,F.jsx)(Je,{chatflowid:s.chatflowid}),"Embed"!==e&&"Share Chatbot"!==e&&"Configuration"!==e&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(ye.Rc,{theme:ye.iC,text:j?K(e):W(e),language:G(e),showLineNumbers:!1,wrapLines:!0}),(0,F.jsx)(Be,{label:"Show Input Config",value:S,onChange:_}),S&&Y.data&&Y.data.length>0&&(0,F.jsxs)(F.Fragment,{children:[Object.keys(M).sort().map((e=>(0,F.jsxs)(ge.A,{expanded:R[e]||!1,onChange:V(e),disableGutters:!0,children:[(0,F.jsx)(fe.A,{expandIcon:(0,F.jsx)(ve.A,{}),"aria-controls":"nodes-accordian-".concat(e),id:"nodes-accordian-header-".concat(e),children:(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,F.jsx)(y.A,{variant:"h5",children:e}),(0,F.jsx)("div",{style:{display:"flex",flexDirection:"row",width:"max-content",borderRadius:15,background:"rgb(254,252,191)",padding:5,paddingLeft:10,paddingRight:10,marginLeft:10},children:(0,F.jsx)("span",{style:{color:"rgb(116,66,16)",fontSize:"0.825rem"},children:M[e][0].nodeId})})]})}),(0,F.jsx)(xe.A,{children:(0,F.jsx)(B,{rows:M[e].map((e=>{const{node:t,nodeId:a,...n}=e;return n})),columns:Object.keys(M[e][0]).slice(-3)})})]},e))),(0,F.jsx)(ye.Rc,{theme:ye.iC,text:j?s.isFormDataRequired?Z(e,Y.data):ee(e,Y.data):s.isFormDataRequired?Q(e,Y.data):$(e,Y.data),language:G(e),showLineNumbers:!1,wrapLines:!0}),(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"column",borderRadius:10,background:"#d8f3dc",padding:10,marginTop:10,marginBottom:10},children:[(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,F.jsx)(U.tBz,{size:30,color:"#2d6a4f"}),(0,F.jsx)("span",{style:{color:"#2d6a4f",marginLeft:10,fontWeight:500},children:"You can also specify multiple values for a config parameter by specifying the node id"})]}),(0,F.jsx)("div",{style:{padding:10},children:(0,F.jsx)(ye.Rc,{theme:ye.iC,text:s.isFormDataRequired?te(e):'{\n "overrideConfig": {\n "openAIApiKey": {\n "chatOpenAI_0": "sk-my-openai-1st-key",\n "openAIEmbeddings_0": "sk-my-openai-2nd-key"\n }\n }\n}',language:G(e),showLineNumbers:!1,wrapLines:!0})})]})]}),(null===(a=q.data)||void 0===a?void 0:a.isStreaming)&&(0,F.jsxs)("p",{children:["Read\xa0",(0,F.jsx)("a",{rel:"noreferrer",target:"_blank",href:"https://docs.flowiseai.com/how-to-use#streaming",children:"here"}),"\xa0on how to stream response back to application"]})]}),"Share Chatbot"===e&&!j&&(0,F.jsx)(Le,{isSessionMemory:s.isSessionMemory}),"Configuration"===e&&(0,F.jsx)(_e,{})]},t)}))]})]}):null;return(0,k.createPortal)(ae,c)};var at=a(70824),nt=a(50962),ot=a(32285),st=a(41642),it=a(2755),rt=a(52770),lt=a(18624);const ct=a.p+"static/media/langchain.03999e05472fc2689e39.png";const dt=a.p+"static/media/langfuse.ff295078d3cf434ac5dc3db3632ff65c.svg";const ut=a.p+"static/media/lunary.1754142e045906a0d3edb6b5ba6cf8f8.svg",ht=[{label:"LangSmith",name:"langSmith",icon:ct,url:"https://smith.langchain.com",inputs:[{label:"Connect Credential",name:"credential",type:"credential",credentialNames:["langsmithApi"]},{label:"Project Name",name:"projectName",type:"string",optional:!0,description:"If not provided, default will be used",placeholder:"default"},{label:"On/Off",name:"status",type:"boolean",optional:!0}]},{label:"LangFuse",name:"langFuse",icon:dt,url:"https://langfuse.com",input
1s:[{label:"Connect Credential",name:"credential",type:"credential",credentialNames:["langfuseApi"]},{label:"Release",name:"release",type:"string",optional:!0,description:"The release number/hash of the application to provide analytics grouped by release"},{label:"On/Off",name:"status",type:"boolean",optional:!0}]},{label:"Lunary",name:"lunary",icon:ut,url:"https://lunary.ai",inputs:[{label:"Connect Credential",name:"credential",type:"credential",credentialNames:["lunaryApi"]},{label:"On/Off",name:"status",type:"boolean",optional:!0}]}],pt=e=>{let{show:t,dialogProps:a,onCancel:o}=e;const s=document.getElementById("portal"),i=(0,r.wA)();(0,Ie.A)();const l=function(){return i((0,d.M8)(...arguments))},c=function(){return i((0,d.mk)(...arguments))},[u,m]=(0,n.useState)({}),[g,f]=(0,n.useState)({}),x=(e,t,a)=>{let n={};n=Object.prototype.hasOwnProperty.call(u,t)?{...u}:{...u,[t]:{}},n[t][a]=e,m(n)};(0,n.useEffect)((()=>{if(a.chatflow&&a.chatflow.analytic)try{m(JSON.parse(a.chatflow.analytic))}catch(e){m({}),console.error(e)}return()=>{m({}),f({})}}),[a]),(0,n.useEffect)((()=>(i(t?{type:d.sC}:{type:d.dv}),()=>i({type:d.dv}))),[t,i]);const v=t?(0,F.jsxs)(D.A,{onClose:o,open:t,fullWidth:!0,maxWidth:"sm","aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,F.jsx)(I.A,{sx:{fontSize:"1rem"},id:"alert-dialog-title",children:"Analyse Chatflow"}),(0,F.jsx)(P.A,{children:ht.map(((e,t)=>{return(0,F.jsxs)(ge.A,{expanded:g[e.name]||!1,onChange:(a=e.name,(e,t)=>{const n={...g};n[a]=t,f(n)}),disableGutters:!0,children:[(0,F.jsx)(fe.A,{expandIcon:(0,F.jsx)(ve.A,{}),"aria-controls":e.name,id:e.name,children:(0,F.jsxs)(at.Ay,{style:{padding:0,margin:0},alignItems:"center",children:[(0,F.jsx)(nt.A,{children:(0,F.jsx)("div",{style:{width:50,height:50,borderRadius:"50%",backgroundColor:"white"},children:(0,F.jsx)("img",{style:{width:"100%",height:"100%",padding:10,objectFit:"contain"},alt:"AI",src:e.icon})})}),(0,F.jsx)(ot.A,{sx:{ml:1},primary:e.label,secondary:(0,F.jsx)("a",{target:"_blank",rel:"noreferrer",href:e.url,children:e.url})}),u[e.name]&&u[e.name].status&&(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignContent:"center",alignItems:"center",background:"#d8f3dc",borderRadius:15,padding:5,paddingLeft:7,paddingRight:7,marginRight:10},children:[(0,F.jsx)("div",{style:{width:15,height:15,borderRadius:"50%",backgroundColor:"#70e000"}}),(0,F.jsx)("span",{style:{color:"#006400",marginLeft:10},children:"ON"})]})]})}),(0,F.jsx)(xe.A,{children:e.inputs.map(((t,a)=>{var n,o;return(0,F.jsxs)(p.A,{sx:{p:2},children:[(0,F.jsx)("div",{style:{display:"flex",flexDirection:"row"},children:(0,F.jsxs)(y.A,{children:[t.label,!t.optional&&(0,F.jsx)("span",{style:{color:"red"},children:"\xa0*"}),t.description&&(0,F.jsx)(ke.J,{style:{marginLeft:10},title:t.description})]})}),g[e.name]&&"credential"===t.type&&(0,F.jsx)(it.A,{data:u[e.name]?{credential:u[e.name].credentialId}:{},inputParam:t,onSelect:t=>x(t,e.name,"credentialId")}),g[e.name]&&"boolean"===t.type&&(0,F.jsx)(rt.d,{onChange:a=>x(a,e.name,t.name),value:u[e.name]?u[e.name][t.name]:null!==(n=t.default)&&void 0!==n&&n}),g[e.name]&&("string"===t.type||"password"===t.type||"number"===t.type)&&(0,F.jsx)(lt.p,{inputParam:t,onChange:a=>x(a,e.name,t.name),value:u[e.name]?u[e.name][t.name]:null!==(o=t.default)&&void 0!==o?o:""})]},a)}))})]},t);var a}))}),(0,F.jsx)(st.A,{children:(0,F.jsx)(Se.O,{variant:"contained",onClick:async()=>{try{const e=await De.A.updateChatflow(a.chatflow.id,{analytic:JSON.stringify(u)});e.data&&(l({message:"Analytic Configuration Saved",options:{key:(new Date).getTime()+Math.random(),variant:"success",action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>c(e),children:(0,F.jsx)(U.MRt,{})})}}),i({type:d.wg,chatflow:e.data})),o()}catch(e){const t=e.response.data||"".concat(e.response.status,": ").concat(e.response.statusText);l({message:"Failed to save Analytic Configuration: ".concat(t),options:{key:(new Date).getTime()+Math.random(),variant:"error",persist:!0,action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>c(e),children:(0,F.jsx)(U.MRt,{})})}})}},children:"Save"})})]}):null;return(0,k.createPortal)(v,s)};var mt=a(15521),gt=a.n(mt),ft=a(79669),xt=a(15500),yt=a(6791),vt=a(41740),wt=a(74075),jt=a(61495),bt=a(10248),At=a(78302),Ct=a.n(At),St=a(9363);const kt=a.p+"static/media/account.bccec459ac1b2deab2d2.png";const Dt=a.p+"static/media/message_empty.e64ce71827642b3667c24731d5cfaaa0.svg";var It=a(67263),Pt=a(67667),Tt=a(79967),Mt=a.n(Tt);const Nt=e=>{var t;let{show:a,dialogProps:o,onCancel:s}=e;const i=document.getElementById("portal"),l=(0,r.d4)((e=>
1e.customization)),[c,d]=(0,n.useState)({});(0,n.useEffect)((()=>(o.data&&d(o.data),()=>{d({})})),[o]);const u=a?(0,F.jsxs)(D.A,{onClose:s,open:a,fullWidth:!0,maxWidth:"sm","aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,F.jsx)(I.A,{sx:{fontSize:"1rem"},id:"alert-dialog-title",children:null!==(t=o.title)&&void 0!==t?t:"Source Documents"}),(0,F.jsx)(P.A,{children:(0,F.jsx)(Mt(),{theme:l.isDarkMode?"ocean":"rjv-default",style:{padding:10,borderRadius:10},src:c,name:null,quotesOnKeys:!1,enableClipboard:!1,displayDataTypes:!1})})]}):null;return(0,k.createPortal)(u,i)};var Rt=a(66261);const Et=e=>q.A.get("/internal-chatmessage/".concat(e)),Lt=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return q.A.get("/chatmessage/".concat(e),{params:{order:"DESC",...t}})},Ot=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return q.A.get("/chatmessage/".concat(e),{params:{order:"ASC",...t}})},Ft=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return q.A.delete("/chatmessage/".concat(e),{params:{...t}})};var Bt=a(21240);a(47522);const zt=(0,n.forwardRef)((function(e,t){let{value:a,onClick:n}=e;return(0,F.jsx)(jt.A,{style:{borderRadius:15,border:"1px solid #e0e0e0"},onClick:n,ref:t,children:a})})),qt=e=>{let{show:t,dialogProps:a,onCancel:o}=e;const s=document.getElementById("portal"),i=(0,r.wA)(),l=(0,f.A)(),c=(0,r.d4)((e=>e.customization)),{confirm:u}=(0,Bt.A)();(0,Ie.A)();const m=function(){return i((0,d.M8)(...arguments))},g=function(){return i((0,d.mk)(...arguments))},[x,y]=(0,n.useState)([]),[v,j]=(0,n.useState)([]),[b,A]=(0,n.useState)([]),[C,S]=(0,n.useState)(0),[T,M]=(0,n.useState)(!1),[N,R]=(0,n.useState)({}),[E,L]=(0,n.useState)([]),[O,B]=(0,n.useState)((new Date).setMonth((new Date).getMonth()-1)),[q,H]=(0,n.useState)(new Date),Y=(0,J.A)(Lt),_=(0,J.A)(Ot),V=e=>{var t,a;const n=e.chatId,o=null!==(t=e.memoryType)&&void 0!==t?t:"null",s=null!==(a=e.sessionId)&&void 0!==a?a:"null";return"".concat(n,"_").concat(o,"_").concat(s)},W=e=>{let[t,a,...n]=e.split("_");const o=t,s=a,i=n.join("_"),r={chatId:o};return"null"!==s&&(r.memoryType=s),"null"!==i&&(r.sessionId=i),r},K=(e,t)=>{R({data:e,title:t}),M(!0)};(0,n.useEffect)((()=>{_.data&&(e=>{let t="";const a=[];for(let n=0;n<e.length;n+=1){const o=e[n];if(t){const e=o.createdDate.split("T")[0];e!==t&&(t=e,a.push({message:o.createdDate,type:"timeMessage"}))}else t=o.createdDate.split("T")[0],a.push({message:o.createdDate,type:"timeMessage"});const s={...o,message:o.content,type:o.role};o.sourceDocuments&&(s.sourceDocuments=JSON.parse(o.sourceDocuments)),o.usedTools&&(s.usedTools=JSON.parse(o.usedTools)),o.fileAnnotations&&(s.fileAnnotations=JSON.parse(o.fileAnnotations)),a.push(s)}A(a)})(_.data)}),[_.data]),(0,n.useEffect)((()=>{if(Y.data){j(Y.data);const e=(e=>{const t={},a=[];for(let n=0;n<e.length;n+=1){const o=V(e[n]),s=e[n];Object.prototype.hasOwnProperty.call(t,o)?Object.prototype.hasOwnProperty.call(t,o)&&1===t[o].counter&&(t[o]={counter:2,item:{...t[o].item,apiContent:"apiMessage"===t[o].item.role?"Bot: ".concat(t[o].item.content):"User: ".concat(t[o].item.content),userContent:"apiMessage"===s.role?"Bot: ".concat(s.content):"User: ".concat(s.content)}},a.push(t[o].item)):t[o]={counter:1,item:e[n]}}if(y(a),a.length)return V(a[0])})(Y.data);S(0),e&&_.request(a.chatflow.id,W(e))}}),[Y.data]),(0,n.useEffect)((()=>(a.chatflow&&Y.request(a.chatflow.id),()=>{y([]),j([]),A([]),L([]),S(0),B((new Date).setMonth((new Date).getMonth()-1)),H(new Date)})),[a]),(0,n.useEffect)((()=>(i(t?{type:d.sC}:{type:d.dv}),()=>i({type:d.dv}))),[t,i]);const G=t?(0,F.jsxs)(D.A,{onClose:o,open:t,fullWidth:!0,maxWidth:x&&0==x.length?"md":"lg","aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,F.jsx)(I.A,{sx:{fontSize:"1rem"},id:"alert-dialog-title",children:(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row"},children:[a.title,(0,F.jsx)("div",{style:{flex:1}}),(0,F.jsx)(h.A,{variant:"outlined",onClick:()=>(()=>{const e={};for(let a=0;a<v.length;a+=1){const o=v[a],s=V(o),i={content:o.content,role:"apiMessage"===o.role?"bot":"user",time:o.createdDate};var t,n;o.sourceDocuments&&(i.sourceDocuments=JSON.parse(o.sourceDocuments)),o.usedTools&&(i.usedTools=JSON.parse(o.usedTools)),o.fileAnnotations&&(i.fileAnnotations=JSON.parse(o.fileAnnotations)),Object.prototype.hasOwnProperty.call(e,s)?Object.prototype.hasOwnProperty.call(e,s)&&(e[s].messages=[...e[s].messages,i]):e[s]={id:o.chatId,source:"INTERNAL"===o.chatType?"UI":"API/Embed",sessionId:null!==(t=o.sessionId)&&void 0!==t?t:null,memoryType:null!==(n=o.memoryType)&&void 0!==n?n:null,messages:[i]}}const o=[];for(const a in e)o.push({...e[a]});for(let a=0;a<o.length;a+=1)o[a].messages=o[a].messages.reverse();const s=JSON.stringify(o,null,2),i="data:application/json;charset=utf-8,"+encodeURIComponent(s),r="".concat(a.chatflow.id,"-Message.json");
1let l=document.createElement("a");l.setAttribute("href",i),l.setAttribute("download",r),l.click()})(),startIcon:(0,F.jsx)(U.mSg,{}),children:"Export"})]})}),(0,F.jsx)(P.A,{children:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",width:"100%",marginBottom:10},children:[(0,F.jsxs)("div",{style:{marginRight:10},children:[(0,F.jsx)("b",{style:{marginRight:10},children:"From Date"}),(0,F.jsx)(Ct(),{selected:O,onChange:e=>(e=>{B(e),Y.request(a.chatflow.id,{startDate:e,endDate:q,chatType:E.length?E:void 0})})(e),selectsStart:!0,startDate:O,endDate:q,customInput:(0,F.jsx)(zt,{})})]}),(0,F.jsxs)("div",{style:{marginRight:10},children:[(0,F.jsx)("b",{style:{marginRight:10},children:"To Date"}),(0,F.jsx)(Ct(),{selected:q,onChange:e=>(e=>{H(e),Y.request(a.chatflow.id,{endDate:e,startDate:O,chatType:E.length?E:void 0})})(e),selectsEnd:!0,startDate:O,endDate:q,minDate:O,maxDate:new Date,customInput:(0,F.jsx)(zt,{})})]}),(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",minWidth:"200px",marginRight:10},children:[(0,F.jsx)("b",{style:{marginRight:10},children:"Source"}),(0,F.jsx)(Rt.X,{name:"chatType",options:[{label:"UI",name:"INTERNAL"},{label:"API/Embed",name:"EXTERNAL"}],onSelect:e=>{return L(t=e),void Y.request(a.chatflow.id,{chatType:t.length?t:void 0,startDate:O,endDate:q});var t},value:E,formControlSx:{mt:0}},JSON.stringify(E))]}),(0,F.jsx)("div",{style:{flex:1}})]}),(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row"},children:[x&&0==x.length&&(0,F.jsxs)($.A,{sx:{alignItems:"center",justifyContent:"center",width:"100%"},flexDirection:"column",children:[(0,F.jsx)(p.A,{sx:{p:5,height:"auto"},children:(0,F.jsx)("img",{style:{objectFit:"cover",height:"20vh",width:"auto"},src:Dt,alt:"msgEmptySVG"})}),(0,F.jsx)("div",{children:"No Messages"})]}),x&&x.length>0&&(0,F.jsx)("div",{style:{flexBasis:"40%"},children:(0,F.jsx)(p.A,{sx:{overflowY:"auto",display:"flex",flexGrow:1,flexDirection:"column",maxHeight:"calc(100vh - 260px)"},children:x.map(((e,t)=>(0,F.jsx)(jt.A,{sx:{p:0,borderRadius:"".concat(c.borderRadius,"px"),boxShadow:"0 2px 14px 0 rgb(32 40 45 / 8%)",mt:1,ml:1,mr:1,mb:t===x.length-1?1:0},selected:C===t,onClick:()=>((e,t)=>{S(e),_.request(a.chatflow.id,W(V(t)))})(t,e),children:(0,F.jsx)(at.Ay,{alignItems:"center",children:(0,F.jsx)(ot.A,{primary:(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"column",marginBottom:10},children:[(0,F.jsx)("span",{children:null===e||void 0===e?void 0:e.userContent}),(0,F.jsx)("div",{style:{maxHeight:"100px",maxWidth:"400px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:null===e||void 0===e?void 0:e.apiContent})]}),secondary:gt()(e.createdDate).format("MMMM Do YYYY, h:mm:ss a")})})},t)))})}),x&&x.length>0&&(0,F.jsxs)("div",{style:{flexBasis:"60%",paddingRight:"30px"},children:[b&&b.length>1&&(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row"},children:[(0,F.jsxs)("div",{style:{flex:1,marginLeft:"20px",marginBottom:"15px",marginTop:"10px"},children:[b[1].sessionId&&(0,F.jsxs)("div",{children:["Session Id:\xa0",(0,F.jsx)("b",{children:b[1].sessionId})]}),b[1].chatType&&(0,F.jsxs)("div",{children:["Source:\xa0",(0,F.jsx)("b",{children:"INTERNAL"===b[1].chatType?"UI":"API/Embed"})]}),b[1].memoryType&&(0,F.jsxs)("div",{children:["Memory:\xa0",(0,F.jsx)("b",{children:b[1].memoryType})]})]}),(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignContent:"center",alignItems:"end"},children:[(0,F.jsx)(Se.O,{sx:{height:"max-content",width:"max-content"},variant:"outlined",color:"error",title:"Clear Message",onClick:()=>(async e=>{const t={title:"Clear Session",description:e.sessionId&&e.memoryType?"Are you sure you want to clear session id: ".concat(e.sessionId," from ").concat(e.memoryType,"?"):"Are you sure you want to clear messages?",confirmButtonName:"Clear",cancelButtonName:"Cancel"},n=await u(t),o=a.chatflow.id;if(n)try{const t={chatflowid:o,isClearFromViewMessageDialog:!0};e.chatId&&(t.chatId=e.chatId),e.chatType&&(t.chatType=e.chatType),e.memoryType&&(t.memoryType=e.memoryType),e.sessionId&&(t.sessionId=e.sessionId),await Ft(o,t);const a=e.sessionId&&e.memoryType?"Succesfully cleared session id: ".concat(e.sessionId," from ").concat(e.memoryType):"Succesfully cleared messages";m({message:a,options:{key:(new Date).getTime()+Math.random(),variant:"success",action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>g(e),children:(0,F.jsx)(U.MRt,{})})}}),Y.request(o)}catch(s){const e=s.response.data||"".concat(s.response.status,": ").concat(s.response.statusText);m({message:e,options:{key:(new Date).getTime()+Math.random(),variant:"error",persist:!0,action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>g(e),children:(0,F.jsx)(U.MRt,{})})}})}})(b[1]),startIcon:(0,F.jsx)(U.Mxb,{}),children:"Clear"}),b[1].sessionId&&(0,F.jsx)(w.A,{title:"At your left \ud83d\udc48 you will see the Memory node that was used in this conversation. You need to have the matching Memory node with same parameters in the canvas, in order to delete the session conversations stored on the Memory node",placement:"bottom",children:(0,F.jsx)("h5",{style:{cursor:"pointer",color:l.palette.primary.main},children:"Why my session is not deleted?"})})]})]}),(0,F.jsx)("div",{style:{marginLeft:"20px",border:"1px solid #e0e0e0",borderRadius:"".concat(c.borderRadius,"px")},className:"cloud-message",children:(0,F.jsx)("div",{style:{width:"100%",height:"100%"},children:b&&b.map(((e,t)=>
1"apiMessage"===e.type||"userMessage"===e.type?(0,F.jsxs)(p.A,{sx:{background:"apiMessage"===e.type?l.palette.asyncSelect.main:"",pl:1,pr:1},style:{display:"flex",justifyContent:"center",alignContent:"center"},children:["apiMessage"===e.type?(0,F.jsx)("img",{style:{marginLeft:"10px"},src:St,alt:"AI",width:"25",height:"25",className:"boticon"}):(0,F.jsx)("img",{style:{marginLeft:"10px"},src:kt,alt:"Me",width:"25",height:"25",className:"usericon"}),(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"column",width:"100%"},children:[e.usedTools&&(0,F.jsx)("div",{style:{display:"block",flexDirection:"row",width:"100%"},children:e.usedTools.map(((e,t)=>(0,F.jsx)(bt.A,{size:"small",label:e.tool,component:"a",sx:{mr:1,mt:1},variant:"outlined",clickable:!0,onClick:()=>K(e,"Used Tools")},t)))}),(0,F.jsx)("div",{className:"markdownanswer",children:(0,F.jsx)(It.d,{remarkPlugins:[yt.A,vt.A],rehypePlugins:[ft.A,xt.A],components:{code(e){let{inline:t,className:n,children:o,...s}=e;const i=/language-(\w+)/.exec(n||"");return t?(0,F.jsx)("code",{className:n,...s,children:o}):(0,F.jsx)(Pt.N,{chatflowid:a.chatflow.id,isDialog:!0,language:i&&i[1]||"",value:String(o).replace(/\n$/,""),...s},Math.random())}},children:e.message})}),e.fileAnnotations&&(0,F.jsx)("div",{style:{display:"block",flexDirection:"row",width:"100%"},children:e.fileAnnotations.map(((e,t)=>(0,F.jsx)(h.A,{sx:{fontSize:"0.85rem",textTransform:"none",mb:1,mr:1},variant:"outlined",onClick:()=>(async e=>{try{const t=await wt.A.post("".concat(z.VY,"/api/v1/openai-assistants-file"),{fileName:e.fileName},{responseType:"blob"}),a=new Blob([t.data],{type:t.headers["content-type"]}),n=window.URL.createObjectURL(a),o=document.createElement("a");o.href=n,o.download=e.fileName,document.body.appendChild(o),o.click(),o.remove()}catch(t){console.error("Download failed:",t)}})(e),endIcon:(0,F.jsx)(U.i8u,{color:l.palette.primary.main}),children:e.fileName},t)))}),e.sourceDocuments&&(0,F.jsx)("div",{style:{display:"block",flexDirection:"row",width:"100%"},children:(0,Ze.XA)(e).map(((e,t)=>{const a=e.metadata&&e.metadata.source?(0,Ze.Gz)(e.metadata.source):void 0;return(0,F.jsx)(bt.A,{size:"small",label:a?"/"===a.pathname.substring(0,15)?a.host:"".concat(a.pathname.substring(0,15),"..."):"".concat(e.pageContent.substring(0,15),"..."),component:"a",sx:{mr:1,mb:1},variant:"outlined",clickable:!0,onClick:()=>{return a?(t=e.metadata.source,void window.open(t,"_blank")):K(e);var t}},t)}))})]})]},t):(0,F.jsx)(p.A,{sx:{background:l.palette.timeMessage.main,p:2},style:{display:"flex",justifyContent:"center",alignContent:"center"},children:gt()(e.message).format("MMMM Do YYYY, h:mm:ss a")},t)))})})]})]}),(0,F.jsx)(Nt,{show:T,dialogProps:N,onCancel:()=>M(!1)})]})})]}):null;return(0,k.createPortal)(G,s)};var Ht=a(85824);const Yt=e=>{let{chatflow:t,handleSaveFlow:a,handleDeleteFlow:o,handleLoadFlow:s}=e;const i=(0,f.A)(),c=(0,r.wA)(),u=(0,l.Zp)(),h=(0,n.useRef)(),m=(0,n.useRef)(),[g,x]=(0,n.useState)(null),[v,w]=(0,n.useState)(""),[j,b]=(0,n.useState)(!1),[A,C]=(0,n.useState)(!1),[S,k]=(0,n.useState)(!1),[D,I]=(0,n.useState)({}),[P,T]=(0,n.useState)(!1),[M,N]=(0,n.useState)({}),[R,E]=(0,n.useState)(!1),[L,O]=(0,n.useState)({}),[B,q]=(0,n.useState)(!1),[H,Y]=(0,n.useState)({}),_=(0,J.A)(De.A.updateChatflow),V=(0,r.d4)((e=>e.canvas));return(0,n.useEffect)((()=>{_.data&&(w(_.data.name),c({type:d.wg,chatflow:_.data})),x(!1)}),[_.data]),(0,n.useEffect)((()=>{t&&w(t.name)}),[t]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(p.A,{children:(0,F.jsx)(Q.A,{title:"Back",sx:{borderRadius:"50%"},children:(0,F.jsx)(Z.A,{variant:"rounded",sx:{...i.typography.commonAvatar,...i.typography.mediumAvatar,transition:"all .2s ease-in-out",background:i.palette.secondary.light,color:i.palette.secondary.dark,"&:hover":{background:i.palette.secondary.dark,color:i.palette.secondary.light}},color:"inherit",onClick:()=>window.history.state&&window.history.state.idx>0?u(-1):u("/",{replace:!0}),children:(0,F.jsx)(U.gu7,{stroke:1.5,size:"1.3rem"})})})}),(0,F.jsxs)(p.A,{sx:{flexGrow:1},children:[!g&&(0,F.jsxs)($.A,{flexDirection:"row",children:[(0,F.jsxs)(y.A,{s
1x:{fontSize:"1.5rem",fontWeight:600,ml:2},children:[V.isDirty&&(0,F.jsx)("strong",{style:{color:i.palette.orange.main},children:"*"})," ",v]}),(null===t||void 0===t?void 0:t.id)&&(0,F.jsx)(Q.A,{title:"Edit Name",sx:{borderRadius:"50%"},children:(0,F.jsx)(Z.A,{variant:"rounded",sx:{...i.typography.commonAvatar,...i.typography.mediumAvatar,transition:"all .2s ease-in-out",ml:1,background:i.palette.secondary.light,color:i.palette.secondary.dark,"&:hover":{background:i.palette.secondary.dark,color:i.palette.secondary.light}},color:"inherit",onClick:()=>x(!0),children:(0,F.jsx)(U.r9C,{stroke:1.5,size:"1.3rem"})})})]}),g&&(0,F.jsxs)($.A,{flexDirection:"row",children:[(0,F.jsx)(ee.A,{size:"small",inputRef:h,sx:{width:"50%",ml:2},defaultValue:v}),(0,F.jsx)(Q.A,{title:"Save Name",sx:{borderRadius:"50%"},children:(0,F.jsx)(Z.A,{variant:"rounded",sx:{...i.typography.commonAvatar,...i.typography.mediumAvatar,transition:"all .2s ease-in-out",background:i.palette.success.light,color:i.palette.success.dark,ml:1,"&:hover":{background:i.palette.success.dark,color:i.palette.success.light}},color:"inherit",onClick:()=>{if(t.id){const e={name:h.current.value};_.request(t.id,e)}},children:(0,F.jsx)(U.iWP,{stroke:1.5,size:"1.3rem"})})}),(0,F.jsx)(Q.A,{title:"Cancel",sx:{borderRadius:"50%"},children:(0,F.jsx)(Z.A,{variant:"rounded",sx:{...i.typography.commonAvatar,...i.typography.mediumAvatar,transition:"all .2s ease-in-out",background:i.palette.error.light,color:i.palette.error.dark,ml:1,"&:hover":{background:i.palette.error.dark,color:i.palette.error.light}},color:"inherit",onClick:()=>x(!1),children:(0,F.jsx)(U.MRt,{stroke:1.5,size:"1.3rem"})})})]})]}),(0,F.jsxs)(p.A,{children:[(null===t||void 0===t?void 0:t.id)&&(0,F.jsx)(Q.A,{title:"API Endpoint",sx:{borderRadius:"50%",mr:2},children:(0,F.jsx)(Z.A,{variant:"rounded",sx:{...i.typography.commonAvatar,...i.typography.mediumAvatar,transition:"all .2s ease-in-out",background:i.palette.canvasHeader.deployLight,color:i.palette.canvasHeader.deployDark,"&:hover":{background:i.palette.canvasHeader.deployDark,color:i.palette.canvasHeader.deployLight}},color:"inherit",onClick:()=>{let e=!1;try{const a=JSON.parse(t.flowData).nodes;for(const t of a)if(t.data.inputParams.find((e=>"file"===e.type))){e=!0;break}}catch(n){console.error(n)}let a=!1;try{const e=JSON.parse(t.flowData).nodes;for(const t of e)if(t.data.inputParams.find((e=>"sessionId"===e.name))){a=!0;break}}catch(n){console.error(n)}I({title:"Embed in website or use as API",chatflowid:t.id,chatflowApiKeyId:t.apikeyid,isFormDataRequired:e,isSessionMemory:a}),k(!0)},children:(0,F.jsx)(U.Dl3,{stroke:1.5,size:"1.3rem"})})}),(0,F.jsx)(Q.A,{title:"Save Chatflow",sx:{borderRadius:"50%",mr:2},children:(0,F.jsx)(Z.A,{variant:"rounded",sx:{...i.typography.commonAvatar,...i.typography.mediumAvatar,transition:"all .2s ease-in-out",background:i.palette.canvasHeader.saveLight,color:i.palette.canvasHeader.saveDark,"&:hover":{background:i.palette.canvasHeader.saveDark,color:i.palette.canvasHeader.saveLight}},color:"inherit",onClick:()=>{t.id?a(v):C(!0)},children:(0,F.jsx)(U.OAL,{stroke:1.5,size:"1.3rem"})})}),(0,F.jsx)(Q.A,{ref:m,title:"Settings",sx:{borderRadius:"50%"},children:(0,F.jsx)(Z.A,{variant:"rounded",sx:{...i.typography.commonAvatar,...i.typography.mediumAvatar,transition:"all .2s ease-in-out",background:i.palette.canvasHeader.settingsLight,color:i.palette.canvasHeader.settingsDark,"&:hover":{background:i.palette.canvasHeader.settingsDark,color:i.palette.canvasHeader.settingsLight}},onClick:()=>b(!j),children:(0,F.jsx)(U.Ni9,{stroke:1.5,size:"1.3rem"})})})]}),(0,F.jsx)(ue,{chatflow:t,isSettingsOpen:j,anchorEl:m.current,onClose:()=>b(!1),onSettingsItemClick:e=>{if(b(!1),"deleteChatflow"===e)o();else if("conversationStarters"===e)O({title:"Starter Prompts - "+t.name,chatflow:t}),E(!0);else if("analyseChatflow"===e)N({title:"Analyse Chatflow",chatflow:t}),T(!0);else if("viewMessages"===e)Y({title:"View Messages",chatflow:t}),q(!0);else if("duplicateChatflow"===e)try{localStorage.setItem("duplicatedFlowData",t.flowData),window.open("".concat(z.bg,"/canvas"),"_blank")}catch(a){console.error(a)}else if("exportChatflow"===e)try{const e=JSON.parse(t.flowData);let a=JSON.stringify((0,Ze.i8)(e),null,2),n="data:application/json;charset=utf-8,"+encodeURIComponent(a),o="".concat(t.name," Chatflow.json"),s=document.createElement("a");s.setAttribute("href",n),s.setAttribute("download",o),s.click()}catch(a){console.error(a)}},onUploadFile:e=>{b(!1),s(e)}}),(0,F.jsx)(he.A,{show:A,dialogProps:{title:"Save New Chatflow",confirmButtonName:"Save",cancelButtonName:"C
1ancel"},onCancel:()=>C(!1),onConfirm:e=>{C(!1),a(e)}}),(0,F.jsx)(tt,{show:S,dialogProps:D,onCancel:()=>k(!1)}),(0,F.jsx)(pt,{show:P,dialogProps:M,onCancel:()=>T(!1)}),(0,F.jsx)(Ht.A,{show:R,dialogProps:L,onConfirm:()=>E(!1),onCancel:()=>E(!1)}),(0,F.jsx)(qt,{show:B,dialogProps:H,onCancel:()=>q(!1)})]})};var Jt=a(51754),_t=a(54972),Ut=a(70939);const Vt=(0,_t.Ay)(Ut.A)((e=>{let{theme:t,color:a="primary"}=e;return{color:"white",backgroundColor:t.palette[a].main,"&:hover":{backgroundColor:t.palette[a].main,backgroundImage:"linear-gradient(rgb(0 0 0/10%) 0 0)"}}}));function Wt(e){return{id:"attachment-tab-".concat(e),"aria-controls":"attachment-tabpanel-".concat(e)}}const Kt=e=>{let{nodesData:t,node:a}=e;const o=(0,f.A)(),s=(0,r.d4)((e=>e.customization)),i=(0,r.wA)(),[l,c]=(0,n.useState)(""),[u,h]=(0,n.useState)({}),[m,g]=(0,n.useState)(!1),[x,w]=(0,n.useState)({}),[j,b]=(0,n.useState)(0),A=(0,n.useRef)(null),C=(0,n.useRef)(m),S=(0,n.useRef)(),k=()=>{const e=S.current;e&&(e.scrollTop=0)},D=(e,t)=>{b(t),I(l,t)},I=(e,a)=>{c(e),setTimeout((()=>{if(e){const n=(e=>t.filter((t=>{const a=t.name.toLowerCase().includes(e.toLowerCase()),n=t.category.toLowerCase().includes(e.toLowerCase());return a||n})))(e);P(n,null!==a&&void 0!==a?a:j,!0),k()}else""===e&&(P(t,null!==a&&void 0!==a?a:j),k())}),500)},P=(e,t,a)=>{const n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const a=e.filter((e=>!e.tags)),n=e.filter((e=>e.tags&&e.tags.includes("LlamaIndex")));return 0===t?a:n}(e,t),o={},s=n.reduce((function(e,t){return e[t.category]=e[t.category]||[],e[t.category].push(t),o[t.category]=!!a,e}),Object.create(null));h(s),((e,t,a)=>{var n;const o={...e},s=null!==(n=o["Vector Stores"])&&void 0!==n?n:[],i=[],r=[];for(const l of s)"DEPRECATING"===l.badge?i.push(l):r.push(l);delete o["Vector Stores"],i.length&&(o["Vector Stores;DEPRECATING"]=i,t["Vector Stores;DEPRECATING"]=!!a),r.length&&(o["Vector Stores;NEW"]=r,t["Vector Stores;NEW"]=!!a),h(o)})(s,o,a),w(o)},T=e=>(t,a)=>{const n={...x};n[e]=a,w(n)},N=e=>{A.current&&A.current.contains(e.target)||g(!1)};return(0,n.useEffect)((()=>{!0===C.current&&!1===m&&A.current.focus(),C.current=m}),[m]),(0,n.useEffect)((()=>{a&&g(!1)}),[a]),(0,n.useEffect)((()=>{t&&(P(t),i({type:d.Z8,componentNodes:t}))}),[t,i]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Vt,{sx:{left:20,top:20},ref:A,size:"small",color:"primary","aria-label":"add",title:"Add Node",onClick:()=>{g((e=>!e))},children:m?(0,F.jsx)(U.YPw,{}):(0,F.jsx)(U.uID,{})}),(0,F.jsx)(te.A,{placement:"bottom-end",open:m,anchorEl:A.current,role:void 0,transition:!0,disablePortal:!0,popperOptions:{modifiers:[{name:"offset",options:{offset:[-40,14]}}]},sx:{zIndex:1e3},children:e=>{let{TransitionProps:t}=e;return(0,F.jsx)(re.A,{in:m,...t,children:(0,F.jsx)(M.A,{children:(0,F.jsx)(ae.x,{onClickAway:N,children:(0,F.jsxs)(ie.A,{border:!1,elevation:16,content:!1,boxShadow:!0,shadow:o.shadows[16],children:[(0,F.jsxs)(p.A,{sx:{p:2},children:[(0,F.jsx)($.A,{children:(0,F.jsx)(y.A,{variant:"h4",children:"Add Nodes"})}),(0,F.jsx)(Ae.A,{sx:{width:"100%",pr:2,pl:2,my:2},id:"input-search-node",value:l,onChange:e=>I(e.target.value),placeholder:"Search nodes",startAdornment:(0,F.jsx)(Jt.A,{position:"start",children:(0,F.jsx)(U.C0l,{stroke:1.5,size:"1rem",color:o.palette.grey[500]})}),endAdornment:(0,F.jsx)(Jt.A,{position:"end",sx:{cursor:"pointer",color:o.palette.grey[500],"&:hover":{color:o.palette.grey[900]}},title:"Clear Search",children:(0,F.jsx)(U.MRt,{stroke:1.5,size:"1rem",onClick:()=>I(""),style:{cursor:"pointer"}})}),"aria-describedby":"search-helper-text",inputProps:{"aria-label":"weight"}}),(0,F.jsxs)(pe.A,{sx:{position:"relative",minHeight:"50px",height:"50px"},variant:"fullWidth",value:j,onChange:D,"aria-label":"tabs",children:[["LangChain","LlamaIndex"].map(((e,t)=>(0,F.jsx)(me.A,{icon:(0,F.jsx)("div",{style:{borderRadius:"50%"},children:(0,F.jsx)("img",{style:{width:"25px",height:"25px",borderRadius:"50%",objectFit:"contain"},src:0===t?ct:W,alt:e})}),iconPosition:"start",sx:{minHeight:"50px",height:"50px"},label:e,...Wt(t)},t))),(0,F.jsx)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",borderRadius:10,background:"rgb(254,252,191)",paddingLeft:6,paddingRight:6,paddingTop:1,paddingBottom:1,width:"max-content",position:"absolute",top:0,right:0,fontSize:"0.65rem",fontWeight:700},children:(0,F.jsx)("span",{style:{color:"rgb(116,66,16)"},children:"BETA"})})]}),(0,F.jsx)(v.A,{})]}),(0,F.jsx)(se(),{containerRef:e=>{S.current=e},style:{height:"100%",maxHeight:"calc(100vh - 380px)",overflowX:"hidden"},children:(0,F.jsx)(p.A,{sx:{p:2,pt:0},children:(0,F.jsx)(ne.A,{sx:{width:"100%",maxWidth:370,py:0,borderRadius:"10px",[o.breakpoints.down("md")]:{maxWidth:370},"& .MuiListItemSecondaryAction-root":{top:22},"& .MuiDivider-root":{my:0},"& .list-container":{pl:7}},children:Object.keys(u).sort().map((e=>"Vector Stores"===e?(0,F.jsx)(F.Fragment,{}):(0,F.jsxs)(ge.A,{expanded:x[e]||!1,onChange:T(e),disableGutters:!0,children:[(0,F.jsx)(fe.A,{expandIcon:(0,F.jsx)(ve.A,{}),"aria-controls":"nodes-accordian-".concat(e),id:"nodes-accordian-header-".concat(e),children:e.split(";").length>1?(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,F.jsx)(y.A,{variant:"h5",children:e.split(";")[0]}),"\xa0",(0,F.jsx)(bt.A,{sx:{width:"max-content",fontWeight:700,fontSize:"0.65rem",background:"DEPRECATING"===e.split(";")[1]?o.palette.warning.main:o.palette.teal.main,color:"DEPRECATING"!==e.split(";")[1]?"white":"inherit"},size:"small",label:e.split(";")[1]})]}):(0,F.jsx)(y.A,{variant:"h5",children:e})}),(0,F.jsx)(xe.A,{children:u[e].map(((t,a)=>(0,F.jsxs)("div",{onDragStart:e=>((e,t)=>{e.dataTransfer.setData("application/reactflow",JSON.stringify(t)),e.dataTransfer.effectAllowed="move"})(e,t),draggable:!0,children:[(0,F.jsx)(jt.A,{sx:{p:0,borderRadius:"".concat(s.borderRadius,"px"),cursor:"move"},children:(0,F.jsxs)(at.Ay,{alignItems:"center",children:[(0,F.jsx)(nt.A,{children:(0,F.jsx)("div",{style:{width:50,height:50,borderRadius:"50%",backgroundColor:"white"},children:(0,F.jsx)("img",{style:{width:"100%",height:"100%",padding:10,objectFit:"contain"},alt:t.name,src:"".concat(z.VY,"/api/v1/node-icon/").concat(t.name)})})}),(0,F.jsx)(ot.A,{sx:{ml:1},primary:(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,F.jsx)("span",{children:t.label}),"\xa0",t.badge&&(0,F.jsx)(bt.A,{sx:{width:"max-content",fontWeight:700,fontSize:"0.65rem",background:"DEPRECATING"===t.badge?o.palette.warning.main:o.palette.teal.main,color:"DEPRECATING"!==t.badge?"white":"inherit"},size:"small",label:t.badge})]}),secondary:t.description})]})}),a===u[e].length-1?null:(0,F.jsx)(v.A,{})]},t.name)))})]},e)))})})})]})})})})}})]})};var Gt=a(1780),Xt=a(48317),Qt=a(88764);const Zt=(e,t)=>
1q.A.post("/internal-prediction/".concat(e),t),$t=e=>{let{isGrid:t,starterPrompts:a,onPromptClick:n}=e;return(0,F.jsx)(p.A,{className:"button-container",sx:{maxWidth:t?"inherit":"400px",m:1},children:a.map(((e,t)=>(0,F.jsx)(bt.A,{label:e.prompt,className:"button",onClick:t=>n(e.prompt,t)},t)))})},ea=e=>{let{open:t,chatflowid:a,isDialog:o}=e;const s=(0,f.A)(),i=(0,r.d4)((e=>e.customization)),l=(0,n.useRef)(),[c,d]=(0,n.useState)(""),[m,g]=(0,n.useState)(!1),[y,w]=(0,n.useState)([{message:"Hi there! How can I help?",type:"apiMessage"}]),[j,b]=(0,n.useState)(""),[A,C]=(0,n.useState)(!1),[S,k]=(0,n.useState)(!1),[D,I]=(0,n.useState)({}),[P,T]=(0,n.useState)(void 0),M=(0,n.useRef)(null),N=(0,J.A)(Et),R=(0,J.A)(De.A.getIsChatflowStreaming),E=(0,J.A)(De.A.getSpecificChatflow),[L,O]=(0,n.useState)([]),B=(e,t)=>{I({data:e,title:t}),k(!0)},q=()=>{l.current&&l.current.scrollTo({top:z.A9})},H=(0,n.useCallback)((e=>d(e.target.value)),[d]),Y=e=>{w((t=>{let a=[...(0,u.cloneDeep)(t)];return"userMessage"===a[a.length-1].type||(a[a.length-1].message+=e),a}))},_=e=>{w((t=>{let a=[...(0,u.cloneDeep)(t)];return"userMessage"===a[a.length-1].type||(a[a.length-1].sourceDocuments=e),a}))},V=async(e,t)=>{if(e&&e.preventDefault(),!t&&""===c.trim())return;let n=c;void 0!==t&&""!==t.trim()&&(n=t),g(!0),w((e=>[...e,{message:n,type:"userMessage"}]));try{const e={question:n,history:y.filter((e=>"Hi there! How can I help?"!==e.message)),chatId:P};A&&(e.socketIOClientId=j);const t=await Zt(a,e);if(t.data){const e=t.data;if(P||T(e.chatId),!A){let t="";t=e.text?e.text:e.json?"```json\n"+JSON.stringify(e.json,null,2):JSON.stringify(e,null,2),w((a=>[...a,{message:t,sourceDocuments:null===e||void 0===e?void 0:e.sourceDocuments,usedTools:null===e||void 0===e?void 0:e.usedTools,fileAnnotations:null===e||void 0===e?void 0:e.fileAnnotations,type:"apiMessage"}]))}(0,Ze.$j)(a,e.chatId,y),g(!1),d(""),setTimeout((()=>{var e;null===(e=M.current)||void 0===e||e.focus(),q()}),100)}}catch(o){return void function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Oops! There seems to be an error. Please try again.";e=e.replace("Unable to parse JSON response from chat agent.\n\n",""),w((t=>[...t,{message:e,type:"apiMessage"}])),g(!1),d(""),setTimeout((()=>{var e;null===(e=M.current)||void 0===e||e.focus()}),100)}(o.response.data||"".concat(o.response.status,": ").concat(o.response.statusText))}};return(0,n.useEffect)((()=>{var e;if(null!==(e=N.data)&&void 0!==e&&e.length){var t;const e=null===(t=N.data[0])||void 0===t?void 0:t.chatId;T(e);const n=N.data.map((e=>{const t={message:e.content,type:e.role};return e.sourceDocuments&&(t.sourceDocuments=JSON.parse(e.sourceDocuments)),e.usedTools&&(t.usedTools=JSON.parse(e.usedTools)),e.fileAnnotations&&(t.fileAnnotations=JSON.parse(e.fileAnnotations)),t}));w((e=>[...e,...n])),(0,Ze.$j)(a,e,y)}}),[N.data]),(0,n.useEffect)((()=>{var e,t;R.data&&C(null!==(e=null===(t=R.data)||void 0===t?void 0:t.isStreaming)&&void 0!==e&&e)}),[R.data]),(0,n.useEffect)((()=>{var e,t;if(E.data&&(null!==(e=E.data)&&void 0!==e&&e.chatbotConfig&&JSON.parse(null===(t=E.data)||void 0===t?void 0:t.chatbotConfig))){var a;let e=JSON.parse(null===(a=E.data)||void 0===a?void 0:a.chatbotConfig);if(e.starterPrompts){let t=[];Object.getOwnPropertyNames(e.starterPrompts).forEach((a=>{e.starterPrompts[a]&&t.push(e.starterPrompts[a])})),O(t)}}}),[E.data]),(0,n.useEffect)((()=>{q()}),[y]),(0,n.useEffect)((()=>{o&&M&&setTimeout((()=>{var e;null===(e=M.current)||void 0===e||e.focus()}),100)}),[o,M]),(0,n.useEffect)((()=>{let e;return t&&a&&(N.request(a),R.request(a),E.request(a),q(),e=(0,Xt.Ay)(z.VY),e.on("connect",(()=>{b(e.id)})),e.on("start",(()=>{w((e=>[...e,{message:"",type:"apiMessage"}]))})),e.on("sourceDocuments",_),e.on("token",Y)),()=>{d(""),g(!1),w([{message:"Hi there! How can I help?",type:"apiMessage"}]),e&&(e.disconnect(),b(""))}}),[t,a]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("div",{className:o?"cloud-dialog":"cloud",children:(0,F.jsx)("div",{ref:l,className:"messagelist",children:y&&y.map(((e,t)=>(0,F.jsx)(F.Fragment,{children:(0,F.jsxs)(p.A,{sx:{background:"apiMessage"===e.type?s.palette.asyncSelect.main:""},style:{display:"flex"},className:"userMessage"===e.type&&m&&t===y.length-1?i.isDarkMode?"usermessagewaiting-dark":"usermessagewaiting-light":"usermessagewaiting"===e.type?"apimessage":"usermessage",children:["apiMessage"===e.type?(0,F.jsx)("img",{src:St,alt:"AI",width:"30",height:"30",className:"boticon"}):(0,F.jsx)("img",{src:kt,alt:"Me",width:"30",height:"30",className:"usericon"}),(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"column",width:"100%"},children:[e.usedTools&&(0,F.jsx)("div",{style:{display:"block",flexDirection:"row",width:"100%"},children:e.usedTools.map(((e,t)=>(0,F.jsx)(bt.A,{size:"small",label:e.tool,component:"a",sx:{mr:1,mt:1},variant:"outlined",clickable:!0,onClick:()=>B(e,"Used Tools")},t)))}),(0,F.jsx)("div",{className:"markdownanswer",children:(0,F.jsx)(It.d,{remarkPlugins:[yt.A,vt.A],rehypePlugins:[ft.A,xt.A],components:{code(e){let{inline:t,className:n,children:s,...i}=e;const r=/language-(\w+)/.exec(n||"");return t?(0,F.jsx)("code",{className:n,...i,children:s}):(0,F.jsx)(Pt.N,{chatflowid:a,isDialog:o,language:r&&r[1]||"",value:String(s).replace(/\n$/,""),...i},Math.random())}},children:e.message})}),e.fileAnnotations&&(0,F.jsx)("div",{style:{display:"block",flexDirection:"row",width:"100%"},children:e.fileAnnotations.map(((e,t)=>(0,F.jsx)(h.A,{sx:{fontSize:"0.85rem",textTransform:"none",mb:1},variant:"outlined",onClick:()=>(async e=>{try{const t=await wt.A.post("".concat(z.VY,"/api/v1/openai-assistants-file"),{fileName:e.fileName},{responseType:"blob"}),a=new Blob([t.data],{type:t.headers["content-type"]}),n=window.URL.createObjectURL(a),o=document.createElement("a");o.href=n,o.download=e.fileName,document.body.appendChild(o),o.click(),o.remove()}catch(t){console.error("Download failed:",t)}})(e),endIcon:(0,F.jsx)(U.i8u,{color:s.palette.primary.main}),children:e.fileName},t)))}),e.sourceDocuments&&(0,F.jsx)("div",{style:{display:"block",flexDirection:"row",width:"100%"},children:(0,Ze.XA)(e).map(((e,t)=>{const a=e.metadata&&e.metadata.source?(0,Ze.Gz)(e.metadata.source):void 0;return(0,F.jsx)(bt.A,{size:"small",label:a?"/"===a.pathname.substring(0,15)?a.host:"".concat(a.pathname.substring(0,15),"..."):"".concat(e.pageContent.substring(0,15),"..."),component:"a",sx:{mr:1,mb:1},variant:"outlined",clickable:!0,onClick:()=>{return a?(t=e.metadata.source,void window.open(t,"_blank")):B(e);var t}},t)}))})]})]},t)})))})}),(0,F.jsxs)("div",{style:{position:"relative"},children:[y&&1===y.length&&(0,F.jsx)($t,{starterPrompts:L||[],onPromptClick:async e=>{d(e),V(void 0,e)},isGrid:o}),(0,F.jsx)(v.A,{})]}),(0,F.jsx)("div",{className:"center",children:(0,F.jsx)("div",{style:{width:"100%"},children:(0,F.jsx)("form",{style:{width:"100%"},onSubmit:V,children:(0,F.jsx)(Ae.A,{inputRef:M,autoFocus:!0,sx:{width:"100%"},disabled:m||!a,onKeyDown:e=>{const t=e.isComposing||229===e.keyCode;"Enter"===e.key&&c&&!t?!e.shiftKey&&c&&V(e):"Enter"===e.key&&e.preventDefault()}
1,id:"userInput",name:"userInput",placeholder:m?"Waiting for response...":"Type your question...",value:c,onChange:H,multiline:!0,maxRows:o?7:2,endAdornment:(0,F.jsx)(Jt.A,{position:"end",sx:{padding:"15px"},children:(0,F.jsx)(x.A,{type:"submit",disabled:m||!a,edge:"end",children:m?(0,F.jsx)("div",{children:(0,F.jsx)(Qt.A,{color:"inherit",size:20})}):(0,F.jsx)(U.mDt,{color:m||!a?"#9e9e9e":i.isDarkMode?"white":"#1e88e5"})})})})})})}),(0,F.jsx)(Nt,{show:S,dialogProps:D,onCancel:()=>k(!1)})]})},ta=e=>{let{show:t,dialogProps:a,onClear:n,onCancel:o}=e;const s=document.getElementById("portal"),i=(0,r.d4)((e=>e.customization)),l=t?(0,F.jsxs)(D.A,{open:t,fullWidth:!0,maxWidth:"md",onClose:o,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",sx:{overflow:"visible"},children:[(0,F.jsx)(I.A,{sx:{fontSize:"1rem"},id:"alert-dialog-title",children:(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row"},children:[a.title,(0,F.jsx)("div",{style:{flex:1}}),i.isDarkMode&&(0,F.jsx)(Se.O,{variant:"outlined",color:"error",title:"Clear Conversation",onClick:n,startIcon:(0,F.jsx)(U.Mxb,{}),children:"Clear Chat"}),!i.isDarkMode&&(0,F.jsx)(h.A,{variant:"outlined",color:"error",title:"Clear Conversation",onClick:n,startIcon:(0,F.jsx)(U.Mxb,{}),children:"Clear Chat"})]})}),(0,F.jsx)(P.A,{sx:{display:"flex",justifyContent:"flex-end",flexDirection:"column"},children:(0,F.jsx)(ea,{isDialog:!0,open:a.open,chatflowid:a.chatflowid})})]}):null;return(0,k.createPortal)(l,s)},aa=e=>{let{chatflowid:t}=e;const a=(0,f.A)(),{confirm:o}=(0,Bt.A)(),s=(0,r.wA)();(0,Ie.A)();const i=function(){return s((0,d.M8)(...arguments))},l=function(){return s((0,d.mk)(...arguments))}
1,[c,u]=(0,n.useState)(!1),[p,m]=(0,n.useState)(!1),[g,x]=(0,n.useState)({}),y=(0,n.useRef)(null),v=(0,n.useRef)(c),w=e=>{y.current&&y.current.contains(e.target)||u(!1)},j=async()=>{if(await o({title:"Clear Chat History",description:"Are you sure you want to clear all chat history?",confirmButtonName:"Clear",cancelButtonName:"Cancel"}))try{const e=localStorage.getItem("".concat(t,"_INTERNAL"));if(!e)return;const a=JSON.parse(e);await Ft(t,{chatId:a.chatId,chatType:"INTERNAL"}),localStorage.removeItem("".concat(t,"_INTERNAL")),(()=>{const e={...g,open:!1};x(e),setTimeout((()=>{const e={...g,open:!0};x(e)}),500)})(),i({message:"Succesfully cleared all chat history",options:{key:(new Date).getTime()+Math.random(),variant:"success",action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>l(e),children:(0,F.jsx)(U.MRt,{})})}})}catch(e){const t=e.response.data||"".concat(e.response.status,": ").concat(e.response.statusText);i({message:t,options:{key:(new Date).getTime()+Math.random(),variant:"error",persist:!0,action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>l(e),children:(0,F.jsx)(U.MRt,{})})}})}};return(0,n.useEffect)((()=>{!0===v.current&&!1===c&&y.current.focus(),v.current=c}),[c,t]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Vt,{sx:{position:"absolute",right:20,top:20},ref:y,size:"small",color:"secondary","aria-label":"chat",title:"Chat",onClick:()=>{u((e=>!e))},children:c?(0,F.jsx)(U.MRt,{}):(0,F.jsx)(U.pjm,{})}),c&&(0,F.jsx)(Vt,{sx:{position:"absolute",right:80,top:20},onClick:j,size:"small",color:"error","aria-label":"clear",title:"Clear Chat History",children:(0,F.jsx)(U.Mxb,{})}),c&&(0,F.jsx)(Vt,{sx:{position:"absolute",right:140,top:20},onClick:()=>{x({open:!0,chatflowid:t}),m(!0)}
1,size:"small",color:"primary","aria-label":"expand",title:"Expand Chat",children:(0,F.jsx)(U.eqE,{})}),(0,F.jsx)(te.A,{placement:"bottom-end",open:c,anchorEl:y.current,role:void 0,transition:!0,disablePortal:!0,popperOptions:{modifiers:[{name:"offset",options:{offset:[40,14]}}]},sx:{zIndex:1e3},children:e=>{let{TransitionProps:n}=e;return(0,F.jsx)(re.A,{in:c,...n,children:(0,F.jsx)(M.A,{children:(0,F.jsx)(ae.x,{onClickAway:w,children:(0,F.jsx)(ie.A,{border:!1,elevation:16,content:!1,boxShadow:!0,shadow:a.shadows[16],children:(0,F.jsx)(ea,{chatflowid:t,open:c})})})})})}}),(0,F.jsx)(ta,{show:p,dialogProps:g,onClear:j,onCancel:()=>m(!1)})]})};var na=a(93059);const oa=(e,t)=>q.A.post("/vector/internal-upsert/".concat(e),t);function sa(e){const{children:t,value:a,index:n,...o}=e;return(0,F.jsx)("div",{role:"tabpanel",hidden:a!==n,id:"attachment-tabpanel-".concat(n),"aria-labelledby":"attachment-tab-".concat(n),...o,children:a===n&&(0,F.jsx)(p.A,{sx:{p:1},children:t})})}function ia(e){return{id:"attachment-tab-".concat(e),"aria-controls":"attachment-tabpanel-".concat(e)}}const ra=e=>{let{show:t,dialogProps:a,onCancel:o}=e;const s=document.getElementById("portal"),{reactFlowInstance:i}=(0,n.useContext)(V.Y),l=(0,r.wA)();(0,Ie.A)();const c=function(){return l((0,d.M8)(...arguments))},u=function(){return l((0,d.mk)(...arguments))}
1,m=(0,J.A)(H),[g,f]=(0,n.useState)([]),[x,v]=(0,n.useState)(!1),[w,j]=(0,n.useState)({}),[b,A]=(0,n.useState)({}),[C,S]=(0,n.useState)({}),[T,M]=(0,n.useState)(0),[N,R]=(0,n.useState)(""),[E,L]=(0,n.useState)({}),O=(e,t,n,o)=>"Python"===e?'import requests\n\nAPI_URL = "'.concat(z.VY,"/api/v1/vector/upsert/").concat(a.chatflowid,'"\n\ndef query(payload):\n response = requests.post(API_URL, json=payload)\n return response.json()\n\noutput = query({\n ').concat(n?'"stopNodeId": "'.concat(t,'",\n '):"",'"overrideConfig": {').concat((0,Ze.FL)(o,"json",n,t),"\n }\n})\n"):"JavaScript"===e?'async function query(data) {\n const response = await fetch(\n "'.concat(z.VY,"/api/v1/vector/upsert/").concat(a.chatflowid,'",\n {\n method: "POST",\n headers: {\n "Content-Type": "application/json"\n },\n body: JSON.stringify(data)\n }\n );\n const result = await response.json();\n return result;\n}\n\nquery({\n ').concat(n?'"stopNodeId": "'.concat(t,'",\n '):"",'"overrideConfig": {').concat((0,Ze.Q6)(o,"json",n,t),"\n }\n}).then((response) => {\n console.log(response);\n});\n"):"cURL"===e?"curl ".concat(z.VY,"/api/v1/vector/upsert/").concat(a.chatflowid," \\\n -X POST \\\n ").concat(n?'-d \'{"stopNodeId": "'.concat(t,'", "overrideConfig": {').concat((0,Ze.hd)(o,"json",n,t),"}' \\"):'-d \'{"overrideConfig": {'.concat((0,Ze.hd)(o,"json",n,t),"}' \\"),'\n -H "Content-Type: application/json"'):"",q=(e,t,n,o)=>{if("Python"===e){let e=(o=(0,Ze.Hn)(o))[0].type;return e.includes(",")&&(e=e.split(",")[0]),'import requests\n\nAPI_URL = "'.concat(z.VY,"/api/v1/vector/upsert/").concat(a.chatflowid,'"\n\n# use form data to upload files\nform_data = {\n "files": ',"('example".concat(e,"', open('example").concat(e,"', 'rb'))"),"\n}\nbody_data = {").concat((0,Ze.FL)(o,"formData",n,t),"}\n\ndef query(form_data, body_data):\n response = requests.post(API_URL, files=form_data, data=body_data)\n return response.json()\n\noutput = query(form_data, body_data)\n")}return"JavaScript"===e?"// use FormData to upload files\nlet formData = new FormData();\n".concat((0,Ze.Q6)(o,"formData",n,t),'\nasync function query(formData) {\n const response = await fetch(\n "').concat(z.VY,"/api/v1/vector/upsert/").concat(a.chatflowid,'",\n {\n method: "POST",\n body: formData\n }\n );\n const result = await response.json();\n return result;\n}\n\nquery(formData).then((response) => {\n console.log(response);\n});\n'):"cURL"===e?"curl ".concat(z.VY,"/api/v1/vector/upsert/").concat(a.chatflowid," \\\n -X POST \\").concat((0,Ze.hd)(o,"formData",n,t),' \\\n -H "Content-Type: multipart/form-data"'):""},Y=e=>"Python"===e?"python":"JavaScript"===e?"javascript":"cURL"===e?"bash":"python",_=e=>"Python"===e?Ue:"JavaScript"===e?Ve:"Embed"===e?EmbedSVG:"cURL"===e?We:"Share Chatbot"===e?ShareChatbotSVG:"Configuration"===e?settingsSVG:Ue,W=e=>{const t=[],a=Object.keys(e.data.inputs);for(let o=0;o<e.data.inputParams.length;o+=1){var n;if(a.includes(e.data.inputParams[o].name))t.push({label:e.data.inputParams[o].label,name:e.data.inputParams[o].name,type:e.data.inputParams[o].type,value:"file"===e.data.inputParams[o].type?(0,Ze.WP)(e.data.inputs[e.data.inputParams[o].name]):null!==(n=e.data.inputs[e.data.inputParams[o].name])&&void 0!==n?n:""})}return t};(0,n.useEffect)((()=>{if(m.data){var e,t;const a={...E};a[N]=((e,t)=>e.filter((e=>t.some((t=>e.nodeId===t.id)))))(m.data,null!==(e=null===(t=g.find((e=>e.vectorNode.data.id===N)))||void 0===t?void 0:t.nodes)&&void 0!==e?e:[]),L(a)}}),[m.data]),(0,n.useEffect)((()=>{if(a&&i){const e=i.getNodes(),t=i.getEdges();f((0,Ze.IA)(e,t))}return()=>{f([]),v(!1),j({}),A({}),S({}),M(0),L({})}}),[a]),(0,n.useEffect)((()=>(l(t?{type:d.sC}:{type:d.dv}),()=>l({type:d.dv}))),[t,l]);const K=t?(0,F.jsxs)(D.A,{open:t,fullWidth:!0,maxWidth:"md",onClose:o,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",sx:{overflow:"visible"},children:[(0,F.jsx)(I.A,{sx:{fontSize:"1rem"},id:"alert-dialog-title",children:a.title}),(0,F.jsx)(P.A,{sx:{display:"flex",justifyContent:"flex-end",flexDirection:"column"},children:(0,F.jsx)(se(),{style:{height:"100%",maxHeight:"calc(100vh - 220p
1x)",overflowX:"hidden"},children:g.length>0&&g.map(((e,t)=>(0,F.jsxs)("div",{children:[e.nodes.length>0&&e.nodes.map(((e,t)=>{return(0,F.jsxs)(ge.A,{expanded:b[e.data.id]||!1,onChange:(a=e.data.id,(e,t)=>{const n={...b};n[a]=t,A(n)}),disableGutters:!0,children:[(0,F.jsx)(fe.A,{expandIcon:(0,F.jsx)(ve.A,{}),"aria-controls":"nodes-accordian-".concat(e.data.name),id:"nodes-accordian-header-".concat(e.data.name),children:(0,F.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,F.jsx)("div",{style:{width:40,height:40,marginRight:10,borderRadius:"50%",backgroundColor:"white"},children:(0,F.jsx)("img",{style:{width:"100%",height:"100%",padding:7,borderRadius:"50%",objectFit:"contain"},alt:e.data.name,src:"".concat(z.VY,"/api/v1/node-icon/").concat(e.data.name)})}),(0,F.jsx)(y.A,{variant:"h5",children:e.data.label}),(0,F.jsx)("div",{style:{display:"flex",flexDirection:"row",width:"max-content",borderRadius:15,background:"rgb(254,252,191)",padding:5,paddingLeft:10,paddingRight:10,marginLeft:10},children:(0,F.jsx)("span",{style:{color:"rgb(116,66,16)",fontSize:"0.825rem"},children:e.data.id})})]})}),(0,F.jsx)(xe.A,{children:(0,F.jsx)(B,{sx:{minWidth:"max-content"},rows:W(e),columns:Object.keys(W(e)[0])})})]},t);var a})),(0,F.jsxs)(p.A,{sx:{p:2},children:[(0,F.jsx)(Be,{label:"Show API",value:C[e.vectorNode.data.id],onChange:()=>(e=>{var t,n;const o={...C};Object.keys(o).includes(e)?o[e]=!o[e]:o[e]=!0,!0===o[e]&&m.request(a.chatflowid),S(o),R(e);const s={...w};s[e]=!1,j(s);const i=null!==(t=null===(n=g.find((t=>t.vectorNode.data.id===e)))||void 0===n?void 0:n.nodes)&&void 0!==t?t:[];for(const a of i)if(a.data.inputParams.find((e=>"file"===e.type))){s[e]=!0,j(s);break}})(e.vectorNode.data.id)},JSON.stringify(C)),C[e.vectorNode.data.id]&&(0,F.jsx)("div",{children:(0,F.jsx)(pe.A,{value:T,onChange:(e,t)=>
1M(t),"aria-label":"tabs",children:["Python","JavaScript","cURL"].map(((e,t)=>(0,F.jsx)(me.A,{icon:(0,F.jsx)("img",{style:{objectFit:"cover",height:15,width:"auto"},src:_(e),alt:"code"}),iconPosition:"start",label:e,...ia(t)},t)))})}),C[e.vectorNode.data.id]&&void 0!==w[e.vectorNode.data.id]&&E[e.vectorNode.data.id]&&E[e.vectorNode.data.id].length>0&&(0,F.jsx)(F.Fragment,{children:(0,F.jsx)("div",{style:{marginTop:10},children:["Python","JavaScript","cURL"].map(((t,a)=>(0,F.jsx)(sa,{value:T,index:a,children:(0,F.jsx)(ye.Rc,{theme:ye.iC,text:w[e.vectorNode.data.id]?q(t,e.vectorNode.data.id,g.length>1,E[e.vectorNode.data.id]):O(t,e.vectorNode.data.id,g.length>1,E[e.vectorNode.data.id]),language:Y(t),showLineNumbers:!1,wrapLines:!0})},a)))})})]}),(0,F.jsxs)("div",{style:{marginBottom:"20px"},children:[x&&(0,F.jsx)(na.U,{open:x}),!x&&(0,F.jsx)(h.A,{sx:{color:"white"},fullWidth:!0,variant:"contained",color:"teal",title:"Upsert",onClick:()=>(async e=>{v(!0);try{await oa(a.chatflowid,{stopNodeId:e.data.id}),c({message:"Succesfully upserted vector store. You can start chatting now!",options:{key:(new Date).getTime()+Math.random(),variant:"success",action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>u(e),children:(0,F.jsx)(U.MRt,{})})}}),v(!1)}catch(t){const e=t.response.data||"".concat(t.response.status,": ").concat(t.response.statusText);c({message:e,options:{key:(new Date).getTime()+Math.random(),variant:"error",persist:!0,action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>u(e),children:(0,F.jsx)(U.MRt,{})})}}),v(!1)}})(e.vectorNode),children:"Upsert"})]})]},t)))})})]}):null;return(0,k.createPortal)(K,s)},la=e=>{let{chatflowid:t}=e;const a=(0,r.wA)();(0,Ie.A)();const o=function(){return a((0,d.M8)(...arguments))},s=function(){return a((0,d.mk)(...arguments))}
1,[i,l]=(0,n.useState)(!1),[c,u]=(0,n.useState)(!1),[p,m]=(0,n.useState)({}),g=(0,n.useRef)(null),f=(0,n.useRef)(i);return(0,n.useEffect)((()=>{!0===f.current&&!1===i&&g.current.focus(),f.current=i}),[i,t]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Vt,{sx:{position:"absolute",right:80,top:20},ref:g,size:"small",color:"teal","aria-label":"upsert",title:"Upsert Vector Database",onClick:()=>{l((e=>!e));m({open:!0,title:"Upsert Vector Store",chatflowid:t}),u(!0)},children:i?(0,F.jsx)(U.MRt,{}):(0,F.jsx)(U.IJ2,{})}),(0,F.jsx)(ra,{show:c,dialogProps:p,onUpsert:async()=>{try{await oa(t,{}),o({message:"Succesfully upserted vector store",options:{key:(new Date).getTime()+Math.random(),variant:"success",action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>s(e),children:(0,F.jsx)(U.MRt,{})})}})}catch(e){const t=e.response.data||"".concat(e.response.status,": ").concat(e.response.statusText);o({message:t,options:{key:(new Date).getTime()+Math.random(),variant:"error",persist:!0,action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>s(e),children:(0,F.jsx)(U.MRt,{})})}})}},onCancel:()=>{u(!1),l((e=>!e))}})]})};var ca=a(83156);const da={customNode:K,stickyNote:X.A},ua={buttonedge:G},ha=()=>{const e=(0,f.A)(),t=(0,l.Zp)(),{state:a}=(0,l.zy)(),x=a?a.templateFlowData:"",y=document.location.pathname.toString().split("/"),v="canvas"===y[y.length-1]?"":y[y.length-1],{confirm:w}=(0,Bt.A)(),j=(0,r.wA)(),b=(0,r.d4)((e=>e.canvas)),[A,C]=(0,n.useState)(b),[S,k]=(0,n.useState)(null),{reactFlowInstance:D,setReactFlowInstance:I}=(0,n.useContext)(V.Y);(0,Ie.A)();const P=function(){return j((0,d.M8)(...arguments))},T=function(){return j((0,d.mk)(...arguments))},[M,N,R]=(0,o.ck)(),[E,L,O]=(0,o.fM)(),[B,q]=(0,n.useState)(null),[H,Y]=(0,n.useState)(!1),_=(0,n.useRef)(null),W=(0,J.A)(ca.A.getAllNodes),K=(0,J.A)(De.A.createNewChatflow),G=(0,J.A)(De.A.testChatflow),X=(0,J.A)(De.A.updateChatflow),Q=(0,J.A)(De.A.getSpecificChatflow),Z=e=>{try{const t=JSON.parse(e),a=t.nodes||[];N(a),L(t.edges||[]),oe()}catch(t){console.error(t)}},$=(0,n.useCallback)(((e,t)=>{q(t),N((e=>e.map((e=>(e.id===t.id?e.data={...e.data,selected:!0}:e.data={...e.data,selected:!1},e)))))})),ee=(0,n.useCallback)((e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"}),[]),te=(0,n.useCallback)((e=>{e.preventDefault();const t=_.current.getBoundingClientRect();let a=e.dataTransfer.getData("application/reactflow");if("undefined"===typeof a||!a)return;a=JSON.parse(a);const n=D.project({x:e.clientX-t.left-100,y:e.clientY-t.top-50}),o=(0,Ze.J2)(a,D.getNodes()),s={id:o,position:n,type:"StickyNote"!==a.type?"customNode":"stickyNote",data:(0,Ze.bC)(a,o)};q(s),N((e=>e.concat(s).map((e=>(e.id===s.id?e.data={...e.data,selected:!0}:e.data={...e.data,selected:!1},e))))),setTimeout((()=>oe()),0)}),[D]),ae=()=>{j({type:d.WJ}),P({message:"Chatflow saved",options:{key:(new Date).getTime()+Math.random(),variant:"success",action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>T(e),children:(0,F.jsx)(U.MRt,{})})}})},ne=e=>{P({message:e,options:{key:(new Date).getTime()+Math.random(),variant:"error",persist:!0,action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>T(e),children:(0,F.jsx)(U.MRt,{})})}})},oe=()=>{j({type:d.w1})};return(0,n.useEffect)((()=>{if(Q.data){const e=Q.data,t=e.flowData?JSON.parse(e.flowData):[];N(t.nodes||[]),L(t.edges||[]),j({type:d.wg,chatflow:e})}else if(Q.error){const e=Q.error,t=e.response.data||"".concat(e.response.status,": ").concat(e.response.statusText);ne("Failed to retrieve chatflow: ".concat(t))}}),[Q.data,Q.error]),(0,n.useEffect)((()=>{if(K.data){const e=K.data;j({type:d.wg,chatflow:e}),ae(),window.history.replaceState(null,null,"/canvas/".concat(e.id))}else if(K.error){const e=K.error,t=e.response.data||"".concat(e.response.status,": ").concat(e.response.statusText);ne("Failed to save chatflow: ".concat(t))}}),[K.data,K.error]),(0,n.useEffect)((()=>{if(X.data)j({type:d.wg,chatflow:X.data}),ae();else if(X.error){const e=X.error,t=e.response.data||"".concat(e.response.status,": ").concat(e.response.statusText);ne("Failed to save chatflow: ".concat(t))}}),[X.data,X.error]),(0,n.useEffect)((()=>{G.error&&P({message:"Test chatflow failed",options:{key:(new Date).getTime()+Math.random(),variant:"error",persist:!0,action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>T(e),children:(0,F.jsx)(U.MRt,{})})}})}),[G.error]),(0,n.useEffect)((()=>
1{if(k(A.chatflow),A.chatflow){const e=A.chatflow.flowData?JSON.parse(A.chatflow.flowData):[];((e,t)=>{(0,Ze.IA)(e,t).length?Y(!0):Y(!1)})(e.nodes||[],e.edges||[])}}),[A.chatflow]),(0,n.useEffect)((()=>(v?Q.request(v):(localStorage.getItem("duplicatedFlowData")?(Z(localStorage.getItem("duplicatedFlowData")),setTimeout((()=>localStorage.removeItem("duplicatedFlowData")),0)):(N([]),L([])),j({type:d.wg,chatflow:{name:"Untitled chatflow"}})),W.request(),()=>{setTimeout((()=>j({type:d.WJ})),0)})),[]),(0,n.useEffect)((()=>{C(b)}),[b]),(0,n.useEffect)((()=>{function e(e){const t=e.clipboardData.getData("text");t.includes('{"nodes":[')&&t.includes('],"edges":[')&&Z(t)}return window.addEventListener("paste",e),()=>{window.removeEventListener("paste",e)}}),[]),(0,n.useEffect)((()=>{x&&x.includes('"nodes":[')&&x.includes('],"edges":[')&&Z(x)}),[x]),c("You have unsaved changes! Do you want to navigate away?",A.isDirty),(0,F.jsx)(F.Fragment,{children:(0,F.jsxs)(p.A,{children:[(0,F.jsx)(m.A,{enableColorOnDark:!0,position:"fixed",color:"inherit",elevation:1,sx:{bgcolor:e.palette.background.default},children:(0,F.jsx)(g.A,{children:(0,F.jsx)(Yt,{chatflow:S,handleSaveFlow:e=>{if(D){const t=D.getNodes().map((e=>{const t=(0,u.cloneDeep)(e.data);return Object.prototype.hasOwnProperty.call(t.inputs,z.MJ)&&(t.credential=t.inputs[z.MJ],t.inputs=(0,u.omit)(t.inputs,[z.MJ])),e.data={...t,selected:!1},e})),a=D.toObject();a.nodes=t;const n=JSON.stringify(a);if(S.id){const t={name:e,flowData:n};X.request(S.id,t)}else{const t={name:e,deployed:!1,isPublic:!1,flowData:n};K.request(t)}}},handleDeleteFlow:async()=>{const e={title:"Delete",description:"Delete chatflow ".concat(S.name,"?"),confirmButtonName:"Delete",cancelButtonName:"Cancel"};if(await w(e))try{await De.A.deleteChatflow(S.id),localStorage.removeItem("".concat(S.id,"_INTERNAL")),t("/")}catch(a){const e=a.response.data||"".concat(a.response.status,": ").concat(a.response.statusText);P({message:e,options:{key:(new Date).getTime()+Math.random(),variant:"error",persist:!0,action:e=>(0,F.jsx)(h.A,{style:{color:"white"},onClick:()=>T(e),children:(0,F.jsx)(U.MRt,{})})}})}},handleLoadFlow:Z})})}),(0,F.jsx)(p.A,{sx:{pt:"70px",height:"100vh",width:"100%"},children:(0,F.jsx)("div",{className:"reactflow-parent-wrapper",children:(0,F.jsx)("div",{className:"reactflow-wrapper",ref:_,children:(0,F.jsxs)(o.Gc,{nodes:M,edges:E,onNodesChange:R,onNodeClick:$,onEdgesChange:O,onDrop:te,onDragOver:ee,onNodeDragStop:oe,nodeTypes:da,edgeTypes:ua,onConnect:e=>{const t={...e,type:"buttonedge",id:"".concat(e.source,"-").concat(e.sourceHandle,"-").concat(e.target,"-").concat(e.targetHandle)},a=e.targetHandle.split("-")[0],n=e.sourceHandle.split("-")[0],s=e.targetHandle.split("-")[2];N((e=>e.map((e=>{if(e.id===a){let t;setTimeout((()=>oe()),0);const a=e.data.inputAnchors.find((e=>e.name===s)),o=e.data.inputParams.find((e=>e.name===s));if(a&&a.list){const a=e.data.inputs[s]||[];"tools"===s?(0,Ze.N$)(a,n):a.push("{{".concat(n,".data.instance}}")),t=a}else t=o&&o.acceptVariable?e.data.inputs[s]||"":"{{".concat(n,".data.instance}}");e.data={...e.data,inputs:{...e.data.inputs,[s]:t}}}return e})))),L((e=>(0,o.rN)(t,e)))},onInit:I,fitView:!0,deleteKeyCode:b.canvasDialogShow?null:["Backspace","Delete"],minZoom:.1,children:[(0,F.jsx)(s.H,{style:{display:"flex",flexDirection:"row",left:"50%",transform:"translate(-50%, -50%)"}}),(0,F.jsx)(i.V,{color:"#aaa",gap:16}),(0,F.jsx)(Kt,{nodesData:W.data,node:B}),H&&(0,F.jsx)(la,{chatflowid:v}),(0,F.jsx)(aa,{chatflowid:v})]})})})}),(0,F.jsx)(Gt.A,{})]})})}}}]); 2//# sourceMappingURL=5702.1f51cba0.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.