import{j as e,_ as p,bg as v,J as _,V as y,I as m}from"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c9910.js";import{a as i}from"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c994.js";import{u as x}from"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c9919.js";import{b as u,a as E}from"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c9997.js";import{p as C,a9 as b}from"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c9923.js";import"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c9947.js";import{E as N}from"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c99119.js";import{A as R}from"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c99135.js";import{u as A}from"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c9935.js";import{k as L}from"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c9940.js";import"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c9918.js";import"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c996.js";import"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c998.js";import"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c99.js";import"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c995.js";import"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c997.js";import"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c999.js";import"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c992.js";import"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c993.js";const O=i.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c99191.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_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c99192.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};
