@fantastic.dev/better-stripe 0.80.0 → 0.81.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/client/billing/renewalPriceReplacement.d.ts +2 -0
  4. package/dist/client/billing/renewalPriceReplacement.d.ts.map +1 -1
  5. package/dist/client/billing/renewalProjection/discounts.d.ts +20 -0
  6. package/dist/client/billing/renewalProjection/discounts.d.ts.map +1 -0
  7. package/dist/client/billing/renewalProjection/discounts.js +121 -0
  8. package/dist/client/billing/renewalProjection/discounts.js.map +1 -0
  9. package/dist/client/billing/renewalProjection/itemSettings.d.ts +14 -0
  10. package/dist/client/billing/renewalProjection/itemSettings.d.ts.map +1 -0
  11. package/dist/client/billing/renewalProjection/itemSettings.js +41 -0
  12. package/dist/client/billing/renewalProjection/itemSettings.js.map +1 -0
  13. package/dist/client/billing/renewalProjection/settings.d.ts +18 -0
  14. package/dist/client/billing/renewalProjection/settings.d.ts.map +1 -0
  15. package/dist/client/billing/renewalProjection/settings.js +132 -0
  16. package/dist/client/billing/renewalProjection/settings.js.map +1 -0
  17. package/dist/client/billing/renewalProjection/settingsSchema.d.ts +200 -0
  18. package/dist/client/billing/renewalProjection/settingsSchema.d.ts.map +1 -0
  19. package/dist/client/billing/renewalProjection/settingsSchema.js +150 -0
  20. package/dist/client/billing/renewalProjection/settingsSchema.js.map +1 -0
  21. package/dist/client/billing/renewalReplacementSchema.d.ts +2 -0
  22. package/dist/client/billing/renewalReplacementSchema.d.ts.map +1 -1
  23. package/dist/client/billing/renewalReplacementSchema.js +10 -4
  24. package/dist/client/billing/renewalReplacementSchema.js.map +1 -1
  25. package/docs/renewal-preservation-mappings.md +94 -0
  26. package/docs/renewal-price-replacements.md +5 -0
  27. package/package.json +1 -1
  28. package/src/client/billing/renewal-discount-projection.test.ts +207 -0
  29. package/src/client/billing/renewal-item-settings-projection.test.ts +79 -0
  30. package/src/client/billing/renewal-price-replacement.test.ts +46 -0
  31. package/src/client/billing/renewal-settings-projection.test.ts +300 -0
  32. package/src/client/billing/renewalProjection/discounts.ts +152 -0
  33. package/src/client/billing/renewalProjection/itemSettings.ts +55 -0
  34. package/src/client/billing/renewalProjection/settings.ts +163 -0
  35. package/src/client/billing/renewalProjection/settingsSchema.ts +154 -0
  36. package/src/client/billing/renewalReplacementSchema.ts +10 -4
package/CHANGELOG.md CHANGED
@@ -26,6 +26,12 @@
26
26
  - Remove internal tracker references from public documentation and add a
27
27
  regression check that prevents their reintroduction.
28
28
 
