1import{r as o,j as e,$ as ne,a0 as re,a1 as oe,a2 as de,a3 as Ae,B as u,P as Ce,C as Ee,a4 as be,a5 as k,w as J,D as q,aa as ce,N as le,f as B,g as G,U as Us,T as Rs,V as as,W as ts,b as ve,Y as is,q as ls,Z as ns,_ as rs,X as Bs,ah as Gs,v as os}from"./index-CxTzo_i5.js";import{V as $s}from"./virtual-data-table-CXBWhM2E.js";import{u as zs,S as De}from"./use-campaigns-B3uio-ee.js";import{B as Ws}from"./batch-actions-bar-CASSUgsC.js";import{L}from"./label-u97y7T5C.js";import{T as hs}from"./textarea-B5xSjLxy.js";import{S as K,a as O,b as F,c as I,d as _}from"./select-yCbIaiw_.js";import{E as we}from"./external-link-Ddpd7fdt.js";import{E as Qs}from"./export-center-dialog-DJBcVyls.js";import{A as Xs,a as Js,b as Ys,c as Zs,d as ea,e as sa,f as aa,g as ta}from"./alert-dialog-COxCilwe.js";import{I as E}from"./input-CcS2mpyJ.js";import{C as ds}from"./currency-input-BnyOnK_0.js";import{C as Ne}from"./combobox-create-Bg8RUXGX.js";import{u as ia,a as la,b as na,P as cs}from"./use-pics-BJME1GH1.js";import{u as ra,a as oa,b as da}from"./use-products-gK0qceFr.js";import{u as ca}from"./useQuery-BujisQX_.js";import{u as me}from"./useMutation-nYJy1ouO.js";import{D as ma}from"./download-W1WbOpl9.js";import{P as ms}from"./plus-BTi1u4UK.js";import{V as ua}from"./video-CbDDEhxj.js";import{E as us}from"./eye-DtgkDt4i.js";import{C as pa}from"./circle-check-big-Buxx_3Mw.js";import{C as ha}from"./circle-x-BKKOqIvz.js";import{P as xa}from"./phone-B4xT8zU7.js";import{p as ga,i as ja}from"./isWithinInterval-Cd7lU2UZ.js";import"./table-DceSb92m.js";import"./checkbox-B1zCQAo8.js";import"./index-BG_NryTU.js";import"./sliders-horizontal-COCJX3yU.js";import"./grip-vertical-DhBU7bxQ.js";import"./chevron-up-DNE74ONe.js";import"./ellipsis-CddaOB9h.js";import"./square-pen-C_jxPBCs.js";import"./user-plus-BMgqCCAW.js";import"./radio-group-TMrL1_Tl.js";import"./xlsx-B6sNpj_1.js";import"./file-spreadsheet-hnOja5yS.js";const ps=[{id:"follow_up",name:"Follow Up Video",template:`Halo {name}! ð 2 3Terima kasih sudah upload video-nya. Kami ingin follow up terkait performa video Anda. 4 5Ada yang bisa kami bantu? 6 7Salam, 8Tim Kolabo`},{id:"reminder",name:"Reminder Upload",template:`Halo {name}! ð 9 10Kami ingin mengingatkan untuk upload video sesuai jadwal yang sudah ditentukan. 11 12Jika ada kendala, jangan ragu untuk menghubungi kami. 13 14Terima kasih! ð`},{id:"approval",name:"Video Approved",template:`Halo {name}! ð 15 16Selamat! Video Anda sudah kami approve. 17 18Terima kasih atas kerjasamanya. Semoga sukses selalu! 19 20Salam, 21Tim Kolabo`},{id:"sample_sent",name:"Sample Terkirim",template:`Halo {name}! ð¦ 22 23Sample produk sudah kami kirim ke alamat Anda. 24 25Mohon konfirmasi jika sudah diterima ya. 26 27Terima kasih! ð`},{id:"custom",name:"Custom Message",template:`Halo {name}! 28 29[Tulis pesan Anda di sini] 30 31Salam, 32Tim Kolabo`}];function fa({contacts:l,open:r,onOpenChange:t,defaultTemplate:n,variables:v=["name","phone"]}){const[j,h]=o.useState(n||"follow_up"),[w,U]=o.useState(""),[ye,ue]=o.useState(null),Y=o.useMemo(()=>{const d=ps.find(f=>f.id===j);return(d==null?void 0:d.template)||""},[j]),pe=o.useMemo(()=>j==="custom"?w:Y,[j,w,Y]),c=o.useMemo(()=>l.map(d=>{let f=pe;return Object.keys(d).forEach(V=>{const R=d[V];R!==void 0&&(f=f.replace(new RegExp(`\\{${V}\\}`,"g"),String(R)))}),{...d,message:f,whatsappUrl:`https://wa.me/${d.phone.replace(/[^0-9]/g,"")}?text=${encodeURIComponent(f)}`}}),[l,pe]),Se=async(d,f)=>{await navigator.clipboard.writeText(f),ue(d),k({title:"Tersalin",description:"Pesan berhasil disalin"}),setTimeout(()=>ue(null),2e3)},$=async()=>{const d=c.map((f,V)=>`[${V+1}] ${f.name} (${f.phone}): 33${f.message}`).join(` 34 35--- 36 37`);await navigator.clipboard.writeText(d),k({title:"Tersalin",description:`${l.length} pesan berhasil disalin`})},z=d=>{window.open(d,"_blank")};return e.jsx(ne,{open:r,onOpenChange:t,children:e.jsxs(re,{className:"max-w-4xl max-h-[85vh] overflow-y-auto",children:[e.jsx(oe,{children:e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:"h-5 w-5 text-green-500"}),"WhatsApp Message Generator (",l.length," contacts)"]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{children:"Template Pesan"}),e.jsxs(K,{value:j,onValueChange:h,children:[e.jsx(O,{children:e.jsx(F,{})}),e.jsx(I,{children:ps.map(d=>e.jsx(_,{value:d.id,children:d.name},d.id))})]})]}),e.jsx("div",{className:"space-y-2",children:e.jsxs(L,{className:"text-muted-foreground text-xs",children:["Variables: ",v.map(d=>`{${d}}
37`).join(", ")]})})]}),j==="custom"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{children:"Custom Message"}),e.jsx(hs,{value:w,onChange:d=>U(d.target.value),placeholder:"Tulis pesan custom Anda...",className:"min-h-[120px]"})]}),j!=="custom"&&e.jsxs("div",{className:"p-3 bg-muted/50 rounded-lg",children:[e.jsx(L,{className:"text-xs text-muted-foreground mb-2 block",children:"Preview Template:"}),e.jsx("pre",{className:"text-sm whitespace-pre-wrap font-sans",children:Y})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(L,{children:"Generated Messages"}),e.jsxs(u,{variant:"outline",size:"sm",onClick:$,children:[e.jsx(Ce,{className:"h-3 w-3 mr-1"}),"Copy All"]})]}),e.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:c.map((d,f)=>e.jsxs("div",{className:"p-3 border rounded-lg space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:d.name}),e.jsx("span",{className:"text-sm text-muted-foreground ml-2",children:d.phone})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(u,{variant:"ghost",size:"sm",onClick:()=>Se(f,d.message),children:ye===f?e.jsx(Ee,{className:"h-4 w-4 text-green-500"}):e.jsx(Ce,{className:"h-4 w-4"})}),e.jsxs(u,{variant:"default",size:"sm",onClick:()=>z(d.whatsappUrl),className:"bg-green-500 hover:bg-green-600",children:[e.jsx(we,{className:"h-4 w-4 mr-1"}),"Open WA"]})]})]}),e.jsx("div",{className:"text-sm bg-muted/30 p-2 rounded whitespace-pre-wrap max-h-[80px] overflow-y-auto",children:d.message})]},d.id))})]})]}),e.jsx(be,{children:e.jsx(u,{variant:"outline",onClick:()=>t(!1),children:"Tutup"})})]})})}const va=(l,r)=>({id:l.id,campaign:l.campaign||"",affiliateName:l.affiliate_name||"",tiktokHandle:l.tiktok_handle||"",gmv:Number(l.gmv||0),followers:l.followers||0,produk:l.produk||"",noHp:l.no_hp||"",tanggalKirim:l.tanggal_kirim||"",statusVideo:l.status_video||"Belum",tglPosting:l.tgl_posting||"",pic:l.pic||"",status:l.status||"Pending",reviewerNotes:l.reviewer_notes||"",videos:r.map(t=>({id:t.id,url:t.url,views:t.views,likes:t.likes,comments:t.comments,shares:t.shares||0,saves:t.saves||0}))});function Na(){const{currentBrand:l}=J();return ca({queryKey:["open-collabs",l==null?void 0:l.id],queryFn:async()=>{if(!(l!=null&&l.id))return[];const{data:r,error:t}=await q.from("open_collabs_safe").select("*").eq("brand_id",l.id).order("created_at",{ascending:!1});if(t)throw t;const n=(r||[]).map(h=>h.id).filter(h=>h!==null);if(n.length===0)return[];const{data:v,error:j}=await q.from("open_collab_videos").select("*").in("open_collab_id",n);if(j)throw j;return(r||[]).filter(h=>h.id!==null).map(h=>{const w=(v||[]).filter(U=>U.open_collab_id===h.id);return va(h,w)})},enabled:!!(l!=null&&l.id)})}function ka(){const l=ce(),{currentBrand:r}=J();return me({mutationFn:async({collab:t,videos:n})=>{if(!(r!=null&&r.id))throw new Error("No brand selected");const{data:v,error:j}=await q.from("open_collabs").insert({brand_id:r.id,campaign:t.campaign,affiliate_name:t.affiliateName,tiktok_handle:t.tiktokHandle,gmv:t.gmv,followers:t.followers,produk:t.produk,no_hp:t.noHp,tanggal_kirim:t.tanggalKirim||null,status_video:t.statusVideo,tgl_posting:t.tglPosting||null,pic:t.pic,status:t.status,reviewer_notes:t.reviewerNotes}).select().single();if(j)throw j;if(n.length>0){const{error:h}=await q.from("open_collab_videos").insert(n.map(w=>({open_collab_id:v.id,url:w.url,views:w.views,likes:w.likes,comments:w.comments,shares:w.shares,saves:w.saves})));if(h)throw h}return v},onSuccess:()=>{l.invalidateQueries({queryKey:["open-collabs",r==null?void 0:r.id]}),k({title:"Berhasil",description:"Data berhasil ditambahkan"})},onError:t=>{k({title:"Error",description:"Gagal menambahkan data",variant:"destructive"}),console.error("Add open collab error:",t)}})}function ba(){const l=ce(),{currentBrand:r}=J();return me({mutationFn:async({id:t,updates:n})=>{const{error:v}=await q.from("open_collabs").update({campaign:n.campaign,affiliate_name:n.affiliateName,tiktok_handle:n.tiktokHandle,gmv:n.gmv,followers:n.followers,produk:n.produk,no_hp:n.noHp,tanggal_kirim:n.tanggalKirim||null,status_video:n.statusVideo,tgl_posting:n.tglPosting||null,pic:n.pic,status:n.status,reviewer_notes:n.reviewerNotes}).eq("id",t);if(v)throw v},onSuccess:()=>
37{l.invalidateQueries({queryKey:["open-collabs",r==null?void 0:r.id]}),k({title:"Berhasil",description:"Data berhasil diperbarui"})},onError:t=>{k({title:"Error",description:"Gagal memperbarui data",variant:"destructive"}),console.error("Update open collab error:",t)}})}function wa(){const l=ce(),{currentBrand:r}=J();return me({mutationFn:async t=>{const{error:n}=await q.from("open_collabs").delete().in("id",t);if(n)throw n},onSuccess:()=>{l.invalidateQueries({queryKey:["open-collabs",r==null?void 0:r.id]}),k({title:"Berhasil",description:"Data berhasil dihapus"})},onError:t=>{k({title:"Error",description:"Gagal menghapus data",variant:"destructive"}),console.error("Delete open collabs error:",t)}})}function Ca(){const l=ce(),{currentBrand:r}=J();return me({mutationFn:async({ids:t,statusVideo:n})=>{const v={};if(n&&(v.status_video=n),Object.keys(v).length===0)return;const{error:j}=await q.from("open_collabs").update(v).in("id",t);if(j)throw j},onSuccess:()=>{l.invalidateQueries({queryKey:["open-collabs",r==null?void 0:r.id]}),k({title:"Berhasil",description:"Status berhasil diperbarui"})},onError:t=>{k({title:"Error",description:"Gagal memperbarui status",variant:"destructive"}),console.error("Bulk update error:",t)}})}function ya(){const l=ce(),{currentBrand:r}=J();return me({mutationFn:async({openCollabId:t,video:n})=>{const{error:v}=await q.from("open_collab_videos").insert({open_collab_id:t,url:n.url,views:n.views,likes:n.likes,comments:n.comments,shares:n.shares,saves:n.saves});if(v)throw v},onSuccess:()=>{l.invalidateQueries({queryKey:["open-collabs",r==null?void 0:r.id]}),k({title:"Berhasil",description:"Video berhasil ditambahkan"})},onError:t=>{k({title:"Error",description:"Gagal menambahkan video",variant:"destructive"}),console.error("Add video error:",t)}})}const ke=["Belum","Sudah"],g=({label:l,required:r=!1,children:t,error:n})=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs(L,{className:n?"text-destructive":"",children:[l," ",r&&e.jsx("span",{className:"text-destructive",children:"*"})]}),t,n&&e.jsx("p",{className:"text-xs text-destructive",children:n})]});function ut(){var ss;const{campaigns:l}=zs(),{data:r=[],isLoading:t}=Na(),{data:n=[]}=ra(),{data:v=[]}=ia(),j=ka(),h=ba(),w=wa(),U=Ca();ya();const ye=oa(),ue=da(),Y=la(),pe=na(),[c,Se]=o.useState(null),[$,z]=o.useState(""),[d,f]=o.useState(!1),[V,R]=o.useState(new Set),[xs,he]=o.useState(!1),[Pe,_e]=o.useState(""),[gs,Ve]=o.useState(!1),[Me,Ke]=o.useState([]),[Oe,Ie]=o.useState(null),[js,xe]=o.useState(!1),[fs,ge]=o.useState(!1),[je,Fe]=o.useState(null),[i,m]=o.useState({campaign:"",affiliateName:"",tiktokHandle:"",gmv:0,followers:0,produk:"",noHp:"",tanggalKirim:"",statusVideo:"Belum",tglPosting:"",pic:""}),[y,Te]=o.useState({}),[fe,W]=o.useState([{url:"",views:0,likes:0,comments:0,shares:0,saves:0,isLoading:!1,isFetched:!1}]),[Z,Le]=o.useState("all"),[ee,qe]=o.useState("all"),[T,Ue]=o.useState(void 0),[H,Re]=o.useState(void 0),[vs,Be]=o.useState(!1),[Sa,Ns]=o.use
37State(""),[Pa,ks]=o.useState(""),[Va,Ge]=o.useState(!1),$e=async s=>{await navigator.clipboard.writeText(s),Ie(s),k({title:"Tersalin",description:"URL video berhasil disalin"}),setTimeout(()=>Ie(null),2e3)},bs=o.useMemo(()=>[...new Set(r.map(a=>a.produk))].filter(Boolean).sort(),[r]),ws=o.useMemo(()=>[...new Set(r.map(a=>a.statusVideo))].sort(),[r]),S=o.useMemo(()=>r.filter(s=>{if(Z!=="all"&&s.produk!==Z||ee!=="all"&&s.statusVideo!==ee)return!1;if(T||H){const a=s.tanggalKirim?ga(s.tanggalKirim,"yyyy-MM-dd",new Date):null;if(a)if(T&&H){if(!ja(a,{start:T,end:H}))return!1}else{if(T&&a<T)return!1;if(H&&a>H)return!1}else return!1}return!0}),[r,Z,ee,T,H]),se=o.useMemo(()=>{const s=S.length,a=S.reduce((D,M)=>{var A;return D+(((A=M.videos)==null?void 0:A.length)||0)},0),p=S.reduce((D,M)=>{var A;return D+(((A=M.videos)==null?void 0:A.reduce((Q,X)=>Q+X.views,0))||0)},0),N=S.reduce((D,M)=>D+M.gmv,0),C=S.length>0?S.reduce((D,M)=>{var ae,te,P;const A=((ae=M.videos)==null?void 0:ae.reduce((b,ie)=>b+ie.views,0))||0,Q=((te=M.videos)==null?void 0:te.reduce((b,ie)=>b+ie.likes,0))||0,X=((P=M.videos)==null?void 0:P.reduce((b,ie)=>b+ie.comments,0))||0;return D+(A>0?(Q+X)/A*100:0)},0)/S.length:0;return{totalCreators:s,totalVideos:a,totalViews:p,totalGmv:N,avgEngagement:C}},[S]),Cs=()=>{Le("all"),qe("all"),Ue(void 0),Re(void 0)},ys=s=>{h.mutate({id:s.id,updates:{...s,status:"Approved",reviewerNotes:$||"Approved"}}),f(!1),z("")},Ss=s=>{if(!$.trim()){k({title:"Error",description:"Harap berikan catatan untuk penolakan.",variant:"destructive"});return}h.mutate({id:s.id,updates:{...s,status:"Rejected",reviewerNotes:$}}),f(!1),z("")},Ps=s=>{Se(s),z(s.reviewerNotes),f(!0)},Vs=(s,a)=>{const p=r.find(N=>N.id===s);p&&h.mutate({id:s,updates:{...p,statusVideo:a}})},Ts=()=>{if(!Pe){k({title:"Error",description:"Pilih status untuk diubah",variant:"destructive"});return}U.mutate({ids:Array.from(V),statusVideo:Pe||void 0},{onSuccess:()=>{he(!1),_e(""),R(new Set)}})},Hs=s=>{Fe(s),m({campaign:s.campaign,affiliateName:s.affiliateName,tiktokHandle:s.tiktokHandle,gmv:s.gmv,followers:s.followers,produk:s.produk,noHp:s.noHp,tanggalKirim:s.tanggalKirim,statusVideo:s.statusVideo,tglPosting:s.tglPosting,pic:s.pic}),Te({}),xe(!0)},ze=()=>{const s={};return i.campaign||(s.campaign="Campaign wajib diisi"),i.affiliateName||(s.affiliateName="Nama wajib diisi"),i.tiktokHandle||(s.tiktokHandle="TikTok Handle wajib diisi"),Te(s),Object.keys(s).length===0},Ds=()=>{if(je){if(!ze()){k({title:"Error",description:"Mohon lengkapi semua field yang wajib diisi",variant:"destructive"});return}h.mutate({id:je.id,updates:{campaign:i.campaign,affiliateName:i.affiliateName,tiktokHandle:i.tiktokHandle,gmv:i.gmv,followers:i.followers,produk:i.produk,noHp:i.noHp,tanggalKirim:i.tanggalKirim,statusVideo:i.statusVideo,tglPosting:i.tglPosting,pic:i.pic,status:je.status,reviewerNotes:je.reviewerNotes}},{onSuccess:()=>{xe(!1),Fe(null)}})}},We=s=>{Ke(s),Ve(!0)},As=()=>{const s=Me.map(a=>a.id);w.mutate(s,{onSuccess:()=>{R(new Set),Ke([]),Ve(!1)}})},Es=()=>{const s=S.filter(a=>V.has(a.id));We(s)},_s=()=>{m({campaign:"",affiliateName:"",tiktokHandle:"",gmv:0,followers:0,produk:"",noHp:"",tanggalKirim:"",statusVideo:"Belum",tglPosting:"",pic:""}),W([{url:"",views:0,likes:0,comments:0,shares:0,saves:0,isLoading:!1,isFetched:!1}]),Te({}),ge(!0)},Qe=s=>s.includes("tiktok.com")&&s.length>20,Ms=(s,a)=>{Qe(a)&&(W(p=>p.map((N,C)=>C===s?{...N,isLoading:!0}:N)),setTimeout(()=>{const p={views:Math.floor(Math.random()*9e4)+1e4,likes:Math.floor(Math.random()*9e3)+1e3,comments:Math.floor(Math.random()*900)+100,shares:Math.floor(Math.random()*500)+50,saves:Math.floor(Math.random()*300)+30};W(N=>N.map((C,D)=>D===s?{...C,...p,isLoading:!1,isFetched:!0}:C))},1e3))},Ks=(s,a)=>{W(p=>p.map((N,C)=>C===s?{...N,url:a,isFetched:!1}:N)),Qe(a)&&Ms(s,a)},Os=()=>{W(s=>[...s,{url:"",views:0,likes:0,comments:0,shares:0,saves:0,isLoading:!1,isFetched:!1}])},Is=s=>{fe.length<=1||W(a=>a.filter((p,N)=>N!==s))},Fs=()=>{if(!ze()){k({title:"Error",description:"Mohon lengkapi semua field yang wajib diisi",variant:"destructive"});return}const s=fe.filter(a=>a.url.trim()!=="");j.mutate({collab:{campaign:i.campaign,affiliateName:i.affiliateName,tiktokHandle:i.tiktokHandle,gmv:i.gmv,followers:i.followers,produk:i.produk,noHp:i.noHp,tanggalKirim:i.tanggalKirim,statusVideo:i.statusVideo,tglPosting:i.tglPosting,pic:i.pic,status:"Pending",reviewerNotes:""},videos:s.map(a=>({url:a.url,views:a.views,likes:a.likes,comments:a.comments,shares:a.shares,saves:a.saves}))},{onSuccess:()=>{ge(!1)}})},Xe=s=>{ye.mutate(s)},Je=s=>{ue.mutate(s),i.produk===s&&m(a=>({...a,produk:""}))},Ye=s=>{Y.mutate(s)},Ze=s=>{pe.mutate(s),i.pic===s&&m(a=>({...a,pic:""}))},es=s=>{Ns(s.noHp||""),ks(s.affiliateName),Be(!0)},x=s=>
37s.toLocaleString("id-ID"),He=s=>`Rp ${s.toLocaleString("id-ID")}`,Ls=[{key:"campaign",label:"Campaign",selected:!0},{key:"affiliateName",label:"Nama",selected:!0},{key:"tiktokHandle",label:"TikTok Handle",selected:!0},{key:"gmv",label:"GMV",selected:!0},{key:"followers",label:"Followers",selected:!0},{key:"produk",label:"Produk",selected:!0},{key:"noHp",label:"No HP",selected:!0},{key:"statusVideo",label:"Status Video",selected:!0},{key:"pic",label:"PIC",selected:!0}],qs=[{id:"no",header:"No",cell:(s,a)=>(a??0)+1,width:60},{id:"campaign",header:"Campaign",accessorKey:"campaign"},{id:"affiliateName",header:"Nama",accessorKey:"affiliateName"},{id:"tiktokHandle",header:"TikTok",accessorKey:"tiktokHandle",cell:s=>e.jsxs("a",{href:`https://tiktok.com/${s.tiktokHandle}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:[s.tiktokHandle,e.jsx(we,{className:"h-3 w-3"})]})},{id:"gmv",header:"GMV",accessorKey:"gmv",cell:s=>He(s.gmv)},{id:"followers",header:"Follower",accessorKey:"followers",cell:s=>x(s.followers)},{id:"produk",header:"Produk",accessorKey:"produk",sortable:!0},{id:"noHp",header:"No HP",accessorKey:"noHp",cell:s=>s.noHp?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:s.noHp}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:a=>{a.stopPropagation(),es(s)},children:e.jsx(xa,{className:"h-3 w-3 text-green-600"})})]}):"-"},{id:"tanggalKirim",header:"Tgl Kirim",accessorKey:"tanggalKirim",sortable:!0},{id:"statusVideo",header:"Status Video",accessorKey:"statusVideo",cell:s=>e.jsxs(K,{value:s.statusVideo,onValueChange:a=>Vs(s.id,a),children:[e.jsx(O,{className:"w-[100px] h-8",children:e.jsx(De,{status:s.statusVideo})}),e.jsx(I,{children:ke.map(a=>e.jsx(_,{value:a,children:a},a))})]}),sortable:!0},{id:"tglPosting",header:"Tgl Posting",accessorKey:"tglPosting",sortable:!0},{id:"videos",header:"Video",cell:s=>s.videos&&s.videos.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:s.videos.map((a,p)=>e.jsx("div",{className:"flex flex-col gap-0.5 p-1.5 bg-muted/30 rounded text-xs",children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:[e.jsx(we,{className:"h-3 w-3"}),"Video ",p+1]}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>$e(a.url),children:Oe===a.url?e.jsx(Ee,{className:"h-3 w-3 text-green-500"}):e.jsx(Ce,{className:"h-3 w-3"})})]})},p))}):e.jsx("span",{className:"text-muted-foreground",children:"-"})},{id:"totalViews",header:"Total View",cell:s=>{var p;const a=((p=s.videos)==null?void 0:p.reduce((N,C)=>N+C.views,0))||0;return x(a)}},{id:"totalLikes",header:"Total Like",cell:s=>{var p;const a=((p=s.videos)==null?void 0:p.reduce((N,C)=>N+C.likes,0))||0;return x(a)}},{id:"engagementRate",header:"Engagement Rate",cell:s=>{var A,Q,X,ae,te;const a=((A=s.videos)==null?void 0:A.reduce((P,b)=>P+b.views,0))||0,p=((Q=s.videos)==null?void 0:Q.reduce((P,b)=>P+b.likes,0))||0,N=((X=s.videos)==null?void 0:X.reduce((P,b)=>P+b.comments,0))||0,C=((ae=s.videos)==null?void 0:ae.reduce((P,b)=>P+b.shares,0))||0,D=((te=s.videos)==null?void 0:te.reduce((P,b)=>P+b.saves,0))||0;return`${(a>0?(p+N+C+D)/a*100:0).toFixed(2)}%`}},{id:"pic",header:"PIC",accessorKey:"pic",sortable:!0},{id:"actions",header:"Review",cell:s=>e.jsxs(u,{variant:"outline",size:"sm",onClick:()=>Ps(s),children:[e.jsx(us,{className:"h-4 w-4 mr-1"}),"Review"]})}];return t?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(le,{className:"h-8 w-8 animate-spin text-primary"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Open Collab"}),e.jsx("p",{className:"text-muted-foreground",children:"Kelola pendaftaran creator untuk campaign"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(u,{variant:"outline",onClick:()=>Ge(!0),children:[e.jsx(ma,{className:"h-4 w-4 mr-2"}),"Export"]}),e.jsxs(u,{onClick:_s,children:[e.jsx(ms,{className:"h-4 w-4 mr-2"}),"Upload Konten"]})]})]}
37),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[e.jsx(B,{children:e.jsx(G,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10",children:e.jsx(Us,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Creator"}),e.jsx("p",{className:"text-xl font-bold",children:x(se.totalCreators)})]})]})})}),e.jsx(B,{children:e.jsx(G,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-blue-500/10",children:e.jsx(ua,{className:"h-5 w-5 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Video"}),e.jsx("p",{className:"text-xl font-bold",children:x(se.totalVideos)})]})]})})}),e.jsx(B,{children:e.jsx(G,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-purple-500/10",children:e.jsx(us,{className:"h-5 w-5 text-purple-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Views"}),e.jsx("p",{className:"text-xl font-bold",children:x(se.totalViews)})]})]})})}),e.jsx(B,{children:e.jsx(G,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-green-500/10",children:e.jsx(Rs,{className:"h-5 w-5 text-green-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total GMV"}),e.jsx("p",{className:"text-xl font-bold",children:He(se.totalGmv)})]})]})})}),e.jsx(B,{children:e.jsx(G,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-orange-500/10",children:e.jsx(Ae,{className:"h-5 w-5 text-orange-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Avg Engagement"}),e.jsxs("p",{className:"text-xl font-bold",children:[se.avgEngagement.toFixed(2),"%"]})]})]})})})]}),e.jsx(B,{children:e.jsx(G,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Produk:"}),e.jsxs(K,{value:Z,onValueChange:Le,children:[e.jsx(O,{className:"w-[180px]",children:e.jsx(F,{placeholder:"Semua Produk"})}),e.jsxs(I,{children:[e.jsx(_,{value:"all",children:"Semua Produk"}),bs.map(s=>e.jsx(_,{value:s,children:s},s))]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Status Video:"}),e.jsxs(K,{value:ee,onValueChange:qe,children:[e.jsx(O,{className:"w-[150px]",children:e.jsx(F,{placeholder:"Semua"})}),e.jsxs(I,{children:[e.jsx(_,{value:"all",children:"Semua"}),ws.map(s=>e.jsx(_,{value:s,children:s},s))]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Dari:"}),e.jsxs(as,{children:[e.jsx(ts,{asChild:!0,children:e.jsxs(u,{variant:"outline",className:ve("w-[150px] justify-start text-left font-normal",!T&&"text-muted-foreground"),children:[e.jsx(is,{className:"mr-2 h-4 w-4"}),T?ls(T,"dd MMM yyyy",{locale:os}):"Pilih tanggal"]})}),e.jsx(ns,{className:"w-auto p-0",align:"start",children:e.jsx(rs,{mode:"single",selected:T,onSelect:Ue,initialFocus:!0,className:ve("p-3 pointer-events-auto")})})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Sampai:"}),e.jsxs(as,{children:[e.jsx(ts,{asChild:!0,children:e.jsxs(u,{variant:"outline",className:ve("w-[150px] justify-start text-left font-normal",!H&&"text-muted-foreground"),children:[e.jsx(is,{className:"mr-2 h-4 w-4"}),H?ls(H,"dd MMM yyyy",{locale:os}):"Pilih tanggal"]})}),e.jsx(ns,{className:"w-auto p-0",align:"start",children:e.jsx(rs,{mode:"single",selected:H,onSelect:Re,initialFocus:!0,className:ve("p-3 pointer-events-auto")})})]})]}),(Z!=="all"||ee!=="all"||T||H)&&e.jsxs(u,{variant:"ghost",size:"sm",onClick:Cs,children:[e.jsx(Bs,{className:"h-4 w-4 mr-1"}),"Reset Filter"]})]})})}),e.jsx(B,{children:e.jsxs(G,{className:"pt-6",children:[e.jsx(Ws,{selectedCount:V.size,onUpdateStatus:()=>he(!0),onDelete:Es,onExport:()=>Ge(!0),onClear:()=>R(new Set)}),e.jsx($s,{data:S,columns:qs,isLoading:t,onEdit:s=>Hs(s),onDelete:s=>We(Array.isArray(s)?s:[s]),searchPlaceholder:"Cari creator...",selectedIds:V,onSelectionChange:R})]})}),e.jsx(fa,{contacts:S.filter(s=>V.has(s.id)&&s.noHp).map(s=>({id:s.id,name:s.affiliateName,phone:s.noHp||""})),open:vs,onOpenChange:Be}),e.jsx(Qs,{data:S,columns:Ls,filename:"open-collab",title:"Data Open Collab",children:e.jsx(u,{variant:"outline",className:"hidden"})}),e.jsx(ne,{open:d,onOpenChange:f,children:e.jsxs(re,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[e.jsx(oe,{children:e.jsx(de,{children:"Review Creator - Detail Lengkap"})}),c&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-primary",children:"Info Creator"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 p-3 bg-muted/50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Nama"}),e.jsx("p",{className:"font-medium",children:c.affiliateName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"TikTok"}),e.jsx("p",{className:"font-medium",children:c.tiktokHandle})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Follower"}),e.jsx("p",{className:"font-medium",children:x(c.followers)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"GMV"}),e.jsx("p",{className:"font-medium",children:He(c.gmv)})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-primary",children:"Info Campaign & Produk"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 p-3 bg-muted/50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Campaign"}),e.jsx("p",{className:"font-medium",children:c.campaign})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Produk"}),e.jsx("p",{className:"font-medium",children:c.produk||"-"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"PIC"}),e.jsx("p",{className:"font-medium",children:c.pic||"-"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-primary",children:"Info Kontak"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 p-3 bg-muted/50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"No HP"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-medium",children:c.noHp||"-"}),c.noHp&&e.jsxs(u,{variant:"outline",size:"sm",onClick:()=>es(c),children:[e.jsx(Ae,{className:"h-4 w-4 mr-1"}),"WhatsApp"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Tanggal Kirim"}),e.jsx("p",{className:"font-medium",children:c.tanggalKirim||"-"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-primary",children:"Video"}),e.jsxs("div",{className:"p-3 bg-muted/50 rounded-lg space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Video (",((ss=c.videos)==null?void 0:ss.length)||0,")"]}),e.jsxs("span",{className:"text-xs",children:["Status: ",e.jsx(De,{status:c.statusVideo})]})]}),c.videos&&c.videos.length>0?e.jsxs("div",{className:"space-y-3",children:[c.videos.map((s,a)=>e.jsxs("div",{className:"p-3 border rounded-lg space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium text-sm",children:["Video ",a+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1 text-sm",children:[e.jsx(we,{className:"h-3 w-3"}),"Lihat Video"]}),e.jsx(u,{variant:"ghost",size:"sm",onClick:()=>$e(s.url),children:Oe===s.url?e.jsx(Ee,{className:"h-4 w-4 text-green-500"}):e.jsx(Ce,{className:"h-4 w-4"})})]})]}
37),e.jsxs("div",{className:"grid grid-cols-5 gap-2 text-xs",children:[e.jsxs("div",{className:"text-center p-2 bg-background rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Views"}),e.jsx("p",{className:"font-bold",children:x(s.views)})]}),e.jsxs("div",{className:"text-center p-2 bg-background rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Likes"}),e.jsx("p",{className:"font-bold",children:x(s.likes)})]}),e.jsxs("div",{className:"text-center p-2 bg-background rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Comments"}),e.jsx("p",{className:"font-bold",children:x(s.comments)})]}),e.jsxs("div",{className:"text-center p-2 bg-background rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Shares"}),e.jsx("p",{className:"font-bold",children:x(s.shares)})]}),e.jsxs("div",{className:"text-center p-2 bg-background rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Saves"}),e.jsx("p",{className:"font-bold",children:x(s.saves)})]})]})]},a)),e.jsxs("div",{className:"p-3 border-t space-y-2",children:[e.jsx("h4",{className:"text-sm font-medium",children:"Total Engagement"}),e.jsxs("div",{className:"grid grid-cols-5 gap-2 text-xs",children:[e.jsxs("div",{className:"text-center p-2 bg-primary/10 rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Views"}),e.jsx("p",{className:"font-bold text-primary",children:x(c.videos.reduce((s,a)=>s+a.views,0))})]}),e.jsxs("div",{className:"text-center p-2 bg-primary/10 rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Likes"}),e.jsx("p",{className:"font-bold text-primary",children:x(c.videos.reduce((s,a)=>s+a.likes,0))})]}),e.jsxs("div",{className:"text-center p-2 bg-primary/10 rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Comments"}),e.jsx("p",{className:"font-bold text-primary",children:x(c.videos.reduce((s,a)=>s+a.comments,0))})]}),e.jsxs("div",{className:"text-center p-2 bg-primary/10 rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Shares"}),e.jsx("p",{className:"font-bold text-primary",children:x(c.videos.reduce((s,a)=>s+a.shares,0))})]}),e.jsxs("div",{className:"text-center p-2 bg-primary/10 rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Saves"}),e.jsx("p",{className:"font-bold text-primary",children:x(c.videos.reduce((s,a)=>s+a.saves,0))})]})]})]})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Belum ada video"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-primary",children:"Review"}),e.jsxs("div",{className:"space-y-3 p-3 bg-muted/50 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm",children:"Status Saat Ini:"}),e.jsx(De,{status:c.status})]}),e.jsx(hs,{placeholder:"Catatan reviewer...",value:$,onChange:s=>z(s.target.value),rows:3}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(u,{onClick:()=>ys(c),disabled:h.isPending,className:"bg-green-600 hover:bg-green-700",children:[e.jsx(pa,{className:"h-4 w-4 mr-1"}),"Approve"]}),e.jsxs(u,{variant:"destructive",onClick:()=>Ss(c),disabled:h.isPending,children:[e.jsx(ha,{className:"h-4 w-4 mr-1"}),"Reject"]})]})]})]})]})]})}),e.jsx(ne,{open:xs,onOpenChange:he,children:e.jsxs(re,{children:[e.jsx(oe,{children:e.jsxs(de,{children:["Bulk Edit - ",V.size," Item"]})}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{children:"Status Video"}),e.jsxs(K,{value:Pe,onValueChange:_e,children:[e.jsx(O,{children:e.jsx(F,{placeholder:"Pilih status video"})}),e.jsx(I,{children:ke.map(s=>e.jsx(_,{value:s,children:s},s))})]})]})}),e.jsxs(be,{children:[e.jsx(u,{variant:"outline",onClick:()=>he(!1),children:"Batal"}),e.jsxs(u,{onClick:Ts,disabled:U.isPending,children:[U.isPending&&e.jsx(le,{className:"h-4 w-4 mr-2 animate-spin"}),"Simpan Perubahan"]})]})]})}),e.jsx(ne,{open:js,onOpenChange:xe,children:e.jsxs(re,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(oe,{children:e.jsx(de,{children:"Edit Data"})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 py-4",children:[e.jsx(g,{label:"Campaign",name:"campaign",required:!0,error:y.campaign,children:e.jsxs(K,{value:i.campaign,onValueChange:s=>m(a=>({...a,campaign:s})),children:[e.jsx(O,{className:y.campaign?"border-destructive":"",children:e.jsx(F,{placeholder:"Pilih campaign"})}),e.jsx(I,{children:l.map(s=>e.jsx(_,{value:s.name,children:s.name},s.id))})]})}),e.jsx(g,{label:"Nama",name:"affiliateName",required:!0,error:y.affiliateName,children:e.jsx(E,{value:i.affiliateName,onChange:s=>m(a=>({...a,affiliateName:s.target.value})),className:y.affiliateName?"border-destructive":""})}),e.jsx(g,{label:"TikTok Handle",name:"tiktokHandle",required:!0,error:y.tiktokHandle,children:e.jsx(E,{value:i.tiktokHandle,onChange:s=>m(a=>({...a,tiktokHandle:s.target.value})),className:y.tiktokHandle?"border-destructive":""})}),e.jsx(g,{label:"Followers",name:"followers",children:e.jsx(E,{type:"number",value:i.followers,onChange:s=>m(a=>({...a,followers:Number(s.target.value)}))})}),e.jsx(g,{label:"GMV",name:"gmv",children:e.jsx(ds,{value:i.gmv,onChange:s=>m(a=>({...a,gmv:s}))})}),e.jsx(g,{label:"Produk",name:"produk",children:e.jsx(Ne,{options:n,value:i.produk,onChange:s=>m(a=>({...a,produk:s})),onAddNew:Xe,onDelete:Je,placeholder:"Pilih atau tambah produk"})}),e.jsx(g,{label:"No HP",name:"noHp",children:e.jsx(cs,{value:i.noHp,onChange:s=>m(a=>({...a,noHp:s}))})}),e.jsx(g,{label:"Tanggal Kirim",name:"tanggalKirim",children:e.jsx(E,{type:"date",value:i.tanggalKirim,onChange:s=>m(a=>({...a,tanggalKirim:s.target.value}))})}),e.jsx(g,{label:"Status Video",name:"statusVideo",children:e.jsxs(K,{value:i.statusVideo,onValueChange:s=>m(a=>({...a,statusVideo:s})),children:[e.jsx(O,{children:e.jsx(F,{})}),e.jsx(I,{children:ke.map(s=>e.jsx(_,{value:s,children:s},s))})]})}),e.jsx(g,{label:"Tgl Posting",name:"tglPosting",children:e.jsx(E,{type:"date",value:i.tglPosting,onChange:s=>m(a=>({...a,tglPosting:s.target.value}))})}),e.jsx(g,{label:"PIC",name:"pic",children:e.jsx(Ne,{options:v,value:i.pic,onChange:s=>m(a=>({...a,pic:s})),onAddNew:Ye,onDelete:Ze,placeholder:"Pilih atau tambah PIC"})})]}),e.jsxs(be,{children:[e.jsx(u,{variant:"outline",onClick:()=>xe(!1),children:"Batal"}),e.jsxs(u,{onClick:Ds,disabled:h.isPending,children:[h.isPending&&e.jsx(le,{className:"h-4 w-4 mr-2 animate-spin"}),"Simpan"]})]})]})}),e.jsx(ne,{open:fs,onOpenChange:ge,children:e.jsxs(re,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(oe,{children:e.jsx(de,{children:"Upload Konten Baru"})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 py-4",children:[e.jsx(g,{label:"Campaign",name:"campaign",required:!0,error:y.campaign,children:e.jsxs(K,{value:i.campaign,onValueChange:s=>m(a=>({...a,campaign:s})),children:[e.jsx(O,{className:y.campaign?"border-destructive":"",children:e.jsx(F,{placeholder:"Pilih campaign"})}),e.jsx(I,{children:l.map(s=>e.jsx(_,{value:s.name,children:s.name},s.id))})]})}),e.jsx(g,{label:"Nama",name:"affiliateName",required:!0,error:y.affiliateName,children:e.jsx(E,{value:i.affiliateName,onChange:s=>m(a=>({...a,affiliateName:s.target.value})),className:y.affiliateName?"border-destructive":""})}),e.jsx(g,{label:"TikTok Handle",name:"tiktokHandle",required:!0,error:y.tiktokHandle,children:e.jsx(E,{value:i.tiktokHandle,onChange:s=>m(a=>({...a,tiktokHandle:s.target.value})),className:y.tiktokHandle?"border-destructive":""})}),e.jsx(g,{label:"Followers",name:"followers",children:e.jsx(E,{type:"number",value:i.followers,onChange:s=>m(a=>({...a,followers:Number(s.target.value)}))})}),e.jsx(g,{label:"GMV",name:"gmv",children:e.jsx(ds,{value:i.gmv,onChange:s=>m(a=>({...a,gmv:s}))})}),e.jsx(g,{label:"Produk",name:"produk",children:e.jsx(Ne,{options:n,value:i.produk,onChange:s=>m(a=>({...a,produk:s})),onAddNew:Xe,onDelete:Je,placeholder:"Pilih atau tambah produk"})}),e.jsx(g,{label:"No HP",name:"noHp",children:e.jsx(cs,{value:i.noHp,onChange:s=>m(a=>({...a,noHp:s}))})}),e.jsx(g,{label:"Tanggal Kirim",name:"tanggalKirim",children:e.jsx(E,{type:"date",value:i.tanggalKirim,onChange:s=>m(a=>({...a,tanggalKirim:s.target.value}))})}),e.jsx(g,{label:"Status Video",name:"statusVideo",children:e.jsxs(K,{value:i.statusVideo,onValueChange:s=>m(a=>({...a,statusVideo:s})),children:[e.jsx(O,{children:e.jsx(F,{})}),e.jsx(I,{children:ke.map(s=>e.jsx(_,{value:s,children:s},s))})]})}),e.jsx(g,{label:"Tgl Posting",name:"tglPosting",children:e.jsx(E,{type:"date",value:i.tglPosting,onChange:s=>m(a=>({...a,tglPosting:s.target.value}))})}),e.jsx(g,{label:"PIC",name:"pic",children:e.jsx(Ne,{options:v,value:i.pic,onChange:s=>m(a=>({...a,pic:s})),onAddNew:Ye,onDelete:Ze,placeholder:"Pilih atau tambah PIC"})}),e.jsxs("div",{className:"col-span-2 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(L,{children:"Video URL"}),e.jsxs(u,{type:"button",variant:"outline",size:"sm",onClick:Os,children:[e.jsx(ms,{className:"h-4 w-4 mr-1"}),"Tambah Video"]})]}),fe.map((s,a)=>e.jsxs("div",{className:"space-y-2 p-3 border rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{placeholder:"https://tiktok.com/@username/video/...",value:s.url,onChange:p=>Ks(a,p.target.value),className:"flex-1"}),fe.length>1&&e.jsx(u,{type:"button",variant:"ghost",size:"icon",onClick:()=>Is(a),children:e.jsx(Gs,{className:"h-4 w-4 text-destructive"})})]}),s.isLoading&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(le,{className:"h-4 w-4 animate-spin"}),"Mengambil data engagement..."]}
37),s.isFetched&&e.jsxs("div",{className:"grid grid-cols-5 gap-2 text-xs",children:[e.jsxs("div",{className:"text-center p-2 bg-muted rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Views"}),e.jsx("p",{className:"font-bold",children:x(s.views)})]}),e.jsxs("div",{className:"text-center p-2 bg-muted rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Likes"}),e.jsx("p",{className:"font-bold",children:x(s.likes)})]}),e.jsxs("div",{className:"text-center p-2 bg-muted rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Comments"}),e.jsx("p",{className:"font-bold",children:x(s.comments)})]}),e.jsxs("div",{className:"text-center p-2 bg-muted rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Shares"}),e.jsx("p",{className:"font-bold",children:x(s.shares)})]}),e.jsxs("div",{className:"text-center p-2 bg-muted rounded",children:[e.jsx("p",{className:"text-muted-foreground",children:"Saves"}),e.jsx("p",{className:"font-bold",children:x(s.saves)})]})]})]},a))]})]}),e.jsxs(be,{children:[e.jsx(u,{variant:"outline",onClick:()=>ge(!1),children:"Batal"}),e.jsxs(u,{onClick:Fs,disabled:j.isPending,children:[j.isPending&&e.jsx(le,{className:"h-4 w-4 mr-2 animate-spin"}),"Simpan"]})]})]})}),e.jsx(Xs,{open:gs,onOpenChange:Ve,children:e.jsxs(Js,{children:[e.jsxs(Ys,{children:[e.jsx(Zs,{children:"Hapus Data"}),e.jsxs(ea,{children:["Apakah Anda yakin ingin menghapus ",Me.length," data? Tindakan ini tidak dapat dibatalkan."]})]}),e.jsxs(sa,{children:[e.jsx(aa,{children:"Batal"}),e.jsx(ta,{onClick:As,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Hapus"})]})]})})]})}export{ut 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.