@rechargeapps/storefront-client 1.91.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/cjs/api/auth.js +1 -1
  2. package/dist/cjs/api/auth.js.map +1 -1
  3. package/dist/cjs/api/bundle.js +2 -2
  4. package/dist/cjs/api/bundle.js.map +1 -1
  5. package/dist/cjs/api/bundleData.js +1 -1
  6. package/dist/cjs/api/bundleData.js.map +1 -1
  7. package/dist/cjs/api/customer.js +4 -2
  8. package/dist/cjs/api/customer.js.map +1 -1
  9. package/dist/cjs/api/subscription.js +3 -5
  10. package/dist/cjs/api/subscription.js.map +1 -1
  11. package/dist/cjs/mappers/cdn.js +1 -2
  12. package/dist/cjs/mappers/cdn.js.map +1 -1
  13. package/dist/cjs/mappers/subscription.js +2 -3
  14. package/dist/cjs/mappers/subscription.js.map +1 -1
  15. package/dist/cjs/mappers/utils.js +11 -0
  16. package/dist/cjs/mappers/utils.js.map +1 -1
  17. package/dist/cjs/utils/id.js +13 -0
  18. package/dist/cjs/utils/id.js.map +1 -0
  19. package/dist/cjs/utils/request.js +6 -11
  20. package/dist/cjs/utils/request.js.map +1 -1
  21. package/dist/esm/api/auth.js +1 -1
  22. package/dist/esm/api/auth.js.map +1 -1
  23. package/dist/esm/api/bundle.js +1 -1
  24. package/dist/esm/api/bundle.js.map +1 -1
  25. package/dist/esm/api/bundleData.js +1 -1
  26. package/dist/esm/api/bundleData.js.map +1 -1
  27. package/dist/esm/api/customer.js +4 -2
  28. package/dist/esm/api/customer.js.map +1 -1
  29. package/dist/esm/api/subscription.js +3 -5
  30. package/dist/esm/api/subscription.js.map +1 -1
  31. package/dist/esm/mappers/cdn.js +1 -2
  32. package/dist/esm/mappers/cdn.js.map +1 -1
  33. package/dist/esm/mappers/subscription.js +1 -2
  34. package/dist/esm/mappers/subscription.js.map +1 -1
  35. package/dist/esm/mappers/utils.js +11 -1
  36. package/dist/esm/mappers/utils.js.map +1 -1
  37. package/dist/esm/utils/id.js +11 -0
  38. package/dist/esm/utils/id.js.map +1 -0
  39. package/dist/esm/utils/request.js +5 -10
  40. package/dist/esm/utils/request.js.map +1 -1
  41. package/dist/umd/recharge-client.min.js +4 -19
  42. package/package.json +2 -10
