import{j as e,r as o}from"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b.js";import{u as m,d as _}from"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b20.js";import{a as u,u as v}from"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b90.js";import{n as R,ap as b}from"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b23.js";import{_ as x,bD as E,bK as C,bl as k,H as N,Q as w,I as d}from"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b11.js";import"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b46.js";import{E as S}from"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b118.js";import{A}from"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b195.js";import{u as L}from"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b34.js";import{u as O}from"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b47.js";import"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b8.js";import"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b19.js";import"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b7.js";import"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b4.js";import"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b3.js";import"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b2.js";import"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b10.js";import"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b6.js";import"./v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b9.js";const z=o.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b193.js")),[]));function I(){return e.jsx(o.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(z,{})})}const Q=o.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_3_17_17ffe662-3f12-45a2-ae5d-997b41d0d61b194.js")),[]));function T({updateCat:t}){return e.jsx(o.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(Q,{updateCat:t})})}function B(){const{open:t}=R(),{categories:l}=L(),{language:a}=m(),{quickReply:s,setQuickReply:c}=u();return e.jsxs("div",{className:"form-control w-full",children:[e.jsx("h2",{className:"pb-[3px]",children:a.selectCategory}),e.jsx("div",{className:"select select-bordered select-sm !cursor-pointer border border-solid",id:"select_cat_createRes",onClick:r=>t(e.jsx(T,{updateCat:i=>c("categoria",i)}),{placement:"left"},document.getElementById("select_cat_createRes"),10,{mounted:()=>document.getElementById("select_cat_createRes")?.classList.add("!border-[var(--primaria)]"),desmouted:()=>document.getElementById("select_cat_createRes")?.classList.remove("!border-[var(--primaria)]")}),children:e.jsx("span",{children:l.length===0||!s?.categoria||s?.categoria?.length===0?a.noneSelected:l.map((r,i)=>{if(r.id==s?.categoria)return e.jsxs("div",{className:"pulse flex gap-2 py-1 items-center",children:[e.jsx("span",{children:e.jsx(E,{className:"h-5 w-5",style:{color:r.hexColor}})}),e.jsx("span",{className:"text-base overflow-hidden text-ellipsis whitespace-nowrap",children:r.name})]},i)})})})]})}function re(){const{language:t}=m(),{setActiveRender:l,activeCreateOrEdit:a}=v(),{quickReply:s,setQuickReply:c,createQuickReply:r,editQuickReply:i}=u(),{acao:g}=b(),{tutorial_resposta_rapida:p}=_(O(n=>({tutorial_resposta_rapida:n.getUrl("tutoriais","resposta_rapida")}))),[h,f]=o.useState(!1),j={respostaRapida:e.jsx(A,{acaoModel:"useAcaoRespostaRapida"}),script:e.jsx(I,{})},y=()=>{if(!s?.titulo||s?.titulo?.length<3){d({type:"Error",message:t.insertTitleAtLeast3Chars,position:"top-right"});return}if(a.model==="respostaRapida"&&g.length===0){d({type:"Error",message:t.addOneAction,position:"top-right"});return}f(!0),a.type==="create"?r():i()};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":t.back,onClick:()=>{l("list")},children:e.jsx(C,{className:"h-6 w-6 text-[var(--primaria)] group"})})}),p.active&&e.jsx("div",{className:"absolute right-[6px] top-[45px]",children:e.jsx(k,{funcao:()=>window.open(p.link,"_blank")})}),e.jsx("div",{className:"text-center mt-8 flex gap-2 justify-center",children:e.jsxs(N,{weight:"600",children:[a.type==="create"?t.create:t.edit," ",t[a.model]]})}),e.jsxs("div",{className:"flex flex-col gap-1 my-2 overflow-y-auto overflow-x-hidden px-1",style:{maxHeight:"calc(100vh - 200px)"},children:[e.jsx("div",{className:"mb-4",children:e.jsx(S,{id:"CreateOREdit_QuickReply",titulo:t.title,type:"input",position:"left",placeholder:t.titlePlaceholher,text:s?.titulo,setText:n=>c("titulo",n)})}),j[a.model],e.jsx("div",{className:"mt-4",children:e.jsx(B,{})}),e.jsx("div",{className:"text-center m-4",children:h?e.jsx("span",{className:"loading loading-spinner loading-sm text-[var(--primaria)]"}):e.jsx(w,{name:a.type==="create"?t.create:t.edit,funcao:y})})]})]})}export{re as default};
