@ancha-labs/cli 0.4.27 → 0.4.29

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.
@@ -1006,14 +1006,14 @@ var require_foldFlowLines = __commonJS({
1006
1006
  var FOLD_FLOW = "flow";
1007
1007
  var FOLD_BLOCK = "block";
1008
1008
  var FOLD_QUOTED = "quoted";
1009
- function foldFlowLines(text24, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
1009
+ function foldFlowLines(text25, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
1010
1010
  if (!lineWidth || lineWidth < 0)
1011
- return text24;
1011
+ return text25;
1012
1012
  if (lineWidth < minContentWidth)
1013
1013
  minContentWidth = 0;
1014
1014
  const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
1015
- if (text24.length <= endStep)
1016
- return text24;
1015
+ if (text25.length <= endStep)
1016
+ return text25;
1017
1017
  const folds = [];
1018
1018
  const escapedFolds = {};
1019
1019
  let end = lineWidth - indent.length;
@@ -1030,14 +1030,14 @@ var require_foldFlowLines = __commonJS({
1030
1030
  let escStart = -1;
1031
1031
  let escEnd = -1;
1032
1032
  if (mode === FOLD_BLOCK) {
1033
- i = consumeMoreIndentedLines(text24, i, indent.length);
1033
+ i = consumeMoreIndentedLines(text25, i, indent.length);
1034
1034
  if (i !== -1)
1035
1035
  end = i + endStep;
1036
1036
  }
1037
- for (let ch; ch = text24[i += 1]; ) {
1037
+ for (let ch; ch = text25[i += 1]; ) {
1038
1038
  if (mode === FOLD_QUOTED && ch === "\\") {
1039
1039
  escStart = i;
1040
- switch (text24[i + 1]) {
1040
+ switch (text25[i + 1]) {
1041
1041
  case "x":
1042
1042
  i += 3;
1043
1043
  break;
@@ -1054,12 +1054,12 @@ var require_foldFlowLines = __commonJS({
1054
1054
  }
1055
1055
  if (ch === "\n") {
1056
1056
  if (mode === FOLD_BLOCK)
1057
- i = consumeMoreIndentedLines(text24, i, indent.length);
1057
+ i = consumeMoreIndentedLines(text25, i, indent.length);
1058
1058
  end = i + indent.length + endStep;
1059
1059
  split = void 0;
1060
1060
  } else {
1061
1061
  if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
1062
- const next2 = text24[i + 1];
1062
+ const next2 = text25[i + 1];
1063
1063
  if (next2 && next2 !== " " && next2 !== "\n" && next2 !== " ")
1064
1064
  split = i;
1065
1065
  }
@@ -1071,12 +1071,12 @@ var require_foldFlowLines = __commonJS({
1071
1071
  } else if (mode === FOLD_QUOTED) {
1072
1072
  while (prev === " " || prev === " ") {
1073
1073
  prev = ch;
1074
- ch = text24[i += 1];
1074
+ ch = text25[i += 1];
1075
1075
  overflow = true;
1076
1076
  }
1077
1077
  const j = i > escEnd + 1 ? i - 2 : escStart - 1;
1078
1078
  if (escapedFolds[j])
1079
- return text24;
1079
+ return text25;
1080
1080
  folds.push(j);
1081
1081
  escapedFolds[j] = true;
1082
1082
  end = j + endStep;
@@ -1091,39 +1091,39 @@ var require_foldFlowLines = __commonJS({
1091
1091
  if (overflow && onOverflow)
1092
1092
  onOverflow();
1093
1093
  if (folds.length === 0)
1094
- return text24;
1094
+ return text25;
1095
1095
  if (onFold)
1096
1096
  onFold();
1097
- let res = text24.slice(0, folds[0]);
1097
+ let res = text25.slice(0, folds[0]);
1098
1098
  for (let i2 = 0; i2 < folds.length; ++i2) {
1099
1099
  const fold2 = folds[i2];
1100
- const end2 = folds[i2 + 1] || text24.length;
1100
+ const end2 = folds[i2 + 1] || text25.length;
1101
1101
  if (fold2 === 0)
1102
1102
  res = `
1103
- ${indent}${text24.slice(0, end2)}`;
1103
+ ${indent}${text25.slice(0, end2)}`;
1104
1104
  else {
1105
1105
  if (mode === FOLD_QUOTED && escapedFolds[fold2])
1106
- res += `${text24[fold2]}\\`;
1106
+ res += `${text25[fold2]}\\`;
1107
1107
  res += `
1108
- ${indent}${text24.slice(fold2 + 1, end2)}`;
1108
+ ${indent}${text25.slice(fold2 + 1, end2)}`;
1109
1109
  }
1110
1110
  }
1111
1111
  return res;
1112
1112
  }
1113
- function consumeMoreIndentedLines(text24, i, indent) {
1113
+ function consumeMoreIndentedLines(text25, i, indent) {
1114
1114
  let end = i;
1115
1115
  let start2 = i + 1;
1116
- let ch = text24[start2];
1116
+ let ch = text25[start2];
1117
1117
  while (ch === " " || ch === " ") {
1118
1118
  if (i < start2 + indent) {
1119
- ch = text24[++i];
1119
+ ch = text25[++i];
1120
1120
  } else {
1121
1121
  do {
1122
- ch = text24[++i];
1122
+ ch = text25[++i];
1123
1123
  } while (ch && ch !== "\n");
1124
1124
  end = i;
1125
1125
  start2 = i + 1;
1126
- ch = text24[start2];
1126
+ ch = text25[start2];
1127
1127
  }
1128
1128
  }
1129
1129
  return end;
@@ -37377,9 +37377,9 @@ var require_logging = __commonJS({
37377
37377
  }
37378
37378
  var allEnabled = enabledTracers.has("all");
37379
37379
  var anyTracerEnabled = allEnabled || enabledTracers.size > 0;
37380
- function trace(severity, tracer, text24) {
37380
+ function trace(severity, tracer, text25) {
37381
37381
  if (isTracerEnabled(tracer)) {
37382
- (0, exports.log)(severity, (/* @__PURE__ */ new Date()).toISOString() + " | v" + clientVersion + " " + process_1.pid + " | " + tracer + " | " + text24);
37382
+ (0, exports.log)(severity, (/* @__PURE__ */ new Date()).toISOString() + " | v" + clientVersion + " " + process_1.pid + " | " + tracer + " | " + text25);
37383
37383
  }
37384
37384
  }
37385
37385
  function isTracerEnabled(tracer) {
@@ -38962,9 +38962,9 @@ var require_backoff_timeout = __commonJS({
38962
38962
  get traceEnabled() {
38963
38963
  return logging.isTracerEnabled(TRACER_NAME);
38964
38964
  }
38965
- trace(text24) {
38965
+ trace(text25) {
38966
38966
  if (this.traceEnabled) {
38967
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "{" + this.id + "} " + text24);
38967
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "{" + this.id + "} " + text25);
38968
38968
  }
38969
38969
  }
38970
38970
  runTimer(delay) {
@@ -39213,8 +39213,8 @@ var require_resolving_load_balancer = __commonJS({
39213
39213
  var uri_parser_1 = require_uri_parser();
39214
39214
  var load_balancer_child_handler_1 = require_load_balancer_child_handler();
39215
39215
  var TRACER_NAME = "resolving_load_balancer";
39216
- function trace(text24) {
39217
- logging.trace(constants_2.LogVerbosity.DEBUG, TRACER_NAME, text24);
39216
+ function trace(text25) {
39217
+ logging.trace(constants_2.LogVerbosity.DEBUG, TRACER_NAME, text25);
39218
39218
  }
39219
39219
  var NAME_MATCH_LEVEL_ORDER = [
39220
39220
  "SERVICE_AND_METHOD",
@@ -42929,14 +42929,14 @@ var require_subchannel = __commonJS({
42929
42929
  get refTraceEnabled() {
42930
42930
  return logging.isTracerEnabled("subchannel_refcount");
42931
42931
  }
42932
- trace(text24) {
42932
+ trace(text25) {
42933
42933
  if (this.traceEnabled) {
42934
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "(" + this.channelzRef.id + ") " + this.subchannelAddressString + " " + text24);
42934
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "(" + this.channelzRef.id + ") " + this.subchannelAddressString + " " + text25);
42935
42935
  }
42936
42936
  }
42937
- refTrace(text24) {
42937
+ refTrace(text25) {
42938
42938
  if (this.refTraceEnabled) {
42939
- logging.trace(constants_1.LogVerbosity.DEBUG, "subchannel_refcount", "(" + this.channelzRef.id + ") " + this.subchannelAddressString + " " + text24);
42939
+ logging.trace(constants_1.LogVerbosity.DEBUG, "subchannel_refcount", "(" + this.channelzRef.id + ") " + this.subchannelAddressString + " " + text25);
42940
42940
  }
42941
42941
  }
42942
42942
  handleBackoffTimer() {
@@ -43223,8 +43223,8 @@ var require_resolver_dns = __commonJS({
43223
43223
  var backoff_timeout_1 = require_backoff_timeout();
43224
43224
  var environment_1 = require_environment();
43225
43225
  var TRACER_NAME = "dns_resolver";
43226
- function trace(text24) {
43227
- logging.trace(constants_2.LogVerbosity.DEBUG, TRACER_NAME, text24);
43226
+ function trace(text25) {
43227
+ logging.trace(constants_2.LogVerbosity.DEBUG, TRACER_NAME, text25);
43228
43228
  }
43229
43229
  exports.DEFAULT_PORT = 443;
43230
43230
  var DEFAULT_MIN_TIME_BETWEEN_RESOLUTIONS_MS = 3e4;
@@ -43509,8 +43509,8 @@ var require_http_proxy = __commonJS({
43509
43509
  var url_1 = __require("url");
43510
43510
  var resolver_dns_1 = require_resolver_dns();
43511
43511
  var TRACER_NAME = "proxy";
43512
- function trace(text24) {
43513
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text24);
43512
+ function trace(text25) {
43513
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text25);
43514
43514
  }
43515
43515
  function getProxyInfo() {
43516
43516
  let proxyEnv = "";
@@ -44040,9 +44040,9 @@ var require_subchannel_call = __commonJS({
44040
44040
  get traceEnabled() {
44041
44041
  return logging.isTracerEnabled(TRACER_NAME);
44042
44042
  }
44043
- trace(text24) {
44043
+ trace(text25) {
44044
44044
  if (this.traceEnabled) {
44045
- logging.trace(constants_2.LogVerbosity.DEBUG, TRACER_NAME, "[" + this.callId + "] " + text24);
44045
+ logging.trace(constants_2.LogVerbosity.DEBUG, TRACER_NAME, "[" + this.callId + "] " + text25);
44046
44046
  }
44047
44047
  }
44048
44048
  /**
@@ -44409,24 +44409,24 @@ var require_transport = __commonJS({
44409
44409
  get internalsTraceEnabled() {
44410
44410
  return logging.isTracerEnabled("transport_internals");
44411
44411
  }
44412
- trace(text24) {
44412
+ trace(text25) {
44413
44413
  if (this.traceEnabled) {
44414
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "(" + this.channelzRef.id + ") " + this.subchannelAddressString + " " + text24);
44414
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "(" + this.channelzRef.id + ") " + this.subchannelAddressString + " " + text25);
44415
44415
  }
44416
44416
  }
44417
- keepaliveTrace(text24) {
44417
+ keepaliveTrace(text25) {
44418
44418
  if (this.keepaliveTraceEnabled) {
44419
- logging.trace(constants_1.LogVerbosity.DEBUG, "keepalive", "(" + this.channelzRef.id + ") " + this.subchannelAddressString + " " + text24);
44419
+ logging.trace(constants_1.LogVerbosity.DEBUG, "keepalive", "(" + this.channelzRef.id + ") " + this.subchannelAddressString + " " + text25);
44420
44420
  }
44421
44421
  }
44422
- flowControlTrace(text24) {
44422
+ flowControlTrace(text25) {
44423
44423
  if (this.flowControlTraceEnabled) {
44424
- logging.trace(constants_1.LogVerbosity.DEBUG, FLOW_CONTROL_TRACER_NAME, "(" + this.channelzRef.id + ") " + this.subchannelAddressString + " " + text24);
44424
+ logging.trace(constants_1.LogVerbosity.DEBUG, FLOW_CONTROL_TRACER_NAME, "(" + this.channelzRef.id + ") " + this.subchannelAddressString + " " + text25);
44425
44425
  }
44426
44426
  }
44427
- internalsTrace(text24) {
44427
+ internalsTrace(text25) {
44428
44428
  if (this.internalsTraceEnabled) {
44429
- logging.trace(constants_1.LogVerbosity.DEBUG, "transport_internals", "(" + this.channelzRef.id + ") " + this.subchannelAddressString + " " + text24);
44429
+ logging.trace(constants_1.LogVerbosity.DEBUG, "transport_internals", "(" + this.channelzRef.id + ") " + this.subchannelAddressString + " " + text25);
44430
44430
  }
44431
44431
  }
44432
44432
  /**
@@ -44664,9 +44664,9 @@ var require_transport = __commonJS({
44664
44664
  get traceEnabled() {
44665
44665
  return logging.isTracerEnabled(TRACER_NAME);
44666
44666
  }
44667
- trace(text24) {
44667
+ trace(text25) {
44668
44668
  if (this.traceEnabled) {
44669
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, (0, uri_parser_1.uriToString)(this.channelTarget) + " " + text24);
44669
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, (0, uri_parser_1.uriToString)(this.channelTarget) + " " + text25);
44670
44670
  }
44671
44671
  }
44672
44672
  createSession(secureConnectResult, address8, options3) {
@@ -44980,9 +44980,9 @@ var require_load_balancing_call = __commonJS({
44980
44980
  get traceEnabled() {
44981
44981
  return logging.isTracerEnabled(TRACER_NAME);
44982
44982
  }
44983
- trace(text24) {
44983
+ trace(text25) {
44984
44984
  if (this.traceEnabled) {
44985
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "[" + this.callNumber + "] " + text24);
44985
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "[" + this.callNumber + "] " + text25);
44986
44986
  }
44987
44987
  }
44988
44988
  getSubchannelString(subchannel) {
@@ -45242,9 +45242,9 @@ var require_resolving_call = __commonJS({
45242
45242
  get traceEnabled() {
45243
45243
  return logging.isTracerEnabled(TRACER_NAME);
45244
45244
  }
45245
- trace(text24) {
45245
+ trace(text25) {
45246
45246
  if (this.traceEnabled) {
45247
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "[" + this.callNumber + "] " + text24);
45247
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "[" + this.callNumber + "] " + text25);
45248
45248
  }
45249
45249
  }
45250
45250
  runDeadlineTimer() {
@@ -45633,9 +45633,9 @@ var require_retrying_call = __commonJS({
45633
45633
  get traceEnabled() {
45634
45634
  return logging.isTracerEnabled(TRACER_NAME);
45635
45635
  }
45636
- trace(text24) {
45636
+ trace(text25) {
45637
45637
  if (this.traceEnabled) {
45638
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "[" + this.callNumber + "] " + text24);
45638
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "[" + this.callNumber + "] " + text25);
45639
45639
  }
45640
45640
  }
45641
45641
  reportStatus(statusObject) {
@@ -46502,9 +46502,9 @@ var require_internal_channel = __commonJS({
46502
46502
  get traceEnabled() {
46503
46503
  return (0, logging_1.isTracerEnabled)("channel");
46504
46504
  }
46505
- trace(text24, verbosityOverride) {
46505
+ trace(text25, verbosityOverride) {
46506
46506
  if (this.traceEnabled) {
46507
- (0, logging_1.trace)(verbosityOverride !== null && verbosityOverride !== void 0 ? verbosityOverride : constants_1.LogVerbosity.DEBUG, "channel", "(" + this.channelzRef.id + ") " + (0, uri_parser_1.uriToString)(this.target) + " " + text24);
46507
+ (0, logging_1.trace)(verbosityOverride !== null && verbosityOverride !== void 0 ? verbosityOverride : constants_1.LogVerbosity.DEBUG, "channel", "(" + this.channelzRef.id + ") " + (0, uri_parser_1.uriToString)(this.target) + " " + text25);
46508
46508
  }
46509
46509
  }
46510
46510
  callRefTimerRef() {
@@ -47748,8 +47748,8 @@ var require_server_interceptors = __commonJS({
47748
47748
  var orca_1 = require_orca();
47749
47749
  var environment_1 = require_environment();
47750
47750
  var TRACER_NAME = "server_call";
47751
- function trace(text24) {
47752
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text24);
47751
+ function trace(text25) {
47752
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text25);
47753
47753
  }
47754
47754
  var ServerListenerBuilder = class {
47755
47755
  constructor() {
@@ -48565,8 +48565,8 @@ var require_server = __commonJS({
48565
48565
  var { HTTP2_HEADER_PATH } = http2.constants;
48566
48566
  var TRACER_NAME = "server";
48567
48567
  var kMaxAge = Buffer.from("max_age");
48568
- function serverCallTrace(text24) {
48569
- logging.trace(constants_1.LogVerbosity.DEBUG, "server_call", text24);
48568
+ function serverCallTrace(text25) {
48569
+ logging.trace(constants_1.LogVerbosity.DEBUG, "server_call", text25);
48570
48570
  }
48571
48571
  function noop() {
48572
48572
  }
@@ -48705,11 +48705,11 @@ var require_server = __commonJS({
48705
48705
  };
48706
48706
  return socketInfo;
48707
48707
  }
48708
- trace(text24) {
48709
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "(" + this.channelzRef.id + ") " + text24);
48708
+ trace(text25) {
48709
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, "(" + this.channelzRef.id + ") " + text25);
48710
48710
  }
48711
- keepaliveTrace(text24) {
48712
- logging.trace(constants_1.LogVerbosity.DEBUG, "keepalive", "(" + this.channelzRef.id + ") " + text24);
48711
+ keepaliveTrace(text25) {
48712
+ logging.trace(constants_1.LogVerbosity.DEBUG, "keepalive", "(" + this.channelzRef.id + ") " + text25);
48713
48713
  }
48714
48714
  addProtoService() {
48715
48715
  throw new Error("Not implemented. Use addService() instead");
@@ -50048,8 +50048,8 @@ var require_load_balancer_pick_first = __commonJS({
50048
50048
  var net_1 = __require("net");
50049
50049
  var call_interface_1 = require_call_interface();
50050
50050
  var TRACER_NAME = "pick_first";
50051
- function trace(text24) {
50052
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text24);
50051
+ function trace(text25) {
50052
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text25);
50053
50053
  }
50054
50054
  var TYPE_NAME = "pick_first";
50055
50055
  var CONNECTION_DELAY_INTERVAL_MS = 250;
@@ -50460,8 +50460,8 @@ var require_certificate_provider = __commonJS({
50460
50460
  var constants_1 = require_constants();
50461
50461
  var util_1 = __require("util");
50462
50462
  var TRACER_NAME = "certificate_provider";
50463
- function trace(text24) {
50464
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text24);
50463
+ function trace(text25) {
50464
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text25);
50465
50465
  }
50466
50466
  var readFilePromise = (0, util_1.promisify)(fs.readFile);
50467
50467
  var FileWatcherCertificateProvider = class {
@@ -50760,8 +50760,8 @@ var require_resolver_ip = __commonJS({
50760
50760
  var uri_parser_1 = require_uri_parser();
50761
50761
  var logging = require_logging();
50762
50762
  var TRACER_NAME = "ip_resolver";
50763
- function trace(text24) {
50764
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text24);
50763
+ function trace(text25) {
50764
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text25);
50765
50765
  }
50766
50766
  var IPV4_SCHEME = "ipv4";
50767
50767
  var IPV6_SCHEME = "ipv6";
@@ -50851,8 +50851,8 @@ var require_load_balancer_round_robin = __commonJS({
50851
50851
  var subchannel_address_1 = require_subchannel_address();
50852
50852
  var load_balancer_pick_first_1 = require_load_balancer_pick_first();
50853
50853
  var TRACER_NAME = "round_robin";
50854
- function trace(text24) {
50855
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text24);
50854
+ function trace(text25) {
50855
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text25);
50856
50856
  }
50857
50857
  var TYPE_NAME = "round_robin";
50858
50858
  var RoundRobinLoadBalancingConfig = class _RoundRobinLoadBalancingConfig {
@@ -51030,8 +51030,8 @@ var require_load_balancer_outlier_detection = __commonJS({
51030
51030
  var subchannel_interface_1 = require_subchannel_interface();
51031
51031
  var logging = require_logging();
51032
51032
  var TRACER_NAME = "outlier_detection";
51033
- function trace(text24) {
51034
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text24);
51033
+ function trace(text25) {
51034
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text25);
51035
51035
  }
51036
51036
  var TYPE_NAME = "outlier_detection";
51037
51037
  var OUTLIER_DETECTION_ENABLED = ((_a3 = process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION) !== null && _a3 !== void 0 ? _a3 : "true") === "true";
@@ -51630,8 +51630,8 @@ var require_load_balancer_weighted_round_robin = __commonJS({
51630
51630
  var priority_queue_1 = require_priority_queue();
51631
51631
  var subchannel_address_1 = require_subchannel_address();
51632
51632
  var TRACER_NAME = "weighted_round_robin";
51633
- function trace(text24) {
51634
- logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text24);
51633
+ function trace(text25) {
51634
+ logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text25);
51635
51635
  }
51636
51636
  var TYPE_NAME = "weighted_round_robin";
51637
51637
  var DEFAULT_OOB_REPORTING_PERIOD_MS = 1e4;
@@ -56559,6 +56559,7 @@ var EXECUTION_SUPPORT = {
56559
56559
  "--compare": sceneOnly,
56560
56560
  "--min-pass-rate": sceneOnly,
56561
56561
  "--strict": sceneOnly,
56562
+ "--allow-simulated": sceneOnly,
56562
56563
  "--seed": sceneOnly,
56563
56564
  "--out": thisComputer,
56564
56565
  "--detach": sceneOnly,
@@ -65938,8 +65939,8 @@ function ko_default() {
65938
65939
  }
65939
65940
 
65940
65941
  // node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/lt.js
65941
- var capitalizeFirstCharacter = (text24) => {
65942
- return text24.charAt(0).toUpperCase() + text24.slice(1);
65942
+ var capitalizeFirstCharacter = (text25) => {
65943
+ return text25.charAt(0).toUpperCase() + text25.slice(1);
65943
65944
  };
65944
65945
  function getUnitTypeFromNumber(number7) {
65945
65946
  const abs = Math.abs(number7);
@@ -76367,9 +76368,9 @@ var NUMBER = new RegExp(
76367
76368
  String.raw`(?<![\p{L}\p{N}_.,]|\p{L}[-−–+/_])(?<open>\()?(?<sign>[-−–+])?(?:(?<before>${CURRENCY})[ \u00A0]?)?(?<minus>[-−–])?(?<inner>\()?` + String.raw`(?<digits>\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?)(?!\p{N}|[eE][-+]?\d|,\d{3}|\.\d)` + String.raw`(?:[ \u00A0]?(?<after>${CODES.join("|")}|[${SYMBOLS}]))?(?<close>\))?`,
76368
76369
  "gu"
76369
76370
  );
76370
- function readNumbers(text24) {
76371
+ function readNumbers(text25) {
76371
76372
  const numbers2 = [];
76372
- for (const match3 of text24.normalize("NFKC").matchAll(NUMBER)) {
76373
+ for (const match3 of text25.normalize("NFKC").matchAll(NUMBER)) {
76373
76374
  const { open: open2, sign: sign3, before, minus, inner, digits, after, close } = match3.groups;
76374
76375
  const parenthesized = (open2 !== void 0 || inner !== void 0) && close !== void 0;
76375
76376
  const amount3 = before !== void 0 || after !== void 0 || /[,.]/.test(digits);
@@ -76389,22 +76390,22 @@ function numberMatches(number7, value4, tolerance) {
76389
76390
  return near(number7.value) || number7.either === true && near(-number7.value);
76390
76391
  }
76391
76392
  function plainNumber(value4) {
76392
- const text24 = String(value4);
76393
- return text24.includes("e") ? value4.toLocaleString("en-US", { useGrouping: false, maximumFractionDigits: 20 }) : text24;
76393
+ const text25 = String(value4);
76394
+ return text25.includes("e") ? value4.toLocaleString("en-US", { useGrouping: false, maximumFractionDigits: 20 }) : text25;
76394
76395
  }
76395
76396
  function answerText(output2) {
76396
76397
  if (output2 === void 0 || output2 === null) return "";
76397
76398
  if (typeof output2 === "string") return output2;
76398
76399
  if (typeof output2 === "number") return Number.isFinite(output2) ? plainNumber(output2) : String(output2);
76399
- if (Array.isArray(output2)) return output2.map(answerText).filter((text24) => text24 !== "").join("\n");
76400
+ if (Array.isArray(output2)) return output2.map(answerText).filter((text25) => text25 !== "").join("\n");
76400
76401
  if (typeof output2 === "object") {
76401
- return Object.entries(output2).map(([key4, value4]) => [key4, answerText(value4)]).filter(([, text24]) => text24 !== "").map(([key4, text24]) => text24.includes("\n") ? `${key4}:
76402
- ${text24}` : `${key4}: ${text24}`).join("\n");
76402
+ return Object.entries(output2).map(([key4, value4]) => [key4, answerText(value4)]).filter(([, text25]) => text25 !== "").map(([key4, text25]) => text25.includes("\n") ? `${key4}:
76403
+ ${text25}` : `${key4}: ${text25}`).join("\n");
76403
76404
  }
76404
76405
  return String(output2);
76405
76406
  }
76406
76407
  var AnswerNumberSchema = external_exports.strictObject({
76407
- value: external_exports.union([external_exports.number(), external_exports.string().refine((text24) => readNumbers(text24).length === 1, 'a number, or one number written as text, e.g. "1,240.00" or "(300.00)"')]).describe('The number the answer must state: a number, or one number as text ("1,240.00") to keep its decimal places'),
76408
+ value: external_exports.union([external_exports.number(), external_exports.string().refine((text25) => readNumbers(text25).length === 1, 'a number, or one number written as text, e.g. "1,240.00" or "(300.00)"')]).describe('The number the answer must state: a number, or one number as text ("1,240.00") to keep its decimal places'),
76408
76409
  tolerance: external_exports.number().nonnegative().optional().describe("How far the stated number may be from value; default: half the last decimal place of value (1200.00 \u2192 0.005, 1240.5 \u2192 0.05, 1200 \u2192 0.5)")
76409
76410
  });
76410
76411
  var texts = external_exports.union([external_exports.string().min(1), external_exports.array(external_exports.string().min(1)).min(1)]);
@@ -76443,8 +76444,8 @@ function decimalsOf(value4) {
76443
76444
  const [mantissa, exponent] = String(Math.abs(value4)).split("e");
76444
76445
  return Math.max(0, (mantissa.split(".")[1]?.length ?? 0) - Number(exponent ?? 0));
76445
76446
  }
76446
- function comparableText(text24, sensitive = false) {
76447
- const plain3 = text24.normalize("NFKC").replace(/[‘’‛′]/g, "'").replace(/[“”„″]/g, '"').replace(/[‐‑‒–—−]/g, "-").replace(/\s+/g, " ").trim();
76447
+ function comparableText(text25, sensitive = false) {
76448
+ const plain3 = text25.normalize("NFKC").replace(/[‘’‛′]/g, "'").replace(/[“”„″]/g, '"').replace(/[‐‑‒–—−]/g, "-").replace(/\s+/g, " ").trim();
76448
76449
  return sensitive ? plain3 : plain3.toLowerCase();
76449
76450
  }
76450
76451
 
@@ -77112,20 +77113,20 @@ var RANGE_HINT = "use <min>..<max> of simulated time, such as 3m..12m, or one du
77112
77113
  var RATE_RE = /^(\d+(?:\.\d+)?)(?:\.\.(\d+(?:\.\d+)?))?\/(m|h|d)$/;
77113
77114
  var RATE_HINT = "use <min>..<max>/<unit> or <n>/<unit> with unit m, h or d, such as 0..2/h";
77114
77115
  var MAX_NOISE_PER_HOUR = 60;
77115
- function parseDurationRange(text24) {
77116
- const parts3 = text24.split("..");
77117
- if (parts3.length > 2 || parts3.some((part) => part === "")) throw new AnchaError("SCENE_INVALID", `invalid duration range "${text24}"`, { hint: RANGE_HINT });
77116
+ function parseDurationRange(text25) {
77117
+ const parts3 = text25.split("..");
77118
+ if (parts3.length > 2 || parts3.some((part) => part === "")) throw new AnchaError("SCENE_INVALID", `invalid duration range "${text25}"`, { hint: RANGE_HINT });
77118
77119
  const minMs = parseDuration(parts3[0]), maxMs = parseDuration(parts3[1] ?? parts3[0]);
77119
- if (minMs < 0 || maxMs < minMs) throw new AnchaError("SCENE_INVALID", `invalid duration range "${text24}": need 0 <= min <= max`, { hint: RANGE_HINT });
77120
+ if (minMs < 0 || maxMs < minMs) throw new AnchaError("SCENE_INVALID", `invalid duration range "${text25}": need 0 <= min <= max`, { hint: RANGE_HINT });
77120
77121
  return { minMs, maxMs };
77121
77122
  }
77122
- function parseRate(text24) {
77123
- const match3 = RATE_RE.exec(text24);
77124
- if (!match3) throw new AnchaError("SCENE_INVALID", `invalid rate "${text24}"`, { hint: RATE_HINT });
77123
+ function parseRate(text25) {
77124
+ const match3 = RATE_RE.exec(text25);
77125
+ if (!match3) throw new AnchaError("SCENE_INVALID", `invalid rate "${text25}"`, { hint: RATE_HINT });
77125
77126
  const perHour = { m: 60, h: 1, d: 1 / 24 }[match3[3]];
77126
77127
  const minPerHour = Number(match3[1]) * perHour, maxPerHour = Number(match3[2] ?? match3[1]) * perHour;
77127
- if (maxPerHour < minPerHour) throw new AnchaError("SCENE_INVALID", `invalid rate "${text24}": min is above max`, { hint: RATE_HINT });
77128
- if (maxPerHour > MAX_NOISE_PER_HOUR) throw new AnchaError("SCENE_INVALID", `invalid rate "${text24}": at most ${MAX_NOISE_PER_HOUR} per hour`, { hint: RATE_HINT });
77128
+ if (maxPerHour < minPerHour) throw new AnchaError("SCENE_INVALID", `invalid rate "${text25}": min is above max`, { hint: RATE_HINT });
77129
+ if (maxPerHour > MAX_NOISE_PER_HOUR) throw new AnchaError("SCENE_INVALID", `invalid rate "${text25}": at most ${MAX_NOISE_PER_HOUR} per hour`, { hint: RATE_HINT });
77129
77130
  return { minPerHour, maxPerHour };
77130
77131
  }
77131
77132
  function parsed(parse15, description2) {
@@ -78286,9 +78287,9 @@ var GMAIL_SCOPES = {
78286
78287
  var scopeValues = Object.values(GMAIL_SCOPES);
78287
78288
  var EMAIL = /^[^\s<>@",;:()[\]\\]+@[^\s<>@",;:()[\]\\]+\.[^\s<>@",;:()[\]\\]+$/;
78288
78289
  function parseGmailAddress(value4) {
78289
- const text24 = value4.trim();
78290
- if (EMAIL.test(text24)) return { name: "", email: text24 };
78291
- const match3 = /^(.*?)\s*<([^<>]+)>$/.exec(text24);
78290
+ const text25 = value4.trim();
78291
+ if (EMAIL.test(text25)) return { name: "", email: text25 };
78292
+ const match3 = /^(.*?)\s*<([^<>]+)>$/.exec(text25);
78292
78293
  if (!match3 || !EMAIL.test(match3[2].trim())) return void 0;
78293
78294
  let name5 = match3[1].trim();
78294
78295
  if (name5.startsWith('"') && name5.endsWith('"') && name5.length >= 2) name5 = name5.slice(1, -1).replace(/\\(.)/g, "$1");
@@ -84019,16 +84020,16 @@ var FormulaSyntaxError = class extends Error {
84019
84020
  };
84020
84021
  var FormulaGap = class extends Error {
84021
84022
  };
84022
- function tokenize(text24) {
84023
+ function tokenize(text25) {
84023
84024
  const out = [];
84024
84025
  let i = 0;
84025
84026
  const quoted3 = (close, what) => {
84026
84027
  let j = i + 1, value4 = "";
84027
84028
  for (; ; ) {
84028
- if (j >= text24.length) throw new FormulaSyntaxError(`unterminated ${what}`);
84029
- const c = text24[j];
84030
- if (c === "\\" && j + 1 < text24.length) {
84031
- const e = text24[j + 1];
84029
+ if (j >= text25.length) throw new FormulaSyntaxError(`unterminated ${what}`);
84030
+ const c = text25[j];
84031
+ if (c === "\\" && j + 1 < text25.length) {
84032
+ const e = text25[j + 1];
84032
84033
  value4 += e === "n" ? "\n" : e === "t" ? " " : e;
84033
84034
  j += 2;
84034
84035
  continue;
@@ -84040,8 +84041,8 @@ function tokenize(text24) {
84040
84041
  i = j + 1;
84041
84042
  return value4;
84042
84043
  };
84043
- while (i < text24.length) {
84044
- const c = text24[i], rest2 = text24.slice(i);
84044
+ while (i < text25.length) {
84045
+ const c = text25[i], rest2 = text25.slice(i);
84045
84046
  if (/\s/.test(c)) {
84046
84047
  i++;
84047
84048
  continue;
@@ -84082,8 +84083,8 @@ function tokenize(text24) {
84082
84083
  out.push({ kind: "end" });
84083
84084
  return out;
84084
84085
  }
84085
- function parseFormula(text24) {
84086
- const tokens3 = tokenize(text24);
84086
+ function parseFormula(text25) {
84087
+ const tokens3 = tokenize(text25);
84087
84088
  let at3 = 0;
84088
84089
  const isOp = (value4) => {
84089
84090
  const token4 = tokens3[at3];
@@ -84167,8 +84168,8 @@ function printFormula(node5, field5 = (name5) => name5) {
84167
84168
  case "unary":
84168
84169
  return `${item2.op}${print(item2.arg, 5)}`;
84169
84170
  case "binary": {
84170
- const precedence = PRECEDENCE[item2.op], text24 = `${print(item2.left, precedence)} ${item2.op} ${print(item2.right, precedence + 1)}`;
84171
- return precedence < parent2 ? `(${text24})` : text24;
84171
+ const precedence = PRECEDENCE[item2.op], text25 = `${print(item2.left, precedence)} ${item2.op} ${print(item2.right, precedence + 1)}`;
84172
+ return precedence < parent2 ? `(${text25})` : text25;
84172
84173
  }
84173
84174
  }
84174
84175
  };
@@ -84223,8 +84224,8 @@ function num(value4) {
84223
84224
  if (typeof value4 === "number") return value4;
84224
84225
  if (typeof value4 === "boolean") return value4 ? 1 : 0;
84225
84226
  if (typeof value4 === "string") {
84226
- const text24 = value4.trim();
84227
- return !text24 ? 0 : NUMERIC.test(text24) ? Number(text24) : NaN;
84227
+ const text25 = value4.trim();
84228
+ return !text25 ? 0 : NUMERIC.test(text25) ? Number(text25) : NaN;
84228
84229
  }
84229
84230
  return NaN;
84230
84231
  }
@@ -84244,8 +84245,8 @@ function validDay(y, m, d) {
84244
84245
  const ms = utc(y, m, d), date10 = new Date(ms);
84245
84246
  return date10.getUTCFullYear() === y && date10.getUTCMonth() === m && date10.getUTCDate() === d ? ms : null;
84246
84247
  }
84247
- function parseFormulaDate(text24) {
84248
- const value4 = text24.trim();
84248
+ function parseFormulaDate(text25) {
84249
+ const value4 = text25.trim();
84249
84250
  let match3 = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value4);
84250
84251
  if (match3) {
84251
84252
  const ms = validDay(+match3[1], +match3[2] - 1, +match3[3]);
@@ -84291,8 +84292,8 @@ function equal(a, b) {
84291
84292
  }
84292
84293
  if (typeof a === "string" && typeof b === "string") return a === b;
84293
84294
  if (typeof a === "string" || typeof b === "string") {
84294
- const text24 = typeof a === "string" ? a : b, other = typeof a === "string" ? b : a;
84295
- return numericText(text24) ? Number(text24.trim()) === num(other) : formulaText(other) === text24;
84295
+ const text25 = typeof a === "string" ? a : b, other = typeof a === "string" ? b : a;
84296
+ return numericText(text25) ? Number(text25.trim()) === num(other) : formulaText(other) === text25;
84296
84297
  }
84297
84298
  return num(a) === num(b);
84298
84299
  }
@@ -84343,8 +84344,8 @@ var UNITS = {
84343
84344
  };
84344
84345
  var FIXED = { milliseconds: 1, seconds: 1e3, minutes: 6e4, hours: 36e5, days: 864e5, weeks: 6048e5 };
84345
84346
  var unitOf = (value4) => {
84346
- const text24 = formulaText(value4).trim();
84347
- return UNITS[text24] ?? UNITS[text24.toLowerCase()] ?? null;
84347
+ const text25 = formulaText(value4).trim();
84348
+ return UNITS[text25] ?? UNITS[text25.toLowerCase()] ?? null;
84348
84349
  };
84349
84350
  function addMonths(ms, months) {
84350
84351
  const date10 = new Date(ms), day9 = date10.getUTCDate();
@@ -84452,7 +84453,7 @@ function formatFormulaDate(ms, format2) {
84452
84453
  };
84453
84454
  return format2.replace(FORMAT_TOKENS, (part, literal2) => literal2 ?? token4(part));
84454
84455
  }
84455
- function parseWithFormat(text24, format2) {
84456
+ function parseWithFormat(text25, format2) {
84456
84457
  const parts3 = [];
84457
84458
  let pattern = "";
84458
84459
  let last = 0;
@@ -84470,7 +84471,7 @@ function parseWithFormat(text24, format2) {
84470
84471
  parts3.push(token4);
84471
84472
  }
84472
84473
  pattern += format2.slice(last).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
84473
- const match3 = new RegExp(`^${pattern}$`).exec(text24.trim());
84474
+ const match3 = new RegExp(`^${pattern}$`).exec(text25.trim());
84474
84475
  if (!match3) return null;
84475
84476
  let y = 1970, mo = 0, d = 1, h = 0, mi = 0, s2 = 0, pm = null;
84476
84477
  parts3.forEach((token4, i) => {
@@ -84534,16 +84535,16 @@ var FUNCTIONS = {
84534
84535
  ISERROR: { min: 1, max: 1, run: (args) => isFormulaError(args[0]) || typeof args[0] === "number" && Number.isNaN(args[0]) },
84535
84536
  // text
84536
84537
  CONCATENATE: { min: 1, max: Infinity, run: (args) => args.map(formulaText).join("") },
84537
- LEN: text1((text24) => [...text24].length),
84538
- LOWER: text1((text24) => text24.toLowerCase()),
84539
- UPPER: text1((text24) => text24.toUpperCase()),
84540
- TRIM: text1((text24) => text24.trim()),
84538
+ LEN: text1((text25) => [...text25].length),
84539
+ LOWER: text1((text25) => text25.toLowerCase()),
84540
+ UPPER: text1((text25) => text25.toUpperCase()),
84541
+ TRIM: text1((text25) => text25.trim()),
84541
84542
  T: { min: 1, max: 1, run: (args) => typeof single(args[0]) === "string" ? single(args[0]) : "" },
84542
- ENCODE_URL_COMPONENT: text1((text24) => encodeURIComponent(text24)),
84543
+ ENCODE_URL_COMPONENT: text1((text25) => encodeURIComponent(text25)),
84543
84544
  LEFT: { min: 2, max: 2, run: (args) => formulaText(args[0]).slice(0, Math.max(0, num(args[1]))) },
84544
84545
  RIGHT: { min: 2, max: 2, run: (args) => {
84545
- const text24 = formulaText(args[0]), n2 = Math.max(0, num(args[1]));
84546
- return n2 ? text24.slice(-n2) : "";
84546
+ const text25 = formulaText(args[0]), n2 = Math.max(0, num(args[1]));
84547
+ return n2 ? text25.slice(-n2) : "";
84547
84548
  } },
84548
84549
  MID: { min: 3, max: 3, run: (args) => {
84549
84550
  const start2 = Math.max(1, num(args[1]));
@@ -84558,20 +84559,20 @@ var FUNCTIONS = {
84558
84559
  return at3 < 0 ? null : at3 + 1;
84559
84560
  } },
84560
84561
  SUBSTITUTE: { min: 3, max: 4, run: (args) => {
84561
- const text24 = formulaText(args[0]), old = formulaText(args[1]), replacement = formulaText(args[2]);
84562
- if (!old) return text24;
84563
- if (args[3] === void 0) return text24.split(old).join(replacement);
84562
+ const text25 = formulaText(args[0]), old = formulaText(args[1]), replacement = formulaText(args[2]);
84563
+ if (!old) return text25;
84564
+ if (args[3] === void 0) return text25.split(old).join(replacement);
84564
84565
  const index = num(args[3]);
84565
84566
  let at3 = -1;
84566
84567
  for (let i = 0; i < index; i++) {
84567
- at3 = text24.indexOf(old, at3 + 1);
84568
- if (at3 < 0) return text24;
84568
+ at3 = text25.indexOf(old, at3 + 1);
84569
+ if (at3 < 0) return text25;
84569
84570
  }
84570
- return text24.slice(0, at3) + replacement + text24.slice(at3 + old.length);
84571
+ return text25.slice(0, at3) + replacement + text25.slice(at3 + old.length);
84571
84572
  } },
84572
84573
  REPLACE: { min: 4, max: 4, run: (args) => {
84573
- const text24 = formulaText(args[0]), start2 = Math.max(1, num(args[1])) - 1;
84574
- return text24.slice(0, start2) + formulaText(args[3]) + text24.slice(start2 + Math.max(0, num(args[2])));
84574
+ const text25 = formulaText(args[0]), start2 = Math.max(1, num(args[1])) - 1;
84575
+ return text25.slice(0, start2) + formulaText(args[3]) + text25.slice(start2 + Math.max(0, num(args[2])));
84575
84576
  } },
84576
84577
  REPT: { min: 2, max: 2, run: (args) => formulaText(args[0]).repeat(Math.max(0, Math.floor(num(args[1])) || 0)) },
84577
84578
  REGEX_MATCH: { min: 2, max: 2, run: (args) => {
@@ -84673,9 +84674,9 @@ var FUNCTIONS = {
84673
84674
  } },
84674
84675
  DATETIME_PARSE: { min: 1, max: 3, run: (args) => {
84675
84676
  if (args[2] !== void 0) throw new FormulaGap("DATETIME_PARSE() with a locale");
84676
- const text24 = formulaText(args[0]);
84677
- if (!text24) return null;
84678
- return (args[1] === void 0 ? parseFormulaDate(text24) : parseWithFormat(text24, formulaText(args[1]))) ?? err();
84677
+ const text25 = formulaText(args[0]);
84678
+ if (!text25) return null;
84679
+ return (args[1] === void 0 ? parseFormulaDate(text25) : parseWithFormat(text25, formulaText(args[1]))) ?? err();
84679
84680
  } },
84680
84681
  DATESTR: { min: 1, max: 1, run: (args) => {
84681
84682
  const date10 = dateArg(args[0]);
@@ -84958,9 +84959,9 @@ var AirtableSeedSchema = external_exports.strictObject({
84958
84959
  if (new Set(entry2.fields.map((item2) => lower4(item2.name))).size !== entry2.fields.length) issue8([...at3, "fields"], "duplicate field name");
84959
84960
  if (!PRIMARY_TYPES.has(entry2.fields[0].type)) issue8([...at3, "fields", 0, "type"], `a ${entry2.fields[0].type} field cannot be the primary field`);
84960
84961
  const has2 = (fieldName) => fields11.has(fieldName);
84961
- const formula = (text24, path4, vars = [], hasField = has2) => {
84962
+ const formula = (text25, path4, vars = [], hasField = has2) => {
84962
84963
  try {
84963
- checkFormula(parseFormula(text24), hasField, vars);
84964
+ checkFormula(parseFormula(text25), hasField, vars);
84964
84965
  } catch (error64) {
84965
84966
  if (error64 instanceof FormulaSyntaxError || error64 instanceof FormulaGap) issue8(path4, `invalid formula: ${error64.message}`);
84966
84967
  else throw error64;
@@ -88630,14 +88631,14 @@ function parseChecks(input5) {
88630
88631
  }
88631
88632
  var PROSE_KEYS = /* @__PURE__ */ new Set(["judge", "task", "text", "value", "about", "message"]);
88632
88633
  var FIX_SHOWN = 120;
88633
- function cutProseIssues(doc, text24, lineCounter) {
88634
+ function cutProseIssues(doc, text25, lineCounter) {
88634
88635
  const issues = [];
88635
88636
  (0, import_yaml.visit)(doc, {
88636
88637
  Pair(_, pair, ancestors2) {
88637
88638
  const value4 = pair.value;
88638
88639
  if (!(0, import_yaml.isScalar)(pair.key) || !PROSE_KEYS.has(String(pair.key.value)) || !(0, import_yaml.isScalar)(value4)) return;
88639
88640
  if (value4.type !== "PLAIN" || typeof value4.value !== "string" || !value4.range) return;
88640
- const comment10 = /^[ \t]+#([^\r\n]*)/.exec(text24.slice(value4.range[1]));
88641
+ const comment10 = /^[ \t]+#([^\r\n]*)/.exec(text25.slice(value4.range[1]));
88641
88642
  if (comment10 === null) return;
88642
88643
  const key4 = String(pair.key.value);
88643
88644
  const { line: line2 } = lineCounter.linePos(value4.range[0]);
@@ -88660,19 +88661,19 @@ function pathOf(ancestors2, pair) {
88660
88661
  });
88661
88662
  return formatPath([...segments3, String(pair.key.value)]);
88662
88663
  }
88663
- function parseSceneYaml(text24) {
88664
+ function parseSceneYaml(text25) {
88664
88665
  const lineCounter = new import_yaml.LineCounter();
88665
- const doc = (0, import_yaml.parseDocument)(text24, { lineCounter, prettyErrors: false });
88666
+ const doc = (0, import_yaml.parseDocument)(text25, { lineCounter, prettyErrors: false });
88666
88667
  if (doc.errors.length > 0) {
88667
88668
  const issues = doc.errors.map((e) => {
88668
88669
  const { line: line2, col: col2 } = lineCounter.linePos(e.pos[0]);
88669
88670
  return { path: `line ${line2}, column ${col2}`, message: e.message };
88670
88671
  });
88671
- const atError = doc.errors.findIndex((e) => text24[e.pos[0]] === "@");
88672
+ const atError = doc.errors.findIndex((e) => text25[e.pos[0]] === "@");
88672
88673
  if (atError >= 0) issues[atError].hint = "refs in a test use $, e.g. $alice \u2014 YAML reserves @";
88673
88674
  throw sceneError(issues, doc.errors[0]);
88674
88675
  }
88675
- const cut = cutProseIssues(doc, text24, lineCounter);
88676
+ const cut = cutProseIssues(doc, text25, lineCounter);
88676
88677
  if (cut.length > 0) throw sceneError(cut);
88677
88678
  return doc.toJS();
88678
88679
  }
@@ -88756,6 +88757,20 @@ var WorldFileSchema = external_exports.strictObject({ version: external_exports.
88756
88757
  var BODY_KEYS = Object.keys(body2);
88757
88758
  var FILE_KEYS = ["version", "id", ...BODY_KEYS];
88758
88759
 
88760
+ // packages/core/src/company/profile.ts
88761
+ var text12 = (max) => external_exports.string().min(1).max(max).regex(/^[^\u0000-\u001f\u007f-\u009f]+$/u);
88762
+ var countries = new Set("AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW".split(" "));
88763
+ var CompanyProfileSchema = external_exports.strictObject({
88764
+ schemaVersion: external_exports.literal(1),
88765
+ name: text12(100),
88766
+ businessModel: external_exports.enum(["goods", "services", "mixed"]).nullable(),
88767
+ scale: external_exports.enum(["small", "medium", "large"]).nullable(),
88768
+ customerKinds: external_exports.array(text12(60)).max(8),
88769
+ vendorKinds: external_exports.array(text12(60)).max(8),
88770
+ offerings: external_exports.array(external_exports.strictObject({ name: text12(100), kind: external_exports.enum(["goods", "service"]) })).max(8),
88771
+ country: external_exports.enum([...countries]).nullable()
88772
+ });
88773
+
88759
88774
  // packages/core/src/datasets/netsuite-pe/generate.ts
88760
88775
  var ACCOUNTS = [
88761
88776
  { id: 1, number: "1000", name: "Operating Checking", type: "Bank" },
@@ -89709,9 +89724,9 @@ function netsuiteInferredCustomFields(seed43) {
89709
89724
  var PRIVATE_KEY = /authorization|cookie|token|secret|password|api[_-]?key|app[_-]?key|routing[_-]?key|credential/i;
89710
89725
  function cleanToolCompletion(value4, secrets = []) {
89711
89726
  if (typeof value4 === "string") {
89712
- let text24 = value4.replace(/\bBearer\s+[^\s"'<>]+/gi, "Bearer [redacted]").replace(/\b(?:sk-[A-Za-z0-9_-]+|xox[baprs]-[A-Za-z0-9-]+)/g, "[redacted]").replace(/\b((?:api[_-]?key|access[_-]?token|password|secret)\s*[:=]\s*)[^\s,;"']+/gi, "$1[redacted]");
89713
- for (const secret of secrets) if (secret) text24 = text24.replaceAll(secret, "[redacted]");
89714
- return text24;
89727
+ let text25 = value4.replace(/\bBearer\s+[^\s"'<>]+/gi, "Bearer [redacted]").replace(/\b(?:sk-[A-Za-z0-9_-]+|xox[baprs]-[A-Za-z0-9-]+)/g, "[redacted]").replace(/\b((?:api[_-]?key|access[_-]?token|password|secret)\s*[:=]\s*)[^\s,;"']+/gi, "$1[redacted]");
89728
+ for (const secret of secrets) if (secret) text25 = text25.replaceAll(secret, "[redacted]");
89729
+ return text25;
89715
89730
  }
89716
89731
  if (Array.isArray(value4)) return value4.map((v) => cleanToolCompletion(v, secrets));
89717
89732
  if (value4 && typeof value4 === "object") return Object.fromEntries(Object.entries(value4).map(([k, v]) => [k, PRIVATE_KEY.test(k) ? "[redacted]" : cleanToolCompletion(v, secrets)]));
@@ -89721,9 +89736,9 @@ function toolSecrets(value4) {
89721
89736
  if (!value4 || typeof value4 !== "object") return [];
89722
89737
  return Object.entries(value4).flatMap(([key4, v]) => PRIVATE_KEY.test(key4) && typeof v === "string" ? [v] : toolSecrets(v));
89723
89738
  }
89724
- function toolErrorText(text24) {
89739
+ function toolErrorText(text25) {
89725
89740
  let out = "", bytes2 = 0;
89726
- for (const char of text24) {
89741
+ for (const char of text25) {
89727
89742
  bytes2 += new TextEncoder().encode(char).length;
89728
89743
  if (bytes2 > 4096) break;
89729
89744
  out += char;
@@ -90450,7 +90465,7 @@ var HonoRequest = class {
90450
90465
  * ```
90451
90466
  */
90452
90467
  json() {
90453
- return this.#cachedBody("text").then((text24) => JSON.parse(text24));
90468
+ return this.#cachedBody("text").then((text25) => JSON.parse(text25));
90454
90469
  }
90455
90470
  /**
90456
90471
  * `.text()` can parse Request body of type `text/plain`
@@ -90968,8 +90983,8 @@ var Context = class {
90968
90983
  * })
90969
90984
  * ```
90970
90985
  */
90971
- text = (text24, arg, headers) => {
90972
- return !this.#preparedHeaders && !this.#status && !arg && !headers && !this.finalized ? new Response(text24) : this.#newResponse(text24, arg, setDefaultContentType(TEXT_PLAIN, headers));
90986
+ text = (text25, arg, headers) => {
90987
+ return !this.#preparedHeaders && !this.#status && !arg && !headers && !this.finalized ? new Response(text25) : this.#newResponse(text25, arg, setDefaultContentType(TEXT_PLAIN, headers));
90973
90988
  };
90974
90989
  /**
90975
90990
  * `.json()` can render JSON as `Content-Type:application/json`.
@@ -91942,8 +91957,8 @@ var PeopleModelError = class extends Error {
91942
91957
  function promptSha256(request4) {
91943
91958
  return createHash4("sha256").update(JSON.stringify([request4.system, request4.user, request4.schema, request4.model ?? null])).digest("hex");
91944
91959
  }
91945
- function parseModelJson(text24) {
91946
- const trimmed2 = text24.trim().replace(/^```(?:json)?\s*/i, "").replace(/\s*```$/, "");
91960
+ function parseModelJson(text25) {
91961
+ const trimmed2 = text25.trim().replace(/^```(?:json)?\s*/i, "").replace(/\s*```$/, "");
91947
91962
  try {
91948
91963
  return JSON.parse(trimmed2);
91949
91964
  } catch {
@@ -91971,7 +91986,7 @@ async function fetchPost(url4, body6, headers, signal) {
91971
91986
  function socketPost(socketPath2) {
91972
91987
  return (url4, body6, headers, signal) => new Promise((resolve7, reject3) => {
91973
91988
  const req = httpRequest({ socketPath: socketPath2, path: new URL(url4).pathname, method: "POST", headers: { ...headers, host: "relay", "content-length": Buffer.byteLength(body6) }, signal }, (res) => {
91974
- let text24 = "", bytes2 = 0;
91989
+ let text25 = "", bytes2 = 0;
91975
91990
  res.setEncoding("utf8");
91976
91991
  res.on("data", (chunk) => {
91977
91992
  bytes2 += Buffer.byteLength(chunk);
@@ -91982,9 +91997,9 @@ function socketPost(socketPath2) {
91982
91997
  res.destroy();
91983
91998
  return;
91984
91999
  }
91985
- text24 += chunk;
92000
+ text25 += chunk;
91986
92001
  });
91987
- res.on("end", () => resolve7({ status: res.statusCode ?? 0, headers: Object.fromEntries(Object.entries(res.headers).map(([k, v]) => [k, String(v)])), text: text24 }));
92002
+ res.on("end", () => resolve7({ status: res.statusCode ?? 0, headers: Object.fromEntries(Object.entries(res.headers).map(([k, v]) => [k, String(v)])), text: text25 }));
91988
92003
  res.on("error", reject3);
91989
92004
  });
91990
92005
  req.on("error", reject3);
@@ -92152,7 +92167,7 @@ async function simulate(model, request4, signal) {
92152
92167
  const recorded2 = (request4.tool?.recorded ?? []).map((o) => ({ args: o.args, at: o.at, ...o.error !== void 0 ? { error: o.error } : { result: o.result } }));
92153
92168
  const results = recorded2.filter((o) => "result" in o).map((o) => o.result);
92154
92169
  const known2 = results.length ? results : (request4.tool?.examples ?? []).filter((o) => o.error === void 0 && o.result !== void 0).map((o) => o.result);
92155
- const text24 = known2.length > 0 && known2.every((r2) => typeof r2 === "string");
92170
+ const text25 = known2.length > 0 && known2.every((r2) => typeof r2 === "string");
92156
92171
  const aware = request4.tool?.schema !== void 0;
92157
92172
  const errors2 = [...recorded2, ...request4.tool?.examples ?? []].flatMap((o) => "error" in o && o.error !== void 0 ? [o.error] : []).map((error64, i) => ({ ref: `error-${i}`, error: error64 }));
92158
92173
  const outputSchema = aware ? { name: "tool_answer", schema: {
@@ -92203,13 +92218,13 @@ ${feedback}` : user8, schema: outputSchema, temperature: 0, maxTokens: 1200 }, s
92203
92218
  try {
92204
92219
  result = JSON.parse(String(out?.result_json));
92205
92220
  } catch {
92206
- if (!text24 || typeof out?.result_json !== "string") {
92221
+ if (!text25 || typeof out?.result_json !== "string") {
92207
92222
  feedback = "Your result_json was not valid JSON. Answer again.";
92208
92223
  continue;
92209
92224
  }
92210
92225
  result = out.result_json;
92211
92226
  }
92212
- if (text24 && typeof result !== "string" && typeof out?.result_json === "string") result = out.result_json;
92227
+ if (text25 && typeof result !== "string" && typeof out?.result_json === "string") result = out.result_json;
92213
92228
  if (sameShape(result, known2)) return { result, inputTokens, outputTokens, costUsd, model: model_ };
92214
92229
  feedback = `Your result has the shape ${shape(result)}, but production's results have the shape ${shape(known2[0])}. Answer again in that shape.`;
92215
92230
  }
@@ -92418,8 +92433,8 @@ function recordsMentioning(ctx, name5, args) {
92418
92433
  const records3 = [];
92419
92434
  const add = (tool, o, here) => {
92420
92435
  const answer = o.error !== void 0 ? { error: o.error } : { result: o.result };
92421
- const text24 = JSON.stringify([o.args, answer]);
92422
- if (ids2.some((id14) => id14.test(text24))) records3.push({ tool, args: o.args ?? {}, ...answer, conversation: here ? "this one" : o.trace ?? "another" });
92436
+ const text25 = JSON.stringify([o.args, answer]);
92437
+ if (ids2.some((id14) => id14.test(text25))) records3.push({ tool, args: o.args ?? {}, ...answer, conversation: here ? "this one" : o.trace ?? "another" });
92423
92438
  };
92424
92439
  const others = Object.entries(ctx.scene.tools ?? {}).filter(([tool]) => tool !== name5);
92425
92440
  for (const [tool] of others) for (const o of recorded(ctx, tool)) add(tool, o, true);
@@ -93150,7 +93165,7 @@ function findIncident(ctx, id14) {
93150
93165
 
93151
93166
  // packages/server/src/world/words.ts
93152
93167
  var list = (items, word) => items.length <= 1 ? items.join("") : `${items.slice(0, -1).join(", ")} ${word} ${items.at(-1)}`;
93153
- var quoted = (text24) => `"${text24.length > 60 ? `${text24.slice(0, 59)}\u2026` : text24}"`;
93168
+ var quoted = (text25) => `"${text25.length > 60 ? `${text25.slice(0, 59)}\u2026` : text25}"`;
93154
93169
  function incident2(selector2) {
93155
93170
  if ("ref" in selector2) return `incident ${selector2.ref}`;
93156
93171
  return `the first incident on ${selector2.service}${selector2.after_start ? " created after the world started" : ""}`;
@@ -93310,8 +93325,8 @@ function inspectPredicate(env, predicate, atMs) {
93310
93325
  const files2 = filesAt(ctx, Number(id14), revision);
93311
93326
  if (!Object.hasOwn(files2, path4)) return outcome3(false, `file ${path4} missing at ${revision}`);
93312
93327
  const content2 = files2[path4];
93313
- const text24 = content2.toString("utf8");
93314
- return outcome3("contains" in predicate ? text24.includes(predicate.contains) : text24 === predicate.equals, text24, `file ${path4} at ${revision}: ${text24}`);
93328
+ const text25 = content2.toString("utf8");
93329
+ return outcome3("contains" in predicate ? text25.includes(predicate.contains) : text25 === predicate.equals, text25, `file ${path4} at ${revision}: ${text25}`);
93315
93330
  } catch (error64) {
93316
93331
  if (!(error64 instanceof GitObjectError)) throw error64;
93317
93332
  return outcome3(false, `revision or production content unavailable in ${tuple3[0]} at ${tuple3[1]}`);
@@ -93829,8 +93844,8 @@ function takeNewMessages(env) {
93829
93844
  function skipSeedHistory(env) {
93830
93845
  takeNewMessages(env);
93831
93846
  }
93832
- var slackMentions = (text24) => new Set([...text24.matchAll(/<@([A-Z0-9]+)(?:\|[^>]*)?>/g)].map((match3) => match3[1]));
93833
- var githubMentions = (text24) => new Set([...text24.matchAll(/(?:^|[^\w`])@([A-Za-z0-9](?:[A-Za-z0-9-]{0,38}))/g)].map((match3) => match3[1].toLowerCase()));
93847
+ var slackMentions = (text25) => new Set([...text25.matchAll(/<@([A-Z0-9]+)(?:\|[^>]*)?>/g)].map((match3) => match3[1]));
93848
+ var githubMentions = (text25) => new Set([...text25.matchAll(/(?:^|[^\w`])@([A-Za-z0-9](?:[A-Za-z0-9-]{0,38}))/g)].map((match3) => match3[1].toLowerCase()));
93834
93849
  function slackThreadParticipants(env, channel3, root3, beforeTs) {
93835
93850
  return new Set(env.store.db.prepare("SELECT user_id FROM slack_messages WHERE channel_id = ? AND (ts = ? OR thread_ts = ?) AND ts < ?").all(channel3, root3, root3, beforeTs).map((row2) => row2.user_id));
93836
93851
  }
@@ -93883,8 +93898,8 @@ function authorOf(message8, people3, bot) {
93883
93898
  var FIELDS = ["to", "in", "in_thread_of", "from", "text_contains", "fact", "top_level", "dm"];
93884
93899
  var hasTable4 = (env, name5) => env.store.db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(name5) !== void 0;
93885
93900
  var startMs2 = (env) => env.clock.startTime.getTime();
93886
- var excerpt = (text24) => {
93887
- const flat2 = text24.replace(/\s+/g, " ").trim();
93901
+ var excerpt = (text25) => {
93902
+ const flat2 = text25.replace(/\s+/g, " ").trim();
93888
93903
  return flat2.length > 80 ? `${flat2.slice(0, 77)}\u2026` : flat2;
93889
93904
  };
93890
93905
  var plural2 = (n2, word) => `${n2} ${word}${n2 === 1 ? "" : "s"}`;
@@ -93955,8 +93970,8 @@ function fieldTest(env, match3, field5) {
93955
93970
  return (message8) => message8.tool === "slack" ? accounts2.slack !== void 0 && message8.authorId === accounts2.slack : accounts2.github !== void 0 && message8.authorId === accounts2.github.id;
93956
93971
  }
93957
93972
  case "text_contains": {
93958
- const wanted = (Array.isArray(match3.text_contains) ? match3.text_contains : [match3.text_contains]).map((text24) => text24.toLowerCase());
93959
- return (message8) => wanted.every((text24) => message8.text.toLowerCase().includes(text24));
93973
+ const wanted = (Array.isArray(match3.text_contains) ? match3.text_contains : [match3.text_contains]).map((text25) => text25.toLowerCase());
93974
+ return (message8) => wanted.every((text25) => message8.text.toLowerCase().includes(text25));
93960
93975
  }
93961
93976
  case "top_level":
93962
93977
  return (message8) => message8.slack !== void 0 && message8.slack.topLevel;
@@ -93981,7 +93996,7 @@ function describeMatch(match3) {
93981
93996
  ...match3.in !== void 0 ? [`in ${match3.in}`] : [],
93982
93997
  ...match3.in_thread_of !== void 0 ? [`in the thread of ${match3.in_thread_of}`] : [],
93983
93998
  ...match3.from !== void 0 ? [`from ${match3.from}`] : [],
93984
- ...texts4.length ? [`containing ${texts4.map((text24) => `"${text24}"`).join(" and ")}`] : [],
93999
+ ...texts4.length ? [`containing ${texts4.map((text25) => `"${text25}"`).join(" and ")}`] : [],
93985
94000
  ...match3.fact !== void 0 ? [`telling ${match3.fact}`] : [],
93986
94001
  ...match3.top_level ? ["at the top level"] : [],
93987
94002
  ...match3.dm ? ["in a direct message"] : []
@@ -94189,17 +94204,17 @@ function graphqlMutation(entry2, field5, requireSuccess = false) {
94189
94204
  function glob(pattern, caseInsensitive) {
94190
94205
  const fold2 = (s2) => caseInsensitive ? s2.toLowerCase() : s2;
94191
94206
  const pieces = fold2(pattern).split("*");
94192
- if (pieces.length === 1) return (text24) => fold2(text24) === pieces[0];
94207
+ if (pieces.length === 1) return (text25) => fold2(text25) === pieces[0];
94193
94208
  const first = pieces[0];
94194
94209
  const last = pieces.at(-1);
94195
94210
  const middle = pieces.slice(1, -1).filter((p2) => p2 !== "");
94196
94211
  return (raw3) => {
94197
- const text24 = fold2(raw3);
94198
- if (text24.length < first.length + last.length || !text24.startsWith(first) || !text24.endsWith(last)) return false;
94199
- const end = text24.length - last.length;
94212
+ const text25 = fold2(raw3);
94213
+ if (text25.length < first.length + last.length || !text25.startsWith(first) || !text25.endsWith(last)) return false;
94214
+ const end = text25.length - last.length;
94200
94215
  let pos = first.length;
94201
94216
  for (const piece2 of middle) {
94202
- const at3 = text24.indexOf(piece2, pos);
94217
+ const at3 = text25.indexOf(piece2, pos);
94203
94218
  if (at3 === -1 || at3 + piece2.length > end) return false;
94204
94219
  pos = at3 + piece2.length;
94205
94220
  }
@@ -94488,11 +94503,11 @@ function evaluateAnswer(check3, trace) {
94488
94503
  explanation: `The agent gave ${answer ? "an empty" : "no"} final answer. An agent answers with a POST to ANCHA_DONE_URL, body {"output": <its answer>}, or by printing it on stdout.`
94489
94504
  };
94490
94505
  }
94491
- const text24 = comparableText(answer.text, sensitive);
94506
+ const text25 = comparableText(answer.text, sensitive);
94492
94507
  const stated = readNumbers(answer.text);
94493
- const missing7 = contains3.filter((piece2) => !text24.includes(comparableText(piece2, sensitive)));
94508
+ const missing7 = contains3.filter((piece2) => !text25.includes(comparableText(piece2, sensitive)));
94494
94509
  const unstated = numbers2.filter((n2) => !stated.some((number7) => numberMatches(number7, n2.value, n2.tolerance)));
94495
- const present2 = absent.filter((piece2) => text24.includes(comparableText(piece2, sensitive)));
94510
+ const present2 = absent.filter((piece2) => text25.includes(comparableText(piece2, sensitive)));
94496
94511
  const line2 = answer.text.replace(/\s+/g, " ").trim();
94497
94512
  const actual = `"${line2.length > ANSWER_QUOTE ? `${line2.slice(0, ANSWER_QUOTE - 1)}\u2026` : line2}"`;
94498
94513
  if (!missing7.length && !unstated.length && !present2.length) {
@@ -95100,9 +95115,9 @@ function formatPatch(patch, headerOptions) {
95100
95115
  }
95101
95116
  return ret.join("\n") + "\n";
95102
95117
  }
95103
- function splitLines(text24) {
95104
- const hasTrailingNl = text24.endsWith("\n");
95105
- const result = text24.split("\n").map((line2) => line2 + "\n");
95118
+ function splitLines(text25) {
95119
+ const hasTrailingNl = text25.endsWith("\n");
95120
+ const result = text25.split("\n").map((line2) => line2 + "\n");
95106
95121
  if (hasTrailingNl) {
95107
95122
  result.pop();
95108
95123
  } else {
@@ -95221,11 +95236,11 @@ function resolveRef2(ctx, repoId, ref22) {
95221
95236
  return resolveCommit(ctx, repoId, /^[a-f0-9]{40}$/.test(ref22) || ref22.startsWith("refs/") ? ref22 : `refs/heads/${ref22}`);
95222
95237
  }
95223
95238
  function jsonBody(c, parsing = {}) {
95224
- const text24 = requestBodies.get(c.req.raw);
95225
- if (text24 === void 0) throw new Error("GitHub body must be read before the synchronous route boundary");
95239
+ const text25 = requestBodies.get(c.req.raw);
95240
+ if (text25 === void 0) throw new Error("GitHub body must be read before the synchronous route boundary");
95226
95241
  c.env.ctx.signal?.throwIfAborted();
95227
95242
  try {
95228
- return parsing.allowEmpty && text24.length === 0 ? {} : JSON.parse(text24);
95243
+ return parsing.allowEmpty && text25.length === 0 ? {} : JSON.parse(text25);
95229
95244
  } catch (error64) {
95230
95245
  if (error64 instanceof SyntaxError) throw new GitHubError(400, "Problems parsing JSON");
95231
95246
  throw error64;
@@ -95504,7 +95519,7 @@ function files(ctx, repoId, commit) {
95504
95519
  visit4(getCommit(ctx, repoId, commit).tree, "");
95505
95520
  return out;
95506
95521
  }
95507
- function text12(bytes2) {
95522
+ function text13(bytes2) {
95508
95523
  if (bytes2.includes(0)) return void 0;
95509
95524
  try {
95510
95525
  return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes2);
@@ -95517,7 +95532,7 @@ function diffFiles(ctx, repoId, base4, head) {
95517
95532
  return [.../* @__PURE__ */ new Set([...before.keys(), ...after.keys()])].sort((a, b) => Buffer.compare(Buffer.from(a), Buffer.from(b))).flatMap((filename) => {
95518
95533
  const old = before.get(filename), next2 = after.get(filename);
95519
95534
  if (old && next2 && old.sha === next2.sha && old.mode === next2.mode) return [];
95520
- const from = text12(old?.bytes ?? Buffer.alloc(0)), to = text12(next2?.bytes ?? Buffer.alloc(0));
95535
+ const from = text13(old?.bytes ?? Buffer.alloc(0)), to = text13(next2?.bytes ?? Buffer.alloc(0));
95521
95536
  let additions = 0, deletions = 0, patch;
95522
95537
  if (from !== void 0 && to !== void 0) {
95523
95538
  for (const change3 of diffLines(from, to)) {
@@ -97362,16 +97377,16 @@ async function readArgs(req) {
97362
97377
  for (const [key4, value4] of form2) entries3.set(key4, value4);
97363
97378
  return Object.fromEntries(entries3);
97364
97379
  }
97365
- const text24 = await req.text();
97366
- if (text24 === "") return Object.fromEntries(entries3);
97380
+ const text25 = await req.text();
97381
+ if (text25 === "") return Object.fromEntries(entries3);
97367
97382
  switch (type) {
97368
97383
  case "application/x-www-form-urlencoded":
97369
- for (const [key4, value4] of new URLSearchParams(text24)) entries3.set(key4, value4);
97384
+ for (const [key4, value4] of new URLSearchParams(text25)) entries3.set(key4, value4);
97370
97385
  break;
97371
97386
  case "application/json": {
97372
97387
  let parsed3;
97373
97388
  try {
97374
- parsed3 = JSON.parse(text24);
97389
+ parsed3 = JSON.parse(text25);
97375
97390
  } catch {
97376
97391
  throw new SlackError("invalid_json");
97377
97392
  }
@@ -97492,16 +97507,16 @@ function limitArg(v) {
97492
97507
  }
97493
97508
  var MICROS_PER_SECOND2 = 1000000n;
97494
97509
  function parseTs(v) {
97495
- const text24 = typeof v === "number" ? String(v) : v;
97496
- if (typeof text24 !== "string") return void 0;
97497
- const m = /^(\d+)(?:\.(\d*))?$/.exec(text24.trim());
97510
+ const text25 = typeof v === "number" ? String(v) : v;
97511
+ if (typeof text25 !== "string") return void 0;
97512
+ const m = /^(\d+)(?:\.(\d*))?$/.exec(text25.trim());
97498
97513
  if (!m) return void 0;
97499
97514
  return BigInt(m[1]) * MICROS_PER_SECOND2 + BigInt((m[2] ?? "").padEnd(6, "0").slice(0, 6));
97500
97515
  }
97501
97516
  function tsBoundArg(v, errorCode) {
97502
- const text24 = stringArg(v);
97503
- if (text24 === void 0) return void 0;
97504
- const micros2 = parseTs(text24);
97517
+ const text25 = stringArg(v);
97518
+ if (text25 === void 0) return void 0;
97519
+ const micros2 = parseTs(text25);
97505
97520
  if (micros2 === void 0) throw new SlackError(errorCode);
97506
97521
  return micros2;
97507
97522
  }
@@ -97818,8 +97833,8 @@ function emit(ctx, event3, id14, apiLinks) {
97818
97833
  is_ext_shared_channel: false
97819
97834
  } });
97820
97835
  }
97821
- function interpolateMentions(ctx, text24) {
97822
- return text24.replace(/<\$user\.([A-Za-z0-9_]+)>/g, (_token, ref22) => `<@${ctx.refs.resolve(`$${ref22}`, "user")}>`);
97836
+ function interpolateMentions(ctx, text25) {
97837
+ return text25.replace(/<\$user\.([A-Za-z0-9_]+)>/g, (_token, ref22) => `<@${ctx.refs.resolve(`$${ref22}`, "user")}>`);
97823
97838
  }
97824
97839
  function emitMessage(ctx, message8, apiLinks) {
97825
97840
  const id14 = identity2(ctx);
@@ -97887,12 +97902,12 @@ function seedApp(ctx, service) {
97887
97902
  ctx.store.db.prepare("INSERT INTO slack_apps VALUES (?, ?, ?, ?, ?)").run(service, app2, user8, bot, name5);
97888
97903
  return { service, app_id: app2, user_id: user8, bot_id: bot, name: name5 };
97889
97904
  }
97890
- function appMessage(ctx, service, channel3, text24, blocks3, ts2, apiLinks) {
97905
+ function appMessage(ctx, service, channel3, text25, blocks3, ts2, apiLinks) {
97891
97906
  const app2 = ctx.store.db.prepare("SELECT * FROM slack_apps WHERE service = ?").get(service);
97892
97907
  const target5 = ctx.store.db.prepare("SELECT is_archived FROM slack_channels WHERE id = ?").get(channel3);
97893
97908
  if (!app2 || !target5 || target5.is_archived) throw new Error("Integration Slack app/channel unavailable");
97894
97909
  if (ts2 === void 0) {
97895
- const message9 = insertMessage(ctx, { channelId: channel3, userId: app2.user_id, botId: app2.bot_id, text: text24, blocks: blocks3, threadTs: null });
97910
+ const message9 = insertMessage(ctx, { channelId: channel3, userId: app2.user_id, botId: app2.bot_id, text: text25, blocks: blocks3, threadTs: null });
97896
97911
  persistMessageLinks(ctx, message9, apiLinks);
97897
97912
  emitMessage(ctx, message9, apiLinks?.map((link6) => ({ ...link6, pointer: `/event${link6.pointer}` })));
97898
97913
  return message9;
@@ -97900,7 +97915,7 @@ function appMessage(ctx, service, channel3, text24, blocks3, ts2, apiLinks) {
97900
97915
  const previous = getMessage(ctx, channel3, ts2);
97901
97916
  if (!previous || previous.user_id !== app2.user_id) throw new Error("Integration Slack message unavailable");
97902
97917
  const previousLinks = messageLinks(ctx, previous);
97903
- ctx.store.db.prepare("UPDATE slack_messages SET text = ?, blocks = ?, edited_ts = ? WHERE channel_id = ? AND ts = ?").run(text24, JSON.stringify(blocks3), (ctx.clock.nowMs() / 1e3).toFixed(6), channel3, ts2);
97918
+ ctx.store.db.prepare("UPDATE slack_messages SET text = ?, blocks = ?, edited_ts = ? WHERE channel_id = ? AND ts = ?").run(text25, JSON.stringify(blocks3), (ctx.clock.nowMs() / 1e3).toFixed(6), channel3, ts2);
97904
97919
  const message8 = getMessage(ctx, channel3, ts2);
97905
97920
  persistMessageLinks(ctx, message8, apiLinks);
97906
97921
  emitMessageChanged(ctx, message8, previous, [
@@ -97940,8 +97955,8 @@ function notificationHandles(message8, declared) {
97940
97955
  }
97941
97956
  return matches9;
97942
97957
  }
97943
- function blocks(text24, path4) {
97944
- return [{ type: "section", text: { type: "plain_text", text: text24 } }, { type: "actions", elements: [{ type: "button", text: { type: "plain_text", text: "View details" }, url: path4, action_id: "view_details" }] }];
97958
+ function blocks(text25, path4) {
97959
+ return [{ type: "section", text: { type: "plain_text", text: text25 } }, { type: "actions", elements: [{ type: "button", text: { type: "plain_text", text: "View details" }, url: path4, action_id: "view_details" }] }];
97945
97960
  }
97946
97961
  var pointer = "/blocks/1/elements/0/url";
97947
97962
  function initializeIntegrations(env) {
@@ -97975,9 +97990,9 @@ function initializeIntegrations(env) {
97975
97990
  if (bindings2.length) reconcileMilestones(env);
97976
97991
  for (const binding2 of bindings2) {
97977
97992
  const mapped = ctx.store.db.prepare("SELECT ts FROM world_incident_messages WHERE binding = ? AND incident_id = ?").get(binding2.ordinal, row2.id);
97978
- const text24 = `PagerDuty #${row2.incident_number}: ${row2.title} \u2014 ${row2.status}`;
97993
+ const text25 = `PagerDuty #${row2.incident_number}: ${row2.title} \u2014 ${row2.status}`;
97979
97994
  const path4 = `/incidents/${row2.id}`;
97980
- const message8 = appMessage(env.ctxFor("slack"), "pagerduty", binding2.channel_id, text24, blocks(text24, path4), mapped?.ts, [{ pointer, path: path4, service: "pagerduty" }]);
97995
+ const message8 = appMessage(env.ctxFor("slack"), "pagerduty", binding2.channel_id, text25, blocks(text25, path4), mapped?.ts, [{ pointer, path: path4, service: "pagerduty" }]);
97981
97996
  if (!mapped) ctx.store.db.prepare("INSERT INTO world_incident_messages VALUES (?, ?, ?, ?)").run(binding2.ordinal, row2.id, binding2.channel_id, message8.ts);
97982
97997
  ctx.trace.record({
97983
97998
  source: "world",
@@ -97985,7 +98000,7 @@ function initializeIntegrations(env) {
97985
98000
  method: "ACTION",
97986
98001
  path: mapped ? "slack.chat.update" : "slack.chat.postMessage",
97987
98002
  request: { source: { service: "pagerduty", incident_id: row2.id, event_id: JSON.parse(event3.body).event.id }, target: { channel: binding2.channel_id, ts: message8.ts } },
97988
- response: { text: text24, blocks: JSON.parse(message8.blocks) }
98003
+ response: { text: text25, blocks: JSON.parse(message8.blocks) }
97989
98004
  });
97990
98005
  }
97991
98006
  });
@@ -98033,16 +98048,16 @@ function initializeIntegrations(env) {
98033
98048
  response: { ...response5, source: { monitor_id: monitor3.id, event_id: native2.id, cycle_key: notification.cycleKey }, target: target5 }
98034
98049
  });
98035
98050
  } else {
98036
- const text24 = `${native2.title}
98051
+ const text25 = `${native2.title}
98037
98052
  ${native2.text}`, path4 = `/api/v1/monitor/${monitor3.id}`;
98038
- const message8 = appMessage(env.ctxFor("slack"), "datadog", binding2.channel_id, text24, blocks(text24, path4), void 0, [{ pointer, path: path4, service: "datadog" }]);
98053
+ const message8 = appMessage(env.ctxFor("slack"), "datadog", binding2.channel_id, text25, blocks(text25, path4), void 0, [{ pointer, path: path4, service: "datadog" }]);
98039
98054
  ctx.trace.record({
98040
98055
  source: "world",
98041
98056
  service: "slack",
98042
98057
  method: "ACTION",
98043
98058
  path: "slack.chat.postMessage",
98044
98059
  request: { source: { service: "datadog", monitor_id: monitor3.id, event_id: native2.id, cycle_key: notification.cycleKey }, target: { channel: binding2.channel_id, ts: message8.ts } },
98045
- response: { text: text24, blocks: JSON.parse(message8.blocks) }
98060
+ response: { text: text25, blocks: JSON.parse(message8.blocks) }
98046
98061
  });
98047
98062
  }
98048
98063
  }
@@ -98123,11 +98138,11 @@ function requireComment(ctx, repoId, id14) {
98123
98138
  if (!row2) throw new GitHubError(404, "Not Found");
98124
98139
  return row2;
98125
98140
  }
98126
- function insertComment(ctx, issue8, userId2, text24) {
98141
+ function insertComment(ctx, issue8, userId2, text25) {
98127
98142
  ctx.signal?.throwIfAborted();
98128
98143
  return withMutation(ctx, () => {
98129
98144
  const id14 = resourceId(ctx), at3 = ctx.clock.now().toISOString();
98130
- ctx.store.db.prepare("INSERT INTO github_comments (id,repo_id,issue_number,user_id,body,created_at,updated_at) VALUES (?,?,?,?,?,?,?)").run(id14, issue8.repo_id, issue8.number, userId2, text24, at3, at3);
98145
+ ctx.store.db.prepare("INSERT INTO github_comments (id,repo_id,issue_number,user_id,body,created_at,updated_at) VALUES (?,?,?,?,?,?,?)").run(id14, issue8.repo_id, issue8.number, userId2, text25, at3, at3);
98131
98146
  ctx.store.db.prepare("UPDATE github_issues SET updated_at = ? WHERE id = ?").run(at3, issue8.id);
98132
98147
  const row2 = requireComment(ctx, issue8.repo_id, id14);
98133
98148
  commentEvent(ctx, getRepo(ctx, issue8.repo_id), row2, "created", userId2);
@@ -98173,9 +98188,9 @@ var issueRoutes = [
98173
98188
  } },
98174
98189
  { method: "POST", path: "/repos/:owner/:repo/issues", coverage, handler: (c) => {
98175
98190
  query(c, []);
98176
- const ctx = c.env.ctx, repo4 = repository(c), input5 = body3(c, ["title", "body", "labels"]), title2 = string4(input5.title, "title"), text24 = input5.body === void 0 ? "" : string4(input5.body, "body", true);
98191
+ const ctx = c.env.ctx, repo4 = repository(c), input5 = body3(c, ["title", "body", "labels"]), title2 = string4(input5.title, "title"), text25 = input5.body === void 0 ? "" : string4(input5.body, "body", true);
98177
98192
  const labels2 = input5.labels === void 0 ? [] : labelNames(ctx, repo4, input5.labels, ["id", "name", "description", "color"]);
98178
- return json2(issueShape(ctx, repo4, createIssue(ctx, repo4, { title: title2, body: text24, labels: labels2 })), 201);
98193
+ return json2(issueShape(ctx, repo4, createIssue(ctx, repo4, { title: title2, body: text25, labels: labels2 })), 201);
98179
98194
  } },
98180
98195
  { method: "GET", path: "/repos/:owner/:repo/issues/comments", coverage, handler: (c) => {
98181
98196
  query(c, ["sort", "direction", "since", "page", "per_page"]);
@@ -98186,15 +98201,15 @@ var issueRoutes = [
98186
98201
  query(c, []);
98187
98202
  const ctx = c.env.ctx, repo4 = repository(c), id14 = resourceNumber(c, "id");
98188
98203
  const input5 = method2 === "PATCH" ? body3(c, ["body"]) : void 0;
98189
- const text24 = input5 ? string4(input5.body, "body") : void 0;
98204
+ const text25 = input5 ? string4(input5.body, "body") : void 0;
98190
98205
  ctx.signal?.throwIfAborted();
98191
98206
  return withMutation(ctx, () => {
98192
98207
  const row2 = requireComment(ctx, repo4.id, id14);
98193
- if (method2 === "GET" || method2 === "PATCH" && text24 === row2.body) return commentShape(ctx, repo4, row2);
98208
+ if (method2 === "GET" || method2 === "PATCH" && text25 === row2.body) return commentShape(ctx, repo4, row2);
98194
98209
  if (method2 === "DELETE") ctx.store.db.prepare("DELETE FROM github_comments WHERE repo_id = ? AND id = ?").run(repo4.id, id14);
98195
- else ctx.store.db.prepare("UPDATE github_comments SET body = ?, updated_at = ? WHERE repo_id = ? AND id = ?").run(text24, ctx.clock.now().toISOString(), repo4.id, id14);
98210
+ else ctx.store.db.prepare("UPDATE github_comments SET body = ?, updated_at = ? WHERE repo_id = ? AND id = ?").run(text25, ctx.clock.now().toISOString(), repo4.id, id14);
98196
98211
  ctx.store.db.prepare("UPDATE github_issues SET updated_at = ? WHERE repo_id = ? AND number = ?").run(ctx.clock.now().toISOString(), repo4.id, row2.issue_number);
98197
- if (method2 === "DELETE" || text24 !== row2.body) commentEvent(ctx, repo4, method2 === "DELETE" ? row2 : requireComment(ctx, repo4.id, id14), method2 === "DELETE" ? "deleted" : "edited", void 0, method2 === "PATCH" ? row2.body : void 0);
98212
+ if (method2 === "DELETE" || text25 !== row2.body) commentEvent(ctx, repo4, method2 === "DELETE" ? row2 : requireComment(ctx, repo4.id, id14), method2 === "DELETE" ? "deleted" : "edited", void 0, method2 === "PATCH" ? row2.body : void 0);
98198
98213
  return method2 === "DELETE" ? new Response(null, { status: 204 }) : commentShape(ctx, repo4, requireComment(ctx, repo4.id, id14));
98199
98214
  });
98200
98215
  } })),
@@ -98241,9 +98256,9 @@ var issueRoutes = [
98241
98256
  } },
98242
98257
  { method: "POST", path: "/repos/:owner/:repo/issues/:number/comments", coverage, handler: (c) => {
98243
98258
  query(c, []);
98244
- const ctx = c.env.ctx, repo4 = repository(c), number7 = resourceNumber(c), input5 = body3(c, ["body"]), text24 = string4(input5.body, "body");
98259
+ const ctx = c.env.ctx, repo4 = repository(c), number7 = resourceNumber(c), input5 = body3(c, ["body"]), text25 = string4(input5.body, "body");
98245
98260
  ctx.signal?.throwIfAborted();
98246
- return withMutation(ctx, () => json2(commentShape(ctx, repo4, insertComment(ctx, requireIssue(ctx, repo4.id, number7), botUser(ctx).id, text24)), 201));
98261
+ return withMutation(ctx, () => json2(commentShape(ctx, repo4, insertComment(ctx, requireIssue(ctx, repo4.id, number7), botUser(ctx).id, text25)), 201));
98247
98262
  } }
98248
98263
  ];
98249
98264
 
@@ -98930,11 +98945,11 @@ function hubspotTwin() {
98930
98945
  try {
98931
98946
  let body6;
98932
98947
  if (!["GET", "HEAD"].includes(c.req.method)) {
98933
- const text24 = await c.req.text();
98934
- if (text24.length > 1e6) throw new HubError(413, "VALIDATION_ERROR", "Body exceeds 1 MB.");
98935
- if (text24) {
98948
+ const text25 = await c.req.text();
98949
+ if (text25.length > 1e6) throw new HubError(413, "VALIDATION_ERROR", "Body exceeds 1 MB.");
98950
+ if (text25) {
98936
98951
  try {
98937
- body6 = JSON.parse(text24);
98952
+ body6 = JSON.parse(text25);
98938
98953
  } catch {
98939
98954
  throw new HubError(400, "VALIDATION_ERROR", "Malformed JSON.");
98940
98955
  }
@@ -98977,11 +98992,11 @@ var renderGitHubDeployDatadog = (config11, event3, ctx) => {
98977
98992
  };
98978
98993
 
98979
98994
  // packages/server/src/world/catalog/github-slack.ts
98980
- var link2 = (url4, text24) => url4 ? `<${url4}|${text24}>` : text24;
98995
+ var link2 = (url4, text25) => url4 ? `<${url4}|${text25}>` : text25;
98981
98996
  var who = (user8) => link2(user8?.html_url, user8?.login ?? "someone");
98982
- var escape2 = (text24) => text24.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
98983
- var excerpt2 = (text24) => {
98984
- const flat2 = (text24 ?? "").replace(/\s+/g, " ").trim();
98997
+ var escape2 = (text25) => text25.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
98998
+ var excerpt2 = (text25) => {
98999
+ const flat2 = (text25 ?? "").replace(/\s+/g, " ").trim();
98985
99000
  return flat2 ? `
98986
99001
  ${escape2(flat2.length > 160 ? `${flat2.slice(0, 157)}...` : flat2)}` : "";
98987
99002
  };
@@ -99011,20 +99026,20 @@ var renderGitHubSlack = (config11, event3, ctx) => {
99011
99026
  } else return [];
99012
99027
  if (!config11.events.includes(key4)) return [];
99013
99028
  const title2 = link2(item2.html_url, `#${item2.number} ${escape2(item2.title ?? "")}`);
99014
- const text24 = `${heading}
99029
+ const text25 = `${heading}
99015
99030
  ${title2}${excerpt2(body6)}`;
99016
99031
  const footer = link2(repository3?.html_url, repository3?.full_name ?? "");
99017
99032
  return [{
99018
99033
  action: "slack.post",
99019
99034
  as: config11.app,
99020
99035
  channel: config11.channel,
99021
- text: text24,
99022
- blocks: [{ type: "section", text: { type: "mrkdwn", text: text24 } }, { type: "context", elements: [{ type: "mrkdwn", text: footer }] }]
99036
+ text: text25,
99037
+ blocks: [{ type: "section", text: { type: "mrkdwn", text: text25 } }, { type: "context", elements: [{ type: "mrkdwn", text: footer }] }]
99023
99038
  }];
99024
99039
  };
99025
99040
 
99026
99041
  // packages/server/src/world/catalog/hubspot-deal-slack.ts
99027
- var escape3 = (text24) => text24.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
99042
+ var escape3 = (text25) => text25.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
99028
99043
  var money8 = (amount3) => typeof amount3 === "string" && amount3 !== "" && Number.isFinite(Number(amount3)) ? `$${Number(amount3).toLocaleString("en-US")}` : void 0;
99029
99044
  var renderHubSpotDealSlack = (config11, event3, ctx) => {
99030
99045
  if (event3.type !== "deal.propertyChange") return [];
@@ -99035,9 +99050,9 @@ var renderHubSpotDealSlack = (config11, event3, ctx) => {
99035
99050
  const deal = ctx.record?.("hubspot", "deal", String(item2.objectId));
99036
99051
  const name5 = escape3(deal?.name ?? `Deal ${item2.objectId}`), stage = escape3(deal?.stageLabels?.[item2.propertyValue] ?? item2.propertyValue);
99037
99052
  const details = [money8(deal?.amount), deal?.pipelineLabel ? `Pipeline: ${escape3(deal.pipelineLabel)}` : void 0].filter(Boolean).join(" \xB7 ");
99038
- const text24 = `*Deal stage changed:* ${deal?.url ? `<${deal.url}|${name5}>` : name5} moved to *${stage}*${details ? `
99053
+ const text25 = `*Deal stage changed:* ${deal?.url ? `<${deal.url}|${name5}>` : name5} moved to *${stage}*${details ? `
99039
99054
  ${details}` : ""}`;
99040
- return [{ action: "slack.post", as: config11.app, channel: config11.channel, text: text24, blocks: [{ type: "section", text: { type: "mrkdwn", text: text24 } }] }];
99055
+ return [{ action: "slack.post", as: config11.app, channel: config11.channel, text: text25, blocks: [{ type: "section", text: { type: "mrkdwn", text: text25 } }] }];
99041
99056
  });
99042
99057
  };
99043
99058
 
@@ -99061,7 +99076,7 @@ var renderMonitorGitHubIssue = (config11, event3, ctx) => {
99061
99076
  };
99062
99077
 
99063
99078
  // packages/server/src/world/catalog/pagerduty-slack.ts
99064
- var escape4 = (text24) => text24.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
99079
+ var escape4 = (text25) => text25.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
99065
99080
  var names = (people3) => (people3 ?? []).map((person4) => escape4(person4.summary ?? "someone")).join(", ");
99066
99081
  var renderPagerDutySlack = (config11, event3, ctx) => {
99067
99082
  const envelope = event3.payload.event;
@@ -99072,13 +99087,13 @@ var renderPagerDutySlack = (config11, event3, ctx) => {
99072
99087
  if (type === "incident.triggered") {
99073
99088
  const title2 = `<${incident6.html_url}|#${incident6.number} ${escape4(incident6.title ?? "")}>`;
99074
99089
  const assigned = names(incident6.assignees);
99075
- const text25 = `*Triggered:* ${title2}
99090
+ const text26 = `*Triggered:* ${title2}
99076
99091
  Service: ${escape4(incident6.service?.summary ?? "")}${assigned ? ` \xB7 Assigned to ${assigned}` : ""}`;
99077
- return [{ ...post4, key: key4, text: text25, blocks: [{ type: "section", text: { type: "mrkdwn", text: text25 } }] }];
99092
+ return [{ ...post4, key: key4, text: text26, blocks: [{ type: "section", text: { type: "mrkdwn", text: text26 } }] }];
99078
99093
  }
99079
99094
  const agent = envelope?.agent ? escape4(envelope.agent.summary ?? "someone") : void 0;
99080
- const text24 = type === "incident.acknowledged" ? `Acknowledged by ${agent ?? "someone"}` : type === "incident.resolved" ? agent ? `Resolved by ${agent}` : "Resolved" : type === "incident.escalated" ? `Escalated to ${names(incident6.assignees) || "the next level"}` : void 0;
99081
- return text24 === void 0 ? [] : [{ ...post4, thread_key: key4, text: text24 }];
99095
+ const text25 = type === "incident.acknowledged" ? `Acknowledged by ${agent ?? "someone"}` : type === "incident.resolved" ? agent ? `Resolved by ${agent}` : "Resolved" : type === "incident.escalated" ? `Escalated to ${names(incident6.assignees) || "the next level"}` : void 0;
99096
+ return text25 === void 0 ? [] : [{ ...post4, thread_key: key4, text: text25 }];
99082
99097
  };
99083
99098
 
99084
99099
  // packages/server/src/world/catalog/index.ts
@@ -99320,9 +99335,9 @@ function aggregateValues(values2, aggregation) {
99320
99335
  }
99321
99336
  function resolveQueryRange(from, to, nowMs) {
99322
99337
  if (!Number.isFinite(nowMs)) invalid3("invalid captured query time");
99323
- const resolve7 = (text24) => {
99324
- if (text24 === "now") return Math.floor(nowMs);
99325
- const relative2 = /^now-(.+)$/.exec(text24);
99338
+ const resolve7 = (text25) => {
99339
+ if (text25 === "now") return Math.floor(nowMs);
99340
+ const relative2 = /^now-(.+)$/.exec(text25);
99326
99341
  if (relative2) {
99327
99342
  let duration8;
99328
99343
  try {
@@ -99333,8 +99348,8 @@ function resolveQueryRange(from, to, nowMs) {
99333
99348
  if (!Number.isSafeInteger(duration8) || duration8 <= 0) return invalid3("relative query duration must be positive finite milliseconds");
99334
99349
  return Math.floor(nowMs) - duration8;
99335
99350
  }
99336
- const absolute = /^(\d{4}-\d{2}-\d{2})T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?(?:Z|[+-]\d{2}:\d{2})$/.exec(text24);
99337
- const value4 = absolute ? Date.parse(text24) : NaN;
99351
+ const absolute = /^(\d{4}-\d{2}-\d{2})T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?(?:Z|[+-]\d{2}:\d{2})$/.exec(text25);
99352
+ const value4 = absolute ? Date.parse(text25) : NaN;
99338
99353
  if (!Number.isFinite(value4)) return invalid3("query time must be ISO or now[-<positive duration>]");
99339
99354
  const date10 = /* @__PURE__ */ new Date(`${absolute[1]}T00:00:00Z`);
99340
99355
  if (date10.toISOString().slice(0, 10) !== absolute[1]) return invalid3("invalid ISO calendar date");
@@ -99421,9 +99436,9 @@ function encodeCursor2(cursor4, seed43) {
99421
99436
  const body6 = Buffer.from(JSON.stringify(cursor4)).toString("base64url");
99422
99437
  return `${body6}.${createHmac("sha256", seed43).update(body6).digest("base64url")}`;
99423
99438
  }
99424
- function decodeCursor2(text24, seed43) {
99425
- if (text24.length > 4096 || !/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(text24)) return invalid3("invalid log cursor");
99426
- const [body6, signature2] = text24.split(".");
99439
+ function decodeCursor2(text25, seed43) {
99440
+ if (text25.length > 4096 || !/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(text25)) return invalid3("invalid log cursor");
99441
+ const [body6, signature2] = text25.split(".");
99427
99442
  if (createHmac("sha256", seed43).update(body6).digest("base64url") !== signature2) return invalid3("invalid log cursor signature");
99428
99443
  let data5;
99429
99444
  try {
@@ -100027,14 +100042,14 @@ var pullRoutes = [
100027
100042
  { method: "POST", path: "/repos/:owner/:repo/pulls", coverage: { status: "partial", notes: writeNotes }, handler: (c) => {
100028
100043
  query(c, []);
100029
100044
  const ctx = c.env.ctx, repo4 = repository(c), input5 = body3(c, ["title", "body", "head", "base", "draft"]);
100030
- const title2 = string4(input5.title, "title"), text24 = input5.body === void 0 ? "" : string4(input5.body, "body", true), draft2 = boolean6(input5.draft, "draft", false);
100045
+ const title2 = string4(input5.title, "title"), text25 = input5.body === void 0 ? "" : string4(input5.body, "body", true), draft2 = boolean6(input5.draft, "draft", false);
100031
100046
  ctx.signal?.throwIfAborted();
100032
100047
  return withMutation(ctx, () => {
100033
100048
  const head = branch(ctx, repo4, input5.head, "head", true), base4 = branch(ctx, repo4, input5.base, "base");
100034
100049
  if (head.ref === base4.ref || isAncestor(ctx, repo4.id, head.sha, base4.sha) || getCommit(ctx, repo4.id, head.sha).tree === getCommit(ctx, repo4.id, base4.sha).tree) throw new GitHubError(422, "No commits or changes between base and head");
100035
100050
  duplicate(ctx, repo4.id, head.ref, base4.ref);
100036
100051
  const number7 = nextIssueNumber(ctx, repo4.id), at3 = ctx.clock.now().toISOString(), user8 = botUser(ctx), issueId = resourceId(ctx);
100037
- ctx.store.db.prepare("INSERT INTO github_issues (id,repo_id,number,user_id,title,body,state,is_pull,created_at,updated_at) VALUES (?,?,?,?,?,?,'open',1,?,?)").run(issueId, repo4.id, number7, user8.id, title2, text24, at3, at3);
100052
+ ctx.store.db.prepare("INSERT INTO github_issues (id,repo_id,number,user_id,title,body,state,is_pull,created_at,updated_at) VALUES (?,?,?,?,?,?,'open',1,?,?)").run(issueId, repo4.id, number7, user8.id, title2, text25, at3, at3);
100038
100053
  const pullId = resourceId(ctx);
100039
100054
  ctx.store.db.prepare("INSERT INTO github_pulls (id,repo_id,number,head_ref,head_sha,base_ref,draft) VALUES (?,?,?,?,?,?,?)").run(pullId, repo4.id, number7, head.ref, head.sha, base4.ref, draft2 ? 1 : 0);
100040
100055
  pullEvent(ctx, repo4, requirePull(ctx, repo4.id, number7), "opened");
@@ -100158,8 +100173,8 @@ function decodeWords(value4) {
100158
100173
  return decodeCharset(bytes2, label7);
100159
100174
  });
100160
100175
  }
100161
- function decodeQuotedPrintable(text24) {
100162
- const soft = text24.replace(/=\r?\n/g, "");
100176
+ function decodeQuotedPrintable(text25) {
100177
+ const soft = text25.replace(/=\r?\n/g, "");
100163
100178
  const bytes2 = [];
100164
100179
  for (let i = 0; i < soft.length; i++) {
100165
100180
  const ch = soft[i];
@@ -100209,15 +100224,15 @@ function parseHeaderParams(value4) {
100209
100224
  let charset = "utf-8";
100210
100225
  const bytes2 = [];
100211
100226
  pieces.forEach((piece2, i) => {
100212
- let text24 = piece2.text;
100227
+ let text25 = piece2.text;
100213
100228
  if (piece2.encoded && i === 0) {
100214
- const m = /^([^']*)'[^']*'(.*)$/.exec(text24);
100229
+ const m = /^([^']*)'[^']*'(.*)$/.exec(text25);
100215
100230
  if (m) {
100216
100231
  charset = m[1] || "utf-8";
100217
- text24 = m[2];
100232
+ text25 = m[2];
100218
100233
  }
100219
100234
  }
100220
- bytes2.push(piece2.encoded ? Buffer.from(text24.replace(/%([0-9A-Fa-f]{2})/g, (_, hex5) => String.fromCharCode(parseInt(hex5, 16))), "latin1") : Buffer.from(text24, "utf8"));
100235
+ bytes2.push(piece2.encoded ? Buffer.from(text25.replace(/%([0-9A-Fa-f]{2})/g, (_, hex5) => String.fromCharCode(parseInt(hex5, 16))), "latin1") : Buffer.from(text25, "utf8"));
100221
100236
  });
100222
100237
  params10[name5] = decodeCharset(Buffer.concat(bytes2), charset);
100223
100238
  }
@@ -100241,9 +100256,9 @@ function header2(headers, name5) {
100241
100256
  return headers.find((h) => h.name.toLowerCase() === name5.toLowerCase())?.value;
100242
100257
  }
100243
100258
  function splitEntity(bytes2) {
100244
- const text24 = bytes2.toString("latin1");
100245
- const match3 = /\r?\n\r?\n/.exec(text24);
100246
- if (!match3) return { headerText: Buffer.from(text24, "latin1").toString("utf8"), body: Buffer.alloc(0) };
100259
+ const text25 = bytes2.toString("latin1");
100260
+ const match3 = /\r?\n\r?\n/.exec(text25);
100261
+ if (!match3) return { headerText: Buffer.from(text25, "latin1").toString("utf8"), body: Buffer.alloc(0) };
100247
100262
  return { headerText: bytes2.subarray(0, match3.index).toString("utf8"), body: bytes2.subarray(match3.index + match3[0].length) };
100248
100263
  }
100249
100264
  function parseEntity(bytes2, partId, depth, count4, defaultType = "text/plain") {
@@ -100260,12 +100275,12 @@ function parseEntity(bytes2, partId, depth, count4, defaultType = "text/plain")
100260
100275
  const boundary = type.params.boundary;
100261
100276
  if (!boundary) throw new MimeError("Multipart entity without a boundary");
100262
100277
  const parts3 = [];
100263
- const text24 = body6.toString("latin1");
100278
+ const text25 = body6.toString("latin1");
100264
100279
  const delimiter = new RegExp(`(?:^|\\r?\\n)--${boundary.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(--)?[ \\t]*(?=\\r?\\n|$)`, "g");
100265
100280
  let previous, match3;
100266
- while ((match3 = delimiter.exec(text24)) !== null) {
100281
+ while ((match3 = delimiter.exec(text25)) !== null) {
100267
100282
  if (previous !== void 0) {
100268
- const chunk = text24.slice(previous, match3.index).replace(/^\r?\n/, "");
100283
+ const chunk = text25.slice(previous, match3.index).replace(/^\r?\n/, "");
100269
100284
  parts3.push(parseEntity(Buffer.from(chunk, "latin1"), partId === "" ? String(parts3.length) : `${partId}.${parts3.length}`, depth + 1, count4, mimeType === "multipart/digest" ? "message/rfc822" : "text/plain"));
100270
100285
  }
100271
100286
  if (match3[1] === "--") {
@@ -100305,11 +100320,11 @@ function parseAddressList(value4) {
100305
100320
  const out = [];
100306
100321
  let current = "", quoted3 = false, angle = false;
100307
100322
  const flush = () => {
100308
- const text24 = current.trim().replace(/^[^:<"@]*:\s*/, "").replace(/;$/, "").trim();
100323
+ const text25 = current.trim().replace(/^[^:<"@]*:\s*/, "").replace(/;$/, "").trim();
100309
100324
  current = "";
100310
- if (!text24) return;
100311
- const parsed3 = parseGmailAddress(text24);
100312
- if (!parsed3) throw new MimeError(`Invalid address: ${text24}`);
100325
+ if (!text25) return;
100326
+ const parsed3 = parseGmailAddress(text25);
100327
+ if (!parsed3) throw new MimeError(`Invalid address: ${text25}`);
100313
100328
  out.push(parsed3);
100314
100329
  };
100315
100330
  for (let i = 0; i < value4.length; i++) {
@@ -100350,8 +100365,8 @@ function formatAddress(a) {
100350
100365
  const name5 = !ASCII.test(a.name) ? encodeWords(a.name) : /[()<>[\]:;@\\,."]/.test(a.name) ? `"${a.name.replace(/(["\\])/g, "\\$1")}"` : a.name;
100351
100366
  return `${name5} <${a.email}>`;
100352
100367
  }
100353
- function quotedPrintable(text24) {
100354
- const lines = text24.replace(/\r?\n/g, "\n").split("\n").map((line2) => {
100368
+ function quotedPrintable(text25) {
100369
+ const lines = text25.replace(/\r?\n/g, "\n").split("\n").map((line2) => {
100355
100370
  let encoded = "";
100356
100371
  for (const byte of Buffer.from(line2, "utf8")) {
100357
100372
  encoded += byte >= 33 && byte <= 126 && byte !== 61 || byte === 32 ? String.fromCharCode(byte) : `=${byte.toString(16).toUpperCase().padStart(2, "0")}`;
@@ -100423,10 +100438,10 @@ ${content2}\r
100423
100438
  `, "utf8");
100424
100439
  }
100425
100440
  function rewriteHeaders(raw3, changes) {
100426
- const text24 = raw3.toString("latin1");
100427
- const match3 = /\r?\n\r?\n/.exec(text24);
100428
- const headerText = match3 ? text24.slice(0, match3.index) : text24;
100429
- const rest2 = match3 ? raw3.subarray(Buffer.byteLength(text24.slice(0, match3.index + match3[0].length), "latin1")) : Buffer.alloc(0);
100441
+ const text25 = raw3.toString("latin1");
100442
+ const match3 = /\r?\n\r?\n/.exec(text25);
100443
+ const headerText = match3 ? text25.slice(0, match3.index) : text25;
100444
+ const rest2 = match3 ? raw3.subarray(Buffer.byteLength(text25.slice(0, match3.index + match3[0].length), "latin1")) : Buffer.alloc(0);
100430
100445
  const kept = [];
100431
100446
  const lower4 = new Map(Object.keys(changes).map((k) => [k.toLowerCase(), k]));
100432
100447
  let skipping = false;
@@ -100597,11 +100612,11 @@ function handle(route12) {
100597
100612
  const ctx = c.env.ctx;
100598
100613
  let body6, bodyError;
100599
100614
  if (route12.method !== "GET" && route12.method !== "DELETE") {
100600
- const text24 = await c.req.text();
100601
- if (Buffer.byteLength(text24) > MAX_BODY_BYTES) bodyError = new GmailError(501, "UNIMPLEMENTED", "notImplemented", "ancha: not implemented: request bodies over 10 MB");
100602
- else if (text24.trim() === "") body6 = {};
100615
+ const text25 = await c.req.text();
100616
+ if (Buffer.byteLength(text25) > MAX_BODY_BYTES) bodyError = new GmailError(501, "UNIMPLEMENTED", "notImplemented", "ancha: not implemented: request bodies over 10 MB");
100617
+ else if (text25.trim() === "") body6 = {};
100603
100618
  else try {
100604
- body6 = JSON.parse(text24);
100619
+ body6 = JSON.parse(text25);
100605
100620
  } catch {
100606
100621
  bodyError = new GmailError(400, "INVALID_ARGUMENT", "parseError", "Invalid JSON payload received. Unexpected token.");
100607
100622
  }
@@ -100696,7 +100711,7 @@ var escapeHtml = (s2) => s2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace
100696
100711
  function describe4(raw3) {
100697
100712
  const root3 = parseMessage(raw3);
100698
100713
  const h = (name5) => header2(root3.headers, name5);
100699
- const text24 = bodyText(root3);
100714
+ const text25 = bodyText(root3);
100700
100715
  const html2 = leaves(root3).find((p2) => p2.mimeType === "text/html" && !isAttachment(p2));
100701
100716
  const meta3 = {
100702
100717
  from: parseAddressList(h("from")),
@@ -100704,9 +100719,9 @@ function describe4(raw3) {
100704
100719
  cc: parseAddressList(h("cc")),
100705
100720
  bcc: parseAddressList(h("bcc")),
100706
100721
  subject: h("subject") ?? "",
100707
- text: text24,
100722
+ text: text25,
100708
100723
  ...html2 && { html: partText(html2) },
100709
- snippet: escapeHtml((text24 || (html2 ? htmlToText(partText(html2)) : "")).replace(/\s+/g, " ").trim().slice(0, 200)),
100724
+ snippet: escapeHtml((text25 || (html2 ? htmlToText(partText(html2)) : "")).replace(/\s+/g, " ").trim().slice(0, 200)),
100710
100725
  ...h("message-id") && { messageId: h("message-id").trim() },
100711
100726
  ...h("in-reply-to") && { inReplyTo: h("in-reply-to").trim() },
100712
100727
  references: (h("references") ?? "").match(/<[^<>\s]+>/g) ?? [],
@@ -100932,18 +100947,18 @@ function decidePrompt(person4, open2, messages2) {
100932
100947
  temperature: 0
100933
100948
  };
100934
100949
  }
100935
- function matchPrompt(fact2, text24) {
100950
+ function matchPrompt(fact2, text25) {
100936
100951
  return {
100937
100952
  system: `You decide whether a message tells its reader this fact: ${JSON.stringify(fact2.value)}. Answer {"told": true} only if the message states that information, directly or by clear paraphrase, even among other things; a question about it, or a mention of something else, does not count. Otherwise {"told": false}.`,
100938
- user: text24,
100953
+ user: text25,
100939
100954
  schema: { name: "match", schema: { type: "object", additionalProperties: false, required: ["told"], properties: { told: { type: "boolean" } } } },
100940
100955
  temperature: 0
100941
100956
  };
100942
100957
  }
100943
- function matchManyPrompt(candidates, text24) {
100958
+ function matchManyPrompt(candidates, text25) {
100944
100959
  return {
100945
100960
  system: `You decide which of these facts a message tells its reader: ${JSON.stringify(candidates.map((fact2) => ({ id: fact2.ref, fact: fact2.value })))}. Include every fact the message states, directly or by clear paraphrase; a message can state several. A question about a fact does not count. Return {"told": []} if it tells none.`,
100946
- user: text24,
100961
+ user: text25,
100947
100962
  schema: { name: "match", schema: { type: "object", additionalProperties: false, required: ["told"], properties: { told: { type: "array", items: { type: "string", enum: candidates.map((fact2) => fact2.ref) } } } } },
100948
100963
  temperature: 0
100949
100964
  };
@@ -100999,8 +101014,8 @@ var MAX_SINGLE_MATCHES = 8;
100999
101014
  function peopleEngine(env) {
101000
101015
  return engines.get(env);
101001
101016
  }
101002
- function normalize(text24) {
101003
- return ` ${text24.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim()} `;
101017
+ function normalize(text25) {
101018
+ return ` ${text25.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim()} `;
101004
101019
  }
101005
101020
  var PeopleEngine = class {
101006
101021
  #env;
@@ -101333,10 +101348,10 @@ var PeopleEngine = class {
101333
101348
  return [...this.#people.values()].filter((other) => other.ref !== person4.ref).flatMap((other) => (other.knows ?? []).filter((fact2) => fact2.match === "semantic" && !known2.has(`${other.ref}.${fact2.id}`)).map((fact2) => ({ ref: `${other.ref}.${fact2.id}`, value: fact2.value })));
101334
101349
  }
101335
101350
  #exactKnowledge(person4, message8, author) {
101336
- const known2 = knownFacts(this.#env, person4.ref), text24 = normalize(message8.text);
101351
+ const known2 = knownFacts(this.#env, person4.ref), text25 = normalize(message8.text);
101337
101352
  for (const other of this.#people.values()) for (const fact2 of other.knows ?? []) {
101338
101353
  const ref22 = `${other.ref}.${fact2.id}`;
101339
- if (other.ref === person4.ref || fact2.match !== "exact" || known2.has(ref22) || !text24.includes(normalize(fact2.value))) continue;
101354
+ if (other.ref === person4.ref || fact2.match !== "exact" || known2.has(ref22) || !text25.includes(normalize(fact2.value))) continue;
101340
101355
  recordKnowledge(this.#env, {
101341
101356
  person: person4.ref,
101342
101357
  fact: ref22,
@@ -101357,7 +101372,7 @@ var PeopleEngine = class {
101357
101372
  for (const row2 of rows7) {
101358
101373
  const candidates = env.world.read(() => this.#semanticCandidates(person4));
101359
101374
  if (!candidates.length) return;
101360
- const text24 = env.world.read(() => this.#messageText(row2));
101375
+ const text25 = env.world.read(() => this.#messageText(row2));
101361
101376
  const learn = (ref22) => env.world.mutate(() => {
101362
101377
  recordKnowledge(env, {
101363
101378
  person: person4.ref,
@@ -101369,14 +101384,14 @@ var PeopleEngine = class {
101369
101384
  });
101370
101385
  });
101371
101386
  if (candidates.length > MAX_SINGLE_MATCHES) {
101372
- const told = (await this.#call(person4, "match", "message", matchManyPrompt(candidates, text24)))?.told;
101387
+ const told = (await this.#call(person4, "match", "message", matchManyPrompt(candidates, text25)))?.told;
101373
101388
  if (Array.isArray(told)) {
101374
101389
  for (const ref22 of told) if (typeof ref22 === "string" && candidates.some((fact2) => fact2.ref === ref22)) learn(ref22);
101375
101390
  }
101376
101391
  continue;
101377
101392
  }
101378
101393
  for (const fact2 of candidates) {
101379
- const output2 = await this.#call(person4, "match", "message", matchPrompt(fact2, text24));
101394
+ const output2 = await this.#call(person4, "match", "message", matchPrompt(fact2, text25));
101380
101395
  if (output2 === void 0) return;
101381
101396
  if (output2.told === true) learn(fact2.ref);
101382
101397
  }
@@ -101678,13 +101693,13 @@ ${issue8.body}`, isNew: fresh.has(`github.issue:${issue8.id}`) }] : [],
101678
101693
  #execute(person4, place2, step2) {
101679
101694
  const env = this.#env, key4 = place2.key;
101680
101695
  const accounts2 = this.#everyone().find((entry2) => entry2.person.ref === person4.ref).accounts;
101681
- const text24 = this.#withMentions(step2.text ?? "");
101696
+ const text25 = this.#withMentions(step2.text ?? "");
101682
101697
  if (key4.startsWith("slack:") && accounts2.slack !== void 0) {
101683
101698
  const [, channel3, root3] = key4.split(":");
101684
101699
  const ctx = env.ctxFor("slack");
101685
- const row2 = insertMessage(ctx, { channelId: channel3, userId: accounts2.slack, botId: null, text: text24, blocks: null, threadTs: root3 === "0" ? null : root3 });
101700
+ const row2 = insertMessage(ctx, { channelId: channel3, userId: accounts2.slack, botId: null, text: text25, blocks: null, threadTs: root3 === "0" ? null : root3 });
101686
101701
  emitMessage(ctx, row2);
101687
- env.trace.record({ source: "world", service: "slack", method: "ACTION", path: "people.post", request: { person: person4.ref, channel: channel3, thread_ts: root3 === "0" ? null : root3, text: text24 } });
101702
+ env.trace.record({ source: "world", service: "slack", method: "ACTION", path: "people.post", request: { person: person4.ref, channel: channel3, thread_ts: root3 === "0" ? null : root3, text: text25 } });
101688
101703
  return;
101689
101704
  }
101690
101705
  if (key4.startsWith("gmail:") && accounts2.gmail !== void 0) {
@@ -101696,12 +101711,12 @@ ${issue8.body}`, isNew: fresh.has(`github.issue:${issue8.id}`) }] : [],
101696
101711
  if (key4.startsWith("github:") && accounts2.github !== void 0) {
101697
101712
  const [repoId, number7] = key4.slice("github:".length).split("#").map(Number);
101698
101713
  const ctx = env.ctxFor("github");
101699
- insertComment(ctx, requireIssue(ctx, repoId, number7), Number(accounts2.github.id), text24);
101700
- env.trace.record({ source: "world", service: "github", method: "ACTION", path: "people.comment", request: { person: person4.ref, repo: repoId, number: number7, body: text24 } });
101714
+ insertComment(ctx, requireIssue(ctx, repoId, number7), Number(accounts2.github.id), text25);
101715
+ env.trace.record({ source: "world", service: "github", method: "ACTION", path: "people.comment", request: { person: person4.ref, repo: repoId, number: number7, body: text25 } });
101701
101716
  }
101702
101717
  }
101703
101718
  /** `@Name` for a person or a Slack user in this world becomes a real mention. */
101704
- #withMentions(text24) {
101719
+ #withMentions(text25) {
101705
101720
  const names5 = /* @__PURE__ */ new Map();
101706
101721
  for (const entry2 of this.#everyone()) if (entry2.accounts.slack) names5.set(entry2.person.name.toLowerCase(), entry2.accounts.slack);
101707
101722
  const bot = this.#botAccounts().slack;
@@ -101709,7 +101724,7 @@ ${issue8.body}`, isNew: fresh.has(`github.issue:${issue8.id}`) }] : [],
101709
101724
  const row2 = this.#env.store.db.prepare("SELECT name FROM slack_users WHERE id = ?").get(bot);
101710
101725
  if (row2) names5.set(row2.name.toLowerCase(), bot);
101711
101726
  }
101712
- return text24.replace(/@([A-Za-z][\w.-]*)/g, (match3, name5) => {
101727
+ return text25.replace(/@([A-Za-z][\w.-]*)/g, (match3, name5) => {
101713
101728
  const id14 = names5.get(name5.toLowerCase());
101714
101729
  return id14 ? `<@${id14}>` : match3;
101715
101730
  });
@@ -101743,7 +101758,7 @@ function messageIn(ctx, channelId, ts2) {
101743
101758
  if (!row2) throw new SlackError("message_not_found");
101744
101759
  return row2;
101745
101760
  }
101746
- var hasText = (text24) => text24 !== void 0 && text24.trim() !== "";
101761
+ var hasText = (text25) => text25 !== void 0 && text25.trim() !== "";
101747
101762
  function messageText(args) {
101748
101763
  if (args.markdown_text === void 0) return stringArg(args.text);
101749
101764
  if (args.text !== void 0 || args.blocks !== void 0) throw new SlackError("markdown_text_conflict");
@@ -101781,14 +101796,14 @@ function supported(ctx, args, fields11) {
101781
101796
  registerMethods({
101782
101797
  "chat.postMessage": (ctx, args, caller2) => {
101783
101798
  supported(ctx, args, ["channel", "text", "blocks", "markdown_text", "thread_ts"]);
101784
- const text24 = messageText(args);
101799
+ const text25 = messageText(args);
101785
101800
  const target5 = stringArg(args.channel);
101786
101801
  const user8 = target5 !== void 0 && /^[UW][A-Z0-9]+$/.test(target5) ? ctx.store.db.prepare("SELECT id FROM slack_users WHERE id = ? AND deleted = 0").get(target5) : void 0;
101787
101802
  const channel3 = user8 ? directMessage(ctx, caller2.userId, user8.id, true) : channelByIdOrName(ctx, caller2, args.channel);
101788
101803
  if (channel3.is_archived === 1) throw new SlackError("is_archived");
101789
101804
  if (!isMember(ctx, channel3.id, caller2.userId)) throw new SlackError("not_in_channel");
101790
101805
  const blocks3 = blocksArg(args.blocks);
101791
- if (!hasText(text24) && (blocks3 === void 0 || blocks3.length === 0)) throw new SlackError("no_text");
101806
+ if (!hasText(text25) && (blocks3 === void 0 || blocks3.length === 0)) throw new SlackError("no_text");
101792
101807
  let threadTs = null;
101793
101808
  const parentTs = stringArg(args.thread_ts);
101794
101809
  if (parentTs !== void 0) {
@@ -101800,7 +101815,7 @@ registerMethods({
101800
101815
  channelId: channel3.id,
101801
101816
  userId: caller2.userId,
101802
101817
  botId: caller2.botId ?? null,
101803
- text: text24 ?? "",
101818
+ text: text25 ?? "",
101804
101819
  blocks: blocks3 === void 0 || blocks3.length === 0 ? null : blocks3,
101805
101820
  threadTs
101806
101821
  });
@@ -101810,7 +101825,7 @@ registerMethods({
101810
101825
  "chat.postEphemeral": (ctx, args, caller2) => {
101811
101826
  requireScope(caller2, "chat:write");
101812
101827
  supported(ctx, args, ["channel", "user", "text", "blocks", "markdown_text", "thread_ts"]);
101813
- const text24 = messageText(args);
101828
+ const text25 = messageText(args);
101814
101829
  const channel3 = channelByIdOrName(ctx, caller2, args.channel);
101815
101830
  if (channel3.is_archived) throw new SlackError("is_archived");
101816
101831
  if (!isMember(ctx, channel3.id, caller2.userId)) throw new SlackError("not_in_channel");
@@ -101818,7 +101833,7 @@ registerMethods({
101818
101833
  if (!user8 || user8.deleted) throw new SlackError("user_not_found");
101819
101834
  if (!isMember(ctx, channel3.id, user8.id)) throw new SlackError("user_not_in_channel");
101820
101835
  const blocks3 = blocksArg(args.blocks);
101821
- if (!hasText(text24) && !blocks3?.length) throw new SlackError("no_text");
101836
+ if (!hasText(text25) && !blocks3?.length) throw new SlackError("no_text");
101822
101837
  let threadTs = null;
101823
101838
  if (args.thread_ts !== void 0) {
101824
101839
  const parent2 = getMessage(ctx, channel3.id, stringArg(args.thread_ts) ?? "");
@@ -101827,13 +101842,13 @@ registerMethods({
101827
101842
  }
101828
101843
  ensureAssistantTables(ctx);
101829
101844
  const ts2 = nextTs(ctx, ctx.clock.nowMs());
101830
- ctx.store.db.prepare("INSERT INTO slack_ephemeral_messages (channel_id, ts, user_id, recipient_user_id, text, blocks, thread_ts) VALUES (?, ?, ?, ?, ?, ?, ?)").run(channel3.id, ts2, caller2.userId, user8.id, text24 ?? "", blocks3?.length ? JSON.stringify(blocks3) : null, threadTs);
101845
+ ctx.store.db.prepare("INSERT INTO slack_ephemeral_messages (channel_id, ts, user_id, recipient_user_id, text, blocks, thread_ts) VALUES (?, ?, ?, ?, ?, ?, ?)").run(channel3.id, ts2, caller2.userId, user8.id, text25 ?? "", blocks3?.length ? JSON.stringify(blocks3) : null, threadTs);
101831
101846
  return { message_ts: ts2 };
101832
101847
  },
101833
101848
  "chat.scheduleMessage": (ctx, args, caller2) => {
101834
101849
  supported(ctx, args, ["channel", "post_at", "text", "blocks", "markdown_text", "thread_ts"]);
101835
- const text24 = messageText(args), blocks3 = blocksArg(args.blocks);
101836
- if (!hasText(text24) && !blocks3?.length) throw new SlackError("no_text");
101850
+ const text25 = messageText(args), blocks3 = blocksArg(args.blocks);
101851
+ if (!hasText(text25) && !blocks3?.length) throw new SlackError("no_text");
101837
101852
  const postAt = Number(args.post_at);
101838
101853
  if (!Number.isSafeInteger(postAt) || postAt <= 0) throw new SlackError("invalid_time");
101839
101854
  if (postAt * 1e3 <= ctx.clock.nowMs()) throw new SlackError("time_in_past");
@@ -101850,24 +101865,24 @@ registerMethods({
101850
101865
  }
101851
101866
  ensureAssistantTables(ctx);
101852
101867
  const id14 = `Q${ctx.ids.alnumUpper(10)}`;
101853
- ctx.store.db.prepare("INSERT INTO slack_scheduled_messages (id, channel_id, user_id, bot_id, text, blocks, thread_ts, post_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)").run(id14, channel3.id, caller2.userId, caller2.botId ?? null, text24 ?? "", blocks3?.length ? JSON.stringify(blocks3) : null, threadTs, postAt);
101868
+ ctx.store.db.prepare("INSERT INTO slack_scheduled_messages (id, channel_id, user_id, bot_id, text, blocks, thread_ts, post_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)").run(id14, channel3.id, caller2.userId, caller2.botId ?? null, text25 ?? "", blocks3?.length ? JSON.stringify(blocks3) : null, threadTs, postAt);
101854
101869
  ctx.enqueueJob({ atMs: postAt * 1e3 - ctx.clock.startTime.getTime(), kind: "slack.scheduled_message", payload: { id: id14 } });
101855
- return { channel: channel3.id, post_at: postAt, scheduled_message_id: id14, message: { text: text24 ?? "", ...blocks3?.length && { blocks: blocks3 } } };
101870
+ return { channel: channel3.id, post_at: postAt, scheduled_message_id: id14, message: { text: text25 ?? "", ...blocks3?.length && { blocks: blocks3 } } };
101856
101871
  },
101857
101872
  "chat.update": (ctx, args, caller2) => {
101858
101873
  supported(ctx, args, ["channel", "ts", "text", "blocks", "markdown_text"]);
101859
- const text24 = messageText(args);
101874
+ const text25 = messageText(args);
101860
101875
  const channel3 = channelToRead(ctx, caller2, args.channel);
101861
101876
  const row2 = messageIn(ctx, channel3.id, args.ts);
101862
101877
  if (row2.user_id !== caller2.userId) throw new SlackError("cant_update_message");
101863
101878
  const blocks3 = blocksArg(args.blocks);
101864
- if (text24 === void 0 && blocks3 === void 0) throw new SlackError("no_text");
101865
- const newText = text24 ?? row2.text;
101866
- const newBlocks = blocks3 === void 0 ? text24 === void 0 ? row2.blocks : null : blocks3.length === 0 ? null : JSON.stringify(blocks3);
101879
+ if (text25 === void 0 && blocks3 === void 0) throw new SlackError("no_text");
101880
+ const newText = text25 ?? row2.text;
101881
+ const newBlocks = blocks3 === void 0 ? text25 === void 0 ? row2.blocks : null : blocks3.length === 0 ? null : JSON.stringify(blocks3);
101867
101882
  if (!hasText(newText) && newBlocks === null) throw new SlackError("no_text");
101868
101883
  const editedTs = nextTs(ctx, ctx.clock.nowMs());
101869
101884
  ctx.store.db.prepare("UPDATE slack_messages SET text = ?, blocks = ?, edited_ts = ? WHERE channel_id = ? AND ts = ?").run(newText, newBlocks, editedTs, channel3.id, row2.ts);
101870
- if (blocks3 !== void 0 || text24 !== void 0) ctx.store.db.prepare("DELETE FROM slack_message_links WHERE channel_id = ? AND ts = ?").run(channel3.id, row2.ts);
101885
+ if (blocks3 !== void 0 || text25 !== void 0) ctx.store.db.prepare("DELETE FROM slack_message_links WHERE channel_id = ? AND ts = ?").run(channel3.id, row2.ts);
101871
101886
  const updated = getMessage(ctx, channel3.id, row2.ts);
101872
101887
  emitMessageChanged(ctx, updated, row2);
101873
101888
  return { channel: channel3.id, ts: row2.ts, text: newText, message: messageShape(ctx, updated) };
@@ -101964,8 +101979,8 @@ var MAX_EVIDENCE = 20;
101964
101979
  var CONVERSATION_LINES = 20;
101965
101980
  var hasTable6 = (env, name5) => env.store.db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(name5) !== void 0;
101966
101981
  var simAt = (env, ms) => new Date(env.clock.startTime.getTime() + ms).toISOString();
101967
- var clip = (text24, limit = 200) => {
101968
- const flat2 = text24.replace(/\s+/g, " ").trim();
101982
+ var clip = (text25, limit = 200) => {
101983
+ const flat2 = text25.replace(/\s+/g, " ").trim();
101969
101984
  return flat2.length > limit ? `${flat2.slice(0, limit - 1)}\u2026` : flat2;
101970
101985
  };
101971
101986
  var nameOf = (env, ref22) => env.scene.people?.find((person4) => person4.ref === ref22)?.name ?? ref22;
@@ -104021,8 +104036,8 @@ function dayBounds(seconds3, zone5) {
104021
104036
  const inZone = (wall) => {
104022
104037
  let candidate = wall;
104023
104038
  for (let i = 0; i < 3; i++) {
104024
- const text24 = new Intl.DateTimeFormat("en", { timeZone: zone5, timeZoneName: "longOffset" }).formatToParts(new Date(candidate)).find((x) => x.type === "timeZoneName").value;
104025
- const m = /GMT([+-])(\d{2}):(\d{2})/.exec(text24), offset17 = m ? (m[1] === "-" ? -1 : 1) * (Number(m[2]) * 60 + Number(m[3])) * 6e4 : 0;
104039
+ const text25 = new Intl.DateTimeFormat("en", { timeZone: zone5, timeZoneName: "longOffset" }).formatToParts(new Date(candidate)).find((x) => x.type === "timeZoneName").value;
104040
+ const m = /GMT([+-])(\d{2}):(\d{2})/.exec(text25), offset17 = m ? (m[1] === "-" ? -1 : 1) * (Number(m[2]) * 60 + Number(m[3])) * 6e4 : 0;
104026
104041
  candidate = wall - offset17;
104027
104042
  }
104028
104043
  return candidate / 1e3;
@@ -104108,7 +104123,7 @@ function parse5(schema, value4) {
104108
104123
  if (!parsed3.success) invalid6(parsed3.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ").slice(0, 1e3));
104109
104124
  return parsed3.data;
104110
104125
  }
104111
- function text13(value4, field5, max = 1e3) {
104126
+ function text14(value4, field5, max = 1e3) {
104112
104127
  if (typeof value4 !== "string" || value4.length > max) invalid6(`Invalid ${field5}`, field5);
104113
104128
  return value4;
104114
104129
  }
@@ -104193,7 +104208,7 @@ function pagination(rows7, query10, defaultLimit = 20, max = 500) {
104193
104208
  if (after !== void 0 && before !== void 0) invalid6("Use only after or before");
104194
104209
  let start2 = 0, end = rows7.length;
104195
104210
  if (after !== void 0 || before !== void 0) {
104196
- const cursor4 = text13(after ?? before, "cursor", 4096), index = rows7.findIndex((row2) => row2.id === cursor4);
104211
+ const cursor4 = text14(after ?? before, "cursor", 4096), index = rows7.findIndex((row2) => row2.id === cursor4);
104197
104212
  if (index < 0) invalid6("Cursor is not visible in this result");
104198
104213
  if (after !== void 0) start2 = index + 1;
104199
104214
  else {
@@ -104258,7 +104273,7 @@ function creative(value4, access3, creating) {
104258
104273
  }
104259
104274
  function parent(access3, kind, value4) {
104260
104275
  if (kind === "campaigns") return void 0;
104261
- const row2 = find(access3, kind === "adGroups" ? "campaigns" : "adGroups", text13(value4[kind === "adGroups" ? "campaign_id" : "ad_group_id"], "parent id", 200));
104276
+ const row2 = find(access3, kind === "adGroups" ? "campaigns" : "adGroups", text14(value4[kind === "adGroups" ? "campaign_id" : "ad_group_id"], "parent id", 200));
104262
104277
  if (row2.status === "archived") invalid6("Cannot create a child of an archived resource");
104263
104278
  if (kind === "ads" && find(access3, "campaigns", row2.campaign_id).status === "archived") invalid6("Cannot create an ad in an archived campaign");
104264
104279
  return row2;
@@ -104315,10 +104330,10 @@ function list4(c, access3, kind) {
104315
104330
  const query10 = params(c, ["include", "name", "limit", "after", "before", "order", ...parentKey ? [parentKey] : []], ["include"]), issues = includes2(query10);
104316
104331
  if (query10.order !== void 0 && !["asc", "desc"].includes(query10.order)) invalid6("order must be asc or desc");
104317
104332
  if (query10.name !== void 0) {
104318
- const name5 = text13(query10.name, "name");
104333
+ const name5 = text14(query10.name, "name");
104319
104334
  if (name5.length < 3 || !name5.trim()) invalid6("name must have at least three characters");
104320
104335
  }
104321
- if (parentKey && query10[parentKey] !== void 0) find(access3, kind === "adGroups" ? "campaigns" : "adGroups", text13(query10[parentKey], parentKey, 200));
104336
+ if (parentKey && query10[parentKey] !== void 0) find(access3, kind === "adGroups" ? "campaigns" : "adGroups", text14(query10[parentKey], parentKey, 200));
104322
104337
  const rows7 = access3.seed[kind].filter((row2) => row2.accountId === access3.account.id && (query10.name === void 0 || row2.name === query10.name) && (!parentKey || query10[parentKey] === void 0 || row2[parentKey] === query10[parentKey]));
104323
104338
  rows7.sort((a, b) => (a.created_at - b.created_at || a.id.localeCompare(b.id)) * (query10.order === "asc" ? 1 : -1));
104324
104339
  const page18 = pagination(rows7, query10);
@@ -104403,7 +104418,7 @@ function report(c, access3, scope2) {
104403
104418
  if (start2 % 3600 || end % 3600) unsupported6("insights non-hour-aligned bound normalization");
104404
104419
  }
104405
104420
  const field5 = (value4) => {
104406
- const name5 = text13(value4, "field", 200);
104421
+ const name5 = text14(value4, "field", 200);
104407
104422
  if (name5 === "metadata.readable_time") return name5;
104408
104423
  const [entity3, key4, ...rest2] = name5.split(".");
104409
104424
  if (rest2.length || !levels.includes(entity3)) unsupported6(`insights field ${name5}`);
@@ -104546,7 +104561,7 @@ function object9(value4, field5) {
104546
104561
  function keys3(value4, allowed2, field5) {
104547
104562
  for (const key4 of Object.keys(value4)) if (!allowed2.includes(key4)) unsupported7(`${field5}.${key4}`);
104548
104563
  }
104549
- function text14(value4, field5, max = 300) {
104564
+ function text15(value4, field5, max = 300) {
104550
104565
  if (typeof value4 !== "string" || value4.length > max) invalid7(`Invalid ${field5}`);
104551
104566
  return value4;
104552
104567
  }
@@ -104648,13 +104663,13 @@ var metrics2 = {
104648
104663
  totalRevenue: { uiName: "Total revenue", type: "TYPE_CURRENCY", description: "Seeded event revenue in the property currency." }
104649
104664
  };
104650
104665
  function dimensionName(value4) {
104651
- const name5 = text14(value4, "dimension name");
104666
+ const name5 = text15(value4, "dimension name");
104652
104667
  if (Object.hasOwn(metrics2, name5)) invalid7(`${name5} is a metric, not a dimension`);
104653
104668
  if (!Object.hasOwn(dimensions, name5)) unsupported7(`dimension ${name5}`);
104654
104669
  return name5;
104655
104670
  }
104656
104671
  function metricName(value4) {
104657
- const name5 = text14(value4, "metric name");
104672
+ const name5 = text15(value4, "metric name");
104658
104673
  if (Object.hasOwn(dimensions, name5)) invalid7(`${name5} is a dimension, not a metric`);
104659
104674
  if (!Object.hasOwn(metrics2, name5)) unsupported7(`metric ${name5}`);
104660
104675
  return name5;
@@ -104769,7 +104784,7 @@ function compileFilter(raw3, kind) {
104769
104784
  const match3 = value4.matchType === void 0 ? "EXACT" : value4.matchType, caseSensitive = bool2(value4.caseSensitive, "caseSensitive");
104770
104785
  if (["FULL_REGEXP", "PARTIAL_REGEXP"].includes(match3)) unsupported7(`stringFilter ${match3}`);
104771
104786
  if (!["EXACT", "BEGINS_WITH", "ENDS_WITH", "CONTAINS"].includes(match3)) invalid7("Invalid matchType");
104772
- const pattern = text14(value4.value, "stringFilter.value", 2e3), normalized = caseSensitive ? pattern : pattern.toLowerCase();
104787
+ const pattern = text15(value4.value, "stringFilter.value", 2e3), normalized = caseSensitive ? pattern : pattern.toLowerCase();
104773
104788
  return (read6) => {
104774
104789
  const raw5 = String(read6(field5)), actual = caseSensitive ? raw5 : raw5.toLowerCase();
104775
104790
  return match3 === "EXACT" ? actual === normalized : match3 === "BEGINS_WITH" ? actual.startsWith(normalized) : match3 === "ENDS_WITH" ? actual.endsWith(normalized) : actual.includes(normalized);
@@ -104781,7 +104796,7 @@ function compileFilter(raw3, kind) {
104781
104796
  const sensitive = bool2(value4.caseSensitive, "caseSensitive");
104782
104797
  if (!Array.isArray(value4.values) || value4.values.length < 1 || value4.values.length > 100) invalid7("Invalid inListFilter.values");
104783
104798
  const expected = value4.values.map((v) => {
104784
- const s2 = text14(v, "inListFilter.values", 2e3);
104799
+ const s2 = text15(v, "inListFilter.values", 2e3);
104785
104800
  return sensitive ? s2 : s2.toLowerCase();
104786
104801
  });
104787
104802
  return (read6) => expected.includes(sensitive ? String(read6(field5)) : String(read6(field5)).toLowerCase());
@@ -104816,7 +104831,7 @@ function compileFilter(raw3, kind) {
104816
104831
 
104817
104832
  // packages/server/src/twins/ga4/report.ts
104818
104833
  function date9(value4, property4, ctx) {
104819
- const input5 = text14(value4, "date", 30);
104834
+ const input5 = text15(value4, "date", 30);
104820
104835
  if (external_exports.iso.date().safeParse(input5).success) return input5;
104821
104836
  const match3 = /^(\d{1,6})daysAgo$/.exec(input5), ago = input5 === "today" ? 0 : input5 === "yesterday" ? 1 : match3 ? Number(match3[1]) : void 0;
104822
104837
  if (ago === void 0) invalid7("Dates must use YYYY-MM-DD, today, yesterday or NdaysAgo");
@@ -104832,7 +104847,7 @@ function ranges(raw3, property4, ctx) {
104832
104847
  keys3(value4, ["startDate", "endDate", "name"], "dateRanges");
104833
104848
  const start2 = date9(value4.startDate, property4, ctx), end = date9(value4.endDate, property4, ctx);
104834
104849
  if (end < start2) invalid7("startDate must not be after endDate");
104835
- const name5 = value4.name === void 0 ? `date_range_${i}` : text14(value4.name, "date range name", 100);
104850
+ const name5 = value4.name === void 0 ? `date_range_${i}` : text15(value4.name, "date range name", 100);
104836
104851
  if (value4.name !== void 0 && (!name5.length || /^(date_range_|RESERVED_)/.test(name5))) invalid7("Invalid date range name");
104837
104852
  return { start: start2, end, name: name5 };
104838
104853
  });
@@ -105053,12 +105068,12 @@ function pull(ctx, args) {
105053
105068
  if (!row2) return outcome(false, expected, `Pull ${args.pull} not found`);
105054
105069
  return outcome(Boolean(row2.merged) === args.merged, expected, `Pull #${row2.number} merged is ${Boolean(row2.merged)}`);
105055
105070
  }
105056
- var texts3 = (value4) => (value4 === void 0 ? [] : Array.isArray(value4) ? value4 : [value4]).map((text24) => text24.toLowerCase());
105071
+ var texts3 = (value4) => (value4 === void 0 ? [] : Array.isArray(value4) ? value4 : [value4]).map((text25) => text25.toLowerCase());
105057
105072
  var counted = (args, n2) => args.count !== void 0 ? n2 === args.count : args.count_gte === void 0 && args.count_lte === void 0 ? n2 >= 1 : (args.count_gte === void 0 || n2 >= args.count_gte) && (args.count_lte === void 0 || n2 <= args.count_lte);
105058
105073
  function issue3(ctx, args) {
105059
105074
  const filters = [
105060
- ...texts3(args.title_contains).map((text24) => `title contains ${JSON.stringify(text24)}`),
105061
- ...texts3(args.body_contains).map((text24) => `body contains ${JSON.stringify(text24)}`),
105075
+ ...texts3(args.title_contains).map((text25) => `title contains ${JSON.stringify(text25)}`),
105076
+ ...texts3(args.body_contains).map((text25) => `body contains ${JSON.stringify(text25)}`),
105062
105077
  ...(args.labels ?? []).map((name5) => `label ${JSON.stringify(name5)}`),
105063
105078
  ...args.state ? [`state ${args.state}`] : [],
105064
105079
  ...args.state_reason !== void 0 ? [`state reason ${args.state_reason}`] : []
@@ -105071,7 +105086,7 @@ function issue3(ctx, args) {
105071
105086
  const rows7 = ctx.store.db.prepare("SELECT * FROM github_issues WHERE repo_id = ? AND is_pull = 0 ORDER BY number").all(repo4.id);
105072
105087
  const matches9 = rows7.filter((row2) => {
105073
105088
  const names5 = new Set(issueLabels(ctx, repo4.id, row2.number).map((label7) => label7.name.toLowerCase()));
105074
- return (args.state === void 0 || row2.state === args.state) && (args.state_reason === void 0 || issueStateReason(ctx, row2) === args.state_reason) && title2.every((text24) => row2.title.toLowerCase().includes(text24)) && body6.every((text24) => row2.body.toLowerCase().includes(text24)) && labels2.every((name5) => names5.has(name5));
105089
+ return (args.state === void 0 || row2.state === args.state) && (args.state_reason === void 0 || issueStateReason(ctx, row2) === args.state_reason) && title2.every((text25) => row2.title.toLowerCase().includes(text25)) && body6.every((text25) => row2.body.toLowerCase().includes(text25)) && labels2.every((name5) => names5.has(name5));
105075
105090
  });
105076
105091
  const numbers2 = new Set(matches9.map((row2) => row2.number));
105077
105092
  const prefix2 = `/repos/${repo4.owner}/${repo4.name}/issues`.toLowerCase();
@@ -105186,7 +105201,7 @@ var searchRoutes = [{
105186
105201
  case "mentions": {
105187
105202
  const escaped = lower4.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
105188
105203
  const mention = new RegExp(`(^|[^a-z0-9_])@${escaped}(?![a-z0-9_-])`, "i");
105189
- predicates.push((item2) => [item2.issue.body, ...item2.comments].some((text24) => mention.test(text24)));
105204
+ predicates.push((item2) => [item2.issue.body, ...item2.comments].some((text25) => mention.test(text25)));
105190
105205
  break;
105191
105206
  }
105192
105207
  case "no":
@@ -105941,10 +105956,10 @@ function reviewCommit(ctx, p2, value4) {
105941
105956
  if (!isAncestor(ctx, p2.repo_id, sha2, head)) throw new GitHubError(422, "commit_id is not part of this pull request");
105942
105957
  return sha2;
105943
105958
  }
105944
- function insertReview(ctx, p2, sha2, state2, text24) {
105959
+ function insertReview(ctx, p2, sha2, state2, text25) {
105945
105960
  const id14 = resourceId(ctx), at3 = ctx.clock.now().toISOString();
105946
105961
  const ordinal2 = ctx.store.db.prepare("SELECT COALESCE(MAX(ordinal),0) + 1 AS n FROM github_reviews").get().n;
105947
- ctx.store.db.prepare("INSERT INTO github_reviews (id,repo_id,pull_number,user_id,commit_sha,state,body,submitted_at,ordinal) VALUES (?,?,?,?,?,?,?,?,?)").run(id14, p2.repo_id, p2.number, botUser(ctx).id, sha2, state2, text24, at3, ordinal2);
105962
+ ctx.store.db.prepare("INSERT INTO github_reviews (id,repo_id,pull_number,user_id,commit_sha,state,body,submitted_at,ordinal) VALUES (?,?,?,?,?,?,?,?,?)").run(id14, p2.repo_id, p2.number, botUser(ctx).id, sha2, state2, text25, at3, ordinal2);
105948
105963
  ctx.store.db.prepare("UPDATE github_issues SET updated_at = ? WHERE repo_id = ? AND number = ?").run(at3, p2.repo_id, p2.number);
105949
105964
  return requireReview(ctx, p2.repo_id, p2.number, id14);
105950
105965
  }
@@ -105956,16 +105971,16 @@ function changedLine(ctx, p2, sha2, path4, line2, side) {
105956
105971
  let old = 0, next2 = 0, hunk = "";
105957
105972
  const lines = file3.patch.split("\n");
105958
105973
  for (let i = 0; i < lines.length; i++) {
105959
- const text24 = lines[i], header3 = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(text24);
105974
+ const text25 = lines[i], header3 = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(text25);
105960
105975
  if (header3) {
105961
105976
  old = Number(header3[1]);
105962
105977
  next2 = Number(header3[2]);
105963
- hunk = text24;
105978
+ hunk = text25;
105964
105979
  continue;
105965
105980
  }
105966
105981
  hunk += `
105967
- ${text24}`;
105968
- const target5 = side === "LEFT" ? text24.startsWith("-") && old === line2 : text24.startsWith("+") && next2 === line2;
105982
+ ${text25}`;
105983
+ const target5 = side === "LEFT" ? text25.startsWith("-") && old === line2 : text25.startsWith("+") && next2 === line2;
105969
105984
  if (target5) {
105970
105985
  let end = i + 1;
105971
105986
  while (end < lines.length && !lines[end].startsWith("@@ ")) {
@@ -105975,9 +105990,9 @@ ${lines[end]}`;
105975
105990
  }
105976
105991
  return hunk.replace(/\n$/, "");
105977
105992
  }
105978
- if (text24.startsWith("-")) old++;
105979
- else if (text24.startsWith("+")) next2++;
105980
- else if (text24.startsWith(" ")) {
105993
+ if (text25.startsWith("-")) old++;
105994
+ else if (text25.startsWith("+")) next2++;
105995
+ else if (text25.startsWith(" ")) {
105981
105996
  old++;
105982
105997
  next2++;
105983
105998
  }
@@ -105999,12 +106014,12 @@ var reviewRoutes = [
105999
106014
  if (input5.event === void 0) unsupported("pending review workflows");
106000
106015
  const event3 = string4(input5.event, "event");
106001
106016
  if (!["APPROVE", "REQUEST_CHANGES", "COMMENT"].includes(event3)) unsupported(`review event ${event3}`);
106002
- const text24 = input5.body === void 0 ? "" : string4(input5.body, "body", true);
106003
- if (event3 !== "APPROVE" && !text24.trim()) throw new GitHubError(422, "body is required for COMMENT or REQUEST_CHANGES");
106017
+ const text25 = input5.body === void 0 ? "" : string4(input5.body, "body", true);
106018
+ if (event3 !== "APPROVE" && !text25.trim()) throw new GitHubError(422, "body is required for COMMENT or REQUEST_CHANGES");
106004
106019
  ctx.signal?.throwIfAborted();
106005
106020
  return withMutation(ctx, () => {
106006
106021
  const p2 = requirePull2(ctx, repo4.id, number7), sha2 = reviewCommit(ctx, p2, input5.commit_id);
106007
- return json2(reviewShape(ctx, repo4, insertReview(ctx, p2, sha2, { APPROVE: "APPROVED", REQUEST_CHANGES: "CHANGES_REQUESTED", COMMENT: "COMMENTED" }[event3], text24)), 200);
106022
+ return json2(reviewShape(ctx, repo4, insertReview(ctx, p2, sha2, { APPROVE: "APPROVED", REQUEST_CHANGES: "CHANGES_REQUESTED", COMMENT: "COMMENTED" }[event3], text25)), 200);
106008
106023
  });
106009
106024
  } },
106010
106025
  { method: "GET", path: "/repos/:owner/:repo/pulls/:number/reviews/:id", coverage: coverage3, handler: (c) => {
@@ -106020,13 +106035,13 @@ var reviewRoutes = [
106020
106035
  ...["GET", "PATCH", "DELETE"].map((method2) => ({ method: method2, path: "/repos/:owner/:repo/pulls/comments/:id", coverage: coverage3, handler: (c) => {
106021
106036
  query(c, []);
106022
106037
  const ctx = c.env.ctx, repo4 = repository(c), id14 = resourceNumber(c, "id");
106023
- const input5 = method2 === "PATCH" ? body3(c, ["body"]) : void 0, text24 = input5 ? string4(input5.body, "body") : void 0;
106038
+ const input5 = method2 === "PATCH" ? body3(c, ["body"]) : void 0, text25 = input5 ? string4(input5.body, "body") : void 0;
106024
106039
  ctx.signal?.throwIfAborted();
106025
106040
  return withMutation(ctx, () => {
106026
106041
  const row2 = requireComment2(ctx, repo4.id, id14);
106027
106042
  if (method2 === "GET") return reviewCommentShape(ctx, repo4, row2);
106028
106043
  if (method2 === "DELETE") ctx.store.db.prepare("DELETE FROM github_review_comments WHERE repo_id = ? AND id = ?").run(repo4.id, id14);
106029
- else ctx.store.db.prepare("UPDATE github_review_comments SET body = ?, updated_at = ? WHERE repo_id = ? AND id = ?").run(text24, ctx.clock.now().toISOString(), repo4.id, id14);
106044
+ else ctx.store.db.prepare("UPDATE github_review_comments SET body = ?, updated_at = ? WHERE repo_id = ? AND id = ?").run(text25, ctx.clock.now().toISOString(), repo4.id, id14);
106030
106045
  ctx.store.db.prepare("UPDATE github_issues SET updated_at = ? WHERE repo_id = ? AND number = ?").run(ctx.clock.now().toISOString(), repo4.id, row2.pull_number);
106031
106046
  return method2 === "DELETE" ? new Response(null, { status: 204 }) : reviewCommentShape(ctx, repo4, requireComment2(ctx, repo4.id, id14));
106032
106047
  });
@@ -106038,7 +106053,7 @@ var reviewRoutes = [
106038
106053
  } },
106039
106054
  { method: "POST", path: "/repos/:owner/:repo/pulls/:number/comments", coverage: coverage3, handler: (c) => {
106040
106055
  query(c, []);
106041
- const ctx = c.env.ctx, repo4 = repository(c), number7 = resourceNumber(c), input5 = body3(c, ["body", "commit_id", "path", "line", "side", "in_reply_to"]), text24 = string4(input5.body, "body");
106056
+ const ctx = c.env.ctx, repo4 = repository(c), number7 = resourceNumber(c), input5 = body3(c, ["body", "commit_id", "path", "line", "side", "in_reply_to"]), text25 = string4(input5.body, "body");
106042
106057
  ctx.signal?.throwIfAborted();
106043
106058
  return withMutation(ctx, () => {
106044
106059
  const p2 = requirePull2(ctx, repo4.id, number7);
@@ -106065,7 +106080,7 @@ var reviewRoutes = [
106065
106080
  reviewId = insertReview(ctx, p2, sha2, "COMMENTED", "").id;
106066
106081
  }
106067
106082
  const id14 = resourceId(ctx), at3 = ctx.clock.now().toISOString();
106068
- ctx.store.db.prepare("INSERT INTO github_review_comments (id,repo_id,pull_number,review_id,user_id,commit_sha,path,line,side,diff_hunk,in_reply_to_id,body,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)").run(id14, repo4.id, number7, reviewId, botUser(ctx).id, sha2, path4, line2, side, diff2, parent2?.id ?? null, text24, at3, at3);
106083
+ ctx.store.db.prepare("INSERT INTO github_review_comments (id,repo_id,pull_number,review_id,user_id,commit_sha,path,line,side,diff_hunk,in_reply_to_id,body,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)").run(id14, repo4.id, number7, reviewId, botUser(ctx).id, sha2, path4, line2, side, diff2, parent2?.id ?? null, text25, at3, at3);
106069
106084
  ctx.store.db.prepare("UPDATE github_issues SET updated_at = ? WHERE repo_id = ? AND number = ?").run(at3, repo4.id, number7);
106070
106085
  return json2(reviewCommentShape(ctx, repo4, requireComment2(ctx, repo4.id, id14)), 201);
106071
106086
  });
@@ -106291,8 +106306,8 @@ function seed7(ctx) {
106291
106306
  for (const monitor3 of seed43.monitors ?? []) insertMonitor(monitor3, false);
106292
106307
  for (const monitor3 of ctx.scene.world_rules?.monitors ?? []) insertMonitor(monitor3, true);
106293
106308
  for (const board of seed43.dashboards ?? []) {
106294
- const text24 = ctx.ids.fork("dashboard").alnumUpper(9).toLowerCase();
106295
- const id14 = `${text24.slice(0, 3)}-${text24.slice(3, 6)}-${text24.slice(6)}`;
106309
+ const text25 = ctx.ids.fork("dashboard").alnumUpper(9).toLowerCase();
106310
+ const id14 = `${text25.slice(0, 3)}-${text25.slice(3, 6)}-${text25.slice(6)}`;
106296
106311
  db3.prepare("INSERT INTO datadog_dashboards VALUES (?, ?, ?, ?, ?, ?, ?, ?)").run(
106297
106312
  id14,
106298
106313
  board.ref,
@@ -106488,7 +106503,7 @@ function boolean7(value4, name5) {
106488
106503
  if (typeof value4 !== "boolean") throw new DatadogError(400, `Invalid ${name5}`);
106489
106504
  return value4;
106490
106505
  }
106491
- function text15(value4, name5) {
106506
+ function text16(value4, name5) {
106492
106507
  if (typeof value4 !== "string") throw new DatadogError(400, `Invalid ${name5}`);
106493
106508
  return value4;
106494
106509
  }
@@ -106553,7 +106568,7 @@ function parse7(c, body6, version5, old) {
106553
106568
  const end = schedule3.end === void 0 ? old.end : timestamp2(schedule3.end, version5, "end");
106554
106569
  if (end <= start2 || end <= now11) throw new DatadogError(400, "end must be after start and current time");
106555
106570
  const zone5 = attrs[version5 === 1 ? "timezone" : "display_timezone"];
106556
- const timezone = zone5 === void 0 ? old?.timezone ?? "UTC" : text15(zone5, "timezone");
106571
+ const timezone = zone5 === void 0 ? old?.timezone ?? "UTC" : text16(zone5, "timezone");
106557
106572
  try {
106558
106573
  new Intl.DateTimeFormat("en", { timeZone: timezone });
106559
106574
  } catch {
@@ -106568,7 +106583,7 @@ function parse7(c, body6, version5, old) {
106568
106583
  start: start2,
106569
106584
  end,
106570
106585
  canceled: old?.canceled ?? null,
106571
- message: attrs.message === void 0 ? old?.message ?? "" : text15(attrs.message, "message"),
106586
+ message: attrs.message === void 0 ? old?.message ?? "" : text16(attrs.message, "message"),
106572
106587
  timezone,
106573
106588
  mute_first: attrs.mute_first_recovery_notification === void 0 ? old?.mute_first ?? 0 : Number(boolean7(attrs.mute_first_recovery_notification, "mute_first_recovery_notification")),
106574
106589
  notify_types: attrs.notify_end_types === void 0 ? old?.notify_types ?? '["expired"]' : JSON.stringify(list6(attrs.notify_end_types, "notify_end_types", ["expired", "canceled"])),
@@ -106799,9 +106814,9 @@ var datadogCoverage = [
106799
106814
  ];
106800
106815
 
106801
106816
  // packages/server/src/twins/datadog/methods/search.ts
106802
- function terms(text24) {
106803
- const tokens3 = text24.match(/(?:[^\s"]|"[^"]*")+/g) ?? [];
106804
- if ((text24.match(/"/g)?.length ?? 0) % 2) throw new DatadogError(400, "Invalid search query");
106817
+ function terms(text25) {
106818
+ const tokens3 = text25.match(/(?:[^\s"]|"[^"]*")+/g) ?? [];
106819
+ if ((text25.match(/"/g)?.length ?? 0) % 2) throw new DatadogError(400, "Invalid search query");
106805
106820
  return tokens3.filter((token4) => token4 !== "AND").map((token4) => {
106806
106821
  if (/^(OR|NOT)$|[()!]|^-/.test(token4)) unsupported4("monitor search expressions");
106807
106822
  const colon = token4.indexOf(":");
@@ -106826,7 +106841,7 @@ function matches3(row2, term2) {
106826
106841
  case "type":
106827
106842
  return ["metric", "metric alert"].includes(term2.value);
106828
106843
  default:
106829
- return term2.value === "*" || [row2.name, row2.overall_state, ...tags4].some((text24) => text24.toLowerCase().includes(term2.value));
106844
+ return term2.value === "*" || [row2.name, row2.overall_state, ...tags4].some((text25) => text25.toLowerCase().includes(term2.value));
106830
106845
  }
106831
106846
  }
106832
106847
  function counts(values2) {
@@ -106908,8 +106923,8 @@ function listEvents(c) {
106908
106923
  function createEvent(c, input5) {
106909
106924
  query3(c, []);
106910
106925
  const body6 = object6(input5, "event");
106911
- const title2 = string5(body6.title, "title"), text24 = string5(body6.text, "text");
106912
- if (text24.length > 4e3) throw new DatadogError(400, "Event text exceeds 4000 characters");
106926
+ const title2 = string5(body6.title, "title"), text25 = string5(body6.text, "text");
106927
+ if (text25.length > 4e3) throw new DatadogError(400, "Event text exceeds 4000 characters");
106913
106928
  const now11 = c.env.ctx.clock.nowMs();
106914
106929
  const seconds3 = body6.date_happened === void 0 ? Math.floor(now11 / 1e3) : body6.date_happened;
106915
106930
  if (typeof seconds3 !== "number" || !Number.isSafeInteger(seconds3) || seconds3 < 0 || seconds3 < Math.floor(now11 / 1e3) - 18 * 3600 || seconds3 > Math.floor(now11 / 1e3) + 2 * 3600) throw new DatadogError(400, "Invalid date_happened: expected integer seconds within 18 hours past and 2 hours future");
@@ -106918,7 +106933,7 @@ function createEvent(c, input5) {
106918
106933
  if (typeof alert !== "string" || !["error", "warning", "info", "success", "user_update", "recommendation", "snapshot"].includes(alert)) throw new DatadogError(400, "Invalid alert_type");
106919
106934
  if (!["error", "warning", "info", "success"].includes(alert)) unsupported4(`event alert_type ${alert}`);
106920
106935
  keys(body6, ["title", "text", "date_happened", "tags", "alert_type"], "event");
106921
- const row2 = { id: nextEventId(c.env.ctx), ref: null, title: title2, text: text24, at: seconds3 * 1e3, tags: JSON.stringify([...body6.tags ?? []].sort()), alert_type: alert };
106936
+ const row2 = { id: nextEventId(c.env.ctx), ref: null, title: title2, text: text25, at: seconds3 * 1e3, tags: JSON.stringify([...body6.tags ?? []].sort()), alert_type: alert };
106922
106937
  c.env.ctx.store.db.prepare("INSERT INTO datadog_events VALUES (?, ?, ?, ?, ?, ?, ?)").run(row2.id, row2.ref, row2.title, row2.text, row2.at, row2.tags, row2.alert_type);
106923
106938
  return { status: "ok", event: eventShape(row2) };
106924
106939
  }
@@ -107058,11 +107073,11 @@ function queryMetrics(c) {
107058
107073
  // packages/server/src/twins/datadog/methods/logs.ts
107059
107074
  async function searchLogs(c) {
107060
107075
  try {
107061
- const text24 = await c.req.text();
107076
+ const text25 = await c.req.text();
107062
107077
  let input5 = {};
107063
- if (text24 !== "") {
107078
+ if (text25 !== "") {
107064
107079
  try {
107065
- input5 = JSON.parse(text24);
107080
+ input5 = JSON.parse(text25);
107066
107081
  } catch {
107067
107082
  throw new DatadogError(400, "Invalid JSON body");
107068
107083
  }
@@ -107710,8 +107725,8 @@ function posterOf(ctx, userId2) {
107710
107725
  const row2 = ctx.store.db.prepare("SELECT name FROM slack_users WHERE id = ?").get(userId2) ?? ctx.store.db.prepare("SELECT name FROM slack_apps WHERE user_id = ?").get(userId2);
107711
107726
  return row2 ? `@${row2.name}: ` : "";
107712
107727
  }
107713
- function opening(text24, max = 48) {
107714
- const flat2 = text24.replace(/\s+/g, " ").trim();
107728
+ function opening(text25, max = 48) {
107729
+ const flat2 = text25.replace(/\s+/g, " ").trim();
107715
107730
  if (flat2.length <= max) return flat2;
107716
107731
  const cut = flat2.slice(0, max), space = cut.lastIndexOf(" ");
107717
107732
  return `${(space > max * 0.6 ? cut.slice(0, space) : cut).replace(/[\s,.;:!?-]+$/, "")}\u2026`;
@@ -108392,7 +108407,7 @@ registerMethods({
108392
108407
  });
108393
108408
 
108394
108409
  // packages/server/src/twins/slack/canvas-html.ts
108395
- var escape5 = (text24) => text24.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
108410
+ var escape5 = (text25) => text25.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
108396
108411
  var gap2 = () => {
108397
108412
  throw new SlackError("invalid_arguments", { ancha_gap: "Canvas HTML conversion for this Markdown syntax is not implemented" });
108398
108413
  };
@@ -108469,14 +108484,14 @@ function canvasHtml(markdown) {
108469
108484
  return out.length ? `${out.join("\n")}
108470
108485
  ` : "";
108471
108486
  }
108472
- function inline(text24) {
108473
- if (text24.length > 16384) gap2();
108474
- if (/\[[^\]]*\]\[|\\[\s\S]| {2}$/.test(text24)) gap2();
108487
+ function inline(text25) {
108488
+ if (text25.length > 16384) gap2();
108489
+ if (/\[[^\]]*\]\[|\\[\s\S]| {2}$/.test(text25)) gap2();
108475
108490
  const token4 = /`([^`\n]+)`|\*\*([^*\n]+)\*\*|__([^_\n]+)__|\*([^*\n]+)\*|_([^_\n]+)_|\[([^\]\n]+)\]\(([^\s)]+)\)/g;
108476
108491
  const out = [];
108477
108492
  let offset17 = 0;
108478
- for (const match3 of text24.matchAll(token4)) {
108479
- out.push(escape5(text24.slice(offset17, match3.index)));
108493
+ for (const match3 of text25.matchAll(token4)) {
108494
+ out.push(escape5(text25.slice(offset17, match3.index)));
108480
108495
  if (match3[1] !== void 0) out.push(`<code>${escape5(match3[1])}</code>`);
108481
108496
  else if (match3[2] !== void 0 || match3[3] !== void 0) out.push(`<strong>${escape5(match3[2] ?? match3[3])}</strong>`);
108482
108497
  else if (match3[4] !== void 0 || match3[5] !== void 0) out.push(`<em>${escape5(match3[4] ?? match3[5])}</em>`);
@@ -108486,7 +108501,7 @@ function inline(text24) {
108486
108501
  }
108487
108502
  offset17 = match3.index + match3[0].length;
108488
108503
  }
108489
- out.push(escape5(text24.slice(offset17)));
108504
+ out.push(escape5(text25.slice(offset17)));
108490
108505
  return out.join("");
108491
108506
  }
108492
108507
 
@@ -109106,11 +109121,11 @@ function salesforceTwin() {
109106
109121
  try {
109107
109122
  let body6;
109108
109123
  if (c.req.method !== "GET") {
109109
- const text24 = await c.req.text();
109110
- if (text24.length > 1e6) throw new SalesforceError(413, "REQUEST_LIMIT_EXCEEDED", "Request body exceeds 1 MB.");
109111
- if (text24) {
109124
+ const text25 = await c.req.text();
109125
+ if (text25.length > 1e6) throw new SalesforceError(413, "REQUEST_LIMIT_EXCEEDED", "Request body exceeds 1 MB.");
109126
+ if (text25) {
109112
109127
  try {
109113
- body6 = JSON.parse(text24);
109128
+ body6 = JSON.parse(text25);
109114
109129
  } catch {
109115
109130
  throw new SalesforceError(400, "JSON_PARSER_ERROR", "Malformed JSON.");
109116
109131
  }
@@ -110725,9 +110740,9 @@ function namePrefix(name5, value4) {
110725
110740
  }
110726
110741
  return false;
110727
110742
  }
110728
- function fullTextMatch(text24, value4) {
110743
+ function fullTextMatch(text25, value4) {
110729
110744
  const words6 = (input5) => input5.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);
110730
- const haystack = words6(text24), needle = words6(value4.replace(/^"|"$/g, ""));
110745
+ const haystack = words6(text25), needle = words6(value4.replace(/^"|"$/g, ""));
110731
110746
  if (!needle.length) return false;
110732
110747
  for (let i = 0; i + needle.length <= haystack.length; i++) if (needle.every((word, j) => haystack[i + j] === word)) return true;
110733
110748
  return false;
@@ -111069,14 +111084,14 @@ function searchable(ctx, caller2, file3, access3) {
111069
111084
  const granted = effectivePermissions(ctx, file3);
111070
111085
  const people3 = (min) => granted.filter((entry2) => (entry2.grant.type === "user" || entry2.grant.type === "group") && RANK2[entry2.grant.role] >= RANK2[min]).map((entry2) => entry2.grant.email);
111071
111086
  const anyone = granted.find((entry2) => entry2.grant.type === "anyone"), domain2 = granted.find((entry2) => entry2.grant.type === "domain");
111072
- const text24 = file3.content !== null && (isEditorFile(file3) || /^text\//.test(file3.mime_type)) ? file3.content.toString("utf8") : "";
111087
+ const text25 = file3.content !== null && (isEditorFile(file3) || /^text\//.test(file3.mime_type)) ? file3.content.toString("utf8") : "";
111073
111088
  const owner3 = getUser4(ctx, file3.owner);
111074
111089
  return {
111075
111090
  name: file3.name,
111076
111091
  mimeType: file3.mime_type,
111077
111092
  fullText: `${file3.name}
111078
111093
  ${file3.description ?? ""}
111079
- ${text24}`,
111094
+ ${text25}`,
111080
111095
  trashed: trashedBy(ctx, file3) !== void 0,
111081
111096
  starred: file3.starred === 1,
111082
111097
  createdMs: file3.created_ms,
@@ -111651,20 +111666,20 @@ function exportFile(call2) {
111651
111666
  if (!isEditorFile(file3)) throw new DriveError(403, "fileNotExportable", "Export only supports Docs Editors files.");
111652
111667
  if (!DRIVE_EXPORT_FORMATS[file3.mime_type].includes(target5)) throw new DriveError(400, "badRequest", "The requested conversion is not supported.", { name: "convertTo" });
111653
111668
  if (!EXPORTS[file3.mime_type].includes(target5)) unsupported11(`export to ${target5}`);
111654
- const text24 = (file3.content ?? Buffer.alloc(0)).toString("utf8");
111655
- let body6 = text24;
111656
- if (target5 === "text/html") body6 = `<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"></head><body>${text24.split("\n").map((line2) => `<p>${line2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")}</p>`).join("")}</body></html>`;
111657
- else if (target5 === "text/tab-separated-values") body6 = csvRows(text24).map((row2) => row2.join(" ")).join("\n");
111658
- else if (target5 === "text/plain" && file3.mime_type === "application/vnd.google-apps.document") body6 = `\uFEFF${text24}`;
111669
+ const text25 = (file3.content ?? Buffer.alloc(0)).toString("utf8");
111670
+ let body6 = text25;
111671
+ if (target5 === "text/html") body6 = `<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"></head><body>${text25.split("\n").map((line2) => `<p>${line2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")}</p>`).join("")}</body></html>`;
111672
+ else if (target5 === "text/tab-separated-values") body6 = csvRows(text25).map((row2) => row2.join(" ")).join("\n");
111673
+ else if (target5 === "text/plain" && file3.mime_type === "application/vnd.google-apps.document") body6 = `\uFEFF${text25}`;
111659
111674
  return new Response(body6, { status: 200, headers: { "content-type": `${target5}; charset=utf-8` } });
111660
111675
  }
111661
- function csvRows(text24) {
111676
+ function csvRows(text25) {
111662
111677
  const rows7 = [];
111663
111678
  let row2 = [], cell2 = "", quoted3 = false;
111664
- for (let i = 0; i < text24.length; i++) {
111665
- const char = text24[i];
111679
+ for (let i = 0; i < text25.length; i++) {
111680
+ const char = text25[i];
111666
111681
  if (quoted3) {
111667
- if (char === '"' && text24[i + 1] === '"') {
111682
+ if (char === '"' && text25[i + 1] === '"') {
111668
111683
  cell2 += '"';
111669
111684
  i++;
111670
111685
  } else if (char === '"') quoted3 = false;
@@ -112120,7 +112135,7 @@ function message5(ctx, args) {
112120
112135
  thread4 = ref22 && ctx.store.db.prepare("SELECT thread_id FROM gmail_messages WHERE mailbox = ? AND rfc822_id = ?").get(box.address, ref22.rfc822_id)?.thread_id;
112121
112136
  if (!thread4) return checkOutcome(!args.exists, expected, `${args.in_thread_of} is not in ${box.address}'s mailbox`);
112122
112137
  }
112123
- const lower4 = (value4) => value4.toLowerCase(), has2 = (text24, parts3) => (parts3 ?? []).every((part) => lower4(text24).includes(lower4(part)));
112138
+ const lower4 = (value4) => value4.toLowerCase(), has2 = (text25, parts3) => (parts3 ?? []).every((part) => lower4(text25).includes(lower4(part)));
112124
112139
  const same3 = (a, b) => a !== void 0 && lower4(a) === lower4(parseGmailAddress(b)?.email ?? b);
112125
112140
  const matches9 = mailboxMessages(ctx, box.address).filter((row2) => {
112126
112141
  const meta3 = metaOf(row2);
@@ -112147,12 +112162,12 @@ import { randomUUID as randomUUID3 } from "node:crypto";
112147
112162
  import { STATUS_CODES } from "node:http";
112148
112163
  var MAX_PARTS2 = 100;
112149
112164
  var BODYLESS = /* @__PURE__ */ new Set(["GET", "HEAD", "DELETE"]);
112150
- function traced(text24) {
112151
- if (text24 === "") return void 0;
112165
+ function traced(text25) {
112166
+ if (text25 === "") return void 0;
112152
112167
  try {
112153
- return JSON.parse(text24);
112168
+ return JSON.parse(text25);
112154
112169
  } catch {
112155
- return text24;
112170
+ return text25;
112156
112171
  }
112157
112172
  }
112158
112173
  function batchHandler(app2) {
@@ -112179,7 +112194,7 @@ function batchHandler(app2) {
112179
112194
  const content2 = payload2.join("\r\n\r\n").trim();
112180
112195
  const url4 = new URL(target5, c.req.url);
112181
112196
  const response5 = await app2.fetch(new Request(url4, { method: method2, headers, ...!BODYLESS.has(method2.toUpperCase()) && content2 !== "" && { body: content2 } }), c.env);
112182
- const text24 = await response5.text();
112197
+ const text25 = await response5.text();
112183
112198
  c.env.ctx.trace.record({
112184
112199
  source: "agent",
112185
112200
  service: "gmail",
@@ -112188,7 +112203,7 @@ function batchHandler(app2) {
112188
112203
  ...url4.search.length > 1 && { query: url4.search.slice(1) },
112189
112204
  status: response5.status,
112190
112205
  ...content2 !== "" && { request: traced(content2) },
112191
- ...text24 !== "" && { response: traced(text24) },
112206
+ ...text25 !== "" && { response: traced(text25) },
112192
112207
  gap: response5.status === 501,
112193
112208
  note: "batch part"
112194
112209
  });
@@ -112199,7 +112214,7 @@ Content-ID: <response-${contentId}>\r
112199
112214
  HTTP/1.1 ${response5.status} ${STATUS_CODES[response5.status] ?? ""}\r
112200
112215
  Content-Type: ${response5.headers.get("content-type") ?? "application/json; charset=UTF-8"}\r
112201
112216
  \r
112202
- ${text24}\r
112217
+ ${text25}\r
112203
112218
  `;
112204
112219
  }
112205
112220
  return new Response(`${body6}--${out}--\r
@@ -112280,7 +112295,7 @@ function tokenize5(q) {
112280
112295
  return tokens3;
112281
112296
  }
112282
112297
  var WORD = /[\p{L}\p{N}]+/gu;
112283
- var words3 = (text24) => text24.toLowerCase().match(WORD) ?? [];
112298
+ var words3 = (text25) => text25.toLowerCase().match(WORD) ?? [];
112284
112299
  function containsWords(haystack, needle) {
112285
112300
  const want = words3(needle);
112286
112301
  if (!want.length) return true;
@@ -113352,7 +113367,7 @@ ${root3}`;
113352
113367
  function parseXml(source) {
113353
113368
  const root3 = { name: "#document", children: [], text: "" };
113354
113369
  const stack = [root3];
113355
- const decode7 = (text24) => text24.replace(/&(lt|gt|amp|quot|apos|#\d+|#x[0-9a-fA-F]+);/g, (_, entity3) => entity3 === "lt" ? "<" : entity3 === "gt" ? ">" : entity3 === "amp" ? "&" : entity3 === "quot" ? '"' : entity3 === "apos" ? "'" : String.fromCodePoint(entity3[1] === "x" ? parseInt(entity3.slice(2), 16) : parseInt(entity3.slice(1), 10)));
113370
+ const decode7 = (text25) => text25.replace(/&(lt|gt|amp|quot|apos|#\d+|#x[0-9a-fA-F]+);/g, (_, entity3) => entity3 === "lt" ? "<" : entity3 === "gt" ? ">" : entity3 === "amp" ? "&" : entity3 === "quot" ? '"' : entity3 === "apos" ? "'" : String.fromCodePoint(entity3[1] === "x" ? parseInt(entity3.slice(2), 16) : parseInt(entity3.slice(1), 10)));
113356
113371
  const body6 = source.replace(/^?\s*<\?xml[^>]*\?>/, "").replace(/<!--[\s\S]*?-->/g, "");
113357
113372
  const pattern = /<!\[CDATA\[([\s\S]*?)\]\]>|<(\/?)([A-Za-z_][\w:.-]*)((?:\s+[^\s=>/]+\s*=\s*(?:"[^"]*"|'[^']*'))*)\s*(\/?)>/g;
113358
113373
  let last = 0, match3;
@@ -114763,7 +114778,7 @@ function connection2(r2, type, rows7, args, toObj) {
114763
114778
  }
114764
114779
  };
114765
114780
  }
114766
- var slug3 = (text24) => text24.toLowerCase().normalize("NFD").replace(new RegExp("\\p{M}", "gu"), "").replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 60);
114781
+ var slug3 = (text25) => text25.toLowerCase().normalize("NFD").replace(new RegExp("\\p{M}", "gu"), "").replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 60);
114767
114782
  var initials = (name5) => name5.split(/\s+/).filter(Boolean).map((w2) => w2[0].toUpperCase()).slice(0, 2).join("");
114768
114783
  var identifier3 = (r2, row2) => `${teamById(r2.ctx, row2.team_id).key}-${row2.number}`;
114769
114784
  var issueUrl = (r2, row2) => `https://linear.app/${r2.org.url_key}/issue/${identifier3(r2, row2)}/${slug3(row2.title)}`;
@@ -115339,7 +115354,7 @@ var Abort = class extends Error {
115339
115354
  var authError = (message8) => error62(message8, { type: "authentication error", code: "AUTHENTICATION_ERROR", userPresentableMessage: "You need to authenticate to access this operation." }, 401);
115340
115355
  async function handleGraphql2(c) {
115341
115356
  const ctx = c.env.ctx;
115342
- const text24 = await c.req.text();
115357
+ const text25 = await c.req.text();
115343
115358
  try {
115344
115359
  const viewerId = withRead(ctx, () => {
115345
115360
  const header3 = (c.req.header("authorization") ?? "").trim();
@@ -115351,7 +115366,7 @@ async function handleGraphql2(c) {
115351
115366
  if (viewerId === null) return errors(401, [authError("Authentication failed: the API key is invalid")]);
115352
115367
  let body6;
115353
115368
  try {
115354
- body6 = JSON.parse(text24);
115369
+ body6 = JSON.parse(text25);
115355
115370
  } catch {
115356
115371
  return errors(400, [error62("Body is not valid JSON", { type: "graphql error", code: "BAD_REQUEST" }, 400)]);
115357
115372
  }
@@ -116561,8 +116576,8 @@ function listLogs2(call2) {
116561
116576
  let events3 = call2.ctx.store.db.prepare("SELECT * FROM okta_logs WHERE published_ms >= ? AND published_ms < ? ORDER BY seq").all(since, until).map((row2) => ({ row: row2, json: eventJson(call2.ctx, row2) }));
116562
116577
  if (filter4) events3 = events3.filter(({ json: json33 }) => filter4(lookupIn(json33)));
116563
116578
  if (words6.length) events3 = events3.filter(({ json: json33 }) => {
116564
- const text24 = JSON.stringify(json33).toLowerCase();
116565
- return words6.every((word) => text24.includes(word));
116579
+ const text25 = JSON.stringify(json33).toLowerCase();
116580
+ return words6.every((word) => text25.includes(word));
116566
116581
  });
116567
116582
  if (order6 === "DESCENDING") events3.reverse();
116568
116583
  const { page: page18, headers } = paginate3(call2, events3, (entry2) => String(entry2.row.seq), limitOf(query10.get("limit"), 100, 1e3));
@@ -116621,11 +116636,11 @@ async function handle9(c) {
116621
116636
  const error64 = new OktaError(404, "E0000007", `Not found: Resource not found: ${url4.pathname} (Resource)`, [gapMessage(c)]);
116622
116637
  return respond2(base4, 404, errorBody4(error64, requestId4), { [GAP_HEADER]: "1" });
116623
116638
  }
116624
- const text24 = method2 === "GET" || method2 === "DELETE" ? "" : await c.req.text();
116639
+ const text25 = method2 === "GET" || method2 === "DELETE" ? "" : await c.req.text();
116625
116640
  let body6;
116626
- if (text24.trim()) {
116641
+ if (text25.trim()) {
116627
116642
  try {
116628
- body6 = JSON.parse(text24);
116643
+ body6 = JSON.parse(text25);
116629
116644
  } catch {
116630
116645
  throw new OktaError(400, "E0000003", "The request body was not well-formed.");
116631
116646
  }
@@ -120068,7 +120083,7 @@ function bool4(value4, name5) {
120068
120083
  if (value4 === "true" || value4 === "false") return value4 === "true";
120069
120084
  throw invalid14(name5);
120070
120085
  }
120071
- function text16(value4, name5, max = 256) {
120086
+ function text17(value4, name5, max = 256) {
120072
120087
  if (value4 === void 0 || value4 === null) return void 0;
120073
120088
  if (typeof value4 !== "string" || value4.length > max) throw invalid14(name5);
120074
120089
  return value4;
@@ -120343,7 +120358,7 @@ function createUser2(call2) {
120343
120358
  const email11 = String(emails[0]).trim().toLowerCase();
120344
120359
  if (!EMAIL15.test(email11)) throw invalid14("email_address");
120345
120360
  if (ctx.store.db.prepare("SELECT 1 FROM clerk_users WHERE email = ?").get(email11)) throw taken("email_address", "email address");
120346
- const username2 = text16(body6.username, "username", 64);
120361
+ const username2 = text17(body6.username, "username", 64);
120347
120362
  if (username2 !== void 0) {
120348
120363
  if (!/^[A-Za-z0-9_-]{4,64}$/.test(username2)) throw new ClerkError(422, "form_username_invalid_character", "Usernames can only contain letters, numbers, underscores and dashes.", "Usernames can only contain letters, numbers, underscores and dashes.", { param_name: "username" });
120349
120364
  if (ctx.store.db.prepare("SELECT 1 FROM clerk_users WHERE username = ?").get(username2)) throw taken("username", "username");
@@ -120356,10 +120371,10 @@ function createUser2(call2) {
120356
120371
  email: email11,
120357
120372
  email_id: newId2(ctx.ids, "idn"),
120358
120373
  email_strategy: "admin",
120359
- first_name: text16(body6.first_name, "first_name") ?? null,
120360
- last_name: text16(body6.last_name, "last_name") ?? null,
120374
+ first_name: text17(body6.first_name, "first_name") ?? null,
120375
+ last_name: text17(body6.last_name, "last_name") ?? null,
120361
120376
  username: username2 ?? null,
120362
- external_id: text16(body6.external_id, "external_id") ?? null,
120377
+ external_id: text17(body6.external_id, "external_id") ?? null,
120363
120378
  password_enabled: password === void 0 ? 0 : 1,
120364
120379
  banned: 0,
120365
120380
  locked: 0,
@@ -120414,11 +120429,11 @@ function updateUser2(call2) {
120414
120429
  ["primary_phone_number_id", "primary_web3_wallet_id", "profile_image_id", "password_digest", "password_hasher", "totp_secret", "backup_codes", "create_organizations_limit", "created_at", "notify_primary_email_address_changed"]
120415
120430
  );
120416
120431
  const user8 = userFor2(call2), next2 = { ...user8, updated_ms: ctx.clock.nowMs() };
120417
- if ("first_name" in body6) next2.first_name = text16(body6.first_name, "first_name") ?? null;
120418
- if ("last_name" in body6) next2.last_name = text16(body6.last_name, "last_name") ?? null;
120419
- if ("external_id" in body6) next2.external_id = text16(body6.external_id, "external_id") ?? null;
120432
+ if ("first_name" in body6) next2.first_name = text17(body6.first_name, "first_name") ?? null;
120433
+ if ("last_name" in body6) next2.last_name = text17(body6.last_name, "last_name") ?? null;
120434
+ if ("external_id" in body6) next2.external_id = text17(body6.external_id, "external_id") ?? null;
120420
120435
  if ("username" in body6) {
120421
- const username2 = text16(body6.username, "username", 64) ?? null;
120436
+ const username2 = text17(body6.username, "username", 64) ?? null;
120422
120437
  if (username2 !== null && username2 !== user8.username && ctx.store.db.prepare("SELECT 1 FROM clerk_users WHERE username = ?").get(username2)) throw taken("username", "username");
120423
120438
  next2.username = username2;
120424
120439
  }
@@ -120506,7 +120521,7 @@ function createOrg(call2) {
120506
120521
  const { ctx } = call2;
120507
120522
  params5(call2, []);
120508
120523
  const body6 = fields7(call2, ["name", "slug", "created_by", "max_allowed_memberships", "public_metadata", "private_metadata"], ["role_set_key"]);
120509
- const name5 = text16(body6.name, "name");
120524
+ const name5 = text17(body6.name, "name");
120510
120525
  if (!name5?.trim()) throw missing3("name");
120511
120526
  const slug10 = checkSlug(ctx, body6.slug ?? slugify2(name5));
120512
120527
  const creator = body6.created_by === void 0 ? void 0 : getUser6(ctx, String(body6.created_by));
@@ -120541,7 +120556,7 @@ function updateOrg(call2) {
120541
120556
  const body6 = fields7(call2, ["name", "slug", "max_allowed_memberships", "admin_delete_enabled", "public_metadata", "private_metadata"]);
120542
120557
  const org5 = orgFor(call2), next2 = { ...org5, updated_ms: ctx.clock.nowMs() };
120543
120558
  if (body6.name !== void 0) {
120544
- const name5 = text16(body6.name, "name");
120559
+ const name5 = text17(body6.name, "name");
120545
120560
  if (!name5?.trim()) throw invalid14("name");
120546
120561
  next2.name = name5;
120547
120562
  }
@@ -120783,12 +120798,12 @@ async function handle11(c) {
120783
120798
  if (clerkRoutes.some((candidate) => candidate.pattern.test(url4.pathname))) unsupported15(`${method2} ${url4.pathname}`);
120784
120799
  return errorResponse7(new ClerkError(404, "resource_not_found", "not found", gapMessage(c)), traceId, { [GAP_HEADER]: "1" });
120785
120800
  }
120786
- const text24 = method2 === "GET" ? "" : await c.req.text();
120801
+ const text25 = method2 === "GET" ? "" : await c.req.text();
120787
120802
  let body6 = {};
120788
- if (text24.trim()) {
120803
+ if (text25.trim()) {
120789
120804
  let parsed3;
120790
120805
  try {
120791
- parsed3 = JSON.parse(text24);
120806
+ parsed3 = JSON.parse(text25);
120792
120807
  } catch {
120793
120808
  throw new ClerkError(400, "malformed_request", "malformed request", "The request body is not valid JSON.");
120794
120809
  }
@@ -121576,12 +121591,12 @@ async function handle12(c) {
121576
121591
  response5.headers.set(GAP_HEADER, "1");
121577
121592
  return response5;
121578
121593
  }
121579
- const text24 = method2 === "GET" || method2 === "DELETE" ? "" : await c.req.text();
121594
+ const text25 = method2 === "GET" || method2 === "DELETE" ? "" : await c.req.text();
121580
121595
  let body6 = {};
121581
- if (text24.trim() && !route12.public) {
121596
+ if (text25.trim() && !route12.public) {
121582
121597
  let parsed3;
121583
121598
  try {
121584
- parsed3 = JSON.parse(text24);
121599
+ parsed3 = JSON.parse(text25);
121585
121600
  } catch {
121586
121601
  throw new BetterStackError(400, "Invalid JSON in the request body");
121587
121602
  }
@@ -121912,8 +121927,8 @@ function handle13(route12) {
121912
121927
  if (!known2) throw new Error(`no Notion parameter list for ${key4}`);
121913
121928
  return async (c) => {
121914
121929
  const ctx = c.env.ctx;
121915
- const text24 = route12.method === "POST" || route12.method === "PATCH" ? await c.req.text() : "";
121916
- const rid = requestId2(ctx, c, text24);
121930
+ const text25 = route12.method === "POST" || route12.method === "PATCH" ? await c.req.text() : "";
121931
+ const rid = requestId2(ctx, c, text25);
121917
121932
  try {
121918
121933
  const run3 = () => {
121919
121934
  const token4 = /^Bearer\s+(\S+)$/i.exec(c.req.header("authorization") ?? "")?.[1];
@@ -121924,10 +121939,10 @@ function handle13(route12) {
121924
121939
  if (!/^\d{4}-\d{2}-\d{2}$/.test(version5)) throw new NotionError(400, "validation_error", `Notion-Version header failed validation: Notion-Version header should be a valid version, instead was \`"${version5}"\`.`);
121925
121940
  if (version5 < NOTION_VERSION) unsupported17(`Notion-Version ${version5}; the twin serves ${NOTION_VERSION} shapes (data sources)`);
121926
121941
  let body6 = {};
121927
- if (text24.trim()) {
121942
+ if (text25.trim()) {
121928
121943
  let parsed3;
121929
121944
  try {
121930
- parsed3 = JSON.parse(text24);
121945
+ parsed3 = JSON.parse(text25);
121931
121946
  } catch {
121932
121947
  throw new NotionError(400, "invalid_json", "Error parsing JSON body.");
121933
121948
  }
@@ -122146,12 +122161,12 @@ function blockFromInput(ctx, input5, path4) {
122146
122161
  if (type === void 0) shouldBe(`${path4}.type`, "defined", void 0);
122147
122162
  if (!NOTION_BLOCK_TYPES.includes(type)) return unsupported17(`block type ${type}`);
122148
122163
  const body6 = block2[type] ?? {};
122149
- const text24 = () => richText(ctx, body6.rich_text ?? [], `${path4}.${type}.rich_text`);
122164
+ const text25 = () => richText(ctx, body6.rich_text ?? [], `${path4}.${type}.rich_text`);
122150
122165
  const color2 = body6.color ?? "default";
122151
122166
  const content2 = type === "divider" ? {} : type === "bookmark" ? (() => {
122152
122167
  if (typeof body6.url !== "string") shouldBe(`${path4}.bookmark.url`, "a string", body6.url);
122153
122168
  return { caption: [], url: body6.url };
122154
- })() : type === "code" ? { caption: [], rich_text: text24(), language: body6.language ?? "plain text" } : type === "to_do" ? { rich_text: text24(), checked: !!body6.checked, color: color2 } : type === "callout" ? { rich_text: text24(), icon: body6.icon ?? { type: "emoji", emoji: "\u{1F4A1}" }, color: color2 } : type.startsWith("heading_") ? { rich_text: text24(), is_toggleable: !!body6.is_toggleable, color: color2 } : { rich_text: text24(), color: color2 };
122169
+ })() : type === "code" ? { caption: [], rich_text: text25(), language: body6.language ?? "plain text" } : type === "to_do" ? { rich_text: text25(), checked: !!body6.checked, color: color2 } : type === "callout" ? { rich_text: text25(), icon: body6.icon ?? { type: "emoji", emoji: "\u{1F4A1}" }, color: color2 } : type.startsWith("heading_") ? { rich_text: text25(), is_toggleable: !!body6.is_toggleable, color: color2 } : { rich_text: text25(), color: color2 };
122155
122170
  const nested = body6.children ?? [];
122156
122171
  if (!Array.isArray(nested)) shouldBe(`${path4}.${type}.children`, "an array", nested);
122157
122172
  return { type, content: content2, children: nested };
@@ -122900,16 +122915,16 @@ function limitOffset(value4, fallback = 500) {
122900
122915
  function handle14(route12) {
122901
122916
  return async (c) => {
122902
122917
  const ctx = c.env.ctx;
122903
- const text24 = ["POST", "PUT", "PATCH"].includes(route12.method) ? await c.req.text() : "";
122918
+ const text25 = ["POST", "PUT", "PATCH"].includes(route12.method) ? await c.req.text() : "";
122904
122919
  try {
122905
122920
  const go = () => {
122906
122921
  const token4 = /^Bearer\s+(\S+)$/i.exec(c.req.header("authorization") ?? "")?.[1];
122907
122922
  const row2 = token4 ? ctx.store.db.prepare("SELECT member_id FROM attio_tokens WHERE token = ?").get(token4) : void 0;
122908
122923
  if (!row2) throw new AttioError(401, "auth_error", "unauthorized", "Your API token is invalid or has been revoked.");
122909
122924
  let body6 = {};
122910
- if (text24.trim()) {
122925
+ if (text25.trim()) {
122911
122926
  try {
122912
- body6 = JSON.parse(text24);
122927
+ body6 = JSON.parse(text25);
122913
122928
  } catch {
122914
122929
  invalid17("Body payload validation error: the body is not valid JSON.");
122915
122930
  }
@@ -124704,7 +124719,7 @@ function page7(items, query10) {
124704
124719
  function handle16(route12) {
124705
124720
  return async (c) => {
124706
124721
  const ctx = c.env.ctx;
124707
- const text24 = route12.method === "POST" || route12.method === "PATCH" ? await c.req.text() : "";
124722
+ const text25 = route12.method === "POST" || route12.method === "PATCH" ? await c.req.text() : "";
124708
124723
  try {
124709
124724
  const go = () => {
124710
124725
  const header3 = c.req.header("authorization");
@@ -124714,9 +124729,9 @@ function handle16(route12) {
124714
124729
  if (!key4) throw new ResendError(403, "invalid_api_key", "API key is invalid");
124715
124730
  if (key4.permission === "sending_access" && !route12.sending) throw new ResendError(401, "restricted_api_key", "This API key is restricted to only send emails");
124716
124731
  let body6 = {};
124717
- if (text24.trim()) {
124732
+ if (text25.trim()) {
124718
124733
  try {
124719
- body6 = JSON.parse(text24);
124734
+ body6 = JSON.parse(text25);
124720
124735
  } catch {
124721
124736
  invalid18("Invalid JSON in the request body.", "validation_error", 400);
124722
124737
  }
@@ -124726,7 +124741,7 @@ function handle16(route12) {
124726
124741
  if (keyHeader !== void 0) {
124727
124742
  if (!keyHeader || keyHeader.length > 256) invalid18("The idempotency key must be between 1 and 256 characters.", "invalid_idempotency_key", 400);
124728
124743
  const fingerprint = createHash37("sha256").update(`${route12.path}
124729
- ${text24}`).digest("hex");
124744
+ ${text25}`).digest("hex");
124730
124745
  const seen = ctx.store.db.prepare("SELECT fingerprint, body FROM resend_idempotency WHERE key = ?").get(keyHeader);
124731
124746
  if (seen) {
124732
124747
  if (seen.fingerprint !== fingerprint) throw new ResendError(409, "invalid_idempotent_request", "Same idempotency key used with a different request payload. Change your idempotency key or payload.");
@@ -124795,10 +124810,10 @@ var UNIT_MS = { min: 6e4, minute: 6e4, hr: 36e5, hour: 36e5, day: 864e5, week: 6
124795
124810
  function scheduleTime(r2, value4) {
124796
124811
  if (value4 === void 0 || value4 === null) invalid18("Missing `scheduled_at` field.", "missing_required_field");
124797
124812
  if (typeof value4 !== "string") invalid18("The `scheduled_at` field must be a string.");
124798
- const now11 = r2.ctx.clock.nowMs(), text24 = value4.trim();
124799
- const relative2 = /^in\s+(\d{1,6})\s+(min|minute|hr|hour|day|week)s?$/i.exec(text24);
124800
- const iso22 = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/i.exec(text24);
124801
- const ms = relative2 ? now11 + Number(relative2[1]) * UNIT_MS[relative2[2].toLowerCase()] : iso22 ? Date.parse(iso22[1] && !iso22[2] ? `${text24}Z` : text24) : unsupported20(`scheduled_at in natural language ("${text24}")`);
124813
+ const now11 = r2.ctx.clock.nowMs(), text25 = value4.trim();
124814
+ const relative2 = /^in\s+(\d{1,6})\s+(min|minute|hr|hour|day|week)s?$/i.exec(text25);
124815
+ const iso22 = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/i.exec(text25);
124816
+ const ms = relative2 ? now11 + Number(relative2[1]) * UNIT_MS[relative2[2].toLowerCase()] : iso22 ? Date.parse(iso22[1] && !iso22[2] ? `${text25}Z` : text25) : unsupported20(`scheduled_at in natural language ("${text25}")`);
124802
124817
  if (!Number.isFinite(ms)) invalid18("The `scheduled_at` field must be a valid date.");
124803
124818
  if (ms <= now11) invalid18("The `scheduled_at` field must be a date in the future.");
124804
124819
  if (ms > now11 + 30 * 864e5) invalid18("The `scheduled_at` field must be within the next 30 days.");
@@ -125406,8 +125421,8 @@ function zip(files2, modifiedMs) {
125406
125421
  const dosDate = date10.getUTCFullYear() - 1980 << 9 | date10.getUTCMonth() + 1 << 5 | date10.getUTCDate();
125407
125422
  const locals = [], centrals = [];
125408
125423
  let offset17 = 0;
125409
- for (const [name5, text24] of files2) {
125410
- const raw3 = Buffer.from(text24, "utf8"), data5 = deflateRawSync(raw3), nameBytes = Buffer.from(name5, "utf8"), checksum2 = crc322(raw3);
125424
+ for (const [name5, text25] of files2) {
125425
+ const raw3 = Buffer.from(text25, "utf8"), data5 = deflateRawSync(raw3), nameBytes = Buffer.from(name5, "utf8"), checksum2 = crc322(raw3);
125411
125426
  const local2 = Buffer.alloc(30);
125412
125427
  local2.writeUInt32LE(67324752, 0);
125413
125428
  local2.writeUInt16LE(20, 4);
@@ -125469,7 +125484,7 @@ function unzip(bytes2) {
125469
125484
  var DOCX_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
125470
125485
  function buildDocx(paragraphs, properties3) {
125471
125486
  const iso22 = (ms) => new Date(ms).toISOString().replace(/\.\d{3}Z$/, "Z");
125472
- const body6 = paragraphs.map((text24) => `<w:p><w:r><w:t xml:space="preserve">${escapeXml2(text24)}</w:t></w:r></w:p>`).join("");
125487
+ const body6 = paragraphs.map((text25) => `<w:p><w:r><w:t xml:space="preserve">${escapeXml2(text25)}</w:t></w:r></w:p>`).join("");
125473
125488
  return zip([
125474
125489
  ["[Content_Types].xml", '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/></Types>'],
125475
125490
  ["_rels/.rels", '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/></Relationships>'],
@@ -125487,20 +125502,20 @@ function docxParagraphs(bytes2) {
125487
125502
  function buildPdf(lines, title2) {
125488
125503
  const pages = [];
125489
125504
  for (let i = 0; i < Math.max(lines.length, 1); i += 50) pages.push(lines.slice(i, i + 50));
125490
- const text24 = (value4) => value4.replace(/[^\x20-\x7e]/g, "?").replace(/([\\()])/g, "\\$1");
125505
+ const text25 = (value4) => value4.replace(/[^\x20-\x7e]/g, "?").replace(/([\\()])/g, "\\$1");
125491
125506
  const objects = [];
125492
125507
  objects.push("<< /Type /Catalog /Pages 2 0 R >>");
125493
125508
  objects.push(`<< /Type /Pages /Kids [${pages.map((_, i) => `${4 + i * 2} 0 R`).join(" ")}] /Count ${pages.length} >>`);
125494
125509
  objects.push("<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>");
125495
125510
  pages.forEach((page18, i) => {
125496
- const stream = `BT /F1 11 Tf 72 750 Td 14 TL ${page18.map((line2) => `(${text24(line2)}) '`).join(" ")} ET`;
125511
+ const stream = `BT /F1 11 Tf 72 750 Td 14 TL ${page18.map((line2) => `(${text25(line2)}) '`).join(" ")} ET`;
125497
125512
  objects.push(`<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Resources << /Font << /F1 3 0 R >> >> /Contents ${5 + i * 2} 0 R >>`);
125498
125513
  objects.push(`<< /Length ${Buffer.byteLength(stream)} >>
125499
125514
  stream
125500
125515
  ${stream}
125501
125516
  endstream`);
125502
125517
  });
125503
- objects.push(`<< /Title (${text24(title2)}) /Producer (Ancha) >>`);
125518
+ objects.push(`<< /Title (${text25(title2)}) /Producer (Ancha) >>`);
125504
125519
  let out = "%PDF-1.4\n";
125505
125520
  const offsets = objects.map((body6, i) => {
125506
125521
  const at3 = Buffer.byteLength(out);
@@ -126172,9 +126187,9 @@ function search7(call2, query10) {
126172
126187
  };
126173
126188
  visit4(scope2);
126174
126189
  const matches9 = all9.filter((item2) => {
126175
- const text24 = `${item2.name}
126190
+ const text25 = `${item2.name}
126176
126191
  ${textOf2(item2) ?? ""}`.toLowerCase();
126177
- return tokens3.every((token4) => text24.includes(token4));
126192
+ return tokens3.every((token4) => text25.includes(token4));
126178
126193
  });
126179
126194
  const response5 = collection(call2, "Collection(driveItem)", matches9);
126180
126195
  return response5;
@@ -127177,12 +127192,12 @@ function childrenOf3(ctx, parent2, kind) {
127177
127192
  return ctx.store.db.prepare("SELECT json FROM shopify_objects WHERE parent = ? AND kind = ? ORDER BY num").all(parent2, kind).map((r2) => JSON.parse(r2.json));
127178
127193
  }
127179
127194
  function cents4(value4) {
127180
- const text24 = typeof value4 === "number" ? String(value4) : value4;
127181
- if (typeof text24 !== "string" || !/^-?\d{1,12}(\.\d+)?$/.test(text24.trim())) return null;
127182
- const [whole2, frac = ""] = text24.trim().replace("-", "").split(".");
127195
+ const text25 = typeof value4 === "number" ? String(value4) : value4;
127196
+ if (typeof text25 !== "string" || !/^-?\d{1,12}(\.\d+)?$/.test(text25.trim())) return null;
127197
+ const [whole2, frac = ""] = text25.trim().replace("-", "").split(".");
127183
127198
  if (/[1-9]/.test(frac.slice(2))) return null;
127184
127199
  const n2 = Number(whole2) * 100 + Number(frac.slice(0, 2).padEnd(2, "0"));
127185
- return text24.trim().startsWith("-") ? -n2 : n2;
127200
+ return text25.trim().startsWith("-") ? -n2 : n2;
127186
127201
  }
127187
127202
  function decimal2(c) {
127188
127203
  const sign3 = c < 0 ? "-" : "", abs = Math.abs(c), frac = String(abs % 100).padStart(2, "0").replace(/0$/, "");
@@ -127411,7 +127426,7 @@ function compare7(op, a, b) {
127411
127426
  return a >= b;
127412
127427
  }
127413
127428
  }
127414
- var wordsOf = (text24) => text24.toLowerCase().split(/[^\p{L}\p{N}*]+/u).filter(Boolean);
127429
+ var wordsOf = (text25) => text25.toLowerCase().split(/[^\p{L}\p{N}*]+/u).filter(Boolean);
127415
127430
  function textMatch(values2, wanted, contains3, words6 = false) {
127416
127431
  const options3 = wanted.split(",").map((v) => v.trim().toLowerCase()).filter(Boolean);
127417
127432
  return values2.some((raw3) => {
@@ -127790,8 +127805,8 @@ function productShape(req, p2) {
127790
127805
  descriptionHtml: p2.description_html,
127791
127806
  bodyHtml: p2.description_html,
127792
127807
  description: ({ truncateAt }) => {
127793
- const text24 = stripHtml(p2.description_html);
127794
- return typeof truncateAt === "number" && text24.length > truncateAt ? `${text24.slice(0, Math.max(0, truncateAt - 3)).trimEnd()}...` : text24;
127808
+ const text25 = stripHtml(p2.description_html);
127809
+ return typeof truncateAt === "number" && text25.length > truncateAt ? `${text25.slice(0, Math.max(0, truncateAt - 3)).trimEnd()}...` : text25;
127795
127810
  },
127796
127811
  vendor: p2.vendor,
127797
127812
  productType: p2.product_type,
@@ -128615,7 +128630,7 @@ function mutationRoot(req) {
128615
128630
  customerCreate: ({ input: input5 }) => customerWrite(req, input5, true)
128616
128631
  };
128617
128632
  }
128618
- var slug6 = (text24) => text24.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 255) || "product";
128633
+ var slug6 = (text25) => text25.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 255) || "product";
128619
128634
  function retag(req, id14, tags4, apply2) {
128620
128635
  const target5 = checkId(id14), kind = kindOf(target5);
128621
128636
  if (!["Order", "Customer", "Product"].includes(kind)) gap5(`tags on ${kind}`);
@@ -128956,17 +128971,17 @@ async function handleGraphql3(c) {
128956
128971
  const version5 = asked !== "unstable" && asked < "2026-01" ? "2026-01" : asked;
128957
128972
  if (!API_VERSIONS.includes(version5)) return respond4(404, { errors: "Not Found" });
128958
128973
  const headers = { "x-shopify-api-version": version5 };
128959
- const text24 = await c.req.text();
128974
+ const text25 = await c.req.text();
128960
128975
  try {
128961
128976
  const token4 = c.req.header("x-shopify-access-token");
128962
128977
  const known2 = !!token4 && withRead(ctx, () => !!ctx.store.db.prepare("SELECT 1 FROM shopify_tokens WHERE token = ?").get(token4));
128963
128978
  if (!known2) return respond4(401, { errors: "[API] Invalid API key or access token (unrecognized login or wrong password)" }, headers);
128964
128979
  let body6;
128965
- if ((c.req.header("content-type") ?? "").includes("application/graphql")) body6 = { query: text24 };
128980
+ if ((c.req.header("content-type") ?? "").includes("application/graphql")) body6 = { query: text25 };
128966
128981
  else {
128967
128982
  let parsed3;
128968
128983
  try {
128969
- parsed3 = JSON.parse(text24);
128984
+ parsed3 = JSON.parse(text25);
128970
128985
  } catch {
128971
128986
  return respond4(400, { errors: { query: "Required parameter missing or invalid" } }, headers);
128972
128987
  }
@@ -129652,11 +129667,11 @@ function renderTemplate(html2, variables2) {
129652
129667
  return truthy2(value4(path4)) === (kind === "if") ? yes : no;
129653
129668
  });
129654
129669
  } while (out !== previous);
129655
- const text24 = (path4) => {
129670
+ const text25 = (path4) => {
129656
129671
  const item2 = value4(path4);
129657
129672
  return item2 === void 0 || item2 === null ? "" : typeof item2 === "object" ? JSON.stringify(item2) : String(item2);
129658
129673
  };
129659
- return out.replace(/\{\{\{\s*([\w.]+)\s*\}\}\}/g, (_, path4) => text24(path4)).replace(/\{\{\s*([\w.]+)\s*\}\}/g, (_, path4) => text24(path4).replace(/[&<>"']/g, (char) => ESCAPES[char]));
129674
+ return out.replace(/\{\{\{\s*([\w.]+)\s*\}\}\}/g, (_, path4) => text25(path4)).replace(/\{\{\s*([\w.]+)\s*\}\}/g, (_, path4) => text25(path4).replace(/[&<>"']/g, (char) => ESCAPES[char]));
129660
129675
  }
129661
129676
  function mergeKeys(html2) {
129662
129677
  const keys6 = /* @__PURE__ */ new Set();
@@ -129664,8 +129679,8 @@ function mergeKeys(html2) {
129664
129679
  return [...keys6];
129665
129680
  }
129666
129681
  function htmlLines(html2) {
129667
- const text24 = html2.replace(/<(style|script|head)\b[^>]*>[\s\S]*?<\/\1>/gi, "").replace(/<br\s*\/?>/gi, "\n").replace(/<\/(p|div|h[1-6]|li|tr|table|section|header|footer|address)>/gi, "\n").replace(/<[^>]+>/g, "").replace(/&nbsp;/g, " ").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;|&apos;/g, "'").replace(/&#(\d+);/g, (_, code2) => String.fromCodePoint(Number(code2))).replace(/&amp;/g, "&");
129668
- return text24.split("\n").map((line2) => line2.replace(/\s+/g, " ").trim()).filter(Boolean);
129682
+ const text25 = html2.replace(/<(style|script|head)\b[^>]*>[\s\S]*?<\/\1>/gi, "").replace(/<br\s*\/?>/gi, "\n").replace(/<\/(p|div|h[1-6]|li|tr|table|section|header|footer|address)>/gi, "\n").replace(/<[^>]+>/g, "").replace(/&nbsp;/g, " ").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;|&apos;/g, "'").replace(/&#(\d+);/g, (_, code2) => String.fromCodePoint(Number(code2))).replace(/&amp;/g, "&");
129683
+ return text25.split("\n").map((line2) => line2.replace(/\s+/g, " ").trim()).filter(Boolean);
129669
129684
  }
129670
129685
  var STEPS = { usps_first_class: [24, 36, 72, 96], usps_standard: [24, 72, 168, 216] };
129671
129686
  var FACILITIES = ["60126", "45246", "75261", "30320"];
@@ -130072,7 +130087,7 @@ function allowed(body6, known2, gaps2 = [], prefix2 = "") {
130072
130087
  if (!known2.includes(field5)) throw invalid21(`${prefix2}${field5} is not allowed`);
130073
130088
  }
130074
130089
  }
130075
- function text17(body6, field5, max, options3 = {}) {
130090
+ function text18(body6, field5, max, options3 = {}) {
130076
130091
  const value4 = body6[field5], name5 = `${options3.prefix ?? ""}${field5}`;
130077
130092
  if (value4 === void 0 || value4 === null || value4 === "") {
130078
130093
  if (options3.required) throw invalid21(`${name5} is required`);
@@ -130133,19 +130148,19 @@ function mergeVariablesOf(value4) {
130133
130148
  var ADDRESS_FIELDS = ["description", "name", "company", "phone", "email", "address_line1", "address_line2", "address_city", "address_state", "address_zip", "address_country", "metadata"];
130134
130149
  function addressInput(body6, prefix2 = "") {
130135
130150
  allowed(body6, ADDRESS_FIELDS, [], prefix2);
130136
- const at3 = { prefix: prefix2 }, country = (text17(body6, "address_country", 60, at3) ?? "US").toUpperCase();
130151
+ const at3 = { prefix: prefix2 }, country = (text18(body6, "address_country", 60, at3) ?? "US").toUpperCase();
130137
130152
  if (!countryName2(country)) throw invalid21(`${prefix2}address_country must be a valid ISO 3166 country code`);
130138
130153
  const input5 = {
130139
- description: text17(body6, "description", 255, at3),
130140
- name: text17(body6, "name", 40, at3),
130141
- company: text17(body6, "company", 40, at3),
130142
- phone: text17(body6, "phone", 40, at3),
130143
- email: text17(body6, "email", 100, at3),
130144
- line1: text17(body6, "address_line1", 64, { prefix: prefix2, required: true }),
130145
- line2: text17(body6, "address_line2", 64, at3),
130146
- city: text17(body6, "address_city", 200, at3),
130147
- state: text17(body6, "address_state", 200, at3),
130148
- zip: text17(body6, "address_zip", 40, at3),
130154
+ description: text18(body6, "description", 255, at3),
130155
+ name: text18(body6, "name", 40, at3),
130156
+ company: text18(body6, "company", 40, at3),
130157
+ phone: text18(body6, "phone", 40, at3),
130158
+ email: text18(body6, "email", 100, at3),
130159
+ line1: text18(body6, "address_line1", 64, { prefix: prefix2, required: true }),
130160
+ line2: text18(body6, "address_line2", 64, at3),
130161
+ city: text18(body6, "address_city", 200, at3),
130162
+ state: text18(body6, "address_state", 200, at3),
130163
+ zip: text18(body6, "address_zip", 40, at3),
130149
130164
  country,
130150
130165
  metadata: metadataOf(body6.metadata, prefix2)
130151
130166
  };
@@ -130310,12 +130325,12 @@ function listBanks(call2) {
130310
130325
  function createBank(call2) {
130311
130326
  const { ctx, body: body6 } = call2;
130312
130327
  allowed(body6, ["description", "routing_number", "account_number", "account_type", "signatory", "metadata"]);
130313
- const routing = text17(body6, "routing_number", 9, { required: true }), account9 = text17(body6, "account_number", 17, { required: true });
130328
+ const routing = text18(body6, "routing_number", 9, { required: true }), account9 = text18(body6, "account_number", 17, { required: true });
130314
130329
  if (!abaChecksum(routing)) throw invalid21("routing_number must be a valid ABA routing number");
130315
130330
  if (!/^\d+$/.test(account9)) throw invalid21("account_number must only contain digits");
130316
130331
  const type = choice(body6, "account_type", ["company", "individual"]);
130317
130332
  if (!type) throw invalid21("account_type is required");
130318
- const signatory = text17(body6, "signatory", 30, { required: true }), description2 = text17(body6, "description", 255), metadata7 = metadataOf(body6.metadata);
130333
+ const signatory = text18(body6, "signatory", 30, { required: true }), description2 = text18(body6, "description", 255), metadata7 = metadataOf(body6.metadata);
130319
130334
  const id14 = newId5(ctx, "bank"), now11 = ctx.clock.nowMs(), deposits = [ctx.ids.int(1, 99), ctx.ids.int(1, 99)];
130320
130335
  const known2 = ctx.store.db.prepare("SELECT bank_name FROM lob_bank_accounts WHERE routing_number = ? AND bank_name IS NOT NULL ORDER BY rowid LIMIT 1").get(routing);
130321
130336
  ctx.store.db.prepare(`INSERT INTO lob_bank_accounts (id, description, routing_number, account_number, account_type, signatory, bank_name, verified, deposits, metadata, created_ms, modified_ms, next_check)
@@ -130377,7 +130392,7 @@ function listTemplates(call2) {
130377
130392
  function createTemplate(call2) {
130378
130393
  const { ctx, body: body6 } = call2;
130379
130394
  allowed(body6, ["description", "html", "engine", "metadata"], ["required_vars"]);
130380
- const html2 = text17(body6, "html", 1e5, { required: true }), description2 = text17(body6, "description", 255), engine = choice(body6, "engine", ["legacy", "handlebars"]) ?? "legacy";
130395
+ const html2 = text18(body6, "html", 1e5, { required: true }), description2 = text18(body6, "description", 255), engine = choice(body6, "engine", ["legacy", "handlebars"]) ?? "legacy";
130381
130396
  const metadata7 = metadataOf(body6.metadata), id14 = newId5(ctx, "tmpl"), version5 = newId5(ctx, "vrsn"), now11 = ctx.clock.nowMs();
130382
130397
  ctx.store.db.prepare("INSERT INTO lob_templates (id, description, metadata, published, created_ms, modified_ms) VALUES (?, ?, ?, ?, ?, ?)").run(id14, description2, JSON.stringify(metadata7), version5, now11, now11);
130383
130398
  ctx.store.db.prepare("INSERT INTO lob_versions (id, template_id, description, html, engine, created_ms) VALUES (?, ?, ?, ?, ?, ?)").run(version5, id14, description2, html2, engine, now11);
@@ -130387,7 +130402,7 @@ var getTemplateRoute = (call2) => json19(templateJson(call2.ctx, liveTemplate(ca
130387
130402
  function updateTemplate(call2) {
130388
130403
  const { ctx, body: body6 } = call2, row2 = liveTemplate(ctx, call2.ids[0]);
130389
130404
  allowed(body6, ["description", "published_version"]);
130390
- const description2 = body6.description === void 0 ? row2.description : text17(body6, "description", 255), published = text17(body6, "published_version", 40) ?? row2.published;
130405
+ const description2 = body6.description === void 0 ? row2.description : text18(body6, "description", 255), published = text18(body6, "published_version", 40) ?? row2.published;
130391
130406
  if (getVersion(ctx, published)?.template_id !== row2.id) throw notFound12("template version");
130392
130407
  ctx.store.db.prepare("UPDATE lob_templates SET description = ?, published = ?, modified_ms = ? WHERE id = ?").run(description2, published, ctx.clock.nowMs(), row2.id);
130393
130408
  return json19(templateJson(ctx, getTemplate(ctx, row2.id)));
@@ -130538,7 +130553,7 @@ function createLetter(call2) {
130538
130553
  const perforated = integer7(body6.perforated_page, "perforated_page", 1, 1e3);
130539
130554
  if (perforated !== null && !returnEnvelope) throw invalid21("perforated_page requires return_envelope", "invalid_perforation_return_envelope");
130540
130555
  const doubleSided = flag3(body6, "double_sided") ?? true, placement = choice(body6, "address_placement", LOB_ADDRESS_PLACEMENTS) ?? "top_first_page";
130541
- const times = sendTimes(call2), description2 = text17(body6, "description", 255), metadata7 = metadataOf(body6.metadata), variables2 = mergeVariablesOf(body6.merge_variables);
130556
+ const times = sendTimes(call2), description2 = text18(body6, "description", 255), metadata7 = metadataOf(body6.metadata), variables2 = mergeVariablesOf(body6.merge_variables);
130542
130557
  const to = addressFor(call2, "to", true), from = addressFor(call2, "from", true);
130543
130558
  usOnly(from, "from");
130544
130559
  if (mailType === "usps_standard" && to.country !== "US") throw invalid21("usps_standard is only available for US addresses");
@@ -130569,7 +130584,7 @@ function createPostcard(call2) {
130569
130584
  filesAllowed(call2, ["front", "back"]);
130570
130585
  const useType = useTypeOf(body6), size2 = choice(body6, "size", LOB_POSTCARD_SIZES) ?? "4x6", mailType = choice(body6, "mail_type", LOB_MAIL_TYPES) ?? "usps_first_class";
130571
130586
  if (mailType === "usps_standard" && size2 === "4x6") throw invalid21("usps_standard cannot be used with 4x6 postcards");
130572
- const times = sendTimes(call2), description2 = text17(body6, "description", 255), metadata7 = metadataOf(body6.metadata), variables2 = mergeVariablesOf(body6.merge_variables);
130587
+ const times = sendTimes(call2), description2 = text18(body6, "description", 255), metadata7 = metadataOf(body6.metadata), variables2 = mergeVariablesOf(body6.merge_variables);
130573
130588
  const to = addressFor(call2, "to", true), from = addressFor(call2, "from", false);
130574
130589
  usOnly(from, "from");
130575
130590
  if (mailType === "usps_standard" && to.country !== "US") throw invalid21("usps_standard is only available for US addresses");
@@ -130596,15 +130611,15 @@ function createCheck(call2) {
130596
130611
  allowed(body6, [...MAIL_FIELDS, "bank_account", "amount", "memo", "message", "check_number", "logo", "check_bottom", "attachment"], ["billing_group_id"]);
130597
130612
  filesAllowed(call2, ["check_bottom", "attachment"]);
130598
130613
  const useType = useTypeOf(body6), mailType = choice(body6, "mail_type", ["usps_first_class"]) ?? "usps_first_class";
130599
- const bankId = text17(body6, "bank_account", 40, { required: true });
130614
+ const bankId = text18(body6, "bank_account", 40, { required: true });
130600
130615
  const raw3 = typeof body6.amount === "string" && /^\d+(\.\d+)?$/.test(body6.amount) ? Number(body6.amount) : body6.amount;
130601
130616
  if (raw3 === void 0 || raw3 === null || raw3 === "") throw invalid21("amount is required");
130602
130617
  if (typeof raw3 !== "number" || !Number.isFinite(raw3) || raw3 <= 0) throw invalid21("amount must be a positive number");
130603
130618
  if (raw3 > 999999.99) throw invalid21("amount must be less than or equal to 999999.99");
130604
130619
  if (Math.abs(raw3 * 100 - Math.round(raw3 * 100)) > 1e-6) throw invalid21("amount must have at most 2 decimal places");
130605
- const memo3 = text17(body6, "memo", 40), message8 = text17(body6, "message", 400), logo = text17(body6, "logo", 2048), requested2 = integer7(body6.check_number, "check_number", 1, 99999999);
130620
+ const memo3 = text18(body6, "memo", 40), message8 = text18(body6, "message", 400), logo = text18(body6, "logo", 2048), requested2 = integer7(body6.check_number, "check_number", 1, 99999999);
130606
130621
  if (logo !== null && !/^https?:\/\//i.test(logo)) throw invalid21("logo must be a URL");
130607
- const times = sendTimes(call2), description2 = text17(body6, "description", 255), metadata7 = metadataOf(body6.metadata), variables2 = mergeVariablesOf(body6.merge_variables);
130622
+ const times = sendTimes(call2), description2 = text18(body6, "description", 255), metadata7 = metadataOf(body6.metadata), variables2 = mergeVariablesOf(body6.merge_variables);
130608
130623
  const bank = liveBank(ctx, bankId);
130609
130624
  if (bank.verified !== 1) throw new LobError(403, "Bank account must be verified before it can be used to create checks", "unverified_bank_account");
130610
130625
  if (requested2 !== null && checkNumberUsed(ctx, bank.id, requested2)) throw invalid21(`check_number ${requested2} has already been used for this bank account`, "invalid_check_number");
@@ -130656,14 +130671,14 @@ var listMail = (kind) => (call2) => {
130656
130671
  var VERIFY_FIELDS = ["address", "recipient", "primary_line", "secondary_line", "urbanization", "city", "state", "zip_code"];
130657
130672
  function verificationInput(body6) {
130658
130673
  allowed(body6, VERIFY_FIELDS);
130659
- const recipient2 = text17(body6, "recipient", 500), urbanization = text17(body6, "urbanization", 500) ?? void 0, single2 = text17(body6, "address", 500);
130674
+ const recipient2 = text18(body6, "recipient", 500), urbanization = text18(body6, "urbanization", 500) ?? void 0, single2 = text18(body6, "address", 500);
130660
130675
  if (single2 !== null) return { recipient: recipient2, urbanization, ...splitAddressLine(single2) };
130661
- const line1 = text17(body6, "primary_line", 500);
130676
+ const line1 = text18(body6, "primary_line", 500);
130662
130677
  if (line1 === null) throw invalid21("primary_line is required or address is required");
130663
- const city = text17(body6, "city", 200) ?? void 0, state2 = text17(body6, "state", 100) ?? void 0, zip2 = text17(body6, "zip_code", 10) ?? void 0;
130678
+ const city = text18(body6, "city", 200) ?? void 0, state2 = text18(body6, "state", 100) ?? void 0, zip2 = text18(body6, "zip_code", 10) ?? void 0;
130664
130679
  if (zip2 && !/^\d{5}(-?\d{4})?$/.test(zip2)) throw invalid21("zip_code must be in a valid zip or zip+4 format");
130665
130680
  if (!zip2 && !(city && state2)) throw invalid21("zip_code is required or both city and state are required");
130666
- return { recipient: recipient2, urbanization, line1, line2: text17(body6, "secondary_line", 500) ?? void 0, city, state: state2, zip: zip2 };
130681
+ return { recipient: recipient2, urbanization, line1, line2: text18(body6, "secondary_line", 500) ?? void 0, city, state: state2, zip: zip2 };
130667
130682
  }
130668
130683
  function caseOf(call2) {
130669
130684
  const query10 = {};
@@ -130770,15 +130785,15 @@ async function readBody(c) {
130770
130785
  }
130771
130786
  return { body: body6, files: files2 };
130772
130787
  }
130773
- const text24 = await c.req.text();
130774
- if (!text24.trim()) return { body: body6, files: files2 };
130788
+ const text25 = await c.req.text();
130789
+ if (!text25.trim()) return { body: body6, files: files2 };
130775
130790
  if (/^application\/x-www-form-urlencoded/i.test(type)) {
130776
- for (const [name5, value4] of new URLSearchParams(text24)) setPath(body6, name5, value4);
130791
+ for (const [name5, value4] of new URLSearchParams(text25)) setPath(body6, name5, value4);
130777
130792
  return { body: body6, files: files2 };
130778
130793
  }
130779
130794
  let parsed3;
130780
130795
  try {
130781
- parsed3 = JSON.parse(text24);
130796
+ parsed3 = JSON.parse(text25);
130782
130797
  } catch {
130783
130798
  throw new LobError(400, "The request body is not valid JSON", "bad_request");
130784
130799
  }
@@ -130914,9 +130929,9 @@ function unsupported23(what) {
130914
130929
  throw new PayPalError(501, "NOT_IMPLEMENTED", `ancha: not implemented: ${what}`, [], true);
130915
130930
  }
130916
130931
  var json20 = (status4, body6, headers = {}) => body6 === null ? new Response(null, { status: status4, headers }) : new Response(JSON.stringify(body6), { status: status4, headers: { "content-type": "application/json", ...headers } });
130917
- var debugId = (c, text24) => createHash43("sha256").update(`${c.req.method} ${c.req.url}
130918
- ${text24}`).digest("hex").slice(0, 13);
130919
- function errorResponse12(c, text24, e) {
130932
+ var debugId = (c, text25) => createHash43("sha256").update(`${c.req.method} ${c.req.url}
130933
+ ${text25}`).digest("hex").slice(0, 13);
130934
+ function errorResponse12(c, text25, e) {
130920
130935
  const anchor2 = e.details[0]?.issue ?? e.code;
130921
130936
  return json20(
130922
130937
  e.status,
@@ -130924,7 +130939,7 @@ function errorResponse12(c, text24, e) {
130924
130939
  name: e.code,
130925
130940
  ...e.details.length && { details: e.details },
130926
130941
  message: e.message,
130927
- debug_id: debugId(c, text24),
130942
+ debug_id: debugId(c, text25),
130928
130943
  links: [{ href: `https://developer.paypal.com/api/rest/reference/orders/v2/errors/#${String(anchor2).toLowerCase()}`, rel: "information_link", method: "GET" }]
130929
130944
  },
130930
130945
  e.gap ? { [GAP_HEADER]: "1" } : {}
@@ -130946,16 +130961,16 @@ function authorize(c, ctx) {
130946
130961
  function handle19(route12) {
130947
130962
  return async (c) => {
130948
130963
  const ctx = c.env.ctx;
130949
- const text24 = route12.method === "GET" ? "" : await c.req.text();
130964
+ const text25 = route12.method === "GET" ? "" : await c.req.text();
130950
130965
  try {
130951
130966
  const denied = withRead(ctx, () => authorize(c, ctx));
130952
130967
  if (denied) return denied;
130953
130968
  if (c.req.header("paypal-mock-response")) unsupported23("PayPal-Mock-Response negative testing");
130954
130969
  let body6 = {};
130955
- if (text24.trim()) {
130970
+ if (text25.trim()) {
130956
130971
  let parsed3;
130957
130972
  try {
130958
- parsed3 = JSON.parse(text24);
130973
+ parsed3 = JSON.parse(text25);
130959
130974
  } catch {
130960
130975
  invalid22({ issue: "MALFORMED_REQUEST_JSON", description: "The request JSON is not well formed." });
130961
130976
  }
@@ -130981,7 +130996,7 @@ function handle19(route12) {
130981
130996
  } catch (error64) {
130982
130997
  if (ctx.signal?.aborted) return new Response(null, { status: 409 });
130983
130998
  if (!(error64 instanceof PayPalError)) throw error64;
130984
- return errorResponse12(c, text24, error64);
130999
+ return errorResponse12(c, text25, error64);
130985
131000
  }
130986
131001
  };
130987
131002
  }
@@ -130997,7 +131012,7 @@ var object14 = (v, field5) => {
130997
131012
  function keys5(o, allowed2, field5) {
130998
131013
  for (const key4 of Object.keys(o)) if (!allowed2.includes(key4)) unsupported23(`${field5}/${key4}`);
130999
131014
  }
131000
- function text18(v, field5, max) {
131015
+ function text19(v, field5, max) {
131001
131016
  if (typeof v !== "string" || !v.trim() || v.length > max) invalid22({ field: field5, issue: "INVALID_PARAMETER_VALUE", description: `Expected text of 1 to ${max} characters.`, location: "body" });
131002
131017
  return v;
131003
131018
  }
@@ -131025,7 +131040,7 @@ function invoiceFrom(ctx, body6) {
131025
131040
  keys5(detail3, ["currency_code", "invoice_number", "reference", "note", "terms_and_conditions", "memo"], "/detail");
131026
131041
  const currency = detail3.currency_code;
131027
131042
  if (!["USD", "EUR", "GBP", "CAD", "AUD"].includes(currency)) unsupported23(`invoice currency ${String(currency)}`);
131028
- for (const key4 of ["invoice_number", "reference", "note", "terms_and_conditions", "memo"]) if (detail3[key4] !== void 0) text18(detail3[key4], `/detail/${key4}`, key4 === "invoice_number" ? 25 : 4e3);
131043
+ for (const key4 of ["invoice_number", "reference", "note", "terms_and_conditions", "memo"]) if (detail3[key4] !== void 0) text19(detail3[key4], `/detail/${key4}`, key4 === "invoice_number" ? 25 : 4e3);
131029
131044
  if (detail3.invoice_number && allOf2(ctx, "invoice").some((i) => i.detail.invoice_number === detail3.invoice_number)) refused("DUPLICATE_INVOICE_NUMBER", "Invoice number must be unique.", "/detail/invoice_number");
131030
131045
  if (b.configuration !== void 0) {
131031
131046
  const c = object14(b.configuration, "/configuration");
@@ -131040,14 +131055,14 @@ function invoiceFrom(ctx, body6) {
131040
131055
  if (c.name !== void 0) {
131041
131056
  const n2 = object14(c.name, `${field5}/name`);
131042
131057
  keys5(n2, ["given_name", "surname", "full_name"], `${field5}/name`);
131043
- for (const [k, v3] of Object.entries(n2)) text18(v3, `${field5}/name/${k}`, 300);
131058
+ for (const [k, v3] of Object.entries(n2)) text19(v3, `${field5}/name/${k}`, 300);
131044
131059
  }
131045
131060
  if (c.address !== void 0) {
131046
131061
  const a = object14(c.address, `${field5}/address`);
131047
131062
  keys5(a, ["address_line_1", "address_line_2", "admin_area_1", "admin_area_2", "postal_code", "country_code"], `${field5}/address`);
131048
- for (const [k, v3] of Object.entries(a)) text18(v3, `${field5}/address/${k}`, 300);
131063
+ for (const [k, v3] of Object.entries(a)) text19(v3, `${field5}/address/${k}`, 300);
131049
131064
  }
131050
- if (c.business_name !== void 0) text18(c.business_name, `${field5}/business_name`, 300);
131065
+ if (c.business_name !== void 0) text19(c.business_name, `${field5}/business_name`, 300);
131051
131066
  return c;
131052
131067
  };
131053
131068
  const invoicer = b.invoicer === void 0 ? void 0 : contact(b.invoicer, "/invoicer");
@@ -131062,7 +131077,7 @@ function invoiceFrom(ctx, body6) {
131062
131077
  const items = b.items.map((raw3, index) => {
131063
131078
  const path4 = `/items/${index}`, i = object14(raw3, path4);
131064
131079
  keys5(i, ["name", "description", "quantity", "unit_amount", "tax", "discount", "unit_of_measure"], path4);
131065
- const name5 = text18(i.name, `${path4}/name`, 200), quantity = decimal3(i.quantity, `${path4}/quantity`);
131080
+ const name5 = text19(i.name, `${path4}/name`, 200), quantity = decimal3(i.quantity, `${path4}/quantity`);
131066
131081
  if (quantity <= 0 || quantity > 1e6) invalid22({ field: `${path4}/quantity`, issue: "INVALID_PARAMETER_VALUE", description: "Quantity must be positive and at most 10000." });
131067
131082
  const unit = money10(i.unit_amount, currency, `${path4}/unit_amount`), line2 = rounded(unit, quantity, 100);
131068
131083
  let discount = 0, tax = 0;
@@ -131080,12 +131095,12 @@ function invoiceFrom(ctx, body6) {
131080
131095
  if (i.tax !== void 0) {
131081
131096
  const t = object14(i.tax, `${path4}/tax`);
131082
131097
  keys5(t, ["name", "percent"], `${path4}/tax`);
131083
- text18(t.name, `${path4}/tax/name`, 100);
131098
+ text19(t.name, `${path4}/tax/name`, 100);
131084
131099
  const percent = decimal3(t.percent, `${path4}/tax/percent`);
131085
131100
  if (percent > 1e4) refused("INVALID_TAX_RATE", "Tax percent must be at most 100.");
131086
131101
  tax = rounded(line2 - discount, percent, 1e4);
131087
131102
  }
131088
- if (i.description !== void 0) text18(i.description, `${path4}/description`, 1e3);
131103
+ if (i.description !== void 0) text19(i.description, `${path4}/description`, 1e3);
131089
131104
  if (i.unit_of_measure !== void 0 && !["QUANTITY", "HOURS", "AMOUNT"].includes(i.unit_of_measure)) invalid22({ field: `${path4}/unit_of_measure`, issue: "INVALID_PARAMETER_VALUE", description: "Invalid unit of measure." });
131090
131105
  return { ...i, name: name5, cents: unit, line_cents: line2, discount_cents: discount, tax_cents: tax };
131091
131106
  });
@@ -131319,14 +131334,14 @@ function money11(input5, field5, currency) {
131319
131334
  return { currency: m.currency_code, cents: c };
131320
131335
  }
131321
131336
  function validateItemDetails(i, at3) {
131322
- const text24 = (input5, field5, min, max) => {
131337
+ const text25 = (input5, field5, min, max) => {
131323
131338
  if (typeof input5 !== "string") invalid22({ field: field5, location: "body", issue: "INVALID_PARAMETER_SYNTAX", description: "The value of a field does not conform to the expected format." });
131324
131339
  if (input5.length < min || input5.length > max) invalid22({ field: field5, location: "body", issue: "INVALID_STRING_LENGTH", description: "The length of a field is either too short or too long." });
131325
131340
  return input5;
131326
131341
  };
131327
- if (i.description !== void 0) text24(i.description, `${at3}/description`, 0, 2048);
131342
+ if (i.description !== void 0) text25(i.description, `${at3}/description`, 0, 2048);
131328
131343
  for (const key4 of ["url", "image_url"]) if (i[key4] !== void 0) {
131329
- const url4 = text24(i[key4], `${at3}/${key4}`, 1, 2048);
131344
+ const url4 = text25(i[key4], `${at3}/${key4}`, 1, 2048);
131330
131345
  try {
131331
131346
  new URL(url4);
131332
131347
  } catch {
@@ -131337,7 +131352,7 @@ function validateItemDetails(i, at3) {
131337
131352
  if (!i.upc || typeof i.upc !== "object" || Array.isArray(i.upc)) invalid22({ field: `${at3}/upc`, location: "body", issue: "INVALID_PARAMETER_SYNTAX", description: "The value of a field does not conform to the expected format." });
131338
131353
  for (const key4 of ["type", "code"]) if (i.upc[key4] === void 0) invalid22({ field: `${at3}/upc/${key4}`, location: "body", issue: "MISSING_REQUIRED_PARAMETER", description: "A required field / parameter is missing." });
131339
131354
  if (!["UPC-A", "UPC-B", "UPC-C", "UPC-D", "UPC-E", "UPC-2", "UPC-5"].includes(i.upc.type)) invalid22({ field: `${at3}/upc/type`, location: "body", issue: "INVALID_PARAMETER_VALUE", description: "The value of a field is invalid." });
131340
- if (!/^\d+$/.test(text24(i.upc.code, `${at3}/upc/code`, 6, 17))) invalid22({ field: `${at3}/upc/code`, location: "body", issue: "INVALID_PARAMETER_SYNTAX", description: "The value of a field does not conform to the expected format." });
131355
+ if (!/^\d+$/.test(text25(i.upc.code, `${at3}/upc/code`, 6, 17))) invalid22({ field: `${at3}/upc/code`, location: "body", issue: "INVALID_PARAMETER_SYNTAX", description: "The value of a field does not conform to the expected format." });
131341
131356
  }
131342
131357
  }
131343
131358
  function unitFrom(input5, index, count4) {
@@ -131998,7 +132013,7 @@ var billingRoutes = [
131998
132013
  ];
131999
132014
 
132000
132015
  // packages/server/src/twins/record-checks.ts
132001
- var containsText = (text24, want) => want === void 0 || (Array.isArray(want) ? want : [want]).every((s2) => text24.toLowerCase().includes(s2.toLowerCase()));
132016
+ var containsText = (text25, want) => want === void 0 || (Array.isArray(want) ? want : [want]).every((s2) => text25.toLowerCase().includes(s2.toLowerCase()));
132002
132017
  var localRef = (value4) => value4.slice(1).replace(/^[^.]+\./, "");
132003
132018
  var atStart = (created4, args, start2) => !args.after_start || created4 >= Date.parse(start2);
132004
132019
  function counted2(kind, args, matches9, candidates) {
@@ -132567,8 +132582,8 @@ function isAdf(value4) {
132567
132582
  const doc = value4;
132568
132583
  return !!doc && typeof doc === "object" && doc.type === "doc" && doc.version === 1 && Array.isArray(doc.content) && doc.content.every(ok);
132569
132584
  }
132570
- function textToAdf(text24) {
132571
- return { type: "doc", version: 1, content: text24.split(/\n\s*\n/).filter((p2) => p2.trim()).map((p2) => ({ type: "paragraph", content: p2.split("\n").flatMap((line2, i) => [...i ? [{ type: "hardBreak" }] : [], ...line2 ? [{ type: "text", text: line2 }] : []]) })) };
132585
+ function textToAdf(text25) {
132586
+ return { type: "doc", version: 1, content: text25.split(/\n\s*\n/).filter((p2) => p2.trim()).map((p2) => ({ type: "paragraph", content: p2.split("\n").flatMap((line2, i) => [...i ? [{ type: "hardBreak" }] : [], ...line2 ? [{ type: "text", text: line2 }] : []]) })) };
132572
132587
  }
132573
132588
  function adfToText(doc) {
132574
132589
  if (!doc) return "";
@@ -132640,14 +132655,14 @@ function tokenize7(jql) {
132640
132655
  continue;
132641
132656
  }
132642
132657
  if (ch === '"' || ch === "'") {
132643
- let j = i + 1, text24 = "";
132658
+ let j = i + 1, text25 = "";
132644
132659
  while (j < jql.length && jql[j] !== ch) {
132645
132660
  if (jql[j] === "\\" && j + 1 < jql.length) j++;
132646
- text24 += jql[j];
132661
+ text25 += jql[j];
132647
132662
  j++;
132648
132663
  }
132649
- if (j >= jql.length) throw new JqlError(`Error in the JQL Query: The quoted string '${text24}' has not been completed. (line 1, character ${i + 1})`);
132650
- out.push({ kind: "string", text: text24, pos: i });
132664
+ if (j >= jql.length) throw new JqlError(`Error in the JQL Query: The quoted string '${text25}' has not been completed. (line 1, character ${i + 1})`);
132665
+ out.push({ kind: "string", text: text25, pos: i });
132651
132666
  i = j + 1;
132652
132667
  continue;
132653
132668
  }
@@ -132888,16 +132903,16 @@ var localToUtc = (y, m, d, tz, h = 0, min = 0) => {
132888
132903
  const guess = Date.UTC(y, m - 1, d, h, min);
132889
132904
  return guess - zoned(guess, tz).offset;
132890
132905
  };
132891
- function period(text24) {
132892
- const s2 = text24.trim();
132906
+ function period(text25) {
132907
+ const s2 = text25.trim();
132893
132908
  if (!/^[-+]?(\d+\s*[wdhm]\s*)+$/.test(s2)) return null;
132894
132909
  const sign3 = s2.startsWith("-") ? -1 : 1, unit = { w: 7 * DAY7, d: DAY7, h: 36e5, m: 6e4 };
132895
132910
  return sign3 * [...s2.matchAll(/(\d+)\s*([wdhm])/g)].reduce((n2, x) => n2 + Number(x[1]) * unit[x[2]], 0);
132896
132911
  }
132897
132912
  function evaluate2(q, w2) {
132898
- const userOf2 = (text24, field5) => {
132899
- const t = text24.toLowerCase(), u = w2.users.find((x) => x.account_id === text24 || x.email?.toLowerCase() === t || x.name.toLowerCase() === t);
132900
- if (!u) throw new JqlError(`The value '${text24}' does not exist for the field '${field5}'.`);
132913
+ const userOf2 = (text25, field5) => {
132914
+ const t = text25.toLowerCase(), u = w2.users.find((x) => x.account_id === text25 || x.email?.toLowerCase() === t || x.name.toLowerCase() === t);
132915
+ if (!u) throw new JqlError(`The value '${text25}' does not exist for the field '${field5}'.`);
132901
132916
  return u.account_id;
132902
132917
  };
132903
132918
  const dateOf2 = (v, field5) => {
@@ -132931,9 +132946,9 @@ function evaluate2(q, w2) {
132931
132946
  if (v.kind === "func") throw new JqlError(`Function '${v.name}' is not supported for the field '${field5}'.`);
132932
132947
  return null;
132933
132948
  };
132934
- const issueId = (text24, field5) => {
132935
- const found2 = w2.issues.find((i) => i.key.toLowerCase() === text24.toLowerCase() || String(i.id) === text24);
132936
- if (!found2) throw new JqlError(/^[A-Za-z][A-Za-z0-9]*-\d+$/.test(text24) ? `An issue with key '${text24.toUpperCase()}' does not exist for field '${field5}'.` : `The issue key '${text24}' for field '${field5}' is invalid.`);
132949
+ const issueId = (text25, field5) => {
132950
+ const found2 = w2.issues.find((i) => i.key.toLowerCase() === text25.toLowerCase() || String(i.id) === text25);
132951
+ if (!found2) throw new JqlError(/^[A-Za-z][A-Za-z0-9]*-\d+$/.test(text25) ? `An issue with key '${text25.toUpperCase()}' does not exist for field '${field5}'.` : `The issue key '${text25}' for field '${field5}' is invalid.`);
132937
132952
  return found2.id;
132938
132953
  };
132939
132954
  const one7 = (resolve7) => (v) => {
@@ -133452,15 +133467,15 @@ function caller(c, ctx) {
133452
133467
  function handle20(route12, api3) {
133453
133468
  return async (c) => {
133454
133469
  const ctx = c.env.ctx;
133455
- const text24 = route12.method === "GET" || route12.method === "DELETE" ? "" : await c.req.text();
133470
+ const text25 = route12.method === "GET" || route12.method === "DELETE" ? "" : await c.req.text();
133456
133471
  try {
133457
133472
  if (/^Bearer\s/i.test(c.req.header("authorization") ?? "")) unsupported24("OAuth 2.0 bearer tokens (use the API token with Basic auth)");
133458
133473
  const me4 = withRead(ctx, () => caller(c, ctx));
133459
133474
  if (!me4) return json21(401, { errorMessages: ["You are not authenticated. Authentication required to perform this operation."], errors: {} });
133460
133475
  let body6 = void 0;
133461
- if (text24.trim()) {
133476
+ if (text25.trim()) {
133462
133477
  try {
133463
- body6 = JSON.parse(text24);
133478
+ body6 = JSON.parse(text25);
133464
133479
  } catch {
133465
133480
  fail2(400, "Unexpected character in the request body: it is not valid JSON.");
133466
133481
  }
@@ -135035,14 +135050,14 @@ function primary2(value4) {
135035
135050
  if (value4 !== void 0 && value4 !== null && value4 !== "" && Number(value4) !== 0) unsupported25("subaccounts other than 0");
135036
135051
  }
135037
135052
  function priceOf(value4, field5) {
135038
- const text24 = typeof value4 === "number" ? String(value4) : value4;
135039
- if (typeof text24 !== "string" || !/^(0?\.\d{1,4}|0|1(\.0{1,4})?)$/.test(text24)) throw invalid23(`${field5} must be a dollar string such as "0.56"`);
135040
- return Math.round(Number(text24) * ONE);
135053
+ const text25 = typeof value4 === "number" ? String(value4) : value4;
135054
+ if (typeof text25 !== "string" || !/^(0?\.\d{1,4}|0|1(\.0{1,4})?)$/.test(text25)) throw invalid23(`${field5} must be a dollar string such as "0.56"`);
135055
+ return Math.round(Number(text25) * ONE);
135041
135056
  }
135042
135057
  function countOf(value4, field5) {
135043
- const text24 = typeof value4 === "number" ? String(value4) : value4;
135044
- if (typeof text24 !== "string" || !/^\d+(\.\d{1,2})?$/.test(text24)) throw invalid23(`${field5} must be a contract count such as "10" or "2.50"`);
135045
- return Math.round(Number(text24) * 100);
135058
+ const text25 = typeof value4 === "number" ? String(value4) : value4;
135059
+ if (typeof text25 !== "string" || !/^\d+(\.\d{1,2})?$/.test(text25)) throw invalid23(`${field5} must be a contract count such as "10" or "2.50"`);
135060
+ return Math.round(Number(text25) * 100);
135046
135061
  }
135047
135062
  function choice2(value4, field5, values2) {
135048
135063
  if (typeof value4 !== "string" || !values2.includes(value4)) throw invalid23(`${field5} must be one of ${values2.join(", ")}`);
@@ -135691,12 +135706,12 @@ async function handle21(c) {
135691
135706
  response5.headers.set(GAP_HEADER, "1");
135692
135707
  return response5;
135693
135708
  }
135694
- const text24 = method2 === "GET" ? "" : await c.req.text();
135709
+ const text25 = method2 === "GET" ? "" : await c.req.text();
135695
135710
  let body6 = {};
135696
- if (text24.trim()) {
135711
+ if (text25.trim()) {
135697
135712
  let parsed3;
135698
135713
  try {
135699
- parsed3 = JSON.parse(text24);
135714
+ parsed3 = JSON.parse(text25);
135700
135715
  } catch {
135701
135716
  throw new KalshiError(400, "invalid_parameters", "invalid parameters", "the request body is not valid JSON");
135702
135717
  }
@@ -135779,11 +135794,11 @@ var unsupported26 = (what) => {
135779
135794
  throw new IntercomError(400, "not_implemented", `ancha: not implemented: ${what}`, true);
135780
135795
  };
135781
135796
  var json23 = (status4, body6, headers = {}) => new Response(body6 === void 0 ? null : JSON.stringify(body6), { status: status4, headers: { "content-type": "application/json; charset=utf-8", ...headers } });
135782
- var requestId3 = (c, text24) => createHash45("sha256").update(`${c.req.method} ${c.req.url}
135783
- ${text24}`).digest("hex").replace(/^(.{8})(.{4})(.{4})(.{4})(.{12}).*$/, "$1-$2-$3-$4-$5");
135797
+ var requestId3 = (c, text25) => createHash45("sha256").update(`${c.req.method} ${c.req.url}
135798
+ ${text25}`).digest("hex").replace(/^(.{8})(.{4})(.{4})(.{4})(.{12}).*$/, "$1-$2-$3-$4-$5");
135784
135799
  function handle22(route12) {
135785
135800
  return async (c) => {
135786
- const ctx = c.env.ctx, text24 = route12.method === "GET" ? "" : await c.req.text(), rid = requestId3(c, text24);
135801
+ const ctx = c.env.ctx, text25 = route12.method === "GET" ? "" : await c.req.text(), rid = requestId3(c, text25);
135787
135802
  const error64 = (e) => json23(e.status, { type: "error.list", request_id: rid, errors: [{ code: e.code, message: e.message }] }, { "x-request-id": rid, ...e.gap && { [GAP_HEADER]: "1" } });
135788
135803
  try {
135789
135804
  const token4 = /^Bearer\s+(\S+)$/i.exec(c.req.header("authorization") ?? "")?.[1];
@@ -135798,9 +135813,9 @@ function handle22(route12) {
135798
135813
  fail3(400, "intercom_version_invalid", `The requested version ${version5} does not exist.`);
135799
135814
  }
135800
135815
  let body6 = void 0;
135801
- if (text24.trim()) {
135816
+ if (text25.trim()) {
135802
135817
  try {
135803
- body6 = JSON.parse(text24);
135818
+ body6 = JSON.parse(text25);
135804
135819
  } catch {
135805
135820
  fail3(400, "parameter_invalid", "The request body is not valid JSON.");
135806
135821
  }
@@ -135823,9 +135838,9 @@ function unknownRoute15(c) {
135823
135838
  // packages/server/src/twins/intercom/routes.ts
135824
135839
  var now8 = (r2) => Math.floor(r2.ctx.clock.nowMs() / 1e3);
135825
135840
  var escape7 = (s2) => s2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
135826
- var html = (text24) => /<[a-z][^>]*>/i.test(text24) ? text24 : text24.split(/\n\s*\n/).map((p2) => `<p>${escape7(p2).replace(/\n/g, "<br>")}</p>`).join("");
135841
+ var html = (text25) => /<[a-z][^>]*>/i.test(text25) ? text25 : text25.split(/\n\s*\n/).map((p2) => `<p>${escape7(p2).replace(/\n/g, "<br>")}</p>`).join("");
135827
135842
  var plain2 = (body6) => body6 === null ? null : body6.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>\s*<p>/gi, "\n\n").replace(/<[^>]+>/g, "").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").trim();
135828
- var text19 = (r2, body6) => r2.plaintext ? plain2(body6) : body6;
135843
+ var text20 = (r2, body6) => r2.plaintext ? plain2(body6) : body6;
135829
135844
  function cursorOf(value4) {
135830
135845
  if (value4 === void 0 || value4 === null || value4 === "") return 0;
135831
135846
  try {
@@ -136001,7 +136016,7 @@ function partShape2(r2, conv, p2) {
136001
136016
  type: "conversation_part",
136002
136017
  id: p2.id,
136003
136018
  part_type: p2.type,
136004
- body: text19(r2, p2.body),
136019
+ body: text20(r2, p2.body),
136005
136020
  created_at: p2.at,
136006
136021
  updated_at: p2.at,
136007
136022
  notified_at: p2.at,
@@ -136040,7 +136055,7 @@ function conversationShape(r2, conv, withParts = true) {
136040
136055
  id: conv.source_id,
136041
136056
  delivered_as: "customer_initiated",
136042
136057
  subject: "",
136043
- body: text19(r2, conv.body),
136058
+ body: text20(r2, conv.body),
136044
136059
  author: authorOf2(r2, { type: "user", id: conv.contact_id }),
136045
136060
  attachments: [],
136046
136061
  url: null,
@@ -136974,7 +136989,7 @@ var STATUSES2 = ["new", "open", "pending", "hold", "solved", "closed"];
136974
136989
  var PRIORITIES2 = ["low", "normal", "high", "urgent"];
136975
136990
  var iso15 = (ms) => new Date(ms).toISOString().replace(/\.\d{3}Z$/, "Z");
136976
136991
  var tagsOf = (value4) => JSON.parse(value4);
136977
- var escape8 = (text24) => text24.replace(/[&<>"]/g, (char) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[char]);
136992
+ var escape8 = (text25) => text25.replace(/[&<>"]/g, (char) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[char]);
136978
136993
  var htmlBody = (body6) => `<div class="zd-comment" dir="auto">${body6.split(/\n{2,}/).map((part) => `<p dir="auto">${escape8(part).replace(/\n/g, "<br>")}</p>`).join("")}</div>`;
136979
136994
  var getUser7 = (ctx, id14) => ctx.store.db.prepare("SELECT * FROM zd_users WHERE id = ?").get(id14);
136980
136995
  var userByEmail = (ctx, email11) => ctx.store.db.prepare("SELECT * FROM zd_users WHERE email = ?").get(email11.toLowerCase());
@@ -137162,8 +137177,8 @@ function ticket2(ctx, args) {
137162
137177
  group: row2.group_id === null ? null : getGroup2(ctx, row2.group_id)?.name ?? row2.group_id,
137163
137178
  public_comments: comments.map((comment10) => comment10.body)
137164
137179
  };
137165
- const text24 = typeof args.public_comment === "object" ? args.public_comment.contains : void 0;
137166
- const passed = (args.status === void 0 || row2.status === args.status) && (args.status_in === void 0 || args.status_in.includes(row2.status)) && (args.status_not_in === void 0 || !args.status_not_in.includes(row2.status)) && (args.priority === void 0 || row2.priority === args.priority) && (args.assignee === void 0 || (typeof args.assignee === "number" ? row2.assignee_id : actual.assignee) === args.assignee) && (args.group === void 0 || (typeof args.group === "number" ? row2.group_id : actual.group) === args.group) && (args.tags?.has === void 0 || args.tags.has.every((tag3) => actual.tags.includes(tag3))) && (args.tags?.lacks === void 0 || args.tags.lacks.every((tag3) => !actual.tags.includes(tag3))) && (args.public_comment === void 0 || comments.some((comment10) => text24 === void 0 || comment10.body.includes(text24)));
137180
+ const text25 = typeof args.public_comment === "object" ? args.public_comment.contains : void 0;
137181
+ const passed = (args.status === void 0 || row2.status === args.status) && (args.status_in === void 0 || args.status_in.includes(row2.status)) && (args.status_not_in === void 0 || !args.status_not_in.includes(row2.status)) && (args.priority === void 0 || row2.priority === args.priority) && (args.assignee === void 0 || (typeof args.assignee === "number" ? row2.assignee_id : actual.assignee) === args.assignee) && (args.group === void 0 || (typeof args.group === "number" ? row2.group_id : actual.group) === args.group) && (args.tags?.has === void 0 || args.tags.has.every((tag3) => actual.tags.includes(tag3))) && (args.tags?.lacks === void 0 || args.tags.lacks.every((tag3) => !actual.tags.includes(tag3))) && (args.public_comment === void 0 || comments.some((comment10) => text25 === void 0 || comment10.body.includes(text25)));
137167
137182
  return checkOutcome(passed, expected, JSON.stringify(actual));
137168
137183
  }
137169
137184
  function unchanged2(ctx, args) {
@@ -137234,8 +137249,8 @@ function ticketMatches(world4, ticket3, term2) {
137234
137249
  const tags4 = tagsOf(ticket3.tags);
137235
137250
  switch (term2.key) {
137236
137251
  case null: {
137237
- const text24 = [ticket3.subject, ticket3.description, ...commentsOf2(world4.ctx, ticket3.id).map((comment10) => comment10.body), ...tags4].join("\n");
137238
- return contains2(text24, term2.value);
137252
+ const text25 = [ticket3.subject, ticket3.description, ...commentsOf2(world4.ctx, ticket3.id).map((comment10) => comment10.body), ...tags4].join("\n");
137253
+ return contains2(text25, term2.value);
137239
137254
  }
137240
137255
  case "status":
137241
137256
  return ordered(STATUSES2, ticket3.status, term2);
@@ -137683,13 +137698,13 @@ function commentFrom(ctx, input5, me4) {
137683
137698
  const comment10 = input5.comment;
137684
137699
  if (comment10 === void 0 || comment10 === null) return null;
137685
137700
  if (!isObject4(comment10)) throw invalid24("comment", "Comment: must be an object");
137686
- const text24 = typeof comment10.body === "string" ? comment10.body : typeof comment10.html_body === "string" ? comment10.html_body.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>/gi, "\n\n").replace(/<[^>]+>/g, "").trim() : "";
137687
- if (!text24.trim()) throw invalid24("comment", "Comment: cannot be blank", "BlankValue");
137701
+ const text25 = typeof comment10.body === "string" ? comment10.body : typeof comment10.html_body === "string" ? comment10.html_body.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>/gi, "\n\n").replace(/<[^>]+>/g, "").trim() : "";
137702
+ if (!text25.trim()) throw invalid24("comment", "Comment: cannot be blank", "BlankValue");
137688
137703
  const author = comment10.author_id === void 0 ? me4 : typeof comment10.author_id === "number" ? getUser7(ctx, comment10.author_id) : void 0;
137689
137704
  if (!author) throw invalid24("comment", "Comment: author is invalid");
137690
137705
  const isPublic = comment10.public === void 0 ? true : comment10.public === true;
137691
137706
  if (!isPublic && !isAgent(author)) throw invalid24("comment", "Comment: only agents can add private comments");
137692
- return { body: text24, public: isPublic, author };
137707
+ return { body: text25, public: isPublic, author };
137693
137708
  }
137694
137709
  function dueFrom(value4, type) {
137695
137710
  if (value4 === void 0) return void 0;
@@ -137835,7 +137850,7 @@ function applyMacro(call2) {
137835
137850
  const ticket3 = ticketBy(call2), macro2 = call2.ctx.store.db.prepare("SELECT * FROM zd_macros WHERE id = ?").get(numericId2(call2.ids[1]));
137836
137851
  if (!macro2) throw notFound16();
137837
137852
  const result = { id: ticket3.id, url: `${api2(call2.ctx)}/tickets/${ticket3.id}.json` };
137838
- let tags4 = tagsOf(ticket3.tags), text24 = null, isPublic = true;
137853
+ let tags4 = tagsOf(ticket3.tags), text25 = null, isPublic = true;
137839
137854
  for (const action of JSON.parse(macro2.actions)) {
137840
137855
  switch (action.field) {
137841
137856
  case "status":
@@ -137864,15 +137879,15 @@ function applyMacro(call2) {
137864
137879
  break;
137865
137880
  }
137866
137881
  case "comment_value":
137867
- text24 = String(action.value);
137882
+ text25 = String(action.value);
137868
137883
  break;
137869
137884
  case "comment_mode_is_public":
137870
137885
  isPublic = action.value === true;
137871
137886
  break;
137872
137887
  }
137873
137888
  }
137874
- if (text24 !== null) result.comment = { body: text24, html_body: `<p>${text24}</p>`, scoped_body: [["channel:all", text24]], public: isPublic };
137875
- return json24({ result: { ticket: result, ...text24 !== null && { comment: result.comment } } });
137889
+ if (text25 !== null) result.comment = { body: text25, html_body: `<p>${text25}</p>`, scoped_body: [["channel:all", text25]], public: isPublic };
137890
+ return json24({ result: { ticket: result, ...text25 !== null && { comment: result.comment } } });
137876
137891
  }
137877
137892
  function world3(call2) {
137878
137893
  const db3 = call2.ctx.store.db;
@@ -138168,12 +138183,12 @@ async function handle23(c) {
138168
138183
  response5.headers.set(GAP_HEADER, "1");
138169
138184
  return response5;
138170
138185
  }
138171
- const text24 = method2 === "GET" || method2 === "DELETE" ? "" : await c.req.text();
138186
+ const text25 = method2 === "GET" || method2 === "DELETE" ? "" : await c.req.text();
138172
138187
  let body6 = {};
138173
- if (text24.trim()) {
138188
+ if (text25.trim()) {
138174
138189
  let parsed3;
138175
138190
  try {
138176
- parsed3 = JSON.parse(text24);
138191
+ parsed3 = JSON.parse(text25);
138177
138192
  } catch {
138178
138193
  throw new ZendeskError(400, { error: "InvalidValue", description: "The request body is not valid JSON" });
138179
138194
  }
@@ -138265,7 +138280,7 @@ function errorResponse15(e) {
138265
138280
  }
138266
138281
  function handle24(route12) {
138267
138282
  return async (c) => {
138268
- const ctx = c.env.ctx, text24 = route12.method === "GET" || route12.method === "DELETE" ? "" : await c.req.text();
138283
+ const ctx = c.env.ctx, text25 = route12.method === "GET" || route12.method === "DELETE" ? "" : await c.req.text();
138269
138284
  try {
138270
138285
  const token4 = /^Bearer\s+(\S+)$/i.exec(c.req.header("authorization") ?? "")?.[1] ?? new URL(c.req.url).searchParams.get("access_token") ?? void 0;
138271
138286
  if (!token4) fail4(401, "required", `Request is missing required authentication credential. ${AUTH_HINT2}`);
@@ -138273,9 +138288,9 @@ function handle24(route12) {
138273
138288
  if (!scopes3) fail4(401, "authError", `Request had invalid authentication credentials. ${AUTH_HINT2}`);
138274
138289
  if (!route12.scopes.some((s2) => JSON.parse(scopes3).includes(s2))) fail4(403, "insufficientPermissions", "Request had insufficient authentication scopes.");
138275
138290
  let body6 = {};
138276
- if (text24.trim()) {
138291
+ if (text25.trim()) {
138277
138292
  try {
138278
- body6 = JSON.parse(text24);
138293
+ body6 = JSON.parse(text25);
138279
138294
  } catch {
138280
138295
  fail4(400, "parseError", "Parse Error");
138281
138296
  }
@@ -138335,10 +138350,10 @@ function readWhen(value4, field5, fallbackZone) {
138335
138350
  if (typeof v.date !== "string" || !/^\d{4}-\d{2}-\d{2}$/.test(v.date)) fail4(400, "invalid", "Bad Request");
138336
138351
  return { ms: Date.parse(`${v.date}T00:00:00Z`), date: v.date, tz };
138337
138352
  }
138338
- const text24 = String(v.dateTime);
138339
- if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?$/.test(text24)) fail4(400, "invalid", "Bad Request");
138340
- const ms = /(Z|[+-]\d{2}:\d{2})$/.test(text24) ? Date.parse(text24) : (() => {
138341
- const [d, t] = text24.split("T");
138353
+ const text25 = String(v.dateTime);
138354
+ if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?$/.test(text25)) fail4(400, "invalid", "Bad Request");
138355
+ const ms = /(Z|[+-]\d{2}:\d{2})$/.test(text25) ? Date.parse(text25) : (() => {
138356
+ const [d, t] = text25.split("T");
138342
138357
  const [y, m, dd] = d.split("-").map(Number);
138343
138358
  const [h, mi, s2] = t.split(":").map(Number);
138344
138359
  return localToUtc2(y, m, dd, h, mi, Math.floor(s2 ?? 0), tz);
@@ -139940,9 +139955,9 @@ var membershipsOf2 = (ctx, task2) => ctx.store.db.prepare("SELECT m.* FROM as_me
139940
139955
  var followersOf = (ctx, task2) => ctx.store.db.prepare("SELECT user FROM as_followers WHERE task = ? ORDER BY user").all(task2).map((row2) => row2.user);
139941
139956
  var subtasksOf = (ctx, task2) => ctx.store.db.prepare("SELECT * FROM as_tasks WHERE parent = ? AND deleted_ms IS NULL ORDER BY created_ms, gid").all(task2);
139942
139957
  var sectionsOf = (ctx, project12) => ctx.store.db.prepare("SELECT * FROM as_sections WHERE project = ? ORDER BY position").all(project12);
139943
- function addStory(ctx, task2, author, type, subtype, text24, at3) {
139958
+ function addStory(ctx, task2, author, type, subtype, text25, at3) {
139944
139959
  const gid2 = nextGid(ctx, "story");
139945
- ctx.store.db.prepare("INSERT INTO as_stories (gid, task, created_by, created_ms, type, subtype, text) VALUES (?, ?, ?, ?, ?, ?, ?)").run(gid2, task2, author, at3, type, subtype, text24);
139960
+ ctx.store.db.prepare("INSERT INTO as_stories (gid, task, created_by, created_ms, type, subtype, text) VALUES (?, ?, ?, ?, ?, ?, ?)").run(gid2, task2, author, at3, type, subtype, text25);
139946
139961
  return gid2;
139947
139962
  }
139948
139963
  function placeTask(ctx, task2, project12, section2, anchor2) {
@@ -140075,7 +140090,7 @@ var errorBody5 = (message8) => ({ errors: [{ message: message8, help: HELP }] })
140075
140090
  var json27 = (body6, status4 = 200) => new Response(JSON.stringify(body6), { status: status4, headers: { "content-type": "application/json; charset=utf-8" } });
140076
140091
  var bad = (message8) => new AsanaError(400, message8);
140077
140092
  var unknownId = (kind, gid2) => new AsanaError(404, `${kind}: Not a recognized ID: ${gid2}`);
140078
- var escape9 = (text24) => text24.replace(/[&<>]/g, (char) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;" })[char]);
140093
+ var escape9 = (text25) => text25.replace(/[&<>]/g, (char) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;" })[char]);
140079
140094
  var userCompact = (user8) => ({ gid: user8.gid, name: user8.name, resource_type: "user" });
140080
140095
  var workspaceCompact = (ctx) => ({ ...workspace2(ctx), resource_type: "workspace" });
140081
140096
  var projectCompact = (project12) => ({ gid: project12.gid, name: project12.name, resource_type: "project" });
@@ -140492,7 +140507,7 @@ function updateTask(call2) {
140492
140507
  }
140493
140508
  }
140494
140509
  ctx.store.db.prepare("UPDATE as_tasks SET name = ?, notes = ?, assignee = ?, due_on = ?, due_at_ms = ?, start_on = ?, completed_ms = ?, completed_by = ?, modified_ms = ? WHERE gid = ?").run(next2.name, next2.notes, next2.assignee, next2.due_on, next2.due_at_ms, next2.start_on, next2.completed_ms, next2.completed_by, stories.length ? now11 : task2.modified_ms, task2.gid);
140495
- for (const [subtype, text24] of stories) addStory(ctx, task2.gid, call2.me.gid, "system", subtype, text24, now11);
140510
+ for (const [subtype, text25] of stories) addStory(ctx, task2.gid, call2.me.gid, "system", subtype, text25, now11);
140496
140511
  return one5(call2, taskFull(ctx, getTask(ctx, task2.gid)));
140497
140512
  }
140498
140513
  function deleteTask(call2) {
@@ -140514,10 +140529,10 @@ function listStories(call2) {
140514
140529
  }
140515
140530
  function addComment2(call2) {
140516
140531
  const task2 = taskBy(call2), data5 = call2.body, now11 = call2.ctx.clock.nowMs();
140517
- const text24 = typeof data5.text === "string" ? data5.text : typeof data5.html_text === "string" ? data5.html_text.replace(/<br\s*\/?>/gi, "\n").replace(/<[^>]+>/g, "") : "";
140518
- if (!text24.trim()) throw bad("text: Missing input");
140532
+ const text25 = typeof data5.text === "string" ? data5.text : typeof data5.html_text === "string" ? data5.html_text.replace(/<br\s*\/?>/gi, "\n").replace(/<[^>]+>/g, "") : "";
140533
+ if (!text25.trim()) throw bad("text: Missing input");
140519
140534
  if (data5.sticker_name !== void 0) unsupported30("stickers");
140520
- const gid2 = addStory(call2.ctx, task2.gid, call2.me.gid, "comment", "comment_added", text24, now11);
140535
+ const gid2 = addStory(call2.ctx, task2.gid, call2.me.gid, "comment", "comment_added", text25, now11);
140521
140536
  call2.ctx.store.db.prepare("UPDATE as_tasks SET modified_ms = ? WHERE gid = ?").run(now11, task2.gid);
140522
140537
  call2.ctx.store.db.prepare("INSERT OR IGNORE INTO as_followers (task, user) VALUES (?, ?)").run(task2.gid, call2.me.gid);
140523
140538
  return json27({ data: storyFull(call2.ctx, call2.ctx.store.db.prepare("SELECT * FROM as_stories WHERE gid = ?").get(gid2)) }, 201);
@@ -140573,7 +140588,7 @@ function searchTasks(call2) {
140573
140588
  const users5 = (name5) => params10.get(name5)?.split(",").map((value4) => userRef3(call2, value4.trim(), name5).gid);
140574
140589
  const ids2 = (name5) => params10.get(name5)?.split(",").map((value4) => value4.trim());
140575
140590
  const assignees = users5("assignee.any"), excluded = users5("assignee.not"), projects = ids2("projects.any"), notProjects = ids2("projects.not"), sections = ids2("sections.any");
140576
- const text24 = params10.get("text")?.toLowerCase(), completed = params10.get("completed"), subtask = params10.get("is_subtask"), sortBy2 = params10.get("sort_by") ?? "modified_at";
140591
+ const text25 = params10.get("text")?.toLowerCase(), completed = params10.get("completed"), subtask = params10.get("is_subtask"), sortBy2 = params10.get("sort_by") ?? "modified_at";
140577
140592
  if (!["due_date", "created_at", "completed_at", "likes", "modified_at"].includes(sortBy2)) throw bad("sort_by: Not one of due_date, created_at, completed_at, likes, modified_at");
140578
140593
  const time7 = (name5) => {
140579
140594
  const value4 = params10.get(name5);
@@ -140587,7 +140602,7 @@ function searchTasks(call2) {
140587
140602
  if (!Number.isInteger(limit) || limit < 1 || limit > 100) throw bad("limit: Value must be between 1 and 100");
140588
140603
  const tasks = liveTasks(ctx).filter((task2) => {
140589
140604
  const memberships = membershipsOf2(ctx, task2.gid);
140590
- return (!text24 || task2.name.toLowerCase().includes(text24) || task2.notes.toLowerCase().includes(text24)) && (!assignees || task2.assignee !== null && assignees.includes(task2.assignee)) && (!excluded || task2.assignee === null || !excluded.includes(task2.assignee)) && (!projects || memberships.some((membership) => projects.includes(membership.project))) && (!notProjects || !memberships.some((membership) => notProjects.includes(membership.project))) && (!sections || memberships.some((membership) => sections.includes(membership.section))) && (completed === null || task2.completed_ms !== null === (completed === "true")) && (subtask === null || task2.parent !== null === (subtask === "true")) && (params10.get("due_on") === null || task2.due_on === params10.get("due_on")) && (params10.get("due_on.before") === null || task2.due_on !== null && task2.due_on < params10.get("due_on.before")) && (params10.get("due_on.after") === null || task2.due_on !== null && task2.due_on > params10.get("due_on.after")) && (createdAfter === null || task2.created_ms > createdAfter) && (createdBefore === null || task2.created_ms < createdBefore) && (modifiedAfter === null || task2.modified_ms > modifiedAfter) && (modifiedBefore === null || task2.modified_ms < modifiedBefore);
140605
+ return (!text25 || task2.name.toLowerCase().includes(text25) || task2.notes.toLowerCase().includes(text25)) && (!assignees || task2.assignee !== null && assignees.includes(task2.assignee)) && (!excluded || task2.assignee === null || !excluded.includes(task2.assignee)) && (!projects || memberships.some((membership) => projects.includes(membership.project))) && (!notProjects || !memberships.some((membership) => notProjects.includes(membership.project))) && (!sections || memberships.some((membership) => sections.includes(membership.section))) && (completed === null || task2.completed_ms !== null === (completed === "true")) && (subtask === null || task2.parent !== null === (subtask === "true")) && (params10.get("due_on") === null || task2.due_on === params10.get("due_on")) && (params10.get("due_on.before") === null || task2.due_on !== null && task2.due_on < params10.get("due_on.before")) && (params10.get("due_on.after") === null || task2.due_on !== null && task2.due_on > params10.get("due_on.after")) && (createdAfter === null || task2.created_ms > createdAfter) && (createdBefore === null || task2.created_ms < createdBefore) && (modifiedAfter === null || task2.modified_ms > modifiedAfter) && (modifiedBefore === null || task2.modified_ms < modifiedBefore);
140591
140606
  });
140592
140607
  const key4 = (task2) => sortBy2 === "due_date" ? task2.due_on ?? "9999" : sortBy2 === "created_at" ? task2.created_ms : sortBy2 === "completed_at" ? task2.completed_ms ?? 0 : sortBy2 === "likes" ? 0 : task2.modified_ms;
140593
140608
  const ascending = params10.get("sort_ascending") === "true";
@@ -140673,16 +140688,16 @@ function authenticate13(ctx, header3) {
140673
140688
  return getUser8(ctx, ctx.store.meta.get("asana.me"));
140674
140689
  }
140675
140690
  async function readBody2(c) {
140676
- const type = c.req.header("content-type") ?? "", text24 = await c.req.text();
140677
- if (!text24.trim()) return {};
140691
+ const type = c.req.header("content-type") ?? "", text25 = await c.req.text();
140692
+ if (!text25.trim()) return {};
140678
140693
  if (/^application\/x-www-form-urlencoded/i.test(type)) {
140679
140694
  const out = {};
140680
- for (const [name5, value4] of new URLSearchParams(text24)) out[name5] = name5 in out ? [...[out[name5]].flat(), value4] : value4;
140695
+ for (const [name5, value4] of new URLSearchParams(text25)) out[name5] = name5 in out ? [...[out[name5]].flat(), value4] : value4;
140681
140696
  return out;
140682
140697
  }
140683
140698
  let parsed3;
140684
140699
  try {
140685
- parsed3 = JSON.parse(text24);
140700
+ parsed3 = JSON.parse(text25);
140686
140701
  } catch {
140687
140702
  throw new AsanaError(400, "Could not parse request data, invalid JSON");
140688
140703
  }
@@ -141350,13 +141365,13 @@ async function handle27(c) {
141350
141365
  response5.headers.set(GAP_HEADER, "1");
141351
141366
  return response5;
141352
141367
  }
141353
- const text24 = method2 === "GET" || method2 === "DELETE" ? "" : await c.req.text();
141368
+ const text25 = method2 === "GET" || method2 === "DELETE" ? "" : await c.req.text();
141354
141369
  if (/^multipart\/form-data/i.test(c.req.header("content-type") ?? "")) unsupported31("file uploads");
141355
141370
  let body6 = {};
141356
- if (text24.trim()) {
141371
+ if (text25.trim()) {
141357
141372
  let parsed3;
141358
141373
  try {
141359
- parsed3 = JSON.parse(text24);
141374
+ parsed3 = JSON.parse(text25);
141360
141375
  } catch {
141361
141376
  throw new DiscordError(400, 50109, "The request body contains invalid JSON.");
141362
141377
  }
@@ -141534,7 +141549,7 @@ var base3 = (ctx) => ctx.serviceUrl ?? "";
141534
141549
  function handle28(route12) {
141535
141550
  return async (c) => {
141536
141551
  const ctx = c.env.ctx;
141537
- const text24 = route12.method === "GET" || route12.method === "DELETE" ? "" : await c.req.text();
141552
+ const text25 = route12.method === "GET" || route12.method === "DELETE" ? "" : await c.req.text();
141538
141553
  try {
141539
141554
  const token4 = /^Bearer\s+(\S+)$/i.exec(c.req.header("authorization") ?? "")?.[1];
141540
141555
  if (!token4) return json29(401, { detail: "Authentication credentials were not provided." });
@@ -141545,9 +141560,9 @@ function handle28(route12) {
141545
141560
  if (!auth) return json29(401, { detail: "Invalid token" });
141546
141561
  if (!route12.scopes.some((s2) => auth.scopes.includes(s2))) fail5(403, "You do not have permission to perform this action.");
141547
141562
  let body6 = {};
141548
- if (text24.trim()) {
141563
+ if (text25.trim()) {
141549
141564
  try {
141550
- body6 = JSON.parse(text24);
141565
+ body6 = JSON.parse(text25);
141551
141566
  } catch {
141552
141567
  fail5(400, "JSON parse error - Expecting value: line 1 column 1 (char 0)");
141553
141568
  }
@@ -142367,8 +142382,8 @@ function apply(ctx, i, by2, c, ms) {
142367
142382
  saveIssue2(ctx, i);
142368
142383
  return delta2;
142369
142384
  }
142370
- function comment9(ctx, i, by2, text24, ms) {
142371
- activity(ctx, i, "note", by2, { text: text24 }, ms);
142385
+ function comment9(ctx, i, by2, text25, ms) {
142386
+ activity(ctx, i, "note", by2, { text: text25 }, ms);
142372
142387
  saveIssue2(ctx, i);
142373
142388
  return i.activity.at(-1);
142374
142389
  }
@@ -142433,7 +142448,7 @@ function bodyDate(field5, value4) {
142433
142448
  if (!Number.isFinite(t)) invalid25(field5, "Datetime has wrong format. Use one of these formats instead: YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM|-HH:MM|Z].");
142434
142449
  return t;
142435
142450
  }
142436
- var text20 = (field5, value4, max = 200) => {
142451
+ var text21 = (field5, value4, max = 200) => {
142437
142452
  if (value4 === null || value4 === void 0) return null;
142438
142453
  if (typeof value4 !== "string") invalid25(field5, "Not a valid string.");
142439
142454
  if (value4.length > max) invalid25(field5, `Ensure this field has no more than ${max} characters.`);
@@ -142546,8 +142561,8 @@ var orgRoutes = [
142546
142561
  project_ids: projects.map((p2) => p2.id),
142547
142562
  created_ms: r2.now,
142548
142563
  released_ms: bodyDate("dateReleased", b.dateReleased),
142549
- ref: text20("ref", b.ref),
142550
- url: text20("url", b.url, 1e3),
142564
+ ref: text21("ref", b.ref),
142565
+ url: text21("url", b.url, 1e3),
142551
142566
  status: b.status ?? "open"
142552
142567
  }));
142553
142568
  }
@@ -142564,8 +142579,8 @@ var orgRoutes = [
142564
142579
  if (b.status !== void 0 && !["open", "archived"].includes(b.status)) invalid25("status", `"${b.status}" is not a valid choice.`);
142565
142580
  return releaseShape(r2.ctx, saveRelease(r2.ctx, {
142566
142581
  ...rel,
142567
- ..."ref" in b && { ref: text20("ref", b.ref) },
142568
- ..."url" in b && { url: text20("url", b.url, 1e3) },
142582
+ ..."ref" in b && { ref: text21("ref", b.ref) },
142583
+ ..."url" in b && { url: text21("url", b.url, 1e3) },
142569
142584
  ..."dateReleased" in b && { released_ms: bodyDate("dateReleased", b.dateReleased) },
142570
142585
  ...b.status !== void 0 && { status: b.status }
142571
142586
  }));
@@ -142594,8 +142609,8 @@ var orgRoutes = [
142594
142609
  id: next(r2.ctx, "deploy", 58210001),
142595
142610
  release_id: rel.id,
142596
142611
  environment: b.environment,
142597
- name: text20("name", b.name, 64),
142598
- url: text20("url", b.url, 1e3),
142612
+ name: text21("name", b.name, 64),
142613
+ url: text21("url", b.url, 1e3),
142599
142614
  started_ms: bodyDate("dateStarted", b.dateStarted),
142600
142615
  finished_ms: finished,
142601
142616
  project_ids: projects.length ? projects.map((p2) => p2.id) : rel.project_ids
@@ -142634,7 +142649,7 @@ function parseSearch2(query10, where2) {
142634
142649
  tokens3.push(query10.slice(i, j));
142635
142650
  i = j;
142636
142651
  }
142637
- const filters = [], text24 = [];
142652
+ const filters = [], text25 = [];
142638
142653
  for (const token4 of tokens3) {
142639
142654
  if (token4 === "OR" || token4 === "AND") {
142640
142655
  if (where2 === "issues") fail5(400, 'Error parsing search query: Boolean statements containing "OR" or "AND" are not supported in this search');
@@ -142642,7 +142657,7 @@ function parseSearch2(query10, where2) {
142642
142657
  }
142643
142658
  const m = KEY2.exec(token4);
142644
142659
  if (!m) {
142645
- text24.push(unquote2(token4));
142660
+ text25.push(unquote2(token4));
142646
142661
  continue;
142647
142662
  }
142648
142663
  const [, bang, key4, rest2] = m;
@@ -142656,7 +142671,7 @@ function parseSearch2(query10, where2) {
142656
142671
  const values2 = value4.startsWith("[") && value4.endsWith("]") ? value4.slice(1, -1).split(",").map((v) => unquote2(v.trim())).filter(Boolean) : [unquote2(value4)];
142657
142672
  filters.push({ key: key4, negated: bang === "!", op, values: values2 });
142658
142673
  }
142659
- return { filters, text: text24.join(" ") };
142674
+ return { filters, text: text25.join(" ") };
142660
142675
  }
142661
142676
  function glob2(pattern, value4, caseless = false) {
142662
142677
  if (!pattern.includes("*")) return caseless ? pattern.toLowerCase() === value4.toLowerCase() : pattern === value4;
@@ -142764,7 +142779,7 @@ function matches7(f2, value4, now11) {
142764
142779
  if (f2.key === "message" || f2.key === "title") return f2.values.some((v) => v.includes("*") ? glob2(v, value4, true) : value4.toLowerCase().includes(v.toLowerCase()));
142765
142780
  return f2.values.some((v) => glob2(v, value4, caseless));
142766
142781
  }
142767
- function eventTest(filters, text24, lookup6, now11, resolve7 = (f2) => f2) {
142782
+ function eventTest(filters, text25, lookup6, now11, resolve7 = (f2) => f2) {
142768
142783
  return (e) => filters.every((raw3) => {
142769
142784
  const f2 = resolve7(raw3, e);
142770
142785
  if (f2.key === "has") return f2.values.every((k) => {
@@ -142772,7 +142787,7 @@ function eventTest(filters, text24, lookup6, now11, resolve7 = (f2) => f2) {
142772
142787
  return v !== null && v !== "" && !(Array.isArray(v) && !v.length);
142773
142788
  }) !== f2.negated;
142774
142789
  return matches7(f2, eventValue(e, f2.key, lookup6), now11) !== f2.negated;
142775
- }) && (!text24 || [e.title, e.message, e.culprit].some((s2) => typeof s2 === "string" && s2.toLowerCase().includes(text24.toLowerCase())));
142790
+ }) && (!text25 || [e.title, e.message, e.culprit].some((s2) => typeof s2 === "string" && s2.toLowerCase().includes(text25.toLowerCase())));
142776
142791
  }
142777
142792
 
142778
142793
  // packages/server/src/twins/sentry/issues.ts
@@ -143521,12 +143536,12 @@ var dateFormatOption = (name5) => ({ format: DATE_FORMATS[name5] ?? "YYYY-MM-DD"
143521
143536
  var timeFormatOption = (name5) => ({ format: TIME_FORMATS[name5] ?? "HH:mm", name: TIME_FORMATS[name5] ? name5 : "24hour" });
143522
143537
  var iso19 = (ms) => new Date(ms).toISOString();
143523
143538
  var parsed2 = /* @__PURE__ */ new Map();
143524
- function parse12(text24) {
143525
- let node5 = parsed2.get(text24);
143539
+ function parse12(text25) {
143540
+ let node5 = parsed2.get(text25);
143526
143541
  if (!node5) {
143527
- node5 = airtable_formula_exports.parseFormula(text24);
143542
+ node5 = airtable_formula_exports.parseFormula(text25);
143528
143543
  if (parsed2.size > 2e3) parsed2.clear();
143529
- parsed2.set(text24, node5);
143544
+ parsed2.set(text25, node5);
143530
143545
  }
143531
143546
  return node5;
143532
143547
  }
@@ -143884,9 +143899,9 @@ var AirtableBase = class _AirtableBase {
143884
143899
  let n2;
143885
143900
  if (typeof value4 === "number" && Number.isFinite(value4)) n2 = value4;
143886
143901
  else if (typecast && typeof value4 === "string") {
143887
- const text24 = value4.trim(), cleaned = text24.replace(/[^0-9eE.+-]/g, "");
143888
- if (!text24) return void 0;
143889
- if (cleaned && Number.isFinite(Number(cleaned))) n2 = field5.type === "percent" && text24.endsWith("%") ? Number(cleaned) / 100 : Number(cleaned);
143902
+ const text25 = value4.trim(), cleaned = text25.replace(/[^0-9eE.+-]/g, "");
143903
+ if (!text25) return void 0;
143904
+ if (cleaned && Number.isFinite(Number(cleaned))) n2 = field5.type === "percent" && text25.endsWith("%") ? Number(cleaned) / 100 : Number(cleaned);
143890
143905
  }
143891
143906
  if (n2 === void 0) throw bad4();
143892
143907
  if (field5.type === "rating" && n2 === 0) return void 0;
@@ -143896,9 +143911,9 @@ var AirtableBase = class _AirtableBase {
143896
143911
  switch (field5.type) {
143897
143912
  case "checkbox": {
143898
143913
  if (typeof value4 === "boolean") return value4 ? true : void 0;
143899
- const text24 = typecast ? String(value4).trim().toLowerCase() : null;
143900
- if (text24 !== null && ["true", "yes", "checked", "x", "1", "on"].includes(text24)) return true;
143901
- if (text24 !== null && ["false", "no", "unchecked", "", "0", "off"].includes(text24)) return void 0;
143914
+ const text25 = typecast ? String(value4).trim().toLowerCase() : null;
143915
+ if (text25 !== null && ["true", "yes", "checked", "x", "1", "on"].includes(text25)) return true;
143916
+ if (text25 !== null && ["false", "no", "unchecked", "", "0", "off"].includes(text25)) return void 0;
143902
143917
  throw bad4();
143903
143918
  }
143904
143919
  case "singleSelect": {
@@ -143918,9 +143933,9 @@ var AirtableBase = class _AirtableBase {
143918
143933
  case "date":
143919
143934
  case "dateTime": {
143920
143935
  if (typeof value4 !== "string") throw bad4();
143921
- const text24 = value4.trim();
143922
- if (!text24) return void 0;
143923
- const date10 = /^\d{4}-\d{2}-\d{2}($|[T ])/.test(text24) || typecast ? airtable_formula_exports.parseFormulaDate(text24) : null;
143936
+ const text25 = value4.trim();
143937
+ if (!text25) return void 0;
143938
+ const date10 = /^\d{4}-\d{2}-\d{2}($|[T ])/.test(text25) || typecast ? airtable_formula_exports.parseFormulaDate(text25) : null;
143924
143939
  if (!date10) throw bad4();
143925
143940
  return field5.type === "date" ? iso19(date10.ms).slice(0, 10) : iso19(date10.ms);
143926
143941
  }
@@ -143955,7 +143970,7 @@ var AirtableBase = class _AirtableBase {
143955
143970
  }
143956
143971
  }
143957
143972
  #person(value4, typecast, bad4) {
143958
- const all9 = this.users(), lower4 = (text24) => String(text24).trim().toLowerCase();
143973
+ const all9 = this.users(), lower4 = (text25) => String(text25).trim().toLowerCase();
143959
143974
  let found;
143960
143975
  if (value4 && typeof value4 === "object" && !Array.isArray(value4)) {
143961
143976
  const ref22 = value4;
@@ -144314,9 +144329,9 @@ function commentText(body6) {
144314
144329
  return body6.text;
144315
144330
  }
144316
144331
  function createComment2(call2) {
144317
- const { model, record: record9 } = commentsOf3(call2, true), text24 = commentText(call2.body), parent2 = call2.body.parentCommentId;
144332
+ const { model, record: record9 } = commentsOf3(call2, true), text25 = commentText(call2.body), parent2 = call2.body.parentCommentId;
144318
144333
  if (parent2 !== void 0 && (typeof parent2 !== "string" || !liveComments(call2.ctx, record9.id).some((row3) => row3.id === parent2))) throw notFound20();
144319
- const row2 = { id: newId8(call2.ctx, "com"), record_id: record9.id, author_id: meId(call2.ctx), text: text24, parent_id: parent2 ?? null, created_ms: call2.ctx.clock.nowMs(), updated_ms: null, deleted_ms: null };
144334
+ const row2 = { id: newId8(call2.ctx, "com"), record_id: record9.id, author_id: meId(call2.ctx), text: text25, parent_id: parent2 ?? null, created_ms: call2.ctx.clock.nowMs(), updated_ms: null, deleted_ms: null };
144320
144335
  call2.ctx.store.db.prepare("INSERT INTO at_comments (id, record_id, author_id, text, parent_id, created_ms) VALUES (?, ?, ?, ?, ?, ?)").run(row2.id, row2.record_id, row2.author_id, row2.text, row2.parent_id, row2.created_ms);
144321
144336
  return json30(commentJson2(model, row2));
144322
144337
  }
@@ -144327,9 +144342,9 @@ function ownComment(call2) {
144327
144342
  return { model, comment: comment10 };
144328
144343
  }
144329
144344
  function updateComment2(call2) {
144330
- const { model, comment: comment10 } = ownComment(call2), text24 = commentText(call2.body), now11 = call2.ctx.clock.nowMs();
144331
- call2.ctx.store.db.prepare("UPDATE at_comments SET text = ?, updated_ms = ? WHERE id = ?").run(text24, now11, comment10.id);
144332
- return json30(commentJson2(model, { ...comment10, text: text24, updated_ms: now11 }));
144345
+ const { model, comment: comment10 } = ownComment(call2), text25 = commentText(call2.body), now11 = call2.ctx.clock.nowMs();
144346
+ call2.ctx.store.db.prepare("UPDATE at_comments SET text = ?, updated_ms = ? WHERE id = ?").run(text25, now11, comment10.id);
144347
+ return json30(commentJson2(model, { ...comment10, text: text25, updated_ms: now11 }));
144333
144348
  }
144334
144349
  function deleteComment2(call2) {
144335
144350
  const { comment: comment10 } = ownComment(call2);
@@ -144385,10 +144400,10 @@ function addField(model, table4, input5) {
144385
144400
  if (field5?.type !== "multipleRecordLinks") throw invalidRequest(`Invalid request: options.${key4} must be a link field in ${table4.name}`);
144386
144401
  return field5;
144387
144402
  };
144388
- const formula = (text24, hasField, vars = []) => {
144389
- if (typeof text24 !== "string" || !text24.trim()) throw invalidRequest("Invalid request: options.formula is required");
144403
+ const formula = (text25, hasField, vars = []) => {
144404
+ if (typeof text25 !== "string" || !text25.trim()) throw invalidRequest("Invalid request: options.formula is required");
144390
144405
  try {
144391
- const node5 = airtable_formula_exports.parseFormula(text24);
144406
+ const node5 = airtable_formula_exports.parseFormula(text25);
144392
144407
  airtable_formula_exports.checkFormula(node5, hasField, vars);
144393
144408
  return node5;
144394
144409
  } catch (error64) {
@@ -144663,8 +144678,8 @@ function seed40(ctx) {
144663
144678
  continue;
144664
144679
  }
144665
144680
  if (field5.type === "dateTime") {
144666
- const text24 = value4;
144667
- cells[key4] = iso19(/^-?\d/.test(text24) && !/^\d{4}-/.test(text24) ? at3(text24) : Date.parse(text24));
144681
+ const text25 = value4;
144682
+ cells[key4] = iso19(/^-?\d/.test(text25) && !/^\d{4}-/.test(text25) ? at3(text25) : Date.parse(text25));
144668
144683
  continue;
144669
144684
  }
144670
144685
  if (value4 === "" || Array.isArray(value4) && !value4.length) continue;
@@ -144692,7 +144707,7 @@ function seed40(ctx) {
144692
144707
  }
144693
144708
  }
144694
144709
  }
144695
- const mention = (text24) => text24.replace(/@\[([^\]]+)\]/g, (_match, who2) => `@[${person4(who2)}]`);
144710
+ const mention = (text25) => text25.replace(/@\[([^\]]+)\]/g, (_match, who2) => `@[${person4(who2)}]`);
144696
144711
  const positions2 = /* @__PURE__ */ new Map();
144697
144712
  for (const row2 of rows7) {
144698
144713
  const position = positions2.get(row2.tableId) ?? 0;
@@ -144706,7 +144721,7 @@ function seed40(ctx) {
144706
144721
  }
144707
144722
  function dumpState39(ctx) {
144708
144723
  const people3 = new Map(users4(ctx).map((user8) => [user8.id, user8]));
144709
- const readable2 = (text24) => text24.replace(/@\[(usr[A-Za-z0-9]+)\]/g, (match3, id14) => people3.has(id14) ? `@[${people3.get(id14).name}]` : match3);
144724
+ const readable2 = (text25) => text25.replace(/@\[(usr[A-Za-z0-9]+)\]/g, (match3, id14) => people3.has(id14) ? `@[${people3.get(id14).name}]` : match3);
144710
144725
  return {
144711
144726
  user: people3.get(meId(ctx))?.email ?? null,
144712
144727
  bases: bases(ctx).map((row2) => {
@@ -144770,11 +144785,11 @@ async function handle29(c) {
144770
144785
  return response5;
144771
144786
  }
144772
144787
  let body6 = {};
144773
- const text24 = method2 === "GET" || method2 === "DELETE" ? "" : await c.req.text();
144774
- if (text24.trim()) {
144788
+ const text25 = method2 === "GET" || method2 === "DELETE" ? "" : await c.req.text();
144789
+ if (text25.trim()) {
144775
144790
  let parsed3;
144776
144791
  try {
144777
- parsed3 = JSON.parse(text24);
144792
+ parsed3 = JSON.parse(text25);
144778
144793
  } catch {
144779
144794
  throw new AirtableError(400, "INVALID_REQUEST_UNKNOWN", "Invalid request: the request body is not valid JSON");
144780
144795
  }
@@ -144967,8 +144982,8 @@ var checks = {
144967
144982
 
144968
144983
  // packages/server/src/twins/carrier-portal/pdf.ts
144969
144984
  var winAnsi = new Map([..."\u20AC\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u0160\u2039\u0152\u017D\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u0161\u203A\u0153\u017E\u0178"].map((c, i) => [c, [128, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 142, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 158, 159][i]]));
144970
- function encodeText(text24) {
144971
- return [...text24.normalize("NFC")].map((c) => {
144985
+ function encodeText(text25) {
144986
+ return [...text25.normalize("NFC")].map((c) => {
144972
144987
  const code2 = c.codePointAt(0);
144973
144988
  if (code2 >= 32 && code2 <= 126 || code2 >= 160 && code2 <= 255) return c;
144974
144989
  if (winAnsi.has(c)) return String.fromCharCode(winAnsi.get(c));
@@ -144976,7 +144991,7 @@ function encodeText(text24) {
144976
144991
  return /^[\x20-\x7e]+$/.test(base4) ? base4 : "?";
144977
144992
  }).join("");
144978
144993
  }
144979
- var pdfString = (text24) => text24.replace(/[\\()\x80-\xff]/g, (c) => c.charCodeAt(0) >= 128 ? `\\${c.charCodeAt(0).toString(8).padStart(3, "0")}` : `\\${c}`);
144994
+ var pdfString = (text25) => text25.replace(/[\\()\x80-\xff]/g, (c) => c.charCodeAt(0) >= 128 ? `\\${c.charCodeAt(0).toString(8).padStart(3, "0")}` : `\\${c}`);
144980
144995
  function carrierPdf(lines) {
144981
144996
  const wrapped = lines.flatMap((line2) => encodeText(line2).match(/.{1,88}/g) ?? [""]);
144982
144997
  const pages = [];
@@ -146036,7 +146051,7 @@ var TYPE_NAMES = {
146036
146051
  ExpRept: "Expense Report"
146037
146052
  };
146038
146053
  var DISPLAY = {
146039
- status: Object.fromEntries(Object.entries(STATUS2).map(([key4, text24]) => [key4, `${TYPE_NAMES[key4.split(":")[0]]} : ${text24}`])),
146054
+ status: Object.fromEntries(Object.entries(STATUS2).map(([key4, text25]) => [key4, `${TYPE_NAMES[key4.split(":")[0]]} : ${text25}`])),
146040
146055
  itemtype: { Service: "Service", NonInvtPart: "Non-inventory Item", InvtPart: "Inventory Item", OthCharge: "Other Charge" },
146041
146056
  accttype: {
146042
146057
  Bank: "Bank",
@@ -146385,9 +146400,9 @@ function assertion(ctx, base4, header3, form2) {
146385
146400
  const access3 = issue7(ctx, "access", { client: creds.consumerKey, scope: JSON.stringify(scopes3), role: ADMINISTRATOR, entity: administrator(ctx), chain, origin }, ACCESS_SECONDS);
146386
146401
  return json31({ access_token: access3, expires_in: ACCESS_SECONDS, token_type: "bearer" });
146387
146402
  }
146388
- function token3(ctx, base4, header3, contentType, text24) {
146403
+ function token3(ctx, base4, header3, contentType, text25) {
146389
146404
  if (!/^\s*application\/x-www-form-urlencoded\s*(?:;.*)?$/i.test(contentType ?? "")) return oauthError(ctx, "invalid_request");
146390
- const form2 = new URLSearchParams(text24);
146405
+ const form2 = new URLSearchParams(text25);
146391
146406
  for (const key4 of new Set(form2.keys())) if (form2.getAll(key4).length > 1) return oauthError(ctx, "invalid_request");
146392
146407
  const grant = form2.get("grant_type");
146393
146408
  if (!grant) return oauthError(ctx, "invalid_request");
@@ -146424,9 +146439,9 @@ function token3(ctx, base4, header3, contentType, text24) {
146424
146439
  db2(ctx).prepare(`UPDATE ns_oauth SET used = 1 WHERE token = ? AND kind = 'refresh'`).run(refresh);
146425
146440
  return json31({ access_token: access3, refresh_token: issue7(ctx, "refresh", row2, refreshSeconds), expires_in: String(ACCESS_SECONDS), token_type: "bearer" });
146426
146441
  }
146427
- function revoke2(ctx, header3, contentType, text24) {
146442
+ function revoke2(ctx, header3, contentType, text25) {
146428
146443
  if (!/^\s*application\/x-www-form-urlencoded\s*(?:;.*)?$/i.test(contentType ?? "")) return oauthError(ctx, "invalid_request");
146429
- const form2 = new URLSearchParams(text24), who2 = client(ctx, header3, form2);
146444
+ const form2 = new URLSearchParams(text25), who2 = client(ctx, header3, form2);
146430
146445
  if (who2 instanceof Response) return who2;
146431
146446
  const value4 = form2.get("token");
146432
146447
  if (!value4 || form2.getAll("token").length > 1) return oauthError(ctx, "invalid_request");
@@ -146434,12 +146449,12 @@ function revoke2(ctx, header3, contentType, text24) {
146434
146449
  if (row2 && row2.client === who2.id) revokeChain(ctx, row2.chain);
146435
146450
  return new Response(null, { status: 200, headers: NO_STORE });
146436
146451
  }
146437
- function oauth2(ctx, method2, url4, path4, headers, text24) {
146452
+ function oauth2(ctx, method2, url4, path4, headers, text25) {
146438
146453
  const base4 = ctx.serviceUrl ?? url4.origin;
146439
146454
  const only4 = (allowed2, run3) => method2 === allowed2 ? withMutation(ctx, run3) : new Response(null, { status: 405, headers: { allow: allowed2 } });
146440
146455
  if (path4 === AUTHORIZE_PATH) return only4("GET", () => authorize3(ctx, url4));
146441
- if (path4 === `${OAUTH2_ROOT}/token`) return only4("POST", () => token3(ctx, base4, headers.authorization, headers.contentType, text24));
146442
- if (path4 === `${OAUTH2_ROOT}/revoke`) return only4("POST", () => revoke2(ctx, headers.authorization, headers.contentType, text24));
146456
+ if (path4 === `${OAUTH2_ROOT}/token`) return only4("POST", () => token3(ctx, base4, headers.authorization, headers.contentType, text25));
146457
+ if (path4 === `${OAUTH2_ROOT}/revoke`) return only4("POST", () => revoke2(ctx, headers.authorization, headers.contentType, text25));
146443
146458
  if (path4 === `${OAUTH2_ROOT}/keys`) return only4("GET", () => json31({ keys: [{ ...createPublicKey3(signingKey(ctx)).export({ format: "jwk" }), kid: KID, use: "sig", alg: "RS256" }] }));
146444
146459
  return void 0;
146445
146460
  }
@@ -148626,7 +148641,7 @@ var r = (kind, target5) => ({ kind, ...target5 && { target: target5 } });
148626
148641
  var w = (kind, more = {}) => ({ kind, write: true, ...more });
148627
148642
  var ref21 = (target5, label7) => w("ref", { target: target5, ...label7 && { label: label7 } });
148628
148643
  var HOLD = { AUTO: "Auto", ON: "On", OFF: "Off" };
148629
- var statusOptions = (code2) => Object.fromEntries(Object.entries(STATUS2).filter(([key4]) => key4.startsWith(`${code2}:`)).map(([key4, text24]) => [key4.split(":")[1], text24]));
148644
+ var statusOptions = (code2) => Object.fromEntries(Object.entries(STATUS2).filter(([key4]) => key4.startsWith(`${code2}:`)).map(([key4, text25]) => [key4.split(":")[1], text25]));
148630
148645
  var MONEY = r("number");
148631
148646
  var SEGMENTS2 = { department: ref21("department"), location: ref21("location"), class: ref21("classification") };
148632
148647
  var DATED = { dateCreated: r("datetime"), lastModifiedDate: r("datetime") };
@@ -149015,9 +149030,9 @@ var today = (ctx) => ctx.clock.now().toISOString().slice(0, 10);
149015
149030
  var stamp5 = (ctx) => ctx.clock.now().toISOString().replace(/\.\d{3}Z$/, "Z");
149016
149031
  var qty = (value4) => Math.round(value4 * 1e8) / 1e8;
149017
149032
  var addDays = (date10, days) => new Date(Date.parse(`${date10}T00:00:00Z`) + days * 864e5).toISOString().slice(0, 10);
149018
- var json32 = (text24) => {
149033
+ var json32 = (text25) => {
149019
149034
  try {
149020
- return text24 ? JSON.parse(text24) : {};
149035
+ return text25 ? JSON.parse(text25) : {};
149021
149036
  } catch {
149022
149037
  return {};
149023
149038
  }
@@ -149879,12 +149894,12 @@ function tokenize8(input5) {
149879
149894
  }
149880
149895
  if (ch === "'" || ch === '"') {
149881
149896
  const quote2 = ch;
149882
- let text24 = "", closed = false;
149897
+ let text25 = "", closed = false;
149883
149898
  i++;
149884
149899
  while (i < input5.length) {
149885
149900
  if (input5[i] === quote2) {
149886
149901
  if (input5[i + 1] === quote2) {
149887
- text24 += quote2;
149902
+ text25 += quote2;
149888
149903
  i += 2;
149889
149904
  } else {
149890
149905
  i++;
@@ -149892,12 +149907,12 @@ function tokenize8(input5) {
149892
149907
  break;
149893
149908
  }
149894
149909
  } else {
149895
- text24 += input5[i++];
149910
+ text25 += input5[i++];
149896
149911
  }
149897
149912
  }
149898
149913
  if (!closed) invalid26("Unterminated quoted value.");
149899
- if (text24.includes("\0")) invalid26("Invalid character in quoted value.");
149900
- out.push({ kind: quote2 === "'" ? "string" : "quoted", text: text24 });
149914
+ if (text25.includes("\0")) invalid26("Invalid character in quoted value.");
149915
+ out.push({ kind: quote2 === "'" ? "string" : "quoted", text: text25 });
149901
149916
  } else {
149902
149917
  const tail = input5.slice(i);
149903
149918
  const number7 = /^(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/.exec(tail);
@@ -149931,17 +149946,17 @@ var Parser = class {
149931
149946
  constructor(input5) {
149932
149947
  this.tokens = tokenize8(input5);
149933
149948
  }
149934
- peek(text24) {
149949
+ peek(text25) {
149935
149950
  const t = this.tokens[this.at];
149936
- return t.kind !== "quoted" && t.kind !== "string" && t.text === text24;
149951
+ return t.kind !== "quoted" && t.kind !== "string" && t.text === text25;
149937
149952
  }
149938
- eat(text24) {
149939
- if (!this.peek(text24)) return false;
149953
+ eat(text25) {
149954
+ if (!this.peek(text25)) return false;
149940
149955
  this.at++;
149941
149956
  return true;
149942
149957
  }
149943
- need(text24) {
149944
- if (!this.eat(text24)) invalid26(`Expected ${text24.toUpperCase()}.`);
149958
+ need(text25) {
149959
+ if (!this.eat(text25)) invalid26(`Expected ${text25.toUpperCase()}.`);
149945
149960
  }
149946
149961
  identifier() {
149947
149962
  const t = this.tokens[this.at++];
@@ -151029,11 +151044,11 @@ function calendar3(y, m, d) {
151029
151044
  if (y < 1 || y > 9999 || date10.getUTCFullYear() !== y || date10.getUTCMonth() + 1 !== m || date10.getUTCDate() !== d) invalid26("Invalid date value.");
151030
151045
  return date10;
151031
151046
  }
151032
- function isoDate(text24) {
151033
- const match3 = /^(\d{4})-(\d{2})-(\d{2})$/.exec(text24);
151047
+ function isoDate(text25) {
151048
+ const match3 = /^(\d{4})-(\d{2})-(\d{2})$/.exec(text25);
151034
151049
  if (!match3) invalid26("Expected a YYYY-MM-DD world date.");
151035
151050
  calendar3(+match3[1], +match3[2], +match3[3]);
151036
- return text24;
151051
+ return text25;
151037
151052
  }
151038
151053
  function dateModel(model) {
151039
151054
  if (!model || model.length > 200) invalid26("Invalid date format model.");
@@ -151084,10 +151099,10 @@ function parseDate2(value4, model) {
151084
151099
  return tokens3.some((t) => t.startsWith("HH") || ["MI", "SS"].includes(t)) ? date10.toISOString() : date10.toISOString().slice(0, 10);
151085
151100
  }
151086
151101
  function readDate(value4) {
151087
- const text24 = String(value4);
151088
- if (!/^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?$/.test(text24)) invalid26("Invalid date value.");
151089
- isoDate(text24.slice(0, 10));
151090
- const date10 = new Date(text24.length === 10 ? `${text24}T00:00:00Z` : /(?:Z|[+-]\d{2}:\d{2})$/.test(text24) ? text24 : `${text24}Z`);
151102
+ const text25 = String(value4);
151103
+ if (!/^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?$/.test(text25)) invalid26("Invalid date value.");
151104
+ isoDate(text25.slice(0, 10));
151105
+ const date10 = new Date(text25.length === 10 ? `${text25}T00:00:00Z` : /(?:Z|[+-]\d{2}:\d{2})$/.test(text25) ? text25 : `${text25}Z`);
151091
151106
  if (!Number.isFinite(date10.getTime())) invalid26("Invalid date value.");
151092
151107
  return date10;
151093
151108
  }
@@ -151181,11 +151196,11 @@ function like(value4, pattern, ...escape11) {
151181
151196
  mask2.push({ char: next2 });
151182
151197
  } else mask2.push(chars[k] === "%" ? { any: true } : chars[k] === "_" ? { one: true } : { char: chars[k] });
151183
151198
  }
151184
- const text24 = Array.from(String(value4));
151199
+ const text25 = Array.from(String(value4));
151185
151200
  let i = 0, j = 0, percent = -1, retry = 0;
151186
- while (i < text24.length) {
151201
+ while (i < text25.length) {
151187
151202
  const m = mask2[j];
151188
- if (m && ("one" in m || "char" in m && m.char === text24[i])) {
151203
+ if (m && ("one" in m || "char" in m && m.char === text25[i])) {
151189
151204
  i++;
151190
151205
  j++;
151191
151206
  } else if (m && "any" in m) {
@@ -151987,11 +152002,11 @@ function parseQuery3(q) {
151987
152002
  return node5;
151988
152003
  }
151989
152004
  function day7(value4) {
151990
- const text24 = String(value4), us = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(text24);
151991
- const iso22 = us ? `${us[3]}-${us[1].padStart(2, "0")}-${us[2].padStart(2, "0")}` : text24;
152005
+ const text25 = String(value4), us = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(text25);
152006
+ const iso22 = us ? `${us[3]}-${us[1].padStart(2, "0")}-${us[2].padStart(2, "0")}` : text25;
151992
152007
  if (!/^\d{4}-\d{2}-\d{2}$/.test(iso22) || (/* @__PURE__ */ new Date(`${iso22}T00:00:00Z`)).toISOString().slice(0, 10) !== iso22) {
151993
- if (/^[a-z]+$/i.test(text24)) throw gap6(`relative date ${text24} in q`);
151994
- throw bad2(`${text24} is not a date; use M/D/YYYY.`);
152008
+ if (/^[a-z]+$/i.test(text25)) throw gap6(`relative date ${text25} in q`);
152009
+ throw bad2(`${text25} is not a date; use M/D/YYYY.`);
151995
152010
  }
151996
152011
  return iso22;
151997
152012
  }
@@ -152942,10 +152957,10 @@ function reportList(ctx) {
152942
152957
  });
152943
152958
  }
152944
152959
  function day8(value4, name5) {
152945
- const text24 = typeof value4 === "string" ? value4.trim() : "";
152960
+ const text25 = typeof value4 === "string" ? value4.trim() : "";
152946
152961
  let iso22;
152947
- const us = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(text24);
152948
- if (/^\d{4}-\d{2}-\d{2}$/.test(text24)) iso22 = text24;
152962
+ const us = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(text25);
152963
+ if (/^\d{4}-\d{2}-\d{2}$/.test(text25)) iso22 = text25;
152949
152964
  else if (us) iso22 = `${us[3]}-${us[1].padStart(2, "0")}-${us[2].padStart(2, "0")}`;
152950
152965
  if (!iso22 || Number.isNaN(Date.parse(`${iso22}T00:00:00Z`)) || (/* @__PURE__ */ new Date(`${iso22}T00:00:00Z`)).toISOString().slice(0, 10) !== iso22) {
152951
152966
  throw new ToolError("INVALID_PARAMETER", `${name5} must be a date such as 2026-01-31 or 1/31/2026.`);
@@ -152998,7 +153013,7 @@ function runReport(ctx, args) {
152998
153013
 
152999
153014
  // packages/server/src/twins/netsuite/searches.ts
153000
153015
  var f = (sql5, kind = "text") => ({ sql: sql5, kind });
153001
- var select2 = (sql5, text24 = `BUILTIN.DF(${sql5})`) => ({ sql: sql5, kind: "select", text: text24 });
153016
+ var select2 = (sql5, text25 = `BUILTIN.DF(${sql5})`) => ({ sql: sql5, kind: "select", text: text25 });
153002
153017
  var entity2 = (a) => ({
153003
153018
  internalid: select2(`${a}.id`, `${a}.id`),
153004
153019
  entityid: f(`${a}.entityid`),
@@ -153265,13 +153280,13 @@ function field4(ctx, type, name5, error64, plan4, formula) {
153265
153280
  var iso20 = (d) => d.toISOString().slice(0, 10);
153266
153281
  var at2 = (y, m, d) => new Date(Date.UTC(y, m, d));
153267
153282
  function dateRange(ctx, value4) {
153268
- const text24 = String(value4 ?? "").trim().toLowerCase(), now11 = /* @__PURE__ */ new Date(`${today(ctx)}T00:00:00Z`);
153283
+ const text25 = String(value4 ?? "").trim().toLowerCase(), now11 = /* @__PURE__ */ new Date(`${today(ctx)}T00:00:00Z`);
153269
153284
  const y = now11.getUTCFullYear(), m = now11.getUTCMonth(), d = now11.getUTCDate(), dow = now11.getUTCDay(), q = Math.floor(m / 3) * 3;
153270
153285
  const one7 = (date10) => [iso20(date10), iso20(date10)];
153271
- const us = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(text24);
153286
+ const us = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(text25);
153272
153287
  if (us) return one7(at2(Number(us[3]), Number(us[1]) - 1, Number(us[2])));
153273
- if (/^\d{4}-\d{2}-\d{2}$/.test(text24)) return [text24, text24];
153274
- const ago = /^(days|weeks|months|quarters|years)(ago|fromnow)(\d{1,4})$/.exec(text24);
153288
+ if (/^\d{4}-\d{2}-\d{2}$/.test(text25)) return [text25, text25];
153289
+ const ago = /^(days|weeks|months|quarters|years)(ago|fromnow)(\d{1,4})$/.exec(text25);
153275
153290
  if (ago) {
153276
153291
  const n2 = Number(ago[3]) * (ago[2] === "ago" ? -1 : 1);
153277
153292
  if (ago[1] === "days") return one7(at2(y, m, d + n2));
@@ -153302,7 +153317,7 @@ function dateRange(ctx, value4) {
153302
153317
  ranges2.thisfiscalyear = ranges2.thisyear;
153303
153318
  ranges2.lastfiscalyear = ranges2.lastyear;
153304
153319
  ranges2.thisfiscalyeartodate = ranges2.thisyeartodate;
153305
- const range2 = ranges2[text24];
153320
+ const range2 = ranges2[text25];
153306
153321
  if (!range2) throw new ToolError("SSS_INVALID_SRCH_FILTER", `An nlobjSearchFilter contains an invalid date value: ${String(value4)}.`);
153307
153322
  return [iso20(range2[0]), iso20(range2[1])];
153308
153323
  }
@@ -153499,8 +153514,8 @@ async function runSearch(ctx, args) {
153499
153514
  return;
153500
153515
  }
153501
153516
  if (c.def.kind === "select") {
153502
- const text24 = c.name === "type" && search10.type === "transaction" ? TYPE_NAMES[value4 ?? ""] : c.name === "status" ? STATUS2[value4 ?? ""] : row2[`c${index}t`] ?? value4;
153503
- values2[key5] = value4 === void 0 ? [] : [{ value: value4, text: text24 ?? value4 }];
153517
+ const text25 = c.name === "type" && search10.type === "transaction" ? TYPE_NAMES[value4 ?? ""] : c.name === "status" ? STATUS2[value4 ?? ""] : row2[`c${index}t`] ?? value4;
153518
+ values2[key5] = value4 === void 0 ? [] : [{ value: value4, text: text25 ?? value4 }];
153504
153519
  } else if (c.def.kind === "checkbox") values2[key5] = value4 === "T";
153505
153520
  else if (c.def.kind === "currency") values2[key5] = money13(value4);
153506
153521
  else values2[key5] = value4 ?? "";
@@ -153533,11 +153548,11 @@ function typeNamed(name5) {
153533
153548
  }
153534
153549
  var recordNamed = (ctx, name5) => withRead(ctx, () => plainType(ctx, String(name5).trim())) ?? typeNamed(name5);
153535
153550
  var invalid28 = (message8) => new ToolError("INVALID_PARAMETER", message8);
153536
- function jsonObject(text24, name5) {
153537
- if (text24 === void 0 || text24 === null || typeof text24 === "string" && text24.trim() === "") return {};
153551
+ function jsonObject(text25, name5) {
153552
+ if (text25 === void 0 || text25 === null || typeof text25 === "string" && text25.trim() === "") return {};
153538
153553
  let value4;
153539
153554
  try {
153540
- value4 = JSON.parse(String(text24));
153555
+ value4 = JSON.parse(String(text25));
153541
153556
  } catch {
153542
153557
  value4 = void 0;
153543
153558
  }
@@ -153770,7 +153785,7 @@ var MCP_TOOLS = [
153770
153785
  targetRecordTypeFilter: s("A comma-separated list of target record types, for example invoice,itemfulfillment. Matching is case-insensitive.").optional()
153771
153786
  }),
153772
153787
  run: (_ctx, a) => {
153773
- const list16 = (text24) => text24?.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
153788
+ const list16 = (text25) => text25?.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
153774
153789
  const sources = list16(a.sourceRecordTypeFilter), targets = list16(a.targetRecordTypeFilter);
153775
153790
  const pairs = netsuiteRecordTypes.flatMap((source) => transformTargets(source).map((target5) => ({ sourceRecordType: source.toLowerCase(), targetRecordType: target5.toLowerCase() })));
153776
153791
  pairs.push(...["cashsale", "estimate", "invoice", "salesorder"].map((targetRecordType) => ({ sourceRecordType: "opportunity", targetRecordType })));
@@ -154078,7 +154093,7 @@ var rpcError = (id14, code2, message8, status4 = 200) => ({
154078
154093
  headers: { "content-type": "application/json" },
154079
154094
  body: JSON.stringify({ jsonrpc: "2.0", id: id14 ?? null, error: { code: code2, message: message8 } })
154080
154095
  });
154081
- async function mcpEndpoint(ctx, method2, text24, base4, serve3, caller2, headers = {}) {
154096
+ async function mcpEndpoint(ctx, method2, text25, base4, serve3, caller2, headers = {}) {
154082
154097
  if (headers.origin !== void 0 && headers.origin !== new URL(base4).origin) return rpcError(null, -32600, "Invalid Origin", 403);
154083
154098
  if (headers.protocolVersion !== void 0 && !PROTOCOLS.includes(headers.protocolVersion)) return rpcError(null, -32600, "Invalid MCP-Protocol-Version", 400);
154084
154099
  if (method2 !== "POST") return { status: 405, headers: { allow: "POST", "content-type": "application/json" }, body: JSON.stringify({
@@ -154088,7 +154103,7 @@ async function mcpEndpoint(ctx, method2, text24, base4, serve3, caller2, headers
154088
154103
  }) };
154089
154104
  let message8;
154090
154105
  try {
154091
- message8 = JSON.parse(text24);
154106
+ message8 = JSON.parse(text25);
154092
154107
  } catch {
154093
154108
  return rpcError(null, -32700, "Parse error", 400);
154094
154109
  }
@@ -154274,7 +154289,7 @@ function runJob(ctx, serve3, job) {
154274
154289
  return true;
154275
154290
  }
154276
154291
  var progress = (tasks) => tasks.some((t) => t.completed === null) ? "pending" : tasks.some((t) => (t.status ?? 0) >= 400) ? "failed" : "succeeded";
154277
- var local = (text24, base4) => text24.split(ORIGIN).join(base4);
154292
+ var local = (text25, base4) => text25.split(ORIGIN).join(base4);
154278
154293
  function readJob(ctx, base4, method2, segments3) {
154279
154294
  if (method2 !== "GET") throw gap6(`${method2} on an asynchronous job`);
154280
154295
  const [kind, jobKey, part, taskKey, leaf] = segments3;
@@ -155257,7 +155272,7 @@ function bearerError(ctx, kind) {
155257
155272
  error64.headers["www-authenticate"] = `Bearer realm="${config10(ctx).account.id}", error="${kind}", error_description="${kind === "invalid_token" ? "Invalid login attempt." : "The request could not be understood by the server due to malformed syntax."}"`;
155258
155273
  return error64;
155259
155274
  }
155260
- function authenticate16(ctx, c, url4, text24, nonceSeen) {
155275
+ function authenticate16(ctx, c, url4, text25, nonceSeen) {
155261
155276
  const saved = ctx.store.meta.get("netsuite.credentials"), header3 = c.req.header("authorization") ?? "";
155262
155277
  if (!saved) throw badLogin();
155263
155278
  const creds = JSON.parse(saved);
@@ -155269,7 +155284,7 @@ function authenticate16(ctx, c, url4, text24, nonceSeen) {
155269
155284
  }
155270
155285
  const clocksMs = [Date.now(), ctx.clock.nowMs()];
155271
155286
  const check3 = checkTba(
155272
- { method: c.req.method, url: `${ctx.serviceUrl ?? url4.origin}${url4.pathname}${url4.search}`, contentType: c.req.header("content-type"), body: text24, authorization: header3 },
155287
+ { method: c.req.method, url: `${ctx.serviceUrl ?? url4.origin}${url4.pathname}${url4.search}`, contentType: c.req.header("content-type"), body: text25, authorization: header3 },
155273
155288
  creds,
155274
155289
  { nonceSeen: (nonce, timestamp4) => nonceSeen(nonce, timestamp4, clocksMs), nowMs: clocksMs }
155275
155290
  );
@@ -155324,7 +155339,7 @@ var failure4 = (error64) => ({
155324
155339
  });
155325
155340
  var BATCH = /;\s*type\s*=\s*"?collection"?/i;
155326
155341
  function serve2(ctx, request4) {
155327
- const { method: method2, url: url4, text: text24 } = request4, path4 = url4.pathname.replace(/\/+$/, "");
155342
+ const { method: method2, url: url4, text: text25 } = request4, path4 = url4.pathname.replace(/\/+$/, "");
155328
155343
  try {
155329
155344
  const validation2 = (name5) => {
155330
155345
  const value4 = (request4.header(name5) ?? "warning").toLowerCase();
@@ -155337,12 +155352,12 @@ function serve2(ctx, request4) {
155337
155352
  throw new NetsuiteError(400, "INVALID_REQUEST", "A batch request runs asynchronously. Send it with the header Prefer: respond-async.", { header: "Prefer" });
155338
155353
  }
155339
155354
  let body6;
155340
- if (text24.trim() !== "") {
155355
+ if (text25.trim() !== "") {
155341
155356
  if (!JSON_BODY.test(request4.header("content-type") ?? "application/json")) {
155342
155357
  throw new NetsuiteError(415, "INVALID_CONTENT", "Invalid content type. Send the request body as application/json or application/vnd.oracle.resource+json.", { header: "Content-Type" });
155343
155358
  }
155344
155359
  try {
155345
- body6 = JSON.parse(text24);
155360
+ body6 = JSON.parse(text25);
155346
155361
  } catch {
155347
155362
  throw new NetsuiteError(400, "INVALID_CONTENT", "The request body is not valid JSON.");
155348
155363
  }
@@ -155382,18 +155397,18 @@ function netsuiteTwin(nonces = new TbaNonceCache(), poolOptions = {}) {
155382
155397
  const ctx = c.env.ctx, url4 = new URL(c.req.url), method2 = c.req.method;
155383
155398
  const send2 = (served) => new Response(served.body, { status: served.status, headers: served.headers });
155384
155399
  try {
155385
- const text24 = method2 === "GET" || method2 === "DELETE" || method2 === "HEAD" ? "" : await c.req.text();
155400
+ const text25 = method2 === "GET" || method2 === "DELETE" || method2 === "HEAD" ? "" : await c.req.text();
155386
155401
  ctx.signal?.throwIfAborted();
155387
- if (text24.length > 104e6) throw new NetsuiteError(413, "REQUEST_TOO_LARGE", "The request body exceeds 104 MB.");
155402
+ if (text25.length > 104e6) throw new NetsuiteError(413, "REQUEST_TOO_LARGE", "The request body exceeds 104 MB.");
155388
155403
  const path4 = url4.pathname.replace(/\/+$/, "");
155389
- const issued = oauth2(ctx, method2, url4, path4, { authorization: c.req.header("authorization"), contentType: c.req.header("content-type") }, text24);
155404
+ const issued = oauth2(ctx, method2, url4, path4, { authorization: c.req.header("authorization"), contentType: c.req.header("content-type") }, text25);
155390
155405
  if (issued) return issued;
155391
155406
  if (MCP_PATHS.includes(path4)) {
155392
155407
  const caller2 = withRead(ctx, () => mcpCaller(ctx, c.req.header("authorization") ?? ""));
155393
- return send2(await mcpEndpoint(ctx, method2, text24, ctx.serviceUrl ?? url4.origin, serve2, caller2, { origin: c.req.header("origin"), protocolVersion: c.req.header("mcp-protocol-version") }));
155408
+ return send2(await mcpEndpoint(ctx, method2, text25, ctx.serviceUrl ?? url4.origin, serve2, caller2, { origin: c.req.header("origin"), protocolVersion: c.req.header("mcp-protocol-version") }));
155394
155409
  }
155395
- withRead(ctx, () => authenticate16(ctx, c, url4, text24, (nonce, timestamp4, clocksMs) => nonces.seen(ctx.store, nonce, timestamp4, clocksMs)));
155396
- const request4 = { method: method2, url: url4, header: (name5) => c.req.header(name5), text: text24 };
155410
+ withRead(ctx, () => authenticate16(ctx, c, url4, text25, (nonce, timestamp4, clocksMs) => nonces.seen(ctx.store, nonce, timestamp4, clocksMs)));
155411
+ const request4 = { method: method2, url: url4, header: (name5) => c.req.header(name5), text: text25 };
155397
155412
  if (wantsAsync(c.req.header("prefer")) && !path4.startsWith(`${ASYNC_ROOT}/`)) return send2(submit(ctx, ctx.serviceUrl ?? url4.origin, request4));
155398
155413
  return send2(await serve2(ctx, request4));
155399
155414
  } catch (error64) {
@@ -156267,11 +156282,11 @@ function slackName(env, id14) {
156267
156282
  const row2 = env.store.db.prepare("SELECT COALESCE(real_name, name) AS name FROM slack_users WHERE id = ?").get(id14);
156268
156283
  return row2?.name ?? id14;
156269
156284
  }
156270
- function slackText(env, text24) {
156271
- return text24.replace(/<@([A-Z0-9]+)(?:\|[^>]*)?>/g, (_match, id14) => `@${slackName(env, id14)}`);
156285
+ function slackText(env, text25) {
156286
+ return text25.replace(/<@([A-Z0-9]+)(?:\|[^>]*)?>/g, (_match, id14) => `@${slackName(env, id14)}`);
156272
156287
  }
156273
- var oneLine3 = (text24) => {
156274
- const flat2 = text24.replace(/\s+/g, " ").trim();
156288
+ var oneLine3 = (text25) => {
156289
+ const flat2 = text25.replace(/\s+/g, " ").trim();
156275
156290
  return flat2.length > LINE_LIMIT ? `${flat2.slice(0, LINE_LIMIT - 1)}\u2026` : flat2;
156276
156291
  };
156277
156292
  function addressedEvent(env, event3) {
@@ -156867,10 +156882,10 @@ function sessionRoutes(opts, sessions) {
156867
156882
  return c.json(await sessions.prepare(opts.manager.get(c.req.param("id")), parseOptions(input5.options)), 201);
156868
156883
  });
156869
156884
  app2.post("/envs/:id/trials/:sid/start", async (c) => {
156870
- const text24 = await c.req.text();
156885
+ const text25 = await c.req.text();
156871
156886
  let input5 = {};
156872
156887
  try {
156873
- if (text24) input5 = JSON.parse(text24);
156888
+ if (text25) input5 = JSON.parse(text25);
156874
156889
  } catch {
156875
156890
  throw new AnchaError("USAGE", "request must be a JSON object");
156876
156891
  }
@@ -157052,11 +157067,11 @@ function controlRoutes(opts) {
157052
157067
  return c.json(env.world.read(() => Object.fromEntries(env.twins.map((twin) => [twin.name, twin.dumpState(env.ctxFor(twin.name))]))));
157053
157068
  });
157054
157069
  control2.post("/envs/:id/checks", async (c) => {
157055
- const text24 = await c.req.text();
157070
+ const text25 = await c.req.text();
157056
157071
  let payload2 = {};
157057
- if (text24.trim() !== "") {
157072
+ if (text25.trim() !== "") {
157058
157073
  try {
157059
- payload2 = JSON.parse(text24);
157074
+ payload2 = JSON.parse(text25);
157060
157075
  } catch {
157061
157076
  throw new AnchaError("USAGE", "request body must be JSON", { hint: `POST { "checks"?: [ \u2026 ] } with content-type: application/json, or an empty body to run the scene's checks` });
157062
157077
  }
@@ -157126,15 +157141,15 @@ function errorResponse20(c, e) {
157126
157141
  if (!(e instanceof AnchaError)) console.error(e);
157127
157142
  return c.json({ error: toErrorJson(e) }, status4);
157128
157143
  }
157129
- function parseBody2(text24, contentType) {
157130
- if (text24 === "") return void 0;
157144
+ function parseBody2(text25, contentType) {
157145
+ if (text25 === "") return void 0;
157131
157146
  if (contentType?.split(";")[0].trim().toLowerCase() === "application/x-www-form-urlencoded") {
157132
- return Object.fromEntries(new URLSearchParams(text24));
157147
+ return Object.fromEntries(new URLSearchParams(text25));
157133
157148
  }
157134
157149
  try {
157135
- return JSON.parse(text24);
157150
+ return JSON.parse(text25);
157136
157151
  } catch {
157137
- return text24;
157152
+ return text25;
157138
157153
  }
157139
157154
  }
157140
157155
  function bearerToken(c, url4) {
@@ -157603,8 +157618,8 @@ var fact = external_exports.preprocess((value4) => {
157603
157618
  confidential: external_exports.boolean()
157604
157619
  }));
157605
157620
  var optionId = (value4) => {
157606
- const text24 = typeof value4 === "string" ? value4 : value4 && typeof value4 === "object" ? value4.id ?? value4.name ?? value4.value : value4;
157607
- return typeof text24 === "string" ? text24.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "_").replace(/^_+|_+$/g, "") : text24;
157621
+ const text25 = typeof value4 === "string" ? value4 : value4 && typeof value4 === "object" ? value4.id ?? value4.name ?? value4.value : value4;
157622
+ return typeof text25 === "string" ? text25.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "_").replace(/^_+|_+$/g, "") : text25;
157608
157623
  };
157609
157624
  var decision = external_exports.object({
157610
157625
  id: external_exports.string().regex(/^[a-z][a-z0-9_]{0,40}$/),
@@ -167532,7 +167547,7 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
167532
167547
  }
167533
167548
  errorsText(errors2 = this.errors, { separator = ", ", dataVar = "data" } = {}) {
167534
167549
  if (!errors2 || errors2.length === 0) return "No errors";
167535
- return errors2.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text24, msg) => text24 + separator + msg);
167550
+ return errors2.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text25, msg) => text25 + separator + msg);
167536
167551
  }
167537
167552
  $dataMetaSchema(metaSchema, keywordsJsonPointers) {
167538
167553
  const rules = this.RULES.all;
@@ -172935,21 +172950,21 @@ async function readRequestBody(request4, maxBytes = DEFAULT_MAX_REQUEST_BODY_SIZ
172935
172950
  const reader = request4.body.getReader();
172936
172951
  const decoder = new TextDecoder();
172937
172952
  let received = 0;
172938
- let text24 = "";
172953
+ let text25 = "";
172939
172954
  try {
172940
172955
  for (; ; ) {
172941
172956
  const { done, value: value4 } = await reader.read();
172942
172957
  if (done) break;
172943
172958
  received += value4.byteLength;
172944
172959
  if (received > maxBytes) return { tooLarge: true };
172945
- text24 += decoder.decode(value4, { stream: true });
172960
+ text25 += decoder.decode(value4, { stream: true });
172946
172961
  }
172947
172962
  } finally {
172948
172963
  reader.releaseLock();
172949
172964
  }
172950
172965
  return {
172951
172966
  tooLarge: false,
172952
- text: text24 + decoder.decode()
172967
+ text: text25 + decoder.decode()
172953
172968
  };
172954
172969
  }
172955
172970
  var WebStandardStreamableHTTPServerTransport = class {
@@ -173959,8 +173974,8 @@ function createMcpHandler(factory, options3 = {}) {
173959
173974
  }
173960
173975
 
173961
173976
  // backend/src/mcp/vendor-http.ts
173962
- function mcpTextResult(text24, isError = false) {
173963
- return { isError, content: [{ type: "text", text: text24 }] };
173977
+ function mcpTextResult(text25, isError = false) {
173978
+ return { isError, content: [{ type: "text", text: text25 }] };
173964
173979
  }
173965
173980
  function mcpJsonResult(value4, isError = false) {
173966
173981
  return {
@@ -174033,7 +174048,7 @@ function createVendorClient(info, tool, suffix = "", request4 = fetch) {
174033
174048
 
174034
174049
  // backend/src/mcp/slack.ts
174035
174050
  var id12 = external_exports.string().min(1).max(200);
174036
- var text21 = external_exports.string().max(4e4);
174051
+ var text22 = external_exports.string().max(4e4);
174037
174052
  var cursor3 = external_exports.string().max(4096).optional();
174038
174053
  var page15 = { limit: external_exports.number().int().min(1).max(1e3).optional(), cursor: cursor3 };
174039
174054
  var window4 = { oldest: id12.optional(), latest: id12.optional(), inclusive: external_exports.boolean().optional() };
@@ -174047,8 +174062,8 @@ var definitions2 = [
174047
174062
  ["conversations.members", "List the members of a visible channel.", { ...channel2, ...page15 }],
174048
174063
  ["conversations.join", "Join an existing public channel.", channel2],
174049
174064
  ["conversations.create", "Create a channel and join it as the bot.", { name: external_exports.string().regex(/^[a-z0-9_-]{1,80}$/), is_private: external_exports.boolean().optional() }],
174050
- ["chat.postMessage", "Post a message or reply. Supply thread_ts to reply in a thread.", { ...channel2, text: text21, thread_ts: id12.optional() }],
174051
- ["chat.update", "Edit a message authored by this bot. Text replaces prior blocks.", { ...channel2, ts: id12, text: text21 }],
174065
+ ["chat.postMessage", "Post a message or reply. Supply thread_ts to reply in a thread.", { ...channel2, text: text22, thread_ts: id12.optional() }],
174066
+ ["chat.update", "Edit a message authored by this bot. Text replaces prior blocks.", { ...channel2, ts: id12, text: text22 }],
174052
174067
  ["chat.delete", "Delete a message authored by this bot.", { ...channel2, ts: id12 }],
174053
174068
  ["chat.getPermalink", "Get a message permalink. It is a fictional workspace address.", { ...channel2, message_ts: id12 }],
174054
174069
  ["reactions.add", "Add a named reaction to a message.", { ...channel2, timestamp: id12, name: id12 }],
@@ -174100,7 +174115,7 @@ Next cursor: ${cursor4}` : ""}`;
174100
174115
  );
174101
174116
  server.registerTool(
174102
174117
  "slack_send_message",
174103
- { description: "Send a plain-text message to a Slack conversation.", inputSchema: external_exports.strictObject({ ...channelId, message: text21, thread_ts: id12.optional(), draft_id: id12.optional(), reply_broadcast: external_exports.boolean().optional() }), annotations: { readOnlyHint: false, openWorldHint: false } },
174118
+ { description: "Send a plain-text message to a Slack conversation.", inputSchema: external_exports.strictObject({ ...channelId, message: text22, thread_ts: id12.optional(), draft_id: id12.optional(), reply_broadcast: external_exports.boolean().optional() }), annotations: { readOnlyHint: false, openWorldHint: false } },
174104
174119
  ({ channel_id, message: message8, draft_id, ...args }, ctx) => draft_id ? Promise.resolve(mcpCoverageGap("slack_send_message", "Sending a saved draft is not implemented")) : /[*_~`\[\]]|(?:^|\n)(?:#{1,6} |[-+] |\d+\. )/.test(message8) ? Promise.resolve(mcpCoverageGap("slack_send_message", "Standard Markdown conversion is not implemented; use plain text")) : request4("chat.postMessage", { channel: channel_id, text: message8, ...args }, ctx.mcpReq.signal, (value4) => `Message sent to <#${value4.channel}>. Timestamp: ${value4.ts}`)
174105
174120
  );
174106
174121
  server.registerTool("slack_read_user_profile", { description: "Read a Slack user profile. Omit user_id for the authenticated user.", inputSchema: external_exports.strictObject({ user_id: id12.optional() }), annotations: { readOnlyHint: true } }, async ({ user_id }, ctx) => {
@@ -174148,8 +174163,8 @@ var GITHUB_REPOSITORY_MCP_TOOLS = [
174148
174163
  ];
174149
174164
  var slug8 = external_exports.string().regex(/^[A-Za-z0-9_.-]{1,100}$/);
174150
174165
  var repo2 = { owner: slug8, repo: slug8 };
174151
- var text22 = external_exports.string().min(1);
174152
- var branch2 = text22.refine(validGitBranch, "Invalid Git branch name");
174166
+ var text23 = external_exports.string().min(1);
174167
+ var branch2 = text23.refine(validGitBranch, "Invalid Git branch name");
174153
174168
  var page16 = { page: external_exports.number().int().min(1).optional(), perPage: external_exports.number().int().min(1).max(100).optional() };
174154
174169
  var read3 = { readOnlyHint: true, openWorldHint: false };
174155
174170
  var write2 = { readOnlyHint: false, openWorldHint: false };
@@ -174202,11 +174217,11 @@ function registerGithubRepositoryTools(server, api3) {
174202
174217
  inputSchema: external_exports.strictObject({
174203
174218
  ...repo2,
174204
174219
  ...page16,
174205
- sha: text22.optional(),
174206
- author: text22.optional(),
174207
- path: text22.optional(),
174208
- since: text22.optional(),
174209
- until: text22.optional(),
174220
+ sha: text23.optional(),
174221
+ author: text23.optional(),
174222
+ path: text23.optional(),
174223
+ since: text23.optional(),
174224
+ until: text23.optional(),
174210
174225
  fields: external_exports.array(external_exports.enum(["sha", "html_url", "commit", "author", "committer"])).optional()
174211
174226
  })
174212
174227
  }, (args, context3) => {
@@ -174222,7 +174237,7 @@ function registerGithubRepositoryTools(server, api3) {
174222
174237
  server.registerTool("get_commit", {
174223
174238
  description: "Read a commit with no file detail, file stats, or full patches. Parent SHAs are not part of this vendor result.",
174224
174239
  annotations: read3,
174225
- inputSchema: external_exports.strictObject({ ...repo2, ...page16, sha: text22, detail: external_exports.enum(["none", "stats", "full_patch"]).optional() })
174240
+ inputSchema: external_exports.strictObject({ ...repo2, ...page16, sha: text23, detail: external_exports.enum(["none", "stats", "full_patch"]).optional() })
174226
174241
  }, (args, context3) => invoke2("GET", `${root2(args)}/commits/${pathSegments(args.sha)}`, void 0, context3.mcpReq.signal, (value4) => {
174227
174242
  const size2 = args.perPage ?? 30, offset17 = ((args.page ?? 1) - 1) * size2;
174228
174243
  return minimalCommit({ ...value4, files: value4.files?.slice(offset17, offset17 + size2) }, args.detail ?? "stats");
@@ -174240,8 +174255,8 @@ function registerGithubRepositoryTools(server, api3) {
174240
174255
  inputSchema: external_exports.strictObject({
174241
174256
  ...repo2,
174242
174257
  path: external_exports.string().optional(),
174243
- ref: text22.optional(),
174244
- sha: text22.optional(),
174258
+ ref: text23.optional(),
174259
+ sha: text23.optional(),
174245
174260
  fields: external_exports.array(external_exports.enum(["type", "name", "path", "sha", "size", "html_url", "download_url", "url", "git_url", "target", "submodule_git_url"])).optional()
174246
174261
  })
174247
174262
  }, async (args, context3) => {
@@ -174291,7 +174306,7 @@ function registerGithubRepositoryTools(server, api3) {
174291
174306
  server.registerTool("create_or_update_file", {
174292
174307
  description: "Write raw text to one file on an existing branch. Supply the current blob SHA when updating.",
174293
174308
  annotations: write2,
174294
- inputSchema: external_exports.strictObject({ ...repo2, path: text22, content: text22, message: text22, branch: branch2, sha: text22.optional(), allow_symlink_write: external_exports.boolean().optional() })
174309
+ inputSchema: external_exports.strictObject({ ...repo2, path: text23, content: text23, message: text23, branch: branch2, sha: text23.optional(), allow_symlink_write: external_exports.boolean().optional() })
174295
174310
  }, async (args, context3) => {
174296
174311
  if (!safePath(args.path)) return mcpJsonResult({ message: "Invalid repository path" }, true);
174297
174312
  if (args.allow_symlink_write) return mcpCoverageGap("create_or_update_file", "Symbolic link writes are not implemented");
@@ -174309,7 +174324,7 @@ function registerGithubRepositoryTools(server, api3) {
174309
174324
  server.registerTool("create_pull_request", {
174310
174325
  description: "Open a same-repository pull request.",
174311
174326
  annotations: write2,
174312
- inputSchema: external_exports.strictObject({ ...repo2, title: text22, head: text22, base: text22, body: external_exports.string().optional(), draft: external_exports.boolean().optional(), maintainer_can_modify: external_exports.boolean().optional(), reviewers: external_exports.array(external_exports.string()).optional() })
174327
+ inputSchema: external_exports.strictObject({ ...repo2, title: text23, head: text23, base: text23, body: external_exports.string().optional(), draft: external_exports.boolean().optional(), maintainer_can_modify: external_exports.boolean().optional(), reviewers: external_exports.array(external_exports.string()).optional() })
174313
174328
  }, async (args, context3) => {
174314
174329
  if (args.reviewers?.length || args.maintainer_can_modify !== void 0) return mcpCoverageGap("create_pull_request", "Reviewer requests and maintainer edit controls are not implemented");
174315
174330
  const response5 = await api3.call("POST", `${root2(args)}/pulls`, { title: args.title, head: args.head, base: args.base, ...args.body !== void 0 ? { body: args.body } : {}, ...args.draft !== void 0 ? { draft: args.draft } : {} }, context3.mcpReq.signal);
@@ -174320,7 +174335,7 @@ function registerGithubRepositoryTools(server, api3) {
174320
174335
  server.registerTool("merge_pull_request", {
174321
174336
  description: "Merge an open pull request through the native merge path and its deployment hooks.",
174322
174337
  annotations: write2,
174323
- inputSchema: external_exports.strictObject({ ...repo2, pullNumber: external_exports.number().int().min(1), commit_title: external_exports.string().optional(), commit_message: external_exports.string().optional(), merge_method: external_exports.enum(["merge", "squash", "rebase"]).optional(), expectedHeadSha: text22.optional() })
174338
+ inputSchema: external_exports.strictObject({ ...repo2, pullNumber: external_exports.number().int().min(1), commit_title: external_exports.string().optional(), commit_message: external_exports.string().optional(), merge_method: external_exports.enum(["merge", "squash", "rebase"]).optional(), expectedHeadSha: text23.optional() })
174324
174339
  }, (args, context3) => invoke2(
174325
174340
  "PUT",
174326
174341
  `${root2(args)}/pulls/${args.pullNumber}/merge`,
@@ -174612,7 +174627,7 @@ var DATADOG_MCP_OPERATIONS = [
174612
174627
  ];
174613
174628
  var DATADOG_MCP_TOOL_NAMES = DATADOG_MCP_OPERATIONS;
174614
174629
  var read5 = { readOnlyHint: true, destructiveHint: false, openWorldHint: false };
174615
- var text23 = external_exports.string().max(16e3);
174630
+ var text24 = external_exports.string().max(16e3);
174616
174631
  var integer10 = external_exports.number().int().nonnegative();
174617
174632
  var schemaNote = " Native API.";
174618
174633
  var params9 = (value4) => new URLSearchParams(Object.entries(value4).filter(([, v]) => v !== void 0).map(([key4, value5]) => [key4, String(value5)]));
@@ -174628,11 +174643,11 @@ function datadogMcpServer(info, request4) {
174628
174643
  annotations: read5,
174629
174644
  inputSchema: external_exports.strictObject({
174630
174645
  monitor_id: integer10.optional(),
174631
- name: text23.optional(),
174632
- monitor_tags: text23.optional(),
174646
+ name: text24.optional(),
174647
+ monitor_tags: text24.optional(),
174633
174648
  page: integer10.optional(),
174634
174649
  page_size: integer10.min(1).max(1e3).optional(),
174635
- group_states: text23.optional()
174650
+ group_states: text24.optional()
174636
174651
  })
174637
174652
  }, async (args, context3) => {
174638
174653
  const { monitor_id, ...query10 } = args;
@@ -174644,7 +174659,7 @@ function datadogMcpServer(info, request4) {
174644
174659
  server.registerTool("get_datadog_metric", {
174645
174660
  description: "Query one native metric expression with integer epoch seconds from/to (maximum 24 hours)." + schemaNote,
174646
174661
  annotations: read5,
174647
- inputSchema: external_exports.strictObject({ query: text23.min(1), from: external_exports.number().int(), to: external_exports.number().int() })
174662
+ inputSchema: external_exports.strictObject({ query: text24.min(1), from: external_exports.number().int(), to: external_exports.number().int() })
174648
174663
  }, (args, context3) => api3.result("GET", `/api/v1/query?${params9(args)}`, void 0, context3.mcpReq.signal, headers));
174649
174664
  server.registerTool("search_datadog_events", {
174650
174665
  description: "Read native events using start/end epoch seconds and optional comma-separated tags." + schemaNote,
@@ -174652,9 +174667,9 @@ function datadogMcpServer(info, request4) {
174652
174667
  inputSchema: external_exports.strictObject({
174653
174668
  start: integer10,
174654
174669
  end: integer10,
174655
- tags: text23.optional(),
174670
+ tags: text24.optional(),
174656
174671
  priority: external_exports.enum(["normal", "low"]).optional(),
174657
- sources: text23.optional(),
174672
+ sources: text24.optional(),
174658
174673
  unaggregated: external_exports.boolean().optional(),
174659
174674
  exclude_aggregate: external_exports.boolean().optional(),
174660
174675
  page: integer10.optional()
@@ -174664,11 +174679,11 @@ function datadogMcpServer(info, request4) {
174664
174679
  description: "Search logs with the native query grammar, world-relative or ISO from/to, and cursor pagination." + schemaNote,
174665
174680
  annotations: read5,
174666
174681
  inputSchema: external_exports.strictObject({
174667
- query: text23.optional(),
174668
- from: text23.optional(),
174669
- to: text23.optional(),
174682
+ query: text24.optional(),
174683
+ from: text24.optional(),
174684
+ to: text24.optional(),
174670
174685
  limit: integer10.min(1).max(1e3).optional(),
174671
- cursor: text23.optional(),
174686
+ cursor: text24.optional(),
174672
174687
  sort: external_exports.enum(["timestamp", "-timestamp"]).optional()
174673
174688
  })
174674
174689
  }, (args, context3) => api3.result("POST", "/api/v2/logs/events/search", {
@@ -174937,19 +174952,19 @@ var HOP_HEADERS = /* @__PURE__ */ new Set(["connection", "proxy-connection", "pr
174937
174952
  var MODEL_REFUSALS = /* @__PURE__ */ new Set([401, 402, 403, 429]);
174938
174953
  var REFUSAL_BYTES = 4096;
174939
174954
  function refusalMessage(body6, encoding) {
174940
- let text24;
174955
+ let text25;
174941
174956
  try {
174942
174957
  const raw3 = encoding === "gzip" || encoding === "x-gzip" ? gunzipSync(body6) : encoding === "deflate" ? inflateSync2(body6) : encoding === "br" ? brotliDecompressSync(body6) : !encoding || encoding === "identity" ? body6 : void 0;
174943
174958
  if (raw3 === void 0) return void 0;
174944
- text24 = raw3.toString("utf8");
174959
+ text25 = raw3.toString("utf8");
174945
174960
  } catch {
174946
174961
  return void 0;
174947
174962
  }
174948
- let message8 = text24;
174963
+ let message8 = text25;
174949
174964
  try {
174950
- const json33 = JSON.parse(text24);
174965
+ const json33 = JSON.parse(text25);
174951
174966
  const error64 = json33?.error;
174952
- message8 = typeof error64 === "string" ? error64 : typeof error64?.message === "string" ? error64.message : typeof json33?.message === "string" ? json33.message : typeof json33?.detail === "string" ? json33.detail : typeof error64?.type === "string" ? error64.type : typeof error64?.code === "string" ? error64.code : text24;
174967
+ message8 = typeof error64 === "string" ? error64 : typeof error64?.message === "string" ? error64.message : typeof json33?.message === "string" ? json33.message : typeof json33?.detail === "string" ? json33.detail : typeof error64?.type === "string" ? error64.type : typeof error64?.code === "string" ? error64.code : text25;
174953
174968
  } catch {
174954
174969
  }
174955
174970
  const line2 = String(message8).replace(/\b(sk|rk|pk)-[\w*-]{4,}/g, "$1-\u2026").replace(/\s+/g, " ").trim();