29
+ ## [0.81.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.80.0...v0.81.0) (2026-10-27)
30
+
31
+ ### Features
32
+
33
+ - **billing:** project preserved renewal billing settings ([349d56e](https://github.com/FantasticDevHQ/better-stripe/commit/349d56e3c001da239958762f6dbcb06d613ccade))
34
+
29
35
  ## [0.80.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.79.1...v0.80.0) (2026-10-27)
30
36
 
31
37
  ### Features
package/README.md CHANGED
@@ -5,7 +5,7 @@ billing, and Connect marketplaces. It provides checkout, subscriptions, webhook
5
5
  syncing, marketplace fees and splits, payouts, refunds, and disputes, with React
6
6
  hooks and headless UI components.
7
7
 
8
- **Version**: `0.80.0` <!-- x-release-please-version --> (pre-1.0). API may change between minor versions until 1.0.
8
+ **Version**: `0.81.0` <!-- x-release-please-version --> (pre-1.0). API may change between minor versions until 1.0.
9
9
 
10
10
  Connect platforms use the default GA API version. Non-Connect merchants using
11
11
  customer-only Accounts v2 need preview access and an explicit preview version.
@@ -67,6 +67,7 @@ export declare function prepareRenewalPriceReplacement(options: PrepareRenewalPr
67
67
  product: string | {
68
68
  [x: string]: unknown;
69
69
  id: string;
70
+ object: "product";
70
71
  deleted?: false | undefined;
71
72
  };
72
73
  active: boolean;
@@ -91,6 +92,7 @@ export declare function prepareRenewalPriceReplacement(options: PrepareRenewalPr
91
92
  product: string | {
92
93
  [x: string]: unknown;
93
94
  id: string;
95
+ object: "product";
94
96
  deleted?: false | undefined;
95
97
  };
96
98
  active: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"renewalPriceReplacement.d.ts","sourceRoot":"","sources":["../../../src/client/billing/renewalPriceReplacement.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,+BAA+B,EACrC,MAAM,+BAA+B,CAAC;AAGvC,MAAM,MAAM,qCAAqC,GAAG;IAClD,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,+BAA+B,CAAC;IAC1C,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,qCAAqC;aAkFnC,CAAC;WACH,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAOT,UAAU;kBACJ,8BAA8B;;;;;EAM/C;AAED,MAAM,MAAM,+BAA+B,GAAG,UAAU,CACtD,OAAO,8BAA8B,CACtC,CAAC"}
1
+ {"version":3,"file":"renewalPriceReplacement.d.ts","sourceRoot":"","sources":["../../../src/client/billing/renewalPriceReplacement.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,+BAA+B,EACrC,MAAM,+BAA+B,CAAC;AAGvC,MAAM,MAAM,qCAAqC,GAAG;IAClD,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,+BAA+B,CAAC;IAC1C,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,qCAAqC;aAkFnC,CAAC;WACH,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAOT,UAAU;kBACJ,8BAA8B;;;;;EAM/C;AAED,MAAM,MAAM,+BAA+B,GAAG,UAAU,CACtD,OAAO,8BAA8B,CACtC,CAAC"}
@@ -0,0 +1,20 @@
1
+ type Reason = "incomplete_discount_evidence" | "ambiguous_empty_discount_hierarchy" | "discount_not_owned_at_level" | "discount_duration_not_qualified" | "coupon_product_applicability" | "phase_redemption_mismatch" | "duplicate_redemptions";
2
+ export type RenewalDiscountProjection = {
3
+ status: "unsupported";
4
+ reason: Reason;
5
+ } | {
6
+ status: "projected";
7
+ discounts: {
8
+ discount: string;
9
+ }[];
10
+ requiresProviderQualification: true;
11
+ };
12
+ /**
13
+ * Project only a direct, unambiguous existing forever redemption. Ancestor-owned
14
+ * redemptions are unsupported. Phase references must be IDs or minimal reference
15
+ * objects; full expanded objects require separate normalization and correlation.
16
+ * This field projection requires provider qualification before writer eligibility.
17
+ */
18
+ export declare function projectRenewalDiscounts(input: unknown): RenewalDiscountProjection;
19
+ export {};
20
+ //# sourceMappingURL=discounts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discounts.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalProjection/discounts.ts"],"names":[],"mappings":"AAqEA,KAAK,MAAM,GACP,8BAA8B,GAC9B,oCAAoC,GACpC,6BAA6B,GAC7B,iCAAiC,GACjC,8BAA8B,GAC9B,2BAA2B,GAC3B,uBAAuB,CAAC;AAC5B,MAAM,MAAM,yBAAyB,GACjC;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzC;IACE,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAClC,6BAA6B,EAAE,IAAI,CAAC;CACrC,CAAC;AAEN;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,GACb,yBAAyB,CA0D3B"}
@@ -0,0 +1,121 @@
1
+ import { z } from "zod";
2
+ import { renewalSnapshot } from "../renewalReplacementSnapshot.js";
3
+ // Coupons and products may have caller-supplied IDs. Do not require a prefix.
4
+ const id = z.string().min(1).max(255).regex(/\S/);
5
+ const resourceId = (prefix) => z
6
+ .string()
7
+ .max(255)
8
+ .regex(new RegExp(`^${prefix}_[A-Za-z0-9_]+$`));
9
+ const coupon = z
10
+ .object({
11
+ id,
12
+ object: z.literal("coupon"),
13
+ deleted: z.literal(false).optional(),
14
+ duration: z.enum(["once", "repeating", "forever"]),
15
+ applies_to: z
16
+ .object({ products: z.array(id) })
17
+ .strict()
18
+ .optional(),
19
+ })
20
+ .passthrough();
21
+ const redemption = z
22
+ .object({
23
+ id: resourceId("di"),
24
+ object: z.literal("discount"),
25
+ deleted: z.literal(false).optional(),
26
+ customer_account: resourceId("acct"),
27
+ subscription: resourceId("sub").nullable(),
28
+ subscription_item: resourceId("si").nullable(),
29
+ start: z.number().int().nonnegative(),
30
+ end: z.number().int().nonnegative().nullable(),
31
+ source: z.object({ type: z.literal("coupon"), coupon }).passthrough(),
32
+ })
33
+ .passthrough();
34
+ const reference = (object, identity = id) => z.union([
35
+ identity,
36
+ z
37
+ .object({
38
+ id: identity,
39
+ object: z.literal(object),
40
+ deleted: z.literal(false).optional(),
41
+ })
42
+ .strict(),
43
+ ]);
44
+ const inputSchema = z
45
+ .object({
46
+ customerAccountId: resourceId("acct"),
47
+ subscriptionId: resourceId("sub"),
48
+ level: z.enum(["subscription", "subscription_item"]),
49
+ itemId: resourceId("si").optional(),
50
+ currentProductId: id,
51
+ targetProductId: id,
52
+ redemptions: z.array(redemption).max(20),
53
+ phaseDiscounts: z
54
+ .array(z
55
+ .object({
56
+ discount: reference("discount", resourceId("di")),
57
+ coupon: reference("coupon").nullable().optional(),
58
+ promotion_code: z.null().optional(),
59
+ })
60
+ .passthrough())
61
+ .max(20),
62
+ })
63
+ .strict();
64
+ /**
65
+ * Project only a direct, unambiguous existing forever redemption. Ancestor-owned
66
+ * redemptions are unsupported. Phase references must be IDs or minimal reference
67
+ * objects; full expanded objects require separate normalization and correlation.
68
+ * This field projection requires provider qualification before writer eligibility.
69
+ */
70
+ export function projectRenewalDiscounts(input) {
71
+ let parsed;
72
+ try {
73
+ parsed = inputSchema.safeParse(renewalSnapshot(input));
74
+ }
75
+ catch {
76
+ return { status: "unsupported", reason: "incomplete_discount_evidence" };
77
+ }
78
+ if (!parsed.success)
79
+ return { status: "unsupported", reason: "incomplete_discount_evidence" };
80
+ const args = parsed.data;
81
+ const unsupported = (reason) => ({
82
+ status: "unsupported",
83
+ reason,
84
+ });
85
+ if (args.redemptions.length === 0 && args.phaseDiscounts.length === 0)
86
+ return unsupported("ambiguous_empty_discount_hierarchy");
87
+ if (args.redemptions.length !== args.phaseDiscounts.length)
88
+ return unsupported("phase_redemption_mismatch");
89
+ if (new Set(args.redemptions.map((v) => v.id)).size !== args.redemptions.length)
90
+ return unsupported("duplicate_redemptions");
91
+ const refId = (value) => typeof value === "string" ? value : value.id;
92
+ for (const [index, value] of args.redemptions.entries()) {
93
+ if (value.customer_account !== args.customerAccountId ||
94
+ (args.level === "subscription" &&
95
+ (value.subscription !== args.subscriptionId ||
96
+ value.subscription_item !== null)) ||
97
+ (args.level === "subscription_item" &&
98
+ (!args.itemId ||
99
+ value.subscription_item !== args.itemId ||
100
+ (value.subscription !== null &&
101
+ value.subscription !== args.subscriptionId))))
102
+ return unsupported("discount_not_owned_at_level");
103
+ if (value.source.coupon.duration !== "forever" || value.end !== null)
104
+ return unsupported("discount_duration_not_qualified");
105
+ const products = value.source.coupon.applies_to?.products;
106
+ if (products &&
107
+ (!products.includes(args.currentProductId) ||
108
+ !products.includes(args.targetProductId)))
109
+ return unsupported("coupon_product_applicability");
110
+ const phase = args.phaseDiscounts[index];
111
+ if (refId(phase.discount) !== value.id ||
112
+ (phase.coupon != null && refId(phase.coupon) !== value.source.coupon.id))
113
+ return unsupported("phase_redemption_mismatch");
114
+ }
115
+ return {
116
+ status: "projected",
117
+ discounts: args.redemptions.map(({ id: discount }) => ({ discount })),
118
+ requiresProviderQualification: true,
119
+ };
120
+ }
121
+ //# sourceMappingURL=discounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discounts.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalProjection/discounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,8EAA8E;AAC9E,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAClD,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,EAAE,CACpC,CAAC;KACE,MAAM,EAAE;KACR,GAAG,CAAC,GAAG,CAAC;KACR,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,MAAM,iBAAiB,CAAC,CAAC,CAAC;AACpD,MAAM,MAAM,GAAG,CAAC;KACb,MAAM,CAAC;IACN,EAAE;IACF,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;IACpC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAClD,UAAU,EAAE,CAAC;SACV,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;SACjC,MAAM,EAAE;SACR,QAAQ,EAAE;CACd,CAAC;KACD,WAAW,EAAE,CAAC;A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,MAAM,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI;YAClE,OAAO,WAAW,CAAC,iCAAiC,CAAC,CAAC;QACxD,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC;QAC1D,IACE,QAAQ;YACR,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC;gBACxC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAE3C,OAAO,WAAW,CAAC,8BAA8B,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAE,CAAC;QAC1C,IACE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAC,EAAE;YAClC,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YAExE,OAAO,WAAW,CAAC,2BAA2B,CAAC,CAAC;IACpD,CAAC;IACD,OAAO;QACL,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QACrE,6BAA6B,EAAE,IAAI;KACpC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type Stripe from "stripe";
2
+ type Settings = Pick<Stripe.SubscriptionScheduleUpdateParams.Phase.Item, "tax_rates" | "metadata">;
3
+ type Result = {
4
+ status: "unsupported";
5
+ reason: string;
6
+ } | {
7
+ status: "projected";
8
+ settings: Settings;
9
+ requiresProviderQualification: true;
10
+ };
11
+ /** Field projection only. The assembler must derive effective tax from defaults. */
12
+ export declare function projectRenewalItemSettings(input: unknown): Result;
13
+ export {};
14
+ //# sourceMappingURL=itemSettings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"itemSettings.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalProjection/itemSettings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAoBjC,KAAK,QAAQ,GAAG,IAAI,CAClB,MAAM,CAAC,gCAAgC,CAAC,KAAK,CAAC,IAAI,EAClD,WAAW,GAAG,UAAU,CACzB,CAAC;AACF,KAAK,MAAM,GACP;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzC;IACE,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,6BAA6B,EAAE,IAAI,CAAC;CACrC,CAAC;AAEN,oFAAoF;AACpF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAqBjE"}
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ import { renewalSnapshot } from "../renewalReplacementSnapshot.js";
3
+ import { taxRate } from "./settingsSchema.js";
4
+ const inputSchema = z
5
+ .object({
6
+ effectiveAutomaticTax: z.boolean(),
7
+ livemode: z.boolean(),
8
+ settings: z
9
+ .object({
10
+ billing_thresholds: z.null(),
11
+ tax_rates: z.array(taxRate).max(20).nullable().optional(),
12
+ metadata: z
13
+ .record(z.string().max(40), z.string().min(1).max(500))
14
+ .nullable(),
15
+ })
16
+ .strict(),
17
+ })
18
+ .strict();
19
+ /** Field projection only. The assembler must derive effective tax from defaults. */
20
+ export function projectRenewalItemSettings(input) {
21
+ let args;
22
+ try {
23
+ args = inputSchema.parse(renewalSnapshot(input));
24
+ }
25
+ catch {
26
+ return { status: "unsupported", reason: "unsupported_item_settings" };
27
+ }
28
+ const { settings: source } = args;
29
+ if ((args.effectiveAutomaticTax && source.tax_rates?.length) ||
30
+ source.tax_rates?.some((tax) => tax.livemode !== args.livemode))
31
+ return { status: "unsupported", reason: "incompatible_item_tax" };
32
+ const settings = {};
33
+ if (source.tax_rates != null)
34
+ settings.tax_rates = source.tax_rates.length
35
+ ? source.tax_rates.map((tax) => tax.id)
36
+ : "";
37
+ if (source.metadata !== null && Object.keys(source.metadata).length)
38
+ settings.metadata = source.metadata;
39
+ return { status: "projected", settings, requiresProviderQualification: true };
40
+ }
41
+ //# sourceMappingURL=itemSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"itemSettings.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalProjection/itemSettings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC;IACN,qBAAqB,EAAE,CAAC,CAAC,OAAO,EAAE;IAClC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,QAAQ,EAAE,CAAC;SACR,MAAM,CAAC;QACN,kBAAkB,EAAE,CAAC,CAAC,IAAI,EAAE;QAC5B,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QACzD,QAAQ,EAAE,CAAC;aACR,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;aACtD,QAAQ,EAAE;KACd,CAAC;SACD,MAAM,EAAE;CACZ,CAAC;KACD,MAAM,EAAE,CAAC;AAaZ,oFAAoF;AACpF,MAAM,UAAU,0BAA0B,CAAC,KAAc;I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on_behalf_of" | "transfer_data" | "automatic_tax" | "default_tax_rates" | "invoice_settings" | "description" | "metadata">;
3
+ type Result = {
4
+ status: "unsupported";
5
+ reason: string;
6
+ } | {
7
+ status: "projected";
8
+ settings: Settings;
9
+ requiresProviderQualification: true;
10
+ };
11
+ /**
12
+ * Map only the named fields of a provider phase. The aggregate assembler must
13
+ * correlate context with its full acknowledged schedule and unchanged defaults.
14
+ * A projection is neither a complete phase nor evidence of provider retention.
15
+ */
16
+ export declare function projectRenewalPhaseSettings(input: unknown): Result;
17
+ export {};
18
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalProjection/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAKjC,KAAK,QAAQ,GAAG,IAAI,CAClB,MAAM,CAAC,gCAAgC,CAAC,KAAK,EAC3C,mBAAmB,GACnB,wBAAwB,GACxB,cAAc,GACd,eAAe,GACf,eAAe,GACf,mBAAmB,GACnB,kBAAkB,GAClB,aAAa,GACb,UAAU,CACb,CAAC;AACF,KAAK,MAAM,GACP;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzC;IACE,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,6BAA6B,EAAE,IAAI,CAAC;CACrC,CAAC;AAIN;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAkIlE"}
@@ -0,0 +1,132 @@
1
+ import { renewalSnapshot } from "../renewalReplacementSnapshot.js";
2
+ import { settingsInput } from "./settingsSchema.js";
3
+ const identity = (ref) => (typeof ref === "string" ? ref : ref.id);
4
+ /**
5
+ * Map only the named fields of a provider phase. The aggregate assembler must
6
+ * correlate context with its full acknowledged schedule and unchanged defaults.
7
+ * A projection is neither a complete phase nor evidence of provider retention.
8
+ */
9
+ export function projectRenewalPhaseSettings(input) {
10
+ let args;
11
+ try {
12
+ args = settingsInput.parse(renewalSnapshot(input));
13
+ }
14
+ catch {
15
+ return { status: "unsupported", reason: "unsupported_phase_settings" };
16
+ }
17
+ const { settings: source, context } = args;
18
+ const failure = (reason) => ({
19
+ status: "unsupported",
20
+ reason,
21
+ });
22
+ const referenceMatches = (ref) => {
23
+ if (ref == null || typeof ref === "string")
24
+ return true;
25
+ const customer = ref.customer;
26
+ if (typeof customer === "object" &&
27
+ customer !== null &&
28
+ ((customer.livemode !== undefined &&
29
+ customer.livemode !== context.livemode) ||
30
+ (customer.customer_account !== undefined &&
31
+ customer.customer_account !== context.customerAccountId)))
32
+ return false;
33
+ return ((ref.livemode === undefined || ref.livemode === context.livemode) &&
34
+ (ref.customer_account == null ||
35
+ ref.customer_account === context.customerAccountId) &&
36
+ (customer == null || identity(customer) === context.customerId));
37
+ };
38
+ const references = [
39
+ source.default_payment_method,
40
+ source.on_behalf_of,
41
+ source.transfer_data?.destination,
42
+ ...(source.invoice_settings?.account_tax_ids ?? []),
43
+ ...(source.default_tax_rates ?? []),
44
+ source.automatic_tax?.liability?.account,
45
+ source.invoice_settings?.issuer?.account,
46
+ ];
47
+ if (!references.every(referenceMatches))
48
+ return failure("foreign_setting_reference");
49
+ const issuerIdentity = (issuer) => issuer.type === "self" ? "self" : identity(issuer.account);
50
+ if (source.invoice_settings?.issuer != null &&
51
+ issuerIdentity(source.invoice_settings.issuer) !==
52
+ issuerIdentity(context.effectiveInvoiceIssuer))
53
+ return failure("invoice_issuer_mismatch");
54
+ for (const taxId of source.invoice_settings?.account_tax_ids ?? []) {
55
+ if (typeof taxId === "string")
56
+ continue;
57
+ const owner = taxId.owner;
58
+ if (issuerIdentity(owner) !==
59
+ issuerIdentity(context.effectiveInvoiceIssuer) ||
60
+ (owner.type === "account" && !referenceMatches(owner.account)))
61
+ return failure("foreign_invoice_tax_owner");
62
+ }
63
+ if (source.collection_method != null &&
64
+ source.collection_method !== context.effectiveCollectionMethod)
65
+ return failure("collection_method_mismatch");
66
+ if (source.automatic_tax !== undefined &&
67
+ source.automatic_tax.enabled !== context.effectiveAutomaticTax)
68
+ return failure("automatic_tax_mismatch");
69
+ if (context.effectiveAutomaticTax && source.default_tax_rates?.length)
70
+ return failure("automatic_and_manual_tax");
71
+ const out = {};
72
+ if (source.collection_method !== null)
73
+ out.collection_method = source.collection_method;
74
+ if (source.default_payment_method !== null)
75
+ out.default_payment_method = identity(source.default_payment_method);
76
+ if (source.on_behalf_of !== null)
77
+ out.on_behalf_of = identity(source.on_behalf_of);
78
+ if (source.transfer_data !== null) {
79
+ out.transfer_data = {
80
+ destination: identity(source.transfer_data.destination),
81
+ };
82
+ if (source.transfer_data.amount_percent !== null)
83
+ out.transfer_data.amount_percent = source.transfer_data.amount_percent;
84
+ }
85
+ const mapIssuer = (issuer) => issuer?.type === "account"
86
+ ? { type: "account", account: identity(issuer.account) }
87
+ : { type: "self" };
88
+ if (source.automatic_tax !== undefined) {
89
+ out.automatic_tax = { enabled: source.automatic_tax.enabled };
90
+ if (source.automatic_tax.liability != null)
91
+ out.automatic_tax.liability = mapIssuer(source.automatic_tax.liability);
92
+ }
93
+ if (source.default_tax_rates != null)
94
+ out.default_tax_rates = source.default_tax_rates.length
95
+ ? source.default_tax_rates.map(identity)
96
+ : "";
97
+ const invoice = source.invoice_settings;
98
+ if (invoice !== null) {
99
+ const mapped = {};
100
+ if (invoice.account_tax_ids !== null)
101
+ mapped.account_tax_ids = invoice.account_tax_ids.length
102
+ ? invoice.account_tax_ids.map(identity)
103
+ : "";
104
+ if (invoice.custom_fields !== null)
105
+ mapped.custom_fields = invoice.custom_fields.length
106
+ ? invoice.custom_fields.map(({ name, value }) => ({ name, value }))
107
+ : "";
108
+ if (invoice.issuer !== null)
109
+ mapped.issuer = mapIssuer(invoice.issuer);
110
+ if (invoice.days_until_due !== null) {
111
+ if (context.effectiveCollectionMethod !== "send_invoice")
112
+ return failure("incompatible_invoice_due_days");
113
+ mapped.days_until_due = invoice.days_until_due;
114
+ }
115
+ if (invoice.description !== null)
116
+ mapped.description = invoice.description;
117
+ if (invoice.footer !== null)
118
+ mapped.footer = invoice.footer;
119
+ if (Object.keys(mapped).length)
120
+ out.invoice_settings = mapped;
121
+ }
122
+ if (source.description !== null)
123
+ out.description = source.description;
124
+ if (source.metadata !== null && Object.keys(source.metadata).length)
125
+ out.metadata = source.metadata;
126
+ return {
127
+ status: "projected",
128
+ settings: out,
129
+ requiresProviderQualification: true,
130
+ };
131
+ }
132
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalProjection/settings.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAkB,MAAM,qBAAqB,CAAC;AAsBpE,MAAM,QAAQ,GAAG,CAAC,GAAc,EAAE,EAAE,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAE9E;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,KAAc;IACxD,IAAI,IAAmC,CAAC;IACxC,IAAI,CAAC;QACH,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IACrD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,4BAA4B,EAAE,CAAC;IACzE,CAAC;IACD,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC3C,MAAM,OAAO,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,CAAC;QAC3C,MAAM,EAAE,aAAa;QACrB,MAAM;KACP,CAAC,CAAC;IACH,MAAM,gBAAgB,G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,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QAC3E,IAAI,OAAO,CAAC,MAAM,KAAK,IAAI;YAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5D,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM;YAAE,GAAG,CAAC,gBAAgB,GAAG,MAAM,CAAC;IAChE,CAAC;IACD,IAAI,MAAM,CAAC,WAAW,KAAK,IAAI;QAAE,GAAG,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IACtE,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM;QACjE,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACjC,OAAO;QACL,MAAM,EAAE,WAAW;QACnB,QAAQ,EAAE,GAAG;QACb,6BAA6B,EAAE,IAAI;KACpC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,200 @@
1
+ import { z } from "zod";
2
+ export declare const reference: (prefix: string, object: string) => z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
3
+ id: z.ZodString;
4
+ object: z.ZodLiteral<string>;
5
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
6
+ livemode: z.ZodOptional<z.ZodBoolean>;
7
+ customer: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
8
+ id: z.ZodString;
9
+ object: z.ZodLiteral<"customer">;
10
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
11
+ livemode: z.ZodOptional<z.ZodBoolean>;
12
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
+ }, z.core.$loose>]>>>;
14
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ }, z.core.$loose>]>;
16
+ export declare const taxRate: z.ZodObject<{
17
+ id: z.ZodString;
18
+ object: z.ZodLiteral<"tax_rate">;
19
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
20
+ livemode: z.ZodBoolean;
21
+ }, z.core.$loose>;
22
+ export declare const settingsInput: z.ZodObject<{
23
+ context: z.ZodObject<{
24
+ customerAccountId: z.ZodString;
25
+ customerId: z.ZodString;
26
+ livemode: z.ZodBoolean;
27
+ effectiveCollectionMethod: z.ZodEnum<{
28
+ charge_automatically: "charge_automatically";
29
+ send_invoice: "send_invoice";
30
+ }>;
31
+ effectiveAutomaticTax: z.ZodBoolean;
32
+ effectiveInvoiceIssuer: z.ZodDiscriminatedUnion<[z.ZodObject<{
33
+ type: z.ZodLiteral<"self">;
34
+ account: z.ZodOptional<z.ZodNull>;
35
+ }, z.core.$strict>, z.ZodObject<{
36
+ type: z.ZodLiteral<"account">;
37
+ account: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
38
+ id: z.ZodString;
39
+ object: z.ZodLiteral<string>;
40
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
41
+ livemode: z.ZodOptional<z.ZodBoolean>;
42
+ customer: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
43
+ id: z.ZodString;
44
+ object: z.ZodLiteral<"customer">;
45
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
46
+ livemode: z.ZodOptional<z.ZodBoolean>;
47
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
+ }, z.core.$loose>]>>>;
49
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ }, z.core.$loose>]>;
51
+ }, z.core.$strict>], "type">;
52
+ }, z.core.$strict>;
53
+ settings: z.ZodObject<{
54
+ application_fee_percent: z.ZodNull;
55
+ billing_thresholds: z.ZodNull;
56
+ collection_method: z.ZodNullable<z.ZodEnum<{
57
+ charge_automatically: "charge_automatically";
58
+ send_invoice: "send_invoice";
59
+ }>>;
60
+ default_payment_method: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
61
+ id: z.ZodString;
62
+ object: z.ZodLiteral<string>;
63
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
64
+ livemode: z.ZodOptional<z.ZodBoolean>;
65
+ customer: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
66
+ id: z.ZodString;
67
+ object: z.ZodLiteral<"customer">;
68
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
69
+ livemode: z.ZodOptional<z.ZodBoolean>;
70
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
+ }, z.core.$loose>]>>>;
72
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
+ }, z.core.$loose>]>>;
74
+ on_behalf_of: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
75
+ id: z.ZodString;
76
+ object: z.ZodLiteral<string>;
77
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
78
+ livemode: z.ZodOptional<z.ZodBoolean>;
79
+ customer: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
80
+ id: z.ZodString;
81
+ object: z.ZodLiteral<"customer">;
82
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
83
+ livemode: z.ZodOptional<z.ZodBoolean>;
84
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
85
+ }, z.core.$loose>]>>>;
86
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
+ }, z.core.$loose>]>>;
88
+ transfer_data: z.ZodNullable<z.ZodObject<{
89
+ destination: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
90
+ id: z.ZodString;
91
+ object: z.ZodLiteral<string>;
92
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
93
+ livemode: z.ZodOptional<z.ZodBoolean>;
94
+ customer: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
95
+ id: z.ZodString;
96
+ object: z.ZodLiteral<"customer">;
97
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
98
+ livemode: z.ZodOptional<z.ZodBoolean>;
99
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
100
+ }, z.core.$loose>]>>>;
101
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
102
+ }, z.core.$loose>]>;
103
+ amount_percent: z.ZodNullable<z.ZodNumber>;
104
+ }, z.core.$strict>>;
105
+ automatic_tax: z.ZodOptional<z.ZodObject<{
106
+ enabled: z.ZodBoolean;
107
+ liability: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
108
+ type: z.ZodLiteral<"self">;
109
+ account: z.ZodOptional<z.ZodNull>;
110
+ }, z.core.$strict>, z.ZodObject<{
111
+ type: z.ZodLiteral<"account">;
112
+ account: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
113
+ id: z.ZodString;
114
+ object: z.ZodLiteral<string>;
115
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
116
+ livemode: z.ZodOptional<z.ZodBoolean>;
117
+ customer: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
118
+ id: z.ZodString;
119
+ object: z.ZodLiteral<"customer">;
120
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
121
+ livemode: z.ZodOptional<z.ZodBoolean>;
122
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
123
+ }, z.core.$loose>]>>>;
124
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
125
+ }, z.core.$loose>]>;
126
+ }, z.core.$strict>], "type">>>;
127
+ disabled_reason: z.ZodOptional<z.ZodNull>;
128
+ }, z.core.$strict>>;
129
+ default_tax_rates: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
130
+ id: z.ZodString;
131
+ object: z.ZodLiteral<"tax_rate">;
132
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
133
+ livemode: z.ZodBoolean;
134
+ }, z.core.$loose>>>>;
135
+ invoice_settings: z.ZodNullable<z.ZodObject<{
136
+ account_tax_ids: z.ZodNullable<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
137
+ id: z.ZodString;
138
+ object: z.ZodLiteral<"tax_id">;
139
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
140
+ livemode: z.ZodBoolean;
141
+ customer: z.ZodOptional<z.ZodNull>;
142
+ customer_account: z.ZodOptional<z.ZodNull>;
143
+ owner: z.ZodDiscriminatedUnion<[z.ZodObject<{
144
+ type: z.ZodLiteral<"self">;
145
+ customer_account: z.ZodNull;
146
+ account: z.ZodOptional<z.ZodNull>;
147
+ customer: z.ZodOptional<z.ZodNull>;
148
+ }, z.core.$strict>, z.ZodObject<{
149
+ type: z.ZodLiteral<"account">;
150
+ account: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
151
+ id: z.ZodString;
152
+ object: z.ZodLiteral<string>;
153
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
154
+ livemode: z.ZodOptional<z.ZodBoolean>;
155
+ customer: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
156
+ id: z.ZodString;
157
+ object: z.ZodLiteral<"customer">;
158
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
159
+ livemode: z.ZodOptional<z.ZodBoolean>;
160
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
161
+ }, z.core.$loose>]>>>;
162
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
163
+ }, z.core.$loose>]>;
164
+ customer_account: z.ZodNull;
165
+ customer: z.ZodOptional<z.ZodNull>;
166
+ }, z.core.$strict>], "type">;
167
+ }, z.core.$loose>]>>>;
168
+ custom_fields: z.ZodNullable<z.ZodArray<z.ZodObject<{
169
+ name: z.ZodString;
170
+ value: z.ZodString;
171
+ }, z.core.$strict>>>;
172
+ days_until_due: z.ZodNullable<z.ZodNumber>;
173
+ description: z.ZodNullable<z.ZodString>;
174
+ footer: z.ZodNullable<z.ZodString>;
175
+ issuer: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
176
+ type: z.ZodLiteral<"self">;
177
+ account: z.ZodOptional<z.ZodNull>;
178
+ }, z.core.$strict>, z.ZodObject<{
179
+ type: z.ZodLiteral<"account">;
180
+ account: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
181
+ id: z.ZodString;
182
+ object: z.ZodLiteral<string>;
183
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
184
+ livemode: z.ZodOptional<z.ZodBoolean>;
185
+ customer: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
186
+ id: z.ZodString;
187
+ object: z.ZodLiteral<"customer">;
188
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
189
+ livemode: z.ZodOptional<z.ZodBoolean>;
190
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
191
+ }, z.core.$loose>]>>>;
192
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
193
+ }, z.core.$loose>]>;
194
+ }, z.core.$strict>], "type">>;
195
+ }, z.core.$strict>>;
196
+ description: z.ZodNullable<z.ZodString>;
197
+ metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
198
+ }, z.core.$strict>;
199
+ }, z.core.$strict>;
200
+ //# sourceMappingURL=settingsSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settingsSchema.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalProjection/settingsSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,SAAS,WAAY,MAAM,UAAU,MAAM;;;;;;;;;;;;;mBA2BpD,CAAC;AAqCL,eAAO,MAAM,OAAO;;;;;iBAOJ,CAAC;AAEjB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAyEf,CAAC"}