(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4272],{81149:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/logo-maker",function(){return a(83433)}])},93729:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});var s=a(50526);let i=s.fabric.util.createClass(s.fabric.Line,{type:"line",superType:"drawing",initialize(e,t){if(!e){let{x1:a,x2:s,y1:i,y2:n}=t;e=[a,i,s,n]}t=t||{},this.callSuper("initialize",e,t)},_render(e){this.callSuper("_render",e)}});i.fromObject=(e,t)=>{let{x1:a,x2:s,y1:n,y2:r}=e;return t(new i([a,n,s,r],e))};let toObject=(e,t,a)=>s.fabric.util.object.extend(e.callSuper("toObject"),t.reduce((t,a)=>Object.assign(t,{[a]:e.get(a)}),Object.assign({},a))),n=s.fabric.util.createClass(s.fabric.Group,{type:"svg",initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.callSuper("initialize",[],e),this.loadSvg(e)},addSvgElements(e,t,a){let i=s.fabric.util.groupSVGElements(e,t,a);if(this.set(t),i.getObjects)i.getObjects().forEach(e=>{this.add(e),t.fill&&e.set("fill",t.fill),t.stroke&&e.set("stroke",t.stroke)});else{var n;i.set({originX:"center",originY:"center"}),t.fill&&i.set({fill:t.fill}),t.stroke&&i.set({stroke:t.stroke}),(null===(n=this._objects)||void 0===n?void 0:n.length)&&this._objects.forEach(e=>this.remove(e)),this.add(i)}return this.set({fill:t.fill||"rgba(0, 0, 0, 1)",stroke:t.stroke||"rgba(255, 255, 255, 0)"}),this.canvas&&this.canvas.requestRenderAll(),this},loadSvg(e){let{svg:t,loadType:a,fill:i,stroke:n}=e;return new Promise(e=>{"svg"===a?s.fabric.loadSVGFromString(t,(a,s)=>{e(this.addSvgElements(a,{...s,fill:i,stroke:n},t))}):s.fabric.loadSVGFromURL(t,(a,s)=>{e(this.addSvgElements(a,{...s,fill:i,stroke:n},t))})})},setFill(e){return this.getObjects().forEach(t=>t.set("fill",e)),this},setStroke(e){return this.getObjects().forEach(t=>t.set("stroke",e)),this},toObject(e){return toObject(this,e,{svg:this.get("svg"),loadType:this.get("loadType")})},_render(e){this.callSuper("_render",e)}});n.fromObject=(e,t)=>t(new n(e));var r={group:{create:e=>{let{objects:t,...a}=e;return new s.fabric.Group(t,a)}},text:{create:e=>{let{text:t,...a}=e;return new s.fabric.Textbox(t,a)}},textbox:{create:e=>{let{text:t,...a}=e;return new s.fabric.Textbox(t,a)}},triangle:{create:e=>new s.fabric.Triangle(e)},circle:{create:e=>new s.fabric.Circle(e)},rect:{create:e=>new s.fabric.Rect(e)},ellipse:{create:e=>new s.fabric.Ellipse(e)},image:{create:e=>{let{element:t=new Image,...a}=e;return new s.fabric.Image(t,{...a,crossOrigin:"anonymous"})}},polygon:{create:e=>{let{points:t,...a}=e;return new s.fabric.Polygon(t,{...a,perPixelTargetFind:!0})}},polyline:{create:e=>{let{points:t,...a}=e;return new s.fabric.Polyline(t,{...a,perPixelTargetFind:!0})}},path:{create:e=>new s.fabric.Path(e.path,{...e})},line:{create:e=>{let{points:t,...a}=e;return new i(t,a)}},svg:{create:e=>new n(e)}}},19746:function(e,t,a){"use strict";var s=a(50526);t.Z=class{initialize(){let{workareaOption:e}=this.handler,t=new Image(e.width,e.height);t.width=e.width,t.height=e.height,this.handler.workarea=new s.fabric.Image(t,e),this.handler.canvas.add(this.handler.workarea),this.handler.objects=this.handler.getObjects(),this.handler.canvas.centerObject(this.handler.workarea),this.handler.canvas.renderAll()}constructor(e){this.calculateScale=e=>{let{canvas:t,workarea:a}=this.handler,{workareaWidth:s,workareaHeight:i}=a,{_element:n}=e||a,r=(null==n?void 0:n.width)||s,l=(null==n?void 0:n.height)||i,o=t.getWidth()/r,c=t.getHeight()/l;return l>=r?(o=c,t.getWidth()<r*o&&(o*=t.getWidth()/(r*o))):(c=o,t.getHeight()<l*o&&(o*=t.getHeight()/(l*o))),{scaleX:o,scaleY:c}},this.changeBackground=e=>{let{workarea:t}=this.handler;t.set({backgroundColor:e}),this.handler.canvas.renderAll()},this.handler=e,this.initialize()}}},91997:function(e,t,a){"use strict";a.d(t,{G:function(){return getLayout}});var s=a(15311),i=a(20132),n=a(69461),r=a(75927),l=a(69139);a(80109);let BuilderLayout=e=>{let{children:t}=e,{theme:a}=(0,i.useContext)(l.x5);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.Wi,{gaId:"G-DB6W30RPLT"}),!1,(0,s.jsxs)("main",{"data-theme":a,className:"relative h-full min-h-screen w-full overflow-hidden bg-background text-text",children:[(0,s.jsx)("div",{className:"mx-auto flex min-h-[100vh] w-full flex-col items-center justify-between space-y-8 px-3 py-5 lg:py-8",children:t}),(0,s.jsx)(r.x7,{gutter:12,containerClassName:"toaster-container",toastOptions:{success:{className:"toaster-success"},error:{className:"toaster-error"}}}),(0,s.jsx)(n.Gk,{})]})]})},getLayout=e=>(0,s.jsx)(BuilderLayout,{children:e})},83433:function(e,t,a){"use strict";a.r(t),a.d(t,{__N_SSG:function(){return I},default:function(){return T}});var s=a(15311),i=a(20132),n=a(69139),r=a(69461),l=a(89784),o=a(52890),c=a(24367),d=a(39860),h=a(50526),u=a(98651),g=a(5762),p=a(23419),m=a.n(p),v=a(69658),f=a(91997),b=a(64817),x=a(19746),y=a(93729),w=a(11118),S=a.n(w),j=a(15113),k=class{initialize(e){this.initOption(e),this.initCallback(e),this.initHandler()}constructor(e){var t=this;this.propertiesToInclude=j.zn,this.workareaOption=j.h3,this.canvasOption=j.vg,this.objectOption={rotation:0,centeredRotation:!0,strokeUniform:!0},this.fabricObjects=y.Z,this.objectMap={},this.zoom=1,this.isCut=!1,this.initOption=e=>{this.id=e.id,this.canvas=e.canvas,this.container=e.container,this.editable=e.editable,this.minZoom=e.minZoom,this.maxZoom=e.maxZoom,this.zoomEnabled=e.zoomEnabled,this.width=e.width,this.height=e.height,this.objects=[],this.setPropertiesToInclude(e.propertiesToInclude),this.setWorkareaOption(e.workareaOption),this.setCanvasOption(e.canvasOption)},this.initCallback=e=>{this.onAdd=e.onAdd,this.onLoad=e.onLoad},this.initHandler=()=>{this.workareaHandler=new x.Z(this)},this.getObjects=()=>{let e=this.canvas.getObjects().filter(e=>"workarea"!==e.id&&"port"!==e.superType&&!!e.id);return e.length?e.forEach(e=>this.objectMap[e.id]=e):this.objectMap={},e},this.set=(e,t)=>{let a=this.canvas.getActiveObject();if(!a)return;a._objects?a._objects.map(a=>{a.set(e,t)}):a.set(e,t),this.canvas.requestRenderAll();let{onModified:s}=this;s&&s(a)},this.setObject=e=>{let t=this.canvas.getActiveObject();if(!t)return;Object.keys(e).forEach(a=>{e[a]!==t[a]&&t.set(a,e[a])}),this.canvas.requestRenderAll();let{onModified:a}=this;a&&a(t)},this.setByObject=(e,t,a)=>{if(!e)return;e.set(t,a),this.canvas.renderAll();let{onModified:s}=this;s&&s(e)},this.setById=(e,t,a)=>{let s=this.findById(e);this.setByObject(s,t,a)},this.setByPartial=(e,t)=>{e&&(e.set(t),this.canvas.renderAll())},this.centerObject=(e,t)=>{t?this.setByPartial(e,{left:(1e3-e.width)/2,top:(500-e.height)/2}):this.setByPartial(e,{left:(1e3-e.width)/2-500,top:(500-e.height)/2-250})},this.add=function(e,a){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],{editable:i,objectOption:n}=t,r={...e,...n,container:t.container.id,hasControls:i,hasBorders:i,selectable:i,lockMovementX:!0,lockMovementY:!0,hoverCursor:i?"move":"pointer",textAlign:a?"center":"left",editable:i},l=t.fabricObjects[e.type].create(r);return t.canvas.add(l),t.canvas.setActiveObject(l),t.objects=t.getObjects(),i&&!s&&t.centerObject(l,a),l},this.addGroup=function(e){let a=!(arguments.length>1)||void 0===arguments[1]||arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e._objects.map(e=>t.add(e,a,s))},this.select=(e,t)=>{let a=e;t&&(a=this.find(e)),a&&(this.canvas.discardActiveObject(),this.canvas.setActiveObject(a),this.canvas.requestRenderAll())},this.selectById=e=>{let t=this.findById(e);t&&(this.canvas.discardActiveObject(),this.canvas.setActiveObject(t),this.canvas.requestRenderAll())},this.exportJSON=()=>this.canvas.toObject(this.propertiesToInclude).objects,this.setBackgroundColor=e=>{this.canvas.backgroundColor=e,this.canvas.requestRenderAll()},this.toActiveSelection=e=>{let t=e||this.canvas.getActiveObject();if(!t||"group"!==t.type)return;let a=t.toActiveSelection();return this.objects=this.getObjects(),this.onSelect&&this.onSelect(a),a},this.clear=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e?(t.canvas.clear(),t.workarea=null):(t.canvas.discardActiveObject(),t.canvas.getObjects().forEach(e=>{"workarea"!==e.id&&t.canvas.remove(e)})),t.objects=t.getObjects(),t.canvas.renderAll()},this.saveImage=function(e){let a,s,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{name:"New Image",format:"jpeg",quality:1},n=e;if(n)a=n.toDataURL(i);else{n=t.canvas.getObjects(),s=new h.fabric.Group(n,{selectable:!1}).toDataURL(i);let e=atob(s.split(",")[1]),a=s.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(e.length),l=new Uint8Array(r);for(let t=0;t<e.length;t++)l[t]=e.charCodeAt(t);let o=new Blob([r],{type:a});return o}return a},this.saveCanvasData=e=>{let t=this.canvas.toSVG({suppressPreamble:!0,width:1e3,height:500,viewBox:{x:-500,y:-250,width:1e3,height:500}}),a=[];return a.push('<?xml version="1.0" encoding="utf-8"?>\n            <svg version="1.1" id="design-container" width="1000" height="500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1000 500" style="background-color:'.concat(e,'; enable-background:new 0 0 1000 500;" xml:space="preserve">')),a.push("".concat(t.replace(/<image (.*?)><\/image>/,"").replace(/<rect (.*?)><\/rect>/,"").replace(/<!--(.*?)-->/,"").replace(/<!(.*?)>/,"").replace(/<svg (.*?)>/,"").replace(/<desc>(.*?)<\/desc>/,"").replace(/\s\s+/g," ").replace(/\n|\r/g,"").replace(/<g (.*?) id="workarea" >(.*?)<\/g>/,'<svg id="design-icon" width="1000" height="1000" viewBox="-700 -350 1400 1400">').replace("</svg>","</svg></svg>"))),a.join("")},this.destroy=()=>{this.clear(!0)},this.setCanvasOption=e=>{this.canvasOption=Object.assign({},this.canvasOption,e),this.canvas.setBackgroundColor(e.backgroundColor,this.canvas.renderAll.bind(this.canvas)),void 0!==e.width&&void 0!==e.height&&(this.eventHandler?this.eventHandler.resize(e.width,e.height):this.canvas.setWidth(e.width).setHeight(e.height)),void 0!==e.selection&&(this.canvas.selection=e.selection),void 0!==e.hoverCursor&&(this.canvas.hoverCursor=e.hoverCursor),void 0!==e.defaultCursor&&(this.canvas.defaultCursor=e.defaultCursor),void 0!==e.preserveObjectStacking&&(this.canvas.preserveObjectStacking=e.preserveObjectStacking)},this.setWorkareaOption=e=>{this.workareaOption={...this.workareaOption,...e},this.workarea&&this.workarea.set({...e})},this.setPropertiesToInclude=e=>{this.propertiesToInclude=S()(e,this.propertiesToInclude)},this.initialize(e)}},O=a(280);let InternalCanvas=class InternalCanvas extends i.Component{componentDidMount(){let{editable:e,width:t,height:a,responsive:s,...i}=this.props,{id:n}=this.state,r={...j.vg,width:t,height:a,selection:e,selectionColor:"rgba(0, 153, 255, 0.2)"};this.canvas=new h.fabric.Canvas("canvas-".concat(n),r),this.canvas.setBackgroundColor(r.backgroundColor,this.canvas.renderAll.bind(this.canvas)),this.canvas.renderAll(),this.container=this.containerRef.current,this.handler=new k({id:n,width:t,height:a,editable:e,canvas:this.canvas,container:this.containerRef.current,canvasOption:r,...i})}componentDidUpdate(e){this.props.editable!==e.editable&&(this.handler.editable=this.props.editable),JSON.stringify(this.props.canvasOption)!==JSON.stringify(e.canvasOption)&&this.handler.setCanvasOption(this.props.canvasOption),JSON.stringify(this.props.workareaOption)!==JSON.stringify(e.workareaOption)&&this.handler.setWorkareaOption(this.props.workareaOption),JSON.stringify(this.props.propertiesToInclude)!==JSON.stringify(e.propertiesToInclude)&&this.handler.setPropertiesToInclude(this.props.propertiesToInclude)}componentWillUnmount(){this.handler.destroy()}render(){let{id:e}=this.state;return(0,s.jsx)("div",{ref:this.containerRef,id:e,style:{width:"100%",height:"100%"},className:"bg-backgroundLight",children:(0,s.jsx)("canvas",{id:"canvas-".concat(e)})})}constructor(){super(...arguments),this.containerRef=(0,i.createRef)(),this.state={id:(0,O.v4)(),loaded:!1},this.handleLoad=()=>{this.setState({loaded:!0},()=>{this.props.onLoad&&this.props.onLoad(this.handler,this.canvas)})}}};InternalCanvas.defaultProps={id:(0,O.v4)(),editable:!0,zoomEnabled:!1,responsive:!0,width:0,height:0};let C=(0,i.forwardRef)((e,t)=>{let a=(0,i.useRef)();return(0,i.useImperativeHandle)(t,()=>({handler:a.current.handler,canvas:a.current.canvas,container:a.current.container})),(0,s.jsx)(InternalCanvas,{ref:a,...e})});function WrappedEditor(e){let{canvasRef:t,...a}=e;return(0,s.jsx)(C,{...a,ref:t})}var N=a(53850),_=a.n(N);let LogoMaker=()=>{let{t:e}=(0,b.Z)("common"),t=[e("logo-maker-process-step1-text"),e("logo-maker-process-step2-text"),e("logo-maker-process-step3-text"),e("logo-maker-process-step4-text"),e("logo-maker-process-step5-text")],a=[e("logo-maker-process-step5-text")],p=[{title:e("home"),link:"/"},{title:e("menu-tools")},{title:e("menu-logo-maker")}],f=(0,g.useRouter)(),{query:x,locale:y}=f,{type:w}=x||{},{loading:S,setLoading:k,theme:O,canvasRef:C}=(0,i.useContext)(n.x5),{data:N,update:I}=(0,v.useSession)(),[T,A]=(0,i.useState)({page:1,limit:15,skip:0}),{limit:B}=T,[E,P]=(0,i.useState)(null),[z,L]=(0,i.useState)(null),[R,U]=(0,i.useState)(null),[D,J]=(0,i.useState)(null),[G,M]=(0,i.useState)(null),[q,F]=(0,i.useState)(null),[H,Z]=(0,i.useState)(!1),[W,V]=(0,i.useState)({status:"active"}),[X,Y]=(0,i.useState)({order:"desc",sortBy:"createdAt",configuration:{companyNameColor:"rgb(0, 0, 1)",companySloganColor:"rgb(0, 0, 1)",companyName:"",companySlogan:"",backgroundColor:"rgb(255, 255, 254)",designCategory:"",designType:"",isVariation:!0,language:"English"}}),{configuration:$}=X||{},{companyName:K,designCategory:Q,language:ee}=$||{},[et]=(0,i.useState)({}),[ea]=(0,i.useState)({order:"desc",sortBy:"_id"}),[es,ei]=(0,i.useState)(null),[en,er]=(0,i.useState)(null),[el,eo]=(0,i.useState)([]),[ec,ed]=(0,i.useState)(null),[eh]=(0,i.useState)({order:"asc",sortBy:"name"}),[eu]=(0,i.useState)({}),[eg]=(0,i.useState)({order:"desc",sortBy:"_id"}),[ep]=(0,i.useState)({}),[em,ev]=(0,i.useState)(!1),[ef,eb]=(0,i.useState)(null),[ex,ey]=(0,i.useState)(1),[ew,eS]=(0,i.useState)(!1),[ej,ek]=(0,i.useState)(!1),[eO,eC]=(0,i.useState)(null),[eN,e_]=(0,i.useState)(!1),eI=new(m()),fetchDesigns=async(e,t)=>{let a=await (0,u.SU)("/api/designs/list","POST",k,{methods:e,filters:t,randomize:!0});"success"===a.status&&(J(e=>e?[...e,...a.items]:a.items),M(a.count))},fetchPalettes=async(e,t)=>{J(null);let a=await (0,u.SU)("/api/colorPalettes/list","POST",k,{methods:e,filters:t});if("success"===a.status){U(a.items.map(e=>e.colors));let e=await (0,u.SU)("/api/designs/list","POST",k,{methods:{...X,...T,skip:0},filters:W,randomize:!0});A(e=>({...e,page:1,skip:0})),"success"===e.status&&(J(e.items),M(e.count))}},fetchDesign=async(e,t)=>{let a=await (0,u.SU)("/api/designs/".concat(e),"POST",null,t||$);"success"===a.status&&(a.design.image.data=(0,u.qP)(a.design,t?t.configuration:$),F(a.design))},fetchBrand=async e=>{var t;let a=await (0,u.SU)("/api/brands/".concat(e),"GET",ev);if("success"===a.status&&!(null==a?void 0:null===(t=a.data)||void 0===t?void 0:t.logo)){ei(a.data),V(e=>({...e,categories:a.data.category._id})),Y(e=>({...e,configuration:{...e.configuration,companyName:a.data.name,designCategory:a.data.category}}));return}f.push("/logo-maker",void 0,{shallow:!0})},pageSelectHandler=async e=>{fetchDesigns({...X,...T,skip:(e-1)*B},W),A(t=>({...t,page:e,skip:e*B}))},checkSubscription=async e=>{if(Z(!0),localStorage.removeItem("configuration"),!es&&"template"!==w){let e=await (0,u.SU)("/api/userPayments/check?locale=".concat(y),"POST",null);if("error"===e.status){Z(!1),toggleSubscriptionModal(),ek(e.susbcriptionStatus);return}}fetchDesign(e,X)},createBrand=async(e,t)=>{let a=await (0,u.SU)("/api/logos/create?locale=".concat(y),"PUT",null,e,!0);if("error"===a.status)Z(!1),(0,u.i6)(a.status,a.message);else if(t)(0,u.i6)(a.status,a.message),f.push("/account/brands/".concat(t,"/logo/designs"));else{let e=await (0,u.SU)("/api/brands/create?locale=".concat(y),"PUT",null,{logoId:a.logo._id,name:K,designCategory:Q._id,colors:el,language:ee||"English"});(0,u.i6)(e.status,e.message),"success"===e.status?(await I({...N.user,brands:N.user.brands+1}),f.push("/account/brands/".concat(e.brand._id,"/logo/designs"))):Z(!1)}},createTemplate=async e=>{let t=await (0,u.SU)("/api/designTemplates/create?locale=".concat(y),"PUT",null,e,!0);(0,u.i6)(t.status,t.message),"error"===t.status?Z(!1):f.push("/dashboard/design-templates")},toggleSubscriptionModal=e=>{e?eS(e):eS(!ew)},handleChange=(e,t)=>{(!["companyName","companySlogan"].includes(e)||/^[a-zA-Z!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ ]*$/.test(t))&&("designCategory"===e?handleFilters("categories","desc",t._id):"colorCategory"===e&&(er(t),fetchPalettes(ea,{...et,category:t._id})),Y(a=>({...a,configuration:{...a.configuration,[e]:t}})))},handleFilters=(e,t,a)=>{let s={...X};a?s[e]=a:(s.sortBy=e,s.order=t),V(s)},nextStep=()=>{if(1===ef){if(!$.companyName)return}else 2===ef&&(J(null),setTimeout(()=>{fetchDesigns({...X,...T,skip:0},W),A(e=>({...e,page:1,skip:0}))},500));ef<3&&(ey(ef),eb(ef>=4?4:ef+1))},prevStep=()=>{ey(ef),eb(ef<=1?1:ef-1)},handleSubmit=(e,t)=>{if(!(null==N?void 0:N.user)){let{companyName:a,companySlogan:s,designCategory:i,colorCategory:n}=$||{};localStorage.setItem("configuration",JSON.stringify({brandId:null==es?void 0:es._id,companyName:a,companySlogan:s,designCategory:{_id:i._id,name:i.name},colorCategory:n?{_id:n._id,name:n.name}:null,designId:e,selectedColors:t,referer:"/logo-maker"})),f.push("/login");return}checkSubscription(e)};(0,i.useEffect)(()=>{if(f.isReady){let e=j.a2.find(e=>e.sc===y);handleChange("language",null==e?void 0:e.language),(async()=>{let e=JSON.parse(localStorage.getItem("configuration")),{companyName:t,companySlogan:a,designCategory:s,selectedColors:i,colorCategory:n,designId:r,brandId:l}=e||{};await (0,v.getSession)()&&(null==e?void 0:e.referer)==="/logo-maker"?(eb(1),Y(i=>({...i,configuration:{...e,companyName:t,companySlogan:a,designCategory:s}})),eo(i),er(n),ed(r),l&&ei({_id:e.brandId}),e_(!0)):x.brand?(eb(1),fetchBrand(x.brand)):"namegenerator"===x.utm_source&&x.name?eC(x):(eb(1),localStorage.removeItem("configuration"));let o=(0,u.SU)("/api/designCategories/list","POST",k,{methods:eh,filters:eu}),c=(0,u.SU)("/api/colorCategories/list","POST",k,{methods:eg,filters:ep}),[d,h]=await Promise.all([o,c]);"success"===d.status&&P(d.items),"success"===h.status&&L(h.items)})()}},[f.isReady]),(0,i.useEffect)(()=>{eN&&(eb(3),checkSubscription(ec))},[eN]),(0,i.useEffect)(()=>{if(eO&&E){let{name:e,industry:t}=eO||{},a=E.find(e=>e.name===t);Y(t=>({...t,configuration:{...t.configuration,companyName:e,designCategory:a?{_id:a._id,name:a.name}:""}})),a?(eb(3),V(e=>({...e,categories:a._id})),fetchDesigns({...X,...T,skip:0},{...W,categories:a._id})):eb(2)}},[eO,E]),(0,i.useEffect)(()=>{if(q){var e,t,a,s;null==C||null===(t=C.current)||void 0===t||null===(e=t.handler)||void 0===e||e.clear(),null==C||null===(s=C.current)||void 0===s||null===(a=s.handler)||void 0===a||a.workareaHandler.changeBackground("rgb(255, 255, 254)"),eT((0,u.yp)(q,el.length&&{companyNameColor:el[0],companySloganColor:el[0],iconColors:el,backgroundColor:"rgb(255, 255, 254)"}),q._id)}},[q]);let{onLoadFromSVG:eT,onAdd:eA,onSelect:eB,onSaveData:eE}={onLoadFromSVG:(t,a)=>{Promise.all([...new Set(t.match(/font-family:(.*?);/g))].map(e=>e.replace("font-family:","").replace(";","")).map(e=>(0,u.mx)(e))).then(()=>{h.fabric.loadSVGFromString(t,(e,t)=>{let s=e.filter(e=>e.fill&&""!==e.fill||e.stroke&&""!==e.stroke),i=new h.fabric.util.groupSVGElements(s,{...t});s.forEach(e=>{"text"===e.type&&e.set("fontFamily",e.fontFamily)}),setTimeout(()=>{var e,t,s;null==C||null===(e=C.current)||void 0===e||e.handler.add(i,!1),null==C||null===(t=C.current)||void 0===t||t.handler.toActiveSelection(),null==C||null===(s=C.current)||void 0===s||s.handler.canvas.requestRenderAll(),eE(a)},[3e3])})}).catch(()=>{Z(!1),(0,u.i6)("error",e("design-damaged")),prevStep()})},onSaveData:e=>{var t,a,s,i,n,r;es&&eI.set("brandId",es._id),eI.set("designId",e),eI.set("imageJson",new Blob([JSON.stringify(null==C?void 0:null===(a=C.current)||void 0===a?void 0:null===(t=a.handler)||void 0===t?void 0:t.exportJSON().filter(e=>!!e.id))],{type:"application/json"}));let l=null==C?void 0:null===(i=C.current)||void 0===i?void 0:null===(s=i.handler)||void 0===s?void 0:s.saveCanvasData("rgb(255, 255, 254)").replace(/\s\s+/g," "),o=null==C?void 0:null===(r=C.current)||void 0===r?void 0:null===(n=r.handler)||void 0===n?void 0:n.saveImage(null,{width:1e3,height:500});eI.set("imageSvg",new Blob([l],{type:"image/svg+xml"})),eI.set("imageJpeg",new Blob([o],{type:"image/jpeg"})),"template"===w?(eI.set("name",K),eI.set("designCategory",Q._id),createTemplate(eI)):createBrand(eI,null==es?void 0:es._id)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.h_,{title:"AI Logo Maker - Make Stunning Logos for FREE",description:"Design a professional logo in seconds with our AI tool. No design skills needed — start building your brand’s identity today!"}),(0,s.jsxs)("div",{className:_()("w-full space-y-20 duration-500 lg:space-y-28",{"pt-[5vh] lg:pt-[15vh]":ef<3||H}),children:[(0,s.jsxs)("div",{className:"space-y-3 lg:space-y-4",children:[(0,s.jsxs)("div",{className:"relative mx-auto flex min-w-[200px] max-w-[300px] items-center justify-center gap-2 overflow-hidden rounded-full border border-borderDark bg-backgroundDark p-2 shadow-sm",children:[(0,s.jsx)("span",{children:(0,s.jsx)(c.Z,{size:20})}),e("menu-logo-maker")]}),p&&(0,s.jsx)(r.Oo,{items:p})]}),(0,s.jsxs)("div",{className:"space-y-8",children:[(0,s.jsx)("div",{className:"relative z-10 mx-auto w-full max-w-xl space-y-3 lg:space-y-4",children:(i=>{let n,c;switch(i){case 1:n=e("logo-maker-step1-title"),c=(0,s.jsx)(r.II,{label:e("label-name"),placeholder:e("placeholder-name"),size:"normal",onChange:e=>handleChange("companyName",e.target.value),value:(null==$?void 0:$.companyName)||"",maxLength:20,required:!0,block:!0});break;case 2:let d=null==E?void 0:E.find(e=>{var t,a;return e.name===(null==X?void 0:null===(a=X.configuration)||void 0===a?void 0:null===(t=a.designCategory)||void 0===t?void 0:t.name)});n=e("logo-maker-step2-title"),c=(0,s.jsx)(r.lq,{labelExtern:e("label-industry"),label:"label",value:"value",size:"normal",placeholder:e("placeholder-industry"),defaultValue:d?{label:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"h-[30px] w-[30px]",children:(0,s.jsx)(r.JO,{icon:d.image,alt:"design-category-icon",className:"h-full w-full p-[1px]",width:30,height:30})}),e(d.name)]}),value:d}:"",items:null==E?void 0:E.map((t,a)=>({label:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"h-[30px] w-[30px]",children:(0,s.jsx)(r.JO,{icon:t.image,alt:"design-category-icon-".concat(a),className:"h-full w-full p-[1px]",width:30,height:30})}),e(t.name)]}),value:t})),onChange:e=>handleChange("designCategory",e),isSearchable:!0,withIcons:!0,required:!0,block:!0});break;case 3:let h=null==z?void 0:z.find(e=>e.name===(null==en?void 0:en.name));n=e("logo-maker-step3-title"),c=(0,s.jsx)(r.lq,{labelExtern:e("label-color-category"),label:"label",value:"value",size:"normal",placeholder:e("placeholder-color-category"),defaultValue:h?{label:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"h-[30px] w-[30px]",children:(0,s.jsx)(r.JO,{icon:h.image,alt:"color-category-icon",className:"h-full w-full p-[1px]",width:30,height:30})}),e(h.name)]}),value:h}:"",items:null==z?void 0:z.map((t,a)=>({label:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"h-[30px] w-[30px]",children:(0,s.jsx)(r.JO,{icon:t.image,alt:"color-category-icon-".concat(a),className:"h-full w-full p-[1px]",width:30,height:30})}),e(t.name)]}),value:t})),onChange:e=>handleChange("colorCategory",e),isSearchable:!0,withIcons:!0,disabled:H,required:!0,block:!0})}return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.ho,{title:n,titleType:"h2",titleButton:i>1&&(0,s.jsx)(r.zx,{variant:"white",size:"square",onClick:()=>prevStep(),disabled:1===ef||3===ef&&H,icon:(0,s.jsx)(l.Z,{size:20})}),withDivider:ef}),ef?(0,s.jsxs)(r.Ue,{x:ef>=ex?"20":"-20",className:"space-y-3 lg:space-y-4",children:[c,ef<3&&(0,s.jsx)(r.zx,{variant:"primary",size:"normal",onClick:()=>nextStep(),disabled:1===ef&&!$.companyName||2===ef&&!$.designCategory,loading:em||H,icon:(0,s.jsx)(o.Z,{size:20}),block:!0,children:e("button-next")})]},ef):(0,s.jsx)(r.aN,{type:"list"}),3===ef&&H&&(0,s.jsx)(r.Ue,{y:20,children:(0,s.jsx)(r.oc,{messages:"template"===w?a:t})})]})})(ef)}),3!==ef||H?null:(0,s.jsx)("div",{className:"mx-auto w-full max-w-7xl",children:D?D.length>0?(0,s.jsxs)("div",{className:"space-y-3 lg:space-y-4",children:[(0,s.jsx)("div",{className:"grid grid-cols-1 gap-3 lg:grid-cols-3",children:D.map((t,a)=>{let i;if(R){var n;let e=(0,u.MH)(0,R.length-1);i=null===(n=R[e])||void 0===n?void 0:n.split(",")}return(0,s.jsxs)(r.Ue,{y:"20",className:"space-y-3 overflow-hidden rounded-md border border-borderDark bg-backgroundDark p-3 leading-[1.9rem] shadow-sm lg:justify-start lg:space-y-4 lg:leading-[2rem]",children:[(0,s.jsx)("div",{className:"-m-3 mb-0",children:(0,s.jsx)(r.YS,{design:t,configuration:$,variation:en?i?{...$,companyNameColor:i[0],companySloganColor:i[0],iconColors:i,backgroundColor:"rgb(255, 255, 254)"}:$:null})}),(0,s.jsx)(r.zx,{variant:"white",size:"small",icon:(0,s.jsx)(d.Z,{size:20}),onClick:()=>{F(null),ed(t._id),i&&eo(i),handleSubmit(t._id,i)},block:!0,children:e("template"===w?"save-as-template":"button-generate-brand")})]},a)})}),D.length<G&&(0,s.jsx)(r.Ue,{y:"20",className:"mx-auto w-full lg:w-1/3 lg:px-1",children:(0,s.jsx)(r.zx,{variant:"white",onClick:()=>{pageSelectHandler(+T.page+1)},loading:S,className:"mx-auto",block:!0,children:e("button-load-more")})})]}):(0,s.jsx)(r.TX,{}):(0,s.jsx)(r.aN,{type:"designs"})})]})]}),(0,s.jsx)(r.u_,{theme:O,title:ej?e("subscription-expired"):e("limit-reached"),isOpen:ew,onClose:()=>{toggleSubscriptionModal(!1),localStorage.getItem("configuration")&&(localStorage.removeItem("configuration"),Y(e=>({...e,configuration:{...e.configuration,companyName:"",companySlogan:"",designCategory:""}})),er(null))},onSubmit:()=>{let{companyName:e,companySlogan:t,designCategory:a,colorCategory:s}=$||{};localStorage.setItem("configuration",JSON.stringify({brandId:null==es?void 0:es._id,companyName:e,companySlogan:t,designCategory:{_id:a._id,name:a.name},colorCategory:s?{_id:s._id,name:s.name}:null,designId:ec,selectedColors:el,referer:"/logo-maker"})),f.push("/account/billing")},content:(0,s.jsx)("p",{className:"leading-[1.9rem] text-textLight lg:leading-[2rem]",children:ej?e("subscription-expired-text"):e("limit-reached-text")}),variant:"primary",buttonText:e("button-subscribe")}),(0,s.jsx)("div",{className:"hidden",children:(0,s.jsx)(WrappedEditor,{canvasRef:C,propertiesToInclude:j.zn,onAdd:eA,onSelect:eB})})]})};LogoMaker.getProvider=n.VH,LogoMaker.getLayout=f.G;var I=!0,T=LogoMaker},24960:function(){},26759:function(){},56272:function(){}},function(e){e.O(0,[1778,3662,8179,5498,2181,8320,7924,9774,2888,179],function(){return e(e.s=81149)}),_N_E=e.O()}]);