1import{j as e}from"./ui-vendor-7ksmbWQe.js";import{r as c,i as Ue,u as We}from"./react-vendor-LSUMIZ7H.js";import{c as le,C as _,a as P,b as I,e as C,B as d,ad as V,j as b,ae as u,P as Ze,D as he,af as Xe}from"./index-DWFe9eMF.js";import{B as re}from"./badge-DRLeqBN9.js";import{L as W}from"./label-BcuwxRqT.js";import{S as Ye}from"./separator-064dhCHm.js";import{A as fe,h as je,a as ke,b as be,c as ve,d as Ne,e as we,f as ye,g as Me}from"./alert-dialog-CE-EObL7.js";import{S as Ge}from"./switch-CJCZf25B.js";import{S as se,a as ae,b as te,c as ne,d as q}from"./select-DwJQZr1y.js";import{u as ie}from"./i18n-vendor-Cq4PMOpV.js";import{Z as Je}from"./zap-Dol2dxVY.js";import{T as Ke}from"./trash-2-DHkDZxUq.js";import{P as B}from"./plus-wVwOVnuZ.js";import{R as _e}from"./RewardAmount-3TSaSN1_.js";import{T as pe}from"./trending-up-72Bi6jOb.js";import{S as Qe}from"./square-pen-D-Eco8cA.js";import{C as es}from"./clipboard-list-DTKTY99m.js";import{C as ge}from"./copy-CAgMBh-k.js";import{C as ss}from"./circle-x-CxkSVCEA.js";const as=le("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const ts=le("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);const ns=le("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),O=[{id:"equals",label:"Equals",needsValue:!0,textual:!0},{id:"contains",label:"Contains",needsValue:!0,textual:!0},{id:"starts_with",label:"Starts with",needsValue:!0,textual:!0},{id:"ends_with",label:"Ends with",needsValue:!0,textual:!0},{id:"not_equals",label:"Does not equal",needsValue:!0,textual:!0},{id:"not_contains",label:"Does not contain",needsValue:!0,textual:!0},{id:"regex",label:"Matches pattern (regex)",needsValue:!0,textual:!0},{id:"url_domain",label:"Is a link on domain",needsValue:!0},{id:"min_length",label:"Min. characters",needsValue:!0},{id:"max_length",label:"Max. characters",needsValue:!0},{id:"not_empty",label:"Is not empty",needsValue:!1},{id:"is_url",label:"Is a valid link",needsValue:!1},{id:"is_number",label:"Is a number",needsValue:!1},{id:"unique",label:"Not used by another worker",needsValue:!1,textual:!0}];function rs({taskId:s,requirements:o,initial:x,onSaved:t}){const{t:l}=ie(),g=o.length>0?o.map((a,r)=>({idx:r,label:a.label||`#${r+1}`,image:a.type==="image"})):[{idx:0,label:l("taskManage.proof","Proof"),image:!1}],[h,m]=c.useState({mode:"off",match:"all",rules:[]}),[p,v]=c.useState(!1);c.useEffect(()=>{m({mode:x?.mode??"off",match:x?.match??"all",rules:(x?.rules??[]).map(a=>({...a,value:a.value??"",match_case:a.match_case!==!1})),min_success_rate:x?.min_success_rate||0,min_prior_approvals:x?.min_prior_approvals||0})},[x]);const N=(a,r)=>m(f=>({...f,rules:f.rules.map((j,M)=>M===a?{...j,...r}:j)})),F=()=>{const a=g.find(r=>!r.image)??g[0];m(r=>({...r,rules:[...r.rules,{field:a.idx,op:a.image?"not_empty":"contains",value:"",match_case:!0}]}))},w=async()=>{v(!0);try{const a=await b.setAutoApproveRules(s,h);u.success(a.message),t()}catch(a){u.error(a.message)}finally{v(!1)}},y=[{id:"off",label:l("taskManage.aaOff","Manual"),hint:l("taskManage.aaOffHint","You review every submission (or it's auto-approved after the review period).")},{id:"all",label:l("taskManage.aaAll","Approve all"),hint:l("taskManage.aaAllHint","Every submission is approved instantly.")},{id:"criteria",label:l("taskManage.aaCriteria","Match criteria"),hint:l("taskManage.aaCriteriaHint","Approved instantly only when the proof matches your rules. Otherwise it waits for review as usual.")}];return e.jsxs(_,{children:[e.jsx(P,{className:"pb-3",children:e.jsxs(I,{className:"text-base flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-warning"})," ",l("taskManage.aaTitle","Instant approval"),x?.mode&&x.mode!=="off"&&e.jsx(re,{variant:"secondary",children:l("taskManage.aaOn","On")})]})}),e.jsxs(C,{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-3 gap-2",children:y.map(a=>e.jsx(d,{type:"button",size:"sm",variant:h.mode===a.id?"default":"outline",onClick:()=>m(r=>({...r,mode:a.id})),children:a.label},a.id))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:y.find(a=>a.id===h.mode)?.hint}),h.mode==="criteria"&&e.jsxs("div",{className:"space-y-3",children:[h.rules.length>1&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:l("taskManage.aaMatch","Approve when")}),e.jsxs(se,{value:h.match,onValueChange:a=>m(r=>({...r,match:a})),children:[e.jsx(ae,{className:"h-8 w-40",children:e.jsx(te,{})}),e.jsxs(ne,{children:[e.jsx(q,{value:"all",children:l("taskManage.aaMatchAll","all rules match")}),e.jsx(q,{value:"any",children:l("taskManage.aaMatchAny","any rule matches")})]})]})]}),h.rules.map((a,r)=>
1{const f=O.find(i=>i.id===a.op)??O[0],M=g.find(i=>i.idx===a.field)?.image?O.filter(i=>i.id==="not_empty"):O;return e.jsxs("div",{className:"rounded-md border p-3 space-y-2 bg-muted/30",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(se,{value:String(a.field),onValueChange:i=>{const k=g.find(D=>D.idx===Number(i));N(r,{field:Number(i),...k?.image?{op:"not_empty"}:{}})},children:[e.jsx(ae,{className:"h-9 flex-1 min-w-0",children:e.jsx(te,{})}),e.jsx(ne,{children:g.map(i=>e.jsx(q,{value:String(i.idx),children:i.label},i.idx))})]}),e.jsx(d,{type:"button",size:"icon",variant:"ghost",className:"h-9 w-9 shrink-0",onClick:()=>m(i=>({...i,rules:i.rules.filter((k,D)=>D!==r)})),children:e.jsx(Ke,{className:"h-4 w-4"})})]}),e.jsxs(se,{value:a.op,onValueChange:i=>N(r,{op:i}),children:[e.jsx(ae,{className:"h-9",children:e.jsx(te,{})}),e.jsx(ne,{children:M.map(i=>e.jsx(q,{value:i.id,children:l(`taskManage.aaOp_${i.id}`,i.label)},i.id))})]}),f.needsValue&&e.jsx(V,{value:a.value,type:a.op==="min_length"||a.op==="max_length"?"number":"text",maxLength:a.op==="regex"?200:500,placeholder:a.op==="url_domain"?"example.com":l("taskManage.aaValue","Expected text"),onChange:i=>N(r,{value:i.target.value})}),f.textual&&e.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Ge,{checked:a.match_case,onCheckedChange:i=>N(r,{match_case:i})}),l("taskManage.aaMatchCase","Match case")]})]},r)}),e.jsxs(d,{type:"button",variant:"outline",size:"sm",onClick:F,disabled:h.rules.length>=10,children:[e.jsx(B,{className:"h-4 w-4 mr-1"})," ",l("taskManage.aaAddRule","Add rule")]})]}),h.mode!=="off"&&e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(W,{className:"text-xs",children:l("taskManage.aaMinAccuracy","Worker min. accuracy (%)")}),e.jsx(V,{type:"number",min:0,max:100,value:h.min_success_rate||"",placeholder:"0",onChange:a=>m(r=>({...r,min_success_rate:Math.max(0,Math.min(100,parseInt(a.target.value)||0))}))})]}),e.jsxs("div",{children:[e.jsx(W,{className:"text-xs",children:l("taskManage.aaMinPrior","Min. approved on your tasks")}),e.jsx(V,{type:"number",min:0,value:h.min_prior_approvals||"",placeholder:"0",onChange:a=>m(r=>({...r,min_prior_approvals:Math.max(0,parseInt(a.target.value)||0)}))})]})]}),e.jsx(d,{onClick:w,disabled:p,className:"w-full",children:l("common.save","Save")})]})]})}const U=s=>Math.round(s*100)/100;function ls({taskId:s,reward:o,canBoost:x,onBoosted:t}){const{t:l}=ie(),[g,h]=c.useState(null),[m,p]=c.useState(0),[v,N]=c.useState(!1),F=()=>b.getRewardBoost(s).then(h).catch(()=>h(null));if(c.useEffect(()=>{F()},[s]),!g)return null;const w=Number(g.reward_boost)||0,y=g.remaining_slots,a=Math.max(0,Math.floor(m)),r=U(a*y),f=U(r*g.fee_rates.platform),j=U((r+f)*g.fee_rates.network),M=U(r+f+j),i=async()=>{N(!0);try{const k=await b.boostReward(s,a);u.success(`${k.message} · â¥${k.cost.toFixed(2)}`),p(0),await F(),t()}catch(k){u.error(k.message)}finally{N(!1)}};return e.jsxs(_,{className:"border-success/30",children:[e.jsx(P,{className:"pb-3",children:e.jsxs(I,{className:"text-base flex items-center justify-between gap-2",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(pe,{className:"h-4 w-4 text-success"})," ",l("taskManage.boostTitle","Boost reward")]}),e.jsx(_e,{reward:o+w,original:w>0?o:void 0,size:"sm"})]})}),e.jsxs(C,{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:l("taskManage.boostHint","Adds a bonus for every worker who hasn't submitted yet (including those currently working on it). Past submissions keep their reward. A boost can't be undone.")}),!x||y<1?e.jsx("p",{className:"text-sm text-muted-foreground",children:l("taskManage.boostUnavailable","Boost is available for active or paused tasks with open slots.")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"+â¥"}),e.jsx(V,{type:"number",min:1,step:1,value:m||"",placeholder:"10",onChange:k=>p(Math.max(0,parseInt(k.target.value)||0))}),e.jsxs("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["à ",y," ",l("taskManage.slots","slots").toLowerCase()]})]}),a>0&&e.jsxs("div",{className:"text-xs text-muted-foreground space-y-0.5",children:[e.jsxs("p",{children:[l("taskManage.reward"),": â¥",r.toFixed(2)]}),e.jsx("p",{children:l("taskManage.platformFeeCalc",{fee:f.toFixed(2)})}),e.jsxs("p",{children:[l("taskManage.boostNetworkFee","Network fee (6%, prepaid for workers)"),": â¥",j.toFixed(2)]}),e.jsxs("p",{className:"font-medium text-foreground",children:["Total: â¥",M.toFixed(2)]})]}),e.jsxs(fe,{children:[e.jsx(je,{asChild:!0,children:e.jsxs(d,{className:"w-full",disabled:v||a<1,children:[e.jsx(pe,{className:"h-4 w-4 mr-1"})," ",l("taskManage.boostTitle","Boost reward")," ",a>0?`+â¥${a}`:""]})}),e.jsxs(ke,{children:[e.jsxs(be,{children:[e.jsxs(ve,{children:[l("taskManage.boostTitle","Boost reward")," +â¥",a]}),e.jsxs(Ne,{children:["â¥",M.toFixed(2)," · ",l("taskManage.boostHint","Adds a bonus for every worker who hasn't submitted yet (including those currently working on it). Past submissions keep their reward. A boost can't be und
1one.")]})]}),e.jsxs(we,{children:[e.jsx(ye,{children:l("common.cancel")}),e.jsx(Me,{onClick:i,children:l("common.confirm","Confirm")})]})]})]})]})]})]})}function Ss(){const{t:s}=ie(),{taskId:o}=Ue(),x=We(),[t,l]=c.useState(null),[g,h]=c.useState(!0),[m,p]=c.useState(!1),[v,N]=c.useState(10),[F,w]=c.useState(!1),[y,a]=c.useState(!1),[r,f]=c.useState(1),[j,M]=c.useState(0),[i,k]=c.useState(0),[D,is]=c.useState(!1),[cs,Ce]=c.useState({title:"",description:"",instructions:"",lock_duration_minutes:15,time_to_rate_days:3,minimum_accuracy:0});c.useEffect(()=>{S()},[o]);const S=async()=>{try{const n=await b.getTask(o);l(n),n.status==="rejected"&&Ce({title:n.title||"",description:n.description||"",instructions:n.instructions||"",lock_duration_minutes:n.lock_duration_minutes||15,time_to_rate_days:n.time_to_rate_days||3,minimum_accuracy:Number(n.minimum_accuracy)||0});const T=await b.getTaskProofs(o);M(T?.filter(ee=>ee.status==="pending").length||0),k(T?.filter(ee=>ee.status==="approved").length||0)}catch{u.error(s("taskManage.failedToLoad"))}finally{h(!1)}},Se=async()=>{p(!0);try{const n=await b.pauseTask(o);u.success(n.message),S()}catch(n){u.error(n.message)}finally{p(!1)}},Ae=async()=>{p(!0);try{const n=await b.cancelTask(o);u.success(n.message+(n.refund?` (Refunded â¥${Math.floor(n.refund)})`:"")),S()}catch(n){u.error(n.message)}finally{p(!1)}},Fe=async()=>{p(!0);try{const n=await b.archiveTask(o);u.success(n.message),S()}catch(n){u.error(n.message)}finally{p(!1)}},Te=async()=>{if(v<1){u.error(s("taskManage.slotsMinimum"));return}p(!0);try{const n=await b.cloneTask(o,{max_claims:v});u.success(n.message),x(`/emp/task-manage/${n.id}`)}catch(n){u.error(n.message)}finally{p(!1),w(!1)}},Pe=async()=>{if(!Number.isInteger(r)||r<1){u.error(s("taskManage.slotsInvalid"));return}p(!0);try{const n=await b.addSlots(o,r);u.success(s("taskManage.slotsSuccess",{message:n.message,cost:Math.floor(n.cost)})),a(!1),f(1),S()}catch(n){u.error(n.message)}finally{p(!1)}};if(g)return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(Ze,{size:32,speed:1.2})});if(!t)return e.jsxs("div",{className:"min-h-screen bg-background pb-20",children:[e.jsx(he,{}),e.jsx("main",{className:"container mx-auto px-4 pt-24 md:pt-6",children:e.jsx("p",{className:"text-center text-muted-foreground",children:s("taskManage.taskNotFound")})})]});const R=t.status==="rejected",L=t.status==="paused",Z=t.status==="active",ce=t.status==="completed",Ie=t.status==="archived",E=t.status==="cancelled",$=t.status==="pending_review",Ve=Z||L||ce||Ie,oe=Z,Be=L,De=$||L&&j===0,Re=ce||E,Le={active:"default",paused:"secondary",completed:"outline",cancelled:"destructive",archived:"secondary",pending_review:"secondary",rejected:"destructive"},A=Math.max(0,Math.floor(r)),X=A*Number(t.reward),de=X*.1,me=Array.isArray(t.proof_requirements)?t.proof_requirements:[],Y=me.filter(n=>n.type==="image").length,G=Y*A*1,z=Number(t.reward_boost||0),Ee=A*z,J=Math.round(Ee*1.1*1.06*100)/100,$e=X+de+G+J,H=Math.max(0,Math.floor(v)),K=H*Number(t.reward),ue=K*.1,Q=Y*H*1,ze=K+ue+Q,xe=Number(t.reward)*t.max_claims,He=xe*.1,qe=Y*t.max_claims*1,Oe=xe+He+qe;return e.jsxs("div",{className:"min-h-screen bg-background pb-20 md:pb-6",children:[e.jsx(he,{}),e.jsxs("main",{className:"container mx-auto px-4 pt-24 md:pt-6 pb-8 space-y-4 max-w-2xl",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(d,{variant:"ghost",size:"icon",onClick:()=>x("/emp/my-tasks"),children:e.jsx(Xe,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h1",{className:"text-xl font-bold truncate",children:t.title}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:t.description})]}),e.jsx(re,{variant:Le[t.status]||"secondary",children:t.status==="pending_review"?s("taskManage.pendingReview"):t.status})]}),e.jsx(_,{children:e.jsx(C,{className:"p-4",children:e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx(_e,{className:"items-center",reward:Number(t.reward)+z,original:z>0?Number(t.reward):void 0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("taskManage.reward")})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-2xl font-bold",children:[t.claimed,"/",t.max_claims]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("taskManage.slots")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-primary",children:j}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("taskManage.pending")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-success",children:i}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("taskManage.approved")})]})]})})}),R&&e.jsx(_,{className:"border-destructive/50 bg-destructive/5",children:e.jsxs(C,{className:"p-4",children:[e.jsx("p",{className:"text-sm font-medium text-destructive mb-2",children:s("taskManage.rejectedBanner")}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:s("taskManage.resubmitCharge",{cost:Oe.toFixed(2)})}),e.jsxs(d,{size:"sm",onClick:()=>x(`/emp/create-task/ai?resubmit=${o}`),children:[e.jsx(Qe,{className:"h-4 w-4 mr-1"})," ",s("taskManage.editResubmitAi","Edit with AI & Resubmit")]}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-2",children:s("taskManage.editResubmitAiHint","We'll open the AI Campaign Builder pre-filled with this task so you can describe the fix and let the AI rewrite the draft before resubmitting.")})]})}),!R&&e.jsxs(_,{children:[e.jsx(P,{className:"pb-3",children:e.jsx(I,{className:"text-base",children:s("taskManage.actions")})}),e.jsxs(C,{className:"space-y-2",children:[!$&&!E&&e.jsxs(d,{className:"w-full",onClick:()=>x(`/emp/task-review/${o}`),children:[e.jsx(es,{className:"h-4 w-4 mr-2"}),s("taskManage.reviewSubmissions"),j>0&&e.jsx(re,{variant:"secondary",className:"ml-2",children:s("taskManage.pendingBadge",{count:j})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[(oe||Be)&&e.jsx(d,{variant:"outline",onClick:Se,disabled:m,children:oe?e.jsxs(e.Fragment,{children:[e.jsx(ts,{className:"h-4 w-4 mr-1"})," ",s("taskManage.pause")]}):e.jsxs(e.Fragment,{children:[e.jsx(ns,{className:"h-4 w-4 mr-1"})," ",s("taskManage.resume")]})}),Ve&&e.jsxs(d,{variant:"outline",onClick:()=>a(!0),children:[e.jsx(B,{className:"h-4 w-4 mr-1"})," ",s("taskManage.addSlots")]}),e.jsxs(d,{variant:"outline",onClick:()=>w(!0),children:[e.jsx(ge,{className:"h-4 w-4 mr-1"})," ",s("taskManage.clone")]}),Re&&e.jsxs(d,{variant:"outline",onClick:Fe,disabled:m,children:[e.jsx(as,{className:"h-4 w-4 mr-1"})," ",s("taskManage.archive")]}),De&&e.jsxs(fe,{children:[e.jsx(je,{asChild:!0,children:e.jsxs(d,{variant:"destructive",size:"default",children:[e.jsx(ss,{className:"h-4 w-4 mr-1"})," ",s("taskManage.cancelTask")]})}),e.jsxs(ke,{children:[e.jsxs(be,{children:[e.jsx(ve,{children:s("taskManage.cancelTitle")}),e.jsx(Ne,{children:s($?"taskManage.cancelPendingDesc":"taskManage.cancelActiveDesc")})]}),e.jsxs(we,{children:[e.jsx(ye,{children:s("taskManage.keepTask")}),e.jsx(Me,{onClick:Ae,disabled:m,children:s("taskManage.yesCancel")})]})]})]})]})]})]}),!R&&!E&&e.jsx(rs,{taskId:o,requirements:me,initial:t.auto_approve_rules,onSaved:S}
1),!R&&!E&&!$&&e.jsx(ls,{taskId:o,reward:Number(t.reward),canBoost:Z||L,onBoosted:S},`${t.reward_boost}-${t.max_claims}`),y&&e.jsxs(_,{className:"border-primary/30",children:[e.jsx(P,{className:"pb-3",children:e.jsxs(I,{className:"text-base flex items-center gap-2",children:[e.jsx(B,{className:"h-4 w-4"})," ",s("taskManage.addSlotsTitle")]})}),e.jsxs(C,{className:"space-y-3",children:[e.jsx("div",{className:"flex items-end gap-3",children:e.jsxs("div",{className:"flex-1",children:[e.jsx(W,{children:s("taskManage.currentSlots",{count:t.max_claims})}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(V,{type:"number",min:1,value:r,onChange:n=>{const T=parseInt(n.target.value)||0;f(Math.max(0,T))},placeholder:s("taskManage.slotsToAdd")}),e.jsxs("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["â ",t.max_claims+A," total"]})]})]})}),A>0&&e.jsxs("div",{className:"text-xs text-muted-foreground space-y-0.5",children:[e.jsxs("p",{children:[s("taskManage.reward"),": â¥",X.toFixed(2)]}),e.jsx("p",{children:s("taskManage.platformFeeCalc",{fee:de.toFixed(2)})}),G>0&&e.jsx("p",{children:s("taskManage.imageUploadFeeCalc",{fee:G.toFixed(2)})}),J>0&&e.jsxs("p",{children:[s("taskManage.boostTitle","Boost reward")," (+â¥",z,", 16.6%): â¥",J.toFixed(2)]}),e.jsxs("p",{className:"font-medium text-foreground",children:["Total: â¥",$e.toFixed(2)]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(d,{onClick:Pe,disabled:m||A<1,children:[e.jsx(B,{className:"h-4 w-4 mr-1"})," ",s("taskManage.addSlots")," (",A,")"]}),e.jsx(d,{variant:"ghost",onClick:()=>{a(!1),f(1)},children:s("common.cancel")})]})]})]}),F&&e.jsxs(_,{className:"border-primary/30",children:[e.jsx(P,{className:"pb-3",children:e.jsxs(I,{className:"text-base flex items-center gap-2",children:[e.jsx(ge,{className:"h-4 w-4"})," ",s("taskManage.cloneTitle")]})}),e.jsxs(C,{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(W,{children:s("taskManage.cloneSlots")}),e.jsx(V,{type:"number",min:1,value:v,onChange:n=>{const T=parseInt(n.target.value)||0;N(Math.max(0,T))}}),H>0&&e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 space-y-0.5",children:[e.jsxs("p",{children:[s("taskManage.reward"),": â¥",K.toFixed(2)]}),e.jsx("p",{children:s("taskManage.platformFeeCalc",{fee:ue.toFixed(2)})}),Q>0&&e.jsx("p",{children:s("taskManage.imageUploadFeeCalc",{fee:Q.toFixed(2)})}),e.jsxs("p",{className:"font-medium text-foreground",children:["Total: â¥",ze.toFixed(2)]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(d,{onClick:Te,disabled:m||H<1,children:[e.jsx(B,{className:"h-4 w-4 mr-1"})," ",s("taskManage.cloneTaskBtn")]}),e.jsx(d,{variant:"ghost",onClick:()=>w(!1),children:s("common.cancel")})]})]})]}),e.jsxs(_,{children:[e.jsx(P,{className:"pb-3",children:e.jsx(I,{className:"text-base",children:"Details"})}),e.jsxs(C,{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("taskManage.lockMin")}),e.jsxs("span",{children:[t.lock_duration_minutes," min"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("taskManage.ttrDays")}),e.jsxs("span",{children:[t.time_to_rate_days," days"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("taskManage.minAccuracy")}),e.jsxs("span",{children:[t.minimum_accuracy||0,"%"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("createTask.platformFee")}),e.jsxs("span",{children:["â¥",Math.floor(Number(t.platform_fee||0))]})]}),t.instructions&&e.jsxs("div",{className:"pt-2",children:[e.jsx("p",{className:"text-muted-foreground mb-1",children:s("taskDetail.instructions")}),e.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none text-sm [&_a]:text-primary [&_a]:underline",dangerouslySetInnerHTML:{__html:t.instructions}})]}),e.jsx(Ye,{}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Created"}),e.jsx("span",{children:new Date(t.created_at).toLocaleDateString()})]}),t.parent_task_id&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Cloned from"}),e.jsx(d,{variant:"link",size:"sm",className:"h-auto p-0",onClick:()=>x(`/emp/task-manage/${t.parent_task_id}`),children:"View parent"})]})]})]})]})]})}export{Ss 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.