import{j as e,_ as p,bf as v,Z as _,a1 as E,I as m}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf10.js";import{a as i}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf4.js";import{u as x}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf19.js";import{b as u,a as y}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf92.js";import{p as C,aE as b}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf23.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf47.js";import{E as N}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf117.js";import{A as R}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf194.js";import{u as A}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf36.js";import{k as L}from"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf41.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf18.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf6.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf8.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf5.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf7.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf9.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf2.js";import"./v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf3.js";const O=i.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf192.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_9_8cb79d4f-81e0-49c1-b597-7f2344477fbf193.js")),[]));function z({updateCat:a}){return e.jsx(i.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(w,{updateCat:a})})}function I(){var c;const{open:a}=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=>a(e.jsx(z,{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: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,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(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})]},s)})})})]})}function ee(){const{language:a}=x(),{setActiveRender:l,activeCreateOrEdit:r}=y(),{quickReply:t,setQuickReply:d,createQuickReply:c,editQuickReply:o}=u(),{acao:s}=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:a.insertTitleAtLeast3Chars,position:"top-right"});return}if(r.model==="respostaRapida"&&s.length===0){m({type:"Error",message:a.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":a.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"?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 - 168px)"},children:[e.jsx("div",{className:"mb-4",children:e.jsx(N,{id:"CreateOREdit_QuickReply",titulo:a.title,type:"input",position:"left",placeholder:a.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(E,{name:r.type==="create"?a.create:a.edit,funcao:j})})]})]})}export{ee as default};
