@rechargeapps/storefront-client 0.13.0 → 0.14.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/customer.js +3 -2
- package/dist/cjs/api/customer.js.map +1 -1
- package/dist/cjs/api/membership.js.map +1 -1
- package/dist/esm/api/customer.js +3 -2
- package/dist/esm/api/customer.js.map +1 -1
- package/dist/esm/api/membership.js.map +1 -1
- package/dist/index.d.ts +208 -188
- package/dist/umd/recharge-client.min.js +2 -2
- package/package.json +2 -2
package/dist/cjs/api/customer.js
CHANGED
|
@@ -4,13 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var request = require('../utils/request.js');
|
|
6
6
|
|
|
7
|
-
async function getCustomer(session) {
|
|
7
|
+
async function getCustomer(session, options) {
|
|
8
8
|
const id = session.customerId;
|
|
9
9
|
if (!id) {
|
|
10
10
|
throw new Error("Not logged in.");
|
|
11
11
|
}
|
|
12
12
|
const { customer } = await request.rechargeApiRequest("get", `/customers`, {
|
|
13
|
-
id
|
|
13
|
+
id,
|
|
14
|
+
query: { include: options == null ? void 0 : options.include }
|
|
14
15
|
}, session);
|
|
15
16
|
return customer;
|
|
16
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.js","sources":["../../../src/api/customer.ts"],"sourcesContent":["import { Session } from '../types/session';\nimport {\n Customer,\n CustomerDeliveryScheduleParams,\n CustomerDeliveryScheduleResponse,\n Delivery,\n UpdateCustomerRequest,\n} from '../types/customer';\nimport { rechargeApiRequest } from '../utils/request';\n\nexport async function getCustomer(session: Session): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'get',\n `/customers`,\n {\n id,\n },\n session\n );\n return customer;\n}\n\nexport async function updateCustomer(session: Session, updateRequest: UpdateCustomerRequest): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'put',\n `/customers`,\n { id, data: updateRequest },\n session\n );\n return customer;\n}\n\nexport async function getDeliverySchedule(\n session: Session,\n query?: CustomerDeliveryScheduleParams\n): Promise<Delivery[]> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { deliveries } = await rechargeApiRequest<CustomerDeliveryScheduleResponse>(\n 'get',\n `/customers/${id}/delivery_schedule`,\n { query },\n session\n );\n return deliveries;\n}\n"],"names":["rechargeApiRequest"],"mappings":";;;;;;AACO,eAAe,WAAW,CAAC,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"customer.js","sources":["../../../src/api/customer.ts"],"sourcesContent":["import { Session } from '../types/session';\nimport {\n Customer,\n CustomerDeliveryScheduleParams,\n CustomerDeliveryScheduleResponse,\n Delivery,\n GetCustomerOptions,\n UpdateCustomerRequest,\n} from '../types/customer';\nimport { rechargeApiRequest } from '../utils/request';\n\nexport async function getCustomer(session: Session, options?: GetCustomerOptions): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'get',\n `/customers`,\n {\n id,\n query: { include: options?.include },\n },\n session\n );\n return customer;\n}\n\nexport async function updateCustomer(session: Session, updateRequest: UpdateCustomerRequest): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'put',\n `/customers`,\n { id, data: updateRequest },\n session\n );\n return customer;\n}\n\nexport async function getDeliverySchedule(\n session: Session,\n query?: CustomerDeliveryScheduleParams\n): Promise<Delivery[]> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { deliveries } = await rechargeApiRequest<CustomerDeliveryScheduleResponse>(\n 'get',\n `/customers/${id}/delivery_schedule`,\n { query },\n session\n );\n return deliveries;\n}\n"],"names":["rechargeApiRequest"],"mappings":";;;;;;AACO,eAAe,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE;AACpD,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;AAChC,EAAE,IAAI,CAAC,EAAE,EAAE;AACX,IAAI,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACtC,GAAG;AACH,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAMA,0BAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE;AACrE,IAAI,EAAE;AACN,IAAI,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,OAAO,EAAE;AAClE,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,QAAQ,CAAC;AAClB,CAAC;AACM,eAAe,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE;AAC7D,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;AAChC,EAAE,IAAI,CAAC,EAAE,EAAE;AACX,IAAI,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACtC,GAAG;AACH,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAMA,0BAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;AAC3G,EAAE,OAAO,QAAQ,CAAC;AAClB,CAAC;AACM,eAAe,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE;AAC1D,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;AAChC,EAAE,IAAI,CAAC,EAAE,EAAE;AACX,IAAI,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACtC,GAAG;AACH,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAMA,0BAAkB,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACnH,EAAE,OAAO,UAAU,CAAC;AACpB;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"membership.js","sources":["../../../src/api/membership.ts"],"sourcesContent":["import {\n ActivateMembershipRequest,\n CancelMembershipRequest,\n MembershipListParams,\n MembershipListResponse,\n MembershipResponse,\n} from '../types/membership';\nimport { Session } from '../types/session';\nimport { rechargeApiRequest } from '../utils/request';\n\n/** Retrieves membership information for passed in id */\nexport async function getMembership(session: Session, id: string | number) {\n const { membership } = await rechargeApiRequest<MembershipResponse>('get', `/memberships`, { id }, session);\n return membership;\n}\n\n/** Retrieves a list of memberships */\nexport function listMemberships(session: Session, query?: MembershipListParams) {\n return rechargeApiRequest<MembershipListResponse>('get', `/memberships`, { query }, session);\n}\n\n/** Cancels a membership */\nexport async function cancelMembership(session: Session, id: string | number, cancelRequest: CancelMembershipRequest) {\n const { membership } = await rechargeApiRequest<MembershipResponse>(\n 'post',\n `/memberships/${id}/cancel`,\n {\n data: cancelRequest,\n },\n session\n );\n return membership;\n}\n\n/** Activates a membership */\nexport async function activateMembership(\n session: Session,\n id: string | number,\n activateRequest: ActivateMembershipRequest\n) {\n const { membership } = await rechargeApiRequest<MembershipResponse>(\n 'post',\n `/memberships/${id}/activate`,\n {\n data: activateRequest,\n },\n session\n );\n return membership;\n}\n"],"names":["rechargeApiRequest"],"mappings":";;;;;;AACO,eAAe,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE;AACjD,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAMA,0BAAkB,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC1F,EAAE,OAAO,UAAU,CAAC;AACpB,CAAC;AACM,SAAS,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE;AAChD,EAAE,OAAOA,0BAAkB,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC;AACM,eAAe,gBAAgB,CAAC,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE;AACnE,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE;AACvF,IAAI,IAAI,EAAE,aAAa;AACvB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,UAAU,CAAC;AACpB,CAAC;AACM,eAAe,kBAAkB,CAAC,OAAO,EAAE,EAAE,EAAE,eAAe,EAAE;AACvE,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE;AACzF,IAAI,IAAI,EAAE,eAAe;AACzB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,UAAU,CAAC;AACpB;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"membership.js","sources":["../../../src/api/membership.ts"],"sourcesContent":["import {\n ActivateMembershipRequest,\n CancelMembershipRequest,\n MembershipListParams,\n MembershipListResponse,\n MembershipResponse,\n} from '../types/membership';\nimport { Session } from '../types/session';\nimport { rechargeApiRequest } from '../utils/request';\n\n/** @internal Retrieves membership information for passed in id */\nexport async function getMembership(session: Session, id: string | number) {\n const { membership } = await rechargeApiRequest<MembershipResponse>('get', `/memberships`, { id }, session);\n return membership;\n}\n\n/** @internal Retrieves a list of memberships */\nexport function listMemberships(session: Session, query?: MembershipListParams) {\n return rechargeApiRequest<MembershipListResponse>('get', `/memberships`, { query }, session);\n}\n\n/** @internal Cancels a membership */\nexport async function cancelMembership(session: Session, id: string | number, cancelRequest: CancelMembershipRequest) {\n const { membership } = await rechargeApiRequest<MembershipResponse>(\n 'post',\n `/memberships/${id}/cancel`,\n {\n data: cancelRequest,\n },\n session\n );\n return membership;\n}\n\n/** @internal Activates a membership */\nexport async function activateMembership(\n session: Session,\n id: string | number,\n activateRequest: ActivateMembershipRequest\n) {\n const { membership } = await rechargeApiRequest<MembershipResponse>(\n 'post',\n `/memberships/${id}/activate`,\n {\n data: activateRequest,\n },\n session\n );\n return membership;\n}\n"],"names":["rechargeApiRequest"],"mappings":";;;;;;AACO,eAAe,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE;AACjD,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAMA,0BAAkB,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC1F,EAAE,OAAO,UAAU,CAAC;AACpB,CAAC;AACM,SAAS,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE;AAChD,EAAE,OAAOA,0BAAkB,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC;AACM,eAAe,gBAAgB,CAAC,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE;AACnE,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE;AACvF,IAAI,IAAI,EAAE,aAAa;AACvB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,UAAU,CAAC;AACpB,CAAC;AACM,eAAe,kBAAkB,CAAC,OAAO,EAAE,EAAE,EAAE,eAAe,EAAE;AACvE,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE;AACzF,IAAI,IAAI,EAAE,eAAe;AACzB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,UAAU,CAAC;AACpB;;;;;;;"}
|
package/dist/esm/api/customer.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { rechargeApiRequest } from '../utils/request.js';
|
|
2
2
|
|
|
3
|
-
async function getCustomer(session) {
|
|
3
|
+
async function getCustomer(session, options) {
|
|
4
4
|
const id = session.customerId;
|
|
5
5
|
if (!id) {
|
|
6
6
|
throw new Error("Not logged in.");
|
|
7
7
|
}
|
|
8
8
|
const { customer } = await rechargeApiRequest("get", `/customers`, {
|
|
9
|
-
id
|
|
9
|
+
id,
|
|
10
|
+
query: { include: options == null ? void 0 : options.include }
|
|
10
11
|
}, session);
|
|
11
12
|
return customer;
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.js","sources":["../../../src/api/customer.ts"],"sourcesContent":["import { Session } from '../types/session';\nimport {\n Customer,\n CustomerDeliveryScheduleParams,\n CustomerDeliveryScheduleResponse,\n Delivery,\n UpdateCustomerRequest,\n} from '../types/customer';\nimport { rechargeApiRequest } from '../utils/request';\n\nexport async function getCustomer(session: Session): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'get',\n `/customers`,\n {\n id,\n },\n session\n );\n return customer;\n}\n\nexport async function updateCustomer(session: Session, updateRequest: UpdateCustomerRequest): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'put',\n `/customers`,\n { id, data: updateRequest },\n session\n );\n return customer;\n}\n\nexport async function getDeliverySchedule(\n session: Session,\n query?: CustomerDeliveryScheduleParams\n): Promise<Delivery[]> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { deliveries } = await rechargeApiRequest<CustomerDeliveryScheduleResponse>(\n 'get',\n `/customers/${id}/delivery_schedule`,\n { query },\n session\n );\n return deliveries;\n}\n"],"names":[],"mappings":";;AACO,eAAe,WAAW,CAAC,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"customer.js","sources":["../../../src/api/customer.ts"],"sourcesContent":["import { Session } from '../types/session';\nimport {\n Customer,\n CustomerDeliveryScheduleParams,\n CustomerDeliveryScheduleResponse,\n Delivery,\n GetCustomerOptions,\n UpdateCustomerRequest,\n} from '../types/customer';\nimport { rechargeApiRequest } from '../utils/request';\n\nexport async function getCustomer(session: Session, options?: GetCustomerOptions): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'get',\n `/customers`,\n {\n id,\n query: { include: options?.include },\n },\n session\n );\n return customer;\n}\n\nexport async function updateCustomer(session: Session, updateRequest: UpdateCustomerRequest): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'put',\n `/customers`,\n { id, data: updateRequest },\n session\n );\n return customer;\n}\n\nexport async function getDeliverySchedule(\n session: Session,\n query?: CustomerDeliveryScheduleParams\n): Promise<Delivery[]> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { deliveries } = await rechargeApiRequest<CustomerDeliveryScheduleResponse>(\n 'get',\n `/customers/${id}/delivery_schedule`,\n { query },\n session\n );\n return deliveries;\n}\n"],"names":[],"mappings":";;AACO,eAAe,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE;AACpD,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;AAChC,EAAE,IAAI,CAAC,EAAE,EAAE;AACX,IAAI,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACtC,GAAG;AACH,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE;AACrE,IAAI,EAAE;AACN,IAAI,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,OAAO,EAAE;AAClE,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,QAAQ,CAAC;AAClB,CAAC;AACM,eAAe,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE;AAC7D,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;AAChC,EAAE,IAAI,CAAC,EAAE,EAAE;AACX,IAAI,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACtC,GAAG;AACH,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;AAC3G,EAAE,OAAO,QAAQ,CAAC;AAClB,CAAC;AACM,eAAe,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE;AAC1D,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;AAChC,EAAE,IAAI,CAAC,EAAE,EAAE;AACX,IAAI,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACtC,GAAG;AACH,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACnH,EAAE,OAAO,UAAU,CAAC;AACpB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"membership.js","sources":["../../../src/api/membership.ts"],"sourcesContent":["import {\n ActivateMembershipRequest,\n CancelMembershipRequest,\n MembershipListParams,\n MembershipListResponse,\n MembershipResponse,\n} from '../types/membership';\nimport { Session } from '../types/session';\nimport { rechargeApiRequest } from '../utils/request';\n\n/** Retrieves membership information for passed in id */\nexport async function getMembership(session: Session, id: string | number) {\n const { membership } = await rechargeApiRequest<MembershipResponse>('get', `/memberships`, { id }, session);\n return membership;\n}\n\n/** Retrieves a list of memberships */\nexport function listMemberships(session: Session, query?: MembershipListParams) {\n return rechargeApiRequest<MembershipListResponse>('get', `/memberships`, { query }, session);\n}\n\n/** Cancels a membership */\nexport async function cancelMembership(session: Session, id: string | number, cancelRequest: CancelMembershipRequest) {\n const { membership } = await rechargeApiRequest<MembershipResponse>(\n 'post',\n `/memberships/${id}/cancel`,\n {\n data: cancelRequest,\n },\n session\n );\n return membership;\n}\n\n/** Activates a membership */\nexport async function activateMembership(\n session: Session,\n id: string | number,\n activateRequest: ActivateMembershipRequest\n) {\n const { membership } = await rechargeApiRequest<MembershipResponse>(\n 'post',\n `/memberships/${id}/activate`,\n {\n data: activateRequest,\n },\n session\n );\n return membership;\n}\n"],"names":[],"mappings":";;AACO,eAAe,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE;AACjD,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC1F,EAAE,OAAO,UAAU,CAAC;AACpB,CAAC;AACM,SAAS,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE;AAChD,EAAE,OAAO,kBAAkB,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC;AACM,eAAe,gBAAgB,CAAC,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE;AACnE,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE;AACvF,IAAI,IAAI,EAAE,aAAa;AACvB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,UAAU,CAAC;AACpB,CAAC;AACM,eAAe,kBAAkB,CAAC,OAAO,EAAE,EAAE,EAAE,eAAe,EAAE;AACvE,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE;AACzF,IAAI,IAAI,EAAE,eAAe;AACzB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,UAAU,CAAC;AACpB;;;;"}
|
|
1
|
+
{"version":3,"file":"membership.js","sources":["../../../src/api/membership.ts"],"sourcesContent":["import {\n ActivateMembershipRequest,\n CancelMembershipRequest,\n MembershipListParams,\n MembershipListResponse,\n MembershipResponse,\n} from '../types/membership';\nimport { Session } from '../types/session';\nimport { rechargeApiRequest } from '../utils/request';\n\n/** @internal Retrieves membership information for passed in id */\nexport async function getMembership(session: Session, id: string | number) {\n const { membership } = await rechargeApiRequest<MembershipResponse>('get', `/memberships`, { id }, session);\n return membership;\n}\n\n/** @internal Retrieves a list of memberships */\nexport function listMemberships(session: Session, query?: MembershipListParams) {\n return rechargeApiRequest<MembershipListResponse>('get', `/memberships`, { query }, session);\n}\n\n/** @internal Cancels a membership */\nexport async function cancelMembership(session: Session, id: string | number, cancelRequest: CancelMembershipRequest) {\n const { membership } = await rechargeApiRequest<MembershipResponse>(\n 'post',\n `/memberships/${id}/cancel`,\n {\n data: cancelRequest,\n },\n session\n );\n return membership;\n}\n\n/** @internal Activates a membership */\nexport async function activateMembership(\n session: Session,\n id: string | number,\n activateRequest: ActivateMembershipRequest\n) {\n const { membership } = await rechargeApiRequest<MembershipResponse>(\n 'post',\n `/memberships/${id}/activate`,\n {\n data: activateRequest,\n },\n session\n );\n return membership;\n}\n"],"names":[],"mappings":";;AACO,eAAe,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE;AACjD,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC1F,EAAE,OAAO,UAAU,CAAC;AACpB,CAAC;AACM,SAAS,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE;AAChD,EAAE,OAAO,kBAAkB,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC;AACM,eAAe,gBAAgB,CAAC,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE;AACnE,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE;AACvF,IAAI,IAAI,EAAE,aAAa;AACvB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,UAAU,CAAC;AACpB,CAAC;AACM,eAAe,kBAAkB,CAAC,OAAO,EAAE,EAAE,EAAE,eAAe,EAAE;AACvE,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE;AACzF,IAAI,IAAI,EAAE,eAAe;AACzB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,UAAU,CAAC;AACpB;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -960,6 +960,192 @@ interface CDNBundleSettings {
|
|
|
960
960
|
variants: CDNBundleVariant[];
|
|
961
961
|
}
|
|
962
962
|
|
|
963
|
+
interface PaymentDetails {
|
|
964
|
+
/** Payment_method brand or company powering it. valid for CREDIT_CARD only. */
|
|
965
|
+
brand?: string;
|
|
966
|
+
/** Payment_method expiry month. valid for CREDIT_CARD only. */
|
|
967
|
+
exp_month?: string;
|
|
968
|
+
/** Payment_method expiry year. valid for CREDIT_CARD only. */
|
|
969
|
+
exp_year?: string;
|
|
970
|
+
/** last 4-digits of the identifier. valid for CREDIT_CARD only. */
|
|
971
|
+
last4?: string;
|
|
972
|
+
/** email linked to paypal. valid for PAYPAL only. */
|
|
973
|
+
paypal_email?: string;
|
|
974
|
+
/** paypal user identifier. valid for PAYPAL only. */
|
|
975
|
+
paypal_payer_id?: string;
|
|
976
|
+
/** If a digital wallet. */
|
|
977
|
+
wallet_type?: string;
|
|
978
|
+
/** Type of funding for the Payment Method. */
|
|
979
|
+
funding_type?: string;
|
|
980
|
+
}
|
|
981
|
+
declare type PaymentType = 'CREDIT_CARD' | 'PAYPAL' | 'APPLE_PAY' | 'GOOGLE_PAY' | 'SEPA_DEBIT';
|
|
982
|
+
declare type ProcessorName = 'stripe' | 'braintree' | 'authorize' | 'shopify_payments' | 'mollie';
|
|
983
|
+
declare type PaymentMethodStatus = 'not_validated' | 'valid' | 'invalid';
|
|
984
|
+
interface PaymentMethod {
|
|
985
|
+
/** The unique payment method id for a customer. */
|
|
986
|
+
id: number;
|
|
987
|
+
/** An object with the customer’s address information. */
|
|
988
|
+
billing_address: AssociatedAddress;
|
|
989
|
+
/** The Recharge customer_id */
|
|
990
|
+
customer_id: number;
|
|
991
|
+
/** The time the payment method was created. */
|
|
992
|
+
created_at: IsoDateString;
|
|
993
|
+
/** If this is the default payment method for the customer */
|
|
994
|
+
default: boolean;
|
|
995
|
+
/** Details about the specific payment method */
|
|
996
|
+
payment_details: PaymentDetails;
|
|
997
|
+
/**
|
|
998
|
+
* The type of payment this is.
|
|
999
|
+
* If passed, must also be accompanied by one of stripe_customer_token, paypal_customer_token or authorizedotnet_customer_token in processor_payment_method_token.
|
|
1000
|
+
*/
|
|
1001
|
+
payment_type: PaymentType;
|
|
1002
|
+
/** The customer token at the processor. */
|
|
1003
|
+
processor_customer_token: string;
|
|
1004
|
+
/**
|
|
1005
|
+
* This will impact validation on billing_details.
|
|
1006
|
+
* Currently, shopify_payments is in read-only mode and can only be managed by Shopify.
|
|
1007
|
+
*/
|
|
1008
|
+
processor_name: ProcessorName;
|
|
1009
|
+
/** The payment token at the processor. */
|
|
1010
|
+
processor_payment_method_token: string;
|
|
1011
|
+
/** State of the Payment Method. */
|
|
1012
|
+
status: PaymentMethodStatus;
|
|
1013
|
+
/**
|
|
1014
|
+
* The status reason for the payment method.
|
|
1015
|
+
* Often used when invalid to provide background details in invalidity.
|
|
1016
|
+
*/
|
|
1017
|
+
status_reason: string;
|
|
1018
|
+
/** The time the payment method was last updated. */
|
|
1019
|
+
updated_at: IsoDateString;
|
|
1020
|
+
}
|
|
1021
|
+
interface PaymentMethodsResponse {
|
|
1022
|
+
next_cursor: null | string;
|
|
1023
|
+
previous_cursor: null | string;
|
|
1024
|
+
payment_methods: PaymentMethod[];
|
|
1025
|
+
}
|
|
1026
|
+
declare type PaymentMethodOptionalUpdateProps = 'billing_address' | 'default';
|
|
1027
|
+
declare type UpdatePaymentMethodRequest = Partial<Pick<PaymentMethod, PaymentMethodOptionalUpdateProps>>;
|
|
1028
|
+
/** no sorting options for payment_methods, always by id-desc */
|
|
1029
|
+
declare type PaymentMethodSortBy = null;
|
|
1030
|
+
interface PaymentMethodListParams extends ListParams<PaymentMethodSortBy> {
|
|
1031
|
+
customer_id?: string;
|
|
1032
|
+
processor_name?: ProcessorName;
|
|
1033
|
+
address_id?: string;
|
|
1034
|
+
processor_payment_method_token?: string;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
interface Subscription {
|
|
1038
|
+
/** Unique numeric identifier for the subscription. */
|
|
1039
|
+
id: number;
|
|
1040
|
+
/** Unique numeric identifier for the address the subscription is associated with. */
|
|
1041
|
+
address_id: number;
|
|
1042
|
+
/** Unique numeric identifier for the customer the subscription is tied to. */
|
|
1043
|
+
customer_id: number;
|
|
1044
|
+
/** An object used to contain analytics data such as utm parameters. */
|
|
1045
|
+
analytics_data: AnalyticsData;
|
|
1046
|
+
/** Reason provided for cancellation. */
|
|
1047
|
+
cancellation_reason: string | null;
|
|
1048
|
+
/** Additional comment for cancellation. */
|
|
1049
|
+
cancellation_reason_comments: string | null;
|
|
1050
|
+
/** The time the subscription was cancelled. */
|
|
1051
|
+
cancelled_at: string | null;
|
|
1052
|
+
/**
|
|
1053
|
+
* The number of units (specified in order_interval_unit) between each Charge. For example, order_interval_unit=month and charge_interval_frequency=3, indicate charge every 3 months.
|
|
1054
|
+
* Charges must use the same unit types as orders.
|
|
1055
|
+
* Max: 1000
|
|
1056
|
+
*/
|
|
1057
|
+
charge_interval_frequency: number;
|
|
1058
|
+
/** The time the subscription was created. */
|
|
1059
|
+
created_at: IsoDateString;
|
|
1060
|
+
/** Set the number of charges until subscription expires. */
|
|
1061
|
+
expire_after_specific_number_of_charges: number | null;
|
|
1062
|
+
/** An object containing the product id as it appears in external platforms. */
|
|
1063
|
+
external_product_id: ExternalId;
|
|
1064
|
+
/** An object containing the variant id as it appears in external platforms. */
|
|
1065
|
+
external_variant_id: ExternalId;
|
|
1066
|
+
/** Retrieves true if there is queued charge. Otherwise, retrieves false. */
|
|
1067
|
+
has_queued_charges: boolean;
|
|
1068
|
+
/** Value is set to true if it is a prepaid item. */
|
|
1069
|
+
is_prepaid: boolean;
|
|
1070
|
+
/** Value is set to true if it is not a prepaid item */
|
|
1071
|
+
is_skippable: boolean;
|
|
1072
|
+
/** Value is set to true if it is not a prepaid item and if in Customer portal settings swap is allowed for customers. */
|
|
1073
|
+
is_swappable: boolean;
|
|
1074
|
+
/** Retrieves true if charge has an error max retries reached. Otherwise, retrieves false. */
|
|
1075
|
+
max_retries_reached: boolean;
|
|
1076
|
+
/** Date of the next charge for the subscription. */
|
|
1077
|
+
next_charge_scheduled_at: IsoDateString;
|
|
1078
|
+
/**
|
|
1079
|
+
* The set day of the month order is created. Default is that there isn’t a strict day of the month when the order is created.
|
|
1080
|
+
* This is only applicable to subscriptions with order_interval_unit:“month”.
|
|
1081
|
+
*/
|
|
1082
|
+
order_day_of_month: number | null;
|
|
1083
|
+
/**
|
|
1084
|
+
* The set day of the week order is created. Default is that there isn’t a strict day of the week order is created.
|
|
1085
|
+
* This is only applicable to subscriptions with order_interval_unit = “week”.
|
|
1086
|
+
* Value of 0 equals to Monday, 1 to Tuesday etc.
|
|
1087
|
+
*/
|
|
1088
|
+
order_day_of_week: number | null;
|
|
1089
|
+
/**
|
|
1090
|
+
* The number of units (specified in order_interval_unit) between each order. For example, order_interval_unit=month and order_interval_frequency=3, indicate order every 3 months. Max value: 1000
|
|
1091
|
+
*/
|
|
1092
|
+
order_interval_frequency: number;
|
|
1093
|
+
/** The frequency unit used to determine when a subscription’s order is created. */
|
|
1094
|
+
order_interval_unit: 'day' | 'week' | 'month';
|
|
1095
|
+
/** The presentment currency of the subscription. */
|
|
1096
|
+
presentment_currency: string | null;
|
|
1097
|
+
/** The price of the item before discounts, taxes, or shipping have been applied. */
|
|
1098
|
+
price: string;
|
|
1099
|
+
/** The name of the product in a store’s catalog. */
|
|
1100
|
+
product_title: string | null;
|
|
1101
|
+
/** A list of line item objects, each one containing information about the subscription. Custom key-value pairs can be installed here, they will appear on the connected queued charge and after it is processed on the order itself. */
|
|
1102
|
+
properties: Property[];
|
|
1103
|
+
/** The number of items in the subscription. */
|
|
1104
|
+
quantity: number;
|
|
1105
|
+
/** A unique identifier of the item in the fulfillment. In cases where SKU is blank, it will be dynamically pulled whenever it is used. */
|
|
1106
|
+
sku: string | null;
|
|
1107
|
+
/** Flag that is automatically updated to true when SKU is passed on create or update. When sku_override is true, the SKU on the subscription will be used to generate charges and orders. When sku_override is false, Recharge will dynamically fetch the SKU from the corresponding external platform variant. */
|
|
1108
|
+
sku_override: boolean;
|
|
1109
|
+
/**
|
|
1110
|
+
* The status of the subscription.
|
|
1111
|
+
* expired - This status occurs when the maximum number of charges for a product has been reached.
|
|
1112
|
+
*/
|
|
1113
|
+
status: 'active' | 'cancelled' | 'expired';
|
|
1114
|
+
/** The date time at which the purchase_item record was last updated. */
|
|
1115
|
+
updated_at: IsoDateString;
|
|
1116
|
+
/** The name of the variant in a shop’s catalog. */
|
|
1117
|
+
variant_title: string;
|
|
1118
|
+
}
|
|
1119
|
+
interface SubscriptionsResponse {
|
|
1120
|
+
next_cursor: null | string;
|
|
1121
|
+
previous_cursor: null | string;
|
|
1122
|
+
subscriptions: Subscription[];
|
|
1123
|
+
}
|
|
1124
|
+
declare type SubscriptionSortBy = 'id-asc' | 'id-desc' | 'created_at-asc' | 'created_at-desc' | 'updated_at-asc' | 'updated_at-desc';
|
|
1125
|
+
interface SubscriptionListParams extends ListParams<SubscriptionSortBy> {
|
|
1126
|
+
created_at_min?: IsoDateString;
|
|
1127
|
+
created_at_max?: IsoDateString;
|
|
1128
|
+
customer_id?: string;
|
|
1129
|
+
}
|
|
1130
|
+
declare type SubscriptionRequiredCreateProps = 'address_id' | 'charge_interval_frequency' | 'external_variant_id' | 'next_charge_scheduled_at' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity';
|
|
1131
|
+
declare type SubscriptionOptionalCreateProps = 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'external_product_id' | 'product_title' | 'properties' | 'status';
|
|
1132
|
+
declare type CreateSubscriptionRequest = SubType<Subscription, SubscriptionRequiredCreateProps, SubscriptionOptionalCreateProps>;
|
|
1133
|
+
declare type SubscriptionOptionalUpdateProps = 'charge_interval_frequency' | 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity' | 'external_product_id' | 'external_variant_id' | 'properties' | 'sku' | 'sku_override';
|
|
1134
|
+
declare type UpdateSubscriptionRequest = Partial<Pick<Subscription, SubscriptionOptionalUpdateProps>>;
|
|
1135
|
+
interface UpdateSubscriptionParams {
|
|
1136
|
+
/** Controls whether the QUEUED charges linked to the subscription should be regenerated upon subscription update. By default the flag is set to false which will delay charge regeneration 5 seconds. This enables running multiple calls to perform changes and receive responses much faster since the API won’t wait for a charge regeneration to complete. Setting this parameter to true will cause charge regeneration to complete before returning a response. */
|
|
1137
|
+
commit?: boolean;
|
|
1138
|
+
}
|
|
1139
|
+
interface CancelSubscriptionRequest {
|
|
1140
|
+
cancellation_reason: string;
|
|
1141
|
+
cancellation_reason_comments?: string;
|
|
1142
|
+
send_email?: boolean;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
declare type CustomerIncludes = 'addresses' | 'payment_methods' | 'subscriptions';
|
|
1146
|
+
interface GetCustomerOptions {
|
|
1147
|
+
include: CustomerIncludes[];
|
|
1148
|
+
}
|
|
963
1149
|
interface Customer {
|
|
964
1150
|
/** Unique numeric identifier for the Customer. */
|
|
965
1151
|
id: number;
|
|
@@ -989,6 +1175,12 @@ interface Customer {
|
|
|
989
1175
|
subscriptions_total_count: number;
|
|
990
1176
|
/** The date and time when the customer was last updated. */
|
|
991
1177
|
updated_at: IsoDateString;
|
|
1178
|
+
/** Additional information as requested */
|
|
1179
|
+
include?: {
|
|
1180
|
+
addresses?: Address[];
|
|
1181
|
+
payment_methods?: PaymentMethod[];
|
|
1182
|
+
subscriptions?: Subscription[];
|
|
1183
|
+
};
|
|
992
1184
|
}
|
|
993
1185
|
declare type CustomerOptionalUpdateProps = 'email' | 'first_name' | 'last_name' | 'external_customer_id';
|
|
994
1186
|
declare type UpdateCustomerRequest = Partial<Pick<Customer, CustomerOptionalUpdateProps>>;
|
|
@@ -1011,7 +1203,9 @@ interface CustomerDeliveryScheduleResponse {
|
|
|
1011
1203
|
deliveries: Delivery[];
|
|
1012
1204
|
}
|
|
1013
1205
|
|
|
1206
|
+
/** @internal */
|
|
1014
1207
|
declare type MembershipStatus = 'active' | 'inactive';
|
|
1208
|
+
/** @internal */
|
|
1015
1209
|
interface Membership {
|
|
1016
1210
|
id: string;
|
|
1017
1211
|
store_id: number;
|
|
@@ -1025,17 +1219,23 @@ interface Membership {
|
|
|
1025
1219
|
subscription_cancelled_at: IsoDateString | null;
|
|
1026
1220
|
image?: string;
|
|
1027
1221
|
}
|
|
1222
|
+
/** @internal */
|
|
1028
1223
|
interface MembershipResponse {
|
|
1029
1224
|
membership: Membership;
|
|
1030
1225
|
}
|
|
1226
|
+
/** @internal */
|
|
1031
1227
|
interface MembershipListResponse {
|
|
1032
1228
|
next_cursor: null | string;
|
|
1033
1229
|
previous_cursor: null | string;
|
|
1034
1230
|
memberships: Membership[];
|
|
1035
1231
|
}
|
|
1232
|
+
/** @internal */
|
|
1036
1233
|
declare type MembershipsSortBy = 'id-asc' | 'id-desc';
|
|
1234
|
+
/** @internal */
|
|
1037
1235
|
declare type membershipIncludes = 'customer' | 'subscriptions';
|
|
1236
|
+
/** @internal */
|
|
1038
1237
|
declare type MembershipIncludes = `${membershipIncludes}` | `${membershipIncludes},${membershipIncludes}`;
|
|
1238
|
+
/** @internal */
|
|
1039
1239
|
interface MembershipListParams extends ListParams<MembershipsSortBy> {
|
|
1040
1240
|
include?: MembershipIncludes;
|
|
1041
1241
|
customer_id?: number;
|
|
@@ -1050,9 +1250,11 @@ interface MembershipListParams extends ListParams<MembershipsSortBy> {
|
|
|
1050
1250
|
include_cancelled?: boolean;
|
|
1051
1251
|
include_deleted?: boolean;
|
|
1052
1252
|
}
|
|
1253
|
+
/** @internal */
|
|
1053
1254
|
interface ActivateMembershipRequest {
|
|
1054
1255
|
expires_at: string | null;
|
|
1055
1256
|
}
|
|
1257
|
+
/** @internal */
|
|
1056
1258
|
interface CancelMembershipRequest {
|
|
1057
1259
|
cancel_immediately: boolean;
|
|
1058
1260
|
cancellation_reason: string;
|
|
@@ -1132,80 +1334,6 @@ interface InitOptions {
|
|
|
1132
1334
|
storefrontAccessToken?: string;
|
|
1133
1335
|
}
|
|
1134
1336
|
|
|
1135
|
-
interface PaymentDetails {
|
|
1136
|
-
/** Payment_method brand or company powering it. valid for CREDIT_CARD only. */
|
|
1137
|
-
brand?: string;
|
|
1138
|
-
/** Payment_method expiry month. valid for CREDIT_CARD only. */
|
|
1139
|
-
exp_month?: string;
|
|
1140
|
-
/** Payment_method expiry year. valid for CREDIT_CARD only. */
|
|
1141
|
-
exp_year?: string;
|
|
1142
|
-
/** last 4-digits of the identifier. valid for CREDIT_CARD only. */
|
|
1143
|
-
last4?: string;
|
|
1144
|
-
/** email linked to paypal. valid for PAYPAL only. */
|
|
1145
|
-
paypal_email?: string;
|
|
1146
|
-
/** paypal user identifier. valid for PAYPAL only. */
|
|
1147
|
-
paypal_payer_id?: string;
|
|
1148
|
-
/** If a digital wallet. */
|
|
1149
|
-
wallet_type?: string;
|
|
1150
|
-
/** Type of funding for the Payment Method. */
|
|
1151
|
-
funding_type?: string;
|
|
1152
|
-
}
|
|
1153
|
-
declare type PaymentType = 'CREDIT_CARD' | 'PAYPAL' | 'APPLE_PAY' | 'GOOGLE_PAY' | 'SEPA_DEBIT';
|
|
1154
|
-
declare type ProcessorName = 'stripe' | 'braintree' | 'authorize' | 'shopify_payments' | 'mollie';
|
|
1155
|
-
declare type PaymentMethodStatus = 'not_validated' | 'valid' | 'invalid';
|
|
1156
|
-
interface PaymentMethod {
|
|
1157
|
-
/** The unique payment method id for a customer. */
|
|
1158
|
-
id: number;
|
|
1159
|
-
/** An object with the customer’s address information. */
|
|
1160
|
-
billing_address: AssociatedAddress;
|
|
1161
|
-
/** The Recharge customer_id */
|
|
1162
|
-
customer_id: number;
|
|
1163
|
-
/** The time the payment method was created. */
|
|
1164
|
-
created_at: IsoDateString;
|
|
1165
|
-
/** If this is the default payment method for the customer */
|
|
1166
|
-
default: boolean;
|
|
1167
|
-
/** Details about the specific payment method */
|
|
1168
|
-
payment_details: PaymentDetails;
|
|
1169
|
-
/**
|
|
1170
|
-
* The type of payment this is.
|
|
1171
|
-
* If passed, must also be accompanied by one of stripe_customer_token, paypal_customer_token or authorizedotnet_customer_token in processor_payment_method_token.
|
|
1172
|
-
*/
|
|
1173
|
-
payment_type: PaymentType;
|
|
1174
|
-
/** The customer token at the processor. */
|
|
1175
|
-
processor_customer_token: string;
|
|
1176
|
-
/**
|
|
1177
|
-
* This will impact validation on billing_details.
|
|
1178
|
-
* Currently, shopify_payments is in read-only mode and can only be managed by Shopify.
|
|
1179
|
-
*/
|
|
1180
|
-
processor_name: ProcessorName;
|
|
1181
|
-
/** The payment token at the processor. */
|
|
1182
|
-
processor_payment_method_token: string;
|
|
1183
|
-
/** State of the Payment Method. */
|
|
1184
|
-
status: PaymentMethodStatus;
|
|
1185
|
-
/**
|
|
1186
|
-
* The status reason for the payment method.
|
|
1187
|
-
* Often used when invalid to provide background details in invalidity.
|
|
1188
|
-
*/
|
|
1189
|
-
status_reason: string;
|
|
1190
|
-
/** The time the payment method was last updated. */
|
|
1191
|
-
updated_at: IsoDateString;
|
|
1192
|
-
}
|
|
1193
|
-
interface PaymentMethodsResponse {
|
|
1194
|
-
next_cursor: null | string;
|
|
1195
|
-
previous_cursor: null | string;
|
|
1196
|
-
payment_methods: PaymentMethod[];
|
|
1197
|
-
}
|
|
1198
|
-
declare type PaymentMethodOptionalUpdateProps = 'billing_address' | 'default';
|
|
1199
|
-
declare type UpdatePaymentMethodRequest = Partial<Pick<PaymentMethod, PaymentMethodOptionalUpdateProps>>;
|
|
1200
|
-
/** no sorting options for payment_methods, always by id-desc */
|
|
1201
|
-
declare type PaymentMethodSortBy = null;
|
|
1202
|
-
interface PaymentMethodListParams extends ListParams<PaymentMethodSortBy> {
|
|
1203
|
-
customer_id?: string;
|
|
1204
|
-
processor_name?: ProcessorName;
|
|
1205
|
-
address_id?: string;
|
|
1206
|
-
processor_payment_method_token?: string;
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
1337
|
interface ChannelSettings {
|
|
1210
1338
|
api: {
|
|
1211
1339
|
display: boolean;
|
|
@@ -1270,114 +1398,6 @@ interface PlanListParams extends ListParams<PlanSortBy> {
|
|
|
1270
1398
|
type?: PlanType;
|
|
1271
1399
|
}
|
|
1272
1400
|
|
|
1273
|
-
interface Subscription {
|
|
1274
|
-
/** Unique numeric identifier for the subscription. */
|
|
1275
|
-
id: number;
|
|
1276
|
-
/** Unique numeric identifier for the address the subscription is associated with. */
|
|
1277
|
-
address_id: number;
|
|
1278
|
-
/** Unique numeric identifier for the customer the subscription is tied to. */
|
|
1279
|
-
customer_id: number;
|
|
1280
|
-
/** An object used to contain analytics data such as utm parameters. */
|
|
1281
|
-
analytics_data: AnalyticsData;
|
|
1282
|
-
/** Reason provided for cancellation. */
|
|
1283
|
-
cancellation_reason: string | null;
|
|
1284
|
-
/** Additional comment for cancellation. */
|
|
1285
|
-
cancellation_reason_comments: string | null;
|
|
1286
|
-
/** The time the subscription was cancelled. */
|
|
1287
|
-
cancelled_at: string | null;
|
|
1288
|
-
/**
|
|
1289
|
-
* The number of units (specified in order_interval_unit) between each Charge. For example, order_interval_unit=month and charge_interval_frequency=3, indicate charge every 3 months.
|
|
1290
|
-
* Charges must use the same unit types as orders.
|
|
1291
|
-
* Max: 1000
|
|
1292
|
-
*/
|
|
1293
|
-
charge_interval_frequency: number;
|
|
1294
|
-
/** The time the subscription was created. */
|
|
1295
|
-
created_at: IsoDateString;
|
|
1296
|
-
/** Set the number of charges until subscription expires. */
|
|
1297
|
-
expire_after_specific_number_of_charges: number | null;
|
|
1298
|
-
/** An object containing the product id as it appears in external platforms. */
|
|
1299
|
-
external_product_id: ExternalId;
|
|
1300
|
-
/** An object containing the variant id as it appears in external platforms. */
|
|
1301
|
-
external_variant_id: ExternalId;
|
|
1302
|
-
/** Retrieves true if there is queued charge. Otherwise, retrieves false. */
|
|
1303
|
-
has_queued_charges: boolean;
|
|
1304
|
-
/** Value is set to true if it is a prepaid item. */
|
|
1305
|
-
is_prepaid: boolean;
|
|
1306
|
-
/** Value is set to true if it is not a prepaid item */
|
|
1307
|
-
is_skippable: boolean;
|
|
1308
|
-
/** Value is set to true if it is not a prepaid item and if in Customer portal settings swap is allowed for customers. */
|
|
1309
|
-
is_swappable: boolean;
|
|
1310
|
-
/** Retrieves true if charge has an error max retries reached. Otherwise, retrieves false. */
|
|
1311
|
-
max_retries_reached: boolean;
|
|
1312
|
-
/** Date of the next charge for the subscription. */
|
|
1313
|
-
next_charge_scheduled_at: IsoDateString;
|
|
1314
|
-
/**
|
|
1315
|
-
* The set day of the month order is created. Default is that there isn’t a strict day of the month when the order is created.
|
|
1316
|
-
* This is only applicable to subscriptions with order_interval_unit:“month”.
|
|
1317
|
-
*/
|
|
1318
|
-
order_day_of_month: number | null;
|
|
1319
|
-
/**
|
|
1320
|
-
* The set day of the week order is created. Default is that there isn’t a strict day of the week order is created.
|
|
1321
|
-
* This is only applicable to subscriptions with order_interval_unit = “week”.
|
|
1322
|
-
* Value of 0 equals to Monday, 1 to Tuesday etc.
|
|
1323
|
-
*/
|
|
1324
|
-
order_day_of_week: number | null;
|
|
1325
|
-
/**
|
|
1326
|
-
* The number of units (specified in order_interval_unit) between each order. For example, order_interval_unit=month and order_interval_frequency=3, indicate order every 3 months. Max value: 1000
|
|
1327
|
-
*/
|
|
1328
|
-
order_interval_frequency: number;
|
|
1329
|
-
/** The frequency unit used to determine when a subscription’s order is created. */
|
|
1330
|
-
order_interval_unit: 'day' | 'week' | 'month';
|
|
1331
|
-
/** The presentment currency of the subscription. */
|
|
1332
|
-
presentment_currency: string | null;
|
|
1333
|
-
/** The price of the item before discounts, taxes, or shipping have been applied. */
|
|
1334
|
-
price: string;
|
|
1335
|
-
/** The name of the product in a store’s catalog. */
|
|
1336
|
-
product_title: string | null;
|
|
1337
|
-
/** A list of line item objects, each one containing information about the subscription. Custom key-value pairs can be installed here, they will appear on the connected queued charge and after it is processed on the order itself. */
|
|
1338
|
-
properties: Property[];
|
|
1339
|
-
/** The number of items in the subscription. */
|
|
1340
|
-
quantity: number;
|
|
1341
|
-
/** A unique identifier of the item in the fulfillment. In cases where SKU is blank, it will be dynamically pulled whenever it is used. */
|
|
1342
|
-
sku: string | null;
|
|
1343
|
-
/** Flag that is automatically updated to true when SKU is passed on create or update. When sku_override is true, the SKU on the subscription will be used to generate charges and orders. When sku_override is false, Recharge will dynamically fetch the SKU from the corresponding external platform variant. */
|
|
1344
|
-
sku_override: boolean;
|
|
1345
|
-
/**
|
|
1346
|
-
* The status of the subscription.
|
|
1347
|
-
* expired - This status occurs when the maximum number of charges for a product has been reached.
|
|
1348
|
-
*/
|
|
1349
|
-
status: 'active' | 'cancelled' | 'expired';
|
|
1350
|
-
/** The date time at which the purchase_item record was last updated. */
|
|
1351
|
-
updated_at: IsoDateString;
|
|
1352
|
-
/** The name of the variant in a shop’s catalog. */
|
|
1353
|
-
variant_title: string;
|
|
1354
|
-
}
|
|
1355
|
-
interface SubscriptionsResponse {
|
|
1356
|
-
next_cursor: null | string;
|
|
1357
|
-
previous_cursor: null | string;
|
|
1358
|
-
subscriptions: Subscription[];
|
|
1359
|
-
}
|
|
1360
|
-
declare type SubscriptionSortBy = 'id-asc' | 'id-desc' | 'created_at-asc' | 'created_at-desc' | 'updated_at-asc' | 'updated_at-desc';
|
|
1361
|
-
interface SubscriptionListParams extends ListParams<SubscriptionSortBy> {
|
|
1362
|
-
created_at_min?: IsoDateString;
|
|
1363
|
-
created_at_max?: IsoDateString;
|
|
1364
|
-
customer_id?: string;
|
|
1365
|
-
}
|
|
1366
|
-
declare type SubscriptionRequiredCreateProps = 'address_id' | 'charge_interval_frequency' | 'external_variant_id' | 'next_charge_scheduled_at' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity';
|
|
1367
|
-
declare type SubscriptionOptionalCreateProps = 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'external_product_id' | 'product_title' | 'properties' | 'status';
|
|
1368
|
-
declare type CreateSubscriptionRequest = SubType<Subscription, SubscriptionRequiredCreateProps, SubscriptionOptionalCreateProps>;
|
|
1369
|
-
declare type SubscriptionOptionalUpdateProps = 'charge_interval_frequency' | 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity' | 'external_product_id' | 'external_variant_id' | 'properties' | 'sku' | 'sku_override';
|
|
1370
|
-
declare type UpdateSubscriptionRequest = Partial<Pick<Subscription, SubscriptionOptionalUpdateProps>>;
|
|
1371
|
-
interface UpdateSubscriptionParams {
|
|
1372
|
-
/** Controls whether the QUEUED charges linked to the subscription should be regenerated upon subscription update. By default the flag is set to false which will delay charge regeneration 5 seconds. This enables running multiple calls to perform changes and receive responses much faster since the API won’t wait for a charge regeneration to complete. Setting this parameter to true will cause charge regeneration to complete before returning a response. */
|
|
1373
|
-
commit?: boolean;
|
|
1374
|
-
}
|
|
1375
|
-
interface CancelSubscriptionRequest {
|
|
1376
|
-
cancellation_reason: string;
|
|
1377
|
-
cancellation_reason_comments?: string;
|
|
1378
|
-
send_email?: boolean;
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
1401
|
declare function getCDNProduct(externalProductId: string | number): Promise<CDNProduct>;
|
|
1382
1402
|
declare function getCDNStoreSettings(): Promise<CDNStoreSettings>;
|
|
1383
1403
|
declare function getCDNWidgetSettings(): Promise<CDNWidgetSettings>;
|
|
@@ -1390,13 +1410,13 @@ declare function resetCDNCache(): Promise<void>;
|
|
|
1390
1410
|
declare function getBundleId(bundle: Bundle): Promise<string>;
|
|
1391
1411
|
declare function validateBundle(bundle: Bundle): Promise<boolean>;
|
|
1392
1412
|
|
|
1393
|
-
/** Retrieves membership information for passed in id */
|
|
1413
|
+
/** @internal Retrieves membership information for passed in id */
|
|
1394
1414
|
declare function getMembership(session: Session, id: string | number): Promise<Membership>;
|
|
1395
|
-
/** Retrieves a list of memberships */
|
|
1415
|
+
/** @internal Retrieves a list of memberships */
|
|
1396
1416
|
declare function listMemberships(session: Session, query?: MembershipListParams): Promise<MembershipListResponse>;
|
|
1397
|
-
/** Cancels a membership */
|
|
1417
|
+
/** @internal Cancels a membership */
|
|
1398
1418
|
declare function cancelMembership(session: Session, id: string | number, cancelRequest: CancelMembershipRequest): Promise<Membership>;
|
|
1399
|
-
/** Activates a membership */
|
|
1419
|
+
/** @internal Activates a membership */
|
|
1400
1420
|
declare function activateMembership(session: Session, id: string | number, activateRequest: ActivateMembershipRequest): Promise<Membership>;
|
|
1401
1421
|
|
|
1402
1422
|
declare function getOnetime(session: Session, id: string | number): Promise<Onetime>;
|
|
@@ -1450,7 +1470,7 @@ declare function cancelSubscription(session: Session, id: string | number, cance
|
|
|
1450
1470
|
declare function activateSubscription(session: Session, id: string | number): Promise<Subscription>;
|
|
1451
1471
|
declare function skipSubscriptionCharge(session: Session, id: number | string, date: IsoDateString): Promise<Charge>;
|
|
1452
1472
|
|
|
1453
|
-
declare function getCustomer(session: Session): Promise<Customer>;
|
|
1473
|
+
declare function getCustomer(session: Session, options?: GetCustomerOptions): Promise<Customer>;
|
|
1454
1474
|
declare function updateCustomer(session: Session, updateRequest: UpdateCustomerRequest): Promise<Customer>;
|
|
1455
1475
|
declare function getDeliverySchedule(session: Session, query?: CustomerDeliveryScheduleParams): Promise<Delivery[]>;
|
|
1456
1476
|
|
|
@@ -1462,4 +1482,4 @@ declare const api: {
|
|
|
1462
1482
|
};
|
|
1463
1483
|
declare function initRecharge(opt?: InitOptions): void;
|
|
1464
1484
|
|
|
1465
|
-
export { ActivateMembershipRequest, Address, AddressListParams, AddressListResponse, AddressResponse, AddressSortBy, AnalyticsData, ApplyDiscountRequest, AssociatedAddress, Bundle, BundleSelection, BundleTranslations, CDNBaseWidgetSettings, CDNBundleLayoutSettings, CDNBundleSettings, CDNBundleStep, CDNBundleStepOption, CDNBundleVariant, CDNBundleVariantOptionSource, CDNBundleVariantSelectionDefault, CDNPrices, CDNProduct, CDNProductAndSettings, CDNProductKeyObject, CDNProductOption, CDNProductOptionValue, CDNProductRaw, CDNProductResource, CDNProductsAndSettings, CDNProductsAndSettingsResource, CDNSellingPlan, CDNSellingPlanAllocations, CDNSellingPlanGroup, CDNStoreSettings, CDNSubscriptionOption, CDNVariant, CDNVariantOptionValue, CDNWidgetSettings, CDNWidgetSettingsRaw, CDNWidgetSettingsResource, CRUDRequestOptions, CancelMembershipRequest, CancelSubscriptionRequest, ChannelSettings, Charge, ChargeListParams, ChargeListResponse, ChargeResponse, ChargeSortBy, ChargeStatus, ColorString, CreateAddressRequest, CreateOnetimeRequest, CreateSubscriptionRequest, Customer, CustomerDeliveryScheduleParams, CustomerDeliveryScheduleResponse, CustomerOptionalUpdateProps, Delivery, Discount, ExternalId, ExternalTransactionId, FirstOption, GetRequestOptions, HTMLString, InitOptions, IntervalUnit, IsoDateString, LineItem, ListParams, LoginResponse, Membership, MembershipIncludes, MembershipListParams, MembershipListResponse, MembershipResponse, MembershipStatus, MembershipsSortBy, MergeAddressesRequest, Method, Onetime, OnetimeCreateProps, OnetimeListParams, OnetimeOptionalCreateProps, OnetimeOptionalUpdateProps, OnetimeRequiredCreateProps, OnetimesResponse, OnetimesSortBy, Order, OrderListParams, OrderSortBy, OrderStatus, OrderType, OrdersResponse, PaymentDetails, PaymentMethod, PaymentMethodListParams, PaymentMethodOptionalUpdateProps, PaymentMethodSortBy, PaymentMethodStatus, PaymentMethodsResponse, PaymentType, Plan, PlanListParams, PlanSortBy, PlanType, PlansResponse, PriceAdjustmentsType, ProcessorName, ProductImage, Property, Request, RequestHeaders, RequestOptions, RequestOptionsHeaders, Session, ShippingLine, SkipFutureChargeAddressRequest, SkipFutureChargeAddressResponse, StorefrontEnvironment, StorefrontOptions, StorefrontPurchaseOption, SubType, Subscription, SubscriptionListParams, SubscriptionOptionalCreateProps, SubscriptionOptionalUpdateProps, SubscriptionPreferences, SubscriptionRequiredCreateProps, SubscriptionSortBy, SubscriptionsResponse, TaxLine, Translations, UpdateAddressRequest, UpdateCustomerRequest, UpdateOnetimeRequest, UpdatePaymentMethodRequest, UpdateSubscriptionParams, UpdateSubscriptionRequest, WidgetIconColor, WidgetTemplateType, activateMembership, activateSubscription, api, applyDiscount, cancelMembership, cancelSubscription, createAddress, createOnetime, createSubscription, deleteAddress, deleteOnetime, getAddress, getBundleId, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCustomer, getDeliverySchedule, getMembership, getOnetime, getOrder, getPaymentMethod, getPlan, getSubscription, initRecharge, listAddresses, listCharges, listMemberships, listOnetimes, listOrders, listPaymentMethods, listPlans, listSubscriptions, loginShopifyApi, loginShopifyAppProxy, membershipIncludes, mergeAddresses, removeDiscount, resetCDNCache, skipCharge, skipFutureCharge, skipSubscriptionCharge, unskipCharge, updateAddress, updateCustomer, updateOnetime, updatePaymentMethod, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, validateBundle };
|
|
1485
|
+
export { ActivateMembershipRequest, Address, AddressListParams, AddressListResponse, AddressResponse, AddressSortBy, AnalyticsData, ApplyDiscountRequest, AssociatedAddress, Bundle, BundleSelection, BundleTranslations, CDNBaseWidgetSettings, CDNBundleLayoutSettings, CDNBundleSettings, CDNBundleStep, CDNBundleStepOption, CDNBundleVariant, CDNBundleVariantOptionSource, CDNBundleVariantSelectionDefault, CDNPrices, CDNProduct, CDNProductAndSettings, CDNProductKeyObject, CDNProductOption, CDNProductOptionValue, CDNProductRaw, CDNProductResource, CDNProductsAndSettings, CDNProductsAndSettingsResource, CDNSellingPlan, CDNSellingPlanAllocations, CDNSellingPlanGroup, CDNStoreSettings, CDNSubscriptionOption, CDNVariant, CDNVariantOptionValue, CDNWidgetSettings, CDNWidgetSettingsRaw, CDNWidgetSettingsResource, CRUDRequestOptions, CancelMembershipRequest, CancelSubscriptionRequest, ChannelSettings, Charge, ChargeListParams, ChargeListResponse, ChargeResponse, ChargeSortBy, ChargeStatus, ColorString, CreateAddressRequest, CreateOnetimeRequest, CreateSubscriptionRequest, Customer, CustomerDeliveryScheduleParams, CustomerDeliveryScheduleResponse, CustomerIncludes, CustomerOptionalUpdateProps, Delivery, Discount, ExternalId, ExternalTransactionId, FirstOption, GetCustomerOptions, GetRequestOptions, HTMLString, InitOptions, IntervalUnit, IsoDateString, LineItem, ListParams, LoginResponse, Membership, MembershipIncludes, MembershipListParams, MembershipListResponse, MembershipResponse, MembershipStatus, MembershipsSortBy, MergeAddressesRequest, Method, Onetime, OnetimeCreateProps, OnetimeListParams, OnetimeOptionalCreateProps, OnetimeOptionalUpdateProps, OnetimeRequiredCreateProps, OnetimesResponse, OnetimesSortBy, Order, OrderListParams, OrderSortBy, OrderStatus, OrderType, OrdersResponse, PaymentDetails, PaymentMethod, PaymentMethodListParams, PaymentMethodOptionalUpdateProps, PaymentMethodSortBy, PaymentMethodStatus, PaymentMethodsResponse, PaymentType, Plan, PlanListParams, PlanSortBy, PlanType, PlansResponse, PriceAdjustmentsType, ProcessorName, ProductImage, Property, Request, RequestHeaders, RequestOptions, RequestOptionsHeaders, Session, ShippingLine, SkipFutureChargeAddressRequest, SkipFutureChargeAddressResponse, StorefrontEnvironment, StorefrontOptions, StorefrontPurchaseOption, SubType, Subscription, SubscriptionListParams, SubscriptionOptionalCreateProps, SubscriptionOptionalUpdateProps, SubscriptionPreferences, SubscriptionRequiredCreateProps, SubscriptionSortBy, SubscriptionsResponse, TaxLine, Translations, UpdateAddressRequest, UpdateCustomerRequest, UpdateOnetimeRequest, UpdatePaymentMethodRequest, UpdateSubscriptionParams, UpdateSubscriptionRequest, WidgetIconColor, WidgetTemplateType, activateMembership, activateSubscription, api, applyDiscount, cancelMembership, cancelSubscription, createAddress, createOnetime, createSubscription, deleteAddress, deleteOnetime, getAddress, getBundleId, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCustomer, getDeliverySchedule, getMembership, getOnetime, getOrder, getPaymentMethod, getPlan, getSubscription, initRecharge, listAddresses, listCharges, listMemberships, listOnetimes, listOrders, listPaymentMethods, listPlans, listSubscriptions, loginShopifyApi, loginShopifyAppProxy, membershipIncludes, mergeAddresses, removeDiscount, resetCDNCache, skipCharge, skipFutureCharge, skipSubscriptionCharge, unskipCharge, updateAddress, updateCustomer, updateOnetime, updatePaymentMethod, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, validateBundle };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* recharge-client-0.
|
|
2
|
+
* recharge-client-0.14.0.min.js
|
|
3
3
|
* Copyright (c) Recharge
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
* @license Long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
|
|
26
26
|
* Released under the Apache License, Version 2.0
|
|
27
27
|
* see: https://github.com/dcodeIO/Long.js for details
|
|
28
|
-
*/(function(e,t){typeof Wb=="function"&&!0&&r&&r.exports?r.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(te,function(){function e(l,u,p){this.low=l|0,this.high=u|0,this.unsigned=!!p}e.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=function(u){return(u&&u.__isLong__)===!0};var t={},n={};e.fromInt=function(u,p){var d,_;return p?(u=u>>>0,0<=u&&u<256&&(_=n[u],_)?_:(d=new e(u,(u|0)<0?-1:0,!0),0<=u&&u<256&&(n[u]=d),d)):(u=u|0,-128<=u&&u<128&&(_=t[u],_)?_:(d=new e(u,u<0?-1:0,!1),-128<=u&&u<128&&(t[u]=d),d))},e.fromNumber=function(u,p){return p=!!p,isNaN(u)||!isFinite(u)?e.ZERO:!p&&u<=-s?e.MIN_VALUE:!p&&u+1>=s?e.MAX_VALUE:p&&u>=f?e.MAX_UNSIGNED_VALUE:u<0?e.fromNumber(-u,p).negate():new e(u%o|0,u/o|0,p)},e.fromBits=function(u,p,d){return new e(u,p,d)},e.fromString=function(u,p,d){if(u.length===0)throw Error("number format error: empty string");if(u==="NaN"||u==="Infinity"||u==="+Infinity"||u==="-Infinity")return e.ZERO;if(typeof p=="number"&&(d=p,p=!1),d=d||10,d<2||36<d)throw Error("radix out of range: "+d);var _;if((_=u.indexOf("-"))>0)throw Error('number format error: interior "-" character: '+u);if(_===0)return e.fromString(u.substring(1),p,d).negate();for(var E=e.fromNumber(Math.pow(d,8)),$=e.ZERO,b=0;b<u.length;b+=8){var S=Math.min(8,u.length-b),h=parseInt(u.substring(b,b+S),d);if(S<8){var A=e.fromNumber(Math.pow(d,S));$=$.multiply(A).add(e.fromNumber(h))}else $=$.multiply(E),$=$.add(e.fromNumber(h))}return $.unsigned=p,$},e.fromValue=function(u){return u instanceof e?u:typeof u=="number"?e.fromNumber(u):typeof u=="string"?e.fromString(u):new e(u.low,u.high,u.unsigned)};var i=1<<16,a=1<<24,o=i*i,f=o*o,s=f/2,c=e.fromInt(a);return e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*o+(this.low>>>0):this.high*o+(this.low>>>0)},e.prototype.toString=function(u){if(u=u||10,u<2||36<u)throw RangeError("radix out of range: "+u);if(this.isZero())return"0";var p;if(this.isNegative())if(this.equals(e.MIN_VALUE)){var d=e.fromNumber(u),_=this.divide(d);return p=_.multiply(d).subtract(this),_.toString(u)+p.toInt().toString(u)}else return"-"+this.negate().toString(u);var E=e.fromNumber(Math.pow(u,6),this.unsigned);p=this;for(var $="";;){var b=p.divide(E),S=p.subtract(b.multiply(E)).toInt()>>>0,h=S.toString(u);if(p=b,p.isZero())return h+$;for(;h.length<6;)h="0"+h;$=""+h+$}},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(e.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var u=this.high!=0?this.high:this.low,p=31;p>0&&(u&1<<p)==0;p--);return this.high!=0?p+33:p+1},e.prototype.isZero=function(){return this.high===0&&this.low===0},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isOdd=function(){return(this.low&1)===1},e.prototype.isEven=function(){return(this.low&1)===0},e.prototype.equals=function(u){return e.isLong(u)||(u=e.fromValue(u)),this.unsigned!==u.unsigned&&this.high>>>31===1&&u.high>>>31===1?!1:this.high===u.high&&this.low===u.low},e.eq=e.prototype.equals,e.prototype.notEquals=function(u){return!this.equals(u)},e.neq=e.prototype.notEquals,e.prototype.lessThan=function(u){return this.compare(u)<0},e.prototype.lt=e.prototype.lessThan,e.prototype.lessThanOrEqual=function(u){return this.compare(u)<=0},e.prototype.lte=e.prototype.lessThanOrEqual,e.prototype.greaterThan=function(u){return this.compare(u)>0},e.prototype.gt=e.prototype.greaterThan,e.prototype.greaterThanOrEqual=function(u){return this.compare(u)>=0},e.prototype.gte=e.prototype.greaterThanOrEqual,e.prototype.compare=function(u){if(e.isLong(u)||(u=e.fromValue(u)),this.equals(u))return 0;var p=this.isNegative(),d=u.isNegative();return p&&!d?-1:!p&&d?1:this.unsigned?u.high>>>0>this.high>>>0||u.high===this.high&&u.low>>>0>this.low>>>0?-1:1:this.subtract(u).isNegative()?-1:1},e.prototype.negate=function(){return!this.unsigned&&this.equals(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=e.prototype.negate,e.prototype.add=function(u){e.isLong(u)||(u=e.fromValue(u));var p=this.high>>>16,d=this.high&65535,_=this.low>>>16,E=this.low&65535,$=u.high>>>16,b=u.high&65535,S=u.low>>>16,h=u.low&65535,A=0,P=0,R=0,m=0;return m+=E+h,R+=m>>>16,m&=65535,R+=_+S,P+=R>>>16,R&=65535,P+=d+b,A+=P>>>16,P&=65535,A+=p+$,A&=65535,e.fromBits(R<<16|m,A<<16|P,this.unsigned)},e.prototype.subtract=function(u){return e.isLong(u)||(u=e.fromValue(u)),this.add(u.negate())},e.prototype.sub=e.prototype.subtract,e.prototype.multiply=function(u){if(this.isZero()||(e.isLong(u)||(u=e.fromValue(u)),u.isZero()))return e.ZERO;if(this.equals(e.MIN_VALUE))return u.isOdd()?e.MIN_VALUE:e.ZERO;if(u.equals(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return u.isNegative()?this.negate().multiply(u.negate()):this.negate().multiply(u).negate();if(u.isNegative())return this.multiply(u.negate()).negate();if(this.lessThan(c)&&u.lessThan(c))return e.fromNumber(this.toNumber()*u.toNumber(),this.unsigned);var p=this.high>>>16,d=this.high&65535,_=this.low>>>16,E=this.low&65535,$=u.high>>>16,b=u.high&65535,S=u.low>>>16,h=u.low&65535,A=0,P=0,R=0,m=0;return m+=E*h,R+=m>>>16,m&=65535,R+=_*h,P+=R>>>16,R&=65535,R+=E*S,P+=R>>>16,R&=65535,P+=d*h,A+=P>>>16,P&=65535,P+=_*S,A+=P>>>16,P&=65535,P+=E*b,A+=P>>>16,P&=65535,A+=p*h+d*S+_*b+E*$,A&=65535,e.fromBits(R<<16|m,A<<16|P,this.unsigned)},e.prototype.mul=e.prototype.multiply,e.prototype.divide=function(u){if(e.isLong(u)||(u=e.fromValue(u)),u.isZero())throw new Error("division by zero");if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var p,d,_;if(this.equals(e.MIN_VALUE)){if(u.equals(e.ONE)||u.equals(e.NEG_ONE))return e.MIN_VALUE;if(u.equals(e.MIN_VALUE))return e.ONE;var E=this.shiftRight(1);return p=E.divide(u).shiftLeft(1),p.equals(e.ZERO)?u.isNegative()?e.ONE:e.NEG_ONE:(d=this.subtract(u.multiply(p)),_=p.add(d.divide(u)),_)}else if(u.equals(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return u.isNegative()?this.negate().divide(u.negate()):this.negate().divide(u).negate();if(u.isNegative())return this.divide(u.negate()).negate();for(_=e.ZERO,d=this;d.greaterThanOrEqual(u);){p=Math.max(1,Math.floor(d.toNumber()/u.toNumber()));for(var $=Math.ceil(Math.log(p)/Math.LN2),b=$<=48?1:Math.pow(2,$-48),S=e.fromNumber(p),h=S.multiply(u);h.isNegative()||h.greaterThan(d);)p-=b,S=e.fromNumber(p,this.unsigned),h=S.multiply(u);S.isZero()&&(S=e.ONE),_=_.add(S),d=d.subtract(h)}return _},e.prototype.div=e.prototype.divide,e.prototype.modulo=function(u){return e.isLong(u)||(u=e.fromValue(u)),this.subtract(this.divide(u).multiply(u))},e.prototype.mod=e.prototype.modulo,e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.and=function(u){return e.isLong(u)||(u=e.fromValue(u)),e.fromBits(this.low&u.low,this.high&u.high,this.unsigned)},e.prototype.or=function(u){return e.isLong(u)||(u=e.fromValue(u)),e.fromBits(this.low|u.low,this.high|u.high,this.unsigned)},e.prototype.xor=function(u){return e.isLong(u)||(u=e.fromValue(u)),e.fromBits(this.low^u.low,this.high^u.high,this.unsigned)},e.prototype.shiftLeft=function(u){return e.isLong(u)&&(u=u.toInt()),(u&=63)===0?this:u<32?e.fromBits(this.low<<u,this.high<<u|this.low>>>32-u,this.unsigned):e.fromBits(0,this.low<<u-32,this.unsigned)},e.prototype.shl=e.prototype.shiftLeft,e.prototype.shiftRight=function(u){return e.isLong(u)&&(u=u.toInt()),(u&=63)===0?this:u<32?e.fromBits(this.low>>>u|this.high<<32-u,this.high>>u,this.unsigned):e.fromBits(this.high>>u-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=e.prototype.shiftRight,e.prototype.shiftRightUnsigned=function(u){if(e.isLong(u)&&(u=u.toInt()),u&=63,u===0)return this;var p=this.high;if(u<32){var d=this.low;return e.fromBits(d>>>u|p<<32-u,p>>>u,this.unsigned)}else return u===32?e.fromBits(p,0,this.unsigned):e.fromBits(p>>>u-32,0,this.unsigned)},e.prototype.shru=e.prototype.shiftRightUnsigned,e.prototype.toSigned=function(){return this.unsigned?new e(this.low,this.high,!1):this},e.prototype.toUnsigned=function(){return this.unsigned?this:new e(this.low,this.high,!0)},e})})(Zn),Object.defineProperty(ht,"__esModule",{value:!0}),ht.Hyper=void 0;var zb=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}}(),Bo=function r(e,t,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:r(a,t,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},Xb=Zn.exports,vr=No(Xb),Yb=M,Kb=No(Yb);function No(r){return r&&r.__esModule?r:{default:r}}function Zb(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Jb(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function Qb(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var gr=ht.Hyper=function(r){Qb(e,r),zb(e,null,[{key:"read",value:function(n){var i=n.readInt32BE(),a=n.readInt32BE();return this.fromBits(a,i)}},{key:"write",value:function(n,i){if(!(n instanceof this))throw new Error("XDR Write Error: "+n+" is not a Hyper");i.writeInt32BE(n.high),i.writeInt32BE(n.low)}},{key:"fromString",value:function(n){if(!/^-?\d+$/.test(n))throw new Error("Invalid hyper string: "+n);var i=Bo(e.__proto__||Object.getPrototypeOf(e),"fromString",this).call(this,n,!1);return new this(i.low,i.high)}},{key:"fromBits",value:function(n,i){var a=Bo(e.__proto__||Object.getPrototypeOf(e),"fromBits",this).call(this,n,i,!1);return new this(a.low,a.high)}},{key:"isValid",value:function(n){return n instanceof this}}]);function e(t,n){return Zb(this,e),Jb(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!1))}return e}(vr.default);(0,Kb.default)(gr),gr.MAX_VALUE=new gr(vr.default.MAX_VALUE.low,vr.default.MAX_VALUE.high),gr.MIN_VALUE=new gr(vr.default.MIN_VALUE.low,vr.default.MIN_VALUE.high);var xe={};Object.defineProperty(xe,"__esModule",{value:!0}),xe.UnsignedInt=void 0;var ew=Jr,Do=Uo(ew),rw=M,tw=Uo(rw);function Uo(r){return r&&r.__esModule?r:{default:r}}var _r=xe.UnsignedInt={read:function(e){return e.readUInt32BE()},write:function(e,t){if(!(0,Do.default)(e))throw new Error("XDR Write Error: not a number");if(Math.floor(e)!==e)throw new Error("XDR Write Error: not an integer");if(e<0)throw new Error("XDR Write Error: negative number "+e);t.writeUInt32BE(e)},isValid:function(e){return!(0,Do.default)(e)||Math.floor(e)!==e?!1:e>=_r.MIN_VALUE&&e<=_r.MAX_VALUE}};_r.MAX_VALUE=Math.pow(2,32)-1,_r.MIN_VALUE=0,(0,tw.default)(_r);var yt={};Object.defineProperty(yt,"__esModule",{value:!0}),yt.UnsignedHyper=void 0;var nw=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),Co=function r(e,t,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:r(a,t,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},iw=Zn.exports,mr=Lo(iw),aw=M,ow=Lo(aw);function Lo(r){return r&&r.__esModule?r:{default:r}}function uw(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function fw(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function sw(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var br=yt.UnsignedHyper=function(r){sw(e,r),nw(e,null,[{key:"read",value:function(n){var i=n.readInt32BE(),a=n.readInt32BE();return this.fromBits(a,i)}},{key:"write",value:function(n,i){if(!(n instanceof this))throw new Error("XDR Write Error: "+n+" is not an UnsignedHyper");i.writeInt32BE(n.high),i.writeInt32BE(n.low)}},{key:"fromString",value:function(n){if(!/^\d+$/.test(n))throw new Error("Invalid hyper string: "+n);var i=Co(e.__proto__||Object.getPrototypeOf(e),"fromString",this).call(this,n,!0);return new this(i.low,i.high)}},{key:"fromBits",value:function(n,i){var a=Co(e.__proto__||Object.getPrototypeOf(e),"fromBits",this).call(this,n,i,!0);return new this(a.low,a.high)}},{key:"isValid",value:function(n){return n instanceof this}}]);function e(t,n){return uw(this,e),fw(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!0))}return e}(mr.default);(0,ow.default)(br),br.MAX_VALUE=new br(mr.default.MAX_UNSIGNED_VALUE.low,mr.default.MAX_UNSIGNED_VALUE.high),br.MIN_VALUE=new br(mr.default.MIN_VALUE.low,mr.default.MIN_VALUE.high);var dt={};Object.defineProperty(dt,"__esModule",{value:!0}),dt.Float=void 0;var cw=Jr,jo=ko(cw),lw=M,pw=ko(lw);function ko(r){return r&&r.__esModule?r:{default:r}}var hw=dt.Float={read:function(e){return e.readFloatBE()},write:function(e,t){if(!(0,jo.default)(e))throw new Error("XDR Write Error: not a number");t.writeFloatBE(e)},isValid:function(e){return(0,jo.default)(e)}};(0,pw.default)(hw);var vt={};Object.defineProperty(vt,"__esModule",{value:!0}),vt.Double=void 0;var yw=Jr,qo=Vo(yw),dw=M,vw=Vo(dw);function Vo(r){return r&&r.__esModule?r:{default:r}}var gw=vt.Double={read:function(e){return e.readDoubleBE()},write:function(e,t){if(!(0,qo.default)(e))throw new Error("XDR Write Error: not a number");t.writeDoubleBE(e)},isValid:function(e){return(0,qo.default)(e)}};(0,vw.default)(gw);var gt={};Object.defineProperty(gt,"__esModule",{value:!0}),gt.Quadruple=void 0;var _w=M,mw=bw(_w);function bw(r){return r&&r.__esModule?r:{default:r}}var ww=gt.Quadruple={read:function(){throw new Error("XDR Read Error: quadruple not supported")},write:function(){throw new Error("XDR Write Error: quadruple not supported")},isValid:function(){return!1}};(0,mw.default)(ww);var wr={},$w=fe,Ew=H,Ow="[object Boolean]";function Aw(r){return r===!0||r===!1||Ew(r)&&$w(r)==Ow}var Sw=Aw;Object.defineProperty(wr,"__esModule",{value:!0}),wr.Bool=void 0;var Tw=Sw,Iw=Ho(Tw),Go=ue,Pw=M,xw=Ho(Pw);function Ho(r){return r&&r.__esModule?r:{default:r}}var Fw=wr.Bool={read:function(e){var t=Go.Int.read(e);switch(t){case 0:return!1;case 1:return!0;default:throw new Error("XDR Read Error: Got "+t+" when trying to read a bool")}},write:function(e,t){var n=e?1:0;return Go.Int.write(n,t)},isValid:function(e){return(0,Iw.default)(e)}};(0,xw.default)(Fw);var _t={},Rw=fe,Mw=C,Bw=H,Nw="[object String]";function Dw(r){return typeof r=="string"||!Mw(r)&&Bw(r)&&Rw(r)==Nw}var Wo=Dw;Object.defineProperty(_t,"__esModule",{value:!0}),_t.String=void 0;var Uw=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}}(),Cw=Wo,zo=Jn(Cw),Lw=C,jw=Jn(Lw),Xo=ue,kw=xe,Yo=Ie,qw=M,Vw=Jn(qw);function Jn(r){return r&&r.__esModule?r:{default:r}}function Gw(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Hw=_t.String=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:kw.UnsignedInt.MAX_VALUE;Gw(this,r),this._maxLength=e}return Uw(r,[{key:"read",value:function(t){var n=Xo.Int.read(t);if(n>this._maxLength)throw new Error("XDR Read Error: Saw "+n+" length String,"+("max allowed is "+this._maxLength));var i=(0,Yo.calculatePadding)(n),a=t.slice(n);return(0,Yo.slicePadding)(t,i),a.buffer()}},{key:"readString",value:function(t){return this.read(t).toString("utf8")}},{key:"write",value:function(t,n){if(t.length>this._maxLength)throw new Error("XDR Write Error: Got "+t.length+" bytes,"+("max allows is "+this._maxLength));var i=void 0;(0,zo.default)(t)?i=y.from(t,"utf8"):i=y.from(t),Xo.Int.write(i.length,n),n.writeBufferPadded(i)}},{key:"isValid",value:function(t){var n=void 0;if((0,zo.default)(t))n=y.from(t,"utf8");else if((0,jw.default)(t)||y.isBuffer(t))n=y.from(t);else return!1;return n.length<=this._maxLength}}]),r}();(0,Vw.default)(Hw.prototype);var mt={};Object.defineProperty(mt,"__esModule",{value:!0}),mt.Opaque=void 0;var Ww=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}}(),Ko=Ie,zw=M,Xw=Yw(zw);function Yw(r){return r&&r.__esModule?r:{default:r}}function Kw(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Zw=mt.Opaque=function(){function r(e){Kw(this,r),this._length=e,this._padding=(0,Ko.calculatePadding)(e)}return Ww(r,[{key:"read",value:function(t){var n=t.slice(this._length);return(0,Ko.slicePadding)(t,this._padding),n.buffer()}},{key:"write",value:function(t,n){if(t.length!==this._length)throw new Error("XDR Write Error: Got "+t.length+" bytes, expected "+this._length);n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length===this._length}}]),r}();(0,Xw.default)(Zw.prototype);var bt={};Object.defineProperty(bt,"__esModule",{value:!0}),bt.VarOpaque=void 0;var Jw=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}}(),Zo=ue,Qw=xe,Jo=Ie,e1=M,r1=t1(e1);function t1(r){return r&&r.__esModule?r:{default:r}}function n1(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var i1=bt.VarOpaque=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Qw.UnsignedInt.MAX_VALUE;n1(this,r),this._maxLength=e}return Jw(r,[{key:"read",value:function(t){var n=Zo.Int.read(t);if(n>this._maxLength)throw new Error("XDR Read Error: Saw "+n+" length VarOpaque,"+("max allowed is "+this._maxLength));var i=(0,Jo.calculatePadding)(n),a=t.slice(n);return(0,Jo.slicePadding)(t,i),a.buffer()}},{key:"write",value:function(t,n){if(t.length>this._maxLength)throw new Error("XDR Write Error: Got "+t.length+" bytes,"+("max allows is "+this._maxLength));Zo.Int.write(t.length,n),n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length<=this._maxLength}}]),r}();(0,r1.default)(i1.prototype);var wt={},Fe={exports:{}};function a1(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}var Qo=a1,o1=et;function u1(r){return typeof r=="function"?r:o1}var eu=u1,f1=Qo,s1=Mn,c1=eu,l1=C;function p1(r,e){var t=l1(r)?f1:s1;return t(r,c1(e))}var h1=p1;(function(r){r.exports=h1})(Fe);var y1=/\s/;function d1(r){for(var e=r.length;e--&&y1.test(r.charAt(e)););return e}var v1=d1,g1=v1,_1=/^\s+/;function m1(r){return r&&r.slice(0,g1(r)+1).replace(_1,"")}var b1=m1,w1=b1,ru=ge,$1=ct,tu=0/0,E1=/^[-+]0x[0-9a-f]+$/i,O1=/^0b[01]+$/i,A1=/^0o[0-7]+$/i,S1=parseInt;function T1(r){if(typeof r=="number")return r;if($1(r))return tu;if(ru(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=ru(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=w1(r);var t=O1.test(r);return t||A1.test(r)?S1(r.slice(2),t?2:8):E1.test(r)?tu:+r}var I1=T1,P1=I1,nu=1/0,x1=17976931348623157e292;function F1(r){if(!r)return r===0?r:0;if(r=P1(r),r===nu||r===-nu){var e=r<0?-1:1;return e*x1}return r===r?r:0}var R1=F1,M1=R1;function B1(r){var e=M1(r),t=e%1;return e===e?t?e-t:e:0}var N1=B1,D1=La,U1=eu,C1=N1,L1=9007199254740991,Qn=4294967295,j1=Math.min;function k1(r,e){if(r=C1(r),r<1||r>L1)return[];var t=Qn,n=j1(r,Qn);e=U1(e),r-=Qn;for(var i=D1(n,e);++t<r;)e(t);return i}var iu=k1;Object.defineProperty(wt,"__esModule",{value:!0}),wt.Array=void 0;var q1=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}}(),V1=Yn,G1=$r(V1),H1=Fe.exports,W1=$r(H1),z1=iu,X1=$r(z1),Y1=C,au=$r(Y1),K1=M,Z1=$r(K1);function $r(r){return r&&r.__esModule?r:{default:r}}function J1(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Q1=wt.Array=function(){function r(e,t){J1(this,r),this._childType=e,this._length=t}return q1(r,[{key:"read",value:function(t){var n=this;return(0,X1.default)(this._length,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,au.default)(t))throw new Error("XDR Write Error: value is not array");if(t.length!==this._length)throw new Error("XDR Write Error: Got array of size "+t.length+","+("expected "+this._length));(0,W1.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,au.default)(t)||t.length!==this._length?!1:(0,G1.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,Z1.default)(Q1.prototype);var $t={};Object.defineProperty($t,"__esModule",{value:!0}),$t.VarArray=void 0;var e$=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}}(),r$=Yn,t$=Er(r$),n$=Fe.exports,i$=Er(n$),a$=iu,o$=Er(a$),u$=C,ou=Er(u$),f$=xe,uu=ue,s$=M,c$=Er(s$);function Er(r){return r&&r.__esModule?r:{default:r}}function l$(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var p$=$t.VarArray=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f$.UnsignedInt.MAX_VALUE;l$(this,r),this._childType=e,this._maxLength=t}return e$(r,[{key:"read",value:function(t){var n=this,i=uu.Int.read(t);if(i>this._maxLength)throw new Error("XDR Read Error: Saw "+i+" length VarArray,"+("max allowed is "+this._maxLength));return(0,o$.default)(i,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,ou.default)(t))throw new Error("XDR Write Error: value is not array");if(t.length>this._maxLength)throw new Error("XDR Write Error: Got array of size "+t.length+","+("max allowed is "+this._maxLength));uu.Int.write(t.length,n),(0,i$.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,ou.default)(t)||t.length>this._maxLength?!1:(0,t$.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,c$.default)(p$.prototype);var Et={};function h$(r){return r===null}var y$=h$;function d$(r){return r===void 0}var Or=d$;Object.defineProperty(Et,"__esModule",{value:!0}),Et.Option=void 0;var v$=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}}(),g$=y$,fu=ei(g$),_$=Or,su=ei(_$),cu=wr,m$=M,b$=ei(m$);function ei(r){return r&&r.__esModule?r:{default:r}}function w$(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var $$=Et.Option=function(){function r(e){w$(this,r),this._childType=e}return v$(r,[{key:"read",value:function(t){if(cu.Bool.read(t))return this._childType.read(t)}},{key:"write",value:function(t,n){var i=!((0,fu.default)(t)||(0,su.default)(t));cu.Bool.write(i,n),i&&this._childType.write(t,n)}},{key:"isValid",value:function(t){return(0,fu.default)(t)||(0,su.default)(t)?!0:this._childType.isValid(t)}}]),r}();(0,b$.default)($$.prototype);var Ar={};Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.Void=void 0;var E$=Or,lu=pu(E$),O$=M,A$=pu(O$);function pu(r){return r&&r.__esModule?r:{default:r}}var S$=Ar.Void={read:function(){},write:function(e){if(!(0,lu.default)(e))throw new Error("XDR Write Error: trying to write value to a void slot")},isValid:function(e){return(0,lu.default)(e)}};(0,A$.default)(S$);var Ot={},T$=lt;function I$(r,e){return T$(e,function(t){return r[t]})}var P$=I$,x$=P$,F$=He;function R$(r){return r==null?[]:x$(r,F$(r))}var M$=R$;Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.Enum=void 0;var B$=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),N$=Fe.exports,D$=ri(N$),U$=M$,C$=ri(U$),hu=ue,L$=M,j$=ri(L$);function ri(r){return r&&r.__esModule?r:{default:r}}function k$(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function q$(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function yu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var V$=Ot.Enum=function(){function r(e,t){yu(this,r),this.name=e,this.value=t}return B$(r,null,[{key:"read",value:function(t){var n=hu.Int.read(t);if(!this._byValue.has(n))throw new Error("XDR Read Error: Unknown "+this.enumName+" member for value "+n);return this._byValue.get(n)}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: Unknown "+t+" is not a "+this.enumName);hu.Int.write(t.value,n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"members",value:function(){return this._members}},{key:"values",value:function(){return(0,C$.default)(this._members)}},{key:"fromName",value:function(t){var n=this._members[t];if(!n)throw new Error(t+" is not a member of "+this.enumName);return n}},{key:"fromValue",value:function(t){var n=this._byValue.get(t);if(!n)throw new Error(t+" is not a value of any member of "+this.enumName);return n}},{key:"create",value:function(t,n,i){var a=function(o){q$(f,o);function f(){return yu(this,f),k$(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}return f}(r);return a.enumName=n,t.results[n]=a,a._members={},a._byValue=new Map,(0,D$.default)(i,function(o,f){var s=new a(f,o);a._members[f]=s,a._byValue.set(o,s),a[f]=function(){return s}}),a}}]),r}();(0,j$.default)(V$);var At={},G$=Mn,H$=lr;function W$(r,e){var t=-1,n=H$(r)?Array(r.length):[];return G$(r,function(i,a,o){n[++t]=e(i,a,o)}),n}var z$=W$,X$=lt,Y$=Io,K$=z$,Z$=C;function J$(r,e){var t=Z$(r)?X$:K$;return t(r,Y$(e))}var Q$=J$;function eE(r){for(var e=-1,t=r==null?0:r.length,n={};++e<t;){var i=r[e];n[i[0]]=i[1]}return n}var rE=eE,Sr={};Object.defineProperty(Sr,"__esModule",{value:!0});var tE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function nE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}Sr.Reference=function(){function r(){nE(this,r)}return tE(r,[{key:"resolve",value:function(){throw new Error("implement resolve in child class")}}]),r}(),Object.defineProperty(At,"__esModule",{value:!0}),At.Struct=void 0;var St=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var f=e[Symbol.iterator](),s;!(i=(s=f.next()).done)&&(n.push(s.value),!(t&&n.length===t));i=!0);}catch(c){a=!0,o=c}finally{try{!i&&f.return&&f.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),iE=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}}(),aE=Fe.exports,du=Tr(aE),oE=Q$,uE=Tr(oE),fE=Or,sE=Tr(fE),cE=rE,lE=Tr(cE),pE=Sr,hE=M,yE=Tr(hE);function Tr(r){return r&&r.__esModule?r:{default:r}}function dE(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function vE(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function vu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var gE=At.Struct=function(){function r(e){vu(this,r),this._attributes=e||{}}return iE(r,null,[{key:"read",value:function(t){var n=(0,uE.default)(this._fields,function(i){var a=St(i,2),o=a[0],f=a[1],s=f.read(t);return[o,s]});return new this((0,lE.default)(n))}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.structName);(0,du.default)(this._fields,function(i){var a=St(i,2),o=a[0],f=a[1],s=t._attributes[o];f.write(s,n)})}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(o){vE(f,o);function f(){return vu(this,f),dE(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}return f}(r);return a.structName=n,t.results[n]=a,a._fields=i.map(function(o){var f=St(o,2),s=f[0],c=f[1];return c instanceof pE.Reference&&(c=c.resolve(t)),[s,c]}),(0,du.default)(a._fields,function(o){var f=St(o,1),s=f[0];a.prototype[s]=_E(s)}),a}}]),r}();(0,yE.default)(gE);function _E(r){return function(t){return(0,sE.default)(t)||(this._attributes[r]=t),this._attributes[r]}}var Tt={};Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.Union=void 0;var mE=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var f=e[Symbol.iterator](),s;!(i=(s=f.next()).done)&&(n.push(s.value),!(t&&n.length===t));i=!0);}catch(c){a=!0,o=c}finally{try{!i&&f.return&&f.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),bE=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}}(),wE=Fe.exports,It=xt(wE),$E=Or,gu=xt($E),EE=Wo,_u=xt(EE),Pt=Ar,ti=Sr,OE=M,AE=xt(OE);function xt(r){return r&&r.__esModule?r:{default:r}}function SE(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function TE(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function mu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var IE=Tt.Union=function(){function r(e,t){mu(this,r),this.set(e,t)}return bE(r,[{key:"set",value:function(t,n){(0,_u.default)(t)&&(t=this.constructor._switchOn.fromName(t)),this._switch=t,this._arm=this.constructor.armForSwitch(this._switch),this._armType=this.constructor.armTypeForArm(this._arm),this._value=n}},{key:"get",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this._arm;if(this._arm!==Pt.Void&&this._arm!==t)throw new Error(t+" not set");return this._value}},{key:"switch",value:function(){return this._switch}},{key:"arm",value:function(){return this._arm}},{key:"armType",value:function(){return this._armType}},{key:"value",value:function(){return this._value}}],[{key:"armForSwitch",value:function(t){if(this._switches.has(t))return this._switches.get(t);if(this._defaultArm)return this._defaultArm;throw new Error("Bad union switch: "+t)}},{key:"armTypeForArm",value:function(t){return t===Pt.Void?Pt.Void:this._arms[t]}},{key:"read",value:function(t){var n=this._switchOn.read(t),i=this.armForSwitch(n),a=this.armTypeForArm(i),o=void 0;return(0,gu.default)(a)?o=i.read(t):o=a.read(t),new this(n,o)}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.unionName);this._switchOn.write(t.switch(),n),t.armType().write(t.value(),n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(f){TE(s,f);function s(){return mu(this,s),SE(this,(s.__proto__||Object.getPrototypeOf(s)).apply(this,arguments))}return s}(r);a.unionName=n,t.results[n]=a,i.switchOn instanceof ti.Reference?a._switchOn=i.switchOn.resolve(t):a._switchOn=i.switchOn,a._switches=new Map,a._arms={},(0,It.default)(i.arms,function(f,s){f instanceof ti.Reference&&(f=f.resolve(t)),a._arms[s]=f});var o=i.defaultArm;return o instanceof ti.Reference&&(o=o.resolve(t)),a._defaultArm=o,(0,It.default)(i.switches,function(f){var s=mE(f,2),c=s[0],l=s[1];(0,_u.default)(c)&&(c=a._switchOn.fromName(c)),a._switches.set(c,l)}),(0,gu.default)(a._switchOn.values)||(0,It.default)(a._switchOn.values(),function(f){a[f.name]=function(s){return new a(f,s)},a.prototype[f.name]=function(c){return this.set(f,c)}}),(0,It.default)(a._arms,function(f,s){f!==Pt.Void&&(a.prototype[s]=function(){return this.get(s)})}),a}}]),r}();(0,AE.default)(IE),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=ue;Object.keys(e).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return e[h]}})});var t=ht;Object.keys(t).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return t[h]}})});var n=xe;Object.keys(n).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return n[h]}})});var i=yt;Object.keys(i).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return i[h]}})});var a=dt;Object.keys(a).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return a[h]}})});var o=vt;Object.keys(o).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return o[h]}})});var f=gt;Object.keys(f).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return f[h]}})});var s=wr;Object.keys(s).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return s[h]}})});var c=_t;Object.keys(c).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return c[h]}})});var l=mt;Object.keys(l).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return l[h]}})});var u=bt;Object.keys(u).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return u[h]}})});var p=wt;Object.keys(p).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return p[h]}})});var d=$t;Object.keys(d).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return d[h]}})});var _=Et;Object.keys(_).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return _[h]}})});var E=Ar;Object.keys(E).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return E[h]}})});var $=Ot;Object.keys($).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return $[h]}})});var b=At;Object.keys(b).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return b[h]}})});var S=Tt;Object.keys(S).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return S[h]}})})}(An);var bu={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=function(){function m(v,g){for(var w=0;w<g.length;w++){var O=g[w];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(v,O.key,O)}}return function(v,g,w){return g&&m(v.prototype,g),w&&m(v,w),v}}(),t=Sr;Object.keys(t).forEach(function(m){m==="default"||m==="__esModule"||Object.defineProperty(r,m,{enumerable:!0,get:function(){return t[m]}})}),r.config=_;var n=Or,i=l(n),a=Fe.exports,o=l(a),f=An,s=c(f);function c(m){if(m&&m.__esModule)return m;var v={};if(m!=null)for(var g in m)Object.prototype.hasOwnProperty.call(m,g)&&(v[g]=m[g]);return v.default=m,v}function l(m){return m&&m.__esModule?m:{default:m}}function u(m,v){if(!(m instanceof v))throw new TypeError("Cannot call a class as a function")}function p(m,v){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:m}function d(m,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);m.prototype=Object.create(v&&v.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(m,v):m.__proto__=v)}function _(m){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(m){var g=new R(v);m(g),g.resolve()}return v}var E=function(m){d(v,m);function v(g){u(this,v);var w=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this));return w.name=g,w}return e(v,[{key:"resolve",value:function(w){var O=w.definitions[this.name];return O.resolve(w)}}]),v}(t.Reference),$=function(m){d(v,m);function v(g,w){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;u(this,v);var L=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this));return L.childReference=g,L.length=w,L.variable=O,L}return e(v,[{key:"resolve",value:function(w){var O=this.childReference,L=this.length;return O instanceof t.Reference&&(O=O.resolve(w)),L instanceof t.Reference&&(L=L.resolve(w)),this.variable?new s.VarArray(O,L):new s.Array(O,L)}}]),v}(t.Reference),b=function(m){d(v,m);function v(g){u(this,v);var w=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this));return w.childReference=g,w.name=g.name,w}return e(v,[{key:"resolve",value:function(w){var O=this.childReference;return O instanceof t.Reference&&(O=O.resolve(w)),new s.Option(O)}}]),v}(t.Reference),S=function(m){d(v,m);function v(g,w){u(this,v);var O=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this));return O.sizedType=g,O.length=w,O}return e(v,[{key:"resolve",value:function(w){var O=this.length;return O instanceof t.Reference&&(O=O.resolve(w)),new this.sizedType(O)}}]),v}(t.Reference),h=function(){function m(v,g,w){u(this,m),this.constructor=v,this.name=g,this.config=w}return e(m,[{key:"resolve",value:function(g){return this.name in g.results?g.results[this.name]:this.constructor(g,this.name,this.config)}}]),m}();function A(m,v,g){return g instanceof t.Reference&&(g=g.resolve(m)),m.results[v]=g,g}function P(m,v,g){return m.results[v]=g,g}var R=function(){function m(v){u(this,m),this._destination=v,this._definitions={}}return e(m,[{key:"enum",value:function(g,w){var O=new h(s.Enum.create,g,w);this.define(g,O)}},{key:"struct",value:function(g,w){var O=new h(s.Struct.create,g,w);this.define(g,O)}},{key:"union",value:function(g,w){var O=new h(s.Union.create,g,w);this.define(g,O)}},{key:"typedef",value:function(g,w){var O=new h(A,g,w);this.define(g,O)}},{key:"const",value:function(g,w){var O=new h(P,g,w);this.define(g,O)}},{key:"void",value:function(){return s.Void}},{key:"bool",value:function(){return s.Bool}},{key:"int",value:function(){return s.Int}},{key:"hyper",value:function(){return s.Hyper}},{key:"uint",value:function(){return s.UnsignedInt}},{key:"uhyper",value:function(){return s.UnsignedHyper}},{key:"float",value:function(){return s.Float}},{key:"double",value:function(){return s.Double}},{key:"quadruple",value:function(){return s.Quadruple}},{key:"string",value:function(g){return new S(s.String,g)}},{key:"opaque",value:function(g){return new S(s.Opaque,g)}},{key:"varOpaque",value:function(g){return new S(s.VarOpaque,g)}},{key:"array",value:function(g,w){return new $(g,w)}},{key:"varArray",value:function(g,w){return new $(g,w,!0)}},{key:"option",value:function(g){return new b(g)}},{key:"define",value:function(g,w){if((0,i.default)(this._destination[g]))this._definitions[g]=w;else throw new Error("XDRTypes Error:"+g+" is already defined")}},{key:"lookup",value:function(g){return new E(g)}},{key:"resolve",value:function(){var g=this;(0,o.default)(this._definitions,function(w){w.resolve({definitions:g._definitions,results:g._destination})})}}]),m}()})(bu),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=An;Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[n]}})});var t=bu;Object.keys(t).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[n]}})})}(wa),Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.xdr=void 0;const PE=(0,wa.config)(r=>{r.enum("EnvelopeType",{envelopeTypeBundle:0}),r.typedef("Uint32",r.uint()),r.typedef("Uint64",r.uhyper()),r.union("BundleItemExt",{switchOn:r.int(),switchName:"v",switches:[[0,r.void()]],arms:{}}),r.struct("BundleItem",[["collectionId",r.lookup("Uint64")],["productId",r.lookup("Uint64")],["variantId",r.lookup("Uint64")],["sku",r.string()],["quantity",r.lookup("Uint32")],["ext",r.lookup("BundleItemExt")]]),r.union("BundleExt",{switchOn:r.int(),switchName:"v",switches:[[0,r.void()]],arms:{}}),r.struct("Bundle",[["variantId",r.lookup("Uint64")],["items",r.varArray(r.lookup("BundleItem"),500)],["version",r.lookup("Uint32")],["ext",r.lookup("BundleExt")]]),r.union("BundleEnvelope",{switchOn:r.lookup("EnvelopeType"),switchName:"type",switches:[["envelopeTypeBundle","v1"]],arms:{v1:r.lookup("Bundle")}})});Zr.xdr=PE,Object.defineProperty(oe,"__esModule",{value:!0}),oe.decodeToLegacyBoxOrder=oe.encodeLegacyBoxOrder=oe.toBundle=$u=oe.toLineItemProperty=void 0;const ee=Zr;function wu(r){let e={variantId:ee.xdr.Uint64.fromString(r.variantId.toString()),version:r.version||Math.floor(Date.now()/1e3),items:r.items.map(n=>new ee.xdr.BundleItem({collectionId:ee.xdr.Uint64.fromString(n.collectionId.toString()),productId:ee.xdr.Uint64.fromString(n.productId.toString()),variantId:ee.xdr.Uint64.fromString(n.variantId.toString()),sku:n.sku||"",quantity:n.quantity,ext:new ee.xdr.BundleItemExt(0)})),ext:new ee.xdr.BundleExt(0)};const t=new ee.xdr.Bundle(e);return ee.xdr.BundleEnvelope.envelopeTypeBundle(t).toXDR("base64")}var $u=oe.toLineItemProperty=wu;function Eu(r){const e=ee.xdr.BundleEnvelope.fromXDR(r,"base64").v1();return{variantId:e.variantId().toString(),version:e.version(),items:e.items().map(t=>({collectionId:t.collectionId().toString(),productId:t.productId().toString(),variantId:t.variantId().toString(),sku:t.sku().toString(),quantity:t.quantity()}))}}oe.toBundle=Eu;function xE(r,e,t=1){const n={variantId:r.toString(),version:t,items:[]};for(const i in e)if(Object.hasOwnProperty.call(e,i)){const a=e[i];n.items.push({collectionId:a.dsId.toString(),productId:a.pId.toString(),variantId:a.vId.toString(),sku:a.sku||"",quantity:a.qty})}return wu(n)}oe.encodeLegacyBoxOrder=xE;function FE(r){let e={};try{Eu(r).items.forEach(n=>{e[n.variantId]={dsId:n.collectionId,pId:Number.parseInt(n.productId),vId:Number.parseInt(n.variantId),sku:n.sku,qty:n.quantity}})}catch{e=JSON.parse(y.from(r,"base64").toString())}return e}oe.decodeToLegacyBoxOrder=FE;var RE=Ge,ME=He;function BE(r,e){return r&&RE(e,ME(e),r)}var NE=BE,DE=Ge,UE=rt;function CE(r,e){return r&&DE(e,UE(e),r)}var LE=CE,ni={exports:{}};(function(r,e){var t=Q,n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,o=a?t.Buffer:void 0,f=o?o.allocUnsafe:void 0;function s(c,l){if(l)return c.slice();var u=c.length,p=f?f(u):new c.constructor(u);return c.copy(p),p}r.exports=s})(ni,ni.exports);function jE(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}var kE=jE,qE=Ge,VE=Ln;function GE(r,e){return qE(r,VE(r),e)}var HE=GE,WE=Wa,zE=WE(Object.getPrototypeOf,Object),ii=zE,XE=Cn,YE=ii,KE=Ln,ZE=ro,JE=Object.getOwnPropertySymbols,QE=JE?function(r){for(var e=[];r;)XE(e,KE(r)),r=YE(r);return e}:ZE,Ou=QE,eO=Ge,rO=Ou;function tO(r,e){return eO(r,rO(r),e)}var nO=tO,iO=eo,aO=Ou,oO=rt;function uO(r){return iO(r,oO,aO)}var Au=uO,fO=Object.prototype,sO=fO.hasOwnProperty;function cO(r){var e=r.length,t=new r.constructor(e);return e&&typeof r[0]=="string"&&sO.call(r,"index")&&(t.index=r.index,t.input=r.input),t}var lO=cO,Su=Ka;function pO(r){var e=new r.constructor(r.byteLength);return new Su(e).set(new Su(r)),e}var ai=pO,hO=ai;function yO(r,e){var t=e?hO(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)}var dO=yO,vO=/\w*$/;function gO(r){var e=new r.constructor(r.source,vO.exec(r));return e.lastIndex=r.lastIndex,e}var _O=gO,Tu=Ve,Iu=Tu?Tu.prototype:void 0,Pu=Iu?Iu.valueOf:void 0;function mO(r){return Pu?Object(Pu.call(r)):{}}var bO=mO,wO=ai;function $O(r,e){var t=e?wO(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)}var EO=$O,OO=ai,AO=dO,SO=_O,TO=bO,IO=EO,PO="[object Boolean]",xO="[object Date]",FO="[object Map]",RO="[object Number]",MO="[object RegExp]",BO="[object Set]",NO="[object String]",DO="[object Symbol]",UO="[object ArrayBuffer]",CO="[object DataView]",LO="[object Float32Array]",jO="[object Float64Array]",kO="[object Int8Array]",qO="[object Int16Array]",VO="[object Int32Array]",GO="[object Uint8Array]",HO="[object Uint8ClampedArray]",WO="[object Uint16Array]",zO="[object Uint32Array]";function XO(r,e,t){var n=r.constructor;switch(e){case UO:return OO(r);case PO:case xO:return new n(+r);case CO:return AO(r,t);case LO:case jO:case kO:case qO:case VO:case GO:case HO:case WO:case zO:return IO(r,t);case FO:return new n;case RO:case NO:return new n(r);case MO:return SO(r);case BO:return new n;case DO:return TO(r)}}var YO=XO,KO=ge,xu=Object.create,ZO=function(){function r(){}return function(e){if(!KO(e))return{};if(xu)return xu(e);r.prototype=e;var t=new r;return r.prototype=void 0,t}}(),JO=ZO,QO=JO,eA=ii,rA=Rn;function tA(r){return typeof r.constructor=="function"&&!rA(r)?QO(eA(r)):{}}var nA=tA,iA=ft,aA=H,oA="[object Map]";function uA(r){return aA(r)&&iA(r)==oA}var fA=uA,sA=fA,cA=Fn,Fu=hr.exports,Ru=Fu&&Fu.isMap,lA=Ru?cA(Ru):sA,pA=lA,hA=ft,yA=H,dA="[object Set]";function vA(r){return yA(r)&&hA(r)==dA}var gA=vA,_A=gA,mA=Fn,Mu=hr.exports,Bu=Mu&&Mu.isSet,bA=Bu?mA(Bu):_A,wA=bA,$A=Dn,EA=Qo,OA=Ma,AA=NE,SA=LE,TA=ni.exports,IA=kE,PA=HE,xA=nO,FA=no,RA=Au,MA=ft,BA=lO,NA=YO,DA=nA,UA=C,CA=pr.exports,LA=pA,jA=ge,kA=wA,qA=He,VA=rt,GA=1,HA=2,WA=4,Nu="[object Arguments]",zA="[object Array]",XA="[object Boolean]",YA="[object Date]",KA="[object Error]",Du="[object Function]",ZA="[object GeneratorFunction]",JA="[object Map]",QA="[object Number]",Uu="[object Object]",eS="[object RegExp]",rS="[object Set]",tS="[object String]",nS="[object Symbol]",iS="[object WeakMap]",aS="[object ArrayBuffer]",oS="[object DataView]",uS="[object Float32Array]",fS="[object Float64Array]",sS="[object Int8Array]",cS="[object Int16Array]",lS="[object Int32Array]",pS="[object Uint8Array]",hS="[object Uint8ClampedArray]",yS="[object Uint16Array]",dS="[object Uint32Array]",x={};x[Nu]=x[zA]=x[aS]=x[oS]=x[XA]=x[YA]=x[uS]=x[fS]=x[sS]=x[cS]=x[lS]=x[JA]=x[QA]=x[Uu]=x[eS]=x[rS]=x[tS]=x[nS]=x[pS]=x[hS]=x[yS]=x[dS]=!0,x[KA]=x[Du]=x[iS]=!1;function Ft(r,e,t,n,i,a){var o,f=e&GA,s=e&HA,c=e&WA;if(t&&(o=i?t(r,n,i,a):t(r)),o!==void 0)return o;if(!jA(r))return r;var l=UA(r);if(l){if(o=BA(r),!f)return IA(r,o)}else{var u=MA(r),p=u==Du||u==ZA;if(CA(r))return TA(r,f);if(u==Uu||u==Nu||p&&!i){if(o=s||p?{}:DA(r),!f)return s?xA(r,SA(o,r)):PA(r,AA(o,r))}else{if(!x[u])return i?r:{};o=NA(r,u,f)}}a||(a=new $A);var d=a.get(r);if(d)return d;a.set(r,o),kA(r)?r.forEach(function($){o.add(Ft($,e,t,$,r,a))}):LA(r)&&r.forEach(function($,b){o.set(b,Ft($,e,t,b,r,a))});var _=c?s?RA:FA:s?VA:qA,E=l?void 0:_(r);return EA(E||r,function($,b){E&&(b=$,$=r[b]),OA(o,b,Ft($,e,t,b,r,a))}),o}var vS=Ft;function gS(r){var e=r==null?0:r.length;return e?r[e-1]:void 0}var _S=gS;function mS(r,e,t){var n=-1,i=r.length;e<0&&(e=-e>i?0:i+e),t=t>i?i:t,t<0&&(t+=i),i=e>t?0:t-e>>>0,e>>>=0;for(var a=Array(i);++n<i;)a[n]=r[n+e];return a}var bS=mS,wS=Xn,$S=bS;function ES(r,e){return e.length<2?r:wS(r,$S(e,0,-1))}var OS=ES,AS=pt,SS=_S,TS=OS,IS=yr;function PS(r,e){return e=AS(e,r),r=TS(r,e),r==null||delete r[IS(SS(e))]}var xS=PS,FS=fe,RS=ii,MS=H,BS="[object Object]",NS=Function.prototype,DS=Object.prototype,Cu=NS.toString,US=DS.hasOwnProperty,CS=Cu.call(Object);function LS(r){if(!MS(r)||FS(r)!=BS)return!1;var e=RS(r);if(e===null)return!0;var t=US.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Cu.call(t)==CS}var jS=LS,kS=jS;function qS(r){return kS(r)?void 0:r}var VS=qS,Lu=Ve,GS=xn,HS=C,ju=Lu?Lu.isConcatSpreadable:void 0;function WS(r){return HS(r)||GS(r)||!!(ju&&r&&r[ju])}var zS=WS,XS=Cn,YS=zS;function ku(r,e,t,n,i){var a=-1,o=r.length;for(t||(t=YS),i||(i=[]);++a<o;){var f=r[a];e>0&&t(f)?e>1?ku(f,e-1,t,n,i):XS(i,f):n||(i[i.length]=f)}return i}var KS=ku,ZS=KS;function JS(r){var e=r==null?0:r.length;return e?ZS(r,1):[]}var QS=JS,eT=QS,rT=Na,tT=Ua;function nT(r){return tT(rT(r,void 0,eT),r+"")}var iT=nT,aT=lt,oT=vS,uT=xS,fT=pt,sT=Ge,cT=VS,lT=iT,pT=Au,hT=1,yT=2,dT=4,vT=lT(function(r,e){var t={};if(r==null)return t;var n=!1;e=aT(e,function(a){return a=fT(a,r),n||(n=a.length>1),a}),sT(r,pT(r),t),n&&(t=oT(t,hT|yT|dT,cT));for(var i=e.length;i--;)uT(t,e[i]);return t}),gT=vT,_T=Object.defineProperty,mT=Object.defineProperties,bT=Object.getOwnPropertyDescriptors,qu=Object.getOwnPropertySymbols,wT=Object.prototype.hasOwnProperty,$T=Object.prototype.propertyIsEnumerable,Vu=(r,e,t)=>e in r?_T(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ET=(r,e)=>{for(var t in e||(e={}))wT.call(e,t)&&Vu(r,t,e[t]);if(qu)for(var t of qu(e))$T.call(e,t)&&Vu(r,t,e[t]);return r},OT=(r,e)=>mT(r,bT(e));function AT(r){try{return JSON.parse(r)}catch{return r}}function ST(r){return Object.entries(r).reduce((e,[t,n])=>OT(ET({},e),{[t]:AT(n)}),{})}var TT=Object.defineProperty,IT=Object.defineProperties,PT=Object.getOwnPropertyDescriptors,Gu=Object.getOwnPropertySymbols,xT=Object.prototype.hasOwnProperty,FT=Object.prototype.propertyIsEnumerable,Hu=(r,e,t)=>e in r?TT(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wu=(r,e)=>{for(var t in e||(e={}))xT.call(e,t)&&Hu(r,t,e[t]);if(Gu)for(var t of Gu(e))FT.call(e,t)&&Hu(r,t,e[t]);return r},zu=(r,e)=>IT(r,PT(e));function Xu(r){var e;const t=ST(r),n=t.auto_inject===void 0?!0:t.auto_inject,i=(e=t.display_on)!=null?e:[],a=t.first_option==="autodeliver";return zu(Wu({},gT(t,["display_on","first_option"])),{auto_inject:n,valid_pages:i,is_subscription_first:a,autoInject:n,validPages:i,isSubscriptionFirst:a})}function Yu(r){var e;const t=((e=r.subscription_options)==null?void 0:e.storefront_purchase_options)==="subscription_only";return zu(Wu({},r),{is_subscription_only:t,isSubscriptionOnly:t})}function RT(r){return r.map(e=>{const t={};return Object.entries(e).forEach(([n,i])=>{t[n]=Yu(i)}),t})}const Rt="2020-12",MT={store_currency:{currency_code:"USD",currency_symbol:"$",decimal_separator:".",thousands_separator:",",currency_symbol_location:"left"}},Ir=new Map;function Mt(r,e){return Ir.has(r)||Ir.set(r,e()),Ir.get(r)}async function oi(r){const{product:e}=await Mt(`product.${r}`,()=>Kr("get",`/product/${Rt}/${r}.json`));return Yu(e)}async function Ku(){return await Mt("storeSettings",()=>Kr("get",`/${Rt}/store_settings.json`).catch(()=>MT))}async function Zu(){const{widget_settings:r}=await Mt("widgetSettings",()=>Kr("get",`/${Rt}/widget_settings.json`));return Xu(r)}async function Ju(){const{products:r,widget_settings:e,store_settings:t,meta:n}=await Mt("productsAndSettings",()=>Kr("get",`/product/${Rt}/products.json`));return n?.status==="error"?Promise.reject(n.message):{products:RT(r),widget_settings:Xu(e),store_settings:t??{}}}async function BT(){const{products:r}=await Ju();return r}async function NT(r){const[e,t,n]=await Promise.all([oi(r),Ku(),Zu()]);return{product:e,store_settings:t,widget_settings:n,storeSettings:t,widgetSettings:n}}async function Qu(r){const{bundle_product:e}=await oi(r);return e}async function ef(){return Array.from(Ir.keys()).forEach(r=>Ir.delete(r))}var DT=Object.freeze({__proto__:null,getCDNProduct:oi,getCDNStoreSettings:Ku,getCDNWidgetSettings:Zu,getCDNProductsAndSettings:Ju,getCDNProducts:BT,getCDNProductAndSettings:NT,getCDNBundleSettings:Qu,resetCDNCache:ef});const rf="/bundling-storefront-manager";function UT(){return Math.ceil(Date.now()/1e3)}async function CT(){try{const{timestamp:r}=await On("get",`${rf}/t`,{headers:{"X-Recharge-App":"storefront-client"}});return r}catch(r){return console.error(`Fetch failed: ${r}. Using client-side date.`),UT()}}async function LT(r){const e=sr();if(!await tf(r))throw new Error("Bundle selection is invalid.");const t=await CT(),n=$u({variantId:r.externalVariantId,version:t,items:r.selections.map(i=>({collectionId:i.collectionId,productId:i.externalProductId,variantId:i.externalVariantId,quantity:i.quantity,sku:""}))});try{const i=await On("post",`${rf}/api/v1/bundles`,{data:{bundle:n},headers:{Origin:`https://${e.storeIdentifier}`}});if(!i.id||i.code!==200)throw new Error(`1: failed generating rb_id: ${JSON.stringify(i)}`);return i.id}catch(i){throw new Error(`2: failed generating rb_id ${i}`)}}async function tf(r){try{const e=await Qu(r.externalProductId);return!!r&&!!e}catch{return console.error("Error fetching bundle settings"),!1}}var jT=Object.freeze({__proto__:null,getBundleId:LT,validateBundle:tf});async function kT(r,e){const{charge:t}=await T("get","/charges",{id:e},r);return t}function qT(r,e){return T("get","/charges",{query:e},r)}async function VT(r,e,t){const{charge:n}=await T("post",`/charges/${e}/apply_discount`,{data:t},r);return n}async function GT(r,e){const{charge:t}=await T("post",`/charges/${e}/remove_discount`,{},r);return t}async function HT(r,e){const{charge:t}=await T("post",`/charges/${e}/skip`,{},r);return t}async function WT(r,e){const{charge:t}=await T("post",`/charges/${e}/unskip`,{},r);return t}var zT=Object.freeze({__proto__:null,getCharge:kT,listCharges:qT,applyDiscount:VT,removeDiscount:GT,skipCharge:HT,unskipCharge:WT});async function XT(r,e){const{membership:t}=await T("get","/memberships",{id:e},r);return t}function YT(r,e){return T("get","/memberships",{query:e},r)}async function KT(r,e,t){const{membership:n}=await T("post",`/memberships/${e}/cancel`,{data:t},r);return n}async function ZT(r,e,t){const{membership:n}=await T("post",`/memberships/${e}/activate`,{data:t},r);return n}var JT=Object.freeze({__proto__:null,getMembership:XT,listMemberships:YT,cancelMembership:KT,activateMembership:ZT});async function QT(r,e){const{onetime:t}=await T("get","/onetimes",{id:e},r);return t}function e2(r,e){return T("get","/onetimes",{query:e},r)}async function r2(r,e){const{onetime:t}=await T("post","/onetimes",{data:e},r);return t}async function t2(r,e,t){const{onetime:n}=await T("put","/onetimes",{id:e,data:t},r);return n}function n2(r,e){return T("delete","/onetime",{id:e},r)}var i2=Object.freeze({__proto__:null,getOnetime:QT,listOnetimes:e2,createOnetime:r2,updateOnetime:t2,deleteOnetime:n2});async function a2(r,e){const{order:t}=await T("get","/orders",{id:e},r);return t}function o2(r,e){return T("get","/orders",{query:e},r)}var u2=Object.freeze({__proto__:null,getOrder:a2,listOrders:o2});async function f2(r,e){const{payment_method:t}=await T("get","/payment_methods",{id:e},r);return t}async function s2(r,e,t){const{payment_method:n}=await T("put","/payment_methods",{id:e,data:t},r);return n}function c2(r,e){return T("get","/payment_methods",{query:e},r)}var l2=Object.freeze({__proto__:null,getPaymentMethod:f2,updatePaymentMethod:s2,listPaymentMethods:c2});async function p2(r,e){const{plan:t}=await T("get","/plans",{id:e},r);return t}function h2(r,e){return T("get","/plans",{query:e},r)}var y2=Object.freeze({__proto__:null,getPlan:p2,listPlans:h2});async function d2(r,e){const{subscription:t}=await T("get","/subscriptions",{id:e},r);return t}function v2(r,e){return T("get","/subscriptions",{query:e},r)}async function g2(r,e){const{subscription:t}=await T("post","/subscriptions",{data:e},r);return t}async function _2(r,e,t,n){const{subscription:i}=await T("put","/subscriptions",{id:e,data:t,query:n},r);return i}async function m2(r,e,t){const{subscription:n}=await T("post",`/subscriptions/${e}/set_next_charge_date`,{data:{date:t}},r);return n}async function b2(r,e,t){const{subscription:n}=await T("post",`/subscriptions/${e}/change_address`,{data:{address_id:t}},r);return n}async function w2(r,e,t){const{subscription:n}=await T("post",`/subscriptions/${e}/cancel`,{data:t},r);return n}async function $2(r,e){const{subscription:t}=await T("post",`/subscriptions/${e}/activate`,{},r);return t}async function E2(r,e,t){const{charge:n}=await T("post",`/subscriptions/${e}/charges/skip`,{data:{date:t,subscription_id:`${e}`}},r);return n}var O2=Object.freeze({__proto__:null,getSubscription:d2,listSubscriptions:v2,createSubscription:g2,updateSubscription:_2,updateSubscriptionChargeDate:m2,updateSubscriptionAddress:b2,cancelSubscription:w2,activateSubscription:$2,skipSubscriptionCharge:E2});async function A2(r){const e=r.customerId;if(!e)throw new Error("Not logged in.");const{customer:t}=await T("get","/customers",{id:e},r);return t}async function S2(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await T("put","/customers",{id:t,data:e},r);return n}async function T2(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{deliveries:n}=await T("get",`/customers/${t}/delivery_schedule`,{query:e},r);return n}var I2=Object.freeze({__proto__:null,getCustomer:A2,updateCustomer:S2,getDeliverySchedule:T2});const P2={get(r,e){return ve("get",r,e)},post(r,e){return ve("post",r,e)},put(r,e){return ve("put",r,e)},delete(r,e){return ve("delete",r,e)}};function x2(r){var e,t;if(r)return r;if((e=window?.Shopify)!=null&&e.shop)return window.Shopify.shop;let n=window?.domain;if(!n){const i=(t=location?.href.match(/(?:http[s]*:\/\/)*(.*?)\.(?=admin\.rechargeapps\.com)/i))==null?void 0:t[1].replace(/-sp$/,"");i&&(n=`${i}.myshopify.com`)}if(n)return n;throw new Error("No storeIdentifier was passed into init.")}function F2(r={}){const e=r;Ol({storeIdentifier:x2(r.storeIdentifier),storefrontAccessToken:r.storefrontAccessToken,environment:e.environment?e.environment:"prod"}),ef()}const nf={init:F2,api:P2,address:jl,auth:Vl,bundle:jT,charge:zT,cdn:DT,customer:I2,membership:JT,onetime:i2,order:u2,paymentMethod:l2,plan:y2,subscription:O2};try{nf.init()}catch{}return nf});
|
|
28
|
+
*/(function(e,t){typeof Wb=="function"&&!0&&r&&r.exports?r.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(te,function(){function e(l,u,p){this.low=l|0,this.high=u|0,this.unsigned=!!p}e.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=function(u){return(u&&u.__isLong__)===!0};var t={},n={};e.fromInt=function(u,p){var d,_;return p?(u=u>>>0,0<=u&&u<256&&(_=n[u],_)?_:(d=new e(u,(u|0)<0?-1:0,!0),0<=u&&u<256&&(n[u]=d),d)):(u=u|0,-128<=u&&u<128&&(_=t[u],_)?_:(d=new e(u,u<0?-1:0,!1),-128<=u&&u<128&&(t[u]=d),d))},e.fromNumber=function(u,p){return p=!!p,isNaN(u)||!isFinite(u)?e.ZERO:!p&&u<=-s?e.MIN_VALUE:!p&&u+1>=s?e.MAX_VALUE:p&&u>=f?e.MAX_UNSIGNED_VALUE:u<0?e.fromNumber(-u,p).negate():new e(u%o|0,u/o|0,p)},e.fromBits=function(u,p,d){return new e(u,p,d)},e.fromString=function(u,p,d){if(u.length===0)throw Error("number format error: empty string");if(u==="NaN"||u==="Infinity"||u==="+Infinity"||u==="-Infinity")return e.ZERO;if(typeof p=="number"&&(d=p,p=!1),d=d||10,d<2||36<d)throw Error("radix out of range: "+d);var _;if((_=u.indexOf("-"))>0)throw Error('number format error: interior "-" character: '+u);if(_===0)return e.fromString(u.substring(1),p,d).negate();for(var E=e.fromNumber(Math.pow(d,8)),$=e.ZERO,b=0;b<u.length;b+=8){var S=Math.min(8,u.length-b),h=parseInt(u.substring(b,b+S),d);if(S<8){var A=e.fromNumber(Math.pow(d,S));$=$.multiply(A).add(e.fromNumber(h))}else $=$.multiply(E),$=$.add(e.fromNumber(h))}return $.unsigned=p,$},e.fromValue=function(u){return u instanceof e?u:typeof u=="number"?e.fromNumber(u):typeof u=="string"?e.fromString(u):new e(u.low,u.high,u.unsigned)};var i=1<<16,a=1<<24,o=i*i,f=o*o,s=f/2,c=e.fromInt(a);return e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*o+(this.low>>>0):this.high*o+(this.low>>>0)},e.prototype.toString=function(u){if(u=u||10,u<2||36<u)throw RangeError("radix out of range: "+u);if(this.isZero())return"0";var p;if(this.isNegative())if(this.equals(e.MIN_VALUE)){var d=e.fromNumber(u),_=this.divide(d);return p=_.multiply(d).subtract(this),_.toString(u)+p.toInt().toString(u)}else return"-"+this.negate().toString(u);var E=e.fromNumber(Math.pow(u,6),this.unsigned);p=this;for(var $="";;){var b=p.divide(E),S=p.subtract(b.multiply(E)).toInt()>>>0,h=S.toString(u);if(p=b,p.isZero())return h+$;for(;h.length<6;)h="0"+h;$=""+h+$}},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(e.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var u=this.high!=0?this.high:this.low,p=31;p>0&&(u&1<<p)==0;p--);return this.high!=0?p+33:p+1},e.prototype.isZero=function(){return this.high===0&&this.low===0},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isOdd=function(){return(this.low&1)===1},e.prototype.isEven=function(){return(this.low&1)===0},e.prototype.equals=function(u){return e.isLong(u)||(u=e.fromValue(u)),this.unsigned!==u.unsigned&&this.high>>>31===1&&u.high>>>31===1?!1:this.high===u.high&&this.low===u.low},e.eq=e.prototype.equals,e.prototype.notEquals=function(u){return!this.equals(u)},e.neq=e.prototype.notEquals,e.prototype.lessThan=function(u){return this.compare(u)<0},e.prototype.lt=e.prototype.lessThan,e.prototype.lessThanOrEqual=function(u){return this.compare(u)<=0},e.prototype.lte=e.prototype.lessThanOrEqual,e.prototype.greaterThan=function(u){return this.compare(u)>0},e.prototype.gt=e.prototype.greaterThan,e.prototype.greaterThanOrEqual=function(u){return this.compare(u)>=0},e.prototype.gte=e.prototype.greaterThanOrEqual,e.prototype.compare=function(u){if(e.isLong(u)||(u=e.fromValue(u)),this.equals(u))return 0;var p=this.isNegative(),d=u.isNegative();return p&&!d?-1:!p&&d?1:this.unsigned?u.high>>>0>this.high>>>0||u.high===this.high&&u.low>>>0>this.low>>>0?-1:1:this.subtract(u).isNegative()?-1:1},e.prototype.negate=function(){return!this.unsigned&&this.equals(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=e.prototype.negate,e.prototype.add=function(u){e.isLong(u)||(u=e.fromValue(u));var p=this.high>>>16,d=this.high&65535,_=this.low>>>16,E=this.low&65535,$=u.high>>>16,b=u.high&65535,S=u.low>>>16,h=u.low&65535,A=0,P=0,R=0,m=0;return m+=E+h,R+=m>>>16,m&=65535,R+=_+S,P+=R>>>16,R&=65535,P+=d+b,A+=P>>>16,P&=65535,A+=p+$,A&=65535,e.fromBits(R<<16|m,A<<16|P,this.unsigned)},e.prototype.subtract=function(u){return e.isLong(u)||(u=e.fromValue(u)),this.add(u.negate())},e.prototype.sub=e.prototype.subtract,e.prototype.multiply=function(u){if(this.isZero()||(e.isLong(u)||(u=e.fromValue(u)),u.isZero()))return e.ZERO;if(this.equals(e.MIN_VALUE))return u.isOdd()?e.MIN_VALUE:e.ZERO;if(u.equals(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return u.isNegative()?this.negate().multiply(u.negate()):this.negate().multiply(u).negate();if(u.isNegative())return this.multiply(u.negate()).negate();if(this.lessThan(c)&&u.lessThan(c))return e.fromNumber(this.toNumber()*u.toNumber(),this.unsigned);var p=this.high>>>16,d=this.high&65535,_=this.low>>>16,E=this.low&65535,$=u.high>>>16,b=u.high&65535,S=u.low>>>16,h=u.low&65535,A=0,P=0,R=0,m=0;return m+=E*h,R+=m>>>16,m&=65535,R+=_*h,P+=R>>>16,R&=65535,R+=E*S,P+=R>>>16,R&=65535,P+=d*h,A+=P>>>16,P&=65535,P+=_*S,A+=P>>>16,P&=65535,P+=E*b,A+=P>>>16,P&=65535,A+=p*h+d*S+_*b+E*$,A&=65535,e.fromBits(R<<16|m,A<<16|P,this.unsigned)},e.prototype.mul=e.prototype.multiply,e.prototype.divide=function(u){if(e.isLong(u)||(u=e.fromValue(u)),u.isZero())throw new Error("division by zero");if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var p,d,_;if(this.equals(e.MIN_VALUE)){if(u.equals(e.ONE)||u.equals(e.NEG_ONE))return e.MIN_VALUE;if(u.equals(e.MIN_VALUE))return e.ONE;var E=this.shiftRight(1);return p=E.divide(u).shiftLeft(1),p.equals(e.ZERO)?u.isNegative()?e.ONE:e.NEG_ONE:(d=this.subtract(u.multiply(p)),_=p.add(d.divide(u)),_)}else if(u.equals(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return u.isNegative()?this.negate().divide(u.negate()):this.negate().divide(u).negate();if(u.isNegative())return this.divide(u.negate()).negate();for(_=e.ZERO,d=this;d.greaterThanOrEqual(u);){p=Math.max(1,Math.floor(d.toNumber()/u.toNumber()));for(var $=Math.ceil(Math.log(p)/Math.LN2),b=$<=48?1:Math.pow(2,$-48),S=e.fromNumber(p),h=S.multiply(u);h.isNegative()||h.greaterThan(d);)p-=b,S=e.fromNumber(p,this.unsigned),h=S.multiply(u);S.isZero()&&(S=e.ONE),_=_.add(S),d=d.subtract(h)}return _},e.prototype.div=e.prototype.divide,e.prototype.modulo=function(u){return e.isLong(u)||(u=e.fromValue(u)),this.subtract(this.divide(u).multiply(u))},e.prototype.mod=e.prototype.modulo,e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.and=function(u){return e.isLong(u)||(u=e.fromValue(u)),e.fromBits(this.low&u.low,this.high&u.high,this.unsigned)},e.prototype.or=function(u){return e.isLong(u)||(u=e.fromValue(u)),e.fromBits(this.low|u.low,this.high|u.high,this.unsigned)},e.prototype.xor=function(u){return e.isLong(u)||(u=e.fromValue(u)),e.fromBits(this.low^u.low,this.high^u.high,this.unsigned)},e.prototype.shiftLeft=function(u){return e.isLong(u)&&(u=u.toInt()),(u&=63)===0?this:u<32?e.fromBits(this.low<<u,this.high<<u|this.low>>>32-u,this.unsigned):e.fromBits(0,this.low<<u-32,this.unsigned)},e.prototype.shl=e.prototype.shiftLeft,e.prototype.shiftRight=function(u){return e.isLong(u)&&(u=u.toInt()),(u&=63)===0?this:u<32?e.fromBits(this.low>>>u|this.high<<32-u,this.high>>u,this.unsigned):e.fromBits(this.high>>u-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=e.prototype.shiftRight,e.prototype.shiftRightUnsigned=function(u){if(e.isLong(u)&&(u=u.toInt()),u&=63,u===0)return this;var p=this.high;if(u<32){var d=this.low;return e.fromBits(d>>>u|p<<32-u,p>>>u,this.unsigned)}else return u===32?e.fromBits(p,0,this.unsigned):e.fromBits(p>>>u-32,0,this.unsigned)},e.prototype.shru=e.prototype.shiftRightUnsigned,e.prototype.toSigned=function(){return this.unsigned?new e(this.low,this.high,!1):this},e.prototype.toUnsigned=function(){return this.unsigned?this:new e(this.low,this.high,!0)},e})})(Zn),Object.defineProperty(ht,"__esModule",{value:!0}),ht.Hyper=void 0;var zb=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}}(),Bo=function r(e,t,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:r(a,t,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},Xb=Zn.exports,vr=No(Xb),Yb=M,Kb=No(Yb);function No(r){return r&&r.__esModule?r:{default:r}}function Zb(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Jb(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function Qb(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var gr=ht.Hyper=function(r){Qb(e,r),zb(e,null,[{key:"read",value:function(n){var i=n.readInt32BE(),a=n.readInt32BE();return this.fromBits(a,i)}},{key:"write",value:function(n,i){if(!(n instanceof this))throw new Error("XDR Write Error: "+n+" is not a Hyper");i.writeInt32BE(n.high),i.writeInt32BE(n.low)}},{key:"fromString",value:function(n){if(!/^-?\d+$/.test(n))throw new Error("Invalid hyper string: "+n);var i=Bo(e.__proto__||Object.getPrototypeOf(e),"fromString",this).call(this,n,!1);return new this(i.low,i.high)}},{key:"fromBits",value:function(n,i){var a=Bo(e.__proto__||Object.getPrototypeOf(e),"fromBits",this).call(this,n,i,!1);return new this(a.low,a.high)}},{key:"isValid",value:function(n){return n instanceof this}}]);function e(t,n){return Zb(this,e),Jb(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!1))}return e}(vr.default);(0,Kb.default)(gr),gr.MAX_VALUE=new gr(vr.default.MAX_VALUE.low,vr.default.MAX_VALUE.high),gr.MIN_VALUE=new gr(vr.default.MIN_VALUE.low,vr.default.MIN_VALUE.high);var xe={};Object.defineProperty(xe,"__esModule",{value:!0}),xe.UnsignedInt=void 0;var ew=Jr,Do=Uo(ew),rw=M,tw=Uo(rw);function Uo(r){return r&&r.__esModule?r:{default:r}}var _r=xe.UnsignedInt={read:function(e){return e.readUInt32BE()},write:function(e,t){if(!(0,Do.default)(e))throw new Error("XDR Write Error: not a number");if(Math.floor(e)!==e)throw new Error("XDR Write Error: not an integer");if(e<0)throw new Error("XDR Write Error: negative number "+e);t.writeUInt32BE(e)},isValid:function(e){return!(0,Do.default)(e)||Math.floor(e)!==e?!1:e>=_r.MIN_VALUE&&e<=_r.MAX_VALUE}};_r.MAX_VALUE=Math.pow(2,32)-1,_r.MIN_VALUE=0,(0,tw.default)(_r);var yt={};Object.defineProperty(yt,"__esModule",{value:!0}),yt.UnsignedHyper=void 0;var nw=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),Co=function r(e,t,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:r(a,t,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},iw=Zn.exports,mr=Lo(iw),aw=M,ow=Lo(aw);function Lo(r){return r&&r.__esModule?r:{default:r}}function uw(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function fw(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function sw(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var br=yt.UnsignedHyper=function(r){sw(e,r),nw(e,null,[{key:"read",value:function(n){var i=n.readInt32BE(),a=n.readInt32BE();return this.fromBits(a,i)}},{key:"write",value:function(n,i){if(!(n instanceof this))throw new Error("XDR Write Error: "+n+" is not an UnsignedHyper");i.writeInt32BE(n.high),i.writeInt32BE(n.low)}},{key:"fromString",value:function(n){if(!/^\d+$/.test(n))throw new Error("Invalid hyper string: "+n);var i=Co(e.__proto__||Object.getPrototypeOf(e),"fromString",this).call(this,n,!0);return new this(i.low,i.high)}},{key:"fromBits",value:function(n,i){var a=Co(e.__proto__||Object.getPrototypeOf(e),"fromBits",this).call(this,n,i,!0);return new this(a.low,a.high)}},{key:"isValid",value:function(n){return n instanceof this}}]);function e(t,n){return uw(this,e),fw(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!0))}return e}(mr.default);(0,ow.default)(br),br.MAX_VALUE=new br(mr.default.MAX_UNSIGNED_VALUE.low,mr.default.MAX_UNSIGNED_VALUE.high),br.MIN_VALUE=new br(mr.default.MIN_VALUE.low,mr.default.MIN_VALUE.high);var dt={};Object.defineProperty(dt,"__esModule",{value:!0}),dt.Float=void 0;var cw=Jr,jo=ko(cw),lw=M,pw=ko(lw);function ko(r){return r&&r.__esModule?r:{default:r}}var hw=dt.Float={read:function(e){return e.readFloatBE()},write:function(e,t){if(!(0,jo.default)(e))throw new Error("XDR Write Error: not a number");t.writeFloatBE(e)},isValid:function(e){return(0,jo.default)(e)}};(0,pw.default)(hw);var vt={};Object.defineProperty(vt,"__esModule",{value:!0}),vt.Double=void 0;var yw=Jr,qo=Vo(yw),dw=M,vw=Vo(dw);function Vo(r){return r&&r.__esModule?r:{default:r}}var gw=vt.Double={read:function(e){return e.readDoubleBE()},write:function(e,t){if(!(0,qo.default)(e))throw new Error("XDR Write Error: not a number");t.writeDoubleBE(e)},isValid:function(e){return(0,qo.default)(e)}};(0,vw.default)(gw);var gt={};Object.defineProperty(gt,"__esModule",{value:!0}),gt.Quadruple=void 0;var _w=M,mw=bw(_w);function bw(r){return r&&r.__esModule?r:{default:r}}var ww=gt.Quadruple={read:function(){throw new Error("XDR Read Error: quadruple not supported")},write:function(){throw new Error("XDR Write Error: quadruple not supported")},isValid:function(){return!1}};(0,mw.default)(ww);var wr={},$w=fe,Ew=H,Ow="[object Boolean]";function Aw(r){return r===!0||r===!1||Ew(r)&&$w(r)==Ow}var Sw=Aw;Object.defineProperty(wr,"__esModule",{value:!0}),wr.Bool=void 0;var Tw=Sw,Iw=Ho(Tw),Go=ue,Pw=M,xw=Ho(Pw);function Ho(r){return r&&r.__esModule?r:{default:r}}var Fw=wr.Bool={read:function(e){var t=Go.Int.read(e);switch(t){case 0:return!1;case 1:return!0;default:throw new Error("XDR Read Error: Got "+t+" when trying to read a bool")}},write:function(e,t){var n=e?1:0;return Go.Int.write(n,t)},isValid:function(e){return(0,Iw.default)(e)}};(0,xw.default)(Fw);var _t={},Rw=fe,Mw=C,Bw=H,Nw="[object String]";function Dw(r){return typeof r=="string"||!Mw(r)&&Bw(r)&&Rw(r)==Nw}var Wo=Dw;Object.defineProperty(_t,"__esModule",{value:!0}),_t.String=void 0;var Uw=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}}(),Cw=Wo,zo=Jn(Cw),Lw=C,jw=Jn(Lw),Xo=ue,kw=xe,Yo=Ie,qw=M,Vw=Jn(qw);function Jn(r){return r&&r.__esModule?r:{default:r}}function Gw(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Hw=_t.String=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:kw.UnsignedInt.MAX_VALUE;Gw(this,r),this._maxLength=e}return Uw(r,[{key:"read",value:function(t){var n=Xo.Int.read(t);if(n>this._maxLength)throw new Error("XDR Read Error: Saw "+n+" length String,"+("max allowed is "+this._maxLength));var i=(0,Yo.calculatePadding)(n),a=t.slice(n);return(0,Yo.slicePadding)(t,i),a.buffer()}},{key:"readString",value:function(t){return this.read(t).toString("utf8")}},{key:"write",value:function(t,n){if(t.length>this._maxLength)throw new Error("XDR Write Error: Got "+t.length+" bytes,"+("max allows is "+this._maxLength));var i=void 0;(0,zo.default)(t)?i=y.from(t,"utf8"):i=y.from(t),Xo.Int.write(i.length,n),n.writeBufferPadded(i)}},{key:"isValid",value:function(t){var n=void 0;if((0,zo.default)(t))n=y.from(t,"utf8");else if((0,jw.default)(t)||y.isBuffer(t))n=y.from(t);else return!1;return n.length<=this._maxLength}}]),r}();(0,Vw.default)(Hw.prototype);var mt={};Object.defineProperty(mt,"__esModule",{value:!0}),mt.Opaque=void 0;var Ww=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}}(),Ko=Ie,zw=M,Xw=Yw(zw);function Yw(r){return r&&r.__esModule?r:{default:r}}function Kw(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Zw=mt.Opaque=function(){function r(e){Kw(this,r),this._length=e,this._padding=(0,Ko.calculatePadding)(e)}return Ww(r,[{key:"read",value:function(t){var n=t.slice(this._length);return(0,Ko.slicePadding)(t,this._padding),n.buffer()}},{key:"write",value:function(t,n){if(t.length!==this._length)throw new Error("XDR Write Error: Got "+t.length+" bytes, expected "+this._length);n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length===this._length}}]),r}();(0,Xw.default)(Zw.prototype);var bt={};Object.defineProperty(bt,"__esModule",{value:!0}),bt.VarOpaque=void 0;var Jw=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}}(),Zo=ue,Qw=xe,Jo=Ie,e1=M,r1=t1(e1);function t1(r){return r&&r.__esModule?r:{default:r}}function n1(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var i1=bt.VarOpaque=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Qw.UnsignedInt.MAX_VALUE;n1(this,r),this._maxLength=e}return Jw(r,[{key:"read",value:function(t){var n=Zo.Int.read(t);if(n>this._maxLength)throw new Error("XDR Read Error: Saw "+n+" length VarOpaque,"+("max allowed is "+this._maxLength));var i=(0,Jo.calculatePadding)(n),a=t.slice(n);return(0,Jo.slicePadding)(t,i),a.buffer()}},{key:"write",value:function(t,n){if(t.length>this._maxLength)throw new Error("XDR Write Error: Got "+t.length+" bytes,"+("max allows is "+this._maxLength));Zo.Int.write(t.length,n),n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length<=this._maxLength}}]),r}();(0,r1.default)(i1.prototype);var wt={},Fe={exports:{}};function a1(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}var Qo=a1,o1=et;function u1(r){return typeof r=="function"?r:o1}var eu=u1,f1=Qo,s1=Mn,c1=eu,l1=C;function p1(r,e){var t=l1(r)?f1:s1;return t(r,c1(e))}var h1=p1;(function(r){r.exports=h1})(Fe);var y1=/\s/;function d1(r){for(var e=r.length;e--&&y1.test(r.charAt(e)););return e}var v1=d1,g1=v1,_1=/^\s+/;function m1(r){return r&&r.slice(0,g1(r)+1).replace(_1,"")}var b1=m1,w1=b1,ru=ge,$1=ct,tu=0/0,E1=/^[-+]0x[0-9a-f]+$/i,O1=/^0b[01]+$/i,A1=/^0o[0-7]+$/i,S1=parseInt;function T1(r){if(typeof r=="number")return r;if($1(r))return tu;if(ru(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=ru(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=w1(r);var t=O1.test(r);return t||A1.test(r)?S1(r.slice(2),t?2:8):E1.test(r)?tu:+r}var I1=T1,P1=I1,nu=1/0,x1=17976931348623157e292;function F1(r){if(!r)return r===0?r:0;if(r=P1(r),r===nu||r===-nu){var e=r<0?-1:1;return e*x1}return r===r?r:0}var R1=F1,M1=R1;function B1(r){var e=M1(r),t=e%1;return e===e?t?e-t:e:0}var N1=B1,D1=La,U1=eu,C1=N1,L1=9007199254740991,Qn=4294967295,j1=Math.min;function k1(r,e){if(r=C1(r),r<1||r>L1)return[];var t=Qn,n=j1(r,Qn);e=U1(e),r-=Qn;for(var i=D1(n,e);++t<r;)e(t);return i}var iu=k1;Object.defineProperty(wt,"__esModule",{value:!0}),wt.Array=void 0;var q1=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}}(),V1=Yn,G1=$r(V1),H1=Fe.exports,W1=$r(H1),z1=iu,X1=$r(z1),Y1=C,au=$r(Y1),K1=M,Z1=$r(K1);function $r(r){return r&&r.__esModule?r:{default:r}}function J1(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var Q1=wt.Array=function(){function r(e,t){J1(this,r),this._childType=e,this._length=t}return q1(r,[{key:"read",value:function(t){var n=this;return(0,X1.default)(this._length,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,au.default)(t))throw new Error("XDR Write Error: value is not array");if(t.length!==this._length)throw new Error("XDR Write Error: Got array of size "+t.length+","+("expected "+this._length));(0,W1.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,au.default)(t)||t.length!==this._length?!1:(0,G1.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,Z1.default)(Q1.prototype);var $t={};Object.defineProperty($t,"__esModule",{value:!0}),$t.VarArray=void 0;var e$=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}}(),r$=Yn,t$=Er(r$),n$=Fe.exports,i$=Er(n$),a$=iu,o$=Er(a$),u$=C,ou=Er(u$),f$=xe,uu=ue,s$=M,c$=Er(s$);function Er(r){return r&&r.__esModule?r:{default:r}}function l$(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var p$=$t.VarArray=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f$.UnsignedInt.MAX_VALUE;l$(this,r),this._childType=e,this._maxLength=t}return e$(r,[{key:"read",value:function(t){var n=this,i=uu.Int.read(t);if(i>this._maxLength)throw new Error("XDR Read Error: Saw "+i+" length VarArray,"+("max allowed is "+this._maxLength));return(0,o$.default)(i,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,ou.default)(t))throw new Error("XDR Write Error: value is not array");if(t.length>this._maxLength)throw new Error("XDR Write Error: Got array of size "+t.length+","+("max allowed is "+this._maxLength));uu.Int.write(t.length,n),(0,i$.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,ou.default)(t)||t.length>this._maxLength?!1:(0,t$.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,c$.default)(p$.prototype);var Et={};function h$(r){return r===null}var y$=h$;function d$(r){return r===void 0}var Or=d$;Object.defineProperty(Et,"__esModule",{value:!0}),Et.Option=void 0;var v$=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}}(),g$=y$,fu=ei(g$),_$=Or,su=ei(_$),cu=wr,m$=M,b$=ei(m$);function ei(r){return r&&r.__esModule?r:{default:r}}function w$(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var $$=Et.Option=function(){function r(e){w$(this,r),this._childType=e}return v$(r,[{key:"read",value:function(t){if(cu.Bool.read(t))return this._childType.read(t)}},{key:"write",value:function(t,n){var i=!((0,fu.default)(t)||(0,su.default)(t));cu.Bool.write(i,n),i&&this._childType.write(t,n)}},{key:"isValid",value:function(t){return(0,fu.default)(t)||(0,su.default)(t)?!0:this._childType.isValid(t)}}]),r}();(0,b$.default)($$.prototype);var Ar={};Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.Void=void 0;var E$=Or,lu=pu(E$),O$=M,A$=pu(O$);function pu(r){return r&&r.__esModule?r:{default:r}}var S$=Ar.Void={read:function(){},write:function(e){if(!(0,lu.default)(e))throw new Error("XDR Write Error: trying to write value to a void slot")},isValid:function(e){return(0,lu.default)(e)}};(0,A$.default)(S$);var Ot={},T$=lt;function I$(r,e){return T$(e,function(t){return r[t]})}var P$=I$,x$=P$,F$=He;function R$(r){return r==null?[]:x$(r,F$(r))}var M$=R$;Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.Enum=void 0;var B$=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),N$=Fe.exports,D$=ri(N$),U$=M$,C$=ri(U$),hu=ue,L$=M,j$=ri(L$);function ri(r){return r&&r.__esModule?r:{default:r}}function k$(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function q$(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function yu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var V$=Ot.Enum=function(){function r(e,t){yu(this,r),this.name=e,this.value=t}return B$(r,null,[{key:"read",value:function(t){var n=hu.Int.read(t);if(!this._byValue.has(n))throw new Error("XDR Read Error: Unknown "+this.enumName+" member for value "+n);return this._byValue.get(n)}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: Unknown "+t+" is not a "+this.enumName);hu.Int.write(t.value,n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"members",value:function(){return this._members}},{key:"values",value:function(){return(0,C$.default)(this._members)}},{key:"fromName",value:function(t){var n=this._members[t];if(!n)throw new Error(t+" is not a member of "+this.enumName);return n}},{key:"fromValue",value:function(t){var n=this._byValue.get(t);if(!n)throw new Error(t+" is not a value of any member of "+this.enumName);return n}},{key:"create",value:function(t,n,i){var a=function(o){q$(f,o);function f(){return yu(this,f),k$(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}return f}(r);return a.enumName=n,t.results[n]=a,a._members={},a._byValue=new Map,(0,D$.default)(i,function(o,f){var s=new a(f,o);a._members[f]=s,a._byValue.set(o,s),a[f]=function(){return s}}),a}}]),r}();(0,j$.default)(V$);var At={},G$=Mn,H$=lr;function W$(r,e){var t=-1,n=H$(r)?Array(r.length):[];return G$(r,function(i,a,o){n[++t]=e(i,a,o)}),n}var z$=W$,X$=lt,Y$=Io,K$=z$,Z$=C;function J$(r,e){var t=Z$(r)?X$:K$;return t(r,Y$(e))}var Q$=J$;function eE(r){for(var e=-1,t=r==null?0:r.length,n={};++e<t;){var i=r[e];n[i[0]]=i[1]}return n}var rE=eE,Sr={};Object.defineProperty(Sr,"__esModule",{value:!0});var tE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}();function nE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}Sr.Reference=function(){function r(){nE(this,r)}return tE(r,[{key:"resolve",value:function(){throw new Error("implement resolve in child class")}}]),r}(),Object.defineProperty(At,"__esModule",{value:!0}),At.Struct=void 0;var St=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var f=e[Symbol.iterator](),s;!(i=(s=f.next()).done)&&(n.push(s.value),!(t&&n.length===t));i=!0);}catch(c){a=!0,o=c}finally{try{!i&&f.return&&f.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),iE=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}}(),aE=Fe.exports,du=Tr(aE),oE=Q$,uE=Tr(oE),fE=Or,sE=Tr(fE),cE=rE,lE=Tr(cE),pE=Sr,hE=M,yE=Tr(hE);function Tr(r){return r&&r.__esModule?r:{default:r}}function dE(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function vE(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function vu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var gE=At.Struct=function(){function r(e){vu(this,r),this._attributes=e||{}}return iE(r,null,[{key:"read",value:function(t){var n=(0,uE.default)(this._fields,function(i){var a=St(i,2),o=a[0],f=a[1],s=f.read(t);return[o,s]});return new this((0,lE.default)(n))}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.structName);(0,du.default)(this._fields,function(i){var a=St(i,2),o=a[0],f=a[1],s=t._attributes[o];f.write(s,n)})}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(o){vE(f,o);function f(){return vu(this,f),dE(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}return f}(r);return a.structName=n,t.results[n]=a,a._fields=i.map(function(o){var f=St(o,2),s=f[0],c=f[1];return c instanceof pE.Reference&&(c=c.resolve(t)),[s,c]}),(0,du.default)(a._fields,function(o){var f=St(o,1),s=f[0];a.prototype[s]=_E(s)}),a}}]),r}();(0,yE.default)(gE);function _E(r){return function(t){return(0,sE.default)(t)||(this._attributes[r]=t),this._attributes[r]}}var Tt={};Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.Union=void 0;var mE=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var f=e[Symbol.iterator](),s;!(i=(s=f.next()).done)&&(n.push(s.value),!(t&&n.length===t));i=!0);}catch(c){a=!0,o=c}finally{try{!i&&f.return&&f.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),bE=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}}(),wE=Fe.exports,It=xt(wE),$E=Or,gu=xt($E),EE=Wo,_u=xt(EE),Pt=Ar,ti=Sr,OE=M,AE=xt(OE);function xt(r){return r&&r.__esModule?r:{default:r}}function SE(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function TE(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}function mu(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var IE=Tt.Union=function(){function r(e,t){mu(this,r),this.set(e,t)}return bE(r,[{key:"set",value:function(t,n){(0,_u.default)(t)&&(t=this.constructor._switchOn.fromName(t)),this._switch=t,this._arm=this.constructor.armForSwitch(this._switch),this._armType=this.constructor.armTypeForArm(this._arm),this._value=n}},{key:"get",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this._arm;if(this._arm!==Pt.Void&&this._arm!==t)throw new Error(t+" not set");return this._value}},{key:"switch",value:function(){return this._switch}},{key:"arm",value:function(){return this._arm}},{key:"armType",value:function(){return this._armType}},{key:"value",value:function(){return this._value}}],[{key:"armForSwitch",value:function(t){if(this._switches.has(t))return this._switches.get(t);if(this._defaultArm)return this._defaultArm;throw new Error("Bad union switch: "+t)}},{key:"armTypeForArm",value:function(t){return t===Pt.Void?Pt.Void:this._arms[t]}},{key:"read",value:function(t){var n=this._switchOn.read(t),i=this.armForSwitch(n),a=this.armTypeForArm(i),o=void 0;return(0,gu.default)(a)?o=i.read(t):o=a.read(t),new this(n,o)}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.unionName);this._switchOn.write(t.switch(),n),t.armType().write(t.value(),n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(f){TE(s,f);function s(){return mu(this,s),SE(this,(s.__proto__||Object.getPrototypeOf(s)).apply(this,arguments))}return s}(r);a.unionName=n,t.results[n]=a,i.switchOn instanceof ti.Reference?a._switchOn=i.switchOn.resolve(t):a._switchOn=i.switchOn,a._switches=new Map,a._arms={},(0,It.default)(i.arms,function(f,s){f instanceof ti.Reference&&(f=f.resolve(t)),a._arms[s]=f});var o=i.defaultArm;return o instanceof ti.Reference&&(o=o.resolve(t)),a._defaultArm=o,(0,It.default)(i.switches,function(f){var s=mE(f,2),c=s[0],l=s[1];(0,_u.default)(c)&&(c=a._switchOn.fromName(c)),a._switches.set(c,l)}),(0,gu.default)(a._switchOn.values)||(0,It.default)(a._switchOn.values(),function(f){a[f.name]=function(s){return new a(f,s)},a.prototype[f.name]=function(c){return this.set(f,c)}}),(0,It.default)(a._arms,function(f,s){f!==Pt.Void&&(a.prototype[s]=function(){return this.get(s)})}),a}}]),r}();(0,AE.default)(IE),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=ue;Object.keys(e).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return e[h]}})});var t=ht;Object.keys(t).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return t[h]}})});var n=xe;Object.keys(n).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return n[h]}})});var i=yt;Object.keys(i).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return i[h]}})});var a=dt;Object.keys(a).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return a[h]}})});var o=vt;Object.keys(o).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return o[h]}})});var f=gt;Object.keys(f).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return f[h]}})});var s=wr;Object.keys(s).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return s[h]}})});var c=_t;Object.keys(c).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return c[h]}})});var l=mt;Object.keys(l).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return l[h]}})});var u=bt;Object.keys(u).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return u[h]}})});var p=wt;Object.keys(p).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return p[h]}})});var d=$t;Object.keys(d).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return d[h]}})});var _=Et;Object.keys(_).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return _[h]}})});var E=Ar;Object.keys(E).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return E[h]}})});var $=Ot;Object.keys($).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return $[h]}})});var b=At;Object.keys(b).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return b[h]}})});var S=Tt;Object.keys(S).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return S[h]}})})}(An);var bu={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=function(){function m(v,g){for(var w=0;w<g.length;w++){var O=g[w];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(v,O.key,O)}}return function(v,g,w){return g&&m(v.prototype,g),w&&m(v,w),v}}(),t=Sr;Object.keys(t).forEach(function(m){m==="default"||m==="__esModule"||Object.defineProperty(r,m,{enumerable:!0,get:function(){return t[m]}})}),r.config=_;var n=Or,i=l(n),a=Fe.exports,o=l(a),f=An,s=c(f);function c(m){if(m&&m.__esModule)return m;var v={};if(m!=null)for(var g in m)Object.prototype.hasOwnProperty.call(m,g)&&(v[g]=m[g]);return v.default=m,v}function l(m){return m&&m.__esModule?m:{default:m}}function u(m,v){if(!(m instanceof v))throw new TypeError("Cannot call a class as a function")}function p(m,v){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:m}function d(m,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);m.prototype=Object.create(v&&v.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(m,v):m.__proto__=v)}function _(m){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(m){var g=new R(v);m(g),g.resolve()}return v}var E=function(m){d(v,m);function v(g){u(this,v);var w=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this));return w.name=g,w}return e(v,[{key:"resolve",value:function(w){var O=w.definitions[this.name];return O.resolve(w)}}]),v}(t.Reference),$=function(m){d(v,m);function v(g,w){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;u(this,v);var L=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this));return L.childReference=g,L.length=w,L.variable=O,L}return e(v,[{key:"resolve",value:function(w){var O=this.childReference,L=this.length;return O instanceof t.Reference&&(O=O.resolve(w)),L instanceof t.Reference&&(L=L.resolve(w)),this.variable?new s.VarArray(O,L):new s.Array(O,L)}}]),v}(t.Reference),b=function(m){d(v,m);function v(g){u(this,v);var w=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this));return w.childReference=g,w.name=g.name,w}return e(v,[{key:"resolve",value:function(w){var O=this.childReference;return O instanceof t.Reference&&(O=O.resolve(w)),new s.Option(O)}}]),v}(t.Reference),S=function(m){d(v,m);function v(g,w){u(this,v);var O=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this));return O.sizedType=g,O.length=w,O}return e(v,[{key:"resolve",value:function(w){var O=this.length;return O instanceof t.Reference&&(O=O.resolve(w)),new this.sizedType(O)}}]),v}(t.Reference),h=function(){function m(v,g,w){u(this,m),this.constructor=v,this.name=g,this.config=w}return e(m,[{key:"resolve",value:function(g){return this.name in g.results?g.results[this.name]:this.constructor(g,this.name,this.config)}}]),m}();function A(m,v,g){return g instanceof t.Reference&&(g=g.resolve(m)),m.results[v]=g,g}function P(m,v,g){return m.results[v]=g,g}var R=function(){function m(v){u(this,m),this._destination=v,this._definitions={}}return e(m,[{key:"enum",value:function(g,w){var O=new h(s.Enum.create,g,w);this.define(g,O)}},{key:"struct",value:function(g,w){var O=new h(s.Struct.create,g,w);this.define(g,O)}},{key:"union",value:function(g,w){var O=new h(s.Union.create,g,w);this.define(g,O)}},{key:"typedef",value:function(g,w){var O=new h(A,g,w);this.define(g,O)}},{key:"const",value:function(g,w){var O=new h(P,g,w);this.define(g,O)}},{key:"void",value:function(){return s.Void}},{key:"bool",value:function(){return s.Bool}},{key:"int",value:function(){return s.Int}},{key:"hyper",value:function(){return s.Hyper}},{key:"uint",value:function(){return s.UnsignedInt}},{key:"uhyper",value:function(){return s.UnsignedHyper}},{key:"float",value:function(){return s.Float}},{key:"double",value:function(){return s.Double}},{key:"quadruple",value:function(){return s.Quadruple}},{key:"string",value:function(g){return new S(s.String,g)}},{key:"opaque",value:function(g){return new S(s.Opaque,g)}},{key:"varOpaque",value:function(g){return new S(s.VarOpaque,g)}},{key:"array",value:function(g,w){return new $(g,w)}},{key:"varArray",value:function(g,w){return new $(g,w,!0)}},{key:"option",value:function(g){return new b(g)}},{key:"define",value:function(g,w){if((0,i.default)(this._destination[g]))this._definitions[g]=w;else throw new Error("XDRTypes Error:"+g+" is already defined")}},{key:"lookup",value:function(g){return new E(g)}},{key:"resolve",value:function(){var g=this;(0,o.default)(this._definitions,function(w){w.resolve({definitions:g._definitions,results:g._destination})})}}]),m}()})(bu),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=An;Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[n]}})});var t=bu;Object.keys(t).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[n]}})})}(wa),Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.xdr=void 0;const PE=(0,wa.config)(r=>{r.enum("EnvelopeType",{envelopeTypeBundle:0}),r.typedef("Uint32",r.uint()),r.typedef("Uint64",r.uhyper()),r.union("BundleItemExt",{switchOn:r.int(),switchName:"v",switches:[[0,r.void()]],arms:{}}),r.struct("BundleItem",[["collectionId",r.lookup("Uint64")],["productId",r.lookup("Uint64")],["variantId",r.lookup("Uint64")],["sku",r.string()],["quantity",r.lookup("Uint32")],["ext",r.lookup("BundleItemExt")]]),r.union("BundleExt",{switchOn:r.int(),switchName:"v",switches:[[0,r.void()]],arms:{}}),r.struct("Bundle",[["variantId",r.lookup("Uint64")],["items",r.varArray(r.lookup("BundleItem"),500)],["version",r.lookup("Uint32")],["ext",r.lookup("BundleExt")]]),r.union("BundleEnvelope",{switchOn:r.lookup("EnvelopeType"),switchName:"type",switches:[["envelopeTypeBundle","v1"]],arms:{v1:r.lookup("Bundle")}})});Zr.xdr=PE,Object.defineProperty(oe,"__esModule",{value:!0}),oe.decodeToLegacyBoxOrder=oe.encodeLegacyBoxOrder=oe.toBundle=$u=oe.toLineItemProperty=void 0;const ee=Zr;function wu(r){let e={variantId:ee.xdr.Uint64.fromString(r.variantId.toString()),version:r.version||Math.floor(Date.now()/1e3),items:r.items.map(n=>new ee.xdr.BundleItem({collectionId:ee.xdr.Uint64.fromString(n.collectionId.toString()),productId:ee.xdr.Uint64.fromString(n.productId.toString()),variantId:ee.xdr.Uint64.fromString(n.variantId.toString()),sku:n.sku||"",quantity:n.quantity,ext:new ee.xdr.BundleItemExt(0)})),ext:new ee.xdr.BundleExt(0)};const t=new ee.xdr.Bundle(e);return ee.xdr.BundleEnvelope.envelopeTypeBundle(t).toXDR("base64")}var $u=oe.toLineItemProperty=wu;function Eu(r){const e=ee.xdr.BundleEnvelope.fromXDR(r,"base64").v1();return{variantId:e.variantId().toString(),version:e.version(),items:e.items().map(t=>({collectionId:t.collectionId().toString(),productId:t.productId().toString(),variantId:t.variantId().toString(),sku:t.sku().toString(),quantity:t.quantity()}))}}oe.toBundle=Eu;function xE(r,e,t=1){const n={variantId:r.toString(),version:t,items:[]};for(const i in e)if(Object.hasOwnProperty.call(e,i)){const a=e[i];n.items.push({collectionId:a.dsId.toString(),productId:a.pId.toString(),variantId:a.vId.toString(),sku:a.sku||"",quantity:a.qty})}return wu(n)}oe.encodeLegacyBoxOrder=xE;function FE(r){let e={};try{Eu(r).items.forEach(n=>{e[n.variantId]={dsId:n.collectionId,pId:Number.parseInt(n.productId),vId:Number.parseInt(n.variantId),sku:n.sku,qty:n.quantity}})}catch{e=JSON.parse(y.from(r,"base64").toString())}return e}oe.decodeToLegacyBoxOrder=FE;var RE=Ge,ME=He;function BE(r,e){return r&&RE(e,ME(e),r)}var NE=BE,DE=Ge,UE=rt;function CE(r,e){return r&&DE(e,UE(e),r)}var LE=CE,ni={exports:{}};(function(r,e){var t=Q,n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,o=a?t.Buffer:void 0,f=o?o.allocUnsafe:void 0;function s(c,l){if(l)return c.slice();var u=c.length,p=f?f(u):new c.constructor(u);return c.copy(p),p}r.exports=s})(ni,ni.exports);function jE(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}var kE=jE,qE=Ge,VE=Ln;function GE(r,e){return qE(r,VE(r),e)}var HE=GE,WE=Wa,zE=WE(Object.getPrototypeOf,Object),ii=zE,XE=Cn,YE=ii,KE=Ln,ZE=ro,JE=Object.getOwnPropertySymbols,QE=JE?function(r){for(var e=[];r;)XE(e,KE(r)),r=YE(r);return e}:ZE,Ou=QE,eO=Ge,rO=Ou;function tO(r,e){return eO(r,rO(r),e)}var nO=tO,iO=eo,aO=Ou,oO=rt;function uO(r){return iO(r,oO,aO)}var Au=uO,fO=Object.prototype,sO=fO.hasOwnProperty;function cO(r){var e=r.length,t=new r.constructor(e);return e&&typeof r[0]=="string"&&sO.call(r,"index")&&(t.index=r.index,t.input=r.input),t}var lO=cO,Su=Ka;function pO(r){var e=new r.constructor(r.byteLength);return new Su(e).set(new Su(r)),e}var ai=pO,hO=ai;function yO(r,e){var t=e?hO(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)}var dO=yO,vO=/\w*$/;function gO(r){var e=new r.constructor(r.source,vO.exec(r));return e.lastIndex=r.lastIndex,e}var _O=gO,Tu=Ve,Iu=Tu?Tu.prototype:void 0,Pu=Iu?Iu.valueOf:void 0;function mO(r){return Pu?Object(Pu.call(r)):{}}var bO=mO,wO=ai;function $O(r,e){var t=e?wO(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)}var EO=$O,OO=ai,AO=dO,SO=_O,TO=bO,IO=EO,PO="[object Boolean]",xO="[object Date]",FO="[object Map]",RO="[object Number]",MO="[object RegExp]",BO="[object Set]",NO="[object String]",DO="[object Symbol]",UO="[object ArrayBuffer]",CO="[object DataView]",LO="[object Float32Array]",jO="[object Float64Array]",kO="[object Int8Array]",qO="[object Int16Array]",VO="[object Int32Array]",GO="[object Uint8Array]",HO="[object Uint8ClampedArray]",WO="[object Uint16Array]",zO="[object Uint32Array]";function XO(r,e,t){var n=r.constructor;switch(e){case UO:return OO(r);case PO:case xO:return new n(+r);case CO:return AO(r,t);case LO:case jO:case kO:case qO:case VO:case GO:case HO:case WO:case zO:return IO(r,t);case FO:return new n;case RO:case NO:return new n(r);case MO:return SO(r);case BO:return new n;case DO:return TO(r)}}var YO=XO,KO=ge,xu=Object.create,ZO=function(){function r(){}return function(e){if(!KO(e))return{};if(xu)return xu(e);r.prototype=e;var t=new r;return r.prototype=void 0,t}}(),JO=ZO,QO=JO,eA=ii,rA=Rn;function tA(r){return typeof r.constructor=="function"&&!rA(r)?QO(eA(r)):{}}var nA=tA,iA=ft,aA=H,oA="[object Map]";function uA(r){return aA(r)&&iA(r)==oA}var fA=uA,sA=fA,cA=Fn,Fu=hr.exports,Ru=Fu&&Fu.isMap,lA=Ru?cA(Ru):sA,pA=lA,hA=ft,yA=H,dA="[object Set]";function vA(r){return yA(r)&&hA(r)==dA}var gA=vA,_A=gA,mA=Fn,Mu=hr.exports,Bu=Mu&&Mu.isSet,bA=Bu?mA(Bu):_A,wA=bA,$A=Dn,EA=Qo,OA=Ma,AA=NE,SA=LE,TA=ni.exports,IA=kE,PA=HE,xA=nO,FA=no,RA=Au,MA=ft,BA=lO,NA=YO,DA=nA,UA=C,CA=pr.exports,LA=pA,jA=ge,kA=wA,qA=He,VA=rt,GA=1,HA=2,WA=4,Nu="[object Arguments]",zA="[object Array]",XA="[object Boolean]",YA="[object Date]",KA="[object Error]",Du="[object Function]",ZA="[object GeneratorFunction]",JA="[object Map]",QA="[object Number]",Uu="[object Object]",eS="[object RegExp]",rS="[object Set]",tS="[object String]",nS="[object Symbol]",iS="[object WeakMap]",aS="[object ArrayBuffer]",oS="[object DataView]",uS="[object Float32Array]",fS="[object Float64Array]",sS="[object Int8Array]",cS="[object Int16Array]",lS="[object Int32Array]",pS="[object Uint8Array]",hS="[object Uint8ClampedArray]",yS="[object Uint16Array]",dS="[object Uint32Array]",x={};x[Nu]=x[zA]=x[aS]=x[oS]=x[XA]=x[YA]=x[uS]=x[fS]=x[sS]=x[cS]=x[lS]=x[JA]=x[QA]=x[Uu]=x[eS]=x[rS]=x[tS]=x[nS]=x[pS]=x[hS]=x[yS]=x[dS]=!0,x[KA]=x[Du]=x[iS]=!1;function Ft(r,e,t,n,i,a){var o,f=e&GA,s=e&HA,c=e&WA;if(t&&(o=i?t(r,n,i,a):t(r)),o!==void 0)return o;if(!jA(r))return r;var l=UA(r);if(l){if(o=BA(r),!f)return IA(r,o)}else{var u=MA(r),p=u==Du||u==ZA;if(CA(r))return TA(r,f);if(u==Uu||u==Nu||p&&!i){if(o=s||p?{}:DA(r),!f)return s?xA(r,SA(o,r)):PA(r,AA(o,r))}else{if(!x[u])return i?r:{};o=NA(r,u,f)}}a||(a=new $A);var d=a.get(r);if(d)return d;a.set(r,o),kA(r)?r.forEach(function($){o.add(Ft($,e,t,$,r,a))}):LA(r)&&r.forEach(function($,b){o.set(b,Ft($,e,t,b,r,a))});var _=c?s?RA:FA:s?VA:qA,E=l?void 0:_(r);return EA(E||r,function($,b){E&&(b=$,$=r[b]),OA(o,b,Ft($,e,t,b,r,a))}),o}var vS=Ft;function gS(r){var e=r==null?0:r.length;return e?r[e-1]:void 0}var _S=gS;function mS(r,e,t){var n=-1,i=r.length;e<0&&(e=-e>i?0:i+e),t=t>i?i:t,t<0&&(t+=i),i=e>t?0:t-e>>>0,e>>>=0;for(var a=Array(i);++n<i;)a[n]=r[n+e];return a}var bS=mS,wS=Xn,$S=bS;function ES(r,e){return e.length<2?r:wS(r,$S(e,0,-1))}var OS=ES,AS=pt,SS=_S,TS=OS,IS=yr;function PS(r,e){return e=AS(e,r),r=TS(r,e),r==null||delete r[IS(SS(e))]}var xS=PS,FS=fe,RS=ii,MS=H,BS="[object Object]",NS=Function.prototype,DS=Object.prototype,Cu=NS.toString,US=DS.hasOwnProperty,CS=Cu.call(Object);function LS(r){if(!MS(r)||FS(r)!=BS)return!1;var e=RS(r);if(e===null)return!0;var t=US.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Cu.call(t)==CS}var jS=LS,kS=jS;function qS(r){return kS(r)?void 0:r}var VS=qS,Lu=Ve,GS=xn,HS=C,ju=Lu?Lu.isConcatSpreadable:void 0;function WS(r){return HS(r)||GS(r)||!!(ju&&r&&r[ju])}var zS=WS,XS=Cn,YS=zS;function ku(r,e,t,n,i){var a=-1,o=r.length;for(t||(t=YS),i||(i=[]);++a<o;){var f=r[a];e>0&&t(f)?e>1?ku(f,e-1,t,n,i):XS(i,f):n||(i[i.length]=f)}return i}var KS=ku,ZS=KS;function JS(r){var e=r==null?0:r.length;return e?ZS(r,1):[]}var QS=JS,eT=QS,rT=Na,tT=Ua;function nT(r){return tT(rT(r,void 0,eT),r+"")}var iT=nT,aT=lt,oT=vS,uT=xS,fT=pt,sT=Ge,cT=VS,lT=iT,pT=Au,hT=1,yT=2,dT=4,vT=lT(function(r,e){var t={};if(r==null)return t;var n=!1;e=aT(e,function(a){return a=fT(a,r),n||(n=a.length>1),a}),sT(r,pT(r),t),n&&(t=oT(t,hT|yT|dT,cT));for(var i=e.length;i--;)uT(t,e[i]);return t}),gT=vT,_T=Object.defineProperty,mT=Object.defineProperties,bT=Object.getOwnPropertyDescriptors,qu=Object.getOwnPropertySymbols,wT=Object.prototype.hasOwnProperty,$T=Object.prototype.propertyIsEnumerable,Vu=(r,e,t)=>e in r?_T(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ET=(r,e)=>{for(var t in e||(e={}))wT.call(e,t)&&Vu(r,t,e[t]);if(qu)for(var t of qu(e))$T.call(e,t)&&Vu(r,t,e[t]);return r},OT=(r,e)=>mT(r,bT(e));function AT(r){try{return JSON.parse(r)}catch{return r}}function ST(r){return Object.entries(r).reduce((e,[t,n])=>OT(ET({},e),{[t]:AT(n)}),{})}var TT=Object.defineProperty,IT=Object.defineProperties,PT=Object.getOwnPropertyDescriptors,Gu=Object.getOwnPropertySymbols,xT=Object.prototype.hasOwnProperty,FT=Object.prototype.propertyIsEnumerable,Hu=(r,e,t)=>e in r?TT(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wu=(r,e)=>{for(var t in e||(e={}))xT.call(e,t)&&Hu(r,t,e[t]);if(Gu)for(var t of Gu(e))FT.call(e,t)&&Hu(r,t,e[t]);return r},zu=(r,e)=>IT(r,PT(e));function Xu(r){var e;const t=ST(r),n=t.auto_inject===void 0?!0:t.auto_inject,i=(e=t.display_on)!=null?e:[],a=t.first_option==="autodeliver";return zu(Wu({},gT(t,["display_on","first_option"])),{auto_inject:n,valid_pages:i,is_subscription_first:a,autoInject:n,validPages:i,isSubscriptionFirst:a})}function Yu(r){var e;const t=((e=r.subscription_options)==null?void 0:e.storefront_purchase_options)==="subscription_only";return zu(Wu({},r),{is_subscription_only:t,isSubscriptionOnly:t})}function RT(r){return r.map(e=>{const t={};return Object.entries(e).forEach(([n,i])=>{t[n]=Yu(i)}),t})}const Rt="2020-12",MT={store_currency:{currency_code:"USD",currency_symbol:"$",decimal_separator:".",thousands_separator:",",currency_symbol_location:"left"}},Ir=new Map;function Mt(r,e){return Ir.has(r)||Ir.set(r,e()),Ir.get(r)}async function oi(r){const{product:e}=await Mt(`product.${r}`,()=>Kr("get",`/product/${Rt}/${r}.json`));return Yu(e)}async function Ku(){return await Mt("storeSettings",()=>Kr("get",`/${Rt}/store_settings.json`).catch(()=>MT))}async function Zu(){const{widget_settings:r}=await Mt("widgetSettings",()=>Kr("get",`/${Rt}/widget_settings.json`));return Xu(r)}async function Ju(){const{products:r,widget_settings:e,store_settings:t,meta:n}=await Mt("productsAndSettings",()=>Kr("get",`/product/${Rt}/products.json`));return n?.status==="error"?Promise.reject(n.message):{products:RT(r),widget_settings:Xu(e),store_settings:t??{}}}async function BT(){const{products:r}=await Ju();return r}async function NT(r){const[e,t,n]=await Promise.all([oi(r),Ku(),Zu()]);return{product:e,store_settings:t,widget_settings:n,storeSettings:t,widgetSettings:n}}async function Qu(r){const{bundle_product:e}=await oi(r);return e}async function ef(){return Array.from(Ir.keys()).forEach(r=>Ir.delete(r))}var DT=Object.freeze({__proto__:null,getCDNProduct:oi,getCDNStoreSettings:Ku,getCDNWidgetSettings:Zu,getCDNProductsAndSettings:Ju,getCDNProducts:BT,getCDNProductAndSettings:NT,getCDNBundleSettings:Qu,resetCDNCache:ef});const rf="/bundling-storefront-manager";function UT(){return Math.ceil(Date.now()/1e3)}async function CT(){try{const{timestamp:r}=await On("get",`${rf}/t`,{headers:{"X-Recharge-App":"storefront-client"}});return r}catch(r){return console.error(`Fetch failed: ${r}. Using client-side date.`),UT()}}async function LT(r){const e=sr();if(!await tf(r))throw new Error("Bundle selection is invalid.");const t=await CT(),n=$u({variantId:r.externalVariantId,version:t,items:r.selections.map(i=>({collectionId:i.collectionId,productId:i.externalProductId,variantId:i.externalVariantId,quantity:i.quantity,sku:""}))});try{const i=await On("post",`${rf}/api/v1/bundles`,{data:{bundle:n},headers:{Origin:`https://${e.storeIdentifier}`}});if(!i.id||i.code!==200)throw new Error(`1: failed generating rb_id: ${JSON.stringify(i)}`);return i.id}catch(i){throw new Error(`2: failed generating rb_id ${i}`)}}async function tf(r){try{const e=await Qu(r.externalProductId);return!!r&&!!e}catch{return console.error("Error fetching bundle settings"),!1}}var jT=Object.freeze({__proto__:null,getBundleId:LT,validateBundle:tf});async function kT(r,e){const{charge:t}=await T("get","/charges",{id:e},r);return t}function qT(r,e){return T("get","/charges",{query:e},r)}async function VT(r,e,t){const{charge:n}=await T("post",`/charges/${e}/apply_discount`,{data:t},r);return n}async function GT(r,e){const{charge:t}=await T("post",`/charges/${e}/remove_discount`,{},r);return t}async function HT(r,e){const{charge:t}=await T("post",`/charges/${e}/skip`,{},r);return t}async function WT(r,e){const{charge:t}=await T("post",`/charges/${e}/unskip`,{},r);return t}var zT=Object.freeze({__proto__:null,getCharge:kT,listCharges:qT,applyDiscount:VT,removeDiscount:GT,skipCharge:HT,unskipCharge:WT});async function XT(r,e){const{membership:t}=await T("get","/memberships",{id:e},r);return t}function YT(r,e){return T("get","/memberships",{query:e},r)}async function KT(r,e,t){const{membership:n}=await T("post",`/memberships/${e}/cancel`,{data:t},r);return n}async function ZT(r,e,t){const{membership:n}=await T("post",`/memberships/${e}/activate`,{data:t},r);return n}var JT=Object.freeze({__proto__:null,getMembership:XT,listMemberships:YT,cancelMembership:KT,activateMembership:ZT});async function QT(r,e){const{onetime:t}=await T("get","/onetimes",{id:e},r);return t}function e2(r,e){return T("get","/onetimes",{query:e},r)}async function r2(r,e){const{onetime:t}=await T("post","/onetimes",{data:e},r);return t}async function t2(r,e,t){const{onetime:n}=await T("put","/onetimes",{id:e,data:t},r);return n}function n2(r,e){return T("delete","/onetime",{id:e},r)}var i2=Object.freeze({__proto__:null,getOnetime:QT,listOnetimes:e2,createOnetime:r2,updateOnetime:t2,deleteOnetime:n2});async function a2(r,e){const{order:t}=await T("get","/orders",{id:e},r);return t}function o2(r,e){return T("get","/orders",{query:e},r)}var u2=Object.freeze({__proto__:null,getOrder:a2,listOrders:o2});async function f2(r,e){const{payment_method:t}=await T("get","/payment_methods",{id:e},r);return t}async function s2(r,e,t){const{payment_method:n}=await T("put","/payment_methods",{id:e,data:t},r);return n}function c2(r,e){return T("get","/payment_methods",{query:e},r)}var l2=Object.freeze({__proto__:null,getPaymentMethod:f2,updatePaymentMethod:s2,listPaymentMethods:c2});async function p2(r,e){const{plan:t}=await T("get","/plans",{id:e},r);return t}function h2(r,e){return T("get","/plans",{query:e},r)}var y2=Object.freeze({__proto__:null,getPlan:p2,listPlans:h2});async function d2(r,e){const{subscription:t}=await T("get","/subscriptions",{id:e},r);return t}function v2(r,e){return T("get","/subscriptions",{query:e},r)}async function g2(r,e){const{subscription:t}=await T("post","/subscriptions",{data:e},r);return t}async function _2(r,e,t,n){const{subscription:i}=await T("put","/subscriptions",{id:e,data:t,query:n},r);return i}async function m2(r,e,t){const{subscription:n}=await T("post",`/subscriptions/${e}/set_next_charge_date`,{data:{date:t}},r);return n}async function b2(r,e,t){const{subscription:n}=await T("post",`/subscriptions/${e}/change_address`,{data:{address_id:t}},r);return n}async function w2(r,e,t){const{subscription:n}=await T("post",`/subscriptions/${e}/cancel`,{data:t},r);return n}async function $2(r,e){const{subscription:t}=await T("post",`/subscriptions/${e}/activate`,{},r);return t}async function E2(r,e,t){const{charge:n}=await T("post",`/subscriptions/${e}/charges/skip`,{data:{date:t,subscription_id:`${e}`}},r);return n}var O2=Object.freeze({__proto__:null,getSubscription:d2,listSubscriptions:v2,createSubscription:g2,updateSubscription:_2,updateSubscriptionChargeDate:m2,updateSubscriptionAddress:b2,cancelSubscription:w2,activateSubscription:$2,skipSubscriptionCharge:E2});async function A2(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await T("get","/customers",{id:t,query:{include:e?.include}},r);return n}async function S2(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await T("put","/customers",{id:t,data:e},r);return n}async function T2(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{deliveries:n}=await T("get",`/customers/${t}/delivery_schedule`,{query:e},r);return n}var I2=Object.freeze({__proto__:null,getCustomer:A2,updateCustomer:S2,getDeliverySchedule:T2});const P2={get(r,e){return ve("get",r,e)},post(r,e){return ve("post",r,e)},put(r,e){return ve("put",r,e)},delete(r,e){return ve("delete",r,e)}};function x2(r){var e,t;if(r)return r;if((e=window?.Shopify)!=null&&e.shop)return window.Shopify.shop;let n=window?.domain;if(!n){const i=(t=location?.href.match(/(?:http[s]*:\/\/)*(.*?)\.(?=admin\.rechargeapps\.com)/i))==null?void 0:t[1].replace(/-sp$/,"");i&&(n=`${i}.myshopify.com`)}if(n)return n;throw new Error("No storeIdentifier was passed into init.")}function F2(r={}){const e=r;Ol({storeIdentifier:x2(r.storeIdentifier),storefrontAccessToken:r.storefrontAccessToken,environment:e.environment?e.environment:"prod"}),ef()}const nf={init:F2,api:P2,address:jl,auth:Vl,bundle:jT,charge:zT,cdn:DT,customer:I2,membership:JT,onetime:i2,order:u2,paymentMethod:l2,plan:y2,subscription:O2};try{nf.init()}catch{}return nf});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rechargeapps/storefront-client",
|
|
3
3
|
"description": "Storefront client for Recharge",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.14.0",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
7
7
|
"module": "dist/esm/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@types/qs": "6.9.7",
|
|
46
46
|
"@vitest/coverage-c8": "0.23.4",
|
|
47
47
|
"concurrently": "7.4.0",
|
|
48
|
-
"cypress": "
|
|
48
|
+
"cypress": "11.1.0",
|
|
49
49
|
"esbuild": "0.14.49",
|
|
50
50
|
"http-server": "14.1.1",
|
|
51
51
|
"rollup": "2.75.7",
|