1import{u as P,j as e,x as C,Y as z,Z as S,aE as T,y as D,L as h,I as f,z as F,D as J,E as W,J as U,K as V,r as A,B as b,ab as M,aP as ae,T as O,aD as oe,bn as G,c as y,s as $,ac as H,bw as B,$ as R,p as re,bP as q,w as X,M as K,aW as L,U as Y,t as Z,bu as de,v as xe,C as Q,a as he,R as me,a_ as ge,a$ as ue,b1 as je,l as pe,aL as ve,bX as fe,cu as Ne,bW as be}from"./index-BR70Jv3h.js";import{A as ee}from"./AiTranslateButton-BRz-v0Ix.js";import{V as _e}from"./video-BxKjUZNr.js";import{G as se}from"./grip-vertical-kc9SXPWS.js";import{M as ye}from"./medal-sK-FwD0U.js";import"./globe-s6baTepi.js";function we({data:r,onChange:c}){const{language:o}=P(),s=o==="ar",t=[{value:"technology",label:s?"Ø§ÙØªÙÙÙØ©":"Technology"},{value:"ai",label:s?"Ø§ÙØ°Ùاء Ø§ÙØ§ØµØ·ÙاعÙ":"Artificial Intelligence"},{value:"fintech",label:s?"Ø§ÙØªÙÙÙØ© اÙÙ
اÙÙØ©":"FinTech"},{value:"healthcare",label:s?"Ø§ÙØµØØ©":"Healthcare"},{value:"education",label:s?"Ø§ÙØªØ¹ÙÙÙ
":"Education"},{value:"sustainability",label:s?"Ø§ÙØ§Ø³ØªØ¯Ø§Ù
Ø©":"Sustainability"},{value:"social",label:s?"Ø§ÙØ§Ø¨ØªÙار Ø§ÙØ§Ø¬ØªÙ
اعÙ":"Social Innovation"},{value:"other",label:s?"أخرÙ":"Other"}],g=[{value:"online",label:s?"Ø¹Ù Ø¨ÙØ¹Ø¯":"Online"},{value:"onsite",label:s?"ØØ¶ÙرÙ":"On-site"},{value:"hybrid",label:s?"Ù
Ø®ØªÙØ·":"Hybrid"}];return e.jsx("div",{className:"space-y-6",dir:s?"rtl":"ltr",children:e.jsxs(C,{children:[e.jsxs(z,{children:[e.jsx(S,{className:s?"text-right":"text-left",children:s?"اÙÙ
عÙÙÙ
ات Ø§ÙØ£Ø³Ø§Ø³ÙØ©":"Basic Information"}),e.jsx(T,{className:s?"text-right":"text-left",children:s?"أدخ٠اسÙ
اÙÙØ§ÙاثÙÙ ÙØ§ÙÙØ¦Ø© ÙÙÙØ¹ اÙÙØ¹Ø§ÙÙØ©":"Enter hackathon name, category, and event type"})]}),e.jsxs(D,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(h,{className:s?"text-right block":"text-left block",children:[s?"اسÙ
اÙÙØ§ÙاثÙÙ":"Hackathon Title"," *"]}),e.jsx(f,{value:r.title,onChange:a=>c({title:a.target.value}),placeholder:s?"Ù
ثاÙ: ÙØ§ÙاثÙÙ Ø§ÙØ§Ø¨ØªÙار 2024":"e.g., Innovation Hackathon 2024",className:s?"text-right":"text-left"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(h,{className:s?"text-right block":"text-left block",children:[s?"اÙÙØ¦Ø©":"Category"," *"]}),e.jsxs(F,{value:r.category,onValueChange:a=>c({category:a}),children:[e.jsx(J,{className:s?"text-right":"text-left",children:e.jsx(W,{placeholder:s?"اختر اÙÙØ¦Ø©":"Select category"})}),e.jsx(U,{children:t.map(a=>e.jsx(V,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(h,{className:s?"text-right block":"text-left block",children:[s?"ÙÙØ¹ اÙÙØ¹Ø§ÙÙØ©":"Event Type"," *"]}),e.jsxs(F,{value:r.event_type,onValueChange:a=>c({event_type:a}),children:[e.jsx(J,{className:s?"text-right":"text-left",children:e.jsx(W,{placeholder:s?"اختر ÙÙØ¹ اÙÙØ¹Ø§ÙÙØ©":"Select event type"})}),e.jsx(U,{children:g.map(a=>e.jsx(V,{value:a.value,children:a.label},a.value))})]})]})]})]})})}function ke({data:r,hackathonTitle:c,onChange:o}){const{language:s}=P(),t=s==="ar",[g,a]=A.useState(!1),w=async()=>{if(!c){y.error(t?"ÙØ±Ø¬Ù إدخا٠اسÙ
اÙÙØ§ÙاثÙ٠أÙÙØ§Ù":"Please enter hackathon title first");return}a(!0);try{const{data:l,error:i}=await $.functions.invoke("generate-field-text",{body:{fieldType:"hackathon_description",language:t?"ar":"en",context:{hackathonName:c}}});if(i)throw i;l!=null&&l.text&&(o({description:l.text}),y.success(t?"تÙ
تÙÙÙØ¯ اÙÙØµÙ Ø¨ÙØ¬Ø§Ø":"Description generated successfully"))}catch(l){console.error("Error generating description:",l),y.error(t?"ÙØ´Ù Ù٠تÙÙÙØ¯ اÙÙØµÙ":"Failed to generate description")}finally{a(!1)}},N=r.banner_type||"image";return e.jsx("div",{className:"space-y-6",dir:t?"rtl":"ltr",children:e.jsxs(C,{children:[e.jsxs(z,{children:[e.jsx(S,{className:t?"text-right":"text-left",children:t?"اÙÙØµÙ ÙØ§ÙØµÙØ±Ø©":"Description & Banner"}),e.jsx(T,{className:t?"text-right":"text-left",children:t?"Ø£Ø¶Ù ÙØµÙØ§Ù Ø¬Ø°Ø§Ø¨Ø§Ù ÙØµÙرة Ø±Ø¦ÙØ³ÙØ© ÙÙÙØ§ÙاثÙÙ":"Add an engaging description and banner image"})]}),e.jsxs(D,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:`flex items-center justify-between ${t?"flex-row-reverse":""}`,children:[e.jsxs(h,{className:t?"text-right":"text-left",children:[t?"ÙØµÙ اÙÙØ§ÙاثÙÙ":"Hackathon Description"," *"]}),e.jsxs(b,{type:"button",variant:"outline",size:"sm",onClick:w,disabled:g,className:`gap-2 ${t?"flex-row-reverse":""}`,children:[g?e.jsx(M,{className:"h-4 w-4 animate-spin"}):e.jsx(ae,{className:"h-4 w-4"}),t?"Ø§ÙØªØ±Ø§Ø Ø¨Ø§ÙØ°Ùاء Ø§ÙØ§ØµØ·ÙاعÙ":"AI Suggest"]})]}),e.jsx(O,{value:r.description,onChange:l=>o({description:l.target.value}),placeholder:t?"Ø§ÙØªØ¨ ÙØµÙا٠شاÙ
ÙØ§Ù ÙÙÙØ§ÙاثÙÙ...":"Write a comprehensive hackathon description...",className:`min-h-[150px] ${t?"text-right":"text-left"}`})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"Ø§ÙØ¹ÙÙØ§Ù اÙÙØ±Ø¹Ù (عربÙ)":"Hero Subtitle (Arabic)"}),e.jsx(ee,{sourceText:r.hero_subtitle_ar,sourceLang:"ar",targetLang:"en",fieldType:"title",currentTargetText:r.hero_subtitle_en,onTranslated:l=>o({hero_subtitle_en:l})})]}),e.jsx(f,{value:r.hero_subtitle_ar,onChange:l=>o({hero_subtitle_ar:l.target.value}),placeholder:t?"Ø§ÙØ¹ÙÙØ§Ù اÙÙØ±Ø¹Ù Ø¨Ø§ÙØ¹Ø±Ø¨ÙØ©":"Arabic subtitle",className:"text-right",dir:"rtl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"Ø§ÙØ¹ÙÙØ§Ù اÙÙØ±Ø¹Ù (Ø¥ÙØ¬ÙÙØ²Ù)":"Hero Subtitle (English)"}),e.jsx(ee,{sourceText:r.hero_subtitle_en,sourceLang:"en",targetLang:"ar",fieldType:"title",currentTargetText:r.hero_subtitle_ar,onTranslated:l=>o({hero_subtitle_ar:l})})]}),e.jsx(f,{value:r.hero_subtitle_en,onChange:l=>o({hero_subtitle_en:l.target.value}),placeholder:t?"Ø§ÙØ¹ÙÙØ§Ù اÙÙØ±Ø¹Ù Ø¨Ø§ÙØ¥ÙجÙÙØ²ÙØ©":"English subtitle",className:"text-left",dir:"ltr"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"Ø§ÙØ¨Ø§Ùر":"Banner"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(b,{type:"button",variant:N==="image"?"default":"outline",size:"sm",onClick:()=>o({banner_type:"image"}),className:"gap-2",children:[e.jsx(oe,{className:"h-4 w-4"}),t?"ØµÙØ±Ø©":"Image"]}),e.jsxs(b,{type:"button",variant:N==="video"?"default":"outline",size:"sm",onClick:()=>o({banner_type:"video"}),className:"gap-2",children:[e.jsx(_e,{className:"h-4 w-4"}),t?"ÙÙØ¯ÙÙ":"Video"]})]}),N==="image"&&e.jsxs(e.Fragment,{children:[e.jsx(G,{bucket:"hackathon-banners",onUpload:l=>o({banner_url:l[0]||"",banner_video_url:""}),accept:"image/*"}),r.banner_url&&e.jsx("div",{className:"mt-4 rounded-lg overflow-hidden border",children:e.jsx("img",{src:r.banner_url,alt:"Banner preview",className:"w-full h-48 object-cover"})})]}),N==="video"&&e.jsxs(e.Fragment,{children:[e.jsx(G,{bucket:"hackathon-banners",onUpload:l=>o({banner_video_url:l[0]||"",banner_url:""}),accept:"video/mp4,video/webm,video/quicktime",maxSize:100}),r.banner_video_url&&e.jsx("div",{className:"mt-4 rounded-lg overflow-hidden border",children:e.jsx("video",{src:r.banner_video_url,className:"w-full h-48 object-cover",controls:!0,muted:!0}
1)})]})]})]})]})})}function $e({data:r,eventType:c,onChange:o}){const{language:s}=P(),t=s==="ar",g=c==="onsite"||c==="hybrid";return e.jsx("div",{className:"space-y-6",dir:t?"rtl":"ltr",children:e.jsxs(C,{children:[e.jsxs(z,{children:[e.jsx(S,{className:t?"text-right":"text-left",children:t?"Ø§ÙØªÙØ§Ø±ÙØ® ÙØ§ÙÙ
ÙÙØ¹":"Dates & Location"}),e.jsx(T,{className:t?"text-right":"text-left",children:t?"ØØ¯Ø¯ Ù
ÙØ§Ø¹Ùد Ø§ÙØªØ³Ø¬ÙÙ ÙØ§ÙÙØ¹Ø§ÙÙØ©":"Set registration and event dates"})]}),e.jsxs(D,{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"Ø¨Ø¯Ø§ÙØ© Ø§ÙØªØ³Ø¬ÙÙ":"Registration Start"}),e.jsx(f,{type:"datetime-local",value:r.registration_start,onChange:a=>o({registration_start:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"ÙÙØ§ÙØ© Ø§ÙØªØ³Ø¬ÙÙ":"Registration Deadline"}),e.jsx(f,{type:"datetime-local",value:r.registration_deadline,onChange:a=>o({registration_deadline:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(h,{className:t?"text-right block":"text-left block",children:[t?"Ø¨Ø¯Ø§ÙØ© اÙÙØ§ÙاثÙÙ":"Hackathon Start"," *"]}),e.jsx(f,{type:"datetime-local",value:r.start_date,onChange:a=>o({start_date:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(h,{className:t?"text-right block":"text-left block",children:[t?"ÙÙØ§ÙØ© اÙÙØ§ÙاثÙÙ":"Hackathon End"," *"]}),e.jsx(f,{type:"datetime-local",value:r.end_date,onChange:a=>o({end_date:a.target.value})})]})]}),g&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"border-t pt-6",children:[e.jsx("h3",{className:`font-medium mb-4 ${t?"text-right":"text-left"}`,children:t?"Ù
عÙÙÙ
ات اÙÙ
ÙÙØ¹":"Location Information"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"اÙÙ
ÙØ§Ù":"Venue"}),e.jsx(f,{value:r.location,onChange:a=>o({location:a.target.value}),placeholder:t?"اسÙ
اÙÙ
ÙØ§Ù أ٠اÙÙ
بÙÙ":"Venue name or building",className:t?"text-right":"text-left"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"اÙÙ
دÙÙØ©":"City"}),e.jsx(f,{value:r.city,onChange:a=>o({city:a.target.value}),placeholder:t?"اÙÙ
دÙÙØ©":"City",className:t?"text-right":"text-left"})]})]}),e.jsxs("div",{className:"space-y-2 mt-4",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"رابط خرائط ÙÙÙÙ":"Google Maps URL"}),e.jsx(f,{value:r.google_maps_url,onChange:a=>o({google_maps_url:a.target.value}),placeholder:"https://maps.google.com/...",dir:"ltr"})]})]})})]})]})})}function Ce({data:r,hackathonTitle:c,onChange:o}){const{language:s}=P(),t=s==="ar",[g,a]=A.useState(!1),w=()=>{const d={id:`temp-${Date.now()}`,text_ar:"",text_en:""};o({objectives:[...r.objectives,d]})},N=(d,m,j)=>{const _=[...r.objectives];_[d]={..._[d],[m]:j},o({objectives:_})},l=d=>{o({objectives:r.objectives.filter((m,j)=>j!==d)})},i=()=>{const d={id:`temp-${Date.now()}`,title_ar:"",title_en:"",description_ar:"",description_en:""};o({challenges:[...r.challenges,d]})},n=(d,m,j)=>{const _=[...r.challenges];_[d]={..._[d],[m]:j},o({challenges:_})},u=d=>{o({challenges:r.challenges.filter((m,j)=>j!==d)})},k=async d=>{a(!0);try{const{data:m,error:j}=await $.functions.invoke("generate-field-text",{body:{fieldType:"hackathon_objective",language:t?"ar":"en",context:{hackathonName:c}}});if(j)throw j;m!=null&&m.text&&(N(d,t?"text_ar":"text_en",m.text),y.success(t?"تÙ
تÙÙÙØ¯ اÙÙØ¯Ù":"Objective generated"))}catch{y.error(t?"ÙØ´Ù ÙÙ Ø§ÙØªÙÙÙØ¯":"Failed to generate")}finally{a(!1)}};return e.jsxs("div",{className:"space-y-6",dir:t?"rtl":"ltr",children:[e.jsxs(C,{children:[e.jsx(z,{children:e.jsxs("div",{className:`flex items-center justify-between ${t?"flex-row-reverse":""}`,children:[e.jsxs("div",{children:[e.jsx(S,{className:t?"text-right":"text-left",children:t?"Ø§ÙØ£ÙداÙ":"Objectives"}),e.jsx(T,{className:t?"text-right":"text-left",children:t?"Ø£Ø¶Ù Ø£ÙØ¯Ø§Ù اÙÙØ§ÙاثÙÙ":"Add hackathon objectives"})]}),e.jsxs(b,{onClick:w,variant:"outline",size:"sm",className:`gap-2 ${t?"flex-row-reverse":""}`,children:[e.jsx(H,{className:"h-4 w-4"}),t?"Ø¥Ø¶Ø§ÙØ© ÙØ¯Ù":"Add Objective"]})]})}),e.jsx(D,{className:"space-y-4",children:r.objectives.length===0?e.jsx("p",{className:`text-muted-foreground text-sm ${t?"text-right":"text-left"}
1`,children:t?"ÙÙ
ÙØªÙ
Ø¥Ø¶Ø§ÙØ© Ø£ÙØ¯Ø§Ù بعد":"No objectives added yet"}):r.objectives.map((d,m)=>e.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[e.jsxs("div",{className:`flex items-center justify-between ${t?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:`flex items-center gap-2 ${t?"flex-row-reverse":""}`,children:[e.jsx(se,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:t?`ÙØ¯Ù ${m+1}`:`Objective ${m+1}`})]}),e.jsxs("div",{className:`flex items-center gap-2 ${t?"flex-row-reverse":""}`,children:[e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>k(m),disabled:g,children:g?e.jsx(M,{className:"h-4 w-4 animate-spin"}):e.jsx(ae,{className:"h-4 w-4"})}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>l(m),children:e.jsx(B,{className:"h-4 w-4 text-destructive"})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:t?"Ø¨Ø§ÙØ¹Ø±Ø¨ÙØ©":"Arabic"}),e.jsx(f,{value:d.text_ar,onChange:j=>N(m,"text_ar",j.target.value),placeholder:t?"اÙÙØ¯Ù Ø¨Ø§ÙØ¹Ø±Ø¨ÙØ©":"Objective in Arabic",className:"text-right",dir:"rtl"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:t?"Ø¨Ø§ÙØ¥ÙجÙÙØ²ÙØ©":"English"}),e.jsx(f,{value:d.text_en,onChange:j=>N(m,"text_en",j.target.value),placeholder:t?"اÙÙØ¯Ù Ø¨Ø§ÙØ¥ÙجÙÙØ²ÙØ©":"Objective in English",className:"text-left",dir:"ltr"})]})]})]},d.id))})]}),e.jsxs(C,{children:[e.jsx(z,{children:e.jsxs("div",{className:`flex items-center justify-between ${t?"flex-row-reverse":""}`,children:[e.jsxs("div",{children:[e.jsx(S,{className:t?"text-right":"text-left",children:t?"Ø§ÙØªØØ¯Ùات":"Challenges"}),e.jsx(T,{className:t?"text-right":"text-left",children:t?"Ø£Ø¶Ù ØªØØ¯Ùات ÙÙ
Ø¬Ø§ÙØ§Øª اÙÙØ§ÙاثÙÙ":"Add hackathon challenges and tracks"})]}),e.jsxs(b,{onClick:i,variant:"outline",size:"sm",className:`gap-2 ${t?"flex-row-reverse":""}`,children:[e.jsx(H,{className:"h-4 w-4"}),t?"Ø¥Ø¶Ø§ÙØ© ØªØØ¯Ù":"Add Challenge"]})]})}),e.jsx(D,{className:"space-y-4",children:r.challenges.length===0?e.jsx("p",{className:`text-muted-foreground text-sm ${t?"text-right":"text-left"}`,children:t?"ÙÙ
ÙØªÙ
Ø¥Ø¶Ø§ÙØ© ØªØØ¯Ùات بعد":"No challenges added yet"}):r.challenges.map((d,m)=>e.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[e.jsxs("div",{className:`flex items-center justify-between ${t?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:`flex items-center gap-2 ${t?"flex-row-reverse":""}`,children:[e.jsx(se,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:t?`ØªØØ¯Ù ${m+1}`:`Challenge ${m+1}`})]}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>u(m),children:e.jsx(B,{className:"h-4 w-4 text-destructive"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:t?"Ø§ÙØ¹ÙÙØ§Ù (عربÙ)":"Title (Arabic)"}),e.jsx(f,{value:d.title_ar,onChange:j=>n(m,"title_ar",j.target.value),className:"text-right",dir:"rtl"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:t?"Ø§ÙØ¹ÙÙØ§Ù (Ø¥ÙØ¬ÙÙØ²Ù)":"Title (English)"}),e.jsx(f,{value:d.title_en,onChange:j=>n(m,"title_en",j.target.value),className:"text-left",dir:"ltr"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:t?"اÙÙØµÙ (عربÙ)":"Description (Arabic)"}),e.jsx(O,{value:d.description_ar,onChange:j=>n(m,"description_ar",j.target.value),className:"text-right min-h-[80px]",dir:"rtl"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:t?"اÙÙØµÙ (Ø¥ÙØ¬ÙÙØ²Ù)":"Description (English)"}),e.jsx(O,{value:d.description_en,onChange:j=>n(m,"description_en",j.target.value),className:"text-left min-h-[80px]",dir:"ltr"})]})]})]},d.id))})]})]})}function ze({data:r,onChange:c}){const{language:o}=P(),s=o==="ar",t=()=>{const l=r.prizes.length+1,i={id:`temp-${Date.now()}`,rank:l,title_ar:l===1?"اÙÙ
Ø±ÙØ² Ø§ÙØ£ÙÙ":l===2?"اÙÙ
Ø±ÙØ² Ø§ÙØ«Ø§ÙÙ":l===3?"اÙÙ
Ø±ÙØ² Ø§ÙØ«Ø§ÙØ«":`اÙÙ
Ø±ÙØ² ${l}`,title_en:l===1?"First Place":l===2?"Second Place":l===3?"Third Place":`${l}th Place`,amount:0,description_ar:"",description_en:""};c({prizes:[...r.prizes,i]})},g=(l,i,n)=>{const u=[...r.prizes];u[l]={...u[l],[i]:n},c({prizes:u})},a=l=>{c({prizes:r.prizes.filter((i,n)=>n!==l)})},w=l=>l===1?e.jsx(re,{className:"h-5 w-5 text-yellow-500"}):l===2?e.jsx(ye,{className:"h-5 w-5 text-gray-400"}):l===3?e.jsx(q,{className:"h-5 w-5 text-amber-600"}):e.jsx(q,{className:"h-5 w-5 text-muted-foreground"}),N=l=>l===1?"border-yellow-500/50 bg-yellow-500/5":l===2?"border-gray-400/50 bg-gray-400/5":l===3?"border-amber-600/50 bg-amber-600/5":"border-border";return e.jsxs("div",{className:"space-y-6",dir:s?"rtl":"ltr",children:[e.jsxs(C,{children:[e.jsxs(z,{children:[e.jsx(S,{className:s?"text-right":"text-left",children:s?"إجÙ
اÙÙ Ø§ÙØ¬Ùائز":"Total Prize Pool"}),e.jsx(T,{className:s?"text-right":"text-left",children:s?"أدخ٠إجÙ
اÙÙ ÙÙÙ
Ø© Ø§ÙØ¬Ùائز":"Enter the total prize value"})]}),e.jsx(D,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:s?"text-right block":"text-left block",children:s?"إجÙ
اÙÙ Ø§ÙØ¬Ùائز (Ø±ÙØ§Ù)":"Total Prize (SAR)"}),e.jsx(f,{type:"number",value:r.total_prize,onChange:l=>c({total_prize:l.target.value}),placeholder:"100000",className:s?"text-right":"text-left"}),r.total_prize&&e.jsx("p",{className:`text-sm text-muted-foreground ${s?"text-right":"text-left"}`,children:s?`${R(r.total_prize)} Ø±ÙØ§Ù Ø³Ø¹ÙØ¯Ù`:`SAR ${R(r.total_prize)}`})]})})]}),e.jsxs(C,{children:[e.jsx(z,{children:e.jsxs("div",{className:`flex items-center justify-between ${s?"flex-row-reverse":""}`,children:[e.jsxs("div",{children:[e.jsx(S,{className:s?"text-right":"text-left",children:s?"ØªÙØ§ØµÙÙ Ø§ÙØ¬Ùائز":"Prize Breakdown"}),e.jsx(T,{className:s?"text-right":"text-left",children:s?"Ø£Ø¶Ù ØªÙØ§ØµÙÙ Ù٠جائزة":"Add details for each prize"})]}),e.jsxs(b,{onClick:t,variant:"outline",size:"sm",className:`gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(H,{className:"h-4 w-4"}),s?"Ø¥Ø¶Ø§ÙØ© جائزة":"Add Prize"]})]})}),e.jsx(D,{className:"space-y-4",children:r.prizes.length===0?e.jsx("p",{className:`text-muted-foreground text-sm ${s?"text-right":"text-left"}`,children:s?"ÙÙ
ÙØªÙ
Ø¥Ø¶Ø§ÙØ© Ø¬ÙØ§Ø¦Ø² بعد":"No prizes added yet"}):r.prizes.map((l,i)=>e.jsxs("div",{className:`border rounded-lg p-4 space-y-3 ${N(l.rank)}`,children:[e.jsxs("div",{className:`flex items-center justify-between ${s?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[w(l.rank),e.jsx("span",{className:"font-medium",children:s?l.title_ar:l.title_en})]}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>a(i),children:e.jsx(B,{className:"h-4 w-4 text-destructive"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:s?"Ø§ÙØ¹ÙÙØ§Ù (عربÙ)":"Title (Arabic)"}),e.jsx(f,{value:l.title_ar,onChange:n=>g(i,"title_ar",n.target.value),className:"text-right",dir:"rtl"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:s?"Ø§ÙØ¹ÙÙØ§Ù (Ø¥ÙØ¬ÙÙØ²Ù)":"Title (English)"}),e.jsx(f,{value:l.title_en,onChange:n=>g(i,"title_en",n.target.value),className:"text-left",dir:"ltr"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:s?"ÙÙÙ
Ø© Ø§ÙØ¬Ø§Ø¦Ø²Ø© (Ø±ÙØ§Ù)":"Prize Amount (SAR)"}),e.jsx(f,{type:"number",value:l.amount,onChange:n=>g(i,"amount",parseInt(n.target.value)||0),placeholder:"50000"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:s?"اÙÙØµÙ (عربÙ)":"Description (Arabic)"}),e.jsx(O,{value:l.description_ar,onChange:n=>g(i,"description_ar",n.target.value),className:"text-right min-h-[60
1px]",dir:"rtl"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:s?"اÙÙØµÙ (Ø¥ÙØ¬ÙÙØ²Ù)":"Description (English)"}),e.jsx(O,{value:l.description_en,onChange:n=>g(i,"description_en",n.target.value),className:"text-left min-h-[60px]",dir:"ltr"})]})]})]},l.id))})]})]})}function Se({data:r,onChange:c}){const{language:o}=P(),s=o==="ar",t=()=>{const i={id:`temp-${Date.now()}`,email:"",message:""};c({judges:[...r.judges,i]})},g=(i,n,u)=>{const k=[...r.judges];k[i]={...k[i],[n]:u},c({judges:k})},a=i=>{c({judges:r.judges.filter((n,u)=>u!==i)})},w=()=>{const i={id:`temp-${Date.now()}`,email:"",message:""};c({mentors:[...r.mentors,i]})},N=(i,n,u)=>{const k=[...r.mentors];k[i]={...k[i],[n]:u},c({mentors:k})},l=i=>{c({mentors:r.mentors.filter((n,u)=>u!==i)})};return e.jsxs("div",{className:"space-y-6",dir:s?"rtl":"ltr",children:[e.jsxs(C,{children:[e.jsx(z,{children:e.jsxs("div",{className:`flex items-center justify-between ${s?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:`flex items-center gap-3 ${s?"flex-row-reverse":""}`,children:[e.jsx(X,{className:"h-5 w-5 text-primary"}),e.jsxs("div",{children:[e.jsx(S,{className:s?"text-right":"text-left",children:s?"اÙÙ
ØÙÙ
ÙÙ":"Judges"}),e.jsx(T,{className:s?"text-right":"text-left",children:s?"أض٠اÙÙ
ØÙÙ
ÙÙ ÙØªÙÙÙÙ
اÙÙ
Ø´Ø§Ø±ÙØ¹":"Add judges to evaluate projects"})]})]}),e.jsxs(b,{onClick:t,variant:"outline",size:"sm",className:`gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(H,{className:"h-4 w-4"}),s?"Ø¥Ø¶Ø§ÙØ© Ù
ØÙÙ
":"Add Judge"]})]})}),e.jsx(D,{className:"space-y-4",children:r.judges.length===0?e.jsxs("div",{className:`text-center py-8 border-2 border-dashed rounded-lg ${s?"text-right":"text-left"}`,children:[e.jsx(X,{className:"h-10 w-10 mx-auto text-muted-foreground mb-2"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:s?"ÙÙ
ÙØªÙ
Ø¥Ø¶Ø§ÙØ© Ù
ØÙÙ
Ù٠بعد":"No judges added yet"}),e.jsx("p",{className:"text-muted-foreground text-xs mt-1",children:s?"Ø³ÙØªÙ
Ø¥Ø±Ø³Ø§Ù Ø¯Ø¹ÙØ§Øª بعد ÙØ´Ø± اÙÙØ§ÙاثÙÙ":"Invitations will be sent after publishing"})]}):r.judges.map((i,n)=>e.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[e.jsxs("div",{className:`flex items-center justify-between ${s?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(K,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium text-sm",children:s?`Ù
ØÙÙ
${n+1}`:`Judge ${n+1}`}),e.jsx(L,{variant:"secondary",className:"text-xs",children:s?"ÙÙ Ø§ÙØ§Ùتظار":"Pending"})]}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>a(n),children:e.jsx(B,{className:"h-4 w-4 text-destructive"})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(h,{className:"text-xs",children:[s?"Ø§ÙØ¨Ø±Ùد Ø§ÙØ¥ÙÙØªØ±ÙÙÙ":"Email Address"," *"]}),e.jsx(f,{type:"email",value:i.email,onChange:u=>g(n,"email",u.target.value),placeholder:"[email protected]",dir:"ltr"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:s?"Ø±Ø³Ø§ÙØ© Ø§ÙØ¯Ø¹ÙØ© (Ø§Ø®ØªÙØ§Ø±Ù)":"Invitation Message (Optional)"}),e.jsx(O,{value:i.message,onChange:u=>g(n,"message",u.target.value),placeholder:s?"Ø±Ø³Ø§ÙØ© Ù
خصصة ÙÙÙ
ØÙÙ
...":"Custom message for the judge...",className:`min-h-[60px] ${s?"text-right":"text-left"}`})]})]})]},i.id))})]}),e.jsxs(C,{children:[e.jsx(z,{children:e.jsxs("div",{className:`flex items-center justify-between ${s?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:`flex items-center gap-3 ${s?"flex-row-reverse":""}`,children:[e.jsx(Y,{className:"h-5 w-5 text-primary"}),e.jsxs("div",{children:[e.jsx(S,{className:s?"text-right":"text-left",children:s?"اÙÙ
رشدÙÙ":"Mentors"}),e.jsx(T,{className:s?"text-right":"text-left",children:s?"أض٠اÙÙ
رشدÙÙ ÙØ¯Ø¹Ù
اÙÙ
شارÙÙÙ":"Add mentors to support participants"})]})]}),e.jsxs(b,{onClick:w,variant:"outline",size:"sm",className:`gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(H,{className:"h-4 w-4"}),s?"Ø¥Ø¶Ø§ÙØ© Ù
رشد":"Add Mentor"]})]})}),e.jsx(D,{className:"space-y-4",children:r.mentors.length===0?e.jsxs("div",{className:`text-center py-8 border-2 border-dashed rounded-lg ${s?"text-right":"text-left"}`,children:[e.jsx(Y,{className:"h-10 w-10 mx-auto text-muted-foreground mb-2"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:s?"ÙÙ
ÙØªÙ
Ø¥Ø¶Ø§ÙØ© Ù
رشدÙ٠بعد":"No mentors added yet"}),e.jsx("p",{className:"text-muted-foreground text-xs mt-1",children:s?"Ø³ÙØªÙ
Ø¥Ø±Ø³Ø§Ù Ø¯Ø¹ÙØ§Øª بعد ÙØ´Ø± اÙÙØ§ÙاثÙÙ":"Invitations will be sent after publishing"})]}):r.mentors.map((i,n)=>e.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[e.jsxs("div",{className:`flex items-center justify-between ${s?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(K,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium text-sm",children:s?`Ù
رشد ${n+1}`:`Mentor ${n+1}`}),e.jsx(L,{variant:"secondary",className:"text-xs",children:s?"ÙÙ Ø§ÙØ§Ùتظار":"Pending"})]}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>l(n),children:e.jsx(B,{className:"h-4 w-4 text-destructive"})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(h,{className:"text-xs",children:[s?"Ø§ÙØ¨Ø±Ùد Ø§ÙØ¥ÙÙØªØ±ÙÙÙ":"Email Address"," *"]}),e.jsx(f,{type:"email",value:i.email,onChange:u=>N(n,"email",u.target.value),placeholder:"[email protected]",dir:"ltr"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:s?"Ø±Ø³Ø§ÙØ© Ø§ÙØ¯Ø¹ÙØ© (Ø§Ø®ØªÙØ§Ø±Ù)":"Invitation Message (Optional)"}),e.jsx(O,{value:i.message,onChange:u=>N(n,"message",u.target.value),placeholder:s?"Ø±Ø³Ø§ÙØ© Ù
خصصة ÙÙÙ
رشد...":"Custom message for the mentor...",className:`min-h-[60
1px] ${s?"text-right":"text-left"}`})]})]})]},i.id))})]})]})}function De({data:r,checklist:c}){var N,l;const{language:o}=P(),s=o==="ar",t=i=>{if(!i)return"-";try{return me(new Date(i),"PPP",{locale:s?ge:ue})}catch{return i}},g=Object.values(c).every(Boolean),a={technology:{ar:"Ø§ÙØªÙÙÙØ©",en:"Technology"},ai:{ar:"Ø§ÙØ°Ùاء Ø§ÙØ§ØµØ·ÙاعÙ",en:"AI"},fintech:{ar:"Ø§ÙØªÙÙÙØ© اÙÙ
اÙÙØ©",en:"FinTech"},healthcare:{ar:"Ø§ÙØµØØ©",en:"Healthcare"},education:{ar:"Ø§ÙØªØ¹ÙÙÙ
",en:"Education"},sustainability:{ar:"Ø§ÙØ§Ø³ØªØ¯Ø§Ù
Ø©",en:"Sustainability"},social:{ar:"Ø§ÙØ§Ø¨ØªÙار Ø§ÙØ§Ø¬ØªÙ
اعÙ",en:"Social Innovation"},other:{ar:"أخرÙ",en:"Other"}},w={online:{ar:"Ø¹Ù Ø¨ÙØ¹Ø¯",en:"Online"},onsite:{ar:"ØØ¶ÙرÙ",en:"On-site"},hybrid:{ar:"Ù
Ø®ØªÙØ·",en:"Hybrid"}};return e.jsxs("div",{className:"space-y-6",dir:s?"rtl":"ltr",children:[e.jsxs(C,{className:g?"border-green-500/50 bg-green-500/5":"border-yellow-500/50 bg-yellow-500/5",children:[e.jsxs(z,{children:[e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[g?e.jsx(Z,{className:"h-5 w-5 text-green-500"}):e.jsx(de,{className:"h-5 w-5 text-yellow-500"}),e.jsx(S,{className:s?"text-right":"text-left",children:s?"ÙØ§Ø¦Ù
Ø© Ø§ÙØªØÙÙ ÙÙÙØ´Ø±":"Publishing Checklist"})]}),e.jsx(T,{className:s?"text-right":"text-left",children:g?s?"اÙÙØ§ÙاثÙÙ Ø¬Ø§ÙØ² ÙÙÙØ´Ø±!":"Hackathon is ready to publish!":s?"Ø£ÙÙ
Ù Ø§ÙØ¹Ùاصر اÙÙ
Ø·ÙÙØ¨Ø© ÙÙÙØ´Ø±":"Complete required items to publish"})]}),e.jsx(D,{children:e.jsx("div",{className:"space-y-2",children:[{key:"hasTitle",label:s?"اسÙ
اÙÙØ§ÙاثÙÙ":"Hackathon Title",checked:c.hasTitle},{key:"hasDescription",label:s?"اÙÙØµÙ":"Description",checked:c.hasDescription},{key:"hasDates",label:s?"ØªØ§Ø±ÙØ® Ø§ÙØ¨Ø¯Ø§ÙØ© ÙØ§ÙÙÙØ§ÙØ©":"Start & End Dates",checked:c.hasDates},{key:"hasBanner",label:s?"ØµÙØ±Ø© Ø§ÙØ¨Ø§Ùر":"Banner Image",checked:c.hasBanner},{key:"hasChallenge",label:s?"ØªØØ¯Ù ÙØ§ØØ¯ عÙÙ Ø§ÙØ£ÙÙ":"At least one challenge",checked:c.hasChallenge}].map(i=>e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[i.checked?e.jsx(Z,{className:"h-4 w-4 text-green-500"}):e.jsx(xe,{className:"h-4 w-4 text-destructive"}),e.jsx("span",{className:i.checked?"text-foreground":"text-muted-foreground",children:i.label})]},i.key))})})]}),e.jsxs(C,{children:[e.jsx(z,{children:e.jsx(S,{className:s?"text-right":"text-left",children:s?"Ù
عاÙÙØ© اÙÙØ§ÙاثÙÙ":"Hackathon Preview"})}),e.jsxs(D,{className:"space-y-6",children:[r.banner_url&&e.jsx("div",{className:"rounded-lg overflow-hidden border",children:e.jsx("img",{src:r.banner_url,alt:"Banner",className:"w-full h-48 object-cover"})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:`text-2xl font-bold ${s?"text-right":"text-left"}`,children:r.title||(s?"بدÙ٠عÙÙØ§Ù":"Untitled")}),e.jsxs("div",{className:`flex items-center gap-2 flex-wrap ${s?"flex-row-reverse justify-end":""}`,children:[r.category&&e.jsx(L,{variant:"secondary",children:((N=a[r.category])==null?void 0:N[s?"ar":"en"])||r.category}),r.event_type&&e.jsx(L,{variant:"outline",children:((l=w[r.event_type])==null?void 0:l[s?"ar":"en"])||r.event_type})]})]}),r.description&&e.jsx("p",{className:`text-muted-foreground ${s?"text-right":"text-left"}`,children:r.description}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(Q,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{className:s?"text-right":"text-left",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"Ø§ÙØ¨Ø¯Ø§ÙØ©":"Start"}),e.jsx("p",{className:"text-sm font-medium",children:t(r.start_date)})]})]}),e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(Q,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{className:s?"text-right":"text-left",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"اÙÙÙØ§ÙØ©":"End"}),e.jsx("p",{className:"text-sm font-medium",children:t(r.end_date)})]})]}),r.location&&e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(he,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{className:s?"text-right":"text-left",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"اÙÙ
ÙÙØ¹":"Location"}),e.jsx("p",{className:"text-sm font-medium",children:r.location})]})]}),r.total_prize&&e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(re,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{className:s?"text-right":"text-left",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"Ø§ÙØ¬Ùائز":"Prizes"}),e.jsxs("p",{className:"text-sm font-medium",children:[R(r.total_prize)," ",s?"Ø±ÙØ§Ù":"SAR"]})]})]})]}),e.jsxs("div",{className:"border-t pt-4 grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[e.jsx("p",{className:"text-2xl font-bold",children:r.objectives.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"Ø£ÙØ¯Ø§Ù":"Objectives"})]}),e.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[e.jsx("p",{className:"text-2xl font-bold",children:r.challenges.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"ØªØØ¯Ùات":"Challenges"})]}),e.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[e.jsx("p",{className:"text-2xl font-bold",children:r.prizes.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"Ø¬ÙØ§Ø¦Ø²":"Prizes"})]}),e.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[e.jsx("p",{className:"text-2xl font-bold",children:r.judges.length+r.mentors.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"Ù
ØÙÙ
ÙÙ ÙÙ
رشدÙÙ":"Judges & Mentors"})]})]})]})]})]})}const te=7,Te={title:"",category:"",event_type:"online",description:"",banner_url:"",banner_video_url:"",banner_type:"image",hero_subtitle_ar:"",hero_subtitle_en:"",start_date:"",end_date:"",registration_start:"",registration_deadline:"",location:"",city:"",google_maps_url:"",objectives:[],challenges:[],total_prize:"",prizes:[],judges:[],mentors:[]};function Be(){const{language:r}=P(),{user:c}=je(),o=pe(),s=r==="ar",[t,g]=A.useState(1),[a,w]=A.useState(Te),[N,l]=A.useState(!1),[i,n]=A.useState(!1),[u,k]=A.useState(null),[d,m]=A.useState(null),j={1:s?"اÙÙ
عÙÙÙ
ات Ø§ÙØ£Ø³Ø§Ø³ÙØ©":"Basic Info",2:s?"اÙÙØµÙ ÙØ§ÙØµÙØ±Ø©":"Description & Banner",3:s?"Ø§ÙØªÙØ§Ø±ÙØ® ÙØ§ÙÙ
ÙÙØ¹":"Dates & Location",4:s?"Ø§ÙØ£ÙØ¯Ø§Ù ÙØ§ÙØªØØ¯Ùات":"Goals & Challenges",5:s?"Ø§ÙØ¬Ùائز":"Prizes",6:s?"اÙÙ
ØÙÙ
ÙÙ ÙØ§ÙÙ
رشدÙÙ":"Judges & Mentors",7:s?"اÙÙ
عاÙÙØ© ÙØ§ÙÙØ´Ø±":"Preview & Publish"};A.useEffect(()=>{(async()=>
1{if(!c)return;const{data:v}=await $.from("organization_members").select("organization_id").eq("user_id",c.id).single();v&&k(v.organization_id)})()},[c]);const _=p=>{w(v=>({...v,...p}))},le=async()=>{if(!u||!c){y.error(s?"ÙØ±Ø¬Ù تسجÙÙ Ø§ÙØ¯Ø®ÙÙ":"Please sign in");return}l(!0);try{const p={title:a.title||"Ù
Ø³ÙØ¯Ø©",description:a.description,banner_url:a.banner_url,banner_video_url:a.banner_video_url,banner_type:a.banner_type,category:a.category,event_type:a.event_type,start_date:a.start_date||null,end_date:a.end_date||null,registration_start:a.registration_start||null,registration_deadline:a.registration_deadline||null,location:a.location,city:a.city,google_maps_url:a.google_maps_url,hero_subtitle_ar:a.hero_subtitle_ar,hero_subtitle_en:a.hero_subtitle_en,stats_total_prize:a.total_prize,status:"draft",organization_id:u,created_by:c.id};if(d){const{error:v}=await $.from("hackathons").update(p).eq("id",d);if(v)throw v}else{const{data:v,error:x}=await $.from("hackathons").insert(p).select().single();if(x)throw x;m(v.id)}y.success(s?"تÙ
ØÙظ اÙÙ
Ø³ÙØ¯Ø©":"Draft saved")}catch(p){console.error("Error saving draft:",p),y.error(s?"ÙØ´Ù ØÙظ اÙÙ
Ø³ÙØ¯Ø©":"Failed to save draft")}finally{l(!1)}},ie=async()=>{if(!u||!c){y.error(s?"ÙØ±Ø¬Ù تسجÙÙ Ø§ÙØ¯Ø®ÙÙ":"Please sign in");return}if(!E.hasTitle||!E.hasDescription||!E.hasDates){y.error(s?"ÙØ±Ø¬Ù Ø¥ÙÙ
Ø§Ù Ø§ÙØÙÙ٠اÙÙ
Ø·ÙÙØ¨Ø©":"Please complete required fields");return}n(!0);try{const p={title:a.title,description:a.description,banner_url:a.banner_url,banner_video_url:a.banner_video_url,banner_type:a.banner_type,category:a.category,event_type:a.event_type,start_date:a.start_date,end_date:a.end_date,registration_start:a.registration_start||null,registration_deadline:a.registration_deadline||null,location:a.location,city:a.city,google_maps_url:a.google_maps_url,hero_subtitle_ar:a.hero_subtitle_ar,hero_subtitle_en:a.hero_subtitle_en,stats_total_prize:a.total_prize,status:"published",organization_id:u,created_by:c.id};let v=d;if(d){const{error:x}=await $.from("hackathons").update(p).eq("id",d);if(x)throw x}else{const{data:x,error:I}=await $.from("hackathons").insert(p).select().single();if(I)throw I;v=x.id}if(a.objectives.length>0&&v)for(let x=0;x<a.objectives.length;x++){const I=a.objectives[x];await $.from("hackathon_objectives").insert({hackathon_id:v,text_ar:I.text_ar,text_en:I.text_en,order_index:x})}if(a.challenges.length>0&&v)for(const x of a.challenges)await $.from("challenges").insert({hackathon_id:v,title:x.title_ar||x.title_en,title_ar:x.title_ar||x.title_en,title_en:x.title_en||null,description:x.description_ar||x.description_en,description_ar:x.description_ar||x.description_en,description_en:x.description_en||null});for(const x of a.judges)x.email&&await $.functions.invoke("invite-judge",{body:{hackathon_id:v,email:x.email,message:x.message}});for(const x of a.mentors)x.email&&await $.functions.invoke("invite-mentor",{body:{hackathon_id:v,email:x.email,message:x.message}});y.success(s?"تÙ
ÙØ´Ø± اÙÙØ§ÙاثÙÙ Ø¨ÙØ¬Ø§Ø!":"Hackathon published successfully!"),o(`/organizer/hackathons/${v}`)}catch(p){console.error("Error publishing:",p),y.error(s?"ÙØ´Ù ÙØ´Ø± اÙÙØ§ÙاثÙÙ":"Failed to publish hackathon")}finally{n(!1)}},E={hasTitle:!!a.title,hasDescription:!!a.description,hasDates:!!a.start_date&&!!a.end_date,hasBanner:!!a.banner_url||!!a.banner_video_url,hasChallenge:a.challenges.length>0},ne=E.hasTitle&&E.hasDescription&&E.hasDates,ce=()=>{switch(t){case 1:return e.jsx(we,{data:a,onChange:_});case 2:return e.jsx(ke,{data:a,hackathonTitle:a.title,onChange:_});case 3:return e.jsx($e,{data:a,eventType:a.event_type,onChange:_});case 4:return e.jsx(Ce,{data:a,hackathonTitle:a.title,onChange:_});case 5:return e.jsx(ze,{data:a,onChange:_});case 6:return e.jsx(Se,{data:a,onChange:_});case 7:return e.jsx(De,{data:a,checklist:E});default:return null}};return e.jsxs("div",{className:"min-h-screen bg-background",dir:s?"rtl":"ltr",children:[e.jsx("div",{className:"border-b bg-card sticky top-0 z-10",children:e.jsxs("div",{className:"container mx-auto px-4 py-4",children:[e.jsxs("div",{className:`flex items-center justify-between ${s?"flex-row-reverse":""}`,children:[e.jsx("h1",{className:`text-xl font-bold ${s?"text-right":"text-left"}`,children:s?"Ø¥ÙØ´Ø§Ø¡ ÙØ§ÙاثÙÙ Ø¬Ø¯ÙØ¯":"Create New Hackathon"}),e.jsxs(b,{variant:"outline",onClick:le,disabled:N,className:`gap-2 ${s?"flex-row-reverse":""}`,children:[N?e.jsx(M,{className:"h-4 w-4 animate-spin"}):e.jsx(ve,{className:"h-4 w-4"}),s?"ØÙظ ÙÙ
Ø³ÙØ¯Ø©":"Save Draft"]})]}),e.jsx("div",{className:"mt-4 flex items-center justify-center gap-2",children:Array.from({length:te},(p,v)=>v+1).map(p=>e.jsxs("button",{onClick:()=>g(p),className:`flex items-center gap-1 px-3 py-1.5 rounded-full text-sm transition-colors ${p===t?"bg-primary text-primary-foreground":p<t?"bg-primary/20 text-primary":"bg-muted text-muted-foreground"}`,children:[e.jsx("span",{className:"font-medium",children:p}),e.jsx("span",{className:"hidden md:inline",children:j[p]})]},p))})]})}),e.jsx("div",{className:"container mx-auto px-4 py-8 max-w-4xl",children:ce()}),e.jsx("div",{className:"border-t bg-card sticky bottom-0",children:e.jsx("div",{className:"container mx-auto px-4 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(b,{variant:"outline",onClick:()=>g(p=>p-1),disabled:t===1,className:"gap-2",children:[e.jsx(fe,{className:"h-4 w-4 rtl-flip"}),s?"Ø§ÙØ³Ø§Ø¨Ù":"Previous"]}),t===te?e.jsxs(b,{onClick:ie,disabled:!ne||i,className:"gap-2",children:[i?e.jsx(M,{className:"h-4 w-4 animate-spin"}):e.jsx(Ne,{className:"h-4 w-4"}),s?"ÙØ´Ø± اÙÙØ§ÙاثÙÙ":"Publish Hackathon"]}):e.jsxs(b,{onClick:()=>g(p=>p+1),className:"gap-2",children:[s?"Ø§ÙØªØ§ÙÙ":"Next",e.jsx(be,{className:"h-4 w-4 rtl-flip"})]})]})})})]})}export{Be 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.