PageSourceSearch

https://boardspace.ai/assets/CreatorDashboard-Dd04fN6Z.js

js boardspace.ai collected 2026-10-05 11:52:20 UTC 117,841 bytes, 24 lines download raw bytes

1import{i as pe,n as ie,U as kr,J as Sr,O as Er,K as Fr,an as Ce,j as e,a5 as qr,k as $r,c as Pr,ao as It,ap as Ar,aq as Mr,o as He,a as Ur}from"./ui-DKb32DiD.js";import{r as o}from"./vendor-DCFBENKy.js";import{c as ut,x as n,ak as Ir,u as ge,ay as Be,az as Ne,s as S,J as ke,K as Se,N as Ee,O as Fe,T as G,ad as Br,ae as Kr,af as Or,ag as Dr,aj as Wr,Y as ue,r as K,$ as le,a9 as Bt,au as Kt,f as M,a4 as Vr,a1 as Re,V as zr,aa as Ot,Q as Hr,o as Gr,a as Qr,b7 as Dt,b as Xr,bq as Jr,cH as Yr,c6 as Zr,aD as yt,cO as Tr,C as jt,aJ as Ue,bK as Rr,cN as Lr,an as ea,b4 as Le,b5 as et,b0 as tt,aR as Wt,b6 as rt,ax as at,bj as ta,aT as Nt,l as ra,cq as aa,X as _t}from"./index-oNwIZiHT.js";import{S as Ge}from"./skeleton-CXLlnrI6.js";import{T as me}from"./textarea-C797MVEe.js";import{a as Ct,g as kt,M as sa}from"./creatorCategories-WfjQuV2W.js";import{U as Vt}from"./upload-C8djh6xk.js";import{S as na}from"./save-elU05o7Y.js";import{F as la}from"./file-text-Coa48xVg.js";import{I as ia}from"./image-jYsTE5eT.js";import{P as Ke}from"./pencil-DUmInc3t.js";import{W as zt}from"./wallet-BnGgg5jY.js";import{A as oa}from"./arrow-up-right-BG_yeSF_.js";import{P as Ie}from"./package-Cs2TzaVy.js";import{S as ca}from"./shopping-cart-dtxL9Tv8.js";import{M as St}from"./message-square-C98XYPav.js";import{I as Ht}from"./image-plus-BSlRWsdz.js";import{c as da,m as ua}from"./motion-BrksToHf.js";import{C as ma}from"./circle-dot-DU2tgv5S.js";import"./r3f-BN6X73lm.js";import"./three-Dv4K_qkO.js";import"./konva-L1CHpTsF.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const ha=ut("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const pa=ut("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const xa=ut("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);async function ga(t,r={}){if(typeof document>"u")return null;const{quality:a=.82,maxWidth:s=720,seekSeconds:c=.5,timeoutMs:l=8e3}=r,i=URL.createObjectURL(t),d=document.createElement("video");d.muted=!0,d.playsInline=!0,d.preload="auto",d.crossOrigin="anonymous",d.src=i;const p=()=>{try{d.pause()}catch{}d.removeAttribute("src");try{d.load()}catch{}URL.revokeObjectURL(i)};return new Promise(m=>{let u=!1;const g=v=>{u||(u=!0,p(),m(v))},b=window.setTimeout(()=>g(null),l),_=()=>{try{const v=d.videoWidth,w=d.videoHeight;if(!v||!w)return window.clearTimeout(b),g(null);const $=Math.min(1,s/v),j=Math.round(v*$),O=Math.round(w*$),E=document.createElement("canvas");E.width=j,E.height=O;const y=E.getContext("2d");if(!y)return window.clearTimeout(b),g(null);y.drawImage(d,0,0,j,O),E.toBlob(P=>{window.clearTimeout(b),g(P)},"image/jpeg",a)}catch{window.clearTimeout(b),g(null)}};d.addEventListener("error",()=>{window.clearTimeout(b),g(null)}),d.addEventListener("seeked",_,{once:!0}),d.addEventListener("loadeddata",()=>{const v=Math.min(c,Math.max(0,(d.duration||1)-.05));try{d.currentTime=v}catch{_()}})})}const Qe={priceTokens:500,deliveryDays:7,maxRevisions:1},Et={interiors:"מעצבי פנים",architects:"אדריכלים",developers:"יזמי נדל״ן",brokers:"מתווכי נדל״ן",furniture:"חנויות רהיטים",building:"חנויות בנייה"},fa=["interiors","architects","developers","brokers","furniture","building"],st=[{id:"int-sketch-render-bedroom",segment:"interiors",title:"סקיצה לרנדר פוטוריאליסטי - חדר שינה",description:"הפכי סקיצת יד לרנדר 4K מוכן ללקוח",requirements:"סקיצה/שרטוט ידני, סגנון רצוי, רשימת חומרים וצבעים",deliverables:"3 רנדרים פוטוריאליסטיים של חדר השינה באיכות 4K מזוויות שונות",categories:["render","sketches"]},{id:"int-sketch-render-living",segment:"interiors",title:"סקיצה לרנדר פוטוריאליסטי - סלון",description:"מהסקיצה שלך לתמונה שהלקוח באמת מבין",requirements:"סקיצה/שרטוט, פלטת צבעים, סגנון (מודרני, סקנדינבי וכו')",deliverables:"3 רנדרים של הסלון באיכות 4K מזוויות שונות",categories:["render","sketches"]},{id:"int-sketch-render-kitchen",segment:"interiors",title:"סקיצה לרנדר פוטוריאליסטי - מטבח",description:"רנדר מטבח שמוכר את הפרויקט ברגע",requirements:"תוכנית/סקיצה, סגנון המטבח, פלטת חומרים וצבעים",deliverables:"4 רנדרים של המטבח, כולל תאורת יום ולילה",categories:["render","sketches"]},{id:"int-sketch-render-bath-lux",segment:"interiors",title:"סקיצה לרנדר - חדר רחצה יוקרתי",description:"חדר רחצה שיהפוך את הפרויקט לבלתי נשכח",requirements:"תוכנית חדר רחצה, סגנון (מודרני/כפרי/מינימליסטי)",deliverables:"3 רנדרים של חדר הרחצה + 2 תקריבים של פינות מרכזיות",categories:["render","sketches"]},{id:"int-three-furniture-variations",segment:"interiors",title:"3 ואריאציות רהיטים על אותה סקיצה",description:"הציעי ללקוח 3 גרסאות בסשן אחד",requirements:"סקיצה של החלל + 3 סטים שונים של רהיטים לבחירה",deliverables:"3 רנדרים של אותו חלל עם סטים שונים של רהיטים",categories:["render","sketches"]},{id:"int-catalog-furniture-in-render",segment:"interiors",title:"שילוב רהיטים אמיתיים מהקטלוג ברנדר",description:"רהיטים אמיתיים מהספק שלך בתוך התמונה",requirements:"רנדר/סקיצה של החלל + תמונות של רהיטים אמיתיים לשילוב",deliverables:"רנדר פוטוריאליסטי עם הרהיטים האמיתיים משולבים במקום",categories:["render","images"]},{id:"int-three-styles-same-space",segment:"interiors",title:"3 סגנונות שונים לאותו חלל",description:"ללקוח מתלבט - הראי לו את כל האפשרויות",requirements:"תמונה/רנדר של החלל + 3 סגנונות רצויים",deliverables:"3 רנדרים של אותו חלל בסגנונות שונים לבחירה",categories:["render","sketches"]},{id:"int-home-tour-video-30s",segment:"interiors",title:"סיור וידאו בבית מעוצב - 30 שניות",description:"סרטון מקצועי שיכבוש את הלקוחות שלך",requirements:"רנדרים של הפרויקט + סגנון רצוי לסרטון",deliverables:"סרטון 30 שניות באיכות 4K עם מעברים חלקים וסאונד",categories:["video","render"]},{id:"int-before-after-video",segment:"interiors",title:"וידאו לפני/אחרי של שינוי חלל",description:"הלקוחות אוהבים לראות את הקסם קורה",requirements:"תמונת לפני + רנדר אחרי + תיאור השינוי",deliverables:"סרטון 15-20 שניות של המעבר מהחלל הישן למעוצב",categories:["video"]},{id:"int-detail-closeup-video",segment:"interiors",title:"וידאו תקריבים על פרטי עיצוב",description:"מצלמה על הדברים הקטנים שעושים את ההבדל",requirements:"רנדר מלא + נקודות עניין שתרצי להדגיש",deliverables:"סרטון 30 שניות עם תקריבים על 5-7 פרטי עיצוב מרכזיים",categories:["video"]},{id:"int-full-project-all-rooms",segment:"interiors",title:"רנדר פרויקט שלם - כל החדרים",description:"הפרויקט כולו מוכן לפרזנטציה ללקוח",requirements:"סקיצות של כל החדרים + סגנון אחיד + חומרים",deliverables:"רנדר לכל חדר + סרטון סיור כללי של 45 שניות",categories:["render","video","sketches"]},{id:"int-lighting-day-evening-night",segment:"interiors",title:"תאורת בוקר/ערב/לילה באותו חלל",description:"הראי ללקוח איך החלל חי לאורך היום",requirements:"רנדר/סקיצה של החלל + סגנון תאורה רצוי",deliverables:"3 גרסאות של אותו חלל - בוקר, אחר צהריים וערב",categories:["render"]},{id:"int-moodboard-video",segment:"interiors",title:"מוד בורד וידאו לפרויקט",description:"מוד בורד שחי - לא עוד תמונה סטטית",requirements:"תמונות השראה + פלטת צבעים + סגנון",deliverables:"סרטון 30 שניות עם כל האלמנטים של המוד בורד בתנועה",categories:["moodboard","video"]},{id:"int-tender-render-package",segment:"interiors",title:"רנדר להצעת מחיר או מכרז",description:"רנדר מנצח שיבטיח לך את הפרויקט",requirements:"תוכנית + דרישות המכרז + סגנון רצוי",deliverables:"3 רנדרים פוטוריאליסטיים + מצגת PDF מוכנה לפרזנטציה",categories:["render","general"]},{id:"int-portfolio-video-60s",segment:"interiors",title:"תיק עבודות וידאו - 60 שניות",description:"תיק עבודות בוידאו שיתפוצץ בסושל",requirements:"5-8 פרויקטים (רנדרים/תמונות) + סגנון רצוי",deliverables:"סרטון 60 שניות עם מעברים + גרסת רילס של 15 שניות",categories:["video","images"]}
16,{id:"arch-plan-exterior-render",segment:"architects",title:"תוכנית אדריכלית לרנדר חיצוני",description:"מקבלים DWG - מוציאים בניין אמיתי",requirements:"תוכנית אדריכלית (DWG/PDF) + סגנון חיצוני + חומרי גמר",deliverables:"3 רנדרים חיצוניים של הבניין באיכות 4K מזוויות שונות",categories:["render","floor_plan"]},{id:"arch-four-facades-3d",segment:"architects",title:"4 חזיתות של הבניין בתלת מימד",description:"כל הכיוונים של הבניין ברנדר איכותי",requirements:"תוכניות חזיתות + פלטת חומרים חיצוניים",deliverables:"4 רנדרים חיצוניים (צפון, דרום, מזרח, מערב) באיכות 4K",categories:["render"]},{id:"arch-building-orbit-video",segment:"architects",title:"סיור וידאו סביב הבניין",description:"טיסת רחפן וירטואלית סביב הפרויקט",requirements:"רנדרים של הבניין מזוויות שונות",deliverables:"סרטון 30 שניות של סיור 360 מעלות סביב הבניין",categories:["video","render"]},{id:"arch-dawn-dusk-night",segment:"architects",title:"הדמיית בוקר, ערב ולילה",description:"אותו בניין בכל שעות היום",requirements:"רנדר ראשוני של הבניין",deliverables:"3 גרסאות של הבניין - בוקר, ערב, לילה עם תאורה דרמטית",categories:["render"]},{id:"arch-existing-building-changes",segment:"architects",title:"הדמיית שינויים בבניין קיים",description:"הראי ללקוח איך השינוי ישנה את הכל",requirements:"תמונות הבניין הקיים + תיאור השינויים המתוכננים",deliverables:"רנדר פוטוריאליסטי של הבניין אחרי השינויים",categories:["render","images"]},{id:"arch-construction-animation",segment:"architects",title:"אנימציית בנייה - ממגרש לבניין",description:"מסד עד מסירת מפתח בסרטון אחד",requirements:"תוכנית בנייה + שלבים עיקריים + הדמיות",deliverables:"סרטון 45 שניות של תהליך בנייה מואץ מהמסד עד הגג",categories:["video","floor_plan"]},{id:"arch-full-presentation-pack",segment:"architects",title:"פרזנטציה אדריכלית - פאקאז' מלא",description:"פרזנטציה מקצועית שתנצח בוועדה",requirements:"תוכניות + קונספט הפרויקט + דרישות הפרזנטציה",deliverables:"5 רנדרים + סרטון 60 שניות + מצגת PPTX מוכנה להגשה",categories:["render","video","general"]},{id:"dev-promo-video-30s",segment:"developers",title:"סרטון פרסומת לפרויקט - 30 שניות",description:"סרטון שיביא לקוחות פוטנציאליים מיום השקה",requirements:"רנדרים של הפרויקט + לוגו + מסר שיווקי",deliverables:"סרטון 30 שניות לפייסבוק/יוטיוב באיכות 4K",categories:["video"]},{id:"dev-reels-15s",segment:"developers",title:"רילס פרויקט נדלן - 15 שניות",description:"רילס שגורם לאנשים לעצור ולצפות",requirements:"3-5 רנדרים + סגנון פרסומי רצוי",deliverables:"סרטון אנכי 9:16 של 15 שניות לאינסטגרם וטיקטוק",categories:["video","render"]},{id:"dev-virtual-tour-show-flat",segment:"developers",title:"סיור וירטואלי בדירה לדוגמה",description:"הלקוח מטייל בדירה עוד לפני שנבנתה",requirements:"תוכנית דירה + סגנון עיצוב רצוי + חומרי גמר",deliverables:"סרטון 45 שניות סיור חדר-חדר בדירה מעוצבת במלואה",categories:["video","render","floor_plan"]},{id:"dev-progress-animation",segment:"developers",title:"אנימציית התקדמות הפרויקט",description:"הבניין שלך ממגרש עד מסירת מפתח",requirements:"תוכניות בנייה + רנדרים של הפרויקט המוגמר",deliverables:"סרטון 60 שניות של תהליך הבנייה המואץ בפיצולי מסך",categories:["video"]},{id:"dev-full-marketing-video-campaign",segment:"developers",title:"קמפיין שיווקי וידאו מלא",description:"קמפיין שלם במקום אחד, מוכן להרצה",requirements:"חומרי שיווק + רנדרים + קונספט הקמפיין",deliverables:"סרטון 60 שניות + 3 גרסאות קצרות (15 שניות) לפלטפורמות שונות",categories:["video","general"]},{id:"dev-neighborhood-aerial",segment:"developers",title:"הדמיית שכונה שלמה",description:"לא רק בניין - שכונה שלמה שחיה",requirements:"תוכנית שכונה + סגנון + עיצוב סביבתי",deliverables:"5 רנדרים שכונתיים + סרטון 45 שניות של סיור עילי",categories:["render","video"]},{id:"dev-tv-spot-luxury",segment:"developers",title:"סרטון טלוויזיה לפרויקט יוקרה",description:"איכות טלוויזיונית לפרויקטים יוקרתיים",requirements:"רנדרים באיכות גבוהה + תסריט ומסר שיווקי",deliverables:"סרטון 30-45 שניות באיכות שידור 4K מוכן לטלוויזיה",categories:["video","render"]},{id:"dev-10-marketing-stills",segment:"developers",title:"10 תמונות שיווק לפני מכירות",description:"תמונות שיווק לפני שהפרויקט בכלל קיים",requirements:"תוכניות + סגנון + אלמנטים יוקרתיים לשילוב",deliverables:"10 תמונות שיווקיות באיכות גבוהה לאתר ולפרסומות",categories:["images","render"]},{id:"dev-youtube-preroll-15s",segment:"developers",title:"פרסומת יוטיוב פרי-רול - 15 שניות",description:"פרסומת קצרה שלא ידלגו עליה",requirements:"רנדרים + מסר עיקרי + קריאה לפעולה",deliverables:"סרטון 15 שניות ממוקד + גרסת 6 שניות בלתי נדלגת",categories:["video"]},{id:"dev-3d-camera-move-video",segment:"developers",title:"וידאו תלת מימד - תנועת מצלמה דרמטית",de
16scription:"הבניין בתנועה, 360 מעלות של וואו",requirements:"רנדרים של הבניין מזוויות שונות",deliverables:"סרטון 30 שניות עם תנועת מצלמה קולנועית סביב הפרויקט",categories:["video","render"]},{id:"brk-property-tour-video",segment:"brokers",title:"סיור וידאו בנכס למכירה",description:"הנכס נמכר מהר יותר עם סרטון מקצועי",requirements:"תמונות הנכס הקיים + נקודות חוזק עיקריות",deliverables:"סרטון 30 שניות של סיור חדר-חדר עם מוזיקה ומעברים",categories:["video","images"]},{id:"brk-virtual-staging",segment:"brokers",title:"Home Staging וירטואלי - מריק למעוצב",description:"דירה ריקה הופכת למעוצבת תוך 48 שעות",requirements:"תמונות של הדירה הריקה + סגנון עיצוב רצוי",deliverables:"תמונות מעוצבות של אותם החללים עם רהיטים ואביזרים",categories:["render","images"]},{id:"brk-photo-upgrade",segment:"brokers",title:"שדרוג תמונות נכס קיימות",description:"תמונות שנראות כמו מצילום מקצועי",requirements:"תמונות של הנכס (גם מצולמות בטלפון)",deliverables:"אותן תמונות משודרגות - תאורה, חדות ואיכות 4K",categories:["images"]},{id:"brk-reels-15s",segment:"brokers",title:"רילס לנכס - 15 שניות",description:"רילס שגורם לאנשים לפנות אליך",requirements:"תמונות הנכס + נקודות מכירה עיקריות",deliverables:"סרטון אנכי 9:16 של 15 שניות לאינסטגרם וטיקטוק",categories:["video"]},{id:"brk-stories-15s",segment:"brokers",title:"וידאו לסטוריז - 15 שניות",description:"סטורי שמביא פנייה ישירה של לקוחות",requirements:"5-10 תמונות של הנכס",deliverables:"סרטון מהיר של 15 שניות + טקסט ובקריאה לפעולה",categories:["video","images"]},{id:"brk-investor-deck",segment:"brokers",title:"פרזנטציה למשקיעים",description:"פרזנטציה מקצועית שמביאה השקעה",requirements:"פרטי הפרויקט + תמונות/תוכניות + יעדי השקעה",deliverables:"סרטון 60 שניות + 5 רנדרים + מצגת PPTX מקצועית",categories:["video","render","general"]},{id:"fur-catalog-to-video",segment:"furniture",title:"המרת קטלוג סטטי לקטלוג וידאו",description:"הקטלוג שלך חי ובתנועה",requirements:"20-50 תמונות מוצרים + סגנון הקטלוג",deliverables:"וידאו קטלוג 60 שניות + 10 רילס 15 שניות למוצרי דגל",categories:["video","images"]},{id:"fur-single-product-15s",segment:"furniture",title:"וידאו מוצר בודד - 15 שניות",description:"רהיט יחיד, סרטון איכותי שמוכר",requirements:"תמונה של רהיט אחד + תיאור",deliverables:"סרטון 15 שניות של הרהיט מזוויות שונות בתוך חלל מעוצב",categories:["video","images"]},{id:"fur-store-promo-30s",segment:"furniture",title:"סרטון פרסומת לחנות - 30 שניות",description:"הכירו את המותג שלכם מחדש",requirements:"לוגו + 5-10 מוצרי דגל + מסר פרסומי",deliverables:"סרטון 30 שניות מקצועי לפרסום בסושל וטלוויזיה",categories:["video"]},{id:"fur-product-in-real-room",segment:"furniture",title:"שילוב רהיט בחלל אמיתי",description:"הלקוח רואה את הרהיט אצלו בבית",requirements:"תמונת הרהיט + סגנון חלל (סלון/חדר שינה/מטבח)",deliverables:"3-5 תמונות של הרהיט בחללים מעוצבים שונים",categories:["render","images"]},{id:"fur-10-monthly-reels",segment:"furniture",title:"10 רילס חודשיים מוכנים",description:"תוכן חודשי מוכן, בלי התעסקות",requirements:"רשימת מוצרים שתרצו לקדם החודש",deliverables:"10 רילס של 15 שניות מוכנים לפרסום + כיתובים מוצעים",categories:["video"]},{id:"fur-product-photo-upgrade",segment:"furniture",title:"שדרוג תמונות מוצר",description:"תמונות מוצר באיכות מותג בינלאומי",requirements:"תמונות מוצר קיימות",deliverables:"אותן תמונות משודרגות - תאורה, רקע, איכות 4K",categories:["images"]},{id:"bld-catalog-video-materials",segment:"building",title:"קטלוג וידאו - חומרי גמר",description:"כל הקטלוג שלך בוידאו מקצועי",requirements:"דוגמאות מוצרים + קטלוג קיים",deliverables:"10 סרטוני מוצר + סרטון קטלוג כללי של 60 שניות",categories:["video","images"]},{id:"bld-product-in-real-space",segment:"building",title:"יישום מוצר בחלל אמיתי",description:"הלקוח רואה איך זה ייראה אצלו בבית",requirements:"תמונות המוצר + סוג החלל היעד (מטבח/רחצה)",deliverables:"3-5 רנדרים של המוצר מיושם בחללים מעוצבים שונים",categories:["render","images"]},{id:"bld-kitchen-bath-showcase",segment:"building",title:"הדגמת מטבחים וחדרי רחצה",description:"המוצרים שלך במטבחים וחדרי רחצה מעוצבים",requirements:"מוצרי דגל מהחנות",deliverables:"5 רנדרים של מטבחים וחדרי רחצה שמשלבים את המוצרים",categories:["render","images"]}
vendor: 12,684 bytes, line 16
16,{id:"bld-store-virtual-tour-60s",segment:"building",title:"סיור וירטואלי בחנות - 60 שניות",description:"לקוחות מטיילים בחנות לפני שהם מגיעים",requirements:"תמונות וסרטונים קיימים של החנות",deliverables:"סרטון סיור של 60 שניות משודרג באיכות מקצועית",categories:["video","images"]},{id:"bld-product-launch-social",segment:"building",title:"השקת מוצר חדש בסושל",description:"השקת מוצר חדשה שמרעישה בסושל",requirements:"תמונות המוצר החדש + מסר שיווקי",deliverables:"סרטון 30 שניות לסושל + 3 רילס 15 שניות להפצה",categories:["video"]},{id:"bld-assembly-install-video",segment:"building",title:"וידאו הרכבה/התקנה של המוצר",description:"הלקוח מבין איך להתקין לפני שהוא קונה",requirements:"תמונות/סרטון של תהליך ההתקנה",deliverables:"סרטון 30-45 שניות מקצועי עם שלבי התקנה ברורים",categories:["video"]}];function ba(t){const r=t.trim();return r?r.split(/\s+/).length:0}function va(){for(const t of st){const r=ba(t.title);if(r>8)throw new Error(`creatorServiceTemplates: title > 8 words for id=${t.id} (${r} words): "${t.title}"`)}}va();var Ft=1,wa=.9,ya=.8,ja=.17,Xe=.1,Je=.999,Na=.9999,_a=.99,Ca=/[\\\/_+.#"@\[\(\{&]/,ka=/[\\\/_+.#"@\[\(\{&]/g,Sa=/[\s-]/,Gt=/[\s-]/g;function nt(t,r,a,s,c,l,i){if(l===r.length)return c===t.length?Ft:_a;var d=`${c},${l}`;if(i[d]!==void 0)return i[d];for(var p=s.charAt(l),m=a.indexOf(p,c),u=0,g,b,_,v;m>=0;)g=nt(t,r,a,s,m+1,l+1,i),g>u&&(m===c?g*=Ft:Ca.test(t.charAt(m-1))?(g*=ya,_=t.slice(c,m-1).match(ka),_&&c>0&&(g*=Math.pow(Je,_.length))):Sa.test(t.charAt(m-1))?(g*=wa,v=t.slice(c,m-1).match(Gt),v&&c>0&&(g*=Math.pow(Je,v.length))):(g*=ja,c>0&&(g*=Math.pow(Je,m-c))),t.charAt(m)!==r.charAt(l)&&(g*=Na)),(g<Xe&&a.charAt(m-1)===s.charAt(l+1)||s.charAt(l+1)===s.charAt(l)&&a.charAt(m-1)!==s.charAt(l))&&(b=nt(t,r,a,s,m+1,l+2,i),b*Xe>g&&(g=b*Xe)),g>u&&(u=g),m=a.indexOf(p,m+1);return i[d]=u,u}function qt(t){return t.toLowerCase().replace(Gt," ")}function Ea(t,r,a){return t=a&&a.length>0?`${t+" "+a.join(" ")}`:t,nt(t,r,qt(t),qt(r),0,0,{})}var _e='[cmdk-group=""]',Ye='[cmdk-group-items=""]',Fa='[cmdk-group-heading=""]',Qt='[cmdk-item=""]',$t=`${Qt}:not([aria-disabled="true"])`,lt="cmdk-item-select",we="data-value",qa=(t,r,a)=>Ea(t,r,a),Xt=o.createContext(void 0),qe=()=>o.useContext(Xt),Jt=o.createContext(void 0),mt=()=>o.useContext(Jt),Yt=o.createContext(void 0),Zt=o.forwardRef((t,r)=>{let a=ye(()=>{var h,C;return{search:"",value:(C=(h=t.value)!=null?h:t.defaultValue)!=null?C:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=ye(()=>new Set),c=ye(()=>new Map),l=ye(()=>new Map),i=ye(()=>new Set),d=Tt(t),{label:p,children:m,value:u,onValueChange:g,filter:b,shouldFilter:_,loop:v,disablePointerSelection:w=!1,vimBindings:$=!0,...j}=t,O=pe(),E=pe(),y=pe(),P=o.useRef(null),k=Wa();xe(()=>{if(u!==void 0){let h=u.trim();a.current.value=h,I.emit()}},[u]),xe(()=>{k(6,Z)},[]);let I=o.useMemo(()=>({subscribe:h=>(i.current.add(h),()=>i.current.delete(h)),snapshot:()=>a.current,setState:(h,C,A)=>{var N,f,F,X;if(!Object.is(a.current[h],C)){if(a.current[h]=C,h==="search")ae(),re(),k(1,J);else if(h==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let z=document.getElementById(y);z?z.focus():(N=document.getElementById(O))==null||N.focus()}if(k(7,()=>{var z;a.current.selectedItemId=(z=T())==null?void 0:z.id,I.emit()}),A||k(5,Z),((f=d.current)==null?void 0:f.value)!==void 0){let z=C??"";(X=(F=d.current).onValueChange)==null||X.call(F,z);return}}I.emit()}},emit:()=>{i.current.forEach(h=>h())}}),[]),W=o.useMemo(()=>({value:(h,C,A)=>{var N;C!==((N=l.current.get(h))==null?void 0:N.value)&&(l.current.set(h,{value:C,keywords:A}),a.current.filtered.items.set(h,R(C,A)),k(2,()=>{re(),I.emit()}))},item:(h,C)=>(s.current.add(h),C&&(c.current.has(C)?c.current.get(C).add(h):c.current.set(C,new Set([h]))),k(3,()=>{ae(),re(),a.current.value||J(),I.emit()}),()=>{l.current.delete(h),s.current.delete(h),a.current.filtered.items.delete(h);let A=T();k(4,()=>{ae(),(A==null?void 0:A.getAttribute("id"))===h&&J(),I.emit()})}),group:h=>(c.current.has(h)||c.current.set(h,new Set),()=>{l.current.delete(h),c.current.delete(h)}),filter:()=>d.current.shouldFilter,label:p||t["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:O,inputId:y,labelId:E,listInnerRef:P}),[]);function R(h,C){var A,N;let f=(N=(A=d.current)==null?void 0:A.filter)!=null?N:qa;return h?f(h,a.current.search,C):0}function re(){if(!a.current.search||d.current.shouldFilter===!1)return;let h=a.current.filtered.items,C=[];a.current.filtered.groups.forEach(N=>{let f=c.current.get(N),F=0;f.forEach(X=>{let z=h.get(X);F=Math.max(z,F)}),C.push([N,F])});let A=P.current;D().sort((N,f)=>{var F,X;let z=N.getAttribute("id"),ce=f.getAttribute("id");return((F=h.get(ce))!=null?F:0)-((X=h.get(z))!=null?X:0)}).forEach(N=>{let f=N.closest(Ye);f?f.appendChild(N.parentElement===f?N:N.closest(`${Ye} > *`)):A.appendChild(N.parentElement===A?N:N.closest(`${Ye} > *`))}),C.sort((N,f)=>f[1]-N[1]).forEach(N=>{var f;let F=(f=P.current)==null?void 0:f.querySelector(`${_e}[${we}="${encodeURIComponent(N[0])}"]`);F==null||F.parentElement.appendChild(F)})}function J(){let h=D().find(A=>A.getAttribute("aria-disabled")!=="true"),C=h==null?void 0:h.getAttribute(we);I.setState("value",C||void 0)}function ae(){var h,C,A,N;if(!a.current.search||d.current.shouldFilter===!1){a.current.filtered.count=s.current.size;return}a.current.filtered.groups=new Set;let f=0;for(let F of s.current){let X=(C=(h=l.current.get(F))==null?void 0:h.value)!=null?C:"",z=(N=(A=l.current.get(F))==null?void 0:A.keywords)!=null?N:[],ce=R(X,z);a.current.filtered.items.set(F,ce),ce>0&&f++}for(let[F,X]of c.current)for(let z of X)if(a.current.filtered.items.get(z)>0){a.current.filtered.groups.add(F);break}a.current.filtered.count=f}function Z(){var h,C,A;let N=T();N&&(((h=N.parentElement)==null?void 0:h.firstChild)===N&&((A=(C=N.closest(_e))==null?void 0:C.querySelector(Fa))==null||A.scrollIntoView({block:"nearest"})),N.scrollIntoView({block:"nearest"}))}function T(){var h;return(h=P.current)==null?void 0:h.querySelector(`${Qt}[aria-selected="true"]`)}function D(){var h;return Array.from(((h=P.current)==null?void 0:h.querySelectorAll($t))||[])}function oe(h){let C=D()[h];C&&I.setState("value",C.getAttribute(we))}function L(h){var C;let A=T(),N=D(),f=N.findIndex(X=>X===A),F=N[f+h];(C=d.current)!=null&&C.loop&&(F=f+h<0?N[N.length-1]:f+h===N.length?N[0]:N[f+h]),F&&I.setState("value",F.getAttribute(we))}function Q(h){let C=T(),A=C==null?void 0:C.closest(_e),N;for(;A&&!N;)A=h>0?Oa(A,_e):Da(A,_e),N=A==null?void 0:A.querySelector($t);N?I.setState("value",N.getAttribute(we)):L(h)}let V=()=>oe(D().length-1),U=h=>{h.preventDefault(),h.metaKey?V():h.altKey?Q(1):L(1)},se=h=>{h.preventDefault(),h.metaKey?oe(0):h.altKey?Q(-1):L(-1)};return o.createElement(ie.div,{ref:r,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:h=>{var C;(C=j.onKeyDown)==null||C.call(j,h);let A=h.nativeEvent.isComposing||h.keyCode===229;if(!(h.defaultPrevented||A))switch(h.key){case"n":case"j":{$&&h.ctrlKey&&U(h);break}case"ArrowDown":{U(h);break}case"p":case"k":{$&&h.ctrlKey&&se(h);break}case"ArrowUp":{se(h);break}case"Home":{h.preventDefault(),oe(0);break}case"End":{h.preventDefault(),V();break}case"Enter":{h.preventDefault();let N=T();if(N){let f=new Event(lt);N.dispatchEvent(f)}}}}},o.createElement("label",{"cmdk-label":"",htmlFor:W.inputId,id:W.labelId,style:za},p),Oe(t,h=>o.createElement(Jt.Provider,{value:I},o.createElement(Xt.Provider,{value:W},h))))}),$a=o.forwardRef((t,r)=>{var a,s;let c=pe(),l=o.useRef(null),i=o.useContext(Yt),d=qe(),p=Tt(t),m=(s=(a=p.current)==null?void 0:a.forceMount)!=null?s:i==null?void 0:i.forceMount;xe(()=>{if(!m)return d.item(c,i==null?void 0:i.id)},[m]);let u=Rt(c,l,[t.value,t.children,l],t.keywords),g=mt(),b=he(k=>k.value&&k.value===u.current),_=he(k=>m||d.filter()===!1?!0:k.search?k.filtered.items.get(c)>0:!0);o.useEffect(()=>{let k=l.current;if(!(!k||t.disabled))return k.addEventListener(lt,v),()=>k.removeEventListener(lt,v)},[_,t.onSelect,t.disabled]);function v(){var k,I;w(),(I=(k=p.current).onSelect)==null||I.call(k,u.current)}function w(){g.setState("value",u.current,!0)}if(!_)return null;let{disabled:$,value:j,onSelect:O,forceMount:E,keywords:y,...P}=t;return o.createElement(ie.div,{ref:Ce(l,r),...P,id:c,"cmdk-item":"",role:"option","aria-disabled":!!$,"aria-selected":!!b,"data-disabled":!!$,"data-selected":!!b,onPointerMove:$||d.getDisablePointerSelection()?void 0:w,onClick:$?void 0:v},t.children)}),Pa=o.forwardRef((t,r)=>{let{heading:a,children:s,forceMount:c,...l}=t,i=pe(),d=o.useRef(null),p=o.useRef(null),m=pe(),u=qe(),g=he(_=>c||u.filter()===!1?!0:_.search?_.filtered.groups.has(i):!0);xe(()=>u.group(i),[]),Rt(i,d,[t.value,t.heading,p]);let b=o.useMemo(()=>({id:i,forceMount:c}),[c]);return o.createElement(ie.div,{ref:Ce(d,r),...l,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},a&&o.createElement("div",{ref:p,"cmdk-group-heading":"","aria-hidden":!0,id:m},a),Oe(t,_=>o.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":a?m:void 0},o.createElement(Yt.Provider,{value:b},_))))}),Aa=o.forwardRef((t,r)=>{let{alwaysRender:a,...s}=t,c=o.useRef(null),l=he(i=>!i.search);return!a&&!l?null:o.createElement(ie.div,{ref:Ce(c,r),...s,"cmdk-separator":"",role:"separator"})}),Ma=o.forwardRef((t,r)=>{let{onValueChange:a,...s}=t,c=t.value!=null,l=mt(),i=he(m=>m.search),d=he(m=>m.selectedItemId),p=qe();return o.useEffect(()=>{t.value!=null&&l.setState("search",t.value)},[t.value]),o.createElement(ie.input,{ref:r,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":p.listId,"aria-labelledby":p.labelId,"aria-activedescendant":d,id:p.inputId,type:"text",value:c?t.value:i,onChange:m=>{c||l.setState("search",m.target.value),a==null||a(m.target.value)}})}),Ua=o.forwardRef((t,r)=>{let{children:a,label:s="Suggestions",...c}=t,l=o.useRef(null),i=o.useRef(null),d=he(m=>m.selectedItemId),p=qe();return o.useEffect(()=>{if(i.current&&l.current){let m=i.current,u=l.current,g,b=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let _=m.offsetHeight;u.style.setProperty("--cmdk-list-height",_.toFixed(1)+"px")})});return b.observe(m),()=>{cancelAnimationFrame(g),b.unobserve(m)}}},[]),o.createElement(ie.div,{ref:Ce(l,r),...c,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":s,id:p.listId},Oe(t,m=>o.createElement("div",{ref:Ce(i,p.listInnerRef),"cmdk-list-sizer":""},m)))}),Ia=o.forwardRef((t,r)=>{let{open:a,onOpenChange:s,overlayClassName:c,contentClassName:l,container:i,...d}=t;return o.createElement(kr,{open:a,onOpenChange:s},o.createElement(Sr,{container:i},o.createElement(Er,{"cmdk-overlay":"",className:c}),o.createElement(Fr,{"aria-label":t.label,"cmdk-dialog":"",className:l},o.createElement(Zt,{ref:r,...d}))))}),Ba=o.forwardRef((t,r)=>he(a=>a.filtered.count===0)?o.createElement(ie.div,{ref:r,...t,"cmdk-empty":"",role:"presentation"}):null),Ka=o.forwardRef((t,r)=>{let{progress:a,children:s,label:c="Loading...",...l}=t;return o.createElement(ie.div,{ref:r,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,"aria-label":c},Oe(t,i=>o.createElement("div",{"aria-hidden":!0},i)))}),te=Object.assign(Zt,{List:Ua,Item:$a,Input:Ma,Group:Pa,Separator:Aa,Dialog:Ia,Empty:Ba,Loading:Ka});function Oa(t,r){let a=t.nextElementSibling;for(;a;){if(a.matches(r))return a;a=a.nextElementSibling}}function Da(t,r){let a=t.previousElementSibling;for(;a;){if(a.matches(r))return a;a=a.previousElementSibling}}function Tt(t){let r=o.useRef(t);return xe(()=>{r.current=t}),r}var xe=typeof window>"u"?o.useEffect:o.useLayoutEffect;function ye(t){let r=o.useRef();return r.current===void 0&&(r.current=t()),r}function he(t){let r=mt(),a=()=>t(r.snapshot());return o.useSyncExternalStore(r.subscribe,a,a)}function Rt(t,r,a,s=[]){let c=o.useRef(),l=qe();return xe(()=>{var i;let d=(()=>{var m;for(let u of a){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(m=u.current.textContent)==null?void 0:m.trim():c.current}})(),p=s.map(m=>m.trim());l.value(t,d,p),(i=r.current)==null||i.setAttribute(we,d),c.current=d}),c}var Wa=()=>{let[t,r]=o.useState(),a=ye(()=>new Map);return xe(()=>{a.current.forEach(s=>
16s()),a.current=new Map},[t]),(s,c)=>{a.current.set(s,c),r({})}};function Va(t){let r=t.type;return typeof r=="function"?r(t.props):"render"in r?r.render(t.props):t}function Oe({asChild:t,children:r},a){return t&&o.isValidElement(r)?o.cloneElement(Va(r),{ref:r.ref},a(r.props.children)):a(r)}var za={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Lt=o.forwardRef(({className:t,...r},a)=>e.jsx(te,{ref:a,className:n("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...r}));Lt.displayName=te.displayName;const er=o.forwardRef(({className:t,...r},a)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Ir,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(te.Input,{ref:a,className:n("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...r})]}));er.displayName=te.Input.displayName;const tr=o.forwardRef(({className:t,...r},a)=>e.jsx(te.List,{ref:a,className:n("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...r}));tr.displayName=te.List.displayName;const rr=o.forwardRef((t,r)=>e.jsx(te.Empty,{ref:r,className:"py-6 text-center text-sm",...t}));rr.displayName=te.Empty.displayName;const it=o.forwardRef(({className:t,...r},a)=>e.jsx(te.Group,{ref:a,className:n("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...r}));it.displayName=te.Group.displayName;const Ha=o.forwardRef(({className:t,...r},a)=>e.jsx(te.Separator,{ref:a,className:n("-mx-1 h-px bg-border",t),...r}));Ha.displayName=te.Separator.displayName;const ot=o.forwardRef(({className:t,...r},a)=>e.jsx(te.Item,{ref:a,className:n("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",t),...r}));ot.displayName=te.Item.displayName;const Pt={"image/jpeg":"jpg","image/jpg":"jpg","image/png":"png","image/webp":"webp","image/gif":"gif","video/mp4":"mp4","video/quicktime":"mov","video/webm":"webm","video/x-m4v":"m4v","application/pdf":"pdf"};function Ga(t,r){if(Pt[t])return Pt[t];const a=r.split(".");return a.length>1?a.pop().toLowerCase():"bin"}function ht(t){const{user:r}=ge(),a=Be(),s=Ne({queryKey:["creator-samples",t],queryFn:async()=>{if(!t)return[];const{data:p,error:m}=await S.from("marketplace_samples").select("*").eq("creator_id",t).order("created_at",{ascending:!1});if(m)throw m;return p||[]},enabled:!!t&&!!r});o.useEffect(()=>{if(!t)return;const p=S.channel(`creator-samples:${t}`).on("postgres_changes",{event:"*",schema:"public",table:"marketplace_samples",filter:`creator_id=eq.${t}`},()=>{a.invalidateQueries({queryKey:["creator-samples",t]})}).subscribe();return()=>{S.removeChannel(p)}},[t,a]);const c=o.useCallback(async p=>{var w;if(!r)throw new Error("Not authenticated");const m=Ga(p.file.type,p.file.name),u=((w=crypto.randomUUID)==null?void 0:w.call(crypto))??`${Date.now()}-${Math.random().toString(36).slice(2,10)}`,g=`${r.id}/${u}.${m}`,{error:b}=await S.storage.from("marketplace-samples").upload(g,p.file,{contentType:p.file.type,upsert:!1});if(b)throw b;const{data:_,error:v}=await S.functions.invoke("marketplace-sample-create",{body:{order_id:p.order_id,file_path:g,file_name:p.file.name,mime_type:p.file.type,title:p.title,description:p.description}});if(v)throw await S.storage.from("marketplace-samples").remove([g]).catch(()=>null),v;if(!(_!=null&&_.success))throw await S.storage.from("marketplace-samples").remove([g]).catch(()=>null),new Error((_==null?void 0:_.error)||"Failed to create sample");return a.invalidateQueries({queryKey:["creator-samples",t]}),_},[r,t,a]),l=o.useCallback(async p=>{const{data:m,error:u}=await S.functions.invoke("marketplace-sample-send",{body:{sample_id:p}});if(u)throw u;if(!(m!=null&&m.success))throw new Error((m==null?void 0:m.error)||"Failed to send sample");return a.invalidateQueries({queryKey:["creator-samples",t]}),m},[t,a]),i=o.useCallback(async(p,m)=>{const{data:u,error:g}=await S.functions.invoke("marketplace-sample-update",{body:{sample_id:p,...m}});if(g)throw g;if(!(u!=null&&u.success))throw new Error((u==null?void 0:u.error)||"Failed to update sample");return a.invalidateQueries({queryKey:["creator-samples",t]}),u},[t,a]),d=o.useCallback(async p=>{const{data:m,error:u}=await S.functions.invoke("marketplace-sample-revoke",{body:{sample_id:p}});if(u)throw u;if(!(m!=null&&m.success))throw new Error((m==null?void 0:m.error)||"Failed to revoke sample");return a.invalidateQueries({queryKey:["creator-samples",t]}),m},[t,a]);return{samples:s.data||[],isLoading:s.isLoading,error:s.error,createSample:c,sendSample:l,revokeSample:d,updateSample:i}}const Qa=500*1024*1024,Xa=new Set(["image/jpeg","image/jpg","image/png","image/webp","image/gif","video/mp4","video/quicktime","video/webm","video/x-m4v","application/pdf"]),Ja="image/*,video/mp4,video/quicktime,video/webm,video/x-m4v,application/pdf";function Ya({open:t,onOpenChange:r,creatorId:a,orders:s,defaultOrderId:c,isRTL:l,isDark:i}){var V;const{createSample:d,sendSample:p,revokeSample:m}=ht(a),[u,g]=o.useState("form"),[b,_]=o.useState(c||((V=s[0])==null?void 0:V.id)||""),[v,w]=o.useState(null),[$,j]=o.useState(""),[O,E]=o.useState(""),[y,P]=o.useState(!1),[k,I]=o.use
16State(!1),[W,R]=o.useState(null),re=o.useRef(null);o.useEffect(()=>{t?c&&_(c):setTimeout(()=>{g("form"),w(null),j(""),E(""),R(null)},200)},[t,c]);const J=o.useMemo(()=>v?URL.createObjectURL(v):null,[v]);o.useEffect(()=>()=>{J&&URL.revokeObjectURL(J)},[J]);function ae(U){var h;const se=(h=U.target.files)==null?void 0:h[0];if(U.target.value="",!!se){if(se.size>Qa){M.error(l?"הקובץ גדול מדי (מקסימום 500MB)":"File is too large (max 500MB)");return}if(se.type&&!Xa.has(se.type)){M.error(l?"סוג קובץ לא נתמך":"Unsupported file type");return}w(se)}}const Z=!!b&&!!v&&!y;async function T(){if(!(!b||!v)){P(!0);try{const U=await d({order_id:b,file:v,title:$.trim()||void 0,description:O.trim()||void 0});R(U),g("preview"),M.success(l?"דף הדוגמה נוצר!":"Sample page created!")}catch(U){M.error((U==null?void 0:U.message)||(l?"שגיאה ביצירת דף הדוגמה":"Failed to create sample"))}finally{P(!1)}}}async function D(){if(W){I(!0);try{await p(W.sample_id),M.success(l?"הלינק נשלח לצ'אט ההזמנה":"Link sent to order chat"),r(!1)}catch(U){M.error((U==null?void 0:U.message)||(l?"שגיאה בשליחה":"Failed to send"))}finally{I(!1)}}}async function oe(){if(W)try{await m(W.sample_id),M.message(l?"הלינק בוטל":"Link revoked")}catch{}r(!1)}const L=l?"rtl":"ltr",Q=l?"font-heebo":"";return e.jsx(ke,{open:t,onOpenChange:r,children:e.jsxs(Se,{className:n("sm:max-w-2xl max-h-[90vh] overflow-y-auto rounded-2xl",i?"bg-[#1e1f26] border border-white/10 text-white":"bg-white"),dir:L,children:[e.jsx(Ee,{children:e.jsx(Fe,{className:n("text-base font-semibold",Q),children:u==="form"?l?"יצירת דף דוגמה ללקוח":"Create Sample Page":l?"תצוגה מקדימה של דף הדוגמה":"Preview Sample Page"})}),u==="form"&&e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{children:[e.jsx(G,{className:n("text-xs font-medium",Q),children:l?"בחר הזמנה":"Order"}),e.jsxs(Br,{value:b,onValueChange:_,children:[e.jsx(Kr,{className:"mt-1.5 rounded-xl",children:e.jsx(Or,{placeholder:l?"בחר הזמנה בעבודה":"Pick an in-progress order"})}),e.jsxs(Dr,{children:[s.length===0&&e.jsx("div",{className:n("px-3 py-2 text-xs text-gray-500",Q),children:l?"אין הזמנות פעילות":"No active orders"}),s.map(U=>e.jsx(Wr,{value:U.id,children:e.jsxs("span",{className:Q,children:["#",U.order_number," · ",U.service_title||U.status]})},U.id))]})]})]}),e.jsxs("div",{children:[e.jsx(G,{className:n("text-xs font-medium",Q),children:l?"העלה קובץ (תמונה, וידאו או PDF · עד 500MB)":"Upload file (image, video or PDF · up to 500MB)"}),e.jsx("input",{ref:re,type:"file",accept:Ja,className:"hidden",onChange:ae}),e.jsx("div",{onClick:()=>{var U;return(U=re.current)==null?void 0:U.click()},className:n("mt-1.5 border-2 border-dashed rounded-xl p-5 text-center cursor-pointer transition-colors",i?"border-white/15 hover:border-white/30":"border-gray-300 hover:border-gray-500"),children:v?e.jsxs("div",{className:"flex items-center gap-3 justify-center",children:[v.type.startsWith("image/")&&J&&e.jsx("img",{src:J,alt:"",className:"w-16 h-16 rounded-lg object-cover border"}),v.type.startsWith("video/")&&J&&e.jsx("video",{src:J,className:"w-16 h-16 rounded-lg object-cover bg-black",muted:!0,playsInline:!0,preload:"metadata"}),e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:n("font-medium truncate max-w-[240px]",Q),children:v.name}),e.jsxs("p",{className:n("text-xs opacity-60",Q),children:[(v.size/(1024*1024)).toFixed(1)," MB"]})]})]}):e.jsxs("div",{children:[e.jsx(Vt,{className:"w-6 h-6 mx-auto mb-2 opacity-60"}),e.jsx("p",{className:n("text-sm font-medium",Q),children:l?"לחץ כדי לבחור קובץ":"Click to pick a file"}),e.jsx("p",{className:n("text-xs opacity-60 mt-1",Q),children:"PNG, JPG, MP4, MOV, WEBM, PDF"})]})})]}),e.jsxs("div",{children:[e.jsx(G,{className:n("text-xs font-medium",Q),children:l?"כותרת (אופציונלי)":"Title (optional)"}),e.jsx(ue,{value:$,onChange:U=>j(U.target.value.slice(0,100)),placeholder:l?'לדוגמה: "רנדר ראשוני של הסלון"':'e.g. "Initial living-room render"',className:"mt-1.5 rounded-xl",dir:L})]}),e.jsxs("div",{children:[e.jsx(G,{className:n("text-xs font-medium",Q),children:l?"הסבר ללקוח (אופציונלי)":"Explanation for the buyer (optional)"}),e.jsx(me,{value:O,onChange:U=>E(U.target.value.slice(0,2e3)),placeholder:l?"מה הלקוח רואה? מה חשוב לשים לב אליו? איפה הוא יכול לבקש שינויים?":"What is the buyer seeing? What to look out for? Where can they request changes?",className:"mt-1.5 rounded-xl min-h-[120px]",dir:L})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(K,{variant:"ghost",onClick:()=>r(!1),children:l?"ביטול":"Cancel"}),e.jsxs(K,{onClick:T,disabled:!Z,className:"rounded-xl text-white",style:{background:"#336CFF"},children:[y&&e.jsx(le,{className:"w-4 h-4 me-2 animate-spin"}),l?"צור דף דוגמה":"Create Sample Page"]})]})]}),u==="preview"&&W&&e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:n("roun
16ded-xl p-3 text-xs flex items-center gap-2",i?"bg-yellow-500/10 text-yellow-200":"bg-yellow-50 text-yellow-900",Q),children:[e.jsx(xa,{className:"w-4 h-4 shrink-0"}),l?`זוהי תצוגה מקדימה. לחץ "שלח ללקוח" כדי לשלוח את הלינק לצ'אט ההזמנה.`:'This is a preview. Click "Send to buyer" to post the link in the order chat.']}),e.jsx("div",{className:n("rounded-xl overflow-hidden border",i?"border-white/10":"border-gray-200"),children:e.jsx("iframe",{src:`/sample/${W.token}`,title:"sample-preview",className:"w-full",style:{height:"60vh"}})}),e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[e.jsxs("a",{href:`/sample/${W.token}`,target:"_blank",rel:"noopener noreferrer",className:n("text-xs flex items-center gap-1 opacity-70 hover:opacity-100",Q),children:[e.jsx(Bt,{className:"w-3.5 h-3.5"}),l?"פתח בלשונית חדשה":"Open in new tab"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(K,{variant:"ghost",onClick:oe,children:l?"בטל והסגר":"Cancel & Close"}),e.jsxs(K,{onClick:D,disabled:k,className:"rounded-xl text-white",style:{background:"#336CFF"},children:[k?e.jsx(le,{className:"w-4 h-4 me-2 animate-spin"}):e.jsx(Kt,{className:"w-4 h-4 me-2"}),l?"שלח ללקוח":"Send to buyer"]})]})]})]})]})})}function Za({open:t,onOpenChange:r,sample:a,creatorId:s,isRTL:c,isDark:l}){const{updateSample:i}=ht(s),[d,p]=o.useState(""),[m,u]=o.useState(""),[g,b]=o.useState(!1);if(o.useEffect(()=>{t&&a&&(p(a.title||""),u(a.description||""))},[t,a]),!a)return null;async function _(){if(a){b(!0);try{await i(a.id,{title:d.trim()||null,description:m.trim()||null}),M.success(c?"הדוגמה עודכנה":"Sample updated"),r(!1)}catch($){M.error(($==null?void 0:$.message)||(c?"שגיאה בעדכון":"Update failed"))}finally{b(!1)}}}const v=c?"font-heebo":"",w=c?"rtl":"ltr";return e.jsx(ke,{open:t,onOpenChange:r,children:e.jsxs(Se,{className:n("sm:max-w-lg rounded-2xl",l?"bg-[#1e1f26] border border-white/10 text-white":"bg-white"),dir:w,children:[e.jsx(Ee,{children:e.jsx(Fe,{className:n("text-base font-semibold",v),children:c?"עריכת דף דוגמה":"Edit Sample Page"})}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{children:[e.jsx(G,{className:n("text-xs font-medium",v),children:c?"כותרת":"Title"}),e.jsx(ue,{value:d,onChange:$=>p($.target.value.slice(0,100)),placeholder:c?"כותרת לדף הדוגמה":"Sample title",className:"mt-1.5 rounded-xl",dir:w})]}),e.jsxs("div",{children:[e.jsx(G,{className:n("text-xs font-medium",v),children:c?"הסבר ללקוח":"Explanation for the buyer"}),e.jsx(me,{value:m,onChange:$=>u($.target.value.slice(0,2e3)),placeholder:c?"מה הלקוח רואה? מה חשוב לשים לב אליו?":"What is the buyer seeing? What to look out for?",className:"mt-1.5 rounded-xl min-h-[140px]",dir:w})]}),e.jsx("p",{className:n("text-[11px] opacity-60",v),children:c?"הקובץ עצמו אינו ניתן לעריכה. אם צריך קובץ אחר, צור דף דוגמה חדש.":"The file itself cannot be edited. If you need a different file, create a new sample."}),e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx(K,{variant:"ghost",onClick:()=>r(!1),children:c?"ביטול":"Cancel"}),e.jsxs(K,{onClick:_,disabled:g,className:"rounded-xl text-white",style:{background:"#336CFF"},children:[g?e.jsx(le,{className:"w-4 h-4 me-2 animate-spin"}):e.jsx(na,{className:"w-4 h-4 me-2"}),c?"שמור":"Save"]})]})]})]})})}const Ae="#336CFF";function Ta({creatorId:t,orders:r,isRTL:a,isDark:s,darkSurfaceStyle:c}){const{samples:l,isLoading:i,sendSample:d,revokeSample:p}=ht(t),[m,u]=o.useState(!1),[g,b]=o.useState(null),[_,v]=o.useState({}),w=o.useMemo(()=>r.filter(y=>["paid","in_progress","delivered","completed"].includes(y.status)),[r]),$=o.useMemo(()=>Object.fromEntries(r.map(y=>[y.id,y])),[r]);async function j(y){v(P=>({...P,[y.id]:"sending"}));try{await d(y.id),M.success(a?"נשלח ללקוח":"Sent to buyer")}catch(P){M.error((P==null?void 0:P.message)||(a?"שגיאה בשליחה":"Send failed"))}finally{v(P=>({...P,[y.id]:void 0}))}}async function O(y){if(confirm(a?"לבטל גישה ללינק הזה? הלקוח כבר לא יוכל לצפות בדף הדוגמה.":"Revoke this link? The buyer will no longer be able to view it.")){v(k=>({...k,[y.id]:"revoking"}));
16try{await p(y.id),M.success(a?"הגישה בוטלה":"Access revoked")}catch(k){M.error((k==null?void 0:k.message)||(a?"שגיאה בביטול":"Revoke failed"))}finally{v(k=>({...k,[y.id]:void 0}))}}}const E=a?"font-heebo":"";return e.jsxs("div",{className:n("rounded-2xl p-5",s?"border border-white/[0.08] shadow-[0_6px_28px_rgba(0,0,0,0.15)]":"bg-white border border-gray-100"),style:s?c:void 0,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:n("text-base font-semibold flex items-center gap-2",s?"text-white":"text-[#182137]",E),children:[e.jsx(Vr,{className:"w-4 h-4",style:{color:Ae}}),a?"דפי דוגמה":"Sample Pages"]}),e.jsxs(K,{size:"sm",onClick:()=>u(!0),disabled:w.length===0,className:"rounded-lg text-white text-xs h-8 px-3",style:{background:Ae},children:[e.jsx(Re,{className:"w-3.5 h-3.5 me-1"}),a?"חדש":"New"]})]}),w.length===0&&l.length===0&&e.jsx("div",{className:n("rounded-xl p-6 text-center text-xs",s?"bg-black/20 text-white/60":"bg-gray-50 text-gray-500",E),children:a?"אין לך הזמנות פעילות עדיין. דפי דוגמה זמינים אחרי שתקבל הזמנה.":"No active orders yet. Sample pages become available once you have a paid order."}),i&&e.jsx("div",{className:"flex items-center justify-center py-6",children:e.jsx(le,{className:"w-5 h-5 animate-spin opacity-60"})}),!i&&l.length>0&&e.jsx("div",{className:"space-y-2",children:l.map(y=>{const P=$[y.order_id],k=y.is_active?y.sent_to_chat?a?"נשלח":"Sent":a?"טיוטה":"Draft":a?"בוטל":"Revoked",I=y.is_active?y.sent_to_chat?"#10B981":"#F59E0B":"#EF4444",W=_[y.id],R=y.file_type==="video"?zr:y.file_type==="pdf"?la:ia;return e.jsxs("div",{className:n("rounded-xl border p-3 flex items-center gap-3",s?"bg-white/[0.02] border-white/[0.08]":"bg-gray-50 border-gray-200"),children:[e.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center shrink-0",style:{background:`${Ae}18`},children:e.jsx(R,{className:"w-5 h-5",style:{color:Ae}})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:n("text-sm font-medium truncate",E),children:y.title||y.original_filename||(a?"דוגמה":"Sample")}),e.jsx(Ot,{variant:"outline",className:"text-[10px] px-1.5 py-0 border-0",style:{background:`${I}22`,color:I},children:k})]}),e.jsxs("div",{className:n("text-[11px] opacity-60 truncate mt-0.5",E),children:[P?`#${P.order_number} · ${P.service_title||""}`:y.order_id," · ",a?`${y.view_count} צפיות`:`${y.view_count} views`]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(K,{size:"icon",variant:"ghost",onClick:()=>window.open(`/sample/${y.token}`,"_blank"),title:a?"תצוגה מקדימה":"Preview",className:"h-8 w-8",children:e.jsx(Bt,{className:"w-4 h-4"})}),y.is_active&&e.jsx(K,{size:"icon",variant:"ghost",onClick:()=>b(y),title:a?"ערוך כותרת/הסבר":"Edit title/description",className:"h-8 w-8",children:e.jsx(Ke,{className:"w-4 h-4"})}),y.is_active&&!y.sent_to_chat&&e.jsx(K,{size:"icon",variant:"ghost",onClick:()=>j(y),disabled:W==="sending",title:a?"שלח ללקוח":"Send to buyer",className:"h-8 w-8 text-emerald-600 hover:text-emerald-500",children:W==="sending"?e.jsx(le,{className:"w-4 h-4 animate-spin"}):e.jsx(Kt,{className:"w-4 h-4"})}),y.is_active&&e.jsx(K,{size:"icon",variant:"ghost",onClick:()=>O(y),disabled:W==="revoking",title:a?"בטל גישה":"Revoke access",className:"h-8 w-8 text-red-500 hover:text-red-400",children:W==="revoking"?e.jsx(le,{className:"w-4 h-4 animate-spin"}):e.jsx(ha,{className:"w-4 h-4"})})]})]},y.id)})}),e.jsx(Ya,{open:m,onOpenChange:u,creatorId:t,orders:w,isRTL:a,isDark:s}),e.jsx(Za,{open:!!g,onOpenChange:y=>!y&&b(null),sample:g,creatorId:t,isRTL:a,isDark:s})]})}const Ze={released_cents:0,pending_release_cents:0,reserved_cents:0,available_cents:0};function Ra(t){const{user:r}=ge(),a=Be(),s=Ne({queryKey:["creator-balance",t],queryFn:async()=>{if(!t)return Ze;const{data:c,error:l}=await S.rpc("get_creator_available_balance",{p_creator_id:t});if(l)throw l;const i=Array.isArray(c)?c[0]:c;return i?{released_cents:Number(i.released_cents)||0,pending_release_cents:Number(i.pending_release_cents)||0,reserved_cents:Number(i.reserved_cents)||0,available_cents:Number(i.available_cents)||0}:Ze},enabled:!!t&&!!r,staleTime:3e4});return o.useEffect(()=>{if(!t)return;const c=S.channel(`creator-balance-payouts:${t}`).on("postgres_changes",{event:"*",schema:"public",table:"creator_payouts",filter:`creator_id=eq.${t}`},()=>{a.invalidateQueries({queryKey:["creator-balance",t]})}).subscribe(),l=S.channel(`creator-balance-orders:${t}`).on("postgres_changes",{event:"UPDATE",schema:"public",table:"orders",filter:`creator_id=eq.${t}`},()=>{a.invalidateQueries({queryKey:["creator-balance",t]})}).subscribe();return()=>{S.removeChannel(c),S.removeChannel(l)}},[t,a]),{balance:s.data||Ze,isLoading:s.isLoading,error:s.error,refetch:s.refetch}}function ar(t){const{user:r}=ge(),a=Be(),s=Ne({queryKey:["creator-payouts",t],queryFn:async()=>
16{if(!t)return[];const{data:l,error:i}=await S.from("creator_payouts").select("*").eq("creator_id",t).order("requested_at",{ascending:!1});if(i)throw i;return l||[]},enabled:!!t&&!!r});o.useEffect(()=>{if(!t)return;const l=S.channel(`creator-payouts:${t}`).on("postgres_changes",{event:"*",schema:"public",table:"creator_payouts",filter:`creator_id=eq.${t}`},()=>{a.invalidateQueries({queryKey:["creator-payouts",t]}),a.invalidateQueries({queryKey:["creator-balance",t]})}).subscribe();return()=>{S.removeChannel(l)}},[t,a]);const c=o.useCallback(async l=>{const{data:i,error:d}=await S.functions.invoke("marketplace-payout-request",{body:{amount_cents:l.amount_cents,notes_creator:l.notes_creator,...t?{creator_id:t}:{}}});if(d)throw d;if(!(i!=null&&i.success)){const p=new Error((i==null?void 0:i.error)||"Failed to request payout");throw p.code=i==null?void 0:i.error,p.availableCents=i==null?void 0:i.available_cents,p}return a.invalidateQueries({queryKey:["creator-payouts",t]}),a.invalidateQueries({queryKey:["creator-balance",t]}),i},[t,a]);return{payouts:s.data||[],isLoading:s.isLoading,error:s.error,requestPayout:c}}function sr(t){const{user:r}=ge(),a=Be(),s=Ne({queryKey:["creator-bank-details",t],queryFn:async()=>{if(!t)return null;const{data:l,error:i}=await S.from("creator_bank_details").select("*").eq("creator_id",t).maybeSingle();if(i)throw i;return l||null},enabled:!!t&&!!r}),c=o.useCallback(async l=>{const{data:i,error:d}=await S.functions.invoke("marketplace-bank-details-upsert",{body:{...l,...t?{creator_id:t}:{}}});if(d)throw d;if(!(i!=null&&i.success))throw new Error((i==null?void 0:i.error)||"Failed to save bank details");return a.invalidateQueries({queryKey:["creator-bank-details",t]}),i.bank_details},[t,a]);
16return{bankDetails:s.data||null,hasBankDetails:!!s.data,isLoading:s.isLoading,error:s.error,upsertBankDetails:c}}const At=["account_holder","company_name","tax_id","company_address","bank_name","swift_bic","iban"];function La({open:t,onOpenChange:r,creatorId:a,isRTL:s,isDark:c}){const{bankDetails:l,upsertBankDetails:i}=sr(a),d=s?"font-heebo":"",[p,m]=o.useState({account_holder:"",bank_name:"",swift_bic:"",iban:"",tax_id:"",company_name:"",company_address:"",notes:""}),[u,g]=o.useState(!1);o.useEffect(()=>{t&&l&&m({account_holder:l.account_holder,bank_name:l.bank_name,swift_bic:l.swift_bic,iban:l.iban,tax_id:l.tax_id,company_name:l.company_name,company_address:l.company_address,notes:l.notes||""})},[t,l]);const b={account_holder:{he:"שם בעל החשבון",en:"Account Holder Name"},company_name:{he:"שם החברה",en:"Company Name"},tax_id:{he:"ח.פ. / ת.ז.",en:"Tax ID / Company Number"},company_address:{he:"כתובת החברה",en:"Company Address"},bank_name:{he:"שם הבנק",en:"Bank Name",placeholder:"Bank Hapoalim"},swift_bic:{he:"SWIFT / BIC",en:"SWIFT / BIC",placeholder:"POALILIT"},iban:{he:"IBAN",en:"IBAN",placeholder:"IL27 0125 4500 0000 1234 567"},notes:{he:"הערות (אופציונלי)",en:"Notes (optional)"}};function _(w,$){m(j=>({...j,[w]:$}))}async function v(){for(const w of At)if(!String(p[w]||"").trim()){M.error(s?`שדה חובה: ${b[w].he}`:`Required: ${b[w].en}`);return}if(p.iban.replace(/\s/g,"").length<15){M.error(s?"IBAN קצר מדי":"IBAN too short");return}g(!0);try{await i(p),M.success(s?"פרטי הבנק נשמרו":"Bank details saved"),r(!1)}catch(w){M.error((w==null?void 0:w.message)||(s?"שמירה נכשלה":"Save failed"))}finally{g(!1)}}return e.jsx(ke,{open:t,onOpenChange:r,children:e.jsxs(Se,{className:n("max-w-lg",c&&"bg-[#0F1320] border border-white/10 text-white"),children:[e.jsxs(Ee,{children:[e.jsx(Fe,{className:d,children:s?"פרטי חשבון בנק":"Bank Account Details"}),e.jsx(Hr,{className:d,children:s?"פרטים אלו ישמשו אותנו להעברת התשלום ידנית. ניתן לעדכן בכל עת.":"These details will be used to wire payouts manually. Editable any time."})]}),e.jsxs("div",{className:"space-y-3 max-h-[60vh] overflow-y-auto pr-1",children:[At.map(w=>e.jsxs("div",{className:"space-y-1",children:[e.jsxs(G,{htmlFor:`bd-${w}`,className:n("text-sm",d),children:[s?b[w].he:b[w].en,e.jsx("span",{className:"text-red-500 ms-1",children:"*"})]}),e.jsx(ue,{id:`bd-${w}`,dir:w==="iban"||w==="swift_bic"||w==="tax_id"?"ltr":void 0,value:String(p[w]||""),onChange:$=>_(w,$.target.value),placeholder:b[w].placeholder,className:n(c&&"bg-black/20 border-white/10 text-white")})]},w)),e.jsxs("div",{className:"space-y-1",children:[e.jsx(G,{htmlFor:"bd-notes",className:n("text-sm",d),children:s?b.notes.he:b.notes.en}),e.jsx(me,{id:"bd-notes",value:p.notes||"",onChange:w=>_("notes",w.target.value),rows:2,className:n(c&&"bg-black/20 border-white/10 text-white")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(K,{variant:"ghost",onClick:()=>r(!1),disabled:u,className:d,children:s?"ביטול":"Cancel"}),e.jsxs(K,{onClick:v,disabled:u,className:d,children:[u&&e.jsx(le,{className:"w-4 h-4 me-2 animate-spin"}),s?"שמור":"Save"]})]})]})})}const es="#336CFF";function ts({creatorId:t,availableCents:r,hasBankDetails:a,onMissingBankDetails:s,isRTL:c,isDark:l}){const{requestPayout:i}=ar(t),d=c?"font-heebo":"",p=r/100,[m,u]=o.useState(p.toFixed(2)),[g,b]=o.useState(""),[_,v]=o.useState(!1),w=o.useMemo(()=>parseFloat(m),[m]),$=o.useMemo(()=>Number.isFinite(w)?Math.round(w*100):0,[w]),j=Number.isFinite(w)&&$>0&&$<=r;async function O(){if(!a){s();return}if(j){v(!0);try{await i({amount_cents:$,notes_creator:g.trim()||void 0}),M.success(c?"הבקשה התקבלה — נחזור אליך תוך 72 שעות":"Request received — we'll respond within 72h"),b("")}catch(E){const y=E==null?void 0:E.code;y==="bank_details_required"?s():y==="insufficient_balance"?M.error(c?"אין יתרה מספקת":"Insufficient balance"):M.error((E==null?void 0:E.message)||(c?"הבקשה נכשלה":"Request failed"))}finally{v(!1)}}}
16return r<=0?e.jsx("div",{className:n("rounded-xl p-6 text-center",l?"bg-black/20 text-white/60":"bg-gray-50 text-[#182137]/60",d),children:c?"אין כרגע יתרה זמינה למשיכה. הזמנות שהושלמו יופיעו כאן.":"No available balance to withdraw yet. Completed orders will appear here."}):e.jsxs("div",{className:"space-y-4",children:[!a&&e.jsxs("div",{className:n("rounded-xl p-3 text-sm flex items-center gap-2",l?"bg-amber-500/10 text-amber-200 border border-amber-500/30":"bg-amber-50 text-amber-900 border border-amber-200",d),children:[e.jsx(zt,{className:"w-4 h-4 shrink-0"}),e.jsx("span",{children:c?"כדי לבקש תשלום, מלא קודם את פרטי החשבון.":"To request a payout, please fill in your bank details first."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(G,{htmlFor:"po-amount",className:n("text-sm",d),children:c?"סכום (USD)":"Amount (USD)"}),e.jsx(ue,{id:"po-amount",type:"number",step:"0.01",min:"0.01",max:p,value:m,onChange:E=>u(E.target.value),dir:"ltr",className:n(l&&"bg-black/20 border-white/10 text-white")}),e.jsx("p",{className:n("text-xs",l?"text-white/50":"text-[#182137]/55",d),children:c?`מקסימום: $${p.toFixed(2)}`:`Maximum: $${p.toFixed(2)}`})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(G,{htmlFor:"po-note",className:n("text-sm",d),children:c?"הערה (אופציונלי)":"Note (optional)"}),e.jsx(me,{id:"po-note",value:g,onChange:E=>b(E.target.value),rows:2,className:n(l&&"bg-black/20 border-white/10 text-white")})]}),e.jsxs(K,{onClick:O,disabled:_||!j,className:n("w-full",d),style:{background:es},children:[_&&e.jsx(le,{className:"w-4 h-4 me-2 animate-spin"}),c?"שלח בקשה":"Submit request"]})]})}const rs={pending:{he:"ממתין",en:"Pending"},approved:{he:"אושר",en:"Approved"},paid:{he:"שולם",en:"Paid"},rejected:{he:"נדחה",en:"Rejected"}},as={pending:{light:"bg-amber-100 text-amber-800 border-amber-200",dark:"bg-amber-500/15 text-amber-200 border-amber-500/30"},approved:{light:"bg-blue-100 text-blue-800 border-blue-200",dark:"bg-blue-500/15 text-blue-200 border-blue-500/30"},paid:{light:"bg-emerald-100 text-emerald-800 border-emerald-200",dark:"bg-emerald-500/15 text-emerald-200 border-emerald-500/30"},rejected:{light:"bg-rose-100 text-rose-800 border-rose-200",dark:"bg-rose-500/15 text-rose-200 border-rose-500/30"}};function ss(t,r){return new Date(t).toLocaleDateString(r?"he-IL":"en-US",{year:"numeric",month:"short",day:"numeric"})}function ns({payouts:t,isLoading:r,isRTL:a,isDark:s}){const c=a?"font-heebo":"";return r?e.jsx("div",{className:n("rounded-xl p-6 text-center text-sm",s?"bg-black/20 text-white/50":"bg-gray-50 text-[#182137]/55",c),children:a?"טוען היסטוריה...":"Loading history..."}):t.length===0?e.jsx("div",{className:n("rounded-xl p-6 text-center text-sm",s?"bg-black/20 text-white/50":"bg-gray-50 text-[#182137]/55",c),children:a?"אין בקשות עדיין":"No payout requests yet"}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:n("border-b",s?"border-white/10 text-white/60":"border-gray-200 text-[#182137]/55"),children:[e.jsx("th",{className:n("text-start py-2 px-1 font-medium",c),children:a?"תאריך":"Date"}),e.jsx("th",{className:n("text-start py-2 px-1 font-medium",c),children:a?"סכום":"Amount"}),e.jsx("th",{className:n("text-start py-2 px-1 font-medium",c),children:a?"סטטוס":"Status"}),e.jsx("th",{className:n("text-start py-2 px-1 font-medium",c),children:a?"אסמכתא":"Reference"})]})}),e.jsx("tbody",{children:t.map(l=>{const i=as[l.status],d=rs[l.status];return e.jsxs("tr",{className:n("border-b last:border-b-0",s?"border-white/[0.06]":"border-gray-100"),children:[e.jsx("td",{className:n("py-2.5 px-1",s?"text-white/80":"text-[#182137]"),children:ss(l.requested_at,a)}),e.jsxs("td",{className:n("py-2.5 px-1 font-medium",s?"text-white":"text-[#182137]"),children:["$",(l.amount_cents/100).toFixed(2)]}),e.jsx("td",{className:"py-2.5 px-1",children:e.jsx("span",{className:n("inline-block rounded-full border px-2 py-0.5 text-xs font-medium",s?i.dark:i.light,c),title:l.status==="rejected"&&l.rejection_reason||void 0,children:a?d.he:d.en})}),e.jsx("td",{className:n("py-2.5 px-1 text-xs",s?"text-white/50":"text-[#182137]/50"),children:l.payment_reference||"—"})]},l.id)})})]})})}const ls="#336CFF";function is({creatorId:t,lifetimeEarningsCents:r,isRTL:a,isDark:s,darkSurfaceStyle:c}
16){const{balance:l,isLoading:i}=Ra(t),{payouts:d,isLoading:p}=ar(t),{hasBankDetails:m}=sr(t),[u,g]=o.useState("request"),[b,_]=o.useState(!1),v=a?"font-heebo":"";return e.jsxs("div",{className:n("rounded-2xl p-5",s?"border border-white/[0.08] shadow-[0_6px_28px_rgba(0,0,0,0.15)]":"bg-white border border-gray-100"),style:s?c:void 0,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:n("text-base font-semibold flex items-center gap-2",s?"text-white":"text-[#182137]",v),children:[e.jsx(zt,{className:"w-4 h-4",style:{color:ls}}),a?"תשלומים":"Payments"]}),e.jsxs(K,{variant:"ghost",size:"sm",onClick:()=>_(!0),className:n("text-xs",v,s&&"text-white/70 hover:text-white"),children:[e.jsx(Ke,{className:"w-3.5 h-3.5 me-1"}),a?"פרטי בנק":"Bank details"]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 mb-5",children:[e.jsx(Te,{label:a?"זמין למשיכה":"Available",value:l.available_cents,highlight:!0,loading:i,isRTL:a,isDark:s}),e.jsx(Te,{label:a?"ממתין לשחרור":"Pending release",value:l.pending_release_cents,loading:i,isRTL:a,isDark:s}),e.jsx(Te,{label:a?"סה״כ הרווחת":"Lifetime earnings",value:r,loading:!1,isRTL:a,isDark:s})]}),e.jsxs("div",{className:n("flex gap-1 mb-4 rounded-lg p-1 w-fit",s?"bg-black/30":"bg-gray-100"),children:[e.jsx(Mt,{active:u==="request",onClick:()=>g("request"),isDark:s,className:v,children:a?"בקשת תשלום":"Request payout"}),e.jsx(Mt,{active:u==="history",onClick:()=>g("history"),isDark:s,className:v,children:a?"היסטוריה":"History"})]}),u==="request"?e.jsx(ts,{creatorId:t,availableCents:l.available_cents,hasBankDetails:m,onMissingBankDetails:()=>_(!0),isRTL:a,isDark:s}):e.jsx(ns,{payouts:d,isLoading:p,isRTL:a,isDark:s}),e.jsx(La,{open:b,onOpenChange:_,creatorId:t,isRTL:a,isDark:s})]})}function Te({label:t,value:r,highlight:a,loading:s,isRTL:c,isDark:l}){const i=c?"font-heebo":"",d=r/100;return e.jsxs("div",{className:n("rounded-xl p-3",l?a?"bg-[#336CFF]/10 border border-[#336CFF]/30":"bg-black/20 border border-white/5":a?"bg-[#336CFF]/5 border border-[#336CFF]/20":"bg-gray-50 border border-gray-100"),children:[e.jsx("p",{className:n("text-[11px] uppercase tracking-wide mb-1",l?"text-white/50":"text-[#182137]/50",i),children:t}),e.jsx("p",{dir:"ltr",className:n("text-lg font-bold tabular-nums",a?"text-[#336CFF]":l?"text-white":"text-[#182137]"),children:s?"—":`$${d.toFixed(2)}`})]})}function Mt({active:t,onClick:r,children:a,isDark:s,className:c}){return e.jsx("button",{onClick:r,className:n("px-3 py-1.5 rounded-md text-xs font-medium transition-colors",t?s?"bg-white/10 text-white":"bg-white text-[#182137] shadow-sm":s?"text-white/50 hover:text-white/80":"text-[#182137]/55 hover:text-[#182137]",c),children:a})}var De="Tabs",[os]=Pr(De,[It]),nr=It(),[cs,pt]=os(De),lr=o.forwardRef((t,r)=>{const{__scopeTabs:a,value:s,onValueChange:c,defaultValue:l,orientation:i="horizontal",dir:d,activationMode:p="automatic",...m}=t,u=qr(d),[g,b]=$r({prop:s,onChange:c,defaultProp:l??"",caller:De});return e.jsx(cs,{scope:a,baseId:pe(),value:g,onValueChange:b,orientation:i,dir:u,activationMode:p,children:e.jsx(ie.div,{dir:u,"data-orientation":i,...m,ref:r})})});lr.displayName=De;var ir="TabsList",or=o.forwardRef((t,r)=>{const{__scopeTabs:a,loop:s=!0,...c}=t,l=pt(ir,a),i=nr(a);return e.jsx(Ar,{asChild:!0,...i,orientation:l.orientation,dir:l.dir,loop:s,children:e.jsx(ie.div,{role:"tablist","aria-orientation":l.orientation,...c,ref:r})})});or.displayName=ir;var cr="TabsTrigger",dr=o.forwardRef((t,r)=>{const{__scopeTabs:a,value:s,disabled:c=!1,...l}=t,i=pt(cr,a),d=nr(a),p=hr(i.baseId,s),m=pr(i.baseId,s),u=s===i.value;return e.jsx(Mr,{asChild:!0,...d,focusable:!c,active:u,children:e.jsx(ie.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":m,"data-state":u?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:p,...l,ref:r,onMouseDown:He(t.onMouseDown,g=>{!c&&g.button===0&&g.ctrlKey===!1?i.onValueChange(s):g.preventDefault()}),onKeyDown:He(t.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&i.onValueChange(s)}),onFocus:He(t.onFocus,()=>{const g=i.activationMode!=="manual";!u&&!c&&g&&i.onValueChange(s)})})})});dr.displayName=cr;var ur="TabsContent",mr=o.forwardRef((t,r)=>{const{__scopeTabs:a,value:s,forceMount:c,children:l,...i}=t,d=pt(ur,a),p=hr(d.baseId,s),m=pr(d.baseId,s),u=s===d.value,g=o.useRef(u);return o.useEffect(()=>{const b=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(b)},[]),e.jsx(Ur,{present:c||u,children:({present:b})=>e.jsx(ie.div,{"data-state":u?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":p,hidden:!b,id:m,tabIndex:0,...i,ref:r,
16style:{...t.style,animationDuration:g.current?"0s":void 0},children:b&&l})})});mr.displayName=ur;function hr(t,r){return`${t}-trigger-${r}`}function pr(t,r){return`${t}-content-${r}`}var ds=lr,xr=or,gr=dr,fr=mr;const us=ds,br=o.forwardRef(({className:t,...r},a)=>e.jsx(xr,{ref:a,className:n("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...r}));br.displayName=xr.displayName;const ct=o.forwardRef(({className:t,...r},a)=>e.jsx(gr,{ref:a,className:n("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",t),...r}));ct.displayName=gr.displayName;const dt=o.forwardRef(({className:t,...r},a)=>e.jsx(fr,{ref:a,className:n("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...r}));dt.displayName=fr.displayName;const ee="#336CFF",ms="#1e1f26",je={backgroundColor:ms,backgroundImage:"linear-gradient(180deg, rgba(255,255,255,0.035) 0%, rgba(255,255,255,0) 40%), linear-gradient(135deg, rgba(51,108,255,0.045) 0%, transparent 52%)"},Ut={inquiry:{labelHe:"ממתין לתגובה",labelEn:"Awaiting Response",color:"#F59E0B",icon:Nt},proposal_sent:{labelHe:"נשלחה הצעה",labelEn:"Proposal Sent",color:"#8B5CF6",icon:ra},pending_payment:{labelHe:"ממתין לתשלום",labelEn:"Pending Payment",color:"#F59E0B",icon:Nt},paid:{labelHe:"שולם",labelEn:"Paid",color:"#10B981",icon:Ue},in_progress:{labelHe:"בעבודה",labelEn:"In Progress",color:"#336CFF",icon:ma},delivered:{labelHe:"נמסר",labelEn:"Delivered",color:"#06B6D4",icon:Ie},completed:{labelHe:"הושלם",labelEn:"Completed",color:"#10B981",icon:Ue}};function ve({children:t,delay:r=0,className:a=""}){const s=o.useRef(null),c=da(s,{once:!0,margin:"-60px"});return e.jsx(ua.div,{ref:s,initial:{opacity:0,y:24},animate:c?{opacity:1,y:0}:{},transition:{duration:.5,delay:r,ease:"easeOut"},className:a,children:t})}function hs(){const{user:t}=ge(),{data:r,isLoading:a,refetch:s}=Ne({queryKey:["marketplace-all-managed-creators",t==null?void 0:t.id],queryFn:async()=>{if(!t)throw new Error("Not authenticated");const{data:c}=await S.from("creator_managers").select("creator_id").eq("manager_user_id",t.id),l=(c||[]).map(m=>m.creator_id),i=[`user_id.eq.${t.id}`,`managed_by_user_id.eq.${t.id}`];l.length>0&&i.push(`id.in.(${l.join(",")})`);const{data:d,error:p}=await S.from("creators").select("id, display_name, nickname, slug, is_verified, avatar_url, user_id, managed_by_user_id").or(i.join(",")).order("created_at");if(p)throw p;return d||[]},enabled:!!t});return{creators:r||[],isLoading:a,refetch:s}}function ps(t){const{user:r}=ge(),{data:a,isLoading:s,error:c,refetch:l}=Ne({queryKey:["marketplace-creator-profile",t],queryFn:async()=>{if(!r||!t)throw new Error("Not authenticated or no creator selected");const{data:i,error:d}=await S.from("creators").select("*, creator_services(*)").eq("id",t).maybeSingle();if(d)throw d;if(!i)return null;const{data:p}=await S.from("orders").select("status, price_cents, creator_payout_cents").eq("creator_id",i.id),m=p||[],u={total_orders:m.length,completed_orders:m.filter(j=>j.status==="completed").length,total_earned_tokens:Math.round(m.filter(j=>j.status==="completed").reduce((j,O)=>j+(O.creator_payout_cents||0),0)/100),average_rating:Number(i.avg_rating)||0,active_orders:m.filter(j=>["inquiry","proposal_sent","paid","in_progress","delivered"].includes(j.status)).length},g=(i.creator_services||[]).map(j=>({id:j.id,title:j.title,description:j.description||"",price_tokens:Math.round((j.price_cents||0)/100),delivery_days:j.delivery_days,category:j.category,is_active:j.is_active,cover_image_url:j.cover_image_url||null,example_urls:j.example_urls||[],requirements:j.requirements||null,deliverables:j.deliverables||null,max_revisions:j.max_revisions??1})),{data:b}=await S.from("orders").select(`
17          id,
18          order_number,
19          status,
20          price_cents,
21          client_id,
22          service:creator_services!orders_service_id_fkey(title),
23          order_messages(message, created_at, is_read, sender_id)
24        `).eq("creator_id",i.id).order("updated_at",{ascending:!1}).limit(6),_=(b||[]).map(j=>
24j.client_id).filter(Boolean),{data:v}=_.length>0?await S.from("profiles").select("id, full_name").in("id",_):{data:[]},w=new Map((v||[]).map(j=>[j.id,j.full_name])),$=(b||[]).map(j=>{var P;const O=j.order_messages||[],E=O.sort((k,I)=>new Date(I.created_at).getTime()-new Date(k.created_at).getTime())[0],y=O.filter(k=>!k.is_read&&k.sender_id!==r.id).length;return{order_id:j.id,order_number:j.order_number||"",client_name:w.get(j.client_id)||"לקוח",service_title:((P=j.service)==null?void 0:P.title)||"",status:j.status,last_message:(E==null?void 0:E.message)||"",last_message_at:(E==null?void 0:E.created_at)||"",unread_count:y,price_cents:j.price_cents||0}});return{creator:{id:i.id,display_name:i.display_name,nickname:i.nickname||null,slug:i.slug,verified:i.is_verified,avatar_url:i.avatar_url||null,cover_image_url:i.cover_image_url||null,portfolio_urls:i.portfolio_urls||[],bio:i.bio||null,total_earnings_cents:i.total_earnings_cents||0},stats:u,services:g,conversations:$}},enabled:!!r&&!!t});return{creator:(a==null?void 0:a.creator)||null,stats:(a==null?void 0:a.stats)||null,services:(a==null?void 0:a.services)||[],conversations:(a==null?void 0:a.conversations)||[],isLoading:s,refetch:l}}function Me({value:t,label:r,icon:a,isDark:s,isRTL:c,accent:l=!1}){return e.jsx("div",{className:n("rounded-2xl p-4 transition-all duration-300",l?"bg-gradient-to-br from-[#336CFF] to-[#5B8DEF] text-white":s?"border border-white/[0.09] shadow-[0_6px_24px_rgba(0,0,0,0.16)]":"bg-white border border-gray-100"),style:!l&&s?je:void 0,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:n("text-2xl font-bold tracking-tight",l||s?"text-white":"text-[#182137]"),children:t}),e.jsx("p",{className:n("text-xs mt-0.5 font-medium",l?"text-white/70":s?"text-white/40":"text-[#182137]/50",c&&"font-heebo"),children:r})]}),e.jsx("div",{className:n("w-10 h-10 rounded-xl flex items-center justify-center",l?"bg-white/20":"bg-[#336CFF]/10"),children:e.jsx(a,{className:n("w-5 h-5",l?"text-white":"text-[#336CFF]")})})]})})}function xs({conv:t,isRTL:r,isDark:a,onClick:s}){const c=Ut[t.status]||Ut.inquiry,l=c.icon,i=t.last_message_at?gs(t.last_message_at,r):"";return t.last_message.length>50?t.last_message.substring(0,50)+"":t.last_message,e.jsx("button",{onClick:s,className:n("w-full text-start p-4 rounded-xl transition-all duration-200 group",a?"hover:bg-white/[0.04] active:bg-white/[0.06]":"hover:bg-gray-50 active:bg-gray-100",t.unread_count>0&&(a?"bg-[#336CFF]/[0.07]":"bg-blue-50/50")),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:n("w-10 h-10 rounded-full flex items-center justify-center shrink-0",a?"bg-white/[0.08]":"bg-gray-100"),children:e.jsx(tt,{className:n("w-5 h-5",a?"text-white/45":"text-gray-400")})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[e.jsx("span",{className:n("font-semibold text-sm truncate",a?"text-white":"text-[#182137]",r&&"font-heebo"),children:t.client_name}),e.jsx("span",{className:n("text-[11px] shrink-0",a?"text-white/30":"text-[#182137]/40"),children:i})]}),e.jsx("p",{className:n("text-xs truncate mb-2",a?"text-white/50":"text-[#182137]/60",r&&"font-heebo"),children:t.service_title}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(l,{className:"w-3 h-3",style:{color:c.color}}),e.jsx("span",{className:"text-[11px] font-medium",style:{color:c.color},children:r?c.labelHe:c.labelEn})]}),t.unread_count>0&&e.jsx("div",{className:"w-5 h-5 rounded-full bg-[#336CFF] flex items-center justify-center",children:e.jsx("span",{className:"text-[10px] font-bold text-white",children:t.unread_count})})]})]}),e.jsx(Wt,{className:n("w-4 h-4 shrink-0 transition-transform group-hover:translate-x-0.5",a?"text-white/20":"text-gray-300",r&&"rotate-180 group-hover:-translate-x-0.5")})]})})}function gs(t,r){const a=new Date(t),c=new Date().getTime()-a.getTime(),l=Math.floor(c/6e4),i=Math.floor(l/60),d=Math.floor(i/24);return l<1?r?"עכשיו":"now":l<60?r?`לפני ${l} דק'`:`${l}m`:i<24?r?`לפני ${i} שע'`:`${i}h`:d<7?r?`לפני ${d} ימים`:`${d}d`:a.toLocaleDateString(r?"he-IL":"en-US",{month:"short",day:"numeric"})}function fs({service:t,isRTL:r,isDark:a,onEdit:s,onToggle:c}){return e.jsxs("div",{className:n("flex items-center gap-3 p-3 rounded-xl transition-all duration-200",a?"hover:bg-white/[0.03]":"hover:bg-gray-50"),children:[t.example_urls[0]?vr(t.example_urls[0])?e.jsxs("div",{className:"relative w-12 h-12 rounded-lg overflow-hidden shrink-0 bg-black",children:[e.jsx("video",{src:t.example_urls[0],className:"w-full h-full object-cover",muted:!0,playsInl
24ine:!0,preload:"metadata"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20",children:e.jsx(at,{className:"w-4 h-4 text-white",fill:"white"})})]}):e.jsx("img",{src:t.example_urls[0],alt:t.title,className:"w-12 h-12 rounded-lg object-cover shrink-0"}):e.jsx("div",{className:"w-12 h-12 rounded-lg flex items-center justify-center shrink-0",style:{background:`${ee}12`},children:e.jsx(Ie,{className:"w-5 h-5",style:{color:`${ee}66`}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:n("font-medium text-sm truncate",a?"text-white":"text-[#182137]",r&&"font-heebo"),children:t.title}),!t.is_active&&e.jsx(Ot,{variant:"outline",className:n("text-[9px] rounded-full px-1.5 py-0",a?"text-white/30 border-white/[0.08]":"text-gray-400 border-gray-200"),children:r?"מושבת":"Off"})]}),e.jsxs("p",{className:n("text-xs mt-0.5",a?"text-white/40":"text-[#182137]/50"),children:[r?`₪${t.price_tokens.toLocaleString()}`:`$${Math.round(t.price_tokens/3.65).toLocaleString()}`," · ",t.delivery_days," ",r?"ימים":"days"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("div",{dir:"ltr",children:e.jsx(ta,{checked:t.is_active,onCheckedChange:c,className:n("data-[state=checked]:bg-[#336CFF]",a?"data-[state=unchecked]:bg-white/[0.12]":"data-[state=unchecked]:bg-gray-300")})}),e.jsx(K,{variant:"ghost",size:"icon",onClick:s,className:n("w-8 h-8 rounded-lg",a?"hover:bg-white/[0.06]":"hover:bg-gray-100"),children:e.jsx(Ke,{className:n("w-3.5 h-3.5",a?"text-white/40":"text-[#182137]/40")})})]})]})}const bs=[".mp4",".webm",".mov",".avi",".m4v",".3gp",".mkv"];function vr(t){const a=t.toLowerCase().split("?")[0];return bs.some(s=>a.endsWith(s))}function vs({isRTL:t,isDark:r,existingService:a,creatorId:s,onClose:c,onSave:l}){var xt,gt,ft,bt;const[i,d]=o.useState((a==null?void 0:a.title)||""),[p,m]=o.useState((a==null?void 0:a.description)||""),[u,g]=o.useState((a==null?void 0:a.requirements)||""),[b,_]=o.useState((a==null?void 0:a.deliverables)||""),[v,w]=o.useState(((xt=a==null?void 0:a.price_tokens)==null?void 0:xt.toString())||""),[$,j]=o.useState(((gt=a==null?void 0:a.delivery_days)==null?void 0:gt.toString())||""),[O,E]=o.useState(((ft=a==null?void 0:a.max_revisions)==null?void 0:ft.toString())||"1"),y=Ct((a==null?void 0:a.category)||"styling"),[P,k]=o.useState(()=>{const x=Array.from(new Set(y));return x.length?x:["styling"]}),[I,W]=o.useState(!1),[R,re]=o.useState(!1),[J,ae]=o.useState(null),Z=o.useRef(!1),T=o.useRef({title:"",description:"",requirements:"",deliverables:""});T.current={title:i,description:p,requirements:u,deliverables:b};const[D,oe]=o.useState([]),[L,Q]=o.useState([]),[V,U]=o.useState((a==null?void 0:a.example_urls)||[]),[se,h]=o.useState(!1),C=o.useRef(0),A=o.useRef(null),N=!!a;o.useEffect(()=>{ae(null),Z.current=!1},[a]);const f=o.useCallback((x,B)=>{const q=T.current;if(!(B!=null&&B.force)&&Z.current&&(q.title.trim()!==""||q.description.trim()!==""||q.requirements.trim()!==""||q.deliverables.trim()!=="")&&!(typeof window<"u"&&window.confirm(t?"בחירת תבנית תחליף את הטקסטים שכבר הזנת. להמשיך?":"Choosing a template will replace text you already entered. Continue?")))return;d(x.title),m(x.description),g(x.requirements),_(x.deliverables);const H=Ct(x.categories);k(H.length?H:["styling"]),w(String(Qe.priceTokens)),j(String(Qe.deliveryDays)),E(String(Qe.maxRevisions)),ae(x.id),Z.current=!1,re(!1)},[t]);o.useEffect(()=>()=>{L.forEach(x=>URL.revokeObjectURL(x))},[]),o.useEffect(()=>{const x=()=>{C.current=0,h(!1)};return window.addEventListener("dragend",x),()=>window.removeEventListener("dragend",x)},[]);const F=o.useCallback(x=>{const B=Array.from(x||[]),q=B.filter(Y=>Y.type.startsWith("image/")||Y.type.startsWith("video/"));if(q.length<B.length&&M.error(t?"רק תמונות או סרטונים":"Only images or videos are allowed"),!q.length)return;const de=3-(V.length+D.length);if(de<=0){M.error(t?"יש להעלות בדיוק 3 דוגמאות לשירות":"Exactly 3 examples per service");return}const ne=q.slice(0,de);oe(Y=>[...Y,...ne]),Q(Y=>[...Y,...ne.map(fe=>URL.createObjectURL(fe))])},[V.length,D.length,t]),X=x=>{F(x.target.files),x.target.value=""},z=x=>{x.preventDefault(),x.stopPropagation(),!(V.length+D.length>=3)&&(C.current+=1,h(!0))},ce=x=>{x.preventDefault(),x.stopPropagation(),C.current-=1,C.current<=0&&(C.current=0,h(!1))},$e=x=>{x.preventDefault(),x.stopPropagation(),!(V.length+D.length>=3)&&(x.dataTransfer.dropEffect="copy")},We=x=>{x.preventDefault(),x.stopPropagation(),C.current=0,h(!1),F(x.dataTransfer.files)},Ve=x=>{URL.revokeObjectURL(L[x]),oe(B=>B.filter((q,H)=>H!==x)),Q(B=>B.filter((q,H)=>H!==x))},wr=x=>{U(B=>B.filter((q,H)=>H!==x))},yr=async x=>{var H;if(x.preventDefault(),!i.trim()||!v||!$){M.error(t?"נא למלא את כל השדות הנדרשים":"Please fill in all required fields");return}if(i.trim().split(/\s+/).length>8){M.error(t?"שם השירות מוגבל ל-8 מילים":"Service title is limited to 8 words");return}const q=V.length+D.length;if(q!==3){M.error(t?`חובה להעלות בדיוק 3 דוגמאות (יש ${q})`:`Exactly 3 examples are required (you have ${q})`);return}W(!0);try{const de={title:i.trim(),description:p.trim(),requirements:u.trim()||null,deliverables:b.trim()||null,price_cents:Math.round(Number(v)*100),delivery_days:Number($),max_revisions:Math.max(0,Math.min(5,Number(O)||1)),category:P.length?P.join(","):"styling"};let ne=null;if(N&&a){const{error:Y}=await S.from("creator_services").update(de).eq("id",a.id);if(Y)throw Y;ne=a.id}else{const{data:Y,error:fe}=await S.from("creator_services").insert({...de,creator_id:s}).select("id").single();if(fe)throw fe;ne=Y==null?void 0:Y.id}if(ne&&D.length>0){const Y=[];for(const be of D){const jr=be.name.split(".").pop()||"jpg",ze=`${s}/services/${ne}/${Date.now()}-${Math.random().toString(36).slice(2,8)}.${jr}`,{error:vt}=await S.storage.from("creator-portfolios").upload(ze,be,{upsert:!0});if(vt){console.warn("Upload failed for file:",be.name,vt);continue}const{data:Nr}=S.storage.from("creator-portfolios").getPublicUrl(ze);if(Y.push(Nr.publicUrl),be.type.startsWith("video/"))try{const Pe=await ga(be);if(Pe){const wt=`${ze}.poster.jpg`,{error:_r}=await S.storage.from("creator-portfolios").upload(wt,Pe,{upsert:!0,contentType:"image/jpeg"});if(!_r){const{data:Cr}=S.storage.from("creator-portfolios").getPublicUrl(wt);Y.push(Cr.publicUrl)}}}catch(Pe){console.warn("Poster capture failed for",be.name,Pe)}}const fe=[...V,...Y];await S.from("creator_services").update({example_urls:fe}).eq("id",ne)}else ne&&V.length!==(((H=a==null?void 0:a.example_urls)==null?void 0:H.length)||0)&&await S.from("creator_services").update({example_urls:V}).eq("id",ne);ne&&S.functions.invoke("marketplace-translate",{body:{service_id:ne}}
24).catch(()=>{}),M.success(t?"השירות נשמר בהצלחה":"Service saved successfully"),l(),c()}catch(de){M.error(de.message||(t?"שגיאה בשמירה":"Failed to save service"))}finally{W(!1)}};return e.jsxs("form",{onSubmit:yr,className:"space-y-4",children:[!N&&e.jsxs("div",{children:[e.jsx(G,{className:n("text-sm font-medium",r?"text-white/50":"text-[#182137]/60",t&&"font-heebo"),children:t?"תבנית מוכנה (אופציונלי)":"Ready-made template (optional)"}),e.jsx("p",{className:n("text-[11px] mt-0.5 mb-1.5",r?"text-white/35":"text-[#182137]/45",t&&"font-heebo"),children:t?"בחר תבנית כדי למלא אוטומטית כותרת, תיאור וקטגוריות — תעלה רק 3 דוגמאות מדיה.":"Pick a template to auto-fill title, description, and categories — you only add 3 media examples."}),e.jsxs(Le,{open:R,onOpenChange:re,children:[e.jsx(et,{asChild:!0,children:e.jsxs(K,{type:"button",variant:"outline",role:"combobox","aria-expanded":R,className:n("w-full mt-1.5 justify-between rounded-xl h-11 font-normal",r?"bg-white/[0.04] border-white/[0.08] text-white/90 hover:bg-white/[0.06]":"bg-gray-50 border-gray-200",t&&"font-heebo"),children:[e.jsx("span",{className:"truncate text-start",children:J?(bt=st.find(x=>x.id===J))==null?void 0:bt.title:t?"ללא תבנית — מילוי ידני":"No template — manual entry"}),e.jsx(pa,{className:"ms-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(rt,{className:n("w-[min(100vw-2rem,420px)] max-h-[min(70vh,560px)] flex flex-col overflow-hidden p-0 z-[200]",r&&"bg-[#1e1f26] border-white/10 text-white"),align:"start",sideOffset:6,collisionPadding:12,onWheel:x=>x.stopPropagation(),children:e.jsxs(Lt,{className:n("h-auto max-h-full min-h-0 flex flex-col overflow-hidden rounded-md",r&&"bg-[#1e1f26]"),dir:t?"rtl":"ltr",children:[e.jsx(er,{placeholder:t?"חיפוש לפי כותרת...":"Search by title...",className:n(r&&"text-white placeholder:text-white/40")}),e.jsxs(tr,{className:"min-h-0 max-h-[min(58vh,440px)] flex-1 overflow-y-auto overscroll-contain scroll-py-1 [scrollbar-gutter:stable]",onWheel:x=>x.stopPropagation(),children:[e.jsx(rr,{className:r?"text-white/50 py-6":"",children:t?"לא נמצאו תוצאות":"No matches."}),e.jsx(it,{heading:t?"התחלה":"Start",children:e.jsx(ot,{value:"__manual ללא תבנית",onSelect:()=>{ae(null),re(!1)},className:n(t&&"font-heebo"),children:t?"ללא תבנית — אמלא בעצמי":"No template — I'll fill manually"})}),fa.map(x=>{const B=st.filter(q=>q.segment===x);return B.length?e.jsx(it,{heading:Et[x],className:n(r&&"[&_[cmdk-group-heading]]:text-white/50"),children:B.map(q=>e.jsx(ot,{value:`${q.id} ${q.title} ${Et[q.segment]}`,onSelect:()=>f(q),className:n(t&&"font-heebo text-right"),children:e.jsx("span",{className:"line-clamp-2",children:q.title})},q.id))},x):null})]})]})})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(G,{className:n("text-sm font-medium",r?"text-white/50":"text-[#182137]/60",t&&"font-heebo"),children:t?"שם השירות * (עד 8 מילים)":"Service Title * (max 8 words)"}),e.jsx("span",{className:n("text-[11px] font-semibold tabular-nums",(()=>{const x=i.trim()?i.trim().split(/\s+/).length:0;return x>8?"text-red-500":x===8?r?"text-amber-400":"text-amber-600":r?"text-white/35":"text-[#182137]/40"})(),t&&"font-heebo"),children:(()=>{const x=i.trim()?i.trim().split(/\s+/).length:0;return t?`${x}/8 מילים`:`${x}/8 words`})()})]}),e.jsx(ue,{value:i,onChange:x=>{Z.current=!0;const B=x.target.value,q=B.trim()?B.trim().split(/\s+/):[];if(q.length>8){const H=(/\s$/.test(B),"");d(q.slice(0,8).join(" ")+H);return}d(B)},placeholder:t?"למשל: הדמיית סלון ב-AI":"e.g. AI Living Room Render",className:n("mt-1.5 rounded-xl h-11",r?"bg-white/[0.04] border-white/[0.08] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200",t&&"font-heebo"),required:!0})]}),e.jsxs("div",{children:[e.jsx(G,{className:n("text-sm font-medium",r?"text-white/50":"text-[#182137]/60",t&&"font-heebo"),children:t?"תיאור":"Description"}),e.jsx(me,{value:p,onChange:x=>{Z.current=!0,m(x.target.value)},placeholder:t?"תאר את השירות שלך":"Describe your service",className:n("mt-1.5 resize-none rounded-xl",r?"bg-white/[0.04] border-white/[0.08] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200",t&&"font-heebo"),rows:3})]}),e.jsxs("div",{children:[e.jsx(G,{className:n("text-sm font-medium",r?"text-white/50":"text-[#182137]/60",t&&"font-heebo"),children:t?"מה הלקוח שולח לך":"What the client sends"}),e.jsx(me,{value:u,onChange:x=>{Z.current=!0,g(x.target.value)},placeholder:t?"למשל: תוכנית אדריכלית ב-PDF, תמונות רפרנס, פירוט סגנון":"e.g. architectural plan (PDF), reference photos, style notes",className:n("mt-1.5 resize-none rounded-xl",r?"bg-white/[0.04] border-white/[0.08] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200",t&&"font-heebo"),rows:2})]}),e.jsxs("div",{children:[e.jsx(G,{className:n("text-sm font-medium",r?"text-white/50":"text-[#182137]/60",t&&"font-heebo"),children:t?"מה הלקוח מקבל":"What the client receives"}),e.jsx(me,{value:b,onChange:x=>{Z.current=!0,_(x.target.value)},placeholder:t?"למשל: 3 הדמיות PNG ברזולוציה 4K + קובץ מקור":"e.g. 3 PNG renders in 4K + source file",className:n("mt-1.5 resize-none rounded-xl",r?"bg-white/[0.04] border-white/[0.08] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200",t&&"font-heebo"),rows:2})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx(G,{className:n("text-sm font-medium",r?"text-white/50":"text-[#182137]/60",t&&"font-heebo"),children:t?"מחיר (₪) *":"Price (₪) *"}
24),e.jsx(ue,{type:"number",min:"1",value:v,onChange:x=>w(x.target.value),placeholder:"50",className:n("mt-1.5 rounded-xl h-11",r?"bg-white/[0.04] border-white/[0.08] text-white":"bg-gray-50 border-gray-200"),required:!0})]}),e.jsxs("div",{children:[e.jsx(G,{className:n("text-sm font-medium",r?"text-white/50":"text-[#182137]/60",t&&"font-heebo"),children:t?"ימי אספקה *":"Delivery Days *"}),e.jsx(ue,{type:"number",min:"1",value:$,onChange:x=>j(x.target.value),placeholder:"7",className:n("mt-1.5 rounded-xl h-11",r?"bg-white/[0.04] border-white/[0.08] text-white":"bg-gray-50 border-gray-200"),required:!0})]}),e.jsxs("div",{children:[e.jsx(G,{className:n("text-sm font-medium",r?"text-white/50":"text-[#182137]/60",t&&"font-heebo"),children:t?"סבבי תיקונים":"Revisions"}),e.jsx(ue,{type:"number",min:"0",max:"5",value:O,onChange:x=>E(x.target.value),placeholder:"1",className:n("mt-1.5 rounded-xl h-11",r?"bg-white/[0.04] border-white/[0.08] text-white":"bg-gray-50 border-gray-200")})]})]}),e.jsxs("div",{children:[e.jsx(G,{className:n("text-sm font-medium",r?"text-white/50":"text-[#182137]/60",t&&"font-heebo"),children:t?"קטגוריות":"Categories"}),e.jsxs(Le,{children:[e.jsx(et,{asChild:!0,children:e.jsx(K,{variant:"outline",className:n("w-full mt-1.5 justify-start rounded-xl h-11 font-normal",r?"bg-white/[0.04] border-white/[0.08] text-white/70 hover:bg-white/[0.06]":"bg-gray-50 border-gray-200 hover:bg-gray-100"),children:P.map(x=>kt(x,t)).join(", ")||(t?"בחר קטגוריות":"Select categories")})}),e.jsx(rt,{className:n("w-56 p-2",r?"bg-[#1e1f26] border-white/10":"bg-white border-[#182137]/10"),children:sa.map(x=>e.jsxs("label",{className:n("flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors",r?"text-white/80 hover:bg-white/[0.08] hover:text-white":"text-[#182137]/80 hover:bg-[#182137]/[0.05] hover:text-[#182137]"),children:[e.jsx(aa,{checked:P.includes(x),onCheckedChange:B=>{if(B)k(Array.from(new Set([...P,x])));else{const q=P.filter(H=>H!==x);k(q.length?q:["styling"])}}}),e.jsx("span",{className:n("text-sm",t&&"font-heebo"),children:kt(x,t)})]},x))})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(G,{className:n("text-sm font-medium",r?"text-white/50":"text-[#182137]/60",t&&"font-heebo"),children:t?"דוגמאות עבודה * (3 חובה — תמונות או סרטונים)":"Example Work * (3 required — images or videos)"}),e.jsx("span",{className:n("text-[11px] font-semibold tabular-nums",V.length+D.length===3?"text-green-600":"text-red-500",t&&"font-heebo"),children:(()=>{const x=V.length+D.length;return t?`${x}/3`:`${x}/3`})()})]}),(()=>{const B=V.length+D.length<3;return e.jsxs("div",{className:n("rounded-xl mt-1.5 p-1 -m-1 transition-[box-shadow,background-color,border-color] border",B&&se?r?"border-[#336CFF]/55 bg-[#336CFF]/12 shadow-[inset_0_0_0_1px_rgba(51,108,255,0.25)]":"border-[#336CFF]/45 bg-[#336CFF]/[0.07]":"border-transparent"),onDragEnter:z,onDragLeave:ce,onDragOver:$e,onDrop:We,children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[V.map((q,H)=>e.jsxs("div",{className:"relative aspect-square rounded-xl overflow-hidden group",children:[vr(q)?e.jsxs("div",{className:"w-full h-full bg-black/10 flex items-center justify-center",children:[e.jsx("video",{src:q,className:"w-full h-full object-cover",muted:!0,preload:"metadata"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx(at,{className:"w-6 h-6 text-white drop-shadow"})})]}):e.jsx("img",{src:q,alt:"",className:"w-full h-full object-cover"}),e.jsx("button",{type:"button",onClick:()=>wr(H),className:"absolute top-1.5 end-1.5 w-6 h-6 rounded-full bg-black/60 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(_t,{className:"w-3.5 h-3.5 text-white"})})]},`existing-${H}`)),L.map((q,H)=>{var de;return e.jsxs("div",{className:"relative aspect-square rounded-xl overflow-hidden group",children:[(de=D[H])!=null&&de.type.startsWith("video/")?e.jsxs("div",{className:"w-full h-full bg-black/10 flex items-center justify-center",children:[e.jsx("video",{src:q,className:"w-full h-full object-cover",muted:!0,preload:"metadata"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx(at,{className:"w-6 h-6 text-white drop-shadow"})})]}):e.jsx("img",{src:q,alt:"",className:"w-full h-full object-cover"}),e.jsx("button",{type:"button",onClick:()=>Ve(H),className:"absolute top-1.5 end-1.5 w-6 h-6 rounded-full bg-black/60 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(_t,{className:"w-3.5 h-3.5 text-white"})})]},`new-${H}`)}),V.length+D.length<3&&e.jsx("button",{type:"button",onClick:()=>{var q;return(q=A.current)==null?void 0:q.click()},className:n("aspect-square rounded-xl border-2 border-dashed flex items-center justify-center cursor-pointer transition-colors",r?"border-white/10 hover:border-white/30 bg-white/[0.02]":"border-gray-200 hover:border-[#336CFF]/50 bg-gray-50"),children:e.jsx(Ht,{className:n("w-5 h-5",r?"text-white/20":"text-[#182137]/30")})})]}),B&&e.jsx("p",{className:n("text-[11px] mt-2 text-center",r?"text-white/40":"text-[#182137]/45",t&&"font-heebo"),children:t?"גרור תמונות או סרטונים לריבועים, או לחץ על + להעלאה":"Drag images or videos onto the slots, or tap + to upload"})]})})(),e.jsx("input",{ref:A,type:"file",accept:"image/*,video/*",multiple:!0,className:"hidden",onChange:X})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx(K,{type:"button",variant:"outline",onClick:c,className:n("flex-1 rounded-xl h-11",r?"border-white/[0.08] text-white/70 hover:bg-white/[0.04]":"border-gray-200"),children:t?"ביטול":"Cancel"}),e.jsx(K,{type:"submit",disabled:I,className:"flex-1 rounded-xl h-11 text-white",style:{background:ee},children:I?e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-4 h-4 animate-spin me-1.5"}),t?"שומר...":"Saving..."]}):t?"שמור":"Save"})]})]})}function ws(){const{theme:t}=Dt(),r=t==="dark"||t==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches,a=r?"bg-white/[0.06]":"bg-gray-200/60";return e.jsx("div",{className:n("min-h-screen pt-24",r&&"bg-[#141416] creators-bronze-grid"),style:{backgroundColor:r?void 0:"#F7F4EF"},children:e.jsx("div",{className:"max-w-6xl mx-auto px-4 sm:px-6",children:e.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[e.jsx(Ge,{className:n("h-24 rounded-2xl",a)}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:[1,2,3,4].map(s=>e.jsx(Ge,{className:n("h-20 rounded-2xl",a)},s))})]}),e.jsx("div",{children:e.jsx(Ge,{className:n("h-96 rounded-2xl",a)})})]})})})}function ys({creators:t,selectedId:r,onSelect:a,isRTL:s,isDark:c}){const[l,i]=o.useState(!1),d=t.find(p=>p.id===r);return t.length<=1?null:e.jsxs(Le,{open:l,onOpenChange:i,children:[e.jsx(et,{asChild:!0,children:e.jsxs(K,{variant:"outline",className:n("roun
24ded-xl h-10 px-4 gap-2 font-medium text-sm",c?"bg-white/[0.04] border-white/[0.08] text-white hover:bg-white/[0.06]":"bg-white border-gray-200 text-[#182137] hover:bg-gray-50",s&&"font-heebo"),children:[d!=null&&d.avatar_url?e.jsx("img",{src:d.avatar_url,alt:"",className:"w-5 h-5 rounded-full object-cover"}):e.jsx(tt,{className:"w-4 h-4 opacity-40"}),(d==null?void 0:d.nickname)||(d==null?void 0:d.display_name),e.jsx(Wt,{className:n("w-3.5 h-3.5 opacity-40 transition-transform",l&&"rotate-90")})]})}),e.jsxs(rt,{className:n("w-64 p-1.5",c&&"bg-[#1e1f26] border-white/10"),align:s?"end":"start",children:[e.jsxs("p",{className:n("text-[10px] uppercase tracking-wider font-semibold px-3 py-2",c?"text-white/30":"text-[#182137]/40"),children:[s?"החלף קריאייטור":"Switch Creator"," (",t.length,")"]}),t.map(p=>e.jsxs("button",{onClick:()=>{a(p.id),i(!1)},className:n("w-full flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors text-start",p.id===r?c?"bg-[#336CFF]/20 text-white":"bg-[#336CFF]/10 text-[#336CFF]":c?"hover:bg-white/[0.04] text-white/70":"hover:bg-gray-50 text-[#182137]/70"),children:[p.avatar_url?e.jsx("img",{src:p.avatar_url,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}):e.jsx("div",{className:n("w-8 h-8 rounded-full flex items-center justify-center shrink-0",c?"bg-white/[0.06]":"bg-gray-100"),children:e.jsx(tt,{className:"w-4 h-4 opacity-40"})}),e.jsx("span",{className:n("text-sm font-medium truncate",s&&"font-heebo"),children:p.nickname||p.display_name}),p.id===r&&e.jsx(Ue,{className:"w-4 h-4 ms-auto shrink-0 text-[#336CFF]"})]},p.id))]})]})}function Hs(){const{t}=Gr("creators"),{isRTL:r}=Qr(),{theme:a}=Dt(),s=a==="dark"||a==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches,c=Xr(),{user:l}=ge(),{creators:i,isLoading:d}=hs(),[p,m]=o.useState(null);o.useEffect(()=>{if(i.length>0&&!p){const f=i.find(F=>F.user_id===(l==null?void 0:l.id));m((f==null?void 0:f.id)||i[0].id)}},[i,p,l==null?void 0:l.id]);const{creator:u,stats:g,services:b,conversations:_,isLoading:v,refetch:w}=ps(p),$=d||v,[j,O]=o.useState(!1),[E,y]=o.useState(null),[P,k]=o.useState(0),[I,W]=o.useState(!1),[R,re]=o.useState(""),[J,ae]=o.useState(""),[Z,T]=o.useState(null),[D,oe]=o.useState(!1),[L,Q]=o.useState(!1),V=o.useRef(null);if(o.useEffect(()=>{!d&&i.length===0&&c("/creators/register",{replace:!0})},[d,i.length,c]),$)return e.jsx(ws,{});if(!u)return null;const U=()=>{y(null),k(f=>f+1),O(!0)},se=f=>{y(f),O(!0)},h=async f=>{try{const{error:F}=await S.from("creator_services").update({is_active:!f.is_active}).eq("id",f.id);if(F)throw F;M.success(f.is_active?r?"השירות הושבת":"Service deactivated":r?"השירות הופעל":"Service activated"),w()}catch{M.error(r?"שגיאה בעדכון":"Failed to update")}},C=()=>{ae(u.nickname||u.display_name||""),re(u.bio||""),T(u.cover_image_url||null),W(!0)},A=async f=>{if(!(!f||!u)){oe(!0);try{const F=f.name.split(".").pop()||"jpg",X=`${u.id}/cover/${Date.now()}-${Math.random().toString(36).slice(2,8)}.${F}`,{error:z}=await S.storage.from("creator-portfolios").upload(X,f,{upsert:!0});if(z)throw z;const{data:ce}=S.storage.from("creator-portfolios").getPublicUrl(X);T(ce.publicUrl),M.success(r?"התמונה הועלתה — לחץ שמור כדי להחיל":"Image uploaded — click Save to apply")}catch{M.error(r?"שגיאה בהעלאה":"Upload failed")}finally{oe(!1)}}},N=async()=>{if(u){Q(!0);try{const{error:f}=await S.from("creators").update({nickname:J.trim()||null,bio:R.trim()||null,cover_image_url:Z||null}).eq("id",u.id);if(f)throw f;M.success(r?"הפרופיל עודכן":"Profile updated"),W(!1),w()}catch{M.error(r?"שגיאה בעדכון":"Failed to update")}finally{Q(!1)}}};return e.jsxs(e.Fragment,{children:[e.jsx(Jr,{title:r?"דשבורד קריאייטור | Boardspace.ai":"Creator Dashboard | Boardspace.ai",description:"Manage your creator profile, services, and orders",noindex:!0}),e.jsxs("div",{dir:r?"rtl":"ltr",className:n("min-h-screen overflow-x-hidden relative",s&&"bg-[#141416] creators-bronze-grid"),style:{backgroundColor:s?void 0:"#F7F4EF"},children:[e.jsx("nav",{className:n("fixed top-0 inset-x-0 z-50",s?"border-b border-white/[0.08] bg-[#141416]/95 backdrop-blur-md":"border-b border-[#182137]/10 bg-[#F7F4EF]/95 backdrop-blur-md"),children:e.jsx("div",{className:n("px-4 sm:px-6","pb-3 sm:pb-3.5","pt-[max(0.75rem,env(safe-area-inset-top,0px))]"),children:e.jsxs("div",{className:"mx-auto flex max-w-6xl min-h-0 items-center justify-between gap-2 sm:gap-4",children:[e.jsx("a",{href:"https://boardspace.ai",className:"flex min-w-0 max-w-[min(58vw,14rem)] shrink items-center sm:max-w-[min(50vw,18rem)]","aria-label":"Boardspace.ai",children:e.jsx("img",{src:s?Yr:Zr,alt:"",className:"h-auto w-full min-h-0 max-h-[36px] object-contain object-left rtl:object-right sm:max-h-[44px] md:max-h-[52px]"})}),e.jsxs("div",{className:"flex min-w-0 shrink-0 items-center gap-1 sm:gap-3",children:[e.jsxs(yt,{to:`/creators/${u.slug}`,className:n("flex min-w-0 max-w-[42vw] items-center gap-1 rounded-lg px-2 py-2 text-xs font-medium transition-colors sm:max-w-none sm:gap-1.5 sm:px-3 sm:text-sm",s?"text-white/50 hover:bg-white/[0.04] hover:text-white":"text-[#182137]/60 hover:bg-gray-100 hover:text-[#182137]",r&&"font-heebo"),children:[e.jsx("span",{className:"truncate",children:r?"הפרופיל שלי":"My Profile"}),e.jsx(oa,{className:"h-3.5 w-3.5 shrink-0"})]}),e.jsx(Tr,{className:"shrink-0"})]})]})})}),e.jsxs("div",{className:n("relative z-10 mx-auto max-w-6xl px-4 sm:px-6 pb-12","pt-[calc(4.75rem+env(safe-area-inset-top,0px))] sm:pt-[calc(5rem+env(safe-area-inset-top,0px))]"),children:[e.jsx(ve,{children:e.jsx("div",{className:n("roun
24ded-2xl p-6 mb-6",s?"border border-white/[0.09] shadow-[0_8px_32px_rgba(0,0,0,0.18)]":"bg-white border border-gray-100"),style:s?je:void 0,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative group",children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",id:"dashboard-avatar-upload",onChange:async f=>{var X;const F=(X=f.target.files)==null?void 0:X[0];if(!(!F||!l))try{const z=F.name.split(".").pop(),ce=`${u.id}/avatar.${z}`,{error:$e}=await S.storage.from("creator-portfolios").upload(ce,F,{upsert:!0});if($e)throw $e;const{data:We}=S.storage.from("creator-portfolios").getPublicUrl(ce),Ve=`${We.publicUrl}?t=${Date.now()}`;await S.from("creators").update({avatar_url:Ve}).eq("id",u.id),w(),M.success(r?"התמונה עודכנה!":"Photo updated!")}catch{M.error(r?"שגיאה בהעלאת תמונה":"Failed to upload photo")}}}),e.jsxs("label",{htmlFor:"dashboard-avatar-upload",className:"cursor-pointer block",children:[e.jsx("div",{className:n("w-14 h-14 rounded-full overflow-hidden flex items-center justify-center transition-all",u.avatar_url?"ring-2 ring-[#336CFF]/20 group-hover:ring-[#336CFF]/50":s?"bg-white/[0.06] border-2 border-dashed border-white/10 group-hover:border-white/30":"bg-gray-50 border-2 border-dashed border-gray-200 group-hover:border-gray-400"),children:u.avatar_url?e.jsx("img",{src:u.avatar_url,alt:"",className:"w-full h-full object-cover"}):e.jsx(jt,{className:n("w-5 h-5",s?"text-white/20":"text-gray-300")})}),e.jsx("div",{className:"absolute -bottom-0.5 -end-0.5 w-5 h-5 rounded-full bg-[#336CFF] text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity shadow-sm",children:e.jsx(jt,{className:"w-2.5 h-2.5"})})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-3 mb-1",children:e.jsx("p",{className:n("text-sm font-medium",s?"text-white/40":"text-[#182137]/50",r&&"font-heebo"),children:r?`שלום, ${u.nickname||u.display_name}`:`Hello, ${u.nickname||u.display_name}`})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:n("text-xl sm:text-2xl font-bold",s?"text-white":"text-[#182137]",r&&"font-heebo"),children:r?"דשבורד קריאייטור":"Creator Dashboard"}),e.jsx(ys,{creators:i,selectedId:p||"",onSelect:m,isRTL:r,isDark:s})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(K,{variant:"ghost",size:"sm",onClick:C,className:n("rounded-lg h-8 px-3 text-xs",s?"text-white/40 hover:text-white hover:bg-white/[0.04]":"text-[#182137]/50 hover:text-[#182137] hover:bg-gray-100"),children:[e.jsx(Ke,{className:"w-3 h-3 me-1.5"}),r?"עריכת פרופיל":"Edit Profile"]}),u.verified&&e.jsxs("div",{className:n("px-3 py-1.5 rounded-full flex items-center gap-1.5 text-sm font-medium","bg-emerald-500/10 text-emerald-500"),children:[e.jsx(Ue,{className:"w-4 h-4"}),r?"מאומת":"Verified"]})]})]})})}),e.jsxs(us,{defaultValue:"overview",className:"w-full",children:[e.jsx("div",{className:"flex",children:e.jsxs(br,{className:n("h-10 p-1 rounded-xl",s?"bg-black/30 border border-white/[0.06]":"bg-gray-100"),children:[e.jsx(ct,{value:"overview",className:n("h-8 px-4 text-sm rounded-lg",r&&"font-heebo"),children:r?"כללי":"Overview"}),e.jsx(ct,{value:"payments",className:n("h-8 px-4 text-sm rounded-lg",r&&"font-heebo"),children:r?"תשלומים":"Payments"})]})}),e.jsx(dt,{value:"overview",className:"mt-6",children:e.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[g&&e.jsx(ve,{delay:.1,children:e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[e.jsx(Me,{value:g.active_orders,label:r?"הזמנות פעילות":"Active",icon:Ie,isDark:s,isRTL:r,accent:!0}),e.jsx(Me,{value:g.completed_orders,label:r?"הושלמו":"Completed",icon:ca,isDark:s,isRTL:r}),e.jsx(Me,{value:`$${g.total_earned_tokens}`,label:r?"הכנסות":"Earnings",icon:Rr,isDark:s,isRTL:r}),e.jsx(Me,{value:g.average_rating>0?g.average_rating.toFixed(1):"-",label:r?"דירוג":"Rating",icon:Lr,isDark:s,isRTL:r})]})}
24),e.jsx(ve,{delay:.2,children:e.jsxs("div",{className:n("rounded-2xl p-5",s?"border border-white/[0.08] shadow-[0_6px_28px_rgba(0,0,0,0.15)]":"bg-white border border-gray-100"),style:s?je:void 0,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:n("text-base font-semibold",s?"text-white":"text-[#182137]",r&&"font-heebo"),children:r?"השירותים שלי":"My Services"}),e.jsxs(K,{size:"sm",onClick:U,className:"rounded-lg text-white text-xs h-8 px-3",style:{background:ee},children:[e.jsx(Re,{className:"w-3.5 h-3.5 me-1"}),r?"חדש":"Add"]})]}),b.length===0?e.jsxs("div",{className:n("rounded-xl p-8 text-center",s?"bg-black/20":"bg-gray-50"),children:[e.jsx("div",{className:"mx-auto w-12 h-12 rounded-xl flex items-center justify-center mb-3",style:{background:`${ee}12`},children:e.jsx(Ie,{className:"w-5 h-5",style:{color:`${ee}66`}})}),e.jsx("p",{className:n("font-medium text-sm",s?"text-white/60":"text-[#182137]/60",r&&"font-heebo"),children:r?"עדיין אין שירותים":"No services yet"}),e.jsxs(K,{onClick:U,size:"sm",className:"mt-4 rounded-lg text-white text-xs",style:{background:ee},children:[e.jsx(Re,{className:"w-3.5 h-3.5 me-1"}),r?"צור שירות":"Create Service"]})]}):e.jsx("div",{className:"space-y-1",children:b.map(f=>e.jsx(fs,{service:f,isRTL:r,isDark:s,onEdit:()=>se(f),onToggle:()=>h(f)},f.id))})]})}),(u==null?void 0:u.id)&&e.jsx(ve,{delay:.25,children:e.jsx(Ta,{creatorId:u.id,orders:_.map(f=>({id:f.order_id,order_number:f.order_number,status:f.status,service_title:f.service_title,client_name:f.client_name})),isRTL:r,isDark:s,darkSurfaceStyle:je})})]}),e.jsx("div",{className:"space-y-6",children:e.jsx(ve,{delay:.15,children:e.jsxs("div",{className:n("rounded-2xl p-5",s?"border border-white/[0.08] shadow-[0_6px_28px_rgba(0,0,0,0.15)]":"bg-white border border-gray-100"),style:s?je:void 0,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:n("text-base font-semibold flex items-center gap-2",s?"text-white":"text-[#182137]",r&&"font-heebo"),children:[e.jsx(St,{className:"w-4 h-4",style:{color:ee}}),r?"שיחות אחרונות":"Recent Chats"]}),_.length>0&&e.jsx(yt,{to:"/creators/messages",className:n("text-xs font-medium transition-colors",s?"text-white/40 hover:text-white":"text-[#182137]/50 hover:text-[#182137]"),children:r?"הכל":"All"})]}),_.length===0?e.jsxs("div",{className:n("rounded-xl p-8 text-center",s?"bg-black/20":"bg-gray-50"),children:[e.jsx("div",{className:"mx-auto w-12 h-12 rounded-xl flex items-center justify-center mb-3",style:{background:`${ee}12`},children:e.jsx(St,{className:"w-5 h-5",style:{color:`${ee}66`}})}),e.jsx("p",{className:n("font-medium text-sm",s?"text-white/60":"text-[#182137]/60",r&&"font-heebo"),children:r?"אין שיחות עדיין":"No conversations yet"}),e.jsx("p",{className:n("text-xs mt-1",s?"text-white/30":"text-[#182137]/40",r&&"font-heebo"),children:r?"כשלקוח יפנה אליך, תראה את זה כאן":"When a client contacts you, you'll see it here"})]}):e.jsx("div",{className:"space-y-1",children:_.map(f=>e.jsx(xs,{conv:f,isRTL:r,isDark:s,onClick:()=>c(`/order/${f.order_id}`)},f.order_id))})]})})})]})}),e.jsx(dt,{value:"payments",className:"mt-6",children:(u==null?void 0:u.id)&&e.jsx(ve,{delay:.1,children:e.jsx("div",{className:"max-w-3xl mx-auto",children:e.jsx(is,{creatorId:u.id,lifetimeEarningsCents:u.total_earnings_cents||0,isRTL:r,isDark:s,darkSurfaceStyle:je})})})})]})]}),e.jsx(ke,{open:j,onOpenChange:O,children:e.jsxs(Se,{className:n("sm:max-w-lg rounded-2xl max-h-[85vh] overflow-y-auto",s?"bg-[#1e1f26] border-white/[0.08]":"bg-white border-gray-200"),dir:r?"rtl":"ltr",children:[e.jsx(Ee,{children:e.jsx(Fe,{className:n("text-lg font-semibold",s?"text-white":"text-[#182137]",r&&"font-heebo text-right"),children:E?r?"עריכת שירות":"Edit Service":r?"שירות חדש":"New Service"})}),e.jsx(vs,{isRTL:r,isDark:s,existingService:E,creatorId:u.id,onClose:()=>O(!1),onSave:w},(E==null?void 0:E.id)??`new-${P}`)]})}),e.jsx(ke,{open:I,onOpenChange:W,children:e.jsxs(Se,{className:n("sm:max-w-md rounded-2xl",s?"bg-[#1e1f26] border-white/[0.08]":"bg-white border-gray-200"),dir:r?"rtl":"ltr",children:[e.jsx(Ee,{children:e.jsx(Fe,{className:n("text-lg font-semibold",s?"text-white":"text-[#182137]",r&&"font-heebo text-right"),children:r?"עריכת פרופיל":"Edit Profile"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(G,{className:n("text-sm font-medium",s?"text-white/50":"text-[#182137]/60",r&&"font-heebo"),children:r?"תמונה ראשית לקיר":"Cover image"}),e.jsx("p",{className:n("text-[11px] mt-0.5 mb-2",s?"text-white/35":"text-[#182137]/45",r&&"font-heebo"),children:r?"התמונה הגדולה שמוצגת בראש עמוד הקריאייטור שלך":"Large hero image shown at the top of your public page"}),e.jsx("input",{ref:V,type:"file",accept:"image/*",className:"hidden",onChange:f=>{var F;A(((F=f.target.files)==null?void 0:F[0])||null),f.target.value=""}}),Z?e.jsxs("div",{className:"relative rounded-xl overflow-hidden group",children:[e.jsx("img",{src:Z,alt:"",className:"w-full h-32 object-cover"}),e.jsxs("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors flex items-center justify-center gap-2 opacity-0 group-hover:opacity-100",children:[e.jsxs(K,{type:"button",size:"sm",onClick:()=>{var f;return(f=V.current)==null?void 0:f.click()},disabled:D,className:"rounded-lg text-white text-xs h-8 px-3",style:{background:ee},children:[D?e.jsx(le,{className:"w-3.5 h-3.5 animate-spin me-1"}):e.jsx(Vt,{className:"w-3.5 h-3.5 me-1"}),r?"החלף":"Replace"]}),e.jsx("button",{type:"button",onClick:()=>T(null),className:"w-8 h-8 rounded-full bg-red-500/90 hover:bg-red-500 flex items-center justify-center transition-colors",children:e.jsx(ea,{className:"w-4 h-4 text-white"})})]})]}):e.jsxs("button",{type:"button",onClick:()=>{var f;return(f=V.current)==null?void 0:f.click()},disabled:D,className:n("w-full h-32 rounded-xl border-2 border-dashed flex flex-col items-center justify-center gap-1.5 transition-colors",s?"border-white/10 hover:border-white/30 bg-white/[0.02]":"border-gray-200 hover:border-[#336CFF]/50 bg-gray-50",r&&"font-heebo"),children:[D?e.jsx(le,{className:"w-5 h-5 animate-spin",style:{color:ee}}):e.jsx(Ht,{className:"w-5 h-5",style:{color:ee}}),e.jsx("span",{className:n("text-xs font-medium",s?"text-white/50":"text-[#182137]/55"),children:D?r?"מעלה...":"Uploading...":r?"העלה תמונה ראשית":"Upload cover image"})]})]}),e.jsxs("div",{children:[e.jsx(G,{className:n("text-sm font-medium",s?"text-white/50":"text-[#182137]/60",r&&"font-heebo"),children:r?"שם תצוגה":"Display Name"}),e.jsx(ue,{value:J,onChange:f=>ae(f.target.value),placeholder:r?"השם שיוצג ללקוחות":"Name shown to clients",maxLength:50,className:n("mt-1.5 rounded-xl h-11",s?"bg-white/[0.04] border-white/[0.08] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200",r&&"font-heebo")})]}),e.jsxs("div",{children:[e.jsx(G,{className:n("text-sm font-medium",s?"text-white/50":"text-[#182137]/60",r&&"font-heebo"),children:r?"ביוגרפיה":"Bio"}),e.jsx(me,{value:R,onChange:f=>{f.target.value.length<=300&&re(f.target.value)},placeholder:r?"ספר על עצמך ועל הניסיון שלך":"Tell about yourself and your experience",className:n("mt-1.5 resize-none rounded-xl",s?"bg-white/[0.04] border-white/[0.08] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200",r&&"font-heebo"),rows:4}),e.jsxs("p",{className:n("text-xs mt-1",s?"text-white/30":"text-[#182137]/40"),children:[R.length,"/300"]})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx(K,{variant:"outline",onClick:()=>W(!1),className:n("flex-1 rounded-xl h-11",s?"border-white/[0.08] text-white/70 hover:bg-white/[0.04]":"border-gray-200"),children:r?"ביטול":"Cancel"}),e.jsx(K,{onClick:N,disabled:L,className:"flex-1 rounded-xl h-11 text-white",style:{background:ee},children:L?e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-4 h-4 animate-spin me-1.5"}),r?"שומר...":"Saving..."]}):r?"שמור":"Save"})]})]})]})})]})]})}export{Hs 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.