(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,46003,e=>{"use strict";let a=async e=>{if(!e)return"";try{let a=new FormData;a.append("file",e);let r=await fetch("/api/upload",{method:"POST",body:a});if(!r.ok)throw Error("Server returned error status "+r.status);let t=await r.json();if(t.success&&t.url)return t.url;throw Error(t.error||"Gagal menyimpan berkas di server")}catch(e){throw console.error("Upload failed: ",e),e}};e.s(["uploadImage",0,a])},8055,e=>{"use strict";var a=e.i(78117),r=e.i(68306),t=e.i(29683),s=e.i(46003),l=e.i(23665);let i=(0,l.createServerReference)("60d5b2f540e519e1e89fbe7a47ea94a1b6d383ba26",l.callServer,void 0,l.findSourceMapURL,"updateOrganigramDpm");var n=e.i(99213),o=e.i(59441);function d({profilId:e,initialUrl:l}){let[d,c]=(0,r.useState)(null),[u,m]=(0,r.useState)(l),[h,f]=(0,r.useState)(!1),g=async()=>{if(!d)return void t.toast.error("Pilih file terlebih dahulu");f(!0);try{let a=await (0,s.uploadImage)(d),r=await i(e,a);r.success?(t.toast.success(r.message),m(a),c(null)):t.toast.error(r.message)}catch(e){t.toast.error(e.message)}finally{f(!1)}},p=d?URL.createObjectURL(d):u;return(0,a.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,a.jsxs)("div",{className:"flex-1 space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-xl font-bold text-slate-800",children:"Organigram DPM"}),(0,a.jsx)("p",{className:"text-slate-500 text-sm mt-1",children:"Unggah bagan struktur organisasi Dewan Perwakilan Mahasiswa."})]}),(0,a.jsx)("div",{className:"space-y-2",children:(0,a.jsx)(o.Input,{type:"file",accept:"image/*",onChange:e=>c(e.target.files?.[0]||null)})}),(0,a.jsx)(n.Button,{onClick:g,disabled:!d||h,children:h?"Menyimpan...":"Simpan Organigram"})]}),(0,a.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:p?(0,a.jsx)("img",{src:p,alt:"Organigram",className:"w-full h-full object-contain"}):(0,a.jsx)("span",{className:"text-slate-400 text-sm font-medium",children:"Belum ada bagan"})})]})}e.s(["default",()=>d],8055)}]);