@rechargeapps/storefront-client 1.34.1 → 1.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/auth.js +1 -1
- package/dist/cjs/utils/request.js +2 -1
- package/dist/cjs/utils/request.js.map +1 -1
- package/dist/esm/api/auth.js +1 -1
- package/dist/esm/utils/request.js +2 -1
- package/dist/esm/utils/request.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/umd/recharge-client.min.js +2 -2
- package/package.json +1 -1
package/dist/cjs/api/auth.js
CHANGED
|
@@ -181,7 +181,7 @@ async function rechargeAdminRequest(method, url, { id, query, data, headers } =
|
|
|
181
181
|
...storefrontAccessToken ? { "X-Recharge-Storefront-Access-Token": storefrontAccessToken } : {},
|
|
182
182
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
183
183
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
184
|
-
"X-Recharge-Sdk-Version": "1.
|
|
184
|
+
"X-Recharge-Sdk-Version": "1.35.0",
|
|
185
185
|
...headers ? headers : {}
|
|
186
186
|
};
|
|
187
187
|
return request.request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
|
|
@@ -41,8 +41,9 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
|
|
|
41
41
|
"X-Recharge-Sdk-Fn": session.internalFnCall,
|
|
42
42
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
43
43
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
44
|
-
"X-Recharge-Sdk-Version": "1.
|
|
44
|
+
"X-Recharge-Sdk-Version": "1.35.0",
|
|
45
45
|
"X-Request-Id": session.internalRequestId,
|
|
46
|
+
...session.tmp_fn_identifier ? { "X-Recharge-Sdk-Fn-Identifier": session.tmp_fn_identifier } : {},
|
|
46
47
|
...headers ? headers : {}
|
|
47
48
|
};
|
|
48
49
|
const localQuery = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sources":["../../../src/utils/request.ts"],"sourcesContent":["import 'isomorphic-fetch';\n\nimport { nanoid } from 'nanoid/non-secure';\nimport stringify from 'qs/lib/stringify';\n\nimport { Method, RequestHeaders, RequestOptions, InternalSession, Session } from '../types';\nimport { getOptions } from './options';\nimport { RECHARGE_API_URL, RECHARGE_CDN_URL, SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { RechargeRequestError } from './error';\n\nfunction stringifyQuery(str: unknown): string {\n return stringify(str, {\n encode: false,\n indices: false,\n arrayFormat: 'comma',\n });\n}\n\n/** @internal */\nexport function getInternalSession(session: Session | InternalSession, fnName: string): InternalSession {\n return {\n ...session,\n internalFnCall: (session as InternalSession).internalFnCall ?? fnName,\n internalRequestId: (session as InternalSession).internalRequestId ?? nanoid(),\n };\n}\n\nexport async function cdnRequest<T>(method: Method, url: string, requestOptions: RequestOptions = {}): Promise<T> {\n const opts = getOptions();\n return request(method, `${RECHARGE_CDN_URL(opts.environment)}/store/${opts.storeIdentifier}${url}`, requestOptions);\n}\n\nexport async function rechargeApiRequest<T>(\n method: Method,\n url: string,\n { id, query, data, headers }: RequestOptions = {},\n session: InternalSession\n): Promise<T> {\n const { environment, environmentUri, storeIdentifier, loginRetryFn, appName, appVersion } = getOptions();\n if (!storeIdentifier) {\n throw new Error('InitRecharge has not been called and/or no store identifier has been defined.');\n }\n const token = session.apiToken;\n if (!token) {\n throw new Error('No API token defined on session.');\n }\n const rechargeBaseUrl = RECHARGE_API_URL(environment, environmentUri);\n const reqHeaders: RequestHeaders = {\n 'X-Recharge-Access-Token': token,\n 'X-Recharge-Version': '2021-11',\n 'X-Recharge-Sdk-Fn': session.internalFnCall,\n ...(appName ? { 'X-Recharge-Sdk-App-Name': appName } : {}),\n ...(appVersion ? { 'X-Recharge-Sdk-App-Version': appVersion } : {}),\n 'X-Recharge-Sdk-Version': '__SDK_VERSION__',\n 'X-Request-Id': session.internalRequestId,\n ...(headers ? headers : {}),\n };\n\n const localQuery = {\n shop_url: storeIdentifier,\n ...(query as any),\n };\n\n try {\n // await to catch any errors\n return await request<T>(method, `${rechargeBaseUrl}${url}`, { id, query: localQuery, data, headers: reqHeaders });\n } catch (error: unknown) {\n if (loginRetryFn && error instanceof RechargeRequestError && error.status === 401) {\n // call loginRetryFn and retry request on 401\n return loginRetryFn().then(session => {\n if (session) {\n return request(method, `${rechargeBaseUrl}${url}`, {\n id,\n query: localQuery,\n data,\n headers: {\n ...reqHeaders,\n 'X-Recharge-Access-Token': session.apiToken,\n },\n });\n }\n throw error;\n });\n }\n throw error;\n }\n}\n\nexport async function shopifyAppProxyRequest<T>(\n method: Method,\n url: string,\n requestOptions: RequestOptions = {}\n): Promise<T> {\n return request(method, `${SHOPIFY_APP_PROXY_URL}${url}`, requestOptions);\n}\n\nexport async function request<T>(\n method: Method,\n url: string,\n { id, query, data, headers }: RequestOptions = {}\n): Promise<T> {\n let reqUrl = url.trim();\n\n if (id) {\n reqUrl = [reqUrl, `${id}`.trim()].join('/');\n }\n\n if (query) {\n let exQuery;\n [reqUrl, exQuery] = reqUrl.split('?');\n const fullQuery = [exQuery, stringifyQuery(query)].join('&').replace(/^&/, '');\n reqUrl = `${reqUrl}${fullQuery ? `?${fullQuery}` : ''}`;\n }\n\n let reqBody;\n if (data && method !== 'get') {\n reqBody = JSON.stringify(data);\n }\n\n const reqHeaders: RequestHeaders = {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'X-Recharge-App': 'storefront-client',\n ...(headers ? headers : {}),\n };\n\n const response = await fetch(reqUrl, {\n method,\n headers: reqHeaders,\n body: reqBody,\n });\n\n let result;\n try {\n result = await response.json();\n } catch (e) {\n // If we get here, it means we were a no content response.\n }\n\n if (!response.ok) {\n if (result && result.error) {\n throw new RechargeRequestError(result.error, response.status);\n } else if (result && result.errors) {\n throw new RechargeRequestError(JSON.stringify(result.errors), response.status);\n } else {\n throw new RechargeRequestError('A connection error occurred while making the request');\n }\n }\n\n return result as T;\n}\n"],"names":["nanoid","getOptions","RECHARGE_CDN_URL","RECHARGE_API_URL","error","RechargeRequestError","session","SHOPIFY_APP_PROXY_URL"],"mappings":";;;;;;;;;AAUA,SAAS,eAAe,GAAsB,EAAA;AAC5C,EAAA,OAAO,UAAU,GAAK,EAAA;AAAA,IACpB,MAAQ,EAAA,KAAA;AAAA,IACR,OAAS,EAAA,KAAA;AAAA,IACT,WAAa,EAAA,OAAA;AAAA,GACd,CAAA,CAAA;AACH,CAAA;AAGgB,SAAA,kBAAA,CAAmB,SAAoC,MAAiC,EAAA;AACtG,EAAO,OAAA;AAAA,IACL,GAAG,OAAA;AAAA,IACH,cAAA,EAAiB,QAA4B,cAAkB,IAAA,MAAA;AAAA,IAC/D,iBAAA,EAAoB,OAA4B,CAAA,iBAAA,IAAqBA,gBAAO,EAAA;AAAA,GAC9E,CAAA;AACF,CAAA;AAEA,eAAsB,UAAc,CAAA,MAAA,EAAgB,GAAa,EAAA,cAAA,GAAiC,EAAgB,EAAA;AAChH,EAAA,MAAM,OAAOC,kBAAW,EAAA,CAAA;AACxB,EAAA,OAAO,OAAQ,CAAA,MAAA,EAAQ,CAAG,EAAAC,oBAAA,CAAiB,IAAK,CAAA,WAAW,CAAC,CAAA,OAAA,EAAU,IAAK,CAAA,eAAe,CAAG,EAAA,GAAG,IAAI,cAAc,CAAA,CAAA;AACpH,CAAA;AAEsB,eAAA,kBAAA,CACpB,MACA,EAAA,GAAA,EACA,EAAE,EAAA,EAAI,KAAO,EAAA,IAAA,EAAM,OAAQ,EAAA,GAAoB,EAAC,EAChD,OACY,EAAA;AACZ,EAAM,MAAA,EAAE,aAAa,cAAgB,EAAA,eAAA,EAAiB,cAAc,OAAS,EAAA,UAAA,KAAeD,kBAAW,EAAA,CAAA;AACvG,EAAA,IAAI,CAAC,eAAiB,EAAA;AACpB,IAAM,MAAA,IAAI,MAAM,+EAA+E,CAAA,CAAA;AAAA,GACjG;AACA,EAAA,MAA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';\n\nimport { nanoid } from 'nanoid/non-secure';\nimport stringify from 'qs/lib/stringify';\n\nimport { Method, RequestHeaders, RequestOptions, InternalSession, Session } from '../types';\nimport { getOptions } from './options';\nimport { RECHARGE_API_URL, RECHARGE_CDN_URL, SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { RechargeRequestError } from './error';\n\nfunction stringifyQuery(str: unknown): string {\n return stringify(str, {\n encode: false,\n indices: false,\n arrayFormat: 'comma',\n });\n}\n\n/** @internal */\nexport function getInternalSession(session: Session | InternalSession, fnName: string): InternalSession {\n return {\n ...session,\n internalFnCall: (session as InternalSession).internalFnCall ?? fnName,\n internalRequestId: (session as InternalSession).internalRequestId ?? nanoid(),\n };\n}\n\nexport async function cdnRequest<T>(method: Method, url: string, requestOptions: RequestOptions = {}): Promise<T> {\n const opts = getOptions();\n return request(method, `${RECHARGE_CDN_URL(opts.environment)}/store/${opts.storeIdentifier}${url}`, requestOptions);\n}\n\nexport async function rechargeApiRequest<T>(\n method: Method,\n url: string,\n { id, query, data, headers }: RequestOptions = {},\n session: InternalSession\n): Promise<T> {\n const { environment, environmentUri, storeIdentifier, loginRetryFn, appName, appVersion } = getOptions();\n if (!storeIdentifier) {\n throw new Error('InitRecharge has not been called and/or no store identifier has been defined.');\n }\n const token = session.apiToken;\n if (!token) {\n throw new Error('No API token defined on session.');\n }\n const rechargeBaseUrl = RECHARGE_API_URL(environment, environmentUri);\n const reqHeaders: RequestHeaders = {\n 'X-Recharge-Access-Token': token,\n 'X-Recharge-Version': '2021-11',\n 'X-Recharge-Sdk-Fn': session.internalFnCall,\n ...(appName ? { 'X-Recharge-Sdk-App-Name': appName } : {}),\n ...(appVersion ? { 'X-Recharge-Sdk-App-Version': appVersion } : {}),\n 'X-Recharge-Sdk-Version': '__SDK_VERSION__',\n 'X-Request-Id': session.internalRequestId,\n ...(session.tmp_fn_identifier ? { 'X-Recharge-Sdk-Fn-Identifier': session.tmp_fn_identifier } : {}),\n ...(headers ? headers : {}),\n };\n\n const localQuery = {\n shop_url: storeIdentifier,\n ...(query as any),\n };\n\n try {\n // await to catch any errors\n return await request<T>(method, `${rechargeBaseUrl}${url}`, { id, query: localQuery, data, headers: reqHeaders });\n } catch (error: unknown) {\n if (loginRetryFn && error instanceof RechargeRequestError && error.status === 401) {\n // call loginRetryFn and retry request on 401\n return loginRetryFn().then(session => {\n if (session) {\n return request(method, `${rechargeBaseUrl}${url}`, {\n id,\n query: localQuery,\n data,\n headers: {\n ...reqHeaders,\n 'X-Recharge-Access-Token': session.apiToken,\n },\n });\n }\n throw error;\n });\n }\n throw error;\n }\n}\n\nexport async function shopifyAppProxyRequest<T>(\n method: Method,\n url: string,\n requestOptions: RequestOptions = {}\n): Promise<T> {\n return request(method, `${SHOPIFY_APP_PROXY_URL}${url}`, requestOptions);\n}\n\nexport async function request<T>(\n method: Method,\n url: string,\n { id, query, data, headers }: RequestOptions = {}\n): Promise<T> {\n let reqUrl = url.trim();\n\n if (id) {\n reqUrl = [reqUrl, `${id}`.trim()].join('/');\n }\n\n if (query) {\n let exQuery;\n [reqUrl, exQuery] = reqUrl.split('?');\n const fullQuery = [exQuery, stringifyQuery(query)].join('&').replace(/^&/, '');\n reqUrl = `${reqUrl}${fullQuery ? `?${fullQuery}` : ''}`;\n }\n\n let reqBody;\n if (data && method !== 'get') {\n reqBody = JSON.stringify(data);\n }\n\n const reqHeaders: RequestHeaders = {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'X-Recharge-App': 'storefront-client',\n ...(headers ? headers : {}),\n };\n\n const response = await fetch(reqUrl, {\n method,\n headers: reqHeaders,\n body: reqBody,\n });\n\n let result;\n try {\n result = await response.json();\n } catch (e) {\n // If we get here, it means we were a no content response.\n }\n\n if (!response.ok) {\n if (result && result.error) {\n throw new RechargeRequestError(result.error, response.status);\n } else if (result && result.errors) {\n throw new RechargeRequestError(JSON.stringify(result.errors), response.status);\n } else {\n throw new RechargeRequestError('A connection error occurred while making the request');\n }\n }\n\n return result as T;\n}\n"],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HANGED
|
@@ -179,7 +179,7 @@ async function rechargeAdminRequest(method, url, { id, query, data, headers } =
|
|
|
179
179
|
...storefrontAccessToken ? { "X-Recharge-Storefront-Access-Token": storefrontAccessToken } : {},
|
|
180
180
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
181
181
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
182
|
-
"X-Recharge-Sdk-Version": "1.
|
|
182
|
+
"X-Recharge-Sdk-Version": "1.35.0",
|
|
183
183
|
...headers ? headers : {}
|
|
184
184
|
};
|
|
185
185
|
return request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
|
|
@@ -39,8 +39,9 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
|
|
|
39
39
|
"X-Recharge-Sdk-Fn": session.internalFnCall,
|
|
40
40
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
41
41
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
42
|
-
"X-Recharge-Sdk-Version": "1.
|
|
42
|
+
"X-Recharge-Sdk-Version": "1.35.0",
|
|
43
43
|
"X-Request-Id": session.internalRequestId,
|
|
44
|
+
...session.tmp_fn_identifier ? { "X-Recharge-Sdk-Fn-Identifier": session.tmp_fn_identifier } : {},
|
|
44
45
|
...headers ? headers : {}
|
|
45
46
|
};
|
|
46
47
|
const localQuery = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sources":["../../../src/utils/request.ts"],"sourcesContent":["import 'isomorphic-fetch';\n\nimport { nanoid } from 'nanoid/non-secure';\nimport stringify from 'qs/lib/stringify';\n\nimport { Method, RequestHeaders, RequestOptions, InternalSession, Session } from '../types';\nimport { getOptions } from './options';\nimport { RECHARGE_API_URL, RECHARGE_CDN_URL, SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { RechargeRequestError } from './error';\n\nfunction stringifyQuery(str: unknown): string {\n return stringify(str, {\n encode: false,\n indices: false,\n arrayFormat: 'comma',\n });\n}\n\n/** @internal */\nexport function getInternalSession(session: Session | InternalSession, fnName: string): InternalSession {\n return {\n ...session,\n internalFnCall: (session as InternalSession).internalFnCall ?? fnName,\n internalRequestId: (session as InternalSession).internalRequestId ?? nanoid(),\n };\n}\n\nexport async function cdnRequest<T>(method: Method, url: string, requestOptions: RequestOptions = {}): Promise<T> {\n const opts = getOptions();\n return request(method, `${RECHARGE_CDN_URL(opts.environment)}/store/${opts.storeIdentifier}${url}`, requestOptions);\n}\n\nexport async function rechargeApiRequest<T>(\n method: Method,\n url: string,\n { id, query, data, headers }: RequestOptions = {},\n session: InternalSession\n): Promise<T> {\n const { environment, environmentUri, storeIdentifier, loginRetryFn, appName, appVersion } = getOptions();\n if (!storeIdentifier) {\n throw new Error('InitRecharge has not been called and/or no store identifier has been defined.');\n }\n const token = session.apiToken;\n if (!token) {\n throw new Error('No API token defined on session.');\n }\n const rechargeBaseUrl = RECHARGE_API_URL(environment, environmentUri);\n const reqHeaders: RequestHeaders = {\n 'X-Recharge-Access-Token': token,\n 'X-Recharge-Version': '2021-11',\n 'X-Recharge-Sdk-Fn': session.internalFnCall,\n ...(appName ? { 'X-Recharge-Sdk-App-Name': appName } : {}),\n ...(appVersion ? { 'X-Recharge-Sdk-App-Version': appVersion } : {}),\n 'X-Recharge-Sdk-Version': '__SDK_VERSION__',\n 'X-Request-Id': session.internalRequestId,\n ...(headers ? headers : {}),\n };\n\n const localQuery = {\n shop_url: storeIdentifier,\n ...(query as any),\n };\n\n try {\n // await to catch any errors\n return await request<T>(method, `${rechargeBaseUrl}${url}`, { id, query: localQuery, data, headers: reqHeaders });\n } catch (error: unknown) {\n if (loginRetryFn && error instanceof RechargeRequestError && error.status === 401) {\n // call loginRetryFn and retry request on 401\n return loginRetryFn().then(session => {\n if (session) {\n return request(method, `${rechargeBaseUrl}${url}`, {\n id,\n query: localQuery,\n data,\n headers: {\n ...reqHeaders,\n 'X-Recharge-Access-Token': session.apiToken,\n },\n });\n }\n throw error;\n });\n }\n throw error;\n }\n}\n\nexport async function shopifyAppProxyRequest<T>(\n method: Method,\n url: string,\n requestOptions: RequestOptions = {}\n): Promise<T> {\n return request(method, `${SHOPIFY_APP_PROXY_URL}${url}`, requestOptions);\n}\n\nexport async function request<T>(\n method: Method,\n url: string,\n { id, query, data, headers }: RequestOptions = {}\n): Promise<T> {\n let reqUrl = url.trim();\n\n if (id) {\n reqUrl = [reqUrl, `${id}`.trim()].join('/');\n }\n\n if (query) {\n let exQuery;\n [reqUrl, exQuery] = reqUrl.split('?');\n const fullQuery = [exQuery, stringifyQuery(query)].join('&').replace(/^&/, '');\n reqUrl = `${reqUrl}${fullQuery ? `?${fullQuery}` : ''}`;\n }\n\n let reqBody;\n if (data && method !== 'get') {\n reqBody = JSON.stringify(data);\n }\n\n const reqHeaders: RequestHeaders = {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'X-Recharge-App': 'storefront-client',\n ...(headers ? headers : {}),\n };\n\n const response = await fetch(reqUrl, {\n method,\n headers: reqHeaders,\n body: reqBody,\n });\n\n let result;\n try {\n result = await response.json();\n } catch (e) {\n // If we get here, it means we were a no content response.\n }\n\n if (!response.ok) {\n if (result && result.error) {\n throw new RechargeRequestError(result.error, response.status);\n } else if (result && result.errors) {\n throw new RechargeRequestError(JSON.stringify(result.errors), response.status);\n } else {\n throw new RechargeRequestError('A connection error occurred while making the request');\n }\n }\n\n return result as T;\n}\n"],"names":["session"],"mappings":";;;;;;;AAUA,SAAS,eAAe,GAAsB,EAAA;AAC5C,EAAA,OAAO,UAAU,GAAK,EAAA;AAAA,IACpB,MAAQ,EAAA,KAAA;AAAA,IACR,OAAS,EAAA,KAAA;AAAA,IACT,WAAa,EAAA,OAAA;AAAA,GACd,CAAA,CAAA;AACH,CAAA;AAGgB,SAAA,kBAAA,CAAmB,SAAoC,MAAiC,EAAA;AACtG,EAAO,OAAA;AAAA,IACL,GAAG,OAAA;AAAA,IACH,cAAA,EAAiB,QAA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S,EAAA,UAAA;AAAA,IACT,IAAM,EAAA,OAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAI,IAAA,MAAA,CAAA;AACJ,EAAI,IAAA;AACF,IAAS,MAAA,GAAA,MAAM,SAAS,IAAK,EAAA,CAAA;AAAA,WACtB,CAAG,EAAA;AAAA,GAEZ;AAEA,EAAI,IAAA,CAAC,SAAS,EAAI,EAAA;AAChB,IAAI,IAAA,MAAA,IAAU,OAAO,KAAO,EAAA;AAC1B,MAAA,MAAM,IAAI,oBAAA,CAAqB,MAAO,CAAA,KAAA,EAAO,SAAS,MAAM,CAAA,CAAA;AAAA,KAC9D,MAAA,IAAW,MAAU,IAAA,MAAA,CAAO,MAAQ,EAAA;AAClC,MAAM,MAAA,IAAI,qBAAqB,IAAK,CAAA,SAAA,CAAU,OAAO,MAAM,CAAA,EAAG,SAAS,MAAM,CAAA,CAAA;AAAA,KACxE,MAAA;AACL,MAAM,MAAA,IAAI,qBAAqB,sDAAsD,CAAA,CAAA;AAAA,KACvF;AAAA,GACF;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
|
|
1
|
+
{"version":3,"file":"request.js","sources":["../../../src/utils/request.ts"],"sourcesContent":["import 'isomorphic-fetch';\n\nimport { nanoid } from 'nanoid/non-secure';\nimport stringify from 'qs/lib/stringify';\n\nimport { Method, RequestHeaders, RequestOptions, InternalSession, Session } from '../types';\nimport { getOptions } from './options';\nimport { RECHARGE_API_URL, RECHARGE_CDN_URL, SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { RechargeRequestError } from './error';\n\nfunction stringifyQuery(str: unknown): string {\n return stringify(str, {\n encode: false,\n indices: false,\n arrayFormat: 'comma',\n });\n}\n\n/** @internal */\nexport function getInternalSession(session: Session | InternalSession, fnName: string): InternalSession {\n return {\n ...session,\n internalFnCall: (session as InternalSession).internalFnCall ?? fnName,\n internalRequestId: (session as InternalSession).internalRequestId ?? nanoid(),\n };\n}\n\nexport async function cdnRequest<T>(method: Method, url: string, requestOptions: RequestOptions = {}): Promise<T> {\n const opts = getOptions();\n return request(method, `${RECHARGE_CDN_URL(opts.environment)}/store/${opts.storeIdentifier}${url}`, requestOptions);\n}\n\nexport async function rechargeApiRequest<T>(\n method: Method,\n url: string,\n { id, query, data, headers }: RequestOptions = {},\n session: InternalSession\n): Promise<T> {\n const { environment, environmentUri, storeIdentifier, loginRetryFn, appName, appVersion } = getOptions();\n if (!storeIdentifier) {\n throw new Error('InitRecharge has not been called and/or no store identifier has been defined.');\n }\n const token = session.apiToken;\n if (!token) {\n throw new Error('No API token defined on session.');\n }\n const rechargeBaseUrl = RECHARGE_API_URL(environment, environmentUri);\n const reqHeaders: RequestHeaders = {\n 'X-Recharge-Access-Token': token,\n 'X-Recharge-Version': '2021-11',\n 'X-Recharge-Sdk-Fn': session.internalFnCall,\n ...(appName ? { 'X-Recharge-Sdk-App-Name': appName } : {}),\n ...(appVersion ? { 'X-Recharge-Sdk-App-Version': appVersion } : {}),\n 'X-Recharge-Sdk-Version': '__SDK_VERSION__',\n 'X-Request-Id': session.internalRequestId,\n ...(session.tmp_fn_identifier ? { 'X-Recharge-Sdk-Fn-Identifier': session.tmp_fn_identifier } : {}),\n ...(headers ? headers : {}),\n };\n\n const localQuery = {\n shop_url: storeIdentifier,\n ...(query as any),\n };\n\n try {\n // await to catch any errors\n return await request<T>(method, `${rechargeBaseUrl}${url}`, { id, query: localQuery, data, headers: reqHeaders });\n } catch (error: unknown) {\n if (loginRetryFn && error instanceof RechargeRequestError && error.status === 401) {\n // call loginRetryFn and retry request on 401\n return loginRetryFn().then(session => {\n if (session) {\n return request(method, `${rechargeBaseUrl}${url}`, {\n id,\n query: localQuery,\n data,\n headers: {\n ...reqHeaders,\n 'X-Recharge-Access-Token': session.apiToken,\n },\n });\n }\n throw error;\n });\n }\n throw error;\n }\n}\n\nexport async function shopifyAppProxyRequest<T>(\n method: Method,\n url: string,\n requestOptions: RequestOptions = {}\n): Promise<T> {\n return request(method, `${SHOPIFY_APP_PROXY_URL}${url}`, requestOptions);\n}\n\nexport async function request<T>(\n method: Method,\n url: string,\n { id, query, data, headers }: RequestOptions = {}\n): Promise<T> {\n let reqUrl = url.trim();\n\n if (id) {\n reqUrl = [reqUrl, `${id}`.trim()].join('/');\n }\n\n if (query) {\n let exQuery;\n [reqUrl, exQuery] = reqUrl.split('?');\n const fullQuery = [exQuery, stringifyQuery(query)].join('&').replace(/^&/, '');\n reqUrl = `${reqUrl}${fullQuery ? `?${fullQuery}` : ''}`;\n }\n\n let reqBody;\n if (data && method !== 'get') {\n reqBody = JSON.stringify(data);\n }\n\n const reqHeaders: RequestHeaders = {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'X-Recharge-App': 'storefront-client',\n ...(headers ? headers : {}),\n };\n\n const response = await fetch(reqUrl, {\n method,\n headers: reqHeaders,\n body: reqBody,\n });\n\n let result;\n try {\n result = await response.json();\n } catch (e) {\n // If we get here, it means we were a no content response.\n }\n\n if (!response.ok) {\n if (result && result.error) {\n throw new RechargeRequestError(result.error, response.status);\n } else if (result && result.errors) {\n throw new RechargeRequestError(JSON.stringify(result.errors), response.status);\n } else {\n throw new RechargeRequestError('A connection error occurred while making the request');\n }\n }\n\n return result as T;\n}\n"],"names":["session"],"mappings":";;;;;;;AAUA,SAAS,eAAe,GAAsB,EAAA;AAC5C,EAAA,OAAO,UAAU,GAAK,EAAA;AAAA,IACpB,MAAQ,EAAA,KAAA;AAAA,IACR,OAAS,EAAA,KAAA;AAAA,IACT,WAAa,EAAA,OAAA;AAAA,GACd,CAAA,CAAA;AACH,CAAA;AAGgB,SAAA,kBAAA,CAAmB,SAAoC,MAAiC,EAAA;AACtG,EAAO,OAAA;AAAA,IACL,GAAG,OAAA;AAAA,IACH,cAAA,EAAiB,QAA4B,cAAkB,IAAA,MAAA;AAAA,IAC/D,iBAAA,EAAoB,OAA4B,CAAA,iBAAA,IAAqB,MAAO,EAAA;AAAA,GAC9E,CAAA;AACF,CAAA;AAEA,eAAsB,UAAc,CA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CAAA,CAAA;AAED,EAAI,IAAA,MAAA,CAAA;AACJ,EAAI,IAAA;AACF,IAAS,MAAA,GAAA,MAAM,SAAS,IAAK,EAAA,CAAA;AAAA,WACtB,CAAG,EAAA;AAAA,GAEZ;AAEA,EAAI,IAAA,CAAC,SAAS,EAAI,EAAA;AAChB,IAAI,IAAA,MAAA,IAAU,OAAO,KAAO,EAAA;AAC1B,MAAA,MAAM,IAAI,oBAAA,CAAqB,MAAO,CAAA,KAAA,EAAO,SAAS,MAAM,CAAA,CAAA;AAAA,KAC9D,MAAA,IAAW,MAAU,IAAA,MAAA,CAAO,MAAQ,EAAA;AAClC,MAAM,MAAA,IAAI,qBAAqB,IAAK,CAAA,SAAA,CAAU,OAAO,MAAM,CAAA,EAAG,SAAS,MAAM,CAAA,CAAA;AAAA,KACxE,MAAA;AACL,MAAM,MAAA,IAAI,qBAAqB,sDAAsD,CAAA,CAAA;AAAA,KACvF;AAAA,GACF;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -878,6 +878,8 @@ interface Customer {
|
|
|
878
878
|
analytics_data: AnalyticsData;
|
|
879
879
|
/** A boolean that indicates whether Recharge credits will be applied to the next recurring charge */
|
|
880
880
|
apply_credit_to_next_recurring_charge: boolean;
|
|
881
|
+
/** A string that indicates which channel `apply_credit_to_next_recurring_charge` was set */
|
|
882
|
+
apply_credit_to_next_recurring_charge_channel?: string;
|
|
881
883
|
/** Backup payment methods enabled */
|
|
882
884
|
backup_payment_methods_enabled: boolean | null;
|
|
883
885
|
/** The date and time when the customer was created. */
|
|
@@ -919,7 +921,7 @@ interface Customer {
|
|
|
919
921
|
referral_info?: ReferralInfo;
|
|
920
922
|
};
|
|
921
923
|
}
|
|
922
|
-
interface UpdateCustomerRequest extends Partial<Pick<Customer, 'email' | 'first_name' | 'last_name' | 'external_customer_id' | 'apply_credit_to_next_recurring_charge' | 'phone' | 'backup_payment_methods_enabled'>> {
|
|
924
|
+
interface UpdateCustomerRequest extends Partial<Pick<Customer, 'email' | 'first_name' | 'last_name' | 'external_customer_id' | 'apply_credit_to_next_recurring_charge' | 'apply_credit_to_next_recurring_charge_channel' | 'phone' | 'backup_payment_methods_enabled'>> {
|
|
923
925
|
}
|
|
924
926
|
interface CustomerDeliveryScheduleParams {
|
|
925
927
|
delivery_count_future?: number;
|
|
@@ -2558,6 +2560,8 @@ interface Session {
|
|
|
2558
2560
|
customerId?: string;
|
|
2559
2561
|
/** Message related to fetching the session */
|
|
2560
2562
|
message?: string;
|
|
2563
|
+
/** @internal if defined will add an identifier to the request headers for the current function call */
|
|
2564
|
+
tmp_fn_identifier?: string;
|
|
2561
2565
|
}
|
|
2562
2566
|
/** @internal */
|
|
2563
2567
|
interface InternalSession extends Session {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// recharge-client-1.
|
|
1
|
+
// recharge-client-1.35.0.min.js | MIT License | © Recharge Inc.
|
|
2
2
|
(function(U,be){typeof exports=="object"&&typeof module<"u"?module.exports=be():typeof define=="function"&&define.amd?define(be):(U=typeof globalThis<"u"?globalThis:U||self,U.recharge=be())})(this,function(){"use strict";var U=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function be(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Ys(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 q=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof q<"u"&&q,G={searchParams:"URLSearchParams"in q,iterable:"Symbol"in q&&"iterator"in Symbol,blob:"FileReader"in q&&"Blob"in q&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in q,arrayBuffer:"ArrayBuffer"in q};function Ks(r){return r&&DataView.prototype.isPrototypeOf(r)}if(G.arrayBuffer)var Zs=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Js=ArrayBuffer.isView||function(r){return r&&Zs.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 nn(r){return typeof r!="string"&&(r=String(r)),r}function an(r){var e={next:function(){var t=r.shift();return{done:t===void 0,value:t}}};return G.iterable&&(e[Symbol.iterator]=function(){return e}),e}function C(r){this.map={},r instanceof C?r.forEach(function(e,t){this.append(t,e)},this):Array.isArray(r)?r.forEach(function(e){this.append(e[0],e[1])},this):r&&Object.getOwnPropertyNames(r).forEach(function(e){this.append(e,r[e])},this)}C.prototype.append=function(r,e){r=hr(r),e=nn(e);var t=this.map[r];this.map[r]=t?t+", "+e:e},C.prototype.delete=function(r){delete this.map[hr(r)]},C.prototype.get=function(r){return r=hr(r),this.has(r)?this.map[r]:null},C.prototype.has=function(r){return this.map.hasOwnProperty(hr(r))},C.prototype.set=function(r,e){this.map[hr(r)]=nn(e)},C.prototype.forEach=function(r,e){for(var t in this.map)this.map.hasOwnProperty(t)&&r.call(e,this.map[t],t,this)},C.prototype.keys=function(){var r=[];return this.forEach(function(e,t){r.push(t)}),an(r)},C.prototype.values=function(){var r=[];return this.forEach(function(e){r.push(e)}),an(r)},C.prototype.entries=function(){var r=[];return this.forEach(function(e,t){r.push([t,e])}),an(r)},G.iterable&&(C.prototype[Symbol.iterator]=C.prototype.entries);function on(r){if(r.bodyUsed)return Promise.reject(new TypeError("Already read"));r.bodyUsed=!0}function Ui(r){return new Promise(function(e,t){r.onload=function(){e(r.result)},r.onerror=function(){t(r.error)}})}function Qs(r){var e=new FileReader,t=Ui(e);return e.readAsArrayBuffer(r),t}function ef(r){var e=new FileReader,t=Ui(e);return e.readAsText(r),t}function rf(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 qi(r){if(r.slice)return r.slice(0);var e=new Uint8Array(r.byteLength);return e.set(new Uint8Array(r)),e.buffer}function Li(){return this.bodyUsed=!1,this._initBody=function(r){this.bodyUsed=this.bodyUsed,this._bodyInit=r,r?typeof r=="string"?this._bodyText=r:G.blob&&Blob.prototype.isPrototypeOf(r)?this._bodyBlob=r:G.formData&&FormData.prototype.isPrototypeOf(r)?this._bodyFormData=r:G.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)?this._bodyText=r.toString():G.arrayBuffer&&G.blob&&Ks(r)?(this._bodyArrayBuffer=qi(r.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):G.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(r)||Js(r))?this._bodyArrayBuffer=qi(r):this._bodyText=r=Object.prototype.toString.call(r):this._bodyText="",this.headers.get("content-type")||(typeof r=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):G.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},G.blob&&(this.blob=function(){var r=on(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=on(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(Qs)}),this.text=function(){var r=on(this);if(r)return r;if(this._bodyBlob)return ef(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(rf(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},G.formData&&(this.formData=function(){return this.text().then(af)}),this.json=function(){return this.text().then(JSON.parse)},this}var tf=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function nf(r){var e=r.toUpperCase();return tf.indexOf(e)>-1?e:r}function $e(r,e){if(!(this instanceof $e))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 $e){if(r.bodyUsed)throw new TypeError("Already read");this.url=r.url,this.credentials=r.credentials,e.headers||(this.headers=new C(r.headers)),this.method=r.method,this.mode=r.mode,this.signal=r.signal,!t&&r._bodyInit!=null&&(t=r._bodyInit,r.bodyUsed=!0)}else this.url=String(r);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new C(e.headers)),this.method=nf(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()}}}$e.prototype.clone=function(){return new $e(this,{body:this._bodyInit})};function af(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 of(r){var e=new C,t=r.replace(/\r?\n[\t ]+/g," ");return t.split("\r").map(function(n){return n.indexOf(`
|
|
3
3
|
`)===0?n.substr(1,n.length):n}).forEach(function(n){var i=n.split(":"),a=i.shift().trim();if(a){var o=i.join(":").trim();e.append(a,o)}}),e}Li.call($e.prototype);function Y(r,e){if(!(this instanceof Y))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=e.status===void 0?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText===void 0?"":""+e.statusText,this.headers=new C(e.headers),this.url=e.url||"",this._initBody(r)}Li.call(Y.prototype),Y.prototype.clone=function(){return new Y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new C(this.headers),url:this.url})},Y.error=function(){var r=new Y(null,{status:0,statusText:""});return r.type="error",r};var uf=[301,302,303,307,308];Y.redirect=function(r,e){if(uf.indexOf(e)===-1)throw new RangeError("Invalid status code");return new Y(null,{status:e,headers:{location:r}})};var Ee=q.DOMException;try{new Ee}catch{Ee=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},Ee.prototype=Object.create(Error.prototype),Ee.prototype.constructor=Ee}function ki(r,e){return new Promise(function(t,n){var i=new $e(r,e);if(i.signal&&i.signal.aborted)return n(new Ee("Aborted","AbortError"));var a=new XMLHttpRequest;function o(){a.abort()}a.onload=function(){var f={status:a.status,statusText:a.statusText,headers:of(a.getAllResponseHeaders()||"")};f.url="responseURL"in a?a.responseURL:f.headers.get("X-Request-URL");var c="response"in a?a.response:a.responseText;setTimeout(function(){t(new Y(c,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 Ee("Aborted","AbortError"))},0)};function u(f){try{return f===""&&q.location.href?q.location.href:f}catch{return f}}a.open(i.method,u(i.url),!0),i.credentials==="include"?a.withCredentials=!0:i.credentials==="omit"&&(a.withCredentials=!1),"responseType"in a&&(G.blob?a.responseType="blob":G.arrayBuffer&&i.headers.get("Content-Type")&&i.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(a.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof C)?Object.getOwnPropertyNames(e.headers).forEach(function(f){a.setRequestHeader(f,nn(e.headers[f]))}):i.headers.forEach(function(f,c){a.setRequestHeader(c,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)})}ki.polyfill=!0,q.fetch||(q.fetch=ki,q.Headers=C,q.Request=$e,q.Response=Y),self.fetch.bind(self);let sf="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",ji=(r=21)=>{let e="",t=r;for(;t--;)e+=sf[Math.random()*64|0];return e};var ff=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(t 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 a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==i||o.enumerable!==!0)return!1}return!0},Vi=typeof Symbol<"u"&&Symbol,cf=ff,lf=function(){return typeof Vi!="function"||typeof Symbol!="function"||typeof Vi("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:cf()},Gi={foo:{}},hf=Object,df=function(){return{__proto__:Gi}.foo===Gi.foo&&!({__proto__:null}instanceof hf)},pf="Function.prototype.bind called on incompatible ",un=Array.prototype.slice,yf=Object.prototype.toString,gf="[object Function]",vf=function(e){var t=this;if(typeof t!="function"||yf.call(t)!==gf)throw new TypeError(pf+t);for(var n=un.call(arguments,1),i,a=function(){if(this instanceof i){var l=t.apply(this,n.concat(un.call(arguments)));return Object(l)===l?l:this}else return t.apply(e,n.concat(un.call(arguments)))},o=Math.max(0,t.length-n.length),u=[],f=0;f<o;f++)u.push("$"+f);if(i=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this,arguments); }")(a),t.prototype){var c=function(){};c.prototype=t.prototype,i.prototype=new c,c.prototype=null}return i},_f=vf,sn=Function.prototype.bind||_f,mf=sn,wf=mf.call(Function.call,Object.prototype.hasOwnProperty),x,Le=SyntaxError,Hi=Function,ke=TypeError,fn=function(r){try{return Hi('"use strict"; return ('+r+").constructor;")()}catch{}},Ae=Object.getOwnPropertyDescriptor;if(Ae)try{Ae({},"")}catch{Ae=null}var cn=function(){throw new ke},bf=Ae?function(){try{return arguments.callee,cn}catch{try{return Ae(arguments,"callee").get}catch{return cn}}}():cn,je=lf(),$f=df(),N=Object.getPrototypeOf||($f?function(r){return r.__proto__}:null),Ve={},Ef=typeof Uint8Array>"u"||!N?x:N(Uint8Array),Se={"%AggregateError%":typeof AggregateError>"u"?x:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?x:ArrayBuffer,"%ArrayIteratorPrototype%":je&&N?N([][Symbol.iterator]()):x,"%AsyncFromSyncIteratorPrototype%":x,"%AsyncFunction%":Ve,"%AsyncGenerator%":Ve,"%AsyncGeneratorFunction%":Ve,"%AsyncIteratorPrototype%":Ve,"%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%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?x:Float32Array,"%Float64Array%":typeof Float64Array>"u"?x:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?x:FinalizationRegistry,"%Function%":Hi,"%GeneratorFunction%":Ve,"%Int8Array%":typeof Int8Array>"u"?x:Int8Array,"%Int16Array%":typeof Int16Array>"u"?x:Int16Array,"%Int32Array%":typeof Int32Array>"u"?x:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":je&&N?N(N([][Symbol.iterator]())):x,"%JSON%":typeof JSON=="object"?JSON:x,"%Map%":typeof Map>"u"?x:Map,"%MapIteratorPrototype%":typeof Map>"u"||!je||!N?x:N(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?x:Promise,"%Proxy%":typeof Proxy>"u"?x:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?x:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?x:Set,"%SetIteratorPrototype%":typeof Set>"u"||!je||!N?x:N(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?x:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":je&&N?N(""[Symbol.iterator]()):x,"%Symbol%":je?Symbol:x,"%SyntaxError%":Le,"%ThrowTypeError%":bf,"%TypedArray%":Ef,"%TypeError%":ke,"%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%":URIError,"%WeakMap%":typeof WeakMap>"u"?x:WeakMap,"%WeakRef%":typeof WeakRef>"u"?x:WeakRef,"%WeakSet%":typeof WeakSet>"u"?x:WeakSet};if(N)try{null.error}catch(r){var Af=N(N(r));Se["%Error.prototype%"]=Af}var Sf=function r(e){var t;if(e==="%AsyncFunction%")t=fn("async function () {}");else if(e==="%GeneratorFunction%")t=fn("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=fn("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&N&&(t=N(i.prototype))}return Se[e]=t,t},Wi={"%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"]},dr=sn,Xr=wf,Of=dr.call(Function.call,Array.prototype.concat),If=dr.call(Function.apply,Array.prototype.splice),Xi=dr.call(Function.call,String.prototype.replace),zr=dr.call(Function.call,String.prototype.slice),Pf=dr.call(Function.call,RegExp.prototype.exec),xf=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Tf=/\\(\\)?/g,Rf=function(e){var t=zr(e,0,1),n=zr(e,-1);if(t==="%"&&n!=="%")throw new Le("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new Le("invalid intrinsic syntax, expected opening `%`");var i=[];return Xi(e,xf,function(a,o,u,f){i[i.length]=u?Xi(f,Tf,"$1"):o||a}),i},Ff=function(e,t){var n=e,i;if(Xr(Wi,n)&&(i=Wi[n],n="%"+i[0]+"%"),Xr(Se,n)){var a=Se[n];if(a===Ve&&(a=Sf(n)),typeof a>"u"&&!t)throw new ke("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new Le("intrinsic "+e+" does not exist!")},ln=function(e,t){if(typeof e!="string"||e.length===0)throw new ke("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new ke('"allowMissing" argument must be a boolean');if(Pf(/^%?[^%]*%?$/,e)===null)throw new Le("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Rf(e),i=n.length>0?n[0]:"",a=Ff("%"+i+"%",t),o=a.name,u=a.value,f=!1,c=a.alias;c&&(i=c[0],If(n,Of([0,1],c)));for(var l=1,s=!0;l<n.length;l+=1){var h=n[l],y=zr(h,0,1),w=zr(h,-1);if((y==='"'||y==="'"||y==="`"||w==='"'||w==="'"||w==="`")&&y!==w)throw new Le("property names with quotes must have matching quotes");if((h==="constructor"||!s)&&(f=!0),i+="."+h,o="%"+i+"%",Xr(Se,o))u=Se[o];else if(u!=null){if(!(h in u)){if(!t)throw new ke("base intrinsic for "+e+" exists, but the property is not available.");return}if(Ae&&l+1>=n.length){var S=Ae(u,h);s=!!S,s&&"get"in S&&!("originalValue"in S.get)?u=S.get:u=u[h]}else s=Xr(u,h),u=u[h];s&&!f&&(Se[o]=u)}}return u},zi={exports:{}};(function(r){var e=sn,t=ln,n=t("%Function.prototype.apply%"),i=t("%Function.prototype.call%"),a=t("%Reflect.apply%",!0)||e.call(i,n),o=t("%Object.getOwnPropertyDescriptor%",!0),u=t("%Object.defineProperty%",!0),f=t("%Math.max%");if(u)try{u({},"a",{value:1})}catch{u=null}r.exports=function(s){var h=a(e,i,arguments);if(o&&u){var y=o(h,"length");y.configurable&&u(h,"length",{value:1+f(0,s.length-(arguments.length-1))})}return h};var c=function(){return a(e,n,arguments)};u?u(r.exports,"apply",{value:c}):r.exports.apply=c})(zi);var Mf=zi.exports,Yi=ln,Ki=Mf,Df=Ki(Yi("String.prototype.indexOf")),Cf=function(e,t){var n=Yi(e,!!t);return typeof n=="function"&&Df(e,".prototype.")>-1?Ki(n):n},Ge=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},K=[],X=[],Nf=typeof Uint8Array<"u"?Uint8Array:Array,hn=!1;function Zi(){hn=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=r.length;e<t;++e)K[e]=r[e],X[r.charCodeAt(e)]=e;X["-".charCodeAt(0)]=62,X["_".charCodeAt(0)]=63}function Bf(r){hn||Zi();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 Nf(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 Uf(r){return K[r>>18&63]+K[r>>12&63]+K[r>>6&63]+K[r&63]}function qf(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(Uf(n));return i.join("")}function Ji(r){hn||Zi();for(var e,t=r.length,n=t%3,i="",a=[],o=16383,u=0,f=t-n;u<f;u+=o)a.push(qf(r,u,u+o>f?f:u+o));return n===1?(e=r[t-1],i+=K[e>>2],i+=K[e<<4&63],i+="=="):n===2&&(e=(r[t-2]<<8)+r[t-1],i+=K[e>>10],i+=K[e>>4&63],i+=K[e<<2&63],i+="="),a.push(i),a.join("")}function Yr(r,e,t,n,i){var a,o,u=i*8-n-1,f=(1<<u)-1,c=f>>1,l=-7,s=t?i-1:0,h=t?-1:1,y=r[e+s];for(s+=h,a=y&(1<<-l)-1,y>>=-l,l+=u;l>0;a=a*256+r[e+s],s+=h,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=n;l>0;o=o*256+r[e+s],s+=h,l-=8);if(a===0)a=1-c;else{if(a===f)return o?NaN:(y?-1:1)*(1/0);o=o+Math.pow(2,n),a=a-c}return(y?-1:1)*o*Math.pow(2,a-n)}function Qi(r,e,t,n,i,a){var o,u,f,c=a*8-i-1,l=(1<<c)-1,s=l>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:a-1,w=n?1:-1,S=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=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+s>=1?e+=h/f:e+=h*Math.pow(2,1-s),e*f>=2&&(o++,f/=2),o+s>=l?(u=0,o=l):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+y]=u&255,y+=w,u/=256,i-=8);for(o=o<<i|u,c+=i;c>0;r[t+y]=o&255,y+=w,o/=256,c-=8);r[t+y-w]|=S*128}var Lf={}.toString,ea=Array.isArray||function(r){return Lf.call(r)=="[object Array]"};/*!
|
|
4
4
|
* The buffer module from node.js, for the browser.
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
`)+" "+t[1]:t[0]+e+" "+r.join(", ")+" "+t[1]}function bn(r){return Array.isArray(r)}function at(r){return typeof r=="boolean"}function pr(r){return r===null}function $a(r){return r==null}function $n(r){return typeof r=="number"}function yr(r){return typeof r=="string"}function Ea(r){return typeof r=="symbol"}function Q(r){return r===void 0}function gr(r){return xe(r)&&En(r)==="[object RegExp]"}function xe(r){return typeof r=="object"&&r!==null}function ot(r){return xe(r)&&En(r)==="[object Date]"}function vr(r){return xe(r)&&(En(r)==="[object Error]"||r instanceof Error)}function _r(r){return typeof r=="function"}function Aa(r){return r===null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||typeof r=="symbol"||typeof r>"u"}function Sa(r){return p.isBuffer(r)}function En(r){return Object.prototype.toString.call(r)}function An(r){return r<10?"0"+r.toString(10):r.toString(10)}var Xc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function zc(){var r=new Date,e=[An(r.getHours()),An(r.getMinutes()),An(r.getSeconds())].join(":");return[r.getDate(),Xc[r.getMonth()],e].join(" ")}function Oa(){console.log("%s - %s",zc(),tt.apply(null,arguments))}function Sn(r,e){if(!e||!xe(e))return r;for(var t=Object.keys(e),n=t.length;n--;)r[t[n]]=e[t[n]];return r}function Ia(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var Te=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function On(r){if(typeof r!="function")throw new TypeError('The "original" argument must be of type Function');if(Te&&r[Te]){var e=r[Te];if(typeof e!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Te,{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)),Te&&Object.defineProperty(e,Te,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,wa(r))}On.custom=Te;function Yc(r,e){if(!r){var t=new Error("Promise was rejected with a falsy value");t.reason=r,r=t}return e(r)}function Pa(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){Xe.nextTick(o.bind(null,null,u))},function(u){Xe.nextTick(Yc.bind(null,u,o))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(r)),Object.defineProperties(e,wa(r)),e}var Kc={inherits:ma,_extend:Sn,log:Oa,isBuffer:Sa,isPrimitive:Aa,isFunction:_r,isError:vr,isDate:ot,isObject:xe,isRegExp:gr,isUndefined:Q,isSymbol:Ea,isString:yr,isNumber:$n,isNullOrUndefined:$a,isNull:pr,isBoolean:at,isArray:bn,inspect:J,deprecate:vn,format:tt,debuglog:ba,promisify:On,callbackify:Pa},Zc=Object.freeze({__proto__:null,_extend:Sn,callbackify:Pa,debuglog:ba,default:Kc,deprecate:vn,format:tt,inherits:ma,inspect:J,isArray:bn,isBoolean:at,isBuffer:Sa,isDate:ot,isError:vr,isFunction:_r,isNull:pr,isNullOrUndefined:$a,isNumber:$n,isObject:xe,isPrimitive:Aa,isRegExp:gr,isString:yr,isSymbol:Ea,isUndefined:Q,log:Oa,promisify:On}),Jc=Ys(Zc),Qc=Jc.inspect,In=typeof Map=="function"&&Map.prototype,Pn=Object.getOwnPropertyDescriptor&&In?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ut=In&&Pn&&typeof Pn.get=="function"?Pn.get:null,xa=In&&Map.prototype.forEach,xn=typeof Set=="function"&&Set.prototype,Tn=Object.getOwnPropertyDescriptor&&xn?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,st=xn&&Tn&&typeof Tn.get=="function"?Tn.get:null,Ta=xn&&Set.prototype.forEach,el=typeof WeakMap=="function"&&WeakMap.prototype,mr=el?WeakMap.prototype.has:null,rl=typeof WeakSet=="function"&&WeakSet.prototype,wr=rl?WeakSet.prototype.has:null,tl=typeof WeakRef=="function"&&WeakRef.prototype,Ra=tl?WeakRef.prototype.deref:null,nl=Boolean.prototype.valueOf,il=Object.prototype.toString,al=Function.prototype.toString,ol=String.prototype.match,Rn=String.prototype.slice,de=String.prototype.replace,ul=String.prototype.toUpperCase,Fa=String.prototype.toLowerCase,Ma=RegExp.prototype.test,Da=Array.prototype.concat,ee=Array.prototype.join,sl=Array.prototype.slice,Ca=Math.floor,Fn=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Mn=Object.getOwnPropertySymbols,Dn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ze=typeof Symbol=="function"&&typeof Symbol.iterator=="object",L=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ze||"symbol")?Symbol.toStringTag:null,Na=Object.prototype.propertyIsEnumerable,Ba=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function Ua(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Ma.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-Ca(-r):Ca(r);if(n!==r){var i=String(n),a=Rn.call(e,i.length+1);return de.call(i,t,"$&_")+"."+de.call(de.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return de.call(e,t,"$&_")}var Cn=Qc,qa=Cn.custom,La=Va(qa)?qa:null,fl=function r(e,t,n,i){var a=t||{};if(pe(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(pe(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=pe(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(pe(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(pe(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 Ha(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var f=String(e);return u?Ua(e,f):f}if(typeof e=="bigint"){var c=String(e)+"n";return u?Ua(e,c):c}var l=typeof a.depth>"u"?5:a.depth;if(typeof n>"u"&&(n=0),n>=l&&l>0&&typeof e=="object")return Nn(e)?"[Array]":"[Object]";var s=Il(a,n);if(typeof i>"u")i=[];else if(Ga(i,e)>=0)return"[Circular]";function h(z,me,lr){if(me&&(i=sl.call(i),i.push(me)),lr){var we={depth:a.depth};return pe(a,"quoteStyle")&&(we.quoteStyle=a.quoteStyle),r(z,we,n+1,i)}return r(z,a,n+1,i)}if(typeof e=="function"&&!ja(e)){var y=_l(e),w=ft(e,h);return"[Function"+(y?": "+y:" (anonymous)")+"]"+(w.length>0?" { "+ee.call(w,", ")+" }":"")}if(Va(e)){var S=ze?de.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Dn.call(e);return typeof e=="object"&&!ze?br(S):S}if(Al(e)){for(var O="<"+Fa.call(String(e.nodeName)),b=e.attributes||[],E=0;E<b.length;E++)O+=" "+b[E].name+"="+ka(cl(b[E].value),"double",a);return O+=">",e.childNodes&&e.childNodes.length&&(O+="..."),O+="</"+Fa.call(String(e.nodeName))+">",O}if(Nn(e)){if(e.length===0)return"[]";var d=ft(e,h);return s&&!Ol(d)?"["+Un(d,s)+"]":"[ "+ee.call(d,", ")+" ]"}if(hl(e)){var I=ft(e,h);return!("cause"in Error.prototype)&&"cause"in e&&!Na.call(e,"cause")?"{ ["+String(e)+"] "+ee.call(Da.call("[cause]: "+h(e.cause),I),", ")+" }":I.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+ee.call(I,", ")+" }"}if(typeof e=="object"&&o){if(La&&typeof e[La]=="function"&&Cn)return Cn(e,{depth:l-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(ml(e)){var T=[];return xa&&xa.call(e,function(z,me){T.push(h(me,e,!0)+" => "+h(z,e))}),Wa("Map",ut.call(e),T,s)}if($l(e)){var F=[];return Ta&&Ta.call(e,function(z){F.push(h(z,e))}),Wa("Set",st.call(e),F,s)}if(wl(e))return Bn("WeakMap");if(El(e))return Bn("WeakSet");if(bl(e))return Bn("WeakRef");if(pl(e))return br(h(Number(e)));if(gl(e))return br(h(Fn.call(e)));if(yl(e))return br(nl.call(e));if(dl(e))return br(h(String(e)));if(!ll(e)&&!ja(e)){var m=ft(e,h),g=Ba?Ba(e)===Object.prototype:e instanceof Object||e.constructor===Object,v=e instanceof Object?"":"null prototype",A=!g&&L&&Object(e)===e&&L in e?Rn.call(ye(e),8,-1):v?"Object":"",P=g||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",M=P+(A||v?"["+ee.call(Da.call([],A||[],v||[]),": ")+"] ":"");return m.length===0?M+"{}":s?M+"{"+Un(m,s)+"}":M+"{ "+ee.call(m,", ")+" }"}return String(e)};function ka(r,e,t){var n=(t.quoteStyle||e)==="double"?'"':"'";return n+r+n}function cl(r){return de.call(String(r),/"/g,""")}function Nn(r){return ye(r)==="[object Array]"&&(!L||!(typeof r=="object"&&L in r))}function ll(r){return ye(r)==="[object Date]"&&(!L||!(typeof r=="object"&&L in r))}function ja(r){return ye(r)==="[object RegExp]"&&(!L||!(typeof r=="object"&&L in r))}function hl(r){return ye(r)==="[object Error]"&&(!L||!(typeof r=="object"&&L in r))}function dl(r){return ye(r)==="[object String]"&&(!L||!(typeof r=="object"&&L in r))}function pl(r){return ye(r)==="[object Number]"&&(!L||!(typeof r=="object"&&L in r))}function yl(r){return ye(r)==="[object Boolean]"&&(!L||!(typeof r=="object"&&L in r))}function Va(r){if(ze)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Dn)return!1;try{return Dn.call(r),!0}catch{}return!1}function gl(r){if(!r||typeof r!="object"||!Fn)return!1;try{return Fn.call(r),!0}catch{}return!1}var vl=Object.prototype.hasOwnProperty||function(r){return r in this};function pe(r,e){return vl.call(r,e)}function ye(r){return il.call(r)}function _l(r){if(r.name)return r.name;var e=ol.call(al.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function Ga(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 ml(r){if(!ut||!r||typeof r!="object")return!1;try{ut.call(r);try{st.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function wl(r){if(!mr||!r||typeof r!="object")return!1;try{mr.call(r,mr);try{wr.call(r,wr)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function bl(r){if(!Ra||!r||typeof r!="object")return!1;try{return Ra.call(r),!0}catch{}return!1}function $l(r){if(!st||!r||typeof r!="object")return!1;try{st.call(r);try{ut.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function El(r){if(!wr||!r||typeof r!="object")return!1;try{wr.call(r,wr);try{mr.call(r,mr)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function Al(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function Ha(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return Ha(Rn.call(r,0,e.maxStringLength),e)+n}var i=de.call(de.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Sl);return ka(i,"single",e)}function Sl(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":"")+ul.call(e.toString(16))}function br(r){return"Object("+r+")"}function Bn(r){return r+" { ? }"}function Wa(r,e,t,n){var i=n?Un(t,n):ee.call(t,", ");return r+" ("+e+") {"+i+"}"}function Ol(r){for(var e=0;e<r.length;e++)if(Ga(r[e],`
|
|
18
18
|
`)>=0)return!1;return!0}function Il(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=ee.call(Array(r.indent+1)," ");else return null;return{base:t,prev:ee.call(Array(e+1),t)}}function Un(r,e){if(r.length===0)return"";var t=`
|
|
19
19
|
`+e.prev+e.base;return t+ee.call(r,","+t)+`
|
|
20
|
-
`+e.prev}function ft(r,e){var t=Nn(r),n=[];if(t){n.length=r.length;for(var i=0;i<r.length;i++)n[i]=pe(r,i)?e(r[i],r):""}var a=typeof Mn=="function"?Mn(r):[],o;if(ze){o={};for(var u=0;u<a.length;u++)o["$"+a[u]]=a[u]}for(var f in r)pe(r,f)&&(t&&String(Number(f))===f&&f<r.length||ze&&o["$"+f]instanceof Symbol||(Ma.call(/[^\w$]/,f)?n.push(e(f,r)+": "+e(r[f],r)):n.push(f+": "+e(r[f],r))));if(typeof Mn=="function")for(var c=0;c<a.length;c++)Na.call(r,a[c])&&n.push("["+e(a[c])+"]: "+e(r[a[c]],r));return n}var qn=ln,Ye=Cf,Pl=fl,xl=qn("%TypeError%"),ct=qn("%WeakMap%",!0),lt=qn("%Map%",!0),Tl=Ye("WeakMap.prototype.get",!0),Rl=Ye("WeakMap.prototype.set",!0),Fl=Ye("WeakMap.prototype.has",!0),Ml=Ye("Map.prototype.get",!0),Dl=Ye("Map.prototype.set",!0),Cl=Ye("Map.prototype.has",!0),Ln=function(r,e){for(var t=r,n;(n=t.next)!==null;t=n)if(n.key===e)return t.next=n.next,n.next=r.next,r.next=n,n},Nl=function(r,e){var t=Ln(r,e);return t&&t.value},Bl=function(r,e,t){var n=Ln(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},Ul=function(r,e){return!!Ln(r,e)},ql=function(){var e,t,n,i={assert:function(a){if(!i.has(a))throw new xl("Side channel does not contain "+Pl(a))},get:function(a){if(ct&&a&&(typeof a=="object"||typeof a=="function")){if(e)return Tl(e,a)}else if(lt){if(t)return Ml(t,a)}else if(n)return Nl(n,a)},has:function(a){if(ct&&a&&(typeof a=="object"||typeof a=="function")){if(e)return Fl(e,a)}else if(lt){if(t)return Cl(t,a)}else if(n)return Ul(n,a);return!1},set:function(a,o){ct&&a&&(typeof a=="object"||typeof a=="function")?(e||(e=new ct),Rl(e,a,o)):lt?(t||(t=new lt),Dl(t,a,o)):(n||(n={key:{},next:null}),Bl(n,a,o))}};return i},Ll=String.prototype.replace,kl=/%20/g,kn={RFC1738:"RFC1738",RFC3986:"RFC3986"},Xa={default:kn.RFC3986,formatters:{RFC1738:function(r){return Ll.call(r,kl,"+")},RFC3986:function(r){return String(r)}},RFC1738:kn.RFC1738,RFC3986:kn.RFC3986},jl=Xa,jn=Object.prototype.hasOwnProperty,Re=Array.isArray,re=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),Vl=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}}},za=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},i=0;i<e.length;++i)typeof e[i]<"u"&&(n[i]=e[i]);return n},Gl=function r(e,t,n){if(!t)return e;if(typeof t!="object"){if(Re(e))e.push(t);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!jn.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var i=e;return Re(e)&&!Re(t)&&(i=za(e,n)),Re(e)&&Re(t)?(t.forEach(function(a,o){if(jn.call(e,o)){var u=e[o];u&&typeof u=="object"&&a&&typeof a=="object"?e[o]=r(u,a,n):e.push(a)}else e[o]=a}),e):Object.keys(t).reduce(function(a,o){var u=t[o];return jn.call(a,o)?a[o]=r(a[o],u,n):a[o]=u,a},i)},Hl=function(e,t){return Object.keys(t).reduce(function(n,i){return n[i]=t[i],n},e)},Wl=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}},Xl=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(l){return"%26%23"+parseInt(l.slice(2),16)+"%3B"});for(var u="",f=0;f<o.length;++f){var c=o.charCodeAt(f);if(c===45||c===46||c===95||c===126||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||a===jl.RFC1738&&(c===40||c===41)){u+=o.charAt(f);continue}if(c<128){u=u+re[c];continue}if(c<2048){u=u+(re[192|c>>6]+re[128|c&63]);continue}if(c<55296||c>=57344){u=u+(re[224|c>>12]+re[128|c>>6&63]+re[128|c&63]);continue}f+=1,c=65536+((c&1023)<<10|o.charCodeAt(f)&1023),u+=re[240|c>>18]+re[128|c>>12&63]+re[128|c>>6&63]+re[128|c&63]}return u},zl=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 c=u[f],l=o[c];typeof l=="object"&&l!==null&&n.indexOf(l)===-1&&(t.push({obj:o,prop:c}),n.push(l))}return Vl(t),e},Yl=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Kl=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Zl=function(e,t){return[].concat(e,t)},Jl=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)},Ql={arrayToObject:za,assign:Hl,combine:Zl,compact:zl,decode:Wl,encode:Xl,isBuffer:Kl,isRegExp:Yl,maybeMap:Jl,merge:Gl},Ya=ql,ht=Ql,$r=Xa,eh=Object.prototype.hasOwnProperty,Ka={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},oe=Array.isArray,rh=Array.prototype.push,Za=function(r,e){rh.apply(r,oe(e)?e:[e])},th=Date.prototype.toISOString,Ja=$r.default,k={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:ht.encode,encodeValuesOnly:!1,format:Ja,formatter:$r.formatters[Ja],indices:!1,serializeDate:function(e){return th.call(e)},skipNulls:!1,strictNullHandling:!1},nh=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Vn={},ih=function r(e,t,n,i,a,o,u,f,c,l,s,h,y,w,S,O){for(var b=e,E=O,d=0,I=!1;(E=E.get(Vn))!==void 0&&!I;){var T=E.get(e);if(d+=1,typeof T<"u"){if(T===d)throw new RangeError("Cyclic object value");I=!0}typeof E.get(Vn)>"u"&&(d=0)}if(typeof f=="function"?b=f(t,b):b instanceof Date?b=s(b):n==="comma"&&oe(b)&&(b=ht.maybeMap(b,function(we){return we instanceof Date?s(we):we})),b===null){if(a)return u&&!w?u(t,k.encoder,S,"key",h):t;b=""}if(nh(b)||ht.isBuffer(b)){if(u){var F=w?t:u(t,k.encoder,S,"key",h);return[y(F)+"="+y(u(b,k.encoder,S,"value",h))]}return[y(t)+"="+y(String(b))]}var m=[];if(typeof b>"u")return m;var g;if(n==="comma"&&oe(b))w&&u&&(b=ht.maybeMap(b,u)),g=[{value:b.length>0?b.join(",")||null:void 0}];else if(oe(f))g=f;else{var v=Object.keys(b);g=c?v.sort(c):v}for(var A=i&&oe(b)&&b.length===1?t+"[]":t,P=0;P<g.length;++P){var M=g[P],z=typeof M=="object"&&typeof M.value<"u"?M.value:b[M];if(!(o&&z===null)){var me=oe(b)?typeof n=="function"?n(A,M):A:A+(l?"."+M:"["+M+"]");O.set(e,d);var lr=Ya();lr.set(Vn,O),Za(m,r(z,me,n,i,a,o,n==="comma"&&w&&oe(b)?null:u,f,c,l,s,h,y,w,S,lr))}}return m},ah=function(e){if(!e)return k;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||k.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=$r.default;if(typeof e.format<"u"){if(!eh.call($r.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var i=$r.formatters[n],a=k.filter;return(typeof e.filter=="function"||oe(e.filter))&&(a=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:k.addQueryPrefix,allowDots:typeof e.allowDots>"u"?k.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:k.charsetSentinel,delimiter:typeof e.delimiter>"u"?k.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:k.encode,encoder:typeof e.encoder=="function"?e.encoder:k.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:k.encodeValuesOnly,filter:a,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:k.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:k.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:k.strictNullHandling}},oh=function(r,e){var t=r,n=ah(e),i,a;typeof n.filter=="function"?(a=n.filter,t=a("",t)):oe(n.filter)&&(a=n.filter,i=a);var o=[];if(typeof t!="object"||t===null)return"";var u;e&&e.arrayFormat in Ka?u=e.arrayFormat:e&&"indices"in e?u=e.indices?"indices":"repeat":u="indices";var f=Ka[u];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var c=f==="comma"&&e&&e.commaRoundTrip;i||(i=Object.keys(t)),n.sort&&i.sort(n.sort);for(var l=Ya(),s=0;s<i.length;++s){var h=i[s];n.skipNulls&&t[h]===null||Za(o,ih(t[h],h,f,c,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}var y=o.join(n.delimiter),w=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?w+="utf8=%26%2310003%3B&":w+="utf8=%E2%9C%93&"),y.length>0?w+y:""},uh=be(oh);let Qa={storeIdentifier:"",environment:"prod"};function sh(r){Qa=r}function W(){return Qa}const fh=(r,e="")=>{switch(r){case"prod":return"https://api.rechargeapps.com";case"stage":return"https://api.stage.rechargeapps.com";case"preprod":case"prestage":return`${e}/api`}},ch=(r,e="")=>{switch(r){case"prod":return"https://admin.rechargeapps.com";case"stage":return"https://admin.stage.rechargeapps.com";case"preprod":case"prestage":return e}},lh=r=>{switch(r){case"prod":case"preprod":return"https://static.rechargecdn.com";case"stage":case"prestage":return"https://static.stage.rechargecdn.com"}},hh="/tools/recurring";class dt{constructor(e,t){this.name="RechargeRequestError",this.message=e,this.status=t}}function dh(r){return uh(r,{encode:!1,indices:!1,arrayFormat:"comma"})}function _(r,e){return{...r,internalFnCall:r.internalFnCall??e,internalRequestId:r.internalRequestId??ji()}}async function pt(r,e,t={}){const n=W();return ue(r,`${lh(n.environment)}/store/${n.storeIdentifier}${e}`,t)}async function $(r,e,{id:t,query:n,data:i,headers:a}={},o){const{environment:u,environmentUri:f,storeIdentifier:c,loginRetryFn:l,appName:s,appVersion:h}=W();if(!c)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const y=o.apiToken;if(!y)throw new Error("No API token defined on session.");const w=fh(u,f),S={"X-Recharge-Access-Token":y,"X-Recharge-Version":"2021-11","X-Recharge-Sdk-Fn":o.internalFnCall,...s?{"X-Recharge-Sdk-App-Name":s}:{},...h?{"X-Recharge-Sdk-App-Version":h}:{},"X-Recharge-Sdk-Version":"1.34.1","X-Request-Id":o.internalRequestId,...a||{}},O={shop_url:c,...n};try{return await ue(r,`${w}${e}`,{id:t,query:O,data:i,headers:S})}catch(b){if(l&&b instanceof dt&&b.status===401)return l().then(E=>{if(E)return ue(r,`${w}${e}`,{id:t,query:O,data:i,headers:{...S,"X-Recharge-Access-Token":E.apiToken}});throw b});throw b}}async function Ke(r,e,t={}){return ue(r,`${hh}${e}`,t)}async function ue(r,e,{id:t,query:n,data:i,headers:a}={}){let o=e.trim();if(t&&(o=[o,`${t}`.trim()].join("/")),n){let s;[o,s]=o.split("?");const h=[s,dh(n)].join("&").replace(/^&/,"");o=`${o}${h?`?${h}`:""}`}let u;i&&r!=="get"&&(u=JSON.stringify(i));const f={Accept:"application/json","Content-Type":"application/json","X-Recharge-App":"storefront-client",...a||{}},c=await fetch(o,{method:r,headers:f,body:u});let l;try{l=await c.json()}catch{}if(!c.ok)throw l&&l.error?new dt(l.error,c.status):l&&l.errors?new dt(JSON.stringify(l.errors),c.status):new dt("A connection error occurred while making the request");return l}function ph(r,e){return $("get","/addresses",{query:e},_(r,"listAddresses"))}async function yh(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{address:n}=await $("get","/addresses",{id:e,query:{include:t?.include}},_(r,"getAddress"));return n}async function gh(r,e){const{address:t}=await $("post","/addresses",{data:{customer_id:r.customerId?Number(r.customerId):void 0,...e}},_(r,"createAddress"));return t}async function Gn(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{address:i}=await $("put","/addresses",{id:e,data:t,query:n},_(r,"updateAddress"));return i}async function vh(r,e,t,n){return Gn(_(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 Gn(_(r,"removeDiscountsFromAddress"),e,{discounts:[]},t)}function mh(r,e){if(e===void 0||e==="")throw new Error("ID is required");return $("delete","/addresses",{id:e},_(r,"deleteAddress"))}async function wh(r,e){const{address:t}=await $("post","/addresses/merge",{data:e},_(r,"mergeAddresses"));return t}async function bh(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await $("post",`/addresses/${e}/charges/skip`,{data:t},_(r,"skipFutureCharge"));return n}var $h=Object.freeze({__proto__:null,applyDiscountToAddress:vh,createAddress:gh,deleteAddress:mh,getAddress:yh,listAddresses:ph,mergeAddresses:wh,removeDiscountsFromAddress:_h,skipFutureCharge:bh,updateAddress:Gn});async function Eh(){const{storefrontAccessToken:r}=W(),e={};r&&(e["X-Recharge-Storefront-Access-Token"]=r);const t=await Ke("get","/access",{headers:e});return{apiToken:t.api_token,customerId:t.customer_id,message:t.message}}async function Ah(r,e){return eo(r,e)}async function eo(r,e){if(!r)throw new Error("Shopify storefront token is required");const{storeIdentifier:t}=W();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 Er("post","/shopify_storefront_access",{data:{customer_token:e,storefront_token:r,shop_url:t}});return n?{apiToken:n,customerId:i,message:a}:null}async function Sh(r){const{storeIdentifier:e}=W();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 Er("post","/shopify_customer_account_api_access",{data:{customer_token:r,shop_url:e}});return t?{apiToken:t,customerId:n,message:i}:null}async function Oh(r,e={}){if(!r)throw new Error("Email is required.");const{storeIdentifier:t}=W();if(!t)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const n=await Er("post","/attempt_login",{data:{email:r,shop:t,...e}});if(n.errors)throw new Error(n.errors);return n.session_token}async function Ih(r,e={}){if(!r)throw new Error("Email is required.");const{storefrontAccessToken:t}=W(),n={};t&&(n["X-Recharge-Storefront-Access-Token"]=t);const i=await Ke("post","/attempt_login",{data:{email:r,...e},headers:n});if(i.errors)throw new Error(i.errors);return i.session_token}async function Ph(r,e,t){if(!r)throw new Error("Email is required.");if(!e)throw new Error("Session token is required.");if(!t)throw new Error("Code is required.");const{storeIdentifier:n}=W();if(!n)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const i=await Er("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 xh(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}=W(),i={};n&&(i["X-Recharge-Storefront-Access-Token"]=n);const a=await Ke("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 Th(){const{customerHash:r}=W(),{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 Rh(){const{customerHash:r,token:e}=Th(),{storeIdentifier:t}=W(),n=await Er("post",`/customers/${r}/access`,{data:{token:e,shop:t}});return{apiToken:n.api_token,customerId:n.customer_id}}async function Er(r,e,{id:t,query:n,data:i,headers:a}={}){const{environment:o,environmentUri:u,storefrontAccessToken:f,appName:c,appVersion:l}=W(),s=ch(o,u),h={...f?{"X-Recharge-Storefront-Access-Token":f}:{},...c?{"X-Recharge-Sdk-App-Name":c}:{},...l?{"X-Recharge-Sdk-App-Version":l}:{},"X-Recharge-Sdk-Version":"1.34.1",...a||{}};return ue(r,`${s}${e}`,{id:t,query:n,data:i,headers:h})}var Fh=Object.freeze({__proto__:null,loginCustomerPortal:Rh,loginShopifyApi:Ah,loginShopifyAppProxy:Eh,loginWithShopifyCustomerAccount:Sh,loginWithShopifyStorefront:eo,sendPasswordlessCode:Oh,sendPasswordlessCodeAppProxy:Ih,validatePasswordlessCode:Ph,validatePasswordlessCodeAppProxy:xh}),ro={},Hn={},se={},Mh=typeof U=="object"&&U&&U.Object===Object&&U,to=Mh,Dh=to,Ch=typeof self=="object"&&self&&self.Object===Object&&self,Nh=Dh||Ch||Function("return this")(),fe=Nh,Bh=fe,Uh=Bh.Symbol,yt=Uh,no=yt,io=Object.prototype,qh=io.hasOwnProperty,Lh=io.toString,Ar=no?no.toStringTag:void 0;function kh(r){var e=qh.call(r,Ar),t=r[Ar];try{r[Ar]=void 0;var n=!0}catch{}var i=Lh.call(r);return n&&(e?r[Ar]=t:delete r[Ar]),i}var jh=kh,Vh=Object.prototype,Gh=Vh.toString;function Hh(r){return Gh.call(r)}var Wh=Hh,ao=yt,Xh=jh,zh=Wh,Yh="[object Null]",Kh="[object Undefined]",oo=ao?ao.toStringTag:void 0;function Zh(r){return r==null?r===void 0?Kh:Yh:oo&&oo in Object(r)?Xh(r):zh(r)}var ge=Zh;function Jh(r){return r!=null&&typeof r=="object"}var ve=Jh,Qh=ge,ed=ve,rd="[object Number]";function td(r){return typeof r=="number"||ed(r)&&Qh(r)==rd}var gt=td,D={};function nd(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var Ze=nd,id=ge,ad=Ze,od="[object AsyncFunction]",ud="[object Function]",sd="[object GeneratorFunction]",fd="[object Proxy]";function cd(r){if(!ad(r))return!1;var e=id(r);return e==ud||e==sd||e==od||e==fd}var Wn=cd,ld=fe,hd=ld["__core-js_shared__"],dd=hd,Xn=dd,uo=function(){var r=/[^.]+$/.exec(Xn&&Xn.keys&&Xn.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function pd(r){return!!uo&&uo in r}var yd=pd,gd=Function.prototype,vd=gd.toString;function _d(r){if(r!=null){try{return vd.call(r)}catch{}try{return r+""}catch{}}return""}var so=_d,md=Wn,wd=yd,bd=Ze,$d=so,Ed=/[\\^$.*+?()[\]{}|]/g,Ad=/^\[object .+?Constructor\]$/,Sd=Function.prototype,Od=Object.prototype,Id=Sd.toString,Pd=Od.hasOwnProperty,xd=RegExp("^"+Id.call(Pd).replace(Ed,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Td(r){if(!bd(r)||wd(r))return!1;var e=md(r)?xd:Ad;return e.test($d(r))}var Rd=Td;function Fd(r,e){return r?.[e]}var Md=Fd,Dd=Rd,Cd=Md;function Nd(r,e){var t=Cd(r,e);return Dd(t)?t:void 0}var Fe=Nd,Bd=Fe,Ud=function(){try{var r=Bd(Object,"defineProperty");return r({},"",{}),r}catch{}}(),fo=Ud,co=fo;function qd(r,e,t){e=="__proto__"&&co?co(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var lo=qd;function Ld(r,e){return r===e||r!==r&&e!==e}var vt=Ld,kd=lo,jd=vt,Vd=Object.prototype,Gd=Vd.hasOwnProperty;function Hd(r,e,t){var n=r[e];(!(Gd.call(r,e)&&jd(n,t))||t===void 0&&!(e in r))&&kd(r,e,t)}var Wd=Hd,Xd=Wd,zd=lo;function Yd(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?zd(t,u,f):Xd(t,u,f)}return t}var Kd=Yd;function Zd(r){return r}var _t=Zd;function Jd(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 Qd=Jd,ep=Qd,ho=Math.max;function rp(r,e,t){return e=ho(e===void 0?r.length-1:e,0),function(){for(var n=arguments,i=-1,a=ho(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),ep(r,this,u)}}var tp=rp;function np(r){return function(){return r}}var ip=np,ap=ip,po=fo,op=_t,up=po?function(r,e){return po(r,"toString",{configurable:!0,enumerable:!1,value:ap(e),writable:!0})}:op,sp=up,fp=800,cp=16,lp=Date.now;function hp(r){var e=0,t=0;return function(){var n=lp(),i=cp-(n-t);if(t=n,i>0){if(++e>=fp)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}var dp=hp,pp=sp,yp=dp,gp=yp(pp),vp=gp,_p=_t,mp=tp,wp=vp;function bp(r,e){return wp(mp(r,e,_p),r+"")}var $p=bp,Ep=9007199254740991;function Ap(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Ep}var zn=Ap,Sp=Wn,Op=zn;function Ip(r){return r!=null&&Op(r.length)&&!Sp(r)}var Sr=Ip,Pp=9007199254740991,xp=/^(?:0|[1-9]\d*)$/;function Tp(r,e){var t=typeof r;return e=e??Pp,!!e&&(t=="number"||t!="symbol"&&xp.test(r))&&r>-1&&r%1==0&&r<e}var Yn=Tp,Rp=vt,Fp=Sr,Mp=Yn,Dp=Ze;function Cp(r,e,t){if(!Dp(t))return!1;var n=typeof e;return(n=="number"?Fp(t)&&Mp(e,t.length):n=="string"&&e in t)?Rp(t[e],r):!1}var yo=Cp,Np=$p,Bp=yo;function Up(r){return Np(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&&Bp(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 qp=Up;function Lp(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var go=Lp,kp=ge,jp=ve,Vp="[object Arguments]";function Gp(r){return jp(r)&&kp(r)==Vp}var Hp=Gp,vo=Hp,Wp=ve,_o=Object.prototype,Xp=_o.hasOwnProperty,zp=_o.propertyIsEnumerable,Yp=vo(function(){return arguments}())?vo:function(r){return Wp(r)&&Xp.call(r,"callee")&&!zp.call(r,"callee")},mo=Yp,Kp=Array.isArray,V=Kp,mt={exports:{}};function Zp(){return!1}var Jp=Zp;mt.exports,function(r,e){var t=fe,n=Jp,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,c=f||n;r.exports=c}(mt,mt.exports);var wo=mt.exports,Qp=ge,ey=zn,ry=ve,ty="[object Arguments]",ny="[object Array]",iy="[object Boolean]",ay="[object Date]",oy="[object Error]",uy="[object Function]",sy="[object Map]",fy="[object Number]",cy="[object Object]",ly="[object RegExp]",hy="[object Set]",dy="[object String]",py="[object WeakMap]",yy="[object ArrayBuffer]",gy="[object DataView]",vy="[object Float32Array]",_y="[object Float64Array]",my="[object Int8Array]",wy="[object Int16Array]",by="[object Int32Array]",$y="[object Uint8Array]",Ey="[object Uint8ClampedArray]",Ay="[object Uint16Array]",Sy="[object Uint32Array]",R={};R[vy]=R[_y]=R[my]=R[wy]=R[by]=R[$y]=R[Ey]=R[Ay]=R[Sy]=!0,R[ty]=R[ny]=R[yy]=R[iy]=R[gy]=R[ay]=R[oy]=R[uy]=R[sy]=R[fy]=R[cy]=R[ly]=R[hy]=R[dy]=R[py]=!1;function Oy(r){return ry(r)&&ey(r.length)&&!!R[Qp(r)]}var Iy=Oy;function Py(r){return function(e){return r(e)}}var xy=Py,wt={exports:{}};wt.exports,function(r,e){var t=to,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}(wt,wt.exports);var Ty=wt.exports,Ry=Iy,Fy=xy,bo=Ty,$o=bo&&bo.isTypedArray,My=$o?Fy($o):Ry,Eo=My,Dy=go,Cy=mo,Ny=V,By=wo,Uy=Yn,qy=Eo,Ly=Object.prototype,ky=Ly.hasOwnProperty;function jy(r,e){var t=Ny(r),n=!t&&Cy(r),i=!t&&!n&&By(r),a=!t&&!n&&!i&&qy(r),o=t||n||i||a,u=o?Dy(r.length,String):[],f=u.length;for(var c in r)(e||ky.call(r,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||a&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Uy(c,f)))&&u.push(c);return u}var Ao=jy,Vy=Object.prototype;function Gy(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Vy;return r===t}var So=Gy;function Hy(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var Wy=Hy,Xy=Ze,zy=So,Yy=Wy,Ky=Object.prototype,Zy=Ky.hasOwnProperty;function Jy(r){if(!Xy(r))return Yy(r);var e=zy(r),t=[];for(var n in r)n=="constructor"&&(e||!Zy.call(r,n))||t.push(n);return t}var Qy=Jy,eg=Ao,rg=Qy,tg=Sr;function ng(r){return tg(r)?eg(r,!0):rg(r)}var ig=ng,ag=Kd,og=qp,ug=ig,sg=og(function(r,e){ag(e,ug(e),r)}),fg=sg,cg=fg,bt={},Me={};function lg(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 hg=lg;function dg(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 pg=dg,yg=pg,gg=yg(),vg=gg;function _g(r,e){return function(t){return r(e(t))}}var mg=_g,wg=mg,bg=wg(Object.keys,Object),$g=bg,Eg=So,Ag=$g,Sg=Object.prototype,Og=Sg.hasOwnProperty;function Ig(r){if(!Eg(r))return Ag(r);var e=[];for(var t in Object(r))Og.call(r,t)&&t!="constructor"&&e.push(t);return e}var Pg=Ig,xg=Ao,Tg=Pg,Rg=Sr;function Fg(r){return Rg(r)?xg(r):Tg(r)}var $t=Fg,Mg=vg,Dg=$t;function Cg(r,e){return r&&Mg(r,e,Dg)}var Ng=Cg,Bg=Sr;function Ug(r,e){return function(t,n){if(t==null)return t;if(!Bg(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 qg=Ug,Lg=Ng,kg=qg,jg=kg(Lg),Kn=jg,Vg=Kn;function Gg(r,e){var t=!0;return Vg(r,function(n,i,a){return t=!!e(n,i,a),t}),t}var Hg=Gg;function Wg(){this.__data__=[],this.size=0}var Xg=Wg,zg=vt;function Yg(r,e){for(var t=r.length;t--;)if(zg(r[t][0],e))return t;return-1}var Et=Yg,Kg=Et,Zg=Array.prototype,Jg=Zg.splice;function Qg(r){var e=this.__data__,t=Kg(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():Jg.call(e,t,1),--this.size,!0}var ev=Qg,rv=Et;function tv(r){var e=this.__data__,t=rv(e,r);return t<0?void 0:e[t][1]}var nv=tv,iv=Et;function av(r){return iv(this.__data__,r)>-1}var ov=av,uv=Et;function sv(r,e){var t=this.__data__,n=uv(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var fv=sv,cv=Xg,lv=ev,hv=nv,dv=ov,pv=fv;function Je(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])}}Je.prototype.clear=cv,Je.prototype.delete=lv,Je.prototype.get=hv,Je.prototype.has=dv,Je.prototype.set=pv;var At=Je,yv=At;function gv(){this.__data__=new yv,this.size=0}var vv=gv;function _v(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var mv=_v;function wv(r){return this.__data__.get(r)}var bv=wv;function $v(r){return this.__data__.has(r)}var Ev=$v,Av=Fe,Sv=fe,Ov=Av(Sv,"Map"),Zn=Ov,Iv=Fe,Pv=Iv(Object,"create"),St=Pv,Oo=St;function xv(){this.__data__=Oo?Oo(null):{},this.size=0}var Tv=xv;function Rv(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var Fv=Rv,Mv=St,Dv="__lodash_hash_undefined__",Cv=Object.prototype,Nv=Cv.hasOwnProperty;function Bv(r){var e=this.__data__;if(Mv){var t=e[r];return t===Dv?void 0:t}return Nv.call(e,r)?e[r]:void 0}var Uv=Bv,qv=St,Lv=Object.prototype,kv=Lv.hasOwnProperty;function jv(r){var e=this.__data__;return qv?e[r]!==void 0:kv.call(e,r)}var Vv=jv,Gv=St,Hv="__lodash_hash_undefined__";function Wv(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Gv&&e===void 0?Hv:e,this}var Xv=Wv,zv=Tv,Yv=Fv,Kv=Uv,Zv=Vv,Jv=Xv;function Qe(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])}}Qe.prototype.clear=zv,Qe.prototype.delete=Yv,Qe.prototype.get=Kv,Qe.prototype.has=Zv,Qe.prototype.set=Jv;var Qv=Qe,Io=Qv,e_=At,r_=Zn;function t_(){this.size=0,this.__data__={hash:new Io,map:new(r_||e_),string:new Io}}var n_=t_;function i_(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var a_=i_,o_=a_;function u_(r,e){var t=r.__data__;return o_(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Ot=u_,s_=Ot;function f_(r){var e=s_(this,r).delete(r);return this.size-=e?1:0,e}var c_=f_,l_=Ot;function h_(r){return l_(this,r).get(r)}var d_=h_,p_=Ot;function y_(r){return p_(this,r).has(r)}var g_=y_,v_=Ot;function __(r,e){var t=v_(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var m_=__,w_=n_,b_=c_,$_=d_,E_=g_,A_=m_;function er(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}er.prototype.clear=w_,er.prototype.delete=b_,er.prototype.get=$_,er.prototype.has=E_,er.prototype.set=A_;var Jn=er,S_=At,O_=Zn,I_=Jn,P_=200;function x_(r,e){var t=this.__data__;if(t instanceof S_){var n=t.__data__;if(!O_||n.length<P_-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new I_(n)}return t.set(r,e),this.size=t.size,this}var T_=x_,R_=At,F_=vv,M_=mv,D_=bv,C_=Ev,N_=T_;function rr(r){var e=this.__data__=new R_(r);this.size=e.size}rr.prototype.clear=F_,rr.prototype.delete=M_,rr.prototype.get=D_,rr.prototype.has=C_,rr.prototype.set=N_;var Po=rr,B_="__lodash_hash_undefined__";function U_(r){return this.__data__.set(r,B_),this}var q_=U_;function L_(r){return this.__data__.has(r)}var k_=L_,j_=Jn,V_=q_,G_=k_;function It(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new j_;++e<t;)this.add(r[e])}It.prototype.add=It.prototype.push=V_,It.prototype.has=G_;var H_=It;function W_(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 X_=W_;function z_(r,e){return r.has(e)}var Y_=z_,K_=H_,Z_=X_,J_=Y_,Q_=1,em=2;function rm(r,e,t,n,i,a){var o=t&Q_,u=r.length,f=e.length;if(u!=f&&!(o&&f>u))return!1;var c=a.get(r),l=a.get(e);if(c&&l)return c==e&&l==r;var s=-1,h=!0,y=t&em?new K_:void 0;for(a.set(r,e),a.set(e,r);++s<u;){var w=r[s],S=e[s];if(n)var O=o?n(S,w,s,e,r,a):n(w,S,s,r,e,a);if(O!==void 0){if(O)continue;h=!1;break}if(y){if(!Z_(e,function(b,E){if(!J_(y,E)&&(w===b||i(w,b,t,n,a)))return y.push(E)})){h=!1;break}}else if(!(w===S||i(w,S,t,n,a))){h=!1;break}}return a.delete(r),a.delete(e),h}var xo=rm,tm=fe,nm=tm.Uint8Array,im=nm;function am(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}var om=am;function um(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var sm=um,To=yt,Ro=im,fm=vt,cm=xo,lm=om,hm=sm,dm=1,pm=2,ym="[object Boolean]",gm="[object Date]",vm="[object Error]",_m="[object Map]",mm="[object Number]",wm="[object RegExp]",bm="[object Set]",$m="[object String]",Em="[object Symbol]",Am="[object ArrayBuffer]",Sm="[object DataView]",Fo=To?To.prototype:void 0,Qn=Fo?Fo.valueOf:void 0;function Om(r,e,t,n,i,a,o){switch(t){case Sm:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case Am:return!(r.byteLength!=e.byteLength||!a(new Ro(r),new Ro(e)));case ym:case gm:case mm:return fm(+r,+e);case vm:return r.name==e.name&&r.message==e.message;case wm:case $m:return r==e+"";case _m:var u=lm;case bm:var f=n&dm;if(u||(u=hm),r.size!=e.size&&!f)return!1;var c=o.get(r);if(c)return c==e;n|=pm,o.set(r,e);var l=cm(u(r),u(e),n,i,a,o);return o.delete(r),l;case Em:if(Qn)return Qn.call(r)==Qn.call(e)}return!1}var Im=Om;function Pm(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}var xm=Pm,Tm=xm,Rm=V;function Fm(r,e,t){var n=e(r);return Rm(r)?n:Tm(n,t(r))}var Mm=Fm;function Dm(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 Cm=Dm;function Nm(){return[]}var Bm=Nm,Um=Cm,qm=Bm,Lm=Object.prototype,km=Lm.propertyIsEnumerable,Mo=Object.getOwnPropertySymbols,jm=Mo?function(r){return r==null?[]:(r=Object(r),Um(Mo(r),function(e){return km.call(r,e)}))}:qm,Vm=jm,Gm=Mm,Hm=Vm,Wm=$t;function Xm(r){return Gm(r,Wm,Hm)}var zm=Xm,Do=zm,Ym=1,Km=Object.prototype,Zm=Km.hasOwnProperty;function Jm(r,e,t,n,i,a){var o=t&Ym,u=Do(r),f=u.length,c=Do(e),l=c.length;if(f!=l&&!o)return!1;for(var s=f;s--;){var h=u[s];if(!(o?h in e:Zm.call(e,h)))return!1}var y=a.get(r),w=a.get(e);if(y&&w)return y==e&&w==r;var S=!0;a.set(r,e),a.set(e,r);for(var O=o;++s<f;){h=u[s];var b=r[h],E=e[h];if(n)var d=o?n(E,b,h,e,r,a):n(b,E,h,r,e,a);if(!(d===void 0?b===E||i(b,E,t,n,a):d)){S=!1;break}O||(O=h=="constructor")}if(S&&!O){var I=r.constructor,T=e.constructor;I!=T&&"constructor"in r&&"constructor"in e&&!(typeof I=="function"&&I instanceof I&&typeof T=="function"&&T instanceof T)&&(S=!1)}return a.delete(r),a.delete(e),S}var Qm=Jm,ew=Fe,rw=fe,tw=ew(rw,"DataView"),nw=tw,iw=Fe,aw=fe,ow=iw(aw,"Promise"),uw=ow,sw=Fe,fw=fe,cw=sw(fw,"Set"),lw=cw,hw=Fe,dw=fe,pw=hw(dw,"WeakMap"),yw=pw,ei=nw,ri=Zn,ti=uw,ni=lw,ii=yw,Co=ge,tr=so,No="[object Map]",gw="[object Object]",Bo="[object Promise]",Uo="[object Set]",qo="[object WeakMap]",Lo="[object DataView]",vw=tr(ei),_w=tr(ri),mw=tr(ti),ww=tr(ni),bw=tr(ii),De=Co;(ei&&De(new ei(new ArrayBuffer(1)))!=Lo||ri&&De(new ri)!=No||ti&&De(ti.resolve())!=Bo||ni&&De(new ni)!=Uo||ii&&De(new ii)!=qo)&&(De=function(r){var e=Co(r),t=e==gw?r.constructor:void 0,n=t?tr(t):"";if(n)switch(n){case vw:return Lo;case _w:return No;case mw:return Bo;case ww:return Uo;case bw:return qo}return e});var $w=De,ai=Po,Ew=xo,Aw=Im,Sw=Qm,ko=$w,jo=V,Vo=wo,Ow=Eo,Iw=1,Go="[object Arguments]",Ho="[object Array]",Pt="[object Object]",Pw=Object.prototype,Wo=Pw.hasOwnProperty;function xw(r,e,t,n,i,a){var o=jo(r),u=jo(e),f=o?Ho:ko(r),c=u?Ho:ko(e);f=f==Go?Pt:f,c=c==Go?Pt:c;var l=f==Pt,s=c==Pt,h=f==c;if(h&&Vo(r)){if(!Vo(e))return!1;o=!0,l=!1}if(h&&!l)return a||(a=new ai),o||Ow(r)?Ew(r,e,t,n,i,a):Aw(r,e,f,t,n,i,a);if(!(t&Iw)){var y=l&&Wo.call(r,"__wrapped__"),w=s&&Wo.call(e,"__wrapped__");if(y||w){var S=y?r.value():r,O=w?e.value():e;return a||(a=new ai),i(S,O,t,n,a)}}return h?(a||(a=new ai),Sw(r,e,t,n,i,a)):!1}var Tw=xw,Rw=Tw,Xo=ve;function zo(r,e,t,n,i){return r===e?!0:r==null||e==null||!Xo(r)&&!Xo(e)?r!==r&&e!==e:Rw(r,e,t,n,zo,i)}var Yo=zo,Fw=Po,Mw=Yo,Dw=1,Cw=2;function Nw(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],c=r[f],l=u[1];if(o&&u[2]){if(c===void 0&&!(f in r))return!1}else{var s=new Fw;if(n)var h=n(c,l,f,r,e,s);if(!(h===void 0?Mw(l,c,Dw|Cw,n,s):h))return!1}}return!0}var Bw=Nw,Uw=Ze;function qw(r){return r===r&&!Uw(r)}var Ko=qw,Lw=Ko,kw=$t;function jw(r){for(var e=kw(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,Lw(i)]}return e}var Vw=jw;function Gw(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}var Zo=Gw,Hw=Bw,Ww=Vw,Xw=Zo;function zw(r){var e=Ww(r);return e.length==1&&e[0][2]?Xw(e[0][0],e[0][1]):function(t){return t===r||Hw(t,r,e)}}var Yw=zw,Kw=ge,Zw=ve,Jw="[object Symbol]";function Qw(r){return typeof r=="symbol"||Zw(r)&&Kw(r)==Jw}var xt=Qw,e0=V,r0=xt,t0=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n0=/^\w*$/;function i0(r,e){if(e0(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||r0(r)?!0:n0.test(r)||!t0.test(r)||e!=null&&r in Object(e)}var oi=i0,Jo=Jn,a0="Expected a function";function ui(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(a0);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(ui.Cache||Jo),t}ui.Cache=Jo;var o0=ui,u0=o0,s0=500;function f0(r){var e=u0(r,function(n){return t.size===s0&&t.clear(),n}),t=e.cache;return e}var c0=f0,l0=c0,h0=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,d0=/\\(\\)?/g,p0=l0(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(h0,function(t,n,i,a){e.push(i?a.replace(d0,"$1"):n||t)}),e}),y0=p0;function g0(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 si=g0,Qo=yt,v0=si,_0=V,m0=xt,w0=1/0,eu=Qo?Qo.prototype:void 0,ru=eu?eu.toString:void 0;function tu(r){if(typeof r=="string")return r;if(_0(r))return v0(r,tu)+"";if(m0(r))return ru?ru.call(r):"";var e=r+"";return e=="0"&&1/r==-w0?"-0":e}var b0=tu,$0=b0;function E0(r){return r==null?"":$0(r)}var A0=E0,S0=V,O0=oi,I0=y0,P0=A0;function x0(r,e){return S0(r)?r:O0(r,e)?[r]:I0(P0(r))}var nu=x0,T0=xt,R0=1/0;function F0(r){if(typeof r=="string"||T0(r))return r;var e=r+"";return e=="0"&&1/r==-R0?"-0":e}var Tt=F0,M0=nu,D0=Tt;function C0(r,e){e=M0(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[D0(e[t++])];return t&&t==n?r:void 0}var iu=C0,N0=iu;function B0(r,e,t){var n=r==null?void 0:N0(r,e);return n===void 0?t:n}var U0=B0;function q0(r,e){return r!=null&&e in Object(r)}var L0=q0,k0=nu,j0=mo,V0=V,G0=Yn,H0=zn,W0=Tt;function X0(r,e,t){e=k0(e,r);for(var n=-1,i=e.length,a=!1;++n<i;){var o=W0(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&&H0(i)&&G0(o,i)&&(V0(r)||j0(r)))}var z0=X0,Y0=L0,K0=z0;function Z0(r,e){return r!=null&&K0(r,e,Y0)}var J0=Z0,Q0=Yo,eb=U0,rb=J0,tb=oi,nb=Ko,ib=Zo,ab=Tt,ob=1,ub=2;function sb(r,e){return tb(r)&&nb(e)?ib(ab(r),e):function(t){var n=eb(t,r);return n===void 0&&n===e?rb(t,r):Q0(e,n,ob|ub)}}var fb=sb;function cb(r){return function(e){return e?.[r]}}var lb=cb,hb=iu;function db(r){return function(e){return hb(e,r)}}var pb=db,yb=lb,gb=pb,vb=oi,_b=Tt;function mb(r){return vb(r)?yb(_b(r)):gb(r)}var wb=mb,bb=Yw,$b=fb,Eb=_t,Ab=V,Sb=wb;function Ob(r){return typeof r=="function"?r:r==null?Eb:typeof r=="object"?Ab(r)?$b(r[0],r[1]):bb(r):Sb(r)}var au=Ob,Ib=hg,Pb=Hg,xb=au,Tb=V,Rb=yo;function Fb(r,e,t){var n=Tb(r)?Ib:Pb;return t&&Rb(r,e,t)&&(e=void 0),n(r,xb(e))}var fi=Fb;Object.defineProperty(Me,"__esModule",{value:!0}),Me.calculatePadding=Nb,Me.slicePadding=Bb;var Mb=fi,Db=Cb(Mb);function Cb(r){return r&&r.__esModule?r:{default:r}}function Nb(r){switch(r%4){case 0:return 0;case 1:return 3;case 2:return 2;case 3:return 1;default:return null}}function Bb(r,e){var t=r.slice(e),n=(0,Db.default)(t.buffer(),function(i){return i===0});if(n!==!0)throw new Error("XDR Read Error: invalid padding")}Object.defineProperty(bt,"__esModule",{value:!0}),bt.Cursor=void 0;var Ub=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}}(),qb=Me;function Lb(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var ci=function(){function r(e){Lb(this,r),e instanceof p||(e=typeof e=="number"?p.alloc(e):p.from(e)),this._setBuffer(e),this.rewind()}return Ub(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,qb.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){ci.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){ci.prototype[e]=function(n){return this.buffer()[e](n,this.tell()),this.seek("+",r[0]),this}})}),bt.Cursor=ci,Object.defineProperty(D,"__esModule",{value:!0}),D.default=Xb;var kb=cg,ou=su(kb),jb=Wn,Vb=su(jb),uu=bt;function su(r){return r&&r.__esModule?r:{default:r}}var Gb=Math.pow(2,16),Hb={toXDR:function(e){var t=new uu.Cursor(Gb);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 uu.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}}},Wb={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 Xb(r){(0,ou.default)(r,Hb),(0,Vb.default)(r)&&(0,ou.default)(r.prototype,Wb)}Object.defineProperty(se,"__esModule",{value:!0}),se.Int=void 0;var zb=gt,fu=cu(zb),Yb=D,Kb=cu(Yb);function cu(r){return r&&r.__esModule?r:{default:r}}var Or=se.Int={read:function(e){return e.readInt32BE()},write:function(e,t){if(!(0,fu.default)(e))throw new Error("XDR Write Error: not a number");if(Math.floor(e)!==e)throw new Error("XDR Write Error: not an integer");t.writeInt32BE(e)},isValid:function(e){return!(0,fu.default)(e)||Math.floor(e)!==e?!1:e>=Or.MIN_VALUE&&e<=Or.MAX_VALUE}};Or.MAX_VALUE=Math.pow(2,31)-1,Or.MIN_VALUE=-Math.pow(2,31),(0,Kb.default)(Or);var Rt={};function Zb(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 lu={exports:{}};(function(r){/**
|
|
20
|
+
`+e.prev}function ft(r,e){var t=Nn(r),n=[];if(t){n.length=r.length;for(var i=0;i<r.length;i++)n[i]=pe(r,i)?e(r[i],r):""}var a=typeof Mn=="function"?Mn(r):[],o;if(ze){o={};for(var u=0;u<a.length;u++)o["$"+a[u]]=a[u]}for(var f in r)pe(r,f)&&(t&&String(Number(f))===f&&f<r.length||ze&&o["$"+f]instanceof Symbol||(Ma.call(/[^\w$]/,f)?n.push(e(f,r)+": "+e(r[f],r)):n.push(f+": "+e(r[f],r))));if(typeof Mn=="function")for(var c=0;c<a.length;c++)Na.call(r,a[c])&&n.push("["+e(a[c])+"]: "+e(r[a[c]],r));return n}var qn=ln,Ye=Cf,Pl=fl,xl=qn("%TypeError%"),ct=qn("%WeakMap%",!0),lt=qn("%Map%",!0),Tl=Ye("WeakMap.prototype.get",!0),Rl=Ye("WeakMap.prototype.set",!0),Fl=Ye("WeakMap.prototype.has",!0),Ml=Ye("Map.prototype.get",!0),Dl=Ye("Map.prototype.set",!0),Cl=Ye("Map.prototype.has",!0),Ln=function(r,e){for(var t=r,n;(n=t.next)!==null;t=n)if(n.key===e)return t.next=n.next,n.next=r.next,r.next=n,n},Nl=function(r,e){var t=Ln(r,e);return t&&t.value},Bl=function(r,e,t){var n=Ln(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},Ul=function(r,e){return!!Ln(r,e)},ql=function(){var e,t,n,i={assert:function(a){if(!i.has(a))throw new xl("Side channel does not contain "+Pl(a))},get:function(a){if(ct&&a&&(typeof a=="object"||typeof a=="function")){if(e)return Tl(e,a)}else if(lt){if(t)return Ml(t,a)}else if(n)return Nl(n,a)},has:function(a){if(ct&&a&&(typeof a=="object"||typeof a=="function")){if(e)return Fl(e,a)}else if(lt){if(t)return Cl(t,a)}else if(n)return Ul(n,a);return!1},set:function(a,o){ct&&a&&(typeof a=="object"||typeof a=="function")?(e||(e=new ct),Rl(e,a,o)):lt?(t||(t=new lt),Dl(t,a,o)):(n||(n={key:{},next:null}),Bl(n,a,o))}};return i},Ll=String.prototype.replace,kl=/%20/g,kn={RFC1738:"RFC1738",RFC3986:"RFC3986"},Xa={default:kn.RFC3986,formatters:{RFC1738:function(r){return Ll.call(r,kl,"+")},RFC3986:function(r){return String(r)}},RFC1738:kn.RFC1738,RFC3986:kn.RFC3986},jl=Xa,jn=Object.prototype.hasOwnProperty,Re=Array.isArray,re=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),Vl=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}}},za=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},i=0;i<e.length;++i)typeof e[i]<"u"&&(n[i]=e[i]);return n},Gl=function r(e,t,n){if(!t)return e;if(typeof t!="object"){if(Re(e))e.push(t);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!jn.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var i=e;return Re(e)&&!Re(t)&&(i=za(e,n)),Re(e)&&Re(t)?(t.forEach(function(a,o){if(jn.call(e,o)){var u=e[o];u&&typeof u=="object"&&a&&typeof a=="object"?e[o]=r(u,a,n):e.push(a)}else e[o]=a}),e):Object.keys(t).reduce(function(a,o){var u=t[o];return jn.call(a,o)?a[o]=r(a[o],u,n):a[o]=u,a},i)},Hl=function(e,t){return Object.keys(t).reduce(function(n,i){return n[i]=t[i],n},e)},Wl=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}},Xl=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(l){return"%26%23"+parseInt(l.slice(2),16)+"%3B"});for(var u="",f=0;f<o.length;++f){var c=o.charCodeAt(f);if(c===45||c===46||c===95||c===126||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||a===jl.RFC1738&&(c===40||c===41)){u+=o.charAt(f);continue}if(c<128){u=u+re[c];continue}if(c<2048){u=u+(re[192|c>>6]+re[128|c&63]);continue}if(c<55296||c>=57344){u=u+(re[224|c>>12]+re[128|c>>6&63]+re[128|c&63]);continue}f+=1,c=65536+((c&1023)<<10|o.charCodeAt(f)&1023),u+=re[240|c>>18]+re[128|c>>12&63]+re[128|c>>6&63]+re[128|c&63]}return u},zl=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 c=u[f],l=o[c];typeof l=="object"&&l!==null&&n.indexOf(l)===-1&&(t.push({obj:o,prop:c}),n.push(l))}return Vl(t),e},Yl=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Kl=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Zl=function(e,t){return[].concat(e,t)},Jl=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)},Ql={arrayToObject:za,assign:Hl,combine:Zl,compact:zl,decode:Wl,encode:Xl,isBuffer:Kl,isRegExp:Yl,maybeMap:Jl,merge:Gl},Ya=ql,ht=Ql,$r=Xa,eh=Object.prototype.hasOwnProperty,Ka={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},oe=Array.isArray,rh=Array.prototype.push,Za=function(r,e){rh.apply(r,oe(e)?e:[e])},th=Date.prototype.toISOString,Ja=$r.default,k={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:ht.encode,encodeValuesOnly:!1,format:Ja,formatter:$r.formatters[Ja],indices:!1,serializeDate:function(e){return th.call(e)},skipNulls:!1,strictNullHandling:!1},nh=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Vn={},ih=function r(e,t,n,i,a,o,u,f,c,l,s,h,y,w,S,O){for(var b=e,E=O,d=0,I=!1;(E=E.get(Vn))!==void 0&&!I;){var T=E.get(e);if(d+=1,typeof T<"u"){if(T===d)throw new RangeError("Cyclic object value");I=!0}typeof E.get(Vn)>"u"&&(d=0)}if(typeof f=="function"?b=f(t,b):b instanceof Date?b=s(b):n==="comma"&&oe(b)&&(b=ht.maybeMap(b,function(we){return we instanceof Date?s(we):we})),b===null){if(a)return u&&!w?u(t,k.encoder,S,"key",h):t;b=""}if(nh(b)||ht.isBuffer(b)){if(u){var F=w?t:u(t,k.encoder,S,"key",h);return[y(F)+"="+y(u(b,k.encoder,S,"value",h))]}return[y(t)+"="+y(String(b))]}var m=[];if(typeof b>"u")return m;var g;if(n==="comma"&&oe(b))w&&u&&(b=ht.maybeMap(b,u)),g=[{value:b.length>0?b.join(",")||null:void 0}];else if(oe(f))g=f;else{var v=Object.keys(b);g=c?v.sort(c):v}for(var A=i&&oe(b)&&b.length===1?t+"[]":t,P=0;P<g.length;++P){var M=g[P],z=typeof M=="object"&&typeof M.value<"u"?M.value:b[M];if(!(o&&z===null)){var me=oe(b)?typeof n=="function"?n(A,M):A:A+(l?"."+M:"["+M+"]");O.set(e,d);var lr=Ya();lr.set(Vn,O),Za(m,r(z,me,n,i,a,o,n==="comma"&&w&&oe(b)?null:u,f,c,l,s,h,y,w,S,lr))}}return m},ah=function(e){if(!e)return k;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||k.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=$r.default;if(typeof e.format<"u"){if(!eh.call($r.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var i=$r.formatters[n],a=k.filter;return(typeof e.filter=="function"||oe(e.filter))&&(a=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:k.addQueryPrefix,allowDots:typeof e.allowDots>"u"?k.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:k.charsetSentinel,delimiter:typeof e.delimiter>"u"?k.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:k.encode,encoder:typeof e.encoder=="function"?e.encoder:k.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:k.encodeValuesOnly,filter:a,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:k.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:k.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:k.strictNullHandling}},oh=function(r,e){var t=r,n=ah(e),i,a;typeof n.filter=="function"?(a=n.filter,t=a("",t)):oe(n.filter)&&(a=n.filter,i=a);var o=[];if(typeof t!="object"||t===null)return"";var u;e&&e.arrayFormat in Ka?u=e.arrayFormat:e&&"indices"in e?u=e.indices?"indices":"repeat":u="indices";var f=Ka[u];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var c=f==="comma"&&e&&e.commaRoundTrip;i||(i=Object.keys(t)),n.sort&&i.sort(n.sort);for(var l=Ya(),s=0;s<i.length;++s){var h=i[s];n.skipNulls&&t[h]===null||Za(o,ih(t[h],h,f,c,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}var y=o.join(n.delimiter),w=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?w+="utf8=%26%2310003%3B&":w+="utf8=%E2%9C%93&"),y.length>0?w+y:""},uh=be(oh);let Qa={storeIdentifier:"",environment:"prod"};function sh(r){Qa=r}function W(){return Qa}const fh=(r,e="")=>{switch(r){case"prod":return"https://api.rechargeapps.com";case"stage":return"https://api.stage.rechargeapps.com";case"preprod":case"prestage":return`${e}/api`}},ch=(r,e="")=>{switch(r){case"prod":return"https://admin.rechargeapps.com";case"stage":return"https://admin.stage.rechargeapps.com";case"preprod":case"prestage":return e}},lh=r=>{switch(r){case"prod":case"preprod":return"https://static.rechargecdn.com";case"stage":case"prestage":return"https://static.stage.rechargecdn.com"}},hh="/tools/recurring";class dt{constructor(e,t){this.name="RechargeRequestError",this.message=e,this.status=t}}function dh(r){return uh(r,{encode:!1,indices:!1,arrayFormat:"comma"})}function _(r,e){return{...r,internalFnCall:r.internalFnCall??e,internalRequestId:r.internalRequestId??ji()}}async function pt(r,e,t={}){const n=W();return ue(r,`${lh(n.environment)}/store/${n.storeIdentifier}${e}`,t)}async function $(r,e,{id:t,query:n,data:i,headers:a}={},o){const{environment:u,environmentUri:f,storeIdentifier:c,loginRetryFn:l,appName:s,appVersion:h}=W();if(!c)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const y=o.apiToken;if(!y)throw new Error("No API token defined on session.");const w=fh(u,f),S={"X-Recharge-Access-Token":y,"X-Recharge-Version":"2021-11","X-Recharge-Sdk-Fn":o.internalFnCall,...s?{"X-Recharge-Sdk-App-Name":s}:{},...h?{"X-Recharge-Sdk-App-Version":h}:{},"X-Recharge-Sdk-Version":"1.35.0","X-Request-Id":o.internalRequestId,...o.tmp_fn_identifier?{"X-Recharge-Sdk-Fn-Identifier":o.tmp_fn_identifier}:{},...a||{}},O={shop_url:c,...n};try{return await ue(r,`${w}${e}`,{id:t,query:O,data:i,headers:S})}catch(b){if(l&&b instanceof dt&&b.status===401)return l().then(E=>{if(E)return ue(r,`${w}${e}`,{id:t,query:O,data:i,headers:{...S,"X-Recharge-Access-Token":E.apiToken}});throw b});throw b}}async function Ke(r,e,t={}){return ue(r,`${hh}${e}`,t)}async function ue(r,e,{id:t,query:n,data:i,headers:a}={}){let o=e.trim();if(t&&(o=[o,`${t}`.trim()].join("/")),n){let s;[o,s]=o.split("?");const h=[s,dh(n)].join("&").replace(/^&/,"");o=`${o}${h?`?${h}`:""}`}let u;i&&r!=="get"&&(u=JSON.stringify(i));const f={Accept:"application/json","Content-Type":"application/json","X-Recharge-App":"storefront-client",...a||{}},c=await fetch(o,{method:r,headers:f,body:u});let l;try{l=await c.json()}catch{}if(!c.ok)throw l&&l.error?new dt(l.error,c.status):l&&l.errors?new dt(JSON.stringify(l.errors),c.status):new dt("A connection error occurred while making the request");return l}function ph(r,e){return $("get","/addresses",{query:e},_(r,"listAddresses"))}async function yh(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{address:n}=await $("get","/addresses",{id:e,query:{include:t?.include}},_(r,"getAddress"));return n}async function gh(r,e){const{address:t}=await $("post","/addresses",{data:{customer_id:r.customerId?Number(r.customerId):void 0,...e}},_(r,"createAddress"));return t}async function Gn(r,e,t,n){if(e===void 0||e==="")throw new Error("ID is required");const{address:i}=await $("put","/addresses",{id:e,data:t,query:n},_(r,"updateAddress"));return i}async function vh(r,e,t,n){return Gn(_(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 Gn(_(r,"removeDiscountsFromAddress"),e,{discounts:[]},t)}function mh(r,e){if(e===void 0||e==="")throw new Error("ID is required");return $("delete","/addresses",{id:e},_(r,"deleteAddress"))}async function wh(r,e){const{address:t}=await $("post","/addresses/merge",{data:e},_(r,"mergeAddresses"));return t}async function bh(r,e,t){if(e===void 0||e==="")throw new Error("ID is required");const{charge:n}=await $("post",`/addresses/${e}/charges/skip`,{data:t},_(r,"skipFutureCharge"));return n}var $h=Object.freeze({__proto__:null,applyDiscountToAddress:vh,createAddress:gh,deleteAddress:mh,getAddress:yh,listAddresses:ph,mergeAddresses:wh,removeDiscountsFromAddress:_h,skipFutureCharge:bh,updateAddress:Gn});async function Eh(){const{storefrontAccessToken:r}=W(),e={};r&&(e["X-Recharge-Storefront-Access-Token"]=r);const t=await Ke("get","/access",{headers:e});return{apiToken:t.api_token,customerId:t.customer_id,message:t.message}}async function Ah(r,e){return eo(r,e)}async function eo(r,e){if(!r)throw new Error("Shopify storefront token is required");const{storeIdentifier:t}=W();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 Er("post","/shopify_storefront_access",{data:{customer_token:e,storefront_token:r,shop_url:t}});return n?{apiToken:n,customerId:i,message:a}:null}async function Sh(r){const{storeIdentifier:e}=W();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 Er("post","/shopify_customer_account_api_access",{data:{customer_token:r,shop_url:e}});return t?{apiToken:t,customerId:n,message:i}:null}async function Oh(r,e={}){if(!r)throw new Error("Email is required.");const{storeIdentifier:t}=W();if(!t)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const n=await Er("post","/attempt_login",{data:{email:r,shop:t,...e}});if(n.errors)throw new Error(n.errors);return n.session_token}async function Ih(r,e={}){if(!r)throw new Error("Email is required.");const{storefrontAccessToken:t}=W(),n={};t&&(n["X-Recharge-Storefront-Access-Token"]=t);const i=await Ke("post","/attempt_login",{data:{email:r,...e},headers:n});if(i.errors)throw new Error(i.errors);return i.session_token}async function Ph(r,e,t){if(!r)throw new Error("Email is required.");if(!e)throw new Error("Session token is required.");if(!t)throw new Error("Code is required.");const{storeIdentifier:n}=W();if(!n)throw new Error("InitRecharge has not been called and/or no store identifier has been defined.");const i=await Er("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 xh(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}=W(),i={};n&&(i["X-Recharge-Storefront-Access-Token"]=n);const a=await Ke("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 Th(){const{customerHash:r}=W(),{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 Rh(){const{customerHash:r,token:e}=Th(),{storeIdentifier:t}=W(),n=await Er("post",`/customers/${r}/access`,{data:{token:e,shop:t}});return{apiToken:n.api_token,customerId:n.customer_id}}async function Er(r,e,{id:t,query:n,data:i,headers:a}={}){const{environment:o,environmentUri:u,storefrontAccessToken:f,appName:c,appVersion:l}=W(),s=ch(o,u),h={...f?{"X-Recharge-Storefront-Access-Token":f}:{},...c?{"X-Recharge-Sdk-App-Name":c}:{},...l?{"X-Recharge-Sdk-App-Version":l}:{},"X-Recharge-Sdk-Version":"1.35.0",...a||{}};return ue(r,`${s}${e}`,{id:t,query:n,data:i,headers:h})}var Fh=Object.freeze({__proto__:null,loginCustomerPortal:Rh,loginShopifyApi:Ah,loginShopifyAppProxy:Eh,loginWithShopifyCustomerAccount:Sh,loginWithShopifyStorefront:eo,sendPasswordlessCode:Oh,sendPasswordlessCodeAppProxy:Ih,validatePasswordlessCode:Ph,validatePasswordlessCodeAppProxy:xh}),ro={},Hn={},se={},Mh=typeof U=="object"&&U&&U.Object===Object&&U,to=Mh,Dh=to,Ch=typeof self=="object"&&self&&self.Object===Object&&self,Nh=Dh||Ch||Function("return this")(),fe=Nh,Bh=fe,Uh=Bh.Symbol,yt=Uh,no=yt,io=Object.prototype,qh=io.hasOwnProperty,Lh=io.toString,Ar=no?no.toStringTag:void 0;function kh(r){var e=qh.call(r,Ar),t=r[Ar];try{r[Ar]=void 0;var n=!0}catch{}var i=Lh.call(r);return n&&(e?r[Ar]=t:delete r[Ar]),i}var jh=kh,Vh=Object.prototype,Gh=Vh.toString;function Hh(r){return Gh.call(r)}var Wh=Hh,ao=yt,Xh=jh,zh=Wh,Yh="[object Null]",Kh="[object Undefined]",oo=ao?ao.toStringTag:void 0;function Zh(r){return r==null?r===void 0?Kh:Yh:oo&&oo in Object(r)?Xh(r):zh(r)}var ge=Zh;function Jh(r){return r!=null&&typeof r=="object"}var ve=Jh,Qh=ge,ed=ve,rd="[object Number]";function td(r){return typeof r=="number"||ed(r)&&Qh(r)==rd}var gt=td,D={};function nd(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var Ze=nd,id=ge,ad=Ze,od="[object AsyncFunction]",ud="[object Function]",sd="[object GeneratorFunction]",fd="[object Proxy]";function cd(r){if(!ad(r))return!1;var e=id(r);return e==ud||e==sd||e==od||e==fd}var Wn=cd,ld=fe,hd=ld["__core-js_shared__"],dd=hd,Xn=dd,uo=function(){var r=/[^.]+$/.exec(Xn&&Xn.keys&&Xn.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function pd(r){return!!uo&&uo in r}var yd=pd,gd=Function.prototype,vd=gd.toString;function _d(r){if(r!=null){try{return vd.call(r)}catch{}try{return r+""}catch{}}return""}var so=_d,md=Wn,wd=yd,bd=Ze,$d=so,Ed=/[\\^$.*+?()[\]{}|]/g,Ad=/^\[object .+?Constructor\]$/,Sd=Function.prototype,Od=Object.prototype,Id=Sd.toString,Pd=Od.hasOwnProperty,xd=RegExp("^"+Id.call(Pd).replace(Ed,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Td(r){if(!bd(r)||wd(r))return!1;var e=md(r)?xd:Ad;return e.test($d(r))}var Rd=Td;function Fd(r,e){return r?.[e]}var Md=Fd,Dd=Rd,Cd=Md;function Nd(r,e){var t=Cd(r,e);return Dd(t)?t:void 0}var Fe=Nd,Bd=Fe,Ud=function(){try{var r=Bd(Object,"defineProperty");return r({},"",{}),r}catch{}}(),fo=Ud,co=fo;function qd(r,e,t){e=="__proto__"&&co?co(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var lo=qd;function Ld(r,e){return r===e||r!==r&&e!==e}var vt=Ld,kd=lo,jd=vt,Vd=Object.prototype,Gd=Vd.hasOwnProperty;function Hd(r,e,t){var n=r[e];(!(Gd.call(r,e)&&jd(n,t))||t===void 0&&!(e in r))&&kd(r,e,t)}var Wd=Hd,Xd=Wd,zd=lo;function Yd(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?zd(t,u,f):Xd(t,u,f)}return t}var Kd=Yd;function Zd(r){return r}var _t=Zd;function Jd(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 Qd=Jd,ep=Qd,ho=Math.max;function rp(r,e,t){return e=ho(e===void 0?r.length-1:e,0),function(){for(var n=arguments,i=-1,a=ho(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),ep(r,this,u)}}var tp=rp;function np(r){return function(){return r}}var ip=np,ap=ip,po=fo,op=_t,up=po?function(r,e){return po(r,"toString",{configurable:!0,enumerable:!1,value:ap(e),writable:!0})}:op,sp=up,fp=800,cp=16,lp=Date.now;function hp(r){var e=0,t=0;return function(){var n=lp(),i=cp-(n-t);if(t=n,i>0){if(++e>=fp)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}var dp=hp,pp=sp,yp=dp,gp=yp(pp),vp=gp,_p=_t,mp=tp,wp=vp;function bp(r,e){return wp(mp(r,e,_p),r+"")}var $p=bp,Ep=9007199254740991;function Ap(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Ep}var zn=Ap,Sp=Wn,Op=zn;function Ip(r){return r!=null&&Op(r.length)&&!Sp(r)}var Sr=Ip,Pp=9007199254740991,xp=/^(?:0|[1-9]\d*)$/;function Tp(r,e){var t=typeof r;return e=e??Pp,!!e&&(t=="number"||t!="symbol"&&xp.test(r))&&r>-1&&r%1==0&&r<e}var Yn=Tp,Rp=vt,Fp=Sr,Mp=Yn,Dp=Ze;function Cp(r,e,t){if(!Dp(t))return!1;var n=typeof e;return(n=="number"?Fp(t)&&Mp(e,t.length):n=="string"&&e in t)?Rp(t[e],r):!1}var yo=Cp,Np=$p,Bp=yo;function Up(r){return Np(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&&Bp(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 qp=Up;function Lp(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var go=Lp,kp=ge,jp=ve,Vp="[object Arguments]";function Gp(r){return jp(r)&&kp(r)==Vp}var Hp=Gp,vo=Hp,Wp=ve,_o=Object.prototype,Xp=_o.hasOwnProperty,zp=_o.propertyIsEnumerable,Yp=vo(function(){return arguments}())?vo:function(r){return Wp(r)&&Xp.call(r,"callee")&&!zp.call(r,"callee")},mo=Yp,Kp=Array.isArray,V=Kp,mt={exports:{}};function Zp(){return!1}var Jp=Zp;mt.exports,function(r,e){var t=fe,n=Jp,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,c=f||n;r.exports=c}(mt,mt.exports);var wo=mt.exports,Qp=ge,ey=zn,ry=ve,ty="[object Arguments]",ny="[object Array]",iy="[object Boolean]",ay="[object Date]",oy="[object Error]",uy="[object Function]",sy="[object Map]",fy="[object Number]",cy="[object Object]",ly="[object RegExp]",hy="[object Set]",dy="[object String]",py="[object WeakMap]",yy="[object ArrayBuffer]",gy="[object DataView]",vy="[object Float32Array]",_y="[object Float64Array]",my="[object Int8Array]",wy="[object Int16Array]",by="[object Int32Array]",$y="[object Uint8Array]",Ey="[object Uint8ClampedArray]",Ay="[object Uint16Array]",Sy="[object Uint32Array]",R={};R[vy]=R[_y]=R[my]=R[wy]=R[by]=R[$y]=R[Ey]=R[Ay]=R[Sy]=!0,R[ty]=R[ny]=R[yy]=R[iy]=R[gy]=R[ay]=R[oy]=R[uy]=R[sy]=R[fy]=R[cy]=R[ly]=R[hy]=R[dy]=R[py]=!1;function Oy(r){return ry(r)&&ey(r.length)&&!!R[Qp(r)]}var Iy=Oy;function Py(r){return function(e){return r(e)}}var xy=Py,wt={exports:{}};wt.exports,function(r,e){var t=to,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}(wt,wt.exports);var Ty=wt.exports,Ry=Iy,Fy=xy,bo=Ty,$o=bo&&bo.isTypedArray,My=$o?Fy($o):Ry,Eo=My,Dy=go,Cy=mo,Ny=V,By=wo,Uy=Yn,qy=Eo,Ly=Object.prototype,ky=Ly.hasOwnProperty;function jy(r,e){var t=Ny(r),n=!t&&Cy(r),i=!t&&!n&&By(r),a=!t&&!n&&!i&&qy(r),o=t||n||i||a,u=o?Dy(r.length,String):[],f=u.length;for(var c in r)(e||ky.call(r,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||a&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Uy(c,f)))&&u.push(c);return u}var Ao=jy,Vy=Object.prototype;function Gy(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Vy;return r===t}var So=Gy;function Hy(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var Wy=Hy,Xy=Ze,zy=So,Yy=Wy,Ky=Object.prototype,Zy=Ky.hasOwnProperty;function Jy(r){if(!Xy(r))return Yy(r);var e=zy(r),t=[];for(var n in r)n=="constructor"&&(e||!Zy.call(r,n))||t.push(n);return t}var Qy=Jy,eg=Ao,rg=Qy,tg=Sr;function ng(r){return tg(r)?eg(r,!0):rg(r)}var ig=ng,ag=Kd,og=qp,ug=ig,sg=og(function(r,e){ag(e,ug(e),r)}),fg=sg,cg=fg,bt={},Me={};function lg(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 hg=lg;function dg(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 pg=dg,yg=pg,gg=yg(),vg=gg;function _g(r,e){return function(t){return r(e(t))}}var mg=_g,wg=mg,bg=wg(Object.keys,Object),$g=bg,Eg=So,Ag=$g,Sg=Object.prototype,Og=Sg.hasOwnProperty;function Ig(r){if(!Eg(r))return Ag(r);var e=[];for(var t in Object(r))Og.call(r,t)&&t!="constructor"&&e.push(t);return e}var Pg=Ig,xg=Ao,Tg=Pg,Rg=Sr;function Fg(r){return Rg(r)?xg(r):Tg(r)}var $t=Fg,Mg=vg,Dg=$t;function Cg(r,e){return r&&Mg(r,e,Dg)}var Ng=Cg,Bg=Sr;function Ug(r,e){return function(t,n){if(t==null)return t;if(!Bg(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 qg=Ug,Lg=Ng,kg=qg,jg=kg(Lg),Kn=jg,Vg=Kn;function Gg(r,e){var t=!0;return Vg(r,function(n,i,a){return t=!!e(n,i,a),t}),t}var Hg=Gg;function Wg(){this.__data__=[],this.size=0}var Xg=Wg,zg=vt;function Yg(r,e){for(var t=r.length;t--;)if(zg(r[t][0],e))return t;return-1}var Et=Yg,Kg=Et,Zg=Array.prototype,Jg=Zg.splice;function Qg(r){var e=this.__data__,t=Kg(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():Jg.call(e,t,1),--this.size,!0}var ev=Qg,rv=Et;function tv(r){var e=this.__data__,t=rv(e,r);return t<0?void 0:e[t][1]}var nv=tv,iv=Et;function av(r){return iv(this.__data__,r)>-1}var ov=av,uv=Et;function sv(r,e){var t=this.__data__,n=uv(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var fv=sv,cv=Xg,lv=ev,hv=nv,dv=ov,pv=fv;function Je(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])}}Je.prototype.clear=cv,Je.prototype.delete=lv,Je.prototype.get=hv,Je.prototype.has=dv,Je.prototype.set=pv;var At=Je,yv=At;function gv(){this.__data__=new yv,this.size=0}var vv=gv;function _v(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var mv=_v;function wv(r){return this.__data__.get(r)}var bv=wv;function $v(r){return this.__data__.has(r)}var Ev=$v,Av=Fe,Sv=fe,Ov=Av(Sv,"Map"),Zn=Ov,Iv=Fe,Pv=Iv(Object,"create"),St=Pv,Oo=St;function xv(){this.__data__=Oo?Oo(null):{},this.size=0}var Tv=xv;function Rv(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var Fv=Rv,Mv=St,Dv="__lodash_hash_undefined__",Cv=Object.prototype,Nv=Cv.hasOwnProperty;function Bv(r){var e=this.__data__;if(Mv){var t=e[r];return t===Dv?void 0:t}return Nv.call(e,r)?e[r]:void 0}var Uv=Bv,qv=St,Lv=Object.prototype,kv=Lv.hasOwnProperty;function jv(r){var e=this.__data__;return qv?e[r]!==void 0:kv.call(e,r)}var Vv=jv,Gv=St,Hv="__lodash_hash_undefined__";function Wv(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Gv&&e===void 0?Hv:e,this}var Xv=Wv,zv=Tv,Yv=Fv,Kv=Uv,Zv=Vv,Jv=Xv;function Qe(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])}}Qe.prototype.clear=zv,Qe.prototype.delete=Yv,Qe.prototype.get=Kv,Qe.prototype.has=Zv,Qe.prototype.set=Jv;var Qv=Qe,Io=Qv,e_=At,r_=Zn;function t_(){this.size=0,this.__data__={hash:new Io,map:new(r_||e_),string:new Io}}var n_=t_;function i_(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var a_=i_,o_=a_;function u_(r,e){var t=r.__data__;return o_(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Ot=u_,s_=Ot;function f_(r){var e=s_(this,r).delete(r);return this.size-=e?1:0,e}var c_=f_,l_=Ot;function h_(r){return l_(this,r).get(r)}var d_=h_,p_=Ot;function y_(r){return p_(this,r).has(r)}var g_=y_,v_=Ot;function __(r,e){var t=v_(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var m_=__,w_=n_,b_=c_,$_=d_,E_=g_,A_=m_;function er(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}er.prototype.clear=w_,er.prototype.delete=b_,er.prototype.get=$_,er.prototype.has=E_,er.prototype.set=A_;var Jn=er,S_=At,O_=Zn,I_=Jn,P_=200;function x_(r,e){var t=this.__data__;if(t instanceof S_){var n=t.__data__;if(!O_||n.length<P_-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new I_(n)}return t.set(r,e),this.size=t.size,this}var T_=x_,R_=At,F_=vv,M_=mv,D_=bv,C_=Ev,N_=T_;function rr(r){var e=this.__data__=new R_(r);this.size=e.size}rr.prototype.clear=F_,rr.prototype.delete=M_,rr.prototype.get=D_,rr.prototype.has=C_,rr.prototype.set=N_;var Po=rr,B_="__lodash_hash_undefined__";function U_(r){return this.__data__.set(r,B_),this}var q_=U_;function L_(r){return this.__data__.has(r)}var k_=L_,j_=Jn,V_=q_,G_=k_;function It(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new j_;++e<t;)this.add(r[e])}It.prototype.add=It.prototype.push=V_,It.prototype.has=G_;var H_=It;function W_(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 X_=W_;function z_(r,e){return r.has(e)}var Y_=z_,K_=H_,Z_=X_,J_=Y_,Q_=1,em=2;function rm(r,e,t,n,i,a){var o=t&Q_,u=r.length,f=e.length;if(u!=f&&!(o&&f>u))return!1;var c=a.get(r),l=a.get(e);if(c&&l)return c==e&&l==r;var s=-1,h=!0,y=t&em?new K_:void 0;for(a.set(r,e),a.set(e,r);++s<u;){var w=r[s],S=e[s];if(n)var O=o?n(S,w,s,e,r,a):n(w,S,s,r,e,a);if(O!==void 0){if(O)continue;h=!1;break}if(y){if(!Z_(e,function(b,E){if(!J_(y,E)&&(w===b||i(w,b,t,n,a)))return y.push(E)})){h=!1;break}}else if(!(w===S||i(w,S,t,n,a))){h=!1;break}}return a.delete(r),a.delete(e),h}var xo=rm,tm=fe,nm=tm.Uint8Array,im=nm;function am(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}var om=am;function um(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var sm=um,To=yt,Ro=im,fm=vt,cm=xo,lm=om,hm=sm,dm=1,pm=2,ym="[object Boolean]",gm="[object Date]",vm="[object Error]",_m="[object Map]",mm="[object Number]",wm="[object RegExp]",bm="[object Set]",$m="[object String]",Em="[object Symbol]",Am="[object ArrayBuffer]",Sm="[object DataView]",Fo=To?To.prototype:void 0,Qn=Fo?Fo.valueOf:void 0;function Om(r,e,t,n,i,a,o){switch(t){case Sm:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case Am:return!(r.byteLength!=e.byteLength||!a(new Ro(r),new Ro(e)));case ym:case gm:case mm:return fm(+r,+e);case vm:return r.name==e.name&&r.message==e.message;case wm:case $m:return r==e+"";case _m:var u=lm;case bm:var f=n&dm;if(u||(u=hm),r.size!=e.size&&!f)return!1;var c=o.get(r);if(c)return c==e;n|=pm,o.set(r,e);var l=cm(u(r),u(e),n,i,a,o);return o.delete(r),l;case Em:if(Qn)return Qn.call(r)==Qn.call(e)}return!1}var Im=Om;function Pm(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}var xm=Pm,Tm=xm,Rm=V;function Fm(r,e,t){var n=e(r);return Rm(r)?n:Tm(n,t(r))}var Mm=Fm;function Dm(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 Cm=Dm;function Nm(){return[]}var Bm=Nm,Um=Cm,qm=Bm,Lm=Object.prototype,km=Lm.propertyIsEnumerable,Mo=Object.getOwnPropertySymbols,jm=Mo?function(r){return r==null?[]:(r=Object(r),Um(Mo(r),function(e){return km.call(r,e)}))}:qm,Vm=jm,Gm=Mm,Hm=Vm,Wm=$t;function Xm(r){return Gm(r,Wm,Hm)}var zm=Xm,Do=zm,Ym=1,Km=Object.prototype,Zm=Km.hasOwnProperty;function Jm(r,e,t,n,i,a){var o=t&Ym,u=Do(r),f=u.length,c=Do(e),l=c.length;if(f!=l&&!o)return!1;for(var s=f;s--;){var h=u[s];if(!(o?h in e:Zm.call(e,h)))return!1}var y=a.get(r),w=a.get(e);if(y&&w)return y==e&&w==r;var S=!0;a.set(r,e),a.set(e,r);for(var O=o;++s<f;){h=u[s];var b=r[h],E=e[h];if(n)var d=o?n(E,b,h,e,r,a):n(b,E,h,r,e,a);if(!(d===void 0?b===E||i(b,E,t,n,a):d)){S=!1;break}O||(O=h=="constructor")}if(S&&!O){var I=r.constructor,T=e.constructor;I!=T&&"constructor"in r&&"constructor"in e&&!(typeof I=="function"&&I instanceof I&&typeof T=="function"&&T instanceof T)&&(S=!1)}return a.delete(r),a.delete(e),S}var Qm=Jm,ew=Fe,rw=fe,tw=ew(rw,"DataView"),nw=tw,iw=Fe,aw=fe,ow=iw(aw,"Promise"),uw=ow,sw=Fe,fw=fe,cw=sw(fw,"Set"),lw=cw,hw=Fe,dw=fe,pw=hw(dw,"WeakMap"),yw=pw,ei=nw,ri=Zn,ti=uw,ni=lw,ii=yw,Co=ge,tr=so,No="[object Map]",gw="[object Object]",Bo="[object Promise]",Uo="[object Set]",qo="[object WeakMap]",Lo="[object DataView]",vw=tr(ei),_w=tr(ri),mw=tr(ti),ww=tr(ni),bw=tr(ii),De=Co;(ei&&De(new ei(new ArrayBuffer(1)))!=Lo||ri&&De(new ri)!=No||ti&&De(ti.resolve())!=Bo||ni&&De(new ni)!=Uo||ii&&De(new ii)!=qo)&&(De=function(r){var e=Co(r),t=e==gw?r.constructor:void 0,n=t?tr(t):"";if(n)switch(n){case vw:return Lo;case _w:return No;case mw:return Bo;case ww:return Uo;case bw:return qo}return e});var $w=De,ai=Po,Ew=xo,Aw=Im,Sw=Qm,ko=$w,jo=V,Vo=wo,Ow=Eo,Iw=1,Go="[object Arguments]",Ho="[object Array]",Pt="[object Object]",Pw=Object.prototype,Wo=Pw.hasOwnProperty;function xw(r,e,t,n,i,a){var o=jo(r),u=jo(e),f=o?Ho:ko(r),c=u?Ho:ko(e);f=f==Go?Pt:f,c=c==Go?Pt:c;var l=f==Pt,s=c==Pt,h=f==c;if(h&&Vo(r)){if(!Vo(e))return!1;o=!0,l=!1}if(h&&!l)return a||(a=new ai),o||Ow(r)?Ew(r,e,t,n,i,a):Aw(r,e,f,t,n,i,a);if(!(t&Iw)){var y=l&&Wo.call(r,"__wrapped__"),w=s&&Wo.call(e,"__wrapped__");if(y||w){var S=y?r.value():r,O=w?e.value():e;return a||(a=new ai),i(S,O,t,n,a)}}return h?(a||(a=new ai),Sw(r,e,t,n,i,a)):!1}var Tw=xw,Rw=Tw,Xo=ve;function zo(r,e,t,n,i){return r===e?!0:r==null||e==null||!Xo(r)&&!Xo(e)?r!==r&&e!==e:Rw(r,e,t,n,zo,i)}var Yo=zo,Fw=Po,Mw=Yo,Dw=1,Cw=2;function Nw(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],c=r[f],l=u[1];if(o&&u[2]){if(c===void 0&&!(f in r))return!1}else{var s=new Fw;if(n)var h=n(c,l,f,r,e,s);if(!(h===void 0?Mw(l,c,Dw|Cw,n,s):h))return!1}}return!0}var Bw=Nw,Uw=Ze;function qw(r){return r===r&&!Uw(r)}var Ko=qw,Lw=Ko,kw=$t;function jw(r){for(var e=kw(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,Lw(i)]}return e}var Vw=jw;function Gw(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}var Zo=Gw,Hw=Bw,Ww=Vw,Xw=Zo;function zw(r){var e=Ww(r);return e.length==1&&e[0][2]?Xw(e[0][0],e[0][1]):function(t){return t===r||Hw(t,r,e)}}var Yw=zw,Kw=ge,Zw=ve,Jw="[object Symbol]";function Qw(r){return typeof r=="symbol"||Zw(r)&&Kw(r)==Jw}var xt=Qw,e0=V,r0=xt,t0=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n0=/^\w*$/;function i0(r,e){if(e0(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||r0(r)?!0:n0.test(r)||!t0.test(r)||e!=null&&r in Object(e)}var oi=i0,Jo=Jn,a0="Expected a function";function ui(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(a0);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(ui.Cache||Jo),t}ui.Cache=Jo;var o0=ui,u0=o0,s0=500;function f0(r){var e=u0(r,function(n){return t.size===s0&&t.clear(),n}),t=e.cache;return e}var c0=f0,l0=c0,h0=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,d0=/\\(\\)?/g,p0=l0(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(h0,function(t,n,i,a){e.push(i?a.replace(d0,"$1"):n||t)}),e}),y0=p0;function g0(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 si=g0,Qo=yt,v0=si,_0=V,m0=xt,w0=1/0,eu=Qo?Qo.prototype:void 0,ru=eu?eu.toString:void 0;function tu(r){if(typeof r=="string")return r;if(_0(r))return v0(r,tu)+"";if(m0(r))return ru?ru.call(r):"";var e=r+"";return e=="0"&&1/r==-w0?"-0":e}var b0=tu,$0=b0;function E0(r){return r==null?"":$0(r)}var A0=E0,S0=V,O0=oi,I0=y0,P0=A0;function x0(r,e){return S0(r)?r:O0(r,e)?[r]:I0(P0(r))}var nu=x0,T0=xt,R0=1/0;function F0(r){if(typeof r=="string"||T0(r))return r;var e=r+"";return e=="0"&&1/r==-R0?"-0":e}var Tt=F0,M0=nu,D0=Tt;function C0(r,e){e=M0(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[D0(e[t++])];return t&&t==n?r:void 0}var iu=C0,N0=iu;function B0(r,e,t){var n=r==null?void 0:N0(r,e);return n===void 0?t:n}var U0=B0;function q0(r,e){return r!=null&&e in Object(r)}var L0=q0,k0=nu,j0=mo,V0=V,G0=Yn,H0=zn,W0=Tt;function X0(r,e,t){e=k0(e,r);for(var n=-1,i=e.length,a=!1;++n<i;){var o=W0(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&&H0(i)&&G0(o,i)&&(V0(r)||j0(r)))}var z0=X0,Y0=L0,K0=z0;function Z0(r,e){return r!=null&&K0(r,e,Y0)}var J0=Z0,Q0=Yo,eb=U0,rb=J0,tb=oi,nb=Ko,ib=Zo,ab=Tt,ob=1,ub=2;function sb(r,e){return tb(r)&&nb(e)?ib(ab(r),e):function(t){var n=eb(t,r);return n===void 0&&n===e?rb(t,r):Q0(e,n,ob|ub)}}var fb=sb;function cb(r){return function(e){return e?.[r]}}var lb=cb,hb=iu;function db(r){return function(e){return hb(e,r)}}var pb=db,yb=lb,gb=pb,vb=oi,_b=Tt;function mb(r){return vb(r)?yb(_b(r)):gb(r)}var wb=mb,bb=Yw,$b=fb,Eb=_t,Ab=V,Sb=wb;function Ob(r){return typeof r=="function"?r:r==null?Eb:typeof r=="object"?Ab(r)?$b(r[0],r[1]):bb(r):Sb(r)}var au=Ob,Ib=hg,Pb=Hg,xb=au,Tb=V,Rb=yo;function Fb(r,e,t){var n=Tb(r)?Ib:Pb;return t&&Rb(r,e,t)&&(e=void 0),n(r,xb(e))}var fi=Fb;Object.defineProperty(Me,"__esModule",{value:!0}),Me.calculatePadding=Nb,Me.slicePadding=Bb;var Mb=fi,Db=Cb(Mb);function Cb(r){return r&&r.__esModule?r:{default:r}}function Nb(r){switch(r%4){case 0:return 0;case 1:return 3;case 2:return 2;case 3:return 1;default:return null}}function Bb(r,e){var t=r.slice(e),n=(0,Db.default)(t.buffer(),function(i){return i===0});if(n!==!0)throw new Error("XDR Read Error: invalid padding")}Object.defineProperty(bt,"__esModule",{value:!0}),bt.Cursor=void 0;var Ub=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}}(),qb=Me;function Lb(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var ci=function(){function r(e){Lb(this,r),e instanceof p||(e=typeof e=="number"?p.alloc(e):p.from(e)),this._setBuffer(e),this.rewind()}return Ub(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,qb.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){ci.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){ci.prototype[e]=function(n){return this.buffer()[e](n,this.tell()),this.seek("+",r[0]),this}})}),bt.Cursor=ci,Object.defineProperty(D,"__esModule",{value:!0}),D.default=Xb;var kb=cg,ou=su(kb),jb=Wn,Vb=su(jb),uu=bt;function su(r){return r&&r.__esModule?r:{default:r}}var Gb=Math.pow(2,16),Hb={toXDR:function(e){var t=new uu.Cursor(Gb);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 uu.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}}},Wb={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 Xb(r){(0,ou.default)(r,Hb),(0,Vb.default)(r)&&(0,ou.default)(r.prototype,Wb)}Object.defineProperty(se,"__esModule",{value:!0}),se.Int=void 0;var zb=gt,fu=cu(zb),Yb=D,Kb=cu(Yb);function cu(r){return r&&r.__esModule?r:{default:r}}var Or=se.Int={read:function(e){return e.readInt32BE()},write:function(e,t){if(!(0,fu.default)(e))throw new Error("XDR Write Error: not a number");if(Math.floor(e)!==e)throw new Error("XDR Write Error: not an integer");t.writeInt32BE(e)},isValid:function(e){return!(0,fu.default)(e)||Math.floor(e)!==e?!1:e>=Or.MIN_VALUE&&e<=Or.MAX_VALUE}};Or.MAX_VALUE=Math.pow(2,31)-1,Or.MIN_VALUE=-Math.pow(2,31),(0,Kb.default)(Or);var Rt={};function Zb(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 lu={exports:{}};(function(r){/**
|
|
21
21
|
* @license Long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
|
|
22
22
|
* Released under the Apache License, Version 2.0
|
|
23
23
|
* see: https://github.com/dcodeIO/Long.js for details
|