@rechargeapps/storefront-client 1.78.1 → 1.78.2

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.
@@ -181,7 +181,7 @@ async function rechargeAdminRequest(method, url, { id, query, data, headers } =
181
181
  ...storefrontAccessToken ? { "X-Recharge-Storefront-Access-Token": storefrontAccessToken } : {},
182
182
  ...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
183
183
  ...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
184
- "X-Recharge-Sdk-Version": "1.78.1",
184
+ "X-Recharge-Sdk-Version": "1.78.2",
185
185
  ...headers ? headers : {}
186
186
  };
187
187
  return request.request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
@@ -15,7 +15,7 @@ async function loadFromOnlineStore(id, country_code) {
15
15
  const { appName, appVersion } = options.getOptions();
16
16
  const headers = {
17
17
  "X-Recharge-Sdk-Fn": "loadFromOnlineStore",
18
- "X-Recharge-Sdk-Version": "1.78.1",
18
+ "X-Recharge-Sdk-Version": "1.78.2",
19
19
  ...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
20
20
  ...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {}
21
21
  };
@@ -49,7 +49,7 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
49
49
  "X-Recharge-Sdk-Fn": session.internalFnCall,
50
50
  ...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
51
51
  ...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
52
- "X-Recharge-Sdk-Version": "1.78.1",
52
+ "X-Recharge-Sdk-Version": "1.78.2",
53
53
  "X-Request-Id": session.internalRequestId,
54
54
  ...session.tmp_fn_identifier ? { "X-Recharge-Sdk-Fn-Identifier": session.tmp_fn_identifier } : {},
55
55
  ...headers ? headers : {}
@@ -179,7 +179,7 @@ async function rechargeAdminRequest(method, url, { id, query, data, headers } =
179
179
  ...storefrontAccessToken ? { "X-Recharge-Storefront-Access-Token": storefrontAccessToken } : {},
180
180
  ...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
181
181
  ...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
182
- "X-Recharge-Sdk-Version": "1.78.1",
182
+ "X-Recharge-Sdk-Version": "1.78.2",
183
183
  ...headers ? headers : {}
184
184
  };
185
185
  return request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
@@ -13,7 +13,7 @@ async function loadFromOnlineStore(id, country_code) {
13
13
  const { appName, appVersion } = getOptions();
14
14
  const headers = {
15
15
  "X-Recharge-Sdk-Fn": "loadFromOnlineStore",
16
- "X-Recharge-Sdk-Version": "1.78.1",
16
+ "X-Recharge-Sdk-Version": "1.78.2",
17
17
  ...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
18
18
  ...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {}
19
19
  };
@@ -47,7 +47,7 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
47
47
  "X-Recharge-Sdk-Fn": session.internalFnCall,
48
48
  ...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
49
49
  ...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
50
- "X-Recharge-Sdk-Version": "1.78.1",
50
+ "X-Recharge-Sdk-Version": "1.78.2",
51
51
  "X-Request-Id": session.internalRequestId,
52
52
  ...session.tmp_fn_identifier ? { "X-Recharge-Sdk-Fn-Identifier": session.tmp_fn_identifier } : {},
53
53
  ...headers ? headers : {}
package/dist/index.d.ts CHANGED
@@ -3631,8 +3631,6 @@ interface CustomerPortalSettings {
3631
3631
  discount_input: boolean;
3632
3632
  /** Allow the customer to modify the shipping address for an existing subscription. */
3633
3633
  edit_shipping_address: BooleanNumbers;
3634
- /** Whether fast-forwarding through a CP flow is enabled or not. */
3635
- enable_abbreviated_cp_flow: boolean;
3636
3634
  /** Whether Affinity uses Storefront API or not. */
3637
3635
  enable_affinity_use_storefront_api: boolean;
3638
3636
  /** Whether the store is using the customer portal extension or not. */
@@ -1,4 +1,4 @@
1
- // recharge-client-1.78.1.min.js | MIT License | © Recharge Inc.
1
+ // recharge-client-1.78.2.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 Jf(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 k=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof k<"u"&&k,G={searchParams:"URLSearchParams"in k,iterable:"Symbol"in k&&"iterator"in Symbol,blob:"FileReader"in k&&"Blob"in k&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in k,arrayBuffer:"ArrayBuffer"in k};function Qf(r){return r&&DataView.prototype.isPrototypeOf(r)}if(G.arrayBuffer)var ec=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],rc=ArrayBuffer.isView||function(r){return r&&ec.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 _n(r){return typeof r!="string"&&(r=String(r)),r}function gn(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=_n(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)]=_n(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)}),gn(r)},C.prototype.values=function(){var r=[];return this.forEach(function(e){r.push(e)}),gn(r)},C.prototype.entries=function(){var r=[];return this.forEach(function(e,t){r.push([t,e])}),gn(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 da(r){return new Promise(function(e,t){r.onload=function(){e(r.result)},r.onerror=function(){t(r.error)}})}function tc(r){var e=new FileReader,t=da(e);return e.readAsArrayBuffer(r),t}function nc(r){var e=new FileReader,t=da(e);return e.readAsText(r),t}function ic(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 pa(r){if(r.slice)return r.slice(0);var e=new Uint8Array(r.byteLength);return e.set(new Uint8Array(r)),e.buffer}function ha(){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&&Qf(r)?(this._bodyArrayBuffer=pa(r.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):G.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(r)||rc(r))?this._bodyArrayBuffer=pa(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(tc)}),this.text=function(){var r=vn(this);if(r)return r;if(this._bodyBlob)return nc(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(ic(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(uc)}),this.json=function(){return this.text().then(JSON.parse)},this}var ac=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function oc(r){var e=r.toUpperCase();return ac.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=oc(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 uc(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 sc(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}ha.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)}ha.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 fc=[301,302,303,307,308];K.redirect=function(r,e){if(fc.indexOf(e)===-1)throw new RangeError("Invalid status code");return new K(null,{status:e,headers:{location:r}})};var $e=k.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 ya(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:sc(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 s(f){try{return f===""&&k.location.href?k.location.href:f}catch{return f}}a.open(i.method,s(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,_n(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)})}ya.polyfill=!0,k.fetch||(k.fetch=ya,k.Headers=C,k.Request=be,k.Response=K),self.fetch.bind(self);let cc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",_a=(r=21)=>{let e="",t=r|0;for(;t--;)e+=cc[Math.random()*64|0];return e};var Le=TypeError,je=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Z=[],z=[],lc=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 dc(r){mn||ga();var e,t,n,i,a,o,s=r.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=r[s-2]==="="?2:r[s-1]==="="?1:0,o=new lc(s*3/4-a),n=a>0?s-4:s;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 pc(r){return Z[r>>18&63]+Z[r>>12&63]+Z[r>>6&63]+Z[r&63]}function hc(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(pc(n));return i.join("")}function va(r){mn||ga();for(var e,t=r.length,n=t%3,i="",a=[],o=16383,s=0,f=t-n;s<f;s+=o)a.push(hc(r,s,s+o>f?f:s+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,s=i*8-n-1,f=(1<<s)-1,d=f>>1,c=-7,u=t?i-1:0,l=t?-1:1,p=r[e+u];for(u+=l,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=a*256+r[e+u],u+=l,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=o*256+r[e+u],u+=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 ma(r,e,t,n,i,a){var o,s,f,d=a*8-i-1,c=(1<<d)-1,u=c>>1,l=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,_=n?1:-1,$=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=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+u>=1?e+=l/f:e+=l*Math.pow(2,1-u),e*f>=2&&(o++,f/=2),o+u>=c?(s=0,o=c):o+u>=1?(s=(e*f-1)*Math.pow(2,i),o=o+u):(s=e*Math.pow(2,u-1)*Math.pow(2,i),o=0));i>=8;r[t+p]=s&255,p+=_,s/=256,i-=8);for(o=o<<i|s,d+=i;d>0;r[t+p]=o&255,p+=_,o/=256,d-=8);r[t+p-_]|=$*128}var yc={}.toString,wa=Array.isArray||function(r){return yc.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 st(r){return typeof r=="boolean"}function hr(r){return r===null}function ja(r){return r==null}function xn(r){return typeof r=="number"}function yr(r){return typeof r=="string"}function Va(r){return typeof r=="symbol"}function ee(r){return r===void 0}function _r(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 gr(r){return Oe(r)&&(Tn(r)==="[object Error]"||r instanceof Error)}function vr(r){return typeof r=="function"}function Ga(r){return r===null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||typeof r=="symbol"||typeof r>"u"}function Ha(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 $l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function El(){var r=new Date,e=[Fn(r.getHours()),Fn(r.getMinutes()),Fn(r.getSeconds())].join(":");return[r.getDate(),$l[r.getMonth()],e].join(" ")}function Wa(){console.log("%s - %s",El(),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 za(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(s,f){t=s,n=f}),a=[],o=0;o<arguments.length;o++)a.push(arguments[o]);a.push(function(s,f){s?n(s):t(f)});try{r.apply(this,a)}catch(s){n(s)}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,ka(r))}Mn.custom=Ie;function Sl(r,e){if(!r){var t=new Error("Promise was rejected with a falsy value");t.reason=r,r=t}return e(r)}function Xa(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(s){He.nextTick(o.bind(null,null,s))},function(s){He.nextTick(Sl.bind(null,s,o))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(r)),Object.defineProperties(e,ka(r)),e}var Al={inherits:Ua,_extend:Rn,log:Wa,isBuffer:Ha,isPrimitive:Ga,isFunction:vr,isError:gr,isDate:ft,isObject:Oe,isRegExp:_r,isUndefined:ee,isSymbol:Va,isString:yr,isNumber:xn,isNullOrUndefined:ja,isNull:hr,isBoolean:st,isArray:Pn,inspect:Q,deprecate:Sn,format:at,debuglog:La,promisify:Mn,callbackify:Xa},Ol=Object.freeze({__proto__:null,_extend:Rn,callbackify:Xa,debuglog:La,default:Al,deprecate:Sn,format:at,inherits:Ua,inspect:Q,isArray:Pn,isBoolean:st,isBuffer:Ha,isDate:ft,isError:gr,isFunction:vr,isNull:hr,isNullOrUndefined:ja,isNumber:xn,isObject:Oe,isPrimitive:Ga,isRegExp:_r,isString:yr,isSymbol:Va,isUndefined:ee,log:Wa,promisify:Mn}),Il=Jf(Ol),Pl=Il.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,Ya=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,Ka=Nn&&Set.prototype.forEach,xl=typeof WeakMap=="function"&&WeakMap.prototype,mr=xl?WeakMap.prototype.has:null,Tl=typeof WeakSet=="function"&&WeakSet.prototype,wr=Tl?WeakSet.prototype.has:null,Fl=typeof WeakRef=="function"&&WeakRef.prototype,Za=Fl?WeakRef.prototype.deref:null,Rl=Boolean.prototype.valueOf,Ml=Object.prototype.toString,Dl=Function.prototype.toString,Cl=String.prototype.match,qn=String.prototype.slice,ye=String.prototype.replace,Nl=String.prototype.toUpperCase,Ja=String.prototype.toLowerCase,Qa=RegExp.prototype.test,eo=Array.prototype.concat,re=Array.prototype.join,Bl=Array.prototype.slice,ro=Math.floor,Un=typeof BigInt=="function"?BigInt.prototype.valueOf:null,kn=Object.getOwnPropertySymbols,Ln=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,to=Object.prototype.propertyIsEnumerable,no=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function io(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Qa.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-ro(-r):ro(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=Pl,ao=jn.custom,oo=co(ao)?ao:null,uo={__proto__:null,double:'"',single:"'"},ql={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},dt=function r(e,t,n,i){var a=t||{};if(fe(a,"quoteStyle")&&!fe(uo,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 s=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 po(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var f=String(e);return s?io(e,f):f}if(typeof e=="bigint"){var d=String(e)+"n";return s?io(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 u=td(a,n);if(typeof i>"u")i=[];else if(lo(i,e)>=0)return"[Circular]";function l(W,oe,Y){if(oe&&(i=Bl.call(i),i.push(oe)),Y){var ke={depth:a.depth};return fe(a,"quoteStyle")&&(ke.quoteStyle=a.quoteStyle),r(W,ke,n+1,i)}return r(W,a,n+1,i)}if(typeof e=="function"&&!fo(e)){var p=zl(e),_=pt(e,l);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(_.length>0?" { "+re.call(_,", ")+" }":"")}if(co(e)){var $=We?ye.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Ln.call(e);return typeof e=="object"&&!We?$r($):$}if(Ql(e)){for(var S="<"+Ja.call(String(e.nodeName)),A=e.attributes||[],E=0;E<A.length;E++)S+=" "+A[E].name+"="+so(Ul(A[E].value),"double",a);return S+=">",e.childNodes&&e.childNodes.length&&(S+="..."),S+="</"+Ja.call(String(e.nodeName))+">",S}if(Vn(e)){if(e.length===0)return"[]";var h=pt(e,l);return u&&!rd(h)?"["+Hn(h,u)+"]":"[ "+re.call(h,", ")+" ]"}if(Ll(e)){var I=pt(e,l);return!("cause"in Error.prototype)&&"cause"in e&&!to.call(e,"cause")?"{ ["+String(e)+"] "+re.call(eo.call("[cause]: "+l(e.cause),I),", ")+" }":I.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+re.call(I,", ")+" }"}if(typeof e=="object"&&o){if(oo&&typeof e[oo]=="function"&&jn)return jn(e,{depth:c-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Xl(e)){var T=[];return Ya&&Ya.call(e,function(W,oe){T.push(l(oe,e,!0)+" => "+l(W,e))}),ho("Map",ct.call(e),T,u)}if(Zl(e)){var F=[];return Ka&&Ka.call(e,function(W){F.push(l(W,e))}),ho("Set",lt.call(e),F,u)}if(Yl(e))return Gn("WeakMap");if(Jl(e))return Gn("WeakSet");if(Kl(e))return Gn("WeakRef");if(Vl(e))return $r(l(Number(e)));if(Hl(e))return $r(l(Un.call(e)));if(Gl(e))return $r(Rl.call(e));if(jl(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(!kl(e)&&!fo(e)){var b=pt(e,l),g=no?no(e)===Object.prototype:e instanceof Object||e.constructor===Object,m=e instanceof Object?"":"null prototype",O=!g&&br&&Object(e)===e&&br in e?qn.call(_e(e),8,-1):m?"Object":"",P=g||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",B=P+(O||m?"["+re.call(eo.call([],O||[],m||[]),": ")+"] ":"");return b.length===0?B+"{}":u?B+"{"+Hn(b,u)+"}":B+"{ "+re.call(b,", ")+" }"}return String(e)};function so(r,e,t){var n=t.quoteStyle||e,i=uo[n];return i+r+i}function Ul(r){return ye.call(String(r),/"/g,"&quot;")}function Pe(r){return!br||!(typeof r=="object"&&(br in r||typeof r[br]<"u"))}function Vn(r){return _e(r)==="[object Array]"&&Pe(r)}function kl(r){return _e(r)==="[object Date]"&&Pe(r)}function fo(r){return _e(r)==="[object RegExp]"&&Pe(r)}function Ll(r){return _e(r)==="[object Error]"&&Pe(r)}function jl(r){return _e(r)==="[object String]"&&Pe(r)}function Vl(r){return _e(r)==="[object Number]"&&Pe(r)}function Gl(r){return _e(r)==="[object Boolean]"&&Pe(r)}function co(r){if(We)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Ln)return!1;try{return Ln.call(r),!0}catch{}return!1}function Hl(r){if(!r||typeof r!="object"||!Un)return!1;try{return Un.call(r),!0}catch{}return!1}var Wl=Object.prototype.hasOwnProperty||function(r){return r in this};function fe(r,e){return Wl.call(r,e)}function _e(r){return Ml.call(r)}function zl(r){if(r.name)return r.name;var e=Cl.call(Dl.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function lo(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 Xl(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 Yl(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 Kl(r){if(!Za||!r||typeof r!="object")return!1;try{return Za.call(r),!0}catch{}return!1}function Zl(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 Jl(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 Ql(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function po(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return po(qn.call(r,0,e.maxStringLength),e)+n}var i=ql[e.quoteStyle||"single"];i.lastIndex=0;var a=ye.call(ye.call(r,i,"\\$1"),/[\x00-\x1f]/g,ed);return so(a,"single",e)}function ed(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":"")+Nl.call(e.toString(16))}function $r(r){return"Object("+r+")"}function Gn(r){return r+" { ? }"}function ho(r,e,t,n){var i=n?Hn(t,n):re.call(t,", ");return r+" ("+e+") {"+i+"}"}function rd(r){for(var e=0;e<r.length;e++)if(lo(r[e],`
18
18
  `)>=0)return!1;return!0}function td(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 kn=="function"?kn(r):[],o;if(We){o={};for(var s=0;s<a.length;s++)o["$"+a[s]]=a[s]}for(var f in r)fe(r,f)&&(t&&String(Number(f))===f&&f<r.length||We&&o["$"+f]instanceof Symbol||(Qa.call(/[^\w$]/,f)?n.push(e(f,r)+": "+e(r[f],r)):n.push(f+": "+e(r[f],r))));if(typeof kn=="function")for(var d=0;d<a.length;d++)to.call(r,a[d])&&n.push("["+e(a[d])+"]: "+e(r[a[d]],r));return n}var nd=dt,id=Le,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},ad=function(r,e){if(r){var t=ht(r,e);return t&&t.value}},od=function(r,e,t){var n=ht(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},ud=function(r,e){return r?!!ht(r,e):!1},sd=function(r,e){if(r)return ht(r,e,!0)},fd=function(){var e,t={assert:function(n){if(!t.has(n))throw new id("Side channel does not contain "+nd(n))},delete:function(n){var i=e&&e.next,a=sd(e,n);return a&&i&&i===a&&(e=void 0),!!a},get:function(n){return ad(e,n)},has:function(n){return ud(e,n)},set:function(n,i){e||(e={next:void 0}),od(e,n,i)}};return t},yo=Object,cd=Error,ld=EvalError,dd=RangeError,pd=ReferenceError,hd=SyntaxError,yd=URIError,_d=Math.abs,gd=Math.floor,vd=Math.max,md=Math.min,wd=Math.pow,bd=Math.round,$d=Number.isNaN||function(e){return e!==e},Ed=$d,Sd=function(e){return Ed(e)||e===0?e:e<0?-1:1},Ad=Object.getOwnPropertyDescriptor,yt=Ad;if(yt)try{yt([],"length")}catch{yt=null}var _o=yt,_t=Object.defineProperty||!1;if(_t)try{_t({},"a",{value:1})}catch{_t=!1}var Od=_t,Wn,go;function Id(){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 s=Object.getOwnPropertyDescriptor(e,t);if(s.value!==i||s.enumerable!==!0)return!1}return!0}),Wn}var zn,vo;function Pd(){if(vo)return zn;vo=1;var r=typeof Symbol<"u"&&Symbol,e=Id();return zn=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},zn}var Xn,mo;function wo(){return mo||(mo=1,Xn=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Xn}var Yn,bo;function $o(){if(bo)return Yn;bo=1;var r=yo;return Yn=r.getPrototypeOf||null,Yn}var Kn,Eo;function xd(){if(Eo)return Kn;Eo=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=[],u=0;u<f.length;u+=1)c[u]=f[u];for(var l=0;l<d.length;l+=1)c[l+f.length]=d[l];return c},a=function(f,d){for(var c=[],u=d||0,l=0;u<f.length;u+=1,l+=1)c[l]=f[u];return c},o=function(s,f){for(var d="",c=0;c<s.length;c+=1)d+=s[c],c+1<s.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),u,l=function(){if(this instanceof u){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),_=[],$=0;$<p;$++)_[$]="$"+$;if(u=Function("binder","return function ("+o(_,",")+"){ return binder.apply(this,arguments); }")(l),d.prototype){var S=function(){};S.prototype=d.prototype,u.prototype=new S,S.prototype=null}return u},Kn}var Zn,So;function gt(){if(So)return Zn;So=1;var r=xd();return Zn=Function.prototype.bind||r,Zn}var Jn,Ao;function Qn(){return Ao||(Ao=1,Jn=Function.prototype.call),Jn}var ei,Oo;function Io(){return Oo||(Oo=1,ei=Function.prototype.apply),ei}var Td=typeof Reflect<"u"&&Reflect&&Reflect.apply,Fd=gt(),Rd=Io(),Md=Qn(),Dd=Td,Cd=Dd||Fd.call(Md,Rd),Nd=gt(),Bd=Le,qd=Qn(),Ud=Cd,Po=function(e){if(e.length<1||typeof e[0]!="function")throw new Bd("a function is required");return Ud(Nd,qd,e)},ri,xo;function kd(){if(xo)return ri;xo=1;var r=Po,e=_o,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 ri=n&&typeof n.get=="function"?r([n.get]):typeof a=="function"?function(s){return a(s==null?s:i(s))}:!1,ri}var ti,To;function Ld(){if(To)return ti;To=1;var r=wo(),e=$o(),t=kd();return ti=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,ti}var ni,Fo;function jd(){if(Fo)return ni;Fo=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=gt();return ni=t.call(r,e),ni}var x,Vd=yo,Gd=cd,Hd=ld,Wd=dd,zd=pd,ze=hd,Xe=Le,Xd=yd,Yd=_d,Kd=gd,Zd=vd,Jd=md,Qd=wd,ep=bd,rp=Sd,Ro=Function,ii=function(r){try{return Ro('"use strict"; return ('+r+").constructor;")()}catch{}},Er=_o,tp=Od,ai=function(){throw new Xe},np=Er?function(){try{return arguments.callee,ai}catch{try{return Er(arguments,"callee").get}catch{return ai}}}():ai,Ye=Pd()(),U=Ld(),ip=$o(),ap=wo(),Mo=Io(),Sr=Qn(),Ke={},op=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%":Gd,"%eval%":eval,"%EvalError%":Hd,"%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%":Ro,"%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%":Vd,"%Object.getOwnPropertyDescriptor%":Er,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?x:Promise,"%Proxy%":typeof Proxy>"u"?x:Proxy,"%RangeError%":Wd,"%ReferenceError%":zd,"%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%":np,"%TypedArray%":op,"%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%":Xd,"%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%":Mo,"%Object.defineProperty%":tp,"%Object.getPrototypeOf%":ip,"%Math.abs%":Yd,"%Math.floor%":Kd,"%Math.max%":Zd,"%Math.min%":Jd,"%Math.pow%":Qd,"%Math.round%":ep,"%Math.sign%":rp,"%Reflect.getPrototypeOf%":ap};if(U)try{null.error}catch(r){var up=U(U(r));xe["%Error.prototype%"]=up}var sp=function r(e){var t;if(e==="%AsyncFunction%")t=ii("async function () {}");else if(e==="%GeneratorFunction%")t=ii("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=ii("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},Do={__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=gt(),vt=jd(),fp=Ar.call(Sr,Array.prototype.concat),cp=Ar.call(Mo,Array.prototype.splice),Co=Ar.call(Sr,String.prototype.replace),mt=Ar.call(Sr,String.prototype.slice),lp=Ar.call(Sr,RegExp.prototype.exec),dp=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,pp=/\\(\\)?/g,hp=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 Co(e,dp,function(a,o,s,f){i[i.length]=s?Co(f,pp,"$1"):o||a}),i},yp=function(e,t){var n=e,i;if(vt(Do,n)&&(i=Do[n],n="%"+i[0]+"%"),vt(xe,n)){var a=xe[n];if(a===Ke&&(a=sp(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!")},oi=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(lp(/^%?[^%]*%?$/,e)===null)throw new ze("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=hp(e),i=n.length>0?n[0]:"",a=yp("%"+i+"%",t),o=a.name,s=a.value,f=!1,d=a.alias;d&&(i=d[0],cp(n,fp([0,1],d)));for(var c=1,u=!0;c<n.length;c+=1){var l=n[c],p=mt(l,0,1),_=mt(l,-1);if((p==='"'||p==="'"||p==="`"||_==='"'||_==="'"||_==="`")&&p!==_)throw new ze("property names with quotes must have matching quotes");if((l==="constructor"||!u)&&(f=!0),i+="."+l,o="%"+i+"%",vt(xe,o))s=xe[o];else if(s!=null){if(!(l in s)){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(s,l);u=!!$,u&&"get"in $&&!("originalValue"in $.get)?s=$.get:s=s[l]}else u=vt(s,l),s=s[l];u&&!f&&(xe[o]=s)}}return s},No=oi,Bo=Po,_p=Bo([No("%String.prototype.indexOf%")]),qo=function(e,t){var n=No(e,!!t);return typeof n=="function"&&_p(e,".prototype.")>-1?Bo([n]):n},gp=oi,Or=qo,vp=dt,mp=Le,Uo=gp("%Map%",!0),wp=Or("Map.prototype.get",!0),bp=Or("Map.prototype.set",!0),$p=Or("Map.prototype.has",!0),Ep=Or("Map.prototype.delete",!0),Sp=Or("Map.prototype.size",!0),ko=!!Uo&&function(){var e,t={assert:function(n){if(!t.has(n))throw new mp("Side channel does not contain "+vp(n))},delete:function(n){if(e){var i=Ep(e,n);return Sp(e)===0&&(e=void 0),i}return!1},get:function(n){if(e)return wp(e,n)},has:function(n){return e?$p(e,n):!1},set:function(n,i){e||(e=new Uo),bp(e,n,i)}};return t},Ap=oi,wt=qo,Op=dt,bt=ko,Ip=Le,Ze=Ap("%WeakMap%",!0),Pp=wt("WeakMap.prototype.get",!0),xp=wt("WeakMap.prototype.set",!0),Tp=wt("WeakMap.prototype.has",!0),Fp=wt("WeakMap.prototype.delete",!0),Rp=Ze?function(){var e,t,n={assert:function(i){if(!n.has(i))throw new Ip("Side channel does not contain "+Op(i))},delete:function(i){if(Ze&&i&&(typeof i=="object"||typeof i=="function")){if(e)return Fp(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?Pp(e,i):t&&t.get(i)},has:function(i){return Ze&&i&&(typeof i=="object"||typeof i=="function")&&e?Tp(e,i):!!t&&t.has(i)},set:function(i,a){Ze&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Ze),xp(e,i,a)):bt&&(t||(t=bt()),t.set(i,a))}};return n}:bt,Mp=Le,Dp=dt,Cp=fd,Np=ko,Bp=Rp,qp=Bp||Np||Cp,Lo=function(){var e,t={assert:function(n){if(!t.has(n))throw new Mp("Side channel does not contain "+Dp(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=qp()),e.set(n,i)}};return t},Up=String.prototype.replace,kp=/%20/g,ui={RFC1738:"RFC1738",RFC3986:"RFC3986"},jo={default:ui.RFC3986,formatters:{RFC1738:function(r){return Up.call(r,kp,"+")},RFC3986:function(r){return String(r)}},RFC1738:ui.RFC1738,RFC3986:ui.RFC3986},Lp=jo,jp=Lo,si=Object.prototype.hasOwnProperty,Te=Array.isArray,$t=jp(),Vo=function(e,t){return $t.set(e,t),e},Et=function(e){return $t.has(e)},fi=function(e){return $t.get(e)},Go=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}(),Vp=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}}},ci=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},Gp=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=fi(e)+1;e[i]=t,Go(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},s=0;s<a.length;s++){var f=parseInt(a[s],10);o[f+1]=t[a[s]]}return Vo(o,fi(t)+1)}return[e].concat(t)}var d=e;return Te(e)&&!Te(t)&&(d=ci(e,n)),Te(e)&&Te(t)?(t.forEach(function(c,u){if(si.call(e,u)){var l=e[u];l&&typeof l=="object"&&c&&typeof c=="object"?e[u]=r(l,c,n):e.push(c)}else e[u]=c}),e):Object.keys(t).reduce(function(c,u){var l=t[u];return si.call(c,u)?c[u]=r(c[u],l,n):c[u]=l,c},d)},Hp=function(e,t){return Object.keys(t).reduce(function(n,i){return n[i]=t[i],n},e)},Wp=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}},li=1024,zp=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 s="",f=0;f<o.length;f+=li){for(var d=o.length>=li?o.slice(f,f+li):o,c=[],u=0;u<d.length;++u){var l=d.charCodeAt(u);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||a===Lp.RFC1738&&(l===40||l===41)){c[c.length]=d.charAt(u);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}u+=1,l=65536+((l&1023)<<10|d.charCodeAt(u)&1023),c[c.length]=te[240|l>>18]+te[128|l>>12&63]+te[128|l>>6&63]+te[128|l&63]}s+=c.join("")}return s},Xp=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],s=Object.keys(o),f=0;f<s.length;++f){var d=s[f],c=o[d];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(t.push({obj:o,prop:d}),n.push(c))}return Vp(t),e},Yp=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Kp=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Zp=function(e,t,n,i){if(Et(e)){var a=fi(e)+1;return e[a]=t,Go(e,a),e}var o=[].concat(e,t);return o.length>n?Vo(ci(o,{plainObjects:i}),o.length-1):o},Jp=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)},Qp={arrayToObject:ci,assign:Hp,combine:Zp,compact:Xp,decode:Wp,encode:zp,isBuffer:Kp,isOverflow:Et,isRegExp:Yp,maybeMap:Jp,merge:Gp},Ho=Lo,St=Qp,Ir=jo,eh=Object.prototype.hasOwnProperty,Wo={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ne=Array.isArray,rh=Array.prototype.push,zo=function(r,e){rh.apply(r,ne(e)?e:[e])},th=Date.prototype.toISOString,Xo=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:Xo,formatter:Ir.formatters[Xo],indices:!1,serializeDate:function(e){return th.call(e)},skipNulls:!1,strictNullHandling:!1},nh=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},di={},ih=function r(e,t,n,i,a,o,s,f,d,c,u,l,p,_,$,S,A,E){for(var h=e,I=E,T=0,F=!1;(I=I.get(di))!==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(di)>"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(la){return la instanceof Date?p(la):la})),h===null){if(o)return d&&!S?d(t,N.encoder,A,"key",_):t;h=""}if(nh(h)||St.isBuffer(h)){if(d){var g=S?t:d(t,N.encoder,A,"key",_);return[$(g)+"="+$(d(h,N.encoder,A,"value",_))]}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=u?P.sort(u):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],ke=typeof Y=="object"&&Y&&typeof Y.value<"u"?Y.value:h[Y];if(!(s&&ke===null)){var ca=l&&f?String(Y).replace(/\./g,"%2E"):String(Y),gT=ne(h)?typeof n=="function"?n(W,ca):W:W+(l?"."+ca:"["+ca+"]");E.set(e,T);var Zf=Ho();Zf.set(di,E),zo(m,r(ke,gT,n,i,a,o,s,f,n==="comma"&&S&&ne(h)?null:d,c,u,l,p,_,$,S,A,Zf))}}return m},ah=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(!eh.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 Wo?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 s=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:N.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:N.addQueryPrefix,allowDots:s,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}},oh=function(r,e){var t=r,n=ah(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 s=Wo[n.arrayFormat],f=s==="comma"&&n.commaRoundTrip;i||(i=Object.keys(t)),n.sort&&i.sort(n.sort);for(var d=Ho(),c=0;c<i.length;++c){var u=i[c],l=t[u];n.skipNulls&&l===null||zo(o,ih(l,u,s,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),_=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?_+="utf8=%26%2310003%3B&":_+="utf8=%E2%9C%93&"),p.length>0?_+p:""},uh=we(oh);let Yo={storeIdentifier:"",environment:"prod"};function sh(r){Yo=r}function j(){return Yo}const fh=(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`}},ch=(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}},lh=r=>{switch(r){case"prod":case"preprod":return"https://static.rechargecdn.com";case"stage":case"prestage":return"https://static.stage.rechargecdn.com"}},Ko="/tools/recurring";class Je{constructor(e,t){this.name="RechargeRequestError",this.message=e,this.status=t}}function dh(r){return uh(r,{encode:!1,indices:!1,arrayFormat:"comma"})}function v(r,e){return{...r,internalFnCall:r.internalFnCall??e,internalRequestId:r.internalRequestId??_a()}}async function At(r,e,t={}){const n=j();return X(r,`${lh(n.environment)}/store/${n.storeIdentifier}${e}`,t)}async function w(r,e,{id:t,query:n,data:i,headers:a}={},o){const{environment:s,environmentUri:f,storeIdentifier:d,loginRetryFn:c,__unstable_twoFactorRetryFn:u,appName:l,appVersion:p}=j();if(!d)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const _=o.apiToken;if(!_)throw new Error("No API token defined on session.");const $=fh(s,f),S={"X-Recharge-Access-Token":_,"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.78.1","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(u&&E instanceof Je&&E.status===423)return u().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,`${Ko}${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 u;[o,u]=o.split("?");const l=[u,dh(n)].join("&").replace(/^&/,"");o=`${o}${l?`?${l}`:""}`}let s;i&&r!=="get"&&(s=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:s});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 ph(r,e){return w("get","/addresses",{query:e},v(r,"listAddresses"))}async function hh(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 yh(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 pi(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 _h(r,e,t,n){return pi(v(r,"applyDiscountToAddress"),e,{discounts:[{code:t}]},n)}async function gh(r,e,t){if(e===void 0||e==="")throw new Error("Id is required");return pi(v(r,"removeDiscountsFromAddress"),e,{discounts:[]},t)}function vh(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/addresses",{id:e},v(r,"deleteAddress"))}async function mh(r,e){const{address:t}=await w("post","/addresses/merge",{data:e},v(r,"mergeAddresses"));return t}async function wh(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 bh=Object.freeze({__proto__:null,applyDiscountToAddress:_h,createAddress:yh,deleteAddress:vh,getAddress:hh,listAddresses:ph,mergeAddresses:mh,removeDiscountsFromAddress:gh,skipFutureCharge:wh,updateAddress:pi});async function $h(){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 Eh(r,e){return Zo(r,e)}async function Zo(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 Sh(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 Ah(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 Oh(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 Ih(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 Ph(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 xh(){const{customerHash:r}=j(),{pathname:e,search:t}=window.location,n=new URLSearchParams(t).get("token"),i=e.split("/").filter(Boolean),a=i.findIndex(s=>s==="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 Th(){const{customerHash:r,token:e}=xh(),{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:s,storefrontAccessToken:f,appName:d,appVersion:c}=j(),u=ch(o,s),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.78.1",...a||{}};return X(r,`${u}${e}`,{id:t,query:n,data:i,headers:l})}var Fh=Object.freeze({__proto__:null,loginCustomerPortal:Th,loginShopifyApi:Eh,loginShopifyAppProxy:$h,loginWithShopifyCustomerAccount:Sh,loginWithShopifyStorefront:Zo,sendPasswordlessCode:Ah,sendPasswordlessCodeAppProxy:Oh,validatePasswordlessCode:Ih,validatePasswordlessCodeAppProxy:Ph}),Jo={},hi={},ce={},Rh=typeof D=="object"&&D&&D.Object===Object&&D,Qo=Rh,Mh=Qo,Dh=typeof self=="object"&&self&&self.Object===Object&&self,Ch=Mh||Dh||Function("return this")(),le=Ch,Nh=le,Bh=Nh.Symbol,Ot=Bh,eu=Ot,ru=Object.prototype,qh=ru.hasOwnProperty,Uh=ru.toString,xr=eu?eu.toStringTag:void 0;function kh(r){var e=qh.call(r,xr),t=r[xr];try{r[xr]=void 0;var n=!0}catch{}var i=Uh.call(r);return n&&(e?r[xr]=t:delete r[xr]),i}var Lh=kh,jh=Object.prototype,Vh=jh.toString;function Gh(r){return Vh.call(r)}var Hh=Gh,tu=Ot,Wh=Lh,zh=Hh,Xh="[object Null]",Yh="[object Undefined]",nu=tu?tu.toStringTag:void 0;function Kh(r){return r==null?r===void 0?Yh:Xh:nu&&nu in Object(r)?Wh(r):zh(r)}var ge=Kh;function Zh(r){return r!=null&&typeof r=="object"}var ve=Zh,Jh=ge,Qh=ve,ey="[object Number]";function ry(r){return typeof r=="number"||Qh(r)&&Jh(r)==ey}var It=ry,M={};function ty(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var Qe=ty,ny=ge,iy=Qe,ay="[object AsyncFunction]",oy="[object Function]",uy="[object GeneratorFunction]",sy="[object Proxy]";function fy(r){if(!iy(r))return!1;var e=ny(r);return e==oy||e==uy||e==ay||e==sy}var yi=fy,cy=le,ly=cy["__core-js_shared__"],dy=ly,_i=dy,iu=function(){var r=/[^.]+$/.exec(_i&&_i.keys&&_i.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function py(r){return!!iu&&iu in r}var hy=py,yy=Function.prototype,_y=yy.toString;function gy(r){if(r!=null){try{return _y.call(r)}catch{}try{return r+""}catch{}}return""}var au=gy,vy=yi,my=hy,wy=Qe,by=au,$y=/[\\^$.*+?()[\]{}|]/g,Ey=/^\[object .+?Constructor\]$/,Sy=Function.prototype,Ay=Object.prototype,Oy=Sy.toString,Iy=Ay.hasOwnProperty,Py=RegExp("^"+Oy.call(Iy).replace($y,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xy(r){if(!wy(r)||my(r))return!1;var e=vy(r)?Py:Ey;return e.test(by(r))}var Ty=xy;function Fy(r,e){return r?.[e]}var Ry=Fy,My=Ty,Dy=Ry;function Cy(r,e){var t=Dy(r,e);return My(t)?t:void 0}var Re=Cy,Ny=Re,By=function(){try{var r=Ny(Object,"defineProperty");return r({},"",{}),r}catch{}}(),ou=By,uu=ou;function qy(r,e,t){e=="__proto__"&&uu?uu(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var su=qy;function Uy(r,e){return r===e||r!==r&&e!==e}var Pt=Uy,ky=su,Ly=Pt,jy=Object.prototype,Vy=jy.hasOwnProperty;function Gy(r,e,t){var n=r[e];(!(Vy.call(r,e)&&Ly(n,t))||t===void 0&&!(e in r))&&ky(r,e,t)}var Hy=Gy,Wy=Hy,zy=su;function Xy(r,e,t,n){var i=!t;t||(t={});for(var a=-1,o=e.length;++a<o;){var s=e[a],f=n?n(t[s],r[s],s,t,r):void 0;f===void 0&&(f=r[s]),i?zy(t,s,f):Wy(t,s,f)}return t}var Yy=Xy;function Ky(r){return r}var xt=Ky;function Zy(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 Jy=Zy,Qy=Jy,fu=Math.max;function e_(r,e,t){return e=fu(e===void 0?r.length-1:e,0),function(){for(var n=arguments,i=-1,a=fu(n.length-e,0),o=Array(a);++i<a;)o[i]=n[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=n[i];return s[e]=t(o),Qy(r,this,s)}}var r_=e_;function t_(r){return function(){return r}}var n_=t_,i_=n_,cu=ou,a_=xt,o_=cu?function(r,e){return cu(r,"toString",{configurable:!0,enumerable:!1,value:i_(e),writable:!0})}:a_,u_=o_,s_=800,f_=16,c_=Date.now;function l_(r){var e=0,t=0;return function(){var n=c_(),i=f_-(n-t);if(t=n,i>0){if(++e>=s_)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}var d_=l_,p_=u_,h_=d_,y_=h_(p_),__=y_,g_=xt,v_=r_,m_=__;function w_(r,e){return m_(v_(r,e,g_),r+"")}var b_=w_,$_=9007199254740991;function E_(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=$_}var gi=E_,S_=yi,A_=gi;function O_(r){return r!=null&&A_(r.length)&&!S_(r)}var Tr=O_,I_=9007199254740991,P_=/^(?:0|[1-9]\d*)$/;function x_(r,e){var t=typeof r;return e=e??I_,!!e&&(t=="number"||t!="symbol"&&P_.test(r))&&r>-1&&r%1==0&&r<e}var vi=x_,T_=Pt,F_=Tr,R_=vi,M_=Qe;function D_(r,e,t){if(!M_(t))return!1;var n=typeof e;return(n=="number"?F_(t)&&R_(e,t.length):n=="string"&&e in t)?T_(t[e],r):!1}var lu=D_,C_=b_,N_=lu;function B_(r){return C_(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&&N_(t[0],t[1],o)&&(a=i<3?void 0:a,i=1),e=Object(e);++n<i;){var s=t[n];s&&r(e,s,n,a)}return e})}var q_=B_;function U_(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var du=U_,k_=ge,L_=ve,j_="[object Arguments]";function V_(r){return L_(r)&&k_(r)==j_}var G_=V_,pu=G_,H_=ve,hu=Object.prototype,W_=hu.hasOwnProperty,z_=hu.propertyIsEnumerable,X_=pu(function(){return arguments}())?pu:function(r){return H_(r)&&W_.call(r,"callee")&&!z_.call(r,"callee")},yu=X_,Y_=Array.isArray,V=Y_,Tt={exports:{}};function K_(){return!1}var Z_=K_;Tt.exports,function(r,e){var t=le,n=Z_,i=e&&!e.nodeType&&e,a=i&&!0&&r&&!r.nodeType&&r,o=a&&a.exports===i,s=o?t.Buffer:void 0,f=s?s.isBuffer:void 0,d=f||n;r.exports=d}(Tt,Tt.exports);var _u=Tt.exports,J_=ge,Q_=gi,eg=ve,rg="[object Arguments]",tg="[object Array]",ng="[object Boolean]",ig="[object Date]",ag="[object Error]",og="[object Function]",ug="[object Map]",sg="[object Number]",fg="[object Object]",cg="[object RegExp]",lg="[object Set]",dg="[object String]",pg="[object WeakMap]",hg="[object ArrayBuffer]",yg="[object DataView]",_g="[object Float32Array]",gg="[object Float64Array]",vg="[object Int8Array]",mg="[object Int16Array]",wg="[object Int32Array]",bg="[object Uint8Array]",$g="[object Uint8ClampedArray]",Eg="[object Uint16Array]",Sg="[object Uint32Array]",R={};R[_g]=R[gg]=R[vg]=R[mg]=R[wg]=R[bg]=R[$g]=R[Eg]=R[Sg]=!0,R[rg]=R[tg]=R[hg]=R[ng]=R[yg]=R[ig]=R[ag]=R[og]=R[ug]=R[sg]=R[fg]=R[cg]=R[lg]=R[dg]=R[pg]=!1;function Ag(r){return eg(r)&&Q_(r.length)&&!!R[J_(r)]}var Og=Ag;function Ig(r){return function(e){return r(e)}}var Pg=Ig,Ft={exports:{}};Ft.exports,function(r,e){var t=Qo,n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,o=a&&t.process,s=function(){try{var f=i&&i.require&&i.require("util").types;return f||o&&o.binding&&o.binding("util")}catch{}}();r.exports=s}(Ft,Ft.exports);var xg=Ft.exports,Tg=Og,Fg=Pg,gu=xg,vu=gu&&gu.isTypedArray,Rg=vu?Fg(vu):Tg,mu=Rg,Mg=du,Dg=yu,Cg=V,Ng=_u,Bg=vi,qg=mu,Ug=Object.prototype,kg=Ug.hasOwnProperty;function Lg(r,e){var t=Cg(r),n=!t&&Dg(r),i=!t&&!n&&Ng(r),a=!t&&!n&&!i&&qg(r),o=t||n||i||a,s=o?Mg(r.length,String):[],f=s.length;for(var d in r)(e||kg.call(r,d))&&!(o&&(d=="length"||i&&(d=="offset"||d=="parent")||a&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||Bg(d,f)))&&s.push(d);return s}var wu=Lg,jg=Object.prototype;function Vg(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||jg;return r===t}var bu=Vg;function Gg(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var Hg=Gg,Wg=Qe,zg=bu,Xg=Hg,Yg=Object.prototype,Kg=Yg.hasOwnProperty;function Zg(r){if(!Wg(r))return Xg(r);var e=zg(r),t=[];for(var n in r)n=="constructor"&&(e||!Kg.call(r,n))||t.push(n);return t}var Jg=Zg,Qg=wu,ev=Jg,rv=Tr;function tv(r){return rv(r)?Qg(r,!0):ev(r)}var nv=tv,iv=Yy,av=q_,ov=nv,uv=av(function(r,e){iv(e,ov(e),r)}),sv=uv,fv=sv,Rt={},Me={};function cv(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 lv=cv;function dv(r){return function(e,t,n){for(var i=-1,a=Object(e),o=n(e),s=o.length;s--;){var f=o[r?s:++i];if(t(a[f],f,a)===!1)break}return e}}var pv=dv,hv=pv,yv=hv(),_v=yv;function gv(r,e){return function(t){return r(e(t))}}var vv=gv,mv=vv,wv=mv(Object.keys,Object),bv=wv,$v=bu,Ev=bv,Sv=Object.prototype,Av=Sv.hasOwnProperty;function Ov(r){if(!$v(r))return Ev(r);var e=[];for(var t in Object(r))Av.call(r,t)&&t!="constructor"&&e.push(t);return e}var Iv=Ov,Pv=wu,xv=Iv,Tv=Tr;function Fv(r){return Tv(r)?Pv(r):xv(r)}var Mt=Fv,Rv=_v,Mv=Mt;function Dv(r,e){return r&&Rv(r,e,Mv)}var Cv=Dv,Nv=Tr;function Bv(r,e){return function(t,n){if(t==null)return t;if(!Nv(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 qv=Bv,Uv=Cv,kv=qv,Lv=kv(Uv),mi=Lv,jv=mi;function Vv(r,e){var t=!0;return jv(r,function(n,i,a){return t=!!e(n,i,a),t}),t}var Gv=Vv;function Hv(){this.__data__=[],this.size=0}var Wv=Hv,zv=Pt;function Xv(r,e){for(var t=r.length;t--;)if(zv(r[t][0],e))return t;return-1}var Dt=Xv,Yv=Dt,Kv=Array.prototype,Zv=Kv.splice;function Jv(r){var e=this.__data__,t=Yv(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():Zv.call(e,t,1),--this.size,!0}var Qv=Jv,em=Dt;function rm(r){var e=this.__data__,t=em(e,r);return t<0?void 0:e[t][1]}var tm=rm,nm=Dt;function im(r){return nm(this.__data__,r)>-1}var am=im,om=Dt;function um(r,e){var t=this.__data__,n=om(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var sm=um,fm=Wv,cm=Qv,lm=tm,dm=am,pm=sm;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=fm,er.prototype.delete=cm,er.prototype.get=lm,er.prototype.has=dm,er.prototype.set=pm;var Ct=er,hm=Ct;function ym(){this.__data__=new hm,this.size=0}var _m=ym;function gm(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var vm=gm;function mm(r){return this.__data__.get(r)}var wm=mm;function bm(r){return this.__data__.has(r)}var $m=bm,Em=Re,Sm=le,Am=Em(Sm,"Map"),wi=Am,Om=Re,Im=Om(Object,"create"),Nt=Im,$u=Nt;function Pm(){this.__data__=$u?$u(null):{},this.size=0}var xm=Pm;function Tm(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var Fm=Tm,Rm=Nt,Mm="__lodash_hash_undefined__",Dm=Object.prototype,Cm=Dm.hasOwnProperty;function Nm(r){var e=this.__data__;if(Rm){var t=e[r];return t===Mm?void 0:t}return Cm.call(e,r)?e[r]:void 0}var Bm=Nm,qm=Nt,Um=Object.prototype,km=Um.hasOwnProperty;function Lm(r){var e=this.__data__;return qm?e[r]!==void 0:km.call(e,r)}var jm=Lm,Vm=Nt,Gm="__lodash_hash_undefined__";function Hm(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Vm&&e===void 0?Gm:e,this}var Wm=Hm,zm=xm,Xm=Fm,Ym=Bm,Km=jm,Zm=Wm;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=zm,rr.prototype.delete=Xm,rr.prototype.get=Ym,rr.prototype.has=Km,rr.prototype.set=Zm;var Jm=rr,Eu=Jm,Qm=Ct,ew=wi;function rw(){this.size=0,this.__data__={hash:new Eu,map:new(ew||Qm),string:new Eu}}var tw=rw;function nw(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var iw=nw,aw=iw;function ow(r,e){var t=r.__data__;return aw(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Bt=ow,uw=Bt;function sw(r){var e=uw(this,r).delete(r);return this.size-=e?1:0,e}var fw=sw,cw=Bt;function lw(r){return cw(this,r).get(r)}var dw=lw,pw=Bt;function hw(r){return pw(this,r).has(r)}var yw=hw,_w=Bt;function gw(r,e){var t=_w(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var vw=gw,mw=tw,ww=fw,bw=dw,$w=yw,Ew=vw;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=mw,tr.prototype.delete=ww,tr.prototype.get=bw,tr.prototype.has=$w,tr.prototype.set=Ew;var bi=tr,Sw=Ct,Aw=wi,Ow=bi,Iw=200;function Pw(r,e){var t=this.__data__;if(t instanceof Sw){var n=t.__data__;if(!Aw||n.length<Iw-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new Ow(n)}return t.set(r,e),this.size=t.size,this}var xw=Pw,Tw=Ct,Fw=_m,Rw=vm,Mw=wm,Dw=$m,Cw=xw;function nr(r){var e=this.__data__=new Tw(r);this.size=e.size}nr.prototype.clear=Fw,nr.prototype.delete=Rw,nr.prototype.get=Mw,nr.prototype.has=Dw,nr.prototype.set=Cw;var Su=nr,Nw="__lodash_hash_undefined__";function Bw(r){return this.__data__.set(r,Nw),this}var qw=Bw;function Uw(r){return this.__data__.has(r)}var kw=Uw,Lw=bi,jw=qw,Vw=kw;function qt(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Lw;++e<t;)this.add(r[e])}qt.prototype.add=qt.prototype.push=jw,qt.prototype.has=Vw;var Gw=qt;function Hw(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 Ww=Hw;function zw(r,e){return r.has(e)}var Xw=zw,Yw=Gw,Kw=Ww,Zw=Xw,Jw=1,Qw=2;function e0(r,e,t,n,i,a){var o=t&Jw,s=r.length,f=e.length;if(s!=f&&!(o&&f>s))return!1;var d=a.get(r),c=a.get(e);if(d&&c)return d==e&&c==r;var u=-1,l=!0,p=t&Qw?new Yw:void 0;for(a.set(r,e),a.set(e,r);++u<s;){var _=r[u],$=e[u];if(n)var S=o?n($,_,u,e,r,a):n(_,$,u,r,e,a);if(S!==void 0){if(S)continue;l=!1;break}if(p){if(!Kw(e,function(A,E){if(!Zw(p,E)&&(_===A||i(_,A,t,n,a)))return p.push(E)})){l=!1;break}}else if(!(_===$||i(_,$,t,n,a))){l=!1;break}}return a.delete(r),a.delete(e),l}var Au=e0,r0=le,t0=r0.Uint8Array,n0=t0;function i0(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}var a0=i0;function o0(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var u0=o0,Ou=Ot,Iu=n0,s0=Pt,f0=Au,c0=a0,l0=u0,d0=1,p0=2,h0="[object Boolean]",y0="[object Date]",_0="[object Error]",g0="[object Map]",v0="[object Number]",m0="[object RegExp]",w0="[object Set]",b0="[object String]",$0="[object Symbol]",E0="[object ArrayBuffer]",S0="[object DataView]",Pu=Ou?Ou.prototype:void 0,$i=Pu?Pu.valueOf:void 0;function A0(r,e,t,n,i,a,o){switch(t){case S0:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case E0:return!(r.byteLength!=e.byteLength||!a(new Iu(r),new Iu(e)));case h0:case y0:case v0:return s0(+r,+e);case _0:return r.name==e.name&&r.message==e.message;case m0:case b0:return r==e+"";case g0:var s=c0;case w0:var f=n&d0;if(s||(s=l0),r.size!=e.size&&!f)return!1;var d=o.get(r);if(d)return d==e;n|=p0,o.set(r,e);var c=f0(s(r),s(e),n,i,a,o);return o.delete(r),c;case $0:if($i)return $i.call(r)==$i.call(e)}return!1}var O0=A0;function I0(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}var P0=I0,x0=P0,T0=V;function F0(r,e,t){var n=e(r);return T0(r)?n:x0(n,t(r))}var R0=F0;function M0(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 D0=M0;function C0(){return[]}var N0=C0,B0=D0,q0=N0,U0=Object.prototype,k0=U0.propertyIsEnumerable,xu=Object.getOwnPropertySymbols,L0=xu?function(r){return r==null?[]:(r=Object(r),B0(xu(r),function(e){return k0.call(r,e)}))}:q0,j0=L0,V0=R0,G0=j0,H0=Mt;function W0(r){return V0(r,H0,G0)}var z0=W0,Tu=z0,X0=1,Y0=Object.prototype,K0=Y0.hasOwnProperty;function Z0(r,e,t,n,i,a){var o=t&X0,s=Tu(r),f=s.length,d=Tu(e),c=d.length;if(f!=c&&!o)return!1;for(var u=f;u--;){var l=s[u];if(!(o?l in e:K0.call(e,l)))return!1}var p=a.get(r),_=a.get(e);if(p&&_)return p==e&&_==r;var $=!0;a.set(r,e),a.set(e,r);for(var S=o;++u<f;){l=s[u];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 J0=Z0,Q0=Re,eb=le,rb=Q0(eb,"DataView"),tb=rb,nb=Re,ib=le,ab=nb(ib,"Promise"),ob=ab,ub=Re,sb=le,fb=ub(sb,"Set"),cb=fb,lb=Re,db=le,pb=lb(db,"WeakMap"),hb=pb,Ei=tb,Si=wi,Ai=ob,Oi=cb,Ii=hb,Fu=ge,ir=au,Ru="[object Map]",yb="[object Object]",Mu="[object Promise]",Du="[object Set]",Cu="[object WeakMap]",Nu="[object DataView]",_b=ir(Ei),gb=ir(Si),vb=ir(Ai),mb=ir(Oi),wb=ir(Ii),De=Fu;(Ei&&De(new Ei(new ArrayBuffer(1)))!=Nu||Si&&De(new Si)!=Ru||Ai&&De(Ai.resolve())!=Mu||Oi&&De(new Oi)!=Du||Ii&&De(new Ii)!=Cu)&&(De=function(r){var e=Fu(r),t=e==yb?r.constructor:void 0,n=t?ir(t):"";if(n)switch(n){case _b:return Nu;case gb:return Ru;case vb:return Mu;case mb:return Du;case wb:return Cu}return e});var bb=De,Pi=Su,$b=Au,Eb=O0,Sb=J0,Bu=bb,qu=V,Uu=_u,Ab=mu,Ob=1,ku="[object Arguments]",Lu="[object Array]",Ut="[object Object]",Ib=Object.prototype,ju=Ib.hasOwnProperty;function Pb(r,e,t,n,i,a){var o=qu(r),s=qu(e),f=o?Lu:Bu(r),d=s?Lu:Bu(e);f=f==ku?Ut:f,d=d==ku?Ut:d;var c=f==Ut,u=d==Ut,l=f==d;if(l&&Uu(r)){if(!Uu(e))return!1;o=!0,c=!1}if(l&&!c)return a||(a=new Pi),o||Ab(r)?$b(r,e,t,n,i,a):Eb(r,e,f,t,n,i,a);if(!(t&Ob)){var p=c&&ju.call(r,"__wrapped__"),_=u&&ju.call(e,"__wrapped__");if(p||_){var $=p?r.value():r,S=_?e.value():e;return a||(a=new Pi),i($,S,t,n,a)}}return l?(a||(a=new Pi),Sb(r,e,t,n,i,a)):!1}var xb=Pb,Tb=xb,Vu=ve;function Gu(r,e,t,n,i){return r===e?!0:r==null||e==null||!Vu(r)&&!Vu(e)?r!==r&&e!==e:Tb(r,e,t,n,Gu,i)}var Hu=Gu,Fb=Su,Rb=Hu,Mb=1,Db=2;function Cb(r,e,t,n){var i=t.length,a=i,o=!n;if(r==null)return!a;for(r=Object(r);i--;){var s=t[i];if(o&&s[2]?s[1]!==r[s[0]]:!(s[0]in r))return!1}for(;++i<a;){s=t[i];var f=s[0],d=r[f],c=s[1];if(o&&s[2]){if(d===void 0&&!(f in r))return!1}else{var u=new Fb;if(n)var l=n(d,c,f,r,e,u);if(!(l===void 0?Rb(c,d,Mb|Db,n,u):l))return!1}}return!0}var Nb=Cb,Bb=Qe;function qb(r){return r===r&&!Bb(r)}var Wu=qb,Ub=Wu,kb=Mt;function Lb(r){for(var e=kb(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,Ub(i)]}return e}var jb=Lb;function Vb(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}var zu=Vb,Gb=Nb,Hb=jb,Wb=zu;function zb(r){var e=Hb(r);return e.length==1&&e[0][2]?Wb(e[0][0],e[0][1]):function(t){return t===r||Gb(t,r,e)}}var Xb=zb,Yb=ge,Kb=ve,Zb="[object Symbol]";function Jb(r){return typeof r=="symbol"||Kb(r)&&Yb(r)==Zb}var kt=Jb,Qb=V,e1=kt,r1=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,t1=/^\w*$/;function n1(r,e){if(Qb(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||e1(r)?!0:t1.test(r)||!r1.test(r)||e!=null&&r in Object(e)}var xi=n1,Xu=bi,i1="Expected a function";function Ti(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(i1);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(Ti.Cache||Xu),t}Ti.Cache=Xu;var a1=Ti,o1=a1,u1=500;function s1(r){var e=o1(r,function(n){return t.size===u1&&t.clear(),n}),t=e.cache;return e}var f1=s1,c1=f1,l1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,d1=/\\(\\)?/g,p1=c1(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(l1,function(t,n,i,a){e.push(i?a.replace(d1,"$1"):n||t)}),e}),h1=p1;function y1(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 Fi=y1,Yu=Ot,_1=Fi,g1=V,v1=kt,m1=1/0,Ku=Yu?Yu.prototype:void 0,Zu=Ku?Ku.toString:void 0;function Ju(r){if(typeof r=="string")return r;if(g1(r))return _1(r,Ju)+"";if(v1(r))return Zu?Zu.call(r):"";var e=r+"";return e=="0"&&1/r==-m1?"-0":e}var w1=Ju,b1=w1;function $1(r){return r==null?"":b1(r)}var E1=$1,S1=V,A1=xi,O1=h1,I1=E1;function P1(r,e){return S1(r)?r:A1(r,e)?[r]:O1(I1(r))}var Qu=P1,x1=kt,T1=1/0;function F1(r){if(typeof r=="string"||x1(r))return r;var e=r+"";return e=="0"&&1/r==-T1?"-0":e}var Lt=F1,R1=Qu,M1=Lt;function D1(r,e){e=R1(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[M1(e[t++])];return t&&t==n?r:void 0}var es=D1,C1=es;function N1(r,e,t){var n=r==null?void 0:C1(r,e);return n===void 0?t:n}var B1=N1;function q1(r,e){return r!=null&&e in Object(r)}var U1=q1,k1=Qu,L1=yu,j1=V,V1=vi,G1=gi,H1=Lt;function W1(r,e,t){e=k1(e,r);for(var n=-1,i=e.length,a=!1;++n<i;){var o=H1(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&&G1(i)&&V1(o,i)&&(j1(r)||L1(r)))}var z1=W1,X1=U1,Y1=z1;function K1(r,e){return r!=null&&Y1(r,e,X1)}var Z1=K1,J1=Hu,Q1=B1,e$=Z1,r$=xi,t$=Wu,n$=zu,i$=Lt,a$=1,o$=2;function u$(r,e){return r$(r)&&t$(e)?n$(i$(r),e):function(t){var n=Q1(t,r);return n===void 0&&n===e?e$(t,r):J1(e,n,a$|o$)}}var s$=u$;function f$(r){return function(e){return e?.[r]}}var c$=f$,l$=es;function d$(r){return function(e){return l$(e,r)}}var p$=d$,h$=c$,y$=p$,_$=xi,g$=Lt;function v$(r){return _$(r)?h$(g$(r)):y$(r)}var m$=v$,w$=Xb,b$=s$,$$=xt,E$=V,S$=m$;function A$(r){return typeof r=="function"?r:r==null?$$:typeof r=="object"?E$(r)?b$(r[0],r[1]):w$(r):S$(r)}var rs=A$,O$=lv,I$=Gv,P$=rs,x$=V,T$=lu;function F$(r,e,t){var n=x$(r)?O$:I$;return t&&T$(r,e,t)&&(e=void 0),n(r,P$(e))}var Ri=F$;Object.defineProperty(Me,"__esModule",{value:!0}),Me.calculatePadding=C$,Me.slicePadding=N$;var R$=Ri,M$=D$(R$);function D$(r){return r&&r.__esModule?r:{default:r}}function C$(r){switch(r%4){case 0:return 0;case 1:return 3;case 2:return 2;case 3:return 1;default:return null}}function N$(r,e){var t=r.slice(e),n=(0,M$.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 B$=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}}(),q$=Me;function U$(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Mi=function(){function r(e){U$(this,r),e instanceof y||(e=typeof e=="number"?y.alloc(e):y.from(e)),this._setBuffer(e),this.rewind()}return B$(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,q$.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){Mi.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){Mi.prototype[e]=function(n){return this.buffer()[e](n,this.tell()),this.seek("+",r[0]),this}})}),Rt.Cursor=Mi,Object.defineProperty(M,"__esModule",{value:!0}),M.default=W$;var k$=fv,ts=is(k$),L$=yi,j$=is(L$),ns=Rt;function is(r){return r&&r.__esModule?r:{default:r}}var V$=Math.pow(2,16),G$={toXDR:function(e){var t=new ns.Cursor(V$);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 ns.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}}},H$={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 W$(r){(0,ts.default)(r,G$),(0,j$.default)(r)&&(0,ts.default)(r.prototype,H$)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.Int=void 0;var z$=It,as=os(z$),X$=M,Y$=os(X$);function os(r){return r&&r.__esModule?r:{default:r}}var Fr=ce.Int={read:function(e){return e.readInt32BE()},write:function(e,t){if(!(0,as.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,as.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,Y$.default)(Fr);var jt={};function K$(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 us={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 kn=="function"?kn(r):[],o;if(We){o={};for(var s=0;s<a.length;s++)o["$"+a[s]]=a[s]}for(var f in r)fe(r,f)&&(t&&String(Number(f))===f&&f<r.length||We&&o["$"+f]instanceof Symbol||(Qa.call(/[^\w$]/,f)?n.push(e(f,r)+": "+e(r[f],r)):n.push(f+": "+e(r[f],r))));if(typeof kn=="function")for(var d=0;d<a.length;d++)to.call(r,a[d])&&n.push("["+e(a[d])+"]: "+e(r[a[d]],r));return n}var nd=dt,id=Le,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},ad=function(r,e){if(r){var t=ht(r,e);return t&&t.value}},od=function(r,e,t){var n=ht(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},ud=function(r,e){return r?!!ht(r,e):!1},sd=function(r,e){if(r)return ht(r,e,!0)},fd=function(){var e,t={assert:function(n){if(!t.has(n))throw new id("Side channel does not contain "+nd(n))},delete:function(n){var i=e&&e.next,a=sd(e,n);return a&&i&&i===a&&(e=void 0),!!a},get:function(n){return ad(e,n)},has:function(n){return ud(e,n)},set:function(n,i){e||(e={next:void 0}),od(e,n,i)}};return t},yo=Object,cd=Error,ld=EvalError,dd=RangeError,pd=ReferenceError,hd=SyntaxError,yd=URIError,_d=Math.abs,gd=Math.floor,vd=Math.max,md=Math.min,wd=Math.pow,bd=Math.round,$d=Number.isNaN||function(e){return e!==e},Ed=$d,Sd=function(e){return Ed(e)||e===0?e:e<0?-1:1},Ad=Object.getOwnPropertyDescriptor,yt=Ad;if(yt)try{yt([],"length")}catch{yt=null}var _o=yt,_t=Object.defineProperty||!1;if(_t)try{_t({},"a",{value:1})}catch{_t=!1}var Od=_t,Wn,go;function Id(){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 s=Object.getOwnPropertyDescriptor(e,t);if(s.value!==i||s.enumerable!==!0)return!1}return!0}),Wn}var zn,vo;function Pd(){if(vo)return zn;vo=1;var r=typeof Symbol<"u"&&Symbol,e=Id();return zn=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},zn}var Xn,mo;function wo(){return mo||(mo=1,Xn=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Xn}var Yn,bo;function $o(){if(bo)return Yn;bo=1;var r=yo;return Yn=r.getPrototypeOf||null,Yn}var Kn,Eo;function xd(){if(Eo)return Kn;Eo=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=[],u=0;u<f.length;u+=1)c[u]=f[u];for(var l=0;l<d.length;l+=1)c[l+f.length]=d[l];return c},a=function(f,d){for(var c=[],u=d||0,l=0;u<f.length;u+=1,l+=1)c[l]=f[u];return c},o=function(s,f){for(var d="",c=0;c<s.length;c+=1)d+=s[c],c+1<s.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),u,l=function(){if(this instanceof u){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),_=[],$=0;$<p;$++)_[$]="$"+$;if(u=Function("binder","return function ("+o(_,",")+"){ return binder.apply(this,arguments); }")(l),d.prototype){var S=function(){};S.prototype=d.prototype,u.prototype=new S,S.prototype=null}return u},Kn}var Zn,So;function gt(){if(So)return Zn;So=1;var r=xd();return Zn=Function.prototype.bind||r,Zn}var Jn,Ao;function Qn(){return Ao||(Ao=1,Jn=Function.prototype.call),Jn}var ei,Oo;function Io(){return Oo||(Oo=1,ei=Function.prototype.apply),ei}var Td=typeof Reflect<"u"&&Reflect&&Reflect.apply,Fd=gt(),Rd=Io(),Md=Qn(),Dd=Td,Cd=Dd||Fd.call(Md,Rd),Nd=gt(),Bd=Le,qd=Qn(),Ud=Cd,Po=function(e){if(e.length<1||typeof e[0]!="function")throw new Bd("a function is required");return Ud(Nd,qd,e)},ri,xo;function kd(){if(xo)return ri;xo=1;var r=Po,e=_o,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 ri=n&&typeof n.get=="function"?r([n.get]):typeof a=="function"?function(s){return a(s==null?s:i(s))}:!1,ri}var ti,To;function Ld(){if(To)return ti;To=1;var r=wo(),e=$o(),t=kd();return ti=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,ti}var ni,Fo;function jd(){if(Fo)return ni;Fo=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=gt();return ni=t.call(r,e),ni}var x,Vd=yo,Gd=cd,Hd=ld,Wd=dd,zd=pd,ze=hd,Xe=Le,Xd=yd,Yd=_d,Kd=gd,Zd=vd,Jd=md,Qd=wd,ep=bd,rp=Sd,Ro=Function,ii=function(r){try{return Ro('"use strict"; return ('+r+").constructor;")()}catch{}},Er=_o,tp=Od,ai=function(){throw new Xe},np=Er?function(){try{return arguments.callee,ai}catch{try{return Er(arguments,"callee").get}catch{return ai}}}():ai,Ye=Pd()(),U=Ld(),ip=$o(),ap=wo(),Mo=Io(),Sr=Qn(),Ke={},op=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%":Gd,"%eval%":eval,"%EvalError%":Hd,"%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%":Ro,"%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%":Vd,"%Object.getOwnPropertyDescriptor%":Er,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?x:Promise,"%Proxy%":typeof Proxy>"u"?x:Proxy,"%RangeError%":Wd,"%ReferenceError%":zd,"%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%":np,"%TypedArray%":op,"%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%":Xd,"%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%":Mo,"%Object.defineProperty%":tp,"%Object.getPrototypeOf%":ip,"%Math.abs%":Yd,"%Math.floor%":Kd,"%Math.max%":Zd,"%Math.min%":Jd,"%Math.pow%":Qd,"%Math.round%":ep,"%Math.sign%":rp,"%Reflect.getPrototypeOf%":ap};if(U)try{null.error}catch(r){var up=U(U(r));xe["%Error.prototype%"]=up}var sp=function r(e){var t;if(e==="%AsyncFunction%")t=ii("async function () {}");else if(e==="%GeneratorFunction%")t=ii("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=ii("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},Do={__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=gt(),vt=jd(),fp=Ar.call(Sr,Array.prototype.concat),cp=Ar.call(Mo,Array.prototype.splice),Co=Ar.call(Sr,String.prototype.replace),mt=Ar.call(Sr,String.prototype.slice),lp=Ar.call(Sr,RegExp.prototype.exec),dp=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,pp=/\\(\\)?/g,hp=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 Co(e,dp,function(a,o,s,f){i[i.length]=s?Co(f,pp,"$1"):o||a}),i},yp=function(e,t){var n=e,i;if(vt(Do,n)&&(i=Do[n],n="%"+i[0]+"%"),vt(xe,n)){var a=xe[n];if(a===Ke&&(a=sp(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!")},oi=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(lp(/^%?[^%]*%?$/,e)===null)throw new ze("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=hp(e),i=n.length>0?n[0]:"",a=yp("%"+i+"%",t),o=a.name,s=a.value,f=!1,d=a.alias;d&&(i=d[0],cp(n,fp([0,1],d)));for(var c=1,u=!0;c<n.length;c+=1){var l=n[c],p=mt(l,0,1),_=mt(l,-1);if((p==='"'||p==="'"||p==="`"||_==='"'||_==="'"||_==="`")&&p!==_)throw new ze("property names with quotes must have matching quotes");if((l==="constructor"||!u)&&(f=!0),i+="."+l,o="%"+i+"%",vt(xe,o))s=xe[o];else if(s!=null){if(!(l in s)){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(s,l);u=!!$,u&&"get"in $&&!("originalValue"in $.get)?s=$.get:s=s[l]}else u=vt(s,l),s=s[l];u&&!f&&(xe[o]=s)}}return s},No=oi,Bo=Po,_p=Bo([No("%String.prototype.indexOf%")]),qo=function(e,t){var n=No(e,!!t);return typeof n=="function"&&_p(e,".prototype.")>-1?Bo([n]):n},gp=oi,Or=qo,vp=dt,mp=Le,Uo=gp("%Map%",!0),wp=Or("Map.prototype.get",!0),bp=Or("Map.prototype.set",!0),$p=Or("Map.prototype.has",!0),Ep=Or("Map.prototype.delete",!0),Sp=Or("Map.prototype.size",!0),ko=!!Uo&&function(){var e,t={assert:function(n){if(!t.has(n))throw new mp("Side channel does not contain "+vp(n))},delete:function(n){if(e){var i=Ep(e,n);return Sp(e)===0&&(e=void 0),i}return!1},get:function(n){if(e)return wp(e,n)},has:function(n){return e?$p(e,n):!1},set:function(n,i){e||(e=new Uo),bp(e,n,i)}};return t},Ap=oi,wt=qo,Op=dt,bt=ko,Ip=Le,Ze=Ap("%WeakMap%",!0),Pp=wt("WeakMap.prototype.get",!0),xp=wt("WeakMap.prototype.set",!0),Tp=wt("WeakMap.prototype.has",!0),Fp=wt("WeakMap.prototype.delete",!0),Rp=Ze?function(){var e,t,n={assert:function(i){if(!n.has(i))throw new Ip("Side channel does not contain "+Op(i))},delete:function(i){if(Ze&&i&&(typeof i=="object"||typeof i=="function")){if(e)return Fp(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?Pp(e,i):t&&t.get(i)},has:function(i){return Ze&&i&&(typeof i=="object"||typeof i=="function")&&e?Tp(e,i):!!t&&t.has(i)},set:function(i,a){Ze&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Ze),xp(e,i,a)):bt&&(t||(t=bt()),t.set(i,a))}};return n}:bt,Mp=Le,Dp=dt,Cp=fd,Np=ko,Bp=Rp,qp=Bp||Np||Cp,Lo=function(){var e,t={assert:function(n){if(!t.has(n))throw new Mp("Side channel does not contain "+Dp(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=qp()),e.set(n,i)}};return t},Up=String.prototype.replace,kp=/%20/g,ui={RFC1738:"RFC1738",RFC3986:"RFC3986"},jo={default:ui.RFC3986,formatters:{RFC1738:function(r){return Up.call(r,kp,"+")},RFC3986:function(r){return String(r)}},RFC1738:ui.RFC1738,RFC3986:ui.RFC3986},Lp=jo,jp=Lo,si=Object.prototype.hasOwnProperty,Te=Array.isArray,$t=jp(),Vo=function(e,t){return $t.set(e,t),e},Et=function(e){return $t.has(e)},fi=function(e){return $t.get(e)},Go=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}(),Vp=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}}},ci=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},Gp=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=fi(e)+1;e[i]=t,Go(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},s=0;s<a.length;s++){var f=parseInt(a[s],10);o[f+1]=t[a[s]]}return Vo(o,fi(t)+1)}return[e].concat(t)}var d=e;return Te(e)&&!Te(t)&&(d=ci(e,n)),Te(e)&&Te(t)?(t.forEach(function(c,u){if(si.call(e,u)){var l=e[u];l&&typeof l=="object"&&c&&typeof c=="object"?e[u]=r(l,c,n):e.push(c)}else e[u]=c}),e):Object.keys(t).reduce(function(c,u){var l=t[u];return si.call(c,u)?c[u]=r(c[u],l,n):c[u]=l,c},d)},Hp=function(e,t){return Object.keys(t).reduce(function(n,i){return n[i]=t[i],n},e)},Wp=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}},li=1024,zp=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 s="",f=0;f<o.length;f+=li){for(var d=o.length>=li?o.slice(f,f+li):o,c=[],u=0;u<d.length;++u){var l=d.charCodeAt(u);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||a===Lp.RFC1738&&(l===40||l===41)){c[c.length]=d.charAt(u);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}u+=1,l=65536+((l&1023)<<10|d.charCodeAt(u)&1023),c[c.length]=te[240|l>>18]+te[128|l>>12&63]+te[128|l>>6&63]+te[128|l&63]}s+=c.join("")}return s},Xp=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],s=Object.keys(o),f=0;f<s.length;++f){var d=s[f],c=o[d];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(t.push({obj:o,prop:d}),n.push(c))}return Vp(t),e},Yp=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Kp=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Zp=function(e,t,n,i){if(Et(e)){var a=fi(e)+1;return e[a]=t,Go(e,a),e}var o=[].concat(e,t);return o.length>n?Vo(ci(o,{plainObjects:i}),o.length-1):o},Jp=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)},Qp={arrayToObject:ci,assign:Hp,combine:Zp,compact:Xp,decode:Wp,encode:zp,isBuffer:Kp,isOverflow:Et,isRegExp:Yp,maybeMap:Jp,merge:Gp},Ho=Lo,St=Qp,Ir=jo,eh=Object.prototype.hasOwnProperty,Wo={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ne=Array.isArray,rh=Array.prototype.push,zo=function(r,e){rh.apply(r,ne(e)?e:[e])},th=Date.prototype.toISOString,Xo=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:Xo,formatter:Ir.formatters[Xo],indices:!1,serializeDate:function(e){return th.call(e)},skipNulls:!1,strictNullHandling:!1},nh=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},di={},ih=function r(e,t,n,i,a,o,s,f,d,c,u,l,p,_,$,S,A,E){for(var h=e,I=E,T=0,F=!1;(I=I.get(di))!==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(di)>"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(la){return la instanceof Date?p(la):la})),h===null){if(o)return d&&!S?d(t,N.encoder,A,"key",_):t;h=""}if(nh(h)||St.isBuffer(h)){if(d){var g=S?t:d(t,N.encoder,A,"key",_);return[$(g)+"="+$(d(h,N.encoder,A,"value",_))]}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=u?P.sort(u):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],ke=typeof Y=="object"&&Y&&typeof Y.value<"u"?Y.value:h[Y];if(!(s&&ke===null)){var ca=l&&f?String(Y).replace(/\./g,"%2E"):String(Y),gT=ne(h)?typeof n=="function"?n(W,ca):W:W+(l?"."+ca:"["+ca+"]");E.set(e,T);var Zf=Ho();Zf.set(di,E),zo(m,r(ke,gT,n,i,a,o,s,f,n==="comma"&&S&&ne(h)?null:d,c,u,l,p,_,$,S,A,Zf))}}return m},ah=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(!eh.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 Wo?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 s=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:N.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:N.addQueryPrefix,allowDots:s,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}},oh=function(r,e){var t=r,n=ah(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 s=Wo[n.arrayFormat],f=s==="comma"&&n.commaRoundTrip;i||(i=Object.keys(t)),n.sort&&i.sort(n.sort);for(var d=Ho(),c=0;c<i.length;++c){var u=i[c],l=t[u];n.skipNulls&&l===null||zo(o,ih(l,u,s,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),_=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?_+="utf8=%26%2310003%3B&":_+="utf8=%E2%9C%93&"),p.length>0?_+p:""},uh=we(oh);let Yo={storeIdentifier:"",environment:"prod"};function sh(r){Yo=r}function j(){return Yo}const fh=(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`}},ch=(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}},lh=r=>{switch(r){case"prod":case"preprod":return"https://static.rechargecdn.com";case"stage":case"prestage":return"https://static.stage.rechargecdn.com"}},Ko="/tools/recurring";class Je{constructor(e,t){this.name="RechargeRequestError",this.message=e,this.status=t}}function dh(r){return uh(r,{encode:!1,indices:!1,arrayFormat:"comma"})}function v(r,e){return{...r,internalFnCall:r.internalFnCall??e,internalRequestId:r.internalRequestId??_a()}}async function At(r,e,t={}){const n=j();return X(r,`${lh(n.environment)}/store/${n.storeIdentifier}${e}`,t)}async function w(r,e,{id:t,query:n,data:i,headers:a}={},o){const{environment:s,environmentUri:f,storeIdentifier:d,loginRetryFn:c,__unstable_twoFactorRetryFn:u,appName:l,appVersion:p}=j();if(!d)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const _=o.apiToken;if(!_)throw new Error("No API token defined on session.");const $=fh(s,f),S={"X-Recharge-Access-Token":_,"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.78.2","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(u&&E instanceof Je&&E.status===423)return u().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,`${Ko}${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 u;[o,u]=o.split("?");const l=[u,dh(n)].join("&").replace(/^&/,"");o=`${o}${l?`?${l}`:""}`}let s;i&&r!=="get"&&(s=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:s});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 ph(r,e){return w("get","/addresses",{query:e},v(r,"listAddresses"))}async function hh(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 yh(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 pi(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 _h(r,e,t,n){return pi(v(r,"applyDiscountToAddress"),e,{discounts:[{code:t}]},n)}async function gh(r,e,t){if(e===void 0||e==="")throw new Error("Id is required");return pi(v(r,"removeDiscountsFromAddress"),e,{discounts:[]},t)}function vh(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/addresses",{id:e},v(r,"deleteAddress"))}async function mh(r,e){const{address:t}=await w("post","/addresses/merge",{data:e},v(r,"mergeAddresses"));return t}async function wh(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 bh=Object.freeze({__proto__:null,applyDiscountToAddress:_h,createAddress:yh,deleteAddress:vh,getAddress:hh,listAddresses:ph,mergeAddresses:mh,removeDiscountsFromAddress:gh,skipFutureCharge:wh,updateAddress:pi});async function $h(){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 Eh(r,e){return Zo(r,e)}async function Zo(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 Sh(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 Ah(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 Oh(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 Ih(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 Ph(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 xh(){const{customerHash:r}=j(),{pathname:e,search:t}=window.location,n=new URLSearchParams(t).get("token"),i=e.split("/").filter(Boolean),a=i.findIndex(s=>s==="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 Th(){const{customerHash:r,token:e}=xh(),{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:s,storefrontAccessToken:f,appName:d,appVersion:c}=j(),u=ch(o,s),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.78.2",...a||{}};return X(r,`${u}${e}`,{id:t,query:n,data:i,headers:l})}var Fh=Object.freeze({__proto__:null,loginCustomerPortal:Th,loginShopifyApi:Eh,loginShopifyAppProxy:$h,loginWithShopifyCustomerAccount:Sh,loginWithShopifyStorefront:Zo,sendPasswordlessCode:Ah,sendPasswordlessCodeAppProxy:Oh,validatePasswordlessCode:Ih,validatePasswordlessCodeAppProxy:Ph}),Jo={},hi={},ce={},Rh=typeof D=="object"&&D&&D.Object===Object&&D,Qo=Rh,Mh=Qo,Dh=typeof self=="object"&&self&&self.Object===Object&&self,Ch=Mh||Dh||Function("return this")(),le=Ch,Nh=le,Bh=Nh.Symbol,Ot=Bh,eu=Ot,ru=Object.prototype,qh=ru.hasOwnProperty,Uh=ru.toString,xr=eu?eu.toStringTag:void 0;function kh(r){var e=qh.call(r,xr),t=r[xr];try{r[xr]=void 0;var n=!0}catch{}var i=Uh.call(r);return n&&(e?r[xr]=t:delete r[xr]),i}var Lh=kh,jh=Object.prototype,Vh=jh.toString;function Gh(r){return Vh.call(r)}var Hh=Gh,tu=Ot,Wh=Lh,zh=Hh,Xh="[object Null]",Yh="[object Undefined]",nu=tu?tu.toStringTag:void 0;function Kh(r){return r==null?r===void 0?Yh:Xh:nu&&nu in Object(r)?Wh(r):zh(r)}var ge=Kh;function Zh(r){return r!=null&&typeof r=="object"}var ve=Zh,Jh=ge,Qh=ve,ey="[object Number]";function ry(r){return typeof r=="number"||Qh(r)&&Jh(r)==ey}var It=ry,M={};function ty(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var Qe=ty,ny=ge,iy=Qe,ay="[object AsyncFunction]",oy="[object Function]",uy="[object GeneratorFunction]",sy="[object Proxy]";function fy(r){if(!iy(r))return!1;var e=ny(r);return e==oy||e==uy||e==ay||e==sy}var yi=fy,cy=le,ly=cy["__core-js_shared__"],dy=ly,_i=dy,iu=function(){var r=/[^.]+$/.exec(_i&&_i.keys&&_i.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function py(r){return!!iu&&iu in r}var hy=py,yy=Function.prototype,_y=yy.toString;function gy(r){if(r!=null){try{return _y.call(r)}catch{}try{return r+""}catch{}}return""}var au=gy,vy=yi,my=hy,wy=Qe,by=au,$y=/[\\^$.*+?()[\]{}|]/g,Ey=/^\[object .+?Constructor\]$/,Sy=Function.prototype,Ay=Object.prototype,Oy=Sy.toString,Iy=Ay.hasOwnProperty,Py=RegExp("^"+Oy.call(Iy).replace($y,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xy(r){if(!wy(r)||my(r))return!1;var e=vy(r)?Py:Ey;return e.test(by(r))}var Ty=xy;function Fy(r,e){return r?.[e]}var Ry=Fy,My=Ty,Dy=Ry;function Cy(r,e){var t=Dy(r,e);return My(t)?t:void 0}var Re=Cy,Ny=Re,By=function(){try{var r=Ny(Object,"defineProperty");return r({},"",{}),r}catch{}}(),ou=By,uu=ou;function qy(r,e,t){e=="__proto__"&&uu?uu(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var su=qy;function Uy(r,e){return r===e||r!==r&&e!==e}var Pt=Uy,ky=su,Ly=Pt,jy=Object.prototype,Vy=jy.hasOwnProperty;function Gy(r,e,t){var n=r[e];(!(Vy.call(r,e)&&Ly(n,t))||t===void 0&&!(e in r))&&ky(r,e,t)}var Hy=Gy,Wy=Hy,zy=su;function Xy(r,e,t,n){var i=!t;t||(t={});for(var a=-1,o=e.length;++a<o;){var s=e[a],f=n?n(t[s],r[s],s,t,r):void 0;f===void 0&&(f=r[s]),i?zy(t,s,f):Wy(t,s,f)}return t}var Yy=Xy;function Ky(r){return r}var xt=Ky;function Zy(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 Jy=Zy,Qy=Jy,fu=Math.max;function e_(r,e,t){return e=fu(e===void 0?r.length-1:e,0),function(){for(var n=arguments,i=-1,a=fu(n.length-e,0),o=Array(a);++i<a;)o[i]=n[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=n[i];return s[e]=t(o),Qy(r,this,s)}}var r_=e_;function t_(r){return function(){return r}}var n_=t_,i_=n_,cu=ou,a_=xt,o_=cu?function(r,e){return cu(r,"toString",{configurable:!0,enumerable:!1,value:i_(e),writable:!0})}:a_,u_=o_,s_=800,f_=16,c_=Date.now;function l_(r){var e=0,t=0;return function(){var n=c_(),i=f_-(n-t);if(t=n,i>0){if(++e>=s_)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}var d_=l_,p_=u_,h_=d_,y_=h_(p_),__=y_,g_=xt,v_=r_,m_=__;function w_(r,e){return m_(v_(r,e,g_),r+"")}var b_=w_,$_=9007199254740991;function E_(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=$_}var gi=E_,S_=yi,A_=gi;function O_(r){return r!=null&&A_(r.length)&&!S_(r)}var Tr=O_,I_=9007199254740991,P_=/^(?:0|[1-9]\d*)$/;function x_(r,e){var t=typeof r;return e=e??I_,!!e&&(t=="number"||t!="symbol"&&P_.test(r))&&r>-1&&r%1==0&&r<e}var vi=x_,T_=Pt,F_=Tr,R_=vi,M_=Qe;function D_(r,e,t){if(!M_(t))return!1;var n=typeof e;return(n=="number"?F_(t)&&R_(e,t.length):n=="string"&&e in t)?T_(t[e],r):!1}var lu=D_,C_=b_,N_=lu;function B_(r){return C_(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&&N_(t[0],t[1],o)&&(a=i<3?void 0:a,i=1),e=Object(e);++n<i;){var s=t[n];s&&r(e,s,n,a)}return e})}var q_=B_;function U_(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var du=U_,k_=ge,L_=ve,j_="[object Arguments]";function V_(r){return L_(r)&&k_(r)==j_}var G_=V_,pu=G_,H_=ve,hu=Object.prototype,W_=hu.hasOwnProperty,z_=hu.propertyIsEnumerable,X_=pu(function(){return arguments}())?pu:function(r){return H_(r)&&W_.call(r,"callee")&&!z_.call(r,"callee")},yu=X_,Y_=Array.isArray,V=Y_,Tt={exports:{}};function K_(){return!1}var Z_=K_;Tt.exports,function(r,e){var t=le,n=Z_,i=e&&!e.nodeType&&e,a=i&&!0&&r&&!r.nodeType&&r,o=a&&a.exports===i,s=o?t.Buffer:void 0,f=s?s.isBuffer:void 0,d=f||n;r.exports=d}(Tt,Tt.exports);var _u=Tt.exports,J_=ge,Q_=gi,eg=ve,rg="[object Arguments]",tg="[object Array]",ng="[object Boolean]",ig="[object Date]",ag="[object Error]",og="[object Function]",ug="[object Map]",sg="[object Number]",fg="[object Object]",cg="[object RegExp]",lg="[object Set]",dg="[object String]",pg="[object WeakMap]",hg="[object ArrayBuffer]",yg="[object DataView]",_g="[object Float32Array]",gg="[object Float64Array]",vg="[object Int8Array]",mg="[object Int16Array]",wg="[object Int32Array]",bg="[object Uint8Array]",$g="[object Uint8ClampedArray]",Eg="[object Uint16Array]",Sg="[object Uint32Array]",R={};R[_g]=R[gg]=R[vg]=R[mg]=R[wg]=R[bg]=R[$g]=R[Eg]=R[Sg]=!0,R[rg]=R[tg]=R[hg]=R[ng]=R[yg]=R[ig]=R[ag]=R[og]=R[ug]=R[sg]=R[fg]=R[cg]=R[lg]=R[dg]=R[pg]=!1;function Ag(r){return eg(r)&&Q_(r.length)&&!!R[J_(r)]}var Og=Ag;function Ig(r){return function(e){return r(e)}}var Pg=Ig,Ft={exports:{}};Ft.exports,function(r,e){var t=Qo,n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,o=a&&t.process,s=function(){try{var f=i&&i.require&&i.require("util").types;return f||o&&o.binding&&o.binding("util")}catch{}}();r.exports=s}(Ft,Ft.exports);var xg=Ft.exports,Tg=Og,Fg=Pg,gu=xg,vu=gu&&gu.isTypedArray,Rg=vu?Fg(vu):Tg,mu=Rg,Mg=du,Dg=yu,Cg=V,Ng=_u,Bg=vi,qg=mu,Ug=Object.prototype,kg=Ug.hasOwnProperty;function Lg(r,e){var t=Cg(r),n=!t&&Dg(r),i=!t&&!n&&Ng(r),a=!t&&!n&&!i&&qg(r),o=t||n||i||a,s=o?Mg(r.length,String):[],f=s.length;for(var d in r)(e||kg.call(r,d))&&!(o&&(d=="length"||i&&(d=="offset"||d=="parent")||a&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||Bg(d,f)))&&s.push(d);return s}var wu=Lg,jg=Object.prototype;function Vg(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||jg;return r===t}var bu=Vg;function Gg(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var Hg=Gg,Wg=Qe,zg=bu,Xg=Hg,Yg=Object.prototype,Kg=Yg.hasOwnProperty;function Zg(r){if(!Wg(r))return Xg(r);var e=zg(r),t=[];for(var n in r)n=="constructor"&&(e||!Kg.call(r,n))||t.push(n);return t}var Jg=Zg,Qg=wu,ev=Jg,rv=Tr;function tv(r){return rv(r)?Qg(r,!0):ev(r)}var nv=tv,iv=Yy,av=q_,ov=nv,uv=av(function(r,e){iv(e,ov(e),r)}),sv=uv,fv=sv,Rt={},Me={};function cv(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 lv=cv;function dv(r){return function(e,t,n){for(var i=-1,a=Object(e),o=n(e),s=o.length;s--;){var f=o[r?s:++i];if(t(a[f],f,a)===!1)break}return e}}var pv=dv,hv=pv,yv=hv(),_v=yv;function gv(r,e){return function(t){return r(e(t))}}var vv=gv,mv=vv,wv=mv(Object.keys,Object),bv=wv,$v=bu,Ev=bv,Sv=Object.prototype,Av=Sv.hasOwnProperty;function Ov(r){if(!$v(r))return Ev(r);var e=[];for(var t in Object(r))Av.call(r,t)&&t!="constructor"&&e.push(t);return e}var Iv=Ov,Pv=wu,xv=Iv,Tv=Tr;function Fv(r){return Tv(r)?Pv(r):xv(r)}var Mt=Fv,Rv=_v,Mv=Mt;function Dv(r,e){return r&&Rv(r,e,Mv)}var Cv=Dv,Nv=Tr;function Bv(r,e){return function(t,n){if(t==null)return t;if(!Nv(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 qv=Bv,Uv=Cv,kv=qv,Lv=kv(Uv),mi=Lv,jv=mi;function Vv(r,e){var t=!0;return jv(r,function(n,i,a){return t=!!e(n,i,a),t}),t}var Gv=Vv;function Hv(){this.__data__=[],this.size=0}var Wv=Hv,zv=Pt;function Xv(r,e){for(var t=r.length;t--;)if(zv(r[t][0],e))return t;return-1}var Dt=Xv,Yv=Dt,Kv=Array.prototype,Zv=Kv.splice;function Jv(r){var e=this.__data__,t=Yv(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():Zv.call(e,t,1),--this.size,!0}var Qv=Jv,em=Dt;function rm(r){var e=this.__data__,t=em(e,r);return t<0?void 0:e[t][1]}var tm=rm,nm=Dt;function im(r){return nm(this.__data__,r)>-1}var am=im,om=Dt;function um(r,e){var t=this.__data__,n=om(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var sm=um,fm=Wv,cm=Qv,lm=tm,dm=am,pm=sm;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=fm,er.prototype.delete=cm,er.prototype.get=lm,er.prototype.has=dm,er.prototype.set=pm;var Ct=er,hm=Ct;function ym(){this.__data__=new hm,this.size=0}var _m=ym;function gm(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var vm=gm;function mm(r){return this.__data__.get(r)}var wm=mm;function bm(r){return this.__data__.has(r)}var $m=bm,Em=Re,Sm=le,Am=Em(Sm,"Map"),wi=Am,Om=Re,Im=Om(Object,"create"),Nt=Im,$u=Nt;function Pm(){this.__data__=$u?$u(null):{},this.size=0}var xm=Pm;function Tm(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var Fm=Tm,Rm=Nt,Mm="__lodash_hash_undefined__",Dm=Object.prototype,Cm=Dm.hasOwnProperty;function Nm(r){var e=this.__data__;if(Rm){var t=e[r];return t===Mm?void 0:t}return Cm.call(e,r)?e[r]:void 0}var Bm=Nm,qm=Nt,Um=Object.prototype,km=Um.hasOwnProperty;function Lm(r){var e=this.__data__;return qm?e[r]!==void 0:km.call(e,r)}var jm=Lm,Vm=Nt,Gm="__lodash_hash_undefined__";function Hm(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Vm&&e===void 0?Gm:e,this}var Wm=Hm,zm=xm,Xm=Fm,Ym=Bm,Km=jm,Zm=Wm;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=zm,rr.prototype.delete=Xm,rr.prototype.get=Ym,rr.prototype.has=Km,rr.prototype.set=Zm;var Jm=rr,Eu=Jm,Qm=Ct,ew=wi;function rw(){this.size=0,this.__data__={hash:new Eu,map:new(ew||Qm),string:new Eu}}var tw=rw;function nw(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var iw=nw,aw=iw;function ow(r,e){var t=r.__data__;return aw(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Bt=ow,uw=Bt;function sw(r){var e=uw(this,r).delete(r);return this.size-=e?1:0,e}var fw=sw,cw=Bt;function lw(r){return cw(this,r).get(r)}var dw=lw,pw=Bt;function hw(r){return pw(this,r).has(r)}var yw=hw,_w=Bt;function gw(r,e){var t=_w(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var vw=gw,mw=tw,ww=fw,bw=dw,$w=yw,Ew=vw;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=mw,tr.prototype.delete=ww,tr.prototype.get=bw,tr.prototype.has=$w,tr.prototype.set=Ew;var bi=tr,Sw=Ct,Aw=wi,Ow=bi,Iw=200;function Pw(r,e){var t=this.__data__;if(t instanceof Sw){var n=t.__data__;if(!Aw||n.length<Iw-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new Ow(n)}return t.set(r,e),this.size=t.size,this}var xw=Pw,Tw=Ct,Fw=_m,Rw=vm,Mw=wm,Dw=$m,Cw=xw;function nr(r){var e=this.__data__=new Tw(r);this.size=e.size}nr.prototype.clear=Fw,nr.prototype.delete=Rw,nr.prototype.get=Mw,nr.prototype.has=Dw,nr.prototype.set=Cw;var Su=nr,Nw="__lodash_hash_undefined__";function Bw(r){return this.__data__.set(r,Nw),this}var qw=Bw;function Uw(r){return this.__data__.has(r)}var kw=Uw,Lw=bi,jw=qw,Vw=kw;function qt(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Lw;++e<t;)this.add(r[e])}qt.prototype.add=qt.prototype.push=jw,qt.prototype.has=Vw;var Gw=qt;function Hw(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 Ww=Hw;function zw(r,e){return r.has(e)}var Xw=zw,Yw=Gw,Kw=Ww,Zw=Xw,Jw=1,Qw=2;function e0(r,e,t,n,i,a){var o=t&Jw,s=r.length,f=e.length;if(s!=f&&!(o&&f>s))return!1;var d=a.get(r),c=a.get(e);if(d&&c)return d==e&&c==r;var u=-1,l=!0,p=t&Qw?new Yw:void 0;for(a.set(r,e),a.set(e,r);++u<s;){var _=r[u],$=e[u];if(n)var S=o?n($,_,u,e,r,a):n(_,$,u,r,e,a);if(S!==void 0){if(S)continue;l=!1;break}if(p){if(!Kw(e,function(A,E){if(!Zw(p,E)&&(_===A||i(_,A,t,n,a)))return p.push(E)})){l=!1;break}}else if(!(_===$||i(_,$,t,n,a))){l=!1;break}}return a.delete(r),a.delete(e),l}var Au=e0,r0=le,t0=r0.Uint8Array,n0=t0;function i0(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}var a0=i0;function o0(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var u0=o0,Ou=Ot,Iu=n0,s0=Pt,f0=Au,c0=a0,l0=u0,d0=1,p0=2,h0="[object Boolean]",y0="[object Date]",_0="[object Error]",g0="[object Map]",v0="[object Number]",m0="[object RegExp]",w0="[object Set]",b0="[object String]",$0="[object Symbol]",E0="[object ArrayBuffer]",S0="[object DataView]",Pu=Ou?Ou.prototype:void 0,$i=Pu?Pu.valueOf:void 0;function A0(r,e,t,n,i,a,o){switch(t){case S0:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case E0:return!(r.byteLength!=e.byteLength||!a(new Iu(r),new Iu(e)));case h0:case y0:case v0:return s0(+r,+e);case _0:return r.name==e.name&&r.message==e.message;case m0:case b0:return r==e+"";case g0:var s=c0;case w0:var f=n&d0;if(s||(s=l0),r.size!=e.size&&!f)return!1;var d=o.get(r);if(d)return d==e;n|=p0,o.set(r,e);var c=f0(s(r),s(e),n,i,a,o);return o.delete(r),c;case $0:if($i)return $i.call(r)==$i.call(e)}return!1}var O0=A0;function I0(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}var P0=I0,x0=P0,T0=V;function F0(r,e,t){var n=e(r);return T0(r)?n:x0(n,t(r))}var R0=F0;function M0(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 D0=M0;function C0(){return[]}var N0=C0,B0=D0,q0=N0,U0=Object.prototype,k0=U0.propertyIsEnumerable,xu=Object.getOwnPropertySymbols,L0=xu?function(r){return r==null?[]:(r=Object(r),B0(xu(r),function(e){return k0.call(r,e)}))}:q0,j0=L0,V0=R0,G0=j0,H0=Mt;function W0(r){return V0(r,H0,G0)}var z0=W0,Tu=z0,X0=1,Y0=Object.prototype,K0=Y0.hasOwnProperty;function Z0(r,e,t,n,i,a){var o=t&X0,s=Tu(r),f=s.length,d=Tu(e),c=d.length;if(f!=c&&!o)return!1;for(var u=f;u--;){var l=s[u];if(!(o?l in e:K0.call(e,l)))return!1}var p=a.get(r),_=a.get(e);if(p&&_)return p==e&&_==r;var $=!0;a.set(r,e),a.set(e,r);for(var S=o;++u<f;){l=s[u];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 J0=Z0,Q0=Re,eb=le,rb=Q0(eb,"DataView"),tb=rb,nb=Re,ib=le,ab=nb(ib,"Promise"),ob=ab,ub=Re,sb=le,fb=ub(sb,"Set"),cb=fb,lb=Re,db=le,pb=lb(db,"WeakMap"),hb=pb,Ei=tb,Si=wi,Ai=ob,Oi=cb,Ii=hb,Fu=ge,ir=au,Ru="[object Map]",yb="[object Object]",Mu="[object Promise]",Du="[object Set]",Cu="[object WeakMap]",Nu="[object DataView]",_b=ir(Ei),gb=ir(Si),vb=ir(Ai),mb=ir(Oi),wb=ir(Ii),De=Fu;(Ei&&De(new Ei(new ArrayBuffer(1)))!=Nu||Si&&De(new Si)!=Ru||Ai&&De(Ai.resolve())!=Mu||Oi&&De(new Oi)!=Du||Ii&&De(new Ii)!=Cu)&&(De=function(r){var e=Fu(r),t=e==yb?r.constructor:void 0,n=t?ir(t):"";if(n)switch(n){case _b:return Nu;case gb:return Ru;case vb:return Mu;case mb:return Du;case wb:return Cu}return e});var bb=De,Pi=Su,$b=Au,Eb=O0,Sb=J0,Bu=bb,qu=V,Uu=_u,Ab=mu,Ob=1,ku="[object Arguments]",Lu="[object Array]",Ut="[object Object]",Ib=Object.prototype,ju=Ib.hasOwnProperty;function Pb(r,e,t,n,i,a){var o=qu(r),s=qu(e),f=o?Lu:Bu(r),d=s?Lu:Bu(e);f=f==ku?Ut:f,d=d==ku?Ut:d;var c=f==Ut,u=d==Ut,l=f==d;if(l&&Uu(r)){if(!Uu(e))return!1;o=!0,c=!1}if(l&&!c)return a||(a=new Pi),o||Ab(r)?$b(r,e,t,n,i,a):Eb(r,e,f,t,n,i,a);if(!(t&Ob)){var p=c&&ju.call(r,"__wrapped__"),_=u&&ju.call(e,"__wrapped__");if(p||_){var $=p?r.value():r,S=_?e.value():e;return a||(a=new Pi),i($,S,t,n,a)}}return l?(a||(a=new Pi),Sb(r,e,t,n,i,a)):!1}var xb=Pb,Tb=xb,Vu=ve;function Gu(r,e,t,n,i){return r===e?!0:r==null||e==null||!Vu(r)&&!Vu(e)?r!==r&&e!==e:Tb(r,e,t,n,Gu,i)}var Hu=Gu,Fb=Su,Rb=Hu,Mb=1,Db=2;function Cb(r,e,t,n){var i=t.length,a=i,o=!n;if(r==null)return!a;for(r=Object(r);i--;){var s=t[i];if(o&&s[2]?s[1]!==r[s[0]]:!(s[0]in r))return!1}for(;++i<a;){s=t[i];var f=s[0],d=r[f],c=s[1];if(o&&s[2]){if(d===void 0&&!(f in r))return!1}else{var u=new Fb;if(n)var l=n(d,c,f,r,e,u);if(!(l===void 0?Rb(c,d,Mb|Db,n,u):l))return!1}}return!0}var Nb=Cb,Bb=Qe;function qb(r){return r===r&&!Bb(r)}var Wu=qb,Ub=Wu,kb=Mt;function Lb(r){for(var e=kb(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,Ub(i)]}return e}var jb=Lb;function Vb(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}var zu=Vb,Gb=Nb,Hb=jb,Wb=zu;function zb(r){var e=Hb(r);return e.length==1&&e[0][2]?Wb(e[0][0],e[0][1]):function(t){return t===r||Gb(t,r,e)}}var Xb=zb,Yb=ge,Kb=ve,Zb="[object Symbol]";function Jb(r){return typeof r=="symbol"||Kb(r)&&Yb(r)==Zb}var kt=Jb,Qb=V,e1=kt,r1=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,t1=/^\w*$/;function n1(r,e){if(Qb(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||e1(r)?!0:t1.test(r)||!r1.test(r)||e!=null&&r in Object(e)}var xi=n1,Xu=bi,i1="Expected a function";function Ti(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(i1);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(Ti.Cache||Xu),t}Ti.Cache=Xu;var a1=Ti,o1=a1,u1=500;function s1(r){var e=o1(r,function(n){return t.size===u1&&t.clear(),n}),t=e.cache;return e}var f1=s1,c1=f1,l1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,d1=/\\(\\)?/g,p1=c1(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(l1,function(t,n,i,a){e.push(i?a.replace(d1,"$1"):n||t)}),e}),h1=p1;function y1(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 Fi=y1,Yu=Ot,_1=Fi,g1=V,v1=kt,m1=1/0,Ku=Yu?Yu.prototype:void 0,Zu=Ku?Ku.toString:void 0;function Ju(r){if(typeof r=="string")return r;if(g1(r))return _1(r,Ju)+"";if(v1(r))return Zu?Zu.call(r):"";var e=r+"";return e=="0"&&1/r==-m1?"-0":e}var w1=Ju,b1=w1;function $1(r){return r==null?"":b1(r)}var E1=$1,S1=V,A1=xi,O1=h1,I1=E1;function P1(r,e){return S1(r)?r:A1(r,e)?[r]:O1(I1(r))}var Qu=P1,x1=kt,T1=1/0;function F1(r){if(typeof r=="string"||x1(r))return r;var e=r+"";return e=="0"&&1/r==-T1?"-0":e}var Lt=F1,R1=Qu,M1=Lt;function D1(r,e){e=R1(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[M1(e[t++])];return t&&t==n?r:void 0}var es=D1,C1=es;function N1(r,e,t){var n=r==null?void 0:C1(r,e);return n===void 0?t:n}var B1=N1;function q1(r,e){return r!=null&&e in Object(r)}var U1=q1,k1=Qu,L1=yu,j1=V,V1=vi,G1=gi,H1=Lt;function W1(r,e,t){e=k1(e,r);for(var n=-1,i=e.length,a=!1;++n<i;){var o=H1(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&&G1(i)&&V1(o,i)&&(j1(r)||L1(r)))}var z1=W1,X1=U1,Y1=z1;function K1(r,e){return r!=null&&Y1(r,e,X1)}var Z1=K1,J1=Hu,Q1=B1,e$=Z1,r$=xi,t$=Wu,n$=zu,i$=Lt,a$=1,o$=2;function u$(r,e){return r$(r)&&t$(e)?n$(i$(r),e):function(t){var n=Q1(t,r);return n===void 0&&n===e?e$(t,r):J1(e,n,a$|o$)}}var s$=u$;function f$(r){return function(e){return e?.[r]}}var c$=f$,l$=es;function d$(r){return function(e){return l$(e,r)}}var p$=d$,h$=c$,y$=p$,_$=xi,g$=Lt;function v$(r){return _$(r)?h$(g$(r)):y$(r)}var m$=v$,w$=Xb,b$=s$,$$=xt,E$=V,S$=m$;function A$(r){return typeof r=="function"?r:r==null?$$:typeof r=="object"?E$(r)?b$(r[0],r[1]):w$(r):S$(r)}var rs=A$,O$=lv,I$=Gv,P$=rs,x$=V,T$=lu;function F$(r,e,t){var n=x$(r)?O$:I$;return t&&T$(r,e,t)&&(e=void 0),n(r,P$(e))}var Ri=F$;Object.defineProperty(Me,"__esModule",{value:!0}),Me.calculatePadding=C$,Me.slicePadding=N$;var R$=Ri,M$=D$(R$);function D$(r){return r&&r.__esModule?r:{default:r}}function C$(r){switch(r%4){case 0:return 0;case 1:return 3;case 2:return 2;case 3:return 1;default:return null}}function N$(r,e){var t=r.slice(e),n=(0,M$.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 B$=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}}(),q$=Me;function U$(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Mi=function(){function r(e){U$(this,r),e instanceof y||(e=typeof e=="number"?y.alloc(e):y.from(e)),this._setBuffer(e),this.rewind()}return B$(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,q$.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){Mi.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){Mi.prototype[e]=function(n){return this.buffer()[e](n,this.tell()),this.seek("+",r[0]),this}})}),Rt.Cursor=Mi,Object.defineProperty(M,"__esModule",{value:!0}),M.default=W$;var k$=fv,ts=is(k$),L$=yi,j$=is(L$),ns=Rt;function is(r){return r&&r.__esModule?r:{default:r}}var V$=Math.pow(2,16),G$={toXDR:function(e){var t=new ns.Cursor(V$);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 ns.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}}},H$={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 W$(r){(0,ts.default)(r,G$),(0,j$.default)(r)&&(0,ts.default)(r.prototype,H$)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.Int=void 0;var z$=It,as=os(z$),X$=M,Y$=os(X$);function os(r){return r&&r.__esModule?r:{default:r}}var Fr=ce.Int={read:function(e){return e.readInt32BE()},write:function(e,t){if(!(0,as.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,as.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,Y$.default)(Fr);var jt={};function K$(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 us={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 K$=="function"&&r&&r.exports?r.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(D,function(){function e(c,u,l){this.low=c|0,this.high=u|0,this.unsigned=!!l}e.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=function(u){return(u&&u.__isLong__)===!0};var t={},n={};e.fromInt=function(u,l){var p,_;return l?(u=u>>>0,0<=u&&u<256&&(_=n[u],_)?_:(p=new e(u,(u|0)<0?-1:0,!0),0<=u&&u<256&&(n[u]=p),p)):(u=u|0,-128<=u&&u<128&&(_=t[u],_)?_:(p=new e(u,u<0?-1:0,!1),-128<=u&&u<128&&(t[u]=p),p))},e.fromNumber=function(u,l){return l=!!l,isNaN(u)||!isFinite(u)?e.ZERO:!l&&u<=-f?e.MIN_VALUE:!l&&u+1>=f?e.MAX_VALUE:l&&u>=s?e.MAX_UNSIGNED_VALUE:u<0?e.fromNumber(-u,l).negate():new e(u%o|0,u/o|0,l)},e.fromBits=function(u,l,p){return new e(u,l,p)},e.fromString=function(u,l,p){if(u.length===0)throw Error("number format error: empty string");if(u==="NaN"||u==="Infinity"||u==="+Infinity"||u==="-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 _;if((_=u.indexOf("-"))>0)throw Error('number format error: interior "-" character: '+u);if(_===0)return e.fromString(u.substring(1),l,p).negate();for(var $=e.fromNumber(Math.pow(p,8)),S=e.ZERO,A=0;A<u.length;A+=8){var E=Math.min(8,u.length-A),h=parseInt(u.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(u){return u instanceof e?u:typeof u=="number"?e.fromNumber(u):typeof u=="string"?e.fromString(u):new e(u.low,u.high,u.unsigned)};var i=65536,a=1<<24,o=i*i,s=o*o,f=s/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(u){if(u=u||10,u<2||36<u)throw RangeError("radix out of range: "+u);if(this.isZero())return"0";var l;if(this.isNegative())if(this.equals(e.MIN_VALUE)){var p=e.fromNumber(u),_=this.divide(p);return l=_.multiply(p).subtract(this),_.toString(u)+l.toInt().toString(u)}else return"-"+this.negate().toString(u);var $=e.fromNumber(Math.pow(u,6),this.unsigned);l=this;for(var S="";;){var A=l.divide($),E=l.subtract(A.multiply($)).toInt()>>>0,h=E.toString(u);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 u=this.high!=0?this.high:this.low,l=31;l>0&&!(u&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(u){return e.isLong(u)||(u=e.fromValue(u)),this.unsigned!==u.unsigned&&this.high>>>31===1&&u.high>>>31===1?!1:this.high===u.high&&this.low===u.low},e.eq=e.prototype.equals,e.prototype.notEquals=function(u){return!this.equals(u)},e.neq=e.prototype.notEquals,e.prototype.lessThan=function(u){return this.compare(u)<0},e.prototype.lt=e.prototype.lessThan,e.prototype.lessThanOrEqual=function(u){return this.compare(u)<=0},e.prototype.lte=e.prototype.lessThanOrEqual,e.prototype.greaterThan=function(u){return this.compare(u)>0},e.prototype.gt=e.prototype.greaterThan,e.prototype.greaterThanOrEqual=function(u){return this.compare(u)>=0},e.prototype.gte=e.prototype.greaterThanOrEqual,e.prototype.compare=function(u){if(e.isLong(u)||(u=e.fromValue(u)),this.equals(u))return 0;var l=this.isNegative(),p=u.isNegative();return l&&!p?-1:!l&&p?1:this.unsigned?u.high>>>0>this.high>>>0||u.high===this.high&&u.low>>>0>this.low>>>0?-1:1:this.subtract(u).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(u){e.isLong(u)||(u=e.fromValue(u));var l=this.high>>>16,p=this.high&65535,_=this.low>>>16,$=this.low&65535,S=u.high>>>16,A=u.high&65535,E=u.low>>>16,h=u.low&65535,I=0,T=0,F=0,b=0;return b+=$+h,F+=b>>>16,b&=65535,F+=_+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(u){return e.isLong(u)||(u=e.fromValue(u)),this.add(u.negate())},e.prototype.sub=e.prototype.subtract,e.prototype.multiply=function(u){if(this.isZero()||(e.isLong(u)||(u=e.fromValue(u)),u.isZero()))return e.ZERO;if(this.equals(e.MIN_VALUE))return u.isOdd()?e.MIN_VALUE:e.ZERO;if(u.equals(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return u.isNegative()?this.negate().multiply(u.negate()):this.negate().multiply(u).negate();if(u.isNegative())return this.multiply(u.negate()).negate();if(this.lessThan(d)&&u.lessThan(d))return e.fromNumber(this.toNumber()*u.toNumber(),this.unsigned);var l=this.high>>>16,p=this.high&65535,_=this.low>>>16,$=this.low&65535,S=u.high>>>16,A=u.high&65535,E=u.low>>>16,h=u.low&65535,I=0,T=0,F=0,b=0;return b+=$*h,F+=b>>>16,b&=65535,F+=_*h,T+=F>>>16,F&=65535,F+=$*E,T+=F>>>16,F&=65535,T+=p*h,I+=T>>>16,T&=65535,T+=_*E,I+=T>>>16,T&=65535,T+=$*A,I+=T>>>16,T&=65535,I+=l*h+p*E+_*A+$*S,I&=65535,e.fromBits(F<<16|b,I<<16|T,this.unsigned)},e.prototype.mul=e.prototype.multiply,e.prototype.divide=function(u){if(e.isLong(u)||(u=e.fromValue(u)),u.isZero())throw new Error("division by zero");if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var l,p,_;if(this.equals(e.MIN_VALUE)){if(u.equals(e.ONE)||u.equals(e.NEG_ONE))return e.MIN_VALUE;if(u.equals(e.MIN_VALUE))return e.ONE;var $=this.shiftRight(1);return l=$.divide(u).shiftLeft(1),l.equals(e.ZERO)?u.isNegative()?e.ONE:e.NEG_ONE:(p=this.subtract(u.multiply(l)),_=l.add(p.divide(u)),_)}else if(u.equals(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return u.isNegative()?this.negate().divide(u.negate()):this.negate().divide(u).negate();if(u.isNegative())return this.divide(u.negate()).negate();for(_=e.ZERO,p=this;p.greaterThanOrEqual(u);){l=Math.max(1,Math.floor(p.toNumber()/u.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(u);h.isNegative()||h.greaterThan(p);)l-=A,E=e.fromNumber(l,this.unsigned),h=E.multiply(u);E.isZero()&&(E=e.ONE),_=_.add(E),p=p.subtract(h)}return _},e.prototype.div=e.prototype.divide,e.prototype.modulo=function(u){return e.isLong(u)||(u=e.fromValue(u)),this.subtract(this.divide(u).multiply(u))},e.prototype.mod=e.prototype.modulo,e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.and=function(u){return e.isLong(u)||(u=e.fromValue(u)),e.fromBits(this.low&u.low,this.high&u.high,this.unsigned)},e.prototype.or=function(u){return e.isLong(u)||(u=e.fromValue(u)),e.fromBits(this.low|u.low,this.high|u.high,this.unsigned)},e.prototype.xor=function(u){return e.isLong(u)||(u=e.fromValue(u)),e.fromBits(this.low^u.low,this.high^u.high,this.unsigned)},e.prototype.shiftLeft=function(u){return e.isLong(u)&&(u=u.toInt()),(u&=63)===0?this:u<32?e.fromBits(this.low<<u,this.high<<u|this.low>>>32-u,this.unsigned):e.fromBits(0,this.low<<u-32,this.unsigned)},e.prototype.shl=e.prototype.shiftLeft,e.prototype.shiftRight=function(u){return e.isLong(u)&&(u=u.toInt()),(u&=63)===0?this:u<32?e.fromBits(this.low>>>u|this.high<<32-u,this.high>>u,this.unsigned):e.fromBits(this.high>>u-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=e.prototype.shiftRight,e.prototype.shiftRightUnsigned=function(u){if(e.isLong(u)&&(u=u.toInt()),u&=63,u===0)return this;var l=this.high;if(u<32){var p=this.low;return e.fromBits(p>>>u|l<<32-u,l>>>u,this.unsigned)}else return u===32?e.fromBits(l,0,this.unsigned):e.fromBits(l>>>u-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})})(us);var ss=us.exports;Object.defineProperty(jt,"__esModule",{value:!0}),jt.Hyper=void 0;var Z$=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}}(),fs=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)}},J$=ss,Rr=cs(J$),Q$=M,eE=cs(Q$);function cs(r){return r&&r.__esModule?r:{default:r}}function rE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function tE(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 nE(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){nE(e,r),Z$(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=fs(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=fs(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 rE(this,e),tE(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!1))}return e}(Rr.default);(0,eE.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 iE=It,ls=ds(iE),aE=M,oE=ds(aE);function ds(r){return r&&r.__esModule?r:{default:r}}var Dr=Ce.UnsignedInt={read:function(e){return e.readUInt32BE()},write:function(e,t){if(!(0,ls.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,ls.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,oE.default)(Dr);var Vt={};Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.UnsignedHyper=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}}(),ps=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)}},sE=ss,Cr=hs(sE),fE=M,cE=hs(fE);function hs(r){return r&&r.__esModule?r:{default:r}}function lE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function dE(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 pE(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){pE(e,r),uE(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=ps(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=ps(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 lE(this,e),dE(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!0))}return e}(Cr.default);(0,cE.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 hE=It,ys=_s(hE),yE=M,_E=_s(yE);function _s(r){return r&&r.__esModule?r:{default:r}}var gE=Gt.Float={read:function(e){return e.readFloatBE()},write:function(e,t){if(!(0,ys.default)(e))throw new Error("XDR Write Error: not a number");t.writeFloatBE(e)},isValid:function(e){return(0,ys.default)(e)}};(0,_E.default)(gE);var Ht={};Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.Double=void 0;var vE=It,gs=vs(vE),mE=M,wE=vs(mE);function vs(r){return r&&r.__esModule?r:{default:r}}var bE=Ht.Double={read:function(e){return e.readDoubleBE()},write:function(e,t){if(!(0,gs.default)(e))throw new Error("XDR Write Error: not a number");t.writeDoubleBE(e)},isValid:function(e){return(0,gs.default)(e)}};(0,wE.default)(bE);var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.Quadruple=void 0;var $E=M,EE=SE($E);function SE(r){return r&&r.__esModule?r:{default:r}}var AE=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,EE.default)(AE);var Br={},OE=ge,IE=ve,PE="[object Boolean]";function xE(r){return r===!0||r===!1||IE(r)&&OE(r)==PE}var TE=xE;Object.defineProperty(Br,"__esModule",{value:!0}),Br.Bool=void 0;var FE=TE,RE=ws(FE),ms=ce,ME=M,DE=ws(ME);function ws(r){return r&&r.__esModule?r:{default:r}}var CE=Br.Bool={read:function(e){var t=ms.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 ms.Int.write(n,t)},isValid:function(e){return(0,RE.default)(e)}};(0,DE.default)(CE);var zt={},NE=ge,BE=V,qE=ve,UE="[object String]";function kE(r){return typeof r=="string"||!BE(r)&&qE(r)&&NE(r)==UE}var bs=kE;Object.defineProperty(zt,"__esModule",{value:!0}),zt.String=void 0;var LE=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}}(),jE=bs,$s=Di(jE),VE=V,GE=Di(VE),Es=ce,HE=Ce,Ss=Me,WE=M,zE=Di(WE);function Di(r){return r&&r.__esModule?r:{default:r}}function XE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var YE=zt.String=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:HE.UnsignedInt.MAX_VALUE;XE(this,r),this._maxLength=e}return LE(r,[{key:"read",value:function(t){var n=Es.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,Ss.calculatePadding)(n),a=t.slice(n);return(0,Ss.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,$s.default)(t)?i=y.from(t,"utf8"):i=y.from(t),Es.Int.write(i.length,n),n.writeBufferPadded(i)}},{key:"isValid",value:function(t){var n=void 0;if((0,$s.default)(t))n=y.from(t,"utf8");else if((0,GE.default)(t)||y.isBuffer(t))n=y.from(t);else return!1;return n.length<=this._maxLength}}]),r}();(0,zE.default)(YE.prototype);var Xt={};Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.Opaque=void 0;var KE=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}}(),As=Me,ZE=M,JE=QE(ZE);function QE(r){return r&&r.__esModule?r:{default:r}}function eS(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var rS=Xt.Opaque=function(){function r(e){eS(this,r),this._length=e,this._padding=(0,As.calculatePadding)(e)}return KE(r,[{key:"read",value:function(t){var n=t.slice(this._length);return(0,As.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,JE.default)(rS.prototype);var Yt={};Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.VarOpaque=void 0;var tS=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}}(),Os=ce,nS=Ce,Is=Me,iS=M,aS=oS(iS);function oS(r){return r&&r.__esModule?r:{default:r}}function uS(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var sS=Yt.VarOpaque=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:nS.UnsignedInt.MAX_VALUE;uS(this,r),this._maxLength=e}return tS(r,[{key:"read",value:function(t){var n=Os.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,Is.calculatePadding)(n),a=t.slice(n);return(0,Is.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));Os.Int.write(t.length,n),n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length<=this._maxLength}}]),r}();(0,aS.default)(sS.prototype);var Kt={};function fS(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}var cS=fS,lS=xt;function dS(r){return typeof r=="function"?r:lS}var Ps=dS,pS=cS,hS=mi,yS=Ps,_S=V;function gS(r,e){var t=_S(r)?pS:hS;return t(r,yS(e))}var vS=gS,ar=vS,mS=/\s/;function wS(r){for(var e=r.length;e--&&mS.test(r.charAt(e)););return e}var bS=wS,$S=bS,ES=/^\s+/;function SS(r){return r&&r.slice(0,$S(r)+1).replace(ES,"")}var AS=SS,OS=AS,xs=Qe,IS=kt,Ts=0/0,PS=/^[-+]0x[0-9a-f]+$/i,xS=/^0b[01]+$/i,TS=/^0o[0-7]+$/i,FS=parseInt;function RS(r){if(typeof r=="number")return r;if(IS(r))return Ts;if(xs(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=xs(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=OS(r);var t=xS.test(r);return t||TS.test(r)?FS(r.slice(2),t?2:8):PS.test(r)?Ts:+r}var MS=RS,DS=MS,Fs=1/0,CS=17976931348623157e292;function NS(r){if(!r)return r===0?r:0;if(r=DS(r),r===Fs||r===-Fs){var e=r<0?-1:1;return e*CS}return r===r?r:0}var BS=NS,qS=BS;function US(r){var e=qS(r),t=e%1;return e===e?t?e-t:e:0}var kS=US,LS=du,jS=Ps,VS=kS,GS=9007199254740991,Ci=4294967295,HS=Math.min;function WS(r,e){if(r=VS(r),r<1||r>GS)return[];var t=Ci,n=HS(r,Ci);e=jS(e),r-=Ci;for(var i=LS(n,e);++t<r;)e(t);return i}var Rs=WS;Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.Array=void 0;var zS=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}}(),XS=Ri,YS=qr(XS),KS=ar,ZS=qr(KS),JS=Rs,QS=qr(JS),eA=V,Ms=qr(eA),rA=M,tA=qr(rA);function qr(r){return r&&r.__esModule?r:{default:r}}function nA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var iA=Kt.Array=function(){function r(e,t){nA(this,r),this._childType=e,this._length=t}return zS(r,[{key:"read",value:function(t){var n=this;return(0,QS.default)(this._length,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,Ms.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,ZS.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,Ms.default)(t)||t.length!==this._length?!1:(0,YS.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,tA.default)(iA.prototype);var Zt={};Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.VarArray=void 0;var aA=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}}(),oA=Ri,uA=Ur(oA),sA=ar,fA=Ur(sA),cA=Rs,lA=Ur(cA),dA=V,Ds=Ur(dA),pA=Ce,Cs=ce,hA=M,yA=Ur(hA);function Ur(r){return r&&r.__esModule?r:{default:r}}function _A(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var gA=Zt.VarArray=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pA.UnsignedInt.MAX_VALUE;_A(this,r),this._childType=e,this._maxLength=t}return aA(r,[{key:"read",value:function(t){var n=this,i=Cs.Int.read(t);if(i>this._maxLength)throw new Error("XDR Read Error: Saw "+i+" length VarArray,"+("max allowed is "+this._maxLength));return(0,lA.default)(i,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,Ds.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));Cs.Int.write(t.length,n),(0,fA.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,Ds.default)(t)||t.length>this._maxLength?!1:(0,uA.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,yA.default)(gA.prototype);var Jt={};function vA(r){return r===null}var mA=vA;function wA(r){return r===void 0}var kr=wA;Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.Option=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}}(),$A=mA,Ns=Ni($A),EA=kr,Bs=Ni(EA),qs=Br,SA=M,AA=Ni(SA);function Ni(r){return r&&r.__esModule?r:{default:r}}function OA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var IA=Jt.Option=function(){function r(e){OA(this,r),this._childType=e}return bA(r,[{key:"read",value:function(t){if(qs.Bool.read(t))return this._childType.read(t)}},{key:"write",value:function(t,n){var i=!((0,Ns.default)(t)||(0,Bs.default)(t));qs.Bool.write(i,n),i&&this._childType.write(t,n)}},{key:"isValid",value:function(t){return(0,Ns.default)(t)||(0,Bs.default)(t)?!0:this._childType.isValid(t)}}]),r}();(0,AA.default)(IA.prototype);var Lr={};Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.Void=void 0;var PA=kr,Us=ks(PA),xA=M,TA=ks(xA);function ks(r){return r&&r.__esModule?r:{default:r}}var FA=Lr.Void={read:function(){},write:function(e){if(!(0,Us.default)(e))throw new Error("XDR Write Error: trying to write value to a void slot")},isValid:function(e){return(0,Us.default)(e)}};(0,TA.default)(FA);var Qt={},RA=Fi;function MA(r,e){return RA(e,function(t){return r[t]})}var DA=MA,CA=DA,NA=Mt;function BA(r){return r==null?[]:CA(r,NA(r))}var qA=BA;Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.Enum=void 0;var UA=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}}(),kA=ar,LA=Bi(kA),jA=qA,VA=Bi(jA),Ls=ce,GA=M,HA=Bi(GA);function Bi(r){return r&&r.__esModule?r:{default:r}}function WA(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 zA(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 js(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var XA=Qt.Enum=function(){function r(e,t){js(this,r),this.name=e,this.value=t}return UA(r,null,[{key:"read",value:function(t){var n=Ls.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);Ls.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,VA.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){zA(s,o);function s(){return js(this,s),WA(this,(s.__proto__||Object.getPrototypeOf(s)).apply(this,arguments))}return s}(r);return a.enumName=n,t.results[n]=a,a._members={},a._byValue=new Map,(0,LA.default)(i,function(o,s){var f=new a(s,o);a._members[s]=f,a._byValue.set(o,f),a[s]=function(){return f}}),a}}]),r}();(0,HA.default)(XA);var en={},YA=mi,KA=Tr;function ZA(r,e){var t=-1,n=KA(r)?Array(r.length):[];return YA(r,function(i,a,o){n[++t]=e(i,a,o)}),n}var JA=ZA,QA=Fi,eO=rs,rO=JA,tO=V;function nO(r,e){var t=tO(r)?QA:rO;return t(r,eO(e))}var iO=nO;function aO(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 oO=aO,jr={};Object.defineProperty(jr,"__esModule",{value:!0});var uO=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 sO(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}jr.Reference=function(){function r(){sO(this,r)}return uO(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 s=e[Symbol.iterator](),f;!(i=(f=s.next()).done)&&(n.push(f.value),!(t&&n.length===t));i=!0);}catch(d){a=!0,o=d}finally{try{!i&&s.return&&s.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")}}(),fO=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}}(),cO=ar,Vs=Vr(cO),lO=iO,dO=Vr(lO),pO=kr,hO=Vr(pO),yO=oO,_O=Vr(yO),gO=jr,vO=M,mO=Vr(vO);function Vr(r){return r&&r.__esModule?r:{default:r}}function wO(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 bO(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 Gs(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var $O=en.Struct=function(){function r(e){Gs(this,r),this._attributes=e||{}}return fO(r,null,[{key:"read",value:function(t){var n=(0,dO.default)(this._fields,function(i){var a=rn(i,2),o=a[0],s=a[1],f=s.read(t);return[o,f]});return new this((0,_O.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,Vs.default)(this._fields,function(i){var a=rn(i,2),o=a[0],s=a[1],f=t._attributes[o];s.write(f,n)})}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(o){bO(s,o);function s(){return Gs(this,s),wO(this,(s.__proto__||Object.getPrototypeOf(s)).apply(this,arguments))}return s}(r);return a.structName=n,t.results[n]=a,a._fields=i.map(function(o){var s=rn(o,2),f=s[0],d=s[1];return d instanceof gO.Reference&&(d=d.resolve(t)),[f,d]}),(0,Vs.default)(a._fields,function(o){var s=rn(o,1),f=s[0];a.prototype[f]=EO(f)}),a}}]),r}();(0,mO.default)($O);function EO(r){return function(t){return(0,hO.default)(t)||(this._attributes[r]=t),this._attributes[r]}}var tn={};Object.defineProperty(tn,"__esModule",{value:!0}),tn.Union=void 0;var SO=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var s=e[Symbol.iterator](),f;!(i=(f=s.next()).done)&&(n.push(f.value),!(t&&n.length===t));i=!0);}catch(d){a=!0,o=d}finally{try{!i&&s.return&&s.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")}}(),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}}(),OO=ar,nn=on(OO),IO=kr,Hs=on(IO),PO=bs,Ws=on(PO),an=Lr,qi=jr,xO=M,TO=on(xO);function on(r){return r&&r.__esModule?r:{default:r}}function FO(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 RO(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 zs(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var MO=tn.Union=function(){function r(e,t){zs(this,r),this.set(e,t)}return AO(r,[{key:"set",value:function(t,n){(0,Ws.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,Hs.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(s){RO(f,s);function f(){return zs(this,f),FO(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}return f}(r);a.unionName=n,t.results[n]=a,i.switchOn instanceof qi.Reference?a._switchOn=i.switchOn.resolve(t):a._switchOn=i.switchOn,a._switches=new Map,a._arms={},(0,nn.default)(i.arms,function(s,f){s instanceof qi.Reference&&(s=s.resolve(t)),a._arms[f]=s});var o=i.defaultArm;return o instanceof qi.Reference&&(o=o.resolve(t)),a._defaultArm=o,(0,nn.default)(i.switches,function(s){var f=SO(s,2),d=f[0],c=f[1];(0,Ws.default)(d)&&(d=a._switchOn.fromName(d)),a._switches.set(d,c)}),(0,Hs.default)(a._switchOn.values)||(0,nn.default)(a._switchOn.values(),function(s){a[s.name]=function(f){return new a(s,f)},a.prototype[s.name]=function(d){return this.set(s,d)}}),(0,nn.default)(a._arms,function(s,f){s!==an.Void&&(a.prototype[f]=function(){return this.get(f)})}),a}}]),r}();(0,TO.default)(MO),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 s=Wt;Object.keys(s).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return s[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 u=Yt;Object.keys(u).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return u[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 _=Jt;Object.keys(_).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return _[h]}})});var $=Lr;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]}})})}(hi);var Xs={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=function(){function b(g,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(g,P.key,P)}}return function(g,m,O){return m&&b(g.prototype,m),O&&b(g,O),g}}(),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=_;var n=kr,i=c(n),a=ar,o=c(a),s=hi,f=d(s);function d(b){if(b&&b.__esModule)return b;var g={};if(b!=null)for(var m in b)Object.prototype.hasOwnProperty.call(b,m)&&(g[m]=b[m]);return g.default=b,g}function c(b){return b&&b.__esModule?b:{default:b}}function u(b,g){if(!(b instanceof g))throw new TypeError("Cannot call a class as a function")}function l(b,g){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g&&(typeof g=="object"||typeof g=="function")?g:b}function p(b,g){if(typeof g!="function"&&g!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof g);b.prototype=Object.create(g&&g.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),g&&(Object.setPrototypeOf?Object.setPrototypeOf(b,g):b.__proto__=g)}function _(b){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(b){var m=new F(g);b(m),m.resolve()}return g}var $=function(b){p(g,b);function g(m){u(this,g);var O=l(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return O.name=m,O}return e(g,[{key:"resolve",value:function(O){var P=O.definitions[this.name];return P.resolve(O)}}]),g}(t.Reference),S=function(b){p(g,b);function g(m,O){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;u(this,g);var B=l(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return B.childReference=m,B.length=O,B.variable=P,B}return e(g,[{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)}}]),g}(t.Reference),A=function(b){p(g,b);function g(m){u(this,g);var O=l(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return O.childReference=m,O.name=m.name,O}return e(g,[{key:"resolve",value:function(O){var P=this.childReference;return P instanceof t.Reference&&(P=P.resolve(O)),new f.Option(P)}}]),g}(t.Reference),E=function(b){p(g,b);function g(m,O){u(this,g);var P=l(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return P.sizedType=m,P.length=O,P}return e(g,[{key:"resolve",value:function(O){var P=this.length;return P instanceof t.Reference&&(P=P.resolve(O)),new this.sizedType(P)}}]),g}(t.Reference),h=function(){function b(g,m,O){u(this,b),this.constructor=g,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,g,m){return m instanceof t.Reference&&(m=m.resolve(b)),b.results[g]=m,m}function T(b,g,m){return b.results[g]=m,m}var F=function(){function b(g){u(this,b),this._destination=g,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}()})(Xs),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=hi;Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[n]}})});var t=Xs;Object.keys(t).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[n]}})})}(Jo);var Ui=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)},L=(r,e,t)=>(Ui(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)},ki=(r,e,t,n)=>(Ui(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),me=(r,e,t)=>(Ui(r,e,"access private method"),t),ie,ae,Gr,Li,Ys,ji,Ks,un,Vi,or,Hr;function DO(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=Jo.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 CO{constructor(e,t){Ne(this,Li),Ne(this,ji),Ne(this,un),Ne(this,or),Ne(this,ie,void 0),Ne(this,ae,void 0),Ne(this,Gr,void 0),ki(this,ie,me(this,Li,Ys).call(this,t)),ki(this,Gr,me(this,ji,Ks).call(this,t)),ki(this,ae,e)}isInitialDataValid(){if(!L(this,Gr))throw"Bundle data does not exist for the given product.";if(!L(this,ie))throw"Bundle settings do not exist for the given product.";if(!Array.isArray(L(this,ae))||!L(this,ae).length)throw"No bundle selection items provided.";return!0}isValidVariant(e){if(!L(this,ie)?.variantsSettings[e])throw`The ${e} bundle variant is invalid.`;return!0}isSelectionInVariantRange(e){const t=L(this,ae).reduce((i,a)=>i+a.quantity,0),n=L(this,ie)?.variantsSettings[e].ranges||[];if(!me(this,un,Vi).call(this,n,t))throw"The total number of products does not fall within the required variant range.";return!0}areItemsInMaxPerItemBound(){const e=L(this,ie)?.bundleSettings.maxPerItem||0,t=L(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=L(this,ie)?.variantsSettings[e],n=L(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=L(this,ae).reduce((a,o)=>(a[o.collectionId]=o.quantity+(a[o.collectionId]||0),a),{}),n=L(this,ie)?.variantsSettings[e],i=Object.values(n?.optionSources||{}).filter(a=>{const o=t[a.collectionId]||0;return!me(this,un,Vi).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=L(this,ie)?.variantsSettings[e]?.optionSources||{},n=Object.values(t).reduce((a,o)=>{const s=L(this,Gr)?.collections[o.collectionId];return s&&(a[o.collectionId]=s),a},{});if(!Object.values(n).length)throw`No collections found for the bundle variant (${e}).`;const i=L(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,Ys=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}},ji=new WeakSet,Ks=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}},un=new WeakSet,Vi=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 NO="/bundling-storefront-manager";function Zs(r){return DO({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 BO(r){const e=j(),t=await Gi(r);if(t!==!0)throw new Error(t);const n=Zs(r);try{const i=await Fe("post",`${NO}/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 qO(r,e){const t=await Gi(e);if(t!==!0)throw new Error(t);const n=Zs(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 UO(r,e){const t=Js(r);if(t!==!0)throw new Error(`Dynamic Bundle is invalid. ${t}`);const n=`${_a(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 Gi(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 kO(r){try{const e=await Fe("get",`/bundle-data/${r.externalProductId}`);return{valid:new CO(r.selections,e).isBundleSelectionValid(r.externalVariantId)}}catch(e){return{valid:!1,error:String(e)}}}const LO={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 Js(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=LO[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 jO(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 VO(r,e){return w("get","/bundle_selections",{query:e},v(r,"listBundleSelections"))}async function GO(r,e){const{bundle_selection:t}=await w("post","/bundle_selections",{data:e},v(r,"createBundleSelection"));return t}async function HO(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 WO(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 zO(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 XO=Object.freeze({__proto__:null,createBundleSelection:GO,deleteBundleSelection:WO,getBundleId:BO,getBundleSelection:jO,getBundleSelectionId:qO,getDynamicBundleItems:UO,listBundleSelections:VO,updateBundle:zO,updateBundleSelection:HO,validateBundle:Gi,validateBundleSelection:kO,validateDynamicBundle:Js});const YO=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}}},KO=r=>r.tiered_discounts.length===0?null:{tiered_discounts:r.tiered_discounts.map(e=>({eligible_charge_types:e.eligible_charge_types,eligible_line_item_types:e.eligible_line_item_types,external_bundle_product_id:{ecommerce:e.external_bundle_product_id.ecommerce},lookup_key:e.lookup_key,name:e.name,status:e.status,tiers:e.tiers.map(({tier:t})=>({tier:{lookup_key:t.lookup_key,discount_type:t.discount_type,discount_value:t.discount_value,condition_quantity_gte:t.condition_quantity_gte}}))}))},sn=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}))}),Qs=r=>({name:r.name,options:r.options.map(e=>({name:e.name,values:e.values})),selling_plans:r.selling_plans.map(sn)}),ef=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}),Hi=r=>r==null||typeof r=="string"?r:"src"in r?r.src:null,rf=r=>({id:String(r.id),title:r.title,description:r.description,available_for_sale:r.available,featured_image:Hi(r.featured_image),images:r.images,requires_selling_plan:r.requires_selling_plan,selling_plan_groups:r.selling_plan_groups.map(Qs)}),tf=r=>{const e=JO(r.selling_plan_groups);return{...rf(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=>({...ef(t),selling_plan_allocations:t.selling_plan_allocations.map(n=>({price:n.price,compare_at_price:n.compare_at_price,selling_plan:sn(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:Hi(t.featured_image),public_title:t.public_title,requires_selling_plan:t.requires_selling_plan}))}},ZO=({items_count:r,ranges:e})=>e.length>0?e.map(({quantity_max:t,quantity_min:n})=>({min:n,max:t})):[{min:r,max:r}],JO=r=>r.reduce((e,t)=>(t.selling_plans.forEach(n=>{const i=`${t.id}-${n.id}`;e[i]=n}),e),{}),QO=r=>Array.isArray(r)?r:[];function Wi(r){const e=YO(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:sn(o.selling_plan)})),ranges:ZO(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:Hi(o.variant.featured_image),sku:o.sku||""}})),position:i}}),selling_plan_groups:r.selling_plan_groups.map(Qs),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(tf)}),n),{}),addons:r.addons.products.length?{collection_id:e.addons?.collection_id||"",collection_handle:e.addons?.collection_handle||"",products:r.addons.products.map(n=>({...rf(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=>({...ef(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:sn(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(tf)}:null,incentives:KO(r.incentives),filters:QO(r.filters)}}async function eI(r,e){return e?.source==="shopify_storefront"?tI():rI(r,e?.country_code)}async function rI(r,e){const{appName:t,appVersion:n}=j(),i={"X-Recharge-Sdk-Fn":"loadFromOnlineStore","X-Recharge-Sdk-Version":"1.78.1",...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 Wi(o)}const a=new FormData;a.append("form_type","localization"),a.append("_method","put"),a.append("return_to",`${Ko}/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 Wi(o)}catch{const o=await Fe("get",`/bundle-data/${r}`,{headers:i});return Wi(o)}}async function tI(r,e){if(!j().storeIdentifier)throw new Error("Store identifier is required for Shopify Storefront API requests");return{}}var nI=Object.freeze({__proto__:null,loadBundleData:eI}),iI=200,zi="__lodash_hash_undefined__",aI=1/0,nf=9007199254740991,oI="[object Arguments]",uI="[object Function]",sI="[object GeneratorFunction]",fI="[object Symbol]",cI=/[\\^$.*+?()[\]{}|]/g,lI=/^\[object .+?Constructor\]$/,dI=/^(?:0|[1-9]\d*)$/,pI=typeof D=="object"&&D&&D.Object===Object&&D,hI=typeof self=="object"&&self&&self.Object===Object&&self,Xi=pI||hI||Function("return this")();function yI(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 _I(r,e){var t=r?r.length:0;return!!t&&mI(r,e,0)>-1}function gI(r,e,t){for(var n=-1,i=r?r.length:0;++n<i;)if(t(e,r[n]))return!0;return!1}function af(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 Yi(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}function vI(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 mI(r,e,t){if(e!==e)return vI(r,wI,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function wI(r){return r!==r}function bI(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}function $I(r){return function(e){return r(e)}}function EI(r,e){return r.has(e)}function SI(r,e){return r?.[e]}function AI(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function of(r,e){return function(t){return r(e(t))}}var OI=Array.prototype,II=Function.prototype,fn=Object.prototype,Ki=Xi["__core-js_shared__"],uf=function(){var r=/[^.]+$/.exec(Ki&&Ki.keys&&Ki.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),sf=II.toString,ur=fn.hasOwnProperty,Zi=fn.toString,PI=RegExp("^"+sf.call(ur).replace(cI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ff=Xi.Symbol,xI=of(Object.getPrototypeOf,Object),TI=fn.propertyIsEnumerable,FI=OI.splice,cf=ff?ff.isConcatSpreadable:void 0,Ji=Object.getOwnPropertySymbols,lf=Math.max,RI=pf(Xi,"Map"),Wr=pf(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 MI(){this.__data__=Wr?Wr(null):{}}function DI(r){return this.has(r)&&delete this.__data__[r]}function CI(r){var e=this.__data__;if(Wr){var t=e[r];return t===zi?void 0:t}return ur.call(e,r)?e[r]:void 0}function NI(r){var e=this.__data__;return Wr?e[r]!==void 0:ur.call(e,r)}function BI(r,e){var t=this.__data__;return t[r]=Wr&&e===void 0?zi:e,this}Be.prototype.clear=MI,Be.prototype.delete=DI,Be.prototype.get=CI,Be.prototype.has=NI,Be.prototype.set=BI;function sr(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 qI(){this.__data__=[]}function UI(r){var e=this.__data__,t=ln(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():FI.call(e,t,1),!0}function kI(r){var e=this.__data__,t=ln(e,r);return t<0?void 0:e[t][1]}function LI(r){return ln(this.__data__,r)>-1}function jI(r,e){var t=this.__data__,n=ln(t,r);return n<0?t.push([r,e]):t[n][1]=e,this}sr.prototype.clear=qI,sr.prototype.delete=UI,sr.prototype.get=kI,sr.prototype.has=LI,sr.prototype.set=jI;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 VI(){this.__data__={hash:new Be,map:new(RI||sr),string:new Be}}function GI(r){return dn(this,r).delete(r)}function HI(r){return dn(this,r).get(r)}function WI(r){return dn(this,r).has(r)}function zI(r,e){return dn(this,r).set(r,e),this}fr.prototype.clear=VI,fr.prototype.delete=GI,fr.prototype.get=HI,fr.prototype.has=WI,fr.prototype.set=zI;function cn(r){var e=-1,t=r?r.length:0;for(this.__data__=new fr;++e<t;)this.add(r[e])}function XI(r){return this.__data__.set(r,zi),this}function YI(r){return this.__data__.has(r)}cn.prototype.add=cn.prototype.push=XI,cn.prototype.has=YI;function KI(r,e){var t=Qi(r)||hf(r)?bI(r.length,String):[],n=t.length,i=!!n;for(var a in r)(e||ur.call(r,a))&&!(i&&(a=="length"||sP(a,n)))&&t.push(a);return t}function ln(r,e){for(var t=r.length;t--;)if(yP(r[t][0],e))return t;return-1}function ZI(r,e,t,n){var i=-1,a=_I,o=!0,s=r.length,f=[],d=e.length;if(!s)return f;t&&(e=af(e,$I(t))),n?(a=gI,o=!1):e.length>=iI&&(a=EI,o=!1,e=new cn(e));e:for(;++i<s;){var c=r[i],u=t?t(c):c;if(c=n||c!==0?c:0,o&&u===u){for(var l=d;l--;)if(e[l]===u)continue e;f.push(c)}else a(e,u,n)||f.push(c)}return f}function df(r,e,t,n,i){var a=-1,o=r.length;for(t||(t=uP),i||(i=[]);++a<o;){var s=r[a];e>0&&t(s)?e>1?df(s,e-1,t,n,i):Yi(i,s):n||(i[i.length]=s)}return i}function JI(r,e,t){var n=e(r);return Qi(r)?n:Yi(n,t(r))}function QI(r){if(!ea(r)||cP(r))return!1;var e=_f(r)||AI(r)?PI:lI;return e.test(hP(r))}function eP(r){if(!ea(r))return dP(r);var e=lP(r),t=[];for(var n in r)n=="constructor"&&(e||!ur.call(r,n))||t.push(n);return t}function rP(r,e){return r=Object(r),tP(r,e,function(t,n){return n in r})}function tP(r,e,t){for(var n=-1,i=e.length,a={};++n<i;){var o=e[n],s=r[o];t(s,o)&&(a[o]=s)}return a}function nP(r,e){return e=lf(e===void 0?r.length-1:e,0),function(){for(var t=arguments,n=-1,i=lf(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,yI(r,this,o)}}function iP(r){return JI(r,mP,oP)}function dn(r,e){var t=r.__data__;return fP(e)?t[typeof e=="string"?"string":"hash"]:t.map}function pf(r,e){var t=SI(r,e);return QI(t)?t:void 0}var aP=Ji?of(Ji,Object):vf,oP=Ji?function(r){for(var e=[];r;)Yi(e,aP(r)),r=xI(r);return e}:vf;function uP(r){return Qi(r)||hf(r)||!!(cf&&r&&r[cf])}function sP(r,e){return e=e??nf,!!e&&(typeof r=="number"||dI.test(r))&&r>-1&&r%1==0&&r<e}function fP(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function cP(r){return!!uf&&uf in r}function lP(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||fn;return r===t}function dP(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}function pP(r){if(typeof r=="string"||vP(r))return r;var e=r+"";return e=="0"&&1/r==-aI?"-0":e}function hP(r){if(r!=null){try{return sf.call(r)}catch{}try{return r+""}catch{}}return""}function yP(r,e){return r===e||r!==r&&e!==e}function hf(r){return _P(r)&&ur.call(r,"callee")&&(!TI.call(r,"callee")||Zi.call(r)==oI)}var Qi=Array.isArray;function yf(r){return r!=null&&gP(r.length)&&!_f(r)}function _P(r){return gf(r)&&yf(r)}function _f(r){var e=ea(r)?Zi.call(r):"";return e==uI||e==sI}function gP(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=nf}function ea(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function gf(r){return!!r&&typeof r=="object"}function vP(r){return typeof r=="symbol"||gf(r)&&Zi.call(r)==fI}function mP(r){return yf(r)?KI(r,!0):eP(r)}var wP=nP(function(r,e){return r==null?{}:(e=af(df(e,1),pP),rP(r,ZI(iP(r),e)))});function vf(){return[]}var bP=wP,ra=we(bP);function $P(r){try{return JSON.parse(r)}catch{return r}}function EP(r){return Object.entries(r).reduce((e,[t,n])=>({...e,[t]:$P(n)}),{})}const mf=r=>typeof r=="string"?r!=="0"&&r!=="false":!!r;function wf(r){const e=EP(r),t=e.auto_inject===void 0?!0:e.auto_inject,n=e.display_on??[],i=e.first_option==="autodeliver";return{...ra(e,["display_on","first_option"]),auto_inject:t,valid_pages:n,is_subscription_first:i,autoInject:t,validPages:n,isSubscriptionFirst:i}}function bf(r){const e=r.subscription_options?.storefront_purchase_options==="subscription_only";return{...r,is_subscription_only:e,isSubscriptionOnly:e}}function SP(r){return r.map(e=>{const t={};return Object.entries(e).forEach(([n,i])=>{t[n]=bf(i)}),t})}const ta="2020-12",AP={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 na(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"?bf(n):n}async function $f(){return await pn("storeSettings",()=>At("get",`/${ta}/store_settings.json`).catch(()=>AP))}async function Ef(){const{widget_settings:r}=await pn("widgetSettings",()=>At("get",`/${ta}/widget_settings.json`));return wf(r)}async function Sf(){const{products:r,widget_settings:e,store_settings:t,meta:n}=await pn("productsAndSettings",()=>At("get",`/product/${ta}/products.json`));return n?.status==="error"?Promise.reject(n.message):{products:SP(r),widget_settings:wf(e),store_settings:t??{}}}async function OP(){const{products:r}=await Sf();return r}async function IP(r){const[e,t,n]=await Promise.all([na(r),$f(),Ef()]);return{product:e,store_settings:t,widget_settings:n,storeSettings:t,widgetSettings:n}}async function PP(r){const{bundle_product:e}=await na(r);return e}async function Af(){return Array.from(zr.keys()).forEach(r=>zr.delete(r))}var xP=Object.freeze({__proto__:null,getCDNBundleSettings:PP,getCDNProduct:na,getCDNProductAndSettings:IP,getCDNProducts:OP,getCDNProductsAndSettings:Sf,getCDNStoreSettings:$f,getCDNWidgetSettings:Ef,resetCDNCache:Af});async function TP(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 FP(r,e){return w("get","/charges",{query:e},v(r,"listCharges"))}async function RP(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 MP(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 DP(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 CP(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 NP(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 BP(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 qP=Object.freeze({__proto__:null,applyDiscountToCharge:RP,getCharge:TP,listCharges:FP,processCharge:NP,removeDiscountsFromCharge:MP,rescheduleCharge:BP,skipCharge:DP,unskipCharge:CP});async function Of(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 UP=Object.freeze({__proto__:null,productSearch:Of});async function If(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 kP(r,e){return w("get","/collections",{query:e},v(r,"listCollections"))}async function LP(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([If(n,e),Of(n,{...t,collection_ids:[e],limit:250})]);if(i==="manual")return{products:a.reduce((s,f)=>{const d=o.find(c=>c.external_product_id===f);return d&&s.push(d),s},[])};{const s=jP(i);return{products:o.slice().sort(s)}}}function Pf(r,e){const t=r.external_created_at,n=e.external_created_at;return t<n?-1:n>t?1:0}function xf(r,e){const t=r.external_product_id,n=e.external_product_id;return t<n?-1:n>t?1:0}function Tf(r,e){const t=r.title.toLowerCase(),n=e.title.toLowerCase();return t<n?-1:n>t?1:0}function jP(r){switch(r){case"created_at-asc":return Pf;case"created_at-desc":return(e,t)=>Pf(t,e);case"id-asc":return xf;case"id-desc":return(e,t)=>xf(t,e);case"title-asc":return Tf;case"title-desc":return(e,t)=>Tf(t,e)}}var VP=Object.freeze({__proto__:null,getCollection:If,listCollectionProducts:LP,listCollections:kP});async function GP(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 Ff(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 HP(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 WP(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 zP(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 XP(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 YP={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 KP(r,e,t){const n=r.customerId;if(!n)throw new Error("Not logged in.");const i=YP[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 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}},v(r,"getCreditSummary"));return n}var JP=Object.freeze({__proto__:null,getActiveChurnLandingPageURL:WP,getCreditSummary:ZP,getCustomer:GP,getCustomerPortalAccess:hn,getDeliverySchedule:HP,getFailedPaymentMethodRecoveryLandingPageURL:zP,getGiftRedemptionLandingPageURL:XP,sendCustomerNotification:KP,updateCustomer:Ff});async function QP(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 ex(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),Ff(v(r,"setApplyCreditsToNextCharge"),t)}async function rx(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 tx=Object.freeze({__proto__:null,getCreditSummary:QP,listCreditAccounts:rx,setApplyCreditsToNextCharge:ex});async function nx(r,e,t){return await w("post","/customer_surveys/cancellation_prevention",{data:{customer_id:e,subscription_id:t}},v(r,"getCustomerSurveyReasons"))}async function ix(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 ax(r,e){return await w("post","/offers/claim",{data:e},v(r,"claimOfferCustomerSurvey")),{}}var ox=Object.freeze({__proto__:null,claimOfferCustomerSurvey:ax,getCustomerSurveyOffers:ix,getCustomerSurveyReasons:nx});function ux(r,e){if(!r.customerId)throw new Error("Not logged in.");return w("get","/gift_purchases",{query:e},v(r,"listGiftPurchases"))}async function sx(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 fx=Object.freeze({__proto__:null,getGiftPurchase:sx,listGiftPurchases:ux});async function cx(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 lx(r,e){return w("get","/memberships",{query:e},v(r,"listMemberships"))}async function dx(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 px(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 hx(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 yx=Object.freeze({__proto__:null,activateMembership:px,cancelMembership:dx,changeMembership:hx,getMembership:cx,listMemberships:lx});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 gx(r,e){return w("get","/membership_programs",{query:e},v(r,"listMembershipPrograms"))}var vx=Object.freeze({__proto__:null,getMembershipProgram:_x,listMembershipPrograms:gx});async function mx(r,e){const{metafield:t}=await w("post","/metafields",{data:{metafield:e}},v(r,"createMetafield"));return t}async function wx(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 bx(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/metafields",{id:e},v(r,"deleteMetafield"))}var $x=Object.freeze({__proto__:null,createMetafield:mx,deleteMetafield:bx,updateMetafield:wx});async function Ex(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 Sx(r,e){return w("get","/onetimes",{query:e},v(r,"listOnetimes"))}async function Ax(r,e){const{onetime:t}=await w("post","/onetimes",{data:e},v(r,"createOnetime"));return t}async function Ox(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 Ix(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/onetimes",{id:e},v(r,"deleteOnetime"))}var Px=Object.freeze({__proto__:null,createOnetime:Ax,deleteOnetime:Ix,getOnetime:Ex,listOnetimes:Sx,updateOnetime:Ox});async function xx(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 Tx(r,e){return w("get","/orders",{query:e},v(r,"listOrders"))}async function Fx(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 Rx=Object.freeze({__proto__:null,delayOrder:Fx,getOrder:xx,listOrders:Tx});async function Mx(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 Dx(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 Rf(r,e){const{payment_method:t}=await w("post","/payment_methods",{data:{...e,customer_id:r.customerId}},v(r,"createPaymentMethod"));return t}async function Cx(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 Nx(r,e){return w("get","/payment_methods",{query:e},v(r,"listPaymentMethods"))}async function Bx(r,e){const t=await qx(r,e),n=t.external.environment_key,i=t.payment_method_intent_id,a=t.external_customer_id.ecommerce,o=t.external.resource_url,s=t.external.integrity_hash,f=t.payment_method?.processor_payment_method_token;await Mx(o,s);let d=!1,c=null,u=null,l=null;return{mount(p,_){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)),_?.onReady?.()}),window.Spreedly.on("fieldEvent",($,S,A,E)=>{_?.onFieldEvent?.($,S,A,E)}),window.Spreedly.on("errors",$=>{_?.onErrors?.($)}),window.Spreedly.on("paymentMethod",($,S)=>{c=$,_?.onPaymentMethod?.($,S),u&&(c=null,u($),u=null)})},tokenize(p){if(!d||!window.Spreedly)throw new Error("Payment form is not initialized");let _=String(p.year);_.length===2&&(_=`20${_}`);const $=String(p.month).padStart(2,"0");"full_name"in p?window.Spreedly.tokenizeCreditCard({full_name:p.full_name,month:$,year:_}):window.Spreedly.tokenizeCreditCard({first_name:p.first_name,last_name:p.last_name,month:$,year:_})},async submit(p){if(!d)throw new Error("Payment form is not initialized");if(c){const _=c;return c=null,Mf(r,_,p,{external_payment_method_id:f,payment_method_intent_id:i,external_customer_id:a})}return new Promise((_,$)=>{l=p,u=async S=>{try{const A=await Mf(r,S,l,{external_payment_method_id:f,payment_method_intent_id:i,external_customer_id:a});_(A)}catch(A){$(A)}finally{l=null}},this.tokenize(p.card_details)})},reset(){window.Spreedly&&window.Spreedly.reload(),c=null,u=null,l=null},unmount(){window.Spreedly&&window.Spreedly.removeHandlers(),d=!1,c=null,u=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,_){window.Spreedly.setFieldType(p,_)},setLabel(p,_){window.Spreedly.setLabel(p,_)},setNumberFormat(p){window.Spreedly.setNumberFormat(p)},setPlaceholder(p,_){window.Spreedly.setPlaceholder(p,_)},setStyle(p,_){window.Spreedly.setStyle(p,_)}}}async function qx(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 Mf(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:s,external_customer_id:f}){return await Rf(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:s,address_ids:i,external_payment_method_id:o,apply_to_all_subscription_addresses:a})}var Ux=Object.freeze({__proto__:null,createPaymentMethod:Rf,getPaymentMethod:Dx,initFrictionlessPaymentV1:Bx,listPaymentMethods:Nx,updatePaymentMethod:Cx});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 Lx(r,e){return w("get","/plans",{query:e},v(r,"listPlans"))}var jx=Object.freeze({__proto__:null,getPlan:kx,listPlans:Lx});async function Vx(r,e){return await w("get","/shop/shipping_countries",{query:e,headers:{"X-Recharge-Version":"2021-01"}},v(r,"getShippingCountries"))}async function Gx(r){return await w("get","/shop/settings",{headers:{"X-Recharge-Version":"2021-01"}},v(r,"getStoreSettings"))}var Hx=Object.freeze({__proto__:null,getShippingCountries:Vx,getStoreSettings:Gx}),Wx="Expected a function",Df="__lodash_placeholder__",qe=1,yn=2,zx=4,cr=8,Xr=16,Ue=32,Yr=64,Cf=128,Xx=256,Nf=512,Bf=1/0,Yx=9007199254740991,Kx=17976931348623157e292,qf=0/0,Zx=[["ary",Cf],["bind",qe],["bindKey",yn],["curry",cr],["curryRight",Xr],["flip",Nf],["partial",Ue],["partialRight",Yr],["rearg",Xx]],Jx="[object Function]",Qx="[object GeneratorFunction]",e2="[object Symbol]",r2=/[\\^$.*+?()[\]{}|]/g,t2=/^\s+|\s+$/g,n2=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,i2=/\{\n\/\* \[wrapped with (.+)\] \*/,a2=/,? & /,o2=/^[-+]0x[0-9a-f]+$/i,u2=/^0b[01]+$/i,s2=/^\[object .+?Constructor\]$/,f2=/^0o[0-7]+$/i,c2=/^(?:0|[1-9]\d*)$/,l2=parseInt,d2=typeof D=="object"&&D&&D.Object===Object&&D,p2=typeof self=="object"&&self&&self.Object===Object&&self,Kr=d2||p2||Function("return this")();function ia(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 h2(r,e){for(var t=-1,n=r?r.length:0;++t<n&&e(r[t],t,r)!==!1;);return r}function y2(r,e){var t=r?r.length:0;return!!t&&g2(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 g2(r,e,t){if(e!==e)return _2(r,v2,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function v2(r){return r!==r}function m2(r,e){for(var t=r.length,n=0;t--;)r[t]===e&&n++;return n}function w2(r,e){return r?.[e]}function b2(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function aa(r,e){for(var t=-1,n=r.length,i=0,a=[];++t<n;){var o=r[t];(o===e||o===Df)&&(r[t]=Df,a[i++]=t)}return a}var $2=Function.prototype,Uf=Object.prototype,oa=Kr["__core-js_shared__"],kf=function(){var r=/[^.]+$/.exec(oa&&oa.keys&&oa.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Lf=$2.toString,E2=Uf.hasOwnProperty,jf=Uf.toString,S2=RegExp("^"+Lf.call(E2).replace(r2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),A2=Object.create,lr=Math.max,O2=Math.min,Vf=function(){var r=Hf(Object,"defineProperty"),e=Hf.name;return e&&e.length>2?r:void 0}();function I2(r){return dr(r)?A2(r):{}}function P2(r){if(!dr(r)||k2(r))return!1;var e=G2(r)||b2(r)?S2:s2;return e.test(j2(r))}function x2(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,ia(r,this,o)}}function T2(r,e,t,n){for(var i=-1,a=r.length,o=t.length,s=-1,f=e.length,d=lr(a-o,0),c=Array(f+d),u=!n;++s<f;)c[s]=e[s];for(;++i<o;)(u||i<a)&&(c[t[i]]=r[i]);for(;d--;)c[s++]=r[i++];return c}function F2(r,e,t,n){for(var i=-1,a=r.length,o=-1,s=t.length,f=-1,d=e.length,c=lr(a-s,0),u=Array(c+d),l=!n;++i<c;)u[i]=r[i];for(var p=i;++f<d;)u[p+f]=e[f];for(;++o<s;)(l||i<a)&&(u[p+t[o]]=r[i++]);return u}function R2(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}function M2(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=I2(r.prototype),n=r.apply(t,e);return dr(n)?n:t}}function D2(r,e,t){var n=Zr(r);function i(){for(var a=arguments.length,o=Array(a),s=a,f=sa(i);s--;)o[s]=arguments[s];var d=a<3&&o[0]!==f&&o[a-1]!==f?[]:aa(o,f);if(a-=d.length,a<t)return Gf(r,e,ua,i.placeholder,void 0,o,d,void 0,void 0,t-a);var c=this&&this!==Kr&&this instanceof i?n:r;return ia(c,this,o)}return i}function ua(r,e,t,n,i,a,o,s,f,d){var c=e&Cf,u=e&qe,l=e&yn,p=e&(cr|Xr),_=e&Nf,$=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=m2(E,I);if(n&&(E=T2(E,n,i,p)),a&&(E=F2(E,a,o,p)),A-=T,p&&A<d){var F=aa(E,I);return Gf(r,e,ua,S.placeholder,t,E,F,s,f,d-A)}var b=u?t:this,g=l?b[r]:r;return A=E.length,s?E=L2(E,s):_&&A>1&&E.reverse(),c&&f<A&&(E.length=f),this&&this!==Kr&&this instanceof S&&(g=$||Zr(g)),g.apply(b,E)}return S}function C2(r,e,t,n){var i=e&qe,a=Zr(r);function o(){for(var s=-1,f=arguments.length,d=-1,c=n.length,u=Array(c+f),l=this&&this!==Kr&&this instanceof o?a:r;++d<c;)u[d]=n[d];for(;f--;)u[d++]=arguments[++s];return ia(l,i?t:this,u)}return o}function Gf(r,e,t,n,i,a,o,s,f,d){var c=e&cr,u=c?o:void 0,l=c?void 0:o,p=c?a:void 0,_=c?void 0:a;e|=c?Ue:Yr,e&=~(c?Yr:Ue),e&zx||(e&=~(qe|yn));var $=t(r,e,i,p,u,_,l,s,f,d);return $.placeholder=n,Wf($,r,e)}function N2(r,e,t,n,i,a,o,s){var f=e&yn;if(!f&&typeof r!="function")throw new TypeError(Wx);var d=n?n.length:0;if(d||(e&=~(Ue|Yr),n=i=void 0),o=o===void 0?o:lr(zf(o),0),s=s===void 0?s:zf(s),d-=i?i.length:0,e&Yr){var c=n,u=i;n=i=void 0}var l=[r,e,t,n,i,c,u,a,o,s];if(r=l[0],e=l[1],t=l[2],n=l[3],i=l[4],s=l[9]=l[9]==null?f?0:r.length:lr(l[9]-d,0),!s&&e&(cr|Xr)&&(e&=~(cr|Xr)),!e||e==qe)var p=M2(r,e,t);else e==cr||e==Xr?p=D2(r,e,s):(e==Ue||e==(qe|Ue))&&!i.length?p=C2(r,e,t,n):p=ua.apply(void 0,l);return Wf(p,r,e)}function sa(r){var e=r;return e.placeholder}function Hf(r,e){var t=w2(r,e);return P2(t)?t:void 0}function B2(r){var e=r.match(i2);return e?e[1].split(a2):[]}function q2(r,e){var t=e.length,n=t-1;return e[n]=(t>1?"& ":"")+e[n],e=e.join(t>2?", ":" "),r.replace(n2,`{
24
+ */(function(e,t){typeof K$=="function"&&r&&r.exports?r.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(D,function(){function e(c,u,l){this.low=c|0,this.high=u|0,this.unsigned=!!l}e.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=function(u){return(u&&u.__isLong__)===!0};var t={},n={};e.fromInt=function(u,l){var p,_;return l?(u=u>>>0,0<=u&&u<256&&(_=n[u],_)?_:(p=new e(u,(u|0)<0?-1:0,!0),0<=u&&u<256&&(n[u]=p),p)):(u=u|0,-128<=u&&u<128&&(_=t[u],_)?_:(p=new e(u,u<0?-1:0,!1),-128<=u&&u<128&&(t[u]=p),p))},e.fromNumber=function(u,l){return l=!!l,isNaN(u)||!isFinite(u)?e.ZERO:!l&&u<=-f?e.MIN_VALUE:!l&&u+1>=f?e.MAX_VALUE:l&&u>=s?e.MAX_UNSIGNED_VALUE:u<0?e.fromNumber(-u,l).negate():new e(u%o|0,u/o|0,l)},e.fromBits=function(u,l,p){return new e(u,l,p)},e.fromString=function(u,l,p){if(u.length===0)throw Error("number format error: empty string");if(u==="NaN"||u==="Infinity"||u==="+Infinity"||u==="-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 _;if((_=u.indexOf("-"))>0)throw Error('number format error: interior "-" character: '+u);if(_===0)return e.fromString(u.substring(1),l,p).negate();for(var $=e.fromNumber(Math.pow(p,8)),S=e.ZERO,A=0;A<u.length;A+=8){var E=Math.min(8,u.length-A),h=parseInt(u.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(u){return u instanceof e?u:typeof u=="number"?e.fromNumber(u):typeof u=="string"?e.fromString(u):new e(u.low,u.high,u.unsigned)};var i=65536,a=1<<24,o=i*i,s=o*o,f=s/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(u){if(u=u||10,u<2||36<u)throw RangeError("radix out of range: "+u);if(this.isZero())return"0";var l;if(this.isNegative())if(this.equals(e.MIN_VALUE)){var p=e.fromNumber(u),_=this.divide(p);return l=_.multiply(p).subtract(this),_.toString(u)+l.toInt().toString(u)}else return"-"+this.negate().toString(u);var $=e.fromNumber(Math.pow(u,6),this.unsigned);l=this;for(var S="";;){var A=l.divide($),E=l.subtract(A.multiply($)).toInt()>>>0,h=E.toString(u);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 u=this.high!=0?this.high:this.low,l=31;l>0&&!(u&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(u){return e.isLong(u)||(u=e.fromValue(u)),this.unsigned!==u.unsigned&&this.high>>>31===1&&u.high>>>31===1?!1:this.high===u.high&&this.low===u.low},e.eq=e.prototype.equals,e.prototype.notEquals=function(u){return!this.equals(u)},e.neq=e.prototype.notEquals,e.prototype.lessThan=function(u){return this.compare(u)<0},e.prototype.lt=e.prototype.lessThan,e.prototype.lessThanOrEqual=function(u){return this.compare(u)<=0},e.prototype.lte=e.prototype.lessThanOrEqual,e.prototype.greaterThan=function(u){return this.compare(u)>0},e.prototype.gt=e.prototype.greaterThan,e.prototype.greaterThanOrEqual=function(u){return this.compare(u)>=0},e.prototype.gte=e.prototype.greaterThanOrEqual,e.prototype.compare=function(u){if(e.isLong(u)||(u=e.fromValue(u)),this.equals(u))return 0;var l=this.isNegative(),p=u.isNegative();return l&&!p?-1:!l&&p?1:this.unsigned?u.high>>>0>this.high>>>0||u.high===this.high&&u.low>>>0>this.low>>>0?-1:1:this.subtract(u).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(u){e.isLong(u)||(u=e.fromValue(u));var l=this.high>>>16,p=this.high&65535,_=this.low>>>16,$=this.low&65535,S=u.high>>>16,A=u.high&65535,E=u.low>>>16,h=u.low&65535,I=0,T=0,F=0,b=0;return b+=$+h,F+=b>>>16,b&=65535,F+=_+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(u){return e.isLong(u)||(u=e.fromValue(u)),this.add(u.negate())},e.prototype.sub=e.prototype.subtract,e.prototype.multiply=function(u){if(this.isZero()||(e.isLong(u)||(u=e.fromValue(u)),u.isZero()))return e.ZERO;if(this.equals(e.MIN_VALUE))return u.isOdd()?e.MIN_VALUE:e.ZERO;if(u.equals(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return u.isNegative()?this.negate().multiply(u.negate()):this.negate().multiply(u).negate();if(u.isNegative())return this.multiply(u.negate()).negate();if(this.lessThan(d)&&u.lessThan(d))return e.fromNumber(this.toNumber()*u.toNumber(),this.unsigned);var l=this.high>>>16,p=this.high&65535,_=this.low>>>16,$=this.low&65535,S=u.high>>>16,A=u.high&65535,E=u.low>>>16,h=u.low&65535,I=0,T=0,F=0,b=0;return b+=$*h,F+=b>>>16,b&=65535,F+=_*h,T+=F>>>16,F&=65535,F+=$*E,T+=F>>>16,F&=65535,T+=p*h,I+=T>>>16,T&=65535,T+=_*E,I+=T>>>16,T&=65535,T+=$*A,I+=T>>>16,T&=65535,I+=l*h+p*E+_*A+$*S,I&=65535,e.fromBits(F<<16|b,I<<16|T,this.unsigned)},e.prototype.mul=e.prototype.multiply,e.prototype.divide=function(u){if(e.isLong(u)||(u=e.fromValue(u)),u.isZero())throw new Error("division by zero");if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var l,p,_;if(this.equals(e.MIN_VALUE)){if(u.equals(e.ONE)||u.equals(e.NEG_ONE))return e.MIN_VALUE;if(u.equals(e.MIN_VALUE))return e.ONE;var $=this.shiftRight(1);return l=$.divide(u).shiftLeft(1),l.equals(e.ZERO)?u.isNegative()?e.ONE:e.NEG_ONE:(p=this.subtract(u.multiply(l)),_=l.add(p.divide(u)),_)}else if(u.equals(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return u.isNegative()?this.negate().divide(u.negate()):this.negate().divide(u).negate();if(u.isNegative())return this.divide(u.negate()).negate();for(_=e.ZERO,p=this;p.greaterThanOrEqual(u);){l=Math.max(1,Math.floor(p.toNumber()/u.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(u);h.isNegative()||h.greaterThan(p);)l-=A,E=e.fromNumber(l,this.unsigned),h=E.multiply(u);E.isZero()&&(E=e.ONE),_=_.add(E),p=p.subtract(h)}return _},e.prototype.div=e.prototype.divide,e.prototype.modulo=function(u){return e.isLong(u)||(u=e.fromValue(u)),this.subtract(this.divide(u).multiply(u))},e.prototype.mod=e.prototype.modulo,e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.and=function(u){return e.isLong(u)||(u=e.fromValue(u)),e.fromBits(this.low&u.low,this.high&u.high,this.unsigned)},e.prototype.or=function(u){return e.isLong(u)||(u=e.fromValue(u)),e.fromBits(this.low|u.low,this.high|u.high,this.unsigned)},e.prototype.xor=function(u){return e.isLong(u)||(u=e.fromValue(u)),e.fromBits(this.low^u.low,this.high^u.high,this.unsigned)},e.prototype.shiftLeft=function(u){return e.isLong(u)&&(u=u.toInt()),(u&=63)===0?this:u<32?e.fromBits(this.low<<u,this.high<<u|this.low>>>32-u,this.unsigned):e.fromBits(0,this.low<<u-32,this.unsigned)},e.prototype.shl=e.prototype.shiftLeft,e.prototype.shiftRight=function(u){return e.isLong(u)&&(u=u.toInt()),(u&=63)===0?this:u<32?e.fromBits(this.low>>>u|this.high<<32-u,this.high>>u,this.unsigned):e.fromBits(this.high>>u-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=e.prototype.shiftRight,e.prototype.shiftRightUnsigned=function(u){if(e.isLong(u)&&(u=u.toInt()),u&=63,u===0)return this;var l=this.high;if(u<32){var p=this.low;return e.fromBits(p>>>u|l<<32-u,l>>>u,this.unsigned)}else return u===32?e.fromBits(l,0,this.unsigned):e.fromBits(l>>>u-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})})(us);var ss=us.exports;Object.defineProperty(jt,"__esModule",{value:!0}),jt.Hyper=void 0;var Z$=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}}(),fs=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)}},J$=ss,Rr=cs(J$),Q$=M,eE=cs(Q$);function cs(r){return r&&r.__esModule?r:{default:r}}function rE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function tE(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 nE(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){nE(e,r),Z$(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=fs(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=fs(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 rE(this,e),tE(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!1))}return e}(Rr.default);(0,eE.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 iE=It,ls=ds(iE),aE=M,oE=ds(aE);function ds(r){return r&&r.__esModule?r:{default:r}}var Dr=Ce.UnsignedInt={read:function(e){return e.readUInt32BE()},write:function(e,t){if(!(0,ls.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,ls.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,oE.default)(Dr);var Vt={};Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.UnsignedHyper=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}}(),ps=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)}},sE=ss,Cr=hs(sE),fE=M,cE=hs(fE);function hs(r){return r&&r.__esModule?r:{default:r}}function lE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function dE(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 pE(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){pE(e,r),uE(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=ps(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=ps(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 lE(this,e),dE(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!0))}return e}(Cr.default);(0,cE.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 hE=It,ys=_s(hE),yE=M,_E=_s(yE);function _s(r){return r&&r.__esModule?r:{default:r}}var gE=Gt.Float={read:function(e){return e.readFloatBE()},write:function(e,t){if(!(0,ys.default)(e))throw new Error("XDR Write Error: not a number");t.writeFloatBE(e)},isValid:function(e){return(0,ys.default)(e)}};(0,_E.default)(gE);var Ht={};Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.Double=void 0;var vE=It,gs=vs(vE),mE=M,wE=vs(mE);function vs(r){return r&&r.__esModule?r:{default:r}}var bE=Ht.Double={read:function(e){return e.readDoubleBE()},write:function(e,t){if(!(0,gs.default)(e))throw new Error("XDR Write Error: not a number");t.writeDoubleBE(e)},isValid:function(e){return(0,gs.default)(e)}};(0,wE.default)(bE);var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.Quadruple=void 0;var $E=M,EE=SE($E);function SE(r){return r&&r.__esModule?r:{default:r}}var AE=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,EE.default)(AE);var Br={},OE=ge,IE=ve,PE="[object Boolean]";function xE(r){return r===!0||r===!1||IE(r)&&OE(r)==PE}var TE=xE;Object.defineProperty(Br,"__esModule",{value:!0}),Br.Bool=void 0;var FE=TE,RE=ws(FE),ms=ce,ME=M,DE=ws(ME);function ws(r){return r&&r.__esModule?r:{default:r}}var CE=Br.Bool={read:function(e){var t=ms.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 ms.Int.write(n,t)},isValid:function(e){return(0,RE.default)(e)}};(0,DE.default)(CE);var zt={},NE=ge,BE=V,qE=ve,UE="[object String]";function kE(r){return typeof r=="string"||!BE(r)&&qE(r)&&NE(r)==UE}var bs=kE;Object.defineProperty(zt,"__esModule",{value:!0}),zt.String=void 0;var LE=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}}(),jE=bs,$s=Di(jE),VE=V,GE=Di(VE),Es=ce,HE=Ce,Ss=Me,WE=M,zE=Di(WE);function Di(r){return r&&r.__esModule?r:{default:r}}function XE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var YE=zt.String=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:HE.UnsignedInt.MAX_VALUE;XE(this,r),this._maxLength=e}return LE(r,[{key:"read",value:function(t){var n=Es.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,Ss.calculatePadding)(n),a=t.slice(n);return(0,Ss.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,$s.default)(t)?i=y.from(t,"utf8"):i=y.from(t),Es.Int.write(i.length,n),n.writeBufferPadded(i)}},{key:"isValid",value:function(t){var n=void 0;if((0,$s.default)(t))n=y.from(t,"utf8");else if((0,GE.default)(t)||y.isBuffer(t))n=y.from(t);else return!1;return n.length<=this._maxLength}}]),r}();(0,zE.default)(YE.prototype);var Xt={};Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.Opaque=void 0;var KE=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}}(),As=Me,ZE=M,JE=QE(ZE);function QE(r){return r&&r.__esModule?r:{default:r}}function eS(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var rS=Xt.Opaque=function(){function r(e){eS(this,r),this._length=e,this._padding=(0,As.calculatePadding)(e)}return KE(r,[{key:"read",value:function(t){var n=t.slice(this._length);return(0,As.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,JE.default)(rS.prototype);var Yt={};Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.VarOpaque=void 0;var tS=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}}(),Os=ce,nS=Ce,Is=Me,iS=M,aS=oS(iS);function oS(r){return r&&r.__esModule?r:{default:r}}function uS(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var sS=Yt.VarOpaque=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:nS.UnsignedInt.MAX_VALUE;uS(this,r),this._maxLength=e}return tS(r,[{key:"read",value:function(t){var n=Os.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,Is.calculatePadding)(n),a=t.slice(n);return(0,Is.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));Os.Int.write(t.length,n),n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length<=this._maxLength}}]),r}();(0,aS.default)(sS.prototype);var Kt={};function fS(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}var cS=fS,lS=xt;function dS(r){return typeof r=="function"?r:lS}var Ps=dS,pS=cS,hS=mi,yS=Ps,_S=V;function gS(r,e){var t=_S(r)?pS:hS;return t(r,yS(e))}var vS=gS,ar=vS,mS=/\s/;function wS(r){for(var e=r.length;e--&&mS.test(r.charAt(e)););return e}var bS=wS,$S=bS,ES=/^\s+/;function SS(r){return r&&r.slice(0,$S(r)+1).replace(ES,"")}var AS=SS,OS=AS,xs=Qe,IS=kt,Ts=0/0,PS=/^[-+]0x[0-9a-f]+$/i,xS=/^0b[01]+$/i,TS=/^0o[0-7]+$/i,FS=parseInt;function RS(r){if(typeof r=="number")return r;if(IS(r))return Ts;if(xs(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=xs(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=OS(r);var t=xS.test(r);return t||TS.test(r)?FS(r.slice(2),t?2:8):PS.test(r)?Ts:+r}var MS=RS,DS=MS,Fs=1/0,CS=17976931348623157e292;function NS(r){if(!r)return r===0?r:0;if(r=DS(r),r===Fs||r===-Fs){var e=r<0?-1:1;return e*CS}return r===r?r:0}var BS=NS,qS=BS;function US(r){var e=qS(r),t=e%1;return e===e?t?e-t:e:0}var kS=US,LS=du,jS=Ps,VS=kS,GS=9007199254740991,Ci=4294967295,HS=Math.min;function WS(r,e){if(r=VS(r),r<1||r>GS)return[];var t=Ci,n=HS(r,Ci);e=jS(e),r-=Ci;for(var i=LS(n,e);++t<r;)e(t);return i}var Rs=WS;Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.Array=void 0;var zS=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}}(),XS=Ri,YS=qr(XS),KS=ar,ZS=qr(KS),JS=Rs,QS=qr(JS),eA=V,Ms=qr(eA),rA=M,tA=qr(rA);function qr(r){return r&&r.__esModule?r:{default:r}}function nA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var iA=Kt.Array=function(){function r(e,t){nA(this,r),this._childType=e,this._length=t}return zS(r,[{key:"read",value:function(t){var n=this;return(0,QS.default)(this._length,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,Ms.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,ZS.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,Ms.default)(t)||t.length!==this._length?!1:(0,YS.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,tA.default)(iA.prototype);var Zt={};Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.VarArray=void 0;var aA=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}}(),oA=Ri,uA=Ur(oA),sA=ar,fA=Ur(sA),cA=Rs,lA=Ur(cA),dA=V,Ds=Ur(dA),pA=Ce,Cs=ce,hA=M,yA=Ur(hA);function Ur(r){return r&&r.__esModule?r:{default:r}}function _A(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var gA=Zt.VarArray=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pA.UnsignedInt.MAX_VALUE;_A(this,r),this._childType=e,this._maxLength=t}return aA(r,[{key:"read",value:function(t){var n=this,i=Cs.Int.read(t);if(i>this._maxLength)throw new Error("XDR Read Error: Saw "+i+" length VarArray,"+("max allowed is "+this._maxLength));return(0,lA.default)(i,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,Ds.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));Cs.Int.write(t.length,n),(0,fA.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,Ds.default)(t)||t.length>this._maxLength?!1:(0,uA.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,yA.default)(gA.prototype);var Jt={};function vA(r){return r===null}var mA=vA;function wA(r){return r===void 0}var kr=wA;Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.Option=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}}(),$A=mA,Ns=Ni($A),EA=kr,Bs=Ni(EA),qs=Br,SA=M,AA=Ni(SA);function Ni(r){return r&&r.__esModule?r:{default:r}}function OA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var IA=Jt.Option=function(){function r(e){OA(this,r),this._childType=e}return bA(r,[{key:"read",value:function(t){if(qs.Bool.read(t))return this._childType.read(t)}},{key:"write",value:function(t,n){var i=!((0,Ns.default)(t)||(0,Bs.default)(t));qs.Bool.write(i,n),i&&this._childType.write(t,n)}},{key:"isValid",value:function(t){return(0,Ns.default)(t)||(0,Bs.default)(t)?!0:this._childType.isValid(t)}}]),r}();(0,AA.default)(IA.prototype);var Lr={};Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.Void=void 0;var PA=kr,Us=ks(PA),xA=M,TA=ks(xA);function ks(r){return r&&r.__esModule?r:{default:r}}var FA=Lr.Void={read:function(){},write:function(e){if(!(0,Us.default)(e))throw new Error("XDR Write Error: trying to write value to a void slot")},isValid:function(e){return(0,Us.default)(e)}};(0,TA.default)(FA);var Qt={},RA=Fi;function MA(r,e){return RA(e,function(t){return r[t]})}var DA=MA,CA=DA,NA=Mt;function BA(r){return r==null?[]:CA(r,NA(r))}var qA=BA;Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.Enum=void 0;var UA=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}}(),kA=ar,LA=Bi(kA),jA=qA,VA=Bi(jA),Ls=ce,GA=M,HA=Bi(GA);function Bi(r){return r&&r.__esModule?r:{default:r}}function WA(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 zA(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 js(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var XA=Qt.Enum=function(){function r(e,t){js(this,r),this.name=e,this.value=t}return UA(r,null,[{key:"read",value:function(t){var n=Ls.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);Ls.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,VA.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){zA(s,o);function s(){return js(this,s),WA(this,(s.__proto__||Object.getPrototypeOf(s)).apply(this,arguments))}return s}(r);return a.enumName=n,t.results[n]=a,a._members={},a._byValue=new Map,(0,LA.default)(i,function(o,s){var f=new a(s,o);a._members[s]=f,a._byValue.set(o,f),a[s]=function(){return f}}),a}}]),r}();(0,HA.default)(XA);var en={},YA=mi,KA=Tr;function ZA(r,e){var t=-1,n=KA(r)?Array(r.length):[];return YA(r,function(i,a,o){n[++t]=e(i,a,o)}),n}var JA=ZA,QA=Fi,eO=rs,rO=JA,tO=V;function nO(r,e){var t=tO(r)?QA:rO;return t(r,eO(e))}var iO=nO;function aO(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 oO=aO,jr={};Object.defineProperty(jr,"__esModule",{value:!0});var uO=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 sO(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}jr.Reference=function(){function r(){sO(this,r)}return uO(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 s=e[Symbol.iterator](),f;!(i=(f=s.next()).done)&&(n.push(f.value),!(t&&n.length===t));i=!0);}catch(d){a=!0,o=d}finally{try{!i&&s.return&&s.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")}}(),fO=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}}(),cO=ar,Vs=Vr(cO),lO=iO,dO=Vr(lO),pO=kr,hO=Vr(pO),yO=oO,_O=Vr(yO),gO=jr,vO=M,mO=Vr(vO);function Vr(r){return r&&r.__esModule?r:{default:r}}function wO(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 bO(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 Gs(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var $O=en.Struct=function(){function r(e){Gs(this,r),this._attributes=e||{}}return fO(r,null,[{key:"read",value:function(t){var n=(0,dO.default)(this._fields,function(i){var a=rn(i,2),o=a[0],s=a[1],f=s.read(t);return[o,f]});return new this((0,_O.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,Vs.default)(this._fields,function(i){var a=rn(i,2),o=a[0],s=a[1],f=t._attributes[o];s.write(f,n)})}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(o){bO(s,o);function s(){return Gs(this,s),wO(this,(s.__proto__||Object.getPrototypeOf(s)).apply(this,arguments))}return s}(r);return a.structName=n,t.results[n]=a,a._fields=i.map(function(o){var s=rn(o,2),f=s[0],d=s[1];return d instanceof gO.Reference&&(d=d.resolve(t)),[f,d]}),(0,Vs.default)(a._fields,function(o){var s=rn(o,1),f=s[0];a.prototype[f]=EO(f)}),a}}]),r}();(0,mO.default)($O);function EO(r){return function(t){return(0,hO.default)(t)||(this._attributes[r]=t),this._attributes[r]}}var tn={};Object.defineProperty(tn,"__esModule",{value:!0}),tn.Union=void 0;var SO=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var s=e[Symbol.iterator](),f;!(i=(f=s.next()).done)&&(n.push(f.value),!(t&&n.length===t));i=!0);}catch(d){a=!0,o=d}finally{try{!i&&s.return&&s.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")}}(),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}}(),OO=ar,nn=on(OO),IO=kr,Hs=on(IO),PO=bs,Ws=on(PO),an=Lr,qi=jr,xO=M,TO=on(xO);function on(r){return r&&r.__esModule?r:{default:r}}function FO(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 RO(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 zs(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var MO=tn.Union=function(){function r(e,t){zs(this,r),this.set(e,t)}return AO(r,[{key:"set",value:function(t,n){(0,Ws.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,Hs.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(s){RO(f,s);function f(){return zs(this,f),FO(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}return f}(r);a.unionName=n,t.results[n]=a,i.switchOn instanceof qi.Reference?a._switchOn=i.switchOn.resolve(t):a._switchOn=i.switchOn,a._switches=new Map,a._arms={},(0,nn.default)(i.arms,function(s,f){s instanceof qi.Reference&&(s=s.resolve(t)),a._arms[f]=s});var o=i.defaultArm;return o instanceof qi.Reference&&(o=o.resolve(t)),a._defaultArm=o,(0,nn.default)(i.switches,function(s){var f=SO(s,2),d=f[0],c=f[1];(0,Ws.default)(d)&&(d=a._switchOn.fromName(d)),a._switches.set(d,c)}),(0,Hs.default)(a._switchOn.values)||(0,nn.default)(a._switchOn.values(),function(s){a[s.name]=function(f){return new a(s,f)},a.prototype[s.name]=function(d){return this.set(s,d)}}),(0,nn.default)(a._arms,function(s,f){s!==an.Void&&(a.prototype[f]=function(){return this.get(f)})}),a}}]),r}();(0,TO.default)(MO),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 s=Wt;Object.keys(s).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return s[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 u=Yt;Object.keys(u).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return u[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 _=Jt;Object.keys(_).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return _[h]}})});var $=Lr;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]}})})}(hi);var Xs={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=function(){function b(g,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(g,P.key,P)}}return function(g,m,O){return m&&b(g.prototype,m),O&&b(g,O),g}}(),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=_;var n=kr,i=c(n),a=ar,o=c(a),s=hi,f=d(s);function d(b){if(b&&b.__esModule)return b;var g={};if(b!=null)for(var m in b)Object.prototype.hasOwnProperty.call(b,m)&&(g[m]=b[m]);return g.default=b,g}function c(b){return b&&b.__esModule?b:{default:b}}function u(b,g){if(!(b instanceof g))throw new TypeError("Cannot call a class as a function")}function l(b,g){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g&&(typeof g=="object"||typeof g=="function")?g:b}function p(b,g){if(typeof g!="function"&&g!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof g);b.prototype=Object.create(g&&g.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),g&&(Object.setPrototypeOf?Object.setPrototypeOf(b,g):b.__proto__=g)}function _(b){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(b){var m=new F(g);b(m),m.resolve()}return g}var $=function(b){p(g,b);function g(m){u(this,g);var O=l(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return O.name=m,O}return e(g,[{key:"resolve",value:function(O){var P=O.definitions[this.name];return P.resolve(O)}}]),g}(t.Reference),S=function(b){p(g,b);function g(m,O){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;u(this,g);var B=l(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return B.childReference=m,B.length=O,B.variable=P,B}return e(g,[{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)}}]),g}(t.Reference),A=function(b){p(g,b);function g(m){u(this,g);var O=l(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return O.childReference=m,O.name=m.name,O}return e(g,[{key:"resolve",value:function(O){var P=this.childReference;return P instanceof t.Reference&&(P=P.resolve(O)),new f.Option(P)}}]),g}(t.Reference),E=function(b){p(g,b);function g(m,O){u(this,g);var P=l(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return P.sizedType=m,P.length=O,P}return e(g,[{key:"resolve",value:function(O){var P=this.length;return P instanceof t.Reference&&(P=P.resolve(O)),new this.sizedType(P)}}]),g}(t.Reference),h=function(){function b(g,m,O){u(this,b),this.constructor=g,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,g,m){return m instanceof t.Reference&&(m=m.resolve(b)),b.results[g]=m,m}function T(b,g,m){return b.results[g]=m,m}var F=function(){function b(g){u(this,b),this._destination=g,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}()})(Xs),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=hi;Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[n]}})});var t=Xs;Object.keys(t).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[n]}})})}(Jo);var Ui=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)},L=(r,e,t)=>(Ui(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)},ki=(r,e,t,n)=>(Ui(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),me=(r,e,t)=>(Ui(r,e,"access private method"),t),ie,ae,Gr,Li,Ys,ji,Ks,un,Vi,or,Hr;function DO(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=Jo.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 CO{constructor(e,t){Ne(this,Li),Ne(this,ji),Ne(this,un),Ne(this,or),Ne(this,ie,void 0),Ne(this,ae,void 0),Ne(this,Gr,void 0),ki(this,ie,me(this,Li,Ys).call(this,t)),ki(this,Gr,me(this,ji,Ks).call(this,t)),ki(this,ae,e)}isInitialDataValid(){if(!L(this,Gr))throw"Bundle data does not exist for the given product.";if(!L(this,ie))throw"Bundle settings do not exist for the given product.";if(!Array.isArray(L(this,ae))||!L(this,ae).length)throw"No bundle selection items provided.";return!0}isValidVariant(e){if(!L(this,ie)?.variantsSettings[e])throw`The ${e} bundle variant is invalid.`;return!0}isSelectionInVariantRange(e){const t=L(this,ae).reduce((i,a)=>i+a.quantity,0),n=L(this,ie)?.variantsSettings[e].ranges||[];if(!me(this,un,Vi).call(this,n,t))throw"The total number of products does not fall within the required variant range.";return!0}areItemsInMaxPerItemBound(){const e=L(this,ie)?.bundleSettings.maxPerItem||0,t=L(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=L(this,ie)?.variantsSettings[e],n=L(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=L(this,ae).reduce((a,o)=>(a[o.collectionId]=o.quantity+(a[o.collectionId]||0),a),{}),n=L(this,ie)?.variantsSettings[e],i=Object.values(n?.optionSources||{}).filter(a=>{const o=t[a.collectionId]||0;return!me(this,un,Vi).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=L(this,ie)?.variantsSettings[e]?.optionSources||{},n=Object.values(t).reduce((a,o)=>{const s=L(this,Gr)?.collections[o.collectionId];return s&&(a[o.collectionId]=s),a},{});if(!Object.values(n).length)throw`No collections found for the bundle variant (${e}).`;const i=L(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,Ys=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}},ji=new WeakSet,Ks=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}},un=new WeakSet,Vi=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 NO="/bundling-storefront-manager";function Zs(r){return DO({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 BO(r){const e=j(),t=await Gi(r);if(t!==!0)throw new Error(t);const n=Zs(r);try{const i=await Fe("post",`${NO}/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 qO(r,e){const t=await Gi(e);if(t!==!0)throw new Error(t);const n=Zs(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 UO(r,e){const t=Js(r);if(t!==!0)throw new Error(`Dynamic Bundle is invalid. ${t}`);const n=`${_a(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 Gi(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 kO(r){try{const e=await Fe("get",`/bundle-data/${r.externalProductId}`);return{valid:new CO(r.selections,e).isBundleSelectionValid(r.externalVariantId)}}catch(e){return{valid:!1,error:String(e)}}}const LO={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 Js(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=LO[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 jO(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 VO(r,e){return w("get","/bundle_selections",{query:e},v(r,"listBundleSelections"))}async function GO(r,e){const{bundle_selection:t}=await w("post","/bundle_selections",{data:e},v(r,"createBundleSelection"));return t}async function HO(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 WO(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 zO(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 XO=Object.freeze({__proto__:null,createBundleSelection:GO,deleteBundleSelection:WO,getBundleId:BO,getBundleSelection:jO,getBundleSelectionId:qO,getDynamicBundleItems:UO,listBundleSelections:VO,updateBundle:zO,updateBundleSelection:HO,validateBundle:Gi,validateBundleSelection:kO,validateDynamicBundle:Js});const YO=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}}},KO=r=>r.tiered_discounts.length===0?null:{tiered_discounts:r.tiered_discounts.map(e=>({eligible_charge_types:e.eligible_charge_types,eligible_line_item_types:e.eligible_line_item_types,external_bundle_product_id:{ecommerce:e.external_bundle_product_id.ecommerce},lookup_key:e.lookup_key,name:e.name,status:e.status,tiers:e.tiers.map(({tier:t})=>({tier:{lookup_key:t.lookup_key,discount_type:t.discount_type,discount_value:t.discount_value,condition_quantity_gte:t.condition_quantity_gte}}))}))},sn=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}))}),Qs=r=>({name:r.name,options:r.options.map(e=>({name:e.name,values:e.values})),selling_plans:r.selling_plans.map(sn)}),ef=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}),Hi=r=>r==null||typeof r=="string"?r:"src"in r?r.src:null,rf=r=>({id:String(r.id),title:r.title,description:r.description,available_for_sale:r.available,featured_image:Hi(r.featured_image),images:r.images,requires_selling_plan:r.requires_selling_plan,selling_plan_groups:r.selling_plan_groups.map(Qs)}),tf=r=>{const e=JO(r.selling_plan_groups);return{...rf(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=>({...ef(t),selling_plan_allocations:t.selling_plan_allocations.map(n=>({price:n.price,compare_at_price:n.compare_at_price,selling_plan:sn(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:Hi(t.featured_image),public_title:t.public_title,requires_selling_plan:t.requires_selling_plan}))}},ZO=({items_count:r,ranges:e})=>e.length>0?e.map(({quantity_max:t,quantity_min:n})=>({min:n,max:t})):[{min:r,max:r}],JO=r=>r.reduce((e,t)=>(t.selling_plans.forEach(n=>{const i=`${t.id}-${n.id}`;e[i]=n}),e),{}),QO=r=>Array.isArray(r)?r:[];function Wi(r){const e=YO(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:sn(o.selling_plan)})),ranges:ZO(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:Hi(o.variant.featured_image),sku:o.sku||""}})),position:i}}),selling_plan_groups:r.selling_plan_groups.map(Qs),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(tf)}),n),{}),addons:r.addons.products.length?{collection_id:e.addons?.collection_id||"",collection_handle:e.addons?.collection_handle||"",products:r.addons.products.map(n=>({...rf(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=>({...ef(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:sn(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(tf)}:null,incentives:KO(r.incentives),filters:QO(r.filters)}}async function eI(r,e){return e?.source==="shopify_storefront"?tI():rI(r,e?.country_code)}async function rI(r,e){const{appName:t,appVersion:n}=j(),i={"X-Recharge-Sdk-Fn":"loadFromOnlineStore","X-Recharge-Sdk-Version":"1.78.2",...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 Wi(o)}const a=new FormData;a.append("form_type","localization"),a.append("_method","put"),a.append("return_to",`${Ko}/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 Wi(o)}catch{const o=await Fe("get",`/bundle-data/${r}`,{headers:i});return Wi(o)}}async function tI(r,e){if(!j().storeIdentifier)throw new Error("Store identifier is required for Shopify Storefront API requests");return{}}var nI=Object.freeze({__proto__:null,loadBundleData:eI}),iI=200,zi="__lodash_hash_undefined__",aI=1/0,nf=9007199254740991,oI="[object Arguments]",uI="[object Function]",sI="[object GeneratorFunction]",fI="[object Symbol]",cI=/[\\^$.*+?()[\]{}|]/g,lI=/^\[object .+?Constructor\]$/,dI=/^(?:0|[1-9]\d*)$/,pI=typeof D=="object"&&D&&D.Object===Object&&D,hI=typeof self=="object"&&self&&self.Object===Object&&self,Xi=pI||hI||Function("return this")();function yI(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 _I(r,e){var t=r?r.length:0;return!!t&&mI(r,e,0)>-1}function gI(r,e,t){for(var n=-1,i=r?r.length:0;++n<i;)if(t(e,r[n]))return!0;return!1}function af(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 Yi(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}function vI(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 mI(r,e,t){if(e!==e)return vI(r,wI,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function wI(r){return r!==r}function bI(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}function $I(r){return function(e){return r(e)}}function EI(r,e){return r.has(e)}function SI(r,e){return r?.[e]}function AI(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function of(r,e){return function(t){return r(e(t))}}var OI=Array.prototype,II=Function.prototype,fn=Object.prototype,Ki=Xi["__core-js_shared__"],uf=function(){var r=/[^.]+$/.exec(Ki&&Ki.keys&&Ki.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),sf=II.toString,ur=fn.hasOwnProperty,Zi=fn.toString,PI=RegExp("^"+sf.call(ur).replace(cI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ff=Xi.Symbol,xI=of(Object.getPrototypeOf,Object),TI=fn.propertyIsEnumerable,FI=OI.splice,cf=ff?ff.isConcatSpreadable:void 0,Ji=Object.getOwnPropertySymbols,lf=Math.max,RI=pf(Xi,"Map"),Wr=pf(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 MI(){this.__data__=Wr?Wr(null):{}}function DI(r){return this.has(r)&&delete this.__data__[r]}function CI(r){var e=this.__data__;if(Wr){var t=e[r];return t===zi?void 0:t}return ur.call(e,r)?e[r]:void 0}function NI(r){var e=this.__data__;return Wr?e[r]!==void 0:ur.call(e,r)}function BI(r,e){var t=this.__data__;return t[r]=Wr&&e===void 0?zi:e,this}Be.prototype.clear=MI,Be.prototype.delete=DI,Be.prototype.get=CI,Be.prototype.has=NI,Be.prototype.set=BI;function sr(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 qI(){this.__data__=[]}function UI(r){var e=this.__data__,t=ln(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():FI.call(e,t,1),!0}function kI(r){var e=this.__data__,t=ln(e,r);return t<0?void 0:e[t][1]}function LI(r){return ln(this.__data__,r)>-1}function jI(r,e){var t=this.__data__,n=ln(t,r);return n<0?t.push([r,e]):t[n][1]=e,this}sr.prototype.clear=qI,sr.prototype.delete=UI,sr.prototype.get=kI,sr.prototype.has=LI,sr.prototype.set=jI;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 VI(){this.__data__={hash:new Be,map:new(RI||sr),string:new Be}}function GI(r){return dn(this,r).delete(r)}function HI(r){return dn(this,r).get(r)}function WI(r){return dn(this,r).has(r)}function zI(r,e){return dn(this,r).set(r,e),this}fr.prototype.clear=VI,fr.prototype.delete=GI,fr.prototype.get=HI,fr.prototype.has=WI,fr.prototype.set=zI;function cn(r){var e=-1,t=r?r.length:0;for(this.__data__=new fr;++e<t;)this.add(r[e])}function XI(r){return this.__data__.set(r,zi),this}function YI(r){return this.__data__.has(r)}cn.prototype.add=cn.prototype.push=XI,cn.prototype.has=YI;function KI(r,e){var t=Qi(r)||hf(r)?bI(r.length,String):[],n=t.length,i=!!n;for(var a in r)(e||ur.call(r,a))&&!(i&&(a=="length"||sP(a,n)))&&t.push(a);return t}function ln(r,e){for(var t=r.length;t--;)if(yP(r[t][0],e))return t;return-1}function ZI(r,e,t,n){var i=-1,a=_I,o=!0,s=r.length,f=[],d=e.length;if(!s)return f;t&&(e=af(e,$I(t))),n?(a=gI,o=!1):e.length>=iI&&(a=EI,o=!1,e=new cn(e));e:for(;++i<s;){var c=r[i],u=t?t(c):c;if(c=n||c!==0?c:0,o&&u===u){for(var l=d;l--;)if(e[l]===u)continue e;f.push(c)}else a(e,u,n)||f.push(c)}return f}function df(r,e,t,n,i){var a=-1,o=r.length;for(t||(t=uP),i||(i=[]);++a<o;){var s=r[a];e>0&&t(s)?e>1?df(s,e-1,t,n,i):Yi(i,s):n||(i[i.length]=s)}return i}function JI(r,e,t){var n=e(r);return Qi(r)?n:Yi(n,t(r))}function QI(r){if(!ea(r)||cP(r))return!1;var e=_f(r)||AI(r)?PI:lI;return e.test(hP(r))}function eP(r){if(!ea(r))return dP(r);var e=lP(r),t=[];for(var n in r)n=="constructor"&&(e||!ur.call(r,n))||t.push(n);return t}function rP(r,e){return r=Object(r),tP(r,e,function(t,n){return n in r})}function tP(r,e,t){for(var n=-1,i=e.length,a={};++n<i;){var o=e[n],s=r[o];t(s,o)&&(a[o]=s)}return a}function nP(r,e){return e=lf(e===void 0?r.length-1:e,0),function(){for(var t=arguments,n=-1,i=lf(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,yI(r,this,o)}}function iP(r){return JI(r,mP,oP)}function dn(r,e){var t=r.__data__;return fP(e)?t[typeof e=="string"?"string":"hash"]:t.map}function pf(r,e){var t=SI(r,e);return QI(t)?t:void 0}var aP=Ji?of(Ji,Object):vf,oP=Ji?function(r){for(var e=[];r;)Yi(e,aP(r)),r=xI(r);return e}:vf;function uP(r){return Qi(r)||hf(r)||!!(cf&&r&&r[cf])}function sP(r,e){return e=e??nf,!!e&&(typeof r=="number"||dI.test(r))&&r>-1&&r%1==0&&r<e}function fP(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function cP(r){return!!uf&&uf in r}function lP(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||fn;return r===t}function dP(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}function pP(r){if(typeof r=="string"||vP(r))return r;var e=r+"";return e=="0"&&1/r==-aI?"-0":e}function hP(r){if(r!=null){try{return sf.call(r)}catch{}try{return r+""}catch{}}return""}function yP(r,e){return r===e||r!==r&&e!==e}function hf(r){return _P(r)&&ur.call(r,"callee")&&(!TI.call(r,"callee")||Zi.call(r)==oI)}var Qi=Array.isArray;function yf(r){return r!=null&&gP(r.length)&&!_f(r)}function _P(r){return gf(r)&&yf(r)}function _f(r){var e=ea(r)?Zi.call(r):"";return e==uI||e==sI}function gP(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=nf}function ea(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function gf(r){return!!r&&typeof r=="object"}function vP(r){return typeof r=="symbol"||gf(r)&&Zi.call(r)==fI}function mP(r){return yf(r)?KI(r,!0):eP(r)}var wP=nP(function(r,e){return r==null?{}:(e=af(df(e,1),pP),rP(r,ZI(iP(r),e)))});function vf(){return[]}var bP=wP,ra=we(bP);function $P(r){try{return JSON.parse(r)}catch{return r}}function EP(r){return Object.entries(r).reduce((e,[t,n])=>({...e,[t]:$P(n)}),{})}const mf=r=>typeof r=="string"?r!=="0"&&r!=="false":!!r;function wf(r){const e=EP(r),t=e.auto_inject===void 0?!0:e.auto_inject,n=e.display_on??[],i=e.first_option==="autodeliver";return{...ra(e,["display_on","first_option"]),auto_inject:t,valid_pages:n,is_subscription_first:i,autoInject:t,validPages:n,isSubscriptionFirst:i}}function bf(r){const e=r.subscription_options?.storefront_purchase_options==="subscription_only";return{...r,is_subscription_only:e,isSubscriptionOnly:e}}function SP(r){return r.map(e=>{const t={};return Object.entries(e).forEach(([n,i])=>{t[n]=bf(i)}),t})}const ta="2020-12",AP={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 na(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"?bf(n):n}async function $f(){return await pn("storeSettings",()=>At("get",`/${ta}/store_settings.json`).catch(()=>AP))}async function Ef(){const{widget_settings:r}=await pn("widgetSettings",()=>At("get",`/${ta}/widget_settings.json`));return wf(r)}async function Sf(){const{products:r,widget_settings:e,store_settings:t,meta:n}=await pn("productsAndSettings",()=>At("get",`/product/${ta}/products.json`));return n?.status==="error"?Promise.reject(n.message):{products:SP(r),widget_settings:wf(e),store_settings:t??{}}}async function OP(){const{products:r}=await Sf();return r}async function IP(r){const[e,t,n]=await Promise.all([na(r),$f(),Ef()]);return{product:e,store_settings:t,widget_settings:n,storeSettings:t,widgetSettings:n}}async function PP(r){const{bundle_product:e}=await na(r);return e}async function Af(){return Array.from(zr.keys()).forEach(r=>zr.delete(r))}var xP=Object.freeze({__proto__:null,getCDNBundleSettings:PP,getCDNProduct:na,getCDNProductAndSettings:IP,getCDNProducts:OP,getCDNProductsAndSettings:Sf,getCDNStoreSettings:$f,getCDNWidgetSettings:Ef,resetCDNCache:Af});async function TP(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 FP(r,e){return w("get","/charges",{query:e},v(r,"listCharges"))}async function RP(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 MP(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 DP(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 CP(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 NP(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 BP(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 qP=Object.freeze({__proto__:null,applyDiscountToCharge:RP,getCharge:TP,listCharges:FP,processCharge:NP,removeDiscountsFromCharge:MP,rescheduleCharge:BP,skipCharge:DP,unskipCharge:CP});async function Of(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 UP=Object.freeze({__proto__:null,productSearch:Of});async function If(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 kP(r,e){return w("get","/collections",{query:e},v(r,"listCollections"))}async function LP(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([If(n,e),Of(n,{...t,collection_ids:[e],limit:250})]);if(i==="manual")return{products:a.reduce((s,f)=>{const d=o.find(c=>c.external_product_id===f);return d&&s.push(d),s},[])};{const s=jP(i);return{products:o.slice().sort(s)}}}function Pf(r,e){const t=r.external_created_at,n=e.external_created_at;return t<n?-1:n>t?1:0}function xf(r,e){const t=r.external_product_id,n=e.external_product_id;return t<n?-1:n>t?1:0}function Tf(r,e){const t=r.title.toLowerCase(),n=e.title.toLowerCase();return t<n?-1:n>t?1:0}function jP(r){switch(r){case"created_at-asc":return Pf;case"created_at-desc":return(e,t)=>Pf(t,e);case"id-asc":return xf;case"id-desc":return(e,t)=>xf(t,e);case"title-asc":return Tf;case"title-desc":return(e,t)=>Tf(t,e)}}var VP=Object.freeze({__proto__:null,getCollection:If,listCollectionProducts:LP,listCollections:kP});async function GP(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 Ff(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 HP(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 WP(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 zP(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 XP(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 YP={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 KP(r,e,t){const n=r.customerId;if(!n)throw new Error("Not logged in.");const i=YP[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 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}},v(r,"getCreditSummary"));return n}var JP=Object.freeze({__proto__:null,getActiveChurnLandingPageURL:WP,getCreditSummary:ZP,getCustomer:GP,getCustomerPortalAccess:hn,getDeliverySchedule:HP,getFailedPaymentMethodRecoveryLandingPageURL:zP,getGiftRedemptionLandingPageURL:XP,sendCustomerNotification:KP,updateCustomer:Ff});async function QP(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 ex(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),Ff(v(r,"setApplyCreditsToNextCharge"),t)}async function rx(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 tx=Object.freeze({__proto__:null,getCreditSummary:QP,listCreditAccounts:rx,setApplyCreditsToNextCharge:ex});async function nx(r,e,t){return await w("post","/customer_surveys/cancellation_prevention",{data:{customer_id:e,subscription_id:t}},v(r,"getCustomerSurveyReasons"))}async function ix(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 ax(r,e){return await w("post","/offers/claim",{data:e},v(r,"claimOfferCustomerSurvey")),{}}var ox=Object.freeze({__proto__:null,claimOfferCustomerSurvey:ax,getCustomerSurveyOffers:ix,getCustomerSurveyReasons:nx});function ux(r,e){if(!r.customerId)throw new Error("Not logged in.");return w("get","/gift_purchases",{query:e},v(r,"listGiftPurchases"))}async function sx(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 fx=Object.freeze({__proto__:null,getGiftPurchase:sx,listGiftPurchases:ux});async function cx(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 lx(r,e){return w("get","/memberships",{query:e},v(r,"listMemberships"))}async function dx(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 px(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 hx(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 yx=Object.freeze({__proto__:null,activateMembership:px,cancelMembership:dx,changeMembership:hx,getMembership:cx,listMemberships:lx});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 gx(r,e){return w("get","/membership_programs",{query:e},v(r,"listMembershipPrograms"))}var vx=Object.freeze({__proto__:null,getMembershipProgram:_x,listMembershipPrograms:gx});async function mx(r,e){const{metafield:t}=await w("post","/metafields",{data:{metafield:e}},v(r,"createMetafield"));return t}async function wx(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 bx(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/metafields",{id:e},v(r,"deleteMetafield"))}var $x=Object.freeze({__proto__:null,createMetafield:mx,deleteMetafield:bx,updateMetafield:wx});async function Ex(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 Sx(r,e){return w("get","/onetimes",{query:e},v(r,"listOnetimes"))}async function Ax(r,e){const{onetime:t}=await w("post","/onetimes",{data:e},v(r,"createOnetime"));return t}async function Ox(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 Ix(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/onetimes",{id:e},v(r,"deleteOnetime"))}var Px=Object.freeze({__proto__:null,createOnetime:Ax,deleteOnetime:Ix,getOnetime:Ex,listOnetimes:Sx,updateOnetime:Ox});async function xx(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 Tx(r,e){return w("get","/orders",{query:e},v(r,"listOrders"))}async function Fx(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 Rx=Object.freeze({__proto__:null,delayOrder:Fx,getOrder:xx,listOrders:Tx});async function Mx(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 Dx(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 Rf(r,e){const{payment_method:t}=await w("post","/payment_methods",{data:{...e,customer_id:r.customerId}},v(r,"createPaymentMethod"));return t}async function Cx(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 Nx(r,e){return w("get","/payment_methods",{query:e},v(r,"listPaymentMethods"))}async function Bx(r,e){const t=await qx(r,e),n=t.external.environment_key,i=t.payment_method_intent_id,a=t.external_customer_id.ecommerce,o=t.external.resource_url,s=t.external.integrity_hash,f=t.payment_method?.processor_payment_method_token;await Mx(o,s);let d=!1,c=null,u=null,l=null;return{mount(p,_){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)),_?.onReady?.()}),window.Spreedly.on("fieldEvent",($,S,A,E)=>{_?.onFieldEvent?.($,S,A,E)}),window.Spreedly.on("errors",$=>{_?.onErrors?.($)}),window.Spreedly.on("paymentMethod",($,S)=>{c=$,_?.onPaymentMethod?.($,S),u&&(c=null,u($),u=null)})},tokenize(p){if(!d||!window.Spreedly)throw new Error("Payment form is not initialized");let _=String(p.year);_.length===2&&(_=`20${_}`);const $=String(p.month).padStart(2,"0");"full_name"in p?window.Spreedly.tokenizeCreditCard({full_name:p.full_name,month:$,year:_}):window.Spreedly.tokenizeCreditCard({first_name:p.first_name,last_name:p.last_name,month:$,year:_})},async submit(p){if(!d)throw new Error("Payment form is not initialized");if(c){const _=c;return c=null,Mf(r,_,p,{external_payment_method_id:f,payment_method_intent_id:i,external_customer_id:a})}return new Promise((_,$)=>{l=p,u=async S=>{try{const A=await Mf(r,S,l,{external_payment_method_id:f,payment_method_intent_id:i,external_customer_id:a});_(A)}catch(A){$(A)}finally{l=null}},this.tokenize(p.card_details)})},reset(){window.Spreedly&&window.Spreedly.reload(),c=null,u=null,l=null},unmount(){window.Spreedly&&window.Spreedly.removeHandlers(),d=!1,c=null,u=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,_){window.Spreedly.setFieldType(p,_)},setLabel(p,_){window.Spreedly.setLabel(p,_)},setNumberFormat(p){window.Spreedly.setNumberFormat(p)},setPlaceholder(p,_){window.Spreedly.setPlaceholder(p,_)},setStyle(p,_){window.Spreedly.setStyle(p,_)}}}async function qx(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 Mf(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:s,external_customer_id:f}){return await Rf(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:s,address_ids:i,external_payment_method_id:o,apply_to_all_subscription_addresses:a})}var Ux=Object.freeze({__proto__:null,createPaymentMethod:Rf,getPaymentMethod:Dx,initFrictionlessPaymentV1:Bx,listPaymentMethods:Nx,updatePaymentMethod:Cx});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 Lx(r,e){return w("get","/plans",{query:e},v(r,"listPlans"))}var jx=Object.freeze({__proto__:null,getPlan:kx,listPlans:Lx});async function Vx(r,e){return await w("get","/shop/shipping_countries",{query:e,headers:{"X-Recharge-Version":"2021-01"}},v(r,"getShippingCountries"))}async function Gx(r){return await w("get","/shop/settings",{headers:{"X-Recharge-Version":"2021-01"}},v(r,"getStoreSettings"))}var Hx=Object.freeze({__proto__:null,getShippingCountries:Vx,getStoreSettings:Gx}),Wx="Expected a function",Df="__lodash_placeholder__",qe=1,yn=2,zx=4,cr=8,Xr=16,Ue=32,Yr=64,Cf=128,Xx=256,Nf=512,Bf=1/0,Yx=9007199254740991,Kx=17976931348623157e292,qf=0/0,Zx=[["ary",Cf],["bind",qe],["bindKey",yn],["curry",cr],["curryRight",Xr],["flip",Nf],["partial",Ue],["partialRight",Yr],["rearg",Xx]],Jx="[object Function]",Qx="[object GeneratorFunction]",e2="[object Symbol]",r2=/[\\^$.*+?()[\]{}|]/g,t2=/^\s+|\s+$/g,n2=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,i2=/\{\n\/\* \[wrapped with (.+)\] \*/,a2=/,? & /,o2=/^[-+]0x[0-9a-f]+$/i,u2=/^0b[01]+$/i,s2=/^\[object .+?Constructor\]$/,f2=/^0o[0-7]+$/i,c2=/^(?:0|[1-9]\d*)$/,l2=parseInt,d2=typeof D=="object"&&D&&D.Object===Object&&D,p2=typeof self=="object"&&self&&self.Object===Object&&self,Kr=d2||p2||Function("return this")();function ia(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 h2(r,e){for(var t=-1,n=r?r.length:0;++t<n&&e(r[t],t,r)!==!1;);return r}function y2(r,e){var t=r?r.length:0;return!!t&&g2(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 g2(r,e,t){if(e!==e)return _2(r,v2,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function v2(r){return r!==r}function m2(r,e){for(var t=r.length,n=0;t--;)r[t]===e&&n++;return n}function w2(r,e){return r?.[e]}function b2(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function aa(r,e){for(var t=-1,n=r.length,i=0,a=[];++t<n;){var o=r[t];(o===e||o===Df)&&(r[t]=Df,a[i++]=t)}return a}var $2=Function.prototype,Uf=Object.prototype,oa=Kr["__core-js_shared__"],kf=function(){var r=/[^.]+$/.exec(oa&&oa.keys&&oa.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Lf=$2.toString,E2=Uf.hasOwnProperty,jf=Uf.toString,S2=RegExp("^"+Lf.call(E2).replace(r2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),A2=Object.create,lr=Math.max,O2=Math.min,Vf=function(){var r=Hf(Object,"defineProperty"),e=Hf.name;return e&&e.length>2?r:void 0}();function I2(r){return dr(r)?A2(r):{}}function P2(r){if(!dr(r)||k2(r))return!1;var e=G2(r)||b2(r)?S2:s2;return e.test(j2(r))}function x2(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,ia(r,this,o)}}function T2(r,e,t,n){for(var i=-1,a=r.length,o=t.length,s=-1,f=e.length,d=lr(a-o,0),c=Array(f+d),u=!n;++s<f;)c[s]=e[s];for(;++i<o;)(u||i<a)&&(c[t[i]]=r[i]);for(;d--;)c[s++]=r[i++];return c}function F2(r,e,t,n){for(var i=-1,a=r.length,o=-1,s=t.length,f=-1,d=e.length,c=lr(a-s,0),u=Array(c+d),l=!n;++i<c;)u[i]=r[i];for(var p=i;++f<d;)u[p+f]=e[f];for(;++o<s;)(l||i<a)&&(u[p+t[o]]=r[i++]);return u}function R2(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}function M2(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=I2(r.prototype),n=r.apply(t,e);return dr(n)?n:t}}function D2(r,e,t){var n=Zr(r);function i(){for(var a=arguments.length,o=Array(a),s=a,f=sa(i);s--;)o[s]=arguments[s];var d=a<3&&o[0]!==f&&o[a-1]!==f?[]:aa(o,f);if(a-=d.length,a<t)return Gf(r,e,ua,i.placeholder,void 0,o,d,void 0,void 0,t-a);var c=this&&this!==Kr&&this instanceof i?n:r;return ia(c,this,o)}return i}function ua(r,e,t,n,i,a,o,s,f,d){var c=e&Cf,u=e&qe,l=e&yn,p=e&(cr|Xr),_=e&Nf,$=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=m2(E,I);if(n&&(E=T2(E,n,i,p)),a&&(E=F2(E,a,o,p)),A-=T,p&&A<d){var F=aa(E,I);return Gf(r,e,ua,S.placeholder,t,E,F,s,f,d-A)}var b=u?t:this,g=l?b[r]:r;return A=E.length,s?E=L2(E,s):_&&A>1&&E.reverse(),c&&f<A&&(E.length=f),this&&this!==Kr&&this instanceof S&&(g=$||Zr(g)),g.apply(b,E)}return S}function C2(r,e,t,n){var i=e&qe,a=Zr(r);function o(){for(var s=-1,f=arguments.length,d=-1,c=n.length,u=Array(c+f),l=this&&this!==Kr&&this instanceof o?a:r;++d<c;)u[d]=n[d];for(;f--;)u[d++]=arguments[++s];return ia(l,i?t:this,u)}return o}function Gf(r,e,t,n,i,a,o,s,f,d){var c=e&cr,u=c?o:void 0,l=c?void 0:o,p=c?a:void 0,_=c?void 0:a;e|=c?Ue:Yr,e&=~(c?Yr:Ue),e&zx||(e&=~(qe|yn));var $=t(r,e,i,p,u,_,l,s,f,d);return $.placeholder=n,Wf($,r,e)}function N2(r,e,t,n,i,a,o,s){var f=e&yn;if(!f&&typeof r!="function")throw new TypeError(Wx);var d=n?n.length:0;if(d||(e&=~(Ue|Yr),n=i=void 0),o=o===void 0?o:lr(zf(o),0),s=s===void 0?s:zf(s),d-=i?i.length:0,e&Yr){var c=n,u=i;n=i=void 0}var l=[r,e,t,n,i,c,u,a,o,s];if(r=l[0],e=l[1],t=l[2],n=l[3],i=l[4],s=l[9]=l[9]==null?f?0:r.length:lr(l[9]-d,0),!s&&e&(cr|Xr)&&(e&=~(cr|Xr)),!e||e==qe)var p=M2(r,e,t);else e==cr||e==Xr?p=D2(r,e,s):(e==Ue||e==(qe|Ue))&&!i.length?p=C2(r,e,t,n):p=ua.apply(void 0,l);return Wf(p,r,e)}function sa(r){var e=r;return e.placeholder}function Hf(r,e){var t=w2(r,e);return P2(t)?t:void 0}function B2(r){var e=r.match(i2);return e?e[1].split(a2):[]}function q2(r,e){var t=e.length,n=t-1;return e[n]=(t>1?"& ":"")+e[n],e=e.join(t>2?", ":" "),r.replace(n2,`{
25
25
  /* [wrapped with `+e+`] */
26
26
  `)}function U2(r,e){return e=e??Yx,!!e&&(typeof r=="number"||c2.test(r))&&r>-1&&r%1==0&&r<e}function k2(r){return!!kf&&kf in r}function L2(r,e){for(var t=r.length,n=O2(e.length,t),i=R2(r);n--;){var a=e[n];r[n]=U2(a,t)?i[a]:void 0}return r}var Wf=Vf?function(r,e,t){var n=e+"";return Vf(r,"toString",{configurable:!0,enumerable:!1,value:Y2(q2(n,V2(B2(n),t)))})}:K2;function j2(r){if(r!=null){try{return Lf.call(r)}catch{}try{return r+""}catch{}}return""}function V2(r,e){return h2(Zx,function(t){var n="_."+t[0];e&t[1]&&!y2(r,n)&&r.push(n)}),r.sort()}var fa=x2(function(r,e){var t=aa(e,sa(fa));return N2(r,Ue,void 0,e,t)});function G2(r){var e=dr(r)?jf.call(r):"";return e==Jx||e==Qx}function dr(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function H2(r){return!!r&&typeof r=="object"}function W2(r){return typeof r=="symbol"||H2(r)&&jf.call(r)==e2}function z2(r){if(!r)return r===0?r:0;if(r=X2(r),r===Bf||r===-Bf){var e=r<0?-1:1;return e*Kx}return r===r?r:0}function zf(r){var e=z2(r),t=e%1;return e===e?t?e-t:e:0}function X2(r){if(typeof r=="number")return r;if(W2(r))return qf;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(t2,"");var t=u2.test(r);return t||f2.test(r)?l2(r.slice(2),t?2:8):o2.test(r)?qf:+r}function Y2(r){return function(){return r}}function K2(r){return r}fa.placeholder={};var Z2=fa,Xf=we(Z2);function J2(r,e){return{...ra(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 Q2(r,e){return{...ra(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 Yf(r){const{id:e,address_id:t,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:s,charge_interval_frequency:f,created_at:d,expire_after_specific_number_of_charges:c,shopify_product_id:u,shopify_variant_id:l,has_queued_charges:p,is_prepaid:_,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:g,product_title:m,properties:O,quantity:P,sku:B,sku_override:W,status:oe,updated_at:Y,variant_title:ke}=r;return{id:e,address_id:t,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:s,charge_interval_frequency:parseInt(f,10),created_at:d,expire_after_specific_number_of_charges:c,external_product_id:{ecommerce:`${u}`},external_variant_id:{ecommerce:`${l}`},has_queued_charges:mf(p),is_prepaid:_,is_skippable:$,is_swappable:S,max_retries_reached:mf(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:`${g}`,product_title:m??"",properties:O,quantity:P,sku:B,sku_override:W,status:oe.toLowerCase(),updated_at:Y,variant_title:ke}}async function eT(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 rT(r,e){return w("get","/subscriptions",{query:e},v(r,"listSubscriptions"))}async function tT(r,e,t){const{subscription:n}=await w("post","/subscriptions",{data:e,query:t},v(r,"createSubscription"));return n}async function nT(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 iT(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 aT(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 oT(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 sT(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 fT(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 cT(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=Xf(J2,i),s=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:s,commit_update:!!t?.commit},headers:{"X-Recharge-Version":"2021-01"},query:f},v(r,"createSubscriptions"));return d.map(Yf)}async function lT(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=Xf(Q2,!!n?.force_update),s=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:s,commit_update:!!n?.commit},headers:{"X-Recharge-Version":"2021-01"},query:f},v(r,"updateSubscriptions"));return d.map(Yf)}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.");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 pT=Object.freeze({__proto__:null,activateSubscription:uT,cancelSubscription:oT,createSubscription:tT,createSubscriptions:cT,deleteSubscriptions:dT,getSubscription:eT,listSubscriptions:rT,skipGiftSubscriptionCharge:fT,skipSubscriptionCharge:sT,updateSubscription:nT,updateSubscriptionAddress:aT,updateSubscriptionChargeDate:iT,updateSubscriptions:lT});const hT={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 yT(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.");sh({storeIdentifier:yT(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}),Af()}const Kf={init:_T,api:hT,address:bh,auth:Fh,bundle:XO,bundleData:nI,charge:qP,cdn:xP,collection:VP,credit:tx,customer:JP,customerSurveys:ox,gift:fx,membership:yx,membershipProgram:vx,metafield:$x,onetime:Px,order:Rx,paymentMethod:Ux,plan:jx,product:UP,store:Hx,subscription:pT};try{Kf.init()}catch{}return Kf});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rechargeapps/storefront-client",
3
3
  "description": "Storefront client for Recharge",
4
- "version": "1.78.1",
4
+ "version": "1.78.2",
5
5
  "author": "Recharge Inc.",
6
6
  "license": "MIT",
7
7
  "main": "dist/cjs/index.js",