@billgangcom/theme-lib 1.33.1 → 1.33.2

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.
@@ -58,7 +58,7 @@ React keys must be passed directly to JSX without using spread:
58
58
  * LICENSE.md file in the root directory of this source tree.
59
59
  *
60
60
  * @license MIT
61
- */function Rn(){return Rn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Rn.apply(this,arguments)}function Uu(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}const Ci="get",bi="application/x-www-form-urlencoded";function fl(e){return e!=null&&typeof e.tagName=="string"}function w3(e){return fl(e)&&e.tagName.toLowerCase()==="button"}function S3(e){return fl(e)&&e.tagName.toLowerCase()==="form"}function E3(e){return fl(e)&&e.tagName.toLowerCase()==="input"}function T3(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function _3(e,t){return e.button===0&&(!t||t==="_self")&&!T3(e)}function Mc(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(o=>[r,o]):[[r,n]])},[]))}function j3(e,t){let r=Mc(e);return t&&t.forEach((n,o)=>{r.has(o)||t.getAll(o).forEach(a=>{r.append(o,a)})}),r}let Qs=null;function P3(){if(Qs===null)try{new FormData(document.createElement("form"),0),Qs=!1}catch{Qs=!0}return Qs}const N3=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Yl(e){return e!=null&&!N3.has(e)?(process.env.NODE_ENV!=="production"&&Dt(!1,'"'+e+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` '+('and will default to "'+bi+'"')),null):e}function D3(e,t){let r,n,o,a,i;if(S3(e)){let c=e.getAttribute("action");n=c?kr(c,t):null,r=e.getAttribute("method")||Ci,o=Yl(e.getAttribute("enctype"))||bi,a=new FormData(e)}else if(w3(e)||E3(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||c.getAttribute("action");if(n=u?kr(u,t):null,r=e.getAttribute("formmethod")||c.getAttribute("method")||Ci,o=Yl(e.getAttribute("formenctype"))||Yl(c.getAttribute("enctype"))||bi,a=new FormData(c,e),!P3()){let{name:d,type:f,value:p}=e;if(f==="image"){let h=d?d+".":"";a.append(h+"x","0"),a.append(h+"y","0")}else d&&a.append(d,p)}}else{if(fl(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Ci,n=null,o=bi,i=e}return a&&o==="text/plain"&&(i=a,a=void 0),{action:n,method:r.toLowerCase(),encType:o,formData:a,body:i}}const O3=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],k3=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],L3=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","unstable_viewTransition"],R3="6";try{window.__reactRouterVersion=R3}catch{}function A3(e,t){return B5({basename:void 0,future:Rn({},void 0,{v7_prependBasename:!0}),history:c5({window:void 0}),hydrationData:I3(),routes:e,mapRouteProperties:b3,unstable_dataStrategy:void 0,unstable_patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function I3(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Rn({},t,{errors:M3(t.errors)})),t}function M3(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,o]of t)if(o&&o.__type==="RouteErrorResponse")r[n]=new Oi(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let a=window[o.__subType];if(typeof a=="function")try{let i=new a(o.message);i.stack="",r[n]=i}catch{}}if(r[n]==null){let a=new Error(o.message);a.stack="",r[n]=a}}else r[n]=o;return r}const Wu=A.createContext({isTransitioning:!1});process.env.NODE_ENV!=="production"&&(Wu.displayName="ViewTransition");const sp=A.createContext(new Map);process.env.NODE_ENV!=="production"&&(sp.displayName="Fetchers");const F3="startTransition",R1=A[F3],B3="flushSync",A1=s5[B3];function H3(e){R1?R1(e):e()}function Ma(e){A1?A1(e):e()}class V3{constructor(){this.status="pending",this.promise=new Promise((t,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function $3(e){let{fallbackElement:t,router:r,future:n}=e,[o,a]=A.useState(r.state),[i,c]=A.useState(),[u,d]=A.useState({isTransitioning:!1}),[f,p]=A.useState(),[h,v]=A.useState(),[m,g]=A.useState(),y=A.useRef(new Map),{v7_startTransition:C}=n||{},b=A.useCallback(T=>{C?H3(T):T()},[C]),_=A.useCallback((T,k)=>{let{deletedFetchers:D,unstable_flushSync:R,unstable_viewTransitionOpts:M}=k;D.forEach(W=>y.current.delete(W)),T.fetchers.forEach((W,Q)=>{W.data!==void 0&&y.current.set(Q,W.data)});let q=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!M||q){R?Ma(()=>a(T)):b(()=>a(T));return}if(R){Ma(()=>{h&&(f&&f.resolve(),h.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:M.currentLocation,nextLocation:M.nextLocation})});let W=r.window.document.startViewTransition(()=>{Ma(()=>a(T))});W.finished.finally(()=>{Ma(()=>{p(void 0),v(void 0),c(void 0),d({isTransitioning:!1})})}),Ma(()=>v(W));return}h?(f&&f.resolve(),h.skipTransition(),g({state:T,currentLocation:M.currentLocation,nextLocation:M.nextLocation})):(c(T),d({isTransitioning:!0,flushSync:!1,currentLocation:M.currentLocation,nextLocation:M.nextLocation}))},[r.window,h,f,y,b]);A.useLayoutEffect(()=>r.subscribe(_),[r,_]),A.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new V3)},[u]),A.useEffect(()=>{if(f&&i&&r.window){let T=i,k=f.promise,D=r.window.document.startViewTransition(async()=>{b(()=>a(T)),await k});D.finished.finally(()=>{p(void 0),v(void 0),c(void 0),d({isTransitioning:!1})}),v(D)}},[b,i,f,r.window]),A.useEffect(()=>{f&&i&&o.location.key===i.location.key&&f.resolve()},[f,h,o.location,i]),A.useEffect(()=>{!u.isTransitioning&&m&&(c(m.state),d({isTransitioning:!0,flushSync:!1,currentLocation:m.currentLocation,nextLocation:m.nextLocation}),g(void 0))},[u.isTransitioning,m]),A.useEffect(()=>{process.env.NODE_ENV!=="production"&&Dt(t==null||!r.future.v7_partialHydration,"`<RouterProvider fallbackElement>` is deprecated when using `v7_partialHydration`, use a `HydrateFallback` component instead")},[]);let S=A.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:T=>r.navigate(T),push:(T,k,D)=>r.navigate(T,{state:k,preventScrollReset:D==null?void 0:D.preventScrollReset}),replace:(T,k,D)=>r.navigate(T,{replace:!0,state:k,preventScrollReset:D==null?void 0:D.preventScrollReset})}),[r]),E=r.basename||"/",L=A.useMemo(()=>({router:r,navigator:S,static:!1,basename:E}),[r,S,E]),P=A.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return A.createElement(A.Fragment,null,A.createElement(la.Provider,{value:L},A.createElement(ul.Provider,{value:o},A.createElement(sp.Provider,{value:y.current},A.createElement(Wu.Provider,{value:u},A.createElement(C3,{basename:E,location:o.location,navigationType:o.historyAction,navigator:S,future:P},o.initialized||r.future.v7_partialHydration?A.createElement(U3,{routes:r.routes,future:r.future,state:o}):t))))),null)}const U3=A.memo(W3);function W3(e){let{routes:t,future:r,state:n}=e;return l3(t,void 0,n,r)}process.env.NODE_ENV;const z3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Z3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ip=A.forwardRef(function(t,r){let{onClick:n,relative:o,reloadDocument:a,replace:i,state:c,target:u,to:d,preventScrollReset:f,unstable_viewTransition:p}=t,h=Uu(t,O3),{basename:v}=A.useContext(Ar),m,g=!1;if(typeof d=="string"&&Z3.test(d)&&(m=d,z3))try{let _=new URL(window.location.href),S=d.startsWith("//")?new URL(_.protocol+d):new URL(d),E=kr(S.pathname,v);S.origin===_.origin&&E!=null?d=E+S.search+S.hash:g=!0}catch{process.env.NODE_ENV!=="production"&&Dt(!1,'<Link to="'+d+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let y=s3(d,{relative:o}),C=Y3(d,{replace:i,state:c,target:u,preventScrollReset:f,relative:o,unstable_viewTransition:p});function b(_){n&&n(_),_.defaultPrevented||C(_)}return A.createElement("a",Rn({},h,{href:m||y,onClick:g||a?n:b,ref:r,target:u}))});process.env.NODE_ENV!=="production"&&(ip.displayName="Link");const lp=A.forwardRef(function(t,r){let{"aria-current":n="page",caseSensitive:o=!1,className:a="",end:i=!1,style:c,to:u,unstable_viewTransition:d,children:f}=t,p=Uu(t,k3),h=Ps(u,{relative:p.relative}),v=qn(),m=A.useContext(ul),{navigator:g,basename:y}=A.useContext(Ar),C=m!=null&&tg(h)&&d===!0,b=g.encodeLocation?g.encodeLocation(h).pathname:h.pathname,_=v.pathname,S=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;o||(_=_.toLowerCase(),S=S?S.toLowerCase():null,b=b.toLowerCase()),S&&y&&(S=kr(S,y)||S);const E=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let L=_===b||!i&&_.startsWith(b)&&_.charAt(E)==="/",P=S!=null&&(S===b||!i&&S.startsWith(b)&&S.charAt(b.length)==="/"),T={isActive:L,isPending:P,isTransitioning:C},k=L?n:void 0,D;typeof a=="function"?D=a(T):D=[a,L?"active":null,P?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let R=typeof c=="function"?c(T):c;return A.createElement(ip,Rn({},p,{"aria-current":k,className:D,ref:r,style:R,to:u,unstable_viewTransition:d}),typeof f=="function"?f(T):f)});process.env.NODE_ENV!=="production"&&(lp.displayName="NavLink");const q3=A.forwardRef((e,t)=>{let{fetcherKey:r,navigate:n,reloadDocument:o,replace:a,state:i,method:c=Ci,action:u,onSubmit:d,relative:f,preventScrollReset:p,unstable_viewTransition:h}=e,v=Uu(e,L3),m=Q3(),g=eg(u,{relative:f}),y=c.toLowerCase()==="get"?"get":"post",C=b=>{if(d&&d(b),b.defaultPrevented)return;b.preventDefault();let _=b.nativeEvent.submitter,S=(_==null?void 0:_.getAttribute("formmethod"))||c;m(_||b.currentTarget,{fetcherKey:r,method:S,navigate:n,replace:a,state:i,relative:f,preventScrollReset:p,unstable_viewTransition:h})};return A.createElement("form",Rn({ref:t,method:y,action:g,onSubmit:o?d:C},v))});process.env.NODE_ENV!=="production"&&(q3.displayName="Form");process.env.NODE_ENV;var Li;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Li||(Li={}));var I1;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(I1||(I1={}));function G3(e){return e+" must be used within a data router. See https://reactrouter.com/routers/picking-a-router."}function cp(e){let t=A.useContext(la);return t||(process.env.NODE_ENV!=="production"?Se(!1,G3(e)):Se(!1)),t}function Y3(e,t){let{target:r,replace:n,state:o,preventScrollReset:a,relative:i,unstable_viewTransition:c}=t===void 0?{}:t,u=Tr(),d=qn(),f=Ps(e,{relative:i});return A.useCallback(p=>{if(_3(p,r)){p.preventDefault();let h=n!==void 0?n:Ln(d)===Ln(f);u(e,{replace:h,state:o,preventScrollReset:a,relative:i,unstable_viewTransition:c})}},[d,u,f,n,o,r,e,a,i,c])}function up(e){process.env.NODE_ENV!=="production"&&Dt(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=A.useRef(Mc(e)),r=A.useRef(!1),n=qn(),o=A.useMemo(()=>j3(n.search,r.current?null:t.current),[n.search]),a=Tr(),i=A.useCallback((c,u)=>{const d=Mc(typeof c=="function"?c(o):c);r.current=!0,a("?"+d,u)},[a,o]);return[o,i]}function K3(){if(typeof document>"u")throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}let X3=0,J3=()=>"__"+String(++X3)+"__";function Q3(){let{router:e}=cp(Li.UseSubmit),{basename:t}=A.useContext(Ar),r=v3();return A.useCallback(function(n,o){o===void 0&&(o={}),K3();let{action:a,method:i,encType:c,formData:u,body:d}=D3(n,t);if(o.navigate===!1){let f=o.fetcherKey||J3();e.fetch(f,r,o.action||a,{preventScrollReset:o.preventScrollReset,formData:u,body:d,formMethod:o.method||i,formEncType:o.encType||c,unstable_flushSync:o.unstable_flushSync})}else e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:u,body:d,formMethod:o.method||i,formEncType:o.encType||c,replace:o.replace,state:o.state,fromRouteId:r,unstable_flushSync:o.unstable_flushSync,unstable_viewTransition:o.unstable_viewTransition})},[e,t,r])}function eg(e,t){let{relative:r}=t===void 0?{}:t,{basename:n}=A.useContext(Ar),o=A.useContext(Qr);o||(process.env.NODE_ENV!=="production"?Se(!1,"useFormAction must be used inside a RouteContext"):Se(!1));let[a]=o.matches.slice(-1),i=Rn({},Ps(e||".",{relative:r})),c=qn();if(e==null){i.search=c.search;let u=new URLSearchParams(i.search);u.has("index")&&u.get("index")===""&&(u.delete("index"),i.search=u.toString()?"?"+u.toString():"")}return(!e||e===".")&&a.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:zr([n,i.pathname])),Ln(i)}function tg(e,t){t===void 0&&(t={});let r=A.useContext(Wu);r==null&&(process.env.NODE_ENV!=="production"?Se(!1,"`unstable_useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"):Se(!1));let{basename:n}=cp(Li.useViewTransitionState),o=Ps(e,{relative:t.relative});if(!r.isTransitioning)return!1;let a=kr(r.currentLocation.pathname,n)||r.currentLocation.pathname,i=kr(r.nextLocation.pathname,n)||r.nextLocation.pathname;return Di(o.pathname,i)!=null||Di(o.pathname,a)!=null}const M1=e=>{let t;const r=new Set,n=(d,f)=>{const p=typeof d=="function"?d(t):d;if(!Object.is(p,t)){const h=t;t=f??(typeof p!="object"||p===null)?p:Object.assign({},t,p),r.forEach(v=>v(t,h))}},o=()=>t,c={setState:n,getState:o,getInitialState:()=>u,subscribe:d=>(r.add(d),()=>r.delete(d))},u=t=e(n,o,c);return c},rg=e=>e?M1(e):M1,ng=e=>e;function og(e,t=ng){const r=x.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return x.useDebugValue(r),r}const F1=e=>{const t=rg(e),r=n=>og(t,n);return Object.assign(r,t),r},Rt=e=>e?F1(e):F1,ag=Rt(e=>({blocks:null,setBlocks:t=>e(()=>({blocks:t})),activeBlock:null,setActiveBlock:t=>e(()=>({activeBlock:t})),sourceBlocks:{},setSourceBlocks:t=>e(()=>({sourceBlocks:t})),currentInstance:null,setCurrentInstance:t=>e(()=>({currentInstance:t}))})),sg=Rt(e=>({currentDevice:{icon:"Desktop",value:"desktop"},setCurrentDevice:t=>e(()=>({currentDevice:t}))}));Rt(e=>({pageData:null,setPageData:t=>e(()=>({pageData:t}))}));const dp=[{icon:"TreeStructure",name:"Layers"},{icon:"Plus",name:"Add"},{icon:"Palette",name:"Theme"},{icon:"Gear",name:"Settings"}],ca="https://g-api.billgang.com",ig="https://www.googleapis.com/webfonts/v1/webfonts",fp="https://stores-api.billgang.com",lg=Array.from({length:122/2+1},(e,t)=>String(6+t*2)),cg=["100","200","300","400","500","600","700","800","900"],ug=Rt(e=>({activeBlock:dp[0],setActiveBlock:t=>e(()=>({activeBlock:t}))}));function dg(e,t){let r;try{r=e()}catch{return}return{getItem:o=>{var a;const i=u=>u===null?null:JSON.parse(u,void 0),c=(a=r.getItem(o))!=null?a:null;return c instanceof Promise?c.then(i):i(c)},setItem:(o,a)=>r.setItem(o,JSON.stringify(a,void 0)),removeItem:o=>r.removeItem(o)}}const Fc=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return Fc(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return Fc(n)(r)}}}},fg=(e,t)=>(r,n,o)=>{let a={storage:dg(()=>localStorage),partialize:g=>g,version:0,merge:(g,y)=>({...y,...g}),...t},i=!1;const c=new Set,u=new Set;let d=a.storage;if(!d)return e((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),r(...g)},n,o);const f=()=>{const g=a.partialize({...n()});return d.setItem(a.name,{state:g,version:a.version})},p=o.setState;o.setState=(g,y)=>{p(g,y),f()};const h=e((...g)=>{r(...g),f()},n,o);o.getInitialState=()=>h;let v;const m=()=>{var g,y;if(!d)return;i=!1,c.forEach(b=>{var _;return b((_=n())!=null?_:h)});const C=((y=a.onRehydrateStorage)==null?void 0:y.call(a,(g=n())!=null?g:h))||void 0;return Fc(d.getItem.bind(d))(a.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==a.version){if(a.migrate)return[!0,a.migrate(b.state,b.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,b.state];return[!1,void 0]}).then(b=>{var _;const[S,E]=b;if(v=a.merge(E,(_=n())!=null?_:h),r(v,!0),S)return f()}).then(()=>{C==null||C(v,void 0),v=n(),i=!0,u.forEach(b=>b(v))}).catch(b=>{C==null||C(void 0,b)})};return o.persist={setOptions:g=>{a={...a,...g},g.storage&&(d=g.storage)},clearStorage:()=>{d==null||d.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>m(),hasHydrated:()=>i,onHydrate:g=>(c.add(g),()=>{c.delete(g)}),onFinishHydration:g=>(u.add(g),()=>{u.delete(g)})},a.skipHydration||m(),v||h},hl=fg,hg=Rt(hl(e=>({onPreview:!0,setOnPreview:t=>e(()=>({onPreview:t})),activeBlock:null,setActiveBlock:t=>e(()=>({activeBlock:t}))}),{name:"preview-storage",partialize:e=>{const{onPreview:t}=e;return{onPreview:t}}}));var Mt=[];for(var Kl=0;Kl<256;++Kl)Mt.push((Kl+256).toString(16).slice(1));function pg(e,t=0){return(Mt[e[t+0]]+Mt[e[t+1]]+Mt[e[t+2]]+Mt[e[t+3]]+"-"+Mt[e[t+4]]+Mt[e[t+5]]+"-"+Mt[e[t+6]]+Mt[e[t+7]]+"-"+Mt[e[t+8]]+Mt[e[t+9]]+"-"+Mt[e[t+10]]+Mt[e[t+11]]+Mt[e[t+12]]+Mt[e[t+13]]+Mt[e[t+14]]+Mt[e[t+15]]).toLowerCase()}var ei,mg=new Uint8Array(16);function gg(){if(!ei&&(ei=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ei))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ei(mg)}var vg=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const B1={randomUUID:vg};function Ri(e,t,r){if(B1.randomUUID&&!t&&!e)return B1.randomUUID();e=e||{};var n=e.random||(e.rng||gg)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,pg(n)}const Ga=Rt(hl((e,t)=>({header:null,blocks:{},footer:null,currentBlock:null,positionBlock:null,setBlocks:r=>{e({blocks:r})},setHeader:r=>{e({header:r})},setFooter:r=>{e({footer:r})},createPage:r=>{const n=t().blocks;n[r]={data:{},order:[]},e({blocks:n})},deletePage:r=>{const n=t().blocks;delete n[r],e({blocks:n})},updatePage:(r,n)=>{const o=t().blocks;if(o[n])return;const a=o[r];delete o[r],o[n]=a,e({blocks:o})},setCurrentBlock:r=>{e({currentBlock:r})},setPositionBlock:(r,n=!1)=>{const{blocks:o}=t(),{currentPage:a,pages:i}=hp.getState();if(!a||!i||!i[a]||!o[i[a].path]){console.error("Cannot set position: invalid page or block data");return}const c=i[a].path,u=o[c],d=r?u.order.indexOf(r):-1;if(d===-1&&r){console.error(`Block with ID "${r}" not found in page "${c}"`);return}const f=d!==-1?d+(n?1:0):u.order.length;e({positionBlock:f})},addBlock:(r,n)=>{const o=structuredClone(t().blocks)||JSON.parse(JSON.stringify(t().blocks));Wo.getState().addHistory(o);const a={...t().blocks},i=a[r]||{data:{},order:[]},c=t().positionBlock,u=Ri(),d={name:n.name,value:n.value};i.data[u]=d,c===null||c>=i.order.length?i.order.push(u):i.order.splice(c,0,u),e({blocks:{...a,[r]:{data:i.data,order:i.order}}})},editBlock:(r,n,o)=>{const a=structuredClone(t().blocks)||JSON.parse(JSON.stringify(t().blocks));Wo.getState().addHistory(a);const i=t().blocks,c=i[r]||{};c.data[n]={name:o.name,value:{...o.value}},e({blocks:{...i,[r]:c}})},removeBlock:(r,n)=>{const o=structuredClone(t().blocks);Wo.getState().addHistory(o);const a=structuredClone(t().blocks),i=a[r];if(!i){console.error(`Page at path "${r}" does not exist.`);return}delete i.data[n],i.order=i.order.filter(c=>c!==n),e({blocks:{...a,[r]:i}})},moveBlock:(r,n,o)=>e(a=>{const i=structuredClone(t().blocks)||JSON.parse(JSON.stringify(t().blocks));if(Wo.getState().addHistory(i),!a.blocks[r])return console.error(`Path ${r} does not exist in blocks`),a;const c={...a.blocks[r]},u=[...c.order];if(n<0||o<0||n>=u.length||o>=u.length)return console.error(`Invalid indices: fromIndex=${n}, toIndex=${o}`),a;const[d]=u.splice(n,1);return u.splice(o,0,d),{blocks:{...a.blocks,[r]:{...c,order:u}}}}),duplicateBlock:(r,n)=>{const o=structuredClone(t().blocks)||JSON.parse(JSON.stringify(t().blocks));Wo.getState().addHistory(o);const{blocks:a}=t(),i=a[r],c=i.data[n],u=Ri(),d={name:c.name,value:{...c.value}},f=Object.keys(i),p=f.indexOf(n),h=f.slice(0,p+1),v=f.slice(p+1),m={...h.reduce((g,y)=>(g[y]=i.data[y],g),{}),[u]:d,...v.reduce((g,y)=>(g[y]=i.data[y],g),{})};e({blocks:{...a,[r]:{data:m,order:Object.keys(m)}}})}}),{name:"layers-storage",partialize:e=>{const{blocks:t,header:r,footer:n}=e;return{blocks:t,header:r,footer:n}}})),yg=Rt((e,t)=>({isModalVisible:!1,hoverBlockId:null,isMouseOverModal:!1,hideTimeout:null,setHoverBlockId:r=>{e({hoverBlockId:r})},showModal:r=>{t().hideTimeout&&clearTimeout(t().hideTimeout),e({isModalVisible:!0,hoverBlockId:r})},hideModal:()=>{e({isModalVisible:!1,hoverBlockId:null})},startHideTimeout:()=>{if(!t().isMouseOverModal){const r=setTimeout(()=>{e({isModalVisible:!1,hoverBlockId:null})},500);e({hideTimeout:r})}},clearHideTimeout:()=>{t().hideTimeout&&(clearTimeout(t().hideTimeout),e({hideTimeout:null}))},setMouseOverModal:r=>{e({isMouseOverModal:r})},isPreviewVisible:!1,showPreview:r=>{e({isPreviewVisible:!0,hoverBlockId:r})},hidePreview:()=>{e({isPreviewVisible:!1,hoverBlockId:null})}})),xg=Rt(e=>({activeBlock:null,setActiveBlock:t=>e(()=>({activeBlock:t})),activeFont:null,setActiveFont:t=>e(()=>({activeFont:t})),setThemeSettings:t=>e(()=>({themeSettings:t})),themeSettings:{colors:{text:{primary:"#252525",secondary:"#757575",tertiary:"#C2C2C2",inverted:"#FFFFFF",action:"#FF3F19",actionHover:"#DA2400",disabled:"#C2C2C2",warning:"#FF3F19",error:"#C12A2A",success:"#338B13",information:"#3683F7",link:"#3683F7"},icon:{primary:"#252525",secondary:"#555555",tertiary:"#C2C2C2",inverted:"#FFFFFF",action:"#FF3F19",actionHover:"#DA2400",disabled:"#C2C2C2",warning:"#FF3F19",error:"#C12A2A",success:"#338B13",information:"#3683F7",link:"#3683F7"},border:{primary:"#C2C2C2",secondary:"#E6E6E6",action:"#FF3F19",actionHover:"#DA2400",disabled:"#E6E6E6",warning:"#FF3F19",error:"#C12A2A",success:"#338B13",information:"#3683F7",focus:"#FF3F19"},surface:{primary:"#FFFFFF",secondary:"#F8F8F8",action1:"#FF3F19",action1Hover:"#DA2400",action2:"#FFFFFF",action2Hover:"#F8F8F8",disabled:"#C2C2C2",warning:"#FAF4E6",error:"#FAE6E6",success:"#E5FADD",information:"#E9F1FE",modal:"rgba(1, 1, 4, 0.4)"}},fonts:{heading:{h1:{font:"Archivo",weight:"900",size:48},h2:{font:"Archivo",weight:"700",size:32},h3:{font:"Archivo",weight:"600",size:24},h4:{font:"Archivo",weight:"500",size:16},h5:{font:"Archivo",weight:"400",size:16},h6:{font:"Archivo",weight:"400",size:16}},paragraph:{text:{font:"Archivo",size:48,weight:"400"}}},borders:{radius:52,thickness:52},buttons:{primary:{size:26,alignment:"left",radius:32,height:40,background:"#ff3f19",hover:!0,font:"Archivo",boxShadow:{left:0,top:4,blur:10,spread:0,color:"#000000"}},secondary:{size:26,alignment:"left",radius:10,height:20,background:"#c2c2c2",hover:!1,font:"Archivo",boxShadow:{left:0,top:4,blur:10,spread:0,color:"#000000"}},tertiary:{size:12,alignment:"left",radius:30,height:30,background:"#c2c2c2",hover:!0,font:"Archivo",boxShadow:{left:0,top:4,blur:10,spread:0,color:"#000000"}}},inputs:{general:{height:48,name:"Style Name",size:48,color:"black"},field:{active:!0,color:"black",opacity:40},border:{active:!0,style:"solid",radius:0,thickness:0,color:"black"},label:{height:48,size:48,color:"black",alignment:"left"}}},updateColor:(t,r,n)=>e(o=>{const a={...o.themeSettings.colors,[t]:{...o.themeSettings.colors[t],[r]:n}};return{themeSettings:{...o.themeSettings,colors:a}}}),updateFont:(t,r,n,o)=>e(a=>{const i={...a.themeSettings.fonts,[t]:{...a.themeSettings.fonts[t],[r]:{...a.themeSettings.fonts[t][r],[n]:o}}};return{themeSettings:{...a.themeSettings,fonts:i}}}),updateBorder:(t,r)=>e(n=>{const o={...n.themeSettings.borders,[t]:r};return{themeSettings:{...n.themeSettings,borders:o}}}),updateButton:(t,r,n)=>e(o=>{const a={...o.themeSettings.buttons[t],[r]:n},i={...o.themeSettings.buttons,[t]:a};return{themeSettings:{...o.themeSettings,buttons:i}}}),updateInput:(t,r,n)=>e(o=>({themeSettings:{...o.themeSettings,inputs:{...o.themeSettings.inputs,[t]:{...o.themeSettings.inputs[t],[n]:r}}}}))})),Cg=Rt(hl(e=>({fonts:[],setFonts:t=>e(()=>({fonts:t}))}),{name:"fonts-storage"})),bg=Rt(e=>({settings:null,setSettings:t=>e(()=>({settings:t}))})),wg=Rt()(e=>({color:"default",initialColor:"",setInitialColor:t=>e(()=>({initialColor:t})),colorChange:()=>{},update:()=>{},activeLabel:null,modalPosition:{left:0,top:0},showModal:!1,dragging:!1,hue:0,saturation:100,brightness:100,alpha:100,isGradientActive:!0,isGradient:!1,setIsGradient:t=>e(()=>({isGradient:t})),gradientDirection:"vertical",setGradientDirection:t=>e(()=>({gradientDirection:t})),hue2:0,saturation2:100,brightness2:100,alpha2:100,setHue2:t=>e(()=>({hue2:t})),setSaturation2:t=>e(()=>({saturation2:t})),setBrightness2:t=>e(()=>({brightness2:t})),setAlpha2:t=>e(()=>({alpha2:t})),activeColorIndex:1,setActiveColorIndex:t=>e(()=>({activeColorIndex:t})),setModalPosition:t=>e(()=>({modalPosition:t})),setHue:t=>e(()=>({hue:t})),setSaturation:t=>e(()=>({saturation:t})),setBrightness:t=>e(()=>({brightness:t})),setShowModal:t=>e(()=>({showModal:t})),setDragging:t=>e(()=>({dragging:t})),setActiveLabel:t=>e(()=>({activeLabel:t})),setColor:t=>e(()=>({color:t})),setUpdate:t=>e(()=>({update:t})),setColorChange:t=>e(()=>({colorChange:t})),setAlpha:t=>e(()=>({alpha:t})),setIsGradientActive:t=>e(()=>({isGradientActive:t})),resetColors:()=>e(()=>({color:"default",initialColor:"",activeLabel:null,modalPosition:{left:0,top:0},showModal:!1,dragging:!1,hue:0,saturation:100,brightness:100,alpha:100,isGradient:!1,gradientDirection:"vertical",hue2:0,saturation2:100,brightness2:100,alpha2:100,activeColorIndex:1,isGradientActive:!0}))})),hp=Rt(hl((e,t)=>({pages:null,currentPage:"/",setPages:r=>e(()=>({pages:r})),pageContext:{listings:null,products:null,reviews:null,categories:null,faqs:null,general:null},isOpenModal:!1,isOpenSelectModal:!1,isEdit:!1,editedPage:null,setEditedPage:r=>e(()=>({editedPage:r})),setCurrentPage:r=>e(()=>({currentPage:r})),setPageContext:r=>e(()=>({pageContext:r})),setIsOpenModal:r=>e(()=>({isOpenModal:r})),setIsOpenSelectModal:r=>e(()=>({isOpenSelectModal:r})),setIsEdit:r=>e(()=>({isEdit:r})),createPage:r=>{const n=t().pages,o=Ri();if(n)n[o]=r,e({pages:n});else{const a=t().setPages;a({});const i=t().pages;i[o]=r,e({pages:i})}},updatePage:(r,n)=>{const o=t().pages;o&&(o[r]={...n},e({pages:o}))},deletePage:r=>{const n=t().pages;n&&(delete n[r],e({pages:n}))}}),{name:"pages-storage",partialize:e=>{const{pages:t,pageContext:r}=e;return{pages:t,pageContext:r}}})),zu=Rt(e=>({openModal:!1,setOpenModal:t=>e(()=>({openModal:t})),onChange:null,setOnChange:t=>e(()=>({onChange:t}))})),Wo=Rt((e,t)=>({past:[],future:[],addHistory:r=>{const{past:n}=t();e({past:[...n,r],future:[]})},undo:()=>{const{past:r,future:n}=t();if(r.length===0)return;const o=r[r.length-1],a=r.slice(0,-1);e({past:a,future:[Ga.getState().blocks,...n]}),Ga.getState().setBlocks(o)},redo:()=>{const{past:r,future:n}=t();if(n.length===0)return;const o=n[0],a=n.slice(1);e({past:[...r,Ga.getState().blocks],future:a}),Ga.getState().setBlocks(o)}})),Sg=Rt(e=>({isOpenModal:!1,setIsOpenModal:t=>e(()=>({isOpenModal:t}))})),Eg=Rt(e=>({notification:null,setNotification:t=>e(()=>({notification:t}))})),Tg=Rt(e=>({error:null,setError:t=>e(()=>({error:t}))})),_g=Rt(e=>({title:null,description:null,onConfirm:null,setTitle:t=>e(()=>({title:t})),setDescription:t=>e(()=>({description:t})),setOnConfirm:t=>e(()=>({onConfirm:t}))}));var pp={exports:{}};/*!
61
+ */function Rn(){return Rn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Rn.apply(this,arguments)}function Uu(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}const Ci="get",bi="application/x-www-form-urlencoded";function fl(e){return e!=null&&typeof e.tagName=="string"}function w3(e){return fl(e)&&e.tagName.toLowerCase()==="button"}function S3(e){return fl(e)&&e.tagName.toLowerCase()==="form"}function E3(e){return fl(e)&&e.tagName.toLowerCase()==="input"}function T3(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function _3(e,t){return e.button===0&&(!t||t==="_self")&&!T3(e)}function Mc(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(o=>[r,o]):[[r,n]])},[]))}function j3(e,t){let r=Mc(e);return t&&t.forEach((n,o)=>{r.has(o)||t.getAll(o).forEach(a=>{r.append(o,a)})}),r}let Qs=null;function P3(){if(Qs===null)try{new FormData(document.createElement("form"),0),Qs=!1}catch{Qs=!0}return Qs}const N3=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Yl(e){return e!=null&&!N3.has(e)?(process.env.NODE_ENV!=="production"&&Dt(!1,'"'+e+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` '+('and will default to "'+bi+'"')),null):e}function D3(e,t){let r,n,o,a,i;if(S3(e)){let c=e.getAttribute("action");n=c?kr(c,t):null,r=e.getAttribute("method")||Ci,o=Yl(e.getAttribute("enctype"))||bi,a=new FormData(e)}else if(w3(e)||E3(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||c.getAttribute("action");if(n=u?kr(u,t):null,r=e.getAttribute("formmethod")||c.getAttribute("method")||Ci,o=Yl(e.getAttribute("formenctype"))||Yl(c.getAttribute("enctype"))||bi,a=new FormData(c,e),!P3()){let{name:d,type:f,value:p}=e;if(f==="image"){let h=d?d+".":"";a.append(h+"x","0"),a.append(h+"y","0")}else d&&a.append(d,p)}}else{if(fl(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Ci,n=null,o=bi,i=e}return a&&o==="text/plain"&&(i=a,a=void 0),{action:n,method:r.toLowerCase(),encType:o,formData:a,body:i}}const O3=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],k3=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],L3=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","unstable_viewTransition"],R3="6";try{window.__reactRouterVersion=R3}catch{}function A3(e,t){return B5({basename:void 0,future:Rn({},void 0,{v7_prependBasename:!0}),history:c5({window:void 0}),hydrationData:I3(),routes:e,mapRouteProperties:b3,unstable_dataStrategy:void 0,unstable_patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function I3(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Rn({},t,{errors:M3(t.errors)})),t}function M3(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,o]of t)if(o&&o.__type==="RouteErrorResponse")r[n]=new Oi(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let a=window[o.__subType];if(typeof a=="function")try{let i=new a(o.message);i.stack="",r[n]=i}catch{}}if(r[n]==null){let a=new Error(o.message);a.stack="",r[n]=a}}else r[n]=o;return r}const Wu=A.createContext({isTransitioning:!1});process.env.NODE_ENV!=="production"&&(Wu.displayName="ViewTransition");const sp=A.createContext(new Map);process.env.NODE_ENV!=="production"&&(sp.displayName="Fetchers");const F3="startTransition",R1=A[F3],B3="flushSync",A1=s5[B3];function H3(e){R1?R1(e):e()}function Ma(e){A1?A1(e):e()}class V3{constructor(){this.status="pending",this.promise=new Promise((t,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function $3(e){let{fallbackElement:t,router:r,future:n}=e,[o,a]=A.useState(r.state),[i,c]=A.useState(),[u,d]=A.useState({isTransitioning:!1}),[f,p]=A.useState(),[h,v]=A.useState(),[m,g]=A.useState(),y=A.useRef(new Map),{v7_startTransition:C}=n||{},b=A.useCallback(T=>{C?H3(T):T()},[C]),_=A.useCallback((T,k)=>{let{deletedFetchers:D,unstable_flushSync:R,unstable_viewTransitionOpts:M}=k;D.forEach(W=>y.current.delete(W)),T.fetchers.forEach((W,Q)=>{W.data!==void 0&&y.current.set(Q,W.data)});let q=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!M||q){R?Ma(()=>a(T)):b(()=>a(T));return}if(R){Ma(()=>{h&&(f&&f.resolve(),h.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:M.currentLocation,nextLocation:M.nextLocation})});let W=r.window.document.startViewTransition(()=>{Ma(()=>a(T))});W.finished.finally(()=>{Ma(()=>{p(void 0),v(void 0),c(void 0),d({isTransitioning:!1})})}),Ma(()=>v(W));return}h?(f&&f.resolve(),h.skipTransition(),g({state:T,currentLocation:M.currentLocation,nextLocation:M.nextLocation})):(c(T),d({isTransitioning:!0,flushSync:!1,currentLocation:M.currentLocation,nextLocation:M.nextLocation}))},[r.window,h,f,y,b]);A.useLayoutEffect(()=>r.subscribe(_),[r,_]),A.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new V3)},[u]),A.useEffect(()=>{if(f&&i&&r.window){let T=i,k=f.promise,D=r.window.document.startViewTransition(async()=>{b(()=>a(T)),await k});D.finished.finally(()=>{p(void 0),v(void 0),c(void 0),d({isTransitioning:!1})}),v(D)}},[b,i,f,r.window]),A.useEffect(()=>{f&&i&&o.location.key===i.location.key&&f.resolve()},[f,h,o.location,i]),A.useEffect(()=>{!u.isTransitioning&&m&&(c(m.state),d({isTransitioning:!0,flushSync:!1,currentLocation:m.currentLocation,nextLocation:m.nextLocation}),g(void 0))},[u.isTransitioning,m]),A.useEffect(()=>{process.env.NODE_ENV!=="production"&&Dt(t==null||!r.future.v7_partialHydration,"`<RouterProvider fallbackElement>` is deprecated when using `v7_partialHydration`, use a `HydrateFallback` component instead")},[]);let S=A.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:T=>r.navigate(T),push:(T,k,D)=>r.navigate(T,{state:k,preventScrollReset:D==null?void 0:D.preventScrollReset}),replace:(T,k,D)=>r.navigate(T,{replace:!0,state:k,preventScrollReset:D==null?void 0:D.preventScrollReset})}),[r]),E=r.basename||"/",L=A.useMemo(()=>({router:r,navigator:S,static:!1,basename:E}),[r,S,E]),P=A.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return A.createElement(A.Fragment,null,A.createElement(la.Provider,{value:L},A.createElement(ul.Provider,{value:o},A.createElement(sp.Provider,{value:y.current},A.createElement(Wu.Provider,{value:u},A.createElement(C3,{basename:E,location:o.location,navigationType:o.historyAction,navigator:S,future:P},o.initialized||r.future.v7_partialHydration?A.createElement(U3,{routes:r.routes,future:r.future,state:o}):t))))),null)}const U3=A.memo(W3);function W3(e){let{routes:t,future:r,state:n}=e;return l3(t,void 0,n,r)}process.env.NODE_ENV;const z3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Z3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ip=A.forwardRef(function(t,r){let{onClick:n,relative:o,reloadDocument:a,replace:i,state:c,target:u,to:d,preventScrollReset:f,unstable_viewTransition:p}=t,h=Uu(t,O3),{basename:v}=A.useContext(Ar),m,g=!1;if(typeof d=="string"&&Z3.test(d)&&(m=d,z3))try{let _=new URL(window.location.href),S=d.startsWith("//")?new URL(_.protocol+d):new URL(d),E=kr(S.pathname,v);S.origin===_.origin&&E!=null?d=E+S.search+S.hash:g=!0}catch{process.env.NODE_ENV!=="production"&&Dt(!1,'<Link to="'+d+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let y=s3(d,{relative:o}),C=Y3(d,{replace:i,state:c,target:u,preventScrollReset:f,relative:o,unstable_viewTransition:p});function b(_){n&&n(_),_.defaultPrevented||C(_)}return A.createElement("a",Rn({},h,{href:m||y,onClick:g||a?n:b,ref:r,target:u}))});process.env.NODE_ENV!=="production"&&(ip.displayName="Link");const lp=A.forwardRef(function(t,r){let{"aria-current":n="page",caseSensitive:o=!1,className:a="",end:i=!1,style:c,to:u,unstable_viewTransition:d,children:f}=t,p=Uu(t,k3),h=Ps(u,{relative:p.relative}),v=qn(),m=A.useContext(ul),{navigator:g,basename:y}=A.useContext(Ar),C=m!=null&&tg(h)&&d===!0,b=g.encodeLocation?g.encodeLocation(h).pathname:h.pathname,_=v.pathname,S=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;o||(_=_.toLowerCase(),S=S?S.toLowerCase():null,b=b.toLowerCase()),S&&y&&(S=kr(S,y)||S);const E=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let L=_===b||!i&&_.startsWith(b)&&_.charAt(E)==="/",P=S!=null&&(S===b||!i&&S.startsWith(b)&&S.charAt(b.length)==="/"),T={isActive:L,isPending:P,isTransitioning:C},k=L?n:void 0,D;typeof a=="function"?D=a(T):D=[a,L?"active":null,P?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let R=typeof c=="function"?c(T):c;return A.createElement(ip,Rn({},p,{"aria-current":k,className:D,ref:r,style:R,to:u,unstable_viewTransition:d}),typeof f=="function"?f(T):f)});process.env.NODE_ENV!=="production"&&(lp.displayName="NavLink");const q3=A.forwardRef((e,t)=>{let{fetcherKey:r,navigate:n,reloadDocument:o,replace:a,state:i,method:c=Ci,action:u,onSubmit:d,relative:f,preventScrollReset:p,unstable_viewTransition:h}=e,v=Uu(e,L3),m=Q3(),g=eg(u,{relative:f}),y=c.toLowerCase()==="get"?"get":"post",C=b=>{if(d&&d(b),b.defaultPrevented)return;b.preventDefault();let _=b.nativeEvent.submitter,S=(_==null?void 0:_.getAttribute("formmethod"))||c;m(_||b.currentTarget,{fetcherKey:r,method:S,navigate:n,replace:a,state:i,relative:f,preventScrollReset:p,unstable_viewTransition:h})};return A.createElement("form",Rn({ref:t,method:y,action:g,onSubmit:o?d:C},v))});process.env.NODE_ENV!=="production"&&(q3.displayName="Form");process.env.NODE_ENV;var Li;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Li||(Li={}));var I1;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(I1||(I1={}));function G3(e){return e+" must be used within a data router. See https://reactrouter.com/routers/picking-a-router."}function cp(e){let t=A.useContext(la);return t||(process.env.NODE_ENV!=="production"?Se(!1,G3(e)):Se(!1)),t}function Y3(e,t){let{target:r,replace:n,state:o,preventScrollReset:a,relative:i,unstable_viewTransition:c}=t===void 0?{}:t,u=Tr(),d=qn(),f=Ps(e,{relative:i});return A.useCallback(p=>{if(_3(p,r)){p.preventDefault();let h=n!==void 0?n:Ln(d)===Ln(f);u(e,{replace:h,state:o,preventScrollReset:a,relative:i,unstable_viewTransition:c})}},[d,u,f,n,o,r,e,a,i,c])}function up(e){process.env.NODE_ENV!=="production"&&Dt(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=A.useRef(Mc(e)),r=A.useRef(!1),n=qn(),o=A.useMemo(()=>j3(n.search,r.current?null:t.current),[n.search]),a=Tr(),i=A.useCallback((c,u)=>{const d=Mc(typeof c=="function"?c(o):c);r.current=!0,a("?"+d,u)},[a,o]);return[o,i]}function K3(){if(typeof document>"u")throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}let X3=0,J3=()=>"__"+String(++X3)+"__";function Q3(){let{router:e}=cp(Li.UseSubmit),{basename:t}=A.useContext(Ar),r=v3();return A.useCallback(function(n,o){o===void 0&&(o={}),K3();let{action:a,method:i,encType:c,formData:u,body:d}=D3(n,t);if(o.navigate===!1){let f=o.fetcherKey||J3();e.fetch(f,r,o.action||a,{preventScrollReset:o.preventScrollReset,formData:u,body:d,formMethod:o.method||i,formEncType:o.encType||c,unstable_flushSync:o.unstable_flushSync})}else e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:u,body:d,formMethod:o.method||i,formEncType:o.encType||c,replace:o.replace,state:o.state,fromRouteId:r,unstable_flushSync:o.unstable_flushSync,unstable_viewTransition:o.unstable_viewTransition})},[e,t,r])}function eg(e,t){let{relative:r}=t===void 0?{}:t,{basename:n}=A.useContext(Ar),o=A.useContext(Qr);o||(process.env.NODE_ENV!=="production"?Se(!1,"useFormAction must be used inside a RouteContext"):Se(!1));let[a]=o.matches.slice(-1),i=Rn({},Ps(e||".",{relative:r})),c=qn();if(e==null){i.search=c.search;let u=new URLSearchParams(i.search);u.has("index")&&u.get("index")===""&&(u.delete("index"),i.search=u.toString()?"?"+u.toString():"")}return(!e||e===".")&&a.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:zr([n,i.pathname])),Ln(i)}function tg(e,t){t===void 0&&(t={});let r=A.useContext(Wu);r==null&&(process.env.NODE_ENV!=="production"?Se(!1,"`unstable_useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"):Se(!1));let{basename:n}=cp(Li.useViewTransitionState),o=Ps(e,{relative:t.relative});if(!r.isTransitioning)return!1;let a=kr(r.currentLocation.pathname,n)||r.currentLocation.pathname,i=kr(r.nextLocation.pathname,n)||r.nextLocation.pathname;return Di(o.pathname,i)!=null||Di(o.pathname,a)!=null}const M1=e=>{let t;const r=new Set,n=(d,f)=>{const p=typeof d=="function"?d(t):d;if(!Object.is(p,t)){const h=t;t=f??(typeof p!="object"||p===null)?p:Object.assign({},t,p),r.forEach(v=>v(t,h))}},o=()=>t,c={setState:n,getState:o,getInitialState:()=>u,subscribe:d=>(r.add(d),()=>r.delete(d))},u=t=e(n,o,c);return c},rg=e=>e?M1(e):M1,ng=e=>e;function og(e,t=ng){const r=x.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return x.useDebugValue(r),r}const F1=e=>{const t=rg(e),r=n=>og(t,n);return Object.assign(r,t),r},Rt=e=>e?F1(e):F1,ag=Rt(e=>({blocks:null,setBlocks:t=>e(()=>({blocks:t})),activeBlock:null,setActiveBlock:t=>e(()=>({activeBlock:t})),sourceBlocks:{},setSourceBlocks:t=>e(()=>({sourceBlocks:t})),currentInstance:null,setCurrentInstance:t=>e(()=>({currentInstance:t}))})),sg=Rt(e=>({currentDevice:{icon:"Desktop",value:"desktop"},setCurrentDevice:t=>e(()=>({currentDevice:t}))}));Rt(e=>({pageData:null,setPageData:t=>e(()=>({pageData:t}))}));const dp=[{icon:"TreeStructure",name:"Layers"},{icon:"Plus",name:"Add"},{icon:"Palette",name:"Theme"},{icon:"Gear",name:"Settings"}],ca="https://g-api.billgang.com",ig="https://www.googleapis.com/webfonts/v1/webfonts",fp="https://stores-api.billgang.com",lg=Array.from({length:122/2+1},(e,t)=>String(6+t*2)),cg=["100","200","300","400","500","600","700","800","900"],ug=Rt(e=>({activeBlock:dp[0],setActiveBlock:t=>e(()=>({activeBlock:t}))}));function dg(e,t){let r;try{r=e()}catch{return}return{getItem:o=>{var a;const i=u=>u===null?null:JSON.parse(u,void 0),c=(a=r.getItem(o))!=null?a:null;return c instanceof Promise?c.then(i):i(c)},setItem:(o,a)=>r.setItem(o,JSON.stringify(a,void 0)),removeItem:o=>r.removeItem(o)}}const Fc=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return Fc(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return Fc(n)(r)}}}},fg=(e,t)=>(r,n,o)=>{let a={storage:dg(()=>localStorage),partialize:g=>g,version:0,merge:(g,y)=>({...y,...g}),...t},i=!1;const c=new Set,u=new Set;let d=a.storage;if(!d)return e((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),r(...g)},n,o);const f=()=>{const g=a.partialize({...n()});return d.setItem(a.name,{state:g,version:a.version})},p=o.setState;o.setState=(g,y)=>{p(g,y),f()};const h=e((...g)=>{r(...g),f()},n,o);o.getInitialState=()=>h;let v;const m=()=>{var g,y;if(!d)return;i=!1,c.forEach(b=>{var _;return b((_=n())!=null?_:h)});const C=((y=a.onRehydrateStorage)==null?void 0:y.call(a,(g=n())!=null?g:h))||void 0;return Fc(d.getItem.bind(d))(a.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==a.version){if(a.migrate)return[!0,a.migrate(b.state,b.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,b.state];return[!1,void 0]}).then(b=>{var _;const[S,E]=b;if(v=a.merge(E,(_=n())!=null?_:h),r(v,!0),S)return f()}).then(()=>{C==null||C(v,void 0),v=n(),i=!0,u.forEach(b=>b(v))}).catch(b=>{C==null||C(void 0,b)})};return o.persist={setOptions:g=>{a={...a,...g},g.storage&&(d=g.storage)},clearStorage:()=>{d==null||d.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>m(),hasHydrated:()=>i,onHydrate:g=>(c.add(g),()=>{c.delete(g)}),onFinishHydration:g=>(u.add(g),()=>{u.delete(g)})},a.skipHydration||m(),v||h},hl=fg,hg=Rt(hl(e=>({onPreview:!0,setOnPreview:t=>e(()=>({onPreview:t})),activeBlock:null,setActiveBlock:t=>e(()=>({activeBlock:t}))}),{name:"preview-storage",partialize:e=>{const{onPreview:t}=e;return{onPreview:t}}}));var Mt=[];for(var Kl=0;Kl<256;++Kl)Mt.push((Kl+256).toString(16).slice(1));function pg(e,t=0){return(Mt[e[t+0]]+Mt[e[t+1]]+Mt[e[t+2]]+Mt[e[t+3]]+"-"+Mt[e[t+4]]+Mt[e[t+5]]+"-"+Mt[e[t+6]]+Mt[e[t+7]]+"-"+Mt[e[t+8]]+Mt[e[t+9]]+"-"+Mt[e[t+10]]+Mt[e[t+11]]+Mt[e[t+12]]+Mt[e[t+13]]+Mt[e[t+14]]+Mt[e[t+15]]).toLowerCase()}var ei,mg=new Uint8Array(16);function gg(){if(!ei&&(ei=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ei))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ei(mg)}var vg=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const B1={randomUUID:vg};function Ri(e,t,r){if(B1.randomUUID&&!t&&!e)return B1.randomUUID();e=e||{};var n=e.random||(e.rng||gg)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,pg(n)}const Ga=Rt(hl((e,t)=>({header:null,blocks:{},footer:null,currentBlock:null,positionBlock:null,setBlocks:r=>{e({blocks:r})},setHeader:r=>{e({header:r})},setFooter:r=>{e({footer:r})},createPage:r=>{const n=t().blocks;n[r]={data:{},order:[]},e({blocks:n})},deletePage:r=>{const n=t().blocks;delete n[r],e({blocks:n})},updatePage:(r,n)=>{const o=t().blocks;if(o[n])return;const a=o[r];delete o[r],o[n]=a,e({blocks:o})},setCurrentBlock:r=>{e({currentBlock:r})},setPositionBlock:(r,n=!1)=>{const{blocks:o}=t(),{currentPage:a,pages:i}=hp.getState();if(!a||!i||!i[a]||!o[i[a].path]){console.error("Cannot set position: invalid page or block data");return}const c=i[a].path,u=o[c],d=r?u.order.indexOf(r):-1;if(d===-1&&r){console.error(`Block with ID "${r}" not found in page "${c}"`);return}const f=d!==-1?d+(n?1:0):u.order.length;e({positionBlock:f})},addBlock:(r,n)=>{const o=structuredClone(t().blocks)||JSON.parse(JSON.stringify(t().blocks));Wo.getState().addHistory(o);const a={...t().blocks},i=a[r]||{data:{},order:[]},c=t().positionBlock,u=Ri(),d={name:n.name,value:n.value};i.data[u]=d,c===null||c>=i.order.length?i.order.push(u):i.order.splice(c,0,u),e({blocks:{...a,[r]:{data:i.data,order:i.order}}})},editBlock:(r,n,o)=>{const a=structuredClone(t().blocks)||JSON.parse(JSON.stringify(t().blocks));Wo.getState().addHistory(a);const i=t().blocks,c=i[r]||{};c.data[n]={name:o.name,value:{...o.value}},e({blocks:{...i,[r]:c}})},removeBlock:(r,n)=>{const o=structuredClone(t().blocks);Wo.getState().addHistory(o);const a=structuredClone(t().blocks),i=a[r];if(!i){console.error(`Page at path "${r}" does not exist.`);return}delete i.data[n],i.order=i.order.filter(c=>c!==n),e({blocks:{...a,[r]:i}})},moveBlock:(r,n,o)=>e(a=>{const i=structuredClone(t().blocks)||JSON.parse(JSON.stringify(t().blocks));if(Wo.getState().addHistory(i),!a.blocks[r])return console.error(`Path ${r} does not exist in blocks`),a;const c={...a.blocks[r]},u=[...c.order];if(n<0||o<0||n>=u.length||o>=u.length)return console.error(`Invalid indices: fromIndex=${n}, toIndex=${o}`),a;const[d]=u.splice(n,1);return u.splice(o,0,d),{blocks:{...a.blocks,[r]:{...c,order:u}}}}),duplicateBlock:(r,n)=>{const o=structuredClone(t().blocks);Wo.getState().addHistory(o);const a=structuredClone(t().blocks),i=a[r];if(!i||!i.data[n]){console.error(`Block with ID "${n}" not found in page "${r}"`);return}const c=Ri(),u=i.data[n],d={name:u.name,value:{...u.value}};i.data[c]=d;const f=i.order.indexOf(n);if(f===-1){console.error(`Block ID "${n}" not found in order array`);return}i.order.splice(f+1,0,c),e({blocks:{...a,[r]:i}})}}),{name:"layers-storage",partialize:e=>{const{blocks:t,header:r,footer:n}=e;return{blocks:t,header:r,footer:n}}})),yg=Rt((e,t)=>({isModalVisible:!1,hoverBlockId:null,isMouseOverModal:!1,hideTimeout:null,setHoverBlockId:r=>{e({hoverBlockId:r})},showModal:r=>{t().hideTimeout&&clearTimeout(t().hideTimeout),e({isModalVisible:!0,hoverBlockId:r})},hideModal:()=>{e({isModalVisible:!1,hoverBlockId:null})},startHideTimeout:()=>{if(!t().isMouseOverModal){const r=setTimeout(()=>{e({isModalVisible:!1,hoverBlockId:null})},500);e({hideTimeout:r})}},clearHideTimeout:()=>{t().hideTimeout&&(clearTimeout(t().hideTimeout),e({hideTimeout:null}))},setMouseOverModal:r=>{e({isMouseOverModal:r})},isPreviewVisible:!1,showPreview:r=>{e({isPreviewVisible:!0,hoverBlockId:r})},hidePreview:()=>{e({isPreviewVisible:!1,hoverBlockId:null})}})),xg=Rt(e=>({activeBlock:null,setActiveBlock:t=>e(()=>({activeBlock:t})),activeFont:null,setActiveFont:t=>e(()=>({activeFont:t})),setThemeSettings:t=>e(()=>({themeSettings:t})),themeSettings:{colors:{text:{primary:"#252525",secondary:"#757575",tertiary:"#C2C2C2",inverted:"#FFFFFF",action:"#FF3F19",actionHover:"#DA2400",disabled:"#C2C2C2",warning:"#FF3F19",error:"#C12A2A",success:"#338B13",information:"#3683F7",link:"#3683F7"},icon:{primary:"#252525",secondary:"#555555",tertiary:"#C2C2C2",inverted:"#FFFFFF",action:"#FF3F19",actionHover:"#DA2400",disabled:"#C2C2C2",warning:"#FF3F19",error:"#C12A2A",success:"#338B13",information:"#3683F7",link:"#3683F7"},border:{primary:"#C2C2C2",secondary:"#E6E6E6",action:"#FF3F19",actionHover:"#DA2400",disabled:"#E6E6E6",warning:"#FF3F19",error:"#C12A2A",success:"#338B13",information:"#3683F7",focus:"#FF3F19"},surface:{primary:"#FFFFFF",secondary:"#F8F8F8",action1:"#FF3F19",action1Hover:"#DA2400",action2:"#FFFFFF",action2Hover:"#F8F8F8",disabled:"#C2C2C2",warning:"#FAF4E6",error:"#FAE6E6",success:"#E5FADD",information:"#E9F1FE",modal:"rgba(1, 1, 4, 0.4)"}},fonts:{heading:{h1:{font:"Archivo",weight:"900",size:48},h2:{font:"Archivo",weight:"700",size:32},h3:{font:"Archivo",weight:"600",size:24},h4:{font:"Archivo",weight:"500",size:16},h5:{font:"Archivo",weight:"400",size:16},h6:{font:"Archivo",weight:"400",size:16}},paragraph:{text:{font:"Archivo",size:48,weight:"400"}}},borders:{radius:52,thickness:52},buttons:{primary:{size:26,alignment:"left",radius:32,height:40,background:"#ff3f19",hover:!0,font:"Archivo",boxShadow:{left:0,top:4,blur:10,spread:0,color:"#000000"}},secondary:{size:26,alignment:"left",radius:10,height:20,background:"#c2c2c2",hover:!1,font:"Archivo",boxShadow:{left:0,top:4,blur:10,spread:0,color:"#000000"}},tertiary:{size:12,alignment:"left",radius:30,height:30,background:"#c2c2c2",hover:!0,font:"Archivo",boxShadow:{left:0,top:4,blur:10,spread:0,color:"#000000"}}},inputs:{general:{height:48,name:"Style Name",size:48,color:"black"},field:{active:!0,color:"black",opacity:40},border:{active:!0,style:"solid",radius:0,thickness:0,color:"black"},label:{height:48,size:48,color:"black",alignment:"left"}}},updateColor:(t,r,n)=>e(o=>{const a={...o.themeSettings.colors,[t]:{...o.themeSettings.colors[t],[r]:n}};return{themeSettings:{...o.themeSettings,colors:a}}}),updateFont:(t,r,n,o)=>e(a=>{const i={...a.themeSettings.fonts,[t]:{...a.themeSettings.fonts[t],[r]:{...a.themeSettings.fonts[t][r],[n]:o}}};return{themeSettings:{...a.themeSettings,fonts:i}}}),updateBorder:(t,r)=>e(n=>{const o={...n.themeSettings.borders,[t]:r};return{themeSettings:{...n.themeSettings,borders:o}}}),updateButton:(t,r,n)=>e(o=>{const a={...o.themeSettings.buttons[t],[r]:n},i={...o.themeSettings.buttons,[t]:a};return{themeSettings:{...o.themeSettings,buttons:i}}}),updateInput:(t,r,n)=>e(o=>({themeSettings:{...o.themeSettings,inputs:{...o.themeSettings.inputs,[t]:{...o.themeSettings.inputs[t],[n]:r}}}}))})),Cg=Rt(hl(e=>({fonts:[],setFonts:t=>e(()=>({fonts:t}))}),{name:"fonts-storage"})),bg=Rt(e=>({settings:null,setSettings:t=>e(()=>({settings:t}))})),wg=Rt()(e=>({color:"default",initialColor:"",setInitialColor:t=>e(()=>({initialColor:t})),colorChange:()=>{},update:()=>{},activeLabel:null,modalPosition:{left:0,top:0},showModal:!1,dragging:!1,hue:0,saturation:100,brightness:100,alpha:100,isGradientActive:!0,isGradient:!1,setIsGradient:t=>e(()=>({isGradient:t})),gradientDirection:"vertical",setGradientDirection:t=>e(()=>({gradientDirection:t})),hue2:0,saturation2:100,brightness2:100,alpha2:100,setHue2:t=>e(()=>({hue2:t})),setSaturation2:t=>e(()=>({saturation2:t})),setBrightness2:t=>e(()=>({brightness2:t})),setAlpha2:t=>e(()=>({alpha2:t})),activeColorIndex:1,setActiveColorIndex:t=>e(()=>({activeColorIndex:t})),setModalPosition:t=>e(()=>({modalPosition:t})),setHue:t=>e(()=>({hue:t})),setSaturation:t=>e(()=>({saturation:t})),setBrightness:t=>e(()=>({brightness:t})),setShowModal:t=>e(()=>({showModal:t})),setDragging:t=>e(()=>({dragging:t})),setActiveLabel:t=>e(()=>({activeLabel:t})),setColor:t=>e(()=>({color:t})),setUpdate:t=>e(()=>({update:t})),setColorChange:t=>e(()=>({colorChange:t})),setAlpha:t=>e(()=>({alpha:t})),setIsGradientActive:t=>e(()=>({isGradientActive:t})),resetColors:()=>e(()=>({color:"default",initialColor:"",activeLabel:null,modalPosition:{left:0,top:0},showModal:!1,dragging:!1,hue:0,saturation:100,brightness:100,alpha:100,isGradient:!1,gradientDirection:"vertical",hue2:0,saturation2:100,brightness2:100,alpha2:100,activeColorIndex:1,isGradientActive:!0}))})),hp=Rt(hl((e,t)=>({pages:null,currentPage:"/",setPages:r=>e(()=>({pages:r})),pageContext:{listings:null,products:null,reviews:null,categories:null,faqs:null,general:null},isOpenModal:!1,isOpenSelectModal:!1,isEdit:!1,editedPage:null,setEditedPage:r=>e(()=>({editedPage:r})),setCurrentPage:r=>e(()=>({currentPage:r})),setPageContext:r=>e(()=>({pageContext:r})),setIsOpenModal:r=>e(()=>({isOpenModal:r})),setIsOpenSelectModal:r=>e(()=>({isOpenSelectModal:r})),setIsEdit:r=>e(()=>({isEdit:r})),createPage:r=>{const n=t().pages,o=Ri();if(n)n[o]=r,e({pages:n});else{const a=t().setPages;a({});const i=t().pages;i[o]=r,e({pages:i})}},updatePage:(r,n)=>{const o=t().pages;o&&(o[r]={...n},e({pages:o}))},deletePage:r=>{const n=t().pages;n&&(delete n[r],e({pages:n}))}}),{name:"pages-storage",partialize:e=>{const{pages:t,pageContext:r}=e;return{pages:t,pageContext:r}}})),zu=Rt(e=>({openModal:!1,setOpenModal:t=>e(()=>({openModal:t})),onChange:null,setOnChange:t=>e(()=>({onChange:t}))})),Wo=Rt((e,t)=>({past:[],future:[],addHistory:r=>{const{past:n}=t();e({past:[...n,r],future:[]})},undo:()=>{const{past:r,future:n}=t();if(r.length===0)return;const o=r[r.length-1],a=r.slice(0,-1);e({past:a,future:[Ga.getState().blocks,...n]}),Ga.getState().setBlocks(o)},redo:()=>{const{past:r,future:n}=t();if(n.length===0)return;const o=n[0],a=n.slice(1);e({past:[...r,Ga.getState().blocks],future:a}),Ga.getState().setBlocks(o)}})),Sg=Rt(e=>({isOpenModal:!1,setIsOpenModal:t=>e(()=>({isOpenModal:t}))})),Eg=Rt(e=>({notification:null,setNotification:t=>e(()=>({notification:t}))})),Tg=Rt(e=>({error:null,setError:t=>e(()=>({error:t}))})),_g=Rt(e=>({title:null,description:null,onConfirm:null,setTitle:t=>e(()=>({title:t})),setDescription:t=>e(()=>({description:t})),setOnConfirm:t=>e(()=>({onConfirm:t}))}));var pp={exports:{}};/*!
62
62
  Copyright (c) 2018 Jed Watson.
63
63
  Licensed under the MIT License (MIT), see
64
64
  http://jedwatson.github.io/classnames
@@ -4370,29 +4370,32 @@ const si = Ft(
4370
4370
  [r]: {
4371
4371
  ...l,
4372
4372
  order: c
4373
- // Обновляем только порядок
4374
4373
  }
4375
4374
  }
4376
4375
  };
4377
4376
  }),
