import{j as e,_ as g,bs as y,bz as E,bh as C,a2 as N,a5 as R,I as x}from"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d610.js";import{a as l}from"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d64.js";import{u as h}from"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d619.js";import{a as f,u as w}from"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d688.js";import{q as L,aG as A,s as O}from"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d623.js";import"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d645.js";import{E as S}from"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d6114.js";import{A as z}from"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d6192.js";import{u as I}from"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d635.js";import"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d618.js";import"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d66.js";import"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d68.js";import"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d6.js";import"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d65.js";import"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d67.js";import"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d69.js";import"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d62.js";import"./v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d63.js";const T=l.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d6190.js")),[]));function Q(){return e.jsx(l.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(T,{})})}const B=l.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_23_80f0be4c-2624-48ff-84de-a733d033e3d6191.js")),[]));function k({updateCat:a}){return e.jsx(l.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(B,{updateCat:a})})}function M(){var n;const{open:a}=L(),{categories:c}=I(),{language:r}=h(),{quickReply:t,setQuickReply:d}=f();return e.jsxs("div",{className:"form-control w-full",children:[e.jsx("h2",{className:"pb-[3px]",children:r.selectCategory}),e.jsx("div",{className:"select select-bordered select-sm !cursor-pointer border border-solid",id:"select_cat_createRes",onClick:o=>a(e.jsx(k,{updateCat:s=>d("categoria",s)}),{placement:"left"},document.getElementById("select_cat_createRes"),10,{mounted:()=>{var s;return(s=document.getElementById("select_cat_createRes"))==null?void 0:s.classList.add("!border-[var(--primaria)]")},desmouted:()=>{var s;return(s=document.getElementById("select_cat_createRes"))==null?void 0:s.classList.remove("!border-[var(--primaria)]")}}),children:e.jsx("span",{children:c.length===0||!(t!=null&&t.categoria)||((n=t==null?void 0:t.categoria)==null?void 0:n.length)===0?r.noneSelected:c.map((o,s)=>{if(o.id==(t==null?void 0:t.categoria))return e.jsxs("div",{className:"pulse flex gap-2 py-1 items-center",children:[e.jsx("span",{children:e.jsx(y,{className:"h-5 w-5",style:{color:o.hexColor}})}),e.jsx("span",{className:"text-base overflow-hidden text-ellipsis whitespace-nowrap",children:o.name})]},s)})})})]})}function re(){var m,u;const{language:a}=h(),{setActiveRender:c,activeCreateOrEdit:r}=w(),{quickReply:t,setQuickReply:d,createQuickReply:n,editQuickReply:o}=f(),{acao:s}=A(),p=O(i=>i.label),[j,v]=l.useState(!1),_={respostaRapida:e.jsx(z,{acaoModel:"useAcaoRespostaRapida"}),script:e.jsx(Q,{})},b=()=>{var i;if(!(t!=null&&t.titulo)||((i=t==null?void 0:t.titulo)==null?void 0:i.length)<3){x({type:"Error",message:a.insertTitleAtLeast3Chars,position:"top-right"});return}if(r.model==="respostaRapida"&&s.length===0){x({type:"Error",message:a.addOneAction,position:"top-right"});return}v(!0),r.type==="create"?n():o()};return e.jsxs("div",{className:"py-1 pl-1",children:[e.jsx("div",{className:"absolute left-0",children:e.jsx("span",{className:"group cursor-pointer lg:tooltip lg:tooltip-right !absolute left-1","data-tip":a.back,onClick:()=>{c("list")},children:e.jsx(E,{className:"h-6 w-6 text-[var(--primaria)] group"})})}),((u=(m=p.videos_tutoriais)==null?void 0:m.resposta_rapida)==null?void 0:u.length)>0&&e.jsx("div",{className:"absolute right-[6px] top-[45px]",children:e.jsx(C,{funcao:()=>window.open(p.videos_tutoriais.resposta_rapida,"_blank")})}),e.jsx("div",{className:"text-center mt-8 flex gap-2 justify-center",children:e.jsxs(N,{weight:"600",children:[r.type==="create"?a.create:a.edit," ",a[r.model]]})}),e.jsxs("div",{className:"flex flex-col gap-1 my-2 overflow-y-auto overflow-x-hidden px-1",style:{maxHeight:"calc(100vh - 200px)"},children:[e.jsx("div",{className:"mb-4",children:e.jsx(S,{id:"CreateOREdit_QuickReply",titulo:a.title,type:"input",position:"left",placeholder:a.titlePlaceholher,text:t==null?void 0:t.titulo,setText:i=>d("titulo",i)})}),_[r.model],e.jsx("div",{className:"mt-4",children:e.jsx(M,{})}),e.jsx("div",{className:"text-center m-4",children:j?e.jsx("span",{className:"loading loading-spinner loading-sm text-[var(--primaria)]"}):e.jsx(R,{name:r.type==="create"?a.create:a.edit,funcao:b})})]})]})}export{re as default};
