PageSourceSearch

https://sagav.net/assets/Campaigns-Cuyxs_1w.js

js sagav.net collected 2026-10-02 02:02:04 UTC 80,610 bytes, 1 lines download raw bytes

1import{X as De,u as _e,r as h,G as Z,w as de,Q as he,M as ye,R as fe,aL as Ce,U as xe,C as ke,o as $e,c as o,d as ue,f as e,x as O,t as r,i as ie,$ as ve,aa as qe,e as l,k as b,j as J,n as G,F as Y,Z as K,T as Ae,aM as ze,aN as Ue,ae as we,B as Pe,b as Re,h as We,aO as Ke,aP as Oe,al as Ze,aQ as Ge,a8 as Le,a4 as Qe,a5 as Xe,ad as Ee,g as ge,af as Be,av as be,v as je,aR as pe,aS as Fe,q as Ne,z as Se,m as Je,l as Me,S as Te,aB as He,am as Ye,a as et,aT as tt,aU as st}from"./index-BdZn1jvU.js";import{C as ot}from"./CreateAdventureModal-BDr3OzMG.js";import{a as Ie}from"./userService-lzUB7sHg.js";import{_ as at}from"./RoguelikeIcon-laLjG5bS.js";import{g as lt,a as rt}from"./aiCreativeService-BFq0slK6.js";const nt={class:"bg-gray-900 border border-gray-700 rounded-2xl shadow-2xl w-[90vw] h-[80vh] flex flex-col overflow-hidden"},it={class:"flex items-center justify-between p-4 border-b border-gray-700 bg-gray-800"},dt={class:"text-xl font-bold text-white flex items-center gap-2"},ct={class:"flex-1 max-w-xl mx-4"},ut={class:"relative"},pt=["placeholder"],vt={key:0,class:"animate-spin rounded-full h-5 w-5 border-b-2 border-purple-500"},gt={key:0,class:"flex flex-col items-center justify-center h-32 text-purple-400 gap-3"},mt={class:"text-sm font-bold"},bt={key:1,class:"flex flex-col items-center justify-center h-full text-gray-500 gap-3"},ft=["src","alt"],ht={key:1,class:"w-10 h-10 rounded-full bg-gray-800 border border-gray-700 flex-shrink-0 flex items-center justify-center text-white text-sm font-bold"},yt={class:"flex-1 min-w-0 bg-gray-900/50 rounded-2xl rounded-tl-none p-3 border border-gray-800"},xt={class:"flex items-baseline gap-2 mb-1"},wt={class:"text-sm font-bold text-white"},_t={class:"text-xs text-gray-500"},kt={key:0,class:"mt-1 p-2.5 bg-purple-900/20 rounded-xl border border-purple-500/20 shadow-inner"},$t={key:0,class:"text-[10px] uppercase font-bold text-purple-400 mb-1 tracking-wider"},Ct={class:"text-purple-300 font-mono text-sm mb-1.5 opacity-90"},St={key:1,class:"text-white font-black text-2xl flex items-baseline gap-2"},Mt={class:"text-purple-500 text-xs font-bold uppercase"},zt={key:1,class:"mt-2 bg-gray-800 rounded-2xl overflow-hidden border border-gray-700 shadow-xl max-w-sm"},It={key:0,class:"aspect-[16/10] w-full bg-gray-900 relative"},At=["src"],Pt={class:"p-4 relative"},Lt={class:"flex items-center gap-2 mb-2"},Et={class:"text-base font-black text-white mb-1.5"},Bt={class:"text-xs text-gray-400 line-clamp-3 leading-relaxed"},jt={key:2,class:"text-gray-300 text-sm break-words whitespace-pre-wrap leading-relaxed mt-1"},Ve=30,Tt={__name:"AdventureChatHistoryModal",props:{campaignId:{type:String,required:!0},adventureId:{type:String,required:!0}},emits:["close"],setup(ee,{emit:N}){const _=ee,{t:B,locale:T}=_e({useScope:"global"}),q=h(""),x=h([]),A=h([]),S=h(!1),P=h(!1),C=h(!1);let j=null;const $=h(!1),n=h(!0),H=h(null),Q=h(null),D=h(null);let V=null;const W=Z(()=>{if(!S.value)return x.value;const f=q.value.toLowerCase();return A.value.filter(m=>{var y,z,L,M,U,X;return!!(m.text&&m.text.toLowerCase().includes(f)||m.message&&m.message.toLowerCase().includes(f)||(y=m.user)!=null&&y.displayName&&m.user.displayName.toLowerCase().includes(f)||(z=m.roll)!=null&&z.title&&m.roll.title.toLowerCase().includes(f)||(M=(L=m.roll)==null?void 0:L.card)!=null&&M.title&&m.roll.card.title.toLowerCase().includes(f)||(X=(U=m.roll)==null?void 0:U.card)!=null&&X.description&&m.roll.card.description.toLowerCase().includes(f))})});de(q,f=>{if(j&&clearTimeout(j),!f.trim()){S.value=!1;return}j=setTimeout(async()=>{if(S.value=!0,!C.value){P.value=!0;try{const m=he(ye,`campaigns/${_.campaignId}/adventures/${_.adventureId}/chat`),y=fe(m,Ce("timestamp","asc")),z=await xe(y);A.value=z.docs.map(L=>({id:L.id,...L.data()})),C.value=!0}catch(m){console.error("Error fetching all messages for search:",m)}finally{P.value=!1}}},600)});const se=async(f=!1)=>{if($.value||!n.value)return;$.value=!0;let m=0,y=0;f&&H.value&&(m=H.value.scrollHeight,y=H.value.scrollTop);try{const z=he(ye,`campaigns/${_.campaignId}/adventures/${_.adventureId}/chat`);let L=fe(z,Ce("timestamp","desc"),ze(Ve));f&&D.value&&(L=fe(z,Ce("timestamp","desc"),Ue(D.value),ze(Ve)));const M=await xe(L);if(M.empty)n.value=!1;else{D.value=M.docs[M.docs.length-1];const U=M.docs.map(X=>({id:X.id,...X.data()}));
1U.reverse(),f?(x.value=[...U,...x.value],we(()=>{if(H.value){const X=H.value.scrollHeight-m;H.value.scrollTop=y+X}})):(x.value=U,we(()=>{H.value&&(H.value.scrollTop=H.value.scrollHeight)}))}}catch(z){console.error("Error fetching chat history:",z)}finally{$.value=!1}},oe=()=>{Q.value&&(V=new IntersectionObserver(async f=>{f[0].isIntersecting&&!$.value&&n.value&&x.value.length>0&&await se(!0)},{root:H.value,threshold:.1}),V.observe(Q.value))};ke(()=>{se().then(()=>{oe()})}),$e(()=>{V&&V.disconnect()});const le=f=>{f.target.src='data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="%23374151"%3E%3Cpath fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd"/%3E%3C/svg%3E'},te=f=>{switch(f){case"item":return"bg-blue-600/80 text-white";case"spell":return"bg-purple-600/80 text-white";case"feature":return"bg-yellow-600/80 text-white";default:return"bg-gray-600/80 text-white"}},re=f=>f?(f.toDate?f.toDate():new Date(f)).toLocaleDateString(T.value,{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit"}):"";return(f,m)=>(o(),ue(Ae,{to:"body"},[e("div",{class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/80 backdrop-blur-md",onClick:m[2]||(m[2]=K(y=>f.$emit("close"),["self"]))},[e("div",nt,[e("div",it,[e("h2",dt,[m[3]||(m[3]=e("svg",{class:"w-6 h-6 text-purple-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})],-1)),O(" "+r(f.$t("chat.history_title")||"Histórico de Chat da Aventura"),1)]),e("div",ct,[e("div",ut,[ie(e("input",{"onUpdate:modelValue":m[0]||(m[0]=y=>q.value=y),type:"text",placeholder:f.$t("chat.search_placeholder")||"Pesquisar nas mensagens carregadas...",class:"w-full bg-gray-950 border border-gray-700 text-white px-4 py-2 pl-10 rounded-xl focus:outline-none focus:border-purple-500 transition-colors shadow-inner"},null,8,pt),[[ve,q.value]]),m[4]||(m[4]=e("svg",{class:"w-5 h-5 text-gray-500 absolute left-3 top-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1))])]),e("button",{onClick:m[1]||(m[1]=y=>f.$emit("close")),class:"text-gray-400 hover:text-white transition-colors bg-gray-700/50 hover:bg-red-500/80 p-2 rounded-full"},m[5]||(m[5]=[e("svg",{class:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("div",{ref_key:"scrollContainer",ref:H,class:"flex-1 overflow-y-auto p-4 space-y-4 relative custom-scrollbar bg-gray-950"},[ie(e("div",{ref_key:"topObserver",ref:Q,class:"h-4 flex items-center justify-center w-full"},[$.value&&n.value?(o(),l("div",vt)):b("",!0)],512),[[qe,!S.value]]),S.value&&P.value?(o(),l("div",gt,[m[6]||(m[6]=e("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-purple-500"},null,-1)),e("p",mt,r(f.$t("chat.searching_all")||"Buscando em todo o histórico..."),1)])):b("",!0),!$.value&&!P.value&&W.value.length===0?(o(),l("div",bt,[m[7]||(m[7]=e("svg",{class:"w-12 h-12",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})],-1)),e("p",null,r(f.$t("chat.no_messages")||"Nenhuma mensagem encontrada."),1)])):b("",!0),(o(!0),l(Y,null,J(W.value,y=>{var z,L,M,U;return o(),l("div",{key:y.id,class:"flex gap-3 group"},[(z=y.user)!=null&&z.photoURL?(o(),l("img",{key:0,src:y.user.photoURL,alt:y.user.displayName,class:"w-10 h-10 rounded-full flex-shrink-0 border border-gray-700",onError:le},null,40,ft)):(o(),l("div",ht,r((((L=y.user)==null?void 0:L.displayName)||"A")[0].toUpperCase()),1)),e("div",yt,[e("div",xt,[e("span",wt,r(((M=y.user)==null?void 0:M.displayName)||"Anônimo"),1),e("span",_t,r(re(y.timestamp)),1)]),y.roll?(o(),l("div",kt,[y.roll.title?(o(),l("div",$t,r(y.roll.title),
11)):b("",!0),e("div",Ct,r(y.roll.expression),1),y.roll.result!==void 0?(o(),l("div",St,[e("span",Mt,r(f.$t("chat.total_roll")||"Total:"),1),O(" "+r(y.roll.result),1)])):b("",!0)])):((U=y.roll)==null?void 0:U.type)==="card"&&y.roll.card?(o(),l("div",zt,[y.roll.card.imageUrl?(o(),l("div",It,[e("img",{src:y.roll.card.imageUrl,class:"w-full h-full object-cover"},null,8,At),m[8]||(m[8]=e("div",{class:"absolute inset-0 bg-gradient-to-t from-gray-900 to-transparent opacity-60"},null,-1))])):b("",!0),e("div",Pt,[e("div",Lt,[e("span",{class:G(["text-[8px] px-2 py-0.5 rounded-full uppercase font-black tracking-widest border border-white/10 shadow-lg",te(y.roll.card.category)])},r(y.roll.card.category),3)]),e("h4",Et,r(y.roll.card.title),1),e("p",Bt,r(y.roll.card.description),1)])])):(o(),l("p",jt,r(y.text||y.message),1))])])}),128))],512)])])]))}},Ht=De(Tt,[["__scopeId","data-v-aaff0e81"]]),Vt={class:"mt-4 border-t border-gray-700 pt-4"},Dt={class:"flex items-center gap-2"},Ft={class:"text-lg font-semibold text-white"},Nt={class:"absolute bottom-full mb-2 px-3 py-1.5 text-sm font-semibold text-white bg-gray-900/80 rounded-md shadow-lg whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-50 left-1/2 -translate-x-1/2"},qt={key:0},Ut={key:0,class:"flex justify-center items-center h-32"},Rt={key:1,class:"relative mt-4"},Wt={class:"relative h-44 bg-gray-700 overflow-hidden rounded-t-2xl -mb-px"},Kt=["src","alt"],Ot={key:1,class:"w-full h-full flex items-center justify-center bg-gradient-to-br from-gray-700 to-gray-800"},Zt={key:0,xmlns:"http://www.w3.org/2000/svg",class:"h-20 w-20 text-purple-500/30",viewBox:"0 0 24 24",fill:"currentColor"},Gt={key:1,xmlns:"http://www.w3.org/2000/svg",class:"h-16 w-16 text-gray-600",viewBox:"0 0 20 20",fill:"currentColor"},Qt={class:"absolute bottom-0 left-0 right-0 p-5"},Xt={class:"flex items-center gap-3"},Jt={key:0,class:"h-5 w-5 text-purple-400 flex-shrink-0 drop-shadow-lg",viewBox:"0 0 24 24",fill:"currentColor"},Yt={key:1,class:"h-5 w-5 text-white flex-shrink-0 drop-shadow-lg",viewBox:"0 0 20 20",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},es={class:"font-bold text-white text-lg drop-shadow-lg"},ts={class:"absolute top-2 right-2 flex flex-col items-end gap-1"},ss={key:0,class:"bg-gray-900/80 text-gray-400 text-[10px] font-black uppercase px-2 py-1 rounded-full border border-gray-700/50 backdrop-blur-md"},os={key:1,class:"bg-purple-600/90 text-white text-[10px] font-black uppercase px-2 py-1 rounded-full border border-purple-400/50 shadow-lg shadow-purple-900/40 backdrop-blur-md"},as={class:"p-4 flex-grow"},ls={key:0},rs={key:0},ns={class:"text-gray-400 text-sm break-words inline"},is=["onClick"],ds={key:1},cs={class:"max-h-32 overflow-y-auto pr-2 scrollbar-thin scrollbar-thumb-gray-600 scrollbar-track-gray-800 bg-gray-900/30 rounded p-2 border border-gray-700/50"},us={class:"text-gray-400 text-sm whitespace-pre-wrap break-words"},ps=["onClick"],vs={class:"p-4 pt-0"},gs={class:"flex items-center justify-end gap-2 mb-2"},ms={class:"relative group"},bs=["onClick"],fs={class:"absolute bottom-full mb-1 text-[10px] font-bold text-white uppercase opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-50 left-1/2 -translate-x-1/2 drop-shadow-[0_0_2px_rgba(0,0,0,1)] whitespace-nowrap"},hs={class:"relative group"},ys=["onClick"],xs={class:"absolute bottom-full mb-1 text-[10px] font-bold text-white uppercase opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-50 left-1/2 -translate-x-1/2 drop-shadow-[0_0_2px_rgba(0,0,0,1)] whitespace-nowrap"},ws={class:"relative group"},_s=["onClick"],ks={class:"relative group"},$s=["onClick"],Cs={class:"absolute bottom-full mb-1 text-[10px] font-bold text-white uppercase opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-50 left-1/2 -translate-x-1/2 drop-shadow-[0_0_2px_rgba(0,0,0,1)] whitespace-nowrap"},Ss={key:2,class:"text-gray-400 text-sm text-center py-4"},Ms={__name:"AdventuresList",props:{campaignId:{type:String,required:!0},dms:{type:Array,required:!0},isExpanded:{type:Boolean,default:!1}},emits:["toggle-expanded"],setup(ee,{emit:N}){const _=ee,{userProfile:B}=Pe(),{t:T}=_e({useScope:"global"}),q=N,x=h([]),A=h(!0),S=h(!1),P=h(null),C=h(null),j=h(null),$=h(!1),n=h(!1),H=
1h({}),Q=h(!1),D=h(null);let V=null;const W=[],{showConfirmation:se}=Le(),oe=(p,c)=>!p||p.length<=c?p:p.substring(0,c).trim(),le=p=>{H.value[p]=!H.value[p]},te=Z(()=>B.value&&_.dms.includes(B.value.uid)),re=p=>{if(!p.lastPlayedAt||x.value.length===0)return!1;const c=Math.max(...x.value.map(I=>{var g;return((g=I.lastPlayedAt)==null?void 0:g.seconds)||0}));return p.lastPlayedAt.seconds===c&&c>0},f=()=>{if(!C.value)return;const{scrollLeft:p,scrollWidth:c,clientWidth:I}=C.value;$.value=p>10,n.value=p<c-I-10;const g=p+I/2;let k=1/0,R=null;const s=C.value.querySelectorAll(".card-bg");x.value.forEach((a,t)=>{const v=s[t];if(v){const w=v.offsetLeft+v.offsetWidth/2,E=Math.abs(g-w);E<k&&(k=E,R=a.id)}}),j.value=R},m=()=>{if(C.value&&x.value.length>0){const p=x.value.findIndex(k=>k.id===j.value),c=Math.max(0,p-1),g=C.value.querySelectorAll(".card-bg")[c];if(g){const k=C.value.clientWidth,s=g.offsetLeft+g.offsetWidth/2-k/2;C.value.scrollTo({left:s,behavior:"smooth"})}setTimeout(f,500)}},y=()=>{if(C.value&&x.value.length>0){const p=x.value.findIndex(k=>k.id===j.value),c=Math.min(x.value.length-1,p+1),g=C.value.querySelectorAll(".card-bg")[c];if(g){const k=C.value.clientWidth,s=g.offsetLeft+g.offsetWidth/2-k/2;C.value.scrollTo({left:s,behavior:"smooth"})}setTimeout(f,500)}},z=()=>{V||(A.value=!0,V=Ke(_.campaignId,p=>{x.value=p.sort((c,I)=>{var a,t,v,w;const g=((a=c.lastPlayedAt)==null?void 0:a.seconds)||0,k=((t=I.lastPlayedAt)==null?void 0:t.seconds)||0;if(k!==g)return k-g;if(c.isEnabled!==I.isEnabled)return c.isEnabled?-1:1;const R=((v=c.createdAt)==null?void 0:v.seconds)||0;return(((w=I.createdAt)==null?void 0:w.seconds)||0)-R}),A.value=!1,setTimeout(f,100),p.forEach(c=>{const I=Oe(_.campaignId,c.id,g=>{if(g.length>0){const k=x.value.findIndex(R=>R.id===c.id);if(k!==-1){const R=g[0].url||g[0].imageUrl||g[0].mapUrl||g[0].backgroundImage;x.value[k].firstMapUrl=R}}});W.push(I)}),C.value&&C.value.addEventListener("scroll",f)}))},L=()=>{V&&(V(),V=null),C.value&&C.value.removeEventListener("scroll",f),W.forEach(p=>p()),W.length=0};let M=null;de(()=>_.isExpanded,p=>{p?(M&&clearTimeout(M),M=setTimeout(()=>{_.isExpanded&&z(),M=null},500)):(M&&(clearTimeout(M),M=null),L())},{immediate:!0}),$e(()=>{L()});const U=()=>{P.value=null,S.value=!0},X=p=>{P.value=p,S.value=!0},ne=()=>{S.value=!1,P.value=null},ce=async p=>{await se({title:T("adventures.delete_confirm_title"),message:T("adventures.delete_confirm_message"),confirmButtonText:T("adventures.delete_tooltip")})&&await Ge(_.campaignId,p)},i=async p=>{await Ze(_.campaignId,p.id,{isEnabled:!p.isEnabled})},u=p=>{D.value=p,Q.value=!0},d=()=>{Q.value=!1,D.value=null};return(p,c)=>{const I=Re("router-link");return o(),l("div",Vt,[e("div",{class:"flex justify-between items-center mb-4 cursor-pointer group/header",onClick:c[1]||(c[1]=g=>q("toggle-expanded"))},[e("div",Dt,[e("h3",Ft,r(p.$t("adventures.title")),1),(o(),l("svg",{class:G([{"rotate-180":ee.isExpanded},"h-5 w-5 text-gray-500 transition-transform duration-200 group-hover/header:text-purple-400"]),viewBox:"0 0 20 20",fill:"currentColor"},c[2]||(c[2]=[e("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)]),2))]),e("div",{class:"relative group",onClick:c[0]||(c[0]=K(()=>{},["stop"]))},[te.value?(o(),l("button",{key:0,onClick:U,class:"p-2 rounded-full bg-gray-700/80 text-white hover:bg-purple-600 transition-colors"},c[3]||(c[3]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"})],-1)]))):b("",!0),e("span",Nt,r(p.$t("adventures.create_tooltip")),1)])]),ee.isExpanded?(o(),l("div",qt,[A.value?(o(),l("div",Ut,c[4]||(c[4]=[e("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-purple-400"},null,-1)]))):x.value.length>0?(o(),l("div",Rt,[e("div",{ref_key:"scrollContainer",ref:C,class:G(["flex gap-6 overflow-x-auto scroll-smooth scrollbar-hide snap-x snap-mandatory pt-6 pb-14 px-[calc(50%-140px)]",{"justify-center":x.value.length===1}]),style:{"scroll-behavior":"smooth","pointer-events":"none"}},[(o(!0),l(Y,null,J(x.value,g=>(o(),l("div",{key:g.id,class:G(["card-bg flex flex-col rounded-2xl border bg-gray-800/60 shadow-lg backdrop-blur-lg transition-all hover:border-purple-400/50 w-[280px] snap-center flex-shrink-0 relative group/adv-card",j.value===g.id||!j.value&&re(g)?"border-purple-500 shadow-[0_0_40px_rgba(168,85,247,0.4)] scale-[1.05] z-10":"border-gray-700/50 opacity-60 grayscale-[0.5]"]),style:{"pointer-events":"auto"}},[e("div",Wt,[g.firstMapUrl?(o(),l("img",{key:0,src:g.firstMapUrl,alt:g.name,class:G([{grayscale:!g.isEnabled},"w-full h-full object-cover transition-all duration-500 transform-gpu"])},null,10,Kt)):(o(),l("div",Ot,[g.type==="roguelike"?(o(),l("svg",Zt,c[5]||(c[5]=[e("path",{d:"M12 2a8 8 0 0 0-8 8v4.3a4 4 0 0 0 4 4h1v2h2v-2h2v2h2v-2h1a4 4 0 0 0 4-4V10a8 8 0 0 0-8-8zM9 13a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm6 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"},null,-1)]))):(o(),l("svg",Gt,c[6]||(c[6]=[e("path",{"fill-rule":"evenodd",d:"M3 6a3 3 0 013-3h10a1 1 0 01.8 1.6L14.25 8l2.55 3.4A1 1 0 0116 13H6a1 1 0 00-1 1v3a1 1 0 11-2 0V6z","clip-rule":"evenodd"},null,-1)])))])),c[9]||(c[9]=e("div",{class:"absolute inset-0 bg-gradient-to-t from-gray-900 via-gray-900/40 to-transparent"},null,-1)),e("div",Qt,[e("div",Xt,[g.type==="roguelike"?(o(),l("svg",Jt,c[7]||(c[7]=[e("path",{d:"M12 2a8 8 0 0 0-8 8v4.3a4 4 0 0 0 4 4h1v2h2v-2h2v2h2v-2h1a4 4 0 0 0 4-4V10a8 8 0 0 0-8-8zM9 13a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm6 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"},null,-1)]))):(o(),l("svg",Yt,c[8]||(c[8]=[e("path",{"fill-rule":"evenodd",d:"M3 6a3 3 0 013-3h10a1 1 0 01.8 1.6L14.25 8l2.55 3.4A1 1 0 0116 13H6a1 1 0 00-1 1v3a1 1 0 11-2 0V6z","clip-rule":"evenodd"},null,-1)]))),e("h4",es,r(g.name),1)])]),e("div",ts,[g.isEnabled?b("",!0):(o(),l("span",ss,r(p.$t("adventures.status_disabled")),1)),g.type==="roguelike"?(o(),l("span",os," Roguelike ")):b("",!0)])]),e("div",as,[g.description?(o(),l("div",ls,[H.value[g.id]?(o(),l("div",ds,[e("div",cs,[e("p",us,r(g.description),1)]),e("button",{onClick:k=>le(g.id),class:"text-purple-400 hover:text-purple-300 text-xs mt-2 font-semibold flex items-center gap-1"},[O(r(p.$t("adventures.read_less"))+" ",1),c[11]||(c[11]=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3 w-3 rotate-180",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1))],8,ps)])):(o(),l("div",rs,[e("p",ns,[O(r(oe(g.description,50))+r(g.description.length>50?"...":"")+" ",1),g.description.length>50?(o(),l("button",{key:0,onClick:k=>le(g.id),class:"text-purple-400 hover:text-purple-300 text-xs font-semibold inline-flex items-center gap-1 ml-1 align-baseline"},[O(r(p.$t("adventures.read_more"))+" ",1),c[10]||(c[10]=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3 w-3",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1))],8,is)):b("",!0)])]))])):b("",!0)]),e("div",vs,[e("div",gs,[e("div",ms,[te.value?(o(),l("button",{key:0,onClick:k=>i(g),class:G([g.isEnabled?"text-green-400":"text-gray-500","text-gray-400 hover:text-white transition-colors"])},c[12]||(c[12]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z","clip-rule":"evenodd"})],-1)]),10,bs)):b("",!0),e("span",fs,r(g.isEnabled?p.$t("adventures.disable_tooltip"):p.$t("adventures.enable_tooltip")),1)]),e("div",hs,[te.value?(o(),l("button",{key:0,onClick:k=>X(g),class:"text-gray-400 hover:text-white transition-colors"},c[13]||(c[13]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{d:"M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z"}),e("path",{"fill-rule":"evenodd",d:"M2 6a2 2 0 012-2h4a1 1 0 010 2H4v10h10v-4a1 1 0 112 0v4a2 2 0 01-2 2H4a2 2 0 01-2-2V6z","clip-rule":"evenodd"})],-1)]),8,ys)):b("",!0),e("span",xs,r(p.$t("adventures.edit_tooltip")),1)]),e("div",ws,[te.value?(o(),l("button",{key:0,onClick:k=>u(g.id),class:"text-gray-400 hover:text-purple-400 transition-colors"},c[14]||(c[14]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})],-1)]),8,_s)):b("",!0),c[15]||(c[15]=e("span",{class:"absolute bottom-full mb-1 text-[10px] font-bold text-white uppercase opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-50 left-1/2 -translate-x-1/2 drop-shadow-[0_0_2px_rgba(0,0,0,1)] whitespace-nowrap"},"Chat Log",-1))]),e("div",ks,[te.value?(o(),l("button",{key:0,onClick:k=>ce(g.id),class:"text-gray-400 hover:text-red-500 transition-colors"},c[16]||(c[16]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"})],-1)]),8,$s)):b("",!0),e("span",Cs,r(p.$t("adventures.delete_tooltip")),1)])]),g.isEnabled?(o(),ue(I,{key:0,to:`/tabletop/${ee.campaignId}/${g.id}`,class:"btn-primary w-full text-center flex items-center justify-center gap-2"},{default:We(()=>[c[17]||(c[17]=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z","clip-rule":"evenodd"})],-1)),O(" "+r(p.$t("adventures.enter_game")),1)]),_:2,__:[17]},1032,["to"])):b("",!0)])],2))),128))],2),$.value?(o(),l("button",{key:0,onClick:m,class:"absolute left-2 top-20 -translate-y-1/2 bg-gray-900/50 hover:bg-gray-900/80 text-white/80 hover:text-white p-2 rounded-full backdrop-blur-sm transition-all duration-300 z-10 border border-white/10"},c[18]||(c[18]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)]))):b("",!0),n.value?(o(),l("button",{key:1,onClick:y,class:"absolute right-2 top-20 -translate-y-1/2 bg-gray-900/50 hover:bg-gray-900/80 text-white/80 hover:text-white p-2 rounded-full backdrop-blur-sm transition-all duration-300 z-10 border border-white/10"},c[19]||(c[19]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})],-1)]))):b("",!0)])):(o(),l("div",Ss,r(p.$t("adventures.no_adventures")),1))])):b("",!0),S.value?(o(),ue(ot,{key:1,campaignId:ee.campaignId,adventureToEdit:P.value,onClose:ne},null,8,["campaignId","adventureToEdit"])):b("",!0),Q.value?(o(),ue(Ht,{key:2,campaignId:ee.campaignId,adventureId:D.value,onClose:d},null,8,["campaignId","adventureId"])):b("",!0)])}}},zs={class:"font-semibold text-gray-200 text-sm mb-2"},Is={key:0,class:"text-xs text-gray-400"},As={key:1,class:"flex items-center -space-x-2"},Ps=["src","alt"],Ls={key:1,class:"h-10 w-10 rounded-full bg-gray-700 border-2 border-gray-800 flex items-center justify-center"},Es={class:"absolute bottom-full mb-2 w-max px-2 py-1 bg-gray-900 text-white text-xs rounded-md opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-20 shadow-lg"},Bs={__name:"PlayerIcons",props:{playerIds:{type:Array,required:!0},disabledPlayerIds:{type:Array,default:()=>[]}},setup(ee){const N=ee,_=h([]),B=h(!0),T=Z(()=>{const x=new Set(N.disabledPlayerIds||[]);return(N.playerIds||[]).filter(A=>!x.has(A))}),q=async()=>{const x=T.value;x&&x.length>0?(B.value=!0,_.value=await Ie(x),B.value=!1):(_.value=[],B.value=!1)};return ke(()=>{q()}),de([()=>N.playerIds,()=>N.disabledPlayerIds],()=>{q()},{deep:!0}),(x,A)=>(o(),l("div",null,[e("p",zs,r(x.$t("common.players"))+":",1),B.value?(o(),l("div",Is,r(x.$t("common.loading")),1)):(o(),l("div",As,[(o(!0),l(Y,null,J(_.value,S=>(o(),l("div",{key:S.uid,class:"group relative"},[S.photoURL?(o(),l("img",{key:0,class:"h-10 w-10 rounded-full object-cover border-2 border-gray-800",src:S.photoURL,alt:S.displayName},null,8,Ps)):(o(),l("div",Ls,A[0]||(A[0]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#a1a1aa",class:"w-6 h-6"},[e("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"})],-1)]))),e("div",Es,r(S.displayName),1)]))),128))]))]))}},js={class:"p-6 pb-4 border-b border-gray-800 bg-gray-950/60 flex items-center justify-between flex-shrink-0"},Ts={class:"flex items-center gap-3"},Hs={class:"text-xl font-bold text-white"},Vs={class:"p-6 space-y-5 flex-grow overflow-y-auto custom-scrollbar"},Ds={class:"flex items-center justify-between mb-1.5"},Fs={for:"campaignName",class:"label mb-0 text-xs font-bold text-gray-300"},Ns=["disabled"],qs={key:0,class:"fa-solid fa-spinner fa-spin text-xs text-amber-400"},Us={key:1,class:"material-icons text-sm text-amber-400 drop-shadow-[0_0_8px_rgba(245,158,11,0.6)] group-hover:scale-110 transition-transform"},Rs={class:"max-w-0 group-hover:max-w-xs transition-all duration-300 ease-in-out opacity-0 group-hover:opacity-100 overflow-hidden whitespace-nowrap text-[10px] font-bold text-amber-300 tracking-wider up
1percase"},Ws={class:"relative"},Ks={key:0,class:"absolute inset-0 rounded-lg overflow-hidden border border-amber-400/60 z-20 bg-gray-950/90 backdrop-blur-sm flex items-center justify-center px-4 shadow-[0_0_15px_rgba(245,158,11,0.25)]"},Os={class:"flex items-center justify-between mb-1.5"},Zs={class:"flex items-center gap-2"},Gs={for:"campaignDesc",class:"label mb-0 text-xs font-bold text-gray-300"},Qs=["disabled"],Xs={key:0,class:"fa-solid fa-spinner fa-spin text-xs text-amber-400"},Js={key:1,class:"material-icons text-sm text-amber-400 drop-shadow-[0_0_8px_rgba(245,158,11,0.6)] group-hover:scale-110 transition-transform"},Ys={class:"max-w-0 group-hover:max-w-xs transition-all duration-300 ease-in-out opacity-0 group-hover:opacity-100 overflow-hidden whitespace-nowrap text-[10px] font-bold text-amber-300 tracking-wider uppercase"},eo={class:"relative"},to={key:0,class:"absolute inset-0 rounded-lg overflow-hidden border border-amber-400/60 z-20 bg-gray-950/90 backdrop-blur-sm flex flex-col items-center justify-center p-4 shadow-[0_0_20px_rgba(245,158,11,0.25)]"},so={for:"nextSession",class:"label text-xs font-bold text-gray-300"},oo={class:"flex items-center justify-between mb-2"},ao={for:"campaignSystem",class:"label mb-0"},lo={class:"flex gap-2"},ro={class:"material-icons text-xs"},no=["value"],io=["value"],co={key:1,class:"relative"},uo=["onClick"],po={class:"h-14 w-full bg-gray-800 flex items-center justify-center relative overflow-hidden group"},vo={key:0,class:"relative z-10 w-full h-full flex items-center justify-center overflow-hidden p-1"},go=["src","onError"],mo={key:1,class:"relative z-10 text-3xl font-black text-white/20 uppercase tracking-tighter group-hover:scale-110 transition-transform"},bo={class:"p-1 px-2 flex-grow flex items-center border-t border-gray-800"},fo={class:"text-[10px] font-bold text-gray-200 line-clamp-1 uppercase tracking-tight"},ho={key:0,class:"mt-6 p-4 rounded-xl bg-gray-900/50 border border-gray-700/50 space-y-4"},yo={class:"text-xs font-bold text-purple-400 uppercase tracking-widest flex items-center gap-2"},xo={class:"grid grid-cols-1 gap-4"},wo={class:"text-[10px] font-bold text-purple-300 uppercase tracking-tight mb-1 flex items-center gap-1.5"},_o={value:null},ko=["label"],$o=["value"],Co={key:1,label:"Outras Fichas Personalizadas"},So=["value"],Mo={class:"text-[10px] font-bold text-amber-300 uppercase tracking-tight mb-1 flex items-center gap-1.5"},zo={value:null},Io=["label"],Ao=["value"],Po={key:1,label:"Outras Fichas Personalizadas"},Lo=["value"],Eo={key:1,class:"mt-8 pt-4 border-t border-gray-700"},Bo={class:"text-xl font-semibold text-white mb-4"},jo={key:0,class:"space-y-3"},To={class:"flex items-center gap-3"},Ho=["src","alt"],Vo={key:1,class:"h-8 w-8 rounded-full bg-gray-700 flex items-center justify-center text-gray-400"},Do={class:"flex items-center gap-2"},Fo={key:0,class:"px-2 py-0.5 bg-purple-500/30 text-purple-300 rounded-full text-xs font-semibold"},No={key:1,class:"px-2 py-0.5 bg-blue-500/30 text-blue-300 rounded-full text-xs font-semibold"},qo=["title"],Uo={key:0,class:"flex items-center gap-2"},Ro=["onClick","title"],Wo={key:0,class:"material-icons text-base"},Ko={key:1,class:"material-icons text-base"},Oo=["onClick","title"],Zo={key:1,class:"text-gray-400 text-sm"},Go={class:"p-8 pt-4 border-t border-gray-700 flex justify-end gap-4 bg-gray-800/50 backdrop-blur-sm flex-shrink-0"},Qo=["disabled"],Xo={class:"bg-gray-900 rounded-3xl w-full max-w-5xl h-full max-h-[90vh] border border-gray-800 shadow-3xl flex flex-col p-8 overflow-hidden relative"},Jo={class:"text-3xl font-black text-white mb-2 tracking-tighter uppercase italic"},Yo={class:"text-sm text-gray-500 mb-8"},ea={class:"flex-grow overflow-y-auto custom-scrollbar pr-2"},ta={class:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-4"},sa=["onClick"],oa={class:"h-3/5 w-full bg-gray-800 overflow-hidden relative flex items-center justify-center"},aa={key:0,class:"relative z-10 w-full h-full flex items-center justify-center overflow-hidden p-2"},la=["src","onError"],ra={key:1,class:"relative z-10 text-5xl font-black text-white/20 uppercase tracking-tighter group-hover/sys:scale-110 transition-transform"},na={class:"p-4 flex-grow flex flex-col justify-between border-t border-gray-800"},ia={class:"font-bold text-sm text-white mb-1 line-clamp-1 truncate"},da={class:"text-[10px] text-gray-500 leading-relaxed uppercase tracking-widest font-bold opacity-60"},ca={key:0,class:"bg-purple-600 py-1 rounded text-center text-[8px] font-black uppercase tracking-widest text-white mt-2"},ua={__name:"CreateCampaignModal",props:{campaignToEdit:{type:Object,default:null}},emits:["close"],setup(ee,{emit:N}){const _=ee,{t:B,locale:T}=_e({useScope:"global"}),{showConfirmation:q}=Le(),{addNotification:x}=Ne(),{userProfile:A}=Pe(),S=N,P=h(!1),C=h(!1),j=h(!1),$=s=>s==null?void 0:s.toLowerCase().replace(/[^a-z0-9]/g,"").trim(),n=h({name:"",description:"",nextSession:"",players:[],dms:[],system:"dnd",customSheetId:null,customNpcSheetId:null}),H=async()=>
1{if(!C.value){C.value=!0;try{const s=L.value.find(t=>t.id===n.value.system),a=await lt({currentTitle:n.value.name,system:(s==null?void 0:s.label)||n.value.system||"D&D 5e",context:n.value.description,isAdventure:!1,language:(T==null?void 0:T.value)||"pt"});a&&(n.value.name=a,x({message:"Título da campanha gerado com IA!",type:"success"}))}catch(s){console.error("Erro ao gerar título:",s),x({message:`Erro ao gerar título: ${s.message}`,type:"error"})}finally{C.value=!1}}},Q=async()=>{if(!j.value){j.value=!0;try{const s=L.value.find(t=>t.id===n.value.system),a=await rt({currentDescription:n.value.description,title:n.value.name,system:(s==null?void 0:s.label)||n.value.system||"D&D 5e",isAdventure:!1,language:(T==null?void 0:T.value)||"pt"});a&&(n.value.description=a,x({message:"Sinopse sem spoilers gerada com IA!",type:"success"}))}catch(s){console.error("Erro ao gerar sinopse:",s),x({message:`Erro ao gerar sinopse: ${s.message}`,type:"error"})}finally{j.value=!1}}},D=h([]),V=h([]),W=h(null),se=h("visual"),oe=h(!1),le=h(new Set),te=h(null),re=h(null),f=Z(()=>[...D.value,...V.value]),m=Z(()=>!!_.campaignToEdit),y=Z(()=>P.value?m.value?B("create_campaign.saving"):B("create_campaign.creating"):m.value?B("create_campaign.save_changes"):B("create_campaign.create_campaign")),z={dnd:"D&D 5.5 / 5e",d20age:"D20 Age",breu:"Breu",morkborg:"Mork Borg",starwars:"Star Wars",cyberpunk:"Cyberpunk",pf2e:"Pathfinder 2e",coc:"Call of Cthulhu",kob:"Kids on Bikes"},L=Z(()=>{const s=new Map;return[{id:"dnd",label:z.dnd,thumbnail:"https://firebasestorage.googleapis.com/v0/b/table-top-llm.appspot.com/o/assets%2Fsystems%2Fdnd_cover.jpg?alt=media",bgColor:"#ef4444",bgImage:null,imageScale:1,imagePosition:{x:0,y:0},uniqueKey:"dnd_legacy"},{id:"d20age",label:z.d20age,thumbnail:"https://firebasestorage.googleapis.com/v0/b/table-top-llm.appspot.com/o/assets%2Fsystems%2Fd20age_cover.jpg?alt=media",bgColor:"#3b82f6",bgImage:null,imageScale:1,imagePosition:{x:0,y:0},uniqueKey:"d20age_legacy"},{id:"breu",label:z.breu,thumbnail:"https://firebasestorage.googleapis.com/v0/b/table-top-llm.appspot.com/o/assets%2Fsystems%2Fbreu_cover.jpg?alt=media",bgColor:"#10b981",bgImage:null,imageScale:1,imagePosition:{x:0,y:0},uniqueKey:"breu_legacy"},{id:"morkborg",label:z.morkborg,thumbnail:"https://firebasestorage.googleapis.com/v0/b/table-top-llm.appspot.com/o/assets%2Fsystems%2Fmorkborg_cover.jpg?alt=media",bgColor:"#f59e0b",bgImage:null,imageScale:1,imagePosition:{x:0,y:0},uniqueKey:"morkborg_legacy"}].forEach(v=>s.set(v.id,v)),[...f.value].sort((v,w)=>{var F,me;const E=((F=v.createdAt)==null?void 0:F.seconds)||0,ae=((me=w.createdAt)==null?void 0:me.seconds)||0;return E-ae}).forEach(v=>{var E,ae;if(!v.system)return;const w=$(v.system);if(!s.has(w))s.set(w,{id:w,label:z[w]||v.system,originalName:v.system,color:((ae=(E=v.style)==null?void 0:E.border)==null?void 0:ae.color)||i(w),bgColor:v.bgColor||v.systemBgColor||i(w),bgImage:v.bgImage||v.systemBgImage||null,thumbnail:v.thumbnail||null,imageScale:v.imageScale!==void 0?v.imageScale:1,imagePosition:v.imagePosition||{x:0,y:0},uniqueKey:`custom_${w}`});else{const F=s.get(w);v.thumbnail&&!F.thumbnail&&(F.thumbnail=v.thumbnail),v.bgColor&&!F.bgColor&&(F.bgColor=v.bgColor),v.bgImage&&!F.bgImage&&(F.bgImage=v.bgImage),v.imageScale!==void 0&&F.imageScale===1&&(F.imageScale=v.imageScale),v.imagePosition&&F.imagePosition.x===0&&F.imagePosition.y===0&&(F.imagePosition=v.imagePosition)}}),Array.from(s.values()).sort((v,w)=>v.label.localeCompare(w.label))}),M=Z(()=>{if(!n.value.system)return[];const s=$(n.value.system);return f.value.filter(a=>$(a.system)===s)}),U=Z(()=>{if(!n.value.system)return f.value;const s=$(n.value.system);return f.value.filter(a=>$(a.system)!==s)});Z(()=>M.value),Z(()=>M.value);const X=s=>{le.value.add(s)},ne=s=>n.value.system===s.id,ce=s=>{n.value.system=s.id;const a=["npc","criatura","monstro","inimigo"],t=f.value.find(w=>$(w.system)===$(s.id)&&!a.some(E=>$(w.name).includes(E)));t?n.value.customSheetId=t.id:n.value.customSheetId=null;const v=f.value.find(w=>$(w.system)===$(s.id)&&a.some(E=>$(w.name).includes(E)));if(v)n.value.customNpcSheetId=v.id;else{const w=V.value.find(E=>$(E.system)===$(s.id)&&a.some(ae=>$(E.name).includes(ae)));if(w)n.value.customNpcSheetId=w.id;else{const E=f.value.find(ae=>$(ae.system)===$(s.id)&&a.some(F=>$(ae.name).includes(F)));if(E)n.value.customNpcSheetId=E.id;else{const ae=V.value.find(F=>$(F.system)==="dnd"&&a.some(me=>$(F.name).includes(me)));n.value.customNpcSheetId=ae?ae.id:null}}}oe.value=!1},i=s=>({dnd:"#ef4444",d20age:"#3b82f6",breu:"#10b981",morkborg:"#f59e0b",starwars:"#6366f1",cyberpunk:"#ec4899",pf2e:"#f43f5e",coc:"#8b5cf6",kob:"#7c2d82"})[s==null?void 0:s.toLowerCase()]||"#4b5563",u=h([]),d=Z(()=>{var s;return A.value&&((s=n.value)==null?void 0:s.dms.includes(A.value.uid))});Z(()=>{var s;return A.value&&((s=n.value)==null?void 0:s.ownerId)===A.value.uid}),ke(async()=>{document.body.style.overflow="hidden",m.value&&(n.value={..._.campaignToEdit},n.value.players=n.value.players||[],n.value.dms=n.value.dms||[],n.value.disabledPlayers=n.value.disabledPlayers||[],n.value.players.length>0?u.value=await Ie(n.value.players):u.value=[]),A.value&&await c(A.value.uid),we(()=>{p()})}),$e(()=>{document.body.style.overflow=""});const p=()=>
1{if(re.value&&te.value){const s=te.value,a=re.value,t=a.offsetLeft-s.offsetWidth/2+a.offsetWidth/2;s.scrollTo({left:t,behavior:"smooth"})}},c=async s=>{const[a,t]=await Promise.all([Qe(s),Xe()]);if(a.success?D.value=a.sheets:D.value=[],t.success?V.value=t.sheets.filter(v=>v.createdBy!==s):V.value=[],n.value.customSheetId){const v=await Ee(n.value.customSheetId);v.success&&(W.value=v.sheet)}};de(A,async s=>{s&&s.uid&&await c(s.uid)}),de(()=>n.value.customSheetId,async s=>{if(!s){W.value=null;return}const a=D.value.find(t=>t.id===s)||V.value.find(t=>t.id===s);if(a)W.value=a;else{const t=await Ee(s);t.success&&(W.value=t.sheet)}}),de(()=>L.value,()=>{we(()=>{p()})},{deep:!0}),de(()=>{var s;return(s=n.value)==null?void 0:s.players},async s=>{m.value&&s&&s.length>0?u.value=await Ie(s):m.value&&(u.value=[])},{deep:!0});const I=async()=>{if(!n.value.name||!n.value.description){x({message:B("create_campaign.validation_error"),type:"error",duration:3e3});return}P.value=!0;try{const s={name:n.value.name,description:n.value.description,nextSession:n.value.nextSession||null,system:n.value.system||"dnd",customSheetId:n.value.customSheetId||null,customNpcSheetId:n.value.customNpcSheetId||null,disabledPlayers:n.value.disabledPlayers||[]};if(m.value)console.log("[CreateCampaignModal] Atualizando campanha:",_.campaignToEdit.id,s),await pe(_.campaignToEdit.id,s),S("close");else{console.log("[CreateCampaignModal] Criando campanha:",s);const a=await Fe({...n.value},A.value);try{const t=he(ye,`campaigns/${a}/adventures`),v=await xe(t);let w=null;v.empty||(w=v.docs[0].id),w?window.location.href=`/tabletop/${a}/${w}`:S("close")}catch(t){console.error("Error auto-entering campaign tabletop:",t),S("close")}}}catch(s){console.error("Erro ao salvar campanha:",s),x({message:B("create_campaign.error_saving",{error:s.message}),type:"error",duration:5e3})}finally{P.value=!1}},g=async s=>{if(await q({title:B("create_campaign.remove_player_confirm_title"),message:B("create_campaign.remove_player_confirm_message"),confirmButtonText:B("create_campaign.remove_confirm_button")})){P.value=!0;try{const t=n.value.players.filter(w=>w!==s),v=n.value.dms.filter(w=>w!==s);await pe(_.campaignToEdit.id,{players:t,dms:v}),n.value.players=t,n.value.dms=v}catch(t){console.error("Erro ao remover jogador:",t)}finally{P.value=!1}}},k=s=>(n.value.disabledPlayers||[]).includes(s),R=async s=>{let a=[...n.value.disabledPlayers||[]];const t=a.includes(s);if(t?a=a.filter(v=>v!==s):a.push(s),n.value.disabledPlayers=a,m.value){P.value=!0;try{await pe(_.campaignToEdit.id,{disabledPlayers:a}),x({message:B(t?"create_campaign.enable_player_tooltip":"create_campaign.disable_player_tooltip"),type:"success"})}catch(v){console.error("Erro ao atualizar status do jogador:",v),x({message:"Erro ao atualizar status do jogador.",type:"error"})}finally{P.value=!1}}};return(s,a)=>(o(),ue(Ae,{to:"body"},[e("div",{class:"fixed inset-0 bg-black/80 backdrop-blur-md z-[999999] flex items-center justify-center p-4 select-none",onClick:a[17]||(a[17]=K(t=>s.$emit("close"),["self"])),onWheel:a[18]||(a[18]=K(()=>{},["stop","prevent"])),onTouchmove:a[19]||(a[19]=K(()=>{},["stop","prevent"])),onPointerdown:a[20]||(a[20]=K(()=>{},["stop"])),onMousedown:a[21]||(a[21]=K(()=>{},["stop"]))},[e("div",{class:"bg-gray-900 rounded-2xl w-full max-w-4xl max-h-[90vh] border border-purple-500/30 shadow-2xl flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-200 select-text",onClick:a[10]||(a[10]=K(()=>{},["stop"])),onWheel:a[11]||(a[11]=K(()=>{},["stop"])),onTouchmove:a[12]||(a[12]=K(()=>{},["stop"])),onPointerdown:a[13]||(a[13]=K(()=>{},["stop"])),onMousedown:a[14]||(a[14]=K(()=>{},["stop"]))},[e("div",js,[e("div",Ts,[a[23]||(a[23]=e("div",{class:"w-10 h-10 rounded-xl bg-purple-600/20 border border-purple-500/30 flex items-center justify-center text-purple-400"},[e("span",{class:"material-icons text-xl"},"folder_special")],-1)),e("div",null,[e("h2",Hs,r(m.value?s.$t("create_campaign.edit_title"):s.$t("create_campaign.new_title")),1),a[22]||(a[22]=e("p",{class:"text-xs text-gray-400"},"Configure sua campanha e personalize o sistema de jogo",-1))])]),e("button",{onClick:a[0]||(a[0]=t=>s.$emit("close")),type:"button",class:"w-8 h-8 rounded-lg flex items-center justify-center text-gray-400 hover:text-white hover:bg-white/10 transition-colors"},a[24]||(a[24]=[e("span",{class:"material-icons text-base"},"close",-1)]))]),e("form",{onSubmit:K(I,["prevent"]),novalidate:"",class:"flex flex-col flex-grow overflow-hidden"},[e("div",Vs,[e("div",null,[e("div",Ds,[e("label",Fs,r(s.$t("create_campaign.name_label")),1),e("button",{type:"button",onClick:H,disabled:C.value,class:"group relative inline-flex items-center gap-1.5 px-2.5 py-1 rounded-xl bg-gray-800/90 hover:bg-amber-500/20 border border-gray-700 hover:border-amber-400/50 text-amber-400 transition-all duration-300 active:scale-95 disabled:opacity-50 cursor-pointer shadow-sm overflow-hidden",title:"Gerar com Saga AI"},[C.value?(o(),l("i",qs)):(o(),l("span",Us,"auto_awesome")),e("span",Rs,[ge(Be,{class:"text-xs pointer-events-none"})])],8,Ns)]),e("div",Ws,[ie(e("input",{type:"text",id:"campaignName","onUpdate:modelValue":a[1]||(a[1]=t=>n.value.name=t),class:"input-field bg-gray-800/90 border-gray-700 text-sm",placeholder:"Ex: As Crônicas de Eldoria, Sombras de Arton..."},null,512),[[ve,n.value.name]]),C.value?(o(),l("div",Ks,a[25]||(a[25]=[e("div",{class:"absolute inset-0 bg-gradient-to-r from-purple-600/30 via-amber-400/40 to-indigo-600/30 animate-ai-sweep"},null,-1),e("div",{class:"relative flex items-center gap-2 text-amber-300 font-bold text-xs tracking-wider up
1percase drop-shadow"},[e("span",{class:"material-icons text-sm animate-spin text-amber-400"},"auto_awesome"),e("span",null,"Saga AI gerando título...")],-1)]))):b("",!0)])]),e("div",null,[e("div",Os,[e("div",Zs,[e("label",Gs,r(s.$t("create_campaign.desc_label")),1),a[26]||(a[26]=e("span",{class:"text-[10px] text-gray-400 font-medium"},"(Sem Spoilers)",-1))]),e("button",{type:"button",onClick:Q,disabled:j.value,class:"group relative inline-flex items-center gap-1.5 px-2.5 py-1 rounded-xl bg-gray-800/90 hover:bg-amber-500/20 border border-gray-700 hover:border-amber-400/50 text-amber-400 transition-all duration-300 active:scale-95 disabled:opacity-50 cursor-pointer shadow-sm overflow-hidden",title:"Gerar com Saga AI"},[j.value?(o(),l("i",Xs)):(o(),l("span",Js,"auto_awesome")),e("span",Ys,[ge(Be,{class:"text-xs pointer-events-none"})])],8,Qs)]),e("div",eo,[ie(e("textarea",{id:"campaignDesc","onUpdate:modelValue":a[2]||(a[2]=t=>n.value.description=t),rows:"4",class:"input-field bg-gray-800/90 border-gray-700 text-sm leading-relaxed",placeholder:"Descreva a premissa, o clima do mundo e o chamado inicial aos jogadores (sem spoilers da trama)..."},null,512),[[ve,n.value.description]]),j.value?(o(),l("div",to,a[27]||(a[27]=[e("div",{class:"absolute inset-0 bg-gradient-to-r from-purple-600/30 via-amber-400/40 to-indigo-600/30 animate-ai-sweep"},null,-1),e("div",{class:"relative flex items-center gap-2 text-amber-300 font-bold text-xs tracking-wider uppercase mb-1 drop-shadow"},[e("span",{class:"material-icons text-base animate-spin text-amber-400"},"auto_awesome"),e("span",null,"Saga AI gerando premissa...")],-1),e("span",{class:"relative text-[10px] text-gray-300 italic font-medium"},"Criando atmosfera e lore da campanha...",-1)]))):b("",!0)])]),e("div",null,[e("label",so,r(s.$t("create_campaign.next_session_label")),1),ie(e("input",{type:"date",id:"nextSession","onUpdate:modelValue":a[3]||(a[3]=t=>n.value.nextSession=t),class:"input-field bg-gray-800/90 border-gray-700 text-sm"},null,512),[[ve,n.value.nextSession]])]),e("div",null,[e("div",oo,[e("label",ao,r(s.$t("create_campaign.system_label")),1),e("div",lo,[e("button",{type:"button",onClick:a[4]||(a[4]=t=>oe.value=!0),class:"text-[10px] flex items-center gap-1 text-purple-400 hover:text-purple-300 transition-colors"},[a[28]||(a[28]=e("span",{class:"material-icons text-xs"},"grid_on",-1)),O(" "+r(s.$t("create_campaign.view_grid")),1)]),e("button",{type:"button",onClick:a[5]||(a[5]=t=>se.value=se.value==="list"?"visual":"list"),class:"text-[10px] flex items-center gap-1 bg-gray-700 hover:bg-gray-600 px-2 py-1 rounded transition-colors text-gray-300"},[e("span",ro,r(se.value==="list"?"grid_view":"list"),1),O(" "+r(se.value==="list"?s.$t("create_campaign.visual_view"):s.$t("create_campaign.list_view")),1)])])]),se.value==="list"?(o(),l("select",{key:0,id:"campaignSystem",value:n.value.system,class:"input-field",onChange:a[6]||(a[6]=t=>{const v=L.value.find(w=>w.id===t.target.value);v&&ce(v)})},[(o(!0),l(Y,null,J(L.value,t=>(o(),l("option",{key:t.uniqueKey,value:t.id}," ● "+r(t.label),9,io))),128))],40,no)):(o(),l("div",co,[e("div",{ref_key:"carouselRef",ref:te,class:"flex gap-4 overflow-x-auto pb-4 custom-scrollbar snap-x no-scrollbar scroll-smooth"},[(o(!0),l(Y,null,J(L.value,t=>{var v,w;return o(),l("div",{key:t.uniqueKey,ref_for:!0,ref:E=>{ne(t)&&(re.value=E)},onClick:E=>ce(t),class:G(["flex-shrink-0 w-40 h-24 rounded-lg border-2 cursor-pointer transition-all snap-start overflow-hidden bg-gray-900 flex flex-col relative group/sys",ne(t)?"border-purple-500 bg-purple-500/20":"border-gray-800 hover:border-gray-700"])},[e("div",po,[e("div",{class:"absolute inset-0 w-full h-full flex flex-col items-center justify-center transition-all",style:be({backgroundColor:t.bgColor||t.color||i(t.id),backgroundImage:t.bgImage?`url(${t.bgImage})`:"none",backgroundSize:"cover",backgroundPosition:"center"})},a[29]||(a[29]=[e("div",{class:"absolute inset-0 bg-black/30 group-hover:bg-black/10 transition-colors"},null,-1)]),4),t.thumbnail&&!le.value.has(t.uniqueKey)?(o(),l("div",vo,[e("img",{src:t.thumbnail,onError:E=>X(t.uniqueKey),class:"pointer-events-none drop-shadow-lg transition-transform",style:be({transform:`translate(${(v=t.imagePosition)!=null&&v.x?t.imagePosition.x*.4:0}px, ${(w=t.imagePosition)!=null&&w.y?t.imagePosition.y*.4:0}px) scale(${t.imageScale||1})`,maxHeight:"44px",maxWidth:"120px"})},null,44,go)])):(o(),l("span",mo,r(t.label.substring(0,2)),1))]),e("div",bo,[e("span",fo,r(t.label),1)])],10,uo)}),128))],512)]))]),n.value.system?(o(),l("div",ho,[e("h3",yo,[a[30]||(a[30]=e("span",{class:"material-icons text-sm"},"tune",-1)),O(" "+r(s.$t("create_campaign.customization_title")),1)]),e("div",xo,[e("div",null,[e("label",wo,[a[31]||(a[31]=e("span",{class:"material-icons text-xs"},"person",-1)),e("span",null,r(s.$t("create_campaign.pc_sheet_label")),1)]),ie(e("select",{"onUpdate:modelValue":a[7]||(a[7]=t=>n.value.customSheetId=t),class:"input-field py-2 text-sm border-purple-500/30 focus:border-purple-500"},[e("option",_o,r(s.$t("create_campaign.default_system",{system:z[n.value.system]||n.value.system})),1),M.value.length>0?(o(),l("optgroup",{key:0,label:`Fichas de ${z[n.value.system]||n.value.system}`},[(o(!0),l(Y,null,J(M.value,t=>(o(),l("option",{key:t.id,value:t.id},r(t.name)+" "+r(t.isPublic?"[Pública]":"[Minha]"),9,$o))),128))],8,ko)):b("",!0),U.value.length>0?(o(),l("optgroup",Co,[(o(!0),l(Y,null,J(U.value,t=>(o(),l("option",{key:t.id,value:t.id},r(t.name)+" ("+r(t.system)+") "+r(t.isPublic?"[Pública]":"[Minha]"),9,So))),128))])):b("",!0)],512),[[je,n.value.customSheetId]])]),e("div",null,[e("label",Mo,[a[32]||(a[32]=e("span",{class:"material-icons text-xs"},"pets",-1)),e("span",null,r(s.$t("create_campaign.npc_sheet_label")),1)]),ie(e("select",{"onUpdate:modelValue":a[8]||(a[8]=t=>n.value.customNpcSheetId=t),class:"input-field py-2 text-sm border-amber-500/30 focus:border-amber-500"},[e("option",zo,r(s.$t("create_campaign.default_system",{system:z[n.value.system]||n.value.system}))+" (Bloco de Estatísticas)",1),M.value.length>0?(o(),l("optgroup",{key:0,label:`Fichas de ${z[n.value.system]||n.value.system}`},[(o(!0),l(Y,null,J(M.value,t=>(o(),l("option",{key:t.id,value:t.id},r(t.name)+" "+r(t.isPublic?"[Pública]":"[Minha]"),9,Ao))),128))],8,Io)):b("",!0),U.value.length>0?(o(),l("optgroup",Po,[(o(!0),l(Y,null,J(U.value,t=>(o(),l("option",{key:t.id,value:t.id},r(t.name)+" ("+r(t.system)+") "+r(t.isPublic?"[Pública]":"[Minha]"),9,Lo))),128))])):b("",!0)],512),[[je,n.value.customNpcSheetId]])])])])):b("",!0),m.value&&d.value?(o(),l("div",Eo,[e("h3",Bo,r(s.$t("create_campaign.players_title")),1),u.value.length>0?(o(),l("ul",jo,[(o(!0),l(Y,null,J(u.value,t=>(o(),l("li",{key:t.uid,class:G(["flex items-center justify-between p-3 rounded-lg border transition-all",k(t.uid)?"bg-amber-950/20 border-amber-500/30":"bg-gray-900/50 border-gray-800"])},[e("div",To,[t.photoURL?(o(),l("img",{key:0,src:t.photoURL,class:G(["h-8 w-8 rounded-full object-cover",{"opacity-50 grayscale":k(t.uid)}]),alt:t.displayName},null,10,Ho)):(o(),l("div",Vo,a[33]||(a[33]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"
1currentColor",class:"w-5 h-5"},[e("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"})],-1)]))),e("div",Do,[e("span",{class:G(["font-medium",k(t.uid)?"text-gray-400 line-through":"text-gray-200"])},r(t.displayName),3),n.value.ownerId===t.uid?(o(),l("span",Fo,r(s.$t("campaigns.role_dm")),1)):n.value.dms.includes(t.uid)?(o(),l("span",No,r(s.$t("campaigns.role_dm")),1)):b("",!0),e("span",{class:G(["w-2.5 h-2.5 rounded-full inline-block shrink-0 shadow-sm transition-all",k(t.uid)?"bg-amber-400 shadow-amber-500/50":"bg-emerald-400 shadow-emerald-500/50"]),title:k(t.uid)?s.$t("create_campaign.player_disabled_tooltip"):s.$t("create_campaign.player_active_tooltip")},null,10,qo)])]),n.value.ownerId!==t.uid&&d.value?(o(),l("div",Uo,[e("button",{type:"button",onClick:K(v=>R(t.uid),["prevent"]),class:G(["p-1.5 rounded-lg text-xs font-bold transition-all flex items-center justify-center border cursor-pointer select-none",k(t.uid)?"bg-emerald-950/60 text-emerald-400 border-emerald-500/40 hover:bg-emerald-900/80 hover:text-emerald-300":"bg-amber-950/60 text-amber-400 border-amber-500/40 hover:bg-amber-900/80 hover:text-amber-300"]),title:k(t.uid)?s.$t("create_campaign.enable_player_tooltip"):s.$t("create_campaign.disable_player_tooltip")},[k(t.uid)?(o(),l("span",Wo,"add")):(o(),l("span",Ko,"block"))],10,Ro),e("button",{onClick:K(v=>g(t.uid),["prevent"]),class:"p-1.5 rounded-lg text-red-400 hover:bg-red-500/20 transition-colors",title:s.$t("create_campaign.remove_player_tooltip")},a[34]||(a[34]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"})],-1)]),8,Oo)])):b("",!0)],2))),128))])):(o(),l("p",Zo,r(s.$t("create_campaign.no_players")),1))])):b("",!0)]),e("div",Go,[e("button",{type:"button",onClick:a[9]||(a[9]=t=>s.$emit("close")),class:"btn-secondary"},r(s.$t("create_campaign.cancel")),1),e("button",{type:"submit",disabled:P.value,class:"btn-primary"},r(y.value),9,Qo)])],32)],32),oe.value?(o(),l("div",{key:0,class:"fixed inset-0 bg-black/95 z-[130] flex items-center justify-center p-8 animate-in fade-in zoom-in duration-200",onClick:a[16]||(a[16]=K(t=>oe.value=!1,["self"]))},[e("div",Xo,[e("button",{onClick:a[15]||(a[15]=t=>oe.value=!1),class:"absolute top-6 right-6 text-gray-500 hover:text-white transition-colors h-10 w-10 flex items-center justify-center bg-gray-800 rounded-full"},a[35]||(a[35]=[e("span",{class:"material-icons"},"close",-1)])),e("h2",Jo,r(s.$t("create_campaign.systems_modal_title")),1),e("p",Yo,r(s.$t("create_campaign.systems_modal_desc")),1),e("div",ea,[e("div",ta,[(o(!0),l(Y,null,J(L.value,t=>{var v,w;return o(),l("div",{key:t.uniqueKey,onClick:E=>ce(t),class:G(["aspect-[4/5] rounded-2xl border-2 cursor-pointer transition-all flex flex-col overflow-hidden bg-gray-900 relative group/sys",ne(t)?"border-purple-500 bg-purple-500/10":"border-gray-800 hover:border-gray-700"])},[e("div",oa,[e("div",{class:"absolute inset-0 w-full h-full flex flex-col items-center justify-center transition-all",style:be({backgroundColor:t.bgColor||t.color||i(t.id),backgroundImage:t.bgImage?`url(${t.bgImage})`:"none",backgroundSize:"cover",backgroundPosition:"center"})},a[36]||(a[36]=[e("div",{class:"absolute inset-0 bg-black/30 group-hover/sys:bg-black/10 transition-colors"},null,-1)]),4),t.thumbnail&&!le.value.has(t.uniqueKey)?(o(),l("div",aa,[e("img",{src:t.thumbnail,onError:E=>X(t.uniqueKey),class:"pointer-events-none drop-shadow-lg transition-transform duration-500 group-hover/sys:scale-110 max-h-full max-w-full object-contain",style:be({transform:`translate(${(v=t.imagePosition)!=null&&v.x?t.imagePosition.x*.4:0}px, ${(w=t.imagePosition)!=null&&w.y?t.imagePosition.y*.4:0}px) scale(${t.imageScale||1})`})},null,44,la)])):(o(),l("span",ra,r(t.label.substring(0,2)),1)),a[37]||(a[37]=e("div",{class:"absolute inset-0 bg-gradient-to-t from-gray-900/80 via-trans
1parent to-transparent pointer-events-none"},null,-1))]),e("div",na,[e("div",null,[e("div",ia,r(t.label),1),e("div",da,r(t.id),1)]),ne(t)?(o(),l("div",ca,r(s.$t("create_campaign.selected")),1)):b("",!0)])],10,sa)}),128))])])])])):b("",!0)],32)]))}},pa=De(ua,[["__scopeId","data-v-a63ebad2"]]),va={class:"w-full flex-grow p-4 md:p-8 font-sans"},ga={class:"max-w-7xl mx-auto"},ma={class:"flex flex-wrap md:flex-nowrap justify-between items-end gap-4 mb-6"},ba={class:"text-3xl font-bold text-white"},fa={class:"flex flex-wrap items-center gap-4 shrink-0"},ha=["disabled","title"],ya={class:"hidden md:inline"},xa={key:0,class:"absolute inset-0 bg-red-600/80 flex items-center justify-center rounded-xl"},wa=["title"],_a={class:"hidden md:inline"},ka={class:"flex items-center justify-between gap-4 mb-6 border-b border-gray-800 pb-4"},$a={class:"relative w-full md:w-64"},Ca={key:0,class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-6"},Sa={key:1,class:"text-center text-gray-400 bg-gray-800/50 p-8 rounded-lg"},Ma={class:"mt-2"},za={key:2,class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-6 items-start"},Ia={class:"flex-grow flex flex-col"},Aa={class:"flex items-baseline gap-2 pr-16 border-b border-gray-700 pb-1 mb-3"},Pa={class:"text-2xl font-bold text-white border-0"},La={class:"text-sm text-gray-400 mt-1"},Ea={key:0},Ba={key:0},ja={class:"text-gray-300 mt-4 text-sm break-words inline"},Ta=["onClick"],Ha={key:1},Va={class:"mt-4 max-h-32 overflow-y-auto pr-2 scrollbar-thin scrollbar-thumb-gray-600 scrollbar-track-gray-800 bg-gray-900/30 rounded p-2 border border-gray-700/50"},Da={class:"text-gray-300 text-sm whitespace-pre-wrap break-words"},Fa=["onClick"],Na=["onClick"],qa={class:"text-sm mb-0"},Ua={class:"font-semibold text-gray-300"},Ra={class:"font-bold text-fuchsia-300"},Wa={class:"mt-4"},Ka={class:"items-center gap-4 pl-4 -mr-2 box-border mt-auto pt-6"},Oa={class:"flex flex-row gap-2 justify-center"},Za={class:"relative group"},Ga=["onClick"],Qa={class:"absolute bottom-full mb-2 px-3 py-1.5 text-sm font-semibold text-white bg-gray-900/80 rounded-md shadow-lg whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-50 left-1/2 -translate-x-1/2"},Xa={class:"relative group"},Ja=["onClick"],Ya={class:"absolute bottom-full mb-2 px-3 py-1.5 text-sm font-semibold text-white bg-gray-900/80 rounded-md shadow-lg whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-50 left-1/2 -translate-x-1/2"},el={class:"relative group"},tl=["onClick","disabled"],sl={key:0,xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},ol={key:1,class:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},al={class:"absolute bottom-full mb-2 px-3 py-1.5 text-sm font-semibold text-white bg-gray-900/80 rounded-md shadow-lg whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-50 left-1/2 -translate-x-1/2"},ll={class:"relative group"},rl=["onClick"],nl={class:"absolute bottom-full mb-2 px-3 py-1.5 text-sm font-semibold text-white bg-gray-900/80 rounded-md shadow-lg whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-50 left-1/2 -translate-x-1/2"},il={class:"relative group"},dl=["onClick","disabled"],cl={key:0,xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},ul={key:1,class:"animate-spin h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},pl={class:"absolute bottom-full mb-2 px-3 py-1.5 text-sm font-semibold text-white bg-gray-900/80 rounded-md shadow-lg whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-50 left-1/2 -translate-x-1/2"},vl={key:3,class:"mt-12"},gl={class:"text-2xl font-bold text-white mb-4"},ml={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"},bl={class:"flex-grow flex flex-col"},fl={class:"text-2xl font-bold text-white pr-16"},hl={class:"text-sm text-gray-400 mt-1"},yl={key:0},xl={key:0},wl={class:"text-gray-300 mt-4 text-sm break-words inline"},_l=["onClick"],kl={key:1},$l={class:"mt-4 max-h-32 overflow-y-auto pr-2 scrollbar-thin scrollbar-thumb-gray-600 scrollbar-track-gray-800 bg-gray-900/30 rounded p-2 border border-gray-700/50"},Cl={class:"text-gray-300 text-sm whitespace-pre-wrap break-words"},Sl=["onClick"],Ml={class:"mt-auto pt-6 flex justify-end"},zl={class:"relative group"},Il=["onClick"],Al={class:"absolute bottom-full mb-2 px-3 py-1.5 text-sm font-semibold text-white bg-gray-900/80 rounded-md shadow-lg whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-50 left-1/2 -translate-x-1/2"},Tl={__name:"Campaigns",setup(ee){const{userProfile:N}=Pe(),{t:_,locale:B}=_e({useScope:"global"}),T=h([]),q=h(!0),x=h(!1),A=h(null);let S=null;const P=h({}),C=h({}),j=h(null),$=h(null),{addNotification:n}=Ne(),{showConfirmation:H}=Le();et();const Q=h(!1),D=h(""),V=(i,u)=>!i||i.length<=u?i:i.substring(0,u).trim(),W=i=>{C.value[i]=!C.value[i]},se=Z(()=>{let i=T.value.filter(u=>u.status!=="archived");if(D.value){const u=D.value.toLowerCase();i=i.filter(d=>{var p,c;return((p=d.name)==null?void 0:p.toLowerCase().includes(u))||((c=d.description)==null?void 0:c.toLowerCase().includes(u))})}return i.sort((u,d)=>{var I,g,k,R,s,a;const p=((I=u.lastPlayedAt)==null?void 0:I.seconds)||((g=u.createdAt)==null?void 0:g.seconds)||0,c=((k=d.lastPlayedAt)==null?void 0:k.seconds)||((R=d.createdAt)==null?void 0:R.seconds)||0;return c!==p?c-p:(((s=d.createdAt)==null?void 0:s.seconds)||0)-(((a=u.createdAt)==null?void 0:a.seconds)||0)})}),oe=Z(()=>{let i=T.value.filter(u=>u.status==="archived");if(D.value){const u=D.value.toLowerCase();i=i.filter(d=>{var p,c;return((p=d.name)==null?void 0:p.toLowerCase().includes(u))||((c=d.description)==null?void 0:c.toLowerCase().includes(u))})}return i}),le=i=>{S&&S(),S=Je(i,u=>{[...u].sort((p,c)=>{var k,R,s,a,t,v;const I=((k=p.lastPlayedAt)==null?void 0:k.seconds)||((R=p.createdAt)==null?void 0:R.seconds)||0,g=((s=c.lastPlayedAt)==null?void 0:s.seconds)||((a=c.createdAt)==null?void 0:a.seconds)||0;return g!==I?g-I:(((t=c.createdAt)==null?void 0:t.seconds)||0)-(((v=p.createdAt)==null?void 0:v.seconds)||0)}
1).forEach((p,c)=>{P.value[p.id]===void 0&&(P.value[p.id]=c===0)}),T.value=u,q.value=!1})};ke(()=>{N.value&&le(N.value.uid)}),de(N,i=>{i&&i.uid?le(i.uid):(S&&S(),T.value=[],q.value=!0)}),$e(()=>{S&&S()});const te=()=>{A.value=null,x.value=!0},re=i=>{A.value=i,x.value=!0},f=()=>{x.value=!1,A.value=null},m=i=>N.value&&i.dms.includes(N.value.uid),y=i=>N.value&&i.ownerId===N.value.uid,z=async i=>{if(await H({title:_("campaigns.delete_confirm_title"),message:_("campaigns.delete_confirm_message"),confirmButtonText:_("campaigns.delete_tooltip")}))try{$.value=i,await st(i),n({message:_("campaigns.notifications.delete_success"),type:"success"})}catch(d){console.error("Erro ao apagar campanha:",d),n({message:_("campaigns.notifications.delete_error"),type:"error"})}finally{$.value=null}},L=async i=>{if(await H({title:_("campaigns.leave_confirm_title"),message:_("campaigns.leave_confirm_message"),confirmButtonText:_("common.logout")})&&N.value){j.value=i;try{await tt(i),n({message:_("campaigns.notifications.leave_success"),type:"success"})}catch(d){console.error("Erro ao sair da campanha:",d),n({message:_("campaigns.notifications.leave_error",{error:d.message}),type:"error"})}finally{j.value=null}}},M=i=>i?new Date(i.seconds*1e3).toLocaleDateString(B.value):_("campaigns.no_date"),U=i=>{P.value[i]=!P.value[i]},X=i=>{const u=Date.now(),d=`${window.location.origin}/invite/${i}?t=${u}`;navigator.clipboard.writeText(d).then(()=>{n({message:_("campaigns.notifications.invite_copied"),type:"success"})})},ne=async i=>{const u=i.status==="archived"?"active":"archived";try{await pe(i.id,{status:u}),n({message:_(u==="archived"?"campaigns.notifications.archived_success":"campaigns.notifications.restored_success"),type:"success"})}catch(d){console.error("Erro ao atualizar status da campanha:",d),n({message:_("campaigns.notifications.update_error"),type:"error"})}},ce=async()=>{if(!Me.currentUser){n({message:"Você precisa estar logado para criar uma aventura.",type:"warning"});return}Q.value=!0;try{const i=Me.currentUser.uid,u=Me.currentUser,d=he(ye,"campaigns"),p=fe(d,Te("ownerId","==",i),Te("name","==","Rouguelike"),ze(1)),c=await xe(p);if(!c.empty){const k=c.docs[0];await pe(k.id,{lastPlayedAt:He()}),n({message:"Sua campanha Roguelike já existe e foi movida para o topo!",type:"info"});return}const I=await Fe({name:"Rouguelike",description:"Campanha para aventuras Roguelike.",system:"dnd",players:[i],dms:[i],ownerId:i},u),g=await Ye(I,{name:"Covil",description:"Minha aventura Roguelike pessoal.",type:"roguelike",system:"dnd",creatorId:i,isEnabled:!0,config:{linkedCharacters:[],enemyPool:[],initialDifficulty:1,selectedActionLists:["attacks","spells","magias","ataques"]}});await pe(I,{lastPlayedAt:He()}),window.location.href=`/tabletop/${I}/${g}`}catch(i){console.error("Erro ao criar aventura:",i),n({message:"Erro ao criar aventura Roguelike.",type:"error"})}finally{Q.value=!1}};return(i,u)=>(o(),l("div",va,[e("div",ga,[e("div",ma,[e("div",null,[e("h1",ba,r(i.$t("common.campaigns")),1),u[1]||(u[1]=e("p",{class:"text-sm text-gray-400 mt-1"},"Gerencie suas campanhas e aventuras.",-1))]),e("div",fa,[e("button",{onClick:ce,disabled:Q.value,class:"group relative px-3 md:px-6 py-2.5 bg-red-600 hover:bg-red-500 text-white rounded-xl font-bold flex items-center gap-2 shadow-[0_0_15px_rgba(220,38,38,0.3)] transition-all hover:scale-105 active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",title:i.$t("common.roguelike_creation_button")},[ge(at,{icon:"skull",class:"w-5 h-5 flex-shrink-0"}),e("span",ya,r(i.$t("common.roguelike_creation_button")||"Roguelike"),1),Q.value?(o(),l("span",xa,u[2]||(u[2]=[e("svg",{class:"animate-spin h-5 w-5 text-white",viewBox:"0 0 24 24"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4",fill:"none"}),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})],-1)]))):b("",!0)],8,ha),e("button",{onClick:te,class:"btn-primary flex justify-between items-center gap-2 py-2.5 px-3 md:px-6",title:i.$t("campaigns.create_button")},[u[3]||(u[3]=Se('<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.67239 7.54199H15.3276C18.7024 7.54199 20.3898 7.54199 21.337
17 8.52882C22.2855 9.51565 22.0625 11.0403 21.6165 14.0895L21.1935 16.9811C20.8437 19.3723 20.6689 20.5679 19.7717 21.2839C18.8745 21.9999 17.5512 21.9999 14.9046 21.9999H9.09536C6.44881 21.9999 5.12553 21.9999 4.22834 21.2839C3.33115 20.5679 3.15626 19.3723 2.80648 16.9811L2.38351 14.0895C1.93748 11.0403 1.71447 9.51565 2.66232 8.52882C3.61017 7.54199 5.29758 7.54199 8.67239 7.54199ZM8 18.0001C8 17.5859 8.3731 17.2501 8.83333 17.2501H15.1667C15.6269 17.2501 16 17.5859 16 18.0001C16 18.4143 15.6269 18.7501 15.1667 18.7501H8.83333C8.3731 18.7501 8 18.4143 8 18.0001Z" fill="#FFFFFF"></path><rect x="7" y="10" width="10" height="10" fill="white"></rect><g opacity="0.4"><path d="M8.51005 2.00001H15.4901C15.7226 1.99995 15.9009 1.99991 16.0567 2.01515C17.1645 2.12352 18.0712 2.78958 18.4558 3.68678H5.54443C5.92895 2.78958 6.83570 2.12352 7.94352 2.01515C8.09933 1.99991 8.27757 1.99995 8.51005 2.00001Z" fill="#FFFFFF"></path></g><g opacity="0.7"><path d="M6.31069 4.72266C4.92007 4.72266 3.77980 5.56241 3.39927 6.67645C3.39134 6.69967 3.38374 6.72302 3.37646 6.74647C3.77461 6.62590 4.18898 6.54713 4.60845 6.49336C5.68882 6.35485 7.05416 6.35492 8.64019 6.35501L8.75863 6.35501L15.5323 6.35501C17.1183 6.35492 18.4837 6.35485 19.5640 6.49336C19.9835 6.54713 20.3979 6.62590 20.7960 6.74647C20.7887 6.72302 20.7811 6.69967 20.7732 6.67645C20.3927 5.56241 19.2524 4.72266 17.8618 4.72266H6.31069Z" fill="#FFFFFF"></path></g><text x="50%" y="65%" dominant-baseline="middle" text-anchor="middle" font-size="14" fill="oklch(62.7% 0.265 303.9)">+</text></svg>',1)),e("span",_a,r(i.$t("campaigns.create_button")),1)],8,wa)])]),e("div",ka,[e("div",$a,[u[4]||(u[4]=e("span",{class:"material-icons absolute left-3 top-1/2 -translate-y-1/2 text-gray-500 text-[18px]"},"search",-1)),ie(e("input",{"onUpdate:modelValue":u[0]||(u[0]=d=>D.value=d),type:"text",class:"w-full bg-gray-900/60 border border-gray-700 rounded-xl py-2 pl-9 pr-4 text-sm text-gray-200 focus:outline-none focus:border-purple-500/50 focus:ring-1 focus:ring-purple-500/50 transition-all placeholder-gray-500 shadow-inner",placeholder:"Buscar campanha..."},null,512),[[ve,D.value]])])]),q.value?(o(),l("div",Ca,[(o(),l(Y,null,J(4,d=>
1e("div",{key:d,class:"card-bg relative flex flex-col gap-4 rounded-2xl border border-gray-700/50 bg-gray-800/60 p-6 shadow-lg backdrop-blur-lg animate-pulse"},u[5]||(u[5]=[Se('<div class="flex items-center gap-3 border-b border-gray-700 pb-4 mb-2"><div class="w-12 h-12 rounded-full bg-gray-700"></div><div class="flex-grow space-y-2"><div class="h-6 bg-gray-700 rounded w-3/4"></div><div class="h-3 bg-gray-700 rounded w-1/3"></div></div></div><div class="space-y-2"><div class="h-3 bg-gray-700 rounded w-full"></div><div class="h-3 bg-gray-700 rounded w-5/6"></div><div class="h-3 bg-gray-700 rounded w-4/6"></div></div><div class="mt-2 h-10 bg-gray-700/50 rounded-lg w-full"></div><div class="flex -space-x-2 mt-2"><div class="w-8 h-8 rounded-full bg-gray-700 border-2 border-gray-800"></div><div class="w-8 h-8 rounded-full bg-gray-700 border-2 border-gray-800"></div><div class="w-8 h-8 rounded-full bg-gray-700 border-2 border-gray-800"></div></div><div class="mt-auto pt-6 flex justify-center gap-2"><div class="w-10 h-10 rounded-full bg-gray-700"></div><div class="w-10 h-10 rounded-full bg-gray-700"></div><div class="w-10 h-10 rounded-full bg-gray-700"></div></div>',5)]))),64))])):b("",!0),!q.value&&T.value.length===0?(o(),l("div",Sa,[e("p",null,r(i.$t("campaigns.no_campaigns")),1),e("p",Ma,r(i.$t("campaigns.create_first_hint")),1)])):b("",!0),q.value?b("",!0):(o(),l("div",za,[(o(!0),l(Y,null,J(se.value,d=>(o(),l("div",{key:d.id,class:"card-bg relative flex flex-col gap-4 roun
1ded-2xl border border-gray-700/50 bg-gray-800/60 p-6 shadow-lg backdrop-blur-lg transition-all hover:border-purple-400/50 hover:scale-105"},[e("span",{class:G([m(d)?"bg-purple-500/30 text-purple-300":"bg-blue-500/30 text-blue-300","absolute top-4 right-4 text-xs font-semibold px-2 py-1 rounded-full z-10"])},r(m(d)?i.$t("campaigns.role_dm"):i.$t("campaigns.role_player")),3),e("div",Ia,[e("div",Aa,[u[6]||(u[6]=Se('<svg class="h-6 w-6 text-white flex-shrink-0" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.67239 7.54199H15.3276C18.7024 7.54199 20.3898 7.54199 21.3377 8.52882C22.2855 9.51565 22.0625 11.0403 21.6165 14.0895L21.1935 16.9811C20.8437 19.3723 20.6689 20.5679 19.7717 21.2839C18.8745 21.9999 17.5512 21.9999 14.9046 21.9999H9.09536C6.44881 21.9999 5.12553 21.9999 4.22834 21.2839C3.33115 20.5679 3.15626 19.3723 2.80648 16.9811L2.38351 14.0895C1.93748 11.0403 1.71447 9.51565 2.66232 8.52882C3.61017 7.54199 5.29758 7.54199 8.67239 7.54199ZM8 18.0001C8 17.5859 8.3731 17.2501 8.83333 17.2501H15.1667C15.6269 17.2501 16 17.5859 16 18.0001C16 18.4143 15.6269 18.7501 15.1667 18.7501H8.83333C8.3731 18.7501 8 18.4143 8 18.0001Z"></path><g opacity="0.4"><path d="M8.51005 2.00001H15.4901C15.7226 1.99995 15.9009 1.99991 16.0567 2.01515C17.1645 2.12352 18.0712 2.78958 18.4558 3.68678H5.54443C5.92895 2.78958 6.83570 2.12352 7.94352 2.01515C8.09933 1.99991 8.27757 1.99995 8.51005 2.00001Z"></path></g><g opacity="0.7"><path d="M6.31069 4.72266C4.92007 4.72266 3.77980 5.56241 3.39927 6.67645C3.39134 6.69967 3.38374 6.72302 3.37646 6.74647C3.77461 6.62590 4.18898 6.54713 4.60845 6.49336C5.68882 6.35485 7.05416 6.35492 8.64019 6.35501L8.75863 6.35501L15.5323 6.35501C17.1183 6.35492 18.4837 6.35485 19.5640 6.49336C19.9835 6.54713 20.3979 6.62590 20.7960 6.74647C20.7887 6.72302 20.7811 6.69967 20.7732 6.67645C20.3927 5.56241 19.2524 4.72266 17.8618 4.72266H6.31069Z"></path></g></svg>',1)),e("h2",Pa,r(d.name),1)]),e("p",La,r(i.$t("campaigns.created_at",{date:M(d.createdAt)})),1),d.description?(o(),l("div",Ea,[C.value[d.id]?(o(),l("div",Ha,[e("div",Va,[e("p",Da,r(d.description),1)]),e("button",{onClick:p=>W(d.id),class:"text-purple-400 hover:text-purple-300 text-xs mt-2 font-semibold flex items-center gap-1"},[O(r(i.$t("campaigns.read_less"))+" ",1),u[8]||(u[8]=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3 w-3 rotate-180",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1))],8,Fa)])):(o(),l("div",Ba,[e("p",ja,[O(r(V(d.description,50))+r(d.description.length>50?"...":"")+" ",1),d.description.length>50?(o(),l("button",{key:0,onClick:p=>W(d.id),class:"text-purple-400 hover:text-purple-300 text-xs font-semibold inline-flex items-center gap-1 ml-1 align-baseline"},[O(r(i.$t("campaigns.read_more"))+" ",1),u[7]||(u[7]=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3 w-3",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1))],8,Ta)):b("",!0)])]))])):b("",!0),e("div",{onClick:p=>re(d),class:"mt-4 flex items-center gap-3 rounded-lg bg-gray-900/50 p-3 border border-gray-700 cursor-pointer hover:border-fuchsia-400/50 transition-colors"},[u[10]||(u[10]=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6 text-fuchsia-300 flex-shrink-0",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z","clip-rule":"evenodd"})],-1)),e("p",qa,[e("span",Ua,r(i.$t("campaigns.next_session")),1),u[9]||(u[9]=O()),e("span",Ra,r(d.nextSession||i.$t("campaigns.no_date")),1)])],8,Na),e("div",Wa,[ge(Bs,{playerIds:d.players,disabledPlayerIds:d.disabledPlayers||[]},null,8,["playerIds","disabledPlayerIds"])]),ge(Ms,{campaignId:d.id,dms:d.dms,"is-expanded":!!P.value[d.id],onToggleExpanded:p=>U(d.id)},null,8,["campaignId","dms","is-expanded","onToggleExpanded"]),e("div",Ka,[e("div",Oa,[e("div",Za,[m(d)?(o(),l("button",{key:0,onClick:p=>re(d),class:"p-3 rounded-full bg-gray-700/80 text-white hover:bg-gray-600 transition-colors"},u[11]||(u[11]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{d:"M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z"}),e("path",{"fill-rule":"evenodd",d:"M2 6a2 2 0 012-2h4a1 1 0 010 2H4v10h10v-4a1 1 0 112 0v4a2 2 0 01-2 2H4a2 2 0 01-2-2V6z","clip-rule":"evenodd"})],-1)]),8,Ga)):b("",!0),e("span",Qa,r(i.$t("campaigns.edit_tooltip")),1)]),e("div",Xa,[e("button",{onClick:p=>X(d.id),class:"p-3 rounded-full bg-gray-700/80 text-white hover:bg-gray-600 transition-colors"},u[12]||(u[12]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M12.586 4.586a2 2 0 112.828 2.828l-3 3a2 2 0 01-2.828 0 1 1 0 00-1.414 1.414 4 4 0 005.656 0l3-3a4 4 0 00-5.656-5.656l-1.5 1.5a1 1 0 101.414 1.414l1.5-1.5zm-5 5a2 2 0 012.828 0 1 1 0 101.414-1.414 4 4 0 00-5.656 0l-3 3a4 4 0 105.656 5.656l1.5-1.5a1 1 0 10-1.414-1.414l-1.5 1.5a2 2 0 11-2.828-2.828l3-3z","clip-rule":"evenodd"})],-1)]),8,Ja),e("span",Ya,r(i.$t("campaigns.copy_invite_tooltip")),1)]),e("div",el,[y(d)?b("",!0):(o(),l("button",{key:0,onClick:p=>L(d.id),disabled:j.value===d.id,class:"p-3 rounded-full bg-red-900/50 text-red-300 hover:bg-red-800/80 hover:text-white transition-colors border border-red-900/50 disabled:opacity-50 disabled:cursor-wait"},[j.value!==d.id?(o(),l("svg",sl,u[13]||(u[13]=[e("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"},null,-1),e("polyline",{points:"16 17 21 12 16 7"},null,-1),e("line",{x1:"21",y1:"12",x2:"9",y2:"12"},null,-1)]))):(o(),l("svg",ol,u[14]||(u[14]=[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},null,-1)])))],8,tl)),e("span",al,r(j.value===d.id?i.$t("campaigns.leaving"):i.$t("campaigns.leave_tooltip")),1)]),e("div",ll,[y(d)?(o(),l("button",{key:0,onClick:p=>ne(d),class:"p-3 rounded-full bg-gray-700/80 text-white hover:bg-gray-600 transition-colors"},u[15]||(u[15]=[e("svg",{class:"h-5 w-5",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 256 256","enable-background":"new 0 0 256 256","xml:space":"preserve"},[e("g",null,[e("g",null,[e("path",{fill:"currentColor",d:"M155.2,118.9c0-2.5-0.9-4.6-2.7-6.4c-1.8-1.8-3.9-2.7-6.4-2.7h-36.3c-2.5,0-4.6,0.9-6.4,2.7c-1.8,1.8-2.7,3.9-2.7,6.4c0,2.5,
10.9,4.6,2.7,6.4c1.8,1.8,3.9,2.7,6.4,2.7h36.3c2.5,0,4.6-0.9,6.4-2.7C154.3,123.5,155.2,121.4,155.2,118.9z M236.9,91.7v136.2c0,2.5-0.9,4.6-2.7,6.4c-1.8,1.8-3.9,2.7-6.4,2.7H28.2c-2.5,0-4.6-0.9-6.4-2.7c-1.8-1.8-2.7-3.9-2.7-6.4V91.7c0-2.5,0.9-4.6,2.7-6.4c1.8-1.8,3.9-2.7,6.4-2.7h199.7c2.5,0,4.6,0.9,6.4,2.7C236,87.1,236.9,89.2,236.9,91.7z M246,28.2v36.3c0,2.5-0.9,4.6-2.7,6.4c-1.8,1.8-3.9,2.7-6.4,2.7H19.1c-2.5,0-4.6-0.9-6.4-2.7C10.9,69,10,66.9,10,64.5V28.2c0-2.5,0.9-4.6,2.7-6.4s3.9-2.7,6.4-2.7h217.8c2.5,0,4.6,0.9,6.4,2.7S246,25.7,246,28.2z"})])])],-1)]),8,rl)):b("",!0),e("span",nl,r(i.$t("campaigns.archive_tooltip")),1)]),e("div",il,[y(d)?(o(),l("button",{key:0,onClick:p=>z(d.id),disabled:$.value===d.id,class:"p-3 rounded-full bg-red-800/80 text-white hover:bg-red-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},[$.value!==d.id?(o(),l("svg",cl,u[16]||(u[16]=[e("path",{"fill-rule":"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"},null,-1)]))):(o(),l("svg",ul,u[17]||(u[17]=[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},null,-1)])))],8,dl)):b("",!0),e("span",pl,r($.value===d.id?i.$t("campaigns.deleting"):i.$t("campaigns.delete_tooltip")),1)])])])])]))),128))])),!q.value&&oe.value.length>0?(o(),l("div",vl,[e("h2",gl,r(i.$t("campaigns.archived_campaigns_title")),1),e("div",ml,[(o(!0),l(Y,null,J(oe.value,d=>(o(),l("div",{key:d.id,class:"card-bg relative flex gap-4 rounded-2xl border border-gray-800 bg-gray-900/50 p-6 shadow-lg backdrop-blur-lg transition-all hover:border-purple-400/50 opacity-60 hover:opacity-100"},[e("span",{class:G([m(d)?"bg-purple-500/30 text-purple-300":"bg-blue-500/30 text-blue-300","absolute top-4 right-4 text-xs font-semibold px-2 py-1 rounded-full z-10"])},r(m(d)?i.$t("campaigns.role_dm"):i.$t("campaigns.role_player")),3),e("div",bl,[e("h2",fl,r(d.name),1),e("p",hl,r(i.$t("campaigns.created_at",{date:M(d.createdAt)})),1),d.description?(o(),l("div",yl,[C.value[d.id]?(o(),l("div",kl,[e("div",$l,[e("p",Cl,r(d.description),1)]),e("button",{onClick:p=>W(d.id),class:"text-purple-400 hover:text-purple-300 text-xs mt-2 font-semibold flex items-center gap-1"},[O(r(i.$t("campaigns.read_less"))+" ",1),u[19]||(u[19]=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3 w-3 rotate-180",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"}
1)],-1))],8,Sl)])):(o(),l("div",xl,[e("p",wl,[O(r(V(d.description,50))+r(d.description.length>50?"...":"")+" ",1),d.description.length>50?(o(),l("button",{key:0,onClick:p=>W(d.id),class:"text-purple-400 hover:text-purple-300 text-xs font-semibold inline-flex items-center gap-1 ml-1 align-baseline"},[O(r(i.$t("campaigns.read_more"))+" ",1),u[18]||(u[18]=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3 w-3",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1))],8,_l)):b("",!0)])]))])):b("",!0),e("div",Ml,[e("div",zl,[y(d)?(o(),l("button",{key:0,onClick:p=>ne(d),class:"p-3 rounded-full bg-green-800/80 text-white hover:bg-green-700 transition-colors"},u[20]||(u[20]=[e("svg",{class:"h-5 w-5",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 256 256","enable-background":"new 0 0 256 256","xml:space":"preserve"},[e("g",null,[e("g",null,[e("path",{fill:"currentColor",d:"M37.6,36.4h180.7L206,22.9H48.7L37.6,36.4z M128,95.4l-71.9,71.9h45.5v26.4h52.9v-26.4h45.5L128,95.4z M239.9,38.9c4.1,4.9,6.1,10.7,6.1,17.2v163.5c0,7-2.7,13.1-8,18.4c-5.3,5.3-11.5,8-18.4,8H36.4c-7.4,0-13.6-2.7-18.8-8c-5.1-5.3-7.7-11.4-7.7-18.4V56.1c0-6.6,2-12.3,6.1-17.2L34,17.4c4.1-4.9,9.2-7.4,15.4-7.4h157.3c6.1,0,11.3,2.5,15.4,7.4L239.9,38.9z"})])])],-1)]),8,Il)):b("",!0),e("span",Al,r(i.$t("campaigns.restore_tooltip")),1)])])])]))),128))])])):b("",!0)]),(o(),ue(Ae,{to:"body"},[x.value?(o(),ue(pa,{key:0,campaignToEdit:A.value,onClose:f},null,8,["campaignToEdit"])):b("",!0)]))]))}};export{Tl 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.