@rechargeapps/storefront-client 1.82.0 → 1.83.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/auth.js +1 -1
- package/dist/cjs/api/bundleData.js +1 -1
- package/dist/cjs/utils/bundleData.js +3 -1
- package/dist/cjs/utils/bundleData.js.map +1 -1
- package/dist/cjs/utils/request.js +1 -1
- package/dist/esm/api/auth.js +1 -1
- package/dist/esm/api/bundleData.js +1 -1
- package/dist/esm/utils/bundleData.js +3 -1
- package/dist/esm/utils/bundleData.js.map +1 -1
- package/dist/esm/utils/request.js +1 -1
- package/dist/index.d.ts +47 -2
- package/dist/umd/recharge-client.min.js +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// recharge-client-1.
|
|
1
|
+
// recharge-client-1.83.0.min.js | MIT License | © Recharge Inc.
|
|
2
2
|
(function(D,we){typeof exports=="object"&&typeof module<"u"?module.exports=we():typeof define=="function"&&define.amd?define(we):(D=typeof globalThis<"u"?globalThis:D||self,D.recharge=we())})(this,function(){"use strict";var D=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function we(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Kf(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var L=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof L<"u"&&L,G={searchParams:"URLSearchParams"in L,iterable:"Symbol"in L&&"iterator"in Symbol,blob:"FileReader"in L&&"Blob"in L&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in L,arrayBuffer:"ArrayBuffer"in L};function Zf(r){return r&&DataView.prototype.isPrototypeOf(r)}if(G.arrayBuffer)var Jf=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Qf=ArrayBuffer.isView||function(r){return r&&Jf.indexOf(Object.prototype.toString.call(r))>-1};function pr(r){if(typeof r!="string"&&(r=String(r)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(r)||r==="")throw new TypeError('Invalid character in header field name: "'+r+'"');return r.toLowerCase()}function gn(r){return typeof r!="string"&&(r=String(r)),r}function _n(r){var e={next:function(){var t=r.shift();return{done:t===void 0,value:t}}};return G.iterable&&(e[Symbol.iterator]=function(){return e}),e}function C(r){this.map={},r instanceof C?r.forEach(function(e,t){this.append(t,e)},this):Array.isArray(r)?r.forEach(function(e){this.append(e[0],e[1])},this):r&&Object.getOwnPropertyNames(r).forEach(function(e){this.append(e,r[e])},this)}C.prototype.append=function(r,e){r=pr(r),e=gn(e);var t=this.map[r];this.map[r]=t?t+", "+e:e},C.prototype.delete=function(r){delete this.map[pr(r)]},C.prototype.get=function(r){return r=pr(r),this.has(r)?this.map[r]:null},C.prototype.has=function(r){return this.map.hasOwnProperty(pr(r))},C.prototype.set=function(r,e){this.map[pr(r)]=gn(e)},C.prototype.forEach=function(r,e){for(var t in this.map)this.map.hasOwnProperty(t)&&r.call(e,this.map[t],t,this)},C.prototype.keys=function(){var r=[];return this.forEach(function(e,t){r.push(t)}),_n(r)},C.prototype.values=function(){var r=[];return this.forEach(function(e){r.push(e)}),_n(r)},C.prototype.entries=function(){var r=[];return this.forEach(function(e,t){r.push([t,e])}),_n(r)},G.iterable&&(C.prototype[Symbol.iterator]=C.prototype.entries);function vn(r){if(r.bodyUsed)return Promise.reject(new TypeError("Already read"));r.bodyUsed=!0}function la(r){return new Promise(function(e,t){r.onload=function(){e(r.result)},r.onerror=function(){t(r.error)}})}function ec(r){var e=new FileReader,t=la(e);return e.readAsArrayBuffer(r),t}function rc(r){var e=new FileReader,t=la(e);return e.readAsText(r),t}function tc(r){for(var e=new Uint8Array(r),t=new Array(e.length),n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return t.join("")}function da(r){if(r.slice)return r.slice(0);var e=new Uint8Array(r.byteLength);return e.set(new Uint8Array(r)),e.buffer}function pa(){return this.bodyUsed=!1,this._initBody=function(r){this.bodyUsed=this.bodyUsed,this._bodyInit=r,r?typeof r=="string"?this._bodyText=r:G.blob&&Blob.prototype.isPrototypeOf(r)?this._bodyBlob=r:G.formData&&FormData.prototype.isPrototypeOf(r)?this._bodyFormData=r:G.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)?this._bodyText=r.toString():G.arrayBuffer&&G.blob&&Zf(r)?(this._bodyArrayBuffer=da(r.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):G.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(r)||Qf(r))?this._bodyArrayBuffer=da(r):this._bodyText=r=Object.prototype.toString.call(r):this._bodyText="",this.headers.get("content-type")||(typeof r=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):G.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},G.blob&&(this.blob=function(){var r=vn(this);if(r)return r;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var r=vn(this);return r||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(ec)}),this.text=function(){var r=vn(this);if(r)return r;if(this._bodyBlob)return rc(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(tc(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},G.formData&&(this.formData=function(){return this.text().then(ac)}),this.json=function(){return this.text().then(JSON.parse)},this}var nc=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function ic(r){var e=r.toUpperCase();return nc.indexOf(e)>-1?e:r}function be(r,e){if(!(this instanceof be))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e=e||{};var t=e.body;if(r instanceof be){if(r.bodyUsed)throw new TypeError("Already read");this.url=r.url,this.credentials=r.credentials,e.headers||(this.headers=new C(r.headers)),this.method=r.method,this.mode=r.mode,this.signal=r.signal,!t&&r._bodyInit!=null&&(t=r._bodyInit,r.bodyUsed=!0)}else this.url=String(r);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new C(e.headers)),this.method=ic(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&t)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(t),(this.method==="GET"||this.method==="HEAD")&&(e.cache==="no-store"||e.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var i=/\?/;this.url+=(i.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}be.prototype.clone=function(){return new be(this,{body:this._bodyInit})};function ac(r){var e=new FormData;return r.trim().split("&").forEach(function(t){if(t){var n=t.split("="),i=n.shift().replace(/\+/g," "),a=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(a))}}),e}function oc(r){var e=new C,t=r.replace(/\r?\n[\t ]+/g," ");return t.split("\r").map(function(n){return n.indexOf(`
|
|
3
3
|
`)===0?n.substr(1,n.length):n}).forEach(function(n){var i=n.split(":"),a=i.shift().trim();if(a){var o=i.join(":").trim();e.append(a,o)}}),e}pa.call(be.prototype);function K(r,e){if(!(this instanceof K))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=e.status===void 0?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText===void 0?"":""+e.statusText,this.headers=new C(e.headers),this.url=e.url||"",this._initBody(r)}pa.call(K.prototype),K.prototype.clone=function(){return new K(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new C(this.headers),url:this.url})},K.error=function(){var r=new K(null,{status:0,statusText:""});return r.type="error",r};var sc=[301,302,303,307,308];K.redirect=function(r,e){if(sc.indexOf(e)===-1)throw new RangeError("Invalid status code");return new K(null,{status:e,headers:{location:r}})};var $e=L.DOMException;try{new $e}catch{$e=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},$e.prototype=Object.create(Error.prototype),$e.prototype.constructor=$e}function ha(r,e){return new Promise(function(t,n){var i=new be(r,e);if(i.signal&&i.signal.aborted)return n(new $e("Aborted","AbortError"));var a=new XMLHttpRequest;function o(){a.abort()}a.onload=function(){var f={status:a.status,statusText:a.statusText,headers:oc(a.getAllResponseHeaders()||"")};f.url="responseURL"in a?a.responseURL:f.headers.get("X-Request-URL");var d="response"in a?a.response:a.responseText;setTimeout(function(){t(new K(d,f))},0)},a.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},a.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},a.onabort=function(){setTimeout(function(){n(new $e("Aborted","AbortError"))},0)};function u(f){try{return f===""&&L.location.href?L.location.href:f}catch{return f}}a.open(i.method,u(i.url),!0),i.credentials==="include"?a.withCredentials=!0:i.credentials==="omit"&&(a.withCredentials=!1),"responseType"in a&&(G.blob?a.responseType="blob":G.arrayBuffer&&i.headers.get("Content-Type")&&i.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(a.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof C)?Object.getOwnPropertyNames(e.headers).forEach(function(f){a.setRequestHeader(f,gn(e.headers[f]))}):i.headers.forEach(function(f,d){a.setRequestHeader(d,f)}),i.signal&&(i.signal.addEventListener("abort",o),a.onreadystatechange=function(){a.readyState===4&&i.signal.removeEventListener("abort",o)}),a.send(typeof i._bodyInit>"u"?null:i._bodyInit)})}ha.polyfill=!0,L.fetch||(L.fetch=ha,L.Headers=C,L.Request=be,L.Response=K),self.fetch.bind(self);let uc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",ya=(r=21)=>{let e="",t=r|0;for(;t--;)e+=uc[Math.random()*64|0];return e};var ke=TypeError,je=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Z=[],z=[],fc=typeof Uint8Array<"u"?Uint8Array:Array,mn=!1;function ga(){mn=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=r.length;e<t;++e)Z[e]=r[e],z[r.charCodeAt(e)]=e;z["-".charCodeAt(0)]=62,z["_".charCodeAt(0)]=63}function cc(r){mn||ga();var e,t,n,i,a,o,u=r.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=r[u-2]==="="?2:r[u-1]==="="?1:0,o=new fc(u*3/4-a),n=a>0?u-4:u;var f=0;for(e=0,t=0;e<n;e+=4,t+=3)i=z[r.charCodeAt(e)]<<18|z[r.charCodeAt(e+1)]<<12|z[r.charCodeAt(e+2)]<<6|z[r.charCodeAt(e+3)],o[f++]=i>>16&255,o[f++]=i>>8&255,o[f++]=i&255;return a===2?(i=z[r.charCodeAt(e)]<<2|z[r.charCodeAt(e+1)]>>4,o[f++]=i&255):a===1&&(i=z[r.charCodeAt(e)]<<10|z[r.charCodeAt(e+1)]<<4|z[r.charCodeAt(e+2)]>>2,o[f++]=i>>8&255,o[f++]=i&255),o}function lc(r){return Z[r>>18&63]+Z[r>>12&63]+Z[r>>6&63]+Z[r&63]}function dc(r,e,t){for(var n,i=[],a=e;a<t;a+=3)n=(r[a]<<16)+(r[a+1]<<8)+r[a+2],i.push(lc(n));return i.join("")}function _a(r){mn||ga();for(var e,t=r.length,n=t%3,i="",a=[],o=16383,u=0,f=t-n;u<f;u+=o)a.push(dc(r,u,u+o>f?f:u+o));return n===1?(e=r[t-1],i+=Z[e>>2],i+=Z[e<<4&63],i+="=="):n===2&&(e=(r[t-2]<<8)+r[t-1],i+=Z[e>>10],i+=Z[e>>4&63],i+=Z[e<<2&63],i+="="),a.push(i),a.join("")}function Jr(r,e,t,n,i){var a,o,u=i*8-n-1,f=(1<<u)-1,d=f>>1,c=-7,s=t?i-1:0,l=t?-1:1,p=r[e+s];for(s+=l,a=p&(1<<-c)-1,p>>=-c,c+=u;c>0;a=a*256+r[e+s],s+=l,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=o*256+r[e+s],s+=l,c-=8);if(a===0)a=1-d;else{if(a===f)return o?NaN:(p?-1:1)*(1/0);o=o+Math.pow(2,n),a=a-d}return(p?-1:1)*o*Math.pow(2,a-n)}function va(r,e,t,n,i,a){var o,u,f,d=a*8-i-1,c=(1<<d)-1,s=c>>1,l=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,g=n?1:-1,$=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+s>=1?e+=l/f:e+=l*Math.pow(2,1-s),e*f>=2&&(o++,f/=2),o+s>=c?(u=0,o=c):o+s>=1?(u=(e*f-1)*Math.pow(2,i),o=o+s):(u=e*Math.pow(2,s-1)*Math.pow(2,i),o=0));i>=8;r[t+p]=u&255,p+=g,u/=256,i-=8);for(o=o<<i|u,d+=i;d>0;r[t+p]=o&255,p+=g,o/=256,d-=8);r[t+p-g]|=$*128}var pc={}.toString,ma=Array.isArray||function(r){return pc.call(r)=="[object Array]"};/*!
|
|
4
4
|
* The buffer module from node.js, for the browser.
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
`)+" "+t[1]:t[0]+e+" "+r.join(", ")+" "+t[1]}function Pn(r){return Array.isArray(r)}function ut(r){return typeof r=="boolean"}function hr(r){return r===null}function ka(r){return r==null}function xn(r){return typeof r=="number"}function yr(r){return typeof r=="string"}function ja(r){return typeof r=="symbol"}function ee(r){return r===void 0}function gr(r){return Oe(r)&&Tn(r)==="[object RegExp]"}function Oe(r){return typeof r=="object"&&r!==null}function ft(r){return Oe(r)&&Tn(r)==="[object Date]"}function _r(r){return Oe(r)&&(Tn(r)==="[object Error]"||r instanceof Error)}function vr(r){return typeof r=="function"}function Va(r){return r===null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||typeof r=="symbol"||typeof r>"u"}function Ga(r){return y.isBuffer(r)}function Tn(r){return Object.prototype.toString.call(r)}function Fn(r){return r<10?"0"+r.toString(10):r.toString(10)}var wl=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function bl(){var r=new Date,e=[Fn(r.getHours()),Fn(r.getMinutes()),Fn(r.getSeconds())].join(":");return[r.getDate(),wl[r.getMonth()],e].join(" ")}function Ha(){console.log("%s - %s",bl(),at.apply(null,arguments))}function Rn(r,e){if(!e||!Oe(e))return r;for(var t=Object.keys(e),n=t.length;n--;)r[t[n]]=e[t[n]];return r}function Wa(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var Ie=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function Mn(r){if(typeof r!="function")throw new TypeError('The "original" argument must be of type Function');if(Ie&&r[Ie]){var e=r[Ie];if(typeof e!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Ie,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var t,n,i=new Promise(function(u,f){t=u,n=f}),a=[],o=0;o<arguments.length;o++)a.push(arguments[o]);a.push(function(u,f){u?n(u):t(f)});try{r.apply(this,a)}catch(u){n(u)}return i}return Object.setPrototypeOf(e,Object.getPrototypeOf(r)),Ie&&Object.defineProperty(e,Ie,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,Ua(r))}Mn.custom=Ie;function $l(r,e){if(!r){var t=new Error("Promise was rejected with a falsy value");t.reason=r,r=t}return e(r)}function za(r){if(typeof r!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var t=[],n=0;n<arguments.length;n++)t.push(arguments[n]);var i=t.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var a=this,o=function(){return i.apply(a,arguments)};r.apply(this,t).then(function(u){He.nextTick(o.bind(null,null,u))},function(u){He.nextTick($l.bind(null,u,o))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(r)),Object.defineProperties(e,Ua(r)),e}var El={inherits:qa,_extend:Rn,log:Ha,isBuffer:Ga,isPrimitive:Va,isFunction:vr,isError:_r,isDate:ft,isObject:Oe,isRegExp:gr,isUndefined:ee,isSymbol:ja,isString:yr,isNumber:xn,isNullOrUndefined:ka,isNull:hr,isBoolean:ut,isArray:Pn,inspect:Q,deprecate:Sn,format:at,debuglog:La,promisify:Mn,callbackify:za},Sl=Object.freeze({__proto__:null,_extend:Rn,callbackify:za,debuglog:La,default:El,deprecate:Sn,format:at,inherits:qa,inspect:Q,isArray:Pn,isBoolean:ut,isBuffer:Ga,isDate:ft,isError:_r,isFunction:vr,isNull:hr,isNullOrUndefined:ka,isNumber:xn,isObject:Oe,isPrimitive:Va,isRegExp:gr,isString:yr,isSymbol:ja,isUndefined:ee,log:Ha,promisify:Mn}),Al=Kf(Sl),Ol=Al.inspect,Dn=typeof Map=="function"&&Map.prototype,Cn=Object.getOwnPropertyDescriptor&&Dn?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ct=Dn&&Cn&&typeof Cn.get=="function"?Cn.get:null,Xa=Dn&&Map.prototype.forEach,Nn=typeof Set=="function"&&Set.prototype,Bn=Object.getOwnPropertyDescriptor&&Nn?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,lt=Nn&&Bn&&typeof Bn.get=="function"?Bn.get:null,Ya=Nn&&Set.prototype.forEach,Il=typeof WeakMap=="function"&&WeakMap.prototype,mr=Il?WeakMap.prototype.has:null,Pl=typeof WeakSet=="function"&&WeakSet.prototype,wr=Pl?WeakSet.prototype.has:null,xl=typeof WeakRef=="function"&&WeakRef.prototype,Ka=xl?WeakRef.prototype.deref:null,Tl=Boolean.prototype.valueOf,Fl=Object.prototype.toString,Rl=Function.prototype.toString,Ml=String.prototype.match,qn=String.prototype.slice,ye=String.prototype.replace,Dl=String.prototype.toUpperCase,Za=String.prototype.toLowerCase,Ja=RegExp.prototype.test,Qa=Array.prototype.concat,re=Array.prototype.join,Cl=Array.prototype.slice,eo=Math.floor,Un=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ln=Object.getOwnPropertySymbols,kn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,We=typeof Symbol=="function"&&typeof Symbol.iterator=="object",br=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===We||"symbol")?Symbol.toStringTag:null,ro=Object.prototype.propertyIsEnumerable,to=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function no(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Ja.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-eo(-r):eo(r);if(n!==r){var i=String(n),a=qn.call(e,i.length+1);return ye.call(i,t,"$&_")+"."+ye.call(ye.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return ye.call(e,t,"$&_")}var jn=Ol,io=jn.custom,ao=fo(io)?io:null,oo={__proto__:null,double:'"',single:"'"},Nl={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},dt=function r(e,t,n,i){var a=t||{};if(fe(a,"quoteStyle")&&!fe(oo,a.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(fe(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=fe(a,"customInspect")?a.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(fe(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(fe(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=a.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return lo(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var f=String(e);return u?no(e,f):f}if(typeof e=="bigint"){var d=String(e)+"n";return u?no(e,d):d}var c=typeof a.depth>"u"?5:a.depth;if(typeof n>"u"&&(n=0),n>=c&&c>0&&typeof e=="object")return Vn(e)?"[Array]":"[Object]";var s=ed(a,n);if(typeof i>"u")i=[];else if(co(i,e)>=0)return"[Circular]";function l(W,oe,Y){if(oe&&(i=Cl.call(i),i.push(oe)),Y){var Le={depth:a.depth};return fe(a,"quoteStyle")&&(Le.quoteStyle=a.quoteStyle),r(W,Le,n+1,i)}return r(W,a,n+1,i)}if(typeof e=="function"&&!uo(e)){var p=Hl(e),g=pt(e,l);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(g.length>0?" { "+re.call(g,", ")+" }":"")}if(fo(e)){var $=We?ye.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):kn.call(e);return typeof e=="object"&&!We?$r($):$}if(Zl(e)){for(var S="<"+Za.call(String(e.nodeName)),A=e.attributes||[],E=0;E<A.length;E++)S+=" "+A[E].name+"="+so(Bl(A[E].value),"double",a);return S+=">",e.childNodes&&e.childNodes.length&&(S+="..."),S+="</"+Za.call(String(e.nodeName))+">",S}if(Vn(e)){if(e.length===0)return"[]";var h=pt(e,l);return s&&!Ql(h)?"["+Hn(h,s)+"]":"[ "+re.call(h,", ")+" ]"}if(Ul(e)){var I=pt(e,l);return!("cause"in Error.prototype)&&"cause"in e&&!ro.call(e,"cause")?"{ ["+String(e)+"] "+re.call(Qa.call("[cause]: "+l(e.cause),I),", ")+" }":I.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+re.call(I,", ")+" }"}if(typeof e=="object"&&o){if(ao&&typeof e[ao]=="function"&&jn)return jn(e,{depth:c-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Wl(e)){var T=[];return Xa&&Xa.call(e,function(W,oe){T.push(l(oe,e,!0)+" => "+l(W,e))}),po("Map",ct.call(e),T,s)}if(Yl(e)){var F=[];return Ya&&Ya.call(e,function(W){F.push(l(W,e))}),po("Set",lt.call(e),F,s)}if(zl(e))return Gn("WeakMap");if(Kl(e))return Gn("WeakSet");if(Xl(e))return Gn("WeakRef");if(kl(e))return $r(l(Number(e)));if(Vl(e))return $r(l(Un.call(e)));if(jl(e))return $r(Tl.call(e));if(Ll(e))return $r(l(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof D<"u"&&e===D)return"{ [object globalThis] }";if(!ql(e)&&!uo(e)){var b=pt(e,l),_=to?to(e)===Object.prototype:e instanceof Object||e.constructor===Object,m=e instanceof Object?"":"null prototype",O=!_&&br&&Object(e)===e&&br in e?qn.call(ge(e),8,-1):m?"Object":"",P=_||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",B=P+(O||m?"["+re.call(Qa.call([],O||[],m||[]),": ")+"] ":"");return b.length===0?B+"{}":s?B+"{"+Hn(b,s)+"}":B+"{ "+re.call(b,", ")+" }"}return String(e)};function so(r,e,t){var n=t.quoteStyle||e,i=oo[n];return i+r+i}function Bl(r){return ye.call(String(r),/"/g,""")}function Pe(r){return!br||!(typeof r=="object"&&(br in r||typeof r[br]<"u"))}function Vn(r){return ge(r)==="[object Array]"&&Pe(r)}function ql(r){return ge(r)==="[object Date]"&&Pe(r)}function uo(r){return ge(r)==="[object RegExp]"&&Pe(r)}function Ul(r){return ge(r)==="[object Error]"&&Pe(r)}function Ll(r){return ge(r)==="[object String]"&&Pe(r)}function kl(r){return ge(r)==="[object Number]"&&Pe(r)}function jl(r){return ge(r)==="[object Boolean]"&&Pe(r)}function fo(r){if(We)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!kn)return!1;try{return kn.call(r),!0}catch{}return!1}function Vl(r){if(!r||typeof r!="object"||!Un)return!1;try{return Un.call(r),!0}catch{}return!1}var Gl=Object.prototype.hasOwnProperty||function(r){return r in this};function fe(r,e){return Gl.call(r,e)}function ge(r){return Fl.call(r)}function Hl(r){if(r.name)return r.name;var e=Ml.call(Rl.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function co(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,n=r.length;t<n;t++)if(r[t]===e)return t;return-1}function Wl(r){if(!ct||!r||typeof r!="object")return!1;try{ct.call(r);try{lt.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function zl(r){if(!mr||!r||typeof r!="object")return!1;try{mr.call(r,mr);try{wr.call(r,wr)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function Xl(r){if(!Ka||!r||typeof r!="object")return!1;try{return Ka.call(r),!0}catch{}return!1}function Yl(r){if(!lt||!r||typeof r!="object")return!1;try{lt.call(r);try{ct.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function Kl(r){if(!wr||!r||typeof r!="object")return!1;try{wr.call(r,wr);try{mr.call(r,mr)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function Zl(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function lo(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return lo(qn.call(r,0,e.maxStringLength),e)+n}var i=Nl[e.quoteStyle||"single"];i.lastIndex=0;var a=ye.call(ye.call(r,i,"\\$1"),/[\x00-\x1f]/g,Jl);return so(a,"single",e)}function Jl(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+Dl.call(e.toString(16))}function $r(r){return"Object("+r+")"}function Gn(r){return r+" { ? }"}function po(r,e,t,n){var i=n?Hn(t,n):re.call(t,", ");return r+" ("+e+") {"+i+"}"}function Ql(r){for(var e=0;e<r.length;e++)if(co(r[e],`
|
|
18
18
|
`)>=0)return!1;return!0}function ed(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=re.call(Array(r.indent+1)," ");else return null;return{base:t,prev:re.call(Array(e+1),t)}}function Hn(r,e){if(r.length===0)return"";var t=`
|
|
19
19
|
`+e.prev+e.base;return t+re.call(r,","+t)+`
|
|
20
|
-
`+e.prev}function pt(r,e){var t=Vn(r),n=[];if(t){n.length=r.length;for(var i=0;i<r.length;i++)n[i]=fe(r,i)?e(r[i],r):""}var a=typeof Ln=="function"?Ln(r):[],o;if(We){o={};for(var u=0;u<a.length;u++)o["$"+a[u]]=a[u]}for(var f in r)fe(r,f)&&(t&&String(Number(f))===f&&f<r.length||We&&o["$"+f]instanceof Symbol||(Ja.call(/[^\w$]/,f)?n.push(e(f,r)+": "+e(r[f],r)):n.push(f+": "+e(r[f],r))));if(typeof Ln=="function")for(var d=0;d<a.length;d++)ro.call(r,a[d])&&n.push("["+e(a[d])+"]: "+e(r[a[d]],r));return n}var rd=dt,td=ke,ht=function(r,e,t){for(var n=r,i;(i=n.next)!=null;n=i)if(i.key===e)return n.next=i.next,t||(i.next=r.next,r.next=i),i},nd=function(r,e){if(r){var t=ht(r,e);return t&&t.value}},id=function(r,e,t){var n=ht(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},ad=function(r,e){return r?!!ht(r,e):!1},od=function(r,e){if(r)return ht(r,e,!0)},sd=function(){var e,t={assert:function(n){if(!t.has(n))throw new td("Side channel does not contain "+rd(n))},delete:function(n){var i=e&&e.next,a=od(e,n);return a&&i&&i===a&&(e=void 0),!!a},get:function(n){return nd(e,n)},has:function(n){return ad(e,n)},set:function(n,i){e||(e={next:void 0}),id(e,n,i)}};return t},ho=Object,ud=Error,fd=EvalError,cd=RangeError,ld=ReferenceError,dd=SyntaxError,pd=URIError,hd=Math.abs,yd=Math.floor,gd=Math.max,_d=Math.min,vd=Math.pow,md=Math.round,wd=Number.isNaN||function(e){return e!==e},bd=wd,$d=function(e){return bd(e)||e===0?e:e<0?-1:1},Ed=Object.getOwnPropertyDescriptor,yt=Ed;if(yt)try{yt([],"length")}catch{yt=null}var yo=yt,gt=Object.defineProperty||!1;if(gt)try{gt({},"a",{value:1})}catch{gt=!1}var Sd=gt,Wn,go;function Ad(){return go||(go=1,Wn=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var a in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var u=Object.getOwnPropertyDescriptor(e,t);if(u.value!==i||u.enumerable!==!0)return!1}return!0}),Wn}var zn,_o;function Od(){if(_o)return zn;_o=1;var r=typeof Symbol<"u"&&Symbol,e=Ad();return zn=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},zn}var Xn,vo;function mo(){return vo||(vo=1,Xn=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Xn}var Yn,wo;function bo(){if(wo)return Yn;wo=1;var r=ho;return Yn=r.getPrototypeOf||null,Yn}var Kn,$o;function Id(){if($o)return Kn;$o=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,n="[object Function]",i=function(f,d){for(var c=[],s=0;s<f.length;s+=1)c[s]=f[s];for(var l=0;l<d.length;l+=1)c[l+f.length]=d[l];return c},a=function(f,d){for(var c=[],s=d||0,l=0;s<f.length;s+=1,l+=1)c[l]=f[s];return c},o=function(u,f){for(var d="",c=0;c<u.length;c+=1)d+=u[c],c+1<u.length&&(d+=f);return d};return Kn=function(f){var d=this;if(typeof d!="function"||e.apply(d)!==n)throw new TypeError(r+d);for(var c=a(arguments,1),s,l=function(){if(this instanceof s){var A=d.apply(this,i(c,arguments));return Object(A)===A?A:this}return d.apply(f,i(c,arguments))},p=t(0,d.length-c.length),g=[],$=0;$<p;$++)g[$]="$"+$;if(s=Function("binder","return function ("+o(g,",")+"){ return binder.apply(this,arguments); }")(l),d.prototype){var S=function(){};S.prototype=d.prototype,s.prototype=new S,S.prototype=null}return s},Kn}var Zn,Eo;function _t(){if(Eo)return Zn;Eo=1;var r=Id();return Zn=Function.prototype.bind||r,Zn}var Jn=Function.prototype.call,Qn,So;function Ao(){return So||(So=1,Qn=Function.prototype.apply),Qn}var Pd=typeof Reflect<"u"&&Reflect&&Reflect.apply,xd=_t(),Td=Ao(),Fd=Jn,Rd=Pd,Md=Rd||xd.call(Fd,Td),Dd=_t(),Cd=ke,Nd=Jn,Bd=Md,Oo=function(e){if(e.length<1||typeof e[0]!="function")throw new Cd("a function is required");return Bd(Dd,Nd,e)},ei,Io;function qd(){if(Io)return ei;Io=1;var r=Oo,e=yo,t;try{t=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var n=!!t&&e&&e(Object.prototype,"__proto__"),i=Object,a=i.getPrototypeOf;return ei=n&&typeof n.get=="function"?r([n.get]):typeof a=="function"?function(u){return a(u==null?u:i(u))}:!1,ei}var ri,Po;function Ud(){if(Po)return ri;Po=1;var r=mo(),e=bo(),t=qd();return ri=r?function(i){return r(i)}:e?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return e(i)}:t?function(i){return t(i)}:null,ri}var ti,xo;function Ld(){if(xo)return ti;xo=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=_t();return ti=t.call(r,e),ti}var x,kd=ho,jd=ud,Vd=fd,Gd=cd,Hd=ld,ze=dd,Xe=ke,Wd=pd,zd=hd,Xd=yd,Yd=gd,Kd=_d,Zd=vd,Jd=md,Qd=$d,To=Function,ni=function(r){try{return To('"use strict"; return ('+r+").constructor;")()}catch{}},Er=yo,ep=Sd,ii=function(){throw new Xe},rp=Er?function(){try{return arguments.callee,ii}catch{try{return Er(arguments,"callee").get}catch{return ii}}}():ii,Ye=Od()(),U=Ud(),tp=bo(),np=mo(),Fo=Ao(),Sr=Jn,Ke={},ip=typeof Uint8Array>"u"||!U?x:U(Uint8Array),xe={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?x:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?x:ArrayBuffer,"%ArrayIteratorPrototype%":Ye&&U?U([][Symbol.iterator]()):x,"%AsyncFromSyncIteratorPrototype%":x,"%AsyncFunction%":Ke,"%AsyncGenerator%":Ke,"%AsyncGeneratorFunction%":Ke,"%AsyncIteratorPrototype%":Ke,"%Atomics%":typeof Atomics>"u"?x:Atomics,"%BigInt%":typeof BigInt>"u"?x:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?x:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?x:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?x:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":jd,"%eval%":eval,"%EvalError%":Vd,"%Float16Array%":typeof Float16Array>"u"?x:Float16Array,"%Float32Array%":typeof Float32Array>"u"?x:Float32Array,"%Float64Array%":typeof Float64Array>"u"?x:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?x:FinalizationRegistry,"%Function%":To,"%GeneratorFunction%":Ke,"%Int8Array%":typeof Int8Array>"u"?x:Int8Array,"%Int16Array%":typeof Int16Array>"u"?x:Int16Array,"%Int32Array%":typeof Int32Array>"u"?x:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ye&&U?U(U([][Symbol.iterator]())):x,"%JSON%":typeof JSON=="object"?JSON:x,"%Map%":typeof Map>"u"?x:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ye||!U?x:U(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":kd,"%Object.getOwnPropertyDescriptor%":Er,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?x:Promise,"%Proxy%":typeof Proxy>"u"?x:Proxy,"%RangeError%":Gd,"%ReferenceError%":Hd,"%Reflect%":typeof Reflect>"u"?x:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?x:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ye||!U?x:U(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?x:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ye&&U?U(""[Symbol.iterator]()):x,"%Symbol%":Ye?Symbol:x,"%SyntaxError%":ze,"%ThrowTypeError%":rp,"%TypedArray%":ip,"%TypeError%":Xe,"%Uint8Array%":typeof Uint8Array>"u"?x:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?x:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?x:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?x:Uint32Array,"%URIError%":Wd,"%WeakMap%":typeof WeakMap>"u"?x:WeakMap,"%WeakRef%":typeof WeakRef>"u"?x:WeakRef,"%WeakSet%":typeof WeakSet>"u"?x:WeakSet,"%Function.prototype.call%":Sr,"%Function.prototype.apply%":Fo,"%Object.defineProperty%":ep,"%Object.getPrototypeOf%":tp,"%Math.abs%":zd,"%Math.floor%":Xd,"%Math.max%":Yd,"%Math.min%":Kd,"%Math.pow%":Zd,"%Math.round%":Jd,"%Math.sign%":Qd,"%Reflect.getPrototypeOf%":np};if(U)try{null.error}catch(r){var ap=U(U(r));xe["%Error.prototype%"]=ap}var op=function r(e){var t;if(e==="%AsyncFunction%")t=ni("async function () {}");else if(e==="%GeneratorFunction%")t=ni("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=ni("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&U&&(t=U(i.prototype))}return xe[e]=t,t},Ro={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ar=_t(),vt=Ld(),sp=Ar.call(Sr,Array.prototype.concat),up=Ar.call(Fo,Array.prototype.splice),Mo=Ar.call(Sr,String.prototype.replace),mt=Ar.call(Sr,String.prototype.slice),fp=Ar.call(Sr,RegExp.prototype.exec),cp=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,lp=/\\(\\)?/g,dp=function(e){var t=mt(e,0,1),n=mt(e,-1);if(t==="%"&&n!=="%")throw new ze("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new ze("invalid intrinsic syntax, expected opening `%`");var i=[];return Mo(e,cp,function(a,o,u,f){i[i.length]=u?Mo(f,lp,"$1"):o||a}),i},pp=function(e,t){var n=e,i;if(vt(Ro,n)&&(i=Ro[n],n="%"+i[0]+"%"),vt(xe,n)){var a=xe[n];if(a===Ke&&(a=op(n)),typeof a>"u"&&!t)throw new Xe("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new ze("intrinsic "+e+" does not exist!")},ai=function(e,t){if(typeof e!="string"||e.length===0)throw new Xe("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Xe('"allowMissing" argument must be a boolean');if(fp(/^%?[^%]*%?$/,e)===null)throw new ze("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=dp(e),i=n.length>0?n[0]:"",a=pp("%"+i+"%",t),o=a.name,u=a.value,f=!1,d=a.alias;d&&(i=d[0],up(n,sp([0,1],d)));for(var c=1,s=!0;c<n.length;c+=1){var l=n[c],p=mt(l,0,1),g=mt(l,-1);if((p==='"'||p==="'"||p==="`"||g==='"'||g==="'"||g==="`")&&p!==g)throw new ze("property names with quotes must have matching quotes");if((l==="constructor"||!s)&&(f=!0),i+="."+l,o="%"+i+"%",vt(xe,o))u=xe[o];else if(u!=null){if(!(l in u)){if(!t)throw new Xe("base intrinsic for "+e+" exists, but the property is not available.");return}if(Er&&c+1>=n.length){var $=Er(u,l);s=!!$,s&&"get"in $&&!("originalValue"in $.get)?u=$.get:u=u[l]}else s=vt(u,l),u=u[l];s&&!f&&(xe[o]=u)}}return u},Do=ai,Co=Oo,hp=Co([Do("%String.prototype.indexOf%")]),No=function(e,t){var n=Do(e,!!t);return typeof n=="function"&&hp(e,".prototype.")>-1?Co([n]):n},yp=ai,Or=No,gp=dt,_p=ke,Bo=yp("%Map%",!0),vp=Or("Map.prototype.get",!0),mp=Or("Map.prototype.set",!0),wp=Or("Map.prototype.has",!0),bp=Or("Map.prototype.delete",!0),$p=Or("Map.prototype.size",!0),qo=!!Bo&&function(){var e,t={assert:function(n){if(!t.has(n))throw new _p("Side channel does not contain "+gp(n))},delete:function(n){if(e){var i=bp(e,n);return $p(e)===0&&(e=void 0),i}return!1},get:function(n){if(e)return vp(e,n)},has:function(n){return e?wp(e,n):!1},set:function(n,i){e||(e=new Bo),mp(e,n,i)}};return t},Ep=ai,wt=No,Sp=dt,bt=qo,Ap=ke,Ze=Ep("%WeakMap%",!0),Op=wt("WeakMap.prototype.get",!0),Ip=wt("WeakMap.prototype.set",!0),Pp=wt("WeakMap.prototype.has",!0),xp=wt("WeakMap.prototype.delete",!0),Tp=Ze?function(){var e,t,n={assert:function(i){if(!n.has(i))throw new Ap("Side channel does not contain "+Sp(i))},delete:function(i){if(Ze&&i&&(typeof i=="object"||typeof i=="function")){if(e)return xp(e,i)}else if(bt&&t)return t.delete(i);return!1},get:function(i){return Ze&&i&&(typeof i=="object"||typeof i=="function")&&e?Op(e,i):t&&t.get(i)},has:function(i){return Ze&&i&&(typeof i=="object"||typeof i=="function")&&e?Pp(e,i):!!t&&t.has(i)},set:function(i,a){Ze&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Ze),Ip(e,i,a)):bt&&(t||(t=bt()),t.set(i,a))}};return n}:bt,Fp=ke,Rp=dt,Mp=sd,Dp=qo,Cp=Tp,Np=Cp||Dp||Mp,Uo=function(){var e,t={assert:function(n){if(!t.has(n))throw new Fp("Side channel does not contain "+Rp(n))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,i){e||(e=Np()),e.set(n,i)}};return t},Bp=String.prototype.replace,qp=/%20/g,oi={RFC1738:"RFC1738",RFC3986:"RFC3986"},Lo={default:oi.RFC3986,formatters:{RFC1738:function(r){return Bp.call(r,qp,"+")},RFC3986:function(r){return String(r)}},RFC1738:oi.RFC1738,RFC3986:oi.RFC3986},Up=Lo,Lp=Uo,si=Object.prototype.hasOwnProperty,Te=Array.isArray,$t=Lp(),ko=function(e,t){return $t.set(e,t),e},Et=function(e){return $t.has(e)},ui=function(e){return $t.get(e)},jo=function(e,t){$t.set(e,t)},te=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),kp=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(Te(n)){for(var i=[],a=0;a<n.length;++a)typeof n[a]<"u"&&i.push(n[a]);t.obj[t.prop]=i}}},fi=function(e,t){for(var n=t&&t.plainObjects?{__proto__:null}:{},i=0;i<e.length;++i)typeof e[i]<"u"&&(n[i]=e[i]);return n},jp=function r(e,t,n){if(!t)return e;if(typeof t!="object"&&typeof t!="function"){if(Te(e))e.push(t);else if(e&&typeof e=="object")if(Et(e)){var i=ui(e)+1;e[i]=t,jo(e,i)}else(n&&(n.plainObjects||n.allowPrototypes)||!si.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object"){if(Et(t)){for(var a=Object.keys(t),o=n&&n.plainObjects?{__proto__:null,0:e}:{0:e},u=0;u<a.length;u++){var f=parseInt(a[u],10);o[f+1]=t[a[u]]}return ko(o,ui(t)+1)}return[e].concat(t)}var d=e;return Te(e)&&!Te(t)&&(d=fi(e,n)),Te(e)&&Te(t)?(t.forEach(function(c,s){if(si.call(e,s)){var l=e[s];l&&typeof l=="object"&&c&&typeof c=="object"?e[s]=r(l,c,n):e.push(c)}else e[s]=c}),e):Object.keys(t).reduce(function(c,s){var l=t[s];return si.call(c,s)?c[s]=r(c[s],l,n):c[s]=l,c},d)},Vp=function(e,t){return Object.keys(t).reduce(function(n,i){return n[i]=t[i],n},e)},Gp=function(r,e,t){var n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},ci=1024,Hp=function(e,t,n,i,a){if(e.length===0)return e;var o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(p){return"%26%23"+parseInt(p.slice(2),16)+"%3B"});for(var u="",f=0;f<o.length;f+=ci){for(var d=o.length>=ci?o.slice(f,f+ci):o,c=[],s=0;s<d.length;++s){var l=d.charCodeAt(s);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||a===Up.RFC1738&&(l===40||l===41)){c[c.length]=d.charAt(s);continue}if(l<128){c[c.length]=te[l];continue}if(l<2048){c[c.length]=te[192|l>>6]+te[128|l&63];continue}if(l<55296||l>=57344){c[c.length]=te[224|l>>12]+te[128|l>>6&63]+te[128|l&63];continue}s+=1,l=65536+((l&1023)<<10|d.charCodeAt(s)&1023),c[c.length]=te[240|l>>18]+te[128|l>>12&63]+te[128|l>>6&63]+te[128|l&63]}u+=c.join("")}return u},Wp=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],i=0;i<t.length;++i)for(var a=t[i],o=a.obj[a.prop],u=Object.keys(o),f=0;f<u.length;++f){var d=u[f],c=o[d];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(t.push({obj:o,prop:d}),n.push(c))}return kp(t),e},zp=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Xp=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Yp=function(e,t,n,i){if(Et(e)){var a=ui(e)+1;return e[a]=t,jo(e,a),e}var o=[].concat(e,t);return o.length>n?ko(fi(o,{plainObjects:i}),o.length-1):o},Kp=function(e,t){if(Te(e)){for(var n=[],i=0;i<e.length;i+=1)n.push(t(e[i]));return n}return t(e)},Zp={arrayToObject:fi,assign:Vp,combine:Yp,compact:Wp,decode:Gp,encode:Hp,isBuffer:Xp,isOverflow:Et,isRegExp:zp,maybeMap:Kp,merge:jp},Vo=Uo,St=Zp,Ir=Lo,Jp=Object.prototype.hasOwnProperty,Go={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ne=Array.isArray,Qp=Array.prototype.push,Ho=function(r,e){Qp.apply(r,ne(e)?e:[e])},eh=Date.prototype.toISOString,Wo=Ir.default,N={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:St.encode,encodeValuesOnly:!1,filter:void 0,format:Wo,formatter:Ir.formatters[Wo],indices:!1,serializeDate:function(e){return eh.call(e)},skipNulls:!1,strictNullHandling:!1},rh=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},li={},th=function r(e,t,n,i,a,o,u,f,d,c,s,l,p,g,$,S,A,E){for(var h=e,I=E,T=0,F=!1;(I=I.get(li))!==void 0&&!F;){var b=I.get(e);if(T+=1,typeof b<"u"){if(b===T)throw new RangeError("Cyclic object value");F=!0}typeof I.get(li)>"u"&&(T=0)}if(typeof c=="function"?h=c(t,h):h instanceof Date?h=p(h):n==="comma"&&ne(h)&&(h=St.maybeMap(h,function(ca){return ca instanceof Date?p(ca):ca})),h===null){if(o)return d&&!S?d(t,N.encoder,A,"key",g):t;h=""}if(rh(h)||St.isBuffer(h)){if(d){var _=S?t:d(t,N.encoder,A,"key",g);return[$(_)+"="+$(d(h,N.encoder,A,"value",g))]}return[$(t)+"="+$(String(h))]}var m=[];if(typeof h>"u")return m;var O;if(n==="comma"&&ne(h))S&&d&&(h=St.maybeMap(h,d)),O=[{value:h.length>0?h.join(",")||null:void 0}];else if(ne(c))O=c;else{var P=Object.keys(h);O=s?P.sort(s):P}var B=f?String(t).replace(/\./g,"%2E"):String(t),W=i&&ne(h)&&h.length===1?B+"[]":B;if(a&&ne(h)&&h.length===0)return W+"[]";for(var oe=0;oe<O.length;++oe){var Y=O[oe],Le=typeof Y=="object"&&Y&&typeof Y.value<"u"?Y.value:h[Y];if(!(u&&Le===null)){var fa=l&&f?String(Y).replace(/\./g,"%2E"):String(Y),vT=ne(h)?typeof n=="function"?n(W,fa):W:W+(l?"."+fa:"["+fa+"]");E.set(e,T);var Yf=Vo();Yf.set(li,E),Ho(m,r(Le,vT,n,i,a,o,u,f,n==="comma"&&S&&ne(h)?null:d,c,s,l,p,g,$,S,A,Yf))}}return m},nh=function(e){if(!e)return N;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||N.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=Ir.default;if(typeof e.format<"u"){if(!Jp.call(Ir.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var i=Ir.formatters[n],a=N.filter;(typeof e.filter=="function"||ne(e.filter))&&(a=e.filter);var o;if(e.arrayFormat in Go?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=N.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:N.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:N.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:N.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:N.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?N.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:N.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:N.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:N.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:N.encodeValuesOnly,filter:a,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:N.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:N.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:N.strictNullHandling}},ih=function(r,e){var t=r,n=nh(e),i,a;typeof n.filter=="function"?(a=n.filter,t=a("",t)):ne(n.filter)&&(a=n.filter,i=a);var o=[];if(typeof t!="object"||t===null)return"";var u=Go[n.arrayFormat],f=u==="comma"&&n.commaRoundTrip;i||(i=Object.keys(t)),n.sort&&i.sort(n.sort);for(var d=Vo(),c=0;c<i.length;++c){var s=i[c],l=t[s];n.skipNulls&&l===null||Ho(o,th(l,s,u,f,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,d))}var p=o.join(n.delimiter),g=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?g+="utf8=%26%2310003%3B&":g+="utf8=%E2%9C%93&"),p.length>0?g+p:""},ah=we(ih);let zo={storeIdentifier:"",environment:"prod"};function oh(r){zo=r}function j(){return zo}const sh=(r,e="")=>{switch(r){case"prod":return"https://api.rechargeapps.com";case"stage":return"https://api.stage.rechargeapps.com";case"preprod":case"prestage":return`${e}/api`}},uh=(r,e="")=>{switch(r){case"prod":return"https://admin.rechargeapps.com";case"stage":return"https://admin.stage.rechargeapps.com";case"preprod":case"prestage":return e}},fh=r=>{switch(r){case"prod":case"preprod":return"https://static.rechargecdn.com";case"stage":case"prestage":return"https://static.stage.rechargecdn.com"}},Xo="/tools/recurring";class Je{constructor(e,t){this.name="RechargeRequestError",this.message=e,this.status=t}}function ch(r){return ah(r,{encode:!1,indices:!1,arrayFormat:"comma"})}function v(r,e){return{...r,internalFnCall:r.internalFnCall??e,internalRequestId:r.internalRequestId??ya()}}async function At(r,e,t={}){const n=j();return X(r,`${fh(n.environment)}/store/${n.storeIdentifier}${e}`,t)}async function w(r,e,{id:t,query:n,data:i,headers:a}={},o){const{environment:u,environmentUri:f,storeIdentifier:d,loginRetryFn:c,__unstable_twoFactorRetryFn:s,appName:l,appVersion:p}=j();if(!d)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const g=o.apiToken;if(!g)throw new Error("No API token defined on session.");const $=sh(u,f),S={"X-Recharge-Access-Token":g,"X-Recharge-Version":"2021-11","X-Recharge-Sdk-Fn":o.internalFnCall,...l?{"X-Recharge-Sdk-App-Name":l}:{},...p?{"X-Recharge-Sdk-App-Version":p}:{},"X-Recharge-Sdk-Version":"1.82.0","X-Request-Id":o.internalRequestId,...o.tmp_fn_identifier?{"X-Recharge-Sdk-Fn-Identifier":o.tmp_fn_identifier}:{},...a||{}},A={shop_url:d,...n};try{return await X(r,`${$}${e}`,{id:t,query:A,data:i,headers:S})}catch(E){if(c&&E instanceof Je&&E.status===401)return c().then(h=>{if(h)return X(r,`${$}${e}`,{id:t,query:A,data:i,headers:{...S,"X-Recharge-Access-Token":h.apiToken}});throw E});if(s&&E instanceof Je&&E.status===423)return s().then(h=>{if(h)return X(r,`${$}${e}`,{id:t,query:A,data:i,headers:{...S,"X-Recharge-Access-Token":h.apiToken}});throw E});throw E}}async function Fe(r,e,t={}){return X(r,`${Xo}${e}`,t)}async function X(r,e,{id:t,query:n,data:i,headers:a}={}){let o=e.trim();if(t&&(o=[o,`${t}`.trim()].join("/")),n){let s;[o,s]=o.split("?");const l=[s,ch(n)].join("&").replace(/^&/,"");o=`${o}${l?`?${l}`:""}`}let u;i&&r!=="get"&&(u=JSON.stringify(i));const f={Accept:"application/json","Content-Type":"application/json","X-Recharge-App":"storefront-client",...a||{}},d=await fetch(o,{method:r,headers:f,body:u});let c;try{c=await d.json()}catch{}if(!d.ok)throw d.status===502||d.status===504?new Je("A gateway error occurred while making the request",d.status):c&&c.error?new Je(c.error,d.status):c&&c.errors?new Je(JSON.stringify(c.errors),d.status):new Je("A connection error occurred while making the request");return c}function lh(r,e){return w("get","/addresses",{query:e},v(r,"listAddresses"))}async function dh(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{address:n}=await w("get","/addresses",{id:e,query:{include:t?.include}},v(r,"getAddress"));return n}async function ph(r,e){const{address:t}=await w("post","/addresses",{data:{customer_id:r.customerId?Number(r.customerId):void 0,...e}},v(r,"createAddress"));return t}async function di(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{address:i}=await w("put","/addresses",{id:e,data:t,query:n},v(r,"updateAddress"));return i}async function hh(r,e,t,n){return di(v(r,"applyDiscountToAddress"),e,{discounts:[{code:t}]},n)}async function yh(r,e,t){if(e===void 0||e==="")throw new Error("Id is required");return di(v(r,"removeDiscountsFromAddress"),e,{discounts:[]},t)}function gh(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/addresses",{id:e},v(r,"deleteAddress"))}async function _h(r,e){const{address:t}=await w("post","/addresses/merge",{data:e},v(r,"mergeAddresses"));return t}async function vh(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/addresses/${e}/charges/skip`,{data:t},v(r,"skipFutureCharge"));return n}var mh=Object.freeze({__proto__:null,applyDiscountToAddress:hh,createAddress:ph,deleteAddress:gh,getAddress:dh,listAddresses:lh,mergeAddresses:_h,removeDiscountsFromAddress:yh,skipFutureCharge:vh,updateAddress:di});async function wh(){const{storefrontAccessToken:r}=j(),e={};r&&(e["X-Recharge-Storefront-Access-Token"]=r);const t=await Fe("get","/access",{headers:e});return{apiToken:t.api_token,customerId:t.customer_id,message:t.message}}async function bh(r,e){return Yo(r,e)}async function Yo(r,e){if(!r)throw new Error("Shopify storefront token is required");const{storeIdentifier:t}=j();if(!t)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const{api_token:n,customer_id:i,message:a}=await Pr("post","/shopify_storefront_access",{data:{customer_token:e,storefront_token:r,shop_url:t}});return n?{apiToken:n,customerId:i,message:a}:null}async function $h(r){const{storeIdentifier:e}=j();if(!e)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const{api_token:t,customer_id:n,message:i}=await Pr("post","/shopify_customer_account_api_access",{data:{customer_token:r,shop_url:e}});return t?{apiToken:t,customerId:n,message:i}:null}async function Eh(r,e={}){if(!r)throw new Error("Email is required.");const{storeIdentifier:t}=j();if(!t)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const n=await Pr("post","/attempt_login",{data:{email:r,shop:t,...e}});if(n.errors)throw new Error(n.errors);return n.session_token}async function Sh(r,e={}){if(!r)throw new Error("Email is required.");const{storefrontAccessToken:t}=j(),n={};t&&(n["X-Recharge-Storefront-Access-Token"]=t);const i=await Fe("post","/attempt_login",{data:{email:r,...e},headers:n});if(i.errors)throw new Error(i.errors);return i.session_token}async function Ah(r,e,t){if(!r)throw new Error("Email is required.");if(!e)throw new Error("Session token is required.");if(!t)throw new Error("Code is required.");const{storeIdentifier:n}=j();if(!n)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const i=await Pr("post","/validate_login",{data:{code:t,email:r,session_token:e,shop:n}});if(i.errors)throw new Error(i.errors);return{apiToken:i.api_token,customerId:i.customer_id}}async function Oh(r,e,t){if(!r)throw new Error("Email is required.");if(!e)throw new Error("Session token is required.");if(!t)throw new Error("Code is required.");const{storefrontAccessToken:n}=j(),i={};n&&(i["X-Recharge-Storefront-Access-Token"]=n);const a=await Fe("post","/validate_login",{data:{code:t,email:r,session_token:e},headers:i});if(a.errors)throw new Error(a.errors);return{apiToken:a.api_token,customerId:a.customer_id}}function Ih(){const{customerHash:r}=j(),{pathname:e,search:t}=window.location,n=new URLSearchParams(t).get("token"),i=e.split("/").filter(Boolean),a=i.findIndex(u=>u==="portal"),o=a!==-1?i[a+1]:r;if(!n||!o)throw new Error("Not in context of Recharge Customer Portal or URL did not contain correct params");return{customerHash:o,token:n}}async function Ph(){const{customerHash:r,token:e}=Ih(),{storeIdentifier:t}=j(),n=await Pr("post",`/customers/${r}/access`,{data:{token:e,shop:t}});return{apiToken:n.api_token,customerId:n.customer_id}}async function Pr(r,e,{id:t,query:n,data:i,headers:a}={}){const{environment:o,environmentUri:u,storefrontAccessToken:f,appName:d,appVersion:c}=j(),s=uh(o,u),l={...f?{"X-Recharge-Storefront-Access-Token":f}:{},...d?{"X-Recharge-Sdk-App-Name":d}:{},...c?{"X-Recharge-Sdk-App-Version":c}:{},"X-Recharge-Sdk-Version":"1.82.0",...a||{}};return X(r,`${s}${e}`,{id:t,query:n,data:i,headers:l})}var xh=Object.freeze({__proto__:null,loginCustomerPortal:Ph,loginShopifyApi:bh,loginShopifyAppProxy:wh,loginWithShopifyCustomerAccount:$h,loginWithShopifyStorefront:Yo,sendPasswordlessCode:Eh,sendPasswordlessCodeAppProxy:Sh,validatePasswordlessCode:Ah,validatePasswordlessCodeAppProxy:Oh}),Ko={},pi={},ce={},Th=typeof D=="object"&&D&&D.Object===Object&&D,Zo=Th,Fh=Zo,Rh=typeof self=="object"&&self&&self.Object===Object&&self,Mh=Fh||Rh||Function("return this")(),le=Mh,Dh=le,Ch=Dh.Symbol,Ot=Ch,Jo=Ot,Qo=Object.prototype,Nh=Qo.hasOwnProperty,Bh=Qo.toString,xr=Jo?Jo.toStringTag:void 0;function qh(r){var e=Nh.call(r,xr),t=r[xr];try{r[xr]=void 0;var n=!0}catch{}var i=Bh.call(r);return n&&(e?r[xr]=t:delete r[xr]),i}var Uh=qh,Lh=Object.prototype,kh=Lh.toString;function jh(r){return kh.call(r)}var Vh=jh,es=Ot,Gh=Uh,Hh=Vh,Wh="[object Null]",zh="[object Undefined]",rs=es?es.toStringTag:void 0;function Xh(r){return r==null?r===void 0?zh:Wh:rs&&rs in Object(r)?Gh(r):Hh(r)}var _e=Xh;function Yh(r){return r!=null&&typeof r=="object"}var ve=Yh,Kh=_e,Zh=ve,Jh="[object Number]";function Qh(r){return typeof r=="number"||Zh(r)&&Kh(r)==Jh}var It=Qh,M={};function ey(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var Qe=ey,ry=_e,ty=Qe,ny="[object AsyncFunction]",iy="[object Function]",ay="[object GeneratorFunction]",oy="[object Proxy]";function sy(r){if(!ty(r))return!1;var e=ry(r);return e==iy||e==ay||e==ny||e==oy}var hi=sy,uy=le,fy=uy["__core-js_shared__"],cy=fy,yi=cy,ts=function(){var r=/[^.]+$/.exec(yi&&yi.keys&&yi.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function ly(r){return!!ts&&ts in r}var dy=ly,py=Function.prototype,hy=py.toString;function yy(r){if(r!=null){try{return hy.call(r)}catch{}try{return r+""}catch{}}return""}var ns=yy,gy=hi,_y=dy,vy=Qe,my=ns,wy=/[\\^$.*+?()[\]{}|]/g,by=/^\[object .+?Constructor\]$/,$y=Function.prototype,Ey=Object.prototype,Sy=$y.toString,Ay=Ey.hasOwnProperty,Oy=RegExp("^"+Sy.call(Ay).replace(wy,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Iy(r){if(!vy(r)||_y(r))return!1;var e=gy(r)?Oy:by;return e.test(my(r))}var Py=Iy;function xy(r,e){return r?.[e]}var Ty=xy,Fy=Py,Ry=Ty;function My(r,e){var t=Ry(r,e);return Fy(t)?t:void 0}var Re=My,Dy=Re,Cy=function(){try{var r=Dy(Object,"defineProperty");return r({},"",{}),r}catch{}}(),is=Cy,as=is;function Ny(r,e,t){e=="__proto__"&&as?as(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var os=Ny;function By(r,e){return r===e||r!==r&&e!==e}var Pt=By,qy=os,Uy=Pt,Ly=Object.prototype,ky=Ly.hasOwnProperty;function jy(r,e,t){var n=r[e];(!(ky.call(r,e)&&Uy(n,t))||t===void 0&&!(e in r))&&qy(r,e,t)}var Vy=jy,Gy=Vy,Hy=os;function Wy(r,e,t,n){var i=!t;t||(t={});for(var a=-1,o=e.length;++a<o;){var u=e[a],f=n?n(t[u],r[u],u,t,r):void 0;f===void 0&&(f=r[u]),i?Hy(t,u,f):Gy(t,u,f)}return t}var zy=Wy;function Xy(r){return r}var xt=Xy;function Yy(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}var Ky=Yy,Zy=Ky,ss=Math.max;function Jy(r,e,t){return e=ss(e===void 0?r.length-1:e,0),function(){for(var n=arguments,i=-1,a=ss(n.length-e,0),o=Array(a);++i<a;)o[i]=n[e+i];i=-1;for(var u=Array(e+1);++i<e;)u[i]=n[i];return u[e]=t(o),Zy(r,this,u)}}var Qy=Jy;function eg(r){return function(){return r}}var rg=eg,tg=rg,us=is,ng=xt,ig=us?function(r,e){return us(r,"toString",{configurable:!0,enumerable:!1,value:tg(e),writable:!0})}:ng,ag=ig,og=800,sg=16,ug=Date.now;function fg(r){var e=0,t=0;return function(){var n=ug(),i=sg-(n-t);if(t=n,i>0){if(++e>=og)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}var cg=fg,lg=ag,dg=cg,pg=dg(lg),hg=pg,yg=xt,gg=Qy,_g=hg;function vg(r,e){return _g(gg(r,e,yg),r+"")}var mg=vg,wg=9007199254740991;function bg(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=wg}var gi=bg,$g=hi,Eg=gi;function Sg(r){return r!=null&&Eg(r.length)&&!$g(r)}var Tr=Sg,Ag=9007199254740991,Og=/^(?:0|[1-9]\d*)$/;function Ig(r,e){var t=typeof r;return e=e??Ag,!!e&&(t=="number"||t!="symbol"&&Og.test(r))&&r>-1&&r%1==0&&r<e}var _i=Ig,Pg=Pt,xg=Tr,Tg=_i,Fg=Qe;function Rg(r,e,t){if(!Fg(t))return!1;var n=typeof e;return(n=="number"?xg(t)&&Tg(e,t.length):n=="string"&&e in t)?Pg(t[e],r):!1}var fs=Rg,Mg=mg,Dg=fs;function Cg(r){return Mg(function(e,t){var n=-1,i=t.length,a=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(a=r.length>3&&typeof a=="function"?(i--,a):void 0,o&&Dg(t[0],t[1],o)&&(a=i<3?void 0:a,i=1),e=Object(e);++n<i;){var u=t[n];u&&r(e,u,n,a)}return e})}var Ng=Cg;function Bg(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var cs=Bg,qg=_e,Ug=ve,Lg="[object Arguments]";function kg(r){return Ug(r)&&qg(r)==Lg}var jg=kg,ls=jg,Vg=ve,ds=Object.prototype,Gg=ds.hasOwnProperty,Hg=ds.propertyIsEnumerable,Wg=ls(function(){return arguments}())?ls:function(r){return Vg(r)&&Gg.call(r,"callee")&&!Hg.call(r,"callee")},ps=Wg,zg=Array.isArray,V=zg,Tt={exports:{}};function Xg(){return!1}var Yg=Xg;Tt.exports,function(r,e){var t=le,n=Yg,i=e&&!e.nodeType&&e,a=i&&!0&&r&&!r.nodeType&&r,o=a&&a.exports===i,u=o?t.Buffer:void 0,f=u?u.isBuffer:void 0,d=f||n;r.exports=d}(Tt,Tt.exports);var hs=Tt.exports,Kg=_e,Zg=gi,Jg=ve,Qg="[object Arguments]",e_="[object Array]",r_="[object Boolean]",t_="[object Date]",n_="[object Error]",i_="[object Function]",a_="[object Map]",o_="[object Number]",s_="[object Object]",u_="[object RegExp]",f_="[object Set]",c_="[object String]",l_="[object WeakMap]",d_="[object ArrayBuffer]",p_="[object DataView]",h_="[object Float32Array]",y_="[object Float64Array]",g_="[object Int8Array]",__="[object Int16Array]",v_="[object Int32Array]",m_="[object Uint8Array]",w_="[object Uint8ClampedArray]",b_="[object Uint16Array]",$_="[object Uint32Array]",R={};R[h_]=R[y_]=R[g_]=R[__]=R[v_]=R[m_]=R[w_]=R[b_]=R[$_]=!0,R[Qg]=R[e_]=R[d_]=R[r_]=R[p_]=R[t_]=R[n_]=R[i_]=R[a_]=R[o_]=R[s_]=R[u_]=R[f_]=R[c_]=R[l_]=!1;function E_(r){return Jg(r)&&Zg(r.length)&&!!R[Kg(r)]}var S_=E_;function A_(r){return function(e){return r(e)}}var O_=A_,Ft={exports:{}};Ft.exports,function(r,e){var t=Zo,n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,o=a&&t.process,u=function(){try{var f=i&&i.require&&i.require("util").types;return f||o&&o.binding&&o.binding("util")}catch{}}();r.exports=u}(Ft,Ft.exports);var I_=Ft.exports,P_=S_,x_=O_,ys=I_,gs=ys&&ys.isTypedArray,T_=gs?x_(gs):P_,_s=T_,F_=cs,R_=ps,M_=V,D_=hs,C_=_i,N_=_s,B_=Object.prototype,q_=B_.hasOwnProperty;function U_(r,e){var t=M_(r),n=!t&&R_(r),i=!t&&!n&&D_(r),a=!t&&!n&&!i&&N_(r),o=t||n||i||a,u=o?F_(r.length,String):[],f=u.length;for(var d in r)(e||q_.call(r,d))&&!(o&&(d=="length"||i&&(d=="offset"||d=="parent")||a&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||C_(d,f)))&&u.push(d);return u}var vs=U_,L_=Object.prototype;function k_(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||L_;return r===t}var ms=k_;function j_(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var V_=j_,G_=Qe,H_=ms,W_=V_,z_=Object.prototype,X_=z_.hasOwnProperty;function Y_(r){if(!G_(r))return W_(r);var e=H_(r),t=[];for(var n in r)n=="constructor"&&(e||!X_.call(r,n))||t.push(n);return t}var K_=Y_,Z_=vs,J_=K_,Q_=Tr;function ev(r){return Q_(r)?Z_(r,!0):J_(r)}var rv=ev,tv=zy,nv=Ng,iv=rv,av=nv(function(r,e){tv(e,iv(e),r)}),ov=av,sv=ov,Rt={},Me={};function uv(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(!e(r[t],t,r))return!1;return!0}var fv=uv;function cv(r){return function(e,t,n){for(var i=-1,a=Object(e),o=n(e),u=o.length;u--;){var f=o[r?u:++i];if(t(a[f],f,a)===!1)break}return e}}var lv=cv,dv=lv,pv=dv(),hv=pv;function yv(r,e){return function(t){return r(e(t))}}var gv=yv,_v=gv,vv=_v(Object.keys,Object),mv=vv,wv=ms,bv=mv,$v=Object.prototype,Ev=$v.hasOwnProperty;function Sv(r){if(!wv(r))return bv(r);var e=[];for(var t in Object(r))Ev.call(r,t)&&t!="constructor"&&e.push(t);return e}var Av=Sv,Ov=vs,Iv=Av,Pv=Tr;function xv(r){return Pv(r)?Ov(r):Iv(r)}var Mt=xv,Tv=hv,Fv=Mt;function Rv(r,e){return r&&Tv(r,e,Fv)}var Mv=Rv,Dv=Tr;function Cv(r,e){return function(t,n){if(t==null)return t;if(!Dv(t))return r(t,n);for(var i=t.length,a=e?i:-1,o=Object(t);(e?a--:++a<i)&&n(o[a],a,o)!==!1;);return t}}var Nv=Cv,Bv=Mv,qv=Nv,Uv=qv(Bv),vi=Uv,Lv=vi;function kv(r,e){var t=!0;return Lv(r,function(n,i,a){return t=!!e(n,i,a),t}),t}var jv=kv;function Vv(){this.__data__=[],this.size=0}var Gv=Vv,Hv=Pt;function Wv(r,e){for(var t=r.length;t--;)if(Hv(r[t][0],e))return t;return-1}var Dt=Wv,zv=Dt,Xv=Array.prototype,Yv=Xv.splice;function Kv(r){var e=this.__data__,t=zv(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():Yv.call(e,t,1),--this.size,!0}var Zv=Kv,Jv=Dt;function Qv(r){var e=this.__data__,t=Jv(e,r);return t<0?void 0:e[t][1]}var em=Qv,rm=Dt;function tm(r){return rm(this.__data__,r)>-1}var nm=tm,im=Dt;function am(r,e){var t=this.__data__,n=im(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var om=am,sm=Gv,um=Zv,fm=em,cm=nm,lm=om;function er(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}er.prototype.clear=sm,er.prototype.delete=um,er.prototype.get=fm,er.prototype.has=cm,er.prototype.set=lm;var Ct=er,dm=Ct;function pm(){this.__data__=new dm,this.size=0}var hm=pm;function ym(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var gm=ym;function _m(r){return this.__data__.get(r)}var vm=_m;function mm(r){return this.__data__.has(r)}var wm=mm,bm=Re,$m=le,Em=bm($m,"Map"),mi=Em,Sm=Re,Am=Sm(Object,"create"),Nt=Am,ws=Nt;function Om(){this.__data__=ws?ws(null):{},this.size=0}var Im=Om;function Pm(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var xm=Pm,Tm=Nt,Fm="__lodash_hash_undefined__",Rm=Object.prototype,Mm=Rm.hasOwnProperty;function Dm(r){var e=this.__data__;if(Tm){var t=e[r];return t===Fm?void 0:t}return Mm.call(e,r)?e[r]:void 0}var Cm=Dm,Nm=Nt,Bm=Object.prototype,qm=Bm.hasOwnProperty;function Um(r){var e=this.__data__;return Nm?e[r]!==void 0:qm.call(e,r)}var Lm=Um,km=Nt,jm="__lodash_hash_undefined__";function Vm(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=km&&e===void 0?jm:e,this}var Gm=Vm,Hm=Im,Wm=xm,zm=Cm,Xm=Lm,Ym=Gm;function rr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}rr.prototype.clear=Hm,rr.prototype.delete=Wm,rr.prototype.get=zm,rr.prototype.has=Xm,rr.prototype.set=Ym;var Km=rr,bs=Km,Zm=Ct,Jm=mi;function Qm(){this.size=0,this.__data__={hash:new bs,map:new(Jm||Zm),string:new bs}}var ew=Qm;function rw(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var tw=rw,nw=tw;function iw(r,e){var t=r.__data__;return nw(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Bt=iw,aw=Bt;function ow(r){var e=aw(this,r).delete(r);return this.size-=e?1:0,e}var sw=ow,uw=Bt;function fw(r){return uw(this,r).get(r)}var cw=fw,lw=Bt;function dw(r){return lw(this,r).has(r)}var pw=dw,hw=Bt;function yw(r,e){var t=hw(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var gw=yw,_w=ew,vw=sw,mw=cw,ww=pw,bw=gw;function tr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}tr.prototype.clear=_w,tr.prototype.delete=vw,tr.prototype.get=mw,tr.prototype.has=ww,tr.prototype.set=bw;var wi=tr,$w=Ct,Ew=mi,Sw=wi,Aw=200;function Ow(r,e){var t=this.__data__;if(t instanceof $w){var n=t.__data__;if(!Ew||n.length<Aw-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new Sw(n)}return t.set(r,e),this.size=t.size,this}var Iw=Ow,Pw=Ct,xw=hm,Tw=gm,Fw=vm,Rw=wm,Mw=Iw;function nr(r){var e=this.__data__=new Pw(r);this.size=e.size}nr.prototype.clear=xw,nr.prototype.delete=Tw,nr.prototype.get=Fw,nr.prototype.has=Rw,nr.prototype.set=Mw;var $s=nr,Dw="__lodash_hash_undefined__";function Cw(r){return this.__data__.set(r,Dw),this}var Nw=Cw;function Bw(r){return this.__data__.has(r)}var qw=Bw,Uw=wi,Lw=Nw,kw=qw;function qt(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Uw;++e<t;)this.add(r[e])}qt.prototype.add=qt.prototype.push=Lw,qt.prototype.has=kw;var jw=qt;function Vw(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(e(r[t],t,r))return!0;return!1}var Gw=Vw;function Hw(r,e){return r.has(e)}var Ww=Hw,zw=jw,Xw=Gw,Yw=Ww,Kw=1,Zw=2;function Jw(r,e,t,n,i,a){var o=t&Kw,u=r.length,f=e.length;if(u!=f&&!(o&&f>u))return!1;var d=a.get(r),c=a.get(e);if(d&&c)return d==e&&c==r;var s=-1,l=!0,p=t&Zw?new zw:void 0;for(a.set(r,e),a.set(e,r);++s<u;){var g=r[s],$=e[s];if(n)var S=o?n($,g,s,e,r,a):n(g,$,s,r,e,a);if(S!==void 0){if(S)continue;l=!1;break}if(p){if(!Xw(e,function(A,E){if(!Yw(p,E)&&(g===A||i(g,A,t,n,a)))return p.push(E)})){l=!1;break}}else if(!(g===$||i(g,$,t,n,a))){l=!1;break}}return a.delete(r),a.delete(e),l}var Es=Jw,Qw=le,e0=Qw.Uint8Array,r0=e0;function t0(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}var n0=t0;function i0(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var a0=i0,Ss=Ot,As=r0,o0=Pt,s0=Es,u0=n0,f0=a0,c0=1,l0=2,d0="[object Boolean]",p0="[object Date]",h0="[object Error]",y0="[object Map]",g0="[object Number]",_0="[object RegExp]",v0="[object Set]",m0="[object String]",w0="[object Symbol]",b0="[object ArrayBuffer]",$0="[object DataView]",Os=Ss?Ss.prototype:void 0,bi=Os?Os.valueOf:void 0;function E0(r,e,t,n,i,a,o){switch(t){case $0:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case b0:return!(r.byteLength!=e.byteLength||!a(new As(r),new As(e)));case d0:case p0:case g0:return o0(+r,+e);case h0:return r.name==e.name&&r.message==e.message;case _0:case m0:return r==e+"";case y0:var u=u0;case v0:var f=n&c0;if(u||(u=f0),r.size!=e.size&&!f)return!1;var d=o.get(r);if(d)return d==e;n|=l0,o.set(r,e);var c=s0(u(r),u(e),n,i,a,o);return o.delete(r),c;case w0:if(bi)return bi.call(r)==bi.call(e)}return!1}var S0=E0;function A0(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}var O0=A0,I0=O0,P0=V;function x0(r,e,t){var n=e(r);return P0(r)?n:I0(n,t(r))}var T0=x0;function F0(r,e){for(var t=-1,n=r==null?0:r.length,i=0,a=[];++t<n;){var o=r[t];e(o,t,r)&&(a[i++]=o)}return a}var R0=F0;function M0(){return[]}var D0=M0,C0=R0,N0=D0,B0=Object.prototype,q0=B0.propertyIsEnumerable,Is=Object.getOwnPropertySymbols,U0=Is?function(r){return r==null?[]:(r=Object(r),C0(Is(r),function(e){return q0.call(r,e)}))}:N0,L0=U0,k0=T0,j0=L0,V0=Mt;function G0(r){return k0(r,V0,j0)}var H0=G0,Ps=H0,W0=1,z0=Object.prototype,X0=z0.hasOwnProperty;function Y0(r,e,t,n,i,a){var o=t&W0,u=Ps(r),f=u.length,d=Ps(e),c=d.length;if(f!=c&&!o)return!1;for(var s=f;s--;){var l=u[s];if(!(o?l in e:X0.call(e,l)))return!1}var p=a.get(r),g=a.get(e);if(p&&g)return p==e&&g==r;var $=!0;a.set(r,e),a.set(e,r);for(var S=o;++s<f;){l=u[s];var A=r[l],E=e[l];if(n)var h=o?n(E,A,l,e,r,a):n(A,E,l,r,e,a);if(!(h===void 0?A===E||i(A,E,t,n,a):h)){$=!1;break}S||(S=l=="constructor")}if($&&!S){var I=r.constructor,T=e.constructor;I!=T&&"constructor"in r&&"constructor"in e&&!(typeof I=="function"&&I instanceof I&&typeof T=="function"&&T instanceof T)&&($=!1)}return a.delete(r),a.delete(e),$}var K0=Y0,Z0=Re,J0=le,Q0=Z0(J0,"DataView"),eb=Q0,rb=Re,tb=le,nb=rb(tb,"Promise"),ib=nb,ab=Re,ob=le,sb=ab(ob,"Set"),ub=sb,fb=Re,cb=le,lb=fb(cb,"WeakMap"),db=lb,$i=eb,Ei=mi,Si=ib,Ai=ub,Oi=db,xs=_e,ir=ns,Ts="[object Map]",pb="[object Object]",Fs="[object Promise]",Rs="[object Set]",Ms="[object WeakMap]",Ds="[object DataView]",hb=ir($i),yb=ir(Ei),gb=ir(Si),_b=ir(Ai),vb=ir(Oi),De=xs;($i&&De(new $i(new ArrayBuffer(1)))!=Ds||Ei&&De(new Ei)!=Ts||Si&&De(Si.resolve())!=Fs||Ai&&De(new Ai)!=Rs||Oi&&De(new Oi)!=Ms)&&(De=function(r){var e=xs(r),t=e==pb?r.constructor:void 0,n=t?ir(t):"";if(n)switch(n){case hb:return Ds;case yb:return Ts;case gb:return Fs;case _b:return Rs;case vb:return Ms}return e});var mb=De,Ii=$s,wb=Es,bb=S0,$b=K0,Cs=mb,Ns=V,Bs=hs,Eb=_s,Sb=1,qs="[object Arguments]",Us="[object Array]",Ut="[object Object]",Ab=Object.prototype,Ls=Ab.hasOwnProperty;function Ob(r,e,t,n,i,a){var o=Ns(r),u=Ns(e),f=o?Us:Cs(r),d=u?Us:Cs(e);f=f==qs?Ut:f,d=d==qs?Ut:d;var c=f==Ut,s=d==Ut,l=f==d;if(l&&Bs(r)){if(!Bs(e))return!1;o=!0,c=!1}if(l&&!c)return a||(a=new Ii),o||Eb(r)?wb(r,e,t,n,i,a):bb(r,e,f,t,n,i,a);if(!(t&Sb)){var p=c&&Ls.call(r,"__wrapped__"),g=s&&Ls.call(e,"__wrapped__");if(p||g){var $=p?r.value():r,S=g?e.value():e;return a||(a=new Ii),i($,S,t,n,a)}}return l?(a||(a=new Ii),$b(r,e,t,n,i,a)):!1}var Ib=Ob,Pb=Ib,ks=ve;function js(r,e,t,n,i){return r===e?!0:r==null||e==null||!ks(r)&&!ks(e)?r!==r&&e!==e:Pb(r,e,t,n,js,i)}var Vs=js,xb=$s,Tb=Vs,Fb=1,Rb=2;function Mb(r,e,t,n){var i=t.length,a=i,o=!n;if(r==null)return!a;for(r=Object(r);i--;){var u=t[i];if(o&&u[2]?u[1]!==r[u[0]]:!(u[0]in r))return!1}for(;++i<a;){u=t[i];var f=u[0],d=r[f],c=u[1];if(o&&u[2]){if(d===void 0&&!(f in r))return!1}else{var s=new xb;if(n)var l=n(d,c,f,r,e,s);if(!(l===void 0?Tb(c,d,Fb|Rb,n,s):l))return!1}}return!0}var Db=Mb,Cb=Qe;function Nb(r){return r===r&&!Cb(r)}var Gs=Nb,Bb=Gs,qb=Mt;function Ub(r){for(var e=qb(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,Bb(i)]}return e}var Lb=Ub;function kb(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}var Hs=kb,jb=Db,Vb=Lb,Gb=Hs;function Hb(r){var e=Vb(r);return e.length==1&&e[0][2]?Gb(e[0][0],e[0][1]):function(t){return t===r||jb(t,r,e)}}var Wb=Hb,zb=_e,Xb=ve,Yb="[object Symbol]";function Kb(r){return typeof r=="symbol"||Xb(r)&&zb(r)==Yb}var Lt=Kb,Zb=V,Jb=Lt,Qb=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,e1=/^\w*$/;function r1(r,e){if(Zb(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||Jb(r)?!0:e1.test(r)||!Qb.test(r)||e!=null&&r in Object(e)}var Pi=r1,Ws=wi,t1="Expected a function";function xi(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(t1);var t=function(){var n=arguments,i=e?e.apply(this,n):n[0],a=t.cache;if(a.has(i))return a.get(i);var o=r.apply(this,n);return t.cache=a.set(i,o)||a,o};return t.cache=new(xi.Cache||Ws),t}xi.Cache=Ws;var n1=xi,i1=n1,a1=500;function o1(r){var e=i1(r,function(n){return t.size===a1&&t.clear(),n}),t=e.cache;return e}var s1=o1,u1=s1,f1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,c1=/\\(\\)?/g,l1=u1(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(f1,function(t,n,i,a){e.push(i?a.replace(c1,"$1"):n||t)}),e}),d1=l1;function p1(r,e){for(var t=-1,n=r==null?0:r.length,i=Array(n);++t<n;)i[t]=e(r[t],t,r);return i}var Ti=p1,zs=Ot,h1=Ti,y1=V,g1=Lt,_1=1/0,Xs=zs?zs.prototype:void 0,Ys=Xs?Xs.toString:void 0;function Ks(r){if(typeof r=="string")return r;if(y1(r))return h1(r,Ks)+"";if(g1(r))return Ys?Ys.call(r):"";var e=r+"";return e=="0"&&1/r==-_1?"-0":e}var v1=Ks,m1=v1;function w1(r){return r==null?"":m1(r)}var b1=w1,$1=V,E1=Pi,S1=d1,A1=b1;function O1(r,e){return $1(r)?r:E1(r,e)?[r]:S1(A1(r))}var Zs=O1,I1=Lt,P1=1/0;function x1(r){if(typeof r=="string"||I1(r))return r;var e=r+"";return e=="0"&&1/r==-P1?"-0":e}var kt=x1,T1=Zs,F1=kt;function R1(r,e){e=T1(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[F1(e[t++])];return t&&t==n?r:void 0}var Js=R1,M1=Js;function D1(r,e,t){var n=r==null?void 0:M1(r,e);return n===void 0?t:n}var C1=D1;function N1(r,e){return r!=null&&e in Object(r)}var B1=N1,q1=Zs,U1=ps,L1=V,k1=_i,j1=gi,V1=kt;function G1(r,e,t){e=q1(e,r);for(var n=-1,i=e.length,a=!1;++n<i;){var o=V1(e[n]);if(!(a=r!=null&&t(r,o)))break;r=r[o]}return a||++n!=i?a:(i=r==null?0:r.length,!!i&&j1(i)&&k1(o,i)&&(L1(r)||U1(r)))}var H1=G1,W1=B1,z1=H1;function X1(r,e){return r!=null&&z1(r,e,W1)}var Y1=X1,K1=Vs,Z1=C1,J1=Y1,Q1=Pi,e$=Gs,r$=Hs,t$=kt,n$=1,i$=2;function a$(r,e){return Q1(r)&&e$(e)?r$(t$(r),e):function(t){var n=Z1(t,r);return n===void 0&&n===e?J1(t,r):K1(e,n,n$|i$)}}var o$=a$;function s$(r){return function(e){return e?.[r]}}var u$=s$,f$=Js;function c$(r){return function(e){return f$(e,r)}}var l$=c$,d$=u$,p$=l$,h$=Pi,y$=kt;function g$(r){return h$(r)?d$(y$(r)):p$(r)}var _$=g$,v$=Wb,m$=o$,w$=xt,b$=V,$$=_$;function E$(r){return typeof r=="function"?r:r==null?w$:typeof r=="object"?b$(r)?m$(r[0],r[1]):v$(r):$$(r)}var Qs=E$,S$=fv,A$=jv,O$=Qs,I$=V,P$=fs;function x$(r,e,t){var n=I$(r)?S$:A$;return t&&P$(r,e,t)&&(e=void 0),n(r,O$(e))}var Fi=x$;Object.defineProperty(Me,"__esModule",{value:!0}),Me.calculatePadding=M$,Me.slicePadding=D$;var T$=Fi,F$=R$(T$);function R$(r){return r&&r.__esModule?r:{default:r}}function M$(r){switch(r%4){case 0:return 0;case 1:return 3;case 2:return 2;case 3:return 1;default:return null}}function D$(r,e){var t=r.slice(e),n=(0,F$.default)(t.buffer(),function(i){return i===0});if(n!==!0)throw new Error("XDR Read Error: invalid padding")}Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.Cursor=void 0;var C$=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),N$=Me;function B$(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Ri=function(){function r(e){B$(this,r),e instanceof y||(e=typeof e=="number"?y.alloc(e):y.from(e)),this._setBuffer(e),this.rewind()}return C$(r,[{key:"_setBuffer",value:function(t){this._buffer=t,this.length=t.length}},{key:"buffer",value:function(){return this._buffer}},{key:"tap",value:function(t){return t(this),this}},{key:"clone",value:function(t){var n=new this.constructor(this.buffer());return n.seek(arguments.length===0?this.tell():t),n}},{key:"tell",value:function(){return this._index}},{key:"seek",value:function(t,n){return arguments.length===1&&(n=t,t="="),t==="+"?this._index+=n:t==="-"?this._index-=n:this._index=n,this}},{key:"rewind",value:function(){return this.seek(0)}},{key:"eof",value:function(){return this.tell()===this.buffer().length}},{key:"write",value:function(t,n,i){return this.seek("+",this.buffer().write(t,this.tell(),n,i))}},{key:"fill",value:function(t,n){return arguments.length===1&&(n=this.buffer().length-this.tell()),this.buffer().fill(t,this.tell(),this.tell()+n),this.seek("+",n),this}},{key:"slice",value:function(t){arguments.length===0&&(t=this.length-this.tell());var n=new this.constructor(this.buffer().slice(this.tell(),this.tell()+t));return this.seek("+",t),n}},{key:"copyFrom",value:function(t){var n=t instanceof y?t:t.buffer();return n.copy(this.buffer(),this.tell(),0,n.length),this.seek("+",n.length),this}},{key:"concat",value:function(t){t.forEach(function(i,a){i instanceof r&&(t[a]=i.buffer())}),t.unshift(this.buffer());var n=y.concat(t);return this._setBuffer(n),this}},{key:"toString",value:function(t,n){arguments.length===0?(t="utf8",n=this.buffer().length-this.tell()):arguments.length===1&&(n=this.buffer().length-this.tell());var i=this.buffer().toString(t,this.tell(),this.tell()+n);return this.seek("+",n),i}},{key:"writeBufferPadded",value:function(t){var n=(0,N$.calculatePadding)(t.length),i=y.alloc(n);return this.copyFrom(new r(t)).copyFrom(new r(i))}}]),r}();[[1,["readInt8","readUInt8"]],[2,["readInt16BE","readInt16LE","readUInt16BE","readUInt16LE"]],[4,["readInt32BE","readInt32LE","readUInt32BE","readUInt32LE","readFloatBE","readFloatLE"]],[8,["readDoubleBE","readDoubleLE"]]].forEach(function(r){r[1].forEach(function(e){Ri.prototype[e]=function(){var n=this.buffer()[e](this.tell());return this.seek("+",r[0]),n}})}),[[1,["writeInt8","writeUInt8"]],[2,["writeInt16BE","writeInt16LE","writeUInt16BE","writeUInt16LE"]],[4,["writeInt32BE","writeInt32LE","writeUInt32BE","writeUInt32LE","writeFloatBE","writeFloatLE"]],[8,["writeDoubleBE","writeDoubleLE"]]].forEach(function(r){r[1].forEach(function(e){Ri.prototype[e]=function(n){return this.buffer()[e](n,this.tell()),this.seek("+",r[0]),this}})}),Rt.Cursor=Ri,Object.defineProperty(M,"__esModule",{value:!0}),M.default=G$;var q$=sv,eu=tu(q$),U$=hi,L$=tu(U$),ru=Rt;function tu(r){return r&&r.__esModule?r:{default:r}}var k$=Math.pow(2,16),j$={toXDR:function(e){var t=new ru.Cursor(k$);this.write(e,t);var n=t.tell();return t.rewind(),t.slice(n).buffer()},fromXDR:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw",n=void 0;switch(t){case"raw":n=e;break;case"hex":n=y.from(e,"hex");break;case"base64":n=y.from(e,"base64");break;default:throw new Error("Invalid format "+t+', must be "raw", "hex", "base64"')}var i=new ru.Cursor(n),a=this.read(i);return a},validateXDR:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw";try{return this.fromXDR(e,t),!0}catch{return!1}}},V$={toXDR:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"raw",t=this.constructor.toXDR(this);switch(e){case"raw":return t;case"hex":return t.toString("hex");case"base64":return t.toString("base64");default:throw new Error("Invalid format "+e+', must be "raw", "hex", "base64"')}}};function G$(r){(0,eu.default)(r,j$),(0,L$.default)(r)&&(0,eu.default)(r.prototype,V$)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.Int=void 0;var H$=It,nu=iu(H$),W$=M,z$=iu(W$);function iu(r){return r&&r.__esModule?r:{default:r}}var Fr=ce.Int={read:function(e){return e.readInt32BE()},write:function(e,t){if(!(0,nu.default)(e))throw new Error("XDR Write Error: not a number");if(Math.floor(e)!==e)throw new Error("XDR Write Error: not an integer");t.writeInt32BE(e)},isValid:function(e){return!(0,nu.default)(e)||Math.floor(e)!==e?!1:e>=Fr.MIN_VALUE&&e<=Fr.MAX_VALUE}};Fr.MAX_VALUE=Math.pow(2,31)-1,Fr.MIN_VALUE=-Math.pow(2,31),(0,z$.default)(Fr);var jt={};function X$(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var au={exports:{}};(function(r){/**
|
|
20
|
+
`+e.prev}function pt(r,e){var t=Vn(r),n=[];if(t){n.length=r.length;for(var i=0;i<r.length;i++)n[i]=fe(r,i)?e(r[i],r):""}var a=typeof Ln=="function"?Ln(r):[],o;if(We){o={};for(var u=0;u<a.length;u++)o["$"+a[u]]=a[u]}for(var f in r)fe(r,f)&&(t&&String(Number(f))===f&&f<r.length||We&&o["$"+f]instanceof Symbol||(Ja.call(/[^\w$]/,f)?n.push(e(f,r)+": "+e(r[f],r)):n.push(f+": "+e(r[f],r))));if(typeof Ln=="function")for(var d=0;d<a.length;d++)ro.call(r,a[d])&&n.push("["+e(a[d])+"]: "+e(r[a[d]],r));return n}var rd=dt,td=ke,ht=function(r,e,t){for(var n=r,i;(i=n.next)!=null;n=i)if(i.key===e)return n.next=i.next,t||(i.next=r.next,r.next=i),i},nd=function(r,e){if(r){var t=ht(r,e);return t&&t.value}},id=function(r,e,t){var n=ht(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},ad=function(r,e){return r?!!ht(r,e):!1},od=function(r,e){if(r)return ht(r,e,!0)},sd=function(){var e,t={assert:function(n){if(!t.has(n))throw new td("Side channel does not contain "+rd(n))},delete:function(n){var i=e&&e.next,a=od(e,n);return a&&i&&i===a&&(e=void 0),!!a},get:function(n){return nd(e,n)},has:function(n){return ad(e,n)},set:function(n,i){e||(e={next:void 0}),id(e,n,i)}};return t},ho=Object,ud=Error,fd=EvalError,cd=RangeError,ld=ReferenceError,dd=SyntaxError,pd=URIError,hd=Math.abs,yd=Math.floor,gd=Math.max,_d=Math.min,vd=Math.pow,md=Math.round,wd=Number.isNaN||function(e){return e!==e},bd=wd,$d=function(e){return bd(e)||e===0?e:e<0?-1:1},Ed=Object.getOwnPropertyDescriptor,yt=Ed;if(yt)try{yt([],"length")}catch{yt=null}var yo=yt,gt=Object.defineProperty||!1;if(gt)try{gt({},"a",{value:1})}catch{gt=!1}var Sd=gt,Wn,go;function Ad(){return go||(go=1,Wn=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var a in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var u=Object.getOwnPropertyDescriptor(e,t);if(u.value!==i||u.enumerable!==!0)return!1}return!0}),Wn}var zn,_o;function Od(){if(_o)return zn;_o=1;var r=typeof Symbol<"u"&&Symbol,e=Ad();return zn=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},zn}var Xn,vo;function mo(){return vo||(vo=1,Xn=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Xn}var Yn,wo;function bo(){if(wo)return Yn;wo=1;var r=ho;return Yn=r.getPrototypeOf||null,Yn}var Kn,$o;function Id(){if($o)return Kn;$o=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,n="[object Function]",i=function(f,d){for(var c=[],s=0;s<f.length;s+=1)c[s]=f[s];for(var l=0;l<d.length;l+=1)c[l+f.length]=d[l];return c},a=function(f,d){for(var c=[],s=d||0,l=0;s<f.length;s+=1,l+=1)c[l]=f[s];return c},o=function(u,f){for(var d="",c=0;c<u.length;c+=1)d+=u[c],c+1<u.length&&(d+=f);return d};return Kn=function(f){var d=this;if(typeof d!="function"||e.apply(d)!==n)throw new TypeError(r+d);for(var c=a(arguments,1),s,l=function(){if(this instanceof s){var A=d.apply(this,i(c,arguments));return Object(A)===A?A:this}return d.apply(f,i(c,arguments))},p=t(0,d.length-c.length),g=[],$=0;$<p;$++)g[$]="$"+$;if(s=Function("binder","return function ("+o(g,",")+"){ return binder.apply(this,arguments); }")(l),d.prototype){var S=function(){};S.prototype=d.prototype,s.prototype=new S,S.prototype=null}return s},Kn}var Zn,Eo;function _t(){if(Eo)return Zn;Eo=1;var r=Id();return Zn=Function.prototype.bind||r,Zn}var Jn=Function.prototype.call,Qn,So;function Ao(){return So||(So=1,Qn=Function.prototype.apply),Qn}var Pd=typeof Reflect<"u"&&Reflect&&Reflect.apply,xd=_t(),Td=Ao(),Fd=Jn,Rd=Pd,Md=Rd||xd.call(Fd,Td),Dd=_t(),Cd=ke,Nd=Jn,Bd=Md,Oo=function(e){if(e.length<1||typeof e[0]!="function")throw new Cd("a function is required");return Bd(Dd,Nd,e)},ei,Io;function qd(){if(Io)return ei;Io=1;var r=Oo,e=yo,t;try{t=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var n=!!t&&e&&e(Object.prototype,"__proto__"),i=Object,a=i.getPrototypeOf;return ei=n&&typeof n.get=="function"?r([n.get]):typeof a=="function"?function(u){return a(u==null?u:i(u))}:!1,ei}var ri,Po;function Ud(){if(Po)return ri;Po=1;var r=mo(),e=bo(),t=qd();return ri=r?function(i){return r(i)}:e?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return e(i)}:t?function(i){return t(i)}:null,ri}var ti,xo;function Ld(){if(xo)return ti;xo=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=_t();return ti=t.call(r,e),ti}var x,kd=ho,jd=ud,Vd=fd,Gd=cd,Hd=ld,ze=dd,Xe=ke,Wd=pd,zd=hd,Xd=yd,Yd=gd,Kd=_d,Zd=vd,Jd=md,Qd=$d,To=Function,ni=function(r){try{return To('"use strict"; return ('+r+").constructor;")()}catch{}},Er=yo,ep=Sd,ii=function(){throw new Xe},rp=Er?function(){try{return arguments.callee,ii}catch{try{return Er(arguments,"callee").get}catch{return ii}}}():ii,Ye=Od()(),U=Ud(),tp=bo(),np=mo(),Fo=Ao(),Sr=Jn,Ke={},ip=typeof Uint8Array>"u"||!U?x:U(Uint8Array),xe={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?x:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?x:ArrayBuffer,"%ArrayIteratorPrototype%":Ye&&U?U([][Symbol.iterator]()):x,"%AsyncFromSyncIteratorPrototype%":x,"%AsyncFunction%":Ke,"%AsyncGenerator%":Ke,"%AsyncGeneratorFunction%":Ke,"%AsyncIteratorPrototype%":Ke,"%Atomics%":typeof Atomics>"u"?x:Atomics,"%BigInt%":typeof BigInt>"u"?x:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?x:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?x:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?x:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":jd,"%eval%":eval,"%EvalError%":Vd,"%Float16Array%":typeof Float16Array>"u"?x:Float16Array,"%Float32Array%":typeof Float32Array>"u"?x:Float32Array,"%Float64Array%":typeof Float64Array>"u"?x:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?x:FinalizationRegistry,"%Function%":To,"%GeneratorFunction%":Ke,"%Int8Array%":typeof Int8Array>"u"?x:Int8Array,"%Int16Array%":typeof Int16Array>"u"?x:Int16Array,"%Int32Array%":typeof Int32Array>"u"?x:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ye&&U?U(U([][Symbol.iterator]())):x,"%JSON%":typeof JSON=="object"?JSON:x,"%Map%":typeof Map>"u"?x:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ye||!U?x:U(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":kd,"%Object.getOwnPropertyDescriptor%":Er,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?x:Promise,"%Proxy%":typeof Proxy>"u"?x:Proxy,"%RangeError%":Gd,"%ReferenceError%":Hd,"%Reflect%":typeof Reflect>"u"?x:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?x:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ye||!U?x:U(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?x:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ye&&U?U(""[Symbol.iterator]()):x,"%Symbol%":Ye?Symbol:x,"%SyntaxError%":ze,"%ThrowTypeError%":rp,"%TypedArray%":ip,"%TypeError%":Xe,"%Uint8Array%":typeof Uint8Array>"u"?x:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?x:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?x:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?x:Uint32Array,"%URIError%":Wd,"%WeakMap%":typeof WeakMap>"u"?x:WeakMap,"%WeakRef%":typeof WeakRef>"u"?x:WeakRef,"%WeakSet%":typeof WeakSet>"u"?x:WeakSet,"%Function.prototype.call%":Sr,"%Function.prototype.apply%":Fo,"%Object.defineProperty%":ep,"%Object.getPrototypeOf%":tp,"%Math.abs%":zd,"%Math.floor%":Xd,"%Math.max%":Yd,"%Math.min%":Kd,"%Math.pow%":Zd,"%Math.round%":Jd,"%Math.sign%":Qd,"%Reflect.getPrototypeOf%":np};if(U)try{null.error}catch(r){var ap=U(U(r));xe["%Error.prototype%"]=ap}var op=function r(e){var t;if(e==="%AsyncFunction%")t=ni("async function () {}");else if(e==="%GeneratorFunction%")t=ni("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=ni("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&U&&(t=U(i.prototype))}return xe[e]=t,t},Ro={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ar=_t(),vt=Ld(),sp=Ar.call(Sr,Array.prototype.concat),up=Ar.call(Fo,Array.prototype.splice),Mo=Ar.call(Sr,String.prototype.replace),mt=Ar.call(Sr,String.prototype.slice),fp=Ar.call(Sr,RegExp.prototype.exec),cp=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,lp=/\\(\\)?/g,dp=function(e){var t=mt(e,0,1),n=mt(e,-1);if(t==="%"&&n!=="%")throw new ze("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new ze("invalid intrinsic syntax, expected opening `%`");var i=[];return Mo(e,cp,function(a,o,u,f){i[i.length]=u?Mo(f,lp,"$1"):o||a}),i},pp=function(e,t){var n=e,i;if(vt(Ro,n)&&(i=Ro[n],n="%"+i[0]+"%"),vt(xe,n)){var a=xe[n];if(a===Ke&&(a=op(n)),typeof a>"u"&&!t)throw new Xe("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new ze("intrinsic "+e+" does not exist!")},ai=function(e,t){if(typeof e!="string"||e.length===0)throw new Xe("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Xe('"allowMissing" argument must be a boolean');if(fp(/^%?[^%]*%?$/,e)===null)throw new ze("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=dp(e),i=n.length>0?n[0]:"",a=pp("%"+i+"%",t),o=a.name,u=a.value,f=!1,d=a.alias;d&&(i=d[0],up(n,sp([0,1],d)));for(var c=1,s=!0;c<n.length;c+=1){var l=n[c],p=mt(l,0,1),g=mt(l,-1);if((p==='"'||p==="'"||p==="`"||g==='"'||g==="'"||g==="`")&&p!==g)throw new ze("property names with quotes must have matching quotes");if((l==="constructor"||!s)&&(f=!0),i+="."+l,o="%"+i+"%",vt(xe,o))u=xe[o];else if(u!=null){if(!(l in u)){if(!t)throw new Xe("base intrinsic for "+e+" exists, but the property is not available.");return}if(Er&&c+1>=n.length){var $=Er(u,l);s=!!$,s&&"get"in $&&!("originalValue"in $.get)?u=$.get:u=u[l]}else s=vt(u,l),u=u[l];s&&!f&&(xe[o]=u)}}return u},Do=ai,Co=Oo,hp=Co([Do("%String.prototype.indexOf%")]),No=function(e,t){var n=Do(e,!!t);return typeof n=="function"&&hp(e,".prototype.")>-1?Co([n]):n},yp=ai,Or=No,gp=dt,_p=ke,Bo=yp("%Map%",!0),vp=Or("Map.prototype.get",!0),mp=Or("Map.prototype.set",!0),wp=Or("Map.prototype.has",!0),bp=Or("Map.prototype.delete",!0),$p=Or("Map.prototype.size",!0),qo=!!Bo&&function(){var e,t={assert:function(n){if(!t.has(n))throw new _p("Side channel does not contain "+gp(n))},delete:function(n){if(e){var i=bp(e,n);return $p(e)===0&&(e=void 0),i}return!1},get:function(n){if(e)return vp(e,n)},has:function(n){return e?wp(e,n):!1},set:function(n,i){e||(e=new Bo),mp(e,n,i)}};return t},Ep=ai,wt=No,Sp=dt,bt=qo,Ap=ke,Ze=Ep("%WeakMap%",!0),Op=wt("WeakMap.prototype.get",!0),Ip=wt("WeakMap.prototype.set",!0),Pp=wt("WeakMap.prototype.has",!0),xp=wt("WeakMap.prototype.delete",!0),Tp=Ze?function(){var e,t,n={assert:function(i){if(!n.has(i))throw new Ap("Side channel does not contain "+Sp(i))},delete:function(i){if(Ze&&i&&(typeof i=="object"||typeof i=="function")){if(e)return xp(e,i)}else if(bt&&t)return t.delete(i);return!1},get:function(i){return Ze&&i&&(typeof i=="object"||typeof i=="function")&&e?Op(e,i):t&&t.get(i)},has:function(i){return Ze&&i&&(typeof i=="object"||typeof i=="function")&&e?Pp(e,i):!!t&&t.has(i)},set:function(i,a){Ze&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Ze),Ip(e,i,a)):bt&&(t||(t=bt()),t.set(i,a))}};return n}:bt,Fp=ke,Rp=dt,Mp=sd,Dp=qo,Cp=Tp,Np=Cp||Dp||Mp,Uo=function(){var e,t={assert:function(n){if(!t.has(n))throw new Fp("Side channel does not contain "+Rp(n))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,i){e||(e=Np()),e.set(n,i)}};return t},Bp=String.prototype.replace,qp=/%20/g,oi={RFC1738:"RFC1738",RFC3986:"RFC3986"},Lo={default:oi.RFC3986,formatters:{RFC1738:function(r){return Bp.call(r,qp,"+")},RFC3986:function(r){return String(r)}},RFC1738:oi.RFC1738,RFC3986:oi.RFC3986},Up=Lo,Lp=Uo,si=Object.prototype.hasOwnProperty,Te=Array.isArray,$t=Lp(),ko=function(e,t){return $t.set(e,t),e},Et=function(e){return $t.has(e)},ui=function(e){return $t.get(e)},jo=function(e,t){$t.set(e,t)},te=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),kp=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(Te(n)){for(var i=[],a=0;a<n.length;++a)typeof n[a]<"u"&&i.push(n[a]);t.obj[t.prop]=i}}},fi=function(e,t){for(var n=t&&t.plainObjects?{__proto__:null}:{},i=0;i<e.length;++i)typeof e[i]<"u"&&(n[i]=e[i]);return n},jp=function r(e,t,n){if(!t)return e;if(typeof t!="object"&&typeof t!="function"){if(Te(e))e.push(t);else if(e&&typeof e=="object")if(Et(e)){var i=ui(e)+1;e[i]=t,jo(e,i)}else(n&&(n.plainObjects||n.allowPrototypes)||!si.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object"){if(Et(t)){for(var a=Object.keys(t),o=n&&n.plainObjects?{__proto__:null,0:e}:{0:e},u=0;u<a.length;u++){var f=parseInt(a[u],10);o[f+1]=t[a[u]]}return ko(o,ui(t)+1)}return[e].concat(t)}var d=e;return Te(e)&&!Te(t)&&(d=fi(e,n)),Te(e)&&Te(t)?(t.forEach(function(c,s){if(si.call(e,s)){var l=e[s];l&&typeof l=="object"&&c&&typeof c=="object"?e[s]=r(l,c,n):e.push(c)}else e[s]=c}),e):Object.keys(t).reduce(function(c,s){var l=t[s];return si.call(c,s)?c[s]=r(c[s],l,n):c[s]=l,c},d)},Vp=function(e,t){return Object.keys(t).reduce(function(n,i){return n[i]=t[i],n},e)},Gp=function(r,e,t){var n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},ci=1024,Hp=function(e,t,n,i,a){if(e.length===0)return e;var o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(p){return"%26%23"+parseInt(p.slice(2),16)+"%3B"});for(var u="",f=0;f<o.length;f+=ci){for(var d=o.length>=ci?o.slice(f,f+ci):o,c=[],s=0;s<d.length;++s){var l=d.charCodeAt(s);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||a===Up.RFC1738&&(l===40||l===41)){c[c.length]=d.charAt(s);continue}if(l<128){c[c.length]=te[l];continue}if(l<2048){c[c.length]=te[192|l>>6]+te[128|l&63];continue}if(l<55296||l>=57344){c[c.length]=te[224|l>>12]+te[128|l>>6&63]+te[128|l&63];continue}s+=1,l=65536+((l&1023)<<10|d.charCodeAt(s)&1023),c[c.length]=te[240|l>>18]+te[128|l>>12&63]+te[128|l>>6&63]+te[128|l&63]}u+=c.join("")}return u},Wp=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],i=0;i<t.length;++i)for(var a=t[i],o=a.obj[a.prop],u=Object.keys(o),f=0;f<u.length;++f){var d=u[f],c=o[d];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(t.push({obj:o,prop:d}),n.push(c))}return kp(t),e},zp=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Xp=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Yp=function(e,t,n,i){if(Et(e)){var a=ui(e)+1;return e[a]=t,jo(e,a),e}var o=[].concat(e,t);return o.length>n?ko(fi(o,{plainObjects:i}),o.length-1):o},Kp=function(e,t){if(Te(e)){for(var n=[],i=0;i<e.length;i+=1)n.push(t(e[i]));return n}return t(e)},Zp={arrayToObject:fi,assign:Vp,combine:Yp,compact:Wp,decode:Gp,encode:Hp,isBuffer:Xp,isOverflow:Et,isRegExp:zp,maybeMap:Kp,merge:jp},Vo=Uo,St=Zp,Ir=Lo,Jp=Object.prototype.hasOwnProperty,Go={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ne=Array.isArray,Qp=Array.prototype.push,Ho=function(r,e){Qp.apply(r,ne(e)?e:[e])},eh=Date.prototype.toISOString,Wo=Ir.default,N={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:St.encode,encodeValuesOnly:!1,filter:void 0,format:Wo,formatter:Ir.formatters[Wo],indices:!1,serializeDate:function(e){return eh.call(e)},skipNulls:!1,strictNullHandling:!1},rh=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},li={},th=function r(e,t,n,i,a,o,u,f,d,c,s,l,p,g,$,S,A,E){for(var h=e,I=E,T=0,F=!1;(I=I.get(li))!==void 0&&!F;){var b=I.get(e);if(T+=1,typeof b<"u"){if(b===T)throw new RangeError("Cyclic object value");F=!0}typeof I.get(li)>"u"&&(T=0)}if(typeof c=="function"?h=c(t,h):h instanceof Date?h=p(h):n==="comma"&&ne(h)&&(h=St.maybeMap(h,function(ca){return ca instanceof Date?p(ca):ca})),h===null){if(o)return d&&!S?d(t,N.encoder,A,"key",g):t;h=""}if(rh(h)||St.isBuffer(h)){if(d){var _=S?t:d(t,N.encoder,A,"key",g);return[$(_)+"="+$(d(h,N.encoder,A,"value",g))]}return[$(t)+"="+$(String(h))]}var m=[];if(typeof h>"u")return m;var O;if(n==="comma"&&ne(h))S&&d&&(h=St.maybeMap(h,d)),O=[{value:h.length>0?h.join(",")||null:void 0}];else if(ne(c))O=c;else{var P=Object.keys(h);O=s?P.sort(s):P}var B=f?String(t).replace(/\./g,"%2E"):String(t),W=i&&ne(h)&&h.length===1?B+"[]":B;if(a&&ne(h)&&h.length===0)return W+"[]";for(var oe=0;oe<O.length;++oe){var Y=O[oe],Le=typeof Y=="object"&&Y&&typeof Y.value<"u"?Y.value:h[Y];if(!(u&&Le===null)){var fa=l&&f?String(Y).replace(/\./g,"%2E"):String(Y),vT=ne(h)?typeof n=="function"?n(W,fa):W:W+(l?"."+fa:"["+fa+"]");E.set(e,T);var Yf=Vo();Yf.set(li,E),Ho(m,r(Le,vT,n,i,a,o,u,f,n==="comma"&&S&&ne(h)?null:d,c,s,l,p,g,$,S,A,Yf))}}return m},nh=function(e){if(!e)return N;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||N.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=Ir.default;if(typeof e.format<"u"){if(!Jp.call(Ir.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var i=Ir.formatters[n],a=N.filter;(typeof e.filter=="function"||ne(e.filter))&&(a=e.filter);var o;if(e.arrayFormat in Go?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=N.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:N.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:N.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:N.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:N.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?N.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:N.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:N.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:N.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:N.encodeValuesOnly,filter:a,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:N.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:N.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:N.strictNullHandling}},ih=function(r,e){var t=r,n=nh(e),i,a;typeof n.filter=="function"?(a=n.filter,t=a("",t)):ne(n.filter)&&(a=n.filter,i=a);var o=[];if(typeof t!="object"||t===null)return"";var u=Go[n.arrayFormat],f=u==="comma"&&n.commaRoundTrip;i||(i=Object.keys(t)),n.sort&&i.sort(n.sort);for(var d=Vo(),c=0;c<i.length;++c){var s=i[c],l=t[s];n.skipNulls&&l===null||Ho(o,th(l,s,u,f,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,d))}var p=o.join(n.delimiter),g=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?g+="utf8=%26%2310003%3B&":g+="utf8=%E2%9C%93&"),p.length>0?g+p:""},ah=we(ih);let zo={storeIdentifier:"",environment:"prod"};function oh(r){zo=r}function j(){return zo}const sh=(r,e="")=>{switch(r){case"prod":return"https://api.rechargeapps.com";case"stage":return"https://api.stage.rechargeapps.com";case"preprod":case"prestage":return`${e}/api`}},uh=(r,e="")=>{switch(r){case"prod":return"https://admin.rechargeapps.com";case"stage":return"https://admin.stage.rechargeapps.com";case"preprod":case"prestage":return e}},fh=r=>{switch(r){case"prod":case"preprod":return"https://static.rechargecdn.com";case"stage":case"prestage":return"https://static.stage.rechargecdn.com"}},Xo="/tools/recurring";class Je{constructor(e,t){this.name="RechargeRequestError",this.message=e,this.status=t}}function ch(r){return ah(r,{encode:!1,indices:!1,arrayFormat:"comma"})}function v(r,e){return{...r,internalFnCall:r.internalFnCall??e,internalRequestId:r.internalRequestId??ya()}}async function At(r,e,t={}){const n=j();return X(r,`${fh(n.environment)}/store/${n.storeIdentifier}${e}`,t)}async function w(r,e,{id:t,query:n,data:i,headers:a}={},o){const{environment:u,environmentUri:f,storeIdentifier:d,loginRetryFn:c,__unstable_twoFactorRetryFn:s,appName:l,appVersion:p}=j();if(!d)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const g=o.apiToken;if(!g)throw new Error("No API token defined on session.");const $=sh(u,f),S={"X-Recharge-Access-Token":g,"X-Recharge-Version":"2021-11","X-Recharge-Sdk-Fn":o.internalFnCall,...l?{"X-Recharge-Sdk-App-Name":l}:{},...p?{"X-Recharge-Sdk-App-Version":p}:{},"X-Recharge-Sdk-Version":"1.83.0","X-Request-Id":o.internalRequestId,...o.tmp_fn_identifier?{"X-Recharge-Sdk-Fn-Identifier":o.tmp_fn_identifier}:{},...a||{}},A={shop_url:d,...n};try{return await X(r,`${$}${e}`,{id:t,query:A,data:i,headers:S})}catch(E){if(c&&E instanceof Je&&E.status===401)return c().then(h=>{if(h)return X(r,`${$}${e}`,{id:t,query:A,data:i,headers:{...S,"X-Recharge-Access-Token":h.apiToken}});throw E});if(s&&E instanceof Je&&E.status===423)return s().then(h=>{if(h)return X(r,`${$}${e}`,{id:t,query:A,data:i,headers:{...S,"X-Recharge-Access-Token":h.apiToken}});throw E});throw E}}async function Fe(r,e,t={}){return X(r,`${Xo}${e}`,t)}async function X(r,e,{id:t,query:n,data:i,headers:a}={}){let o=e.trim();if(t&&(o=[o,`${t}`.trim()].join("/")),n){let s;[o,s]=o.split("?");const l=[s,ch(n)].join("&").replace(/^&/,"");o=`${o}${l?`?${l}`:""}`}let u;i&&r!=="get"&&(u=JSON.stringify(i));const f={Accept:"application/json","Content-Type":"application/json","X-Recharge-App":"storefront-client",...a||{}},d=await fetch(o,{method:r,headers:f,body:u});let c;try{c=await d.json()}catch{}if(!d.ok)throw d.status===502||d.status===504?new Je("A gateway error occurred while making the request",d.status):c&&c.error?new Je(c.error,d.status):c&&c.errors?new Je(JSON.stringify(c.errors),d.status):new Je("A connection error occurred while making the request");return c}function lh(r,e){return w("get","/addresses",{query:e},v(r,"listAddresses"))}async function dh(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{address:n}=await w("get","/addresses",{id:e,query:{include:t?.include}},v(r,"getAddress"));return n}async function ph(r,e){const{address:t}=await w("post","/addresses",{data:{customer_id:r.customerId?Number(r.customerId):void 0,...e}},v(r,"createAddress"));return t}async function di(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{address:i}=await w("put","/addresses",{id:e,data:t,query:n},v(r,"updateAddress"));return i}async function hh(r,e,t,n){return di(v(r,"applyDiscountToAddress"),e,{discounts:[{code:t}]},n)}async function yh(r,e,t){if(e===void 0||e==="")throw new Error("Id is required");return di(v(r,"removeDiscountsFromAddress"),e,{discounts:[]},t)}function gh(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/addresses",{id:e},v(r,"deleteAddress"))}async function _h(r,e){const{address:t}=await w("post","/addresses/merge",{data:e},v(r,"mergeAddresses"));return t}async function vh(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/addresses/${e}/charges/skip`,{data:t},v(r,"skipFutureCharge"));return n}var mh=Object.freeze({__proto__:null,applyDiscountToAddress:hh,createAddress:ph,deleteAddress:gh,getAddress:dh,listAddresses:lh,mergeAddresses:_h,removeDiscountsFromAddress:yh,skipFutureCharge:vh,updateAddress:di});async function wh(){const{storefrontAccessToken:r}=j(),e={};r&&(e["X-Recharge-Storefront-Access-Token"]=r);const t=await Fe("get","/access",{headers:e});return{apiToken:t.api_token,customerId:t.customer_id,message:t.message}}async function bh(r,e){return Yo(r,e)}async function Yo(r,e){if(!r)throw new Error("Shopify storefront token is required");const{storeIdentifier:t}=j();if(!t)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const{api_token:n,customer_id:i,message:a}=await Pr("post","/shopify_storefront_access",{data:{customer_token:e,storefront_token:r,shop_url:t}});return n?{apiToken:n,customerId:i,message:a}:null}async function $h(r){const{storeIdentifier:e}=j();if(!e)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const{api_token:t,customer_id:n,message:i}=await Pr("post","/shopify_customer_account_api_access",{data:{customer_token:r,shop_url:e}});return t?{apiToken:t,customerId:n,message:i}:null}async function Eh(r,e={}){if(!r)throw new Error("Email is required.");const{storeIdentifier:t}=j();if(!t)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const n=await Pr("post","/attempt_login",{data:{email:r,shop:t,...e}});if(n.errors)throw new Error(n.errors);return n.session_token}async function Sh(r,e={}){if(!r)throw new Error("Email is required.");const{storefrontAccessToken:t}=j(),n={};t&&(n["X-Recharge-Storefront-Access-Token"]=t);const i=await Fe("post","/attempt_login",{data:{email:r,...e},headers:n});if(i.errors)throw new Error(i.errors);return i.session_token}async function Ah(r,e,t){if(!r)throw new Error("Email is required.");if(!e)throw new Error("Session token is required.");if(!t)throw new Error("Code is required.");const{storeIdentifier:n}=j();if(!n)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const i=await Pr("post","/validate_login",{data:{code:t,email:r,session_token:e,shop:n}});if(i.errors)throw new Error(i.errors);return{apiToken:i.api_token,customerId:i.customer_id}}async function Oh(r,e,t){if(!r)throw new Error("Email is required.");if(!e)throw new Error("Session token is required.");if(!t)throw new Error("Code is required.");const{storefrontAccessToken:n}=j(),i={};n&&(i["X-Recharge-Storefront-Access-Token"]=n);const a=await Fe("post","/validate_login",{data:{code:t,email:r,session_token:e},headers:i});if(a.errors)throw new Error(a.errors);return{apiToken:a.api_token,customerId:a.customer_id}}function Ih(){const{customerHash:r}=j(),{pathname:e,search:t}=window.location,n=new URLSearchParams(t).get("token"),i=e.split("/").filter(Boolean),a=i.findIndex(u=>u==="portal"),o=a!==-1?i[a+1]:r;if(!n||!o)throw new Error("Not in context of Recharge Customer Portal or URL did not contain correct params");return{customerHash:o,token:n}}async function Ph(){const{customerHash:r,token:e}=Ih(),{storeIdentifier:t}=j(),n=await Pr("post",`/customers/${r}/access`,{data:{token:e,shop:t}});return{apiToken:n.api_token,customerId:n.customer_id}}async function Pr(r,e,{id:t,query:n,data:i,headers:a}={}){const{environment:o,environmentUri:u,storefrontAccessToken:f,appName:d,appVersion:c}=j(),s=uh(o,u),l={...f?{"X-Recharge-Storefront-Access-Token":f}:{},...d?{"X-Recharge-Sdk-App-Name":d}:{},...c?{"X-Recharge-Sdk-App-Version":c}:{},"X-Recharge-Sdk-Version":"1.83.0",...a||{}};return X(r,`${s}${e}`,{id:t,query:n,data:i,headers:l})}var xh=Object.freeze({__proto__:null,loginCustomerPortal:Ph,loginShopifyApi:bh,loginShopifyAppProxy:wh,loginWithShopifyCustomerAccount:$h,loginWithShopifyStorefront:Yo,sendPasswordlessCode:Eh,sendPasswordlessCodeAppProxy:Sh,validatePasswordlessCode:Ah,validatePasswordlessCodeAppProxy:Oh}),Ko={},pi={},ce={},Th=typeof D=="object"&&D&&D.Object===Object&&D,Zo=Th,Fh=Zo,Rh=typeof self=="object"&&self&&self.Object===Object&&self,Mh=Fh||Rh||Function("return this")(),le=Mh,Dh=le,Ch=Dh.Symbol,Ot=Ch,Jo=Ot,Qo=Object.prototype,Nh=Qo.hasOwnProperty,Bh=Qo.toString,xr=Jo?Jo.toStringTag:void 0;function qh(r){var e=Nh.call(r,xr),t=r[xr];try{r[xr]=void 0;var n=!0}catch{}var i=Bh.call(r);return n&&(e?r[xr]=t:delete r[xr]),i}var Uh=qh,Lh=Object.prototype,kh=Lh.toString;function jh(r){return kh.call(r)}var Vh=jh,es=Ot,Gh=Uh,Hh=Vh,Wh="[object Null]",zh="[object Undefined]",rs=es?es.toStringTag:void 0;function Xh(r){return r==null?r===void 0?zh:Wh:rs&&rs in Object(r)?Gh(r):Hh(r)}var _e=Xh;function Yh(r){return r!=null&&typeof r=="object"}var ve=Yh,Kh=_e,Zh=ve,Jh="[object Number]";function Qh(r){return typeof r=="number"||Zh(r)&&Kh(r)==Jh}var It=Qh,M={};function ey(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var Qe=ey,ry=_e,ty=Qe,ny="[object AsyncFunction]",iy="[object Function]",ay="[object GeneratorFunction]",oy="[object Proxy]";function sy(r){if(!ty(r))return!1;var e=ry(r);return e==iy||e==ay||e==ny||e==oy}var hi=sy,uy=le,fy=uy["__core-js_shared__"],cy=fy,yi=cy,ts=function(){var r=/[^.]+$/.exec(yi&&yi.keys&&yi.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function ly(r){return!!ts&&ts in r}var dy=ly,py=Function.prototype,hy=py.toString;function yy(r){if(r!=null){try{return hy.call(r)}catch{}try{return r+""}catch{}}return""}var ns=yy,gy=hi,_y=dy,vy=Qe,my=ns,wy=/[\\^$.*+?()[\]{}|]/g,by=/^\[object .+?Constructor\]$/,$y=Function.prototype,Ey=Object.prototype,Sy=$y.toString,Ay=Ey.hasOwnProperty,Oy=RegExp("^"+Sy.call(Ay).replace(wy,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Iy(r){if(!vy(r)||_y(r))return!1;var e=gy(r)?Oy:by;return e.test(my(r))}var Py=Iy;function xy(r,e){return r?.[e]}var Ty=xy,Fy=Py,Ry=Ty;function My(r,e){var t=Ry(r,e);return Fy(t)?t:void 0}var Re=My,Dy=Re,Cy=function(){try{var r=Dy(Object,"defineProperty");return r({},"",{}),r}catch{}}(),is=Cy,as=is;function Ny(r,e,t){e=="__proto__"&&as?as(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var os=Ny;function By(r,e){return r===e||r!==r&&e!==e}var Pt=By,qy=os,Uy=Pt,Ly=Object.prototype,ky=Ly.hasOwnProperty;function jy(r,e,t){var n=r[e];(!(ky.call(r,e)&&Uy(n,t))||t===void 0&&!(e in r))&&qy(r,e,t)}var Vy=jy,Gy=Vy,Hy=os;function Wy(r,e,t,n){var i=!t;t||(t={});for(var a=-1,o=e.length;++a<o;){var u=e[a],f=n?n(t[u],r[u],u,t,r):void 0;f===void 0&&(f=r[u]),i?Hy(t,u,f):Gy(t,u,f)}return t}var zy=Wy;function Xy(r){return r}var xt=Xy;function Yy(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}var Ky=Yy,Zy=Ky,ss=Math.max;function Jy(r,e,t){return e=ss(e===void 0?r.length-1:e,0),function(){for(var n=arguments,i=-1,a=ss(n.length-e,0),o=Array(a);++i<a;)o[i]=n[e+i];i=-1;for(var u=Array(e+1);++i<e;)u[i]=n[i];return u[e]=t(o),Zy(r,this,u)}}var Qy=Jy;function eg(r){return function(){return r}}var rg=eg,tg=rg,us=is,ng=xt,ig=us?function(r,e){return us(r,"toString",{configurable:!0,enumerable:!1,value:tg(e),writable:!0})}:ng,ag=ig,og=800,sg=16,ug=Date.now;function fg(r){var e=0,t=0;return function(){var n=ug(),i=sg-(n-t);if(t=n,i>0){if(++e>=og)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}var cg=fg,lg=ag,dg=cg,pg=dg(lg),hg=pg,yg=xt,gg=Qy,_g=hg;function vg(r,e){return _g(gg(r,e,yg),r+"")}var mg=vg,wg=9007199254740991;function bg(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=wg}var gi=bg,$g=hi,Eg=gi;function Sg(r){return r!=null&&Eg(r.length)&&!$g(r)}var Tr=Sg,Ag=9007199254740991,Og=/^(?:0|[1-9]\d*)$/;function Ig(r,e){var t=typeof r;return e=e??Ag,!!e&&(t=="number"||t!="symbol"&&Og.test(r))&&r>-1&&r%1==0&&r<e}var _i=Ig,Pg=Pt,xg=Tr,Tg=_i,Fg=Qe;function Rg(r,e,t){if(!Fg(t))return!1;var n=typeof e;return(n=="number"?xg(t)&&Tg(e,t.length):n=="string"&&e in t)?Pg(t[e],r):!1}var fs=Rg,Mg=mg,Dg=fs;function Cg(r){return Mg(function(e,t){var n=-1,i=t.length,a=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(a=r.length>3&&typeof a=="function"?(i--,a):void 0,o&&Dg(t[0],t[1],o)&&(a=i<3?void 0:a,i=1),e=Object(e);++n<i;){var u=t[n];u&&r(e,u,n,a)}return e})}var Ng=Cg;function Bg(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var cs=Bg,qg=_e,Ug=ve,Lg="[object Arguments]";function kg(r){return Ug(r)&&qg(r)==Lg}var jg=kg,ls=jg,Vg=ve,ds=Object.prototype,Gg=ds.hasOwnProperty,Hg=ds.propertyIsEnumerable,Wg=ls(function(){return arguments}())?ls:function(r){return Vg(r)&&Gg.call(r,"callee")&&!Hg.call(r,"callee")},ps=Wg,zg=Array.isArray,V=zg,Tt={exports:{}};function Xg(){return!1}var Yg=Xg;Tt.exports,function(r,e){var t=le,n=Yg,i=e&&!e.nodeType&&e,a=i&&!0&&r&&!r.nodeType&&r,o=a&&a.exports===i,u=o?t.Buffer:void 0,f=u?u.isBuffer:void 0,d=f||n;r.exports=d}(Tt,Tt.exports);var hs=Tt.exports,Kg=_e,Zg=gi,Jg=ve,Qg="[object Arguments]",e_="[object Array]",r_="[object Boolean]",t_="[object Date]",n_="[object Error]",i_="[object Function]",a_="[object Map]",o_="[object Number]",s_="[object Object]",u_="[object RegExp]",f_="[object Set]",c_="[object String]",l_="[object WeakMap]",d_="[object ArrayBuffer]",p_="[object DataView]",h_="[object Float32Array]",y_="[object Float64Array]",g_="[object Int8Array]",__="[object Int16Array]",v_="[object Int32Array]",m_="[object Uint8Array]",w_="[object Uint8ClampedArray]",b_="[object Uint16Array]",$_="[object Uint32Array]",R={};R[h_]=R[y_]=R[g_]=R[__]=R[v_]=R[m_]=R[w_]=R[b_]=R[$_]=!0,R[Qg]=R[e_]=R[d_]=R[r_]=R[p_]=R[t_]=R[n_]=R[i_]=R[a_]=R[o_]=R[s_]=R[u_]=R[f_]=R[c_]=R[l_]=!1;function E_(r){return Jg(r)&&Zg(r.length)&&!!R[Kg(r)]}var S_=E_;function A_(r){return function(e){return r(e)}}var O_=A_,Ft={exports:{}};Ft.exports,function(r,e){var t=Zo,n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,o=a&&t.process,u=function(){try{var f=i&&i.require&&i.require("util").types;return f||o&&o.binding&&o.binding("util")}catch{}}();r.exports=u}(Ft,Ft.exports);var I_=Ft.exports,P_=S_,x_=O_,ys=I_,gs=ys&&ys.isTypedArray,T_=gs?x_(gs):P_,_s=T_,F_=cs,R_=ps,M_=V,D_=hs,C_=_i,N_=_s,B_=Object.prototype,q_=B_.hasOwnProperty;function U_(r,e){var t=M_(r),n=!t&&R_(r),i=!t&&!n&&D_(r),a=!t&&!n&&!i&&N_(r),o=t||n||i||a,u=o?F_(r.length,String):[],f=u.length;for(var d in r)(e||q_.call(r,d))&&!(o&&(d=="length"||i&&(d=="offset"||d=="parent")||a&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||C_(d,f)))&&u.push(d);return u}var vs=U_,L_=Object.prototype;function k_(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||L_;return r===t}var ms=k_;function j_(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var V_=j_,G_=Qe,H_=ms,W_=V_,z_=Object.prototype,X_=z_.hasOwnProperty;function Y_(r){if(!G_(r))return W_(r);var e=H_(r),t=[];for(var n in r)n=="constructor"&&(e||!X_.call(r,n))||t.push(n);return t}var K_=Y_,Z_=vs,J_=K_,Q_=Tr;function ev(r){return Q_(r)?Z_(r,!0):J_(r)}var rv=ev,tv=zy,nv=Ng,iv=rv,av=nv(function(r,e){tv(e,iv(e),r)}),ov=av,sv=ov,Rt={},Me={};function uv(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(!e(r[t],t,r))return!1;return!0}var fv=uv;function cv(r){return function(e,t,n){for(var i=-1,a=Object(e),o=n(e),u=o.length;u--;){var f=o[r?u:++i];if(t(a[f],f,a)===!1)break}return e}}var lv=cv,dv=lv,pv=dv(),hv=pv;function yv(r,e){return function(t){return r(e(t))}}var gv=yv,_v=gv,vv=_v(Object.keys,Object),mv=vv,wv=ms,bv=mv,$v=Object.prototype,Ev=$v.hasOwnProperty;function Sv(r){if(!wv(r))return bv(r);var e=[];for(var t in Object(r))Ev.call(r,t)&&t!="constructor"&&e.push(t);return e}var Av=Sv,Ov=vs,Iv=Av,Pv=Tr;function xv(r){return Pv(r)?Ov(r):Iv(r)}var Mt=xv,Tv=hv,Fv=Mt;function Rv(r,e){return r&&Tv(r,e,Fv)}var Mv=Rv,Dv=Tr;function Cv(r,e){return function(t,n){if(t==null)return t;if(!Dv(t))return r(t,n);for(var i=t.length,a=e?i:-1,o=Object(t);(e?a--:++a<i)&&n(o[a],a,o)!==!1;);return t}}var Nv=Cv,Bv=Mv,qv=Nv,Uv=qv(Bv),vi=Uv,Lv=vi;function kv(r,e){var t=!0;return Lv(r,function(n,i,a){return t=!!e(n,i,a),t}),t}var jv=kv;function Vv(){this.__data__=[],this.size=0}var Gv=Vv,Hv=Pt;function Wv(r,e){for(var t=r.length;t--;)if(Hv(r[t][0],e))return t;return-1}var Dt=Wv,zv=Dt,Xv=Array.prototype,Yv=Xv.splice;function Kv(r){var e=this.__data__,t=zv(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():Yv.call(e,t,1),--this.size,!0}var Zv=Kv,Jv=Dt;function Qv(r){var e=this.__data__,t=Jv(e,r);return t<0?void 0:e[t][1]}var em=Qv,rm=Dt;function tm(r){return rm(this.__data__,r)>-1}var nm=tm,im=Dt;function am(r,e){var t=this.__data__,n=im(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var om=am,sm=Gv,um=Zv,fm=em,cm=nm,lm=om;function er(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}er.prototype.clear=sm,er.prototype.delete=um,er.prototype.get=fm,er.prototype.has=cm,er.prototype.set=lm;var Ct=er,dm=Ct;function pm(){this.__data__=new dm,this.size=0}var hm=pm;function ym(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var gm=ym;function _m(r){return this.__data__.get(r)}var vm=_m;function mm(r){return this.__data__.has(r)}var wm=mm,bm=Re,$m=le,Em=bm($m,"Map"),mi=Em,Sm=Re,Am=Sm(Object,"create"),Nt=Am,ws=Nt;function Om(){this.__data__=ws?ws(null):{},this.size=0}var Im=Om;function Pm(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var xm=Pm,Tm=Nt,Fm="__lodash_hash_undefined__",Rm=Object.prototype,Mm=Rm.hasOwnProperty;function Dm(r){var e=this.__data__;if(Tm){var t=e[r];return t===Fm?void 0:t}return Mm.call(e,r)?e[r]:void 0}var Cm=Dm,Nm=Nt,Bm=Object.prototype,qm=Bm.hasOwnProperty;function Um(r){var e=this.__data__;return Nm?e[r]!==void 0:qm.call(e,r)}var Lm=Um,km=Nt,jm="__lodash_hash_undefined__";function Vm(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=km&&e===void 0?jm:e,this}var Gm=Vm,Hm=Im,Wm=xm,zm=Cm,Xm=Lm,Ym=Gm;function rr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}rr.prototype.clear=Hm,rr.prototype.delete=Wm,rr.prototype.get=zm,rr.prototype.has=Xm,rr.prototype.set=Ym;var Km=rr,bs=Km,Zm=Ct,Jm=mi;function Qm(){this.size=0,this.__data__={hash:new bs,map:new(Jm||Zm),string:new bs}}var ew=Qm;function rw(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var tw=rw,nw=tw;function iw(r,e){var t=r.__data__;return nw(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Bt=iw,aw=Bt;function ow(r){var e=aw(this,r).delete(r);return this.size-=e?1:0,e}var sw=ow,uw=Bt;function fw(r){return uw(this,r).get(r)}var cw=fw,lw=Bt;function dw(r){return lw(this,r).has(r)}var pw=dw,hw=Bt;function yw(r,e){var t=hw(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var gw=yw,_w=ew,vw=sw,mw=cw,ww=pw,bw=gw;function tr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}tr.prototype.clear=_w,tr.prototype.delete=vw,tr.prototype.get=mw,tr.prototype.has=ww,tr.prototype.set=bw;var wi=tr,$w=Ct,Ew=mi,Sw=wi,Aw=200;function Ow(r,e){var t=this.__data__;if(t instanceof $w){var n=t.__data__;if(!Ew||n.length<Aw-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new Sw(n)}return t.set(r,e),this.size=t.size,this}var Iw=Ow,Pw=Ct,xw=hm,Tw=gm,Fw=vm,Rw=wm,Mw=Iw;function nr(r){var e=this.__data__=new Pw(r);this.size=e.size}nr.prototype.clear=xw,nr.prototype.delete=Tw,nr.prototype.get=Fw,nr.prototype.has=Rw,nr.prototype.set=Mw;var $s=nr,Dw="__lodash_hash_undefined__";function Cw(r){return this.__data__.set(r,Dw),this}var Nw=Cw;function Bw(r){return this.__data__.has(r)}var qw=Bw,Uw=wi,Lw=Nw,kw=qw;function qt(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Uw;++e<t;)this.add(r[e])}qt.prototype.add=qt.prototype.push=Lw,qt.prototype.has=kw;var jw=qt;function Vw(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(e(r[t],t,r))return!0;return!1}var Gw=Vw;function Hw(r,e){return r.has(e)}var Ww=Hw,zw=jw,Xw=Gw,Yw=Ww,Kw=1,Zw=2;function Jw(r,e,t,n,i,a){var o=t&Kw,u=r.length,f=e.length;if(u!=f&&!(o&&f>u))return!1;var d=a.get(r),c=a.get(e);if(d&&c)return d==e&&c==r;var s=-1,l=!0,p=t&Zw?new zw:void 0;for(a.set(r,e),a.set(e,r);++s<u;){var g=r[s],$=e[s];if(n)var S=o?n($,g,s,e,r,a):n(g,$,s,r,e,a);if(S!==void 0){if(S)continue;l=!1;break}if(p){if(!Xw(e,function(A,E){if(!Yw(p,E)&&(g===A||i(g,A,t,n,a)))return p.push(E)})){l=!1;break}}else if(!(g===$||i(g,$,t,n,a))){l=!1;break}}return a.delete(r),a.delete(e),l}var Es=Jw,Qw=le,e0=Qw.Uint8Array,r0=e0;function t0(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}var n0=t0;function i0(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var a0=i0,Ss=Ot,As=r0,o0=Pt,s0=Es,u0=n0,f0=a0,c0=1,l0=2,d0="[object Boolean]",p0="[object Date]",h0="[object Error]",y0="[object Map]",g0="[object Number]",_0="[object RegExp]",v0="[object Set]",m0="[object String]",w0="[object Symbol]",b0="[object ArrayBuffer]",$0="[object DataView]",Os=Ss?Ss.prototype:void 0,bi=Os?Os.valueOf:void 0;function E0(r,e,t,n,i,a,o){switch(t){case $0:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case b0:return!(r.byteLength!=e.byteLength||!a(new As(r),new As(e)));case d0:case p0:case g0:return o0(+r,+e);case h0:return r.name==e.name&&r.message==e.message;case _0:case m0:return r==e+"";case y0:var u=u0;case v0:var f=n&c0;if(u||(u=f0),r.size!=e.size&&!f)return!1;var d=o.get(r);if(d)return d==e;n|=l0,o.set(r,e);var c=s0(u(r),u(e),n,i,a,o);return o.delete(r),c;case w0:if(bi)return bi.call(r)==bi.call(e)}return!1}var S0=E0;function A0(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}var O0=A0,I0=O0,P0=V;function x0(r,e,t){var n=e(r);return P0(r)?n:I0(n,t(r))}var T0=x0;function F0(r,e){for(var t=-1,n=r==null?0:r.length,i=0,a=[];++t<n;){var o=r[t];e(o,t,r)&&(a[i++]=o)}return a}var R0=F0;function M0(){return[]}var D0=M0,C0=R0,N0=D0,B0=Object.prototype,q0=B0.propertyIsEnumerable,Is=Object.getOwnPropertySymbols,U0=Is?function(r){return r==null?[]:(r=Object(r),C0(Is(r),function(e){return q0.call(r,e)}))}:N0,L0=U0,k0=T0,j0=L0,V0=Mt;function G0(r){return k0(r,V0,j0)}var H0=G0,Ps=H0,W0=1,z0=Object.prototype,X0=z0.hasOwnProperty;function Y0(r,e,t,n,i,a){var o=t&W0,u=Ps(r),f=u.length,d=Ps(e),c=d.length;if(f!=c&&!o)return!1;for(var s=f;s--;){var l=u[s];if(!(o?l in e:X0.call(e,l)))return!1}var p=a.get(r),g=a.get(e);if(p&&g)return p==e&&g==r;var $=!0;a.set(r,e),a.set(e,r);for(var S=o;++s<f;){l=u[s];var A=r[l],E=e[l];if(n)var h=o?n(E,A,l,e,r,a):n(A,E,l,r,e,a);if(!(h===void 0?A===E||i(A,E,t,n,a):h)){$=!1;break}S||(S=l=="constructor")}if($&&!S){var I=r.constructor,T=e.constructor;I!=T&&"constructor"in r&&"constructor"in e&&!(typeof I=="function"&&I instanceof I&&typeof T=="function"&&T instanceof T)&&($=!1)}return a.delete(r),a.delete(e),$}var K0=Y0,Z0=Re,J0=le,Q0=Z0(J0,"DataView"),eb=Q0,rb=Re,tb=le,nb=rb(tb,"Promise"),ib=nb,ab=Re,ob=le,sb=ab(ob,"Set"),ub=sb,fb=Re,cb=le,lb=fb(cb,"WeakMap"),db=lb,$i=eb,Ei=mi,Si=ib,Ai=ub,Oi=db,xs=_e,ir=ns,Ts="[object Map]",pb="[object Object]",Fs="[object Promise]",Rs="[object Set]",Ms="[object WeakMap]",Ds="[object DataView]",hb=ir($i),yb=ir(Ei),gb=ir(Si),_b=ir(Ai),vb=ir(Oi),De=xs;($i&&De(new $i(new ArrayBuffer(1)))!=Ds||Ei&&De(new Ei)!=Ts||Si&&De(Si.resolve())!=Fs||Ai&&De(new Ai)!=Rs||Oi&&De(new Oi)!=Ms)&&(De=function(r){var e=xs(r),t=e==pb?r.constructor:void 0,n=t?ir(t):"";if(n)switch(n){case hb:return Ds;case yb:return Ts;case gb:return Fs;case _b:return Rs;case vb:return Ms}return e});var mb=De,Ii=$s,wb=Es,bb=S0,$b=K0,Cs=mb,Ns=V,Bs=hs,Eb=_s,Sb=1,qs="[object Arguments]",Us="[object Array]",Ut="[object Object]",Ab=Object.prototype,Ls=Ab.hasOwnProperty;function Ob(r,e,t,n,i,a){var o=Ns(r),u=Ns(e),f=o?Us:Cs(r),d=u?Us:Cs(e);f=f==qs?Ut:f,d=d==qs?Ut:d;var c=f==Ut,s=d==Ut,l=f==d;if(l&&Bs(r)){if(!Bs(e))return!1;o=!0,c=!1}if(l&&!c)return a||(a=new Ii),o||Eb(r)?wb(r,e,t,n,i,a):bb(r,e,f,t,n,i,a);if(!(t&Sb)){var p=c&&Ls.call(r,"__wrapped__"),g=s&&Ls.call(e,"__wrapped__");if(p||g){var $=p?r.value():r,S=g?e.value():e;return a||(a=new Ii),i($,S,t,n,a)}}return l?(a||(a=new Ii),$b(r,e,t,n,i,a)):!1}var Ib=Ob,Pb=Ib,ks=ve;function js(r,e,t,n,i){return r===e?!0:r==null||e==null||!ks(r)&&!ks(e)?r!==r&&e!==e:Pb(r,e,t,n,js,i)}var Vs=js,xb=$s,Tb=Vs,Fb=1,Rb=2;function Mb(r,e,t,n){var i=t.length,a=i,o=!n;if(r==null)return!a;for(r=Object(r);i--;){var u=t[i];if(o&&u[2]?u[1]!==r[u[0]]:!(u[0]in r))return!1}for(;++i<a;){u=t[i];var f=u[0],d=r[f],c=u[1];if(o&&u[2]){if(d===void 0&&!(f in r))return!1}else{var s=new xb;if(n)var l=n(d,c,f,r,e,s);if(!(l===void 0?Tb(c,d,Fb|Rb,n,s):l))return!1}}return!0}var Db=Mb,Cb=Qe;function Nb(r){return r===r&&!Cb(r)}var Gs=Nb,Bb=Gs,qb=Mt;function Ub(r){for(var e=qb(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,Bb(i)]}return e}var Lb=Ub;function kb(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}var Hs=kb,jb=Db,Vb=Lb,Gb=Hs;function Hb(r){var e=Vb(r);return e.length==1&&e[0][2]?Gb(e[0][0],e[0][1]):function(t){return t===r||jb(t,r,e)}}var Wb=Hb,zb=_e,Xb=ve,Yb="[object Symbol]";function Kb(r){return typeof r=="symbol"||Xb(r)&&zb(r)==Yb}var Lt=Kb,Zb=V,Jb=Lt,Qb=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,e1=/^\w*$/;function r1(r,e){if(Zb(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||Jb(r)?!0:e1.test(r)||!Qb.test(r)||e!=null&&r in Object(e)}var Pi=r1,Ws=wi,t1="Expected a function";function xi(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(t1);var t=function(){var n=arguments,i=e?e.apply(this,n):n[0],a=t.cache;if(a.has(i))return a.get(i);var o=r.apply(this,n);return t.cache=a.set(i,o)||a,o};return t.cache=new(xi.Cache||Ws),t}xi.Cache=Ws;var n1=xi,i1=n1,a1=500;function o1(r){var e=i1(r,function(n){return t.size===a1&&t.clear(),n}),t=e.cache;return e}var s1=o1,u1=s1,f1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,c1=/\\(\\)?/g,l1=u1(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(f1,function(t,n,i,a){e.push(i?a.replace(c1,"$1"):n||t)}),e}),d1=l1;function p1(r,e){for(var t=-1,n=r==null?0:r.length,i=Array(n);++t<n;)i[t]=e(r[t],t,r);return i}var Ti=p1,zs=Ot,h1=Ti,y1=V,g1=Lt,_1=1/0,Xs=zs?zs.prototype:void 0,Ys=Xs?Xs.toString:void 0;function Ks(r){if(typeof r=="string")return r;if(y1(r))return h1(r,Ks)+"";if(g1(r))return Ys?Ys.call(r):"";var e=r+"";return e=="0"&&1/r==-_1?"-0":e}var v1=Ks,m1=v1;function w1(r){return r==null?"":m1(r)}var b1=w1,$1=V,E1=Pi,S1=d1,A1=b1;function O1(r,e){return $1(r)?r:E1(r,e)?[r]:S1(A1(r))}var Zs=O1,I1=Lt,P1=1/0;function x1(r){if(typeof r=="string"||I1(r))return r;var e=r+"";return e=="0"&&1/r==-P1?"-0":e}var kt=x1,T1=Zs,F1=kt;function R1(r,e){e=T1(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[F1(e[t++])];return t&&t==n?r:void 0}var Js=R1,M1=Js;function D1(r,e,t){var n=r==null?void 0:M1(r,e);return n===void 0?t:n}var C1=D1;function N1(r,e){return r!=null&&e in Object(r)}var B1=N1,q1=Zs,U1=ps,L1=V,k1=_i,j1=gi,V1=kt;function G1(r,e,t){e=q1(e,r);for(var n=-1,i=e.length,a=!1;++n<i;){var o=V1(e[n]);if(!(a=r!=null&&t(r,o)))break;r=r[o]}return a||++n!=i?a:(i=r==null?0:r.length,!!i&&j1(i)&&k1(o,i)&&(L1(r)||U1(r)))}var H1=G1,W1=B1,z1=H1;function X1(r,e){return r!=null&&z1(r,e,W1)}var Y1=X1,K1=Vs,Z1=C1,J1=Y1,Q1=Pi,e$=Gs,r$=Hs,t$=kt,n$=1,i$=2;function a$(r,e){return Q1(r)&&e$(e)?r$(t$(r),e):function(t){var n=Z1(t,r);return n===void 0&&n===e?J1(t,r):K1(e,n,n$|i$)}}var o$=a$;function s$(r){return function(e){return e?.[r]}}var u$=s$,f$=Js;function c$(r){return function(e){return f$(e,r)}}var l$=c$,d$=u$,p$=l$,h$=Pi,y$=kt;function g$(r){return h$(r)?d$(y$(r)):p$(r)}var _$=g$,v$=Wb,m$=o$,w$=xt,b$=V,$$=_$;function E$(r){return typeof r=="function"?r:r==null?w$:typeof r=="object"?b$(r)?m$(r[0],r[1]):v$(r):$$(r)}var Qs=E$,S$=fv,A$=jv,O$=Qs,I$=V,P$=fs;function x$(r,e,t){var n=I$(r)?S$:A$;return t&&P$(r,e,t)&&(e=void 0),n(r,O$(e))}var Fi=x$;Object.defineProperty(Me,"__esModule",{value:!0}),Me.calculatePadding=M$,Me.slicePadding=D$;var T$=Fi,F$=R$(T$);function R$(r){return r&&r.__esModule?r:{default:r}}function M$(r){switch(r%4){case 0:return 0;case 1:return 3;case 2:return 2;case 3:return 1;default:return null}}function D$(r,e){var t=r.slice(e),n=(0,F$.default)(t.buffer(),function(i){return i===0});if(n!==!0)throw new Error("XDR Read Error: invalid padding")}Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.Cursor=void 0;var C$=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),N$=Me;function B$(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Ri=function(){function r(e){B$(this,r),e instanceof y||(e=typeof e=="number"?y.alloc(e):y.from(e)),this._setBuffer(e),this.rewind()}return C$(r,[{key:"_setBuffer",value:function(t){this._buffer=t,this.length=t.length}},{key:"buffer",value:function(){return this._buffer}},{key:"tap",value:function(t){return t(this),this}},{key:"clone",value:function(t){var n=new this.constructor(this.buffer());return n.seek(arguments.length===0?this.tell():t),n}},{key:"tell",value:function(){return this._index}},{key:"seek",value:function(t,n){return arguments.length===1&&(n=t,t="="),t==="+"?this._index+=n:t==="-"?this._index-=n:this._index=n,this}},{key:"rewind",value:function(){return this.seek(0)}},{key:"eof",value:function(){return this.tell()===this.buffer().length}},{key:"write",value:function(t,n,i){return this.seek("+",this.buffer().write(t,this.tell(),n,i))}},{key:"fill",value:function(t,n){return arguments.length===1&&(n=this.buffer().length-this.tell()),this.buffer().fill(t,this.tell(),this.tell()+n),this.seek("+",n),this}},{key:"slice",value:function(t){arguments.length===0&&(t=this.length-this.tell());var n=new this.constructor(this.buffer().slice(this.tell(),this.tell()+t));return this.seek("+",t),n}},{key:"copyFrom",value:function(t){var n=t instanceof y?t:t.buffer();return n.copy(this.buffer(),this.tell(),0,n.length),this.seek("+",n.length),this}},{key:"concat",value:function(t){t.forEach(function(i,a){i instanceof r&&(t[a]=i.buffer())}),t.unshift(this.buffer());var n=y.concat(t);return this._setBuffer(n),this}},{key:"toString",value:function(t,n){arguments.length===0?(t="utf8",n=this.buffer().length-this.tell()):arguments.length===1&&(n=this.buffer().length-this.tell());var i=this.buffer().toString(t,this.tell(),this.tell()+n);return this.seek("+",n),i}},{key:"writeBufferPadded",value:function(t){var n=(0,N$.calculatePadding)(t.length),i=y.alloc(n);return this.copyFrom(new r(t)).copyFrom(new r(i))}}]),r}();[[1,["readInt8","readUInt8"]],[2,["readInt16BE","readInt16LE","readUInt16BE","readUInt16LE"]],[4,["readInt32BE","readInt32LE","readUInt32BE","readUInt32LE","readFloatBE","readFloatLE"]],[8,["readDoubleBE","readDoubleLE"]]].forEach(function(r){r[1].forEach(function(e){Ri.prototype[e]=function(){var n=this.buffer()[e](this.tell());return this.seek("+",r[0]),n}})}),[[1,["writeInt8","writeUInt8"]],[2,["writeInt16BE","writeInt16LE","writeUInt16BE","writeUInt16LE"]],[4,["writeInt32BE","writeInt32LE","writeUInt32BE","writeUInt32LE","writeFloatBE","writeFloatLE"]],[8,["writeDoubleBE","writeDoubleLE"]]].forEach(function(r){r[1].forEach(function(e){Ri.prototype[e]=function(n){return this.buffer()[e](n,this.tell()),this.seek("+",r[0]),this}})}),Rt.Cursor=Ri,Object.defineProperty(M,"__esModule",{value:!0}),M.default=G$;var q$=sv,eu=tu(q$),U$=hi,L$=tu(U$),ru=Rt;function tu(r){return r&&r.__esModule?r:{default:r}}var k$=Math.pow(2,16),j$={toXDR:function(e){var t=new ru.Cursor(k$);this.write(e,t);var n=t.tell();return t.rewind(),t.slice(n).buffer()},fromXDR:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw",n=void 0;switch(t){case"raw":n=e;break;case"hex":n=y.from(e,"hex");break;case"base64":n=y.from(e,"base64");break;default:throw new Error("Invalid format "+t+', must be "raw", "hex", "base64"')}var i=new ru.Cursor(n),a=this.read(i);return a},validateXDR:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"raw";try{return this.fromXDR(e,t),!0}catch{return!1}}},V$={toXDR:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"raw",t=this.constructor.toXDR(this);switch(e){case"raw":return t;case"hex":return t.toString("hex");case"base64":return t.toString("base64");default:throw new Error("Invalid format "+e+', must be "raw", "hex", "base64"')}}};function G$(r){(0,eu.default)(r,j$),(0,L$.default)(r)&&(0,eu.default)(r.prototype,V$)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.Int=void 0;var H$=It,nu=iu(H$),W$=M,z$=iu(W$);function iu(r){return r&&r.__esModule?r:{default:r}}var Fr=ce.Int={read:function(e){return e.readInt32BE()},write:function(e,t){if(!(0,nu.default)(e))throw new Error("XDR Write Error: not a number");if(Math.floor(e)!==e)throw new Error("XDR Write Error: not an integer");t.writeInt32BE(e)},isValid:function(e){return!(0,nu.default)(e)||Math.floor(e)!==e?!1:e>=Fr.MIN_VALUE&&e<=Fr.MAX_VALUE}};Fr.MAX_VALUE=Math.pow(2,31)-1,Fr.MIN_VALUE=-Math.pow(2,31),(0,z$.default)(Fr);var jt={};function X$(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var au={exports:{}};(function(r){/**
|
|
21
21
|
* @license Long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
|
|
22
22
|
* Released under the Apache License, Version 2.0
|
|
23
23
|
* see: https://github.com/dcodeIO/Long.js for details
|
|
24
|
-
*/(function(e,t){typeof X$=="function"&&r&&r.exports?r.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(D,function(){function e(c,s,l){this.low=c|0,this.high=s|0,this.unsigned=!!l}e.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=function(s){return(s&&s.__isLong__)===!0};var t={},n={};e.fromInt=function(s,l){var p,g;return l?(s=s>>>0,0<=s&&s<256&&(g=n[s],g)?g:(p=new e(s,(s|0)<0?-1:0,!0),0<=s&&s<256&&(n[s]=p),p)):(s=s|0,-128<=s&&s<128&&(g=t[s],g)?g:(p=new e(s,s<0?-1:0,!1),-128<=s&&s<128&&(t[s]=p),p))},e.fromNumber=function(s,l){return l=!!l,isNaN(s)||!isFinite(s)?e.ZERO:!l&&s<=-f?e.MIN_VALUE:!l&&s+1>=f?e.MAX_VALUE:l&&s>=u?e.MAX_UNSIGNED_VALUE:s<0?e.fromNumber(-s,l).negate():new e(s%o|0,s/o|0,l)},e.fromBits=function(s,l,p){return new e(s,l,p)},e.fromString=function(s,l,p){if(s.length===0)throw Error("number format error: empty string");if(s==="NaN"||s==="Infinity"||s==="+Infinity"||s==="-Infinity")return e.ZERO;if(typeof l=="number"&&(p=l,l=!1),p=p||10,p<2||36<p)throw Error("radix out of range: "+p);var g;if((g=s.indexOf("-"))>0)throw Error('number format error: interior "-" character: '+s);if(g===0)return e.fromString(s.substring(1),l,p).negate();for(var $=e.fromNumber(Math.pow(p,8)),S=e.ZERO,A=0;A<s.length;A+=8){var E=Math.min(8,s.length-A),h=parseInt(s.substring(A,A+E),p);if(E<8){var I=e.fromNumber(Math.pow(p,E));S=S.multiply(I).add(e.fromNumber(h))}else S=S.multiply($),S=S.add(e.fromNumber(h))}return S.unsigned=l,S},e.fromValue=function(s){return s instanceof e?s:typeof s=="number"?e.fromNumber(s):typeof s=="string"?e.fromString(s):new e(s.low,s.high,s.unsigned)};var i=65536,a=1<<24,o=i*i,u=o*o,f=u/2,d=e.fromInt(a);return e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*o+(this.low>>>0):this.high*o+(this.low>>>0)},e.prototype.toString=function(s){if(s=s||10,s<2||36<s)throw RangeError("radix out of range: "+s);if(this.isZero())return"0";var l;if(this.isNegative())if(this.equals(e.MIN_VALUE)){var p=e.fromNumber(s),g=this.divide(p);return l=g.multiply(p).subtract(this),g.toString(s)+l.toInt().toString(s)}else return"-"+this.negate().toString(s);var $=e.fromNumber(Math.pow(s,6),this.unsigned);l=this;for(var S="";;){var A=l.divide($),E=l.subtract(A.multiply($)).toInt()>>>0,h=E.toString(s);if(l=A,l.isZero())return h+S;for(;h.length<6;)h="0"+h;S=""+h+S}},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(e.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var s=this.high!=0?this.high:this.low,l=31;l>0&&!(s&1<<l);l--);return this.high!=0?l+33:l+1},e.prototype.isZero=function(){return this.high===0&&this.low===0},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isOdd=function(){return(this.low&1)===1},e.prototype.isEven=function(){return(this.low&1)===0},e.prototype.equals=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.unsigned!==s.unsigned&&this.high>>>31===1&&s.high>>>31===1?!1:this.high===s.high&&this.low===s.low},e.eq=e.prototype.equals,e.prototype.notEquals=function(s){return!this.equals(s)},e.neq=e.prototype.notEquals,e.prototype.lessThan=function(s){return this.compare(s)<0},e.prototype.lt=e.prototype.lessThan,e.prototype.lessThanOrEqual=function(s){return this.compare(s)<=0},e.prototype.lte=e.prototype.lessThanOrEqual,e.prototype.greaterThan=function(s){return this.compare(s)>0},e.prototype.gt=e.prototype.greaterThan,e.prototype.greaterThanOrEqual=function(s){return this.compare(s)>=0},e.prototype.gte=e.prototype.greaterThanOrEqual,e.prototype.compare=function(s){if(e.isLong(s)||(s=e.fromValue(s)),this.equals(s))return 0;var l=this.isNegative(),p=s.isNegative();return l&&!p?-1:!l&&p?1:this.unsigned?s.high>>>0>this.high>>>0||s.high===this.high&&s.low>>>0>this.low>>>0?-1:1:this.subtract(s).isNegative()?-1:1},e.prototype.negate=function(){return!this.unsigned&&this.equals(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=e.prototype.negate,e.prototype.add=function(s){e.isLong(s)||(s=e.fromValue(s));var l=this.high>>>16,p=this.high&65535,g=this.low>>>16,$=this.low&65535,S=s.high>>>16,A=s.high&65535,E=s.low>>>16,h=s.low&65535,I=0,T=0,F=0,b=0;return b+=$+h,F+=b>>>16,b&=65535,F+=g+E,T+=F>>>16,F&=65535,T+=p+A,I+=T>>>16,T&=65535,I+=l+S,I&=65535,e.fromBits(F<<16|b,I<<16|T,this.unsigned)},e.prototype.subtract=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.add(s.negate())},e.prototype.sub=e.prototype.subtract,e.prototype.multiply=function(s){if(this.isZero()||(e.isLong(s)||(s=e.fromValue(s)),s.isZero()))return e.ZERO;if(this.equals(e.MIN_VALUE))return s.isOdd()?e.MIN_VALUE:e.ZERO;if(s.equals(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return s.isNegative()?this.negate().multiply(s.negate()):this.negate().multiply(s).negate();if(s.isNegative())return this.multiply(s.negate()).negate();if(this.lessThan(d)&&s.lessThan(d))return e.fromNumber(this.toNumber()*s.toNumber(),this.unsigned);var l=this.high>>>16,p=this.high&65535,g=this.low>>>16,$=this.low&65535,S=s.high>>>16,A=s.high&65535,E=s.low>>>16,h=s.low&65535,I=0,T=0,F=0,b=0;return b+=$*h,F+=b>>>16,b&=65535,F+=g*h,T+=F>>>16,F&=65535,F+=$*E,T+=F>>>16,F&=65535,T+=p*h,I+=T>>>16,T&=65535,T+=g*E,I+=T>>>16,T&=65535,T+=$*A,I+=T>>>16,T&=65535,I+=l*h+p*E+g*A+$*S,I&=65535,e.fromBits(F<<16|b,I<<16|T,this.unsigned)},e.prototype.mul=e.prototype.multiply,e.prototype.divide=function(s){if(e.isLong(s)||(s=e.fromValue(s)),s.isZero())throw new Error("division by zero");if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var l,p,g;if(this.equals(e.MIN_VALUE)){if(s.equals(e.ONE)||s.equals(e.NEG_ONE))return e.MIN_VALUE;if(s.equals(e.MIN_VALUE))return e.ONE;var $=this.shiftRight(1);return l=$.divide(s).shiftLeft(1),l.equals(e.ZERO)?s.isNegative()?e.ONE:e.NEG_ONE:(p=this.subtract(s.multiply(l)),g=l.add(p.divide(s)),g)}else if(s.equals(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return s.isNegative()?this.negate().divide(s.negate()):this.negate().divide(s).negate();if(s.isNegative())return this.divide(s.negate()).negate();for(g=e.ZERO,p=this;p.greaterThanOrEqual(s);){l=Math.max(1,Math.floor(p.toNumber()/s.toNumber()));for(var S=Math.ceil(Math.log(l)/Math.LN2),A=S<=48?1:Math.pow(2,S-48),E=e.fromNumber(l),h=E.multiply(s);h.isNegative()||h.greaterThan(p);)l-=A,E=e.fromNumber(l,this.unsigned),h=E.multiply(s);E.isZero()&&(E=e.ONE),g=g.add(E),p=p.subtract(h)}return g},e.prototype.div=e.prototype.divide,e.prototype.modulo=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.subtract(this.divide(s).multiply(s))},e.prototype.mod=e.prototype.modulo,e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.and=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low&s.low,this.high&s.high,this.unsigned)},e.prototype.or=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low|s.low,this.high|s.high,this.unsigned)},e.prototype.xor=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low^s.low,this.high^s.high,this.unsigned)},e.prototype.shiftLeft=function(s){return e.isLong(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?e.fromBits(this.low<<s,this.high<<s|this.low>>>32-s,this.unsigned):e.fromBits(0,this.low<<s-32,this.unsigned)},e.prototype.shl=e.prototype.shiftLeft,e.prototype.shiftRight=function(s){return e.isLong(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?e.fromBits(this.low>>>s|this.high<<32-s,this.high>>s,this.unsigned):e.fromBits(this.high>>s-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=e.prototype.shiftRight,e.prototype.shiftRightUnsigned=function(s){if(e.isLong(s)&&(s=s.toInt()),s&=63,s===0)return this;var l=this.high;if(s<32){var p=this.low;return e.fromBits(p>>>s|l<<32-s,l>>>s,this.unsigned)}else return s===32?e.fromBits(l,0,this.unsigned):e.fromBits(l>>>s-32,0,this.unsigned)},e.prototype.shru=e.prototype.shiftRightUnsigned,e.prototype.toSigned=function(){return this.unsigned?new e(this.low,this.high,!1):this},e.prototype.toUnsigned=function(){return this.unsigned?this:new e(this.low,this.high,!0)},e})})(au);var ou=au.exports;Object.defineProperty(jt,"__esModule",{value:!0}),jt.Hyper=void 0;var Y$=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),su=function r(e,t,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:r(a,t,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},K$=ou,Rr=uu(K$),Z$=M,J$=uu(Z$);function uu(r){return r&&r.__esModule?r:{default:r}}function Q$(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function eE(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function rE(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Mr=jt.Hyper=function(r){rE(e,r),Y$(e,null,[{key:"read",value:function(n){var i=n.readInt32BE(),a=n.readInt32BE();return this.fromBits(a,i)}},{key:"write",value:function(n,i){if(!(n instanceof this))throw new Error("XDR Write Error: "+n+" is not a Hyper");i.writeInt32BE(n.high),i.writeInt32BE(n.low)}},{key:"fromString",value:function(n){if(!/^-?\d+$/.test(n))throw new Error("Invalid hyper string: "+n);var i=su(e.__proto__||Object.getPrototypeOf(e),"fromString",this).call(this,n,!1);return new this(i.low,i.high)}},{key:"fromBits",value:function(n,i){var a=su(e.__proto__||Object.getPrototypeOf(e),"fromBits",this).call(this,n,i,!1);return new this(a.low,a.high)}},{key:"isValid",value:function(n){return n instanceof this}}]);function e(t,n){return Q$(this,e),eE(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!1))}return e}(Rr.default);(0,J$.default)(Mr),Mr.MAX_VALUE=new Mr(Rr.default.MAX_VALUE.low,Rr.default.MAX_VALUE.high),Mr.MIN_VALUE=new Mr(Rr.default.MIN_VALUE.low,Rr.default.MIN_VALUE.high);var Ce={};Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.UnsignedInt=void 0;var tE=It,fu=cu(tE),nE=M,iE=cu(nE);function cu(r){return r&&r.__esModule?r:{default:r}}var Dr=Ce.UnsignedInt={read:function(e){return e.readUInt32BE()},write:function(e,t){if(!(0,fu.default)(e))throw new Error("XDR Write Error: not a number");if(Math.floor(e)!==e)throw new Error("XDR Write Error: not an integer");if(e<0)throw new Error("XDR Write Error: negative number "+e);t.writeUInt32BE(e)},isValid:function(e){return!(0,fu.default)(e)||Math.floor(e)!==e?!1:e>=Dr.MIN_VALUE&&e<=Dr.MAX_VALUE}};Dr.MAX_VALUE=Math.pow(2,32)-1,Dr.MIN_VALUE=0,(0,iE.default)(Dr);var Vt={};Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.UnsignedHyper=void 0;var aE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),lu=function r(e,t,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:r(a,t,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},oE=ou,Cr=du(oE),sE=M,uE=du(sE);function du(r){return r&&r.__esModule?r:{default:r}}function fE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function cE(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function lE(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Nr=Vt.UnsignedHyper=function(r){lE(e,r),aE(e,null,[{key:"read",value:function(n){var i=n.readInt32BE(),a=n.readInt32BE();return this.fromBits(a,i)}},{key:"write",value:function(n,i){if(!(n instanceof this))throw new Error("XDR Write Error: "+n+" is not an UnsignedHyper");i.writeInt32BE(n.high),i.writeInt32BE(n.low)}},{key:"fromString",value:function(n){if(!/^\d+$/.test(n))throw new Error("Invalid hyper string: "+n);var i=lu(e.__proto__||Object.getPrototypeOf(e),"fromString",this).call(this,n,!0);return new this(i.low,i.high)}},{key:"fromBits",value:function(n,i){var a=lu(e.__proto__||Object.getPrototypeOf(e),"fromBits",this).call(this,n,i,!0);return new this(a.low,a.high)}},{key:"isValid",value:function(n){return n instanceof this}}]);function e(t,n){return fE(this,e),cE(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!0))}return e}(Cr.default);(0,uE.default)(Nr),Nr.MAX_VALUE=new Nr(Cr.default.MAX_UNSIGNED_VALUE.low,Cr.default.MAX_UNSIGNED_VALUE.high),Nr.MIN_VALUE=new Nr(Cr.default.MIN_VALUE.low,Cr.default.MIN_VALUE.high);var Gt={};Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.Float=void 0;var dE=It,pu=hu(dE),pE=M,hE=hu(pE);function hu(r){return r&&r.__esModule?r:{default:r}}var yE=Gt.Float={read:function(e){return e.readFloatBE()},write:function(e,t){if(!(0,pu.default)(e))throw new Error("XDR Write Error: not a number");t.writeFloatBE(e)},isValid:function(e){return(0,pu.default)(e)}};(0,hE.default)(yE);var Ht={};Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.Double=void 0;var gE=It,yu=gu(gE),_E=M,vE=gu(_E);function gu(r){return r&&r.__esModule?r:{default:r}}var mE=Ht.Double={read:function(e){return e.readDoubleBE()},write:function(e,t){if(!(0,yu.default)(e))throw new Error("XDR Write Error: not a number");t.writeDoubleBE(e)},isValid:function(e){return(0,yu.default)(e)}};(0,vE.default)(mE);var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.Quadruple=void 0;var wE=M,bE=$E(wE);function $E(r){return r&&r.__esModule?r:{default:r}}var EE=Wt.Quadruple={read:function(){throw new Error("XDR Read Error: quadruple not supported")},write:function(){throw new Error("XDR Write Error: quadruple not supported")},isValid:function(){return!1}};(0,bE.default)(EE);var Br={},SE=_e,AE=ve,OE="[object Boolean]";function IE(r){return r===!0||r===!1||AE(r)&&SE(r)==OE}var PE=IE;Object.defineProperty(Br,"__esModule",{value:!0}),Br.Bool=void 0;var xE=PE,TE=vu(xE),_u=ce,FE=M,RE=vu(FE);function vu(r){return r&&r.__esModule?r:{default:r}}var ME=Br.Bool={read:function(e){var t=_u.Int.read(e);switch(t){case 0:return!1;case 1:return!0;default:throw new Error("XDR Read Error: Got "+t+" when trying to read a bool")}},write:function(e,t){var n=e?1:0;return _u.Int.write(n,t)},isValid:function(e){return(0,TE.default)(e)}};(0,RE.default)(ME);var zt={},DE=_e,CE=V,NE=ve,BE="[object String]";function qE(r){return typeof r=="string"||!CE(r)&&NE(r)&&DE(r)==BE}var mu=qE;Object.defineProperty(zt,"__esModule",{value:!0}),zt.String=void 0;var UE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),LE=mu,wu=Mi(LE),kE=V,jE=Mi(kE),bu=ce,VE=Ce,$u=Me,GE=M,HE=Mi(GE);function Mi(r){return r&&r.__esModule?r:{default:r}}function WE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var zE=zt.String=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:VE.UnsignedInt.MAX_VALUE;WE(this,r),this._maxLength=e}return UE(r,[{key:"read",value:function(t){var n=bu.Int.read(t);if(n>this._maxLength)throw new Error("XDR Read Error: Saw "+n+" length String,"+("max allowed is "+this._maxLength));var i=(0,$u.calculatePadding)(n),a=t.slice(n);return(0,$u.slicePadding)(t,i),a.buffer()}},{key:"readString",value:function(t){return this.read(t).toString("utf8")}},{key:"write",value:function(t,n){if(t.length>this._maxLength)throw new Error("XDR Write Error: Got "+t.length+" bytes,"+("max allows is "+this._maxLength));var i=void 0;(0,wu.default)(t)?i=y.from(t,"utf8"):i=y.from(t),bu.Int.write(i.length,n),n.writeBufferPadded(i)}},{key:"isValid",value:function(t){var n=void 0;if((0,wu.default)(t))n=y.from(t,"utf8");else if((0,jE.default)(t)||y.isBuffer(t))n=y.from(t);else return!1;return n.length<=this._maxLength}}]),r}();(0,HE.default)(zE.prototype);var Xt={};Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.Opaque=void 0;var XE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),Eu=Me,YE=M,KE=ZE(YE);function ZE(r){return r&&r.__esModule?r:{default:r}}function JE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var QE=Xt.Opaque=function(){function r(e){JE(this,r),this._length=e,this._padding=(0,Eu.calculatePadding)(e)}return XE(r,[{key:"read",value:function(t){var n=t.slice(this._length);return(0,Eu.slicePadding)(t,this._padding),n.buffer()}},{key:"write",value:function(t,n){if(t.length!==this._length)throw new Error("XDR Write Error: Got "+t.length+" bytes, expected "+this._length);n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length===this._length}}]),r}();(0,KE.default)(QE.prototype);var Yt={};Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.VarOpaque=void 0;var eS=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),Su=ce,rS=Ce,Au=Me,tS=M,nS=iS(tS);function iS(r){return r&&r.__esModule?r:{default:r}}function aS(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var oS=Yt.VarOpaque=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rS.UnsignedInt.MAX_VALUE;aS(this,r),this._maxLength=e}return eS(r,[{key:"read",value:function(t){var n=Su.Int.read(t);if(n>this._maxLength)throw new Error("XDR Read Error: Saw "+n+" length VarOpaque,"+("max allowed is "+this._maxLength));var i=(0,Au.calculatePadding)(n),a=t.slice(n);return(0,Au.slicePadding)(t,i),a.buffer()}},{key:"write",value:function(t,n){if(t.length>this._maxLength)throw new Error("XDR Write Error: Got "+t.length+" bytes,"+("max allows is "+this._maxLength));Su.Int.write(t.length,n),n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length<=this._maxLength}}]),r}();(0,nS.default)(oS.prototype);var Kt={};function sS(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}var uS=sS,fS=xt;function cS(r){return typeof r=="function"?r:fS}var Ou=cS,lS=uS,dS=vi,pS=Ou,hS=V;function yS(r,e){var t=hS(r)?lS:dS;return t(r,pS(e))}var gS=yS,ar=gS,_S=/\s/;function vS(r){for(var e=r.length;e--&&_S.test(r.charAt(e)););return e}var mS=vS,wS=mS,bS=/^\s+/;function $S(r){return r&&r.slice(0,wS(r)+1).replace(bS,"")}var ES=$S,SS=ES,Iu=Qe,AS=Lt,Pu=0/0,OS=/^[-+]0x[0-9a-f]+$/i,IS=/^0b[01]+$/i,PS=/^0o[0-7]+$/i,xS=parseInt;function TS(r){if(typeof r=="number")return r;if(AS(r))return Pu;if(Iu(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Iu(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=SS(r);var t=IS.test(r);return t||PS.test(r)?xS(r.slice(2),t?2:8):OS.test(r)?Pu:+r}var FS=TS,RS=FS,xu=1/0,MS=17976931348623157e292;function DS(r){if(!r)return r===0?r:0;if(r=RS(r),r===xu||r===-xu){var e=r<0?-1:1;return e*MS}return r===r?r:0}var CS=DS,NS=CS;function BS(r){var e=NS(r),t=e%1;return e===e?t?e-t:e:0}var qS=BS,US=cs,LS=Ou,kS=qS,jS=9007199254740991,Di=4294967295,VS=Math.min;function GS(r,e){if(r=kS(r),r<1||r>jS)return[];var t=Di,n=VS(r,Di);e=LS(e),r-=Di;for(var i=US(n,e);++t<r;)e(t);return i}var Tu=GS;Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.Array=void 0;var HS=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),WS=Fi,zS=qr(WS),XS=ar,YS=qr(XS),KS=Tu,ZS=qr(KS),JS=V,Fu=qr(JS),QS=M,eA=qr(QS);function qr(r){return r&&r.__esModule?r:{default:r}}function rA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var tA=Kt.Array=function(){function r(e,t){rA(this,r),this._childType=e,this._length=t}return HS(r,[{key:"read",value:function(t){var n=this;return(0,ZS.default)(this._length,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,Fu.default)(t))throw new Error("XDR Write Error: value is not array");if(t.length!==this._length)throw new Error("XDR Write Error: Got array of size "+t.length+","+("expected "+this._length));(0,YS.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,Fu.default)(t)||t.length!==this._length?!1:(0,zS.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,eA.default)(tA.prototype);var Zt={};Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.VarArray=void 0;var nA=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),iA=Fi,aA=Ur(iA),oA=ar,sA=Ur(oA),uA=Tu,fA=Ur(uA),cA=V,Ru=Ur(cA),lA=Ce,Mu=ce,dA=M,pA=Ur(dA);function Ur(r){return r&&r.__esModule?r:{default:r}}function hA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var yA=Zt.VarArray=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:lA.UnsignedInt.MAX_VALUE;hA(this,r),this._childType=e,this._maxLength=t}return nA(r,[{key:"read",value:function(t){var n=this,i=Mu.Int.read(t);if(i>this._maxLength)throw new Error("XDR Read Error: Saw "+i+" length VarArray,"+("max allowed is "+this._maxLength));return(0,fA.default)(i,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,Ru.default)(t))throw new Error("XDR Write Error: value is not array");if(t.length>this._maxLength)throw new Error("XDR Write Error: Got array of size "+t.length+","+("max allowed is "+this._maxLength));Mu.Int.write(t.length,n),(0,sA.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,Ru.default)(t)||t.length>this._maxLength?!1:(0,aA.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,pA.default)(yA.prototype);var Jt={};function gA(r){return r===null}var _A=gA;function vA(r){return r===void 0}var Lr=vA;Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.Option=void 0;var mA=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),wA=_A,Du=Ci(wA),bA=Lr,Cu=Ci(bA),Nu=Br,$A=M,EA=Ci($A);function Ci(r){return r&&r.__esModule?r:{default:r}}function SA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var AA=Jt.Option=function(){function r(e){SA(this,r),this._childType=e}return mA(r,[{key:"read",value:function(t){if(Nu.Bool.read(t))return this._childType.read(t)}},{key:"write",value:function(t,n){var i=!((0,Du.default)(t)||(0,Cu.default)(t));Nu.Bool.write(i,n),i&&this._childType.write(t,n)}},{key:"isValid",value:function(t){return(0,Du.default)(t)||(0,Cu.default)(t)?!0:this._childType.isValid(t)}}]),r}();(0,EA.default)(AA.prototype);var kr={};Object.defineProperty(kr,"__esModule",{value:!0}),kr.Void=void 0;var OA=Lr,Bu=qu(OA),IA=M,PA=qu(IA);function qu(r){return r&&r.__esModule?r:{default:r}}var xA=kr.Void={read:function(){},write:function(e){if(!(0,Bu.default)(e))throw new Error("XDR Write Error: trying to write value to a void slot")},isValid:function(e){return(0,Bu.default)(e)}};(0,PA.default)(xA);var Qt={},TA=Ti;function FA(r,e){return TA(e,function(t){return r[t]})}var RA=FA,MA=RA,DA=Mt;function CA(r){return r==null?[]:MA(r,DA(r))}var NA=CA;Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.Enum=void 0;var BA=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),qA=ar,UA=Ni(qA),LA=NA,kA=Ni(LA),Uu=ce,jA=M,VA=Ni(jA);function Ni(r){return r&&r.__esModule?r:{default:r}}function GA(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function HA(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function Lu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var WA=Qt.Enum=function(){function r(e,t){Lu(this,r),this.name=e,this.value=t}return BA(r,null,[{key:"read",value:function(t){var n=Uu.Int.read(t);if(!this._byValue.has(n))throw new Error("XDR Read Error: Unknown "+this.enumName+" member for value "+n);return this._byValue.get(n)}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: Unknown "+t+" is not a "+this.enumName);Uu.Int.write(t.value,n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"members",value:function(){return this._members}},{key:"values",value:function(){return(0,kA.default)(this._members)}},{key:"fromName",value:function(t){var n=this._members[t];if(!n)throw new Error(t+" is not a member of "+this.enumName);return n}},{key:"fromValue",value:function(t){var n=this._byValue.get(t);if(!n)throw new Error(t+" is not a value of any member of "+this.enumName);return n}},{key:"create",value:function(t,n,i){var a=function(o){HA(u,o);function u(){return Lu(this,u),GA(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u}(r);return a.enumName=n,t.results[n]=a,a._members={},a._byValue=new Map,(0,UA.default)(i,function(o,u){var f=new a(u,o);a._members[u]=f,a._byValue.set(o,f),a[u]=function(){return f}}),a}}]),r}();(0,VA.default)(WA);var en={},zA=vi,XA=Tr;function YA(r,e){var t=-1,n=XA(r)?Array(r.length):[];return zA(r,function(i,a,o){n[++t]=e(i,a,o)}),n}var KA=YA,ZA=Ti,JA=Qs,QA=KA,eO=V;function rO(r,e){var t=eO(r)?ZA:QA;return t(r,JA(e))}var tO=rO;function nO(r){for(var e=-1,t=r==null?0:r.length,n={};++e<t;){var i=r[e];n[i[0]]=i[1]}return n}var iO=nO,jr={};Object.defineProperty(jr,"__esModule",{value:!0});var aO=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function oO(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}jr.Reference=function(){function r(){oO(this,r)}return aO(r,[{key:"resolve",value:function(){throw new Error("implement resolve in child class")}}]),r}(),Object.defineProperty(en,"__esModule",{value:!0}),en.Struct=void 0;var rn=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var u=e[Symbol.iterator](),f;!(i=(f=u.next()).done)&&(n.push(f.value),!(t&&n.length===t));i=!0);}catch(d){a=!0,o=d}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),sO=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),uO=ar,ku=Vr(uO),fO=tO,cO=Vr(fO),lO=Lr,dO=Vr(lO),pO=iO,hO=Vr(pO),yO=jr,gO=M,_O=Vr(gO);function Vr(r){return r&&r.__esModule?r:{default:r}}function vO(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function mO(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function ju(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var wO=en.Struct=function(){function r(e){ju(this,r),this._attributes=e||{}}return sO(r,null,[{key:"read",value:function(t){var n=(0,cO.default)(this._fields,function(i){var a=rn(i,2),o=a[0],u=a[1],f=u.read(t);return[o,f]});return new this((0,hO.default)(n))}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.structName);(0,ku.default)(this._fields,function(i){var a=rn(i,2),o=a[0],u=a[1],f=t._attributes[o];u.write(f,n)})}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(o){mO(u,o);function u(){return ju(this,u),vO(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u}(r);return a.structName=n,t.results[n]=a,a._fields=i.map(function(o){var u=rn(o,2),f=u[0],d=u[1];return d instanceof yO.Reference&&(d=d.resolve(t)),[f,d]}),(0,ku.default)(a._fields,function(o){var u=rn(o,1),f=u[0];a.prototype[f]=bO(f)}),a}}]),r}();(0,_O.default)(wO);function bO(r){return function(t){return(0,dO.default)(t)||(this._attributes[r]=t),this._attributes[r]}}var tn={};Object.defineProperty(tn,"__esModule",{value:!0}),tn.Union=void 0;var $O=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var u=e[Symbol.iterator](),f;!(i=(f=u.next()).done)&&(n.push(f.value),!(t&&n.length===t));i=!0);}catch(d){a=!0,o=d}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),EO=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),SO=ar,nn=on(SO),AO=Lr,Vu=on(AO),OO=mu,Gu=on(OO),an=kr,Bi=jr,IO=M,PO=on(IO);function on(r){return r&&r.__esModule?r:{default:r}}function xO(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function TO(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function Hu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var FO=tn.Union=function(){function r(e,t){Hu(this,r),this.set(e,t)}return EO(r,[{key:"set",value:function(t,n){(0,Gu.default)(t)&&(t=this.constructor._switchOn.fromName(t)),this._switch=t,this._arm=this.constructor.armForSwitch(this._switch),this._armType=this.constructor.armTypeForArm(this._arm),this._value=n}},{key:"get",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this._arm;if(this._arm!==an.Void&&this._arm!==t)throw new Error(t+" not set");return this._value}},{key:"switch",value:function(){return this._switch}},{key:"arm",value:function(){return this._arm}},{key:"armType",value:function(){return this._armType}},{key:"value",value:function(){return this._value}}],[{key:"armForSwitch",value:function(t){if(this._switches.has(t))return this._switches.get(t);if(this._defaultArm)return this._defaultArm;throw new Error("Bad union switch: "+t)}},{key:"armTypeForArm",value:function(t){return t===an.Void?an.Void:this._arms[t]}},{key:"read",value:function(t){var n=this._switchOn.read(t),i=this.armForSwitch(n),a=this.armTypeForArm(i),o=void 0;return(0,Vu.default)(a)?o=i.read(t):o=a.read(t),new this(n,o)}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.unionName);this._switchOn.write(t.switch(),n),t.armType().write(t.value(),n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(u){TO(f,u);function f(){return Hu(this,f),xO(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}return f}(r);a.unionName=n,t.results[n]=a,i.switchOn instanceof Bi.Reference?a._switchOn=i.switchOn.resolve(t):a._switchOn=i.switchOn,a._switches=new Map,a._arms={},(0,nn.default)(i.arms,function(u,f){u instanceof Bi.Reference&&(u=u.resolve(t)),a._arms[f]=u});var o=i.defaultArm;return o instanceof Bi.Reference&&(o=o.resolve(t)),a._defaultArm=o,(0,nn.default)(i.switches,function(u){var f=$O(u,2),d=f[0],c=f[1];(0,Gu.default)(d)&&(d=a._switchOn.fromName(d)),a._switches.set(d,c)}),(0,Vu.default)(a._switchOn.values)||(0,nn.default)(a._switchOn.values(),function(u){a[u.name]=function(f){return new a(u,f)},a.prototype[u.name]=function(d){return this.set(u,d)}}),(0,nn.default)(a._arms,function(u,f){u!==an.Void&&(a.prototype[f]=function(){return this.get(f)})}),a}}]),r}();(0,PO.default)(FO),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=ce;Object.keys(e).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return e[h]}})});var t=jt;Object.keys(t).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return t[h]}})});var n=Ce;Object.keys(n).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return n[h]}})});var i=Vt;Object.keys(i).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return i[h]}})});var a=Gt;Object.keys(a).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return a[h]}})});var o=Ht;Object.keys(o).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return o[h]}})});var u=Wt;Object.keys(u).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return u[h]}})});var f=Br;Object.keys(f).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return f[h]}})});var d=zt;Object.keys(d).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return d[h]}})});var c=Xt;Object.keys(c).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return c[h]}})});var s=Yt;Object.keys(s).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return s[h]}})});var l=Kt;Object.keys(l).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return l[h]}})});var p=Zt;Object.keys(p).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return p[h]}})});var g=Jt;Object.keys(g).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return g[h]}})});var $=kr;Object.keys($).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return $[h]}})});var S=Qt;Object.keys(S).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return S[h]}})});var A=en;Object.keys(A).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return A[h]}})});var E=tn;Object.keys(E).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return E[h]}})})}(pi);var Wu={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=function(){function b(_,m){for(var O=0;O<m.length;O++){var P=m[O];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(_,P.key,P)}}return function(_,m,O){return m&&b(_.prototype,m),O&&b(_,O),_}}(),t=jr;Object.keys(t).forEach(function(b){b==="default"||b==="__esModule"||Object.defineProperty(r,b,{enumerable:!0,get:function(){return t[b]}})}),r.config=g;var n=Lr,i=c(n),a=ar,o=c(a),u=pi,f=d(u);function d(b){if(b&&b.__esModule)return b;var _={};if(b!=null)for(var m in b)Object.prototype.hasOwnProperty.call(b,m)&&(_[m]=b[m]);return _.default=b,_}function c(b){return b&&b.__esModule?b:{default:b}}function s(b,_){if(!(b instanceof _))throw new TypeError("Cannot call a class as a function")}function l(b,_){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:b}function p(b,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);b.prototype=Object.create(_&&_.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(b,_):b.__proto__=_)}function g(b){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(b){var m=new F(_);b(m),m.resolve()}return _}var $=function(b){p(_,b);function _(m){s(this,_);var O=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return O.name=m,O}return e(_,[{key:"resolve",value:function(O){var P=O.definitions[this.name];return P.resolve(O)}}]),_}(t.Reference),S=function(b){p(_,b);function _(m,O){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;s(this,_);var B=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return B.childReference=m,B.length=O,B.variable=P,B}return e(_,[{key:"resolve",value:function(O){var P=this.childReference,B=this.length;return P instanceof t.Reference&&(P=P.resolve(O)),B instanceof t.Reference&&(B=B.resolve(O)),this.variable?new f.VarArray(P,B):new f.Array(P,B)}}]),_}(t.Reference),A=function(b){p(_,b);function _(m){s(this,_);var O=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return O.childReference=m,O.name=m.name,O}return e(_,[{key:"resolve",value:function(O){var P=this.childReference;return P instanceof t.Reference&&(P=P.resolve(O)),new f.Option(P)}}]),_}(t.Reference),E=function(b){p(_,b);function _(m,O){s(this,_);var P=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return P.sizedType=m,P.length=O,P}return e(_,[{key:"resolve",value:function(O){var P=this.length;return P instanceof t.Reference&&(P=P.resolve(O)),new this.sizedType(P)}}]),_}(t.Reference),h=function(){function b(_,m,O){s(this,b),this.constructor=_,this.name=m,this.config=O}return e(b,[{key:"resolve",value:function(m){return this.name in m.results?m.results[this.name]:this.constructor(m,this.name,this.config)}}]),b}();function I(b,_,m){return m instanceof t.Reference&&(m=m.resolve(b)),b.results[_]=m,m}function T(b,_,m){return b.results[_]=m,m}var F=function(){function b(_){s(this,b),this._destination=_,this._definitions={}}return e(b,[{key:"enum",value:function(m,O){var P=new h(f.Enum.create,m,O);this.define(m,P)}},{key:"struct",value:function(m,O){var P=new h(f.Struct.create,m,O);this.define(m,P)}},{key:"union",value:function(m,O){var P=new h(f.Union.create,m,O);this.define(m,P)}},{key:"typedef",value:function(m,O){var P=new h(I,m,O);this.define(m,P)}},{key:"const",value:function(m,O){var P=new h(T,m,O);this.define(m,P)}},{key:"void",value:function(){return f.Void}},{key:"bool",value:function(){return f.Bool}},{key:"int",value:function(){return f.Int}},{key:"hyper",value:function(){return f.Hyper}},{key:"uint",value:function(){return f.UnsignedInt}},{key:"uhyper",value:function(){return f.UnsignedHyper}},{key:"float",value:function(){return f.Float}},{key:"double",value:function(){return f.Double}},{key:"quadruple",value:function(){return f.Quadruple}},{key:"string",value:function(m){return new E(f.String,m)}},{key:"opaque",value:function(m){return new E(f.Opaque,m)}},{key:"varOpaque",value:function(m){return new E(f.VarOpaque,m)}},{key:"array",value:function(m,O){return new S(m,O)}},{key:"varArray",value:function(m,O){return new S(m,O,!0)}},{key:"option",value:function(m){return new A(m)}},{key:"define",value:function(m,O){if((0,i.default)(this._destination[m]))this._definitions[m]=O;else throw new Error("XDRTypes Error:"+m+" is already defined")}},{key:"lookup",value:function(m){return new $(m)}},{key:"resolve",value:function(){var m=this;(0,o.default)(this._definitions,function(O){O.resolve({definitions:m._definitions,results:m._destination})})}}]),b}()})(Wu),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=pi;Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[n]}})});var t=Wu;Object.keys(t).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[n]}})})}(Ko);var qi=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)},k=(r,e,t)=>(qi(r,e,"read from private field"),t?t.call(r):e.get(r)),Ne=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},Ui=(r,e,t,n)=>(qi(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),me=(r,e,t)=>(qi(r,e,"access private method"),t),ie,ae,Gr,Li,zu,ki,Xu,sn,ji,or,Hr;function RO(r){const e={variantId:de.Uint64.fromString(r.variantId.toString()),version:r.version||Math.floor(Date.now()/1e3),items:r.items.map(n=>new de.BundleItem({collectionId:de.Uint64.fromString(n.collectionId.toString()),productId:de.Uint64.fromString(n.productId.toString()),variantId:de.Uint64.fromString(n.variantId.toString()),sku:n.sku||"",quantity:n.quantity,ext:new de.BundleItemExt(0)})),ext:new de.BundleExt(0)},t=new de.Bundle(e);return de.BundleEnvelope.envelopeTypeBundle(t).toXDR("base64")}const de=Ko.config(r=>{r.enum("EnvelopeType",{envelopeTypeBundle:0}),r.typedef("Uint32",r.uint()),r.typedef("Uint64",r.uhyper()),r.union("BundleItemExt",{switchOn:r.int(),switchName:"v",switches:[[0,r.void()]],arms:{}}),r.struct("BundleItem",[["collectionId",r.lookup("Uint64")],["productId",r.lookup("Uint64")],["variantId",r.lookup("Uint64")],["sku",r.string()],["quantity",r.lookup("Uint32")],["ext",r.lookup("BundleItemExt")]]),r.union("BundleExt",{switchOn:r.int(),switchName:"v",switches:[[0,r.void()]],arms:{}}),r.struct("Bundle",[["variantId",r.lookup("Uint64")],["items",r.varArray(r.lookup("BundleItem"),500)],["version",r.lookup("Uint32")],["ext",r.lookup("BundleExt")]]),r.union("BundleEnvelope",{switchOn:r.lookup("EnvelopeType"),switchName:"type",switches:[["envelopeTypeBundle","v1"]],arms:{v1:r.lookup("Bundle")}})});class MO{constructor(e,t){Ne(this,Li),Ne(this,ki),Ne(this,sn),Ne(this,or),Ne(this,ie,void 0),Ne(this,ae,void 0),Ne(this,Gr,void 0),Ui(this,ie,me(this,Li,zu).call(this,t)),Ui(this,Gr,me(this,ki,Xu).call(this,t)),Ui(this,ae,e)}isInitialDataValid(){if(!k(this,Gr))throw"Bundle data does not exist for the given product.";if(!k(this,ie))throw"Bundle settings do not exist for the given product.";if(!Array.isArray(k(this,ae))||!k(this,ae).length)throw"No bundle selection items provided.";return!0}isValidVariant(e){if(!k(this,ie)?.variantsSettings[e])throw`The ${e} bundle variant is invalid.`;return!0}isSelectionInVariantRange(e){const t=k(this,ae).reduce((i,a)=>i+a.quantity,0),n=k(this,ie)?.variantsSettings[e].ranges||[];if(!me(this,sn,ji).call(this,n,t))throw"The total number of products does not fall within the required variant range.";return!0}areItemsInMaxPerItemBound(){const e=k(this,ie)?.bundleSettings.maxPerItem||0,t=k(this,ae).filter(({quantity:n})=>n>e);if(e&&t.length)throw`The selected products (${me(this,or,Hr).call(this,t.map(({externalProductId:n})=>n)).join(", ")}) exceed the maximum limit of ${e} items per product.`;return!0}areSelectedCollectionsValid(e){const t=k(this,ie)?.variantsSettings[e],n=k(this,ae).filter(({collectionId:i})=>!t?.optionSources[i]);if(n.length)throw`The collections (${me(this,or,Hr).call(this,n.map(({collectionId:i})=>i)).join(", ")}) are no longer valid for the bundle variant (${e}).`;return!0}areItemsQuantitiesValidForTheCollection(e){const t=k(this,ae).reduce((a,o)=>(a[o.collectionId]=o.quantity+(a[o.collectionId]||0),a),{}),n=k(this,ie)?.variantsSettings[e],i=Object.values(n?.optionSources||{}).filter(a=>{const o=t[a.collectionId]||0;return!me(this,sn,ji).call(this,[a],o)});if(!n||i.length)throw`The selection exceeds the limits for the collections (${me(this,or,Hr).call(this,i.map(({collectionId:a})=>a)).join(", ")}).`;return!0}areSelectedProductsValid(e){const t=k(this,ie)?.variantsSettings[e]?.optionSources||{},n=Object.values(t).reduce((a,o)=>{const u=k(this,Gr)?.collections[o.collectionId];return u&&(a[o.collectionId]=u),a},{});if(!Object.values(n).length)throw`No collections found for the bundle variant (${e}).`;const i=k(this,ae).filter(({externalProductId:a,collectionId:o})=>!n[o]?.products[a]);if(i.length)throw`The products (${me(this,or,Hr).call(this,i.map(({externalProductId:a})=>a)).join(", ")}) are no longer valid for the bundle product.`;return!0}isBundleSelectionValid(e){return this.isInitialDataValid(),this.isValidVariant(e),this.isSelectionInVariantRange(e),this.areItemsInMaxPerItemBound(),this.areSelectedCollectionsValid(e),this.areItemsQuantitiesValidForTheCollection(e),this.areSelectedProductsValid(e),!0}}ie=new WeakMap,ae=new WeakMap,Gr=new WeakMap,Li=new WeakSet,zu=function(r){try{const e=r.bundle_settings;return{bundleSettings:{maxPerItem:e.max_quantity_per_variant,isCustomizable:e.is_customizable},variantsSettings:e.variants.reduce((t,n)=>{if(!n.enabled)return t;let i=[{min:n.items_count,max:n.items_count}];return n.items_count||(i=n.ranges.map(({quantity_max:a,quantity_min:o})=>({min:o,max:a}))),t[n.external_variant_id]={externalVariantId:n.external_variant_id,optionSources:n.option_sources.reduce((a,o)=>(a[o.option_source_id]={min:o.quantity_min,max:o.quantity_max,collectionId:o.option_source_id},a),{}),ranges:i},t},{})}}catch{return null}},ki=new WeakSet,Xu=function(r){try{const e=Object.values(r.collections).reduce((t,n)=>(t[n.id]={...n,products:n.products.reduce((i,a)=>(i[a.id]=a,i),{})},t),{});return{...r,collections:e}}catch{return null}},sn=new WeakSet,ji=function(r,e){return!!r.filter(({min:t,max:n})=>{const i=t??e,a=n??e;return i<=e&&e<=a}).length},or=new WeakSet,Hr=function(r){return Array.from(new Set(r))};const DO="/bundling-storefront-manager";function Yu(r){return RO({variantId:r.externalVariantId,version:0,items:r.selections.map(e=>({collectionId:e.collectionId,productId:e.externalProductId,variantId:e.externalVariantId,quantity:e.quantity,sku:""}))})}async function CO(r){const e=j(),t=await Vi(r);if(t!==!0)throw new Error(t);const n=Yu(r);try{const i=await Fe("post",`${DO}/api/v1/bundles`,{data:{bundle:n},headers:{Origin:`https://${e.storeIdentifier}`}});if(!i.id||i.code!==200)throw new Error(`1: failed generating rb_id: ${JSON.stringify(i)}`);return i.id}catch(i){throw new Error(`2: failed generating rb_id ${i}`)}}async function NO(r,e){const t=await Vi(e);if(t!==!0)throw new Error(t);const n=Yu(e);try{const i=await w("post","/bundle_selections/bundle_id",{data:{bundle:n}},v(r,"getBundleSelectionId"));if(!i.id||i.code!==200)throw new Error(`1: failed generating rb_id: ${JSON.stringify(i)}`);return i.id}catch(i){throw new Error(`2: failed generating rb_id ${i}`)}}function BO(r,e){const t=Ku(r);if(t!==!0)throw new Error(`Dynamic Bundle is invalid. ${t}`);const n=`${ya(9)}:${r.externalProductId}`;return r.selections.map(i=>{const a={id:i.externalVariantId,quantity:i.quantity,properties:{_rc_bundle:n,_rc_bundle_variant:r.externalVariantId,_rc_bundle_parent:e,_rc_bundle_collection_id:i.collectionId}};return i.sellingPlan?a.selling_plan=i.sellingPlan:i.shippingIntervalFrequency&&(a.properties.shipping_interval_frequency=i.shippingIntervalFrequency,a.properties.shipping_interval_unit_type=i.shippingIntervalUnitType,a.id=`${i.discountedVariantId}`),a})}async function Vi(r){try{return r?r.selections.length===0?"No selections defined":!0:"Bundle is not defined"}catch(e){return`Error fetching bundle settings: ${e}`}}async function qO(r){try{const e=await Fe("get",`/bundle-data/${r.externalProductId}`);return{valid:new MO(r.selections,e).isBundleSelectionValid(r.externalVariantId)}}catch(e){return{valid:!1,error:String(e)}}}const UO={day:["day","days","Days"],days:["day","days","Days"],Days:["day","days","Days"],week:["week","weeks","Weeks"],weeks:["week","weeks","Weeks"],Weeks:["week","weeks","Weeks"],month:["month","months","Months"],months:["month","months","Months"],Months:["month","months","Months"]};function Ku(r){if(!r)return"No bundle defined.";if(r.selections.length===0)return"No selections defined.";const{shippingIntervalFrequency:e,shippingIntervalUnitType:t}=r.selections.find(n=>n.shippingIntervalFrequency||n.shippingIntervalUnitType)||{};if(e||t){if(!e||!t)return"Shipping intervals do not match on selections.";{const n=UO[t];for(let i=0;i<r.selections.length;i++){const{shippingIntervalFrequency:a,shippingIntervalUnitType:o}=r.selections[i];if(a&&a!==e||o&&!n.includes(o))return"Shipping intervals do not match on selections."}}}return!0}async function LO(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{bundle_selection:t}=await w("get","/bundle_selections",{id:e},v(r,"getBundleSelection"));return t}function kO(r,e){return w("get","/bundle_selections",{query:e},v(r,"listBundleSelections"))}async function jO(r,e){const{bundle_selection:t}=await w("post","/bundle_selections",{data:e},v(r,"createBundleSelection"));return t}async function VO(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{bundle_selection:n}=await w("put","/bundle_selections",{id:e,data:t},v(r,"updateBundleSelection"));return n}function GO(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/bundle_selections",{id:e},v(r,"deleteBundleSelection"))}async function HO(r,e,t,n){if(e===void 0||e==="")throw new Error("Purchase item ID is required");const{subscription:i}=await w("put","/bundles",{id:e,data:t,query:n},v(r,"updateBundle"));return i}var WO=Object.freeze({__proto__:null,createBundleSelection:jO,deleteBundleSelection:GO,getBundleId:CO,getBundleSelection:LO,getBundleSelectionId:NO,getDynamicBundleItems:BO,listBundleSelections:kO,updateBundle:HO,updateBundleSelection:VO,validateBundle:Vi,validateBundleSelection:qO,validateDynamicBundle:Ku});const zO=r=>{const e=r.layout_settings.addons,t=r.layout_settings.crossSells,n=r.customization_window,i=r.default_bundle_variant_id,a=r.layout_settings.defaultFrequency,o=r.layout_settings.addToCartCallback;return{default_variant_id:i?String(i):null,is_customizable:r.is_customizable,price_rule:String(r.price_rule).toUpperCase(),customization_window:n?{active_days:n,disabled_message:r.customization_window_disabled_message||""}:null,addons:e.collectionId?{collection_id:e.collectionId,collection_handle:e.collectionHandle}:null,cross_sells:t.collectionId?{collection_id:e.collectionId,collection_handle:e.collectionHandle}:null,default_selling_plan_id:a||null,collapsible_collections:r.layout_settings.collapsibleSections,max_quantity_per_variant:r.max_quantity_per_variant,show_product_variants:r.layout_settings.showVariants,product_details_modal_enabled:r.layout_settings.learnMoreModal,addToCartBehavior:{type:o.type==="none"?"cart_page":o.type,value:o.value}}},XO=r=>r.tiered_discounts.length===0?null:{tiered_discounts:r.tiered_discounts},un=r=>({id:r.id,name:r.name,options:r.options.map(e=>({name:e.name,value:e.value})),recurring_deliveries:r.recurring_deliveries,price_adjustments:r.price_adjustments.map(({value:e,value_type:t})=>({value:e,value_type:t}))}),Zu=r=>({name:r.name,options:r.options.map(e=>({name:e.name,values:e.values})),selling_plans:r.selling_plans.map(un)}),Ju=r=>({id:String(r.id),title:r.title,price:r.price,compare_at_price:r.compare_at_price,options:r.options,available_for_sale:r.available}),Gi=r=>r==null||typeof r=="string"?r:"src"in r?r.src:null,Qu=r=>({id:String(r.id),title:r.title,description:r.description,available_for_sale:r.available,featured_image:Gi(r.featured_image),images:r.images,requires_selling_plan:r.requires_selling_plan,selling_plan_groups:r.selling_plan_groups.map(Zu)}),ef=r=>{const e=KO(r.selling_plan_groups);return{...Qu(r),handle:r.handle,tags:r.tags,price_range:{min:r.price_min,max:r.price_max},compare_at_price_range:{min:r.compare_at_price_min,max:r.compare_at_price_max},options:r.options,variants:r.variants.map(t=>({...Ju(t),selling_plan_allocations:t.selling_plan_allocations.map(n=>({price:n.price,compare_at_price:n.compare_at_price,selling_plan:un(e[`${n.selling_plan_group_id}-${n.selling_plan_id}`])})),option1:t.option1,option2:t.option2,option3:t.option3,sku:t.sku||"",requires_shipping:t.requires_shipping,taxable:t.taxable,featured_image:Gi(t.featured_image),public_title:t.public_title,requires_selling_plan:t.requires_selling_plan}))}},YO=({items_count:r,ranges:e})=>e.length>0?e.map(({quantity_max:t,quantity_min:n})=>({min:n,max:t})):[{min:r,max:r}],KO=r=>r.reduce((e,t)=>(t.selling_plans.forEach(n=>{const i=`${t.id}-${n.id}`;e[i]=n}),e),{}),ZO=r=>Array.isArray(r)?r:[];function Hi(r){const e=zO(r.bundle_settings),t=r.variants.reduce((n,i)=>(n[i.id]=i,n),{});return{id:String(r.id),title:r.title,description:r.description||null,handle:r.handle,options:r.options.map(n=>({name:n.name,position:n.position,values:n.values})),default_variant_id:e.default_variant_id,default_selling_plan_id:e.default_selling_plan_id?Number(e.default_selling_plan_id):null,available_for_sale:r.available,requires_selling_plan:r.requires_selling_plan,bundle_settings:{is_customizable:e.is_customizable,price_rule:e.price_rule,customization_window:e.customization_window,max_quantity_per_variant:e.max_quantity_per_variant,collapsible_collections:e.collapsible_collections,show_product_variants:e.show_product_variants,product_details_modal_enabled:e.product_details_modal_enabled,show_variants_as_individual_products:r.bundle_settings.settings.display_variants_as_separate_products_in_list,post_add_to_cart_behavior:e.addToCartBehavior},variants:r.bundle_settings.variants.filter(({enabled:n})=>n).map((n,i)=>{const a=t[String(n.external_variant_id)];return{id:String(n.external_variant_id),title:a.title,price:a.price,compare_at_price:a.compare_at_price,image:a.image||"",available_for_sale:a.available,options:a.options,requires_selling_plan:a.requires_selling_plan,selling_plan_allocations:a.selling_plan_allocations.map(o=>({price:o.price,compare_at_price:o.compare_at_price,selling_plan:un(o.selling_plan)})),ranges:YO(n),collections:n.option_sources.map(o=>({id:o.option_source_id,source_platform:"shopify",min:o.quantity_min||0,max:o.quantity_max,position:o.position})),default_selections:n.selection_defaults.map(o=>({quantity:o.quantity,product:{id:String(o.product.id),handle:o.handle,title:o.product.title,description:o.product.description,images:o.product.images},variant:{id:o.external_variant_id,title:o.variant.title,featured_image:Gi(o.variant.featured_image),sku:o.sku||""}})),position:i}}),selling_plan_groups:r.selling_plan_groups.map(Zu),collections:Object.values(r.collections).reduce((n,i)=>(Array.isArray(i.products)&&(n[String(i.id)]={id:String(i.id),title:i.title,handle:i.handle,products:i.products.map(ef)}),n),{}),addons:r.addons.products.length?{collection_id:e.addons?.collection_id||"",collection_handle:e.addons?.collection_handle||"",products:r.addons.products.map(n=>({...Qu(n),price_range:{min:n.price,max:n.price},compare_at_price_range:{min:n.compare_at_price||0,max:n.compare_at_price},variants:n.variants.map(i=>({...Ju(i),image:i.image,selling_plan_allocations:i.selling_plan_allocations.map(a=>({price:a.price,compare_at_price:a.compare_at_price,selling_plan:un(a.selling_plan)}))}))}))}:null,cross_sells:r.cross_sells.products.length?{collection_id:e.cross_sells?.collection_id||"",collection_handle:e.cross_sells?.collection_handle||"",products:r.cross_sells.products.map(ef)}:null,incentives:XO(r.incentives),filters:ZO(r.filters)}}async function JO(r,e){return e?.source==="shopify_storefront"?eI():QO(r,e?.country_code)}async function QO(r,e){const{appName:t,appVersion:n}=j(),i={"X-Recharge-Sdk-Fn":"loadFromOnlineStore","X-Recharge-Sdk-Version":"1.82.0",...t?{"X-Recharge-Sdk-App-Name":t}:{},...n?{"X-Recharge-Sdk-App-Version":n}:{}};if(!e){const o=await Fe("get",`/bundle-data/${r}`,{headers:i});return Hi(o)}const a=new FormData;a.append("form_type","localization"),a.append("_method","put"),a.append("return_to",`${Xo}/bundle-data/${r}`),a.append("country_code",e);try{const o=await X("post","/localization",{headers:{"Content-Type":"multipart/form-data",...i},data:a});return Hi(o)}catch{const o=await Fe("get",`/bundle-data/${r}`,{headers:i});return Hi(o)}}async function eI(r,e){if(!j().storeIdentifier)throw new Error("Store identifier is required for Shopify Storefront API requests");return{}}var rI=Object.freeze({__proto__:null,loadBundleData:JO}),tI=200,Wi="__lodash_hash_undefined__",nI=1/0,rf=9007199254740991,iI="[object Arguments]",aI="[object Function]",oI="[object GeneratorFunction]",sI="[object Symbol]",uI=/[\\^$.*+?()[\]{}|]/g,fI=/^\[object .+?Constructor\]$/,cI=/^(?:0|[1-9]\d*)$/,lI=typeof D=="object"&&D&&D.Object===Object&&D,dI=typeof self=="object"&&self&&self.Object===Object&&self,zi=lI||dI||Function("return this")();function pI(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}function hI(r,e){var t=r?r.length:0;return!!t&&_I(r,e,0)>-1}function yI(r,e,t){for(var n=-1,i=r?r.length:0;++n<i;)if(t(e,r[n]))return!0;return!1}function tf(r,e){for(var t=-1,n=r?r.length:0,i=Array(n);++t<n;)i[t]=e(r[t],t,r);return i}function Xi(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}function gI(r,e,t,n){for(var i=r.length,a=t+(n?1:-1);n?a--:++a<i;)if(e(r[a],a,r))return a;return-1}function _I(r,e,t){if(e!==e)return gI(r,vI,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function vI(r){return r!==r}function mI(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}function wI(r){return function(e){return r(e)}}function bI(r,e){return r.has(e)}function $I(r,e){return r?.[e]}function EI(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function nf(r,e){return function(t){return r(e(t))}}var SI=Array.prototype,AI=Function.prototype,fn=Object.prototype,Yi=zi["__core-js_shared__"],af=function(){var r=/[^.]+$/.exec(Yi&&Yi.keys&&Yi.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),of=AI.toString,sr=fn.hasOwnProperty,Ki=fn.toString,OI=RegExp("^"+of.call(sr).replace(uI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),sf=zi.Symbol,II=nf(Object.getPrototypeOf,Object),PI=fn.propertyIsEnumerable,xI=SI.splice,uf=sf?sf.isConcatSpreadable:void 0,Zi=Object.getOwnPropertySymbols,ff=Math.max,TI=lf(zi,"Map"),Wr=lf(Object,"create");function Be(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}function FI(){this.__data__=Wr?Wr(null):{}}function RI(r){return this.has(r)&&delete this.__data__[r]}function MI(r){var e=this.__data__;if(Wr){var t=e[r];return t===Wi?void 0:t}return sr.call(e,r)?e[r]:void 0}function DI(r){var e=this.__data__;return Wr?e[r]!==void 0:sr.call(e,r)}function CI(r,e){var t=this.__data__;return t[r]=Wr&&e===void 0?Wi:e,this}Be.prototype.clear=FI,Be.prototype.delete=RI,Be.prototype.get=MI,Be.prototype.has=DI,Be.prototype.set=CI;function ur(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}function NI(){this.__data__=[]}function BI(r){var e=this.__data__,t=ln(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():xI.call(e,t,1),!0}function qI(r){var e=this.__data__,t=ln(e,r);return t<0?void 0:e[t][1]}function UI(r){return ln(this.__data__,r)>-1}function LI(r,e){var t=this.__data__,n=ln(t,r);return n<0?t.push([r,e]):t[n][1]=e,this}ur.prototype.clear=NI,ur.prototype.delete=BI,ur.prototype.get=qI,ur.prototype.has=UI,ur.prototype.set=LI;function fr(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}function kI(){this.__data__={hash:new Be,map:new(TI||ur),string:new Be}}function jI(r){return dn(this,r).delete(r)}function VI(r){return dn(this,r).get(r)}function GI(r){return dn(this,r).has(r)}function HI(r,e){return dn(this,r).set(r,e),this}fr.prototype.clear=kI,fr.prototype.delete=jI,fr.prototype.get=VI,fr.prototype.has=GI,fr.prototype.set=HI;function cn(r){var e=-1,t=r?r.length:0;for(this.__data__=new fr;++e<t;)this.add(r[e])}function WI(r){return this.__data__.set(r,Wi),this}function zI(r){return this.__data__.has(r)}cn.prototype.add=cn.prototype.push=WI,cn.prototype.has=zI;function XI(r,e){var t=Ji(r)||df(r)?mI(r.length,String):[],n=t.length,i=!!n;for(var a in r)(e||sr.call(r,a))&&!(i&&(a=="length"||oP(a,n)))&&t.push(a);return t}function ln(r,e){for(var t=r.length;t--;)if(pP(r[t][0],e))return t;return-1}function YI(r,e,t,n){var i=-1,a=hI,o=!0,u=r.length,f=[],d=e.length;if(!u)return f;t&&(e=tf(e,wI(t))),n?(a=yI,o=!1):e.length>=tI&&(a=bI,o=!1,e=new cn(e));e:for(;++i<u;){var c=r[i],s=t?t(c):c;if(c=n||c!==0?c:0,o&&s===s){for(var l=d;l--;)if(e[l]===s)continue e;f.push(c)}else a(e,s,n)||f.push(c)}return f}function cf(r,e,t,n,i){var a=-1,o=r.length;for(t||(t=aP),i||(i=[]);++a<o;){var u=r[a];e>0&&t(u)?e>1?cf(u,e-1,t,n,i):Xi(i,u):n||(i[i.length]=u)}return i}function KI(r,e,t){var n=e(r);return Ji(r)?n:Xi(n,t(r))}function ZI(r){if(!Qi(r)||uP(r))return!1;var e=hf(r)||EI(r)?OI:fI;return e.test(dP(r))}function JI(r){if(!Qi(r))return cP(r);var e=fP(r),t=[];for(var n in r)n=="constructor"&&(e||!sr.call(r,n))||t.push(n);return t}function QI(r,e){return r=Object(r),eP(r,e,function(t,n){return n in r})}function eP(r,e,t){for(var n=-1,i=e.length,a={};++n<i;){var o=e[n],u=r[o];t(u,o)&&(a[o]=u)}return a}function rP(r,e){return e=ff(e===void 0?r.length-1:e,0),function(){for(var t=arguments,n=-1,i=ff(t.length-e,0),a=Array(i);++n<i;)a[n]=t[e+n];n=-1;for(var o=Array(e+1);++n<e;)o[n]=t[n];return o[e]=a,pI(r,this,o)}}function tP(r){return KI(r,_P,iP)}function dn(r,e){var t=r.__data__;return sP(e)?t[typeof e=="string"?"string":"hash"]:t.map}function lf(r,e){var t=$I(r,e);return ZI(t)?t:void 0}var nP=Zi?nf(Zi,Object):gf,iP=Zi?function(r){for(var e=[];r;)Xi(e,nP(r)),r=II(r);return e}:gf;function aP(r){return Ji(r)||df(r)||!!(uf&&r&&r[uf])}function oP(r,e){return e=e??rf,!!e&&(typeof r=="number"||cI.test(r))&&r>-1&&r%1==0&&r<e}function sP(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function uP(r){return!!af&&af in r}function fP(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||fn;return r===t}function cP(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}function lP(r){if(typeof r=="string"||gP(r))return r;var e=r+"";return e=="0"&&1/r==-nI?"-0":e}function dP(r){if(r!=null){try{return of.call(r)}catch{}try{return r+""}catch{}}return""}function pP(r,e){return r===e||r!==r&&e!==e}function df(r){return hP(r)&&sr.call(r,"callee")&&(!PI.call(r,"callee")||Ki.call(r)==iI)}var Ji=Array.isArray;function pf(r){return r!=null&&yP(r.length)&&!hf(r)}function hP(r){return yf(r)&&pf(r)}function hf(r){var e=Qi(r)?Ki.call(r):"";return e==aI||e==oI}function yP(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=rf}function Qi(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function yf(r){return!!r&&typeof r=="object"}function gP(r){return typeof r=="symbol"||yf(r)&&Ki.call(r)==sI}function _P(r){return pf(r)?XI(r,!0):JI(r)}var vP=rP(function(r,e){return r==null?{}:(e=tf(cf(e,1),lP),QI(r,YI(tP(r),e)))});function gf(){return[]}var mP=vP,ea=we(mP);function wP(r){try{return JSON.parse(r)}catch{return r}}function bP(r){return Object.entries(r).reduce((e,[t,n])=>({...e,[t]:wP(n)}),{})}const _f=r=>typeof r=="string"?r!=="0"&&r!=="false":!!r;function vf(r){const e=bP(r),t=e.auto_inject===void 0?!0:e.auto_inject,n=e.display_on??[],i=e.first_option==="autodeliver";return{...ea(e,["display_on","first_option"]),auto_inject:t,valid_pages:n,is_subscription_first:i,autoInject:t,validPages:n,isSubscriptionFirst:i}}function mf(r){const e=r.subscription_options?.storefront_purchase_options==="subscription_only";return{...r,is_subscription_only:e,isSubscriptionOnly:e}}function $P(r){return r.map(e=>{const t={};return Object.entries(e).forEach(([n,i])=>{t[n]=mf(i)}),t})}const ra="2020-12",EP={store_currency:{currency_code:"USD",currency_symbol:"$",decimal_separator:".",thousands_separator:",",currency_symbol_location:"left"}},zr=new Map;function pn(r,e){return zr.has(r)||zr.set(r,e()),zr.get(r)}async function ta(r,e){if(r===void 0||r==="")throw new Error("ID is required");const t=e?.version??"2020-12",{product:n}=await pn(`product.${r}.${t}`,()=>At("get",`/product/${t}/${r}.json`));return t==="2020-12"?mf(n):n}async function wf(){return await pn("storeSettings",()=>At("get",`/${ra}/store_settings.json`).catch(()=>EP))}async function bf(){const{widget_settings:r}=await pn("widgetSettings",()=>At("get",`/${ra}/widget_settings.json`));return vf(r)}async function $f(){const{products:r,widget_settings:e,store_settings:t,meta:n}=await pn("productsAndSettings",()=>At("get",`/product/${ra}/products.json`));return n?.status==="error"?Promise.reject(n.message):{products:$P(r),widget_settings:vf(e),store_settings:t??{}}}async function SP(){const{products:r}=await $f();return r}async function AP(r){const[e,t,n]=await Promise.all([ta(r),wf(),bf()]);return{product:e,store_settings:t,widget_settings:n,storeSettings:t,widgetSettings:n}}async function OP(r){const{bundle_product:e}=await ta(r);return e}async function Ef(){return Array.from(zr.keys()).forEach(r=>zr.delete(r))}var IP=Object.freeze({__proto__:null,getCDNBundleSettings:OP,getCDNProduct:ta,getCDNProductAndSettings:AP,getCDNProducts:SP,getCDNProductsAndSettings:$f,getCDNStoreSettings:wf,getCDNWidgetSettings:bf,resetCDNCache:Ef});async function PP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("get","/charges",{id:e,query:{include:t?.include}},v(r,"getCharge"));return n}function xP(r,e){return w("get","/charges",{query:e},v(r,"listCharges"))}async function TP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/charges/${e}/apply_discount`,{data:{discount_code:t}},v(r,"applyDiscountToCharge"));return n}async function FP(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{charge:t}=await w("post",`/charges/${e}/remove_discount`,{},v(r,"removeDiscountsFromCharge"));return t}async function RP(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");if(t===void 0||t.length===0)throw new Error("Purchase item IDs are required");const{charge:i}=await w("post",`/charges/${e}/skip`,{query:n,data:{purchase_item_ids:t.map(a=>Number(a))}},v(r,"skipCharge"));return i}async function MP(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");if(t===void 0||t.length===0)throw new Error("Purchase item IDs are required");const{charge:i}=await w("post",`/charges/${e}/unskip`,{query:n,data:{purchase_item_ids:t.map(a=>Number(a))}},v(r,"unskipCharge"));return i}async function DP(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{charge:t}=await w("post",`/charges/${e}/process`,{},v(r,"processCharge"));return t}async function CP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/charges/${e}/change_next_charge_date`,{data:{next_charge_date:t}},v(r,"rescheduleCharge"));return n}var NP=Object.freeze({__proto__:null,applyDiscountToCharge:TP,getCharge:PP,listCharges:xP,processCharge:DP,removeDiscountsFromCharge:FP,rescheduleCharge:CP,skipCharge:RP,unskipCharge:MP});async function Sf(r,e){if(!["2020-12","2022-06"].includes(e.format_version))throw new Error("Missing or unsupported format_version.");return w("get","/product_search",{query:e,headers:{"X-Recharge-Version":"2021-01"}},v(r,"productSearch"))}var BP=Object.freeze({__proto__:null,productSearch:Sf});async function Af(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{collection:t}=await w("get","/collections",{id:e},v(r,"getCollection"));return t}function qP(r,e){return w("get","/collections",{query:e},v(r,"listCollections"))}async function UP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");if(!["2020-12","2022-06"].includes(t.format_version))throw new Error("Missing or unsupported format_version.");const n=v(r,"listCollectionProducts"),[{sort_order:i,manual_sort_order:a},{products:o}]=await Promise.all([Af(n,e),Sf(n,{...t,collection_ids:[e],limit:250})]);if(i==="manual")return{products:a.reduce((u,f)=>{const d=o.find(c=>c.external_product_id===f);return d&&u.push(d),u},[])};{const u=LP(i);return{products:o.slice().sort(u)}}}function Of(r,e){const t=r.external_created_at,n=e.external_created_at;return t<n?-1:n>t?1:0}function If(r,e){const t=r.external_product_id,n=e.external_product_id;return t<n?-1:n>t?1:0}function Pf(r,e){const t=r.title.toLowerCase(),n=e.title.toLowerCase();return t<n?-1:n>t?1:0}function LP(r){switch(r){case"created_at-asc":return Of;case"created_at-desc":return(e,t)=>Of(t,e);case"id-asc":return If;case"id-desc":return(e,t)=>If(t,e);case"title-asc":return Pf;case"title-desc":return(e,t)=>Pf(t,e)}}var kP=Object.freeze({__proto__:null,getCollection:Af,listCollectionProducts:UP,listCollections:qP});async function jP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await w("get","/customers",{id:t,query:{include:e?.include}},v(r,"getCustomer"));return n}async function xf(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await w("put","/customers",{id:t,data:e},v(r,"updateCustomer"));return n}async function VP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{deliveries:n}=await w("get",`/customers/${t}/delivery_schedule`,{query:e},v(r,"getDeliverySchedule"));return n}async function hn(r,e){return w("get","/portal_access",{query:e},v(r,"getCustomerPortalAccess"))}async function GP(r,e,t){if(e===void 0||e==="")throw new Error("Subscription ID is required");const{base_url:n,customer_hash:i,temp_token:a}=await hn(v(r,"getActiveChurnLandingPageURL"));return`${n.replace("portal","pages")}${i}/subscriptions/${e}/cancel?token=${a}&subscription=${e}&redirect_to=${t}`}async function HP(r){const{base_url:e,customer_hash:t,temp_token:n}=await hn(v(r,"getFailedPaymentMethodRecoveryLandingPageURL"));return`${e.replace("portal","pages")}account/payment-methods?token=${n}&hash=${t}`}async function WP(r,e,t){if(e===void 0||e==="")throw new Error("Gift ID is required");const{base_url:n,customer_hash:i,temp_token:a}=await hn(v(r,"getGiftRedemptionLandingPageURL"));return`${n.replace("portal","pages")}${i}/gifts/${e}?token=${a}&redirect_to=${t}`}const zP={SHOPIFY_UPDATE_PAYMENT_INFO:{type:"email",template_type:"shopify_update_payment_information"},SHOPIFY_MIGRATE_PAYMENT_INFO:{type:"email",template_type:"shopify_migrate_payment_information"}};async function XP(r,e,t){const n=r.customerId;if(!n)throw new Error("Not logged in.");const i=zP[e];if(!i)throw new Error("Notification not supported.");return w("post",`/customers/${n}/notifications`,{data:{...i,template_vars:t}},v(r,"sendCustomerNotification"))}async function YP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{credit_summary:n}=await w("get",`/customers/${t}/credit_summary`,{query:{include:e?.include}},v(r,"getCreditSummary"));return n}var KP=Object.freeze({__proto__:null,getActiveChurnLandingPageURL:GP,getCreditSummary:YP,getCustomer:jP,getCustomerPortalAccess:hn,getDeliverySchedule:VP,getFailedPaymentMethodRecoveryLandingPageURL:HP,getGiftRedemptionLandingPageURL:WP,sendCustomerNotification:XP,updateCustomer:xf});async function ZP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{credit_summary:n}=await w("get",`/customers/${t}/credit_summary`,{query:{include:e?.include,presentment_currency_code:e?.presentment_currency_code}},v(r,"getCreditSummary"));return n}function JP(r,{recurring:e}){if(!r.customerId)throw new Error("Not logged in.");const t={};return e!==void 0&&(t.apply_credit_to_next_recurring_charge=e),xf(v(r,"setApplyCreditsToNextCharge"),t)}async function QP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");return await w("get","/credit_accounts",{query:{customer_id:t,...e}},v(r,"listCreditAccounts"))}var ex=Object.freeze({__proto__:null,getCreditSummary:ZP,listCreditAccounts:QP,setApplyCreditsToNextCharge:JP});async function rx(r,e,t){return await w("post","/customer_surveys/cancellation_prevention",{data:{customer_id:e,subscription_id:t}},v(r,"getCustomerSurveyReasons"))}async function tx(r,e,t,n){return await w("post",`/customer_surveys/${t}/customer_response`,{data:{customer_id:e,response_id:n}},v(r,"getCustomerSurveyOffers"))}async function nx(r,e){return await w("post","/offers/claim",{data:e},v(r,"claimOfferCustomerSurvey")),{}}var ix=Object.freeze({__proto__:null,claimOfferCustomerSurvey:nx,getCustomerSurveyOffers:tx,getCustomerSurveyReasons:rx});function ax(r,e){if(!r.customerId)throw new Error("Not logged in.");return w("get","/gift_purchases",{query:e},v(r,"listGiftPurchases"))}async function ox(r,e){if(!r.customerId)throw new Error("Not logged in.");if(e===void 0||e==="")throw new Error("ID is required");const{gift_purchase:t}=await w("get","/gift_purchases",{id:e},v(r,"getGiftPurchase"));return t}var sx=Object.freeze({__proto__:null,getGiftPurchase:ox,listGiftPurchases:ax});function ux(r,e){if(!r.customerId)throw new Error("Not logged in.");return w("get","/incentives/tiered_discounts",{query:e},v(r,"listTieredDiscounts"))}async function fx(r,e){if(!r.customerId)throw new Error("Not logged in.");if(e===void 0||e==="")throw new Error("ID is required");const{tiered_discount:t}=await w("get",`/incentives/tiered_discounts/${e}`,{},v(r,"getTieredDiscount"));return t}var cx=Object.freeze({__proto__:null,getTieredDiscount:fx,listTieredDiscounts:ux});async function lx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{membership:t}=await w("get","/memberships",{id:e},v(r,"getMembership"));return t}function dx(r,e){return w("get","/memberships",{query:e},v(r,"listMemberships"))}async function px(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${e}/cancel`,{data:t},v(r,"cancelMembership"));return n}async function hx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${e}/activate`,{data:t},v(r,"activateMembership"));return n}async function yx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${e}/change`,{data:t},v(r,"changeMembership"));return n}var gx=Object.freeze({__proto__:null,activateMembership:hx,cancelMembership:px,changeMembership:yx,getMembership:lx,listMemberships:dx});async function _x(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership_program:n}=await w("get","/membership_programs",{id:e,query:{include:t?.include}},v(r,"getMembershipProgram"));return n}function vx(r,e){return w("get","/membership_programs",{query:e},v(r,"listMembershipPrograms"))}var mx=Object.freeze({__proto__:null,getMembershipProgram:_x,listMembershipPrograms:vx});async function wx(r,e){const{metafield:t}=await w("post","/metafields",{data:{metafield:e}},v(r,"createMetafield"));return t}async function bx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{metafield:n}=await w("put","/metafields",{id:e,data:{metafield:t}},v(r,"updateMetafield"));return n}function $x(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/metafields",{id:e},v(r,"deleteMetafield"))}var Ex=Object.freeze({__proto__:null,createMetafield:wx,deleteMetafield:$x,updateMetafield:bx});async function Sx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{onetime:t}=await w("get","/onetimes",{id:e},v(r,"getOnetime"));return t}function Ax(r,e){return w("get","/onetimes",{query:e},v(r,"listOnetimes"))}async function Ox(r,e){const{onetime:t}=await w("post","/onetimes",{data:e},v(r,"createOnetime"));return t}async function Ix(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{onetime:n}=await w("put","/onetimes",{id:e,data:t},v(r,"updateOnetime"));return n}function Px(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/onetimes",{id:e},v(r,"deleteOnetime"))}var xx=Object.freeze({__proto__:null,createOnetime:Ox,deleteOnetime:Px,getOnetime:Sx,listOnetimes:Ax,updateOnetime:Ix});async function Tx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{order:t}=await w("get","/orders",{id:e},v(r,"getOrder"));return t}function Fx(r,e){return w("get","/orders",{query:e},v(r,"listOrders"))}async function Rx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{order:t}=await w("post",`/orders/${e}/delay`,{},v(r,"delayOrder"));return t}var Mx=Object.freeze({__proto__:null,delayOrder:Rx,getOrder:Tx,listOrders:Fx});async function Dx(r,e){return typeof window<"u"&&window.Spreedly?Promise.resolve():new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Document is not available. This function must be called in a browser environment."));return}if(document.querySelector(`script[src="${r}"]`)){const a=()=>{window.Spreedly?t():setTimeout(a,50)};a();return}const i=document.createElement("script");i.src=r,i.integrity=e,i.crossOrigin="anonymous",i.addEventListener("load",()=>{const a=()=>{window.Spreedly?t():setTimeout(a,50)};a()}),i.addEventListener("error",()=>{n(new Error("Failed to load payment iFrame script"))}),document.head.appendChild(i)})}async function Cx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{payment_method:n}=await w("get","/payment_methods",{id:e,query:{include:t?.include}},v(r,"getPaymentMethod"));return n}async function Tf(r,e){const{payment_method:t}=await w("post","/payment_methods",{data:{...e,customer_id:r.customerId}},v(r,"createPaymentMethod"));return t}async function Nx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{payment_method:n}=await w("put","/payment_methods",{id:e,data:t},v(r,"updatePaymentMethod"));return n}function Bx(r,e){return w("get","/payment_methods",{query:e},v(r,"listPaymentMethods"))}async function qx(r,e){const t=await Ux(r,e),n=t.external.environment_key,i=t.payment_method_intent_id,a=t.external_customer_id.ecommerce,o=t.external.resource_url,u=t.external.integrity_hash,f=t.payment_method?.processor_payment_method_token;await Dx(o,u);let d=!1,c=null,s=null,l=null;return{mount(p,g){if(typeof window>"u"||!window.Spreedly)throw new Error("Payment script failed to load");window.Spreedly.init(n,{numberEl:p.numberElementId,cvvEl:p.cvvElementId}),window.Spreedly.on("ready",()=>{d=!0,p.styles&&(window.Spreedly.setStyle("number",p.styles),window.Spreedly.setStyle("cvv",p.styles)),p.numberLabel&&window.Spreedly.setLabel("number",p.numberLabel),p.cvvLabel&&window.Spreedly.setLabel("cvv",p.cvvLabel),p.numberPlaceholder&&window.Spreedly.setPlaceholder("number",p.numberPlaceholder),p.cvvPlaceholder&&window.Spreedly.setPlaceholder("cvv",p.cvvPlaceholder),p.numberFormat==="plainFormat"?(p.numberFieldType&&window.Spreedly.setFieldType("number",p.numberFieldType),p.cvvFieldType&&window.Spreedly.setFieldType("cvv",p.cvvFieldType),window.Spreedly.setNumberFormat("plainFormat")):p.numberFormat==="maskedFormat"?(window.Spreedly.setFieldType("cvv","text"),window.Spreedly.setFieldType("number","text"),window.Spreedly.setNumberFormat("maskedFormat")):p.numberFormat==="prettyFormat"?(p.numberFieldType==="text"||p.numberFieldType==="tel"?window.Spreedly.setFieldType("number",p.numberFieldType):window.Spreedly.setFieldType("number","tel"),p.cvvFieldType==="text"||p.cvvFieldType==="tel"?window.Spreedly.setFieldType("cvv",p.cvvFieldType):window.Spreedly.setFieldType("cvv","tel"),window.Spreedly.setNumberFormat("prettyFormat")):(p.numberFieldType&&window.Spreedly.setFieldType("number",p.numberFieldType),p.cvvFieldType&&window.Spreedly.setFieldType("cvv",p.cvvFieldType)),g?.onReady?.()}),window.Spreedly.on("fieldEvent",($,S,A,E)=>{g?.onFieldEvent?.($,S,A,E)}),window.Spreedly.on("errors",$=>{g?.onErrors?.($)}),window.Spreedly.on("paymentMethod",($,S)=>{c=$,g?.onPaymentMethod?.($,S),s&&(c=null,s($),s=null)})},tokenize(p){if(!d||!window.Spreedly)throw new Error("Payment form is not initialized");let g=String(p.year);g.length===2&&(g=`20${g}`);const $=String(p.month).padStart(2,"0");"full_name"in p?window.Spreedly.tokenizeCreditCard({full_name:p.full_name,month:$,year:g}):window.Spreedly.tokenizeCreditCard({first_name:p.first_name,last_name:p.last_name,month:$,year:g})},async submit(p){if(!d)throw new Error("Payment form is not initialized");if(c){const g=c;return c=null,Ff(r,g,p,{external_payment_method_id:f,payment_method_intent_id:i,external_customer_id:a})}return new Promise((g,$)=>{l=p,s=async S=>{try{const A=await Ff(r,S,l,{external_payment_method_id:f,payment_method_intent_id:i,external_customer_id:a});g(A)}catch(A){$(A)}finally{l=null}},this.tokenize(p.card_details)})},reset(){window.Spreedly&&window.Spreedly.reload(),c=null,s=null,l=null},unmount(){window.Spreedly&&window.Spreedly.removeHandlers(),d=!1,c=null,s=null,l=null},addEventHandlers(p){p.onReady&&window.Spreedly.on("ready",p.onReady),p.onFieldEvent&&window.Spreedly.on("fieldEvent",p.onFieldEvent),p.onErrors&&window.Spreedly.on("errors",p.onErrors),p.onPaymentMethod&&window.Spreedly.on("paymentMethod",p.onPaymentMethod)},removeHandlers(){window.Spreedly&&window.Spreedly.removeHandlers()},setFieldType(p,g){window.Spreedly.setFieldType(p,g)},setLabel(p,g){window.Spreedly.setLabel(p,g)},setNumberFormat(p){window.Spreedly.setNumberFormat(p)},setPlaceholder(p,g){window.Spreedly.setPlaceholder(p,g)},setStyle(p,g){window.Spreedly.setStyle(p,g)}}}async function Ux(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");return await w("post","/payment_method_intents",{data:{customer_id:t,payment_method_id:e}},v(r,"createFrictionlessPaymentIntentV1"))}async function Ff(r,e,{billing_address:t,default_payment_method:n,address_ids:i,apply_to_all_subscription_addresses:a},{external_payment_method_id:o,payment_method_intent_id:u,external_customer_id:f}){return await Tf(v(r,"submitFrictionlessPaymentMethodV1"),{default:n??!1,payment_type:"CREDIT_CARD",processor_customer_token:f.toString(),processor_name:"frictionless",processor_payment_method_token:e,billing_address:t,payment_method_intent_id:u,address_ids:i,external_payment_method_id:o,apply_to_all_subscription_addresses:a})}var Lx=Object.freeze({__proto__:null,createPaymentMethod:Tf,getPaymentMethod:Cx,initFrictionlessPaymentV1:qx,listPaymentMethods:Bx,updatePaymentMethod:Nx});async function kx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{plan:t}=await w("get","/plans",{id:e},v(r,"getPlan"));return t}function jx(r,e){return w("get","/plans",{query:e},v(r,"listPlans"))}var Vx=Object.freeze({__proto__:null,getPlan:kx,listPlans:jx});async function Gx(r,e){return await w("get","/shop/shipping_countries",{query:e,headers:{"X-Recharge-Version":"2021-01"}},v(r,"getShippingCountries"))}async function Hx(r){return await w("get","/shop/settings",{headers:{"X-Recharge-Version":"2021-01"}},v(r,"getStoreSettings"))}var Wx=Object.freeze({__proto__:null,getShippingCountries:Gx,getStoreSettings:Hx}),zx="Expected a function",Rf="__lodash_placeholder__",qe=1,yn=2,Xx=4,cr=8,Xr=16,Ue=32,Yr=64,Mf=128,Yx=256,Df=512,Cf=1/0,Kx=9007199254740991,Zx=17976931348623157e292,Nf=0/0,Jx=[["ary",Mf],["bind",qe],["bindKey",yn],["curry",cr],["curryRight",Xr],["flip",Df],["partial",Ue],["partialRight",Yr],["rearg",Yx]],Qx="[object Function]",e2="[object GeneratorFunction]",r2="[object Symbol]",t2=/[\\^$.*+?()[\]{}|]/g,n2=/^\s+|\s+$/g,i2=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,a2=/\{\n\/\* \[wrapped with (.+)\] \*/,o2=/,? & /,s2=/^[-+]0x[0-9a-f]+$/i,u2=/^0b[01]+$/i,f2=/^\[object .+?Constructor\]$/,c2=/^0o[0-7]+$/i,l2=/^(?:0|[1-9]\d*)$/,d2=parseInt,p2=typeof D=="object"&&D&&D.Object===Object&&D,h2=typeof self=="object"&&self&&self.Object===Object&&self,Kr=p2||h2||Function("return this")();function na(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}function y2(r,e){for(var t=-1,n=r?r.length:0;++t<n&&e(r[t],t,r)!==!1;);return r}function g2(r,e){var t=r?r.length:0;return!!t&&v2(r,e,0)>-1}function _2(r,e,t,n){for(var i=r.length,a=t+(n?1:-1);n?a--:++a<i;)if(e(r[a],a,r))return a;return-1}function v2(r,e,t){if(e!==e)return _2(r,m2,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function m2(r){return r!==r}function w2(r,e){for(var t=r.length,n=0;t--;)r[t]===e&&n++;return n}function b2(r,e){return r?.[e]}function $2(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function ia(r,e){for(var t=-1,n=r.length,i=0,a=[];++t<n;){var o=r[t];(o===e||o===Rf)&&(r[t]=Rf,a[i++]=t)}return a}var E2=Function.prototype,Bf=Object.prototype,aa=Kr["__core-js_shared__"],qf=function(){var r=/[^.]+$/.exec(aa&&aa.keys&&aa.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Uf=E2.toString,S2=Bf.hasOwnProperty,Lf=Bf.toString,A2=RegExp("^"+Uf.call(S2).replace(t2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),O2=Object.create,lr=Math.max,I2=Math.min,kf=function(){var r=Vf(Object,"defineProperty"),e=Vf.name;return e&&e.length>2?r:void 0}();function P2(r){return dr(r)?O2(r):{}}function x2(r){if(!dr(r)||k2(r))return!1;var e=H2(r)||$2(r)?A2:f2;return e.test(V2(r))}function T2(r,e){return e=lr(e===void 0?r.length-1:e,0),function(){for(var t=arguments,n=-1,i=lr(t.length-e,0),a=Array(i);++n<i;)a[n]=t[e+n];n=-1;for(var o=Array(e+1);++n<e;)o[n]=t[n];return o[e]=a,na(r,this,o)}}function F2(r,e,t,n){for(var i=-1,a=r.length,o=t.length,u=-1,f=e.length,d=lr(a-o,0),c=Array(f+d),s=!n;++u<f;)c[u]=e[u];for(;++i<o;)(s||i<a)&&(c[t[i]]=r[i]);for(;d--;)c[u++]=r[i++];return c}function R2(r,e,t,n){for(var i=-1,a=r.length,o=-1,u=t.length,f=-1,d=e.length,c=lr(a-u,0),s=Array(c+d),l=!n;++i<c;)s[i]=r[i];for(var p=i;++f<d;)s[p+f]=e[f];for(;++o<u;)(l||i<a)&&(s[p+t[o]]=r[i++]);return s}function M2(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}function D2(r,e,t){var n=e&qe,i=Zr(r);function a(){var o=this&&this!==Kr&&this instanceof a?i:r;return o.apply(n?t:this,arguments)}return a}function Zr(r){return function(){var e=arguments;switch(e.length){case 0:return new r;case 1:return new r(e[0]);case 2:return new r(e[0],e[1]);case 3:return new r(e[0],e[1],e[2]);case 4:return new r(e[0],e[1],e[2],e[3]);case 5:return new r(e[0],e[1],e[2],e[3],e[4]);case 6:return new r(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new r(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var t=P2(r.prototype),n=r.apply(t,e);return dr(n)?n:t}}function C2(r,e,t){var n=Zr(r);function i(){for(var a=arguments.length,o=Array(a),u=a,f=sa(i);u--;)o[u]=arguments[u];var d=a<3&&o[0]!==f&&o[a-1]!==f?[]:ia(o,f);if(a-=d.length,a<t)return jf(r,e,oa,i.placeholder,void 0,o,d,void 0,void 0,t-a);var c=this&&this!==Kr&&this instanceof i?n:r;return na(c,this,o)}return i}function oa(r,e,t,n,i,a,o,u,f,d){var c=e&Mf,s=e&qe,l=e&yn,p=e&(cr|Xr),g=e&Df,$=l?void 0:Zr(r);function S(){for(var A=arguments.length,E=Array(A),h=A;h--;)E[h]=arguments[h];if(p)var I=sa(S),T=w2(E,I);if(n&&(E=F2(E,n,i,p)),a&&(E=R2(E,a,o,p)),A-=T,p&&A<d){var F=ia(E,I);return jf(r,e,oa,S.placeholder,t,E,F,u,f,d-A)}var b=s?t:this,_=l?b[r]:r;return A=E.length,u?E=j2(E,u):g&&A>1&&E.reverse(),c&&f<A&&(E.length=f),this&&this!==Kr&&this instanceof S&&(_=$||Zr(_)),_.apply(b,E)}return S}function N2(r,e,t,n){var i=e&qe,a=Zr(r);function o(){for(var u=-1,f=arguments.length,d=-1,c=n.length,s=Array(c+f),l=this&&this!==Kr&&this instanceof o?a:r;++d<c;)s[d]=n[d];for(;f--;)s[d++]=arguments[++u];return na(l,i?t:this,s)}return o}function jf(r,e,t,n,i,a,o,u,f,d){var c=e&cr,s=c?o:void 0,l=c?void 0:o,p=c?a:void 0,g=c?void 0:a;e|=c?Ue:Yr,e&=~(c?Yr:Ue),e&Xx||(e&=~(qe|yn));var $=t(r,e,i,p,s,g,l,u,f,d);return $.placeholder=n,Gf($,r,e)}function B2(r,e,t,n,i,a,o,u){var f=e&yn;if(!f&&typeof r!="function")throw new TypeError(zx);var d=n?n.length:0;if(d||(e&=~(Ue|Yr),n=i=void 0),o=o===void 0?o:lr(Hf(o),0),u=u===void 0?u:Hf(u),d-=i?i.length:0,e&Yr){var c=n,s=i;n=i=void 0}var l=[r,e,t,n,i,c,s,a,o,u];if(r=l[0],e=l[1],t=l[2],n=l[3],i=l[4],u=l[9]=l[9]==null?f?0:r.length:lr(l[9]-d,0),!u&&e&(cr|Xr)&&(e&=~(cr|Xr)),!e||e==qe)var p=D2(r,e,t);else e==cr||e==Xr?p=C2(r,e,u):(e==Ue||e==(qe|Ue))&&!i.length?p=N2(r,e,t,n):p=oa.apply(void 0,l);return Gf(p,r,e)}function sa(r){var e=r;return e.placeholder}function Vf(r,e){var t=b2(r,e);return x2(t)?t:void 0}function q2(r){var e=r.match(a2);return e?e[1].split(o2):[]}function U2(r,e){var t=e.length,n=t-1;return e[n]=(t>1?"& ":"")+e[n],e=e.join(t>2?", ":" "),r.replace(i2,`{
|
|
24
|
+
*/(function(e,t){typeof X$=="function"&&r&&r.exports?r.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(D,function(){function e(c,s,l){this.low=c|0,this.high=s|0,this.unsigned=!!l}e.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=function(s){return(s&&s.__isLong__)===!0};var t={},n={};e.fromInt=function(s,l){var p,g;return l?(s=s>>>0,0<=s&&s<256&&(g=n[s],g)?g:(p=new e(s,(s|0)<0?-1:0,!0),0<=s&&s<256&&(n[s]=p),p)):(s=s|0,-128<=s&&s<128&&(g=t[s],g)?g:(p=new e(s,s<0?-1:0,!1),-128<=s&&s<128&&(t[s]=p),p))},e.fromNumber=function(s,l){return l=!!l,isNaN(s)||!isFinite(s)?e.ZERO:!l&&s<=-f?e.MIN_VALUE:!l&&s+1>=f?e.MAX_VALUE:l&&s>=u?e.MAX_UNSIGNED_VALUE:s<0?e.fromNumber(-s,l).negate():new e(s%o|0,s/o|0,l)},e.fromBits=function(s,l,p){return new e(s,l,p)},e.fromString=function(s,l,p){if(s.length===0)throw Error("number format error: empty string");if(s==="NaN"||s==="Infinity"||s==="+Infinity"||s==="-Infinity")return e.ZERO;if(typeof l=="number"&&(p=l,l=!1),p=p||10,p<2||36<p)throw Error("radix out of range: "+p);var g;if((g=s.indexOf("-"))>0)throw Error('number format error: interior "-" character: '+s);if(g===0)return e.fromString(s.substring(1),l,p).negate();for(var $=e.fromNumber(Math.pow(p,8)),S=e.ZERO,A=0;A<s.length;A+=8){var E=Math.min(8,s.length-A),h=parseInt(s.substring(A,A+E),p);if(E<8){var I=e.fromNumber(Math.pow(p,E));S=S.multiply(I).add(e.fromNumber(h))}else S=S.multiply($),S=S.add(e.fromNumber(h))}return S.unsigned=l,S},e.fromValue=function(s){return s instanceof e?s:typeof s=="number"?e.fromNumber(s):typeof s=="string"?e.fromString(s):new e(s.low,s.high,s.unsigned)};var i=65536,a=1<<24,o=i*i,u=o*o,f=u/2,d=e.fromInt(a);return e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*o+(this.low>>>0):this.high*o+(this.low>>>0)},e.prototype.toString=function(s){if(s=s||10,s<2||36<s)throw RangeError("radix out of range: "+s);if(this.isZero())return"0";var l;if(this.isNegative())if(this.equals(e.MIN_VALUE)){var p=e.fromNumber(s),g=this.divide(p);return l=g.multiply(p).subtract(this),g.toString(s)+l.toInt().toString(s)}else return"-"+this.negate().toString(s);var $=e.fromNumber(Math.pow(s,6),this.unsigned);l=this;for(var S="";;){var A=l.divide($),E=l.subtract(A.multiply($)).toInt()>>>0,h=E.toString(s);if(l=A,l.isZero())return h+S;for(;h.length<6;)h="0"+h;S=""+h+S}},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(e.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var s=this.high!=0?this.high:this.low,l=31;l>0&&!(s&1<<l);l--);return this.high!=0?l+33:l+1},e.prototype.isZero=function(){return this.high===0&&this.low===0},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isOdd=function(){return(this.low&1)===1},e.prototype.isEven=function(){return(this.low&1)===0},e.prototype.equals=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.unsigned!==s.unsigned&&this.high>>>31===1&&s.high>>>31===1?!1:this.high===s.high&&this.low===s.low},e.eq=e.prototype.equals,e.prototype.notEquals=function(s){return!this.equals(s)},e.neq=e.prototype.notEquals,e.prototype.lessThan=function(s){return this.compare(s)<0},e.prototype.lt=e.prototype.lessThan,e.prototype.lessThanOrEqual=function(s){return this.compare(s)<=0},e.prototype.lte=e.prototype.lessThanOrEqual,e.prototype.greaterThan=function(s){return this.compare(s)>0},e.prototype.gt=e.prototype.greaterThan,e.prototype.greaterThanOrEqual=function(s){return this.compare(s)>=0},e.prototype.gte=e.prototype.greaterThanOrEqual,e.prototype.compare=function(s){if(e.isLong(s)||(s=e.fromValue(s)),this.equals(s))return 0;var l=this.isNegative(),p=s.isNegative();return l&&!p?-1:!l&&p?1:this.unsigned?s.high>>>0>this.high>>>0||s.high===this.high&&s.low>>>0>this.low>>>0?-1:1:this.subtract(s).isNegative()?-1:1},e.prototype.negate=function(){return!this.unsigned&&this.equals(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=e.prototype.negate,e.prototype.add=function(s){e.isLong(s)||(s=e.fromValue(s));var l=this.high>>>16,p=this.high&65535,g=this.low>>>16,$=this.low&65535,S=s.high>>>16,A=s.high&65535,E=s.low>>>16,h=s.low&65535,I=0,T=0,F=0,b=0;return b+=$+h,F+=b>>>16,b&=65535,F+=g+E,T+=F>>>16,F&=65535,T+=p+A,I+=T>>>16,T&=65535,I+=l+S,I&=65535,e.fromBits(F<<16|b,I<<16|T,this.unsigned)},e.prototype.subtract=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.add(s.negate())},e.prototype.sub=e.prototype.subtract,e.prototype.multiply=function(s){if(this.isZero()||(e.isLong(s)||(s=e.fromValue(s)),s.isZero()))return e.ZERO;if(this.equals(e.MIN_VALUE))return s.isOdd()?e.MIN_VALUE:e.ZERO;if(s.equals(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return s.isNegative()?this.negate().multiply(s.negate()):this.negate().multiply(s).negate();if(s.isNegative())return this.multiply(s.negate()).negate();if(this.lessThan(d)&&s.lessThan(d))return e.fromNumber(this.toNumber()*s.toNumber(),this.unsigned);var l=this.high>>>16,p=this.high&65535,g=this.low>>>16,$=this.low&65535,S=s.high>>>16,A=s.high&65535,E=s.low>>>16,h=s.low&65535,I=0,T=0,F=0,b=0;return b+=$*h,F+=b>>>16,b&=65535,F+=g*h,T+=F>>>16,F&=65535,F+=$*E,T+=F>>>16,F&=65535,T+=p*h,I+=T>>>16,T&=65535,T+=g*E,I+=T>>>16,T&=65535,T+=$*A,I+=T>>>16,T&=65535,I+=l*h+p*E+g*A+$*S,I&=65535,e.fromBits(F<<16|b,I<<16|T,this.unsigned)},e.prototype.mul=e.prototype.multiply,e.prototype.divide=function(s){if(e.isLong(s)||(s=e.fromValue(s)),s.isZero())throw new Error("division by zero");if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var l,p,g;if(this.equals(e.MIN_VALUE)){if(s.equals(e.ONE)||s.equals(e.NEG_ONE))return e.MIN_VALUE;if(s.equals(e.MIN_VALUE))return e.ONE;var $=this.shiftRight(1);return l=$.divide(s).shiftLeft(1),l.equals(e.ZERO)?s.isNegative()?e.ONE:e.NEG_ONE:(p=this.subtract(s.multiply(l)),g=l.add(p.divide(s)),g)}else if(s.equals(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return s.isNegative()?this.negate().divide(s.negate()):this.negate().divide(s).negate();if(s.isNegative())return this.divide(s.negate()).negate();for(g=e.ZERO,p=this;p.greaterThanOrEqual(s);){l=Math.max(1,Math.floor(p.toNumber()/s.toNumber()));for(var S=Math.ceil(Math.log(l)/Math.LN2),A=S<=48?1:Math.pow(2,S-48),E=e.fromNumber(l),h=E.multiply(s);h.isNegative()||h.greaterThan(p);)l-=A,E=e.fromNumber(l,this.unsigned),h=E.multiply(s);E.isZero()&&(E=e.ONE),g=g.add(E),p=p.subtract(h)}return g},e.prototype.div=e.prototype.divide,e.prototype.modulo=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.subtract(this.divide(s).multiply(s))},e.prototype.mod=e.prototype.modulo,e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.and=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low&s.low,this.high&s.high,this.unsigned)},e.prototype.or=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low|s.low,this.high|s.high,this.unsigned)},e.prototype.xor=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low^s.low,this.high^s.high,this.unsigned)},e.prototype.shiftLeft=function(s){return e.isLong(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?e.fromBits(this.low<<s,this.high<<s|this.low>>>32-s,this.unsigned):e.fromBits(0,this.low<<s-32,this.unsigned)},e.prototype.shl=e.prototype.shiftLeft,e.prototype.shiftRight=function(s){return e.isLong(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?e.fromBits(this.low>>>s|this.high<<32-s,this.high>>s,this.unsigned):e.fromBits(this.high>>s-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=e.prototype.shiftRight,e.prototype.shiftRightUnsigned=function(s){if(e.isLong(s)&&(s=s.toInt()),s&=63,s===0)return this;var l=this.high;if(s<32){var p=this.low;return e.fromBits(p>>>s|l<<32-s,l>>>s,this.unsigned)}else return s===32?e.fromBits(l,0,this.unsigned):e.fromBits(l>>>s-32,0,this.unsigned)},e.prototype.shru=e.prototype.shiftRightUnsigned,e.prototype.toSigned=function(){return this.unsigned?new e(this.low,this.high,!1):this},e.prototype.toUnsigned=function(){return this.unsigned?this:new e(this.low,this.high,!0)},e})})(au);var ou=au.exports;Object.defineProperty(jt,"__esModule",{value:!0}),jt.Hyper=void 0;var Y$=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),su=function r(e,t,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:r(a,t,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},K$=ou,Rr=uu(K$),Z$=M,J$=uu(Z$);function uu(r){return r&&r.__esModule?r:{default:r}}function Q$(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function eE(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function rE(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Mr=jt.Hyper=function(r){rE(e,r),Y$(e,null,[{key:"read",value:function(n){var i=n.readInt32BE(),a=n.readInt32BE();return this.fromBits(a,i)}},{key:"write",value:function(n,i){if(!(n instanceof this))throw new Error("XDR Write Error: "+n+" is not a Hyper");i.writeInt32BE(n.high),i.writeInt32BE(n.low)}},{key:"fromString",value:function(n){if(!/^-?\d+$/.test(n))throw new Error("Invalid hyper string: "+n);var i=su(e.__proto__||Object.getPrototypeOf(e),"fromString",this).call(this,n,!1);return new this(i.low,i.high)}},{key:"fromBits",value:function(n,i){var a=su(e.__proto__||Object.getPrototypeOf(e),"fromBits",this).call(this,n,i,!1);return new this(a.low,a.high)}},{key:"isValid",value:function(n){return n instanceof this}}]);function e(t,n){return Q$(this,e),eE(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!1))}return e}(Rr.default);(0,J$.default)(Mr),Mr.MAX_VALUE=new Mr(Rr.default.MAX_VALUE.low,Rr.default.MAX_VALUE.high),Mr.MIN_VALUE=new Mr(Rr.default.MIN_VALUE.low,Rr.default.MIN_VALUE.high);var Ce={};Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.UnsignedInt=void 0;var tE=It,fu=cu(tE),nE=M,iE=cu(nE);function cu(r){return r&&r.__esModule?r:{default:r}}var Dr=Ce.UnsignedInt={read:function(e){return e.readUInt32BE()},write:function(e,t){if(!(0,fu.default)(e))throw new Error("XDR Write Error: not a number");if(Math.floor(e)!==e)throw new Error("XDR Write Error: not an integer");if(e<0)throw new Error("XDR Write Error: negative number "+e);t.writeUInt32BE(e)},isValid:function(e){return!(0,fu.default)(e)||Math.floor(e)!==e?!1:e>=Dr.MIN_VALUE&&e<=Dr.MAX_VALUE}};Dr.MAX_VALUE=Math.pow(2,32)-1,Dr.MIN_VALUE=0,(0,iE.default)(Dr);var Vt={};Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.UnsignedHyper=void 0;var aE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),lu=function r(e,t,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:r(a,t,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},oE=ou,Cr=du(oE),sE=M,uE=du(sE);function du(r){return r&&r.__esModule?r:{default:r}}function fE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function cE(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function lE(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var Nr=Vt.UnsignedHyper=function(r){lE(e,r),aE(e,null,[{key:"read",value:function(n){var i=n.readInt32BE(),a=n.readInt32BE();return this.fromBits(a,i)}},{key:"write",value:function(n,i){if(!(n instanceof this))throw new Error("XDR Write Error: "+n+" is not an UnsignedHyper");i.writeInt32BE(n.high),i.writeInt32BE(n.low)}},{key:"fromString",value:function(n){if(!/^\d+$/.test(n))throw new Error("Invalid hyper string: "+n);var i=lu(e.__proto__||Object.getPrototypeOf(e),"fromString",this).call(this,n,!0);return new this(i.low,i.high)}},{key:"fromBits",value:function(n,i){var a=lu(e.__proto__||Object.getPrototypeOf(e),"fromBits",this).call(this,n,i,!0);return new this(a.low,a.high)}},{key:"isValid",value:function(n){return n instanceof this}}]);function e(t,n){return fE(this,e),cE(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!0))}return e}(Cr.default);(0,uE.default)(Nr),Nr.MAX_VALUE=new Nr(Cr.default.MAX_UNSIGNED_VALUE.low,Cr.default.MAX_UNSIGNED_VALUE.high),Nr.MIN_VALUE=new Nr(Cr.default.MIN_VALUE.low,Cr.default.MIN_VALUE.high);var Gt={};Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.Float=void 0;var dE=It,pu=hu(dE),pE=M,hE=hu(pE);function hu(r){return r&&r.__esModule?r:{default:r}}var yE=Gt.Float={read:function(e){return e.readFloatBE()},write:function(e,t){if(!(0,pu.default)(e))throw new Error("XDR Write Error: not a number");t.writeFloatBE(e)},isValid:function(e){return(0,pu.default)(e)}};(0,hE.default)(yE);var Ht={};Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.Double=void 0;var gE=It,yu=gu(gE),_E=M,vE=gu(_E);function gu(r){return r&&r.__esModule?r:{default:r}}var mE=Ht.Double={read:function(e){return e.readDoubleBE()},write:function(e,t){if(!(0,yu.default)(e))throw new Error("XDR Write Error: not a number");t.writeDoubleBE(e)},isValid:function(e){return(0,yu.default)(e)}};(0,vE.default)(mE);var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.Quadruple=void 0;var wE=M,bE=$E(wE);function $E(r){return r&&r.__esModule?r:{default:r}}var EE=Wt.Quadruple={read:function(){throw new Error("XDR Read Error: quadruple not supported")},write:function(){throw new Error("XDR Write Error: quadruple not supported")},isValid:function(){return!1}};(0,bE.default)(EE);var Br={},SE=_e,AE=ve,OE="[object Boolean]";function IE(r){return r===!0||r===!1||AE(r)&&SE(r)==OE}var PE=IE;Object.defineProperty(Br,"__esModule",{value:!0}),Br.Bool=void 0;var xE=PE,TE=vu(xE),_u=ce,FE=M,RE=vu(FE);function vu(r){return r&&r.__esModule?r:{default:r}}var ME=Br.Bool={read:function(e){var t=_u.Int.read(e);switch(t){case 0:return!1;case 1:return!0;default:throw new Error("XDR Read Error: Got "+t+" when trying to read a bool")}},write:function(e,t){var n=e?1:0;return _u.Int.write(n,t)},isValid:function(e){return(0,TE.default)(e)}};(0,RE.default)(ME);var zt={},DE=_e,CE=V,NE=ve,BE="[object String]";function qE(r){return typeof r=="string"||!CE(r)&&NE(r)&&DE(r)==BE}var mu=qE;Object.defineProperty(zt,"__esModule",{value:!0}),zt.String=void 0;var UE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),LE=mu,wu=Mi(LE),kE=V,jE=Mi(kE),bu=ce,VE=Ce,$u=Me,GE=M,HE=Mi(GE);function Mi(r){return r&&r.__esModule?r:{default:r}}function WE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var zE=zt.String=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:VE.UnsignedInt.MAX_VALUE;WE(this,r),this._maxLength=e}return UE(r,[{key:"read",value:function(t){var n=bu.Int.read(t);if(n>this._maxLength)throw new Error("XDR Read Error: Saw "+n+" length String,"+("max allowed is "+this._maxLength));var i=(0,$u.calculatePadding)(n),a=t.slice(n);return(0,$u.slicePadding)(t,i),a.buffer()}},{key:"readString",value:function(t){return this.read(t).toString("utf8")}},{key:"write",value:function(t,n){if(t.length>this._maxLength)throw new Error("XDR Write Error: Got "+t.length+" bytes,"+("max allows is "+this._maxLength));var i=void 0;(0,wu.default)(t)?i=y.from(t,"utf8"):i=y.from(t),bu.Int.write(i.length,n),n.writeBufferPadded(i)}},{key:"isValid",value:function(t){var n=void 0;if((0,wu.default)(t))n=y.from(t,"utf8");else if((0,jE.default)(t)||y.isBuffer(t))n=y.from(t);else return!1;return n.length<=this._maxLength}}]),r}();(0,HE.default)(zE.prototype);var Xt={};Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.Opaque=void 0;var XE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),Eu=Me,YE=M,KE=ZE(YE);function ZE(r){return r&&r.__esModule?r:{default:r}}function JE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var QE=Xt.Opaque=function(){function r(e){JE(this,r),this._length=e,this._padding=(0,Eu.calculatePadding)(e)}return XE(r,[{key:"read",value:function(t){var n=t.slice(this._length);return(0,Eu.slicePadding)(t,this._padding),n.buffer()}},{key:"write",value:function(t,n){if(t.length!==this._length)throw new Error("XDR Write Error: Got "+t.length+" bytes, expected "+this._length);n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length===this._length}}]),r}();(0,KE.default)(QE.prototype);var Yt={};Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.VarOpaque=void 0;var eS=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),Su=ce,rS=Ce,Au=Me,tS=M,nS=iS(tS);function iS(r){return r&&r.__esModule?r:{default:r}}function aS(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var oS=Yt.VarOpaque=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rS.UnsignedInt.MAX_VALUE;aS(this,r),this._maxLength=e}return eS(r,[{key:"read",value:function(t){var n=Su.Int.read(t);if(n>this._maxLength)throw new Error("XDR Read Error: Saw "+n+" length VarOpaque,"+("max allowed is "+this._maxLength));var i=(0,Au.calculatePadding)(n),a=t.slice(n);return(0,Au.slicePadding)(t,i),a.buffer()}},{key:"write",value:function(t,n){if(t.length>this._maxLength)throw new Error("XDR Write Error: Got "+t.length+" bytes,"+("max allows is "+this._maxLength));Su.Int.write(t.length,n),n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length<=this._maxLength}}]),r}();(0,nS.default)(oS.prototype);var Kt={};function sS(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}var uS=sS,fS=xt;function cS(r){return typeof r=="function"?r:fS}var Ou=cS,lS=uS,dS=vi,pS=Ou,hS=V;function yS(r,e){var t=hS(r)?lS:dS;return t(r,pS(e))}var gS=yS,ar=gS,_S=/\s/;function vS(r){for(var e=r.length;e--&&_S.test(r.charAt(e)););return e}var mS=vS,wS=mS,bS=/^\s+/;function $S(r){return r&&r.slice(0,wS(r)+1).replace(bS,"")}var ES=$S,SS=ES,Iu=Qe,AS=Lt,Pu=0/0,OS=/^[-+]0x[0-9a-f]+$/i,IS=/^0b[01]+$/i,PS=/^0o[0-7]+$/i,xS=parseInt;function TS(r){if(typeof r=="number")return r;if(AS(r))return Pu;if(Iu(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Iu(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=SS(r);var t=IS.test(r);return t||PS.test(r)?xS(r.slice(2),t?2:8):OS.test(r)?Pu:+r}var FS=TS,RS=FS,xu=1/0,MS=17976931348623157e292;function DS(r){if(!r)return r===0?r:0;if(r=RS(r),r===xu||r===-xu){var e=r<0?-1:1;return e*MS}return r===r?r:0}var CS=DS,NS=CS;function BS(r){var e=NS(r),t=e%1;return e===e?t?e-t:e:0}var qS=BS,US=cs,LS=Ou,kS=qS,jS=9007199254740991,Di=4294967295,VS=Math.min;function GS(r,e){if(r=kS(r),r<1||r>jS)return[];var t=Di,n=VS(r,Di);e=LS(e),r-=Di;for(var i=US(n,e);++t<r;)e(t);return i}var Tu=GS;Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.Array=void 0;var HS=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),WS=Fi,zS=qr(WS),XS=ar,YS=qr(XS),KS=Tu,ZS=qr(KS),JS=V,Fu=qr(JS),QS=M,eA=qr(QS);function qr(r){return r&&r.__esModule?r:{default:r}}function rA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var tA=Kt.Array=function(){function r(e,t){rA(this,r),this._childType=e,this._length=t}return HS(r,[{key:"read",value:function(t){var n=this;return(0,ZS.default)(this._length,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,Fu.default)(t))throw new Error("XDR Write Error: value is not array");if(t.length!==this._length)throw new Error("XDR Write Error: Got array of size "+t.length+","+("expected "+this._length));(0,YS.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,Fu.default)(t)||t.length!==this._length?!1:(0,zS.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,eA.default)(tA.prototype);var Zt={};Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.VarArray=void 0;var nA=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),iA=Fi,aA=Ur(iA),oA=ar,sA=Ur(oA),uA=Tu,fA=Ur(uA),cA=V,Ru=Ur(cA),lA=Ce,Mu=ce,dA=M,pA=Ur(dA);function Ur(r){return r&&r.__esModule?r:{default:r}}function hA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var yA=Zt.VarArray=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:lA.UnsignedInt.MAX_VALUE;hA(this,r),this._childType=e,this._maxLength=t}return nA(r,[{key:"read",value:function(t){var n=this,i=Mu.Int.read(t);if(i>this._maxLength)throw new Error("XDR Read Error: Saw "+i+" length VarArray,"+("max allowed is "+this._maxLength));return(0,fA.default)(i,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,Ru.default)(t))throw new Error("XDR Write Error: value is not array");if(t.length>this._maxLength)throw new Error("XDR Write Error: Got array of size "+t.length+","+("max allowed is "+this._maxLength));Mu.Int.write(t.length,n),(0,sA.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,Ru.default)(t)||t.length>this._maxLength?!1:(0,aA.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,pA.default)(yA.prototype);var Jt={};function gA(r){return r===null}var _A=gA;function vA(r){return r===void 0}var Lr=vA;Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.Option=void 0;var mA=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),wA=_A,Du=Ci(wA),bA=Lr,Cu=Ci(bA),Nu=Br,$A=M,EA=Ci($A);function Ci(r){return r&&r.__esModule?r:{default:r}}function SA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var AA=Jt.Option=function(){function r(e){SA(this,r),this._childType=e}return mA(r,[{key:"read",value:function(t){if(Nu.Bool.read(t))return this._childType.read(t)}},{key:"write",value:function(t,n){var i=!((0,Du.default)(t)||(0,Cu.default)(t));Nu.Bool.write(i,n),i&&this._childType.write(t,n)}},{key:"isValid",value:function(t){return(0,Du.default)(t)||(0,Cu.default)(t)?!0:this._childType.isValid(t)}}]),r}();(0,EA.default)(AA.prototype);var kr={};Object.defineProperty(kr,"__esModule",{value:!0}),kr.Void=void 0;var OA=Lr,Bu=qu(OA),IA=M,PA=qu(IA);function qu(r){return r&&r.__esModule?r:{default:r}}var xA=kr.Void={read:function(){},write:function(e){if(!(0,Bu.default)(e))throw new Error("XDR Write Error: trying to write value to a void slot")},isValid:function(e){return(0,Bu.default)(e)}};(0,PA.default)(xA);var Qt={},TA=Ti;function FA(r,e){return TA(e,function(t){return r[t]})}var RA=FA,MA=RA,DA=Mt;function CA(r){return r==null?[]:MA(r,DA(r))}var NA=CA;Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.Enum=void 0;var BA=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),qA=ar,UA=Ni(qA),LA=NA,kA=Ni(LA),Uu=ce,jA=M,VA=Ni(jA);function Ni(r){return r&&r.__esModule?r:{default:r}}function GA(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function HA(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function Lu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var WA=Qt.Enum=function(){function r(e,t){Lu(this,r),this.name=e,this.value=t}return BA(r,null,[{key:"read",value:function(t){var n=Uu.Int.read(t);if(!this._byValue.has(n))throw new Error("XDR Read Error: Unknown "+this.enumName+" member for value "+n);return this._byValue.get(n)}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: Unknown "+t+" is not a "+this.enumName);Uu.Int.write(t.value,n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"members",value:function(){return this._members}},{key:"values",value:function(){return(0,kA.default)(this._members)}},{key:"fromName",value:function(t){var n=this._members[t];if(!n)throw new Error(t+" is not a member of "+this.enumName);return n}},{key:"fromValue",value:function(t){var n=this._byValue.get(t);if(!n)throw new Error(t+" is not a value of any member of "+this.enumName);return n}},{key:"create",value:function(t,n,i){var a=function(o){HA(u,o);function u(){return Lu(this,u),GA(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u}(r);return a.enumName=n,t.results[n]=a,a._members={},a._byValue=new Map,(0,UA.default)(i,function(o,u){var f=new a(u,o);a._members[u]=f,a._byValue.set(o,f),a[u]=function(){return f}}),a}}]),r}();(0,VA.default)(WA);var en={},zA=vi,XA=Tr;function YA(r,e){var t=-1,n=XA(r)?Array(r.length):[];return zA(r,function(i,a,o){n[++t]=e(i,a,o)}),n}var KA=YA,ZA=Ti,JA=Qs,QA=KA,eO=V;function rO(r,e){var t=eO(r)?ZA:QA;return t(r,JA(e))}var tO=rO;function nO(r){for(var e=-1,t=r==null?0:r.length,n={};++e<t;){var i=r[e];n[i[0]]=i[1]}return n}var iO=nO,jr={};Object.defineProperty(jr,"__esModule",{value:!0});var aO=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function oO(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}jr.Reference=function(){function r(){oO(this,r)}return aO(r,[{key:"resolve",value:function(){throw new Error("implement resolve in child class")}}]),r}(),Object.defineProperty(en,"__esModule",{value:!0}),en.Struct=void 0;var rn=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var u=e[Symbol.iterator](),f;!(i=(f=u.next()).done)&&(n.push(f.value),!(t&&n.length===t));i=!0);}catch(d){a=!0,o=d}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),sO=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),uO=ar,ku=Vr(uO),fO=tO,cO=Vr(fO),lO=Lr,dO=Vr(lO),pO=iO,hO=Vr(pO),yO=jr,gO=M,_O=Vr(gO);function Vr(r){return r&&r.__esModule?r:{default:r}}function vO(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function mO(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function ju(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var wO=en.Struct=function(){function r(e){ju(this,r),this._attributes=e||{}}return sO(r,null,[{key:"read",value:function(t){var n=(0,cO.default)(this._fields,function(i){var a=rn(i,2),o=a[0],u=a[1],f=u.read(t);return[o,f]});return new this((0,hO.default)(n))}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.structName);(0,ku.default)(this._fields,function(i){var a=rn(i,2),o=a[0],u=a[1],f=t._attributes[o];u.write(f,n)})}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(o){mO(u,o);function u(){return ju(this,u),vO(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u}(r);return a.structName=n,t.results[n]=a,a._fields=i.map(function(o){var u=rn(o,2),f=u[0],d=u[1];return d instanceof yO.Reference&&(d=d.resolve(t)),[f,d]}),(0,ku.default)(a._fields,function(o){var u=rn(o,1),f=u[0];a.prototype[f]=bO(f)}),a}}]),r}();(0,_O.default)(wO);function bO(r){return function(t){return(0,dO.default)(t)||(this._attributes[r]=t),this._attributes[r]}}var tn={};Object.defineProperty(tn,"__esModule",{value:!0}),tn.Union=void 0;var $O=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var u=e[Symbol.iterator](),f;!(i=(f=u.next()).done)&&(n.push(f.value),!(t&&n.length===t));i=!0);}catch(d){a=!0,o=d}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),EO=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),SO=ar,nn=on(SO),AO=Lr,Vu=on(AO),OO=mu,Gu=on(OO),an=kr,Bi=jr,IO=M,PO=on(IO);function on(r){return r&&r.__esModule?r:{default:r}}function xO(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function TO(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function Hu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var FO=tn.Union=function(){function r(e,t){Hu(this,r),this.set(e,t)}return EO(r,[{key:"set",value:function(t,n){(0,Gu.default)(t)&&(t=this.constructor._switchOn.fromName(t)),this._switch=t,this._arm=this.constructor.armForSwitch(this._switch),this._armType=this.constructor.armTypeForArm(this._arm),this._value=n}},{key:"get",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this._arm;if(this._arm!==an.Void&&this._arm!==t)throw new Error(t+" not set");return this._value}},{key:"switch",value:function(){return this._switch}},{key:"arm",value:function(){return this._arm}},{key:"armType",value:function(){return this._armType}},{key:"value",value:function(){return this._value}}],[{key:"armForSwitch",value:function(t){if(this._switches.has(t))return this._switches.get(t);if(this._defaultArm)return this._defaultArm;throw new Error("Bad union switch: "+t)}},{key:"armTypeForArm",value:function(t){return t===an.Void?an.Void:this._arms[t]}},{key:"read",value:function(t){var n=this._switchOn.read(t),i=this.armForSwitch(n),a=this.armTypeForArm(i),o=void 0;return(0,Vu.default)(a)?o=i.read(t):o=a.read(t),new this(n,o)}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.unionName);this._switchOn.write(t.switch(),n),t.armType().write(t.value(),n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(u){TO(f,u);function f(){return Hu(this,f),xO(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}return f}(r);a.unionName=n,t.results[n]=a,i.switchOn instanceof Bi.Reference?a._switchOn=i.switchOn.resolve(t):a._switchOn=i.switchOn,a._switches=new Map,a._arms={},(0,nn.default)(i.arms,function(u,f){u instanceof Bi.Reference&&(u=u.resolve(t)),a._arms[f]=u});var o=i.defaultArm;return o instanceof Bi.Reference&&(o=o.resolve(t)),a._defaultArm=o,(0,nn.default)(i.switches,function(u){var f=$O(u,2),d=f[0],c=f[1];(0,Gu.default)(d)&&(d=a._switchOn.fromName(d)),a._switches.set(d,c)}),(0,Vu.default)(a._switchOn.values)||(0,nn.default)(a._switchOn.values(),function(u){a[u.name]=function(f){return new a(u,f)},a.prototype[u.name]=function(d){return this.set(u,d)}}),(0,nn.default)(a._arms,function(u,f){u!==an.Void&&(a.prototype[f]=function(){return this.get(f)})}),a}}]),r}();(0,PO.default)(FO),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=ce;Object.keys(e).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return e[h]}})});var t=jt;Object.keys(t).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return t[h]}})});var n=Ce;Object.keys(n).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return n[h]}})});var i=Vt;Object.keys(i).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return i[h]}})});var a=Gt;Object.keys(a).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return a[h]}})});var o=Ht;Object.keys(o).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return o[h]}})});var u=Wt;Object.keys(u).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return u[h]}})});var f=Br;Object.keys(f).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return f[h]}})});var d=zt;Object.keys(d).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return d[h]}})});var c=Xt;Object.keys(c).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return c[h]}})});var s=Yt;Object.keys(s).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return s[h]}})});var l=Kt;Object.keys(l).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return l[h]}})});var p=Zt;Object.keys(p).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return p[h]}})});var g=Jt;Object.keys(g).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return g[h]}})});var $=kr;Object.keys($).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return $[h]}})});var S=Qt;Object.keys(S).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return S[h]}})});var A=en;Object.keys(A).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return A[h]}})});var E=tn;Object.keys(E).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return E[h]}})})}(pi);var Wu={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=function(){function b(_,m){for(var O=0;O<m.length;O++){var P=m[O];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(_,P.key,P)}}return function(_,m,O){return m&&b(_.prototype,m),O&&b(_,O),_}}(),t=jr;Object.keys(t).forEach(function(b){b==="default"||b==="__esModule"||Object.defineProperty(r,b,{enumerable:!0,get:function(){return t[b]}})}),r.config=g;var n=Lr,i=c(n),a=ar,o=c(a),u=pi,f=d(u);function d(b){if(b&&b.__esModule)return b;var _={};if(b!=null)for(var m in b)Object.prototype.hasOwnProperty.call(b,m)&&(_[m]=b[m]);return _.default=b,_}function c(b){return b&&b.__esModule?b:{default:b}}function s(b,_){if(!(b instanceof _))throw new TypeError("Cannot call a class as a function")}function l(b,_){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:b}function p(b,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);b.prototype=Object.create(_&&_.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(b,_):b.__proto__=_)}function g(b){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(b){var m=new F(_);b(m),m.resolve()}return _}var $=function(b){p(_,b);function _(m){s(this,_);var O=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return O.name=m,O}return e(_,[{key:"resolve",value:function(O){var P=O.definitions[this.name];return P.resolve(O)}}]),_}(t.Reference),S=function(b){p(_,b);function _(m,O){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;s(this,_);var B=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return B.childReference=m,B.length=O,B.variable=P,B}return e(_,[{key:"resolve",value:function(O){var P=this.childReference,B=this.length;return P instanceof t.Reference&&(P=P.resolve(O)),B instanceof t.Reference&&(B=B.resolve(O)),this.variable?new f.VarArray(P,B):new f.Array(P,B)}}]),_}(t.Reference),A=function(b){p(_,b);function _(m){s(this,_);var O=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return O.childReference=m,O.name=m.name,O}return e(_,[{key:"resolve",value:function(O){var P=this.childReference;return P instanceof t.Reference&&(P=P.resolve(O)),new f.Option(P)}}]),_}(t.Reference),E=function(b){p(_,b);function _(m,O){s(this,_);var P=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return P.sizedType=m,P.length=O,P}return e(_,[{key:"resolve",value:function(O){var P=this.length;return P instanceof t.Reference&&(P=P.resolve(O)),new this.sizedType(P)}}]),_}(t.Reference),h=function(){function b(_,m,O){s(this,b),this.constructor=_,this.name=m,this.config=O}return e(b,[{key:"resolve",value:function(m){return this.name in m.results?m.results[this.name]:this.constructor(m,this.name,this.config)}}]),b}();function I(b,_,m){return m instanceof t.Reference&&(m=m.resolve(b)),b.results[_]=m,m}function T(b,_,m){return b.results[_]=m,m}var F=function(){function b(_){s(this,b),this._destination=_,this._definitions={}}return e(b,[{key:"enum",value:function(m,O){var P=new h(f.Enum.create,m,O);this.define(m,P)}},{key:"struct",value:function(m,O){var P=new h(f.Struct.create,m,O);this.define(m,P)}},{key:"union",value:function(m,O){var P=new h(f.Union.create,m,O);this.define(m,P)}},{key:"typedef",value:function(m,O){var P=new h(I,m,O);this.define(m,P)}},{key:"const",value:function(m,O){var P=new h(T,m,O);this.define(m,P)}},{key:"void",value:function(){return f.Void}},{key:"bool",value:function(){return f.Bool}},{key:"int",value:function(){return f.Int}},{key:"hyper",value:function(){return f.Hyper}},{key:"uint",value:function(){return f.UnsignedInt}},{key:"uhyper",value:function(){return f.UnsignedHyper}},{key:"float",value:function(){return f.Float}},{key:"double",value:function(){return f.Double}},{key:"quadruple",value:function(){return f.Quadruple}},{key:"string",value:function(m){return new E(f.String,m)}},{key:"opaque",value:function(m){return new E(f.Opaque,m)}},{key:"varOpaque",value:function(m){return new E(f.VarOpaque,m)}},{key:"array",value:function(m,O){return new S(m,O)}},{key:"varArray",value:function(m,O){return new S(m,O,!0)}},{key:"option",value:function(m){return new A(m)}},{key:"define",value:function(m,O){if((0,i.default)(this._destination[m]))this._definitions[m]=O;else throw new Error("XDRTypes Error:"+m+" is already defined")}},{key:"lookup",value:function(m){return new $(m)}},{key:"resolve",value:function(){var m=this;(0,o.default)(this._definitions,function(O){O.resolve({definitions:m._definitions,results:m._destination})})}}]),b}()})(Wu),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=pi;Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[n]}})});var t=Wu;Object.keys(t).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[n]}})})}(Ko);var qi=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)},k=(r,e,t)=>(qi(r,e,"read from private field"),t?t.call(r):e.get(r)),Ne=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},Ui=(r,e,t,n)=>(qi(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),me=(r,e,t)=>(qi(r,e,"access private method"),t),ie,ae,Gr,Li,zu,ki,Xu,sn,ji,or,Hr;function RO(r){const e={variantId:de.Uint64.fromString(r.variantId.toString()),version:r.version||Math.floor(Date.now()/1e3),items:r.items.map(n=>new de.BundleItem({collectionId:de.Uint64.fromString(n.collectionId.toString()),productId:de.Uint64.fromString(n.productId.toString()),variantId:de.Uint64.fromString(n.variantId.toString()),sku:n.sku||"",quantity:n.quantity,ext:new de.BundleItemExt(0)})),ext:new de.BundleExt(0)},t=new de.Bundle(e);return de.BundleEnvelope.envelopeTypeBundle(t).toXDR("base64")}const de=Ko.config(r=>{r.enum("EnvelopeType",{envelopeTypeBundle:0}),r.typedef("Uint32",r.uint()),r.typedef("Uint64",r.uhyper()),r.union("BundleItemExt",{switchOn:r.int(),switchName:"v",switches:[[0,r.void()]],arms:{}}),r.struct("BundleItem",[["collectionId",r.lookup("Uint64")],["productId",r.lookup("Uint64")],["variantId",r.lookup("Uint64")],["sku",r.string()],["quantity",r.lookup("Uint32")],["ext",r.lookup("BundleItemExt")]]),r.union("BundleExt",{switchOn:r.int(),switchName:"v",switches:[[0,r.void()]],arms:{}}),r.struct("Bundle",[["variantId",r.lookup("Uint64")],["items",r.varArray(r.lookup("BundleItem"),500)],["version",r.lookup("Uint32")],["ext",r.lookup("BundleExt")]]),r.union("BundleEnvelope",{switchOn:r.lookup("EnvelopeType"),switchName:"type",switches:[["envelopeTypeBundle","v1"]],arms:{v1:r.lookup("Bundle")}})});class MO{constructor(e,t){Ne(this,Li),Ne(this,ki),Ne(this,sn),Ne(this,or),Ne(this,ie,void 0),Ne(this,ae,void 0),Ne(this,Gr,void 0),Ui(this,ie,me(this,Li,zu).call(this,t)),Ui(this,Gr,me(this,ki,Xu).call(this,t)),Ui(this,ae,e)}isInitialDataValid(){if(!k(this,Gr))throw"Bundle data does not exist for the given product.";if(!k(this,ie))throw"Bundle settings do not exist for the given product.";if(!Array.isArray(k(this,ae))||!k(this,ae).length)throw"No bundle selection items provided.";return!0}isValidVariant(e){if(!k(this,ie)?.variantsSettings[e])throw`The ${e} bundle variant is invalid.`;return!0}isSelectionInVariantRange(e){const t=k(this,ae).reduce((i,a)=>i+a.quantity,0),n=k(this,ie)?.variantsSettings[e].ranges||[];if(!me(this,sn,ji).call(this,n,t))throw"The total number of products does not fall within the required variant range.";return!0}areItemsInMaxPerItemBound(){const e=k(this,ie)?.bundleSettings.maxPerItem||0,t=k(this,ae).filter(({quantity:n})=>n>e);if(e&&t.length)throw`The selected products (${me(this,or,Hr).call(this,t.map(({externalProductId:n})=>n)).join(", ")}) exceed the maximum limit of ${e} items per product.`;return!0}areSelectedCollectionsValid(e){const t=k(this,ie)?.variantsSettings[e],n=k(this,ae).filter(({collectionId:i})=>!t?.optionSources[i]);if(n.length)throw`The collections (${me(this,or,Hr).call(this,n.map(({collectionId:i})=>i)).join(", ")}) are no longer valid for the bundle variant (${e}).`;return!0}areItemsQuantitiesValidForTheCollection(e){const t=k(this,ae).reduce((a,o)=>(a[o.collectionId]=o.quantity+(a[o.collectionId]||0),a),{}),n=k(this,ie)?.variantsSettings[e],i=Object.values(n?.optionSources||{}).filter(a=>{const o=t[a.collectionId]||0;return!me(this,sn,ji).call(this,[a],o)});if(!n||i.length)throw`The selection exceeds the limits for the collections (${me(this,or,Hr).call(this,i.map(({collectionId:a})=>a)).join(", ")}).`;return!0}areSelectedProductsValid(e){const t=k(this,ie)?.variantsSettings[e]?.optionSources||{},n=Object.values(t).reduce((a,o)=>{const u=k(this,Gr)?.collections[o.collectionId];return u&&(a[o.collectionId]=u),a},{});if(!Object.values(n).length)throw`No collections found for the bundle variant (${e}).`;const i=k(this,ae).filter(({externalProductId:a,collectionId:o})=>!n[o]?.products[a]);if(i.length)throw`The products (${me(this,or,Hr).call(this,i.map(({externalProductId:a})=>a)).join(", ")}) are no longer valid for the bundle product.`;return!0}isBundleSelectionValid(e){return this.isInitialDataValid(),this.isValidVariant(e),this.isSelectionInVariantRange(e),this.areItemsInMaxPerItemBound(),this.areSelectedCollectionsValid(e),this.areItemsQuantitiesValidForTheCollection(e),this.areSelectedProductsValid(e),!0}}ie=new WeakMap,ae=new WeakMap,Gr=new WeakMap,Li=new WeakSet,zu=function(r){try{const e=r.bundle_settings;return{bundleSettings:{maxPerItem:e.max_quantity_per_variant,isCustomizable:e.is_customizable},variantsSettings:e.variants.reduce((t,n)=>{if(!n.enabled)return t;let i=[{min:n.items_count,max:n.items_count}];return n.items_count||(i=n.ranges.map(({quantity_max:a,quantity_min:o})=>({min:o,max:a}))),t[n.external_variant_id]={externalVariantId:n.external_variant_id,optionSources:n.option_sources.reduce((a,o)=>(a[o.option_source_id]={min:o.quantity_min,max:o.quantity_max,collectionId:o.option_source_id},a),{}),ranges:i},t},{})}}catch{return null}},ki=new WeakSet,Xu=function(r){try{const e=Object.values(r.collections).reduce((t,n)=>(t[n.id]={...n,products:n.products.reduce((i,a)=>(i[a.id]=a,i),{})},t),{});return{...r,collections:e}}catch{return null}},sn=new WeakSet,ji=function(r,e){return!!r.filter(({min:t,max:n})=>{const i=t??e,a=n??e;return i<=e&&e<=a}).length},or=new WeakSet,Hr=function(r){return Array.from(new Set(r))};const DO="/bundling-storefront-manager";function Yu(r){return RO({variantId:r.externalVariantId,version:0,items:r.selections.map(e=>({collectionId:e.collectionId,productId:e.externalProductId,variantId:e.externalVariantId,quantity:e.quantity,sku:""}))})}async function CO(r){const e=j(),t=await Vi(r);if(t!==!0)throw new Error(t);const n=Yu(r);try{const i=await Fe("post",`${DO}/api/v1/bundles`,{data:{bundle:n},headers:{Origin:`https://${e.storeIdentifier}`}});if(!i.id||i.code!==200)throw new Error(`1: failed generating rb_id: ${JSON.stringify(i)}`);return i.id}catch(i){throw new Error(`2: failed generating rb_id ${i}`)}}async function NO(r,e){const t=await Vi(e);if(t!==!0)throw new Error(t);const n=Yu(e);try{const i=await w("post","/bundle_selections/bundle_id",{data:{bundle:n}},v(r,"getBundleSelectionId"));if(!i.id||i.code!==200)throw new Error(`1: failed generating rb_id: ${JSON.stringify(i)}`);return i.id}catch(i){throw new Error(`2: failed generating rb_id ${i}`)}}function BO(r,e){const t=Ku(r);if(t!==!0)throw new Error(`Dynamic Bundle is invalid. ${t}`);const n=`${ya(9)}:${r.externalProductId}`;return r.selections.map(i=>{const a={id:i.externalVariantId,quantity:i.quantity,properties:{_rc_bundle:n,_rc_bundle_variant:r.externalVariantId,_rc_bundle_parent:e,_rc_bundle_collection_id:i.collectionId}};return i.sellingPlan?a.selling_plan=i.sellingPlan:i.shippingIntervalFrequency&&(a.properties.shipping_interval_frequency=i.shippingIntervalFrequency,a.properties.shipping_interval_unit_type=i.shippingIntervalUnitType,a.id=`${i.discountedVariantId}`),a})}async function Vi(r){try{return r?r.selections.length===0?"No selections defined":!0:"Bundle is not defined"}catch(e){return`Error fetching bundle settings: ${e}`}}async function qO(r){try{const e=await Fe("get",`/bundle-data/${r.externalProductId}`);return{valid:new MO(r.selections,e).isBundleSelectionValid(r.externalVariantId)}}catch(e){return{valid:!1,error:String(e)}}}const UO={day:["day","days","Days"],days:["day","days","Days"],Days:["day","days","Days"],week:["week","weeks","Weeks"],weeks:["week","weeks","Weeks"],Weeks:["week","weeks","Weeks"],month:["month","months","Months"],months:["month","months","Months"],Months:["month","months","Months"]};function Ku(r){if(!r)return"No bundle defined.";if(r.selections.length===0)return"No selections defined.";const{shippingIntervalFrequency:e,shippingIntervalUnitType:t}=r.selections.find(n=>n.shippingIntervalFrequency||n.shippingIntervalUnitType)||{};if(e||t){if(!e||!t)return"Shipping intervals do not match on selections.";{const n=UO[t];for(let i=0;i<r.selections.length;i++){const{shippingIntervalFrequency:a,shippingIntervalUnitType:o}=r.selections[i];if(a&&a!==e||o&&!n.includes(o))return"Shipping intervals do not match on selections."}}}return!0}async function LO(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{bundle_selection:t}=await w("get","/bundle_selections",{id:e},v(r,"getBundleSelection"));return t}function kO(r,e){return w("get","/bundle_selections",{query:e},v(r,"listBundleSelections"))}async function jO(r,e){const{bundle_selection:t}=await w("post","/bundle_selections",{data:e},v(r,"createBundleSelection"));return t}async function VO(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{bundle_selection:n}=await w("put","/bundle_selections",{id:e,data:t},v(r,"updateBundleSelection"));return n}function GO(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/bundle_selections",{id:e},v(r,"deleteBundleSelection"))}async function HO(r,e,t,n){if(e===void 0||e==="")throw new Error("Purchase item ID is required");const{subscription:i}=await w("put","/bundles",{id:e,data:t,query:n},v(r,"updateBundle"));return i}var WO=Object.freeze({__proto__:null,createBundleSelection:jO,deleteBundleSelection:GO,getBundleId:CO,getBundleSelection:LO,getBundleSelectionId:NO,getDynamicBundleItems:BO,listBundleSelections:kO,updateBundle:HO,updateBundleSelection:VO,validateBundle:Vi,validateBundleSelection:qO,validateDynamicBundle:Ku});const zO=r=>{const e=r.layout_settings.addons,t=r.layout_settings.crossSells,n=r.customization_window,i=r.default_bundle_variant_id,a=r.layout_settings.defaultFrequency,o=r.layout_settings.addToCartCallback;return{default_variant_id:i?String(i):null,is_customizable:r.is_customizable,price_rule:String(r.price_rule).toUpperCase(),customization_window:n?{active_days:n,disabled_message:r.customization_window_disabled_message||""}:null,addons:e.collectionId?{collection_id:e.collectionId,collection_handle:e.collectionHandle}:null,cross_sells:t.collectionId?{collection_id:e.collectionId,collection_handle:e.collectionHandle}:null,default_selling_plan_id:a||null,collapsible_collections:r.layout_settings.collapsibleSections,max_quantity_per_variant:r.max_quantity_per_variant,show_product_variants:r.layout_settings.showVariants,product_details_modal_enabled:r.layout_settings.learnMoreModal,addToCartBehavior:{type:o.type==="none"?"cart_page":o.type,value:o.value}}},XO=r=>r.tiered_discounts.length===0?null:{tiered_discounts:r.tiered_discounts},un=r=>({id:r.id,name:r.name,options:r.options.map(e=>({name:e.name,value:e.value})),recurring_deliveries:r.recurring_deliveries,price_adjustments:r.price_adjustments.map(({value:e,value_type:t})=>({value:e,value_type:t}))}),Zu=r=>({name:r.name,options:r.options.map(e=>({name:e.name,values:e.values})),selling_plans:r.selling_plans.map(un)}),Ju=r=>({id:String(r.id),title:r.title,price:r.price,compare_at_price:r.compare_at_price,options:r.options,available_for_sale:r.available}),Gi=r=>r==null||typeof r=="string"?r:"src"in r?r.src:null,Qu=r=>({id:String(r.id),title:r.title,description:r.description,available_for_sale:r.available,featured_image:Gi(r.featured_image),images:r.images,requires_selling_plan:r.requires_selling_plan,selling_plan_groups:r.selling_plan_groups.map(Zu)}),ef=r=>{const e=KO(r.selling_plan_groups);return{...Qu(r),handle:r.handle,tags:r.tags,price_range:{min:r.price_min,max:r.price_max},compare_at_price_range:{min:r.compare_at_price_min,max:r.compare_at_price_max},options:r.options,variants:r.variants.map(t=>({...Ju(t),selling_plan_allocations:t.selling_plan_allocations.map(n=>({price:n.price,compare_at_price:n.compare_at_price,selling_plan:un(e[`${n.selling_plan_group_id}-${n.selling_plan_id}`])})),option1:t.option1,option2:t.option2,option3:t.option3,sku:t.sku||"",requires_shipping:t.requires_shipping,taxable:t.taxable,featured_image:Gi(t.featured_image),public_title:t.public_title,requires_selling_plan:t.requires_selling_plan}))}},YO=({items_count:r,ranges:e})=>e.length>0?e.map(({quantity_max:t,quantity_min:n})=>({min:n,max:t})):[{min:r,max:r}],KO=r=>r.reduce((e,t)=>(t.selling_plans.forEach(n=>{const i=`${t.id}-${n.id}`;e[i]=n}),e),{}),ZO=r=>Array.isArray(r)?r:[];function Hi(r){const e=zO(r.bundle_settings),t=r.variants.reduce((n,i)=>(n[i.id]=i,n),{});return{id:String(r.id),title:r.title,description:r.description||null,handle:r.handle,options:r.options.map(n=>({name:n.name,position:n.position,values:n.values})),default_variant_id:e.default_variant_id,default_selling_plan_id:e.default_selling_plan_id?Number(e.default_selling_plan_id):null,available_for_sale:r.available,requires_selling_plan:r.requires_selling_plan,bundle_settings:{is_customizable:e.is_customizable,price_rule:e.price_rule,customization_window:e.customization_window,max_quantity_per_variant:e.max_quantity_per_variant,collapsible_collections:e.collapsible_collections,show_product_variants:e.show_product_variants,product_details_modal_enabled:e.product_details_modal_enabled,show_variants_as_individual_products:r.bundle_settings.settings.display_variants_as_separate_products_in_list,post_add_to_cart_behavior:e.addToCartBehavior},variants:r.bundle_settings.variants.filter(({enabled:n})=>n).map((n,i)=>{const a=t[String(n.external_variant_id)];return{id:String(n.external_variant_id),title:a.title,price:a.price,compare_at_price:a.compare_at_price,image:a.image||"",available_for_sale:a.available,options:a.options,requires_selling_plan:a.requires_selling_plan,selling_plan_allocations:a.selling_plan_allocations.map(o=>({price:o.price,compare_at_price:o.compare_at_price,selling_plan:un(o.selling_plan)})),ranges:YO(n),collections:n.option_sources.map(o=>({id:o.option_source_id,source_platform:"shopify",min:o.quantity_min||0,max:o.quantity_max,position:o.position})),default_selections:n.selection_defaults.map(o=>({quantity:o.quantity,product:{id:String(o.product.id),handle:o.handle,title:o.product.title,description:o.product.description,images:o.product.images},variant:{id:o.external_variant_id,title:o.variant.title,featured_image:Gi(o.variant.featured_image),sku:o.sku||""}})),position:i}}),selling_plan_groups:r.selling_plan_groups.map(Zu),collections:Object.values(r.collections).reduce((n,i)=>(Array.isArray(i.products)&&(n[String(i.id)]={id:String(i.id),title:i.title,handle:i.handle,products:i.products.map(ef)}),n),{}),addons:r.addons.products.length?{collection_id:e.addons?.collection_id||"",collection_handle:e.addons?.collection_handle||"",products:r.addons.products.map(n=>({...Qu(n),price_range:{min:n.price,max:n.price},compare_at_price_range:{min:n.compare_at_price||0,max:n.compare_at_price},variants:n.variants.map(i=>({...Ju(i),image:i.image,selling_plan_allocations:i.selling_plan_allocations.map(a=>({price:a.price,compare_at_price:a.compare_at_price,selling_plan:un(a.selling_plan)}))}))}))}:null,cross_sells:r.cross_sells.products.length?{collection_id:e.cross_sells?.collection_id||"",collection_handle:e.cross_sells?.collection_handle||"",products:r.cross_sells.products.map(ef)}:null,incentives:XO(r.incentives),filters:ZO(r.filters),templates:r.bundle_settings.layout_settings.templates||null,globalStyles:r.bundle_settings.layout_settings.globalStyles||null}}async function JO(r,e){return e?.source==="shopify_storefront"?eI():QO(r,e?.country_code)}async function QO(r,e){const{appName:t,appVersion:n}=j(),i={"X-Recharge-Sdk-Fn":"loadFromOnlineStore","X-Recharge-Sdk-Version":"1.83.0",...t?{"X-Recharge-Sdk-App-Name":t}:{},...n?{"X-Recharge-Sdk-App-Version":n}:{}};if(!e){const o=await Fe("get",`/bundle-data/${r}`,{headers:i});return Hi(o)}const a=new FormData;a.append("form_type","localization"),a.append("_method","put"),a.append("return_to",`${Xo}/bundle-data/${r}`),a.append("country_code",e);try{const o=await X("post","/localization",{headers:{"Content-Type":"multipart/form-data",...i},data:a});return Hi(o)}catch{const o=await Fe("get",`/bundle-data/${r}`,{headers:i});return Hi(o)}}async function eI(r,e){if(!j().storeIdentifier)throw new Error("Store identifier is required for Shopify Storefront API requests");return{}}var rI=Object.freeze({__proto__:null,loadBundleData:JO}),tI=200,Wi="__lodash_hash_undefined__",nI=1/0,rf=9007199254740991,iI="[object Arguments]",aI="[object Function]",oI="[object GeneratorFunction]",sI="[object Symbol]",uI=/[\\^$.*+?()[\]{}|]/g,fI=/^\[object .+?Constructor\]$/,cI=/^(?:0|[1-9]\d*)$/,lI=typeof D=="object"&&D&&D.Object===Object&&D,dI=typeof self=="object"&&self&&self.Object===Object&&self,zi=lI||dI||Function("return this")();function pI(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}function hI(r,e){var t=r?r.length:0;return!!t&&_I(r,e,0)>-1}function yI(r,e,t){for(var n=-1,i=r?r.length:0;++n<i;)if(t(e,r[n]))return!0;return!1}function tf(r,e){for(var t=-1,n=r?r.length:0,i=Array(n);++t<n;)i[t]=e(r[t],t,r);return i}function Xi(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}function gI(r,e,t,n){for(var i=r.length,a=t+(n?1:-1);n?a--:++a<i;)if(e(r[a],a,r))return a;return-1}function _I(r,e,t){if(e!==e)return gI(r,vI,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function vI(r){return r!==r}function mI(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}function wI(r){return function(e){return r(e)}}function bI(r,e){return r.has(e)}function $I(r,e){return r?.[e]}function EI(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function nf(r,e){return function(t){return r(e(t))}}var SI=Array.prototype,AI=Function.prototype,fn=Object.prototype,Yi=zi["__core-js_shared__"],af=function(){var r=/[^.]+$/.exec(Yi&&Yi.keys&&Yi.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),of=AI.toString,sr=fn.hasOwnProperty,Ki=fn.toString,OI=RegExp("^"+of.call(sr).replace(uI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),sf=zi.Symbol,II=nf(Object.getPrototypeOf,Object),PI=fn.propertyIsEnumerable,xI=SI.splice,uf=sf?sf.isConcatSpreadable:void 0,Zi=Object.getOwnPropertySymbols,ff=Math.max,TI=lf(zi,"Map"),Wr=lf(Object,"create");function Be(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}function FI(){this.__data__=Wr?Wr(null):{}}function RI(r){return this.has(r)&&delete this.__data__[r]}function MI(r){var e=this.__data__;if(Wr){var t=e[r];return t===Wi?void 0:t}return sr.call(e,r)?e[r]:void 0}function DI(r){var e=this.__data__;return Wr?e[r]!==void 0:sr.call(e,r)}function CI(r,e){var t=this.__data__;return t[r]=Wr&&e===void 0?Wi:e,this}Be.prototype.clear=FI,Be.prototype.delete=RI,Be.prototype.get=MI,Be.prototype.has=DI,Be.prototype.set=CI;function ur(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}function NI(){this.__data__=[]}function BI(r){var e=this.__data__,t=ln(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():xI.call(e,t,1),!0}function qI(r){var e=this.__data__,t=ln(e,r);return t<0?void 0:e[t][1]}function UI(r){return ln(this.__data__,r)>-1}function LI(r,e){var t=this.__data__,n=ln(t,r);return n<0?t.push([r,e]):t[n][1]=e,this}ur.prototype.clear=NI,ur.prototype.delete=BI,ur.prototype.get=qI,ur.prototype.has=UI,ur.prototype.set=LI;function fr(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}function kI(){this.__data__={hash:new Be,map:new(TI||ur),string:new Be}}function jI(r){return dn(this,r).delete(r)}function VI(r){return dn(this,r).get(r)}function GI(r){return dn(this,r).has(r)}function HI(r,e){return dn(this,r).set(r,e),this}fr.prototype.clear=kI,fr.prototype.delete=jI,fr.prototype.get=VI,fr.prototype.has=GI,fr.prototype.set=HI;function cn(r){var e=-1,t=r?r.length:0;for(this.__data__=new fr;++e<t;)this.add(r[e])}function WI(r){return this.__data__.set(r,Wi),this}function zI(r){return this.__data__.has(r)}cn.prototype.add=cn.prototype.push=WI,cn.prototype.has=zI;function XI(r,e){var t=Ji(r)||df(r)?mI(r.length,String):[],n=t.length,i=!!n;for(var a in r)(e||sr.call(r,a))&&!(i&&(a=="length"||oP(a,n)))&&t.push(a);return t}function ln(r,e){for(var t=r.length;t--;)if(pP(r[t][0],e))return t;return-1}function YI(r,e,t,n){var i=-1,a=hI,o=!0,u=r.length,f=[],d=e.length;if(!u)return f;t&&(e=tf(e,wI(t))),n?(a=yI,o=!1):e.length>=tI&&(a=bI,o=!1,e=new cn(e));e:for(;++i<u;){var c=r[i],s=t?t(c):c;if(c=n||c!==0?c:0,o&&s===s){for(var l=d;l--;)if(e[l]===s)continue e;f.push(c)}else a(e,s,n)||f.push(c)}return f}function cf(r,e,t,n,i){var a=-1,o=r.length;for(t||(t=aP),i||(i=[]);++a<o;){var u=r[a];e>0&&t(u)?e>1?cf(u,e-1,t,n,i):Xi(i,u):n||(i[i.length]=u)}return i}function KI(r,e,t){var n=e(r);return Ji(r)?n:Xi(n,t(r))}function ZI(r){if(!Qi(r)||uP(r))return!1;var e=hf(r)||EI(r)?OI:fI;return e.test(dP(r))}function JI(r){if(!Qi(r))return cP(r);var e=fP(r),t=[];for(var n in r)n=="constructor"&&(e||!sr.call(r,n))||t.push(n);return t}function QI(r,e){return r=Object(r),eP(r,e,function(t,n){return n in r})}function eP(r,e,t){for(var n=-1,i=e.length,a={};++n<i;){var o=e[n],u=r[o];t(u,o)&&(a[o]=u)}return a}function rP(r,e){return e=ff(e===void 0?r.length-1:e,0),function(){for(var t=arguments,n=-1,i=ff(t.length-e,0),a=Array(i);++n<i;)a[n]=t[e+n];n=-1;for(var o=Array(e+1);++n<e;)o[n]=t[n];return o[e]=a,pI(r,this,o)}}function tP(r){return KI(r,_P,iP)}function dn(r,e){var t=r.__data__;return sP(e)?t[typeof e=="string"?"string":"hash"]:t.map}function lf(r,e){var t=$I(r,e);return ZI(t)?t:void 0}var nP=Zi?nf(Zi,Object):gf,iP=Zi?function(r){for(var e=[];r;)Xi(e,nP(r)),r=II(r);return e}:gf;function aP(r){return Ji(r)||df(r)||!!(uf&&r&&r[uf])}function oP(r,e){return e=e??rf,!!e&&(typeof r=="number"||cI.test(r))&&r>-1&&r%1==0&&r<e}function sP(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function uP(r){return!!af&&af in r}function fP(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||fn;return r===t}function cP(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}function lP(r){if(typeof r=="string"||gP(r))return r;var e=r+"";return e=="0"&&1/r==-nI?"-0":e}function dP(r){if(r!=null){try{return of.call(r)}catch{}try{return r+""}catch{}}return""}function pP(r,e){return r===e||r!==r&&e!==e}function df(r){return hP(r)&&sr.call(r,"callee")&&(!PI.call(r,"callee")||Ki.call(r)==iI)}var Ji=Array.isArray;function pf(r){return r!=null&&yP(r.length)&&!hf(r)}function hP(r){return yf(r)&&pf(r)}function hf(r){var e=Qi(r)?Ki.call(r):"";return e==aI||e==oI}function yP(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=rf}function Qi(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function yf(r){return!!r&&typeof r=="object"}function gP(r){return typeof r=="symbol"||yf(r)&&Ki.call(r)==sI}function _P(r){return pf(r)?XI(r,!0):JI(r)}var vP=rP(function(r,e){return r==null?{}:(e=tf(cf(e,1),lP),QI(r,YI(tP(r),e)))});function gf(){return[]}var mP=vP,ea=we(mP);function wP(r){try{return JSON.parse(r)}catch{return r}}function bP(r){return Object.entries(r).reduce((e,[t,n])=>({...e,[t]:wP(n)}),{})}const _f=r=>typeof r=="string"?r!=="0"&&r!=="false":!!r;function vf(r){const e=bP(r),t=e.auto_inject===void 0?!0:e.auto_inject,n=e.display_on??[],i=e.first_option==="autodeliver";return{...ea(e,["display_on","first_option"]),auto_inject:t,valid_pages:n,is_subscription_first:i,autoInject:t,validPages:n,isSubscriptionFirst:i}}function mf(r){const e=r.subscription_options?.storefront_purchase_options==="subscription_only";return{...r,is_subscription_only:e,isSubscriptionOnly:e}}function $P(r){return r.map(e=>{const t={};return Object.entries(e).forEach(([n,i])=>{t[n]=mf(i)}),t})}const ra="2020-12",EP={store_currency:{currency_code:"USD",currency_symbol:"$",decimal_separator:".",thousands_separator:",",currency_symbol_location:"left"}},zr=new Map;function pn(r,e){return zr.has(r)||zr.set(r,e()),zr.get(r)}async function ta(r,e){if(r===void 0||r==="")throw new Error("ID is required");const t=e?.version??"2020-12",{product:n}=await pn(`product.${r}.${t}`,()=>At("get",`/product/${t}/${r}.json`));return t==="2020-12"?mf(n):n}async function wf(){return await pn("storeSettings",()=>At("get",`/${ra}/store_settings.json`).catch(()=>EP))}async function bf(){const{widget_settings:r}=await pn("widgetSettings",()=>At("get",`/${ra}/widget_settings.json`));return vf(r)}async function $f(){const{products:r,widget_settings:e,store_settings:t,meta:n}=await pn("productsAndSettings",()=>At("get",`/product/${ra}/products.json`));return n?.status==="error"?Promise.reject(n.message):{products:$P(r),widget_settings:vf(e),store_settings:t??{}}}async function SP(){const{products:r}=await $f();return r}async function AP(r){const[e,t,n]=await Promise.all([ta(r),wf(),bf()]);return{product:e,store_settings:t,widget_settings:n,storeSettings:t,widgetSettings:n}}async function OP(r){const{bundle_product:e}=await ta(r);return e}async function Ef(){return Array.from(zr.keys()).forEach(r=>zr.delete(r))}var IP=Object.freeze({__proto__:null,getCDNBundleSettings:OP,getCDNProduct:ta,getCDNProductAndSettings:AP,getCDNProducts:SP,getCDNProductsAndSettings:$f,getCDNStoreSettings:wf,getCDNWidgetSettings:bf,resetCDNCache:Ef});async function PP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("get","/charges",{id:e,query:{include:t?.include}},v(r,"getCharge"));return n}function xP(r,e){return w("get","/charges",{query:e},v(r,"listCharges"))}async function TP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/charges/${e}/apply_discount`,{data:{discount_code:t}},v(r,"applyDiscountToCharge"));return n}async function FP(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{charge:t}=await w("post",`/charges/${e}/remove_discount`,{},v(r,"removeDiscountsFromCharge"));return t}async function RP(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");if(t===void 0||t.length===0)throw new Error("Purchase item IDs are required");const{charge:i}=await w("post",`/charges/${e}/skip`,{query:n,data:{purchase_item_ids:t.map(a=>Number(a))}},v(r,"skipCharge"));return i}async function MP(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");if(t===void 0||t.length===0)throw new Error("Purchase item IDs are required");const{charge:i}=await w("post",`/charges/${e}/unskip`,{query:n,data:{purchase_item_ids:t.map(a=>Number(a))}},v(r,"unskipCharge"));return i}async function DP(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{charge:t}=await w("post",`/charges/${e}/process`,{},v(r,"processCharge"));return t}async function CP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/charges/${e}/change_next_charge_date`,{data:{next_charge_date:t}},v(r,"rescheduleCharge"));return n}var NP=Object.freeze({__proto__:null,applyDiscountToCharge:TP,getCharge:PP,listCharges:xP,processCharge:DP,removeDiscountsFromCharge:FP,rescheduleCharge:CP,skipCharge:RP,unskipCharge:MP});async function Sf(r,e){if(!["2020-12","2022-06"].includes(e.format_version))throw new Error("Missing or unsupported format_version.");return w("get","/product_search",{query:e,headers:{"X-Recharge-Version":"2021-01"}},v(r,"productSearch"))}var BP=Object.freeze({__proto__:null,productSearch:Sf});async function Af(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{collection:t}=await w("get","/collections",{id:e},v(r,"getCollection"));return t}function qP(r,e){return w("get","/collections",{query:e},v(r,"listCollections"))}async function UP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");if(!["2020-12","2022-06"].includes(t.format_version))throw new Error("Missing or unsupported format_version.");const n=v(r,"listCollectionProducts"),[{sort_order:i,manual_sort_order:a},{products:o}]=await Promise.all([Af(n,e),Sf(n,{...t,collection_ids:[e],limit:250})]);if(i==="manual")return{products:a.reduce((u,f)=>{const d=o.find(c=>c.external_product_id===f);return d&&u.push(d),u},[])};{const u=LP(i);return{products:o.slice().sort(u)}}}function Of(r,e){const t=r.external_created_at,n=e.external_created_at;return t<n?-1:n>t?1:0}function If(r,e){const t=r.external_product_id,n=e.external_product_id;return t<n?-1:n>t?1:0}function Pf(r,e){const t=r.title.toLowerCase(),n=e.title.toLowerCase();return t<n?-1:n>t?1:0}function LP(r){switch(r){case"created_at-asc":return Of;case"created_at-desc":return(e,t)=>Of(t,e);case"id-asc":return If;case"id-desc":return(e,t)=>If(t,e);case"title-asc":return Pf;case"title-desc":return(e,t)=>Pf(t,e)}}var kP=Object.freeze({__proto__:null,getCollection:Af,listCollectionProducts:UP,listCollections:qP});async function jP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await w("get","/customers",{id:t,query:{include:e?.include}},v(r,"getCustomer"));return n}async function xf(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await w("put","/customers",{id:t,data:e},v(r,"updateCustomer"));return n}async function VP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{deliveries:n}=await w("get",`/customers/${t}/delivery_schedule`,{query:e},v(r,"getDeliverySchedule"));return n}async function hn(r,e){return w("get","/portal_access",{query:e},v(r,"getCustomerPortalAccess"))}async function GP(r,e,t){if(e===void 0||e==="")throw new Error("Subscription ID is required");const{base_url:n,customer_hash:i,temp_token:a}=await hn(v(r,"getActiveChurnLandingPageURL"));return`${n.replace("portal","pages")}${i}/subscriptions/${e}/cancel?token=${a}&subscription=${e}&redirect_to=${t}`}async function HP(r){const{base_url:e,customer_hash:t,temp_token:n}=await hn(v(r,"getFailedPaymentMethodRecoveryLandingPageURL"));return`${e.replace("portal","pages")}account/payment-methods?token=${n}&hash=${t}`}async function WP(r,e,t){if(e===void 0||e==="")throw new Error("Gift ID is required");const{base_url:n,customer_hash:i,temp_token:a}=await hn(v(r,"getGiftRedemptionLandingPageURL"));return`${n.replace("portal","pages")}${i}/gifts/${e}?token=${a}&redirect_to=${t}`}const zP={SHOPIFY_UPDATE_PAYMENT_INFO:{type:"email",template_type:"shopify_update_payment_information"},SHOPIFY_MIGRATE_PAYMENT_INFO:{type:"email",template_type:"shopify_migrate_payment_information"}};async function XP(r,e,t){const n=r.customerId;if(!n)throw new Error("Not logged in.");const i=zP[e];if(!i)throw new Error("Notification not supported.");return w("post",`/customers/${n}/notifications`,{data:{...i,template_vars:t}},v(r,"sendCustomerNotification"))}async function YP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{credit_summary:n}=await w("get",`/customers/${t}/credit_summary`,{query:{include:e?.include}},v(r,"getCreditSummary"));return n}var KP=Object.freeze({__proto__:null,getActiveChurnLandingPageURL:GP,getCreditSummary:YP,getCustomer:jP,getCustomerPortalAccess:hn,getDeliverySchedule:VP,getFailedPaymentMethodRecoveryLandingPageURL:HP,getGiftRedemptionLandingPageURL:WP,sendCustomerNotification:XP,updateCustomer:xf});async function ZP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{credit_summary:n}=await w("get",`/customers/${t}/credit_summary`,{query:{include:e?.include,presentment_currency_code:e?.presentment_currency_code}},v(r,"getCreditSummary"));return n}function JP(r,{recurring:e}){if(!r.customerId)throw new Error("Not logged in.");const t={};return e!==void 0&&(t.apply_credit_to_next_recurring_charge=e),xf(v(r,"setApplyCreditsToNextCharge"),t)}async function QP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");return await w("get","/credit_accounts",{query:{customer_id:t,...e}},v(r,"listCreditAccounts"))}var ex=Object.freeze({__proto__:null,getCreditSummary:ZP,listCreditAccounts:QP,setApplyCreditsToNextCharge:JP});async function rx(r,e,t){return await w("post","/customer_surveys/cancellation_prevention",{data:{customer_id:e,subscription_id:t}},v(r,"getCustomerSurveyReasons"))}async function tx(r,e,t,n){return await w("post",`/customer_surveys/${t}/customer_response`,{data:{customer_id:e,response_id:n}},v(r,"getCustomerSurveyOffers"))}async function nx(r,e){return await w("post","/offers/claim",{data:e},v(r,"claimOfferCustomerSurvey")),{}}var ix=Object.freeze({__proto__:null,claimOfferCustomerSurvey:nx,getCustomerSurveyOffers:tx,getCustomerSurveyReasons:rx});function ax(r,e){if(!r.customerId)throw new Error("Not logged in.");return w("get","/gift_purchases",{query:e},v(r,"listGiftPurchases"))}async function ox(r,e){if(!r.customerId)throw new Error("Not logged in.");if(e===void 0||e==="")throw new Error("ID is required");const{gift_purchase:t}=await w("get","/gift_purchases",{id:e},v(r,"getGiftPurchase"));return t}var sx=Object.freeze({__proto__:null,getGiftPurchase:ox,listGiftPurchases:ax});function ux(r,e){if(!r.customerId)throw new Error("Not logged in.");return w("get","/incentives/tiered_discounts",{query:e},v(r,"listTieredDiscounts"))}async function fx(r,e){if(!r.customerId)throw new Error("Not logged in.");if(e===void 0||e==="")throw new Error("ID is required");const{tiered_discount:t}=await w("get",`/incentives/tiered_discounts/${e}`,{},v(r,"getTieredDiscount"));return t}var cx=Object.freeze({__proto__:null,getTieredDiscount:fx,listTieredDiscounts:ux});async function lx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{membership:t}=await w("get","/memberships",{id:e},v(r,"getMembership"));return t}function dx(r,e){return w("get","/memberships",{query:e},v(r,"listMemberships"))}async function px(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${e}/cancel`,{data:t},v(r,"cancelMembership"));return n}async function hx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${e}/activate`,{data:t},v(r,"activateMembership"));return n}async function yx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${e}/change`,{data:t},v(r,"changeMembership"));return n}var gx=Object.freeze({__proto__:null,activateMembership:hx,cancelMembership:px,changeMembership:yx,getMembership:lx,listMemberships:dx});async function _x(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership_program:n}=await w("get","/membership_programs",{id:e,query:{include:t?.include}},v(r,"getMembershipProgram"));return n}function vx(r,e){return w("get","/membership_programs",{query:e},v(r,"listMembershipPrograms"))}var mx=Object.freeze({__proto__:null,getMembershipProgram:_x,listMembershipPrograms:vx});async function wx(r,e){const{metafield:t}=await w("post","/metafields",{data:{metafield:e}},v(r,"createMetafield"));return t}async function bx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{metafield:n}=await w("put","/metafields",{id:e,data:{metafield:t}},v(r,"updateMetafield"));return n}function $x(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/metafields",{id:e},v(r,"deleteMetafield"))}var Ex=Object.freeze({__proto__:null,createMetafield:wx,deleteMetafield:$x,updateMetafield:bx});async function Sx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{onetime:t}=await w("get","/onetimes",{id:e},v(r,"getOnetime"));return t}function Ax(r,e){return w("get","/onetimes",{query:e},v(r,"listOnetimes"))}async function Ox(r,e){const{onetime:t}=await w("post","/onetimes",{data:e},v(r,"createOnetime"));return t}async function Ix(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{onetime:n}=await w("put","/onetimes",{id:e,data:t},v(r,"updateOnetime"));return n}function Px(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/onetimes",{id:e},v(r,"deleteOnetime"))}var xx=Object.freeze({__proto__:null,createOnetime:Ox,deleteOnetime:Px,getOnetime:Sx,listOnetimes:Ax,updateOnetime:Ix});async function Tx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{order:t}=await w("get","/orders",{id:e},v(r,"getOrder"));return t}function Fx(r,e){return w("get","/orders",{query:e},v(r,"listOrders"))}async function Rx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{order:t}=await w("post",`/orders/${e}/delay`,{},v(r,"delayOrder"));return t}var Mx=Object.freeze({__proto__:null,delayOrder:Rx,getOrder:Tx,listOrders:Fx});async function Dx(r,e){return typeof window<"u"&&window.Spreedly?Promise.resolve():new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Document is not available. This function must be called in a browser environment."));return}if(document.querySelector(`script[src="${r}"]`)){const a=()=>{window.Spreedly?t():setTimeout(a,50)};a();return}const i=document.createElement("script");i.src=r,i.integrity=e,i.crossOrigin="anonymous",i.addEventListener("load",()=>{const a=()=>{window.Spreedly?t():setTimeout(a,50)};a()}),i.addEventListener("error",()=>{n(new Error("Failed to load payment iFrame script"))}),document.head.appendChild(i)})}async function Cx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{payment_method:n}=await w("get","/payment_methods",{id:e,query:{include:t?.include}},v(r,"getPaymentMethod"));return n}async function Tf(r,e){const{payment_method:t}=await w("post","/payment_methods",{data:{...e,customer_id:r.customerId}},v(r,"createPaymentMethod"));return t}async function Nx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{payment_method:n}=await w("put","/payment_methods",{id:e,data:t},v(r,"updatePaymentMethod"));return n}function Bx(r,e){return w("get","/payment_methods",{query:e},v(r,"listPaymentMethods"))}async function qx(r,e){const t=await Ux(r,e),n=t.external.environment_key,i=t.payment_method_intent_id,a=t.external_customer_id.ecommerce,o=t.external.resource_url,u=t.external.integrity_hash,f=t.payment_method?.processor_payment_method_token;await Dx(o,u);let d=!1,c=null,s=null,l=null;return{mount(p,g){if(typeof window>"u"||!window.Spreedly)throw new Error("Payment script failed to load");window.Spreedly.init(n,{numberEl:p.numberElementId,cvvEl:p.cvvElementId}),window.Spreedly.on("ready",()=>{d=!0,p.styles&&(window.Spreedly.setStyle("number",p.styles),window.Spreedly.setStyle("cvv",p.styles)),p.numberLabel&&window.Spreedly.setLabel("number",p.numberLabel),p.cvvLabel&&window.Spreedly.setLabel("cvv",p.cvvLabel),p.numberPlaceholder&&window.Spreedly.setPlaceholder("number",p.numberPlaceholder),p.cvvPlaceholder&&window.Spreedly.setPlaceholder("cvv",p.cvvPlaceholder),p.numberFormat==="plainFormat"?(p.numberFieldType&&window.Spreedly.setFieldType("number",p.numberFieldType),p.cvvFieldType&&window.Spreedly.setFieldType("cvv",p.cvvFieldType),window.Spreedly.setNumberFormat("plainFormat")):p.numberFormat==="maskedFormat"?(window.Spreedly.setFieldType("cvv","text"),window.Spreedly.setFieldType("number","text"),window.Spreedly.setNumberFormat("maskedFormat")):p.numberFormat==="prettyFormat"?(p.numberFieldType==="text"||p.numberFieldType==="tel"?window.Spreedly.setFieldType("number",p.numberFieldType):window.Spreedly.setFieldType("number","tel"),p.cvvFieldType==="text"||p.cvvFieldType==="tel"?window.Spreedly.setFieldType("cvv",p.cvvFieldType):window.Spreedly.setFieldType("cvv","tel"),window.Spreedly.setNumberFormat("prettyFormat")):(p.numberFieldType&&window.Spreedly.setFieldType("number",p.numberFieldType),p.cvvFieldType&&window.Spreedly.setFieldType("cvv",p.cvvFieldType)),g?.onReady?.()}),window.Spreedly.on("fieldEvent",($,S,A,E)=>{g?.onFieldEvent?.($,S,A,E)}),window.Spreedly.on("errors",$=>{g?.onErrors?.($)}),window.Spreedly.on("paymentMethod",($,S)=>{c=$,g?.onPaymentMethod?.($,S),s&&(c=null,s($),s=null)})},tokenize(p){if(!d||!window.Spreedly)throw new Error("Payment form is not initialized");let g=String(p.year);g.length===2&&(g=`20${g}`);const $=String(p.month).padStart(2,"0");"full_name"in p?window.Spreedly.tokenizeCreditCard({full_name:p.full_name,month:$,year:g}):window.Spreedly.tokenizeCreditCard({first_name:p.first_name,last_name:p.last_name,month:$,year:g})},async submit(p){if(!d)throw new Error("Payment form is not initialized");if(c){const g=c;return c=null,Ff(r,g,p,{external_payment_method_id:f,payment_method_intent_id:i,external_customer_id:a})}return new Promise((g,$)=>{l=p,s=async S=>{try{const A=await Ff(r,S,l,{external_payment_method_id:f,payment_method_intent_id:i,external_customer_id:a});g(A)}catch(A){$(A)}finally{l=null}},this.tokenize(p.card_details)})},reset(){window.Spreedly&&window.Spreedly.reload(),c=null,s=null,l=null},unmount(){window.Spreedly&&window.Spreedly.removeHandlers(),d=!1,c=null,s=null,l=null},addEventHandlers(p){p.onReady&&window.Spreedly.on("ready",p.onReady),p.onFieldEvent&&window.Spreedly.on("fieldEvent",p.onFieldEvent),p.onErrors&&window.Spreedly.on("errors",p.onErrors),p.onPaymentMethod&&window.Spreedly.on("paymentMethod",p.onPaymentMethod)},removeHandlers(){window.Spreedly&&window.Spreedly.removeHandlers()},setFieldType(p,g){window.Spreedly.setFieldType(p,g)},setLabel(p,g){window.Spreedly.setLabel(p,g)},setNumberFormat(p){window.Spreedly.setNumberFormat(p)},setPlaceholder(p,g){window.Spreedly.setPlaceholder(p,g)},setStyle(p,g){window.Spreedly.setStyle(p,g)}}}async function Ux(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");return await w("post","/payment_method_intents",{data:{customer_id:t,payment_method_id:e}},v(r,"createFrictionlessPaymentIntentV1"))}async function Ff(r,e,{billing_address:t,default_payment_method:n,address_ids:i,apply_to_all_subscription_addresses:a},{external_payment_method_id:o,payment_method_intent_id:u,external_customer_id:f}){return await Tf(v(r,"submitFrictionlessPaymentMethodV1"),{default:n??!1,payment_type:"CREDIT_CARD",processor_customer_token:f.toString(),processor_name:"frictionless",processor_payment_method_token:e,billing_address:t,payment_method_intent_id:u,address_ids:i,external_payment_method_id:o,apply_to_all_subscription_addresses:a})}var Lx=Object.freeze({__proto__:null,createPaymentMethod:Tf,getPaymentMethod:Cx,initFrictionlessPaymentV1:qx,listPaymentMethods:Bx,updatePaymentMethod:Nx});async function kx(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{plan:t}=await w("get","/plans",{id:e},v(r,"getPlan"));return t}function jx(r,e){return w("get","/plans",{query:e},v(r,"listPlans"))}var Vx=Object.freeze({__proto__:null,getPlan:kx,listPlans:jx});async function Gx(r,e){return await w("get","/shop/shipping_countries",{query:e,headers:{"X-Recharge-Version":"2021-01"}},v(r,"getShippingCountries"))}async function Hx(r){return await w("get","/shop/settings",{headers:{"X-Recharge-Version":"2021-01"}},v(r,"getStoreSettings"))}var Wx=Object.freeze({__proto__:null,getShippingCountries:Gx,getStoreSettings:Hx}),zx="Expected a function",Rf="__lodash_placeholder__",qe=1,yn=2,Xx=4,cr=8,Xr=16,Ue=32,Yr=64,Mf=128,Yx=256,Df=512,Cf=1/0,Kx=9007199254740991,Zx=17976931348623157e292,Nf=0/0,Jx=[["ary",Mf],["bind",qe],["bindKey",yn],["curry",cr],["curryRight",Xr],["flip",Df],["partial",Ue],["partialRight",Yr],["rearg",Yx]],Qx="[object Function]",e2="[object GeneratorFunction]",r2="[object Symbol]",t2=/[\\^$.*+?()[\]{}|]/g,n2=/^\s+|\s+$/g,i2=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,a2=/\{\n\/\* \[wrapped with (.+)\] \*/,o2=/,? & /,s2=/^[-+]0x[0-9a-f]+$/i,u2=/^0b[01]+$/i,f2=/^\[object .+?Constructor\]$/,c2=/^0o[0-7]+$/i,l2=/^(?:0|[1-9]\d*)$/,d2=parseInt,p2=typeof D=="object"&&D&&D.Object===Object&&D,h2=typeof self=="object"&&self&&self.Object===Object&&self,Kr=p2||h2||Function("return this")();function na(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}function y2(r,e){for(var t=-1,n=r?r.length:0;++t<n&&e(r[t],t,r)!==!1;);return r}function g2(r,e){var t=r?r.length:0;return!!t&&v2(r,e,0)>-1}function _2(r,e,t,n){for(var i=r.length,a=t+(n?1:-1);n?a--:++a<i;)if(e(r[a],a,r))return a;return-1}function v2(r,e,t){if(e!==e)return _2(r,m2,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function m2(r){return r!==r}function w2(r,e){for(var t=r.length,n=0;t--;)r[t]===e&&n++;return n}function b2(r,e){return r?.[e]}function $2(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function ia(r,e){for(var t=-1,n=r.length,i=0,a=[];++t<n;){var o=r[t];(o===e||o===Rf)&&(r[t]=Rf,a[i++]=t)}return a}var E2=Function.prototype,Bf=Object.prototype,aa=Kr["__core-js_shared__"],qf=function(){var r=/[^.]+$/.exec(aa&&aa.keys&&aa.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Uf=E2.toString,S2=Bf.hasOwnProperty,Lf=Bf.toString,A2=RegExp("^"+Uf.call(S2).replace(t2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),O2=Object.create,lr=Math.max,I2=Math.min,kf=function(){var r=Vf(Object,"defineProperty"),e=Vf.name;return e&&e.length>2?r:void 0}();function P2(r){return dr(r)?O2(r):{}}function x2(r){if(!dr(r)||k2(r))return!1;var e=H2(r)||$2(r)?A2:f2;return e.test(V2(r))}function T2(r,e){return e=lr(e===void 0?r.length-1:e,0),function(){for(var t=arguments,n=-1,i=lr(t.length-e,0),a=Array(i);++n<i;)a[n]=t[e+n];n=-1;for(var o=Array(e+1);++n<e;)o[n]=t[n];return o[e]=a,na(r,this,o)}}function F2(r,e,t,n){for(var i=-1,a=r.length,o=t.length,u=-1,f=e.length,d=lr(a-o,0),c=Array(f+d),s=!n;++u<f;)c[u]=e[u];for(;++i<o;)(s||i<a)&&(c[t[i]]=r[i]);for(;d--;)c[u++]=r[i++];return c}function R2(r,e,t,n){for(var i=-1,a=r.length,o=-1,u=t.length,f=-1,d=e.length,c=lr(a-u,0),s=Array(c+d),l=!n;++i<c;)s[i]=r[i];for(var p=i;++f<d;)s[p+f]=e[f];for(;++o<u;)(l||i<a)&&(s[p+t[o]]=r[i++]);return s}function M2(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}function D2(r,e,t){var n=e&qe,i=Zr(r);function a(){var o=this&&this!==Kr&&this instanceof a?i:r;return o.apply(n?t:this,arguments)}return a}function Zr(r){return function(){var e=arguments;switch(e.length){case 0:return new r;case 1:return new r(e[0]);case 2:return new r(e[0],e[1]);case 3:return new r(e[0],e[1],e[2]);case 4:return new r(e[0],e[1],e[2],e[3]);case 5:return new r(e[0],e[1],e[2],e[3],e[4]);case 6:return new r(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new r(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var t=P2(r.prototype),n=r.apply(t,e);return dr(n)?n:t}}function C2(r,e,t){var n=Zr(r);function i(){for(var a=arguments.length,o=Array(a),u=a,f=sa(i);u--;)o[u]=arguments[u];var d=a<3&&o[0]!==f&&o[a-1]!==f?[]:ia(o,f);if(a-=d.length,a<t)return jf(r,e,oa,i.placeholder,void 0,o,d,void 0,void 0,t-a);var c=this&&this!==Kr&&this instanceof i?n:r;return na(c,this,o)}return i}function oa(r,e,t,n,i,a,o,u,f,d){var c=e&Mf,s=e&qe,l=e&yn,p=e&(cr|Xr),g=e&Df,$=l?void 0:Zr(r);function S(){for(var A=arguments.length,E=Array(A),h=A;h--;)E[h]=arguments[h];if(p)var I=sa(S),T=w2(E,I);if(n&&(E=F2(E,n,i,p)),a&&(E=R2(E,a,o,p)),A-=T,p&&A<d){var F=ia(E,I);return jf(r,e,oa,S.placeholder,t,E,F,u,f,d-A)}var b=s?t:this,_=l?b[r]:r;return A=E.length,u?E=j2(E,u):g&&A>1&&E.reverse(),c&&f<A&&(E.length=f),this&&this!==Kr&&this instanceof S&&(_=$||Zr(_)),_.apply(b,E)}return S}function N2(r,e,t,n){var i=e&qe,a=Zr(r);function o(){for(var u=-1,f=arguments.length,d=-1,c=n.length,s=Array(c+f),l=this&&this!==Kr&&this instanceof o?a:r;++d<c;)s[d]=n[d];for(;f--;)s[d++]=arguments[++u];return na(l,i?t:this,s)}return o}function jf(r,e,t,n,i,a,o,u,f,d){var c=e&cr,s=c?o:void 0,l=c?void 0:o,p=c?a:void 0,g=c?void 0:a;e|=c?Ue:Yr,e&=~(c?Yr:Ue),e&Xx||(e&=~(qe|yn));var $=t(r,e,i,p,s,g,l,u,f,d);return $.placeholder=n,Gf($,r,e)}function B2(r,e,t,n,i,a,o,u){var f=e&yn;if(!f&&typeof r!="function")throw new TypeError(zx);var d=n?n.length:0;if(d||(e&=~(Ue|Yr),n=i=void 0),o=o===void 0?o:lr(Hf(o),0),u=u===void 0?u:Hf(u),d-=i?i.length:0,e&Yr){var c=n,s=i;n=i=void 0}var l=[r,e,t,n,i,c,s,a,o,u];if(r=l[0],e=l[1],t=l[2],n=l[3],i=l[4],u=l[9]=l[9]==null?f?0:r.length:lr(l[9]-d,0),!u&&e&(cr|Xr)&&(e&=~(cr|Xr)),!e||e==qe)var p=D2(r,e,t);else e==cr||e==Xr?p=C2(r,e,u):(e==Ue||e==(qe|Ue))&&!i.length?p=N2(r,e,t,n):p=oa.apply(void 0,l);return Gf(p,r,e)}function sa(r){var e=r;return e.placeholder}function Vf(r,e){var t=b2(r,e);return x2(t)?t:void 0}function q2(r){var e=r.match(a2);return e?e[1].split(o2):[]}function U2(r,e){var t=e.length,n=t-1;return e[n]=(t>1?"& ":"")+e[n],e=e.join(t>2?", ":" "),r.replace(i2,`{
|
|
25
25
|
/* [wrapped with `+e+`] */
|
|
26
26
|
`)}function L2(r,e){return e=e??Kx,!!e&&(typeof r=="number"||l2.test(r))&&r>-1&&r%1==0&&r<e}function k2(r){return!!qf&&qf in r}function j2(r,e){for(var t=r.length,n=I2(e.length,t),i=M2(r);n--;){var a=e[n];r[n]=L2(a,t)?i[a]:void 0}return r}var Gf=kf?function(r,e,t){var n=e+"";return kf(r,"toString",{configurable:!0,enumerable:!1,value:K2(U2(n,G2(q2(n),t)))})}:Z2;function V2(r){if(r!=null){try{return Uf.call(r)}catch{}try{return r+""}catch{}}return""}function G2(r,e){return y2(Jx,function(t){var n="_."+t[0];e&t[1]&&!g2(r,n)&&r.push(n)}),r.sort()}var ua=T2(function(r,e){var t=ia(e,sa(ua));return B2(r,Ue,void 0,e,t)});function H2(r){var e=dr(r)?Lf.call(r):"";return e==Qx||e==e2}function dr(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function W2(r){return!!r&&typeof r=="object"}function z2(r){return typeof r=="symbol"||W2(r)&&Lf.call(r)==r2}function X2(r){if(!r)return r===0?r:0;if(r=Y2(r),r===Cf||r===-Cf){var e=r<0?-1:1;return e*Zx}return r===r?r:0}function Hf(r){var e=X2(r),t=e%1;return e===e?t?e-t:e:0}function Y2(r){if(typeof r=="number")return r;if(z2(r))return Nf;if(dr(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=dr(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(n2,"");var t=u2.test(r);return t||c2.test(r)?d2(r.slice(2),t?2:8):s2.test(r)?Nf:+r}function K2(r){return function(){return r}}function Z2(r){return r}ua.placeholder={};var J2=ua,Wf=we(J2);function Q2(r,e){return{...ea(e,["address_id","external_variant_id","external_product_id","charge_interval_frequency","order_interval_frequency","price","status"]),customer_id:parseInt(r,10),shopify_variant_id:e.external_variant_id.ecommerce?parseInt(e.external_variant_id.ecommerce,10):void 0,...e.charge_interval_frequency?{charge_interval_frequency:`${e.charge_interval_frequency}`}:{},...e.order_interval_frequency?{order_interval_frequency:`${e.order_interval_frequency}`}:{},status:e.status?e.status.toUpperCase():void 0}}function eT(r,e){return{...ea(e,["external_variant_id","external_product_id","charge_interval_frequency","order_interval_frequency","price","use_external_variant_defaults"]),shopify_variant_id:e.external_variant_id?.ecommerce?parseInt(e.external_variant_id.ecommerce,10):void 0,...e.charge_interval_frequency?{charge_interval_frequency:`${e.charge_interval_frequency}`}:void 0,...e.order_interval_frequency?{order_interval_frequency:`${e.order_interval_frequency}`}:void 0,force_update:r}}function zf(r){const{id:e,address_id:t,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:u,charge_interval_frequency:f,created_at:d,expire_after_specific_number_of_charges:c,shopify_product_id:s,shopify_variant_id:l,has_queued_charges:p,is_prepaid:g,is_skippable:$,is_swappable:S,max_retries_reached:A,next_charge_scheduled_at:E,order_day_of_month:h,order_day_of_week:I,order_interval_frequency:T,order_interval_unit:F,presentment_currency:b,price:_,product_title:m,properties:O,quantity:P,sku:B,sku_override:W,status:oe,updated_at:Y,variant_title:Le}=r;return{id:e,address_id:t,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:u,charge_interval_frequency:parseInt(f,10),created_at:d,expire_after_specific_number_of_charges:c,external_product_id:{ecommerce:`${s}`},external_variant_id:{ecommerce:`${l}`},has_queued_charges:_f(p),is_prepaid:g,is_skippable:$,is_swappable:S,max_retries_reached:_f(A),next_charge_scheduled_at:E,order_day_of_month:h,order_day_of_week:I,order_interval_frequency:parseInt(T,10),order_interval_unit:F,presentment_currency:b,price:`${_}`,product_title:m??"",properties:O,quantity:P,sku:B,sku_override:W,status:oe.toLowerCase(),updated_at:Y,variant_title:Le}}async function rT(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:n}=await w("get","/subscriptions",{id:e,query:{include:t?.include}},v(r,"getSubscription"));return n}function tT(r,e){return w("get","/subscriptions",{query:e},v(r,"listSubscriptions"))}async function nT(r,e,t){const{subscription:n}=await w("post","/subscriptions",{data:e,query:t},v(r,"createSubscription"));return n}async function iT(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:i}=await w("put","/subscriptions",{id:e,data:t,query:n},v(r,"updateSubscription"));return i}async function aT(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:i}=await w("post",`/subscriptions/${e}/set_next_charge_date`,{data:{date:t},query:n},v(r,"updateSubscriptionChargeDate"));return i}async function oT(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:n}=await w("post",`/subscriptions/${e}/change_address`,{data:{address_id:t}},v(r,"updateSubscriptionAddress"));return n}async function sT(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:i}=await w("post",`/subscriptions/${e}/cancel`,{data:t,query:n},v(r,"cancelSubscription"));return i}async function uT(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:n}=await w("post",`/subscriptions/${e}/activate`,{query:t},v(r,"activateSubscription"));return n}async function fT(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/subscriptions/${e}/charges/skip`,{data:{date:t,subscription_id:`${e}`}},v(r,"skipSubscriptionCharge"));return n}async function cT(r,e,t){if(e===void 0||e.length===0)throw new Error("Subscription IDs are required");const{onetimes:n}=await w("post","/purchase_items/skip_gift",{data:{purchase_item_ids:e.map(Number),recipient_address:t}},v(r,"skipGiftSubscriptionCharge"));return n}async function lT(r,e,t){const n=e.length;if(n<1||n>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:i}=r;if(!i)throw new Error("No customerId in session.");const a=e[0].address_id;if(!e.every(c=>c.address_id===a))throw new Error("All subscriptions must have the same address_id.");const o=Wf(Q2,i),u=e.map(o);let f;t?.allow_onetimes!==void 0&&(f={allow_onetimes:t.allow_onetimes});const{subscriptions:d}=await w("post",`/addresses/${a}/subscriptions-bulk`,{data:{subscriptions:u,commit_update:!!t?.commit},headers:{"X-Recharge-Version":"2021-01"},query:f},v(r,"createSubscriptions"));return d.map(zf)}async function dT(r,e,t,n){if(e===void 0||e==="")throw new Error("Address ID is required");const i=t.length;if(i<1||i>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:a}=r;if(!a)throw new Error("No customerId in session.");const o=Wf(eT,!!n?.force_update),u=t.map(o);let f;n?.allow_onetimes!==void 0&&(f={allow_onetimes:n.allow_onetimes});const{subscriptions:d}=await w("put",`/addresses/${e}/subscriptions-bulk`,{data:{subscriptions:u,commit_update:!!n?.commit},headers:{"X-Recharge-Version":"2021-01"},query:f},v(r,"updateSubscriptions"));return d.map(zf)}async function pT(r,e,t,n){if(e===void 0||e==="")throw new Error("Address ID is required");const i=t.length;if(i<1||i>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:a}=r;if(!a)throw new Error("No customerId in session.");let o;n?.allow_onetimes!==void 0&&(o={allow_onetimes:n.allow_onetimes}),await w("delete",`/addresses/${e}/subscriptions-bulk`,{data:{subscriptions:t,send_email:!!n?.send_email,commit_update:!!n?.commit},headers:{"X-Recharge-Version":"2021-01"},query:o},v(r,"deleteSubscriptions"))}var hT=Object.freeze({__proto__:null,activateSubscription:uT,cancelSubscription:sT,createSubscription:nT,createSubscriptions:lT,deleteSubscriptions:pT,getSubscription:rT,listSubscriptions:tT,skipGiftSubscriptionCharge:cT,skipSubscriptionCharge:fT,updateSubscription:iT,updateSubscriptionAddress:oT,updateSubscriptionChargeDate:aT,updateSubscriptions:dT});const yT={get(r,e){return X("get",r,e)},post(r,e){return X("post",r,e)},put(r,e){return X("put",r,e)},delete(r,e){return X("delete",r,e)}};function gT(r){if(r)return r;if(window?.Shopify?.shop)return window.Shopify.shop;let e=window?.domain;if(!e){const t=location?.href.match(/(?:http[s]*:\/\/)*(.*?)\.(?=admin\.rechargeapps\.com)/i)?.[1].replace(/-sp$/,"");t&&(e=`${t}.myshopify.com`)}if(e)return e;throw new Error("No storeIdentifier was passed into init.")}function _T(r={}){const e=r,{storefrontAccessToken:t}=r;if(t&&!t.startsWith("strfnt"))throw new Error("Incorrect storefront access token used. See https://storefront.rechargepayments.com/client/docs/getting_started/package_setup/#initialization-- for more information.");oh({storeIdentifier:gT(r.storeIdentifier),loginRetryFn:r.loginRetryFn,__unstable_twoFactorRetryFn:r.__unstable_twoFactorRetryFn,storefrontAccessToken:t,appName:r.appName,appVersion:r.appVersion,environment:e.environment?e.environment:"prod",environmentUri:e.environmentUri,customerHash:e.customerHash}),Ef()}const Xf={init:_T,api:yT,address:mh,auth:xh,bundle:WO,bundleData:rI,charge:NP,cdn:IP,collection:kP,credit:ex,customer:KP,customerSurveys:ix,gift:sx,tieredDiscount:cx,membership:gx,membershipProgram:mx,metafield:Ex,onetime:xx,order:Mx,paymentMethod:Lx,plan:Vx,product:BP,store:Wx,subscription:hT};try{Xf.init()}catch{}return Xf});
|