atmn 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -43674,6 +43674,7 @@ async function startOAuthFlow(clientId, options) {
43674
43674
  return { html: getErrorHtml(msg), error: new Error(msg) };
43675
43675
  }
43676
43676
  }, () => {
43677
+ options?.onUrl?.(authUrl.toString());
43677
43678
  if (options?.headless) {
43678
43679
  console.log(`
43679
43680
  Visit this URL to authenticate:
@@ -43776,7 +43777,7 @@ async function request(options) {
43776
43777
  requestInit.body = JSON.stringify(body);
43777
43778
  }
43778
43779
  try {
43779
- if (process.env.ATMN_DEBUG) {
43780
+ if (process.env["ATMN_DEBUG"]) {
43780
43781
  console.log(`[DEBUG] ${method} ${url.toString()}`);
43781
43782
  }
43782
43783
  const response = await fetch(url.toString(), requestInit);
@@ -43992,6 +43993,20 @@ async function getPlanDeletionInfo(options) {
43992
43993
  secretKey
43993
43994
  });
43994
43995
  }
43996
+ async function migrateProduct(options) {
43997
+ const { secretKey, fromProductId, fromVersion, toProductId, toVersion } = options;
43998
+ await request({
43999
+ method: "POST",
44000
+ path: "/v1/migrations",
44001
+ secretKey,
44002
+ body: {
44003
+ from_product_id: fromProductId,
44004
+ from_version: fromVersion,
44005
+ to_product_id: toProductId,
44006
+ to_version: toVersion
44007
+ }
44008
+ });
44009
+ }
43995
44010
  async function getPlanHasCustomers(options) {
43996
44011
  const { secretKey, planId, plan } = options;
43997
44012
  return await request({
@@ -44160,7 +44175,7 @@ function validateCustomerLimit(customerCount, maxCustomers = 50) {
44160
44175
  }
44161
44176
  }
44162
44177
  function getMaxCustomers() {
44163
- const envValue = process.env.ATMN_NUKE_MAX_CUSTOMERS;
44178
+ const envValue = process.env["ATMN_NUKE_MAX_CUSTOMERS"];
44164
44179
  if (envValue) {
44165
44180
  const parsed = parseInt(envValue, 10);
44166
44181
  if (!Number.isNaN(parsed) && parsed > 0) {
@@ -44378,19 +44393,19 @@ async function fetchEvents(options) {
44378
44393
  } = options;
44379
44394
  const body = {};
44380
44395
  if (customerId !== undefined) {
44381
- body.customer_id = customerId;
44396
+ body["customer_id"] = customerId;
44382
44397
  }
44383
44398
  if (featureId !== undefined) {
44384
- body.feature_id = featureId;
44399
+ body["feature_id"] = featureId;
44385
44400
  }
44386
44401
  if (customRange !== undefined) {
44387
- body.custom_range = customRange;
44402
+ body["custom_range"] = customRange;
44388
44403
  }
44389
44404
  if (offset !== undefined) {
44390
- body.offset = offset;
44405
+ body["offset"] = offset;
44391
44406
  }
44392
44407
  if (limit !== undefined) {
44393
- body.limit = limit;
44408
+ body["limit"] = limit;
44394
44409
  }
44395
44410
  return request({
44396
44411
  method: "POST",
@@ -44414,16 +44429,16 @@ async function fetchEventsAggregate(options) {
44414
44429
  feature_id: featureId
44415
44430
  };
44416
44431
  if (range !== undefined) {
44417
- body.range = range;
44432
+ body["range"] = range;
44418
44433
  }
44419
44434
  if (binSize !== undefined) {
44420
- body.bin_size = binSize;
44435
+ body["bin_size"] = binSize;
44421
44436
  }
44422
44437
  if (groupBy !== undefined && groupBy !== "") {
44423
- body.group_by = groupBy;
44438
+ body["group_by"] = groupBy;
44424
44439
  }
44425
44440
  if (customRange !== undefined) {
44426
- body.custom_range = customRange;
44441
+ body["custom_range"] = customRange;
44427
44442
  }
44428
44443
  return request({
44429
44444
  method: "POST",
@@ -44438,10 +44453,10 @@ var init_events = __esm(() => {
44438
44453
 
44439
44454
  // src/lib/api/endpoints/index.ts
44440
44455
  var init_endpoints = __esm(() => {
44456
+ init_events();
44441
44457
  init_features();
44442
44458
  init_organization();
44443
44459
  init_plans();
44444
- init_events();
44445
44460
  });
44446
44461
 
44447
44462
  // src/lib/transforms/apiToSdk/Transformer.ts
@@ -44554,67 +44569,86 @@ function createTransformer(config) {
44554
44569
  }
44555
44570
 
44556
44571
  // src/lib/transforms/apiToSdk/feature.ts
44572
+ function mapCreditSchema(api) {
44573
+ return (api.credit_schema ?? []).map((cs) => ({
44574
+ meteredFeatureId: cs.metered_feature_id,
44575
+ creditCost: cs.credit_cost
44576
+ }));
44577
+ }
44557
44578
  function transformApiFeature(apiFeature) {
44558
44579
  return featureTransformer.transform(apiFeature);
44559
44580
  }
44560
- var featureTransformer;
44581
+ var BASE_COMPUTE, featureTransformer;
44561
44582
  var init_feature = __esm(() => {
44583
+ BASE_COMPUTE = {
44584
+ eventNames: (api) => api.event_names && api.event_names.length > 0 ? api.event_names : undefined
44585
+ };
44562
44586
  featureTransformer = createTransformer({
44563
44587
  discriminator: "type",
44564
44588
  cases: {
44565
44589
  boolean: {
44566
- copy: ["id", "name", "event_names", "credit_schema", "archived"],
44590
+ copy: ["id", "name", "archived"],
44567
44591
  compute: {
44592
+ ...BASE_COMPUTE,
44568
44593
  type: () => "boolean"
44569
44594
  }
44570
44595
  },
44571
44596
  credit_system: {
44572
- copy: ["id", "name", "event_names", "credit_schema", "archived"],
44597
+ copy: ["id", "name", "archived"],
44573
44598
  compute: {
44599
+ ...BASE_COMPUTE,
44574
44600
  type: () => "credit_system",
44575
44601
  consumable: () => true,
44576
- credit_schema: (api) => api.credit_schema || []
44602
+ creditSchema: mapCreditSchema
44577
44603
  }
44578
44604
  },
44579
44605
  single_use: {
44580
- copy: ["id", "name", "event_names", "credit_schema", "archived"],
44606
+ copy: ["id", "name", "archived"],
44581
44607
  compute: {
44608
+ ...BASE_COMPUTE,
44582
44609
  type: () => "metered",
44583
44610
  consumable: () => true
44584
44611
  }
44585
44612
  },
44586
44613
  continuous_use: {
44587
- copy: ["id", "name", "event_names", "credit_schema", "archived"],
44614
+ copy: ["id", "name", "archived"],
44588
44615
  compute: {
44616
+ ...BASE_COMPUTE,
44589
44617
  type: () => "metered",
44590
44618
  consumable: () => false
44591
44619
  }
44592
44620
  },
44593
44621
  metered: {
44594
- copy: ["id", "name", "event_names", "credit_schema", "archived"],
44622
+ copy: ["id", "name", "archived"],
44595
44623
  compute: {
44624
+ ...BASE_COMPUTE,
44596
44625
  type: () => "metered",
44597
44626
  consumable: (api) => api.consumable ?? true
44598
44627
  }
44599
44628
  }
44600
44629
  },
44601
44630
  default: {
44602
- copy: ["id", "name", "event_names", "credit_schema", "archived"],
44631
+ copy: ["id", "name", "archived"],
44603
44632
  compute: {
44633
+ ...BASE_COMPUTE,
44604
44634
  type: () => "metered",
44605
44635
  consumable: () => true
44606
44636
  }
44607
44637
  }
44608
44638
  });
44609
44639
  });
44610
- // src/lib/transforms/apiToSdk/planFeature.ts
44611
- function transformApiPlanFeature(apiPlanFeature) {
44612
- return planFeatureTransformer.transform(apiPlanFeature);
44640
+ // src/lib/transforms/apiToSdk/planItem.ts
44641
+ function transformApiPlanItem(apiPlanItem) {
44642
+ return planItemTransformer.transform(apiPlanItem);
44613
44643
  }
44614
- var planFeatureTransformer;
44615
- var init_planFeature = __esm(() => {
44616
- planFeatureTransformer = createTransformer({
44617
- copy: ["feature_id", "unlimited", "proration"],
44644
+ var planItemTransformer;
44645
+ var init_planItem = __esm(() => {
44646
+ planItemTransformer = createTransformer({
44647
+ rename: {
44648
+ feature_id: "featureId",
44649
+ entity_feature_id: "entityFeatureId"
44650
+ },
44651
+ copy: ["unlimited"],
44618
44652
  swapFalse: ["unlimited"],
44619
44653
  compute: {
44620
44654
  included: (api) => api.unlimited ? undefined : api.included,
@@ -44625,7 +44659,9 @@ var init_planFeature = __esm(() => {
44625
44659
  if (api.reset) {
44626
44660
  return {
44627
44661
  interval: api.reset.interval,
44628
- interval_count: api.reset.interval_count
44662
+ ...api.reset.interval_count !== undefined && {
44663
+ intervalCount: api.reset.interval_count
44664
+ }
44629
44665
  };
44630
44666
  }
44631
44667
  return;
@@ -44636,16 +44672,26 @@ var init_planFeature = __esm(() => {
44636
44672
  return {
44637
44673
  amount: api.price.amount,
44638
44674
  tiers: api.price.tiers,
44639
- billing_units: api.price.billing_units,
44640
- max_purchase: api.price.max_purchase ?? undefined,
44641
- billing_method: api.price.billing_method,
44675
+ billingUnits: api.price.billing_units,
44676
+ maxPurchase: api.price.max_purchase ?? undefined,
44677
+ billingMethod: api.price.billing_method,
44678
+ tierBehaviour: api.price.tier_behaviour,
44642
44679
  interval: api.price.interval,
44643
- interval_count: api.price.interval_count
44680
+ ...api.price.interval_count !== undefined && {
44681
+ intervalCount: api.price.interval_count
44682
+ }
44644
44683
  };
44645
44684
  },
44685
+ proration: (api) => api.proration ? {
44686
+ onIncrease: api.proration.on_increase,
44687
+ onDecrease: api.proration.on_decrease
44688
+ } : undefined,
44646
44689
  rollover: (api) => api.rollover ? {
44647
- ...api.rollover,
44648
- max: api.rollover.max ?? 0
44690
+ max: api.rollover.max ?? 0,
44691
+ expiryDurationType: api.rollover.expiry_duration_type,
44692
+ ...api.rollover.expiry_duration_length !== undefined && {
44693
+ expiryDurationLength: api.rollover.expiry_duration_length
44694
+ }
44649
44695
  } : undefined
44650
44696
  }
44651
44697
  });
@@ -44657,9 +44703,13 @@ function transformApiPlan(apiPlan) {
44657
44703
  }
44658
44704
  var planTransformer;
44659
44705
  var init_plan = __esm(() => {
44660
- init_planFeature();
44706
+ init_planItem();
44661
44707
  planTransformer = createTransformer({
44662
- copy: ["id", "name", "description", "group", "add_on", "auto_enable", "free_trial"],
44708
+ copy: ["id", "name", "description", "group"],
44709
+ rename: {
44710
+ add_on: "addOn",
44711
+ auto_enable: "autoEnable"
44712
+ },
44663
44713
  swapNullish: ["group"],
44664
44714
  swapFalse: ["auto_enable", "add_on"],
44665
44715
  compute: {
@@ -44667,7 +44717,12 @@ var init_plan = __esm(() => {
44667
44717
  amount: api.price.amount,
44668
44718
  interval: api.price.interval
44669
44719
  } : undefined,
44670
- items: (api) => api.items && api.items.length > 0 ? api.items.map(transformApiPlanFeature) : undefined
44720
+ items: (api) => api.items && api.items.length > 0 ? api.items.map(transformApiPlanItem) : undefined,
44721
+ freeTrial: (api) => api.free_trial ? {
44722
+ durationLength: api.free_trial.duration_length,
44723
+ durationType: api.free_trial.duration_type,
44724
+ cardRequired: api.free_trial.card_required
44725
+ } : undefined
44671
44726
  }
44672
44727
  });
44673
44728
  });
@@ -44676,7 +44731,7 @@ var init_plan = __esm(() => {
44676
44731
  var init_apiToSdk = __esm(() => {
44677
44732
  init_feature();
44678
44733
  init_plan();
44679
- init_planFeature();
44734
+ init_planItem();
44680
44735
  });
44681
44736
 
44682
44737
  // src/lib/transforms/inPlaceUpdate/parseConfig.ts
@@ -44685,11 +44740,11 @@ function extractId(lines) {
44685
44740
  const joined = lines.join(`
44686
44741
  `);
44687
44742
  const match = joined.match(/id:\s*['"]([^'"]+)['"]/);
44688
- return match ? match[1] : null;
44743
+ return match ? match[1] ?? null : null;
44689
44744
  }
44690
44745
  function extractVarName(line) {
44691
44746
  const match = line.match(/export\s+const\s+(\w+)\s*=/);
44692
- return match ? match[1] : null;
44747
+ return match ? match[1] ?? null : null;
44693
44748
  }
44694
44749
  function determineEntityType(lines) {
44695
44750
  const joined = lines.join(`
@@ -44888,14 +44943,14 @@ function buildFeatureCode(feature) {
44888
44943
  if (feature.type === "metered") {
44889
44944
  lines.push(` consumable: ${feature.consumable},`);
44890
44945
  }
44891
- if (feature.event_names && feature.event_names.length > 0) {
44892
- lines.push(` event_names: ${formatValue(feature.event_names)},`);
44946
+ if (feature.eventNames && feature.eventNames.length > 0) {
44947
+ lines.push(` eventNames: ${formatValue(feature.eventNames)},`);
44893
44948
  }
44894
44949
  if (feature.archived) {
44895
44950
  lines.push(` archived: true,`);
44896
44951
  }
44897
- if (feature.type === "credit_system" && feature.credit_schema) {
44898
- lines.push(` credit_schema: ${formatValue(feature.credit_schema)},`);
44952
+ if (feature.type === "credit_system" && feature.creditSchema) {
44953
+ lines.push(` creditSchema: ${formatValue(feature.creditSchema)},`);
44899
44954
  }
44900
44955
  lines.push(`});`);
44901
44956
  return lines.join(`
@@ -44905,70 +44960,74 @@ var init_feature2 = () => {};
44905
44960
 
44906
44961
  // src/lib/transforms/sdkToCode/imports.ts
44907
44962
  function buildImports() {
44908
- return `import { feature, plan, planFeature } from 'atmn';`;
44963
+ return `import { feature, item, plan } from 'atmn';`;
44909
44964
  }
44910
44965
 
44911
- // src/lib/transforms/sdkToCode/planFeature.ts
44912
- function buildPlanFeatureCode(planFeature, _features, featureVarMap) {
44913
- const featureVarName = featureVarMap?.get(planFeature.feature_id);
44914
- const featureIdCode = featureVarName ? `${featureVarName}.id` : `'${planFeature.feature_id}'`;
44966
+ // src/lib/transforms/sdkToCode/planItem.ts
44967
+ function buildPlanItemCode(planItem, _features, featureVarMap) {
44968
+ const featureVarName = featureVarMap?.get(planItem.featureId);
44969
+ const featureIdCode = featureVarName ? `${featureVarName}.id` : `'${planItem.featureId}'`;
44915
44970
  const lines = [];
44916
- lines.push(` planFeature({`);
44917
- lines.push(` feature_id: ${featureIdCode},`);
44918
- if (planFeature.included !== undefined) {
44919
- lines.push(` included: ${planFeature.included},`);
44971
+ lines.push(` item({`);
44972
+ lines.push(` featureId: ${featureIdCode},`);
44973
+ if (planItem.included !== undefined) {
44974
+ lines.push(` included: ${planItem.included},`);
44920
44975
  }
44921
- if (planFeature.unlimited === true) {
44976
+ if (planItem.unlimited === true) {
44922
44977
  lines.push(` unlimited: true,`);
44923
44978
  }
44924
- if (planFeature.reset) {
44979
+ if (planItem.reset) {
44925
44980
  lines.push(` reset: {`);
44926
- if (planFeature.reset.interval) {
44927
- lines.push(` interval: '${planFeature.reset.interval}',`);
44981
+ if (planItem.reset.interval) {
44982
+ lines.push(` interval: '${planItem.reset.interval}',`);
44928
44983
  }
44929
- if (planFeature.reset.interval_count !== undefined) {
44930
- lines.push(` interval_count: ${planFeature.reset.interval_count},`);
44984
+ if (planItem.reset.intervalCount !== undefined) {
44985
+ lines.push(` intervalCount: ${planItem.reset.intervalCount},`);
44931
44986
  }
44932
44987
  lines.push(` },`);
44933
44988
  }
44934
- if (planFeature.price) {
44989
+ if (planItem.price) {
44935
44990
  lines.push(` price: {`);
44936
- if (planFeature.price.amount !== undefined) {
44937
- lines.push(` amount: ${planFeature.price.amount},`);
44991
+ if (planItem.price.amount !== undefined) {
44992
+ lines.push(` amount: ${planItem.price.amount},`);
44938
44993
  }
44939
- if (planFeature.price.tiers) {
44940
- const tiersCode = formatValue(planFeature.price.tiers);
44994
+ if (planItem.price.tiers) {
44995
+ const tiersCode = formatValue(planItem.price.tiers);
44941
44996
  lines.push(` tiers: ${tiersCode},`);
44942
44997
  }
44943
- if (planFeature.price.billing_units !== undefined) {
44944
- lines.push(` billing_units: ${planFeature.price.billing_units},`);
44998
+ const priceWithBilling = planItem.price;
44999
+ if (priceWithBilling.billingUnits !== undefined) {
45000
+ lines.push(` billingUnits: ${priceWithBilling.billingUnits},`);
45001
+ }
45002
+ if (priceWithBilling.billingMethod) {
45003
+ lines.push(` billingMethod: '${priceWithBilling.billingMethod}',`);
44945
45004
  }
44946
- if (planFeature.price.billing_method) {
44947
- lines.push(` billing_method: '${planFeature.price.billing_method}',`);
45005
+ if (priceWithBilling.maxPurchase !== undefined) {
45006
+ lines.push(` maxPurchase: ${priceWithBilling.maxPurchase},`);
44948
45007
  }
44949
- if (planFeature.price.max_purchase !== undefined) {
44950
- lines.push(` max_purchase: ${planFeature.price.max_purchase},`);
45008
+ if (priceWithBilling.tierBehaviour !== undefined) {
45009
+ lines.push(` tierBehaviour: '${priceWithBilling.tierBehaviour}',`);
44951
45010
  }
44952
- const priceWithInterval = planFeature.price;
45011
+ const priceWithInterval = planItem.price;
44953
45012
  if (priceWithInterval.interval) {
44954
45013
  lines.push(` interval: '${priceWithInterval.interval}',`);
44955
45014
  }
44956
- if (priceWithInterval.interval_count !== undefined) {
44957
- lines.push(` interval_count: ${priceWithInterval.interval_count},`);
45015
+ if (priceWithInterval.intervalCount !== undefined) {
45016
+ lines.push(` intervalCount: ${priceWithInterval.intervalCount},`);
44958
45017
  }
44959
45018
  lines.push(` },`);
44960
45019
  }
44961
- if (planFeature.proration) {
44962
- lines.push(` proration: ${formatValue(planFeature.proration)},`);
45020
+ if (planItem.proration) {
45021
+ lines.push(` proration: ${formatValue(planItem.proration)},`);
44963
45022
  }
44964
- if (planFeature.rollover) {
44965
- lines.push(` rollover: ${formatValue(planFeature.rollover)},`);
45023
+ if (planItem.rollover) {
45024
+ lines.push(` rollover: ${formatValue(planItem.rollover)},`);
44966
45025
  }
44967
45026
  lines.push(` }),`);
44968
45027
  return lines.join(`
44969
45028
  `);
44970
45029
  }
44971
- var init_planFeature2 = () => {};
45030
+ var init_planItem2 = () => {};
44972
45031
 
44973
45032
  // src/lib/transforms/sdkToCode/plan.ts
44974
45033
  function buildPlanCode(plan, features, featureVarMap) {
@@ -44983,11 +45042,11 @@ function buildPlanCode(plan, features, featureVarMap) {
44983
45042
  if (plan.group !== undefined && plan.group !== null && plan.group !== "") {
44984
45043
  lines.push(` group: '${plan.group}',`);
44985
45044
  }
44986
- if (plan.add_on !== undefined) {
44987
- lines.push(` add_on: ${plan.add_on},`);
45045
+ if (plan.addOn !== undefined) {
45046
+ lines.push(` addOn: ${plan.addOn},`);
44988
45047
  }
44989
- if (plan.auto_enable !== undefined) {
44990
- lines.push(` auto_enable: ${plan.auto_enable},`);
45048
+ if (plan.autoEnable !== undefined) {
45049
+ lines.push(` autoEnable: ${plan.autoEnable},`);
44991
45050
  }
44992
45051
  if (plan.price) {
44993
45052
  lines.push(` price: {`);
@@ -44997,21 +45056,21 @@ function buildPlanCode(plan, features, featureVarMap) {
44997
45056
  }
44998
45057
  lines.push(` items: [`);
44999
45058
  if (plan.items && plan.items.length > 0) {
45000
- for (const planFeature of plan.items) {
45001
- const featureCode = buildPlanFeatureCode(planFeature, features, featureVarMap);
45002
- lines.push(featureCode);
45059
+ for (const planItem of plan.items) {
45060
+ const itemCode = buildPlanItemCode(planItem, features, featureVarMap);
45061
+ lines.push(itemCode);
45003
45062
  }
45004
45063
  }
45005
45064
  lines.push(` ],`);
45006
- if (plan.free_trial) {
45007
- lines.push(` free_trial: ${formatValue(plan.free_trial)},`);
45065
+ if (plan.freeTrial) {
45066
+ lines.push(` freeTrial: ${formatValue(plan.freeTrial)},`);
45008
45067
  }
45009
45068
  lines.push(`});`);
45010
45069
  return lines.join(`
45011
45070
  `);
45012
45071
  }
45013
45072
  var init_plan2 = __esm(() => {
45014
- init_planFeature2();
45073
+ init_planItem2();
45015
45074
  });
45016
45075
 
45017
45076
  // src/lib/transforms/inPlaceUpdate/updateConfig.ts
@@ -45148,12 +45207,19 @@ async function updateConfigInPlace(features, plans, cwd2 = process.cwd()) {
45148
45207
  `);
45149
45208
  if (lastFeatureBlockIndex >= 0) {
45150
45209
  outputBlocks.splice(lastFeatureBlockIndex + 1, 0, newFeatureCode);
45151
- lastPlanBlockIndex++;
45210
+ lastFeatureBlockIndex++;
45211
+ if (lastPlanBlockIndex >= 0) {
45212
+ lastPlanBlockIndex++;
45213
+ }
45152
45214
  } else if (sawFeaturesComment) {
45153
45215
  for (let i = 0;i < outputBlocks.length; i++) {
45154
- if (outputBlocks[i].toLowerCase().includes("feature") && (outputBlocks[i].trim().startsWith("//") || outputBlocks[i].trim().startsWith("/*"))) {
45216
+ const blk = outputBlocks[i];
45217
+ if (blk.toLowerCase().includes("feature") && (blk.trim().startsWith("//") || blk.trim().startsWith("/*"))) {
45155
45218
  outputBlocks.splice(i + 1, 0, newFeatureCode);
45156
- lastPlanBlockIndex++;
45219
+ lastFeatureBlockIndex = i + 1;
45220
+ if (lastPlanBlockIndex >= 0) {
45221
+ lastPlanBlockIndex++;
45222
+ }
45157
45223
  break;
45158
45224
  }
45159
45225
  }
@@ -45167,7 +45233,10 @@ async function updateConfigInPlace(features, plans, cwd2 = process.cwd()) {
45167
45233
  outputBlocks.splice(insertIdx, 0, `
45168
45234
  // Features
45169
45235
  ${newFeatureCode}`);
45170
- lastPlanBlockIndex++;
45236
+ lastFeatureBlockIndex = insertIdx;
45237
+ if (lastPlanBlockIndex >= 0) {
45238
+ lastPlanBlockIndex++;
45239
+ }
45171
45240
  }
45172
45241
  result.featuresAdded = newFeatures.length;
45173
45242
  }
@@ -45180,11 +45249,16 @@ ${newFeatureCode}`);
45180
45249
  outputBlocks.splice(lastPlanBlockIndex + 1, 0, newPlanCode);
45181
45250
  } else if (sawPlansComment) {
45182
45251
  for (let i = 0;i < outputBlocks.length; i++) {
45183
- if (outputBlocks[i].toLowerCase().includes("plan") && (outputBlocks[i].trim().startsWith("//") || outputBlocks[i].trim().startsWith("/*"))) {
45252
+ const blk = outputBlocks[i];
45253
+ if (blk.toLowerCase().includes("plan") && (blk.trim().startsWith("//") || blk.trim().startsWith("/*"))) {
45184
45254
  outputBlocks.splice(i + 1, 0, newPlanCode);
45185
45255
  break;
45186
45256
  }
45187
45257
  }
45258
+ } else if (lastFeatureBlockIndex >= 0) {
45259
+ outputBlocks.splice(lastFeatureBlockIndex + 1, 0, `
45260
+ // Plans
45261
+ ${newPlanCode}`);
45188
45262
  } else {
45189
45263
  outputBlocks.push(`
45190
45264
  // Plans
@@ -45255,7 +45329,7 @@ var init_sdkToCode = __esm(() => {
45255
45329
  init_configFile();
45256
45330
  init_feature2();
45257
45331
  init_plan2();
45258
- init_planFeature2();
45332
+ init_planItem2();
45259
45333
  });
45260
45334
 
45261
45335
  // src/lib/transforms/index.ts
@@ -45438,7 +45512,7 @@ var init_pull = __esm(() => {
45438
45512
  });
45439
45513
 
45440
45514
  // src/lib/version.ts
45441
- var APP_VERSION = "1.0.4";
45515
+ var APP_VERSION = "1.1.0";
45442
45516
 
45443
45517
  // ../node_modules/.pnpm/@tanstack+query-core@5.90.17/node_modules/@tanstack/query-core/build/modern/subscribable.js
45444
45518
  var Subscribable = class {
@@ -48665,6 +48739,7 @@ function Card({ title, children }) {
48665
48739
  cardWidth.registerWidth(id, contentWidth);
48666
48740
  return () => cardWidth.unregisterWidth(id);
48667
48741
  }
48742
+ return;
48668
48743
  }, [id, contentWidth, cardWidth]);
48669
48744
  const width = cardWidth?.width ?? Math.max(DEFAULT_WIDTH, contentWidth);
48670
48745
  return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
@@ -50550,7 +50625,8 @@ function QueryProvider({ children }) {
50550
50625
  return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(QueryClientProvider, {
50551
50626
  client: queryClient,
50552
50627
  children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(AuthRecoveryBoundary, {
50553
- onRetry: handleRetry
50628
+ onRetry: handleRetry,
50629
+ children: null
50554
50630
  }, undefined, false, undefined, this)
50555
50631
  }, undefined, false, undefined, this);
50556
50632
  }
@@ -60196,7 +60272,7 @@ This creates: $10/month base price that includes 1 unit, then $10 per additional
60196
60272
  ## Example Configuration
60197
60273
 
60198
60274
  \`\`\`typescript
60199
- import { feature, plan, planFeature } from "atmn";
60275
+ import { feature, plan, item } from "atmn";
60200
60276
 
60201
60277
  // Features
60202
60278
  export const messages = feature({
@@ -60217,10 +60293,10 @@ export const seats = feature({
60217
60293
  export const free = plan({
60218
60294
  id: "free",
60219
60295
  name: "Free",
60220
- auto_enable: true,
60296
+ autoEnable: true,
60221
60297
  items: [
60222
- planFeature({ feature_id: messages.id, included: 100 }),
60223
- planFeature({ feature_id: seats.id, included: 1 }),
60298
+ item({ featureId: messages.id, included: 100 }),
60299
+ item({ featureId: seats.id, included: 1 }),
60224
60300
  ],
60225
60301
  });
60226
60302
 
@@ -60232,23 +60308,23 @@ export const pro = plan({
60232
60308
  interval: "month",
60233
60309
  },
60234
60310
  items: [
60235
- planFeature({
60236
- feature_id: seats.id,
60311
+ item({
60312
+ featureId: seats.id,
60237
60313
  included: 5,
60238
60314
  price: {
60239
60315
  amount: 10,
60240
60316
  interval: "month",
60241
- billing_method: "usage_based",
60317
+ billingMethod: "usage_based",
60242
60318
  },
60243
60319
  }),
60244
- planFeature({
60245
- feature_id: messages.id,
60320
+ item({
60321
+ featureId: messages.id,
60246
60322
  included: 10_000,
60247
- entity_feature_id: seats.id,
60323
+ entityFeatureId: seats.id,
60248
60324
  price: {
60249
60325
  amount: 0.01,
60250
60326
  interval: "month",
60251
- billing_method: "usage_based",
60327
+ billingMethod: "usage_based",
60252
60328
  },
60253
60329
  }),
60254
60330
  ],
@@ -61120,7 +61196,7 @@ function useEventsFilter(featuresCount) {
61120
61196
  const presets = ["24h", "7d", "30d", "90d", "all"];
61121
61197
  setDraftFilters((prev) => ({
61122
61198
  ...prev,
61123
- timeRange: presets[activeIndex]
61199
+ timeRange: presets[activeIndex] ?? "24h"
61124
61200
  }));
61125
61201
  return;
61126
61202
  }
@@ -61656,7 +61732,8 @@ function createProdConfirmationPrompt() {
61656
61732
  ]
61657
61733
  };
61658
61734
  }
61659
- function createPlanVersioningPrompt(info) {
61735
+ function createPlanVersioningPrompt(info, env5) {
61736
+ const isSandbox = !env5 || env5 === "sandbox" /* Sandbox */;
61660
61737
  return {
61661
61738
  id: generatePromptId(),
61662
61739
  type: "plan_versioning",
@@ -61667,10 +61744,17 @@ function createPlanVersioningPrompt(info) {
61667
61744
  planName: info.plan.name
61668
61745
  },
61669
61746
  options: [
61747
+ ...isSandbox ? [
61748
+ {
61749
+ label: "Yes, migrate existing customers and create a new version",
61750
+ value: "version_and_migrate",
61751
+ isDefault: true
61752
+ }
61753
+ ] : [],
61670
61754
  {
61671
- label: "Yes, create new version",
61755
+ label: "Yes, but create a new version only",
61672
61756
  value: "version",
61673
- isDefault: true
61757
+ isDefault: !isSandbox
61674
61758
  },
61675
61759
  { label: "No, skip this plan", value: "skip", isDefault: false }
61676
61760
  ]
@@ -61815,59 +61899,92 @@ function createPlanDeletePrompt(info) {
61815
61899
  return createPlanDeleteNoCustomersPrompt(info);
61816
61900
  }
61817
61901
  var promptCounter = 0;
61902
+ var init_prompts = __esm(() => {
61903
+ init_env();
61904
+ });
61905
+
61906
+ // src/lib/transforms/sdkToApi/feature.ts
61907
+ function transformFeatureToApi(feature) {
61908
+ const base3 = {
61909
+ id: feature.id,
61910
+ name: feature.name,
61911
+ type: feature.type
61912
+ };
61913
+ if (feature.archived !== undefined) {
61914
+ base3.archived = feature.archived;
61915
+ }
61916
+ if (feature.eventNames !== undefined) {
61917
+ base3.event_names = feature.eventNames;
61918
+ }
61919
+ if (feature.type === "metered") {
61920
+ base3.consumable = feature.consumable;
61921
+ }
61922
+ if (feature.type === "credit_system" && feature.creditSchema) {
61923
+ base3.credit_schema = feature.creditSchema.map((entry) => ({
61924
+ metered_feature_id: entry.meteredFeatureId,
61925
+ credit_cost: entry.creditCost
61926
+ }));
61927
+ }
61928
+ return base3;
61929
+ }
61818
61930
 
61819
61931
  // src/lib/transforms/sdkToApi/plan.ts
61820
- function transformPlanFeature(feature) {
61932
+ function transformPlanItem(planItem) {
61821
61933
  const result = {
61822
- feature_id: feature.feature_id
61934
+ feature_id: planItem.featureId
61823
61935
  };
61824
- if (feature.included !== undefined) {
61825
- result.included = feature.included;
61936
+ if (planItem.included !== undefined) {
61937
+ result.included = planItem.included;
61826
61938
  }
61827
- if (feature.unlimited !== undefined) {
61828
- result.unlimited = feature.unlimited;
61939
+ if (planItem.unlimited !== undefined) {
61940
+ result.unlimited = planItem.unlimited;
61829
61941
  }
61830
- if (feature.reset) {
61942
+ if (planItem.reset) {
61831
61943
  result.reset = {
61832
- interval: feature.reset.interval,
61833
- ...feature.reset.interval_count !== undefined && {
61834
- interval_count: feature.reset.interval_count
61944
+ interval: planItem.reset.interval,
61945
+ ...planItem.reset.intervalCount !== undefined && {
61946
+ interval_count: planItem.reset.intervalCount
61835
61947
  }
61836
61948
  };
61837
61949
  }
61838
- if (feature.price) {
61839
- const priceInterval = feature.price.interval;
61840
- const priceIntervalCount = feature.price.interval_count;
61841
- const interval = priceInterval ?? feature.reset?.interval;
61842
- const intervalCount = priceIntervalCount ?? feature.reset?.interval_count;
61950
+ if (planItem.price) {
61951
+ const priceWithInterval = planItem.price;
61952
+ const priceInterval = priceWithInterval.interval;
61953
+ const priceIntervalCount = priceWithInterval.intervalCount;
61954
+ const interval = priceInterval ?? planItem.reset?.interval;
61955
+ const intervalCount = priceIntervalCount ?? planItem.reset?.intervalCount;
61956
+ const priceWithBilling = planItem.price;
61843
61957
  result.price = {
61844
61958
  interval,
61845
- billing_units: feature.price.billing_units ?? 1,
61846
- billing_method: feature.price.billing_method ?? "prepaid",
61847
- ...feature.price.amount !== undefined && {
61848
- amount: feature.price.amount
61959
+ billing_units: priceWithBilling.billingUnits ?? 1,
61960
+ billing_method: priceWithBilling.billingMethod ?? "prepaid",
61961
+ ...planItem.price.amount !== undefined && {
61962
+ amount: planItem.price.amount
61849
61963
  },
61850
- ...feature.price.tiers && { tiers: feature.price.tiers },
61964
+ ...planItem.price.tiers && { tiers: planItem.price.tiers },
61851
61965
  ...intervalCount !== undefined && {
61852
61966
  interval_count: intervalCount
61853
61967
  },
61854
- ...feature.price.max_purchase !== undefined && {
61855
- max_purchase: feature.price.max_purchase
61968
+ ...priceWithBilling.maxPurchase !== undefined && {
61969
+ max_purchase: priceWithBilling.maxPurchase
61970
+ },
61971
+ ...priceWithBilling.tierBehaviour !== undefined && {
61972
+ tier_behaviour: priceWithBilling.tierBehaviour
61856
61973
  }
61857
61974
  };
61858
61975
  }
61859
- if (feature.proration) {
61976
+ if (planItem.proration) {
61860
61977
  result.proration = {
61861
- on_increase: feature.proration.on_increase,
61862
- on_decrease: feature.proration.on_decrease
61978
+ on_increase: planItem.proration.onIncrease,
61979
+ on_decrease: planItem.proration.onDecrease
61863
61980
  };
61864
61981
  }
61865
- if (feature.rollover) {
61982
+ if (planItem.rollover) {
61866
61983
  result.rollover = {
61867
- max: feature.rollover.max ?? 0,
61868
- expiry_duration_type: feature.rollover.expiry_duration_type,
61869
- ...feature.rollover.expiry_duration_length !== undefined && {
61870
- expiry_duration_length: feature.rollover.expiry_duration_length
61984
+ max: planItem.rollover.max ?? 0,
61985
+ expiry_duration_type: planItem.rollover.expiryDurationType,
61986
+ ...planItem.rollover.expiryDurationLength !== undefined && {
61987
+ expiry_duration_length: planItem.rollover.expiryDurationLength
61871
61988
  }
61872
61989
  };
61873
61990
  }
@@ -61884,11 +62001,11 @@ function transformPlanToApi(plan) {
61884
62001
  if (plan.group !== undefined) {
61885
62002
  result.group = plan.group;
61886
62003
  }
61887
- if (plan.add_on !== undefined) {
61888
- result.add_on = plan.add_on;
62004
+ if (plan.addOn !== undefined) {
62005
+ result.add_on = plan.addOn;
61889
62006
  }
61890
- if (plan.auto_enable !== undefined) {
61891
- result.auto_enable = plan.auto_enable;
62007
+ if (plan.autoEnable !== undefined) {
62008
+ result.auto_enable = plan.autoEnable;
61892
62009
  }
61893
62010
  if (plan.price) {
61894
62011
  result.price = {
@@ -61897,13 +62014,13 @@ function transformPlanToApi(plan) {
61897
62014
  };
61898
62015
  }
61899
62016
  if (plan.items && plan.items.length > 0) {
61900
- result.items = plan.items.map(transformPlanFeature);
62017
+ result.items = plan.items.map(transformPlanItem);
61901
62018
  }
61902
- if (plan.free_trial) {
62019
+ if (plan.freeTrial) {
61903
62020
  result.free_trial = {
61904
- duration_type: plan.free_trial.duration_type,
61905
- duration_length: plan.free_trial.duration_length,
61906
- card_required: plan.free_trial.card_required
62021
+ duration_type: plan.freeTrial.durationType,
62022
+ duration_length: plan.freeTrial.durationLength,
62023
+ card_required: plan.freeTrial.cardRequired
61907
62024
  };
61908
62025
  }
61909
62026
  return result;
@@ -61932,7 +62049,7 @@ async function checkFeatureDeleteInfo(featureId, localFeatures, remoteFeatures)
61932
62049
  const secretKey = getSecretKey();
61933
62050
  const remoteFeature = remoteFeatures.find((f) => f.id === featureId);
61934
62051
  const featureType = remoteFeature?.type;
61935
- const referencingCreditSystems = localFeatures.filter((f) => f.type === "credit_system" && f.credit_schema?.some((cs) => cs.metered_feature_id === featureId));
62052
+ const referencingCreditSystems = localFeatures.filter((f) => f.type === "credit_system" && f.creditSchema?.some((cs) => cs.meteredFeatureId === featureId));
61936
62053
  if (referencingCreditSystems.length >= 1) {
61937
62054
  return {
61938
62055
  id: featureId,
@@ -61989,7 +62106,7 @@ async function checkPlanForVersioning(plan, remotePlans, localFeatureIds, remote
61989
62106
  isArchived: false
61990
62107
  };
61991
62108
  }
61992
- const missingFeatureIds = (plan.items || []).map((item) => item.feature_id).filter((featureId) => !remoteFeatureIds.has(featureId));
62109
+ const missingFeatureIds = (plan.items || []).map((item) => item.featureId).filter((featureId) => !remoteFeatureIds.has(featureId));
61993
62110
  const missingLocalFeatureIds = missingFeatureIds.filter((featureId) => localFeatureIds.has(featureId));
61994
62111
  const missingUnknownFeatureIds = missingFeatureIds.filter((featureId) => !localFeatureIds.has(featureId));
61995
62112
  if (missingLocalFeatureIds.length > 0) {
@@ -62091,13 +62208,13 @@ function normalizeFeatureForCompare(f) {
62091
62208
  if (f.type === "metered" && "consumable" in f) {
62092
62209
  result.consumable = f.consumable;
62093
62210
  }
62094
- if (f.event_names && f.event_names.length > 0) {
62095
- result.event_names = [...f.event_names].sort();
62211
+ if (f.eventNames && f.eventNames.length > 0) {
62212
+ result.eventNames = [...f.eventNames].sort();
62096
62213
  }
62097
- if (f.credit_schema && f.credit_schema.length > 0) {
62098
- result.credit_schema = [...f.credit_schema].sort((a2, b) => a2.metered_feature_id.localeCompare(b.metered_feature_id)).map((cs) => ({
62099
- metered_feature_id: cs.metered_feature_id,
62100
- credit_cost: cs.credit_cost
62214
+ if (f.creditSchema && f.creditSchema.length > 0) {
62215
+ result.creditSchema = [...f.creditSchema].sort((a2, b) => a2.meteredFeatureId.localeCompare(b.meteredFeatureId)).map((cs) => ({
62216
+ meteredFeatureId: cs.meteredFeatureId,
62217
+ creditCost: cs.creditCost
62101
62218
  }));
62102
62219
  }
62103
62220
  return result;
@@ -62105,17 +62222,17 @@ function normalizeFeatureForCompare(f) {
62105
62222
  function normalizePlanFeatureForCompare(pf) {
62106
62223
  const f = pf;
62107
62224
  const result = {
62108
- feature_id: pf.feature_id
62225
+ featureId: pf.featureId
62109
62226
  };
62110
- if (f.included != null)
62227
+ if (f.included != null && f.included !== 0)
62111
62228
  result.included = f.included;
62112
62229
  if (f.unlimited === true)
62113
62230
  result.unlimited = true;
62114
62231
  const reset2 = f.reset;
62115
62232
  if (reset2 != null) {
62116
62233
  const r = { interval: reset2.interval };
62117
- if (reset2.interval_count != null && reset2.interval_count !== 1) {
62118
- r.interval_count = reset2.interval_count;
62234
+ if (reset2.intervalCount != null && reset2.intervalCount !== 1) {
62235
+ r.intervalCount = reset2.intervalCount;
62119
62236
  }
62120
62237
  result.reset = r;
62121
62238
  }
@@ -62124,21 +62241,21 @@ function normalizePlanFeatureForCompare(pf) {
62124
62241
  const p = {};
62125
62242
  if (price.amount != null)
62126
62243
  p.amount = price.amount;
62127
- if (price.billing_method != null)
62128
- p.billing_method = price.billing_method;
62244
+ if (price.billingMethod != null)
62245
+ p.billingMethod = price.billingMethod;
62129
62246
  if (price.interval != null)
62130
62247
  p.interval = price.interval;
62131
- if (price.interval_count != null && price.interval_count !== 1) {
62132
- p.interval_count = price.interval_count;
62248
+ if (price.intervalCount != null && price.intervalCount !== 1) {
62249
+ p.intervalCount = price.intervalCount;
62133
62250
  }
62134
62251
  if (price.tiers != null && Array.isArray(price.tiers) && price.tiers.length > 0) {
62135
62252
  p.tiers = price.tiers;
62136
62253
  }
62137
- if (price.billing_units != null && price.billing_units !== 1) {
62138
- p.billing_units = price.billing_units;
62254
+ if (price.billingUnits != null && price.billingUnits !== 1) {
62255
+ p.billingUnits = price.billingUnits;
62139
62256
  }
62140
- if (price.max_purchase != null)
62141
- p.max_purchase = price.max_purchase;
62257
+ if (price.maxPurchase != null)
62258
+ p.maxPurchase = price.maxPurchase;
62142
62259
  if (Object.keys(p).length > 0)
62143
62260
  result.price = p;
62144
62261
  }
@@ -62151,7 +62268,7 @@ function normalizePlanFeatureForCompare(pf) {
62151
62268
  return result;
62152
62269
  }
62153
62270
  function getPlanFeatureIds(plan) {
62154
- return (plan.items || []).map((item) => item.feature_id);
62271
+ return (plan.items || []).map((item) => item.featureId);
62155
62272
  }
62156
62273
  function normalizePlanForCompare(plan) {
62157
62274
  const result = {
@@ -62164,25 +62281,25 @@ function normalizePlanForCompare(plan) {
62164
62281
  if (plan.group != null && plan.group !== "") {
62165
62282
  result.group = plan.group;
62166
62283
  }
62167
- if (plan.add_on === true)
62168
- result.add_on = true;
62169
- if (plan.auto_enable === true)
62170
- result.auto_enable = true;
62284
+ if (plan.addOn === true)
62285
+ result.addOn = true;
62286
+ if (plan.autoEnable === true)
62287
+ result.autoEnable = true;
62171
62288
  if (plan.price != null) {
62172
62289
  result.price = {
62173
62290
  amount: plan.price.amount,
62174
62291
  interval: plan.price.interval
62175
62292
  };
62176
62293
  }
62177
- if (plan.free_trial != null) {
62178
- result.free_trial = {
62179
- duration_type: plan.free_trial.duration_type,
62180
- duration_length: plan.free_trial.duration_length,
62181
- card_required: plan.free_trial.card_required
62294
+ if (plan.freeTrial != null) {
62295
+ result.freeTrial = {
62296
+ durationLength: plan.freeTrial.durationLength,
62297
+ durationType: plan.freeTrial.durationType,
62298
+ cardRequired: plan.freeTrial.cardRequired
62182
62299
  };
62183
62300
  }
62184
62301
  if (plan.items != null && plan.items.length > 0) {
62185
- result.items = [...plan.items].sort((a2, b) => a2.feature_id.localeCompare(b.feature_id)).map(normalizePlanFeatureForCompare);
62302
+ result.items = [...plan.items].sort((a2, b) => a2.featureId.localeCompare(b.featureId)).map(normalizePlanFeatureForCompare);
62186
62303
  }
62187
62304
  return result;
62188
62305
  }
@@ -62327,10 +62444,11 @@ async function analyzePush(localFeatures, localPlans) {
62327
62444
  }
62328
62445
  async function pushFeature(feature) {
62329
62446
  const secretKey = getSecretKey();
62447
+ const apiFeature = transformFeatureToApi(feature);
62330
62448
  try {
62331
62449
  await upsertFeature({
62332
62450
  secretKey,
62333
- feature
62451
+ feature: apiFeature
62334
62452
  });
62335
62453
  return { action: "created" };
62336
62454
  } catch (error) {
@@ -62339,7 +62457,7 @@ async function pushFeature(feature) {
62339
62457
  await updateFeature({
62340
62458
  secretKey,
62341
62459
  featureId: feature.id,
62342
- feature
62460
+ feature: apiFeature
62343
62461
  });
62344
62462
  return { action: "updated" };
62345
62463
  }
@@ -62360,10 +62478,10 @@ async function pushPlan(plan, remotePlans) {
62360
62478
  } else if (plan.group === null && remotePlan.group !== undefined && remotePlan.group !== null) {
62361
62479
  updatePayload.group = null;
62362
62480
  }
62363
- if (plan.add_on === undefined && remotePlan.add_on === true) {
62481
+ if (plan.addOn === undefined && remotePlan.addOn === true) {
62364
62482
  updatePayload.add_on = false;
62365
62483
  }
62366
- if (plan.auto_enable === undefined && remotePlan.auto_enable === true) {
62484
+ if (plan.autoEnable === undefined && remotePlan.autoEnable === true) {
62367
62485
  updatePayload.auto_enable = false;
62368
62486
  }
62369
62487
  await updatePlan({ secretKey, planId: plan.id, plan: updatePayload });
@@ -62412,7 +62530,7 @@ function getPriceInterval(feature) {
62412
62530
  return;
62413
62531
  const price = feature.price;
62414
62532
  if (price.interval) {
62415
- return { interval: price.interval, interval_count: price.interval_count };
62533
+ return { interval: price.interval, intervalCount: price.intervalCount };
62416
62534
  }
62417
62535
  return;
62418
62536
  }
@@ -62428,9 +62546,9 @@ function isConsumableFeature(feature) {
62428
62546
  }
62429
62547
  function validatePlanFeature(planFeature, planId, featureIndex, features) {
62430
62548
  const errors2 = [];
62431
- const featureId = planFeature.feature_id || `(no feature_id)`;
62549
+ const featureId = planFeature.featureId || `(no featureId)`;
62432
62550
  const basePath = `plan "${planId}" → items[${featureIndex}] (${featureId})`;
62433
- const featureDefinition = features.find((f) => f.id === planFeature.feature_id);
62551
+ const featureDefinition = features.find((f) => f.id === planFeature.featureId);
62434
62552
  const topLevelReset = planFeature.reset;
62435
62553
  const priceInterval = getPriceInterval(planFeature);
62436
62554
  const hasTopLevelReset = topLevelReset !== undefined;
@@ -62461,10 +62579,10 @@ function validatePlanFeature(planFeature, planId, featureIndex, features) {
62461
62579
  }
62462
62580
  }
62463
62581
  if (planFeature.price) {
62464
- if (!planFeature.price.billing_method) {
62582
+ if (!planFeature.price.billingMethod) {
62465
62583
  errors2.push({
62466
62584
  path: `${basePath} → price`,
62467
- message: `"billing_method" is required when "price" is defined. Must be "prepaid" or "usage_based".`
62585
+ message: `"billingMethod" is required when "price" is defined. Must be "prepaid" or "usage_based".`
62468
62586
  });
62469
62587
  }
62470
62588
  if ((planFeature.price.amount !== undefined || planFeature.price.tiers) && !hasAnyReset) {
@@ -62536,7 +62654,7 @@ function validatePlan(plan, features) {
62536
62654
  });
62537
62655
  }
62538
62656
  }
62539
- if (plan.auto_enable === true && plan.free_trial?.card_required === true) {
62657
+ if (plan.autoEnable === true && plan.freeTrial?.cardRequired === true) {
62540
62658
  errors2.push({
62541
62659
  path: `plan "${planId}"`,
62542
62660
  message: `"auto_enable" cannot be true when "free_trial.card_required" is true. Customers cannot be auto-enrolled in a trial that requires card input.`
@@ -62546,10 +62664,10 @@ function validatePlan(plan, features) {
62546
62664
  for (let i2 = 0;i2 < plan.items.length; i2++) {
62547
62665
  const planFeature = plan.items[i2];
62548
62666
  if (planFeature) {
62549
- if (!planFeature.feature_id) {
62667
+ if (!planFeature.featureId) {
62550
62668
  errors2.push({
62551
62669
  path: `plan "${planId}" → items[${i2}]`,
62552
- message: `"feature_id" is required.`
62670
+ message: `"featureId" is required.`
62553
62671
  });
62554
62672
  }
62555
62673
  errors2.push(...validatePlanFeature(planFeature, planId, i2, features));
@@ -62589,10 +62707,10 @@ function validateFeature(feature) {
62589
62707
  }
62590
62708
  }
62591
62709
  if (feature.type === "credit_system") {
62592
- if (!feature.credit_schema || feature.credit_schema.length === 0) {
62710
+ if (!feature.creditSchema || feature.creditSchema.length === 0) {
62593
62711
  errors2.push({
62594
62712
  path: `feature "${featureId}"`,
62595
- message: `"credit_schema" is required for credit_system features.`
62713
+ message: `"creditSchema" is required for credit_system features.`
62596
62714
  });
62597
62715
  }
62598
62716
  }
@@ -62687,7 +62805,7 @@ function buildPromptQueue(analysis, environment) {
62687
62805
  }
62688
62806
  for (const planInfo of analysis.plansToUpdate) {
62689
62807
  if (planInfo.willVersion) {
62690
- prompts.push(createPlanVersioningPrompt(planInfo));
62808
+ prompts.push(createPlanVersioningPrompt(planInfo, environment));
62691
62809
  }
62692
62810
  }
62693
62811
  for (const info of analysis.featuresToDelete) {
@@ -62771,7 +62889,7 @@ async function syncArchivedFeaturesToConfig(config, archivedFeatureIds, cwd2) {
62771
62889
  }
62772
62890
  await writeConfig(Array.from(localFeaturesById.values()), config.plans, cwd2);
62773
62891
  }
62774
- async function executePushWithDefaults(config, analysis, prompts, cwd2) {
62892
+ async function executePushWithDefaults(config, analysis, prompts, cwd2, environment) {
62775
62893
  const result = {
62776
62894
  success: true,
62777
62895
  featuresCreated: [],
@@ -62802,7 +62920,13 @@ async function executePushWithDefaults(config, analysis, prompts, cwd2) {
62802
62920
  await unarchiveFeature2(feature.id);
62803
62921
  }
62804
62922
  }
62805
- const allFeatures = config.features;
62923
+ const allFeatures = [...config.features].sort((a2, b) => {
62924
+ if (a2.type === "credit_system" && b.type !== "credit_system")
62925
+ return 1;
62926
+ if (a2.type !== "credit_system" && b.type === "credit_system")
62927
+ return -1;
62928
+ return 0;
62929
+ });
62806
62930
  for (const feature of allFeatures) {
62807
62931
  const isArchived = analysis.archivedFeatures.some((af) => af.id === feature.id);
62808
62932
  if (isArchived) {
@@ -62835,12 +62959,10 @@ async function executePushWithDefaults(config, analysis, prompts, cwd2) {
62835
62959
  const planUpdateById = new Map(refreshedPlanUpdates.map((planInfo) => [planInfo.plan.id, planInfo]));
62836
62960
  for (const planInfo of analysis.plansToUpdate) {
62837
62961
  const refreshedPlanInfo = planUpdateById.get(planInfo.plan.id) ?? planInfo;
62838
- if (refreshedPlanInfo.willVersion) {
62839
- const promptId = prompts.find((p) => p.type === "plan_versioning" && p.entityId === planInfo.plan.id)?.id;
62840
- const response = promptId ? responses.get(promptId) : undefined;
62841
- if (response === "skip") {
62842
- continue;
62843
- }
62962
+ const versioningPromptId = prompts.find((p) => p.type === "plan_versioning" && p.entityId === planInfo.plan.id)?.id;
62963
+ const versioningResponse = versioningPromptId ? responses.get(versioningPromptId) : undefined;
62964
+ if (refreshedPlanInfo.willVersion && versioningResponse === "skip") {
62965
+ continue;
62844
62966
  }
62845
62967
  if (planInfo.isArchived || refreshedPlanInfo.isArchived) {
62846
62968
  const promptId = prompts.find((p) => p.type === "plan_archived" && p.entityId === planInfo.plan.id)?.id;
@@ -62850,6 +62972,23 @@ async function executePushWithDefaults(config, analysis, prompts, cwd2) {
62850
62972
  }
62851
62973
  }
62852
62974
  await pushPlan(planInfo.plan, remotePlans);
62975
+ if (refreshedPlanInfo.willVersion && versioningResponse === "version_and_migrate") {
62976
+ const secretKey = getKey(environment);
62977
+ const updatedPlans = await fetchPlans({
62978
+ secretKey,
62979
+ includeArchived: false
62980
+ });
62981
+ const updatedPlan = updatedPlans.find((p) => p.id === planInfo.plan.id);
62982
+ if (updatedPlan && updatedPlan.version > 1) {
62983
+ await migrateProduct({
62984
+ secretKey,
62985
+ fromProductId: planInfo.plan.id,
62986
+ fromVersion: updatedPlan.version - 1,
62987
+ toProductId: planInfo.plan.id,
62988
+ toVersion: updatedPlan.version
62989
+ });
62990
+ }
62991
+ }
62853
62992
  if (refreshedPlanInfo.willVersion) {
62854
62993
  result.plansUpdated.push(refreshedPlanInfo.plan.id);
62855
62994
  } else {
@@ -62914,7 +63053,14 @@ async function executeCleanPush(config, analysis) {
62914
63053
  };
62915
63054
  const remoteData = await fetchRemoteData();
62916
63055
  const remotePlans = remoteData.plans;
62917
- for (const feature of config.features) {
63056
+ const sortedFeatures = [...config.features].sort((a2, b) => {
63057
+ if (a2.type === "credit_system" && b.type !== "credit_system")
63058
+ return 1;
63059
+ if (a2.type !== "credit_system" && b.type === "credit_system")
63060
+ return -1;
63061
+ return 0;
63062
+ });
63063
+ for (const feature of sortedFeatures) {
62918
63064
  const pushResult = await pushFeature(feature);
62919
63065
  if (pushResult.action === "created") {
62920
63066
  result.featuresCreated.push(feature.id);
@@ -62988,7 +63134,7 @@ Push requires confirmation for the following:`));
62988
63134
  Pushing to ${envLabel}...`));
62989
63135
  let result;
62990
63136
  if (prompts.length > 0) {
62991
- result = await executePushWithDefaults(config, analysis, prompts, cwd2);
63137
+ result = await executePushWithDefaults(config, analysis, prompts, cwd2, environment);
62992
63138
  } else {
62993
63139
  result = await executeCleanPush(config, analysis);
62994
63140
  }
@@ -63022,15 +63168,18 @@ Push complete!`));
63022
63168
  }
63023
63169
  var init_headless = __esm(() => {
63024
63170
  init_source();
63171
+ init_endpoints();
63025
63172
  init_headlessAuthRecovery();
63026
63173
  init_env();
63027
63174
  init_writeConfig();
63175
+ init_prompts();
63028
63176
  init_push();
63029
63177
  });
63030
63178
 
63031
63179
  // src/commands/push/index.ts
63032
63180
  var init_push2 = __esm(() => {
63033
63181
  init_headless();
63182
+ init_prompts();
63034
63183
  init_push();
63035
63184
  });
63036
63185
 
@@ -63186,7 +63335,7 @@ ${formatValidationErrors2(validation.errors)}`);
63186
63335
  }
63187
63336
  for (const planInfo of analysisResult.plansToUpdate) {
63188
63337
  if (planInfo.willVersion) {
63189
- prompts.push(createPlanVersioningPrompt(planInfo));
63338
+ prompts.push(createPlanVersioningPrompt(planInfo, environment));
63190
63339
  }
63191
63340
  }
63192
63341
  for (const info of analysisResult.featuresToDelete) {
@@ -63235,7 +63384,13 @@ ${formatValidationErrors2(validation.errors)}`);
63235
63384
  const allFeatures = [
63236
63385
  ...config.features.filter((f) => !analysis?.archivedFeatures.some((af) => af.id === f.id)),
63237
63386
  ...config.features.filter((f) => analysis?.archivedFeatures.some((af) => af.id === f.id))
63238
- ];
63387
+ ].sort((a2, b) => {
63388
+ if (a2.type === "credit_system" && b.type !== "credit_system")
63389
+ return 1;
63390
+ if (a2.type !== "credit_system" && b.type === "credit_system")
63391
+ return -1;
63392
+ return 0;
63393
+ });
63239
63394
  for (const feature of allFeatures) {
63240
63395
  const isArchived = analysis?.archivedFeatures.some((af) => af.id === feature.id);
63241
63396
  if (isArchived) {
@@ -63306,7 +63461,25 @@ ${formatValidationErrors2(validation.errors)}`);
63306
63461
  }
63307
63462
  }
63308
63463
  setPlanProgress((prev) => new Map(prev).set(planInfo.plan.id, "pushing"));
63464
+ const versioningResponse = resolvedPlanInfo.willVersion ? promptResponses.get(promptQueue.find((p) => p.type === "plan_versioning" && p.entityId === planInfo.plan.id)?.id || "") : undefined;
63309
63465
  await pushPlan(planInfo.plan, remotePlans);
63466
+ if (resolvedPlanInfo.willVersion && versioningResponse === "version_and_migrate") {
63467
+ const secretKey = getKey(environment);
63468
+ const updatedPlans = await fetchPlans({
63469
+ secretKey,
63470
+ includeArchived: false
63471
+ });
63472
+ const updatedPlan = updatedPlans.find((p) => p.id === planInfo.plan.id);
63473
+ if (updatedPlan && updatedPlan.version > 1) {
63474
+ await migrateProduct({
63475
+ secretKey,
63476
+ fromProductId: planInfo.plan.id,
63477
+ fromVersion: updatedPlan.version - 1,
63478
+ toProductId: planInfo.plan.id,
63479
+ toVersion: updatedPlan.version
63480
+ });
63481
+ }
63482
+ }
63310
63483
  if (resolvedPlanInfo.willVersion) {
63311
63484
  versioned.push(planInfo.plan.id);
63312
63485
  setPlanProgress((prev) => new Map(prev).set(planInfo.plan.id, "versioned"));
@@ -63513,10 +63686,11 @@ ${formatValidationErrors2(validation.errors)}`);
63513
63686
  var import_react43;
63514
63687
  var init_usePush = __esm(() => {
63515
63688
  init_modern2();
63689
+ init_writeConfig();
63516
63690
  init_push2();
63517
63691
  init_client2();
63692
+ init_endpoints();
63518
63693
  init_env();
63519
- init_writeConfig();
63520
63694
  init_useOrganization();
63521
63695
  import_react43 = __toESM(require_react(), 1);
63522
63696
  });
@@ -63548,11 +63722,11 @@ var init_linear_config = __esm(() => {
63548
63722
  {
63549
63723
  id: "free",
63550
63724
  name: "Free",
63551
- auto_enable: true,
63725
+ autoEnable: true,
63552
63726
  items: [
63553
- { feature_id: "teams", included: 2 },
63554
- { feature_id: "issues", included: 250, reset: { interval: "one_off" } },
63555
- { feature_id: "seats", unlimited: true }
63727
+ { featureId: "teams", included: 2 },
63728
+ { featureId: "issues", included: 250, reset: { interval: "one_off" } },
63729
+ { featureId: "seats", unlimited: true }
63556
63730
  ]
63557
63731
  },
63558
63732
  {
@@ -63561,17 +63735,17 @@ var init_linear_config = __esm(() => {
63561
63735
  price: { amount: 12, interval: "month" },
63562
63736
  items: [
63563
63737
  {
63564
- feature_id: "seats",
63738
+ featureId: "seats",
63565
63739
  included: 1,
63566
63740
  price: {
63567
63741
  amount: 12,
63568
- billing_method: "usage_based",
63569
- billing_units: 1,
63742
+ billingMethod: "usage_based",
63743
+ billingUnits: 1,
63570
63744
  interval: "month"
63571
63745
  }
63572
63746
  },
63573
- { feature_id: "teams", included: 5 },
63574
- { feature_id: "issues", unlimited: true }
63747
+ { featureId: "teams", included: 5 },
63748
+ { featureId: "issues", unlimited: true }
63575
63749
  ]
63576
63750
  },
63577
63751
  {
@@ -63580,17 +63754,17 @@ var init_linear_config = __esm(() => {
63580
63754
  price: { amount: 18, interval: "month" },
63581
63755
  items: [
63582
63756
  {
63583
- feature_id: "seats",
63757
+ featureId: "seats",
63584
63758
  included: 1,
63585
63759
  price: {
63586
63760
  amount: 18,
63587
- billing_method: "usage_based",
63588
- billing_units: 1,
63761
+ billingMethod: "usage_based",
63762
+ billingUnits: 1,
63589
63763
  interval: "month"
63590
63764
  }
63591
63765
  },
63592
- { feature_id: "teams", unlimited: true },
63593
- { feature_id: "issues", unlimited: true }
63766
+ { featureId: "teams", unlimited: true },
63767
+ { featureId: "issues", unlimited: true }
63594
63768
  ]
63595
63769
  }
63596
63770
  ];
@@ -63604,13 +63778,13 @@ var init_openai_config = __esm(() => {
63604
63778
  id: "credits",
63605
63779
  name: "Credits",
63606
63780
  type: "credit_system",
63607
- credit_schema: [
63608
- { metered_feature_id: "gpt5_mini_input", credit_cost: 0.25 },
63609
- { metered_feature_id: "gpt5_mini_output", credit_cost: 2 },
63610
- { metered_feature_id: "gpt52_input", credit_cost: 1.75 },
63611
- { metered_feature_id: "gpt52_output", credit_cost: 14 },
63612
- { metered_feature_id: "gpt52_pro_input", credit_cost: 21 },
63613
- { metered_feature_id: "gpt52_pro_output", credit_cost: 168 }
63781
+ creditSchema: [
63782
+ { meteredFeatureId: "gpt5_mini_input", creditCost: 0.25 },
63783
+ { meteredFeatureId: "gpt5_mini_output", creditCost: 2 },
63784
+ { meteredFeatureId: "gpt52_input", creditCost: 1.75 },
63785
+ { meteredFeatureId: "gpt52_output", creditCost: 14 },
63786
+ { meteredFeatureId: "gpt52_pro_input", creditCost: 21 },
63787
+ { meteredFeatureId: "gpt52_pro_output", creditCost: 168 }
63614
63788
  ]
63615
63789
  },
63616
63790
  {
@@ -63654,23 +63828,23 @@ var init_openai_config = __esm(() => {
63654
63828
  {
63655
63829
  id: "free",
63656
63830
  name: "Free",
63657
- auto_enable: true,
63831
+ autoEnable: true,
63658
63832
  items: [
63659
- { feature_id: "credits", included: 2000, reset: { interval: "one_off" } }
63833
+ { featureId: "credits", included: 2000, reset: { interval: "one_off" } }
63660
63834
  ]
63661
63835
  },
63662
63836
  {
63663
63837
  id: "credits-top-up",
63664
63838
  name: "Credits Top-Up",
63665
- add_on: true,
63839
+ addOn: true,
63666
63840
  items: [
63667
63841
  {
63668
- feature_id: "credits",
63842
+ featureId: "credits",
63669
63843
  price: {
63670
63844
  amount: 10,
63671
- billing_method: "prepaid",
63672
- billing_units: 1e4,
63673
- interval: "one_off"
63845
+ billingMethod: "prepaid",
63846
+ billingUnits: 1e4,
63847
+ interval: "month"
63674
63848
  }
63675
63849
  }
63676
63850
  ]
@@ -63686,11 +63860,11 @@ var init_railway_config = __esm(() => {
63686
63860
  id: "credits",
63687
63861
  name: "Credits",
63688
63862
  type: "credit_system",
63689
- credit_schema: [
63690
- { metered_feature_id: "memory", credit_cost: 0.039 },
63691
- { metered_feature_id: "cpu", credit_cost: 0.078 },
63692
- { metered_feature_id: "egress", credit_cost: 5 },
63693
- { metered_feature_id: "storage", credit_cost: 1.5 }
63863
+ creditSchema: [
63864
+ { meteredFeatureId: "memory", creditCost: 0.039 },
63865
+ { meteredFeatureId: "cpu", creditCost: 0.078 },
63866
+ { meteredFeatureId: "egress", creditCost: 5 },
63867
+ { meteredFeatureId: "storage", creditCost: 1.5 }
63694
63868
  ]
63695
63869
  },
63696
63870
  {
@@ -63722,9 +63896,9 @@ var init_railway_config = __esm(() => {
63722
63896
  {
63723
63897
  id: "free",
63724
63898
  name: "Free",
63725
- auto_enable: true,
63899
+ autoEnable: true,
63726
63900
  items: [
63727
- { feature_id: "credits", included: 500, reset: { interval: "one_off" } }
63901
+ { featureId: "credits", included: 500, reset: { interval: "one_off" } }
63728
63902
  ]
63729
63903
  },
63730
63904
  {
@@ -63733,13 +63907,13 @@ var init_railway_config = __esm(() => {
63733
63907
  price: { amount: 5, interval: "month" },
63734
63908
  items: [
63735
63909
  {
63736
- feature_id: "credits",
63910
+ featureId: "credits",
63737
63911
  included: 500,
63912
+ reset: { interval: "month" },
63738
63913
  price: {
63739
63914
  amount: 0.01,
63740
- billing_method: "usage_based",
63741
- billing_units: 1,
63742
- interval: "month"
63915
+ billingMethod: "usage_based",
63916
+ billingUnits: 1
63743
63917
  }
63744
63918
  }
63745
63919
  ]
@@ -63750,13 +63924,13 @@ var init_railway_config = __esm(() => {
63750
63924
  price: { amount: 20, interval: "month" },
63751
63925
  items: [
63752
63926
  {
63753
- feature_id: "credits",
63927
+ featureId: "credits",
63754
63928
  included: 2000,
63755
63929
  reset: { interval: "month" },
63756
63930
  price: {
63757
63931
  amount: 0.01,
63758
- billing_method: "usage_based",
63759
- billing_units: 1
63932
+ billingMethod: "usage_based",
63933
+ billingUnits: 1
63760
63934
  }
63761
63935
  }
63762
63936
  ]
@@ -63785,10 +63959,10 @@ var init_t3chat_config = __esm(() => {
63785
63959
  {
63786
63960
  id: "free",
63787
63961
  name: "Free",
63788
- auto_enable: true,
63962
+ autoEnable: true,
63789
63963
  items: [
63790
63964
  {
63791
- feature_id: "standard_messages",
63965
+ featureId: "standard_messages",
63792
63966
  included: 100,
63793
63967
  reset: { interval: "month" }
63794
63968
  }
@@ -63800,12 +63974,12 @@ var init_t3chat_config = __esm(() => {
63800
63974
  price: { amount: 8, interval: "month" },
63801
63975
  items: [
63802
63976
  {
63803
- feature_id: "standard_messages",
63977
+ featureId: "standard_messages",
63804
63978
  included: 1500,
63805
63979
  reset: { interval: "month" }
63806
63980
  },
63807
63981
  {
63808
- feature_id: "premium_messages",
63982
+ featureId: "premium_messages",
63809
63983
  included: 100,
63810
63984
  reset: { interval: "month" }
63811
63985
  }
@@ -63814,11 +63988,11 @@ var init_t3chat_config = __esm(() => {
63814
63988
  {
63815
63989
  id: "premium-credits",
63816
63990
  name: "Premium Credits",
63817
- add_on: true,
63818
- price: { amount: 8, interval: "one_off" },
63991
+ addOn: true,
63992
+ price: { amount: 8, interval: "month" },
63819
63993
  items: [
63820
63994
  {
63821
- feature_id: "premium_messages",
63995
+ featureId: "premium_messages",
63822
63996
  included: 100,
63823
63997
  reset: { interval: "one_off" }
63824
63998
  }
@@ -64190,6 +64364,7 @@ function PromptCard({
64190
64364
  cardWidth.registerWidth(id, contentWidth);
64191
64365
  return () => cardWidth.unregisterWidth(id);
64192
64366
  }
64367
+ return;
64193
64368
  }, [id, contentWidth, cardWidth]);
64194
64369
  const width = cardWidth?.width ?? Math.max(DEFAULT_WIDTH2, contentWidth);
64195
64370
  return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
@@ -64435,7 +64610,7 @@ var init_components = __esm(async () => {
64435
64610
  import fs14 from "node:fs";
64436
64611
  import path12 from "node:path";
64437
64612
  function writeEmptyConfig(targetDir) {
64438
- const content = `import { plan, feature, planFeature } from 'atmn'
64613
+ const content = `import { feature, item, plan } from 'atmn'
64439
64614
  `;
64440
64615
  const configPath = targetDir ? path12.join(targetDir, "autumn.config.ts") : resolveConfigPath();
64441
64616
  fs14.writeFileSync(configPath, content, "utf-8");
@@ -65313,801 +65488,6 @@ var init_NukeAnimation = __esm(async () => {
65313
65488
  jsx_dev_runtime17 = __toESM(require_jsx_dev_runtime(), 1);
65314
65489
  });
65315
65490
 
65316
- // ../node_modules/.pnpm/react@19.1.1/node_modules/react/cjs/react.development.js
65317
- var require_react_development2 = __commonJS((exports, module) => {
65318
- (function() {
65319
- function defineDeprecationWarning(methodName, info) {
65320
- Object.defineProperty(Component.prototype, methodName, {
65321
- get: function() {
65322
- console.warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
65323
- }
65324
- });
65325
- }
65326
- function getIteratorFn(maybeIterable) {
65327
- if (maybeIterable === null || typeof maybeIterable !== "object")
65328
- return null;
65329
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
65330
- return typeof maybeIterable === "function" ? maybeIterable : null;
65331
- }
65332
- function warnNoop(publicInstance, callerName) {
65333
- publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
65334
- var warningKey = publicInstance + "." + callerName;
65335
- didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, publicInstance), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
65336
- }
65337
- function Component(props, context2, updater) {
65338
- this.props = props;
65339
- this.context = context2;
65340
- this.refs = emptyObject;
65341
- this.updater = updater || ReactNoopUpdateQueue;
65342
- }
65343
- function ComponentDummy() {}
65344
- function PureComponent2(props, context2, updater) {
65345
- this.props = props;
65346
- this.context = context2;
65347
- this.refs = emptyObject;
65348
- this.updater = updater || ReactNoopUpdateQueue;
65349
- }
65350
- function testStringCoercion(value) {
65351
- return "" + value;
65352
- }
65353
- function checkKeyStringCoercion(value) {
65354
- try {
65355
- testStringCoercion(value);
65356
- var JSCompiler_inline_result = false;
65357
- } catch (e) {
65358
- JSCompiler_inline_result = true;
65359
- }
65360
- if (JSCompiler_inline_result) {
65361
- JSCompiler_inline_result = console;
65362
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
65363
- var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
65364
- JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
65365
- return testStringCoercion(value);
65366
- }
65367
- }
65368
- function getComponentNameFromType(type) {
65369
- if (type == null)
65370
- return null;
65371
- if (typeof type === "function")
65372
- return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
65373
- if (typeof type === "string")
65374
- return type;
65375
- switch (type) {
65376
- case REACT_FRAGMENT_TYPE:
65377
- return "Fragment";
65378
- case REACT_PROFILER_TYPE:
65379
- return "Profiler";
65380
- case REACT_STRICT_MODE_TYPE:
65381
- return "StrictMode";
65382
- case REACT_SUSPENSE_TYPE:
65383
- return "Suspense";
65384
- case REACT_SUSPENSE_LIST_TYPE:
65385
- return "SuspenseList";
65386
- case REACT_ACTIVITY_TYPE:
65387
- return "Activity";
65388
- }
65389
- if (typeof type === "object")
65390
- switch (typeof type.tag === "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
65391
- case REACT_PORTAL_TYPE:
65392
- return "Portal";
65393
- case REACT_CONTEXT_TYPE:
65394
- return (type.displayName || "Context") + ".Provider";
65395
- case REACT_CONSUMER_TYPE:
65396
- return (type._context.displayName || "Context") + ".Consumer";
65397
- case REACT_FORWARD_REF_TYPE:
65398
- var innerType = type.render;
65399
- type = type.displayName;
65400
- type || (type = innerType.displayName || innerType.name || "", type = type !== "" ? "ForwardRef(" + type + ")" : "ForwardRef");
65401
- return type;
65402
- case REACT_MEMO_TYPE:
65403
- return innerType = type.displayName || null, innerType !== null ? innerType : getComponentNameFromType(type.type) || "Memo";
65404
- case REACT_LAZY_TYPE:
65405
- innerType = type._payload;
65406
- type = type._init;
65407
- try {
65408
- return getComponentNameFromType(type(innerType));
65409
- } catch (x) {}
65410
- }
65411
- return null;
65412
- }
65413
- function getTaskName(type) {
65414
- if (type === REACT_FRAGMENT_TYPE)
65415
- return "<>";
65416
- if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE)
65417
- return "<...>";
65418
- try {
65419
- var name = getComponentNameFromType(type);
65420
- return name ? "<" + name + ">" : "<...>";
65421
- } catch (x) {
65422
- return "<...>";
65423
- }
65424
- }
65425
- function getOwner() {
65426
- var dispatcher = ReactSharedInternals.A;
65427
- return dispatcher === null ? null : dispatcher.getOwner();
65428
- }
65429
- function UnknownOwner() {
65430
- return Error("react-stack-top-frame");
65431
- }
65432
- function hasValidKey(config) {
65433
- if (hasOwnProperty.call(config, "key")) {
65434
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
65435
- if (getter && getter.isReactWarning)
65436
- return false;
65437
- }
65438
- return config.key !== undefined;
65439
- }
65440
- function defineKeyPropWarningGetter(props, displayName) {
65441
- function warnAboutAccessingKey() {
65442
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
65443
- }
65444
- warnAboutAccessingKey.isReactWarning = true;
65445
- Object.defineProperty(props, "key", {
65446
- get: warnAboutAccessingKey,
65447
- configurable: true
65448
- });
65449
- }
65450
- function elementRefGetterWithDeprecationWarning() {
65451
- var componentName = getComponentNameFromType(this.type);
65452
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
65453
- componentName = this.props.ref;
65454
- return componentName !== undefined ? componentName : null;
65455
- }
65456
- function ReactElement(type, key2, self2, source, owner, props, debugStack, debugTask) {
65457
- self2 = props.ref;
65458
- type = {
65459
- $$typeof: REACT_ELEMENT_TYPE,
65460
- type,
65461
- key: key2,
65462
- props,
65463
- _owner: owner
65464
- };
65465
- (self2 !== undefined ? self2 : null) !== null ? Object.defineProperty(type, "ref", {
65466
- enumerable: false,
65467
- get: elementRefGetterWithDeprecationWarning
65468
- }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
65469
- type._store = {};
65470
- Object.defineProperty(type._store, "validated", {
65471
- configurable: false,
65472
- enumerable: false,
65473
- writable: true,
65474
- value: 0
65475
- });
65476
- Object.defineProperty(type, "_debugInfo", {
65477
- configurable: false,
65478
- enumerable: false,
65479
- writable: true,
65480
- value: null
65481
- });
65482
- Object.defineProperty(type, "_debugStack", {
65483
- configurable: false,
65484
- enumerable: false,
65485
- writable: true,
65486
- value: debugStack
65487
- });
65488
- Object.defineProperty(type, "_debugTask", {
65489
- configurable: false,
65490
- enumerable: false,
65491
- writable: true,
65492
- value: debugTask
65493
- });
65494
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
65495
- return type;
65496
- }
65497
- function cloneAndReplaceKey(oldElement, newKey) {
65498
- newKey = ReactElement(oldElement.type, newKey, undefined, undefined, oldElement._owner, oldElement.props, oldElement._debugStack, oldElement._debugTask);
65499
- oldElement._store && (newKey._store.validated = oldElement._store.validated);
65500
- return newKey;
65501
- }
65502
- function isValidElement(object) {
65503
- return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
65504
- }
65505
- function escape3(key2) {
65506
- var escaperLookup = { "=": "=0", ":": "=2" };
65507
- return "$" + key2.replace(/[=:]/g, function(match) {
65508
- return escaperLookup[match];
65509
- });
65510
- }
65511
- function getElementKey(element, index) {
65512
- return typeof element === "object" && element !== null && element.key != null ? (checkKeyStringCoercion(element.key), escape3("" + element.key)) : index.toString(36);
65513
- }
65514
- function noop$1() {}
65515
- function resolveThenable(thenable) {
65516
- switch (thenable.status) {
65517
- case "fulfilled":
65518
- return thenable.value;
65519
- case "rejected":
65520
- throw thenable.reason;
65521
- default:
65522
- switch (typeof thenable.status === "string" ? thenable.then(noop$1, noop$1) : (thenable.status = "pending", thenable.then(function(fulfilledValue) {
65523
- thenable.status === "pending" && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
65524
- }, function(error) {
65525
- thenable.status === "pending" && (thenable.status = "rejected", thenable.reason = error);
65526
- })), thenable.status) {
65527
- case "fulfilled":
65528
- return thenable.value;
65529
- case "rejected":
65530
- throw thenable.reason;
65531
- }
65532
- }
65533
- throw thenable;
65534
- }
65535
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
65536
- var type = typeof children;
65537
- if (type === "undefined" || type === "boolean")
65538
- children = null;
65539
- var invokeCallback = false;
65540
- if (children === null)
65541
- invokeCallback = true;
65542
- else
65543
- switch (type) {
65544
- case "bigint":
65545
- case "string":
65546
- case "number":
65547
- invokeCallback = true;
65548
- break;
65549
- case "object":
65550
- switch (children.$$typeof) {
65551
- case REACT_ELEMENT_TYPE:
65552
- case REACT_PORTAL_TYPE:
65553
- invokeCallback = true;
65554
- break;
65555
- case REACT_LAZY_TYPE:
65556
- return invokeCallback = children._init, mapIntoArray(invokeCallback(children._payload), array, escapedPrefix, nameSoFar, callback);
65557
- }
65558
- }
65559
- if (invokeCallback) {
65560
- invokeCallback = children;
65561
- callback = callback(invokeCallback);
65562
- var childKey = nameSoFar === "" ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
65563
- isArrayImpl(callback) ? (escapedPrefix = "", childKey != null && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c3) {
65564
- return c3;
65565
- })) : callback != null && (isValidElement(callback) && (callback.key != null && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(callback, escapedPrefix + (callback.key == null || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(userProvidedKeyEscapeRegex, "$&/") + "/") + childKey), nameSoFar !== "" && invokeCallback != null && isValidElement(invokeCallback) && invokeCallback.key == null && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
65566
- return 1;
65567
- }
65568
- invokeCallback = 0;
65569
- childKey = nameSoFar === "" ? "." : nameSoFar + ":";
65570
- if (isArrayImpl(children))
65571
- for (var i2 = 0;i2 < children.length; i2++)
65572
- nameSoFar = children[i2], type = childKey + getElementKey(nameSoFar, i2), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
65573
- else if (i2 = getIteratorFn(children), typeof i2 === "function")
65574
- for (i2 === children.entries && (didWarnAboutMaps || console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."), didWarnAboutMaps = true), children = i2.call(children), i2 = 0;!(nameSoFar = children.next()).done; )
65575
- nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i2++), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
65576
- else if (type === "object") {
65577
- if (typeof children.then === "function")
65578
- return mapIntoArray(resolveThenable(children), array, escapedPrefix, nameSoFar, callback);
65579
- array = String(children);
65580
- throw Error("Objects are not valid as a React child (found: " + (array === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead.");
65581
- }
65582
- return invokeCallback;
65583
- }
65584
- function mapChildren(children, func, context2) {
65585
- if (children == null)
65586
- return children;
65587
- var result = [], count2 = 0;
65588
- mapIntoArray(children, result, "", "", function(child) {
65589
- return func.call(context2, child, count2++);
65590
- });
65591
- return result;
65592
- }
65593
- function lazyInitializer(payload) {
65594
- if (payload._status === -1) {
65595
- var ctor = payload._result;
65596
- ctor = ctor();
65597
- ctor.then(function(moduleObject) {
65598
- if (payload._status === 0 || payload._status === -1)
65599
- payload._status = 1, payload._result = moduleObject;
65600
- }, function(error) {
65601
- if (payload._status === 0 || payload._status === -1)
65602
- payload._status = 2, payload._result = error;
65603
- });
65604
- payload._status === -1 && (payload._status = 0, payload._result = ctor);
65605
- }
65606
- if (payload._status === 1)
65607
- return ctor = payload._result, ctor === undefined && console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
65608
-
65609
- Your code should look like:
65610
- const MyComponent = lazy(() => import('./MyComponent'))
65611
-
65612
- Did you accidentally put curly braces around the import?`, ctor), "default" in ctor || console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
65613
-
65614
- Your code should look like:
65615
- const MyComponent = lazy(() => import('./MyComponent'))`, ctor), ctor.default;
65616
- throw payload._result;
65617
- }
65618
- function resolveDispatcher() {
65619
- var dispatcher = ReactSharedInternals.H;
65620
- dispatcher === null && console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
65621
- 1. You might have mismatching versions of React and the renderer (such as React DOM)
65622
- 2. You might be breaking the Rules of Hooks
65623
- 3. You might have more than one copy of React in the same app
65624
- See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`);
65625
- return dispatcher;
65626
- }
65627
- function noop5() {}
65628
- function enqueueTask(task) {
65629
- if (enqueueTaskImpl === null)
65630
- try {
65631
- var requireString = ("require" + Math.random()).slice(0, 7);
65632
- enqueueTaskImpl = (module && module[requireString]).call(module, "timers").setImmediate;
65633
- } catch (_err) {
65634
- enqueueTaskImpl = function(callback) {
65635
- didWarnAboutMessageChannel === false && (didWarnAboutMessageChannel = true, typeof MessageChannel === "undefined" && console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));
65636
- var channel = new MessageChannel;
65637
- channel.port1.onmessage = callback;
65638
- channel.port2.postMessage(undefined);
65639
- };
65640
- }
65641
- return enqueueTaskImpl(task);
65642
- }
65643
- function aggregateErrors(errors2) {
65644
- return 1 < errors2.length && typeof AggregateError === "function" ? new AggregateError(errors2) : errors2[0];
65645
- }
65646
- function popActScope(prevActQueue, prevActScopeDepth) {
65647
- prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
65648
- actScopeDepth = prevActScopeDepth;
65649
- }
65650
- function recursivelyFlushAsyncActWork(returnValue, resolve7, reject) {
65651
- var queue = ReactSharedInternals.actQueue;
65652
- if (queue !== null)
65653
- if (queue.length !== 0)
65654
- try {
65655
- flushActQueue(queue);
65656
- enqueueTask(function() {
65657
- return recursivelyFlushAsyncActWork(returnValue, resolve7, reject);
65658
- });
65659
- return;
65660
- } catch (error) {
65661
- ReactSharedInternals.thrownErrors.push(error);
65662
- }
65663
- else
65664
- ReactSharedInternals.actQueue = null;
65665
- 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve7(returnValue);
65666
- }
65667
- function flushActQueue(queue) {
65668
- if (!isFlushing) {
65669
- isFlushing = true;
65670
- var i2 = 0;
65671
- try {
65672
- for (;i2 < queue.length; i2++) {
65673
- var callback = queue[i2];
65674
- do {
65675
- ReactSharedInternals.didUsePromise = false;
65676
- var continuation = callback(false);
65677
- if (continuation !== null) {
65678
- if (ReactSharedInternals.didUsePromise) {
65679
- queue[i2] = callback;
65680
- queue.splice(0, i2);
65681
- return;
65682
- }
65683
- callback = continuation;
65684
- } else
65685
- break;
65686
- } while (1);
65687
- }
65688
- queue.length = 0;
65689
- } catch (error) {
65690
- queue.splice(0, i2 + 1), ReactSharedInternals.thrownErrors.push(error);
65691
- } finally {
65692
- isFlushing = false;
65693
- }
65694
- }
65695
- }
65696
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
65697
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler");
65698
- Symbol.for("react.provider");
65699
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
65700
- isMounted: function() {
65701
- return false;
65702
- },
65703
- enqueueForceUpdate: function(publicInstance) {
65704
- warnNoop(publicInstance, "forceUpdate");
65705
- },
65706
- enqueueReplaceState: function(publicInstance) {
65707
- warnNoop(publicInstance, "replaceState");
65708
- },
65709
- enqueueSetState: function(publicInstance) {
65710
- warnNoop(publicInstance, "setState");
65711
- }
65712
- }, assign = Object.assign, emptyObject = {};
65713
- Object.freeze(emptyObject);
65714
- Component.prototype.isReactComponent = {};
65715
- Component.prototype.setState = function(partialState, callback) {
65716
- if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null)
65717
- throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
65718
- this.updater.enqueueSetState(this, partialState, callback, "setState");
65719
- };
65720
- Component.prototype.forceUpdate = function(callback) {
65721
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
65722
- };
65723
- var deprecatedAPIs = {
65724
- isMounted: [
65725
- "isMounted",
65726
- "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
65727
- ],
65728
- replaceState: [
65729
- "replaceState",
65730
- "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
65731
- ]
65732
- }, fnName;
65733
- for (fnName in deprecatedAPIs)
65734
- deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
65735
- ComponentDummy.prototype = Component.prototype;
65736
- deprecatedAPIs = PureComponent2.prototype = new ComponentDummy;
65737
- deprecatedAPIs.constructor = PureComponent2;
65738
- assign(deprecatedAPIs, Component.prototype);
65739
- deprecatedAPIs.isPureReactComponent = true;
65740
- var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = {
65741
- H: null,
65742
- A: null,
65743
- T: null,
65744
- S: null,
65745
- V: null,
65746
- actQueue: null,
65747
- isBatchingLegacy: false,
65748
- didScheduleLegacyUpdate: false,
65749
- didUsePromise: false,
65750
- thrownErrors: [],
65751
- getCurrentStack: null,
65752
- recentlyCreatedOwnerStacks: 0
65753
- }, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
65754
- return null;
65755
- };
65756
- deprecatedAPIs = {
65757
- react_stack_bottom_frame: function(callStackForError) {
65758
- return callStackForError();
65759
- }
65760
- };
65761
- var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
65762
- var didWarnAboutElementRef = {};
65763
- var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(deprecatedAPIs, UnknownOwner)();
65764
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
65765
- var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = typeof reportError === "function" ? reportError : function(error) {
65766
- if (typeof window === "object" && typeof window.ErrorEvent === "function") {
65767
- var event = new window.ErrorEvent("error", {
65768
- bubbles: true,
65769
- cancelable: true,
65770
- message: typeof error === "object" && error !== null && typeof error.message === "string" ? String(error.message) : String(error),
65771
- error
65772
- });
65773
- if (!window.dispatchEvent(event))
65774
- return;
65775
- } else if (typeof process === "object" && typeof process.emit === "function") {
65776
- process.emit("uncaughtException", error);
65777
- return;
65778
- }
65779
- console.error(error);
65780
- }, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = typeof queueMicrotask === "function" ? function(callback) {
65781
- queueMicrotask(function() {
65782
- return queueMicrotask(callback);
65783
- });
65784
- } : enqueueTask;
65785
- deprecatedAPIs = Object.freeze({
65786
- __proto__: null,
65787
- c: function(size) {
65788
- return resolveDispatcher().useMemoCache(size);
65789
- }
65790
- });
65791
- exports.Children = {
65792
- map: mapChildren,
65793
- forEach: function(children, forEachFunc, forEachContext) {
65794
- mapChildren(children, function() {
65795
- forEachFunc.apply(this, arguments);
65796
- }, forEachContext);
65797
- },
65798
- count: function(children) {
65799
- var n2 = 0;
65800
- mapChildren(children, function() {
65801
- n2++;
65802
- });
65803
- return n2;
65804
- },
65805
- toArray: function(children) {
65806
- return mapChildren(children, function(child) {
65807
- return child;
65808
- }) || [];
65809
- },
65810
- only: function(children) {
65811
- if (!isValidElement(children))
65812
- throw Error("React.Children.only expected to receive a single React element child.");
65813
- return children;
65814
- }
65815
- };
65816
- exports.Component = Component;
65817
- exports.Fragment = REACT_FRAGMENT_TYPE;
65818
- exports.Profiler = REACT_PROFILER_TYPE;
65819
- exports.PureComponent = PureComponent2;
65820
- exports.StrictMode = REACT_STRICT_MODE_TYPE;
65821
- exports.Suspense = REACT_SUSPENSE_TYPE;
65822
- exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
65823
- exports.__COMPILER_RUNTIME = deprecatedAPIs;
65824
- exports.act = function(callback) {
65825
- var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
65826
- actScopeDepth++;
65827
- var queue = ReactSharedInternals.actQueue = prevActQueue !== null ? prevActQueue : [], didAwaitActCall = false;
65828
- try {
65829
- var result = callback();
65830
- } catch (error) {
65831
- ReactSharedInternals.thrownErrors.push(error);
65832
- }
65833
- if (0 < ReactSharedInternals.thrownErrors.length)
65834
- throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
65835
- if (result !== null && typeof result === "object" && typeof result.then === "function") {
65836
- var thenable = result;
65837
- queueSeveralMicrotasks(function() {
65838
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
65839
- });
65840
- return {
65841
- then: function(resolve7, reject) {
65842
- didAwaitActCall = true;
65843
- thenable.then(function(returnValue) {
65844
- popActScope(prevActQueue, prevActScopeDepth);
65845
- if (prevActScopeDepth === 0) {
65846
- try {
65847
- flushActQueue(queue), enqueueTask(function() {
65848
- return recursivelyFlushAsyncActWork(returnValue, resolve7, reject);
65849
- });
65850
- } catch (error$0) {
65851
- ReactSharedInternals.thrownErrors.push(error$0);
65852
- }
65853
- if (0 < ReactSharedInternals.thrownErrors.length) {
65854
- var _thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
65855
- ReactSharedInternals.thrownErrors.length = 0;
65856
- reject(_thrownError);
65857
- }
65858
- } else
65859
- resolve7(returnValue);
65860
- }, function(error) {
65861
- popActScope(prevActQueue, prevActScopeDepth);
65862
- 0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
65863
- });
65864
- }
65865
- };
65866
- }
65867
- var returnValue$jscomp$0 = result;
65868
- popActScope(prevActQueue, prevActScopeDepth);
65869
- prevActScopeDepth === 0 && (flushActQueue(queue), queue.length !== 0 && queueSeveralMicrotasks(function() {
65870
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"));
65871
- }), ReactSharedInternals.actQueue = null);
65872
- if (0 < ReactSharedInternals.thrownErrors.length)
65873
- throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
65874
- return {
65875
- then: function(resolve7, reject) {
65876
- didAwaitActCall = true;
65877
- prevActScopeDepth === 0 ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
65878
- return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve7, reject);
65879
- })) : resolve7(returnValue$jscomp$0);
65880
- }
65881
- };
65882
- };
65883
- exports.cache = function(fn) {
65884
- return function() {
65885
- return fn.apply(null, arguments);
65886
- };
65887
- };
65888
- exports.captureOwnerStack = function() {
65889
- var getCurrentStack = ReactSharedInternals.getCurrentStack;
65890
- return getCurrentStack === null ? null : getCurrentStack();
65891
- };
65892
- exports.cloneElement = function(element, config, children) {
65893
- if (element === null || element === undefined)
65894
- throw Error("The argument must be a React element, but you passed " + element + ".");
65895
- var props = assign({}, element.props), key2 = element.key, owner = element._owner;
65896
- if (config != null) {
65897
- var JSCompiler_inline_result;
65898
- a: {
65899
- if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(config, "ref").get) && JSCompiler_inline_result.isReactWarning) {
65900
- JSCompiler_inline_result = false;
65901
- break a;
65902
- }
65903
- JSCompiler_inline_result = config.ref !== undefined;
65904
- }
65905
- JSCompiler_inline_result && (owner = getOwner());
65906
- hasValidKey(config) && (checkKeyStringCoercion(config.key), key2 = "" + config.key);
65907
- for (propName in config)
65908
- !hasOwnProperty.call(config, propName) || propName === "key" || propName === "__self" || propName === "__source" || propName === "ref" && config.ref === undefined || (props[propName] = config[propName]);
65909
- }
65910
- var propName = arguments.length - 2;
65911
- if (propName === 1)
65912
- props.children = children;
65913
- else if (1 < propName) {
65914
- JSCompiler_inline_result = Array(propName);
65915
- for (var i2 = 0;i2 < propName; i2++)
65916
- JSCompiler_inline_result[i2] = arguments[i2 + 2];
65917
- props.children = JSCompiler_inline_result;
65918
- }
65919
- props = ReactElement(element.type, key2, undefined, undefined, owner, props, element._debugStack, element._debugTask);
65920
- for (key2 = 2;key2 < arguments.length; key2++)
65921
- owner = arguments[key2], isValidElement(owner) && owner._store && (owner._store.validated = 1);
65922
- return props;
65923
- };
65924
- exports.createContext = function(defaultValue) {
65925
- defaultValue = {
65926
- $$typeof: REACT_CONTEXT_TYPE,
65927
- _currentValue: defaultValue,
65928
- _currentValue2: defaultValue,
65929
- _threadCount: 0,
65930
- Provider: null,
65931
- Consumer: null
65932
- };
65933
- defaultValue.Provider = defaultValue;
65934
- defaultValue.Consumer = {
65935
- $$typeof: REACT_CONSUMER_TYPE,
65936
- _context: defaultValue
65937
- };
65938
- defaultValue._currentRenderer = null;
65939
- defaultValue._currentRenderer2 = null;
65940
- return defaultValue;
65941
- };
65942
- exports.createElement = function(type, config, children) {
65943
- for (var i2 = 2;i2 < arguments.length; i2++) {
65944
- var node = arguments[i2];
65945
- isValidElement(node) && node._store && (node._store.validated = 1);
65946
- }
65947
- i2 = {};
65948
- node = null;
65949
- if (config != null)
65950
- for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")), hasValidKey(config) && (checkKeyStringCoercion(config.key), node = "" + config.key), config)
65951
- hasOwnProperty.call(config, propName) && propName !== "key" && propName !== "__self" && propName !== "__source" && (i2[propName] = config[propName]);
65952
- var childrenLength = arguments.length - 2;
65953
- if (childrenLength === 1)
65954
- i2.children = children;
65955
- else if (1 < childrenLength) {
65956
- for (var childArray = Array(childrenLength), _i = 0;_i < childrenLength; _i++)
65957
- childArray[_i] = arguments[_i + 2];
65958
- Object.freeze && Object.freeze(childArray);
65959
- i2.children = childArray;
65960
- }
65961
- if (type && type.defaultProps)
65962
- for (propName in childrenLength = type.defaultProps, childrenLength)
65963
- i2[propName] === undefined && (i2[propName] = childrenLength[propName]);
65964
- node && defineKeyPropWarningGetter(i2, typeof type === "function" ? type.displayName || type.name || "Unknown" : type);
65965
- var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
65966
- return ReactElement(type, node, undefined, undefined, getOwner(), i2, propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack, propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
65967
- };
65968
- exports.createRef = function() {
65969
- var refObject = { current: null };
65970
- Object.seal(refObject);
65971
- return refObject;
65972
- };
65973
- exports.forwardRef = function(render2) {
65974
- render2 != null && render2.$$typeof === REACT_MEMO_TYPE ? console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).") : typeof render2 !== "function" ? console.error("forwardRef requires a render function but was given %s.", render2 === null ? "null" : typeof render2) : render2.length !== 0 && render2.length !== 2 && console.error("forwardRef render functions accept exactly two parameters: props and ref. %s", render2.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.");
65975
- render2 != null && render2.defaultProps != null && console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");
65976
- var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render: render2 }, ownName;
65977
- Object.defineProperty(elementType, "displayName", {
65978
- enumerable: false,
65979
- configurable: true,
65980
- get: function() {
65981
- return ownName;
65982
- },
65983
- set: function(name) {
65984
- ownName = name;
65985
- render2.name || render2.displayName || (Object.defineProperty(render2, "name", { value: name }), render2.displayName = name);
65986
- }
65987
- });
65988
- return elementType;
65989
- };
65990
- exports.isValidElement = isValidElement;
65991
- exports.lazy = function(ctor) {
65992
- return {
65993
- $$typeof: REACT_LAZY_TYPE,
65994
- _payload: { _status: -1, _result: ctor },
65995
- _init: lazyInitializer
65996
- };
65997
- };
65998
- exports.memo = function(type, compare) {
65999
- type == null && console.error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
66000
- compare = {
66001
- $$typeof: REACT_MEMO_TYPE,
66002
- type,
66003
- compare: compare === undefined ? null : compare
66004
- };
66005
- var ownName;
66006
- Object.defineProperty(compare, "displayName", {
66007
- enumerable: false,
66008
- configurable: true,
66009
- get: function() {
66010
- return ownName;
66011
- },
66012
- set: function(name) {
66013
- ownName = name;
66014
- type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
66015
- }
66016
- });
66017
- return compare;
66018
- };
66019
- exports.startTransition = function(scope) {
66020
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
66021
- ReactSharedInternals.T = currentTransition;
66022
- currentTransition._updatedFibers = new Set;
66023
- try {
66024
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
66025
- onStartTransitionFinish !== null && onStartTransitionFinish(currentTransition, returnValue);
66026
- typeof returnValue === "object" && returnValue !== null && typeof returnValue.then === "function" && returnValue.then(noop5, reportGlobalError);
66027
- } catch (error) {
66028
- reportGlobalError(error);
66029
- } finally {
66030
- prevTransition === null && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")), ReactSharedInternals.T = prevTransition;
66031
- }
66032
- };
66033
- exports.unstable_useCacheRefresh = function() {
66034
- return resolveDispatcher().useCacheRefresh();
66035
- };
66036
- exports.use = function(usable) {
66037
- return resolveDispatcher().use(usable);
66038
- };
66039
- exports.useActionState = function(action, initialState3, permalink) {
66040
- return resolveDispatcher().useActionState(action, initialState3, permalink);
66041
- };
66042
- exports.useCallback = function(callback, deps) {
66043
- return resolveDispatcher().useCallback(callback, deps);
66044
- };
66045
- exports.useContext = function(Context) {
66046
- var dispatcher = resolveDispatcher();
66047
- Context.$$typeof === REACT_CONSUMER_TYPE && console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?");
66048
- return dispatcher.useContext(Context);
66049
- };
66050
- exports.useDebugValue = function(value, formatterFn) {
66051
- return resolveDispatcher().useDebugValue(value, formatterFn);
66052
- };
66053
- exports.useDeferredValue = function(value, initialValue) {
66054
- return resolveDispatcher().useDeferredValue(value, initialValue);
66055
- };
66056
- exports.useEffect = function(create2, createDeps, update) {
66057
- create2 == null && console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?");
66058
- var dispatcher = resolveDispatcher();
66059
- if (typeof update === "function")
66060
- throw Error("useEffect CRUD overload is not enabled in this build of React.");
66061
- return dispatcher.useEffect(create2, createDeps);
66062
- };
66063
- exports.useId = function() {
66064
- return resolveDispatcher().useId();
66065
- };
66066
- exports.useImperativeHandle = function(ref, create2, deps) {
66067
- return resolveDispatcher().useImperativeHandle(ref, create2, deps);
66068
- };
66069
- exports.useInsertionEffect = function(create2, deps) {
66070
- create2 == null && console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?");
66071
- return resolveDispatcher().useInsertionEffect(create2, deps);
66072
- };
66073
- exports.useLayoutEffect = function(create2, deps) {
66074
- create2 == null && console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?");
66075
- return resolveDispatcher().useLayoutEffect(create2, deps);
66076
- };
66077
- exports.useMemo = function(create2, deps) {
66078
- return resolveDispatcher().useMemo(create2, deps);
66079
- };
66080
- exports.useOptimistic = function(passthrough, reducer) {
66081
- return resolveDispatcher().useOptimistic(passthrough, reducer);
66082
- };
66083
- exports.useReducer = function(reducer, initialArg, init) {
66084
- return resolveDispatcher().useReducer(reducer, initialArg, init);
66085
- };
66086
- exports.useRef = function(initialValue) {
66087
- return resolveDispatcher().useRef(initialValue);
66088
- };
66089
- exports.useState = function(initialState3) {
66090
- return resolveDispatcher().useState(initialState3);
66091
- };
66092
- exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
66093
- return resolveDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
66094
- };
66095
- exports.useTransition = function() {
66096
- return resolveDispatcher().useTransition();
66097
- };
66098
- exports.version = "19.1.1";
66099
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
66100
- })();
66101
- });
66102
-
66103
- // ../node_modules/.pnpm/react@19.1.1/node_modules/react/index.js
66104
- var require_react2 = __commonJS((exports, module) => {
66105
- var react_development = __toESM(require_react_development2());
66106
- if (false) {} else {
66107
- module.exports = react_development;
66108
- }
66109
- });
66110
-
66111
65491
  // ../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js
66112
65492
  var require_cjs = __commonJS((exports, module) => {
66113
65493
  var isMergeableObject = function isMergeableObject2(value) {
@@ -66544,7 +65924,7 @@ var init_theme15 = __esm(() => {
66544
65924
  init_theme12();
66545
65925
  init_theme13();
66546
65926
  init_theme14();
66547
- import_react57 = __toESM(require_react2(), 1);
65927
+ import_react57 = __toESM(require_react(), 1);
66548
65928
  import_deepmerge = __toESM(require_cjs(), 1);
66549
65929
  defaultTheme2 = {
66550
65930
  components: {
@@ -66571,7 +65951,7 @@ var import_react58;
66571
65951
  var init_badge = __esm(async () => {
66572
65952
  init_theme15();
66573
65953
  await init_build2();
66574
- import_react58 = __toESM(require_react2(), 1);
65954
+ import_react58 = __toESM(require_react(), 1);
66575
65955
  });
66576
65956
 
66577
65957
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/badge/index.js
@@ -66584,7 +65964,7 @@ var import_react59;
66584
65964
  var init_confirm_input = __esm(async () => {
66585
65965
  init_theme15();
66586
65966
  await init_build2();
66587
- import_react59 = __toESM(require_react2(), 1);
65967
+ import_react59 = __toESM(require_react(), 1);
66588
65968
  });
66589
65969
 
66590
65970
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/confirm-input/index.js
@@ -66603,7 +65983,7 @@ var init_constants2 = __esm(() => {
66603
65983
  var import_react60, UnorderedListItemContext;
66604
65984
  var init_unordered_list_item_context = __esm(() => {
66605
65985
  init_constants2();
66606
- import_react60 = __toESM(require_react2(), 1);
65986
+ import_react60 = __toESM(require_react(), 1);
66607
65987
  UnorderedListItemContext = import_react60.createContext({
66608
65988
  marker: defaultMarker
66609
65989
  });
@@ -66620,13 +66000,13 @@ var init_unordered_list_item = __esm(async () => {
66620
66000
  init_theme15();
66621
66001
  init_unordered_list_item_context();
66622
66002
  await init_build2();
66623
- import_react61 = __toESM(require_react2(), 1);
66003
+ import_react61 = __toESM(require_react(), 1);
66624
66004
  });
66625
66005
 
66626
66006
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/unordered-list/unordered-list-context.js
66627
66007
  var import_react62, UnorderedListContext;
66628
66008
  var init_unordered_list_context = __esm(() => {
66629
- import_react62 = __toESM(require_react2(), 1);
66009
+ import_react62 = __toESM(require_react(), 1);
66630
66010
  UnorderedListContext = import_react62.createContext({
66631
66011
  depth: 0
66632
66012
  });
@@ -66665,7 +66045,7 @@ var init_unordered_list = __esm(async () => {
66665
66045
  init_build2(),
66666
66046
  init_unordered_list_item()
66667
66047
  ]);
66668
- import_react63 = __toESM(require_react2(), 1);
66048
+ import_react63 = __toESM(require_react(), 1);
66669
66049
  UnorderedList.Item = UnorderedListItem;
66670
66050
  });
66671
66051
 
@@ -66684,7 +66064,7 @@ var init_multi_select_option = __esm(async () => {
66684
66064
  init_figures();
66685
66065
  init_theme15();
66686
66066
  await init_build2();
66687
- import_react64 = __toESM(require_react2(), 1);
66067
+ import_react64 = __toESM(require_react(), 1);
66688
66068
  });
66689
66069
 
66690
66070
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/lib/option-map.js
@@ -66867,7 +66247,7 @@ var import_react65, reducer = (state, action) => {
66867
66247
  };
66868
66248
  var init_use_multi_select_state = __esm(() => {
66869
66249
  init_option_map();
66870
- import_react65 = __toESM(require_react2(), 1);
66250
+ import_react65 = __toESM(require_react(), 1);
66871
66251
  });
66872
66252
 
66873
66253
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/multi-select/use-multi-select.js
@@ -66920,7 +66300,7 @@ var init_multi_select = __esm(async () => {
66920
66300
  init_multi_select_option(),
66921
66301
  init_use_multi_select()
66922
66302
  ]);
66923
- import_react66 = __toESM(require_react2(), 1);
66303
+ import_react66 = __toESM(require_react(), 1);
66924
66304
  });
66925
66305
 
66926
66306
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/multi-select/index.js
@@ -66948,7 +66328,7 @@ var import_react67;
66948
66328
  var init_progress_bar = __esm(async () => {
66949
66329
  init_theme15();
66950
66330
  await init_build2();
66951
- import_react67 = __toESM(require_react2(), 1);
66331
+ import_react67 = __toESM(require_react(), 1);
66952
66332
  });
66953
66333
 
66954
66334
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/progress-bar/index.js
@@ -66957,190 +66337,26 @@ var init_progress_bar2 = __esm(async () => {
66957
66337
  });
66958
66338
 
66959
66339
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/select/select-option.js
66960
- function SelectOption({ isFocused, isSelected, children }) {
66961
- const { styles: styles7 } = useComponentTheme("Select");
66962
- return import_react68.default.createElement(Box_default, { ...styles7.option({ isFocused }) }, isFocused && import_react68.default.createElement(Text, { ...styles7.focusIndicator() }, figures_default.pointer), import_react68.default.createElement(Text, { ...styles7.label({ isFocused, isSelected }) }, children), isSelected && import_react68.default.createElement(Text, { ...styles7.selectedIndicator() }, figures_default.tick));
66963
- }
66964
66340
  var import_react68;
66965
66341
  var init_select_option = __esm(async () => {
66966
- init_figures();
66967
66342
  init_theme15();
66968
66343
  await init_build2();
66969
- import_react68 = __toESM(require_react2(), 1);
66344
+ import_react68 = __toESM(require_react(), 1);
66970
66345
  });
66971
66346
 
66972
66347
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/select/use-select-state.js
66973
- import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
66974
- var import_react69, reducer2 = (state, action) => {
66975
- switch (action.type) {
66976
- case "focus-next-option": {
66977
- if (!state.focusedValue) {
66978
- return state;
66979
- }
66980
- const item = state.optionMap.get(state.focusedValue);
66981
- if (!item) {
66982
- return state;
66983
- }
66984
- const next = item.next;
66985
- if (!next) {
66986
- return state;
66987
- }
66988
- const needsToScroll = next.index >= state.visibleToIndex;
66989
- if (!needsToScroll) {
66990
- return {
66991
- ...state,
66992
- focusedValue: next.value
66993
- };
66994
- }
66995
- const nextVisibleToIndex = Math.min(state.optionMap.size, state.visibleToIndex + 1);
66996
- const nextVisibleFromIndex = nextVisibleToIndex - state.visibleOptionCount;
66997
- return {
66998
- ...state,
66999
- focusedValue: next.value,
67000
- visibleFromIndex: nextVisibleFromIndex,
67001
- visibleToIndex: nextVisibleToIndex
67002
- };
67003
- }
67004
- case "focus-previous-option": {
67005
- if (!state.focusedValue) {
67006
- return state;
67007
- }
67008
- const item = state.optionMap.get(state.focusedValue);
67009
- if (!item) {
67010
- return state;
67011
- }
67012
- const previous = item.previous;
67013
- if (!previous) {
67014
- return state;
67015
- }
67016
- const needsToScroll = previous.index <= state.visibleFromIndex;
67017
- if (!needsToScroll) {
67018
- return {
67019
- ...state,
67020
- focusedValue: previous.value
67021
- };
67022
- }
67023
- const nextVisibleFromIndex = Math.max(0, state.visibleFromIndex - 1);
67024
- const nextVisibleToIndex = nextVisibleFromIndex + state.visibleOptionCount;
67025
- return {
67026
- ...state,
67027
- focusedValue: previous.value,
67028
- visibleFromIndex: nextVisibleFromIndex,
67029
- visibleToIndex: nextVisibleToIndex
67030
- };
67031
- }
67032
- case "select-focused-option": {
67033
- return {
67034
- ...state,
67035
- previousValue: state.value,
67036
- value: state.focusedValue
67037
- };
67038
- }
67039
- case "reset": {
67040
- return action.state;
67041
- }
67042
- }
67043
- }, createDefaultState2 = ({ visibleOptionCount: customVisibleOptionCount, defaultValue, options }) => {
67044
- const visibleOptionCount = typeof customVisibleOptionCount === "number" ? Math.min(customVisibleOptionCount, options.length) : options.length;
67045
- const optionMap = new OptionMap(options);
67046
- return {
67047
- optionMap,
67048
- visibleOptionCount,
67049
- focusedValue: optionMap.first?.value,
67050
- visibleFromIndex: 0,
67051
- visibleToIndex: visibleOptionCount,
67052
- previousValue: defaultValue,
67053
- value: defaultValue
67054
- };
67055
- }, useSelectState = ({ visibleOptionCount = 5, options, defaultValue, onChange }) => {
67056
- const [state, dispatch] = import_react69.useReducer(reducer2, { visibleOptionCount, defaultValue, options }, createDefaultState2);
67057
- const [lastOptions, setLastOptions] = import_react69.useState(options);
67058
- if (options !== lastOptions && !isDeepStrictEqual3(options, lastOptions)) {
67059
- dispatch({
67060
- type: "reset",
67061
- state: createDefaultState2({ visibleOptionCount, defaultValue, options })
67062
- });
67063
- setLastOptions(options);
67064
- }
67065
- const focusNextOption = import_react69.useCallback(() => {
67066
- dispatch({
67067
- type: "focus-next-option"
67068
- });
67069
- }, []);
67070
- const focusPreviousOption = import_react69.useCallback(() => {
67071
- dispatch({
67072
- type: "focus-previous-option"
67073
- });
67074
- }, []);
67075
- const selectFocusedOption = import_react69.useCallback(() => {
67076
- dispatch({
67077
- type: "select-focused-option"
67078
- });
67079
- }, []);
67080
- const visibleOptions = import_react69.useMemo(() => {
67081
- return options.map((option, index) => ({
67082
- ...option,
67083
- index
67084
- })).slice(state.visibleFromIndex, state.visibleToIndex);
67085
- }, [options, state.visibleFromIndex, state.visibleToIndex]);
67086
- import_react69.useEffect(() => {
67087
- if (state.value && state.previousValue !== state.value) {
67088
- onChange?.(state.value);
67089
- }
67090
- }, [state.previousValue, state.value, options, onChange]);
67091
- return {
67092
- focusedValue: state.focusedValue,
67093
- visibleFromIndex: state.visibleFromIndex,
67094
- visibleToIndex: state.visibleToIndex,
67095
- value: state.value,
67096
- visibleOptions,
67097
- focusNextOption,
67098
- focusPreviousOption,
67099
- selectFocusedOption
67100
- };
67101
- };
66348
+ var import_react69;
67102
66349
  var init_use_select_state = __esm(() => {
67103
66350
  init_option_map();
67104
- import_react69 = __toESM(require_react2(), 1);
66351
+ import_react69 = __toESM(require_react(), 1);
67105
66352
  });
67106
66353
 
67107
66354
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/select/use-select.js
67108
- var useSelect = ({ isDisabled = false, state }) => {
67109
- use_input_default((_input, key2) => {
67110
- if (key2.downArrow) {
67111
- state.focusNextOption();
67112
- }
67113
- if (key2.upArrow) {
67114
- state.focusPreviousOption();
67115
- }
67116
- if (key2.return) {
67117
- state.selectFocusedOption();
67118
- }
67119
- }, { isActive: !isDisabled });
67120
- };
67121
66355
  var init_use_select = __esm(async () => {
67122
66356
  await init_build2();
67123
66357
  });
67124
66358
 
67125
66359
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/select/select.js
67126
- function Select({ isDisabled = false, visibleOptionCount = 5, highlightText, options, defaultValue, onChange }) {
67127
- const state = useSelectState({
67128
- visibleOptionCount,
67129
- options,
67130
- defaultValue,
67131
- onChange
67132
- });
67133
- useSelect({ isDisabled, state });
67134
- const { styles: styles7 } = useComponentTheme("Select");
67135
- return import_react70.default.createElement(Box_default, { ...styles7.container() }, state.visibleOptions.map((option) => {
67136
- let label = option.label;
67137
- if (highlightText && option.label.includes(highlightText)) {
67138
- const index = option.label.indexOf(highlightText);
67139
- label = import_react70.default.createElement(import_react70.default.Fragment, null, option.label.slice(0, index), import_react70.default.createElement(Text, { ...styles7.highlightedText() }, highlightText), option.label.slice(index + highlightText.length));
67140
- }
67141
- return import_react70.default.createElement(SelectOption, { key: option.value, isFocused: !isDisabled && state.focusedValue === option.value, isSelected: state.value === option.value }, label);
67142
- }));
67143
- }
67144
66360
  var import_react70;
67145
66361
  var init_select = __esm(async () => {
67146
66362
  init_theme15();
@@ -67150,7 +66366,7 @@ var init_select = __esm(async () => {
67150
66366
  init_select_option(),
67151
66367
  init_use_select()
67152
66368
  ]);
67153
- import_react70 = __toESM(require_react2(), 1);
66369
+ import_react70 = __toESM(require_react(), 1);
67154
66370
  });
67155
66371
 
67156
66372
  // ../node_modules/.pnpm/cli-spinners@3.4.0/node_modules/cli-spinners/spinners.json
@@ -68885,7 +68101,7 @@ function useSpinner({ type = "dots" }) {
68885
68101
  var import_react71;
68886
68102
  var init_use_spinner = __esm(() => {
68887
68103
  init_cli_spinners();
68888
- import_react71 = __toESM(require_react2(), 1);
68104
+ import_react71 = __toESM(require_react(), 1);
68889
68105
  });
68890
68106
 
68891
68107
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/spinner/spinner.js
@@ -68899,7 +68115,7 @@ var init_spinner = __esm(async () => {
68899
68115
  init_theme15();
68900
68116
  init_use_spinner();
68901
68117
  await init_build2();
68902
- import_react72 = __toESM(require_react2(), 1);
68118
+ import_react72 = __toESM(require_react(), 1);
68903
68119
  });
68904
68120
 
68905
68121
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/spinner/index.js
@@ -68909,7 +68125,7 @@ var init_spinner2 = __esm(async () => {
68909
68125
  });
68910
68126
 
68911
68127
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/text-input/use-text-input-state.js
68912
- var import_react73, reducer3 = (state, action) => {
68128
+ var import_react73, reducer2 = (state, action) => {
68913
68129
  switch (action.type) {
68914
68130
  case "move-cursor-left": {
68915
68131
  return {
@@ -68942,7 +68158,7 @@ var import_react73, reducer3 = (state, action) => {
68942
68158
  }
68943
68159
  }
68944
68160
  }, useTextInputState = ({ defaultValue = "", suggestions, onChange, onSubmit }) => {
68945
- const [state, dispatch] = import_react73.useReducer(reducer3, {
68161
+ const [state, dispatch] = import_react73.useReducer(reducer2, {
68946
68162
  previousValue: defaultValue,
68947
68163
  value: defaultValue,
68948
68164
  cursorOffset: defaultValue.length
@@ -68998,7 +68214,7 @@ var import_react73, reducer3 = (state, action) => {
68998
68214
  };
68999
68215
  };
69000
68216
  var init_use_text_input_state = __esm(() => {
69001
- import_react73 = __toESM(require_react2(), 1);
68217
+ import_react73 = __toESM(require_react(), 1);
69002
68218
  });
69003
68219
 
69004
68220
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/text-input/use-text-input.js
@@ -69057,7 +68273,7 @@ var import_react74, cursor, useTextInput = ({ isDisabled = false, state, placeho
69057
68273
  var init_use_text_input = __esm(async () => {
69058
68274
  init_source2();
69059
68275
  await init_build2();
69060
- import_react74 = __toESM(require_react2(), 1);
68276
+ import_react74 = __toESM(require_react(), 1);
69061
68277
  cursor = source_default2.inverse(" ");
69062
68278
  });
69063
68279
 
@@ -69085,7 +68301,7 @@ var init_text_input = __esm(async () => {
69085
68301
  init_build2(),
69086
68302
  init_use_text_input()
69087
68303
  ]);
69088
- import_react75 = __toESM(require_react2(), 1);
68304
+ import_react75 = __toESM(require_react(), 1);
69089
68305
  });
69090
68306
 
69091
68307
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/text-input/index.js
@@ -69097,7 +68313,7 @@ var init_text_input2 = __esm(async () => {
69097
68313
  var import_react76, OrderedListItemContext;
69098
68314
  var init_ordered_list_item_context = __esm(() => {
69099
68315
  init_figures();
69100
- import_react76 = __toESM(require_react2(), 1);
68316
+ import_react76 = __toESM(require_react(), 1);
69101
68317
  OrderedListItemContext = import_react76.createContext({
69102
68318
  marker: figures_default.line
69103
68319
  });
@@ -69114,13 +68330,13 @@ var init_ordered_list_item = __esm(async () => {
69114
68330
  init_theme15();
69115
68331
  init_ordered_list_item_context();
69116
68332
  await init_build2();
69117
- import_react77 = __toESM(require_react2(), 1);
68333
+ import_react77 = __toESM(require_react(), 1);
69118
68334
  });
69119
68335
 
69120
68336
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/ordered-list/ordered-list-context.js
69121
68337
  var import_react78, OrderedListContext;
69122
68338
  var init_ordered_list_context = __esm(() => {
69123
- import_react78 = __toESM(require_react2(), 1);
68339
+ import_react78 = __toESM(require_react(), 1);
69124
68340
  OrderedListContext = import_react78.createContext({
69125
68341
  marker: ""
69126
68342
  });
@@ -69156,7 +68372,7 @@ var init_ordered_list = __esm(async () => {
69156
68372
  init_build2(),
69157
68373
  init_ordered_list_item()
69158
68374
  ]);
69159
- import_react79 = __toESM(require_react2(), 1);
68375
+ import_react79 = __toESM(require_react(), 1);
69160
68376
  OrderedList.Item = OrderedListItem;
69161
68377
  });
69162
68378
 
@@ -69168,7 +68384,7 @@ var init_ordered_list2 = __esm(async () => {
69168
68384
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/password-input/use-password-input-state.js
69169
68385
  var import_react80;
69170
68386
  var init_use_password_input_state = __esm(() => {
69171
- import_react80 = __toESM(require_react2(), 1);
68387
+ import_react80 = __toESM(require_react(), 1);
69172
68388
  });
69173
68389
 
69174
68390
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/password-input/use-password-input.js
@@ -69176,7 +68392,7 @@ var import_react81, cursor2;
69176
68392
  var init_use_password_input = __esm(async () => {
69177
68393
  init_source2();
69178
68394
  await init_build2();
69179
- import_react81 = __toESM(require_react2(), 1);
68395
+ import_react81 = __toESM(require_react(), 1);
69180
68396
  cursor2 = source_default2.inverse(" ");
69181
68397
  });
69182
68398
 
@@ -69189,7 +68405,7 @@ var init_password_input = __esm(async () => {
69189
68405
  init_build2(),
69190
68406
  init_use_password_input()
69191
68407
  ]);
69192
- import_react82 = __toESM(require_react2(), 1);
68408
+ import_react82 = __toESM(require_react(), 1);
69193
68409
  });
69194
68410
 
69195
68411
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/password-input/index.js
@@ -69202,7 +68418,7 @@ var import_react83;
69202
68418
  var init_status_message = __esm(async () => {
69203
68419
  init_theme15();
69204
68420
  await init_build2();
69205
- import_react83 = __toESM(require_react2(), 1);
68421
+ import_react83 = __toESM(require_react(), 1);
69206
68422
  });
69207
68423
 
69208
68424
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/status-message/index.js
@@ -69215,7 +68431,7 @@ var import_react84;
69215
68431
  var init_alert = __esm(async () => {
69216
68432
  init_theme15();
69217
68433
  await init_build2();
69218
- import_react84 = __toESM(require_react2(), 1);
68434
+ import_react84 = __toESM(require_react(), 1);
69219
68435
  });
69220
68436
 
69221
68437
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/alert/index.js
@@ -69226,7 +68442,7 @@ var init_alert2 = __esm(async () => {
69226
68442
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/email-input/use-email-input-state.js
69227
68443
  var import_react85;
69228
68444
  var init_use_email_input_state = __esm(() => {
69229
- import_react85 = __toESM(require_react2(), 1);
68445
+ import_react85 = __toESM(require_react(), 1);
69230
68446
  });
69231
68447
 
69232
68448
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/email-input/use-email-input.js
@@ -69234,7 +68450,7 @@ var import_react86, cursor3;
69234
68450
  var init_use_email_input = __esm(async () => {
69235
68451
  init_source2();
69236
68452
  await init_build2();
69237
- import_react86 = __toESM(require_react2(), 1);
68453
+ import_react86 = __toESM(require_react(), 1);
69238
68454
  cursor3 = source_default2.inverse(" ");
69239
68455
  });
69240
68456
 
@@ -69247,7 +68463,7 @@ var init_email_input = __esm(async () => {
69247
68463
  init_build2(),
69248
68464
  init_use_email_input()
69249
68465
  ]);
69250
- import_react87 = __toESM(require_react2(), 1);
68466
+ import_react87 = __toESM(require_react(), 1);
69251
68467
  });
69252
68468
 
69253
68469
  // ../node_modules/.pnpm/@inkjs+ui@2.0.0_ink@6.6.0_@types+react@19.2.7_react-devtools-core@6.1.5_react@19.2.3_/node_modules/@inkjs/ui/build/components/email-input/index.js
@@ -80276,7 +79492,7 @@ var init_uint8array_extras = __esm(() => {
80276
79492
  });
80277
79493
 
80278
79494
  // ../node_modules/.pnpm/conf@13.1.0/node_modules/conf/dist/source/index.js
80279
- import { isDeepStrictEqual as isDeepStrictEqual4 } from "node:util";
79495
+ import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
80280
79496
  import process38 from "node:process";
80281
79497
  import fs17 from "node:fs";
80282
79498
  import path17 from "node:path";
@@ -80514,7 +79730,7 @@ var init_source4 = __esm(() => {
80514
79730
  const onChange = () => {
80515
79731
  const oldValue = currentValue;
80516
79732
  const newValue = getter();
80517
- if (isDeepStrictEqual4(newValue, oldValue)) {
79733
+ if (isDeepStrictEqual3(newValue, oldValue)) {
80518
79734
  return;
80519
79735
  }
80520
79736
  currentValue = newValue;
@@ -80823,7 +80039,7 @@ function HeadlessInitFlow() {
80823
80039
  /* @__PURE__ */ jsx_dev_runtime43.jsxDEV(Text, {
80824
80040
  children: "Checking authentication..."
80825
80041
  }, undefined, false, undefined, this),
80826
- authState === "waiting" && /* @__PURE__ */ jsx_dev_runtime43.jsxDEV(Text, {
80042
+ authState === "authenticating" && /* @__PURE__ */ jsx_dev_runtime43.jsxDEV(Text, {
80827
80043
  dimColor: true,
80828
80044
  children: "Waiting for authentication... (timeout: 5 minutes)"
80829
80045
  }, undefined, false, undefined, this),
@@ -83489,7 +82705,7 @@ class CustomersController {
83489
82705
  offset
83490
82706
  };
83491
82707
  if (this.searchQuery.trim()) {
83492
- body.search = this.searchQuery.trim();
82708
+ body["search"] = this.searchQuery.trim();
83493
82709
  }
83494
82710
  const response = await request({
83495
82711
  method: "POST",
@@ -83532,7 +82748,7 @@ class CustomersController {
83532
82748
  selectByIndex(index) {
83533
82749
  if (index >= 0 && index < this.items.length) {
83534
82750
  this.selectedIndex = index;
83535
- return this.items[index];
82751
+ return this.items[index] ?? null;
83536
82752
  }
83537
82753
  return null;
83538
82754
  }
@@ -83540,21 +82756,21 @@ class CustomersController {
83540
82756
  const index = this.items.findIndex((c3) => c3.id === id);
83541
82757
  if (index !== -1) {
83542
82758
  this.selectedIndex = index;
83543
- return this.items[index];
82759
+ return this.items[index] ?? null;
83544
82760
  }
83545
82761
  return null;
83546
82762
  }
83547
82763
  selectPrev() {
83548
82764
  if (this.selectedIndex > 0) {
83549
82765
  this.selectedIndex--;
83550
- return this.items[this.selectedIndex];
82766
+ return this.items[this.selectedIndex] ?? null;
83551
82767
  }
83552
82768
  return null;
83553
82769
  }
83554
82770
  selectNext() {
83555
82771
  if (this.selectedIndex < this.items.length - 1) {
83556
82772
  this.selectedIndex++;
83557
- return this.items[this.selectedIndex];
82773
+ return this.items[this.selectedIndex] ?? null;
83558
82774
  }
83559
82775
  return null;
83560
82776
  }
@@ -83839,12 +83055,12 @@ function outputSingleCustomer(customer, format2) {
83839
83055
  const featureName = balance.feature?.name ?? balance.feature_id;
83840
83056
  if (balance.unlimited) {
83841
83057
  console.log(` - ${featureName}: Unlimited`);
83842
- } else if (balance.balance !== undefined) {
83843
- const used = balance.used ?? 0;
83844
- const total = balance.balance;
83058
+ } else if (balance.feature?.type !== "boolean") {
83059
+ const used = balance.usage;
83060
+ const total = balance.current_balance;
83845
83061
  console.log(` - ${featureName}: ${used}/${total} used`);
83846
83062
  } else {
83847
- console.log(` - ${featureName}: ${balance.enabled ? "ON" : "OFF"}`);
83063
+ console.log(` - ${featureName}: ON`);
83848
83064
  }
83849
83065
  }
83850
83066
  }
@@ -85700,22 +84916,23 @@ var formatAmount = ({
85700
84916
  return `${firstAmount} - ${lastAmount}`;
85701
84917
  };
85702
84918
 
85703
- // src/commands/preview/planFeatureToItem.ts
84919
+ // src/commands/preview/planItemToItem.ts
85704
84920
  var planFeatureToItem = ({
85705
84921
  planFeature
85706
84922
  }) => {
85707
- const pf = planFeature;
85708
- const includedValue = planFeature.included ?? pf.granted;
84923
+ const pi = planFeature;
84924
+ const includedValue = planFeature.included ?? pi.granted;
85709
84925
  const interval = planFeature.reset?.interval ?? planFeature.price?.interval ?? null;
85710
- const intervalCount = planFeature.reset?.interval_count ?? planFeature.price?.interval_count ?? null;
84926
+ const priceWithInterval = planFeature.price;
84927
+ const intervalCount = planFeature.reset?.intervalCount ?? priceWithInterval?.intervalCount ?? null;
85711
84928
  return {
85712
- feature_id: planFeature.feature_id,
84929
+ feature_id: planFeature.featureId,
85713
84930
  included_usage: planFeature.unlimited ? "inf" : includedValue ?? null,
85714
84931
  interval,
85715
84932
  interval_count: intervalCount,
85716
84933
  price: planFeature.price?.amount ?? null,
85717
84934
  tiers: planFeature.price?.tiers ?? null,
85718
- billing_units: planFeature.price?.billing_units ?? null
84935
+ billing_units: planFeature.price?.billingUnits ?? null
85719
84936
  };
85720
84937
  }, featureToDisplayFeature = ({
85721
84938
  feature
@@ -85878,15 +85095,15 @@ var getIntervalDisplay = (item) => {
85878
85095
  }
85879
85096
  }
85880
85097
  let freeTrial;
85881
- if (plan.free_trial) {
85882
- const { duration_length, duration_type } = plan.free_trial;
85883
- const durationUnit = duration_length === 1 ? duration_type : `${duration_type}s`;
85884
- freeTrial = `${duration_length} ${durationUnit} free trial`;
85098
+ if (plan.freeTrial) {
85099
+ const { durationLength, durationType } = plan.freeTrial;
85100
+ const durationUnit = durationLength === 1 ? durationType : `${durationType}s`;
85101
+ freeTrial = `${durationLength} ${durationUnit} free trial`;
85885
85102
  }
85886
85103
  const featureDisplays = [];
85887
85104
  if (plan.items) {
85888
85105
  for (const planFeature of plan.items) {
85889
- const feature = features5.find((f) => f.id === planFeature.feature_id);
85106
+ const feature = features5.find((f) => f.id === planFeature.featureId);
85890
85107
  if (feature) {
85891
85108
  const display = getPlanFeatureDisplay({
85892
85109
  planFeature,
@@ -85896,7 +85113,7 @@ var getIntervalDisplay = (item) => {
85896
85113
  featureDisplays.push(display);
85897
85114
  } else {
85898
85115
  featureDisplays.push({
85899
- primary_text: planFeature.feature_id
85116
+ primary_text: planFeature.featureId
85900
85117
  });
85901
85118
  }
85902
85119
  }
@@ -87013,6 +86230,8 @@ function renderStackedChart(list, binSize) {
87013
86230
  let foundGroup = false;
87014
86231
  for (let i2 = 0;i2 < groupKeys.length; i2++) {
87015
86232
  const groupKey = groupKeys[i2];
86233
+ if (!groupKey)
86234
+ continue;
87016
86235
  const groupVal = bucket.groupValues[groupKey] ?? 0;
87017
86236
  const prevCumulative = cumulative;
87018
86237
  cumulative += groupVal;
@@ -87418,7 +86637,7 @@ function useChartDimensions() {
87418
86637
  return { maxBarHeight, maxBuckets };
87419
86638
  }
87420
86639
  function getGroupColor(index) {
87421
- return GROUP_COLORS2[index % GROUP_COLORS2.length];
86640
+ return GROUP_COLORS2[index % GROUP_COLORS2.length] ?? "blue";
87422
86641
  }
87423
86642
  function hasGroupedData(data) {
87424
86643
  return data.some((bucket) => Object.keys(bucket.groupedValues).length > 0);
@@ -87579,6 +86798,8 @@ function StackedChart({
87579
86798
  let foundColor = "gray";
87580
86799
  for (let i2 = 0;i2 < groupKeys.length; i2++) {
87581
86800
  const groupKey = groupKeys[i2];
86801
+ if (!groupKey)
86802
+ continue;
87582
86803
  const groupVal = bucket.groupTotals[groupKey] ?? 0;
87583
86804
  const prevCumulative = cumulative;
87584
86805
  cumulative += groupVal;
@@ -88289,24 +87510,27 @@ function EventsView({
88289
87510
  };
88290
87511
  const titleBarItems = [];
88291
87512
  titleBarItems.push({
88292
- label: viewMode === "aggregate" ? "Aggregate" : "List",
87513
+ label: "View",
87514
+ value: viewMode === "aggregate" ? "Aggregate" : "List",
88293
87515
  color: viewMode === "aggregate" ? "yellow" : "white"
88294
87516
  });
88295
87517
  if (viewMode === "aggregate") {
88296
87518
  const binSizeLabel = BIN_SIZE_OPTIONS.find((t) => t.value === binSize)?.label ?? binSize;
88297
87519
  titleBarItems.push({
88298
- label: binSizeLabel,
87520
+ label: "Bin",
87521
+ value: binSizeLabel,
88299
87522
  color: "cyan"
88300
87523
  });
88301
87524
  }
88302
87525
  if (hasActiveFilters || cliCustomerId || cliFeatureId) {
88303
87526
  titleBarItems.push({
88304
- label: "Filtered",
87527
+ label: "Filter",
87528
+ value: "active",
88305
87529
  color: "cyan"
88306
87530
  });
88307
87531
  }
88308
87532
  const showFilterPanel = isFilterOpen;
88309
- const showDetailSheet = state.sheetOpen && state.selectedItem && !isFilterOpen && viewMode === "list";
87533
+ const showDetailSheet = state.sheetOpen && !!state.selectedItem && !isFilterOpen && viewMode === "list";
88310
87534
  const sideOpen = showFilterPanel || showDetailSheet;
88311
87535
  const getAggregatePaginationText = () => {
88312
87536
  try {
@@ -88429,7 +87653,7 @@ function EventsView({
88429
87653
  }, undefined, true, undefined, this)
88430
87654
  ]
88431
87655
  }, undefined, true, undefined, this) : showDetailSheet ? /* @__PURE__ */ jsx_dev_runtime77.jsxDEV(EventSheet, {
88432
- event: state?.selectedItem,
87656
+ event: state.selectedItem,
88433
87657
  isFocused: state?.focusTarget === "sheet",
88434
87658
  copiedFeedback: showingFeedback
88435
87659
  }, undefined, false, undefined, this) : undefined,
@@ -88615,6 +87839,256 @@ var init_events3 = __esm(async () => {
88615
87839
  await init_command7();
88616
87840
  });
88617
87841
 
87842
+ // src/commands/test-diff/command.ts
87843
+ import fs18 from "node:fs";
87844
+ import { resolve as resolve9 } from "node:path";
87845
+ import { pathToFileURL as pathToFileURL4 } from "node:url";
87846
+ import createJiti4 from "jiti";
87847
+ function valuesEqual2(a2, b) {
87848
+ if (a2 === b)
87849
+ return true;
87850
+ if (a2 == null && b == null)
87851
+ return true;
87852
+ if (a2 == null || b == null)
87853
+ return false;
87854
+ if (typeof a2 !== typeof b)
87855
+ return false;
87856
+ if (Array.isArray(a2) && Array.isArray(b)) {
87857
+ if (a2.length !== b.length)
87858
+ return false;
87859
+ return a2.every((item, i2) => valuesEqual2(item, b[i2]));
87860
+ }
87861
+ if (typeof a2 === "object" && typeof b === "object") {
87862
+ const aObj = a2;
87863
+ const bObj = b;
87864
+ const allKeys = new Set([...Object.keys(aObj), ...Object.keys(bObj)]);
87865
+ for (const key2 of allKeys) {
87866
+ if (!valuesEqual2(aObj[key2], bObj[key2]))
87867
+ return false;
87868
+ }
87869
+ return true;
87870
+ }
87871
+ return false;
87872
+ }
87873
+ function normalizeFeatureForCompare2(f) {
87874
+ const result = { id: f.id, name: f.name, type: f.type };
87875
+ if (f.type === "metered" && "consumable" in f) {
87876
+ result.consumable = f.consumable;
87877
+ }
87878
+ if (f.eventNames && f.eventNames.length > 0) {
87879
+ result.eventNames = [...f.eventNames].sort();
87880
+ }
87881
+ if (f.creditSchema && f.creditSchema.length > 0) {
87882
+ result.creditSchema = [...f.creditSchema].sort((a2, b) => a2.meteredFeatureId.localeCompare(b.meteredFeatureId)).map((cs) => ({ meteredFeatureId: cs.meteredFeatureId, creditCost: cs.creditCost }));
87883
+ }
87884
+ return result;
87885
+ }
87886
+ function normalizePlanFeatureForCompare2(pf) {
87887
+ const result = { featureId: pf.featureId };
87888
+ if (pf.included != null && pf.included !== 0)
87889
+ result.included = pf.included;
87890
+ if (pf.unlimited === true)
87891
+ result.unlimited = true;
87892
+ const reset2 = pf.reset;
87893
+ if (reset2 != null) {
87894
+ const r = { interval: reset2.interval };
87895
+ if (reset2.intervalCount != null && reset2.intervalCount !== 1)
87896
+ r.intervalCount = reset2.intervalCount;
87897
+ result.reset = r;
87898
+ }
87899
+ const price = pf.price;
87900
+ if (price != null) {
87901
+ const p = {};
87902
+ if (price.amount != null)
87903
+ p.amount = price.amount;
87904
+ if (price.billingMethod != null)
87905
+ p.billingMethod = price.billingMethod;
87906
+ if (price.interval != null)
87907
+ p.interval = price.interval;
87908
+ if (price.intervalCount != null && price.intervalCount !== 1)
87909
+ p.intervalCount = price.intervalCount;
87910
+ if (price.tiers != null && Array.isArray(price.tiers) && price.tiers.length > 0)
87911
+ p.tiers = price.tiers;
87912
+ if (price.billingUnits != null && price.billingUnits !== 1)
87913
+ p.billingUnits = price.billingUnits;
87914
+ if (price.maxPurchase != null)
87915
+ p.maxPurchase = price.maxPurchase;
87916
+ if (Object.keys(p).length > 0)
87917
+ result.price = p;
87918
+ }
87919
+ const proration = pf.proration;
87920
+ if (proration != null)
87921
+ result.proration = proration;
87922
+ const rollover = pf.rollover;
87923
+ if (rollover != null)
87924
+ result.rollover = rollover;
87925
+ return result;
87926
+ }
87927
+ function normalizePlanForCompare2(plan) {
87928
+ const result = { id: plan.id, name: plan.name };
87929
+ if (plan.description != null && plan.description !== "")
87930
+ result.description = plan.description;
87931
+ if (plan.group != null && plan.group !== "")
87932
+ result.group = plan.group;
87933
+ if (plan.addOn === true)
87934
+ result.addOn = true;
87935
+ if (plan.autoEnable === true)
87936
+ result.autoEnable = true;
87937
+ if (plan.price != null) {
87938
+ result.price = { amount: plan.price.amount, interval: plan.price.interval };
87939
+ }
87940
+ if (plan.freeTrial != null) {
87941
+ result.freeTrial = {
87942
+ durationLength: plan.freeTrial.durationLength,
87943
+ durationType: plan.freeTrial.durationType,
87944
+ cardRequired: plan.freeTrial.cardRequired
87945
+ };
87946
+ }
87947
+ if (plan.items != null && plan.items.length > 0) {
87948
+ result.items = [...plan.items].sort((a2, b) => a2.featureId.localeCompare(b.featureId)).map((pf) => normalizePlanFeatureForCompare2(pf));
87949
+ }
87950
+ return result;
87951
+ }
87952
+ function diffObjects(a2, b, path18 = "") {
87953
+ const diffs = [];
87954
+ const allKeys = new Set([...Object.keys(a2), ...Object.keys(b)]);
87955
+ for (const key2 of allKeys) {
87956
+ const fullPath = path18 ? `${path18}.${key2}` : key2;
87957
+ const av = a2[key2];
87958
+ const bv = b[key2];
87959
+ if (!valuesEqual2(av, bv)) {
87960
+ diffs.push(` ${source_default.yellow(fullPath)}:
87961
+ ` + ` local: ${source_default.green(JSON.stringify(av))}
87962
+ ` + ` remote: ${source_default.red(JSON.stringify(bv))}`);
87963
+ }
87964
+ }
87965
+ return diffs;
87966
+ }
87967
+ async function loadLocalConfig3(cwd2) {
87968
+ const configPath = resolveConfigPath(cwd2);
87969
+ if (!fs18.existsSync(configPath)) {
87970
+ throw new Error(`Config file not found at ${configPath}. Run 'atmn pull' first.`);
87971
+ }
87972
+ const absolutePath = resolve9(configPath);
87973
+ const fileUrl = pathToFileURL4(absolutePath).href;
87974
+ const jiti = createJiti4(import.meta.url);
87975
+ const mod = await jiti.import(fileUrl);
87976
+ const plans5 = [];
87977
+ const features5 = [];
87978
+ const modRecord = mod;
87979
+ const defaultExport = modRecord.default;
87980
+ if (defaultExport?.plans && defaultExport?.features) {
87981
+ if (Array.isArray(defaultExport.plans))
87982
+ plans5.push(...defaultExport.plans);
87983
+ if (Array.isArray(defaultExport.features))
87984
+ features5.push(...defaultExport.features);
87985
+ } else if (defaultExport?.products && defaultExport?.features) {
87986
+ if (Array.isArray(defaultExport.products))
87987
+ plans5.push(...defaultExport.products);
87988
+ if (Array.isArray(defaultExport.features))
87989
+ features5.push(...defaultExport.features);
87990
+ } else {
87991
+ for (const [key2, value] of Object.entries(modRecord)) {
87992
+ if (key2 === "default")
87993
+ continue;
87994
+ const obj = value;
87995
+ if (obj && typeof obj === "object") {
87996
+ if ("type" in obj)
87997
+ features5.push(obj);
87998
+ else if (Array.isArray(obj.items) || "id" in obj)
87999
+ plans5.push(obj);
88000
+ }
88001
+ }
88002
+ }
88003
+ return { features: features5, plans: plans5 };
88004
+ }
88005
+ async function testDiffCommand() {
88006
+ console.log(source_default.cyan("Loading local config..."));
88007
+ const { features: localFeatures, plans: localPlans } = await loadLocalConfig3(process.cwd());
88008
+ console.log(source_default.cyan("Fetching remote data..."));
88009
+ const remoteData = await fetchRemoteData();
88010
+ const remoteFeaturesById = new Map(remoteData.features.map((f) => [f.id, f]));
88011
+ const remotePlansById = new Map(remoteData.plans.map((p) => [p.id, p]));
88012
+ console.log("");
88013
+ console.log(source_default.bold("━━━ FEATURE DIFF ━━━"));
88014
+ let featureChanges = 0;
88015
+ for (const local of localFeatures) {
88016
+ const remote = remoteFeaturesById.get(local.id);
88017
+ if (!remote) {
88018
+ console.log(source_default.green(` [NEW] ${local.id}`));
88019
+ featureChanges++;
88020
+ continue;
88021
+ }
88022
+ const localNorm = normalizeFeatureForCompare2(local);
88023
+ const remoteNorm = normalizeFeatureForCompare2(remote);
88024
+ if (!valuesEqual2(localNorm, remoteNorm)) {
88025
+ console.log(source_default.yellow(` [CHANGED] ${local.id}`));
88026
+ const diffs = diffObjects(localNorm, remoteNorm);
88027
+ for (const d of diffs)
88028
+ console.log(d);
88029
+ featureChanges++;
88030
+ }
88031
+ }
88032
+ if (featureChanges === 0)
88033
+ console.log(source_default.gray(" (no feature changes)"));
88034
+ console.log("");
88035
+ console.log(source_default.bold("━━━ PLAN DIFF ━━━"));
88036
+ let planChanges = 0;
88037
+ for (const local of localPlans) {
88038
+ const remote = remotePlansById.get(local.id);
88039
+ if (!remote) {
88040
+ console.log(source_default.green(` [NEW] ${local.id}`));
88041
+ planChanges++;
88042
+ continue;
88043
+ }
88044
+ const localNorm = normalizePlanForCompare2(local);
88045
+ const remoteNorm = normalizePlanForCompare2(remote);
88046
+ if (!valuesEqual2(localNorm, remoteNorm)) {
88047
+ console.log(source_default.yellow(` [CHANGED] ${local.id}`));
88048
+ const diffs = diffObjects(localNorm, remoteNorm);
88049
+ for (const d of diffs)
88050
+ console.log(d);
88051
+ planChanges++;
88052
+ } else {
88053
+ console.log(source_default.gray(` [same] ${local.id}`));
88054
+ }
88055
+ }
88056
+ if (planChanges === 0)
88057
+ console.log(source_default.gray(" (no plan changes)"));
88058
+ console.log("");
88059
+ console.log(source_default.bold("━━━ RAW NORMALIZED (plans) ━━━"));
88060
+ for (const local of localPlans) {
88061
+ const remote = remotePlansById.get(local.id);
88062
+ if (!remote)
88063
+ continue;
88064
+ const localNorm = normalizePlanForCompare2(local);
88065
+ const remoteNorm = normalizePlanForCompare2(remote);
88066
+ console.log(source_default.cyan(`
88067
+ [${local.id}] local:`));
88068
+ console.log(JSON.stringify(localNorm, null, 2).split(`
88069
+ `).map((l) => ` ${l}`).join(`
88070
+ `));
88071
+ console.log(source_default.magenta(` [${local.id}] remote:`));
88072
+ console.log(JSON.stringify(remoteNorm, null, 2).split(`
88073
+ `).map((l) => ` ${l}`).join(`
88074
+ `));
88075
+ }
88076
+ }
88077
+ var init_command8 = __esm(() => {
88078
+ init_source();
88079
+ init_env();
88080
+ init_push();
88081
+ });
88082
+
88083
+ // src/commands/test-diff/index.ts
88084
+ var exports_test_diff = {};
88085
+ __export(exports_test_diff, {
88086
+ testDiffCommand: () => testDiffCommand
88087
+ });
88088
+ var init_test_diff = __esm(() => {
88089
+ init_command8();
88090
+ });
88091
+
88618
88092
  // src/cli.tsx
88619
88093
  init_source();
88620
88094
 
@@ -88739,7 +88213,7 @@ async function Nuke(options) {
88739
88213
  console.log(source_default.red("No API key found. Run `atmn login` first."));
88740
88214
  process.exit(1);
88741
88215
  }
88742
- const isSandbox = isSandboxKey2(apiKey);
88216
+ const isSandbox = await isSandboxKey2(apiKey);
88743
88217
  if (isSandbox) {
88744
88218
  const secretKey = getKey("sandbox" /* Sandbox */);
88745
88219
  try {
@@ -89636,7 +89110,7 @@ function TemplateRow({
89636
89110
  }, tier.name, false, undefined, this))
89637
89111
  }, undefined, false, undefined, this),
89638
89112
  hasCreditSystem && /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(CreditSchemaCard, {
89639
- costs: template.creditSystem?.costs,
89113
+ costs: template.creditSystem?.costs ?? [],
89640
89114
  height: tiersHeight,
89641
89115
  width: creditSchemaWidth
89642
89116
  }, undefined, false, undefined, this)
@@ -90164,9 +89638,9 @@ function HandoffStep({
90164
89638
  }, undefined, false, undefined, this),
90165
89639
  /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(Box_default, {
90166
89640
  marginTop: 1,
90167
- children: /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(Select, {
90168
- options: aiChoiceOptions,
90169
- onChange: handleAiChoice
89641
+ children: /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(SelectMenu, {
89642
+ items: aiChoiceOptions,
89643
+ onSelect: (item) => handleAiChoice(item.value)
90170
89644
  }, undefined, false, undefined, this)
90171
89645
  }, undefined, false, undefined, this)
90172
89646
  ]
@@ -90235,7 +89709,7 @@ function HandoffStep({
90235
89709
  }, undefined, true, undefined, this),
90236
89710
  /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(TextInput2, {
90237
89711
  placeholder: process.cwd(),
90238
- value: customPath,
89712
+ defaultValue: customPath,
90239
89713
  onChange: setCustomPath,
90240
89714
  onSubmit: handleCustomPathSubmit
90241
89715
  }, undefined, false, undefined, this)
@@ -90321,9 +89795,9 @@ function HandoffStep({
90321
89795
  }, undefined, false, undefined, this),
90322
89796
  /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(Box_default, {
90323
89797
  marginTop: 1,
90324
- children: /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(Select, {
90325
- options: nextStepsOptions,
90326
- onChange: handleNextStepsChoice
89798
+ children: /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(SelectMenu, {
89799
+ items: nextStepsOptions,
89800
+ onSelect: (item) => handleNextStepsChoice(item.value)
90327
89801
  }, undefined, false, undefined, this)
90328
89802
  }, undefined, false, undefined, this)
90329
89803
  ]
@@ -90826,6 +90300,17 @@ program.command("config").description("Get and set global configuration").option
90826
90300
  const args = [key2, value].filter((a2) => a2 !== undefined);
90827
90301
  configCommand2(args, { global: options.global });
90828
90302
  });
90303
+ program.command("test-diff", { hidden: true }).description("Debug: show normalized diff between local config and remote").action(async () => {
90304
+ const { testDiffCommand: testDiffCommand2 } = await Promise.resolve().then(() => (init_test_diff(), exports_test_diff));
90305
+ try {
90306
+ await testDiffCommand2();
90307
+ } catch (error) {
90308
+ const { formatError: formatError2 } = await Promise.resolve().then(() => (init_client2(), exports_client));
90309
+ console.error(source_default.red(`
90310
+ Error: ${formatError2(error)}`));
90311
+ process.exit(1);
90312
+ }
90313
+ });
90829
90314
  var originalEmit = process.emitWarning;
90830
90315
  process.emitWarning = (warning, ...args) => {
90831
90316
  const msg = typeof warning === "string" ? warning : warning.message;