1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3023],{73023:function(e,t,s){s.r(t),s.d(t,{ActionList:function(){return w}});var o=s(57437),a=s(2265),n=s(47079),l=s(62869),i=s(35974),c=s(53417),r=s(33276);let d=(0,s(39763).Z)("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var u=s(96362),p=s(30401),m=s(61476),h=s(8883);function w(e){let{companion:t,walletAddress:s,onActionComplete:w,expanded:f=!1}=e,[y,g]=(0,a.useState)([]),[v,x]=(0,a.useState)(!0),[b,j]=(0,a.useState)(!1);(0,a.useEffect)(()=>{(async()=>{if(x(!0),j(!0),s)try{var e,o,a,n,l;let i=await fetch("/api/quests/status?wallet_address=".concat(s),{cache:"no-store"}),c=await i.json(),r=(null===(e=c.completed)||void 0===e?void 0:e[t.slug])||[],d=(null===(o=c.completed)||void 0===o?void 0:o.global)||[];console.log("[action-list] Completed quests for ".concat(t.slug,":"),r),console.log("[action-list] Global completed quests:",d);let u=(t.actions||[]).filter(e=>{let s="".concat(t.slug,"_").concat(e.type),o="global_".concat(e.type);return r.includes(s)||d.includes(o)}).map(e=>e.type);g(u);let p=(t.actions||[]).find(e=>"join_discord"===e.type);if(p&&!u.includes("join_discord")&&s){let e=(null===(a=p.invite)||void 0===a?void 0:a.includes("discord.com/invite/cultverse"))?"global":t.slug;try{let o=await fetch("/api/quests/discord/join",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wallet_address:s,companion_slug:e})});if(o.ok){let a=await o.json();if(a.ok){console.log("[action-list] Auto-completed Discord for ".concat(e));let o=await fetch("/api/quests/status?wallet_address=".concat(s),{cache:"no-store"});if(o.ok){let e=await o.json(),s=(null===(n=e.completed)||void 0===n?void 0:n[t.slug])||[],a=(null===(l=e.completed)||void 0===l?void 0:l.global)||[],i=(t.actions||[]).filter(e=>{let o="".concat(t.slug,"_").concat(e.type),n="global_".concat(e.type);return s.includes(o)||a.includes(n)}).map(e=>e.type);g(i),null==w||w()}}else"link"===a.step?console.log("[action-list] User needs to connect Discord OAuth"):"invite"===a.step&&console.log("[action-list] User not in guild yet")}j(!1)}catch(e){console.error("[action-list] Auto-check Discord failed:",e),j(!1)}}else j(!1)}catch(e){console.error("[action-list] Failed to load completed actions:",e),j(!1)}else g((t.actions||[]).filter(e=>(0,h.wt)(t.slug,e.type)).map(e=>e.type)),j(!1);x(!1)})()},[t,s]);let _=async e=>{if(!y.includes(e.type)){if(!s){window.dispatchEvent&&window.dispatchEvent(new CustomEvent("toast",{detail:{title:"Wallet Required",description:"Connect your wallet to earn Gems!",type:"warning"}}));return}switch(e.type){case"follow_cultverse":window.open("https://x.com/".concat(e.handle),"_blank"),setTimeout(async()=>{try{let a=await fetch("/api/quests/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wallet_address:s,companion_slug:"global",quest_id:"global_follow_cultverse"})}),n=await a.json();if(a.ok){let a=await fetch("/api/quests/status?wallet_address=".concat(s),{cache:"no-store"});if(a.ok){var e,o;let s=await a.json(),l=(null===(e=s.completed)||void 0===e?void 0:e[t.slug])||[],i=(null===(o=s.completed)||void 0===o?void 0:o.global)||[],c=t.actions.filter(e=>{let s="".concat(t.slug,"_").concat(e.type),o="global_".concat(e.type);return l.includes(s)||i.includes(o)}).map(e=>e.type);g(c),window.dispatchEvent&&window.dispatchEvent(new CustomEvent("toast",{detail:{title:"Gems Earned!",description:"You earned ".concat(n.gems_earned||5," Gems!"),type:"success"}})),null==w||w()}}}catch(e){console.error("Failed to complete follow_cultverse quest:",e)}},2e3);break;case"follow_x":window.open("https://x.com/".concat(e.handle),"_blank"),setTimeout(async()=>{try{let o=await fetch("/api/quests/twitter/follow/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wallet_address:s,companion_slug:t.slug})}),a=await o.json();if(o.ok&&a.ok){let o=await fetch("/api/quests/status?wallet_address=".concat(s),{cache:"no-store"});if(o.ok){var e;let s=await o.json(),n=(null===(e=s.completed)||void 0===e?void 0:e[t.slug])||[],l=t.actions.filter(e=>{let s="".concat(t.slug,"_").concat(e.type);return n.includes(s)}).map(e=>e.type);g(l),window.dispatchEvent&&window.dispatchEvent(new CustomEvent("toast",{detail:{title:"Gems Earned!",description:"You earned ".concat(a.gems_earned," Gems!"),type:"success"}})),null==w||w()}}}catch(e){console.error("Failed to complete follow quest:",e)}},2e3);break;case"join_discord":var o,a,n;let l=(null===(o=e.invite)||void 0===o?void 0:o.includes("discord.com/invite/cultverse"))?"global":t.slug;try{let e=await fetch("/api/quests/discord/join",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wallet_address:s,companion_slug:l})});if(e.ok){let o=await e.json();if("link"===o.step){window.location.href=o.url;return}if("invite"===o.step){window.open(o.url,"_blank");return}if(o.ok){console.log("[action-list] Discord quest auto-completed");let e=await fetch("/api/quests/status?wallet_address=".concat(s),{cache:"no-store"});if(e.ok){let s=await e.json(),l=(null===(a=s.completed)||void 0===a?void 0:a[t.slug])||[],i=(null===(n=s.completed)||void 0===n?void 0:n.global)||[],c=(t.actions||[]).filter(e=>{let s="".concat(t.slug,"_").concat(e.type),o="global_".concat(e.type);return l.includes(s)||i.includes(o)}).map(e=>e.type);g(c),window.dispatchEvent&&window.dispatchEvent(new CustomEvent("toast",{detail:{title:"Gems Earned!",description:"You earned ".concat(o.gems_earned||5," Gems!"),type:"success"}})),null==w||w()}return}}}catch(t){console.error("[action-list] Discord join error:",t),window.open(e.invite,"_blank")}break;case"DEPRECATED_join_discord_old":setTimeout(async()=>{try{{let a=await fetch("/api/quests/discord/join",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wallet_address:s,companion_slug:t.slug})}),n=await a.json();if(a.ok&&n.ok){let a=await fetch("/api/quests/status?wallet_address=".concat(s),{cache:"no-store"});if(a.ok){var e,o;let s=await a.json(),l=(null===(e=s.completed)||void 0===e?void 0:e[t.slug])||[],i=(null===(o=s.completed)||void 0===o?void 0:o.global)||[],c=t.actions.filter(e=>{let s="".concat(t.slug,"_").concat(e.type),o="global_".concat(e.type);return l.includes(s)||i.includes(o)}).map(e=>e.type);g(c),window.dispatchEvent&&window.dispatchEvent(new CustomEvent("toast",{detail:{title:"Gems Earned!",description:"You earned ".concat(n.gems_earned," Gems!"),type:"success"}})),null==w||w()}}}}catch(e){console.error("Failed to verify Discord membership:",e)}},3e3);break;case"watch":window.open(e.url,"_blank"),setTimeout(async()=>{try{let a="".concat(t.slug,"_").concat(e.type),n=await fetch("/api/quests/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wallet_address:s,companion_slug:t.slug,quest_id:a})});if(await n.json(),n.ok){let e=await fetch("/api/quests/status?wallet_address=".concat(s),{cache:"no-store"});if(e.ok){var o;let s=await e.json(),a=(null===(o=s.completed)||void 0===o?void 0:o[t.slug])||[],n=t.actions.filter(e=>{let s="".concat(t.slug,"_").concat(e.type);return a.includes(s)}).map(e=>e.type);g(n),null==w||w()}}}catch(e){console.error("Failed to complete watch quest:",e)}},2e3);break;case"quiz":let i=prompt(e.question);if((null==i?void 0:i.toLowerCase())!==e.answer.toLowerCase()){window.dispatchEvent&&window.dispatchEvent(new CustomEvent("toast",{detail:{title:"Incorrect",description:"Try again!",type:"error"}}));return}try{let o="".concat(t.slug,"_").concat(e.type),a=await fetch("/api/quests/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wallet_address:s,companion_slug:t.slug,quest_id:o})}),n=await a.json();if(a.ok){let e=await fetch("/api/quests/status?wallet_address=".concat(s),{cache:"no-store"});if(e.ok){let s=await e.json(),o=t.actions.filter(e=>{var o,a;let n="".concat(t.slug,"_").concat(e.type);return null===(a=s.completed)||void 0===a?void 0:null===(o=a.default)||void 0===o?void 0:o.includes(n)}).map(e=>e.type);g(o),window.dispatchEvent&&window.dispatchEvent(new CustomEvent("toast",{detail:{title:"Correct!",description:"You earned ".concat(n.gems_earned," Gems!"),type:"success"}})),null==w||w()}}}catch(e){console.error("Failed to complete quiz:",e)}break;default:e.url&&window.open(e.url,"_blank");try{let o="".concat(t.slug,"_").concat(e.type);if((await fetch("/api/quests/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wallet_address:s,companion_slug:t.slug,quest_id:o})})).ok){let e=await fetch("/api/quests/status?wallet_address=".concat(s),{cache:"no-store"});if(e.ok){let s=await e.json(),o=t.actions.filter(e=>{var o,a;let n="".concat(t.slug,"_").concat(e.type);return null===(a=s.completed)||void 0===a?void 0:null===(o=a.default)||void 0===o?void 0:o.includes(n)}).map(e=>e.type);g(o),null==w||w()}}}catch(e){console.error("Failed to complete action:",e)}}}},k=e=>{switch(e){case"follow_x":case"follow_cultverse":return(0,o.jsx)("span",{className:"text-sm",children:"\uD835\uDD4F"});case"join_discord":return(0,o.jsx)(c.Z,{className:"h-4 w-4"});case"watch":return(0,o.jsx)(r.Z,{className:"h-4 w-4"});case"quiz":return(0,o.jsx)(d,{className:"h-4 w-4"});default:return(0,o.jsx)(u.Z,{className:"h-4 w-4"})}};return(0,o.jsxs)("div",{className:"bg-black/55 border border-white/20 backdrop-blur-md rounded-xl p-6",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,o.jsx)("h3",{className:"font-semibold",children:"Complete Actions"}),(0,o.jsxs)(i.C,{variant:"secondary",className:"bg-white/10 text-white border-white/20",children:[y.length,"/",(t.actions||[]).length]})]}),s&&(0,o.jsxs)("div",{className:"mb-4 p-3 bg-black/30 border border-white/10 rounded-lg",children:[(0,o.jsx)("p",{className:"text-xs text-gray-400 mb-1",children:"Connected Wallet"}),(0,o.jsxs)("p",{className:"text-xs font-mono text-white/80 mb-2",children:[s.slice(0,6),"...",s.slice(-4)]}),(0,o.jsx)("p",{className:"text-sm text-white",children:"Complete actions to earn Gems and unlock exclusive rewards!"})]}),!s&&(0,o.jsx)("div",{className:"mb-4 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:(0,o.jsx)("p",{className:"text-sm text-yellow-200",children:"\uD83D\uDCA1 Connect your wallet to earn Gems from actions!"})}),(0,o.jsxs)("div",{className:"mb-4 p-3 bg-purple500/30 border border-purple500/40 rounded-lg",children:[(0,o.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,o.jsxs)("span",{className:"flex text-sm font-medium text-white",children:[(0,o.jsx)(m.Z,{className:"w-4 h-4"}),"\xa0",(0,o.jsx)("p",{className:"-mt-0.5",children:"Gems Available"})]})}),(0,o.jsxs)("div",{className:"space-y-1 text-xs text-gray-300",children:[(0,o.jsxs)("div",{className:"flex justify-between",children:[(0,o.jsx)("span",{children:"From actions:"}),(0,o.jsxs)("span",{className:"font-semibold text-purple300",children:[5*(t.actions||[]).length," gems"]})]}),(0,o.jsx)("div",{className:"flex justify-between"}),(0,o.jsx)("div",{className:"text-xs text-gray-400 mt-2 pt-1 border-t border-white/10",children:"Earn additional 1-5 gems per message based on conversation depth"})]})]}),(0,o.jsx)("div",{className:"space-y-3",children:v?Array.from({length:3}).map((e,t)=>(0,o.jsx)("div",{className:"h-16 bg-white/5 animate-pulse rounded-lg border border-white/10"},t)):(t.actions||[]).map((e,t)=>{let s=y.includes(e.type),a=b&&"join_discord"===e.type&&!s;return(0,o.jsx)(n.E.div,{initial:{opacity:0,x:-20}
1,animate:{opacity:1,x:0},transition:{delay:.1*t},children:(0,o.jsxs)(l.z,{onClick:()=>_(e),disabled:s||a,variant:"outline",className:"w-full justify-start gap-3 h-auto p-4 ".concat(s?"bg-green500/20 border-green500/30 text-green300":a?"bg-white/5 border-white/10 text-gray-400":"border-white/20 text-gray-300 hover:border-purple500/50 hover:text-white"),children:[(0,o.jsxs)("div",{className:"flex items-center gap-3 flex-1",children:[(0,o.jsx)("div",{className:"flex-shrink-0",children:a?(0,o.jsx)("div",{className:"h-4 w-4 border-2 border-white/30 border-t-white/80 rounded-full animate-spin"}):s?(0,o.jsx)(p.Z,{className:"h-4 w-4 text-green400"}):k(e.type)}),(0,o.jsxs)("div",{className:"text-left flex-1",children:[(0,o.jsx)("div",{className:"font-medium",children:e.label}),a&&(0,o.jsx)("div",{className:"text-xs opacity-70 mt-1",children:"Checking membership..."}),f&&"quiz"===e.type&&(0,o.jsxs)("div",{className:"text-sm opacity-70 mt-1",children:["Answer: ",e.question]})]}),(0,o.jsxs)("div",{className:"flex text-xs text-purple300 font-semibold",children:[(0,o.jsx)("p",{children:"+5"}),"\xa0",(0,o.jsx)(m.Z,{className:"w-4 h-4"})]})]}),s&&(0,o.jsx)(i.C,{className:"bg-green500/30 text-green300 border-green500/40",children:"â Done"})]})},e.type)})}),y.length>0&&y.length===(t.actions||[]).length&&(0,o.jsxs)(n.E.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"mt-4 p-4 bg-purple500/30 border border-purple500/40 rounded-lg text-center",children:[(0,o.jsx)("div",{className:"text-lg font-semibold text-purple300 mb-1",children:"\uD83C\uDF89 All Actions Complete!"}),(0,o.jsx)("div",{className:"text-sm text-gray-300",children:"You're now qualified for exclusive raffles and rewards!"})]})]})}},35974:function(e,t,s){s.d(t,{C:function(){return i}});var o=s(57437);s(2265);var a=s(90535),n=s(19804);let l=(0,a.j)("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-white shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-gray-400 hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-[#242424]"}},defaultVariants:{variant:"default"}});function i(e){let{className:t,variant:s,...a}=e;return(0,o.jsx)("div",{className:(0,n.cn)(l({variant:s}),t),...a})}},8883:function(e,t,s){s.d(t,{Av:function(){return l},wt:function(){return i}});let o=(0,s(86091).hu)("shared-storage"),a="cultverse_progress";function n(){try{let e=localStorage.getItem(a);if(e){let t=JSON.parse(e);return t.xp&&!t.gems&&(t.gems=t.xp,delete t.xp),t}}catch(e){o.error("Failed to parse user progress",null,e)}return{actionsDone:{},tickets:{},gems:{}}}function l(e,t){let s=n();s.actionsDone[e]||(s.actionsDone[e]=[]),s.actionsDone[e].includes(t)||(s.actionsDone[e].push(t),s.gems[e]=(s.gems[e]||0)+10,s.tickets[e]=(s.tickets[e]||0)+1,function(e){try{localStorage.setItem(a,JSON.stringify(e))}catch(e){o.error("Failed to save user progress",null,e)}}(s))}function i(e,t){var s;return(null===(s=n().actionsDone[e])||void 0===s?void 0:s.includes(t))||!1}},30401:function(e,t,s){s.d(t,{Z:function(){return o}});let o=(0,s(39763).Z)("Check",[["polyline",{points:"20 6 9 17 4 12",key:"10jjfj"}]])},96362:function(e,t,s){s.d(t,{Z:function(){return o}});let o=(0,s(39763).Z)("ExternalLink",[["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}],["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["line",{x1:"10",x2:"21",y1:"14",y2:"3",key:"18c3s4"}]])},61476:function(e,t,s){s.d(t,{Z:function(){return o}});let o=(0,s(39763).Z)("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]])},53417:function(e,t,s){s.d(t,{Z:function(){return o}});let o=(0,s(39763).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},33276:function(e,t,s){s.d(t,{Z:function(){return o}});let o=(0,s(39763).Z)("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]])}}]);
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.