@billgangcom/theme-lib 1.17.0 → 1.17.1
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.
|
@@ -63,7 +63,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
63
63
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const s=new this(t);return r.forEach(n=>s.set(n)),s}static accessor(t){const s=(this[w1]=this[w1]={accessors:{}}).accessors,n=this.prototype;function o(a){const l=_o(a);s[l]||(O6(n,a),s[l]=!0)}return H.isArray(t)?t.forEach(o):o(t),this}}Yt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);H.reduceDescriptors(Yt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[r]=s}}});H.freezeMethods(Yt);function Fl(e,t){const r=this||xi,s=t||r,n=Yt.from(s.headers);let o=s.data;return H.forEach(e,function(l){o=l.call(r,o,n.normalize(),t?t.status:void 0)}),n.normalize(),o}function sm(e){return!!(e&&e.__CANCEL__)}function Qn(e,t,r){De.call(this,e??"canceled",De.ERR_CANCELED,t,r),this.name="CanceledError"}H.inherits(Qn,De,{__CANCEL__:!0});function nm(e,t,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?e(r):t(new De("Request failed with status code "+r.status,[De.ERR_BAD_REQUEST,De.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function R6(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function k6(e,t){e=e||10;const r=new Array(e),s=new Array(e);let n=0,o=0,a;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),f=s[o];a||(a=u),r[n]=c,s[n]=u;let h=o,d=0;for(;h!==n;)d+=r[h++],h=h%e;if(n=(n+1)%e,n===o&&(o=(o+1)%e),u-a<t)return;const v=f&&u-f;return v?Math.round(d*1e3/v):void 0}}function L6(e,t){let r=0,s=1e3/t,n,o;const a=(u,f=Date.now())=>{r=f,n=null,o&&(clearTimeout(o),o=null),e.apply(null,u)};return[(...u)=>{const f=Date.now(),h=f-r;h>=s?a(u,f):(n=u,o||(o=setTimeout(()=>{o=null,a(n)},s-h)))},()=>n&&a(n)]}const wa=(e,t,r=3)=>{let s=0;const n=k6(50,250);return L6(o=>{const a=o.loaded,l=o.lengthComputable?o.total:void 0,c=a-s,u=n(c),f=a<=l;s=a;const h={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&f?(l-a)/u:void 0,event:o,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(h)},r)},P1=(e,t)=>{const r=e!=null;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},S1=e=>(...t)=>H.asap(()=>e(...t)),A6=Zt.hasStandardBrowserEnv?function(){const t=Zt.navigator&&/(msie|trident)/i.test(Zt.navigator.userAgent),r=document.createElement("a");let s;function n(o){let a=o;return t&&(r.setAttribute("href",a),a=r.href),r.setAttribute("href",a),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return s=n(window.location.href),function(a){const l=H.isString(a)?n(a):a;return l.protocol===s.protocol&&l.host===s.host}}():function(){return function(){return!0}}(),I6=Zt.hasStandardBrowserEnv?{write(e,t,r,s,n,o){const a=[e+"="+encodeURIComponent(t)];H.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),H.isString(s)&&a.push("path="+s),H.isString(n)&&a.push("domain="+n),o===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function M6(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function F6(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function om(e,t){return e&&!M6(t)?F6(e,t):t}const E1=e=>e instanceof Yt?{...e}:e;function nn(e,t){t=t||{};const r={};function s(u,f,h){return H.isPlainObject(u)&&H.isPlainObject(f)?H.merge.call({caseless:h},u,f):H.isPlainObject(f)?H.merge({},f):H.isArray(f)?f.slice():f}function n(u,f,h){if(H.isUndefined(f)){if(!H.isUndefined(u))return s(void 0,u,h)}else return s(u,f,h)}function o(u,f){if(!H.isUndefined(f))return s(void 0,f)}function a(u,f){if(H.isUndefined(f)){if(!H.isUndefined(u))return s(void 0,u)}else return s(void 0,f)}function l(u,f,h){if(h in t)return s(u,f);if(h in e)return s(void 0,u)}const c={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(u,f)=>n(E1(u),E1(f),!0)};return H.forEach(Object.keys(Object.assign({},e,t)),function(f){const h=c[f]||n,d=h(e[f],t[f],f);H.isUndefined(d)&&h!==l||(r[f]=d)}),r}const im=e=>{const t=nn({},e);let{data:r,withXSRFToken:s,xsrfHeaderName:n,xsrfCookieName:o,headers:a,auth:l}=t;t.headers=a=Yt.from(a),t.url=em(om(t.baseURL,t.url),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(H.isFormData(r)){if(Zt.hasStandardBrowserEnv||Zt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((c=a.getContentType())!==!1){const[u,...f]=c?c.split(";").map(h=>h.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...f].join("; "))}}if(Zt.hasStandardBrowserEnv&&(s&&H.isFunction(s)&&(s=s(t)),s||s!==!1&&A6(t.url))){const u=n&&o&&I6.read(o);u&&a.set(n,u)}return t},B6=typeof XMLHttpRequest<"u",H6=B6&&function(e){return new Promise(function(r,s){const n=im(e);let o=n.data;const a=Yt.from(n.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=n,f,h,d,v,m;function p(){v&&v(),m&&m(),n.cancelToken&&n.cancelToken.unsubscribe(f),n.signal&&n.signal.removeEventListener("abort",f)}let g=new XMLHttpRequest;g.open(n.method.toUpperCase(),n.url,!0),g.timeout=n.timeout;function x(){if(!g)return;const E=Yt.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),w={data:!l||l==="text"||l==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:E,config:e,request:g};nm(function(_){r(_),p()},function(_){s(_),p()},w),g=null}"onloadend"in g?g.onloadend=x:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(x)},g.onabort=function(){g&&(s(new De("Request aborted",De.ECONNABORTED,e,g)),g=null)},g.onerror=function(){s(new De("Network Error",De.ERR_NETWORK,e,g)),g=null},g.ontimeout=function(){let S=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const w=n.transitional||tm;n.timeoutErrorMessage&&(S=n.timeoutErrorMessage),s(new De(S,w.clarifyTimeoutError?De.ETIMEDOUT:De.ECONNABORTED,e,g)),g=null},o===void 0&&a.setContentType(null),"setRequestHeader"in g&&H.forEach(a.toJSON(),function(S,w){g.setRequestHeader(w,S)}),H.isUndefined(n.withCredentials)||(g.withCredentials=!!n.withCredentials),l&&l!=="json"&&(g.responseType=n.responseType),u&&([d,m]=wa(u,!0),g.addEventListener("progress",d)),c&&g.upload&&([h,v]=wa(c),g.upload.addEventListener("progress",h),g.upload.addEventListener("loadend",v)),(n.cancelToken||n.signal)&&(f=E=>{g&&(s(!E||E.type?new Qn(null,e,g):E),g.abort(),g=null)},n.cancelToken&&n.cancelToken.subscribe(f),n.signal&&(n.signal.aborted?f():n.signal.addEventListener("abort",f)));const b=R6(n.url);if(b&&Zt.protocols.indexOf(b)===-1){s(new De("Unsupported protocol "+b+":",De.ERR_BAD_REQUEST,e));return}g.send(o||null)})},V6=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let s=new AbortController,n;const o=function(u){if(!n){n=!0,l();const f=u instanceof Error?u:this.reason;s.abort(f instanceof De?f:new Qn(f instanceof Error?f.message:f))}};let a=t&&setTimeout(()=>{a=null,o(new De(`timeout ${t} of ms exceeded`,De.ETIMEDOUT))},t);const l=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:c}=s;return c.unsubscribe=()=>H.asap(l),c}},$6=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let s=0,n;for(;s<r;)n=s+t,yield e.slice(s,n),s=n},U6=async function*(e,t){for await(const r of W6(e))yield*$6(r,t)},W6=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:s}=await t.read();if(r)break;yield s}}finally{await t.cancel()}},_1=(e,t,r,s)=>{const n=U6(e,t);let o=0,a,l=c=>{a||(a=!0,s&&s(c))};return new ReadableStream({async pull(c){try{const{done:u,value:f}=await n.next();if(u){l(),c.close();return}let h=f.byteLength;if(r){let d=o+=h;r(d)}c.enqueue(new Uint8Array(f))}catch(u){throw l(u),u}},cancel(c){return l(c),n.return()}},{highWaterMark:2})},nl=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",am=nl&&typeof ReadableStream=="function",z6=nl&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),lm=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Z6=am&&lm(()=>{let e=!1;const t=new Request(Zt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),j1=64*1024,Tc=am&&lm(()=>H.isReadableStream(new Response("").body)),Pa={stream:Tc&&(e=>e.body)};nl&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Pa[t]&&(Pa[t]=H.isFunction(e[t])?r=>r[t]():(r,s)=>{throw new De(`Response type '${t}' is not supported`,De.ERR_NOT_SUPPORT,s)})})})(new Response);const Y6=async e=>{if(e==null)return 0;if(H.isBlob(e))return e.size;if(H.isSpecCompliantForm(e))return(await new Request(Zt.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(H.isArrayBufferView(e)||H.isArrayBuffer(e))return e.byteLength;if(H.isURLSearchParams(e)&&(e=e+""),H.isString(e))return(await z6(e)).byteLength},G6=async(e,t)=>{const r=H.toFiniteNumber(e.getContentLength());return r??Y6(t)},K6=nl&&(async e=>{let{url:t,method:r,data:s,signal:n,cancelToken:o,timeout:a,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:f,withCredentials:h="same-origin",fetchOptions:d}=im(e);u=u?(u+"").toLowerCase():"text";let v=V6([n,o&&o.toAbortSignal()],a),m;const p=v&&v.unsubscribe&&(()=>{v.unsubscribe()});let g;try{if(c&&Z6&&r!=="get"&&r!=="head"&&(g=await G6(f,s))!==0){let w=new Request(t,{method:"POST",body:s,duplex:"half"}),R;if(H.isFormData(s)&&(R=w.headers.get("content-type"))&&f.setContentType(R),w.body){const[_,P]=P1(g,wa(S1(c)));s=_1(w.body,j1,_,P)}}H.isString(h)||(h=h?"include":"omit");const x="credentials"in Request.prototype;m=new Request(t,{...d,signal:v,method:r.toUpperCase(),headers:f.normalize().toJSON(),body:s,duplex:"half",credentials:x?h:void 0});let b=await fetch(m);const E=Tc&&(u==="stream"||u==="response");if(Tc&&(l||E&&p)){const w={};["status","statusText","headers"].forEach(D=>{w[D]=b[D]});const R=H.toFiniteNumber(b.headers.get("content-length")),[_,P]=l&&P1(R,wa(S1(l),!0))||[];b=new Response(_1(b.body,j1,_,()=>{P&&P(),p&&p()}),w)}u=u||"text";let S=await Pa[H.findKey(Pa,u)||"text"](b,e);return!E&&p&&p(),await new Promise((w,R)=>{nm(w,R,{data:S,headers:Yt.from(b.headers),status:b.status,statusText:b.statusText,config:e,request:m})})}catch(x){throw p&&p(),x&&x.name==="TypeError"&&/fetch/i.test(x.message)?Object.assign(new De("Network Error",De.ERR_NETWORK,e,m),{cause:x.cause||x}):De.from(x,x&&x.code,e,m)}}),Nc={http:d6,xhr:H6,fetch:K6};H.forEach(Nc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const T1=e=>`- ${e}`,X6=e=>H.isFunction(e)||e===null||e===!1,cm={getAdapter:e=>{e=H.isArray(e)?e:[e];const{length:t}=e;let r,s;const n={};for(let o=0;o<t;o++){r=e[o];let a;if(s=r,!X6(r)&&(s=Nc[(a=String(r)).toLowerCase()],s===void 0))throw new De(`Unknown adapter '${a}'`);if(s)break;n[a||"#"+o]=s}if(!s){const o=Object.entries(n).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=t?o.length>1?`since :
|
|
64
64
|
`+o.map(T1).join(`
|
|
65
65
|
`):" "+T1(o[0]):"as no adapter specified";throw new De("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s},adapters:Nc};function Bl(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Qn(null,e)}function N1(e){return Bl(e),e.headers=Yt.from(e.headers),e.data=Fl.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),cm.getAdapter(e.adapter||xi.adapter)(e).then(function(s){return Bl(e),s.data=Fl.call(e,e.transformResponse,s),s.headers=Yt.from(s.headers),s},function(s){return sm(s)||(Bl(e),s&&s.response&&(s.response.data=Fl.call(e,e.transformResponse,s.response),s.response.headers=Yt.from(s.response.headers))),Promise.reject(s)})}const um="1.7.7",qu={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{qu[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const q1={};qu.transitional=function(t,r,s){function n(o,a){return"[Axios v"+um+"] Transitional option '"+o+"'"+a+(s?". "+s:"")}return(o,a,l)=>{if(t===!1)throw new De(n(a," has been removed"+(r?" in "+r:"")),De.ERR_DEPRECATED);return r&&!q1[a]&&(q1[a]=!0,console.warn(n(a," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,a,l):!0}};function J6(e,t,r){if(typeof e!="object")throw new De("options must be an object",De.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let n=s.length;for(;n-- >0;){const o=s[n],a=t[o];if(a){const l=e[o],c=l===void 0||a(l,o,e);if(c!==!0)throw new De("option "+o+" must be "+c,De.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new De("Unknown option "+o,De.ERR_BAD_OPTION)}}const qc={assertOptions:J6,validators:qu},gs=qc.validators;class en{constructor(t){this.defaults=t,this.interceptors={request:new C1,response:new C1}}async request(t,r){try{return await this._request(t,r)}catch(s){if(s instanceof Error){let n;Error.captureStackTrace?Error.captureStackTrace(n={}):n=new Error;const o=n.stack?n.stack.replace(/^.+\n/,""):"";try{s.stack?o&&!String(s.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
|
66
|
-
`+o):s.stack=o}catch{}}throw s}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=nn(this.defaults,r);const{transitional:s,paramsSerializer:n,headers:o}=r;s!==void 0&&qc.assertOptions(s,{silentJSONParsing:gs.transitional(gs.boolean),forcedJSONParsing:gs.transitional(gs.boolean),clarifyTimeoutError:gs.transitional(gs.boolean)},!1),n!=null&&(H.isFunction(n)?r.paramsSerializer={serialize:n}:qc.assertOptions(n,{encode:gs.function,serialize:gs.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=o&&H.merge(o.common,o[r.method]);o&&H.forEach(["delete","get","head","post","put","patch","common"],m=>{delete o[m]}),r.headers=Yt.concat(a,o);const l=[];let c=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(r)===!1||(c=c&&p.synchronous,l.unshift(p.fulfilled,p.rejected))});const u=[];this.interceptors.response.forEach(function(p){u.push(p.fulfilled,p.rejected)});let f,h=0,d;if(!c){const m=[N1.bind(this),void 0];for(m.unshift.apply(m,l),m.push.apply(m,u),d=m.length,f=Promise.resolve(r);h<d;)f=f.then(m[h++],m[h++]);return f}d=l.length;let v=r;for(h=0;h<d;){const m=l[h++],p=l[h++];try{v=m(v)}catch(g){p.call(this,g);break}}try{f=N1.call(this,v)}catch(m){return Promise.reject(m)}for(h=0,d=u.length;h<d;)f=f.then(u[h++],u[h++]);return f}getUri(t){t=nn(this.defaults,t);const r=om(t.baseURL,t.url);return em(r,t.params,t.paramsSerializer)}}H.forEach(["delete","get","head","options"],function(t){en.prototype[t]=function(r,s){return this.request(nn(s||{},{method:t,url:r,data:(s||{}).data}))}});H.forEach(["post","put","patch"],function(t){function r(s){return function(o,a,l){return this.request(nn(l||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:o,data:a}))}}en.prototype[t]=r(),en.prototype[t+"Form"]=r(!0)});class Du{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const s=this;this.promise.then(n=>{if(!s._listeners)return;let o=s._listeners.length;for(;o-- >0;)s._listeners[o](n);s._listeners=null}),this.promise.then=n=>{let o;const a=new Promise(l=>{s.subscribe(l),o=l}).then(n);return a.cancel=function(){s.unsubscribe(o)},a},t(function(o,a,l){s.reason||(s.reason=new Qn(o,a,l),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=s=>{t.abort(s)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new Du(function(n){t=n}),cancel:t}}}function Q6(e){return function(r){return e.apply(null,r)}}function e4(e){return H.isObject(e)&&e.isAxiosError===!0}const Dc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Dc).forEach(([e,t])=>{Dc[t]=e});function dm(e){const t=new en(e),r=Vh(en.prototype.request,t);return H.extend(r,en.prototype,t,{allOwnKeys:!0}),H.extend(r,t,null,{allOwnKeys:!0}),r.create=function(n){return dm(nn(e,n))},r}const st=dm(xi);st.Axios=en;st.CanceledError=Qn;st.CancelToken=Du;st.isCancel=sm;st.VERSION=um;st.toFormData=sl;st.AxiosError=De;st.Cancel=st.CanceledError;st.all=function(t){return Promise.all(t)};st.spread=Q6;st.isAxiosError=e4;st.mergeConfig=nn;st.AxiosHeaders=Yt;st.formToJSON=e=>rm(H.isHTMLForm(e)?new FormData(e):e);st.getAdapter=cm.getAdapter;st.HttpStatusCode=Dc;st.default=st;const t4=async(e="get",t,r)=>{const s=localStorage.getItem("shopId")||void 0,n=localStorage.getItem("draftId"),o=`${vi}/v2/builder/shops/${s}/drafts/${n}/${t}`,a=localStorage.getItem("sellerAccessToken")||void 0;if(e.toUpperCase()==="GET")return(await st.get(o,{headers:{Authorization:`Bearer ${a}`}})).data;e.toUpperCase()==="POST"&&await st.post(o,{...r},{headers:{Authorization:`Bearer ${a}`}}),e.toUpperCase()==="PUT"&&await st.put(o,{...r},{headers:{Authorization:`Bearer ${a}`}})},r4=async()=>{const e=localStorage.getItem("shopId")||void 0,t=`${vi}/v1/dash/shops/${e}/images`,r=localStorage.getItem("sellerAccessToken")||void 0;return(await st.get(t,{headers:{Authorization:`Bearer ${r}`}})).data},s4=async e=>{const t=localStorage.getItem("shopId")||void 0,r=`${vi}/v1/dash/shops/${t}/images`,s=localStorage.getItem("sellerAccessToken")||void 0;return(await st.post(r,e,{headers:{Authorization:`Bearer ${s}`,"Content-Type":"multipart/form-data"}})).data},n4=async e=>{const t=localStorage.getItem("shopId")||void 0,r=localStorage.getItem("draftId"),s=`${vi}/v2/builder/shops/${t}/drafts/${r}/pages/${e}`,n=localStorage.getItem("sellerAccessToken")||void 0;return(await st.delete(s,{headers:{Authorization:`Bearer ${n}`,"Content-Type":"multipart/form-data"}})).data},o4=async e=>{const t=window.location.hostname.includes("localhost")?"flagship-theme.pages.dev":window.location.hostname,r=`${Hh}/shops/${t}/${e}`,s=localStorage.getItem("sellerAccessToken")||void 0;return(await st.get(r,{headers:{Authorization:`Bearer ${s}`,"Content-Type":"multipart/form-data"}})).data},i4=async()=>{const e=window.location.hostname.includes("localhost")?"flagship-theme.pages.dev":window.location.hostname,t=`${Hh}/v2/shops/${e}/settings-theme`,r=localStorage.getItem("sellerAccessToken")||void 0;return(await st.get(t,{headers:{Authorization:`Bearer ${r}`,"Content-Type":"multipart/form-data"}})).data},D1=e=>{let t;const r=new Set,s=(u,f)=>{const h=typeof u=="function"?u(t):u;if(!Object.is(h,t)){const d=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),r.forEach(v=>v(t,d))}},n=()=>t,l={setState:s,getState:n,getInitialState:()=>c,subscribe:u=>(r.add(u),()=>r.delete(u))},c=t=e(s,n,l);return l},a4=e=>e?D1(e):D1,l4=e=>e;function c4(e,t=l4){const r=y.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return y.useDebugValue(r),r}const O1=e=>{const t=a4(e),r=s=>c4(t,s);return Object.assign(r,t),r},cr=e=>e?O1(e):O1,u4=cr(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}))})),d4=cr(e=>({currentDevice:{icon:"Desktop",value:"desktop"},setCurrentDevice:t=>e(()=>({currentDevice:t}))}));cr(e=>({pageData:null,setPageData:t=>e(()=>({pageData:t}))}));const f4=cr(e=>({activeBlock:Bh[0],setActiveBlock:t=>e(()=>({activeBlock:t}))}));function h4(e,t){let r;try{r=e()}catch{return}return{getItem:n=>{var o;const a=c=>c===null?null:JSON.parse(c,void 0),l=(o=r.getItem(n))!=null?o:null;return l instanceof Promise?l.then(a):a(l)},setItem:(n,o)=>r.setItem(n,JSON.stringify(o,void 0)),removeItem:n=>r.removeItem(n)}}const Oc=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(s){return Oc(s)(r)},catch(s){return this}}}catch(r){return{then(s){return this},catch(s){return Oc(s)(r)}}}},m4=(e,t)=>(r,s,n)=>{let o={storage:h4(()=>localStorage),partialize:p=>p,version:0,merge:(p,g)=>({...g,...p}),...t},a=!1;const l=new Set,c=new Set;let u=o.storage;if(!u)return e((...p)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...p)},s,n);const f=()=>{const p=o.partialize({...s()});return u.setItem(o.name,{state:p,version:o.version})},h=n.setState;n.setState=(p,g)=>{h(p,g),f()};const d=e((...p)=>{r(...p),f()},s,n);n.getInitialState=()=>d;let v;const m=()=>{var p,g;if(!u)return;a=!1,l.forEach(b=>{var E;return b((E=s())!=null?E:d)});const x=((g=o.onRehydrateStorage)==null?void 0:g.call(o,(p=s())!=null?p:d))||void 0;return Oc(u.getItem.bind(u))(o.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==o.version){if(o.migrate)return[!0,o.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 E;const[S,w]=b;if(v=o.merge(w,(E=s())!=null?E:d),r(v,!0),S)return f()}).then(()=>{x==null||x(v,void 0),v=s(),a=!0,c.forEach(b=>b(v))}).catch(b=>{x==null||x(void 0,b)})};return n.persist={setOptions:p=>{o={...o,...p},p.storage&&(u=p.storage)},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>m(),hasHydrated:()=>a,onHydrate:p=>(l.add(p),()=>{l.delete(p)}),onFinishHydration:p=>(c.add(p),()=>{c.delete(p)})},o.skipHydration||m(),v||d},ol=m4,p4=cr(ol(e=>({onPreview:!1,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 Ot=[];for(var Hl=0;Hl<256;++Hl)Ot.push((Hl+256).toString(16).slice(1));function v4(e,t=0){return(Ot[e[t+0]]+Ot[e[t+1]]+Ot[e[t+2]]+Ot[e[t+3]]+"-"+Ot[e[t+4]]+Ot[e[t+5]]+"-"+Ot[e[t+6]]+Ot[e[t+7]]+"-"+Ot[e[t+8]]+Ot[e[t+9]]+"-"+Ot[e[t+10]]+Ot[e[t+11]]+Ot[e[t+12]]+Ot[e[t+13]]+Ot[e[t+14]]+Ot[e[t+15]]).toLowerCase()}var Hi,g4=new Uint8Array(16);function x4(){if(!Hi&&(Hi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Hi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Hi(g4)}var y4=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const R1={randomUUID:y4};function Sa(e,t,r){if(R1.randomUUID&&!t&&!e)return R1.randomUUID();e=e||{};var s=e.random||(e.rng||x4)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,v4(s)}const b4=cr(ol((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 s=t().blocks;s[r]={},e({blocks:s})},deletePage:r=>{const s=t().blocks;delete s[r],e({blocks:s})},updatePage:(r,s)=>{const n=t().blocks;if(n[s])return;const o=n[r];delete n[r],n[s]=o,e({blocks:n})},setCurrentBlock:r=>{e({currentBlock:r})},setPositionBlock:r=>{e({positionBlock:r})},addBlock:(r,s)=>{const n=t().blocks,o=n[r]||{},a=t().positionBlock,l=Sa();o[l]={name:s.name,value:s.value};const c=Object.keys(o);if(a===null||a>=c.length)e({blocks:{...n,[r]:o}});else{const u={name:s.name,value:{...s.value}},f=c.slice(0,a),h=c.slice(a),d={...f.reduce((v,m)=>(v[m]=o[m],v),{}),[l]:u,...h.reduce((v,m)=>(v[m]=o[m],v),{})};e({blocks:{...n,[r]:d}})}},editBlock:(r,s,n)=>{const o=t().blocks,a=o[r]||{};console.log(n),a[s]={name:n.name,value:{...n.value}},e({blocks:{...o,[r]:a}})},removeBlock:(r,s)=>{const n=t().blocks,o=n[r]||{};delete o[s],e({blocks:{...n,[r]:o}})},moveBlock:(r,s,n)=>e(o=>{const a={...o.blocks[r]},l=Object.keys(a),[c]=l.splice(s,1);l.splice(n,0,c);const u=l.reduce((f,h)=>(f[h]=a[h],f),{});return{blocks:{...o.blocks,[r]:u}}}),duplicateBlock:(r,s)=>{const{blocks:n}=t(),o=n[r],a=o[s],l=Sa(),c={name:a.name,value:{...a.value}},u=Object.keys(o),f=u.indexOf(s),h=u.slice(0,f+1),d=u.slice(f+1),v={...h.reduce((m,p)=>(m[p]=o[p],m),{}),[l]:c,...d.reduce((m,p)=>(m[p]=o[p],m),{})};e({blocks:{...n,[r]:v}})}}),{name:"layers-storage",partialize:e=>{const{blocks:t,header:r,footer:s}=e;return{blocks:t,header:r,footer:s}}})),fm=cr((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})}})),C4=cr(e=>({activeBlock:null,setActiveBlock:t=>e(()=>({activeBlock:t})),activeFont:null,setActiveFont:t=>e(()=>({activeFont:t})),setThemeSettings:t=>e(()=>({themeSettings:t})),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:(t,r,s)=>e(n=>{const o={...n.themeSettings.colors,[t]:{...n.themeSettings.colors[t],[r]:s}};return{themeSettings:{...n.themeSettings,colors:o}}}),updateFont:(t,r,s,n)=>e(o=>{const a={...o.themeSettings.fonts,[t]:{...o.themeSettings.fonts[t],[r]:{...o.themeSettings.fonts[t][r],[s]:n}}};return{themeSettings:{...o.themeSettings,fonts:a}}}),updateBorder:(t,r)=>e(s=>{const n={...s.themeSettings.borders,[t]:r};return{themeSettings:{...s.themeSettings,borders:n}}}),updateButton:(t,r)=>e(s=>{const n={...s.themeSettings.buttons,[t]:r};return{themeSettings:{...s.themeSettings,buttons:n}}}),updateInput:(t,r,s)=>e(n=>({themeSettings:{...n.themeSettings,inputs:{...n.themeSettings.inputs,[t]:{...n.themeSettings.inputs[t],[s]:r}}}}))})),w4=cr(ol(e=>({fonts:[],setFonts:t=>e(()=>({fonts:t}))}),{name:"fonts-storage"})),P4=cr(e=>({settings:null,setSettings:t=>e(()=>({settings:t}))})),hm=cr()(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,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}))})),S4=cr(ol((e,t)=>({pages:null,currentPage:"home",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 s=t().pages,n=Sa();if(s)s[n]=r,e({pages:s});else{const o=t().setPages;o({});const a=t().pages;a[n]=r,e({pages:a})}},updatePage:(r,s)=>{const n=t().pages;n&&(n[r]={...s},e({pages:n}))},deletePage:r=>{const s=t().pages;s&&(delete s[r],e({pages:s}))}}),{name:"pages-storage",partialize:e=>{const{pages:t,pageContext:r}=e;return{pages:t,pageContext:r}}})),Ou=cr(e=>({openModal:!1,setOpenModal:t=>e(()=>({openModal:t})),onChange:null,setOnChange:t=>e(()=>({onChange:t}))})),E4=(e,t,r)=>{const s=e[t];return s?typeof s=="function"?s():Promise.resolve(s):new Promise((n,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},_4="_icon_bsuj2_1",j4="_hoverable_bsuj2_5",T4="_rotated_bsuj2_9",k1={icon:_4,hoverable:j4,rotated:T4};var mm={exports:{}};/*!
|
|
66
|
+
`+o):s.stack=o}catch{}}throw s}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=nn(this.defaults,r);const{transitional:s,paramsSerializer:n,headers:o}=r;s!==void 0&&qc.assertOptions(s,{silentJSONParsing:gs.transitional(gs.boolean),forcedJSONParsing:gs.transitional(gs.boolean),clarifyTimeoutError:gs.transitional(gs.boolean)},!1),n!=null&&(H.isFunction(n)?r.paramsSerializer={serialize:n}:qc.assertOptions(n,{encode:gs.function,serialize:gs.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=o&&H.merge(o.common,o[r.method]);o&&H.forEach(["delete","get","head","post","put","patch","common"],m=>{delete o[m]}),r.headers=Yt.concat(a,o);const l=[];let c=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(r)===!1||(c=c&&p.synchronous,l.unshift(p.fulfilled,p.rejected))});const u=[];this.interceptors.response.forEach(function(p){u.push(p.fulfilled,p.rejected)});let f,h=0,d;if(!c){const m=[N1.bind(this),void 0];for(m.unshift.apply(m,l),m.push.apply(m,u),d=m.length,f=Promise.resolve(r);h<d;)f=f.then(m[h++],m[h++]);return f}d=l.length;let v=r;for(h=0;h<d;){const m=l[h++],p=l[h++];try{v=m(v)}catch(g){p.call(this,g);break}}try{f=N1.call(this,v)}catch(m){return Promise.reject(m)}for(h=0,d=u.length;h<d;)f=f.then(u[h++],u[h++]);return f}getUri(t){t=nn(this.defaults,t);const r=om(t.baseURL,t.url);return em(r,t.params,t.paramsSerializer)}}H.forEach(["delete","get","head","options"],function(t){en.prototype[t]=function(r,s){return this.request(nn(s||{},{method:t,url:r,data:(s||{}).data}))}});H.forEach(["post","put","patch"],function(t){function r(s){return function(o,a,l){return this.request(nn(l||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:o,data:a}))}}en.prototype[t]=r(),en.prototype[t+"Form"]=r(!0)});class Du{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const s=this;this.promise.then(n=>{if(!s._listeners)return;let o=s._listeners.length;for(;o-- >0;)s._listeners[o](n);s._listeners=null}),this.promise.then=n=>{let o;const a=new Promise(l=>{s.subscribe(l),o=l}).then(n);return a.cancel=function(){s.unsubscribe(o)},a},t(function(o,a,l){s.reason||(s.reason=new Qn(o,a,l),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=s=>{t.abort(s)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new Du(function(n){t=n}),cancel:t}}}function Q6(e){return function(r){return e.apply(null,r)}}function e4(e){return H.isObject(e)&&e.isAxiosError===!0}const Dc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Dc).forEach(([e,t])=>{Dc[t]=e});function dm(e){const t=new en(e),r=Vh(en.prototype.request,t);return H.extend(r,en.prototype,t,{allOwnKeys:!0}),H.extend(r,t,null,{allOwnKeys:!0}),r.create=function(n){return dm(nn(e,n))},r}const st=dm(xi);st.Axios=en;st.CanceledError=Qn;st.CancelToken=Du;st.isCancel=sm;st.VERSION=um;st.toFormData=sl;st.AxiosError=De;st.Cancel=st.CanceledError;st.all=function(t){return Promise.all(t)};st.spread=Q6;st.isAxiosError=e4;st.mergeConfig=nn;st.AxiosHeaders=Yt;st.formToJSON=e=>rm(H.isHTMLForm(e)?new FormData(e):e);st.getAdapter=cm.getAdapter;st.HttpStatusCode=Dc;st.default=st;const t4=async(e="get",t,r)=>{const s=localStorage.getItem("shopId")||void 0,n=localStorage.getItem("draftId"),o=`${vi}/v2/builder/shops/${s}/drafts/${n}/${t}`,a=localStorage.getItem("sellerAccessToken")||void 0;if(e.toUpperCase()==="GET")return(await st.get(o,{headers:{Authorization:`Bearer ${a}`}})).data;e.toUpperCase()==="POST"&&await st.post(o,{...r},{headers:{Authorization:`Bearer ${a}`}}),e.toUpperCase()==="PUT"&&await st.put(o,{...r},{headers:{Authorization:`Bearer ${a}`}})},r4=async()=>{const e=localStorage.getItem("shopId")||void 0,t=`${vi}/v1/dash/shops/${e}/images`,r=localStorage.getItem("sellerAccessToken")||void 0;return(await st.get(t,{headers:{Authorization:`Bearer ${r}`}})).data},s4=async e=>{const t=localStorage.getItem("shopId")||void 0,r=`${vi}/v1/dash/shops/${t}/images`,s=localStorage.getItem("sellerAccessToken")||void 0;return(await st.post(r,e,{headers:{Authorization:`Bearer ${s}`,"Content-Type":"multipart/form-data"}})).data},n4=async e=>{const t=localStorage.getItem("shopId")||void 0,r=localStorage.getItem("draftId"),s=`${vi}/v2/builder/shops/${t}/drafts/${r}/pages/${e}`,n=localStorage.getItem("sellerAccessToken")||void 0;return(await st.delete(s,{headers:{Authorization:`Bearer ${n}`,"Content-Type":"multipart/form-data"}})).data},o4=async e=>{const t=window.location.hostname.includes("localhost")?"flagship-theme.pages.dev":window.location.hostname,r=`${Hh}/shops/${t}/${e}`,s=localStorage.getItem("sellerAccessToken")||void 0;return(await st.get(r,{headers:{Authorization:`Bearer ${s}`,"Content-Type":"multipart/form-data"}})).data},i4=async()=>{const e=window.location.hostname.includes("localhost")?"flagship-theme.pages.dev":window.location.hostname,t=`${Hh}/v2/shops/${e}/settings-theme`,r=localStorage.getItem("sellerAccessToken")||void 0;return(await st.get(t,{headers:{Authorization:`Bearer ${r}`,"Content-Type":"multipart/form-data"}})).data},D1=e=>{let t;const r=new Set,s=(u,f)=>{const h=typeof u=="function"?u(t):u;if(!Object.is(h,t)){const d=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),r.forEach(v=>v(t,d))}},n=()=>t,l={setState:s,getState:n,getInitialState:()=>c,subscribe:u=>(r.add(u),()=>r.delete(u))},c=t=e(s,n,l);return l},a4=e=>e?D1(e):D1,l4=e=>e;function c4(e,t=l4){const r=y.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return y.useDebugValue(r),r}const O1=e=>{const t=a4(e),r=s=>c4(t,s);return Object.assign(r,t),r},cr=e=>e?O1(e):O1,u4=cr(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}))})),d4=cr(e=>({currentDevice:{icon:"Desktop",value:"desktop"},setCurrentDevice:t=>e(()=>({currentDevice:t}))}));cr(e=>({pageData:null,setPageData:t=>e(()=>({pageData:t}))}));const f4=cr(e=>({activeBlock:Bh[0],setActiveBlock:t=>e(()=>({activeBlock:t}))}));function h4(e,t){let r;try{r=e()}catch{return}return{getItem:n=>{var o;const a=c=>c===null?null:JSON.parse(c,void 0),l=(o=r.getItem(n))!=null?o:null;return l instanceof Promise?l.then(a):a(l)},setItem:(n,o)=>r.setItem(n,JSON.stringify(o,void 0)),removeItem:n=>r.removeItem(n)}}const Oc=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(s){return Oc(s)(r)},catch(s){return this}}}catch(r){return{then(s){return this},catch(s){return Oc(s)(r)}}}},m4=(e,t)=>(r,s,n)=>{let o={storage:h4(()=>localStorage),partialize:p=>p,version:0,merge:(p,g)=>({...g,...p}),...t},a=!1;const l=new Set,c=new Set;let u=o.storage;if(!u)return e((...p)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...p)},s,n);const f=()=>{const p=o.partialize({...s()});return u.setItem(o.name,{state:p,version:o.version})},h=n.setState;n.setState=(p,g)=>{h(p,g),f()};const d=e((...p)=>{r(...p),f()},s,n);n.getInitialState=()=>d;let v;const m=()=>{var p,g;if(!u)return;a=!1,l.forEach(b=>{var E;return b((E=s())!=null?E:d)});const x=((g=o.onRehydrateStorage)==null?void 0:g.call(o,(p=s())!=null?p:d))||void 0;return Oc(u.getItem.bind(u))(o.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==o.version){if(o.migrate)return[!0,o.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 E;const[S,w]=b;if(v=o.merge(w,(E=s())!=null?E:d),r(v,!0),S)return f()}).then(()=>{x==null||x(v,void 0),v=s(),a=!0,c.forEach(b=>b(v))}).catch(b=>{x==null||x(void 0,b)})};return n.persist={setOptions:p=>{o={...o,...p},p.storage&&(u=p.storage)},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>m(),hasHydrated:()=>a,onHydrate:p=>(l.add(p),()=>{l.delete(p)}),onFinishHydration:p=>(c.add(p),()=>{c.delete(p)})},o.skipHydration||m(),v||d},ol=m4,p4=cr(ol(e=>({onPreview:!1,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 Ot=[];for(var Hl=0;Hl<256;++Hl)Ot.push((Hl+256).toString(16).slice(1));function v4(e,t=0){return(Ot[e[t+0]]+Ot[e[t+1]]+Ot[e[t+2]]+Ot[e[t+3]]+"-"+Ot[e[t+4]]+Ot[e[t+5]]+"-"+Ot[e[t+6]]+Ot[e[t+7]]+"-"+Ot[e[t+8]]+Ot[e[t+9]]+"-"+Ot[e[t+10]]+Ot[e[t+11]]+Ot[e[t+12]]+Ot[e[t+13]]+Ot[e[t+14]]+Ot[e[t+15]]).toLowerCase()}var Hi,g4=new Uint8Array(16);function x4(){if(!Hi&&(Hi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Hi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Hi(g4)}var y4=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const R1={randomUUID:y4};function Sa(e,t,r){if(R1.randomUUID&&!t&&!e)return R1.randomUUID();e=e||{};var s=e.random||(e.rng||x4)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,v4(s)}const b4=cr(ol((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 s=t().blocks;s[r]={},e({blocks:s})},deletePage:r=>{const s=t().blocks;delete s[r],e({blocks:s})},updatePage:(r,s)=>{const n=t().blocks;if(n[s])return;const o=n[r];delete n[r],n[s]=o,e({blocks:n})},setCurrentBlock:r=>{e({currentBlock:r})},setPositionBlock:r=>{e({positionBlock:r})},addBlock:(r,s)=>{const n=t().blocks,o=n[r]||{},a=t().positionBlock,l=Sa();o[l]={name:s.name,value:s.value};const c=Object.keys(o);if(a===null||a>=c.length)e({blocks:{...n,[r]:o}});else{const u={name:s.name,value:{...s.value}},f=c.slice(0,a),h=c.slice(a),d={...f.reduce((v,m)=>(v[m]=o[m],v),{}),[l]:u,...h.reduce((v,m)=>(v[m]=o[m],v),{})};e({blocks:{...n,[r]:d}})}},editBlock:(r,s,n)=>{const o=t().blocks,a=o[r]||{};console.log(n),a[s]={name:n.name,value:{...n.value}},e({blocks:{...o,[r]:a}})},removeBlock:(r,s)=>{const n=t().blocks,o=n[r]||{};delete o[s],e({blocks:{...n,[r]:o}})},moveBlock:(r,s,n)=>e(o=>{const a={...o.blocks[r]},l=Object.keys(a),[c]=l.splice(s,1);l.splice(n,0,c);const u=l.reduce((f,h)=>(f[h]=a[h],f),{});return{blocks:{...o.blocks,[r]:u}}}),duplicateBlock:(r,s)=>{const{blocks:n}=t(),o=n[r],a=o[s],l=Sa(),c={name:a.name,value:{...a.value}},u=Object.keys(o),f=u.indexOf(s),h=u.slice(0,f+1),d=u.slice(f+1),v={...h.reduce((m,p)=>(m[p]=o[p],m),{}),[l]:c,...d.reduce((m,p)=>(m[p]=o[p],m),{})};e({blocks:{...n,[r]:v}})}}),{name:"layers-storage",partialize:e=>{const{blocks:t,header:r,footer:s}=e;return{blocks:t,header:r,footer:s}}})),fm=cr((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})}})),C4=cr(e=>({activeBlock:null,setActiveBlock:t=>e(()=>({activeBlock:t})),activeFont:null,setActiveFont:t=>e(()=>({activeFont:t})),setThemeSettings:t=>e(()=>({themeSettings:t})),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:(t,r,s)=>e(n=>{const o={...n.themeSettings.colors,[t]:{...n.themeSettings.colors[t],[r]:s}};return{themeSettings:{...n.themeSettings,colors:o}}}),updateFont:(t,r,s,n)=>e(o=>{const a={...o.themeSettings.fonts,[t]:{...o.themeSettings.fonts[t],[r]:{...o.themeSettings.fonts[t][r],[s]:n}}};return{themeSettings:{...o.themeSettings,fonts:a}}}),updateBorder:(t,r)=>e(s=>{const n={...s.themeSettings.borders,[t]:r};return{themeSettings:{...s.themeSettings,borders:n}}}),updateButton:(t,r)=>e(s=>{const n={...s.themeSettings.buttons,[t]:r};return{themeSettings:{...s.themeSettings,buttons:n}}}),updateInput:(t,r,s)=>e(n=>({themeSettings:{...n.themeSettings,inputs:{...n.themeSettings.inputs,[t]:{...n.themeSettings.inputs[t],[s]:r}}}}))})),w4=cr(ol(e=>({fonts:[],setFonts:t=>e(()=>({fonts:t}))}),{name:"fonts-storage"})),P4=cr(e=>({settings:null,setSettings:t=>e(()=>({settings:t}))})),hm=cr()(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,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}))})),S4=cr(ol((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 s=t().pages,n=Sa();if(s)s[n]=r,e({pages:s});else{const o=t().setPages;o({});const a=t().pages;a[n]=r,e({pages:a})}},updatePage:(r,s)=>{const n=t().pages;n&&(n[r]={...s},e({pages:n}))},deletePage:r=>{const s=t().pages;s&&(delete s[r],e({pages:s}))}}),{name:"pages-storage",partialize:e=>{const{pages:t,pageContext:r}=e;return{pages:t,pageContext:r}}})),Ou=cr(e=>({openModal:!1,setOpenModal:t=>e(()=>({openModal:t})),onChange:null,setOnChange:t=>e(()=>({onChange:t}))})),E4=(e,t,r)=>{const s=e[t];return s?typeof s=="function"?s():Promise.resolve(s):new Promise((n,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},_4="_icon_bsuj2_1",j4="_hoverable_bsuj2_5",T4="_rotated_bsuj2_9",k1={icon:_4,hoverable:j4,rotated:T4};var mm={exports:{}};/*!
|
|
67
67
|
Copyright (c) 2018 Jed Watson.
|
|
68
68
|
Licensed under the MIT License (MIT), see
|
|
69
69
|
http://jedwatson.github.io/classnames
|
package/dist/ui.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./root-CQZ1839v.cjs"),h=require("react"),rt="_accordion_2tiiw_1",at="_header_2tiiw_9",lt="_icon_2tiiw_16",ut="_open_2tiiw_19",xt="_content_2tiiw_23",U={accordion:rt,header:at,icon:lt,open:ut,content:xt},dt=({title:l,content:n})=>{const[s,o]=h.useState(!1),[r,a]=h.useState(0),e=h.useRef(null),c=()=>{o(!s)};return h.useEffect(()=>{e.current&&a(s?e.current.scrollHeight:0)},[s]),t.jsxRuntimeExports.jsxs("div",{className:U.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:U.header,onClick:c,children:[t.jsxRuntimeExports.jsx("h3",{children:l}),t.jsxRuntimeExports.jsx("div",{className:t.clx(U.icon,{[U.open]:s}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:e,className:U.content,style:{height:`${r}px`},children:t.jsxRuntimeExports.jsx("p",{children:n})})]})},pt="_wrapper_1g82c_2",mt="_alignmentBlock_1g82c_8",jt="_title_1g82c_15",_t="_subtitle_1g82c_22",ht="_alignmentContent_1g82c_29",gt="_alignments_1g82c_35",bt="_alignment_1g82c_8",ft="_circle_1g82c_54",vt="_paddings_1g82c_61",Rt="_padding_1g82c_61",Et="_input_1g82c_79",O={wrapper:pt,alignmentBlock:mt,title:jt,subtitle:_t,alignmentContent:ht,alignments:gt,alignment:bt,circle:ft,paddings:vt,padding:Rt,input:Et},yt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],kt=["left","top","right","bottom"],It=l=>{const{alignment:n,padding:s,setPadding:o,setAlignment:r}=l;function a(){switch(n){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 e(c){switch(c){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}return t.jsxRuntimeExports.jsxs("div",{className:O.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:O.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:O.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:O.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:O.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:O.alignments,children:yt.map(c=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{r(c)},className:O.alignment,children:[c!==n&&t.jsxRuntimeExports.jsx("div",{className:O.circle}),c===n&&t.jsxRuntimeExports.jsx(t.Icon,{name:a(),fill:"#FF3F19",width:22,height:22})]},c))}),t.jsxRuntimeExports.jsx("div",{className:O.paddings,children:kt.map(c=>t.jsxRuntimeExports.jsxs("label",{className:O.padding,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:e(c),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"text",value:String(s[c]),onChange:x=>o({...s,[c]:Number(x)}),paddingless:!0,borderless:!0})]},c))})]})]})]})},$t="_subtitle_2zbxx_1",Nt="_header_2zbxx_8",Ct="_text_2zbxx_9",wt="_top_2zbxx_16",Bt="_itemsBlock_2zbxx_23",G={subtitle:$t,header:Nt,text:Ct,top:wt,itemsBlock:Bt},Pt="_typeTexts_3zlec_1",St="_block_3zlec_7",Tt="_active_3zlec_18",W={typeTexts:Pt,block:St,active:Tt},At=["bold","italic","underline","strike-through","code"],K=l=>{const{typesText:n,setTypesText:s}=l;function o(r){switch(r){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:W.typeTexts,children:At.map(r=>t.jsxRuntimeExports.jsx("div",{className:t.clx(W.block,{[W.active]:n.includes(r)}),onClick:()=>{const a=[...n];if(a.includes(r)){const e=a.filter(c=>c!==r);s(e)}else a.push(r),s(a)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:o(r),fill:n.includes(r)?"#252525":"#757575",width:20,height:20})},String(r)))})},Z=l=>{const{typesText:n,isActiveText:s,setIsActiveText:o,text:r,setText:a,setTypesText:e,title:c,subtitle:x="Items"}=l;return t.jsxRuntimeExports.jsxs("div",{className:G.text,children:[(c||s!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:G.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:G.title,children:c}),s!==void 0&&o&&t.jsxRuntimeExports.jsx(t.Switch,{current:s,onChange:v=>o(v)})]}),t.jsxRuntimeExports.jsxs("div",{className:G.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:G.subtitle,children:x}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:v=>a(v),value:r,maxLength:150}),t.jsxRuntimeExports.jsx(K,{typesText:n,setTypesText:e})]})]})},Ot="_subtitle_11qr1_1",Dt="_header_11qr1_8",qt="_text_11qr1_9",Lt="_productsBlock_11qr1_10",Mt="_top_11qr1_22",Ht="_itemsBlock_11qr1_29",Vt="_typeTexts_11qr1_35",zt="_block_11qr1_41",Ft="_active_11qr1_52",Ut="_products_11qr1_10",Gt="_product_11qr1_10",Yt="_button_11qr1_70",Xt="_disabled_11qr1_80",Qt="_image_11qr1_84",Wt="_info_11qr1_91",Jt="_name_11qr1_102",Kt="_buttons_11qr1_106",Zt="_modal_11qr1_112",te="_link_11qr1_130",ee="_modalOptions_11qr1_136",$={subtitle:Ot,header:Dt,text:qt,productsBlock:Lt,top:Mt,itemsBlock:Ht,typeTexts:Vt,block:zt,active:Ft,products:Ut,product:Gt,button:Yt,disabled:Xt,image:Qt,info:Wt,name:Jt,buttons:Kt,modal:Zt,link:te,modalOptions:ee},se=l=>{const{activeItem:n,setActiveItem:s,popupPosition:o,modalOptions:r,setIsOpenModal:a}=l;return t.jsxRuntimeExports.jsxs("div",{className:$.modal,onClick:e=>{e.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{s(null),a(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:$.modalOptions,children:r.map(e=>{if(e.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:c=>{const x={...n,[e.field]:c};s(x)}},String(e.field));if(e.type==="text")return t.jsxRuntimeExports.jsx(Z,{typesText:n[e.field.type],setTypesText:c=>{const x={...n,[e.field.type]:c};s(x)},text:n[e.field.text]||"",setText:c=>{const x={...n,[e.field.text]:c};s(x)},subtitle:e.label});if(e.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const x={...n,[e.field]:c};s(x)},value:n[e.field]||"",label:e.label,placeholder:e.placeholder});if(e.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:$.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const x={...n,[e.field.text]:c};s(x)},value:n[e.field.text]||"",label:e.inputLabel,placeholder:e.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!n[e.field.switch]||!1,label:e.switchLabel,onChange:c=>{const x={...n,[e.field.switch]:c};s(x)}})]});if(e.type==="list")return t.jsxRuntimeExports.jsx(et,{items:n[e.field]||[],setItems:c=>{const x={...n,[e.field]:c};s(x)},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:c=>{const x={...n,[e.field]:c};s(x)},label:e.label,value:n[e.field]||"String",leftAddon:e.leftAddon&&e.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:n[e.field]})})})})]})},ne="_other_1wtgi_1",oe="_subtitle_1wtgi_7",ie="_items_1wtgi_14",J={other:ne,subtitle:oe,items:ie},tt=l=>{const{items:n,title:s="Other"}=l;return t.jsxRuntimeExports.jsxs("div",{className:J.other,children:[t.jsxRuntimeExports.jsx("h5",{className:J.subtitle,children:s}),t.jsxRuntimeExports.jsx("div",{className:J.items,children:n.map((o,r)=>t.jsxRuntimeExports.jsx(t.Switch,{current:o.isItem,onChange:a=>o.setIsItem(a),label:o.label,hasBackground:!0,paddingless:!1},r))})]})},ce=l=>{const{index:n,moveProduct:s,children:o}=l,[,r]=t.useDrop({accept:"product",hover(c){c.index!==n&&(s(c.index,n),c.index=n)}}),[{isDragging:a},e]=t.useDrag({type:"product",item:{index:n},collect:c=>({isDragging:c.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:c=>e(r(c)),className:`${$.product} ${a?$.dragging:""}`,children:o})},et=l=>{const{isActiveItems:n,setIsActiveItems:s,items:o,setItems:r,other:a,title:e,subtitle:c,editable:x=!0,draggable:v=!1,withImage:m=!1,deletable:f=!0,addable:g=!0,itemsType:i,itemsPlaceholder:d="",itemsOptions:j,hasRangeSelector:N=!1,rangeSelectorOptions:B,modalOptions:y,addableOptions:z={},limit:T}=l,[q,L]=h.useState(null),[Q,X]=h.useState({top:0,left:0}),[p,R]=h.useState(!1),P=(u,C)=>{const S=[...o],[E]=S.splice(u,1);S.splice(C,0,E),r(S)};h.useEffect(()=>{const u=()=>{L(null),R(!1)};return document.body.addEventListener("click",u),L(null),R(!1),()=>{L(null),R(!1),document.body.removeEventListener("click",u)}},[]),h.useEffect(()=>{if(q){const u=[...o].map(C=>C.id===q.id?q:C);r(u)}},[q]);const k=(u,C)=>{u.stopPropagation(),R(!0);const S=u.target.getBoundingClientRect(),E=500,F=window.innerHeight;let D=S.top+window.scrollY;D+E>F&&(D=F-E-20),X({top:D-80,left:S.left-30}),L(C)};function H(u){if(m)return u?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${u[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const A=(u,C)=>{const S=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[v&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),i==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,name:E}:M);L({...u,name:E}),r([...D])},value:u.name,options:j,leftAddon:H(u.images)}),i==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,name:E}:M);r([...D])},value:u.name,placeholder:d}),i==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,images:E}:M);r([...D])}}),t.jsxRuntimeExports.jsxs("div",{className:$.buttons,children:[x&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:E=>k(E,u)}),f&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>r(o.filter(E=>E.id!==u.id))})]})]});return v?t.jsxRuntimeExports.jsx(ce,{product:u,index:C,moveProduct:P,children:S},u.id):t.jsxRuntimeExports.jsx("div",{className:$.product,children:S},u.id)};return t.jsxRuntimeExports.jsxs("div",{className:$.productsBlock,children:[(e||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:$.title,children:e}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:u=>s==null?void 0:s(u)})]}),q&&x&&y&&p&&t.jsxRuntimeExports.jsx(se,{activeItem:q,setActiveItem:L,popupPosition:Q,modalOptions:y,setIsOpenModal:R}),N&&B&&t.jsxRuntimeExports.jsx(nt,{...B}),t.jsxRuntimeExports.jsxs("div",{className:$.products,children:[c&&t.jsxRuntimeExports.jsx("h5",{className:$.subtitle,children:c}),v?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:o.map((u,C)=>A(u,C))}):o.map((u,C)=>A(u,C)),g&&t.jsxRuntimeExports.jsxs(t.Button,{className:t.clx($.button,{[$.disabled]:!!(T&&T<=o.length)}),size:"s",disabled:!!(T&&T<=o.length),onClick:()=>{const u=[...o];i==="select"?u.push({name:j[0]||`Product ${o.length+1}`,id:t.v4(),...z}):i==="input"?u.push({name:"",id:t.v4(),...z}):u.push({name:`Image ${o.length+1}`,id:t.v4(),...z}),r(u)},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(tt,{items:a})]})},re="_subtitle_41klp_1",ae="_header_41klp_8",le="_text_41klp_9",ue="_productsBlock_41klp_10",xe="_buttonsBlock_41klp_11",de="_top_41klp_21",pe="_itemsBlock_41klp_28",me="_typeTexts_41klp_34",je="_block_41klp_40",_e="_active_41klp_51",he="_products_41klp_10",ge="_product_41klp_10",be="_button_41klp_11",fe="_image_41klp_79",ve="_info_41klp_86",Re="_name_41klp_97",Ee="_buttons_41klp_11",ye="_modal_41klp_107",ke="_other_41klp_124",Ie="_options_41klp_130",V={subtitle:re,header:ae,text:le,productsBlock:ue,buttonsBlock:xe,top:de,itemsBlock:pe,typeTexts:me,block:je,active:_e,products:he,product:ge,button:be,image:fe,info:ve,name:Re,buttons:Ee,modal:ye,other:ke,options:Ie},$e=l=>{const{activeButton:n,setActiveButton:s,popupPosition:o}=l,[r,a]=h.useState(n.typesText),[e,c]=h.useState(n.destination),[x,v]=h.useState(n.link||""),[m,f]=h.useState(n.text||"");return h.useEffect(()=>{s({...n,...{text:m,link:x,destination:e,typesText:r}})},[r,e,x,m]),t.jsxRuntimeExports.jsxs("div",{className:V.modal,onClick:g=>{g.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.type}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>s(null)})]}),t.jsxRuntimeExports.jsxs("div",{className:V.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:g=>c(g),options:["Go to Page","Open Link"],value:e}),e==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:()=>{},options:[],value:"Homepage"}):t.jsxRuntimeExports.jsx(t.Input,{onChange:g=>v(g),value:x,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:!1,label:"Open in new tab"}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:g=>f(g),value:m,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(K,{typesText:r,setTypesText:a})]})]})},Ne="_subtitle_1y5sw_1",Ce="_header_1y5sw_8",we="_text_1y5sw_9",Be="_productsBlock_1y5sw_10",Pe="_buttonsBlock_1y5sw_11",Se="_top_1y5sw_22",Te="_itemsBlock_1y5sw_29",Ae="_typeTexts_1y5sw_35",Oe="_block_1y5sw_41",De="_active_1y5sw_52",qe="_products_1y5sw_10",Le="_product_1y5sw_10",Me="_button_1y5sw_11",He="_image_1y5sw_80",Ve="_info_1y5sw_87",ze="_name_1y5sw_98",Fe="_buttons_1y5sw_11",Ue="_modal_1y5sw_108",Ge="_other_1y5sw_125",Ye="_options_1y5sw_131",Y={subtitle:Ne,header:Ce,text:we,productsBlock:Be,buttonsBlock:Pe,top:Se,itemsBlock:Te,typeTexts:Ae,block:Oe,active:De,products:qe,product:Le,button:Me,image:He,info:Ve,name:ze,buttons:Fe,modal:Ue,other:Ge,options:Ye},st=l=>{const{buttons:n,setButtons:s,deletable:o=!0,addable:r=!0}=l,[a,e]=h.useState(null),[c,x]=h.useState({top:0,left:0});h.useEffect(()=>{const m=()=>{e(null)};return document.body.addEventListener("click",m),e(null),()=>{e(null),document.body.removeEventListener("click",m)}},[]),h.useEffect(()=>{if(a){const m=[...n].map(f=>f.id===a.id?a:f);s(m)}},[a]);const v=(m,f)=>{m.stopPropagation();const g=m.target.getBoundingClientRect(),i=490,d=window.innerHeight;let j=g.top+window.scrollY;j+i>d&&(j=d-i-20),x({top:j,left:g.left-30}),e(f)};return t.jsxRuntimeExports.jsxs("div",{className:Y.products,children:[t.jsxRuntimeExports.jsx("h5",{className:Y.subtitle,children:"Button Type"}),n.map(m=>t.jsxRuntimeExports.jsxs("div",{className:Y.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:f=>{const i=[...n].map(d=>d.id===m.id?{...m,type:f}:d);s(i)},value:m.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:Y.buttons,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:f=>{v(f,m)}}),o&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const f=n.filter(g=>g.id!==m.id);s(f)},width:20,height:20,fill:"#C12A2A"})]})]},m.id)),a&&t.jsxRuntimeExports.jsx($e,{activeButton:a,setActiveButton:e,popupPosition:c}),r&&t.jsxRuntimeExports.jsxs(t.Button,{className:Y.button,size:"s",onClick:()=>{const m=[...n];m.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:""}),s(m)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]})},Xe=l=>{const{isActiveButtons:n,setIsActiveButtons:s,buttons:o,setButtons:r}=l;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:V.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[t.jsxRuntimeExports.jsx("h3",{className:V.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:a=>s(a)})]}),t.jsxRuntimeExports.jsx(st,{buttons:o,setButtons:r})]})})},Qe="_wrapper_tn7gb_1",We="_subtitle_tn7gb_7",Je="_content_tn7gb_14",Ke="_range_tn7gb_21",Ze="_track_tn7gb_26",ts="_progress_tn7gb_35",es="_dots_tn7gb_45",ss="_dot_tn7gb_45",ns="_active_tn7gb_62",os="_input_tn7gb_74",is="_countBlock_tn7gb_88",cs="_count_tn7gb_88",rs="_controls_tn7gb_103",as="_button_tn7gb_108",I={wrapper:Qe,subtitle:We,content:Je,range:Ke,track:Ze,progress:ts,dots:es,dot:ss,active:ns,input:os,countBlock:is,count:cs,controls:rs,button:as},nt=l=>{const{label:n,min:s=1,max:o=4,step:r=1,count:a,setCount:e}=l,[c,x]=h.useState(!1),v=Array.from({length:(o-s)/r+1}),m=(a-s)/(o-s)*100,f=()=>{a<o&&e(a+r)},g=()=>{a>s&&e(a-r)},i=d=>{const j=s+d*r;e(j)};return t.jsxRuntimeExports.jsxs("div",{className:I.wrapper,children:[n&&t.jsxRuntimeExports.jsx("h5",{className:I.subtitle,children:n}),t.jsxRuntimeExports.jsxs("div",{className:I.content,children:[t.jsxRuntimeExports.jsxs("div",{className:I.range,children:[t.jsxRuntimeExports.jsx("div",{className:I.track}),t.jsxRuntimeExports.jsx("div",{className:I.progress,style:{width:`${m}%`}}),t.jsxRuntimeExports.jsx("div",{className:I.dots,children:v.map((d,j)=>{const N=j<=(a-s)/r;return t.jsxRuntimeExports.jsx("button",{onClick:()=>i(j),className:t.clx(I.dot,{[I.active]:N,[I.inactive]:!N,[I.dragging]:c}),"aria-label":`Set value to ${s+j*r}`},j)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:s,max:o,step:r,value:a,onChange:d=>e(Number(d.target.value)),onMouseDown:()=>x(!0),onMouseUp:()=>x(!1),onTouchStart:()=>x(!0),onTouchEnd:()=>x(!1),className:I.input})]}),t.jsxRuntimeExports.jsxs("div",{className:I.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:s,max:o,paddingless:!0,onChange:d=>{const j=Number(d);j>o?e(o):j<s?e(s):e(j)},value:String(a)}),t.jsxRuntimeExports.jsxs("div",{className:I.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:f,disabled:a>=o,className:I.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:g,disabled:a<=s,className:I.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},ls="_subtitle_1nl8x_1",us="_header_1nl8x_8",xs="_text_1nl8x_9",ds="_productsBlock_1nl8x_10",ps="_top_1nl8x_22",ms="_itemsBlock_1nl8x_29",js="_typeTexts_1nl8x_35",_s="_block_1nl8x_41",hs="_active_1nl8x_52",gs="_products_1nl8x_10",bs="_product_1nl8x_10",fs="_button_1nl8x_70",vs="_image_1nl8x_80",Rs="_info_1nl8x_87",Es="_name_1nl8x_98",ys="_buttons_1nl8x_102",ks="_modal_1nl8x_108",Is="_link_1nl8x_126",$s="_modalOptions_1nl8x_132",w={subtitle:ls,header:us,text:xs,productsBlock:ds,top:ps,itemsBlock:ms,typeTexts:js,block:_s,active:hs,products:gs,product:bs,button:fs,image:vs,info:Rs,name:Es,buttons:ys,modal:ks,link:Is,modalOptions:$s},Ns=l=>{const{activeItem:n,setActiveItem:s,popupPosition:o,setIsOpenModal:r}=l;return t.jsxRuntimeExports.jsxs("div",{className:w.modal,onClick:a=>{a.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:w.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{r(!1),s(null)}})]}),t.jsxRuntimeExports.jsx("div",{className:w.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:a=>{const e={...n,images:a,imagePath:a[0]};s(e)}})})]})},Cs=l=>{const{index:n,moveProduct:s,children:o}=l,[,r]=t.useDrop({accept:"product",hover(c){c.index!==n&&(s(c.index,n),c.index=n)}}),[{isDragging:a},e]=t.useDrag({type:"product",item:{index:n},collect:c=>({isDragging:c.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:c=>e(r(c)),className:`${w.product} ${a?w.dragging:""}`,children:o})},ws=l=>{const{isActiveItems:n,setIsActiveItems:s,items:o,setItems:r,other:a,title:e,subtitle:c,editable:x=!0,draggable:v=!1,withImage:m=!1,deletable:f=!0,addable:g=!0,itemsType:i,itemsOptions:d}=l,[j,N]=h.useState(null),[B,y]=h.useState({top:0,left:0}),[z,T]=h.useState(!1),q=(p,R)=>{const P=[...o],[k]=P.splice(p,1);P.splice(R,0,k),r(P)};h.useEffect(()=>{const p=()=>{N(null),T(!1)};return document.body.addEventListener("click",p),N(null),T(!1),()=>{N(null),T(!1),document.body.removeEventListener("click",p)}},[]),h.useEffect(()=>{if(j){const p=[...o].map(R=>R.id===j.id?j:R);r(p)}},[j]);const L=(p,R)=>{p.stopPropagation();const P=p.target.getBoundingClientRect(),k=100,H=window.innerHeight;let A=P.top+window.scrollY;A+k>H&&(A=H-k-20),T(!0),y({top:A-80,left:P.left-30}),N(R)};function Q(p){if(m)return p?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${p}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const X=(p,R)=>{const P=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[v&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),i==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:k=>{const H=[...o],A=Number(k.split(" ")[1]),u=d.find(E=>E.id===A);if(!u)return;const C={...u.productData.stats,newPrice:u.productData.minPrice.amount,oldPrice:u.productData.compareAtPrice.amount},S=H.map(E=>E.id===p.id?{...p,name:k,listingId:A,stats:C}:E);N({...p,name:k,listingId:A}),r([...S])},value:p.name,options:[...d.map(k=>`Product ${k.id}`)],leftAddon:Q(p.images[0])}),t.jsxRuntimeExports.jsxs("div",{className:w.buttons,children:[x&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:k=>L(k,p)}),f&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>r(o.filter(k=>k.id!==p.id))})]})]});return v?t.jsxRuntimeExports.jsx(Cs,{product:p,index:R,moveProduct:q,children:P},p.id):t.jsxRuntimeExports.jsx("div",{className:w.product,children:P},p.id)};return t.jsxRuntimeExports.jsxs("div",{className:w.productsBlock,children:[(e||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:w.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:w.title,children:e}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:p=>s==null?void 0:s(p)})]}),z&&j&&t.jsxRuntimeExports.jsx(Ns,{activeItem:j,setActiveItem:N,setIsOpenModal:T,popupPosition:B}),t.jsxRuntimeExports.jsxs("div",{className:w.products,children:[c&&t.jsxRuntimeExports.jsx("h5",{className:w.subtitle,children:c}),v?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:o.map((p,R)=>X(p,R))}):o.map((p,R)=>X(p,R)),g&&t.jsxRuntimeExports.jsxs(t.Button,{className:w.button,size:"s",onClick:()=>{const p=[...o],R=d[0].id;p.push({name:`Product ${R}`,id:t.v4(),listingId:R,imagePath:"",images:[],stats:{...d[0].productData.stats,newPrice:d[0].productData.minPrice.amount,oldPrice:d[0].productData.compareAtPrice.amount}}),r(p)},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(tt,{items:a})]})},Bs="_options_163bj_1",Ps="_price_163bj_12",Ss="_oldPrice_163bj_18",Ts="_newPrice_163bj_26",As="_meta_163bj_33",Os="_info_163bj_39",Ds="_infoRight_163bj_46",qs="_buttons_163bj_52",Ls="_variants_163bj_59",Ms="_variant_163bj_59",Hs="_stock_163bj_74",Vs="_variantInfo_163bj_81",zs="_quantity_163bj_87",Fs="_count_163bj_93",Us="_button_163bj_52",Gs="_activeVariant_163bj_110",Ys="_chargeTypes_163bj_114",Xs="_charge_163bj_114",Qs="_chargeActive_163bj_131",b={options:Bs,price:Ps,oldPrice:Ss,newPrice:Ts,meta:As,info:Os,infoRight:Ds,buttons:qs,variants:Ls,variant:Ms,stock:Hs,variantInfo:Vs,quantity:zs,count:Fs,button:Us,activeVariant:Gs,chargeTypes:Ys,charge:Xs,chargeActive:Qs},Ws=l=>{const{variants:n}=l,[s,o]=h.useState(n[0]),r=t.useNavigate(),[a,e]=h.useState(1),{reset:c,addProductToCart:x,getProducts:v}=t.useCart();async function m(){await v(),await x({productId:l.id,productVariantId:s.id,quantity:a})}function f(){c(),m(),r("/checkout")}function g(i){if(i>=864e5){const y=Math.floor(i/864e5);return`${y} ${y===1?"day":"days"}`}else if(i>=36e5){const y=Math.floor(i/36e5);return`${y} ${y===1?"hour":"hours"}`}else if(i>=6e4){const y=Math.floor(i/6e4);return`${y} ${y===1?"minute":"minutes"}`}else{const y=Math.floor(i/1e3);return`${y} ${y===1?"second":"seconds"}`}}return t.jsxRuntimeExports.jsxs("div",{className:b.options,children:[t.jsxRuntimeExports.jsx("div",{className:b.chargeTypes,children:s.chargeTypes?s.chargeTypes.map(i=>t.jsxRuntimeExports.jsx("div",{children:i},i)):t.jsxRuntimeExports.jsx("div",{className:t.clx(b.charge,b.chargeActive),children:"One-Time"})}),t.jsxRuntimeExports.jsx("div",{className:b.variants,children:n.map(i=>t.jsxRuntimeExports.jsxs("div",{className:t.clx(b.variant,{[b.activeVariant]:s.id===i.id}),onClick:()=>o(i),children:[t.jsxRuntimeExports.jsxs("div",{className:b.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:b.title,children:i.name}),t.jsxRuntimeExports.jsxs("span",{children:["$",i.price.amount]})]}),t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsxs("span",{className:b.stock,children:[i.quantity.restrictions.max||0," in stock"]})})]},i.id))}),t.jsxRuntimeExports.jsxs("div",{className:b.quantity,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{a>1?e(i=>i-1):e(1)},className:b.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx("div",{className:b.count,children:a}),t.jsxRuntimeExports.jsx("div",{onClick:()=>e(i=>i+1),className:b.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:b.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:b.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:b.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"#FF3F19",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{children:s.deliveryTime===0?"Instant":g(s.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:b.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:b.infoRight,children:s.compareAtPrice&&(s.compareAtPrice.amount||0)-(s.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:b.price,children:[t.jsxRuntimeExports.jsxs("span",{className:b.newPrice,children:["$ ",(s.price.amount||0)*a]}),t.jsxRuntimeExports.jsxs("span",{className:b.oldPrice,children:["$ ",(s.compareAtPrice.amount||0)*a]})]}):t.jsxRuntimeExports.jsxs("span",{className:b.newPrice,children:["$ ",(s.price.amount||0)*a]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:b.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:()=>f(),children:"Buy Now"}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:()=>m(),children:"Add to Cart"})]})]})},Js="_button_1jgdy_1",Ks="_login_1jgdy_12",Zs="_signUp_1jgdy_16",tn="_buttons_1jgdy_21",en="_modal_1jgdy_28",sn="_info_1jgdy_44",nn="_top_1jgdy_50",on="_title_1jgdy_59",cn="_clear_1jgdy_65",rn="_activeClear_1jgdy_72",an="_count_1jgdy_76",ln="_cart_1jgdy_89",un="_empty_1jgdy_96",xn="_product_1jgdy_122",dn="_products_1jgdy_129",pn="_image_1jgdy_136",mn="_productInfo_1jgdy_142",jn="_content_1jgdy_148",_n="_name_1jgdy_154",hn="_price_1jgdy_160",gn="_productButtons_1jgdy_166",bn="_productButton_1jgdy_166",fn="_productCount_1jgdy_183",vn="_bottom_1jgdy_197",Rn="_subtotal_1jgdy_205",En="_block_1jgdy_211",yn="_shoppingCount_1jgdy_217",_={button:Js,login:Ks,signUp:Zs,buttons:tn,modal:en,info:sn,top:nn,title:on,clear:cn,activeClear:rn,count:an,cart:ln,empty:un,product:xn,products:dn,image:pn,productInfo:mn,content:jn,name:_n,price:hn,productButtons:gn,productButton:bn,productCount:fn,bottom:vn,subtotal:Rn,block:En,shoppingCount:yn},kn=l=>{const{shopping:n,signUp:s}=l,o=t.useNavigate();function r(a){o(a)}return t.jsxRuntimeExports.jsxs("div",{className:_.buttons,children:[n&&t.jsxRuntimeExports.jsx(ot,{}),t.jsxRuntimeExports.jsx("div",{className:t.clx(_.button,_.login),onClick:()=>r("/customer-dash"),children:"Login"}),s&&t.jsxRuntimeExports.jsx("div",{className:t.clx(_.button,_.login,_.signUp),onClick:()=>r("/customer-dash"),children:"Sign Up"})]})},ot=()=>{const[l,n]=h.useState(!1),{cart:s}=t.useCart();return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:_.button,onClick:o=>{o.stopPropagation(),n(!0)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"#252525"}),s.parts.length>0&&t.jsxRuntimeExports.jsx("div",{className:_.shoppingCount,children:s.parts.length})]}),l&&t.jsxRuntimeExports.jsx(t.Modal,{close:n,children:t.jsxRuntimeExports.jsx(it,{})})]})},it=()=>{const{cart:l,reset:n,getProducts:s,getTotalAndDiscount:o,updateQuantityOfProduct:r}=t.useCart(),[a,e]=h.useState([]),c=t.useNavigate();function x(i){for(let d=0;d<l.parts.length;d++)for(let j=0;j<i.variants.length;j++)if(l.parts[d].productVariantId===i.variants[d].id)return l.parts[d].productVariantId}function v(i){for(let d=0;d<l.parts.length;d++)for(let j=0;j<i.variants.length;j++)if(l.parts[d].productVariantId===i.variants[d].id)return l.parts[d].quantity}function m(i){c(i)}function f(i){r({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity+1})}function g(i){r({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity-1})}return h.useEffect(()=>{(async()=>{const d=l.parts.map(B=>String(B.productId)),N=(await s([...d])).map(B=>({...B,activeVariantId:x(B),quantity:v(B)}));e(N)})()},[l]),t.jsxRuntimeExports.jsxs("div",{className:_.modal,onClick:i=>i.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:_.top,children:[t.jsxRuntimeExports.jsxs("div",{className:_.info,children:[t.jsxRuntimeExports.jsx("span",{className:_.title,children:"Cart"}),l.parts.length>0&&t.jsxRuntimeExports.jsx("div",{className:_.count,children:l.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx(_.clear,{[_.activeClear]:l.parts.length>0}),disabled:l.parts.length===0,onClick:()=>n(),children:"Clear all"})]}),l.parts.length>0?t.jsxRuntimeExports.jsxs("div",{className:_.cart,children:[t.jsxRuntimeExports.jsx("div",{className:_.products,children:a.map(i=>t.jsxRuntimeExports.jsxs("div",{className:_.product,children:[t.jsxRuntimeExports.jsxs("div",{className:_.productInfo,children:[t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${i.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:_.image}),t.jsxRuntimeExports.jsxs("div",{className:_.content,children:[t.jsxRuntimeExports.jsx("div",{className:_.name,children:i.name}),t.jsxRuntimeExports.jsxs("div",{className:_.price,children:["$",i.variants.find(d=>d.id===i.activeVariantId).price.amount*((i==null?void 0:i.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:_.productButtons,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{i.quantity!==1&&g(i)},className:_.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:_.productCount,children:i.quantity}),t.jsxRuntimeExports.jsx("div",{onClick:()=>f(i),className:_.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},i.id))}),t.jsxRuntimeExports.jsxs("div",{className:_.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:_.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:_.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",{children:["$",o().total]})]}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>m("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(ct,{})]})},ct=()=>t.jsxRuntimeExports.jsxs("div",{className:_.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.jsx("span",{children:"Check out the store's products and add them here"})]});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.Loader=t.Loader;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.Accordion=dt;exports.ButtonTypeSettings=st;exports.ButtonsSettings=Xe;exports.EmptyCart=ct;exports.HeaderButtons=kn;exports.ItemsSettings=et;exports.LayoutSettings=It;exports.ListingSelector=ws;exports.ProductOptions=Ws;exports.RangeSelector=nt;exports.ShoppingButton=ot;exports.ShoppingModalCart=it;exports.TextSettings=Z;exports.TypesText=K;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./root-CcZWgeeq.cjs"),h=require("react"),rt="_accordion_2tiiw_1",at="_header_2tiiw_9",lt="_icon_2tiiw_16",ut="_open_2tiiw_19",xt="_content_2tiiw_23",U={accordion:rt,header:at,icon:lt,open:ut,content:xt},dt=({title:l,content:n})=>{const[s,o]=h.useState(!1),[r,a]=h.useState(0),e=h.useRef(null),c=()=>{o(!s)};return h.useEffect(()=>{e.current&&a(s?e.current.scrollHeight:0)},[s]),t.jsxRuntimeExports.jsxs("div",{className:U.accordion,children:[t.jsxRuntimeExports.jsxs("div",{className:U.header,onClick:c,children:[t.jsxRuntimeExports.jsx("h3",{children:l}),t.jsxRuntimeExports.jsx("div",{className:t.clx(U.icon,{[U.open]:s}),children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown"})})]}),t.jsxRuntimeExports.jsx("div",{ref:e,className:U.content,style:{height:`${r}px`},children:t.jsxRuntimeExports.jsx("p",{children:n})})]})},pt="_wrapper_1g82c_2",mt="_alignmentBlock_1g82c_8",jt="_title_1g82c_15",_t="_subtitle_1g82c_22",ht="_alignmentContent_1g82c_29",gt="_alignments_1g82c_35",bt="_alignment_1g82c_8",ft="_circle_1g82c_54",vt="_paddings_1g82c_61",Rt="_padding_1g82c_61",Et="_input_1g82c_79",O={wrapper:pt,alignmentBlock:mt,title:jt,subtitle:_t,alignmentContent:ht,alignments:gt,alignment:bt,circle:ft,paddings:vt,padding:Rt,input:Et},yt=["topLeft","top","topRight","left","center","right","bottomLeft","bottom","bottomRight"],kt=["left","top","right","bottom"],It=l=>{const{alignment:n,padding:s,setPadding:o,setAlignment:r}=l;function a(){switch(n){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 e(c){switch(c){case"left":return"AlignLeft";case"right":return"AlignRight";case"top":return"AlignTop";case"bottom":return"AlignBottom"}}return t.jsxRuntimeExports.jsxs("div",{className:O.layout,children:[t.jsxRuntimeExports.jsx("h3",{className:O.title,children:"Layout"}),t.jsxRuntimeExports.jsxs("div",{className:O.alignmentBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:O.subtitle,children:"Alignment"}),t.jsxRuntimeExports.jsxs("div",{className:O.alignmentContent,children:[t.jsxRuntimeExports.jsx("div",{className:O.alignments,children:yt.map(c=>t.jsxRuntimeExports.jsxs("div",{onClick:()=>{r(c)},className:O.alignment,children:[c!==n&&t.jsxRuntimeExports.jsx("div",{className:O.circle}),c===n&&t.jsxRuntimeExports.jsx(t.Icon,{name:a(),fill:"#FF3F19",width:22,height:22})]},c))}),t.jsxRuntimeExports.jsx("div",{className:O.paddings,children:kt.map(c=>t.jsxRuntimeExports.jsxs("label",{className:O.padding,children:[t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:e(c),width:20,height:20})}),t.jsxRuntimeExports.jsx(t.Input,{type:"text",value:String(s[c]),onChange:x=>o({...s,[c]:Number(x)}),paddingless:!0,borderless:!0})]},c))})]})]})]})},$t="_subtitle_2zbxx_1",Nt="_header_2zbxx_8",Ct="_text_2zbxx_9",wt="_top_2zbxx_16",Bt="_itemsBlock_2zbxx_23",G={subtitle:$t,header:Nt,text:Ct,top:wt,itemsBlock:Bt},Pt="_typeTexts_3zlec_1",St="_block_3zlec_7",Tt="_active_3zlec_18",W={typeTexts:Pt,block:St,active:Tt},At=["bold","italic","underline","strike-through","code"],K=l=>{const{typesText:n,setTypesText:s}=l;function o(r){switch(r){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:W.typeTexts,children:At.map(r=>t.jsxRuntimeExports.jsx("div",{className:t.clx(W.block,{[W.active]:n.includes(r)}),onClick:()=>{const a=[...n];if(a.includes(r)){const e=a.filter(c=>c!==r);s(e)}else a.push(r),s(a)},children:t.jsxRuntimeExports.jsx(t.Icon,{name:o(r),fill:n.includes(r)?"#252525":"#757575",width:20,height:20})},String(r)))})},Z=l=>{const{typesText:n,isActiveText:s,setIsActiveText:o,text:r,setText:a,setTypesText:e,title:c,subtitle:x="Items"}=l;return t.jsxRuntimeExports.jsxs("div",{className:G.text,children:[(c||s!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:G.top,children:[c&&t.jsxRuntimeExports.jsx("h3",{className:G.title,children:c}),s!==void 0&&o&&t.jsxRuntimeExports.jsx(t.Switch,{current:s,onChange:v=>o(v)})]}),t.jsxRuntimeExports.jsxs("div",{className:G.itemsBlock,children:[t.jsxRuntimeExports.jsx("h5",{className:G.subtitle,children:x}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:v=>a(v),value:r,maxLength:150}),t.jsxRuntimeExports.jsx(K,{typesText:n,setTypesText:e})]})]})},Ot="_subtitle_11qr1_1",Dt="_header_11qr1_8",qt="_text_11qr1_9",Lt="_productsBlock_11qr1_10",Mt="_top_11qr1_22",Ht="_itemsBlock_11qr1_29",Vt="_typeTexts_11qr1_35",zt="_block_11qr1_41",Ft="_active_11qr1_52",Ut="_products_11qr1_10",Gt="_product_11qr1_10",Yt="_button_11qr1_70",Xt="_disabled_11qr1_80",Qt="_image_11qr1_84",Wt="_info_11qr1_91",Jt="_name_11qr1_102",Kt="_buttons_11qr1_106",Zt="_modal_11qr1_112",te="_link_11qr1_130",ee="_modalOptions_11qr1_136",$={subtitle:Ot,header:Dt,text:qt,productsBlock:Lt,top:Mt,itemsBlock:Ht,typeTexts:Vt,block:zt,active:Ft,products:Ut,product:Gt,button:Yt,disabled:Xt,image:Qt,info:Wt,name:Jt,buttons:Kt,modal:Zt,link:te,modalOptions:ee},se=l=>{const{activeItem:n,setActiveItem:s,popupPosition:o,modalOptions:r,setIsOpenModal:a}=l;return t.jsxRuntimeExports.jsxs("div",{className:$.modal,onClick:e=>{e.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{s(null),a(!1)}})]}),t.jsxRuntimeExports.jsx("div",{className:$.modalOptions,children:r.map(e=>{if(e.type==="image")return t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:c=>{const x={...n,[e.field]:c};s(x)}},String(e.field));if(e.type==="text")return t.jsxRuntimeExports.jsx(Z,{typesText:n[e.field.type],setTypesText:c=>{const x={...n,[e.field.type]:c};s(x)},text:n[e.field.text]||"",setText:c=>{const x={...n,[e.field.text]:c};s(x)},subtitle:e.label});if(e.type==="input")return t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const x={...n,[e.field]:c};s(x)},value:n[e.field]||"",label:e.label,placeholder:e.placeholder});if(e.type==="inputSwitch")return t.jsxRuntimeExports.jsxs("div",{className:$.link,children:[t.jsxRuntimeExports.jsx(t.Input,{onChange:c=>{const x={...n,[e.field.text]:c};s(x)},value:n[e.field.text]||"",label:e.inputLabel,placeholder:e.placeholder}),t.jsxRuntimeExports.jsx(t.Switch,{current:!!n[e.field.switch]||!1,label:e.switchLabel,onChange:c=>{const x={...n,[e.field.switch]:c};s(x)}})]});if(e.type==="list")return t.jsxRuntimeExports.jsx(et,{items:n[e.field]||[],setItems:c=>{const x={...n,[e.field]:c};s(x)},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:c=>{const x={...n,[e.field]:c};s(x)},label:e.label,value:n[e.field]||"String",leftAddon:e.leftAddon&&e.leftAddon==="icon"&&t.jsxRuntimeExports.jsx(t.Icon,{name:n[e.field]})})})})]})},ne="_other_1wtgi_1",oe="_subtitle_1wtgi_7",ie="_items_1wtgi_14",J={other:ne,subtitle:oe,items:ie},tt=l=>{const{items:n,title:s="Other"}=l;return t.jsxRuntimeExports.jsxs("div",{className:J.other,children:[t.jsxRuntimeExports.jsx("h5",{className:J.subtitle,children:s}),t.jsxRuntimeExports.jsx("div",{className:J.items,children:n.map((o,r)=>t.jsxRuntimeExports.jsx(t.Switch,{current:o.isItem,onChange:a=>o.setIsItem(a),label:o.label,hasBackground:!0,paddingless:!1},r))})]})},ce=l=>{const{index:n,moveProduct:s,children:o}=l,[,r]=t.useDrop({accept:"product",hover(c){c.index!==n&&(s(c.index,n),c.index=n)}}),[{isDragging:a},e]=t.useDrag({type:"product",item:{index:n},collect:c=>({isDragging:c.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:c=>e(r(c)),className:`${$.product} ${a?$.dragging:""}`,children:o})},et=l=>{const{isActiveItems:n,setIsActiveItems:s,items:o,setItems:r,other:a,title:e,subtitle:c,editable:x=!0,draggable:v=!1,withImage:m=!1,deletable:f=!0,addable:g=!0,itemsType:i,itemsPlaceholder:d="",itemsOptions:j,hasRangeSelector:N=!1,rangeSelectorOptions:B,modalOptions:y,addableOptions:z={},limit:T}=l,[q,L]=h.useState(null),[Q,X]=h.useState({top:0,left:0}),[p,R]=h.useState(!1),P=(u,C)=>{const S=[...o],[E]=S.splice(u,1);S.splice(C,0,E),r(S)};h.useEffect(()=>{const u=()=>{L(null),R(!1)};return document.body.addEventListener("click",u),L(null),R(!1),()=>{L(null),R(!1),document.body.removeEventListener("click",u)}},[]),h.useEffect(()=>{if(q){const u=[...o].map(C=>C.id===q.id?q:C);r(u)}},[q]);const k=(u,C)=>{u.stopPropagation(),R(!0);const S=u.target.getBoundingClientRect(),E=500,F=window.innerHeight;let D=S.top+window.scrollY;D+E>F&&(D=F-E-20),X({top:D-80,left:S.left-30}),L(C)};function H(u){if(m)return u?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${u[0]}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const A=(u,C)=>{const S=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[v&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),i==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,name:E}:M);L({...u,name:E}),r([...D])},value:u.name,options:j,leftAddon:H(u.images)}),i==="input"&&t.jsxRuntimeExports.jsx(t.Input,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,name:E}:M);r([...D])},value:u.name,placeholder:d}),i==="image"&&t.jsxRuntimeExports.jsx(t.ChooseImage,{onChange:E=>{const D=[...o].map(M=>M.id===u.id?{...u,images:E}:M);r([...D])}}),t.jsxRuntimeExports.jsxs("div",{className:$.buttons,children:[x&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:E=>k(E,u)}),f&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>r(o.filter(E=>E.id!==u.id))})]})]});return v?t.jsxRuntimeExports.jsx(ce,{product:u,index:C,moveProduct:P,children:S},u.id):t.jsxRuntimeExports.jsx("div",{className:$.product,children:S},u.id)};return t.jsxRuntimeExports.jsxs("div",{className:$.productsBlock,children:[(e||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:$.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:$.title,children:e}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:u=>s==null?void 0:s(u)})]}),q&&x&&y&&p&&t.jsxRuntimeExports.jsx(se,{activeItem:q,setActiveItem:L,popupPosition:Q,modalOptions:y,setIsOpenModal:R}),N&&B&&t.jsxRuntimeExports.jsx(nt,{...B}),t.jsxRuntimeExports.jsxs("div",{className:$.products,children:[c&&t.jsxRuntimeExports.jsx("h5",{className:$.subtitle,children:c}),v?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:o.map((u,C)=>A(u,C))}):o.map((u,C)=>A(u,C)),g&&t.jsxRuntimeExports.jsxs(t.Button,{className:t.clx($.button,{[$.disabled]:!!(T&&T<=o.length)}),size:"s",disabled:!!(T&&T<=o.length),onClick:()=>{const u=[...o];i==="select"?u.push({name:j[0]||`Product ${o.length+1}`,id:t.v4(),...z}):i==="input"?u.push({name:"",id:t.v4(),...z}):u.push({name:`Image ${o.length+1}`,id:t.v4(),...z}),r(u)},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(tt,{items:a})]})},re="_subtitle_41klp_1",ae="_header_41klp_8",le="_text_41klp_9",ue="_productsBlock_41klp_10",xe="_buttonsBlock_41klp_11",de="_top_41klp_21",pe="_itemsBlock_41klp_28",me="_typeTexts_41klp_34",je="_block_41klp_40",_e="_active_41klp_51",he="_products_41klp_10",ge="_product_41klp_10",be="_button_41klp_11",fe="_image_41klp_79",ve="_info_41klp_86",Re="_name_41klp_97",Ee="_buttons_41klp_11",ye="_modal_41klp_107",ke="_other_41klp_124",Ie="_options_41klp_130",V={subtitle:re,header:ae,text:le,productsBlock:ue,buttonsBlock:xe,top:de,itemsBlock:pe,typeTexts:me,block:je,active:_e,products:he,product:ge,button:be,image:fe,info:ve,name:Re,buttons:Ee,modal:ye,other:ke,options:Ie},$e=l=>{const{activeButton:n,setActiveButton:s,popupPosition:o}=l,[r,a]=h.useState(n.typesText),[e,c]=h.useState(n.destination),[x,v]=h.useState(n.link||""),[m,f]=h.useState(n.text||"");return h.useEffect(()=>{s({...n,...{text:m,link:x,destination:e,typesText:r}})},[r,e,x,m]),t.jsxRuntimeExports.jsxs("div",{className:V.modal,onClick:g=>{g.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.type}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>s(null)})]}),t.jsxRuntimeExports.jsxs("div",{className:V.options,children:[t.jsxRuntimeExports.jsx(t.Select,{label:"Destination",onChange:g=>c(g),options:["Go to Page","Open Link"],value:e}),e==="Go to Page"?t.jsxRuntimeExports.jsx(t.Select,{label:"Go to",onChange:()=>{},options:[],value:"Homepage"}):t.jsxRuntimeExports.jsx(t.Input,{onChange:g=>v(g),value:x,placeholder:"https://",label:"Link"}),t.jsxRuntimeExports.jsx(t.Switch,{current:!1,label:"Open in new tab"}),t.jsxRuntimeExports.jsx(t.Textarea,{onChange:g=>f(g),value:m,label:"Text",maxLength:150}),t.jsxRuntimeExports.jsx(K,{typesText:r,setTypesText:a})]})]})},Ne="_subtitle_1y5sw_1",Ce="_header_1y5sw_8",we="_text_1y5sw_9",Be="_productsBlock_1y5sw_10",Pe="_buttonsBlock_1y5sw_11",Se="_top_1y5sw_22",Te="_itemsBlock_1y5sw_29",Ae="_typeTexts_1y5sw_35",Oe="_block_1y5sw_41",De="_active_1y5sw_52",qe="_products_1y5sw_10",Le="_product_1y5sw_10",Me="_button_1y5sw_11",He="_image_1y5sw_80",Ve="_info_1y5sw_87",ze="_name_1y5sw_98",Fe="_buttons_1y5sw_11",Ue="_modal_1y5sw_108",Ge="_other_1y5sw_125",Ye="_options_1y5sw_131",Y={subtitle:Ne,header:Ce,text:we,productsBlock:Be,buttonsBlock:Pe,top:Se,itemsBlock:Te,typeTexts:Ae,block:Oe,active:De,products:qe,product:Le,button:Me,image:He,info:Ve,name:ze,buttons:Fe,modal:Ue,other:Ge,options:Ye},st=l=>{const{buttons:n,setButtons:s,deletable:o=!0,addable:r=!0}=l,[a,e]=h.useState(null),[c,x]=h.useState({top:0,left:0});h.useEffect(()=>{const m=()=>{e(null)};return document.body.addEventListener("click",m),e(null),()=>{e(null),document.body.removeEventListener("click",m)}},[]),h.useEffect(()=>{if(a){const m=[...n].map(f=>f.id===a.id?a:f);s(m)}},[a]);const v=(m,f)=>{m.stopPropagation();const g=m.target.getBoundingClientRect(),i=490,d=window.innerHeight;let j=g.top+window.scrollY;j+i>d&&(j=d-i-20),x({top:j,left:g.left-30}),e(f)};return t.jsxRuntimeExports.jsxs("div",{className:Y.products,children:[t.jsxRuntimeExports.jsx("h5",{className:Y.subtitle,children:"Button Type"}),n.map(m=>t.jsxRuntimeExports.jsxs("div",{className:Y.product,children:[t.jsxRuntimeExports.jsx(t.Select,{onChange:f=>{const i=[...n].map(d=>d.id===m.id?{...m,type:f}:d);s(i)},value:m.type,options:["Primary","Secondary","Tertiary"]}),t.jsxRuntimeExports.jsxs("div",{className:Y.buttons,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:f=>{v(f,m)}}),o&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,onClick:()=>{const f=n.filter(g=>g.id!==m.id);s(f)},width:20,height:20,fill:"#C12A2A"})]})]},m.id)),a&&t.jsxRuntimeExports.jsx($e,{activeButton:a,setActiveButton:e,popupPosition:c}),r&&t.jsxRuntimeExports.jsxs(t.Button,{className:Y.button,size:"s",onClick:()=>{const m=[...n];m.push({type:"Primary",id:t.v4(),typesText:[],destination:"Go to Page",text:""}),s(m)},children:[t.jsxRuntimeExports.jsx("span",{children:"Add Option"}),t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",width:16,height:16})]})]})},Xe=l=>{const{isActiveButtons:n,setIsActiveButtons:s,buttons:o,setButtons:r}=l;return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:t.jsxRuntimeExports.jsxs("div",{className:V.buttonsBlock,children:[t.jsxRuntimeExports.jsxs("div",{className:V.top,children:[t.jsxRuntimeExports.jsx("h3",{className:V.title,children:"Buttons"}),t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:a=>s(a)})]}),t.jsxRuntimeExports.jsx(st,{buttons:o,setButtons:r})]})})},Qe="_wrapper_tn7gb_1",We="_subtitle_tn7gb_7",Je="_content_tn7gb_14",Ke="_range_tn7gb_21",Ze="_track_tn7gb_26",ts="_progress_tn7gb_35",es="_dots_tn7gb_45",ss="_dot_tn7gb_45",ns="_active_tn7gb_62",os="_input_tn7gb_74",is="_countBlock_tn7gb_88",cs="_count_tn7gb_88",rs="_controls_tn7gb_103",as="_button_tn7gb_108",I={wrapper:Qe,subtitle:We,content:Je,range:Ke,track:Ze,progress:ts,dots:es,dot:ss,active:ns,input:os,countBlock:is,count:cs,controls:rs,button:as},nt=l=>{const{label:n,min:s=1,max:o=4,step:r=1,count:a,setCount:e}=l,[c,x]=h.useState(!1),v=Array.from({length:(o-s)/r+1}),m=(a-s)/(o-s)*100,f=()=>{a<o&&e(a+r)},g=()=>{a>s&&e(a-r)},i=d=>{const j=s+d*r;e(j)};return t.jsxRuntimeExports.jsxs("div",{className:I.wrapper,children:[n&&t.jsxRuntimeExports.jsx("h5",{className:I.subtitle,children:n}),t.jsxRuntimeExports.jsxs("div",{className:I.content,children:[t.jsxRuntimeExports.jsxs("div",{className:I.range,children:[t.jsxRuntimeExports.jsx("div",{className:I.track}),t.jsxRuntimeExports.jsx("div",{className:I.progress,style:{width:`${m}%`}}),t.jsxRuntimeExports.jsx("div",{className:I.dots,children:v.map((d,j)=>{const N=j<=(a-s)/r;return t.jsxRuntimeExports.jsx("button",{onClick:()=>i(j),className:t.clx(I.dot,{[I.active]:N,[I.inactive]:!N,[I.dragging]:c}),"aria-label":`Set value to ${s+j*r}`},j)})}),t.jsxRuntimeExports.jsx("input",{type:"range",min:s,max:o,step:r,value:a,onChange:d=>e(Number(d.target.value)),onMouseDown:()=>x(!0),onMouseUp:()=>x(!1),onTouchStart:()=>x(!0),onTouchEnd:()=>x(!1),className:I.input})]}),t.jsxRuntimeExports.jsxs("div",{className:I.countBlock,children:[t.jsxRuntimeExports.jsx(t.Input,{type:"number",min:s,max:o,paddingless:!0,onChange:d=>{const j=Number(d);j>o?e(o):j<s?e(s):e(j)},value:String(a)}),t.jsxRuntimeExports.jsxs("div",{className:I.controls,children:[t.jsxRuntimeExports.jsx("button",{onClick:f,disabled:a>=o,className:I.button,"aria-label":"Increment count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretUp",width:15,height:15})}),t.jsxRuntimeExports.jsx("button",{onClick:g,disabled:a<=s,className:I.button,"aria-label":"Decrement count",children:t.jsxRuntimeExports.jsx(t.Icon,{name:"CaretDown",width:15,height:15})})]})]})]})]})},ls="_subtitle_1nl8x_1",us="_header_1nl8x_8",xs="_text_1nl8x_9",ds="_productsBlock_1nl8x_10",ps="_top_1nl8x_22",ms="_itemsBlock_1nl8x_29",js="_typeTexts_1nl8x_35",_s="_block_1nl8x_41",hs="_active_1nl8x_52",gs="_products_1nl8x_10",bs="_product_1nl8x_10",fs="_button_1nl8x_70",vs="_image_1nl8x_80",Rs="_info_1nl8x_87",Es="_name_1nl8x_98",ys="_buttons_1nl8x_102",ks="_modal_1nl8x_108",Is="_link_1nl8x_126",$s="_modalOptions_1nl8x_132",w={subtitle:ls,header:us,text:xs,productsBlock:ds,top:ps,itemsBlock:ms,typeTexts:js,block:_s,active:hs,products:gs,product:bs,button:fs,image:vs,info:Rs,name:Es,buttons:ys,modal:ks,link:Is,modalOptions:$s},Ns=l=>{const{activeItem:n,setActiveItem:s,popupPosition:o,setIsOpenModal:r}=l;return t.jsxRuntimeExports.jsxs("div",{className:w.modal,onClick:a=>{a.stopPropagation()},style:{top:`${o.top}px`,left:`${o.left}px`},children:[t.jsxRuntimeExports.jsxs("div",{className:w.top,children:[t.jsxRuntimeExports.jsx("h3",{children:n.name}),t.jsxRuntimeExports.jsx(t.Icon,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{r(!1),s(null)}})]}),t.jsxRuntimeExports.jsx("div",{className:w.modalOptions,children:t.jsxRuntimeExports.jsx(t.ChooseImage,{label:"Put up an attractive image",onChange:a=>{const e={...n,images:a,imagePath:a[0]};s(e)}})})]})},Cs=l=>{const{index:n,moveProduct:s,children:o}=l,[,r]=t.useDrop({accept:"product",hover(c){c.index!==n&&(s(c.index,n),c.index=n)}}),[{isDragging:a},e]=t.useDrag({type:"product",item:{index:n},collect:c=>({isDragging:c.isDragging()})});return t.jsxRuntimeExports.jsx("div",{ref:c=>e(r(c)),className:`${w.product} ${a?w.dragging:""}`,children:o})},ws=l=>{const{isActiveItems:n,setIsActiveItems:s,items:o,setItems:r,other:a,title:e,subtitle:c,editable:x=!0,draggable:v=!1,withImage:m=!1,deletable:f=!0,addable:g=!0,itemsType:i,itemsOptions:d}=l,[j,N]=h.useState(null),[B,y]=h.useState({top:0,left:0}),[z,T]=h.useState(!1),q=(p,R)=>{const P=[...o],[k]=P.splice(p,1);P.splice(R,0,k),r(P)};h.useEffect(()=>{const p=()=>{N(null),T(!1)};return document.body.addEventListener("click",p),N(null),T(!1),()=>{N(null),T(!1),document.body.removeEventListener("click",p)}},[]),h.useEffect(()=>{if(j){const p=[...o].map(R=>R.id===j.id?j:R);r(p)}},[j]);const L=(p,R)=>{p.stopPropagation();const P=p.target.getBoundingClientRect(),k=100,H=window.innerHeight;let A=P.top+window.scrollY;A+k>H&&(A=H-k-20),T(!0),y({top:A-80,left:P.left-30}),N(R)};function Q(p){if(m)return p?t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${p}/w=1000`,alt:"image",width:16,height:16}):t.jsxRuntimeExports.jsx(t.Icon,{name:"Image",width:16,height:16,fill:"#757575"})}const X=(p,R)=>{const P=t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[v&&t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsx(t.Icon,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),i==="select"&&t.jsxRuntimeExports.jsx(t.Select,{onChange:k=>{const H=[...o],A=Number(k.split(" ")[1]),u=d.find(E=>E.id===A);if(!u)return;const C={...u.productData.stats,newPrice:u.productData.minPrice.amount,oldPrice:u.productData.compareAtPrice.amount},S=H.map(E=>E.id===p.id?{...p,name:k,listingId:A,stats:C}:E);N({...p,name:k,listingId:A}),r([...S])},value:p.name,options:[...d.map(k=>`Product ${k.id}`)],leftAddon:Q(p.images[0])}),t.jsxRuntimeExports.jsxs("div",{className:w.buttons,children:[x&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:k=>L(k,p)}),f&&t.jsxRuntimeExports.jsx(t.Icon,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>r(o.filter(k=>k.id!==p.id))})]})]});return v?t.jsxRuntimeExports.jsx(Cs,{product:p,index:R,moveProduct:q,children:P},p.id):t.jsxRuntimeExports.jsx("div",{className:w.product,children:P},p.id)};return t.jsxRuntimeExports.jsxs("div",{className:w.productsBlock,children:[(e||n!==void 0)&&t.jsxRuntimeExports.jsxs("div",{className:w.top,children:[e&&t.jsxRuntimeExports.jsx("h3",{className:w.title,children:e}),n!==void 0&&t.jsxRuntimeExports.jsx(t.Switch,{current:n,onChange:p=>s==null?void 0:s(p)})]}),z&&j&&t.jsxRuntimeExports.jsx(Ns,{activeItem:j,setActiveItem:N,setIsOpenModal:T,popupPosition:B}),t.jsxRuntimeExports.jsxs("div",{className:w.products,children:[c&&t.jsxRuntimeExports.jsx("h5",{className:w.subtitle,children:c}),v?t.jsxRuntimeExports.jsx(t.DndProvider,{backend:t.HTML5Backend,children:o.map((p,R)=>X(p,R))}):o.map((p,R)=>X(p,R)),g&&t.jsxRuntimeExports.jsxs(t.Button,{className:w.button,size:"s",onClick:()=>{const p=[...o],R=d[0].id;p.push({name:`Product ${R}`,id:t.v4(),listingId:R,imagePath:"",images:[],stats:{...d[0].productData.stats,newPrice:d[0].productData.minPrice.amount,oldPrice:d[0].productData.compareAtPrice.amount}}),r(p)},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(tt,{items:a})]})},Bs="_options_163bj_1",Ps="_price_163bj_12",Ss="_oldPrice_163bj_18",Ts="_newPrice_163bj_26",As="_meta_163bj_33",Os="_info_163bj_39",Ds="_infoRight_163bj_46",qs="_buttons_163bj_52",Ls="_variants_163bj_59",Ms="_variant_163bj_59",Hs="_stock_163bj_74",Vs="_variantInfo_163bj_81",zs="_quantity_163bj_87",Fs="_count_163bj_93",Us="_button_163bj_52",Gs="_activeVariant_163bj_110",Ys="_chargeTypes_163bj_114",Xs="_charge_163bj_114",Qs="_chargeActive_163bj_131",b={options:Bs,price:Ps,oldPrice:Ss,newPrice:Ts,meta:As,info:Os,infoRight:Ds,buttons:qs,variants:Ls,variant:Ms,stock:Hs,variantInfo:Vs,quantity:zs,count:Fs,button:Us,activeVariant:Gs,chargeTypes:Ys,charge:Xs,chargeActive:Qs},Ws=l=>{const{variants:n}=l,[s,o]=h.useState(n[0]),r=t.useNavigate(),[a,e]=h.useState(1),{reset:c,addProductToCart:x,getProducts:v}=t.useCart();async function m(){await v(),await x({productId:l.id,productVariantId:s.id,quantity:a})}function f(){c(),m(),r("/checkout")}function g(i){if(i>=864e5){const y=Math.floor(i/864e5);return`${y} ${y===1?"day":"days"}`}else if(i>=36e5){const y=Math.floor(i/36e5);return`${y} ${y===1?"hour":"hours"}`}else if(i>=6e4){const y=Math.floor(i/6e4);return`${y} ${y===1?"minute":"minutes"}`}else{const y=Math.floor(i/1e3);return`${y} ${y===1?"second":"seconds"}`}}return t.jsxRuntimeExports.jsxs("div",{className:b.options,children:[t.jsxRuntimeExports.jsx("div",{className:b.chargeTypes,children:s.chargeTypes?s.chargeTypes.map(i=>t.jsxRuntimeExports.jsx("div",{children:i},i)):t.jsxRuntimeExports.jsx("div",{className:t.clx(b.charge,b.chargeActive),children:"One-Time"})}),t.jsxRuntimeExports.jsx("div",{className:b.variants,children:n.map(i=>t.jsxRuntimeExports.jsxs("div",{className:t.clx(b.variant,{[b.activeVariant]:s.id===i.id}),onClick:()=>o(i),children:[t.jsxRuntimeExports.jsxs("div",{className:b.variantInfo,children:[t.jsxRuntimeExports.jsx("span",{className:b.title,children:i.name}),t.jsxRuntimeExports.jsxs("span",{children:["$",i.price.amount]})]}),t.jsxRuntimeExports.jsx("div",{children:t.jsxRuntimeExports.jsxs("span",{className:b.stock,children:[i.quantity.restrictions.max||0," in stock"]})})]},i.id))}),t.jsxRuntimeExports.jsxs("div",{className:b.quantity,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{a>1?e(i=>i-1):e(1)},className:b.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus"})}),t.jsxRuntimeExports.jsx("div",{className:b.count,children:a}),t.jsxRuntimeExports.jsx("div",{onClick:()=>e(i=>i+1),className:b.button,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus"})})]}),t.jsxRuntimeExports.jsxs("div",{className:b.meta,children:[t.jsxRuntimeExports.jsxs("div",{className:b.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Delivery"}),t.jsxRuntimeExports.jsxs("div",{className:b.infoRight,children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Lightning",fill:"#FF3F19",width:20,height:20}),t.jsxRuntimeExports.jsx("span",{children:s.deliveryTime===0?"Instant":g(s.deliveryTime)})]})]}),t.jsxRuntimeExports.jsxs("div",{className:b.info,children:[t.jsxRuntimeExports.jsx("span",{children:"Price"}),t.jsxRuntimeExports.jsx("div",{className:b.infoRight,children:s.compareAtPrice&&(s.compareAtPrice.amount||0)-(s.price.amount||0)>0?t.jsxRuntimeExports.jsxs("div",{className:b.price,children:[t.jsxRuntimeExports.jsxs("span",{className:b.newPrice,children:["$ ",(s.price.amount||0)*a]}),t.jsxRuntimeExports.jsxs("span",{className:b.oldPrice,children:["$ ",(s.compareAtPrice.amount||0)*a]})]}):t.jsxRuntimeExports.jsxs("span",{className:b.newPrice,children:["$ ",(s.price.amount||0)*a]})})]})]}),t.jsxRuntimeExports.jsxs("div",{className:b.buttons,children:[t.jsxRuntimeExports.jsx(t.Button,{type:"Primary",onClick:()=>f(),children:"Buy Now"}),t.jsxRuntimeExports.jsx(t.Button,{type:"Secondary",onClick:()=>m(),children:"Add to Cart"})]})]})},Js="_button_1jgdy_1",Ks="_login_1jgdy_12",Zs="_signUp_1jgdy_16",tn="_buttons_1jgdy_21",en="_modal_1jgdy_28",sn="_info_1jgdy_44",nn="_top_1jgdy_50",on="_title_1jgdy_59",cn="_clear_1jgdy_65",rn="_activeClear_1jgdy_72",an="_count_1jgdy_76",ln="_cart_1jgdy_89",un="_empty_1jgdy_96",xn="_product_1jgdy_122",dn="_products_1jgdy_129",pn="_image_1jgdy_136",mn="_productInfo_1jgdy_142",jn="_content_1jgdy_148",_n="_name_1jgdy_154",hn="_price_1jgdy_160",gn="_productButtons_1jgdy_166",bn="_productButton_1jgdy_166",fn="_productCount_1jgdy_183",vn="_bottom_1jgdy_197",Rn="_subtotal_1jgdy_205",En="_block_1jgdy_211",yn="_shoppingCount_1jgdy_217",_={button:Js,login:Ks,signUp:Zs,buttons:tn,modal:en,info:sn,top:nn,title:on,clear:cn,activeClear:rn,count:an,cart:ln,empty:un,product:xn,products:dn,image:pn,productInfo:mn,content:jn,name:_n,price:hn,productButtons:gn,productButton:bn,productCount:fn,bottom:vn,subtotal:Rn,block:En,shoppingCount:yn},kn=l=>{const{shopping:n,signUp:s}=l,o=t.useNavigate();function r(a){o(a)}return t.jsxRuntimeExports.jsxs("div",{className:_.buttons,children:[n&&t.jsxRuntimeExports.jsx(ot,{}),t.jsxRuntimeExports.jsx("div",{className:t.clx(_.button,_.login),onClick:()=>r("/customer-dash"),children:"Login"}),s&&t.jsxRuntimeExports.jsx("div",{className:t.clx(_.button,_.login,_.signUp),onClick:()=>r("/customer-dash"),children:"Sign Up"})]})},ot=()=>{const[l,n]=h.useState(!1),{cart:s}=t.useCart();return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:_.button,onClick:o=>{o.stopPropagation(),n(!0)},children:[t.jsxRuntimeExports.jsx(t.Icon,{name:"Handbag",fill:"#252525"}),s.parts.length>0&&t.jsxRuntimeExports.jsx("div",{className:_.shoppingCount,children:s.parts.length})]}),l&&t.jsxRuntimeExports.jsx(t.Modal,{close:n,children:t.jsxRuntimeExports.jsx(it,{})})]})},it=()=>{const{cart:l,reset:n,getProducts:s,getTotalAndDiscount:o,updateQuantityOfProduct:r}=t.useCart(),[a,e]=h.useState([]),c=t.useNavigate();function x(i){for(let d=0;d<l.parts.length;d++)for(let j=0;j<i.variants.length;j++)if(l.parts[d].productVariantId===i.variants[d].id)return l.parts[d].productVariantId}function v(i){for(let d=0;d<l.parts.length;d++)for(let j=0;j<i.variants.length;j++)if(l.parts[d].productVariantId===i.variants[d].id)return l.parts[d].quantity}function m(i){c(i)}function f(i){r({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity+1})}function g(i){r({productId:i.id,productVariantId:i.activeVariantId,quantity:i.quantity-1})}return h.useEffect(()=>{(async()=>{const d=l.parts.map(B=>String(B.productId)),N=(await s([...d])).map(B=>({...B,activeVariantId:x(B),quantity:v(B)}));e(N)})()},[l]),t.jsxRuntimeExports.jsxs("div",{className:_.modal,onClick:i=>i.stopPropagation(),children:[t.jsxRuntimeExports.jsxs("div",{className:_.top,children:[t.jsxRuntimeExports.jsxs("div",{className:_.info,children:[t.jsxRuntimeExports.jsx("span",{className:_.title,children:"Cart"}),l.parts.length>0&&t.jsxRuntimeExports.jsx("div",{className:_.count,children:l.parts.length})]}),t.jsxRuntimeExports.jsx("button",{className:t.clx(_.clear,{[_.activeClear]:l.parts.length>0}),disabled:l.parts.length===0,onClick:()=>n(),children:"Clear all"})]}),l.parts.length>0?t.jsxRuntimeExports.jsxs("div",{className:_.cart,children:[t.jsxRuntimeExports.jsx("div",{className:_.products,children:a.map(i=>t.jsxRuntimeExports.jsxs("div",{className:_.product,children:[t.jsxRuntimeExports.jsxs("div",{className:_.productInfo,children:[t.jsxRuntimeExports.jsx("img",{src:`https://imagedelivery.net/${i.images[0].cfId}/w=500`,alt:"image",width:"100%",height:"100%",className:_.image}),t.jsxRuntimeExports.jsxs("div",{className:_.content,children:[t.jsxRuntimeExports.jsx("div",{className:_.name,children:i.name}),t.jsxRuntimeExports.jsxs("div",{className:_.price,children:["$",i.variants.find(d=>d.id===i.activeVariantId).price.amount*((i==null?void 0:i.quantity)||1)]})]})]}),t.jsxRuntimeExports.jsxs("div",{className:_.productButtons,children:[t.jsxRuntimeExports.jsx("div",{onClick:()=>{i.quantity!==1&&g(i)},className:_.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Minus",fill:"#757575",width:20,height:20})}),t.jsxRuntimeExports.jsx("div",{className:_.productCount,children:i.quantity}),t.jsxRuntimeExports.jsx("div",{onClick:()=>f(i),className:_.productButton,children:t.jsxRuntimeExports.jsx(t.Icon,{name:"Plus",fill:"#757575",width:20,height:20})})]})]},i.id))}),t.jsxRuntimeExports.jsxs("div",{className:_.bottom,children:[t.jsxRuntimeExports.jsxs("div",{className:_.subtotal,children:[t.jsxRuntimeExports.jsxs("div",{className:_.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",{children:["$",o().total]})]}),t.jsxRuntimeExports.jsx(t.Button,{onClick:()=>m("/checkout"),children:"Checkout"})]})]}):t.jsxRuntimeExports.jsx(ct,{})]})},ct=()=>t.jsxRuntimeExports.jsxs("div",{className:_.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.jsx("span",{children:"Check out the store's products and add them here"})]});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.Loader=t.Loader;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.Accordion=dt;exports.ButtonTypeSettings=st;exports.ButtonsSettings=Xe;exports.EmptyCart=ct;exports.HeaderButtons=kn;exports.ItemsSettings=et;exports.LayoutSettings=It;exports.ListingSelector=ws;exports.ProductOptions=Ws;exports.RangeSelector=nt;exports.ShoppingButton=ot;exports.ShoppingModalCart=it;exports.TextSettings=Z;exports.TypesText=K;
|
package/dist/ui.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { j as t, c as H, I as x, a as G, S as z, T as lt, C as ot, b as Y, D as rt, H as dt, B as X, v as tt, u as ut, d as _t, e as it, f as at, M as mt } from "./root-
|
|
2
|
-
import { k as Gn, l as Yn, h as Xn, L as Qn, P as Wn, R as Jn, g as Kn, i as Zn } from "./root-
|
|
1
|
+
import { j as t, c as H, I as x, a as G, S as z, T as lt, C as ot, b as Y, D as rt, H as dt, B as X, v as tt, u as ut, d as _t, e as it, f as at, M as mt } from "./root-iwDkF_8A.js";
|
|
2
|
+
import { k as Gn, l as Yn, h as Xn, L as Qn, P as Wn, R as Jn, g as Kn, i as Zn } from "./root-iwDkF_8A.js";
|
|
3
3
|
import b from "react";
|
|
4
4
|
const gt = "_accordion_2tiiw_1", xt = "_header_2tiiw_9", bt = "_icon_2tiiw_16", jt = "_open_2tiiw_19", ft = "_content_2tiiw_23", J = {
|
|
5
5
|
accordion: gt,
|