picture-designer 0.1.13 → 0.1.14
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.
|
@@ -20684,7 +20684,11 @@ function L_({ apiUrl: l, productId: a, imageUrl: r }) {
|
|
|
20684
20684
|
try {
|
|
20685
20685
|
const Z = await q(j.current), { data: G } = await Fe.post(l, {
|
|
20686
20686
|
productId: a,
|
|
20687
|
-
image: Z
|
|
20687
|
+
image: Z,
|
|
20688
|
+
width: o,
|
|
20689
|
+
height: f,
|
|
20690
|
+
mUnit: m,
|
|
20691
|
+
material: S
|
|
20688
20692
|
});
|
|
20689
20693
|
await Fe.post("/cart/add.json", {
|
|
20690
20694
|
items: [{
|
|
@@ -56,4 +56,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${a.do
|
|
|
56
56
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(a){return a instanceof this?a:new this(a)}static concat(a,...r){const o=new this(a);return r.forEach(c=>o.set(c)),o}static accessor(a){const o=(this[kp]=this[kp]={accessors:{}}).accessors,c=this.prototype;function f(d){const m=hi(d);o[m]||(OA(c,d),o[m]=!0)}return B.isArray(a)?a.forEach(f):f(a),this}};bt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),B.reduceDescriptors(bt.prototype,({value:l},a)=>{let r=a[0].toUpperCase()+a.slice(1);return{get:()=>l,set(o){this[r]=o}}}),B.freezeMethods(bt);function Nu(l,a){const r=this||mi,o=a||r,c=bt.from(o.headers);let f=o.data;return B.forEach(l,function(m){f=m.call(r,f,c.normalize(),a?a.status:void 0)}),c.normalize(),f}function qp(l){return!!(l&&l.__CANCEL__)}function ha(l,a,r){be.call(this,l??"canceled",be.ERR_CANCELED,a,r),this.name="CanceledError"}B.inherits(ha,be,{__CANCEL__:!0});function Vp(l,a,r){const o=r.config.validateStatus;!r.status||!o||o(r.status)?l(r):a(new be("Request failed with status code "+r.status,[be.ERR_BAD_REQUEST,be.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function _A(l){const a=/^([-+\w]{1,25})(:?\/\/|:)/.exec(l);return a&&a[1]||""}function NA(l,a){l=l||10;const r=new Array(l),o=new Array(l);let c=0,f=0,d;return a=a!==void 0?a:1e3,function(g){const p=Date.now(),y=o[f];d||(d=p),r[c]=g,o[c]=p;let S=f,E=0;for(;S!==c;)E+=r[S++],S=S%l;if(c=(c+1)%l,c===f&&(f=(f+1)%l),p-d<a)return;const O=y&&p-y;return O?Math.round(E*1e3/O):void 0}}function MA(l,a){let r=0,o=1e3/a,c,f;const d=(p,y=Date.now())=>{r=y,c=null,f&&(clearTimeout(f),f=null),l(...p)};return[(...p)=>{const y=Date.now(),S=y-r;S>=o?d(p,y):(c=p,f||(f=setTimeout(()=>{f=null,d(c)},o-S)))},()=>c&&d(c)]}const Jr=(l,a,r=3)=>{let o=0;const c=NA(50,250);return MA(f=>{const d=f.loaded,m=f.lengthComputable?f.total:void 0,g=d-o,p=c(g),y=d<=m;o=d;const S={loaded:d,total:m,progress:m?d/m:void 0,bytes:g,rate:p||void 0,estimated:p&&m&&y?(m-d)/p:void 0,event:f,lengthComputable:m!=null,[a?"download":"upload"]:!0};l(S)},r)},Yp=(l,a)=>{const r=l!=null;return[o=>a[0]({lengthComputable:r,total:l,loaded:o}),a[1]]},Gp=l=>(...a)=>B.asap(()=>l(...a)),DA=ht.hasStandardBrowserEnv?((l,a)=>r=>(r=new URL(r,ht.origin),l.protocol===r.protocol&&l.host===r.host&&(a||l.port===r.port)))(new URL(ht.origin),ht.navigator&&/(msie|trident)/i.test(ht.navigator.userAgent)):()=>!0,zA=ht.hasStandardBrowserEnv?{write(l,a,r,o,c,f,d){if(typeof document>"u")return;const m=[`${l}=${encodeURIComponent(a)}`];B.isNumber(r)&&m.push(`expires=${new Date(r).toUTCString()}`),B.isString(o)&&m.push(`path=${o}`),B.isString(c)&&m.push(`domain=${c}`),f===!0&&m.push("secure"),B.isString(d)&&m.push(`SameSite=${d}`),document.cookie=m.join("; ")},read(l){if(typeof document>"u")return null;const a=document.cookie.match(new RegExp("(?:^|; )"+l+"=([^;]*)"));return a?decodeURIComponent(a[1]):null},remove(l){this.write(l,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function jA(l){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(l)}function UA(l,a){return a?l.replace(/\/?\/$/,"")+"/"+a.replace(/^\/+/,""):l}function Xp(l,a,r){let o=!jA(a);return l&&(o||r==!1)?UA(l,a):a}const Qp=l=>l instanceof bt?{...l}:l;function Al(l,a){a=a||{};const r={};function o(p,y,S,E){return B.isPlainObject(p)&&B.isPlainObject(y)?B.merge.call({caseless:E},p,y):B.isPlainObject(y)?B.merge({},y):B.isArray(y)?y.slice():y}function c(p,y,S,E){if(B.isUndefined(y)){if(!B.isUndefined(p))return o(void 0,p,S,E)}else return o(p,y,S,E)}function f(p,y){if(!B.isUndefined(y))return o(void 0,y)}function d(p,y){if(B.isUndefined(y)){if(!B.isUndefined(p))return o(void 0,p)}else return o(void 0,y)}function m(p,y,S){if(S in a)return o(p,y);if(S in l)return o(void 0,p)}const g={url:f,method:f,data:f,baseURL:d,transformRequest:d,transformResponse:d,paramsSerializer:d,timeout:d,timeoutMessage:d,withCredentials:d,withXSRFToken:d,adapter:d,responseType:d,xsrfCookieName:d,xsrfHeaderName:d,onUploadProgress:d,onDownloadProgress:d,decompress:d,maxContentLength:d,maxBodyLength:d,beforeRedirect:d,transport:d,httpAgent:d,httpsAgent:d,cancelToken:d,socketPath:d,responseEncoding:d,validateStatus:m,headers:(p,y,S)=>c(Qp(p),Qp(y),S,!0)};return B.forEach(Object.keys({...l,...a}),function(y){const S=g[y]||c,E=S(l[y],a[y],y);B.isUndefined(E)&&S!==m||(r[y]=E)}),r}const Zp=l=>{const a=Al({},l);let{data:r,withXSRFToken:o,xsrfHeaderName:c,xsrfCookieName:f,headers:d,auth:m}=a;if(a.headers=d=bt.from(d),a.url=Up(Xp(a.baseURL,a.url,a.allowAbsoluteUrls),l.params,l.paramsSerializer),m&&d.set("Authorization","Basic "+btoa((m.username||"")+":"+(m.password?unescape(encodeURIComponent(m.password)):""))),B.isFormData(r)){if(ht.hasStandardBrowserEnv||ht.hasStandardBrowserWebWorkerEnv)d.setContentType(void 0);else if(B.isFunction(r.getHeaders)){const g=r.getHeaders(),p=["content-type","content-length"];Object.entries(g).forEach(([y,S])=>{p.includes(y.toLowerCase())&&d.set(y,S)})}}if(ht.hasStandardBrowserEnv&&(o&&B.isFunction(o)&&(o=o(a)),o||o!==!1&&DA(a.url))){const g=c&&f&&zA.read(f);g&&d.set(c,g)}return a},LA=typeof XMLHttpRequest<"u"&&function(l){return new Promise(function(r,o){const c=Zp(l);let f=c.data;const d=bt.from(c.headers).normalize();let{responseType:m,onUploadProgress:g,onDownloadProgress:p}=c,y,S,E,O,T;function x(){O&&O(),T&&T(),c.cancelToken&&c.cancelToken.unsubscribe(y),c.signal&&c.signal.removeEventListener("abort",y)}let C=new XMLHttpRequest;C.open(c.method.toUpperCase(),c.url,!0),C.timeout=c.timeout;function D(){if(!C)return;const j=bt.from("getAllResponseHeaders"in C&&C.getAllResponseHeaders()),P={data:!m||m==="text"||m==="json"?C.responseText:C.response,status:C.status,statusText:C.statusText,headers:j,config:l,request:C};Vp(function(Z){r(Z),x()},function(Z){o(Z),x()},P),C=null}"onloadend"in C?C.onloadend=D:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(D)},C.onabort=function(){C&&(o(new be("Request aborted",be.ECONNABORTED,l,C)),C=null)},C.onerror=function(q){const P=q&&q.message?q.message:"Network Error",W=new be(P,be.ERR_NETWORK,l,C);W.event=q||null,o(W),C=null},C.ontimeout=function(){let q=c.timeout?"timeout of "+c.timeout+"ms exceeded":"timeout exceeded";const P=c.transitional||Hp;c.timeoutErrorMessage&&(q=c.timeoutErrorMessage),o(new be(q,P.clarifyTimeoutError?be.ETIMEDOUT:be.ECONNABORTED,l,C)),C=null},f===void 0&&d.setContentType(null),"setRequestHeader"in C&&B.forEach(d.toJSON(),function(q,P){C.setRequestHeader(P,q)}),B.isUndefined(c.withCredentials)||(C.withCredentials=!!c.withCredentials),m&&m!=="json"&&(C.responseType=c.responseType),p&&([E,T]=Jr(p,!0),C.addEventListener("progress",E)),g&&C.upload&&([S,O]=Jr(g),C.upload.addEventListener("progress",S),C.upload.addEventListener("loadend",O)),(c.cancelToken||c.signal)&&(y=j=>{C&&(o(!j||j.type?new ha(null,l,C):j),C.abort(),C=null)},c.cancelToken&&c.cancelToken.subscribe(y),c.signal&&(c.signal.aborted?y():c.signal.addEventListener("abort",y)));const z=_A(c.url);if(z&&ht.protocols.indexOf(z)===-1){o(new be("Unsupported protocol "+z+":",be.ERR_BAD_REQUEST,l));return}C.send(f||null)})},HA=(l,a)=>{const{length:r}=l=l?l.filter(Boolean):[];if(a||r){let o=new AbortController,c;const f=function(p){if(!c){c=!0,m();const y=p instanceof Error?p:this.reason;o.abort(y instanceof be?y:new ha(y instanceof Error?y.message:y))}};let d=a&&setTimeout(()=>{d=null,f(new be(`timeout ${a} of ms exceeded`,be.ETIMEDOUT))},a);const m=()=>{l&&(d&&clearTimeout(d),d=null,l.forEach(p=>{p.unsubscribe?p.unsubscribe(f):p.removeEventListener("abort",f)}),l=null)};l.forEach(p=>p.addEventListener("abort",f));const{signal:g}=o;return g.unsubscribe=()=>B.asap(m),g}},BA=function*(l,a){let r=l.byteLength;if(r<a){yield l;return}let o=0,c;for(;o<r;)c=o+a,yield l.slice(o,c),o=c},kA=async function*(l,a){for await(const r of qA(l))yield*BA(r,a)},qA=async function*(l){if(l[Symbol.asyncIterator]){yield*l;return}const a=l.getReader();try{for(;;){const{done:r,value:o}=await a.read();if(r)break;yield o}}finally{await a.cancel()}},Kp=(l,a,r,o)=>{const c=kA(l,a);let f=0,d,m=g=>{d||(d=!0,o&&o(g))};return new ReadableStream({async pull(g){try{const{done:p,value:y}=await c.next();if(p){m(),g.close();return}let S=y.byteLength;if(r){let E=f+=S;r(E)}g.enqueue(new Uint8Array(y))}catch(p){throw m(p),p}},cancel(g){return m(g),c.return()}},{highWaterMark:2})},Pp=64*1024,{isFunction:Wr}=B,VA=(({Request:l,Response:a})=>({Request:l,Response:a}))(B.global),{ReadableStream:$p,TextEncoder:Fp}=B.global,Jp=(l,...a)=>{try{return!!l(...a)}catch{return!1}},YA=l=>{l=B.merge.call({skipUndefined:!0},VA,l);const{fetch:a,Request:r,Response:o}=l,c=a?Wr(a):typeof fetch=="function",f=Wr(r),d=Wr(o);if(!c)return!1;const m=c&&Wr($p),g=c&&(typeof Fp=="function"?(T=>x=>T.encode(x))(new Fp):async T=>new Uint8Array(await new r(T).arrayBuffer())),p=f&&m&&Jp(()=>{let T=!1;const x=new r(ht.origin,{body:new $p,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!x}),y=d&&m&&Jp(()=>B.isReadableStream(new o("").body)),S={stream:y&&(T=>T.body)};c&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!S[T]&&(S[T]=(x,C)=>{let D=x&&x[T];if(D)return D.call(x);throw new be(`Response type '${T}' is not supported`,be.ERR_NOT_SUPPORT,C)})});const E=async T=>{if(T==null)return 0;if(B.isBlob(T))return T.size;if(B.isSpecCompliantForm(T))return(await new r(ht.origin,{method:"POST",body:T}).arrayBuffer()).byteLength;if(B.isArrayBufferView(T)||B.isArrayBuffer(T))return T.byteLength;if(B.isURLSearchParams(T)&&(T=T+""),B.isString(T))return(await g(T)).byteLength},O=async(T,x)=>{const C=B.toFiniteNumber(T.getContentLength());return C??E(x)};return async T=>{let{url:x,method:C,data:D,signal:z,cancelToken:j,timeout:q,onDownloadProgress:P,onUploadProgress:W,responseType:Z,headers:G,withCredentials:le="same-origin",fetchOptions:ce}=Zp(T),pe=a||fetch;Z=Z?(Z+"").toLowerCase():"text";let ue=HA([z,j&&j.toAbortSignal()],q),me=null;const de=ue&&ue.unsubscribe&&(()=>{ue.unsubscribe()});let ge;try{if(W&&p&&C!=="get"&&C!=="head"&&(ge=await O(G,D))!==0){let Ne=new r(x,{method:"POST",body:D,duplex:"half"}),R;if(B.isFormData(D)&&(R=Ne.headers.get("content-type"))&&G.setContentType(R),Ne.body){const[V,F]=Yp(ge,Jr(Gp(W)));D=Kp(Ne.body,Pp,V,F)}}B.isString(le)||(le=le?"include":"omit");const X=f&&"credentials"in r.prototype,Y={...ce,signal:ue,method:C.toUpperCase(),headers:G.normalize().toJSON(),body:D,duplex:"half",credentials:X?le:void 0};me=f&&new r(x,Y);let M=await(f?pe(me,ce):pe(x,Y));const ae=y&&(Z==="stream"||Z==="response");if(y&&(P||ae&&de)){const Ne={};["status","statusText","headers"].forEach(I=>{Ne[I]=M[I]});const R=B.toFiniteNumber(M.headers.get("content-length")),[V,F]=P&&Yp(R,Jr(Gp(P),!0))||[];M=new o(Kp(M.body,Pp,V,()=>{F&&F(),de&&de()}),Ne)}Z=Z||"text";let ye=await S[B.findKey(S,Z)||"text"](M,T);return!ae&&de&&de(),await new Promise((Ne,R)=>{Vp(Ne,R,{data:ye,headers:bt.from(M.headers),status:M.status,statusText:M.statusText,config:T,request:me})})}catch(X){throw de&&de(),X&&X.name==="TypeError"&&/Load failed|fetch/i.test(X.message)?Object.assign(new be("Network Error",be.ERR_NETWORK,T,me),{cause:X.cause||X}):be.from(X,X&&X.code,T,me)}}},GA=new Map,Wp=l=>{let a=l&&l.env||{};const{fetch:r,Request:o,Response:c}=a,f=[o,c,r];let d=f.length,m=d,g,p,y=GA;for(;m--;)g=f[m],p=y.get(g),p===void 0&&y.set(g,p=m?new Map:YA(a)),y=p;return p};Wp();const Mu={http:fA,xhr:LA,fetch:{get:Wp}};B.forEach(Mu,(l,a)=>{if(l){try{Object.defineProperty(l,"name",{value:a})}catch{}Object.defineProperty(l,"adapterName",{value:a})}});const Ip=l=>`- ${l}`,XA=l=>B.isFunction(l)||l===null||l===!1;function QA(l,a){l=B.isArray(l)?l:[l];const{length:r}=l;let o,c;const f={};for(let d=0;d<r;d++){o=l[d];let m;if(c=o,!XA(o)&&(c=Mu[(m=String(o)).toLowerCase()],c===void 0))throw new be(`Unknown adapter '${m}'`);if(c&&(B.isFunction(c)||(c=c.get(a))))break;f[m||"#"+d]=c}if(!c){const d=Object.entries(f).map(([g,p])=>`adapter ${g} `+(p===!1?"is not supported by the environment":"is not available in the build"));let m=r?d.length>1?`since :
|
|
57
57
|
`+d.map(Ip).join(`
|
|
58
58
|
`):" "+Ip(d[0]):"as no adapter specified";throw new be("There is no suitable adapter to dispatch the request "+m,"ERR_NOT_SUPPORT")}return c}const eg={getAdapter:QA,adapters:Mu};function Du(l){if(l.cancelToken&&l.cancelToken.throwIfRequested(),l.signal&&l.signal.aborted)throw new ha(null,l)}function tg(l){return Du(l),l.headers=bt.from(l.headers),l.data=Nu.call(l,l.transformRequest),["post","put","patch"].indexOf(l.method)!==-1&&l.headers.setContentType("application/x-www-form-urlencoded",!1),eg.getAdapter(l.adapter||mi.adapter,l)(l).then(function(o){return Du(l),o.data=Nu.call(l,l.transformResponse,o),o.headers=bt.from(o.headers),o},function(o){return qp(o)||(Du(l),o&&o.response&&(o.response.data=Nu.call(l,l.transformResponse,o.response),o.response.headers=bt.from(o.response.headers))),Promise.reject(o)})}const ng="1.13.2",Ir={};["object","boolean","number","function","string","symbol"].forEach((l,a)=>{Ir[l]=function(o){return typeof o===l||"a"+(a<1?"n ":" ")+l}});const lg={};Ir.transitional=function(a,r,o){function c(f,d){return"[Axios v"+ng+"] Transitional option '"+f+"'"+d+(o?". "+o:"")}return(f,d,m)=>{if(a===!1)throw new be(c(d," has been removed"+(r?" in "+r:"")),be.ERR_DEPRECATED);return r&&!lg[d]&&(lg[d]=!0,console.warn(c(d," has been deprecated since v"+r+" and will be removed in the near future"))),a?a(f,d,m):!0}},Ir.spelling=function(a){return(r,o)=>(console.warn(`${o} is likely a misspelling of ${a}`),!0)};function ZA(l,a,r){if(typeof l!="object")throw new be("options must be an object",be.ERR_BAD_OPTION_VALUE);const o=Object.keys(l);let c=o.length;for(;c-- >0;){const f=o[c],d=a[f];if(d){const m=l[f],g=m===void 0||d(m,f,l);if(g!==!0)throw new be("option "+f+" must be "+g,be.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new be("Unknown option "+f,be.ERR_BAD_OPTION)}}const eo={assertOptions:ZA,validators:Ir},dn=eo.validators;let Rl=class{constructor(a){this.defaults=a||{},this.interceptors={request:new Lp,response:new Lp}}async request(a,r){try{return await this._request(a,r)}catch(o){if(o instanceof Error){let c={};Error.captureStackTrace?Error.captureStackTrace(c):c=new Error;const f=c.stack?c.stack.replace(/^.+\n/,""):"";try{o.stack?f&&!String(o.stack).endsWith(f.replace(/^.+\n.+\n/,""))&&(o.stack+=`
|
|
59
|
-
`+f):o.stack=f}catch{}}throw o}}_request(a,r){typeof a=="string"?(r=r||{},r.url=a):r=a||{},r=Al(this.defaults,r);const{transitional:o,paramsSerializer:c,headers:f}=r;o!==void 0&&eo.assertOptions(o,{silentJSONParsing:dn.transitional(dn.boolean),forcedJSONParsing:dn.transitional(dn.boolean),clarifyTimeoutError:dn.transitional(dn.boolean)},!1),c!=null&&(B.isFunction(c)?r.paramsSerializer={serialize:c}:eo.assertOptions(c,{encode:dn.function,serialize:dn.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),eo.assertOptions(r,{baseUrl:dn.spelling("baseURL"),withXsrfToken:dn.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let d=f&&B.merge(f.common,f[r.method]);f&&B.forEach(["delete","get","head","post","put","patch","common"],T=>{delete f[T]}),r.headers=bt.concat(d,f);const m=[];let g=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(r)===!1||(g=g&&x.synchronous,m.unshift(x.fulfilled,x.rejected))});const p=[];this.interceptors.response.forEach(function(x){p.push(x.fulfilled,x.rejected)});let y,S=0,E;if(!g){const T=[tg.bind(this),void 0];for(T.unshift(...m),T.push(...p),E=T.length,y=Promise.resolve(r);S<E;)y=y.then(T[S++],T[S++]);return y}E=m.length;let O=r;for(;S<E;){const T=m[S++],x=m[S++];try{O=T(O)}catch(C){x.call(this,C);break}}try{y=tg.call(this,O)}catch(T){return Promise.reject(T)}for(S=0,E=p.length;S<E;)y=y.then(p[S++],p[S++]);return y}getUri(a){a=Al(this.defaults,a);const r=Xp(a.baseURL,a.url,a.allowAbsoluteUrls);return Up(r,a.params,a.paramsSerializer)}};B.forEach(["delete","get","head","options"],function(a){Rl.prototype[a]=function(r,o){return this.request(Al(o||{},{method:a,url:r,data:(o||{}).data}))}}),B.forEach(["post","put","patch"],function(a){function r(o){return function(f,d,m){return this.request(Al(m||{},{method:a,headers:o?{"Content-Type":"multipart/form-data"}:{},url:f,data:d}))}}Rl.prototype[a]=r(),Rl.prototype[a+"Form"]=r(!0)});let KA=class i0{constructor(a){if(typeof a!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(f){r=f});const o=this;this.promise.then(c=>{if(!o._listeners)return;let f=o._listeners.length;for(;f-- >0;)o._listeners[f](c);o._listeners=null}),this.promise.then=c=>{let f;const d=new Promise(m=>{o.subscribe(m),f=m}).then(c);return d.cancel=function(){o.unsubscribe(f)},d},a(function(f,d,m){o.reason||(o.reason=new ha(f,d,m),r(o.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(a){if(this.reason){a(this.reason);return}this._listeners?this._listeners.push(a):this._listeners=[a]}unsubscribe(a){if(!this._listeners)return;const r=this._listeners.indexOf(a);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const a=new AbortController,r=o=>{a.abort(o)};return this.subscribe(r),a.signal.unsubscribe=()=>this.unsubscribe(r),a.signal}static source(){let a;return{token:new i0(function(c){a=c}),cancel:a}}};function PA(l){return function(r){return l.apply(null,r)}}function $A(l){return B.isObject(l)&&l.isAxiosError===!0}const zu={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(zu).forEach(([l,a])=>{zu[a]=l});function ag(l){const a=new Rl(l),r=bp(Rl.prototype.request,a);return B.extend(r,Rl.prototype,a,{allOwnKeys:!0}),B.extend(r,a,null,{allOwnKeys:!0}),r.create=function(c){return ag(Al(l,c))},r}const Ke=ag(mi);Ke.Axios=Rl,Ke.CanceledError=ha,Ke.CancelToken=KA,Ke.isCancel=qp,Ke.VERSION=ng,Ke.toFormData=$r,Ke.AxiosError=be,Ke.Cancel=Ke.CanceledError,Ke.all=function(a){return Promise.all(a)},Ke.spread=PA,Ke.isAxiosError=$A,Ke.mergeConfig=Al,Ke.AxiosHeaders=bt,Ke.formToJSON=l=>Bp(B.isHTMLForm(l)?new FormData(l):l),Ke.getAdapter=eg.getAdapter,Ke.HttpStatusCode=zu,Ke.default=Ke;const{Axios:q_,AxiosError:V_,CanceledError:Y_,isCancel:G_,CancelToken:X_,VERSION:Q_,all:Z_,Cancel:K_,isAxiosError:P_,spread:$_,toFormData:F_,AxiosHeaders:J_,HttpStatusCode:W_,formToJSON:I_,getAdapter:eN,mergeConfig:tN}=Ke;function FA({className:l,...a}){return w.jsx(d1,{role:"status","aria-label":"Loading",className:We("size-4 animate-spin",l),...a})}const to=2.54;function JA({apiUrl:l,productId:a,imageUrl:r}){const[o,c]=v.useState(),[f,d]=v.useState(),[m,g]=v.useState("inch"),[p,y]=v.useState(),[S,E]=v.useState("Peel and stick"),[O,T]=v.useState(!1),[x,C]=v.useState(!1),[D,z]=v.useState(!1),j=v.useRef(null),q=async Z=>await AC(Z,{cacheBust:!0,pixelRatio:1,skipFonts:!1}),P=async()=>{if(j.current){C(!0),z(!0),await mS(100);try{const Z=await q(j.current),{data:G}=await Ke.post(l,{productId:a,image:Z});await Ke.post("/cart/add.json",{items:[{id:G.id,quantity:1,properties:{Width:`${o}"`,Height:`${f}"`,Mirror:`${O}`}}]}),window.location.href="/cart"}catch(Z){window.alert("Error while cropping or adding product to cart. Contact our manager."),console.error("Error while cropping or adding product to cart. Contact our manager."),console.error(Z)}finally{C(!1),z(!1)}}},W=w.jsxs(jc,{onClick:P,disabled:x,children:[x&&w.jsx(FA,{})," Add to cart"]});return v.useEffect(()=>{if(o&&f){const Z=OT(m,o,f,S);y(Z)}},[o,f,S]),w.jsx(w.Fragment,{children:w.jsx(MT,{actionButton:W,heightValue:f,widthValue:o,onHeightChange:d,onWidthChange:c,onMirrorChange:T,mirror:O,setMUnit:Z=>{Z==="cm"&&m==="inch"?(d(G=>fr((G??50)*to,2)),c(G=>fr((G??50)*to,2))):Z==="inch"&&m==="cm"&&(d(G=>fr((G??50)/to,2)),c(G=>fr((G??50)/to,2))),g(Z)},mUnit:m,setMaterial:E,material:S,price:p,children:w.jsxs("div",{className:"flex justify-center",children:[w.jsx("img",{className:"object-cover max-h-[70vh] border-2 border-dashed border-black",src:r,ref:j,style:{aspectRatio:`${o??"50"} / ${f??"50"}`,pointerEvents:"none",display:D?"block":"none"}}),w.jsx(DT,{mirror:O,width:o,height:f,imageUrl:r,generatingImg:D,mUnit:m})]})})})}function WA(l,a){const r=typeof l=="string"?document.querySelector(l):l;g0.createRoot(r).render(w.jsx(JA,{...a}))}return Sc.mountConstructorWidget=WA,Object.defineProperty(Sc,Symbol.toStringTag,{value:"Module"}),Sc})({});
|
|
59
|
+
`+f):o.stack=f}catch{}}throw o}}_request(a,r){typeof a=="string"?(r=r||{},r.url=a):r=a||{},r=Al(this.defaults,r);const{transitional:o,paramsSerializer:c,headers:f}=r;o!==void 0&&eo.assertOptions(o,{silentJSONParsing:dn.transitional(dn.boolean),forcedJSONParsing:dn.transitional(dn.boolean),clarifyTimeoutError:dn.transitional(dn.boolean)},!1),c!=null&&(B.isFunction(c)?r.paramsSerializer={serialize:c}:eo.assertOptions(c,{encode:dn.function,serialize:dn.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),eo.assertOptions(r,{baseUrl:dn.spelling("baseURL"),withXsrfToken:dn.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let d=f&&B.merge(f.common,f[r.method]);f&&B.forEach(["delete","get","head","post","put","patch","common"],T=>{delete f[T]}),r.headers=bt.concat(d,f);const m=[];let g=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(r)===!1||(g=g&&x.synchronous,m.unshift(x.fulfilled,x.rejected))});const p=[];this.interceptors.response.forEach(function(x){p.push(x.fulfilled,x.rejected)});let y,S=0,E;if(!g){const T=[tg.bind(this),void 0];for(T.unshift(...m),T.push(...p),E=T.length,y=Promise.resolve(r);S<E;)y=y.then(T[S++],T[S++]);return y}E=m.length;let O=r;for(;S<E;){const T=m[S++],x=m[S++];try{O=T(O)}catch(C){x.call(this,C);break}}try{y=tg.call(this,O)}catch(T){return Promise.reject(T)}for(S=0,E=p.length;S<E;)y=y.then(p[S++],p[S++]);return y}getUri(a){a=Al(this.defaults,a);const r=Xp(a.baseURL,a.url,a.allowAbsoluteUrls);return Up(r,a.params,a.paramsSerializer)}};B.forEach(["delete","get","head","options"],function(a){Rl.prototype[a]=function(r,o){return this.request(Al(o||{},{method:a,url:r,data:(o||{}).data}))}}),B.forEach(["post","put","patch"],function(a){function r(o){return function(f,d,m){return this.request(Al(m||{},{method:a,headers:o?{"Content-Type":"multipart/form-data"}:{},url:f,data:d}))}}Rl.prototype[a]=r(),Rl.prototype[a+"Form"]=r(!0)});let KA=class i0{constructor(a){if(typeof a!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(f){r=f});const o=this;this.promise.then(c=>{if(!o._listeners)return;let f=o._listeners.length;for(;f-- >0;)o._listeners[f](c);o._listeners=null}),this.promise.then=c=>{let f;const d=new Promise(m=>{o.subscribe(m),f=m}).then(c);return d.cancel=function(){o.unsubscribe(f)},d},a(function(f,d,m){o.reason||(o.reason=new ha(f,d,m),r(o.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(a){if(this.reason){a(this.reason);return}this._listeners?this._listeners.push(a):this._listeners=[a]}unsubscribe(a){if(!this._listeners)return;const r=this._listeners.indexOf(a);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const a=new AbortController,r=o=>{a.abort(o)};return this.subscribe(r),a.signal.unsubscribe=()=>this.unsubscribe(r),a.signal}static source(){let a;return{token:new i0(function(c){a=c}),cancel:a}}};function PA(l){return function(r){return l.apply(null,r)}}function $A(l){return B.isObject(l)&&l.isAxiosError===!0}const zu={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(zu).forEach(([l,a])=>{zu[a]=l});function ag(l){const a=new Rl(l),r=bp(Rl.prototype.request,a);return B.extend(r,Rl.prototype,a,{allOwnKeys:!0}),B.extend(r,a,null,{allOwnKeys:!0}),r.create=function(c){return ag(Al(l,c))},r}const Ke=ag(mi);Ke.Axios=Rl,Ke.CanceledError=ha,Ke.CancelToken=KA,Ke.isCancel=qp,Ke.VERSION=ng,Ke.toFormData=$r,Ke.AxiosError=be,Ke.Cancel=Ke.CanceledError,Ke.all=function(a){return Promise.all(a)},Ke.spread=PA,Ke.isAxiosError=$A,Ke.mergeConfig=Al,Ke.AxiosHeaders=bt,Ke.formToJSON=l=>Bp(B.isHTMLForm(l)?new FormData(l):l),Ke.getAdapter=eg.getAdapter,Ke.HttpStatusCode=zu,Ke.default=Ke;const{Axios:q_,AxiosError:V_,CanceledError:Y_,isCancel:G_,CancelToken:X_,VERSION:Q_,all:Z_,Cancel:K_,isAxiosError:P_,spread:$_,toFormData:F_,AxiosHeaders:J_,HttpStatusCode:W_,formToJSON:I_,getAdapter:eN,mergeConfig:tN}=Ke;function FA({className:l,...a}){return w.jsx(d1,{role:"status","aria-label":"Loading",className:We("size-4 animate-spin",l),...a})}const to=2.54;function JA({apiUrl:l,productId:a,imageUrl:r}){const[o,c]=v.useState(),[f,d]=v.useState(),[m,g]=v.useState("inch"),[p,y]=v.useState(),[S,E]=v.useState("Peel and stick"),[O,T]=v.useState(!1),[x,C]=v.useState(!1),[D,z]=v.useState(!1),j=v.useRef(null),q=async Z=>await AC(Z,{cacheBust:!0,pixelRatio:1,skipFonts:!1}),P=async()=>{if(j.current){C(!0),z(!0),await mS(100);try{const Z=await q(j.current),{data:G}=await Ke.post(l,{productId:a,image:Z,width:o,height:f,mUnit:m,material:S});await Ke.post("/cart/add.json",{items:[{id:G.id,quantity:1,properties:{Width:`${o}"`,Height:`${f}"`,Mirror:`${O}`}}]}),window.location.href="/cart"}catch(Z){window.alert("Error while cropping or adding product to cart. Contact our manager."),console.error("Error while cropping or adding product to cart. Contact our manager."),console.error(Z)}finally{C(!1),z(!1)}}},W=w.jsxs(jc,{onClick:P,disabled:x,children:[x&&w.jsx(FA,{})," Add to cart"]});return v.useEffect(()=>{if(o&&f){const Z=OT(m,o,f,S);y(Z)}},[o,f,S]),w.jsx(w.Fragment,{children:w.jsx(MT,{actionButton:W,heightValue:f,widthValue:o,onHeightChange:d,onWidthChange:c,onMirrorChange:T,mirror:O,setMUnit:Z=>{Z==="cm"&&m==="inch"?(d(G=>fr((G??50)*to,2)),c(G=>fr((G??50)*to,2))):Z==="inch"&&m==="cm"&&(d(G=>fr((G??50)/to,2)),c(G=>fr((G??50)/to,2))),g(Z)},mUnit:m,setMaterial:E,material:S,price:p,children:w.jsxs("div",{className:"flex justify-center",children:[w.jsx("img",{className:"object-cover max-h-[70vh] border-2 border-dashed border-black",src:r,ref:j,style:{aspectRatio:`${o??"50"} / ${f??"50"}`,pointerEvents:"none",display:D?"block":"none"}}),w.jsx(DT,{mirror:O,width:o,height:f,imageUrl:r,generatingImg:D,mUnit:m})]})})})}function WA(l,a){const r=typeof l=="string"?document.querySelector(l):l;g0.createRoot(r).render(w.jsx(JA,{...a}))}return Sc.mountConstructorWidget=WA,Object.defineProperty(Sc,Symbol.toStringTag,{value:"Module"}),Sc})({});
|