PageSourceSearch

https://epicos.ai/assets/ListarAplicacoes-DE1jAv9G.js

js epicos.ai collected 2026-10-05 13:31:21 UTC 28,482 bytes, 1 lines download raw bytes

1import{C as Me,u as Le,aC as Re,aD as Oe,t as C,j as e,aE as Ie,aF as ze,R as Ve,S as Ue,c as u,U as $e,W as qe,aG as Ge,aH as ve,ae as He,X as k,aI as A,aJ as D,aK as S,aL as Je,aM as We,aN as Xe,aO as B,aP as fe,aQ as Ke,aR as Qe,aS as Ye}from"./index-DdokvTmJ.js";import{r as o,U as Ze,V as ea,Y as aa,X as je,d as sa,Z as ra,P as ta,_ as oa,$ as na,a0 as ia,a1 as la,a2 as ca,L as da,a3 as xa,a4 as pa,a5 as ua,a6 as ha}from"./lucide-icons-DcjOfOJe.js";import{b as ma}from"./filtroService-DkAOXZXJ.js";import{g as ba,T as ga}from"./tiposAplicacao-DX5sBHkt.js";import{T as va}from"./TipoAplicacaoBadge-DCPNfCfU.js";const fa=[{key:"todos",label:"Todos"},{key:"texto",label:"Texto"},{key:"imagem",label:"Imagem"},{key:"apresentacao",label:"Apresentação"},{key:"audio",label:"Áudio"}],F=n=>{var T;if((T=n.tipo)!=null&&T.codigo){const $=n.tipo.codigo.toLowerCase(),N=ga[$];if(N)return N.filterTab}const r=(n.nome||"").toLowerCase();return r.includes("imagem")||r.includes("image")?"imagem":r.includes("vídeo")||r.includes("video")?"video":r.includes("áudio")||r.includes("audio")?"audio":r.includes("apresentação")||r.includes("apresentacao")?"apresentacao":"texto"},ja=["texto","imagem","audio","apresentacao","programacao"],ae=n=>{var r;return ja.includes((((r=n.tipo)==null?void 0:r.codigo)||"").toLowerCase())},Na=10080*60*1e3,wa=n=>{if(!n)return!1;const r=new Date(n).getTime();return Number.isNaN(r)?!1:Date.now()-r<Na},ya=n=>n.rascunho?{label:"Rascunho",isRascunho:!0,isPublicada:!1}:n.status==="ativo"?{label:"Publicada",isRascunho:!1,isPublicada:!0}:{label:"Despublicada",isRascunho:!1,isPublicada:!1},U=({label:n,onRemove:r})=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-md bg-[var(--brand-10)] border border-[var(--n200)] text-xs font-medium text-[var(--text-2)]",children:[e.jsx("span",{className:"truncate max-w-[160px]",children:n}),e.jsx("button",{type:"button",onClick:r,className:"text-[var(--text-3)] hover:text-[var(--text-1)] transition-colors","aria-label":`Remover filtro ${n}`,children:e.jsx(je,{className:"w-3 h-3"})})]}),Fa=()=>{const n=Me(),{user:r,recaptchaToken:T,generateRecaptchaToken:$,hasPermission:N}=Le(),[w,se]=o.useState([]),[Ne,q]=o.useState(!0),[re,te]=o.useState(null),[G,we]=o.useState(""),[M,ye]=o.useState(""),[Ce,oe]=o.useState(0),[g,H]=o.useState("todos"),[h,J]=o.useState(""),[L,W]=o.useState(null),[ne,ie]=o.useState(null),[X,R]=o.useState(8),le=o.useRef(null),[ce,de]=o.useState(!1),[O,xe]=o.useState(!1);o.useEffect(()=>{(async()=>{if(r)try{const[s,t]=await Promise.all([N("documentos_wizard_criar"),N("documentos_wizard_listar")]);de(s),xe(t)}catch(s){console.error("Erro ao verificar permissões de aplicações:",s),de(!1),xe(!1)}})()},[r,N]);const P=o.useCallback(a=>{var t;const s=a.created_by||a.criado_por||((t=a.criador)==null?void 0:t.id);return s?s===(r==null?void 0:r.id):!1},[r==null?void 0:r.id]),{isMasterOrAdmin:v}=Re(),ke=o.useCallback(a=>{var c;const s=P(a);return(((c=a.origem)==null?void 0:c.codigo)||"sistema").toLowerCase()==="sistema"&&!v?{canDelete:!1,reason:"Aplicações do tipo Sistema só podem ser excluídas por Master ou Administrador."}:s||v?{canDelete:!0}:a.rascunho===!0||a.status==="inativo"?{canDelete:!0}:{canDelete:!1,reason:"Apenas aplicações em rascunho ou despublicadas podem ser excluídas."}},[P,v]),Ae=o.useCallback(a=>{var t;return(((t=a.origem)==null?void 0:t.codigo)||"sistema").toLowerCase()==="sistema"&&!v?{canModify:!1,reason:"Apenas Master ou Administrador pode modificar aplicações Sistema."}:P(a)||v?{canModify:!0}:{canModify:!0}},[P,v]),[d,I]=o.useState(""),[l,E]=o.useState(""),[f,K]=o.useState(!1);o.useEffect(()=>{const a=setTimeout(()=>ye(G),500);return()=>clearTimeout(a)},[G]),o.useEffect(()=>{if(!r)return;(async()=>{try{const s=await ma();oe((s==null?void 0:s.total)||0)}catch(s){console.error("Erro ao buscar total de agentes:",s),oe(0)}})()},[r]);const z=o.useCallback(async()=>{var a;if(!(r!=null&&r.id)){q(!1);return}try{q(!0),te(null);const s={usuario_id:r.id,cliente_id:r.cliente_id||"",organizacao_id:r.organizacao_id||"",search:M||void 0,skip:0,limit:100},c=(a=(await Oe.listar(s,T||"")).items)!=null?a:[];se(c)}catch(s){const t=s instanceof Error?s.message:"Erro ao carregar aplicações";console.error("Erro ao buscar aplicações:",s),te(t),C.error("Erro ao carregar aplicações",{description:t,duration:6e3})}finally{q(!1)}},[r==null?void 0:r.id,r==null?void 0:r.cliente_id,r==null?void 0:r.organizacao_id,M,T]);o.useEffect(()=>{z()},[z]);const j=o.useMemo(()=>{let a=0;return g!=="todos"&&a++,h&&a++,d&&a++,l&&a++,f&&a++,a},[g,h,d,l,f]),Q=()=>{H("todos"),J(""),I(""),E(""),K(!1)},_=o.useMemo(()=>{let a=w.filter(ae);if(g!=="todos"&&(a=a.filter(s=>F(s)===g)),h){const s=h.toLowerCase().trim();a=a.filter(t=>(t.nome||"").toLowerCase().includes(s))}return d&&(a=a.filter(s=>{var c;return(((c=s.origem)==null?void 0:c.codigo)||"sistema").toLowerCase()===d})),l&&(a=a.filter(s=>l==="rascunho"?!!s.rascunho:l==="publicada"?s.status==="ativo"&&!s.rascunho:l==="despublicada"?s.status==="inativo"&&!s.rascunho:!0)),f&&(r!=null&&r.id)&&(a=a.filter(s=>{var t;return((t=s.criador)==null?void 0:t.id)===r.id||s.criado_por===r.id||s.created_by===r.id})),a},[w,g,h,d,l,f,r==null?void 0:r.id]),V=o.useMemo(()=>{const a=w.filter(ae);return{todos:a.length,texto:a.filter(t=>F(t)==="texto").length,imagem:a.filter(t=>F(t)==="imagem").length,apresentacao:a.filter(t=>F(t)==="apresentacao").length,video:a.filter(t=>F(t)==="video").length,audio:a.filter(t=>F(t)==="audio").length}},[w]),Y=o.useMemo(()=>fa.filter(a=>a.key==="todos"||V[a.key]>0),[V]),pe=Y.length>1,De=o.useMemo(()=>w.filter(a=>ae(a)&&a.status==="ativo"&&!a.rascunho).length,[w]),ue=!!r,Z=a=>{n(`/aplicacoes/ver/${a.id}`)},he=(a,s)=>{a.stopPropagation(),n(`/aplicacoes/usar/${s.id}`)},me=()=>n("/aplicacoes/criar/etapa/1"),Se=async a=>{if(ne)return;const s=a.status==="ativo"&&!a.rascunho;ie(a.id);try{const t=await $("atualizar_aplicacao");await Qe(a.id,{status:s?"inativo":"ativo",rascunho:s},t||""),C.success(s?"Aplicação despublicada":"Aplicação publicada",{description:s?"A aplicação voltou ao estado de rascunho.":"A aplicação está visível para uso."}),se(c=>c.map(b=>b.id===a.id?{...b,rascunho:s,status:s?"inativo":"ativo"}:b))}catch(t){console.error("Erro ao alternar publicação:",t),C.error("Não foi possível alterar o status",{description:"Tente novamente."})}finally{ie(null)}},Fe=async a=>{try{const s=`${window.location.origin}/aplicacoes/ver/${a.id}`;await navigator.clipboard.writeText(s),C.success("Link copiado",{description:"O link da aplicação foi copiado."})}catch(s){console.error("Erro ao copiar link:",s),C.error("Não foi possível copiar o link.")}},Te=()=>{W(null),C.success("Aplicação excluída"),z()},Pe=async(a,s)=>{await Ye(a,s)},Ee=_.slice(0,X),ee=_.length>X;return o.useEffect(()=>{if(!ee)return;const a=le.current;if(!a)return;const s=new IntersectionObserver(t=>{var c;(c=t[0])!=null&&c.isIntersecting&&R(b=>b+8)},{rootMargin:"240px 0px"});return s.observe(a),()=>s.disconnect()},[ee,X]),e.jsxs(Ie,{children:[e.jsx("div",{className:"flex-1 bg-[var(--bg-1)] w-full max-w-full overflow-x-hidden",children:e.jsxs("div",{className:"mx-auto px-3 sm:px-4 lg:px-6 py-5 sm:py-
17 w-full max-w-none",children:[e.jsxs("div",{className:"bg-[var(--bg-3)] border border-[var(--brand-20)] rounded-[18px] p-[18px_22px] mb-6 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",style:{boxShadow:"0 10px 30px rgba(23,23,23,0.03)"},children:[e.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[e.jsx("div",{className:"w-[52px] h-[52px] min-w-[52px] rounded-[14px] flex items-center justify-center text-white flex-shrink-0",style:{background:"linear-gradient(135deg,#C89258 0%,#B2763E 55%,#8B5C36 100%)",boxShadow:"0 12px 24px rgba(178,118,62,0.24)"},children:e.jsx(Ze,{className:"w-6 h-6"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"mb-1.5 text-2xl font-bold leading-[1.15] tracking-[-0.02em] text-[var(--text-1)]",children:"Aplicações"}),e.jsxs("p",{className:"max-w-[720px] text-sm text-[var(--text-2)]",children:["Você tem"," ",e.jsxs("strong",{className:"text-[var(--brand)] font-bold",children:[Ce," especialistas"]})," ","à sua disposição. Crie algo com eles agora mesmo."," ",e.jsxs("strong",{className:"text-[var(--brand)] font-bold",children:[De," aplicações ativas"]}),"."]})]})]}),ue&&e.jsxs("button",{type:"button",onClick:me,className:"inline-flex h-[42px] flex-shrink-0 items-center gap-2 rounded-[12px] bg-[var(--brand)] px-[14px] text-sm font-semibold text-white transition-all hover:-translate-y-px hover:bg-[var(--brand-dark)]",children:[e.jsx(ea,{className:"w-4 h-4"}),"Nova Aplicação"]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-3 mb-4",children:[e.jsx("div",{className:"relative flex-1",children:e.jsx(ze,{value:G,onChange:we,placeholder:"Buscar aplicações...",searchFields:["nome","descrição","tipo"],className:"w-full h-[42px] rounded-[12px] border border-[var(--n200)] bg-[var(--bg-3)] text-[var(--text-1)] focus-within:border-[var(--brand)] focus-within:ring-4 focus-within:ring-[var(--brand-10)]",inputClassName:"h-[42px] border-0 bg-transparent shadow-none focus:ring-0 focus-visible:ring-0 focus:border-0"})}),(h||d||l||f)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h&&e.jsx(U,{label:`nome: ${h}`,onRemove:()=>J("")}),d&&e.jsx(U,{label:d==="sistema"?"🌍 Sistema":"🎨 Personalizada",onRemove:()=>I("")}),l&&e.jsx(U,{label:l==="publicada"?"Publicada":l==="rascunho"?"Rascunho":"Despublicada",onRemove:()=>E("")}),f&&e.jsx(U,{label:"Apenas minhas",onRemove:()=>K(!1)}),e.jsx("button",{type:"button",onClick:Q,className:"text-xs text-[var(--text-3)] hover:text-[var(--text-1)] transition-colors px-2 py-1 whitespace-nowrap",children:"Limpar todos"})]}),e.jsxs(Ve,{children:[e.jsx(Ue,{asChild:!0,children:e.jsxs("button",{type:"button",className:u("inline-flex items-center gap-2 h-[42px] px-4 rounded-[12px] border text-sm font-semibold transition-all hover:-translate-y-px",j>0?"border-[var(--brand)] bg-[var(--brand-10)] text-[var(--brand)]":"border-[var(--n200)] bg-[var(--bg-3)] text-[var(--n700)] hover:bg-[var(--n100)] hover:border-[var(--n300)]"),children:[e.jsx(aa,{className:"w-4 h-4"}),"Avançado",j>0&&e.jsx("span",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-[5px] rounded-full bg-[var(--brand)] text-white text-[10px] font-bold",children:j})]})}),e.jsx($e,{hideCloseButton:!0,className:"max-w-[880px] w-[calc(100vw-2rem)] p-0 gap-0 border border-[#E8DED2] rounded-[24px] shadow-[0_30px_80px_rgba(23,23,23,0.18)] max-h-[88vh] overflow-y-auto",style:{background:"radial-gradient(circle at top right, rgba(212,160,109,0.12), transparent 34%), linear-gradient(180deg,#FFFDFC 0%,#FFF8F3 100%)"},children:e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-[22px]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(qe,{className:"text-[24px] font-bold text-[var(--text-1)] leading-[1.1] tracking-[-0.02em]",children:"Filtrar aplicações"}),e.jsx(Ge,{className:"mt-1 text-[13px] text-[var(--text-3)] leading-[1.5]",children:"Use combinações rápidas para encontrar com mais precisão a aplicação ideal."})]}),e.jsx(ve,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Fechar filtros",className:"w-10 h-10 min-w-[40px] flex-shrink-0 rounded-[12px] border border-[var(--n200)] bg-white/80 text-[var(--n600)] inline-flex items-center justify-center transition-all hover:bg-white hover:border-[#D9B38C] hover:text-[var(--brand)] hover:-translate-y-
1px",children:e.jsx(je,{className:"w-[18px] h-[18px]"})})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[minmax(0,1.25fr)_minmax(0,1fr)] gap-[18px]",children:[e.jsxs("div",{className:"p-[18px] border border-[var(--n200)] rounded-[16px] bg-white/70",children:[e.jsx("h4",{className:"mb-[14px] text-[13px] font-bold text-[var(--text-1)] uppercase tracking-[0.06em]",children:"Busca e Contexto"}),e.jsxs("div",{className:"grid gap-[14px]",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:"text-[13px] font-semibold text-[var(--text-2)]",children:"Nome da Aplicação"}),e.jsxs("div",{className:"relative",children:[e.jsx(sa,{className:"absolute left-[14px] top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--n400)] pointer-events-none"}),e.jsx(He,{placeholder:"Pesquisar por nome...",value:h,onChange:a=>J(a.target.value),className:"h-[46px] rounded-[14px] pl-[44px] text-sm border-[var(--n200)] bg-white focus:border-[var(--brand)] focus:ring-4 focus:ring-[var(--brand-10)]"})]})]}),pe&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:"text-[13px] font-semibold text-[var(--text-2)]",children:"Categoria"}),e.jsx("div",{className:"flex flex-wrap gap-[6px]",children:Y.map(a=>{const s=g===a.key;return e.jsxs("button",{type:"button",onClick:()=>{H(a.key),R(8)},className:u("inline-flex items-center gap-[6px] px-[10px] py-[4px] rounded-full border text-[12px] font-semibold transition-all whitespace-nowrap",s?"bg-[var(--brand)] border-[var(--brand)] text-white":"bg-white/85 border-[var(--n200)] text-[var(--n600)] hover:bg-[var(--n100)] hover:border-[var(--n300)]"),children:[a.label,e.jsx("span",{className:u("text-[10px] font-bold px-[5px] py-[1px] rounded-full leading-[1.5]",s?"bg-white/25 text-white":"bg-black/[0.09] text-[var(--n700)]"),children:V[a.key]})]},a.key)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:"text-[13px] font-semibold text-[var(--text-2)]",children:"Origem"}),e.jsxs("div",{className:"grid gap-[10px]",children:[e.jsxs("label",{className:"flex items-center gap-[10px] min-h-[42px] px-[12px] rounded-[14px] border border-[var(--n200)] bg-white/85 text-sm font-medium text-[var(--text-2)] cursor-pointer transition-all hover:border-[#D9B38C] hover:bg-[#FFFBF7] hover:-translate-y-px",children:[e.jsx("input",{type:"checkbox",checked:d==="sistema",onChange:a=>I(a.target.checked?"sistema":""),className:"w-4 h-4 m-0 accent-[var(--brand)]"}),e.jsx("span",{children:"🌍 Sistema"})]}),e.jsxs("label",{className:"flex items-center gap-[10px] min-h-[42px] px-[12px] rounded-[14px] border border-[var(--n200)] bg-white/85 text-sm font-medium text-[var(--text-2)] cursor-pointer transition-all hover:border-[#D9B38C] hover:bg-[#FFFBF7] hover:-translate-y-px",children:[e.jsx("input",{type:"checkbox",checked:d==="personalizada",onChange:a=>I(a.target.checked?"personalizada":""),className:"w-4 h-4 m-0 accent-[var(--brand)]"}),e.jsx("span",{children:"🎨 Personalizada"})]})]})]})]})]}),e.jsxs("div",{className:"p-[18px] border border-[var(--n200)] rounded-[16px] bg-white/70",children:[e.jsx("h4",{className:"mb-[14px] text-[13px] font-bold text-[var(--text-1)] uppercase tracking-[0.06em]",children:"Status e Atalhos"}),e.jsxs("div",{className:"grid gap-[14px]",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:"text-[13px] font-semibold text-[var(--text-2)]",children:"Status"}),e.jsxs("div",{className:"grid gap-[10px]",children:[e.jsxs("label",{className:"flex items-center gap-[10px] min-h-[42px] px-[12px] rounded-[14px] border border-[var(--n200)] bg-white/85 text-sm font-medium text-[var(--text-2)] cursor-pointer transition-all hover:border-[#D9B38C] hover:bg-[#FFFBF7] hover:-translate-y-px",children:[e.jsx("input",{type:"checkbox",checked:l==="publicada",onChange:a=>E(a.target.checked?"publicada":""),className:"w-4 h-4 m-0 accent-[var(--brand)]"}),e.jsx("span",{children:"Publicada"})]}),e.jsxs("label",{className:"flex items-center gap-[10px] min-h-[42px] px-[12px] rounded-[14px] border border-[var(--n200)] bg-white/85 text-sm font-medium text-[var(--text-2)] cursor-pointer transition-all hover:border-[#D9B38C] hover:bg-[#FFFBF7] hover:-translate-y-
1px",children:[e.jsx("input",{type:"checkbox",checked:l==="rascunho",onChange:a=>E(a.target.checked?"rascunho":""),className:"w-4 h-4 m-0 accent-[var(--brand)]"}),e.jsx("span",{children:"Rascunho"})]}),e.jsxs("label",{className:"flex items-center gap-[10px] min-h-[42px] px-[12px] rounded-[14px] border border-[var(--n200)] bg-white/85 text-sm font-medium text-[var(--text-2)] cursor-pointer transition-all hover:border-[#D9B38C] hover:bg-[#FFFBF7] hover:-translate-y-px",children:[e.jsx("input",{type:"checkbox",checked:l==="despublicada",onChange:a=>E(a.target.checked?"despublicada":""),className:"w-4 h-4 m-0 accent-[var(--brand)]"}),e.jsx("span",{children:"Despublicada"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:"text-[13px] font-semibold text-[var(--text-2)]",children:"Filtros Rápidos"}),e.jsx("div",{className:"grid gap-[10px]",children:e.jsxs("label",{className:"flex items-center gap-[10px] min-h-[42px] px-[12px] rounded-[14px] border border-[var(--n200)] bg-white/85 text-sm font-medium text-[var(--text-2)] cursor-pointer transition-all hover:border-[#D9B38C] hover:bg-[#FFFBF7] hover:-translate-y-px",children:[e.jsx("input",{type:"checkbox",checked:f,onChange:a=>K(a.target.checked),className:"w-4 h-4 m-0 accent-[var(--brand)]"}),e.jsx("span",{children:"Apenas minhas aplicações"})]})})]})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 mt-[18px]",children:[j>0?e.jsx("button",{type:"button",onClick:Q,className:"text-[13px] font-medium text-[var(--text-3)] hover:text-[var(--text-1)] transition-colors",children:"Limpar filtros"}):e.jsx("span",{}),e.jsx(ve,{asChild:!0,children:e.jsxs("button",{type:"button",className:"inline-flex items-center justify-center gap-2 h-11 px-6 rounded-[12px] bg-[var(--brand)] hover:bg-[var(--brand-dark)] text-white text-sm font-semibold transition-all hover:-translate-y-px",children:["Ver ",_.length," ",_.length===1?"resultado":"resultados"]})})]})]})})]})]}),pe&&e.jsx("div",{className:"flex flex-wrap items-center justify-center gap-[6px] mb-5",children:Y.map(a=>{const s=g===a.key;return e.jsxs("button",{type:"button",onClick:()=>{H(a.key),R(8)},className:u("inline-flex items-center gap-[7px] px-[14px] py-[6px] rounded-full border-[1.5px] text-[13px] font-semibold transition-all whitespace-nowrap",s?"bg-[var(--brand)] border-[var(--brand)] text-white":"bg-[var(--bg-3)] border-[var(--n200)] text-[var(--n600)] hover:bg-[var(--n100)] hover:border-[var(--n300)]"),children:[a.label,e.jsx("span",{className:u("text-[11px] font-bold px-[6px] py-[1px] rounded-full leading-[1.5]",s?"bg-white/25 text-white":"bg-black/[0.09] text-[var(--n700)]"),children:V[a.key]})]},a.key)})}),Ne?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-4",children:Array.from({length:8}).map((a,s)=>e.jsxs("div",{className:"bg-[var(--bg-3)] border border-[var(--n200)] rounded-[18px] p-[18px] flex flex-col gap-3",children:[e.jsx(k,{className:"h-5 w-2/3 rounded-md"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{className:"h-5 w-16 rounded-full"}),e.jsx(k,{className:"h-5 w-20 rounded-full"})]}),e.jsx("div",{className:"border-t border-[var(--n200)] pt-3",children:e.jsx(k,{className:"h-4 w-24"})}),e.jsxs("div",{className:"flex gap-2 mt-auto pt-3 border-t border-[var(--n200)]",children:[e.jsx(k,{className:"h-8 flex-1 rounded-[10px]"}),e.jsx(k,{className:"h-8 flex-1 rounded-[10px]"})]})]},s))}):re?e.jsxs("div",{className:"rounded-[14px] border border-[var(--danger)] bg-[var(--danger-bg)] p-8 text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-[var(--danger)] mb-1",children:"Erro ao carregar"}),e.jsx("p",{className:"text-sm text-[var(--text-2)] mb-4",children:re}),e.jsx("button",{type:"button",onClick:z,className:"inline-flex items-center gap-2 h-9 px-4 rounded-[10px] border border-[var(--n200)] bg-[var(--bg-3)] text-sm font-medium text-[var(--text-1)] hover:bg-[var(--n100)] transition-colors",children:"Tentar novamente"})]}):_.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsx("div",{className:"w-20 h-20 bg-[var(--brand-10)] rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(ra,{className:"w-10 h-10 text-[var(--brand)]"})}),e.jsx("h3",{className:"text-xl font-semibold text-[var(--text-1)] mb-2",children:"Nenhuma aplicação encontrada"}),e.jsx("p",{className:"text-[var(--text-3)] mb-6 max-w-md mx-auto",children:j>0||M?"Tente ajustar seus filtros de busca":"Comece criando sua primeira aplicação"}),e.jsxs("div",{className:"flex gap-2 justify-center",children:[j>0&&e.jsx("button",{type:"button",onClick:Q,className:"inline-flex items-center gap-2 h-9 px-4 roun
1ded-[10px] border border-[var(--n200)] bg-[var(--bg-3)] text-sm font-medium text-[var(--text-1)] hover:bg-[var(--n100)] transition-colors",children:"Limpar filtros"}),ue&&j===0&&!M&&e.jsxs("button",{type:"button",onClick:me,className:"inline-flex items-center gap-2 h-10 px-5 rounded-[10px] bg-[var(--brand)] hover:bg-[var(--brand-dark)] text-white text-sm font-semibold transition-all hover:-translate-y-px",children:[e.jsx(ta,{className:"w-4 h-4"}),"Criar primeira aplicação"]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-4",children:Ee.map(a=>{var b,be;const s=ya(a),t=wa(a.created_at),c=ba((b=a.tipo)==null?void 0:b.codigo);return e.jsxs("article",{className:"relative bg-[var(--bg-3)] border border-[var(--n200)] rounded-[18px] p-[18px] flex flex-col cursor-pointer transition-all duration-[180ms] hover:-translate-y-[2px] hover:border-[#E7D5C1] hover:shadow-[0_18px_32px_rgba(23,23,23,0.06)] overflow-hidden",onClick:()=>Z(a),children:[e.jsx("span",{"aria-hidden":!0,className:"absolute left-0 top-0 bottom-0 w-1 pointer-events-none",style:{backgroundColor:c}}),e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-[14px]",children:[e.jsx("div",{className:"flex items-center min-w-0 flex-1",children:e.jsxs(A,{children:[e.jsx(D,{className:"min-w-0 flex-1",children:e.jsx("h3",{className:"text-[17px] font-bold text-[var(--text-1)] leading-[1.25] truncate text-left",style:{letterSpacing:"-0.02em",paddingRight:8},children:a.nome})}),e.jsx(S,{children:e.jsx("p",{children:a.nome})})]})}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[t&&e.jsx("span",{className:"text-[11px] font-bold text-white rounded-full px-[10px] py-[5px] pointer-events-none whitespace-nowrap",style:{background:"linear-gradient(135deg,#D49A54 0%,#B2763E 100%)",boxShadow:"0 10px 20px rgba(178,118,62,0.20)"},children:"Novo"}),a.descricao&&e.jsxs(A,{children:[e.jsx(D,{onClick:x=>x.stopPropagation(),children:e.jsx(oa,{className:"w-[15px] h-[15px] text-[var(--n400)] hover:text-[var(--brand)] transition-colors flex-shrink-0"})}),e.jsx(S,{className:"max-w-xs",children:e.jsx("p",{className:"text-sm",children:a.descricao})})]}),(()=>{const x=P(a),p=a.status==="ativo"&&!a.rascunho,y=ne===a.id,m=ke(a),_e=Ae(a),Be=(x||v)&&_e.canModify,ge=p?"":a.rascunho?"Publique a aplicação para poder usá-la.":"Aplicação despublicada — publique para poder usá-la.";return e.jsxs(Je,{children:[e.jsx(We,{asChild:!0,children:e.jsx("button",{type:"button",className:"w-[30px] h-[30px] min-w-[30px] rounded-[10px] border border-transparent bg-transparent text-[var(--n400)] flex items-center justify-center hover:bg-[var(--n100)] hover:text-[var(--n700)] hover:border-[var(--n200)] transition-all flex-shrink-0",onClick:i=>i.stopPropagation(),"aria-label":"Ações da aplicação",children:e.jsx(na,{className:"w-[15px] h-[15px]"})})}),e.jsxs(Xe,{align:"end",className:"w-56",onClick:i=>i.stopPropagation(),children:[e.jsxs(A,{children:[e.jsx(D,{asChild:!0,children:e.jsx("div",{children:e.jsxs(B,{disabled:!p,className:u(!p&&"text-[var(--n400)] cursor-not-allowed"),onClick:i=>{if(!p){i.preventDefault(),i.stopPropagation();return}he(i,a)},children:[e.jsx(ia,{className:"w-4 h-4 mr-2"}),"Criar Documento"]})})}),ge&&e.jsx(S,{side:"left",children:e.jsx("p",{className:"max-w-xs text-xs",children:ge})})]}),e.jsxs(B,{onClick:i=>{i.stopPropagation(),Fe(a)},children:[e.jsx(la,{className:"w-4 h-4 mr-2"}),"Compartilhar Link"]}),e.jsxs(B,{onClick:i=>{i.stopPropagation(),Z(a)},children:[e.jsx(ca,{className:"w-4 h-4 mr-2"}),"Visualizar Detalhes"]}),Be&&e.jsxs(e.Fragment,{children:[e.jsx(fe,{}),e.jsxs(B,{disabled:y,onClick:i=>{i.stopPropagation(),Se(a)},children:[y?e.jsx(da,{className:"w-4 h-4 mr-2 animate-spin"}):p?e.jsx(xa,{className:"w-4 h-4 mr-2"}):e.jsx(pa,{className:"w-4 h-4 mr-2"}),y?"Atualizando...":p?"Despublicar Aplicação":"Publicar Aplicação"]})]}),e.jsx(fe,{}),e.jsxs(A,{children:[e.jsx(D,{asChild:!0,children:e.jsx("div",{children:e.jsxs(B,{disabled:!m.canDelete,className:u(m.canDelete?"text-[var(--danger)] focus:text-[var(--danger)] focus:bg-[var(--danger-bg)]":"text-[var(--n400)] curs
1or-not-allowed"),onClick:i=>{i.stopPropagation(),m.canDelete&&W(a)},children:[e.jsx(ua,{className:"w-4 h-4 mr-2"}),"Excluir Aplicação"]})})}),!m.canDelete&&m.reason&&e.jsx(S,{side:"left",children:e.jsx("p",{className:"max-w-xs text-xs",children:m.reason})})]})]})]})})()]})]}),e.jsx("div",{className:"flex flex-col gap-[10px] flex-1 pb-[14px]",children:e.jsx("div",{className:"flex flex-wrap items-center gap-2 mt-[2px]",children:e.jsx(va,{codigo:(be=a.tipo)==null?void 0:be.codigo,className:"max-w-[140px]"})})}),e.jsxs("div",{className:"flex items-center justify-between gap-2 pt-[12px] mt-auto border-t border-[var(--n200)]",children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0",children:e.jsx("span",{className:u("inline-flex items-center gap-[5px] min-h-[26px] rounded-full px-[10px] text-[11px] font-semibold border",s.isPublicada?"bg-[var(--success-bg)] border-[rgba(74,140,111,0.30)] text-[var(--success)]":s.isRascunho?"bg-[var(--warning-bg)] border-[rgba(178,126,94,0.30)] text-[var(--warning)]":"bg-[var(--n100)] border-[var(--n200)] text-[var(--n600)]"),children:s.label})}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(()=>{const x=a.status==="ativo"&&!a.rascunho,p=x&&ce,y=ce?x?"":a.rascunho?"Publique a aplicação para poder usá-la.":"Aplicação despublicada — publique para poder usá-la.":"Você não tem permissão para usar aplicações.";return e.jsxs(A,{children:[e.jsx(D,{asChild:!0,children:e.jsx("button",{type:"button",disabled:!p,className:u("min-w-[64px] h-[34px] rounded-[10px] text-[13px] font-bold flex items-center justify-center gap-1 transition-all hover:-translate-y-px",p?"bg-[#D4A06D] hover:bg-[var(--brand)] text-white border border-[#D4A06D]":"bg-[var(--n100)] text-[var(--n400)] border border-[var(--n200)] cursor-not-allowed opacity-60"),onClick:m=>{if(!p){m.stopPropagation();return}he(m,a)},children:"Usar"})}),y&&e.jsx(S,{children:e.jsx("p",{className:"text-xs",children:y})})]})})(),e.jsx("button",{type:"button",className:"min-w-[64px] h-[34px] rounded-[10px] text-[13px] font-bold bg-white text-[var(--n700)] border border-[var(--n200)] flex items-center justify-center gap-1 transition-all hover:bg-[var(--n100)] hover:-translate-y-px",onClick:x=>{x.stopPropagation(),Z(a)},children:"Ver"}),e.jsxs(A,{children:[e.jsx(D,{asChild:!0,children:e.jsx("button",{type:"button",disabled:!O,className:u("h-[34px] px-3 rounded-[10px] text-[13px] font-bold border flex items-center justify-center gap-1 transition-all",O?"bg-white text-[var(--n700)] border-[var(--n200)] hover:bg-[var(--n100)] hover:-translate-y-px":"bg-[var(--n100)] text-[var(--n400)] border-[var(--n200)] cursor-not-allowed opacity-60"),onClick:x=>{x.stopPropagation(),O&&n(`/aplicacoes/ver/${a.id}?tab=documentos`)},children:e.jsx(ha,{className:"w-[14px] h-[14px]"})})}),!O&&e.jsx(S,{children:e.jsx("p",{className:"text-xs",children:"Você não tem permissão para ver documentos."})})]})]})]})]},a.id)})}),ee&&e.jsxs("div",{className:"flex flex-col items-center pt-6",children:[e.jsx("div",{ref:le,"aria-hidden":"true",className:"h-px w-full"}),e.jsx("button",{type:"button",onClick:()=>R(a=>a+8),className:"inline-flex items-center gap-2 h-10 px-[18px] rounded-[12px] border border-[#E3C7AB] bg-[#F8EBDD] text-[#9A6D43] text-[13px] font-bold transition-all hover:bg-[#F1DCC6] hover:border-[#D6AE85] hover:-translate-y-px",children:"Mostrar mais itens"})]})]})]})}),L&&e.jsx(Ke,{isOpen:!!L,onClose:()=>W(null),entityType:"aplicacao",entityId:L.id,entityName:L.nome,displayName:"Aplicação",onDelete:Pe,recaptchaAction:"remover_aplicacao",onSuccess:Te})]})};export{Fa as ListarAplicacoes,Fa as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.