4378
4377
  duplicateBlock: (r, n) => {
4379
- const s = structuredClone(t().blocks) || JSON.parse(JSON.stringify(t().blocks));
4378
+ const s = structuredClone(t().blocks);
4380
4379
  Ha.getState().addHistory(s);
4381
- const { blocks: a } = t(), o = a[r], l = o.data[n], c = Uc(), u = {
4382
- name: l.name,
4383
- value: { ...l.value }
4384
- }, d = Object.keys(o), h = d.indexOf(n), f = d.slice(0, h + 1), g = d.slice(h + 1), p = {
4385
- ...f.reduce((m, v) => (m[v] = o.data[v], m), {}),
4386
- [c]: u,
4387
- ...g.reduce((m, v) => (m[v] = o.data[v], m), {})
4380
+ const a = structuredClone(t().blocks), o = a[r];
4381
+ if (!o || !o.data[n]) {
4382
+ console.error(`Block with ID "${n}" not found in page "${r}"`);
4383
+ return;
4384
+ }
4385
+ const l = Uc(), c = o.data[n], u = {
4386
+ name: c.name,
4387
+ value: { ...c.value }
4388
4388
  };
4389
- e({
4389
+ o.data[l] = u;
4390
+ const d = o.order.indexOf(n);
4391
+ if (d === -1) {
4392
+ console.error(`Block ID "${n}" not found in order array`);
4393
+ return;
4394
+ }
4395
+ o.order.splice(d + 1, 0, l), e({
4390
4396
  blocks: {
4391
4397
  ...a,
4392
- [r]: {
4393
- data: p,
4394
- order: Object.keys(p)
4395
- }
4398
+ [r]: o
4396
4399
  }
4397
4400
  });
4398
4401
  }
package/dist/ui.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-J6kEvjGE.cjs"),h=require("react");require("@phosphor-icons/react");const Rt="_wrapper_9rr5j_2",yt="_alignmentBlock_9rr5j_8",It="_title_9rr5j_15",wt="_subtitle_9rr5j_22",kt="_alignmentContent_9rr5j_29",$t="_alignments_9rr5j_37",Nt="_alignment_9rr5j_8",Ct="_circle_9rr5j_58",St="_paddings_9rr5j_65",Bt="_padding_9rr5j_65",Tt="_input_9rr5j_84",G={wrapper:Rt,alignmentBlock:yt,title:It,subtitle:wt,alignmentContent:kt,alignments:$t,alignment:Nt,circle:Ct,paddings:St,padding:Bt,input:Tt},Pt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],At=["left","top","right","bottom"],Ot=u=>{const{alignment:o,padding:e,setPadding:s,setAlignment:i}=u;function a(){switch(o){case"left":case"topLeft":case"bottomLeft":return"TextAlignLeft";case"right":case"topRight":case"bottomRight":return"TextAlignRight";case"center":case"top":case"bottom":return"TextAlignCenter";default:return"TextAlignCenter"}}function c(r){switch(r){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}return t.jsxRuntimeExports.jsxs("div",{className:G.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:G.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:G.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:G.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:G.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:G.alignments,children:Pt.map(r=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{i(r)},className:G.alignment,children:[r!==o&&t.jsxRuntimeExports.jsx("div",{className:G.circle}),r===o&&t.jsxRuntimeExports.jsx(t.Icon,{name:a(),fill:"#FF3F19",width:22,height:22})]},r))}),t.jsxRuntimeExports.jsx("div",{className:G.paddings,children:At.map(r=>t.jsxRuntimeExports.jsxs("label",{className:G.padding,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:c(r),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(e[r]),onChange:n=>s({...e,[r]:Number(n)}),paddingless:!0,borderless:!0})]},r))})]})]})]})},qt="_title_voimd_1",Dt="_subtitle_voimd_5",Lt="_header_voimd_12",Mt="_text_voimd_13",Ht="_top_voimd_20",zt="_itemsBlock_voimd_29",it={title:qt,subtitle:Dt,header:Lt,text:Mt,top:Ht,itemsBlock:zt},Ft="_typeTexts_167ez_1",Vt="_block_167ez_8",Ut="_active_167ez_25",xt={typeTexts:Ft,block:Vt,active:Ut},Yt=["bold","italic","underline","strike-through","code"],pt=u=>{const{typesText:o,setTypesText:e}=u;function s(i){switch(i){case"bold":return"TextB";case"italic":return"TextItalic";case"code":return"CodeSimple";case"strike-through":return"TextStrikethrough";case"underline":return"TextUnderline"}}return t.jsxRuntimeExports.jsx("div",{className:xt.typeTexts,children:Yt.map(i=>t.jsxRuntimeExports.jsx("div",{className:t.clx(xt.block,{[xt.active]:o.includes(i)}),onClick:()=>{const a=[...o];if(a.includes(i)){const c=a.filter(r=>r!==i);e(c)}else a.push(i),e(a)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:s(i),fill:o.includes(i)?"#252525":"#757575",width:20,height:20})},String(i)))})},ht=u=>{const{typesText:o,isActiveText:e,setIsActiveText:s,text:i,setText:a,setTypesText:c,title:r,subtitle:n="Items"}=u;return t.jsxRuntimeExports.jsxs("div",{className:it.text,children:[(r||e!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:it.top,children:[r&&t.jsxRuntimeExports.jsx("h3",{className:it.title,children:r}),e!==void 0&&s&&t.jsxRuntimeExports.jsx(t.Switch,{current:e,onChange:l=>s(l)})]}),t.jsxRuntimeExports.jsxs("div",{className:it.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:it.subtitle,children:n}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:l=>a(l),value:i,maxLength:150}),t.jsxRuntimeExports.jsx(pt,{typesText:o,setTypesText:c})]})]})},Gt="_title_vzbkd_1",Wt="_subtitle_vzbkd_5",Xt="_header_vzbkd_12",Jt="_text_vzbkd_13",Qt="_productsBlock_vzbkd_14",Kt="_top_vzbkd_26",Zt="_itemsBlock_vzbkd_35",te="_typeTexts_vzbkd_41",ee="_block_vzbkd_48",se="_active_vzbkd_61",ne="_products_vzbkd_14",ie="_product_vzbkd_14",oe="_button_vzbkd_80",re="_disabled_vzbkd_91",ae="_image_vzbkd_95",ce="_info_vzbkd_102",le="_name_vzbkd_114",de="_buttons_vzbkd_118",ue="_modal_vzbkd_125",xe="_link_vzbkd_145",me="_modalOptions_vzbkd_151",pe="_addButton_vzbkd_163",M={title:Gt,subtitle:Wt,header:Xt,text:Jt,productsBlock:Qt,top:Kt,itemsBlock:Zt,typeTexts:te,block:ee,active:se,products:ne,product:ie,button:oe,disabled:re,image:ae,info:ce,name:le,buttons:de,modal:ue,link:xe,modalOptions:me,addButton:pe},he=h.forwardRef((u,o)=>{const{activeItem:e,setActiveItem:s,popupPosition:i,modalOptions:a,setIsOpenModal:c}=u;function r(n,l){return n.length>l?`${n.slice(0,l)}...`:n}return t.jsxRuntimeExports.jsxs("div",{ref:o,className:M.modal,onClick:n=>{n.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:M.top,children:[t.jsxRuntimeExports.jsx("h3",{className:M.title,children:r(e.name,20)}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{s(null),c(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:M.modalOptions,children:a.map(n=>{if(n.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[n.field],onChange:l=>{const x={...e,[n.field]:l};s(x)}},String(n.field));if(n.type==="text")return t.jsxRuntimeExports.jsx(ht,{typesText:e[n.field.type],setTypesText:l=>{const x={...e,[n.field.type]:l};s(x)},text:e[n.field.text]||"",setText:l=>{const x={...e,[n.field.text]:l};s(x)},subtitle:n.label});if(n.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:l=>{const x={...e,[n.field]:l};s(x)},value:e[n.field]||"",label:n.label,placeholder:n.placeholder});if(n.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:M.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:l=>{const x={...e,[n.field.text]:l};s(x)},value:e[n.field.text]||"",label:n.inputLabel,placeholder:n.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[n.field.switch]||!1,label:n.switchLabel,onChange:l=>{const x={...e,[n.field.switch]:l};s(x)}})]});if(n.type==="list")return t.jsxRuntimeExports.jsx(_t,{items:e[n.field]||[],setItems:l=>{const x={...e,[n.field]:l};s(x)},itemsType:"select",draggable:n.draggable||!1,itemsOptions:n.itemsOptions,deletable:n.deletable||!1,editable:!1,subtitle:n.label,addableOptions:n.addableOptions});if(n.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:n.itemsOptions,onChange:l=>{const x={...e,[n.field]:l};s(x)},label:n.label,value:e[n.field]||"String",leftAddon:n.leftAddon&&n.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[n.field]})})})})]})}),_e="_other_g74jx_1",je="_subtitle_g74jx_7",ge="_items_g74jx_14",mt={other:_e,subtitle:je,items:ge},dt=u=>{const{items:o,title:e="Other"}=u;return t.jsxRuntimeExports.jsxs("div",{className:mt.other,children:[t.jsxRuntimeExports.jsx("h5",{className:mt.subtitle,children:e}),t.jsxRuntimeExports.jsx("div",{className:mt.items,children:o.map((s,i)=>t.jsxRuntimeExports.jsx(t.Switch,{current:s.isItem,onChange:a=>s.setIsItem(a),label:s.label,hasBackground:!0,paddingless:!1},i))})]})},fe=u=>{const{index:o,moveProduct:e,children:s}=u,[,i]=t.useDrop({accept:"product",hover(r){r.index!==o&&(e(r.index,o),r.index=o)}}),[{isDragging:a},c]=t.useDrag({type:"product",item:{index:o},collect:r=>({isDragging:r.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:r=>c(i(r)),className:`${M.product} ${a?M.dragging:""}`,children:s})},_t=u=>{const{isActiveItems:o,setIsActiveItems:e,items:s,setItems:i,other:a,title:c,subtitle:r,editable:n=!0,draggable:l=!1,withImage:x=!1,deletable:d=!0,addable:S=!0,itemsType:g,itemsPlaceholder:_="",itemsOptions:p,hasRangeSelector:T=!1,rangeSelectorOptions:P,modalOptions:f,addableOptions:O={},limit:k,autoScrollInterval:$}=u,[j,v]=h.useState(null),[L,R]=h.useState({top:0,left:0}),[E,I]=h.useState(null),q=h.useRef(null),[D,F]=h.useState(!1),X=(m,N)=>{const y=[...s],[Y]=y.splice(m,1);y.splice(N,0,Y),i(y)};h.useEffect(()=>{const m=()=>{v(null),F(!1)};return document.body.addEventListener("click",m),v(null),F(!1),()=>{v(null),F(!1),document.body.removeEventListener("click",m)}},[]),h.useEffect(()=>{if(j){const m=[...s].map(N=>N.id===j.id?j:N);i(m)}},[j]),h.useEffect(()=>{if(q.current&&E){const m=q.current.getBoundingClientRect().height,N=window.innerHeight;let y=E.top;y+m>N+window.scrollY-200&&(y=N+window.scrollY-m-200),y<0&&(y=10),R({top:y,left:E.left})}},[q.current,E]);const Z=(m,N)=>{m.stopPropagation();const y=m.target.getBoundingClientRect();I({top:y.top+window.scrollY,left:y.left-30}),v(N),F(!0)};function b(m){if(x)return m?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${m[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const B=(m,N)=>{var Y;const y=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[l&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),g==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:A=>{const V=[...s],st=p.find(at=>at.name===A);if(!st)return;const tt=V.map(at=>at.id===m.id?{...st,name:A}:at);v({...m,name:A}),i([...tt])},value:m.name,options:p.filter(A=>!s.find(V=>V.name===A.name)).map(A=>A.name),leftAddon:b(m.images)}),g==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:A=>{const st=[...s].map(tt=>tt.id===m.id?{...m,name:A}:tt);i([...st])},value:m.name,placeholder:_}),g==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:A=>{const st=[...s].map(tt=>tt.id===m.id?{...m,images:A}:tt);i([...st])},activeImage:(Y=s.find(A=>A.id===m.id))==null?void 0:Y.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:M.buttons,children:[n&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:A=>Z(A,m)}),d&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>i(s.filter(A=>A.id!==m.id))})]})]});return l?t.jsxRuntimeExports.jsx(fe,{product:m,index:N,moveProduct:X,children:y},m.id):t.jsxRuntimeExports.jsx("div",{className:M.product,children:y},m.id)};return t.jsxRuntimeExports.jsxs("div",{className:M.productsBlock,children:[(c||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:M.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:M.title,children:c}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:m=>e==null?void 0:e(m)})]}),j&&n&&f&&D&&t.jsxRuntimeExports.jsx(he,{ref:q,activeItem:j,setActiveItem:v,popupPosition:L,modalOptions:f,setIsOpenModal:F}),T&&P&&t.jsxRuntimeExports.jsx(ut,{...P}),t.jsxRuntimeExports.jsxs("div",{className:M.products,children:[r&&t.jsxRuntimeExports.jsx("h5",{className:M.subtitle,children:r}),l?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:s.map((m,N)=>B(m,N))}):s.map((m,N)=>B(m,N)),S&&t.jsxRuntimeExports.jsx("div",{className:M.addButton,children:t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:t.clx(M.button,{[M.disabled]:!!(k&&k<=s.length||s.length===(p==null?void 0:p.length))}),size:"s",disabled:!!(k&&k<=s.length||s.length===(p==null?void 0:p.length)),onClick:()=>{const m=[...s];let N=null;if(p){for(let y=0;y<p.length;y++)if(!s.find(Y=>Y.id===p[y].id)){N=p[y];break}}g==="select"?m.push({name:N?N.name:p[0].name,id:(N==null?void 0:N.id)||p[0].id,...O}):g==="input"?m.push({name:"",id:t.v4(),...O}):m.push({name:`Image ${s.length+1}`,id:t.v4(),...O}),i(m)},style:{width:"fit-content"},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(dt,{items:a}),$!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String($.scrollInterval),onChange:m=>$.setScrollInterval(Number(m)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},be="_title_1jjcw_1",ve="_subtitle_1jjcw_5",Ee="_header_1jjcw_12",Re="_text_1jjcw_13",ye="_productsBlock_1jjcw_14",Ie="_top_1jjcw_26",we="_itemsBlock_1jjcw_35",ke="_typeTexts_1jjcw_41",$e="_block_1jjcw_48",Ne="_active_1jjcw_61",Ce="_products_1jjcw_14",Se="_product_1jjcw_14",Be="_button_1jjcw_80",Te="_disabled_1jjcw_91",Pe="_image_1jjcw_95",Ae="_info_1jjcw_102",Oe="_name_1jjcw_114",qe="_buttons_1jjcw_118",De="_modal_1jjcw_125",Le="_link_1jjcw_145",Me="_modalOptions_1jjcw_151",He="_addButton_1jjcw_157",W={title:be,subtitle:ve,header:Ee,text:Re,productsBlock:ye,top:Ie,itemsBlock:we,typeTexts:ke,block:$e,active:Ne,products:Ce,product:Se,button:Be,disabled:Te,image:Pe,info:Ae,name:Oe,buttons:qe,modal:De,link:Le,modalOptions:Me,addButton:He},ze=u=>{const{isActiveItems:o,setIsActiveItems:e,items:s,setItems:i,other:a,title:c,subtitle:r,draggable:n=!1,withImage:l=!1,addable:x=!0,itemsOptions:d,hasRangeSelector:S=!1,rangeSelectorOptions:g,limit:_,autoScrollInterval:p}=u;function T(f){if(l)return f?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${f[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const P=f=>{const O=d.find($=>$.id===f);if(!O)return;const k=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[n&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Select,{onChange:$=>{const j=[...s],v=d.find(E=>E.name===$);if(!v)return;const L=v.id,R=j.map(E=>E===f?L:E);i([...R])},value:O.name,options:d.filter($=>!s.find(j=>j===$.id)).map($=>$.name),leftAddon:T(O.images)}),t.jsxRuntimeExports.jsx("div",{className:W.buttons,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>i(s.filter($=>$!==f))})})]});return t.jsxRuntimeExports.jsx("div",{className:W.product,children:k},f)};return t.jsxRuntimeExports.jsxs("div",{className:W.productsBlock,children:[(c||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:W.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:W.title,children:c}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:f=>e==null?void 0:e(f)})]}),S&&g&&t.jsxRuntimeExports.jsx(ut,{...g}),t.jsxRuntimeExports.jsxs("div",{className:W.products,children:[r&&t.jsxRuntimeExports.jsx("h5",{className:W.subtitle,children:r}),s.map(f=>P(f)),x&&t.jsxRuntimeExports.jsx("div",{className:W.addButton,children:t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:t.clx(W.button,{[W.disabled]:!!(_&&_<=s.length||s.length===d.length)}),size:"s",disabled:!!(_&&_<=s.length||s.length===d.length),onClick:()=>{const f=[...s];let O=null;if(d){for(let k=0;k<d.length;k++)if(!s.find($=>$===d[k].id)){O=d[k];break}}f.push((O==null?void 0:O.id)||d[0].id),i(f)},style:{width:"fit-content"},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(dt,{items:a}),p!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(p.scrollInterval),onChange:f=>p.setScrollInterval(Number(f)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},Fe="_title_iqcxl_1",Ve="_subtitle_iqcxl_5",Ue="_header_iqcxl_12",Ye="_text_iqcxl_13",Ge="_productsBlock_iqcxl_14",We="_top_iqcxl_26",Xe="_itemsBlock_iqcxl_35",Je="_typeTexts_iqcxl_41",Qe="_block_iqcxl_48",Ke="_active_iqcxl_61",Ze="_products_iqcxl_14",ts="_product_iqcxl_14",es="_button_iqcxl_80",ss="_disabled_iqcxl_91",ns="_image_iqcxl_95",is="_info_iqcxl_102",os="_name_iqcxl_114",rs="_buttons_iqcxl_118",as="_modal_iqcxl_125",cs="_link_iqcxl_146",ls="_modalOptions_iqcxl_152",ds="_addButton_iqcxl_164",z={title:Fe,subtitle:Ve,header:Ue,text:Ye,productsBlock:Ge,top:We,itemsBlock:Xe,typeTexts:Je,block:Qe,active:Ke,products:Ze,product:ts,button:es,disabled:ss,image:ns,info:is,name:os,buttons:rs,modal:as,link:cs,modalOptions:ls,addButton:ds},us=h.forwardRef((u,o)=>{const{activeItem:e,setActiveItem:s,popupPosition:i,modalOptions:a,setIsOpenModal:c}=u;function r(n,l){return n.length>l?`${n.slice(0,l)}...`:n}return t.jsxRuntimeExports.jsxs("div",{ref:o,className:z.modal,onClick:n=>{n.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:z.top,children:[t.jsxRuntimeExports.jsx("h3",{className:z.title,children:r(e.name,20)}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{s(null),c(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:z.modalOptions,children:a.map(n=>{if(n.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[n.field],onChange:l=>{const x={...e,[n.field]:l};s(x)}},String(n.field));if(n.type==="text")return t.jsxRuntimeExports.jsx(ht,{typesText:e[n.field.type],setTypesText:l=>{const x={...e,[n.field.type]:l};s(x)},text:e[n.field.text]||"",setText:l=>{const x={...e,[n.field.text]:l};s(x)},subtitle:n.label});if(n.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:l=>{const x={...e,[n.field]:l};s(x)},value:e[n.field]||"",label:n.label,placeholder:n.placeholder});if(n.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:z.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:l=>{const x={...e,[n.field.text]:l};s(x)},value:e[n.field.text]||"",label:n.inputLabel,placeholder:n.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[n.field.switch]||!1,label:n.switchLabel,onChange:l=>{const x={...e,[n.field.switch]:l};s(x)}})]});if(n.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:n.itemsOptions,onChange:l=>{const x={...e,[n.field]:l};s(x)},label:n.label,value:e[n.field]||"String",leftAddon:n.leftAddon&&n.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[n.field]})})})})]})}),xs=u=>{const{index:o,moveProduct:e,children:s}=u,[,i]=t.useDrop({accept:"product",hover(r){r.index!==o&&(e(r.index,o),r.index=o)}}),[{isDragging:a},c]=t.useDrag({type:"product",item:{index:o},collect:r=>({isDragging:r.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:r=>c(i(r)),className:`${z.product} ${a?z.dragging:""}`,children:s})},ms=u=>{const{isActiveItems:o,setIsActiveItems:e,items:s,setItems:i,other:a,title:c,subtitle:r,editable:n=!0,draggable:l=!1,withImage:x=!1,deletable:d=!0,addable:S=!0,itemsType:g,itemsPlaceholder:_="",itemsOptions:p,hasRangeSelector:T=!1,rangeSelectorOptions:P,modalOptions:f,addableOptions:O={}}=u,[k,$]=h.useState(null),[j,v]=h.useState({top:0,left:0}),[L,R]=h.useState(null),E=h.useRef(null),[I,q]=h.useState(!1),D=(b,B)=>{const m=[...s],[N]=m.splice(b,1);m.splice(B,0,N),i(m)};h.useEffect(()=>{const b=()=>{$(null),q(!1)};return document.body.addEventListener("click",b),$(null),q(!1),()=>{$(null),q(!1),document.body.removeEventListener("click",b)}},[]),h.useEffect(()=>{if(k){const b=[...s].map(B=>B.id===k.id?k:B);i(b)}},[k]),h.useEffect(()=>{if(E.current&&L){const b=E.current.getBoundingClientRect().height,B=window.innerHeight;let m=L.top;m+b>B+window.scrollY-200&&(m=B+window.scrollY-b-200),m<0&&(m=10),v({top:m,left:L.left})}},[E.current,L]);const F=(b,B)=>{b.stopPropagation();const m=b.target.getBoundingClientRect();R({top:m.top+window.scrollY,left:m.left-30}),$(B),q(!0)};function X(b){if(x)return b?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${b[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const Z=(b,B)=>{var N;const m=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[l&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),g==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:y=>{const A=[...s].map(V=>V.id===b.id?{...b,name:y}:V);$({...b,name:y}),i([...A])},value:b.name,options:p.filter(y=>!s.find(Y=>Y.name===y)),leftAddon:X(b.images)}),g==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:y=>{const A=[...s].map(V=>V.id===b.id?{...b,name:y}:V);i([...A])},value:b.name,placeholder:_}),g==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:y=>{const A=[...s].map(V=>V.id===b.id?{...b,images:y}:V);i([...A])},activeImage:(N=s.find(y=>y.id===b.id))==null?void 0:N.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:z.buttons,children:[n&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:y=>F(y,b)}),d&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>i(s.filter(y=>y.id!==b.id))})]})]});return l?t.jsxRuntimeExports.jsx(xs,{product:b,index:B,moveProduct:D,children:m},b.id):t.jsxRuntimeExports.jsx("div",{className:z.product,children:m},b.id)};return t.jsxRuntimeExports.jsxs("div",{className:z.productsBlock,children:[(c||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:z.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:z.title,children:c}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:b=>e==null?void 0:e(b)})]}),k&&n&&f&&I&&t.jsxRuntimeExports.jsx(us,{ref:E,activeItem:k,setActiveItem:$,popupPosition:j,modalOptions:f,setIsOpenModal:q}),T&&P&&t.jsxRuntimeExports.jsx(ut,{...P}),t.jsxRuntimeExports.jsxs("div",{className:z.products,children:[r&&t.jsxRuntimeExports.jsx("h5",{className:z.subtitle,children:r}),l?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:s.map((b,B)=>Z(b,B))}):s.map((b,B)=>Z(b,B)),S&&t.jsxRuntimeExports.jsx("div",{className:z.addButton,children:t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:z.button,size:"s",onClick:()=>{const b=[...s];let B=null;if(p){for(let m=0;m<p.length;m++)if(!s.find(N=>N.name===p[m])){B=p[m];break}}g==="select"?b.push({name:B||p[0],id:t.v4(),...O}):g==="input"?b.push({name:"",id:t.v4(),...O}):b.push({name:`Image ${s.length+1}`,id:t.v4(),...O}),i(b)},style:{width:"fit-content"},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(dt,{items:a})]})},ps="_title_oravb_1",hs="_subtitle_oravb_5",_s="_header_oravb_12",js="_text_oravb_13",gs="_productsBlock_oravb_14",fs="_buttonsBlock_oravb_15",bs="_top_oravb_26",vs="_itemsBlock_oravb_35",Es="_typeTexts_oravb_41",Rs="_block_oravb_48",ys="_active_oravb_60",Is="_products_oravb_14",ws="_product_oravb_14",ks="_button_oravb_15",$s="_image_oravb_90",Ns="_info_oravb_97",Cs="_name_oravb_109",Ss="_buttons_oravb_15",Bs="_modal_oravb_120",Ts="_other_oravb_139",Ps="_options_oravb_145",et={title:ps,subtitle:hs,header:_s,text:js,productsBlock:gs,buttonsBlock:fs,top:bs,itemsBlock:vs,typeTexts:Es,block:Rs,active:ys,products:Is,product:ws,button:ks,image:$s,info:Ns,name:Cs,buttons:Ss,modal:Bs,other:Ts,options:Ps},As=h.forwardRef((u,o)=>{const{activeButton:e,setActiveButton:s,popupPosition:i}=u,[a,c]=h.useState(e.typesText),[r,n]=h.useState(e.destination),[l,x]=h.useState(e.page),[d,S]=h.useState(e.link||""),[g,_]=h.useState(e.text||""),[p,T]=h.useState(e.openInNewTab),{pages:P}=t.usePagesStore();return h.useEffect(()=>{s({...e,...{text:g,link:d,destination:r,typesText:a,page:l,openInNewTab:p}})},[a,r,d,g,l,p]),t.jsxRuntimeExports.jsxs("div",{className:et.modal,onClick:f=>{f.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},ref:o,children:[t.jsxRuntimeExports.jsxs("div",{className:et.top,children:[t.jsxRuntimeExports.jsx("h3",{className:et.title,children:e.type}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>s(null)})]}),t.jsxRuntimeExports.jsxs("div",{className:et.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:f=>n(f),options:["Go to Page","Open Link"].filter(f=>f!==r),value:r}),r==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:f=>x(f),options:P?Object.values(P).filter(f=>f.name!==l).map(f=>f.name):[],value:l}):t.jsxRuntimeExports.jsx(t.Input,{onChange:f=>S(f),value:d,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:e.openInNewTab,label:"Open in new tab",onChange:f=>T(f)}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:f=>_(f),value:g,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(pt,{typesText:a,setTypesText:c})]})]})}),Os="_subtitle_w0d5g_1",qs="_header_w0d5g_8",Ds="_text_w0d5g_9",Ls="_productsBlock_w0d5g_10",Ms="_buttonsBlock_w0d5g_11",Hs="_top_w0d5g_23",zs="_itemsBlock_w0d5g_32",Fs="_typeTexts_w0d5g_38",Vs="_block_w0d5g_45",Us="_active_w0d5g_58",Ys="_products_w0d5g_10",Gs="_product_w0d5g_10",Ws="_button_w0d5g_11",Xs="_image_w0d5g_88",Js="_info_w0d5g_95",Qs="_name_w0d5g_107",Ks="_buttons_w0d5g_11",Zs="_modal_w0d5g_118",tn="_other_w0d5g_138",en="_options_w0d5g_144",sn="_addButton_w0d5g_150",nt={subtitle:Os,header:qs,text:Ds,productsBlock:Ls,buttonsBlock:Ms,top:Hs,itemsBlock:zs,typeTexts:Fs,block:Vs,active:Us,products:Ys,product:Gs,button:Ws,image:Xs,info:Js,name:Qs,buttons:Ks,modal:Zs,other:tn,options:en,addButton:sn},jt=u=>{const{buttons:o,setButtons:e,deletable:s=!0,addable:i=!0}=u,[a,c]=h.useState(null),[r,n]=h.useState({top:0,left:0}),[l,x]=h.useState(null),d=h.useRef(null);h.useEffect(()=>{const g=()=>{c(null)};return document.body.addEventListener("click",g),c(null),()=>{c(null),document.body.removeEventListener("click",g)}},[]),h.useEffect(()=>{if(a){const g=[...o].map(_=>_.id===a.id?a:_);e(g)}},[a]),h.useEffect(()=>{if(d.current&&l){const g=d.current.getBoundingClientRect().height,_=window.innerHeight;let p=l.top;p+g>_+window.scrollY-200&&(p=_+window.scrollY-g-200),p<0&&(p=10),n({top:p,left:l.left})}},[d.current,l]);const S=(g,_)=>{g.stopPropagation();const p=g.target.getBoundingClientRect();x({top:p.top+window.scrollY,left:p.left-30}),c(_)};return t.jsxRuntimeExports.jsxs("div",{className:nt.products,children:[t.jsxRuntimeExports.jsx("h5",{className:nt.subtitle,children:"Button Type"}),o.map(g=>t.jsxRuntimeExports.jsxs("div",{className:nt.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:_=>{const T=[...o].map(P=>P.id===g.id?{...g,type:_}:P);e(T)},value:g.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:nt.buttons,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:_=>{S(_,g)}}),s&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const _=o.filter(p=>p.id!==g.id);e(_)},width:20,height:20,fill:"#C12A2A"})]})]},g.id)),a&&t.jsxRuntimeExports.jsx(As,{ref:d,activeButton:a,setActiveButton:c,popupPosition:r}),i&&t.jsxRuntimeExports.jsx("div",{className:nt.addButton,children:t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:nt.button,size:"s",onClick:()=>{const g=[...o];g.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:"Button Name",page:"home",openInNewTab:!0}),e(g)},style:{width:"fit-content"},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})]})},nn=u=>{const{isActiveButtons:o,setIsActiveButtons:e,buttons:s,setButtons:i}=u;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:et.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:et.top,children:[t.jsxRuntimeExports.jsx("h3",{className:et.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:a=>e(a)})]}),t.jsxRuntimeExports.jsx(jt,{buttons:s,setButtons:i})]})})},on="_wrapper_m18qi_1",rn="_subtitle_m18qi_7",an="_content_m18qi_14",cn="_range_m18qi_22",ln="_track_m18qi_27",dn="_progress_m18qi_36",un="_dots_m18qi_46",xn="_dot_m18qi_46",mn="_active_m18qi_65",pn="_input_m18qi_77",hn="_countBlock_m18qi_91",_n="_count_m18qi_91",jn="_controls_m18qi_107",gn="_button_m18qi_113",H={wrapper:on,subtitle:rn,content:an,range:cn,track:ln,progress:dn,dots:un,dot:xn,active:mn,input:pn,countBlock:hn,count:_n,controls:jn,button:gn},ut=u=>{const{label:o,min:e=1,max:s=4,step:i=1,count:a,setCount:c}=u,[r,n]=h.useState(!1),l=Array.from({length:(s-e)/i+1}),x=(a-e)/(s-e)*100,d=()=>{a<s&&c(a+i)},S=()=>{a>e&&c(a-i)},g=_=>{const p=e+_*i;c(p)};return t.jsxRuntimeExports.jsxs("div",{className:H.wrapper,children:[o&&t.jsxRuntimeExports.jsx("h5",{className:H.subtitle,children:o}),t.jsxRuntimeExports.jsxs("div",{className:H.content,children:[t.jsxRuntimeExports.jsxs("div",{className:H.range,children:[t.jsxRuntimeExports.jsx("div",{className:H.track}),t.jsxRuntimeExports.jsx("div",{className:H.progress,style:{width:`${x}%`}}),t.jsxRuntimeExports.jsx("div",{className:H.dots,children:l.map((_,p)=>{const T=p<=(a-e)/i;return t.jsxRuntimeExports.jsx("button",{onClick:()=>g(p),className:t.clx(H.dot,{[H.active]:T,[H.inactive]:!T,[H.dragging]:r}),"aria-label":`Set value to ${e+p*i}`},p)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:e,max:s,step:i,value:a,onChange:_=>c(Number(_.target.value)),onMouseDown:()=>n(!0),onMouseUp:()=>n(!1),onTouchStart:()=>n(!0),onTouchEnd:()=>n(!1),className:H.input})]}),t.jsxRuntimeExports.jsxs("div",{className:H.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:e,max:s,paddingless:!0,onChange:_=>{const p=Number(_);p>s?c(s):p<e?c(e):c(p)},value:String(a)}),t.jsxRuntimeExports.jsxs("div",{className:H.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:d,disabled:a>=s,className:H.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:S,disabled:a<=e,className:H.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},fn="_title_w64fy_1",bn="_subtitle_w64fy_5",vn="_header_w64fy_12",En="_text_w64fy_13",Rn="_productsBlock_w64fy_14",yn="_top_w64fy_26",In="_itemsBlock_w64fy_35",wn="_typeTexts_w64fy_41",kn="_block_w64fy_48",$n="_active_w64fy_61",Nn="_products_w64fy_14",Cn="_product_w64fy_14",Sn="_button_w64fy_80",Bn="_image_w64fy_91",Tn="_info_w64fy_98",Pn="_name_w64fy_110",An="_buttons_w64fy_114",On="_modal_w64fy_121",qn="_link_w64fy_141",Dn="_modalOptions_w64fy_147",Ln="_addButton_w64fy_159",U={title:fn,subtitle:bn,header:vn,text:En,productsBlock:Rn,top:yn,itemsBlock:In,typeTexts:wn,block:kn,active:$n,products:Nn,product:Cn,button:Sn,image:Bn,info:Tn,name:Pn,buttons:An,modal:On,link:qn,modalOptions:Dn,addButton:Ln},Mn=u=>{const{activeItem:o,setActiveItem:e,popupPosition:s,setIsOpenModal:i,itemsOptions:a}=u,c=a.find(n=>n.id===o.listingId);if(!c)return null;function r(n,l){return n.length>l?`${n.slice(0,l)}...`:n}return t.jsxRuntimeExports.jsxs("div",{className:U.modal,onClick:n=>{n.stopPropagation()},style:{top:`${s.top}px`,left:`${s.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:U.top,children:[t.jsxRuntimeExports.jsx("h3",{children:r(c.productData.name,20)}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{i(!1),e(null)}})]}),t.jsxRuntimeExports.jsx("div",{className:U.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:c.productData.images.length>0?c.productData.images[0].cfId:void 0,onChange:n=>{const l={...o,image:n[0]};e(l)}})})]})},Hn=u=>{const{index:o,moveProduct:e,children:s}=u,[,i]=t.useDrop({accept:"product",hover(r){r.index!==o&&(e(r.index,o),r.index=o)}}),[{isDragging:a},c]=t.useDrag({type:"product",item:{index:o},collect:r=>({isDragging:r.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:r=>c(i(r)),className:`${U.product} ${a?U.dragging:""}`,children:s})},zn=u=>{const{isActiveItems:o,setIsActiveItems:e,items:s,setItems:i,other:a,title:c,subtitle:r,editable:n=!0,draggable:l=!1,withImage:x=!1,deletable:d=!0,addable:S=!0,itemsType:g,itemsOptions:_}=u,[p,T]=h.useState(null),[P,f]=h.useState({top:0,left:0}),[O,k]=h.useState(!1),$=(R,E)=>{const I=[...s],[q]=I.splice(R,1);I.splice(E,0,q),i(I)};h.useEffect(()=>{const R=()=>{T(null),k(!1)};return document.body.addEventListener("click",R),T(null),k(!1),()=>{T(null),k(!1),document.body.removeEventListener("click",R)}},[]),h.useEffect(()=>{if(p){const R=[...s].map(E=>E.listingId===p.listingId?p:E);i(R)}},[p]);const j=(R,E)=>{R.stopPropagation();const I=R.target.getBoundingClientRect(),q=100,D=window.innerHeight;let F=I.top+window.scrollY;F+q>D&&(F=D-q-20),k(!0),f({top:F-80,left:I.left-30}),T(E)};function v(R){if(x)return R?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${R}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const L=(R,E)=>{const I=_.find(D=>R.listingId===D.id);if(!I)return null;const q=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[l&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})},E),g==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:D=>{const F=[...s],X=_.find(B=>B.productData.name===D);if(!X)return;const Z={listingId:X.id,image:X.productData.images.length>0?X.productData.images[0].cfId:""},b=F.map(B=>B.listingId===R.listingId?Z:B);T(Z),i([...b])},value:I.productData.name,options:[..._.filter(D=>!s.find(F=>F.listingId===D.id)).map(D=>D.productData.name)],leftAddon:v(R.image||I.productData.images.length>0&&I.productData.images[0].cfId||"")},E),t.jsxRuntimeExports.jsxs("div",{className:U.buttons,children:[n&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:D=>j(D,R)}),d&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>i(s.filter(D=>D!==R))})]})]});return l?t.jsxRuntimeExports.jsx(Hn,{product:R,index:E,moveProduct:$,children:q},R.listingId):t.jsxRuntimeExports.jsx("div",{className:U.product,children:q},R.listingId)};return t.jsxRuntimeExports.jsxs("div",{className:U.productsBlock,children:[(c||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:U.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:U.title,children:c}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:R=>e==null?void 0:e(R)})]}),O&&p&&t.jsxRuntimeExports.jsx(Mn,{activeItem:p,setActiveItem:T,setIsOpenModal:k,popupPosition:P,itemsOptions:_}),t.jsxRuntimeExports.jsxs("div",{className:U.products,children:[r&&t.jsxRuntimeExports.jsx("h5",{className:U.subtitle,children:r}),l?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:s.map((R,E)=>L(R,E))}):s.map((R,E)=>L(R,E)),S&&t.jsxRuntimeExports.jsx("div",{className:U.addButton,children:t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:U.button,size:"s",onClick:()=>{const R=[...s];for(let E=0;E<_.length;E++)if(!s.find(I=>I.listingId===_[E].id)){R.push({listingId:_[E].id,image:_[E].productData.images.length>0?_[E].productData.images[0].cfId:""});break}i(R)},disabled:s.length===_.length,style:{width:"fit-content"},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(dt,{items:a})]})},Fn="_options_jdafm_1",Vn="_price_jdafm_12",Un="_oldPrice_jdafm_19",Yn="_newPrice_jdafm_27",Gn="_animate_jdafm_34",Wn="_appearAndBounce_jdafm_1",Xn="_meta_jdafm_52",Jn="_info_jdafm_58",Qn="_infoRight_jdafm_66",Kn="_buttons_jdafm_73",Zn="_variants_jdafm_80",ti="_variant_jdafm_80",ei="_stock_jdafm_97",si="_variantInfo_jdafm_104",ni="_quantity_jdafm_110",ii="_count_jdafm_117",oi="_focused_jdafm_134",ri="_button_jdafm_73",ai="_activeVariant_jdafm_160",ci="_chargeTypes_jdafm_164",li="_charge_jdafm_164",di="_chargeActive_jdafm_189",ui="_title_jdafm_197",w={options:Fn,price:Vn,oldPrice:Un,newPrice:Yn,animate:Gn,appearAndBounce:Wn,meta:Xn,info:Jn,infoRight:Qn,buttons:Kn,variants:Zn,variant:ti,stock:ei,variantInfo:si,quantity:ni,count:ii,focused:oi,button:ri,activeVariant:ai,chargeTypes:ci,charge:li,chargeActive:di,title:ui};var gt=(u=>(u.ONE_TIME="One-Time",u.RECURRING="Subscribe & Save",u))(gt||{});const xi=u=>{var k,$;const{variants:o}=u,[e,s]=h.useState(o[0]),[i,a]=h.useState(e.chargeTypes[0]),c=t.useNavigate(),[r,n]=h.useState(1),[l,x]=h.useState(!1),{reset:d,addProductToCart:S,getProducts:g}=t.useCart(),[_,p]=h.useState(!1);h.useEffect(()=>{p(!0);const j=setTimeout(()=>p(!1),600);return()=>clearTimeout(j)},[r]);async function T(){await g(),await S({productId:u.id,productVariantId:e.id,quantity:r})}function P(){d(),T(),c("/checkout")}function f(j){if(j>=864e5){const I=Math.floor(j/864e5);return`${I} ${I===1?"day":"days"}`}else if(j>=36e5){const I=Math.floor(j/36e5);return`${I} ${I===1?"hour":"hours"}`}else if(j>=6e4){const I=Math.floor(j/6e4);return`${I} ${I===1?"minute":"minutes"}`}else{const I=Math.floor(j/1e3);return`${I} ${I===1?"second":"seconds"}`}}function O(j,v){return j.length>v?j.slice(0,v)+"...":j}return t.jsxRuntimeExports.jsxs("div",{className:w.options,children:[e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:w.chargeTypes,children:e.chargeTypes.map(j=>t.jsxRuntimeExports.jsx("div",{className:t.clx(w.charge,{[w.chargeActive]:i===j}),onClick:()=>a(j),children:gt[j]},j))}),t.jsxRuntimeExports.jsx("div",{className:w.variants,children:o.map(j=>{var v;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(w.variant,{[w.activeVariant]:e.id===j.id}),onClick:()=>s(j),children:[t.jsxRuntimeExports.jsxs("div",{className:w.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:w.title,children:O(j.name,15)}),t.jsxRuntimeExports.jsxs("span",{children:["$",i==="ONE_TIME"?j.price.amount:j.subscriptionSettings?j.subscriptionSettings.price.amount:"Price Not Found"]})]}),t.jsxRuntimeExports.jsx("div",{children:i==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:w.stock,children:[((v=j.quantity.restrictions)==null?void 0:v.max)||j.quantity.available||0," in stock"]})})]},j.id)})}),i==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("div",{className:w.quantity,children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>{r>1?n(j=>j-1):n(1)},className:w.button,disabled:e.quantity.restrictions&&r<=e.quantity.restrictions.min,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx("label",{className:t.clx(w.count,{[w.focused]:l}),onFocus:()=>x(!0),onBlur:()=>x(!1),children:t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(r),onChange:j=>n(Number(j)),max:((k=e.quantity.restrictions)==null?void 0:k.max)||e.quantity.available||1/0,min:(($=e.quantity.restrictions)==null?void 0:$.min)||0,style:{backgroundColor:"transparent",border:"none",textAlign:"center"}})}),t.jsxRuntimeExports.jsx("button",{onClick:()=>{n(j=>j+1)},className:w.button,disabled:!!(e.quantity.restrictions&&r>=e.quantity.restrictions.max||e.quantity.available&&r>=e.quantity.available),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:w.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:w.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:w.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"#FF3F19",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{children:!e.deliveryTime||e.deliveryTime===0?"Instant":f(e.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:w.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:w.infoRight,children:i==="ONE_TIME"?e.compareAtPrice&&(e.compareAtPrice.amount||0)-(e.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:w.price,children:[t.jsxRuntimeExports.jsxs("span",{className:t.clx(w.newPrice,{[w.animate]:_}),children:["$ ",(e.price.amount||0)*r]}),t.jsxRuntimeExports.jsxs("span",{className:w.oldPrice,children:["$ ",(e.compareAtPrice.amount||0)*r]})]}):t.jsxRuntimeExports.jsxs("span",{className:t.clx(w.newPrice,{[w.animate]:_}),children:["$ ",(e.price.amount||0)*r]}):e.subscriptionSettings&&e.subscriptionSettings.compareAtPrice&&(e.subscriptionSettings.compareAtPrice.amount||0)-(e.subscriptionSettings.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:w.price,children:[t.jsxRuntimeExports.jsxs("span",{className:t.clx(w.newPrice,{[w.animate]:_}),children:["$ ",e.subscriptionSettings.price.amount||0]}),t.jsxRuntimeExports.jsxs("span",{className:w.oldPrice,children:["$ ",e.subscriptionSettings.compareAtPrice.amount||0]})]}):e.subscriptionSettings&&t.jsxRuntimeExports.jsxs("span",{className:t.clx(w.newPrice,{[w.animate]:_}),children:["$ ",e.subscriptionSettings.price.amount||0]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:w.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:()=>P(),children:t.jsxRuntimeExports.jsx("span",{children:i==="ONE_TIME"?"Buy Now":"Subscribe Now"})}),i==="ONE_TIME"&&t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:()=>T(),children:"Add to Cart"})]})]})},mi="_button_1861a_1",pi="_login_1861a_14",hi="_signUp_1861a_18",_i="_buttons_1861a_23",ji="_modal_1861a_32",gi="_info_1861a_60",fi="_top_1861a_67",bi="_title_1861a_78",vi="_clear_1861a_84",Ei="_activeClear_1861a_91",Ri="_count_1861a_95",yi="_cart_1861a_110",Ii="_empty_1861a_118",wi="_product_1861a_144",ki="_products_1861a_153",$i="_image_1861a_161",Ni="_productInfo_1861a_167",Ci="_content_1861a_174",Si="_name_1861a_180",Bi="_price_1861a_186",Ti="_productButtons_1861a_192",Pi="_productButton_1861a_192",Ai="_productCount_1861a_212",Oi="_bottom_1861a_228",qi="_subtotal_1861a_236",Di="_block_1861a_244",Li="_shoppingCount_1861a_251",Mi="_total_1861a_271",Hi="_link_1861a_277",zi="_userInfo_1861a_284",C={button:mi,login:pi,signUp:hi,buttons:_i,modal:ji,info:gi,top:fi,title:bi,clear:vi,activeClear:Ei,count:Ri,cart:yi,empty:Ii,product:wi,products:ki,image:$i,productInfo:Ni,content:Ci,name:Si,price:Bi,productButtons:Ti,productButton:Pi,productCount:Ai,bottom:Oi,subtotal:qi,block:Di,shoppingCount:Li,total:Mi,link:Hi,userInfo:zi},Fi="_button_bymeg_1",Vi="_primary_bymeg_19",Ui="_primaryHovered_bymeg_30",Yi="_secondary_bymeg_34",Gi="_secondaryHovered_bymeg_44",Wi="_tertiary_bymeg_48",Xi="_tertiaryHovered_bymeg_58",Ji="_content_bymeg_62",J={button:Fi,primary:Vi,primaryHovered:Ui,secondary:Yi,secondaryHovered:Gi,tertiary:Wi,tertiaryHovered:Xi,content:Ji},lt=u=>{const{children:o,onClick:e,style:s,className:i,disabled:a=!1,type:c="Primary"}=u,{themeSettings:r}=t.useThemeSettingsStore();return t.jsxRuntimeExports.jsx("button",{className:t.clx(J.button,i,{[J.primary]:c==="Primary",[J.secondary]:c==="Secondary",[J.tertiary]:c==="Tertiary",[J.primaryHovered]:c==="Primary"&&!a&&r.buttons.primary.hover,[J.secondaryHovered]:c==="Secondary"&&!a&&r.buttons.secondary.hover,[J.tertiaryHovered]:c==="Tertiary"&&!a&&r.buttons.tertiary.hover}),onClick:e,style:{...s},disabled:a,children:c==="Tertiary"?t.jsxRuntimeExports.jsxs("div",{className:J.content,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowRight",fill:"#757575",width:20,height:20}),o]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:o})})};class rt extends Error{}rt.prototype.name="InvalidTokenError";function Qi(u){return decodeURIComponent(atob(u).replace(/(.)/g,(o,e)=>{let s=e.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function Ki(u){let o=u.replace(/-/g,"+").replace(/_/g,"/");switch(o.length%4){case 0:break;case 2:o+="==";break;case 3:o+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Qi(o)}catch{return atob(o)}}function Zi(u,o){if(typeof u!="string")throw new rt("Invalid token specified: must be a string");o||(o={});const e=o.header===!0?0:1,s=u.split(".")[e];if(typeof s!="string")throw new rt(`Invalid token specified: missing part #${e+1}`);let i;try{i=Ki(s)}catch(a){throw new rt(`Invalid token specified: invalid base64 for part #${e+1} (${a.message})`)}try{return JSON.parse(i)}catch(a){throw new rt(`Invalid token specified: invalid json for part #${e+1} (${a.message})`)}}const to=u=>{const{shopping:o,signUp:e}=u,s=t.useNavigate();function i(c){s(c)}const a=JSON.parse(localStorage.getItem("token")||"{}");return t.jsxRuntimeExports.jsxs("div",{className:C.buttons,children:[o&&t.jsxRuntimeExports.jsx(ft,{}),!a.data&&t.jsxRuntimeExports.jsx(lt,{onClick:()=>i("/customer-dash"),type:"Secondary",style:{padding:10},children:"Login"}),!a.data&&e&&t.jsxRuntimeExports.jsx(lt,{onClick:()=>i("/customer-dash"),type:"Primary",style:{padding:10},children:"Sign Up"}),a.data&&t.jsxRuntimeExports.jsx(Et,{token:a.data})]})},ft=()=>{const[u,o]=h.useState(!1),[e,s]=h.useState([]),{cart:i,getProducts:a}=t.useCart();function c(x){for(let d=0;d<i.parts.length;d++)for(let S=0;S<x.variants.length;S++)if(i.parts[d].productVariantId===x.variants[d].id)return i.parts[d].productVariantId}function r(x){for(let d=0;d<i.parts.length;d++)for(let S=0;S<x.variants.length;S++)if(i.parts[d].productVariantId===x.variants[d].id)return i.parts[d].quantity}h.useEffect(()=>{(async()=>{const d=i.parts.map(_=>String(_.productId)),g=(await a([...d])).map(_=>({..._,activeVariantId:c(_),quantity:r(_)}));s(g)})()},[i]);function n(x){var d;return!x||!(x!=null&&x.variants)?!1:(d=x.variants.find(S=>S.id===x.activeVariantId))==null?void 0:d.subscriptionSettings}const l=i.parts.length>0&&e.length>0&&!n(e[0]);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:C.button,onClick:x=>{x.stopPropagation(),window.location.pathname!=="/admin/builder"&&o(!0)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--icon-primary)"}),l&&t.jsxRuntimeExports.jsx("div",{className:C.shoppingCount,children:i.parts.length})]}),u&&t.jsxRuntimeExports.jsx(t.Modal,{close:o,children:t.jsxRuntimeExports.jsx(bt,{activeProducts:e,isCartNotEmpty:l})})]})},bt=u=>{const{activeProducts:o,isCartNotEmpty:e}=u,{cart:s,reset:i,getTotalAndDiscount:a,updateQuantityOfProduct:c}=t.useCart(),r=t.useNavigate();function n(d){r(d)}function l(d){c({productId:d.id,productVariantId:d.activeVariantId,quantity:d.quantity+1})}function x(d){c({productId:d.id,productVariantId:d.activeVariantId,quantity:d.quantity-1})}return t.jsxRuntimeExports.jsxs("div",{className:C.modal,onClick:d=>d.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:C.top,children:[t.jsxRuntimeExports.jsxs("div",{className:C.info,children:[t.jsxRuntimeExports.jsx("span",{className:C.title,children:"Cart"}),e&&t.jsxRuntimeExports.jsx("div",{className:C.count,children:s.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx(C.clear,{[C.activeClear]:e}),disabled:!e,onClick:()=>i(),children:"Clear all"})]}),e?t.jsxRuntimeExports.jsxs("div",{className:C.cart,children:[t.jsxRuntimeExports.jsx("div",{className:C.products,children:o.map(d=>t.jsxRuntimeExports.jsxs("div",{className:C.product,children:[t.jsxRuntimeExports.jsxs("div",{className:C.productInfo,children:[t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${d.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:C.image}),t.jsxRuntimeExports.jsxs("div",{className:C.content,children:[t.jsxRuntimeExports.jsx("div",{className:C.name,children:d.name}),t.jsxRuntimeExports.jsxs("div",{className:C.price,children:["$",d.variants.find(S=>S.id===d.activeVariantId).price.amount*((d==null?void 0:d.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:C.productButtons,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{d.quantity!==1&&x(d)},className:C.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:C.productCount,children:d.quantity}),t.jsxRuntimeExports.jsx("div",{onClick:()=>l(d),className:C.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},d.id))}),t.jsxRuntimeExports.jsxs("div",{className:C.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:C.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:C.block,children:[t.jsxRuntimeExports.jsx("span",{children:"Subtotal"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Info",width:20,height:20,fill:"#757575"})]}),t.jsxRuntimeExports.jsxs("div",{className:C.total,children:["$",a().total]})]}),t.jsxRuntimeExports.jsx(lt,{onClick:()=>n("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(vt,{})]})},vt=()=>t.jsxRuntimeExports.jsxs("div",{className:C.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag"})}),t.jsxRuntimeExports.jsx("span",{children:"Your cart is empty"}),t.jsxRuntimeExports.jsxs("span",{children:["Check out the store's products and add them"," ",t.jsxRuntimeExports.jsx("a",{href:"/products",className:C.link,children:"here"})]})]}),Et=({token:u})=>{const[o,e]=h.useState("test-email@gmail.com"),s=t.useNavigate();h.useEffect(()=>{(async()=>{const c=Zi(u);e(c.email)})()},[u]);function i(a){s(a)}return t.jsxRuntimeExports.jsx("div",{className:C.userInfo,onClick:()=>i("/customer-dash"),children:t.jsxRuntimeExports.jsx("div",{children:o||"test-email@gmail.com"})})},eo="_share_11u0d_1",so="_modal_11u0d_8",no="_header_11u0d_14",io="_socials_11u0d_24",oo="_social_11u0d_24",ro="_copy_11u0d_34",ao="_title_11u0d_41",co="_copyWrapper_11u0d_47",lo="_copyText_11u0d_56",K={share:eo,modal:so,header:no,socials:io,social:oo,copy:ro,title:ao,copyWrapper:co,copyText:lo},uo=()=>{const{isOpenModal:u,setIsOpenModal:o}=t.useShareLinkStore();function e(){o(!0)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button,{className:K.share,onClick:s=>{s.stopPropagation(),e()},type:"Secondary",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Share",fill:"#757575",hoverable:!0})}),u&&t.jsxRuntimeExports.jsx(t.Modal,{close:o,children:t.jsxRuntimeExports.jsx(xo,{})})]})},xo=()=>{const{setIsOpenModal:u}=t.useShareLinkStore(),{notification:o,setNotification:e}=t.useNotificationStore(),s=window.location.href;function i(){navigator.clipboard.writeText(s),e({message:"Link copied to clipboard",status:"success"})}return t.jsxRuntimeExports.jsxs("div",{className:K.modal,onClick:a=>a.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:K.header,children:[t.jsxRuntimeExports.jsx("div",{className:K.title,children:"Share this Post"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",onClick:()=>u(!1),hoverable:!0})]}),t.jsxRuntimeExports.jsxs("div",{className:K.copyWrapper,children:[t.jsxRuntimeExports.jsx("div",{className:t.clx(K.copy,K.copyText),onClick:i,children:s}),t.jsxRuntimeExports.jsx("div",{onClick:i,className:K.copy,children:o?t.jsxRuntimeExports.jsx(t.Icon,{name:"Check"}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})},mo="_accordion_1s1lq_1",po="_header_1s1lq_9",ho="_icon_1s1lq_18",_o="_open_1s1lq_21",jo="_content_1s1lq_25",ot={accordion:mo,header:po,icon:ho,open:_o,content:jo},go=({title:u,content:o})=>{const[e,s]=h.useState(!1),[i,a]=h.useState(0),c=h.useRef(null),r=()=>{s(!e)};return h.useEffect(()=>{c.current&&a(e?c.current.scrollHeight:0)},[e]),t.jsxRuntimeExports.jsxs("div",{className:ot.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:ot.header,onClick:r,children:[t.jsxRuntimeExports.jsx("h5",{id:"h5",children:u}),t.jsxRuntimeExports.jsx("div",{className:t.clx(ot.icon,{[ot.open]:e}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:c,className:ot.content,style:{height:`${i}px`},children:t.jsxRuntimeExports.jsx("p",{id:"p",children:o})})]})},fo="_wrapper_1r14x_1",bo="_label_1r14x_9",vo="_input_1r14x_18",Eo="_required_1r14x_35",Ro="_paddingless_1r14x_39",yo="_content_1r14x_43",Io="_borderless_1r14x_58",wo="_rightIcon_1r14x_63",Q={wrapper:fo,label:bo,input:vo,required:Eo,paddingless:Ro,content:yo,borderless:Io,rightIcon:wo},ko=u=>{const{onChange:o,style:e,label:s,value:i,type:a,min:c,max:r,placeholder:n,disabled:l=!1,required:x=!1,regex:d,paddingless:S=!1,borderless:g=!1,editable:_=!1,isSearch:p=!1}=u,{themeSettings:T}=t.useThemeSettingsStore(),{inputs:P}=T,[f,O]=h.useState(!1);function k(v,L){if(v.startsWith("#")){let I,q,D;return v.length===7?(I=parseInt(v.slice(1,3),16),q=parseInt(v.slice(3,5),16),D=parseInt(v.slice(5,7),16)):v.length===4&&(I=parseInt(v[1]+v[1],16),q=parseInt(v[2]+v[2],16),D=parseInt(v[3]+v[3],16)),`rgba(${I}, ${q}, ${D}, ${L})`}const E={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#00ff00",blue:"#0000ff"}[v.toLowerCase()];return E?k(E,L):v}function $(v){return Number(v)<0?String(c):v}function j(v){return!x||!d?!0:new RegExp(d).test(v)}return t.jsxRuntimeExports.jsxs("div",{className:Q.wrapper,children:[s&&t.jsxRuntimeExports.jsx("label",{className:Q.label,htmlFor:s,children:s}),t.jsxRuntimeExports.jsxs("div",{className:Q.content,style:{paddingRight:P.general.height+15,...e,backgroundColor:k(P.field.color,P.field.opacity/100)},children:[t.jsxRuntimeExports.jsx("input",{id:s,type:a||"text",onChange:v=>{if(a==="text")o(v.target.value);else{const L=$(v.target.value);o(L)}},value:i,autoComplete:"off",placeholder:n||"Type something...",className:t.clx(Q.input,{[Q.required]:f&&x&&!j(i),[Q.paddingless]:S,[Q.borderless]:g}),min:a==="number"?c:void 0,max:a==="number"?r:void 0,disabled:l,onFocus:()=>O(!0)}),p&&t.jsxRuntimeExports.jsx("div",{className:Q.rightIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"MagnifyingGlass",fill:"var(--icon-secondary)",width:P.general.height,height:P.general.height})}),_&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",width:20,height:20,hoverable:!0})})]})]})},$o="_wrapper_st58d_1",No="_label_st58d_10",Co="_textarea_st58d_18",So="_length_st58d_33",ct={wrapper:$o,label:No,textarea:Co,length:So},Bo=u=>{const{onChange:o,label:e,value:s,maxLength:i,placeholder:a="Type something..."}=u,[c,r]=h.useState(s.length);return t.jsxRuntimeExports.jsxs("div",{className:ct.wrapper,children:[e&&t.jsxRuntimeExports.jsx("label",{className:ct.label,htmlFor:e,children:e}),t.jsxRuntimeExports.jsx("textarea",{id:e,defaultValue:s,onChange:n=>{r(n.target.value.length),o(n.target.value)},placeholder:a,className:ct.textarea,maxLength:i}),i&&t.jsxRuntimeExports.jsxs("div",{className:ct.length,children:[c,"/",i]})]})};exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.Icon=t.Icon;exports.InputSettings=t.Input;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.Select=t.Select;exports.Switch=t.Switch;exports.TextareaSettings=t.Textarea;exports.Accordion=go;exports.Button=lt;exports.ButtonTypeSettings=jt;exports.ButtonsSettings=nn;exports.CategorySettings=ze;exports.EmptyCart=vt;exports.FormSettings=ms;exports.HeaderButtons=to;exports.InputUI=ko;exports.ItemsSettings=_t;exports.LayoutSettings=Ot;exports.ListingSelector=zn;exports.ProductOptions=xi;exports.RangeSelector=ut;exports.ShareLink=uo;exports.ShoppingButton=ft;exports.ShoppingModalCart=bt;exports.TextSettings=ht;exports.TextareaUI=Bo;exports.TypesText=pt;exports.UserInfo=Et;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CLg_NJ6J.cjs"),_=require("react");require("@phosphor-icons/react");const Rt="_wrapper_9rr5j_2",yt="_alignmentBlock_9rr5j_8",It="_title_9rr5j_15",kt="_subtitle_9rr5j_22",wt="_alignmentContent_9rr5j_29",$t="_alignments_9rr5j_37",Nt="_alignment_9rr5j_8",Ct="_circle_9rr5j_58",St="_paddings_9rr5j_65",Bt="_padding_9rr5j_65",Tt="_input_9rr5j_84",G={wrapper:Rt,alignmentBlock:yt,title:It,subtitle:kt,alignmentContent:wt,alignments:$t,alignment:Nt,circle:Ct,paddings:St,padding:Bt,input:Tt},Pt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],qt=["left","top","right","bottom"],At=u=>{const{alignment:o,padding:e,setPadding:s,setAlignment:i}=u;function a(){switch(o){case"left":case"topLeft":case"bottomLeft":return"TextAlignLeft";case"right":case"topRight":case"bottomRight":return"TextAlignRight";case"center":case"top":case"bottom":return"TextAlignCenter";default:return"TextAlignCenter"}}function c(r){switch(r){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}return t.jsxRuntimeExports.jsxs("div",{className:G.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:G.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:G.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:G.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:G.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:G.alignments,children:Pt.map(r=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{i(r)},className:G.alignment,children:[r!==o&&t.jsxRuntimeExports.jsx("div",{className:G.circle}),r===o&&t.jsxRuntimeExports.jsx(t.Icon,{name:a(),fill:"#FF3F19",width:22,height:22})]},r))}),t.jsxRuntimeExports.jsx("div",{className:G.paddings,children:qt.map(r=>t.jsxRuntimeExports.jsxs("label",{className:G.padding,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:c(r),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(e[r]),onChange:n=>s({...e,[r]:Number(n)}),paddingless:!0,borderless:!0})]},r))})]})]})]})},Ot="_title_voimd_1",Dt="_subtitle_voimd_5",Lt="_header_voimd_12",Mt="_text_voimd_13",Ht="_top_voimd_20",zt="_itemsBlock_voimd_29",it={title:Ot,subtitle:Dt,header:Lt,text:Mt,top:Ht,itemsBlock:zt},Ft="_typeTexts_167ez_1",Vt="_block_167ez_8",Ut="_active_167ez_25",xt={typeTexts:Ft,block:Vt,active:Ut},Yt=["bold","italic","underline","strike-through","code"],pt=u=>{const{typesText:o,setTypesText:e}=u;function s(i){switch(i){case"bold":return"TextB";case"italic":return"TextItalic";case"code":return"CodeSimple";case"strike-through":return"TextStrikethrough";case"underline":return"TextUnderline"}}return t.jsxRuntimeExports.jsx("div",{className:xt.typeTexts,children:Yt.map(i=>t.jsxRuntimeExports.jsx("div",{className:t.clx(xt.block,{[xt.active]:o.includes(i)}),onClick:()=>{const a=[...o];if(a.includes(i)){const c=a.filter(r=>r!==i);e(c)}else a.push(i),e(a)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:s(i),fill:o.includes(i)?"#252525":"#757575",width:20,height:20})},String(i)))})},ht=u=>{const{typesText:o,isActiveText:e,setIsActiveText:s,text:i,setText:a,setTypesText:c,title:r,subtitle:n="Items"}=u;return t.jsxRuntimeExports.jsxs("div",{className:it.text,children:[(r||e!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:it.top,children:[r&&t.jsxRuntimeExports.jsx("h3",{className:it.title,children:r}),e!==void 0&&s&&t.jsxRuntimeExports.jsx(t.Switch,{current:e,onChange:l=>s(l)})]}),t.jsxRuntimeExports.jsxs("div",{className:it.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:it.subtitle,children:n}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:l=>a(l),value:i,maxLength:150}),t.jsxRuntimeExports.jsx(pt,{typesText:o,setTypesText:c})]})]})},Gt="_title_vzbkd_1",Wt="_subtitle_vzbkd_5",Xt="_header_vzbkd_12",Jt="_text_vzbkd_13",Qt="_productsBlock_vzbkd_14",Kt="_top_vzbkd_26",Zt="_itemsBlock_vzbkd_35",te="_typeTexts_vzbkd_41",ee="_block_vzbkd_48",se="_active_vzbkd_61",ne="_products_vzbkd_14",ie="_product_vzbkd_14",oe="_button_vzbkd_80",re="_disabled_vzbkd_91",ae="_image_vzbkd_95",ce="_info_vzbkd_102",le="_name_vzbkd_114",de="_buttons_vzbkd_118",ue="_modal_vzbkd_125",xe="_link_vzbkd_145",me="_modalOptions_vzbkd_151",pe="_addButton_vzbkd_163",M={title:Gt,subtitle:Wt,header:Xt,text:Jt,productsBlock:Qt,top:Kt,itemsBlock:Zt,typeTexts:te,block:ee,active:se,products:ne,product:ie,button:oe,disabled:re,image:ae,info:ce,name:le,buttons:de,modal:ue,link:xe,modalOptions:me,addButton:pe},he=_.forwardRef((u,o)=>{const{activeItem:e,setActiveItem:s,popupPosition:i,modalOptions:a,setIsOpenModal:c}=u;function r(n,l){return n.length>l?`${n.slice(0,l)}...`:n}return t.jsxRuntimeExports.jsxs("div",{ref:o,className:M.modal,onClick:n=>{n.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:M.top,children:[t.jsxRuntimeExports.jsx("h3",{className:M.title,children:r(e.name,20)}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{s(null),c(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:M.modalOptions,children:a.map(n=>{if(n.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[n.field],onChange:l=>{const m={...e,[n.field]:l};s(m)}},String(n.field));if(n.type==="text")return t.jsxRuntimeExports.jsx(ht,{typesText:e[n.field.type],setTypesText:l=>{const m={...e,[n.field.type]:l};s(m)},text:e[n.field.text]||"",setText:l=>{const m={...e,[n.field.text]:l};s(m)},subtitle:n.label});if(n.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:l=>{const m={...e,[n.field]:l};s(m)},value:e[n.field]||"",label:n.label,placeholder:n.placeholder});if(n.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:M.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:l=>{const m={...e,[n.field.text]:l};s(m)},value:e[n.field.text]||"",label:n.inputLabel,placeholder:n.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[n.field.switch]||!1,label:n.switchLabel,onChange:l=>{const m={...e,[n.field.switch]:l};s(m)}})]});if(n.type==="list")return t.jsxRuntimeExports.jsx(_t,{items:e[n.field]||[],setItems:l=>{const m={...e,[n.field]:l};s(m)},itemsType:"select",draggable:n.draggable||!1,itemsOptions:n.itemsOptions,deletable:n.deletable||!1,editable:!1,subtitle:n.label,addableOptions:n.addableOptions});if(n.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:n.itemsOptions,onChange:l=>{const m={...e,[n.field]:l};s(m)},label:n.label,value:e[n.field]||"String",leftAddon:n.leftAddon&&n.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[n.field]})})})})]})}),_e="_other_g74jx_1",je="_subtitle_g74jx_7",ge="_items_g74jx_14",mt={other:_e,subtitle:je,items:ge},dt=u=>{const{items:o,title:e="Other"}=u;return t.jsxRuntimeExports.jsxs("div",{className:mt.other,children:[t.jsxRuntimeExports.jsx("h5",{className:mt.subtitle,children:e}),t.jsxRuntimeExports.jsx("div",{className:mt.items,children:o.map((s,i)=>t.jsxRuntimeExports.jsx(t.Switch,{current:s.isItem,onChange:a=>s.setIsItem(a),label:s.label,hasBackground:!0,paddingless:!1},i))})]})},fe=u=>{const{index:o,moveProduct:e,children:s}=u,[,i]=t.useDrop({accept:"product",hover(r){r.index!==o&&(e(r.index,o),r.index=o)}}),[{isDragging:a},c]=t.useDrag({type:"product",item:{index:o},collect:r=>({isDragging:r.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:r=>c(i(r)),className:`${M.product} ${a?M.dragging:""}`,children:s})},_t=u=>{const{isActiveItems:o,setIsActiveItems:e,items:s,setItems:i,other:a,title:c,subtitle:r,editable:n=!0,draggable:l=!1,withImage:m=!1,deletable:d=!0,addable:C=!0,itemsType:g,itemsPlaceholder:j="",itemsOptions:p,hasRangeSelector:B=!1,rangeSelectorOptions:T,modalOptions:f,addableOptions:A={},limit:k,autoScrollInterval:w}=u,[L,x]=_.useState(null),[P,E]=_.useState({top:0,left:0}),[v,O]=_.useState(null),y=_.useRef(null),[D,F]=_.useState(!1),X=(h,$)=>{const R=[...s],[Y]=R.splice(h,1);R.splice($,0,Y),i(R)};_.useEffect(()=>{const h=()=>{x(null),F(!1)};return document.body.addEventListener("click",h),x(null),F(!1),()=>{x(null),F(!1),document.body.removeEventListener("click",h)}},[]),_.useEffect(()=>{if(L){const h=[...s].map($=>$.id===L.id?L:$);i(h)}},[L]),_.useEffect(()=>{if(y.current&&v){const h=y.current.getBoundingClientRect().height,$=window.innerHeight;let R=v.top;R+h>$+window.scrollY-200&&(R=$+window.scrollY-h-200),R<0&&(R=10),E({top:R,left:v.left})}},[y.current,v]);const Z=(h,$)=>{h.stopPropagation();const R=h.target.getBoundingClientRect();O({top:R.top+window.scrollY,left:R.left-30}),x($),F(!0)};function b(h){if(m)return h?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${h[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const S=(h,$)=>{var Y;const R=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[l&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),g==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:q=>{const V=[...s],st=p.find(at=>at.name===q);if(!st)return;const tt=V.map(at=>at.id===h.id?{...st,name:q}:at);x({...h,name:q}),i([...tt])},value:h.name,options:p.filter(q=>!s.find(V=>V.name===q.name)).map(q=>q.name),leftAddon:b(h.images)}),g==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:q=>{const st=[...s].map(tt=>tt.id===h.id?{...h,name:q}:tt);i([...st])},value:h.name,placeholder:j}),g==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:q=>{const st=[...s].map(tt=>tt.id===h.id?{...h,images:q}:tt);i([...st])},activeImage:(Y=s.find(q=>q.id===h.id))==null?void 0:Y.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:M.buttons,children:[n&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:q=>Z(q,h)}),d&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>i(s.filter(q=>q.id!==h.id))})]})]});return l?t.jsxRuntimeExports.jsx(fe,{product:h,index:$,moveProduct:X,children:R},h.id):t.jsxRuntimeExports.jsx("div",{className:M.product,children:R},h.id)};return t.jsxRuntimeExports.jsxs("div",{className:M.productsBlock,children:[(c||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:M.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:M.title,children:c}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:h=>e==null?void 0:e(h)})]}),L&&n&&f&&D&&t.jsxRuntimeExports.jsx(he,{ref:y,activeItem:L,setActiveItem:x,popupPosition:P,modalOptions:f,setIsOpenModal:F}),B&&T&&t.jsxRuntimeExports.jsx(ut,{...T}),t.jsxRuntimeExports.jsxs("div",{className:M.products,children:[r&&t.jsxRuntimeExports.jsx("h5",{className:M.subtitle,children:r}),l?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:s.map((h,$)=>S(h,$))}):s.map((h,$)=>S(h,$)),C&&t.jsxRuntimeExports.jsx("div",{className:M.addButton,children:t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:t.clx(M.button,{[M.disabled]:!!(k&&k<=s.length||s.length===(p==null?void 0:p.length))}),size:"s",disabled:!!(k&&k<=s.length||s.length===(p==null?void 0:p.length)),onClick:()=>{const h=[...s];let $=null;if(p){for(let R=0;R<p.length;R++)if(!s.find(Y=>Y.id===p[R].id)){$=p[R];break}}g==="select"?h.push({name:$?$.name:p[0].name,id:($==null?void 0:$.id)||p[0].id,...A}):g==="input"?h.push({name:"",id:t.v4(),...A}):h.push({name:`Image ${s.length+1}`,id:t.v4(),...A}),i(h)},style:{width:"fit-content"},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(dt,{items:a}),w!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(w.scrollInterval),onChange:h=>w.setScrollInterval(Number(h)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},be="_title_1jjcw_1",ve="_subtitle_1jjcw_5",Ee="_header_1jjcw_12",Re="_text_1jjcw_13",ye="_productsBlock_1jjcw_14",Ie="_top_1jjcw_26",ke="_itemsBlock_1jjcw_35",we="_typeTexts_1jjcw_41",$e="_block_1jjcw_48",Ne="_active_1jjcw_61",Ce="_products_1jjcw_14",Se="_product_1jjcw_14",Be="_button_1jjcw_80",Te="_disabled_1jjcw_91",Pe="_image_1jjcw_95",qe="_info_1jjcw_102",Ae="_name_1jjcw_114",Oe="_buttons_1jjcw_118",De="_modal_1jjcw_125",Le="_link_1jjcw_145",Me="_modalOptions_1jjcw_151",He="_addButton_1jjcw_157",W={title:be,subtitle:ve,header:Ee,text:Re,productsBlock:ye,top:Ie,itemsBlock:ke,typeTexts:we,block:$e,active:Ne,products:Ce,product:Se,button:Be,disabled:Te,image:Pe,info:qe,name:Ae,buttons:Oe,modal:De,link:Le,modalOptions:Me,addButton:He},ze=u=>{const{isActiveItems:o,setIsActiveItems:e,items:s,setItems:i,other:a,title:c,subtitle:r,draggable:n=!1,withImage:l=!1,addable:m=!0,itemsOptions:d,hasRangeSelector:C=!1,rangeSelectorOptions:g,limit:j,autoScrollInterval:p}=u;function B(f){if(l)return f?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${f[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const T=f=>{const A=d.find(w=>w.id===f);if(!A)return;const k=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[n&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Select,{onChange:w=>{const L=[...s],x=d.find(v=>v.name===w);if(!x)return;const P=x.id,E=L.map(v=>v===f?P:v);i([...E])},value:A.name,options:d.filter(w=>!s.find(L=>L===w.id)).map(w=>w.name),leftAddon:B(A.images)}),t.jsxRuntimeExports.jsx("div",{className:W.buttons,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>i(s.filter(w=>w!==f))})})]});return t.jsxRuntimeExports.jsx("div",{className:W.product,children:k},f)};return t.jsxRuntimeExports.jsxs("div",{className:W.productsBlock,children:[(c||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:W.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:W.title,children:c}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:f=>e==null?void 0:e(f)})]}),C&&g&&t.jsxRuntimeExports.jsx(ut,{...g}),t.jsxRuntimeExports.jsxs("div",{className:W.products,children:[r&&t.jsxRuntimeExports.jsx("h5",{className:W.subtitle,children:r}),s.map(f=>T(f)),m&&t.jsxRuntimeExports.jsx("div",{className:W.addButton,children:t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:t.clx(W.button,{[W.disabled]:!!(j&&j<=s.length||s.length===d.length)}),size:"s",disabled:!!(j&&j<=s.length||s.length===d.length),onClick:()=>{const f=[...s];let A=null;if(d){for(let k=0;k<d.length;k++)if(!s.find(w=>w===d[k].id)){A=d[k];break}}f.push((A==null?void 0:A.id)||d[0].id),i(f)},style:{width:"fit-content"},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(dt,{items:a}),p!==void 0&&t.jsxRuntimeExports.jsx(t.Input,{label:"Auto scroll interval",type:"number",value:String(p.scrollInterval),onChange:f=>p.setScrollInterval(Number(f)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},Fe="_title_iqcxl_1",Ve="_subtitle_iqcxl_5",Ue="_header_iqcxl_12",Ye="_text_iqcxl_13",Ge="_productsBlock_iqcxl_14",We="_top_iqcxl_26",Xe="_itemsBlock_iqcxl_35",Je="_typeTexts_iqcxl_41",Qe="_block_iqcxl_48",Ke="_active_iqcxl_61",Ze="_products_iqcxl_14",ts="_product_iqcxl_14",es="_button_iqcxl_80",ss="_disabled_iqcxl_91",ns="_image_iqcxl_95",is="_info_iqcxl_102",os="_name_iqcxl_114",rs="_buttons_iqcxl_118",as="_modal_iqcxl_125",cs="_link_iqcxl_146",ls="_modalOptions_iqcxl_152",ds="_addButton_iqcxl_164",z={title:Fe,subtitle:Ve,header:Ue,text:Ye,productsBlock:Ge,top:We,itemsBlock:Xe,typeTexts:Je,block:Qe,active:Ke,products:Ze,product:ts,button:es,disabled:ss,image:ns,info:is,name:os,buttons:rs,modal:as,link:cs,modalOptions:ls,addButton:ds},us=_.forwardRef((u,o)=>{const{activeItem:e,setActiveItem:s,popupPosition:i,modalOptions:a,setIsOpenModal:c}=u;function r(n,l){return n.length>l?`${n.slice(0,l)}...`:n}return t.jsxRuntimeExports.jsxs("div",{ref:o,className:z.modal,onClick:n=>{n.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:z.top,children:[t.jsxRuntimeExports.jsx("h3",{className:z.title,children:r(e.name,20)}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{s(null),c(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:z.modalOptions,children:a.map(n=>{if(n.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:e[n.field],onChange:l=>{const m={...e,[n.field]:l};s(m)}},String(n.field));if(n.type==="text")return t.jsxRuntimeExports.jsx(ht,{typesText:e[n.field.type],setTypesText:l=>{const m={...e,[n.field.type]:l};s(m)},text:e[n.field.text]||"",setText:l=>{const m={...e,[n.field.text]:l};s(m)},subtitle:n.label});if(n.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:l=>{const m={...e,[n.field]:l};s(m)},value:e[n.field]||"",label:n.label,placeholder:n.placeholder});if(n.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:z.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:l=>{const m={...e,[n.field.text]:l};s(m)},value:e[n.field.text]||"",label:n.inputLabel,placeholder:n.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!e[n.field.switch]||!1,label:n.switchLabel,onChange:l=>{const m={...e,[n.field.switch]:l};s(m)}})]});if(n.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:n.itemsOptions,onChange:l=>{const m={...e,[n.field]:l};s(m)},label:n.label,value:e[n.field]||"String",leftAddon:n.leftAddon&&n.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:e[n.field]})})})})]})}),xs=u=>{const{index:o,moveProduct:e,children:s}=u,[,i]=t.useDrop({accept:"product",hover(r){r.index!==o&&(e(r.index,o),r.index=o)}}),[{isDragging:a},c]=t.useDrag({type:"product",item:{index:o},collect:r=>({isDragging:r.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:r=>c(i(r)),className:`${z.product} ${a?z.dragging:""}`,children:s})},ms=u=>{const{isActiveItems:o,setIsActiveItems:e,items:s,setItems:i,other:a,title:c,subtitle:r,editable:n=!0,draggable:l=!1,withImage:m=!1,deletable:d=!0,addable:C=!0,itemsType:g,itemsPlaceholder:j="",itemsOptions:p,hasRangeSelector:B=!1,rangeSelectorOptions:T,modalOptions:f,addableOptions:A={}}=u,[k,w]=_.useState(null),[L,x]=_.useState({top:0,left:0}),[P,E]=_.useState(null),v=_.useRef(null),[O,y]=_.useState(!1),D=(b,S)=>{const h=[...s],[$]=h.splice(b,1);h.splice(S,0,$),i(h)};_.useEffect(()=>{const b=()=>{w(null),y(!1)};return document.body.addEventListener("click",b),w(null),y(!1),()=>{w(null),y(!1),document.body.removeEventListener("click",b)}},[]),_.useEffect(()=>{if(k){const b=[...s].map(S=>S.id===k.id?k:S);i(b)}},[k]),_.useEffect(()=>{if(v.current&&P){const b=v.current.getBoundingClientRect().height,S=window.innerHeight;let h=P.top;h+b>S+window.scrollY-200&&(h=S+window.scrollY-b-200),h<0&&(h=10),x({top:h,left:P.left})}},[v.current,P]);const F=(b,S)=>{b.stopPropagation();const h=b.target.getBoundingClientRect();E({top:h.top+window.scrollY,left:h.left-30}),w(S),y(!0)};function X(b){if(m)return b?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${b[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const Z=(b,S)=>{var $;const h=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[l&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),g==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:R=>{const q=[...s].map(V=>V.id===b.id?{...b,name:R}:V);w({...b,name:R}),i([...q])},value:b.name,options:p.filter(R=>!s.find(Y=>Y.name===R)),leftAddon:X(b.images)}),g==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:R=>{const q=[...s].map(V=>V.id===b.id?{...b,name:R}:V);i([...q])},value:b.name,placeholder:j}),g==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:R=>{const q=[...s].map(V=>V.id===b.id?{...b,images:R}:V);i([...q])},activeImage:($=s.find(R=>R.id===b.id))==null?void 0:$.images[0]}),t.jsxRuntimeExports.jsxs("div",{className:z.buttons,children:[n&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:R=>F(R,b)}),d&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>i(s.filter(R=>R.id!==b.id))})]})]});return l?t.jsxRuntimeExports.jsx(xs,{product:b,index:S,moveProduct:D,children:h},b.id):t.jsxRuntimeExports.jsx("div",{className:z.product,children:h},b.id)};return t.jsxRuntimeExports.jsxs("div",{className:z.productsBlock,children:[(c||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:z.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:z.title,children:c}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:b=>e==null?void 0:e(b)})]}),k&&n&&f&&O&&t.jsxRuntimeExports.jsx(us,{ref:v,activeItem:k,setActiveItem:w,popupPosition:L,modalOptions:f,setIsOpenModal:y}),B&&T&&t.jsxRuntimeExports.jsx(ut,{...T}),t.jsxRuntimeExports.jsxs("div",{className:z.products,children:[r&&t.jsxRuntimeExports.jsx("h5",{className:z.subtitle,children:r}),l?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:s.map((b,S)=>Z(b,S))}):s.map((b,S)=>Z(b,S)),C&&t.jsxRuntimeExports.jsx("div",{className:z.addButton,children:t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:z.button,size:"s",onClick:()=>{const b=[...s];let S=null;if(p){for(let h=0;h<p.length;h++)if(!s.find($=>$.name===p[h])){S=p[h];break}}g==="select"?b.push({name:S||p[0],id:t.v4(),...A}):g==="input"?b.push({name:"",id:t.v4(),...A}):b.push({name:`Image ${s.length+1}`,id:t.v4(),...A}),i(b)},style:{width:"fit-content"},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(dt,{items:a})]})},ps="_title_oravb_1",hs="_subtitle_oravb_5",_s="_header_oravb_12",js="_text_oravb_13",gs="_productsBlock_oravb_14",fs="_buttonsBlock_oravb_15",bs="_top_oravb_26",vs="_itemsBlock_oravb_35",Es="_typeTexts_oravb_41",Rs="_block_oravb_48",ys="_active_oravb_60",Is="_products_oravb_14",ks="_product_oravb_14",ws="_button_oravb_15",$s="_image_oravb_90",Ns="_info_oravb_97",Cs="_name_oravb_109",Ss="_buttons_oravb_15",Bs="_modal_oravb_120",Ts="_other_oravb_139",Ps="_options_oravb_145",et={title:ps,subtitle:hs,header:_s,text:js,productsBlock:gs,buttonsBlock:fs,top:bs,itemsBlock:vs,typeTexts:Es,block:Rs,active:ys,products:Is,product:ks,button:ws,image:$s,info:Ns,name:Cs,buttons:Ss,modal:Bs,other:Ts,options:Ps},qs=_.forwardRef((u,o)=>{const{activeButton:e,setActiveButton:s,popupPosition:i}=u,[a,c]=_.useState(e.typesText),[r,n]=_.useState(e.destination),[l,m]=_.useState(e.page),[d,C]=_.useState(e.link||""),[g,j]=_.useState(e.text||""),[p,B]=_.useState(e.openInNewTab),{pages:T}=t.usePagesStore();return _.useEffect(()=>{s({...e,...{text:g,link:d,destination:r,typesText:a,page:l,openInNewTab:p}})},[a,r,d,g,l,p]),t.jsxRuntimeExports.jsxs("div",{className:et.modal,onClick:f=>{f.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},ref:o,children:[t.jsxRuntimeExports.jsxs("div",{className:et.top,children:[t.jsxRuntimeExports.jsx("h3",{className:et.title,children:e.type}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>s(null)})]}),t.jsxRuntimeExports.jsxs("div",{className:et.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:f=>n(f),options:["Go to Page","Open Link"].filter(f=>f!==r),value:r}),r==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:f=>m(f),options:T?Object.values(T).filter(f=>f.name!==l).map(f=>f.name):[],value:l}):t.jsxRuntimeExports.jsx(t.Input,{onChange:f=>C(f),value:d,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:e.openInNewTab,label:"Open in new tab",onChange:f=>B(f)}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:f=>j(f),value:g,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(pt,{typesText:a,setTypesText:c})]})]})}),As="_subtitle_w0d5g_1",Os="_header_w0d5g_8",Ds="_text_w0d5g_9",Ls="_productsBlock_w0d5g_10",Ms="_buttonsBlock_w0d5g_11",Hs="_top_w0d5g_23",zs="_itemsBlock_w0d5g_32",Fs="_typeTexts_w0d5g_38",Vs="_block_w0d5g_45",Us="_active_w0d5g_58",Ys="_products_w0d5g_10",Gs="_product_w0d5g_10",Ws="_button_w0d5g_11",Xs="_image_w0d5g_88",Js="_info_w0d5g_95",Qs="_name_w0d5g_107",Ks="_buttons_w0d5g_11",Zs="_modal_w0d5g_118",tn="_other_w0d5g_138",en="_options_w0d5g_144",sn="_addButton_w0d5g_150",nt={subtitle:As,header:Os,text:Ds,productsBlock:Ls,buttonsBlock:Ms,top:Hs,itemsBlock:zs,typeTexts:Fs,block:Vs,active:Us,products:Ys,product:Gs,button:Ws,image:Xs,info:Js,name:Qs,buttons:Ks,modal:Zs,other:tn,options:en,addButton:sn},jt=u=>{const{buttons:o,setButtons:e,deletable:s=!0,addable:i=!0}=u,[a,c]=_.useState(null),[r,n]=_.useState({top:0,left:0}),[l,m]=_.useState(null),d=_.useRef(null);_.useEffect(()=>{const g=()=>{c(null)};return document.body.addEventListener("click",g),c(null),()=>{c(null),document.body.removeEventListener("click",g)}},[]),_.useEffect(()=>{if(a){const g=[...o].map(j=>j.id===a.id?a:j);e(g)}},[a]),_.useEffect(()=>{if(d.current&&l){const g=d.current.getBoundingClientRect().height,j=window.innerHeight;let p=l.top;p+g>j+window.scrollY-200&&(p=j+window.scrollY-g-200),p<0&&(p=10),n({top:p,left:l.left})}},[d.current,l]);const C=(g,j)=>{g.stopPropagation();const p=g.target.getBoundingClientRect();m({top:p.top+window.scrollY,left:p.left-30}),c(j)};return t.jsxRuntimeExports.jsxs("div",{className:nt.products,children:[t.jsxRuntimeExports.jsx("h5",{className:nt.subtitle,children:"Button Type"}),o.map(g=>t.jsxRuntimeExports.jsxs("div",{className:nt.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:j=>{const B=[...o].map(T=>T.id===g.id?{...g,type:j}:T);e(B)},value:g.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:nt.buttons,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:j=>{C(j,g)}}),s&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const j=o.filter(p=>p.id!==g.id);e(j)},width:20,height:20,fill:"#C12A2A"})]})]},g.id)),a&&t.jsxRuntimeExports.jsx(qs,{ref:d,activeButton:a,setActiveButton:c,popupPosition:r}),i&&t.jsxRuntimeExports.jsx("div",{className:nt.addButton,children:t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:nt.button,size:"s",onClick:()=>{const g=[...o];g.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:"Button Name",page:"home",openInNewTab:!0}),e(g)},style:{width:"fit-content"},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})]})},nn=u=>{const{isActiveButtons:o,setIsActiveButtons:e,buttons:s,setButtons:i}=u;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:et.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:et.top,children:[t.jsxRuntimeExports.jsx("h3",{className:et.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:a=>e(a)})]}),t.jsxRuntimeExports.jsx(jt,{buttons:s,setButtons:i})]})})},on="_wrapper_m18qi_1",rn="_subtitle_m18qi_7",an="_content_m18qi_14",cn="_range_m18qi_22",ln="_track_m18qi_27",dn="_progress_m18qi_36",un="_dots_m18qi_46",xn="_dot_m18qi_46",mn="_active_m18qi_65",pn="_input_m18qi_77",hn="_countBlock_m18qi_91",_n="_count_m18qi_91",jn="_controls_m18qi_107",gn="_button_m18qi_113",H={wrapper:on,subtitle:rn,content:an,range:cn,track:ln,progress:dn,dots:un,dot:xn,active:mn,input:pn,countBlock:hn,count:_n,controls:jn,button:gn},ut=u=>{const{label:o,min:e=1,max:s=4,step:i=1,count:a,setCount:c}=u,[r,n]=_.useState(!1),l=Array.from({length:(s-e)/i+1}),m=(a-e)/(s-e)*100,d=()=>{a<s&&c(a+i)},C=()=>{a>e&&c(a-i)},g=j=>{const p=e+j*i;c(p)};return t.jsxRuntimeExports.jsxs("div",{className:H.wrapper,children:[o&&t.jsxRuntimeExports.jsx("h5",{className:H.subtitle,children:o}),t.jsxRuntimeExports.jsxs("div",{className:H.content,children:[t.jsxRuntimeExports.jsxs("div",{className:H.range,children:[t.jsxRuntimeExports.jsx("div",{className:H.track}),t.jsxRuntimeExports.jsx("div",{className:H.progress,style:{width:`${m}%`}}),t.jsxRuntimeExports.jsx("div",{className:H.dots,children:l.map((j,p)=>{const B=p<=(a-e)/i;return t.jsxRuntimeExports.jsx("button",{onClick:()=>g(p),className:t.clx(H.dot,{[H.active]:B,[H.inactive]:!B,[H.dragging]:r}),"aria-label":`Set value to ${e+p*i}`},p)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:e,max:s,step:i,value:a,onChange:j=>c(Number(j.target.value)),onMouseDown:()=>n(!0),onMouseUp:()=>n(!1),onTouchStart:()=>n(!0),onTouchEnd:()=>n(!1),className:H.input})]}),t.jsxRuntimeExports.jsxs("div",{className:H.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:e,max:s,paddingless:!0,onChange:j=>{const p=Number(j);p>s?c(s):p<e?c(e):c(p)},value:String(a)}),t.jsxRuntimeExports.jsxs("div",{className:H.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:d,disabled:a>=s,className:H.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:C,disabled:a<=e,className:H.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},fn="_title_w64fy_1",bn="_subtitle_w64fy_5",vn="_header_w64fy_12",En="_text_w64fy_13",Rn="_productsBlock_w64fy_14",yn="_top_w64fy_26",In="_itemsBlock_w64fy_35",kn="_typeTexts_w64fy_41",wn="_block_w64fy_48",$n="_active_w64fy_61",Nn="_products_w64fy_14",Cn="_product_w64fy_14",Sn="_button_w64fy_80",Bn="_image_w64fy_91",Tn="_info_w64fy_98",Pn="_name_w64fy_110",qn="_buttons_w64fy_114",An="_modal_w64fy_121",On="_link_w64fy_141",Dn="_modalOptions_w64fy_147",Ln="_addButton_w64fy_159",U={title:fn,subtitle:bn,header:vn,text:En,productsBlock:Rn,top:yn,itemsBlock:In,typeTexts:kn,block:wn,active:$n,products:Nn,product:Cn,button:Sn,image:Bn,info:Tn,name:Pn,buttons:qn,modal:An,link:On,modalOptions:Dn,addButton:Ln},Mn=u=>{const{activeItem:o,setActiveItem:e,popupPosition:s,setIsOpenModal:i,itemsOptions:a}=u,c=a.find(n=>n.id===o.listingId);if(!c)return null;function r(n,l){return n.length>l?`${n.slice(0,l)}...`:n}return t.jsxRuntimeExports.jsxs("div",{className:U.modal,onClick:n=>{n.stopPropagation()},style:{top:`${s.top}px`,left:`${s.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:U.top,children:[t.jsxRuntimeExports.jsx("h3",{children:r(c.productData.name,20)}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{i(!1),e(null)}})]}),t.jsxRuntimeExports.jsx("div",{className:U.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",activeImage:c.productData.images.length>0?c.productData.images[0].cfId:void 0,onChange:n=>{const l={...o,image:n[0]};e(l)}})})]})},Hn=u=>{const{index:o,moveProduct:e,children:s}=u,[,i]=t.useDrop({accept:"product",hover(r){r.index!==o&&(e(r.index,o),r.index=o)}}),[{isDragging:a},c]=t.useDrag({type:"product",item:{index:o},collect:r=>({isDragging:r.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:r=>c(i(r)),className:`${U.product} ${a?U.dragging:""}`,children:s})},zn=u=>{const{isActiveItems:o,setIsActiveItems:e,items:s,setItems:i,other:a,title:c,subtitle:r,editable:n=!0,draggable:l=!1,withImage:m=!1,deletable:d=!0,addable:C=!0,itemsType:g,itemsOptions:j}=u,[p,B]=_.useState(null),[T,f]=_.useState({top:0,left:0}),[A,k]=_.useState(!1),w=(E,v)=>{const O=[...s],[y]=O.splice(E,1);O.splice(v,0,y),i(O)};_.useEffect(()=>{const E=()=>{B(null),k(!1)};return document.body.addEventListener("click",E),B(null),k(!1),()=>{B(null),k(!1),document.body.removeEventListener("click",E)}},[]),_.useEffect(()=>{if(p){const E=[...s].map(v=>v.listingId===p.listingId?p:v);i(E)}},[p]);const L=(E,v)=>{E.stopPropagation();const O=E.target.getBoundingClientRect(),y=100,D=window.innerHeight;let F=O.top+window.scrollY;F+y>D&&(F=D-y-20),k(!0),f({top:F-80,left:O.left-30}),B(v)};function x(E){if(m)return E?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${E}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const P=(E,v)=>{const O=j.find(D=>E.listingId===D.id);if(!O)return null;const y=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[l&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})},v),g==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:D=>{const F=[...s],X=j.find(S=>S.productData.name===D);if(!X)return;const Z={listingId:X.id,image:X.productData.images.length>0?X.productData.images[0].cfId:""},b=F.map(S=>S.listingId===E.listingId?Z:S);B(Z),i([...b])},value:O.productData.name,options:[...j.filter(D=>!s.find(F=>F.listingId===D.id)).map(D=>D.productData.name)],leftAddon:x(E.image||O.productData.images.length>0&&O.productData.images[0].cfId||"")},v),t.jsxRuntimeExports.jsxs("div",{className:U.buttons,children:[n&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:D=>L(D,E)}),d&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>i(s.filter(D=>D!==E))})]})]});return l?t.jsxRuntimeExports.jsx(Hn,{product:E,index:v,moveProduct:w,children:y},E.listingId):t.jsxRuntimeExports.jsx("div",{className:U.product,children:y},E.listingId)};return t.jsxRuntimeExports.jsxs("div",{className:U.productsBlock,children:[(c||o!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:U.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:U.title,children:c}),o!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:E=>e==null?void 0:e(E)})]}),A&&p&&t.jsxRuntimeExports.jsx(Mn,{activeItem:p,setActiveItem:B,setIsOpenModal:k,popupPosition:T,itemsOptions:j}),t.jsxRuntimeExports.jsxs("div",{className:U.products,children:[r&&t.jsxRuntimeExports.jsx("h5",{className:U.subtitle,children:r}),l?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:s.map((E,v)=>P(E,v))}):s.map((E,v)=>P(E,v)),C&&t.jsxRuntimeExports.jsx("div",{className:U.addButton,children:t.jsxRuntimeExports.jsxs(t.Button,{withoutHover:!0,className:U.button,size:"s",onClick:()=>{const E=[...s];for(let v=0;v<j.length;v++)if(!s.find(O=>O.listingId===j[v].id)){E.push({listingId:j[v].id,image:j[v].productData.images.length>0?j[v].productData.images[0].cfId:""});break}i(E)},disabled:s.length===j.length,style:{width:"fit-content"},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})})]}),a!==void 0&&t.jsxRuntimeExports.jsx(dt,{items:a})]})},Fn="_options_jdafm_1",Vn="_price_jdafm_12",Un="_oldPrice_jdafm_19",Yn="_newPrice_jdafm_27",Gn="_animate_jdafm_34",Wn="_appearAndBounce_jdafm_1",Xn="_meta_jdafm_52",Jn="_info_jdafm_58",Qn="_infoRight_jdafm_66",Kn="_buttons_jdafm_73",Zn="_variants_jdafm_80",ti="_variant_jdafm_80",ei="_stock_jdafm_97",si="_variantInfo_jdafm_104",ni="_quantity_jdafm_110",ii="_count_jdafm_117",oi="_focused_jdafm_134",ri="_button_jdafm_73",ai="_activeVariant_jdafm_160",ci="_chargeTypes_jdafm_164",li="_charge_jdafm_164",di="_chargeActive_jdafm_189",ui="_title_jdafm_197",I={options:Fn,price:Vn,oldPrice:Un,newPrice:Yn,animate:Gn,appearAndBounce:Wn,meta:Xn,info:Jn,infoRight:Qn,buttons:Kn,variants:Zn,variant:ti,stock:ei,variantInfo:si,quantity:ni,count:ii,focused:oi,button:ri,activeVariant:ai,chargeTypes:ci,charge:li,chargeActive:di,title:ui};var gt=(u=>(u.ONE_TIME="One-Time",u.RECURRING="Subscribe & Save",u))(gt||{});const xi=u=>{var w,L;const{variants:o}=u,[e,s]=_.useState(o[0]),[i,a]=_.useState(e.chargeTypes[0]),c=t.useNavigate(),[r,n]=_.useState(1),[l,m]=_.useState(!1),{reset:d,addProductToCart:C,getProducts:g,cart:j}=t.useCart(),[p,B]=_.useState(!1);_.useEffect(()=>{B(!0);const x=setTimeout(()=>B(!1),600);return()=>clearTimeout(x)},[r]);async function T(){await g(),await C({productId:u.id,productVariantId:e.id,quantity:r})}function f(){d(),T(),c("/checkout")}console.log(j);function A(x){if(x>=864e5){const y=Math.floor(x/864e5);return`${y} ${y===1?"day":"days"}`}else if(x>=36e5){const y=Math.floor(x/36e5);return`${y} ${y===1?"hour":"hours"}`}else if(x>=6e4){const y=Math.floor(x/6e4);return`${y} ${y===1?"minute":"minutes"}`}else{const y=Math.floor(x/1e3);return`${y} ${y===1?"second":"seconds"}`}}function k(x,P){return x.length>P?x.slice(0,P)+"...":x}return t.jsxRuntimeExports.jsxs("div",{className:I.options,children:[e.chargeTypes.length>1&&t.jsxRuntimeExports.jsx("div",{className:I.chargeTypes,children:e.chargeTypes.map(x=>t.jsxRuntimeExports.jsx("div",{className:t.clx(I.charge,{[I.chargeActive]:i===x}),onClick:()=>a(x),children:gt[x]},x))}),t.jsxRuntimeExports.jsx("div",{className:I.variants,children:o.map(x=>{var P;return t.jsxRuntimeExports.jsxs("div",{className:t.clx(I.variant,{[I.activeVariant]:e.id===x.id}),onClick:()=>s(x),children:[t.jsxRuntimeExports.jsxs("div",{className:I.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:I.title,children:k(x.name,15)}),t.jsxRuntimeExports.jsxs("span",{children:["$",i==="ONE_TIME"?x.price.amount:x.subscriptionSettings?x.subscriptionSettings.price.amount:"Price Not Found"]})]}),t.jsxRuntimeExports.jsx("div",{children:i==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("span",{className:I.stock,children:[((P=x.quantity.restrictions)==null?void 0:P.max)||x.quantity.available||0," in stock"]})})]},x.id)})}),i==="ONE_TIME"&&t.jsxRuntimeExports.jsxs("div",{className:I.quantity,children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>{r>1?n(x=>x-1):n(1)},className:I.button,disabled:e.quantity.restrictions&&r<=e.quantity.restrictions.min,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx("label",{className:t.clx(I.count,{[I.focused]:l}),onFocus:()=>m(!0),onBlur:()=>m(!1),children:t.jsxRuntimeExports.jsx(t.Input,{type:"number",value:String(r),onChange:x=>n(Number(x)),max:((w=e.quantity.restrictions)==null?void 0:w.max)||e.quantity.available||1/0,min:((L=e.quantity.restrictions)==null?void 0:L.min)||0,style:{backgroundColor:"transparent",border:"none",textAlign:"center"}})}),t.jsxRuntimeExports.jsx("button",{onClick:()=>{n(x=>x+1)},className:I.button,disabled:!!(e.quantity.restrictions&&r>=e.quantity.restrictions.max||e.quantity.available&&r>=e.quantity.available),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:I.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:I.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:I.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"#FF3F19",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{children:!e.deliveryTime||e.deliveryTime===0?"Instant":A(e.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:I.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:I.infoRight,children:i==="ONE_TIME"?e.compareAtPrice&&(e.compareAtPrice.amount||0)-(e.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:I.price,children:[t.jsxRuntimeExports.jsxs("span",{className:t.clx(I.newPrice,{[I.animate]:p}),children:["$ ",(e.price.amount||0)*r]}),t.jsxRuntimeExports.jsxs("span",{className:I.oldPrice,children:["$ ",(e.compareAtPrice.amount||0)*r]})]}):t.jsxRuntimeExports.jsxs("span",{className:t.clx(I.newPrice,{[I.animate]:p}),children:["$ ",(e.price.amount||0)*r]}):e.subscriptionSettings&&e.subscriptionSettings.compareAtPrice&&(e.subscriptionSettings.compareAtPrice.amount||0)-(e.subscriptionSettings.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:I.price,children:[t.jsxRuntimeExports.jsxs("span",{className:t.clx(I.newPrice,{[I.animate]:p}),children:["$ ",e.subscriptionSettings.price.amount||0]}),t.jsxRuntimeExports.jsxs("span",{className:I.oldPrice,children:["$ ",e.subscriptionSettings.compareAtPrice.amount||0]})]}):e.subscriptionSettings&&t.jsxRuntimeExports.jsxs("span",{className:t.clx(I.newPrice,{[I.animate]:p}),children:["$ ",e.subscriptionSettings.price.amount||0]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:I.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:()=>f(),children:t.jsxRuntimeExports.jsx("span",{children:i==="ONE_TIME"?"Buy Now":"Subscribe Now"})}),i==="ONE_TIME"&&t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:()=>T(),children:"Add to Cart"})]})]})},mi="_button_nq46k_1",pi="_login_nq46k_14",hi="_signUp_nq46k_18",_i="_buttons_nq46k_23",ji="_modal_nq46k_32",gi="_info_nq46k_60",fi="_top_nq46k_67",bi="_title_nq46k_78",vi="_clear_nq46k_85",Ei="_activeClear_nq46k_92",Ri="_count_nq46k_96",yi="_cart_nq46k_111",Ii="_empty_nq46k_119",ki="_product_nq46k_145",wi="_products_nq46k_154",$i="_image_nq46k_162",Ni="_productInfo_nq46k_168",Ci="_content_nq46k_175",Si="_name_nq46k_181",Bi="_price_nq46k_187",Ti="_productButtons_nq46k_193",Pi="_productButton_nq46k_193",qi="_productCount_nq46k_213",Ai="_bottom_nq46k_229",Oi="_subtotal_nq46k_237",Di="_block_nq46k_245",Li="_shoppingCount_nq46k_252",Mi="_total_nq46k_272",Hi="_link_nq46k_278",zi="_userInfo_nq46k_285",N={button:mi,login:pi,signUp:hi,buttons:_i,modal:ji,info:gi,top:fi,title:bi,clear:vi,activeClear:Ei,count:Ri,cart:yi,empty:Ii,product:ki,products:wi,image:$i,productInfo:Ni,content:Ci,name:Si,price:Bi,productButtons:Ti,productButton:Pi,productCount:qi,bottom:Ai,subtotal:Oi,block:Di,shoppingCount:Li,total:Mi,link:Hi,userInfo:zi},Fi="_button_85085_1",Vi="_primary_85085_20",Ui="_primaryHovered_85085_30",Yi="_secondary_85085_34",Gi="_secondaryHovered_85085_44",Wi="_tertiary_85085_48",Xi="_tertiaryHovered_85085_58",Ji="_content_85085_62",J={button:Fi,primary:Vi,primaryHovered:Ui,secondary:Yi,secondaryHovered:Gi,tertiary:Wi,tertiaryHovered:Xi,content:Ji},lt=u=>{const{children:o,onClick:e,style:s,className:i,disabled:a=!1,type:c="Primary"}=u,{themeSettings:r}=t.useThemeSettingsStore();return t.jsxRuntimeExports.jsx("button",{className:t.clx(J.button,i,{[J.primary]:c==="Primary",[J.secondary]:c==="Secondary",[J.tertiary]:c==="Tertiary",[J.primaryHovered]:c==="Primary"&&!a&&r.buttons.primary.hover,[J.secondaryHovered]:c==="Secondary"&&!a&&r.buttons.secondary.hover,[J.tertiaryHovered]:c==="Tertiary"&&!a&&r.buttons.tertiary.hover}),onClick:e,style:{...s},disabled:a,children:c==="Tertiary"?t.jsxRuntimeExports.jsxs("div",{className:J.content,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"ArrowRight",fill:"#757575",width:20,height:20}),o]}):t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:o})})};class rt extends Error{}rt.prototype.name="InvalidTokenError";function Qi(u){return decodeURIComponent(atob(u).replace(/(.)/g,(o,e)=>{let s=e.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function Ki(u){let o=u.replace(/-/g,"+").replace(/_/g,"/");switch(o.length%4){case 0:break;case 2:o+="==";break;case 3:o+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Qi(o)}catch{return atob(o)}}function Zi(u,o){if(typeof u!="string")throw new rt("Invalid token specified: must be a string");o||(o={});const e=o.header===!0?0:1,s=u.split(".")[e];if(typeof s!="string")throw new rt(`Invalid token specified: missing part #${e+1}`);let i;try{i=Ki(s)}catch(a){throw new rt(`Invalid token specified: invalid base64 for part #${e+1} (${a.message})`)}try{return JSON.parse(i)}catch(a){throw new rt(`Invalid token specified: invalid json for part #${e+1} (${a.message})`)}}const to=u=>{const{shopping:o,signUp:e}=u,s=t.useNavigate();function i(c){s(c)}const a=JSON.parse(localStorage.getItem("token")||"{}");return t.jsxRuntimeExports.jsxs("div",{className:N.buttons,children:[o&&t.jsxRuntimeExports.jsx(ft,{}),!a.data&&t.jsxRuntimeExports.jsx(lt,{onClick:()=>i("/customer-dash"),type:"Secondary",style:{padding:10},children:"Login"}),!a.data&&e&&t.jsxRuntimeExports.jsx(lt,{onClick:()=>i("/customer-dash"),type:"Primary",style:{padding:10},children:"Sign Up"}),a.data&&t.jsxRuntimeExports.jsx(Et,{token:a.data})]})},ft=()=>{const[u,o]=_.useState(!1),[e,s]=_.useState([]),{cart:i,getProducts:a}=t.useCart();function c(m){for(let d=0;d<i.parts.length;d++)for(let C=0;C<m.variants.length;C++)if(i.parts[d].productVariantId===m.variants[d].id)return i.parts[d].productVariantId}function r(m){for(let d=0;d<i.parts.length;d++)for(let C=0;C<m.variants.length;C++)if(i.parts[d].productVariantId===m.variants[d].id)return i.parts[d].quantity}_.useEffect(()=>{(async()=>{const d=i.parts.map(j=>String(j.productId)),g=(await a([...d])).map(j=>({...j,activeVariantId:c(j),quantity:r(j)}));s(g)})()},[i.parts.length]);function n(m){var d;return!m||!(m!=null&&m.variants)?!1:(d=m.variants.find(C=>C.id===m.activeVariantId))==null?void 0:d.subscriptionSettings}const l=i.parts.length>0&&e.length>0&&!n(e[0]);return console.log(i.parts.length>0,e.length>0,!n(e[0])),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:N.button,onClick:m=>{m.stopPropagation(),o(!0)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"var(--icon-primary)"}),l&&t.jsxRuntimeExports.jsx("div",{className:N.shoppingCount,children:i.parts.length})]}),u&&t.jsxRuntimeExports.jsx(t.Modal,{close:o,children:t.jsxRuntimeExports.jsx(bt,{activeProducts:e,isCartNotEmpty:l})})]})},bt=u=>{const{activeProducts:o,isCartNotEmpty:e}=u,{cart:s,reset:i,getTotalAndDiscount:a,updateQuantityOfProduct:c}=t.useCart(),r=t.useNavigate();function n(d){r(d)}function l(d){c({productId:d.id,productVariantId:d.activeVariantId,quantity:d.quantity+1})}function m(d){c({productId:d.id,productVariantId:d.activeVariantId,quantity:d.quantity-1})}return t.jsxRuntimeExports.jsxs("div",{className:N.modal,onClick:d=>d.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:N.top,children:[t.jsxRuntimeExports.jsxs("div",{className:N.info,children:[t.jsxRuntimeExports.jsx("span",{className:N.title,children:"Cart"}),e&&t.jsxRuntimeExports.jsx("div",{className:N.count,children:s.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx(N.clear,{[N.activeClear]:e}),disabled:!e,onClick:()=>i(),children:"Clear all"})]}),e?t.jsxRuntimeExports.jsxs("div",{className:N.cart,children:[t.jsxRuntimeExports.jsx("div",{className:N.products,children:o.map(d=>t.jsxRuntimeExports.jsxs("div",{className:N.product,children:[t.jsxRuntimeExports.jsxs("div",{className:N.productInfo,children:[t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${d.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:N.image}),t.jsxRuntimeExports.jsxs("div",{className:N.content,children:[t.jsxRuntimeExports.jsx("div",{className:N.name,children:d.name}),t.jsxRuntimeExports.jsxs("div",{className:N.price,children:["$",d.variants.find(C=>C.id===d.activeVariantId).price.amount*((d==null?void 0:d.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:N.productButtons,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{d.quantity!==1&&m(d)},className:N.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:N.productCount,children:d.quantity}),t.jsxRuntimeExports.jsx("div",{onClick:()=>l(d),className:N.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},d.id))}),t.jsxRuntimeExports.jsxs("div",{className:N.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:N.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:N.block,children:[t.jsxRuntimeExports.jsx("span",{children:"Subtotal"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Info",width:20,height:20,fill:"#757575"})]}),t.jsxRuntimeExports.jsxs("div",{className:N.total,children:["$",a().total]})]}),t.jsxRuntimeExports.jsx(lt,{onClick:()=>n("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(vt,{})]})},vt=()=>t.jsxRuntimeExports.jsxs("div",{className:N.empty,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag"})}),t.jsxRuntimeExports.jsx("span",{children:"Your cart is empty"}),t.jsxRuntimeExports.jsxs("span",{children:["Check out the store's products and add them"," ",t.jsxRuntimeExports.jsx("a",{href:"/products",className:N.link,children:"here"})]})]}),Et=({token:u})=>{const[o,e]=_.useState("test-email@gmail.com"),s=t.useNavigate();_.useEffect(()=>{(async()=>{const c=Zi(u);e(c.email)})()},[u]);function i(a){s(a)}return t.jsxRuntimeExports.jsx("div",{className:N.userInfo,onClick:()=>i("/customer-dash"),children:t.jsxRuntimeExports.jsx("div",{children:o||"test-email@gmail.com"})})},eo="_share_11u0d_1",so="_modal_11u0d_8",no="_header_11u0d_14",io="_socials_11u0d_24",oo="_social_11u0d_24",ro="_copy_11u0d_34",ao="_title_11u0d_41",co="_copyWrapper_11u0d_47",lo="_copyText_11u0d_56",K={share:eo,modal:so,header:no,socials:io,social:oo,copy:ro,title:ao,copyWrapper:co,copyText:lo},uo=()=>{const{isOpenModal:u,setIsOpenModal:o}=t.useShareLinkStore();function e(){o(!0)}return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(t.Button,{className:K.share,onClick:s=>{s.stopPropagation(),e()},type:"Secondary",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Share",fill:"#757575",hoverable:!0})}),u&&t.jsxRuntimeExports.jsx(t.Modal,{close:o,children:t.jsxRuntimeExports.jsx(xo,{})})]})},xo=()=>{const{setIsOpenModal:u}=t.useShareLinkStore(),{notification:o,setNotification:e}=t.useNotificationStore(),s=window.location.href;function i(){navigator.clipboard.writeText(s),e({message:"Link copied to clipboard",status:"success"})}return t.jsxRuntimeExports.jsxs("div",{className:K.modal,onClick:a=>a.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:K.header,children:[t.jsxRuntimeExports.jsx("div",{className:K.title,children:"Share this Post"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",fill:"#757575",onClick:()=>u(!1),hoverable:!0})]}),t.jsxRuntimeExports.jsxs("div",{className:K.copyWrapper,children:[t.jsxRuntimeExports.jsx("div",{className:t.clx(K.copy,K.copyText),onClick:i,children:s}),t.jsxRuntimeExports.jsx("div",{onClick:i,className:K.copy,children:o?t.jsxRuntimeExports.jsx(t.Icon,{name:"Check"}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Copy"})})]})]})},mo="_accordion_1s1lq_1",po="_header_1s1lq_9",ho="_icon_1s1lq_18",_o="_open_1s1lq_21",jo="_content_1s1lq_25",ot={accordion:mo,header:po,icon:ho,open:_o,content:jo},go=({title:u,content:o})=>{const[e,s]=_.useState(!1),[i,a]=_.useState(0),c=_.useRef(null),r=()=>{s(!e)};return _.useEffect(()=>{c.current&&a(e?c.current.scrollHeight:0)},[e]),t.jsxRuntimeExports.jsxs("div",{className:ot.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:ot.header,onClick:r,children:[t.jsxRuntimeExports.jsx("h5",{id:"h5",children:u}),t.jsxRuntimeExports.jsx("div",{className:t.clx(ot.icon,{[ot.open]:e}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:c,className:ot.content,style:{height:`${i}px`},children:t.jsxRuntimeExports.jsx("p",{id:"p",children:o})})]})},fo="_wrapper_1r14x_1",bo="_label_1r14x_9",vo="_input_1r14x_18",Eo="_required_1r14x_35",Ro="_paddingless_1r14x_39",yo="_content_1r14x_43",Io="_borderless_1r14x_58",ko="_rightIcon_1r14x_63",Q={wrapper:fo,label:bo,input:vo,required:Eo,paddingless:Ro,content:yo,borderless:Io,rightIcon:ko},wo=u=>{const{onChange:o,style:e,label:s,value:i,type:a,min:c,max:r,placeholder:n,disabled:l=!1,required:m=!1,regex:d,paddingless:C=!1,borderless:g=!1,editable:j=!1,isSearch:p=!1}=u,{themeSettings:B}=t.useThemeSettingsStore(),{inputs:T}=B,[f,A]=_.useState(!1);function k(x,P){if(x.startsWith("#")){let O,y,D;return x.length===7?(O=parseInt(x.slice(1,3),16),y=parseInt(x.slice(3,5),16),D=parseInt(x.slice(5,7),16)):x.length===4&&(O=parseInt(x[1]+x[1],16),y=parseInt(x[2]+x[2],16),D=parseInt(x[3]+x[3],16)),`rgba(${O}, ${y}, ${D}, ${P})`}const v={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#00ff00",blue:"#0000ff"}[x.toLowerCase()];return v?k(v,P):x}function w(x){return Number(x)<0?String(c):x}function L(x){return!m||!d?!0:new RegExp(d).test(x)}return t.jsxRuntimeExports.jsxs("div",{className:Q.wrapper,children:[s&&t.jsxRuntimeExports.jsx("label",{className:Q.label,htmlFor:s,children:s}),t.jsxRuntimeExports.jsxs("div",{className:Q.content,style:{paddingRight:T.general.height+15,...e,backgroundColor:k(T.field.color,T.field.opacity/100)},children:[t.jsxRuntimeExports.jsx("input",{id:s,type:a||"text",onChange:x=>{if(a==="text")o(x.target.value);else{const P=w(x.target.value);o(P)}},value:i,autoComplete:"off",placeholder:n||"Type something...",className:t.clx(Q.input,{[Q.required]:f&&m&&!L(i),[Q.paddingless]:C,[Q.borderless]:g}),min:a==="number"?c:void 0,max:a==="number"?r:void 0,disabled:l,onFocus:()=>A(!0)}),p&&t.jsxRuntimeExports.jsx("div",{className:Q.rightIcon,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"MagnifyingGlass",fill:"var(--icon-secondary)",width:T.general.height,height:T.general.height})}),j&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",width:20,height:20,hoverable:!0})})]})]})},$o="_wrapper_st58d_1",No="_label_st58d_10",Co="_textarea_st58d_18",So="_length_st58d_33",ct={wrapper:$o,label:No,textarea:Co,length:So},Bo=u=>{const{onChange:o,label:e,value:s,maxLength:i,placeholder:a="Type something..."}=u,[c,r]=_.useState(s.length);return t.jsxRuntimeExports.jsxs("div",{className:ct.wrapper,children:[e&&t.jsxRuntimeExports.jsx("label",{className:ct.label,htmlFor:e,children:e}),t.jsxRuntimeExports.jsx("textarea",{id:e,defaultValue:s,onChange:n=>{r(n.target.value.length),o(n.target.value)},placeholder:a,className:ct.textarea,maxLength:i}),i&&t.jsxRuntimeExports.jsxs("div",{className:ct.length,children:[c,"/",i]})]})};exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.Icon=t.Icon;exports.InputSettings=t.Input;exports.Loader=t.Loader;exports.Modal=t.Modal;exports.Select=t.Select;exports.Switch=t.Switch;exports.TextareaSettings=t.Textarea;exports.Accordion=go;exports.Button=lt;exports.ButtonTypeSettings=jt;exports.ButtonsSettings=nn;exports.CategorySettings=ze;exports.EmptyCart=vt;exports.FormSettings=ms;exports.HeaderButtons=to;exports.InputUI=wo;exports.ItemsSettings=_t;exports.LayoutSettings=At;exports.ListingSelector=zn;exports.ProductOptions=xi;exports.RangeSelector=ut;exports.ShareLink=uo;exports.ShoppingButton=ft;exports.ShoppingModalCart=bt;exports.TextSettings=ht;exports.TextareaUI=Bo;exports.TypesText=pt;exports.UserInfo=Et;