vibes-diy 14.3.482 → 14.3.484

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.
@@ -568,12 +568,12 @@ var init_write_stream = __esm({
568
568
  getWindowSize() {
569
569
  return [this.columns, this.rows];
570
570
  }
571
- write(str4, encoding, cb) {
572
- if (str4 instanceof Uint8Array) {
573
- str4 = new TextDecoder().decode(str4);
571
+ write(str5, encoding, cb) {
572
+ if (str5 instanceof Uint8Array) {
573
+ str5 = new TextDecoder().decode(str5);
574
574
  }
575
575
  try {
576
- console.log(str4);
576
+ console.log(str5);
577
577
  } catch {
578
578
  }
579
579
  cb && typeof cb === "function" && cb();
@@ -2095,9 +2095,9 @@ var init_stringifyComment = __esm({
2095
2095
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
2096
2096
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
2097
2097
  init_performance2();
2098
- stringifyComment = /* @__PURE__ */ __name((str4) => str4.replace(/^(?!$)(?: $)?/gm, "#"), "stringifyComment");
2098
+ stringifyComment = /* @__PURE__ */ __name((str5) => str5.replace(/^(?!$)(?: $)?/gm, "#"), "stringifyComment");
2099
2099
  __name(indentComment, "indentComment");
2100
- lineComment = /* @__PURE__ */ __name((str4, indent2, comment) => str4.endsWith("\n") ? indentComment(comment, indent2) : comment.includes("\n") ? "\n" + indentComment(comment, indent2) : (str4.endsWith(" ") ? "" : " ") + comment, "lineComment");
2100
+ lineComment = /* @__PURE__ */ __name((str5, indent2, comment) => str5.endsWith("\n") ? indentComment(comment, indent2) : comment.includes("\n") ? "\n" + indentComment(comment, indent2) : (str5.endsWith(" ") ? "" : " ") + comment, "lineComment");
2101
2101
  }
2102
2102
  });
2103
2103
 
@@ -2239,15 +2239,15 @@ var init_foldFlowLines = __esm({
2239
2239
  });
2240
2240
 
2241
2241
  // ../../home/runner/work/vibes.diy/vibes.diy/node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/browser/dist/stringify/stringifyString.js
2242
- function lineLengthOverLimit(str4, lineWidth, indentLength) {
2242
+ function lineLengthOverLimit(str5, lineWidth, indentLength) {
2243
2243
  if (!lineWidth || lineWidth < 0)
2244
2244
  return false;
2245
2245
  const limit = lineWidth - indentLength;
2246
- const strLen = str4.length;
2246
+ const strLen = str5.length;
2247
2247
  if (strLen <= limit)
2248
2248
  return false;
2249
2249
  for (let i3 = 0, start = 0; i3 < strLen; ++i3) {
2250
- if (str4[i3] === "\n") {
2250
+ if (str5[i3] === "\n") {
2251
2251
  if (i3 - start > limit)
2252
2252
  return true;
2253
2253
  start = i3 + 1;
@@ -2264,11 +2264,11 @@ function doubleQuotedString(value2, ctx) {
2264
2264
  const { implicitKey } = ctx;
2265
2265
  const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;
2266
2266
  const indent2 = ctx.indent || (containsDocumentMarker(value2) ? " " : "");
2267
- let str4 = "";
2267
+ let str5 = "";
2268
2268
  let start = 0;
2269
2269
  for (let i3 = 0, ch = json5[i3]; ch; ch = json5[++i3]) {
2270
2270
  if (ch === " " && json5[i3 + 1] === "\\" && json5[i3 + 2] === "n") {
2271
- str4 += json5.slice(start, i3) + "\\ ";
2271
+ str5 += json5.slice(start, i3) + "\\ ";
2272
2272
  i3 += 1;
2273
2273
  start = i3;
2274
2274
  ch = "\\";
@@ -2277,38 +2277,38 @@ function doubleQuotedString(value2, ctx) {
2277
2277
  switch (json5[i3 + 1]) {
2278
2278
  case "u":
2279
2279
  {
2280
- str4 += json5.slice(start, i3);
2280
+ str5 += json5.slice(start, i3);
2281
2281
  const code2 = json5.substr(i3 + 2, 4);
2282
2282
  switch (code2) {
2283
2283
  case "0000":
2284
- str4 += "\\0";
2284
+ str5 += "\\0";
2285
2285
  break;
2286
2286
  case "0007":
2287
- str4 += "\\a";
2287
+ str5 += "\\a";
2288
2288
  break;
2289
2289
  case "000b":
2290
- str4 += "\\v";
2290
+ str5 += "\\v";
2291
2291
  break;
2292
2292
  case "001b":
2293
- str4 += "\\e";
2293
+ str5 += "\\e";
2294
2294
  break;
2295
2295
  case "0085":
2296
- str4 += "\\N";
2296
+ str5 += "\\N";
2297
2297
  break;
2298
2298
  case "00a0":
2299
- str4 += "\\_";
2299
+ str5 += "\\_";
2300
2300
  break;
2301
2301
  case "2028":
2302
- str4 += "\\L";
2302
+ str5 += "\\L";
2303
2303
  break;
2304
2304
  case "2029":
2305
- str4 += "\\P";
2305
+ str5 += "\\P";
2306
2306
  break;
2307
2307
  default:
2308
2308
  if (code2.substr(0, 2) === "00")
2309
- str4 += "\\x" + code2.substr(2);
2309
+ str5 += "\\x" + code2.substr(2);
2310
2310
  else
2311
- str4 += json5.substr(i3, 6);
2311
+ str5 += json5.substr(i3, 6);
2312
2312
  }
2313
2313
  i3 += 5;
2314
2314
  start = i3 + 1;
@@ -2318,14 +2318,14 @@ function doubleQuotedString(value2, ctx) {
2318
2318
  if (implicitKey || json5[i3 + 2] === '"' || json5.length < minMultiLineLength) {
2319
2319
  i3 += 1;
2320
2320
  } else {
2321
- str4 += json5.slice(start, i3) + "\n\n";
2321
+ str5 += json5.slice(start, i3) + "\n\n";
2322
2322
  while (json5[i3 + 2] === "\\" && json5[i3 + 3] === "n" && json5[i3 + 4] !== '"') {
2323
- str4 += "\n";
2323
+ str5 += "\n";
2324
2324
  i3 += 2;
2325
2325
  }
2326
- str4 += indent2;
2326
+ str5 += indent2;
2327
2327
  if (json5[i3 + 2] === " ")
2328
- str4 += "\\";
2328
+ str5 += "\\";
2329
2329
  i3 += 1;
2330
2330
  start = i3 + 1;
2331
2331
  }
@@ -2334,8 +2334,8 @@ function doubleQuotedString(value2, ctx) {
2334
2334
  i3 += 1;
2335
2335
  }
2336
2336
  }
2337
- str4 = start ? str4 + json5.slice(start) : json5;
2338
- return implicitKey ? str4 : foldFlowLines(str4, indent2, FOLD_QUOTED, getFoldOptions(ctx, false));
2337
+ str5 = start ? str5 + json5.slice(start) : json5;
2338
+ return implicitKey ? str5 : foldFlowLines(str5, indent2, FOLD_QUOTED, getFoldOptions(ctx, false));
2339
2339
  }
2340
2340
  function singleQuotedString(value2, ctx) {
2341
2341
  if (ctx.options.singleQuote === false || ctx.implicitKey && value2.includes("\n") || /[ \t]\n|\n[ \t]/.test(value2))
@@ -2457,15 +2457,15 @@ function plainString(item, ctx, onComment, onChompKeep) {
2457
2457
  return quotedString(value2, ctx);
2458
2458
  }
2459
2459
  }
2460
- const str4 = value2.replace(/\n+/g, `$&
2460
+ const str5 = value2.replace(/\n+/g, `$&
2461
2461
  ${indent2}`);
2462
2462
  if (actualString) {
2463
- const test = /* @__PURE__ */ __name((tag2) => tag2.default && tag2.tag !== "tag:yaml.org,2002:str" && tag2.test?.test(str4), "test");
2463
+ const test = /* @__PURE__ */ __name((tag2) => tag2.default && tag2.tag !== "tag:yaml.org,2002:str" && tag2.test?.test(str5), "test");
2464
2464
  const { compat, tags } = ctx.doc.schema;
2465
2465
  if (tags.some(test) || compat?.some(test))
2466
2466
  return quotedString(value2, ctx);
2467
2467
  }
2468
- return implicitKey ? str4 : foldFlowLines(str4, indent2, FOLD_FLOW, getFoldOptions(ctx, false));
2468
+ return implicitKey ? str5 : foldFlowLines(str5, indent2, FOLD_FLOW, getFoldOptions(ctx, false));
2469
2469
  }
2470
2470
  function stringifyString(item, ctx, onComment, onChompKeep) {
2471
2471
  const { implicitKey, inFlow } = ctx;
@@ -2513,7 +2513,7 @@ var init_stringifyString = __esm({
2513
2513
  lineWidth: ctx.options.lineWidth,
2514
2514
  minContentWidth: ctx.options.minContentWidth
2515
2515
  }), "getFoldOptions");
2516
- containsDocumentMarker = /* @__PURE__ */ __name((str4) => /^(%|---|\.\.\.)/m.test(str4), "containsDocumentMarker");
2516
+ containsDocumentMarker = /* @__PURE__ */ __name((str5) => /^(%|---|\.\.\.)/m.test(str5), "containsDocumentMarker");
2517
2517
  __name(lineLengthOverLimit, "lineLengthOverLimit");
2518
2518
  __name(doubleQuotedString, "doubleQuotedString");
2519
2519
  __name(singleQuotedString, "singleQuotedString");
@@ -2635,11 +2635,11 @@ function stringify(item, ctx, onComment, onChompKeep) {
2635
2635
  const props = stringifyProps(node3, tagObj, ctx);
2636
2636
  if (props.length > 0)
2637
2637
  ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
2638
- const str4 = typeof tagObj.stringify === "function" ? tagObj.stringify(node3, ctx, onComment, onChompKeep) : isScalar(node3) ? stringifyString(node3, ctx, onComment, onChompKeep) : node3.toString(ctx, onComment, onChompKeep);
2638
+ const str5 = typeof tagObj.stringify === "function" ? tagObj.stringify(node3, ctx, onComment, onChompKeep) : isScalar(node3) ? stringifyString(node3, ctx, onComment, onChompKeep) : node3.toString(ctx, onComment, onChompKeep);
2639
2639
  if (!props)
2640
- return str4;
2641
- return isScalar(node3) || str4[0] === "{" || str4[0] === "[" ? `${props} ${str4}` : `${props}
2642
- ${ctx.indent}${str4}`;
2640
+ return str5;
2641
+ return isScalar(node3) || str5[0] === "{" || str5[0] === "[" ? `${props} ${str5}` : `${props}
2642
+ ${ctx.indent}${str5}`;
2643
2643
  }
2644
2644
  var init_stringify = __esm({
2645
2645
  "../../home/runner/work/vibes.diy/vibes.diy/node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/browser/dist/stringify/stringify.js"() {
@@ -2678,8 +2678,8 @@ function stringifyPair({ key, value: value2 }, ctx, onComment, onChompKeep) {
2678
2678
  });
2679
2679
  let keyCommentDone = false;
2680
2680
  let chompKeep = false;
2681
- let str4 = stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
2682
- if (!explicitKey && !ctx.inFlow && str4.length > 1024) {
2681
+ let str5 = stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
2682
+ if (!explicitKey && !ctx.inFlow && str5.length > 1024) {
2683
2683
  if (simpleKeys)
2684
2684
  throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
2685
2685
  explicitKey = true;
@@ -2688,27 +2688,27 @@ function stringifyPair({ key, value: value2 }, ctx, onComment, onChompKeep) {
2688
2688
  if (allNullValues || value2 == null) {
2689
2689
  if (keyCommentDone && onComment)
2690
2690
  onComment();
2691
- return str4 === "" ? "?" : explicitKey ? `? ${str4}` : str4;
2691
+ return str5 === "" ? "?" : explicitKey ? `? ${str5}` : str5;
2692
2692
  }
2693
2693
  } else if (allNullValues && !simpleKeys || value2 == null && explicitKey) {
2694
- str4 = `? ${str4}`;
2694
+ str5 = `? ${str5}`;
2695
2695
  if (keyComment && !keyCommentDone) {
2696
- str4 += lineComment(str4, ctx.indent, commentString(keyComment));
2696
+ str5 += lineComment(str5, ctx.indent, commentString(keyComment));
2697
2697
  } else if (chompKeep && onChompKeep)
2698
2698
  onChompKeep();
2699
- return str4;
2699
+ return str5;
2700
2700
  }
2701
2701
  if (keyCommentDone)
2702
2702
  keyComment = null;
2703
2703
  if (explicitKey) {
2704
2704
  if (keyComment)
2705
- str4 += lineComment(str4, ctx.indent, commentString(keyComment));
2706
- str4 = `? ${str4}
2705
+ str5 += lineComment(str5, ctx.indent, commentString(keyComment));
2706
+ str5 = `? ${str5}
2707
2707
  ${indent2}:`;
2708
2708
  } else {
2709
- str4 = `${str4}:`;
2709
+ str5 = `${str5}:`;
2710
2710
  if (keyComment)
2711
- str4 += lineComment(str4, ctx.indent, commentString(keyComment));
2711
+ str5 += lineComment(str5, ctx.indent, commentString(keyComment));
2712
2712
  }
2713
2713
  let vsb, vcb, valueComment;
2714
2714
  if (isNode(value2)) {
@@ -2724,7 +2724,7 @@ ${indent2}:`;
2724
2724
  }
2725
2725
  ctx.implicitKey = false;
2726
2726
  if (!explicitKey && !keyComment && isScalar(value2))
2727
- ctx.indentAtStart = str4.length + 1;
2727
+ ctx.indentAtStart = str5.length + 1;
2728
2728
  chompKeep = false;
2729
2729
  if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && isSeq(value2) && !value2.flow && !value2.tag && !value2.anchor) {
2730
2730
  ctx.indent = ctx.indent.substring(2);
@@ -2768,16 +2768,16 @@ ${ctx.indent}`;
2768
2768
  } else if (valueStr === "" || valueStr[0] === "\n") {
2769
2769
  ws = "";
2770
2770
  }
2771
- str4 += ws + valueStr;
2771
+ str5 += ws + valueStr;
2772
2772
  if (ctx.inFlow) {
2773
2773
  if (valueCommentDone && onComment)
2774
2774
  onComment();
2775
2775
  } else if (valueComment && !valueCommentDone) {
2776
- str4 += lineComment(str4, ctx.indent, commentString(valueComment));
2776
+ str5 += lineComment(str5, ctx.indent, commentString(valueComment));
2777
2777
  } else if (chompKeep && onChompKeep) {
2778
2778
  onChompKeep();
2779
2779
  }
2780
- return str4;
2780
+ return str5;
2781
2781
  }
2782
2782
  var init_stringifyPair = __esm({
2783
2783
  "../../home/runner/work/vibes.diy/vibes.diy/node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/browser/dist/stringify/stringifyPair.js"() {
@@ -3011,31 +3011,31 @@ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, fl
3011
3011
  }
3012
3012
  }
3013
3013
  chompKeep = false;
3014
- let str5 = stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
3014
+ let str6 = stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
3015
3015
  if (comment2)
3016
- str5 += lineComment(str5, itemIndent, commentString(comment2));
3016
+ str6 += lineComment(str6, itemIndent, commentString(comment2));
3017
3017
  if (chompKeep && comment2)
3018
3018
  chompKeep = false;
3019
- lines.push(blockItemPrefix + str5);
3019
+ lines.push(blockItemPrefix + str6);
3020
3020
  }
3021
- let str4;
3021
+ let str5;
3022
3022
  if (lines.length === 0) {
3023
- str4 = flowChars.start + flowChars.end;
3023
+ str5 = flowChars.start + flowChars.end;
3024
3024
  } else {
3025
- str4 = lines[0];
3025
+ str5 = lines[0];
3026
3026
  for (let i3 = 1; i3 < lines.length; ++i3) {
3027
3027
  const line2 = lines[i3];
3028
- str4 += line2 ? `
3028
+ str5 += line2 ? `
3029
3029
  ${indent2}${line2}` : "\n";
3030
3030
  }
3031
3031
  }
3032
3032
  if (comment) {
3033
- str4 += "\n" + indentComment(commentString(comment), indent2);
3033
+ str5 += "\n" + indentComment(commentString(comment), indent2);
3034
3034
  if (onComment)
3035
3035
  onComment();
3036
3036
  } else if (chompKeep && onChompKeep)
3037
3037
  onChompKeep();
3038
- return str4;
3038
+ return str5;
3039
3039
  }
3040
3040
  function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
3041
3041
  const { indent: indent2, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
@@ -3078,21 +3078,21 @@ function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
3078
3078
  }
3079
3079
  if (comment)
3080
3080
  reqNewline = true;
3081
- let str4 = stringify(item, itemCtx, () => comment = null);
3082
- reqNewline || (reqNewline = lines.length > linesAtValue || str4.includes("\n"));
3081
+ let str5 = stringify(item, itemCtx, () => comment = null);
3082
+ reqNewline || (reqNewline = lines.length > linesAtValue || str5.includes("\n"));
3083
3083
  if (i3 < items.length - 1) {
3084
- str4 += ",";
3084
+ str5 += ",";
3085
3085
  } else if (ctx.options.trailingComma) {
3086
3086
  if (ctx.options.lineWidth > 0) {
3087
- reqNewline || (reqNewline = lines.reduce((sum, line2) => sum + line2.length + 2, 2) + (str4.length + 2) > ctx.options.lineWidth);
3087
+ reqNewline || (reqNewline = lines.reduce((sum, line2) => sum + line2.length + 2, 2) + (str5.length + 2) > ctx.options.lineWidth);
3088
3088
  }
3089
3089
  if (reqNewline) {
3090
- str4 += ",";
3090
+ str5 += ",";
3091
3091
  }
3092
3092
  }
3093
3093
  if (comment)
3094
- str4 += lineComment(str4, itemIndent, commentString(comment));
3095
- lines.push(str4);
3094
+ str5 += lineComment(str5, itemIndent, commentString(comment));
3095
+ lines.push(str5);
3096
3096
  linesAtValue = lines.length;
3097
3097
  }
3098
3098
  const { start, end } = flowChars;
@@ -3104,11 +3104,11 @@ function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
3104
3104
  reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;
3105
3105
  }
3106
3106
  if (reqNewline) {
3107
- let str4 = start;
3107
+ let str5 = start;
3108
3108
  for (const line2 of lines)
3109
- str4 += line2 ? `
3109
+ str5 += line2 ? `
3110
3110
  ${indentStep}${indent2}${line2}` : "\n";
3111
- return `${str4}
3111
+ return `${str5}
3112
3112
  ${indent2}${end}`;
3113
3113
  } else {
3114
3114
  return `${start}${fcPadding}${lines.join(" ")}${fcPadding}${end}`;
@@ -3469,7 +3469,7 @@ var init_string = __esm({
3469
3469
  identify: /* @__PURE__ */ __name((value2) => typeof value2 === "string", "identify"),
3470
3470
  default: true,
3471
3471
  tag: "tag:yaml.org,2002:str",
3472
- resolve: /* @__PURE__ */ __name((str4) => str4, "resolve"),
3472
+ resolve: /* @__PURE__ */ __name((str5) => str5, "resolve"),
3473
3473
  stringify(item, ctx, onComment, onChompKeep) {
3474
3474
  ctx = Object.assign({ actualString: true }, ctx);
3475
3475
  return stringifyString(item, ctx, onComment, onChompKeep);
@@ -3511,7 +3511,7 @@ var init_bool = __esm({
3511
3511
  default: true,
3512
3512
  tag: "tag:yaml.org,2002:bool",
3513
3513
  test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
3514
- resolve: /* @__PURE__ */ __name((str4) => new Scalar(str4[0] === "t" || str4[0] === "T"), "resolve"),
3514
+ resolve: /* @__PURE__ */ __name((str5) => new Scalar(str5[0] === "t" || str5[0] === "T"), "resolve"),
3515
3515
  stringify({ source, value: value2 }, ctx) {
3516
3516
  if (source && boolTag.test.test(source)) {
3517
3517
  const sv = source[0] === "t" || source[0] === "T";
@@ -3567,7 +3567,7 @@ var init_float = __esm({
3567
3567
  default: true,
3568
3568
  tag: "tag:yaml.org,2002:float",
3569
3569
  test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
3570
- resolve: /* @__PURE__ */ __name((str4) => str4.slice(-3).toLowerCase() === "nan" ? NaN : str4[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, "resolve"),
3570
+ resolve: /* @__PURE__ */ __name((str5) => str5.slice(-3).toLowerCase() === "nan" ? NaN : str5[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, "resolve"),
3571
3571
  stringify: stringifyNumber
3572
3572
  };
3573
3573
  floatExp = {
@@ -3576,7 +3576,7 @@ var init_float = __esm({
3576
3576
  tag: "tag:yaml.org,2002:float",
3577
3577
  format: "EXP",
3578
3578
  test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
3579
- resolve: /* @__PURE__ */ __name((str4) => parseFloat(str4), "resolve"),
3579
+ resolve: /* @__PURE__ */ __name((str5) => parseFloat(str5), "resolve"),
3580
3580
  stringify(node3) {
3581
3581
  const num = Number(node3.value);
3582
3582
  return isFinite(num) ? num.toExponential() : stringifyNumber(node3);
@@ -3587,11 +3587,11 @@ var init_float = __esm({
3587
3587
  default: true,
3588
3588
  tag: "tag:yaml.org,2002:float",
3589
3589
  test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
3590
- resolve(str4) {
3591
- const node3 = new Scalar(parseFloat(str4));
3592
- const dot = str4.indexOf(".");
3593
- if (dot !== -1 && str4[str4.length - 1] === "0")
3594
- node3.minFractionDigits = str4.length - dot - 1;
3590
+ resolve(str5) {
3591
+ const node3 = new Scalar(parseFloat(str5));
3592
+ const dot = str5.indexOf(".");
3593
+ if (dot !== -1 && str5[str5.length - 1] === "0")
3594
+ node3.minFractionDigits = str5.length - dot - 1;
3595
3595
  return node3;
3596
3596
  },
3597
3597
  stringify: stringifyNumber
@@ -3614,7 +3614,7 @@ var init_int = __esm({
3614
3614
  init_performance2();
3615
3615
  init_stringifyNumber();
3616
3616
  intIdentify = /* @__PURE__ */ __name((value2) => typeof value2 === "bigint" || Number.isInteger(value2), "intIdentify");
3617
- intResolve = /* @__PURE__ */ __name((str4, offset2, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str4) : parseInt(str4.substring(offset2), radix), "intResolve");
3617
+ intResolve = /* @__PURE__ */ __name((str5, offset2, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str5) : parseInt(str5.substring(offset2), radix), "intResolve");
3618
3618
  __name(intStringify, "intStringify");
3619
3619
  intOct = {
3620
3620
  identify: /* @__PURE__ */ __name((value2) => intIdentify(value2) && value2 >= 0, "identify"),
@@ -3622,7 +3622,7 @@ var init_int = __esm({
3622
3622
  tag: "tag:yaml.org,2002:int",
3623
3623
  format: "OCT",
3624
3624
  test: /^0o[0-7]+$/,
3625
- resolve: /* @__PURE__ */ __name((str4, _onError, opt2) => intResolve(str4, 2, 8, opt2), "resolve"),
3625
+ resolve: /* @__PURE__ */ __name((str5, _onError, opt2) => intResolve(str5, 2, 8, opt2), "resolve"),
3626
3626
  stringify: /* @__PURE__ */ __name((node3) => intStringify(node3, 8, "0o"), "stringify")
3627
3627
  };
3628
3628
  int = {
@@ -3630,7 +3630,7 @@ var init_int = __esm({
3630
3630
  default: true,
3631
3631
  tag: "tag:yaml.org,2002:int",
3632
3632
  test: /^[-+]?[0-9]+$/,
3633
- resolve: /* @__PURE__ */ __name((str4, _onError, opt2) => intResolve(str4, 0, 10, opt2), "resolve"),
3633
+ resolve: /* @__PURE__ */ __name((str5, _onError, opt2) => intResolve(str5, 0, 10, opt2), "resolve"),
3634
3634
  stringify: stringifyNumber
3635
3635
  };
3636
3636
  intHex = {
@@ -3639,7 +3639,7 @@ var init_int = __esm({
3639
3639
  tag: "tag:yaml.org,2002:int",
3640
3640
  format: "HEX",
3641
3641
  test: /^0x[0-9a-fA-F]+$/,
3642
- resolve: /* @__PURE__ */ __name((str4, _onError, opt2) => intResolve(str4, 2, 16, opt2), "resolve"),
3642
+ resolve: /* @__PURE__ */ __name((str5, _onError, opt2) => intResolve(str5, 2, 16, opt2), "resolve"),
3643
3643
  stringify: /* @__PURE__ */ __name((node3) => intStringify(node3, 16, "0x"), "stringify")
3644
3644
  };
3645
3645
  }
@@ -3695,7 +3695,7 @@ var init_schema2 = __esm({
3695
3695
  identify: /* @__PURE__ */ __name((value2) => typeof value2 === "string", "identify"),
3696
3696
  default: true,
3697
3697
  tag: "tag:yaml.org,2002:str",
3698
- resolve: /* @__PURE__ */ __name((str4) => str4, "resolve"),
3698
+ resolve: /* @__PURE__ */ __name((str5) => str5, "resolve"),
3699
3699
  stringify: stringifyJSON
3700
3700
  },
3701
3701
  {
@@ -3712,7 +3712,7 @@ var init_schema2 = __esm({
3712
3712
  default: true,
3713
3713
  tag: "tag:yaml.org,2002:bool",
3714
3714
  test: /^true$|^false$/,
3715
- resolve: /* @__PURE__ */ __name((str4) => str4 === "true", "resolve"),
3715
+ resolve: /* @__PURE__ */ __name((str5) => str5 === "true", "resolve"),
3716
3716
  stringify: stringifyJSON
3717
3717
  },
3718
3718
  {
@@ -3720,7 +3720,7 @@ var init_schema2 = __esm({
3720
3720
  default: true,
3721
3721
  tag: "tag:yaml.org,2002:int",
3722
3722
  test: /^-?(?:0|[1-9][0-9]*)$/,
3723
- resolve: /* @__PURE__ */ __name((str4, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str4) : parseInt(str4, 10), "resolve"),
3723
+ resolve: /* @__PURE__ */ __name((str5, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str5) : parseInt(str5, 10), "resolve"),
3724
3724
  stringify: /* @__PURE__ */ __name(({ value: value2 }) => intIdentify2(value2) ? value2.toString() : JSON.stringify(value2), "stringify")
3725
3725
  },
3726
3726
  {
@@ -3728,7 +3728,7 @@ var init_schema2 = __esm({
3728
3728
  default: true,
3729
3729
  tag: "tag:yaml.org,2002:float",
3730
3730
  test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
3731
- resolve: /* @__PURE__ */ __name((str4) => parseFloat(str4), "resolve"),
3731
+ resolve: /* @__PURE__ */ __name((str5) => parseFloat(str5), "resolve"),
3732
3732
  stringify: stringifyJSON
3733
3733
  }
3734
3734
  ];
@@ -3736,9 +3736,9 @@ var init_schema2 = __esm({
3736
3736
  default: true,
3737
3737
  tag: "",
3738
3738
  test: /^/,
3739
- resolve(str4, onError) {
3740
- onError(`Unresolved plain scalar ${JSON.stringify(str4)}`);
3741
- return str4;
3739
+ resolve(str5, onError) {
3740
+ onError(`Unresolved plain scalar ${JSON.stringify(str5)}`);
3741
+ return str5;
3742
3742
  }
3743
3743
  };
3744
3744
  schema2 = [map, seq].concat(jsonScalars, jsonError);
@@ -3769,10 +3769,10 @@ var init_binary = __esm({
3769
3769
  */
3770
3770
  resolve(src2, onError) {
3771
3771
  if (typeof atob === "function") {
3772
- const str4 = atob(src2.replace(/[\n\r]/g, ""));
3773
- const buffer = new Uint8Array(str4.length);
3774
- for (let i3 = 0; i3 < str4.length; ++i3)
3775
- buffer[i3] = str4.charCodeAt(i3);
3772
+ const str5 = atob(src2.replace(/[\n\r]/g, ""));
3773
+ const buffer = new Uint8Array(str5.length);
3774
+ for (let i3 = 0; i3 < str5.length; ++i3)
3775
+ buffer[i3] = str5.charCodeAt(i3);
3776
3776
  return buffer;
3777
3777
  } else {
3778
3778
  onError("This environment does not support reading binary tags; either Buffer or atob is required");
@@ -3783,26 +3783,26 @@ var init_binary = __esm({
3783
3783
  if (!value2)
3784
3784
  return "";
3785
3785
  const buf = value2;
3786
- let str4;
3786
+ let str5;
3787
3787
  if (typeof btoa === "function") {
3788
3788
  let s2 = "";
3789
3789
  for (let i3 = 0; i3 < buf.length; ++i3)
3790
3790
  s2 += String.fromCharCode(buf[i3]);
3791
- str4 = btoa(s2);
3791
+ str5 = btoa(s2);
3792
3792
  } else {
3793
3793
  throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
3794
3794
  }
3795
3795
  type2 ?? (type2 = Scalar.BLOCK_LITERAL);
3796
3796
  if (type2 !== Scalar.QUOTE_DOUBLE) {
3797
3797
  const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
3798
- const n2 = Math.ceil(str4.length / lineWidth);
3798
+ const n2 = Math.ceil(str5.length / lineWidth);
3799
3799
  const lines = new Array(n2);
3800
3800
  for (let i3 = 0, o3 = 0; i3 < n2; ++i3, o3 += lineWidth) {
3801
- lines[i3] = str4.substr(o3, lineWidth);
3801
+ lines[i3] = str5.substr(o3, lineWidth);
3802
3802
  }
3803
- str4 = lines.join(type2 === Scalar.BLOCK_LITERAL ? "\n" : " ");
3803
+ str5 = lines.join(type2 === Scalar.BLOCK_LITERAL ? "\n" : " ");
3804
3804
  }
3805
- return stringifyString({ comment, type: type2, value: str4 }, ctx, onComment, onChompKeep);
3805
+ return stringifyString({ comment, type: type2, value: str5 }, ctx, onComment, onChompKeep);
3806
3806
  }
3807
3807
  };
3808
3808
  }
@@ -4018,7 +4018,7 @@ var init_float2 = __esm({
4018
4018
  default: true,
4019
4019
  tag: "tag:yaml.org,2002:float",
4020
4020
  test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
4021
- resolve: /* @__PURE__ */ __name((str4) => str4.slice(-3).toLowerCase() === "nan" ? NaN : str4[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, "resolve"),
4021
+ resolve: /* @__PURE__ */ __name((str5) => str5.slice(-3).toLowerCase() === "nan" ? NaN : str5[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, "resolve"),
4022
4022
  stringify: stringifyNumber
4023
4023
  };
4024
4024
  floatExp2 = {
@@ -4027,7 +4027,7 @@ var init_float2 = __esm({
4027
4027
  tag: "tag:yaml.org,2002:float",
4028
4028
  format: "EXP",
4029
4029
  test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
4030
- resolve: /* @__PURE__ */ __name((str4) => parseFloat(str4.replace(/_/g, "")), "resolve"),
4030
+ resolve: /* @__PURE__ */ __name((str5) => parseFloat(str5.replace(/_/g, "")), "resolve"),
4031
4031
  stringify(node3) {
4032
4032
  const num = Number(node3.value);
4033
4033
  return isFinite(num) ? num.toExponential() : stringifyNumber(node3);
@@ -4038,11 +4038,11 @@ var init_float2 = __esm({
4038
4038
  default: true,
4039
4039
  tag: "tag:yaml.org,2002:float",
4040
4040
  test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
4041
- resolve(str4) {
4042
- const node3 = new Scalar(parseFloat(str4.replace(/_/g, "")));
4043
- const dot = str4.indexOf(".");
4041
+ resolve(str5) {
4042
+ const node3 = new Scalar(parseFloat(str5.replace(/_/g, "")));
4043
+ const dot = str5.indexOf(".");
4044
4044
  if (dot !== -1) {
4045
- const f3 = str4.substring(dot + 1).replace(/_/g, "");
4045
+ const f3 = str5.substring(dot + 1).replace(/_/g, "");
4046
4046
  if (f3[f3.length - 1] === "0")
4047
4047
  node3.minFractionDigits = f3.length;
4048
4048
  }
@@ -4054,34 +4054,34 @@ var init_float2 = __esm({
4054
4054
  });
4055
4055
 
4056
4056
  // ../../home/runner/work/vibes.diy/vibes.diy/node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js
4057
- function intResolve2(str4, offset2, radix, { intAsBigInt }) {
4058
- const sign = str4[0];
4057
+ function intResolve2(str5, offset2, radix, { intAsBigInt }) {
4058
+ const sign = str5[0];
4059
4059
  if (sign === "-" || sign === "+")
4060
4060
  offset2 += 1;
4061
- str4 = str4.substring(offset2).replace(/_/g, "");
4061
+ str5 = str5.substring(offset2).replace(/_/g, "");
4062
4062
  if (intAsBigInt) {
4063
4063
  switch (radix) {
4064
4064
  case 2:
4065
- str4 = `0b${str4}`;
4065
+ str5 = `0b${str5}`;
4066
4066
  break;
4067
4067
  case 8:
4068
- str4 = `0o${str4}`;
4068
+ str5 = `0o${str5}`;
4069
4069
  break;
4070
4070
  case 16:
4071
- str4 = `0x${str4}`;
4071
+ str5 = `0x${str5}`;
4072
4072
  break;
4073
4073
  }
4074
- const n3 = BigInt(str4);
4074
+ const n3 = BigInt(str5);
4075
4075
  return sign === "-" ? BigInt(-1) * n3 : n3;
4076
4076
  }
4077
- const n2 = parseInt(str4, radix);
4077
+ const n2 = parseInt(str5, radix);
4078
4078
  return sign === "-" ? -1 * n2 : n2;
4079
4079
  }
4080
4080
  function intStringify2(node3, radix, prefix) {
4081
4081
  const { value: value2 } = node3;
4082
4082
  if (intIdentify3(value2)) {
4083
- const str4 = value2.toString(radix);
4084
- return value2 < 0 ? "-" + prefix + str4.substr(1) : prefix + str4;
4083
+ const str5 = value2.toString(radix);
4084
+ return value2 < 0 ? "-" + prefix + str5.substr(1) : prefix + str5;
4085
4085
  }
4086
4086
  return stringifyNumber(node3);
4087
4087
  }
@@ -4101,7 +4101,7 @@ var init_int2 = __esm({
4101
4101
  tag: "tag:yaml.org,2002:int",
4102
4102
  format: "BIN",
4103
4103
  test: /^[-+]?0b[0-1_]+$/,
4104
- resolve: /* @__PURE__ */ __name((str4, _onError, opt2) => intResolve2(str4, 2, 2, opt2), "resolve"),
4104
+ resolve: /* @__PURE__ */ __name((str5, _onError, opt2) => intResolve2(str5, 2, 2, opt2), "resolve"),
4105
4105
  stringify: /* @__PURE__ */ __name((node3) => intStringify2(node3, 2, "0b"), "stringify")
4106
4106
  };
4107
4107
  intOct2 = {
@@ -4110,7 +4110,7 @@ var init_int2 = __esm({
4110
4110
  tag: "tag:yaml.org,2002:int",
4111
4111
  format: "OCT",
4112
4112
  test: /^[-+]?0[0-7_]+$/,
4113
- resolve: /* @__PURE__ */ __name((str4, _onError, opt2) => intResolve2(str4, 1, 8, opt2), "resolve"),
4113
+ resolve: /* @__PURE__ */ __name((str5, _onError, opt2) => intResolve2(str5, 1, 8, opt2), "resolve"),
4114
4114
  stringify: /* @__PURE__ */ __name((node3) => intStringify2(node3, 8, "0"), "stringify")
4115
4115
  };
4116
4116
  int2 = {
@@ -4118,7 +4118,7 @@ var init_int2 = __esm({
4118
4118
  default: true,
4119
4119
  tag: "tag:yaml.org,2002:int",
4120
4120
  test: /^[-+]?[0-9][0-9_]*$/,
4121
- resolve: /* @__PURE__ */ __name((str4, _onError, opt2) => intResolve2(str4, 0, 10, opt2), "resolve"),
4121
+ resolve: /* @__PURE__ */ __name((str5, _onError, opt2) => intResolve2(str5, 0, 10, opt2), "resolve"),
4122
4122
  stringify: stringifyNumber
4123
4123
  };
4124
4124
  intHex2 = {
@@ -4127,7 +4127,7 @@ var init_int2 = __esm({
4127
4127
  tag: "tag:yaml.org,2002:int",
4128
4128
  format: "HEX",
4129
4129
  test: /^[-+]?0x[0-9a-fA-F_]+$/,
4130
- resolve: /* @__PURE__ */ __name((str4, _onError, opt2) => intResolve2(str4, 2, 16, opt2), "resolve"),
4130
+ resolve: /* @__PURE__ */ __name((str5, _onError, opt2) => intResolve2(str5, 2, 16, opt2), "resolve"),
4131
4131
  stringify: /* @__PURE__ */ __name((node3) => intStringify2(node3, 16, "0x"), "stringify")
4132
4132
  };
4133
4133
  }
@@ -4227,9 +4227,9 @@ var init_set = __esm({
4227
4227
  });
4228
4228
 
4229
4229
  // ../../home/runner/work/vibes.diy/vibes.diy/node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js
4230
- function parseSexagesimal(str4, asBigInt) {
4231
- const sign = str4[0];
4232
- const parts = sign === "-" || sign === "+" ? str4.substring(1) : str4;
4230
+ function parseSexagesimal(str5, asBigInt) {
4231
+ const sign = str5[0];
4232
+ const parts = sign === "-" || sign === "+" ? str5.substring(1) : str5;
4233
4233
  const num = /* @__PURE__ */ __name((n2) => asBigInt ? BigInt(n2) : Number(n2), "num");
4234
4234
  const res = parts.replace(/_/g, "").split(":").reduce((res2, p2) => res2 * num(60) + num(p2), num(0));
4235
4235
  return sign === "-" ? num(-1) * res : res;
@@ -4275,7 +4275,7 @@ var init_timestamp = __esm({
4275
4275
  tag: "tag:yaml.org,2002:int",
4276
4276
  format: "TIME",
4277
4277
  test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
4278
- resolve: /* @__PURE__ */ __name((str4, _onError, { intAsBigInt }) => parseSexagesimal(str4, intAsBigInt), "resolve"),
4278
+ resolve: /* @__PURE__ */ __name((str5, _onError, { intAsBigInt }) => parseSexagesimal(str5, intAsBigInt), "resolve"),
4279
4279
  stringify: stringifySexagesimal
4280
4280
  };
4281
4281
  floatTime = {
@@ -4284,7 +4284,7 @@ var init_timestamp = __esm({
4284
4284
  tag: "tag:yaml.org,2002:float",
4285
4285
  format: "TIME",
4286
4286
  test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
4287
- resolve: /* @__PURE__ */ __name((str4) => parseSexagesimal(str4, false), "resolve"),
4287
+ resolve: /* @__PURE__ */ __name((str5) => parseSexagesimal(str5, false), "resolve"),
4288
4288
  stringify: stringifySexagesimal
4289
4289
  };
4290
4290
  timestamp = {
@@ -4295,8 +4295,8 @@ var init_timestamp = __esm({
4295
4295
  // may be omitted altogether, resulting in a date format. In such a case, the time part is
4296
4296
  // assumed to be 00:00:00Z (start of day, UTC).
4297
4297
  test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
4298
- resolve(str4) {
4299
- const match4 = str4.match(timestamp.test);
4298
+ resolve(str5) {
4299
+ const match4 = str5.match(timestamp.test);
4300
4300
  if (!match4)
4301
4301
  throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
4302
4302
  const [, year, month, day, hour, minute, second] = match4.map(Number);
@@ -9930,8 +9930,8 @@ var init_txt_en_decoder = __esm({
9930
9930
  }
9931
9931
  encoder = new TextEncoder();
9932
9932
  decoder = new TextDecoder();
9933
- encode = /* @__PURE__ */ __name((str4) => {
9934
- return this.encoder.encode(str4);
9933
+ encode = /* @__PURE__ */ __name((str5) => {
9934
+ return this.encoder.encode(str5);
9935
9935
  }, "encode");
9936
9936
  decode = /* @__PURE__ */ __name((data2) => {
9937
9937
  if (!data2) {
@@ -9967,10 +9967,10 @@ var init_txt_en_decoder = __esm({
9967
9967
  });
9968
9968
 
9969
9969
  // ../../home/runner/work/vibes.diy/vibes.diy/node_modules/.pnpm/@adviser+cement@0.5.37_patch_hash=4b56088b3199853cd2f95b22916eab8aa4b3a5e88440a5cc47d309d83a874c0d_typescript@6.0.3/node_modules/@adviser/cement/esm/is-json.js
9970
- function isJSON(str4) {
9971
- if (possibleJSONre.test(str4)) {
9970
+ function isJSON(str5) {
9971
+ if (possibleJSONre.test(str5)) {
9972
9972
  try {
9973
- const parsed2 = JSON.parse(str4);
9973
+ const parsed2 = JSON.parse(str5);
9974
9974
  return { isJSON: true, parsed: parsed2 };
9975
9975
  } catch {
9976
9976
  }
@@ -10996,14 +10996,14 @@ var init_uri = __esm({
10996
10996
  this._url.searchParams.delete(key);
10997
10997
  return this;
10998
10998
  }
10999
- defParam(key, str4) {
10999
+ defParam(key, str5) {
11000
11000
  if (!this._url.searchParams.has(key)) {
11001
- this._url.searchParams.set(key, str4);
11001
+ this._url.searchParams.set(key, str5);
11002
11002
  }
11003
11003
  return this;
11004
11004
  }
11005
- setParam(key, str4) {
11006
- this._url.searchParams.set(key, str4);
11005
+ setParam(key, str5) {
11006
+ this._url.searchParams.set(key, str5);
11007
11007
  return this;
11008
11008
  }
11009
11009
  hasParam(key) {
@@ -26488,7 +26488,13 @@ var init_block_stream = __esm({
26488
26488
  // #10273: of those, the entries no write of the turn survived for (saved unchanged).
26489
26489
  "editsNotApplied?": "string[]",
26490
26490
  findings: "string[]",
26491
- "usage?": type({ prompt_tokens: "number", completion_tokens: "number", total_tokens: "number", "cost?": "number" }).array()
26491
+ "usage?": type({ prompt_tokens: "number", completion_tokens: "number", total_tokens: "number", "cost?": "number" }).array(),
26492
+ // VibesDIY/vibes.diy#12165: when a model round ran, how it asked (`whole` file or `edits`
26493
+ // over the broken region), the largest file it fixed as a class, and how long it took.
26494
+ "ask?": "'whole' | 'edits'",
26495
+ "fileKind?": "'entry' | 'component' | 'seed' | 'other'",
26496
+ "sizeClass?": "'under-8kb' | '8-16kb' | '16-32kb' | '32kb-plus'",
26497
+ "ms?": "number"
26492
26498
  }),
26493
26499
  // The save-path seed repair this turn needed (VibesDIY/vibes.diy#6904),
26494
26500
  // written unless `SEED_REPAIR` is "off" and only when the turn wrote a
@@ -28715,7 +28721,10 @@ var init_prompt = __esm({
28715
28721
  "detail?": "string",
28716
28722
  "ms?": "number",
28717
28723
  "fileKind?": SaveRepairFileKind,
28718
- "sizeClass?": SaveRepairSizeClass
28724
+ "sizeClass?": SaveRepairSizeClass,
28725
+ // #12165: how the round asked for the files: `whole` re-emits them, `edits` asks a file of
28726
+ // 16 kB or more for SEARCH/REPLACE sections over the broken lines. Absent when no round ran.
28727
+ "ask?": "'whole' | 'edits'"
28719
28728
  })
28720
28729
  );
28721
28730
  PromptError = lazyType(
@@ -33028,7 +33037,7 @@ var init_stop_turn = __esm({
33028
33037
  });
33029
33038
 
33030
33039
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/types/custom-domain.ts
33031
- var customDomainPhase, customDomainState, vibeTarget, reqCustomDomainSet, reqCustomDomainGet, reqCustomDomainRemove, reqCustomDomainClaim, customDomainClaim, resCustomDomain, reqDomainSearch, domainSuggestion, resDomainSearch;
33040
+ var customDomainPhase, customDomainState, vibeTarget, reqCustomDomainSet, reqCustomDomainGet, reqCustomDomainRemove, reqCustomDomainClaim, customDomainClaim, boughtDomain, resCustomDomain, DOMAIN_SEARCH_QUERY_MAX, DOMAIN_SEARCH_TITLE_MAX, reqDomainSearch, domainSuggestion, resDomainSearch, DOMAIN_CONTACT_FIELDS, domainContact, reqDomainBuy, domainBuyStatus, resDomainBuy;
33032
33041
  var init_custom_domain = __esm({
33033
33042
  "../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/types/custom-domain.ts"() {
33034
33043
  "use strict";
@@ -33095,6 +33104,20 @@ var init_custom_domain = __esm({
33095
33104
  recordValue: "string"
33096
33105
  })
33097
33106
  );
33107
+ boughtDomain = lazyType(
33108
+ () => type({
33109
+ domainName: "string",
33110
+ /** When the paid term ends (ISO 8601), once registered. */
33111
+ "expiresAt?": "string",
33112
+ autoRenew: "boolean",
33113
+ /**
33114
+ * Where `www.<name>` stands: its own Cloudflare hostname and certificate,
33115
+ * settling on their own clock. The address is fully live once both the
33116
+ * bare name and this read `active`.
33117
+ */
33118
+ "wwwPhase?": customDomainPhase
33119
+ })
33120
+ );
33098
33121
  resCustomDomain = lazyType(
33099
33122
  () => type({
33100
33123
  type: "'vibes.diy.res-custom-domain'",
@@ -33108,26 +33131,40 @@ var init_custom_domain = __esm({
33108
33131
  */
33109
33132
  "claim?": customDomainClaim,
33110
33133
  /** True when this deployment can search for a new address to get (#12119). */
33111
- "newAddress?": "boolean"
33134
+ "newAddress?": "boolean",
33135
+ /**
33136
+ * Set when `domain` is a name the owner bought here (#12120): the card
33137
+ * shows "Setting up your address" rather than a DNS record to add, since
33138
+ * we set the records ourselves.
33139
+ */
33140
+ "bought?": boughtDomain,
33141
+ /**
33142
+ * A purchase for this vibe that has started and not finished (#12120):
33143
+ * the card calls `domainBuy` with this order id to finish it, so a closed
33144
+ * tab or a Checkout return to another page never strands a paid name.
33145
+ */
33146
+ "pendingPurchase?": type({ domainName: "string", orderId: "string" })
33112
33147
  })
33113
33148
  );
33149
+ DOMAIN_SEARCH_QUERY_MAX = 253;
33150
+ DOMAIN_SEARCH_TITLE_MAX = 200;
33114
33151
  reqDomainSearch = lazyType(
33115
33152
  () => type({
33116
33153
  type: "'vibes.diy.req-domain-search'",
33117
33154
  auth: dashAuthType,
33118
33155
  ...vibeTarget,
33119
33156
  /** What the owner typed: a name (`my cafe`) or a whole domain (`mycafe.app`). */
33120
- query: "string <= 253",
33157
+ query: `string <= ${DOMAIN_SEARCH_QUERY_MAX}`,
33121
33158
  /** The vibe's title, for a second set of suggestions. */
33122
- "title?": "string <= 200"
33159
+ "title?": `string <= ${DOMAIN_SEARCH_TITLE_MAX}`
33123
33160
  })
33124
33161
  );
33125
33162
  domainSuggestion = lazyType(
33126
33163
  () => type({
33127
33164
  domainName: "string",
33128
- /** Free to register right now. */
33165
+ /** Free to register right now (search answers free names only). */
33129
33166
  available: "boolean",
33130
- /** Our price for one term, in US cents (never the registrar's). */
33167
+ /** Our price for one term, in US cents (never the registrar's); renewals cost the same. */
33131
33168
  priceCents: "number",
33132
33169
  /** Years per term: registration and every renewal (.ai is 2). */
33133
33170
  termYears: "number"
@@ -33142,6 +33179,73 @@ var init_custom_domain = __esm({
33142
33179
  suggestions: domainSuggestion.array()
33143
33180
  })
33144
33181
  );
33182
+ DOMAIN_CONTACT_FIELDS = [
33183
+ "firstName",
33184
+ "lastName",
33185
+ "address1",
33186
+ "city",
33187
+ "state",
33188
+ "zip",
33189
+ "country",
33190
+ "email",
33191
+ "phone"
33192
+ ];
33193
+ domainContact = lazyType(
33194
+ () => type({
33195
+ "firstName?": "string <= 100",
33196
+ "lastName?": "string <= 100",
33197
+ "address1?": "string <= 200",
33198
+ "address2?": "string <= 200",
33199
+ "city?": "string <= 100",
33200
+ "state?": "string <= 100",
33201
+ "zip?": "string <= 20",
33202
+ /** ISO 3166-1 alpha-2, e.g. `US`. */
33203
+ "country?": "string <= 2",
33204
+ "email?": "string <= 254",
33205
+ /** E.164, e.g. `+14155550100`. */
33206
+ "phone?": "string <= 20"
33207
+ })
33208
+ );
33209
+ reqDomainBuy = lazyType(
33210
+ () => type({
33211
+ type: "'vibes.diy.req-domain-buy'",
33212
+ auth: dashAuthType,
33213
+ ...vibeTarget,
33214
+ /** A name from the search, like `mycafe.com`. */
33215
+ domainName: "string <= 253",
33216
+ /** What the owner filled in; the server fills the rest from their account and asks for what is still missing. */
33217
+ "contact?": domainContact,
33218
+ /** The page Stripe Checkout returns to (our own origins only). */
33219
+ successUrl: "string <= 2000",
33220
+ /** Finish this order (after a Checkout return) instead of starting a new one. */
33221
+ "orderId?": "string <= 100",
33222
+ /**
33223
+ * The price for one term the owner was shown, in US cents. A new order
33224
+ * charges it when the fresh price is the same or lower, and answers
33225
+ * `price-changed` (nothing charged) when the fresh price is higher.
33226
+ */
33227
+ "priceCents?": "number.integer > 0"
33228
+ })
33229
+ );
33230
+ domainBuyStatus = type("'needs-contact'|'price-changed'|'checkout'|'processing'|'setting-up'|'live'");
33231
+ resDomainBuy = lazyType(
33232
+ () => type({
33233
+ type: "'vibes.diy.res-domain-buy'",
33234
+ ...vibeTarget,
33235
+ domainName: "string",
33236
+ status: domainBuyStatus,
33237
+ /** Our price for one term, in US cents (what this order charges, or the new price for `price-changed`), and the term in years. */
33238
+ priceCents: "number",
33239
+ termYears: "number",
33240
+ "orderId?": "string",
33241
+ "checkoutUrl?": "string",
33242
+ /** needs-contact: the fields still to ask for, and what we could fill in. */
33243
+ "missing?": type.enumerated(...DOMAIN_CONTACT_FIELDS).array(),
33244
+ "prefill?": domainContact,
33245
+ /** setting-up / live: the vibe's address as it now stands. */
33246
+ "domain?": customDomainState
33247
+ })
33248
+ );
33145
33249
  }
33146
33250
  });
33147
33251
 
@@ -41366,11 +41470,11 @@ function base(ALPHABET, name, caseInsensitive) {
41366
41470
  while (it22 !== size && b58[it22] === 0) {
41367
41471
  it22++;
41368
41472
  }
41369
- var str4 = LEADER.repeat(zeroes);
41473
+ var str5 = LEADER.repeat(zeroes);
41370
41474
  for (; it22 < size; ++it22) {
41371
- str4 += ALPHABET.charAt(b58[it22]);
41475
+ str5 += ALPHABET.charAt(b58[it22]);
41372
41476
  }
41373
- return str4;
41477
+ return str5;
41374
41478
  }
41375
41479
  __name(encode9, "encode");
41376
41480
  function decodeUnsafe(source) {
@@ -42228,14 +42332,14 @@ function promiseAllObject(promisesObj) {
42228
42332
  }
42229
42333
  function randomString(length2 = 10) {
42230
42334
  const chars2 = "abcdefghijklmnopqrstuvwxyz";
42231
- let str4 = "";
42335
+ let str5 = "";
42232
42336
  for (let i3 = 0; i3 < length2; i3++) {
42233
- str4 += chars2[Math.floor(Math.random() * chars2.length)];
42337
+ str5 += chars2[Math.floor(Math.random() * chars2.length)];
42234
42338
  }
42235
- return str4;
42339
+ return str5;
42236
42340
  }
42237
- function esc(str4) {
42238
- return JSON.stringify(str4);
42341
+ function esc(str5) {
42342
+ return JSON.stringify(str5);
42239
42343
  }
42240
42344
  function slugify(input3) {
42241
42345
  return input3.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
@@ -42279,8 +42383,8 @@ function numKeys(data2) {
42279
42383
  }
42280
42384
  return keyCount;
42281
42385
  }
42282
- function escapeRegex(str4) {
42283
- return str4.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
42386
+ function escapeRegex(str5) {
42387
+ return str5.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
42284
42388
  }
42285
42389
  function clone(inst, def, params) {
42286
42390
  const cl = new inst._zod.constr(def ?? inst._zod.def);
@@ -42534,13 +42638,13 @@ function getSizableOrigin(input3) {
42534
42638
  return "file";
42535
42639
  return "unknown";
42536
42640
  }
42537
- function codePointLength(str4) {
42538
- const units = str4.length;
42539
- if (!highSurrogate.test(str4))
42641
+ function codePointLength(str5) {
42642
+ const units = str5.length;
42643
+ if (!highSurrogate.test(str5))
42540
42644
  return units;
42541
42645
  let count4 = units;
42542
42646
  for (let i3 = 0; i3 < units - 1; i3++) {
42543
- if ((str4.charCodeAt(i3) & 64512) === 55296 && (str4.charCodeAt(i3 + 1) & 64512) === 56320) {
42647
+ if ((str5.charCodeAt(i3) & 64512) === 55296 && (str5.charCodeAt(i3 + 1) & 64512) === 56320) {
42544
42648
  count4--;
42545
42649
  i3++;
42546
42650
  }
@@ -64149,9 +64253,9 @@ var init_jws_verify = __esm({
64149
64253
  function invalidDuration() {
64150
64254
  throw new TypeError("Invalid time period format");
64151
64255
  }
64152
- function secs(str4) {
64153
- typeof str4 != "string" && invalidDuration();
64154
- const matched = REGEX.exec(str4);
64256
+ function secs(str5) {
64257
+ typeof str5 != "string" && invalidDuration();
64258
+ const matched = REGEX.exec(str5);
64155
64259
  (!matched || matched[4] && matched[1]) && invalidDuration();
64156
64260
  const value2 = parseFloat(matched[2]), durationSeconds = Math.round(value2 * multipliers[matched[3][0].toLowerCase()]);
64157
64261
  return Number.isFinite(durationSeconds) || invalidDuration(), matched[1] === "-" || matched[4]?.toLowerCase() === "ago" ? -durationSeconds : durationSeconds;
@@ -68135,8 +68239,8 @@ var init_sql = __esm({
68135
68239
  }
68136
68240
  __name(fromList, "fromList");
68137
68241
  sql2.fromList = fromList;
68138
- function raw(str4) {
68139
- return new SQL([new StringChunk(str4)]);
68242
+ function raw(str5) {
68243
+ return new SQL([new StringChunk(str5)]);
68140
68244
  }
68141
68245
  __name(raw, "raw");
68142
68246
  sql2.raw = raw;
@@ -72718,8 +72822,8 @@ var init_dialect = __esm({
72718
72822
  escapeParam(_num) {
72719
72823
  return "?";
72720
72824
  }
72721
- escapeString(str4) {
72722
- return `'${str4.replace(/'/g, "''")}'`;
72825
+ escapeString(str5) {
72826
+ return `'${str5.replace(/'/g, "''")}'`;
72723
72827
  }
72724
72828
  buildWithCTE(queries) {
72725
72829
  if (!queries?.length) return void 0;
@@ -75687,7 +75791,7 @@ var init_drizzle_orm = __esm({
75687
75791
  });
75688
75792
 
75689
75793
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/sql/vibes-diy-api-schema-sqlite.ts
75690
- var sqlAssets, sqlHandleBinding, sqlAppSlugBinding, sqlApps, sqlGuestBuilds, sqlChatContexts, sqlMintJobs, sqlOpenTurns, sqlChatSections, sqlPromptContexts, sqlApplicationChats, sqlUserSettings, sqlAppSettings, sqlAppSettingItems, sqlHandleSettings, sqlRequestGrants, sqlDeveloperGrants, sqlAppDocuments, sqlSyncFeed, sqlVibeCuration, sqlDirectChannelIndex, sqlDirectChannelReads, sqlSocialEdges, sqlSocialBlocks, sqlAudienceArms, sqlSocialInvites, sqlSocialInviteSuppressions, sqlChannelInvites, sqlInviteGrants, sqlAssetUploads, sqlAssetSafety, sqlImgGenClaims, sqlAppClipExperiences, sqlRefererEvents, sqlMissingVibeEvents, sqlLandingEvents, sqlApiRequestEvents, sqlEgressEvents, sqlEgressSuspectEvents, sqlSessionsFanoutEvents, sqlAccessFunctionBindings, sqlNotifications, sqlNotificationDigests, sqlVibeLogEvents, sqlGithubRepoRoutes, sqlGithubSourceBindings, sqlSignupAttributions, sqlMakerCredits, sqlAccessFnOutputs, sqlAccessFnChannelIndex, sqlAccessFnChannelIndexState, sqlAppFirstMessageEmbeddings, sqlAppParticipants, sqlThirdPartyGrants, sqlThirdPartyConsents, sqlConnectionApprovals, sqlAppContentOrdinals, sqlAppPublicNames, sqlLookRestyleRounds, sqlAppMoves, sqlStripeConnectAccounts, sqlPlatformDailyCounters, sqlPhoneLinkCodes, sqlPhoneLinkInvites, sqlCliCertPickups, sqlVibeReports, sqlAutoModerationFlags, sqlAccountSuspensions, sqlPlatformSwitches, sqlTextLinks, sqlTextChats, sqlTextLines, sqlTextLineDays, sqlTextOnboarding, sqlTextTaps, sqlTextConsents, sqlVibeBriefs, sqlCustomDomains;
75794
+ var sqlAssets, sqlHandleBinding, sqlAppSlugBinding, sqlApps, sqlGuestBuilds, sqlChatContexts, sqlMintJobs, sqlOpenTurns, sqlChatSections, sqlPromptContexts, sqlApplicationChats, sqlUserSettings, sqlAppSettings, sqlAppSettingItems, sqlHandleSettings, sqlRequestGrants, sqlDeveloperGrants, sqlAppDocuments, sqlSyncFeed, sqlVibeCuration, sqlDirectChannelIndex, sqlDirectChannelReads, sqlSocialEdges, sqlSocialBlocks, sqlAudienceArms, sqlSocialInvites, sqlSocialInviteSuppressions, sqlChannelInvites, sqlInviteGrants, sqlAssetUploads, sqlAssetSafety, sqlImgGenClaims, sqlAppClipExperiences, sqlRefererEvents, sqlMissingVibeEvents, sqlLandingEvents, sqlApiRequestEvents, sqlEgressEvents, sqlEgressSuspectEvents, sqlSessionsFanoutEvents, sqlAccessFunctionBindings, sqlNotifications, sqlNotificationDigests, sqlVibeLogEvents, sqlGithubRepoRoutes, sqlGithubSourceBindings, sqlSignupAttributions, sqlMakerCredits, sqlAccessFnOutputs, sqlAccessFnChannelIndex, sqlAccessFnChannelIndexState, sqlAppFirstMessageEmbeddings, sqlAppParticipants, sqlThirdPartyGrants, sqlThirdPartyConsents, sqlConnectionApprovals, sqlAppContentOrdinals, sqlAppPublicNames, sqlLookRestyleRounds, sqlAppMoves, sqlStripeConnectAccounts, sqlPlatformDailyCounters, sqlPhoneLinkCodes, sqlPhoneLinkInvites, sqlCliCertPickups, sqlVibeReports, sqlAutoModerationFlags, sqlAccountSuspensions, sqlPlatformSwitches, sqlTextLinks, sqlTextChats, sqlTextLines, sqlTextLineDays, sqlTextOnboarding, sqlTextTaps, sqlTextConsents, sqlVibeBriefs, sqlCustomDomains, sqlDomains;
75691
75795
  var init_vibes_diy_api_schema_sqlite = __esm({
75692
75796
  "../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/sql/vibes-diy-api-schema-sqlite.ts"() {
75693
75797
  "use strict";
@@ -77442,6 +77546,47 @@ SELECT DISTINCT a."ownerHandle" AS "userSlug", a."appSlug" AS "appSlug",
77442
77546
  // both land (#12050 review).
77443
77547
  (table4) => [uniqueIndex("CustomDomains_vibe").on(table4.ownerHandle, table4.appSlug)]
77444
77548
  );
77549
+ sqlDomains = sqliteTable(
77550
+ "Domains",
77551
+ {
77552
+ domainName: text().primaryKey(),
77553
+ userId: text().notNull(),
77554
+ ownerHandle: text().notNull(),
77555
+ appSlug: text().notNull(),
77556
+ orderId: text().notNull(),
77557
+ planId: text().notNull(),
77558
+ priceCents: int4().notNull(),
77559
+ termYears: int4().notNull(),
77560
+ status: text().notNull(),
77561
+ chargeRef: text().notNull().default(""),
77562
+ checkoutUrl: text().notNull().default(""),
77563
+ registrarOrder: text().notNull().default(""),
77564
+ expiresAt: text().notNull().default(""),
77565
+ autoRenew: int4().notNull().default(1),
77566
+ wwwCfHostnameId: text().notNull().default(""),
77567
+ wwwStatus: text().notNull().default(""),
77568
+ // Cloudflare's word for the www hostname
77569
+ wwwSslStatus: text().notNull().default(""),
77570
+ // and its certificate; www is live once both read `active`
77571
+ registrant: text().notNull().default(""),
77572
+ lastError: text().notNull().default(""),
77573
+ created: text().notNull(),
77574
+ updated: text().notNull()
77575
+ },
77576
+ (table4) => [
77577
+ index("Domains_vibe").on(table4.ownerHandle, table4.appSlug),
77578
+ index("Domains_user").on(table4.userId),
77579
+ // One paid invoice buys one name: claiming an invoice for an order is a
77580
+ // write this index refuses when another row already holds it (#12178 review).
77581
+ uniqueIndex("Domains_chargeRef").on(table4.chargeRef).where(sql`"chargeRef" <> ''`),
77582
+ // One open order per owner per plan, so per owner on the one `domain` plan (#12178 review): Autumn's invoice
77583
+ // list doesn't say which order a paid invoice paid for, so while an order
77584
+ // is unpaid (or a declined card's invoice isn't proven void) no second order
77585
+ // on the same plan starts, and an unused paid invoice on the plan can only
77586
+ // be that order's.
77587
+ uniqueIndex("Domains_openOrder").on(table4.userId, table4.planId).where(sql`"status" IN ('awaiting-payment', 'payment-held')`)
77588
+ ]
77589
+ );
77445
77590
  }
77446
77591
  });
77447
77592
 
@@ -77809,8 +77954,8 @@ var init_dialect2 = __esm({
77809
77954
  escapeParam(num) {
77810
77955
  return `$${num + 1}`;
77811
77956
  }
77812
- escapeString(str4) {
77813
- return `'${str4.replace(/'/g, "''")}'`;
77957
+ escapeString(str5) {
77958
+ return `'${str5.replace(/'/g, "''")}'`;
77814
77959
  }
77815
77960
  buildWithCTE(queries) {
77816
77961
  if (!queries?.length) return void 0;
@@ -81682,7 +81827,7 @@ var init_pg_core = __esm({
81682
81827
  });
81683
81828
 
81684
81829
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/sql/vibes-diy-api-schema-pg.ts
81685
- var bytea, EMBEDDING_DIMS, sqlAssets2, sqlHandleBinding2, sqlAppSlugBinding2, sqlApps2, sqlGuestBuilds2, sqlChatContexts2, sqlMintJobs2, sqlOpenTurns2, sqlChatSections2, sqlPromptContexts2, sqlApplicationChats2, sqlUserSettings2, sqlAppSettings2, sqlAppSettingItems2, sqlHandleSettings2, sqlRequestGrants2, sqlDeveloperGrants2, sqlAppDocuments2, sqlSyncFeed2, sqlVibeCuration2, sqlDirectChannelIndex2, sqlDirectChannelReads2, sqlSocialEdges2, sqlSocialBlocks2, sqlAudienceArms2, sqlSocialInvites2, sqlSocialInviteSuppressions2, sqlChannelInvites2, sqlInviteGrants2, sqlRefererEvents2, sqlMissingVibeEvents2, sqlLandingEvents2, sqlApiRequestEvents2, sqlEgressEvents2, sqlEgressSuspectEvents2, sqlSessionsFanoutEvents2, sqlAssetUploads2, sqlAssetSafety2, sqlImgGenClaims2, sqlAppClipExperiences2, sqlAccessFunctionBindings2, sqlNotifications2, sqlNotificationDigests2, sqlVibeLogEvents2, sqlGithubRepoRoutes2, sqlGithubSourceBindings2, sqlSignupAttributions2, sqlMakerCredits2, sqlAccessFnOutputs2, sqlAccessFnChannelIndex2, sqlAccessFnChannelIndexState2, sqlAppFirstMessageEmbeddings2, sqlAppParticipants2, sqlThirdPartyGrants2, sqlThirdPartyConsents2, sqlConnectionApprovals2, sqlAppContentOrdinals2, sqlAppPublicNames2, sqlLookRestyleRounds2, sqlAppMoves2, sqlStripeConnectAccounts2, sqlPlatformDailyCounters2, sqlPhoneLinkCodes2, sqlPhoneLinkInvites2, sqlCliCertPickups2, sqlVibeReports2, sqlAutoModerationFlags2, sqlAccountSuspensions2, sqlPlatformSwitches2, sqlTextLinks2, sqlTextChats2, sqlTextLines2, sqlTextLineDays2, sqlTextOnboarding2, sqlTextTaps2, sqlTextConsents2, sqlVibeBriefs2, sqlCustomDomains2;
81830
+ var bytea, EMBEDDING_DIMS, sqlAssets2, sqlHandleBinding2, sqlAppSlugBinding2, sqlApps2, sqlGuestBuilds2, sqlChatContexts2, sqlMintJobs2, sqlOpenTurns2, sqlChatSections2, sqlPromptContexts2, sqlApplicationChats2, sqlUserSettings2, sqlAppSettings2, sqlAppSettingItems2, sqlHandleSettings2, sqlRequestGrants2, sqlDeveloperGrants2, sqlAppDocuments2, sqlSyncFeed2, sqlVibeCuration2, sqlDirectChannelIndex2, sqlDirectChannelReads2, sqlSocialEdges2, sqlSocialBlocks2, sqlAudienceArms2, sqlSocialInvites2, sqlSocialInviteSuppressions2, sqlChannelInvites2, sqlInviteGrants2, sqlRefererEvents2, sqlMissingVibeEvents2, sqlLandingEvents2, sqlApiRequestEvents2, sqlEgressEvents2, sqlEgressSuspectEvents2, sqlSessionsFanoutEvents2, sqlAssetUploads2, sqlAssetSafety2, sqlImgGenClaims2, sqlAppClipExperiences2, sqlAccessFunctionBindings2, sqlNotifications2, sqlNotificationDigests2, sqlVibeLogEvents2, sqlGithubRepoRoutes2, sqlGithubSourceBindings2, sqlSignupAttributions2, sqlMakerCredits2, sqlAccessFnOutputs2, sqlAccessFnChannelIndex2, sqlAccessFnChannelIndexState2, sqlAppFirstMessageEmbeddings2, sqlAppParticipants2, sqlThirdPartyGrants2, sqlThirdPartyConsents2, sqlConnectionApprovals2, sqlAppContentOrdinals2, sqlAppPublicNames2, sqlLookRestyleRounds2, sqlAppMoves2, sqlStripeConnectAccounts2, sqlPlatformDailyCounters2, sqlPhoneLinkCodes2, sqlPhoneLinkInvites2, sqlCliCertPickups2, sqlVibeReports2, sqlAutoModerationFlags2, sqlAccountSuspensions2, sqlPlatformSwitches2, sqlTextLinks2, sqlTextChats2, sqlTextLines2, sqlTextLineDays2, sqlTextOnboarding2, sqlTextTaps2, sqlTextConsents2, sqlVibeBriefs2, sqlCustomDomains2, sqlDomains2;
81686
81831
  var init_vibes_diy_api_schema_pg = __esm({
81687
81832
  "../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/sql/vibes-diy-api-schema-pg.ts"() {
81688
81833
  "use strict";
@@ -83657,6 +83802,54 @@ SELECT DISTINCT a."ownerHandle" AS "userSlug", a."appSlug" AS "appSlug",
83657
83802
  // both land (#12050 review).
83658
83803
  (table4) => [uniqueIndex2("CustomDomains_vibe").on(table4.ownerHandle, table4.appSlug)]
83659
83804
  );
83805
+ sqlDomains2 = pgTable(
83806
+ "Domains",
83807
+ {
83808
+ domainName: text2().primaryKey(),
83809
+ userId: text2().notNull(),
83810
+ // the owner who bought it (Clerk)
83811
+ ownerHandle: text2().notNull(),
83812
+ appSlug: text2().notNull(),
83813
+ orderId: text2().notNull(),
83814
+ planId: text2().notNull(),
83815
+ // the Autumn one-off plan charged
83816
+ priceCents: integer4().notNull(),
83817
+ // what we charged for one term
83818
+ termYears: integer4().notNull(),
83819
+ status: text2().notNull(),
83820
+ chargeRef: text2().notNull().default(""),
83821
+ checkoutUrl: text2().notNull().default(""),
83822
+ // the open Stripe Checkout while awaiting payment
83823
+ registrarOrder: text2().notNull().default(""),
83824
+ expiresAt: text2().notNull().default(""),
83825
+ // ISO 8601, once registered
83826
+ autoRenew: integer4().notNull().default(1),
83827
+ wwwCfHostnameId: text2().notNull().default(""),
83828
+ wwwStatus: text2().notNull().default(""),
83829
+ // Cloudflare's word for the www hostname
83830
+ wwwSslStatus: text2().notNull().default(""),
83831
+ // and its certificate; www is live once both read `active`
83832
+ registrant: text2().notNull().default(""),
83833
+ lastError: text2().notNull().default(""),
83834
+ created: text2().notNull(),
83835
+ // ISO 8601
83836
+ updated: text2().notNull()
83837
+ // ISO 8601
83838
+ },
83839
+ (table4) => [
83840
+ index2("Domains_vibe").on(table4.ownerHandle, table4.appSlug),
83841
+ index2("Domains_user").on(table4.userId),
83842
+ // One paid invoice buys one name: claiming an invoice for an order is a
83843
+ // write this index refuses when another row already holds it (#12178 review).
83844
+ uniqueIndex2("Domains_chargeRef").on(table4.chargeRef).where(sql`"chargeRef" <> ''`),
83845
+ // One open order per owner per plan, so per owner on the one `domain` plan (#12178 review): Autumn's invoice
83846
+ // list doesn't say which order a paid invoice paid for, so while an order
83847
+ // is unpaid (or a declined card's invoice isn't proven void) no second order
83848
+ // on the same plan starts, and an unused paid invoice on the plan can only
83849
+ // be that order's.
83850
+ uniqueIndex2("Domains_openOrder").on(table4.userId, table4.planId).where(sql`"status" IN ('awaiting-payment', 'payment-held')`)
83851
+ ]
83852
+ );
83660
83853
  }
83661
83854
  });
83662
83855
 
@@ -83789,7 +83982,9 @@ function createSqliteVibesApiTables() {
83789
83982
  // The agent brief of one vibe release (svc/intern/vibe-brief.ts). Registered in BOTH flavour maps.
83790
83983
  vibeBriefs: sqlVibeBriefs,
83791
83984
  // Custom domains (#12050): one owner hostname per vibe. Registered in BOTH flavour maps.
83792
- customDomains: sqlCustomDomains
83985
+ customDomains: sqlCustomDomains,
83986
+ // Bought domains (#12120): a name an owner bought in the card. Registered in BOTH flavour maps.
83987
+ domains: sqlDomains
83793
83988
  };
83794
83989
  }
83795
83990
  function toDBFlavour(flavour) {
@@ -83880,7 +84075,8 @@ function createVibesApiTables(flavour) {
83880
84075
  platformSwitches: sqlPlatformSwitches2,
83881
84076
  textConsents: sqlTextConsents2,
83882
84077
  vibeBriefs: sqlVibeBriefs2,
83883
- customDomains: sqlCustomDomains2
84078
+ customDomains: sqlCustomDomains2,
84079
+ domains: sqlDomains2
83884
84080
  };
83885
84081
  }
83886
84082
  return createSqliteVibesApiTables();
@@ -95792,7 +95988,8 @@ function autumnInvoiceRows(json5) {
95792
95988
  id: e2.id,
95793
95989
  stripeId: typeof e2.stripe_id === "string" ? e2.stripe_id : "",
95794
95990
  ...typeof e2.status === "string" ? { status: e2.status } : {},
95795
- planIds: Array.isArray(e2.plan_ids) ? e2.plan_ids.filter((p2) => typeof p2 === "string") : []
95991
+ planIds: Array.isArray(e2.plan_ids) ? e2.plan_ids.filter((p2) => typeof p2 === "string") : [],
95992
+ ...typeof e2.total === "number" && Number.isFinite(e2.total) ? { totalCents: Math.round(e2.total * 100) } : {}
95796
95993
  });
95797
95994
  }
95798
95995
  return rows;
@@ -110372,7 +110569,7 @@ function formatJSXStringValueLiteral(text3) {
110372
110569
  return JSON.stringify(result);
110373
110570
  }
110374
110571
  function processEntity(text3, indexAfterAmpersand) {
110375
- let str4 = "";
110572
+ let str5 = "";
110376
110573
  let count4 = 0;
110377
110574
  let entity;
110378
110575
  let i3 = indexAfterAmpersand;
@@ -110405,10 +110602,10 @@ function processEntity(text3, indexAfterAmpersand) {
110405
110602
  const ch = text3[i3];
110406
110603
  i3++;
110407
110604
  if (ch === ";") {
110408
- entity = xhtml_default.get(str4);
110605
+ entity = xhtml_default.get(str5);
110409
110606
  break;
110410
110607
  }
110411
- str4 += ch;
110608
+ str5 += ch;
110412
110609
  }
110413
110610
  }
110414
110611
  if (!entity) {
@@ -123099,17 +123296,17 @@ function hexToInt(ch) {
123099
123296
  function isOctalDigit(ch) {
123100
123297
  return ch >= 48 && ch <= 55;
123101
123298
  }
123102
- function stringToNumber(str4, isLegacyOctalNumericLiteral) {
123299
+ function stringToNumber(str5, isLegacyOctalNumericLiteral) {
123103
123300
  if (isLegacyOctalNumericLiteral) {
123104
- return parseInt(str4, 8);
123301
+ return parseInt(str5, 8);
123105
123302
  }
123106
- return parseFloat(str4.replace(/_/g, ""));
123303
+ return parseFloat(str5.replace(/_/g, ""));
123107
123304
  }
123108
- function stringToBigInt(str4) {
123305
+ function stringToBigInt(str5) {
123109
123306
  if (typeof BigInt !== "function") {
123110
123307
  return null;
123111
123308
  }
123112
- return BigInt(str4.replace(/_/g, ""));
123309
+ return BigInt(str5.replace(/_/g, ""));
123113
123310
  }
123114
123311
  var astralIdentifierCodes, astralIdentifierStartCodes, nonASCIIidentifierChars, nonASCIIidentifierStartChars, reservedWords, ecma5AndLessKeywords, keywords$1, keywordRelationalOperator, nonASCIIidentifierStart, nonASCIIidentifier, TokenType2, beforeExpr, startsExpr, keywords2, types$1, lineBreak, lineBreakG, nonASCIIwhitespace, skipWhiteSpace2, ref2, hasOwnProperty, toString, hasOwn, isArray2, regexpCache, loneSurrogate, Position, SourceLocation, defaultOptions, warnedAboutEcmaVersion, SCOPE_TOP, SCOPE_FUNCTION, SCOPE_ASYNC, SCOPE_GENERATOR, SCOPE_ARROW, SCOPE_SIMPLE_CATCH, SCOPE_SUPER, SCOPE_DIRECT_SUPER, SCOPE_CLASS_STATIC_BLOCK, SCOPE_CLASS_FIELD_INIT, SCOPE_SWITCH, SCOPE_VAR, BIND_NONE, BIND_VAR, BIND_LEXICAL, BIND_FUNCTION, BIND_SIMPLE_CATCH, BIND_OUTSIDE, Parser2, prototypeAccessors, pp$9, literal2, DestructuringErrors, pp$8, loopLabel, switchLabel, empty$1, FUNC_STATEMENT, FUNC_HANGING_STATEMENT, FUNC_NULLABLE_ID, pp$7, TokContext, types3, pp$6, pp$5, empty2, pp$4, pp$3, Scope3, Node, pp$2, scriptValuesAddedInUnicode, ecma9BinaryProperties, ecma10BinaryProperties, ecma11BinaryProperties, ecma12BinaryProperties, ecma13BinaryProperties, ecma14BinaryProperties, unicodeBinaryProperties, ecma14BinaryPropertiesOfStrings, unicodeBinaryPropertiesOfStrings, unicodeGeneralCategoryValues, ecma9ScriptValues, ecma10ScriptValues, ecma11ScriptValues, ecma12ScriptValues, ecma13ScriptValues, ecma14ScriptValues, unicodeScriptValues, data, ecmaVersion, i, list, pp$1, BranchID, RegExpValidationState, CharSetNone, CharSetOk, CharSetString, Token2, pp, INVALID_TEMPLATE_ESCAPE_ERROR, version4;
123115
123312
  var init_acorn = __esm({
@@ -128137,9 +128334,9 @@ var init_acorn = __esm({
128137
128334
  this.raise(this.pos, "Unexpected character '" + codePointToString(code2) + "'");
128138
128335
  };
128139
128336
  pp.finishOp = function(type2, size) {
128140
- var str4 = this.input.slice(this.pos, this.pos + size);
128337
+ var str5 = this.input.slice(this.pos, this.pos + size);
128141
128338
  this.pos += size;
128142
- return this.finishToken(type2, str4);
128339
+ return this.finishToken(type2, str5);
128143
128340
  };
128144
128341
  pp.readRegexp = function() {
128145
128342
  var escaped, inClass, start = this.pos;
@@ -128689,6 +128886,7 @@ var init_ensure_push_seeded_chat = __esm({
128689
128886
  init_types4();
128690
128887
  init_seed_chat_section();
128691
128888
  init_client_attribution();
128889
+ init_guest_principal_owner();
128692
128890
  }
128693
128891
  });
128694
128892
 
@@ -129706,10 +129904,10 @@ function bytesToHex(bytes) {
129706
129904
  }
129707
129905
  return hex4;
129708
129906
  }
129709
- function utf8ToBytes(str4) {
129710
- if (typeof str4 !== "string")
129907
+ function utf8ToBytes(str5) {
129908
+ if (typeof str5 !== "string")
129711
129909
  throw new TypeError("string expected");
129712
- const encoded = new TextEncoder().encode(str4);
129910
+ const encoded = new TextEncoder().encode(str5);
129713
129911
  try {
129714
129912
  return new Uint8Array(encoded);
129715
129913
  } finally {
@@ -148687,6 +148885,19 @@ var init_test_traffic = __esm({
148687
148885
  }
148688
148886
  });
148689
148887
 
148888
+ // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/usage-report/guest-origin-sql.ts
148889
+ var PROMPT_GUEST_ROW_SQL;
148890
+ var init_guest_origin_sql = __esm({
148891
+ "../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/usage-report/guest-origin-sql.ts"() {
148892
+ "use strict";
148893
+ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
148894
+ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
148895
+ init_performance2();
148896
+ init_types4();
148897
+ PROMPT_GUEST_ROW_SQL = `starts_with("PromptContexts"."userId", '${GUEST_PRINCIPAL_PREFIX}')`;
148898
+ }
148899
+ });
148900
+
148690
148901
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/usage-report/new-user-alert-util.ts
148691
148902
  import { createHash } from "node:crypto";
148692
148903
  function normalizeStaffEmail(email4) {
@@ -148737,6 +148948,8 @@ var init_new_user_alert_util = __esm({
148737
148948
  init_performance2();
148738
148949
  init_types4();
148739
148950
  init_test_traffic();
148951
+ init_prompt_turn_sql();
148952
+ init_guest_origin_sql();
148740
148953
  init_test_traffic();
148741
148954
  KNOWN_STAFF_EMAIL_DOMAINS = ["vibes.diy", "fireproof.storage"];
148742
148955
  KNOWN_STAFF_USER_IDS = [
@@ -159821,8 +160034,8 @@ var require_number = __commonJS({
159821
160034
  return flipped;
159822
160035
  }
159823
160036
  __name(flip, "flip");
159824
- function padStart(str4, count4) {
159825
- return " ".repeat(count4 - str4.length).substr(0, count4) + str4;
160037
+ function padStart(str5, count4) {
160038
+ return " ".repeat(count4 - str5.length).substr(0, count4) + str5;
159826
160039
  }
159827
160040
  __name(padStart, "padStart");
159828
160041
  }
@@ -159835,21 +160048,21 @@ var require_object = __commonJS({
159835
160048
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
159836
160049
  init_performance2();
159837
160050
  var dictEscape = { "?": "?@", "!": "??", '"': "?%" };
159838
- function escape(str4) {
159839
- if (!/[!"]/.test(str4)) {
159840
- return str4;
160051
+ function escape(str5) {
160052
+ if (!/[!"]/.test(str5)) {
160053
+ return str5;
159841
160054
  }
159842
- return str4.replace(/[\?!"]/g, function(match4) {
160055
+ return str5.replace(/[\?!"]/g, function(match4) {
159843
160056
  return dictEscape[match4];
159844
160057
  });
159845
160058
  }
159846
160059
  __name(escape, "escape");
159847
160060
  var dictUnescape = { "?@": "?", "??": "!", "?%": '"' };
159848
- function unescape(str4) {
159849
- if (!/\?[%\?@]/.test(str4)) {
159850
- return str4;
160061
+ function unescape(str5) {
160062
+ if (!/\?[%\?@]/.test(str5)) {
160063
+ return str5;
159851
160064
  }
159852
- return str4.replace(/\?[%\?@]/g, function(match4) {
160065
+ return str5.replace(/\?[%\?@]/g, function(match4) {
159853
160066
  return dictUnescape[match4];
159854
160067
  });
159855
160068
  }
@@ -165729,8 +165942,8 @@ Lifetime used`) : new QuickJSUseAfterFree("Lifetime not alive");
165729
165942
  return this.module.HEAPU8.set(buffer, ptr), new Lifetime({ pointer: ptr, numBytes }, void 0, (value2) => this.module._free(value2.pointer));
165730
165943
  }
165731
165944
  consumeHeapCharPointer(ptr) {
165732
- let str4 = this.module.UTF8ToString(ptr);
165733
- return this.module._free(ptr), str4;
165945
+ let str5 = this.module.UTF8ToString(ptr);
165946
+ return this.module._free(ptr), str5;
165734
165947
  }
165735
165948
  };
165736
165949
  DefaultIntrinsics = Object.freeze({ BaseObjects: true, Date: true, Eval: true, StringNormalize: true, RegExp: true, JSON: true, Proxy: true, MapSet: true, TypedArrays: true, Promise: true });
@@ -165866,8 +166079,8 @@ Lifetime used`) : new QuickJSUseAfterFree("Lifetime not alive");
165866
166079
  return this.scope.manage(lifetime);
165867
166080
  }
165868
166081
  consumeJSCharPointer(ptr) {
165869
- let str4 = this.module.UTF8ToString(ptr);
165870
- return this.ffi.QTS_FreeCString(this.ctx.value, ptr), str4;
166082
+ let str5 = this.module.UTF8ToString(ptr);
166083
+ return this.ffi.QTS_FreeCString(this.ctx.value, ptr), str5;
165871
166084
  }
165872
166085
  heapValueHandle(ptr, extraDispose) {
165873
166086
  let dispose = extraDispose ? (val) => {
@@ -165952,8 +166165,8 @@ Lifetime used`) : new QuickJSUseAfterFree("Lifetime not alive");
165952
166165
  newNumber(num) {
165953
166166
  return this.memory.heapValueHandle(this.ffi.QTS_NewFloat64(this.ctx.value, num));
165954
166167
  }
165955
- newString(str4) {
165956
- let ptr = this.memory.newHeapCharPointer(str4).consume((charHandle) => this.ffi.QTS_NewString(this.ctx.value, charHandle.value.ptr));
166168
+ newString(str5) {
166169
+ let ptr = this.memory.newHeapCharPointer(str5).consume((charHandle) => this.ffi.QTS_NewString(this.ctx.value, charHandle.value.ptr));
165957
166170
  return this.memory.heapValueHandle(ptr);
165958
166171
  }
165959
166172
  newUniqueSymbol(description) {
@@ -166176,11 +166389,11 @@ Lifetime used`) : new QuickJSUseAfterFree("Lifetime not alive");
166176
166389
  if (asPromiseState.type === "fulfilled" && !asPromiseState.notAPromise) return handle.dispose(), { type: asPromiseState.type, value: asPromiseState.value.consume(this.dump) };
166177
166390
  if (asPromiseState.type === "pending") return handle.dispose(), { type: asPromiseState.type };
166178
166391
  if (asPromiseState.type === "rejected") return handle.dispose(), { type: asPromiseState.type, error: asPromiseState.error.consume(this.dump) };
166179
- let str4 = this.memory.consumeJSCharPointer(this.ffi.QTS_Dump(this.ctx.value, handle.value));
166392
+ let str5 = this.memory.consumeJSCharPointer(this.ffi.QTS_Dump(this.ctx.value, handle.value));
166180
166393
  try {
166181
- return JSON.parse(str4);
166394
+ return JSON.parse(str5);
166182
166395
  } catch {
166183
- return str4;
166396
+ return str5;
166184
166397
  }
166185
166398
  }
166186
166399
  unwrapResult(result) {
@@ -168591,6 +168804,24 @@ var init_agent_turn_allowance = __esm({
168591
168804
  }
168592
168805
  });
168593
168806
 
168807
+ // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/resolve-servable-asset.ts
168808
+ var PLACEHOLDER_SVG_URI, HOLD_FRESH_MS;
168809
+ var init_resolve_servable_asset = __esm({
168810
+ "../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/resolve-servable-asset.ts"() {
168811
+ "use strict";
168812
+ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
168813
+ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
168814
+ init_performance2();
168815
+ init_esm();
168816
+ init_analytics();
168817
+ init_stamped_geo_country();
168818
+ PLACEHOLDER_SVG_URI = "data:image/svg+xml;utf8," + encodeURIComponent(
168819
+ '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><rect width="20" height="20" fill="#d9d9d9"/></svg>'
168820
+ );
168821
+ HOLD_FRESH_MS = 10 * 6e4;
168822
+ }
168823
+ });
168824
+
168594
168825
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/agent-send-picture-tool.ts
168595
168826
  function pictureInDoc(doc, fileKey) {
168596
168827
  const files = doc._files;
@@ -168720,14 +168951,21 @@ var init_agent_send_picture_tool = __esm({
168720
168951
  init_agent_turn_allowance();
168721
168952
  init_app_documents_read_eventos();
168722
168953
  init_files_url_mint();
168954
+ init_access_helpers();
168955
+ init_latest_screenshot();
168956
+ init_resolve_servable_asset();
168957
+ init_moderation_gate();
168958
+ init_developer_grants();
168959
+ init_select_app();
168723
168960
  sendPictureInput = lazyType(
168724
168961
  () => type({
168725
168962
  ownerHandle: "string > 0",
168726
168963
  appSlug: "string > 0",
168727
- dbName: "string > 0",
168728
- docId: "string > 0",
168964
+ "dbName?": "string",
168965
+ "docId?": "string",
168729
168966
  "fileKey?": "string",
168730
- "sticker?": "boolean"
168967
+ "sticker?": "boolean",
168968
+ "screenshot?": "boolean"
168731
168969
  }).onUndeclaredKey("reject")
168732
168970
  );
168733
168971
  __name(pictureInDoc, "pictureInDoc");
@@ -175848,12 +176086,12 @@ __name(invalid2, "invalid");
175848
176086
  function parseCalendarEvent(input3) {
175849
176087
  if (typeof input3 !== "object" || input3 === null) return invalid2("An event is an object.");
175850
176088
  const o3 = input3;
175851
- const str4 = /* @__PURE__ */ __name((k2) => typeof o3[k2] === "string" ? clean(o3[k2]) : void 0, "str");
175852
- const title2 = str4("title");
176089
+ const str5 = /* @__PURE__ */ __name((k2) => typeof o3[k2] === "string" ? clean(o3[k2]) : void 0, "str");
176090
+ const title2 = str5("title");
175853
176091
  if (title2 === void 0 || title2 === "") return invalid2("title is required: the event's name, as the flyer says it.");
175854
176092
  if (title2.length > CALENDAR_TITLE_MAX) return invalid2(`title is at most ${CALENDAR_TITLE_MAX} characters.`);
175855
176093
  const allDay = o3.allDay === true;
175856
- const startRaw = str4("start") ?? "";
176094
+ const startRaw = str5("start") ?? "";
175857
176095
  const form = allDay ? "YYYY-MM-DD" : "YYYY-MM-DDTHH:mm (24-hour)";
175858
176096
  const re3 = allDay ? DATE_RE : DATE_TIME_RE;
175859
176097
  if (!re3.test(startRaw) || wallOf(startRaw) === void 0) {
@@ -175861,7 +176099,7 @@ function parseCalendarEvent(input3) {
175861
176099
  `start is a ${allDay ? "date" : "wall time"} written ${form}, such as ${allDay ? "2026-11-21" : "2026-11-21T19:00"}.`
175862
176100
  );
175863
176101
  }
175864
- const endRaw = str4("end");
176102
+ const endRaw = str5("end");
175865
176103
  const end = endRaw === void 0 || endRaw === "" ? void 0 : endRaw;
175866
176104
  if (end !== void 0) {
175867
176105
  if (!re3.test(end) || wallOf(end) === void 0) return invalid2(`end is written ${form}, like start.`);
@@ -175869,7 +176107,7 @@ function parseCalendarEvent(input3) {
175869
176107
  const e2 = wallOf(end);
175870
176108
  if (allDay ? wallUtc(e2) < wallUtc(s2) : wallUtc(e2) <= wallUtc(s2)) return invalid2("end comes after start.");
175871
176109
  }
175872
- const tzRaw = str4("timeZone") ?? "";
176110
+ const tzRaw = str5("timeZone") ?? "";
175873
176111
  const timeZone = zoneOf(tzRaw);
175874
176112
  if (timeZone === void 0) return invalid2("timeZone is an IANA zone name, such as America/New_York.");
175875
176113
  if (!allDay) {
@@ -175884,11 +176122,11 @@ function parseCalendarEvent(input3) {
175884
176122
  }
175885
176123
  }
175886
176124
  }
175887
- const location = str4("location");
176125
+ const location = str5("location");
175888
176126
  if (location !== void 0 && location.length > CALENDAR_LOCATION_MAX) {
175889
176127
  return invalid2(`location is at most ${CALENDAR_LOCATION_MAX} characters.`);
175890
176128
  }
175891
- const details = str4("details");
176129
+ const details = str5("details");
175892
176130
  if (details !== void 0 && details.length > CALENDAR_DETAILS_MAX) {
175893
176131
  return invalid2(`details is at most ${CALENDAR_DETAILS_MAX} characters.`);
175894
176132
  }
@@ -178891,6 +179129,7 @@ var orderResponse = lazyType(
178891
179129
  );
178892
179130
  var authCodeResponse = lazyType(() => type({ authCode: "string" }));
178893
179131
  var domainResponse = lazyType(() => type({ "domainName?": "string", "locked?": "boolean" }));
179132
+ var domainInfoResponse = lazyType(() => type({ "domainName?": "string", "expireDate?": "string" }));
178894
179133
  var recordsResponse = lazyType(
178895
179134
  () => type({
178896
179135
  "records?": type({
@@ -178902,6 +179141,197 @@ var recordsResponse = lazyType(
178902
179141
  })
178903
179142
  );
178904
179143
 
179144
+ // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/domain-payments.ts
179145
+ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
179146
+ init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
179147
+ init_performance2();
179148
+ init_esm();
179149
+ init_billing();
179150
+ var DOMAIN_PLAN_ID = "domain";
179151
+ var DOMAIN_CHECKOUT_TTL_MS = 35 * 60 * 1e3;
179152
+ function str4(v3) {
179153
+ return typeof v3 === "string" && v3 !== "" ? v3 : void 0;
179154
+ }
179155
+ __name(str4, "str");
179156
+ function invoiceOrderIds(json5) {
179157
+ const out = /* @__PURE__ */ new Map();
179158
+ const list2 = Array.isArray(json5.list) ? json5.list : [];
179159
+ for (const raw of list2) {
179160
+ if (typeof raw !== "object" || raw === null) continue;
179161
+ const e2 = raw;
179162
+ const meta3 = typeof e2.metadata === "object" && e2.metadata !== null ? e2.metadata : {};
179163
+ const id = str4(e2.id);
179164
+ const order = str4(meta3.domain_order_id);
179165
+ if (id !== void 0 && order !== void 0) out.set(id, order);
179166
+ }
179167
+ return out;
179168
+ }
179169
+ __name(invoiceOrderIds, "invoiceOrderIds");
179170
+ function invoicePlanCents(json5) {
179171
+ const out = /* @__PURE__ */ new Map();
179172
+ const list2 = Array.isArray(json5.list) ? json5.list : [];
179173
+ for (const raw of list2) {
179174
+ if (typeof raw !== "object" || raw === null) continue;
179175
+ const e2 = raw;
179176
+ const id = str4(e2.id);
179177
+ if (id === void 0 || Array.isArray(e2.items) === false) continue;
179178
+ let cents;
179179
+ for (const item of e2.items) {
179180
+ if (typeof item !== "object" || item === null) continue;
179181
+ const it3 = item;
179182
+ if (it3.plan_id !== DOMAIN_PLAN_ID || typeof it3.amount !== "number" || Number.isFinite(it3.amount) === false) continue;
179183
+ cents = (cents ?? 0) + Math.round(it3.amount * 100);
179184
+ }
179185
+ if (cents !== void 0) out.set(id, cents);
179186
+ }
179187
+ return out;
179188
+ }
179189
+ __name(invoicePlanCents, "invoicePlanCents");
179190
+ function autumnDomainPayments(opts) {
179191
+ const secretKey = opts.secretKey;
179192
+ if (secretKey === void 0 || secretKey === "" || opts.track !== "on") return void 0;
179193
+ const baseUrl = opts.baseUrl ?? AUTUMN_API_BASE;
179194
+ const doFetch = opts.fetch ?? ((input3, init) => fetch(input3, init));
179195
+ const post = /* @__PURE__ */ __name((path, body, apiVersion = "2.3.0") => exception2Result(async () => {
179196
+ const res = await doFetch(`${baseUrl}${path}`, {
179197
+ method: "POST",
179198
+ headers: { "content-type": "application/json", authorization: `Bearer ${secretKey}`, "x-api-version": apiVersion },
179199
+ body: JSON.stringify(body)
179200
+ });
179201
+ const json5 = await res.json().catch(() => ({}));
179202
+ return { status: res.status, json: json5 };
179203
+ }), "post");
179204
+ async function invoiceByStripeId(userId, stripeId) {
179205
+ const r2 = await post("/invoices.list", { customer_id: userId, stripe_id: stripeId }, AUTUMN_INVOICES_API_VERSION);
179206
+ if (r2.isErr() || r2.Ok().status >= 400) return void 0;
179207
+ return autumnInvoiceRows(r2.Ok().json).find((row) => row.stripeId === stripeId);
179208
+ }
179209
+ __name(invoiceByStripeId, "invoiceByStripeId");
179210
+ async function invoiceById(userId, invoiceId) {
179211
+ const r2 = await post("/invoices.list", { customer_id: userId, limit: 100 }, AUTUMN_INVOICES_API_VERSION);
179212
+ if (r2.isErr() || r2.Ok().status >= 400) return void 0;
179213
+ return autumnInvoiceRows(r2.Ok().json).find((row) => row.id === invoiceId);
179214
+ }
179215
+ __name(invoiceById, "invoiceById");
179216
+ async function voidAndConfirm(userId, row) {
179217
+ if (row.status === "void") return "voided";
179218
+ if (row.status === "paid") return "paid";
179219
+ const rVoid = await post("/invoices.void", { invoice_id: row.id }, AUTUMN_INVOICES_API_VERSION);
179220
+ if (rVoid.isOk() && rVoid.Ok().status < 400 && autumnInvoiceRows(rVoid.Ok().json)[0]?.status === "void") return "voided";
179221
+ const back = await invoiceById(userId, row.id);
179222
+ if (back?.status === "void") return "voided";
179223
+ if (back?.status === "paid") return "paid";
179224
+ return "held";
179225
+ }
179226
+ __name(voidAndConfirm, "voidAndConfirm");
179227
+ return {
179228
+ async charge(args2) {
179229
+ if (isAllowedSuccessUrl(args2.successUrl) === false || isAllowedSuccessUrl(args2.cancelUrl) === false) {
179230
+ return Result.Err(`return url not allowed: ${args2.successUrl}`);
179231
+ }
179232
+ if (Number.isInteger(args2.priceCents) === false || args2.priceCents <= 0) {
179233
+ return Result.Err(`domain price must be a positive whole number of cents: ${args2.priceCents}`);
179234
+ }
179235
+ const term = args2.termYears === 1 ? "1 year" : `${args2.termYears} years`;
179236
+ const rCustomer = await post("/customers.get_or_create", {
179237
+ customer_id: args2.userId,
179238
+ ...args2.customerData?.name !== void 0 ? { name: args2.customerData.name } : {},
179239
+ ...args2.customerData?.email !== void 0 ? { email: args2.customerData.email } : {}
179240
+ });
179241
+ if (rCustomer.isErr()) return Result.Err(rCustomer);
179242
+ const nowMs = args2.nowMs ?? Date.now();
179243
+ const r2 = await post("/billing.attach", {
179244
+ customer_id: args2.userId,
179245
+ plan_id: DOMAIN_PLAN_ID,
179246
+ // The order's price, as one one-off base price (verified on the sandbox
179247
+ // 2026-12-04: Checkout shows "Domain registration" at this amount).
179248
+ customize: { price: { amount: args2.priceCents / 100, interval: "one_off" } },
179249
+ success_url: args2.successUrl,
179250
+ metadata: { domain_order_id: args2.orderId, domain_name: args2.domainName },
179251
+ checkout_session_params: {
179252
+ cancel_url: args2.cancelUrl,
179253
+ expires_at: Math.floor((nowMs + DOMAIN_CHECKOUT_TTL_MS) / 1e3),
179254
+ custom_text: {
179255
+ submit: {
179256
+ message: `${args2.domainName}, ${term}, is registered in your name. Domains can't be refunded once registered.`
179257
+ }
179258
+ }
179259
+ }
179260
+ });
179261
+ if (r2.isErr()) return Result.Err(r2);
179262
+ const { status, json: json5 } = r2.Ok();
179263
+ const code2 = autumnErrorCode(json5);
179264
+ if (status >= 400 && (code2 === "plan_not_found" || code2 === "product_not_found")) return Result.Ok({ status: "no-plan" });
179265
+ const action = json5.required_action;
179266
+ const actionCode = typeof action === "object" && action !== null ? str4(action.code) : void 0;
179267
+ const invoice = typeof json5.invoice === "object" && json5.invoice !== null ? json5.invoice : void 0;
179268
+ const invoiceStatus2 = str4(invoice?.status);
179269
+ if (actionCode === "payment_failed") {
179270
+ const stripeId = str4(invoice?.stripe_id);
179271
+ const row = stripeId === void 0 ? void 0 : await invoiceByStripeId(args2.userId, stripeId);
179272
+ if (row === void 0 || row.planIds.includes(DOMAIN_PLAN_ID) === false) {
179273
+ return Result.Ok({ status: "held", ...row === void 0 ? {} : { invoiceId: row.id } });
179274
+ }
179275
+ const settled = await voidAndConfirm(args2.userId, row);
179276
+ if (settled === "voided") return Result.Ok({ status: "declined" });
179277
+ if (settled === "paid")
179278
+ return Result.Ok({ status: "paid", invoiceId: row.id, ...stripeId === void 0 ? {} : { stripeInvoiceId: stripeId } });
179279
+ return Result.Ok({ status: "held", invoiceId: row.id });
179280
+ }
179281
+ const url3 = str4(json5.checkout_url) ?? str4(json5.payment_url);
179282
+ if (status < 400 && url3 !== void 0) return Result.Ok({ status: "checkout", checkoutUrl: url3 });
179283
+ if (status < 400 && invoiceStatus2 === "paid") {
179284
+ const stripeId = str4(invoice?.stripe_id);
179285
+ const invoiceId = str4(invoice?.id) ?? (stripeId === void 0 ? void 0 : (await invoiceByStripeId(args2.userId, stripeId))?.id);
179286
+ return Result.Ok({
179287
+ status: "paid",
179288
+ ...invoiceId !== void 0 ? { invoiceId } : {},
179289
+ ...stripeId !== void 0 ? { stripeInvoiceId: stripeId } : {}
179290
+ });
179291
+ }
179292
+ if (actionCode !== void 0) return Result.Ok({ status: "processing", requiredAction: actionCode });
179293
+ if (invoiceStatus2 !== void 0 && invoiceStatus2 !== "void" && invoiceStatus2 !== "uncollectible") {
179294
+ return Result.Ok({ status: "processing", requiredAction: `invoice_${invoiceStatus2}` });
179295
+ }
179296
+ return Result.Err(`autumn attach for a domain failed: ${status} ${code2 ?? ""}`);
179297
+ },
179298
+ async findPaidCharge({ orderId, userId, amountCents, used }) {
179299
+ const r2 = await post("/invoices.list", { customer_id: userId, limit: 100 }, AUTUMN_INVOICES_API_VERSION);
179300
+ if (r2.isErr()) return Result.Err(r2);
179301
+ if (r2.Ok().status >= 400) return Result.Err(`autumn invoices.list failed: ${r2.Ok().status}`);
179302
+ const orders = invoiceOrderIds(r2.Ok().json);
179303
+ const planCents = invoicePlanCents(r2.Ok().json);
179304
+ const row = autumnInvoiceRows(r2.Ok().json).find((i3) => {
179305
+ const named2 = orders.get(i3.id);
179306
+ return i3.status === "paid" && i3.planIds.includes(DOMAIN_PLAN_ID) && (planCents.get(i3.id) ?? i3.totalCents) === amountCents && used.includes(i3.id) === false && (named2 === void 0 || named2 === orderId);
179307
+ });
179308
+ return Result.Ok(row === void 0 ? void 0 : { invoiceId: row.id });
179309
+ },
179310
+ async settleHeld({ userId, invoiceId }) {
179311
+ const row = await invoiceById(userId, invoiceId);
179312
+ return row === void 0 ? "held" : voidAndConfirm(userId, row);
179313
+ },
179314
+ async refund({ invoiceId, amountCents, memo: memo2 }) {
179315
+ if (Number.isInteger(amountCents) === false || amountCents <= 0) {
179316
+ return Result.Err(`refund amount must be a positive whole number of cents: ${amountCents}`);
179317
+ }
179318
+ const r2 = await post(
179319
+ "/invoices.issue_credit_note",
179320
+ { invoice_id: invoiceId, destination: "refund", amount: amountCents / 100, memo: memo2.slice(0, 500) },
179321
+ AUTUMN_INVOICES_API_VERSION
179322
+ );
179323
+ if (r2.isErr()) return Result.Err(r2);
179324
+ const { status, json: json5 } = r2.Ok();
179325
+ const note = typeof json5.credit_note === "object" && json5.credit_note !== null ? json5.credit_note : {};
179326
+ if (status >= 400 || note.status === "void") {
179327
+ return Result.Err(`autumn credit note failed: ${status} ${autumnErrorCode(json5) ?? ""}`);
179328
+ }
179329
+ return Result.Ok(void 0);
179330
+ }
179331
+ };
179332
+ }
179333
+ __name(autumnDomainPayments, "autumnDomainPayments");
179334
+
178905
179335
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/create-handler.ts
178906
179336
  async function createAppContext(params) {
178907
179337
  const { sthis } = params;
@@ -179375,6 +179805,7 @@ async function createAppContext(params) {
179375
179805
  hubspotFetch: params.hubspotFetch ?? ((input3, init) => fetch(input3, init)),
179376
179806
  customHostnames: customHostnamesFromEnv(envVals.CF_CUSTOM_HOSTNAMES_TOKEN, envVals.CF_CUSTOM_HOSTNAMES_ZONE_ID).customHostnames,
179377
179807
  namecom: namecomFromEnv(envVals.NAMECOM_USERNAME, envVals.NAMECOM_API_TOKEN).namecom,
179808
+ domainPayments: autumnDomainPayments({ secretKey: envVals.AUTUMN_SECRET_KEY, track: envVals.AUTUMN_TRACK }),
179378
179809
  posthogProjectId: envVals.POSTHOG_PROJECT_ID,
179379
179810
  posthogQueryHost: envVals.POSTHOG_QUERY_HOST,
179380
179811
  deviceCA: rDeviceIdCA.Ok(),