@buzzni/saycode-cli 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.mjs CHANGED
@@ -6,12 +6,12 @@ import require$$0 from "crypto";
6
6
  import { mkdirSync, writeFileSync, readFileSync, rmSync, chmodSync } from "node:fs";
7
7
  import { dirname, join } from "node:path";
8
8
  import require$$0$1 from "fs";
9
- import require$$1$1 from "url";
10
- import require$$2$1 from "child_process";
9
+ import require$$1 from "url";
10
+ import require$$2 from "child_process";
11
11
  import require$$3 from "http";
12
12
  import require$$4 from "https";
13
- import require$$1$2 from "tty";
14
- import require$$1$3 from "util";
13
+ import require$$1$1 from "tty";
14
+ import require$$1$2 from "util";
15
15
  import require$$0$2 from "os";
16
16
  import require$$0$6 from "events";
17
17
  import require$$3$1 from "net";
@@ -37,7 +37,7 @@ function _mergeNamespaces(n, m) {
37
37
  }
38
38
  return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
39
39
  }
40
- const version = "0.1.0";
40
+ const version = "0.1.2";
41
41
  const manifest = {
42
42
  version
43
43
  };
@@ -235,30 +235,6 @@ Leaving never stops a remote session — it keeps running on the machine.`;
235
235
  function getDefaultExportFromCjs(x) {
236
236
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
237
237
  }
238
- function getAugmentedNamespace(n) {
239
- if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
240
- var f = n.default;
241
- if (typeof f == "function") {
242
- var a = function a2() {
243
- if (this instanceof a2) {
244
- return Reflect.construct(f, arguments, this.constructor);
245
- }
246
- return f.apply(this, arguments);
247
- };
248
- a.prototype = f.prototype;
249
- } else a = {};
250
- Object.defineProperty(a, "__esModule", { value: true });
251
- Object.keys(n).forEach(function(k) {
252
- var d = Object.getOwnPropertyDescriptor(n, k);
253
- Object.defineProperty(a, k, d.get ? d : {
254
- enumerable: true,
255
- get: function() {
256
- return n[k];
257
- }
258
- });
259
- });
260
- return a;
261
- }
262
238
  function commonjsRequire(path) {
263
239
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
264
240
  }
@@ -2829,1791 +2805,43 @@ function parseProjectConversationsPayload(value2) {
2829
2805
  warnings: stringArray(value2.warnings)
2830
2806
  };
2831
2807
  }
2832
- const scopes = /* @__PURE__ */ new Set(["owned", "collaborating", "shared"]);
2833
- const sorts = /* @__PURE__ */ new Set(["activity", "updated", "created", "name"]);
2834
- function buildProjectListV2Path(input) {
2835
- if (input.context !== "personal" && (!input.context.startsWith("company:") || input.context.length === "company:".length) || !scopes.has(input.scope) || !Number.isInteger(input.limit) || input.limit < 1 || input.limit > 100) {
2836
- throw new Error("Invalid project list v2 query");
2837
- }
2838
- const sort = input.sort ?? "activity";
2839
- if (!sorts.has(sort)) throw new Error("Invalid project list v2 query");
2840
- const params = new URLSearchParams();
2841
- params.set("context", input.context);
2842
- params.set("scope", input.scope);
2843
- params.set("limit", String(input.limit));
2844
- params.set("sort", sort);
2845
- const query = input.query?.trim();
2846
- if (query) params.set("q", query);
2847
- if (input.cursor) params.set("cursor", input.cursor);
2848
- return `/api/v2/projects?${params.toString()}`;
2849
- }
2850
- function isProjectListV2Item(value2) {
2851
- if (!value2 || typeof value2 !== "object") return false;
2852
- const item = value2;
2853
- return typeof item.id === "string" && typeof item.name === "string" && typeof item.userId === "string" && typeof item.createdAt === "number" && typeof item.updatedAt === "number" && scopes.has(item.access) && typeof item.lastActivityAt === "number" && Number.isFinite(item.lastActivityAt);
2854
- }
2855
- function parseProjectListV2Page(body) {
2856
- if (!body || typeof body !== "object" || Array.isArray(body)) {
2857
- throw new Error("Invalid project list v2 response");
2858
- }
2859
- const page = body;
2860
- if (!Array.isArray(page.items) || !page.items.every(isProjectListV2Item) || page.nextCursor !== null && typeof page.nextCursor !== "string" || !Number.isInteger(page.total) || page.total < 0) {
2861
- throw new Error("Invalid project list v2 response");
2862
- }
2863
- return {
2864
- items: page.items,
2865
- nextCursor: page.nextCursor,
2866
- total: page.total
2867
- };
2868
- }
2869
- var jsxRuntime = { exports: {} };
2870
- var reactJsxRuntime_production = {};
2871
- /**
2872
- * @license React
2873
- * react-jsx-runtime.production.js
2874
- *
2875
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2876
- *
2877
- * This source code is licensed under the MIT license found in the
2878
- * LICENSE file in the root directory of this source tree.
2879
- */
2880
- var hasRequiredReactJsxRuntime_production;
2881
- function requireReactJsxRuntime_production() {
2882
- if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
2883
- hasRequiredReactJsxRuntime_production = 1;
2884
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
2885
- function jsxProd(type, config, maybeKey) {
2886
- var key = null;
2887
- void 0 !== maybeKey && (key = "" + maybeKey);
2888
- void 0 !== config.key && (key = "" + config.key);
2889
- if ("key" in config) {
2890
- maybeKey = {};
2891
- for (var propName in config)
2892
- "key" !== propName && (maybeKey[propName] = config[propName]);
2893
- } else maybeKey = config;
2894
- config = maybeKey.ref;
2895
- return {
2896
- $$typeof: REACT_ELEMENT_TYPE,
2897
- type,
2898
- key,
2899
- ref: void 0 !== config ? config : null,
2900
- props: maybeKey
2901
- };
2902
- }
2903
- reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
2904
- reactJsxRuntime_production.jsx = jsxProd;
2905
- reactJsxRuntime_production.jsxs = jsxProd;
2906
- return reactJsxRuntime_production;
2907
- }
2908
- var reactJsxRuntime_development = {};
2909
- var react = { exports: {} };
2910
- var react_production = {};
2911
- /**
2912
- * @license React
2913
- * react.production.js
2914
- *
2915
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2916
- *
2917
- * This source code is licensed under the MIT license found in the
2918
- * LICENSE file in the root directory of this source tree.
2919
- */
2920
- var hasRequiredReact_production;
2921
- function requireReact_production() {
2922
- if (hasRequiredReact_production) return react_production;
2923
- hasRequiredReact_production = 1;
2924
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
2925
- function getIteratorFn(maybeIterable) {
2926
- if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
2927
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
2928
- return "function" === typeof maybeIterable ? maybeIterable : null;
2929
- }
2930
- var ReactNoopUpdateQueue = {
2931
- isMounted: function() {
2932
- return false;
2933
- },
2934
- enqueueForceUpdate: function() {
2935
- },
2936
- enqueueReplaceState: function() {
2937
- },
2938
- enqueueSetState: function() {
2939
- }
2940
- }, assign = Object.assign, emptyObject = {};
2941
- function Component(props, context, updater) {
2942
- this.props = props;
2943
- this.context = context;
2944
- this.refs = emptyObject;
2945
- this.updater = updater || ReactNoopUpdateQueue;
2946
- }
2947
- Component.prototype.isReactComponent = {};
2948
- Component.prototype.setState = function(partialState, callback) {
2949
- if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
2950
- throw Error(
2951
- "takes an object of state variables to update or a function which returns an object of state variables."
2952
- );
2953
- this.updater.enqueueSetState(this, partialState, callback, "setState");
2954
- };
2955
- Component.prototype.forceUpdate = function(callback) {
2956
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
2957
- };
2958
- function ComponentDummy() {
2959
- }
2960
- ComponentDummy.prototype = Component.prototype;
2961
- function PureComponent(props, context, updater) {
2962
- this.props = props;
2963
- this.context = context;
2964
- this.refs = emptyObject;
2965
- this.updater = updater || ReactNoopUpdateQueue;
2966
- }
2967
- var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
2968
- pureComponentPrototype.constructor = PureComponent;
2969
- assign(pureComponentPrototype, Component.prototype);
2970
- pureComponentPrototype.isPureReactComponent = true;
2971
- var isArrayImpl = Array.isArray;
2972
- function noop() {
2973
- }
2974
- var ReactSharedInternals = { H: null, A: null, T: null, S: null }, hasOwnProperty = Object.prototype.hasOwnProperty;
2975
- function ReactElement(type, key, props) {
2976
- var refProp = props.ref;
2977
- return {
2978
- $$typeof: REACT_ELEMENT_TYPE,
2979
- type,
2980
- key,
2981
- ref: void 0 !== refProp ? refProp : null,
2982
- props
2983
- };
2984
- }
2985
- function cloneAndReplaceKey(oldElement, newKey) {
2986
- return ReactElement(oldElement.type, newKey, oldElement.props);
2987
- }
2988
- function isValidElement(object) {
2989
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
2990
- }
2991
- function escape(key) {
2992
- var escaperLookup = { "=": "=0", ":": "=2" };
2993
- return "$" + key.replace(/[=:]/g, function(match) {
2994
- return escaperLookup[match];
2995
- });
2996
- }
2997
- var userProvidedKeyEscapeRegex = /\/+/g;
2998
- function getElementKey(element, index) {
2999
- return "object" === typeof element && null !== element && null != element.key ? escape("" + element.key) : index.toString(36);
3000
- }
3001
- function resolveThenable(thenable) {
3002
- switch (thenable.status) {
3003
- case "fulfilled":
3004
- return thenable.value;
3005
- case "rejected":
3006
- throw thenable.reason;
3007
- default:
3008
- switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
3009
- function(fulfilledValue) {
3010
- "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
3011
- },
3012
- function(error) {
3013
- "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
3014
- }
3015
- )), thenable.status) {
3016
- case "fulfilled":
3017
- return thenable.value;
3018
- case "rejected":
3019
- throw thenable.reason;
3020
- }
3021
- }
3022
- throw thenable;
3023
- }
3024
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
3025
- var type = typeof children;
3026
- if ("undefined" === type || "boolean" === type) children = null;
3027
- var invokeCallback = false;
3028
- if (null === children) invokeCallback = true;
3029
- else
3030
- switch (type) {
3031
- case "bigint":
3032
- case "string":
3033
- case "number":
3034
- invokeCallback = true;
3035
- break;
3036
- case "object":
3037
- switch (children.$$typeof) {
3038
- case REACT_ELEMENT_TYPE:
3039
- case REACT_PORTAL_TYPE:
3040
- invokeCallback = true;
3041
- break;
3042
- case REACT_LAZY_TYPE:
3043
- return invokeCallback = children._init, mapIntoArray(
3044
- invokeCallback(children._payload),
3045
- array,
3046
- escapedPrefix,
3047
- nameSoFar,
3048
- callback
3049
- );
3050
- }
3051
- }
3052
- if (invokeCallback)
3053
- return callback = callback(children), invokeCallback = "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar, isArrayImpl(callback) ? (escapedPrefix = "", null != invokeCallback && (escapedPrefix = invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
3054
- return c;
3055
- })) : null != callback && (isValidElement(callback) && (callback = cloneAndReplaceKey(
3056
- callback,
3057
- escapedPrefix + (null == callback.key || children && children.key === callback.key ? "" : ("" + callback.key).replace(
3058
- userProvidedKeyEscapeRegex,
3059
- "$&/"
3060
- ) + "/") + invokeCallback
3061
- )), array.push(callback)), 1;
3062
- invokeCallback = 0;
3063
- var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
3064
- if (isArrayImpl(children))
3065
- for (var i = 0; i < children.length; i++)
3066
- nameSoFar = children[i], type = nextNamePrefix + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
3067
- nameSoFar,
3068
- array,
3069
- escapedPrefix,
3070
- type,
3071
- callback
3072
- );
3073
- else if (i = getIteratorFn(children), "function" === typeof i)
3074
- for (children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
3075
- nameSoFar = nameSoFar.value, type = nextNamePrefix + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
3076
- nameSoFar,
3077
- array,
3078
- escapedPrefix,
3079
- type,
3080
- callback
3081
- );
3082
- else if ("object" === type) {
3083
- if ("function" === typeof children.then)
3084
- return mapIntoArray(
3085
- resolveThenable(children),
3086
- array,
3087
- escapedPrefix,
3088
- nameSoFar,
3089
- callback
3090
- );
3091
- array = String(children);
3092
- throw Error(
3093
- "Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead."
3094
- );
3095
- }
3096
- return invokeCallback;
3097
- }
3098
- function mapChildren(children, func, context) {
3099
- if (null == children) return children;
3100
- var result = [], count = 0;
3101
- mapIntoArray(children, result, "", "", function(child) {
3102
- return func.call(context, child, count++);
3103
- });
3104
- return result;
3105
- }
3106
- function lazyInitializer(payload) {
3107
- if (-1 === payload._status) {
3108
- var ctor = payload._result;
3109
- ctor = ctor();
3110
- ctor.then(
3111
- function(moduleObject) {
3112
- if (0 === payload._status || -1 === payload._status)
3113
- payload._status = 1, payload._result = moduleObject;
3114
- },
3115
- function(error) {
3116
- if (0 === payload._status || -1 === payload._status)
3117
- payload._status = 2, payload._result = error;
3118
- }
3119
- );
3120
- -1 === payload._status && (payload._status = 0, payload._result = ctor);
3121
- }
3122
- if (1 === payload._status) return payload._result.default;
3123
- throw payload._result;
3124
- }
3125
- var reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
3126
- if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
3127
- var event = new window.ErrorEvent("error", {
3128
- bubbles: true,
3129
- cancelable: true,
3130
- message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
3131
- error
3132
- });
3133
- if (!window.dispatchEvent(event)) return;
3134
- } else if ("object" === typeof process && "function" === typeof process.emit) {
3135
- process.emit("uncaughtException", error);
3136
- return;
3137
- }
3138
- console.error(error);
3139
- }, Children = {
3140
- map: mapChildren,
3141
- forEach: function(children, forEachFunc, forEachContext) {
3142
- mapChildren(
3143
- children,
3144
- function() {
3145
- forEachFunc.apply(this, arguments);
3146
- },
3147
- forEachContext
3148
- );
3149
- },
3150
- count: function(children) {
3151
- var n = 0;
3152
- mapChildren(children, function() {
3153
- n++;
3154
- });
3155
- return n;
3156
- },
3157
- toArray: function(children) {
3158
- return mapChildren(children, function(child) {
3159
- return child;
3160
- }) || [];
3161
- },
3162
- only: function(children) {
3163
- if (!isValidElement(children))
3164
- throw Error(
3165
- "React.Children.only expected to receive a single React element child."
3166
- );
3167
- return children;
3168
- }
3169
- };
3170
- react_production.Activity = REACT_ACTIVITY_TYPE;
3171
- react_production.Children = Children;
3172
- react_production.Component = Component;
3173
- react_production.Fragment = REACT_FRAGMENT_TYPE;
3174
- react_production.Profiler = REACT_PROFILER_TYPE;
3175
- react_production.PureComponent = PureComponent;
3176
- react_production.StrictMode = REACT_STRICT_MODE_TYPE;
3177
- react_production.Suspense = REACT_SUSPENSE_TYPE;
3178
- react_production.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
3179
- react_production.__COMPILER_RUNTIME = {
3180
- __proto__: null,
3181
- c: function(size) {
3182
- return ReactSharedInternals.H.useMemoCache(size);
3183
- }
3184
- };
3185
- react_production.cache = function(fn) {
3186
- return function() {
3187
- return fn.apply(null, arguments);
3188
- };
3189
- };
3190
- react_production.cacheSignal = function() {
3191
- return null;
3192
- };
3193
- react_production.cloneElement = function(element, config, children) {
3194
- if (null === element || void 0 === element)
3195
- throw Error(
3196
- "The argument must be a React element, but you passed " + element + "."
3197
- );
3198
- var props = assign({}, element.props), key = element.key;
3199
- if (null != config)
3200
- for (propName in void 0 !== config.key && (key = "" + config.key), config)
3201
- !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
3202
- var propName = arguments.length - 2;
3203
- if (1 === propName) props.children = children;
3204
- else if (1 < propName) {
3205
- for (var childArray = Array(propName), i = 0; i < propName; i++)
3206
- childArray[i] = arguments[i + 2];
3207
- props.children = childArray;
3208
- }
3209
- return ReactElement(element.type, key, props);
3210
- };
3211
- react_production.createContext = function(defaultValue) {
3212
- defaultValue = {
3213
- $$typeof: REACT_CONTEXT_TYPE,
3214
- _currentValue: defaultValue,
3215
- _currentValue2: defaultValue,
3216
- _threadCount: 0,
3217
- Provider: null,
3218
- Consumer: null
3219
- };
3220
- defaultValue.Provider = defaultValue;
3221
- defaultValue.Consumer = {
3222
- $$typeof: REACT_CONSUMER_TYPE,
3223
- _context: defaultValue
3224
- };
3225
- return defaultValue;
3226
- };
3227
- react_production.createElement = function(type, config, children) {
3228
- var propName, props = {}, key = null;
3229
- if (null != config)
3230
- for (propName in void 0 !== config.key && (key = "" + config.key), config)
3231
- hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (props[propName] = config[propName]);
3232
- var childrenLength = arguments.length - 2;
3233
- if (1 === childrenLength) props.children = children;
3234
- else if (1 < childrenLength) {
3235
- for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
3236
- childArray[i] = arguments[i + 2];
3237
- props.children = childArray;
3238
- }
3239
- if (type && type.defaultProps)
3240
- for (propName in childrenLength = type.defaultProps, childrenLength)
3241
- void 0 === props[propName] && (props[propName] = childrenLength[propName]);
3242
- return ReactElement(type, key, props);
3243
- };
3244
- react_production.createRef = function() {
3245
- return { current: null };
3246
- };
3247
- react_production.forwardRef = function(render) {
3248
- return { $$typeof: REACT_FORWARD_REF_TYPE, render };
3249
- };
3250
- react_production.isValidElement = isValidElement;
3251
- react_production.lazy = function(ctor) {
3252
- return {
3253
- $$typeof: REACT_LAZY_TYPE,
3254
- _payload: { _status: -1, _result: ctor },
3255
- _init: lazyInitializer
3256
- };
3257
- };
3258
- react_production.memo = function(type, compare) {
3259
- return {
3260
- $$typeof: REACT_MEMO_TYPE,
3261
- type,
3262
- compare: void 0 === compare ? null : compare
3263
- };
3264
- };
3265
- react_production.startTransition = function(scope) {
3266
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
3267
- ReactSharedInternals.T = currentTransition;
3268
- try {
3269
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
3270
- null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
3271
- "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && returnValue.then(noop, reportGlobalError);
3272
- } catch (error) {
3273
- reportGlobalError(error);
3274
- } finally {
3275
- null !== prevTransition && null !== currentTransition.types && (prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
3276
- }
3277
- };
3278
- react_production.unstable_useCacheRefresh = function() {
3279
- return ReactSharedInternals.H.useCacheRefresh();
3280
- };
3281
- react_production.use = function(usable) {
3282
- return ReactSharedInternals.H.use(usable);
3283
- };
3284
- react_production.useActionState = function(action, initialState, permalink) {
3285
- return ReactSharedInternals.H.useActionState(action, initialState, permalink);
3286
- };
3287
- react_production.useCallback = function(callback, deps) {
3288
- return ReactSharedInternals.H.useCallback(callback, deps);
3289
- };
3290
- react_production.useContext = function(Context) {
3291
- return ReactSharedInternals.H.useContext(Context);
3292
- };
3293
- react_production.useDebugValue = function() {
3294
- };
3295
- react_production.useDeferredValue = function(value2, initialValue) {
3296
- return ReactSharedInternals.H.useDeferredValue(value2, initialValue);
3297
- };
3298
- react_production.useEffect = function(create, deps) {
3299
- return ReactSharedInternals.H.useEffect(create, deps);
3300
- };
3301
- react_production.useEffectEvent = function(callback) {
3302
- return ReactSharedInternals.H.useEffectEvent(callback);
3303
- };
3304
- react_production.useId = function() {
3305
- return ReactSharedInternals.H.useId();
3306
- };
3307
- react_production.useImperativeHandle = function(ref, create, deps) {
3308
- return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
3309
- };
3310
- react_production.useInsertionEffect = function(create, deps) {
3311
- return ReactSharedInternals.H.useInsertionEffect(create, deps);
3312
- };
3313
- react_production.useLayoutEffect = function(create, deps) {
3314
- return ReactSharedInternals.H.useLayoutEffect(create, deps);
3315
- };
3316
- react_production.useMemo = function(create, deps) {
3317
- return ReactSharedInternals.H.useMemo(create, deps);
3318
- };
3319
- react_production.useOptimistic = function(passthrough, reducer) {
3320
- return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
3321
- };
3322
- react_production.useReducer = function(reducer, initialArg, init) {
3323
- return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
3324
- };
3325
- react_production.useRef = function(initialValue) {
3326
- return ReactSharedInternals.H.useRef(initialValue);
3327
- };
3328
- react_production.useState = function(initialState) {
3329
- return ReactSharedInternals.H.useState(initialState);
3330
- };
3331
- react_production.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
3332
- return ReactSharedInternals.H.useSyncExternalStore(
3333
- subscribe,
3334
- getSnapshot,
3335
- getServerSnapshot
3336
- );
3337
- };
3338
- react_production.useTransition = function() {
3339
- return ReactSharedInternals.H.useTransition();
3340
- };
3341
- react_production.version = "19.2.7";
3342
- return react_production;
3343
- }
3344
- var react_development = { exports: {} };
3345
- /**
3346
- * @license React
3347
- * react.development.js
3348
- *
3349
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3350
- *
3351
- * This source code is licensed under the MIT license found in the
3352
- * LICENSE file in the root directory of this source tree.
3353
- */
3354
- react_development.exports;
3355
- var hasRequiredReact_development;
3356
- function requireReact_development() {
3357
- if (hasRequiredReact_development) return react_development.exports;
3358
- hasRequiredReact_development = 1;
3359
- (function(module, exports) {
3360
- "production" !== process.env.NODE_ENV && (function() {
3361
- function defineDeprecationWarning(methodName, info) {
3362
- Object.defineProperty(Component.prototype, methodName, {
3363
- get: function() {
3364
- console.warn(
3365
- "%s(...) is deprecated in plain JavaScript React classes. %s",
3366
- info[0],
3367
- info[1]
3368
- );
3369
- }
3370
- });
3371
- }
3372
- function getIteratorFn(maybeIterable) {
3373
- if (null === maybeIterable || "object" !== typeof maybeIterable)
3374
- return null;
3375
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
3376
- return "function" === typeof maybeIterable ? maybeIterable : null;
3377
- }
3378
- function warnNoop(publicInstance, callerName) {
3379
- publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
3380
- var warningKey = publicInstance + "." + callerName;
3381
- didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error(
3382
- "Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",
3383
- callerName,
3384
- publicInstance
3385
- ), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
3386
- }
3387
- function Component(props, context, updater) {
3388
- this.props = props;
3389
- this.context = context;
3390
- this.refs = emptyObject;
3391
- this.updater = updater || ReactNoopUpdateQueue;
3392
- }
3393
- function ComponentDummy() {
3394
- }
3395
- function PureComponent(props, context, updater) {
3396
- this.props = props;
3397
- this.context = context;
3398
- this.refs = emptyObject;
3399
- this.updater = updater || ReactNoopUpdateQueue;
3400
- }
3401
- function noop() {
3402
- }
3403
- function testStringCoercion(value2) {
3404
- return "" + value2;
3405
- }
3406
- function checkKeyStringCoercion(value2) {
3407
- try {
3408
- testStringCoercion(value2);
3409
- var JSCompiler_inline_result = false;
3410
- } catch (e) {
3411
- JSCompiler_inline_result = true;
3412
- }
3413
- if (JSCompiler_inline_result) {
3414
- JSCompiler_inline_result = console;
3415
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
3416
- var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value2[Symbol.toStringTag] || value2.constructor.name || "Object";
3417
- JSCompiler_temp_const.call(
3418
- JSCompiler_inline_result,
3419
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
3420
- JSCompiler_inline_result$jscomp$0
3421
- );
3422
- return testStringCoercion(value2);
3423
- }
3424
- }
3425
- function getComponentNameFromType(type) {
3426
- if (null == type) return null;
3427
- if ("function" === typeof type)
3428
- return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
3429
- if ("string" === typeof type) return type;
3430
- switch (type) {
3431
- case REACT_FRAGMENT_TYPE:
3432
- return "Fragment";
3433
- case REACT_PROFILER_TYPE:
3434
- return "Profiler";
3435
- case REACT_STRICT_MODE_TYPE:
3436
- return "StrictMode";
3437
- case REACT_SUSPENSE_TYPE:
3438
- return "Suspense";
3439
- case REACT_SUSPENSE_LIST_TYPE:
3440
- return "SuspenseList";
3441
- case REACT_ACTIVITY_TYPE:
3442
- return "Activity";
3443
- }
3444
- if ("object" === typeof type)
3445
- switch ("number" === typeof type.tag && console.error(
3446
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
3447
- ), type.$$typeof) {
3448
- case REACT_PORTAL_TYPE:
3449
- return "Portal";
3450
- case REACT_CONTEXT_TYPE:
3451
- return type.displayName || "Context";
3452
- case REACT_CONSUMER_TYPE:
3453
- return (type._context.displayName || "Context") + ".Consumer";
3454
- case REACT_FORWARD_REF_TYPE:
3455
- var innerType = type.render;
3456
- type = type.displayName;
3457
- type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
3458
- return type;
3459
- case REACT_MEMO_TYPE:
3460
- return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
3461
- case REACT_LAZY_TYPE:
3462
- innerType = type._payload;
3463
- type = type._init;
3464
- try {
3465
- return getComponentNameFromType(type(innerType));
3466
- } catch (x) {
3467
- }
3468
- }
3469
- return null;
3470
- }
3471
- function getTaskName(type) {
3472
- if (type === REACT_FRAGMENT_TYPE) return "<>";
3473
- if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
3474
- return "<...>";
3475
- try {
3476
- var name = getComponentNameFromType(type);
3477
- return name ? "<" + name + ">" : "<...>";
3478
- } catch (x) {
3479
- return "<...>";
3480
- }
3481
- }
3482
- function getOwner() {
3483
- var dispatcher = ReactSharedInternals.A;
3484
- return null === dispatcher ? null : dispatcher.getOwner();
3485
- }
3486
- function UnknownOwner() {
3487
- return Error("react-stack-top-frame");
3488
- }
3489
- function hasValidKey(config) {
3490
- if (hasOwnProperty.call(config, "key")) {
3491
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
3492
- if (getter && getter.isReactWarning) return false;
3493
- }
3494
- return void 0 !== config.key;
3495
- }
3496
- function defineKeyPropWarningGetter(props, displayName) {
3497
- function warnAboutAccessingKey() {
3498
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
3499
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
3500
- displayName
3501
- ));
3502
- }
3503
- warnAboutAccessingKey.isReactWarning = true;
3504
- Object.defineProperty(props, "key", {
3505
- get: warnAboutAccessingKey,
3506
- configurable: true
3507
- });
3508
- }
3509
- function elementRefGetterWithDeprecationWarning() {
3510
- var componentName = getComponentNameFromType(this.type);
3511
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
3512
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
3513
- ));
3514
- componentName = this.props.ref;
3515
- return void 0 !== componentName ? componentName : null;
3516
- }
3517
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
3518
- var refProp = props.ref;
3519
- type = {
3520
- $$typeof: REACT_ELEMENT_TYPE,
3521
- type,
3522
- key,
3523
- props,
3524
- _owner: owner
3525
- };
3526
- null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
3527
- enumerable: false,
3528
- get: elementRefGetterWithDeprecationWarning
3529
- }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
3530
- type._store = {};
3531
- Object.defineProperty(type._store, "validated", {
3532
- configurable: false,
3533
- enumerable: false,
3534
- writable: true,
3535
- value: 0
3536
- });
3537
- Object.defineProperty(type, "_debugInfo", {
3538
- configurable: false,
3539
- enumerable: false,
3540
- writable: true,
3541
- value: null
3542
- });
3543
- Object.defineProperty(type, "_debugStack", {
3544
- configurable: false,
3545
- enumerable: false,
3546
- writable: true,
3547
- value: debugStack
3548
- });
3549
- Object.defineProperty(type, "_debugTask", {
3550
- configurable: false,
3551
- enumerable: false,
3552
- writable: true,
3553
- value: debugTask
3554
- });
3555
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
3556
- return type;
3557
- }
3558
- function cloneAndReplaceKey(oldElement, newKey) {
3559
- newKey = ReactElement(
3560
- oldElement.type,
3561
- newKey,
3562
- oldElement.props,
3563
- oldElement._owner,
3564
- oldElement._debugStack,
3565
- oldElement._debugTask
3566
- );
3567
- oldElement._store && (newKey._store.validated = oldElement._store.validated);
3568
- return newKey;
3569
- }
3570
- function validateChildKeys(node2) {
3571
- isValidElement(node2) ? node2._store && (node2._store.validated = 1) : "object" === typeof node2 && null !== node2 && node2.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node2._payload.status ? isValidElement(node2._payload.value) && node2._payload.value._store && (node2._payload.value._store.validated = 1) : node2._store && (node2._store.validated = 1));
3572
- }
3573
- function isValidElement(object) {
3574
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
3575
- }
3576
- function escape(key) {
3577
- var escaperLookup = { "=": "=0", ":": "=2" };
3578
- return "$" + key.replace(/[=:]/g, function(match) {
3579
- return escaperLookup[match];
3580
- });
3581
- }
3582
- function getElementKey(element, index) {
3583
- return "object" === typeof element && null !== element && null != element.key ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
3584
- }
3585
- function resolveThenable(thenable) {
3586
- switch (thenable.status) {
3587
- case "fulfilled":
3588
- return thenable.value;
3589
- case "rejected":
3590
- throw thenable.reason;
3591
- default:
3592
- switch ("string" === typeof thenable.status ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(
3593
- function(fulfilledValue) {
3594
- "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
3595
- },
3596
- function(error) {
3597
- "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
3598
- }
3599
- )), thenable.status) {
3600
- case "fulfilled":
3601
- return thenable.value;
3602
- case "rejected":
3603
- throw thenable.reason;
3604
- }
3605
- }
3606
- throw thenable;
3607
- }
3608
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
3609
- var type = typeof children;
3610
- if ("undefined" === type || "boolean" === type) children = null;
3611
- var invokeCallback = false;
3612
- if (null === children) invokeCallback = true;
3613
- else
3614
- switch (type) {
3615
- case "bigint":
3616
- case "string":
3617
- case "number":
3618
- invokeCallback = true;
3619
- break;
3620
- case "object":
3621
- switch (children.$$typeof) {
3622
- case REACT_ELEMENT_TYPE:
3623
- case REACT_PORTAL_TYPE:
3624
- invokeCallback = true;
3625
- break;
3626
- case REACT_LAZY_TYPE:
3627
- return invokeCallback = children._init, mapIntoArray(
3628
- invokeCallback(children._payload),
3629
- array,
3630
- escapedPrefix,
3631
- nameSoFar,
3632
- callback
3633
- );
3634
- }
3635
- }
3636
- if (invokeCallback) {
3637
- invokeCallback = children;
3638
- callback = callback(invokeCallback);
3639
- var childKey = "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
3640
- isArrayImpl(callback) ? (escapedPrefix = "", null != childKey && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
3641
- return c;
3642
- })) : null != callback && (isValidElement(callback) && (null != callback.key && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(
3643
- callback,
3644
- escapedPrefix + (null == callback.key || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(
3645
- userProvidedKeyEscapeRegex,
3646
- "$&/"
3647
- ) + "/") + childKey
3648
- ), "" !== nameSoFar && null != invokeCallback && isValidElement(invokeCallback) && null == invokeCallback.key && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
3649
- return 1;
3650
- }
3651
- invokeCallback = 0;
3652
- childKey = "" === nameSoFar ? "." : nameSoFar + ":";
3653
- if (isArrayImpl(children))
3654
- for (var i = 0; i < children.length; i++)
3655
- nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
3656
- nameSoFar,
3657
- array,
3658
- escapedPrefix,
3659
- type,
3660
- callback
3661
- );
3662
- else if (i = getIteratorFn(children), "function" === typeof i)
3663
- for (i === children.entries && (didWarnAboutMaps || console.warn(
3664
- "Using Maps as children is not supported. Use an array of keyed ReactElements instead."
3665
- ), didWarnAboutMaps = true), children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
3666
- nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
3667
- nameSoFar,
3668
- array,
3669
- escapedPrefix,
3670
- type,
3671
- callback
3672
- );
3673
- else if ("object" === type) {
3674
- if ("function" === typeof children.then)
3675
- return mapIntoArray(
3676
- resolveThenable(children),
3677
- array,
3678
- escapedPrefix,
3679
- nameSoFar,
3680
- callback
3681
- );
3682
- array = String(children);
3683
- throw Error(
3684
- "Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead."
3685
- );
3686
- }
3687
- return invokeCallback;
3688
- }
3689
- function mapChildren(children, func, context) {
3690
- if (null == children) return children;
3691
- var result = [], count = 0;
3692
- mapIntoArray(children, result, "", "", function(child) {
3693
- return func.call(context, child, count++);
3694
- });
3695
- return result;
3696
- }
3697
- function lazyInitializer(payload) {
3698
- if (-1 === payload._status) {
3699
- var ioInfo = payload._ioInfo;
3700
- null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
3701
- ioInfo = payload._result;
3702
- var thenable = ioInfo();
3703
- thenable.then(
3704
- function(moduleObject) {
3705
- if (0 === payload._status || -1 === payload._status) {
3706
- payload._status = 1;
3707
- payload._result = moduleObject;
3708
- var _ioInfo = payload._ioInfo;
3709
- null != _ioInfo && (_ioInfo.end = performance.now());
3710
- void 0 === thenable.status && (thenable.status = "fulfilled", thenable.value = moduleObject);
3711
- }
3712
- },
3713
- function(error) {
3714
- if (0 === payload._status || -1 === payload._status) {
3715
- payload._status = 2;
3716
- payload._result = error;
3717
- var _ioInfo2 = payload._ioInfo;
3718
- null != _ioInfo2 && (_ioInfo2.end = performance.now());
3719
- void 0 === thenable.status && (thenable.status = "rejected", thenable.reason = error);
3720
- }
3721
- }
3722
- );
3723
- ioInfo = payload._ioInfo;
3724
- if (null != ioInfo) {
3725
- ioInfo.value = thenable;
3726
- var displayName = thenable.displayName;
3727
- "string" === typeof displayName && (ioInfo.name = displayName);
3728
- }
3729
- -1 === payload._status && (payload._status = 0, payload._result = thenable);
3730
- }
3731
- if (1 === payload._status)
3732
- return ioInfo = payload._result, void 0 === ioInfo && console.error(
3733
- "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",
3734
- ioInfo
3735
- ), "default" in ioInfo || console.error(
3736
- "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",
3737
- ioInfo
3738
- ), ioInfo.default;
3739
- throw payload._result;
3740
- }
3741
- function resolveDispatcher() {
3742
- var dispatcher = ReactSharedInternals.H;
3743
- null === dispatcher && console.error(
3744
- "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
3745
- );
3746
- return dispatcher;
3747
- }
3748
- function releaseAsyncTransition() {
3749
- ReactSharedInternals.asyncTransitions--;
3750
- }
3751
- function enqueueTask(task) {
3752
- if (null === enqueueTaskImpl)
3753
- try {
3754
- var requireString = ("require" + Math.random()).slice(0, 7);
3755
- enqueueTaskImpl = (module && module[requireString]).call(
3756
- module,
3757
- "timers"
3758
- ).setImmediate;
3759
- } catch (_err) {
3760
- enqueueTaskImpl = function(callback) {
3761
- false === didWarnAboutMessageChannel && (didWarnAboutMessageChannel = true, "undefined" === typeof MessageChannel && console.error(
3762
- "This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."
3763
- ));
3764
- var channel = new MessageChannel();
3765
- channel.port1.onmessage = callback;
3766
- channel.port2.postMessage(void 0);
3767
- };
3768
- }
3769
- return enqueueTaskImpl(task);
3770
- }
3771
- function aggregateErrors(errors) {
3772
- return 1 < errors.length && "function" === typeof AggregateError ? new AggregateError(errors) : errors[0];
3773
- }
3774
- function popActScope(prevActQueue, prevActScopeDepth) {
3775
- prevActScopeDepth !== actScopeDepth - 1 && console.error(
3776
- "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
3777
- );
3778
- actScopeDepth = prevActScopeDepth;
3779
- }
3780
- function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
3781
- var queue = ReactSharedInternals.actQueue;
3782
- if (null !== queue)
3783
- if (0 !== queue.length)
3784
- try {
3785
- flushActQueue(queue);
3786
- enqueueTask(function() {
3787
- return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
3788
- });
3789
- return;
3790
- } catch (error) {
3791
- ReactSharedInternals.thrownErrors.push(error);
3792
- }
3793
- else ReactSharedInternals.actQueue = null;
3794
- 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
3795
- }
3796
- function flushActQueue(queue) {
3797
- if (!isFlushing) {
3798
- isFlushing = true;
3799
- var i = 0;
3800
- try {
3801
- for (; i < queue.length; i++) {
3802
- var callback = queue[i];
3803
- do {
3804
- ReactSharedInternals.didUsePromise = false;
3805
- var continuation = callback(false);
3806
- if (null !== continuation) {
3807
- if (ReactSharedInternals.didUsePromise) {
3808
- queue[i] = callback;
3809
- queue.splice(0, i);
3810
- return;
3811
- }
3812
- callback = continuation;
3813
- } else break;
3814
- } while (1);
3815
- }
3816
- queue.length = 0;
3817
- } catch (error) {
3818
- queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
3819
- } finally {
3820
- isFlushing = false;
3821
- }
3822
- }
3823
- }
3824
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
3825
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
3826
- isMounted: function() {
3827
- return false;
3828
- },
3829
- enqueueForceUpdate: function(publicInstance) {
3830
- warnNoop(publicInstance, "forceUpdate");
3831
- },
3832
- enqueueReplaceState: function(publicInstance) {
3833
- warnNoop(publicInstance, "replaceState");
3834
- },
3835
- enqueueSetState: function(publicInstance) {
3836
- warnNoop(publicInstance, "setState");
3837
- }
3838
- }, assign = Object.assign, emptyObject = {};
3839
- Object.freeze(emptyObject);
3840
- Component.prototype.isReactComponent = {};
3841
- Component.prototype.setState = function(partialState, callback) {
3842
- if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
3843
- throw Error(
3844
- "takes an object of state variables to update or a function which returns an object of state variables."
3845
- );
3846
- this.updater.enqueueSetState(this, partialState, callback, "setState");
3847
- };
3848
- Component.prototype.forceUpdate = function(callback) {
3849
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
3850
- };
3851
- var deprecatedAPIs = {
3852
- isMounted: [
3853
- "isMounted",
3854
- "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
3855
- ],
3856
- replaceState: [
3857
- "replaceState",
3858
- "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
3859
- ]
3860
- };
3861
- for (fnName in deprecatedAPIs)
3862
- deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
3863
- ComponentDummy.prototype = Component.prototype;
3864
- deprecatedAPIs = PureComponent.prototype = new ComponentDummy();
3865
- deprecatedAPIs.constructor = PureComponent;
3866
- assign(deprecatedAPIs, Component.prototype);
3867
- deprecatedAPIs.isPureReactComponent = true;
3868
- var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = {
3869
- H: null,
3870
- A: null,
3871
- T: null,
3872
- S: null,
3873
- actQueue: null,
3874
- asyncTransitions: 0,
3875
- isBatchingLegacy: false,
3876
- didScheduleLegacyUpdate: false,
3877
- didUsePromise: false,
3878
- thrownErrors: [],
3879
- getCurrentStack: null,
3880
- recentlyCreatedOwnerStacks: 0
3881
- }, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
3882
- return null;
3883
- };
3884
- deprecatedAPIs = {
3885
- react_stack_bottom_frame: function(callStackForError) {
3886
- return callStackForError();
3887
- }
3888
- };
3889
- var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
3890
- var didWarnAboutElementRef = {};
3891
- var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(
3892
- deprecatedAPIs,
3893
- UnknownOwner
3894
- )();
3895
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
3896
- var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
3897
- if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
3898
- var event = new window.ErrorEvent("error", {
3899
- bubbles: true,
3900
- cancelable: true,
3901
- message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
3902
- error
3903
- });
3904
- if (!window.dispatchEvent(event)) return;
3905
- } else if ("object" === typeof process && "function" === typeof process.emit) {
3906
- process.emit("uncaughtException", error);
3907
- return;
3908
- }
3909
- console.error(error);
3910
- }, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = "function" === typeof queueMicrotask ? function(callback) {
3911
- queueMicrotask(function() {
3912
- return queueMicrotask(callback);
3913
- });
3914
- } : enqueueTask;
3915
- deprecatedAPIs = Object.freeze({
3916
- __proto__: null,
3917
- c: function(size) {
3918
- return resolveDispatcher().useMemoCache(size);
3919
- }
3920
- });
3921
- var fnName = {
3922
- map: mapChildren,
3923
- forEach: function(children, forEachFunc, forEachContext) {
3924
- mapChildren(
3925
- children,
3926
- function() {
3927
- forEachFunc.apply(this, arguments);
3928
- },
3929
- forEachContext
3930
- );
3931
- },
3932
- count: function(children) {
3933
- var n = 0;
3934
- mapChildren(children, function() {
3935
- n++;
3936
- });
3937
- return n;
3938
- },
3939
- toArray: function(children) {
3940
- return mapChildren(children, function(child) {
3941
- return child;
3942
- }) || [];
3943
- },
3944
- only: function(children) {
3945
- if (!isValidElement(children))
3946
- throw Error(
3947
- "React.Children.only expected to receive a single React element child."
3948
- );
3949
- return children;
3950
- }
3951
- };
3952
- exports.Activity = REACT_ACTIVITY_TYPE;
3953
- exports.Children = fnName;
3954
- exports.Component = Component;
3955
- exports.Fragment = REACT_FRAGMENT_TYPE;
3956
- exports.Profiler = REACT_PROFILER_TYPE;
3957
- exports.PureComponent = PureComponent;
3958
- exports.StrictMode = REACT_STRICT_MODE_TYPE;
3959
- exports.Suspense = REACT_SUSPENSE_TYPE;
3960
- exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
3961
- exports.__COMPILER_RUNTIME = deprecatedAPIs;
3962
- exports.act = function(callback) {
3963
- var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
3964
- actScopeDepth++;
3965
- var queue = ReactSharedInternals.actQueue = null !== prevActQueue ? prevActQueue : [], didAwaitActCall = false;
3966
- try {
3967
- var result = callback();
3968
- } catch (error) {
3969
- ReactSharedInternals.thrownErrors.push(error);
3970
- }
3971
- if (0 < ReactSharedInternals.thrownErrors.length)
3972
- throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
3973
- if (null !== result && "object" === typeof result && "function" === typeof result.then) {
3974
- var thenable = result;
3975
- queueSeveralMicrotasks(function() {
3976
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
3977
- "You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"
3978
- ));
3979
- });
3980
- return {
3981
- then: function(resolve, reject) {
3982
- didAwaitActCall = true;
3983
- thenable.then(
3984
- function(returnValue) {
3985
- popActScope(prevActQueue, prevActScopeDepth);
3986
- if (0 === prevActScopeDepth) {
3987
- try {
3988
- flushActQueue(queue), enqueueTask(function() {
3989
- return recursivelyFlushAsyncActWork(
3990
- returnValue,
3991
- resolve,
3992
- reject
3993
- );
3994
- });
3995
- } catch (error$0) {
3996
- ReactSharedInternals.thrownErrors.push(error$0);
3997
- }
3998
- if (0 < ReactSharedInternals.thrownErrors.length) {
3999
- var _thrownError = aggregateErrors(
4000
- ReactSharedInternals.thrownErrors
4001
- );
4002
- ReactSharedInternals.thrownErrors.length = 0;
4003
- reject(_thrownError);
4004
- }
4005
- } else resolve(returnValue);
4006
- },
4007
- function(error) {
4008
- popActScope(prevActQueue, prevActScopeDepth);
4009
- 0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(
4010
- ReactSharedInternals.thrownErrors
4011
- ), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
4012
- }
4013
- );
4014
- }
4015
- };
4016
- }
4017
- var returnValue$jscomp$0 = result;
4018
- popActScope(prevActQueue, prevActScopeDepth);
4019
- 0 === prevActScopeDepth && (flushActQueue(queue), 0 !== queue.length && queueSeveralMicrotasks(function() {
4020
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error(
4021
- "A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"
4022
- ));
4023
- }), ReactSharedInternals.actQueue = null);
4024
- if (0 < ReactSharedInternals.thrownErrors.length)
4025
- throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
4026
- return {
4027
- then: function(resolve, reject) {
4028
- didAwaitActCall = true;
4029
- 0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
4030
- return recursivelyFlushAsyncActWork(
4031
- returnValue$jscomp$0,
4032
- resolve,
4033
- reject
4034
- );
4035
- })) : resolve(returnValue$jscomp$0);
4036
- }
4037
- };
4038
- };
4039
- exports.cache = function(fn) {
4040
- return function() {
4041
- return fn.apply(null, arguments);
4042
- };
4043
- };
4044
- exports.cacheSignal = function() {
4045
- return null;
4046
- };
4047
- exports.captureOwnerStack = function() {
4048
- var getCurrentStack = ReactSharedInternals.getCurrentStack;
4049
- return null === getCurrentStack ? null : getCurrentStack();
4050
- };
4051
- exports.cloneElement = function(element, config, children) {
4052
- if (null === element || void 0 === element)
4053
- throw Error(
4054
- "The argument must be a React element, but you passed " + element + "."
4055
- );
4056
- var props = assign({}, element.props), key = element.key, owner = element._owner;
4057
- if (null != config) {
4058
- var JSCompiler_inline_result;
4059
- a: {
4060
- if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(
4061
- config,
4062
- "ref"
4063
- ).get) && JSCompiler_inline_result.isReactWarning) {
4064
- JSCompiler_inline_result = false;
4065
- break a;
4066
- }
4067
- JSCompiler_inline_result = void 0 !== config.ref;
4068
- }
4069
- JSCompiler_inline_result && (owner = getOwner());
4070
- hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key);
4071
- for (propName in config)
4072
- !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
4073
- }
4074
- var propName = arguments.length - 2;
4075
- if (1 === propName) props.children = children;
4076
- else if (1 < propName) {
4077
- JSCompiler_inline_result = Array(propName);
4078
- for (var i = 0; i < propName; i++)
4079
- JSCompiler_inline_result[i] = arguments[i + 2];
4080
- props.children = JSCompiler_inline_result;
4081
- }
4082
- props = ReactElement(
4083
- element.type,
4084
- key,
4085
- props,
4086
- owner,
4087
- element._debugStack,
4088
- element._debugTask
4089
- );
4090
- for (key = 2; key < arguments.length; key++)
4091
- validateChildKeys(arguments[key]);
4092
- return props;
4093
- };
4094
- exports.createContext = function(defaultValue) {
4095
- defaultValue = {
4096
- $$typeof: REACT_CONTEXT_TYPE,
4097
- _currentValue: defaultValue,
4098
- _currentValue2: defaultValue,
4099
- _threadCount: 0,
4100
- Provider: null,
4101
- Consumer: null
4102
- };
4103
- defaultValue.Provider = defaultValue;
4104
- defaultValue.Consumer = {
4105
- $$typeof: REACT_CONSUMER_TYPE,
4106
- _context: defaultValue
4107
- };
4108
- defaultValue._currentRenderer = null;
4109
- defaultValue._currentRenderer2 = null;
4110
- return defaultValue;
4111
- };
4112
- exports.createElement = function(type, config, children) {
4113
- for (var i = 2; i < arguments.length; i++)
4114
- validateChildKeys(arguments[i]);
4115
- i = {};
4116
- var key = null;
4117
- if (null != config)
4118
- for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn(
4119
- "Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
4120
- )), hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key), config)
4121
- hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (i[propName] = config[propName]);
4122
- var childrenLength = arguments.length - 2;
4123
- if (1 === childrenLength) i.children = children;
4124
- else if (1 < childrenLength) {
4125
- for (var childArray = Array(childrenLength), _i = 0; _i < childrenLength; _i++)
4126
- childArray[_i] = arguments[_i + 2];
4127
- Object.freeze && Object.freeze(childArray);
4128
- i.children = childArray;
4129
- }
4130
- if (type && type.defaultProps)
4131
- for (propName in childrenLength = type.defaultProps, childrenLength)
4132
- void 0 === i[propName] && (i[propName] = childrenLength[propName]);
4133
- key && defineKeyPropWarningGetter(
4134
- i,
4135
- "function" === typeof type ? type.displayName || type.name || "Unknown" : type
4136
- );
4137
- var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
4138
- return ReactElement(
4139
- type,
4140
- key,
4141
- i,
4142
- getOwner(),
4143
- propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
4144
- propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
4145
- );
4146
- };
4147
- exports.createRef = function() {
4148
- var refObject = { current: null };
4149
- Object.seal(refObject);
4150
- return refObject;
4151
- };
4152
- exports.forwardRef = function(render) {
4153
- null != render && render.$$typeof === REACT_MEMO_TYPE ? console.error(
4154
- "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
4155
- ) : "function" !== typeof render ? console.error(
4156
- "forwardRef requires a render function but was given %s.",
4157
- null === render ? "null" : typeof render
4158
- ) : 0 !== render.length && 2 !== render.length && console.error(
4159
- "forwardRef render functions accept exactly two parameters: props and ref. %s",
4160
- 1 === render.length ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."
4161
- );
4162
- null != render && null != render.defaultProps && console.error(
4163
- "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
4164
- );
4165
- var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }, ownName;
4166
- Object.defineProperty(elementType, "displayName", {
4167
- enumerable: false,
4168
- configurable: true,
4169
- get: function() {
4170
- return ownName;
4171
- },
4172
- set: function(name) {
4173
- ownName = name;
4174
- render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
4175
- }
4176
- });
4177
- return elementType;
4178
- };
4179
- exports.isValidElement = isValidElement;
4180
- exports.lazy = function(ctor) {
4181
- ctor = { _status: -1, _result: ctor };
4182
- var lazyType = {
4183
- $$typeof: REACT_LAZY_TYPE,
4184
- _payload: ctor,
4185
- _init: lazyInitializer
4186
- }, ioInfo = {
4187
- name: "lazy",
4188
- start: -1,
4189
- end: -1,
4190
- value: null,
4191
- owner: null,
4192
- debugStack: Error("react-stack-top-frame"),
4193
- debugTask: console.createTask ? console.createTask("lazy()") : null
4194
- };
4195
- ctor._ioInfo = ioInfo;
4196
- lazyType._debugInfo = [{ awaited: ioInfo }];
4197
- return lazyType;
4198
- };
4199
- exports.memo = function(type, compare) {
4200
- null == type && console.error(
4201
- "memo: The first argument must be a component. Instead received: %s",
4202
- null === type ? "null" : typeof type
4203
- );
4204
- compare = {
4205
- $$typeof: REACT_MEMO_TYPE,
4206
- type,
4207
- compare: void 0 === compare ? null : compare
4208
- };
4209
- var ownName;
4210
- Object.defineProperty(compare, "displayName", {
4211
- enumerable: false,
4212
- configurable: true,
4213
- get: function() {
4214
- return ownName;
4215
- },
4216
- set: function(name) {
4217
- ownName = name;
4218
- type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
4219
- }
4220
- });
4221
- return compare;
4222
- };
4223
- exports.startTransition = function(scope) {
4224
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
4225
- currentTransition._updatedFibers = /* @__PURE__ */ new Set();
4226
- ReactSharedInternals.T = currentTransition;
4227
- try {
4228
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
4229
- null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
4230
- "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop, reportGlobalError));
4231
- } catch (error) {
4232
- reportGlobalError(error);
4233
- } finally {
4234
- null === prevTransition && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn(
4235
- "Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."
4236
- )), null !== prevTransition && null !== currentTransition.types && (null !== prevTransition.types && prevTransition.types !== currentTransition.types && console.error(
4237
- "We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."
4238
- ), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
4239
- }
4240
- };
4241
- exports.unstable_useCacheRefresh = function() {
4242
- return resolveDispatcher().useCacheRefresh();
4243
- };
4244
- exports.use = function(usable) {
4245
- return resolveDispatcher().use(usable);
4246
- };
4247
- exports.useActionState = function(action, initialState, permalink) {
4248
- return resolveDispatcher().useActionState(
4249
- action,
4250
- initialState,
4251
- permalink
4252
- );
4253
- };
4254
- exports.useCallback = function(callback, deps) {
4255
- return resolveDispatcher().useCallback(callback, deps);
4256
- };
4257
- exports.useContext = function(Context) {
4258
- var dispatcher = resolveDispatcher();
4259
- Context.$$typeof === REACT_CONSUMER_TYPE && console.error(
4260
- "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
4261
- );
4262
- return dispatcher.useContext(Context);
4263
- };
4264
- exports.useDebugValue = function(value2, formatterFn) {
4265
- return resolveDispatcher().useDebugValue(value2, formatterFn);
4266
- };
4267
- exports.useDeferredValue = function(value2, initialValue) {
4268
- return resolveDispatcher().useDeferredValue(value2, initialValue);
4269
- };
4270
- exports.useEffect = function(create, deps) {
4271
- null == create && console.warn(
4272
- "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
4273
- );
4274
- return resolveDispatcher().useEffect(create, deps);
4275
- };
4276
- exports.useEffectEvent = function(callback) {
4277
- return resolveDispatcher().useEffectEvent(callback);
4278
- };
4279
- exports.useId = function() {
4280
- return resolveDispatcher().useId();
4281
- };
4282
- exports.useImperativeHandle = function(ref, create, deps) {
4283
- return resolveDispatcher().useImperativeHandle(ref, create, deps);
4284
- };
4285
- exports.useInsertionEffect = function(create, deps) {
4286
- null == create && console.warn(
4287
- "React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
4288
- );
4289
- return resolveDispatcher().useInsertionEffect(create, deps);
4290
- };
4291
- exports.useLayoutEffect = function(create, deps) {
4292
- null == create && console.warn(
4293
- "React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
4294
- );
4295
- return resolveDispatcher().useLayoutEffect(create, deps);
4296
- };
4297
- exports.useMemo = function(create, deps) {
4298
- return resolveDispatcher().useMemo(create, deps);
4299
- };
4300
- exports.useOptimistic = function(passthrough, reducer) {
4301
- return resolveDispatcher().useOptimistic(passthrough, reducer);
4302
- };
4303
- exports.useReducer = function(reducer, initialArg, init) {
4304
- return resolveDispatcher().useReducer(reducer, initialArg, init);
4305
- };
4306
- exports.useRef = function(initialValue) {
4307
- return resolveDispatcher().useRef(initialValue);
4308
- };
4309
- exports.useState = function(initialState) {
4310
- return resolveDispatcher().useState(initialState);
4311
- };
4312
- exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
4313
- return resolveDispatcher().useSyncExternalStore(
4314
- subscribe,
4315
- getSnapshot,
4316
- getServerSnapshot
4317
- );
4318
- };
4319
- exports.useTransition = function() {
4320
- return resolveDispatcher().useTransition();
4321
- };
4322
- exports.version = "19.2.7";
4323
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
4324
- })();
4325
- })(react_development, react_development.exports);
4326
- return react_development.exports;
4327
- }
4328
- var hasRequiredReact;
4329
- function requireReact() {
4330
- if (hasRequiredReact) return react.exports;
4331
- hasRequiredReact = 1;
4332
- if (process.env.NODE_ENV === "production") {
4333
- react.exports = requireReact_production();
4334
- } else {
4335
- react.exports = requireReact_development();
4336
- }
4337
- return react.exports;
4338
- }
4339
- /**
4340
- * @license React
4341
- * react-jsx-runtime.development.js
4342
- *
4343
- * Copyright (c) Meta Platforms, Inc. and affiliates.
4344
- *
4345
- * This source code is licensed under the MIT license found in the
4346
- * LICENSE file in the root directory of this source tree.
4347
- */
4348
- var hasRequiredReactJsxRuntime_development;
4349
- function requireReactJsxRuntime_development() {
4350
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
4351
- hasRequiredReactJsxRuntime_development = 1;
4352
- "production" !== process.env.NODE_ENV && (function() {
4353
- function getComponentNameFromType(type) {
4354
- if (null == type) return null;
4355
- if ("function" === typeof type)
4356
- return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
4357
- if ("string" === typeof type) return type;
4358
- switch (type) {
4359
- case REACT_FRAGMENT_TYPE:
4360
- return "Fragment";
4361
- case REACT_PROFILER_TYPE:
4362
- return "Profiler";
4363
- case REACT_STRICT_MODE_TYPE:
4364
- return "StrictMode";
4365
- case REACT_SUSPENSE_TYPE:
4366
- return "Suspense";
4367
- case REACT_SUSPENSE_LIST_TYPE:
4368
- return "SuspenseList";
4369
- case REACT_ACTIVITY_TYPE:
4370
- return "Activity";
4371
- }
4372
- if ("object" === typeof type)
4373
- switch ("number" === typeof type.tag && console.error(
4374
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
4375
- ), type.$$typeof) {
4376
- case REACT_PORTAL_TYPE:
4377
- return "Portal";
4378
- case REACT_CONTEXT_TYPE:
4379
- return type.displayName || "Context";
4380
- case REACT_CONSUMER_TYPE:
4381
- return (type._context.displayName || "Context") + ".Consumer";
4382
- case REACT_FORWARD_REF_TYPE:
4383
- var innerType = type.render;
4384
- type = type.displayName;
4385
- type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
4386
- return type;
4387
- case REACT_MEMO_TYPE:
4388
- return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
4389
- case REACT_LAZY_TYPE:
4390
- innerType = type._payload;
4391
- type = type._init;
4392
- try {
4393
- return getComponentNameFromType(type(innerType));
4394
- } catch (x) {
4395
- }
4396
- }
4397
- return null;
4398
- }
4399
- function testStringCoercion(value2) {
4400
- return "" + value2;
4401
- }
4402
- function checkKeyStringCoercion(value2) {
4403
- try {
4404
- testStringCoercion(value2);
4405
- var JSCompiler_inline_result = false;
4406
- } catch (e) {
4407
- JSCompiler_inline_result = true;
4408
- }
4409
- if (JSCompiler_inline_result) {
4410
- JSCompiler_inline_result = console;
4411
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
4412
- var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value2[Symbol.toStringTag] || value2.constructor.name || "Object";
4413
- JSCompiler_temp_const.call(
4414
- JSCompiler_inline_result,
4415
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
4416
- JSCompiler_inline_result$jscomp$0
4417
- );
4418
- return testStringCoercion(value2);
4419
- }
4420
- }
4421
- function getTaskName(type) {
4422
- if (type === REACT_FRAGMENT_TYPE) return "<>";
4423
- if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
4424
- return "<...>";
4425
- try {
4426
- var name = getComponentNameFromType(type);
4427
- return name ? "<" + name + ">" : "<...>";
4428
- } catch (x) {
4429
- return "<...>";
4430
- }
4431
- }
4432
- function getOwner() {
4433
- var dispatcher = ReactSharedInternals.A;
4434
- return null === dispatcher ? null : dispatcher.getOwner();
4435
- }
4436
- function UnknownOwner() {
4437
- return Error("react-stack-top-frame");
4438
- }
4439
- function hasValidKey(config) {
4440
- if (hasOwnProperty.call(config, "key")) {
4441
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
4442
- if (getter && getter.isReactWarning) return false;
4443
- }
4444
- return void 0 !== config.key;
4445
- }
4446
- function defineKeyPropWarningGetter(props, displayName) {
4447
- function warnAboutAccessingKey() {
4448
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
4449
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
4450
- displayName
4451
- ));
4452
- }
4453
- warnAboutAccessingKey.isReactWarning = true;
4454
- Object.defineProperty(props, "key", {
4455
- get: warnAboutAccessingKey,
4456
- configurable: true
4457
- });
4458
- }
4459
- function elementRefGetterWithDeprecationWarning() {
4460
- var componentName = getComponentNameFromType(this.type);
4461
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
4462
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
4463
- ));
4464
- componentName = this.props.ref;
4465
- return void 0 !== componentName ? componentName : null;
4466
- }
4467
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
4468
- var refProp = props.ref;
4469
- type = {
4470
- $$typeof: REACT_ELEMENT_TYPE,
4471
- type,
4472
- key,
4473
- props,
4474
- _owner: owner
4475
- };
4476
- null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
4477
- enumerable: false,
4478
- get: elementRefGetterWithDeprecationWarning
4479
- }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
4480
- type._store = {};
4481
- Object.defineProperty(type._store, "validated", {
4482
- configurable: false,
4483
- enumerable: false,
4484
- writable: true,
4485
- value: 0
4486
- });
4487
- Object.defineProperty(type, "_debugInfo", {
4488
- configurable: false,
4489
- enumerable: false,
4490
- writable: true,
4491
- value: null
4492
- });
4493
- Object.defineProperty(type, "_debugStack", {
4494
- configurable: false,
4495
- enumerable: false,
4496
- writable: true,
4497
- value: debugStack
4498
- });
4499
- Object.defineProperty(type, "_debugTask", {
4500
- configurable: false,
4501
- enumerable: false,
4502
- writable: true,
4503
- value: debugTask
4504
- });
4505
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
4506
- return type;
4507
- }
4508
- function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
4509
- var children = config.children;
4510
- if (void 0 !== children)
4511
- if (isStaticChildren)
4512
- if (isArrayImpl(children)) {
4513
- for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++)
4514
- validateChildKeys(children[isStaticChildren]);
4515
- Object.freeze && Object.freeze(children);
4516
- } else
4517
- console.error(
4518
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
4519
- );
4520
- else validateChildKeys(children);
4521
- if (hasOwnProperty.call(config, "key")) {
4522
- children = getComponentNameFromType(type);
4523
- var keys = Object.keys(config).filter(function(k) {
4524
- return "key" !== k;
4525
- });
4526
- isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
4527
- didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(
4528
- 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
4529
- isStaticChildren,
4530
- children,
4531
- keys,
4532
- children
4533
- ), didWarnAboutKeySpread[children + isStaticChildren] = true);
4534
- }
4535
- children = null;
4536
- void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
4537
- hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
4538
- if ("key" in config) {
4539
- maybeKey = {};
4540
- for (var propName in config)
4541
- "key" !== propName && (maybeKey[propName] = config[propName]);
4542
- } else maybeKey = config;
4543
- children && defineKeyPropWarningGetter(
4544
- maybeKey,
4545
- "function" === typeof type ? type.displayName || type.name || "Unknown" : type
4546
- );
4547
- return ReactElement(
4548
- type,
4549
- children,
4550
- maybeKey,
4551
- getOwner(),
4552
- debugStack,
4553
- debugTask
4554
- );
4555
- }
4556
- function validateChildKeys(node2) {
4557
- isValidElement(node2) ? node2._store && (node2._store.validated = 1) : "object" === typeof node2 && null !== node2 && node2.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node2._payload.status ? isValidElement(node2._payload.value) && node2._payload.value._store && (node2._payload.value._store.validated = 1) : node2._store && (node2._store.validated = 1));
4558
- }
4559
- function isValidElement(object) {
4560
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
4561
- }
4562
- var React = requireReact(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
4563
- return null;
4564
- };
4565
- React = {
4566
- react_stack_bottom_frame: function(callStackForError) {
4567
- return callStackForError();
4568
- }
4569
- };
4570
- var specialPropKeyWarningShown;
4571
- var didWarnAboutElementRef = {};
4572
- var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
4573
- React,
4574
- UnknownOwner
4575
- )();
4576
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
4577
- var didWarnAboutKeySpread = {};
4578
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
4579
- reactJsxRuntime_development.jsx = function(type, config, maybeKey) {
4580
- var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
4581
- return jsxDEVImpl(
4582
- type,
4583
- config,
4584
- maybeKey,
4585
- false,
4586
- trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
4587
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
4588
- );
4589
- };
4590
- reactJsxRuntime_development.jsxs = function(type, config, maybeKey) {
4591
- var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
4592
- return jsxDEVImpl(
4593
- type,
4594
- config,
4595
- maybeKey,
4596
- true,
4597
- trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
4598
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
4599
- );
4600
- };
4601
- })();
4602
- return reactJsxRuntime_development;
4603
- }
4604
- var hasRequiredJsxRuntime;
4605
- function requireJsxRuntime() {
4606
- if (hasRequiredJsxRuntime) return jsxRuntime.exports;
4607
- hasRequiredJsxRuntime = 1;
4608
- if (process.env.NODE_ENV === "production") {
4609
- jsxRuntime.exports = requireReactJsxRuntime_production();
4610
- } else {
4611
- jsxRuntime.exports = requireReactJsxRuntime_development();
2808
+ const scopes = /* @__PURE__ */ new Set(["owned", "collaborating", "shared"]);
2809
+ const sorts = /* @__PURE__ */ new Set(["activity", "updated", "created", "name"]);
2810
+ function buildProjectListV2Path(input) {
2811
+ if (input.context !== "personal" && (!input.context.startsWith("company:") || input.context.length === "company:".length) || !scopes.has(input.scope) || !Number.isInteger(input.limit) || input.limit < 1 || input.limit > 100) {
2812
+ throw new Error("Invalid project list v2 query");
2813
+ }
2814
+ const sort = input.sort ?? "activity";
2815
+ if (!sorts.has(sort)) throw new Error("Invalid project list v2 query");
2816
+ const params = new URLSearchParams();
2817
+ params.set("context", input.context);
2818
+ params.set("scope", input.scope);
2819
+ params.set("limit", String(input.limit));
2820
+ params.set("sort", sort);
2821
+ const query = input.query?.trim();
2822
+ if (query) params.set("q", query);
2823
+ if (input.cursor) params.set("cursor", input.cursor);
2824
+ return `/api/v2/projects?${params.toString()}`;
2825
+ }
2826
+ function isProjectListV2Item(value2) {
2827
+ if (!value2 || typeof value2 !== "object") return false;
2828
+ const item = value2;
2829
+ return typeof item.id === "string" && typeof item.name === "string" && typeof item.userId === "string" && typeof item.createdAt === "number" && typeof item.updatedAt === "number" && scopes.has(item.access) && typeof item.lastActivityAt === "number" && Number.isFinite(item.lastActivityAt);
2830
+ }
2831
+ function parseProjectListV2Page(body) {
2832
+ if (!body || typeof body !== "object" || Array.isArray(body)) {
2833
+ throw new Error("Invalid project list v2 response");
2834
+ }
2835
+ const page = body;
2836
+ if (!Array.isArray(page.items) || !page.items.every(isProjectListV2Item) || page.nextCursor !== null && typeof page.nextCursor !== "string" || !Number.isInteger(page.total) || page.total < 0) {
2837
+ throw new Error("Invalid project list v2 response");
4612
2838
  }
4613
- return jsxRuntime.exports;
2839
+ return {
2840
+ items: page.items,
2841
+ nextCursor: page.nextCursor,
2842
+ total: page.total
2843
+ };
4614
2844
  }
4615
- requireJsxRuntime();
4616
- var reactExports = requireReact();
4617
2845
  const DEFAULT_LANGUAGE = "ko";
4618
2846
  function isLanguage(value2) {
4619
2847
  return value2 === "ko" || value2 === "en" || value2 === "zh" || value2 === "ja";
@@ -6257,7 +4485,7 @@ const githubTriggersJa = {
6257
4485
  "githubTriggers.templateLabel": "プロンプトテンプレート",
6258
4486
  "githubTriggers.templateHint": "使用可能な変数: {pr.number} {pr.title} {pr.author} {pr.url} {pr.baseBranch} {pr.headBranch} {pr.labels} {event}",
6259
4487
  "githubTriggers.presetReview": "「PR 自動レビュー」プリセットを挿入",
6260
- "githubTriggers.presetReviewFix": "「PR レビュー + 後続修正」プリセットを挿入",
4488
+ "githubTriggers.presetReviewFix": "「PR レビュー + フォローアップ修正」プリセットを挿入",
6261
4489
  "githubTriggers.filterBaseBranch": "base ブランチ(完全一致、空欄で全て)",
6262
4490
  "githubTriggers.filterLabel": "ラベル含む(空欄で全て)",
6263
4491
  "githubTriggers.filterExcludeDrafts": "ドラフト PR を除外",
@@ -14580,14 +12808,6 @@ function translate(language, key, params) {
14580
12808
  function translateCurrent(key, params) {
14581
12809
  return translate(getCurrentLanguage(), key, params);
14582
12810
  }
14583
- const DEFAULT_CONTEXT = {
14584
- language: DEFAULT_LANGUAGE,
14585
- status: "ready",
14586
- setLanguage: () => {
14587
- },
14588
- t: (key, params) => translate(DEFAULT_LANGUAGE, key, params)
14589
- };
14590
- reactExports.createContext(DEFAULT_CONTEXT);
14591
12811
  function isAskUserQuestionToolName(value2) {
14592
12812
  if (!value2) return false;
14593
12813
  const normalized = value2.replace(/^functions\./i, "").replace(/^mcp__.+?__/i, "").replace(/\s+call$/i, "").replace(/[._\-\s]+/g, "").trim().toLowerCase();
@@ -16658,6 +14878,16 @@ class ApiClient {
16658
14878
  );
16659
14879
  }
16660
14880
  }
14881
+ function consumeHiddenInput(current, chunk) {
14882
+ let value2 = current;
14883
+ for (const char of chunk) {
14884
+ if (char === "\n" || char === "\r" || char === "") return { type: "submit", value: value2 };
14885
+ if (char === "") return { type: "interrupt" };
14886
+ if (char === "") value2 = value2.slice(0, -1);
14887
+ else value2 += char;
14888
+ }
14889
+ return { type: "continue", value: value2 };
14890
+ }
16661
14891
  const SECRETBOX_KEY_BYTES = 32;
16662
14892
  function isNonEmptyString(value2) {
16663
14893
  return typeof value2 === "string" && value2.length > 0;
@@ -16824,8 +15054,8 @@ function requireXMLHttpRequest() {
16824
15054
  if (hasRequiredXMLHttpRequest) return XMLHttpRequest_1;
16825
15055
  hasRequiredXMLHttpRequest = 1;
16826
15056
  var fs = require$$0$1;
16827
- var Url = require$$1$1;
16828
- var spawn = require$$2$1.spawn;
15057
+ var Url = require$$1;
15058
+ var spawn = require$$2.spawn;
16829
15059
  XMLHttpRequest_1 = XMLHttpRequest2;
16830
15060
  XMLHttpRequest2.XMLHttpRequest = XMLHttpRequest2;
16831
15061
  function XMLHttpRequest2(opts) {
@@ -18160,7 +16390,7 @@ function requireSupportsColor() {
18160
16390
  if (hasRequiredSupportsColor) return supportsColor_1;
18161
16391
  hasRequiredSupportsColor = 1;
18162
16392
  const os = require$$0$2;
18163
- const tty = require$$1$2;
16393
+ const tty = require$$1$1;
18164
16394
  const hasFlag2 = requireHasFlag();
18165
16395
  const { env } = process;
18166
16396
  let forceColor;
@@ -18261,8 +16491,8 @@ function requireNode() {
18261
16491
  if (hasRequiredNode) return node.exports;
18262
16492
  hasRequiredNode = 1;
18263
16493
  (function(module, exports) {
18264
- const tty = require$$1$2;
18265
- const util = require$$1$3;
16494
+ const tty = require$$1$1;
16495
+ const util = require$$1$2;
18266
16496
  exports.init = init;
18267
16497
  exports.log = log;
18268
16498
  exports.formatArgs = formatArgs;
@@ -18964,7 +17194,6 @@ class XHR extends BaseXHR {
18964
17194
  return new Request((opts2) => new XMLHttpRequest$1(opts2), this.uri(), opts);
18965
17195
  }
18966
17196
  }
18967
- var bufferUtil = { exports: {} };
18968
17197
  var constants;
18969
17198
  var hasRequiredConstants;
18970
17199
  function requireConstants() {
@@ -18988,15 +17217,10 @@ function requireConstants() {
18988
17217
  };
18989
17218
  return constants;
18990
17219
  }
18991
- const __viteOptionalPeerDep_bufferutil_ws = {};
18992
- const __viteOptionalPeerDep_bufferutil_ws$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18993
- __proto__: null,
18994
- default: __viteOptionalPeerDep_bufferutil_ws
18995
- }, Symbol.toStringTag, { value: "Module" }));
18996
- const require$$1 = /* @__PURE__ */ getAugmentedNamespace(__viteOptionalPeerDep_bufferutil_ws$1);
17220
+ var bufferUtil;
18997
17221
  var hasRequiredBufferUtil;
18998
17222
  function requireBufferUtil() {
18999
- if (hasRequiredBufferUtil) return bufferUtil.exports;
17223
+ if (hasRequiredBufferUtil) return bufferUtil;
19000
17224
  hasRequiredBufferUtil = 1;
19001
17225
  const { EMPTY_BUFFER } = requireConstants();
19002
17226
  const FastBuffer = Buffer[Symbol.species];
@@ -19045,28 +17269,14 @@ function requireBufferUtil() {
19045
17269
  }
19046
17270
  return buf;
19047
17271
  }
19048
- bufferUtil.exports = {
17272
+ bufferUtil = {
19049
17273
  concat,
19050
17274
  mask: _mask,
19051
17275
  toArrayBuffer,
19052
17276
  toBuffer: toBuffer2,
19053
17277
  unmask: _unmask
19054
17278
  };
19055
- if (!process.env.WS_NO_BUFFER_UTIL) {
19056
- try {
19057
- const bufferUtil$1 = require$$1;
19058
- bufferUtil.exports.mask = function(source, mask, output, offset, length) {
19059
- if (length < 48) _mask(source, mask, output, offset, length);
19060
- else bufferUtil$1.mask(source, mask, output, offset, length);
19061
- };
19062
- bufferUtil.exports.unmask = function(buffer, mask) {
19063
- if (buffer.length < 32) _unmask(buffer, mask);
19064
- else bufferUtil$1.unmask(buffer, mask);
19065
- };
19066
- } catch (e) {
19067
- }
19068
- }
19069
- return bufferUtil.exports;
17279
+ return bufferUtil;
19070
17280
  }
19071
17281
  var limiter;
19072
17282
  var hasRequiredLimiter;
@@ -19502,12 +17712,6 @@ function requirePermessageDeflate() {
19502
17712
  return permessageDeflate;
19503
17713
  }
19504
17714
  var validation = { exports: {} };
19505
- const __viteOptionalPeerDep_utf8Validate_ws = {};
19506
- const __viteOptionalPeerDep_utf8Validate_ws$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
19507
- __proto__: null,
19508
- default: __viteOptionalPeerDep_utf8Validate_ws
19509
- }, Symbol.toStringTag, { value: "Module" }));
19510
- const require$$2 = /* @__PURE__ */ getAugmentedNamespace(__viteOptionalPeerDep_utf8Validate_ws$1);
19511
17715
  var hasRequiredValidation;
19512
17716
  function requireValidation() {
19513
17717
  if (hasRequiredValidation) return validation.exports;
@@ -19697,14 +17901,6 @@ function requireValidation() {
19697
17901
  validation.exports.isValidUTF8 = function(buf) {
19698
17902
  return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
19699
17903
  };
19700
- } else if (!process.env.WS_NO_UTF_8_VALIDATE) {
19701
- try {
19702
- const isValidUTF8 = require$$2;
19703
- validation.exports.isValidUTF8 = function(buf) {
19704
- return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
19705
- };
19706
- } catch (e) {
19707
- }
19708
17904
  }
19709
17905
  return validation.exports;
19710
17906
  }
@@ -20349,7 +18545,7 @@ function requireSender() {
20349
18545
  const { randomFillSync } = require$$0;
20350
18546
  const {
20351
18547
  types: { isUint8Array }
20352
- } = require$$1$3;
18548
+ } = require$$1$2;
20353
18549
  const PerMessageDeflate = requirePermessageDeflate();
20354
18550
  const { EMPTY_BUFFER, kWebSocket, NOOP } = requireConstants();
20355
18551
  const { isBlob, isValidStatusCode } = requireValidation();
@@ -21227,7 +19423,7 @@ function requireWebsocket() {
21227
19423
  const tls = require$$4$1;
21228
19424
  const { randomBytes, createHash } = require$$0;
21229
19425
  const { Duplex, Readable } = require$$0$5;
21230
- const { URL: URL2 } = require$$1$1;
19426
+ const { URL: URL2 } = require$$1;
21231
19427
  const PerMessageDeflate = requirePermessageDeflate();
21232
19428
  const Receiver = requireReceiver();
21233
19429
  const Sender = requireSender();
@@ -25145,43 +23341,164 @@ Object.assign(lookup, {
25145
23341
  io: lookup,
25146
23342
  connect: lookup
25147
23343
  });
25148
- const DEFAULT_SERVER_URL = "https://saycode.ai";
25149
- const DEFAULT_ACK_TIMEOUT_MS = 15e3;
25150
- class CliTransport {
25151
- constructor(credential, serverUrl = DEFAULT_SERVER_URL) {
23344
+ const CONNECT_ATTEMPTS = 3;
23345
+ const MAX_RETRY_DELAY_BUDGET_MS = 1e3;
23346
+ function connectSchedule(totalTimeoutMs) {
23347
+ const retryBudget = Math.min(MAX_RETRY_DELAY_BUDGET_MS, Math.max(0, Math.floor(totalTimeoutMs / 5)));
23348
+ const firstDelay = Math.floor(retryBudget / 4);
23349
+ return {
23350
+ attemptTimeoutMs: Math.max(1, Math.floor((totalTimeoutMs - retryBudget) / CONNECT_ATTEMPTS)),
23351
+ retryDelaysMs: [firstDelay, retryBudget - firstDelay]
23352
+ };
23353
+ }
23354
+ class RealtimeSocket {
23355
+ constructor(credential, serverUrl) {
25152
23356
  this.credential = credential;
25153
23357
  this.serverUrl = serverUrl;
25154
- this.secretKey = decodeBase64(credential.secret);
25155
23358
  this.socket = lookup(serverUrl, {
25156
23359
  path: "/v1/updates",
25157
23360
  auth: { token: credential.token, clientType: "user-scoped" },
25158
- transports: ["websocket"]
23361
+ transports: ["websocket"],
23362
+ autoConnect: false,
23363
+ // Bound the initial handshake ourselves, then restore live reconnection.
23364
+ reconnection: false
25159
23365
  });
25160
23366
  }
25161
23367
  socket;
25162
- secretKey;
25163
- get key() {
25164
- return this.secretKey;
25165
- }
25166
- connect(timeoutMs = 15e3) {
23368
+ connecting = null;
23369
+ cancelPendingConnect = null;
23370
+ connectedOnce = false;
23371
+ disposed = false;
23372
+ connect(totalTimeoutMs) {
25167
23373
  if (this.socket.connected) return Promise.resolve();
25168
- return new Promise((resolve, reject) => {
25169
- const timer = setTimeout(() => reject(new Error(`Could not reach ${this.serverUrl} within ${timeoutMs}ms`)), timeoutMs);
25170
- this.socket.once("connect", () => {
23374
+ if (this.disposed) return Promise.reject(new Error("Realtime WebSocket transport was disposed."));
23375
+ if (this.connecting) return this.connecting;
23376
+ this.connecting = this.connectWithRetry(Math.max(1, totalTimeoutMs)).finally(() => {
23377
+ this.connecting = null;
23378
+ });
23379
+ return this.connecting;
23380
+ }
23381
+ async connectWithRetry(totalTimeoutMs) {
23382
+ if (this.connectedOnce) {
23383
+ this.socket.io.reconnection(false);
23384
+ this.socket.disconnect();
23385
+ }
23386
+ const schedule = connectSchedule(totalTimeoutMs);
23387
+ let lastError = null;
23388
+ for (let attempt = 0; attempt < CONNECT_ATTEMPTS; attempt += 1) {
23389
+ const result = await this.connectOnce(schedule.attemptTimeoutMs);
23390
+ if (result.type === "cancelled") throw this.cancelledError();
23391
+ if (result.type === "connected") {
23392
+ this.connectedOnce = true;
23393
+ this.socket.io.reconnection(true);
23394
+ return;
23395
+ }
23396
+ if (result.type === "error") lastError = result.error;
23397
+ this.socket.disconnect();
23398
+ const retryDelay = schedule.retryDelaysMs[attempt];
23399
+ if (retryDelay !== void 0 && retryDelay > 0 && !await this.waitForRetry(retryDelay)) {
23400
+ throw this.cancelledError();
23401
+ }
23402
+ }
23403
+ const cause = lastError ? ` Last error: ${this.safeErrorMessage(lastError)}` : "";
23404
+ throw new Error([
23405
+ `Realtime WebSocket /v1/updates at ${this.serverUrl} did not connect after ${CONNECT_ATTEMPTS} attempts within ${totalTimeoutMs}ms.`,
23406
+ `${cause} Retry the chat. If it keeps failing, check whether a VPN or proxy blocks WebSocket connections.`
23407
+ ].join(""));
23408
+ }
23409
+ connectOnce(timeoutMs) {
23410
+ if (this.disposed) return Promise.resolve({ type: "cancelled" });
23411
+ return new Promise((resolve) => {
23412
+ let settled = false;
23413
+ let timer;
23414
+ const finish = (result) => {
23415
+ if (settled) return;
23416
+ settled = true;
25171
23417
  clearTimeout(timer);
25172
- resolve();
25173
- });
25174
- this.socket.once("connect_error", (error) => {
23418
+ this.socket.off("connect", onConnect);
23419
+ this.socket.off("connect_error", onError);
23420
+ this.cancelPendingConnect = null;
23421
+ resolve(result);
23422
+ };
23423
+ const onConnect = () => finish({ type: "connected" });
23424
+ const onError = (error) => finish({ type: "error", error });
23425
+ timer = setTimeout(() => finish({ type: "timeout" }), timeoutMs);
23426
+ this.cancelPendingConnect = () => finish({ type: "cancelled" });
23427
+ this.socket.once("connect", onConnect);
23428
+ this.socket.once("connect_error", onError);
23429
+ this.socket.connect();
23430
+ });
23431
+ }
23432
+ waitForRetry(timeoutMs) {
23433
+ if (this.disposed) return Promise.resolve(false);
23434
+ return new Promise((resolve) => {
23435
+ let settled = false;
23436
+ const finish = (shouldContinue) => {
23437
+ if (settled) return;
23438
+ settled = true;
23439
+ clearTimeout(timer);
23440
+ this.cancelPendingConnect = null;
23441
+ resolve(shouldContinue);
23442
+ };
23443
+ const timer = setTimeout(() => finish(true), timeoutMs);
23444
+ this.cancelPendingConnect = () => finish(false);
23445
+ });
23446
+ }
23447
+ cancelledError() {
23448
+ return new Error("Realtime WebSocket connection was cancelled because the transport was disposed.");
23449
+ }
23450
+ safeErrorMessage(error) {
23451
+ return error.message.replaceAll(this.credential.token, "[redacted]").replaceAll(this.credential.secret, "[redacted]");
23452
+ }
23453
+ on(event, listener) {
23454
+ this.socket.on(event, listener);
23455
+ let active = true;
23456
+ return () => {
23457
+ if (!active) return;
23458
+ active = false;
23459
+ this.socket.off(event, listener);
23460
+ };
23461
+ }
23462
+ emitWithAck(event, payload, timeoutMs) {
23463
+ return new Promise((resolve, reject) => {
23464
+ const timer = setTimeout(() => reject(new Error(`Timed out waiting for ${event} acknowledgement`)), timeoutMs);
23465
+ this.socket.emit(event, payload, (response) => {
25175
23466
  clearTimeout(timer);
25176
- reject(new Error(`Connection refused by ${this.serverUrl}: ${error.message}`));
23467
+ resolve(response);
25177
23468
  });
25178
23469
  });
25179
23470
  }
23471
+ dispose() {
23472
+ if (this.disposed) return;
23473
+ this.disposed = true;
23474
+ this.cancelPendingConnect?.();
23475
+ this.socket.removeAllListeners();
23476
+ this.socket.disconnect();
23477
+ }
23478
+ }
23479
+ const DEFAULT_SERVER_URL = "https://saycode.ai";
23480
+ const DEFAULT_ACK_TIMEOUT_MS = 15e3;
23481
+ const DEFAULT_CONNECT_TIMEOUT_MS = 15e3;
23482
+ class CliTransport {
23483
+ constructor(credential, serverUrl = DEFAULT_SERVER_URL) {
23484
+ this.credential = credential;
23485
+ this.serverUrl = serverUrl;
23486
+ this.secretKey = decodeBase64(credential.secret);
23487
+ this.realtime = new RealtimeSocket(credential, serverUrl);
23488
+ }
23489
+ realtime;
23490
+ secretKey;
23491
+ get key() {
23492
+ return this.secretKey;
23493
+ }
23494
+ connect(timeoutMs = DEFAULT_CONNECT_TIMEOUT_MS) {
23495
+ return this.realtime.connect(timeoutMs);
23496
+ }
25180
23497
  onUpdate(listener) {
25181
- this.socket.on("update", listener);
23498
+ return this.realtime.on("update", listener);
25182
23499
  }
25183
23500
  onEphemeral(listener) {
25184
- this.socket.on("ephemeral", listener);
23501
+ return this.realtime.on("ephemeral", listener);
25185
23502
  }
25186
23503
  /**
25187
23504
  * Encrypted RPC to a machine daemon or a live session, mirroring
@@ -25190,7 +23507,7 @@ class CliTransport {
25190
23507
  */
25191
23508
  async rpc(target, method, params, ackTimeoutMs = DEFAULT_ACK_TIMEOUT_MS) {
25192
23509
  const encrypted = this.secretKey ? encryptSecretBox(JSON.stringify(params), this.secretKey) : plainJsonToBase64(params);
25193
- const response = await this.emitWithAck("rpc-call", {
23510
+ const response = await this.realtime.emitWithAck("rpc-call", {
25194
23511
  method: `${target}:${method}`,
25195
23512
  params: encrypted
25196
23513
  }, ackTimeoutMs);
@@ -25204,18 +23521,8 @@ class CliTransport {
25204
23521
  if (this.secretKey) return JSON.parse(decryptSecretBox(raw, this.secretKey));
25205
23522
  return JSON.parse(Buffer.from(raw, "base64").toString("utf8"));
25206
23523
  }
25207
- emitWithAck(event, payload, timeoutMs) {
25208
- return new Promise((resolve, reject) => {
25209
- const timer = setTimeout(() => reject(new Error(`Timed out waiting for ${event} acknowledgement`)), timeoutMs);
25210
- this.socket.emit(event, payload, (response) => {
25211
- clearTimeout(timer);
25212
- resolve(response);
25213
- });
25214
- });
25215
- }
25216
23524
  dispose() {
25217
- this.socket.removeAllListeners();
25218
- this.socket.disconnect();
23525
+ this.realtime.dispose();
25219
23526
  }
25220
23527
  }
25221
23528
  const REQUEST_TIMEOUT_MS = 2e4;
@@ -25258,7 +23565,7 @@ class CliRest {
25258
23565
  /** Newest-last page of a session transcript, used for `attach --since`. */
25259
23566
  async recentMessages(sessionId, limit) {
25260
23567
  const data = await this.get(
25261
- `/v3/sessions/${encodeURIComponent(sessionId)}/messages?limit=${encodeURIComponent(String(limit))}`
23568
+ `/v3/sessions/${encodeURIComponent(sessionId)}/messages?${new URLSearchParams({ limit: String(limit), before_seq: "2147483647" })}`
25262
23569
  );
25263
23570
  return data.messages ?? [];
25264
23571
  }
@@ -25318,17 +23625,34 @@ const RESET = "\x1B[0m";
25318
23625
  const STYLE_CODES = {
25319
23626
  user: "\x1B[1;36m",
25320
23627
  thinking: "\x1B[2;37m",
25321
- tool: "\x1B[33m",
23628
+ tool: "\x1B[2;33m",
25322
23629
  progress: "\x1B[2;37m",
25323
23630
  status: "\x1B[32m",
25324
- error: "\x1B[31m"
23631
+ error: "\x1B[31m",
23632
+ heading: "\x1B[1;36m",
23633
+ quote: "\x1B[2;37m",
23634
+ code: "\x1B[36m"
25325
23635
  // `text` is intentionally absent: agent prose is the main content and reads
25326
23636
  // best in the terminal's own foreground colour.
25327
23637
  };
23638
+ const INLINE_STYLE_CODES = {
23639
+ strong: "\x1B[1m",
23640
+ emphasis: "\x1B[3m",
23641
+ inlineCode: "\x1B[36m",
23642
+ strike: "\x1B[9m",
23643
+ link: "\x1B[4;36m"
23644
+ };
23645
+ function formatSpans(spans, baseCode) {
23646
+ return spans.map((span) => {
23647
+ if (!span.style) return span.text;
23648
+ return `${INLINE_STYLE_CODES[span.style]}${span.text}${baseCode ?? RESET}`;
23649
+ }).join("");
23650
+ }
25328
23651
  function formatLine(line, colour) {
25329
23652
  if (line.style === "divider") return "";
25330
23653
  const code = colour ? STYLE_CODES[line.style] : void 0;
25331
- return code ? `${code}${line.text}${RESET}` : line.text;
23654
+ const text2 = colour && line.spans ? formatSpans(line.spans, code) : line.text;
23655
+ return code ? `${code}${text2}${RESET}` : text2;
25332
23656
  }
25333
23657
  function colourEnabled(env, isTty) {
25334
23658
  if (env.NO_COLOR !== void 0) return false;
@@ -25456,8 +23780,8 @@ ${names}`);
25456
23780
  }