@@ -1,26 +1,11 @@
1
- // recharge-client-1.91.0.min.js | MIT License | © Recharge Inc.
2
- (function(C,$e){typeof exports=="object"&&typeof module<"u"?module.exports=$e():typeof define=="function"&&define.amd?define($e):(C=typeof globalThis<"u"?globalThis:C||self,C.recharge=$e())})(this,function(){"use strict";var C=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $e(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function tc(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,H={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 nc(r){return r&&DataView.prototype.isPrototypeOf(r)}if(H.arrayBuffer)var ic=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],ac=ArrayBuffer.isView||function(r){return r&&ic.indexOf(Object.prototype.toString.call(r))>-1};function hr(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 mn(r){return typeof r!="string"&&(r=String(r)),r}function wn(r){var e={next:function(){var t=r.shift();return{done:t===void 0,value:t}}};return H.iterable&&(e[Symbol.iterator]=function(){return e}),e}function N(r){this.map={},r instanceof N?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)}N.prototype.append=function(r,e){r=hr(r),e=mn(e);var t=this.map[r];this.map[r]=t?t+", "+e:e},N.prototype.delete=function(r){delete this.map[hr(r)]},N.prototype.get=function(r){return r=hr(r),this.has(r)?this.map[r]:null},N.prototype.has=function(r){return this.map.hasOwnProperty(hr(r))},N.prototype.set=function(r,e){this.map[hr(r)]=mn(e)},N.prototype.forEach=function(r,e){for(var t in this.map)this.map.hasOwnProperty(t)&&r.call(e,this.map[t],t,this)},N.prototype.keys=function(){var r=[];return this.forEach(function(e,t){r.push(t)}),wn(r)},N.prototype.values=function(){var r=[];return this.forEach(function(e){r.push(e)}),wn(r)},N.prototype.entries=function(){var r=[];return this.forEach(function(e,t){r.push([t,e])}),wn(r)},H.iterable&&(N.prototype[Symbol.iterator]=N.prototype.entries);function bn(r){if(r.bodyUsed)return Promise.reject(new TypeError("Already read"));r.bodyUsed=!0}function ya(r){return new Promise(function(e,t){r.onload=function(){e(r.result)},r.onerror=function(){t(r.error)}})}function oc(r){var e=new FileReader,t=ya(e);return e.readAsArrayBuffer(r),t}function sc(r){var e=new FileReader,t=ya(e);return e.readAsText(r),t}function uc(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 ga(r){if(r.slice)return r.slice(0);var e=new Uint8Array(r.byteLength);return e.set(new Uint8Array(r)),e.buffer}function _a(){return this.bodyUsed=!1,this._initBody=function(r){this.bodyUsed=this.bodyUsed,this._bodyInit=r,r?typeof r=="string"?this._bodyText=r:H.blob&&Blob.prototype.isPrototypeOf(r)?this._bodyBlob=r:H.formData&&FormData.prototype.isPrototypeOf(r)?this._bodyFormData=r:H.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)?this._bodyText=r.toString():H.arrayBuffer&&H.blob&&nc(r)?(this._bodyArrayBuffer=ga(r.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):H.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(r)||ac(r))?this._bodyArrayBuffer=ga(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):H.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},H.blob&&(this.blob=function(){var r=bn(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=bn(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(oc)}),this.text=function(){var r=bn(this);if(r)return r;if(this._bodyBlob)return sc(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(uc(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},H.formData&&(this.formData=function(){return this.text().then(lc)}),this.json=function(){return this.text().then(JSON.parse)},this}var fc=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function cc(r){var e=r.toUpperCase();return fc.indexOf(e)>-1?e:r}function Ee(r,e){if(!(this instanceof Ee))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 Ee){if(r.bodyUsed)throw new TypeError("Already read");this.url=r.url,this.credentials=r.credentials,e.headers||(this.headers=new N(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 N(e.headers)),this.method=cc(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()}}}Ee.prototype.clone=function(){return new Ee(this,{body:this._bodyInit})};function lc(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 dc(r){var e=new N,t=r.replace(/\r?\n[\t ]+/g," ");return t.split("\r").map(function(n){return n.indexOf(`
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}_a.call(Ee.prototype);function J(r,e){if(!(this instanceof J))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 N(e.headers),this.url=e.url||"",this._initBody(r)}_a.call(J.prototype),J.prototype.clone=function(){return new J(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new N(this.headers),url:this.url})},J.error=function(){var r=new J(null,{status:0,statusText:""});return r.type="error",r};var pc=[301,302,303,307,308];J.redirect=function(r,e){if(pc.indexOf(e)===-1)throw new RangeError("Invalid status code");return new J(null,{status:e,headers:{location:r}})};var Se=k.DOMException;try{new Se}catch{Se=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},Se.prototype=Object.create(Error.prototype),Se.prototype.constructor=Se}function va(r,e){return new Promise(function(t,n){var i=new Ee(r,e);if(i.signal&&i.signal.aborted)return n(new Se("Aborted","AbortError"));var a=new XMLHttpRequest;function o(){a.abort()}a.onload=function(){var f={status:a.status,statusText:a.statusText,headers:dc(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 J(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 Se("Aborted","AbortError"))},0)};function u(f){try{return f===""&&k.location.href?k.location.href:f}catch{return f}}a.open(i.method,u(i.url),!0),i.credentials==="include"?a.withCredentials=!0:i.credentials==="omit"&&(a.withCredentials=!1),"responseType"in a&&(H.blob?a.responseType="blob":H.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 N)?Object.getOwnPropertyNames(e.headers).forEach(function(f){a.setRequestHeader(f,mn(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)})}va.polyfill=!0,k.fetch||(k.fetch=va,k.Headers=N,k.Request=Ee,k.Response=J),self.fetch.bind(self);let hc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",ma=(r=21)=>{let e="",t=r|0;for(;t--;)e+=hc[Math.random()*64|0];return e};var je=TypeError,Ve=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Q=[],X=[],yc=typeof Uint8Array<"u"?Uint8Array:Array,$n=!1;function wa(){$n=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=r.length;e<t;++e)Q[e]=r[e],X[r.charCodeAt(e)]=e;X["-".charCodeAt(0)]=62,X["_".charCodeAt(0)]=63}function gc(r){$n||wa();var e,t,n,i,a,o,u=r.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=r[u-2]==="="?2:r[u-1]==="="?1:0,o=new yc(u*3/4-a),n=a>0?u-4:u;var f=0;for(e=0,t=0;e<n;e+=4,t+=3)i=X[r.charCodeAt(e)]<<18|X[r.charCodeAt(e+1)]<<12|X[r.charCodeAt(e+2)]<<6|X[r.charCodeAt(e+3)],o[f++]=i>>16&255,o[f++]=i>>8&255,o[f++]=i&255;return a===2?(i=X[r.charCodeAt(e)]<<2|X[r.charCodeAt(e+1)]>>4,o[f++]=i&255):a===1&&(i=X[r.charCodeAt(e)]<<10|X[r.charCodeAt(e+1)]<<4|X[r.charCodeAt(e+2)]>>2,o[f++]=i>>8&255,o[f++]=i&255),o}function _c(r){return Q[r>>18&63]+Q[r>>12&63]+Q[r>>6&63]+Q[r&63]}function vc(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(_c(n));return i.join("")}function ba(r){$n||wa();for(var e,t=r.length,n=t%3,i="",a=[],o=16383,u=0,f=t-n;u<f;u+=o)a.push(vc(r,u,u+o>f?f:u+o));return n===1?(e=r[t-1],i+=Q[e>>2],i+=Q[e<<4&63],i+="=="):n===2&&(e=(r[t-2]<<8)+r[t-1],i+=Q[e>>10],i+=Q[e>>4&63],i+=Q[e<<2&63],i+="="),a.push(i),a.join("")}function et(r,e,t,n,i){var a,o,u=i*8-n-1,f=(1<<u)-1,d=f>>1,c=-7,s=t?i-1:0,l=t?-1:1,p=r[e+s];for(s+=l,a=p&(1<<-c)-1,p>>=-c,c+=u;c>0;a=a*256+r[e+s],s+=l,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=o*256+r[e+s],s+=l,c-=8);if(a===0)a=1-d;else{if(a===f)return o?NaN:(p?-1:1)*(1/0);o=o+Math.pow(2,n),a=a-d}return(p?-1:1)*o*Math.pow(2,a-n)}function $a(r,e,t,n,i,a){var o,u,f,d=a*8-i-1,c=(1<<d)-1,s=c>>1,l=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,g=n?1:-1,$=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+s>=1?e+=l/f:e+=l*Math.pow(2,1-s),e*f>=2&&(o++,f/=2),o+s>=c?(u=0,o=c):o+s>=1?(u=(e*f-1)*Math.pow(2,i),o=o+s):(u=e*Math.pow(2,s-1)*Math.pow(2,i),o=0));i>=8;r[t+p]=u&255,p+=g,u/=256,i-=8);for(o=o<<i|u,d+=i;d>0;r[t+p]=o&255,p+=g,o/=256,d-=8);r[t+p-g]|=$*128}var mc={}.toString,Ea=Array.isArray||function(r){return mc.call(r)=="[object Array]"};/*!
1
+ // recharge-client-2.0.0.min.js | MIT License | © Recharge Inc.
2
+ (function(ge,oe){typeof exports=="object"&&typeof module<"u"?module.exports=oe():typeof define=="function"&&define.amd?define(oe):(ge=typeof globalThis<"u"?globalThis:ge||self,ge.recharge=oe())})(this,function(){"use strict";const ge="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function oe(r=21){let e="";for(let t=0;t<r;t++)e+=ge[Math.random()*64|0];return e}let yt={storeIdentifier:"",environment:"prod"};function ua(r){yt=r}function q(){return yt}const ca=(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`}},la=(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}},fa=r=>{switch(r){case"prod":case"preprod":return"https://static.rechargecdn.com";case"stage":case"prestage":return"https://static.stage.rechargecdn.com"}},vt="/tools/recurring";class se{constructor(e,t){this.name="RechargeRequestError",this.message=e,this.status=t}}function T(r){return encodeURIComponent(`${r}`.trim())}function da(r){const e=t=>encodeURIComponent(t===null?"":String(t));return Object.entries(r).filter(([,t])=>t!==void 0&&!(Array.isArray(t)&&t.length===0)).map(([t,n])=>`${t}=${Array.isArray(n)?n.map(e).join(","):e(n)}`).join("&")}const ha=new Set(["shop_url"]);function y(r,e){return{...r,internalFnCall:r.internalFnCall??e,internalRequestId:r.internalRequestId??oe()}}async function ke(r,e,t={}){const n=q();return L(r,`${fa(n.environment)}/store/${n.storeIdentifier}${e}`,t)}async function v(r,e,{id:t,query:n,data:i,headers:a}={},o){const{environment:u,environmentUri:c,storeIdentifier:h,loginRetryFn:d,__unstable_twoFactorRetryFn:s,appName:_,appVersion:l}=q();if(!h)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const m=o.apiToken;if(!m)throw new Error("No API token defined on session.");const E=ca(u,c),I={"X-Recharge-Access-Token":m,"X-Recharge-Version":"2021-11","X-Recharge-Sdk-Fn":o.internalFnCall,..._?{"X-Recharge-Sdk-App-Name":_}:{},...l?{"X-Recharge-Sdk-App-Version":l}:{},"X-Recharge-Sdk-Version":"2.0.0","X-Request-Id":o.internalRequestId,...o.tmp_fn_identifier?{"X-Recharge-Sdk-Fn-Identifier":o.tmp_fn_identifier}:{},...a||{}},x=n,O={...x?Object.fromEntries(Object.entries(x).filter(([f])=>!ha.has(f))):void 0,shop_url:h};try{return await L(r,`${E}${e}`,{id:t,query:O,data:i,headers:I})}catch(f){if(d&&f instanceof se&&f.status===401)return d().then(S=>{if(S)return L(r,`${E}${e}`,{id:t,query:O,data:i,headers:{...I,"X-Recharge-Access-Token":S.apiToken}});throw f});if(s&&f instanceof se&&f.status===423)return s().then(S=>{if(S)return L(r,`${E}${e}`,{id:t,query:O,data:i,headers:{...I,"X-Recharge-Access-Token":S.apiToken}});throw f});throw f}}async function ee(r,e,t={}){return L(r,`${vt}${e}`,t)}async function L(r,e,{id:t,query:n,data:i,headers:a}={}){let o=e.trim();if(t&&(o=[o,T(t)].join("/")),n){let s;[o,s]=o.split("?");const _=[s,da(n)].join("&").replace(/^&/,"");o=`${o}${_?`?${_}`:""}`}let u;i&&r!=="get"&&(u=JSON.stringify(i));const c={Accept:"application/json","Content-Type":"application/json","X-Recharge-App":"storefront-client",...a||{}},h=await fetch(o,{method:r,headers:c,body:u});let d;try{d=await h.json()}catch{}if(!h.ok)throw h.status===502||h.status===504?new se("A gateway error occurred while making the request",h.status):d&&d.error?new se(d.error,h.status):d&&d.errors?new se(JSON.stringify(d.errors),h.status):new se("A connection error occurred while making the request");return d}function pa(r,e){return v("get","/addresses",{query:e},y(r,"listAddresses"))}async function _a(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{address:n}=await v("get","/addresses",{id:e,query:{include:t?.include}},y(r,"getAddress"));return n}async function ga(r,e){const{address:t}=await v("post","/addresses",{data:{...e,customer_id:r.customerId?Number(r.customerId):void 0}},y(r,"createAddress"));return t}async function Pr(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{address:i}=await v("put","/addresses",{id:e,data:t,query:n},y(r,"updateAddress"));return i}async function ya(r,e,t,n){return Pr(y(r,"applyDiscountToAddress"),e,{discounts:[{code:t}]},n)}async function va(r,e,t){if(e===void 0||e==="")throw new Error("Id is required");return Pr(y(r,"removeDiscountsFromAddress"),e,{discounts:[]},t)}function ma(r,e){if(e===void 0||e==="")throw new Error("ID is required");return v("delete","/addresses",{id:e},y(r,"deleteAddress"))}async function wa(r,e){const{address:t}=await v("post","/addresses/merge",{data:e},y(r,"mergeAddresses"));return t}async function ba(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await v("post",`/addresses/${T(e)}/charges/skip`,{data:t},y(r,"skipFutureCharge"));return n}var Ea=Object.freeze({__proto__:null,applyDiscountToAddress:ya,createAddress:ga,deleteAddress:ma,getAddress:_a,listAddresses:pa,mergeAddresses:wa,removeDiscountsFromAddress:va,skipFutureCharge:ba,updateAddress:Pr});async function $a(){const{storefrontAccessToken:r}=q(),e={};r&&(e["X-Recharge-Storefront-Access-Token"]=r);const t=await ee("get","/access",{headers:e});return{apiToken:t.api_token,customerId:t.customer_id,message:t.message}}async function Ia(r,e){return mt(r,e)}async function mt(r,e){if(!r)throw new Error("Shopify storefront token is required");const{storeIdentifier:t}=q();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 ye("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 Sa(r){const{storeIdentifier:e}=q();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 ye("post","/shopify_customer_account_api_access",{data:{customer_token:r,shop_url:e}});return t?{apiToken:t,customerId:n,message:i}:null}async function Aa(r,e={}){if(!r)throw new Error("Email is required.");const{storeIdentifier:t}=q();if(!t)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const{send_email:n,send_sms:i}=e,a=await ye("post","/attempt_login",{data:{email:r,shop:t,...n!==void 0?{send_email:n}:{},...i!==void 0?{send_sms:i}:{}}});if(a.errors)throw new Error(a.errors);return a.session_token}async function Oa(r,e={}){if(!r)throw new Error("Email is required.");const{storefrontAccessToken:t}=q(),n={};t&&(n["X-Recharge-Storefront-Access-Token"]=t);const{send_email:i,send_sms:a}=e,o=await ee("post","/attempt_login",{data:{email:r,...i!==void 0?{send_email:i}:{},...a!==void 0?{send_sms:a}:{}},headers:n});if(o.errors)throw new Error(o.errors);return o.session_token}async function xa(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}=q();if(!n)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const i=await ye("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 Ta(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}=q(),i={};n&&(i["X-Recharge-Storefront-Access-Token"]=n);const a=await ee("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 Pa(){const{customerHash:r}=q(),{pathname:e,search:t}=window.location,n=new URLSearchParams(t).get("token"),i=e.split("/").filter(Boolean),a=i.findIndex(u=>u==="portal"),o=a!==-1?i[a+1]:r;if(!n||!o)throw new Error("Not in context of Recharge Customer Portal or URL did not contain correct params");return{customerHash:o,token:n}}async function Fa(){const{customerHash:r,token:e}=Pa(),{storeIdentifier:t}=q(),n=await ye("post",`/customers/${T(r)}/access`,{data:{token:e,shop:t}});return{apiToken:n.api_token,customerId:n.customer_id}}async function ye(r,e,{id:t,query:n,data:i,headers:a}={}){const{environment:o,environmentUri:u,storefrontAccessToken:c,appName:h,appVersion:d}=q(),s=la(o,u),_={...c?{"X-Recharge-Storefront-Access-Token":c}:{},...h?{"X-Recharge-Sdk-App-Name":h}:{},...d?{"X-Recharge-Sdk-App-Version":d}:{},"X-Recharge-Sdk-Version":"2.0.0",...a||{}};return L(r,`${s}${e}`,{id:t,query:n,data:i,headers:_})}var Ra=Object.freeze({__proto__:null,loginCustomerPortal:Fa,loginShopifyApi:Ia,loginShopifyAppProxy:$a,loginWithShopifyCustomerAccount:Sa,loginWithShopifyStorefront:mt,sendPasswordlessCode:Aa,sendPasswordlessCodeAppProxy:Oa,validatePasswordlessCode:xa,validatePasswordlessCodeAppProxy:Ta}),ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},wt={},Fr={},W={},Ma=typeof ve=="object"&&ve&&ve.Object===Object&&ve,bt=Ma,Da=bt,Ca=typeof self=="object"&&self&&self.Object===Object&&self,qa=Da||Ca||Function("return this")(),z=qa,Na=z,ka=Na.Symbol,Ue=ka,Et=Ue,$t=Object.prototype,Ua=$t.hasOwnProperty,Ba=$t.toString,me=Et?Et.toStringTag:void 0;function La(r){var e=Ua.call(r,me),t=r[me];try{r[me]=void 0;var n=!0}catch{}var i=Ba.call(r);return n&&(e?r[me]=t:delete r[me]),i}var Va=La,ja=Object.prototype,Xa=ja.toString;function Ga(r){return Xa.call(r)}var Ha=Ga,It=Ue,Wa=Va,za=Ha,Ya="[object Null]",Ka="[object Undefined]",St=It?It.toStringTag:void 0;function Za(r){return r==null?r===void 0?Ka:Ya:St&&St in Object(r)?Wa(r):za(r)}var Z=Za;function Ja(r){return r!=null&&typeof r=="object"}var J=Ja,Qa=Z,eo=J,ro="[object Number]";function to(r){return typeof r=="number"||eo(r)&&Qa(r)==ro}var Be=to,At=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},j=[],U=[],no=typeof Uint8Array<"u"?Uint8Array:Array,Rr=!1;function Ot(){Rr=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=r.length;e<t;++e)j[e]=r[e],U[r.charCodeAt(e)]=e;U["-".charCodeAt(0)]=62,U["_".charCodeAt(0)]=63}function io(r){Rr||Ot();var e,t,n,i,a,o,u=r.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=r[u-2]==="="?2:r[u-1]==="="?1:0,o=new no(u*3/4-a),n=a>0?u-4:u;var c=0;for(e=0,t=0;e<n;e+=4,t+=3)i=U[r.charCodeAt(e)]<<18|U[r.charCodeAt(e+1)]<<12|U[r.charCodeAt(e+2)]<<6|U[r.charCodeAt(e+3)],o[c++]=i>>16&255,o[c++]=i>>8&255,o[c++]=i&255;return a===2?(i=U[r.charCodeAt(e)]<<2|U[r.charCodeAt(e+1)]>>4,o[c++]=i&255):a===1&&(i=U[r.charCodeAt(e)]<<10|U[r.charCodeAt(e+1)]<<4|U[r.charCodeAt(e+2)]>>2,o[c++]=i>>8&255,o[c++]=i&255),o}function ao(r){return j[r>>18&63]+j[r>>12&63]+j[r>>6&63]+j[r&63]}function oo(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(ao(n));return i.join("")}function xt(r){Rr||Ot();for(var e,t=r.length,n=t%3,i="",a=[],o=16383,u=0,c=t-n;u<c;u+=o)a.push(oo(r,u,u+o>c?c:u+o));return n===1?(e=r[t-1],i+=j[e>>2],i+=j[e<<4&63],i+="=="):n===2&&(e=(r[t-2]<<8)+r[t-1],i+=j[e>>10],i+=j[e>>4&63],i+=j[e<<2&63],i+="="),a.push(i),a.join("")}function Le(r,e,t,n,i){var a,o,u=i*8-n-1,c=(1<<u)-1,h=c>>1,d=-7,s=t?i-1:0,_=t?-1:1,l=r[e+s];for(s+=_,a=l&(1<<-d)-1,l>>=-d,d+=u;d>0;a=a*256+r[e+s],s+=_,d-=8);for(o=a&(1<<-d)-1,a>>=-d,d+=n;d>0;o=o*256+r[e+s],s+=_,d-=8);if(a===0)a=1-h;else{if(a===c)return o?NaN:(l?-1:1)*(1/0);o=o+Math.pow(2,n),a=a-h}return(l?-1:1)*o*Math.pow(2,a-n)}function Tt(r,e,t,n,i,a){var o,u,c,h=a*8-i-1,d=(1<<h)-1,s=d>>1,_=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:a-1,m=n?1:-1,E=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=d):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+s>=1?e+=_/c:e+=_*Math.pow(2,1-s),e*c>=2&&(o++,c/=2),o+s>=d?(u=0,o=d):o+s>=1?(u=(e*c-1)*Math.pow(2,i),o=o+s):(u=e*Math.pow(2,s-1)*Math.pow(2,i),o=0));i>=8;r[t+l]=u&255,l+=m,u/=256,i-=8);for(o=o<<i|u,h+=i;h>0;r[t+l]=o&255,l+=m,o/=256,h-=8);r[t+l-m]|=E*128}var so={}.toString,Pt=Array.isArray||function(r){return so.call(r)=="[object Array]"};/*!
4
3
  * The buffer module from node.js, for the browser.
5
4
  *
6
5
  * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
7
6
  * @license MIT
8
- */var wc=50;y.TYPED_ARRAY_SUPPORT=Ve.TYPED_ARRAY_SUPPORT!==void 0?Ve.TYPED_ARRAY_SUPPORT:!0,rt();function rt(){return y.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function fe(r,e){if(rt()<e)throw new RangeError("Invalid typed array length");return y.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=y.prototype):(r===null&&(r=new y(e)),r.length=e),r}function y(r,e,t){if(!y.TYPED_ARRAY_SUPPORT&&!(this instanceof y))return new y(r,e,t);if(typeof r=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return En(this,r)}return Sa(this,r,e,t)}y.poolSize=8192,y._augment=function(r){return r.__proto__=y.prototype,r};function Sa(r,e,t,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Ec(r,e,t,n):typeof e=="string"?$c(r,e,t):Sc(r,e)}y.from=function(r,e,t){return Sa(null,r,e,t)},y.TYPED_ARRAY_SUPPORT&&(y.prototype.__proto__=Uint8Array.prototype,y.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&y[Symbol.species]);function Aa(r){if(typeof r!="number")throw new TypeError('"size" argument must be a number');if(r<0)throw new RangeError('"size" argument must not be negative')}function bc(r,e,t,n){return Aa(e),e<=0?fe(r,e):t!==void 0?typeof n=="string"?fe(r,e).fill(t,n):fe(r,e).fill(t):fe(r,e)}y.alloc=function(r,e,t){return bc(null,r,e,t)};function En(r,e){if(Aa(e),r=fe(r,e<0?0:An(e)|0),!y.TYPED_ARRAY_SUPPORT)for(var t=0;t<e;++t)r[t]=0;return r}y.allocUnsafe=function(r){return En(null,r)},y.allocUnsafeSlow=function(r){return En(null,r)};function $c(r,e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!y.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var n=Oa(e,t)|0;r=fe(r,n);var i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function Sn(r,e){var t=e.length<0?0:An(e.length)|0;r=fe(r,t);for(var n=0;n<t;n+=1)r[n]=e[n]&255;return r}function Ec(r,e,t,n){if(e.byteLength,t<0||e.byteLength<t)throw new RangeError("'offset' is out of bounds");if(e.byteLength<t+(n||0))throw new RangeError("'length' is out of bounds");return t===void 0&&n===void 0?e=new Uint8Array(e):n===void 0?e=new Uint8Array(e,t):e=new Uint8Array(e,t,n),y.TYPED_ARRAY_SUPPORT?(r=e,r.__proto__=y.prototype):r=Sn(r,e),r}function Sc(r,e){if(ee(e)){var t=An(e.length)|0;return r=fe(r,t),r.length===0||e.copy(r,0,0,t),r}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Vc(e.length)?fe(r,0):Sn(r,e);if(e.type==="Buffer"&&Ea(e.data))return Sn(r,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function An(r){if(r>=rt())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+rt().toString(16)+" bytes");return r|0}y.isBuffer=Gc;function ee(r){return!!(r!=null&&r._isBuffer)}y.compare=function(e,t){if(!ee(e)||!ee(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,i=t.length,a=0,o=Math.min(n,i);a<o;++a)if(e[a]!==t[a]){n=e[a],i=t[a];break}return n<i?-1:i<n?1:0},y.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},y.concat=function(e,t){if(!Ea(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return y.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=y.allocUnsafe(t),a=0;for(n=0;n<e.length;++n){var o=e[n];if(!ee(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,a),a+=o.length}return i};function Oa(r,e){if(ee(r))return r.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(r)||r instanceof ArrayBuffer))return r.byteLength;typeof r!="string"&&(r=""+r);var t=r.length;if(t===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":case void 0:return it(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Ca(r).length;default:if(n)return it(r).length;e=(""+e).toLowerCase(),n=!0}}y.byteLength=Oa;function Ac(r,e,t){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Cc(this,e,t);case"utf8":case"utf-8":return Ta(this,e,t);case"ascii":return Mc(this,e,t);case"latin1":case"binary":return Dc(this,e,t);case"base64":return Fc(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Nc(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}y.prototype._isBuffer=!0;function Ae(r,e,t){var n=r[e];r[e]=r[t],r[t]=n}y.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Ae(this,t,t+1);return this},y.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Ae(this,t,t+3),Ae(this,t+1,t+2);return this},y.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Ae(this,t,t+7),Ae(this,t+1,t+6),Ae(this,t+2,t+5),Ae(this,t+3,t+4);return this},y.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?Ta(this,0,e):Ac.apply(this,arguments)},y.prototype.equals=function(e){if(!ee(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:y.compare(this,e)===0},y.prototype.inspect=function(){var e="",t=wc;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},y.prototype.compare=function(e,t,n,i,a){if(!ee(e))throw new TypeError("Argument must be a Buffer");if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),t<0||n>e.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&t>=n)return 0;if(i>=a)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,a>>>=0,this===e)return 0;for(var o=a-i,u=n-t,f=Math.min(o,u),d=this.slice(i,a),c=e.slice(t,n),s=0;s<f;++s)if(d[s]!==c[s]){o=d[s],u=c[s];break}return o<u?-1:u<o?1:0};function Ia(r,e,t,n,i){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,isNaN(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=y.from(e,n)),ee(e))return e.length===0?-1:Pa(r,e,t,n,i);if(typeof e=="number")return e=e&255,y.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Pa(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function Pa(r,e,t,n,i){var a=1,o=r.length,u=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;a=2,o/=2,u/=2,t/=2}function f(p,g){return a===1?p[g]:p.readUInt16BE(g*a)}var d;if(i){var c=-1;for(d=t;d<o;d++)if(f(r,d)===f(e,c===-1?0:d-c)){if(c===-1&&(c=d),d-c+1===u)return c*a}else c!==-1&&(d-=d-c),c=-1}else for(t+u>o&&(t=o-u),d=t;d>=0;d--){for(var s=!0,l=0;l<u;l++)if(f(r,d+l)!==f(e,l)){s=!1;break}if(s)return d}return-1}y.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},y.prototype.indexOf=function(e,t,n){return Ia(this,e,t,n,!0)},y.prototype.lastIndexOf=function(e,t,n){return Ia(this,e,t,n,!1)};function Oc(r,e,t,n){t=Number(t)||0;var i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;var a=e.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o<n;++o){var u=parseInt(e.substr(o*2,2),16);if(isNaN(u))return o;r[t+o]=u}return o}function Ic(r,e,t,n){return at(it(e,r.length-t),r,t,n)}function xa(r,e,t,n){return at(kc(e),r,t,n)}function Pc(r,e,t,n){return xa(r,e,t,n)}function xc(r,e,t,n){return at(Ca(e),r,t,n)}function Tc(r,e,t,n){return at(jc(e,r.length-t),r,t,n)}y.prototype.write=function(e,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a=this.length-t;if((n===void 0||n>a)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return Oc(this,e,t,n);case"utf8":case"utf-8":return Ic(this,e,t,n);case"ascii":return xa(this,e,t,n);case"latin1":case"binary":return Pc(this,e,t,n);case"base64":return xc(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Tc(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Fc(r,e,t){return e===0&&t===r.length?ba(r):ba(r.slice(e,t))}function Ta(r,e,t){t=Math.min(r.length,t);for(var n=[],i=e;i<t;){var a=r[i],o=null,u=a>239?4:a>223?3:a>191?2:1;if(i+u<=t){var f,d,c,s;switch(u){case 1:a<128&&(o=a);break;case 2:f=r[i+1],(f&192)===128&&(s=(a&31)<<6|f&63,s>127&&(o=s));break;case 3:f=r[i+1],d=r[i+2],(f&192)===128&&(d&192)===128&&(s=(a&15)<<12|(f&63)<<6|d&63,s>2047&&(s<55296||s>57343)&&(o=s));break;case 4:f=r[i+1],d=r[i+2],c=r[i+3],(f&192)===128&&(d&192)===128&&(c&192)===128&&(s=(a&15)<<18|(f&63)<<12|(d&63)<<6|c&63,s>65535&&s<1114112&&(o=s))}}o===null?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=u}return Rc(n)}var Fa=4096;function Rc(r){var e=r.length;if(e<=Fa)return String.fromCharCode.apply(String,r);for(var t="",n=0;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=Fa));return t}function Mc(r,e,t){var n="";t=Math.min(r.length,t);for(var i=e;i<t;++i)n+=String.fromCharCode(r[i]&127);return n}function Dc(r,e,t){var n="";t=Math.min(r.length,t);for(var i=e;i<t;++i)n+=String.fromCharCode(r[i]);return n}function Cc(r,e,t){var n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);for(var i="",a=e;a<t;++a)i+=Lc(r[a]);return i}function Nc(r,e,t){for(var n=r.slice(e,t),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+n[a+1]*256);return i}y.prototype.slice=function(e,t){var n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var i;if(y.TYPED_ARRAY_SUPPORT)i=this.subarray(e,t),i.__proto__=y.prototype;else{var a=t-e;i=new y(a,void 0);for(var o=0;o<a;++o)i[o]=this[o+e]}return i};function U(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}y.prototype.readUIntLE=function(e,t,n){e=e|0,t=t|0,n||U(e,t,this.length);for(var i=this[e],a=1,o=0;++o<t&&(a*=256);)i+=this[e+o]*a;return i},y.prototype.readUIntBE=function(e,t,n){e=e|0,t=t|0,n||U(e,t,this.length);for(var i=this[e+--t],a=1;t>0&&(a*=256);)i+=this[e+--t]*a;return i},y.prototype.readUInt8=function(e,t){return t||U(e,1,this.length),this[e]},y.prototype.readUInt16LE=function(e,t){return t||U(e,2,this.length),this[e]|this[e+1]<<8},y.prototype.readUInt16BE=function(e,t){return t||U(e,2,this.length),this[e]<<8|this[e+1]},y.prototype.readUInt32LE=function(e,t){return t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},y.prototype.readUInt32BE=function(e,t){return t||U(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},y.prototype.readIntLE=function(e,t,n){e=e|0,t=t|0,n||U(e,t,this.length);for(var i=this[e],a=1,o=0;++o<t&&(a*=256);)i+=this[e+o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*t)),i},y.prototype.readIntBE=function(e,t,n){e=e|0,t=t|0,n||U(e,t,this.length);for(var i=t,a=1,o=this[e+--i];i>0&&(a*=256);)o+=this[e+--i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*t)),o},y.prototype.readInt8=function(e,t){return t||U(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},y.prototype.readInt16LE=function(e,t){t||U(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},y.prototype.readInt16BE=function(e,t){t||U(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},y.prototype.readInt32LE=function(e,t){return t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},y.prototype.readInt32BE=function(e,t){return t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},y.prototype.readFloatLE=function(e,t){return t||U(e,4,this.length),et(this,e,!0,23,4)},y.prototype.readFloatBE=function(e,t){return t||U(e,4,this.length),et(this,e,!1,23,4)},y.prototype.readDoubleLE=function(e,t){return t||U(e,8,this.length),et(this,e,!0,52,8)},y.prototype.readDoubleBE=function(e,t){return t||U(e,8,this.length),et(this,e,!1,52,8)};function W(r,e,t,n,i,a){if(!ee(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<a)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError("Index out of range")}y.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t=t|0,n=n|0,!i){var a=Math.pow(2,8*n)-1;W(this,e,t,n,a,0)}var o=1,u=0;for(this[t]=e&255;++u<n&&(o*=256);)this[t+u]=e/o&255;return t+n},y.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t=t|0,n=n|0,!i){var a=Math.pow(2,8*n)-1;W(this,e,t,n,a,0)}var o=n-1,u=1;for(this[t+o]=e&255;--o>=0&&(u*=256);)this[t+o]=e/u&255;return t+n},y.prototype.writeUInt8=function(e,t,n){return e=+e,t=t|0,n||W(this,e,t,1,255,0),y.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e&255,t+1};function tt(r,e,t,n){e<0&&(e=65535+e+1);for(var i=0,a=Math.min(r.length-t,2);i<a;++i)r[t+i]=(e&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}y.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t|0,n||W(this,e,t,2,65535,0),y.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):tt(this,e,t,!0),t+2},y.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t|0,n||W(this,e,t,2,65535,0),y.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):tt(this,e,t,!1),t+2};function nt(r,e,t,n){e<0&&(e=4294967295+e+1);for(var i=0,a=Math.min(r.length-t,4);i<a;++i)r[t+i]=e>>>(n?i:3-i)*8&255}y.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t|0,n||W(this,e,t,4,4294967295,0),y.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255):nt(this,e,t,!0),t+4},y.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t|0,n||W(this,e,t,4,4294967295,0),y.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):nt(this,e,t,!1),t+4},y.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t|0,!i){var a=Math.pow(2,8*n-1);W(this,e,t,n,a-1,-a)}var o=0,u=1,f=0;for(this[t]=e&255;++o<n&&(u*=256);)e<0&&f===0&&this[t+o-1]!==0&&(f=1),this[t+o]=(e/u>>0)-f&255;return t+n},y.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t|0,!i){var a=Math.pow(2,8*n-1);W(this,e,t,n,a-1,-a)}var o=n-1,u=1,f=0;for(this[t+o]=e&255;--o>=0&&(u*=256);)e<0&&f===0&&this[t+o+1]!==0&&(f=1),this[t+o]=(e/u>>0)-f&255;return t+n},y.prototype.writeInt8=function(e,t,n){return e=+e,t=t|0,n||W(this,e,t,1,127,-128),y.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=e&255,t+1},y.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t|0,n||W(this,e,t,2,32767,-32768),y.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):tt(this,e,t,!0),t+2},y.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t|0,n||W(this,e,t,2,32767,-32768),y.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):tt(this,e,t,!1),t+2},y.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t|0,n||W(this,e,t,4,2147483647,-2147483648),y.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):nt(this,e,t,!0),t+4},y.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t|0,n||W(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),y.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):nt(this,e,t,!1),t+4};function Ra(r,e,t,n,i,a){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Ma(r,e,t,n,i){return i||Ra(r,e,t,4),$a(r,e,t,n,23,4),t+4}y.prototype.writeFloatLE=function(e,t,n){return Ma(this,e,t,!0,n)},y.prototype.writeFloatBE=function(e,t,n){return Ma(this,e,t,!1,n)};function Da(r,e,t,n,i){return i||Ra(r,e,t,8),$a(r,e,t,n,52,8),t+8}y.prototype.writeDoubleLE=function(e,t,n){return Da(this,e,t,!0,n)},y.prototype.writeDoubleBE=function(e,t,n){return Da(this,e,t,!1,n)},y.prototype.copy=function(e,t,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var a=i-n,o;if(this===e&&n<t&&t<i)for(o=a-1;o>=0;--o)e[o+t]=this[o+n];else if(a<1e3||!y.TYPED_ARRAY_SUPPORT)for(o=0;o<a;++o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+a),t);return a},y.prototype.fill=function(e,t,n,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),e.length===1){var a=e.charCodeAt(0);a<256&&(e=a)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!y.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof e=="number"&&(e=e&255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=t;o<n;++o)this[o]=e;else{var u=ee(e)?e:it(new y(e,i).toString()),f=u.length;for(o=0;o<n-t;++o)this[o+t]=u[o%f]}return this};var Bc=/[^+\/0-9A-Za-z-_]/g;function qc(r){if(r=Uc(r).replace(Bc,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Uc(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function Lc(r){return r<16?"0"+r.toString(16):r.toString(16)}function it(r,e){e=e||1/0;for(var t,n=r.length,i=null,a=[],o=0;o<n;++o){if(t=r.charCodeAt(o),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&a.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&a.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;a.push(t)}else if(t<2048){if((e-=2)<0)break;a.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;a.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;a.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return a}function kc(r){for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function jc(r,e){for(var t,n,i,a=[],o=0;o<r.length&&!((e-=2)<0);++o)t=r.charCodeAt(o),n=t>>8,i=t%256,a.push(i),a.push(n);return a}function Ca(r){return gc(qc(r))}function at(r,e,t,n){for(var i=0;i<n&&!(i+t>=e.length||i>=r.length);++i)e[i+t]=r[i];return i}function Vc(r){return r!==r}function Gc(r){return r!=null&&(!!r._isBuffer||Na(r)||Hc(r))}function Na(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Hc(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&Na(r.slice(0,0))}function Ba(){throw new Error("setTimeout has not been defined")}function qa(){throw new Error("clearTimeout has not been defined")}var ye=Ba,ge=qa;typeof Ve.setTimeout=="function"&&(ye=setTimeout),typeof Ve.clearTimeout=="function"&&(ge=clearTimeout);function Ua(r){if(ye===setTimeout)return setTimeout(r,0);if((ye===Ba||!ye)&&setTimeout)return ye=setTimeout,setTimeout(r,0);try{return ye(r,0)}catch{try{return ye.call(null,r,0)}catch{return ye.call(this,r,0)}}}function Wc(r){if(ge===clearTimeout)return clearTimeout(r);if((ge===qa||!ge)&&clearTimeout)return ge=clearTimeout,clearTimeout(r);try{return ge(r)}catch{try{return ge.call(null,r)}catch{return ge.call(this,r)}}}var ce=[],Ge=!1,Oe,ot=-1;function zc(){!Ge||!Oe||(Ge=!1,Oe.length?ce=Oe.concat(ce):ot=-1,ce.length&&La())}function La(){if(!Ge){var r=Ua(zc);Ge=!0;for(var e=ce.length;e;){for(Oe=ce,ce=[];++ot<e;)Oe&&Oe[ot].run();ot=-1,e=ce.length}Oe=null,Ge=!1,Wc(r)}}function Xc(r){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];ce.push(new ka(r,e)),ce.length===1&&!Ge&&Ua(La)}function ka(r,e){this.fun=r,this.array=e}ka.prototype.run=function(){this.fun.apply(null,this.array)};var Yc="browser",Kc="browser",Zc=!0,Jc={},Qc=[],el="",rl={},tl={},nl={};function Ie(){}var il=Ie,al=Ie,ol=Ie,sl=Ie,ul=Ie,fl=Ie,cl=Ie;function ll(r){throw new Error("process.binding is not supported")}function dl(){return"/"}function pl(r){throw new Error("process.chdir is not supported")}function hl(){return 0}var He=Ve.performance||{},yl=He.now||He.mozNow||He.msNow||He.oNow||He.webkitNow||function(){return new Date().getTime()};function gl(r){var e=yl.call(He)*.001,t=Math.floor(e),n=Math.floor(e%1*1e9);return r&&(t=t-r[0],n=n-r[1],n<0&&(t--,n+=1e9)),[t,n]}var _l=new Date;function vl(){var r=new Date,e=r-_l;return e/1e3}var We={nextTick:Xc,title:Yc,browser:Zc,env:Jc,argv:Qc,version:el,versions:rl,on:il,addListener:al,once:ol,off:sl,removeListener:ul,removeAllListeners:fl,emit:cl,binding:ll,cwd:dl,chdir:pl,umask:hl,hrtime:gl,platform:Kc,release:tl,config:nl,uptime:vl},On;typeof Object.create=="function"?On=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:On=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};var ja=On,Va=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++)n[t[i]]=Object.getOwnPropertyDescriptor(e,t[i]);return n},ml=/%[sdj%]/g;function st(r){if(!gr(r)){for(var e=[],t=0;t<arguments.length;t++)e.push(re(arguments[t]));return e.join(" ")}for(var t=1,n=arguments,i=n.length,a=String(r).replace(ml,function(u){if(u==="%%")return"%";if(t>=i)return u;switch(u){case"%s":return String(n[t++]);case"%d":return Number(n[t++]);case"%j":try{return JSON.stringify(n[t++])}catch{return"[Circular]"}default:return u}}),o=n[t];t<i;o=n[++t])yr(o)||!Pe(o)?a+=" "+o:a+=" "+re(o);return a}function In(r,e){if(te(Ve.process))return function(){return In(r,e).apply(this,arguments)};if(We.noDeprecation===!0)return r;var t=!1;function n(){if(!t){if(We.throwDeprecation)throw new Error(e);We.traceDeprecation?console.trace(e):console.error(e),t=!0}return r.apply(this,arguments)}return n}var ut={},Pn;function Ga(r){if(te(Pn)&&(Pn=We.env.NODE_DEBUG||""),r=r.toUpperCase(),!ut[r])if(new RegExp("\\b"+r+"\\b","i").test(Pn)){var e=0;ut[r]=function(){var t=st.apply(null,arguments);console.error("%s %d: %s",r,e,t)}}else ut[r]=function(){};return ut[r]}function re(r,e){var t={seen:[],stylize:bl};return arguments.length>=3&&(t.depth=arguments[2]),arguments.length>=4&&(t.colors=arguments[3]),ct(e)?t.showHidden=e:e&&Cn(t,e),te(t.showHidden)&&(t.showHidden=!1),te(t.depth)&&(t.depth=2),te(t.colors)&&(t.colors=!1),te(t.customInspect)&&(t.customInspect=!0),t.colors&&(t.stylize=wl),ft(t,r,t.depth)}re.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},re.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function wl(r,e){var t=re.styles[e];return t?"\x1B["+re.colors[t][0]+"m"+r+"\x1B["+re.colors[t][1]+"m":r}function bl(r,e){return r}function $l(r){var e={};return r.forEach(function(t,n){e[t]=!0}),e}function ft(r,e,t){if(r.customInspect&&e&&mr(e.inspect)&&e.inspect!==re&&!(e.constructor&&e.constructor.prototype===e)){var n=e.inspect(t,r);return gr(n)||(n=ft(r,n,t)),n}var i=El(r,e);if(i)return i;var a=Object.keys(e),o=$l(a);if(r.showHidden&&(a=Object.getOwnPropertyNames(e)),vr(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return xn(e);if(a.length===0){if(mr(e)){var u=e.name?": "+e.name:"";return r.stylize("[Function"+u+"]","special")}if(_r(e))return r.stylize(RegExp.prototype.toString.call(e),"regexp");if(lt(e))return r.stylize(Date.prototype.toString.call(e),"date");if(vr(e))return xn(e)}var f="",d=!1,c=["{","}"];if(Fn(e)&&(d=!0,c=["[","]"]),mr(e)){var s=e.name?": "+e.name:"";f=" [Function"+s+"]"}if(_r(e)&&(f=" "+RegExp.prototype.toString.call(e)),lt(e)&&(f=" "+Date.prototype.toUTCString.call(e)),vr(e)&&(f=" "+xn(e)),a.length===0&&(!d||e.length==0))return c[0]+f+c[1];if(t<0)return _r(e)?r.stylize(RegExp.prototype.toString.call(e),"regexp"):r.stylize("[Object]","special");r.seen.push(e);var l;return d?l=Sl(r,e,t,o,a):l=a.map(function(p){return Tn(r,e,t,o,p,d)}),r.seen.pop(),Al(l,f,c)}function El(r,e){if(te(e))return r.stylize("undefined","undefined");if(gr(e)){var t="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return r.stylize(t,"string")}if(Rn(e))return r.stylize(""+e,"number");if(ct(e))return r.stylize(""+e,"boolean");if(yr(e))return r.stylize("null","null")}function xn(r){return"["+Error.prototype.toString.call(r)+"]"}function Sl(r,e,t,n,i){for(var a=[],o=0,u=e.length;o<u;++o)Ka(e,String(o))?a.push(Tn(r,e,t,n,String(o),!0)):a.push("");return i.forEach(function(f){f.match(/^\d+$/)||a.push(Tn(r,e,t,n,f,!0))}),a}function Tn(r,e,t,n,i,a){var o,u,f;if(f=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},f.get?f.set?u=r.stylize("[Getter/Setter]","special"):u=r.stylize("[Getter]","special"):f.set&&(u=r.stylize("[Setter]","special")),Ka(n,i)||(o="["+i+"]"),u||(r.seen.indexOf(f.value)<0?(yr(t)?u=ft(r,f.value,null):u=ft(r,f.value,t-1),u.indexOf(`
9
- `)>-1&&(a?u=u.split(`
10
- `).map(function(d){return" "+d}).join(`
11
- `).substr(2):u=`
12
- `+u.split(`
13
- `).map(function(d){return" "+d}).join(`
14
- `))):u=r.stylize("[Circular]","special")),te(o)){if(a&&i.match(/^\d+$/))return u;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=r.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=r.stylize(o,"string"))}return o+": "+u}function Al(r,e,t){var n=r.reduce(function(i,a){return a.indexOf(`
15
- `)>=0,i+a.replace(/\u001b\[\d\d?m/g,"").length+1},0);return n>60?t[0]+(e===""?"":e+`
16
- `)+" "+r.join(`,
17
- `)+" "+t[1]:t[0]+e+" "+r.join(", ")+" "+t[1]}function Fn(r){return Array.isArray(r)}function ct(r){return typeof r=="boolean"}function yr(r){return r===null}function Ha(r){return r==null}function Rn(r){return typeof r=="number"}function gr(r){return typeof r=="string"}function Wa(r){return typeof r=="symbol"}function te(r){return r===void 0}function _r(r){return Pe(r)&&Mn(r)==="[object RegExp]"}function Pe(r){return typeof r=="object"&&r!==null}function lt(r){return Pe(r)&&Mn(r)==="[object Date]"}function vr(r){return Pe(r)&&(Mn(r)==="[object Error]"||r instanceof Error)}function mr(r){return typeof r=="function"}function za(r){return r===null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||typeof r=="symbol"||typeof r>"u"}function Xa(r){return y.isBuffer(r)}function Mn(r){return Object.prototype.toString.call(r)}function Dn(r){return r<10?"0"+r.toString(10):r.toString(10)}var Ol=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Il(){var r=new Date,e=[Dn(r.getHours()),Dn(r.getMinutes()),Dn(r.getSeconds())].join(":");return[r.getDate(),Ol[r.getMonth()],e].join(" ")}function Ya(){console.log("%s - %s",Il(),st.apply(null,arguments))}function Cn(r,e){if(!e||!Pe(e))return r;for(var t=Object.keys(e),n=t.length;n--;)r[t[n]]=e[t[n]];return r}function Ka(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var xe=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function Nn(r){if(typeof r!="function")throw new TypeError('The "original" argument must be of type Function');if(xe&&r[xe]){var e=r[xe];if(typeof e!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,xe,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var t,n,i=new Promise(function(u,f){t=u,n=f}),a=[],o=0;o<arguments.length;o++)a.push(arguments[o]);a.push(function(u,f){u?n(u):t(f)});try{r.apply(this,a)}catch(u){n(u)}return i}return Object.setPrototypeOf(e,Object.getPrototypeOf(r)),xe&&Object.defineProperty(e,xe,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,Va(r))}Nn.custom=xe;function Pl(r,e){if(!r){var t=new Error("Promise was rejected with a falsy value");t.reason=r,r=t}return e(r)}function Za(r){if(typeof r!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var t=[],n=0;n<arguments.length;n++)t.push(arguments[n]);var i=t.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var a=this,o=function(){return i.apply(a,arguments)};r.apply(this,t).then(function(u){We.nextTick(o.bind(null,null,u))},function(u){We.nextTick(Pl.bind(null,u,o))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(r)),Object.defineProperties(e,Va(r)),e}var xl={inherits:ja,_extend:Cn,log:Ya,isBuffer:Xa,isPrimitive:za,isFunction:mr,isError:vr,isDate:lt,isObject:Pe,isRegExp:_r,isUndefined:te,isSymbol:Wa,isString:gr,isNumber:Rn,isNullOrUndefined:Ha,isNull:yr,isBoolean:ct,isArray:Fn,inspect:re,deprecate:In,format:st,debuglog:Ga,promisify:Nn,callbackify:Za},Tl=Object.freeze({__proto__:null,_extend:Cn,callbackify:Za,debuglog:Ga,default:xl,deprecate:In,format:st,inherits:ja,inspect:re,isArray:Fn,isBoolean:ct,isBuffer:Xa,isDate:lt,isError:vr,isFunction:mr,isNull:yr,isNullOrUndefined:Ha,isNumber:Rn,isObject:Pe,isPrimitive:za,isRegExp:_r,isString:gr,isSymbol:Wa,isUndefined:te,log:Ya,promisify:Nn}),Fl=tc(Tl),Rl=Fl.inspect,Bn=typeof Map=="function"&&Map.prototype,qn=Object.getOwnPropertyDescriptor&&Bn?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,dt=Bn&&qn&&typeof qn.get=="function"?qn.get:null,Ja=Bn&&Map.prototype.forEach,Un=typeof Set=="function"&&Set.prototype,Ln=Object.getOwnPropertyDescriptor&&Un?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,pt=Un&&Ln&&typeof Ln.get=="function"?Ln.get:null,Qa=Un&&Set.prototype.forEach,Ml=typeof WeakMap=="function"&&WeakMap.prototype,wr=Ml?WeakMap.prototype.has:null,Dl=typeof WeakSet=="function"&&WeakSet.prototype,br=Dl?WeakSet.prototype.has:null,Cl=typeof WeakRef=="function"&&WeakRef.prototype,eo=Cl?WeakRef.prototype.deref:null,Nl=Boolean.prototype.valueOf,Bl=Object.prototype.toString,ql=Function.prototype.toString,Ul=String.prototype.match,kn=String.prototype.slice,_e=String.prototype.replace,Ll=String.prototype.toUpperCase,ro=String.prototype.toLowerCase,to=RegExp.prototype.test,no=Array.prototype.concat,ne=Array.prototype.join,kl=Array.prototype.slice,io=Math.floor,jn=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Vn=Object.getOwnPropertySymbols,Gn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ze=typeof Symbol=="function"&&typeof Symbol.iterator=="object",$r=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ze||"symbol")?Symbol.toStringTag:null,ao=Object.prototype.propertyIsEnumerable,oo=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function so(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||to.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-io(-r):io(r);if(n!==r){var i=String(n),a=kn.call(e,i.length+1);return _e.call(i,t,"$&_")+"."+_e.call(_e.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _e.call(e,t,"$&_")}var Hn=Rl,uo=Hn.custom,fo=ho(uo)?uo:null,co={__proto__:null,double:'"',single:"'"},jl={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},ht=function r(e,t,n,i){var a=t||{};if(le(a,"quoteStyle")&&!le(co,a.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(le(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=le(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(le(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(le(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=a.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return go(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var f=String(e);return u?so(e,f):f}if(typeof e=="bigint"){var d=String(e)+"n";return u?so(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 Wn(e)?"[Array]":"[Object]";var s=od(a,n);if(typeof i>"u")i=[];else if(yo(i,e)>=0)return"[Circular]";function l(z,ue,Z){if(ue&&(i=kl.call(i),i.push(ue)),Z){var ke={depth:a.depth};return le(a,"quoteStyle")&&(ke.quoteStyle=a.quoteStyle),r(z,ke,n+1,i)}return r(z,a,n+1,i)}if(typeof e=="function"&&!po(e)){var p=Zl(e),g=yt(e,l);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(g.length>0?" { "+ne.call(g,", ")+" }":"")}if(ho(e)){var $=ze?_e.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Gn.call(e);return typeof e=="object"&&!ze?Er($):$}if(nd(e)){for(var E="<"+ro.call(String(e.nodeName)),A=e.attributes||[],S=0;S<A.length;S++)E+=" "+A[S].name+"="+lo(Vl(A[S].value),"double",a);return E+=">",e.childNodes&&e.childNodes.length&&(E+="..."),E+="</"+ro.call(String(e.nodeName))+">",E}if(Wn(e)){if(e.length===0)return"[]";var h=yt(e,l);return s&&!ad(h)?"["+Xn(h,s)+"]":"[ "+ne.call(h,", ")+" ]"}if(Hl(e)){var O=yt(e,l);return!("cause"in Error.prototype)&&"cause"in e&&!ao.call(e,"cause")?"{ ["+String(e)+"] "+ne.call(no.call("[cause]: "+l(e.cause),O),", ")+" }":O.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+ne.call(O,", ")+" }"}if(typeof e=="object"&&o){if(fo&&typeof e[fo]=="function"&&Hn)return Hn(e,{depth:c-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Jl(e)){var T=[];return Ja&&Ja.call(e,function(z,ue){T.push(l(ue,e,!0)+" => "+l(z,e))}),_o("Map",dt.call(e),T,s)}if(rd(e)){var R=[];return Qa&&Qa.call(e,function(z){R.push(l(z,e))}),_o("Set",pt.call(e),R,s)}if(Ql(e))return zn("WeakMap");if(td(e))return zn("WeakSet");if(ed(e))return zn("WeakRef");if(zl(e))return Er(l(Number(e)));if(Yl(e))return Er(l(jn.call(e)));if(Xl(e))return Er(Nl.call(e));if(Wl(e))return Er(l(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof C<"u"&&e===C)return"{ [object globalThis] }";if(!Gl(e)&&!po(e)){var b=yt(e,l),_=oo?oo(e)===Object.prototype:e instanceof Object||e.constructor===Object,m=e instanceof Object?"":"null prototype",I=!_&&$r&&Object(e)===e&&$r in e?kn.call(ve(e),8,-1):m?"Object":"",P=_||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",q=P+(I||m?"["+ne.call(no.call([],I||[],m||[]),": ")+"] ":"");return b.length===0?q+"{}":s?q+"{"+Xn(b,s)+"}":q+"{ "+ne.call(b,", ")+" }"}return String(e)};function lo(r,e,t){var n=t.quoteStyle||e,i=co[n];return i+r+i}function Vl(r){return _e.call(String(r),/"/g,"&quot;")}function Te(r){return!$r||!(typeof r=="object"&&($r in r||typeof r[$r]<"u"))}function Wn(r){return ve(r)==="[object Array]"&&Te(r)}function Gl(r){return ve(r)==="[object Date]"&&Te(r)}function po(r){return ve(r)==="[object RegExp]"&&Te(r)}function Hl(r){return ve(r)==="[object Error]"&&Te(r)}function Wl(r){return ve(r)==="[object String]"&&Te(r)}function zl(r){return ve(r)==="[object Number]"&&Te(r)}function Xl(r){return ve(r)==="[object Boolean]"&&Te(r)}function ho(r){if(ze)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Gn)return!1;try{return Gn.call(r),!0}catch{}return!1}function Yl(r){if(!r||typeof r!="object"||!jn)return!1;try{return jn.call(r),!0}catch{}return!1}var Kl=Object.prototype.hasOwnProperty||function(r){return r in this};function le(r,e){return Kl.call(r,e)}function ve(r){return Bl.call(r)}function Zl(r){if(r.name)return r.name;var e=Ul.call(ql.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function yo(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 Jl(r){if(!dt||!r||typeof r!="object")return!1;try{dt.call(r);try{pt.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function Ql(r){if(!wr||!r||typeof r!="object")return!1;try{wr.call(r,wr);try{br.call(r,br)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function ed(r){if(!eo||!r||typeof r!="object")return!1;try{return eo.call(r),!0}catch{}return!1}function rd(r){if(!pt||!r||typeof r!="object")return!1;try{pt.call(r);try{dt.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function td(r){if(!br||!r||typeof r!="object")return!1;try{br.call(r,br);try{wr.call(r,wr)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function nd(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function go(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return go(kn.call(r,0,e.maxStringLength),e)+n}var i=jl[e.quoteStyle||"single"];i.lastIndex=0;var a=_e.call(_e.call(r,i,"\\$1"),/[\x00-\x1f]/g,id);return lo(a,"single",e)}function id(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":"")+Ll.call(e.toString(16))}function Er(r){return"Object("+r+")"}function zn(r){return r+" { ? }"}function _o(r,e,t,n){var i=n?Xn(t,n):ne.call(t,", ");return r+" ("+e+") {"+i+"}"}function ad(r){for(var e=0;e<r.length;e++)if(yo(r[e],`
18
- `)>=0)return!1;return!0}function od(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=ne.call(Array(r.indent+1)," ");else return null;return{base:t,prev:ne.call(Array(e+1),t)}}function Xn(r,e){if(r.length===0)return"";var t=`
19
- `+e.prev+e.base;return t+ne.call(r,","+t)+`
20
- `+e.prev}function yt(r,e){var t=Wn(r),n=[];if(t){n.length=r.length;for(var i=0;i<r.length;i++)n[i]=le(r,i)?e(r[i],r):""}var a=typeof Vn=="function"?Vn(r):[],o;if(ze){o={};for(var u=0;u<a.length;u++)o["$"+a[u]]=a[u]}for(var f in r)le(r,f)&&(t&&String(Number(f))===f&&f<r.length||ze&&o["$"+f]instanceof Symbol||(to.call(/[^\w$]/,f)?n.push(e(f,r)+": "+e(r[f],r)):n.push(f+": "+e(r[f],r))));if(typeof Vn=="function")for(var d=0;d<a.length;d++)ao.call(r,a[d])&&n.push("["+e(a[d])+"]: "+e(r[a[d]],r));return n}var sd=ht,ud=je,gt=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},fd=function(r,e){if(r){var t=gt(r,e);return t&&t.value}},cd=function(r,e,t){var n=gt(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},ld=function(r,e){return r?!!gt(r,e):!1},dd=function(r,e){if(r)return gt(r,e,!0)},pd=function(){var e,t={assert:function(n){if(!t.has(n))throw new ud("Side channel does not contain "+sd(n))},delete:function(n){var i=e&&e.next,a=dd(e,n);return a&&i&&i===a&&(e=void 0),!!a},get:function(n){return fd(e,n)},has:function(n){return ld(e,n)},set:function(n,i){e||(e={next:void 0}),cd(e,n,i)}};return t},vo=Object,hd=Error,yd=EvalError,gd=RangeError,_d=ReferenceError,vd=SyntaxError,md=URIError,wd=Math.abs,bd=Math.floor,$d=Math.max,Ed=Math.min,Sd=Math.pow,Ad=Math.round,Od=Number.isNaN||function(e){return e!==e},Id=Od,Pd=function(e){return Id(e)||e===0?e:e<0?-1:1},xd=Object.getOwnPropertyDescriptor,_t=xd;if(_t)try{_t([],"length")}catch{_t=null}var mo=_t,vt=Object.defineProperty||!1;if(vt)try{vt({},"a",{value:1})}catch{vt=!1}var Td=vt,Yn,wo;function Fd(){return wo||(wo=1,Yn=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var a in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var u=Object.getOwnPropertyDescriptor(e,t);if(u.value!==i||u.enumerable!==!0)return!1}return!0}),Yn}var Kn,bo;function Rd(){if(bo)return Kn;bo=1;var r=typeof Symbol<"u"&&Symbol,e=Fd();return Kn=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Kn}var Zn,$o;function Eo(){return $o||($o=1,Zn=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Zn}var Jn,So;function Ao(){if(So)return Jn;So=1;var r=vo;return Jn=r.getPrototypeOf||null,Jn}var Qn,Oo;function Md(){if(Oo)return Qn;Oo=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,n="[object Function]",i=function(f,d){for(var c=[],s=0;s<f.length;s+=1)c[s]=f[s];for(var l=0;l<d.length;l+=1)c[l+f.length]=d[l];return c},a=function(f,d){for(var c=[],s=d||0,l=0;s<f.length;s+=1,l+=1)c[l]=f[s];return c},o=function(u,f){for(var d="",c=0;c<u.length;c+=1)d+=u[c],c+1<u.length&&(d+=f);return d};return Qn=function(f){var d=this;if(typeof d!="function"||e.apply(d)!==n)throw new TypeError(r+d);for(var c=a(arguments,1),s,l=function(){if(this instanceof s){var A=d.apply(this,i(c,arguments));return Object(A)===A?A:this}return d.apply(f,i(c,arguments))},p=t(0,d.length-c.length),g=[],$=0;$<p;$++)g[$]="$"+$;if(s=Function("binder","return function ("+o(g,",")+"){ return binder.apply(this,arguments); }")(l),d.prototype){var E=function(){};E.prototype=d.prototype,s.prototype=new E,E.prototype=null}return s},Qn}var ei,Io;function mt(){if(Io)return ei;Io=1;var r=Md();return ei=Function.prototype.bind||r,ei}var ri,Po;function ti(){return Po||(Po=1,ri=Function.prototype.call),ri}var ni,xo;function To(){return xo||(xo=1,ni=Function.prototype.apply),ni}var Dd=typeof Reflect<"u"&&Reflect&&Reflect.apply,Cd=mt(),Nd=To(),Bd=ti(),qd=Dd,Ud=qd||Cd.call(Bd,Nd),Ld=mt(),kd=je,jd=ti(),Vd=Ud,Fo=function(e){if(e.length<1||typeof e[0]!="function")throw new kd("a function is required");return Vd(Ld,jd,e)},ii,Ro;function Gd(){if(Ro)return ii;Ro=1;var r=Fo,e=mo,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 ii=n&&typeof n.get=="function"?r([n.get]):typeof a=="function"?function(u){return a(u==null?u:i(u))}:!1,ii}var ai,Mo;function Hd(){if(Mo)return ai;Mo=1;var r=Eo(),e=Ao(),t=Gd();return ai=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,ai}var oi,Do;function Wd(){if(Do)return oi;Do=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=mt();return oi=t.call(r,e),oi}var x,zd=vo,Xd=hd,Yd=yd,Kd=gd,Zd=_d,Xe=vd,Ye=je,Jd=md,Qd=wd,ep=bd,rp=$d,tp=Ed,np=Sd,ip=Ad,ap=Pd,Co=Function,si=function(r){try{return Co('"use strict"; return ('+r+").constructor;")()}catch{}},Sr=mo,op=Td,ui=function(){throw new Ye},sp=Sr?function(){try{return arguments.callee,ui}catch{try{return Sr(arguments,"callee").get}catch{return ui}}}():ui,Ke=Rd()(),L=Hd(),up=Ao(),fp=Eo(),No=To(),Ar=ti(),Ze={},cp=typeof Uint8Array>"u"||!L?x:L(Uint8Array),Fe={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?x:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?x:ArrayBuffer,"%ArrayIteratorPrototype%":Ke&&L?L([][Symbol.iterator]()):x,"%AsyncFromSyncIteratorPrototype%":x,"%AsyncFunction%":Ze,"%AsyncGenerator%":Ze,"%AsyncGeneratorFunction%":Ze,"%AsyncIteratorPrototype%":Ze,"%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%":Xd,"%eval%":eval,"%EvalError%":Yd,"%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%":Co,"%GeneratorFunction%":Ze,"%Int8Array%":typeof Int8Array>"u"?x:Int8Array,"%Int16Array%":typeof Int16Array>"u"?x:Int16Array,"%Int32Array%":typeof Int32Array>"u"?x:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ke&&L?L(L([][Symbol.iterator]())):x,"%JSON%":typeof JSON=="object"?JSON:x,"%Map%":typeof Map>"u"?x:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ke||!L?x:L(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":zd,"%Object.getOwnPropertyDescriptor%":Sr,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?x:Promise,"%Proxy%":typeof Proxy>"u"?x:Proxy,"%RangeError%":Kd,"%ReferenceError%":Zd,"%Reflect%":typeof Reflect>"u"?x:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?x:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ke||!L?x:L(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?x:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ke&&L?L(""[Symbol.iterator]()):x,"%Symbol%":Ke?Symbol:x,"%SyntaxError%":Xe,"%ThrowTypeError%":sp,"%TypedArray%":cp,"%TypeError%":Ye,"%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%":Jd,"%WeakMap%":typeof WeakMap>"u"?x:WeakMap,"%WeakRef%":typeof WeakRef>"u"?x:WeakRef,"%WeakSet%":typeof WeakSet>"u"?x:WeakSet,"%Function.prototype.call%":Ar,"%Function.prototype.apply%":No,"%Object.defineProperty%":op,"%Object.getPrototypeOf%":up,"%Math.abs%":Qd,"%Math.floor%":ep,"%Math.max%":rp,"%Math.min%":tp,"%Math.pow%":np,"%Math.round%":ip,"%Math.sign%":ap,"%Reflect.getPrototypeOf%":fp};if(L)try{null.error}catch(r){var lp=L(L(r));Fe["%Error.prototype%"]=lp}var dp=function r(e){var t;if(e==="%AsyncFunction%")t=si("async function () {}");else if(e==="%GeneratorFunction%")t=si("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=si("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&L&&(t=L(i.prototype))}return Fe[e]=t,t},Bo={__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"]},Or=mt(),wt=Wd(),pp=Or.call(Ar,Array.prototype.concat),hp=Or.call(No,Array.prototype.splice),qo=Or.call(Ar,String.prototype.replace),bt=Or.call(Ar,String.prototype.slice),yp=Or.call(Ar,RegExp.prototype.exec),gp=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,_p=/\\(\\)?/g,vp=function(e){var t=bt(e,0,1),n=bt(e,-1);if(t==="%"&&n!=="%")throw new Xe("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new Xe("invalid intrinsic syntax, expected opening `%`");var i=[];return qo(e,gp,function(a,o,u,f){i[i.length]=u?qo(f,_p,"$1"):o||a}),i},mp=function(e,t){var n=e,i;if(wt(Bo,n)&&(i=Bo[n],n="%"+i[0]+"%"),wt(Fe,n)){var a=Fe[n];if(a===Ze&&(a=dp(n)),typeof a>"u"&&!t)throw new Ye("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new Xe("intrinsic "+e+" does not exist!")},fi=function(e,t){if(typeof e!="string"||e.length===0)throw new Ye("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Ye('"allowMissing" argument must be a boolean');if(yp(/^%?[^%]*%?$/,e)===null)throw new Xe("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=vp(e),i=n.length>0?n[0]:"",a=mp("%"+i+"%",t),o=a.name,u=a.value,f=!1,d=a.alias;d&&(i=d[0],hp(n,pp([0,1],d)));for(var c=1,s=!0;c<n.length;c+=1){var l=n[c],p=bt(l,0,1),g=bt(l,-1);if((p==='"'||p==="'"||p==="`"||g==='"'||g==="'"||g==="`")&&p!==g)throw new Xe("property names with quotes must have matching quotes");if((l==="constructor"||!s)&&(f=!0),i+="."+l,o="%"+i+"%",wt(Fe,o))u=Fe[o];else if(u!=null){if(!(l in u)){if(!t)throw new Ye("base intrinsic for "+e+" exists, but the property is not available.");return}if(Sr&&c+1>=n.length){var $=Sr(u,l);s=!!$,s&&"get"in $&&!("originalValue"in $.get)?u=$.get:u=u[l]}else s=wt(u,l),u=u[l];s&&!f&&(Fe[o]=u)}}return u},Uo=fi,Lo=Fo,wp=Lo([Uo("%String.prototype.indexOf%")]),ko=function(e,t){var n=Uo(e,!!t);return typeof n=="function"&&wp(e,".prototype.")>-1?Lo([n]):n},bp=fi,Ir=ko,$p=ht,Ep=je,jo=bp("%Map%",!0),Sp=Ir("Map.prototype.get",!0),Ap=Ir("Map.prototype.set",!0),Op=Ir("Map.prototype.has",!0),Ip=Ir("Map.prototype.delete",!0),Pp=Ir("Map.prototype.size",!0),Vo=!!jo&&function(){var e,t={assert:function(n){if(!t.has(n))throw new Ep("Side channel does not contain "+$p(n))},delete:function(n){if(e){var i=Ip(e,n);return Pp(e)===0&&(e=void 0),i}return!1},get:function(n){if(e)return Sp(e,n)},has:function(n){return e?Op(e,n):!1},set:function(n,i){e||(e=new jo),Ap(e,n,i)}};return t},xp=fi,$t=ko,Tp=ht,Et=Vo,Fp=je,Je=xp("%WeakMap%",!0),Rp=$t("WeakMap.prototype.get",!0),Mp=$t("WeakMap.prototype.set",!0),Dp=$t("WeakMap.prototype.has",!0),Cp=$t("WeakMap.prototype.delete",!0),Np=Je?function(){var e,t,n={assert:function(i){if(!n.has(i))throw new Fp("Side channel does not contain "+Tp(i))},delete:function(i){if(Je&&i&&(typeof i=="object"||typeof i=="function")){if(e)return Cp(e,i)}else if(Et&&t)return t.delete(i);return!1},get:function(i){return Je&&i&&(typeof i=="object"||typeof i=="function")&&e?Rp(e,i):t&&t.get(i)},has:function(i){return Je&&i&&(typeof i=="object"||typeof i=="function")&&e?Dp(e,i):!!t&&t.has(i)},set:function(i,a){Je&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Je),Mp(e,i,a)):Et&&(t||(t=Et()),t.set(i,a))}};return n}:Et,Bp=je,qp=ht,Up=pd,Lp=Vo,kp=Np,jp=kp||Lp||Up,Go=function(){var e,t={assert:function(n){if(!t.has(n))throw new Bp("Side channel does not contain "+qp(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=jp()),e.set(n,i)}};return t},Vp=String.prototype.replace,Gp=/%20/g,ci={RFC1738:"RFC1738",RFC3986:"RFC3986"},Ho={default:ci.RFC3986,formatters:{RFC1738:function(r){return Vp.call(r,Gp,"+")},RFC3986:function(r){return String(r)}},RFC1738:ci.RFC1738,RFC3986:ci.RFC3986},Hp=Ho,Wp=Go,li=Object.prototype.hasOwnProperty,Re=Array.isArray,St=Wp(),Wo=function(e,t){return St.set(e,t),e},At=function(e){return St.has(e)},di=function(e){return St.get(e)},zo=function(e,t){St.set(e,t)},ie=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),zp=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(Re(n)){for(var i=[],a=0;a<n.length;++a)typeof n[a]<"u"&&i.push(n[a]);t.obj[t.prop]=i}}},pi=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},Xp=function r(e,t,n){if(!t)return e;if(typeof t!="object"&&typeof t!="function"){if(Re(e))e.push(t);else if(e&&typeof e=="object")if(At(e)){var i=di(e)+1;e[i]=t,zo(e,i)}else(n&&(n.plainObjects||n.allowPrototypes)||!li.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object"){if(At(t)){for(var a=Object.keys(t),o=n&&n.plainObjects?{__proto__:null,0:e}:{0:e},u=0;u<a.length;u++){var f=parseInt(a[u],10);o[f+1]=t[a[u]]}return Wo(o,di(t)+1)}return[e].concat(t)}var d=e;return Re(e)&&!Re(t)&&(d=pi(e,n)),Re(e)&&Re(t)?(t.forEach(function(c,s){if(li.call(e,s)){var l=e[s];l&&typeof l=="object"&&c&&typeof c=="object"?e[s]=r(l,c,n):e.push(c)}else e[s]=c}),e):Object.keys(t).reduce(function(c,s){var l=t[s];return li.call(c,s)?c[s]=r(c[s],l,n):c[s]=l,c},d)},Yp=function(e,t){return Object.keys(t).reduce(function(n,i){return n[i]=t[i],n},e)},Kp=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}},hi=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 u="",f=0;f<o.length;f+=hi){for(var d=o.length>=hi?o.slice(f,f+hi):o,c=[],s=0;s<d.length;++s){var l=d.charCodeAt(s);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||a===Hp.RFC1738&&(l===40||l===41)){c[c.length]=d.charAt(s);continue}if(l<128){c[c.length]=ie[l];continue}if(l<2048){c[c.length]=ie[192|l>>6]+ie[128|l&63];continue}if(l<55296||l>=57344){c[c.length]=ie[224|l>>12]+ie[128|l>>6&63]+ie[128|l&63];continue}s+=1,l=65536+((l&1023)<<10|d.charCodeAt(s)&1023),c[c.length]=ie[240|l>>18]+ie[128|l>>12&63]+ie[128|l>>6&63]+ie[128|l&63]}u+=c.join("")}return u},Jp=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],i=0;i<t.length;++i)for(var a=t[i],o=a.obj[a.prop],u=Object.keys(o),f=0;f<u.length;++f){var d=u[f],c=o[d];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(t.push({obj:o,prop:d}),n.push(c))}return zp(t),e},Qp=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},eh=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},rh=function(e,t,n,i){if(At(e)){var a=di(e)+1;return e[a]=t,zo(e,a),e}var o=[].concat(e,t);return o.length>n?Wo(pi(o,{plainObjects:i}),o.length-1):o},th=function(e,t){if(Re(e)){for(var n=[],i=0;i<e.length;i+=1)n.push(t(e[i]));return n}return t(e)},nh={arrayToObject:pi,assign:Yp,combine:rh,compact:Jp,decode:Kp,encode:Zp,isBuffer:eh,isOverflow:At,isRegExp:Qp,maybeMap:th,merge:Xp},Xo=Go,Ot=nh,Pr=Ho,ih=Object.prototype.hasOwnProperty,Yo={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ae=Array.isArray,ah=Array.prototype.push,Ko=function(r,e){ah.apply(r,ae(e)?e:[e])},oh=Date.prototype.toISOString,Zo=Pr.default,B={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Ot.encode,encodeValuesOnly:!1,filter:void 0,format:Zo,formatter:Pr.formatters[Zo],indices:!1,serializeDate:function(e){return oh.call(e)},skipNulls:!1,strictNullHandling:!1},sh=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},yi={},uh=function r(e,t,n,i,a,o,u,f,d,c,s,l,p,g,$,E,A,S){for(var h=e,O=S,T=0,R=!1;(O=O.get(yi))!==void 0&&!R;){var b=O.get(e);if(T+=1,typeof b<"u"){if(b===T)throw new RangeError("Cyclic object value");R=!0}typeof O.get(yi)>"u"&&(T=0)}if(typeof c=="function"?h=c(t,h):h instanceof Date?h=p(h):n==="comma"&&ae(h)&&(h=Ot.maybeMap(h,function(ha){return ha instanceof Date?p(ha):ha})),h===null){if(o)return d&&!E?d(t,B.encoder,A,"key",g):t;h=""}if(sh(h)||Ot.isBuffer(h)){if(d){var _=E?t:d(t,B.encoder,A,"key",g);return[$(_)+"="+$(d(h,B.encoder,A,"value",g))]}return[$(t)+"="+$(String(h))]}var m=[];if(typeof h>"u")return m;var I;if(n==="comma"&&ae(h))E&&d&&(h=Ot.maybeMap(h,d)),I=[{value:h.length>0?h.join(",")||null:void 0}];else if(ae(c))I=c;else{var P=Object.keys(h);I=s?P.sort(s):P}var q=f?String(t).replace(/\./g,"%2E"):String(t),z=i&&ae(h)&&h.length===1?q+"[]":q;if(a&&ae(h)&&h.length===0)return z+"[]";for(var ue=0;ue<I.length;++ue){var Z=I[ue],ke=typeof Z=="object"&&Z&&typeof Z.value<"u"?Z.value:h[Z];if(!(u&&ke===null)){var pa=l&&f?String(Z).replace(/\./g,"%2E"):String(Z),OT=ae(h)?typeof n=="function"?n(z,pa):z:z+(l?"."+pa:"["+pa+"]");S.set(e,T);var rc=Xo();rc.set(yi,S),Ko(m,r(ke,OT,n,i,a,o,u,f,n==="comma"&&E&&ae(h)?null:d,c,s,l,p,g,$,E,A,rc))}}return m},fh=function(e){if(!e)return B;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||B.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=Pr.default;if(typeof e.format<"u"){if(!ih.call(Pr.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var i=Pr.formatters[n],a=B.filter;(typeof e.filter=="function"||ae(e.filter))&&(a=e.filter);var o;if(e.arrayFormat in Yo?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=B.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:B.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:B.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:B.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:B.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?B.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:B.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:B.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:B.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:B.encodeValuesOnly,filter:a,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:B.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:B.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:B.strictNullHandling}},ch=function(r,e){var t=r,n=fh(e),i,a;typeof n.filter=="function"?(a=n.filter,t=a("",t)):ae(n.filter)&&(a=n.filter,i=a);var o=[];if(typeof t!="object"||t===null)return"";var u=Yo[n.arrayFormat],f=u==="comma"&&n.commaRoundTrip;i||(i=Object.keys(t)),n.sort&&i.sort(n.sort);for(var d=Xo(),c=0;c<i.length;++c){var s=i[c],l=t[s];n.skipNulls&&l===null||Ko(o,uh(l,s,u,f,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,d))}var p=o.join(n.delimiter),g=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?g+="utf8=%26%2310003%3B&":g+="utf8=%E2%9C%93&"),p.length>0?g+p:""},lh=$e(ch);let Jo={storeIdentifier:"",environment:"prod"};function dh(r){Jo=r}function V(){return Jo}const ph=(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`}},hh=(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}},yh=r=>{switch(r){case"prod":case"preprod":return"https://static.rechargecdn.com";case"stage":case"prestage":return"https://static.stage.rechargecdn.com"}},Qo="/tools/recurring";class Qe{constructor(e,t){this.name="RechargeRequestError",this.message=e,this.status=t}}function F(r){return encodeURIComponent(`${r}`.trim())}function gh(r){return lh(r,{encodeValuesOnly:!0,indices:!1,arrayFormat:"comma"})}const _h=new Set(["shop_url"]);function v(r,e){return{...r,internalFnCall:r.internalFnCall??e,internalRequestId:r.internalRequestId??ma()}}async function It(r,e,t={}){const n=V();return Y(r,`${yh(n.environment)}/store/${n.storeIdentifier}${e}`,t)}async function w(r,e,{id:t,query:n,data:i,headers:a}={},o){const{environment:u,environmentUri:f,storeIdentifier:d,loginRetryFn:c,__unstable_twoFactorRetryFn:s,appName:l,appVersion:p}=V();if(!d)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const g=o.apiToken;if(!g)throw new Error("No API token defined on session.");const $=ph(u,f),E={"X-Recharge-Access-Token":g,"X-Recharge-Version":"2021-11","X-Recharge-Sdk-Fn":o.internalFnCall,...l?{"X-Recharge-Sdk-App-Name":l}:{},...p?{"X-Recharge-Sdk-App-Version":p}:{},"X-Recharge-Sdk-Version":"1.91.0","X-Request-Id":o.internalRequestId,...o.tmp_fn_identifier?{"X-Recharge-Sdk-Fn-Identifier":o.tmp_fn_identifier}:{},...a||{}},A=n,S={...A?Object.fromEntries(Object.entries(A).filter(([h])=>!_h.has(h))):void 0,shop_url:d};try{return await Y(r,`${$}${e}`,{id:t,query:S,data:i,headers:E})}catch(h){if(c&&h instanceof Qe&&h.status===401)return c().then(O=>{if(O)return Y(r,`${$}${e}`,{id:t,query:S,data:i,headers:{...E,"X-Recharge-Access-Token":O.apiToken}});throw h});if(s&&h instanceof Qe&&h.status===423)return s().then(O=>{if(O)return Y(r,`${$}${e}`,{id:t,query:S,data:i,headers:{...E,"X-Recharge-Access-Token":O.apiToken}});throw h});throw h}}async function Me(r,e,t={}){return Y(r,`${Qo}${e}`,t)}async function Y(r,e,{id:t,query:n,data:i,headers:a}={}){let o=e.trim();if(t&&(o=[o,F(t)].join("/")),n){let s;[o,s]=o.split("?");const l=[s,gh(n)].join("&").replace(/^&/,"");o=`${o}${l?`?${l}`:""}`}let u;i&&r!=="get"&&(u=JSON.stringify(i));const f={Accept:"application/json","Content-Type":"application/json","X-Recharge-App":"storefront-client",...a||{}},d=await fetch(o,{method:r,headers:f,body:u});let c;try{c=await d.json()}catch{}if(!d.ok)throw d.status===502||d.status===504?new Qe("A gateway error occurred while making the request",d.status):c&&c.error?new Qe(c.error,d.status):c&&c.errors?new Qe(JSON.stringify(c.errors),d.status):new Qe("A connection error occurred while making the request");return c}function vh(r,e){return w("get","/addresses",{query:e},v(r,"listAddresses"))}async function mh(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 wh(r,e){const{address:t}=await w("post","/addresses",{data:{...e,customer_id:r.customerId?Number(r.customerId):void 0}},v(r,"createAddress"));return t}async function gi(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 bh(r,e,t,n){return gi(v(r,"applyDiscountToAddress"),e,{discounts:[{code:t}]},n)}async function $h(r,e,t){if(e===void 0||e==="")throw new Error("Id is required");return gi(v(r,"removeDiscountsFromAddress"),e,{discounts:[]},t)}function Eh(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/addresses",{id:e},v(r,"deleteAddress"))}async function Sh(r,e){const{address:t}=await w("post","/addresses/merge",{data:e},v(r,"mergeAddresses"));return t}async function Ah(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/addresses/${F(e)}/charges/skip`,{data:t},v(r,"skipFutureCharge"));return n}var Oh=Object.freeze({__proto__:null,applyDiscountToAddress:bh,createAddress:wh,deleteAddress:Eh,getAddress:mh,listAddresses:vh,mergeAddresses:Sh,removeDiscountsFromAddress:$h,skipFutureCharge:Ah,updateAddress:gi});async function Ih(){const{storefrontAccessToken:r}=V(),e={};r&&(e["X-Recharge-Storefront-Access-Token"]=r);const t=await Me("get","/access",{headers:e});return{apiToken:t.api_token,customerId:t.customer_id,message:t.message}}async function Ph(r,e){return es(r,e)}async function es(r,e){if(!r)throw new Error("Shopify storefront token is required");const{storeIdentifier:t}=V();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 xr("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 xh(r){const{storeIdentifier:e}=V();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 xr("post","/shopify_customer_account_api_access",{data:{customer_token:r,shop_url:e}});return t?{apiToken:t,customerId:n,message:i}:null}async function Th(r,e={}){if(!r)throw new Error("Email is required.");const{storeIdentifier:t}=V();if(!t)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const{send_email:n,send_sms:i}=e,a=await xr("post","/attempt_login",{data:{email:r,shop:t,...n!==void 0?{send_email:n}:{},...i!==void 0?{send_sms:i}:{}}});if(a.errors)throw new Error(a.errors);return a.session_token}async function Fh(r,e={}){if(!r)throw new Error("Email is required.");const{storefrontAccessToken:t}=V(),n={};t&&(n["X-Recharge-Storefront-Access-Token"]=t);const{send_email:i,send_sms:a}=e,o=await Me("post","/attempt_login",{data:{email:r,...i!==void 0?{send_email:i}:{},...a!==void 0?{send_sms:a}:{}},headers:n});if(o.errors)throw new Error(o.errors);return o.session_token}async function Rh(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}=V();if(!n)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const i=await xr("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 Mh(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}=V(),i={};n&&(i["X-Recharge-Storefront-Access-Token"]=n);const a=await Me("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 Dh(){const{customerHash:r}=V(),{pathname:e,search:t}=window.location,n=new URLSearchParams(t).get("token"),i=e.split("/").filter(Boolean),a=i.findIndex(u=>u==="portal"),o=a!==-1?i[a+1]:r;if(!n||!o)throw new Error("Not in context of Recharge Customer Portal or URL did not contain correct params");return{customerHash:o,token:n}}async function Ch(){const{customerHash:r,token:e}=Dh(),{storeIdentifier:t}=V(),n=await xr("post",`/customers/${F(r)}/access`,{data:{token:e,shop:t}});return{apiToken:n.api_token,customerId:n.customer_id}}async function xr(r,e,{id:t,query:n,data:i,headers:a}={}){const{environment:o,environmentUri:u,storefrontAccessToken:f,appName:d,appVersion:c}=V(),s=hh(o,u),l={...f?{"X-Recharge-Storefront-Access-Token":f}:{},...d?{"X-Recharge-Sdk-App-Name":d}:{},...c?{"X-Recharge-Sdk-App-Version":c}:{},"X-Recharge-Sdk-Version":"1.91.0",...a||{}};return Y(r,`${s}${e}`,{id:t,query:n,data:i,headers:l})}var Nh=Object.freeze({__proto__:null,loginCustomerPortal:Ch,loginShopifyApi:Ph,loginShopifyAppProxy:Ih,loginWithShopifyCustomerAccount:xh,loginWithShopifyStorefront:es,sendPasswordlessCode:Th,sendPasswordlessCodeAppProxy:Fh,validatePasswordlessCode:Rh,validatePasswordlessCodeAppProxy:Mh}),rs={},_i={},de={},Bh=typeof C=="object"&&C&&C.Object===Object&&C,ts=Bh,qh=ts,Uh=typeof self=="object"&&self&&self.Object===Object&&self,Lh=qh||Uh||Function("return this")(),pe=Lh,kh=pe,jh=kh.Symbol,Pt=jh,ns=Pt,is=Object.prototype,Vh=is.hasOwnProperty,Gh=is.toString,Tr=ns?ns.toStringTag:void 0;function Hh(r){var e=Vh.call(r,Tr),t=r[Tr];try{r[Tr]=void 0;var n=!0}catch{}var i=Gh.call(r);return n&&(e?r[Tr]=t:delete r[Tr]),i}var Wh=Hh,zh=Object.prototype,Xh=zh.toString;function Yh(r){return Xh.call(r)}var Kh=Yh,as=Pt,Zh=Wh,Jh=Kh,Qh="[object Null]",ey="[object Undefined]",os=as?as.toStringTag:void 0;function ry(r){return r==null?r===void 0?ey:Qh:os&&os in Object(r)?Zh(r):Jh(r)}var me=ry;function ty(r){return r!=null&&typeof r=="object"}var we=ty,ny=me,iy=we,ay="[object Number]";function oy(r){return typeof r=="number"||iy(r)&&ny(r)==ay}var xt=oy,D={};function sy(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var er=sy,uy=me,fy=er,cy="[object AsyncFunction]",ly="[object Function]",dy="[object GeneratorFunction]",py="[object Proxy]";function hy(r){if(!fy(r))return!1;var e=uy(r);return e==ly||e==dy||e==cy||e==py}var vi=hy,yy=pe,gy=yy["__core-js_shared__"],_y=gy,mi=_y,ss=function(){var r=/[^.]+$/.exec(mi&&mi.keys&&mi.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function vy(r){return!!ss&&ss in r}var my=vy,wy=Function.prototype,by=wy.toString;function $y(r){if(r!=null){try{return by.call(r)}catch{}try{return r+""}catch{}}return""}var us=$y,Ey=vi,Sy=my,Ay=er,Oy=us,Iy=/[\\^$.*+?()[\]{}|]/g,Py=/^\[object .+?Constructor\]$/,xy=Function.prototype,Ty=Object.prototype,Fy=xy.toString,Ry=Ty.hasOwnProperty,My=RegExp("^"+Fy.call(Ry).replace(Iy,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Dy(r){if(!Ay(r)||Sy(r))return!1;var e=Ey(r)?My:Py;return e.test(Oy(r))}var Cy=Dy;function Ny(r,e){return r?.[e]}var By=Ny,qy=Cy,Uy=By;function Ly(r,e){var t=Uy(r,e);return qy(t)?t:void 0}var De=Ly,ky=De,jy=function(){try{var r=ky(Object,"defineProperty");return r({},"",{}),r}catch{}}(),fs=jy,cs=fs;function Vy(r,e,t){e=="__proto__"&&cs?cs(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var ls=Vy;function Gy(r,e){return r===e||r!==r&&e!==e}var Tt=Gy,Hy=ls,Wy=Tt,zy=Object.prototype,Xy=zy.hasOwnProperty;function Yy(r,e,t){var n=r[e];(!(Xy.call(r,e)&&Wy(n,t))||t===void 0&&!(e in r))&&Hy(r,e,t)}var Ky=Yy,Zy=Ky,Jy=ls;function Qy(r,e,t,n){var i=!t;t||(t={});for(var a=-1,o=e.length;++a<o;){var u=e[a],f=n?n(t[u],r[u],u,t,r):void 0;f===void 0&&(f=r[u]),i?Jy(t,u,f):Zy(t,u,f)}return t}var eg=Qy;function rg(r){return r}var Ft=rg;function tg(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 ng=tg,ig=ng,ds=Math.max;function ag(r,e,t){return e=ds(e===void 0?r.length-1:e,0),function(){for(var n=arguments,i=-1,a=ds(n.length-e,0),o=Array(a);++i<a;)o[i]=n[e+i];i=-1;for(var u=Array(e+1);++i<e;)u[i]=n[i];return u[e]=t(o),ig(r,this,u)}}var og=ag;function sg(r){return function(){return r}}var ug=sg,fg=ug,ps=fs,cg=Ft,lg=ps?function(r,e){return ps(r,"toString",{configurable:!0,enumerable:!1,value:fg(e),writable:!0})}:cg,dg=lg,pg=800,hg=16,yg=Date.now;function gg(r){var e=0,t=0;return function(){var n=yg(),i=hg-(n-t);if(t=n,i>0){if(++e>=pg)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}var _g=gg,vg=dg,mg=_g,wg=mg(vg),bg=wg,$g=Ft,Eg=og,Sg=bg;function Ag(r,e){return Sg(Eg(r,e,$g),r+"")}var Og=Ag,Ig=9007199254740991;function Pg(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Ig}var wi=Pg,xg=vi,Tg=wi;function Fg(r){return r!=null&&Tg(r.length)&&!xg(r)}var Fr=Fg,Rg=9007199254740991,Mg=/^(?:0|[1-9]\d*)$/;function Dg(r,e){var t=typeof r;return e=e??Rg,!!e&&(t=="number"||t!="symbol"&&Mg.test(r))&&r>-1&&r%1==0&&r<e}var bi=Dg,Cg=Tt,Ng=Fr,Bg=bi,qg=er;function Ug(r,e,t){if(!qg(t))return!1;var n=typeof e;return(n=="number"?Ng(t)&&Bg(e,t.length):n=="string"&&e in t)?Cg(t[e],r):!1}var hs=Ug,Lg=Og,kg=hs;function jg(r){return Lg(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&&kg(t[0],t[1],o)&&(a=i<3?void 0:a,i=1),e=Object(e);++n<i;){var u=t[n];u&&r(e,u,n,a)}return e})}var Vg=jg;function Gg(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var ys=Gg,Hg=me,Wg=we,zg="[object Arguments]";function Xg(r){return Wg(r)&&Hg(r)==zg}var Yg=Xg,gs=Yg,Kg=we,_s=Object.prototype,Zg=_s.hasOwnProperty,Jg=_s.propertyIsEnumerable,Qg=gs(function(){return arguments}())?gs:function(r){return Kg(r)&&Zg.call(r,"callee")&&!Jg.call(r,"callee")},vs=Qg,e_=Array.isArray,G=e_,Rt={exports:{}};function r_(){return!1}var t_=r_;Rt.exports,function(r,e){var t=pe,n=t_,i=e&&!e.nodeType&&e,a=i&&!0&&r&&!r.nodeType&&r,o=a&&a.exports===i,u=o?t.Buffer:void 0,f=u?u.isBuffer:void 0,d=f||n;r.exports=d}(Rt,Rt.exports);var ms=Rt.exports,n_=me,i_=wi,a_=we,o_="[object Arguments]",s_="[object Array]",u_="[object Boolean]",f_="[object Date]",c_="[object Error]",l_="[object Function]",d_="[object Map]",p_="[object Number]",h_="[object Object]",y_="[object RegExp]",g_="[object Set]",__="[object String]",v_="[object WeakMap]",m_="[object ArrayBuffer]",w_="[object DataView]",b_="[object Float32Array]",$_="[object Float64Array]",E_="[object Int8Array]",S_="[object Int16Array]",A_="[object Int32Array]",O_="[object Uint8Array]",I_="[object Uint8ClampedArray]",P_="[object Uint16Array]",x_="[object Uint32Array]",M={};M[b_]=M[$_]=M[E_]=M[S_]=M[A_]=M[O_]=M[I_]=M[P_]=M[x_]=!0,M[o_]=M[s_]=M[m_]=M[u_]=M[w_]=M[f_]=M[c_]=M[l_]=M[d_]=M[p_]=M[h_]=M[y_]=M[g_]=M[__]=M[v_]=!1;function T_(r){return a_(r)&&i_(r.length)&&!!M[n_(r)]}var F_=T_;function R_(r){return function(e){return r(e)}}var M_=R_,Mt={exports:{}};Mt.exports,function(r,e){var t=ts,n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,o=a&&t.process,u=function(){try{var f=i&&i.require&&i.require("util").types;return f||o&&o.binding&&o.binding("util")}catch{}}();r.exports=u}(Mt,Mt.exports);var D_=Mt.exports,C_=F_,N_=M_,ws=D_,bs=ws&&ws.isTypedArray,B_=bs?N_(bs):C_,$s=B_,q_=ys,U_=vs,L_=G,k_=ms,j_=bi,V_=$s,G_=Object.prototype,H_=G_.hasOwnProperty;function W_(r,e){var t=L_(r),n=!t&&U_(r),i=!t&&!n&&k_(r),a=!t&&!n&&!i&&V_(r),o=t||n||i||a,u=o?q_(r.length,String):[],f=u.length;for(var d in r)(e||H_.call(r,d))&&!(o&&(d=="length"||i&&(d=="offset"||d=="parent")||a&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||j_(d,f)))&&u.push(d);return u}var Es=W_,z_=Object.prototype;function X_(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||z_;return r===t}var Ss=X_;function Y_(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var K_=Y_,Z_=er,J_=Ss,Q_=K_,ev=Object.prototype,rv=ev.hasOwnProperty;function tv(r){if(!Z_(r))return Q_(r);var e=J_(r),t=[];for(var n in r)n=="constructor"&&(e||!rv.call(r,n))||t.push(n);return t}var nv=tv,iv=Es,av=nv,ov=Fr;function sv(r){return ov(r)?iv(r,!0):av(r)}var uv=sv,fv=eg,cv=Vg,lv=uv,dv=cv(function(r,e){fv(e,lv(e),r)}),pv=dv,hv=pv,Dt={},Ce={};function yv(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 gv=yv;function _v(r){return function(e,t,n){for(var i=-1,a=Object(e),o=n(e),u=o.length;u--;){var f=o[r?u:++i];if(t(a[f],f,a)===!1)break}return e}}var vv=_v,mv=vv,wv=mv(),bv=wv;function $v(r,e){return function(t){return r(e(t))}}var Ev=$v,Sv=Ev,Av=Sv(Object.keys,Object),Ov=Av,Iv=Ss,Pv=Ov,xv=Object.prototype,Tv=xv.hasOwnProperty;function Fv(r){if(!Iv(r))return Pv(r);var e=[];for(var t in Object(r))Tv.call(r,t)&&t!="constructor"&&e.push(t);return e}var Rv=Fv,Mv=Es,Dv=Rv,Cv=Fr;function Nv(r){return Cv(r)?Mv(r):Dv(r)}var Ct=Nv,Bv=bv,qv=Ct;function Uv(r,e){return r&&Bv(r,e,qv)}var Lv=Uv,kv=Fr;function jv(r,e){return function(t,n){if(t==null)return t;if(!kv(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 Vv=jv,Gv=Lv,Hv=Vv,Wv=Hv(Gv),$i=Wv,zv=$i;function Xv(r,e){var t=!0;return zv(r,function(n,i,a){return t=!!e(n,i,a),t}),t}var Yv=Xv;function Kv(){this.__data__=[],this.size=0}var Zv=Kv,Jv=Tt;function Qv(r,e){for(var t=r.length;t--;)if(Jv(r[t][0],e))return t;return-1}var Nt=Qv,em=Nt,rm=Array.prototype,tm=rm.splice;function nm(r){var e=this.__data__,t=em(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():tm.call(e,t,1),--this.size,!0}var im=nm,am=Nt;function om(r){var e=this.__data__,t=am(e,r);return t<0?void 0:e[t][1]}var sm=om,um=Nt;function fm(r){return um(this.__data__,r)>-1}var cm=fm,lm=Nt;function dm(r,e){var t=this.__data__,n=lm(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var pm=dm,hm=Zv,ym=im,gm=sm,_m=cm,vm=pm;function rr(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}rr.prototype.clear=hm,rr.prototype.delete=ym,rr.prototype.get=gm,rr.prototype.has=_m,rr.prototype.set=vm;var Bt=rr,mm=Bt;function wm(){this.__data__=new mm,this.size=0}var bm=wm;function $m(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var Em=$m;function Sm(r){return this.__data__.get(r)}var Am=Sm;function Om(r){return this.__data__.has(r)}var Im=Om,Pm=De,xm=pe,Tm=Pm(xm,"Map"),Ei=Tm,Fm=De,Rm=Fm(Object,"create"),qt=Rm,As=qt;function Mm(){this.__data__=As?As(null):{},this.size=0}var Dm=Mm;function Cm(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var Nm=Cm,Bm=qt,qm="__lodash_hash_undefined__",Um=Object.prototype,Lm=Um.hasOwnProperty;function km(r){var e=this.__data__;if(Bm){var t=e[r];return t===qm?void 0:t}return Lm.call(e,r)?e[r]:void 0}var jm=km,Vm=qt,Gm=Object.prototype,Hm=Gm.hasOwnProperty;function Wm(r){var e=this.__data__;return Vm?e[r]!==void 0:Hm.call(e,r)}var zm=Wm,Xm=qt,Ym="__lodash_hash_undefined__";function Km(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Xm&&e===void 0?Ym:e,this}var Zm=Km,Jm=Dm,Qm=Nm,ew=jm,rw=zm,tw=Zm;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=Jm,tr.prototype.delete=Qm,tr.prototype.get=ew,tr.prototype.has=rw,tr.prototype.set=tw;var nw=tr,Os=nw,iw=Bt,aw=Ei;function ow(){this.size=0,this.__data__={hash:new Os,map:new(aw||iw),string:new Os}}var sw=ow;function uw(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var fw=uw,cw=fw;function lw(r,e){var t=r.__data__;return cw(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Ut=lw,dw=Ut;function pw(r){var e=dw(this,r).delete(r);return this.size-=e?1:0,e}var hw=pw,yw=Ut;function gw(r){return yw(this,r).get(r)}var _w=gw,vw=Ut;function mw(r){return vw(this,r).has(r)}var ww=mw,bw=Ut;function $w(r,e){var t=bw(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var Ew=$w,Sw=sw,Aw=hw,Ow=_w,Iw=ww,Pw=Ew;function nr(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])}}nr.prototype.clear=Sw,nr.prototype.delete=Aw,nr.prototype.get=Ow,nr.prototype.has=Iw,nr.prototype.set=Pw;var Si=nr,xw=Bt,Tw=Ei,Fw=Si,Rw=200;function Mw(r,e){var t=this.__data__;if(t instanceof xw){var n=t.__data__;if(!Tw||n.length<Rw-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new Fw(n)}return t.set(r,e),this.size=t.size,this}var Dw=Mw,Cw=Bt,Nw=bm,Bw=Em,qw=Am,Uw=Im,Lw=Dw;function ir(r){var e=this.__data__=new Cw(r);this.size=e.size}ir.prototype.clear=Nw,ir.prototype.delete=Bw,ir.prototype.get=qw,ir.prototype.has=Uw,ir.prototype.set=Lw;var Is=ir,kw="__lodash_hash_undefined__";function jw(r){return this.__data__.set(r,kw),this}var Vw=jw;function Gw(r){return this.__data__.has(r)}var Hw=Gw,Ww=Si,zw=Vw,Xw=Hw;function Lt(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Ww;++e<t;)this.add(r[e])}Lt.prototype.add=Lt.prototype.push=zw,Lt.prototype.has=Xw;var Yw=Lt;function Kw(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 Zw=Kw;function Jw(r,e){return r.has(e)}var Qw=Jw,e0=Yw,r0=Zw,t0=Qw,n0=1,i0=2;function a0(r,e,t,n,i,a){var o=t&n0,u=r.length,f=e.length;if(u!=f&&!(o&&f>u))return!1;var d=a.get(r),c=a.get(e);if(d&&c)return d==e&&c==r;var s=-1,l=!0,p=t&i0?new e0:void 0;for(a.set(r,e),a.set(e,r);++s<u;){var g=r[s],$=e[s];if(n)var E=o?n($,g,s,e,r,a):n(g,$,s,r,e,a);if(E!==void 0){if(E)continue;l=!1;break}if(p){if(!r0(e,function(A,S){if(!t0(p,S)&&(g===A||i(g,A,t,n,a)))return p.push(S)})){l=!1;break}}else if(!(g===$||i(g,$,t,n,a))){l=!1;break}}return a.delete(r),a.delete(e),l}var Ps=a0,o0=pe,s0=o0.Uint8Array,u0=s0;function f0(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}var c0=f0;function l0(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var d0=l0,xs=Pt,Ts=u0,p0=Tt,h0=Ps,y0=c0,g0=d0,_0=1,v0=2,m0="[object Boolean]",w0="[object Date]",b0="[object Error]",$0="[object Map]",E0="[object Number]",S0="[object RegExp]",A0="[object Set]",O0="[object String]",I0="[object Symbol]",P0="[object ArrayBuffer]",x0="[object DataView]",Fs=xs?xs.prototype:void 0,Ai=Fs?Fs.valueOf:void 0;function T0(r,e,t,n,i,a,o){switch(t){case x0:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case P0:return!(r.byteLength!=e.byteLength||!a(new Ts(r),new Ts(e)));case m0:case w0:case E0:return p0(+r,+e);case b0:return r.name==e.name&&r.message==e.message;case S0:case O0:return r==e+"";case $0:var u=y0;case A0:var f=n&_0;if(u||(u=g0),r.size!=e.size&&!f)return!1;var d=o.get(r);if(d)return d==e;n|=v0,o.set(r,e);var c=h0(u(r),u(e),n,i,a,o);return o.delete(r),c;case I0:if(Ai)return Ai.call(r)==Ai.call(e)}return!1}var F0=T0;function R0(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}var M0=R0,D0=M0,C0=G;function N0(r,e,t){var n=e(r);return C0(r)?n:D0(n,t(r))}var B0=N0;function q0(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 U0=q0;function L0(){return[]}var k0=L0,j0=U0,V0=k0,G0=Object.prototype,H0=G0.propertyIsEnumerable,Rs=Object.getOwnPropertySymbols,W0=Rs?function(r){return r==null?[]:(r=Object(r),j0(Rs(r),function(e){return H0.call(r,e)}))}:V0,z0=W0,X0=B0,Y0=z0,K0=Ct;function Z0(r){return X0(r,K0,Y0)}var J0=Z0,Ms=J0,Q0=1,eb=Object.prototype,rb=eb.hasOwnProperty;function tb(r,e,t,n,i,a){var o=t&Q0,u=Ms(r),f=u.length,d=Ms(e),c=d.length;if(f!=c&&!o)return!1;for(var s=f;s--;){var l=u[s];if(!(o?l in e:rb.call(e,l)))return!1}var p=a.get(r),g=a.get(e);if(p&&g)return p==e&&g==r;var $=!0;a.set(r,e),a.set(e,r);for(var E=o;++s<f;){l=u[s];var A=r[l],S=e[l];if(n)var h=o?n(S,A,l,e,r,a):n(A,S,l,r,e,a);if(!(h===void 0?A===S||i(A,S,t,n,a):h)){$=!1;break}E||(E=l=="constructor")}if($&&!E){var O=r.constructor,T=e.constructor;O!=T&&"constructor"in r&&"constructor"in e&&!(typeof O=="function"&&O instanceof O&&typeof T=="function"&&T instanceof T)&&($=!1)}return a.delete(r),a.delete(e),$}var nb=tb,ib=De,ab=pe,ob=ib(ab,"DataView"),sb=ob,ub=De,fb=pe,cb=ub(fb,"Promise"),lb=cb,db=De,pb=pe,hb=db(pb,"Set"),yb=hb,gb=De,_b=pe,vb=gb(_b,"WeakMap"),mb=vb,Oi=sb,Ii=Ei,Pi=lb,xi=yb,Ti=mb,Ds=me,ar=us,Cs="[object Map]",wb="[object Object]",Ns="[object Promise]",Bs="[object Set]",qs="[object WeakMap]",Us="[object DataView]",bb=ar(Oi),$b=ar(Ii),Eb=ar(Pi),Sb=ar(xi),Ab=ar(Ti),Ne=Ds;(Oi&&Ne(new Oi(new ArrayBuffer(1)))!=Us||Ii&&Ne(new Ii)!=Cs||Pi&&Ne(Pi.resolve())!=Ns||xi&&Ne(new xi)!=Bs||Ti&&Ne(new Ti)!=qs)&&(Ne=function(r){var e=Ds(r),t=e==wb?r.constructor:void 0,n=t?ar(t):"";if(n)switch(n){case bb:return Us;case $b:return Cs;case Eb:return Ns;case Sb:return Bs;case Ab:return qs}return e});var Ob=Ne,Fi=Is,Ib=Ps,Pb=F0,xb=nb,Ls=Ob,ks=G,js=ms,Tb=$s,Fb=1,Vs="[object Arguments]",Gs="[object Array]",kt="[object Object]",Rb=Object.prototype,Hs=Rb.hasOwnProperty;function Mb(r,e,t,n,i,a){var o=ks(r),u=ks(e),f=o?Gs:Ls(r),d=u?Gs:Ls(e);f=f==Vs?kt:f,d=d==Vs?kt:d;var c=f==kt,s=d==kt,l=f==d;if(l&&js(r)){if(!js(e))return!1;o=!0,c=!1}if(l&&!c)return a||(a=new Fi),o||Tb(r)?Ib(r,e,t,n,i,a):Pb(r,e,f,t,n,i,a);if(!(t&Fb)){var p=c&&Hs.call(r,"__wrapped__"),g=s&&Hs.call(e,"__wrapped__");if(p||g){var $=p?r.value():r,E=g?e.value():e;return a||(a=new Fi),i($,E,t,n,a)}}return l?(a||(a=new Fi),xb(r,e,t,n,i,a)):!1}var Db=Mb,Cb=Db,Ws=we;function zs(r,e,t,n,i){return r===e?!0:r==null||e==null||!Ws(r)&&!Ws(e)?r!==r&&e!==e:Cb(r,e,t,n,zs,i)}var Xs=zs,Nb=Is,Bb=Xs,qb=1,Ub=2;function Lb(r,e,t,n){var i=t.length,a=i,o=!n;if(r==null)return!a;for(r=Object(r);i--;){var u=t[i];if(o&&u[2]?u[1]!==r[u[0]]:!(u[0]in r))return!1}for(;++i<a;){u=t[i];var f=u[0],d=r[f],c=u[1];if(o&&u[2]){if(d===void 0&&!(f in r))return!1}else{var s=new Nb;if(n)var l=n(d,c,f,r,e,s);if(!(l===void 0?Bb(c,d,qb|Ub,n,s):l))return!1}}return!0}var kb=Lb,jb=er;function Vb(r){return r===r&&!jb(r)}var Ys=Vb,Gb=Ys,Hb=Ct;function Wb(r){for(var e=Hb(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,Gb(i)]}return e}var zb=Wb;function Xb(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}var Ks=Xb,Yb=kb,Kb=zb,Zb=Ks;function Jb(r){var e=Kb(r);return e.length==1&&e[0][2]?Zb(e[0][0],e[0][1]):function(t){return t===r||Yb(t,r,e)}}var Qb=Jb,e1=me,r1=we,t1="[object Symbol]";function n1(r){return typeof r=="symbol"||r1(r)&&e1(r)==t1}var jt=n1,i1=G,a1=jt,o1=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s1=/^\w*$/;function u1(r,e){if(i1(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||a1(r)?!0:s1.test(r)||!o1.test(r)||e!=null&&r in Object(e)}var Ri=u1,Zs=Si,f1="Expected a function";function Mi(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(f1);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(Mi.Cache||Zs),t}Mi.Cache=Zs;var c1=Mi,l1=c1,d1=500;function p1(r){var e=l1(r,function(n){return t.size===d1&&t.clear(),n}),t=e.cache;return e}var h1=p1,y1=h1,g1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,_1=/\\(\\)?/g,v1=y1(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(g1,function(t,n,i,a){e.push(i?a.replace(_1,"$1"):n||t)}),e}),m1=v1;function w1(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 Di=w1,Js=Pt,b1=Di,$1=G,E1=jt,S1=1/0,Qs=Js?Js.prototype:void 0,eu=Qs?Qs.toString:void 0;function ru(r){if(typeof r=="string")return r;if($1(r))return b1(r,ru)+"";if(E1(r))return eu?eu.call(r):"";var e=r+"";return e=="0"&&1/r==-S1?"-0":e}var A1=ru,O1=A1;function I1(r){return r==null?"":O1(r)}var P1=I1,x1=G,T1=Ri,F1=m1,R1=P1;function M1(r,e){return x1(r)?r:T1(r,e)?[r]:F1(R1(r))}var tu=M1,D1=jt,C1=1/0;function N1(r){if(typeof r=="string"||D1(r))return r;var e=r+"";return e=="0"&&1/r==-C1?"-0":e}var Vt=N1,B1=tu,q1=Vt;function U1(r,e){e=B1(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[q1(e[t++])];return t&&t==n?r:void 0}var nu=U1,L1=nu;function k1(r,e,t){var n=r==null?void 0:L1(r,e);return n===void 0?t:n}var j1=k1;function V1(r,e){return r!=null&&e in Object(r)}var G1=V1,H1=tu,W1=vs,z1=G,X1=bi,Y1=wi,K1=Vt;function Z1(r,e,t){e=H1(e,r);for(var n=-1,i=e.length,a=!1;++n<i;){var o=K1(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&&Y1(i)&&X1(o,i)&&(z1(r)||W1(r)))}var J1=Z1,Q1=G1,e$=J1;function r$(r,e){return r!=null&&e$(r,e,Q1)}var t$=r$,n$=Xs,i$=j1,a$=t$,o$=Ri,s$=Ys,u$=Ks,f$=Vt,c$=1,l$=2;function d$(r,e){return o$(r)&&s$(e)?u$(f$(r),e):function(t){var n=i$(t,r);return n===void 0&&n===e?a$(t,r):n$(e,n,c$|l$)}}var p$=d$;function h$(r){return function(e){return e?.[r]}}var y$=h$,g$=nu;function _$(r){return function(e){return g$(e,r)}}var v$=_$,m$=y$,w$=v$,b$=Ri,$$=Vt;function E$(r){return b$(r)?m$($$(r)):w$(r)}var S$=E$,A$=Qb,O$=p$,I$=Ft,P$=G,x$=S$;function T$(r){return typeof r=="function"?r:r==null?I$:typeof r=="object"?P$(r)?O$(r[0],r[1]):A$(r):x$(r)}var iu=T$,F$=gv,R$=Yv,M$=iu,D$=G,C$=hs;function N$(r,e,t){var n=D$(r)?F$:R$;return t&&C$(r,e,t)&&(e=void 0),n(r,M$(e))}var Ci=N$;Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.calculatePadding=L$,Ce.slicePadding=k$;var B$=Ci,q$=U$(B$);function U$(r){return r&&r.__esModule?r:{default:r}}function L$(r){switch(r%4){case 0:return 0;case 1:return 3;case 2:return 2;case 3:return 1;default:return null}}function k$(r,e){var t=r.slice(e),n=(0,q$.default)(t.buffer(),function(i){return i===0});if(n!==!0)throw new Error("XDR Read Error: invalid padding")}Object.defineProperty(Dt,"__esModule",{value:!0}),Dt.Cursor=void 0;var j$=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}}(),V$=Ce;function G$(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Ni=function(){function r(e){G$(this,r),e instanceof y||(e=typeof e=="number"?y.alloc(e):y.from(e)),this._setBuffer(e),this.rewind()}return j$(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,V$.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){Ni.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){Ni.prototype[e]=function(n){return this.buffer()[e](n,this.tell()),this.seek("+",r[0]),this}})}),Dt.Cursor=Ni,Object.defineProperty(D,"__esModule",{value:!0}),D.default=Z$;var H$=hv,au=su(H$),W$=vi,z$=su(W$),ou=Dt;function su(r){return r&&r.__esModule?r:{default:r}}var X$=Math.pow(2,16),Y$={toXDR:function(e){var t=new ou.Cursor(X$);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 ou.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}}},K$={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 Z$(r){(0,au.default)(r,Y$),(0,z$.default)(r)&&(0,au.default)(r.prototype,K$)}Object.defineProperty(de,"__esModule",{value:!0}),de.Int=void 0;var J$=xt,uu=fu(J$),Q$=D,eE=fu(Q$);function fu(r){return r&&r.__esModule?r:{default:r}}var Rr=de.Int={read:function(e){return e.readInt32BE()},write:function(e,t){if(!(0,uu.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,uu.default)(e)||Math.floor(e)!==e?!1:e>=Rr.MIN_VALUE&&e<=Rr.MAX_VALUE}};Rr.MAX_VALUE=Math.pow(2,31)-1,Rr.MIN_VALUE=-Math.pow(2,31),(0,eE.default)(Rr);var Gt={};function rE(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 cu={exports:{}};(function(r){/**
7
+ */var uo=50;p.TYPED_ARRAY_SUPPORT=At.TYPED_ARRAY_SUPPORT!==void 0?At.TYPED_ARRAY_SUPPORT:!0,Ve();function Ve(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Y(r,e){if(Ve()<e)throw new RangeError("Invalid typed array length");return p.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=p.prototype):(r===null&&(r=new p(e)),r.length=e),r}function p(r,e,t){if(!p.TYPED_ARRAY_SUPPORT&&!(this instanceof p))return new p(r,e,t);if(typeof r=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return Mr(this,r)}return Ft(this,r,e,t)}p.poolSize=8192,p._augment=function(r){return r.__proto__=p.prototype,r};function Ft(r,e,t,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?fo(r,e,t,n):typeof e=="string"?lo(r,e,t):ho(r,e)}p.from=function(r,e,t){return Ft(null,r,e,t)},p.TYPED_ARRAY_SUPPORT&&(p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&p[Symbol.species]);function Rt(r){if(typeof r!="number")throw new TypeError('"size" argument must be a number');if(r<0)throw new RangeError('"size" argument must not be negative')}function co(r,e,t,n){return Rt(e),e<=0?Y(r,e):t!==void 0?typeof n=="string"?Y(r,e).fill(t,n):Y(r,e).fill(t):Y(r,e)}p.alloc=function(r,e,t){return co(null,r,e,t)};function Mr(r,e){if(Rt(e),r=Y(r,e<0?0:Cr(e)|0),!p.TYPED_ARRAY_SUPPORT)for(var t=0;t<e;++t)r[t]=0;return r}p.allocUnsafe=function(r){return Mr(null,r)},p.allocUnsafeSlow=function(r){return Mr(null,r)};function lo(r,e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!p.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var n=Mt(e,t)|0;r=Y(r,n);var i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function Dr(r,e){var t=e.length<0?0:Cr(e.length)|0;r=Y(r,t);for(var n=0;n<t;n+=1)r[n]=e[n]&255;return r}function fo(r,e,t,n){if(e.byteLength,t<0||e.byteLength<t)throw new RangeError("'offset' is out of bounds");if(e.byteLength<t+(n||0))throw new RangeError("'length' is out of bounds");return t===void 0&&n===void 0?e=new Uint8Array(e):n===void 0?e=new Uint8Array(e,t):e=new Uint8Array(e,t,n),p.TYPED_ARRAY_SUPPORT?(r=e,r.__proto__=p.prototype):r=Dr(r,e),r}function ho(r,e){if(X(e)){var t=Cr(e.length)|0;return r=Y(r,t),r.length===0||e.copy(r,0,0,t),r}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Ro(e.length)?Y(r,0):Dr(r,e);if(e.type==="Buffer"&&Pt(e.data))return Dr(r,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Cr(r){if(r>=Ve())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ve().toString(16)+" bytes");return r|0}p.isBuffer=Mo;function X(r){return!!(r!=null&&r._isBuffer)}p.compare=function(e,t){if(!X(e)||!X(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,i=t.length,a=0,o=Math.min(n,i);a<o;++a)if(e[a]!==t[a]){n=e[a],i=t[a];break}return n<i?-1:i<n?1:0},p.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},p.concat=function(e,t){if(!Pt(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return p.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=p.allocUnsafe(t),a=0;for(n=0;n<e.length;++n){var o=e[n];if(!X(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,a),a+=o.length}return i};function Mt(r,e){if(X(r))return r.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(r)||r instanceof ArrayBuffer))return r.byteLength;typeof r!="string"&&(r=""+r);var t=r.length;if(t===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":case void 0:return Ge(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Vt(r).length;default:if(n)return Ge(r).length;e=(""+e).toLowerCase(),n=!0}}p.byteLength=Mt;function po(r,e,t){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Io(this,e,t);case"utf8":case"utf-8":return Nt(this,e,t);case"ascii":return Eo(this,e,t);case"latin1":case"binary":return $o(this,e,t);case"base64":return wo(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return So(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function re(r,e,t){var n=r[e];r[e]=r[t],r[t]=n}p.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)re(this,t,t+1);return this},p.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)re(this,t,t+3),re(this,t+1,t+2);return this},p.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)re(this,t,t+7),re(this,t+1,t+6),re(this,t+2,t+5),re(this,t+3,t+4);return this},p.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?Nt(this,0,e):po.apply(this,arguments)},p.prototype.equals=function(e){if(!X(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:p.compare(this,e)===0},p.prototype.inspect=function(){var e="",t=uo;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},p.prototype.compare=function(e,t,n,i,a){if(!X(e))throw new TypeError("Argument must be a Buffer");if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),t<0||n>e.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&t>=n)return 0;if(i>=a)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,a>>>=0,this===e)return 0;for(var o=a-i,u=n-t,c=Math.min(o,u),h=this.slice(i,a),d=e.slice(t,n),s=0;s<c;++s)if(h[s]!==d[s]){o=h[s],u=d[s];break}return o<u?-1:u<o?1:0};function Dt(r,e,t,n,i){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,isNaN(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=p.from(e,n)),X(e))return e.length===0?-1:Ct(r,e,t,n,i);if(typeof e=="number")return e=e&255,p.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Ct(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function Ct(r,e,t,n,i){var a=1,o=r.length,u=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;a=2,o/=2,u/=2,t/=2}function c(l,m){return a===1?l[m]:l.readUInt16BE(m*a)}var h;if(i){var d=-1;for(h=t;h<o;h++)if(c(r,h)===c(e,d===-1?0:h-d)){if(d===-1&&(d=h),h-d+1===u)return d*a}else d!==-1&&(h-=h-d),d=-1}else for(t+u>o&&(t=o-u),h=t;h>=0;h--){for(var s=!0,_=0;_<u;_++)if(c(r,h+_)!==c(e,_)){s=!1;break}if(s)return h}return-1}p.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},p.prototype.indexOf=function(e,t,n){return Dt(this,e,t,n,!0)},p.prototype.lastIndexOf=function(e,t,n){return Dt(this,e,t,n,!1)};function _o(r,e,t,n){t=Number(t)||0;var i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;var a=e.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o<n;++o){var u=parseInt(e.substr(o*2,2),16);if(isNaN(u))return o;r[t+o]=u}return o}function go(r,e,t,n){return He(Ge(e,r.length-t),r,t,n)}function qt(r,e,t,n){return He(Po(e),r,t,n)}function yo(r,e,t,n){return qt(r,e,t,n)}function vo(r,e,t,n){return He(Vt(e),r,t,n)}function mo(r,e,t,n){return He(Fo(e,r.length-t),r,t,n)}p.prototype.write=function(e,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var a=this.length-t;if((n===void 0||n>a)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return _o(this,e,t,n);case"utf8":case"utf-8":return go(this,e,t,n);case"ascii":return qt(this,e,t,n);case"latin1":case"binary":return yo(this,e,t,n);case"base64":return vo(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mo(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function wo(r,e,t){return e===0&&t===r.length?xt(r):xt(r.slice(e,t))}function Nt(r,e,t){t=Math.min(r.length,t);for(var n=[],i=e;i<t;){var a=r[i],o=null,u=a>239?4:a>223?3:a>191?2:1;if(i+u<=t){var c,h,d,s;switch(u){case 1:a<128&&(o=a);break;case 2:c=r[i+1],(c&192)===128&&(s=(a&31)<<6|c&63,s>127&&(o=s));break;case 3:c=r[i+1],h=r[i+2],(c&192)===128&&(h&192)===128&&(s=(a&15)<<12|(c&63)<<6|h&63,s>2047&&(s<55296||s>57343)&&(o=s));break;case 4:c=r[i+1],h=r[i+2],d=r[i+3],(c&192)===128&&(h&192)===128&&(d&192)===128&&(s=(a&15)<<18|(c&63)<<12|(h&63)<<6|d&63,s>65535&&s<1114112&&(o=s))}}o===null?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=u}return bo(n)}var kt=4096;function bo(r){var e=r.length;if(e<=kt)return String.fromCharCode.apply(String,r);for(var t="",n=0;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=kt));return t}function Eo(r,e,t){var n="";t=Math.min(r.length,t);for(var i=e;i<t;++i)n+=String.fromCharCode(r[i]&127);return n}function $o(r,e,t){var n="";t=Math.min(r.length,t);for(var i=e;i<t;++i)n+=String.fromCharCode(r[i]);return n}function Io(r,e,t){var n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);for(var i="",a=e;a<t;++a)i+=To(r[a]);return i}function So(r,e,t){for(var n=r.slice(e,t),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+n[a+1]*256);return i}p.prototype.slice=function(e,t){var n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var i;if(p.TYPED_ARRAY_SUPPORT)i=this.subarray(e,t),i.__proto__=p.prototype;else{var a=t-e;i=new p(a,void 0);for(var o=0;o<a;++o)i[o]=this[o+e]}return i};function M(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUIntLE=function(e,t,n){e=e|0,t=t|0,n||M(e,t,this.length);for(var i=this[e],a=1,o=0;++o<t&&(a*=256);)i+=this[e+o]*a;return i},p.prototype.readUIntBE=function(e,t,n){e=e|0,t=t|0,n||M(e,t,this.length);for(var i=this[e+--t],a=1;t>0&&(a*=256);)i+=this[e+--t]*a;return i},p.prototype.readUInt8=function(e,t){return t||M(e,1,this.length),this[e]},p.prototype.readUInt16LE=function(e,t){return t||M(e,2,this.length),this[e]|this[e+1]<<8},p.prototype.readUInt16BE=function(e,t){return t||M(e,2,this.length),this[e]<<8|this[e+1]},p.prototype.readUInt32LE=function(e,t){return t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},p.prototype.readUInt32BE=function(e,t){return t||M(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},p.prototype.readIntLE=function(e,t,n){e=e|0,t=t|0,n||M(e,t,this.length);for(var i=this[e],a=1,o=0;++o<t&&(a*=256);)i+=this[e+o]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*t)),i},p.prototype.readIntBE=function(e,t,n){e=e|0,t=t|0,n||M(e,t,this.length);for(var i=t,a=1,o=this[e+--i];i>0&&(a*=256);)o+=this[e+--i]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*t)),o},p.prototype.readInt8=function(e,t){return t||M(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},p.prototype.readInt16LE=function(e,t){t||M(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},p.prototype.readInt16BE=function(e,t){t||M(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},p.prototype.readInt32LE=function(e,t){return t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},p.prototype.readInt32BE=function(e,t){return t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},p.prototype.readFloatLE=function(e,t){return t||M(e,4,this.length),Le(this,e,!0,23,4)},p.prototype.readFloatBE=function(e,t){return t||M(e,4,this.length),Le(this,e,!1,23,4)},p.prototype.readDoubleLE=function(e,t){return t||M(e,8,this.length),Le(this,e,!0,52,8)},p.prototype.readDoubleBE=function(e,t){return t||M(e,8,this.length),Le(this,e,!1,52,8)};function k(r,e,t,n,i,a){if(!X(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<a)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError("Index out of range")}p.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t=t|0,n=n|0,!i){var a=Math.pow(2,8*n)-1;k(this,e,t,n,a,0)}var o=1,u=0;for(this[t]=e&255;++u<n&&(o*=256);)this[t+u]=e/o&255;return t+n},p.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t=t|0,n=n|0,!i){var a=Math.pow(2,8*n)-1;k(this,e,t,n,a,0)}var o=n-1,u=1;for(this[t+o]=e&255;--o>=0&&(u*=256);)this[t+o]=e/u&255;return t+n},p.prototype.writeUInt8=function(e,t,n){return e=+e,t=t|0,n||k(this,e,t,1,255,0),p.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e&255,t+1};function je(r,e,t,n){e<0&&(e=65535+e+1);for(var i=0,a=Math.min(r.length-t,2);i<a;++i)r[t+i]=(e&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}p.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t|0,n||k(this,e,t,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):je(this,e,t,!0),t+2},p.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t|0,n||k(this,e,t,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):je(this,e,t,!1),t+2};function Xe(r,e,t,n){e<0&&(e=4294967295+e+1);for(var i=0,a=Math.min(r.length-t,4);i<a;++i)r[t+i]=e>>>(n?i:3-i)*8&255}p.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t|0,n||k(this,e,t,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255):Xe(this,e,t,!0),t+4},p.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t|0,n||k(this,e,t,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):Xe(this,e,t,!1),t+4},p.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t|0,!i){var a=Math.pow(2,8*n-1);k(this,e,t,n,a-1,-a)}var o=0,u=1,c=0;for(this[t]=e&255;++o<n&&(u*=256);)e<0&&c===0&&this[t+o-1]!==0&&(c=1),this[t+o]=(e/u>>0)-c&255;return t+n},p.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t|0,!i){var a=Math.pow(2,8*n-1);k(this,e,t,n,a-1,-a)}var o=n-1,u=1,c=0;for(this[t+o]=e&255;--o>=0&&(u*=256);)e<0&&c===0&&this[t+o+1]!==0&&(c=1),this[t+o]=(e/u>>0)-c&255;return t+n},p.prototype.writeInt8=function(e,t,n){return e=+e,t=t|0,n||k(this,e,t,1,127,-128),p.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=e&255,t+1},p.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t|0,n||k(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):je(this,e,t,!0),t+2},p.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t|0,n||k(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):je(this,e,t,!1),t+2},p.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t|0,n||k(this,e,t,4,2147483647,-2147483648),p.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Xe(this,e,t,!0),t+4},p.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t|0,n||k(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):Xe(this,e,t,!1),t+4};function Ut(r,e,t,n,i,a){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Bt(r,e,t,n,i){return i||Ut(r,e,t,4),Tt(r,e,t,n,23,4),t+4}p.prototype.writeFloatLE=function(e,t,n){return Bt(this,e,t,!0,n)},p.prototype.writeFloatBE=function(e,t,n){return Bt(this,e,t,!1,n)};function Lt(r,e,t,n,i){return i||Ut(r,e,t,8),Tt(r,e,t,n,52,8),t+8}p.prototype.writeDoubleLE=function(e,t,n){return Lt(this,e,t,!0,n)},p.prototype.writeDoubleBE=function(e,t,n){return Lt(this,e,t,!1,n)},p.prototype.copy=function(e,t,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var a=i-n,o;if(this===e&&n<t&&t<i)for(o=a-1;o>=0;--o)e[o+t]=this[o+n];else if(a<1e3||!p.TYPED_ARRAY_SUPPORT)for(o=0;o<a;++o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+a),t);return a},p.prototype.fill=function(e,t,n,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),e.length===1){var a=e.charCodeAt(0);a<256&&(e=a)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!p.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof e=="number"&&(e=e&255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=t;o<n;++o)this[o]=e;else{var u=X(e)?e:Ge(new p(e,i).toString()),c=u.length;for(o=0;o<n-t;++o)this[o+t]=u[o%c]}return this};var Ao=/[^+\/0-9A-Za-z-_]/g;function Oo(r){if(r=xo(r).replace(Ao,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function xo(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function To(r){return r<16?"0"+r.toString(16):r.toString(16)}function Ge(r,e){e=e||1/0;for(var t,n=r.length,i=null,a=[],o=0;o<n;++o){if(t=r.charCodeAt(o),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&a.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&a.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;a.push(t)}else if(t<2048){if((e-=2)<0)break;a.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;a.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;a.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return a}function Po(r){for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function Fo(r,e){for(var t,n,i,a=[],o=0;o<r.length&&!((e-=2)<0);++o)t=r.charCodeAt(o),n=t>>8,i=t%256,a.push(i),a.push(n);return a}function Vt(r){return io(Oo(r))}function He(r,e,t,n){for(var i=0;i<n&&!(i+t>=e.length||i>=r.length);++i)e[i+t]=r[i];return i}function Ro(r){return r!==r}function Mo(r){return r!=null&&(!!r._isBuffer||jt(r)||Do(r))}function jt(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Do(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&jt(r.slice(0,0))}var R={};function Co(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var ue=Co,qo=Z,No=ue,ko="[object AsyncFunction]",Uo="[object Function]",Bo="[object GeneratorFunction]",Lo="[object Proxy]";function Vo(r){if(!No(r))return!1;var e=qo(r);return e==Uo||e==Bo||e==ko||e==Lo}var qr=Vo,jo=z,Xo=jo["__core-js_shared__"],Go=Xo,Nr=Go,Xt=function(){var r=/[^.]+$/.exec(Nr&&Nr.keys&&Nr.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function Ho(r){return!!Xt&&Xt in r}var Wo=Ho,zo=Function.prototype,Yo=zo.toString;function Ko(r){if(r!=null){try{return Yo.call(r)}catch{}try{return r+""}catch{}}return""}var Gt=Ko,Zo=qr,Jo=Wo,Qo=ue,es=Gt,rs=/[\\^$.*+?()[\]{}|]/g,ts=/^\[object .+?Constructor\]$/,ns=Function.prototype,is=Object.prototype,as=ns.toString,os=is.hasOwnProperty,ss=RegExp("^"+as.call(os).replace(rs,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function us(r){if(!Qo(r)||Jo(r))return!1;var e=Zo(r)?ss:ts;return e.test(es(r))}var cs=us;function ls(r,e){return r?.[e]}var fs=ls,ds=cs,hs=fs;function ps(r,e){var t=hs(r,e);return ds(t)?t:void 0}var te=ps,_s=te,gs=function(){try{var r=_s(Object,"defineProperty");return r({},"",{}),r}catch{}}(),Ht=gs,Wt=Ht;function ys(r,e,t){e=="__proto__"&&Wt?Wt(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var zt=ys;function vs(r,e){return r===e||r!==r&&e!==e}var We=vs,ms=zt,ws=We,bs=Object.prototype,Es=bs.hasOwnProperty;function $s(r,e,t){var n=r[e];(!(Es.call(r,e)&&ws(n,t))||t===void 0&&!(e in r))&&ms(r,e,t)}var Is=$s,Ss=Is,As=zt;function Os(r,e,t,n){var i=!t;t||(t={});for(var a=-1,o=e.length;++a<o;){var u=e[a],c=n?n(t[u],r[u],u,t,r):void 0;c===void 0&&(c=r[u]),i?As(t,u,c):Ss(t,u,c)}return t}var xs=Os;function Ts(r){return r}var ze=Ts;function Ps(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 Fs=Ps,Rs=Fs,Yt=Math.max;function Ms(r,e,t){return e=Yt(e===void 0?r.length-1:e,0),function(){for(var n=arguments,i=-1,a=Yt(n.length-e,0),o=Array(a);++i<a;)o[i]=n[e+i];i=-1;for(var u=Array(e+1);++i<e;)u[i]=n[i];return u[e]=t(o),Rs(r,this,u)}}var Ds=Ms;function Cs(r){return function(){return r}}var qs=Cs,Ns=qs,Kt=Ht,ks=ze,Us=Kt?function(r,e){return Kt(r,"toString",{configurable:!0,enumerable:!1,value:Ns(e),writable:!0})}:ks,Bs=Us,Ls=800,Vs=16,js=Date.now;function Xs(r){var e=0,t=0;return function(){var n=js(),i=Vs-(n-t);if(t=n,i>0){if(++e>=Ls)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}var Gs=Xs,Hs=Bs,Ws=Gs,zs=Ws(Hs),Ys=zs,Ks=ze,Zs=Ds,Js=Ys;function Qs(r,e){return Js(Zs(r,e,Ks),r+"")}var eu=Qs,ru=9007199254740991;function tu(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=ru}var kr=tu,nu=qr,iu=kr;function au(r){return r!=null&&iu(r.length)&&!nu(r)}var we=au,ou=9007199254740991,su=/^(?:0|[1-9]\d*)$/;function uu(r,e){var t=typeof r;return e=e??ou,!!e&&(t=="number"||t!="symbol"&&su.test(r))&&r>-1&&r%1==0&&r<e}var Ur=uu,cu=We,lu=we,fu=Ur,du=ue;function hu(r,e,t){if(!du(t))return!1;var n=typeof e;return(n=="number"?lu(t)&&fu(e,t.length):n=="string"&&e in t)?cu(t[e],r):!1}var Zt=hu,pu=eu,_u=Zt;function gu(r){return pu(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&&_u(t[0],t[1],o)&&(a=i<3?void 0:a,i=1),e=Object(e);++n<i;){var u=t[n];u&&r(e,u,n,a)}return e})}var yu=gu;function vu(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var Jt=vu,mu=Z,wu=J,bu="[object Arguments]";function Eu(r){return wu(r)&&mu(r)==bu}var $u=Eu,Qt=$u,Iu=J,en=Object.prototype,Su=en.hasOwnProperty,Au=en.propertyIsEnumerable,Ou=Qt(function(){return arguments}())?Qt:function(r){return Iu(r)&&Su.call(r,"callee")&&!Au.call(r,"callee")},rn=Ou,xu=Array.isArray,N=xu,Ye={exports:{}};function Tu(){return!1}var Pu=Tu;Ye.exports,function(r,e){var t=z,n=Pu,i=e&&!e.nodeType&&e,a=i&&!0&&r&&!r.nodeType&&r,o=a&&a.exports===i,u=o?t.Buffer:void 0,c=u?u.isBuffer:void 0,h=c||n;r.exports=h}(Ye,Ye.exports);var tn=Ye.exports,Fu=Z,Ru=kr,Mu=J,Du="[object Arguments]",Cu="[object Array]",qu="[object Boolean]",Nu="[object Date]",ku="[object Error]",Uu="[object Function]",Bu="[object Map]",Lu="[object Number]",Vu="[object Object]",ju="[object RegExp]",Xu="[object Set]",Gu="[object String]",Hu="[object WeakMap]",Wu="[object ArrayBuffer]",zu="[object DataView]",Yu="[object Float32Array]",Ku="[object Float64Array]",Zu="[object Int8Array]",Ju="[object Int16Array]",Qu="[object Int32Array]",ec="[object Uint8Array]",rc="[object Uint8ClampedArray]",tc="[object Uint16Array]",nc="[object Uint32Array]",F={};F[Yu]=F[Ku]=F[Zu]=F[Ju]=F[Qu]=F[ec]=F[rc]=F[tc]=F[nc]=!0,F[Du]=F[Cu]=F[Wu]=F[qu]=F[zu]=F[Nu]=F[ku]=F[Uu]=F[Bu]=F[Lu]=F[Vu]=F[ju]=F[Xu]=F[Gu]=F[Hu]=!1;function ic(r){return Mu(r)&&Ru(r.length)&&!!F[Fu(r)]}var ac=ic;function oc(r){return function(e){return r(e)}}var sc=oc,Ke={exports:{}};Ke.exports,function(r,e){var t=bt,n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,o=a&&t.process,u=function(){try{var c=i&&i.require&&i.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();r.exports=u}(Ke,Ke.exports);var uc=Ke.exports,cc=ac,lc=sc,nn=uc,an=nn&&nn.isTypedArray,fc=an?lc(an):cc,on=fc,dc=Jt,hc=rn,pc=N,_c=tn,gc=Ur,yc=on,vc=Object.prototype,mc=vc.hasOwnProperty;function wc(r,e){var t=pc(r),n=!t&&hc(r),i=!t&&!n&&_c(r),a=!t&&!n&&!i&&yc(r),o=t||n||i||a,u=o?dc(r.length,String):[],c=u.length;for(var h in r)(e||mc.call(r,h))&&!(o&&(h=="length"||i&&(h=="offset"||h=="parent")||a&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||gc(h,c)))&&u.push(h);return u}var sn=wc,bc=Object.prototype;function Ec(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||bc;return r===t}var un=Ec;function $c(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var Ic=$c,Sc=ue,Ac=un,Oc=Ic,xc=Object.prototype,Tc=xc.hasOwnProperty;function Pc(r){if(!Sc(r))return Oc(r);var e=Ac(r),t=[];for(var n in r)n=="constructor"&&(e||!Tc.call(r,n))||t.push(n);return t}var Fc=Pc,Rc=sn,Mc=Fc,Dc=we;function Cc(r){return Dc(r)?Rc(r,!0):Mc(r)}var qc=Cc,Nc=xs,kc=yu,Uc=qc,Bc=kc(function(r,e){Nc(e,Uc(e),r)}),Lc=Bc,Vc=Lc,Ze={},ne={};function jc(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 Xc=jc;function Gc(r){return function(e,t,n){for(var i=-1,a=Object(e),o=n(e),u=o.length;u--;){var c=o[r?u:++i];if(t(a[c],c,a)===!1)break}return e}}var Hc=Gc,Wc=Hc,zc=Wc(),Yc=zc;function Kc(r,e){return function(t){return r(e(t))}}var Zc=Kc,Jc=Zc,Qc=Jc(Object.keys,Object),el=Qc,rl=un,tl=el,nl=Object.prototype,il=nl.hasOwnProperty;function al(r){if(!rl(r))return tl(r);var e=[];for(var t in Object(r))il.call(r,t)&&t!="constructor"&&e.push(t);return e}var ol=al,sl=sn,ul=ol,cl=we;function ll(r){return cl(r)?sl(r):ul(r)}var Je=ll,fl=Yc,dl=Je;function hl(r,e){return r&&fl(r,e,dl)}var pl=hl,_l=we;function gl(r,e){return function(t,n){if(t==null)return t;if(!_l(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 yl=gl,vl=pl,ml=yl,wl=ml(vl),Br=wl,bl=Br;function El(r,e){var t=!0;return bl(r,function(n,i,a){return t=!!e(n,i,a),t}),t}var $l=El;function Il(){this.__data__=[],this.size=0}var Sl=Il,Al=We;function Ol(r,e){for(var t=r.length;t--;)if(Al(r[t][0],e))return t;return-1}var Qe=Ol,xl=Qe,Tl=Array.prototype,Pl=Tl.splice;function Fl(r){var e=this.__data__,t=xl(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():Pl.call(e,t,1),--this.size,!0}var Rl=Fl,Ml=Qe;function Dl(r){var e=this.__data__,t=Ml(e,r);return t<0?void 0:e[t][1]}var Cl=Dl,ql=Qe;function Nl(r){return ql(this.__data__,r)>-1}var kl=Nl,Ul=Qe;function Bl(r,e){var t=this.__data__,n=Ul(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var Ll=Bl,Vl=Sl,jl=Rl,Xl=Cl,Gl=kl,Hl=Ll;function ce(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])}}ce.prototype.clear=Vl,ce.prototype.delete=jl,ce.prototype.get=Xl,ce.prototype.has=Gl,ce.prototype.set=Hl;var er=ce,Wl=er;function zl(){this.__data__=new Wl,this.size=0}var Yl=zl;function Kl(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var Zl=Kl;function Jl(r){return this.__data__.get(r)}var Ql=Jl;function ef(r){return this.__data__.has(r)}var rf=ef,tf=te,nf=z,af=tf(nf,"Map"),Lr=af,of=te,sf=of(Object,"create"),rr=sf,cn=rr;function uf(){this.__data__=cn?cn(null):{},this.size=0}var cf=uf;function lf(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var ff=lf,df=rr,hf="__lodash_hash_undefined__",pf=Object.prototype,_f=pf.hasOwnProperty;function gf(r){var e=this.__data__;if(df){var t=e[r];return t===hf?void 0:t}return _f.call(e,r)?e[r]:void 0}var yf=gf,vf=rr,mf=Object.prototype,wf=mf.hasOwnProperty;function bf(r){var e=this.__data__;return vf?e[r]!==void 0:wf.call(e,r)}var Ef=bf,$f=rr,If="__lodash_hash_undefined__";function Sf(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=$f&&e===void 0?If:e,this}var Af=Sf,Of=cf,xf=ff,Tf=yf,Pf=Ef,Ff=Af;function le(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])}}le.prototype.clear=Of,le.prototype.delete=xf,le.prototype.get=Tf,le.prototype.has=Pf,le.prototype.set=Ff;var Rf=le,ln=Rf,Mf=er,Df=Lr;function Cf(){this.size=0,this.__data__={hash:new ln,map:new(Df||Mf),string:new ln}}var qf=Cf;function Nf(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var kf=Nf,Uf=kf;function Bf(r,e){var t=r.__data__;return Uf(e)?t[typeof e=="string"?"string":"hash"]:t.map}var tr=Bf,Lf=tr;function Vf(r){var e=Lf(this,r).delete(r);return this.size-=e?1:0,e}var jf=Vf,Xf=tr;function Gf(r){return Xf(this,r).get(r)}var Hf=Gf,Wf=tr;function zf(r){return Wf(this,r).has(r)}var Yf=zf,Kf=tr;function Zf(r,e){var t=Kf(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var Jf=Zf,Qf=qf,ed=jf,rd=Hf,td=Yf,nd=Jf;function fe(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])}}fe.prototype.clear=Qf,fe.prototype.delete=ed,fe.prototype.get=rd,fe.prototype.has=td,fe.prototype.set=nd;var Vr=fe,id=er,ad=Lr,od=Vr,sd=200;function ud(r,e){var t=this.__data__;if(t instanceof id){var n=t.__data__;if(!ad||n.length<sd-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new od(n)}return t.set(r,e),this.size=t.size,this}var cd=ud,ld=er,fd=Yl,dd=Zl,hd=Ql,pd=rf,_d=cd;function de(r){var e=this.__data__=new ld(r);this.size=e.size}de.prototype.clear=fd,de.prototype.delete=dd,de.prototype.get=hd,de.prototype.has=pd,de.prototype.set=_d;var fn=de,gd="__lodash_hash_undefined__";function yd(r){return this.__data__.set(r,gd),this}var vd=yd;function md(r){return this.__data__.has(r)}var wd=md,bd=Vr,Ed=vd,$d=wd;function nr(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new bd;++e<t;)this.add(r[e])}nr.prototype.add=nr.prototype.push=Ed,nr.prototype.has=$d;var Id=nr;function Sd(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 Ad=Sd;function Od(r,e){return r.has(e)}var xd=Od,Td=Id,Pd=Ad,Fd=xd,Rd=1,Md=2;function Dd(r,e,t,n,i,a){var o=t&Rd,u=r.length,c=e.length;if(u!=c&&!(o&&c>u))return!1;var h=a.get(r),d=a.get(e);if(h&&d)return h==e&&d==r;var s=-1,_=!0,l=t&Md?new Td:void 0;for(a.set(r,e),a.set(e,r);++s<u;){var m=r[s],E=e[s];if(n)var I=o?n(E,m,s,e,r,a):n(m,E,s,r,e,a);if(I!==void 0){if(I)continue;_=!1;break}if(l){if(!Pd(e,function(x,O){if(!Fd(l,O)&&(m===x||i(m,x,t,n,a)))return l.push(O)})){_=!1;break}}else if(!(m===E||i(m,E,t,n,a))){_=!1;break}}return a.delete(r),a.delete(e),_}var dn=Dd,Cd=z,qd=Cd.Uint8Array,Nd=qd;function kd(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}var Ud=kd;function Bd(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var Ld=Bd,hn=Ue,pn=Nd,Vd=We,jd=dn,Xd=Ud,Gd=Ld,Hd=1,Wd=2,zd="[object Boolean]",Yd="[object Date]",Kd="[object Error]",Zd="[object Map]",Jd="[object Number]",Qd="[object RegExp]",eh="[object Set]",rh="[object String]",th="[object Symbol]",nh="[object ArrayBuffer]",ih="[object DataView]",_n=hn?hn.prototype:void 0,jr=_n?_n.valueOf:void 0;function ah(r,e,t,n,i,a,o){switch(t){case ih:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case nh:return!(r.byteLength!=e.byteLength||!a(new pn(r),new pn(e)));case zd:case Yd:case Jd:return Vd(+r,+e);case Kd:return r.name==e.name&&r.message==e.message;case Qd:case rh:return r==e+"";case Zd:var u=Xd;case eh:var c=n&Hd;if(u||(u=Gd),r.size!=e.size&&!c)return!1;var h=o.get(r);if(h)return h==e;n|=Wd,o.set(r,e);var d=jd(u(r),u(e),n,i,a,o);return o.delete(r),d;case th:if(jr)return jr.call(r)==jr.call(e)}return!1}var oh=ah;function sh(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}var uh=sh,ch=uh,lh=N;function fh(r,e,t){var n=e(r);return lh(r)?n:ch(n,t(r))}var dh=fh;function hh(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 ph=hh;function _h(){return[]}var gh=_h,yh=ph,vh=gh,mh=Object.prototype,wh=mh.propertyIsEnumerable,gn=Object.getOwnPropertySymbols,bh=gn?function(r){return r==null?[]:(r=Object(r),yh(gn(r),function(e){return wh.call(r,e)}))}:vh,Eh=bh,$h=dh,Ih=Eh,Sh=Je;function Ah(r){return $h(r,Sh,Ih)}var Oh=Ah,yn=Oh,xh=1,Th=Object.prototype,Ph=Th.hasOwnProperty;function Fh(r,e,t,n,i,a){var o=t&xh,u=yn(r),c=u.length,h=yn(e),d=h.length;if(c!=d&&!o)return!1;for(var s=c;s--;){var _=u[s];if(!(o?_ in e:Ph.call(e,_)))return!1}var l=a.get(r),m=a.get(e);if(l&&m)return l==e&&m==r;var E=!0;a.set(r,e),a.set(e,r);for(var I=o;++s<c;){_=u[s];var x=r[_],O=e[_];if(n)var f=o?n(O,x,_,e,r,a):n(x,O,_,r,e,a);if(!(f===void 0?x===O||i(x,O,t,n,a):f)){E=!1;break}I||(I=_=="constructor")}if(E&&!I){var S=r.constructor,P=e.constructor;S!=P&&"constructor"in r&&"constructor"in e&&!(typeof S=="function"&&S instanceof S&&typeof P=="function"&&P instanceof P)&&(E=!1)}return a.delete(r),a.delete(e),E}var Rh=Fh,Mh=te,Dh=z,Ch=Mh(Dh,"DataView"),qh=Ch,Nh=te,kh=z,Uh=Nh(kh,"Promise"),Bh=Uh,Lh=te,Vh=z,jh=Lh(Vh,"Set"),Xh=jh,Gh=te,Hh=z,Wh=Gh(Hh,"WeakMap"),zh=Wh,Xr=qh,Gr=Lr,Hr=Bh,Wr=Xh,zr=zh,vn=Z,he=Gt,mn="[object Map]",Yh="[object Object]",wn="[object Promise]",bn="[object Set]",En="[object WeakMap]",$n="[object DataView]",Kh=he(Xr),Zh=he(Gr),Jh=he(Hr),Qh=he(Wr),ep=he(zr),ie=vn;(Xr&&ie(new Xr(new ArrayBuffer(1)))!=$n||Gr&&ie(new Gr)!=mn||Hr&&ie(Hr.resolve())!=wn||Wr&&ie(new Wr)!=bn||zr&&ie(new zr)!=En)&&(ie=function(r){var e=vn(r),t=e==Yh?r.constructor:void 0,n=t?he(t):"";if(n)switch(n){case Kh:return $n;case Zh:return mn;case Jh:return wn;case Qh:return bn;case ep:return En}return e});var rp=ie,Yr=fn,tp=dn,np=oh,ip=Rh,In=rp,Sn=N,An=tn,ap=on,op=1,On="[object Arguments]",xn="[object Array]",ir="[object Object]",sp=Object.prototype,Tn=sp.hasOwnProperty;function up(r,e,t,n,i,a){var o=Sn(r),u=Sn(e),c=o?xn:In(r),h=u?xn:In(e);c=c==On?ir:c,h=h==On?ir:h;var d=c==ir,s=h==ir,_=c==h;if(_&&An(r)){if(!An(e))return!1;o=!0,d=!1}if(_&&!d)return a||(a=new Yr),o||ap(r)?tp(r,e,t,n,i,a):np(r,e,c,t,n,i,a);if(!(t&op)){var l=d&&Tn.call(r,"__wrapped__"),m=s&&Tn.call(e,"__wrapped__");if(l||m){var E=l?r.value():r,I=m?e.value():e;return a||(a=new Yr),i(E,I,t,n,a)}}return _?(a||(a=new Yr),ip(r,e,t,n,i,a)):!1}var cp=up,lp=cp,Pn=J;function Fn(r,e,t,n,i){return r===e?!0:r==null||e==null||!Pn(r)&&!Pn(e)?r!==r&&e!==e:lp(r,e,t,n,Fn,i)}var Rn=Fn,fp=fn,dp=Rn,hp=1,pp=2;function _p(r,e,t,n){var i=t.length,a=i,o=!n;if(r==null)return!a;for(r=Object(r);i--;){var u=t[i];if(o&&u[2]?u[1]!==r[u[0]]:!(u[0]in r))return!1}for(;++i<a;){u=t[i];var c=u[0],h=r[c],d=u[1];if(o&&u[2]){if(h===void 0&&!(c in r))return!1}else{var s=new fp;if(n)var _=n(h,d,c,r,e,s);if(!(_===void 0?dp(d,h,hp|pp,n,s):_))return!1}}return!0}var gp=_p,yp=ue;function vp(r){return r===r&&!yp(r)}var Mn=vp,mp=Mn,wp=Je;function bp(r){for(var e=wp(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,mp(i)]}return e}var Ep=bp;function $p(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}var Dn=$p,Ip=gp,Sp=Ep,Ap=Dn;function Op(r){var e=Sp(r);return e.length==1&&e[0][2]?Ap(e[0][0],e[0][1]):function(t){return t===r||Ip(t,r,e)}}var xp=Op,Tp=Z,Pp=J,Fp="[object Symbol]";function Rp(r){return typeof r=="symbol"||Pp(r)&&Tp(r)==Fp}var ar=Rp,Mp=N,Dp=ar,Cp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qp=/^\w*$/;function Np(r,e){if(Mp(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||Dp(r)?!0:qp.test(r)||!Cp.test(r)||e!=null&&r in Object(e)}var Kr=Np,Cn=Vr,kp="Expected a function";function Zr(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(kp);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(Zr.Cache||Cn),t}Zr.Cache=Cn;var Up=Zr,Bp=Up,Lp=500;function Vp(r){var e=Bp(r,function(n){return t.size===Lp&&t.clear(),n}),t=e.cache;return e}var jp=Vp,Xp=jp,Gp=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Hp=/\\(\\)?/g,Wp=Xp(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(Gp,function(t,n,i,a){e.push(i?a.replace(Hp,"$1"):n||t)}),e}),zp=Wp;function Yp(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 Jr=Yp,qn=Ue,Kp=Jr,Zp=N,Jp=ar,Qp=1/0,Nn=qn?qn.prototype:void 0,kn=Nn?Nn.toString:void 0;function Un(r){if(typeof r=="string")return r;if(Zp(r))return Kp(r,Un)+"";if(Jp(r))return kn?kn.call(r):"";var e=r+"";return e=="0"&&1/r==-Qp?"-0":e}var e_=Un,r_=e_;function t_(r){return r==null?"":r_(r)}var n_=t_,i_=N,a_=Kr,o_=zp,s_=n_;function u_(r,e){return i_(r)?r:a_(r,e)?[r]:o_(s_(r))}var Bn=u_,c_=ar,l_=1/0;function f_(r){if(typeof r=="string"||c_(r))return r;var e=r+"";return e=="0"&&1/r==-l_?"-0":e}var or=f_,d_=Bn,h_=or;function p_(r,e){e=d_(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[h_(e[t++])];return t&&t==n?r:void 0}var Ln=p_,__=Ln;function g_(r,e,t){var n=r==null?void 0:__(r,e);return n===void 0?t:n}var y_=g_;function v_(r,e){return r!=null&&e in Object(r)}var m_=v_,w_=Bn,b_=rn,E_=N,$_=Ur,I_=kr,S_=or;function A_(r,e,t){e=w_(e,r);for(var n=-1,i=e.length,a=!1;++n<i;){var o=S_(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&&I_(i)&&$_(o,i)&&(E_(r)||b_(r)))}var O_=A_,x_=m_,T_=O_;function P_(r,e){return r!=null&&T_(r,e,x_)}var F_=P_,R_=Rn,M_=y_,D_=F_,C_=Kr,q_=Mn,N_=Dn,k_=or,U_=1,B_=2;function L_(r,e){return C_(r)&&q_(e)?N_(k_(r),e):function(t){var n=M_(t,r);return n===void 0&&n===e?D_(t,r):R_(e,n,U_|B_)}}var V_=L_;function j_(r){return function(e){return e?.[r]}}var X_=j_,G_=Ln;function H_(r){return function(e){return G_(e,r)}}var W_=H_,z_=X_,Y_=W_,K_=Kr,Z_=or;function J_(r){return K_(r)?z_(Z_(r)):Y_(r)}var Q_=J_,eg=xp,rg=V_,tg=ze,ng=N,ig=Q_;function ag(r){return typeof r=="function"?r:r==null?tg:typeof r=="object"?ng(r)?rg(r[0],r[1]):eg(r):ig(r)}var Vn=ag,og=Xc,sg=$l,ug=Vn,cg=N,lg=Zt;function fg(r,e,t){var n=cg(r)?og:sg;return t&&lg(r,e,t)&&(e=void 0),n(r,ug(e))}var Qr=fg;Object.defineProperty(ne,"__esModule",{value:!0}),ne.calculatePadding=_g,ne.slicePadding=gg;var dg=Qr,hg=pg(dg);function pg(r){return r&&r.__esModule?r:{default:r}}function _g(r){switch(r%4){case 0:return 0;case 1:return 3;case 2:return 2;case 3:return 1;default:return null}}function gg(r,e){var t=r.slice(e),n=(0,hg.default)(t.buffer(),function(i){return i===0});if(n!==!0)throw new Error("XDR Read Error: invalid padding")}Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.Cursor=void 0;var yg=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}}(),vg=ne;function mg(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var et=function(){function r(e){mg(this,r),e instanceof p||(e=typeof e=="number"?p.alloc(e):p.from(e)),this._setBuffer(e),this.rewind()}return yg(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 p?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=p.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,vg.calculatePadding)(t.length),i=p.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){et.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){et.prototype[e]=function(n){return this.buffer()[e](n,this.tell()),this.seek("+",r[0]),this}})}),Ze.Cursor=et,Object.defineProperty(R,"__esModule",{value:!0}),R.default=Ag;var wg=Vc,jn=Gn(wg),bg=qr,Eg=Gn(bg),Xn=Ze;function Gn(r){return r&&r.__esModule?r:{default:r}}var $g=Math.pow(2,16),Ig={toXDR:function(e){var t=new Xn.Cursor($g);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=p.from(e,"hex");break;case"base64":n=p.from(e,"base64");break;default:throw new Error("Invalid format "+t+', must be "raw", "hex", "base64"')}var i=new Xn.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}}},Sg={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 Ag(r){(0,jn.default)(r,Ig),(0,Eg.default)(r)&&(0,jn.default)(r.prototype,Sg)}Object.defineProperty(W,"__esModule",{value:!0}),W.Int=void 0;var Og=Be,Hn=Wn(Og),xg=R,Tg=Wn(xg);function Wn(r){return r&&r.__esModule?r:{default:r}}var be=W.Int={read:function(e){return e.readInt32BE()},write:function(e,t){if(!(0,Hn.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,Hn.default)(e)||Math.floor(e)!==e?!1:e>=be.MIN_VALUE&&e<=be.MAX_VALUE}};be.MAX_VALUE=Math.pow(2,31)-1,be.MIN_VALUE=-Math.pow(2,31),(0,Tg.default)(be);var sr={};function Pg(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 zn={exports:{}};(function(r){/**
21
8
  * @license Long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
22
9
  * Released under the Apache License, Version 2.0
23
10
  * see: https://github.com/dcodeIO/Long.js for details
24
- */(function(e,t){typeof rE=="function"&&r&&r.exports?r.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(C,function(){function e(c,s,l){this.low=c|0,this.high=s|0,this.unsigned=!!l}e.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=function(s){return(s&&s.__isLong__)===!0};var t={},n={};e.fromInt=function(s,l){var p,g;return l?(s=s>>>0,0<=s&&s<256&&(g=n[s],g)?g:(p=new e(s,(s|0)<0?-1:0,!0),0<=s&&s<256&&(n[s]=p),p)):(s=s|0,-128<=s&&s<128&&(g=t[s],g)?g:(p=new e(s,s<0?-1:0,!1),-128<=s&&s<128&&(t[s]=p),p))},e.fromNumber=function(s,l){return l=!!l,isNaN(s)||!isFinite(s)?e.ZERO:!l&&s<=-f?e.MIN_VALUE:!l&&s+1>=f?e.MAX_VALUE:l&&s>=u?e.MAX_UNSIGNED_VALUE:s<0?e.fromNumber(-s,l).negate():new e(s%o|0,s/o|0,l)},e.fromBits=function(s,l,p){return new e(s,l,p)},e.fromString=function(s,l,p){if(s.length===0)throw Error("number format error: empty string");if(s==="NaN"||s==="Infinity"||s==="+Infinity"||s==="-Infinity")return e.ZERO;if(typeof l=="number"&&(p=l,l=!1),p=p||10,p<2||36<p)throw Error("radix out of range: "+p);var g;if((g=s.indexOf("-"))>0)throw Error('number format error: interior "-" character: '+s);if(g===0)return e.fromString(s.substring(1),l,p).negate();for(var $=e.fromNumber(Math.pow(p,8)),E=e.ZERO,A=0;A<s.length;A+=8){var S=Math.min(8,s.length-A),h=parseInt(s.substring(A,A+S),p);if(S<8){var O=e.fromNumber(Math.pow(p,S));E=E.multiply(O).add(e.fromNumber(h))}else E=E.multiply($),E=E.add(e.fromNumber(h))}return E.unsigned=l,E},e.fromValue=function(s){return s instanceof e?s:typeof s=="number"?e.fromNumber(s):typeof s=="string"?e.fromString(s):new e(s.low,s.high,s.unsigned)};var i=65536,a=1<<24,o=i*i,u=o*o,f=u/2,d=e.fromInt(a);return e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*o+(this.low>>>0):this.high*o+(this.low>>>0)},e.prototype.toString=function(s){if(s=s||10,s<2||36<s)throw RangeError("radix out of range: "+s);if(this.isZero())return"0";var l;if(this.isNegative())if(this.equals(e.MIN_VALUE)){var p=e.fromNumber(s),g=this.divide(p);return l=g.multiply(p).subtract(this),g.toString(s)+l.toInt().toString(s)}else return"-"+this.negate().toString(s);var $=e.fromNumber(Math.pow(s,6),this.unsigned);l=this;for(var E="";;){var A=l.divide($),S=l.subtract(A.multiply($)).toInt()>>>0,h=S.toString(s);if(l=A,l.isZero())return h+E;for(;h.length<6;)h="0"+h;E=""+h+E}},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(e.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var s=this.high!=0?this.high:this.low,l=31;l>0&&!(s&1<<l);l--);return this.high!=0?l+33:l+1},e.prototype.isZero=function(){return this.high===0&&this.low===0},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isOdd=function(){return(this.low&1)===1},e.prototype.isEven=function(){return(this.low&1)===0},e.prototype.equals=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.unsigned!==s.unsigned&&this.high>>>31===1&&s.high>>>31===1?!1:this.high===s.high&&this.low===s.low},e.eq=e.prototype.equals,e.prototype.notEquals=function(s){return!this.equals(s)},e.neq=e.prototype.notEquals,e.prototype.lessThan=function(s){return this.compare(s)<0},e.prototype.lt=e.prototype.lessThan,e.prototype.lessThanOrEqual=function(s){return this.compare(s)<=0},e.prototype.lte=e.prototype.lessThanOrEqual,e.prototype.greaterThan=function(s){return this.compare(s)>0},e.prototype.gt=e.prototype.greaterThan,e.prototype.greaterThanOrEqual=function(s){return this.compare(s)>=0},e.prototype.gte=e.prototype.greaterThanOrEqual,e.prototype.compare=function(s){if(e.isLong(s)||(s=e.fromValue(s)),this.equals(s))return 0;var l=this.isNegative(),p=s.isNegative();return l&&!p?-1:!l&&p?1:this.unsigned?s.high>>>0>this.high>>>0||s.high===this.high&&s.low>>>0>this.low>>>0?-1:1:this.subtract(s).isNegative()?-1:1},e.prototype.negate=function(){return!this.unsigned&&this.equals(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=e.prototype.negate,e.prototype.add=function(s){e.isLong(s)||(s=e.fromValue(s));var l=this.high>>>16,p=this.high&65535,g=this.low>>>16,$=this.low&65535,E=s.high>>>16,A=s.high&65535,S=s.low>>>16,h=s.low&65535,O=0,T=0,R=0,b=0;return b+=$+h,R+=b>>>16,b&=65535,R+=g+S,T+=R>>>16,R&=65535,T+=p+A,O+=T>>>16,T&=65535,O+=l+E,O&=65535,e.fromBits(R<<16|b,O<<16|T,this.unsigned)},e.prototype.subtract=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.add(s.negate())},e.prototype.sub=e.prototype.subtract,e.prototype.multiply=function(s){if(this.isZero()||(e.isLong(s)||(s=e.fromValue(s)),s.isZero()))return e.ZERO;if(this.equals(e.MIN_VALUE))return s.isOdd()?e.MIN_VALUE:e.ZERO;if(s.equals(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return s.isNegative()?this.negate().multiply(s.negate()):this.negate().multiply(s).negate();if(s.isNegative())return this.multiply(s.negate()).negate();if(this.lessThan(d)&&s.lessThan(d))return e.fromNumber(this.toNumber()*s.toNumber(),this.unsigned);var l=this.high>>>16,p=this.high&65535,g=this.low>>>16,$=this.low&65535,E=s.high>>>16,A=s.high&65535,S=s.low>>>16,h=s.low&65535,O=0,T=0,R=0,b=0;return b+=$*h,R+=b>>>16,b&=65535,R+=g*h,T+=R>>>16,R&=65535,R+=$*S,T+=R>>>16,R&=65535,T+=p*h,O+=T>>>16,T&=65535,T+=g*S,O+=T>>>16,T&=65535,T+=$*A,O+=T>>>16,T&=65535,O+=l*h+p*S+g*A+$*E,O&=65535,e.fromBits(R<<16|b,O<<16|T,this.unsigned)},e.prototype.mul=e.prototype.multiply,e.prototype.divide=function(s){if(e.isLong(s)||(s=e.fromValue(s)),s.isZero())throw new Error("division by zero");if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var l,p,g;if(this.equals(e.MIN_VALUE)){if(s.equals(e.ONE)||s.equals(e.NEG_ONE))return e.MIN_VALUE;if(s.equals(e.MIN_VALUE))return e.ONE;var $=this.shiftRight(1);return l=$.divide(s).shiftLeft(1),l.equals(e.ZERO)?s.isNegative()?e.ONE:e.NEG_ONE:(p=this.subtract(s.multiply(l)),g=l.add(p.divide(s)),g)}else if(s.equals(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return s.isNegative()?this.negate().divide(s.negate()):this.negate().divide(s).negate();if(s.isNegative())return this.divide(s.negate()).negate();for(g=e.ZERO,p=this;p.greaterThanOrEqual(s);){l=Math.max(1,Math.floor(p.toNumber()/s.toNumber()));for(var E=Math.ceil(Math.log(l)/Math.LN2),A=E<=48?1:Math.pow(2,E-48),S=e.fromNumber(l),h=S.multiply(s);h.isNegative()||h.greaterThan(p);)l-=A,S=e.fromNumber(l,this.unsigned),h=S.multiply(s);S.isZero()&&(S=e.ONE),g=g.add(S),p=p.subtract(h)}return g},e.prototype.div=e.prototype.divide,e.prototype.modulo=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.subtract(this.divide(s).multiply(s))},e.prototype.mod=e.prototype.modulo,e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.and=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low&s.low,this.high&s.high,this.unsigned)},e.prototype.or=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low|s.low,this.high|s.high,this.unsigned)},e.prototype.xor=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low^s.low,this.high^s.high,this.unsigned)},e.prototype.shiftLeft=function(s){return e.isLong(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?e.fromBits(this.low<<s,this.high<<s|this.low>>>32-s,this.unsigned):e.fromBits(0,this.low<<s-32,this.unsigned)},e.prototype.shl=e.prototype.shiftLeft,e.prototype.shiftRight=function(s){return e.isLong(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?e.fromBits(this.low>>>s|this.high<<32-s,this.high>>s,this.unsigned):e.fromBits(this.high>>s-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=e.prototype.shiftRight,e.prototype.shiftRightUnsigned=function(s){if(e.isLong(s)&&(s=s.toInt()),s&=63,s===0)return this;var l=this.high;if(s<32){var p=this.low;return e.fromBits(p>>>s|l<<32-s,l>>>s,this.unsigned)}else return s===32?e.fromBits(l,0,this.unsigned):e.fromBits(l>>>s-32,0,this.unsigned)},e.prototype.shru=e.prototype.shiftRightUnsigned,e.prototype.toSigned=function(){return this.unsigned?new e(this.low,this.high,!1):this},e.prototype.toUnsigned=function(){return this.unsigned?this:new e(this.low,this.high,!0)},e})})(cu);var lu=cu.exports;Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.Hyper=void 0;var tE=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}}(),du=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)}},nE=lu,Mr=pu(nE),iE=D,aE=pu(iE);function pu(r){return r&&r.__esModule?r:{default:r}}function oE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function sE(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 uE(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 Dr=Gt.Hyper=function(r){uE(e,r),tE(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=du(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=du(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 oE(this,e),sE(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!1))}return e}(Mr.default);(0,aE.default)(Dr),Dr.MAX_VALUE=new Dr(Mr.default.MAX_VALUE.low,Mr.default.MAX_VALUE.high),Dr.MIN_VALUE=new Dr(Mr.default.MIN_VALUE.low,Mr.default.MIN_VALUE.high);var Be={};Object.defineProperty(Be,"__esModule",{value:!0}),Be.UnsignedInt=void 0;var fE=xt,hu=yu(fE),cE=D,lE=yu(cE);function yu(r){return r&&r.__esModule?r:{default:r}}var Cr=Be.UnsignedInt={read:function(e){return e.readUInt32BE()},write:function(e,t){if(!(0,hu.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,hu.default)(e)||Math.floor(e)!==e?!1:e>=Cr.MIN_VALUE&&e<=Cr.MAX_VALUE}};Cr.MAX_VALUE=Math.pow(2,32)-1,Cr.MIN_VALUE=0,(0,lE.default)(Cr);var Ht={};Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.UnsignedHyper=void 0;var dE=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}}(),gu=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)}},pE=lu,Nr=_u(pE),hE=D,yE=_u(hE);function _u(r){return r&&r.__esModule?r:{default:r}}function gE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function _E(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 vE(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 Br=Ht.UnsignedHyper=function(r){vE(e,r),dE(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=gu(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=gu(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 gE(this,e),_E(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!0))}return e}(Nr.default);(0,yE.default)(Br),Br.MAX_VALUE=new Br(Nr.default.MAX_UNSIGNED_VALUE.low,Nr.default.MAX_UNSIGNED_VALUE.high),Br.MIN_VALUE=new Br(Nr.default.MIN_VALUE.low,Nr.default.MIN_VALUE.high);var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.Float=void 0;var mE=xt,vu=mu(mE),wE=D,bE=mu(wE);function mu(r){return r&&r.__esModule?r:{default:r}}var $E=Wt.Float={read:function(e){return e.readFloatBE()},write:function(e,t){if(!(0,vu.default)(e))throw new Error("XDR Write Error: not a number");t.writeFloatBE(e)},isValid:function(e){return(0,vu.default)(e)}};(0,bE.default)($E);var zt={};Object.defineProperty(zt,"__esModule",{value:!0}),zt.Double=void 0;var EE=xt,wu=bu(EE),SE=D,AE=bu(SE);function bu(r){return r&&r.__esModule?r:{default:r}}var OE=zt.Double={read:function(e){return e.readDoubleBE()},write:function(e,t){if(!(0,wu.default)(e))throw new Error("XDR Write Error: not a number");t.writeDoubleBE(e)},isValid:function(e){return(0,wu.default)(e)}};(0,AE.default)(OE);var Xt={};Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.Quadruple=void 0;var IE=D,PE=xE(IE);function xE(r){return r&&r.__esModule?r:{default:r}}var TE=Xt.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,PE.default)(TE);var qr={},FE=me,RE=we,ME="[object Boolean]";function DE(r){return r===!0||r===!1||RE(r)&&FE(r)==ME}var CE=DE;Object.defineProperty(qr,"__esModule",{value:!0}),qr.Bool=void 0;var NE=CE,BE=Eu(NE),$u=de,qE=D,UE=Eu(qE);function Eu(r){return r&&r.__esModule?r:{default:r}}var LE=qr.Bool={read:function(e){var t=$u.Int.read(e);switch(t){case 0:return!1;case 1:return!0;default:throw new Error("XDR Read Error: Got "+t+" when trying to read a bool")}},write:function(e,t){var n=e?1:0;return $u.Int.write(n,t)},isValid:function(e){return(0,BE.default)(e)}};(0,UE.default)(LE);var Yt={},kE=me,jE=G,VE=we,GE="[object String]";function HE(r){return typeof r=="string"||!jE(r)&&VE(r)&&kE(r)==GE}var Su=HE;Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.String=void 0;var WE=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}}(),zE=Su,Au=Bi(zE),XE=G,YE=Bi(XE),Ou=de,KE=Be,Iu=Ce,ZE=D,JE=Bi(ZE);function Bi(r){return r&&r.__esModule?r:{default:r}}function QE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var eS=Yt.String=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:KE.UnsignedInt.MAX_VALUE;QE(this,r),this._maxLength=e}return WE(r,[{key:"read",value:function(t){var n=Ou.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,Iu.calculatePadding)(n),a=t.slice(n);return(0,Iu.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,Au.default)(t)?i=y.from(t,"utf8"):i=y.from(t),Ou.Int.write(i.length,n),n.writeBufferPadded(i)}},{key:"isValid",value:function(t){var n=void 0;if((0,Au.default)(t))n=y.from(t,"utf8");else if((0,YE.default)(t)||y.isBuffer(t))n=y.from(t);else return!1;return n.length<=this._maxLength}}]),r}();(0,JE.default)(eS.prototype);var Kt={};Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.Opaque=void 0;var rS=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}}(),Pu=Ce,tS=D,nS=iS(tS);function iS(r){return r&&r.__esModule?r:{default:r}}function aS(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var oS=Kt.Opaque=function(){function r(e){aS(this,r),this._length=e,this._padding=(0,Pu.calculatePadding)(e)}return rS(r,[{key:"read",value:function(t){var n=t.slice(this._length);return(0,Pu.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,nS.default)(oS.prototype);var Zt={};Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.VarOpaque=void 0;var sS=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}}(),xu=de,uS=Be,Tu=Ce,fS=D,cS=lS(fS);function lS(r){return r&&r.__esModule?r:{default:r}}function dS(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var pS=Zt.VarOpaque=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:uS.UnsignedInt.MAX_VALUE;dS(this,r),this._maxLength=e}return sS(r,[{key:"read",value:function(t){var n=xu.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,Tu.calculatePadding)(n),a=t.slice(n);return(0,Tu.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));xu.Int.write(t.length,n),n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length<=this._maxLength}}]),r}();(0,cS.default)(pS.prototype);var Jt={};function hS(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}var yS=hS,gS=Ft;function _S(r){return typeof r=="function"?r:gS}var Fu=_S,vS=yS,mS=$i,wS=Fu,bS=G;function $S(r,e){var t=bS(r)?vS:mS;return t(r,wS(e))}var ES=$S,or=ES,SS=/\s/;function AS(r){for(var e=r.length;e--&&SS.test(r.charAt(e)););return e}var OS=AS,IS=OS,PS=/^\s+/;function xS(r){return r&&r.slice(0,IS(r)+1).replace(PS,"")}var TS=xS,FS=TS,Ru=er,RS=jt,Mu=0/0,MS=/^[-+]0x[0-9a-f]+$/i,DS=/^0b[01]+$/i,CS=/^0o[0-7]+$/i,NS=parseInt;function BS(r){if(typeof r=="number")return r;if(RS(r))return Mu;if(Ru(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Ru(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=FS(r);var t=DS.test(r);return t||CS.test(r)?NS(r.slice(2),t?2:8):MS.test(r)?Mu:+r}var qS=BS,US=qS,Du=1/0,LS=17976931348623157e292;function kS(r){if(!r)return r===0?r:0;if(r=US(r),r===Du||r===-Du){var e=r<0?-1:1;return e*LS}return r===r?r:0}var jS=kS,VS=jS;function GS(r){var e=VS(r),t=e%1;return e===e?t?e-t:e:0}var HS=GS,WS=ys,zS=Fu,XS=HS,YS=9007199254740991,qi=4294967295,KS=Math.min;function ZS(r,e){if(r=XS(r),r<1||r>YS)return[];var t=qi,n=KS(r,qi);e=zS(e),r-=qi;for(var i=WS(n,e);++t<r;)e(t);return i}var Cu=ZS;Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.Array=void 0;var JS=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}}(),QS=Ci,eA=Ur(QS),rA=or,tA=Ur(rA),nA=Cu,iA=Ur(nA),aA=G,Nu=Ur(aA),oA=D,sA=Ur(oA);function Ur(r){return r&&r.__esModule?r:{default:r}}function uA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var fA=Jt.Array=function(){function r(e,t){uA(this,r),this._childType=e,this._length=t}return JS(r,[{key:"read",value:function(t){var n=this;return(0,iA.default)(this._length,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,Nu.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,tA.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,Nu.default)(t)||t.length!==this._length?!1:(0,eA.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,sA.default)(fA.prototype);var Qt={};Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.VarArray=void 0;var cA=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}}(),lA=Ci,dA=Lr(lA),pA=or,hA=Lr(pA),yA=Cu,gA=Lr(yA),_A=G,Bu=Lr(_A),vA=Be,qu=de,mA=D,wA=Lr(mA);function Lr(r){return r&&r.__esModule?r:{default:r}}function bA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var $A=Qt.VarArray=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:vA.UnsignedInt.MAX_VALUE;bA(this,r),this._childType=e,this._maxLength=t}return cA(r,[{key:"read",value:function(t){var n=this,i=qu.Int.read(t);if(i>this._maxLength)throw new Error("XDR Read Error: Saw "+i+" length VarArray,"+("max allowed is "+this._maxLength));return(0,gA.default)(i,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,Bu.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));qu.Int.write(t.length,n),(0,hA.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,Bu.default)(t)||t.length>this._maxLength?!1:(0,dA.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,wA.default)($A.prototype);var en={};function EA(r){return r===null}var SA=EA;function AA(r){return r===void 0}var kr=AA;Object.defineProperty(en,"__esModule",{value:!0}),en.Option=void 0;var OA=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),IA=SA,Uu=Ui(IA),PA=kr,Lu=Ui(PA),ku=qr,xA=D,TA=Ui(xA);function Ui(r){return r&&r.__esModule?r:{default:r}}function FA(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var RA=en.Option=function(){function r(e){FA(this,r),this._childType=e}return OA(r,[{key:"read",value:function(t){if(ku.Bool.read(t))return this._childType.read(t)}},{key:"write",value:function(t,n){var i=!((0,Uu.default)(t)||(0,Lu.default)(t));ku.Bool.write(i,n),i&&this._childType.write(t,n)}},{key:"isValid",value:function(t){return(0,Uu.default)(t)||(0,Lu.default)(t)?!0:this._childType.isValid(t)}}]),r}();(0,TA.default)(RA.prototype);var jr={};Object.defineProperty(jr,"__esModule",{value:!0}),jr.Void=void 0;var MA=kr,ju=Vu(MA),DA=D,CA=Vu(DA);function Vu(r){return r&&r.__esModule?r:{default:r}}var NA=jr.Void={read:function(){},write:function(e){if(!(0,ju.default)(e))throw new Error("XDR Write Error: trying to write value to a void slot")},isValid:function(e){return(0,ju.default)(e)}};(0,CA.default)(NA);var rn={},BA=Di;function qA(r,e){return BA(e,function(t){return r[t]})}var UA=qA,LA=UA,kA=Ct;function jA(r){return r==null?[]:LA(r,kA(r))}var VA=jA;Object.defineProperty(rn,"__esModule",{value:!0}),rn.Enum=void 0;var GA=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}}(),HA=or,WA=Li(HA),zA=VA,XA=Li(zA),Gu=de,YA=D,KA=Li(YA);function Li(r){return r&&r.__esModule?r:{default:r}}function ZA(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 JA(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function Hu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var QA=rn.Enum=function(){function r(e,t){Hu(this,r),this.name=e,this.value=t}return GA(r,null,[{key:"read",value:function(t){var n=Gu.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);Gu.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,XA.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){JA(u,o);function u(){return Hu(this,u),ZA(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u}(r);return a.enumName=n,t.results[n]=a,a._members={},a._byValue=new Map,(0,WA.default)(i,function(o,u){var f=new a(u,o);a._members[u]=f,a._byValue.set(o,f),a[u]=function(){return f}}),a}}]),r}();(0,KA.default)(QA);var tn={},eO=$i,rO=Fr;function tO(r,e){var t=-1,n=rO(r)?Array(r.length):[];return eO(r,function(i,a,o){n[++t]=e(i,a,o)}),n}var nO=tO,iO=Di,aO=iu,oO=nO,sO=G;function uO(r,e){var t=sO(r)?iO:oO;return t(r,aO(e))}var fO=uO;function cO(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 lO=cO,Vr={};Object.defineProperty(Vr,"__esModule",{value:!0});var dO=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 pO(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}Vr.Reference=function(){function r(){pO(this,r)}return dO(r,[{key:"resolve",value:function(){throw new Error("implement resolve in child class")}}]),r}(),Object.defineProperty(tn,"__esModule",{value:!0}),tn.Struct=void 0;var nn=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var u=e[Symbol.iterator](),f;!(i=(f=u.next()).done)&&(n.push(f.value),!(t&&n.length===t));i=!0);}catch(d){a=!0,o=d}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),hO=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}}(),yO=or,Wu=Gr(yO),gO=fO,_O=Gr(gO),vO=kr,mO=Gr(vO),wO=lO,bO=Gr(wO),$O=Vr,EO=D,SO=Gr(EO);function Gr(r){return r&&r.__esModule?r:{default:r}}function AO(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 OO(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 zu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var IO=tn.Struct=function(){function r(e){zu(this,r),this._attributes=e||{}}return hO(r,null,[{key:"read",value:function(t){var n=(0,_O.default)(this._fields,function(i){var a=nn(i,2),o=a[0],u=a[1],f=u.read(t);return[o,f]});return new this((0,bO.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,Wu.default)(this._fields,function(i){var a=nn(i,2),o=a[0],u=a[1],f=t._attributes[o];u.write(f,n)})}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(o){OO(u,o);function u(){return zu(this,u),AO(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u}(r);return a.structName=n,t.results[n]=a,a._fields=i.map(function(o){var u=nn(o,2),f=u[0],d=u[1];return d instanceof $O.Reference&&(d=d.resolve(t)),[f,d]}),(0,Wu.default)(a._fields,function(o){var u=nn(o,1),f=u[0];a.prototype[f]=PO(f)}),a}}]),r}();(0,SO.default)(IO);function PO(r){return function(t){return(0,mO.default)(t)||(this._attributes[r]=t),this._attributes[r]}}var an={};Object.defineProperty(an,"__esModule",{value:!0}),an.Union=void 0;var xO=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var u=e[Symbol.iterator](),f;!(i=(f=u.next()).done)&&(n.push(f.value),!(t&&n.length===t));i=!0);}catch(d){a=!0,o=d}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),TO=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}}(),FO=or,on=un(FO),RO=kr,Xu=un(RO),MO=Su,Yu=un(MO),sn=jr,ki=Vr,DO=D,CO=un(DO);function un(r){return r&&r.__esModule?r:{default:r}}function NO(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 Ku(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var qO=an.Union=function(){function r(e,t){Ku(this,r),this.set(e,t)}return TO(r,[{key:"set",value:function(t,n){(0,Yu.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!==sn.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===sn.Void?sn.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,Xu.default)(a)?o=i.read(t):o=a.read(t),new this(n,o)}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.unionName);this._switchOn.write(t.switch(),n),t.armType().write(t.value(),n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(u){BO(f,u);function f(){return Ku(this,f),NO(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}return f}(r);a.unionName=n,t.results[n]=a,i.switchOn instanceof ki.Reference?a._switchOn=i.switchOn.resolve(t):a._switchOn=i.switchOn,a._switches=new Map,a._arms={},(0,on.default)(i.arms,function(u,f){u instanceof ki.Reference&&(u=u.resolve(t)),a._arms[f]=u});var o=i.defaultArm;return o instanceof ki.Reference&&(o=o.resolve(t)),a._defaultArm=o,(0,on.default)(i.switches,function(u){var f=xO(u,2),d=f[0],c=f[1];(0,Yu.default)(d)&&(d=a._switchOn.fromName(d)),a._switches.set(d,c)}),(0,Xu.default)(a._switchOn.values)||(0,on.default)(a._switchOn.values(),function(u){a[u.name]=function(f){return new a(u,f)},a.prototype[u.name]=function(d){return this.set(u,d)}}),(0,on.default)(a._arms,function(u,f){u!==sn.Void&&(a.prototype[f]=function(){return this.get(f)})}),a}}]),r}();(0,CO.default)(qO),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=de;Object.keys(e).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return e[h]}})});var t=Gt;Object.keys(t).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return t[h]}})});var n=Be;Object.keys(n).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return n[h]}})});var i=Ht;Object.keys(i).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return i[h]}})});var a=Wt;Object.keys(a).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return a[h]}})});var o=zt;Object.keys(o).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return o[h]}})});var u=Xt;Object.keys(u).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return u[h]}})});var f=qr;Object.keys(f).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return f[h]}})});var d=Yt;Object.keys(d).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return d[h]}})});var c=Kt;Object.keys(c).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return c[h]}})});var s=Zt;Object.keys(s).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return s[h]}})});var l=Jt;Object.keys(l).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return l[h]}})});var p=Qt;Object.keys(p).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return p[h]}})});var g=en;Object.keys(g).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return g[h]}})});var $=jr;Object.keys($).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return $[h]}})});var E=rn;Object.keys(E).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return E[h]}})});var A=tn;Object.keys(A).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return A[h]}})});var S=an;Object.keys(S).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return S[h]}})})}(_i);var Zu={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=function(){function b(_,m){for(var I=0;I<m.length;I++){var P=m[I];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(_,P.key,P)}}return function(_,m,I){return m&&b(_.prototype,m),I&&b(_,I),_}}(),t=Vr;Object.keys(t).forEach(function(b){b==="default"||b==="__esModule"||Object.defineProperty(r,b,{enumerable:!0,get:function(){return t[b]}})}),r.config=g;var n=kr,i=c(n),a=or,o=c(a),u=_i,f=d(u);function d(b){if(b&&b.__esModule)return b;var _={};if(b!=null)for(var m in b)Object.prototype.hasOwnProperty.call(b,m)&&(_[m]=b[m]);return _.default=b,_}function c(b){return b&&b.__esModule?b:{default:b}}function s(b,_){if(!(b instanceof _))throw new TypeError("Cannot call a class as a function")}function l(b,_){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:b}function p(b,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);b.prototype=Object.create(_&&_.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(b,_):b.__proto__=_)}function g(b){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(b){var m=new R(_);b(m),m.resolve()}return _}var $=function(b){p(_,b);function _(m){s(this,_);var I=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return I.name=m,I}return e(_,[{key:"resolve",value:function(I){var P=I.definitions[this.name];return P.resolve(I)}}]),_}(t.Reference),E=function(b){p(_,b);function _(m,I){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;s(this,_);var q=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return q.childReference=m,q.length=I,q.variable=P,q}return e(_,[{key:"resolve",value:function(I){var P=this.childReference,q=this.length;return P instanceof t.Reference&&(P=P.resolve(I)),q instanceof t.Reference&&(q=q.resolve(I)),this.variable?new f.VarArray(P,q):new f.Array(P,q)}}]),_}(t.Reference),A=function(b){p(_,b);function _(m){s(this,_);var I=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return I.childReference=m,I.name=m.name,I}return e(_,[{key:"resolve",value:function(I){var P=this.childReference;return P instanceof t.Reference&&(P=P.resolve(I)),new f.Option(P)}}]),_}(t.Reference),S=function(b){p(_,b);function _(m,I){s(this,_);var P=l(this,(_.__proto__||Object.getPrototypeOf(_)).call(this));return P.sizedType=m,P.length=I,P}return e(_,[{key:"resolve",value:function(I){var P=this.length;return P instanceof t.Reference&&(P=P.resolve(I)),new this.sizedType(P)}}]),_}(t.Reference),h=function(){function b(_,m,I){s(this,b),this.constructor=_,this.name=m,this.config=I}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 O(b,_,m){return m instanceof t.Reference&&(m=m.resolve(b)),b.results[_]=m,m}function T(b,_,m){return b.results[_]=m,m}var R=function(){function b(_){s(this,b),this._destination=_,this._definitions={}}return e(b,[{key:"enum",value:function(m,I){var P=new h(f.Enum.create,m,I);this.define(m,P)}},{key:"struct",value:function(m,I){var P=new h(f.Struct.create,m,I);this.define(m,P)}},{key:"union",value:function(m,I){var P=new h(f.Union.create,m,I);this.define(m,P)}},{key:"typedef",value:function(m,I){var P=new h(O,m,I);this.define(m,P)}},{key:"const",value:function(m,I){var P=new h(T,m,I);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 S(f.String,m)}},{key:"opaque",value:function(m){return new S(f.Opaque,m)}},{key:"varOpaque",value:function(m){return new S(f.VarOpaque,m)}},{key:"array",value:function(m,I){return new E(m,I)}},{key:"varArray",value:function(m,I){return new E(m,I,!0)}},{key:"option",value:function(m){return new A(m)}},{key:"define",value:function(m,I){if((0,i.default)(this._destination[m]))this._definitions[m]=I;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(I){I.resolve({definitions:m._definitions,results:m._destination})})}}]),b}()})(Zu),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=_i;Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[n]}})});var t=Zu;Object.keys(t).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[n]}})})}(rs);var ji=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)},j=(r,e,t)=>(ji(r,e,"read from private field"),t?t.call(r):e.get(r)),be=(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)},Vi=(r,e,t,n)=>(ji(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),K=(r,e,t)=>(ji(r,e,"access private method"),t),oe,se,Hr,Gi,Ju,Hi,Qu,fn,Wi,sr,Wr,zr,cn;function UO(r){const e={variantId:he.Uint64.fromString(r.variantId.toString()),version:r.version||Math.floor(Date.now()/1e3),items:r.items.map(n=>new he.BundleItem({collectionId:he.Uint64.fromString(n.collectionId.toString()),productId:he.Uint64.fromString(n.productId.toString()),variantId:he.Uint64.fromString(n.variantId.toString()),sku:n.sku||"",quantity:n.quantity,ext:new he.BundleItemExt(0)})),ext:new he.BundleExt(0)},t=new he.Bundle(e);return he.BundleEnvelope.envelopeTypeBundle(t).toXDR("base64")}const he=rs.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 LO{constructor(e,t){be(this,Gi),be(this,Hi),be(this,fn),be(this,sr),be(this,zr),be(this,oe,void 0),be(this,se,void 0),be(this,Hr,void 0),Vi(this,oe,K(this,Gi,Ju).call(this,t)),Vi(this,Hr,K(this,Hi,Qu).call(this,t)),Vi(this,se,e)}isInitialDataValid(){if(!j(this,Hr))throw"Bundle data does not exist for the given product.";if(!j(this,oe))throw"Bundle settings do not exist for the given product.";if(!Array.isArray(j(this,se))||!j(this,se).length)throw"No bundle selection items provided.";return!0}isValidVariant(e){if(!j(this,oe)?.variantsSettings[e])throw`The ${e} bundle variant is invalid.`;return!0}isSelectionInVariantRange(e){const t=j(this,se).reduce((i,a)=>i+a.quantity,0),n=j(this,oe)?.variantsSettings[e].ranges||[];if(!K(this,fn,Wi).call(this,n,t))throw"The total number of products does not fall within the required variant range.";return!0}areItemsInMaxPerItemBound(){const e=j(this,oe)?.bundleSettings.maxPerItem||0,t=j(this,se).filter(({quantity:n})=>n>e);if(e&&t.length)throw`The selected products (${K(this,sr,Wr).call(this,t.map(({externalProductId:n})=>n)).join(", ")}) exceed the maximum limit of ${e} items per product.`;return!0}areSelectedCollectionsValid(e){const t=j(this,oe)?.variantsSettings[e]?.optionSources,n=j(this,se).filter(({collectionId:i})=>!t||!K(this,zr,cn).call(this,t,i));if(n.length)throw`The collections (${K(this,sr,Wr).call(this,n.map(({collectionId:i})=>i)).join(", ")}) are no longer valid for the bundle variant (${e}).`;return!0}areItemsQuantitiesValidForTheCollection(e){const t=j(this,se).reduce((a,o)=>(a[o.collectionId]=o.quantity+(a[o.collectionId]||0),a),Object.create(null)),n=j(this,oe)?.variantsSettings[e],i=Object.values(n?.optionSources||{}).filter(a=>{const o=t[a.collectionId]||0;return!K(this,fn,Wi).call(this,[a],o)});if(!n||i.length)throw`The selection exceeds the limits for the collections (${K(this,sr,Wr).call(this,i.map(({collectionId:a})=>a)).join(", ")}).`;return!0}areSelectedProductsValid(e){const t=j(this,oe)?.variantsSettings[e]?.optionSources||{},n=Object.values(t).reduce((a,o)=>{const u=j(this,Hr)?.collections[o.collectionId];return u&&(a[o.collectionId]=u),a},Object.create(null));if(!Object.values(n).length)throw`No collections found for the bundle variant (${e}).`;const i=j(this,se).filter(({externalProductId:a,collectionId:o})=>K(this,zr,cn).call(this,n,o)?!K(this,zr,cn).call(this,n[o].products,a):!0);if(i.length)throw`The products (${K(this,sr,Wr).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}}oe=new WeakMap,se=new WeakMap,Hr=new WeakMap,Gi=new WeakSet,Ju=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),Object.create(null)),ranges:i},t},Object.create(null))}}catch{return null}},Hi=new WeakSet,Qu=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),Object.create(null))},t),Object.create(null));return{...r,collections:e}}catch{return null}},fn=new WeakSet,Wi=function(r,e){return!!r.filter(({min:t,max:n})=>{const i=t??e,a=n??e;return i<=e&&e<=a}).length},sr=new WeakSet,Wr=function(r){return Array.from(new Set(r))},zr=new WeakSet,cn=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};const kO="/bundling-storefront-manager";function ef(r){return UO({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 jO(r){const e=V(),t=await zi(r);if(t!==!0)throw new Error(t);const n=ef(r);try{const i=await Me("post",`${kO}/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 VO(r,e){const t=await zi(e);if(t!==!0)throw new Error(t);const n=ef(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 GO(r,e){const t=rf(r);if(t!==!0)throw new Error(`Dynamic Bundle is invalid. ${t}`);const n=`${ma(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 zi(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 HO(r){try{const e=await Me("get",`/bundle-data/${F(r.externalProductId)}`);return{valid:new LO(r.selections,e).isBundleSelectionValid(r.externalVariantId)}}catch(e){return{valid:!1,error:String(e)}}}const WO={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 rf(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=WO[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 zO(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 XO(r,e){return w("get","/bundle_selections",{query:e},v(r,"listBundleSelections"))}async function YO(r,e){const{bundle_selection:t}=await w("post","/bundle_selections",{data:e},v(r,"createBundleSelection"));return t}async function KO(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 ZO(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 JO(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 QO=Object.freeze({__proto__:null,createBundleSelection:YO,deleteBundleSelection:ZO,getBundleId:jO,getBundleSelection:zO,getBundleSelectionId:VO,getDynamicBundleItems:GO,listBundleSelections:XO,updateBundle:JO,updateBundleSelection:KO,validateBundle:zi,validateBundleSelection:HO,validateDynamicBundle:rf});const eI=r=>{const e=r.layout_settings.addons,t=r.layout_settings.crossSells,n=r.customization_window,i=r.layout_settings?.defaultVariantId??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}}},rI=r=>r.tiered_discounts.length===0?null:{tiered_discounts:r.tiered_discounts},ln=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}))}),tf=r=>({name:r.name,options:r.options.map(e=>({name:e.name,values:e.values})),selling_plans:r.selling_plans.map(ln)}),nf=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}),Xi=r=>r==null||typeof r=="string"?r:"src"in r?r.src:null,af=r=>({id:String(r.id),title:r.title,description:r.description,available_for_sale:r.available,featured_image:Xi(r.featured_image),images:r.images,requires_selling_plan:r.requires_selling_plan,selling_plan_groups:r.selling_plan_groups.map(tf)}),of=r=>{const e=nI(r.selling_plan_groups);return{...af(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=>({...nf(t),selling_plan_allocations:t.selling_plan_allocations.map(n=>({price:n.price,compare_at_price:n.compare_at_price,selling_plan:ln(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:Xi(t.featured_image),public_title:t.public_title,requires_selling_plan:t.requires_selling_plan}))}},tI=({items_count:r,ranges:e})=>e.length>0?e.map(({quantity_max:t,quantity_min:n})=>({min:n,max:t})):[{min:r,max:r}],nI=r=>r.reduce((e,t)=>(t.selling_plans.forEach(n=>{const i=`${t.id}-${n.id}`;e[i]=n}),e),{}),iI=r=>Array.isArray(r)?r:[];function Yi(r){const e=eI(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:ln(o.selling_plan)})),ranges:tI(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:Xi(o.variant.featured_image),sku:o.sku||""}})),position:i}}),selling_plan_groups:r.selling_plan_groups.map(tf),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(of)}),n),{}),addons:r.addons.products.length?{collection_id:e.addons?.collection_id||"",collection_handle:e.addons?.collection_handle||"",products:r.addons.products.map(n=>({...af(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=>({...nf(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:ln(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(of)}:null,incentives:rI(r.incentives),filters:iI(r.filters),templates:r.bundle_settings.layout_settings.templates||null,globalStyles:r.bundle_settings.layout_settings.globalStyles||null}}async function aI(r,e){return e?.source==="shopify_storefront"?sI():oI(r,e?.country_code)}async function oI(r,e){const{appName:t,appVersion:n}=V(),i={"X-Recharge-Sdk-Fn":"loadFromOnlineStore","X-Recharge-Sdk-Version":"1.91.0",...t?{"X-Recharge-Sdk-App-Name":t}:{},...n?{"X-Recharge-Sdk-App-Version":n}:{}};if(!e){const o=await Me("get",`/bundle-data/${F(r)}`,{headers:i});return Yi(o)}const a=new FormData;a.append("form_type","localization"),a.append("_method","put"),a.append("return_to",`${Qo}/bundle-data/${r}`),a.append("country_code",e);try{const o=await Y("post","/localization",{headers:{"Content-Type":"multipart/form-data",...i},data:a});return Yi(o)}catch{const o=await Me("get",`/bundle-data/${F(r)}`,{headers:i});return Yi(o)}}async function sI(r,e){if(!V().storeIdentifier)throw new Error("Store identifier is required for Shopify Storefront API requests");return{}}var uI=Object.freeze({__proto__:null,loadBundleData:aI}),fI=200,Ki="__lodash_hash_undefined__",cI=1/0,sf=9007199254740991,lI="[object Arguments]",dI="[object Function]",pI="[object GeneratorFunction]",hI="[object Symbol]",yI=/[\\^$.*+?()[\]{}|]/g,gI=/^\[object .+?Constructor\]$/,_I=/^(?:0|[1-9]\d*)$/,vI=typeof C=="object"&&C&&C.Object===Object&&C,mI=typeof self=="object"&&self&&self.Object===Object&&self,Zi=vI||mI||Function("return this")();function wI(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 bI(r,e){var t=r?r.length:0;return!!t&&SI(r,e,0)>-1}function $I(r,e,t){for(var n=-1,i=r?r.length:0;++n<i;)if(t(e,r[n]))return!0;return!1}function uf(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 Ji(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}function EI(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 SI(r,e,t){if(e!==e)return EI(r,AI,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function AI(r){return r!==r}function OI(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}function II(r){return function(e){return r(e)}}function PI(r,e){return r.has(e)}function xI(r,e){return r?.[e]}function TI(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function ff(r,e){return function(t){return r(e(t))}}var FI=Array.prototype,RI=Function.prototype,dn=Object.prototype,Qi=Zi["__core-js_shared__"],cf=function(){var r=/[^.]+$/.exec(Qi&&Qi.keys&&Qi.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),lf=RI.toString,ur=dn.hasOwnProperty,ea=dn.toString,MI=RegExp("^"+lf.call(ur).replace(yI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),df=Zi.Symbol,DI=ff(Object.getPrototypeOf,Object),CI=dn.propertyIsEnumerable,NI=FI.splice,pf=df?df.isConcatSpreadable:void 0,ra=Object.getOwnPropertySymbols,hf=Math.max,BI=gf(Zi,"Map"),Xr=gf(Object,"create");function qe(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__=Xr?Xr(null):{}}function UI(r){return this.has(r)&&delete this.__data__[r]}function LI(r){var e=this.__data__;if(Xr){var t=e[r];return t===Ki?void 0:t}return ur.call(e,r)?e[r]:void 0}function kI(r){var e=this.__data__;return Xr?e[r]!==void 0:ur.call(e,r)}function jI(r,e){var t=this.__data__;return t[r]=Xr&&e===void 0?Ki:e,this}qe.prototype.clear=qI,qe.prototype.delete=UI,qe.prototype.get=LI,qe.prototype.has=kI,qe.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__=[]}function GI(r){var e=this.__data__,t=hn(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():NI.call(e,t,1),!0}function HI(r){var e=this.__data__,t=hn(e,r);return t<0?void 0:e[t][1]}function WI(r){return hn(this.__data__,r)>-1}function zI(r,e){var t=this.__data__,n=hn(t,r);return n<0?t.push([r,e]):t[n][1]=e,this}fr.prototype.clear=VI,fr.prototype.delete=GI,fr.prototype.get=HI,fr.prototype.has=WI,fr.prototype.set=zI;function cr(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 XI(){this.__data__={hash:new qe,map:new(BI||fr),string:new qe}}function YI(r){return yn(this,r).delete(r)}function KI(r){return yn(this,r).get(r)}function ZI(r){return yn(this,r).has(r)}function JI(r,e){return yn(this,r).set(r,e),this}cr.prototype.clear=XI,cr.prototype.delete=YI,cr.prototype.get=KI,cr.prototype.has=ZI,cr.prototype.set=JI;function pn(r){var e=-1,t=r?r.length:0;for(this.__data__=new cr;++e<t;)this.add(r[e])}function QI(r){return this.__data__.set(r,Ki),this}function eP(r){return this.__data__.has(r)}pn.prototype.add=pn.prototype.push=QI,pn.prototype.has=eP;function rP(r,e){var t=ta(r)||_f(r)?OI(r.length,String):[],n=t.length,i=!!n;for(var a in r)(e||ur.call(r,a))&&!(i&&(a=="length"||pP(a,n)))&&t.push(a);return t}function hn(r,e){for(var t=r.length;t--;)if(wP(r[t][0],e))return t;return-1}function tP(r,e,t,n){var i=-1,a=bI,o=!0,u=r.length,f=[],d=e.length;if(!u)return f;t&&(e=uf(e,II(t))),n?(a=$I,o=!1):e.length>=fI&&(a=PI,o=!1,e=new pn(e));e:for(;++i<u;){var c=r[i],s=t?t(c):c;if(c=n||c!==0?c:0,o&&s===s){for(var l=d;l--;)if(e[l]===s)continue e;f.push(c)}else a(e,s,n)||f.push(c)}return f}function yf(r,e,t,n,i){var a=-1,o=r.length;for(t||(t=dP),i||(i=[]);++a<o;){var u=r[a];e>0&&t(u)?e>1?yf(u,e-1,t,n,i):Ji(i,u):n||(i[i.length]=u)}return i}function nP(r,e,t){var n=e(r);return ta(r)?n:Ji(n,t(r))}function iP(r){if(!na(r)||yP(r))return!1;var e=mf(r)||TI(r)?MI:gI;return e.test(mP(r))}function aP(r){if(!na(r))return _P(r);var e=gP(r),t=[];for(var n in r)n=="constructor"&&(e||!ur.call(r,n))||t.push(n);return t}function oP(r,e){return r=Object(r),sP(r,e,function(t,n){return n in r})}function sP(r,e,t){for(var n=-1,i=e.length,a={};++n<i;){var o=e[n],u=r[o];t(u,o)&&(a[o]=u)}return a}function uP(r,e){return e=hf(e===void 0?r.length-1:e,0),function(){for(var t=arguments,n=-1,i=hf(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,wI(r,this,o)}}function fP(r){return nP(r,SP,lP)}function yn(r,e){var t=r.__data__;return hP(e)?t[typeof e=="string"?"string":"hash"]:t.map}function gf(r,e){var t=xI(r,e);return iP(t)?t:void 0}var cP=ra?ff(ra,Object):bf,lP=ra?function(r){for(var e=[];r;)Ji(e,cP(r)),r=DI(r);return e}:bf;function dP(r){return ta(r)||_f(r)||!!(pf&&r&&r[pf])}function pP(r,e){return e=e??sf,!!e&&(typeof r=="number"||_I.test(r))&&r>-1&&r%1==0&&r<e}function hP(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function yP(r){return!!cf&&cf in r}function gP(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||dn;return r===t}function _P(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}function vP(r){if(typeof r=="string"||EP(r))return r;var e=r+"";return e=="0"&&1/r==-cI?"-0":e}function mP(r){if(r!=null){try{return lf.call(r)}catch{}try{return r+""}catch{}}return""}function wP(r,e){return r===e||r!==r&&e!==e}function _f(r){return bP(r)&&ur.call(r,"callee")&&(!CI.call(r,"callee")||ea.call(r)==lI)}var ta=Array.isArray;function vf(r){return r!=null&&$P(r.length)&&!mf(r)}function bP(r){return wf(r)&&vf(r)}function mf(r){var e=na(r)?ea.call(r):"";return e==dI||e==pI}function $P(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=sf}function na(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function wf(r){return!!r&&typeof r=="object"}function EP(r){return typeof r=="symbol"||wf(r)&&ea.call(r)==hI}function SP(r){return vf(r)?rP(r,!0):aP(r)}var AP=uP(function(r,e){return r==null?{}:(e=uf(yf(e,1),vP),oP(r,tP(fP(r),e)))});function bf(){return[]}var OP=AP,ia=$e(OP);function IP(r){try{return JSON.parse(r)}catch{return r}}function PP(r){return Object.entries(r).reduce((e,[t,n])=>({...e,[t]:IP(n)}),{})}const $f=r=>typeof r=="string"?r!=="0"&&r!=="false":!!r;function Ef(r){const e=PP(r),t=e.auto_inject===void 0?!0:e.auto_inject,n=e.display_on??[],i=e.first_option==="autodeliver";return{...ia(e,["display_on","first_option"]),auto_inject:t,valid_pages:n,is_subscription_first:i,autoInject:t,validPages:n,isSubscriptionFirst:i}}function Sf(r){const e=r.subscription_options?.storefront_purchase_options==="subscription_only";return{...r,is_subscription_only:e,isSubscriptionOnly:e}}function xP(r){return r.map(e=>{const t={};return Object.entries(e).forEach(([n,i])=>{Object.defineProperty(t,n,{value:Sf(i),enumerable:!0,writable:!0,configurable:!0})}),t})}const aa="2020-12",TP={store_currency:{currency_code:"USD",currency_symbol:"$",decimal_separator:".",thousands_separator:",",currency_symbol_location:"left"}},Yr=new Map;function gn(r,e){return Yr.has(r)||Yr.set(r,e()),Yr.get(r)}async function oa(r,e){if(r===void 0||r==="")throw new Error("ID is required");const t=e?.version??"2020-12",{product:n}=await gn(`product.${r}.${t}`,()=>It("get",`/product/${t}/${F(r)}.json`));return t==="2020-12"?Sf(n):n}async function Af(){return await gn("storeSettings",()=>It("get",`/${aa}/store_settings.json`).catch(()=>TP))}async function Of(){const{widget_settings:r}=await gn("widgetSettings",()=>It("get",`/${aa}/widget_settings.json`));return Ef(r)}async function If(){const{products:r,widget_settings:e,store_settings:t,meta:n}=await gn("productsAndSettings",()=>It("get",`/product/${aa}/products.json`));return n?.status==="error"?Promise.reject(n.message):{products:xP(r),widget_settings:Ef(e),store_settings:t??{}}}async function FP(){const{products:r}=await If();return r}async function RP(r){const[e,t,n]=await Promise.all([oa(r),Af(),Of()]);return{product:e,store_settings:t,widget_settings:n,storeSettings:t,widgetSettings:n}}async function MP(r){const{bundle_product:e}=await oa(r);return e}async function Pf(){return Array.from(Yr.keys()).forEach(r=>Yr.delete(r))}var DP=Object.freeze({__proto__:null,getCDNBundleSettings:MP,getCDNProduct:oa,getCDNProductAndSettings:RP,getCDNProducts:FP,getCDNProductsAndSettings:If,getCDNStoreSettings:Af,getCDNWidgetSettings:Of,resetCDNCache:Pf});async function CP(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 NP(r,e){return w("get","/charges",{query:e},v(r,"listCharges"))}async function BP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/charges/${F(e)}/apply_discount`,{data:{discount_code:t}},v(r,"applyDiscountToCharge"));return n}async function qP(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{charge:t}=await w("post",`/charges/${F(e)}/remove_discount`,{},v(r,"removeDiscountsFromCharge"));return t}async function UP(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/${F(e)}/skip`,{query:n,data:{purchase_item_ids:t.map(a=>Number(a))}},v(r,"skipCharge"));return i}async function LP(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/${F(e)}/unskip`,{query:n,data:{purchase_item_ids:t.map(a=>Number(a))}},v(r,"unskipCharge"));return i}async function kP(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{charge:t}=await w("post",`/charges/${F(e)}/process`,{},v(r,"processCharge"));return t}async function jP(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/charges/${F(e)}/change_next_charge_date`,{data:{next_charge_date:t}},v(r,"rescheduleCharge"));return n}var VP=Object.freeze({__proto__:null,applyDiscountToCharge:BP,getCharge:CP,listCharges:NP,processCharge:kP,removeDiscountsFromCharge:qP,rescheduleCharge:jP,skipCharge:UP,unskipCharge:LP});async function xf(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 GP=Object.freeze({__proto__:null,productSearch:xf});async function Tf(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 HP(r,e){return w("get","/collections",{query:e},v(r,"listCollections"))}async function WP(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([Tf(n,e),xf(n,{...t,collection_ids:[e],limit:250})]);if(i==="manual")return{products:a.reduce((u,f)=>{const d=o.find(c=>c.external_product_id===f);return d&&u.push(d),u},[])};{const u=zP(i);return{products:o.slice().sort(u)}}}function Ff(r,e){const t=r.external_created_at,n=e.external_created_at;return t<n?-1:n>t?1:0}function Rf(r,e){const t=r.external_product_id,n=e.external_product_id;return t<n?-1:n>t?1:0}function Mf(r,e){const t=r.title.toLowerCase(),n=e.title.toLowerCase();return t<n?-1:n>t?1:0}function zP(r){switch(r){case"created_at-asc":return Ff;case"created_at-desc":return(e,t)=>Ff(t,e);case"id-asc":return Rf;case"id-desc":return(e,t)=>Rf(t,e);case"title-asc":return Mf;case"title-desc":return(e,t)=>Mf(t,e)}}var XP=Object.freeze({__proto__:null,getCollection:Tf,listCollectionProducts:WP,listCollections:HP});async function YP(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 Df(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 KP(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{deliveries:n}=await w("get",`/customers/${F(t)}/delivery_schedule`,{query:e},v(r,"getDeliverySchedule"));return n}async function _n(r,e){return w("get","/portal_access",{query:e},v(r,"getCustomerPortalAccess"))}async function ZP(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 _n(v(r,"getActiveChurnLandingPageURL"));return`${n.replace("portal","pages")}${i}/subscriptions/${e}/cancel?token=${a}&subscription=${e}&redirect_to=${t}`}async function JP(r){const{base_url:e,customer_hash:t,temp_token:n}=await _n(v(r,"getFailedPaymentMethodRecoveryLandingPageURL"));return`${e.replace("portal","pages")}account/payment-methods?token=${n}&hash=${t}`}async function QP(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 _n(v(r,"getGiftRedemptionLandingPageURL"));return`${n.replace("portal","pages")}${i}/gifts/${e}?token=${a}&redirect_to=${t}`}const Cf={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 ex(r,e,t){const n=r.customerId;if(!n)throw new Error("Not logged in.");if(!Object.prototype.hasOwnProperty.call(Cf,e))throw new Error("Notification not supported.");const i=Cf[e];return w("post",`/customers/${F(n)}/notifications`,{data:{...i,template_vars:t}},v(r,"sendCustomerNotification"))}async function rx(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{credit_summary:n}=await w("get",`/customers/${F(t)}/credit_summary`,{query:{include:e?.include}},v(r,"getCreditSummary"));return n}var tx=Object.freeze({__proto__:null,getActiveChurnLandingPageURL:ZP,getCreditSummary:rx,getCustomer:YP,getCustomerPortalAccess:_n,getDeliverySchedule:KP,getFailedPaymentMethodRecoveryLandingPageURL:JP,getGiftRedemptionLandingPageURL:QP,sendCustomerNotification:ex,updateCustomer:Df});async function nx(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{credit_summary:n}=await w("get",`/customers/${F(t)}/credit_summary`,{query:{include:e?.include,presentment_currency_code:e?.presentment_currency_code}},v(r,"getCreditSummary"));return n}function ix(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),Df(v(r,"setApplyCreditsToNextCharge"),t)}async function ax(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer_id:n,...i}=e??{};return await w("get","/credit_accounts",{query:{...i,customer_id:t}},v(r,"listCreditAccounts"))}var ox=Object.freeze({__proto__:null,getCreditSummary:nx,listCreditAccounts:ax,setApplyCreditsToNextCharge:ix});async function sx(r,e,t){return await w("post","/customer_surveys/cancellation_prevention",{data:{customer_id:e,subscription_id:t}},v(r,"getCustomerSurveyReasons"))}async function ux(r,e,t,n){return await w("post",`/customer_surveys/${F(t)}/customer_response`,{data:{customer_id:e,response_id:n}},v(r,"getCustomerSurveyOffers"))}async function fx(r,e){return await w("post","/offers/claim",{data:e},v(r,"claimOfferCustomerSurvey")),{}}var cx=Object.freeze({__proto__:null,claimOfferCustomerSurvey:fx,getCustomerSurveyOffers:ux,getCustomerSurveyReasons:sx});function lx(r,e){if(!r.customerId)throw new Error("Not logged in.");return w("get","/gift_purchases",{query:e},v(r,"listGiftPurchases"))}async function dx(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 px=Object.freeze({__proto__:null,getGiftPurchase:dx,listGiftPurchases:lx});function hx(r,e){if(!r.customerId)throw new Error("Not logged in.");return w("get","/incentives/tiered_discounts",{query:e},v(r,"listTieredDiscounts"))}async function yx(r,e){if(!r.customerId)throw new Error("Not logged in.");if(e===void 0||e==="")throw new Error("ID is required");const{tiered_discount:t}=await w("get",`/incentives/tiered_discounts/${F(e)}`,{},v(r,"getTieredDiscount"));return t}function gx(r,e){return w("post","/incentives/tiered_discounts/offers",{data:e},v(r,"getTieredDiscountOffers"))}var _x=Object.freeze({__proto__:null,getTieredDiscount:yx,getTieredDiscountOffers:gx,listTieredDiscounts:hx});async function vx(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 mx(r,e){return w("get","/memberships",{query:e},v(r,"listMemberships"))}async function wx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${F(e)}/cancel`,{data:t},v(r,"cancelMembership"));return n}async function bx(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${F(e)}/activate`,{data:t},v(r,"activateMembership"));return n}async function $x(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await w("post",`/memberships/${F(e)}/change`,{data:t},v(r,"changeMembership"));return n}var Ex=Object.freeze({__proto__:null,activateMembership:bx,cancelMembership:wx,changeMembership:$x,getMembership:vx,listMemberships:mx});async function Sx(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 Ax(r,e){return w("get","/membership_programs",{query:e},v(r,"listMembershipPrograms"))}var Ox=Object.freeze({__proto__:null,getMembershipProgram:Sx,listMembershipPrograms:Ax});async function Ix(r,e){const{metafield:t}=await w("post","/metafields",{data:{metafield:e}},v(r,"createMetafield"));return t}async function Px(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 xx(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/metafields",{id:e},v(r,"deleteMetafield"))}var Tx=Object.freeze({__proto__:null,createMetafield:Ix,deleteMetafield:xx,updateMetafield:Px});async function Fx(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 Rx(r,e){return w("get","/onetimes",{query:e},v(r,"listOnetimes"))}async function Mx(r,e){const{onetime:t}=await w("post","/onetimes",{data:e},v(r,"createOnetime"));return t}async function Dx(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 Cx(r,e){if(e===void 0||e==="")throw new Error("ID is required");return w("delete","/onetimes",{id:e},v(r,"deleteOnetime"))}var Nx=Object.freeze({__proto__:null,createOnetime:Mx,deleteOnetime:Cx,getOnetime:Fx,listOnetimes:Rx,updateOnetime:Dx});async function Bx(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 qx(r,e){return w("get","/orders",{query:e},v(r,"listOrders"))}async function Ux(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{order:t}=await w("post",`/orders/${F(e)}/delay`,{},v(r,"delayOrder"));return t}var Lx=Object.freeze({__proto__:null,delayOrder:Ux,getOrder:Bx,listOrders:qx});async function kx(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 jx(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 Nf(r,e){const{payment_method:t}=await w("post","/payment_methods",{data:{...e,customer_id:r.customerId}},v(r,"createPaymentMethod"));return t}async function Vx(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 Gx(r,e){return w("get","/payment_methods",{query:e},v(r,"listPaymentMethods"))}async function Hx(r,e){const t=await Wx(r,e),n=t.external.environment_key,i=t.payment_method_intent_id,a=t.external_customer_id.ecommerce,o=t.external.resource_url,u=t.external.integrity_hash,f=t.payment_method?.processor_payment_method_token;await kx(o,u);let d=!1,c=null,s=null,l=null;return{mount(p,g){if(typeof window>"u"||!window.Spreedly)throw new Error("Payment script failed to load");window.Spreedly.init(n,{numberEl:p.numberElementId,cvvEl:p.cvvElementId}),window.Spreedly.on("ready",()=>{d=!0,p.styles&&(window.Spreedly.setStyle("number",p.styles),window.Spreedly.setStyle("cvv",p.styles)),p.numberLabel&&window.Spreedly.setLabel("number",p.numberLabel),p.cvvLabel&&window.Spreedly.setLabel("cvv",p.cvvLabel),p.numberPlaceholder&&window.Spreedly.setPlaceholder("number",p.numberPlaceholder),p.cvvPlaceholder&&window.Spreedly.setPlaceholder("cvv",p.cvvPlaceholder),p.numberFormat==="plainFormat"?(p.numberFieldType&&window.Spreedly.setFieldType("number",p.numberFieldType),p.cvvFieldType&&window.Spreedly.setFieldType("cvv",p.cvvFieldType),window.Spreedly.setNumberFormat("plainFormat")):p.numberFormat==="maskedFormat"?(window.Spreedly.setFieldType("cvv","text"),window.Spreedly.setFieldType("number","text"),window.Spreedly.setNumberFormat("maskedFormat")):p.numberFormat==="prettyFormat"?(p.numberFieldType==="text"||p.numberFieldType==="tel"?window.Spreedly.setFieldType("number",p.numberFieldType):window.Spreedly.setFieldType("number","tel"),p.cvvFieldType==="text"||p.cvvFieldType==="tel"?window.Spreedly.setFieldType("cvv",p.cvvFieldType):window.Spreedly.setFieldType("cvv","tel"),window.Spreedly.setNumberFormat("prettyFormat")):(p.numberFieldType&&window.Spreedly.setFieldType("number",p.numberFieldType),p.cvvFieldType&&window.Spreedly.setFieldType("cvv",p.cvvFieldType)),g?.onReady?.()}),window.Spreedly.on("fieldEvent",($,E,A,S)=>{g?.onFieldEvent?.($,E,A,S)}),window.Spreedly.on("errors",$=>{g?.onErrors?.($)}),window.Spreedly.on("paymentMethod",($,E)=>{c=$,g?.onPaymentMethod?.($,E),s&&(c=null,s($),s=null)})},tokenize(p){if(!d||!window.Spreedly)throw new Error("Payment form is not initialized");let g=String(p.year);g.length===2&&(g=`20${g}`);const $=String(p.month).padStart(2,"0");"full_name"in p?window.Spreedly.tokenizeCreditCard({full_name:p.full_name,month:$,year:g}):window.Spreedly.tokenizeCreditCard({first_name:p.first_name,last_name:p.last_name,month:$,year:g})},async submit(p){if(!d)throw new Error("Payment form is not initialized");if(c){const g=c;return c=null,Bf(r,g,p,{external_payment_method_id:f,payment_method_intent_id:i,external_customer_id:a})}return new Promise((g,$)=>{l=p,s=async E=>{try{const A=await Bf(r,E,l,{external_payment_method_id:f,payment_method_intent_id:i,external_customer_id:a});g(A)}catch(A){$(A)}finally{l=null}},this.tokenize(p.card_details)})},reset(){window.Spreedly&&window.Spreedly.reload(),c=null,s=null,l=null},unmount(){window.Spreedly&&window.Spreedly.removeHandlers(),d=!1,c=null,s=null,l=null},addEventHandlers(p){p.onReady&&window.Spreedly.on("ready",p.onReady),p.onFieldEvent&&window.Spreedly.on("fieldEvent",p.onFieldEvent),p.onErrors&&window.Spreedly.on("errors",p.onErrors),p.onPaymentMethod&&window.Spreedly.on("paymentMethod",p.onPaymentMethod)},removeHandlers(){window.Spreedly&&window.Spreedly.removeHandlers()},setFieldType(p,g){window.Spreedly.setFieldType(p,g)},setLabel(p,g){window.Spreedly.setLabel(p,g)},setNumberFormat(p){window.Spreedly.setNumberFormat(p)},setPlaceholder(p,g){window.Spreedly.setPlaceholder(p,g)},setStyle(p,g){window.Spreedly.setStyle(p,g)}}}async function Wx(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 Bf(r,e,{billing_address:t,default_payment_method:n,address_ids:i,apply_to_all_subscription_addresses:a},{external_payment_method_id:o,payment_method_intent_id:u,external_customer_id:f}){return await Nf(v(r,"submitFrictionlessPaymentMethodV1"),{default:n??!1,payment_type:"CREDIT_CARD",processor_customer_token:f.toString(),processor_name:"frictionless",processor_payment_method_token:e,billing_address:t,payment_method_intent_id:u,address_ids:i,external_payment_method_id:o,apply_to_all_subscription_addresses:a})}var zx=Object.freeze({__proto__:null,createPaymentMethod:Nf,getPaymentMethod:jx,initFrictionlessPaymentV1:Hx,listPaymentMethods:Gx,updatePaymentMethod:Vx});async function Xx(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 Yx(r,e){return w("get","/plans",{query:e},v(r,"listPlans"))}var Kx=Object.freeze({__proto__:null,getPlan:Xx,listPlans:Yx});async function Zx(r,e){return await w("get","/shop/shipping_countries",{query:e,headers:{"X-Recharge-Version":"2021-01"}},v(r,"getShippingCountries"))}async function Jx(r){return await w("get","/shop/settings",{headers:{"X-Recharge-Version":"2021-01"}},v(r,"getStoreSettings"))}var Qx=Object.freeze({__proto__:null,getShippingCountries:Zx,getStoreSettings:Jx}),e2="Expected a function",qf="__lodash_placeholder__",Ue=1,vn=2,r2=4,lr=8,Kr=16,Le=32,Zr=64,Uf=128,t2=256,Lf=512,kf=1/0,n2=9007199254740991,i2=17976931348623157e292,jf=0/0,a2=[["ary",Uf],["bind",Ue],["bindKey",vn],["curry",lr],["curryRight",Kr],["flip",Lf],["partial",Le],["partialRight",Zr],["rearg",t2]],o2="[object Function]",s2="[object GeneratorFunction]",u2="[object Symbol]",f2=/[\\^$.*+?()[\]{}|]/g,c2=/^\s+|\s+$/g,l2=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,d2=/\{\n\/\* \[wrapped with (.+)\] \*/,p2=/,? & /,h2=/^[-+]0x[0-9a-f]+$/i,y2=/^0b[01]+$/i,g2=/^\[object .+?Constructor\]$/,_2=/^0o[0-7]+$/i,v2=/^(?:0|[1-9]\d*)$/,m2=parseInt,w2=typeof C=="object"&&C&&C.Object===Object&&C,b2=typeof self=="object"&&self&&self.Object===Object&&self,Jr=w2||b2||Function("return this")();function sa(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 $2(r,e){for(var t=-1,n=r?r.length:0;++t<n&&e(r[t],t,r)!==!1;);return r}function E2(r,e){var t=r?r.length:0;return!!t&&A2(r,e,0)>-1}function S2(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 A2(r,e,t){if(e!==e)return S2(r,O2,t);for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function O2(r){return r!==r}function I2(r,e){for(var t=r.length,n=0;t--;)r[t]===e&&n++;return n}function P2(r,e){return r?.[e]}function x2(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch{}return e}function ua(r,e){for(var t=-1,n=r.length,i=0,a=[];++t<n;){var o=r[t];(o===e||o===qf)&&(r[t]=qf,a[i++]=t)}return a}var T2=Function.prototype,Vf=Object.prototype,fa=Jr["__core-js_shared__"],Gf=function(){var r=/[^.]+$/.exec(fa&&fa.keys&&fa.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Hf=T2.toString,F2=Vf.hasOwnProperty,Wf=Vf.toString,R2=RegExp("^"+Hf.call(F2).replace(f2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),M2=Object.create,dr=Math.max,D2=Math.min,zf=function(){var r=Yf(Object,"defineProperty"),e=Yf.name;return e&&e.length>2?r:void 0}();function C2(r){return pr(r)?M2(r):{}}function N2(r){if(!pr(r)||X2(r))return!1;var e=J2(r)||x2(r)?R2:g2;return e.test(K2(r))}function B2(r,e){return e=dr(e===void 0?r.length-1:e,0),function(){for(var t=arguments,n=-1,i=dr(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,sa(r,this,o)}}function q2(r,e,t,n){for(var i=-1,a=r.length,o=t.length,u=-1,f=e.length,d=dr(a-o,0),c=Array(f+d),s=!n;++u<f;)c[u]=e[u];for(;++i<o;)(s||i<a)&&(c[t[i]]=r[i]);for(;d--;)c[u++]=r[i++];return c}function U2(r,e,t,n){for(var i=-1,a=r.length,o=-1,u=t.length,f=-1,d=e.length,c=dr(a-u,0),s=Array(c+d),l=!n;++i<c;)s[i]=r[i];for(var p=i;++f<d;)s[p+f]=e[f];for(;++o<u;)(l||i<a)&&(s[p+t[o]]=r[i++]);return s}function L2(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}function k2(r,e,t){var n=e&Ue,i=Qr(r);function a(){var o=this&&this!==Jr&&this instanceof a?i:r;return o.apply(n?t:this,arguments)}return a}function Qr(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=C2(r.prototype),n=r.apply(t,e);return pr(n)?n:t}}function j2(r,e,t){var n=Qr(r);function i(){for(var a=arguments.length,o=Array(a),u=a,f=la(i);u--;)o[u]=arguments[u];var d=a<3&&o[0]!==f&&o[a-1]!==f?[]:ua(o,f);if(a-=d.length,a<t)return Xf(r,e,ca,i.placeholder,void 0,o,d,void 0,void 0,t-a);var c=this&&this!==Jr&&this instanceof i?n:r;return sa(c,this,o)}return i}function ca(r,e,t,n,i,a,o,u,f,d){var c=e&Uf,s=e&Ue,l=e&vn,p=e&(lr|Kr),g=e&Lf,$=l?void 0:Qr(r);function E(){for(var A=arguments.length,S=Array(A),h=A;h--;)S[h]=arguments[h];if(p)var O=la(E),T=I2(S,O);if(n&&(S=q2(S,n,i,p)),a&&(S=U2(S,a,o,p)),A-=T,p&&A<d){var R=ua(S,O);return Xf(r,e,ca,E.placeholder,t,S,R,u,f,d-A)}var b=s?t:this,_=l?b[r]:r;return A=S.length,u?S=Y2(S,u):g&&A>1&&S.reverse(),c&&f<A&&(S.length=f),this&&this!==Jr&&this instanceof E&&(_=$||Qr(_)),_.apply(b,S)}return E}function V2(r,e,t,n){var i=e&Ue,a=Qr(r);function o(){for(var u=-1,f=arguments.length,d=-1,c=n.length,s=Array(c+f),l=this&&this!==Jr&&this instanceof o?a:r;++d<c;)s[d]=n[d];for(;f--;)s[d++]=arguments[++u];return sa(l,i?t:this,s)}return o}function Xf(r,e,t,n,i,a,o,u,f,d){var c=e&lr,s=c?o:void 0,l=c?void 0:o,p=c?a:void 0,g=c?void 0:a;e|=c?Le:Zr,e&=~(c?Zr:Le),e&r2||(e&=~(Ue|vn));var $=t(r,e,i,p,s,g,l,u,f,d);return $.placeholder=n,Kf($,r,e)}function G2(r,e,t,n,i,a,o,u){var f=e&vn;if(!f&&typeof r!="function")throw new TypeError(e2);var d=n?n.length:0;if(d||(e&=~(Le|Zr),n=i=void 0),o=o===void 0?o:dr(Zf(o),0),u=u===void 0?u:Zf(u),d-=i?i.length:0,e&Zr){var c=n,s=i;n=i=void 0}var l=[r,e,t,n,i,c,s,a,o,u];if(r=l[0],e=l[1],t=l[2],n=l[3],i=l[4],u=l[9]=l[9]==null?f?0:r.length:dr(l[9]-d,0),!u&&e&(lr|Kr)&&(e&=~(lr|Kr)),!e||e==Ue)var p=k2(r,e,t);else e==lr||e==Kr?p=j2(r,e,u):(e==Le||e==(Ue|Le))&&!i.length?p=V2(r,e,t,n):p=ca.apply(void 0,l);return Kf(p,r,e)}function la(r){var e=r;return e.placeholder}function Yf(r,e){var t=P2(r,e);return N2(t)?t:void 0}function H2(r){var e=r.match(d2);return e?e[1].split(p2):[]}function W2(r,e){var t=e.length,n=t-1;return e[n]=(t>1?"& ":"")+e[n],e=e.join(t>2?", ":" "),r.replace(l2,`{
25
- /* [wrapped with `+e+`] */
26
- `)}function z2(r,e){return e=e??n2,!!e&&(typeof r=="number"||v2.test(r))&&r>-1&&r%1==0&&r<e}function X2(r){return!!Gf&&Gf in r}function Y2(r,e){for(var t=r.length,n=D2(e.length,t),i=L2(r);n--;){var a=e[n];r[n]=z2(a,t)?i[a]:void 0}return r}var Kf=zf?function(r,e,t){var n=e+"";return zf(r,"toString",{configurable:!0,enumerable:!1,value:nT(W2(n,Z2(H2(n),t)))})}:iT;function K2(r){if(r!=null){try{return Hf.call(r)}catch{}try{return r+""}catch{}}return""}function Z2(r,e){return $2(a2,function(t){var n="_."+t[0];e&t[1]&&!E2(r,n)&&r.push(n)}),r.sort()}var da=B2(function(r,e){var t=ua(e,la(da));return G2(r,Le,void 0,e,t)});function J2(r){var e=pr(r)?Wf.call(r):"";return e==o2||e==s2}function pr(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function Q2(r){return!!r&&typeof r=="object"}function eT(r){return typeof r=="symbol"||Q2(r)&&Wf.call(r)==u2}function rT(r){if(!r)return r===0?r:0;if(r=tT(r),r===kf||r===-kf){var e=r<0?-1:1;return e*i2}return r===r?r:0}function Zf(r){var e=rT(r),t=e%1;return e===e?t?e-t:e:0}function tT(r){if(typeof r=="number")return r;if(eT(r))return jf;if(pr(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=pr(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(c2,"");var t=y2.test(r);return t||_2.test(r)?m2(r.slice(2),t?2:8):h2.test(r)?jf:+r}function nT(r){return function(){return r}}function iT(r){return r}da.placeholder={};var aT=da,Jf=$e(aT);function oT(r,e){return{...ia(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 sT(r,e){return{...ia(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 Qf(r){const{id:e,address_id:t,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:u,charge_interval_frequency:f,created_at:d,expire_after_specific_number_of_charges:c,shopify_product_id:s,shopify_variant_id:l,has_queued_charges:p,is_prepaid:g,is_skippable:$,is_swappable:E,max_retries_reached:A,next_charge_scheduled_at:S,order_day_of_month:h,order_day_of_week:O,order_interval_frequency:T,order_interval_unit:R,presentment_currency:b,price:_,product_title:m,properties:I,quantity:P,sku:q,sku_override:z,status:ue,updated_at:Z,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:u,charge_interval_frequency:parseInt(f,10),created_at:d,expire_after_specific_number_of_charges:c,external_product_id:{ecommerce:`${s}`},external_variant_id:{ecommerce:`${l}`},has_queued_charges:$f(p),is_prepaid:g,is_skippable:$,is_swappable:E,max_retries_reached:$f(A),next_charge_scheduled_at:S,order_day_of_month:h,order_day_of_week:O,order_interval_frequency:parseInt(T,10),order_interval_unit:R,presentment_currency:b,price:`${_}`,product_title:m??"",properties:I,quantity:P,sku:q,sku_override:z,status:ue.toLowerCase(),updated_at:Z,variant_title:ke}}async function uT(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 fT(r,e){return w("get","/subscriptions",{query:e},v(r,"listSubscriptions"))}function cT(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");return w("get",`/subscriptions/${F(e)}/addons`,{query:t},v(r,"listSubscriptionAddons"))}async function lT(r,e,t){const{subscription:n}=await w("post","/subscriptions",{data:e,query:t},v(r,"createSubscription"));return n}async function dT(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 pT(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:i}=await w("post",`/subscriptions/${F(e)}/set_next_charge_date`,{data:{date:t},query:n},v(r,"updateSubscriptionChargeDate"));return i}async function hT(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:n}=await w("post",`/subscriptions/${F(e)}/change_address`,{data:{address_id:t}},v(r,"updateSubscriptionAddress"));return n}async function yT(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:i}=await w("post",`/subscriptions/${F(e)}/cancel`,{data:t,query:n},v(r,"cancelSubscription"));return i}async function gT(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:n}=await w("post",`/subscriptions/${F(e)}/activate`,{query:t},v(r,"activateSubscription"));return n}async function _T(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await w("post",`/subscriptions/${F(e)}/charges/skip`,{data:{date:t,subscription_id:`${e}`}},v(r,"skipSubscriptionCharge"));return n}async function vT(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 mT(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=Jf(oT,i),u=e.map(o);let f;t?.allow_onetimes!==void 0&&(f={allow_onetimes:t.allow_onetimes});const{subscriptions:d}=await w("post",`/addresses/${F(a)}/subscriptions-bulk`,{data:{subscriptions:u,commit_update:!!t?.commit},headers:{"X-Recharge-Version":"2021-01"},query:f},v(r,"createSubscriptions"));return d.map(Qf)}async function wT(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=Jf(sT,!!n?.force_update),u=t.map(o);let f;n?.allow_onetimes!==void 0&&(f={allow_onetimes:n.allow_onetimes});const{subscriptions:d}=await w("put",`/addresses/${F(e)}/subscriptions-bulk`,{data:{subscriptions:u,commit_update:!!n?.commit},headers:{"X-Recharge-Version":"2021-01"},query:f},v(r,"updateSubscriptions"));return d.map(Qf)}async function bT(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/${F(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 $T=Object.freeze({__proto__:null,activateSubscription:gT,cancelSubscription:yT,createSubscription:lT,createSubscriptions:mT,deleteSubscriptions:bT,getSubscription:uT,listSubscriptionAddons:cT,listSubscriptions:fT,skipGiftSubscriptionCharge:vT,skipSubscriptionCharge:_T,updateSubscription:dT,updateSubscriptionAddress:hT,updateSubscriptionChargeDate:pT,updateSubscriptions:wT});const ET={get(r,e){return Y("get",r,e)},post(r,e){return Y("post",r,e)},put(r,e){return Y("put",r,e)},delete(r,e){return Y("delete",r,e)}};function ST(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 AT(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.");dh({storeIdentifier:ST(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}),Pf()}const ec={init:AT,api:ET,address:Oh,auth:Nh,bundle:QO,bundleData:uI,charge:VP,cdn:DP,collection:XP,credit:ox,customer:tx,customerSurveys:cx,gift:px,tieredDiscount:_x,membership:Ex,membershipProgram:Ox,metafield:Tx,onetime:Nx,order:Lx,paymentMethod:zx,plan:Kx,product:GP,store:Qx,subscription:$T};try{ec.init()}catch{}return ec});
11
+ */(function(e,t){typeof Pg=="function"&&r&&r.exports?r.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(ve,function(){function e(d,s,_){this.low=d|0,this.high=s|0,this.unsigned=!!_}e.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=function(s){return(s&&s.__isLong__)===!0};var t={},n={};e.fromInt=function(s,_){var l,m;return _?(s=s>>>0,0<=s&&s<256&&(m=n[s],m)?m:(l=new e(s,(s|0)<0?-1:0,!0),0<=s&&s<256&&(n[s]=l),l)):(s=s|0,-128<=s&&s<128&&(m=t[s],m)?m:(l=new e(s,s<0?-1:0,!1),-128<=s&&s<128&&(t[s]=l),l))},e.fromNumber=function(s,_){return _=!!_,isNaN(s)||!isFinite(s)?e.ZERO:!_&&s<=-c?e.MIN_VALUE:!_&&s+1>=c?e.MAX_VALUE:_&&s>=u?e.MAX_UNSIGNED_VALUE:s<0?e.fromNumber(-s,_).negate():new e(s%o|0,s/o|0,_)},e.fromBits=function(s,_,l){return new e(s,_,l)},e.fromString=function(s,_,l){if(s.length===0)throw Error("number format error: empty string");if(s==="NaN"||s==="Infinity"||s==="+Infinity"||s==="-Infinity")return e.ZERO;if(typeof _=="number"&&(l=_,_=!1),l=l||10,l<2||36<l)throw Error("radix out of range: "+l);var m;if((m=s.indexOf("-"))>0)throw Error('number format error: interior "-" character: '+s);if(m===0)return e.fromString(s.substring(1),_,l).negate();for(var E=e.fromNumber(Math.pow(l,8)),I=e.ZERO,x=0;x<s.length;x+=8){var O=Math.min(8,s.length-x),f=parseInt(s.substring(x,x+O),l);if(O<8){var S=e.fromNumber(Math.pow(l,O));I=I.multiply(S).add(e.fromNumber(f))}else I=I.multiply(E),I=I.add(e.fromNumber(f))}return I.unsigned=_,I},e.fromValue=function(s){return s instanceof e?s:typeof s=="number"?e.fromNumber(s):typeof s=="string"?e.fromString(s):new e(s.low,s.high,s.unsigned)};var i=65536,a=1<<24,o=i*i,u=o*o,c=u/2,h=e.fromInt(a);return e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*o+(this.low>>>0):this.high*o+(this.low>>>0)},e.prototype.toString=function(s){if(s=s||10,s<2||36<s)throw RangeError("radix out of range: "+s);if(this.isZero())return"0";var _;if(this.isNegative())if(this.equals(e.MIN_VALUE)){var l=e.fromNumber(s),m=this.divide(l);return _=m.multiply(l).subtract(this),m.toString(s)+_.toInt().toString(s)}else return"-"+this.negate().toString(s);var E=e.fromNumber(Math.pow(s,6),this.unsigned);_=this;for(var I="";;){var x=_.divide(E),O=_.subtract(x.multiply(E)).toInt()>>>0,f=O.toString(s);if(_=x,_.isZero())return f+I;for(;f.length<6;)f="0"+f;I=""+f+I}},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(e.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var s=this.high!=0?this.high:this.low,_=31;_>0&&!(s&1<<_);_--);return this.high!=0?_+33:_+1},e.prototype.isZero=function(){return this.high===0&&this.low===0},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isOdd=function(){return(this.low&1)===1},e.prototype.isEven=function(){return(this.low&1)===0},e.prototype.equals=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.unsigned!==s.unsigned&&this.high>>>31===1&&s.high>>>31===1?!1:this.high===s.high&&this.low===s.low},e.eq=e.prototype.equals,e.prototype.notEquals=function(s){return!this.equals(s)},e.neq=e.prototype.notEquals,e.prototype.lessThan=function(s){return this.compare(s)<0},e.prototype.lt=e.prototype.lessThan,e.prototype.lessThanOrEqual=function(s){return this.compare(s)<=0},e.prototype.lte=e.prototype.lessThanOrEqual,e.prototype.greaterThan=function(s){return this.compare(s)>0},e.prototype.gt=e.prototype.greaterThan,e.prototype.greaterThanOrEqual=function(s){return this.compare(s)>=0},e.prototype.gte=e.prototype.greaterThanOrEqual,e.prototype.compare=function(s){if(e.isLong(s)||(s=e.fromValue(s)),this.equals(s))return 0;var _=this.isNegative(),l=s.isNegative();return _&&!l?-1:!_&&l?1:this.unsigned?s.high>>>0>this.high>>>0||s.high===this.high&&s.low>>>0>this.low>>>0?-1:1:this.subtract(s).isNegative()?-1:1},e.prototype.negate=function(){return!this.unsigned&&this.equals(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=e.prototype.negate,e.prototype.add=function(s){e.isLong(s)||(s=e.fromValue(s));var _=this.high>>>16,l=this.high&65535,m=this.low>>>16,E=this.low&65535,I=s.high>>>16,x=s.high&65535,O=s.low>>>16,f=s.low&65535,S=0,P=0,D=0,b=0;return b+=E+f,D+=b>>>16,b&=65535,D+=m+O,P+=D>>>16,D&=65535,P+=l+x,S+=P>>>16,P&=65535,S+=_+I,S&=65535,e.fromBits(D<<16|b,S<<16|P,this.unsigned)},e.prototype.subtract=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.add(s.negate())},e.prototype.sub=e.prototype.subtract,e.prototype.multiply=function(s){if(this.isZero()||(e.isLong(s)||(s=e.fromValue(s)),s.isZero()))return e.ZERO;if(this.equals(e.MIN_VALUE))return s.isOdd()?e.MIN_VALUE:e.ZERO;if(s.equals(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return s.isNegative()?this.negate().multiply(s.negate()):this.negate().multiply(s).negate();if(s.isNegative())return this.multiply(s.negate()).negate();if(this.lessThan(h)&&s.lessThan(h))return e.fromNumber(this.toNumber()*s.toNumber(),this.unsigned);var _=this.high>>>16,l=this.high&65535,m=this.low>>>16,E=this.low&65535,I=s.high>>>16,x=s.high&65535,O=s.low>>>16,f=s.low&65535,S=0,P=0,D=0,b=0;return b+=E*f,D+=b>>>16,b&=65535,D+=m*f,P+=D>>>16,D&=65535,D+=E*O,P+=D>>>16,D&=65535,P+=l*f,S+=P>>>16,P&=65535,P+=m*O,S+=P>>>16,P&=65535,P+=E*x,S+=P>>>16,P&=65535,S+=_*f+l*O+m*x+E*I,S&=65535,e.fromBits(D<<16|b,S<<16|P,this.unsigned)},e.prototype.mul=e.prototype.multiply,e.prototype.divide=function(s){if(e.isLong(s)||(s=e.fromValue(s)),s.isZero())throw new Error("division by zero");if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var _,l,m;if(this.equals(e.MIN_VALUE)){if(s.equals(e.ONE)||s.equals(e.NEG_ONE))return e.MIN_VALUE;if(s.equals(e.MIN_VALUE))return e.ONE;var E=this.shiftRight(1);return _=E.divide(s).shiftLeft(1),_.equals(e.ZERO)?s.isNegative()?e.ONE:e.NEG_ONE:(l=this.subtract(s.multiply(_)),m=_.add(l.divide(s)),m)}else if(s.equals(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return s.isNegative()?this.negate().divide(s.negate()):this.negate().divide(s).negate();if(s.isNegative())return this.divide(s.negate()).negate();for(m=e.ZERO,l=this;l.greaterThanOrEqual(s);){_=Math.max(1,Math.floor(l.toNumber()/s.toNumber()));for(var I=Math.ceil(Math.log(_)/Math.LN2),x=I<=48?1:Math.pow(2,I-48),O=e.fromNumber(_),f=O.multiply(s);f.isNegative()||f.greaterThan(l);)_-=x,O=e.fromNumber(_,this.unsigned),f=O.multiply(s);O.isZero()&&(O=e.ONE),m=m.add(O),l=l.subtract(f)}return m},e.prototype.div=e.prototype.divide,e.prototype.modulo=function(s){return e.isLong(s)||(s=e.fromValue(s)),this.subtract(this.divide(s).multiply(s))},e.prototype.mod=e.prototype.modulo,e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.and=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low&s.low,this.high&s.high,this.unsigned)},e.prototype.or=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low|s.low,this.high|s.high,this.unsigned)},e.prototype.xor=function(s){return e.isLong(s)||(s=e.fromValue(s)),e.fromBits(this.low^s.low,this.high^s.high,this.unsigned)},e.prototype.shiftLeft=function(s){return e.isLong(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?e.fromBits(this.low<<s,this.high<<s|this.low>>>32-s,this.unsigned):e.fromBits(0,this.low<<s-32,this.unsigned)},e.prototype.shl=e.prototype.shiftLeft,e.prototype.shiftRight=function(s){return e.isLong(s)&&(s=s.toInt()),(s&=63)===0?this:s<32?e.fromBits(this.low>>>s|this.high<<32-s,this.high>>s,this.unsigned):e.fromBits(this.high>>s-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=e.prototype.shiftRight,e.prototype.shiftRightUnsigned=function(s){if(e.isLong(s)&&(s=s.toInt()),s&=63,s===0)return this;var _=this.high;if(s<32){var l=this.low;return e.fromBits(l>>>s|_<<32-s,_>>>s,this.unsigned)}else return s===32?e.fromBits(_,0,this.unsigned):e.fromBits(_>>>s-32,0,this.unsigned)},e.prototype.shru=e.prototype.shiftRightUnsigned,e.prototype.toSigned=function(){return this.unsigned?new e(this.low,this.high,!1):this},e.prototype.toUnsigned=function(){return this.unsigned?this:new e(this.low,this.high,!0)},e})})(zn);var Yn=zn.exports;Object.defineProperty(sr,"__esModule",{value:!0}),sr.Hyper=void 0;var Fg=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}}(),Kn=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)}},Rg=Yn,Ee=Zn(Rg),Mg=R,Dg=Zn(Mg);function Zn(r){return r&&r.__esModule?r:{default:r}}function Cg(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function qg(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 Ng(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 $e=sr.Hyper=function(r){Ng(e,r),Fg(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=Kn(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=Kn(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 Cg(this,e),qg(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!1))}return e}(Ee.default);(0,Dg.default)($e),$e.MAX_VALUE=new $e(Ee.default.MAX_VALUE.low,Ee.default.MAX_VALUE.high),$e.MIN_VALUE=new $e(Ee.default.MIN_VALUE.low,Ee.default.MIN_VALUE.high);var ae={};Object.defineProperty(ae,"__esModule",{value:!0}),ae.UnsignedInt=void 0;var kg=Be,Jn=Qn(kg),Ug=R,Bg=Qn(Ug);function Qn(r){return r&&r.__esModule?r:{default:r}}var Ie=ae.UnsignedInt={read:function(e){return e.readUInt32BE()},write:function(e,t){if(!(0,Jn.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,Jn.default)(e)||Math.floor(e)!==e?!1:e>=Ie.MIN_VALUE&&e<=Ie.MAX_VALUE}};Ie.MAX_VALUE=Math.pow(2,32)-1,Ie.MIN_VALUE=0,(0,Bg.default)(Ie);var ur={};Object.defineProperty(ur,"__esModule",{value:!0}),ur.UnsignedHyper=void 0;var Lg=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}}(),ei=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)}},Vg=Yn,Se=ri(Vg),jg=R,Xg=ri(jg);function ri(r){return r&&r.__esModule?r:{default:r}}function Gg(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Hg(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 Wg(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 Ae=ur.UnsignedHyper=function(r){Wg(e,r),Lg(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=ei(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=ei(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 Gg(this,e),Hg(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!0))}return e}(Se.default);(0,Xg.default)(Ae),Ae.MAX_VALUE=new Ae(Se.default.MAX_UNSIGNED_VALUE.low,Se.default.MAX_UNSIGNED_VALUE.high),Ae.MIN_VALUE=new Ae(Se.default.MIN_VALUE.low,Se.default.MIN_VALUE.high);var cr={};Object.defineProperty(cr,"__esModule",{value:!0}),cr.Float=void 0;var zg=Be,ti=ni(zg),Yg=R,Kg=ni(Yg);function ni(r){return r&&r.__esModule?r:{default:r}}var Zg=cr.Float={read:function(e){return e.readFloatBE()},write:function(e,t){if(!(0,ti.default)(e))throw new Error("XDR Write Error: not a number");t.writeFloatBE(e)},isValid:function(e){return(0,ti.default)(e)}};(0,Kg.default)(Zg);var lr={};Object.defineProperty(lr,"__esModule",{value:!0}),lr.Double=void 0;var Jg=Be,ii=ai(Jg),Qg=R,ey=ai(Qg);function ai(r){return r&&r.__esModule?r:{default:r}}var ry=lr.Double={read:function(e){return e.readDoubleBE()},write:function(e,t){if(!(0,ii.default)(e))throw new Error("XDR Write Error: not a number");t.writeDoubleBE(e)},isValid:function(e){return(0,ii.default)(e)}};(0,ey.default)(ry);var fr={};Object.defineProperty(fr,"__esModule",{value:!0}),fr.Quadruple=void 0;var ty=R,ny=iy(ty);function iy(r){return r&&r.__esModule?r:{default:r}}var ay=fr.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,ny.default)(ay);var Oe={},oy=Z,sy=J,uy="[object Boolean]";function cy(r){return r===!0||r===!1||sy(r)&&oy(r)==uy}var ly=cy;Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.Bool=void 0;var fy=ly,dy=si(fy),oi=W,hy=R,py=si(hy);function si(r){return r&&r.__esModule?r:{default:r}}var _y=Oe.Bool={read:function(e){var t=oi.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 oi.Int.write(n,t)},isValid:function(e){return(0,dy.default)(e)}};(0,py.default)(_y);var dr={},gy=Z,yy=N,vy=J,my="[object String]";function wy(r){return typeof r=="string"||!yy(r)&&vy(r)&&gy(r)==my}var ui=wy;Object.defineProperty(dr,"__esModule",{value:!0}),dr.String=void 0;var by=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}}(),Ey=ui,ci=rt(Ey),$y=N,Iy=rt($y),li=W,Sy=ae,fi=ne,Ay=R,Oy=rt(Ay);function rt(r){return r&&r.__esModule?r:{default:r}}function xy(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Ty=dr.String=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Sy.UnsignedInt.MAX_VALUE;xy(this,r),this._maxLength=e}return by(r,[{key:"read",value:function(t){var n=li.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,fi.calculatePadding)(n),a=t.slice(n);return(0,fi.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,ci.default)(t)?i=p.from(t,"utf8"):i=p.from(t),li.Int.write(i.length,n),n.writeBufferPadded(i)}},{key:"isValid",value:function(t){var n=void 0;if((0,ci.default)(t))n=p.from(t,"utf8");else if((0,Iy.default)(t)||p.isBuffer(t))n=p.from(t);else return!1;return n.length<=this._maxLength}}]),r}();(0,Oy.default)(Ty.prototype);var hr={};Object.defineProperty(hr,"__esModule",{value:!0}),hr.Opaque=void 0;var Py=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}}(),di=ne,Fy=R,Ry=My(Fy);function My(r){return r&&r.__esModule?r:{default:r}}function Dy(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Cy=hr.Opaque=function(){function r(e){Dy(this,r),this._length=e,this._padding=(0,di.calculatePadding)(e)}return Py(r,[{key:"read",value:function(t){var n=t.slice(this._length);return(0,di.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 p.isBuffer(t)&&t.length===this._length}}]),r}();(0,Ry.default)(Cy.prototype);var pr={};Object.defineProperty(pr,"__esModule",{value:!0}),pr.VarOpaque=void 0;var qy=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}}(),hi=W,Ny=ae,pi=ne,ky=R,Uy=By(ky);function By(r){return r&&r.__esModule?r:{default:r}}function Ly(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Vy=pr.VarOpaque=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ny.UnsignedInt.MAX_VALUE;Ly(this,r),this._maxLength=e}return qy(r,[{key:"read",value:function(t){var n=hi.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,pi.calculatePadding)(n),a=t.slice(n);return(0,pi.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));hi.Int.write(t.length,n),n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return p.isBuffer(t)&&t.length<=this._maxLength}}]),r}();(0,Uy.default)(Vy.prototype);var _r={};function jy(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}var Xy=jy,Gy=ze;function Hy(r){return typeof r=="function"?r:Gy}var _i=Hy,Wy=Xy,zy=Br,Yy=_i,Ky=N;function Zy(r,e){var t=Ky(r)?Wy:zy;return t(r,Yy(e))}var Jy=Zy,pe=Jy,Qy=/\s/;function ev(r){for(var e=r.length;e--&&Qy.test(r.charAt(e)););return e}var rv=ev,tv=rv,nv=/^\s+/;function iv(r){return r&&r.slice(0,tv(r)+1).replace(nv,"")}var av=iv,ov=av,gi=ue,sv=ar,yi=0/0,uv=/^[-+]0x[0-9a-f]+$/i,cv=/^0b[01]+$/i,lv=/^0o[0-7]+$/i,fv=parseInt;function dv(r){if(typeof r=="number")return r;if(sv(r))return yi;if(gi(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=gi(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=ov(r);var t=cv.test(r);return t||lv.test(r)?fv(r.slice(2),t?2:8):uv.test(r)?yi:+r}var hv=dv,pv=hv,vi=1/0,_v=17976931348623157e292;function gv(r){if(!r)return r===0?r:0;if(r=pv(r),r===vi||r===-vi){var e=r<0?-1:1;return e*_v}return r===r?r:0}var yv=gv,vv=yv;function mv(r){var e=vv(r),t=e%1;return e===e?t?e-t:e:0}var wv=mv,bv=Jt,Ev=_i,$v=wv,Iv=9007199254740991,tt=4294967295,Sv=Math.min;function Av(r,e){if(r=$v(r),r<1||r>Iv)return[];var t=tt,n=Sv(r,tt);e=Ev(e),r-=tt;for(var i=bv(n,e);++t<r;)e(t);return i}var mi=Av;Object.defineProperty(_r,"__esModule",{value:!0}),_r.Array=void 0;var Ov=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}}(),xv=Qr,Tv=xe(xv),Pv=pe,Fv=xe(Pv),Rv=mi,Mv=xe(Rv),Dv=N,wi=xe(Dv),Cv=R,qv=xe(Cv);function xe(r){return r&&r.__esModule?r:{default:r}}function Nv(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var kv=_r.Array=function(){function r(e,t){Nv(this,r),this._childType=e,this._length=t}return Ov(r,[{key:"read",value:function(t){var n=this;return(0,Mv.default)(this._length,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,wi.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,Fv.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,wi.default)(t)||t.length!==this._length?!1:(0,Tv.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,qv.default)(kv.prototype);var gr={};Object.defineProperty(gr,"__esModule",{value:!0}),gr.VarArray=void 0;var Uv=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}}(),Bv=Qr,Lv=Te(Bv),Vv=pe,jv=Te(Vv),Xv=mi,Gv=Te(Xv),Hv=N,bi=Te(Hv),Wv=ae,Ei=W,zv=R,Yv=Te(zv);function Te(r){return r&&r.__esModule?r:{default:r}}function Kv(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Zv=gr.VarArray=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Wv.UnsignedInt.MAX_VALUE;Kv(this,r),this._childType=e,this._maxLength=t}return Uv(r,[{key:"read",value:function(t){var n=this,i=Ei.Int.read(t);if(i>this._maxLength)throw new Error("XDR Read Error: Saw "+i+" length VarArray,"+("max allowed is "+this._maxLength));return(0,Gv.default)(i,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,bi.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));Ei.Int.write(t.length,n),(0,jv.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,bi.default)(t)||t.length>this._maxLength?!1:(0,Lv.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,Yv.default)(Zv.prototype);var yr={};function Jv(r){return r===null}var Qv=Jv;function em(r){return r===void 0}var Pe=em;Object.defineProperty(yr,"__esModule",{value:!0}),yr.Option=void 0;var rm=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}}(),tm=Qv,$i=nt(tm),nm=Pe,Ii=nt(nm),Si=Oe,im=R,am=nt(im);function nt(r){return r&&r.__esModule?r:{default:r}}function om(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var sm=yr.Option=function(){function r(e){om(this,r),this._childType=e}return rm(r,[{key:"read",value:function(t){if(Si.Bool.read(t))return this._childType.read(t)}},{key:"write",value:function(t,n){var i=!((0,$i.default)(t)||(0,Ii.default)(t));Si.Bool.write(i,n),i&&this._childType.write(t,n)}},{key:"isValid",value:function(t){return(0,$i.default)(t)||(0,Ii.default)(t)?!0:this._childType.isValid(t)}}]),r}();(0,am.default)(sm.prototype);var Fe={};Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.Void=void 0;var um=Pe,Ai=Oi(um),cm=R,lm=Oi(cm);function Oi(r){return r&&r.__esModule?r:{default:r}}var fm=Fe.Void={read:function(){},write:function(e){if(!(0,Ai.default)(e))throw new Error("XDR Write Error: trying to write value to a void slot")},isValid:function(e){return(0,Ai.default)(e)}};(0,lm.default)(fm);var vr={},dm=Jr;function hm(r,e){return dm(e,function(t){return r[t]})}var pm=hm,_m=pm,gm=Je;function ym(r){return r==null?[]:_m(r,gm(r))}var vm=ym;Object.defineProperty(vr,"__esModule",{value:!0}),vr.Enum=void 0;var mm=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}}(),wm=pe,bm=it(wm),Em=vm,$m=it(Em),xi=W,Im=R,Sm=it(Im);function it(r){return r&&r.__esModule?r:{default:r}}function Am(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 Om(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 Ti(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var xm=vr.Enum=function(){function r(e,t){Ti(this,r),this.name=e,this.value=t}return mm(r,null,[{key:"read",value:function(t){var n=xi.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);xi.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,$m.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){Om(u,o);function u(){return Ti(this,u),Am(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u}(r);return a.enumName=n,t.results[n]=a,a._members={},a._byValue=new Map,(0,bm.default)(i,function(o,u){var c=new a(u,o);a._members[u]=c,a._byValue.set(o,c),a[u]=function(){return c}}),a}}]),r}();(0,Sm.default)(xm);var mr={},Tm=Br,Pm=we;function Fm(r,e){var t=-1,n=Pm(r)?Array(r.length):[];return Tm(r,function(i,a,o){n[++t]=e(i,a,o)}),n}var Rm=Fm,Mm=Jr,Dm=Vn,Cm=Rm,qm=N;function Nm(r,e){var t=qm(r)?Mm:Cm;return t(r,Dm(e))}var km=Nm;function Um(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 Bm=Um,Re={};Object.defineProperty(Re,"__esModule",{value:!0});var Lm=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 Vm(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}Re.Reference=function(){function r(){Vm(this,r)}return Lm(r,[{key:"resolve",value:function(){throw new Error("implement resolve in child class")}}]),r}(),Object.defineProperty(mr,"__esModule",{value:!0}),mr.Struct=void 0;var wr=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var u=e[Symbol.iterator](),c;!(i=(c=u.next()).done)&&(n.push(c.value),!(t&&n.length===t));i=!0);}catch(h){a=!0,o=h}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),jm=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}}(),Xm=pe,Pi=Me(Xm),Gm=km,Hm=Me(Gm),Wm=Pe,zm=Me(Wm),Ym=Bm,Km=Me(Ym),Zm=Re,Jm=R,Qm=Me(Jm);function Me(r){return r&&r.__esModule?r:{default:r}}function ew(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 rw(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 Fi(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var tw=mr.Struct=function(){function r(e){Fi(this,r),this._attributes=e||{}}return jm(r,null,[{key:"read",value:function(t){var n=(0,Hm.default)(this._fields,function(i){var a=wr(i,2),o=a[0],u=a[1],c=u.read(t);return[o,c]});return new this((0,Km.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,Pi.default)(this._fields,function(i){var a=wr(i,2),o=a[0],u=a[1],c=t._attributes[o];u.write(c,n)})}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(o){rw(u,o);function u(){return Fi(this,u),ew(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u}(r);return a.structName=n,t.results[n]=a,a._fields=i.map(function(o){var u=wr(o,2),c=u[0],h=u[1];return h instanceof Zm.Reference&&(h=h.resolve(t)),[c,h]}),(0,Pi.default)(a._fields,function(o){var u=wr(o,1),c=u[0];a.prototype[c]=nw(c)}),a}}]),r}();(0,Qm.default)(tw);function nw(r){return function(t){return(0,zm.default)(t)||(this._attributes[r]=t),this._attributes[r]}}var br={};Object.defineProperty(br,"__esModule",{value:!0}),br.Union=void 0;var iw=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var u=e[Symbol.iterator](),c;!(i=(c=u.next()).done)&&(n.push(c.value),!(t&&n.length===t));i=!0);}catch(h){a=!0,o=h}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),aw=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}}(),ow=pe,Er=Ir(ow),sw=Pe,Ri=Ir(sw),uw=ui,Mi=Ir(uw),$r=Fe,at=Re,cw=R,lw=Ir(cw);function Ir(r){return r&&r.__esModule?r:{default:r}}function fw(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 dw(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 Di(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var hw=br.Union=function(){function r(e,t){Di(this,r),this.set(e,t)}return aw(r,[{key:"set",value:function(t,n){(0,Mi.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!==$r.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===$r.Void?$r.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,Ri.default)(a)?o=i.read(t):o=a.read(t),new this(n,o)}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.unionName);this._switchOn.write(t.switch(),n),t.armType().write(t.value(),n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(u){dw(c,u);function c(){return Di(this,c),fw(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}return c}(r);a.unionName=n,t.results[n]=a,i.switchOn instanceof at.Reference?a._switchOn=i.switchOn.resolve(t):a._switchOn=i.switchOn,a._switches=new Map,a._arms={},(0,Er.default)(i.arms,function(u,c){u instanceof at.Reference&&(u=u.resolve(t)),a._arms[c]=u});var o=i.defaultArm;return o instanceof at.Reference&&(o=o.resolve(t)),a._defaultArm=o,(0,Er.default)(i.switches,function(u){var c=iw(u,2),h=c[0],d=c[1];(0,Mi.default)(h)&&(h=a._switchOn.fromName(h)),a._switches.set(h,d)}),(0,Ri.default)(a._switchOn.values)||(0,Er.default)(a._switchOn.values(),function(u){a[u.name]=function(c){return new a(u,c)},a.prototype[u.name]=function(h){return this.set(u,h)}}),(0,Er.default)(a._arms,function(u,c){u!==$r.Void&&(a.prototype[c]=function(){return this.get(c)})}),a}}]),r}();(0,lw.default)(hw),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=W;Object.keys(e).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return e[f]}})});var t=sr;Object.keys(t).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return t[f]}})});var n=ae;Object.keys(n).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return n[f]}})});var i=ur;Object.keys(i).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return i[f]}})});var a=cr;Object.keys(a).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return a[f]}})});var o=lr;Object.keys(o).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return o[f]}})});var u=fr;Object.keys(u).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return u[f]}})});var c=Oe;Object.keys(c).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return c[f]}})});var h=dr;Object.keys(h).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return h[f]}})});var d=hr;Object.keys(d).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return d[f]}})});var s=pr;Object.keys(s).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return s[f]}})});var _=_r;Object.keys(_).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return _[f]}})});var l=gr;Object.keys(l).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return l[f]}})});var m=yr;Object.keys(m).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return m[f]}})});var E=Fe;Object.keys(E).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return E[f]}})});var I=vr;Object.keys(I).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return I[f]}})});var x=mr;Object.keys(x).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return x[f]}})});var O=br;Object.keys(O).forEach(function(f){f==="default"||f==="__esModule"||Object.defineProperty(r,f,{enumerable:!0,get:function(){return O[f]}})})}(Fr);var Ci={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=function(){function b(g,w){for(var $=0;$<w.length;$++){var A=w[$];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(g,A.key,A)}}return function(g,w,$){return w&&b(g.prototype,w),$&&b(g,$),g}}(),t=Re;Object.keys(t).forEach(function(b){b==="default"||b==="__esModule"||Object.defineProperty(r,b,{enumerable:!0,get:function(){return t[b]}})}),r.config=m;var n=Pe,i=d(n),a=pe,o=d(a),u=Fr,c=h(u);function h(b){if(b&&b.__esModule)return b;var g={};if(b!=null)for(var w in b)Object.prototype.hasOwnProperty.call(b,w)&&(g[w]=b[w]);return g.default=b,g}function d(b){return b&&b.__esModule?b:{default:b}}function s(b,g){if(!(b instanceof g))throw new TypeError("Cannot call a class as a function")}function _(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 l(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 m(b){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(b){var w=new D(g);b(w),w.resolve()}return g}var E=function(b){l(g,b);function g(w){s(this,g);var $=_(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return $.name=w,$}return e(g,[{key:"resolve",value:function($){var A=$.definitions[this.name];return A.resolve($)}}]),g}(t.Reference),I=function(b){l(g,b);function g(w,$){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;s(this,g);var B=_(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return B.childReference=w,B.length=$,B.variable=A,B}return e(g,[{key:"resolve",value:function($){var A=this.childReference,B=this.length;return A instanceof t.Reference&&(A=A.resolve($)),B instanceof t.Reference&&(B=B.resolve($)),this.variable?new c.VarArray(A,B):new c.Array(A,B)}}]),g}(t.Reference),x=function(b){l(g,b);function g(w){s(this,g);var $=_(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return $.childReference=w,$.name=w.name,$}return e(g,[{key:"resolve",value:function($){var A=this.childReference;return A instanceof t.Reference&&(A=A.resolve($)),new c.Option(A)}}]),g}(t.Reference),O=function(b){l(g,b);function g(w,$){s(this,g);var A=_(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));return A.sizedType=w,A.length=$,A}return e(g,[{key:"resolve",value:function($){var A=this.length;return A instanceof t.Reference&&(A=A.resolve($)),new this.sizedType(A)}}]),g}(t.Reference),f=function(){function b(g,w,$){s(this,b),this.constructor=g,this.name=w,this.config=$}return e(b,[{key:"resolve",value:function(w){return this.name in w.results?w.results[this.name]:this.constructor(w,this.name,this.config)}}]),b}();function S(b,g,w){return w instanceof t.Reference&&(w=w.resolve(b)),b.results[g]=w,w}function P(b,g,w){return b.results[g]=w,w}var D=function(){function b(g){s(this,b),this._destination=g,this._definitions={}}return e(b,[{key:"enum",value:function(w,$){var A=new f(c.Enum.create,w,$);this.define(w,A)}},{key:"struct",value:function(w,$){var A=new f(c.Struct.create,w,$);this.define(w,A)}},{key:"union",value:function(w,$){var A=new f(c.Union.create,w,$);this.define(w,A)}},{key:"typedef",value:function(w,$){var A=new f(S,w,$);this.define(w,A)}},{key:"const",value:function(w,$){var A=new f(P,w,$);this.define(w,A)}},{key:"void",value:function(){return c.Void}},{key:"bool",value:function(){return c.Bool}},{key:"int",value:function(){return c.Int}},{key:"hyper",value:function(){return c.Hyper}},{key:"uint",value:function(){return c.UnsignedInt}},{key:"uhyper",value:function(){return c.UnsignedHyper}},{key:"float",value:function(){return c.Float}},{key:"double",value:function(){return c.Double}},{key:"quadruple",value:function(){return c.Quadruple}},{key:"string",value:function(w){return new O(c.String,w)}},{key:"opaque",value:function(w){return new O(c.Opaque,w)}},{key:"varOpaque",value:function(w){return new O(c.VarOpaque,w)}},{key:"array",value:function(w,$){return new I(w,$)}},{key:"varArray",value:function(w,$){return new I(w,$,!0)}},{key:"option",value:function(w){return new x(w)}},{key:"define",value:function(w,$){if((0,i.default)(this._destination[w]))this._definitions[w]=$;else throw new Error("XDRTypes Error:"+w+" is already defined")}},{key:"lookup",value:function(w){return new E(w)}},{key:"resolve",value:function(){var w=this;(0,o.default)(this._definitions,function($){$.resolve({definitions:w._definitions,results:w._destination})})}}]),b}()})(Ci),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Fr;Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[n]}})});var t=Ci;Object.keys(t).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[n]}})})}(wt);var ot=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)},C=(r,e,t)=>(ot(r,e,"read from private field"),t?t.call(r):e.get(r)),Q=(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)},st=(r,e,t,n)=>(ot(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),V=(r,e,t)=>(ot(r,e,"access private method"),t),G,H,De,ut,qi,ct,Ni,Sr,lt,_e,Ce,qe,Ar;function pw(r){const e={variantId:K.Uint64.fromString(r.variantId.toString()),version:r.version||Math.floor(Date.now()/1e3),items:r.items.map(n=>new K.BundleItem({collectionId:K.Uint64.fromString(n.collectionId.toString()),productId:K.Uint64.fromString(n.productId.toString()),variantId:K.Uint64.fromString(n.variantId.toString()),sku:n.sku||"",quantity:n.quantity,ext:new K.BundleItemExt(0)})),ext:new K.BundleExt(0)},t=new K.Bundle(e);return K.BundleEnvelope.envelopeTypeBundle(t).toXDR("base64")}const K=wt.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 _w{constructor(e,t){Q(this,ut),Q(this,ct),Q(this,Sr),Q(this,_e),Q(this,qe),Q(this,G,void 0),Q(this,H,void 0),Q(this,De,void 0),st(this,G,V(this,ut,qi).call(this,t)),st(this,De,V(this,ct,Ni).call(this,t)),st(this,H,e)}isInitialDataValid(){if(!C(this,De))throw"Bundle data does not exist for the given product.";if(!C(this,G))throw"Bundle settings do not exist for the given product.";if(!Array.isArray(C(this,H))||!C(this,H).length)throw"No bundle selection items provided.";return!0}isValidVariant(e){if(!C(this,G)?.variantsSettings[e])throw`The ${e} bundle variant is invalid.`;return!0}isSelectionInVariantRange(e){const t=C(this,H).reduce((i,a)=>i+a.quantity,0),n=C(this,G)?.variantsSettings[e].ranges||[];if(!V(this,Sr,lt).call(this,n,t))throw"The total number of products does not fall within the required variant range.";return!0}areItemsInMaxPerItemBound(){const e=C(this,G)?.bundleSettings.maxPerItem||0,t=C(this,H).filter(({quantity:n})=>n>e);if(e&&t.length)throw`The selected products (${V(this,_e,Ce).call(this,t.map(({externalProductId:n})=>n)).join(", ")}) exceed the maximum limit of ${e} items per product.`;return!0}areSelectedCollectionsValid(e){const t=C(this,G)?.variantsSettings[e]?.optionSources,n=C(this,H).filter(({collectionId:i})=>!t||!V(this,qe,Ar).call(this,t,i));if(n.length)throw`The collections (${V(this,_e,Ce).call(this,n.map(({collectionId:i})=>i)).join(", ")}) are no longer valid for the bundle variant (${e}).`;return!0}areItemsQuantitiesValidForTheCollection(e){const t=C(this,H).reduce((a,o)=>(a[o.collectionId]=o.quantity+(a[o.collectionId]||0),a),Object.create(null)),n=C(this,G)?.variantsSettings[e],i=Object.values(n?.optionSources||{}).filter(a=>{const o=t[a.collectionId]||0;return!V(this,Sr,lt).call(this,[a],o)});if(!n||i.length)throw`The selection exceeds the limits for the collections (${V(this,_e,Ce).call(this,i.map(({collectionId:a})=>a)).join(", ")}).`;return!0}areSelectedProductsValid(e){const t=C(this,G)?.variantsSettings[e]?.optionSources||{},n=Object.values(t).reduce((a,o)=>{const u=C(this,De)?.collections[o.collectionId];return u&&(a[o.collectionId]=u),a},Object.create(null));if(!Object.values(n).length)throw`No collections found for the bundle variant (${e}).`;const i=C(this,H).filter(({externalProductId:a,collectionId:o})=>V(this,qe,Ar).call(this,n,o)?!V(this,qe,Ar).call(this,n[o].products,a):!0);if(i.length)throw`The products (${V(this,_e,Ce).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}}G=new WeakMap,H=new WeakMap,De=new WeakMap,ut=new WeakSet,qi=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),Object.create(null)),ranges:i},t},Object.create(null))}}catch{return null}},ct=new WeakSet,Ni=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),Object.create(null))},t),Object.create(null));return{...r,collections:e}}catch{return null}},Sr=new WeakSet,lt=function(r,e){return!!r.filter(({min:t,max:n})=>{const i=t??e,a=n??e;return i<=e&&e<=a}).length},_e=new WeakSet,Ce=function(r){return Array.from(new Set(r))},qe=new WeakSet,Ar=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};const gw="/bundling-storefront-manager";function ki(r){return pw({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 yw(r){const e=q(),t=await ft(r);if(t!==!0)throw new Error(t);const n=ki(r);try{const i=await ee("post",`${gw}/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 vw(r,e){const t=await ft(e);if(t!==!0)throw new Error(t);const n=ki(e);try{const i=await v("post","/bundle_selections/bundle_id",{data:{bundle:n}},y(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 mw(r,e){const t=Ui(r);if(t!==!0)throw new Error(`Dynamic Bundle is invalid. ${t}`);const n=`${oe(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 ft(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 ww(r){try{const e=await ee("get",`/bundle-data/${T(r.externalProductId)}`);return{valid:new _w(r.selections,e).isBundleSelectionValid(r.externalVariantId)}}catch(e){return{valid:!1,error:String(e)}}}const bw={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 Ui(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=bw[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 Ew(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{bundle_selection:t}=await v("get","/bundle_selections",{id:e},y(r,"getBundleSelection"));return t}function $w(r,e){return v("get","/bundle_selections",{query:e},y(r,"listBundleSelections"))}async function Iw(r,e){const{bundle_selection:t}=await v("post","/bundle_selections",{data:e},y(r,"createBundleSelection"));return t}async function Sw(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{bundle_selection:n}=await v("put","/bundle_selections",{id:e,data:t},y(r,"updateBundleSelection"));return n}function Aw(r,e){if(e===void 0||e==="")throw new Error("ID is required");return v("delete","/bundle_selections",{id:e},y(r,"deleteBundleSelection"))}async function Ow(r,e,t,n){if(e===void 0||e==="")throw new Error("Purchase item ID is required");const{subscription:i}=await v("put","/bundles",{id:e,data:t,query:n},y(r,"updateBundle"));return i}var xw=Object.freeze({__proto__:null,createBundleSelection:Iw,deleteBundleSelection:Aw,getBundleId:yw,getBundleSelection:Ew,getBundleSelectionId:vw,getDynamicBundleItems:mw,listBundleSelections:$w,updateBundle:Ow,updateBundleSelection:Sw,validateBundle:ft,validateBundleSelection:ww,validateDynamicBundle:Ui});const Tw=r=>{const e=r.layout_settings.addons,t=r.layout_settings.crossSells,n=r.customization_window,i=r.layout_settings?.defaultVariantId??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}}},Pw=r=>r.tiered_discounts.length===0?null:{tiered_discounts:r.tiered_discounts},Or=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}))}),Bi=r=>({name:r.name,options:r.options.map(e=>({name:e.name,values:e.values})),selling_plans:r.selling_plans.map(Or)}),Li=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}),dt=r=>r==null||typeof r=="string"?r:"src"in r?r.src:null,Vi=r=>({id:String(r.id),title:r.title,description:r.description,available_for_sale:r.available,featured_image:dt(r.featured_image),images:r.images,requires_selling_plan:r.requires_selling_plan,selling_plan_groups:r.selling_plan_groups.map(Bi)}),ji=r=>{const e=Rw(r.selling_plan_groups);return{...Vi(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=>({...Li(t),selling_plan_allocations:t.selling_plan_allocations.map(n=>({price:n.price,compare_at_price:n.compare_at_price,selling_plan:Or(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:dt(t.featured_image),public_title:t.public_title,requires_selling_plan:t.requires_selling_plan}))}},Fw=({items_count:r,ranges:e})=>e.length>0?e.map(({quantity_max:t,quantity_min:n})=>({min:n,max:t})):[{min:r,max:r}],Rw=r=>r.reduce((e,t)=>(t.selling_plans.forEach(n=>{const i=`${t.id}-${n.id}`;e[i]=n}),e),{}),Mw=r=>Array.isArray(r)?r:[];function ht(r){const e=Tw(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:Or(o.selling_plan)})),ranges:Fw(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:dt(o.variant.featured_image),sku:o.sku||""}})),position:i}}),selling_plan_groups:r.selling_plan_groups.map(Bi),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(ji)}),n),{}),addons:r.addons.products.length?{collection_id:e.addons?.collection_id||"",collection_handle:e.addons?.collection_handle||"",products:r.addons.products.map(n=>({...Vi(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=>({...Li(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:Or(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(ji)}:null,incentives:Pw(r.incentives),filters:Mw(r.filters),templates:r.bundle_settings.layout_settings.templates||null,globalStyles:r.bundle_settings.layout_settings.globalStyles||null}}async function Dw(r,e){return e?.source==="shopify_storefront"?qw():Cw(r,e?.country_code)}async function Cw(r,e){const{appName:t,appVersion:n}=q(),i={"X-Recharge-Sdk-Fn":"loadFromOnlineStore","X-Recharge-Sdk-Version":"2.0.0",...t?{"X-Recharge-Sdk-App-Name":t}:{},...n?{"X-Recharge-Sdk-App-Version":n}:{}};if(!e){const o=await ee("get",`/bundle-data/${T(r)}`,{headers:i});return ht(o)}const a=new FormData;a.append("form_type","localization"),a.append("_method","put"),a.append("return_to",`${vt}/bundle-data/${r}`),a.append("country_code",e);try{const o=await L("post","/localization",{headers:{"Content-Type":"multipart/form-data",...i},data:a});return ht(o)}catch{const o=await ee("get",`/bundle-data/${T(r)}`,{headers:i});return ht(o)}}async function qw(r,e){if(!q().storeIdentifier)throw new Error("Store identifier is required for Shopify Storefront API requests");return{}}var Nw=Object.freeze({__proto__:null,loadBundleData:Dw});function kw(r){try{return JSON.parse(r)}catch{return r}}function Uw(r){return Object.entries(r).reduce((e,[t,n])=>({...e,[t]:kw(n)}),{})}const Xi=r=>typeof r=="string"?r!=="0"&&r!=="false":!!r;function pt(r,e){const t=new Set(e),n={};for(const i of Object.keys(r))t.has(i)||(n[i]=r[i]);return n}function Gi(r){const e=Uw(r),t=e.auto_inject===void 0?!0:e.auto_inject,n=e.display_on??[],i=e.first_option==="autodeliver";return{...pt(e,["display_on","first_option"]),auto_inject:t,valid_pages:n,is_subscription_first:i,autoInject:t,validPages:n,isSubscriptionFirst:i}}function Hi(r){const e=r.subscription_options?.storefront_purchase_options==="subscription_only";return{...r,is_subscription_only:e,isSubscriptionOnly:e}}function Bw(r){return r.map(e=>{const t={};return Object.entries(e).forEach(([n,i])=>{Object.defineProperty(t,n,{value:Hi(i),enumerable:!0,writable:!0,configurable:!0})}),t})}const _t="2020-12",Lw={store_currency:{currency_code:"USD",currency_symbol:"$",decimal_separator:".",thousands_separator:",",currency_symbol_location:"left"}},Ne=new Map;function xr(r,e){return Ne.has(r)||Ne.set(r,e()),Ne.get(r)}async function gt(r,e){if(r===void 0||r==="")throw new Error("ID is required");const t=e?.version??"2020-12",{product:n}=await xr(`product.${r}.${t}`,()=>ke("get",`/product/${t}/${T(r)}.json`));return t==="2020-12"?Hi(n):n}async function Wi(){return await xr("storeSettings",()=>ke("get",`/${_t}/store_settings.json`).catch(()=>Lw))}async function zi(){const{widget_settings:r}=await xr("widgetSettings",()=>ke("get",`/${_t}/widget_settings.json`));return Gi(r)}async function Yi(){const{products:r,widget_settings:e,store_settings:t,meta:n}=await xr("productsAndSettings",()=>ke("get",`/product/${_t}/products.json`));return n?.status==="error"?Promise.reject(n.message):{products:Bw(r),widget_settings:Gi(e),store_settings:t??{}}}async function Vw(){const{products:r}=await Yi();return r}async function jw(r){const[e,t,n]=await Promise.all([gt(r),Wi(),zi()]);return{product:e,store_settings:t,widget_settings:n,storeSettings:t,widgetSettings:n}}async function Xw(r){const{bundle_product:e}=await gt(r);return e}async function Ki(){return Array.from(Ne.keys()).forEach(r=>Ne.delete(r))}var Gw=Object.freeze({__proto__:null,getCDNBundleSettings:Xw,getCDNProduct:gt,getCDNProductAndSettings:jw,getCDNProducts:Vw,getCDNProductsAndSettings:Yi,getCDNStoreSettings:Wi,getCDNWidgetSettings:zi,resetCDNCache:Ki});async function Hw(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await v("get","/charges",{id:e,query:{include:t?.include}},y(r,"getCharge"));return n}function Ww(r,e){return v("get","/charges",{query:e},y(r,"listCharges"))}async function zw(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await v("post",`/charges/${T(e)}/apply_discount`,{data:{discount_code:t}},y(r,"applyDiscountToCharge"));return n}async function Yw(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{charge:t}=await v("post",`/charges/${T(e)}/remove_discount`,{},y(r,"removeDiscountsFromCharge"));return t}async function Kw(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 v("post",`/charges/${T(e)}/skip`,{query:n,data:{purchase_item_ids:t.map(a=>Number(a))}},y(r,"skipCharge"));return i}async function Zw(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 v("post",`/charges/${T(e)}/unskip`,{query:n,data:{purchase_item_ids:t.map(a=>Number(a))}},y(r,"unskipCharge"));return i}async function Jw(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{charge:t}=await v("post",`/charges/${T(e)}/process`,{},y(r,"processCharge"));return t}async function Qw(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await v("post",`/charges/${T(e)}/change_next_charge_date`,{data:{next_charge_date:t}},y(r,"rescheduleCharge"));return n}var e0=Object.freeze({__proto__:null,applyDiscountToCharge:zw,getCharge:Hw,listCharges:Ww,processCharge:Jw,removeDiscountsFromCharge:Yw,rescheduleCharge:Qw,skipCharge:Kw,unskipCharge:Zw});async function Zi(r,e){if(!["2020-12","2022-06"].includes(e.format_version))throw new Error("Missing or unsupported format_version.");return v("get","/product_search",{query:e,headers:{"X-Recharge-Version":"2021-01"}},y(r,"productSearch"))}var r0=Object.freeze({__proto__:null,productSearch:Zi});async function Ji(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{collection:t}=await v("get","/collections",{id:e},y(r,"getCollection"));return t}function t0(r,e){return v("get","/collections",{query:e},y(r,"listCollections"))}async function n0(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=y(r,"listCollectionProducts"),[{sort_order:i,manual_sort_order:a},{products:o}]=await Promise.all([Ji(n,e),Zi(n,{...t,collection_ids:[e],limit:250})]);if(i==="manual")return{products:a.reduce((u,c)=>{const h=o.find(d=>d.external_product_id===c);return h&&u.push(h),u},[])};{const u=i0(i);return{products:o.slice().sort(u)}}}function Qi(r,e){const t=r.external_created_at,n=e.external_created_at;return t<n?-1:n>t?1:0}function ea(r,e){const t=r.external_product_id,n=e.external_product_id;return t<n?-1:n>t?1:0}function ra(r,e){const t=r.title.toLowerCase(),n=e.title.toLowerCase();return t<n?-1:n>t?1:0}function i0(r){switch(r){case"created_at-asc":return Qi;case"created_at-desc":return(e,t)=>Qi(t,e);case"id-asc":return ea;case"id-desc":return(e,t)=>ea(t,e);case"title-asc":return ra;case"title-desc":return(e,t)=>ra(t,e)}}var a0=Object.freeze({__proto__:null,getCollection:Ji,listCollectionProducts:n0,listCollections:t0});async function o0(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await v("get","/customers",{id:t,query:{include:e?.include}},y(r,"getCustomer"));return n}async function ta(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await v("put","/customers",{id:t,data:e},y(r,"updateCustomer"));return n}async function s0(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{deliveries:n}=await v("get",`/customers/${T(t)}/delivery_schedule`,{query:e},y(r,"getDeliverySchedule"));return n}async function Tr(r,e){return v("get","/portal_access",{query:e},y(r,"getCustomerPortalAccess"))}async function u0(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 Tr(y(r,"getActiveChurnLandingPageURL"));return`${n.replace("portal","pages")}${i}/subscriptions/${e}/cancel?token=${a}&subscription=${e}&redirect_to=${encodeURIComponent(t)}`}async function c0(r){const{base_url:e,customer_hash:t,temp_token:n}=await Tr(y(r,"getFailedPaymentMethodRecoveryLandingPageURL"));return`${e.replace("portal","pages")}account/payment-methods?token=${n}&hash=${t}`}async function l0(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 Tr(y(r,"getGiftRedemptionLandingPageURL"));return`${n.replace("portal","pages")}${i}/gifts/${e}?token=${a}&redirect_to=${encodeURIComponent(t)}`}const na={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 f0(r,e,t){const n=r.customerId;if(!n)throw new Error("Not logged in.");if(!Object.prototype.hasOwnProperty.call(na,e))throw new Error("Notification not supported.");const i=na[e];return v("post",`/customers/${T(n)}/notifications`,{data:{...i,template_vars:t}},y(r,"sendCustomerNotification"))}async function d0(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{credit_summary:n}=await v("get",`/customers/${T(t)}/credit_summary`,{query:{include:e?.include}},y(r,"getCreditSummary"));return n}var h0=Object.freeze({__proto__:null,getActiveChurnLandingPageURL:u0,getCreditSummary:d0,getCustomer:o0,getCustomerPortalAccess:Tr,getDeliverySchedule:s0,getFailedPaymentMethodRecoveryLandingPageURL:c0,getGiftRedemptionLandingPageURL:l0,sendCustomerNotification:f0,updateCustomer:ta});async function p0(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{credit_summary:n}=await v("get",`/customers/${T(t)}/credit_summary`,{query:{include:e?.include,presentment_currency_code:e?.presentment_currency_code}},y(r,"getCreditSummary"));return n}function _0(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),ta(y(r,"setApplyCreditsToNextCharge"),t)}async function g0(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer_id:n,...i}=e??{};return await v("get","/credit_accounts",{query:{...i,customer_id:t}},y(r,"listCreditAccounts"))}var y0=Object.freeze({__proto__:null,getCreditSummary:p0,listCreditAccounts:g0,setApplyCreditsToNextCharge:_0});async function v0(r,e,t){return await v("post","/customer_surveys/cancellation_prevention",{data:{customer_id:e,subscription_id:t}},y(r,"getCustomerSurveyReasons"))}async function m0(r,e,t,n){return await v("post",`/customer_surveys/${T(t)}/customer_response`,{data:{customer_id:e,response_id:n}},y(r,"getCustomerSurveyOffers"))}async function w0(r,e){return await v("post","/offers/claim",{data:e},y(r,"claimOfferCustomerSurvey")),{}}var b0=Object.freeze({__proto__:null,claimOfferCustomerSurvey:w0,getCustomerSurveyOffers:m0,getCustomerSurveyReasons:v0});function E0(r,e){if(!r.customerId)throw new Error("Not logged in.");return v("get","/gift_purchases",{query:e},y(r,"listGiftPurchases"))}async function $0(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 v("get","/gift_purchases",{id:e},y(r,"getGiftPurchase"));return t}var I0=Object.freeze({__proto__:null,getGiftPurchase:$0,listGiftPurchases:E0});function S0(r,e){if(!r.customerId)throw new Error("Not logged in.");return v("get","/incentives/tiered_discounts",{query:e},y(r,"listTieredDiscounts"))}async function A0(r,e){if(!r.customerId)throw new Error("Not logged in.");if(e===void 0||e==="")throw new Error("ID is required");const{tiered_discount:t}=await v("get",`/incentives/tiered_discounts/${T(e)}`,{},y(r,"getTieredDiscount"));return t}function O0(r,e){return v("post","/incentives/tiered_discounts/offers",{data:e},y(r,"getTieredDiscountOffers"))}var x0=Object.freeze({__proto__:null,getTieredDiscount:A0,getTieredDiscountOffers:O0,listTieredDiscounts:S0});async function T0(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{membership:t}=await v("get","/memberships",{id:e},y(r,"getMembership"));return t}function P0(r,e){return v("get","/memberships",{query:e},y(r,"listMemberships"))}async function F0(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await v("post",`/memberships/${T(e)}/cancel`,{data:t},y(r,"cancelMembership"));return n}async function R0(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await v("post",`/memberships/${T(e)}/activate`,{data:t},y(r,"activateMembership"));return n}async function M0(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership:n}=await v("post",`/memberships/${T(e)}/change`,{data:t},y(r,"changeMembership"));return n}var D0=Object.freeze({__proto__:null,activateMembership:R0,cancelMembership:F0,changeMembership:M0,getMembership:T0,listMemberships:P0});async function C0(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{membership_program:n}=await v("get","/membership_programs",{id:e,query:{include:t?.include}},y(r,"getMembershipProgram"));return n}function q0(r,e){return v("get","/membership_programs",{query:e},y(r,"listMembershipPrograms"))}var N0=Object.freeze({__proto__:null,getMembershipProgram:C0,listMembershipPrograms:q0});async function k0(r,e){const{metafield:t}=await v("post","/metafields",{data:{metafield:e}},y(r,"createMetafield"));return t}async function U0(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{metafield:n}=await v("put","/metafields",{id:e,data:{metafield:t}},y(r,"updateMetafield"));return n}function B0(r,e){if(e===void 0||e==="")throw new Error("ID is required");return v("delete","/metafields",{id:e},y(r,"deleteMetafield"))}var L0=Object.freeze({__proto__:null,createMetafield:k0,deleteMetafield:B0,updateMetafield:U0});async function V0(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{onetime:t}=await v("get","/onetimes",{id:e},y(r,"getOnetime"));return t}function j0(r,e){return v("get","/onetimes",{query:e},y(r,"listOnetimes"))}async function X0(r,e){const{onetime:t}=await v("post","/onetimes",{data:e},y(r,"createOnetime"));return t}async function G0(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{onetime:n}=await v("put","/onetimes",{id:e,data:t},y(r,"updateOnetime"));return n}function H0(r,e){if(e===void 0||e==="")throw new Error("ID is required");return v("delete","/onetimes",{id:e},y(r,"deleteOnetime"))}var W0=Object.freeze({__proto__:null,createOnetime:X0,deleteOnetime:H0,getOnetime:V0,listOnetimes:j0,updateOnetime:G0});async function z0(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{order:t}=await v("get","/orders",{id:e},y(r,"getOrder"));return t}function Y0(r,e){return v("get","/orders",{query:e},y(r,"listOrders"))}async function K0(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{order:t}=await v("post",`/orders/${T(e)}/delay`,{},y(r,"delayOrder"));return t}var Z0=Object.freeze({__proto__:null,delayOrder:K0,getOrder:z0,listOrders:Y0});async function J0(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 Q0(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{payment_method:n}=await v("get","/payment_methods",{id:e,query:{include:t?.include}},y(r,"getPaymentMethod"));return n}async function ia(r,e){const{payment_method:t}=await v("post","/payment_methods",{data:{...e,customer_id:r.customerId}},y(r,"createPaymentMethod"));return t}async function eb(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{payment_method:n}=await v("put","/payment_methods",{id:e,data:t},y(r,"updatePaymentMethod"));return n}function rb(r,e){return v("get","/payment_methods",{query:e},y(r,"listPaymentMethods"))}async function tb(r,e){const t=await nb(r,e),n=t.external.environment_key,i=t.payment_method_intent_id,a=t.external_customer_id.ecommerce,o=t.external.resource_url,u=t.external.integrity_hash,c=t.payment_method?.processor_payment_method_token;await J0(o,u);let h=!1,d=null,s=null,_=null;return{mount(l,m){if(typeof window>"u"||!window.Spreedly)throw new Error("Payment script failed to load");window.Spreedly.init(n,{numberEl:l.numberElementId,cvvEl:l.cvvElementId}),window.Spreedly.on("ready",()=>{h=!0,l.styles&&(window.Spreedly.setStyle("number",l.styles),window.Spreedly.setStyle("cvv",l.styles)),l.numberLabel&&window.Spreedly.setLabel("number",l.numberLabel),l.cvvLabel&&window.Spreedly.setLabel("cvv",l.cvvLabel),l.numberPlaceholder&&window.Spreedly.setPlaceholder("number",l.numberPlaceholder),l.cvvPlaceholder&&window.Spreedly.setPlaceholder("cvv",l.cvvPlaceholder),l.numberFormat==="plainFormat"?(l.numberFieldType&&window.Spreedly.setFieldType("number",l.numberFieldType),l.cvvFieldType&&window.Spreedly.setFieldType("cvv",l.cvvFieldType),window.Spreedly.setNumberFormat("plainFormat")):l.numberFormat==="maskedFormat"?(window.Spreedly.setFieldType("cvv","text"),window.Spreedly.setFieldType("number","text"),window.Spreedly.setNumberFormat("maskedFormat")):l.numberFormat==="prettyFormat"?(l.numberFieldType==="text"||l.numberFieldType==="tel"?window.Spreedly.setFieldType("number",l.numberFieldType):window.Spreedly.setFieldType("number","tel"),l.cvvFieldType==="text"||l.cvvFieldType==="tel"?window.Spreedly.setFieldType("cvv",l.cvvFieldType):window.Spreedly.setFieldType("cvv","tel"),window.Spreedly.setNumberFormat("prettyFormat")):(l.numberFieldType&&window.Spreedly.setFieldType("number",l.numberFieldType),l.cvvFieldType&&window.Spreedly.setFieldType("cvv",l.cvvFieldType)),m?.onReady?.()}),window.Spreedly.on("fieldEvent",(E,I,x,O)=>{m?.onFieldEvent?.(E,I,x,O)}),window.Spreedly.on("errors",E=>{m?.onErrors?.(E)}),window.Spreedly.on("paymentMethod",(E,I)=>{d=E,m?.onPaymentMethod?.(E,I),s&&(d=null,s(E),s=null)})},tokenize(l){if(!h||!window.Spreedly)throw new Error("Payment form is not initialized");let m=String(l.year);m.length===2&&(m=`20${m}`);const E=String(l.month).padStart(2,"0");"full_name"in l?window.Spreedly.tokenizeCreditCard({full_name:l.full_name,month:E,year:m}):window.Spreedly.tokenizeCreditCard({first_name:l.first_name,last_name:l.last_name,month:E,year:m})},async submit(l){if(!h)throw new Error("Payment form is not initialized");if(d){const m=d;return d=null,aa(r,m,l,{external_payment_method_id:c,payment_method_intent_id:i,external_customer_id:a})}return new Promise((m,E)=>{_=l,s=async I=>{try{const x=await aa(r,I,_,{external_payment_method_id:c,payment_method_intent_id:i,external_customer_id:a});m(x)}catch(x){E(x)}finally{_=null}},this.tokenize(l.card_details)})},reset(){window.Spreedly&&window.Spreedly.reload(),d=null,s=null,_=null},unmount(){window.Spreedly&&window.Spreedly.removeHandlers(),h=!1,d=null,s=null,_=null},addEventHandlers(l){l.onReady&&window.Spreedly.on("ready",l.onReady),l.onFieldEvent&&window.Spreedly.on("fieldEvent",l.onFieldEvent),l.onErrors&&window.Spreedly.on("errors",l.onErrors),l.onPaymentMethod&&window.Spreedly.on("paymentMethod",l.onPaymentMethod)},removeHandlers(){window.Spreedly&&window.Spreedly.removeHandlers()},setFieldType(l,m){window.Spreedly.setFieldType(l,m)},setLabel(l,m){window.Spreedly.setLabel(l,m)},setNumberFormat(l){window.Spreedly.setNumberFormat(l)},setPlaceholder(l,m){window.Spreedly.setPlaceholder(l,m)},setStyle(l,m){window.Spreedly.setStyle(l,m)}}}async function nb(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");return await v("post","/payment_method_intents",{data:{customer_id:t,payment_method_id:e}},y(r,"createFrictionlessPaymentIntentV1"))}async function aa(r,e,{billing_address:t,default_payment_method:n,address_ids:i,apply_to_all_subscription_addresses:a},{external_payment_method_id:o,payment_method_intent_id:u,external_customer_id:c}){return await ia(y(r,"submitFrictionlessPaymentMethodV1"),{default:n??!1,payment_type:"CREDIT_CARD",processor_customer_token:c.toString(),processor_name:"frictionless",processor_payment_method_token:e,billing_address:t,payment_method_intent_id:u,address_ids:i,external_payment_method_id:o,apply_to_all_subscription_addresses:a})}var ib=Object.freeze({__proto__:null,createPaymentMethod:ia,getPaymentMethod:Q0,initFrictionlessPaymentV1:tb,listPaymentMethods:rb,updatePaymentMethod:eb});async function ab(r,e){if(e===void 0||e==="")throw new Error("ID is required");const{plan:t}=await v("get","/plans",{id:e},y(r,"getPlan"));return t}function ob(r,e){return v("get","/plans",{query:e},y(r,"listPlans"))}var sb=Object.freeze({__proto__:null,getPlan:ab,listPlans:ob});async function ub(r,e){return await v("get","/shop/shipping_countries",{query:e,headers:{"X-Recharge-Version":"2021-01"}},y(r,"getShippingCountries"))}async function cb(r){return await v("get","/shop/settings",{headers:{"X-Recharge-Version":"2021-01"}},y(r,"getStoreSettings"))}var lb=Object.freeze({__proto__:null,getShippingCountries:ub,getStoreSettings:cb});function fb(r,e){return{...pt(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 db(r,e){return{...pt(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 oa(r){const{id:e,address_id:t,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:u,charge_interval_frequency:c,created_at:h,expire_after_specific_number_of_charges:d,shopify_product_id:s,shopify_variant_id:_,has_queued_charges:l,is_prepaid:m,is_skippable:E,is_swappable:I,max_retries_reached:x,next_charge_scheduled_at:O,order_day_of_month:f,order_day_of_week:S,order_interval_frequency:P,order_interval_unit:D,presentment_currency:b,price:g,product_title:w,properties:$,quantity:A,sku:B,sku_override:Fb,status:Rb,updated_at:Mb,variant_title:Db}=r;return{id:e,address_id:t,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:u,charge_interval_frequency:parseInt(c,10),created_at:h,expire_after_specific_number_of_charges:d,external_product_id:{ecommerce:`${s}`},external_variant_id:{ecommerce:`${_}`},has_queued_charges:Xi(l),is_prepaid:m,is_skippable:E,is_swappable:I,max_retries_reached:Xi(x),next_charge_scheduled_at:O,order_day_of_month:f,order_day_of_week:S,order_interval_frequency:parseInt(P,10),order_interval_unit:D,presentment_currency:b,price:`${g}`,product_title:w??"",properties:$,quantity:A,sku:B,sku_override:Fb,status:Rb.toLowerCase(),updated_at:Mb,variant_title:Db}}async function hb(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:n}=await v("get","/subscriptions",{id:e,query:{include:t?.include}},y(r,"getSubscription"));return n}function pb(r,e){return v("get","/subscriptions",{query:e},y(r,"listSubscriptions"))}function _b(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");return v("get",`/subscriptions/${T(e)}/addons`,{query:t},y(r,"listSubscriptionAddons"))}async function gb(r,e,t){const{subscription:n}=await v("post","/subscriptions",{data:e,query:t},y(r,"createSubscription"));return n}async function yb(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:i}=await v("put","/subscriptions",{id:e,data:t,query:n},y(r,"updateSubscription"));return i}async function vb(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:i}=await v("post",`/subscriptions/${T(e)}/set_next_charge_date`,{data:{date:t},query:n},y(r,"updateSubscriptionChargeDate"));return i}async function mb(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:n}=await v("post",`/subscriptions/${T(e)}/change_address`,{data:{address_id:t}},y(r,"updateSubscriptionAddress"));return n}async function wb(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:i}=await v("post",`/subscriptions/${T(e)}/cancel`,{data:t,query:n},y(r,"cancelSubscription"));return i}async function bb(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{subscription:n}=await v("post",`/subscriptions/${T(e)}/activate`,{query:t},y(r,"activateSubscription"));return n}async function Eb(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await v("post",`/subscriptions/${T(e)}/charges/skip`,{data:{date:t,subscription_id:`${e}`}},y(r,"skipSubscriptionCharge"));return n}async function $b(r,e,t){if(e===void 0||e.length===0)throw new Error("Subscription IDs are required");const{onetimes:n}=await v("post","/purchase_items/skip_gift",{data:{purchase_item_ids:e.map(Number),recipient_address:t}},y(r,"skipGiftSubscriptionCharge"));return n}async function Ib(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(h=>h.address_id===a))throw new Error("All subscriptions must have the same address_id.");const o=e.map(h=>fb(i,h));let u;t?.allow_onetimes!==void 0&&(u={allow_onetimes:t.allow_onetimes});const{subscriptions:c}=await v("post",`/addresses/${T(a)}/subscriptions-bulk`,{data:{subscriptions:o,commit_update:!!t?.commit},headers:{"X-Recharge-Version":"2021-01"},query:u},y(r,"createSubscriptions"));return c.map(oa)}async function Sb(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=!!n?.force_update,u=t.map(d=>db(o,d));let c;n?.allow_onetimes!==void 0&&(c={allow_onetimes:n.allow_onetimes});const{subscriptions:h}=await v("put",`/addresses/${T(e)}/subscriptions-bulk`,{data:{subscriptions:u,commit_update:!!n?.commit},headers:{"X-Recharge-Version":"2021-01"},query:c},y(r,"updateSubscriptions"));return h.map(oa)}async function Ab(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 v("delete",`/addresses/${T(e)}/subscriptions-bulk`,{data:{subscriptions:t,send_email:!!n?.send_email,commit_update:!!n?.commit},headers:{"X-Recharge-Version":"2021-01"},query:o},y(r,"deleteSubscriptions"))}var Ob=Object.freeze({__proto__:null,activateSubscription:bb,cancelSubscription:wb,createSubscription:gb,createSubscriptions:Ib,deleteSubscriptions:Ab,getSubscription:hb,listSubscriptionAddons:_b,listSubscriptions:pb,skipGiftSubscriptionCharge:$b,skipSubscriptionCharge:Eb,updateSubscription:yb,updateSubscriptionAddress:mb,updateSubscriptionChargeDate:vb,updateSubscriptions:Sb});const xb={get(r,e){return L("get",r,e)},post(r,e){return L("post",r,e)},put(r,e){return L("put",r,e)},delete(r,e){return L("delete",r,e)}};function Tb(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 Pb(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.");ua({storeIdentifier:Tb(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}),Ki()}const sa={init:Pb,api:xb,address:Ea,auth:Ra,bundle:xw,bundleData:Nw,charge:e0,cdn:Gw,collection:a0,credit:y0,customer:h0,customerSurveys:b0,gift:I0,tieredDiscount:x0,membership:D0,membershipProgram:N0,metafield:L0,onetime:W0,order:Z0,paymentMethod:ib,plan:sb,product:r0,store:lb,subscription:Ob};try{sa.init()}catch{}return sa});