1import{h as m,T as O,A as F,a4 as H,o as d,e as c,b as u,w as y,F as V,a as e,t as n,u as r,i as z,d as k,k as L,n as b,g,r as I}from"./app-7815e791.js";import{_ as D}from"./App-3930589c.js";import{t as h}from"./index-b290e30e.js";import{_ as G}from"./FormInput-2b68ba6f.js";import{_ as S}from"./FormSelect-8184c6e6.js";import{_ as W}from"./FormTextArea-41e997bd.js";import{_ as J}from"./Modal-2db2b2c5.js";import{P as q}from"./style-0888ef27.js";import"./Sidebar-c5d35ae8.js";import"./Menu-9020baf4.js";import"./ProfileModal-4e3334d9.js";import"./FormPhoneInput-557d4d70.js";/* empty css */import"./_plugin-vue_export-helper-c27b6911.js";import"./transition-f502e46f.js";import"./keyboard-eb760314.js";import"./open-closed-45a14c26.js";import"./hidden-b908ac47.js";import"./micro-task-89dcd6af.js";import"./tabs-b83056de.js";import"./use-resolve-button-type-314233cb.js";import"./OrganizationModal-9d636f08.js";import"./use-text-value-64cb9bbb.js";import"./index-168b89c2.js";import"./MobileSidebar-2ee47e38.js";/* empty css */import"./useDesktopNotifications-a7590a71.js";const K={class:"bg-white md:bg-inherit pt-10 px-4 md:pt-8 md:p-8 rounded-[5px] text-[#000] h-full md:overflow-y-auto"},Q={class:"flex justify-between"},X={class:"text-xl mb-1"},Y={class:"mb-6 flex items-center text-sm leading-6 text-gray-600"},ee={class:"ml-1 mt-1"},te={class:"flex flex-col md:flex-row border-b py-5"},se={class:"w-full md:w-[40%] mb-1 md:mb-0"},oe={class:"text-sm text-gray-500 tracking-[0px]"},le={class:"w-full md:w-[60%] flex flex-col md:flex-row md:space-x-6 space-y-4 md:space-y-0"},re={class:"w-full md:w-[80%]"},ne={class:"flex flex-col md:flex-row border-b py-5 gap-4 md:gap-0"},ie={class:"w-full md:w-[40%] mb-1 md:mb-0"},ae={class:"text-sm text-gray-500 tracking-[0px]"},de={class:"flex items-start text-xs mt-2 gap-2"},ce={class:"w-full md:w-[60%] flex flex-col md:flex-row md:space-x-6"},pe={class:"w-full md:w-[80%]"},ue={class:"flex flex-col sm:flex-row border-b py-4 sm:py-5 gap-3 sm:gap-0"},me={class:"w-full sm:w-[40%]"},fe={class:"text-sm text-gray-500 tracking-normal"},ge={class:"flex items-start gap-2 mt-1 sm:mt-2 text-xs text-gray-600"},he={class:"w-full sm:w-[60%] mt-2 sm:mt-0"},ve={class:"w-full sm:w-[80%]"},xe={class:"flex flex-col sm:flex-row border-b py-4 sm:py-5 gap-3 sm:gap-0"},we={class:"w-full sm:w-[40%] mb-1 sm:mb-0"},be={class:"text-sm text-gray-500 tracking-normal"},_e={class:"w-full sm:w-[60%]"},ye={class:"w-full sm:w-[80%]"},ke={key:0,class:"flex flex-col sm:flex-row py-5 gap-y-4"},$e={class:"sm:w-2/5 w-full"},Ce={class:"text-sm text-gray-500 tracking-[0px]"},Ve={class:"sm:w-3/5 w-full flex flex-col space-y-3"},Le={class:"w-full"},Se={class:"sm:col-span-6 mb-2"},je={class:"mt-2"},Be={key:0,class:"form-error text-[#b91c1c] text-xs"},Me={class:"flex flex-wrap items-center gap-3"},Re={class:"relative"},Te={class:"pt-4 text-right"},Ze={type:"submit",class:"inline-flex items-center space-x-2 rounded-md bg-black px-3 py-2 text-sm text-white shadow-sm hover:bg-slate-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-600"},Pe={key:1,class:"flex flex-col md:flex-row py-5 gap-y-4"},Ae={class:"md:w-2/5 w-full"},Ee={key:0,class:"text-sm text-gray-500 tracking-[0px]"},Ue={key:1,class:"text-sm text-gray-500 tracking-[0px]"},Ne={class:"md:w-3/5 w-full flex flex-col space-y-4"},Oe={class:"w-full"},Fe=["accept"],He={class:"text-center w-full"},ze={key:0,class:"flex justify-center items-center"},Ie={class:"flex flex-wrap justify-center items-center space-x-3 py-1 border bg-slate-100 rounded-lg mb-2 w-fit px-2 max-w-full"},De={class:"flex items-center space-x-2 max-w-full"},Ge={class:"text-sm truncate max-w-[160px]"},We={class:"flex justify-center text-sm text-gray-600"},Je={for:"file-upload",class:"relative cursor-pointer bg-white rounded-md font-medium hover:text-indigo-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-indigo-500"},qe={class:"text-xs text-center text-gray-500"},Ke={key:0,class:"form-error text-[#b91c1c] text-xs mt-1"},Qe={type:"submit",class:"mt-6 md:mt-10 flex items-center space-x-4 roun
1ded-md bg-black px-4 py-2 text-sm text-white shadow-sm hover:bg-slate-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 float-right"},Xe={class:"flex bg-slate-50 p-2 rounded-md mt-3"},Ye={class:"font-light text-sm"},et={class:"mt-2 grid grid-cols-1 gap-x-6"},tt={class:"pt-3 grid grid-cols-2 gap-x-2 text-sm gap-y-1"},st=["onClick"],ot={class:"mt-4 border-t pt-4 modal-footer"},Mt={__name:"Create",props:["placeholders"],setup(j){const B=j,v=m(!1),f=m(null),x=m(!1),_=m(null),M=s=>{const t=f.value,i=t.value||"",l=t.selectionStart||0,p=t.selectionEnd||0,a=`${i.substring(0,l)}${s}${i.substring(p)}`;t.value=a,o.response=a,setTimeout(()=>{t.focus(),t.setSelectionRange(l+s.length,l+s.length)},0),v.value=!1},R=s=>{o.response=s.target.value},o=O({name:null,trigger:null,match_criteria:null,response_type:"text",response:null}),T=m([{value:"exact match",label:h("When text is an exact match to trigger text")},{value:"contains",label:h("When text contains trigger text")}]),Z=m([{value:"text",label:h("Respond with text")},{value:"image",label:h("Respond with image")},{value:"audio",label:h("Respond with audio")}]),P=s=>{const t=s.target.files[0],i=new FileReader;i.onload=l=>{o.response=t},i.readAsDataURL(t)},$=()=>{o.response=null},A=()=>{o.post("/automation/basic",{preserveScroll:!0,onSuccess:()=>o.reset()})},w=s=>{const t=f.value,i=t.selectionStart,l=t.selectionEnd,p=o.response.slice(i,l);let a="";s=="bold"?a=o.response.slice(0,i)+"*"+p+"*"+o.response.slice(l):s=="italic"?a=o.response.slice(0,i)+"_"+p+"_"+o.response.slice(l):s=="strike-through"?a=o.response.slice(0,i)+"~"+p+"~"+o.response.slice(l):s=="monospace"&&(a=o.response.slice(0,i)+"```"+p+"```"+o.response.slice(l)),t.value=a,setTimeout(()=>{s=="monospace"?t.setSelectionRange(i+3,l+3):t.setSelectionRange(i+1,l+1),t.focus()},0)},E=s=>{s.stopPropagation(),x.value=!x.value},U=()=>{x.value=!1},N=s=>{const t=f.value,i=t.value||"",l=t.selectionStart||0,p=t.selectionEnd||0,a=i.substring(0,l)+s.i+i.substring(p);t.value=a,o.response=a,setTimeout(()=>{t.focus(),t.setSelectionRange(l+s.i.length,l+s.i.length)},0)},C=s=>{_.value&&!_.value.contains(s.target)&&!f.value.contains(s.target)&&U()};return F(()=>{document.addEventListener("click",C)}),H(()=>{document.removeEventListener("click",C)}),(s,t)=>(d(),c(V,null,[u(D,null,{default:y(()=>{var i;return[e("div",K,[e("div",Q,[e("div",null,[e("h2",X,n(s.$t("Create automation")),1),e("p",Y,[t[13]||(t[13]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 11v5m0 5a9 9 0 1 1 0-18a9 9 0 0 1 0 18Zm.05-13v.1h-.1V8h.1Z"})],-1)),e("span",ee,n(s.$t("Create reply automation using your own criteria")),1)])]),e("div",null,[u(r(z),{href:"/automation/basic",class:"flex items-center space-x-4 rounded-md bg-indigo-600 px-3 py-2 text-sm text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"},{default:y(()=>[t[14]||(t[14]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},[e("path",{fill:"currentColor","fill-rule":"evenodd",d:"M5.841 5.28a.75.75 0 0 0-1.06-1.06L1.53 7.47L1 8l.53.53l3.25 3.25a.75.75 0 0 0 1.061-1.06l-1.97-1.97H24.25a.75.75 0 0 0 0-1.5H3.871l1.97-1.97Z","clip-rule":"evenodd"})],-1)),k(" "+n(s.$t("Back")),1)]),_:1})])]),e("form",{onSubmit:t[11]||(t[11]=L(l=>A(),["prevent"])),class:"bg-white border py-5 px-5 rounded-[0.5rem]"},[e("div",te,[e("div",se,[e("h2",oe,n(s.$t("Name")),1)]),e("div",le,[e("div",re,[u(G,{modelValue:r(o).name,"onUpdate:modelValue":t[0]||(t[0]=l=>r(o).name=l),type:"text",error:r(o).errors.name,class:b("w-full"),labelClass:"mb-0"},null,8,["modelValue","error"])])])]),e("div",ne,[e("div",ie,[e("h2",ae,n(s.$t("Trigger")),1),e("span",de,[t[15]||(t[15]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24",class:"mt-0.5 flex-shrink-0"},[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 11v5m0 5a9 9 0 1 1 0-18a9 9 0 0 1 0 18Zm.05-13v.1h-.1V8h.1Z"})],-1)),k(" "+n(s.$t("Add the string of text responsible for triggering the response")),1)])]),e("div",ce,[e("div",pe,[u(W,{modelValue:r(o).trigger,"onUpdate:modelValue":t[1]||(t[1]=l=>r(o).trigger=l),type:"text",error:r(o).errors.trigger,textAreaRows:3,class:b("w-full mb-4 md:mb-10")},null,8,["modelValue","error"])])])]),e("div",ue,[e("div",me,[e("h2",fe,n(s.$t("Match criteria")),1),e("div",ge,[t[16]||(t[16]=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"flex-shrink-0 mt-0.5",width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("path",{d:"M12 11v5m0 5a9 9 0 1 1 0-18a9 9 0 0 1 0 18Zm.05-13v.1h-.1V8h.1Z"})],-1)),e("span",null,n(s.$t("Select the criteria for matching the trigger text above")),1)])]),e("div",he,[e("div",ve,[u(S,{labelTranslate:!0,modelValue:r(o).match_criteria,"onUpdate:modelValue":t[2]||(t[2]=l=>r(o).match_criteria=l),options:T.value,error:r(o).errors.match_criteria,class:"w-full",placeholder:s.$t("Select criteria")},null,8,["modelValue","options","error","placeholder"])])])]),e("div",xe,[e("div",we,[e("h2",be,n(s.$t("Response type")),1)]),e("div",_e,[e("div",ye,[u(S,{labelTranslate:!0,modelValue:r(o).response_type,"onUpdate:modelValue":[t[3]||(t[3]=l=>r(o).response_type=l),$],options:Z.value,error:r(o).errors.response_type,class:"w-full",placeholder:s.$t("Select Type")},null,8,["modelValue","options","error","placeholder"])])])]),r(o).response_type==="text"?(d(),c("div",ke,[e("div",$e,[e("h2",Ce,n(s.$t("Text response")),1)]),e("div",Ve,[e("div",Le,[e("div",Se,[e("div",je,[e("textarea",{class:b(["block w-full rounded-md border-0 py-1.5 px-4 text-gray-900 shadow-sm outline-none ring-1 ring-inset placeholder:text-gray-400 sm:text-sm sm:leading-6",r(o).errors.response?"ring-[#b91c1c]":"ring-gray-300"]),onInput:R,rows:"3",ref_key:"textareaRef",ref:f},n(r(o).response),35)]),r(o).errors.response?(d(),c("div",Be,n(r(o).errors.response),1)):g("",!0)]),e("div",Me,[e("button",{type:"button",onClick:t[4]||(t[4]=l=>v.value=!0),class:"bg-slate-100 px-2 py-1 rounded-md text-sm flex items-center gap-x-1 shadow-sm"},[k(n(s.$t("Add Variable"))+" ",1),t[17]||(t[17]=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":"1.5",d:"M8.25 15L12 18.75L15.75 15m-7.5-6L12 5.25L15.75 9"})],-1))]),e("button",{type:"button",onClick:t[5]||(t[5]=l=>w("bold")),class:"hover:bg-slate-100 rounded p-1"},t[18]||(t[18]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M5 3h8c1.06 0 2.078.474 2.828 1.318C16.578 5.162 17 6.307 17 7.5c0 1.193-.421 2.338-1.172 3.182C15.078 11.526 14.061 12 13
112H5zm0 9h10.039a4.44 4.44 0 0 1 3.154 1.318A4.52 4.52 0 0 1 19.5 16.5a4.52 4.52 0 0 1-1.307 3.182A4.442 4.442 0 0 1 15.038 21H5z"})],-1)])),e("button",{type:"button",onClick:t[6]||(t[6]=l=>w("italic")),class:"hover:bg-slate-100 rounded p-1"},t[19]||(t[19]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M10 4.75a.75.75 0 0 1 .75-.75h8.5a.75.75 0 0 1 0 1.5h-3.514l-5.828 13h3.342a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5h3.514l5.828-13H20.75a.75.75 0 0 1-.75-.75Z"})],-1)])),e("button",{type:"button",onClick:t[7]||(t[7]=l=>w("strike-through")),class:"hover:bg-slate-100 rounded p-1"},t[20]||(t[20]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"m16.533 12.5...Z"})],-1)])),e("button",{type:"button",onClick:t[8]||(t[8]=l=>w("monospace")),class:"hover:bg-slate-100 rounded p-1"},t[21]||(t[21]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M13.5 6L10 18.5m-3.5-10L3 12l3.5 3.5m11-7L21 12l-3.5 3.5"})],-1)])),e("div",Re,[e("button",{type:"button",onClick:E},"ð"),x.value?(d(),c("div",{key:0,class:"absolute right-0 bottom-full z-10",ref_key:"emojiPickerRef",ref:_},[u(r(q),{native:!0,onSelect:N})],512)):g("",!0)])]),e("div",Te,[e("button",Ze,n(s.$t("Save")),1)])])])])):r(o).response_type==="image"||r(o).response_type==="audio"?(d(),c("div",Pe,[e("div",Ae,[r(o).response_type==="image"?(d(),c("h2",Ee,n(s.$t("Image response")),1)):(d(),c("h2",Ue,n(s.$t("Audio response")),1))]),e("div",Ne,[e("div",Oe,[e("div",{class:b([r(o).errors.response?"border-[#b91c1c]":"border-gray-300","flex justify-center px-4 md:px-6 pt-5 pb-6 border-2 border-dashed rounded-md transition-all"])},[e("input",{type:"file",class:"sr-only",accept:r(o).response_type==="image"?".jpg, .png":".mp3",ref:"fileInput",id:"file-upload",onChange:t[9]||(t[9]=l=>P(l))},null,40,Fe),e("div",He,[e("div",null,[r(o).response?(d(),c("div",ze,[e("div",Ie,[t[23]||(t[23]=e("div",null,[e("svg",{class:"h-6 w-6 text-gray-400 cursor-pointer",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M14 9a1.5 1.5 0 1 1 3 0a1.5 1.5 0 0 1-3 0Z"}),e("path",{fill:"currentColor","fill-rule":"evenodd",d:"M7.268 4.658a54.647 54.647 0 0 1 9.465 0l1.51.132a3.138 3.138 0 0 1 2.831 2.66a30.604 30.604 0 0 1 0 9.1a3.138 3.138 0 0 1-2.831 2.66l-1.51.131c-3.15.274-6.316.274-9.465 0l-1.51-.131a3.138 3.138 0 0 1-2.832-2.66a30.601 30.601 0 0 1 0-9.1a3.138 3.138 0 0 1 2.831-2.66l1.51-.132Zm9.335 1.495a53.147 53.147 0 0 0-9.206 0l-1.51.131A1.638 1.638 0 0 0 4.41 7.672a29.101 29.101 0 0 0-.311 5.17L7.97 8.97a.75.75 0 0 1 1.09.032l3.672 4.13l2.53-.844a.75.75 0 0 1 .796.21l3.519 3.91a29.101 29.101 0 0 0 .014-8.736a1.638 1.638 0 0 0-1.478-1.388l-1.51-.131Zm2.017 11.435l-3.349-3.721l-2.534.844a.75.75 0 0 1-.798-.213l-3.471-3.905l-4.244 4.243c.049.498.11.996.185 1.491a1.638 1.638 0 0 0 1.478 1.389l1.51.131c3.063.266 6.143.266 9.206 0l1.51-.131c.178-.016.35-.06.507-.128Z","clip-rule":"evenodd"})])],-1)),e("div",De,[e("span",Ge,n(((i=r(o).response)==null?void 0:i.name)??r(o).response),1),e("button",{type:"button",onClick:t[10]||(t[10]=l=>$())},t[22]||(t[22]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M17.707 7.707a1 1 0 0 0-1.414-1.414L12 10.586L7.707 6.293a1 1 0 0 0-1.414 1.414L10.586 12l-4.293 4.293a1 1 0 1 0 1.414 1.414L12 13.414l4.293 4.293a1 1 0 1 0 1.414-1.414L13.414 12l4.293-4.293Z","clip-rule":"evenodd"})],-1)]))])])])):g("",!0),e("div",We,[e("label",Je,[e("p",null,n(r(o).response_type==="image"?s.$t("Click to upload image"):s.$t("Click to upload audio")),1),e("p",qe,n(r(o).response_type==="image"?s.$t("PNG or JPG files only"):s.$t("MP3 files only")),1)])])])])],2),r(o).errors.response?(d(),c("div",Ke,n(r(o).errors.response),1)):g("",!0),e("button",Qe,n(s.$t("Save")),1)])])])):g("",!0)],32)])]}),_:1}),u(J,{label:s.$t("Select variable"),isOpen:v.value},{default:y(()=>[e("div",Xe,[e("span",Ye,n(s.$t("Select a placeholder to add to your response. The placeholder will replace itself with the actual data.")),1)]),e("div",et,[e("div",tt,[(d(!0),c(V,null,I(B.placeholders,i=>(d(),c("button",{onClick:l=>
1M(i.value),class:"col-span-1 bg-gray-100 p-2 rounded-md text-left hover:bg-gray-50"},n(s.$t(i.label)),9,st))),256))]),e("div",ot,[e("button",{type:"button",onClick:t[12]||(t[12]=L(i=>v.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"},n(s.$t("Cancel")),1)])])]),_:1},8,["label","isOpen"])],64))}};export{Mt as default};
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.