1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4cdc43e7-98bf-4f61-a100-18a4e9dc9367",e._sentryDebugIdIdentifier="sentry-dbid-4cdc43e7-98bf-4f61-a100-18a4e9dc9367")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7989],{41926:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/chatbots/[bot_id]/workflows",function(){return s(97506)}])},21757:function(e,t,s){"use strict";s.d(t,{Z:function(){return c}});var a=s(85893),n=s(41664),i=s.n(n),o=s(63386),r=s(11163),l=s(99785),d=s(40209);function c(e){let{bot_id:t,children:s}=e,n=(0,r.useRouter)().asPath.split("/")[3]||null;return(0,a.jsxs)("div",{className:"sticky top-0 z-[99] bg-white border-b border-gray-200",children:[(0,a.jsxs)("div",{className:"flex py-[10px] h-[53px] px-9 items-center bg-white border-b border-gray-200",children:[(0,a.jsx)(l.Z,{bot_id:t}),(0,a.jsx)(d.Z,{})]}),(0,a.jsx)("div",{className:"flex items-center py-3 px-9 h-[53px]",children:(0,a.jsxs)("nav",{className:"flex space-x-4 grow","aria-label":"Tabs",children:[(0,a.jsx)(i(),{href:"/chatbots/".concat(t),className:(0,o.AK)(null==n?"bg-gray-200 text-gray-700":"text-gray-500 hover:text-gray-700","rounded-md py-1 px-3 text-sm font-medium my-auto"),children:"Preview"}),(0,a.jsx)(i(),{href:"/chatbots/".concat(t,"/sources"),className:(0,o.AK)("sources"==n?"bg-gray-100 text-gray-700":"text-gray-500 hover:text-gray-700","rounded-md px-3 py-1 text-sm font-medium my-auto"),children:"Sources"}),(0,a.jsx)(i(),{href:"/chatbots/".concat(t,"/prompts"),className:(0,o.AK)("prompts"==n?"bg-gray-100 text-gray-700":"text-gray-500 hover:text-gray-700","rounded-md px-3 py-1 text-sm font-medium my-auto"),children:"Prompt"}),(0,a.jsx)(i(),{href:"/chatbots/".concat(t,"/embed"),className:(0,o.AK)("embed"==n?"bg-gray-100 text-gray-700":"text-gray-500 hover:text-gray-700","rounded-md px-3 py-1 text-sm font-medium my-auto"),children:"Settings & Embedding"}),(0,a.jsx)("div",{className:"text-right grow",children:s})]})})]})}},99785:function(e,t,s){"use strict";s.d(t,{Z:function(){return c}});var a=s(85893),n=s(24201),i=s(80649),o=s(41664),r=s.n(o),l=s(11163),d=s(61292);function c(e){let{bot_id:t}=e,{asPath:s}=(0,l.useRouter)(),{activeBot:o}=(0,d.Z)(),c=s.split("/").filter(e=>""!==e);return(0,a.jsx)("nav",{className:"flex grow","aria-label":"Breadcrumb",children:(0,a.jsxs)("ol",{role:"list",className:"flex items-center space-x-2",children:[(0,a.jsx)("li",{children:(0,a.jsx)("div",{children:(0,a.jsxs)(r(),{href:"/",className:"text-gray-500 hover:text-gray-500",children:[(0,a.jsx)(n.Z,{className:"h-4 w-4 flex-shrink-0","aria-hidden":"true"}),(0,a.jsx)("span",{className:"sr-only",children:"Home"})]})})}),c.map((e,t)=>(0,a.jsx)("li",{children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(i.Z,{className:"h-3 w-3 flex-shrink-0 text-gray-500","aria-hidden":"true"}),(0,a.jsx)(r(),{href:"/".concat(c.slice(0,t+1).join("/")),className:"ml-1 text-xs font-medium text-gray-500 hover:text-gray-700 capitalize",children:e==(null==o?void 0:o.id)?null==o?void 0:o.name:e})]})},"crumb-".concat(t)))]})})}},40209:function(e,t,s){"use strict";var a=s(85893),n=s(84053),i=s(57773),o=s(62506),r=s(67294),l=s(26554),d=s(41910),c=s(40146),u=s(61292),h=s(41664),x=s.n(h),m=s(63386);s(45444),t.Z=()=>{let e=(0,n.useSupabaseClient)(),{activeBot:t}=(0,u.Z)(),{activeAccount:s,notifications:h,setNotifications:p}=(0,c.Z)(),[f,b]=(0,r.useState)(!1),[g,y]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{s&&(async()=>{e.channel("table_db_changes").on("postgres_changes",{event:"UPDATE",schema:"public",table:"sources",filter:"account_id=eq.".concat(null==s?void 0:s.account_id)},e=>{let t={...e.new,date:new Date};p([...h.slice(0,9),t].reverse()),y(!0),b(!0),setTimeout(()=>{y(!1)},5e3)}).subscribe()})()},[h,s]),(0,a.jsx)("div",{className:"flex grow shrink-0 place-content-end",children:(0,a.jsx)("div",{className:"transition-colors",children:(0,a.jsxs)(l.v,{as:"div",className:"relative z-40 text-left",children:[(0,a.jsx)("div",{children:(0,a.jsx)(l.v.Button,{className:"flex w-full",onClick:()=>{b(!1)},children:(0,a.jsxs)("div",{className:"relative p-1 transition-colors bg-white rounded-full hover:bg-gray-100",children:[(0,a.jsx)(i.Z,{className:"w-5 h-5 text-gray-400 ".concat(g?"ring-bell":""),"aria-hidden":"true"}),(0,a.jsxs)("span",{className:"flex h-2.5 w-2.5 absolute top-1 left-1 ".concat(f?"opacity-100":"opacity-0"),children:[(0,a.jsx)("span",{className:"absolute inline-flex w-full h-full rounded-full opacity-75 animate-ping bg-sky-4
100"}),(0,a.jsx)("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5 bg-sky-500"})]})]})})}),(0,a.jsx)(d.u,{as:r.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,a.jsx)(l.v.Items,{className:"absolute top-7 z-40 w-[350px] -left-[320px] py-1 mt-2 origin-top-right bg-white rounded border border-gray-200",children:(0,a.jsx)(l.v.Item,{children:(0,a.jsxs)("div",{className:"px-4 max-h-[400px] overflow-y-scroll pb-6",children:[(0,a.jsx)("b",{className:"sticky top-0 block w-full py-2 mb-4 text-sm font-bold bg-white",children:"Notifications"}),(!h||0===h.length)&&(0,a.jsx)("p",{className:"text-sm italic text-gray-400",children:"No new notifications."}),null==h?void 0:h.map((e,s)=>(0,a.jsxs)(x(),{href:"/chatbots/".concat(null==t?void 0:t.id,"/sources"),className:"flex justify-between p-2 mb-4 border gap-x-2 borerborder-gray-200 rouneded",children:[(0,a.jsx)(o.Z,{className:"w-5 h-5 mt-2 text-green-400 shrink-0","aria-hidden":"true"}),(0,a.jsxs)("div",{className:"grow",children:[(0,a.jsx)("b",{className:"text-xs",children:"Now available to your bot:"}),(0,a.jsx)("div",{className:"text-sm w-full inline-block max-w-[250px] truncate",children:e.name}),(0,a.jsx)("p",{className:"text-xs text-gray-400",children:(0,m.Sy)(e.date)})]})]},s))]})})})})]})})})}},97506:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return k}});var a=s(85893),n=s(11163),i=s(67294),o=s(36851),r=s(34334),l=s(40009);s(21733);var d=s(38600),c=s(61292),u=s(23275),h=s(77187),x=s(22583),m=s(97360),p=s(63115),f=s(92181),b=s(12427),g=s(29299),y=s(55678),v=s(58923),w=s(80649);s(11543);var j=s(21757);let N={defaultNode:x.Z,emptyNode:m.Z,buttonNode:p.Z,groupNode:f.Z,branchGroupNode:b.Z,branchNode:g.Z};function k(){var e,t;let s=(0,n.useRouter)(),{bot_id:x}=s.query,{activeSources:m,setActiveSources:p,activeBot:f,setActiveBot:b,nodes:g,setNodes:k,edges:Z,setEdges:_}=(0,c.Z)(),[C,S]=(0,i.useState)(!1),[E,I]=(0,i.useState)(!0),[A,z]=(0,i.useState)(null),[D,O]=(0,i.useState)(!1),[T,L]=(0,i.useState)(null),M=async e=>{if(e){let{x:t=0,y:s=0,zoom:a=1}=e.viewport;k(e.nodes||[]),_(e.edges||[])}};(0,i.useEffect)(()=>{let e=async()=>{var e,t;let s=await d.Z.get("/api/chatbots/".concat(x,"?include=destination"));b(s.data),0===m.length&&p([...s.data.source_ids.map(e=>({id:e}))]),(null==s?void 0:null===(t=s.data)||void 0===t?void 0:null===(e=t.config)||void 0===e?void 0:e.flow)?M(s.data.config.flow):q(s.data),I(!1)};x&&e()},[x,s]);let R=async()=>{let e=A.toObject(),t=(e,s)=>e.filter(e=>e.data.childOf==s).map(s=>({id:s.id,type:s.type,data:s.data,parentNode:s.parentNode,children:t(e,s.id)})),s=t(e.nodes,"start");200===(await d.Z.put("/api/chatbots",{...f,config:{...f.config,flow:e,flowJson:s}})).status&&y.Am.success("Chatbot saved successfully.")},P=async()=>{I(!0);let e=await d.Z.get("/api/chatbots/".concat(x,"?include=destination"));k([]),_([]),b(e.data),q(e.data),I(!1)},q=async e=>{var t,s,a,n,i;let o={id:"start",type:"groupNode",position:{x:0,y:0},data:{id:"start",label:"This is the start of a conversation"},style:{width:300,height:95*((null==e?void 0:null===(a=e.destination)||void 0===a?void 0:null===(s=a.config)||void 0===s?void 0:null===(t=s.questions)||void 0===t?void 0:t.length)+1||1),top:-100},draggable:!1},r={id:"firstUserMessage",type:"buttonNode",position:{x:20,y:0},data:{id:"firstUserMessage",label:"Custom user message",type:"firstUserMessage",locked:!0,childOf:"start"},parentNode:"start",extent:"parent",zIndex:1,style:{width:260,heigth:80,zIndex:1},draggable:!1};(null==e?void 0:null===(i=e.destination)||void 0===i?void 0:null===(n=i.config)||void 0===n?void 0:n.questions)?k([o,...e.destination.config.questions.map((e,t)=>({id:(t+1).toString(),type:"buttonNode",position:{x:20,y:60*t},data:{id:(t+1).toString(),label:e,type:"buttonNode",locked:!1,childOf:"start"},parentNode:"start",extent:"parent",draggable:!1,zIndex:10,style:{width:260}})),r]):k([o,r])},B=async()=>{var e,t;let s=await d.Z.get("/api/chatbots/".concat(x,"?include=destination"));b(s.data),M(null==s?void 0:null===(t=s.data)||void 0===t?void 0:null===(e=t.config)||void 0===e?void 0:e.flow),L(Math.random())},F=async e=>{k((0,o.Fb)(e,g))},K=async e=>{_((0,o.yn)(e,Z))},Q=async e=>{_((0,o.Z_)(e,Z))};return(0,a.jsxs)(h.Z,{noSpacing:!0,noDots:!0,children:[(0,a.jsx)(j.Z,{bot_id:x}),(0,a.jsx)("div",{className:" ".concat(D?"lg:pr-0":"lg:pr-[420px]"," h-[100vh] transition-all"),children:(0,a.jsx)("div",{className:"w-full h-[calc(100vh_-_110px)]",children:(0,a.jsx)(o.tV,{children:!E&&(0,a.jsxs)(o.x$,{nodes:g,edges:Z,onNodesChange:F,onEdgesChange:K,onConnect:Q,nodeTypes:N,onInit:z,fitView:!0,maxZoom:1,children:[(0,a.jsx)(r.Z,{}),(0,a.jsx)(l.A,{variant:"dots",gap:12,size:1})]})})})}),(0,a.jsxs)("div",{className:"transition-all fixed inset-y-0 border-t border-l border-gray-200 bg-white right-0 mt-[106px] z-[150] hidden w-[420px] xl:block ".concat(D?"-right-[400px]":"0"),children:[(0,a.jsx)("button",{className:"absolute -left-3 -top-3 bg-white rounded-full border border-gray-200 p-1.5",onClick:()=>O(!D),children:D?(0,a.jsx)(v.Z,{className:"w-3 h-3"}):(0,a.jsx)(w.Z,{className:"w-3 h-3"})}),(0,a.jsxs)("div",{className:"".concat(D?"hidden":"visible"),children:[(0,a.jsxs)("div",{className:"flex items-center p-4 border-b border-gray-200 bg-gray-50 gap-x-4",children:[(0,a.jsx)("button",{className:"text-center btn-default grow place-content-center",onClick:R,children:"Save"}),(0,a.jsx)("button",{className:"btn-secondary",onClick:P,children:"Reset all automations"}),(0,a.jsx)("button",{className:"btn-secondary",onClick:B,children:"Reset chat"})]}),(0,a.jsx)("div",{className:"relative p-4 py-6",children:(0,a.jsx)(u.Z,{prompt:null==f?void 0:f.prompt_id,sources:m,config:{...null==f?void 0:null===(e=f.destination)||void 0===e?void 0:e.config,title:"Finetune your bot b
1y adjusting active sources and prompts"},chatbotConfig:null==f?void 0:f.config,chatbotId:null==f?void 0:f.id,destinationId:null==f?void 0:null===(t=f.destination)||void 0===t?void 0:t.uuid,limitQueries:!1,is_public:!1,is_studio:!1,scrollHeight:!1},x)},T)]})]})]})}},45444:function(e,t,s){"use strict";var a=s(14671),n=s(38597);let i=(e,t)=>({showQuickstart:!1,doneSteps:[{id:1,title:"Create your first source",description:"Sources are used to ingest your data, so your bots know exactly what to say. You can create a source from different data sources, including CSV files, websites and audio files.",link:"/sources/catalog",completed:!1},{id:2,title:"Create your first prompt",description:"Prompts are used to generate your bot's responses. You can use prompts to set the bot's tone and personality, and to make sure your bot is always on-brand.",link:"/prompts/new",completed:!1},{id:3,title:"Create your first destination",description:"Destinations are used to send your bot's responses to your customers or your team. You can create different destination such as website embeds or Slack integrations.",link:"/destinations/catalog",completed:!1},{id:4,title:"Create your first chatbot",description:"Chatbots are used to connect your sources, prompts and destinations.",link:"/chatbots/new",completed:!1}],notifications:[],setNotifications:t=>{e(e=>({notifications:t}))},setShowQuickstart:t=>{e(e=>({showQuickstart:t}))},setDoneSteps:t=>{e(e=>({doneSteps:t}))}});i=(0,n.mW)(i),t.Z=(0,a.Z)(i)},57773:function(e,t,s){"use strict";var a=s(67294);let n=a.forwardRef(function(e,t){let{title:s,titleId:n,...i}=e;return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":n},i),s?a.createElement("title",{id:n},s):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0M3.124 7.5A8.969 8.969 0 0 1 5.292 3m13.416 0a8.969 8.969 0 0 1 2.168 4.5"}))});t.Z=n},62506:function(e,t,s){"use strict";var a=s(67294);let n=a.forwardRef(function(e,t){let{title:s,titleId:n,...i}=e;return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":n},i),s?a.createElement("title",{id:n},s):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"}))});t.Z=n},14535:function(e,t,s){"use strict";var a=s(67294);let n=a.forwardRef(function(e,t){let{title:s,titleId:n,...i}=e;return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":n},i),s?a.createElement("title",{id:n},s):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"}))});t.Z=n}},function(e){e.O(0,[8241,121,2065,4740,5936,6139,7187,3275,1543,2644,2888,9774,179],function(){return e(e.s=41926)}),_N_E=e.O()}]);
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.