Your IP : 216.73.217.77


Current Path : /home/users/unlimited/www/whatsapp-crm/public/build/assets/
Upload File :
Current File : /home/users/unlimited/www/whatsapp-crm/public/build/assets/Index-62d8ca26.js

import{T as O,r as $,O as H,o as n,c as u,a as e,w as ge,v as be,u as t,b,e as d,f,k as C,t as a,F as K,d as we,h as he,n as v,i as ye,j as xe,m as $e,G as ke,g as j,K as Ce}from"./app-43851608.js";import Me from"./Layout-eae3fe0c.js";import{t as ve}from"./index-17cd980e.js";import{d as Ve}from"./debounce-729b203d.js";import{_ as Ze}from"./AlertModal-1a288ce3.js";import{u as Te}from"./useAlertModal-27d09708.js";/* empty css              */import{a as Ae,_ as I,T as Se}from"./TableHeaderRowItem-459897e8.js";import{a as Be,_ as U,T as Fe}from"./TableBodyRowItem-110be769.js";import{_ as De}from"./Dropdown-6e7c10b4.js";import{_ as F}from"./FormInput-4a309017.js";import{_ as _e}from"./Modal-22a49fae.js";import{_ as Ne}from"./FormTextArea-a182534a.js";import"./App-26099fac.js";import"./Sidebar-13bbdf6e.js";import"./Menu-7a7609fd.js";import"./ProfileModal-628e5b7c.js";import"./LangToggle-8d05b0dc.js";import"./index-99011d5f.js";import"./MobileSidebar-64958b6d.js";import"./_baseGetTag-2e10a2d1.js";import"./_plugin-vue_export-helper-c27b6911.js";import"./use-text-value-242aa4d7.js";import"./use-tree-walker-7c9f6f67.js";const Ie={class:"bg-slate-100 md:bg-slate-50 flex items-center border border-primary md:border-none md:shadow-sm h-10 w-full md:w-80 rounded-[0.5rem] mb-6 text-sm"},Ue=e("span",{class:"pl-3"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 15l6 6m-11-4a7 7 0 1 1 0-14a7 7 0 0 1 0 14Z"})])],-1),je=["placeholder"],Oe=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10s10-4.5 10-10S17.5 2 12 2zm3.7 12.3c.4.4.4 1 0 1.4c-.4.4-1 .4-1.4 0L12 13.4l-2.3 2.3c-.4.4-1 .4-1.4 0c-.4-.4-.4-1 0-1.4l2.3-2.3l-2.3-2.3c-.4-.4-.4-1 0-1.4c.4-.4 1-.4 1.4 0l2.3 2.3l2.3-2.3c.4-.4 1-.4 1.4 0c.4.4.4 1 0 1.4L13.4 12l2.3 2.3z"})],-1),ze=[Oe],Le={key:1,class:"pr-2"},Ee=xe('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="3.5" r="1.5" fill="currentColor" opacity="0"><animateTransform attributeName="transform" calcMode="discrete" dur="2.4s" repeatCount="indefinite" type="rotate" values="0 12 12;90 12 12;180 12 12;270 12 12"></animateTransform><animate attributeName="opacity" dur="0.6s" keyTimes="0;0.5;1" repeatCount="indefinite" values="1;1;0"></animate></circle><circle cx="12" cy="3.5" r="1.5" fill="currentColor" opacity="0"><animateTransform attributeName="transform" begin="0.2s" calcMode="discrete" dur="2.4s" repeatCount="indefinite" type="rotate" values="30 12 12;120 12 12;210 12 12;300 12 12"></animateTransform><animate attributeName="opacity" begin="0.2s" dur="0.6s" keyTimes="0;0.5;1" repeatCount="indefinite" values="1;1;0"></animate></circle><circle cx="12" cy="3.5" r="1.5" fill="currentColor" opacity="0"><animateTransform attributeName="transform" begin="0.4s" calcMode="discrete" dur="2.4s" repeatCount="indefinite" type="rotate" values="60 12 12;150 12 12;240 12 12;330 12 12"></animateTransform><animate attributeName="opacity" begin="0.4s" dur="0.6s" keyTimes="0;0.5;1" repeatCount="indefinite" values="1;1;0"></animate></circle></svg>',1),He=[Ee],Ke={class:"bg-slate-100 md:bg-slate-50 rounded-[0.5rem]"},Pe={class:"w-full"},Re=["onClick"],Xe=e("span",{class:"hover:bg-[#F6F7F9] hover:rounded-full w-[fit-content] p-2"},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M16 9v10H8V9zm-1.5-6h-5l-1 1H5v2h14V4h-3.5zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2z"})])],-1),We=[Xe],qe={__name:"DocumentTable",props:{rows:{type:Object,required:!0},filters:{type:Object}},emits:["delete"],setup(Z,{emit:S}){const M=Z,{isOpenAlert:m,openAlert:T,confirmAlert:w}=Te(),y=O({test:null}),x=p=>{y.delete("/automation/upload/document/"+p)},r=p=>p===M.rows.data.length-1,o=$({search:M.filters.search}),V=$(!1),D=()=>{o.value.search=null,B()},A=Ve(()=>{V.value=!0,B()},1e3),B=()=>{H.visit("/automation/ai",{method:"get",data:o.value})},N=p=>p?p.charAt(0).toUpperCase()+p.slice(1):"";return(p,h)=>(n(),u(K,null,[e("div",Ie,[Ue,ge(e("input",{onInput:h[0]||(h[0]=(...s)=>t(A)&&t(A)(...s)),"onUpdate:modelValue":h[1]||(h[1]=s=>o.value.search=s),type:"text",class:"outline-none px-4 w-full bg-slate-100 md:bg-slate-50",placeholder:p.$t("Search by title")},null,40,je),[[be,o.value.search]]),V.value===!1&&o.value.search?(n(),u("button",{key:0,onClick:D,type:"button",class:"pr-2"},ze)):b("",!0),V.value?(n(),u("span",Le,He)):b("",!0)]),e("div",Ke,[e("table",Pe,[d(Se,null,{default:f(()=>[d(Ae,null,{default:f(()=>[d(I,{position:"first"},{default:f(()=>[C(a(p.$t("Title")),1)]),_:1}),d(I,null,{default:f(()=>[C(a(p.$t("Source")),1)]),_:1}),d(I,null,{default:f(()=>[C(a(p.$t("Status")),1)]),_:1}),d(I,null,{default:f(()=>[C(a(p.$t("Last updated")),1)]),_:1}),d(I,{position:"last"})]),_:1})]),_:1}),d(Fe,null,{default:f(()=>[(n(!0),u(K,null,we(Z.rows.data,(s,i)=>(n(),he(Be,{key:i,class:v(r(i)?"":"border-b")},{default:f(()=>[d(U,{position:"first",class:"capitalize"},{default:f(()=>[C(a(s.title),1)]),_:2},1024),d(U,{class:"hidden sm:table-cell"},{default:f(()=>[C(a(s.source),1)]),_:2},1024),d(U,{class:"hidden sm:table-cell"},{default:f(()=>[C(a(p.$t(N(s.status))),1)]),_:2},1024),d(U,{class:"hidden sm:table-cell"},{default:f(()=>[C(a(s.updated_at),1)]),_:2},1024),d(U,{position:"last"},{default:f(()=>[d(De,{align:"right",class:"mt-2"},{default:f(()=>[e("button",{onClick:g=>t(T)(s.uuid),class:"inline-flex w-full justify-center rounded-md text-sm font-medium text-black hover:bg-opacity-30 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75"},We,8,Re)]),_:2},1024)]),_:2},1024)]),_:2},1032,["class"]))),128))]),_:1})])]),d(Ze,{modelValue:t(m),"onUpdate:modelValue":h[2]||(h[2]=s=>ye(m)?m.value=s:null),onConfirm:h[3]||(h[3]=()=>t(w)(x)),label:p.$t("Delete row"),description:p.$t("Are you sure you want to delete this row? This action can not be undone")},null,8,["modelValue","label","description"])],64))}},Ge={class:"block text-sm leading-6 text-gray-900 mt-4 mb-1"},Je={class:"max-w-md w-full gap-y-8"},Qe={class:"space-y-6"},Ye={for:"file-upload",class:"text-center cursor-pointer"},et=e("svg",{class:"mx-auto h-12 w-12 text-gray-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("g",{fill:"none"},[e("path",{fill:"currentColor",d:"m15.393 4.054l-.502.557l.502-.557Zm3.959 3.563l-.502.557l.502-.557Zm2.302 2.537l-.685.305l.685-.305ZM3.172 20.828l.53-.53l-.53.53Zm17.656 0l-.53-.53l.53.53ZM14 21.25h-4v1.5h4v-1.5ZM2.75 14v-4h-1.5v4h2.5Zm18.5-.437V14h2.5v-.437h-1.5ZM14.891 4.61l3.959 3.563l1.003-1.115l-3.958-3.563l-1.004 1.115Zm7.859 8.952c0-1.689.015-2.758-.41-3.714l-1.371.61c.266.598.281 1.283.281 3.104h2.5Zm-3.9-5.389c1.353 1.218 1.853 1.688 2.119 2.285l1.37-.61c-.426-.957-1.23-1.66-2.486-2.79L18.85 8.174ZM10.03 2.75c1.582 0 2.179.012 2.71.216l.538-1.4c-.852-.328-1.78-.316-3.248-.316v1.5Zm5.865.746c-1.086-.977-1.765-1.604-2.617-1.93l-.537 1.4c.532.204.98.592 2.15 1.645l1.004-1.115ZM10 21.25c-1.907 0-3.261-.002-4.29-.14c-1.005-.135-1.585-.389-2.008-.812l-1.06 1.06c.748.75 1.697 1.081 2.869 1.239c1.15.155 2.625.153 4.489.153v-1.5ZM1.25 14c0 1.864-.002 3.338.153 4.489c.158 1.172.49 2.121 1.238 2.87l1.06-1.06c-.422-.424-.676-1.004-.811-2.01c-.138-1.027-.14-2.382-.14-4.289h-1.5ZM14 22.75c1.864 0 3.338.002 4.489-.153c1.172-.158 2.121-.49 2.87-1.238l-1.06-1.06c-.424.422-1.004.676-2.01.811c-1.027.138-2.382.14-4.289.14v1.5ZM21.25 14c0 1.907-.002 3.262-.14 4.29c-.135 1.005-.389 1.585-.812 2.008l1.06 1.06c.75-.748 1.081-1.697 1.239-2.869c.155-1.15.153-2.625.153-4.489h-1.5Zm-18.5-4c0-1.907.002-3.261.14-4.29c.135-1.005.389-1.585.812-2.008l-1.06-1.06c-.75.748-1.081 1.697-1.239 2.869C1.248 6.661 1.25 8.136 1.25 10h2.5Zm7.28-8.75c-1.875 0-3.356-.002-4.511.153c-1.177.158-2.129.49-2.878 1.238l1.06 1.06c.424-.422 1.005-.676 2.017-.811c1.033-.138 2.395-.14 4.312-.14v-1.5Z"}),e("path",{stroke:"currentColor","stroke-width":"1.5",d:"M13 2.5V5c0 2.357 0 3.536.732 4.268C14.464 10 15.643 10 18 10h4"})])],-1),tt={class:"flex text-sm text-gray-600"},st={class:"relative bg-white rounded-md"},ot={class:"pl-1"},lt={class:"text-xs text-gray-500"},at={class:"text-xs text-gray-500"},it=e("b",null,"20MB",-1),nt=e("svg",{class:"mx-auto h-12 w-12 text-gray-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("g",{fill:"none"},[e("path",{fill:"currentColor",d:"m15.393 4.054l-.502.557l.502-.557Zm3.959 3.563l-.502.557l.502-.557Zm2.302 2.537l-.685.305l.685-.305ZM3.172 20.828l.53-.53l-.53.53Zm17.656 0l-.53-.53l.53.53ZM14 21.25h-4v1.5h4v-1.5ZM2.75 14v-4h-1.5v4h2.5Zm18.5-.437V14h2.5v-.437h-1.5ZM14.891 4.61l3.959 3.563l1.003-1.115l-3.958-3.563l-1.004 1.115Zm7.859 8.952c0-1.689.015-2.758-.41-3.714l-1.371.61c.266.598.281 1.283.281 3.104h2.5Zm-3.9-5.389c1.353 1.218 1.853 1.688 2.119 2.285l1.37-.61c-.426-.957-1.23-1.66-2.486-2.79L18.85 8.174ZM10.03 2.75c1.582 0 2.179.012 2.71.216l.538-1.4c-.852-.328-1.78-.316-3.248-.316v1.5Zm5.865.746c-1.086-.977-1.765-1.604-2.617-1.93l-.537 1.4c.532.204.98.592 2.15 1.645l1.004-1.115ZM10 21.25c-1.907 0-3.261-.002-4.29-.14c-1.005-.135-1.585-.389-2.008-.812l-1.06 1.06c.748.75 1.697 1.081 2.869 1.239c1.15.155 2.625.153 4.489.153v-1.5ZM1.25 14c0 1.864-.002 3.338.153 4.489c.158 1.172.49 2.121 1.238 2.87l1.06-1.06c-.422-.424-.676-1.004-.811-2.01c-.138-1.027-.14-2.382-.14-4.289h-1.5ZM14 22.75c1.864 0 3.338.002 4.489-.153c1.172-.158 2.121-.49 2.87-1.238l-1.06-1.06c-.424.422-1.004.676-2.01.811c-1.027.138-2.382.14-4.289.14v1.5ZM21.25 14c0 1.907-.002 3.262-.14 4.29c-.135 1.005-.389 1.585-.812 2.008l1.06 1.06c.75-.748 1.081-1.697 1.239-2.869c.155-1.15.153-2.625.153-4.489h-1.5Zm-18.5-4c0-1.907.002-3.261.14-4.29c.135-1.005.389-1.585.812-2.008l-1.06-1.06c-.75.748-1.081 1.697-1.239 2.869C1.248 6.661 1.25 8.136 1.25 10h2.5Zm7.28-8.75c-1.875 0-3.356-.002-4.511.153c-1.177.158-2.129.49-2.878 1.238l1.06 1.06c.424-.422 1.005-.676 2.017-.811c1.033-.138 2.395-.14 4.312-.14v-1.5Z"}),e("path",{stroke:"currentColor","stroke-width":"1.5",d:"M13 2.5V5c0 2.357 0 3.536.732 4.268C14.464 10 15.643 10 18 10h4"})])],-1),rt={class:"rounded-md p-1 bg-slate-50 text-center text-sm flex items-center gap-x-1"},dt=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 20 20"},[e("g",{fill:"black"},[e("path",{d:"M6.854 13.854a.5.5 0 0 1-.708-.708l7-7a.5.5 0 0 1 .708.708z"}),e("path",{d:"M6.146 6.854a.5.5 0 1 1 .708-.708l7 7a.5.5 0 0 1-.708.708z"})])],-1),ut=[dt],ct={key:0,class:"form-error text-[#b91c1c] text-xs"},mt={class:"mt-5"},pt={class:"flex justify-center mt-2 w-full"},ft={key:0,class:"w-full inline-flex justify-center rounded-md border border-transparent bg-primary px-4 py-2 text-sm text-white hover:bg-green-800 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"},vt=e("svg",{class:"mx-auto text-white",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},[e("path",{fill:"none",stroke:"white","stroke-dasharray":"15","stroke-dashoffset":"15","stroke-linecap":"round","stroke-width":"2",d:"M12 3C16.9706 3 21 7.02944 21 12"},[e("animate",{fill:"freeze",attributeName:"stroke-dashoffset",dur:"0.3s",values:"15;0"}),e("animateTransform",{attributeName:"transform",dur:"1.5s",repeatCount:"indefinite",type:"rotate",values:"0 12 12;360 12 12"})])],-1),ht=[vt],_t={__name:"DocumentUploadModal",props:["type","modelValue"],emits:["update:modelValue"],setup(Z,{emit:S}){const M=Z,m=S;$e(()=>Ce().props.flash.status);const T=ve("Upload Document"),w=$(M.modelValue),y=$(null),x=$(y.value),r=$(null),o=O({title:null,file:null});ke(()=>M.modelValue,s=>{w.value=s});const V=s=>{s.preventDefault();const i=s.target.files[0];A(i)},D=s=>{s.preventDefault();const i=s.dataTransfer.files[0];A(i)};function A(s){if(!["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain"].includes(s.type)){alert(ve("please select a PDF, Word, or TXT file"));return}y.value=s.name,x.value=B(y.value,28),o.file=s}const B=(s,i)=>{if(s.length<=i)return s;const g=Math.floor(i/2),z=s.slice(0,g),L=s.slice(-g);return`${z}...${L}`};function N(){o.file=null}function p(){const s=new FormData;s.append("title",o.title),s.append("file",o.file),o.post("/automation/upload/document",{preserveScroll:!0,onProgress:i=>{r.value="pending"},onSuccess:()=>{o.reset(),r.value="complete",h()},onError:i=>{r.value=null}})}function h(){w.value=!1,m("update:modelValue",!1),setTimeout(()=>{r.value=null,o.reset(),o.clearErrors()},500)}return(s,i)=>(n(),he(_e,{label:t(T),isOpen:w.value,closeBtn:!0,onClose:i[5]||(i[5]=g=>h())},{default:f(()=>[d(F,{modelValue:t(o).title,"onUpdate:modelValue":i[0]||(i[0]=g=>t(o).title=g),error:t(o).errors.title,name:"Title",type:"text",class:v("mt-4")},null,8,["modelValue","error"]),e("div",Ge,a(s.$t("Document (PDF, word or TXT file)")),1),e("div",Je,[e("div",Qe,[t(o).file==null?(n(),u("div",{key:0,onDragover:i[2]||(i[2]=j(()=>{},["prevent"])),onDrop:D,class:v(["flex justify-center px-6 pt-5 pb-6 shadow-sm outline-none ring-1 ring-inset rounded-md",t(o).errors.file?"ring-[#b91c1c]":"ring-gray-300"])},[e("input",{type:"file",class:"sr-only",accept:".pdf,.txt,.doc,.docx",ref:"fileInput",id:"file-upload",onChange:i[1]||(i[1]=g=>V(g))},null,544),e("label",Ye,[e("div",null,[et,e("div",tt,[e("div",st,[e("span",null,a(s.$t("Click to upload a file")),1)]),e("p",ot,a(s.$t("Or drag and drop")),1)]),e("p",lt,a(s.$t("PDF, Word or TXT files only")),1),e("p",at,[C(a(s.$t("Maximum size"))+" ",1),it])])])],34)):(n(),u("div",{key:1,class:v(["flex justify-center px-6 pt-5 pb-6 shadow-sm outline-none ring-1 ring-inset rounded-md",t(o).errors.file?"ring-[#b91c1c]":"ring-gray-300"])},[e("div",null,[nt,e("div",rt,[e("span",null,a(x.value),1),e("span",{onClick:i[3]||(i[3]=g=>N()),class:"bg-slate-200 rounded-full cursor-pointer"},ut)])])],2))]),t(o).errors.file?(n(),u("span",ct,a(t(o).errors.file),1)):b("",!0)]),e("div",mt,[e("div",pt,[t(o).processing?(n(),u("div",ft,ht)):(n(),u("button",{key:1,type:"button",onClick:i[4]||(i[4]=g=>p()),class:"w-full inline-flex justify-center rounded-md border border-transparent bg-primary px-4 py-2 text-sm text-white hover:bg-green-800 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"},a(s.$t("Upload")),1))])])]),_:1},8,["label","isOpen"]))}},gt={class:"md:h-[90vh]"},bt={class:"flex justify-center items-center"},wt={class:"md:w-[60em]"},yt={class:"bg-white border border-slate-200 rounded-lg pt-2 text-sm mb-4 px-4 mb-20"},xt={class:"w-full py-2 mb-4 mt-2"},$t={class:"flex w-full"},kt={class:"text-md"},Ct={class:"text-[16px]"},Mt={class:"mb-1 text-slate-500"},Vt={class:"ml-auto"},Zt={class:"flex items-center gap-x-3"},Tt={key:2},At={class:"flex items-center justify-between px-4 pt-2 pb-4"},St={class:"text-[16px]"},Bt={class:"text-slate-500"},Ft={class:"w-[10%]"},Dt={key:0,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Nt=e("path",{fill:"black","fill-rule":"evenodd",d:"M16.53 14.03a.75.75 0 0 1-1.06 0L12 10.56l-3.47 3.47a.75.75 0 0 1-1.06-1.06l4-4a.75.75 0 0 1 1.06 0l4 4a.75.75 0 0 1 0 1.06","clip-rule":"evenodd"},null,-1),It=[Nt],Ut={key:1,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},jt=e("path",{fill:"black","fill-rule":"evenodd",d:"M16.53 8.97a.75.75 0 0 1 0 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L12 12.44l3.47-3.47a.75.75 0 0 1 1.06 0","clip-rule":"evenodd"},null,-1),Ot=[jt],zt={key:0},Lt={class:"flex space-x-10 border-b w-full px-4 py-6"},Et={class:"w-[70%]"},Ht={class:"text-slate-600"},Kt={class:"text-xs text-slate-700 flex items-center"},Pt={class:"w-[30%]"},Rt={class:"flex space-x-10 border-b w-full px-4 py-6"},Xt={class:"w-[40%]"},Wt={class:"text-slate-600"},qt={class:"text-xs text-slate-700 flex items-center"},Gt={class:"w-[60%]"},Jt={class:"flex space-x-10 border-b w-full px-4 py-6"},Qt={class:"w-[40%]"},Yt={class:"text-slate-600"},es={class:"text-xs text-slate-700 flex items-center"},ts={class:"w-[60%]"},ss={class:"flex px-4 pt-1"},os={class:"ml-auto mt-2"},ls=["disabled"],as={key:0,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},is=e("path",{fill:"currentColor",d:"M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z",opacity:".5"},null,-1),ns=e("path",{fill:"currentColor",d:"M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z"},[e("animateTransform",{attributeName:"transform",dur:"1s",from:"0 12 12",repeatCount:"indefinite",to:"360 12 12",type:"rotate"})],-1),rs=[is,ns],ds={key:1},us={key:1,class:"bg-white border border-slate-200 rounded-lg py-2 text-sm mb-20 pb-4 px-4"},cs={class:"w-full py-2 mb-4 mt-2"},ms={class:"flex w-full mb-4"},ps={class:"text-md w-[70%]"},fs={class:"text-[16px]"},vs={class:"flex items-center mt-1 text-slate-500"},hs={class:"ml-auto w-[40%]"},_s={class:"float-right flex items-center gap-x-2"},gs={class:"w-5/5"},bs={class:"mt-5 grid grid-cols-1 gap-x-6 gap-y-4"},ws={class:"mt-4 flex"},ys=["disabled"],xs={key:0,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},$s=e("path",{fill:"currentColor",d:"M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z",opacity:".5"},null,-1),ks=e("path",{fill:"currentColor",d:"M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z"},[e("animateTransform",{attributeName:"transform",dur:"1s",from:"0 12 12",repeatCount:"indefinite",to:"360 12 12",type:"rotate"})],-1),Cs=[$s,ks],Ms={key:1},Js={__name:"Index",props:["rows","filters","settings","aimodule"],setup(Z){var h,s,i,g,z,L,P,R,X,W,q,G,J,Q,Y,ee,te,se;const S=Z,M=$(S.settings.metadata),m=$(M.value?JSON.parse(M.value):null),T=$(!1),w=$(!1),y=$(!1),x=O({active:((s=(h=m.value)==null?void 0:h.ai)==null?void 0:s.active)??!1}),r=O({active:((g=(i=m.value)==null?void 0:i.ai)==null?void 0:g.active)??!1,api_key:((L=(z=m.value)==null?void 0:z.ai)==null?void 0:L.api_key)??null,model:((R=(P=m.value)==null?void 0:P.ai)==null?void 0:R.model)??null,max_tokens:((W=(X=m.value)==null?void 0:X.ai)==null?void 0:W.max_tokens)??null,temperature:((G=(q=m.value)==null?void 0:q.ai)==null?void 0:G.temperature)??null}),o=O({enable_automatic_responses:((Q=(J=m.value)==null?void 0:J.ai)==null?void 0:Q.enable_automatic_responses)??!1,start_keywords:((ee=(Y=m.value)==null?void 0:Y.ai)==null?void 0:ee.start_keywords)??null,stop_keywords:((se=(te=m.value)==null?void 0:te.ai)==null?void 0:se.stop_keywords)??null}),V=()=>{y.value=!y.value},D=()=>{x.active=!x.active,B()},A=()=>{o.enable_automatic_responses=!o.enable_automatic_responses},B=async()=>{x.post("/automation/ai/activate",{preserveScroll:!0})},N=()=>{r.post("/automation/ai/setup",{preserveScroll:!0,onSuccess:()=>{H.visit("/automation/ai",{preserveState:!1})}})},p=()=>{o.post("/automation/ai/assistant-setup",{preserveScroll:!0,onSuccess:()=>{H.visit("/automation/ai",{preserveState:!1})}})};return(c,l)=>(n(),u(K,null,[d(Me,{aimodule:Z.aimodule},{default:f(()=>{var E,oe,le,ae,ie,ne,re,de,ue,ce,me,pe;return[e("div",gt,[e("div",bt,[e("div",wt,[e("div",yt,[e("div",xt,[e("div",$t,[e("div",kt,[e("h4",Ct,a(c.$t("Enable AI Assistant")),1),e("div",Mt,a(c.$t("Activate AI-generated responses in your conversations")),1)]),e("div",Vt,[e("div",Zt,[((oe=(E=m.value)==null?void 0:E.ai)==null?void 0:oe.api_key)!=null?(n(),u("div",{key:0,class:v(["w-12 h-6 flex items-center bg-gray-300 rounded-full p-1",{"bg-primary":t(x).active}]),onClick:l[0]||(l[0]=_=>D(c.active))},[e("div",{class:v(["bg-white w-4 h-4 rounded-full shadow-md transform duration-300 ease-in-out",{"translate-x-6":t(x).active}])},null,2)],2)):b("",!0),((ae=(le=m.value)==null?void 0:le.ai)==null?void 0:ae.api_key)==null?(n(),u("div",{key:1,class:v(["w-12 h-6 flex items-center bg-gray-300 rounded-full p-1",{"bg-primary":t(r).active}]),onClick:l[1]||(l[1]=_=>{t(r).active=!0,w.value=!0})},[e("div",{class:v(["bg-white w-4 h-4 rounded-full shadow-md transform duration-300 ease-in-out",{"translate-x-6":t(r).active}])},null,2)],2)):b("",!0),((ne=(ie=m.value)==null?void 0:ie.ai)==null?void 0:ne.api_key)!=null?(n(),u("div",Tt," | ")):b("",!0),((de=(re=m.value)==null?void 0:re.ai)==null?void 0:de.api_key)!=null?(n(),u("button",{key:3,onClick:l[2]||(l[2]=_=>w.value=!0),class:"bg-primary text-white h-8 rounded-lg text-[13px] px-3 w-fit"},a(c.$t("Update")),1)):b("",!0)])])])])]),((ce=(ue=m.value)==null?void 0:ue.ai)==null?void 0:ce.api_key)!=null?(n(),u("form",{key:0,onSubmit:l[8]||(l[8]=j(_=>p(),["prevent"])),class:"bg-white border border-slate-200 rounded-lg py-2 text-sm mb-4 pb-4"},[e("div",At,[e("div",{onClick:l[3]||(l[3]=_=>V()),class:"w-[90%] cursor-pointer"},[e("h4",St,a(c.$t("AI Assistant Setup")),1),e("div",Bt,a(c.$t("Setup keywords for AI assistance")),1)]),e("div",Ft,[e("button",{type:"button",onClick:l[4]||(l[4]=_=>V()),class:"hover:bg-slate-50 rounded-full p-1 float-right"},[y.value?(n(),u("svg",Dt,It)):b("",!0),y.value?b("",!0):(n(),u("svg",Ut,Ot))])])]),y.value?(n(),u("div",zt,[e("div",Lt,[e("div",Et,[e("span",Ht,a(c.$t("Enable automatic AI assistance for new conversations")),1),e("div",Kt,[e("span",null,a(c.$t("Turn on this option to let users automatically get help from the AI whenever they start a new conversation or ticket. If enabled, this will override the keywords set for initiating AI chat.")),1)])]),e("div",Pt,[e("div",{class:v(["ml-auto w-12 h-6 flex items-center bg-gray-300 rounded-full p-1",{"bg-primary":t(o).enable_automatic_responses}]),onClick:l[5]||(l[5]=_=>A())},[e("div",{class:v(["bg-white w-4 h-4 rounded-full shadow-md transform duration-300 ease-in-out",{"translate-x-6":t(o).enable_automatic_responses}])},null,2)],2)])]),e("div",Rt,[e("div",Xt,[e("span",Wt,a(c.$t("Keyword(s) to start the AI agent")),1),e("div",qt,[e("span",null,a(c.$t("Set word or phrase")),1)])]),e("div",Gt,[d(F,{modelValue:t(o).start_keywords,"onUpdate:modelValue":l[6]||(l[6]=_=>t(o).start_keywords=_),error:t(o).errors.start_keywords,name:"",type:"text",class:v("col-span-4")},null,8,["modelValue","error"])])]),e("div",Jt,[e("div",Qt,[e("span",Yt,a(c.$t("Keyword(s) to stop the AI agent")),1),e("div",es,[e("span",null,a(c.$t("Set word or phrase")),1)])]),e("div",ts,[d(Ne,{modelValue:t(o).stop_keywords,"onUpdate:modelValue":l[7]||(l[7]=_=>t(o).stop_keywords=_),error:t(o).errors.stop_keywords,name:"",type:"text",class:v("col-span-4")},null,8,["modelValue","error"])])]),e("div",ss,[e("div",os,[e("button",{type:"submit",class:"float-right bg-primary text-white h-8 rounded-lg text-[13px] px-3 w-fit",disabled:t(o).processing},[t(o).processing?(n(),u("svg",as,rs)):(n(),u("span",ds,a(c.$t("Save")),1))],8,ls)])])])):b("",!0)],32)):b("",!0),((pe=(me=m.value)==null?void 0:me.ai)==null?void 0:pe.api_key)!=null?(n(),u("div",us,[e("div",cs,[e("div",ms,[e("div",ps,[e("h4",fs,a(c.$t("Knowledge Base")),1),e("span",vs,a(c.$t("Enhance your AI assistant by uploading information to improve client interactions.")),1)]),e("div",hs,[e("div",_s,[e("button",{onClick:l[9]||(l[9]=_=>T.value=!0),class:"rounded-md bg-primary px-3 h-8 text-[13px] text-white shadow-sm hover:bg-black focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"},a(c.$t("Upload Documents")),1)])])]),e("div",gs,[d(qe,{rows:S.rows,filters:S.filters},null,8,["rows","filters"])])])])):b("",!0)])])]),d(_e,{label:c.$t("AI Assistant Setup"),isOpen:w.value},{default:f(()=>{var _,fe;return[e("div",bs,[e("form",{onSubmit:l[16]||(l[16]=j(k=>N(),["prevent"])),class:"grid gap-x-6 gap-y-4 sm:grid-cols-6"},[d(F,{modelValue:t(r).api_key,"onUpdate:modelValue":l[10]||(l[10]=k=>t(r).api_key=k),error:t(r).errors.api_key,name:c.$t("OpenAI API Key"),type:"password",class:v("sm:col-span-6")},null,8,["modelValue","error","name"]),d(F,{modelValue:t(r).model,"onUpdate:modelValue":l[11]||(l[11]=k=>t(r).model=k),error:t(r).errors.model,name:c.$t("Model"),type:"text",class:v("sm:col-span-6")},null,8,["modelValue","error","name"]),d(F,{modelValue:t(r).max_tokens,"onUpdate:modelValue":l[12]||(l[12]=k=>t(r).max_tokens=k),error:t(r).errors.max_tokens,name:c.$t("Max Tokens"),type:"text",class:v("sm:col-span-3")},null,8,["modelValue","error","name"]),d(F,{modelValue:t(r).temperature,"onUpdate:modelValue":l[13]||(l[13]=k=>t(r).temperature=k),error:t(r).errors.temperature,name:c.$t("Temperature"),type:"text",class:v("sm:col-span-3")},null,8,["modelValue","error","name"]),e("div",ws,[((fe=(_=m.value)==null?void 0:_.ai)==null?void 0:fe.api_key)==null?(n(),u("button",{key:0,type:"button",onClick:l[14]||(l[14]=j(k=>{w.value=!1,t(r).active=!1},["self"])),class:"inline-flex justify-center rounded-md border border-transparent bg-slate-50 px-4 py-2 text-sm text-slate-500 hover:bg-slate-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 mr-4"},a(c.$t("Cancel")),1)):(n(),u("button",{key:1,type:"button",onClick:l[15]||(l[15]=j(k=>w.value=!1,["self"])),class:"inline-flex justify-center rounded-md border border-transparent bg-slate-50 px-4 py-2 text-sm text-slate-500 hover:bg-slate-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 mr-4"},a(c.$t("Cancel")),1)),e("button",{class:v(["inline-flex justify-center rounded-md border border-transparent bg-primary px-4 py-2 text-sm text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",{"opacity-50":t(x).processing}]),disabled:t(r).processing},[t(r).processing?(n(),u("svg",xs,Cs)):(n(),u("span",Ms,a(c.$t("Save")),1))],10,ys)])],32)])]}),_:1},8,["label","isOpen"])]}),_:1},8,["aimodule"]),d(_t,{type:"contact",modelValue:T.value,"onUpdate:modelValue":l[17]||(l[17]=E=>T.value=E)},null,8,["modelValue"])],64))}};export{Js as default};