import{j as e,_ as g,br as b,by as E,bg as C,a1 as N,a4 as R,I as x}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b710.js";import{a as l}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b74.js";import{u as h}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b719.js";import{a as f,u as w}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b788.js";import{q as L,aG as A,s as O}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b723.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b745.js";import{E as S}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7114.js";import{A as z}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7192.js";import{u as I}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b735.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b718.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b76.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b78.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b75.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b77.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b79.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b72.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b73.js";const T=l.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7190.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_16_364f475f-21c1-4d89-bf17-70efc8c405b7191.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(b,{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,{})},y=()=>{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:"flex justify-end -mt-3 mr-2",children:e.jsx(C,{funcao:()=>window.open(p.videos_tutoriais.resposta_rapida,"_blank")})}),e.jsx("div",{className:"text-center mt-2 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 - 168px)"},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:y})})]})]})}export{re as default};
