module.exports=[69473,a=>{"use strict";let b=async a=>{if(!a)return"";try{let b=new FormData;b.append("file",a);let c=await fetch("/api/upload",{method:"POST",body:b});if(!c.ok)throw Error("Server returned error status "+c.status);let d=await c.json();if(d.success&&d.url)return d.url;throw Error(d.error||"Gagal menyimpan berkas di server")}catch(a){throw console.error("Upload failed: ",a),a}};a.s(["uploadImage",0,b])},50879,a=>{"use strict";var b=a.i(81139),c=a.i(99718),d=a.i(6285),e=a.i(69473),f=a.i(91243);let g=(0,f.createServerReference)("60d5b2f540e519e1e89fbe7a47ea94a1b6d383ba26",f.callServer,void 0,f.findSourceMapURL,"updateOrganigramDpm");var h=a.i(73086),i=a.i(13461);function j({profilId:a,initialUrl:f}){let[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(f),[n,o]=(0,c.useState)(!1),p=async()=>{if(!j)return void d.toast.error("Pilih file terlebih dahulu");o(!0);try{let b=await (0,e.uploadImage)(j),c=await g(a,b);c.success?(d.toast.success(c.message),m(b),k(null)):d.toast.error(c.message)}catch(a){d.toast.error(a.message)}finally{o(!1)}},q=j?URL.createObjectURL(j):l;return(0,b.jsxs)("div",{className:"bg-white border border-slate-200 rounded-3xl p-8 relative overflow-hidden flex flex-col md:flex-row gap-6 shadow-sm",children:[(0,b.jsxs)("div",{className:"flex-1 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-xl font-bold text-slate-800",children:"Organigram DPM"}),(0,b.jsx)("p",{className:"text-slate-500 text-sm mt-1",children:"Unggah bagan struktur organisasi Dewan Perwakilan Mahasiswa."})]}),(0,b.jsx)("div",{className:"space-y-2",children:(0,b.jsx)(i.Input,{type:"file",accept:"image/*",onChange:a=>k(a.target.files?.[0]||null)})}),(0,b.jsx)(h.Button,{onClick:p,disabled:!j||n,children:n?"Menyimpan...":"Simpan Organigram"})]}),(0,b.jsx)("div",{className:"w-full md:w-1/3 aspect-video bg-slate-50 border-2 border-dashed border-slate-200 rounded-xl flex items-center justify-center overflow-hidden",children:q?(0,b.jsx)("img",{src:q,alt:"Organigram",className:"w-full h-full object-contain"}):(0,b.jsx)("span",{className:"text-slate-400 text-sm font-medium",children:"Belum ada bagan"})})]})}a.s(["default",()=>j],50879)}];

//# sourceMappingURL=_gemini_antigravity_scratch_HMF%20FPMIPA%20UPI_src_1a53385f._.js.map