basant307/AI_Governance_Project
048
1"use strict";Object.defineProperty(exports, "__esModule", {value: true});2 3 4 5var _chunkLK6DILFKjs = require('./chunk-LK6DILFK.js');6 7 8var _chunkPFGO5BSMjs = require('./chunk-PFGO5BSM.js');9 10 11var _chunk73NOP3T5js = require('./chunk-73NOP3T5.js');12 13 14 15var _chunkC2JSMMHYjs = require('./chunk-C2JSMMHY.js');16 17 18 19 20 21var _chunkA7U44ARPjs = require('./chunk-A7U44ARP.js');22 23 24var _chunkSMXZPJEAjs = require('./chunk-SMXZPJEA.js');25 26// src/interceptors/XMLHttpRequest/index.ts27var _outvariant = require('outvariant');28 29// src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts30 31var _isnodeprocess = require('is-node-process');32 33// src/interceptors/XMLHttpRequest/utils/concatArrayBuffer.ts34function concatArrayBuffer(left, right) {35 const result = new Uint8Array(left.byteLength + right.byteLength);36 result.set(left, 0);37 result.set(right, left.byteLength);38 return result;39}40 41// src/interceptors/XMLHttpRequest/polyfills/EventPolyfill.ts42var EventPolyfill = class {43 constructor(type, options) {44 this.NONE = 0;45 this.CAPTURING_PHASE = 1;46 this.AT_TARGET = 2;47 this.BUBBLING_PHASE = 3;48 this.type = "";49 this.srcElement = null;50 this.currentTarget = null;51 this.eventPhase = 0;52 this.isTrusted = true;53 this.composed = false;54 this.cancelable = true;55 this.defaultPrevented = false;56 this.bubbles = true;57 this.lengthComputable = true;58 this.loaded = 0;59 this.total = 0;60 this.cancelBubble = false;61 this.returnValue = true;62 this.type = type;63 this.target = (options == null ? void 0 : options.target) || null;64 this.currentTarget = (options == null ? void 0 : options.currentTarget) || null;65 this.timeStamp = Date.now();66 }67 composedPath() {68 return [];69 }70 initEvent(type, bubbles, cancelable) {71 this.type = type;72 this.bubbles = !!bubbles;73 this.cancelable = !!cancelable;74 }75 preventDefault() {76 this.defaultPrevented = true;77 }78 stopPropagation() {79 }80 stopImmediatePropagation() {81 }82};83 84// src/interceptors/XMLHttpRequest/polyfills/ProgressEventPolyfill.ts85var ProgressEventPolyfill = class extends EventPolyfill {86 constructor(type, init) {87 super(type);88 this.lengthComputable = (init == null ? void 0 : init.lengthComputable) || false;89 this.composed = (init == null ? void 0 : init.composed) || false;90 this.loaded = (init == null ? void 0 : init.loaded) || 0;91 this.total = (init == null ? void 0 : init.total) || 0;92 }93};94 95// src/interceptors/XMLHttpRequest/utils/createEvent.ts96var SUPPORTS_PROGRESS_EVENT = typeof ProgressEvent !== "undefined";97function createEvent(target, type, init) {98 const progressEvents = [99 "error",100 "progress",101 "loadstart",102 "loadend",103 "load",104 "timeout",105 "abort"106 ];107 const ProgressEventClass = SUPPORTS_PROGRESS_EVENT ? ProgressEvent : ProgressEventPolyfill;108 const event = progressEvents.includes(type) ? new ProgressEventClass(type, {109 lengthComputable: true,110 loaded: (init == null ? void 0 : init.loaded) || 0,111 total: (init == null ? void 0 : init.total) || 0112 }) : new EventPolyfill(type, {113 target,114 currentTarget: target115 });116 return event;117}118 119// src/utils/findPropertySource.ts120function findPropertySource(target, propertyName) {121 if (!(propertyName in target)) {122 return null;123 }124 const hasProperty = Object.prototype.hasOwnProperty.call(target, propertyName);125 if (hasProperty) {126 return target;127 }128 const prototype = Reflect.getPrototypeOf(target);129 return prototype ? findPropertySource(prototype, propertyName) : null;130}131 132// src/utils/createProxy.ts133function createProxy(target, options) {134 const proxy = new Proxy(target, optionsToProxyHandler(options));135 return proxy;136}137function optionsToProxyHandler(options) {138 const { constructorCall, methodCall, getProperty, setProperty } = options;139 const handler = {};140 if (typeof constructorCall !== "undefined") {141 handler.construct = function(target, args, newTarget) {142 const next = Reflect.construct.bind(null, target, args, newTarget);143 return constructorCall.call(newTarget, args, next);144 };145 }146 handler.set = function(target, propertyName, nextValue) {147 const next = () => {148 const propertySource = findPropertySource(target, propertyName) || target;149 const ownDescriptors = Reflect.getOwnPropertyDescriptor(150 propertySource,151 propertyName152 );153 if (typeof (ownDescriptors == null ? void 0 : ownDescriptors.set) !== "undefined") {154 ownDescriptors.set.apply(target, [nextValue]);155 return true;156 }157 return Reflect.defineProperty(propertySource, propertyName, {158 writable: true,159 enumerable: true,160 configurable: true,161 value: nextValue162 });163 };164 if (typeof setProperty !== "undefined") {165 return setProperty.call(target, [propertyName, nextValue], next);166 }167 return next();168 };169 handler.get = function(target, propertyName, receiver) {170 const next = () => target[propertyName];171 const value = typeof getProperty !== "undefined" ? getProperty.call(target, [propertyName, receiver], next) : next();172 if (typeof value === "function") {173 return (...args) => {174 const next2 = value.bind(target, ...args);175 if (typeof methodCall !== "undefined") {176 return methodCall.call(target, [propertyName, args], next2);177 }178 return next2();179 };180 }181 return value;182 };183 return handler;184}185 186// src/interceptors/XMLHttpRequest/utils/isDomParserSupportedType.ts187function isDomParserSupportedType(type) {188 const supportedTypes = [189 "application/xhtml+xml",190 "application/xml",191 "image/svg+xml",192 "text/html",193 "text/xml"194 ];195 return supportedTypes.some((supportedType) => {196 return type.startsWith(supportedType);197 });198}199 200// src/utils/parseJson.ts201function parseJson(data) {202 try {203 const json = JSON.parse(data);204 return json;205 } catch (_) {206 return null;207 }208}209 210// src/interceptors/XMLHttpRequest/utils/createResponse.ts211function createResponse(request, body) {212 const responseBodyOrNull = _chunkA7U44ARPjs.FetchResponse.isResponseWithBody(request.status) ? body : null;213 return new (0, _chunkA7U44ARPjs.FetchResponse)(responseBodyOrNull, {214 url: request.responseURL,215 status: request.status,216 statusText: request.statusText,217 headers: createHeadersFromXMLHttpReqestHeaders(218 request.getAllResponseHeaders()219 )220 });221}222function createHeadersFromXMLHttpReqestHeaders(headersString) {223 const headers = new Headers();224 const lines = headersString.split(/[\r\n]+/);225 for (const line of lines) {226 if (line.trim() === "") {227 continue;228 }229 const [name, ...parts] = line.split(": ");230 const value = parts.join(": ");231 headers.append(name, value);232 }233 return headers;234}235 236// src/interceptors/XMLHttpRequest/utils/getBodyByteLength.ts237async function getBodyByteLength(input) {238 const explicitContentLength = input.headers.get("content-length");239 if (explicitContentLength != null && explicitContentLength !== "") {240 return Number(explicitContentLength);241 }242 const buffer = await input.arrayBuffer();243 return buffer.byteLength;244}245 246// src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts247var kIsRequestHandled = Symbol("kIsRequestHandled");248var IS_NODE = _isnodeprocess.isNodeProcess.call(void 0, );249var kFetchRequest = Symbol("kFetchRequest");250var XMLHttpRequestController = class {251 constructor(initialRequest, logger) {252 this.initialRequest = initialRequest;253 this.logger = logger;254 this.method = "GET";255 this.url = null;256 this[kIsRequestHandled] = false;257 this.events = /* @__PURE__ */ new Map();258 this.uploadEvents = /* @__PURE__ */ new Map();259 this.requestId = _chunkA7U44ARPjs.createRequestId.call(void 0, );260 this.requestHeaders = new Headers();261 this.responseBuffer = new Uint8Array();262 this.request = createProxy(initialRequest, {263 setProperty: ([propertyName, nextValue], invoke) => {264 switch (propertyName) {265 case "ontimeout": {266 const eventName = propertyName.slice(267 2268 );269 this.request.addEventListener(eventName, nextValue);270 return invoke();271 }272 default: {273 return invoke();274 }275 }276 },277 methodCall: ([methodName, args], invoke) => {278 var _a;279 switch (methodName) {280 case "open": {281 const [method, url] = args;282 if (typeof url === "undefined") {283 this.method = "GET";284 this.url = toAbsoluteUrl(method);285 } else {286 this.method = method;287 this.url = toAbsoluteUrl(url);288 }289 this.logger = this.logger.extend(`${this.method} ${this.url.href}`);290 this.logger.info("open", this.method, this.url.href);291 return invoke();292 }293 case "addEventListener": {294 const [eventName, listener] = args;295 this.registerEvent(eventName, listener);296 this.logger.info("addEventListener", eventName, listener);297 return invoke();298 }299 case "setRequestHeader": {300 const [name, value] = args;301 this.requestHeaders.set(name, value);302 this.logger.info("setRequestHeader", name, value);303 return invoke();304 }305 case "send": {306 const [body] = args;307 this.request.addEventListener("load", () => {308 if (typeof this.onResponse !== "undefined") {309 const fetchResponse = createResponse(310 this.request,311 /**312 * The `response` property is the right way to read313 * the ambiguous response body, as the request's "responseType" may differ.314 * @see https://xhr.spec.whatwg.org/#the-response-attribute315 */316 this.request.response317 );318 this.onResponse.call(this, {319 response: fetchResponse,320 isMockedResponse: this[kIsRequestHandled],321 request: fetchRequest,322 requestId: this.requestId323 });324 }325 });326 const requestBody = typeof body === "string" ? _chunkLK6DILFKjs.encodeBuffer.call(void 0, body) : body;327 const fetchRequest = this.toFetchApiRequest(requestBody);328 this[kFetchRequest] = fetchRequest.clone();329 const onceRequestSettled = ((_a = this.onRequest) == null ? void 0 : _a.call(this, {330 request: fetchRequest,331 requestId: this.requestId332 })) || Promise.resolve();333 onceRequestSettled.finally(() => {334 if (!this[kIsRequestHandled]) {335 this.logger.info(336 "request callback settled but request has not been handled (readystate %d), performing as-is...",337 this.request.readyState338 );339 if (IS_NODE) {340 this.request.setRequestHeader(341 _chunkA7U44ARPjs.INTERNAL_REQUEST_ID_HEADER_NAME,342 this.requestId343 );344 }345 return invoke();346 }347 });348 break;349 }350 default: {351 return invoke();352 }353 }354 }355 });356 define(357 this.request,358 "upload",359 createProxy(this.request.upload, {360 setProperty: ([propertyName, nextValue], invoke) => {361 switch (propertyName) {362 case "onloadstart":363 case "onprogress":364 case "onaboart":365 case "onerror":366 case "onload":367 case "ontimeout":368 case "onloadend": {369 const eventName = propertyName.slice(370 2371 );372 this.registerUploadEvent(eventName, nextValue);373 }374 }375 return invoke();376 },377 methodCall: ([methodName, args], invoke) => {378 switch (methodName) {379 case "addEventListener": {380 const [eventName, listener] = args;381 this.registerUploadEvent(eventName, listener);382 this.logger.info("upload.addEventListener", eventName, listener);383 return invoke();384 }385 }386 }387 })388 );389 }390 registerEvent(eventName, listener) {391 const prevEvents = this.events.get(eventName) || [];392 const nextEvents = prevEvents.concat(listener);393 this.events.set(eventName, nextEvents);394 this.logger.info('registered event "%s"', eventName, listener);395 }396 registerUploadEvent(eventName, listener) {397 const prevEvents = this.uploadEvents.get(eventName) || [];398 const nextEvents = prevEvents.concat(listener);399 this.uploadEvents.set(eventName, nextEvents);400 this.logger.info('registered upload event "%s"', eventName, listener);401 }402 /**403 * Responds to the current request with the given404 * Fetch API `Response` instance.405 */406 async respondWith(response) {407 this[kIsRequestHandled] = true;408 if (this[kFetchRequest]) {409 const totalRequestBodyLength = await getBodyByteLength(410 this[kFetchRequest]411 );412 this.trigger("loadstart", this.request.upload, {413 loaded: 0,414 total: totalRequestBodyLength415 });416 this.trigger("progress", this.request.upload, {417 loaded: totalRequestBodyLength,418 total: totalRequestBodyLength419 });420 this.trigger("load", this.request.upload, {421 loaded: totalRequestBodyLength,422 total: totalRequestBodyLength423 });424 this.trigger("loadend", this.request.upload, {425 loaded: totalRequestBodyLength,426 total: totalRequestBodyLength427 });428 }429 this.logger.info(430 "responding with a mocked response: %d %s",431 response.status,432 response.statusText433 );434 define(this.request, "status", response.status);435 define(this.request, "statusText", response.statusText);436 define(this.request, "responseURL", this.url.href);437 this.request.getResponseHeader = new Proxy(this.request.getResponseHeader, {438 apply: (_, __, args) => {439 this.logger.info("getResponseHeader", args[0]);440 if (this.request.readyState < this.request.HEADERS_RECEIVED) {441 this.logger.info("headers not received yet, returning null");442 return null;443 }444 const headerValue = response.headers.get(args[0]);445 this.logger.info(446 'resolved response header "%s" to',447 args[0],448 headerValue449 );450 return headerValue;451 }452 });453 this.request.getAllResponseHeaders = new Proxy(454 this.request.getAllResponseHeaders,455 {456 apply: () => {457 this.logger.info("getAllResponseHeaders");458 if (this.request.readyState < this.request.HEADERS_RECEIVED) {459 this.logger.info("headers not received yet, returning empty string");460 return "";461 }462 const headersList = Array.from(response.headers.entries());463 const allHeaders = headersList.map(([headerName, headerValue]) => {464 return `${headerName}: ${headerValue}`;465 }).join("\r\n");466 this.logger.info("resolved all response headers to", allHeaders);467 return allHeaders;468 }469 }470 );471 Object.defineProperties(this.request, {472 response: {473 enumerable: true,474 configurable: false,475 get: () => this.response476 },477 responseText: {478 enumerable: true,479 configurable: false,480 get: () => this.responseText481 },482 responseXML: {483 enumerable: true,484 configurable: false,485 get: () => this.responseXML486 }487 });488 const totalResponseBodyLength = await getBodyByteLength(response.clone());489 this.logger.info("calculated response body length", totalResponseBodyLength);490 this.trigger("loadstart", this.request, {491 loaded: 0,492 total: totalResponseBodyLength493 });494 this.setReadyState(this.request.HEADERS_RECEIVED);495 this.setReadyState(this.request.LOADING);496 const finalizeResponse = () => {497 this.logger.info("finalizing the mocked response...");498 this.setReadyState(this.request.DONE);499 this.trigger("load", this.request, {500 loaded: this.responseBuffer.byteLength,501 total: totalResponseBodyLength502 });503 this.trigger("loadend", this.request, {504 loaded: this.responseBuffer.byteLength,505 total: totalResponseBodyLength506 });507 };508 if (response.body) {509 this.logger.info("mocked response has body, streaming...");510 const reader = response.body.getReader();511 const readNextResponseBodyChunk = async () => {512 const { value, done } = await reader.read();513 if (done) {514 this.logger.info("response body stream done!");515 finalizeResponse();516 return;517 }518 if (value) {519 this.logger.info("read response body chunk:", value);520 this.responseBuffer = concatArrayBuffer(this.responseBuffer, value);521 this.trigger("progress", this.request, {522 loaded: this.responseBuffer.byteLength,523 total: totalResponseBodyLength524 });525 }526 readNextResponseBodyChunk();527 };528 readNextResponseBodyChunk();529 } else {530 finalizeResponse();531 }532 }533 responseBufferToText() {534 return _chunkLK6DILFKjs.decodeBuffer.call(void 0, this.responseBuffer);535 }536 get response() {537 this.logger.info(538 "getResponse (responseType: %s)",539 this.request.responseType540 );541 if (this.request.readyState !== this.request.DONE) {542 return null;543 }544 switch (this.request.responseType) {545 case "json": {546 const responseJson = parseJson(this.responseBufferToText());547 this.logger.info("resolved response JSON", responseJson);548 return responseJson;549 }550 case "arraybuffer": {551 const arrayBuffer = _chunkLK6DILFKjs.toArrayBuffer.call(void 0, this.responseBuffer);552 this.logger.info("resolved response ArrayBuffer", arrayBuffer);553 return arrayBuffer;554 }555 case "blob": {556 const mimeType = this.request.getResponseHeader("Content-Type") || "text/plain";557 const responseBlob = new Blob([this.responseBufferToText()], {558 type: mimeType559 });560 this.logger.info(561 "resolved response Blob (mime type: %s)",562 responseBlob,563 mimeType564 );565 return responseBlob;566 }567 default: {568 const responseText = this.responseBufferToText();569 this.logger.info(570 'resolving "%s" response type as text',571 this.request.responseType,572 responseText573 );574 return responseText;575 }576 }577 }578 get responseText() {579 _outvariant.invariant.call(void 0, 580 this.request.responseType === "" || this.request.responseType === "text",581 "InvalidStateError: The object is in invalid state."582 );583 if (this.request.readyState !== this.request.LOADING && this.request.readyState !== this.request.DONE) {584 return "";585 }586 const responseText = this.responseBufferToText();587 this.logger.info('getResponseText: "%s"', responseText);588 return responseText;589 }590 get responseXML() {591 _outvariant.invariant.call(void 0, 592 this.request.responseType === "" || this.request.responseType === "document",593 "InvalidStateError: The object is in invalid state."594 );595 if (this.request.readyState !== this.request.DONE) {596 return null;597 }598 const contentType = this.request.getResponseHeader("Content-Type") || "";599 if (typeof DOMParser === "undefined") {600 console.warn(601 "Cannot retrieve XMLHttpRequest response body as XML: DOMParser is not defined. You are likely using an environment that is not browser or does not polyfill browser globals correctly."602 );603 return null;604 }605 if (isDomParserSupportedType(contentType)) {606 return new DOMParser().parseFromString(607 this.responseBufferToText(),608 contentType609 );610 }611 return null;612 }613 errorWith(error) {614 this[kIsRequestHandled] = true;615 this.logger.info("responding with an error");616 this.setReadyState(this.request.DONE);617 this.trigger("error", this.request);618 this.trigger("loadend", this.request);619 }620 /**621 * Transitions this request's `readyState` to the given one.622 */623 setReadyState(nextReadyState) {624 this.logger.info(625 "setReadyState: %d -> %d",626 this.request.readyState,627 nextReadyState628 );629 if (this.request.readyState === nextReadyState) {630 this.logger.info("ready state identical, skipping transition...");631 return;632 }633 define(this.request, "readyState", nextReadyState);634 this.logger.info("set readyState to: %d", nextReadyState);635 if (nextReadyState !== this.request.UNSENT) {636 this.logger.info('triggerring "readystatechange" event...');637 this.trigger("readystatechange", this.request);638 }639 }640 /**641 * Triggers given event on the `XMLHttpRequest` instance.642 */643 trigger(eventName, target, options) {644 const callback = target[`on${eventName}`];645 const event = createEvent(target, eventName, options);646 this.logger.info('trigger "%s"', eventName, options || "");647 if (typeof callback === "function") {648 this.logger.info('found a direct "%s" callback, calling...', eventName);649 callback.call(target, event);650 }651 const events = target instanceof XMLHttpRequestUpload ? this.uploadEvents : this.events;652 for (const [registeredEventName, listeners] of events) {653 if (registeredEventName === eventName) {654 this.logger.info(655 'found %d listener(s) for "%s" event, calling...',656 listeners.length,657 eventName658 );659 listeners.forEach((listener) => listener.call(target, event));660 }661 }662 }663 /**664 * Converts this `XMLHttpRequest` instance into a Fetch API `Request` instance.665 */666 toFetchApiRequest(body) {667 this.logger.info("converting request to a Fetch API Request...");668 const resolvedBody = body instanceof Document ? body.documentElement.innerText : body;669 const fetchRequest = new Request(this.url.href, {670 method: this.method,671 headers: this.requestHeaders,672 /**673 * @see https://xhr.spec.whatwg.org/#cross-origin-credentials674 */675 credentials: this.request.withCredentials ? "include" : "same-origin",676 body: ["GET", "HEAD"].includes(this.method.toUpperCase()) ? null : resolvedBody677 });678 const proxyHeaders = createProxy(fetchRequest.headers, {679 methodCall: ([methodName, args], invoke) => {680 switch (methodName) {681 case "append":682 case "set": {683 const [headerName, headerValue] = args;684 this.request.setRequestHeader(headerName, headerValue);685 break;686 }687 case "delete": {688 const [headerName] = args;689 console.warn(690 `XMLHttpRequest: Cannot remove a "${headerName}" header from the Fetch API representation of the "${fetchRequest.method} ${fetchRequest.url}" request. XMLHttpRequest headers cannot be removed.`691 );692 break;693 }694 }695 return invoke();696 }697 });698 define(fetchRequest, "headers", proxyHeaders);699 _chunkSMXZPJEAjs.setRawRequest.call(void 0, fetchRequest, this.request);700 this.logger.info("converted request to a Fetch API Request!", fetchRequest);701 return fetchRequest;702 }703};704kIsRequestHandled, kFetchRequest;705function toAbsoluteUrl(url) {706 if (typeof location === "undefined") {707 return new URL(url);708 }709 return new URL(url.toString(), location.href);710}711function define(target, property, value) {712 Reflect.defineProperty(target, property, {713 // Ensure writable properties to allow redefining readonly properties.714 writable: true,715 enumerable: true,716 value717 });718}719 720// src/interceptors/XMLHttpRequest/XMLHttpRequestProxy.ts721function createXMLHttpRequestProxy({722 emitter,723 logger724}) {725 const XMLHttpRequestProxy = new Proxy(globalThis.XMLHttpRequest, {726 construct(target, args, newTarget) {727 logger.info("constructed new XMLHttpRequest");728 const originalRequest = Reflect.construct(729 target,730 args,731 newTarget732 );733 const prototypeDescriptors = Object.getOwnPropertyDescriptors(734 target.prototype735 );736 for (const propertyName in prototypeDescriptors) {737 Reflect.defineProperty(738 originalRequest,739 propertyName,740 prototypeDescriptors[propertyName]741 );742 }743 const xhrRequestController = new XMLHttpRequestController(744 originalRequest,745 logger746 );747 xhrRequestController.onRequest = async function({ request, requestId }) {748 const controller = new (0, _chunkC2JSMMHYjs.RequestController)(request);749 this.logger.info("awaiting mocked response...");750 this.logger.info(751 'emitting the "request" event for %s listener(s)...',752 emitter.listenerCount("request")753 );754 const isRequestHandled = await _chunkC2JSMMHYjs.handleRequest.call(void 0, {755 request,756 requestId,757 controller,758 emitter,759 onResponse: async (response) => {760 await this.respondWith(response);761 },762 onRequestError: () => {763 this.errorWith(new TypeError("Network error"));764 },765 onError: (error) => {766 this.logger.info("request errored!", { error });767 if (error instanceof Error) {768 this.errorWith(error);769 }770 }771 });772 if (!isRequestHandled) {773 this.logger.info(774 "no mocked response received, performing request as-is..."775 );776 }777 };778 xhrRequestController.onResponse = async function({779 response,780 isMockedResponse,781 request,782 requestId783 }) {784 this.logger.info(785 'emitting the "response" event for %s listener(s)...',786 emitter.listenerCount("response")787 );788 emitter.emit("response", {789 response,790 isMockedResponse,791 request,792 requestId793 });794 };795 return xhrRequestController.request;796 }797 });798 return XMLHttpRequestProxy;799}800 801// src/interceptors/XMLHttpRequest/index.ts802var _XMLHttpRequestInterceptor = class extends _chunkA7U44ARPjs.Interceptor {803 constructor() {804 super(_XMLHttpRequestInterceptor.interceptorSymbol);805 }806 checkEnvironment() {807 return _chunkPFGO5BSMjs.hasConfigurableGlobal.call(void 0, "XMLHttpRequest");808 }809 setup() {810 const logger = this.logger.extend("setup");811 logger.info('patching "XMLHttpRequest" module...');812 const PureXMLHttpRequest = globalThis.XMLHttpRequest;813 _outvariant.invariant.call(void 0, 814 !PureXMLHttpRequest[_chunk73NOP3T5js.IS_PATCHED_MODULE],815 'Failed to patch the "XMLHttpRequest" module: already patched.'816 );817 globalThis.XMLHttpRequest = createXMLHttpRequestProxy({818 emitter: this.emitter,819 logger: this.logger820 });821 logger.info(822 'native "XMLHttpRequest" module patched!',823 globalThis.XMLHttpRequest.name824 );825 Object.defineProperty(globalThis.XMLHttpRequest, _chunk73NOP3T5js.IS_PATCHED_MODULE, {826 enumerable: true,827 configurable: true,828 value: true829 });830 this.subscriptions.push(() => {831 Object.defineProperty(globalThis.XMLHttpRequest, _chunk73NOP3T5js.IS_PATCHED_MODULE, {832 value: void 0833 });834 globalThis.XMLHttpRequest = PureXMLHttpRequest;835 logger.info(836 'native "XMLHttpRequest" module restored!',837 globalThis.XMLHttpRequest.name838 );839 });840 }841};842var XMLHttpRequestInterceptor = _XMLHttpRequestInterceptor;843XMLHttpRequestInterceptor.interceptorSymbol = Symbol("xhr");844 845 846 847exports.XMLHttpRequestInterceptor = XMLHttpRequestInterceptor;848//# sourceMappingURL=chunk-4WG2AM2T.js.map