@creaditor/business-ai 1.0.46 → 1.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27366,7 +27366,7 @@ function UK({
27366
27366
  var we, Me, Pe, pt;
27367
27367
  if (!o) return;
27368
27368
  const K = (t == null ? void 0 : t.trim()) || ((we = o.website) == null ? void 0 : we.trim()) || "";
27369
- let q = !0;
27369
+ let q = !1;
27370
27370
  (Me = o.website) != null && Me.trim() || (q = !1);
27371
27371
  const O = E || "", G = O.startsWith("data:image/"), Y = (Pe = o == null ? void 0 : o.theme) == null ? void 0 : Pe.logoHeaderBackground, Ae = Y && /^#(000|000000)$/i.test(String(Y).trim()), Te = Y && !Ae ? Y : Y && Ae ? "white" : void 0, He = (pt = o == null ? void 0 : o.theme) != null && pt.logoHeaderBackground && /^#(000|000000)$/i.test(String(o.theme.logoHeaderBackground).trim()) ? { ...o, theme: { ...o.theme, logoHeaderBackground: "white" } } : o;
27372
27372
  if (!He.business_name) {
@@ -516,7 +516,7 @@ Newsletter creation ✉️, Landing pages 🎯, Digital courses 📇 and more`,s
516
516
  ${u(c,.8)} 0%,
517
517
  ${u(c,.6)} 50%,
518
518
  ${u(c,.4)} 100%
519
- )`,animationDelay:`${f*.15}s`}},f))})]}),A.jsxs(Ae,{className:l?Wh:"",sx:{fontSize:{xs:"0.875rem",sm:"1rem"},fontWeight:500,color:"text.secondary"},children:[e,A.jsx("span",{className:dh,children:a})]}),t&&A.jsxs(P,{className:l?gh:"",sx:{width:"100%",maxWidth:"600px",display:"flex",flexDirection:"column",gap:2,mt:1},children:[A.jsx(hg,{variant:"rectangular",height:60,sx:{borderRadius:2}}),A.jsx(hg,{variant:"rectangular",height:40,width:"80%",sx:{borderRadius:2}}),A.jsx(hg,{variant:"rectangular",height:40,width:"60%",sx:{borderRadius:2}})]})]}):null}const _i=Ul,YO=["קהילה ועמותות","טכנולוגיה","בריאות","חינוך","אוכל ומסעדות","אופנה","נדל״ן","כספים וביטוח","תחבורה ולוגיסטיקה","תקשורת ושיווק","אמנות ותרבות","ספורט ופנאי","ייעוץ וניהול","מסחר קמעונאי","ייצור","אנרגיה וסביבה","משפטים","בנייה","חקלאות","תיירות","בידור","ביטחון"],ZO=["מקצועי","ידידותי","פורמלי","לא פורמלי","חברתי","מעודכן","קלאסי","צעיר","משפחתי","איכותי","מהיר","אמין","יצירתי","חכם","חם","קר","מעורר השראה","מעשי","יוקרתי","נגיש"],js=e=>{if(!e||typeof e!="string")return e;const t=e.trim();return!t||/^https?:\/\//i.test(t)?t:`https://${t}`};function NO(e,t,n){let a="";const r=n.trim().toLowerCase();if(r)try{const i=/^https?:\/\//i.test(r)?r:`https://${r}`;a=new URL(i).hostname.replace(/^www\./,"")}catch{}const l=`${a} ${r} ${e.toLowerCase()} ${t.toLowerCase()}`;return/linkedin|לינקדאין|לינקדין/.test(l)?mx:/facebook|fb\.com|fb\.me|פייסבוק/.test(l)?fx:/instagram|instagr\.am|אינסטגרם/.test(l)?gx:/youtube|youtu\.be|יוטיוב/.test(l)?vx:/(^|\.)x\.com|twitter\.com|טוויטר|טוויט/.test(l)?Sx:/tiktok|טיקטוק|tik tok/.test(l)?Ux:/whatsapp|wa\.me|וואטסאפ|ווטסאפ/.test(l)?xx:/telegram|t\.me|טלגרם/.test(l)?bx:/reddit|רדיט/.test(l)?Rx:/pinterest|פינטרסט/.test(l)?Bx:/github|גיטהאב|גיטהב/.test(l)?Mx:Vx}function GO({platform:e,url:t,onPlatformCommit:n,onUrlChange:a,onRemove:r}){const[l,i]=v.useState(e);v.useEffect(()=>{i(e)},[e]);const o=v.useCallback(()=>{l!==e&&n(e,l)},[e,l,n]),s=NO(e,l,t);return A.jsxs(P,{sx:{display:"flex",alignItems:"flex-start",gap:1,mb:1,flexDirection:{xs:"column",sm:"row"}},children:[A.jsx(rt,{fullWidth:!0,label:"פלטפורמה",value:l,onChange:p=>i(p.target.value),onBlur:o,onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),p.target.blur())},variant:"outlined",margin:"normal",size:"small",sx:{flex:{xs:"1 1 100%",sm:"0 0 min(200px, 34%)"}},placeholder:"לדוגמה: LinkedIn",InputProps:{startAdornment:A.jsx(ug,{position:"start",sx:{mr:0},children:A.jsx(s,{sx:{fontSize:22,color:"primary.main"},"aria-hidden":!0})})}}),A.jsx(rt,{fullWidth:!0,label:"קישור",value:t,onChange:p=>a(e,p.target.value),variant:"outlined",margin:"normal",size:"small",sx:{flex:1},placeholder:"https://..."}),A.jsx(Wa,{color:"error",onClick:()=>r(e),sx:{mt:1},"aria-label":"הסר רשת חברתית",children:A.jsx(Qs,{})})]})}const HO=e=>({business_name:"",industry:"",business_type:"",business_type_options:[],keywords:[],profit_intent:"",is_haredi_sector:null,business_tone:"",description:"",overall_confidence:0,owner:"",owner_gender:"",business_address:"",website:e||"",contacts:{email:"",phone:""},socials:{linkedin:"",instagram:"",facebook:""},theme:void 0,website_confidence:0,confidence_scores:{website:0,contacts:{phone:0},socials:{},overall:0},token_usage:{total:{prompt_tokens:0,completion_tokens:0,total_tokens:0},breakdown:{analyze_business:{prompt_tokens:0,completion_tokens:0,total_tokens:0}}},estimated_cost_usd:0,source_urls:[],analyzed_at:new Date().toISOString()}),tA=e=>{var t,n;return e?{...e,business_address:e.business_address??(e==null?void 0:e.address)??"",business_type_options:Array.isArray(e.business_type_options)?e.business_type_options:[],keywords:Array.isArray(e.keywords)?e.keywords:[],description:Array.isArray(e.description)?e.description:e.description?[e.description]:[""],contacts:{email:((t=e.contacts)==null?void 0:t.email)??"",phone:((n=e.contacts)==null?void 0:n.phone)??""},socials:e.socials&&typeof e.socials=="object"?e.socials:{linkedin:"",instagram:"",facebook:""},theme:(()=>{var i;const a=(i=e.theme)==null?void 0:i.logoHeaderBackground,r=(e==null?void 0:e.logoHeaderBackground)??(e==null?void 0:e.logoBackgroundHex),l=typeof a=="string"?a:typeof r=="string"?r:void 0;if(e.theme)return{primary:e.theme.primary||"",secondary:e.theme.secondary||"",colors:Array.isArray(e.theme.colors)?e.theme.colors:[],...l?{logoHeaderBackground:l}:{}};if(l)return{primary:"",secondary:"",colors:[],logoHeaderBackground:l}})()}:null};function XO({data:e,websiteUrl:t,setActiveStep:n,onSave:a,urls:r,language:l}){var Qe,be,je,Ke,Ue;const i=Ni(),[o,s]=v.useState(null),[p,c]=v.useState(!0),[u,d]=v.useState(null),[f,W]=v.useState(!1),[m,x]=v.useState(null),[h,g]=v.useState([]),[C,y]=v.useState([]),[E,S]=v.useState((e==null?void 0:e.logo)||(e&&typeof e=="object"&&"logo"in e?e.logo:"")),k=v.useRef(null),w=v.useRef(""),V=v.useRef(!1),b=v.useRef(new Map),B=v.useRef(0),M=()=>{b.current=new Map,B.current=0},F=K=>{const q=b.current;let O=q.get(K);return O||(O=`social-row-${B.current++}`,q.set(K,O)),O},{shadowRoot:U,stepBeforeStep1:T,step2Data:z}=Va(),[J,L]=v.useState(!1),j=v.useCallback(K=>{if(!K){S(""),s(O=>{var G,Y,de,Oe;return!O||!((G=O.theme)!=null&&G.logoHeaderBackground)?O:{...O,theme:{...O.theme,primary:((Y=O.theme)==null?void 0:Y.primary)??"",secondary:((de=O.theme)==null?void 0:de.secondary)??"",colors:((Oe=O.theme)==null?void 0:Oe.colors)??[],logoHeaderBackground:void 0}}});return}K.startsWith("http://")||K.startsWith("https://")?Qj(K).then(O=>{S(O.pngDataUrl),s(G=>{var Y,de,Oe,He;return G&&{...G,theme:{...G.theme,primary:((Y=G.theme)==null?void 0:Y.primary)??"",secondary:((de=G.theme)==null?void 0:de.secondary)??"",colors:((Oe=G.theme)==null?void 0:Oe.colors)??[],logoHeaderBackground:((He=G.theme)==null?void 0:He.logoHeaderBackground)??O.backgroundHex}}})}).catch(()=>{S(K)}):S(K)},[]),R=K=>{var G;const q=(G=K.target.files)==null?void 0:G[0];if(!q)return;if(!q.type.startsWith("image/")){alert("אנא בחר קובץ תמונה בלבד");return}if(q.size>5*1024*1024){alert("קובץ התמונה גדול מדי. אנא בחר קובץ קטן מ-5MB");return}const O=new FileReader;O.onloadend=()=>{const Y=O.result;S(Y)},O.onerror=()=>{alert("שגיאה בקריאת הקובץ. אנא נסה שוב.")},O.readAsDataURL(q)},X=()=>{S(""),s(K=>{var q,O,G,Y;return(q=K==null?void 0:K.theme)!=null&&q.logoHeaderBackground?{...K,theme:{...K.theme,primary:((O=K.theme)==null?void 0:O.primary)??"",secondary:((G=K.theme)==null?void 0:G.secondary)??"",colors:((Y=K.theme)==null?void 0:Y.colors)??[],logoHeaderBackground:void 0}}:K}),k.current&&(k.current.value="")},Z=v.useCallback(()=>[...YO].sort(),[]),Q=v.useCallback(()=>[...ZO].sort(),[]);v.useEffect(()=>{g(Z()),y(Q())},[Z,Q]),v.useEffect(()=>{if(o!=null&&o.industry){const K=Z();K.includes(o.industry)||K.push(o.industry),g(K.sort())}},[o==null?void 0:o.industry,Z]),v.useEffect(()=>{if(o!=null&&o.business_tone){const K=Q();K.includes(o.business_tone)||K.push(o.business_tone),y(K.sort())}},[o==null?void 0:o.business_tone,Q]);const N=K=>!K||typeof K!="object"?!1:"business_name"in K||"industry"in K||"business_type"in K||"keywords"in K||"description"in K;v.useEffect(()=>{if(e&&N(e)&&e.logo){const K=e.logo;K.startsWith("http://")||K.startsWith("https://")?j(K):S(K)}else if(e&&"logo"in e&&e.logo){const K=e.logo;K.startsWith("http://")||K.startsWith("https://")?j(K):S(K)}},[e,j]),v.useEffect(()=>{!p&&o&&L(!0)},[p,o]),v.useEffect(()=>{(async()=>{var Oe,He,ue,we,Me,Je,Wt,$e;const q=t?js(t).replace(/\/$/,"").toLowerCase():"",O=t&&t.trim()!=="";if(w.current===q&&o!==null&&O){c(!1);return}if(V.current)return;if(!!!(e&&N(e))&&(z!=null&&z.businessData)&&(z!=null&&z.websiteUrl)){const De=tA(z.businessData);if(De){M(),s(De),c(!1),w.current="",z.logo&&(z.logo.startsWith("http://")||z.logo.startsWith("https://")?j(z.logo):S(z.logo));return}}if(O){const De=Array.isArray(r)?r.map(js):[];De.push(js(t));try{V.current=!0,c(!0),d(null);const Ye=await rx(t,De,"",l);let st=tA(Ye);const Xt=(Oe=e==null?void 0:e.theme)==null?void 0:Oe.logoHeaderBackground;if(st&&typeof Xt=="string"&&(st={...st,theme:{...st.theme,primary:((He=st.theme)==null?void 0:He.primary)??"",secondary:((ue=st.theme)==null?void 0:ue.secondary)??"",colors:Array.isArray((we=st.theme)==null?void 0:we.colors)?st.theme.colors:[],logoHeaderBackground:Xt}}),st){M(),s(st),w.current=q;const Re=Ye==null?void 0:Ye.logo;Re&&j(Re)}else d("שגיאה בעיבוד הנתונים שהתקבלו מהשרת")}catch(Ye){d(Ye instanceof Error?Ye.message:"שגיאה בטעינת הנתונים")}finally{c(!1),V.current=!1}return}if(e&&N(e)){const De=tA(e);if(De){M(),s(De),c(!1),w.current="";const Ye=e==null?void 0:e.logo;Ye&&(Ye.startsWith("http://")||Ye.startsWith("https://")?j(Ye):S(Ye));return}}const de=Array.isArray(r)?r.map(js):[];if(de.length===0){M(),s(HO(t)),c(!1),w.current="";return}try{V.current=!0,c(!0),d(null);const De=await rx(t,de,"",l);let Ye=tA(De);const st=(Me=e==null?void 0:e.theme)==null?void 0:Me.logoHeaderBackground;if(Ye&&typeof st=="string"&&(Ye={...Ye,theme:{...Ye.theme,primary:((Je=Ye.theme)==null?void 0:Je.primary)??"",secondary:((Wt=Ye.theme)==null?void 0:Wt.secondary)??"",colors:Array.isArray(($e=Ye.theme)==null?void 0:$e.colors)?Ye.theme.colors:[],logoHeaderBackground:st}}),Ye){M(),s(Ye),w.current="";const Xt=De==null?void 0:De.logo;Xt&&j(Xt)}else d("שגיאה בעיבוד הנתונים שהתקבלו מהשרת")}catch(De){d(De instanceof Error?De.message:"שגיאה בטעינת הנתונים")}finally{c(!1),V.current=!1}})()},[t,z]);const te=(K,q)=>{o&&s({...o,[K]:q})},se=(K,q,O)=>{o&&s({...o,[K]:{...o[K],[q]:O}})},ve=(K,q)=>{if(o){const O=o.theme||{primary:"",secondary:"",colors:[]};s({...o,theme:{...O,[K]:q}})}},We=K=>{if(!o)return;const q={primary:"",secondary:"",colors:[],...o.theme},O=Oe=>Oe.toLowerCase(),G=new Set(K.map(O)),Y=q.primary&&G.has(O(q.primary))?q.primary:"",de=q.secondary&&G.has(O(q.secondary))?q.secondary:"";s({...o,theme:{...q,primary:Y,secondary:de,colors:K}})},me=(K,q,O)=>{if(o)if(K==="description"){const Y=[...Array.isArray(o.description)?o.description:o.description?[o.description]:[""]];Y[q]=O,s({...o,description:Y})}else{const G=[...o[K]];G[q]=O,s({...o,[K]:G})}},ae=()=>{if(o){const K=[...o.business_type_options,""];s({...o,business_type_options:K})}},$=K=>{if(o){const q=o.business_type_options.filter((O,G)=>G!==K);s({...o,business_type_options:q})}},ye=()=>{if(o){const q=[...Array.isArray(o.description)?o.description:o.description?[o.description]:[""],""];s({...o,description:q})}},fe=K=>{if(o){const O=(Array.isArray(o.description)?o.description:o.description?[o.description]:[""]).filter((G,Y)=>Y!==K);s({...o,description:O.length>0?O:[""]})}},ge=()=>{if(o){const K={...o.socials};let q=1,O="social_media";for(;K[O];)O=`social_media_${q}`,q++;K[O]="",b.current.has(O)||b.current.set(O,`social-row-${B.current++}`),s({...o,socials:K})}},he=K=>{if(o){b.current.delete(K);const q={...o.socials};delete q[K],s({...o,socials:q})}},pe=(K,q)=>{if(o&&K!==q){const O={...o.socials},G=O[K]||"";delete O[K];const Y=q.trim(),de=b.current.get(K);de&&(b.current.delete(K),Y&&b.current.set(Y,de)),Y&&(O[Y]&&Y!==K?O[Y]=G||O[Y]:O[Y]=G),s({...o,socials:O})}},Ne=(K,q)=>{if(o){const O={...o.socials};O[K]=q,s({...o,socials:O})}},ne=async()=>{var we,Me,Je,Wt;if(!o)return;const K=(t==null?void 0:t.trim())||((we=o.website)==null?void 0:we.trim())||"";let q=!0;(Me=o.website)!=null&&Me.trim()||(q=!1);const O=E||"",G=O.startsWith("data:image/"),Y=(Je=o==null?void 0:o.theme)==null?void 0:Je.logoHeaderBackground,de=Y&&/^#(000|000000)$/i.test(String(Y).trim()),Oe=Y&&!de?Y:Y&&de?"white":void 0,He=(Wt=o==null?void 0:o.theme)!=null&&Wt.logoHeaderBackground&&/^#(000|000000)$/i.test(String(o.theme.logoHeaderBackground).trim())?{...o,theme:{...o.theme,logoHeaderBackground:"white"}}:o;if(!He.business_name){x("שם העסק הוא שדה חובה"),W(!1);return}const ue={businessData:He,logo:O,websiteUrl:K,...Oe?{logoBackgroundHex:Oe}:{}};G&&(ue.logoToUpload=O),W(!0),x(null);try{const $e={...He};delete $e._id,delete $e.__v,$e.business_address!==void 0&&($e.address=$e.business_address),Array.isArray($e.description)&&($e.description=$e.description.filter(Boolean).join(`
519
+ )`,animationDelay:`${f*.15}s`}},f))})]}),A.jsxs(Ae,{className:l?Wh:"",sx:{fontSize:{xs:"0.875rem",sm:"1rem"},fontWeight:500,color:"text.secondary"},children:[e,A.jsx("span",{className:dh,children:a})]}),t&&A.jsxs(P,{className:l?gh:"",sx:{width:"100%",maxWidth:"600px",display:"flex",flexDirection:"column",gap:2,mt:1},children:[A.jsx(hg,{variant:"rectangular",height:60,sx:{borderRadius:2}}),A.jsx(hg,{variant:"rectangular",height:40,width:"80%",sx:{borderRadius:2}}),A.jsx(hg,{variant:"rectangular",height:40,width:"60%",sx:{borderRadius:2}})]})]}):null}const _i=Ul,YO=["קהילה ועמותות","טכנולוגיה","בריאות","חינוך","אוכל ומסעדות","אופנה","נדל״ן","כספים וביטוח","תחבורה ולוגיסטיקה","תקשורת ושיווק","אמנות ותרבות","ספורט ופנאי","ייעוץ וניהול","מסחר קמעונאי","ייצור","אנרגיה וסביבה","משפטים","בנייה","חקלאות","תיירות","בידור","ביטחון"],ZO=["מקצועי","ידידותי","פורמלי","לא פורמלי","חברתי","מעודכן","קלאסי","צעיר","משפחתי","איכותי","מהיר","אמין","יצירתי","חכם","חם","קר","מעורר השראה","מעשי","יוקרתי","נגיש"],js=e=>{if(!e||typeof e!="string")return e;const t=e.trim();return!t||/^https?:\/\//i.test(t)?t:`https://${t}`};function NO(e,t,n){let a="";const r=n.trim().toLowerCase();if(r)try{const i=/^https?:\/\//i.test(r)?r:`https://${r}`;a=new URL(i).hostname.replace(/^www\./,"")}catch{}const l=`${a} ${r} ${e.toLowerCase()} ${t.toLowerCase()}`;return/linkedin|לינקדאין|לינקדין/.test(l)?mx:/facebook|fb\.com|fb\.me|פייסבוק/.test(l)?fx:/instagram|instagr\.am|אינסטגרם/.test(l)?gx:/youtube|youtu\.be|יוטיוב/.test(l)?vx:/(^|\.)x\.com|twitter\.com|טוויטר|טוויט/.test(l)?Sx:/tiktok|טיקטוק|tik tok/.test(l)?Ux:/whatsapp|wa\.me|וואטסאפ|ווטסאפ/.test(l)?xx:/telegram|t\.me|טלגרם/.test(l)?bx:/reddit|רדיט/.test(l)?Rx:/pinterest|פינטרסט/.test(l)?Bx:/github|גיטהאב|גיטהב/.test(l)?Mx:Vx}function GO({platform:e,url:t,onPlatformCommit:n,onUrlChange:a,onRemove:r}){const[l,i]=v.useState(e);v.useEffect(()=>{i(e)},[e]);const o=v.useCallback(()=>{l!==e&&n(e,l)},[e,l,n]),s=NO(e,l,t);return A.jsxs(P,{sx:{display:"flex",alignItems:"flex-start",gap:1,mb:1,flexDirection:{xs:"column",sm:"row"}},children:[A.jsx(rt,{fullWidth:!0,label:"פלטפורמה",value:l,onChange:p=>i(p.target.value),onBlur:o,onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),p.target.blur())},variant:"outlined",margin:"normal",size:"small",sx:{flex:{xs:"1 1 100%",sm:"0 0 min(200px, 34%)"}},placeholder:"לדוגמה: LinkedIn",InputProps:{startAdornment:A.jsx(ug,{position:"start",sx:{mr:0},children:A.jsx(s,{sx:{fontSize:22,color:"primary.main"},"aria-hidden":!0})})}}),A.jsx(rt,{fullWidth:!0,label:"קישור",value:t,onChange:p=>a(e,p.target.value),variant:"outlined",margin:"normal",size:"small",sx:{flex:1},placeholder:"https://..."}),A.jsx(Wa,{color:"error",onClick:()=>r(e),sx:{mt:1},"aria-label":"הסר רשת חברתית",children:A.jsx(Qs,{})})]})}const HO=e=>({business_name:"",industry:"",business_type:"",business_type_options:[],keywords:[],profit_intent:"",is_haredi_sector:null,business_tone:"",description:"",overall_confidence:0,owner:"",owner_gender:"",business_address:"",website:e||"",contacts:{email:"",phone:""},socials:{linkedin:"",instagram:"",facebook:""},theme:void 0,website_confidence:0,confidence_scores:{website:0,contacts:{phone:0},socials:{},overall:0},token_usage:{total:{prompt_tokens:0,completion_tokens:0,total_tokens:0},breakdown:{analyze_business:{prompt_tokens:0,completion_tokens:0,total_tokens:0}}},estimated_cost_usd:0,source_urls:[],analyzed_at:new Date().toISOString()}),tA=e=>{var t,n;return e?{...e,business_address:e.business_address??(e==null?void 0:e.address)??"",business_type_options:Array.isArray(e.business_type_options)?e.business_type_options:[],keywords:Array.isArray(e.keywords)?e.keywords:[],description:Array.isArray(e.description)?e.description:e.description?[e.description]:[""],contacts:{email:((t=e.contacts)==null?void 0:t.email)??"",phone:((n=e.contacts)==null?void 0:n.phone)??""},socials:e.socials&&typeof e.socials=="object"?e.socials:{linkedin:"",instagram:"",facebook:""},theme:(()=>{var i;const a=(i=e.theme)==null?void 0:i.logoHeaderBackground,r=(e==null?void 0:e.logoHeaderBackground)??(e==null?void 0:e.logoBackgroundHex),l=typeof a=="string"?a:typeof r=="string"?r:void 0;if(e.theme)return{primary:e.theme.primary||"",secondary:e.theme.secondary||"",colors:Array.isArray(e.theme.colors)?e.theme.colors:[],...l?{logoHeaderBackground:l}:{}};if(l)return{primary:"",secondary:"",colors:[],logoHeaderBackground:l}})()}:null};function XO({data:e,websiteUrl:t,setActiveStep:n,onSave:a,urls:r,language:l}){var Qe,be,je,Ke,Ue;const i=Ni(),[o,s]=v.useState(null),[p,c]=v.useState(!0),[u,d]=v.useState(null),[f,W]=v.useState(!1),[m,x]=v.useState(null),[h,g]=v.useState([]),[C,y]=v.useState([]),[E,S]=v.useState((e==null?void 0:e.logo)||(e&&typeof e=="object"&&"logo"in e?e.logo:"")),k=v.useRef(null),w=v.useRef(""),V=v.useRef(!1),b=v.useRef(new Map),B=v.useRef(0),M=()=>{b.current=new Map,B.current=0},F=K=>{const q=b.current;let O=q.get(K);return O||(O=`social-row-${B.current++}`,q.set(K,O)),O},{shadowRoot:U,stepBeforeStep1:T,step2Data:z}=Va(),[J,L]=v.useState(!1),j=v.useCallback(K=>{if(!K){S(""),s(O=>{var G,Y,de,Oe;return!O||!((G=O.theme)!=null&&G.logoHeaderBackground)?O:{...O,theme:{...O.theme,primary:((Y=O.theme)==null?void 0:Y.primary)??"",secondary:((de=O.theme)==null?void 0:de.secondary)??"",colors:((Oe=O.theme)==null?void 0:Oe.colors)??[],logoHeaderBackground:void 0}}});return}K.startsWith("http://")||K.startsWith("https://")?Qj(K).then(O=>{S(O.pngDataUrl),s(G=>{var Y,de,Oe,He;return G&&{...G,theme:{...G.theme,primary:((Y=G.theme)==null?void 0:Y.primary)??"",secondary:((de=G.theme)==null?void 0:de.secondary)??"",colors:((Oe=G.theme)==null?void 0:Oe.colors)??[],logoHeaderBackground:((He=G.theme)==null?void 0:He.logoHeaderBackground)??O.backgroundHex}}})}).catch(()=>{S(K)}):S(K)},[]),R=K=>{var G;const q=(G=K.target.files)==null?void 0:G[0];if(!q)return;if(!q.type.startsWith("image/")){alert("אנא בחר קובץ תמונה בלבד");return}if(q.size>5*1024*1024){alert("קובץ התמונה גדול מדי. אנא בחר קובץ קטן מ-5MB");return}const O=new FileReader;O.onloadend=()=>{const Y=O.result;S(Y)},O.onerror=()=>{alert("שגיאה בקריאת הקובץ. אנא נסה שוב.")},O.readAsDataURL(q)},X=()=>{S(""),s(K=>{var q,O,G,Y;return(q=K==null?void 0:K.theme)!=null&&q.logoHeaderBackground?{...K,theme:{...K.theme,primary:((O=K.theme)==null?void 0:O.primary)??"",secondary:((G=K.theme)==null?void 0:G.secondary)??"",colors:((Y=K.theme)==null?void 0:Y.colors)??[],logoHeaderBackground:void 0}}:K}),k.current&&(k.current.value="")},Z=v.useCallback(()=>[...YO].sort(),[]),Q=v.useCallback(()=>[...ZO].sort(),[]);v.useEffect(()=>{g(Z()),y(Q())},[Z,Q]),v.useEffect(()=>{if(o!=null&&o.industry){const K=Z();K.includes(o.industry)||K.push(o.industry),g(K.sort())}},[o==null?void 0:o.industry,Z]),v.useEffect(()=>{if(o!=null&&o.business_tone){const K=Q();K.includes(o.business_tone)||K.push(o.business_tone),y(K.sort())}},[o==null?void 0:o.business_tone,Q]);const N=K=>!K||typeof K!="object"?!1:"business_name"in K||"industry"in K||"business_type"in K||"keywords"in K||"description"in K;v.useEffect(()=>{if(e&&N(e)&&e.logo){const K=e.logo;K.startsWith("http://")||K.startsWith("https://")?j(K):S(K)}else if(e&&"logo"in e&&e.logo){const K=e.logo;K.startsWith("http://")||K.startsWith("https://")?j(K):S(K)}},[e,j]),v.useEffect(()=>{!p&&o&&L(!0)},[p,o]),v.useEffect(()=>{(async()=>{var Oe,He,ue,we,Me,Je,Wt,$e;const q=t?js(t).replace(/\/$/,"").toLowerCase():"",O=t&&t.trim()!=="";if(w.current===q&&o!==null&&O){c(!1);return}if(V.current)return;if(!!!(e&&N(e))&&(z!=null&&z.businessData)&&(z!=null&&z.websiteUrl)){const De=tA(z.businessData);if(De){M(),s(De),c(!1),w.current="",z.logo&&(z.logo.startsWith("http://")||z.logo.startsWith("https://")?j(z.logo):S(z.logo));return}}if(O){const De=Array.isArray(r)?r.map(js):[];De.push(js(t));try{V.current=!0,c(!0),d(null);const Ye=await rx(t,De,"",l);let st=tA(Ye);const Xt=(Oe=e==null?void 0:e.theme)==null?void 0:Oe.logoHeaderBackground;if(st&&typeof Xt=="string"&&(st={...st,theme:{...st.theme,primary:((He=st.theme)==null?void 0:He.primary)??"",secondary:((ue=st.theme)==null?void 0:ue.secondary)??"",colors:Array.isArray((we=st.theme)==null?void 0:we.colors)?st.theme.colors:[],logoHeaderBackground:Xt}}),st){M(),s(st),w.current=q;const Re=Ye==null?void 0:Ye.logo;Re&&j(Re)}else d("שגיאה בעיבוד הנתונים שהתקבלו מהשרת")}catch(Ye){d(Ye instanceof Error?Ye.message:"שגיאה בטעינת הנתונים")}finally{c(!1),V.current=!1}return}if(e&&N(e)){const De=tA(e);if(De){M(),s(De),c(!1),w.current="";const Ye=e==null?void 0:e.logo;Ye&&(Ye.startsWith("http://")||Ye.startsWith("https://")?j(Ye):S(Ye));return}}const de=Array.isArray(r)?r.map(js):[];if(de.length===0){M(),s(HO(t)),c(!1),w.current="";return}try{V.current=!0,c(!0),d(null);const De=await rx(t,de,"",l);let Ye=tA(De);const st=(Me=e==null?void 0:e.theme)==null?void 0:Me.logoHeaderBackground;if(Ye&&typeof st=="string"&&(Ye={...Ye,theme:{...Ye.theme,primary:((Je=Ye.theme)==null?void 0:Je.primary)??"",secondary:((Wt=Ye.theme)==null?void 0:Wt.secondary)??"",colors:Array.isArray(($e=Ye.theme)==null?void 0:$e.colors)?Ye.theme.colors:[],logoHeaderBackground:st}}),Ye){M(),s(Ye),w.current="";const Xt=De==null?void 0:De.logo;Xt&&j(Xt)}else d("שגיאה בעיבוד הנתונים שהתקבלו מהשרת")}catch(De){d(De instanceof Error?De.message:"שגיאה בטעינת הנתונים")}finally{c(!1),V.current=!1}})()},[t,z]);const te=(K,q)=>{o&&s({...o,[K]:q})},se=(K,q,O)=>{o&&s({...o,[K]:{...o[K],[q]:O}})},ve=(K,q)=>{if(o){const O=o.theme||{primary:"",secondary:"",colors:[]};s({...o,theme:{...O,[K]:q}})}},We=K=>{if(!o)return;const q={primary:"",secondary:"",colors:[],...o.theme},O=Oe=>Oe.toLowerCase(),G=new Set(K.map(O)),Y=q.primary&&G.has(O(q.primary))?q.primary:"",de=q.secondary&&G.has(O(q.secondary))?q.secondary:"";s({...o,theme:{...q,primary:Y,secondary:de,colors:K}})},me=(K,q,O)=>{if(o)if(K==="description"){const Y=[...Array.isArray(o.description)?o.description:o.description?[o.description]:[""]];Y[q]=O,s({...o,description:Y})}else{const G=[...o[K]];G[q]=O,s({...o,[K]:G})}},ae=()=>{if(o){const K=[...o.business_type_options,""];s({...o,business_type_options:K})}},$=K=>{if(o){const q=o.business_type_options.filter((O,G)=>G!==K);s({...o,business_type_options:q})}},ye=()=>{if(o){const q=[...Array.isArray(o.description)?o.description:o.description?[o.description]:[""],""];s({...o,description:q})}},fe=K=>{if(o){const O=(Array.isArray(o.description)?o.description:o.description?[o.description]:[""]).filter((G,Y)=>Y!==K);s({...o,description:O.length>0?O:[""]})}},ge=()=>{if(o){const K={...o.socials};let q=1,O="social_media";for(;K[O];)O=`social_media_${q}`,q++;K[O]="",b.current.has(O)||b.current.set(O,`social-row-${B.current++}`),s({...o,socials:K})}},he=K=>{if(o){b.current.delete(K);const q={...o.socials};delete q[K],s({...o,socials:q})}},pe=(K,q)=>{if(o&&K!==q){const O={...o.socials},G=O[K]||"";delete O[K];const Y=q.trim(),de=b.current.get(K);de&&(b.current.delete(K),Y&&b.current.set(Y,de)),Y&&(O[Y]&&Y!==K?O[Y]=G||O[Y]:O[Y]=G),s({...o,socials:O})}},Ne=(K,q)=>{if(o){const O={...o.socials};O[K]=q,s({...o,socials:O})}},ne=async()=>{var we,Me,Je,Wt;if(!o)return;const K=(t==null?void 0:t.trim())||((we=o.website)==null?void 0:we.trim())||"";let q=!1;(Me=o.website)!=null&&Me.trim()||(q=!1);const O=E||"",G=O.startsWith("data:image/"),Y=(Je=o==null?void 0:o.theme)==null?void 0:Je.logoHeaderBackground,de=Y&&/^#(000|000000)$/i.test(String(Y).trim()),Oe=Y&&!de?Y:Y&&de?"white":void 0,He=(Wt=o==null?void 0:o.theme)!=null&&Wt.logoHeaderBackground&&/^#(000|000000)$/i.test(String(o.theme.logoHeaderBackground).trim())?{...o,theme:{...o.theme,logoHeaderBackground:"white"}}:o;if(!He.business_name){x("שם העסק הוא שדה חובה"),W(!1);return}const ue={businessData:He,logo:O,websiteUrl:K,...Oe?{logoBackgroundHex:Oe}:{}};G&&(ue.logoToUpload=O),W(!0),x(null);try{const $e={...He};delete $e._id,delete $e.__v,$e.business_address!==void 0&&($e.address=$e.business_address),Array.isArray($e.description)&&($e.description=$e.description.filter(Boolean).join(`
520
520
  `)||""),q&&await Mj(K,$e)}catch($e){const De=$e instanceof Error?$e.message:String($e);if(De.includes("404")||De.includes("not found"))console.warn("Business analysis not in DB, saving to context only:",De);else{console.error("Failed to save business analysis:",De),x(`שמירה נכשלה: ${De}`),W(!1);return}}W(!1),a(ue),i&&i.triggerEvent("onDataComplete",ue),window.dispatchEvent(new CustomEvent("business-analysis-saved",{detail:o,bubbles:!0,composed:!0})),n(2)};if(p)return A.jsx(P,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:{xs:2,sm:3,md:5},minHeight:{xs:"300px",sm:"350px",md:"400px"}},children:A.jsx(DO,{text:"Analyzing",showSkeletons:!0})});if(u)return A.jsxs(P,{sx:{padding:{xs:2,sm:3,md:5},width:{xs:"100%",sm:"500px"},maxWidth:"100%",boxSizing:"border-box"},children:[A.jsx(Ml,{severity:"error",sx:{fontSize:{xs:"0.875rem",sm:"1rem"}},children:u}),A.jsx(ze,{variant:"text",color:"primary",onClick:()=>n(T),sx:{mt:2,fontSize:{xs:"0.875rem",sm:"1rem"}},children:"חזרה"})]});if(!o)return null;const qe=(t==null?void 0:t.trim())||(e&&typeof e=="object"&&"websiteUrl"in e?(Qe=e.websiteUrl)==null?void 0:Qe.trim():"")||((be=o==null?void 0:o.website)==null?void 0:be.trim())||"";return A.jsxs(P,{sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0,height:"100%",width:"100%",maxWidth:"100%",boxSizing:"border-box",overflow:"hidden"},children:[A.jsxs(P,{sx:{flex:1,minHeight:0,height:"100%",maxHeight:"calc(90vh - 140px)",overflowY:"auto",overflowX:"hidden",padding:{xs:2,sm:3,md:5},paddingBottom:{xs:1,sm:1.5,md:2},WebkitOverflowScrolling:"touch"},children:[qe&&A.jsx(P,{className:J?_i.fadeUp:"",sx:{mb:{xs:2,sm:2.5},mt:{xs:.5,sm:1}},children:A.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:1.25,px:{xs:1.5,sm:2},py:{xs:1,sm:1.125},borderRadius:2,border:"1px solid",borderColor:"divider",maxWidth:"100%",overflow:"hidden",bgcolor:K=>un(K.palette.primary.main,.06)},children:[A.jsx(ux,{sx:{fontSize:{xs:"1.125rem",sm:"1.25rem"},color:"text.secondary",flexShrink:0,opacity:.85}}),A.jsx(Ae,{variant:"body2",sx:{fontSize:{xs:"0.8125rem",sm:"0.875rem"},color:"text.primary",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",flex:1,direction:"ltr",textAlign:"left",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',fontWeight:500},children:js(qe)})]})}),A.jsxs(P,{className:J?_i.fadeUp:"",sx:{mb:{xs:2.5,sm:3}},children:[A.jsx(Ae,{component:"h1",variant:"h4",sx:{mt:qe?{xs:1.5,sm:2}:{xs:4,sm:4},fontSize:{xs:"1.5rem",sm:"1.875rem",md:"2rem"},fontWeight:700,letterSpacing:"-0.025em",lineHeight:1.2,color:"text.primary"},children:"עריכת פרטי העסק"}),A.jsx(Ae,{variant:"body2",className:J?_i.fadeUpDelay1:"",color:"text.secondary",sx:{mt:{xs:.75,sm:1},fontSize:{xs:"0.875rem",sm:"0.9375rem"},maxWidth:"min(48ch, 100%)",lineHeight:1.55},children:"עברו על השדות, עדכנו מה שצריך, והמשיכו לשלב הבא."})]}),A.jsx(P,{className:J?_i.fadeUpDelay2:"",children:A.jsxs(va,{title:"לוגו",description:"מומלץ קובץ שקוף או רקע בהיר. אפשר לדלג אם אין לוגו מעודכן.",children:[A.jsx("input",{ref:k,type:"file",accept:"image/*",onChange:R,style:{display:"none"},id:"logo-upload-input"}),E?A.jsxs(P,{sx:{p:{xs:1.5,sm:2,md:2.5},border:"1px dashed",borderColor:"divider",borderRadius:2,bgcolor:K=>un(K.palette.common.black,.02),transition:"border-color 0.2s ease, background-color 0.2s ease",mb:{xs:1.5,sm:2},"&:hover":{borderColor:"text.secondary",bgcolor:K=>un(K.palette.common.black,.035)}},children:[A.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:{xs:1,sm:1.5,md:2},mb:{xs:1.5,sm:2},flexDirection:{xs:"column",sm:"row"}},children:[A.jsx(Wa,{size:"small",color:"error",onClick:X,sx:{border:"1px solid rgba(211, 47, 47, 0.3)",alignSelf:{xs:"flex-start",sm:"auto"},"&:hover":{backgroundColor:"rgba(211, 47, 47, 0.08)",borderColor:"rgba(211, 47, 47, 0.5)"}},"aria-label":"הסר לוגו",children:A.jsx(Qs,{fontSize:"small"})}),A.jsx(P,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",minHeight:{xs:"80px",sm:"90px",md:"100px"},backgroundColor:(()=>{var O;const K=((O=o==null?void 0:o.theme)==null?void 0:O.logoHeaderBackground)??"white";return/^#(000|000000)$/i.test(K.trim())||/^rgb\s*\(\s*0\s*,\s*0\s*,\s*0\s*\)$/i.test(K.trim())?"white":K})(),borderRadius:1,border:"1px solid rgba(0, 0, 0, 0.08)",p:{xs:.5,sm:1},width:{xs:"100%",sm:"auto"}},children:A.jsx("img",{src:E,alt:"Logo preview",style:{maxWidth:"100%",maxHeight:"100px",objectFit:"contain"}})})]}),A.jsx("label",{htmlFor:"logo-upload-input",children:A.jsx(ze,{variant:"outlined",component:"span",startIcon:A.jsx(px,{}),fullWidth:!0,sx:{textTransform:"none",borderRadius:{xs:1.5,sm:2},fontSize:{xs:"0.875rem",sm:"1rem"}},children:"החלף לוגו"})})]}):A.jsxs(P,{sx:{border:"1px dashed",borderColor:"divider",borderRadius:2,p:{xs:2,sm:2.5,md:3},textAlign:"center",bgcolor:K=>un(K.palette.common.black,.02),transition:"border-color 0.2s ease, background-color 0.2s ease","&:hover":{borderColor:"text.secondary",bgcolor:K=>un(K.palette.common.black,.035)}},children:[A.jsx("label",{htmlFor:"logo-upload-input",children:A.jsx(ze,{variant:"outlined",component:"span",startIcon:A.jsx(sx,{}),sx:{textTransform:"none",borderRadius:{xs:1.5,sm:2},px:{xs:2,sm:2.5,md:3},py:{xs:.75,sm:1},fontSize:{xs:"0.875rem",sm:"1rem"}},children:"העלה לוגו"})}),A.jsx(Ae,{variant:"caption",color:"text.secondary",sx:{mt:{xs:1,sm:1.5},display:"block",fontSize:{xs:"0.7rem",sm:"0.75rem"}},children:"תמונות PNG, JPG או SVG עד 5MB"})]})]})}),A.jsxs(ct,{spacing:0,className:J?_i.fadeUpDelay3:"",children:[A.jsx(va,{title:"פרטי העסק",description:"שם, תעשייה, כתובת והגדרות סוג עסק — משמשים לנתח ולייצר תוצרים מדויקים יותר.",children:A.jsxs(At,{container:!0,spacing:{xs:2,sm:2.5,md:3},children:[A.jsx(At,{item:!0,xs:12,md:6,children:A.jsx(rt,{fullWidth:!0,label:"שם העסק",value:o.business_name,onChange:K=>te("business_name",K.target.value),variant:"outlined",margin:"normal"})}),A.jsxs(At,{item:!0,xs:12,md:6,children:[A.jsx(rt,{fullWidth:!0,label:"שם בעל.ת העסק (מלא)",value:o.owner,onChange:K=>te("owner",K.target.value),variant:"outlined",margin:"normal"}),A.jsxs($z,{row:!0,value:o.owner_gender??"",onChange:K=>te("owner_gender",K.target.value),sx:{mt:.5,gap:{xs:.5,sm:1},"& .MuiFormControlLabel-root":{mr:0}},children:[A.jsx(Oc,{value:"male",control:A.jsx(Wg,{size:"small"}),label:A.jsxs(P,{component:"span",sx:{display:"flex",alignItems:"center",gap:.5},children:[A.jsx(cx,{fontSize:"small"}),A.jsx("span",{children:"זכר"})]}),labelPlacement:"end"}),A.jsx(Oc,{value:"female",control:A.jsx(Wg,{size:"small"}),label:A.jsxs(P,{component:"span",sx:{display:"flex",alignItems:"center",gap:.5},children:[A.jsx(Ax,{fontSize:"small"}),A.jsx("span",{children:"נקבה"})]}),labelPlacement:"end"}),A.jsx(Oc,{value:"other",control:A.jsx(Wg,{size:"small"}),label:A.jsxs(P,{component:"span",sx:{display:"flex",alignItems:"center",gap:.5},children:[A.jsx(dx,{fontSize:"small"}),A.jsx("span",{children:"אחר"})]}),labelPlacement:"end"})]})]}),A.jsx(At,{item:!0,xs:12,md:6,children:A.jsx($W,{freeSolo:!0,options:h,value:o.industry||"",onChange:(K,q)=>{te("industry",q||"")},onInputChange:(K,q)=>{te("industry",q)},inputValue:o.industry||"",openOnFocus:!0,disablePortal:!0,componentsProps:{popper:{container:(U==null?void 0:U.getElementById("cdtr-business-ai-root"))||void 0,style:{zIndex:9999},modifiers:[{name:"offset",options:{offset:[0,4]}}]}},ListboxProps:{sx:{maxHeight:"300px","& .MuiAutocomplete-option":{padding:"8px 16px","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"},"&[aria-selected='true']":{backgroundColor:"rgba(0, 0, 0, 0.08)"}}}},PaperComponent:({children:K,...q})=>A.jsx(P,{...q,sx:{borderRadius:"4px",border:"1px solid rgba(0, 0, 0, 0.1)",marginTop:"4px",backgroundColor:"white"},children:K}),renderInput:K=>A.jsx(rt,{...K,label:"תעשייה",variant:"outlined",margin:"normal"}),noOptionsText:h.length===0?"הקלד תעשייה":"אין אפשרויות"})}),A.jsx(At,{item:!0,xs:12,md:6,children:A.jsx(rt,{fullWidth:!0,label:"סוג עסק",value:o.business_type,onChange:K=>te("business_type",K.target.value),variant:"outlined",margin:"normal"})}),A.jsx(At,{item:!0,xs:12,md:6,children:A.jsx(rt,{fullWidth:!0,label:"כתובת העסק",value:o.business_address??"",onChange:K=>te("business_address",K.target.value),variant:"outlined",margin:"normal"})}),A.jsxs(At,{item:!0,xs:12,children:[A.jsx(Ae,{variant:"subtitle2",sx:{mb:{xs:.75,sm:1},fontSize:{xs:"0.875rem",sm:"1rem"}},children:"אפשרויות סוג עסק"}),(Array.isArray(o.business_type_options)?o.business_type_options:[]).map((K,q)=>A.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:1,mb:1},children:[A.jsx(rt,{fullWidth:!0,value:K,onChange:O=>me("business_type_options",q,O.target.value),variant:"outlined",margin:"normal",size:"small"}),A.jsx(Wa,{color:"error",onClick:()=>$(q),sx:{mt:1},"aria-label":"הסר אפשרות",children:A.jsx(Qs,{})})]},q)),A.jsx(ze,{variant:"outlined",startIcon:A.jsx(Fl,{}),onClick:ae,sx:{mt:1},children:"הוספת אפשרות"})]}),A.jsx(At,{item:!0,xs:12,children:A.jsx(rO,{value:o.keywords,onChange:K=>te("keywords",K)})})]})}),A.jsx(er,{sx:{my:{xs:1.5,sm:2},borderColor:"divider"}}),A.jsx(va,{title:"צבעי מותג",description:"גררו צבעים או עדכנו ראשי ומשני — משפיעים על תצוגת המותג בחוויה.",children:A.jsx(TO,{colors:((je=o.theme)==null?void 0:je.colors)??[],primary:((Ke=o.theme)==null?void 0:Ke.primary)||"",secondary:((Ue=o.theme)==null?void 0:Ue.secondary)||"",onPrimaryChange:K=>ve("primary",K),onSecondaryChange:K=>ve("secondary",K),onColorsChange:We})}),A.jsx(er,{sx:{my:{xs:1.5,sm:2},borderColor:"divider"}}),A.jsx(va,{title:"טון ותוכן",description:"איך העסק נשמע, תיאור קצר וכתובת האתר לעדכון.",children:A.jsxs(At,{container:!0,spacing:{xs:2,sm:2.5,md:3},children:[A.jsx(At,{item:!0,xs:12,md:6,children:A.jsx($W,{freeSolo:!0,options:C,value:o.business_tone||"",onChange:(K,q)=>{te("business_tone",q||"")},onInputChange:(K,q)=>{te("business_tone",q)},inputValue:o.business_tone||"",openOnFocus:!0,disablePortal:!0,componentsProps:{popper:{container:(U==null?void 0:U.getElementById("cdtr-business-ai-root"))||void 0,style:{zIndex:9999},modifiers:[{name:"offset",options:{offset:[0,4]}}]}},ListboxProps:{sx:{maxHeight:"300px","& .MuiAutocomplete-option":{padding:"8px 16px","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"},"&[aria-selected='true']":{backgroundColor:"rgba(0, 0, 0, 0.08)"}}}},PaperComponent:({children:K,...q})=>A.jsx(P,{...q,sx:{borderRadius:"4px",border:"1px solid rgba(0, 0, 0, 0.1)",marginTop:"4px",backgroundColor:"white"},children:K}),renderInput:K=>A.jsx(rt,{...K,label:"טון עסקי",variant:"outlined",margin:"normal"}),noOptionsText:C.length===0?"הקלד טון עסקי":"אין אפשרויות"})}),A.jsxs(At,{item:!0,xs:12,children:[A.jsx(Ae,{variant:"subtitle2",sx:{mb:{xs:.75,sm:1},fontSize:{xs:"0.875rem",sm:"1rem"}},children:"תיאור"}),(Array.isArray(o.description)?o.description:o.description?[o.description]:[""]).map((K,q)=>A.jsxs(P,{sx:{display:"flex",alignItems:"flex-start",gap:1,mb:1},children:[A.jsx(rt,{fullWidth:!0,value:K,onChange:O=>me("description",q,O.target.value),variant:"outlined",margin:"normal",multiline:!0,rows:3,size:"small"}),A.jsx(Wa,{color:"error",onClick:()=>fe(q),sx:{mt:1},"aria-label":"הסר תיאור",children:A.jsx(Qs,{})})]},q)),A.jsx(ze,{variant:"outlined",startIcon:A.jsx(Fl,{}),onClick:ye,sx:{mt:1},children:"הוספת תיאור"})]}),A.jsx(At,{item:!0,xs:12,md:6,children:A.jsx(rt,{fullWidth:!0,label:"אתר אינטרנט",value:o.website,onChange:K=>te("website",K.target.value),variant:"outlined",margin:"normal"})})]})}),A.jsx(er,{sx:{my:{xs:1.5,sm:2},borderColor:"divider"}}),A.jsxs(va,{title:"קשר ורשתות",description:"אימייל וטלפון ליצירת קשר, וקישורים לפרופילים ציבוריים.",children:[A.jsxs(At,{container:!0,spacing:{xs:1.5,sm:2},children:[A.jsx(At,{item:!0,xs:12,md:6,children:A.jsx(rt,{fullWidth:!0,label:"אימייל",value:o.contacts.email,onChange:K=>se("contacts","email",K.target.value),variant:"outlined",margin:"normal"})}),A.jsx(At,{item:!0,xs:12,md:6,children:A.jsx(rt,{fullWidth:!0,label:"טלפון",value:o.contacts.phone,onChange:K=>se("contacts","phone",K.target.value),variant:"outlined",margin:"normal"})})]}),A.jsxs(P,{sx:{mt:{xs:2,sm:2.5},p:{xs:1.5,sm:2},borderRadius:2,border:"1px solid",borderColor:"divider",bgcolor:K=>un(K.palette.common.black,.02)},children:[Object.entries(o.socials).map(([K,q])=>A.jsx(GO,{platform:K,url:q,onPlatformCommit:pe,onUrlChange:Ne,onRemove:he},F(K))),A.jsx(ze,{variant:"outlined",startIcon:A.jsx(Fl,{}),onClick:ge,sx:{mt:1,textTransform:"none"},children:"הוספת רשת חברתית"})]})]})]})]}),A.jsxs(P,{className:J?_i.fadeUpDelay4:"",sx:{position:"fixed",bottom:0,left:0,right:0,zIndex:10,padding:{xs:1,sm:1,md:1},paddingTop:{xs:1,sm:1,md:1},backgroundColor:"background.default",borderTop:"1px solid",borderColor:"divider"},children:[m&&A.jsx(Ml,{severity:"error",sx:{mb:1},onClose:()=>x(null),children:m}),A.jsxs(At,{container:!0,spacing:{xs:1,sm:2},sx:{justifyContent:{xs:"center",sm:"space-between"}},children:[A.jsx(At,{item:!0,xs:12,sm:"auto",children:A.jsx(ze,{variant:"text",color:"primary",onClick:()=>n(T),fullWidth:!0,sx:{fontSize:{xs:"0.875rem",sm:"1rem"},maxWidth:{xs:"100%",sm:"auto"}},children:"חזרה"})}),A.jsx(At,{item:!0,xs:12,sm:"auto",children:A.jsx(ze,{variant:"contained",color:"primary",onClick:ne,disabled:f,fullWidth:!0,startIcon:f?A.jsx(Qa,{size:18,color:"inherit"}):null,sx:{fontSize:{xs:"0.875rem",sm:"1rem"},maxWidth:{xs:"100%",sm:"auto"},minWidth:120},children:f?"שומר...":"שלב הבא"})})]})]})]})}const _O=an(A.jsx("path",{d:"M20.97 7.27c.39-.39.39-1.02 0-1.41l-2.83-2.83a.9959.9959 0 0 0-1.41 0l-4.49 4.49-3.89-3.89c-.78-.78-2.05-.78-2.83 0l-1.9 1.9c-.78.78-.78 2.05 0 2.83l3.89 3.89L3 16.76V21h4.24l4.52-4.52 3.89 3.89c.95.95 2.23.6 2.83 0l1.9-1.9c.78-.78.78-2.05 0-2.83l-3.89-3.89zM5.04 6.94l1.89-1.9L8.2 6.31 7.02 7.5l1.41 1.41 1.19-1.19 1.2 1.2-1.9 1.9zm11.23 7.44-1.19 1.19 1.41 1.41 1.19-1.19 1.27 1.27-1.9 1.9-3.89-3.89 1.9-1.9zM6.41 19H5v-1.41l9.61-9.61 1.3 1.3.11.11zm9.61-12.44 1.41-1.41 1.41 1.41-1.41 1.41z"}),"DesignServicesOutlined");var mh={},$O=Fe;Object.defineProperty(mh,"__esModule",{value:!0});var $x=mh.default=void 0,eK=$O(Te()),tK=A;$x=mh.default=(0,eK.default)((0,tK.jsx)("path",{d:"m19 9 1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25zm0 6-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25zm-7.5-5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12zm-1.51 3.49L9 15.17l-.99-2.18L5.83 12l2.18-.99L9 8.83l.99 2.18 2.18.99z"}),"AutoAwesomeOutlined");var Ch={},nK=Fe;Object.defineProperty(Ch,"__esModule",{value:!0});var eE=Ch.default=void 0,aK=nK(Te()),vh=A;eE=Ch.default=(0,aK.default)([(0,vh.jsx)("path",{d:"M18 10.48V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4.48l4 3.98v-11zm-2-.79V18H4V6h12z"},"0"),(0,vh.jsx)("circle",{cx:"10",cy:"10",r:"2"},"1"),(0,vh.jsx)("path",{d:"M14 15.43c0-.81-.48-1.53-1.22-1.85-.85-.37-1.79-.58-2.78-.58-.99 0-1.93.21-2.78.58C6.48 13.9 6 14.62 6 15.43V16h8z"},"2")],"VideoCameraFrontOutlined");var yh={},rK=Fe;Object.defineProperty(yh,"__esModule",{value:!0});var Sh=yh.default=void 0,lK=rK(Te()),iK=A;Sh=yh.default=(0,lK.default)((0,iK.jsx)("path",{d:"M21 11.01 3 11v2h18zM3 16h12v2H3zM21 6H3v2.01L21 8z"}),"NotesOutlined");var Ih={},oK=Fe;Object.defineProperty(Ih,"__esModule",{value:!0});var tE=Ih.default=void 0,sK=oK(Te()),pK=A;tE=Ih.default=(0,sK.default)((0,pK.jsx)("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 9H9V9h10zm-4 4H9v-2h6zm4-8H9V5h10z"}),"LibraryBooks");var xh={},uK=Fe;Object.defineProperty(xh,"__esModule",{value:!0});var nE=xh.default=void 0,cK=uK(Te()),AK=A;nE=xh.default=(0,cK.default)((0,AK.jsx)("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Edit");var Eh={},dK=Fe;Object.defineProperty(Eh,"__esModule",{value:!0});var aE=Eh.default=void 0,fK=dK(Te()),WK=A;aE=Eh.default=(0,fK.default)((0,WK.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const rE=[{id:"authentic_text",label:"טקסט אישי",questions:[{id:"topic",label:"נושא / תיאור קצר",inputType:"multiline"}]},{id:"webinar",label:"וובינר",questions:[{id:"date",label:"תאריך",inputType:"date"},{id:"time",label:"שעה",inputType:"time"},{id:"topic",label:"נושא / תיאור",inputType:"multiline"}]},{id:"designed_mail",label:"מעוצב (מצב מהיר)",questions:[{id:"topic",label:"נושא / תיאור קצר",inputType:"multiline"}]},{id:"designed_mail_advanced",comingSoon:!0,label:"מעצב פרו (סטודיו)",questions:[{id:"topic",label:"נושא / תיאור קצר",inputType:"multiline"}]}];function lE(e){return rE.find(t=>t.id===e)}function bh(e){return e==="other"}function iE(e,t,n){if(e==="other"&&n!=null){const l=n.trim();return l?l+(l.endsWith(".")?"":"."):"אני רוצה לבנות מייל."}const a=lE(e);if(!a)return"";const r=[];if(e==="webinar"){const l=t.date||"",i=t.time||"",o=t.topic||"";return r.push("אני רוצה לבנות מייל לוובינר"),(l||i)&&r.push(`בתאריך ${l}${i?` בשעה ${i}`:""}`),o&&r.push(`, ${o}`),r.join(" ")+"."}if(e==="designed_mail"){const l=t.topic||"";return l?`אני רוצה לבנות מייל מעוצב: ${l}.`:"אני רוצה לבנות מייל מעוצב."}if(e==="authentic_text"){const l=t.topic||"";return l?`אני רוצה לבנות מייל בטקסט אישי: ${l}.`:"אני רוצה לבנות מייל בטקסט אישי."}return a.label?`אני רוצה לבנות מייל מסוג ${a.label}.`:""}var kh={},gK=Fe;Object.defineProperty(kh,"__esModule",{value:!0});var nA=kh.default=void 0,hK=gK(Te()),mK=A;nA=kh.default=(0,hK.default)((0,mK.jsx)("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"}),"TextFields");var Rh={},CK=Fe;Object.defineProperty(Rh,"__esModule",{value:!0});var Ts=Rh.default=void 0,vK=CK(Te()),yK=A;Ts=Rh.default=(0,vK.default)((0,yK.jsx)("path",{d:"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11"}),"Extension");const oE=["newsletter.loadingSteps.building","newsletter.loadingSteps.searchingImages","newsletter.loadingSteps.choosingIcons","newsletter.loadingSteps.analyzing"],wh=["https://images.pexels.com/photos/3184292/pexels-photo-3184292.jpeg?auto=compress&cs=tinysrgb&w=200","https://images.pexels.com/photos/2762247/pexels-photo-2762247.jpeg?auto=compress&cs=tinysrgb&w=200","https://images.pexels.com/photos/267350/pexels-photo-267350.jpeg?auto=compress&cs=tinysrgb&w=200"],SK={"@keyframes sceneIn":{"0%":{opacity:0,transform:"scale(0.94)"},"100%":{opacity:1,transform:"scale(1)"}},"@keyframes blockDrop":{"0%":{transform:"translate(-10px, -16px)",opacity:.5},"100%":{transform:"translate(0, 0)",opacity:1}},"@keyframes blockFloat":{"0%, 100%":{transform:"translate(0, 0)"},"50%":{transform:"translate(3px, -2px)"}}},Qn={animation:"blockDrop 0.5s ease-out both, blockFloat 2.2s ease-in-out 0.6s infinite",borderRadius:2,border:"1px solid rgba(0, 0, 0, 0.08)",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},sE={background:`linear-gradient(135deg, ${eA}61 0%, ${hh}61 100%)`};function IK(){return A.jsxs(P,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:1.5},children:[A.jsx(P,{className:"block",sx:{...Qn,width:110,height:26,background:$n,color:"primary.contrastText"},children:A.jsx(nA,{sx:{fontSize:16}})}),A.jsx(P,{className:"block",sx:{...Qn,width:130,height:72},children:A.jsx("img",{src:wh[0],alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}})}),A.jsxs(P,{sx:{display:"flex",gap:1},children:[A.jsx(P,{className:"block",sx:{...Qn,width:36,height:36,bgcolor:"secondary.main",color:"secondary.contrastText"},children:A.jsx(Ts,{sx:{fontSize:20}})}),A.jsx(P,{className:"block",sx:{...Qn,width:44,height:36,...sE}})]})]})}function xK(){return A.jsxs(P,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:1.5},children:[A.jsx(P,{className:"block",sx:{...Qn,width:130,height:68},children:A.jsx("img",{src:wh[1],alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}})}),A.jsxs(P,{sx:{display:"flex",gap:1},children:[A.jsx(P,{className:"block",sx:{...Qn,width:100,height:24,background:$n,color:"primary.contrastText"},children:A.jsx(nA,{sx:{fontSize:14}})}),A.jsx(P,{className:"block",sx:{...Qn,width:36,height:36,bgcolor:"secondary.main",color:"secondary.contrastText"},children:A.jsx(Ts,{sx:{fontSize:20}})})]}),A.jsx(P,{className:"block",sx:{...Qn,width:90,height:32,bgcolor:"grey.300"}})]})}function EK(){return A.jsxs(P,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:1.5},children:[A.jsxs(P,{sx:{display:"flex",gap:1},children:[A.jsx(P,{className:"block",sx:{...Qn,width:38,height:38,background:$n,color:"primary.contrastText"},children:A.jsx(Ts,{sx:{fontSize:22}})}),A.jsx(P,{className:"block",sx:{...Qn,width:50,height:38,...sE}}),A.jsx(P,{className:"block",sx:{...Qn,width:38,height:38,bgcolor:"secondary.main",color:"secondary.contrastText"},children:A.jsx(Ts,{sx:{fontSize:20}})})]}),A.jsx(P,{className:"block",sx:{...Qn,width:120,height:70},children:A.jsx("img",{src:wh[2],alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}})}),A.jsx(P,{className:"block",sx:{...Qn,width:100,height:22,background:$n,color:"primary.contrastText"},children:A.jsx(nA,{sx:{fontSize:14}})})]})}const pE=[IK,xK,EK];function bK(e){const{t}=Nn(),[n,a]=v.useState(0),[r,l]=v.useState(0);v.useEffect(()=>{const o=setInterval(()=>{a(s=>(s+1)%oE.length)},2500);return()=>clearInterval(o)},[]),v.useEffect(()=>{const o=setInterval(()=>{l(s=>(s+1)%pE.length)},3200);return()=>clearInterval(o)},[]);const i=pE[r];return A.jsxs(P,{sx:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:2,paddingTop:4,...SK},children:[A.jsx(P,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:1.5,mb:3,minHeight:180,"& .block":Qn,"& .block:nth-of-type(1)":{animationDelay:"0s, 0.6s"},"& .block:nth-of-type(2)":{animationDelay:"0.12s, 0.72s"},"& .block:nth-of-type(3)":{animationDelay:"0.24s, 0.84s"},"& .block:nth-of-type(4)":{animationDelay:"0.36s, 0.96s"},"& .block:nth-of-type(5)":{animationDelay:"0.48s, 1.08s"},"& .block:nth-of-type(6)":{animationDelay:"0.6s, 1.2s"}},children:A.jsx(P,{sx:{animation:"sceneIn 0.4s ease-out"},children:A.jsx(i,{})},r)}),A.jsx(P,{sx:{display:"flex",gap:.75,mb:1.5},children:[0,1,2,3].map(o=>A.jsx(P,{sx:{width:10,height:10,borderRadius:"50%",...o<=n?{background:$n}:{bgcolor:"action.hover"},opacity:o===n?1:o<n?.8:.4,transition:"opacity 0.3s ease, background-color 0.3s ease"}},o))}),A.jsx(Ae,{variant:"body1",sx:{fontWeight:500,color:"text.secondary"},children:t(oE[n])})]})}const uE={IL:"Israel",US:"United States",CA:"Canada",GB:"United Kingdom",UK:"United Kingdom",AU:"Australia",DE:"Germany",FR:"France",ES:"Spain",IT:"Italy",NL:"Netherlands",BR:"Brazil",MX:"Mexico",AR:"Argentina",RU:"Russia",JP:"Japan",CN:"China",IN:"India",ZA:"South Africa",AE:"United Arab Emirates",SA:"Saudi Arabia",PL:"Poland",SE:"Sweden",NO:"Norway",DK:"Denmark",FI:"Finland",CH:"Switzerland",AT:"Austria",BE:"Belgium",PT:"Portugal",GR:"Greece",TR:"Turkey",KR:"South Korea",SG:"Singapore",HK:"Hong Kong",TW:"Taiwan",NZ:"New Zealand",IE:"Ireland"},kK={"Asia/Jerusalem":"Israel","America/New_York":"United States","America/Los_Angeles":"United States","America/Chicago":"United States","America/Toronto":"Canada","America/Vancouver":"Canada","Europe/London":"United Kingdom","Europe/Paris":"France","Europe/Berlin":"Germany","Europe/Madrid":"Spain","Europe/Rome":"Italy","Europe/Amsterdam":"Netherlands","Australia/Sydney":"Australia","Australia/Melbourne":"Australia","Asia/Tokyo":"Japan","Asia/Shanghai":"China","Asia/Dubai":"United Arab Emirates","America/Sao_Paulo":"Brazil","America/Mexico_City":"Mexico"};function RK(){if(typeof navigator>"u")return null;try{const e=navigator,t=[navigator.language,...e.languages??[]].filter(Boolean);for(const n of t){if(!n)continue;const a=new Intl.Locale(n).region;if(a&&uE[a])return uE[a];if(n.startsWith("he")&&!a)return"Israel"}}catch{}try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;if(e){const t=kK[e];if(t)return t;if(e.split("/")[0]==="Asia"&&e.includes("Jerusalem"))return"Israel"}}catch{}return null}const wK={authentic_text:Sh,webinar:eE,designed_mail:$x,designed_mail_advanced:_O};function Bh({header:e,children:t,footer:n,compactBody:a}){return A.jsxs(P,{sx:{flex:"1 1 0%",minHeight:0,display:"flex",flexDirection:"column",bgcolor:"background.paper"},children:[A.jsx(P,{sx:{flexShrink:0,pt:{xs:6,sm:7},px:2.5,pb:2,borderBottom:"1px solid",borderColor:"divider"},children:e}),a?A.jsx(P,{sx:{flex:1,minHeight:0}}):A.jsx(P,{sx:{flex:1,minHeight:0,overflow:"auto",px:2.5,py:2,WebkitOverflowScrolling:"touch"},children:t}),n?A.jsx(P,{sx:{flexShrink:0,px:2.5,py:2,borderTop:"1px solid",borderColor:"divider",bgcolor:"background.paper"},children:n}):null]})}function BK({domain:e,mergeTags:t=[],visibilityRules:n,location:a,onResult:r,result:l,language:i,context:o,onSeriesClick:s}){const{t:p}=Nn(),c=Ni(),{step3Draft:u,setStep3Draft:d}=ax(),[f,W]=v.useState(0),[m,x]=v.useState(null),[h,g]=v.useState({}),[C,y]=v.useState(""),[E,S]=v.useState(!1),[k,w]=v.useState(null),V=m?lE(m):null,b=(V==null?void 0:V.questions)??[],B=a&&a.trim()||RK()||void 0,M=Z=>{x(Z),g({}),W(1)},F=(Z,Q)=>{g(N=>({...N,[Z]:Q}))},U=async()=>{if(C.trim()){S(!0),w(null);try{const Z=iE("other",{},C),Q=await kg({prompt:Z,domain:e,mergeTags:t,structureUrl:"",textStyleUrl:"",...n&&Object.keys(n).length>0?{visibilityRules:n}:{},...i?{language:i}:{},...B?{location:B}:{},...o?{context:o}:{}});r(Q)}catch(Z){console.error("Newsletter generation failed:",Z),w(p("common.errorGeneric"))}finally{S(!1)}}},T=async(Z,Q)=>{S(!0),w(null);try{const N=await kg({prompt:Z,domain:e,mergeTags:t,structureUrl:"",textStyleUrl:Q,...n&&Object.keys(n).length>0?{visibilityRules:n}:{},...i?{language:i}:{},...B?{location:B}:{},...o?{context:o}:{}});r(N)}catch(N){console.error("Newsletter generation failed:",N),w(p("common.errorGeneric"))}finally{S(!1)}},z=()=>{const Z=iE(m,h);Z&&T(Z,"")},J=()=>{if(c&&l){const Z=(u==null?void 0:u.components)??l.components??l.template,Q={...l,components:Z,template:Z};try{c.triggerEvent("onEditPage",Q),d(null)}catch{}}},L=()=>{r(null),W(0),x(null),g({}),y(""),w(null)},j=()=>{W(0),x(null),g({}),y("")};if(l&&l.components)return A.jsx(Bh,{compactBody:!0,header:A.jsxs(ct,{spacing:1,children:[A.jsx(Ae,{variant:"h6",component:"h1",sx:{fontWeight:700,letterSpacing:"-0.02em",lineHeight:1.35},children:p("newsletter.successHeading")}),A.jsx(Ae,{variant:"body2",color:"text.secondary",sx:{lineHeight:1.55},children:p("newsletter.successMessage")})]}),footer:A.jsxs(ct,{direction:"row",flexWrap:"wrap",gap:1.5,justifyContent:"flex-start",children:[A.jsx(ze,{variant:"contained",color:"primary",startIcon:A.jsx(nE,{}),onClick:J,sx:{textTransform:"none"},children:p("newsletter.editDesign")}),A.jsx(ze,{variant:"outlined",color:"primary",startIcon:A.jsx(aE,{}),onClick:L,sx:{textTransform:"none"},children:p("newsletter.startOver")})]})});if(E)return A.jsx(P,{sx:{height:"100%",minHeight:0,overflow:"auto"},children:A.jsx(bK,{language:i})});const R=f!==1||!m?"":bh(m)?p("newsletter.tellUs"):V?p(`newsletter.types.${V.id}`):"";if(f===0)return A.jsxs(Bh,{header:A.jsxs(ct,{spacing:1,children:[A.jsx("br",{}),A.jsx("br",{}),A.jsx(Ae,{component:"h1",variant:"h6",sx:{fontWeight:700,letterSpacing:"-0.02em",lineHeight:1.35,color:"text.primary"},children:p("newsletter.whatType")}),A.jsx(Ae,{variant:"body2",color:"text.secondary",sx:{fontSize:"0.8125rem",lineHeight:1.55,maxWidth:"52ch"},children:p("newsletter.typeSectionHint")})]}),children:[A.jsxs(ct,{spacing:1.25,children:[rE.map(Z=>{const Q=wK[Z.id]??Sh;return A.jsx(eg,{elevation:0,variant:"outlined",sx:{borderRadius:2,borderColor:"divider",bgcolor:"background.paper",transition:"border-color 0.2s ease, box-shadow 0.2s ease","&:hover":{borderColor:"primary.main",boxShadow:N=>`0 2px 12px ${un(N.palette.primary.main,.12)}`},...Z.comingSoon?{opacity:.5,cursor:"not-allowed"}:{}},children:A.jsx($S,{onClick:()=>Z.comingSoon?null:M(Z.id),sx:{borderRadius:0,"&:focus-visible":{outlineOffset:-2}},children:A.jsx(ng,{sx:{py:1.75,px:2,"&:last-child":{pb:1.75}},children:A.jsxs(ct,{direction:"row",spacing:1.75,alignItems:"center",children:[A.jsx(P,{sx:{width:44,height:44,borderRadius:1.5,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:N=>un(N.palette.primary.main,.08),border:N=>`1px solid ${un(N.palette.primary.main,.16)}`},children:A.jsx(Q,{sx:{fontSize:24,...Xi}})}),A.jsx(Ae,{variant:"subtitle1",sx:{fontWeight:600,fontSize:"0.9375rem",lineHeight:1.4,letterSpacing:"-0.01em",color:"text.primary"},children:p(`newsletter.types.${Z.id}`)}),Z.comingSoon?A.jsx(vn,{label:p("newsletter.comingSoon"),size:"small",color:"primary",variant:"outlined"}):null]})})})},Z.id)}),s?A.jsx(eg,{elevation:0,variant:"outlined",sx:{borderRadius:2,borderColor:"divider",bgcolor:"background.paper",opacity:.5,cursor:"not-allowed"},children:A.jsx($S,{onClick:void 0,disabled:!0,sx:{borderRadius:0,"&:focus-visible":{outlineOffset:-2}},children:A.jsx(ng,{sx:{py:1.75,px:2,"&:last-child":{pb:1.75}},children:A.jsxs(ct,{direction:"row",spacing:1.75,alignItems:"center",children:[A.jsx(P,{sx:{width:44,height:44,borderRadius:1.5,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:Z=>un(Z.palette.primary.main,.08),border:Z=>`1px solid ${un(Z.palette.primary.main,.16)}`},children:A.jsx(tE,{sx:{fontSize:24,...Xi}})}),A.jsx(Ae,{variant:"subtitle1",sx:{fontWeight:600,fontSize:"0.9375rem",lineHeight:1.4,letterSpacing:"-0.01em",color:"text.primary"},children:p("seriesPrompt.hub.title")}),A.jsx(vn,{label:p("newsletter.comingSoon"),size:"small",color:"primary",variant:"outlined"})]})})})}):null]}),k?A.jsx(Ae,{color:"error",variant:"body2",sx:{mt:2},children:k}):null]});const X=bh(m)?A.jsx(ct,{direction:"row",spacing:1.5,justifyContent:"flex-end",flexWrap:"wrap",children:A.jsx(ze,{variant:"contained",color:"primary",onClick:U,disabled:!C.trim()||E,sx:{textTransform:"none"},children:E?A.jsx(Qa,{size:22,color:"inherit"}):p("common.send")})}):A.jsx(ct,{direction:"row",spacing:1.5,justifyContent:"flex-end",flexWrap:"wrap",children:A.jsx(ze,{variant:"contained",color:"primary",onClick:z,disabled:E,sx:{textTransform:"none"},children:E?A.jsx(Qa,{size:22,color:"inherit"}):p("common.continue")})});return A.jsxs(Bh,{header:A.jsxs(ct,{spacing:1.25,children:[A.jsx(ze,{variant:"text",color:"primary",onClick:j,sx:{alignSelf:"flex-start",textTransform:"none",minWidth:"auto",px:.5,ml:-.5,mt:-.5},children:p("newsletter.back")}),A.jsx(Ae,{variant:"h6",component:"h1",sx:{fontWeight:700,letterSpacing:"-0.02em",lineHeight:1.35},children:R}),A.jsx(Ae,{variant:"body2",color:"text.secondary",sx:{fontSize:"0.8125rem",lineHeight:1.55},children:p("newsletter.questionsSectionHint")})]}),footer:X,children:[bh(m)?A.jsx(rt,{multiline:!0,minRows:4,placeholder:p("newsletter.writeHere"),value:C,onChange:Z=>y(Z.target.value),fullWidth:!0,variant:"outlined",size:"small"}):A.jsx(ct,{spacing:2,children:b.map(Z=>A.jsx(P,{children:Z.inputType==="multiline"?A.jsxs(A.Fragment,{children:[A.jsx(Ae,{variant:"caption",sx:{mb:.75,display:"block",fontWeight:600,color:"text.secondary",letterSpacing:"0.02em"},children:p("newsletter.topicLabel")}),A.jsx(rt,{multiline:!0,minRows:3,placeholder:p("newsletter.writeHere"),value:h[Z.id]??"",onChange:Q=>F(Z.id,Q.target.value),fullWidth:!0,variant:"outlined",size:"small"})]}):A.jsx(rt,{label:p(m==="webinar"&&Z.id==="topic"?"newsletter.questions.topicShort":`newsletter.questions.${Z.id}`),type:Z.inputType==="date"?"date":Z.inputType==="time"?"time":"text",value:h[Z.id]??"",onChange:Q=>F(Z.id,Q.target.value),fullWidth:!0,variant:"outlined",size:"small",InputLabelProps:Z.inputType==="date"||Z.inputType==="time"?{shrink:!0}:void 0})},Z.id))}),k?A.jsx(Ae,{color:"error",variant:"body2",sx:{mt:2},children:k}):null]})}function LK({setActiveStep:e,placeholderSuggestions:t=[],language:n,data:a={},logo:r="",mergeTags:l=[],visibilityRules:i,location:o,onDesignChange:s}){const{t:p}=Nn(),c=v.useRef(s);c.current=s;const{step2Data:u}=bg(),{step3Draft:d,setStep3Draft:f}=ax(),W=u||a,m=(W==null?void 0:W.businessData)||W,x=(W==null?void 0:W.websiteUrl)||(m==null?void 0:m.website)||"",h=Hc({...m,websiteUrl:x})??void 0,g=(u==null?void 0:u.logo)||(W&&typeof W=="object"&&"logo"in W?W.logo:r),C=(u==null?void 0:u.logoBackgroundHex)??(W==null?void 0:W.logoBackgroundHex),y=v.useRef(null),E=v.useRef(!1),S=v.useRef(null),k=v.useRef(!1),[w,V]=v.useState(0),[b,B]=v.useState(0),[M,F]=v.useState([]),[U,T]=v.useState(null);v.useEffect(()=>{var j;if(k.current)return;const L=d;(j=L==null?void 0:L.components)!=null&&j.length&&(k.current=!0,F(Array.isArray(L.components)?L.components:[]),T(L.surveyResult??null))},[d]);const z=L=>{if(L!=null&&L.components){const j=Array.isArray(L.components)?L.components:[];F(j),T(L),f({components:j,surveyResult:L})}else F([]),T(null),f(null),B(j=>j+1)};v.useEffect(()=>{},[]),v.useEffect(()=>{var X;if(M.length===0||!y.current)return;const L=y.current.querySelector("iframe");L&&L.remove(),(X=S.current)!=null&&X.parentNode&&S.current.parentNode.removeChild(S.current),S.current=null,E.current=!1,E.current=!0;const j=document.createElement("iframe");j.width="100%",j.height="100%",j.style.border="none",S.current=j,y.current.appendChild(j);let R=!1;return j.onload=()=>{if(R)return;R=!0;const Z=j.contentDocument,Q=j.contentWindow;if(!Z||!Q||Z.querySelector('script[src*="creaditor.bundle.js"]'))return;Z.open(),Z.write(`
521
521
  <!DOCTYPE html>
522
522
  <html>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@creaditor/business-ai",
3
3
  "private": false,
4
- "version": "1.0.46",
4
+ "version": "1.0.47",
5
5
  "type": "module",
6
6
  "publishConfig": {
7
7
  "access": "public"