import{j as e,_ as p,b9 as v,D as _,J as y,I as m}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e10.js";import{a as i}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e4.js";import{u as x}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e19.js";import{b as u,a as E}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e92.js";import{o as C,a4 as b}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e22.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e46.js";import{E as N}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e113.js";import{A as R}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e132.js";import{u as A}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e34.js";import{j as L}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e39.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e18.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e8.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e5.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e7.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e6.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e2.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e3.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e9.js";const O=i.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e180.js")),[]));function S(){return e.jsx(i.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(O,{})})}const w=i.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e181.js")),[]));function z({updateCat:s}){return e.jsx(i.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(w,{updateCat:s})})}function I(){var c;const{open:s}=C(),{categories:l}=A(),{language:r}=x(),{quickReply:t,setQuickReply:d}=u();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=>s(e.jsx(z,{updateCat:a=>d("categoria",a)}),{placement:"left"},document.getElementById("select_cat_createRes"),10,{mounted:()=>{var a;return(a=document.getElementById("select_cat_createRes"))==null?void 0:a.classList.add("!border-[var(--primaria)]")},desmouted:()=>{var a;return(a=document.getElementById("select_cat_createRes"))==null?void 0:a.classList.remove("!border-[var(--primaria)]")}}),children:e.jsx("span",{children:l.length===0||!(t!=null&&t.categoria)||((c=t==null?void 0:t.categoria)==null?void 0:c.length)===0?r.noneSelected:l.map((o,a)=>{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(v,{className:"h-5 w-5",style:{color:o.hexColor}})}),e.jsx("span",{className:"text-base overflow-hidden text-ellipsis whitespace-nowrap",children:o.name})]},a)})})})]})}function ee(){const{language:s}=x(),{setActiveRender:l,activeCreateOrEdit:r}=E(),{quickReply:t,setQuickReply:d,createQuickReply:c,editQuickReply:o}=u(),{acao:a}=b(),[g,h]=i.useState(!1),f={respostaRapida:e.jsx(R,{acaoModel:"useAcaoRespostaRapida"}),script:e.jsx(S,{})},j=()=>{var n;if(!(t!=null&&t.titulo)||((n=t==null?void 0:t.titulo)==null?void 0:n.length)<3){m({type:"Error",message:s.insertTitleAtLeast3Chars,position:"top-right"});return}if(r.model==="respostaRapida"&&a.length===0){m({type:"Error",message:s.addOneAction,position:"top-right"});return}h(!0),r.type==="create"?c():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":s.back,onClick:()=>{l("list")},children:e.jsx(L,{className:"h-6 w-6 text-[var(--primaria)] group"})})}),e.jsx("div",{className:"text-center mt-2",children:e.jsxs(_,{weight:"600",children:[r.type==="create"?s.create:s.edit," ",s[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 - 168px)"},children:[e.jsx("div",{className:"mb-4",children:e.jsx(N,{id:"CreateOREdit_QuickReply",titulo:s.title,type:"input",position:"left",placeholder:s.titlePlaceholher,text:t==null?void 0:t.titulo,setText:n=>d("titulo",n)})}),f[r.model],e.jsx("div",{className:"mt-4",children:e.jsx(I,{})}),e.jsx("div",{className:"text-center m-4",children:g?e.jsx("span",{className:"loading loading-spinner loading-sm text-[var(--primaria)]"}):e.jsx(y,{name:r.type==="create"?s.create:s.edit,funcao:j})})]})]})}export{ee as default};
