@billgangcom/theme-lib 1.8.2 → 1.9.0

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.
@@ -27,7 +27,7 @@ Check the top-level render call using <`+E+">.")}return v}}function Er(c,v){{if(
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,mt,le,_s,le),_r[le+mt]=!0}}return c===n?bs(q):ys(q),q}}function Ss(c,v,E){return Tr(c,v,E,!0)}function ws(c,v,E){return Tr(c,v,E,!1)}var Es=ws,Os=Ss;xe.Fragment=n,xe.jsx=Es,xe.jsxs=Os}()),xe}process.env.NODE_ENV==="production"?It.exports=Ds():It.exports=Cs();var m=It.exports;const xr=t=>{let e;const r=new Set,n=(l,u)=>{const h=typeof l=="function"?l(e):l;if(!Object.is(h,e)){const S=e;e=u??(typeof h!="object"||h===null)?h:Object.assign({},e,h),r.forEach(y=>y(e,S))}},s=()=>e,a={setState:n,getState:s,getInitialState:()=>d,subscribe:l=>(r.add(l),()=>r.delete(l))},d=e=t(n,s,a);return a},xs=t=>t?xr(t):xr,Ps=t=>t;function Is(t,e=Ps){const r=D.useSyncExternalStore(t.subscribe,()=>e(t.getState()),()=>e(t.getInitialState()));return D.useDebugValue(r),r}const Pr=t=>{const e=xs(t),r=n=>Is(e,n);return Object.assign(r,e),r},Y=t=>t?Pr(t):Pr,Rs=Y(t=>({blocks:{},setBlocks:e=>t(()=>({blocks:e})),activeBlock:null,setActiveBlock:e=>t(()=>({activeBlock:e})),sourceBlocks:{},setSourceBlocks:e=>t(()=>({sourceBlocks:e}))})),Ns=Y(t=>({currentDevice:"desktop",setCurrentDevice:e=>t(()=>({currentDevice:e}))}));Y(t=>({pageData:null,setPageData:e=>t(()=>({pageData:e}))}));const on=[{icon:"layers",name:"Layers"},{icon:"plus",name:"Add"},{icon:"palette",name:"Theme"},{icon:"settings",name:"Settings"}],ks=Array.from({length:122/2+1},(t,e)=>String(6+e*2)),js=["100","200","300","400","500","600","700","800","900"],As=["home","reviews","faqs","contact","product","ticket","login"],Ms={home:{path:"/",name:"home",icon:"house",seo:{description:"",title:""},visibility:"public"},product:{path:"/product",name:"product",icon:"squares",seo:{description:"",title:""},visibility:"public"},faqs:{path:"/faqs",name:"faqs",icon:"faqs",seo:{description:"",title:""},visibility:"public"},reviews:{path:"/reviews",name:"reviews",icon:"star",seo:{description:"",title:""},visibility:"public"},contact:{path:"/contact",name:"contact",icon:"chat",seo:{description:"",title:""},visibility:"public"},ticket:{path:"/ticket",name:"ticket",icon:"ticket",seo:{description:"",title:""},visibility:"public"},login:{path:"/login",name:"login",icon:"user-circle-gear",seo:{description:"",title:""},visibility:"public"}},Ls=Y(t=>({activeBlock:on[0],setActiveBlock:e=>t(()=>({activeBlock:e}))}));function qs(t,e){let r;try{r=t()}catch{return}return{getItem:s=>{var o;const i=d=>d===null?null:JSON.parse(d,void 0),a=(o=r.getItem(s))!=null?o:null;return a instanceof Promise?a.then(i):i(a)},setItem:(s,o)=>r.setItem(s,JSON.stringify(o,void 0)),removeItem:s=>r.removeItem(s)}}const Rt=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return Rt(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return Rt(n)(r)}}}},Bs=(t,e)=>(r,n,s)=>{let o={storage:qs(()=>localStorage),partialize:p=>p,version:0,merge:(p,b)=>({...b,...p}),...e},i=!1;const a=new Set,d=new Set;let l=o.storage;if(!l)return t((...p)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...p)},n,s);const u=()=>{const p=o.partialize({...n()});return l.setItem(o.name,{state:p,version:o.version})},h=s.setState;s.setState=(p,b)=>{h(p,b),u()};const S=t((...p)=>{r(...p),u()},n,s);s.getInitialState=()=>S;let y;const g=()=>{var p,b;if(!l)return;i=!1,a.forEach(w=>{var _;return w((_=n())!=null?_:S)});const O=((b=o.onRehydrateStorage)==null?void 0:b.call(o,(p=n())!=null?p:S))||void 0;return Rt(l.getItem.bind(l))(o.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return[!0,o.migrate(w.state,w.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,w.state];return[!1,void 0]}).then(w=>{var _;const[k,M]=w;if(y=o.merge(M,(_=n())!=null?_:S),r(y,!0),k)return u()}).then(()=>{O==null||O(y,void 0),y=n(),i=!0,d.forEach(w=>w(y))}).catch(w=>{O==null||O(void 0,w)})};return s.persist={setOptions:p=>{o={...o,...p},p.storage&&(l=p.storage)},clearStorage:()=>{l==null||l.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>g(),hasHydrated:()=>i,onHydrate:p=>(a.add(p),()=>{a.delete(p)}),onFinishHydration:p=>(d.add(p),()=>{d.delete(p)})},o.skipHydration||g(),y||S},Ke=Bs,Fs=Y(Ke(t=>({onPreview:!1,setOnPreview:e=>t(()=>({onPreview:e})),activeBlock:null,setActiveBlock:e=>t(()=>({activeBlock:e}))}),{name:"preview-storage",partialize:t=>{const{onPreview:e}=t;return{onPreview:e}}}));var F=[];for(var vt=0;vt<256;++vt)F.push((vt+256).toString(16).slice(1));function Us(t,e=0){return(F[t[e+0]]+F[t[e+1]]+F[t[e+2]]+F[t[e+3]]+"-"+F[t[e+4]]+F[t[e+5]]+"-"+F[t[e+6]]+F[t[e+7]]+"-"+F[t[e+8]]+F[t[e+9]]+"-"+F[t[e+10]]+F[t[e+11]]+F[t[e+12]]+F[t[e+13]]+F[t[e+14]]+F[t[e+15]]).toLowerCase()}var Be,Hs=new Uint8Array(16);function $s(){if(!Be&&(Be=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Be))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Be(Hs)}var Vs=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Ir={randomUUID:Vs};function Ye(t,e,r){if(Ir.randomUUID&&!e&&!t)return Ir.randomUUID();t=t||{};var n=t.random||(t.rng||$s)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Us(n)}const zs=Y(Ke((t,e)=>({header:null,blocks:{home:{},contact:{},product:{},faqs:{},reviews:{},ticket:{},login:{}},footer:null,currentBlock:null,positionBlock:null,setHeader:r=>{t({header:r})},setFooter:r=>{t({footer:r})},createPage:r=>{const n=e().blocks;n[r]={},t({blocks:n})},deletePage:r=>{const n=e().blocks;delete n[r],t({blocks:n})},updatePage:(r,n)=>{const s=e().blocks;if(s[n])return;const o=s[r];delete s[r],s[n]=o,t({blocks:s})},setCurrentBlock:r=>{t({currentBlock:r})},setPositionBlock:r=>{t({positionBlock:r})},addBlock:(r,n)=>{const s=e().blocks,o=s[r]||{},i=e().positionBlock,a=Ye();o[a]={name:n.name,value:n.value};const d=Object.keys(o);if(i===null||i>=d.length)t({blocks:{...s,[r]:o}});else{const l={name:n.name,value:{...n.value}},u=d.slice(0,i),h=d.slice(i),S={...u.reduce((y,g)=>(y[g]=o[g],y),{}),[a]:l,...h.reduce((y,g)=>(y[g]=o[g],y),{})};t({blocks:{...s,[r]:S}})}},editBlock:(r,n,s)=>{const o=e().blocks,i=o[r]||{};i[n]={name:s.name,value:{...s.value}},t({blocks:{...o,[r]:i}})},removeBlock:(r,n)=>{const s=e().blocks,o=s[r]||{};delete o[n],t({blocks:{...s,[r]:o}})},moveBlock:(r,n,s)=>t(o=>{const i={...o.blocks[r]},a=Object.keys(i),[d]=a.splice(n,1);a.splice(s,0,d);const l=a.reduce((u,h)=>(u[h]=i[h],u),{});return{blocks:{...o.blocks,[r]:l}}}),duplicateBlock:(r,n)=>{const{blocks:s}=e(),o=s[r],i=o[n],a=Ye(),d={name:i.name,value:{...i.value}},l=Object.keys(o),u=l.indexOf(n),h=l.slice(0,u+1),S=l.slice(u+1),y={...h.reduce((g,p)=>(g[p]=o[p],g),{}),[a]:d,...S.reduce((g,p)=>(g[p]=o[p],g),{})};t({blocks:{...s,[r]:y}})}}),{name:"layers-storage",partialize:t=>{const{blocks:e,header:r,footer:n}=t;return{blocks:e,header:r,footer:n}}})),an=Y((t,e)=>({isModalVisible:!1,hoverBlockId:null,isMouseOverModal:!1,hideTimeout:null,showModal:r=>{e().hideTimeout&&clearTimeout(e().hideTimeout),t({isModalVisible:!0,hoverBlockId:r})},hideModal:()=>{t({isModalVisible:!1,hoverBlockId:null})},startHideTimeout:()=>{if(!e().isMouseOverModal){const r=setTimeout(()=>{t({isModalVisible:!1,hoverBlockId:null})},500);t({hideTimeout:r})}},clearHideTimeout:()=>{e().hideTimeout&&(clearTimeout(e().hideTimeout),t({hideTimeout:null}))},setMouseOverModal:r=>{t({isMouseOverModal:r})},isPreviewVisible:!1,showPreview:r=>{t({isPreviewVisible:!0,hoverBlockId:r})},hidePreview:()=>{t({isPreviewVisible:!1,hoverBlockId:null})}})),Ws=Y(t=>({activeBlock:null,setActiveBlock:e=>t(()=>({activeBlock:e})),activeFont:null,setActiveFont:e=>t(()=>({activeFont:e})),themeSettings:{colors:{brand:{primary:"#fefefe",secondary:"#fefefe",toner:"#ffffff"},background:{primary:"#fefefe",secondary:"#000000"},text_icons:{primary:"#000000",secondary:"#fefefe",tertiary:"#fefefe",disabled:"#ffffff"},lines:{divider:"#000000",border:"#fefefe"},others:{link:"#000000"}},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:{size:26,alignment:"left",radius:32,height:40},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:(e,r,n)=>t(s=>{const o={...s.themeSettings.colors,[e]:{...s.themeSettings.colors[e],[r]:n}};return{themeSettings:{...s.themeSettings,colors:o}}}),updateFont:(e,r,n,s)=>t(o=>{const i={...o.themeSettings.fonts,[e]:{...o.themeSettings.fonts[e],[r]:{...o.themeSettings.fonts[e][r],[n]:s}}};return{themeSettings:{...o.themeSettings,fonts:i}}}),updateBorder:(e,r)=>t(n=>{const s={...n.themeSettings.borders,[e]:r};return{themeSettings:{...n.themeSettings,borders:s}}}),updateButton:(e,r)=>t(n=>{const s={...n.themeSettings.buttons,[e]:r};return{themeSettings:{...n.themeSettings,buttons:s}}}),updateInput:(e,r,n)=>t(s=>({themeSettings:{...s.themeSettings,inputs:{...s.themeSettings.inputs,[e]:{...s.themeSettings.inputs[e],[n]:r}}}}))})),Ys=Y(Ke(t=>({fonts:[],setFonts:e=>t(()=>({fonts:e}))}),{name:"fonts-storage"})),Js=Y(t=>({settings:null,setSettings:e=>t(()=>({settings:e}))})),cn=Y()(t=>({color:"default",initialColor:"",setInitialColor:e=>t(()=>({initialColor:e})),colorChange:()=>{},update:()=>{},activeLabel:null,modalPosition:{left:0,top:0},showModal:!1,dragging:!1,hue:0,saturation:100,brightness:100,setModalPosition:e=>t(()=>({modalPosition:e})),setHue:e=>t(()=>({hue:e})),setSaturation:e=>t(()=>({saturation:e})),setBrightness:e=>t(()=>({brightness:e})),setShowModal:e=>t(()=>({showModal:e})),setDragging:e=>t(()=>({dragging:e})),setActiveLabel:e=>t(()=>({activeLabel:e})),setColor:e=>t(()=>({color:e})),setUpdate:e=>t(()=>({update:e})),setColorChange:e=>t(()=>({colorChange:e}))})),Gs=Y(Ke((t,e)=>({pages:Ms,currentPage:"home",pageContext:{listings:void 0,products:void 0,reviews:void 0,categories:void 0,faqs:void 0,general:void 0},isOpenModal:!1,isOpenSelectModal:!1,isEdit:!1,editedPage:null,setEditedPage:r=>t(()=>({editedPage:r})),setCurrentPage:r=>t(()=>({currentPage:r})),setPageContext:r=>t(()=>({pageContext:r})),setIsOpenModal:r=>t(()=>({isOpenModal:r})),setIsOpenSelectModal:r=>t(()=>({isOpenSelectModal:r})),setIsEdit:r=>t(()=>({isEdit:r})),createPage:r=>{const n=e().pages,s=Ye();n[s]=r,t({pages:n})},updatePage:(r,n)=>{const s=e().pages;s[r]={...n},t({pages:s})},deletePage:r=>{const n=e().pages;delete n[r],t({pages:n})}}),{name:"pages-storage",partialize:t=>{const{pages:e}=t;return{pages:e}}})),zt=Y(t=>({openModal:!1,setOpenModal:e=>t(()=>({openModal:e})),onChange:null,setOnChange:e=>t(()=>({onChange:e}))})),Ks=(t,e,r)=>{const n=t[e];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((s,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},Xs="_icon_bsuj2_1",Qs="_hoverable_bsuj2_5",Zs="_rotated_bsuj2_9",yt={icon:Xs,hoverable:Qs,rotated:Zs};var ln={exports:{}};/*!
30
+ <%s key={someKey} {...props} />`,mt,le,_s,le),_r[le+mt]=!0}}return c===n?bs(q):ys(q),q}}function Ss(c,v,E){return Tr(c,v,E,!0)}function ws(c,v,E){return Tr(c,v,E,!1)}var Es=ws,Os=Ss;xe.Fragment=n,xe.jsx=Es,xe.jsxs=Os}()),xe}process.env.NODE_ENV==="production"?It.exports=Ds():It.exports=Cs();var m=It.exports;const xr=t=>{let e;const r=new Set,n=(l,u)=>{const h=typeof l=="function"?l(e):l;if(!Object.is(h,e)){const S=e;e=u??(typeof h!="object"||h===null)?h:Object.assign({},e,h),r.forEach(y=>y(e,S))}},s=()=>e,a={setState:n,getState:s,getInitialState:()=>d,subscribe:l=>(r.add(l),()=>r.delete(l))},d=e=t(n,s,a);return a},xs=t=>t?xr(t):xr,Ps=t=>t;function Is(t,e=Ps){const r=D.useSyncExternalStore(t.subscribe,()=>e(t.getState()),()=>e(t.getInitialState()));return D.useDebugValue(r),r}const Pr=t=>{const e=xs(t),r=n=>Is(e,n);return Object.assign(r,e),r},Y=t=>t?Pr(t):Pr,Rs=Y(t=>({blocks:{},setBlocks:e=>t(()=>({blocks:e})),activeBlock:null,setActiveBlock:e=>t(()=>({activeBlock:e})),sourceBlocks:{},setSourceBlocks:e=>t(()=>({sourceBlocks:e}))})),Ns=Y(t=>({currentDevice:"desktop",setCurrentDevice:e=>t(()=>({currentDevice:e}))}));Y(t=>({pageData:null,setPageData:e=>t(()=>({pageData:e}))}));const on=[{icon:"layers",name:"Layers"},{icon:"plus",name:"Add"},{icon:"palette",name:"Theme"},{icon:"settings",name:"Settings"}],ks=Array.from({length:122/2+1},(t,e)=>String(6+e*2)),js=["100","200","300","400","500","600","700","800","900"],As=["home","reviews","faqs","contact","product","ticket","login"],Ms={home:{path:"/",name:"home",icon:"house",seo:{description:"",title:""},visibility:"public"},product:{path:"/product",name:"product",icon:"squares",seo:{description:"",title:""},visibility:"public"},faqs:{path:"/faqs",name:"faqs",icon:"faqs",seo:{description:"",title:""},visibility:"public"},reviews:{path:"/reviews",name:"reviews",icon:"star",seo:{description:"",title:""},visibility:"public"},contact:{path:"/contact",name:"contact",icon:"chat",seo:{description:"",title:""},visibility:"public"},ticket:{path:"/ticket",name:"ticket",icon:"ticket",seo:{description:"",title:""},visibility:"public"},login:{path:"/login",name:"login",icon:"user-circle-gear",seo:{description:"",title:""},visibility:"public"}},Ls=Y(t=>({activeBlock:on[0],setActiveBlock:e=>t(()=>({activeBlock:e}))}));function qs(t,e){let r;try{r=t()}catch{return}return{getItem:s=>{var o;const i=d=>d===null?null:JSON.parse(d,void 0),a=(o=r.getItem(s))!=null?o:null;return a instanceof Promise?a.then(i):i(a)},setItem:(s,o)=>r.setItem(s,JSON.stringify(o,void 0)),removeItem:s=>r.removeItem(s)}}const Rt=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return Rt(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return Rt(n)(r)}}}},Bs=(t,e)=>(r,n,s)=>{let o={storage:qs(()=>localStorage),partialize:p=>p,version:0,merge:(p,b)=>({...b,...p}),...e},i=!1;const a=new Set,d=new Set;let l=o.storage;if(!l)return t((...p)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...p)},n,s);const u=()=>{const p=o.partialize({...n()});return l.setItem(o.name,{state:p,version:o.version})},h=s.setState;s.setState=(p,b)=>{h(p,b),u()};const S=t((...p)=>{r(...p),u()},n,s);s.getInitialState=()=>S;let y;const g=()=>{var p,b;if(!l)return;i=!1,a.forEach(w=>{var _;return w((_=n())!=null?_:S)});const O=((b=o.onRehydrateStorage)==null?void 0:b.call(o,(p=n())!=null?p:S))||void 0;return Rt(l.getItem.bind(l))(o.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return[!0,o.migrate(w.state,w.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,w.state];return[!1,void 0]}).then(w=>{var _;const[k,M]=w;if(y=o.merge(M,(_=n())!=null?_:S),r(y,!0),k)return u()}).then(()=>{O==null||O(y,void 0),y=n(),i=!0,d.forEach(w=>w(y))}).catch(w=>{O==null||O(void 0,w)})};return s.persist={setOptions:p=>{o={...o,...p},p.storage&&(l=p.storage)},clearStorage:()=>{l==null||l.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>g(),hasHydrated:()=>i,onHydrate:p=>(a.add(p),()=>{a.delete(p)}),onFinishHydration:p=>(d.add(p),()=>{d.delete(p)})},o.skipHydration||g(),y||S},Ke=Bs,Fs=Y(Ke(t=>({onPreview:!1,setOnPreview:e=>t(()=>({onPreview:e})),activeBlock:null,setActiveBlock:e=>t(()=>({activeBlock:e}))}),{name:"preview-storage",partialize:t=>{const{onPreview:e}=t;return{onPreview:e}}}));var F=[];for(var vt=0;vt<256;++vt)F.push((vt+256).toString(16).slice(1));function Us(t,e=0){return(F[t[e+0]]+F[t[e+1]]+F[t[e+2]]+F[t[e+3]]+"-"+F[t[e+4]]+F[t[e+5]]+"-"+F[t[e+6]]+F[t[e+7]]+"-"+F[t[e+8]]+F[t[e+9]]+"-"+F[t[e+10]]+F[t[e+11]]+F[t[e+12]]+F[t[e+13]]+F[t[e+14]]+F[t[e+15]]).toLowerCase()}var Be,Hs=new Uint8Array(16);function $s(){if(!Be&&(Be=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Be))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Be(Hs)}var Vs=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Ir={randomUUID:Vs};function Ye(t,e,r){if(Ir.randomUUID&&!e&&!t)return Ir.randomUUID();t=t||{};var n=t.random||(t.rng||$s)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Us(n)}const zs=Y(Ke((t,e)=>({header:null,blocks:{home:{},contact:{},product:{},faqs:{},reviews:{},ticket:{},login:{}},footer:null,currentBlock:null,positionBlock:null,setHeader:r=>{t({header:r})},setFooter:r=>{t({footer:r})},createPage:r=>{const n=e().blocks;n[r]={},t({blocks:n})},deletePage:r=>{const n=e().blocks;delete n[r],t({blocks:n})},updatePage:(r,n)=>{const s=e().blocks;if(s[n])return;const o=s[r];delete s[r],s[n]=o,t({blocks:s})},setCurrentBlock:r=>{t({currentBlock:r})},setPositionBlock:r=>{t({positionBlock:r})},addBlock:(r,n)=>{const s=e().blocks,o=s[r]||{},i=e().positionBlock,a=Ye();o[a]={name:n.name,value:n.value};const d=Object.keys(o);if(i===null||i>=d.length)t({blocks:{...s,[r]:o}});else{const l={name:n.name,value:{...n.value}},u=d.slice(0,i),h=d.slice(i),S={...u.reduce((y,g)=>(y[g]=o[g],y),{}),[a]:l,...h.reduce((y,g)=>(y[g]=o[g],y),{})};t({blocks:{...s,[r]:S}})}},editBlock:(r,n,s)=>{const o=e().blocks,i=o[r]||{};i[n]={name:s.name,value:{...s.value}},t({blocks:{...o,[r]:i}})},removeBlock:(r,n)=>{const s=e().blocks,o=s[r]||{};delete o[n],t({blocks:{...s,[r]:o}})},moveBlock:(r,n,s)=>t(o=>{const i={...o.blocks[r]},a=Object.keys(i),[d]=a.splice(n,1);a.splice(s,0,d);const l=a.reduce((u,h)=>(u[h]=i[h],u),{});return{blocks:{...o.blocks,[r]:l}}}),duplicateBlock:(r,n)=>{const{blocks:s}=e(),o=s[r],i=o[n],a=Ye(),d={name:i.name,value:{...i.value}},l=Object.keys(o),u=l.indexOf(n),h=l.slice(0,u+1),S=l.slice(u+1),y={...h.reduce((g,p)=>(g[p]=o[p],g),{}),[a]:d,...S.reduce((g,p)=>(g[p]=o[p],g),{})};t({blocks:{...s,[r]:y}})}}),{name:"layers-storage",partialize:t=>{const{blocks:e,header:r,footer:n}=t;return{blocks:e,header:r,footer:n}}})),an=Y((t,e)=>({isModalVisible:!1,hoverBlockId:null,isMouseOverModal:!1,hideTimeout:null,setHoverBlockId:r=>{t({hoverBlockId:r})},showModal:r=>{e().hideTimeout&&clearTimeout(e().hideTimeout),t({isModalVisible:!0,hoverBlockId:r})},hideModal:()=>{t({isModalVisible:!1,hoverBlockId:null})},startHideTimeout:()=>{if(!e().isMouseOverModal){const r=setTimeout(()=>{t({isModalVisible:!1,hoverBlockId:null})},500);t({hideTimeout:r})}},clearHideTimeout:()=>{e().hideTimeout&&(clearTimeout(e().hideTimeout),t({hideTimeout:null}))},setMouseOverModal:r=>{t({isMouseOverModal:r})},isPreviewVisible:!1,showPreview:r=>{t({isPreviewVisible:!0,hoverBlockId:r})},hidePreview:()=>{t({isPreviewVisible:!1,hoverBlockId:null})}})),Ws=Y(t=>({activeBlock:null,setActiveBlock:e=>t(()=>({activeBlock:e})),activeFont:null,setActiveFont:e=>t(()=>({activeFont:e})),themeSettings:{colors:{brand:{primary:"#fefefe",secondary:"#fefefe",toner:"#ffffff"},background:{primary:"#fefefe",secondary:"#000000"},text_icons:{primary:"#000000",secondary:"#fefefe",tertiary:"#fefefe",disabled:"#ffffff"},lines:{divider:"#000000",border:"#fefefe"},others:{link:"#000000"}},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:{size:26,alignment:"left",radius:32,height:40},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:(e,r,n)=>t(s=>{const o={...s.themeSettings.colors,[e]:{...s.themeSettings.colors[e],[r]:n}};return{themeSettings:{...s.themeSettings,colors:o}}}),updateFont:(e,r,n,s)=>t(o=>{const i={...o.themeSettings.fonts,[e]:{...o.themeSettings.fonts[e],[r]:{...o.themeSettings.fonts[e][r],[n]:s}}};return{themeSettings:{...o.themeSettings,fonts:i}}}),updateBorder:(e,r)=>t(n=>{const s={...n.themeSettings.borders,[e]:r};return{themeSettings:{...n.themeSettings,borders:s}}}),updateButton:(e,r)=>t(n=>{const s={...n.themeSettings.buttons,[e]:r};return{themeSettings:{...n.themeSettings,buttons:s}}}),updateInput:(e,r,n)=>t(s=>({themeSettings:{...s.themeSettings,inputs:{...s.themeSettings.inputs,[e]:{...s.themeSettings.inputs[e],[n]:r}}}}))})),Ys=Y(Ke(t=>({fonts:[],setFonts:e=>t(()=>({fonts:e}))}),{name:"fonts-storage"})),Js=Y(t=>({settings:null,setSettings:e=>t(()=>({settings:e}))})),cn=Y()(t=>({color:"default",initialColor:"",setInitialColor:e=>t(()=>({initialColor:e})),colorChange:()=>{},update:()=>{},activeLabel:null,modalPosition:{left:0,top:0},showModal:!1,dragging:!1,hue:0,saturation:100,brightness:100,setModalPosition:e=>t(()=>({modalPosition:e})),setHue:e=>t(()=>({hue:e})),setSaturation:e=>t(()=>({saturation:e})),setBrightness:e=>t(()=>({brightness:e})),setShowModal:e=>t(()=>({showModal:e})),setDragging:e=>t(()=>({dragging:e})),setActiveLabel:e=>t(()=>({activeLabel:e})),setColor:e=>t(()=>({color:e})),setUpdate:e=>t(()=>({update:e})),setColorChange:e=>t(()=>({colorChange:e}))})),Gs=Y(Ke((t,e)=>({pages:Ms,currentPage:"home",pageContext:{listings:void 0,products:void 0,reviews:void 0,categories:void 0,faqs:void 0,general:void 0},isOpenModal:!1,isOpenSelectModal:!1,isEdit:!1,editedPage:null,setEditedPage:r=>t(()=>({editedPage:r})),setCurrentPage:r=>t(()=>({currentPage:r})),setPageContext:r=>t(()=>({pageContext:r})),setIsOpenModal:r=>t(()=>({isOpenModal:r})),setIsOpenSelectModal:r=>t(()=>({isOpenSelectModal:r})),setIsEdit:r=>t(()=>({isEdit:r})),createPage:r=>{const n=e().pages,s=Ye();n[s]=r,t({pages:n})},updatePage:(r,n)=>{const s=e().pages;s[r]={...n},t({pages:s})},deletePage:r=>{const n=e().pages;delete n[r],t({pages:n})}}),{name:"pages-storage",partialize:t=>{const{pages:e}=t;return{pages:e}}})),zt=Y(t=>({openModal:!1,setOpenModal:e=>t(()=>({openModal:e})),onChange:null,setOnChange:e=>t(()=>({onChange:e}))})),Ks=(t,e,r)=>{const n=t[e];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((s,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},Xs="_icon_bsuj2_1",Qs="_hoverable_bsuj2_5",Zs="_rotated_bsuj2_9",yt={icon:Xs,hoverable:Qs,rotated:Zs};var ln={exports:{}};/*!
31
31
  Copyright (c) 2018 Jed Watson.
32
32
  Licensed under the MIT License (MIT), see
33
33
  http://jedwatson.github.io/classnames
@@ -1100,6 +1100,9 @@ const Cu = W(
1100
1100
  hoverBlockId: null,
1101
1101
  isMouseOverModal: !1,
1102
1102
  hideTimeout: null,
1103
+ setHoverBlockId: (r) => {
1104
+ t({ hoverBlockId: r });
1105
+ },
1103
1106
  showModal: (r) => {
1104
1107
  e().hideTimeout && clearTimeout(e().hideTimeout), t({ isModalVisible: !0, hoverBlockId: r });
1105
1108
  },
@@ -11,6 +11,7 @@ interface Options {
11
11
  isPreviewVisible: boolean;
12
12
  showPreview: (blockId: string) => void;
13
13
  hidePreview: () => void;
14
+ setHoverBlockId: (hoverBlockId: string | null) => void;
14
15
  }
15
16
  export declare const useSubmodalStore: import("zustand").UseBoundStore<import("zustand").StoreApi<Options>>;
16
17
  export {};
@@ -1,7 +1,7 @@
1
1
  import { ModalOption } from './popup';
2
2
  import { Other } from '../OtherSettings';
3
3
  export interface ItemBase {
4
- image?: string;
4
+ images: string[];
5
5
  name: string;
6
6
  id: string;
7
7
  }
@@ -0,0 +1,49 @@
1
+ import { Other } from '../OtherSettings';
2
+ import { Listing } from '../../abstractions';
3
+ interface ListingData {
4
+ id: number;
5
+ link: {
6
+ to: string;
7
+ };
8
+ productData: {
9
+ compareAtPrice: {
10
+ amount: number;
11
+ currency: string;
12
+ };
13
+ images: string[];
14
+ isInStock: boolean;
15
+ minPrice: {
16
+ amount: number;
17
+ currency: string;
18
+ };
19
+ name: string;
20
+ shortDescription: string;
21
+ stats: {
22
+ averageRating: number;
23
+ totalReviews: number;
24
+ totalSold: number;
25
+ };
26
+ uniquePath: string;
27
+ };
28
+ type: string;
29
+ }
30
+ interface Props {
31
+ isActiveItems?: boolean;
32
+ setIsActiveItems?: (value: boolean) => void;
33
+ items: Listing[];
34
+ setItems: (value: Listing[]) => void;
35
+ title?: string;
36
+ subtitle?: string;
37
+ editable?: boolean;
38
+ draggable?: boolean;
39
+ withImage?: boolean;
40
+ deletable?: boolean;
41
+ addable?: boolean;
42
+ other?: Other[];
43
+ addableOptions?: Record<string, any>;
44
+ itemsType: 'select';
45
+ itemsPlaceholder?: never;
46
+ itemsOptions: ListingData[];
47
+ }
48
+ export declare const ListingSelector: (props: Props) => import("react/jsx-runtime").JSX.Element;
49
+ export {};
@@ -0,0 +1,12 @@
1
+ import { Listing } from '../../abstractions';
2
+ interface Props {
3
+ activeItem: Listing;
4
+ setActiveItem: (value: Listing | null) => void;
5
+ setIsOpenModal: React.Dispatch<React.SetStateAction<boolean>>;
6
+ popupPosition: {
7
+ top: number;
8
+ left: number;
9
+ };
10
+ }
11
+ export declare const ListingPopup: (props: Props) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -7,3 +7,4 @@ export * from './TypesText';
7
7
  export * from './ChooseImage';
8
8
  export * from './ButtonTypeSettings';
9
9
  export * from './RangeSelector';
10
+ export * from './ListingSelector';
package/dist/ui.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-D4KlodOJ.cjs"),b=require("react"),V="_wrapper_1g82c_2",W="_alignmentBlock_1g82c_8",X="_title_1g82c_15",Z="_subtitle_1g82c_22",tt="_alignmentContent_1g82c_29",et="_alignments_1g82c_35",st="_alignment_1g82c_8",nt="_circle_1g82c_54",ot="_paddings_1g82c_61",it="_padding_1g82c_61",ct="_input_1g82c_79",v={wrapper:V,alignmentBlock:W,title:X,subtitle:Z,alignmentContent:tt,alignments:et,alignment:st,circle:nt,paddings:ot,padding:it,input:ct},lt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],rt=["left","top","right","bottom"],at=x=>{const{alignment:s,padding:o,setPadding:i,setAlignment:l}=x;function e(){switch(s){case"left":case"topLeft":case"bottomLeft":return"left";case"right":case"topRight":case"bottomRight":return"right";case"center":case"top":case"bottom":return"center";default:return"center"}}return t.jsxRuntimeExports.jsxs("div",{className:v.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:v.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:v.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:v.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:v.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:v.alignments,children:lt.map(n=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{l(n)},className:v.alignment,children:[n!==s&&t.jsxRuntimeExports.jsx("div",{className:v.circle}),n===s&&t.jsxRuntimeExports.jsx(t.Icon,{name:`text-align-${e()}`,fill:"#FF3F19",width:22,height:22})]},n))}),t.jsxRuntimeExports.jsx("div",{className:v.paddings,children:rt.map(n=>t.jsxRuntimeExports.jsxs("label",{className:v.padding,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:`align-${n}`,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"text",value:String(o[n]),onChange:r=>i({...o,[n]:Number(r)}),paddingless:!0,borderless:!0})]}))})]})]})]})},xt="_subtitle_2zbxx_1",ut="_header_2zbxx_8",dt="_text_2zbxx_9",pt="_top_2zbxx_16",mt="_itemsBlock_2zbxx_23",C={subtitle:xt,header:ut,text:dt,top:pt,itemsBlock:mt},_t="_typeTexts_3zlec_1",ht="_block_3zlec_7",gt="_active_3zlec_18",A={typeTexts:_t,block:ht,active:gt},jt=["bold","italic","underline","strike-through","code"],L=x=>{const{typesText:s,setTypesText:o}=x;return t.jsxRuntimeExports.jsx("div",{className:A.typeTexts,children:jt.map(i=>t.jsxRuntimeExports.jsx("div",{className:t.clx(A.block,{[A.active]:s.includes(i)}),onClick:()=>{const l=[...s];if(l.includes(i)){const e=l.filter(n=>n!==i);o(e)}else l.push(i),o(l)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:`text-${i}`,fill:s.includes(i)?"#252525":"#757575",width:20,height:20})},String(i)))})},M=x=>{const{typesText:s,isActiveText:o,setIsActiveText:i,text:l,setText:e,setTypesText:n,title:r,subtitle:_="Items"}=x;return t.jsxRuntimeExports.jsxs("div",{className:C.text,children:[(r||o)&&t.jsxRuntimeExports.jsxs("div",{className:C.top,children:[r&&t.jsxRuntimeExports.jsx("h3",{className:C.title,children:r}),o&&i&&t.jsxRuntimeExports.jsx(t.Switch,{current:o,onChange:f=>i(f)})]}),t.jsxRuntimeExports.jsxs("div",{className:C.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:C.subtitle,children:_}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:f=>e(f),value:l,maxLength:150}),t.jsxRuntimeExports.jsx(L,{typesText:s,setTypesText:n})]})]})},bt="_subtitle_1nl8x_1",ft="_header_1nl8x_8",Rt="_text_1nl8x_9",Et="_productsBlock_1nl8x_10",vt="_top_1nl8x_22",kt="_itemsBlock_1nl8x_29",yt="_typeTexts_1nl8x_35",wt="_block_1nl8x_41",$t="_active_1nl8x_52",It="_products_1nl8x_10",Bt="_product_1nl8x_10",Nt="_button_1nl8x_70",Ct="_image_1nl8x_80",Tt="_info_1nl8x_87",St="_name_1nl8x_98",Pt="_buttons_1nl8x_102",At="_modal_1nl8x_108",Ot="_link_1nl8x_126",Lt="_modalOptions_1nl8x_132",j={subtitle:bt,header:ft,text:Rt,productsBlock:Et,top:vt,itemsBlock:kt,typeTexts:yt,block:wt,active:$t,products:It,product:Bt,button:Nt,image:Ct,info:Tt,name:St,buttons:Pt,modal:At,link:Ot,modalOptions:Lt},Dt=x=>{const{activeItem:s,setActiveItem:o,popupPosition:i,modalOptions:l}=x;return t.jsxRuntimeExports.jsxs("div",{className:j.modal,onClick:e=>{e.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:j.top,children:[t.jsxRuntimeExports.jsx("h3",{children:s.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"x",height:20,width:20,hoverable:!0,onClick:()=>o(null)})]}),t.jsxRuntimeExports.jsx("div",{className:j.modalOptions,children:l.map(e=>{if(e.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:n=>{const r={...s,[e.field]:n[0]};o(r)}});if(e.type==="text")return t.jsxRuntimeExports.jsx(M,{typesText:s[e.field.type],setTypesText:n=>{const r={...s,[e.field.type]:n};o(r)},text:s[e.field.text]||"",setText:n=>{const r={...s,[e.field.text]:n};o(r)},subtitle:e.label});if(e.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:n=>{const r={...s,[e.field]:n};o(r)},value:s[e.field]||"",label:e.label,placeholder:e.placeholder});if(e.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:j.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:n=>{const r={...s,[e.field.text]:n};o(r)},value:s[e.field.text]||"",label:e.inputLabel,placeholder:e.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!s[e.field.switch]||!1,label:e.switchLabel,onChange:n=>{const r={...s,[e.field.switch]:n};o(r)}})]});if(e.type==="list")return t.jsxRuntimeExports.jsx(F,{items:s[e.field]||[],setItems:n=>{const r={...s,[e.field]:n};o(r)},itemsType:"select",draggable:e.draggable||!1,itemsOptions:e.itemsOptions,deletable:e.deletable||!1,editable:!1,subtitle:e.label});if(e.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:e.itemsOptions,onChange:n=>{const r={...s,[e.field]:n};o(r)},label:e.label,value:s[e.field]||"String"})})})]})},zt="_other_1wtgi_1",Ht="_subtitle_1wtgi_7",Mt="_items_1wtgi_14",O={other:zt,subtitle:Ht,items:Mt},Ft=x=>{const{items:s,title:o="Other"}=x;return t.jsxRuntimeExports.jsxs("div",{className:O.other,children:[t.jsxRuntimeExports.jsx("h5",{className:O.subtitle,children:o}),t.jsxRuntimeExports.jsx("div",{className:O.items,children:s.map(i=>t.jsxRuntimeExports.jsx(t.Switch,{current:i.isItem,onChange:l=>i.setIsItem(l),label:i.label,hasBackground:!0,paddingless:!1}))})]})},Gt=x=>{const{index:s,moveProduct:o,children:i}=x,[,l]=t.useDrop({accept:"product",hover(r){r.index!==s&&(o(r.index,s),r.index=s)}}),[{isDragging:e},n]=t.useDrag({type:"product",item:{index:s},collect:r=>({isDragging:r.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:r=>n(l(r)),className:`${j.product} ${e?j.dragging:""}`,children:i})},F=x=>{const{isActiveItems:s,setIsActiveItems:o,items:i,setItems:l,other:e,title:n,subtitle:r,editable:_=!0,draggable:f=!1,withImage:a=!1,deletable:p=!0,addable:u=!0,itemsType:R,itemsPlaceholder:g="",itemsOptions:d,hasRangeSelector:S=!1,rangeSelectorOptions:D,modalOptions:z,addableOptions:P={}}=x,[$,I]=b.useState(null),[Y,U]=b.useState({top:0,left:0}),J=(c,E)=>{const k=[...i],[h]=k.splice(c,1);k.splice(E,0,h),l(k)};b.useEffect(()=>{const c=()=>{I(null)};return document.body.addEventListener("click",c),I(null),()=>{I(null),document.body.removeEventListener("click",c)}},[]),b.useEffect(()=>{if($){const c=[...i].map(E=>E.id===$.id?$:E);l(c)}},[$]);const K=(c,E)=>{c.stopPropagation();const k=c.target.getBoundingClientRect(),h=100,N=window.innerHeight;let y=k.top+window.scrollY;y+h>N&&(y=N-h-20),U({top:y-80,left:k.left-30}),I(E)};function Q(c){if(a)return c?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${c}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"image",width:16,height:16,fill:"#757575"})}const H=(c,E)=>{const k=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"drag",hoverable:!0,width:20,height:20})}),R==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:h=>{const y=[...i].map(w=>w.id===c.id?{...c,name:h}:w);I({...c,name:h}),l([...y])},value:c.name,options:d,leftAddon:Q(c.image)}),R==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:h=>{const y=[...i].map(w=>w.id===c.id?{...c,name:h}:w);l([...y])},value:c.name,placeholder:g}),R==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:h=>{const y=[...i].map(w=>w.id===c.id?{...c,image:h[0]}:w);l([...y])}}),t.jsxRuntimeExports.jsxs("div",{className:j.buttons,children:[_&&t.jsxRuntimeExports.jsx(t.Icon,{name:"sliders",hoverable:!0,width:20,height:20,onClick:h=>K(h,c)}),p&&t.jsxRuntimeExports.jsx(t.Icon,{name:"trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>l(i.filter(h=>h.id!==c.id))})]})]});return f?t.jsxRuntimeExports.jsx(Gt,{product:c,index:E,moveProduct:J,children:k},c.id):t.jsxRuntimeExports.jsx("div",{className:j.product,children:k},c.id)};return t.jsxRuntimeExports.jsxs("div",{className:j.productsBlock,children:[(n||s!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:j.top,children:[n&&t.jsxRuntimeExports.jsx("h3",{className:j.title,children:n}),s!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:s,onChange:c=>o==null?void 0:o(c)})]}),$&&_&&z&&t.jsxRuntimeExports.jsx(Dt,{activeItem:$,setActiveItem:I,popupPosition:Y,modalOptions:z}),S&&D&&t.jsxRuntimeExports.jsx(q,{...D}),t.jsxRuntimeExports.jsxs("div",{className:j.products,children:[r&&t.jsxRuntimeExports.jsx("h5",{className:j.subtitle,children:r}),f?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:i.map((c,E)=>H(c,E))}):i.map((c,E)=>H(c,E)),u&&t.jsxRuntimeExports.jsxs(t.Button,{className:j.button,size:"s",onClick:()=>{const c=[...i];R==="select"?c.push({name:d[0]||`Product ${i.length+1}`,id:t.v4(),...P}):R==="input"?c.push({name:"",id:t.v4(),...P}):c.push({name:`Image ${i.length+1}`,id:t.v4(),...P}),l(c)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"plus",width:16,height:16})]})]}),e!==void 0&&t.jsxRuntimeExports.jsx(Ft,{items:e})]})},qt="_subtitle_41klp_1",Yt="_header_41klp_8",Ut="_text_41klp_9",Jt="_productsBlock_41klp_10",Kt="_buttonsBlock_41klp_11",Qt="_top_41klp_21",Vt="_itemsBlock_41klp_28",Wt="_typeTexts_41klp_34",Xt="_block_41klp_40",Zt="_active_41klp_51",te="_products_41klp_10",ee="_product_41klp_10",se="_button_41klp_11",ne="_image_41klp_79",oe="_info_41klp_86",ie="_name_41klp_97",ce="_buttons_41klp_11",le="_modal_41klp_107",re="_other_41klp_124",ae="_options_41klp_130",B={subtitle:qt,header:Yt,text:Ut,productsBlock:Jt,buttonsBlock:Kt,top:Qt,itemsBlock:Vt,typeTexts:Wt,block:Xt,active:Zt,products:te,product:ee,button:se,image:ne,info:oe,name:ie,buttons:ce,modal:le,other:re,options:ae},xe=x=>{const{activeButton:s,setActiveButton:o,popupPosition:i}=x,[l,e]=b.useState(s.typesText),[n,r]=b.useState(s.destination),[_,f]=b.useState(s.link||""),[a,p]=b.useState(s.text||"");return b.useEffect(()=>{o({...s,...{text:a,link:_,destination:n,typesText:l}})},[l,n,_,a]),t.jsxRuntimeExports.jsxs("div",{className:B.modal,onClick:u=>{u.stopPropagation()},style:{top:`${i.top}px`,left:`${i.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:B.top,children:[t.jsxRuntimeExports.jsx("h3",{children:s.type}),t.jsxRuntimeExports.jsx(t.Icon,{name:"x",height:20,width:20,hoverable:!0,onClick:()=>o(null)})]}),t.jsxRuntimeExports.jsxs("div",{className:B.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:u=>r(u),options:["Go to Page","Open Link"],value:n}),n==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:()=>{},options:[],value:"Homepage"}):t.jsxRuntimeExports.jsx(t.Input,{onChange:u=>f(u),value:_,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:!1,label:"Open in new tab"}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:u=>p(u),value:a,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(L,{typesText:l,setTypesText:e})]})]})},ue="_subtitle_1y5sw_1",de="_header_1y5sw_8",pe="_text_1y5sw_9",me="_productsBlock_1y5sw_10",_e="_buttonsBlock_1y5sw_11",he="_top_1y5sw_22",ge="_itemsBlock_1y5sw_29",je="_typeTexts_1y5sw_35",be="_block_1y5sw_41",fe="_active_1y5sw_52",Re="_products_1y5sw_10",Ee="_product_1y5sw_10",ve="_button_1y5sw_11",ke="_image_1y5sw_80",ye="_info_1y5sw_87",we="_name_1y5sw_98",$e="_buttons_1y5sw_11",Ie="_modal_1y5sw_108",Be="_other_1y5sw_125",Ne="_options_1y5sw_131",T={subtitle:ue,header:de,text:pe,productsBlock:me,buttonsBlock:_e,top:he,itemsBlock:ge,typeTexts:je,block:be,active:fe,products:Re,product:Ee,button:ve,image:ke,info:ye,name:we,buttons:$e,modal:Ie,other:Be,options:Ne},G=x=>{const{buttons:s,setButtons:o,deletable:i=!0,addable:l=!0}=x,[e,n]=b.useState(null),[r,_]=b.useState({top:0,left:0});b.useEffect(()=>{const a=()=>{n(null)};return document.body.addEventListener("click",a),n(null),()=>{n(null),document.body.removeEventListener("click",a)}},[]),b.useEffect(()=>{if(e){const a=[...s].map(p=>p.id===e.id?e:p);o(a)}},[e]);const f=(a,p)=>{a.stopPropagation();const u=a.target.getBoundingClientRect(),R=490,g=window.innerHeight;let d=u.top+window.scrollY;d+R>g&&(d=g-R-20),_({top:d,left:u.left-30}),n(p)};return t.jsxRuntimeExports.jsxs("div",{className:T.products,children:[t.jsxRuntimeExports.jsx("h5",{className:T.subtitle,children:"Button Type"}),s.map(a=>t.jsxRuntimeExports.jsxs("div",{className:T.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:p=>{const R=[...s].map(g=>g.id===a.id?{...a,type:p}:g);o(R)},value:a.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:T.buttons,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"sliders",hoverable:!0,width:20,height:20,onClick:p=>{f(p,a)}}),i&&t.jsxRuntimeExports.jsx(t.Icon,{name:"trash",hoverable:!0,onClick:()=>{const p=s.filter(u=>u.id!==a.id);o(p)},width:20,height:20,fill:"#C12A2A"})]})]},a.id)),e&&t.jsxRuntimeExports.jsx(xe,{activeButton:e,setActiveButton:n,popupPosition:r}),l&&t.jsxRuntimeExports.jsxs(t.Button,{className:T.button,size:"s",onClick:()=>{const a=[...s];a.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:""}),o(a)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"plus",width:16,height:16})]})]})},Ce=x=>{const{isActiveButtons:s,setIsActiveButtons:o,buttons:i,setButtons:l}=x;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:B.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:B.top,children:[t.jsxRuntimeExports.jsx("h3",{className:B.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:s,onChange:e=>o(e)})]}),t.jsxRuntimeExports.jsx(G,{buttons:i,setButtons:l})]})})},Te="_wrapper_tn7gb_1",Se="_subtitle_tn7gb_7",Pe="_content_tn7gb_14",Ae="_range_tn7gb_21",Oe="_track_tn7gb_26",Le="_progress_tn7gb_35",De="_dots_tn7gb_45",ze="_dot_tn7gb_45",He="_active_tn7gb_62",Me="_input_tn7gb_74",Fe="_countBlock_tn7gb_88",Ge="_count_tn7gb_88",qe="_controls_tn7gb_103",Ye="_button_tn7gb_108",m={wrapper:Te,subtitle:Se,content:Pe,range:Ae,track:Oe,progress:Le,dots:De,dot:ze,active:He,input:Me,countBlock:Fe,count:Ge,controls:qe,button:Ye},q=x=>{const{label:s,min:o=1,max:i=4,step:l=1,count:e,setCount:n}=x,[r,_]=b.useState(!1),f=Array.from({length:(i-o)/l+1}),a=(e-o)/(i-o)*100,p=()=>{e<i&&n(e+l)},u=()=>{e>o&&n(e-l)},R=g=>{const d=o+g*l;n(d)};return t.jsxRuntimeExports.jsxs("div",{className:m.wrapper,children:[s&&t.jsxRuntimeExports.jsx("h5",{className:m.subtitle,children:s}),t.jsxRuntimeExports.jsxs("div",{className:m.content,children:[t.jsxRuntimeExports.jsxs("div",{className:m.range,children:[t.jsxRuntimeExports.jsx("div",{className:m.track}),t.jsxRuntimeExports.jsx("div",{className:m.progress,style:{width:`${a}%`}}),t.jsxRuntimeExports.jsx("div",{className:m.dots,children:f.map((g,d)=>{const S=d<=(e-o)/l;return t.jsxRuntimeExports.jsx("button",{onClick:()=>R(d),className:t.clx(m.dot,{[m.active]:S,[m.inactive]:!S,[m.dragging]:r}),"aria-label":`Set value to ${o+d*l}`},d)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:o,max:i,step:l,value:e,onChange:g=>n(Number(g.target.value)),onMouseDown:()=>_(!0),onMouseUp:()=>_(!1),onTouchStart:()=>_(!0),onTouchEnd:()=>_(!1),className:m.input})]}),t.jsxRuntimeExports.jsxs("div",{className:m.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:o,max:i,paddingless:!0,onChange:g=>{const d=Number(g);d>i?n(i):d<o?n(o):n(d)},value:String(e)}),t.jsxRuntimeExports.jsxs("div",{className:m.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:p,disabled:e>=i,className:m.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"arrow-down",width:15,height:15,rotated:!0})}),t.jsxRuntimeExports.jsx("button",{onClick:u,disabled:e<=o,className:m.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"arrow-down",width:15,height:15})})]})]})]})]})};exports.Button=t.Button;exports.Checkbox=t.Checkbox;exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.ColorPicker=t.ColorPicker;exports.Icon=t.Icon;exports.Input=t.Input;exports.Modal=t.Modal;exports.Picker=t.Picker;exports.Radio=t.Radio;exports.Select=t.Select;exports.Submodal=t.Submodal;exports.Switch=t.Switch;exports.Textarea=t.Textarea;exports.Tip=t.Tip;exports.ButtonTypeSettings=G;exports.ButtonsSettings=Ce;exports.ItemsSettings=F;exports.LayoutSettings=at;exports.RangeSelector=q;exports.TextSettings=M;exports.TypesText=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-C2h2e3d1.cjs"),h=require("react"),X="_wrapper_1g82c_2",Z="_alignmentBlock_1g82c_8",tt="_title_1g82c_15",et="_subtitle_1g82c_22",st="_alignmentContent_1g82c_29",nt="_alignments_1g82c_35",ot="_alignment_1g82c_8",it="_circle_1g82c_54",ct="_paddings_1g82c_61",lt="_padding_1g82c_61",rt="_input_1g82c_79",C={wrapper:X,alignmentBlock:Z,title:tt,subtitle:et,alignmentContent:st,alignments:nt,alignment:ot,circle:it,paddings:ct,padding:lt,input:rt},at=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],xt=["left","top","right","bottom"],ut=x=>{const{alignment:s,padding:i,setPadding:n,setAlignment:r}=x;function e(){switch(s){case"left":case"topLeft":case"bottomLeft":return"left";case"right":case"topRight":case"bottomRight":return"right";case"center":case"top":case"bottom":return"center";default:return"center"}}return t.jsxRuntimeExports.jsxs("div",{className:C.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:C.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:C.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:C.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:C.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:C.alignments,children:at.map(o=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{r(o)},className:C.alignment,children:[o!==s&&t.jsxRuntimeExports.jsx("div",{className:C.circle}),o===s&&t.jsxRuntimeExports.jsx(t.Icon,{name:`text-align-${e()}`,fill:"#FF3F19",width:22,height:22})]},o))}),t.jsxRuntimeExports.jsx("div",{className:C.paddings,children:xt.map(o=>t.jsxRuntimeExports.jsxs("label",{className:C.padding,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:`align-${o}`,width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"text",value:String(i[o]),onChange:l=>n({...i,[o]:Number(l)}),paddingless:!0,borderless:!0})]}))})]})]})]})},dt="_subtitle_2zbxx_1",pt="_header_2zbxx_8",mt="_text_2zbxx_9",_t="_top_2zbxx_16",ht="_itemsBlock_2zbxx_23",D={subtitle:dt,header:pt,text:mt,top:_t,itemsBlock:ht},gt="_typeTexts_3zlec_1",jt="_block_3zlec_7",bt="_active_3zlec_18",Y={typeTexts:gt,block:jt,active:bt},ft=["bold","italic","underline","strike-through","code"],U=x=>{const{typesText:s,setTypesText:i}=x;return t.jsxRuntimeExports.jsx("div",{className:Y.typeTexts,children:ft.map(n=>t.jsxRuntimeExports.jsx("div",{className:t.clx(Y.block,{[Y.active]:s.includes(n)}),onClick:()=>{const r=[...s];if(r.includes(n)){const e=r.filter(o=>o!==n);i(e)}else r.push(n),i(r)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:`text-${n}`,fill:s.includes(n)?"#252525":"#757575",width:20,height:20})},String(n)))})},J=x=>{const{typesText:s,isActiveText:i,setIsActiveText:n,text:r,setText:e,setTypesText:o,title:l,subtitle:b="Items"}=x;return t.jsxRuntimeExports.jsxs("div",{className:D.text,children:[(l||i!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:D.top,children:[l&&t.jsxRuntimeExports.jsx("h3",{className:D.title,children:l}),i!==void 0&&n&&t.jsxRuntimeExports.jsx(t.Switch,{current:i,onChange:f=>n(f)})]}),t.jsxRuntimeExports.jsxs("div",{className:D.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:D.subtitle,children:b}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:f=>e(f),value:r,maxLength:150}),t.jsxRuntimeExports.jsx(U,{typesText:s,setTypesText:o})]})]})},Et="_subtitle_1nl8x_1",Rt="_header_1nl8x_8",vt="_text_1nl8x_9",kt="_productsBlock_1nl8x_10",yt="_top_1nl8x_22",$t="_itemsBlock_1nl8x_29",wt="_typeTexts_1nl8x_35",It="_block_1nl8x_41",Bt="_active_1nl8x_52",Nt="_products_1nl8x_10",Ct="_product_1nl8x_10",Pt="_button_1nl8x_70",Tt="_image_1nl8x_80",St="_info_1nl8x_87",At="_name_1nl8x_98",Ot="_buttons_1nl8x_102",Dt="_modal_1nl8x_108",Lt="_link_1nl8x_126",Ht="_modalOptions_1nl8x_132",y={subtitle:Et,header:Rt,text:vt,productsBlock:kt,top:yt,itemsBlock:$t,typeTexts:wt,block:It,active:Bt,products:Nt,product:Ct,button:Pt,image:Tt,info:St,name:At,buttons:Ot,modal:Dt,link:Lt,modalOptions:Ht},Mt=x=>{const{activeItem:s,setActiveItem:i,popupPosition:n,modalOptions:r}=x;return t.jsxRuntimeExports.jsxs("div",{className:y.modal,onClick:e=>{e.stopPropagation()},style:{top:`${n.top}px`,left:`${n.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:y.top,children:[t.jsxRuntimeExports.jsx("h3",{children:s.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"x",height:20,width:20,hoverable:!0,onClick:()=>i(null)})]}),t.jsxRuntimeExports.jsx("div",{className:y.modalOptions,children:r.map(e=>{if(e.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:o=>{const l={...s,[e.field]:o};i(l)}});if(e.type==="text")return t.jsxRuntimeExports.jsx(J,{typesText:s[e.field.type],setTypesText:o=>{const l={...s,[e.field.type]:o};i(l)},text:s[e.field.text]||"",setText:o=>{const l={...s,[e.field.text]:o};i(l)},subtitle:e.label});if(e.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:o=>{const l={...s,[e.field]:o};i(l)},value:s[e.field]||"",label:e.label,placeholder:e.placeholder});if(e.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:y.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:o=>{const l={...s,[e.field.text]:o};i(l)},value:s[e.field.text]||"",label:e.inputLabel,placeholder:e.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!s[e.field.switch]||!1,label:e.switchLabel,onChange:o=>{const l={...s,[e.field.switch]:o};i(l)}})]});if(e.type==="list")return t.jsxRuntimeExports.jsx(Q,{items:s[e.field]||[],setItems:o=>{const l={...s,[e.field]:o};i(l)},itemsType:"select",draggable:e.draggable||!1,itemsOptions:e.itemsOptions,deletable:e.deletable||!1,editable:!1,subtitle:e.label});if(e.type==="select")return t.jsxRuntimeExports.jsx(t.Select,{options:e.itemsOptions,onChange:o=>{const l={...s,[e.field]:o};i(l)},label:e.label,value:s[e.field]||"String"})})})]})},zt="_other_1wtgi_1",Ft="_subtitle_1wtgi_7",Gt="_items_1wtgi_14",q={other:zt,subtitle:Ft,items:Gt},K=x=>{const{items:s,title:i="Other"}=x;return t.jsxRuntimeExports.jsxs("div",{className:q.other,children:[t.jsxRuntimeExports.jsx("h5",{className:q.subtitle,children:i}),t.jsxRuntimeExports.jsx("div",{className:q.items,children:s.map(n=>t.jsxRuntimeExports.jsx(t.Switch,{current:n.isItem,onChange:r=>n.setIsItem(r),label:n.label,hasBackground:!0,paddingless:!1}))})]})},Yt=x=>{const{index:s,moveProduct:i,children:n}=x,[,r]=t.useDrop({accept:"product",hover(l){l.index!==s&&(i(l.index,s),l.index=s)}}),[{isDragging:e},o]=t.useDrag({type:"product",item:{index:s},collect:l=>({isDragging:l.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:l=>o(r(l)),className:`${y.product} ${e?y.dragging:""}`,children:n})},Q=x=>{const{isActiveItems:s,setIsActiveItems:i,items:n,setItems:r,other:e,title:o,subtitle:l,editable:b=!0,draggable:f=!1,withImage:u=!1,deletable:g=!0,addable:m=!0,itemsType:k,itemsPlaceholder:p="",itemsOptions:d,hasRangeSelector:B=!1,rangeSelectorOptions:H,modalOptions:M,addableOptions:O={}}=x,[P,T]=h.useState(null),[F,G]=h.useState({top:0,left:0}),z=(c,R)=>{const j=[...n],[_]=j.splice(c,1);j.splice(R,0,_),r(j)};h.useEffect(()=>{const c=()=>{T(null)};return document.body.addEventListener("click",c),T(null),()=>{T(null),document.body.removeEventListener("click",c)}},[]),h.useEffect(()=>{if(P){const c=[...n].map(R=>R.id===P.id?P:R);r(c)}},[P]);const a=(c,R)=>{c.stopPropagation();const j=c.target.getBoundingClientRect(),_=100,S=window.innerHeight;let N=j.top+window.scrollY;N+_>S&&(N=S-_-20),G({top:N-80,left:j.left-30}),T(R)};console.log(n);function E(c){if(u)return c?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${c[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"image",width:16,height:16,fill:"#757575"})}const I=(c,R)=>{const j=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"drag",hoverable:!0,width:20,height:20})}),k==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:_=>{const N=[...n].map($=>$.id===c.id?{...c,name:_}:$);T({...c,name:_}),r([...N])},value:c.name,options:d,leftAddon:E(c.images)}),k==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:_=>{const N=[...n].map($=>$.id===c.id?{...c,name:_}:$);r([...N])},value:c.name,placeholder:p}),k==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:_=>{const N=[...n].map($=>$.id===c.id?{...c,image:_[0]}:$);r([...N])}}),t.jsxRuntimeExports.jsxs("div",{className:y.buttons,children:[b&&t.jsxRuntimeExports.jsx(t.Icon,{name:"sliders",hoverable:!0,width:20,height:20,onClick:_=>a(_,c)}),g&&t.jsxRuntimeExports.jsx(t.Icon,{name:"trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>r(n.filter(_=>_.id!==c.id))})]})]});return f?t.jsxRuntimeExports.jsx(Yt,{product:c,index:R,moveProduct:z,children:j},c.id):t.jsxRuntimeExports.jsx("div",{className:y.product,children:j},c.id)};return t.jsxRuntimeExports.jsxs("div",{className:y.productsBlock,children:[(o||s!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:y.top,children:[o&&t.jsxRuntimeExports.jsx("h3",{className:y.title,children:o}),s!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:s,onChange:c=>i==null?void 0:i(c)})]}),P&&b&&M&&t.jsxRuntimeExports.jsx(Mt,{activeItem:P,setActiveItem:T,popupPosition:F,modalOptions:M}),B&&H&&t.jsxRuntimeExports.jsx(W,{...H}),t.jsxRuntimeExports.jsxs("div",{className:y.products,children:[l&&t.jsxRuntimeExports.jsx("h5",{className:y.subtitle,children:l}),f?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:n.map((c,R)=>I(c,R))}):n.map((c,R)=>I(c,R)),m&&t.jsxRuntimeExports.jsxs(t.Button,{className:y.button,size:"s",onClick:()=>{const c=[...n];k==="select"?c.push({name:d[0]||`Product ${n.length+1}`,id:t.v4(),...O}):k==="input"?c.push({name:"",id:t.v4(),...O}):c.push({name:`Image ${n.length+1}`,id:t.v4(),...O}),r(c)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"plus",width:16,height:16})]})]}),e!==void 0&&t.jsxRuntimeExports.jsx(K,{items:e})]})},qt="_subtitle_41klp_1",Ut="_header_41klp_8",Jt="_text_41klp_9",Kt="_productsBlock_41klp_10",Qt="_buttonsBlock_41klp_11",Vt="_top_41klp_21",Wt="_itemsBlock_41klp_28",Xt="_typeTexts_41klp_34",Zt="_block_41klp_40",te="_active_41klp_51",ee="_products_41klp_10",se="_product_41klp_10",ne="_button_41klp_11",oe="_image_41klp_79",ie="_info_41klp_86",ce="_name_41klp_97",le="_buttons_41klp_11",re="_modal_41klp_107",ae="_other_41klp_124",xe="_options_41klp_130",A={subtitle:qt,header:Ut,text:Jt,productsBlock:Kt,buttonsBlock:Qt,top:Vt,itemsBlock:Wt,typeTexts:Xt,block:Zt,active:te,products:ee,product:se,button:ne,image:oe,info:ie,name:ce,buttons:le,modal:re,other:ae,options:xe},ue=x=>{const{activeButton:s,setActiveButton:i,popupPosition:n}=x,[r,e]=h.useState(s.typesText),[o,l]=h.useState(s.destination),[b,f]=h.useState(s.link||""),[u,g]=h.useState(s.text||"");return h.useEffect(()=>{i({...s,...{text:u,link:b,destination:o,typesText:r}})},[r,o,b,u]),t.jsxRuntimeExports.jsxs("div",{className:A.modal,onClick:m=>{m.stopPropagation()},style:{top:`${n.top}px`,left:`${n.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:A.top,children:[t.jsxRuntimeExports.jsx("h3",{children:s.type}),t.jsxRuntimeExports.jsx(t.Icon,{name:"x",height:20,width:20,hoverable:!0,onClick:()=>i(null)})]}),t.jsxRuntimeExports.jsxs("div",{className:A.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:m=>l(m),options:["Go to Page","Open Link"],value:o}),o==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:()=>{},options:[],value:"Homepage"}):t.jsxRuntimeExports.jsx(t.Input,{onChange:m=>f(m),value:b,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:!1,label:"Open in new tab"}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:m=>g(m),value:u,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(U,{typesText:r,setTypesText:e})]})]})},de="_subtitle_1y5sw_1",pe="_header_1y5sw_8",me="_text_1y5sw_9",_e="_productsBlock_1y5sw_10",he="_buttonsBlock_1y5sw_11",ge="_top_1y5sw_22",je="_itemsBlock_1y5sw_29",be="_typeTexts_1y5sw_35",fe="_block_1y5sw_41",Ee="_active_1y5sw_52",Re="_products_1y5sw_10",ve="_product_1y5sw_10",ke="_button_1y5sw_11",ye="_image_1y5sw_80",$e="_info_1y5sw_87",we="_name_1y5sw_98",Ie="_buttons_1y5sw_11",Be="_modal_1y5sw_108",Ne="_other_1y5sw_125",Ce="_options_1y5sw_131",L={subtitle:de,header:pe,text:me,productsBlock:_e,buttonsBlock:he,top:ge,itemsBlock:je,typeTexts:be,block:fe,active:Ee,products:Re,product:ve,button:ke,image:ye,info:$e,name:we,buttons:Ie,modal:Be,other:Ne,options:Ce},V=x=>{const{buttons:s,setButtons:i,deletable:n=!0,addable:r=!0}=x,[e,o]=h.useState(null),[l,b]=h.useState({top:0,left:0});h.useEffect(()=>{const u=()=>{o(null)};return document.body.addEventListener("click",u),o(null),()=>{o(null),document.body.removeEventListener("click",u)}},[]),h.useEffect(()=>{if(e){const u=[...s].map(g=>g.id===e.id?e:g);i(u)}},[e]);const f=(u,g)=>{u.stopPropagation();const m=u.target.getBoundingClientRect(),k=490,p=window.innerHeight;let d=m.top+window.scrollY;d+k>p&&(d=p-k-20),b({top:d,left:m.left-30}),o(g)};return t.jsxRuntimeExports.jsxs("div",{className:L.products,children:[t.jsxRuntimeExports.jsx("h5",{className:L.subtitle,children:"Button Type"}),s.map(u=>t.jsxRuntimeExports.jsxs("div",{className:L.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:g=>{const k=[...s].map(p=>p.id===u.id?{...u,type:g}:p);i(k)},value:u.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:L.buttons,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"sliders",hoverable:!0,width:20,height:20,onClick:g=>{f(g,u)}}),n&&t.jsxRuntimeExports.jsx(t.Icon,{name:"trash",hoverable:!0,onClick:()=>{const g=s.filter(m=>m.id!==u.id);i(g)},width:20,height:20,fill:"#C12A2A"})]})]},u.id)),e&&t.jsxRuntimeExports.jsx(ue,{activeButton:e,setActiveButton:o,popupPosition:l}),r&&t.jsxRuntimeExports.jsxs(t.Button,{className:L.button,size:"s",onClick:()=>{const u=[...s];u.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:""}),i(u)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"plus",width:16,height:16})]})]})},Pe=x=>{const{isActiveButtons:s,setIsActiveButtons:i,buttons:n,setButtons:r}=x;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:A.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:A.top,children:[t.jsxRuntimeExports.jsx("h3",{className:A.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:s,onChange:e=>i(e)})]}),t.jsxRuntimeExports.jsx(V,{buttons:n,setButtons:r})]})})},Te="_wrapper_tn7gb_1",Se="_subtitle_tn7gb_7",Ae="_content_tn7gb_14",Oe="_range_tn7gb_21",De="_track_tn7gb_26",Le="_progress_tn7gb_35",He="_dots_tn7gb_45",Me="_dot_tn7gb_45",ze="_active_tn7gb_62",Fe="_input_tn7gb_74",Ge="_countBlock_tn7gb_88",Ye="_count_tn7gb_88",qe="_controls_tn7gb_103",Ue="_button_tn7gb_108",v={wrapper:Te,subtitle:Se,content:Ae,range:Oe,track:De,progress:Le,dots:He,dot:Me,active:ze,input:Fe,countBlock:Ge,count:Ye,controls:qe,button:Ue},W=x=>{const{label:s,min:i=1,max:n=4,step:r=1,count:e,setCount:o}=x,[l,b]=h.useState(!1),f=Array.from({length:(n-i)/r+1}),u=(e-i)/(n-i)*100,g=()=>{e<n&&o(e+r)},m=()=>{e>i&&o(e-r)},k=p=>{const d=i+p*r;o(d)};return t.jsxRuntimeExports.jsxs("div",{className:v.wrapper,children:[s&&t.jsxRuntimeExports.jsx("h5",{className:v.subtitle,children:s}),t.jsxRuntimeExports.jsxs("div",{className:v.content,children:[t.jsxRuntimeExports.jsxs("div",{className:v.range,children:[t.jsxRuntimeExports.jsx("div",{className:v.track}),t.jsxRuntimeExports.jsx("div",{className:v.progress,style:{width:`${u}%`}}),t.jsxRuntimeExports.jsx("div",{className:v.dots,children:f.map((p,d)=>{const B=d<=(e-i)/r;return t.jsxRuntimeExports.jsx("button",{onClick:()=>k(d),className:t.clx(v.dot,{[v.active]:B,[v.inactive]:!B,[v.dragging]:l}),"aria-label":`Set value to ${i+d*r}`},d)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:i,max:n,step:r,value:e,onChange:p=>o(Number(p.target.value)),onMouseDown:()=>b(!0),onMouseUp:()=>b(!1),onTouchStart:()=>b(!0),onTouchEnd:()=>b(!1),className:v.input})]}),t.jsxRuntimeExports.jsxs("div",{className:v.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:i,max:n,paddingless:!0,onChange:p=>{const d=Number(p);d>n?o(n):d<i?o(i):o(d)},value:String(e)}),t.jsxRuntimeExports.jsxs("div",{className:v.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:g,disabled:e>=n,className:v.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"arrow-down",width:15,height:15,rotated:!0})}),t.jsxRuntimeExports.jsx("button",{onClick:m,disabled:e<=i,className:v.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"arrow-down",width:15,height:15})})]})]})]})]})},Je="_subtitle_1nl8x_1",Ke="_header_1nl8x_8",Qe="_text_1nl8x_9",Ve="_productsBlock_1nl8x_10",We="_top_1nl8x_22",Xe="_itemsBlock_1nl8x_29",Ze="_typeTexts_1nl8x_35",ts="_block_1nl8x_41",es="_active_1nl8x_52",ss="_products_1nl8x_10",ns="_product_1nl8x_10",os="_button_1nl8x_70",is="_image_1nl8x_80",cs="_info_1nl8x_87",ls="_name_1nl8x_98",rs="_buttons_1nl8x_102",as="_modal_1nl8x_108",xs="_link_1nl8x_126",us="_modalOptions_1nl8x_132",w={subtitle:Je,header:Ke,text:Qe,productsBlock:Ve,top:We,itemsBlock:Xe,typeTexts:Ze,block:ts,active:es,products:ss,product:ns,button:os,image:is,info:cs,name:ls,buttons:rs,modal:as,link:xs,modalOptions:us},ds=x=>{const{activeItem:s,setActiveItem:i,popupPosition:n,setIsOpenModal:r}=x;return t.jsxRuntimeExports.jsxs("div",{className:w.modal,onClick:e=>{e.stopPropagation()},style:{top:`${n.top}px`,left:`${n.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:w.top,children:[t.jsxRuntimeExports.jsx("h3",{children:s.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"x",height:20,width:20,hoverable:!0,onClick:()=>{r(!1),i(null)}})]}),t.jsxRuntimeExports.jsx("div",{className:w.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:e=>{const o={...s,images:e,imagePath:e[0]};i(o)}})})]})},ps=x=>{const{index:s,moveProduct:i,children:n}=x,[,r]=t.useDrop({accept:"product",hover(l){l.index!==s&&(i(l.index,s),l.index=s)}}),[{isDragging:e},o]=t.useDrag({type:"product",item:{index:s},collect:l=>({isDragging:l.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:l=>o(r(l)),className:`${w.product} ${e?w.dragging:""}`,children:n})},ms=x=>{const{isActiveItems:s,setIsActiveItems:i,items:n,setItems:r,other:e,title:o,subtitle:l,editable:b=!0,draggable:f=!1,withImage:u=!1,deletable:g=!0,addable:m=!0,itemsType:k,itemsOptions:p}=x,[d,B]=h.useState(null),[H,M]=h.useState({top:0,left:0}),[O,P]=h.useState(!1),T=(a,E)=>{const I=[...n],[c]=I.splice(a,1);I.splice(E,0,c),r(I)};h.useEffect(()=>{const a=()=>{B(null)};return document.body.addEventListener("click",a),B(null),()=>{B(null),document.body.removeEventListener("click",a)}},[]),h.useEffect(()=>{if(d){const a=[...n].map(E=>E.id===d.id?d:E);r(a)}},[d]);const F=(a,E)=>{a.stopPropagation();const I=a.target.getBoundingClientRect(),c=100,R=window.innerHeight;let j=I.top+window.scrollY;j+c>R&&(j=R-c-20),P(!0),M({top:j-80,left:I.left-30}),B(E)};function G(a){if(u)return a?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${a}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"image",width:16,height:16,fill:"#757575"})}const z=(a,E)=>{const I=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[f&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"drag",hoverable:!0,width:20,height:20})}),k==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:c=>{const R=[...n],j=Number(c.split(" ")[1]),_=p.find($=>$.id===j);if(!_)return;const S={..._.productData.stats,newPrice:_.productData.minPrice.amount,oldPrice:_.productData.compareAtPrice.amount},N=R.map($=>(console.log(c,j),$.id===a.id?{...a,name:c,listingId:j,stats:S}:$));B({...a,name:c,listingId:j}),r([...N])},value:a.name,options:[...p.map(c=>`Product ${c.id}`)],leftAddon:G(a.images[0])}),t.jsxRuntimeExports.jsxs("div",{className:w.buttons,children:[b&&t.jsxRuntimeExports.jsx(t.Icon,{name:"sliders",hoverable:!0,width:20,height:20,onClick:c=>F(c,a)}),g&&t.jsxRuntimeExports.jsx(t.Icon,{name:"trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>r(n.filter(c=>c.id!==a.id))})]})]});return f?t.jsxRuntimeExports.jsx(ps,{product:a,index:E,moveProduct:T,children:I},a.id):t.jsxRuntimeExports.jsx("div",{className:w.product,children:I},a.id)};return t.jsxRuntimeExports.jsxs("div",{className:w.productsBlock,children:[(o||s!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:w.top,children:[o&&t.jsxRuntimeExports.jsx("h3",{className:w.title,children:o}),s!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:s,onChange:a=>i==null?void 0:i(a)})]}),O&&d&&t.jsxRuntimeExports.jsx(ds,{activeItem:d,setActiveItem:B,setIsOpenModal:P,popupPosition:H}),t.jsxRuntimeExports.jsxs("div",{className:w.products,children:[l&&t.jsxRuntimeExports.jsx("h5",{className:w.subtitle,children:l}),f?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:n.map((a,E)=>z(a,E))}):n.map((a,E)=>z(a,E)),m&&t.jsxRuntimeExports.jsxs(t.Button,{className:w.button,size:"s",onClick:()=>{const a=[...n],E=p[0].id;a.push({name:`Product ${E}`,id:t.v4(),listingId:E,imagePath:"",images:[],stats:{...p[0].productData.stats,newPrice:p[0].productData.minPrice.amount,oldPrice:p[0].productData.compareAtPrice.amount}}),r(a)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"plus",width:16,height:16})]})]}),e!==void 0&&t.jsxRuntimeExports.jsx(K,{items:e})]})};exports.Button=t.Button;exports.Checkbox=t.Checkbox;exports.ChooseImage=t.ChooseImage;exports.ChooseImageModal=t.ChooseImageModal;exports.ColorPicker=t.ColorPicker;exports.Icon=t.Icon;exports.Input=t.Input;exports.Modal=t.Modal;exports.Picker=t.Picker;exports.Radio=t.Radio;exports.Select=t.Select;exports.Submodal=t.Submodal;exports.Switch=t.Switch;exports.Textarea=t.Textarea;exports.Tip=t.Tip;exports.ButtonTypeSettings=V;exports.ButtonsSettings=Pe;exports.ItemsSettings=Q;exports.LayoutSettings=ut;exports.ListingSelector=ms;exports.RangeSelector=W;exports.TextSettings=J;exports.TypesText=U;