25457
23781
  this.activeSync = await this.resolver.resolve(this.activeWorkspace);
25458
23782
  }
25459
- createTransport() {
25460
- return new CliTransport(this.activeSync, this.serverUrl);
23783
+ createTransport(credential = this.activeSync) {
23784
+ return new CliTransport(credential, this.serverUrl);
25461
23785
  }
25462
23786
  }
25463
23787
  function loadContext(env = process.env) {
@@ -25474,13 +23798,13 @@ function loadContext(env = process.env) {
25474
23798
  }
25475
23799
  return new CliContext(credential, serverUrlFromEnv(env), homeDir, out);
25476
23800
  }
25477
- async function withTransport(context, run) {
25478
- const transport = context.createTransport();
23801
+ async function withTransport(context, run, providedTransport) {
23802
+ const transport = providedTransport ?? context.createTransport();
25479
23803
  try {
25480
23804
  await transport.connect();
25481
23805
  return await run(transport);
25482
23806
  } finally {
25483
- transport.dispose();
23807
+ if (!providedTransport) transport.dispose();
25484
23808
  }
25485
23809
  }
25486
23810
  function askHidden(question) {
@@ -25491,25 +23815,20 @@ function askHidden(question) {
25491
23815
  if (stdin.isTTY) stdin.setRawMode(true);
25492
23816
  let value2 = "";
25493
23817
  const onData = (chunk) => {
25494
- const char = chunk.toString("utf8");
25495
- if (char === "\n" || char === "\r" || char === "") {
25496
- if (stdin.isTTY) stdin.setRawMode(wasRaw);
25497
- stdin.removeListener("data", onData);
25498
- stdin.pause();
25499
- process.stdout.write("\n");
25500
- resolve(value2);
23818
+ const result = consumeHiddenInput(value2, chunk.toString("utf8"));
23819
+ if (result.type === "continue") {
23820
+ value2 = result.value;
25501
23821
  return;
25502
23822
  }
25503
- if (char === "") {
25504
- if (stdin.isTTY) stdin.setRawMode(wasRaw);
25505
- process.stdout.write("\n");
25506
- process.exit(130);
25507
- }
25508
- if (char === "") {
25509
- value2 = value2.slice(0, -1);
23823
+ if (stdin.isTTY) stdin.setRawMode(wasRaw);
23824
+ stdin.removeListener("data", onData);
23825
+ stdin.pause();
23826
+ process.stdout.write("\n");
23827
+ if (result.type === "submit") {
23828
+ resolve(result.value);
25510
23829
  return;
25511
23830
  }
25512
- value2 += char;
23831
+ process.exit(130);
25513
23832
  };
25514
23833
  stdin.resume();
25515
23834
  stdin.on("data", onData);
@@ -25552,7 +23871,171 @@ function runLogout(out) {
25552
23871
  }
25553
23872
  out.raw("No stored Saycode credentials. Happy credentials (~/.happy*/access.key) are untouched.");
25554
23873
  }
23874
+ function isCombining(codePoint, character) {
23875
+ return codePoint === 8205 || new RegExp("\\p{Mark}", "u").test(character);
23876
+ }
23877
+ function isWide(codePoint) {
23878
+ return codePoint >= 4352 && (codePoint <= 4447 || codePoint === 9001 || codePoint === 9002 || codePoint >= 11904 && codePoint <= 42191 && codePoint !== 12351 || codePoint >= 44032 && codePoint <= 55203 || codePoint >= 63744 && codePoint <= 64255 || codePoint >= 65040 && codePoint <= 65049 || codePoint >= 65072 && codePoint <= 65135 || codePoint >= 65280 && codePoint <= 65376 || codePoint >= 65504 && codePoint <= 65510 || codePoint >= 127744 && codePoint <= 129791 || codePoint >= 131072 && codePoint <= 262141);
23879
+ }
23880
+ function displayWidth(text2) {
23881
+ let width = 0;
23882
+ for (const character of text2) {
23883
+ const codePoint = character.codePointAt(0) ?? 0;
23884
+ if (codePoint < 32 || codePoint >= 127 && codePoint < 160 || isCombining(codePoint, character)) continue;
23885
+ width += isWide(codePoint) ? 2 : 1;
23886
+ }
23887
+ return width;
23888
+ }
23889
+ function styledToken(source, marker, style) {
23890
+ if (!source.startsWith(marker)) return null;
23891
+ const end = source.indexOf(marker, marker.length);
23892
+ if (end < marker.length + 1) return null;
23893
+ const text2 = source.slice(marker.length, end);
23894
+ if (text2.trim() === "") return null;
23895
+ return { length: end + marker.length, spans: [{ style, text: text2 }] };
23896
+ }
23897
+ function tokenAt(source) {
23898
+ const escaped = source.match(/^\\([\\`*_[\]~()])/);
23899
+ if (escaped) return { length: escaped[0].length, spans: [{ text: escaped[1] ?? "" }] };
23900
+ const code = source.match(/^`([^`\n]+)`/);
23901
+ if (code) return { length: code[0].length, spans: [{ style: "inlineCode", text: code[1] ?? "" }] };
23902
+ const link = source.match(/^\[([^\]\n]+)]\((https?:\/\/[^\s)\n]+)\)/);
23903
+ if (link) {
23904
+ const text2 = link[1] ?? "";
23905
+ const href = link[2] ?? "";
23906
+ return {
23907
+ length: link[0].length,
23908
+ spans: [{ href, style: "link", text: text2 }, { text: ` (${href})` }]
23909
+ };
23910
+ }
23911
+ return styledToken(source, "**", "strong") ?? styledToken(source, "~~", "strike") ?? (source.startsWith("**") ? null : styledToken(source, "*", "emphasis"));
23912
+ }
23913
+ function appendSpan(spans, span) {
23914
+ if (span.text === "") return;
23915
+ const previous = spans.at(-1);
23916
+ if (previous && previous.style === span.style && previous.href === span.href) {
23917
+ previous.text += span.text;
23918
+ return;
23919
+ }
23920
+ spans.push({ ...span });
23921
+ }
23922
+ function parseInlineMarkdown(source) {
23923
+ const spans = [];
23924
+ let offset = 0;
23925
+ while (offset < source.length) {
23926
+ const token = tokenAt(source.slice(offset));
23927
+ if (token) {
23928
+ for (const span of token.spans) appendSpan(spans, span);
23929
+ offset += token.length;
23930
+ continue;
23931
+ }
23932
+ const character = String.fromCodePoint(source.codePointAt(offset) ?? 0);
23933
+ appendSpan(spans, { text: character });
23934
+ offset += character.length;
23935
+ }
23936
+ return spans;
23937
+ }
23938
+ function finishLine(spans) {
23939
+ while (spans.at(-1)?.text.endsWith(" ")) {
23940
+ const last = spans.at(-1);
23941
+ if (!last) break;
23942
+ last.text = last.text.trimEnd();
23943
+ if (last.text === "") spans.pop();
23944
+ }
23945
+ return { text: spans.map((span) => span.text).join(""), spans };
23946
+ }
23947
+ function renderInlineMarkdown(source, width) {
23948
+ const parsed = parseInlineMarkdown(source);
23949
+ const lines = [];
23950
+ let current = [];
23951
+ let currentWidth = 0;
23952
+ for (const span of parsed) {
23953
+ for (const character of span.text) {
23954
+ const characterWidth = displayWidth(character);
23955
+ if (current.length > 0 && currentWidth + characterWidth > width) {
23956
+ lines.push(finishLine(current));
23957
+ current = [];
23958
+ currentWidth = 0;
23959
+ }
23960
+ if (current.length === 0 && character === " ") continue;
23961
+ appendSpan(current, { ...span, text: character });
23962
+ currentWidth += characterWidth;
23963
+ }
23964
+ }
23965
+ if (current.length > 0 || lines.length === 0) lines.push(finishLine(current));
23966
+ return lines;
23967
+ }
23968
+ function withPrefix(style, prefix, line) {
23969
+ if (!line.spans.some((span) => span.style)) return { style, text: `${prefix}${line.text}` };
23970
+ return { style, text: `${prefix}${line.text}`, spans: [...prefix ? [{ text: prefix }] : [], ...line.spans] };
23971
+ }
23972
+ class TerminalMarkdownRenderer {
23973
+ constructor(width) {
23974
+ this.width = width;
23975
+ }
23976
+ pending = "";
23977
+ inFence = false;
23978
+ get hasPending() {
23979
+ return this.pending !== "";
23980
+ }
23981
+ push(chunk) {
23982
+ const normalized = `${this.pending}${chunk}`.replace(/\r\n?/g, "\n");
23983
+ const sourceLines = normalized.split("\n");
23984
+ this.pending = sourceLines.pop() ?? "";
23985
+ return sourceLines.flatMap((line) => this.renderLine(line));
23986
+ }
23987
+ flush() {
23988
+ const pending = this.pending;
23989
+ this.pending = "";
23990
+ const lines = pending === "" ? [] : this.renderLine(pending);
23991
+ if (!this.inFence) return lines;
23992
+ this.inFence = false;
23993
+ return [...lines, { style: "code", text: "└─" }];
23994
+ }
23995
+ prefixed(style, prefix, content, continuation = " ") {
23996
+ const firstWidth = Math.max(1, this.width - displayWidth(prefix));
23997
+ const wrapped = renderInlineMarkdown(content, firstWidth);
23998
+ const lines = [withPrefix(style, prefix, wrapped[0] ?? { spans: [], text: "" })];
23999
+ for (const part of wrapped.slice(1)) {
24000
+ lines.push(withPrefix(style, continuation, part));
24001
+ }
24002
+ return lines;
24003
+ }
24004
+ renderLine(source) {
24005
+ const fence = source.match(/^\s*```\s*([^`]*)$/);
24006
+ if (fence) {
24007
+ if (this.inFence) {
24008
+ this.inFence = false;
24009
+ return [{ style: "code", text: "└─" }];
24010
+ }
24011
+ this.inFence = true;
24012
+ const language = fence[1]?.trim();
24013
+ return [{ style: "code", text: language ? `┌─ ${language}` : "┌─" }];
24014
+ }
24015
+ if (this.inFence) return this.prefixed("code", "│ ", source, "│ ");
24016
+ if (source.trim() === "") return [{ style: "divider", text: "" }];
24017
+ const heading = source.match(/^\s{0,3}#{1,6}\s+(.+)$/);
24018
+ if (heading) return this.prefixed("heading", "◆ ", heading[1] ?? "");
24019
+ const quote = source.match(/^\s*>\s?(.*)$/);
24020
+ if (quote) return this.prefixed("quote", "│ ", quote[1] ?? "", "│ ");
24021
+ const list = source.match(/^(\s*)([-+*]|\d+\.)\s+(.+)$/);
24022
+ if (list) {
24023
+ const indent = list[1] ?? "";
24024
+ const marker = /^\d/.test(list[2] ?? "") ? list[2] : "•";
24025
+ const prefix = `${indent}${marker} `;
24026
+ return this.prefixed("text", prefix, list[3] ?? "", " ".repeat(displayWidth(prefix)));
24027
+ }
24028
+ return renderInlineMarkdown(source, this.width).map((line) => withPrefix("text", "", line));
24029
+ }
24030
+ }
24031
+ function createTerminalMarkdownRenderer(width = 100) {
24032
+ return new TerminalMarkdownRenderer(Math.max(8, width));
24033
+ }
24034
+ function terminalContentWidth(columns) {
24035
+ return Math.max(20, Math.min(100, (columns ?? 104) - 4));
24036
+ }
25555
24037
  const TOOL_SUMMARY_MAX_LENGTH = 80;
24038
+ const TOOL_PROGRESS_VISIBLE_LINES = 3;
25556
24039
  const TOOL_SUMMARY_KEYS = ["command", "file_path", "path", "pattern", "query", "url", "prompt"];
25557
24040
  function truncate(value2, max) {
25558
24041
  if (value2.length <= max) return value2;
@@ -25575,7 +24058,7 @@ function textLines(text2, style) {
25575
24058
  if (text2.trim() === "") return [];
25576
24059
  return text2.split("\n").map((line) => ({ style, text: line }));
25577
24060
  }
25578
- function renderSessionEvent(ev, envelopeRole) {
24061
+ function renderSessionEvent(ev, envelopeRole, progressByCall) {
25579
24062
  switch (ev.t) {
25580
24063
  case "text":
25581
24064
  if (envelopeRole === "user") return textLines(ev.text, "user").map((line) => ({ ...line, text: `› ${line.text}` }));
@@ -25583,16 +24066,35 @@ function renderSessionEvent(ev, envelopeRole) {
25583
24066
  case "service":
25584
24067
  return textLines(ev.text, "status");
25585
24068
  case "tool-call-start": {
24069
+ progressByCall.set(ev.call, { shown: 0, hidden: 0, lastHidden: null });
25586
24070
  const summary = summarizeToolArgs(ev.args) ?? (ev.description?.trim() || null);
25587
24071
  return [{ style: "tool", text: summary ? `⏺ ${ev.name}(${summary})` : `⏺ ${ev.name}` }];
25588
24072
  }
25589
- case "tool-call-progress":
25590
- return ev.lines.map((line) => ({
25591
- style: ev.stream === "stderr" ? "error" : "progress",
25592
- text: ` │ ${line}`
25593
- }));
25594
- case "tool-call-end":
25595
- return [];
24073
+ case "tool-call-progress": {
24074
+ const state = progressByCall.get(ev.call) ?? { shown: 0, hidden: 0, lastHidden: null };
24075
+ progressByCall.set(ev.call, state);
24076
+ const lines = [];
24077
+ for (const line of ev.lines) {
24078
+ if (ev.stream === "stderr") lines.push({ style: "error", text: ` │ ${line}` });
24079
+ else if (state.shown < TOOL_PROGRESS_VISIBLE_LINES) {
24080
+ state.shown += 1;
24081
+ lines.push({ style: "progress", text: ` │ ${line}` });
24082
+ } else {
24083
+ state.hidden += 1;
24084
+ state.lastHidden = line;
24085
+ }
24086
+ }
24087
+ return lines;
24088
+ }
24089
+ case "tool-call-end": {
24090
+ const state = progressByCall.get(ev.call);
24091
+ progressByCall.delete(ev.call);
24092
+ if (!state?.hidden || !state.lastHidden) return [];
24093
+ return [{
24094
+ style: "progress",
24095
+ text: ` └ ${state.hidden} more lines hidden · last: ${truncate(state.lastHidden, TOOL_SUMMARY_MAX_LENGTH)}`
24096
+ }];
24097
+ }
25596
24098
  case "file":
25597
24099
  return [{ style: "status", text: `📎 ${ev.name} (${formatBytes(ev.size)})` }];
25598
24100
  case "turn-start":
@@ -25605,14 +24107,34 @@ function renderSessionEvent(ev, envelopeRole) {
25605
24107
  return [];
25606
24108
  }
25607
24109
  }
25608
- function renderMessageContent(content) {
25609
- if (content.role === "user") {
25610
- return textLines(content.content.text, "user").map((line) => ({ ...line, text: `› ${line.text}` }));
24110
+ class SessionEventRenderer {
24111
+ markdown;
24112
+ progressByCall = /* @__PURE__ */ new Map();
24113
+ constructor(width) {
24114
+ this.markdown = createTerminalMarkdownRenderer(width);
24115
+ }
24116
+ flush() {
24117
+ return this.markdown.flush();
25611
24118
  }
25612
- if (content.role === "session") {
25613
- return renderSessionEvent(content.content.ev, content.content.role);
24119
+ render(content) {
24120
+ if (content.role === "user") {
24121
+ return [...this.flush(), ...textLines(content.content.text, "user").map((line) => ({ ...line, text: `› ${line.text}` }))];
24122
+ }
24123
+ if (content.role !== "session") return [];
24124
+ const { ev, role } = content.content;
24125
+ if (ev.t === "text" && role === "agent" && !ev.thinking) {
24126
+ if (!this.markdown.hasPending && ev.text.trim() === "") return [];
24127
+ return this.markdown.push(ev.text);
24128
+ }
24129
+ const prefix = this.flush();
24130
+ if (ev.t === "turn-start") this.progressByCall.clear();
24131
+ const rendered = renderSessionEvent(ev, role, this.progressByCall);
24132
+ if (ev.t === "turn-end") this.progressByCall.clear();
24133
+ return [...prefix, ...rendered];
25614
24134
  }
25615
- return [];
24135
+ }
24136
+ function createSessionEventRenderer(width = 100) {
24137
+ return new SessionEventRenderer(width);
25616
24138
  }
25617
24139
  function record(value2) {
25618
24140
  return value2 && typeof value2 === "object" && !Array.isArray(value2) ? value2 : null;
@@ -25650,10 +24172,10 @@ function decodeContent(transport, ciphertext) {
25650
24172
  return null;
25651
24173
  }
25652
24174
  }
25653
- function printContent(context, content) {
25654
- context.out.lines(renderMessageContent(content));
24175
+ function printContent(context, content, renderer = createSessionEventRenderer()) {
24176
+ context.out.lines(renderer.render(content));
25655
24177
  }
25656
- async function prerollHistory(context, transport, sessionId, since) {
24178
+ async function prerollHistory(context, transport, sessionId, since, onContent, renderer = createSessionEventRenderer()) {
25657
24179
  if (since <= 0) return 0;
25658
24180
  const messages = await context.rest.recentMessages(sessionId, since);
25659
24181
  let highestSeq = 0;
@@ -25662,28 +24184,31 @@ async function prerollHistory(context, transport, sessionId, since) {
25662
24184
  const ciphertext = unwrapEncryptedField(message.content);
25663
24185
  if (!ciphertext) continue;
25664
24186
  const content = decodeContent(transport, ciphertext);
25665
- if (content) printContent(context, content);
24187
+ if (!content) continue;
24188
+ printContent(context, content, renderer);
24189
+ onContent?.(content);
25666
24190
  }
25667
24191
  return highestSeq;
25668
24192
  }
25669
24193
  function followSession(input) {
25670
24194
  let highestSeq = input.seenThroughSeq;
25671
- input.transport.onUpdate((update) => {
24195
+ const renderer = input.renderer ?? createSessionEventRenderer();
24196
+ return input.transport.onUpdate((update) => {
25672
24197
  input.onUpdate?.(update);
25673
24198
  const message = readNewMessage(update, input.sessionId);
25674
- if (!message) return;
25675
- if (message.localId && input.ownLocalIds?.has(message.localId)) return;
24199
+ if (!message || message.localId && input.ownLocalIds?.has(message.localId)) return;
25676
24200
  if (message.seq !== 0 && message.seq <= highestSeq) return;
25677
24201
  highestSeq = Math.max(highestSeq, message.seq);
25678
24202
  const content = decodeContent(input.transport, message.ciphertext);
25679
24203
  if (!content) return;
25680
- input.onContent ? input.onContent(content) : printContent(input.context, content);
24204
+ input.onContent ? input.onContent(content) : printContent(input.context, content, renderer);
25681
24205
  });
25682
24206
  }
25683
24207
  async function runAttach(context, options) {
25684
24208
  await withTransport(context, async (transport) => {
25685
- const seenThroughSeq = await prerollHistory(context, transport, options.sessionId, options.since);
25686
- followSession({ context, transport, sessionId: options.sessionId, seenThroughSeq });
24209
+ const renderer = createSessionEventRenderer(terminalContentWidth(process.stdout.columns));
24210
+ const seenThroughSeq = await prerollHistory(context, transport, options.sessionId, options.since, void 0, renderer);
24211
+ followSession({ context, transport, sessionId: options.sessionId, seenThroughSeq, renderer });
25687
24212
  context.out.raw(`Attached to ${options.sessionId}. Ctrl+C to detach — the session keeps running.`);
25688
24213
  await new Promise((resolve) => {
25689
24214
  process.once("SIGINT", () => {
@@ -25696,17 +24221,20 @@ async function runAttach(context, options) {
25696
24221
  function createChatState() {
25697
24222
  return { phase: "idle", pendingPermission: null };
25698
24223
  }
25699
- function isTurnEnd(content) {
25700
- if (content.role !== "session") return false;
25701
- const { t } = content.content.ev;
25702
- return t === "turn-end" || t === "stop";
24224
+ function turnBoundary(content) {
24225
+ if (content.role !== "session") return null;
24226
+ const { role, ev } = content.content;
24227
+ if (role === "agent" && ev.t === "turn-start") return "start";
24228
+ return ev.t === "turn-end" || ev.t === "stop" ? "end" : null;
25703
24229
  }
25704
24230
  function reduceChatState(state, event) {
25705
24231
  switch (event.type) {
25706
24232
  case "message-sent":
25707
24233
  return { phase: "responding", pendingPermission: null };
25708
24234
  case "content": {
25709
- if (!isTurnEnd(event.content)) return state;
24235
+ const boundary = turnBoundary(event.content);
24236
+ if (boundary === "start") return { phase: "responding", pendingPermission: null };
24237
+ if (boundary !== "end") return state;
25710
24238
  if (state.phase === "idle") return state;
25711
24239
  return { phase: "idle", pendingPermission: null };
25712
24240
  }
@@ -25729,6 +24257,27 @@ function interruptMenuChoice(key) {
25729
24257
  if (first === "s") return "stop";
25730
24258
  return "watch";
25731
24259
  }
24260
+ function chatPresentation(state) {
24261
+ if (state.phase === "idle") {
24262
+ return {
24263
+ inputMode: "prompt",
24264
+ status: "● Ready — you can type",
24265
+ prompt: "› "
24266
+ };
24267
+ }
24268
+ if (state.phase === "awaiting-permission") {
24269
+ return {
24270
+ inputMode: "permission",
24271
+ status: "◆ Action required — permission response only",
24272
+ prompt: null
24273
+ };
24274
+ }
24275
+ return {
24276
+ inputMode: "locked",
24277
+ status: "● Agent is responding — input locked · Ctrl+C for options",
24278
+ prompt: null
24279
+ };
24280
+ }
25732
24281
  function describePermissionRequest(request) {
25733
24282
  const summary = summarizeToolArgs(request.arguments ?? {});
25734
24283
  if (summary) return `${request.toolName}(${summary})`;
@@ -25751,6 +24300,7 @@ function isNewConversation(id) {
25751
24300
  return id === NEW_CONVERSATION_ID;
25752
24301
  }
25753
24302
  function withNewConversationEntry(items, canCreate) {
24303
+ if (!canCreate) return [...items];
25754
24304
  return [{ id: NEW_CONVERSATION_ID, label: "+ New conversation", detail: "" }, ...items];
25755
24305
  }
25756
24306
  const DEFAULT_RESUME_HISTORY = 20;
@@ -25758,6 +24308,106 @@ function resumeHistoryCount(input) {
25758
24308
  if (!input.resuming) return 0;
25759
24309
  return input.since ?? DEFAULT_RESUME_HISTORY;
25760
24310
  }
24311
+ class ChatInputController {
24312
+ constructor(readline, input) {
24313
+ this.readline = readline;
24314
+ this.input = input;
24315
+ this.readline.once("close", this.handleClose);
24316
+ }
24317
+ closed = false;
24318
+ locked = false;
24319
+ rawBeforeLock = false;
24320
+ onInterrupt = null;
24321
+ suspendedDataListeners = [];
24322
+ keyListener = null;
24323
+ resolveKey = null;
24324
+ questionAbort = null;
24325
+ handleClose = () => {
24326
+ this.closed = true;
24327
+ this.cancelQuestion();
24328
+ this.unlock();
24329
+ };
24330
+ handleLockedData = (chunk) => {
24331
+ const value2 = typeof chunk === "string" ? chunk : chunk.toString("utf8");
24332
+ if (value2.includes("")) this.onInterrupt?.();
24333
+ };
24334
+ lock(onInterrupt) {
24335
+ this.onInterrupt = onInterrupt;
24336
+ if (this.locked || this.closed) return;
24337
+ this.cancelQuestion();
24338
+ this.locked = true;
24339
+ this.rawBeforeLock = this.input.isRaw === true;
24340
+ this.readline.pause();
24341
+ this.suspendedDataListeners = this.input.listeners("data");
24342
+ for (const listener of this.suspendedDataListeners) this.input.off("data", listener);
24343
+ if (this.input.isTTY) this.input.setRawMode?.(true);
24344
+ this.input.resume();
24345
+ this.input.on("data", this.handleLockedData);
24346
+ }
24347
+ unlock() {
24348
+ if (!this.locked) return;
24349
+ this.locked = false;
24350
+ this.input.off("data", this.handleLockedData);
24351
+ if (this.keyListener) {
24352
+ this.input.off("data", this.keyListener);
24353
+ this.keyListener = null;
24354
+ const resolve = this.resolveKey;
24355
+ this.resolveKey = null;
24356
+ resolve?.("");
24357
+ }
24358
+ if (this.input.isTTY) this.input.setRawMode?.(this.rawBeforeLock);
24359
+ for (const listener of this.suspendedDataListeners) this.input.on("data", listener);
24360
+ this.suspendedDataListeners = [];
24361
+ this.readline.resume();
24362
+ }
24363
+ ask(prompt) {
24364
+ this.unlock();
24365
+ if (this.closed) return Promise.resolve(null);
24366
+ const abort = new AbortController();
24367
+ this.questionAbort = abort;
24368
+ return new Promise((resolve) => {
24369
+ let settled = false;
24370
+ const finish = (answer) => {
24371
+ if (settled) return;
24372
+ settled = true;
24373
+ this.readline.off("close", onClose);
24374
+ abort.signal.removeEventListener("abort", onAbort);
24375
+ if (this.questionAbort === abort) this.questionAbort = null;
24376
+ resolve(answer);
24377
+ };
24378
+ const onClose = () => finish(null);
24379
+ const onAbort = () => finish(null);
24380
+ this.readline.once("close", onClose);
24381
+ abort.signal.addEventListener("abort", onAbort, { once: true });
24382
+ this.readline.question(prompt, { signal: abort.signal }, (answer) => finish(answer));
24383
+ });
24384
+ }
24385
+ cancelQuestion() {
24386
+ this.questionAbort?.abort();
24387
+ }
24388
+ readKey() {
24389
+ if (!this.locked || this.closed) return Promise.resolve("");
24390
+ this.input.off("data", this.handleLockedData);
24391
+ return new Promise((resolve) => {
24392
+ this.resolveKey = resolve;
24393
+ this.keyListener = (chunk) => {
24394
+ if (!this.keyListener) return;
24395
+ this.input.off("data", this.keyListener);
24396
+ this.keyListener = null;
24397
+ this.resolveKey = null;
24398
+ if (this.locked) this.input.on("data", this.handleLockedData);
24399
+ resolve(typeof chunk === "string" ? chunk : chunk.toString("utf8"));
24400
+ };
24401
+ this.input.on("data", this.keyListener);
24402
+ });
24403
+ }
24404
+ close() {
24405
+ this.cancelQuestion();
24406
+ this.unlock();
24407
+ this.closed = true;
24408
+ this.readline.off("close", this.handleClose);
24409
+ }
24410
+ }
25761
24411
  function readString$1(source, key) {
25762
24412
  const value2 = source?.[key];
25763
24413
  return typeof value2 === "string" && value2 ? value2 : void 0;
@@ -26009,32 +24659,6 @@ async function spawnSession(transport, machineId, directory, agent) {
26009
24659
  }
26010
24660
  return result.sessionId;
26011
24661
  }
26012
- function ask(rl, question, state) {
26013
- if (state.closed) return Promise.resolve(null);
26014
- return new Promise((resolve) => {
26015
- const onClose = () => resolve(null);
26016
- rl.once("close", onClose);
26017
- rl.question(question, (answer) => {
26018
- rl.off("close", onClose);
26019
- resolve(answer);
26020
- });
26021
- });
26022
- }
26023
- function readSingleKey(rl, input) {
26024
- rl.pause();
26025
- const wasRaw = input.isRaw === true;
26026
- if (input.isTTY) input.setRawMode(true);
26027
- input.resume();
26028
- return new Promise((resolve) => {
26029
- const onData = (chunk) => {
26030
- input.off("data", onData);
26031
- if (input.isTTY) input.setRawMode(wasRaw);
26032
- rl.resume();
26033
- resolve(typeof chunk === "string" ? chunk : chunk.toString("utf8"));
26034
- };
26035
- input.on("data", onData);
26036
- });
26037
- }
26038
24662
  async function replyToPermission(transport, sessionId, request, answer) {
26039
24663
  const approved = answer !== "deny";
26040
24664
  await transport.rpc(sessionId, "permission", {
@@ -26105,56 +24729,28 @@ async function resolveSpawnTarget(context, options) {
26105
24729
  }
26106
24730
  return { machineId: await resolveMachineId(context, options.machine), directory: options.directory };
26107
24731
  }
26108
- async function runChat(context, options) {
24732
+ async function runChat(context, options, providedTransport) {
26109
24733
  const resuming = !!options.sessionId;
26110
24734
  const target = resuming ? null : await resolveSpawnTarget(context, options);
26111
24735
  return withTransport(context, async (transport) => {
26112
24736
  const sessionId = options.sessionId ?? await spawnSession(transport, target.machineId, target.directory, options.agent);
26113
24737
  context.out.raw(`Session ${sessionId}`);
26114
- context.out.raw("While working: Ctrl+C for options (keep watching · detach · stop).");
24738
+ context.out.raw("During a response, typing is locked. Ctrl+C opens response options.");
26115
24739
  context.out.raw("At the prompt: /detach to leave with the agent still running · /exit to leave.\n");
26116
24740
  const chat = new ChatSession();
24741
+ const renderer = createSessionEventRenderer(terminalContentWidth(process.stdout.columns));
26117
24742
  const answered = /* @__PURE__ */ new Set();
26118
24743
  const ownLocalIds = /* @__PURE__ */ new Set();
26119
24744
  const seenThroughSeq = await prerollHistory(
26120
24745
  context,
26121
24746
  transport,
26122
24747
  sessionId,
26123
- resumeHistoryCount({ resuming, ...options.since !== void 0 ? { since: options.since } : {} })
24748
+ resumeHistoryCount({ resuming, ...options.since !== void 0 ? { since: options.since } : {} }),
24749
+ (content) => chat.apply({ type: "content", content }),
24750
+ renderer
26124
24751
  );
26125
- followSession({
26126
- context,
26127
- transport,
26128
- sessionId,
26129
- seenThroughSeq,
26130
- ownLocalIds,
26131
- onContent: (content) => {
26132
- printContent(context, content);
26133
- chat.apply({ type: "content", content });
26134
- },
26135
- onUpdate: (update) => {
26136
- const cipher = readSessionAgentState(update, sessionId);
26137
- if (!cipher) return;
26138
- let decoded;
26139
- try {
26140
- decoded = transport.decodePayload(cipher);
26141
- } catch {
26142
- return;
26143
- }
26144
- for (const request of pendingPermissionRequestsFromState(decoded)) {
26145
- if (answered.has(request.requestId)) continue;
26146
- chat.apply({ type: "permission-requested", request });
26147
- }
26148
- }
26149
- });
26150
24752
  const rl = createInterface({ input: process.stdin, output: process.stdout });
26151
- const stdinState = { closed: false };
26152
- rl.once("close", () => {
26153
- stdinState.closed = true;
26154
- });
26155
- rl.on("line", (raw) => {
26156
- if (raw.trim() === DETACH_COMMAND) chat.detach();
26157
- });
24753
+ const input = new ChatInputController(rl, process.stdin);
26158
24754
  let menuOpen = false;
26159
24755
  const onSigint = () => {
26160
24756
  if (interruptDecision(chat.current) === "exit-cli") {
@@ -26166,7 +24762,7 @@ Leaving. Reattach with \`saycode chat -s ${sessionId}\`.`);
26166
24762
  if (menuOpen) return;
26167
24763
  menuOpen = true;
26168
24764
  context.out.raw("\n^C [Enter] keep watching · [d] detach, agent keeps working · [s] stop the response");
26169
- void readSingleKey(rl, process.stdin).then((key) => {
24765
+ void input.readKey().then((key) => {
26170
24766
  menuOpen = false;
26171
24767
  const choice = interruptMenuChoice(key);
26172
24768
  if (choice === "detach") {
@@ -26181,12 +24777,72 @@ Leaving. Reattach with \`saycode chat -s ${sessionId}\`.`);
26181
24777
  context.out.raw("…still working.");
26182
24778
  });
26183
24779
  };
24780
+ const stopFollowing = followSession({
24781
+ context,
24782
+ transport,
24783
+ sessionId,
24784
+ seenThroughSeq,
24785
+ ownLocalIds,
24786
+ renderer,
24787
+ onContent: (content) => {
24788
+ printContent(context, content, renderer);
24789
+ chat.apply({ type: "content", content });
24790
+ if (chat.current.phase === "responding") input.lock(onSigint);
24791
+ },
24792
+ onUpdate: (update) => {
24793
+ const cipher = readSessionAgentState(update, sessionId);
24794
+ if (!cipher) return;
24795
+ let decoded;
24796
+ try {
24797
+ decoded = transport.decodePayload(cipher);
24798
+ } catch {
24799
+ return;
24800
+ }
24801
+ for (const request of pendingPermissionRequestsFromState(decoded)) {
24802
+ if (answered.has(request.requestId)) continue;
24803
+ chat.apply({ type: "permission-requested", request });
24804
+ input.cancelQuestion();
24805
+ }
24806
+ }
24807
+ });
26184
24808
  process.on("SIGINT", onSigint);
26185
24809
  let outcome = "exited";
26186
24810
  try {
26187
24811
  for (; ; ) {
26188
- const line = await ask(rl, "› ", stdinState);
26189
- if (line === null) break;
24812
+ if (chat.current.phase !== "idle") {
24813
+ if (chat.current.phase === "responding") {
24814
+ context.out.line({ style: "thinking", text: chatPresentation(chat.current).status });
24815
+ input.lock(onSigint);
24816
+ }
24817
+ for (; ; ) {
24818
+ const state = await chat.waitForAttention();
24819
+ if (chat.isDetached) break;
24820
+ if (state.phase !== "awaiting-permission" || !state.pendingPermission) break;
24821
+ const request = state.pendingPermission;
24822
+ context.out.line({ style: "tool", text: chatPresentation(state).status });
24823
+ let answer = parsePermissionAnswer(await input.ask(`${permissionPromptText(request)} `) ?? "n");
24824
+ while (answer === "unknown") {
24825
+ answer = parsePermissionAnswer(await input.ask("Please answer y, n, or a. ") ?? "n");
24826
+ }
24827
+ answered.add(request.requestId);
24828
+ await replyToPermission(transport, sessionId, request, answer);
24829
+ chat.apply({ type: "permission-answered" });
24830
+ context.out.line({ style: "thinking", text: chatPresentation(chat.current).status });
24831
+ input.lock(onSigint);
24832
+ }
24833
+ if (chat.isDetached) {
24834
+ outcome = "detached";
24835
+ break;
24836
+ }
24837
+ continue;
24838
+ }
24839
+ const ready = chatPresentation(chat.current);
24840
+ context.out.line({ style: "status", text: ready.status });
24841
+ const line = await input.ask(ready.prompt);
24842
+ if (line === null) {
24843
+ if (chat.current.phase !== "idle") continue;
24844
+ break;
24845
+ }
26190
24846
  const prompt = line.trim();
26191
24847
  if (prompt === "/exit" || prompt === "/quit") break;
26192
24848
  if (prompt === DETACH_COMMAND) {
@@ -26194,36 +24850,21 @@ Leaving. Reattach with \`saycode chat -s ${sessionId}\`.`);
26194
24850
  break;
26195
24851
  }
26196
24852
  if (prompt === "") continue;
26197
- ownLocalIds.add(await sendPrompt(context, sessionId, prompt));
26198
24853
  chat.apply({ type: "message-sent" });
26199
- context.out.line({ style: "thinking", text: "⏳ working — Ctrl+C for options" });
26200
- for (; ; ) {
26201
- const state = await chat.waitForAttention();
26202
- if (chat.isDetached) break;
26203
- if (state.phase !== "awaiting-permission" || !state.pendingPermission) break;
26204
- const request = state.pendingPermission;
26205
- let answer = parsePermissionAnswer(await ask(rl, `${permissionPromptText(request)} `, stdinState) ?? "n");
26206
- while (answer === "unknown") {
26207
- answer = parsePermissionAnswer(await ask(rl, "Please answer y, n, or a. ", stdinState) ?? "n");
26208
- }
26209
- answered.add(request.requestId);
26210
- await replyToPermission(transport, sessionId, request, answer);
26211
- chat.apply({ type: "permission-answered" });
26212
- }
26213
- if (chat.isDetached) {
26214
- outcome = "detached";
26215
- break;
26216
- }
24854
+ input.lock(onSigint);
24855
+ ownLocalIds.add(await sendPrompt(context, sessionId, prompt));
26217
24856
  }
26218
24857
  } finally {
24858
+ stopFollowing();
26219
24859
  process.off("SIGINT", onSigint);
24860
+ input.close();
26220
24861
  rl.close();
26221
24862
  }
26222
24863
  context.out.raw(outcome === "detached" ? `
26223
24864
  Detached — the session keeps running. Reattach with \`saycode chat -s ${sessionId}\`.` : `
26224
24865
  Leaving. Reattach with \`saycode chat -s ${sessionId}\`.`);
26225
24866
  return outcome;
26226
- });
24867
+ }, providedTransport);
26227
24868
  }
26228
24869
  const ESC = "\x1B";
26229
24870
  const CTRL_C = "";
@@ -26408,7 +25049,7 @@ async function runWatch(context, options) {
26408
25049
  const selectable = process.stdin.isTTY === true;
26409
25050
  await withTransport(context, async (transport) => {
26410
25051
  let activity = createActivityIndex();
26411
- transport.onEphemeral((event) => {
25052
+ const stopActivity = transport.onEphemeral((event) => {
26412
25053
  activity = applyActivity(activity, event);
26413
25054
  });
26414
25055
  let rows = [];
@@ -26453,11 +25094,12 @@ async function runWatch(context, options) {
26453
25094
  wake = null;
26454
25095
  }
26455
25096
  } finally {
25097
+ stopActivity();
26456
25098
  keyboard?.restore();
26457
25099
  }
26458
25100
  if (openSessionId) {
26459
25101
  context.out.raw("\x1B[2J\x1B[H");
26460
- await runChat(context, { sessionId: openSessionId, agent: "claude" });
25102
+ await runChat(context, { sessionId: openSessionId, agent: "claude" }, transport);
26461
25103
  return;
26462
25104
  }
26463
25105
  context.out.raw("");
@@ -26552,6 +25194,30 @@ function applyAction(state, action) {
26552
25194
  return state;
26553
25195
  }
26554
25196
  }
25197
+ function canCreateProjectConversation(project) {
25198
+ return Boolean(project?.detail?.trim());
25199
+ }
25200
+ class WorkspaceTransportOwner {
25201
+ constructor(create) {
25202
+ this.create = create;
25203
+ }
25204
+ current = null;
25205
+ disposed = false;
25206
+ get(credential) {
25207
+ if (this.disposed) throw new Error("Workspace transport owner was disposed.");
25208
+ if (this.current?.credential === credential) return this.current.transport;
25209
+ this.current?.transport.dispose();
25210
+ const transport = this.create(credential);
25211
+ this.current = { credential, transport };
25212
+ return transport;
25213
+ }
25214
+ dispose() {
25215
+ if (this.disposed) return;
25216
+ this.disposed = true;
25217
+ this.current?.transport.dispose();
25218
+ this.current = null;
25219
+ }
25220
+ }
26555
25221
  const HEADER_LINES = 4;
26556
25222
  function screenHeight() {
26557
25223
  return Math.max(5, (process.stdout.rows ?? 24) - HEADER_LINES - 3);
@@ -26584,7 +25250,8 @@ async function loadLevel(context, state) {
26584
25250
  label: row.summaryText ?? row.title ?? row.id,
26585
25251
  detail: row.active ? "●" : "○"
26586
25252
  }));
26587
- return withNewConversationEntry(rows);
25253
+ const project = state.selections.find((_, index) => state.levels[index] === "project");
25254
+ return withNewConversationEntry(rows, canCreateProjectConversation(project));
26588
25255
  }
26589
25256
  const machineId = selectedId(state, "machine");
26590
25257
  const sessions = filterSessions(normalizeSessionRows(await context.rest.listSessions(), keys), {
@@ -26628,6 +25295,7 @@ async function runBrowse(context) {
26628
25295
  }
26629
25296
  let state = createBrowseState(levels);
26630
25297
  const keyboard = startKeyboard(process.stdin);
25298
+ const transports2 = new WorkspaceTransportOwner((credential) => context.createTransport(credential));
26631
25299
  const pending = [];
26632
25300
  let wake = null;
26633
25301
  keyboard.onKey((key) => {
@@ -26668,9 +25336,9 @@ async function runBrowse(context) {
26668
25336
  try {
26669
25337
  if (isNewConversation(chosen.id)) {
26670
25338
  const projectId = selectedId(state, "project");
26671
- await runChat(context, { project: projectId, agent: "claude" });
25339
+ await runChat(context, { project: projectId, agent: "claude" }, transports2.get(context.syncCredential));
26672
25340
  } else {
26673
- await runChat(context, { sessionId: chosen.id, agent: "claude" });
25341
+ await runChat(context, { sessionId: chosen.id, agent: "claude" }, transports2.get(context.syncCredential));
26674
25342
  }
26675
25343
  } catch (error) {
26676
25344
  context.out.raw(`
@@ -26687,6 +25355,7 @@ Could not open that: ${error instanceof Error ? error.message : String(error)}`)
26687
25355
  }
26688
25356
  }
26689
25357
  } finally {
25358
+ transports2.dispose();
26690
25359
  keyboard.restore();
26691
25360
  context.out.raw("");
26692
25361
  }