@rechargeapps/storefront-client 0.29.0 → 0.29.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/dist/cjs/mappers/subscription.js +0 -3
- package/dist/cjs/mappers/subscription.js.map +1 -1
- package/dist/esm/mappers/subscription.js +0 -3
- package/dist/esm/mappers/subscription.js.map +1 -1
- package/dist/index.d.ts +73 -80
- package/dist/umd/recharge-client.min.js +2 -6
- package/package.json +3 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2023 Recharge Inc.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -42,7 +42,6 @@ function bulkSubscriptionCreateMapper(customer_id, createRequest) {
|
|
|
42
42
|
shopify_variant_id: createRequest.external_variant_id.ecommerce ? parseInt(createRequest.external_variant_id.ecommerce, 10) : void 0,
|
|
43
43
|
charge_interval_frequency: `${createRequest.charge_interval_frequency}`,
|
|
44
44
|
order_interval_frequency: `${createRequest.order_interval_frequency}`,
|
|
45
|
-
price: createRequest.price ? parseFloat(createRequest.price) : void 0,
|
|
46
45
|
status: createRequest.status ? createRequest.status.toUpperCase() : void 0
|
|
47
46
|
});
|
|
48
47
|
}
|
|
@@ -59,8 +58,6 @@ function bulkSubscriptionUpdateMapper(force_update, updateRequest) {
|
|
|
59
58
|
shopify_variant_id: ((_a = updateRequest.external_variant_id) == null ? void 0 : _a.ecommerce) ? parseInt(updateRequest.external_variant_id.ecommerce, 10) : void 0,
|
|
60
59
|
charge_interval_frequency: updateRequest.charge_interval_frequency ? `${updateRequest.charge_interval_frequency}` : void 0,
|
|
61
60
|
order_interval_frequency: updateRequest.order_interval_frequency ? `${updateRequest.order_interval_frequency}` : void 0,
|
|
62
|
-
price: updateRequest.price ? parseFloat(updateRequest.price) : void 0,
|
|
63
|
-
use_shopify_variant_defaults: updateRequest.use_external_variant_defaults,
|
|
64
61
|
force_update
|
|
65
62
|
});
|
|
66
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.js","sources":["../../../src/mappers/subscription.ts"],"sourcesContent":["import omit from 'lodash/omit';\nimport {\n CreateSubscriptionRequest,\n Subscription,\n SubscriptionStatus,\n Subscription_2021_01,\n UpdateSubscriptionsRequest,\n} from '../types';\nimport { convertToBool } from './utils';\n\nexport function bulkSubscriptionCreateMapper(customer_id: string, createRequest: CreateSubscriptionRequest) {\n return {\n ...omit(createRequest, [\n 'address_id',\n 'external_variant_id',\n 'external_product_id',\n 'charge_interval_frequency',\n 'order_interval_frequency',\n 'price',\n 'status',\n ]),\n customer_id: parseInt(customer_id, 10),\n shopify_variant_id: createRequest.external_variant_id.ecommerce\n ? parseInt(createRequest.external_variant_id.ecommerce, 10)\n : undefined,\n charge_interval_frequency: `${createRequest.charge_interval_frequency}`,\n order_interval_frequency: `${createRequest.order_interval_frequency}`,\n
|
|
1
|
+
{"version":3,"file":"subscription.js","sources":["../../../src/mappers/subscription.ts"],"sourcesContent":["import omit from 'lodash/omit';\nimport {\n CreateSubscriptionRequest,\n Subscription,\n SubscriptionStatus,\n Subscription_2021_01,\n UpdateSubscriptionsRequest,\n} from '../types';\nimport { convertToBool } from './utils';\n\nexport function bulkSubscriptionCreateMapper(customer_id: string, createRequest: CreateSubscriptionRequest) {\n return {\n ...omit(createRequest, [\n 'address_id',\n 'external_variant_id',\n 'external_product_id',\n 'charge_interval_frequency',\n 'order_interval_frequency',\n 'price',\n 'status',\n ]),\n customer_id: parseInt(customer_id, 10),\n shopify_variant_id: createRequest.external_variant_id.ecommerce\n ? parseInt(createRequest.external_variant_id.ecommerce, 10)\n : undefined,\n charge_interval_frequency: `${createRequest.charge_interval_frequency}`,\n order_interval_frequency: `${createRequest.order_interval_frequency}`,\n status: createRequest.status ? createRequest.status.toUpperCase() : undefined,\n };\n}\n\nexport function bulkSubscriptionUpdateMapper(force_update: boolean, updateRequest: UpdateSubscriptionsRequest) {\n return {\n ...omit(updateRequest, [\n 'external_variant_id',\n 'external_product_id',\n 'charge_interval_frequency',\n 'order_interval_frequency',\n 'price',\n 'use_external_variant_defaults',\n ]),\n shopify_variant_id: updateRequest.external_variant_id?.ecommerce\n ? parseInt(updateRequest.external_variant_id.ecommerce, 10)\n : undefined,\n charge_interval_frequency: updateRequest.charge_interval_frequency\n ? `${updateRequest.charge_interval_frequency}`\n : undefined,\n order_interval_frequency: updateRequest.order_interval_frequency\n ? `${updateRequest.order_interval_frequency}`\n : undefined,\n force_update,\n };\n}\n\nexport function subscriptionMapperOldToNew(old: Subscription_2021_01): Subscription {\n const {\n id,\n address_id,\n customer_id,\n analytics_data,\n cancellation_reason,\n cancellation_reason_comments,\n cancelled_at,\n charge_interval_frequency,\n created_at,\n expire_after_specific_number_of_charges,\n shopify_product_id,\n shopify_variant_id,\n has_queued_charges,\n is_prepaid,\n is_skippable,\n is_swappable,\n max_retries_reached,\n next_charge_scheduled_at,\n order_day_of_month,\n order_day_of_week,\n order_interval_frequency,\n order_interval_unit,\n presentment_currency,\n price,\n product_title,\n properties,\n quantity,\n sku,\n sku_override,\n status,\n updated_at,\n variant_title,\n } = old;\n return {\n id,\n address_id,\n customer_id,\n analytics_data,\n cancellation_reason,\n cancellation_reason_comments,\n cancelled_at,\n charge_interval_frequency: parseInt(charge_interval_frequency, 10),\n created_at,\n expire_after_specific_number_of_charges,\n external_product_id: { ecommerce: `${shopify_product_id}` },\n external_variant_id: { ecommerce: `${shopify_variant_id}` },\n has_queued_charges: convertToBool(has_queued_charges),\n is_prepaid,\n is_skippable,\n is_swappable,\n max_retries_reached: convertToBool(max_retries_reached),\n next_charge_scheduled_at,\n order_day_of_month,\n order_day_of_week,\n order_interval_frequency: parseInt(order_interval_frequency, 10),\n order_interval_unit,\n presentment_currency,\n price: `${price}`,\n product_title: product_title ?? '',\n properties,\n quantity,\n sku,\n sku_override,\n status: status.toLowerCase() as SubscriptionStatus,\n updated_at,\n variant_title,\n };\n}\n"],"names":["omit","convertToBool"],"mappings":"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"}
|
|
@@ -34,7 +34,6 @@ function bulkSubscriptionCreateMapper(customer_id, createRequest) {
|
|
|
34
34
|
shopify_variant_id: createRequest.external_variant_id.ecommerce ? parseInt(createRequest.external_variant_id.ecommerce, 10) : void 0,
|
|
35
35
|
charge_interval_frequency: `${createRequest.charge_interval_frequency}`,
|
|
36
36
|
order_interval_frequency: `${createRequest.order_interval_frequency}`,
|
|
37
|
-
price: createRequest.price ? parseFloat(createRequest.price) : void 0,
|
|
38
37
|
status: createRequest.status ? createRequest.status.toUpperCase() : void 0
|
|
39
38
|
});
|
|
40
39
|
}
|
|
@@ -51,8 +50,6 @@ function bulkSubscriptionUpdateMapper(force_update, updateRequest) {
|
|
|
51
50
|
shopify_variant_id: ((_a = updateRequest.external_variant_id) == null ? void 0 : _a.ecommerce) ? parseInt(updateRequest.external_variant_id.ecommerce, 10) : void 0,
|
|
52
51
|
charge_interval_frequency: updateRequest.charge_interval_frequency ? `${updateRequest.charge_interval_frequency}` : void 0,
|
|
53
52
|
order_interval_frequency: updateRequest.order_interval_frequency ? `${updateRequest.order_interval_frequency}` : void 0,
|
|
54
|
-
price: updateRequest.price ? parseFloat(updateRequest.price) : void 0,
|
|
55
|
-
use_shopify_variant_defaults: updateRequest.use_external_variant_defaults,
|
|
56
53
|
force_update
|
|
57
54
|
});
|
|
58
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.js","sources":["../../../src/mappers/subscription.ts"],"sourcesContent":["import omit from 'lodash/omit';\nimport {\n CreateSubscriptionRequest,\n Subscription,\n SubscriptionStatus,\n Subscription_2021_01,\n UpdateSubscriptionsRequest,\n} from '../types';\nimport { convertToBool } from './utils';\n\nexport function bulkSubscriptionCreateMapper(customer_id: string, createRequest: CreateSubscriptionRequest) {\n return {\n ...omit(createRequest, [\n 'address_id',\n 'external_variant_id',\n 'external_product_id',\n 'charge_interval_frequency',\n 'order_interval_frequency',\n 'price',\n 'status',\n ]),\n customer_id: parseInt(customer_id, 10),\n shopify_variant_id: createRequest.external_variant_id.ecommerce\n ? parseInt(createRequest.external_variant_id.ecommerce, 10)\n : undefined,\n charge_interval_frequency: `${createRequest.charge_interval_frequency}`,\n order_interval_frequency: `${createRequest.order_interval_frequency}`,\n
|
|
1
|
+
{"version":3,"file":"subscription.js","sources":["../../../src/mappers/subscription.ts"],"sourcesContent":["import omit from 'lodash/omit';\nimport {\n CreateSubscriptionRequest,\n Subscription,\n SubscriptionStatus,\n Subscription_2021_01,\n UpdateSubscriptionsRequest,\n} from '../types';\nimport { convertToBool } from './utils';\n\nexport function bulkSubscriptionCreateMapper(customer_id: string, createRequest: CreateSubscriptionRequest) {\n return {\n ...omit(createRequest, [\n 'address_id',\n 'external_variant_id',\n 'external_product_id',\n 'charge_interval_frequency',\n 'order_interval_frequency',\n 'price',\n 'status',\n ]),\n customer_id: parseInt(customer_id, 10),\n shopify_variant_id: createRequest.external_variant_id.ecommerce\n ? parseInt(createRequest.external_variant_id.ecommerce, 10)\n : undefined,\n charge_interval_frequency: `${createRequest.charge_interval_frequency}`,\n order_interval_frequency: `${createRequest.order_interval_frequency}`,\n status: createRequest.status ? createRequest.status.toUpperCase() : undefined,\n };\n}\n\nexport function bulkSubscriptionUpdateMapper(force_update: boolean, updateRequest: UpdateSubscriptionsRequest) {\n return {\n ...omit(updateRequest, [\n 'external_variant_id',\n 'external_product_id',\n 'charge_interval_frequency',\n 'order_interval_frequency',\n 'price',\n 'use_external_variant_defaults',\n ]),\n shopify_variant_id: updateRequest.external_variant_id?.ecommerce\n ? parseInt(updateRequest.external_variant_id.ecommerce, 10)\n : undefined,\n charge_interval_frequency: updateRequest.charge_interval_frequency\n ? `${updateRequest.charge_interval_frequency}`\n : undefined,\n order_interval_frequency: updateRequest.order_interval_frequency\n ? `${updateRequest.order_interval_frequency}`\n : undefined,\n force_update,\n };\n}\n\nexport function subscriptionMapperOldToNew(old: Subscription_2021_01): Subscription {\n const {\n id,\n address_id,\n customer_id,\n analytics_data,\n cancellation_reason,\n cancellation_reason_comments,\n cancelled_at,\n charge_interval_frequency,\n created_at,\n expire_after_specific_number_of_charges,\n shopify_product_id,\n shopify_variant_id,\n has_queued_charges,\n is_prepaid,\n is_skippable,\n is_swappable,\n max_retries_reached,\n next_charge_scheduled_at,\n order_day_of_month,\n order_day_of_week,\n order_interval_frequency,\n order_interval_unit,\n presentment_currency,\n price,\n product_title,\n properties,\n quantity,\n sku,\n sku_override,\n status,\n updated_at,\n variant_title,\n } = old;\n return {\n id,\n address_id,\n customer_id,\n analytics_data,\n cancellation_reason,\n cancellation_reason_comments,\n cancelled_at,\n charge_interval_frequency: parseInt(charge_interval_frequency, 10),\n created_at,\n expire_after_specific_number_of_charges,\n external_product_id: { ecommerce: `${shopify_product_id}` },\n external_variant_id: { ecommerce: `${shopify_variant_id}` },\n has_queued_charges: convertToBool(has_queued_charges),\n is_prepaid,\n is_skippable,\n is_swappable,\n max_retries_reached: convertToBool(max_retries_reached),\n next_charge_scheduled_at,\n order_day_of_month,\n order_day_of_week,\n order_interval_frequency: parseInt(order_interval_frequency, 10),\n order_interval_unit,\n presentment_currency,\n price: `${price}`,\n product_title: product_title ?? '',\n properties,\n quantity,\n sku,\n sku_override,\n status: status.toLowerCase() as SubscriptionStatus,\n updated_at,\n variant_title,\n };\n}\n"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** HEXA, RGBA, HSLA */
|
|
2
|
-
|
|
2
|
+
type ColorString = string;
|
|
3
3
|
/** HTML String */
|
|
4
|
-
|
|
4
|
+
type HTMLString = string;
|
|
5
5
|
/** ISO 8601 date time, YYYY-MM-DDTHH:MM:SS+00:00 */
|
|
6
|
-
|
|
6
|
+
type IsoDateString = string;
|
|
7
7
|
interface Property {
|
|
8
8
|
name: string;
|
|
9
9
|
value: string;
|
|
@@ -119,14 +119,14 @@ interface AnalyticsData {
|
|
|
119
119
|
}[];
|
|
120
120
|
}
|
|
121
121
|
/** preferred values are 'day', 'week', 'month' other values are available for backwards compatibility */
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
type IntervalUnit = 'day' | 'week' | 'month' | 'days' | 'Days' | 'weeks' | 'Weeks' | 'months' | 'Months';
|
|
123
|
+
type SubType<T, TRequired extends keyof T = keyof T, TOptional extends keyof T = keyof T> = Required<Pick<T, TRequired>> & Partial<Pick<T, TOptional>>;
|
|
124
|
+
type BooleanString = 'true' | 'false';
|
|
125
|
+
type BooleanNumbers = 0 | 1;
|
|
126
|
+
type BooleanStringNumbers = '0' | '1';
|
|
127
|
+
type BooleanLike = boolean | BooleanNumbers | BooleanStringNumbers | BooleanString;
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
type MetafieldOwnerResource = 'customer' | 'subscription' | 'order' | 'charge';
|
|
130
130
|
interface Metafield {
|
|
131
131
|
/** Unique numeric identifier for the metafield. */
|
|
132
132
|
id: number;
|
|
@@ -149,15 +149,15 @@ interface Metafield {
|
|
|
149
149
|
/** The type of the value parameter. */
|
|
150
150
|
value_type: 'string' | 'integer' | 'json_string';
|
|
151
151
|
}
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
type MetafieldRequiredCreateProps = 'key' | 'namespace' | 'owner_id' | 'owner_resource' | 'value' | 'value_type';
|
|
153
|
+
type MetafieldOptionalCreateProps = 'description';
|
|
154
154
|
interface MetafieldCreateProps {
|
|
155
155
|
/** Instructs to add the Onetime to the next charge scheduled under this Address. */
|
|
156
156
|
add_to_next_charge?: boolean;
|
|
157
157
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
type CreateMetafieldRequest = SubType<Metafield, MetafieldRequiredCreateProps, MetafieldOptionalCreateProps> & MetafieldCreateProps;
|
|
159
|
+
type MetafieldOptionalUpdateProps = 'description' | 'owner_id' | 'owner_resource' | 'value' | 'value_type';
|
|
160
|
+
type UpdateMetafieldRequest = Partial<Pick<Metafield, MetafieldOptionalUpdateProps>>;
|
|
161
161
|
|
|
162
162
|
interface PaymentDetails {
|
|
163
163
|
/** Payment_method brand or company powering it. valid for CREDIT_CARD only. */
|
|
@@ -177,9 +177,9 @@ interface PaymentDetails {
|
|
|
177
177
|
/** Type of funding for the Payment Method. */
|
|
178
178
|
funding_type?: string;
|
|
179
179
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
type PaymentType = 'CREDIT_CARD' | 'PAYPAL' | 'APPLE_PAY' | 'GOOGLE_PAY' | 'SEPA_DEBIT' | 'IDEAL' | 'SHOP_PAY' | 'PAYPAL_EXPRESS' | 'SOFORT' | 'GIROPAY';
|
|
181
|
+
type ProcessorName = 'stripe' | 'braintree' | 'authorize' | 'shopify_payments' | 'mollie' | 'adyen' | 'shopify_app_subscription_billing';
|
|
182
|
+
type PaymentMethodStatus = 'not_validated' | 'valid' | 'invalid';
|
|
183
183
|
interface PaymentMethod {
|
|
184
184
|
/** The unique payment method id for a customer. */
|
|
185
185
|
id: number;
|
|
@@ -226,14 +226,14 @@ interface PaymentMethodsResponse {
|
|
|
226
226
|
previous_cursor: null | string;
|
|
227
227
|
payment_methods: PaymentMethod[];
|
|
228
228
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
type PaymentMethodOptionalUpdateProps = 'billing_address' | 'default';
|
|
230
|
+
type UpdatePaymentMethodRequest = Partial<Pick<PaymentMethod, PaymentMethodOptionalUpdateProps>>;
|
|
231
|
+
type PaymentMethodIncludes = 'addresses';
|
|
232
232
|
interface GetPaymentMethodOptions {
|
|
233
233
|
include?: PaymentMethodIncludes[];
|
|
234
234
|
}
|
|
235
235
|
/** no sorting options for payment_methods, always by id-desc */
|
|
236
|
-
|
|
236
|
+
type PaymentMethodSortBy = null;
|
|
237
237
|
interface PaymentMethodListParams extends ListParams<PaymentMethodSortBy> {
|
|
238
238
|
/** Return the payment_methods linked to the given processor_name. */
|
|
239
239
|
processor_name?: ProcessorName;
|
|
@@ -245,7 +245,7 @@ interface PaymentMethodListParams extends ListParams<PaymentMethodSortBy> {
|
|
|
245
245
|
include?: PaymentMethodIncludes[];
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
|
|
248
|
+
type SubscriptionStatus = 'active' | 'cancelled' | 'expired';
|
|
249
249
|
interface Subscription {
|
|
250
250
|
/** Unique numeric identifier for the subscription. */
|
|
251
251
|
id: number;
|
|
@@ -339,11 +339,11 @@ interface SubscriptionsResponse {
|
|
|
339
339
|
previous_cursor: null | string;
|
|
340
340
|
subscriptions: Subscription[];
|
|
341
341
|
}
|
|
342
|
-
|
|
342
|
+
type SubscriptionIncludes = 'address' | 'customer' | 'metafields';
|
|
343
343
|
interface GetSubscriptionOptions {
|
|
344
344
|
include?: SubscriptionIncludes[];
|
|
345
345
|
}
|
|
346
|
-
|
|
346
|
+
type SubscriptionSortBy = 'id-asc' | 'id-desc' | 'created_at-asc' | 'created_at-desc' | 'updated_at-asc' | 'updated_at-desc';
|
|
347
347
|
interface SubscriptionListParams extends ListParams<SubscriptionSortBy> {
|
|
348
348
|
/** Return the subscriptions linked to the given address_id. */
|
|
349
349
|
address_id?: string;
|
|
@@ -366,18 +366,11 @@ interface SubscriptionListParams extends ListParams<SubscriptionSortBy> {
|
|
|
366
366
|
/** Include related data options */
|
|
367
367
|
include?: SubscriptionIncludes[];
|
|
368
368
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Flag instructing to pull the price from the product variant passed.
|
|
376
|
-
* You need to pass the variant_id under external_variant_id.ecommerce and set this attribute to true in the request for the flag to work.
|
|
377
|
-
*/
|
|
378
|
-
use_external_variant_defaults?: boolean;
|
|
379
|
-
};
|
|
380
|
-
declare type UpdateSubscriptionRequest = Partial<Pick<Subscription, SubscriptionOptionalUpdateProps>> & SubscriptionUpdateProps;
|
|
369
|
+
type SubscriptionRequiredCreateProps = 'address_id' | 'charge_interval_frequency' | 'external_variant_id' | 'next_charge_scheduled_at' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity';
|
|
370
|
+
type SubscriptionOptionalCreateProps = 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'external_product_id' | 'properties' | 'status';
|
|
371
|
+
type CreateSubscriptionRequest = SubType<Subscription, SubscriptionRequiredCreateProps, SubscriptionOptionalCreateProps>;
|
|
372
|
+
type SubscriptionOptionalUpdateProps = 'charge_interval_frequency' | 'expire_after_specific_number_of_charges' | 'external_variant_id' | 'order_day_of_month' | 'order_day_of_week' | 'order_interval_frequency' | 'order_interval_unit' | 'properties' | 'quantity';
|
|
373
|
+
type UpdateSubscriptionRequest = Partial<Pick<Subscription, SubscriptionOptionalUpdateProps>>;
|
|
381
374
|
interface BasicSubscriptionParams {
|
|
382
375
|
/** 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. */
|
|
383
376
|
commit?: boolean;
|
|
@@ -442,7 +435,7 @@ interface Subscription_2021_01 {
|
|
|
442
435
|
status: 'ACTIVE' | 'CANCELLED' | 'EXPIRED';
|
|
443
436
|
}
|
|
444
437
|
|
|
445
|
-
|
|
438
|
+
type CustomerIncludes = 'addresses' | 'metafields' | 'payment_methods' | 'subscriptions';
|
|
446
439
|
interface GetCustomerOptions {
|
|
447
440
|
include?: CustomerIncludes[];
|
|
448
441
|
}
|
|
@@ -483,14 +476,14 @@ interface Customer {
|
|
|
483
476
|
subscriptions?: Subscription[];
|
|
484
477
|
};
|
|
485
478
|
}
|
|
486
|
-
|
|
487
|
-
|
|
479
|
+
type CustomerOptionalUpdateProps = 'email' | 'first_name' | 'last_name' | 'external_customer_id';
|
|
480
|
+
type UpdateCustomerRequest = Partial<Pick<Customer, CustomerOptionalUpdateProps>>;
|
|
488
481
|
interface CustomerDeliveryScheduleParams {
|
|
489
482
|
delivery_count_future?: number;
|
|
490
483
|
future_internal?: number;
|
|
491
484
|
date_max?: IsoDateString;
|
|
492
485
|
}
|
|
493
|
-
|
|
486
|
+
type DeliveryLineItem = Omit<LineItem, 'external_inventory_policy' | 'grams' | 'handle' | 'purchase_item_id' | 'purchase_item_type' | 'sku' | 'tax_due' | 'tax_lines' | 'taxable_amount' | 'taxable' | 'title' | 'total_price' | 'unit_price_includes_tax'> & {
|
|
494
487
|
/** Value is set to true if it is not a onetime or a prepaid item */
|
|
495
488
|
is_skippable: boolean;
|
|
496
489
|
/** Value is set to true if the order is skipped. */
|
|
@@ -506,7 +499,7 @@ declare type DeliveryLineItem = Omit<LineItem, 'external_inventory_policy' | 'gr
|
|
|
506
499
|
/** The subtotal price (sum of all line items * their quantity) of the order less discounts. */
|
|
507
500
|
subtotal_price: string;
|
|
508
501
|
};
|
|
509
|
-
|
|
502
|
+
type DeliveryPaymentMethod = Omit<PaymentMethod, 'created_at' | 'customer_id' | 'default' | 'payment_type' | 'processor_customer_token' | 'processor_name' | 'processor_payment_method_token' | 'status_reason' | 'status' | 'updated_at'> & {
|
|
510
503
|
payment_details: PaymentDetails;
|
|
511
504
|
billing_address: AssociatedAddress;
|
|
512
505
|
};
|
|
@@ -560,8 +553,8 @@ interface ShippingLine {
|
|
|
560
553
|
/** An array of tax lines associated with the shipping_line. */
|
|
561
554
|
tax_lines: TaxLine[];
|
|
562
555
|
}
|
|
563
|
-
|
|
564
|
-
|
|
556
|
+
type OrderStatus = 'success' | 'error' | 'queued' | 'cancelled' | 'pending_charge_status';
|
|
557
|
+
type OrderType = 'checkout' | 'recurring';
|
|
565
558
|
interface Order {
|
|
566
559
|
/** The unique numeric identifier for the order. */
|
|
567
560
|
id: number;
|
|
@@ -656,13 +649,13 @@ interface Order {
|
|
|
656
649
|
metafields?: Metafield[];
|
|
657
650
|
};
|
|
658
651
|
}
|
|
659
|
-
|
|
652
|
+
type OrderIncludes = 'customer' | 'metafields';
|
|
660
653
|
interface OrdersResponse {
|
|
661
654
|
next_cursor: null | string;
|
|
662
655
|
previous_cursor: null | string;
|
|
663
656
|
orders: Order[];
|
|
664
657
|
}
|
|
665
|
-
|
|
658
|
+
type OrderSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc' | 'processed_at-asc' | 'processed_at-desc' | 'scheduled_at-asc' | 'scheduled_at-desc';
|
|
666
659
|
interface OrderListParams extends ListParams<OrderSortBy> {
|
|
667
660
|
/** Filter orders by address. */
|
|
668
661
|
address_id?: string;
|
|
@@ -696,7 +689,7 @@ interface OrderListParams extends ListParams<OrderSortBy> {
|
|
|
696
689
|
include?: OrderIncludes[];
|
|
697
690
|
}
|
|
698
691
|
|
|
699
|
-
|
|
692
|
+
type ChargeStatus = 'success' | 'error' | 'queued' | 'skipped' | 'refunded' | 'partially_refunded' | 'pending_manual_payment' | 'pending';
|
|
700
693
|
interface Charge {
|
|
701
694
|
/** The unique numeric identifier for the Charge. */
|
|
702
695
|
id: number;
|
|
@@ -795,11 +788,11 @@ interface ChargeListResponse {
|
|
|
795
788
|
previous_cursor: null | string;
|
|
796
789
|
charges: Charge[];
|
|
797
790
|
}
|
|
798
|
-
|
|
791
|
+
type ChargeIncludes = 'customer' | 'metafields' | 'payment_methods';
|
|
799
792
|
interface GetChargeOptions {
|
|
800
793
|
include?: ChargeIncludes[];
|
|
801
794
|
}
|
|
802
|
-
|
|
795
|
+
type ChargeSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc' | 'scheduled_at-asc' | 'scheduled_at-desc';
|
|
803
796
|
interface ChargeListParams extends ListParams<ChargeSortBy> {
|
|
804
797
|
/** Filter Charges by Address. */
|
|
805
798
|
address_id?: string;
|
|
@@ -884,7 +877,7 @@ interface CreateAddressRequest {
|
|
|
884
877
|
/** The zip or postal code associated with the address. */
|
|
885
878
|
zip: string;
|
|
886
879
|
}
|
|
887
|
-
|
|
880
|
+
type UpdateAddressRequest = Omit<Partial<CreateAddressRequest>, 'presentment_currency' | 'customer_id' | 'discounts'> & {
|
|
888
881
|
discounts?: {
|
|
889
882
|
code: string;
|
|
890
883
|
}[];
|
|
@@ -977,11 +970,11 @@ interface AddressListResponse {
|
|
|
977
970
|
previous_cursor: null | string;
|
|
978
971
|
addresses: Address[];
|
|
979
972
|
}
|
|
980
|
-
|
|
973
|
+
type AddressIncludes = 'customer' | 'payment_methods' | 'subscriptions';
|
|
981
974
|
interface GetAddressOptions {
|
|
982
975
|
include?: AddressIncludes[];
|
|
983
976
|
}
|
|
984
|
-
|
|
977
|
+
type AddressSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc';
|
|
985
978
|
interface AddressListParams extends ListParams<AddressSortBy> {
|
|
986
979
|
/** Returns addresses that have the provided discount_id. */
|
|
987
980
|
discount_id?: string;
|
|
@@ -1052,8 +1045,8 @@ declare function skipCharge(session: Session, id: number | string): Promise<Char
|
|
|
1052
1045
|
declare function unskipCharge(session: Session, id: number | string): Promise<Charge>;
|
|
1053
1046
|
declare function processCharge(session: Session, id: number | string): Promise<Charge>;
|
|
1054
1047
|
|
|
1055
|
-
|
|
1056
|
-
|
|
1048
|
+
type Method = 'get' | 'post' | 'put' | 'delete';
|
|
1049
|
+
type Request = <T>(method: Method, url: string, options?: RequestOptions) => Promise<T>;
|
|
1057
1050
|
interface GetRequestOptions {
|
|
1058
1051
|
id?: string | number;
|
|
1059
1052
|
query?: unknown;
|
|
@@ -1068,11 +1061,11 @@ interface CustomHeaders {
|
|
|
1068
1061
|
['X-Recharge-App']?: 'storefront-client';
|
|
1069
1062
|
}
|
|
1070
1063
|
/** We only support headers with an object syntax */
|
|
1071
|
-
|
|
1064
|
+
type RequestHeaders = Record<string, string> & CustomHeaders;
|
|
1072
1065
|
interface RequestOptionsHeaders {
|
|
1073
1066
|
headers?: RequestHeaders;
|
|
1074
1067
|
}
|
|
1075
|
-
|
|
1068
|
+
type RequestOptions = GetRequestOptions & CRUDRequestOptions & RequestOptionsHeaders;
|
|
1076
1069
|
|
|
1077
1070
|
interface LoginResponse {
|
|
1078
1071
|
api_token: string;
|
|
@@ -1152,18 +1145,18 @@ interface BundleSelection {
|
|
|
1152
1145
|
/** The date and time at which the BundleSelection was most recently updated. */
|
|
1153
1146
|
updated_at: IsoDateString;
|
|
1154
1147
|
}
|
|
1155
|
-
|
|
1156
|
-
|
|
1148
|
+
type BundleSelectionItemRequiredCreateProps = 'collection_id' | 'collection_source' | 'external_product_id' | 'external_variant_id' | 'quantity';
|
|
1149
|
+
type CreateBundleSelectionRequest = {
|
|
1157
1150
|
purchase_item_id: number;
|
|
1158
1151
|
items: Pick<BundleSelectionItem, BundleSelectionItemRequiredCreateProps>[];
|
|
1159
1152
|
};
|
|
1160
|
-
|
|
1153
|
+
type UpdateBundleSelectionRequest = CreateBundleSelectionRequest;
|
|
1161
1154
|
interface BundleSelectionsResponse {
|
|
1162
1155
|
next_cursor: null | string;
|
|
1163
1156
|
previous_cursor: null | string;
|
|
1164
1157
|
bundle_selections: BundleSelection[];
|
|
1165
1158
|
}
|
|
1166
|
-
|
|
1159
|
+
type BundleSelectionsSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc';
|
|
1167
1160
|
interface BundleSelectionListParams extends ListParams<BundleSelectionsSortBy> {
|
|
1168
1161
|
/** Filter BundleSelections by Subscription or Onetime ID. */
|
|
1169
1162
|
purchase_item_ids?: string[];
|
|
@@ -1171,9 +1164,9 @@ interface BundleSelectionListParams extends ListParams<BundleSelectionsSortBy> {
|
|
|
1171
1164
|
bundle_variant_ids?: string[];
|
|
1172
1165
|
}
|
|
1173
1166
|
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1167
|
+
type FirstOption = 'onetime' | 'autodeliver';
|
|
1168
|
+
type PriceAdjustmentsType = 'percentage';
|
|
1169
|
+
type StorefrontPurchaseOption = 'subscription_and_onetime' | 'subscription_only' | 'onetime_only' | 'inactive';
|
|
1177
1170
|
interface BundleTranslations {
|
|
1178
1171
|
cpb_add: string;
|
|
1179
1172
|
cpb_add_items_to_continue: string;
|
|
@@ -1257,8 +1250,8 @@ interface Translations {
|
|
|
1257
1250
|
month: string;
|
|
1258
1251
|
months: string;
|
|
1259
1252
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1253
|
+
type WidgetTemplateType = 'radio' | 'checkbox' | 'button_group' | 'radio_group';
|
|
1254
|
+
type WidgetIconColor = '#191D48' | 'white' | 'black' | '#ffffff';
|
|
1262
1255
|
/****************** 2020-12 **********************/
|
|
1263
1256
|
interface CDNProductResource {
|
|
1264
1257
|
product: CDNProductRaw;
|
|
@@ -1398,7 +1391,7 @@ interface CDNBaseWidgetSettings {
|
|
|
1398
1391
|
widget_icon: WidgetIconColor;
|
|
1399
1392
|
widget_template_type: WidgetTemplateType;
|
|
1400
1393
|
}
|
|
1401
|
-
|
|
1394
|
+
type CDNExcludedWidgetSettings = 'display_on' | 'first_option';
|
|
1402
1395
|
interface CDNWidgetSettings extends Omit<CDNBaseWidgetSettings, CDNExcludedWidgetSettings> {
|
|
1403
1396
|
/** @deprecated */
|
|
1404
1397
|
autoInject: boolean;
|
|
@@ -1410,7 +1403,7 @@ interface CDNWidgetSettings extends Omit<CDNBaseWidgetSettings, CDNExcludedWidge
|
|
|
1410
1403
|
valid_pages: string[];
|
|
1411
1404
|
is_subscription_first: boolean;
|
|
1412
1405
|
}
|
|
1413
|
-
|
|
1406
|
+
type CDNWidgetSettingsRaw = {
|
|
1414
1407
|
[key in keyof CDNBaseWidgetSettings]: string;
|
|
1415
1408
|
};
|
|
1416
1409
|
interface CDNWidgetSettingsResource {
|
|
@@ -1521,7 +1514,7 @@ interface CDNBundleSettings {
|
|
|
1521
1514
|
}
|
|
1522
1515
|
|
|
1523
1516
|
/** @internal */
|
|
1524
|
-
|
|
1517
|
+
type MembershipStatus = 'active' | 'inactive';
|
|
1525
1518
|
/** @internal */
|
|
1526
1519
|
interface Membership {
|
|
1527
1520
|
id: string;
|
|
@@ -1547,11 +1540,11 @@ interface MembershipListResponse {
|
|
|
1547
1540
|
memberships: Membership[];
|
|
1548
1541
|
}
|
|
1549
1542
|
/** @internal */
|
|
1550
|
-
|
|
1543
|
+
type MembershipsSortBy = 'id-asc' | 'id-desc';
|
|
1551
1544
|
/** @internal */
|
|
1552
|
-
|
|
1545
|
+
type membershipIncludes = 'customer' | 'subscriptions';
|
|
1553
1546
|
/** @internal */
|
|
1554
|
-
|
|
1547
|
+
type MembershipIncludes = `${membershipIncludes}` | `${membershipIncludes},${membershipIncludes}`;
|
|
1555
1548
|
/** @internal */
|
|
1556
1549
|
interface MembershipListParams extends ListParams<MembershipsSortBy> {
|
|
1557
1550
|
include?: MembershipIncludes;
|
|
@@ -1623,21 +1616,21 @@ interface Onetime {
|
|
|
1623
1616
|
/** Presentment currency */
|
|
1624
1617
|
presentment_currency: string | null;
|
|
1625
1618
|
}
|
|
1626
|
-
|
|
1627
|
-
|
|
1619
|
+
type OnetimeRequiredCreateProps = 'address_id' | 'external_variant_id' | 'next_charge_scheduled_at' | 'price' | 'product_title' | 'quantity';
|
|
1620
|
+
type OnetimeOptionalCreateProps = 'external_product_id' | 'properties' | 'sku';
|
|
1628
1621
|
interface OnetimeCreateProps {
|
|
1629
1622
|
/** Instructs to add the Onetime to the next charge scheduled under this Address. */
|
|
1630
1623
|
add_to_next_charge?: boolean;
|
|
1631
1624
|
}
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1625
|
+
type CreateOnetimeRequest = SubType<Onetime, OnetimeRequiredCreateProps, OnetimeOptionalCreateProps> & OnetimeCreateProps;
|
|
1626
|
+
type OnetimeOptionalUpdateProps = 'next_charge_scheduled_at' | 'properties' | 'quantity' | 'external_variant_id' | 'sku';
|
|
1627
|
+
type UpdateOnetimeRequest = Partial<Pick<Onetime, OnetimeOptionalUpdateProps>>;
|
|
1635
1628
|
interface OnetimesResponse {
|
|
1636
1629
|
next_cursor: null | string;
|
|
1637
1630
|
previous_cursor: null | string;
|
|
1638
1631
|
onetimes: Onetime[];
|
|
1639
1632
|
}
|
|
1640
|
-
|
|
1633
|
+
type OnetimesSortBy = 'id-asc' | 'id-desc' | 'created_at-asc' | 'created_at-desc' | 'updated_at-asc' | 'updated_at-desc';
|
|
1641
1634
|
interface OnetimeListParams extends ListParams<OnetimesSortBy> {
|
|
1642
1635
|
/** Return the onetimes linked to the given address_id. */
|
|
1643
1636
|
address_id?: string;
|
|
@@ -1660,7 +1653,7 @@ interface OnetimeListParams extends ListParams<OnetimesSortBy> {
|
|
|
1660
1653
|
}
|
|
1661
1654
|
|
|
1662
1655
|
/** @internal */
|
|
1663
|
-
|
|
1656
|
+
type StorefrontEnvironment = 'stage' | 'prod';
|
|
1664
1657
|
/** @internal */
|
|
1665
1658
|
interface StorefrontOptions {
|
|
1666
1659
|
storeIdentifier: string;
|
|
@@ -1715,7 +1708,7 @@ interface SubscriptionPreferences {
|
|
|
1715
1708
|
order_day_of_week: null | number;
|
|
1716
1709
|
order_interval_frequency: number;
|
|
1717
1710
|
}
|
|
1718
|
-
|
|
1711
|
+
type PlanType = 'subscription' | 'prepaid' | 'onetime';
|
|
1719
1712
|
interface Plan {
|
|
1720
1713
|
/** Unique numeric identifier for the Plan. */
|
|
1721
1714
|
id: number;
|
|
@@ -1747,7 +1740,7 @@ interface PlansResponse {
|
|
|
1747
1740
|
previous_cursor: null | string;
|
|
1748
1741
|
plans: Plan[];
|
|
1749
1742
|
}
|
|
1750
|
-
|
|
1743
|
+
type PlanSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc';
|
|
1751
1744
|
interface PlanListParams extends ListParams<PlanSortBy> {
|
|
1752
1745
|
/** Return the Plans linked to the Product record in Recharge with the indicated external_product_id */
|
|
1753
1746
|
external_product_id?: string;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* recharge-client-0.29.0.min.js
|
|
3
|
-
* Copyright (c) Recharge
|
|
4
|
-
*/
|
|
5
|
-
|
|
1
|
+
// recharge-client-0.29.2.min.js | MIT License | © Recharge Inc.
|
|
6
2
|
(function(ne,Ke){typeof exports=="object"&&typeof module<"u"?module.exports=Ke():typeof define=="function"&&define.amd?define(Ke):(ne=typeof globalThis<"u"?globalThis:ne||self,ne.recharge=Ke())})(this,function(){"use strict";var ne=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ke(r){var e=r.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var L=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof L<"u"&&L,k={searchParams:"URLSearchParams"in L,iterable:"Symbol"in L&&"iterator"in Symbol,blob:"FileReader"in L&&"Blob"in L&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in L,arrayBuffer:"ArrayBuffer"in L};function tf(r){return r&&DataView.prototype.isPrototypeOf(r)}if(k.arrayBuffer)var nf=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],af=ArrayBuffer.isView||function(r){return r&&nf.indexOf(Object.prototype.toString.call(r))>-1};function Ze(r){if(typeof r!="string"&&(r=String(r)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(r)||r==="")throw new TypeError('Invalid character in header field name: "'+r+'"');return r.toLowerCase()}function kt(r){return typeof r!="string"&&(r=String(r)),r}function qt(r){var e={next:function(){var t=r.shift();return{done:t===void 0,value:t}}};return k.iterable&&(e[Symbol.iterator]=function(){return e}),e}function D(r){this.map={},r instanceof D?r.forEach(function(e,t){this.append(t,e)},this):Array.isArray(r)?r.forEach(function(e){this.append(e[0],e[1])},this):r&&Object.getOwnPropertyNames(r).forEach(function(e){this.append(e,r[e])},this)}D.prototype.append=function(r,e){r=Ze(r),e=kt(e);var t=this.map[r];this.map[r]=t?t+", "+e:e},D.prototype.delete=function(r){delete this.map[Ze(r)]},D.prototype.get=function(r){return r=Ze(r),this.has(r)?this.map[r]:null},D.prototype.has=function(r){return this.map.hasOwnProperty(Ze(r))},D.prototype.set=function(r,e){this.map[Ze(r)]=kt(e)},D.prototype.forEach=function(r,e){for(var t in this.map)this.map.hasOwnProperty(t)&&r.call(e,this.map[t],t,this)},D.prototype.keys=function(){var r=[];return this.forEach(function(e,t){r.push(t)}),qt(r)},D.prototype.values=function(){var r=[];return this.forEach(function(e){r.push(e)}),qt(r)},D.prototype.entries=function(){var r=[];return this.forEach(function(e,t){r.push([t,e])}),qt(r)},k.iterable&&(D.prototype[Symbol.iterator]=D.prototype.entries);function Gt(r){if(r.bodyUsed)return Promise.reject(new TypeError("Already read"));r.bodyUsed=!0}function Oi(r){return new Promise(function(e,t){r.onload=function(){e(r.result)},r.onerror=function(){t(r.error)}})}function of(r){var e=new FileReader,t=Oi(e);return e.readAsArrayBuffer(r),t}function uf(r){var e=new FileReader,t=Oi(e);return e.readAsText(r),t}function sf(r){for(var e=new Uint8Array(r),t=new Array(e.length),n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return t.join("")}function Si(r){if(r.slice)return r.slice(0);var e=new Uint8Array(r.byteLength);return e.set(new Uint8Array(r)),e.buffer}function Ii(){return this.bodyUsed=!1,this._initBody=function(r){this.bodyUsed=this.bodyUsed,this._bodyInit=r,r?typeof r=="string"?this._bodyText=r:k.blob&&Blob.prototype.isPrototypeOf(r)?this._bodyBlob=r:k.formData&&FormData.prototype.isPrototypeOf(r)?this._bodyFormData=r:k.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)?this._bodyText=r.toString():k.arrayBuffer&&k.blob&&tf(r)?(this._bodyArrayBuffer=Si(r.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):k.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(r)||af(r))?this._bodyArrayBuffer=Si(r):this._bodyText=r=Object.prototype.toString.call(r):this._bodyText="",this.headers.get("content-type")||(typeof r=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):k.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},k.blob&&(this.blob=function(){var r=Gt(this);if(r)return r;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var r=Gt(this);return r||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(of)}),this.text=function(){var r=Gt(this);if(r)return r;if(this._bodyBlob)return uf(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(sf(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},k.formData&&(this.formData=function(){return this.text().then(lf)}),this.json=function(){return this.text().then(JSON.parse)},this}var ff=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function cf(r){var e=r.toUpperCase();return ff.indexOf(e)>-1?e:r}function _e(r,e){if(!(this instanceof _e))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e=e||{};var t=e.body;if(r instanceof _e){if(r.bodyUsed)throw new TypeError("Already read");this.url=r.url,this.credentials=r.credentials,e.headers||(this.headers=new D(r.headers)),this.method=r.method,this.mode=r.mode,this.signal=r.signal,!t&&r._bodyInit!=null&&(t=r._bodyInit,r.bodyUsed=!0)}else this.url=String(r);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new D(e.headers)),this.method=cf(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&t)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(t),(this.method==="GET"||this.method==="HEAD")&&(e.cache==="no-store"||e.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var i=/\?/;this.url+=(i.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}_e.prototype.clone=function(){return new _e(this,{body:this._bodyInit})};function lf(r){var e=new FormData;return r.trim().split("&").forEach(function(t){if(t){var n=t.split("="),i=n.shift().replace(/\+/g," "),a=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(a))}}),e}function pf(r){var e=new D,t=r.replace(/\r?\n[\t ]+/g," ");return t.split("\r").map(function(n){return n.indexOf(`
|
|
7
3
|
`)===0?n.substr(1,n.length):n}).forEach(function(n){var i=n.split(":"),a=i.shift().trim();if(a){var o=i.join(":").trim();e.append(a,o)}}),e}Ii.call(_e.prototype);function Y(r,e){if(!(this instanceof Y))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=e.status===void 0?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText===void 0?"":""+e.statusText,this.headers=new D(e.headers),this.url=e.url||"",this._initBody(r)}Ii.call(Y.prototype),Y.prototype.clone=function(){return new Y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new D(this.headers),url:this.url})},Y.error=function(){var r=new Y(null,{status:0,statusText:""});return r.type="error",r};var hf=[301,302,303,307,308];Y.redirect=function(r,e){if(hf.indexOf(e)===-1)throw new RangeError("Invalid status code");return new Y(null,{status:e,headers:{location:r}})};var me=L.DOMException;try{new me}catch{me=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},me.prototype=Object.create(Error.prototype),me.prototype.constructor=me}function Pi(r,e){return new Promise(function(t,n){var i=new _e(r,e);if(i.signal&&i.signal.aborted)return n(new me("Aborted","AbortError"));var a=new XMLHttpRequest;function o(){a.abort()}a.onload=function(){var f={status:a.status,statusText:a.statusText,headers:pf(a.getAllResponseHeaders()||"")};f.url="responseURL"in a?a.responseURL:f.headers.get("X-Request-URL");var c="response"in a?a.response:a.responseText;setTimeout(function(){t(new Y(c,f))},0)},a.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},a.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},a.onabort=function(){setTimeout(function(){n(new me("Aborted","AbortError"))},0)};function s(f){try{return f===""&&L.location.href?L.location.href:f}catch{return f}}a.open(i.method,s(i.url),!0),i.credentials==="include"?a.withCredentials=!0:i.credentials==="omit"&&(a.withCredentials=!1),"responseType"in a&&(k.blob?a.responseType="blob":k.arrayBuffer&&i.headers.get("Content-Type")&&i.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(a.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof D)?Object.getOwnPropertyNames(e.headers).forEach(function(f){a.setRequestHeader(f,kt(e.headers[f]))}):i.headers.forEach(function(f,c){a.setRequestHeader(c,f)}),i.signal&&(i.signal.addEventListener("abort",o),a.onreadystatechange=function(){a.readyState===4&&i.signal.removeEventListener("abort",o)}),a.send(typeof i._bodyInit>"u"?null:i._bodyInit)})}Pi.polyfill=!0,L.fetch||(L.fetch=Pi,L.Headers=D,L.Request=_e,L.Response=Y),self.fetch.bind(self);var df=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==i||o.enumerable!==!0)return!1}return!0},Ti=typeof Symbol<"u"&&Symbol,yf=df,vf=function(){return typeof Ti!="function"||typeof Symbol!="function"||typeof Ti("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:yf()},gf="Function.prototype.bind called on incompatible ",Wt=Array.prototype.slice,_f=Object.prototype.toString,mf="[object Function]",wf=function(e){var t=this;if(typeof t!="function"||_f.call(t)!==mf)throw new TypeError(gf+t);for(var n=Wt.call(arguments,1),i,a=function(){if(this instanceof i){var l=t.apply(this,n.concat(Wt.call(arguments)));return Object(l)===l?l:this}else return t.apply(e,n.concat(Wt.call(arguments)))},o=Math.max(0,t.length-n.length),s=[],f=0;f<o;f++)s.push("$"+f);if(i=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this,arguments); }")(a),t.prototype){var c=function(){};c.prototype=t.prototype,i.prototype=new c,c.prototype=null}return i},bf=wf,Vt=Function.prototype.bind||bf,$f=Vt,Af=$f.call(Function.call,Object.prototype.hasOwnProperty),T,Fe=SyntaxError,xi=Function,Me=TypeError,Ht=function(r){try{return xi('"use strict"; return ('+r+").constructor;")()}catch{}},we=Object.getOwnPropertyDescriptor;if(we)try{we({},"")}catch{we=null}var zt=function(){throw new Me},Ef=we?function(){try{return arguments.callee,zt}catch{try{return we(arguments,"callee").get}catch{return zt}}}():zt,De=vf(),pe=Object.getPrototypeOf||function(r){return r.__proto__},Be={},Of=typeof Uint8Array>"u"?T:pe(Uint8Array),Ne={"%AggregateError%":typeof AggregateError>"u"?T:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?T:ArrayBuffer,"%ArrayIteratorPrototype%":De?pe([][Symbol.iterator]()):T,"%AsyncFromSyncIteratorPrototype%":T,"%AsyncFunction%":Be,"%AsyncGenerator%":Be,"%AsyncGeneratorFunction%":Be,"%AsyncIteratorPrototype%":Be,"%Atomics%":typeof Atomics>"u"?T:Atomics,"%BigInt%":typeof BigInt>"u"?T:BigInt,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?T:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?T:Float32Array,"%Float64Array%":typeof Float64Array>"u"?T:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?T:FinalizationRegistry,"%Function%":xi,"%GeneratorFunction%":Be,"%Int8Array%":typeof Int8Array>"u"?T:Int8Array,"%Int16Array%":typeof Int16Array>"u"?T:Int16Array,"%Int32Array%":typeof Int32Array>"u"?T:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":De?pe(pe([][Symbol.iterator]())):T,"%JSON%":typeof JSON=="object"?JSON:T,"%Map%":typeof Map>"u"?T:Map,"%MapIteratorPrototype%":typeof Map>"u"||!De?T:pe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?T:Promise,"%Proxy%":typeof Proxy>"u"?T:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?T:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?T:Set,"%SetIteratorPrototype%":typeof Set>"u"||!De?T:pe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?T:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":De?pe(""[Symbol.iterator]()):T,"%Symbol%":De?Symbol:T,"%SyntaxError%":Fe,"%ThrowTypeError%":Ef,"%TypedArray%":Of,"%TypeError%":Me,"%Uint8Array%":typeof Uint8Array>"u"?T:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?T:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?T:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?T:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?T:WeakMap,"%WeakRef%":typeof WeakRef>"u"?T:WeakRef,"%WeakSet%":typeof WeakSet>"u"?T:WeakSet},Sf=function r(e){var t;if(e==="%AsyncFunction%")t=Ht("async function () {}");else if(e==="%GeneratorFunction%")t=Ht("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Ht("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&(t=pe(i.prototype))}return Ne[e]=t,t},Ri={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Je=Vt,xr=Af,If=Je.call(Function.call,Array.prototype.concat),Pf=Je.call(Function.apply,Array.prototype.splice),Fi=Je.call(Function.call,String.prototype.replace),Rr=Je.call(Function.call,String.prototype.slice),Tf=Je.call(Function.call,RegExp.prototype.exec),xf=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Rf=/\\(\\)?/g,Ff=function(e){var t=Rr(e,0,1),n=Rr(e,-1);if(t==="%"&&n!=="%")throw new Fe("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new Fe("invalid intrinsic syntax, expected opening `%`");var i=[];return Fi(e,xf,function(a,o,s,f){i[i.length]=s?Fi(f,Rf,"$1"):o||a}),i},Mf=function(e,t){var n=e,i;if(xr(Ri,n)&&(i=Ri[n],n="%"+i[0]+"%"),xr(Ne,n)){var a=Ne[n];if(a===Be&&(a=Sf(n)),typeof a>"u"&&!t)throw new Me("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new Fe("intrinsic "+e+" does not exist!")},Xt=function(e,t){if(typeof e!="string"||e.length===0)throw new Me("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Me('"allowMissing" argument must be a boolean');if(Tf(/^%?[^%]*%?$/,e)===null)throw new Fe("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Ff(e),i=n.length>0?n[0]:"",a=Mf("%"+i+"%",t),o=a.name,s=a.value,f=!1,c=a.alias;c&&(i=c[0],Pf(n,If([0,1],c)));for(var l=1,u=!0;l<n.length;l+=1){var p=n[l],d=Rr(p,0,1),_=Rr(p,-1);if((d==='"'||d==="'"||d==="`"||_==='"'||_==="'"||_==="`")&&d!==_)throw new Fe("property names with quotes must have matching quotes");if((p==="constructor"||!u)&&(f=!0),i+="."+p,o="%"+i+"%",xr(Ne,o))s=Ne[o];else if(s!=null){if(!(p in s)){if(!t)throw new Me("base intrinsic for "+e+" exists, but the property is not available.");return}if(we&&l+1>=n.length){var $=we(s,p);u=!!$,u&&"get"in $&&!("originalValue"in $.get)?s=$.get:s=s[p]}else u=xr(s,p),s=s[p];u&&!f&&(Ne[o]=s)}}return s},Mi={exports:{}};(function(r){var e=Vt,t=Xt,n=t("%Function.prototype.apply%"),i=t("%Function.prototype.call%"),a=t("%Reflect.apply%",!0)||e.call(i,n),o=t("%Object.getOwnPropertyDescriptor%",!0),s=t("%Object.defineProperty%",!0),f=t("%Math.max%");if(s)try{s({},"a",{value:1})}catch{s=null}r.exports=function(u){var p=a(e,i,arguments);if(o&&s){var d=o(p,"length");d.configurable&&s(p,"length",{value:1+f(0,u.length-(arguments.length-1))})}return p};var c=function(){return a(e,n,arguments)};s?s(r.exports,"apply",{value:c}):r.exports.apply=c})(Mi);var Di=Xt,Bi=Mi.exports,Df=Bi(Di("String.prototype.indexOf")),Bf=function(e,t){var n=Di(e,!!t);return typeof n=="function"&&Df(e,".prototype.")>-1?Bi(n):n},Ue=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},K=[],W=[],Nf=typeof Uint8Array<"u"?Uint8Array:Array,Yt=!1;function Ni(){Yt=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=r.length;e<t;++e)K[e]=r[e],W[r.charCodeAt(e)]=e;W["-".charCodeAt(0)]=62,W["_".charCodeAt(0)]=63}function Uf(r){Yt||Ni();var e,t,n,i,a,o,s=r.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a=r[s-2]==="="?2:r[s-1]==="="?1:0,o=new Nf(s*3/4-a),n=a>0?s-4:s;var f=0;for(e=0,t=0;e<n;e+=4,t+=3)i=W[r.charCodeAt(e)]<<18|W[r.charCodeAt(e+1)]<<12|W[r.charCodeAt(e+2)]<<6|W[r.charCodeAt(e+3)],o[f++]=i>>16&255,o[f++]=i>>8&255,o[f++]=i&255;return a===2?(i=W[r.charCodeAt(e)]<<2|W[r.charCodeAt(e+1)]>>4,o[f++]=i&255):a===1&&(i=W[r.charCodeAt(e)]<<10|W[r.charCodeAt(e+1)]<<4|W[r.charCodeAt(e+2)]>>2,o[f++]=i>>8&255,o[f++]=i&255),o}function Cf(r){return K[r>>18&63]+K[r>>12&63]+K[r>>6&63]+K[r&63]}function Lf(r,e,t){for(var n,i=[],a=e;a<t;a+=3)n=(r[a]<<16)+(r[a+1]<<8)+r[a+2],i.push(Cf(n));return i.join("")}function Ui(r){Yt||Ni();for(var e,t=r.length,n=t%3,i="",a=[],o=16383,s=0,f=t-n;s<f;s+=o)a.push(Lf(r,s,s+o>f?f:s+o));return n===1?(e=r[t-1],i+=K[e>>2],i+=K[e<<4&63],i+="=="):n===2&&(e=(r[t-2]<<8)+r[t-1],i+=K[e>>10],i+=K[e>>4&63],i+=K[e<<2&63],i+="="),a.push(i),a.join("")}function Fr(r,e,t,n,i){var a,o,s=i*8-n-1,f=(1<<s)-1,c=f>>1,l=-7,u=t?i-1:0,p=t?-1:1,d=r[e+u];for(u+=p,a=d&(1<<-l)-1,d>>=-l,l+=s;l>0;a=a*256+r[e+u],u+=p,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=n;l>0;o=o*256+r[e+u],u+=p,l-=8);if(a===0)a=1-c;else{if(a===f)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,n),a=a-c}return(d?-1:1)*o*Math.pow(2,a-n)}function Ci(r,e,t,n,i,a){var o,s,f,c=a*8-i-1,l=(1<<c)-1,u=l>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,_=n?1:-1,$=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+u>=1?e+=p/f:e+=p*Math.pow(2,1-u),e*f>=2&&(o++,f/=2),o+u>=l?(s=0,o=l):o+u>=1?(s=(e*f-1)*Math.pow(2,i),o=o+u):(s=e*Math.pow(2,u-1)*Math.pow(2,i),o=0));i>=8;r[t+d]=s&255,d+=_,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;r[t+d]=o&255,d+=_,o/=256,c-=8);r[t+d-_]|=$*128}var jf={}.toString,Li=Array.isArray||function(r){return jf.call(r)=="[object Array]"};/*!
|
|
8
4
|
* The buffer module from node.js, for the browser.
|
|
@@ -27,4 +23,4 @@
|
|
|
27
23
|
* see: https://github.com/dcodeIO/Long.js for details
|
|
28
24
|
*/(function(e,t){typeof CE=="function"&&!0&&r&&r.exports?r.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(ne,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<=-f?e.MIN_VALUE:!p&&u+1>=f?e.MAX_VALUE:p&&u>=s?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.fromNumber(Math.pow(d,8)),b=e.ZERO,w=0;w<u.length;w+=8){var A=Math.min(8,u.length-w),h=parseInt(u.substring(w,w+A),d);if(A<8){var I=e.fromNumber(Math.pow(d,A));b=b.multiply(I).add(e.fromNumber(h))}else b=b.multiply($),b=b.add(e.fromNumber(h))}return b.unsigned=p,b},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,s=o*o,f=s/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.fromNumber(Math.pow(u,6),this.unsigned);p=this;for(var b="";;){var w=p.divide($),A=p.subtract(w.multiply($)).toInt()>>>0,h=A.toString(u);if(p=w,p.isZero())return h+b;for(;h.length<6;)h="0"+h;b=""+h+b}},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,$=this.low&65535,b=u.high>>>16,w=u.high&65535,A=u.low>>>16,h=u.low&65535,I=0,P=0,R=0,m=0;return m+=$+h,R+=m>>>16,m&=65535,R+=_+A,P+=R>>>16,R&=65535,P+=d+w,I+=P>>>16,P&=65535,I+=p+b,I&=65535,e.fromBits(R<<16|m,I<<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,$=this.low&65535,b=u.high>>>16,w=u.high&65535,A=u.low>>>16,h=u.low&65535,I=0,P=0,R=0,m=0;return m+=$*h,R+=m>>>16,m&=65535,R+=_*h,P+=R>>>16,R&=65535,R+=$*A,P+=R>>>16,R&=65535,P+=d*h,I+=P>>>16,P&=65535,P+=_*A,I+=P>>>16,P&=65535,P+=$*w,I+=P>>>16,P&=65535,I+=p*h+d*A+_*w+$*b,I&=65535,e.fromBits(R<<16|m,I<<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 $=this.shiftRight(1);return p=$.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 b=Math.ceil(Math.log(p)/Math.LN2),w=b<=48?1:Math.pow(2,b-48),A=e.fromNumber(p),h=A.multiply(u);h.isNegative()||h.greaterThan(d);)p-=w,A=e.fromNumber(p,this.unsigned),h=A.multiply(u);A.isZero()&&(A=e.ONE),_=_.add(A),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})})(ci),Object.defineProperty(_t,"__esModule",{value:!0}),_t.Hyper=void 0;var LE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),xu=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)}},jE=ci.exports,gr=Ru(jE),kE=M,qE=Ru(kE);function Ru(r){return r&&r.__esModule?r:{default:r}}function GE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function WE(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function VE(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var _r=_t.Hyper=function(r){VE(e,r),LE(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=xu(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=xu(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 GE(this,e),WE(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!1))}return e}(gr.default);(0,qE.default)(_r),_r.MAX_VALUE=new _r(gr.default.MAX_VALUE.low,gr.default.MAX_VALUE.high),_r.MIN_VALUE=new _r(gr.default.MIN_VALUE.low,gr.default.MIN_VALUE.high);var Te={};Object.defineProperty(Te,"__esModule",{value:!0}),Te.UnsignedInt=void 0;var HE=dt,Fu=Mu(HE),zE=M,XE=Mu(zE);function Mu(r){return r&&r.__esModule?r:{default:r}}var mr=Te.UnsignedInt={read:function(e){return e.readUInt32BE()},write:function(e,t){if(!(0,Fu.default)(e))throw new Error("XDR Write Error: not a number");if(Math.floor(e)!==e)throw new Error("XDR Write Error: not an integer");if(e<0)throw new Error("XDR Write Error: negative number "+e);t.writeUInt32BE(e)},isValid:function(e){return!(0,Fu.default)(e)||Math.floor(e)!==e?!1:e>=mr.MIN_VALUE&&e<=mr.MAX_VALUE}};mr.MAX_VALUE=Math.pow(2,32)-1,mr.MIN_VALUE=0,(0,XE.default)(mr);var mt={};Object.defineProperty(mt,"__esModule",{value:!0}),mt.UnsignedHyper=void 0;var YE=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),Du=function r(e,t,n){e===null&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,t);if(i===void 0){var a=Object.getPrototypeOf(e);return a===null?void 0:r(a,t,n)}else{if("value"in i)return i.value;var o=i.get;return o===void 0?void 0:o.call(n)}},KE=ci.exports,wr=Bu(KE),ZE=M,JE=Bu(ZE);function Bu(r){return r&&r.__esModule?r:{default:r}}function QE(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function eO(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:r}function rO(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}var br=mt.UnsignedHyper=function(r){rO(e,r),YE(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=Du(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=Du(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 QE(this,e),eO(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,!0))}return e}(wr.default);(0,JE.default)(br),br.MAX_VALUE=new br(wr.default.MAX_UNSIGNED_VALUE.low,wr.default.MAX_UNSIGNED_VALUE.high),br.MIN_VALUE=new br(wr.default.MIN_VALUE.low,wr.default.MIN_VALUE.high);var wt={};Object.defineProperty(wt,"__esModule",{value:!0}),wt.Float=void 0;var tO=dt,Nu=Uu(tO),nO=M,iO=Uu(nO);function Uu(r){return r&&r.__esModule?r:{default:r}}var aO=wt.Float={read:function(e){return e.readFloatBE()},write:function(e,t){if(!(0,Nu.default)(e))throw new Error("XDR Write Error: not a number");t.writeFloatBE(e)},isValid:function(e){return(0,Nu.default)(e)}};(0,iO.default)(aO);var bt={};Object.defineProperty(bt,"__esModule",{value:!0}),bt.Double=void 0;var oO=dt,Cu=Lu(oO),uO=M,sO=Lu(uO);function Lu(r){return r&&r.__esModule?r:{default:r}}var fO=bt.Double={read:function(e){return e.readDoubleBE()},write:function(e,t){if(!(0,Cu.default)(e))throw new Error("XDR Write Error: not a number");t.writeDoubleBE(e)},isValid:function(e){return(0,Cu.default)(e)}};(0,sO.default)(fO);var $t={};Object.defineProperty($t,"__esModule",{value:!0}),$t.Quadruple=void 0;var cO=M,lO=pO(cO);function pO(r){return r&&r.__esModule?r:{default:r}}var hO=$t.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,lO.default)(hO);var $r={},dO=se,yO=V,vO="[object Boolean]";function gO(r){return r===!0||r===!1||yO(r)&&dO(r)==vO}var _O=gO;Object.defineProperty($r,"__esModule",{value:!0}),$r.Bool=void 0;var mO=_O,wO=ku(mO),ju=ce,bO=M,$O=ku(bO);function ku(r){return r&&r.__esModule?r:{default:r}}var AO=$r.Bool={read:function(e){var t=ju.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 ju.Int.write(n,t)},isValid:function(e){return(0,wO.default)(e)}};(0,$O.default)(AO);var At={},EO=se,OO=U,SO=V,IO="[object String]";function PO(r){return typeof r=="string"||!OO(r)&&SO(r)&&EO(r)==IO}var qu=PO;Object.defineProperty(At,"__esModule",{value:!0}),At.String=void 0;var TO=function(){function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}}(),xO=qu,Gu=li(xO),RO=U,FO=li(RO),Wu=ce,MO=Te,Vu=Pe,DO=M,BO=li(DO);function li(r){return r&&r.__esModule?r:{default:r}}function NO(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var UO=At.String=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:MO.UnsignedInt.MAX_VALUE;NO(this,r),this._maxLength=e}return TO(r,[{key:"read",value:function(t){var n=Wu.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,Vu.calculatePadding)(n),a=t.slice(n);return(0,Vu.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,Gu.default)(t)?i=y.from(t,"utf8"):i=y.from(t),Wu.Int.write(i.length,n),n.writeBufferPadded(i)}},{key:"isValid",value:function(t){var n=void 0;if((0,Gu.default)(t))n=y.from(t,"utf8");else if((0,FO.default)(t)||y.isBuffer(t))n=y.from(t);else return!1;return n.length<=this._maxLength}}]),r}();(0,BO.default)(UO.prototype);var Et={};Object.defineProperty(Et,"__esModule",{value:!0}),Et.Opaque=void 0;var CO=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}}(),Hu=Pe,LO=M,jO=kO(LO);function kO(r){return r&&r.__esModule?r:{default:r}}function qO(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var GO=Et.Opaque=function(){function r(e){qO(this,r),this._length=e,this._padding=(0,Hu.calculatePadding)(e)}return CO(r,[{key:"read",value:function(t){var n=t.slice(this._length);return(0,Hu.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,jO.default)(GO.prototype);var Ot={};Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.VarOpaque=void 0;var WO=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}}(),zu=ce,VO=Te,Xu=Pe,HO=M,zO=XO(HO);function XO(r){return r&&r.__esModule?r:{default:r}}function YO(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var KO=Ot.VarOpaque=function(){function r(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:VO.UnsignedInt.MAX_VALUE;YO(this,r),this._maxLength=e}return WO(r,[{key:"read",value:function(t){var n=zu.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,Xu.calculatePadding)(n),a=t.slice(n);return(0,Xu.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));zu.Int.write(t.length,n),n.writeBufferPadded(t)}},{key:"isValid",value:function(t){return y.isBuffer(t)&&t.length<=this._maxLength}}]),r}();(0,zO.default)(KO.prototype);var St={},xe={exports:{}},ZO=dr;function JO(r){return typeof r=="function"?r:ZO}var Yu=JO,QO=Bn,eS=ai,rS=Yu,tS=U;function nS(r,e){var t=tS(r)?QO:eS;return t(r,rS(e))}var iS=nS;(function(r){r.exports=iS})(xe);var aS=/\s/;function oS(r){for(var e=r.length;e--&&aS.test(r.charAt(e)););return e}var uS=oS,sS=uS,fS=/^\s+/;function cS(r){return r&&r.slice(0,sS(r)+1).replace(fS,"")}var lS=cS,pS=lS,Ku=fe,hS=ct,Zu=0/0,dS=/^[-+]0x[0-9a-f]+$/i,yS=/^0b[01]+$/i,vS=/^0o[0-7]+$/i,gS=parseInt;function _S(r){if(typeof r=="number")return r;if(hS(r))return Zu;if(Ku(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Ku(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=pS(r);var t=yS.test(r);return t||vS.test(r)?gS(r.slice(2),t?2:8):dS.test(r)?Zu:+r}var mS=_S,wS=mS,Ju=1/0,bS=17976931348623157e292;function $S(r){if(!r)return r===0?r:0;if(r=wS(r),r===Ju||r===-Ju){var e=r<0?-1:1;return e*bS}return r===r?r:0}var AS=$S,ES=AS;function OS(r){var e=ES(r),t=e%1;return e===e?t?e-t:e:0}var Qu=OS,SS=Ka,IS=Yu,PS=Qu,TS=9007199254740991,pi=4294967295,xS=Math.min;function RS(r,e){if(r=PS(r),r<1||r>TS)return[];var t=pi,n=xS(r,pi);e=IS(e),r-=pi;for(var i=SS(n,e);++t<r;)e(t);return i}var es=RS;Object.defineProperty(St,"__esModule",{value:!0}),St.Array=void 0;var FS=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}}(),MS=si,DS=Ar(MS),BS=xe.exports,NS=Ar(BS),US=es,CS=Ar(US),LS=U,rs=Ar(LS),jS=M,kS=Ar(jS);function Ar(r){return r&&r.__esModule?r:{default:r}}function qS(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var GS=St.Array=function(){function r(e,t){qS(this,r),this._childType=e,this._length=t}return FS(r,[{key:"read",value:function(t){var n=this;return(0,CS.default)(this._length,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,rs.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,NS.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,rs.default)(t)||t.length!==this._length?!1:(0,DS.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,kS.default)(GS.prototype);var It={};Object.defineProperty(It,"__esModule",{value:!0}),It.VarArray=void 0;var WS=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}}(),VS=si,HS=Er(VS),zS=xe.exports,XS=Er(zS),YS=es,KS=Er(YS),ZS=U,ts=Er(ZS),JS=Te,ns=ce,QS=M,e2=Er(QS);function Er(r){return r&&r.__esModule?r:{default:r}}function r2(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var t2=It.VarArray=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:JS.UnsignedInt.MAX_VALUE;r2(this,r),this._childType=e,this._maxLength=t}return WS(r,[{key:"read",value:function(t){var n=this,i=ns.Int.read(t);if(i>this._maxLength)throw new Error("XDR Read Error: Saw "+i+" length VarArray,"+("max allowed is "+this._maxLength));return(0,KS.default)(i,function(){return n._childType.read(t)})}},{key:"write",value:function(t,n){var i=this;if(!(0,ts.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));ns.Int.write(t.length,n),(0,XS.default)(t,function(a){return i._childType.write(a,n)})}},{key:"isValid",value:function(t){var n=this;return!(0,ts.default)(t)||t.length>this._maxLength?!1:(0,HS.default)(t,function(i){return n._childType.isValid(i)})}}]),r}();(0,e2.default)(t2.prototype);var Pt={};function n2(r){return r===null}var i2=n2;function a2(r){return r===void 0}var Or=a2;Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.Option=void 0;var o2=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}}(),u2=i2,is=hi(u2),s2=Or,as=hi(s2),os=$r,f2=M,c2=hi(f2);function hi(r){return r&&r.__esModule?r:{default:r}}function l2(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var p2=Pt.Option=function(){function r(e){l2(this,r),this._childType=e}return o2(r,[{key:"read",value:function(t){if(os.Bool.read(t))return this._childType.read(t)}},{key:"write",value:function(t,n){var i=!((0,is.default)(t)||(0,as.default)(t));os.Bool.write(i,n),i&&this._childType.write(t,n)}},{key:"isValid",value:function(t){return(0,is.default)(t)||(0,as.default)(t)?!0:this._childType.isValid(t)}}]),r}();(0,c2.default)(p2.prototype);var Sr={};Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.Void=void 0;var h2=Or,us=ss(h2),d2=M,y2=ss(d2);function ss(r){return r&&r.__esModule?r:{default:r}}var v2=Sr.Void={read:function(){},write:function(e){if(!(0,us.default)(e))throw new Error("XDR Write Error: trying to write value to a void slot")},isValid:function(e){return(0,us.default)(e)}};(0,y2.default)(v2);var Tt={},g2=Qr;function _2(r,e){return g2(e,function(t){return r[t]})}var m2=_2,w2=m2,b2=Xe;function $2(r){return r==null?[]:w2(r,b2(r))}var A2=$2;Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.Enum=void 0;var E2=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}}(),O2=xe.exports,S2=di(O2),I2=A2,P2=di(I2),fs=ce,T2=M,x2=di(T2);function di(r){return r&&r.__esModule?r:{default:r}}function R2(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 F2(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 cs(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var M2=Tt.Enum=function(){function r(e,t){cs(this,r),this.name=e,this.value=t}return E2(r,null,[{key:"read",value:function(t){var n=fs.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);fs.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,P2.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){F2(s,o);function s(){return cs(this,s),R2(this,(s.__proto__||Object.getPrototypeOf(s)).apply(this,arguments))}return s}(r);return a.enumName=n,t.results[n]=a,a._members={},a._byValue=new Map,(0,S2.default)(i,function(o,s){var f=new a(s,o);a._members[s]=f,a._byValue.set(o,f),a[s]=function(){return f}}),a}}]),r}();(0,x2.default)(M2);var xt={},D2=ai,B2=pr;function N2(r,e){var t=-1,n=B2(r)?Array(r.length):[];return D2(r,function(i,a,o){n[++t]=e(i,a,o)}),n}var U2=N2,C2=Qr,L2=Eu,j2=U2,k2=U;function q2(r,e){var t=k2(r)?C2:j2;return t(r,L2(e))}var G2=q2;function W2(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 V2=W2,Ir={};Object.defineProperty(Ir,"__esModule",{value:!0});var H2=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 z2(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}Ir.Reference=function(){function r(){z2(this,r)}return H2(r,[{key:"resolve",value:function(){throw new Error("implement resolve in child class")}}]),r}(),Object.defineProperty(xt,"__esModule",{value:!0}),xt.Struct=void 0;var Rt=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var s=e[Symbol.iterator](),f;!(i=(f=s.next()).done)&&(n.push(f.value),!(t&&n.length===t));i=!0);}catch(c){a=!0,o=c}finally{try{!i&&s.return&&s.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),X2=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}}(),Y2=xe.exports,ls=Pr(Y2),K2=G2,Z2=Pr(K2),J2=Or,Q2=Pr(J2),eI=V2,rI=Pr(eI),tI=Ir,nI=M,iI=Pr(nI);function Pr(r){return r&&r.__esModule?r:{default:r}}function aI(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 oI(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 ps(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var uI=xt.Struct=function(){function r(e){ps(this,r),this._attributes=e||{}}return X2(r,null,[{key:"read",value:function(t){var n=(0,Z2.default)(this._fields,function(i){var a=Rt(i,2),o=a[0],s=a[1],f=s.read(t);return[o,f]});return new this((0,rI.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,ls.default)(this._fields,function(i){var a=Rt(i,2),o=a[0],s=a[1],f=t._attributes[o];s.write(f,n)})}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(o){oI(s,o);function s(){return ps(this,s),aI(this,(s.__proto__||Object.getPrototypeOf(s)).apply(this,arguments))}return s}(r);return a.structName=n,t.results[n]=a,a._fields=i.map(function(o){var s=Rt(o,2),f=s[0],c=s[1];return c instanceof tI.Reference&&(c=c.resolve(t)),[f,c]}),(0,ls.default)(a._fields,function(o){var s=Rt(o,1),f=s[0];a.prototype[f]=sI(f)}),a}}]),r}();(0,iI.default)(uI);function sI(r){return function(t){return(0,Q2.default)(t)||(this._attributes[r]=t),this._attributes[r]}}var Ft={};Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.Union=void 0;var fI=function(){function r(e,t){var n=[],i=!0,a=!1,o=void 0;try{for(var s=e[Symbol.iterator](),f;!(i=(f=s.next()).done)&&(n.push(f.value),!(t&&n.length===t));i=!0);}catch(c){a=!0,o=c}finally{try{!i&&s.return&&s.return()}finally{if(a)throw o}}return n}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return r(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),cI=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}}(),lI=xe.exports,Mt=Bt(lI),pI=Or,hs=Bt(pI),hI=qu,ds=Bt(hI),Dt=Sr,yi=Ir,dI=M,yI=Bt(dI);function Bt(r){return r&&r.__esModule?r:{default:r}}function vI(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 gI(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 ys(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var _I=Ft.Union=function(){function r(e,t){ys(this,r),this.set(e,t)}return cI(r,[{key:"set",value:function(t,n){(0,ds.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!==Dt.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===Dt.Void?Dt.Void:this._arms[t]}},{key:"read",value:function(t){var n=this._switchOn.read(t),i=this.armForSwitch(n),a=this.armTypeForArm(i),o=void 0;return(0,hs.default)(a)?o=i.read(t):o=a.read(t),new this(n,o)}},{key:"write",value:function(t,n){if(!(t instanceof this))throw new Error("XDR Write Error: "+t+" is not a "+this.unionName);this._switchOn.write(t.switch(),n),t.armType().write(t.value(),n)}},{key:"isValid",value:function(t){return t instanceof this}},{key:"create",value:function(t,n,i){var a=function(s){gI(f,s);function f(){return ys(this,f),vI(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}return f}(r);a.unionName=n,t.results[n]=a,i.switchOn instanceof yi.Reference?a._switchOn=i.switchOn.resolve(t):a._switchOn=i.switchOn,a._switches=new Map,a._arms={},(0,Mt.default)(i.arms,function(s,f){s instanceof yi.Reference&&(s=s.resolve(t)),a._arms[f]=s});var o=i.defaultArm;return o instanceof yi.Reference&&(o=o.resolve(t)),a._defaultArm=o,(0,Mt.default)(i.switches,function(s){var f=fI(s,2),c=f[0],l=f[1];(0,ds.default)(c)&&(c=a._switchOn.fromName(c)),a._switches.set(c,l)}),(0,hs.default)(a._switchOn.values)||(0,Mt.default)(a._switchOn.values(),function(s){a[s.name]=function(f){return new a(s,f)},a.prototype[s.name]=function(c){return this.set(s,c)}}),(0,Mt.default)(a._arms,function(s,f){s!==Dt.Void&&(a.prototype[f]=function(){return this.get(f)})}),a}}]),r}();(0,yI.default)(_I),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=ce;Object.keys(e).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return e[h]}})});var t=_t;Object.keys(t).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return t[h]}})});var n=Te;Object.keys(n).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return n[h]}})});var i=mt;Object.keys(i).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return i[h]}})});var a=wt;Object.keys(a).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return a[h]}})});var o=bt;Object.keys(o).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return o[h]}})});var s=$t;Object.keys(s).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return s[h]}})});var f=$r;Object.keys(f).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return f[h]}})});var c=At;Object.keys(c).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return c[h]}})});var l=Et;Object.keys(l).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return l[h]}})});var u=Ot;Object.keys(u).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return u[h]}})});var p=St;Object.keys(p).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return p[h]}})});var d=It;Object.keys(d).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return d[h]}})});var _=Pt;Object.keys(_).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return _[h]}})});var $=Sr;Object.keys($).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return $[h]}})});var b=Tt;Object.keys(b).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return b[h]}})});var w=xt;Object.keys(w).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return w[h]}})});var A=Ft;Object.keys(A).forEach(function(h){h==="default"||h==="__esModule"||Object.defineProperty(r,h,{enumerable:!0,get:function(){return A[h]}})})}(ii);var vs={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=function(){function m(v,g){for(var E=0;E<g.length;E++){var S=g[E];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,S.key,S)}}return function(v,g,E){return g&&m(v.prototype,g),E&&m(v,E),v}}(),t=Ir;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=xe.exports,o=l(a),s=ii,f=c(s);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 $=function(m){d(v,m);function v(g){u(this,v);var E=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this));return E.name=g,E}return e(v,[{key:"resolve",value:function(E){var S=E.definitions[this.name];return S.resolve(E)}}]),v}(t.Reference),b=function(m){d(v,m);function v(g,E){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;u(this,v);var B=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this));return B.childReference=g,B.length=E,B.variable=S,B}return e(v,[{key:"resolve",value:function(E){var S=this.childReference,B=this.length;return S instanceof t.Reference&&(S=S.resolve(E)),B instanceof t.Reference&&(B=B.resolve(E)),this.variable?new f.VarArray(S,B):new f.Array(S,B)}}]),v}(t.Reference),w=function(m){d(v,m);function v(g){u(this,v);var E=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this));return E.childReference=g,E.name=g.name,E}return e(v,[{key:"resolve",value:function(E){var S=this.childReference;return S instanceof t.Reference&&(S=S.resolve(E)),new f.Option(S)}}]),v}(t.Reference),A=function(m){d(v,m);function v(g,E){u(this,v);var S=p(this,(v.__proto__||Object.getPrototypeOf(v)).call(this));return S.sizedType=g,S.length=E,S}return e(v,[{key:"resolve",value:function(E){var S=this.length;return S instanceof t.Reference&&(S=S.resolve(E)),new this.sizedType(S)}}]),v}(t.Reference),h=function(){function m(v,g,E){u(this,m),this.constructor=v,this.name=g,this.config=E}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 I(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,E){var S=new h(f.Enum.create,g,E);this.define(g,S)}},{key:"struct",value:function(g,E){var S=new h(f.Struct.create,g,E);this.define(g,S)}},{key:"union",value:function(g,E){var S=new h(f.Union.create,g,E);this.define(g,S)}},{key:"typedef",value:function(g,E){var S=new h(I,g,E);this.define(g,S)}},{key:"const",value:function(g,E){var S=new h(P,g,E);this.define(g,S)}},{key:"void",value:function(){return f.Void}},{key:"bool",value:function(){return f.Bool}},{key:"int",value:function(){return f.Int}},{key:"hyper",value:function(){return f.Hyper}},{key:"uint",value:function(){return f.UnsignedInt}},{key:"uhyper",value:function(){return f.UnsignedHyper}},{key:"float",value:function(){return f.Float}},{key:"double",value:function(){return f.Double}},{key:"quadruple",value:function(){return f.Quadruple}},{key:"string",value:function(g){return new A(f.String,g)}},{key:"opaque",value:function(g){return new A(f.Opaque,g)}},{key:"varOpaque",value:function(g){return new A(f.VarOpaque,g)}},{key:"array",value:function(g,E){return new b(g,E)}},{key:"varArray",value:function(g,E){return new b(g,E,!0)}},{key:"option",value:function(g){return new w(g)}},{key:"define",value:function(g,E){if((0,i.default)(this._destination[g]))this._definitions[g]=E;else throw new Error("XDRTypes Error:"+g+" is already defined")}},{key:"lookup",value:function(g){return new $(g)}},{key:"resolve",value:function(){var g=this;(0,o.default)(this._definitions,function(E){E.resolve({definitions:g._definitions,results:g._destination})})}}]),m}()})(vs),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=ii;Object.keys(e).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[n]}})});var t=vs;Object.keys(t).forEach(function(n){n==="default"||n==="__esModule"||Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[n]}})})}(iu);function mI(r){const e={variantId:le.Uint64.fromString(r.variantId.toString()),version:r.version||Math.floor(Date.now()/1e3),items:r.items.map(n=>new le.BundleItem({collectionId:le.Uint64.fromString(n.collectionId.toString()),productId:le.Uint64.fromString(n.productId.toString()),variantId:le.Uint64.fromString(n.variantId.toString()),sku:n.sku||"",quantity:n.quantity,ext:new le.BundleItemExt(0)})),ext:new le.BundleExt(0)},t=new le.Bundle(e);return le.BundleEnvelope.envelopeTypeBundle(t).toXDR("base64")}const le=iu.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")}})}),gs="/bundling-storefront-manager";function wI(){return Math.ceil(Date.now()/1e3)}async function bI(){try{const{timestamp:r}=await sr("get",`${gs}/t`,{headers:{"X-Recharge-App":"storefront-client"}});return r}catch(r){return console.error(`Fetch failed: ${r}. Using client-side date.`),wI()}}async function $I(r){const e=ue(),t=await _s(r);if(t!==!0)throw new Error(t);const n=await bI(),i=mI({variantId:r.externalVariantId,version:n,items:r.selections.map(a=>({collectionId:a.collectionId,productId:a.externalProductId,variantId:a.externalVariantId,quantity:a.quantity,sku:""}))});try{const a=await sr("post",`${gs}/api/v1/bundles`,{data:{bundle:i},headers:{Origin:`https://${e.storeIdentifier}`}});if(!a.id||a.code!==200)throw new Error(`1: failed generating rb_id: ${JSON.stringify(a)}`);return a.id}catch(a){throw new Error(`2: failed generating rb_id ${a}`)}}function AI(r,e){const t=ms(r);if(t!==!0)throw new Error(`Dynamic Bundle is invalid. ${t}`);const n=`${Np(9)}:${r.externalProductId}`;return r.selections.map(i=>{const a={id:i.externalVariantId,quantity:i.quantity,properties:{_rc_bundle:n,_rc_bundle_variant:r.externalVariantId,_rc_bundle_parent:e,_rc_bundle_collection_id:i.collectionId}};return i.sellingPlan?a.selling_plan=i.sellingPlan:i.shippingIntervalFrequency&&(a.properties.shipping_interval_frequency=i.shippingIntervalFrequency,a.properties.shipping_interval_unit_type=i.shippingIntervalUnitType,a.id=`${i.discountedVariantId}`),a})}async function _s(r){try{return r?await tu(r.externalProductId)?!0:"Bundle settings do not exist for the given product":"Bundle is not defined"}catch(e){return`Error fetching bundle settings: ${e}`}}const EI={day:["day","days","Days"],days:["day","days","Days"],Days:["day","days","Days"],week:["week","weeks","Weeks"],weeks:["week","weeks","Weeks"],Weeks:["week","weeks","Weeks"],month:["month","months","Months"],months:["month","months","Months"],Months:["month","months","Months"]};function ms(r){if(!r)return"No bundle defined.";if(r.selections.length===0)return"No selections defined.";const{shippingIntervalFrequency:e,shippingIntervalUnitType:t}=r.selections.find(n=>n.shippingIntervalFrequency||n.shippingIntervalUnitType)||{};if(e||t){if(!e||!t)return"Shipping intervals do not match on selections.";{const n=EI[t];for(let i=0;i<r.selections.length;i++){const{shippingIntervalFrequency:a,shippingIntervalUnitType:o}=r.selections[i];if(a&&a!==e||o&&!n.includes(o))return"Shipping intervals do not match on selections."}}}return!0}async function OI(r,e){const{bundle_selection:t}=await O("get","/bundle_selections",{id:e},r);return t}function SI(r,e){return O("get","/bundle_selections",{query:e},r)}async function II(r,e){const{bundle_selection:t}=await O("post","/bundle_selections",{data:e},r);return t}async function PI(r,e,t){const{bundle_selection:n}=await O("put","/bundle_selections",{id:e,data:t},r);return n}function TI(r,e){return O("delete","/bundle_selections",{id:e},r)}var xI=Object.freeze({__proto__:null,getBundleId:$I,getDynamicBundleItems:AI,validateBundle:_s,validateDynamicBundle:ms,getBundleSelection:OI,listBundleSelections:SI,createBundleSelection:II,updateBundleSelection:PI,deleteBundleSelection:TI});async function RI(r,e,t){const{charge:n}=await O("get","/charges",{id:e,query:{include:t?.include}},r);return n}function FI(r,e){return O("get","/charges",{query:e},r)}async function MI(r,e,t){const{charge:n}=await O("post",`/charges/${e}/apply_discount`,{data:{discount_code:t}},r);return n}async function DI(r,e){const{charge:t}=await O("post",`/charges/${e}/remove_discount`,{},r);return t}async function BI(r,e){const{charge:t}=await O("post",`/charges/${e}/skip`,{},r);return t}async function NI(r,e){const{charge:t}=await O("post",`/charges/${e}/unskip`,{},r);return t}async function UI(r,e){const{charge:t}=await O("post",`/charges/${e}/process`,{},r);return t}var CI=Object.freeze({__proto__:null,getCharge:RI,listCharges:FI,applyDiscountToCharge:MI,removeDiscountsFromCharge:DI,skipCharge:BI,unskipCharge:NI,processCharge:UI});async function LI(r,e){const{membership:t}=await O("get","/memberships",{id:e},r);return t}function jI(r,e){return O("get","/memberships",{query:e},r)}async function kI(r,e,t){const{membership:n}=await O("post",`/memberships/${e}/cancel`,{data:t},r);return n}async function qI(r,e,t){const{membership:n}=await O("post",`/memberships/${e}/activate`,{data:t},r);return n}var GI=Object.freeze({__proto__:null,getMembership:LI,listMemberships:jI,cancelMembership:kI,activateMembership:qI});async function WI(r,e){const{metafield:t}=await O("post","/metafields",{data:{metafield:e}},r);return t}async function VI(r,e,t){const{metafield:n}=await O("put","/metafields",{id:e,data:{metafield:t}},r);return n}function HI(r,e){return O("delete","/metafields",{id:e},r)}var zI=Object.freeze({__proto__:null,createMetafield:WI,updateMetafield:VI,deleteMetafield:HI});async function XI(r,e){const{onetime:t}=await O("get","/onetimes",{id:e},r);return t}function YI(r,e){return O("get","/onetimes",{query:e},r)}async function KI(r,e){const{onetime:t}=await O("post","/onetimes",{data:e},r);return t}async function ZI(r,e,t){const{onetime:n}=await O("put","/onetimes",{id:e,data:t},r);return n}function JI(r,e){return O("delete","/onetimes",{id:e},r)}var QI=Object.freeze({__proto__:null,getOnetime:XI,listOnetimes:YI,createOnetime:KI,updateOnetime:ZI,deleteOnetime:JI});async function eP(r,e){const{order:t}=await O("get","/orders",{id:e},r);return t}function rP(r,e){return O("get","/orders",{query:e},r)}var tP=Object.freeze({__proto__:null,getOrder:eP,listOrders:rP});async function nP(r,e,t){const{payment_method:n}=await O("get","/payment_methods",{id:e,query:{include:t?.include}},r);return n}async function iP(r,e,t){const{payment_method:n}=await O("put","/payment_methods",{id:e,data:t},r);return n}function aP(r,e){return O("get","/payment_methods",{query:e},r)}var oP=Object.freeze({__proto__:null,getPaymentMethod:nP,updatePaymentMethod:iP,listPaymentMethods:aP});async function uP(r,e){const{plan:t}=await O("get","/plans",{id:e},r);return t}function sP(r,e){return O("get","/plans",{query:e},r)}var fP=Object.freeze({__proto__:null,getPlan:uP,listPlans:sP}),ws=co,cP=ws&&new ws,bs=cP,lP=dr,$s=bs,pP=$s?function(r,e){return $s.set(r,e),r}:lP,As=pP,hP=st,dP=fe;function yP(r){return function(){var e=arguments;switch(e.length){case 0:return new r;case 1:return new r(e[0]);case 2:return new r(e[0],e[1]);case 3:return new r(e[0],e[1],e[2]);case 4:return new r(e[0],e[1],e[2],e[3]);case 5:return new r(e[0],e[1],e[2],e[3],e[4]);case 6:return new r(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new r(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var t=hP(r.prototype),n=r.apply(t,e);return dP(n)?n:t}}var Nt=yP,vP=Nt,gP=G,_P=1;function mP(r,e,t){var n=e&_P,i=vP(r);function a(){var o=this&&this!==gP&&this instanceof a?i:r;return o.apply(n?t:this,arguments)}return a}var wP=mP,bP=Math.max;function $P(r,e,t,n){for(var i=-1,a=r.length,o=t.length,s=-1,f=e.length,c=bP(a-o,0),l=Array(f+c),u=!n;++s<f;)l[s]=e[s];for(;++i<o;)(u||i<a)&&(l[t[i]]=r[i]);for(;c--;)l[s++]=r[i++];return l}var Es=$P,AP=Math.max;function EP(r,e,t,n){for(var i=-1,a=r.length,o=-1,s=t.length,f=-1,c=e.length,l=AP(a-s,0),u=Array(l+c),p=!n;++i<l;)u[i]=r[i];for(var d=i;++f<c;)u[d+f]=e[f];for(;++o<s;)(p||i<a)&&(u[d+t[o]]=r[i++]);return u}var Os=EP;function OP(r,e){for(var t=r.length,n=0;t--;)r[t]===e&&++n;return n}var SP=OP;function IP(){}var vi=IP,PP=st,TP=vi,xP=4294967295;function Ut(r){this.__wrapped__=r,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=xP,this.__views__=[]}Ut.prototype=PP(TP.prototype),Ut.prototype.constructor=Ut;var gi=Ut;function RP(){}var FP=RP,Ss=bs,MP=FP,DP=Ss?function(r){return Ss.get(r)}:MP,Is=DP,BP={},NP=BP,Ps=NP,UP=Object.prototype,CP=UP.hasOwnProperty;function LP(r){for(var e=r.name+"",t=Ps[e],n=CP.call(Ps,e)?t.length:0;n--;){var i=t[n],a=i.func;if(a==null||a==r)return i.name}return e}var jP=LP,kP=st,qP=vi;function Ct(r,e){this.__wrapped__=r,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}Ct.prototype=kP(qP.prototype),Ct.prototype.constructor=Ct;var Ts=Ct,GP=gi,WP=Ts,VP=kn;function HP(r){if(r instanceof GP)return r.clone();var e=new WP(r.__wrapped__,r.__chain__);return e.__actions__=VP(r.__actions__),e.__index__=r.__index__,e.__values__=r.__values__,e}var zP=HP,XP=gi,xs=Ts,YP=vi,KP=U,ZP=V,JP=zP,QP=Object.prototype,eT=QP.hasOwnProperty;function Lt(r){if(ZP(r)&&!KP(r)&&!(r instanceof XP)){if(r instanceof xs)return r;if(eT.call(r,"__wrapped__"))return JP(r)}return new xs(r)}Lt.prototype=YP.prototype,Lt.prototype.constructor=Lt;var rT=Lt,tT=gi,nT=Is,iT=jP,aT=rT;function oT(r){var e=iT(r),t=aT[e];if(typeof t!="function"||!(e in tT.prototype))return!1;if(r===t)return!0;var n=nT(t);return!!n&&r===n[0]}var uT=oT,sT=As,fT=Go,cT=fT(sT),Rs=cT,lT=/\{\n\/\* \[wrapped with (.+)\] \*/,pT=/,? & /;function hT(r){var e=r.match(lT);return e?e[1].split(pT):[]}var dT=hT,yT=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function vT(r,e){var t=e.length;if(!t)return r;var n=t-1;return e[n]=(t>1?"& ":"")+e[n],e=e.join(t>2?", ":" "),r.replace(yT,`{
|
|
29
25
|
/* [wrapped with `+e+`] */
|
|
30
|
-
`)}var gT=vT;function _T(r,e,t,n){for(var i=r.length,a=t+(n?1:-1);n?a--:++a<i;)if(e(r[a],a,r))return a;return-1}var mT=_T;function wT(r){return r!==r}var bT=wT;function $T(r,e,t){for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}var AT=$T,ET=mT,OT=bT,ST=AT;function IT(r,e,t){return e===e?ST(r,e,t):ET(r,OT,t)}var PT=IT,TT=PT;function xT(r,e){var t=r==null?0:r.length;return!!t&&TT(r,e,0)>-1}var RT=xT,FT=Bn,MT=RT,DT=1,BT=2,NT=8,UT=16,CT=32,LT=64,jT=128,kT=256,qT=512,GT=[["ary",jT],["bind",DT],["bindKey",BT],["curry",NT],["curryRight",UT],["flip",qT],["partial",CT],["partialRight",LT],["rearg",kT]];function WT(r,e){return FT(GT,function(t){var n="_."+t[0];e&t[1]&&!MT(r,n)&&r.push(n)}),r.sort()}var VT=WT,HT=dT,zT=gT,XT=ri,YT=VT;function KT(r,e,t){var n=e+"";return XT(r,zT(n,YT(HT(n),t)))}var Fs=KT,ZT=uT,JT=Rs,QT=Fs,ex=1,rx=2,tx=4,nx=8,Ms=32,Ds=64;function ix(r,e,t,n,i,a,o,s,f,c){var l=e&nx,u=l?o:void 0,p=l?void 0:o,d=l?a:void 0,_=l?void 0:a;e|=l?Ms:Ds,e&=~(l?Ds:Ms),e&tx||(e&=~(ex|rx));var $=[r,e,i,d,u,_,p,s,f,c],b=t.apply(void 0,$);return ZT(r)&&JT(b,$),b.placeholder=n,QT(b,r,e)}var Bs=ix;function ax(r){var e=r;return e.placeholder}var _i=ax,ox=kn,ux=at,sx=Math.min;function fx(r,e){for(var t=r.length,n=sx(e.length,t),i=ox(r);n--;){var a=e[n];r[n]=ux(a,t)?i[a]:void 0}return r}var cx=fx,Ns="__lodash_placeholder__";function lx(r,e){for(var t=-1,n=r.length,i=0,a=[];++t<n;){var o=r[t];(o===e||o===Ns)&&(r[t]=Ns,a[i++]=t)}return a}var jt=lx,px=Es,hx=Os,dx=SP,Us=Nt,yx=Bs,vx=_i,gx=cx,_x=jt,mx=G,wx=1,bx=2,$x=8,Ax=16,Ex=128,Ox=512;function Cs(r,e,t,n,i,a,o,s,f,c){var l=e&Ex,u=e&wx,p=e&bx,d=e&($x|Ax),_=e&Ox,$=p?void 0:Us(r);function b(){for(var w=arguments.length,A=Array(w),h=w;h--;)A[h]=arguments[h];if(d)var I=vx(b),P=dx(A,I);if(n&&(A=px(A,n,i,d)),a&&(A=hx(A,a,o,d)),w-=P,d&&w<c){var R=_x(A,I);return yx(r,e,Cs,b.placeholder,t,A,R,s,f,c-w)}var m=u?t:this,v=p?m[r]:r;return w=A.length,s?A=gx(A,s):_&&w>1&&A.reverse(),l&&f<w&&(A.length=f),this&&this!==mx&&this instanceof b&&(v=$||Us(v)),v.apply(m,A)}return b}var Ls=Cs,Sx=ei,Ix=Nt,Px=Ls,Tx=Bs,xx=_i,Rx=jt,Fx=G;function Mx(r,e,t){var n=Ix(r);function i(){for(var a=arguments.length,o=Array(a),s=a,f=xx(i);s--;)o[s]=arguments[s];var c=a<3&&o[0]!==f&&o[a-1]!==f?[]:Rx(o,f);if(a-=c.length,a<t)return Tx(r,e,Px,i.placeholder,void 0,o,c,void 0,void 0,t-a);var l=this&&this!==Fx&&this instanceof i?n:r;return Sx(l,this,o)}return i}var Dx=Mx,Bx=ei,Nx=Nt,Ux=G,Cx=1;function Lx(r,e,t,n){var i=e&Cx,a=Nx(r);function o(){for(var s=-1,f=arguments.length,c=-1,l=n.length,u=Array(l+f),p=this&&this!==Ux&&this instanceof o?a:r;++c<l;)u[c]=n[c];for(;f--;)u[c++]=arguments[++s];return Bx(p,i?t:this,u)}return o}var jx=Lx,kx=Es,qx=Os,js=jt,ks="__lodash_placeholder__",mi=1,Gx=2,Wx=4,qs=8,Tr=128,Gs=256,Vx=Math.min;function Hx(r,e){var t=r[1],n=e[1],i=t|n,a=i<(mi|Gx|Tr),o=n==Tr&&t==qs||n==Tr&&t==Gs&&r[7].length<=e[8]||n==(Tr|Gs)&&e[7].length<=e[8]&&t==qs;if(!(a||o))return r;n&mi&&(r[2]=e[2],i|=t&mi?0:Wx);var s=e[3];if(s){var f=r[3];r[3]=f?kx(f,s,e[4]):s,r[4]=f?js(r[3],ks):e[4]}return s=e[5],s&&(f=r[5],r[5]=f?qx(f,s,e[6]):s,r[6]=f?js(r[5],ks):e[6]),s=e[7],s&&(r[7]=s),n&Tr&&(r[8]=r[8]==null?e[8]:Vx(r[8],e[8])),r[9]==null&&(r[9]=e[9]),r[0]=e[0],r[1]=i,r}var zx=Hx,Xx=As,Yx=wP,Kx=Dx,Zx=Ls,Jx=jx,Qx=Is,eR=zx,rR=Rs,tR=Fs,Ws=Qu,nR="Expected a function",Vs=1,iR=2,wi=8,bi=16,$i=32,Hs=64,zs=Math.max;function aR(r,e,t,n,i,a,o,s){var f=e&iR;if(!f&&typeof r!="function")throw new TypeError(nR);var c=n?n.length:0;if(c||(e&=~($i|Hs),n=i=void 0),o=o===void 0?o:zs(Ws(o),0),s=s===void 0?s:Ws(s),c-=i?i.length:0,e&Hs){var l=n,u=i;n=i=void 0}var p=f?void 0:Qx(r),d=[r,e,t,n,i,l,u,a,o,s];if(p&&eR(d,p),r=d[0],e=d[1],t=d[2],n=d[3],i=d[4],s=d[9]=d[9]===void 0?f?0:r.length:zs(d[9]-c,0),!s&&e&(wi|bi)&&(e&=~(wi|bi)),!e||e==Vs)var _=Yx(r,e,t);else e==wi||e==bi?_=Kx(r,e,s):(e==$i||e==(Vs|$i))&&!i.length?_=Jx(r,e,t,n):_=Zx.apply(void 0,d);var $=p?Xx:rR;return tR($(_,d),r,e)}var oR=aR,uR=ou,sR=oR,fR=_i,cR=jt,lR=32,Ai=uR(function(r,e){var t=cR(e,fR(Ai));return sR(r,lR,void 0,e,t)});Ai.placeholder={};var Xs=Ai,pR=Object.defineProperty,hR=Object.defineProperties,dR=Object.getOwnPropertyDescriptors,Ys=Object.getOwnPropertySymbols,yR=Object.prototype.hasOwnProperty,vR=Object.prototype.propertyIsEnumerable,Ks=(r,e,t)=>e in r?pR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zs=(r,e)=>{for(var t in e||(e={}))yR.call(e,t)&&Ks(r,t,e[t]);if(Ys)for(var t of Ys(e))vR.call(e,t)&&Ks(r,t,e[t]);return r},Js=(r,e)=>hR(r,dR(e));function gR(r,e){return Js(Zs({},ti(e,["address_id","external_variant_id","external_product_id","charge_interval_frequency","order_interval_frequency","price","status"])),{customer_id:parseInt(r,10),shopify_variant_id:e.external_variant_id.ecommerce?parseInt(e.external_variant_id.ecommerce,10):void 0,charge_interval_frequency:`${e.charge_interval_frequency}`,order_interval_frequency:`${e.order_interval_frequency}`,price:e.price?parseFloat(e.price):void 0,status:e.status?e.status.toUpperCase():void 0})}function _R(r,e){var t;return Js(Zs({},ti(e,["external_variant_id","external_product_id","charge_interval_frequency","order_interval_frequency","price","use_external_variant_defaults"])),{shopify_variant_id:(t=e.external_variant_id)!=null&&t.ecommerce?parseInt(e.external_variant_id.ecommerce,10):void 0,charge_interval_frequency:e.charge_interval_frequency?`${e.charge_interval_frequency}`:void 0,order_interval_frequency:e.order_interval_frequency?`${e.order_interval_frequency}`:void 0,price:e.price?parseFloat(e.price):void 0,use_shopify_variant_defaults:e.use_external_variant_defaults,force_update:r})}function Qs(r){const{id:e,address_id:t,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:s,charge_interval_frequency:f,created_at:c,expire_after_specific_number_of_charges:l,shopify_product_id:u,shopify_variant_id:p,has_queued_charges:d,is_prepaid:_,is_skippable:$,is_swappable:b,max_retries_reached:w,next_charge_scheduled_at:A,order_day_of_month:h,order_day_of_week:I,order_interval_frequency:P,order_interval_unit:R,presentment_currency:m,price:v,product_title:g,properties:E,quantity:S,sku:B,sku_override:H,status:te,updated_at:X,variant_title:Re}=r;return{id:e,address_id:t,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:s,charge_interval_frequency:parseInt(f,10),created_at:c,expire_after_specific_number_of_charges:l,external_product_id:{ecommerce:`${u}`},external_variant_id:{ecommerce:`${p}`},has_queued_charges:Ho(d),is_prepaid:_,is_skippable:$,is_swappable:b,max_retries_reached:Ho(w),next_charge_scheduled_at:A,order_day_of_month:h,order_day_of_week:I,order_interval_frequency:parseInt(P,10),order_interval_unit:R,presentment_currency:m,price:`${v}`,product_title:g??"",properties:E,quantity:S,sku:B,sku_override:H,status:te.toLowerCase(),updated_at:X,variant_title:Re}}async function mR(r,e,t){const{subscription:n}=await O("get","/subscriptions",{id:e,query:{include:t?.include}},r);return n}function wR(r,e){return O("get","/subscriptions",{query:e},r)}async function bR(r,e,t){const{subscription:n}=await O("post","/subscriptions",{data:e,query:t},r);return n}async function $R(r,e,t,n){const{subscription:i}=await O("put","/subscriptions",{id:e,data:t,query:n},r);return i}async function AR(r,e,t,n){const{subscription:i}=await O("post",`/subscriptions/${e}/set_next_charge_date`,{data:{date:t},query:n},r);return i}async function ER(r,e,t){const{subscription:n}=await O("post",`/subscriptions/${e}/change_address`,{data:{address_id:t}},r);return n}async function OR(r,e,t,n){const{subscription:i}=await O("post",`/subscriptions/${e}/cancel`,{data:t,query:n},r);return i}async function SR(r,e,t){const{subscription:n}=await O("post",`/subscriptions/${e}/activate`,{query:t},r);return n}async function IR(r,e,t){const{charge:n}=await O("post",`/subscriptions/${e}/charges/skip`,{data:{date:t,subscription_id:`${e}`}},r);return n}async function PR(r,e){const t=e.length;if(t<1||t>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:n}=r;if(!n)throw new Error("No customerId in session.");const i=e[0].address_id;if(!e.every(f=>f.address_id===i))throw new Error("All subscriptions must have the same address_id.");const a=Xs(gR,n),o=e.map(a),{subscriptions:s}=await O("post",`/addresses/${i}/subscriptions-bulk`,{data:{subscriptions:o},headers:{"X-Recharge-Version":"2021-01"}},r);return s.map(Qs)}async function TR(r,e,t,n){const i=t.length;if(i<1||i>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:a}=r;if(!a)throw new Error("No customerId in session.");const o=Xs(_R,!!(n!=null&&n.force_update)),s=t.map(o),{subscriptions:f}=await O("put",`/addresses/${e}/subscriptions-bulk`,{data:{subscriptions:s},headers:{"X-Recharge-Version":"2021-01"}},r);return f.map(Qs)}var xR=Object.freeze({__proto__:null,getSubscription:mR,listSubscriptions:wR,createSubscription:bR,updateSubscription:$R,updateSubscriptionChargeDate:AR,updateSubscriptionAddress:ER,cancelSubscription:OR,activateSubscription:SR,skipSubscriptionCharge:IR,createSubscriptions:PR,updateSubscriptions:TR});async function RR(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await O("get","/customers",{id:t,query:{include:e?.include}},r);return n}async function FR(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await O("put","/customers",{id:t,data:e},r);return n}async function MR(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{deliveries:n}=await O("get",`/customers/${t}/delivery_schedule`,{query:e},r);return n}async function DR(r){return await O("get","/portal_access",{},r)}var BR=Object.freeze({__proto__:null,getCustomer:RR,updateCustomer:FR,getDeliverySchedule:MR,getCustomerPortalAccess:DR});const NR={get(r,e){return z("get",r,e)},post(r,e){return z("post",r,e)},put(r,e){return z("put",r,e)},delete(r,e){return z("delete",r,e)}};function UR(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 CR(r={}){const e=r;fp({storeIdentifier:UR(r.storeIdentifier),loginRetryFn:r.loginRetryFn,storefrontAccessToken:r.storefrontAccessToken,environment:e.environment?e.environment:"prod"}),nu()}const ef={init:CR,api:NR,address:Pp,auth:Bp,bundle:xI,charge:CI,cdn:d1,customer:BR,membership:GI,metafield:zI,onetime:QI,order:tP,paymentMethod:oP,plan:fP,subscription:xR};try{ef.init()}catch{}return ef});
|
|
26
|
+
`)}var gT=vT;function _T(r,e,t,n){for(var i=r.length,a=t+(n?1:-1);n?a--:++a<i;)if(e(r[a],a,r))return a;return-1}var mT=_T;function wT(r){return r!==r}var bT=wT;function $T(r,e,t){for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}var AT=$T,ET=mT,OT=bT,ST=AT;function IT(r,e,t){return e===e?ST(r,e,t):ET(r,OT,t)}var PT=IT,TT=PT;function xT(r,e){var t=r==null?0:r.length;return!!t&&TT(r,e,0)>-1}var RT=xT,FT=Bn,MT=RT,DT=1,BT=2,NT=8,UT=16,CT=32,LT=64,jT=128,kT=256,qT=512,GT=[["ary",jT],["bind",DT],["bindKey",BT],["curry",NT],["curryRight",UT],["flip",qT],["partial",CT],["partialRight",LT],["rearg",kT]];function WT(r,e){return FT(GT,function(t){var n="_."+t[0];e&t[1]&&!MT(r,n)&&r.push(n)}),r.sort()}var VT=WT,HT=dT,zT=gT,XT=ri,YT=VT;function KT(r,e,t){var n=e+"";return XT(r,zT(n,YT(HT(n),t)))}var Fs=KT,ZT=uT,JT=Rs,QT=Fs,ex=1,rx=2,tx=4,nx=8,Ms=32,Ds=64;function ix(r,e,t,n,i,a,o,s,f,c){var l=e&nx,u=l?o:void 0,p=l?void 0:o,d=l?a:void 0,_=l?void 0:a;e|=l?Ms:Ds,e&=~(l?Ds:Ms),e&tx||(e&=~(ex|rx));var $=[r,e,i,d,u,_,p,s,f,c],b=t.apply(void 0,$);return ZT(r)&&JT(b,$),b.placeholder=n,QT(b,r,e)}var Bs=ix;function ax(r){var e=r;return e.placeholder}var _i=ax,ox=kn,ux=at,sx=Math.min;function fx(r,e){for(var t=r.length,n=sx(e.length,t),i=ox(r);n--;){var a=e[n];r[n]=ux(a,t)?i[a]:void 0}return r}var cx=fx,Ns="__lodash_placeholder__";function lx(r,e){for(var t=-1,n=r.length,i=0,a=[];++t<n;){var o=r[t];(o===e||o===Ns)&&(r[t]=Ns,a[i++]=t)}return a}var jt=lx,px=Es,hx=Os,dx=SP,Us=Nt,yx=Bs,vx=_i,gx=cx,_x=jt,mx=G,wx=1,bx=2,$x=8,Ax=16,Ex=128,Ox=512;function Cs(r,e,t,n,i,a,o,s,f,c){var l=e&Ex,u=e&wx,p=e&bx,d=e&($x|Ax),_=e&Ox,$=p?void 0:Us(r);function b(){for(var w=arguments.length,A=Array(w),h=w;h--;)A[h]=arguments[h];if(d)var I=vx(b),P=dx(A,I);if(n&&(A=px(A,n,i,d)),a&&(A=hx(A,a,o,d)),w-=P,d&&w<c){var R=_x(A,I);return yx(r,e,Cs,b.placeholder,t,A,R,s,f,c-w)}var m=u?t:this,v=p?m[r]:r;return w=A.length,s?A=gx(A,s):_&&w>1&&A.reverse(),l&&f<w&&(A.length=f),this&&this!==mx&&this instanceof b&&(v=$||Us(v)),v.apply(m,A)}return b}var Ls=Cs,Sx=ei,Ix=Nt,Px=Ls,Tx=Bs,xx=_i,Rx=jt,Fx=G;function Mx(r,e,t){var n=Ix(r);function i(){for(var a=arguments.length,o=Array(a),s=a,f=xx(i);s--;)o[s]=arguments[s];var c=a<3&&o[0]!==f&&o[a-1]!==f?[]:Rx(o,f);if(a-=c.length,a<t)return Tx(r,e,Px,i.placeholder,void 0,o,c,void 0,void 0,t-a);var l=this&&this!==Fx&&this instanceof i?n:r;return Sx(l,this,o)}return i}var Dx=Mx,Bx=ei,Nx=Nt,Ux=G,Cx=1;function Lx(r,e,t,n){var i=e&Cx,a=Nx(r);function o(){for(var s=-1,f=arguments.length,c=-1,l=n.length,u=Array(l+f),p=this&&this!==Ux&&this instanceof o?a:r;++c<l;)u[c]=n[c];for(;f--;)u[c++]=arguments[++s];return Bx(p,i?t:this,u)}return o}var jx=Lx,kx=Es,qx=Os,js=jt,ks="__lodash_placeholder__",mi=1,Gx=2,Wx=4,qs=8,Tr=128,Gs=256,Vx=Math.min;function Hx(r,e){var t=r[1],n=e[1],i=t|n,a=i<(mi|Gx|Tr),o=n==Tr&&t==qs||n==Tr&&t==Gs&&r[7].length<=e[8]||n==(Tr|Gs)&&e[7].length<=e[8]&&t==qs;if(!(a||o))return r;n&mi&&(r[2]=e[2],i|=t&mi?0:Wx);var s=e[3];if(s){var f=r[3];r[3]=f?kx(f,s,e[4]):s,r[4]=f?js(r[3],ks):e[4]}return s=e[5],s&&(f=r[5],r[5]=f?qx(f,s,e[6]):s,r[6]=f?js(r[5],ks):e[6]),s=e[7],s&&(r[7]=s),n&Tr&&(r[8]=r[8]==null?e[8]:Vx(r[8],e[8])),r[9]==null&&(r[9]=e[9]),r[0]=e[0],r[1]=i,r}var zx=Hx,Xx=As,Yx=wP,Kx=Dx,Zx=Ls,Jx=jx,Qx=Is,eR=zx,rR=Rs,tR=Fs,Ws=Qu,nR="Expected a function",Vs=1,iR=2,wi=8,bi=16,$i=32,Hs=64,zs=Math.max;function aR(r,e,t,n,i,a,o,s){var f=e&iR;if(!f&&typeof r!="function")throw new TypeError(nR);var c=n?n.length:0;if(c||(e&=~($i|Hs),n=i=void 0),o=o===void 0?o:zs(Ws(o),0),s=s===void 0?s:Ws(s),c-=i?i.length:0,e&Hs){var l=n,u=i;n=i=void 0}var p=f?void 0:Qx(r),d=[r,e,t,n,i,l,u,a,o,s];if(p&&eR(d,p),r=d[0],e=d[1],t=d[2],n=d[3],i=d[4],s=d[9]=d[9]===void 0?f?0:r.length:zs(d[9]-c,0),!s&&e&(wi|bi)&&(e&=~(wi|bi)),!e||e==Vs)var _=Yx(r,e,t);else e==wi||e==bi?_=Kx(r,e,s):(e==$i||e==(Vs|$i))&&!i.length?_=Jx(r,e,t,n):_=Zx.apply(void 0,d);var $=p?Xx:rR;return tR($(_,d),r,e)}var oR=aR,uR=ou,sR=oR,fR=_i,cR=jt,lR=32,Ai=uR(function(r,e){var t=cR(e,fR(Ai));return sR(r,lR,void 0,e,t)});Ai.placeholder={};var Xs=Ai,pR=Object.defineProperty,hR=Object.defineProperties,dR=Object.getOwnPropertyDescriptors,Ys=Object.getOwnPropertySymbols,yR=Object.prototype.hasOwnProperty,vR=Object.prototype.propertyIsEnumerable,Ks=(r,e,t)=>e in r?pR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zs=(r,e)=>{for(var t in e||(e={}))yR.call(e,t)&&Ks(r,t,e[t]);if(Ys)for(var t of Ys(e))vR.call(e,t)&&Ks(r,t,e[t]);return r},Js=(r,e)=>hR(r,dR(e));function gR(r,e){return Js(Zs({},ti(e,["address_id","external_variant_id","external_product_id","charge_interval_frequency","order_interval_frequency","price","status"])),{customer_id:parseInt(r,10),shopify_variant_id:e.external_variant_id.ecommerce?parseInt(e.external_variant_id.ecommerce,10):void 0,charge_interval_frequency:`${e.charge_interval_frequency}`,order_interval_frequency:`${e.order_interval_frequency}`,status:e.status?e.status.toUpperCase():void 0})}function _R(r,e){var t;return Js(Zs({},ti(e,["external_variant_id","external_product_id","charge_interval_frequency","order_interval_frequency","price","use_external_variant_defaults"])),{shopify_variant_id:(t=e.external_variant_id)!=null&&t.ecommerce?parseInt(e.external_variant_id.ecommerce,10):void 0,charge_interval_frequency:e.charge_interval_frequency?`${e.charge_interval_frequency}`:void 0,order_interval_frequency:e.order_interval_frequency?`${e.order_interval_frequency}`:void 0,force_update:r})}function Qs(r){const{id:e,address_id:t,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:s,charge_interval_frequency:f,created_at:c,expire_after_specific_number_of_charges:l,shopify_product_id:u,shopify_variant_id:p,has_queued_charges:d,is_prepaid:_,is_skippable:$,is_swappable:b,max_retries_reached:w,next_charge_scheduled_at:A,order_day_of_month:h,order_day_of_week:I,order_interval_frequency:P,order_interval_unit:R,presentment_currency:m,price:v,product_title:g,properties:E,quantity:S,sku:B,sku_override:H,status:te,updated_at:X,variant_title:Re}=r;return{id:e,address_id:t,customer_id:n,analytics_data:i,cancellation_reason:a,cancellation_reason_comments:o,cancelled_at:s,charge_interval_frequency:parseInt(f,10),created_at:c,expire_after_specific_number_of_charges:l,external_product_id:{ecommerce:`${u}`},external_variant_id:{ecommerce:`${p}`},has_queued_charges:Ho(d),is_prepaid:_,is_skippable:$,is_swappable:b,max_retries_reached:Ho(w),next_charge_scheduled_at:A,order_day_of_month:h,order_day_of_week:I,order_interval_frequency:parseInt(P,10),order_interval_unit:R,presentment_currency:m,price:`${v}`,product_title:g??"",properties:E,quantity:S,sku:B,sku_override:H,status:te.toLowerCase(),updated_at:X,variant_title:Re}}async function mR(r,e,t){const{subscription:n}=await O("get","/subscriptions",{id:e,query:{include:t?.include}},r);return n}function wR(r,e){return O("get","/subscriptions",{query:e},r)}async function bR(r,e,t){const{subscription:n}=await O("post","/subscriptions",{data:e,query:t},r);return n}async function $R(r,e,t,n){const{subscription:i}=await O("put","/subscriptions",{id:e,data:t,query:n},r);return i}async function AR(r,e,t,n){const{subscription:i}=await O("post",`/subscriptions/${e}/set_next_charge_date`,{data:{date:t},query:n},r);return i}async function ER(r,e,t){const{subscription:n}=await O("post",`/subscriptions/${e}/change_address`,{data:{address_id:t}},r);return n}async function OR(r,e,t,n){const{subscription:i}=await O("post",`/subscriptions/${e}/cancel`,{data:t,query:n},r);return i}async function SR(r,e,t){const{subscription:n}=await O("post",`/subscriptions/${e}/activate`,{query:t},r);return n}async function IR(r,e,t){const{charge:n}=await O("post",`/subscriptions/${e}/charges/skip`,{data:{date:t,subscription_id:`${e}`}},r);return n}async function PR(r,e){const t=e.length;if(t<1||t>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:n}=r;if(!n)throw new Error("No customerId in session.");const i=e[0].address_id;if(!e.every(f=>f.address_id===i))throw new Error("All subscriptions must have the same address_id.");const a=Xs(gR,n),o=e.map(a),{subscriptions:s}=await O("post",`/addresses/${i}/subscriptions-bulk`,{data:{subscriptions:o},headers:{"X-Recharge-Version":"2021-01"}},r);return s.map(Qs)}async function TR(r,e,t,n){const i=t.length;if(i<1||i>21)throw new Error("Number of subscriptions must be between 1 and 20.");const{customerId:a}=r;if(!a)throw new Error("No customerId in session.");const o=Xs(_R,!!(n!=null&&n.force_update)),s=t.map(o),{subscriptions:f}=await O("put",`/addresses/${e}/subscriptions-bulk`,{data:{subscriptions:s},headers:{"X-Recharge-Version":"2021-01"}},r);return f.map(Qs)}var xR=Object.freeze({__proto__:null,getSubscription:mR,listSubscriptions:wR,createSubscription:bR,updateSubscription:$R,updateSubscriptionChargeDate:AR,updateSubscriptionAddress:ER,cancelSubscription:OR,activateSubscription:SR,skipSubscriptionCharge:IR,createSubscriptions:PR,updateSubscriptions:TR});async function RR(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await O("get","/customers",{id:t,query:{include:e?.include}},r);return n}async function FR(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{customer:n}=await O("put","/customers",{id:t,data:e},r);return n}async function MR(r,e){const t=r.customerId;if(!t)throw new Error("Not logged in.");const{deliveries:n}=await O("get",`/customers/${t}/delivery_schedule`,{query:e},r);return n}async function DR(r){return await O("get","/portal_access",{},r)}var BR=Object.freeze({__proto__:null,getCustomer:RR,updateCustomer:FR,getDeliverySchedule:MR,getCustomerPortalAccess:DR});const NR={get(r,e){return z("get",r,e)},post(r,e){return z("post",r,e)},put(r,e){return z("put",r,e)},delete(r,e){return z("delete",r,e)}};function UR(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 CR(r={}){const e=r;fp({storeIdentifier:UR(r.storeIdentifier),loginRetryFn:r.loginRetryFn,storefrontAccessToken:r.storefrontAccessToken,environment:e.environment?e.environment:"prod"}),nu()}const ef={init:CR,api:NR,address:Pp,auth:Bp,bundle:xI,charge:CI,cdn:d1,customer:BR,membership:GI,metafield:zI,onetime:QI,order:tP,paymentMethod:oP,plan:fP,subscription:xR};try{ef.init()}catch{}return ef});
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rechargeapps/storefront-client",
|
|
3
3
|
"description": "Storefront client for Recharge",
|
|
4
|
-
"version": "0.29.
|
|
5
|
-
"
|
|
4
|
+
"version": "0.29.2",
|
|
5
|
+
"author": "Recharge Inc.",
|
|
6
|
+
"license": "MIT",
|
|
6
7
|
"main": "dist/cjs/index.js",
|
|
7
8
|
"module": "dist/esm/index.js",
|
|
8
9
|
"types": "dist/index.d.ts",
|