pixelkiln 0.138.0 → 0.138.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -11052,24 +11052,7 @@ var RetroDiffusionProvider = class _RetroDiffusionProvider {
11052
11052
  const options = retroOptions(spec);
11053
11053
  const style = resolvedPromptStyle(spec, options);
11054
11054
  const count = options.numImages ?? 1;
11055
- const pixels = spec.width * spec.height;
11056
- let each;
11057
- if (style.startsWith("rd_advanced_animation__")) {
11058
- each = /__(?:custom_action|subtle_motion)$/.test(style) ? 0.25 : 0.14;
11059
- } else if (style.startsWith("rd_animation__")) {
11060
- each = /__(?:any_animation|8_dir_rotation)$/.test(style) ? 0.25 : 0.07;
11061
- } else if (/^rd_tile__tileset(?:_advanced)?$/.test(style)) {
11062
- each = 0.1;
11063
- } else if (style.startsWith("rd_pro__")) {
11064
- each = 0.18;
11065
- } else if (style.startsWith("rd_fast__")) {
11066
- each = Math.max(0.015, (pixels + 1e5) / 6e6);
11067
- } else if (isLowResolutionStyle(style)) {
11068
- each = Math.max(0.02, (pixels + 13700) / 6e5);
11069
- } else {
11070
- each = Math.max(0.025, (pixels + 5e4) / 2e6);
11071
- }
11072
- return { unit: "usd", amount: roundUsdEstimate(each * count), candidates: count };
11055
+ return { unit: "usd", amount: roundUsdEstimate(retroUsdPerImage(style, spec) * count), candidates: count };
11073
11056
  }
11074
11057
  validate(spec, styleImages) {
11075
11058
  const options = retroOptions(spec);
@@ -11284,6 +11267,24 @@ function validateTile(style, spec, styleImages, count, options) {
11284
11267
  }
11285
11268
  }
11286
11269
  }
11270
+ function retroUsdPerImage(style, spec) {
11271
+ if (style.startsWith("rd_advanced_animation__")) {
11272
+ return /__(?:custom_action|subtle_motion)$/.test(style) ? 0.25 : 0.14;
11273
+ }
11274
+ if (style.startsWith("rd_animation__")) {
11275
+ return /__(?:any_animation|8_dir_rotation)$/.test(style) ? 0.25 : 0.07;
11276
+ }
11277
+ if (/^rd_tile__tileset(?:_advanced)?$/.test(style)) return 0.1;
11278
+ if (style.startsWith("rd_tile__")) return 0.06;
11279
+ if (style.startsWith("rd_pro__")) return 0.18;
11280
+ if (style.startsWith("rd_core__")) return 0.1;
11281
+ if (style.startsWith("rd_plus__") || style.startsWith("rd_mini__")) return 0.06;
11282
+ if (style.startsWith("rd_lite__")) return 0.05;
11283
+ if (style.startsWith("rd_fast__") || style.endsWith(":rd_flux") || style === "item_sheet") return 0.03;
11284
+ const pixels = spec.width * spec.height;
11285
+ const formula = isLowResolutionStyle(style) ? (pixels + 13700) / 6e5 : (pixels + 5e4) / 2e6;
11286
+ return Math.max(0.06, formula);
11287
+ }
11287
11288
  function isLowResolutionStyle(style) {
11288
11289
  return /(?:^|__)(?:mc_|low_res|classic|skill_icon|topdown_item)/.test(style);
11289
11290
  }