import{j as e,_ as p,bd as v,H as _,Q as y,I as m}from"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b10.js";import{a as i}from"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b4.js";import{u as x}from"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b19.js";import{b as u,a as E}from"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b97.js";import{p as C,a8 as b}from"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b23.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b47.js";import{E as N}from"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b119.js";import{A as R}from"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b135.js";import{u as A}from"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b35.js";import{k as L}from"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b40.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b18.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b8.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b5.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b7.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b6.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b9.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b2.js";import"./v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b3.js";const O=i.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b191.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_1_31_281d2484-5da9-48a8-8939-2c37d755bb5b192.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};
