1import{j as e}from"./ui-vendor-7ksmbWQe.js";import{u as Ie,r as i,e as Ve,L as I}from"./react-vendor-LSUMIZ7H.js";import{r as Z,R as ee}from"./RewardAmount-3TSaSN1_.js";import{c as $e,C as u,a as K,b as W,S as Fe,d as se,e as x,f as ne,g as ze,B as b,i as ce,h as le,r as He,j as d,u as Ke,k as We,l as qe,P as Ue,D as Oe,T as te}from"./index-DWFe9eMF.js";import{S as Ge,a as Ye,b as Je,c as Xe,d as k}from"./select-DwJQZr1y.js";import{B as h}from"./badge-DRLeqBN9.js";import{T as Ze,a as es,b as V,c as $}from"./tabs-BERL4pnv.js";import{u as q}from"./i18n-vendor-Cq4PMOpV.js";import{t as ae}from"./taskTaxonomy-DK7Q7FUm.js";import{s as ss}from"./pollmaticQualifications-DxyUE7FP.js";import{T as ts}from"./tag-UwUFWKOZ.js";import{U as ie}from"./users-2RT-GKgj.js";import{C as re}from"./circle-check-big-BRFBDULZ.js";import{C as F}from"./clipboard-check-C8_6vIEM.js";const as=$e("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);function is(){const{t:s}=q(),r=Ie();return e.jsxs(u,{className:"hover:shadow-lg transition-shadow border-primary/30 bg-gradient-to-br from-primary/5 via-background to-background",children:[e.jsx(K,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsxs(W,{className:"text-lg flex items-center gap-2",children:[e.jsx(Fe,{className:"h-5 w-5 text-primary"}),s("profileTask.title","Complete your profile")]}),e.jsxs(h,{variant:"secondary",className:"text-[10px] w-fit gap-1",children:[e.jsx(se,{className:"h-3 w-3"}),s("profileTask.category","Account verification")]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("profileTask.description","Verify your identity so you can earn from tasks, surveys and offers. No proof needed â the reward is paid the moment your profile is saved.")})]}),e.jsx("div",{className:"text-right",children:e.jsx("div",{className:"text-2xl font-bold text-success",children:"â¥10"})})]})}),e.jsxs(x,{children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:e.jsx("strong",{children:"~2m"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ze,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:s("profileTask.noProof","No proof")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:s("profileTask.instant","Instant pay")})]})]}),e.jsx(b,{variant:"gamified-success",className:"w-full",onClick:()=>r("/complete-profile"),children:s("profileTask.viewTask","View task")})]})]})}const oe=He("ScreenSecurity"),de="no-capture-active",g="no-capture-hidden";let T=0,D=!1;function rs(s){const r=s.key;if(r==="PrintScreen")return!0;const n=s.ctrlKey||s.metaKey;return!!(n&&(r==="p"||r==="P")||n&&(r==="s"||r==="S")||n&&s.shiftKey&&(r==="s"||r==="S"))}function M(s){s.preventDefault(),s.stopPropagation()}function me(s){rs(s)&&(s.preventDefault(),s.stopPropagation())}function ue(s){if(s.key==="PrintScreen")try{navigator.clipboard?.writeText("")}catch{}}function xe(){document.visibilityState==="hidden"?document.body.classList.add(g):document.body.classList.remove(g)}function he(){document.body.classList.add(g)}function fe(){document.body.classList.remove(g)}let v=null;function ns(){typeof navigator>"u"||!navigator.mediaDevices?.getDisplayMedia||v||(v=navigator.mediaDevices.getDisplayMedia.bind(navigator.mediaDevices),navigator.mediaDevices.getDisplayMedia=async(...s)=>{const r=await v(...s);return document.body.classList.add(g),r.getVideoTracks().forEach(n=>{n.addEventListener("ended",()=>document.body.classList.remove(g))}),r})}function cs(){v&&navigator.mediaDevices&&(navigator.mediaDevices.getDisplayMedia=v,v=null)}function ls(){D||typeof window>"u"||(D=!0,document.body.classList.add(de),window.addEventListener("keydown",me,!0),window.addEventListener("keyup",ue,!0),document.addEventListener("contextmenu",M,
1!0),document.addEventListener("dragstart",M,!0),document.addEventListener("visibilitychange",xe),window.addEventListener("blur",he),window.addEventListener("focus",fe),ns())}function os(){D&&(D=!1,document.body.classList.remove(de),document.body.classList.remove(g),window.removeEventListener("keydown",me,!0),window.removeEventListener("keyup",ue,!0),document.removeEventListener("contextmenu",M,!0),document.removeEventListener("dragstart",M,!0),document.removeEventListener("visibilitychange",xe),window.removeEventListener("blur",he),window.removeEventListener("focus",fe),cs())}async function ds(){if(T+=1,!(T>1)){if(ce()&&le.getPlatform()==="android")try{await oe.enable()}catch(s){console.warn("[screenSecurity] native enable failed",s)}ls()}}async function ms(){if(T=Math.max(0,T-1),!(T>0)){if(ce()&&le.getPlatform()==="android")try{await oe.disable()}catch(s){console.warn("[screenSecurity] native disable failed",s)}os()}}function us(s=!0){i.useEffect(()=>{if(!s)return;let r=!1;return ds().catch(()=>{}),()=>{r||(r=!0,ms().catch(()=>{}))}},[s])}const z=new Map,H=new Map;function E({text:s,className:r,as:n="span"}){const{i18n:S}=q(),f=S.language||"en",j=f.startsWith("en"),l=`${f}:${s}`,[c,y]=i.useState(()=>z.get(l)||s);return i.useEffect(()=>{if(j||!s?.trim()){y(s);return}const w=z.get(l);if(w){y(w);return}let N=!1,p=H.get(l);return p||(p=d.translateTexts([s],f).then(m=>m.translations?.[0]||s).catch(()=>s).then(m=>(z.set(l,m),H.delete(l),m)),H.set(l,p)),p.then(m=>{N||y(m)}),()=>{N=!0}},[l,s,f,j]),e.jsx(n,{className:r,children:c})}function _s(){const{t:s}=q(),{isProfileIncomplete:r}=Ke(),{data:n}=We(),S=n?.qualifications_pollmatic_enabled!==!1,f=n?.qualifications_pollmatic_max??12,[j,l]=Ve(),c=j.get("tab"),y=c&&["available","locked","invited"].includes(c)?c:"available",[w,N]=i.useState(y);i.useEffect(()=>{c&&["available","locked","invited"].includes(c)&&c!==w&&N(c)},[c]);const[p,m]=i.useState("none"),[L,U]=i.useState("all"),[B,pe]=i.useState([]),[Q,ge]=i.useState([]),[C,ve]=i.useState([]),[O,je]=i.useState([]),[ye,G]=i.useState([]),[xs,we]=i.useState([]),[hs,Ne]=i.useState([]),[ke,be]=i.useState(!0),[Te,Se]=i.useState(new Date),[Le,Ce]=i.useState(0),[Pe,_e]=i.useState(0),[R,Ee]=i.useState("all"),{toast:De}=qe();us(),i.useEffect(()=>{Me(),Be(),Qe(),Re(),d.getTaskCategories().then(pe).catch(console.error);const t=setInterval(()=>Se(new Date),1e3);return()=>clearInterval(t)},[S,f]);const Me=async()=>{try{const t=await d.getTasks();ge(t||[]);const a=await d.getProfile();a&&(Ce(a.payable_balance||0),_e(a.pending_balance||0))}catch(t){De({title:s("common.error"),description:t.message,variant:"destructive"})}finally{be(!1)}},Be=async()=>{try{const t=await d.getLockedTasks();ve(t||[])}catch(t){console.error("Error fetching locked tasks:",t)}},Qe=async()=>{try{const[t,a,o]=await Promise.all([d.getQualifications(),d.getQualifiedList(),d.getMyQualificationResponses()]);je(t||[]),we(a||[]),Ne(o||[])}catch(t){console.error("Error fetching qualifications:",t)}},Re=async()=>{try{if(!S){G([]);return}const t=await d.getPollmaticSurveys(),o=(Array.isArray(t?.data)?t.data:[]).map(ss).sort((P,_)=>_.reward-P.reward||P.survey.loi-_.survey.loi).slice(0,Math.max(0,f));G(o)}catch{}},Ae=t=>{const o=new Date(t).getTime()-Te.getTime();if(o<=0)return s("tasks.expired");const P=Math.floor(o/6e4),_=Math.floor(o%6e4/1e3);return`${P}:${_.toString().padStart(2,"0")}`},Y=[...L==="all"?Q:Q.filter(t=>t.category_id===L)].sort((t,a)=>{switch(p){case"reward":return Number(a.reward)-Number(t.reward);case"title":return t.title.localeCompare(a.title);case"newest":return new Date(a.created_at).getTime()-new Date(t.created_at).getTime();case"ttr":return(t.time_to_rate_days||3)-(a.time_to_rate_days||3);default:return 0}}),J=[...O,...ye],X=J.length,A=R==="all"||R==="qualifications"?J:[];return ke?e.jsx("div",{className:"min-h-screen bg-background pb-20 md:pb-6 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Ue,{size:48,speed:1.6,className:"mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:s("common.loading")})]})}):e.jsxs("div",{className:"min-h-screen bg-background pb-20 md:pb-6",children:[e.jsx(Oe,{payableBalance:Le,pendingBalance:Pe}),e.jsx("main",{className:"container mx-auto px-4 pt-24 md:pt-6 pb-8 space-y-6",children:r?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("tasks.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("tasks.firstTaskSubtitle","Your first task is waiting â complete your profile to unlock the rest.")})]})}),e.jsx(is,{})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("tasks.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("tasks.subtitle")})]}),e.jsx(h,{variant:"destructive",className:"animate-pulse",children:s("common.live")})]}),e.jsxs(Ze,{value:w,onValueChange:t=>{N(t);const a=new URLSearchParams(j);a.set("tab",t),l(a,{replace:!0})},className:"w-full",children:[e.jsxs(es,{className:"grid w-full grid-cols-3 h-auto gap-1",children:[e.jsx(V,{value:"available",className:"h-auto min-h-9 whitespace-normal text-center leading-tight text-xs sm:text-sm px-1.5 py-1.5 break-words hyphens-auto",children:s("tasks.availableTasks")}),e.jsxs(V,{value:"locked",className:"h-auto min-h-9 whitespace-normal text-center leading-tight text-xs sm:text-sm px-1.5 py-1.5 break-words hyphens-auto inline-flex flex-wrap items-center justify-center gap-1",children:[e.jsx("span",{children:s("tasks.myLockedTasks")}),C.length>0&&e.jsx(h,{variant:"secondary",className:"shrink-0",children:C.length})]}),e.jsxs(V,{value:"invited",className:"h-auto min-h-9 whitespace-normal text-center leading-tight text-xs sm:text-sm px-1.5 py-1.5 break-words hyphens-auto inline-flex flex-wrap items-center justify-center gap-1",children:[e.jsx("span",{children:s("tasksPage.invited")}),X>0&&e.jsx(h,{variant:"secondary",className:"shrink-0",children:X})]})]}
1),e.jsxs($,{value:"available",className:"space-y-4 mt-4",children:[e.jsx(u,{children:e.jsxs(x,{className:"pt-6 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm font-medium",children:s("tasks.sortBy")}),e.jsxs(Ge,{value:p,onValueChange:m,children:[e.jsx(Ye,{className:"w-[200px]",children:e.jsx(Je,{placeholder:s("tasks.sortNone")})}),e.jsxs(Xe,{children:[e.jsx(k,{value:"none",children:s("tasks.sortNone")}),e.jsx(k,{value:"reward",children:s("tasks.sortReward")}),e.jsx(k,{value:"title",children:s("tasks.sortTitle")}),e.jsx(k,{value:"newest",children:s("tasks.sortNewest")}),e.jsx(k,{value:"ttr",children:s("tasks.sortReviewTime")})]})]})]}),B.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(h,{variant:L==="all"?"default":"outline",className:"cursor-pointer text-xs",onClick:()=>U("all"),children:s("tasksPage.all")}),B.map(t=>{const a=Q.filter(o=>o.category_id===t.id).length;return a===0?null:e.jsxs(h,{variant:L===t.id?"default":"outline",className:"cursor-pointer text-xs gap-1",onClick:()=>U(t.id),children:[ae(s,t.id,t.name)," (",a,")"]},t.id)})]})]})}),e.jsx("div",{className:"space-y-4",children:Y.map(t=>e.jsxs(u,{className:"hover:shadow-lg transition-shadow",children:[e.jsx(K,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsx(W,{className:"text-lg",children:t.title}),t.category_id&&e.jsxs(h,{variant:"secondary",className:"text-[10px] w-fit gap-1",children:[e.jsx(ts,{className:"h-3 w-3"}),ae(s,t.category_id,B.find(a=>a.id===t.category_id)?.name)]}),e.jsx(E,{as:"p",className:"text-sm text-muted-foreground",text:t.description})]}),e.jsx("div",{className:"text-right",children:(()=>{const a=Z(t);return e.jsx(ee,{reward:a.effective,original:a.boost>0?a.original:void 0})})()})]})}),e.jsxs(x,{children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ne,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:e.jsxs("strong",{children:[t.lock_duration_minutes,"m"]})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ie,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("span",{children:[e.jsx("strong",{children:t.max_claims-t.claimed})," ",s("tasksPage.slotsLeft",{count:t.max_claims-t.claimed}).replace(/^\d+ /,"")]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(as,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("span",{children:[s("tasksPage.ttr"),": ",e.jsxs("strong",{children:[t.time_to_rate_days||3,"d"]})]})]})]}),e.jsx(I,{to:`/tasks/${t.id}`,children:e.jsxs(b,{className:"w-full",size:"lg",children:[e.jsx(re,{className:"h-4 w-4 mr-2"}),s("tasks.viewTask")]})})]})]},t.id))}),Y.length===0&&e.jsx(u,{children:e.jsxs(x,{className:"py-12 text-center",children:[e.jsx("p",{className:"text-muted-foreground",children:s("tasks.noTasks")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:s("tasks.noTasksHint")})]})})]}),e.jsx($,{value:"locked",className:"space-y-4 mt-4",children:C.length>0?e.jsx("div",{className:"space-y-4",children:C.map(t=>e.jsxs(u,{className:"hover:shadow-lg transition-shadow border-warning",children:[e.jsx(K,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsx(W,{className:"text-lg",children:t.task.title}),e.jsx(E,{as:"p",className:"text-sm text-muted-foreground",text:t.task.description})]}),e.jsx("div",{className:"text-right",children:(()=>{const a=Z(t.task);return e.jsx(ee,{reward:a.effective,original:a.boost>0?a.original:void 0})})()})]})}),e.jsxs(x,{children:[e.jsx("div",{className:"flex items-center justify-between mb-4",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(te,{className:"h-4 w-4 text-warning"}),e.jsxs("span",{className:"font-semibold text-warning",children:[s("tasks.timeLeft"),": ",Ae(t.expires_at)]})]})}),e.jsx(I,{to:`/tasks/${t.task_id}`,children:e.jsxs(b,{className:"w-full",size:"lg",variant:"outline",children:[e.jsx(re,{className:"h-4 w-4 mr-2"}),s("tasks.continueTask")]})})]})]},t.id))}):e.jsx(u,{children:e.jsxs(x,{className:"py-12 text-center",children:[e.jsx(te,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:s("tasks.noLockedTasks")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:s("tasks.noLockedTasksHint")})]})})}
1),e.jsxs($,{value:"invited",className:"space-y-4 mt-4",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:[{value:"all",label:s("tasksPage.all")},{value:"qualifications",label:`${s("tasksPage.qualifications")} (${O.length})`}].map(t=>e.jsx(b,{variant:R===t.value?"default":"outline",size:"sm",onClick:()=>Ee(t.value),children:t.label},t.value))}),A.length>0&&e.jsx("div",{className:"space-y-3",children:A.map(t=>e.jsx(u,{className:"hover:shadow-lg transition-shadow",children:e.jsxs(x,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"flex items-center gap-2 mb-1",children:e.jsxs(h,{variant:"outline",className:"text-primary border-primary text-xs",children:[e.jsx(F,{className:"h-3 w-3 mr-1"})," ",s("tasksPage.qualifications")]})}),e.jsx(E,{as:"h3",className:"font-semibold",text:t.title}),e.jsx(E,{as:"p",className:"text-sm text-muted-foreground line-clamp-2",text:t.description})]}),e.jsx("div",{className:"text-xl font-bold text-success",children:Number(t.reward)>0?`â¥${Math.floor(Number(t.reward))}`:s("tasksPage.free")})]}),e.jsx("div",{className:"flex items-center gap-3 text-xs text-muted-foreground mb-3",children:e.jsxs("span",{children:[e.jsx(ie,{className:"h-3 w-3 inline mr-1"}),t.max_claims-t.claimed," ",s("tasksPage.slotsLeft",{count:t.max_claims-t.claimed}).replace(/^\d+ /,"")]})}),e.jsx(I,{to:`/qualifications/${t.id}`,children:e.jsxs(b,{className:"w-full",size:"sm",children:[e.jsx(F,{className:"h-4 w-4 mr-2"})," ",s("tasksPage.takeQualification")]})})]})},t.id))}),A.length===0&&e.jsx(u,{children:e.jsxs(x,{className:"py-12 text-center",children:[e.jsx(F,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:s("tasksPage.noInvitations")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:s("tasksPage.noInvitationsDesc")})]})})]})]})]})})]})}export{_s 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.