picture-designer 0.0.5 → 0.0.6
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.
|
@@ -16253,7 +16253,7 @@ function O1({ imageUrl: i, apiUrl: r, productId: s }) {
|
|
|
16253
16253
|
id: H.id,
|
|
16254
16254
|
quantity: 1
|
|
16255
16255
|
}]
|
|
16256
|
-
});
|
|
16256
|
+
}), window.location.href = "/cart";
|
|
16257
16257
|
} catch (lt) {
|
|
16258
16258
|
et("Error while cropping or adding product to cart. Contact our manager."), console.error(lt);
|
|
16259
16259
|
} finally {
|
|
@@ -96,4 +96,4 @@ License: MIT
|
|
|
96
96
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(r){return r instanceof this?r:new this(r)}static concat(r,...s){const c=new this(r);return s.forEach(o=>c.set(o)),c}static accessor(r){const c=(this[sf]=this[sf]={accessors:{}}).accessors,o=this.prototype;function d(m){const p=_a(m);c[p]||(B0(o,m),c[p]=!0)}return N.isArray(r)?r.forEach(d):d(r),this}};Te.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),N.reduceDescriptors(Te.prototype,({value:i},r)=>{let s=r[0].toUpperCase()+r.slice(1);return{get:()=>i,set(c){this[s]=c}}}),N.freezeMethods(Te);function Tr(i,r){const s=this||xa,c=r||s,o=Te.from(c.headers);let d=c.data;return N.forEach(i,function(p){d=p.call(s,d,o.normalize(),r?r.status:void 0)}),o.normalize(),d}function cf(i){return!!(i&&i.__CANCEL__)}function Ml(i,r,s){vt.call(this,i??"canceled",vt.ERR_CANCELED,r,s),this.name="CanceledError"}N.inherits(Ml,vt,{__CANCEL__:!0});function of(i,r,s){const c=s.config.validateStatus;!s.status||!c||c(s.status)?i(s):r(new vt("Request failed with status code "+s.status,[vt.ERR_BAD_REQUEST,vt.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))}function q0(i){const r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return r&&r[1]||""}function L0(i,r){i=i||10;const s=new Array(i),c=new Array(i);let o=0,d=0,m;return r=r!==void 0?r:1e3,function(S){const g=Date.now(),E=c[d];m||(m=g),s[o]=S,c[o]=g;let M=d,X=0;for(;M!==o;)X+=s[M++],M=M%i;if(o=(o+1)%i,o===d&&(d=(d+1)%i),g-m<r)return;const et=E&&g-E;return et?Math.round(X*1e3/et):void 0}}function k0(i,r){let s=0,c=1e3/r,o,d;const m=(g,E=Date.now())=>{s=E,o=null,d&&(clearTimeout(d),d=null),i(...g)};return[(...g)=>{const E=Date.now(),M=E-s;M>=c?m(g,E):(o=g,d||(d=setTimeout(()=>{d=null,m(o)},c-M)))},()=>o&&m(o)]}const Hi=(i,r,s=3)=>{let c=0;const o=L0(50,250);return k0(d=>{const m=d.loaded,p=d.lengthComputable?d.total:void 0,S=m-c,g=o(S),E=m<=p;c=m;const M={loaded:m,total:p,progress:p?m/p:void 0,bytes:S,rate:g||void 0,estimated:g&&p&&E?(p-m)/g:void 0,event:d,lengthComputable:p!=null,[r?"download":"upload"]:!0};i(M)},s)},ff=(i,r)=>{const s=i!=null;return[c=>r[0]({lengthComputable:s,total:i,loaded:c}),r[1]]},df=i=>(...r)=>N.asap(()=>i(...r)),G0=ye.hasStandardBrowserEnv?((i,r)=>s=>(s=new URL(s,ye.origin),i.protocol===s.protocol&&i.host===s.host&&(r||i.port===s.port)))(new URL(ye.origin),ye.navigator&&/(msie|trident)/i.test(ye.navigator.userAgent)):()=>!0,Y0=ye.hasStandardBrowserEnv?{write(i,r,s,c,o,d,m){if(typeof document>"u")return;const p=[`${i}=${encodeURIComponent(r)}`];N.isNumber(s)&&p.push(`expires=${new Date(s).toUTCString()}`),N.isString(c)&&p.push(`path=${c}`),N.isString(o)&&p.push(`domain=${o}`),d===!0&&p.push("secure"),N.isString(m)&&p.push(`SameSite=${m}`),document.cookie=p.join("; ")},read(i){if(typeof document>"u")return null;const r=document.cookie.match(new RegExp("(?:^|; )"+i+"=([^;]*)"));return r?decodeURIComponent(r[1]):null},remove(i){this.write(i,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function X0(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function V0(i,r){return r?i.replace(/\/?\/$/,"")+"/"+r.replace(/^\/+/,""):i}function hf(i,r,s){let c=!X0(r);return i&&(c||s==!1)?V0(i,r):r}const mf=i=>i instanceof Te?{...i}:i;function tl(i,r){r=r||{};const s={};function c(g,E,M,X){return N.isPlainObject(g)&&N.isPlainObject(E)?N.merge.call({caseless:X},g,E):N.isPlainObject(E)?N.merge({},E):N.isArray(E)?E.slice():E}function o(g,E,M,X){if(N.isUndefined(E)){if(!N.isUndefined(g))return c(void 0,g,M,X)}else return c(g,E,M,X)}function d(g,E){if(!N.isUndefined(E))return c(void 0,E)}function m(g,E){if(N.isUndefined(E)){if(!N.isUndefined(g))return c(void 0,g)}else return c(void 0,E)}function p(g,E,M){if(M in r)return c(g,E);if(M in i)return c(void 0,g)}const S={url:d,method:d,data:d,baseURL:m,transformRequest:m,transformResponse:m,paramsSerializer:m,timeout:m,timeoutMessage:m,withCredentials:m,withXSRFToken:m,adapter:m,responseType:m,xsrfCookieName:m,xsrfHeaderName:m,onUploadProgress:m,onDownloadProgress:m,decompress:m,maxContentLength:m,maxBodyLength:m,beforeRedirect:m,transport:m,httpAgent:m,httpsAgent:m,cancelToken:m,socketPath:m,responseEncoding:m,validateStatus:p,headers:(g,E,M)=>o(mf(g),mf(E),M,!0)};return N.forEach(Object.keys({...i,...r}),function(E){const M=S[E]||o,X=M(i[E],r[E],E);N.isUndefined(X)&&M!==p||(s[E]=X)}),s}const gf=i=>{const r=tl({},i);let{data:s,withXSRFToken:c,xsrfHeaderName:o,xsrfCookieName:d,headers:m,auth:p}=r;if(r.headers=m=Te.from(m),r.url=lf(hf(r.baseURL,r.url,r.allowAbsoluteUrls),i.params,i.paramsSerializer),p&&m.set("Authorization","Basic "+btoa((p.username||"")+":"+(p.password?unescape(encodeURIComponent(p.password)):""))),N.isFormData(s)){if(ye.hasStandardBrowserEnv||ye.hasStandardBrowserWebWorkerEnv)m.setContentType(void 0);else if(N.isFunction(s.getHeaders)){const S=s.getHeaders(),g=["content-type","content-length"];Object.entries(S).forEach(([E,M])=>{g.includes(E.toLowerCase())&&m.set(E,M)})}}if(ye.hasStandardBrowserEnv&&(c&&N.isFunction(c)&&(c=c(r)),c||c!==!1&&G0(r.url))){const S=o&&d&&Y0.read(d);S&&m.set(o,S)}return r},Q0=typeof XMLHttpRequest<"u"&&function(i){return new Promise(function(s,c){const o=gf(i);let d=o.data;const m=Te.from(o.headers).normalize();let{responseType:p,onUploadProgress:S,onDownloadProgress:g}=o,E,M,X,et,j;function Q(){et&&et(),j&&j(),o.cancelToken&&o.cancelToken.unsubscribe(E),o.signal&&o.signal.removeEventListener("abort",E)}let Y=new XMLHttpRequest;Y.open(o.method.toUpperCase(),o.url,!0),Y.timeout=o.timeout;function ht(){if(!Y)return;const gt=Te.from("getAllResponseHeaders"in Y&&Y.getAllResponseHeaders()),zt={data:!p||p==="text"||p==="json"?Y.responseText:Y.response,status:Y.status,statusText:Y.statusText,headers:gt,config:i,request:Y};of(function(it){s(it),Q()},function(it){c(it),Q()},zt),Y=null}"onloadend"in Y?Y.onloadend=ht:Y.onreadystatechange=function(){!Y||Y.readyState!==4||Y.status===0&&!(Y.responseURL&&Y.responseURL.indexOf("file:")===0)||setTimeout(ht)},Y.onabort=function(){Y&&(c(new vt("Request aborted",vt.ECONNABORTED,i,Y)),Y=null)},Y.onerror=function(bt){const zt=bt&&bt.message?bt.message:"Network Error",I=new vt(zt,vt.ERR_NETWORK,i,Y);I.event=bt||null,c(I),Y=null},Y.ontimeout=function(){let bt=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const zt=o.transitional||uf;o.timeoutErrorMessage&&(bt=o.timeoutErrorMessage),c(new vt(bt,zt.clarifyTimeoutError?vt.ETIMEDOUT:vt.ECONNABORTED,i,Y)),Y=null},d===void 0&&m.setContentType(null),"setRequestHeader"in Y&&N.forEach(m.toJSON(),function(bt,zt){Y.setRequestHeader(zt,bt)}),N.isUndefined(o.withCredentials)||(Y.withCredentials=!!o.withCredentials),p&&p!=="json"&&(Y.responseType=o.responseType),g&&([X,j]=Hi(g,!0),Y.addEventListener("progress",X)),S&&Y.upload&&([M,et]=Hi(S),Y.upload.addEventListener("progress",M),Y.upload.addEventListener("loadend",et)),(o.cancelToken||o.signal)&&(E=gt=>{Y&&(c(!gt||gt.type?new Ml(null,i,Y):gt),Y.abort(),Y=null)},o.cancelToken&&o.cancelToken.subscribe(E),o.signal&&(o.signal.aborted?E():o.signal.addEventListener("abort",E)));const P=q0(o.url);if(P&&ye.protocols.indexOf(P)===-1){c(new vt("Unsupported protocol "+P+":",vt.ERR_BAD_REQUEST,i));return}Y.send(d||null)})},Z0=(i,r)=>{const{length:s}=i=i?i.filter(Boolean):[];if(r||s){let c=new AbortController,o;const d=function(g){if(!o){o=!0,p();const E=g instanceof Error?g:this.reason;c.abort(E instanceof vt?E:new Ml(E instanceof Error?E.message:E))}};let m=r&&setTimeout(()=>{m=null,d(new vt(`timeout ${r} of ms exceeded`,vt.ETIMEDOUT))},r);const p=()=>{i&&(m&&clearTimeout(m),m=null,i.forEach(g=>{g.unsubscribe?g.unsubscribe(d):g.removeEventListener("abort",d)}),i=null)};i.forEach(g=>g.addEventListener("abort",d));const{signal:S}=c;return S.unsubscribe=()=>N.asap(p),S}},K0=function*(i,r){let s=i.byteLength;if(s<r){yield i;return}let c=0,o;for(;c<s;)o=c+r,yield i.slice(c,o),c=o},J0=async function*(i,r){for await(const s of $0(i))yield*K0(s,r)},$0=async function*(i){if(i[Symbol.asyncIterator]){yield*i;return}const r=i.getReader();try{for(;;){const{done:s,value:c}=await r.read();if(s)break;yield c}}finally{await r.cancel()}},yf=(i,r,s,c)=>{const o=J0(i,r);let d=0,m,p=S=>{m||(m=!0,c&&c(S))};return new ReadableStream({async pull(S){try{const{done:g,value:E}=await o.next();if(g){p(),S.close();return}let M=E.byteLength;if(s){let X=d+=M;s(X)}S.enqueue(new Uint8Array(E))}catch(g){throw p(g),g}},cancel(S){return p(S),o.return()}},{highWaterMark:2})},pf=64*1024,{isFunction:ji}=N,F0=(({Request:i,Response:r})=>({Request:i,Response:r}))(N.global),{ReadableStream:bf,TextEncoder:vf}=N.global,Sf=(i,...r)=>{try{return!!i(...r)}catch{return!1}},W0=i=>{i=N.merge.call({skipUndefined:!0},F0,i);const{fetch:r,Request:s,Response:c}=i,o=r?ji(r):typeof fetch=="function",d=ji(s),m=ji(c);if(!o)return!1;const p=o&&ji(bf),S=o&&(typeof vf=="function"?(j=>Q=>j.encode(Q))(new vf):async j=>new Uint8Array(await new s(j).arrayBuffer())),g=d&&p&&Sf(()=>{let j=!1;const Q=new s(ye.origin,{body:new bf,method:"POST",get duplex(){return j=!0,"half"}}).headers.has("Content-Type");return j&&!Q}),E=m&&p&&Sf(()=>N.isReadableStream(new c("").body)),M={stream:E&&(j=>j.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(j=>{!M[j]&&(M[j]=(Q,Y)=>{let ht=Q&&Q[j];if(ht)return ht.call(Q);throw new vt(`Response type '${j}' is not supported`,vt.ERR_NOT_SUPPORT,Y)})});const X=async j=>{if(j==null)return 0;if(N.isBlob(j))return j.size;if(N.isSpecCompliantForm(j))return(await new s(ye.origin,{method:"POST",body:j}).arrayBuffer()).byteLength;if(N.isArrayBufferView(j)||N.isArrayBuffer(j))return j.byteLength;if(N.isURLSearchParams(j)&&(j=j+""),N.isString(j))return(await S(j)).byteLength},et=async(j,Q)=>{const Y=N.toFiniteNumber(j.getContentLength());return Y??X(Q)};return async j=>{let{url:Q,method:Y,data:ht,signal:P,cancelToken:gt,timeout:bt,onDownloadProgress:zt,onUploadProgress:I,responseType:it,headers:v,withCredentials:_="same-origin",fetchOptions:q}=gf(j),J=r||fetch;it=it?(it+"").toLowerCase():"text";let Z=Z0([P,gt&>.toAbortSignal()],bt),nt=null;const Et=Z&&Z.unsubscribe&&(()=>{Z.unsubscribe()});let lt;try{if(I&&g&&Y!=="get"&&Y!=="head"&&(lt=await et(v,ht))!==0){let y=new s(Q,{method:"POST",body:ht,duplex:"half"}),w;if(N.isFormData(ht)&&(w=y.headers.get("content-type"))&&v.setContentType(w),y.body){const[U,L]=ff(lt,Hi(df(I)));ht=yf(y.body,pf,U,L)}}N.isString(_)||(_=_?"include":"omit");const H=d&&"credentials"in s.prototype,C={...q,signal:Z,method:Y.toUpperCase(),headers:v.normalize().toJSON(),body:ht,duplex:"half",credentials:H?_:void 0};nt=d&&new s(Q,C);let O=await(d?J(nt,q):J(Q,C));const V=E&&(it==="stream"||it==="response");if(E&&(zt||V&&Et)){const y={};["status","statusText","headers"].forEach(K=>{y[K]=O[K]});const w=N.toFiniteNumber(O.headers.get("content-length")),[U,L]=zt&&ff(w,Hi(df(zt),!0))||[];O=new c(yf(O.body,pf,U,()=>{L&&L(),Et&&Et()}),y)}it=it||"text";let ot=await M[N.findKey(M,it)||"text"](O,j);return!V&&Et&&Et(),await new Promise((y,w)=>{of(y,w,{data:ot,headers:Te.from(O.headers),status:O.status,statusText:O.statusText,config:j,request:nt})})}catch(H){throw Et&&Et(),H&&H.name==="TypeError"&&/Load failed|fetch/i.test(H.message)?Object.assign(new vt("Network Error",vt.ERR_NETWORK,j,nt),{cause:H.cause||H}):vt.from(H,H&&H.code,j,nt)}}},P0=new Map,Ef=i=>{let r=i&&i.env||{};const{fetch:s,Request:c,Response:o}=r,d=[c,o,s];let m=d.length,p=m,S,g,E=P0;for(;p--;)S=d[p],g=E.get(S),g===void 0&&E.set(S,g=p?new Map:W0(r)),E=g;return g};Ef();const Rr={http:S0,xhr:Q0,fetch:{get:Ef}};N.forEach(Rr,(i,r)=>{if(i){try{Object.defineProperty(i,"name",{value:r})}catch{}Object.defineProperty(i,"adapterName",{value:r})}});const xf=i=>`- ${i}`,I0=i=>N.isFunction(i)||i===null||i===!1;function tb(i,r){i=N.isArray(i)?i:[i];const{length:s}=i;let c,o;const d={};for(let m=0;m<s;m++){c=i[m];let p;if(o=c,!I0(c)&&(o=Rr[(p=String(c)).toLowerCase()],o===void 0))throw new vt(`Unknown adapter '${p}'`);if(o&&(N.isFunction(o)||(o=o.get(r))))break;d[p||"#"+m]=o}if(!o){const m=Object.entries(d).map(([S,g])=>`adapter ${S} `+(g===!1?"is not supported by the environment":"is not available in the build"));let p=s?m.length>1?`since :
|
|
97
97
|
`+m.map(xf).join(`
|
|
98
98
|
`):" "+xf(m[0]):"as no adapter specified";throw new vt("There is no suitable adapter to dispatch the request "+p,"ERR_NOT_SUPPORT")}return o}const _f={getAdapter:tb,adapters:Rr};function Ar(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new Ml(null,i)}function Tf(i){return Ar(i),i.headers=Te.from(i.headers),i.data=Tr.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),_f.getAdapter(i.adapter||xa.adapter,i)(i).then(function(c){return Ar(i),c.data=Tr.call(i,i.transformResponse,c),c.headers=Te.from(c.headers),c},function(c){return cf(c)||(Ar(i),c&&c.response&&(c.response.data=Tr.call(i,i.transformResponse,c.response),c.response.headers=Te.from(c.response.headers))),Promise.reject(c)})}const Rf="1.13.2",Bi={};["object","boolean","number","function","string","symbol"].forEach((i,r)=>{Bi[i]=function(c){return typeof c===i||"a"+(r<1?"n ":" ")+i}});const Af={};Bi.transitional=function(r,s,c){function o(d,m){return"[Axios v"+Rf+"] Transitional option '"+d+"'"+m+(c?". "+c:"")}return(d,m,p)=>{if(r===!1)throw new vt(o(m," has been removed"+(s?" in "+s:"")),vt.ERR_DEPRECATED);return s&&!Af[m]&&(Af[m]=!0,console.warn(o(m," has been deprecated since v"+s+" and will be removed in the near future"))),r?r(d,m,p):!0}},Bi.spelling=function(r){return(s,c)=>(console.warn(`${c} is likely a misspelling of ${r}`),!0)};function eb(i,r,s){if(typeof i!="object")throw new vt("options must be an object",vt.ERR_BAD_OPTION_VALUE);const c=Object.keys(i);let o=c.length;for(;o-- >0;){const d=c[o],m=r[d];if(m){const p=i[d],S=p===void 0||m(p,d,i);if(S!==!0)throw new vt("option "+d+" must be "+S,vt.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new vt("Unknown option "+d,vt.ERR_BAD_OPTION)}}const qi={assertOptions:eb,validators:Bi},nn=qi.validators;let el=class{constructor(r){this.defaults=r||{},this.interceptors={request:new af,response:new af}}async request(r,s){try{return await this._request(r,s)}catch(c){if(c instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const d=o.stack?o.stack.replace(/^.+\n/,""):"";try{c.stack?d&&!String(c.stack).endsWith(d.replace(/^.+\n.+\n/,""))&&(c.stack+=`
|
|
99
|
-
`+d):c.stack=d}catch{}}throw c}}_request(r,s){typeof r=="string"?(s=s||{},s.url=r):s=r||{},s=tl(this.defaults,s);const{transitional:c,paramsSerializer:o,headers:d}=s;c!==void 0&&qi.assertOptions(c,{silentJSONParsing:nn.transitional(nn.boolean),forcedJSONParsing:nn.transitional(nn.boolean),clarifyTimeoutError:nn.transitional(nn.boolean)},!1),o!=null&&(N.isFunction(o)?s.paramsSerializer={serialize:o}:qi.assertOptions(o,{encode:nn.function,serialize:nn.function},!0)),s.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?s.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:s.allowAbsoluteUrls=!0),qi.assertOptions(s,{baseUrl:nn.spelling("baseURL"),withXsrfToken:nn.spelling("withXSRFToken")},!0),s.method=(s.method||this.defaults.method||"get").toLowerCase();let m=d&&N.merge(d.common,d[s.method]);d&&N.forEach(["delete","get","head","post","put","patch","common"],j=>{delete d[j]}),s.headers=Te.concat(m,d);const p=[];let S=!0;this.interceptors.request.forEach(function(Q){typeof Q.runWhen=="function"&&Q.runWhen(s)===!1||(S=S&&Q.synchronous,p.unshift(Q.fulfilled,Q.rejected))});const g=[];this.interceptors.response.forEach(function(Q){g.push(Q.fulfilled,Q.rejected)});let E,M=0,X;if(!S){const j=[Tf.bind(this),void 0];for(j.unshift(...p),j.push(...g),X=j.length,E=Promise.resolve(s);M<X;)E=E.then(j[M++],j[M++]);return E}X=p.length;let et=s;for(;M<X;){const j=p[M++],Q=p[M++];try{et=j(et)}catch(Y){Q.call(this,Y);break}}try{E=Tf.call(this,et)}catch(j){return Promise.reject(j)}for(M=0,X=g.length;M<X;)E=E.then(g[M++],g[M++]);return E}getUri(r){r=tl(this.defaults,r);const s=hf(r.baseURL,r.url,r.allowAbsoluteUrls);return lf(s,r.params,r.paramsSerializer)}};N.forEach(["delete","get","head","options"],function(r){el.prototype[r]=function(s,c){return this.request(tl(c||{},{method:r,url:s,data:(c||{}).data}))}}),N.forEach(["post","put","patch"],function(r){function s(c){return function(d,m,p){return this.request(tl(p||{},{method:r,headers:c?{"Content-Type":"multipart/form-data"}:{},url:d,data:m}))}}el.prototype[r]=s(),el.prototype[r+"Form"]=s(!0)});let nb=class pg{constructor(r){if(typeof r!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(d){s=d});const c=this;this.promise.then(o=>{if(!c._listeners)return;let d=c._listeners.length;for(;d-- >0;)c._listeners[d](o);c._listeners=null}),this.promise.then=o=>{let d;const m=new Promise(p=>{c.subscribe(p),d=p}).then(o);return m.cancel=function(){c.unsubscribe(d)},m},r(function(d,m,p){c.reason||(c.reason=new Ml(d,m,p),s(c.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(r){if(this.reason){r(this.reason);return}this._listeners?this._listeners.push(r):this._listeners=[r]}unsubscribe(r){if(!this._listeners)return;const s=this._listeners.indexOf(r);s!==-1&&this._listeners.splice(s,1)}toAbortSignal(){const r=new AbortController,s=c=>{r.abort(c)};return this.subscribe(s),r.signal.unsubscribe=()=>this.unsubscribe(s),r.signal}static source(){let r;return{token:new pg(function(o){r=o}),cancel:r}}};function lb(i){return function(s){return i.apply(null,s)}}function ab(i){return N.isObject(i)&&i.isAxiosError===!0}const wr={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(wr).forEach(([i,r])=>{wr[r]=i});function wf(i){const r=new el(i),s=Go(el.prototype.request,r);return N.extend(s,el.prototype,r,{allOwnKeys:!0}),N.extend(s,r,null,{allOwnKeys:!0}),s.create=function(o){return wf(tl(i,o))},s}const $t=wf(xa);$t.Axios=el,$t.CanceledError=Ml,$t.CancelToken=nb,$t.isCancel=cf,$t.VERSION=Rf,$t.toFormData=Ui,$t.AxiosError=vt,$t.Cancel=$t.CanceledError,$t.all=function(r){return Promise.all(r)},$t.spread=lb,$t.isAxiosError=ab,$t.mergeConfig=tl,$t.AxiosHeaders=Te,$t.formToJSON=i=>rf(N.isHTMLForm(i)?new FormData(i):i),$t.getAdapter=_f.getAdapter,$t.HttpStatusCode=wr,$t.default=$t;const{Axios:C1,AxiosError:U1,CanceledError:N1,isCancel:H1,CancelToken:j1,VERSION:B1,all:q1,Cancel:L1,isAxiosError:k1,spread:G1,toFormData:Y1,AxiosHeaders:X1,HttpStatusCode:V1,formToJSON:Q1,getAdapter:Z1,mergeConfig:K1}=$t;function ib({className:i,...r}){return rt.jsx(qy,{role:"status","aria-label":"Loading",className:vo("size-4 animate-spin",i),...r})}function ub({imageUrl:i,apiUrl:r,productId:s}){const c=Rt.useRef(null),o=Rt.useRef(null),[d,m]=Rt.useState(),p=Rt.useRef(null),[S,g]=Rt.useState(),[E,M]=Rt.useState(!1),[X,et]=Rt.useState(),[j,Q]=Rt.useState(1),[Y,ht]=Rt.useState({width:1500,height:1054}),[P,gt]=Rt.useState({x:100,y:100,width:300,height:300}),[bt,zt]=Rt.useState(!1),[I,it]=Rt.useState({x:0,y:0}),[v,_]=Rt.useState(null),q=async lt=>await Hp(lt,{cacheBust:!0,pixelRatio:1,skipFonts:!1}),J=async()=>{if(M(!0),p.current)try{const lt=await q(p.current),{data:H}=await $t.post(r,{productId:s,image:lt});await $t.post("/cart/add.json",{items:[{id:H.id,quantity:1}]})}catch(lt){et("Error while cropping or adding product to cart. Contact our manager."),console.error(lt)}finally{M(!1)}},Z=async()=>{if(o.current){const lt=await q(o.current);m(lt)}if(p.current){const lt=await q(p.current);g(lt)}};Rt.useEffect(()=>{const lt=setTimeout(()=>{Z()},100);return()=>{clearTimeout(lt)}},[P]),Rt.useEffect(()=>{const lt=new Image;lt.src=i,lt.onload=()=>{const H=window.innerHeight-100,C=Math.min(window.innerWidth/lt.width,H/lt.height);ht({width:lt.width*C,height:lt.height*C})}},[]);const nt=lt=>{Q(lt);const H=P.width/lt;if(H<=Y.height)gt({...P,height:H});else{const C=Y.height*lt;gt({...P,width:C,height:Y.height})}},Et=(lt,H)=>{H?_(H):(zt(!0),it({x:lt.clientX-(c.current?.getBoundingClientRect().left||0)-P.x,y:lt.clientY-(c.current?.getBoundingClientRect().top||0)-P.y}))};return Rt.useEffect(()=>{const lt=C=>{if(!c.current)return;const O=c.current.getBoundingClientRect(),V=C.clientX-O.left,ot=C.clientY-O.top;if(bt){const y=Math.max(0,Math.min(V-I.x,Y.width-P.width)),w=Math.max(0,Math.min(ot-I.y,Y.height-P.height));gt(U=>({...U,x:y,y:w}))}else if(v){let y=P.width,w=P.height,U=P.x,L=P.y;v.includes("e")&&(y=Math.max(50,Math.min(V-P.x,Y.width-P.x))),v.includes("w")&&(y=Math.max(50,P.width+P.x-V),U=Math.min(V,P.x+P.width-50)),v.includes("s")&&(w=Math.max(50,Math.min(ot-P.y,Y.height-P.y))),v.includes("n")&&(w=Math.max(50,P.height+P.y-ot),L=Math.min(ot,P.y+P.height-50)),(v.includes("e")||v.includes("w"))&&(w=y/j,w>Y.height-L&&(w=Y.height-L,y=w*j)),gt({x:U,y:L,width:y,height:w})}},H=()=>{zt(!1),_(null)};if(bt||v)return document.addEventListener("mousemove",lt),document.addEventListener("mouseup",H),()=>{document.removeEventListener("mousemove",lt),document.removeEventListener("mouseup",H)}},[bt,v,I,P,Y]),rt.jsxs("div",{className:" inset-0 bg-black flex flex-col overflow-hidden",children:[rt.jsx(ky,{}),rt.jsx("div",{className:"flex-1 overflow-hidden flex items-center justify-center",children:rt.jsxs("div",{ref:c,className:"relative cursor-move",style:{width:`${Y.width}px`,height:`${Y.height}px`},children:[rt.jsx("img",{src:i,alt:"Painting to crop",className:"absolute inset-0 w-full h-full object-cover select-none",draggable:!1,ref:o}),rt.jsx(Ay,{cropArea:P,imageSize:Y,onMouseDown:Et})]})}),rt.jsx("div",{className:"bg-white/95 backdrop-blur border-t border-slate-200 px-6 py-4",children:rt.jsxs("div",{className:"max-w-full flex items-center gap-6",children:[rt.jsx("div",{className:"flex-1",children:rt.jsx(Oy,{selectedRatio:j,onRatioChange:nt})}),rt.jsxs("div",{className:"space-y-4",children:[rt.jsxs("div",{className:"flex items-center gap-4",children:[rt.jsx("div",{className:"text-sm",children:rt.jsxs("p",{className:"text-slate-600",children:["Crop size: ",Math.round(P.width)," × ",Math.round(P.height)]})}),rt.jsxs(dr,{disabled:E,onClick:()=>J(),className:"bg-red-600 hover:bg-red-700 text-white font-semibold px-6 py-2 rounded-lg",children:[E&&rt.jsx(ib,{}),"Apply Crop"]}),rt.jsx(Gy,{onExpand:rt.jsx("img",{src:S,className:"w-full max-h-[800px] object-contain"}),children:rt.jsx(dr,{disabled:E,variant:"outline",className:"px-6 py-2 rounded-lg border-2 border-slate-300 bg-transparent",children:"Preview"})})]}),X&&rt.jsx("p",{className:"text text-red-600",children:X})]})]})}),rt.jsxs("div",{className:"bg-white rounded-lg p-6",children:[rt.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-4",children:"Preview"}),rt.jsx("img",{src:d,ref:p,style:{width:`${P.width}px`,height:`${P.height}px`,objectFit:"none",objectPosition:`-${P.x}px -${P.y}px`}})]})]})}function rb(i){return rt.jsx(ub,{...i})}function sb(i,r){const s=typeof i=="string"?document.querySelector(i):i;zg.createRoot(s).render(rt.jsx(rb,{...r}))}return Wu.mountConstructorWidget=sb,Object.defineProperty(Wu,Symbol.toStringTag,{value:"Module"}),Wu}({});
|
|
99
|
+
`+d):c.stack=d}catch{}}throw c}}_request(r,s){typeof r=="string"?(s=s||{},s.url=r):s=r||{},s=tl(this.defaults,s);const{transitional:c,paramsSerializer:o,headers:d}=s;c!==void 0&&qi.assertOptions(c,{silentJSONParsing:nn.transitional(nn.boolean),forcedJSONParsing:nn.transitional(nn.boolean),clarifyTimeoutError:nn.transitional(nn.boolean)},!1),o!=null&&(N.isFunction(o)?s.paramsSerializer={serialize:o}:qi.assertOptions(o,{encode:nn.function,serialize:nn.function},!0)),s.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?s.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:s.allowAbsoluteUrls=!0),qi.assertOptions(s,{baseUrl:nn.spelling("baseURL"),withXsrfToken:nn.spelling("withXSRFToken")},!0),s.method=(s.method||this.defaults.method||"get").toLowerCase();let m=d&&N.merge(d.common,d[s.method]);d&&N.forEach(["delete","get","head","post","put","patch","common"],j=>{delete d[j]}),s.headers=Te.concat(m,d);const p=[];let S=!0;this.interceptors.request.forEach(function(Q){typeof Q.runWhen=="function"&&Q.runWhen(s)===!1||(S=S&&Q.synchronous,p.unshift(Q.fulfilled,Q.rejected))});const g=[];this.interceptors.response.forEach(function(Q){g.push(Q.fulfilled,Q.rejected)});let E,M=0,X;if(!S){const j=[Tf.bind(this),void 0];for(j.unshift(...p),j.push(...g),X=j.length,E=Promise.resolve(s);M<X;)E=E.then(j[M++],j[M++]);return E}X=p.length;let et=s;for(;M<X;){const j=p[M++],Q=p[M++];try{et=j(et)}catch(Y){Q.call(this,Y);break}}try{E=Tf.call(this,et)}catch(j){return Promise.reject(j)}for(M=0,X=g.length;M<X;)E=E.then(g[M++],g[M++]);return E}getUri(r){r=tl(this.defaults,r);const s=hf(r.baseURL,r.url,r.allowAbsoluteUrls);return lf(s,r.params,r.paramsSerializer)}};N.forEach(["delete","get","head","options"],function(r){el.prototype[r]=function(s,c){return this.request(tl(c||{},{method:r,url:s,data:(c||{}).data}))}}),N.forEach(["post","put","patch"],function(r){function s(c){return function(d,m,p){return this.request(tl(p||{},{method:r,headers:c?{"Content-Type":"multipart/form-data"}:{},url:d,data:m}))}}el.prototype[r]=s(),el.prototype[r+"Form"]=s(!0)});let nb=class pg{constructor(r){if(typeof r!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(d){s=d});const c=this;this.promise.then(o=>{if(!c._listeners)return;let d=c._listeners.length;for(;d-- >0;)c._listeners[d](o);c._listeners=null}),this.promise.then=o=>{let d;const m=new Promise(p=>{c.subscribe(p),d=p}).then(o);return m.cancel=function(){c.unsubscribe(d)},m},r(function(d,m,p){c.reason||(c.reason=new Ml(d,m,p),s(c.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(r){if(this.reason){r(this.reason);return}this._listeners?this._listeners.push(r):this._listeners=[r]}unsubscribe(r){if(!this._listeners)return;const s=this._listeners.indexOf(r);s!==-1&&this._listeners.splice(s,1)}toAbortSignal(){const r=new AbortController,s=c=>{r.abort(c)};return this.subscribe(s),r.signal.unsubscribe=()=>this.unsubscribe(s),r.signal}static source(){let r;return{token:new pg(function(o){r=o}),cancel:r}}};function lb(i){return function(s){return i.apply(null,s)}}function ab(i){return N.isObject(i)&&i.isAxiosError===!0}const wr={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(wr).forEach(([i,r])=>{wr[r]=i});function wf(i){const r=new el(i),s=Go(el.prototype.request,r);return N.extend(s,el.prototype,r,{allOwnKeys:!0}),N.extend(s,r,null,{allOwnKeys:!0}),s.create=function(o){return wf(tl(i,o))},s}const $t=wf(xa);$t.Axios=el,$t.CanceledError=Ml,$t.CancelToken=nb,$t.isCancel=cf,$t.VERSION=Rf,$t.toFormData=Ui,$t.AxiosError=vt,$t.Cancel=$t.CanceledError,$t.all=function(r){return Promise.all(r)},$t.spread=lb,$t.isAxiosError=ab,$t.mergeConfig=tl,$t.AxiosHeaders=Te,$t.formToJSON=i=>rf(N.isHTMLForm(i)?new FormData(i):i),$t.getAdapter=_f.getAdapter,$t.HttpStatusCode=wr,$t.default=$t;const{Axios:C1,AxiosError:U1,CanceledError:N1,isCancel:H1,CancelToken:j1,VERSION:B1,all:q1,Cancel:L1,isAxiosError:k1,spread:G1,toFormData:Y1,AxiosHeaders:X1,HttpStatusCode:V1,formToJSON:Q1,getAdapter:Z1,mergeConfig:K1}=$t;function ib({className:i,...r}){return rt.jsx(qy,{role:"status","aria-label":"Loading",className:vo("size-4 animate-spin",i),...r})}function ub({imageUrl:i,apiUrl:r,productId:s}){const c=Rt.useRef(null),o=Rt.useRef(null),[d,m]=Rt.useState(),p=Rt.useRef(null),[S,g]=Rt.useState(),[E,M]=Rt.useState(!1),[X,et]=Rt.useState(),[j,Q]=Rt.useState(1),[Y,ht]=Rt.useState({width:1500,height:1054}),[P,gt]=Rt.useState({x:100,y:100,width:300,height:300}),[bt,zt]=Rt.useState(!1),[I,it]=Rt.useState({x:0,y:0}),[v,_]=Rt.useState(null),q=async lt=>await Hp(lt,{cacheBust:!0,pixelRatio:1,skipFonts:!1}),J=async()=>{if(M(!0),p.current)try{const lt=await q(p.current),{data:H}=await $t.post(r,{productId:s,image:lt});await $t.post("/cart/add.json",{items:[{id:H.id,quantity:1}]}),window.location.href="/cart"}catch(lt){et("Error while cropping or adding product to cart. Contact our manager."),console.error(lt)}finally{M(!1)}},Z=async()=>{if(o.current){const lt=await q(o.current);m(lt)}if(p.current){const lt=await q(p.current);g(lt)}};Rt.useEffect(()=>{const lt=setTimeout(()=>{Z()},100);return()=>{clearTimeout(lt)}},[P]),Rt.useEffect(()=>{const lt=new Image;lt.src=i,lt.onload=()=>{const H=window.innerHeight-100,C=Math.min(window.innerWidth/lt.width,H/lt.height);ht({width:lt.width*C,height:lt.height*C})}},[]);const nt=lt=>{Q(lt);const H=P.width/lt;if(H<=Y.height)gt({...P,height:H});else{const C=Y.height*lt;gt({...P,width:C,height:Y.height})}},Et=(lt,H)=>{H?_(H):(zt(!0),it({x:lt.clientX-(c.current?.getBoundingClientRect().left||0)-P.x,y:lt.clientY-(c.current?.getBoundingClientRect().top||0)-P.y}))};return Rt.useEffect(()=>{const lt=C=>{if(!c.current)return;const O=c.current.getBoundingClientRect(),V=C.clientX-O.left,ot=C.clientY-O.top;if(bt){const y=Math.max(0,Math.min(V-I.x,Y.width-P.width)),w=Math.max(0,Math.min(ot-I.y,Y.height-P.height));gt(U=>({...U,x:y,y:w}))}else if(v){let y=P.width,w=P.height,U=P.x,L=P.y;v.includes("e")&&(y=Math.max(50,Math.min(V-P.x,Y.width-P.x))),v.includes("w")&&(y=Math.max(50,P.width+P.x-V),U=Math.min(V,P.x+P.width-50)),v.includes("s")&&(w=Math.max(50,Math.min(ot-P.y,Y.height-P.y))),v.includes("n")&&(w=Math.max(50,P.height+P.y-ot),L=Math.min(ot,P.y+P.height-50)),(v.includes("e")||v.includes("w"))&&(w=y/j,w>Y.height-L&&(w=Y.height-L,y=w*j)),gt({x:U,y:L,width:y,height:w})}},H=()=>{zt(!1),_(null)};if(bt||v)return document.addEventListener("mousemove",lt),document.addEventListener("mouseup",H),()=>{document.removeEventListener("mousemove",lt),document.removeEventListener("mouseup",H)}},[bt,v,I,P,Y]),rt.jsxs("div",{className:" inset-0 bg-black flex flex-col overflow-hidden",children:[rt.jsx(ky,{}),rt.jsx("div",{className:"flex-1 overflow-hidden flex items-center justify-center",children:rt.jsxs("div",{ref:c,className:"relative cursor-move",style:{width:`${Y.width}px`,height:`${Y.height}px`},children:[rt.jsx("img",{src:i,alt:"Painting to crop",className:"absolute inset-0 w-full h-full object-cover select-none",draggable:!1,ref:o}),rt.jsx(Ay,{cropArea:P,imageSize:Y,onMouseDown:Et})]})}),rt.jsx("div",{className:"bg-white/95 backdrop-blur border-t border-slate-200 px-6 py-4",children:rt.jsxs("div",{className:"max-w-full flex items-center gap-6",children:[rt.jsx("div",{className:"flex-1",children:rt.jsx(Oy,{selectedRatio:j,onRatioChange:nt})}),rt.jsxs("div",{className:"space-y-4",children:[rt.jsxs("div",{className:"flex items-center gap-4",children:[rt.jsx("div",{className:"text-sm",children:rt.jsxs("p",{className:"text-slate-600",children:["Crop size: ",Math.round(P.width)," × ",Math.round(P.height)]})}),rt.jsxs(dr,{disabled:E,onClick:()=>J(),className:"bg-red-600 hover:bg-red-700 text-white font-semibold px-6 py-2 rounded-lg",children:[E&&rt.jsx(ib,{}),"Apply Crop"]}),rt.jsx(Gy,{onExpand:rt.jsx("img",{src:S,className:"w-full max-h-[800px] object-contain"}),children:rt.jsx(dr,{disabled:E,variant:"outline",className:"px-6 py-2 rounded-lg border-2 border-slate-300 bg-transparent",children:"Preview"})})]}),X&&rt.jsx("p",{className:"text text-red-600",children:X})]})]})}),rt.jsxs("div",{className:"bg-white rounded-lg p-6",children:[rt.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-4",children:"Preview"}),rt.jsx("img",{src:d,ref:p,style:{width:`${P.width}px`,height:`${P.height}px`,objectFit:"none",objectPosition:`-${P.x}px -${P.y}px`}})]})]})}function rb(i){return rt.jsx(ub,{...i})}function sb(i,r){const s=typeof i=="string"?document.querySelector(i):i;zg.createRoot(s).render(rt.jsx(rb,{...r}))}return Wu.mountConstructorWidget=sb,Object.defineProperty(Wu,Symbol.toStringTag,{value:"Module"}),Wu}({});
|