claude-threads 1.17.0 → 1.17.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/CHANGELOG.md +18 -0
- package/dist/index.js +329 -3145
- package/dist/mcp/mcp-server.js +21 -4
- package/package.json +10 -6
package/dist/index.js
CHANGED
|
@@ -7203,6 +7203,18 @@ var require_semver = __commonJS((exports, module) => {
|
|
|
7203
7203
|
var { safeRe: re, t } = require_re();
|
|
7204
7204
|
var parseOptions = require_parse_options();
|
|
7205
7205
|
var { compareIdentifiers } = require_identifiers();
|
|
7206
|
+
var isPrereleaseIdentifier = (prerelease, identifier) => {
|
|
7207
|
+
const identifiers = identifier.split(".");
|
|
7208
|
+
if (identifiers.length > prerelease.length) {
|
|
7209
|
+
return false;
|
|
7210
|
+
}
|
|
7211
|
+
for (let i2 = 0;i2 < identifiers.length; i2++) {
|
|
7212
|
+
if (compareIdentifiers(prerelease[i2], identifiers[i2]) !== 0) {
|
|
7213
|
+
return false;
|
|
7214
|
+
}
|
|
7215
|
+
}
|
|
7216
|
+
return true;
|
|
7217
|
+
};
|
|
7206
7218
|
|
|
7207
7219
|
class SemVer {
|
|
7208
7220
|
constructor(version, options) {
|
|
@@ -7442,8 +7454,9 @@ var require_semver = __commonJS((exports, module) => {
|
|
|
7442
7454
|
if (identifierBase === false) {
|
|
7443
7455
|
prerelease = [identifier];
|
|
7444
7456
|
}
|
|
7445
|
-
if (
|
|
7446
|
-
|
|
7457
|
+
if (isPrereleaseIdentifier(this.prerelease, identifier)) {
|
|
7458
|
+
const prereleaseBase = this.prerelease[identifier.split(".").length];
|
|
7459
|
+
if (isNaN(prereleaseBase)) {
|
|
7447
7460
|
this.prerelease = prerelease;
|
|
7448
7461
|
}
|
|
7449
7462
|
} else {
|
|
@@ -8032,6 +8045,7 @@ var require_range = __commonJS((exports, module) => {
|
|
|
8032
8045
|
return comp;
|
|
8033
8046
|
};
|
|
8034
8047
|
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
8048
|
+
var invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
|
|
8035
8049
|
var replaceTildes = (comp, options) => {
|
|
8036
8050
|
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
8037
8051
|
};
|
|
@@ -8091,9 +8105,9 @@ var require_range = __commonJS((exports, module) => {
|
|
|
8091
8105
|
debug("no pr");
|
|
8092
8106
|
if (M === "0") {
|
|
8093
8107
|
if (m === "0") {
|
|
8094
|
-
ret = `>=${M}.${m}.${p}
|
|
8108
|
+
ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
|
|
8095
8109
|
} else {
|
|
8096
|
-
ret = `>=${M}.${m}.${p}
|
|
8110
|
+
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
8097
8111
|
}
|
|
8098
8112
|
} else {
|
|
8099
8113
|
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
@@ -8112,6 +8126,9 @@ var require_range = __commonJS((exports, module) => {
|
|
|
8112
8126
|
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
8113
8127
|
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
8114
8128
|
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
8129
|
+
if (invalidXRangeOrder(M, m, p)) {
|
|
8130
|
+
return comp;
|
|
8131
|
+
}
|
|
8115
8132
|
const xM = isX(M);
|
|
8116
8133
|
const xm = xM || isX(m);
|
|
8117
8134
|
const xp = xm || isX(p);
|
|
@@ -29984,3172 +30001,336 @@ Check the top-level render call using <` + componentName2 + ">.");
|
|
|
29984
30001
|
(executionContext & (RenderContext | CommitContext)) === NoContext && (workInProgressRootRenderTargetTime = now$1() + RENDER_TIMEOUT_MS, flushSyncWorkAcrossRoots_impl(0, false));
|
|
29985
30002
|
}
|
|
29986
30003
|
}
|
|
29987
|
-
break;
|
|
29988
|
-
case 31:
|
|
29989
|
-
case 13:
|
|
29990
|
-
lanes = enqueueConcurrentRenderForLane(fiber, 2), lanes !== null && scheduleUpdateOnFiber(lanes, fiber, 2), flushSyncWork(), markRetryLaneIfNotHydrated(fiber, 2);
|
|
29991
|
-
}
|
|
29992
|
-
};
|
|
29993
|
-
exports2.batchedUpdates = function(fn, a) {
|
|
29994
|
-
return fn(a);
|
|
29995
|
-
};
|
|
29996
|
-
exports2.createComponentSelector = function(component) {
|
|
29997
|
-
return { $$typeof: COMPONENT_TYPE, value: component };
|
|
29998
|
-
};
|
|
29999
|
-
exports2.createContainer = function(containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator) {
|
|
30000
|
-
return createFiberRoot(containerInfo, tag, false, null, hydrationCallbacks, isStrictMode, identifierPrefix, null, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator);
|
|
30001
|
-
};
|
|
30002
|
-
exports2.createHasPseudoClassSelector = function(selectors) {
|
|
30003
|
-
return { $$typeof: HAS_PSEUDO_CLASS_TYPE, value: selectors };
|
|
30004
|
-
};
|
|
30005
|
-
exports2.createHydrationContainer = function(initialChildren, callback, containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator, transitionCallbacks, formState) {
|
|
30006
|
-
initialChildren = createFiberRoot(containerInfo, tag, true, initialChildren, hydrationCallbacks, isStrictMode, identifierPrefix, formState, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator);
|
|
30007
|
-
initialChildren.context = getContextForSubtree(null);
|
|
30008
|
-
containerInfo = initialChildren.current;
|
|
30009
|
-
tag = requestUpdateLane(containerInfo);
|
|
30010
|
-
tag = getBumpedLaneForHydrationByLane(tag);
|
|
30011
|
-
hydrationCallbacks = createUpdate(tag);
|
|
30012
|
-
hydrationCallbacks.callback = callback !== undefined && callback !== null ? callback : null;
|
|
30013
|
-
enqueueUpdate(containerInfo, hydrationCallbacks, tag);
|
|
30014
|
-
startUpdateTimerByLane(tag, "hydrateRoot()", null);
|
|
30015
|
-
callback = tag;
|
|
30016
|
-
initialChildren.current.lanes = callback;
|
|
30017
|
-
markRootUpdated$1(initialChildren, callback);
|
|
30018
|
-
ensureRootIsScheduled(initialChildren);
|
|
30019
|
-
return initialChildren;
|
|
30020
|
-
};
|
|
30021
|
-
exports2.createPortal = function(children, containerInfo, implementation) {
|
|
30022
|
-
var key = 3 < arguments.length && arguments[3] !== undefined ? arguments[3] : null;
|
|
30023
|
-
try {
|
|
30024
|
-
testStringCoercion(key);
|
|
30025
|
-
var JSCompiler_inline_result = false;
|
|
30026
|
-
} catch (e$6) {
|
|
30027
|
-
JSCompiler_inline_result = true;
|
|
30028
|
-
}
|
|
30029
|
-
JSCompiler_inline_result && (console.error("The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", typeof Symbol === "function" && Symbol.toStringTag && key[Symbol.toStringTag] || key.constructor.name || "Object"), testStringCoercion(key));
|
|
30030
|
-
return {
|
|
30031
|
-
$$typeof: REACT_PORTAL_TYPE,
|
|
30032
|
-
key: key == null ? null : "" + key,
|
|
30033
|
-
children,
|
|
30034
|
-
containerInfo,
|
|
30035
|
-
implementation
|
|
30036
|
-
};
|
|
30037
|
-
};
|
|
30038
|
-
exports2.createRoleSelector = function(role) {
|
|
30039
|
-
return { $$typeof: ROLE_TYPE, value: role };
|
|
30040
|
-
};
|
|
30041
|
-
exports2.createTestNameSelector = function(id) {
|
|
30042
|
-
return { $$typeof: TEST_NAME_TYPE, value: id };
|
|
30043
|
-
};
|
|
30044
|
-
exports2.createTextSelector = function(text) {
|
|
30045
|
-
return { $$typeof: TEXT_TYPE, value: text };
|
|
30046
|
-
};
|
|
30047
|
-
exports2.defaultOnCaughtError = function(error) {
|
|
30048
|
-
var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component." : "The above error occurred in one of your React components.", recreateMessage = "React will try to recreate this component tree from scratch using the error boundary you provided, " + ((errorBoundaryName || "Anonymous") + ".");
|
|
30049
|
-
typeof error === "object" && error !== null && typeof error.environmentName === "string" ? bindToConsole("error", [`%o
|
|
30050
|
-
|
|
30051
|
-
%s
|
|
30052
|
-
|
|
30053
|
-
%s
|
|
30054
|
-
`, error, componentNameMessage, recreateMessage], error.environmentName)() : console.error(`%o
|
|
30055
|
-
|
|
30056
|
-
%s
|
|
30057
|
-
|
|
30058
|
-
%s
|
|
30059
|
-
`, error, componentNameMessage, recreateMessage);
|
|
30060
|
-
};
|
|
30061
|
-
exports2.defaultOnRecoverableError = function(error) {
|
|
30062
|
-
reportGlobalError(error);
|
|
30063
|
-
};
|
|
30064
|
-
exports2.defaultOnUncaughtError = function(error) {
|
|
30065
|
-
reportGlobalError(error);
|
|
30066
|
-
console.warn(`%s
|
|
30067
|
-
|
|
30068
|
-
%s
|
|
30069
|
-
`, componentName ? "An error occurred in the <" + componentName + "> component." : "An error occurred in one of your React components.", `Consider adding an error boundary to your tree to customize error handling behavior.
|
|
30070
|
-
Visit https://react.dev/link/error-boundaries to learn more about error boundaries.`);
|
|
30071
|
-
};
|
|
30072
|
-
exports2.deferredUpdates = function(fn) {
|
|
30073
|
-
var prevTransition = ReactSharedInternals.T, previousPriority = getCurrentUpdatePriority();
|
|
30074
|
-
try {
|
|
30075
|
-
return setCurrentUpdatePriority(32), ReactSharedInternals.T = null, fn();
|
|
30076
|
-
} finally {
|
|
30077
|
-
setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = prevTransition;
|
|
30078
|
-
}
|
|
30079
|
-
};
|
|
30080
|
-
exports2.discreteUpdates = function(fn, a, b, c, d) {
|
|
30081
|
-
var prevTransition = ReactSharedInternals.T, previousPriority = getCurrentUpdatePriority();
|
|
30082
|
-
try {
|
|
30083
|
-
return setCurrentUpdatePriority(2), ReactSharedInternals.T = null, fn(a, b, c, d);
|
|
30084
|
-
} finally {
|
|
30085
|
-
setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = prevTransition, executionContext === NoContext && (workInProgressRootRenderTargetTime = now$1() + RENDER_TIMEOUT_MS);
|
|
30086
|
-
}
|
|
30087
|
-
};
|
|
30088
|
-
exports2.findAllNodes = findAllNodes;
|
|
30089
|
-
exports2.findBoundingRects = function(hostRoot, selectors) {
|
|
30090
|
-
if (!supportsTestSelectors)
|
|
30091
|
-
throw Error("Test selector API is not supported by this renderer.");
|
|
30092
|
-
selectors = findAllNodes(hostRoot, selectors);
|
|
30093
|
-
hostRoot = [];
|
|
30094
|
-
for (var i2 = 0;i2 < selectors.length; i2++)
|
|
30095
|
-
hostRoot.push(getBoundingRect(selectors[i2]));
|
|
30096
|
-
for (selectors = hostRoot.length - 1;0 < selectors; selectors--) {
|
|
30097
|
-
i2 = hostRoot[selectors];
|
|
30098
|
-
for (var targetLeft = i2.x, targetRight = targetLeft + i2.width, targetTop = i2.y, targetBottom = targetTop + i2.height, j = selectors - 1;0 <= j; j--)
|
|
30099
|
-
if (selectors !== j) {
|
|
30100
|
-
var otherRect = hostRoot[j], otherLeft = otherRect.x, otherRight = otherLeft + otherRect.width, otherTop = otherRect.y, otherBottom = otherTop + otherRect.height;
|
|
30101
|
-
if (targetLeft >= otherLeft && targetTop >= otherTop && targetRight <= otherRight && targetBottom <= otherBottom) {
|
|
30102
|
-
hostRoot.splice(selectors, 1);
|
|
30103
|
-
break;
|
|
30104
|
-
} else if (!(targetLeft !== otherLeft || i2.width !== otherRect.width || otherBottom < targetTop || otherTop > targetBottom)) {
|
|
30105
|
-
otherTop > targetTop && (otherRect.height += otherTop - targetTop, otherRect.y = targetTop);
|
|
30106
|
-
otherBottom < targetBottom && (otherRect.height = targetBottom - otherTop);
|
|
30107
|
-
hostRoot.splice(selectors, 1);
|
|
30108
|
-
break;
|
|
30109
|
-
} else if (!(targetTop !== otherTop || i2.height !== otherRect.height || otherRight < targetLeft || otherLeft > targetRight)) {
|
|
30110
|
-
otherLeft > targetLeft && (otherRect.width += otherLeft - targetLeft, otherRect.x = targetLeft);
|
|
30111
|
-
otherRight < targetRight && (otherRect.width = targetRight - otherLeft);
|
|
30112
|
-
hostRoot.splice(selectors, 1);
|
|
30113
|
-
break;
|
|
30114
|
-
}
|
|
30115
|
-
}
|
|
30116
|
-
}
|
|
30117
|
-
return hostRoot;
|
|
30118
|
-
};
|
|
30119
|
-
exports2.findHostInstance = function(component) {
|
|
30120
|
-
var fiber = component._reactInternals;
|
|
30121
|
-
if (fiber === undefined) {
|
|
30122
|
-
if (typeof component.render === "function")
|
|
30123
|
-
throw Error("Unable to find node on an unmounted component.");
|
|
30124
|
-
component = Object.keys(component).join(",");
|
|
30125
|
-
throw Error("Argument appears to not be a ReactComponent. Keys: " + component);
|
|
30126
|
-
}
|
|
30127
|
-
component = findCurrentHostFiber(fiber);
|
|
30128
|
-
return component === null ? null : getPublicInstance(component.stateNode);
|
|
30129
|
-
};
|
|
30130
|
-
exports2.findHostInstanceWithNoPortals = function(fiber) {
|
|
30131
|
-
fiber = findCurrentFiberUsingSlowPath(fiber);
|
|
30132
|
-
fiber = fiber !== null ? findCurrentHostFiberWithNoPortalsImpl(fiber) : null;
|
|
30133
|
-
return fiber === null ? null : getPublicInstance(fiber.stateNode);
|
|
30134
|
-
};
|
|
30135
|
-
exports2.findHostInstanceWithWarning = function(component, methodName) {
|
|
30136
|
-
var fiber = component._reactInternals;
|
|
30137
|
-
if (fiber === undefined) {
|
|
30138
|
-
if (typeof component.render === "function")
|
|
30139
|
-
throw Error("Unable to find node on an unmounted component.");
|
|
30140
|
-
component = Object.keys(component).join(",");
|
|
30141
|
-
throw Error("Argument appears to not be a ReactComponent. Keys: " + component);
|
|
30142
|
-
}
|
|
30143
|
-
component = findCurrentHostFiber(fiber);
|
|
30144
|
-
if (component === null)
|
|
30145
|
-
return null;
|
|
30146
|
-
if (component.mode & 8) {
|
|
30147
|
-
var componentName2 = getComponentNameFromFiber(fiber) || "Component";
|
|
30148
|
-
didWarnAboutFindNodeInStrictMode[componentName2] || (didWarnAboutFindNodeInStrictMode[componentName2] = true, runWithFiberInDEV(component, function() {
|
|
30149
|
-
fiber.mode & 8 ? console.error("%s is deprecated in StrictMode. %s was passed an instance of %s which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://react.dev/link/strict-mode-find-node", methodName, methodName, componentName2) : console.error("%s is deprecated in StrictMode. %s was passed an instance of %s which renders StrictMode children. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://react.dev/link/strict-mode-find-node", methodName, methodName, componentName2);
|
|
30150
|
-
}));
|
|
30151
|
-
}
|
|
30152
|
-
return getPublicInstance(component.stateNode);
|
|
30153
|
-
};
|
|
30154
|
-
exports2.flushPassiveEffects = flushPendingEffects;
|
|
30155
|
-
exports2.flushSyncFromReconciler = function(fn) {
|
|
30156
|
-
var prevExecutionContext = executionContext;
|
|
30157
|
-
executionContext |= 1;
|
|
30158
|
-
var prevTransition = ReactSharedInternals.T, previousPriority = getCurrentUpdatePriority();
|
|
30159
|
-
try {
|
|
30160
|
-
if (setCurrentUpdatePriority(2), ReactSharedInternals.T = null, fn)
|
|
30161
|
-
return fn();
|
|
30162
|
-
} finally {
|
|
30163
|
-
setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = prevTransition, executionContext = prevExecutionContext, (executionContext & (RenderContext | CommitContext)) === NoContext && flushSyncWorkAcrossRoots_impl(0, false);
|
|
30164
|
-
}
|
|
30165
|
-
};
|
|
30166
|
-
exports2.flushSyncWork = flushSyncWork;
|
|
30167
|
-
exports2.focusWithin = function(hostRoot, selectors) {
|
|
30168
|
-
if (!supportsTestSelectors)
|
|
30169
|
-
throw Error("Test selector API is not supported by this renderer.");
|
|
30170
|
-
hostRoot = findFiberRootForHostRoot(hostRoot);
|
|
30171
|
-
selectors = findPaths(hostRoot, selectors);
|
|
30172
|
-
selectors = Array.from(selectors);
|
|
30173
|
-
for (hostRoot = 0;hostRoot < selectors.length; ) {
|
|
30174
|
-
var fiber = selectors[hostRoot++], tag = fiber.tag;
|
|
30175
|
-
if (!isHiddenSubtree(fiber)) {
|
|
30176
|
-
if ((tag === 5 || tag === 26 || tag === 27) && setFocusIfFocusable(fiber.stateNode))
|
|
30177
|
-
return true;
|
|
30178
|
-
for (fiber = fiber.child;fiber !== null; )
|
|
30179
|
-
selectors.push(fiber), fiber = fiber.sibling;
|
|
30180
|
-
}
|
|
30181
|
-
}
|
|
30182
|
-
return false;
|
|
30183
|
-
};
|
|
30184
|
-
exports2.getFindAllNodesFailureDescription = function(hostRoot, selectors) {
|
|
30185
|
-
if (!supportsTestSelectors)
|
|
30186
|
-
throw Error("Test selector API is not supported by this renderer.");
|
|
30187
|
-
var maxSelectorIndex = 0, matchedNames = [];
|
|
30188
|
-
hostRoot = [findFiberRootForHostRoot(hostRoot), 0];
|
|
30189
|
-
for (var index = 0;index < hostRoot.length; ) {
|
|
30190
|
-
var fiber = hostRoot[index++], tag = fiber.tag, selectorIndex = hostRoot[index++], selector = selectors[selectorIndex];
|
|
30191
|
-
if (tag !== 5 && tag !== 26 && tag !== 27 || !isHiddenSubtree(fiber)) {
|
|
30192
|
-
if (matchSelector(fiber, selector) && (matchedNames.push(selectorToString(selector)), selectorIndex++, selectorIndex > maxSelectorIndex && (maxSelectorIndex = selectorIndex)), selectorIndex < selectors.length)
|
|
30193
|
-
for (fiber = fiber.child;fiber !== null; )
|
|
30194
|
-
hostRoot.push(fiber, selectorIndex), fiber = fiber.sibling;
|
|
30195
|
-
}
|
|
30196
|
-
}
|
|
30197
|
-
if (maxSelectorIndex < selectors.length) {
|
|
30198
|
-
for (hostRoot = [];maxSelectorIndex < selectors.length; maxSelectorIndex++)
|
|
30199
|
-
hostRoot.push(selectorToString(selectors[maxSelectorIndex]));
|
|
30200
|
-
return `findAllNodes was able to match part of the selector:
|
|
30201
|
-
` + (matchedNames.join(" > ") + `
|
|
30202
|
-
|
|
30203
|
-
No matching component was found for:
|
|
30204
|
-
`) + hostRoot.join(" > ");
|
|
30205
|
-
}
|
|
30206
|
-
return null;
|
|
30207
|
-
};
|
|
30208
|
-
exports2.getPublicRootInstance = function(container) {
|
|
30209
|
-
container = container.current;
|
|
30210
|
-
if (!container.child)
|
|
30211
|
-
return null;
|
|
30212
|
-
switch (container.child.tag) {
|
|
30213
|
-
case 27:
|
|
30214
|
-
case 5:
|
|
30215
|
-
return getPublicInstance(container.child.stateNode);
|
|
30216
|
-
default:
|
|
30217
|
-
return container.child.stateNode;
|
|
30218
|
-
}
|
|
30219
|
-
};
|
|
30220
|
-
exports2.injectIntoDevTools = function() {
|
|
30221
|
-
var internals = {
|
|
30222
|
-
bundleType: 1,
|
|
30223
|
-
version: rendererVersion,
|
|
30224
|
-
rendererPackageName,
|
|
30225
|
-
currentDispatcherRef: ReactSharedInternals,
|
|
30226
|
-
reconcilerVersion: "19.2.0"
|
|
30227
|
-
};
|
|
30228
|
-
extraDevToolsConfig !== null && (internals.rendererConfig = extraDevToolsConfig);
|
|
30229
|
-
internals.overrideHookState = overrideHookState;
|
|
30230
|
-
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
|
|
30231
|
-
internals.overrideHookStateRenamePath = overrideHookStateRenamePath;
|
|
30232
|
-
internals.overrideProps = overrideProps;
|
|
30233
|
-
internals.overridePropsDeletePath = overridePropsDeletePath;
|
|
30234
|
-
internals.overridePropsRenamePath = overridePropsRenamePath;
|
|
30235
|
-
internals.scheduleUpdate = scheduleUpdate;
|
|
30236
|
-
internals.scheduleRetry = scheduleRetry;
|
|
30237
|
-
internals.setErrorHandler = setErrorHandler;
|
|
30238
|
-
internals.setSuspenseHandler = setSuspenseHandler;
|
|
30239
|
-
internals.scheduleRefresh = scheduleRefresh;
|
|
30240
|
-
internals.scheduleRoot = scheduleRoot;
|
|
30241
|
-
internals.setRefreshHandler = setRefreshHandler;
|
|
30242
|
-
internals.getCurrentFiber = getCurrentFiberForDevTools;
|
|
30243
|
-
return injectInternals(internals);
|
|
30244
|
-
};
|
|
30245
|
-
exports2.isAlreadyRendering = isAlreadyRendering;
|
|
30246
|
-
exports2.observeVisibleRects = function(hostRoot, selectors, callback, options) {
|
|
30247
|
-
function commitHook() {
|
|
30248
|
-
var nextInstanceRoots = findAllNodes(hostRoot, selectors);
|
|
30249
|
-
instanceRoots.forEach(function(target) {
|
|
30250
|
-
0 > nextInstanceRoots.indexOf(target) && unobserve(target);
|
|
30251
|
-
});
|
|
30252
|
-
nextInstanceRoots.forEach(function(target) {
|
|
30253
|
-
0 > instanceRoots.indexOf(target) && observe(target);
|
|
30254
|
-
});
|
|
30255
|
-
}
|
|
30256
|
-
if (!supportsTestSelectors)
|
|
30257
|
-
throw Error("Test selector API is not supported by this renderer.");
|
|
30258
|
-
var instanceRoots = findAllNodes(hostRoot, selectors);
|
|
30259
|
-
callback = setupIntersectionObserver(instanceRoots, callback, options);
|
|
30260
|
-
var { disconnect, observe, unobserve } = callback;
|
|
30261
|
-
commitHooks.push(commitHook);
|
|
30262
|
-
return {
|
|
30263
|
-
disconnect: function() {
|
|
30264
|
-
var index = commitHooks.indexOf(commitHook);
|
|
30265
|
-
0 <= index && commitHooks.splice(index, 1);
|
|
30266
|
-
disconnect();
|
|
30267
|
-
}
|
|
30268
|
-
};
|
|
30269
|
-
};
|
|
30270
|
-
exports2.shouldError = function(fiber) {
|
|
30271
|
-
return shouldErrorImpl(fiber);
|
|
30272
|
-
};
|
|
30273
|
-
exports2.shouldSuspend = function(fiber) {
|
|
30274
|
-
return shouldSuspendImpl(fiber);
|
|
30275
|
-
};
|
|
30276
|
-
exports2.startHostTransition = function(formFiber, pendingState, action, formData) {
|
|
30277
|
-
if (formFiber.tag !== 5)
|
|
30278
|
-
throw Error("Expected the form instance to be a HostComponent. This is a bug in React.");
|
|
30279
|
-
var queue = ensureFormComponentIsStateful(formFiber).queue;
|
|
30280
|
-
startHostActionTimer(formFiber);
|
|
30281
|
-
startTransition(formFiber, queue, pendingState, NotPendingTransition, action === null ? noop : function() {
|
|
30282
|
-
ReactSharedInternals.T === null && console.error("requestFormReset was called outside a transition or action. To fix, move to an action, or wrap with startTransition.");
|
|
30283
|
-
var stateHook = ensureFormComponentIsStateful(formFiber);
|
|
30284
|
-
stateHook.next === null && (stateHook = formFiber.alternate.memoizedState);
|
|
30285
|
-
dispatchSetStateInternal(formFiber, stateHook.next.queue, {}, requestUpdateLane(formFiber));
|
|
30286
|
-
return action(formData);
|
|
30287
|
-
});
|
|
30288
|
-
};
|
|
30289
|
-
exports2.updateContainer = function(element, container, parentComponent, callback) {
|
|
30290
|
-
var current2 = container.current, lane = requestUpdateLane(current2);
|
|
30291
|
-
updateContainerImpl(current2, lane, element, container, parentComponent, callback);
|
|
30292
|
-
return lane;
|
|
30293
|
-
};
|
|
30294
|
-
exports2.updateContainerSync = updateContainerSync;
|
|
30295
|
-
return exports2;
|
|
30296
|
-
}, module.exports.default = module.exports, Object.defineProperty(module.exports, "__esModule", { value: true });
|
|
30297
|
-
});
|
|
30298
|
-
|
|
30299
|
-
// node_modules/react-reconciler/index.js
|
|
30300
|
-
var require_react_reconciler = __commonJS((exports, module) => {
|
|
30301
|
-
if (false) {} else {
|
|
30302
|
-
module.exports = require_react_reconciler_development();
|
|
30303
|
-
}
|
|
30304
|
-
});
|
|
30305
|
-
|
|
30306
|
-
// node_modules/ink/node_modules/ws/lib/constants.js
|
|
30307
|
-
var require_constants6 = __commonJS((exports, module) => {
|
|
30308
|
-
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
30309
|
-
var hasBlob = typeof Blob !== "undefined";
|
|
30310
|
-
if (hasBlob)
|
|
30311
|
-
BINARY_TYPES.push("blob");
|
|
30312
|
-
module.exports = {
|
|
30313
|
-
BINARY_TYPES,
|
|
30314
|
-
EMPTY_BUFFER: Buffer.alloc(0),
|
|
30315
|
-
GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
|
|
30316
|
-
hasBlob,
|
|
30317
|
-
kForOnEventAttribute: Symbol("kIsForOnEventAttribute"),
|
|
30318
|
-
kListener: Symbol("kListener"),
|
|
30319
|
-
kStatusCode: Symbol("status-code"),
|
|
30320
|
-
kWebSocket: Symbol("websocket"),
|
|
30321
|
-
NOOP: () => {}
|
|
30322
|
-
};
|
|
30323
|
-
});
|
|
30324
|
-
|
|
30325
|
-
// node_modules/ink/node_modules/ws/lib/buffer-util.js
|
|
30326
|
-
var require_buffer_util2 = __commonJS((exports, module) => {
|
|
30327
|
-
var { EMPTY_BUFFER } = require_constants6();
|
|
30328
|
-
var FastBuffer = Buffer[Symbol.species];
|
|
30329
|
-
function concat(list, totalLength) {
|
|
30330
|
-
if (list.length === 0)
|
|
30331
|
-
return EMPTY_BUFFER;
|
|
30332
|
-
if (list.length === 1)
|
|
30333
|
-
return list[0];
|
|
30334
|
-
const target = Buffer.allocUnsafe(totalLength);
|
|
30335
|
-
let offset = 0;
|
|
30336
|
-
for (let i2 = 0;i2 < list.length; i2++) {
|
|
30337
|
-
const buf = list[i2];
|
|
30338
|
-
target.set(buf, offset);
|
|
30339
|
-
offset += buf.length;
|
|
30340
|
-
}
|
|
30341
|
-
if (offset < totalLength) {
|
|
30342
|
-
return new FastBuffer(target.buffer, target.byteOffset, offset);
|
|
30343
|
-
}
|
|
30344
|
-
return target;
|
|
30345
|
-
}
|
|
30346
|
-
function _mask(source, mask, output, offset, length) {
|
|
30347
|
-
for (let i2 = 0;i2 < length; i2++) {
|
|
30348
|
-
output[offset + i2] = source[i2] ^ mask[i2 & 3];
|
|
30349
|
-
}
|
|
30350
|
-
}
|
|
30351
|
-
function _unmask(buffer, mask) {
|
|
30352
|
-
for (let i2 = 0;i2 < buffer.length; i2++) {
|
|
30353
|
-
buffer[i2] ^= mask[i2 & 3];
|
|
30354
|
-
}
|
|
30355
|
-
}
|
|
30356
|
-
function toArrayBuffer(buf) {
|
|
30357
|
-
if (buf.length === buf.buffer.byteLength) {
|
|
30358
|
-
return buf.buffer;
|
|
30359
|
-
}
|
|
30360
|
-
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
|
|
30361
|
-
}
|
|
30362
|
-
function toBuffer(data) {
|
|
30363
|
-
toBuffer.readOnly = true;
|
|
30364
|
-
if (Buffer.isBuffer(data))
|
|
30365
|
-
return data;
|
|
30366
|
-
let buf;
|
|
30367
|
-
if (data instanceof ArrayBuffer) {
|
|
30368
|
-
buf = new FastBuffer(data);
|
|
30369
|
-
} else if (ArrayBuffer.isView(data)) {
|
|
30370
|
-
buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength);
|
|
30371
|
-
} else {
|
|
30372
|
-
buf = Buffer.from(data);
|
|
30373
|
-
toBuffer.readOnly = false;
|
|
30374
|
-
}
|
|
30375
|
-
return buf;
|
|
30376
|
-
}
|
|
30377
|
-
module.exports = {
|
|
30378
|
-
concat,
|
|
30379
|
-
mask: _mask,
|
|
30380
|
-
toArrayBuffer,
|
|
30381
|
-
toBuffer,
|
|
30382
|
-
unmask: _unmask
|
|
30383
|
-
};
|
|
30384
|
-
if (!process.env.WS_NO_BUFFER_UTIL) {
|
|
30385
|
-
try {
|
|
30386
|
-
const bufferUtil = (()=>{throw new Error("Cannot require module "+"bufferutil");})();
|
|
30387
|
-
module.exports.mask = function(source, mask, output, offset, length) {
|
|
30388
|
-
if (length < 48)
|
|
30389
|
-
_mask(source, mask, output, offset, length);
|
|
30390
|
-
else
|
|
30391
|
-
bufferUtil.mask(source, mask, output, offset, length);
|
|
30392
|
-
};
|
|
30393
|
-
module.exports.unmask = function(buffer, mask) {
|
|
30394
|
-
if (buffer.length < 32)
|
|
30395
|
-
_unmask(buffer, mask);
|
|
30396
|
-
else
|
|
30397
|
-
bufferUtil.unmask(buffer, mask);
|
|
30398
|
-
};
|
|
30399
|
-
} catch (e) {}
|
|
30400
|
-
}
|
|
30401
|
-
});
|
|
30402
|
-
|
|
30403
|
-
// node_modules/ink/node_modules/ws/lib/limiter.js
|
|
30404
|
-
var require_limiter2 = __commonJS((exports, module) => {
|
|
30405
|
-
var kDone = Symbol("kDone");
|
|
30406
|
-
var kRun = Symbol("kRun");
|
|
30407
|
-
|
|
30408
|
-
class Limiter {
|
|
30409
|
-
constructor(concurrency) {
|
|
30410
|
-
this[kDone] = () => {
|
|
30411
|
-
this.pending--;
|
|
30412
|
-
this[kRun]();
|
|
30413
|
-
};
|
|
30414
|
-
this.concurrency = concurrency || Infinity;
|
|
30415
|
-
this.jobs = [];
|
|
30416
|
-
this.pending = 0;
|
|
30417
|
-
}
|
|
30418
|
-
add(job) {
|
|
30419
|
-
this.jobs.push(job);
|
|
30420
|
-
this[kRun]();
|
|
30421
|
-
}
|
|
30422
|
-
[kRun]() {
|
|
30423
|
-
if (this.pending === this.concurrency)
|
|
30424
|
-
return;
|
|
30425
|
-
if (this.jobs.length) {
|
|
30426
|
-
const job = this.jobs.shift();
|
|
30427
|
-
this.pending++;
|
|
30428
|
-
job(this[kDone]);
|
|
30429
|
-
}
|
|
30430
|
-
}
|
|
30431
|
-
}
|
|
30432
|
-
module.exports = Limiter;
|
|
30433
|
-
});
|
|
30434
|
-
|
|
30435
|
-
// node_modules/ink/node_modules/ws/lib/permessage-deflate.js
|
|
30436
|
-
var require_permessage_deflate2 = __commonJS((exports, module) => {
|
|
30437
|
-
var zlib = __require("zlib");
|
|
30438
|
-
var bufferUtil = require_buffer_util2();
|
|
30439
|
-
var Limiter = require_limiter2();
|
|
30440
|
-
var { kStatusCode } = require_constants6();
|
|
30441
|
-
var FastBuffer = Buffer[Symbol.species];
|
|
30442
|
-
var TRAILER = Buffer.from([0, 0, 255, 255]);
|
|
30443
|
-
var kPerMessageDeflate = Symbol("permessage-deflate");
|
|
30444
|
-
var kTotalLength = Symbol("total-length");
|
|
30445
|
-
var kCallback = Symbol("callback");
|
|
30446
|
-
var kBuffers = Symbol("buffers");
|
|
30447
|
-
var kError = Symbol("error");
|
|
30448
|
-
var zlibLimiter;
|
|
30449
|
-
|
|
30450
|
-
class PerMessageDeflate {
|
|
30451
|
-
constructor(options, isServer, maxPayload) {
|
|
30452
|
-
this._maxPayload = maxPayload | 0;
|
|
30453
|
-
this._options = options || {};
|
|
30454
|
-
this._threshold = this._options.threshold !== undefined ? this._options.threshold : 1024;
|
|
30455
|
-
this._isServer = !!isServer;
|
|
30456
|
-
this._deflate = null;
|
|
30457
|
-
this._inflate = null;
|
|
30458
|
-
this.params = null;
|
|
30459
|
-
if (!zlibLimiter) {
|
|
30460
|
-
const concurrency = this._options.concurrencyLimit !== undefined ? this._options.concurrencyLimit : 10;
|
|
30461
|
-
zlibLimiter = new Limiter(concurrency);
|
|
30462
|
-
}
|
|
30463
|
-
}
|
|
30464
|
-
static get extensionName() {
|
|
30465
|
-
return "permessage-deflate";
|
|
30466
|
-
}
|
|
30467
|
-
offer() {
|
|
30468
|
-
const params = {};
|
|
30469
|
-
if (this._options.serverNoContextTakeover) {
|
|
30470
|
-
params.server_no_context_takeover = true;
|
|
30471
|
-
}
|
|
30472
|
-
if (this._options.clientNoContextTakeover) {
|
|
30473
|
-
params.client_no_context_takeover = true;
|
|
30474
|
-
}
|
|
30475
|
-
if (this._options.serverMaxWindowBits) {
|
|
30476
|
-
params.server_max_window_bits = this._options.serverMaxWindowBits;
|
|
30477
|
-
}
|
|
30478
|
-
if (this._options.clientMaxWindowBits) {
|
|
30479
|
-
params.client_max_window_bits = this._options.clientMaxWindowBits;
|
|
30480
|
-
} else if (this._options.clientMaxWindowBits == null) {
|
|
30481
|
-
params.client_max_window_bits = true;
|
|
30482
|
-
}
|
|
30483
|
-
return params;
|
|
30484
|
-
}
|
|
30485
|
-
accept(configurations) {
|
|
30486
|
-
configurations = this.normalizeParams(configurations);
|
|
30487
|
-
this.params = this._isServer ? this.acceptAsServer(configurations) : this.acceptAsClient(configurations);
|
|
30488
|
-
return this.params;
|
|
30489
|
-
}
|
|
30490
|
-
cleanup() {
|
|
30491
|
-
if (this._inflate) {
|
|
30492
|
-
this._inflate.close();
|
|
30493
|
-
this._inflate = null;
|
|
30494
|
-
}
|
|
30495
|
-
if (this._deflate) {
|
|
30496
|
-
const callback = this._deflate[kCallback];
|
|
30497
|
-
this._deflate.close();
|
|
30498
|
-
this._deflate = null;
|
|
30499
|
-
if (callback) {
|
|
30500
|
-
callback(new Error("The deflate stream was closed while data was being processed"));
|
|
30501
|
-
}
|
|
30502
|
-
}
|
|
30503
|
-
}
|
|
30504
|
-
acceptAsServer(offers) {
|
|
30505
|
-
const opts = this._options;
|
|
30506
|
-
const accepted = offers.find((params) => {
|
|
30507
|
-
if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && !params.client_max_window_bits) {
|
|
30508
|
-
return false;
|
|
30509
|
-
}
|
|
30510
|
-
return true;
|
|
30511
|
-
});
|
|
30512
|
-
if (!accepted) {
|
|
30513
|
-
throw new Error("None of the extension offers can be accepted");
|
|
30514
|
-
}
|
|
30515
|
-
if (opts.serverNoContextTakeover) {
|
|
30516
|
-
accepted.server_no_context_takeover = true;
|
|
30517
|
-
}
|
|
30518
|
-
if (opts.clientNoContextTakeover) {
|
|
30519
|
-
accepted.client_no_context_takeover = true;
|
|
30520
|
-
}
|
|
30521
|
-
if (typeof opts.serverMaxWindowBits === "number") {
|
|
30522
|
-
accepted.server_max_window_bits = opts.serverMaxWindowBits;
|
|
30523
|
-
}
|
|
30524
|
-
if (typeof opts.clientMaxWindowBits === "number") {
|
|
30525
|
-
accepted.client_max_window_bits = opts.clientMaxWindowBits;
|
|
30526
|
-
} else if (accepted.client_max_window_bits === true || opts.clientMaxWindowBits === false) {
|
|
30527
|
-
delete accepted.client_max_window_bits;
|
|
30528
|
-
}
|
|
30529
|
-
return accepted;
|
|
30530
|
-
}
|
|
30531
|
-
acceptAsClient(response) {
|
|
30532
|
-
const params = response[0];
|
|
30533
|
-
if (this._options.clientNoContextTakeover === false && params.client_no_context_takeover) {
|
|
30534
|
-
throw new Error('Unexpected parameter "client_no_context_takeover"');
|
|
30535
|
-
}
|
|
30536
|
-
if (!params.client_max_window_bits) {
|
|
30537
|
-
if (typeof this._options.clientMaxWindowBits === "number") {
|
|
30538
|
-
params.client_max_window_bits = this._options.clientMaxWindowBits;
|
|
30539
|
-
}
|
|
30540
|
-
} else if (this._options.clientMaxWindowBits === false || typeof this._options.clientMaxWindowBits === "number" && params.client_max_window_bits > this._options.clientMaxWindowBits) {
|
|
30541
|
-
throw new Error('Unexpected or invalid parameter "client_max_window_bits"');
|
|
30542
|
-
}
|
|
30543
|
-
return params;
|
|
30544
|
-
}
|
|
30545
|
-
normalizeParams(configurations) {
|
|
30546
|
-
configurations.forEach((params) => {
|
|
30547
|
-
Object.keys(params).forEach((key) => {
|
|
30548
|
-
let value = params[key];
|
|
30549
|
-
if (value.length > 1) {
|
|
30550
|
-
throw new Error(`Parameter "${key}" must have only a single value`);
|
|
30551
|
-
}
|
|
30552
|
-
value = value[0];
|
|
30553
|
-
if (key === "client_max_window_bits") {
|
|
30554
|
-
if (value !== true) {
|
|
30555
|
-
const num = +value;
|
|
30556
|
-
if (!Number.isInteger(num) || num < 8 || num > 15) {
|
|
30557
|
-
throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
|
|
30558
|
-
}
|
|
30559
|
-
value = num;
|
|
30560
|
-
} else if (!this._isServer) {
|
|
30561
|
-
throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
|
|
30562
|
-
}
|
|
30563
|
-
} else if (key === "server_max_window_bits") {
|
|
30564
|
-
const num = +value;
|
|
30565
|
-
if (!Number.isInteger(num) || num < 8 || num > 15) {
|
|
30566
|
-
throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
|
|
30567
|
-
}
|
|
30568
|
-
value = num;
|
|
30569
|
-
} else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") {
|
|
30570
|
-
if (value !== true) {
|
|
30571
|
-
throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
|
|
30572
|
-
}
|
|
30573
|
-
} else {
|
|
30574
|
-
throw new Error(`Unknown parameter "${key}"`);
|
|
30575
|
-
}
|
|
30576
|
-
params[key] = value;
|
|
30577
|
-
});
|
|
30578
|
-
});
|
|
30579
|
-
return configurations;
|
|
30580
|
-
}
|
|
30581
|
-
decompress(data, fin, callback) {
|
|
30582
|
-
zlibLimiter.add((done) => {
|
|
30583
|
-
this._decompress(data, fin, (err, result) => {
|
|
30584
|
-
done();
|
|
30585
|
-
callback(err, result);
|
|
30586
|
-
});
|
|
30587
|
-
});
|
|
30588
|
-
}
|
|
30589
|
-
compress(data, fin, callback) {
|
|
30590
|
-
zlibLimiter.add((done) => {
|
|
30591
|
-
this._compress(data, fin, (err, result) => {
|
|
30592
|
-
done();
|
|
30593
|
-
callback(err, result);
|
|
30594
|
-
});
|
|
30595
|
-
});
|
|
30596
|
-
}
|
|
30597
|
-
_decompress(data, fin, callback) {
|
|
30598
|
-
const endpoint = this._isServer ? "client" : "server";
|
|
30599
|
-
if (!this._inflate) {
|
|
30600
|
-
const key = `${endpoint}_max_window_bits`;
|
|
30601
|
-
const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key];
|
|
30602
|
-
this._inflate = zlib.createInflateRaw({
|
|
30603
|
-
...this._options.zlibInflateOptions,
|
|
30604
|
-
windowBits
|
|
30605
|
-
});
|
|
30606
|
-
this._inflate[kPerMessageDeflate] = this;
|
|
30607
|
-
this._inflate[kTotalLength] = 0;
|
|
30608
|
-
this._inflate[kBuffers] = [];
|
|
30609
|
-
this._inflate.on("error", inflateOnError);
|
|
30610
|
-
this._inflate.on("data", inflateOnData);
|
|
30611
|
-
}
|
|
30612
|
-
this._inflate[kCallback] = callback;
|
|
30613
|
-
this._inflate.write(data);
|
|
30614
|
-
if (fin)
|
|
30615
|
-
this._inflate.write(TRAILER);
|
|
30616
|
-
this._inflate.flush(() => {
|
|
30617
|
-
const err = this._inflate[kError];
|
|
30618
|
-
if (err) {
|
|
30619
|
-
this._inflate.close();
|
|
30620
|
-
this._inflate = null;
|
|
30621
|
-
callback(err);
|
|
30622
|
-
return;
|
|
30623
|
-
}
|
|
30624
|
-
const data2 = bufferUtil.concat(this._inflate[kBuffers], this._inflate[kTotalLength]);
|
|
30625
|
-
if (this._inflate._readableState.endEmitted) {
|
|
30626
|
-
this._inflate.close();
|
|
30627
|
-
this._inflate = null;
|
|
30628
|
-
} else {
|
|
30629
|
-
this._inflate[kTotalLength] = 0;
|
|
30630
|
-
this._inflate[kBuffers] = [];
|
|
30631
|
-
if (fin && this.params[`${endpoint}_no_context_takeover`]) {
|
|
30632
|
-
this._inflate.reset();
|
|
30633
|
-
}
|
|
30634
|
-
}
|
|
30635
|
-
callback(null, data2);
|
|
30636
|
-
});
|
|
30637
|
-
}
|
|
30638
|
-
_compress(data, fin, callback) {
|
|
30639
|
-
const endpoint = this._isServer ? "server" : "client";
|
|
30640
|
-
if (!this._deflate) {
|
|
30641
|
-
const key = `${endpoint}_max_window_bits`;
|
|
30642
|
-
const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key];
|
|
30643
|
-
this._deflate = zlib.createDeflateRaw({
|
|
30644
|
-
...this._options.zlibDeflateOptions,
|
|
30645
|
-
windowBits
|
|
30646
|
-
});
|
|
30647
|
-
this._deflate[kTotalLength] = 0;
|
|
30648
|
-
this._deflate[kBuffers] = [];
|
|
30649
|
-
this._deflate.on("data", deflateOnData);
|
|
30650
|
-
}
|
|
30651
|
-
this._deflate[kCallback] = callback;
|
|
30652
|
-
this._deflate.write(data);
|
|
30653
|
-
this._deflate.flush(zlib.Z_SYNC_FLUSH, () => {
|
|
30654
|
-
if (!this._deflate) {
|
|
30655
|
-
return;
|
|
30656
|
-
}
|
|
30657
|
-
let data2 = bufferUtil.concat(this._deflate[kBuffers], this._deflate[kTotalLength]);
|
|
30658
|
-
if (fin) {
|
|
30659
|
-
data2 = new FastBuffer(data2.buffer, data2.byteOffset, data2.length - 4);
|
|
30660
|
-
}
|
|
30661
|
-
this._deflate[kCallback] = null;
|
|
30662
|
-
this._deflate[kTotalLength] = 0;
|
|
30663
|
-
this._deflate[kBuffers] = [];
|
|
30664
|
-
if (fin && this.params[`${endpoint}_no_context_takeover`]) {
|
|
30665
|
-
this._deflate.reset();
|
|
30666
|
-
}
|
|
30667
|
-
callback(null, data2);
|
|
30668
|
-
});
|
|
30669
|
-
}
|
|
30670
|
-
}
|
|
30671
|
-
module.exports = PerMessageDeflate;
|
|
30672
|
-
function deflateOnData(chunk) {
|
|
30673
|
-
this[kBuffers].push(chunk);
|
|
30674
|
-
this[kTotalLength] += chunk.length;
|
|
30675
|
-
}
|
|
30676
|
-
function inflateOnData(chunk) {
|
|
30677
|
-
this[kTotalLength] += chunk.length;
|
|
30678
|
-
if (this[kPerMessageDeflate]._maxPayload < 1 || this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload) {
|
|
30679
|
-
this[kBuffers].push(chunk);
|
|
30680
|
-
return;
|
|
30681
|
-
}
|
|
30682
|
-
this[kError] = new RangeError("Max payload size exceeded");
|
|
30683
|
-
this[kError].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH";
|
|
30684
|
-
this[kError][kStatusCode] = 1009;
|
|
30685
|
-
this.removeListener("data", inflateOnData);
|
|
30686
|
-
this.reset();
|
|
30687
|
-
}
|
|
30688
|
-
function inflateOnError(err) {
|
|
30689
|
-
this[kPerMessageDeflate]._inflate = null;
|
|
30690
|
-
if (this[kError]) {
|
|
30691
|
-
this[kCallback](this[kError]);
|
|
30692
|
-
return;
|
|
30693
|
-
}
|
|
30694
|
-
err[kStatusCode] = 1007;
|
|
30695
|
-
this[kCallback](err);
|
|
30696
|
-
}
|
|
30697
|
-
});
|
|
30698
|
-
|
|
30699
|
-
// node_modules/ink/node_modules/ws/lib/validation.js
|
|
30700
|
-
var require_validation2 = __commonJS((exports, module) => {
|
|
30701
|
-
var { isUtf8 } = __require("buffer");
|
|
30702
|
-
var { hasBlob } = require_constants6();
|
|
30703
|
-
var tokenChars = [
|
|
30704
|
-
0,
|
|
30705
|
-
0,
|
|
30706
|
-
0,
|
|
30707
|
-
0,
|
|
30708
|
-
0,
|
|
30709
|
-
0,
|
|
30710
|
-
0,
|
|
30711
|
-
0,
|
|
30712
|
-
0,
|
|
30713
|
-
0,
|
|
30714
|
-
0,
|
|
30715
|
-
0,
|
|
30716
|
-
0,
|
|
30717
|
-
0,
|
|
30718
|
-
0,
|
|
30719
|
-
0,
|
|
30720
|
-
0,
|
|
30721
|
-
0,
|
|
30722
|
-
0,
|
|
30723
|
-
0,
|
|
30724
|
-
0,
|
|
30725
|
-
0,
|
|
30726
|
-
0,
|
|
30727
|
-
0,
|
|
30728
|
-
0,
|
|
30729
|
-
0,
|
|
30730
|
-
0,
|
|
30731
|
-
0,
|
|
30732
|
-
0,
|
|
30733
|
-
0,
|
|
30734
|
-
0,
|
|
30735
|
-
0,
|
|
30736
|
-
0,
|
|
30737
|
-
1,
|
|
30738
|
-
0,
|
|
30739
|
-
1,
|
|
30740
|
-
1,
|
|
30741
|
-
1,
|
|
30742
|
-
1,
|
|
30743
|
-
1,
|
|
30744
|
-
0,
|
|
30745
|
-
0,
|
|
30746
|
-
1,
|
|
30747
|
-
1,
|
|
30748
|
-
0,
|
|
30749
|
-
1,
|
|
30750
|
-
1,
|
|
30751
|
-
0,
|
|
30752
|
-
1,
|
|
30753
|
-
1,
|
|
30754
|
-
1,
|
|
30755
|
-
1,
|
|
30756
|
-
1,
|
|
30757
|
-
1,
|
|
30758
|
-
1,
|
|
30759
|
-
1,
|
|
30760
|
-
1,
|
|
30761
|
-
1,
|
|
30762
|
-
0,
|
|
30763
|
-
0,
|
|
30764
|
-
0,
|
|
30765
|
-
0,
|
|
30766
|
-
0,
|
|
30767
|
-
0,
|
|
30768
|
-
0,
|
|
30769
|
-
1,
|
|
30770
|
-
1,
|
|
30771
|
-
1,
|
|
30772
|
-
1,
|
|
30773
|
-
1,
|
|
30774
|
-
1,
|
|
30775
|
-
1,
|
|
30776
|
-
1,
|
|
30777
|
-
1,
|
|
30778
|
-
1,
|
|
30779
|
-
1,
|
|
30780
|
-
1,
|
|
30781
|
-
1,
|
|
30782
|
-
1,
|
|
30783
|
-
1,
|
|
30784
|
-
1,
|
|
30785
|
-
1,
|
|
30786
|
-
1,
|
|
30787
|
-
1,
|
|
30788
|
-
1,
|
|
30789
|
-
1,
|
|
30790
|
-
1,
|
|
30791
|
-
1,
|
|
30792
|
-
1,
|
|
30793
|
-
1,
|
|
30794
|
-
1,
|
|
30795
|
-
0,
|
|
30796
|
-
0,
|
|
30797
|
-
0,
|
|
30798
|
-
1,
|
|
30799
|
-
1,
|
|
30800
|
-
1,
|
|
30801
|
-
1,
|
|
30802
|
-
1,
|
|
30803
|
-
1,
|
|
30804
|
-
1,
|
|
30805
|
-
1,
|
|
30806
|
-
1,
|
|
30807
|
-
1,
|
|
30808
|
-
1,
|
|
30809
|
-
1,
|
|
30810
|
-
1,
|
|
30811
|
-
1,
|
|
30812
|
-
1,
|
|
30813
|
-
1,
|
|
30814
|
-
1,
|
|
30815
|
-
1,
|
|
30816
|
-
1,
|
|
30817
|
-
1,
|
|
30818
|
-
1,
|
|
30819
|
-
1,
|
|
30820
|
-
1,
|
|
30821
|
-
1,
|
|
30822
|
-
1,
|
|
30823
|
-
1,
|
|
30824
|
-
1,
|
|
30825
|
-
1,
|
|
30826
|
-
1,
|
|
30827
|
-
0,
|
|
30828
|
-
1,
|
|
30829
|
-
0,
|
|
30830
|
-
1,
|
|
30831
|
-
0
|
|
30832
|
-
];
|
|
30833
|
-
function isValidStatusCode(code) {
|
|
30834
|
-
return code >= 1000 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3000 && code <= 4999;
|
|
30835
|
-
}
|
|
30836
|
-
function _isValidUTF8(buf) {
|
|
30837
|
-
const len = buf.length;
|
|
30838
|
-
let i2 = 0;
|
|
30839
|
-
while (i2 < len) {
|
|
30840
|
-
if ((buf[i2] & 128) === 0) {
|
|
30841
|
-
i2++;
|
|
30842
|
-
} else if ((buf[i2] & 224) === 192) {
|
|
30843
|
-
if (i2 + 1 === len || (buf[i2 + 1] & 192) !== 128 || (buf[i2] & 254) === 192) {
|
|
30844
|
-
return false;
|
|
30845
|
-
}
|
|
30846
|
-
i2 += 2;
|
|
30847
|
-
} else if ((buf[i2] & 240) === 224) {
|
|
30848
|
-
if (i2 + 2 >= len || (buf[i2 + 1] & 192) !== 128 || (buf[i2 + 2] & 192) !== 128 || buf[i2] === 224 && (buf[i2 + 1] & 224) === 128 || buf[i2] === 237 && (buf[i2 + 1] & 224) === 160) {
|
|
30849
|
-
return false;
|
|
30850
|
-
}
|
|
30851
|
-
i2 += 3;
|
|
30852
|
-
} else if ((buf[i2] & 248) === 240) {
|
|
30853
|
-
if (i2 + 3 >= len || (buf[i2 + 1] & 192) !== 128 || (buf[i2 + 2] & 192) !== 128 || (buf[i2 + 3] & 192) !== 128 || buf[i2] === 240 && (buf[i2 + 1] & 240) === 128 || buf[i2] === 244 && buf[i2 + 1] > 143 || buf[i2] > 244) {
|
|
30854
|
-
return false;
|
|
30855
|
-
}
|
|
30856
|
-
i2 += 4;
|
|
30857
|
-
} else {
|
|
30858
|
-
return false;
|
|
30859
|
-
}
|
|
30860
|
-
}
|
|
30861
|
-
return true;
|
|
30862
|
-
}
|
|
30863
|
-
function isBlob(value) {
|
|
30864
|
-
return hasBlob && typeof value === "object" && typeof value.arrayBuffer === "function" && typeof value.type === "string" && typeof value.stream === "function" && (value[Symbol.toStringTag] === "Blob" || value[Symbol.toStringTag] === "File");
|
|
30865
|
-
}
|
|
30866
|
-
module.exports = {
|
|
30867
|
-
isBlob,
|
|
30868
|
-
isValidStatusCode,
|
|
30869
|
-
isValidUTF8: _isValidUTF8,
|
|
30870
|
-
tokenChars
|
|
30871
|
-
};
|
|
30872
|
-
if (isUtf8) {
|
|
30873
|
-
module.exports.isValidUTF8 = function(buf) {
|
|
30874
|
-
return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
|
|
30875
|
-
};
|
|
30876
|
-
} else if (!process.env.WS_NO_UTF_8_VALIDATE) {
|
|
30877
|
-
try {
|
|
30878
|
-
const isValidUTF8 = (()=>{throw new Error("Cannot require module "+"utf-8-validate");})();
|
|
30879
|
-
module.exports.isValidUTF8 = function(buf) {
|
|
30880
|
-
return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
|
|
30881
|
-
};
|
|
30882
|
-
} catch (e) {}
|
|
30883
|
-
}
|
|
30884
|
-
});
|
|
30885
|
-
|
|
30886
|
-
// node_modules/ink/node_modules/ws/lib/receiver.js
|
|
30887
|
-
var require_receiver2 = __commonJS((exports, module) => {
|
|
30888
|
-
var { Writable } = __require("stream");
|
|
30889
|
-
var PerMessageDeflate = require_permessage_deflate2();
|
|
30890
|
-
var {
|
|
30891
|
-
BINARY_TYPES,
|
|
30892
|
-
EMPTY_BUFFER,
|
|
30893
|
-
kStatusCode,
|
|
30894
|
-
kWebSocket
|
|
30895
|
-
} = require_constants6();
|
|
30896
|
-
var { concat, toArrayBuffer, unmask } = require_buffer_util2();
|
|
30897
|
-
var { isValidStatusCode, isValidUTF8 } = require_validation2();
|
|
30898
|
-
var FastBuffer = Buffer[Symbol.species];
|
|
30899
|
-
var GET_INFO = 0;
|
|
30900
|
-
var GET_PAYLOAD_LENGTH_16 = 1;
|
|
30901
|
-
var GET_PAYLOAD_LENGTH_64 = 2;
|
|
30902
|
-
var GET_MASK = 3;
|
|
30903
|
-
var GET_DATA = 4;
|
|
30904
|
-
var INFLATING = 5;
|
|
30905
|
-
var DEFER_EVENT = 6;
|
|
30906
|
-
|
|
30907
|
-
class Receiver extends Writable {
|
|
30908
|
-
constructor(options = {}) {
|
|
30909
|
-
super();
|
|
30910
|
-
this._allowSynchronousEvents = options.allowSynchronousEvents !== undefined ? options.allowSynchronousEvents : true;
|
|
30911
|
-
this._binaryType = options.binaryType || BINARY_TYPES[0];
|
|
30912
|
-
this._extensions = options.extensions || {};
|
|
30913
|
-
this._isServer = !!options.isServer;
|
|
30914
|
-
this._maxPayload = options.maxPayload | 0;
|
|
30915
|
-
this._skipUTF8Validation = !!options.skipUTF8Validation;
|
|
30916
|
-
this[kWebSocket] = undefined;
|
|
30917
|
-
this._bufferedBytes = 0;
|
|
30918
|
-
this._buffers = [];
|
|
30919
|
-
this._compressed = false;
|
|
30920
|
-
this._payloadLength = 0;
|
|
30921
|
-
this._mask = undefined;
|
|
30922
|
-
this._fragmented = 0;
|
|
30923
|
-
this._masked = false;
|
|
30924
|
-
this._fin = false;
|
|
30925
|
-
this._opcode = 0;
|
|
30926
|
-
this._totalPayloadLength = 0;
|
|
30927
|
-
this._messageLength = 0;
|
|
30928
|
-
this._fragments = [];
|
|
30929
|
-
this._errored = false;
|
|
30930
|
-
this._loop = false;
|
|
30931
|
-
this._state = GET_INFO;
|
|
30932
|
-
}
|
|
30933
|
-
_write(chunk, encoding, cb) {
|
|
30934
|
-
if (this._opcode === 8 && this._state == GET_INFO)
|
|
30935
|
-
return cb();
|
|
30936
|
-
this._bufferedBytes += chunk.length;
|
|
30937
|
-
this._buffers.push(chunk);
|
|
30938
|
-
this.startLoop(cb);
|
|
30939
|
-
}
|
|
30940
|
-
consume(n) {
|
|
30941
|
-
this._bufferedBytes -= n;
|
|
30942
|
-
if (n === this._buffers[0].length)
|
|
30943
|
-
return this._buffers.shift();
|
|
30944
|
-
if (n < this._buffers[0].length) {
|
|
30945
|
-
const buf = this._buffers[0];
|
|
30946
|
-
this._buffers[0] = new FastBuffer(buf.buffer, buf.byteOffset + n, buf.length - n);
|
|
30947
|
-
return new FastBuffer(buf.buffer, buf.byteOffset, n);
|
|
30948
|
-
}
|
|
30949
|
-
const dst = Buffer.allocUnsafe(n);
|
|
30950
|
-
do {
|
|
30951
|
-
const buf = this._buffers[0];
|
|
30952
|
-
const offset = dst.length - n;
|
|
30953
|
-
if (n >= buf.length) {
|
|
30954
|
-
dst.set(this._buffers.shift(), offset);
|
|
30955
|
-
} else {
|
|
30956
|
-
dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset);
|
|
30957
|
-
this._buffers[0] = new FastBuffer(buf.buffer, buf.byteOffset + n, buf.length - n);
|
|
30958
|
-
}
|
|
30959
|
-
n -= buf.length;
|
|
30960
|
-
} while (n > 0);
|
|
30961
|
-
return dst;
|
|
30962
|
-
}
|
|
30963
|
-
startLoop(cb) {
|
|
30964
|
-
this._loop = true;
|
|
30965
|
-
do {
|
|
30966
|
-
switch (this._state) {
|
|
30967
|
-
case GET_INFO:
|
|
30968
|
-
this.getInfo(cb);
|
|
30969
|
-
break;
|
|
30970
|
-
case GET_PAYLOAD_LENGTH_16:
|
|
30971
|
-
this.getPayloadLength16(cb);
|
|
30972
|
-
break;
|
|
30973
|
-
case GET_PAYLOAD_LENGTH_64:
|
|
30974
|
-
this.getPayloadLength64(cb);
|
|
30975
|
-
break;
|
|
30976
|
-
case GET_MASK:
|
|
30977
|
-
this.getMask();
|
|
30978
|
-
break;
|
|
30979
|
-
case GET_DATA:
|
|
30980
|
-
this.getData(cb);
|
|
30981
|
-
break;
|
|
30982
|
-
case INFLATING:
|
|
30983
|
-
case DEFER_EVENT:
|
|
30984
|
-
this._loop = false;
|
|
30985
|
-
return;
|
|
30986
|
-
}
|
|
30987
|
-
} while (this._loop);
|
|
30988
|
-
if (!this._errored)
|
|
30989
|
-
cb();
|
|
30990
|
-
}
|
|
30991
|
-
getInfo(cb) {
|
|
30992
|
-
if (this._bufferedBytes < 2) {
|
|
30993
|
-
this._loop = false;
|
|
30994
|
-
return;
|
|
30995
|
-
}
|
|
30996
|
-
const buf = this.consume(2);
|
|
30997
|
-
if ((buf[0] & 48) !== 0) {
|
|
30998
|
-
const error = this.createError(RangeError, "RSV2 and RSV3 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_2_3");
|
|
30999
|
-
cb(error);
|
|
31000
|
-
return;
|
|
31001
|
-
}
|
|
31002
|
-
const compressed = (buf[0] & 64) === 64;
|
|
31003
|
-
if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
|
|
31004
|
-
const error = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
|
|
31005
|
-
cb(error);
|
|
31006
|
-
return;
|
|
31007
|
-
}
|
|
31008
|
-
this._fin = (buf[0] & 128) === 128;
|
|
31009
|
-
this._opcode = buf[0] & 15;
|
|
31010
|
-
this._payloadLength = buf[1] & 127;
|
|
31011
|
-
if (this._opcode === 0) {
|
|
31012
|
-
if (compressed) {
|
|
31013
|
-
const error = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
|
|
31014
|
-
cb(error);
|
|
31015
|
-
return;
|
|
31016
|
-
}
|
|
31017
|
-
if (!this._fragmented) {
|
|
31018
|
-
const error = this.createError(RangeError, "invalid opcode 0", true, 1002, "WS_ERR_INVALID_OPCODE");
|
|
31019
|
-
cb(error);
|
|
31020
|
-
return;
|
|
31021
|
-
}
|
|
31022
|
-
this._opcode = this._fragmented;
|
|
31023
|
-
} else if (this._opcode === 1 || this._opcode === 2) {
|
|
31024
|
-
if (this._fragmented) {
|
|
31025
|
-
const error = this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE");
|
|
31026
|
-
cb(error);
|
|
31027
|
-
return;
|
|
31028
|
-
}
|
|
31029
|
-
this._compressed = compressed;
|
|
31030
|
-
} else if (this._opcode > 7 && this._opcode < 11) {
|
|
31031
|
-
if (!this._fin) {
|
|
31032
|
-
const error = this.createError(RangeError, "FIN must be set", true, 1002, "WS_ERR_EXPECTED_FIN");
|
|
31033
|
-
cb(error);
|
|
31034
|
-
return;
|
|
31035
|
-
}
|
|
31036
|
-
if (compressed) {
|
|
31037
|
-
const error = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
|
|
31038
|
-
cb(error);
|
|
31039
|
-
return;
|
|
31040
|
-
}
|
|
31041
|
-
if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
|
|
31042
|
-
const error = this.createError(RangeError, `invalid payload length ${this._payloadLength}`, true, 1002, "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");
|
|
31043
|
-
cb(error);
|
|
31044
|
-
return;
|
|
31045
|
-
}
|
|
31046
|
-
} else {
|
|
31047
|
-
const error = this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE");
|
|
31048
|
-
cb(error);
|
|
31049
|
-
return;
|
|
31050
|
-
}
|
|
31051
|
-
if (!this._fin && !this._fragmented)
|
|
31052
|
-
this._fragmented = this._opcode;
|
|
31053
|
-
this._masked = (buf[1] & 128) === 128;
|
|
31054
|
-
if (this._isServer) {
|
|
31055
|
-
if (!this._masked) {
|
|
31056
|
-
const error = this.createError(RangeError, "MASK must be set", true, 1002, "WS_ERR_EXPECTED_MASK");
|
|
31057
|
-
cb(error);
|
|
31058
|
-
return;
|
|
31059
|
-
}
|
|
31060
|
-
} else if (this._masked) {
|
|
31061
|
-
const error = this.createError(RangeError, "MASK must be clear", true, 1002, "WS_ERR_UNEXPECTED_MASK");
|
|
31062
|
-
cb(error);
|
|
31063
|
-
return;
|
|
31064
|
-
}
|
|
31065
|
-
if (this._payloadLength === 126)
|
|
31066
|
-
this._state = GET_PAYLOAD_LENGTH_16;
|
|
31067
|
-
else if (this._payloadLength === 127)
|
|
31068
|
-
this._state = GET_PAYLOAD_LENGTH_64;
|
|
31069
|
-
else
|
|
31070
|
-
this.haveLength(cb);
|
|
31071
|
-
}
|
|
31072
|
-
getPayloadLength16(cb) {
|
|
31073
|
-
if (this._bufferedBytes < 2) {
|
|
31074
|
-
this._loop = false;
|
|
31075
|
-
return;
|
|
31076
|
-
}
|
|
31077
|
-
this._payloadLength = this.consume(2).readUInt16BE(0);
|
|
31078
|
-
this.haveLength(cb);
|
|
31079
|
-
}
|
|
31080
|
-
getPayloadLength64(cb) {
|
|
31081
|
-
if (this._bufferedBytes < 8) {
|
|
31082
|
-
this._loop = false;
|
|
31083
|
-
return;
|
|
31084
|
-
}
|
|
31085
|
-
const buf = this.consume(8);
|
|
31086
|
-
const num = buf.readUInt32BE(0);
|
|
31087
|
-
if (num > Math.pow(2, 53 - 32) - 1) {
|
|
31088
|
-
const error = this.createError(RangeError, "Unsupported WebSocket frame: payload length > 2^53 - 1", false, 1009, "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");
|
|
31089
|
-
cb(error);
|
|
31090
|
-
return;
|
|
31091
|
-
}
|
|
31092
|
-
this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
31093
|
-
this.haveLength(cb);
|
|
31094
|
-
}
|
|
31095
|
-
haveLength(cb) {
|
|
31096
|
-
if (this._payloadLength && this._opcode < 8) {
|
|
31097
|
-
this._totalPayloadLength += this._payloadLength;
|
|
31098
|
-
if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
|
|
31099
|
-
const error = this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");
|
|
31100
|
-
cb(error);
|
|
31101
|
-
return;
|
|
31102
|
-
}
|
|
31103
|
-
}
|
|
31104
|
-
if (this._masked)
|
|
31105
|
-
this._state = GET_MASK;
|
|
31106
|
-
else
|
|
31107
|
-
this._state = GET_DATA;
|
|
31108
|
-
}
|
|
31109
|
-
getMask() {
|
|
31110
|
-
if (this._bufferedBytes < 4) {
|
|
31111
|
-
this._loop = false;
|
|
31112
|
-
return;
|
|
31113
|
-
}
|
|
31114
|
-
this._mask = this.consume(4);
|
|
31115
|
-
this._state = GET_DATA;
|
|
31116
|
-
}
|
|
31117
|
-
getData(cb) {
|
|
31118
|
-
let data = EMPTY_BUFFER;
|
|
31119
|
-
if (this._payloadLength) {
|
|
31120
|
-
if (this._bufferedBytes < this._payloadLength) {
|
|
31121
|
-
this._loop = false;
|
|
31122
|
-
return;
|
|
31123
|
-
}
|
|
31124
|
-
data = this.consume(this._payloadLength);
|
|
31125
|
-
if (this._masked && (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0) {
|
|
31126
|
-
unmask(data, this._mask);
|
|
31127
|
-
}
|
|
31128
|
-
}
|
|
31129
|
-
if (this._opcode > 7) {
|
|
31130
|
-
this.controlMessage(data, cb);
|
|
31131
|
-
return;
|
|
31132
|
-
}
|
|
31133
|
-
if (this._compressed) {
|
|
31134
|
-
this._state = INFLATING;
|
|
31135
|
-
this.decompress(data, cb);
|
|
31136
|
-
return;
|
|
31137
|
-
}
|
|
31138
|
-
if (data.length) {
|
|
31139
|
-
this._messageLength = this._totalPayloadLength;
|
|
31140
|
-
this._fragments.push(data);
|
|
31141
|
-
}
|
|
31142
|
-
this.dataMessage(cb);
|
|
31143
|
-
}
|
|
31144
|
-
decompress(data, cb) {
|
|
31145
|
-
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
31146
|
-
perMessageDeflate.decompress(data, this._fin, (err, buf) => {
|
|
31147
|
-
if (err)
|
|
31148
|
-
return cb(err);
|
|
31149
|
-
if (buf.length) {
|
|
31150
|
-
this._messageLength += buf.length;
|
|
31151
|
-
if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
|
|
31152
|
-
const error = this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");
|
|
31153
|
-
cb(error);
|
|
31154
|
-
return;
|
|
31155
|
-
}
|
|
31156
|
-
this._fragments.push(buf);
|
|
31157
|
-
}
|
|
31158
|
-
this.dataMessage(cb);
|
|
31159
|
-
if (this._state === GET_INFO)
|
|
31160
|
-
this.startLoop(cb);
|
|
31161
|
-
});
|
|
31162
|
-
}
|
|
31163
|
-
dataMessage(cb) {
|
|
31164
|
-
if (!this._fin) {
|
|
31165
|
-
this._state = GET_INFO;
|
|
31166
|
-
return;
|
|
31167
|
-
}
|
|
31168
|
-
const messageLength = this._messageLength;
|
|
31169
|
-
const fragments = this._fragments;
|
|
31170
|
-
this._totalPayloadLength = 0;
|
|
31171
|
-
this._messageLength = 0;
|
|
31172
|
-
this._fragmented = 0;
|
|
31173
|
-
this._fragments = [];
|
|
31174
|
-
if (this._opcode === 2) {
|
|
31175
|
-
let data;
|
|
31176
|
-
if (this._binaryType === "nodebuffer") {
|
|
31177
|
-
data = concat(fragments, messageLength);
|
|
31178
|
-
} else if (this._binaryType === "arraybuffer") {
|
|
31179
|
-
data = toArrayBuffer(concat(fragments, messageLength));
|
|
31180
|
-
} else if (this._binaryType === "blob") {
|
|
31181
|
-
data = new Blob(fragments);
|
|
31182
|
-
} else {
|
|
31183
|
-
data = fragments;
|
|
31184
|
-
}
|
|
31185
|
-
if (this._allowSynchronousEvents) {
|
|
31186
|
-
this.emit("message", data, true);
|
|
31187
|
-
this._state = GET_INFO;
|
|
31188
|
-
} else {
|
|
31189
|
-
this._state = DEFER_EVENT;
|
|
31190
|
-
setImmediate(() => {
|
|
31191
|
-
this.emit("message", data, true);
|
|
31192
|
-
this._state = GET_INFO;
|
|
31193
|
-
this.startLoop(cb);
|
|
31194
|
-
});
|
|
31195
|
-
}
|
|
31196
|
-
} else {
|
|
31197
|
-
const buf = concat(fragments, messageLength);
|
|
31198
|
-
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
31199
|
-
const error = this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8");
|
|
31200
|
-
cb(error);
|
|
31201
|
-
return;
|
|
31202
|
-
}
|
|
31203
|
-
if (this._state === INFLATING || this._allowSynchronousEvents) {
|
|
31204
|
-
this.emit("message", buf, false);
|
|
31205
|
-
this._state = GET_INFO;
|
|
31206
|
-
} else {
|
|
31207
|
-
this._state = DEFER_EVENT;
|
|
31208
|
-
setImmediate(() => {
|
|
31209
|
-
this.emit("message", buf, false);
|
|
31210
|
-
this._state = GET_INFO;
|
|
31211
|
-
this.startLoop(cb);
|
|
31212
|
-
});
|
|
31213
|
-
}
|
|
31214
|
-
}
|
|
31215
|
-
}
|
|
31216
|
-
controlMessage(data, cb) {
|
|
31217
|
-
if (this._opcode === 8) {
|
|
31218
|
-
if (data.length === 0) {
|
|
31219
|
-
this._loop = false;
|
|
31220
|
-
this.emit("conclude", 1005, EMPTY_BUFFER);
|
|
31221
|
-
this.end();
|
|
31222
|
-
} else {
|
|
31223
|
-
const code = data.readUInt16BE(0);
|
|
31224
|
-
if (!isValidStatusCode(code)) {
|
|
31225
|
-
const error = this.createError(RangeError, `invalid status code ${code}`, true, 1002, "WS_ERR_INVALID_CLOSE_CODE");
|
|
31226
|
-
cb(error);
|
|
31227
|
-
return;
|
|
31228
|
-
}
|
|
31229
|
-
const buf = new FastBuffer(data.buffer, data.byteOffset + 2, data.length - 2);
|
|
31230
|
-
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
31231
|
-
const error = this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8");
|
|
31232
|
-
cb(error);
|
|
31233
|
-
return;
|
|
31234
|
-
}
|
|
31235
|
-
this._loop = false;
|
|
31236
|
-
this.emit("conclude", code, buf);
|
|
31237
|
-
this.end();
|
|
31238
|
-
}
|
|
31239
|
-
this._state = GET_INFO;
|
|
31240
|
-
return;
|
|
31241
|
-
}
|
|
31242
|
-
if (this._allowSynchronousEvents) {
|
|
31243
|
-
this.emit(this._opcode === 9 ? "ping" : "pong", data);
|
|
31244
|
-
this._state = GET_INFO;
|
|
31245
|
-
} else {
|
|
31246
|
-
this._state = DEFER_EVENT;
|
|
31247
|
-
setImmediate(() => {
|
|
31248
|
-
this.emit(this._opcode === 9 ? "ping" : "pong", data);
|
|
31249
|
-
this._state = GET_INFO;
|
|
31250
|
-
this.startLoop(cb);
|
|
31251
|
-
});
|
|
31252
|
-
}
|
|
31253
|
-
}
|
|
31254
|
-
createError(ErrorCtor, message, prefix, statusCode, errorCode) {
|
|
31255
|
-
this._loop = false;
|
|
31256
|
-
this._errored = true;
|
|
31257
|
-
const err = new ErrorCtor(prefix ? `Invalid WebSocket frame: ${message}` : message);
|
|
31258
|
-
Error.captureStackTrace(err, this.createError);
|
|
31259
|
-
err.code = errorCode;
|
|
31260
|
-
err[kStatusCode] = statusCode;
|
|
31261
|
-
return err;
|
|
31262
|
-
}
|
|
31263
|
-
}
|
|
31264
|
-
module.exports = Receiver;
|
|
31265
|
-
});
|
|
31266
|
-
|
|
31267
|
-
// node_modules/ink/node_modules/ws/lib/sender.js
|
|
31268
|
-
var require_sender2 = __commonJS((exports, module) => {
|
|
31269
|
-
var { Duplex } = __require("stream");
|
|
31270
|
-
var { randomFillSync } = __require("crypto");
|
|
31271
|
-
var PerMessageDeflate = require_permessage_deflate2();
|
|
31272
|
-
var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants6();
|
|
31273
|
-
var { isBlob, isValidStatusCode } = require_validation2();
|
|
31274
|
-
var { mask: applyMask, toBuffer } = require_buffer_util2();
|
|
31275
|
-
var kByteLength = Symbol("kByteLength");
|
|
31276
|
-
var maskBuffer = Buffer.alloc(4);
|
|
31277
|
-
var RANDOM_POOL_SIZE = 8 * 1024;
|
|
31278
|
-
var randomPool;
|
|
31279
|
-
var randomPoolPointer = RANDOM_POOL_SIZE;
|
|
31280
|
-
var DEFAULT = 0;
|
|
31281
|
-
var DEFLATING = 1;
|
|
31282
|
-
var GET_BLOB_DATA = 2;
|
|
31283
|
-
|
|
31284
|
-
class Sender {
|
|
31285
|
-
constructor(socket, extensions, generateMask) {
|
|
31286
|
-
this._extensions = extensions || {};
|
|
31287
|
-
if (generateMask) {
|
|
31288
|
-
this._generateMask = generateMask;
|
|
31289
|
-
this._maskBuffer = Buffer.alloc(4);
|
|
31290
|
-
}
|
|
31291
|
-
this._socket = socket;
|
|
31292
|
-
this._firstFragment = true;
|
|
31293
|
-
this._compress = false;
|
|
31294
|
-
this._bufferedBytes = 0;
|
|
31295
|
-
this._queue = [];
|
|
31296
|
-
this._state = DEFAULT;
|
|
31297
|
-
this.onerror = NOOP;
|
|
31298
|
-
this[kWebSocket] = undefined;
|
|
31299
|
-
}
|
|
31300
|
-
static frame(data, options) {
|
|
31301
|
-
let mask;
|
|
31302
|
-
let merge2 = false;
|
|
31303
|
-
let offset = 2;
|
|
31304
|
-
let skipMasking = false;
|
|
31305
|
-
if (options.mask) {
|
|
31306
|
-
mask = options.maskBuffer || maskBuffer;
|
|
31307
|
-
if (options.generateMask) {
|
|
31308
|
-
options.generateMask(mask);
|
|
31309
|
-
} else {
|
|
31310
|
-
if (randomPoolPointer === RANDOM_POOL_SIZE) {
|
|
31311
|
-
if (randomPool === undefined) {
|
|
31312
|
-
randomPool = Buffer.alloc(RANDOM_POOL_SIZE);
|
|
31313
|
-
}
|
|
31314
|
-
randomFillSync(randomPool, 0, RANDOM_POOL_SIZE);
|
|
31315
|
-
randomPoolPointer = 0;
|
|
31316
|
-
}
|
|
31317
|
-
mask[0] = randomPool[randomPoolPointer++];
|
|
31318
|
-
mask[1] = randomPool[randomPoolPointer++];
|
|
31319
|
-
mask[2] = randomPool[randomPoolPointer++];
|
|
31320
|
-
mask[3] = randomPool[randomPoolPointer++];
|
|
31321
|
-
}
|
|
31322
|
-
skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;
|
|
31323
|
-
offset = 6;
|
|
31324
|
-
}
|
|
31325
|
-
let dataLength;
|
|
31326
|
-
if (typeof data === "string") {
|
|
31327
|
-
if ((!options.mask || skipMasking) && options[kByteLength] !== undefined) {
|
|
31328
|
-
dataLength = options[kByteLength];
|
|
31329
|
-
} else {
|
|
31330
|
-
data = Buffer.from(data);
|
|
31331
|
-
dataLength = data.length;
|
|
31332
|
-
}
|
|
31333
|
-
} else {
|
|
31334
|
-
dataLength = data.length;
|
|
31335
|
-
merge2 = options.mask && options.readOnly && !skipMasking;
|
|
31336
|
-
}
|
|
31337
|
-
let payloadLength = dataLength;
|
|
31338
|
-
if (dataLength >= 65536) {
|
|
31339
|
-
offset += 8;
|
|
31340
|
-
payloadLength = 127;
|
|
31341
|
-
} else if (dataLength > 125) {
|
|
31342
|
-
offset += 2;
|
|
31343
|
-
payloadLength = 126;
|
|
31344
|
-
}
|
|
31345
|
-
const target = Buffer.allocUnsafe(merge2 ? dataLength + offset : offset);
|
|
31346
|
-
target[0] = options.fin ? options.opcode | 128 : options.opcode;
|
|
31347
|
-
if (options.rsv1)
|
|
31348
|
-
target[0] |= 64;
|
|
31349
|
-
target[1] = payloadLength;
|
|
31350
|
-
if (payloadLength === 126) {
|
|
31351
|
-
target.writeUInt16BE(dataLength, 2);
|
|
31352
|
-
} else if (payloadLength === 127) {
|
|
31353
|
-
target[2] = target[3] = 0;
|
|
31354
|
-
target.writeUIntBE(dataLength, 4, 6);
|
|
31355
|
-
}
|
|
31356
|
-
if (!options.mask)
|
|
31357
|
-
return [target, data];
|
|
31358
|
-
target[1] |= 128;
|
|
31359
|
-
target[offset - 4] = mask[0];
|
|
31360
|
-
target[offset - 3] = mask[1];
|
|
31361
|
-
target[offset - 2] = mask[2];
|
|
31362
|
-
target[offset - 1] = mask[3];
|
|
31363
|
-
if (skipMasking)
|
|
31364
|
-
return [target, data];
|
|
31365
|
-
if (merge2) {
|
|
31366
|
-
applyMask(data, mask, target, offset, dataLength);
|
|
31367
|
-
return [target];
|
|
31368
|
-
}
|
|
31369
|
-
applyMask(data, mask, data, 0, dataLength);
|
|
31370
|
-
return [target, data];
|
|
31371
|
-
}
|
|
31372
|
-
close(code, data, mask, cb) {
|
|
31373
|
-
let buf;
|
|
31374
|
-
if (code === undefined) {
|
|
31375
|
-
buf = EMPTY_BUFFER;
|
|
31376
|
-
} else if (typeof code !== "number" || !isValidStatusCode(code)) {
|
|
31377
|
-
throw new TypeError("First argument must be a valid error code number");
|
|
31378
|
-
} else if (data === undefined || !data.length) {
|
|
31379
|
-
buf = Buffer.allocUnsafe(2);
|
|
31380
|
-
buf.writeUInt16BE(code, 0);
|
|
31381
|
-
} else {
|
|
31382
|
-
const length = Buffer.byteLength(data);
|
|
31383
|
-
if (length > 123) {
|
|
31384
|
-
throw new RangeError("The message must not be greater than 123 bytes");
|
|
31385
|
-
}
|
|
31386
|
-
buf = Buffer.allocUnsafe(2 + length);
|
|
31387
|
-
buf.writeUInt16BE(code, 0);
|
|
31388
|
-
if (typeof data === "string") {
|
|
31389
|
-
buf.write(data, 2);
|
|
31390
|
-
} else {
|
|
31391
|
-
buf.set(data, 2);
|
|
31392
|
-
}
|
|
31393
|
-
}
|
|
31394
|
-
const options = {
|
|
31395
|
-
[kByteLength]: buf.length,
|
|
31396
|
-
fin: true,
|
|
31397
|
-
generateMask: this._generateMask,
|
|
31398
|
-
mask,
|
|
31399
|
-
maskBuffer: this._maskBuffer,
|
|
31400
|
-
opcode: 8,
|
|
31401
|
-
readOnly: false,
|
|
31402
|
-
rsv1: false
|
|
31403
|
-
};
|
|
31404
|
-
if (this._state !== DEFAULT) {
|
|
31405
|
-
this.enqueue([this.dispatch, buf, false, options, cb]);
|
|
31406
|
-
} else {
|
|
31407
|
-
this.sendFrame(Sender.frame(buf, options), cb);
|
|
31408
|
-
}
|
|
31409
|
-
}
|
|
31410
|
-
ping(data, mask, cb) {
|
|
31411
|
-
let byteLength;
|
|
31412
|
-
let readOnly;
|
|
31413
|
-
if (typeof data === "string") {
|
|
31414
|
-
byteLength = Buffer.byteLength(data);
|
|
31415
|
-
readOnly = false;
|
|
31416
|
-
} else if (isBlob(data)) {
|
|
31417
|
-
byteLength = data.size;
|
|
31418
|
-
readOnly = false;
|
|
31419
|
-
} else {
|
|
31420
|
-
data = toBuffer(data);
|
|
31421
|
-
byteLength = data.length;
|
|
31422
|
-
readOnly = toBuffer.readOnly;
|
|
31423
|
-
}
|
|
31424
|
-
if (byteLength > 125) {
|
|
31425
|
-
throw new RangeError("The data size must not be greater than 125 bytes");
|
|
31426
|
-
}
|
|
31427
|
-
const options = {
|
|
31428
|
-
[kByteLength]: byteLength,
|
|
31429
|
-
fin: true,
|
|
31430
|
-
generateMask: this._generateMask,
|
|
31431
|
-
mask,
|
|
31432
|
-
maskBuffer: this._maskBuffer,
|
|
31433
|
-
opcode: 9,
|
|
31434
|
-
readOnly,
|
|
31435
|
-
rsv1: false
|
|
31436
|
-
};
|
|
31437
|
-
if (isBlob(data)) {
|
|
31438
|
-
if (this._state !== DEFAULT) {
|
|
31439
|
-
this.enqueue([this.getBlobData, data, false, options, cb]);
|
|
31440
|
-
} else {
|
|
31441
|
-
this.getBlobData(data, false, options, cb);
|
|
31442
|
-
}
|
|
31443
|
-
} else if (this._state !== DEFAULT) {
|
|
31444
|
-
this.enqueue([this.dispatch, data, false, options, cb]);
|
|
31445
|
-
} else {
|
|
31446
|
-
this.sendFrame(Sender.frame(data, options), cb);
|
|
31447
|
-
}
|
|
31448
|
-
}
|
|
31449
|
-
pong(data, mask, cb) {
|
|
31450
|
-
let byteLength;
|
|
31451
|
-
let readOnly;
|
|
31452
|
-
if (typeof data === "string") {
|
|
31453
|
-
byteLength = Buffer.byteLength(data);
|
|
31454
|
-
readOnly = false;
|
|
31455
|
-
} else if (isBlob(data)) {
|
|
31456
|
-
byteLength = data.size;
|
|
31457
|
-
readOnly = false;
|
|
31458
|
-
} else {
|
|
31459
|
-
data = toBuffer(data);
|
|
31460
|
-
byteLength = data.length;
|
|
31461
|
-
readOnly = toBuffer.readOnly;
|
|
31462
|
-
}
|
|
31463
|
-
if (byteLength > 125) {
|
|
31464
|
-
throw new RangeError("The data size must not be greater than 125 bytes");
|
|
31465
|
-
}
|
|
31466
|
-
const options = {
|
|
31467
|
-
[kByteLength]: byteLength,
|
|
31468
|
-
fin: true,
|
|
31469
|
-
generateMask: this._generateMask,
|
|
31470
|
-
mask,
|
|
31471
|
-
maskBuffer: this._maskBuffer,
|
|
31472
|
-
opcode: 10,
|
|
31473
|
-
readOnly,
|
|
31474
|
-
rsv1: false
|
|
31475
|
-
};
|
|
31476
|
-
if (isBlob(data)) {
|
|
31477
|
-
if (this._state !== DEFAULT) {
|
|
31478
|
-
this.enqueue([this.getBlobData, data, false, options, cb]);
|
|
31479
|
-
} else {
|
|
31480
|
-
this.getBlobData(data, false, options, cb);
|
|
31481
|
-
}
|
|
31482
|
-
} else if (this._state !== DEFAULT) {
|
|
31483
|
-
this.enqueue([this.dispatch, data, false, options, cb]);
|
|
31484
|
-
} else {
|
|
31485
|
-
this.sendFrame(Sender.frame(data, options), cb);
|
|
31486
|
-
}
|
|
31487
|
-
}
|
|
31488
|
-
send(data, options, cb) {
|
|
31489
|
-
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
31490
|
-
let opcode = options.binary ? 2 : 1;
|
|
31491
|
-
let rsv1 = options.compress;
|
|
31492
|
-
let byteLength;
|
|
31493
|
-
let readOnly;
|
|
31494
|
-
if (typeof data === "string") {
|
|
31495
|
-
byteLength = Buffer.byteLength(data);
|
|
31496
|
-
readOnly = false;
|
|
31497
|
-
} else if (isBlob(data)) {
|
|
31498
|
-
byteLength = data.size;
|
|
31499
|
-
readOnly = false;
|
|
31500
|
-
} else {
|
|
31501
|
-
data = toBuffer(data);
|
|
31502
|
-
byteLength = data.length;
|
|
31503
|
-
readOnly = toBuffer.readOnly;
|
|
31504
|
-
}
|
|
31505
|
-
if (this._firstFragment) {
|
|
31506
|
-
this._firstFragment = false;
|
|
31507
|
-
if (rsv1 && perMessageDeflate && perMessageDeflate.params[perMessageDeflate._isServer ? "server_no_context_takeover" : "client_no_context_takeover"]) {
|
|
31508
|
-
rsv1 = byteLength >= perMessageDeflate._threshold;
|
|
31509
|
-
}
|
|
31510
|
-
this._compress = rsv1;
|
|
31511
|
-
} else {
|
|
31512
|
-
rsv1 = false;
|
|
31513
|
-
opcode = 0;
|
|
31514
|
-
}
|
|
31515
|
-
if (options.fin)
|
|
31516
|
-
this._firstFragment = true;
|
|
31517
|
-
const opts = {
|
|
31518
|
-
[kByteLength]: byteLength,
|
|
31519
|
-
fin: options.fin,
|
|
31520
|
-
generateMask: this._generateMask,
|
|
31521
|
-
mask: options.mask,
|
|
31522
|
-
maskBuffer: this._maskBuffer,
|
|
31523
|
-
opcode,
|
|
31524
|
-
readOnly,
|
|
31525
|
-
rsv1
|
|
31526
|
-
};
|
|
31527
|
-
if (isBlob(data)) {
|
|
31528
|
-
if (this._state !== DEFAULT) {
|
|
31529
|
-
this.enqueue([this.getBlobData, data, this._compress, opts, cb]);
|
|
31530
|
-
} else {
|
|
31531
|
-
this.getBlobData(data, this._compress, opts, cb);
|
|
31532
|
-
}
|
|
31533
|
-
} else if (this._state !== DEFAULT) {
|
|
31534
|
-
this.enqueue([this.dispatch, data, this._compress, opts, cb]);
|
|
31535
|
-
} else {
|
|
31536
|
-
this.dispatch(data, this._compress, opts, cb);
|
|
31537
|
-
}
|
|
31538
|
-
}
|
|
31539
|
-
getBlobData(blob, compress, options, cb) {
|
|
31540
|
-
this._bufferedBytes += options[kByteLength];
|
|
31541
|
-
this._state = GET_BLOB_DATA;
|
|
31542
|
-
blob.arrayBuffer().then((arrayBuffer) => {
|
|
31543
|
-
if (this._socket.destroyed) {
|
|
31544
|
-
const err = new Error("The socket was closed while the blob was being read");
|
|
31545
|
-
process.nextTick(callCallbacks, this, err, cb);
|
|
31546
|
-
return;
|
|
31547
|
-
}
|
|
31548
|
-
this._bufferedBytes -= options[kByteLength];
|
|
31549
|
-
const data = toBuffer(arrayBuffer);
|
|
31550
|
-
if (!compress) {
|
|
31551
|
-
this._state = DEFAULT;
|
|
31552
|
-
this.sendFrame(Sender.frame(data, options), cb);
|
|
31553
|
-
this.dequeue();
|
|
31554
|
-
} else {
|
|
31555
|
-
this.dispatch(data, compress, options, cb);
|
|
31556
|
-
}
|
|
31557
|
-
}).catch((err) => {
|
|
31558
|
-
process.nextTick(onError, this, err, cb);
|
|
31559
|
-
});
|
|
31560
|
-
}
|
|
31561
|
-
dispatch(data, compress, options, cb) {
|
|
31562
|
-
if (!compress) {
|
|
31563
|
-
this.sendFrame(Sender.frame(data, options), cb);
|
|
31564
|
-
return;
|
|
31565
|
-
}
|
|
31566
|
-
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
31567
|
-
this._bufferedBytes += options[kByteLength];
|
|
31568
|
-
this._state = DEFLATING;
|
|
31569
|
-
perMessageDeflate.compress(data, options.fin, (_, buf) => {
|
|
31570
|
-
if (this._socket.destroyed) {
|
|
31571
|
-
const err = new Error("The socket was closed while data was being compressed");
|
|
31572
|
-
callCallbacks(this, err, cb);
|
|
31573
|
-
return;
|
|
31574
|
-
}
|
|
31575
|
-
this._bufferedBytes -= options[kByteLength];
|
|
31576
|
-
this._state = DEFAULT;
|
|
31577
|
-
options.readOnly = false;
|
|
31578
|
-
this.sendFrame(Sender.frame(buf, options), cb);
|
|
31579
|
-
this.dequeue();
|
|
31580
|
-
});
|
|
31581
|
-
}
|
|
31582
|
-
dequeue() {
|
|
31583
|
-
while (this._state === DEFAULT && this._queue.length) {
|
|
31584
|
-
const params = this._queue.shift();
|
|
31585
|
-
this._bufferedBytes -= params[3][kByteLength];
|
|
31586
|
-
Reflect.apply(params[0], this, params.slice(1));
|
|
31587
|
-
}
|
|
31588
|
-
}
|
|
31589
|
-
enqueue(params) {
|
|
31590
|
-
this._bufferedBytes += params[3][kByteLength];
|
|
31591
|
-
this._queue.push(params);
|
|
31592
|
-
}
|
|
31593
|
-
sendFrame(list, cb) {
|
|
31594
|
-
if (list.length === 2) {
|
|
31595
|
-
this._socket.cork();
|
|
31596
|
-
this._socket.write(list[0]);
|
|
31597
|
-
this._socket.write(list[1], cb);
|
|
31598
|
-
this._socket.uncork();
|
|
31599
|
-
} else {
|
|
31600
|
-
this._socket.write(list[0], cb);
|
|
31601
|
-
}
|
|
31602
|
-
}
|
|
31603
|
-
}
|
|
31604
|
-
module.exports = Sender;
|
|
31605
|
-
function callCallbacks(sender, err, cb) {
|
|
31606
|
-
if (typeof cb === "function")
|
|
31607
|
-
cb(err);
|
|
31608
|
-
for (let i2 = 0;i2 < sender._queue.length; i2++) {
|
|
31609
|
-
const params = sender._queue[i2];
|
|
31610
|
-
const callback = params[params.length - 1];
|
|
31611
|
-
if (typeof callback === "function")
|
|
31612
|
-
callback(err);
|
|
31613
|
-
}
|
|
31614
|
-
}
|
|
31615
|
-
function onError(sender, err, cb) {
|
|
31616
|
-
callCallbacks(sender, err, cb);
|
|
31617
|
-
sender.onerror(err);
|
|
31618
|
-
}
|
|
31619
|
-
});
|
|
31620
|
-
|
|
31621
|
-
// node_modules/ink/node_modules/ws/lib/event-target.js
|
|
31622
|
-
var require_event_target2 = __commonJS((exports, module) => {
|
|
31623
|
-
var { kForOnEventAttribute, kListener } = require_constants6();
|
|
31624
|
-
var kCode = Symbol("kCode");
|
|
31625
|
-
var kData = Symbol("kData");
|
|
31626
|
-
var kError = Symbol("kError");
|
|
31627
|
-
var kMessage = Symbol("kMessage");
|
|
31628
|
-
var kReason = Symbol("kReason");
|
|
31629
|
-
var kTarget = Symbol("kTarget");
|
|
31630
|
-
var kType = Symbol("kType");
|
|
31631
|
-
var kWasClean = Symbol("kWasClean");
|
|
31632
|
-
|
|
31633
|
-
class Event {
|
|
31634
|
-
constructor(type2) {
|
|
31635
|
-
this[kTarget] = null;
|
|
31636
|
-
this[kType] = type2;
|
|
31637
|
-
}
|
|
31638
|
-
get target() {
|
|
31639
|
-
return this[kTarget];
|
|
31640
|
-
}
|
|
31641
|
-
get type() {
|
|
31642
|
-
return this[kType];
|
|
31643
|
-
}
|
|
31644
|
-
}
|
|
31645
|
-
Object.defineProperty(Event.prototype, "target", { enumerable: true });
|
|
31646
|
-
Object.defineProperty(Event.prototype, "type", { enumerable: true });
|
|
31647
|
-
|
|
31648
|
-
class CloseEvent extends Event {
|
|
31649
|
-
constructor(type2, options = {}) {
|
|
31650
|
-
super(type2);
|
|
31651
|
-
this[kCode] = options.code === undefined ? 0 : options.code;
|
|
31652
|
-
this[kReason] = options.reason === undefined ? "" : options.reason;
|
|
31653
|
-
this[kWasClean] = options.wasClean === undefined ? false : options.wasClean;
|
|
31654
|
-
}
|
|
31655
|
-
get code() {
|
|
31656
|
-
return this[kCode];
|
|
31657
|
-
}
|
|
31658
|
-
get reason() {
|
|
31659
|
-
return this[kReason];
|
|
31660
|
-
}
|
|
31661
|
-
get wasClean() {
|
|
31662
|
-
return this[kWasClean];
|
|
31663
|
-
}
|
|
31664
|
-
}
|
|
31665
|
-
Object.defineProperty(CloseEvent.prototype, "code", { enumerable: true });
|
|
31666
|
-
Object.defineProperty(CloseEvent.prototype, "reason", { enumerable: true });
|
|
31667
|
-
Object.defineProperty(CloseEvent.prototype, "wasClean", { enumerable: true });
|
|
31668
|
-
|
|
31669
|
-
class ErrorEvent extends Event {
|
|
31670
|
-
constructor(type2, options = {}) {
|
|
31671
|
-
super(type2);
|
|
31672
|
-
this[kError] = options.error === undefined ? null : options.error;
|
|
31673
|
-
this[kMessage] = options.message === undefined ? "" : options.message;
|
|
31674
|
-
}
|
|
31675
|
-
get error() {
|
|
31676
|
-
return this[kError];
|
|
31677
|
-
}
|
|
31678
|
-
get message() {
|
|
31679
|
-
return this[kMessage];
|
|
31680
|
-
}
|
|
31681
|
-
}
|
|
31682
|
-
Object.defineProperty(ErrorEvent.prototype, "error", { enumerable: true });
|
|
31683
|
-
Object.defineProperty(ErrorEvent.prototype, "message", { enumerable: true });
|
|
31684
|
-
|
|
31685
|
-
class MessageEvent extends Event {
|
|
31686
|
-
constructor(type2, options = {}) {
|
|
31687
|
-
super(type2);
|
|
31688
|
-
this[kData] = options.data === undefined ? null : options.data;
|
|
31689
|
-
}
|
|
31690
|
-
get data() {
|
|
31691
|
-
return this[kData];
|
|
31692
|
-
}
|
|
31693
|
-
}
|
|
31694
|
-
Object.defineProperty(MessageEvent.prototype, "data", { enumerable: true });
|
|
31695
|
-
var EventTarget = {
|
|
31696
|
-
addEventListener(type2, handler2, options = {}) {
|
|
31697
|
-
for (const listener of this.listeners(type2)) {
|
|
31698
|
-
if (!options[kForOnEventAttribute] && listener[kListener] === handler2 && !listener[kForOnEventAttribute]) {
|
|
31699
|
-
return;
|
|
31700
|
-
}
|
|
31701
|
-
}
|
|
31702
|
-
let wrapper;
|
|
31703
|
-
if (type2 === "message") {
|
|
31704
|
-
wrapper = function onMessage(data, isBinary2) {
|
|
31705
|
-
const event = new MessageEvent("message", {
|
|
31706
|
-
data: isBinary2 ? data : data.toString()
|
|
31707
|
-
});
|
|
31708
|
-
event[kTarget] = this;
|
|
31709
|
-
callListener(handler2, this, event);
|
|
31710
|
-
};
|
|
31711
|
-
} else if (type2 === "close") {
|
|
31712
|
-
wrapper = function onClose(code, message) {
|
|
31713
|
-
const event = new CloseEvent("close", {
|
|
31714
|
-
code,
|
|
31715
|
-
reason: message.toString(),
|
|
31716
|
-
wasClean: this._closeFrameReceived && this._closeFrameSent
|
|
31717
|
-
});
|
|
31718
|
-
event[kTarget] = this;
|
|
31719
|
-
callListener(handler2, this, event);
|
|
31720
|
-
};
|
|
31721
|
-
} else if (type2 === "error") {
|
|
31722
|
-
wrapper = function onError(error) {
|
|
31723
|
-
const event = new ErrorEvent("error", {
|
|
31724
|
-
error,
|
|
31725
|
-
message: error.message
|
|
31726
|
-
});
|
|
31727
|
-
event[kTarget] = this;
|
|
31728
|
-
callListener(handler2, this, event);
|
|
31729
|
-
};
|
|
31730
|
-
} else if (type2 === "open") {
|
|
31731
|
-
wrapper = function onOpen() {
|
|
31732
|
-
const event = new Event("open");
|
|
31733
|
-
event[kTarget] = this;
|
|
31734
|
-
callListener(handler2, this, event);
|
|
31735
|
-
};
|
|
31736
|
-
} else {
|
|
31737
|
-
return;
|
|
31738
|
-
}
|
|
31739
|
-
wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
|
|
31740
|
-
wrapper[kListener] = handler2;
|
|
31741
|
-
if (options.once) {
|
|
31742
|
-
this.once(type2, wrapper);
|
|
31743
|
-
} else {
|
|
31744
|
-
this.on(type2, wrapper);
|
|
31745
|
-
}
|
|
31746
|
-
},
|
|
31747
|
-
removeEventListener(type2, handler2) {
|
|
31748
|
-
for (const listener of this.listeners(type2)) {
|
|
31749
|
-
if (listener[kListener] === handler2 && !listener[kForOnEventAttribute]) {
|
|
31750
|
-
this.removeListener(type2, listener);
|
|
31751
|
-
break;
|
|
31752
|
-
}
|
|
31753
|
-
}
|
|
31754
|
-
}
|
|
31755
|
-
};
|
|
31756
|
-
module.exports = {
|
|
31757
|
-
CloseEvent,
|
|
31758
|
-
ErrorEvent,
|
|
31759
|
-
Event,
|
|
31760
|
-
EventTarget,
|
|
31761
|
-
MessageEvent
|
|
31762
|
-
};
|
|
31763
|
-
function callListener(listener, thisArg, event) {
|
|
31764
|
-
if (typeof listener === "object" && listener.handleEvent) {
|
|
31765
|
-
listener.handleEvent.call(listener, event);
|
|
31766
|
-
} else {
|
|
31767
|
-
listener.call(thisArg, event);
|
|
31768
|
-
}
|
|
31769
|
-
}
|
|
31770
|
-
});
|
|
31771
|
-
|
|
31772
|
-
// node_modules/ink/node_modules/ws/lib/extension.js
|
|
31773
|
-
var require_extension2 = __commonJS((exports, module) => {
|
|
31774
|
-
var { tokenChars } = require_validation2();
|
|
31775
|
-
function push(dest, name, elem) {
|
|
31776
|
-
if (dest[name] === undefined)
|
|
31777
|
-
dest[name] = [elem];
|
|
31778
|
-
else
|
|
31779
|
-
dest[name].push(elem);
|
|
31780
|
-
}
|
|
31781
|
-
function parse(header) {
|
|
31782
|
-
const offers = Object.create(null);
|
|
31783
|
-
let params = Object.create(null);
|
|
31784
|
-
let mustUnescape = false;
|
|
31785
|
-
let isEscaping = false;
|
|
31786
|
-
let inQuotes = false;
|
|
31787
|
-
let extensionName;
|
|
31788
|
-
let paramName;
|
|
31789
|
-
let start = -1;
|
|
31790
|
-
let code = -1;
|
|
31791
|
-
let end = -1;
|
|
31792
|
-
let i2 = 0;
|
|
31793
|
-
for (;i2 < header.length; i2++) {
|
|
31794
|
-
code = header.charCodeAt(i2);
|
|
31795
|
-
if (extensionName === undefined) {
|
|
31796
|
-
if (end === -1 && tokenChars[code] === 1) {
|
|
31797
|
-
if (start === -1)
|
|
31798
|
-
start = i2;
|
|
31799
|
-
} else if (i2 !== 0 && (code === 32 || code === 9)) {
|
|
31800
|
-
if (end === -1 && start !== -1)
|
|
31801
|
-
end = i2;
|
|
31802
|
-
} else if (code === 59 || code === 44) {
|
|
31803
|
-
if (start === -1) {
|
|
31804
|
-
throw new SyntaxError(`Unexpected character at index ${i2}`);
|
|
31805
|
-
}
|
|
31806
|
-
if (end === -1)
|
|
31807
|
-
end = i2;
|
|
31808
|
-
const name = header.slice(start, end);
|
|
31809
|
-
if (code === 44) {
|
|
31810
|
-
push(offers, name, params);
|
|
31811
|
-
params = Object.create(null);
|
|
31812
|
-
} else {
|
|
31813
|
-
extensionName = name;
|
|
31814
|
-
}
|
|
31815
|
-
start = end = -1;
|
|
31816
|
-
} else {
|
|
31817
|
-
throw new SyntaxError(`Unexpected character at index ${i2}`);
|
|
31818
|
-
}
|
|
31819
|
-
} else if (paramName === undefined) {
|
|
31820
|
-
if (end === -1 && tokenChars[code] === 1) {
|
|
31821
|
-
if (start === -1)
|
|
31822
|
-
start = i2;
|
|
31823
|
-
} else if (code === 32 || code === 9) {
|
|
31824
|
-
if (end === -1 && start !== -1)
|
|
31825
|
-
end = i2;
|
|
31826
|
-
} else if (code === 59 || code === 44) {
|
|
31827
|
-
if (start === -1) {
|
|
31828
|
-
throw new SyntaxError(`Unexpected character at index ${i2}`);
|
|
31829
|
-
}
|
|
31830
|
-
if (end === -1)
|
|
31831
|
-
end = i2;
|
|
31832
|
-
push(params, header.slice(start, end), true);
|
|
31833
|
-
if (code === 44) {
|
|
31834
|
-
push(offers, extensionName, params);
|
|
31835
|
-
params = Object.create(null);
|
|
31836
|
-
extensionName = undefined;
|
|
31837
|
-
}
|
|
31838
|
-
start = end = -1;
|
|
31839
|
-
} else if (code === 61 && start !== -1 && end === -1) {
|
|
31840
|
-
paramName = header.slice(start, i2);
|
|
31841
|
-
start = end = -1;
|
|
31842
|
-
} else {
|
|
31843
|
-
throw new SyntaxError(`Unexpected character at index ${i2}`);
|
|
31844
|
-
}
|
|
31845
|
-
} else {
|
|
31846
|
-
if (isEscaping) {
|
|
31847
|
-
if (tokenChars[code] !== 1) {
|
|
31848
|
-
throw new SyntaxError(`Unexpected character at index ${i2}`);
|
|
31849
|
-
}
|
|
31850
|
-
if (start === -1)
|
|
31851
|
-
start = i2;
|
|
31852
|
-
else if (!mustUnescape)
|
|
31853
|
-
mustUnescape = true;
|
|
31854
|
-
isEscaping = false;
|
|
31855
|
-
} else if (inQuotes) {
|
|
31856
|
-
if (tokenChars[code] === 1) {
|
|
31857
|
-
if (start === -1)
|
|
31858
|
-
start = i2;
|
|
31859
|
-
} else if (code === 34 && start !== -1) {
|
|
31860
|
-
inQuotes = false;
|
|
31861
|
-
end = i2;
|
|
31862
|
-
} else if (code === 92) {
|
|
31863
|
-
isEscaping = true;
|
|
31864
|
-
} else {
|
|
31865
|
-
throw new SyntaxError(`Unexpected character at index ${i2}`);
|
|
31866
|
-
}
|
|
31867
|
-
} else if (code === 34 && header.charCodeAt(i2 - 1) === 61) {
|
|
31868
|
-
inQuotes = true;
|
|
31869
|
-
} else if (end === -1 && tokenChars[code] === 1) {
|
|
31870
|
-
if (start === -1)
|
|
31871
|
-
start = i2;
|
|
31872
|
-
} else if (start !== -1 && (code === 32 || code === 9)) {
|
|
31873
|
-
if (end === -1)
|
|
31874
|
-
end = i2;
|
|
31875
|
-
} else if (code === 59 || code === 44) {
|
|
31876
|
-
if (start === -1) {
|
|
31877
|
-
throw new SyntaxError(`Unexpected character at index ${i2}`);
|
|
31878
|
-
}
|
|
31879
|
-
if (end === -1)
|
|
31880
|
-
end = i2;
|
|
31881
|
-
let value = header.slice(start, end);
|
|
31882
|
-
if (mustUnescape) {
|
|
31883
|
-
value = value.replace(/\\/g, "");
|
|
31884
|
-
mustUnescape = false;
|
|
31885
|
-
}
|
|
31886
|
-
push(params, paramName, value);
|
|
31887
|
-
if (code === 44) {
|
|
31888
|
-
push(offers, extensionName, params);
|
|
31889
|
-
params = Object.create(null);
|
|
31890
|
-
extensionName = undefined;
|
|
31891
|
-
}
|
|
31892
|
-
paramName = undefined;
|
|
31893
|
-
start = end = -1;
|
|
31894
|
-
} else {
|
|
31895
|
-
throw new SyntaxError(`Unexpected character at index ${i2}`);
|
|
31896
|
-
}
|
|
31897
|
-
}
|
|
31898
|
-
}
|
|
31899
|
-
if (start === -1 || inQuotes || code === 32 || code === 9) {
|
|
31900
|
-
throw new SyntaxError("Unexpected end of input");
|
|
31901
|
-
}
|
|
31902
|
-
if (end === -1)
|
|
31903
|
-
end = i2;
|
|
31904
|
-
const token = header.slice(start, end);
|
|
31905
|
-
if (extensionName === undefined) {
|
|
31906
|
-
push(offers, token, params);
|
|
31907
|
-
} else {
|
|
31908
|
-
if (paramName === undefined) {
|
|
31909
|
-
push(params, token, true);
|
|
31910
|
-
} else if (mustUnescape) {
|
|
31911
|
-
push(params, paramName, token.replace(/\\/g, ""));
|
|
31912
|
-
} else {
|
|
31913
|
-
push(params, paramName, token);
|
|
31914
|
-
}
|
|
31915
|
-
push(offers, extensionName, params);
|
|
31916
|
-
}
|
|
31917
|
-
return offers;
|
|
31918
|
-
}
|
|
31919
|
-
function format2(extensions) {
|
|
31920
|
-
return Object.keys(extensions).map((extension) => {
|
|
31921
|
-
let configurations = extensions[extension];
|
|
31922
|
-
if (!Array.isArray(configurations))
|
|
31923
|
-
configurations = [configurations];
|
|
31924
|
-
return configurations.map((params) => {
|
|
31925
|
-
return [extension].concat(Object.keys(params).map((k) => {
|
|
31926
|
-
let values = params[k];
|
|
31927
|
-
if (!Array.isArray(values))
|
|
31928
|
-
values = [values];
|
|
31929
|
-
return values.map((v) => v === true ? k : `${k}=${v}`).join("; ");
|
|
31930
|
-
})).join("; ");
|
|
31931
|
-
}).join(", ");
|
|
31932
|
-
}).join(", ");
|
|
31933
|
-
}
|
|
31934
|
-
module.exports = { format: format2, parse };
|
|
31935
|
-
});
|
|
31936
|
-
|
|
31937
|
-
// node_modules/ink/node_modules/ws/lib/websocket.js
|
|
31938
|
-
var require_websocket2 = __commonJS((exports, module) => {
|
|
31939
|
-
var EventEmitter5 = __require("events");
|
|
31940
|
-
var https = __require("https");
|
|
31941
|
-
var http = __require("http");
|
|
31942
|
-
var net = __require("net");
|
|
31943
|
-
var tls = __require("tls");
|
|
31944
|
-
var { randomBytes, createHash } = __require("crypto");
|
|
31945
|
-
var { Duplex, Readable } = __require("stream");
|
|
31946
|
-
var { URL: URL2 } = __require("url");
|
|
31947
|
-
var PerMessageDeflate = require_permessage_deflate2();
|
|
31948
|
-
var Receiver = require_receiver2();
|
|
31949
|
-
var Sender = require_sender2();
|
|
31950
|
-
var { isBlob } = require_validation2();
|
|
31951
|
-
var {
|
|
31952
|
-
BINARY_TYPES,
|
|
31953
|
-
EMPTY_BUFFER,
|
|
31954
|
-
GUID,
|
|
31955
|
-
kForOnEventAttribute,
|
|
31956
|
-
kListener,
|
|
31957
|
-
kStatusCode,
|
|
31958
|
-
kWebSocket,
|
|
31959
|
-
NOOP
|
|
31960
|
-
} = require_constants6();
|
|
31961
|
-
var {
|
|
31962
|
-
EventTarget: { addEventListener, removeEventListener }
|
|
31963
|
-
} = require_event_target2();
|
|
31964
|
-
var { format: format2, parse } = require_extension2();
|
|
31965
|
-
var { toBuffer } = require_buffer_util2();
|
|
31966
|
-
var closeTimeout = 30 * 1000;
|
|
31967
|
-
var kAborted = Symbol("kAborted");
|
|
31968
|
-
var protocolVersions = [8, 13];
|
|
31969
|
-
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
|
31970
|
-
var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
31971
|
-
|
|
31972
|
-
class WebSocket extends EventEmitter5 {
|
|
31973
|
-
constructor(address, protocols, options) {
|
|
31974
|
-
super();
|
|
31975
|
-
this._binaryType = BINARY_TYPES[0];
|
|
31976
|
-
this._closeCode = 1006;
|
|
31977
|
-
this._closeFrameReceived = false;
|
|
31978
|
-
this._closeFrameSent = false;
|
|
31979
|
-
this._closeMessage = EMPTY_BUFFER;
|
|
31980
|
-
this._closeTimer = null;
|
|
31981
|
-
this._errorEmitted = false;
|
|
31982
|
-
this._extensions = {};
|
|
31983
|
-
this._paused = false;
|
|
31984
|
-
this._protocol = "";
|
|
31985
|
-
this._readyState = WebSocket.CONNECTING;
|
|
31986
|
-
this._receiver = null;
|
|
31987
|
-
this._sender = null;
|
|
31988
|
-
this._socket = null;
|
|
31989
|
-
if (address !== null) {
|
|
31990
|
-
this._bufferedAmount = 0;
|
|
31991
|
-
this._isServer = false;
|
|
31992
|
-
this._redirects = 0;
|
|
31993
|
-
if (protocols === undefined) {
|
|
31994
|
-
protocols = [];
|
|
31995
|
-
} else if (!Array.isArray(protocols)) {
|
|
31996
|
-
if (typeof protocols === "object" && protocols !== null) {
|
|
31997
|
-
options = protocols;
|
|
31998
|
-
protocols = [];
|
|
31999
|
-
} else {
|
|
32000
|
-
protocols = [protocols];
|
|
32001
|
-
}
|
|
32002
|
-
}
|
|
32003
|
-
initAsClient(this, address, protocols, options);
|
|
32004
|
-
} else {
|
|
32005
|
-
this._autoPong = options.autoPong;
|
|
32006
|
-
this._isServer = true;
|
|
32007
|
-
}
|
|
32008
|
-
}
|
|
32009
|
-
get binaryType() {
|
|
32010
|
-
return this._binaryType;
|
|
32011
|
-
}
|
|
32012
|
-
set binaryType(type2) {
|
|
32013
|
-
if (!BINARY_TYPES.includes(type2))
|
|
32014
|
-
return;
|
|
32015
|
-
this._binaryType = type2;
|
|
32016
|
-
if (this._receiver)
|
|
32017
|
-
this._receiver._binaryType = type2;
|
|
32018
|
-
}
|
|
32019
|
-
get bufferedAmount() {
|
|
32020
|
-
if (!this._socket)
|
|
32021
|
-
return this._bufferedAmount;
|
|
32022
|
-
return this._socket._writableState.length + this._sender._bufferedBytes;
|
|
32023
|
-
}
|
|
32024
|
-
get extensions() {
|
|
32025
|
-
return Object.keys(this._extensions).join();
|
|
32026
|
-
}
|
|
32027
|
-
get isPaused() {
|
|
32028
|
-
return this._paused;
|
|
32029
|
-
}
|
|
32030
|
-
get onclose() {
|
|
32031
|
-
return null;
|
|
32032
|
-
}
|
|
32033
|
-
get onerror() {
|
|
32034
|
-
return null;
|
|
32035
|
-
}
|
|
32036
|
-
get onopen() {
|
|
32037
|
-
return null;
|
|
32038
|
-
}
|
|
32039
|
-
get onmessage() {
|
|
32040
|
-
return null;
|
|
32041
|
-
}
|
|
32042
|
-
get protocol() {
|
|
32043
|
-
return this._protocol;
|
|
32044
|
-
}
|
|
32045
|
-
get readyState() {
|
|
32046
|
-
return this._readyState;
|
|
32047
|
-
}
|
|
32048
|
-
get url() {
|
|
32049
|
-
return this._url;
|
|
32050
|
-
}
|
|
32051
|
-
setSocket(socket, head, options) {
|
|
32052
|
-
const receiver = new Receiver({
|
|
32053
|
-
allowSynchronousEvents: options.allowSynchronousEvents,
|
|
32054
|
-
binaryType: this.binaryType,
|
|
32055
|
-
extensions: this._extensions,
|
|
32056
|
-
isServer: this._isServer,
|
|
32057
|
-
maxPayload: options.maxPayload,
|
|
32058
|
-
skipUTF8Validation: options.skipUTF8Validation
|
|
32059
|
-
});
|
|
32060
|
-
const sender = new Sender(socket, this._extensions, options.generateMask);
|
|
32061
|
-
this._receiver = receiver;
|
|
32062
|
-
this._sender = sender;
|
|
32063
|
-
this._socket = socket;
|
|
32064
|
-
receiver[kWebSocket] = this;
|
|
32065
|
-
sender[kWebSocket] = this;
|
|
32066
|
-
socket[kWebSocket] = this;
|
|
32067
|
-
receiver.on("conclude", receiverOnConclude);
|
|
32068
|
-
receiver.on("drain", receiverOnDrain);
|
|
32069
|
-
receiver.on("error", receiverOnError);
|
|
32070
|
-
receiver.on("message", receiverOnMessage);
|
|
32071
|
-
receiver.on("ping", receiverOnPing);
|
|
32072
|
-
receiver.on("pong", receiverOnPong);
|
|
32073
|
-
sender.onerror = senderOnError;
|
|
32074
|
-
if (socket.setTimeout)
|
|
32075
|
-
socket.setTimeout(0);
|
|
32076
|
-
if (socket.setNoDelay)
|
|
32077
|
-
socket.setNoDelay();
|
|
32078
|
-
if (head.length > 0)
|
|
32079
|
-
socket.unshift(head);
|
|
32080
|
-
socket.on("close", socketOnClose);
|
|
32081
|
-
socket.on("data", socketOnData);
|
|
32082
|
-
socket.on("end", socketOnEnd);
|
|
32083
|
-
socket.on("error", socketOnError);
|
|
32084
|
-
this._readyState = WebSocket.OPEN;
|
|
32085
|
-
this.emit("open");
|
|
32086
|
-
}
|
|
32087
|
-
emitClose() {
|
|
32088
|
-
if (!this._socket) {
|
|
32089
|
-
this._readyState = WebSocket.CLOSED;
|
|
32090
|
-
this.emit("close", this._closeCode, this._closeMessage);
|
|
32091
|
-
return;
|
|
32092
|
-
}
|
|
32093
|
-
if (this._extensions[PerMessageDeflate.extensionName]) {
|
|
32094
|
-
this._extensions[PerMessageDeflate.extensionName].cleanup();
|
|
32095
|
-
}
|
|
32096
|
-
this._receiver.removeAllListeners();
|
|
32097
|
-
this._readyState = WebSocket.CLOSED;
|
|
32098
|
-
this.emit("close", this._closeCode, this._closeMessage);
|
|
32099
|
-
}
|
|
32100
|
-
close(code, data) {
|
|
32101
|
-
if (this.readyState === WebSocket.CLOSED)
|
|
32102
|
-
return;
|
|
32103
|
-
if (this.readyState === WebSocket.CONNECTING) {
|
|
32104
|
-
const msg = "WebSocket was closed before the connection was established";
|
|
32105
|
-
abortHandshake(this, this._req, msg);
|
|
32106
|
-
return;
|
|
32107
|
-
}
|
|
32108
|
-
if (this.readyState === WebSocket.CLOSING) {
|
|
32109
|
-
if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) {
|
|
32110
|
-
this._socket.end();
|
|
32111
|
-
}
|
|
32112
|
-
return;
|
|
32113
|
-
}
|
|
32114
|
-
this._readyState = WebSocket.CLOSING;
|
|
32115
|
-
this._sender.close(code, data, !this._isServer, (err) => {
|
|
32116
|
-
if (err)
|
|
32117
|
-
return;
|
|
32118
|
-
this._closeFrameSent = true;
|
|
32119
|
-
if (this._closeFrameReceived || this._receiver._writableState.errorEmitted) {
|
|
32120
|
-
this._socket.end();
|
|
32121
|
-
}
|
|
32122
|
-
});
|
|
32123
|
-
setCloseTimer(this);
|
|
32124
|
-
}
|
|
32125
|
-
pause() {
|
|
32126
|
-
if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) {
|
|
32127
|
-
return;
|
|
32128
|
-
}
|
|
32129
|
-
this._paused = true;
|
|
32130
|
-
this._socket.pause();
|
|
32131
|
-
}
|
|
32132
|
-
ping(data, mask, cb) {
|
|
32133
|
-
if (this.readyState === WebSocket.CONNECTING) {
|
|
32134
|
-
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
32135
|
-
}
|
|
32136
|
-
if (typeof data === "function") {
|
|
32137
|
-
cb = data;
|
|
32138
|
-
data = mask = undefined;
|
|
32139
|
-
} else if (typeof mask === "function") {
|
|
32140
|
-
cb = mask;
|
|
32141
|
-
mask = undefined;
|
|
32142
|
-
}
|
|
32143
|
-
if (typeof data === "number")
|
|
32144
|
-
data = data.toString();
|
|
32145
|
-
if (this.readyState !== WebSocket.OPEN) {
|
|
32146
|
-
sendAfterClose(this, data, cb);
|
|
32147
|
-
return;
|
|
32148
|
-
}
|
|
32149
|
-
if (mask === undefined)
|
|
32150
|
-
mask = !this._isServer;
|
|
32151
|
-
this._sender.ping(data || EMPTY_BUFFER, mask, cb);
|
|
32152
|
-
}
|
|
32153
|
-
pong(data, mask, cb) {
|
|
32154
|
-
if (this.readyState === WebSocket.CONNECTING) {
|
|
32155
|
-
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
32156
|
-
}
|
|
32157
|
-
if (typeof data === "function") {
|
|
32158
|
-
cb = data;
|
|
32159
|
-
data = mask = undefined;
|
|
32160
|
-
} else if (typeof mask === "function") {
|
|
32161
|
-
cb = mask;
|
|
32162
|
-
mask = undefined;
|
|
32163
|
-
}
|
|
32164
|
-
if (typeof data === "number")
|
|
32165
|
-
data = data.toString();
|
|
32166
|
-
if (this.readyState !== WebSocket.OPEN) {
|
|
32167
|
-
sendAfterClose(this, data, cb);
|
|
32168
|
-
return;
|
|
32169
|
-
}
|
|
32170
|
-
if (mask === undefined)
|
|
32171
|
-
mask = !this._isServer;
|
|
32172
|
-
this._sender.pong(data || EMPTY_BUFFER, mask, cb);
|
|
32173
|
-
}
|
|
32174
|
-
resume() {
|
|
32175
|
-
if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) {
|
|
32176
|
-
return;
|
|
32177
|
-
}
|
|
32178
|
-
this._paused = false;
|
|
32179
|
-
if (!this._receiver._writableState.needDrain)
|
|
32180
|
-
this._socket.resume();
|
|
32181
|
-
}
|
|
32182
|
-
send(data, options, cb) {
|
|
32183
|
-
if (this.readyState === WebSocket.CONNECTING) {
|
|
32184
|
-
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
32185
|
-
}
|
|
32186
|
-
if (typeof options === "function") {
|
|
32187
|
-
cb = options;
|
|
32188
|
-
options = {};
|
|
32189
|
-
}
|
|
32190
|
-
if (typeof data === "number")
|
|
32191
|
-
data = data.toString();
|
|
32192
|
-
if (this.readyState !== WebSocket.OPEN) {
|
|
32193
|
-
sendAfterClose(this, data, cb);
|
|
32194
|
-
return;
|
|
32195
|
-
}
|
|
32196
|
-
const opts = {
|
|
32197
|
-
binary: typeof data !== "string",
|
|
32198
|
-
mask: !this._isServer,
|
|
32199
|
-
compress: true,
|
|
32200
|
-
fin: true,
|
|
32201
|
-
...options
|
|
32202
|
-
};
|
|
32203
|
-
if (!this._extensions[PerMessageDeflate.extensionName]) {
|
|
32204
|
-
opts.compress = false;
|
|
32205
|
-
}
|
|
32206
|
-
this._sender.send(data || EMPTY_BUFFER, opts, cb);
|
|
32207
|
-
}
|
|
32208
|
-
terminate() {
|
|
32209
|
-
if (this.readyState === WebSocket.CLOSED)
|
|
32210
|
-
return;
|
|
32211
|
-
if (this.readyState === WebSocket.CONNECTING) {
|
|
32212
|
-
const msg = "WebSocket was closed before the connection was established";
|
|
32213
|
-
abortHandshake(this, this._req, msg);
|
|
32214
|
-
return;
|
|
32215
|
-
}
|
|
32216
|
-
if (this._socket) {
|
|
32217
|
-
this._readyState = WebSocket.CLOSING;
|
|
32218
|
-
this._socket.destroy();
|
|
32219
|
-
}
|
|
32220
|
-
}
|
|
32221
|
-
}
|
|
32222
|
-
Object.defineProperty(WebSocket, "CONNECTING", {
|
|
32223
|
-
enumerable: true,
|
|
32224
|
-
value: readyStates.indexOf("CONNECTING")
|
|
32225
|
-
});
|
|
32226
|
-
Object.defineProperty(WebSocket.prototype, "CONNECTING", {
|
|
32227
|
-
enumerable: true,
|
|
32228
|
-
value: readyStates.indexOf("CONNECTING")
|
|
32229
|
-
});
|
|
32230
|
-
Object.defineProperty(WebSocket, "OPEN", {
|
|
32231
|
-
enumerable: true,
|
|
32232
|
-
value: readyStates.indexOf("OPEN")
|
|
32233
|
-
});
|
|
32234
|
-
Object.defineProperty(WebSocket.prototype, "OPEN", {
|
|
32235
|
-
enumerable: true,
|
|
32236
|
-
value: readyStates.indexOf("OPEN")
|
|
32237
|
-
});
|
|
32238
|
-
Object.defineProperty(WebSocket, "CLOSING", {
|
|
32239
|
-
enumerable: true,
|
|
32240
|
-
value: readyStates.indexOf("CLOSING")
|
|
32241
|
-
});
|
|
32242
|
-
Object.defineProperty(WebSocket.prototype, "CLOSING", {
|
|
32243
|
-
enumerable: true,
|
|
32244
|
-
value: readyStates.indexOf("CLOSING")
|
|
32245
|
-
});
|
|
32246
|
-
Object.defineProperty(WebSocket, "CLOSED", {
|
|
32247
|
-
enumerable: true,
|
|
32248
|
-
value: readyStates.indexOf("CLOSED")
|
|
32249
|
-
});
|
|
32250
|
-
Object.defineProperty(WebSocket.prototype, "CLOSED", {
|
|
32251
|
-
enumerable: true,
|
|
32252
|
-
value: readyStates.indexOf("CLOSED")
|
|
32253
|
-
});
|
|
32254
|
-
[
|
|
32255
|
-
"binaryType",
|
|
32256
|
-
"bufferedAmount",
|
|
32257
|
-
"extensions",
|
|
32258
|
-
"isPaused",
|
|
32259
|
-
"protocol",
|
|
32260
|
-
"readyState",
|
|
32261
|
-
"url"
|
|
32262
|
-
].forEach((property) => {
|
|
32263
|
-
Object.defineProperty(WebSocket.prototype, property, { enumerable: true });
|
|
32264
|
-
});
|
|
32265
|
-
["open", "error", "close", "message"].forEach((method) => {
|
|
32266
|
-
Object.defineProperty(WebSocket.prototype, `on${method}`, {
|
|
32267
|
-
enumerable: true,
|
|
32268
|
-
get() {
|
|
32269
|
-
for (const listener of this.listeners(method)) {
|
|
32270
|
-
if (listener[kForOnEventAttribute])
|
|
32271
|
-
return listener[kListener];
|
|
32272
|
-
}
|
|
32273
|
-
return null;
|
|
32274
|
-
},
|
|
32275
|
-
set(handler2) {
|
|
32276
|
-
for (const listener of this.listeners(method)) {
|
|
32277
|
-
if (listener[kForOnEventAttribute]) {
|
|
32278
|
-
this.removeListener(method, listener);
|
|
32279
|
-
break;
|
|
32280
|
-
}
|
|
32281
|
-
}
|
|
32282
|
-
if (typeof handler2 !== "function")
|
|
32283
|
-
return;
|
|
32284
|
-
this.addEventListener(method, handler2, {
|
|
32285
|
-
[kForOnEventAttribute]: true
|
|
32286
|
-
});
|
|
32287
|
-
}
|
|
32288
|
-
});
|
|
32289
|
-
});
|
|
32290
|
-
WebSocket.prototype.addEventListener = addEventListener;
|
|
32291
|
-
WebSocket.prototype.removeEventListener = removeEventListener;
|
|
32292
|
-
module.exports = WebSocket;
|
|
32293
|
-
function initAsClient(websocket, address, protocols, options) {
|
|
32294
|
-
const opts = {
|
|
32295
|
-
allowSynchronousEvents: true,
|
|
32296
|
-
autoPong: true,
|
|
32297
|
-
protocolVersion: protocolVersions[1],
|
|
32298
|
-
maxPayload: 100 * 1024 * 1024,
|
|
32299
|
-
skipUTF8Validation: false,
|
|
32300
|
-
perMessageDeflate: true,
|
|
32301
|
-
followRedirects: false,
|
|
32302
|
-
maxRedirects: 10,
|
|
32303
|
-
...options,
|
|
32304
|
-
socketPath: undefined,
|
|
32305
|
-
hostname: undefined,
|
|
32306
|
-
protocol: undefined,
|
|
32307
|
-
timeout: undefined,
|
|
32308
|
-
method: "GET",
|
|
32309
|
-
host: undefined,
|
|
32310
|
-
path: undefined,
|
|
32311
|
-
port: undefined
|
|
32312
|
-
};
|
|
32313
|
-
websocket._autoPong = opts.autoPong;
|
|
32314
|
-
if (!protocolVersions.includes(opts.protocolVersion)) {
|
|
32315
|
-
throw new RangeError(`Unsupported protocol version: ${opts.protocolVersion} ` + `(supported versions: ${protocolVersions.join(", ")})`);
|
|
32316
|
-
}
|
|
32317
|
-
let parsedUrl;
|
|
32318
|
-
if (address instanceof URL2) {
|
|
32319
|
-
parsedUrl = address;
|
|
32320
|
-
} else {
|
|
32321
|
-
try {
|
|
32322
|
-
parsedUrl = new URL2(address);
|
|
32323
|
-
} catch (e) {
|
|
32324
|
-
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
32325
|
-
}
|
|
32326
|
-
}
|
|
32327
|
-
if (parsedUrl.protocol === "http:") {
|
|
32328
|
-
parsedUrl.protocol = "ws:";
|
|
32329
|
-
} else if (parsedUrl.protocol === "https:") {
|
|
32330
|
-
parsedUrl.protocol = "wss:";
|
|
32331
|
-
}
|
|
32332
|
-
websocket._url = parsedUrl.href;
|
|
32333
|
-
const isSecure = parsedUrl.protocol === "wss:";
|
|
32334
|
-
const isIpcUrl = parsedUrl.protocol === "ws+unix:";
|
|
32335
|
-
let invalidUrlMessage;
|
|
32336
|
-
if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl) {
|
|
32337
|
-
invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", ` + '"http:", "https:", or "ws+unix:"';
|
|
32338
|
-
} else if (isIpcUrl && !parsedUrl.pathname) {
|
|
32339
|
-
invalidUrlMessage = "The URL's pathname is empty";
|
|
32340
|
-
} else if (parsedUrl.hash) {
|
|
32341
|
-
invalidUrlMessage = "The URL contains a fragment identifier";
|
|
32342
|
-
}
|
|
32343
|
-
if (invalidUrlMessage) {
|
|
32344
|
-
const err = new SyntaxError(invalidUrlMessage);
|
|
32345
|
-
if (websocket._redirects === 0) {
|
|
32346
|
-
throw err;
|
|
32347
|
-
} else {
|
|
32348
|
-
emitErrorAndClose(websocket, err);
|
|
32349
|
-
return;
|
|
32350
|
-
}
|
|
32351
|
-
}
|
|
32352
|
-
const defaultPort = isSecure ? 443 : 80;
|
|
32353
|
-
const key = randomBytes(16).toString("base64");
|
|
32354
|
-
const request = isSecure ? https.request : http.request;
|
|
32355
|
-
const protocolSet = new Set;
|
|
32356
|
-
let perMessageDeflate;
|
|
32357
|
-
opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
|
|
32358
|
-
opts.defaultPort = opts.defaultPort || defaultPort;
|
|
32359
|
-
opts.port = parsedUrl.port || defaultPort;
|
|
32360
|
-
opts.host = parsedUrl.hostname.startsWith("[") ? parsedUrl.hostname.slice(1, -1) : parsedUrl.hostname;
|
|
32361
|
-
opts.headers = {
|
|
32362
|
-
...opts.headers,
|
|
32363
|
-
"Sec-WebSocket-Version": opts.protocolVersion,
|
|
32364
|
-
"Sec-WebSocket-Key": key,
|
|
32365
|
-
Connection: "Upgrade",
|
|
32366
|
-
Upgrade: "websocket"
|
|
32367
|
-
};
|
|
32368
|
-
opts.path = parsedUrl.pathname + parsedUrl.search;
|
|
32369
|
-
opts.timeout = opts.handshakeTimeout;
|
|
32370
|
-
if (opts.perMessageDeflate) {
|
|
32371
|
-
perMessageDeflate = new PerMessageDeflate(opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, false, opts.maxPayload);
|
|
32372
|
-
opts.headers["Sec-WebSocket-Extensions"] = format2({
|
|
32373
|
-
[PerMessageDeflate.extensionName]: perMessageDeflate.offer()
|
|
32374
|
-
});
|
|
32375
|
-
}
|
|
32376
|
-
if (protocols.length) {
|
|
32377
|
-
for (const protocol of protocols) {
|
|
32378
|
-
if (typeof protocol !== "string" || !subprotocolRegex.test(protocol) || protocolSet.has(protocol)) {
|
|
32379
|
-
throw new SyntaxError("An invalid or duplicated subprotocol was specified");
|
|
32380
|
-
}
|
|
32381
|
-
protocolSet.add(protocol);
|
|
32382
|
-
}
|
|
32383
|
-
opts.headers["Sec-WebSocket-Protocol"] = protocols.join(",");
|
|
32384
|
-
}
|
|
32385
|
-
if (opts.origin) {
|
|
32386
|
-
if (opts.protocolVersion < 13) {
|
|
32387
|
-
opts.headers["Sec-WebSocket-Origin"] = opts.origin;
|
|
32388
|
-
} else {
|
|
32389
|
-
opts.headers.Origin = opts.origin;
|
|
32390
|
-
}
|
|
32391
|
-
}
|
|
32392
|
-
if (parsedUrl.username || parsedUrl.password) {
|
|
32393
|
-
opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
|
|
32394
|
-
}
|
|
32395
|
-
if (isIpcUrl) {
|
|
32396
|
-
const parts = opts.path.split(":");
|
|
32397
|
-
opts.socketPath = parts[0];
|
|
32398
|
-
opts.path = parts[1];
|
|
32399
|
-
}
|
|
32400
|
-
let req;
|
|
32401
|
-
if (opts.followRedirects) {
|
|
32402
|
-
if (websocket._redirects === 0) {
|
|
32403
|
-
websocket._originalIpc = isIpcUrl;
|
|
32404
|
-
websocket._originalSecure = isSecure;
|
|
32405
|
-
websocket._originalHostOrSocketPath = isIpcUrl ? opts.socketPath : parsedUrl.host;
|
|
32406
|
-
const headers = options && options.headers;
|
|
32407
|
-
options = { ...options, headers: {} };
|
|
32408
|
-
if (headers) {
|
|
32409
|
-
for (const [key2, value] of Object.entries(headers)) {
|
|
32410
|
-
options.headers[key2.toLowerCase()] = value;
|
|
32411
|
-
}
|
|
32412
|
-
}
|
|
32413
|
-
} else if (websocket.listenerCount("redirect") === 0) {
|
|
32414
|
-
const isSameHost = isIpcUrl ? websocket._originalIpc ? opts.socketPath === websocket._originalHostOrSocketPath : false : websocket._originalIpc ? false : parsedUrl.host === websocket._originalHostOrSocketPath;
|
|
32415
|
-
if (!isSameHost || websocket._originalSecure && !isSecure) {
|
|
32416
|
-
delete opts.headers.authorization;
|
|
32417
|
-
delete opts.headers.cookie;
|
|
32418
|
-
if (!isSameHost)
|
|
32419
|
-
delete opts.headers.host;
|
|
32420
|
-
opts.auth = undefined;
|
|
32421
|
-
}
|
|
32422
|
-
}
|
|
32423
|
-
if (opts.auth && !options.headers.authorization) {
|
|
32424
|
-
options.headers.authorization = "Basic " + Buffer.from(opts.auth).toString("base64");
|
|
32425
|
-
}
|
|
32426
|
-
req = websocket._req = request(opts);
|
|
32427
|
-
if (websocket._redirects) {
|
|
32428
|
-
websocket.emit("redirect", websocket.url, req);
|
|
32429
|
-
}
|
|
32430
|
-
} else {
|
|
32431
|
-
req = websocket._req = request(opts);
|
|
32432
|
-
}
|
|
32433
|
-
if (opts.timeout) {
|
|
32434
|
-
req.on("timeout", () => {
|
|
32435
|
-
abortHandshake(websocket, req, "Opening handshake has timed out");
|
|
32436
|
-
});
|
|
32437
|
-
}
|
|
32438
|
-
req.on("error", (err) => {
|
|
32439
|
-
if (req === null || req[kAborted])
|
|
32440
|
-
return;
|
|
32441
|
-
req = websocket._req = null;
|
|
32442
|
-
emitErrorAndClose(websocket, err);
|
|
32443
|
-
});
|
|
32444
|
-
req.on("response", (res) => {
|
|
32445
|
-
const location = res.headers.location;
|
|
32446
|
-
const statusCode = res.statusCode;
|
|
32447
|
-
if (location && opts.followRedirects && statusCode >= 300 && statusCode < 400) {
|
|
32448
|
-
if (++websocket._redirects > opts.maxRedirects) {
|
|
32449
|
-
abortHandshake(websocket, req, "Maximum redirects exceeded");
|
|
32450
|
-
return;
|
|
32451
|
-
}
|
|
32452
|
-
req.abort();
|
|
32453
|
-
let addr;
|
|
32454
|
-
try {
|
|
32455
|
-
addr = new URL2(location, address);
|
|
32456
|
-
} catch (e) {
|
|
32457
|
-
const err = new SyntaxError(`Invalid URL: ${location}`);
|
|
32458
|
-
emitErrorAndClose(websocket, err);
|
|
32459
|
-
return;
|
|
32460
|
-
}
|
|
32461
|
-
initAsClient(websocket, addr, protocols, options);
|
|
32462
|
-
} else if (!websocket.emit("unexpected-response", req, res)) {
|
|
32463
|
-
abortHandshake(websocket, req, `Unexpected server response: ${res.statusCode}`);
|
|
32464
|
-
}
|
|
32465
|
-
});
|
|
32466
|
-
req.on("upgrade", (res, socket, head) => {
|
|
32467
|
-
websocket.emit("upgrade", res);
|
|
32468
|
-
if (websocket.readyState !== WebSocket.CONNECTING)
|
|
32469
|
-
return;
|
|
32470
|
-
req = websocket._req = null;
|
|
32471
|
-
const upgrade = res.headers.upgrade;
|
|
32472
|
-
if (upgrade === undefined || upgrade.toLowerCase() !== "websocket") {
|
|
32473
|
-
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
32474
|
-
return;
|
|
32475
|
-
}
|
|
32476
|
-
const digest = createHash("sha1").update(key + GUID).digest("base64");
|
|
32477
|
-
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
32478
|
-
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
32479
|
-
return;
|
|
32480
|
-
}
|
|
32481
|
-
const serverProt = res.headers["sec-websocket-protocol"];
|
|
32482
|
-
let protError;
|
|
32483
|
-
if (serverProt !== undefined) {
|
|
32484
|
-
if (!protocolSet.size) {
|
|
32485
|
-
protError = "Server sent a subprotocol but none was requested";
|
|
32486
|
-
} else if (!protocolSet.has(serverProt)) {
|
|
32487
|
-
protError = "Server sent an invalid subprotocol";
|
|
32488
|
-
}
|
|
32489
|
-
} else if (protocolSet.size) {
|
|
32490
|
-
protError = "Server sent no subprotocol";
|
|
32491
|
-
}
|
|
32492
|
-
if (protError) {
|
|
32493
|
-
abortHandshake(websocket, socket, protError);
|
|
32494
|
-
return;
|
|
32495
|
-
}
|
|
32496
|
-
if (serverProt)
|
|
32497
|
-
websocket._protocol = serverProt;
|
|
32498
|
-
const secWebSocketExtensions = res.headers["sec-websocket-extensions"];
|
|
32499
|
-
if (secWebSocketExtensions !== undefined) {
|
|
32500
|
-
if (!perMessageDeflate) {
|
|
32501
|
-
const message = "Server sent a Sec-WebSocket-Extensions header but no extension " + "was requested";
|
|
32502
|
-
abortHandshake(websocket, socket, message);
|
|
32503
|
-
return;
|
|
32504
|
-
}
|
|
32505
|
-
let extensions;
|
|
32506
|
-
try {
|
|
32507
|
-
extensions = parse(secWebSocketExtensions);
|
|
32508
|
-
} catch (err) {
|
|
32509
|
-
const message = "Invalid Sec-WebSocket-Extensions header";
|
|
32510
|
-
abortHandshake(websocket, socket, message);
|
|
32511
|
-
return;
|
|
32512
|
-
}
|
|
32513
|
-
const extensionNames = Object.keys(extensions);
|
|
32514
|
-
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate.extensionName) {
|
|
32515
|
-
const message = "Server indicated an extension that was not requested";
|
|
32516
|
-
abortHandshake(websocket, socket, message);
|
|
32517
|
-
return;
|
|
32518
|
-
}
|
|
32519
|
-
try {
|
|
32520
|
-
perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]);
|
|
32521
|
-
} catch (err) {
|
|
32522
|
-
const message = "Invalid Sec-WebSocket-Extensions header";
|
|
32523
|
-
abortHandshake(websocket, socket, message);
|
|
32524
|
-
return;
|
|
32525
|
-
}
|
|
32526
|
-
websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
|
|
32527
|
-
}
|
|
32528
|
-
websocket.setSocket(socket, head, {
|
|
32529
|
-
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
32530
|
-
generateMask: opts.generateMask,
|
|
32531
|
-
maxPayload: opts.maxPayload,
|
|
32532
|
-
skipUTF8Validation: opts.skipUTF8Validation
|
|
32533
|
-
});
|
|
32534
|
-
});
|
|
32535
|
-
if (opts.finishRequest) {
|
|
32536
|
-
opts.finishRequest(req, websocket);
|
|
32537
|
-
} else {
|
|
32538
|
-
req.end();
|
|
32539
|
-
}
|
|
32540
|
-
}
|
|
32541
|
-
function emitErrorAndClose(websocket, err) {
|
|
32542
|
-
websocket._readyState = WebSocket.CLOSING;
|
|
32543
|
-
websocket._errorEmitted = true;
|
|
32544
|
-
websocket.emit("error", err);
|
|
32545
|
-
websocket.emitClose();
|
|
32546
|
-
}
|
|
32547
|
-
function netConnect(options) {
|
|
32548
|
-
options.path = options.socketPath;
|
|
32549
|
-
return net.connect(options);
|
|
32550
|
-
}
|
|
32551
|
-
function tlsConnect(options) {
|
|
32552
|
-
options.path = undefined;
|
|
32553
|
-
if (!options.servername && options.servername !== "") {
|
|
32554
|
-
options.servername = net.isIP(options.host) ? "" : options.host;
|
|
32555
|
-
}
|
|
32556
|
-
return tls.connect(options);
|
|
32557
|
-
}
|
|
32558
|
-
function abortHandshake(websocket, stream, message) {
|
|
32559
|
-
websocket._readyState = WebSocket.CLOSING;
|
|
32560
|
-
const err = new Error(message);
|
|
32561
|
-
Error.captureStackTrace(err, abortHandshake);
|
|
32562
|
-
if (stream.setHeader) {
|
|
32563
|
-
stream[kAborted] = true;
|
|
32564
|
-
stream.abort();
|
|
32565
|
-
if (stream.socket && !stream.socket.destroyed) {
|
|
32566
|
-
stream.socket.destroy();
|
|
32567
|
-
}
|
|
32568
|
-
process.nextTick(emitErrorAndClose, websocket, err);
|
|
32569
|
-
} else {
|
|
32570
|
-
stream.destroy(err);
|
|
32571
|
-
stream.once("error", websocket.emit.bind(websocket, "error"));
|
|
32572
|
-
stream.once("close", websocket.emitClose.bind(websocket));
|
|
32573
|
-
}
|
|
32574
|
-
}
|
|
32575
|
-
function sendAfterClose(websocket, data, cb) {
|
|
32576
|
-
if (data) {
|
|
32577
|
-
const length = isBlob(data) ? data.size : toBuffer(data).length;
|
|
32578
|
-
if (websocket._socket)
|
|
32579
|
-
websocket._sender._bufferedBytes += length;
|
|
32580
|
-
else
|
|
32581
|
-
websocket._bufferedAmount += length;
|
|
32582
|
-
}
|
|
32583
|
-
if (cb) {
|
|
32584
|
-
const err = new Error(`WebSocket is not open: readyState ${websocket.readyState} ` + `(${readyStates[websocket.readyState]})`);
|
|
32585
|
-
process.nextTick(cb, err);
|
|
32586
|
-
}
|
|
32587
|
-
}
|
|
32588
|
-
function receiverOnConclude(code, reason) {
|
|
32589
|
-
const websocket = this[kWebSocket];
|
|
32590
|
-
websocket._closeFrameReceived = true;
|
|
32591
|
-
websocket._closeMessage = reason;
|
|
32592
|
-
websocket._closeCode = code;
|
|
32593
|
-
if (websocket._socket[kWebSocket] === undefined)
|
|
32594
|
-
return;
|
|
32595
|
-
websocket._socket.removeListener("data", socketOnData);
|
|
32596
|
-
process.nextTick(resume, websocket._socket);
|
|
32597
|
-
if (code === 1005)
|
|
32598
|
-
websocket.close();
|
|
32599
|
-
else
|
|
32600
|
-
websocket.close(code, reason);
|
|
32601
|
-
}
|
|
32602
|
-
function receiverOnDrain() {
|
|
32603
|
-
const websocket = this[kWebSocket];
|
|
32604
|
-
if (!websocket.isPaused)
|
|
32605
|
-
websocket._socket.resume();
|
|
32606
|
-
}
|
|
32607
|
-
function receiverOnError(err) {
|
|
32608
|
-
const websocket = this[kWebSocket];
|
|
32609
|
-
if (websocket._socket[kWebSocket] !== undefined) {
|
|
32610
|
-
websocket._socket.removeListener("data", socketOnData);
|
|
32611
|
-
process.nextTick(resume, websocket._socket);
|
|
32612
|
-
websocket.close(err[kStatusCode]);
|
|
32613
|
-
}
|
|
32614
|
-
if (!websocket._errorEmitted) {
|
|
32615
|
-
websocket._errorEmitted = true;
|
|
32616
|
-
websocket.emit("error", err);
|
|
32617
|
-
}
|
|
32618
|
-
}
|
|
32619
|
-
function receiverOnFinish() {
|
|
32620
|
-
this[kWebSocket].emitClose();
|
|
32621
|
-
}
|
|
32622
|
-
function receiverOnMessage(data, isBinary2) {
|
|
32623
|
-
this[kWebSocket].emit("message", data, isBinary2);
|
|
32624
|
-
}
|
|
32625
|
-
function receiverOnPing(data) {
|
|
32626
|
-
const websocket = this[kWebSocket];
|
|
32627
|
-
if (websocket._autoPong)
|
|
32628
|
-
websocket.pong(data, !this._isServer, NOOP);
|
|
32629
|
-
websocket.emit("ping", data);
|
|
32630
|
-
}
|
|
32631
|
-
function receiverOnPong(data) {
|
|
32632
|
-
this[kWebSocket].emit("pong", data);
|
|
32633
|
-
}
|
|
32634
|
-
function resume(stream) {
|
|
32635
|
-
stream.resume();
|
|
32636
|
-
}
|
|
32637
|
-
function senderOnError(err) {
|
|
32638
|
-
const websocket = this[kWebSocket];
|
|
32639
|
-
if (websocket.readyState === WebSocket.CLOSED)
|
|
32640
|
-
return;
|
|
32641
|
-
if (websocket.readyState === WebSocket.OPEN) {
|
|
32642
|
-
websocket._readyState = WebSocket.CLOSING;
|
|
32643
|
-
setCloseTimer(websocket);
|
|
32644
|
-
}
|
|
32645
|
-
this._socket.end();
|
|
32646
|
-
if (!websocket._errorEmitted) {
|
|
32647
|
-
websocket._errorEmitted = true;
|
|
32648
|
-
websocket.emit("error", err);
|
|
32649
|
-
}
|
|
32650
|
-
}
|
|
32651
|
-
function setCloseTimer(websocket) {
|
|
32652
|
-
websocket._closeTimer = setTimeout(websocket._socket.destroy.bind(websocket._socket), closeTimeout);
|
|
32653
|
-
}
|
|
32654
|
-
function socketOnClose() {
|
|
32655
|
-
const websocket = this[kWebSocket];
|
|
32656
|
-
this.removeListener("close", socketOnClose);
|
|
32657
|
-
this.removeListener("data", socketOnData);
|
|
32658
|
-
this.removeListener("end", socketOnEnd);
|
|
32659
|
-
websocket._readyState = WebSocket.CLOSING;
|
|
32660
|
-
let chunk;
|
|
32661
|
-
if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && (chunk = websocket._socket.read()) !== null) {
|
|
32662
|
-
websocket._receiver.write(chunk);
|
|
32663
|
-
}
|
|
32664
|
-
websocket._receiver.end();
|
|
32665
|
-
this[kWebSocket] = undefined;
|
|
32666
|
-
clearTimeout(websocket._closeTimer);
|
|
32667
|
-
if (websocket._receiver._writableState.finished || websocket._receiver._writableState.errorEmitted) {
|
|
32668
|
-
websocket.emitClose();
|
|
32669
|
-
} else {
|
|
32670
|
-
websocket._receiver.on("error", receiverOnFinish);
|
|
32671
|
-
websocket._receiver.on("finish", receiverOnFinish);
|
|
32672
|
-
}
|
|
32673
|
-
}
|
|
32674
|
-
function socketOnData(chunk) {
|
|
32675
|
-
if (!this[kWebSocket]._receiver.write(chunk)) {
|
|
32676
|
-
this.pause();
|
|
32677
|
-
}
|
|
32678
|
-
}
|
|
32679
|
-
function socketOnEnd() {
|
|
32680
|
-
const websocket = this[kWebSocket];
|
|
32681
|
-
websocket._readyState = WebSocket.CLOSING;
|
|
32682
|
-
websocket._receiver.end();
|
|
32683
|
-
this.end();
|
|
32684
|
-
}
|
|
32685
|
-
function socketOnError() {
|
|
32686
|
-
const websocket = this[kWebSocket];
|
|
32687
|
-
this.removeListener("error", socketOnError);
|
|
32688
|
-
this.on("error", NOOP);
|
|
32689
|
-
if (websocket) {
|
|
32690
|
-
websocket._readyState = WebSocket.CLOSING;
|
|
32691
|
-
this.destroy();
|
|
32692
|
-
}
|
|
32693
|
-
}
|
|
32694
|
-
});
|
|
32695
|
-
|
|
32696
|
-
// node_modules/ink/node_modules/ws/lib/stream.js
|
|
32697
|
-
var require_stream2 = __commonJS((exports, module) => {
|
|
32698
|
-
var WebSocket = require_websocket2();
|
|
32699
|
-
var { Duplex } = __require("stream");
|
|
32700
|
-
function emitClose(stream) {
|
|
32701
|
-
stream.emit("close");
|
|
32702
|
-
}
|
|
32703
|
-
function duplexOnEnd() {
|
|
32704
|
-
if (!this.destroyed && this._writableState.finished) {
|
|
32705
|
-
this.destroy();
|
|
32706
|
-
}
|
|
32707
|
-
}
|
|
32708
|
-
function duplexOnError(err) {
|
|
32709
|
-
this.removeListener("error", duplexOnError);
|
|
32710
|
-
this.destroy();
|
|
32711
|
-
if (this.listenerCount("error") === 0) {
|
|
32712
|
-
this.emit("error", err);
|
|
32713
|
-
}
|
|
32714
|
-
}
|
|
32715
|
-
function createWebSocketStream(ws, options) {
|
|
32716
|
-
let terminateOnDestroy = true;
|
|
32717
|
-
const duplex = new Duplex({
|
|
32718
|
-
...options,
|
|
32719
|
-
autoDestroy: false,
|
|
32720
|
-
emitClose: false,
|
|
32721
|
-
objectMode: false,
|
|
32722
|
-
writableObjectMode: false
|
|
32723
|
-
});
|
|
32724
|
-
ws.on("message", function message(msg, isBinary2) {
|
|
32725
|
-
const data = !isBinary2 && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
32726
|
-
if (!duplex.push(data))
|
|
32727
|
-
ws.pause();
|
|
32728
|
-
});
|
|
32729
|
-
ws.once("error", function error(err) {
|
|
32730
|
-
if (duplex.destroyed)
|
|
32731
|
-
return;
|
|
32732
|
-
terminateOnDestroy = false;
|
|
32733
|
-
duplex.destroy(err);
|
|
32734
|
-
});
|
|
32735
|
-
ws.once("close", function close() {
|
|
32736
|
-
if (duplex.destroyed)
|
|
32737
|
-
return;
|
|
32738
|
-
duplex.push(null);
|
|
32739
|
-
});
|
|
32740
|
-
duplex._destroy = function(err, callback) {
|
|
32741
|
-
if (ws.readyState === ws.CLOSED) {
|
|
32742
|
-
callback(err);
|
|
32743
|
-
process.nextTick(emitClose, duplex);
|
|
32744
|
-
return;
|
|
32745
|
-
}
|
|
32746
|
-
let called = false;
|
|
32747
|
-
ws.once("error", function error(err2) {
|
|
32748
|
-
called = true;
|
|
32749
|
-
callback(err2);
|
|
32750
|
-
});
|
|
32751
|
-
ws.once("close", function close() {
|
|
32752
|
-
if (!called)
|
|
32753
|
-
callback(err);
|
|
32754
|
-
process.nextTick(emitClose, duplex);
|
|
32755
|
-
});
|
|
32756
|
-
if (terminateOnDestroy)
|
|
32757
|
-
ws.terminate();
|
|
32758
|
-
};
|
|
32759
|
-
duplex._final = function(callback) {
|
|
32760
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
32761
|
-
ws.once("open", function open() {
|
|
32762
|
-
duplex._final(callback);
|
|
32763
|
-
});
|
|
32764
|
-
return;
|
|
32765
|
-
}
|
|
32766
|
-
if (ws._socket === null)
|
|
32767
|
-
return;
|
|
32768
|
-
if (ws._socket._writableState.finished) {
|
|
32769
|
-
callback();
|
|
32770
|
-
if (duplex._readableState.endEmitted)
|
|
32771
|
-
duplex.destroy();
|
|
32772
|
-
} else {
|
|
32773
|
-
ws._socket.once("finish", function finish() {
|
|
32774
|
-
callback();
|
|
32775
|
-
});
|
|
32776
|
-
ws.close();
|
|
32777
|
-
}
|
|
32778
|
-
};
|
|
32779
|
-
duplex._read = function() {
|
|
32780
|
-
if (ws.isPaused)
|
|
32781
|
-
ws.resume();
|
|
32782
|
-
};
|
|
32783
|
-
duplex._write = function(chunk, encoding, callback) {
|
|
32784
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
32785
|
-
ws.once("open", function open() {
|
|
32786
|
-
duplex._write(chunk, encoding, callback);
|
|
32787
|
-
});
|
|
32788
|
-
return;
|
|
32789
|
-
}
|
|
32790
|
-
ws.send(chunk, callback);
|
|
32791
|
-
};
|
|
32792
|
-
duplex.on("end", duplexOnEnd);
|
|
32793
|
-
duplex.on("error", duplexOnError);
|
|
32794
|
-
return duplex;
|
|
32795
|
-
}
|
|
32796
|
-
module.exports = createWebSocketStream;
|
|
32797
|
-
});
|
|
32798
|
-
|
|
32799
|
-
// node_modules/ink/node_modules/ws/lib/subprotocol.js
|
|
32800
|
-
var require_subprotocol2 = __commonJS((exports, module) => {
|
|
32801
|
-
var { tokenChars } = require_validation2();
|
|
32802
|
-
function parse(header) {
|
|
32803
|
-
const protocols = new Set;
|
|
32804
|
-
let start = -1;
|
|
32805
|
-
let end = -1;
|
|
32806
|
-
let i2 = 0;
|
|
32807
|
-
for (i2;i2 < header.length; i2++) {
|
|
32808
|
-
const code = header.charCodeAt(i2);
|
|
32809
|
-
if (end === -1 && tokenChars[code] === 1) {
|
|
32810
|
-
if (start === -1)
|
|
32811
|
-
start = i2;
|
|
32812
|
-
} else if (i2 !== 0 && (code === 32 || code === 9)) {
|
|
32813
|
-
if (end === -1 && start !== -1)
|
|
32814
|
-
end = i2;
|
|
32815
|
-
} else if (code === 44) {
|
|
32816
|
-
if (start === -1) {
|
|
32817
|
-
throw new SyntaxError(`Unexpected character at index ${i2}`);
|
|
32818
|
-
}
|
|
32819
|
-
if (end === -1)
|
|
32820
|
-
end = i2;
|
|
32821
|
-
const protocol2 = header.slice(start, end);
|
|
32822
|
-
if (protocols.has(protocol2)) {
|
|
32823
|
-
throw new SyntaxError(`The "${protocol2}" subprotocol is duplicated`);
|
|
32824
|
-
}
|
|
32825
|
-
protocols.add(protocol2);
|
|
32826
|
-
start = end = -1;
|
|
32827
|
-
} else {
|
|
32828
|
-
throw new SyntaxError(`Unexpected character at index ${i2}`);
|
|
32829
|
-
}
|
|
32830
|
-
}
|
|
32831
|
-
if (start === -1 || end !== -1) {
|
|
32832
|
-
throw new SyntaxError("Unexpected end of input");
|
|
32833
|
-
}
|
|
32834
|
-
const protocol = header.slice(start, i2);
|
|
32835
|
-
if (protocols.has(protocol)) {
|
|
32836
|
-
throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
|
|
32837
|
-
}
|
|
32838
|
-
protocols.add(protocol);
|
|
32839
|
-
return protocols;
|
|
32840
|
-
}
|
|
32841
|
-
module.exports = { parse };
|
|
32842
|
-
});
|
|
32843
|
-
|
|
32844
|
-
// node_modules/ink/node_modules/ws/lib/websocket-server.js
|
|
32845
|
-
var require_websocket_server2 = __commonJS((exports, module) => {
|
|
32846
|
-
var EventEmitter5 = __require("events");
|
|
32847
|
-
var http = __require("http");
|
|
32848
|
-
var { Duplex } = __require("stream");
|
|
32849
|
-
var { createHash } = __require("crypto");
|
|
32850
|
-
var extension = require_extension2();
|
|
32851
|
-
var PerMessageDeflate = require_permessage_deflate2();
|
|
32852
|
-
var subprotocol = require_subprotocol2();
|
|
32853
|
-
var WebSocket = require_websocket2();
|
|
32854
|
-
var { GUID, kWebSocket } = require_constants6();
|
|
32855
|
-
var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
32856
|
-
var RUNNING = 0;
|
|
32857
|
-
var CLOSING = 1;
|
|
32858
|
-
var CLOSED = 2;
|
|
32859
|
-
|
|
32860
|
-
class WebSocketServer extends EventEmitter5 {
|
|
32861
|
-
constructor(options, callback) {
|
|
32862
|
-
super();
|
|
32863
|
-
options = {
|
|
32864
|
-
allowSynchronousEvents: true,
|
|
32865
|
-
autoPong: true,
|
|
32866
|
-
maxPayload: 100 * 1024 * 1024,
|
|
32867
|
-
skipUTF8Validation: false,
|
|
32868
|
-
perMessageDeflate: false,
|
|
32869
|
-
handleProtocols: null,
|
|
32870
|
-
clientTracking: true,
|
|
32871
|
-
verifyClient: null,
|
|
32872
|
-
noServer: false,
|
|
32873
|
-
backlog: null,
|
|
32874
|
-
server: null,
|
|
32875
|
-
host: null,
|
|
32876
|
-
path: null,
|
|
32877
|
-
port: null,
|
|
32878
|
-
WebSocket,
|
|
32879
|
-
...options
|
|
32880
|
-
};
|
|
32881
|
-
if (options.port == null && !options.server && !options.noServer || options.port != null && (options.server || options.noServer) || options.server && options.noServer) {
|
|
32882
|
-
throw new TypeError('One and only one of the "port", "server", or "noServer" options ' + "must be specified");
|
|
32883
|
-
}
|
|
32884
|
-
if (options.port != null) {
|
|
32885
|
-
this._server = http.createServer((req, res) => {
|
|
32886
|
-
const body = http.STATUS_CODES[426];
|
|
32887
|
-
res.writeHead(426, {
|
|
32888
|
-
"Content-Length": body.length,
|
|
32889
|
-
"Content-Type": "text/plain"
|
|
32890
|
-
});
|
|
32891
|
-
res.end(body);
|
|
32892
|
-
});
|
|
32893
|
-
this._server.listen(options.port, options.host, options.backlog, callback);
|
|
32894
|
-
} else if (options.server) {
|
|
32895
|
-
this._server = options.server;
|
|
32896
|
-
}
|
|
32897
|
-
if (this._server) {
|
|
32898
|
-
const emitConnection = this.emit.bind(this, "connection");
|
|
32899
|
-
this._removeListeners = addListeners(this._server, {
|
|
32900
|
-
listening: this.emit.bind(this, "listening"),
|
|
32901
|
-
error: this.emit.bind(this, "error"),
|
|
32902
|
-
upgrade: (req, socket, head) => {
|
|
32903
|
-
this.handleUpgrade(req, socket, head, emitConnection);
|
|
32904
|
-
}
|
|
32905
|
-
});
|
|
30004
|
+
break;
|
|
30005
|
+
case 31:
|
|
30006
|
+
case 13:
|
|
30007
|
+
lanes = enqueueConcurrentRenderForLane(fiber, 2), lanes !== null && scheduleUpdateOnFiber(lanes, fiber, 2), flushSyncWork(), markRetryLaneIfNotHydrated(fiber, 2);
|
|
32906
30008
|
}
|
|
32907
|
-
|
|
32908
|
-
|
|
32909
|
-
|
|
32910
|
-
|
|
32911
|
-
|
|
30009
|
+
};
|
|
30010
|
+
exports2.batchedUpdates = function(fn, a) {
|
|
30011
|
+
return fn(a);
|
|
30012
|
+
};
|
|
30013
|
+
exports2.createComponentSelector = function(component) {
|
|
30014
|
+
return { $$typeof: COMPONENT_TYPE, value: component };
|
|
30015
|
+
};
|
|
30016
|
+
exports2.createContainer = function(containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator) {
|
|
30017
|
+
return createFiberRoot(containerInfo, tag, false, null, hydrationCallbacks, isStrictMode, identifierPrefix, null, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator);
|
|
30018
|
+
};
|
|
30019
|
+
exports2.createHasPseudoClassSelector = function(selectors) {
|
|
30020
|
+
return { $$typeof: HAS_PSEUDO_CLASS_TYPE, value: selectors };
|
|
30021
|
+
};
|
|
30022
|
+
exports2.createHydrationContainer = function(initialChildren, callback, containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator, transitionCallbacks, formState) {
|
|
30023
|
+
initialChildren = createFiberRoot(containerInfo, tag, true, initialChildren, hydrationCallbacks, isStrictMode, identifierPrefix, formState, onUncaughtError, onCaughtError, onRecoverableError, onDefaultTransitionIndicator);
|
|
30024
|
+
initialChildren.context = getContextForSubtree(null);
|
|
30025
|
+
containerInfo = initialChildren.current;
|
|
30026
|
+
tag = requestUpdateLane(containerInfo);
|
|
30027
|
+
tag = getBumpedLaneForHydrationByLane(tag);
|
|
30028
|
+
hydrationCallbacks = createUpdate(tag);
|
|
30029
|
+
hydrationCallbacks.callback = callback !== undefined && callback !== null ? callback : null;
|
|
30030
|
+
enqueueUpdate(containerInfo, hydrationCallbacks, tag);
|
|
30031
|
+
startUpdateTimerByLane(tag, "hydrateRoot()", null);
|
|
30032
|
+
callback = tag;
|
|
30033
|
+
initialChildren.current.lanes = callback;
|
|
30034
|
+
markRootUpdated$1(initialChildren, callback);
|
|
30035
|
+
ensureRootIsScheduled(initialChildren);
|
|
30036
|
+
return initialChildren;
|
|
30037
|
+
};
|
|
30038
|
+
exports2.createPortal = function(children, containerInfo, implementation) {
|
|
30039
|
+
var key = 3 < arguments.length && arguments[3] !== undefined ? arguments[3] : null;
|
|
30040
|
+
try {
|
|
30041
|
+
testStringCoercion(key);
|
|
30042
|
+
var JSCompiler_inline_result = false;
|
|
30043
|
+
} catch (e$6) {
|
|
30044
|
+
JSCompiler_inline_result = true;
|
|
32912
30045
|
}
|
|
32913
|
-
|
|
32914
|
-
|
|
32915
|
-
|
|
32916
|
-
|
|
32917
|
-
|
|
32918
|
-
|
|
30046
|
+
JSCompiler_inline_result && (console.error("The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", typeof Symbol === "function" && Symbol.toStringTag && key[Symbol.toStringTag] || key.constructor.name || "Object"), testStringCoercion(key));
|
|
30047
|
+
return {
|
|
30048
|
+
$$typeof: REACT_PORTAL_TYPE,
|
|
30049
|
+
key: key == null ? null : "" + key,
|
|
30050
|
+
children,
|
|
30051
|
+
containerInfo,
|
|
30052
|
+
implementation
|
|
30053
|
+
};
|
|
30054
|
+
};
|
|
30055
|
+
exports2.createRoleSelector = function(role) {
|
|
30056
|
+
return { $$typeof: ROLE_TYPE, value: role };
|
|
30057
|
+
};
|
|
30058
|
+
exports2.createTestNameSelector = function(id) {
|
|
30059
|
+
return { $$typeof: TEST_NAME_TYPE, value: id };
|
|
30060
|
+
};
|
|
30061
|
+
exports2.createTextSelector = function(text) {
|
|
30062
|
+
return { $$typeof: TEXT_TYPE, value: text };
|
|
30063
|
+
};
|
|
30064
|
+
exports2.defaultOnCaughtError = function(error) {
|
|
30065
|
+
var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component." : "The above error occurred in one of your React components.", recreateMessage = "React will try to recreate this component tree from scratch using the error boundary you provided, " + ((errorBoundaryName || "Anonymous") + ".");
|
|
30066
|
+
typeof error === "object" && error !== null && typeof error.environmentName === "string" ? bindToConsole("error", [`%o
|
|
30067
|
+
|
|
30068
|
+
%s
|
|
30069
|
+
|
|
30070
|
+
%s
|
|
30071
|
+
`, error, componentNameMessage, recreateMessage], error.environmentName)() : console.error(`%o
|
|
30072
|
+
|
|
30073
|
+
%s
|
|
30074
|
+
|
|
30075
|
+
%s
|
|
30076
|
+
`, error, componentNameMessage, recreateMessage);
|
|
30077
|
+
};
|
|
30078
|
+
exports2.defaultOnRecoverableError = function(error) {
|
|
30079
|
+
reportGlobalError(error);
|
|
30080
|
+
};
|
|
30081
|
+
exports2.defaultOnUncaughtError = function(error) {
|
|
30082
|
+
reportGlobalError(error);
|
|
30083
|
+
console.warn(`%s
|
|
30084
|
+
|
|
30085
|
+
%s
|
|
30086
|
+
`, componentName ? "An error occurred in the <" + componentName + "> component." : "An error occurred in one of your React components.", `Consider adding an error boundary to your tree to customize error handling behavior.
|
|
30087
|
+
Visit https://react.dev/link/error-boundaries to learn more about error boundaries.`);
|
|
30088
|
+
};
|
|
30089
|
+
exports2.deferredUpdates = function(fn) {
|
|
30090
|
+
var prevTransition = ReactSharedInternals.T, previousPriority = getCurrentUpdatePriority();
|
|
30091
|
+
try {
|
|
30092
|
+
return setCurrentUpdatePriority(32), ReactSharedInternals.T = null, fn();
|
|
30093
|
+
} finally {
|
|
30094
|
+
setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = prevTransition;
|
|
32919
30095
|
}
|
|
32920
|
-
|
|
32921
|
-
|
|
32922
|
-
|
|
32923
|
-
|
|
32924
|
-
|
|
32925
|
-
|
|
32926
|
-
|
|
32927
|
-
this.once("close", () => {
|
|
32928
|
-
cb(new Error("The server is not running"));
|
|
32929
|
-
});
|
|
32930
|
-
}
|
|
32931
|
-
process.nextTick(emitClose, this);
|
|
32932
|
-
return;
|
|
30096
|
+
};
|
|
30097
|
+
exports2.discreteUpdates = function(fn, a, b, c, d) {
|
|
30098
|
+
var prevTransition = ReactSharedInternals.T, previousPriority = getCurrentUpdatePriority();
|
|
30099
|
+
try {
|
|
30100
|
+
return setCurrentUpdatePriority(2), ReactSharedInternals.T = null, fn(a, b, c, d);
|
|
30101
|
+
} finally {
|
|
30102
|
+
setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = prevTransition, executionContext === NoContext && (workInProgressRootRenderTargetTime = now$1() + RENDER_TIMEOUT_MS);
|
|
32933
30103
|
}
|
|
32934
|
-
|
|
32935
|
-
|
|
32936
|
-
|
|
32937
|
-
|
|
32938
|
-
|
|
32939
|
-
|
|
32940
|
-
|
|
32941
|
-
|
|
32942
|
-
|
|
32943
|
-
|
|
32944
|
-
|
|
32945
|
-
|
|
32946
|
-
|
|
32947
|
-
|
|
32948
|
-
|
|
30104
|
+
};
|
|
30105
|
+
exports2.findAllNodes = findAllNodes;
|
|
30106
|
+
exports2.findBoundingRects = function(hostRoot, selectors) {
|
|
30107
|
+
if (!supportsTestSelectors)
|
|
30108
|
+
throw Error("Test selector API is not supported by this renderer.");
|
|
30109
|
+
selectors = findAllNodes(hostRoot, selectors);
|
|
30110
|
+
hostRoot = [];
|
|
30111
|
+
for (var i2 = 0;i2 < selectors.length; i2++)
|
|
30112
|
+
hostRoot.push(getBoundingRect(selectors[i2]));
|
|
30113
|
+
for (selectors = hostRoot.length - 1;0 < selectors; selectors--) {
|
|
30114
|
+
i2 = hostRoot[selectors];
|
|
30115
|
+
for (var targetLeft = i2.x, targetRight = targetLeft + i2.width, targetTop = i2.y, targetBottom = targetTop + i2.height, j = selectors - 1;0 <= j; j--)
|
|
30116
|
+
if (selectors !== j) {
|
|
30117
|
+
var otherRect = hostRoot[j], otherLeft = otherRect.x, otherRight = otherLeft + otherRect.width, otherTop = otherRect.y, otherBottom = otherTop + otherRect.height;
|
|
30118
|
+
if (targetLeft >= otherLeft && targetTop >= otherTop && targetRight <= otherRight && targetBottom <= otherBottom) {
|
|
30119
|
+
hostRoot.splice(selectors, 1);
|
|
30120
|
+
break;
|
|
30121
|
+
} else if (!(targetLeft !== otherLeft || i2.width !== otherRect.width || otherBottom < targetTop || otherTop > targetBottom)) {
|
|
30122
|
+
otherTop > targetTop && (otherRect.height += otherTop - targetTop, otherRect.y = targetTop);
|
|
30123
|
+
otherBottom < targetBottom && (otherRect.height = targetBottom - otherTop);
|
|
30124
|
+
hostRoot.splice(selectors, 1);
|
|
30125
|
+
break;
|
|
30126
|
+
} else if (!(targetTop !== otherTop || i2.height !== otherRect.height || otherRight < targetLeft || otherLeft > targetRight)) {
|
|
30127
|
+
otherLeft > targetLeft && (otherRect.width += otherLeft - targetLeft, otherRect.x = targetLeft);
|
|
30128
|
+
otherRight < targetRight && (otherRect.width = targetRight - otherLeft);
|
|
30129
|
+
hostRoot.splice(selectors, 1);
|
|
30130
|
+
break;
|
|
30131
|
+
}
|
|
32949
30132
|
}
|
|
32950
|
-
} else {
|
|
32951
|
-
process.nextTick(emitClose, this);
|
|
32952
|
-
}
|
|
32953
|
-
} else {
|
|
32954
|
-
const server = this._server;
|
|
32955
|
-
this._removeListeners();
|
|
32956
|
-
this._removeListeners = this._server = null;
|
|
32957
|
-
server.close(() => {
|
|
32958
|
-
emitClose(this);
|
|
32959
|
-
});
|
|
32960
|
-
}
|
|
32961
|
-
}
|
|
32962
|
-
shouldHandle(req) {
|
|
32963
|
-
if (this.options.path) {
|
|
32964
|
-
const index = req.url.indexOf("?");
|
|
32965
|
-
const pathname = index !== -1 ? req.url.slice(0, index) : req.url;
|
|
32966
|
-
if (pathname !== this.options.path)
|
|
32967
|
-
return false;
|
|
32968
|
-
}
|
|
32969
|
-
return true;
|
|
32970
|
-
}
|
|
32971
|
-
handleUpgrade(req, socket, head, cb) {
|
|
32972
|
-
socket.on("error", socketOnError);
|
|
32973
|
-
const key = req.headers["sec-websocket-key"];
|
|
32974
|
-
const upgrade = req.headers.upgrade;
|
|
32975
|
-
const version = +req.headers["sec-websocket-version"];
|
|
32976
|
-
if (req.method !== "GET") {
|
|
32977
|
-
const message = "Invalid HTTP method";
|
|
32978
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
|
|
32979
|
-
return;
|
|
32980
|
-
}
|
|
32981
|
-
if (upgrade === undefined || upgrade.toLowerCase() !== "websocket") {
|
|
32982
|
-
const message = "Invalid Upgrade header";
|
|
32983
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
32984
|
-
return;
|
|
32985
30133
|
}
|
|
32986
|
-
|
|
32987
|
-
|
|
32988
|
-
|
|
32989
|
-
|
|
30134
|
+
return hostRoot;
|
|
30135
|
+
};
|
|
30136
|
+
exports2.findHostInstance = function(component) {
|
|
30137
|
+
var fiber = component._reactInternals;
|
|
30138
|
+
if (fiber === undefined) {
|
|
30139
|
+
if (typeof component.render === "function")
|
|
30140
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
30141
|
+
component = Object.keys(component).join(",");
|
|
30142
|
+
throw Error("Argument appears to not be a ReactComponent. Keys: " + component);
|
|
32990
30143
|
}
|
|
32991
|
-
|
|
32992
|
-
|
|
32993
|
-
|
|
32994
|
-
|
|
32995
|
-
|
|
32996
|
-
|
|
30144
|
+
component = findCurrentHostFiber(fiber);
|
|
30145
|
+
return component === null ? null : getPublicInstance(component.stateNode);
|
|
30146
|
+
};
|
|
30147
|
+
exports2.findHostInstanceWithNoPortals = function(fiber) {
|
|
30148
|
+
fiber = findCurrentFiberUsingSlowPath(fiber);
|
|
30149
|
+
fiber = fiber !== null ? findCurrentHostFiberWithNoPortalsImpl(fiber) : null;
|
|
30150
|
+
return fiber === null ? null : getPublicInstance(fiber.stateNode);
|
|
30151
|
+
};
|
|
30152
|
+
exports2.findHostInstanceWithWarning = function(component, methodName) {
|
|
30153
|
+
var fiber = component._reactInternals;
|
|
30154
|
+
if (fiber === undefined) {
|
|
30155
|
+
if (typeof component.render === "function")
|
|
30156
|
+
throw Error("Unable to find node on an unmounted component.");
|
|
30157
|
+
component = Object.keys(component).join(",");
|
|
30158
|
+
throw Error("Argument appears to not be a ReactComponent. Keys: " + component);
|
|
32997
30159
|
}
|
|
32998
|
-
|
|
32999
|
-
|
|
33000
|
-
return;
|
|
30160
|
+
component = findCurrentHostFiber(fiber);
|
|
30161
|
+
if (component === null)
|
|
30162
|
+
return null;
|
|
30163
|
+
if (component.mode & 8) {
|
|
30164
|
+
var componentName2 = getComponentNameFromFiber(fiber) || "Component";
|
|
30165
|
+
didWarnAboutFindNodeInStrictMode[componentName2] || (didWarnAboutFindNodeInStrictMode[componentName2] = true, runWithFiberInDEV(component, function() {
|
|
30166
|
+
fiber.mode & 8 ? console.error("%s is deprecated in StrictMode. %s was passed an instance of %s which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://react.dev/link/strict-mode-find-node", methodName, methodName, componentName2) : console.error("%s is deprecated in StrictMode. %s was passed an instance of %s which renders StrictMode children. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://react.dev/link/strict-mode-find-node", methodName, methodName, componentName2);
|
|
30167
|
+
}));
|
|
33001
30168
|
}
|
|
33002
|
-
|
|
33003
|
-
|
|
33004
|
-
|
|
33005
|
-
|
|
33006
|
-
|
|
33007
|
-
|
|
33008
|
-
|
|
33009
|
-
|
|
33010
|
-
|
|
33011
|
-
|
|
30169
|
+
return getPublicInstance(component.stateNode);
|
|
30170
|
+
};
|
|
30171
|
+
exports2.flushPassiveEffects = flushPendingEffects;
|
|
30172
|
+
exports2.flushSyncFromReconciler = function(fn) {
|
|
30173
|
+
var prevExecutionContext = executionContext;
|
|
30174
|
+
executionContext |= 1;
|
|
30175
|
+
var prevTransition = ReactSharedInternals.T, previousPriority = getCurrentUpdatePriority();
|
|
30176
|
+
try {
|
|
30177
|
+
if (setCurrentUpdatePriority(2), ReactSharedInternals.T = null, fn)
|
|
30178
|
+
return fn();
|
|
30179
|
+
} finally {
|
|
30180
|
+
setCurrentUpdatePriority(previousPriority), ReactSharedInternals.T = prevTransition, executionContext = prevExecutionContext, (executionContext & (RenderContext | CommitContext)) === NoContext && flushSyncWorkAcrossRoots_impl(0, false);
|
|
33012
30181
|
}
|
|
33013
|
-
|
|
33014
|
-
|
|
33015
|
-
|
|
33016
|
-
|
|
33017
|
-
|
|
33018
|
-
|
|
33019
|
-
|
|
33020
|
-
|
|
33021
|
-
|
|
33022
|
-
|
|
33023
|
-
|
|
33024
|
-
|
|
33025
|
-
|
|
33026
|
-
|
|
30182
|
+
};
|
|
30183
|
+
exports2.flushSyncWork = flushSyncWork;
|
|
30184
|
+
exports2.focusWithin = function(hostRoot, selectors) {
|
|
30185
|
+
if (!supportsTestSelectors)
|
|
30186
|
+
throw Error("Test selector API is not supported by this renderer.");
|
|
30187
|
+
hostRoot = findFiberRootForHostRoot(hostRoot);
|
|
30188
|
+
selectors = findPaths(hostRoot, selectors);
|
|
30189
|
+
selectors = Array.from(selectors);
|
|
30190
|
+
for (hostRoot = 0;hostRoot < selectors.length; ) {
|
|
30191
|
+
var fiber = selectors[hostRoot++], tag = fiber.tag;
|
|
30192
|
+
if (!isHiddenSubtree(fiber)) {
|
|
30193
|
+
if ((tag === 5 || tag === 26 || tag === 27) && setFocusIfFocusable(fiber.stateNode))
|
|
30194
|
+
return true;
|
|
30195
|
+
for (fiber = fiber.child;fiber !== null; )
|
|
30196
|
+
selectors.push(fiber), fiber = fiber.sibling;
|
|
33027
30197
|
}
|
|
33028
30198
|
}
|
|
33029
|
-
|
|
33030
|
-
|
|
33031
|
-
|
|
33032
|
-
|
|
33033
|
-
|
|
33034
|
-
|
|
33035
|
-
|
|
33036
|
-
|
|
33037
|
-
|
|
33038
|
-
|
|
33039
|
-
|
|
33040
|
-
|
|
33041
|
-
|
|
33042
|
-
return;
|
|
30199
|
+
return false;
|
|
30200
|
+
};
|
|
30201
|
+
exports2.getFindAllNodesFailureDescription = function(hostRoot, selectors) {
|
|
30202
|
+
if (!supportsTestSelectors)
|
|
30203
|
+
throw Error("Test selector API is not supported by this renderer.");
|
|
30204
|
+
var maxSelectorIndex = 0, matchedNames = [];
|
|
30205
|
+
hostRoot = [findFiberRootForHostRoot(hostRoot), 0];
|
|
30206
|
+
for (var index = 0;index < hostRoot.length; ) {
|
|
30207
|
+
var fiber = hostRoot[index++], tag = fiber.tag, selectorIndex = hostRoot[index++], selector = selectors[selectorIndex];
|
|
30208
|
+
if (tag !== 5 && tag !== 26 && tag !== 27 || !isHiddenSubtree(fiber)) {
|
|
30209
|
+
if (matchSelector(fiber, selector) && (matchedNames.push(selectorToString(selector)), selectorIndex++, selectorIndex > maxSelectorIndex && (maxSelectorIndex = selectorIndex)), selectorIndex < selectors.length)
|
|
30210
|
+
for (fiber = fiber.child;fiber !== null; )
|
|
30211
|
+
hostRoot.push(fiber, selectorIndex), fiber = fiber.sibling;
|
|
33043
30212
|
}
|
|
33044
|
-
if (!this.options.verifyClient(info))
|
|
33045
|
-
return abortHandshake(socket, 401);
|
|
33046
30213
|
}
|
|
33047
|
-
|
|
33048
|
-
|
|
33049
|
-
|
|
33050
|
-
|
|
33051
|
-
|
|
33052
|
-
|
|
33053
|
-
|
|
30214
|
+
if (maxSelectorIndex < selectors.length) {
|
|
30215
|
+
for (hostRoot = [];maxSelectorIndex < selectors.length; maxSelectorIndex++)
|
|
30216
|
+
hostRoot.push(selectorToString(selectors[maxSelectorIndex]));
|
|
30217
|
+
return `findAllNodes was able to match part of the selector:
|
|
30218
|
+
` + (matchedNames.join(" > ") + `
|
|
30219
|
+
|
|
30220
|
+
No matching component was found for:
|
|
30221
|
+
`) + hostRoot.join(" > ");
|
|
33054
30222
|
}
|
|
33055
|
-
|
|
33056
|
-
|
|
33057
|
-
|
|
33058
|
-
|
|
33059
|
-
|
|
33060
|
-
|
|
33061
|
-
|
|
33062
|
-
|
|
33063
|
-
|
|
33064
|
-
|
|
33065
|
-
|
|
33066
|
-
|
|
33067
|
-
if (protocol) {
|
|
33068
|
-
headers.push(`Sec-WebSocket-Protocol: ${protocol}`);
|
|
33069
|
-
ws._protocol = protocol;
|
|
33070
|
-
}
|
|
30223
|
+
return null;
|
|
30224
|
+
};
|
|
30225
|
+
exports2.getPublicRootInstance = function(container) {
|
|
30226
|
+
container = container.current;
|
|
30227
|
+
if (!container.child)
|
|
30228
|
+
return null;
|
|
30229
|
+
switch (container.child.tag) {
|
|
30230
|
+
case 27:
|
|
30231
|
+
case 5:
|
|
30232
|
+
return getPublicInstance(container.child.stateNode);
|
|
30233
|
+
default:
|
|
30234
|
+
return container.child.stateNode;
|
|
33071
30235
|
}
|
|
33072
|
-
|
|
33073
|
-
|
|
33074
|
-
|
|
33075
|
-
|
|
30236
|
+
};
|
|
30237
|
+
exports2.injectIntoDevTools = function() {
|
|
30238
|
+
var internals = {
|
|
30239
|
+
bundleType: 1,
|
|
30240
|
+
version: rendererVersion,
|
|
30241
|
+
rendererPackageName,
|
|
30242
|
+
currentDispatcherRef: ReactSharedInternals,
|
|
30243
|
+
reconcilerVersion: "19.2.0"
|
|
30244
|
+
};
|
|
30245
|
+
extraDevToolsConfig !== null && (internals.rendererConfig = extraDevToolsConfig);
|
|
30246
|
+
internals.overrideHookState = overrideHookState;
|
|
30247
|
+
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
|
|
30248
|
+
internals.overrideHookStateRenamePath = overrideHookStateRenamePath;
|
|
30249
|
+
internals.overrideProps = overrideProps;
|
|
30250
|
+
internals.overridePropsDeletePath = overridePropsDeletePath;
|
|
30251
|
+
internals.overridePropsRenamePath = overridePropsRenamePath;
|
|
30252
|
+
internals.scheduleUpdate = scheduleUpdate;
|
|
30253
|
+
internals.scheduleRetry = scheduleRetry;
|
|
30254
|
+
internals.setErrorHandler = setErrorHandler;
|
|
30255
|
+
internals.setSuspenseHandler = setSuspenseHandler;
|
|
30256
|
+
internals.scheduleRefresh = scheduleRefresh;
|
|
30257
|
+
internals.scheduleRoot = scheduleRoot;
|
|
30258
|
+
internals.setRefreshHandler = setRefreshHandler;
|
|
30259
|
+
internals.getCurrentFiber = getCurrentFiberForDevTools;
|
|
30260
|
+
return injectInternals(internals);
|
|
30261
|
+
};
|
|
30262
|
+
exports2.isAlreadyRendering = isAlreadyRendering;
|
|
30263
|
+
exports2.observeVisibleRects = function(hostRoot, selectors, callback, options) {
|
|
30264
|
+
function commitHook() {
|
|
30265
|
+
var nextInstanceRoots = findAllNodes(hostRoot, selectors);
|
|
30266
|
+
instanceRoots.forEach(function(target) {
|
|
30267
|
+
0 > nextInstanceRoots.indexOf(target) && unobserve(target);
|
|
33076
30268
|
});
|
|
33077
|
-
|
|
33078
|
-
|
|
33079
|
-
}
|
|
33080
|
-
this.emit("headers", headers, req);
|
|
33081
|
-
socket.write(headers.concat(`\r
|
|
33082
|
-
`).join(`\r
|
|
33083
|
-
`));
|
|
33084
|
-
socket.removeListener("error", socketOnError);
|
|
33085
|
-
ws.setSocket(socket, head, {
|
|
33086
|
-
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
33087
|
-
maxPayload: this.options.maxPayload,
|
|
33088
|
-
skipUTF8Validation: this.options.skipUTF8Validation
|
|
33089
|
-
});
|
|
33090
|
-
if (this.clients) {
|
|
33091
|
-
this.clients.add(ws);
|
|
33092
|
-
ws.on("close", () => {
|
|
33093
|
-
this.clients.delete(ws);
|
|
33094
|
-
if (this._shouldEmitClose && !this.clients.size) {
|
|
33095
|
-
process.nextTick(emitClose, this);
|
|
33096
|
-
}
|
|
30269
|
+
nextInstanceRoots.forEach(function(target) {
|
|
30270
|
+
0 > instanceRoots.indexOf(target) && observe(target);
|
|
33097
30271
|
});
|
|
33098
30272
|
}
|
|
33099
|
-
|
|
33100
|
-
|
|
33101
|
-
|
|
33102
|
-
|
|
33103
|
-
|
|
33104
|
-
|
|
33105
|
-
|
|
33106
|
-
|
|
33107
|
-
|
|
33108
|
-
|
|
33109
|
-
|
|
30273
|
+
if (!supportsTestSelectors)
|
|
30274
|
+
throw Error("Test selector API is not supported by this renderer.");
|
|
30275
|
+
var instanceRoots = findAllNodes(hostRoot, selectors);
|
|
30276
|
+
callback = setupIntersectionObserver(instanceRoots, callback, options);
|
|
30277
|
+
var { disconnect, observe, unobserve } = callback;
|
|
30278
|
+
commitHooks.push(commitHook);
|
|
30279
|
+
return {
|
|
30280
|
+
disconnect: function() {
|
|
30281
|
+
var index = commitHooks.indexOf(commitHook);
|
|
30282
|
+
0 <= index && commitHooks.splice(index, 1);
|
|
30283
|
+
disconnect();
|
|
30284
|
+
}
|
|
30285
|
+
};
|
|
33110
30286
|
};
|
|
33111
|
-
|
|
33112
|
-
|
|
33113
|
-
server._state = CLOSED;
|
|
33114
|
-
server.emit("close");
|
|
33115
|
-
}
|
|
33116
|
-
function socketOnError() {
|
|
33117
|
-
this.destroy();
|
|
33118
|
-
}
|
|
33119
|
-
function abortHandshake(socket, code, message, headers) {
|
|
33120
|
-
message = message || http.STATUS_CODES[code];
|
|
33121
|
-
headers = {
|
|
33122
|
-
Connection: "close",
|
|
33123
|
-
"Content-Type": "text/html",
|
|
33124
|
-
"Content-Length": Buffer.byteLength(message),
|
|
33125
|
-
...headers
|
|
30287
|
+
exports2.shouldError = function(fiber) {
|
|
30288
|
+
return shouldErrorImpl(fiber);
|
|
33126
30289
|
};
|
|
33127
|
-
|
|
33128
|
-
|
|
33129
|
-
|
|
33130
|
-
|
|
33131
|
-
|
|
33132
|
-
|
|
33133
|
-
|
|
33134
|
-
|
|
33135
|
-
|
|
33136
|
-
|
|
33137
|
-
|
|
33138
|
-
|
|
33139
|
-
|
|
33140
|
-
|
|
33141
|
-
|
|
30290
|
+
exports2.shouldSuspend = function(fiber) {
|
|
30291
|
+
return shouldSuspendImpl(fiber);
|
|
30292
|
+
};
|
|
30293
|
+
exports2.startHostTransition = function(formFiber, pendingState, action, formData) {
|
|
30294
|
+
if (formFiber.tag !== 5)
|
|
30295
|
+
throw Error("Expected the form instance to be a HostComponent. This is a bug in React.");
|
|
30296
|
+
var queue = ensureFormComponentIsStateful(formFiber).queue;
|
|
30297
|
+
startHostActionTimer(formFiber);
|
|
30298
|
+
startTransition(formFiber, queue, pendingState, NotPendingTransition, action === null ? noop : function() {
|
|
30299
|
+
ReactSharedInternals.T === null && console.error("requestFormReset was called outside a transition or action. To fix, move to an action, or wrap with startTransition.");
|
|
30300
|
+
var stateHook = ensureFormComponentIsStateful(formFiber);
|
|
30301
|
+
stateHook.next === null && (stateHook = formFiber.alternate.memoizedState);
|
|
30302
|
+
dispatchSetStateInternal(formFiber, stateHook.next.queue, {}, requestUpdateLane(formFiber));
|
|
30303
|
+
return action(formData);
|
|
30304
|
+
});
|
|
30305
|
+
};
|
|
30306
|
+
exports2.updateContainer = function(element, container, parentComponent, callback) {
|
|
30307
|
+
var current2 = container.current, lane = requestUpdateLane(current2);
|
|
30308
|
+
updateContainerImpl(current2, lane, element, container, parentComponent, callback);
|
|
30309
|
+
return lane;
|
|
30310
|
+
};
|
|
30311
|
+
exports2.updateContainerSync = updateContainerSync;
|
|
30312
|
+
return exports2;
|
|
30313
|
+
}, module.exports.default = module.exports, Object.defineProperty(module.exports, "__esModule", { value: true });
|
|
30314
|
+
});
|
|
30315
|
+
|
|
30316
|
+
// node_modules/react-reconciler/index.js
|
|
30317
|
+
var require_react_reconciler = __commonJS((exports, module) => {
|
|
30318
|
+
if (false) {} else {
|
|
30319
|
+
module.exports = require_react_reconciler_development();
|
|
33142
30320
|
}
|
|
33143
30321
|
});
|
|
33144
30322
|
|
|
33145
|
-
// node_modules/
|
|
33146
|
-
var import_stream, import_receiver, import_sender, import_websocket5, import_websocket_server, wrapper_default;
|
|
30323
|
+
// node_modules/ws/wrapper.mjs
|
|
30324
|
+
var import_stream, import_extension, import_permessage_deflate, import_receiver, import_sender, import_subprotocol, import_websocket5, import_websocket_server, wrapper_default;
|
|
33147
30325
|
var init_wrapper = __esm(() => {
|
|
33148
|
-
import_stream = __toESM(
|
|
33149
|
-
|
|
33150
|
-
|
|
33151
|
-
|
|
33152
|
-
|
|
30326
|
+
import_stream = __toESM(require_stream(), 1);
|
|
30327
|
+
import_extension = __toESM(require_extension(), 1);
|
|
30328
|
+
import_permessage_deflate = __toESM(require_permessage_deflate(), 1);
|
|
30329
|
+
import_receiver = __toESM(require_receiver(), 1);
|
|
30330
|
+
import_sender = __toESM(require_sender(), 1);
|
|
30331
|
+
import_subprotocol = __toESM(require_subprotocol(), 1);
|
|
30332
|
+
import_websocket5 = __toESM(require_websocket(), 1);
|
|
30333
|
+
import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
33153
30334
|
wrapper_default = import_websocket5.default;
|
|
33154
30335
|
});
|
|
33155
30336
|
|
|
@@ -83665,6 +80846,9 @@ async function handleMessage(client, session, post2, user, options) {
|
|
|
83665
80846
|
return;
|
|
83666
80847
|
}
|
|
83667
80848
|
}
|
|
80849
|
+
if (persistedSession?.respondOnlyWhenMentioned && !client.isBotMentioned(message)) {
|
|
80850
|
+
return;
|
|
80851
|
+
}
|
|
83668
80852
|
const files2 = post2.metadata?.files;
|
|
83669
80853
|
if (content || files2?.length) {
|
|
83670
80854
|
await session.resumePausedSession(threadRoot, content, files2, username);
|