From 2bceda39122b2cc71e6e26ad729b92b44d101f4b Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Sun, 24 Mar 2024 09:56:50 +0100 Subject: [PATCH] "update dependencies" --- dist/restore/index.js | 15359 +++++++++++++++++++++------------------- dist/save/index.js | 15359 +++++++++++++++++++++------------------- package-lock.json | 106 +- package.json | 2 +- 4 files changed, 15814 insertions(+), 15012 deletions(-) diff --git a/dist/restore/index.js b/dist/restore/index.js index 640ab67..ef32a83 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -9598,7 +9598,7 @@ class HttpClient { if (this._keepAlive && useProxy) { agent = this._proxyAgent; } - if (this._keepAlive && !useProxy) { + if (!useProxy) { agent = this._agent; } // if agent is already assigned use that agent. @@ -9630,16 +9630,12 @@ class HttpClient { agent = tunnelAgent(agentOptions); this._proxyAgent = agent; } - // if reusing agent across request and tunneling agent isn't assigned create a new agent - if (this._keepAlive && !agent) { + // if tunneling agent isn't assigned create a new agent + if (!agent) { const options = { keepAlive: this._keepAlive, maxSockets }; agent = usingSsl ? new https.Agent(options) : new http.Agent(options); this._agent = agent; } - // if not using private agent and tunnel agent isn't setup then use global agent - if (!agent) { - agent = usingSsl ? https.globalAgent : http.globalAgent; - } if (usingSsl && this._ignoreSslError) { // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options @@ -10583,206 +10579,6 @@ exports.AbortSignal = AbortSignal; //# sourceMappingURL=index.js.map -/***/ }), - -/***/ 9645: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var coreUtil = __nccwpck_require__(1333); - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * A static-key-based credential that supports updating - * the underlying key value. - */ -class AzureKeyCredential { - /** - * The value of the key to be used in authentication - */ - get key() { - return this._key; - } - /** - * Create an instance of an AzureKeyCredential for use - * with a service client. - * - * @param key - The initial value of the key to use in authentication - */ - constructor(key) { - if (!key) { - throw new Error("key must be a non-empty string"); - } - this._key = key; - } - /** - * Change the value of the key. - * - * Updates will take effect upon the next request after - * updating the key value. - * - * @param newKey - The new key value to be used - */ - update(newKey) { - this._key = newKey; - } -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Tests an object to determine whether it implements KeyCredential. - * - * @param credential - The assumed KeyCredential to be tested. - */ -function isKeyCredential(credential) { - return coreUtil.isObjectWithProperties(credential, ["key"]) && typeof credential.key === "string"; -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * A static name/key-based credential that supports updating - * the underlying name and key values. - */ -class AzureNamedKeyCredential { - /** - * The value of the key to be used in authentication. - */ - get key() { - return this._key; - } - /** - * The value of the name to be used in authentication. - */ - get name() { - return this._name; - } - /** - * Create an instance of an AzureNamedKeyCredential for use - * with a service client. - * - * @param name - The initial value of the name to use in authentication. - * @param key - The initial value of the key to use in authentication. - */ - constructor(name, key) { - if (!name || !key) { - throw new TypeError("name and key must be non-empty strings"); - } - this._name = name; - this._key = key; - } - /** - * Change the value of the key. - * - * Updates will take effect upon the next request after - * updating the key value. - * - * @param newName - The new name value to be used. - * @param newKey - The new key value to be used. - */ - update(newName, newKey) { - if (!newName || !newKey) { - throw new TypeError("newName and newKey must be non-empty strings"); - } - this._name = newName; - this._key = newKey; - } -} -/** - * Tests an object to determine whether it implements NamedKeyCredential. - * - * @param credential - The assumed NamedKeyCredential to be tested. - */ -function isNamedKeyCredential(credential) { - return (coreUtil.isObjectWithProperties(credential, ["name", "key"]) && - typeof credential.key === "string" && - typeof credential.name === "string"); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * A static-signature-based credential that supports updating - * the underlying signature value. - */ -class AzureSASCredential { - /** - * The value of the shared access signature to be used in authentication - */ - get signature() { - return this._signature; - } - /** - * Create an instance of an AzureSASCredential for use - * with a service client. - * - * @param signature - The initial value of the shared access signature to use in authentication - */ - constructor(signature) { - if (!signature) { - throw new Error("shared access signature must be a non-empty string"); - } - this._signature = signature; - } - /** - * Change the value of the signature. - * - * Updates will take effect upon the next request after - * updating the signature value. - * - * @param newSignature - The new shared access signature value to be used - */ - update(newSignature) { - if (!newSignature) { - throw new Error("shared access signature must be a non-empty string"); - } - this._signature = newSignature; - } -} -/** - * Tests an object to determine whether it implements SASCredential. - * - * @param credential - The assumed SASCredential to be tested. - */ -function isSASCredential(credential) { - return (coreUtil.isObjectWithProperties(credential, ["signature"]) && typeof credential.signature === "string"); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Tests an object to determine whether it implements TokenCredential. - * - * @param credential - The assumed TokenCredential to be tested. - */ -function isTokenCredential(credential) { - // Check for an object with a 'getToken' function and possibly with - // a 'signRequest' function. We do this check to make sure that - // a ServiceClientCredentials implementor (like TokenClientCredentials - // in ms-rest-nodeauth) doesn't get mistaken for a TokenCredential if - // it doesn't actually implement TokenCredential also. - const castCredential = credential; - return (castCredential && - typeof castCredential.getToken === "function" && - (castCredential.signRequest === undefined || castCredential.getToken.length > 0)); -} - -exports.AzureKeyCredential = AzureKeyCredential; -exports.AzureNamedKeyCredential = AzureNamedKeyCredential; -exports.AzureSASCredential = AzureSASCredential; -exports.isKeyCredential = isKeyCredential; -exports.isNamedKeyCredential = isNamedKeyCredential; -exports.isSASCredential = isSASCredential; -exports.isTokenCredential = isTokenCredential; -//# sourceMappingURL=index.js.map - - /***/ }), /***/ 4607: @@ -10797,9 +10593,9 @@ var uuid = __nccwpck_require__(3415); var util = __nccwpck_require__(3837); var tslib = __nccwpck_require__(4351); var xml2js = __nccwpck_require__(6189); -var coreUtil = __nccwpck_require__(1333); -var logger$1 = __nccwpck_require__(3233); -var coreAuth = __nccwpck_require__(9645); +var coreUtil = __nccwpck_require__(637); +var logger$1 = __nccwpck_require__(9497); +var coreAuth = __nccwpck_require__(8834); var os = __nccwpck_require__(2037); var http = __nccwpck_require__(3685); var https = __nccwpck_require__(5687); @@ -16270,7 +16066,7 @@ var parseUrl = (__nccwpck_require__(7310).parse); var fs = __nccwpck_require__(7147); var Stream = (__nccwpck_require__(2781).Stream); var mime = __nccwpck_require__(3583); -var asynckit = __nccwpck_require__(4812); +var asynckit = __nccwpck_require__(6284); var populate = __nccwpck_require__(3971); // Public API @@ -17429,7 +17225,7 @@ exports["default"] = _default; /***/ }), -/***/ 7094: +/***/ 4175: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -17437,2294 +17233,361 @@ exports["default"] = _default; Object.defineProperty(exports, "__esModule", ({ value: true })); -var logger$1 = __nccwpck_require__(3233); -var coreUtil = __nccwpck_require__(1333); +var api = __nccwpck_require__(5163); // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +(function (SpanKind) { + /** Default value. Indicates that the span is used internally. */ + SpanKind[SpanKind["INTERNAL"] = 0] = "INTERNAL"; + /** + * Indicates that the span covers server-side handling of an RPC or other + * remote request. + */ + SpanKind[SpanKind["SERVER"] = 1] = "SERVER"; + /** + * Indicates that the span covers the client-side wrapper around an RPC or + * other remote request. + */ + SpanKind[SpanKind["CLIENT"] = 2] = "CLIENT"; + /** + * Indicates that the span describes producer sending a message to a + * broker. Unlike client and server, there is no direct critical path latency + * relationship between producer and consumer spans. + */ + SpanKind[SpanKind["PRODUCER"] = 3] = "PRODUCER"; + /** + * Indicates that the span describes consumer receiving a message from a + * broker. Unlike client and server, there is no direct critical path latency + * relationship between producer and consumer spans. + */ + SpanKind[SpanKind["CONSUMER"] = 4] = "CONSUMER"; +})(exports.SpanKind || (exports.SpanKind = {})); /** - * The `@azure/logger` configuration for this package. - * @internal + * Return the span if one exists + * + * @param context - context to get span from */ -const logger = logger$1.createClientLogger("core-lro"); - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +function getSpan(context) { + return api.trace.getSpan(context); +} /** - * The default time interval to wait before sending the next polling request. + * Set the span on a context + * + * @param context - context to use as parent + * @param span - span to set active */ -const POLL_INTERVAL_IN_MS = 2000; +function setSpan(context, span) { + return api.trace.setSpan(context, span); +} /** - * The closed set of terminal states. + * Wrap span context in a NoopSpan and set as span in a new + * context + * + * @param context - context to set active span on + * @param spanContext - span context to be wrapped */ -const terminalStates = ["succeeded", "canceled", "failed"]; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +function setSpanContext(context, spanContext) { + return api.trace.setSpanContext(context, spanContext); +} /** - * Deserializes the state + * Get the span context of the span if it exists. + * + * @param context - context to get values from */ -function deserializeState(serializedState) { - try { - return JSON.parse(serializedState).state; - } - catch (e) { - throw new Error(`Unable to deserialize input state: ${serializedState}`); - } -} -function setStateError(inputs) { - const { state, stateProxy, isOperationError } = inputs; - return (error) => { - if (isOperationError(error)) { - stateProxy.setError(state, error); - stateProxy.setFailed(state); - } - throw error; - }; +function getSpanContext(context) { + return api.trace.getSpanContext(context); } -function appendReadableErrorMessage(currentMessage, innerMessage) { - let message = currentMessage; - if (message.slice(-1) !== ".") { - message = message + "."; - } - return message + " " + innerMessage; +/** + * Returns true of the given {@link SpanContext} is valid. + * A valid {@link SpanContext} is one which has a valid trace ID and span ID as per the spec. + * + * @param context - the {@link SpanContext} to validate. + * + * @returns true if the {@link SpanContext} is valid, false otherwise. + */ +function isSpanContextValid(context) { + return api.trace.isSpanContextValid(context); } -function simplifyError(err) { - let message = err.message; - let code = err.code; - let curErr = err; - while (curErr.innererror) { - curErr = curErr.innererror; - code = curErr.code; - message = appendReadableErrorMessage(message, curErr.message); - } - return { - code, - message, - }; +function getTracer(name, version) { + return api.trace.getTracer(name || "azure/core-tracing", version); } -function processOperationStatus(result) { - const { state, stateProxy, status, isDone, processResult, getError, response, setErrorAsResult } = result; - switch (status) { - case "succeeded": { - stateProxy.setSucceeded(state); - break; - } - case "failed": { - const err = getError === null || getError === void 0 ? void 0 : getError(response); - let postfix = ""; - if (err) { - const { code, message } = simplifyError(err); - postfix = `. ${code}. ${message}`; - } - const errStr = `The long-running operation has failed${postfix}`; - stateProxy.setError(state, new Error(errStr)); - stateProxy.setFailed(state); - logger.warning(errStr); - break; - } - case "canceled": { - stateProxy.setCanceled(state); - break; - } +/** Entrypoint for context API */ +const context = api.context; +(function (SpanStatusCode) { + /** + * The default status. + */ + SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET"; + /** + * The operation has been validated by an Application developer or + * Operator to have completed successfully. + */ + SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK"; + /** + * The operation contains an error. + */ + SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR"; +})(exports.SpanStatusCode || (exports.SpanStatusCode = {})); + +// Copyright (c) Microsoft Corporation. +function isTracingDisabled() { + var _a; + if (typeof process === "undefined") { + // not supported in browser for now without polyfills + return false; } - if ((isDone === null || isDone === void 0 ? void 0 : isDone(response, state)) || - (isDone === undefined && - ["succeeded", "canceled"].concat(setErrorAsResult ? [] : ["failed"]).includes(status))) { - stateProxy.setResult(state, buildResult({ - response, - state, - processResult, - })); + const azureTracingDisabledValue = (_a = process.env.AZURE_TRACING_DISABLED) === null || _a === void 0 ? void 0 : _a.toLowerCase(); + if (azureTracingDisabledValue === "false" || azureTracingDisabledValue === "0") { + return false; } -} -function buildResult(inputs) { - const { processResult, response, state } = inputs; - return processResult ? processResult(response, state) : response; + return Boolean(azureTracingDisabledValue); } /** - * Initiates the long-running operation. + * Creates a function that can be used to create spans using the global tracer. + * + * Usage: + * + * ```typescript + * // once + * const createSpan = createSpanFunction({ packagePrefix: "Azure.Data.AppConfiguration", namespace: "Microsoft.AppConfiguration" }); + * + * // in each operation + * const span = createSpan("deleteConfigurationSetting", operationOptions); + * // code... + * span.end(); + * ``` + * + * @hidden + * @param args - allows configuration of the prefix for each span as well as the az.namespace field. */ -async function initOperation(inputs) { - const { init, stateProxy, processResult, getOperationStatus, withOperationLocation, setErrorAsResult, } = inputs; - const { operationLocation, resourceLocation, metadata, response } = await init(); - if (operationLocation) - withOperationLocation === null || withOperationLocation === void 0 ? void 0 : withOperationLocation(operationLocation, false); - const config = { - metadata, - operationLocation, - resourceLocation, - }; - logger.verbose(`LRO: Operation description:`, config); - const state = stateProxy.initState(config); - const status = getOperationStatus({ response, state, operationLocation }); - processOperationStatus({ state, status, stateProxy, response, setErrorAsResult, processResult }); - return state; -} -async function pollOperationHelper(inputs) { - const { poll, state, stateProxy, operationLocation, getOperationStatus, getResourceLocation, isOperationError, options, } = inputs; - const response = await poll(operationLocation, options).catch(setStateError({ - state, - stateProxy, - isOperationError, - })); - const status = getOperationStatus(response, state); - logger.verbose(`LRO: Status:\n\tPolling from: ${state.config.operationLocation}\n\tOperation status: ${status}\n\tPolling status: ${terminalStates.includes(status) ? "Stopped" : "Running"}`); - if (status === "succeeded") { - const resourceLocation = getResourceLocation(response, state); - if (resourceLocation !== undefined) { - return { - response: await poll(resourceLocation).catch(setStateError({ state, stateProxy, isOperationError })), - status, - }; +function createSpanFunction(args) { + return function (operationName, operationOptions) { + const tracer = getTracer(); + const tracingOptions = (operationOptions === null || operationOptions === void 0 ? void 0 : operationOptions.tracingOptions) || {}; + const spanOptions = Object.assign({ kind: exports.SpanKind.INTERNAL }, tracingOptions.spanOptions); + const spanName = args.packagePrefix ? `${args.packagePrefix}.${operationName}` : operationName; + let span; + if (isTracingDisabled()) { + span = api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT); } - } - return { response, status }; -} -/** Polls the long-running operation. */ -async function pollOperation(inputs) { - const { poll, state, stateProxy, options, getOperationStatus, getResourceLocation, getOperationLocation, isOperationError, withOperationLocation, getPollingInterval, processResult, getError, updateState, setDelay, isDone, setErrorAsResult, } = inputs; - const { operationLocation } = state.config; - if (operationLocation !== undefined) { - const { response, status } = await pollOperationHelper({ - poll, - getOperationStatus, - state, - stateProxy, - operationLocation, - getResourceLocation, - isOperationError, - options, - }); - processOperationStatus({ - status, - response, - state, - stateProxy, - isDone, - processResult, - getError, - setErrorAsResult, - }); - if (!terminalStates.includes(status)) { - const intervalInMs = getPollingInterval === null || getPollingInterval === void 0 ? void 0 : getPollingInterval(response); - if (intervalInMs) - setDelay(intervalInMs); - const location = getOperationLocation === null || getOperationLocation === void 0 ? void 0 : getOperationLocation(response, state); - if (location !== undefined) { - const isUpdated = operationLocation !== location; - state.config.operationLocation = location; - withOperationLocation === null || withOperationLocation === void 0 ? void 0 : withOperationLocation(location, isUpdated); - } - else - withOperationLocation === null || withOperationLocation === void 0 ? void 0 : withOperationLocation(operationLocation, false); + else { + span = tracer.startSpan(spanName, spanOptions, tracingOptions.tracingContext); } - updateState === null || updateState === void 0 ? void 0 : updateState(state, response); - } + if (args.namespace) { + span.setAttribute("az.namespace", args.namespace); + } + let newSpanOptions = tracingOptions.spanOptions || {}; + if (span.isRecording() && args.namespace) { + newSpanOptions = Object.assign(Object.assign({}, tracingOptions.spanOptions), { attributes: Object.assign(Object.assign({}, spanOptions.attributes), { "az.namespace": args.namespace }) }); + } + const newTracingOptions = Object.assign(Object.assign({}, tracingOptions), { spanOptions: newSpanOptions, tracingContext: setSpan(tracingOptions.tracingContext || context.active(), span) }); + const newOperationOptions = Object.assign(Object.assign({}, operationOptions), { tracingOptions: newTracingOptions }); + return { + span, + updatedOptions: newOperationOptions + }; + }; } // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -function getOperationLocationPollingUrl(inputs) { - const { azureAsyncOperation, operationLocation } = inputs; - return operationLocation !== null && operationLocation !== void 0 ? operationLocation : azureAsyncOperation; -} -function getLocationHeader(rawResponse) { - return rawResponse.headers["location"]; -} -function getOperationLocationHeader(rawResponse) { - return rawResponse.headers["operation-location"]; -} -function getAzureAsyncOperationHeader(rawResponse) { - return rawResponse.headers["azure-asyncoperation"]; -} -function findResourceLocation(inputs) { - var _a; - const { location, requestMethod, requestPath, resourceLocationConfig } = inputs; - switch (requestMethod) { - case "PUT": { - return requestPath; - } - case "DELETE": { - return undefined; - } - case "PATCH": { - return (_a = getDefault()) !== null && _a !== void 0 ? _a : requestPath; - } - default: { - return getDefault(); - } - } - function getDefault() { - switch (resourceLocationConfig) { - case "azure-async-operation": { - return undefined; - } - case "original-uri": { - return requestPath; - } - case "location": - default: { - return location; - } - } - } -} -function inferLroMode(inputs) { - const { rawResponse, requestMethod, requestPath, resourceLocationConfig } = inputs; - const operationLocation = getOperationLocationHeader(rawResponse); - const azureAsyncOperation = getAzureAsyncOperationHeader(rawResponse); - const pollingUrl = getOperationLocationPollingUrl({ operationLocation, azureAsyncOperation }); - const location = getLocationHeader(rawResponse); - const normalizedRequestMethod = requestMethod === null || requestMethod === void 0 ? void 0 : requestMethod.toLocaleUpperCase(); - if (pollingUrl !== undefined) { - return { - mode: "OperationLocation", - operationLocation: pollingUrl, - resourceLocation: findResourceLocation({ - requestMethod: normalizedRequestMethod, - location, - requestPath, - resourceLocationConfig, - }), - }; - } - else if (location !== undefined) { - return { - mode: "ResourceLocation", - operationLocation: location, - }; - } - else if (normalizedRequestMethod === "PUT" && requestPath) { - return { - mode: "Body", - operationLocation: requestPath, - }; - } - else { - return undefined; - } -} -function transformStatus(inputs) { - const { status, statusCode } = inputs; - if (typeof status !== "string" && status !== undefined) { - throw new Error(`Polling was unsuccessful. Expected status to have a string value or no value but it has instead: ${status}. This doesn't necessarily indicate the operation has failed. Check your Azure subscription or resource status for more information.`); - } - switch (status === null || status === void 0 ? void 0 : status.toLocaleLowerCase()) { - case undefined: - return toOperationStatus(statusCode); - case "succeeded": - return "succeeded"; - case "failed": - return "failed"; - case "running": - case "accepted": - case "started": - case "canceling": - case "cancelling": - return "running"; - case "canceled": - case "cancelled": - return "canceled"; - default: { - logger.verbose(`LRO: unrecognized operation status: ${status}`); - return status; - } - } -} -function getStatus(rawResponse) { - var _a; - const { status } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {}; - return transformStatus({ status, statusCode: rawResponse.statusCode }); -} -function getProvisioningState(rawResponse) { - var _a, _b; - const { properties, provisioningState } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {}; - const status = (_b = properties === null || properties === void 0 ? void 0 : properties.provisioningState) !== null && _b !== void 0 ? _b : provisioningState; - return transformStatus({ status, statusCode: rawResponse.statusCode }); -} -function toOperationStatus(statusCode) { - if (statusCode === 202) { - return "running"; - } - else if (statusCode < 300) { - return "succeeded"; - } - else { - return "failed"; - } -} -function parseRetryAfter({ rawResponse }) { - const retryAfter = rawResponse.headers["retry-after"]; - if (retryAfter !== undefined) { - // Retry-After header value is either in HTTP date format, or in seconds - const retryAfterInSeconds = parseInt(retryAfter); - return isNaN(retryAfterInSeconds) - ? calculatePollingIntervalFromDate(new Date(retryAfter)) - : retryAfterInSeconds * 1000; - } - return undefined; -} -function getErrorFromResponse(response) { - const error = accessBodyProperty(response, "error"); - if (!error) { - logger.warning(`The long-running operation failed but there is no error property in the response's body`); - return; - } - if (!error.code || !error.message) { - logger.warning(`The long-running operation failed but the error property in the response's body doesn't contain code or message`); - return; - } - return error; -} -function calculatePollingIntervalFromDate(retryAfterDate) { - const timeNow = Math.floor(new Date().getTime()); - const retryAfterTime = retryAfterDate.getTime(); - if (timeNow < retryAfterTime) { - return retryAfterTime - timeNow; - } - return undefined; -} -function getStatusFromInitialResponse(inputs) { - const { response, state, operationLocation } = inputs; - function helper() { - var _a; - const mode = (_a = state.config.metadata) === null || _a === void 0 ? void 0 : _a["mode"]; - switch (mode) { - case undefined: - return toOperationStatus(response.rawResponse.statusCode); - case "Body": - return getOperationStatus(response, state); - default: - return "running"; - } - } - const status = helper(); - return status === "running" && operationLocation === undefined ? "succeeded" : status; +const VERSION = "00"; +/** + * Generates a `SpanContext` given a `traceparent` header value. + * @param traceParent - Serialized span context data as a `traceparent` header value. + * @returns The `SpanContext` generated from the `traceparent` value. + */ +function extractSpanContextFromTraceParentHeader(traceParentHeader) { + const parts = traceParentHeader.split("-"); + if (parts.length !== 4) { + return; + } + const [version, traceId, spanId, traceOptions] = parts; + if (version !== VERSION) { + return; + } + const traceFlags = parseInt(traceOptions, 16); + const spanContext = { + spanId, + traceId, + traceFlags + }; + return spanContext; } /** - * Initiates the long-running operation. + * Generates a `traceparent` value given a span context. + * @param spanContext - Contains context for a specific span. + * @returns The `spanContext` represented as a `traceparent` value. */ -async function initHttpOperation(inputs) { - const { stateProxy, resourceLocationConfig, processResult, lro, setErrorAsResult } = inputs; - return initOperation({ - init: async () => { - const response = await lro.sendInitialRequest(); - const config = inferLroMode({ - rawResponse: response.rawResponse, - requestPath: lro.requestPath, - requestMethod: lro.requestMethod, - resourceLocationConfig, - }); - return Object.assign({ response, operationLocation: config === null || config === void 0 ? void 0 : config.operationLocation, resourceLocation: config === null || config === void 0 ? void 0 : config.resourceLocation }, ((config === null || config === void 0 ? void 0 : config.mode) ? { metadata: { mode: config.mode } } : {})); - }, - stateProxy, - processResult: processResult - ? ({ flatResponse }, state) => processResult(flatResponse, state) - : ({ flatResponse }) => flatResponse, - getOperationStatus: getStatusFromInitialResponse, - setErrorAsResult, - }); -} -function getOperationLocation({ rawResponse }, state) { - var _a; - const mode = (_a = state.config.metadata) === null || _a === void 0 ? void 0 : _a["mode"]; - switch (mode) { - case "OperationLocation": { - return getOperationLocationPollingUrl({ - operationLocation: getOperationLocationHeader(rawResponse), - azureAsyncOperation: getAzureAsyncOperationHeader(rawResponse), - }); - } - case "ResourceLocation": { - return getLocationHeader(rawResponse); - } - case "Body": - default: { - return undefined; - } +function getTraceParentHeader(spanContext) { + const missingFields = []; + if (!spanContext.traceId) { + missingFields.push("traceId"); } -} -function getOperationStatus({ rawResponse }, state) { - var _a; - const mode = (_a = state.config.metadata) === null || _a === void 0 ? void 0 : _a["mode"]; - switch (mode) { - case "OperationLocation": { - return getStatus(rawResponse); - } - case "ResourceLocation": { - return toOperationStatus(rawResponse.statusCode); - } - case "Body": { - return getProvisioningState(rawResponse); - } - default: - throw new Error(`Internal error: Unexpected operation mode: ${mode}`); + if (!spanContext.spanId) { + missingFields.push("spanId"); } -} -function accessBodyProperty({ flatResponse, rawResponse }, prop) { - var _a, _b; - return (_a = flatResponse === null || flatResponse === void 0 ? void 0 : flatResponse[prop]) !== null && _a !== void 0 ? _a : (_b = rawResponse.body) === null || _b === void 0 ? void 0 : _b[prop]; -} -function getResourceLocation(res, state) { - const loc = accessBodyProperty(res, "resourceLocation"); - if (loc && typeof loc === "string") { - state.config.resourceLocation = loc; + if (missingFields.length) { + return; } - return state.config.resourceLocation; -} -function isOperationError(e) { - return e.name === "RestError"; + const flags = spanContext.traceFlags || 0 /* NONE */; + const hexFlags = flags.toString(16); + const traceFlags = hexFlags.length === 1 ? `0${hexFlags}` : hexFlags; + // https://www.w3.org/TR/trace-context/#traceparent-header-field-values + return `${VERSION}-${spanContext.traceId}-${spanContext.spanId}-${traceFlags}`; } -/** Polls the long-running operation. */ -async function pollHttpOperation(inputs) { - const { lro, stateProxy, options, processResult, updateState, setDelay, state, setErrorAsResult, } = inputs; - return pollOperation({ - state, - stateProxy, - setDelay, - processResult: processResult - ? ({ flatResponse }, inputState) => processResult(flatResponse, inputState) - : ({ flatResponse }) => flatResponse, - getError: getErrorFromResponse, - updateState, - getPollingInterval: parseRetryAfter, - getOperationLocation, - getOperationStatus, - isOperationError, - getResourceLocation, - options, - /** - * The expansion here is intentional because `lro` could be an object that - * references an inner this, so we need to preserve a reference to it. - */ - poll: async (location, inputOptions) => lro.sendPollRequest(location, inputOptions), - setErrorAsResult, - }); + +exports.context = context; +exports.createSpanFunction = createSpanFunction; +exports.extractSpanContextFromTraceParentHeader = extractSpanContextFromTraceParentHeader; +exports.getSpan = getSpan; +exports.getSpanContext = getSpanContext; +exports.getTraceParentHeader = getTraceParentHeader; +exports.getTracer = getTracer; +exports.isSpanContextValid = isSpanContextValid; +exports.setSpan = setSpan; +exports.setSpanContext = setSpanContext; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 4100: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var coreHttp = __nccwpck_require__(4607); +var tslib = __nccwpck_require__(4351); +var coreTracing = __nccwpck_require__(4175); +var logger$1 = __nccwpck_require__(9497); +var abortController = __nccwpck_require__(978); +var os = __nccwpck_require__(2037); +var crypto = __nccwpck_require__(6113); +var stream = __nccwpck_require__(2781); +__nccwpck_require__(7947); +var coreLro = __nccwpck_require__(334); +var events = __nccwpck_require__(2361); +var fs = __nccwpck_require__(7147); +var util = __nccwpck_require__(3837); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n["default"] = e; + return Object.freeze(n); } -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -const createStateProxy$1 = () => ({ - /** - * The state at this point is created to be of type OperationState. - * It will be updated later to be of type TState when the - * customer-provided callback, `updateState`, is called during polling. - */ - initState: (config) => ({ status: "running", config }), - setCanceled: (state) => (state.status = "canceled"), - setError: (state, error) => (state.error = error), - setResult: (state, result) => (state.result = result), - setRunning: (state) => (state.status = "running"), - setSucceeded: (state) => (state.status = "succeeded"), - setFailed: (state) => (state.status = "failed"), - getError: (state) => state.error, - getResult: (state) => state.result, - isCanceled: (state) => state.status === "canceled", - isFailed: (state) => state.status === "failed", - isRunning: (state) => state.status === "running", - isSucceeded: (state) => state.status === "succeeded", -}); -/** - * Returns a poller factory. +var coreHttp__namespace = /*#__PURE__*/_interopNamespace(coreHttp); +var os__namespace = /*#__PURE__*/_interopNamespace(os); +var fs__namespace = /*#__PURE__*/_interopNamespace(fs); +var util__namespace = /*#__PURE__*/_interopNamespace(util); + +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -function buildCreatePoller(inputs) { - const { getOperationLocation, getStatusFromInitialResponse, getStatusFromPollResponse, isOperationError, getResourceLocation, getPollingInterval, getError, resolveOnUnsuccessful, } = inputs; - return async ({ init, poll }, options) => { - const { processResult, updateState, withOperationLocation: withOperationLocationCallback, intervalInMs = POLL_INTERVAL_IN_MS, restoreFrom, } = options || {}; - const stateProxy = createStateProxy$1(); - const withOperationLocation = withOperationLocationCallback - ? (() => { - let called = false; - return (operationLocation, isUpdated) => { - if (isUpdated) - withOperationLocationCallback(operationLocation); - else if (!called) - withOperationLocationCallback(operationLocation); - called = true; - }; - })() - : undefined; - const state = restoreFrom - ? deserializeState(restoreFrom) - : await initOperation({ - init, - stateProxy, - processResult, - getOperationStatus: getStatusFromInitialResponse, - withOperationLocation, - setErrorAsResult: !resolveOnUnsuccessful, - }); - let resultPromise; - const abortController = new AbortController(); - const handlers = new Map(); - const handleProgressEvents = async () => handlers.forEach((h) => h(state)); - const cancelErrMsg = "Operation was canceled"; - let currentPollIntervalInMs = intervalInMs; - const poller = { - getOperationState: () => state, - getResult: () => state.result, - isDone: () => ["succeeded", "failed", "canceled"].includes(state.status), - isStopped: () => resultPromise === undefined, - stopPolling: () => { - abortController.abort(); - }, - toString: () => JSON.stringify({ - state, - }), - onProgress: (callback) => { - const s = Symbol(); - handlers.set(s, callback); - return () => handlers.delete(s); - }, - pollUntilDone: (pollOptions) => (resultPromise !== null && resultPromise !== void 0 ? resultPromise : (resultPromise = (async () => { - const { abortSignal: inputAbortSignal } = pollOptions || {}; - // In the future we can use AbortSignal.any() instead - function abortListener() { - abortController.abort(); +const BlobServiceProperties = { + serializedName: "BlobServiceProperties", + xmlName: "StorageServiceProperties", + type: { + name: "Composite", + className: "BlobServiceProperties", + modelProperties: { + blobAnalyticsLogging: { + serializedName: "Logging", + xmlName: "Logging", + type: { + name: "Composite", + className: "Logging" } - const abortSignal = abortController.signal; - if (inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.aborted) { - abortController.abort(); + }, + hourMetrics: { + serializedName: "HourMetrics", + xmlName: "HourMetrics", + type: { + name: "Composite", + className: "Metrics" } - else if (!abortSignal.aborted) { - inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.addEventListener("abort", abortListener, { once: true }); + }, + minuteMetrics: { + serializedName: "MinuteMetrics", + xmlName: "MinuteMetrics", + type: { + name: "Composite", + className: "Metrics" } - try { - if (!poller.isDone()) { - await poller.poll({ abortSignal }); - while (!poller.isDone()) { - await coreUtil.delay(currentPollIntervalInMs, { abortSignal }); - await poller.poll({ abortSignal }); + }, + cors: { + serializedName: "Cors", + xmlName: "Cors", + xmlIsWrapped: true, + xmlElementName: "CorsRule", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CorsRule" } } } - finally { - inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.removeEventListener("abort", abortListener); - } - if (resolveOnUnsuccessful) { - return poller.getResult(); + }, + defaultServiceVersion: { + serializedName: "DefaultServiceVersion", + xmlName: "DefaultServiceVersion", + type: { + name: "String" } - else { - switch (state.status) { - case "succeeded": - return poller.getResult(); - case "canceled": - throw new Error(cancelErrMsg); - case "failed": - throw state.error; - case "notStarted": - case "running": - throw new Error(`Polling completed without succeeding or failing`); - } + }, + deleteRetentionPolicy: { + serializedName: "DeleteRetentionPolicy", + xmlName: "DeleteRetentionPolicy", + type: { + name: "Composite", + className: "RetentionPolicy" } - })().finally(() => { - resultPromise = undefined; - }))), - async poll(pollOptions) { - if (resolveOnUnsuccessful) { - if (poller.isDone()) - return; + }, + staticWebsite: { + serializedName: "StaticWebsite", + xmlName: "StaticWebsite", + type: { + name: "Composite", + className: "StaticWebsite" } - else { - switch (state.status) { - case "succeeded": - return; - case "canceled": - throw new Error(cancelErrMsg); - case "failed": - throw state.error; - } - } - await pollOperation({ - poll, - state, - stateProxy, - getOperationLocation, - isOperationError, - withOperationLocation, - getPollingInterval, - getOperationStatus: getStatusFromPollResponse, - getResourceLocation, - processResult, - getError, - updateState, - options: pollOptions, - setDelay: (pollIntervalInMs) => { - currentPollIntervalInMs = pollIntervalInMs; - }, - setErrorAsResult: !resolveOnUnsuccessful, - }); - await handleProgressEvents(); - if (!resolveOnUnsuccessful) { - switch (state.status) { - case "canceled": - throw new Error(cancelErrMsg); - case "failed": - throw state.error; - } - } - }, - }; - return poller; - }; -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Creates a poller that can be used to poll a long-running operation. - * @param lro - Description of the long-running operation - * @param options - options to configure the poller - * @returns an initialized poller - */ -async function createHttpPoller(lro, options) { - const { resourceLocationConfig, intervalInMs, processResult, restoreFrom, updateState, withOperationLocation, resolveOnUnsuccessful = false, } = options || {}; - return buildCreatePoller({ - getStatusFromInitialResponse, - getStatusFromPollResponse: getOperationStatus, - isOperationError, - getOperationLocation, - getResourceLocation, - getPollingInterval: parseRetryAfter, - getError: getErrorFromResponse, - resolveOnUnsuccessful, - })({ - init: async () => { - const response = await lro.sendInitialRequest(); - const config = inferLroMode({ - rawResponse: response.rawResponse, - requestPath: lro.requestPath, - requestMethod: lro.requestMethod, - resourceLocationConfig, - }); - return Object.assign({ response, operationLocation: config === null || config === void 0 ? void 0 : config.operationLocation, resourceLocation: config === null || config === void 0 ? void 0 : config.resourceLocation }, ((config === null || config === void 0 ? void 0 : config.mode) ? { metadata: { mode: config.mode } } : {})); - }, - poll: lro.sendPollRequest, - }, { - intervalInMs, - withOperationLocation, - restoreFrom, - updateState, - processResult: processResult - ? ({ flatResponse }, state) => processResult(flatResponse, state) - : ({ flatResponse }) => flatResponse, - }); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -const createStateProxy = () => ({ - initState: (config) => ({ config, isStarted: true }), - setCanceled: (state) => (state.isCancelled = true), - setError: (state, error) => (state.error = error), - setResult: (state, result) => (state.result = result), - setRunning: (state) => (state.isStarted = true), - setSucceeded: (state) => (state.isCompleted = true), - setFailed: () => { - /** empty body */ - }, - getError: (state) => state.error, - getResult: (state) => state.result, - isCanceled: (state) => !!state.isCancelled, - isFailed: (state) => !!state.error, - isRunning: (state) => !!state.isStarted, - isSucceeded: (state) => Boolean(state.isCompleted && !state.isCancelled && !state.error), -}); -class GenericPollOperation { - constructor(state, lro, setErrorAsResult, lroResourceLocationConfig, processResult, updateState, isDone) { - this.state = state; - this.lro = lro; - this.setErrorAsResult = setErrorAsResult; - this.lroResourceLocationConfig = lroResourceLocationConfig; - this.processResult = processResult; - this.updateState = updateState; - this.isDone = isDone; - } - setPollerConfig(pollerConfig) { - this.pollerConfig = pollerConfig; - } - async update(options) { - var _a; - const stateProxy = createStateProxy(); - if (!this.state.isStarted) { - this.state = Object.assign(Object.assign({}, this.state), (await initHttpOperation({ - lro: this.lro, - stateProxy, - resourceLocationConfig: this.lroResourceLocationConfig, - processResult: this.processResult, - setErrorAsResult: this.setErrorAsResult, - }))); - } - const updateState = this.updateState; - const isDone = this.isDone; - if (!this.state.isCompleted && this.state.error === undefined) { - await pollHttpOperation({ - lro: this.lro, - state: this.state, - stateProxy, - processResult: this.processResult, - updateState: updateState - ? (state, { rawResponse }) => updateState(state, rawResponse) - : undefined, - isDone: isDone - ? ({ flatResponse }, state) => isDone(flatResponse, state) - : undefined, - options, - setDelay: (intervalInMs) => { - this.pollerConfig.intervalInMs = intervalInMs; - }, - setErrorAsResult: this.setErrorAsResult, - }); - } - (_a = options === null || options === void 0 ? void 0 : options.fireProgress) === null || _a === void 0 ? void 0 : _a.call(options, this.state); - return this; - } - async cancel() { - logger.error("`cancelOperation` is deprecated because it wasn't implemented"); - return this; - } - /** - * Serializes the Poller operation. - */ - toString() { - return JSON.stringify({ - state: this.state, - }); - } -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * When a poller is manually stopped through the `stopPolling` method, - * the poller will be rejected with an instance of the PollerStoppedError. - */ -class PollerStoppedError extends Error { - constructor(message) { - super(message); - this.name = "PollerStoppedError"; - Object.setPrototypeOf(this, PollerStoppedError.prototype); - } -} -/** - * When the operation is cancelled, the poller will be rejected with an instance - * of the PollerCancelledError. - */ -class PollerCancelledError extends Error { - constructor(message) { - super(message); - this.name = "PollerCancelledError"; - Object.setPrototypeOf(this, PollerCancelledError.prototype); - } -} -/** - * A class that represents the definition of a program that polls through consecutive requests - * until it reaches a state of completion. - * - * A poller can be executed manually, by polling request by request by calling to the `poll()` method repeatedly, until its operation is completed. - * It also provides a way to wait until the operation completes, by calling `pollUntilDone()` and waiting until the operation finishes. - * Pollers can also request the cancellation of the ongoing process to whom is providing the underlying long running operation. - * - * ```ts - * const poller = new MyPoller(); - * - * // Polling just once: - * await poller.poll(); - * - * // We can try to cancel the request here, by calling: - * // - * // await poller.cancelOperation(); - * // - * - * // Getting the final result: - * const result = await poller.pollUntilDone(); - * ``` - * - * The Poller is defined by two types, a type representing the state of the poller, which - * must include a basic set of properties from `PollOperationState`, - * and a return type defined by `TResult`, which can be anything. - * - * The Poller class implements the `PollerLike` interface, which allows poller implementations to avoid having - * to export the Poller's class directly, and instead only export the already instantiated poller with the PollerLike type. - * - * ```ts - * class Client { - * public async makePoller: PollerLike { - * const poller = new MyPoller({}); - * // It might be preferred to return the poller after the first request is made, - * // so that some information can be obtained right away. - * await poller.poll(); - * return poller; - * } - * } - * - * const poller: PollerLike = myClient.makePoller(); - * ``` - * - * A poller can be created through its constructor, then it can be polled until it's completed. - * At any point in time, the state of the poller can be obtained without delay through the getOperationState method. - * At any point in time, the intermediate forms of the result type can be requested without delay. - * Once the underlying operation is marked as completed, the poller will stop and the final value will be returned. - * - * ```ts - * const poller = myClient.makePoller(); - * const state: MyOperationState = poller.getOperationState(); - * - * // The intermediate result can be obtained at any time. - * const result: MyResult | undefined = poller.getResult(); - * - * // The final result can only be obtained after the poller finishes. - * const result: MyResult = await poller.pollUntilDone(); - * ``` - * - */ -// eslint-disable-next-line no-use-before-define -class Poller { - /** - * A poller needs to be initialized by passing in at least the basic properties of the `PollOperation`. - * - * When writing an implementation of a Poller, this implementation needs to deal with the initialization - * of any custom state beyond the basic definition of the poller. The basic poller assumes that the poller's - * operation has already been defined, at least its basic properties. The code below shows how to approach - * the definition of the constructor of a new custom poller. - * - * ```ts - * export class MyPoller extends Poller { - * constructor({ - * // Anything you might need outside of the basics - * }) { - * let state: MyOperationState = { - * privateProperty: private, - * publicProperty: public, - * }; - * - * const operation = { - * state, - * update, - * cancel, - * toString - * } - * - * // Sending the operation to the parent's constructor. - * super(operation); - * - * // You can assign more local properties here. - * } - * } - * ``` - * - * Inside of this constructor, a new promise is created. This will be used to - * tell the user when the poller finishes (see `pollUntilDone()`). The promise's - * resolve and reject methods are also used internally to control when to resolve - * or reject anyone waiting for the poller to finish. - * - * The constructor of a custom implementation of a poller is where any serialized version of - * a previous poller's operation should be deserialized into the operation sent to the - * base constructor. For example: - * - * ```ts - * export class MyPoller extends Poller { - * constructor( - * baseOperation: string | undefined - * ) { - * let state: MyOperationState = {}; - * if (baseOperation) { - * state = { - * ...JSON.parse(baseOperation).state, - * ...state - * }; - * } - * const operation = { - * state, - * // ... - * } - * super(operation); - * } - * } - * ``` - * - * @param operation - Must contain the basic properties of `PollOperation`. - */ - constructor(operation) { - /** controls whether to throw an error if the operation failed or was canceled. */ - this.resolveOnUnsuccessful = false; - this.stopped = true; - this.pollProgressCallbacks = []; - this.operation = operation; - this.promise = new Promise((resolve, reject) => { - this.resolve = resolve; - this.reject = reject; - }); - // This prevents the UnhandledPromiseRejectionWarning in node.js from being thrown. - // The above warning would get thrown if `poller.poll` is called, it returns an error, - // and pullUntilDone did not have a .catch or await try/catch on it's return value. - this.promise.catch(() => { - /* intentionally blank */ - }); - } - /** - * Starts a loop that will break only if the poller is done - * or if the poller is stopped. - */ - async startPolling(pollOptions = {}) { - if (this.stopped) { - this.stopped = false; - } - while (!this.isStopped() && !this.isDone()) { - await this.poll(pollOptions); - await this.delay(); - } - } - /** - * pollOnce does one polling, by calling to the update method of the underlying - * poll operation to make any relevant change effective. - * - * It only optionally receives an object with an abortSignal property, from \@azure/abort-controller's AbortSignalLike. - * - * @param options - Optional properties passed to the operation's update method. - */ - async pollOnce(options = {}) { - if (!this.isDone()) { - this.operation = await this.operation.update({ - abortSignal: options.abortSignal, - fireProgress: this.fireProgress.bind(this), - }); - } - this.processUpdatedState(); - } - /** - * fireProgress calls the functions passed in via onProgress the method of the poller. - * - * It loops over all of the callbacks received from onProgress, and executes them, sending them - * the current operation state. - * - * @param state - The current operation state. - */ - fireProgress(state) { - for (const callback of this.pollProgressCallbacks) { - callback(state); - } - } - /** - * Invokes the underlying operation's cancel method. - */ - async cancelOnce(options = {}) { - this.operation = await this.operation.cancel(options); - } - /** - * Returns a promise that will resolve once a single polling request finishes. - * It does this by calling the update method of the Poller's operation. - * - * It only optionally receives an object with an abortSignal property, from \@azure/abort-controller's AbortSignalLike. - * - * @param options - Optional properties passed to the operation's update method. - */ - poll(options = {}) { - if (!this.pollOncePromise) { - this.pollOncePromise = this.pollOnce(options); - const clearPollOncePromise = () => { - this.pollOncePromise = undefined; - }; - this.pollOncePromise.then(clearPollOncePromise, clearPollOncePromise).catch(this.reject); - } - return this.pollOncePromise; - } - processUpdatedState() { - if (this.operation.state.error) { - this.stopped = true; - if (!this.resolveOnUnsuccessful) { - this.reject(this.operation.state.error); - throw this.operation.state.error; - } - } - if (this.operation.state.isCancelled) { - this.stopped = true; - if (!this.resolveOnUnsuccessful) { - const error = new PollerCancelledError("Operation was canceled"); - this.reject(error); - throw error; - } - } - if (this.isDone() && this.resolve) { - // If the poller has finished polling, this means we now have a result. - // However, it can be the case that TResult is instantiated to void, so - // we are not expecting a result anyway. To assert that we might not - // have a result eventually after finishing polling, we cast the result - // to TResult. - this.resolve(this.getResult()); - } - } - /** - * Returns a promise that will resolve once the underlying operation is completed. - */ - async pollUntilDone(pollOptions = {}) { - if (this.stopped) { - this.startPolling(pollOptions).catch(this.reject); - } - // This is needed because the state could have been updated by - // `cancelOperation`, e.g. the operation is canceled or an error occurred. - this.processUpdatedState(); - return this.promise; - } - /** - * Invokes the provided callback after each polling is completed, - * sending the current state of the poller's operation. - * - * It returns a method that can be used to stop receiving updates on the given callback function. - */ - onProgress(callback) { - this.pollProgressCallbacks.push(callback); - return () => { - this.pollProgressCallbacks = this.pollProgressCallbacks.filter((c) => c !== callback); - }; - } - /** - * Returns true if the poller has finished polling. - */ - isDone() { - const state = this.operation.state; - return Boolean(state.isCompleted || state.isCancelled || state.error); - } - /** - * Stops the poller from continuing to poll. - */ - stopPolling() { - if (!this.stopped) { - this.stopped = true; - if (this.reject) { - this.reject(new PollerStoppedError("This poller is already stopped")); - } - } - } - /** - * Returns true if the poller is stopped. - */ - isStopped() { - return this.stopped; - } - /** - * Attempts to cancel the underlying operation. - * - * It only optionally receives an object with an abortSignal property, from \@azure/abort-controller's AbortSignalLike. - * - * If it's called again before it finishes, it will throw an error. - * - * @param options - Optional properties passed to the operation's update method. - */ - cancelOperation(options = {}) { - if (!this.cancelPromise) { - this.cancelPromise = this.cancelOnce(options); - } - else if (options.abortSignal) { - throw new Error("A cancel request is currently pending"); - } - return this.cancelPromise; - } - /** - * Returns the state of the operation. - * - * Even though TState will be the same type inside any of the methods of any extension of the Poller class, - * implementations of the pollers can customize what's shared with the public by writing their own - * version of the `getOperationState` method, and by defining two types, one representing the internal state of the poller - * and a public type representing a safe to share subset of the properties of the internal state. - * Their definition of getOperationState can then return their public type. - * - * Example: - * - * ```ts - * // Let's say we have our poller's operation state defined as: - * interface MyOperationState extends PollOperationState { - * privateProperty?: string; - * publicProperty?: string; - * } - * - * // To allow us to have a true separation of public and private state, we have to define another interface: - * interface PublicState extends PollOperationState { - * publicProperty?: string; - * } - * - * // Then, we define our Poller as follows: - * export class MyPoller extends Poller { - * // ... More content is needed here ... - * - * public getOperationState(): PublicState { - * const state: PublicState = this.operation.state; - * return { - * // Properties from PollOperationState - * isStarted: state.isStarted, - * isCompleted: state.isCompleted, - * isCancelled: state.isCancelled, - * error: state.error, - * result: state.result, - * - * // The only other property needed by PublicState. - * publicProperty: state.publicProperty - * } - * } - * } - * ``` - * - * You can see this in the tests of this repository, go to the file: - * `../test/utils/testPoller.ts` - * and look for the getOperationState implementation. - */ - getOperationState() { - return this.operation.state; - } - /** - * Returns the result value of the operation, - * regardless of the state of the poller. - * It can return undefined or an incomplete form of the final TResult value - * depending on the implementation. - */ - getResult() { - const state = this.operation.state; - return state.result; - } - /** - * Returns a serialized version of the poller's operation - * by invoking the operation's toString method. - */ - toString() { - return this.operation.toString(); - } -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * The LRO Engine, a class that performs polling. - */ -class LroEngine extends Poller { - constructor(lro, options) { - const { intervalInMs = POLL_INTERVAL_IN_MS, resumeFrom, resolveOnUnsuccessful = false, isDone, lroResourceLocationConfig, processResult, updateState, } = options || {}; - const state = resumeFrom - ? deserializeState(resumeFrom) - : {}; - const operation = new GenericPollOperation(state, lro, !resolveOnUnsuccessful, lroResourceLocationConfig, processResult, updateState, isDone); - super(operation); - this.resolveOnUnsuccessful = resolveOnUnsuccessful; - this.config = { intervalInMs: intervalInMs }; - operation.setPollerConfig(this.config); - } - /** - * The method used by the poller to wait before attempting to update its operation. - */ - delay() { - return new Promise((resolve) => setTimeout(() => resolve(), this.config.intervalInMs)); - } -} - -exports.LroEngine = LroEngine; -exports.Poller = Poller; -exports.PollerCancelledError = PollerCancelledError; -exports.PollerStoppedError = PollerStoppedError; -exports.createHttpPoller = createHttpPoller; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ 4559: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var tslib = __nccwpck_require__(4351); - -// Copyright (c) Microsoft Corporation. -/** - * returns an async iterator that iterates over results. It also has a `byPage` - * method that returns pages of items at once. - * - * @param pagedResult - an object that specifies how to get pages. - * @returns a paged async iterator that iterates over results. - */ -function getPagedAsyncIterator(pagedResult) { - var _a; - const iter = getItemAsyncIterator(pagedResult); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (_a = pagedResult === null || pagedResult === void 0 ? void 0 : pagedResult.byPage) !== null && _a !== void 0 ? _a : ((settings) => { - const { continuationToken, maxPageSize } = settings !== null && settings !== void 0 ? settings : {}; - return getPageAsyncIterator(pagedResult, { - pageLink: continuationToken, - maxPageSize, - }); - }), - }; -} -function getItemAsyncIterator(pagedResult) { - return tslib.__asyncGenerator(this, arguments, function* getItemAsyncIterator_1() { - var e_1, _a, e_2, _b; - const pages = getPageAsyncIterator(pagedResult); - const firstVal = yield tslib.__await(pages.next()); - // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is - if (!Array.isArray(firstVal.value)) { - // can extract elements from this page - const { toElements } = pagedResult; - if (toElements) { - yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(toElements(firstVal.value)))); - try { - for (var pages_1 = tslib.__asyncValues(pages), pages_1_1; pages_1_1 = yield tslib.__await(pages_1.next()), !pages_1_1.done;) { - const page = pages_1_1.value; - yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(toElements(page)))); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (pages_1_1 && !pages_1_1.done && (_a = pages_1.return)) yield tslib.__await(_a.call(pages_1)); - } - finally { if (e_1) throw e_1.error; } - } - } - else { - yield yield tslib.__await(firstVal.value); - // `pages` is of type `AsyncIterableIterator` but TPage = TElement in this case - yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(pages))); - } - } - else { - yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(firstVal.value))); - try { - for (var pages_2 = tslib.__asyncValues(pages), pages_2_1; pages_2_1 = yield tslib.__await(pages_2.next()), !pages_2_1.done;) { - const page = pages_2_1.value; - // pages is of type `AsyncIterableIterator` so `page` is of type `TPage`. In this branch, - // it must be the case that `TPage = TElement[]` - yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page))); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (pages_2_1 && !pages_2_1.done && (_b = pages_2.return)) yield tslib.__await(_b.call(pages_2)); - } - finally { if (e_2) throw e_2.error; } - } - } - }); -} -function getPageAsyncIterator(pagedResult, options = {}) { - return tslib.__asyncGenerator(this, arguments, function* getPageAsyncIterator_1() { - const { pageLink, maxPageSize } = options; - let response = yield tslib.__await(pagedResult.getPage(pageLink !== null && pageLink !== void 0 ? pageLink : pagedResult.firstPageLink, maxPageSize)); - if (!response) { - return yield tslib.__await(void 0); - } - yield yield tslib.__await(response.page); - while (response.nextPageLink) { - response = yield tslib.__await(pagedResult.getPage(response.nextPageLink, maxPageSize)); - if (!response) { - return yield tslib.__await(void 0); - } - yield yield tslib.__await(response.page); - } - }); -} - -exports.getPagedAsyncIterator = getPagedAsyncIterator; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ 4175: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var api = __nccwpck_require__(5163); - -// Copyright (c) Microsoft Corporation. -(function (SpanKind) { - /** Default value. Indicates that the span is used internally. */ - SpanKind[SpanKind["INTERNAL"] = 0] = "INTERNAL"; - /** - * Indicates that the span covers server-side handling of an RPC or other - * remote request. - */ - SpanKind[SpanKind["SERVER"] = 1] = "SERVER"; - /** - * Indicates that the span covers the client-side wrapper around an RPC or - * other remote request. - */ - SpanKind[SpanKind["CLIENT"] = 2] = "CLIENT"; - /** - * Indicates that the span describes producer sending a message to a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - SpanKind[SpanKind["PRODUCER"] = 3] = "PRODUCER"; - /** - * Indicates that the span describes consumer receiving a message from a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - SpanKind[SpanKind["CONSUMER"] = 4] = "CONSUMER"; -})(exports.SpanKind || (exports.SpanKind = {})); -/** - * Return the span if one exists - * - * @param context - context to get span from - */ -function getSpan(context) { - return api.trace.getSpan(context); -} -/** - * Set the span on a context - * - * @param context - context to use as parent - * @param span - span to set active - */ -function setSpan(context, span) { - return api.trace.setSpan(context, span); -} -/** - * Wrap span context in a NoopSpan and set as span in a new - * context - * - * @param context - context to set active span on - * @param spanContext - span context to be wrapped - */ -function setSpanContext(context, spanContext) { - return api.trace.setSpanContext(context, spanContext); -} -/** - * Get the span context of the span if it exists. - * - * @param context - context to get values from - */ -function getSpanContext(context) { - return api.trace.getSpanContext(context); -} -/** - * Returns true of the given {@link SpanContext} is valid. - * A valid {@link SpanContext} is one which has a valid trace ID and span ID as per the spec. - * - * @param context - the {@link SpanContext} to validate. - * - * @returns true if the {@link SpanContext} is valid, false otherwise. - */ -function isSpanContextValid(context) { - return api.trace.isSpanContextValid(context); -} -function getTracer(name, version) { - return api.trace.getTracer(name || "azure/core-tracing", version); -} -/** Entrypoint for context API */ -const context = api.context; -(function (SpanStatusCode) { - /** - * The default status. - */ - SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET"; - /** - * The operation has been validated by an Application developer or - * Operator to have completed successfully. - */ - SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK"; - /** - * The operation contains an error. - */ - SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR"; -})(exports.SpanStatusCode || (exports.SpanStatusCode = {})); - -// Copyright (c) Microsoft Corporation. -function isTracingDisabled() { - var _a; - if (typeof process === "undefined") { - // not supported in browser for now without polyfills - return false; - } - const azureTracingDisabledValue = (_a = process.env.AZURE_TRACING_DISABLED) === null || _a === void 0 ? void 0 : _a.toLowerCase(); - if (azureTracingDisabledValue === "false" || azureTracingDisabledValue === "0") { - return false; - } - return Boolean(azureTracingDisabledValue); -} -/** - * Creates a function that can be used to create spans using the global tracer. - * - * Usage: - * - * ```typescript - * // once - * const createSpan = createSpanFunction({ packagePrefix: "Azure.Data.AppConfiguration", namespace: "Microsoft.AppConfiguration" }); - * - * // in each operation - * const span = createSpan("deleteConfigurationSetting", operationOptions); - * // code... - * span.end(); - * ``` - * - * @hidden - * @param args - allows configuration of the prefix for each span as well as the az.namespace field. - */ -function createSpanFunction(args) { - return function (operationName, operationOptions) { - const tracer = getTracer(); - const tracingOptions = (operationOptions === null || operationOptions === void 0 ? void 0 : operationOptions.tracingOptions) || {}; - const spanOptions = Object.assign({ kind: exports.SpanKind.INTERNAL }, tracingOptions.spanOptions); - const spanName = args.packagePrefix ? `${args.packagePrefix}.${operationName}` : operationName; - let span; - if (isTracingDisabled()) { - span = api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT); - } - else { - span = tracer.startSpan(spanName, spanOptions, tracingOptions.tracingContext); - } - if (args.namespace) { - span.setAttribute("az.namespace", args.namespace); - } - let newSpanOptions = tracingOptions.spanOptions || {}; - if (span.isRecording() && args.namespace) { - newSpanOptions = Object.assign(Object.assign({}, tracingOptions.spanOptions), { attributes: Object.assign(Object.assign({}, spanOptions.attributes), { "az.namespace": args.namespace }) }); - } - const newTracingOptions = Object.assign(Object.assign({}, tracingOptions), { spanOptions: newSpanOptions, tracingContext: setSpan(tracingOptions.tracingContext || context.active(), span) }); - const newOperationOptions = Object.assign(Object.assign({}, operationOptions), { tracingOptions: newTracingOptions }); - return { - span, - updatedOptions: newOperationOptions - }; - }; -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -const VERSION = "00"; -/** - * Generates a `SpanContext` given a `traceparent` header value. - * @param traceParent - Serialized span context data as a `traceparent` header value. - * @returns The `SpanContext` generated from the `traceparent` value. - */ -function extractSpanContextFromTraceParentHeader(traceParentHeader) { - const parts = traceParentHeader.split("-"); - if (parts.length !== 4) { - return; - } - const [version, traceId, spanId, traceOptions] = parts; - if (version !== VERSION) { - return; - } - const traceFlags = parseInt(traceOptions, 16); - const spanContext = { - spanId, - traceId, - traceFlags - }; - return spanContext; -} -/** - * Generates a `traceparent` value given a span context. - * @param spanContext - Contains context for a specific span. - * @returns The `spanContext` represented as a `traceparent` value. - */ -function getTraceParentHeader(spanContext) { - const missingFields = []; - if (!spanContext.traceId) { - missingFields.push("traceId"); - } - if (!spanContext.spanId) { - missingFields.push("spanId"); - } - if (missingFields.length) { - return; - } - const flags = spanContext.traceFlags || 0 /* NONE */; - const hexFlags = flags.toString(16); - const traceFlags = hexFlags.length === 1 ? `0${hexFlags}` : hexFlags; - // https://www.w3.org/TR/trace-context/#traceparent-header-field-values - return `${VERSION}-${spanContext.traceId}-${spanContext.spanId}-${traceFlags}`; -} - -exports.context = context; -exports.createSpanFunction = createSpanFunction; -exports.extractSpanContextFromTraceParentHeader = extractSpanContextFromTraceParentHeader; -exports.getSpan = getSpan; -exports.getSpanContext = getSpanContext; -exports.getTraceParentHeader = getTraceParentHeader; -exports.getTracer = getTracer; -exports.isSpanContextValid = isSpanContextValid; -exports.setSpan = setSpan; -exports.setSpanContext = setSpanContext; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ 1333: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var abortController = __nccwpck_require__(4200); -var crypto = __nccwpck_require__(6113); - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Creates an abortable promise. - * @param buildPromise - A function that takes the resolve and reject functions as parameters. - * @param options - The options for the abortable promise. - * @returns A promise that can be aborted. - */ -function createAbortablePromise(buildPromise, options) { - const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options !== null && options !== void 0 ? options : {}; - return new Promise((resolve, reject) => { - function rejectOnAbort() { - reject(new abortController.AbortError(abortErrorMsg !== null && abortErrorMsg !== void 0 ? abortErrorMsg : "The operation was aborted.")); - } - function removeListeners() { - abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.removeEventListener("abort", onAbort); - } - function onAbort() { - cleanupBeforeAbort === null || cleanupBeforeAbort === void 0 ? void 0 : cleanupBeforeAbort(); - removeListeners(); - rejectOnAbort(); - } - if (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted) { - return rejectOnAbort(); - } - try { - buildPromise((x) => { - removeListeners(); - resolve(x); - }, (x) => { - removeListeners(); - reject(x); - }); - } - catch (err) { - reject(err); - } - abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.addEventListener("abort", onAbort); - }); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -const StandardAbortMessage = "The delay was aborted."; -/** - * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds. - * @param timeInMs - The number of milliseconds to be delayed. - * @param options - The options for delay - currently abort options - * @returns Promise that is resolved after timeInMs - */ -function delay(timeInMs, options) { - let token; - const { abortSignal, abortErrorMsg } = options !== null && options !== void 0 ? options : {}; - return createAbortablePromise((resolve) => { - token = setTimeout(resolve, timeInMs); - }, { - cleanupBeforeAbort: () => clearTimeout(token), - abortSignal, - abortErrorMsg: abortErrorMsg !== null && abortErrorMsg !== void 0 ? abortErrorMsg : StandardAbortMessage, - }); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * promise.race() wrapper that aborts rest of promises as soon as the first promise settles. - */ -async function cancelablePromiseRace(abortablePromiseBuilders, options) { - var _a, _b; - const aborter = new AbortController(); - function abortHandler() { - aborter.abort(); - } - (_a = options === null || options === void 0 ? void 0 : options.abortSignal) === null || _a === void 0 ? void 0 : _a.addEventListener("abort", abortHandler); - try { - return await Promise.race(abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal }))); - } - finally { - aborter.abort(); - (_b = options === null || options === void 0 ? void 0 : options.abortSignal) === null || _b === void 0 ? void 0 : _b.removeEventListener("abort", abortHandler); - } -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Returns a random integer value between a lower and upper bound, - * inclusive of both bounds. - * Note that this uses Math.random and isn't secure. If you need to use - * this for any kind of security purpose, find a better source of random. - * @param min - The smallest integer value allowed. - * @param max - The largest integer value allowed. - */ -function getRandomIntegerInclusive(min, max) { - // Make sure inputs are integers. - min = Math.ceil(min); - max = Math.floor(max); - // Pick a random offset from zero to the size of the range. - // Since Math.random() can never return 1, we have to make the range one larger - // in order to be inclusive of the maximum value after we take the floor. - const offset = Math.floor(Math.random() * (max - min + 1)); - return offset + min; -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Helper to determine when an input is a generic JS object. - * @returns true when input is an object type that is not null, Array, RegExp, or Date. - */ -function isObject(input) { - return (typeof input === "object" && - input !== null && - !Array.isArray(input) && - !(input instanceof RegExp) && - !(input instanceof Date)); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Typeguard for an error object shape (has name and message) - * @param e - Something caught by a catch clause. - */ -function isError(e) { - if (isObject(e)) { - const hasName = typeof e.name === "string"; - const hasMessage = typeof e.message === "string"; - return hasName && hasMessage; - } - return false; -} -/** - * Given what is thought to be an error object, return the message if possible. - * If the message is missing, returns a stringified version of the input. - * @param e - Something thrown from a try block - * @returns The error message or a string of the input - */ -function getErrorMessage(e) { - if (isError(e)) { - return e.message; - } - else { - let stringified; - try { - if (typeof e === "object" && e) { - stringified = JSON.stringify(e); - } - else { - stringified = String(e); - } - } - catch (err) { - stringified = "[unable to stringify input]"; - } - return `Unknown error ${stringified}`; - } -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Generates a SHA-256 HMAC signature. - * @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash. - * @param stringToSign - The data to be signed. - * @param encoding - The textual encoding to use for the returned HMAC digest. - */ -async function computeSha256Hmac(key, stringToSign, encoding) { - const decodedKey = Buffer.from(key, "base64"); - return crypto.createHmac("sha256", decodedKey).update(stringToSign).digest(encoding); -} -/** - * Generates a SHA-256 hash. - * @param content - The data to be included in the hash. - * @param encoding - The textual encoding to use for the returned hash. - */ -async function computeSha256Hash(content, encoding) { - return crypto.createHash("sha256").update(content).digest(encoding); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Helper TypeGuard that checks if something is defined or not. - * @param thing - Anything - */ -function isDefined(thing) { - return typeof thing !== "undefined" && thing !== null; -} -/** - * Helper TypeGuard that checks if the input is an object with the specified properties. - * @param thing - Anything. - * @param properties - The name of the properties that should appear in the object. - */ -function isObjectWithProperties(thing, properties) { - if (!isDefined(thing) || typeof thing !== "object") { - return false; - } - for (const property of properties) { - if (!objectHasProperty(thing, property)) { - return false; - } - } - return true; -} -/** - * Helper TypeGuard that checks if the input is an object with the specified property. - * @param thing - Any object. - * @param property - The name of the property that should appear in the object. - */ -function objectHasProperty(thing, property) { - return (isDefined(thing) && typeof thing === "object" && property in thing); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/* - * NOTE: When moving this file, please update "react-native" section in package.json. - */ -/** - * Generated Universally Unique Identifier - * - * @returns RFC4122 v4 UUID. - */ -function generateUUID() { - let uuid = ""; - for (let i = 0; i < 32; i++) { - // Generate a random number between 0 and 15 - const randomNumber = Math.floor(Math.random() * 16); - // Set the UUID version to 4 in the 13th position - if (i === 12) { - uuid += "4"; - } - else if (i === 16) { - // Set the UUID variant to "10" in the 17th position - uuid += (randomNumber & 0x3) | 0x8; - } - else { - // Add a random hexadecimal digit to the UUID string - uuid += randomNumber.toString(16); - } - // Add hyphens to the UUID string at the appropriate positions - if (i === 7 || i === 11 || i === 15 || i === 19) { - uuid += "-"; - } - } - return uuid; -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -var _a$1; -// NOTE: This is a workaround until we can use `globalThis.crypto.randomUUID` in Node.js 19+. -let uuidFunction = typeof ((_a$1 = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a$1 === void 0 ? void 0 : _a$1.randomUUID) === "function" - ? globalThis.crypto.randomUUID.bind(globalThis.crypto) - : crypto.randomUUID; -// Not defined in earlier versions of Node.js 14 -if (!uuidFunction) { - uuidFunction = generateUUID; -} -/** - * Generated Universally Unique Identifier - * - * @returns RFC4122 v4 UUID. - */ -function randomUUID() { - return uuidFunction(); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -var _a, _b, _c, _d; -/** - * A constant that indicates whether the environment the code is running is a Web Browser. - */ -// eslint-disable-next-line @azure/azure-sdk/ts-no-window -const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; -/** - * A constant that indicates whether the environment the code is running is a Web Worker. - */ -const isWebWorker = typeof self === "object" && - typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" && - (((_a = self.constructor) === null || _a === void 0 ? void 0 : _a.name) === "DedicatedWorkerGlobalScope" || - ((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "ServiceWorkerGlobalScope" || - ((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "SharedWorkerGlobalScope"); -/** - * A constant that indicates whether the environment the code is running is Deno. - */ -const isDeno = typeof Deno !== "undefined" && - typeof Deno.version !== "undefined" && - typeof Deno.version.deno !== "undefined"; -/** - * A constant that indicates whether the environment the code is running is Node.JS. - */ -const isNode = typeof process !== "undefined" && - Boolean(process.version) && - Boolean((_d = process.versions) === null || _d === void 0 ? void 0 : _d.node) && - // Deno thought it was a good idea to spoof process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions - !isDeno; -/** - * A constant that indicates whether the environment the code is running is Bun.sh. - */ -const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; -/** - * A constant that indicates whether the environment the code is running is in React-Native. - */ -// https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js -const isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === void 0 ? void 0 : navigator.product) === "ReactNative"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * The helper that transforms bytes with specific character encoding into string - * @param bytes - the uint8array bytes - * @param format - the format we use to encode the byte - * @returns a string of the encoded string - */ -function uint8ArrayToString(bytes, format) { - return Buffer.from(bytes).toString(format); -} -/** - * The helper that transforms string to specific character encoded bytes array. - * @param value - the string to be converted - * @param format - the format we use to decode the value - * @returns a uint8array - */ -function stringToUint8Array(value, format) { - return Buffer.from(value, format); -} - -exports.cancelablePromiseRace = cancelablePromiseRace; -exports.computeSha256Hash = computeSha256Hash; -exports.computeSha256Hmac = computeSha256Hmac; -exports.createAbortablePromise = createAbortablePromise; -exports.delay = delay; -exports.getErrorMessage = getErrorMessage; -exports.getRandomIntegerInclusive = getRandomIntegerInclusive; -exports.isBrowser = isBrowser; -exports.isBun = isBun; -exports.isDefined = isDefined; -exports.isDeno = isDeno; -exports.isError = isError; -exports.isNode = isNode; -exports.isObject = isObject; -exports.isObjectWithProperties = isObjectWithProperties; -exports.isReactNative = isReactNative; -exports.isWebWorker = isWebWorker; -exports.objectHasProperty = objectHasProperty; -exports.randomUUID = randomUUID; -exports.stringToUint8Array = stringToUint8Array; -exports.uint8ArrayToString = uint8ArrayToString; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ 4200: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * This error is thrown when an asynchronous operation has been aborted. - * Check for this error by testing the `name` that the name property of the - * error matches `"AbortError"`. - * - * @example - * ```ts - * const controller = new AbortController(); - * controller.abort(); - * try { - * doAsyncWork(controller.signal) - * } catch (e) { - * if (e.name === 'AbortError') { - * // handle abort error here. - * } - * } - * ``` - */ -class AbortError extends Error { - constructor(message) { - super(message); - this.name = "AbortError"; - } -} - -exports.AbortError = AbortError; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ 3233: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var os = __nccwpck_require__(2037); -var util = __nccwpck_require__(3837); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var util__default = /*#__PURE__*/_interopDefaultLegacy(util); - -// Copyright (c) Microsoft Corporation. -function log(message, ...args) { - process.stderr.write(`${util__default["default"].format(message, ...args)}${os.EOL}`); -} - -// Copyright (c) Microsoft Corporation. -const debugEnvVariable = (typeof process !== "undefined" && process.env && process.env.DEBUG) || undefined; -let enabledString; -let enabledNamespaces = []; -let skippedNamespaces = []; -const debuggers = []; -if (debugEnvVariable) { - enable(debugEnvVariable); -} -const debugObj = Object.assign((namespace) => { - return createDebugger(namespace); -}, { - enable, - enabled, - disable, - log, -}); -function enable(namespaces) { - enabledString = namespaces; - enabledNamespaces = []; - skippedNamespaces = []; - const wildcard = /\*/g; - const namespaceList = namespaces.split(",").map((ns) => ns.trim().replace(wildcard, ".*?")); - for (const ns of namespaceList) { - if (ns.startsWith("-")) { - skippedNamespaces.push(new RegExp(`^${ns.substr(1)}$`)); - } - else { - enabledNamespaces.push(new RegExp(`^${ns}$`)); - } - } - for (const instance of debuggers) { - instance.enabled = enabled(instance.namespace); - } -} -function enabled(namespace) { - if (namespace.endsWith("*")) { - return true; - } - for (const skipped of skippedNamespaces) { - if (skipped.test(namespace)) { - return false; - } - } - for (const enabledNamespace of enabledNamespaces) { - if (enabledNamespace.test(namespace)) { - return true; - } - } - return false; -} -function disable() { - const result = enabledString || ""; - enable(""); - return result; -} -function createDebugger(namespace) { - const newDebugger = Object.assign(debug, { - enabled: enabled(namespace), - destroy, - log: debugObj.log, - namespace, - extend, - }); - function debug(...args) { - if (!newDebugger.enabled) { - return; - } - if (args.length > 0) { - args[0] = `${namespace} ${args[0]}`; - } - newDebugger.log(...args); - } - debuggers.push(newDebugger); - return newDebugger; -} -function destroy() { - const index = debuggers.indexOf(this); - if (index >= 0) { - debuggers.splice(index, 1); - return true; - } - return false; -} -function extend(namespace) { - const newDebugger = createDebugger(`${this.namespace}:${namespace}`); - newDebugger.log = this.log; - return newDebugger; -} -var debug = debugObj; - -// Copyright (c) Microsoft Corporation. -const registeredLoggers = new Set(); -const logLevelFromEnv = (typeof process !== "undefined" && process.env && process.env.AZURE_LOG_LEVEL) || undefined; -let azureLogLevel; -/** - * The AzureLogger provides a mechanism for overriding where logs are output to. - * By default, logs are sent to stderr. - * Override the `log` method to redirect logs to another location. - */ -const AzureLogger = debug("azure"); -AzureLogger.log = (...args) => { - debug.log(...args); -}; -const AZURE_LOG_LEVELS = ["verbose", "info", "warning", "error"]; -if (logLevelFromEnv) { - // avoid calling setLogLevel because we don't want a mis-set environment variable to crash - if (isAzureLogLevel(logLevelFromEnv)) { - setLogLevel(logLevelFromEnv); - } - else { - console.error(`AZURE_LOG_LEVEL set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${AZURE_LOG_LEVELS.join(", ")}.`); - } -} -/** - * Immediately enables logging at the specified log level. If no level is specified, logging is disabled. - * @param level - The log level to enable for logging. - * Options from most verbose to least verbose are: - * - verbose - * - info - * - warning - * - error - */ -function setLogLevel(level) { - if (level && !isAzureLogLevel(level)) { - throw new Error(`Unknown log level '${level}'. Acceptable values: ${AZURE_LOG_LEVELS.join(",")}`); - } - azureLogLevel = level; - const enabledNamespaces = []; - for (const logger of registeredLoggers) { - if (shouldEnable(logger)) { - enabledNamespaces.push(logger.namespace); - } - } - debug.enable(enabledNamespaces.join(",")); -} -/** - * Retrieves the currently specified log level. - */ -function getLogLevel() { - return azureLogLevel; -} -const levelMap = { - verbose: 400, - info: 300, - warning: 200, - error: 100, -}; -/** - * Creates a logger for use by the Azure SDKs that inherits from `AzureLogger`. - * @param namespace - The name of the SDK package. - * @hidden - */ -function createClientLogger(namespace) { - const clientRootLogger = AzureLogger.extend(namespace); - patchLogMethod(AzureLogger, clientRootLogger); - return { - error: createLogger(clientRootLogger, "error"), - warning: createLogger(clientRootLogger, "warning"), - info: createLogger(clientRootLogger, "info"), - verbose: createLogger(clientRootLogger, "verbose"), - }; -} -function patchLogMethod(parent, child) { - child.log = (...args) => { - parent.log(...args); - }; -} -function createLogger(parent, level) { - const logger = Object.assign(parent.extend(level), { - level, - }); - patchLogMethod(parent, logger); - if (shouldEnable(logger)) { - const enabledNamespaces = debug.disable(); - debug.enable(enabledNamespaces + "," + logger.namespace); - } - registeredLoggers.add(logger); - return logger; -} -function shouldEnable(logger) { - return Boolean(azureLogLevel && levelMap[logger.level] <= levelMap[azureLogLevel]); -} -function isAzureLogLevel(logLevel) { - return AZURE_LOG_LEVELS.includes(logLevel); -} - -exports.AzureLogger = AzureLogger; -exports.createClientLogger = createClientLogger; -exports.getLogLevel = getLogLevel; -exports.setLogLevel = setLogLevel; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ 4100: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var coreHttp = __nccwpck_require__(4607); -var tslib = __nccwpck_require__(4351); -var coreTracing = __nccwpck_require__(4175); -var logger$1 = __nccwpck_require__(3233); -var abortController = __nccwpck_require__(978); -var os = __nccwpck_require__(2037); -var crypto = __nccwpck_require__(6113); -var stream = __nccwpck_require__(2781); -__nccwpck_require__(4559); -var coreLro = __nccwpck_require__(7094); -var events = __nccwpck_require__(2361); -var fs = __nccwpck_require__(7147); -var util = __nccwpck_require__(3837); - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n["default"] = e; - return Object.freeze(n); -} - -var coreHttp__namespace = /*#__PURE__*/_interopNamespace(coreHttp); -var os__namespace = /*#__PURE__*/_interopNamespace(os); -var fs__namespace = /*#__PURE__*/_interopNamespace(fs); -var util__namespace = /*#__PURE__*/_interopNamespace(util); - -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -const BlobServiceProperties = { - serializedName: "BlobServiceProperties", - xmlName: "StorageServiceProperties", - type: { - name: "Composite", - className: "BlobServiceProperties", - modelProperties: { - blobAnalyticsLogging: { - serializedName: "Logging", - xmlName: "Logging", - type: { - name: "Composite", - className: "Logging" - } - }, - hourMetrics: { - serializedName: "HourMetrics", - xmlName: "HourMetrics", - type: { - name: "Composite", - className: "Metrics" - } - }, - minuteMetrics: { - serializedName: "MinuteMetrics", - xmlName: "MinuteMetrics", - type: { - name: "Composite", - className: "Metrics" - } - }, - cors: { - serializedName: "Cors", - xmlName: "Cors", - xmlIsWrapped: true, - xmlElementName: "CorsRule", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "CorsRule" - } - } - } - }, - defaultServiceVersion: { - serializedName: "DefaultServiceVersion", - xmlName: "DefaultServiceVersion", - type: { - name: "String" - } - }, - deleteRetentionPolicy: { - serializedName: "DeleteRetentionPolicy", - xmlName: "DeleteRetentionPolicy", - type: { - name: "Composite", - className: "RetentionPolicy" - } - }, - staticWebsite: { - serializedName: "StaticWebsite", - xmlName: "StaticWebsite", - type: { - name: "Composite", - className: "StaticWebsite" - } - } - } - } -}; -const Logging = { - serializedName: "Logging", - type: { - name: "Composite", - className: "Logging", - modelProperties: { - version: { - serializedName: "Version", - required: true, - xmlName: "Version", - type: { - name: "String" + } + } + } +}; +const Logging = { + serializedName: "Logging", + type: { + name: "Composite", + className: "Logging", + modelProperties: { + version: { + serializedName: "Version", + required: true, + xmlName: "Version", + type: { + name: "String" } }, deleteProperty: { @@ -47427,12 +45290,12 @@ var TraceFlags; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.VERSION = void 0; // this is autogenerated file, see scripts/version-update.js -exports.VERSION = '1.7.0'; +exports.VERSION = '1.8.0'; //# sourceMappingURL=version.js.map /***/ }), -/***/ 4812: +/***/ 6284: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { module.exports = @@ -67384,6 +65247,9 @@ function httpRedirectFetch (fetchParams, response) { // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name request.headersList.delete('authorization') + // https://fetch.spec.whatwg.org/#authentication-entries + request.headersList.delete('proxy-authorization', true) + // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement. request.headersList.delete('cookie') request.headersList.delete('host') @@ -78484,1256 +76350,2104 @@ function percentEncode(c) { return "%" + hex; } -function utf8PercentEncode(c) { - const buf = new Buffer(c); - - let str = ""; +function utf8PercentEncode(c) { + const buf = new Buffer(c); + + let str = ""; + + for (let i = 0; i < buf.length; ++i) { + str += percentEncode(buf[i]); + } + + return str; +} + +function utf8PercentDecode(str) { + const input = new Buffer(str); + const output = []; + for (let i = 0; i < input.length; ++i) { + if (input[i] !== 37) { + output.push(input[i]); + } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { + output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); + i += 2; + } else { + output.push(input[i]); + } + } + return new Buffer(output).toString(); +} + +function isC0ControlPercentEncode(c) { + return c <= 0x1F || c > 0x7E; +} + +const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); +function isPathPercentEncode(c) { + return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); +} + +const extraUserinfoPercentEncodeSet = + new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); +function isUserinfoPercentEncode(c) { + return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); +} + +function percentEncodeChar(c, encodeSetPredicate) { + const cStr = String.fromCodePoint(c); + + if (encodeSetPredicate(c)) { + return utf8PercentEncode(cStr); + } + + return cStr; +} + +function parseIPv4Number(input) { + let R = 10; + + if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { + input = input.substring(2); + R = 16; + } else if (input.length >= 2 && input.charAt(0) === "0") { + input = input.substring(1); + R = 8; + } + + if (input === "") { + return 0; + } + + const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); + if (regex.test(input)) { + return failure; + } + + return parseInt(input, R); +} + +function parseIPv4(input) { + const parts = input.split("."); + if (parts[parts.length - 1] === "") { + if (parts.length > 1) { + parts.pop(); + } + } + + if (parts.length > 4) { + return input; + } + + const numbers = []; + for (const part of parts) { + if (part === "") { + return input; + } + const n = parseIPv4Number(part); + if (n === failure) { + return input; + } + + numbers.push(n); + } + + for (let i = 0; i < numbers.length - 1; ++i) { + if (numbers[i] > 255) { + return failure; + } + } + if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { + return failure; + } + + let ipv4 = numbers.pop(); + let counter = 0; + + for (const n of numbers) { + ipv4 += n * Math.pow(256, 3 - counter); + ++counter; + } + + return ipv4; +} + +function serializeIPv4(address) { + let output = ""; + let n = address; + + for (let i = 1; i <= 4; ++i) { + output = String(n % 256) + output; + if (i !== 4) { + output = "." + output; + } + n = Math.floor(n / 256); + } + + return output; +} + +function parseIPv6(input) { + const address = [0, 0, 0, 0, 0, 0, 0, 0]; + let pieceIndex = 0; + let compress = null; + let pointer = 0; + + input = punycode.ucs2.decode(input); + + if (input[pointer] === 58) { + if (input[pointer + 1] !== 58) { + return failure; + } + + pointer += 2; + ++pieceIndex; + compress = pieceIndex; + } + + while (pointer < input.length) { + if (pieceIndex === 8) { + return failure; + } + + if (input[pointer] === 58) { + if (compress !== null) { + return failure; + } + ++pointer; + ++pieceIndex; + compress = pieceIndex; + continue; + } + + let value = 0; + let length = 0; + + while (length < 4 && isASCIIHex(input[pointer])) { + value = value * 0x10 + parseInt(at(input, pointer), 16); + ++pointer; + ++length; + } + + if (input[pointer] === 46) { + if (length === 0) { + return failure; + } + + pointer -= length; + + if (pieceIndex > 6) { + return failure; + } + + let numbersSeen = 0; + + while (input[pointer] !== undefined) { + let ipv4Piece = null; + + if (numbersSeen > 0) { + if (input[pointer] === 46 && numbersSeen < 4) { + ++pointer; + } else { + return failure; + } + } + + if (!isASCIIDigit(input[pointer])) { + return failure; + } + + while (isASCIIDigit(input[pointer])) { + const number = parseInt(at(input, pointer)); + if (ipv4Piece === null) { + ipv4Piece = number; + } else if (ipv4Piece === 0) { + return failure; + } else { + ipv4Piece = ipv4Piece * 10 + number; + } + if (ipv4Piece > 255) { + return failure; + } + ++pointer; + } + + address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; + + ++numbersSeen; + + if (numbersSeen === 2 || numbersSeen === 4) { + ++pieceIndex; + } + } + + if (numbersSeen !== 4) { + return failure; + } + + break; + } else if (input[pointer] === 58) { + ++pointer; + if (input[pointer] === undefined) { + return failure; + } + } else if (input[pointer] !== undefined) { + return failure; + } + + address[pieceIndex] = value; + ++pieceIndex; + } + + if (compress !== null) { + let swaps = pieceIndex - compress; + pieceIndex = 7; + while (pieceIndex !== 0 && swaps > 0) { + const temp = address[compress + swaps - 1]; + address[compress + swaps - 1] = address[pieceIndex]; + address[pieceIndex] = temp; + --pieceIndex; + --swaps; + } + } else if (compress === null && pieceIndex !== 8) { + return failure; + } + + return address; +} + +function serializeIPv6(address) { + let output = ""; + const seqResult = findLongestZeroSequence(address); + const compress = seqResult.idx; + let ignore0 = false; + + for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { + if (ignore0 && address[pieceIndex] === 0) { + continue; + } else if (ignore0) { + ignore0 = false; + } + + if (compress === pieceIndex) { + const separator = pieceIndex === 0 ? "::" : ":"; + output += separator; + ignore0 = true; + continue; + } + + output += address[pieceIndex].toString(16); + + if (pieceIndex !== 7) { + output += ":"; + } + } + + return output; +} + +function parseHost(input, isSpecialArg) { + if (input[0] === "[") { + if (input[input.length - 1] !== "]") { + return failure; + } + + return parseIPv6(input.substring(1, input.length - 1)); + } + + if (!isSpecialArg) { + return parseOpaqueHost(input); + } + + const domain = utf8PercentDecode(input); + const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); + if (asciiDomain === null) { + return failure; + } + + if (containsForbiddenHostCodePoint(asciiDomain)) { + return failure; + } + + const ipv4Host = parseIPv4(asciiDomain); + if (typeof ipv4Host === "number" || ipv4Host === failure) { + return ipv4Host; + } + + return asciiDomain; +} + +function parseOpaqueHost(input) { + if (containsForbiddenHostCodePointExcludingPercent(input)) { + return failure; + } + + let output = ""; + const decoded = punycode.ucs2.decode(input); + for (let i = 0; i < decoded.length; ++i) { + output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); + } + return output; +} + +function findLongestZeroSequence(arr) { + let maxIdx = null; + let maxLen = 1; // only find elements > 1 + let currStart = null; + let currLen = 0; + + for (let i = 0; i < arr.length; ++i) { + if (arr[i] !== 0) { + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + currStart = null; + currLen = 0; + } else { + if (currStart === null) { + currStart = i; + } + ++currLen; + } + } + + // if trailing zeros + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + return { + idx: maxIdx, + len: maxLen + }; +} + +function serializeHost(host) { + if (typeof host === "number") { + return serializeIPv4(host); + } + + // IPv6 serializer + if (host instanceof Array) { + return "[" + serializeIPv6(host) + "]"; + } + + return host; +} + +function trimControlChars(url) { + return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); +} + +function trimTabAndNewline(url) { + return url.replace(/\u0009|\u000A|\u000D/g, ""); +} - for (let i = 0; i < buf.length; ++i) { - str += percentEncode(buf[i]); +function shortenPath(url) { + const path = url.path; + if (path.length === 0) { + return; + } + if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { + return; } - return str; + path.pop(); } -function utf8PercentDecode(str) { - const input = new Buffer(str); - const output = []; - for (let i = 0; i < input.length; ++i) { - if (input[i] !== 37) { - output.push(input[i]); - } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { - output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); - i += 2; - } else { - output.push(input[i]); - } - } - return new Buffer(output).toString(); +function includesCredentials(url) { + return url.username !== "" || url.password !== ""; } -function isC0ControlPercentEncode(c) { - return c <= 0x1F || c > 0x7E; +function cannotHaveAUsernamePasswordPort(url) { + return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; } -const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); -function isPathPercentEncode(c) { - return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); +function isNormalizedWindowsDriveLetter(string) { + return /^[A-Za-z]:$/.test(string); } -const extraUserinfoPercentEncodeSet = - new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); -function isUserinfoPercentEncode(c) { - return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); -} +function URLStateMachine(input, base, encodingOverride, url, stateOverride) { + this.pointer = 0; + this.input = input; + this.base = base || null; + this.encodingOverride = encodingOverride || "utf-8"; + this.stateOverride = stateOverride; + this.url = url; + this.failure = false; + this.parseError = false; -function percentEncodeChar(c, encodeSetPredicate) { - const cStr = String.fromCodePoint(c); + if (!this.url) { + this.url = { + scheme: "", + username: "", + password: "", + host: null, + port: null, + path: [], + query: null, + fragment: null, - if (encodeSetPredicate(c)) { - return utf8PercentEncode(cStr); + cannotBeABaseURL: false + }; + + const res = trimControlChars(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; } - return cStr; -} + const res = trimTabAndNewline(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; -function parseIPv4Number(input) { - let R = 10; + this.state = stateOverride || "scheme start"; - if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { - input = input.substring(2); - R = 16; - } else if (input.length >= 2 && input.charAt(0) === "0") { - input = input.substring(1); - R = 8; - } + this.buffer = ""; + this.atFlag = false; + this.arrFlag = false; + this.passwordTokenSeenFlag = false; - if (input === "") { - return 0; + this.input = punycode.ucs2.decode(this.input); + + for (; this.pointer <= this.input.length; ++this.pointer) { + const c = this.input[this.pointer]; + const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); + + // exec state machine + const ret = this["parse " + this.state](c, cStr); + if (!ret) { + break; // terminate algorithm + } else if (ret === failure) { + this.failure = true; + break; + } } +} - const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); - if (regex.test(input)) { +URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { + if (isASCIIAlpha(c)) { + this.buffer += cStr.toLowerCase(); + this.state = "scheme"; + } else if (!this.stateOverride) { + this.state = "no scheme"; + --this.pointer; + } else { + this.parseError = true; return failure; } - return parseInt(input, R); -} + return true; +}; -function parseIPv4(input) { - const parts = input.split("."); - if (parts[parts.length - 1] === "") { - if (parts.length > 1) { - parts.pop(); - } - } +URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { + if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { + this.buffer += cStr.toLowerCase(); + } else if (c === 58) { + if (this.stateOverride) { + if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { + return false; + } - if (parts.length > 4) { - return input; - } + if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { + return false; + } - const numbers = []; - for (const part of parts) { - if (part === "") { - return input; + if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { + return false; + } + + if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { + return false; + } } - const n = parseIPv4Number(part); - if (n === failure) { - return input; + this.url.scheme = this.buffer; + this.buffer = ""; + if (this.stateOverride) { + return false; } - - numbers.push(n); - } - - for (let i = 0; i < numbers.length - 1; ++i) { - if (numbers[i] > 255) { - return failure; + if (this.url.scheme === "file") { + if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { + this.parseError = true; + } + this.state = "file"; + } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { + this.state = "special relative or authority"; + } else if (isSpecial(this.url)) { + this.state = "special authority slashes"; + } else if (this.input[this.pointer + 1] === 47) { + this.state = "path or authority"; + ++this.pointer; + } else { + this.url.cannotBeABaseURL = true; + this.url.path.push(""); + this.state = "cannot-be-a-base-URL path"; } - } - if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { + } else if (!this.stateOverride) { + this.buffer = ""; + this.state = "no scheme"; + this.pointer = -1; + } else { + this.parseError = true; return failure; } - let ipv4 = numbers.pop(); - let counter = 0; + return true; +}; - for (const n of numbers) { - ipv4 += n * Math.pow(256, 3 - counter); - ++counter; +URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { + if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { + return failure; + } else if (this.base.cannotBeABaseURL && c === 35) { + this.url.scheme = this.base.scheme; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.url.cannotBeABaseURL = true; + this.state = "fragment"; + } else if (this.base.scheme === "file") { + this.state = "file"; + --this.pointer; + } else { + this.state = "relative"; + --this.pointer; } - return ipv4; -} - -function serializeIPv4(address) { - let output = ""; - let n = address; + return true; +}; - for (let i = 1; i <= 4; ++i) { - output = String(n % 256) + output; - if (i !== 4) { - output = "." + output; - } - n = Math.floor(n / 256); +URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "relative"; + --this.pointer; } - return output; -} + return true; +}; -function parseIPv6(input) { - const address = [0, 0, 0, 0, 0, 0, 0, 0]; - let pieceIndex = 0; - let compress = null; - let pointer = 0; +URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { + if (c === 47) { + this.state = "authority"; + } else { + this.state = "path"; + --this.pointer; + } - input = punycode.ucs2.decode(input); + return true; +}; - if (input[pointer] === 58) { - if (input[pointer + 1] !== 58) { - return failure; - } +URLStateMachine.prototype["parse relative"] = function parseRelative(c) { + this.url.scheme = this.base.scheme; + if (isNaN(c)) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 47) { + this.state = "relative slash"; + } else if (c === 63) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else if (isSpecial(this.url) && c === 92) { + this.parseError = true; + this.state = "relative slash"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(0, this.base.path.length - 1); - pointer += 2; - ++pieceIndex; - compress = pieceIndex; + this.state = "path"; + --this.pointer; } - while (pointer < input.length) { - if (pieceIndex === 8) { - return failure; - } + return true; +}; - if (input[pointer] === 58) { - if (compress !== null) { - return failure; - } - ++pointer; - ++pieceIndex; - compress = pieceIndex; - continue; +URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { + if (isSpecial(this.url) && (c === 47 || c === 92)) { + if (c === 92) { + this.parseError = true; } + this.state = "special authority ignore slashes"; + } else if (c === 47) { + this.state = "authority"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.state = "path"; + --this.pointer; + } - let value = 0; - let length = 0; + return true; +}; - while (length < 4 && isASCIIHex(input[pointer])) { - value = value * 0x10 + parseInt(at(input, pointer), 16); - ++pointer; - ++length; - } +URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "special authority ignore slashes"; + --this.pointer; + } - if (input[pointer] === 46) { - if (length === 0) { - return failure; - } + return true; +}; - pointer -= length; +URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { + if (c !== 47 && c !== 92) { + this.state = "authority"; + --this.pointer; + } else { + this.parseError = true; + } - if (pieceIndex > 6) { - return failure; - } + return true; +}; - let numbersSeen = 0; +URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { + if (c === 64) { + this.parseError = true; + if (this.atFlag) { + this.buffer = "%40" + this.buffer; + } + this.atFlag = true; - while (input[pointer] !== undefined) { - let ipv4Piece = null; + // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars + const len = countSymbols(this.buffer); + for (let pointer = 0; pointer < len; ++pointer) { + const codePoint = this.buffer.codePointAt(pointer); - if (numbersSeen > 0) { - if (input[pointer] === 46 && numbersSeen < 4) { - ++pointer; - } else { - return failure; - } - } + if (codePoint === 58 && !this.passwordTokenSeenFlag) { + this.passwordTokenSeenFlag = true; + continue; + } + const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); + if (this.passwordTokenSeenFlag) { + this.url.password += encodedCodePoints; + } else { + this.url.username += encodedCodePoints; + } + } + this.buffer = ""; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + if (this.atFlag && this.buffer === "") { + this.parseError = true; + return failure; + } + this.pointer -= countSymbols(this.buffer) + 1; + this.buffer = ""; + this.state = "host"; + } else { + this.buffer += cStr; + } - if (!isASCIIDigit(input[pointer])) { - return failure; - } + return true; +}; - while (isASCIIDigit(input[pointer])) { - const number = parseInt(at(input, pointer)); - if (ipv4Piece === null) { - ipv4Piece = number; - } else if (ipv4Piece === 0) { - return failure; - } else { - ipv4Piece = ipv4Piece * 10 + number; - } - if (ipv4Piece > 255) { - return failure; - } - ++pointer; - } +URLStateMachine.prototype["parse hostname"] = +URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { + if (this.stateOverride && this.url.scheme === "file") { + --this.pointer; + this.state = "file host"; + } else if (c === 58 && !this.arrFlag) { + if (this.buffer === "") { + this.parseError = true; + return failure; + } - address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } - ++numbersSeen; + this.url.host = host; + this.buffer = ""; + this.state = "port"; + if (this.stateOverride === "hostname") { + return false; + } + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + --this.pointer; + if (isSpecial(this.url) && this.buffer === "") { + this.parseError = true; + return failure; + } else if (this.stateOverride && this.buffer === "" && + (includesCredentials(this.url) || this.url.port !== null)) { + this.parseError = true; + return false; + } - if (numbersSeen === 2 || numbersSeen === 4) { - ++pieceIndex; - } - } + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } - if (numbersSeen !== 4) { - return failure; - } + this.url.host = host; + this.buffer = ""; + this.state = "path start"; + if (this.stateOverride) { + return false; + } + } else { + if (c === 91) { + this.arrFlag = true; + } else if (c === 93) { + this.arrFlag = false; + } + this.buffer += cStr; + } - break; - } else if (input[pointer] === 58) { - ++pointer; - if (input[pointer] === undefined) { + return true; +}; + +URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { + if (isASCIIDigit(c)) { + this.buffer += cStr; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92) || + this.stateOverride) { + if (this.buffer !== "") { + const port = parseInt(this.buffer); + if (port > Math.pow(2, 16) - 1) { + this.parseError = true; return failure; } - } else if (input[pointer] !== undefined) { - return failure; + this.url.port = port === defaultPort(this.url.scheme) ? null : port; + this.buffer = ""; } - - address[pieceIndex] = value; - ++pieceIndex; - } - - if (compress !== null) { - let swaps = pieceIndex - compress; - pieceIndex = 7; - while (pieceIndex !== 0 && swaps > 0) { - const temp = address[compress + swaps - 1]; - address[compress + swaps - 1] = address[pieceIndex]; - address[pieceIndex] = temp; - --pieceIndex; - --swaps; + if (this.stateOverride) { + return false; } - } else if (compress === null && pieceIndex !== 8) { + this.state = "path start"; + --this.pointer; + } else { + this.parseError = true; return failure; } - return address; -} + return true; +}; -function serializeIPv6(address) { - let output = ""; - const seqResult = findLongestZeroSequence(address); - const compress = seqResult.idx; - let ignore0 = false; +const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); - for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { - if (ignore0 && address[pieceIndex] === 0) { - continue; - } else if (ignore0) { - ignore0 = false; - } +URLStateMachine.prototype["parse file"] = function parseFile(c) { + this.url.scheme = "file"; - if (compress === pieceIndex) { - const separator = pieceIndex === 0 ? "::" : ":"; - output += separator; - ignore0 = true; - continue; + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; } + this.state = "file slash"; + } else if (this.base !== null && this.base.scheme === "file") { + if (isNaN(c)) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 63) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else { + if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points + !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || + (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points + !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + shortenPath(this.url); + } else { + this.parseError = true; + } - output += address[pieceIndex].toString(16); - - if (pieceIndex !== 7) { - output += ":"; + this.state = "path"; + --this.pointer; } + } else { + this.state = "path"; + --this.pointer; } - return output; -} + return true; +}; -function parseHost(input, isSpecialArg) { - if (input[0] === "[") { - if (input[input.length - 1] !== "]") { - return failure; +URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; } - - return parseIPv6(input.substring(1, input.length - 1)); + this.state = "file host"; + } else { + if (this.base !== null && this.base.scheme === "file") { + if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { + this.url.path.push(this.base.path[0]); + } else { + this.url.host = this.base.host; + } + } + this.state = "path"; + --this.pointer; } - if (!isSpecialArg) { - return parseOpaqueHost(input); - } + return true; +}; - const domain = utf8PercentDecode(input); - const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); - if (asciiDomain === null) { - return failure; - } +URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { + if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { + --this.pointer; + if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { + this.parseError = true; + this.state = "path"; + } else if (this.buffer === "") { + this.url.host = ""; + if (this.stateOverride) { + return false; + } + this.state = "path start"; + } else { + let host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + if (host === "localhost") { + host = ""; + } + this.url.host = host; - if (containsForbiddenHostCodePoint(asciiDomain)) { - return failure; - } + if (this.stateOverride) { + return false; + } - const ipv4Host = parseIPv4(asciiDomain); - if (typeof ipv4Host === "number" || ipv4Host === failure) { - return ipv4Host; + this.buffer = ""; + this.state = "path start"; + } + } else { + this.buffer += cStr; } - return asciiDomain; -} + return true; +}; -function parseOpaqueHost(input) { - if (containsForbiddenHostCodePointExcludingPercent(input)) { - return failure; - } +URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { + if (isSpecial(this.url)) { + if (c === 92) { + this.parseError = true; + } + this.state = "path"; - let output = ""; - const decoded = punycode.ucs2.decode(input); - for (let i = 0; i < decoded.length; ++i) { - output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); + if (c !== 47 && c !== 92) { + --this.pointer; + } + } else if (!this.stateOverride && c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (!this.stateOverride && c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else if (c !== undefined) { + this.state = "path"; + if (c !== 47) { + --this.pointer; + } } - return output; -} -function findLongestZeroSequence(arr) { - let maxIdx = null; - let maxLen = 1; // only find elements > 1 - let currStart = null; - let currLen = 0; + return true; +}; - for (let i = 0; i < arr.length; ++i) { - if (arr[i] !== 0) { - if (currLen > maxLen) { - maxIdx = currStart; - maxLen = currLen; - } +URLStateMachine.prototype["parse path"] = function parsePath(c) { + if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || + (!this.stateOverride && (c === 63 || c === 35))) { + if (isSpecial(this.url) && c === 92) { + this.parseError = true; + } - currStart = null; - currLen = 0; - } else { - if (currStart === null) { - currStart = i; + if (isDoubleDot(this.buffer)) { + shortenPath(this.url); + if (c !== 47 && !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); } - ++currLen; + } else if (isSingleDot(this.buffer) && c !== 47 && + !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } else if (!isSingleDot(this.buffer)) { + if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { + if (this.url.host !== "" && this.url.host !== null) { + this.parseError = true; + this.url.host = ""; + } + this.buffer = this.buffer[0] + ":"; + } + this.url.path.push(this.buffer); } - } - - // if trailing zeros - if (currLen > maxLen) { - maxIdx = currStart; - maxLen = currLen; - } - - return { - idx: maxIdx, - len: maxLen - }; -} + this.buffer = ""; + if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { + while (this.url.path.length > 1 && this.url.path[0] === "") { + this.parseError = true; + this.url.path.shift(); + } + } + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. -function serializeHost(host) { - if (typeof host === "number") { - return serializeIPv4(host); - } + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } - // IPv6 serializer - if (host instanceof Array) { - return "[" + serializeIPv6(host) + "]"; + this.buffer += percentEncodeChar(c, isPathPercentEncode); } - return host; -} + return true; +}; -function trimControlChars(url) { - return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); -} +URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else { + // TODO: Add: not a URL code point + if (!isNaN(c) && c !== 37) { + this.parseError = true; + } -function trimTabAndNewline(url) { - return url.replace(/\u0009|\u000A|\u000D/g, ""); -} + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } -function shortenPath(url) { - const path = url.path; - if (path.length === 0) { - return; - } - if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { - return; + if (!isNaN(c)) { + this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); + } } - path.pop(); -} - -function includesCredentials(url) { - return url.username !== "" || url.password !== ""; -} + return true; +}; -function cannotHaveAUsernamePasswordPort(url) { - return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; -} +URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { + if (isNaN(c) || (!this.stateOverride && c === 35)) { + if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { + this.encodingOverride = "utf-8"; + } -function isNormalizedWindowsDriveLetter(string) { - return /^[A-Za-z]:$/.test(string); -} + const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead + for (let i = 0; i < buffer.length; ++i) { + if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || + buffer[i] === 0x3C || buffer[i] === 0x3E) { + this.url.query += percentEncode(buffer[i]); + } else { + this.url.query += String.fromCodePoint(buffer[i]); + } + } -function URLStateMachine(input, base, encodingOverride, url, stateOverride) { - this.pointer = 0; - this.input = input; - this.base = base || null; - this.encodingOverride = encodingOverride || "utf-8"; - this.stateOverride = stateOverride; - this.url = url; - this.failure = false; - this.parseError = false; + this.buffer = ""; + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } - if (!this.url) { - this.url = { - scheme: "", - username: "", - password: "", - host: null, - port: null, - path: [], - query: null, - fragment: null, + this.buffer += cStr; + } - cannotBeABaseURL: false - }; + return true; +}; - const res = trimControlChars(this.input); - if (res !== this.input) { +URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { + if (isNaN(c)) { // do nothing + } else if (c === 0x0) { + this.parseError = true; + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { this.parseError = true; } - this.input = res; - } - const res = trimTabAndNewline(this.input); - if (res !== this.input) { - this.parseError = true; + this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); } - this.input = res; - this.state = stateOverride || "scheme start"; + return true; +}; - this.buffer = ""; - this.atFlag = false; - this.arrFlag = false; - this.passwordTokenSeenFlag = false; +function serializeURL(url, excludeFragment) { + let output = url.scheme + ":"; + if (url.host !== null) { + output += "//"; - this.input = punycode.ucs2.decode(this.input); + if (url.username !== "" || url.password !== "") { + output += url.username; + if (url.password !== "") { + output += ":" + url.password; + } + output += "@"; + } - for (; this.pointer <= this.input.length; ++this.pointer) { - const c = this.input[this.pointer]; - const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); + output += serializeHost(url.host); - // exec state machine - const ret = this["parse " + this.state](c, cStr); - if (!ret) { - break; // terminate algorithm - } else if (ret === failure) { - this.failure = true; - break; + if (url.port !== null) { + output += ":" + url.port; } + } else if (url.host === null && url.scheme === "file") { + output += "//"; } -} -URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { - if (isASCIIAlpha(c)) { - this.buffer += cStr.toLowerCase(); - this.state = "scheme"; - } else if (!this.stateOverride) { - this.state = "no scheme"; - --this.pointer; + if (url.cannotBeABaseURL) { + output += url.path[0]; } else { - this.parseError = true; - return failure; + for (const string of url.path) { + output += "/" + string; + } } - return true; -}; + if (url.query !== null) { + output += "?" + url.query; + } -URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { - if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { - this.buffer += cStr.toLowerCase(); - } else if (c === 58) { - if (this.stateOverride) { - if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { - return false; - } + if (!excludeFragment && url.fragment !== null) { + output += "#" + url.fragment; + } - if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { - return false; - } + return output; +} - if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { - return false; - } +function serializeOrigin(tuple) { + let result = tuple.scheme + "://"; + result += serializeHost(tuple.host); - if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { - return false; - } - } - this.url.scheme = this.buffer; - this.buffer = ""; - if (this.stateOverride) { - return false; - } - if (this.url.scheme === "file") { - if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { - this.parseError = true; - } - this.state = "file"; - } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { - this.state = "special relative or authority"; - } else if (isSpecial(this.url)) { - this.state = "special authority slashes"; - } else if (this.input[this.pointer + 1] === 47) { - this.state = "path or authority"; - ++this.pointer; - } else { - this.url.cannotBeABaseURL = true; - this.url.path.push(""); - this.state = "cannot-be-a-base-URL path"; - } - } else if (!this.stateOverride) { - this.buffer = ""; - this.state = "no scheme"; - this.pointer = -1; - } else { - this.parseError = true; - return failure; + if (tuple.port !== null) { + result += ":" + tuple.port; } - return true; -}; + return result; +} -URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { - if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { - return failure; - } else if (this.base.cannotBeABaseURL && c === 35) { - this.url.scheme = this.base.scheme; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.url.cannotBeABaseURL = true; - this.state = "fragment"; - } else if (this.base.scheme === "file") { - this.state = "file"; - --this.pointer; - } else { - this.state = "relative"; - --this.pointer; - } +module.exports.serializeURL = serializeURL; - return true; +module.exports.serializeURLOrigin = function (url) { + // https://url.spec.whatwg.org/#concept-url-origin + switch (url.scheme) { + case "blob": + try { + return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); + } catch (e) { + // serializing an opaque origin returns "null" + return "null"; + } + case "ftp": + case "gopher": + case "http": + case "https": + case "ws": + case "wss": + return serializeOrigin({ + scheme: url.scheme, + host: url.host, + port: url.port + }); + case "file": + // spec says "exercise to the reader", chrome says "file://" + return "file://"; + default: + // serializing an opaque origin returns "null" + return "null"; + } }; -URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { - if (c === 47 && this.input[this.pointer + 1] === 47) { - this.state = "special authority ignore slashes"; - ++this.pointer; - } else { - this.parseError = true; - this.state = "relative"; - --this.pointer; +module.exports.basicURLParse = function (input, options) { + if (options === undefined) { + options = {}; } - return true; + const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); + if (usm.failure) { + return "failure"; + } + + return usm.url; }; -URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { - if (c === 47) { - this.state = "authority"; - } else { - this.state = "path"; - --this.pointer; +module.exports.setTheUsername = function (url, username) { + url.username = ""; + const decoded = punycode.ucs2.decode(username); + for (let i = 0; i < decoded.length; ++i) { + url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); } +}; - return true; +module.exports.setThePassword = function (url, password) { + url.password = ""; + const decoded = punycode.ucs2.decode(password); + for (let i = 0; i < decoded.length; ++i) { + url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } }; -URLStateMachine.prototype["parse relative"] = function parseRelative(c) { - this.url.scheme = this.base.scheme; - if (isNaN(c)) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - } else if (c === 47) { - this.state = "relative slash"; - } else if (c === 63) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.state = "fragment"; - } else if (isSpecial(this.url) && c === 92) { - this.parseError = true; - this.state = "relative slash"; - } else { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(0, this.base.path.length - 1); +module.exports.serializeHost = serializeHost; - this.state = "path"; - --this.pointer; - } +module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; - return true; +module.exports.serializeInteger = function (integer) { + return String(integer); }; -URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { - if (isSpecial(this.url) && (c === 47 || c === 92)) { - if (c === 92) { - this.parseError = true; - } - this.state = "special authority ignore slashes"; - } else if (c === 47) { - this.state = "authority"; - } else { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.state = "path"; - --this.pointer; +module.exports.parseURL = function (input, options) { + if (options === undefined) { + options = {}; } - return true; + // We don't handle blobs, so this just delegates: + return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); }; -URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { - if (c === 47 && this.input[this.pointer + 1] === 47) { - this.state = "special authority ignore slashes"; - ++this.pointer; - } else { - this.parseError = true; - this.state = "special authority ignore slashes"; - --this.pointer; - } - return true; -}; +/***/ }), -URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { - if (c !== 47 && c !== 92) { - this.state = "authority"; - --this.pointer; - } else { - this.parseError = true; +/***/ 3185: +/***/ ((module) => { + +"use strict"; + + +module.exports.mixin = function mixin(target, source) { + const keys = Object.getOwnPropertyNames(source); + for (let i = 0; i < keys.length; ++i) { + Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i])); } +}; - return true; +module.exports.wrapperSymbol = Symbol("wrapper"); +module.exports.implSymbol = Symbol("impl"); + +module.exports.wrapperForImpl = function (impl) { + return impl[module.exports.wrapperSymbol]; }; -URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { - if (c === 64) { - this.parseError = true; - if (this.atFlag) { - this.buffer = "%40" + this.buffer; +module.exports.implForWrapper = function (wrapper) { + return wrapper[module.exports.implSymbol]; +}; + + + +/***/ }), + +/***/ 2624: +/***/ (function(__unused_webpack_module, exports) { + +// Generated by CoffeeScript 1.12.7 +(function() { + "use strict"; + exports.stripBOM = function(str) { + if (str[0] === '\uFEFF') { + return str.substring(1); + } else { + return str; } - this.atFlag = true; + }; - // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars - const len = countSymbols(this.buffer); - for (let pointer = 0; pointer < len; ++pointer) { - const codePoint = this.buffer.codePointAt(pointer); +}).call(this); - if (codePoint === 58 && !this.passwordTokenSeenFlag) { - this.passwordTokenSeenFlag = true; - continue; + +/***/ }), + +/***/ 3337: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +// Generated by CoffeeScript 1.12.7 +(function() { + "use strict"; + var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA, + hasProp = {}.hasOwnProperty; + + builder = __nccwpck_require__(2958); + + defaults = (__nccwpck_require__(7251).defaults); + + requiresCDATA = function(entry) { + return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0); + }; + + wrapCDATA = function(entry) { + return ""; + }; + + escapeCDATA = function(entry) { + return entry.replace(']]>', ']]]]>'); + }; + + exports.Builder = (function() { + function Builder(opts) { + var key, ref, value; + this.options = {}; + ref = defaults["0.2"]; + for (key in ref) { + if (!hasProp.call(ref, key)) continue; + value = ref[key]; + this.options[key] = value; } - const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); - if (this.passwordTokenSeenFlag) { - this.url.password += encodedCodePoints; - } else { - this.url.username += encodedCodePoints; + for (key in opts) { + if (!hasProp.call(opts, key)) continue; + value = opts[key]; + this.options[key] = value; } } - this.buffer = ""; - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92)) { - if (this.atFlag && this.buffer === "") { - this.parseError = true; - return failure; - } - this.pointer -= countSymbols(this.buffer) + 1; - this.buffer = ""; - this.state = "host"; - } else { - this.buffer += cStr; - } - return true; -}; + Builder.prototype.buildObject = function(rootObj) { + var attrkey, charkey, render, rootElement, rootName; + attrkey = this.options.attrkey; + charkey = this.options.charkey; + if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) { + rootName = Object.keys(rootObj)[0]; + rootObj = rootObj[rootName]; + } else { + rootName = this.options.rootName; + } + render = (function(_this) { + return function(element, obj) { + var attr, child, entry, index, key, value; + if (typeof obj !== 'object') { + if (_this.options.cdata && requiresCDATA(obj)) { + element.raw(wrapCDATA(obj)); + } else { + element.txt(obj); + } + } else if (Array.isArray(obj)) { + for (index in obj) { + if (!hasProp.call(obj, index)) continue; + child = obj[index]; + for (key in child) { + entry = child[key]; + element = render(element.ele(key), entry).up(); + } + } + } else { + for (key in obj) { + if (!hasProp.call(obj, key)) continue; + child = obj[key]; + if (key === attrkey) { + if (typeof child === "object") { + for (attr in child) { + value = child[attr]; + element = element.att(attr, value); + } + } + } else if (key === charkey) { + if (_this.options.cdata && requiresCDATA(child)) { + element = element.raw(wrapCDATA(child)); + } else { + element = element.txt(child); + } + } else if (Array.isArray(child)) { + for (index in child) { + if (!hasProp.call(child, index)) continue; + entry = child[index]; + if (typeof entry === 'string') { + if (_this.options.cdata && requiresCDATA(entry)) { + element = element.ele(key).raw(wrapCDATA(entry)).up(); + } else { + element = element.ele(key, entry).up(); + } + } else { + element = render(element.ele(key), entry).up(); + } + } + } else if (typeof child === "object") { + element = render(element.ele(key), child).up(); + } else { + if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) { + element = element.ele(key).raw(wrapCDATA(child)).up(); + } else { + if (child == null) { + child = ''; + } + element = element.ele(key, child.toString()).up(); + } + } + } + } + return element; + }; + })(this); + rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, { + headless: this.options.headless, + allowSurrogateChars: this.options.allowSurrogateChars + }); + return render(rootElement, rootObj).end(this.options.renderOpts); + }; -URLStateMachine.prototype["parse hostname"] = -URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { - if (this.stateOverride && this.url.scheme === "file") { - --this.pointer; - this.state = "file host"; - } else if (c === 58 && !this.arrFlag) { - if (this.buffer === "") { - this.parseError = true; - return failure; - } + return Builder; - const host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } + })(); - this.url.host = host; - this.buffer = ""; - this.state = "port"; - if (this.stateOverride === "hostname") { - return false; - } - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92)) { - --this.pointer; - if (isSpecial(this.url) && this.buffer === "") { - this.parseError = true; - return failure; - } else if (this.stateOverride && this.buffer === "" && - (includesCredentials(this.url) || this.url.port !== null)) { - this.parseError = true; - return false; - } +}).call(this); - const host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - this.url.host = host; - this.buffer = ""; - this.state = "path start"; - if (this.stateOverride) { - return false; - } - } else { - if (c === 91) { - this.arrFlag = true; - } else if (c === 93) { - this.arrFlag = false; - } - this.buffer += cStr; - } +/***/ }), - return true; -}; +/***/ 7251: +/***/ (function(__unused_webpack_module, exports) { -URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { - if (isASCIIDigit(c)) { - this.buffer += cStr; - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92) || - this.stateOverride) { - if (this.buffer !== "") { - const port = parseInt(this.buffer); - if (port > Math.pow(2, 16) - 1) { - this.parseError = true; - return failure; - } - this.url.port = port === defaultPort(this.url.scheme) ? null : port; - this.buffer = ""; - } - if (this.stateOverride) { - return false; - } - this.state = "path start"; - --this.pointer; - } else { - this.parseError = true; - return failure; - } +// Generated by CoffeeScript 1.12.7 +(function() { + exports.defaults = { + "0.1": { + explicitCharkey: false, + trim: true, + normalize: true, + normalizeTags: false, + attrkey: "@", + charkey: "#", + explicitArray: false, + ignoreAttrs: false, + mergeAttrs: false, + explicitRoot: false, + validator: null, + xmlns: false, + explicitChildren: false, + childkey: '@@', + charsAsChildren: false, + includeWhiteChars: false, + async: false, + strict: true, + attrNameProcessors: null, + attrValueProcessors: null, + tagNameProcessors: null, + valueProcessors: null, + emptyTag: '' + }, + "0.2": { + explicitCharkey: false, + trim: false, + normalize: false, + normalizeTags: false, + attrkey: "$", + charkey: "_", + explicitArray: true, + ignoreAttrs: false, + mergeAttrs: false, + explicitRoot: true, + validator: null, + xmlns: false, + explicitChildren: false, + preserveChildrenOrder: false, + childkey: '$$', + charsAsChildren: false, + includeWhiteChars: false, + async: false, + strict: true, + attrNameProcessors: null, + attrValueProcessors: null, + tagNameProcessors: null, + valueProcessors: null, + rootName: 'root', + xmldec: { + 'version': '1.0', + 'encoding': 'UTF-8', + 'standalone': true + }, + doctype: null, + renderOpts: { + 'pretty': true, + 'indent': ' ', + 'newline': '\n' + }, + headless: false, + chunkSize: 10000, + emptyTag: '', + cdata: false + } + }; - return true; -}; +}).call(this); -const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); -URLStateMachine.prototype["parse file"] = function parseFile(c) { - this.url.scheme = "file"; +/***/ }), - if (c === 47 || c === 92) { - if (c === 92) { - this.parseError = true; - } - this.state = "file slash"; - } else if (this.base !== null && this.base.scheme === "file") { - if (isNaN(c)) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - } else if (c === 63) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.state = "fragment"; - } else { - if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points - !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || - (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points - !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - shortenPath(this.url); - } else { - this.parseError = true; - } +/***/ 3314: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - this.state = "path"; - --this.pointer; - } - } else { - this.state = "path"; - --this.pointer; - } +// Generated by CoffeeScript 1.12.7 +(function() { + "use strict"; + var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate, + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - return true; -}; + sax = __nccwpck_require__(2043); -URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { - if (c === 47 || c === 92) { - if (c === 92) { - this.parseError = true; - } - this.state = "file host"; - } else { - if (this.base !== null && this.base.scheme === "file") { - if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { - this.url.path.push(this.base.path[0]); - } else { - this.url.host = this.base.host; - } + events = __nccwpck_require__(2361); + + bom = __nccwpck_require__(2624); + + processors = __nccwpck_require__(9236); + + setImmediate = (__nccwpck_require__(9512).setImmediate); + + defaults = (__nccwpck_require__(7251).defaults); + + isEmpty = function(thing) { + return typeof thing === "object" && (thing != null) && Object.keys(thing).length === 0; + }; + + processItem = function(processors, item, key) { + var i, len, process; + for (i = 0, len = processors.length; i < len; i++) { + process = processors[i]; + item = process(item, key); } - this.state = "path"; - --this.pointer; - } + return item; + }; - return true; -}; + exports.Parser = (function(superClass) { + extend(Parser, superClass); -URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { - if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { - --this.pointer; - if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { - this.parseError = true; - this.state = "path"; - } else if (this.buffer === "") { - this.url.host = ""; - if (this.stateOverride) { - return false; + function Parser(opts) { + this.parseStringPromise = bind(this.parseStringPromise, this); + this.parseString = bind(this.parseString, this); + this.reset = bind(this.reset, this); + this.assignOrPush = bind(this.assignOrPush, this); + this.processAsync = bind(this.processAsync, this); + var key, ref, value; + if (!(this instanceof exports.Parser)) { + return new exports.Parser(opts); } - this.state = "path start"; - } else { - let host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; + this.options = {}; + ref = defaults["0.2"]; + for (key in ref) { + if (!hasProp.call(ref, key)) continue; + value = ref[key]; + this.options[key] = value; } - if (host === "localhost") { - host = ""; + for (key in opts) { + if (!hasProp.call(opts, key)) continue; + value = opts[key]; + this.options[key] = value; } - this.url.host = host; + if (this.options.xmlns) { + this.options.xmlnskey = this.options.attrkey + "ns"; + } + if (this.options.normalizeTags) { + if (!this.options.tagNameProcessors) { + this.options.tagNameProcessors = []; + } + this.options.tagNameProcessors.unshift(processors.normalize); + } + this.reset(); + } - if (this.stateOverride) { - return false; + Parser.prototype.processAsync = function() { + var chunk, err; + try { + if (this.remaining.length <= this.options.chunkSize) { + chunk = this.remaining; + this.remaining = ''; + this.saxParser = this.saxParser.write(chunk); + return this.saxParser.close(); + } else { + chunk = this.remaining.substr(0, this.options.chunkSize); + this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length); + this.saxParser = this.saxParser.write(chunk); + return setImmediate(this.processAsync); + } + } catch (error1) { + err = error1; + if (!this.saxParser.errThrown) { + this.saxParser.errThrown = true; + return this.emit(err); + } } + }; - this.buffer = ""; - this.state = "path start"; - } - } else { - this.buffer += cStr; - } + Parser.prototype.assignOrPush = function(obj, key, newValue) { + if (!(key in obj)) { + if (!this.options.explicitArray) { + return obj[key] = newValue; + } else { + return obj[key] = [newValue]; + } + } else { + if (!(obj[key] instanceof Array)) { + obj[key] = [obj[key]]; + } + return obj[key].push(newValue); + } + }; - return true; -}; + Parser.prototype.reset = function() { + var attrkey, charkey, ontext, stack; + this.removeAllListeners(); + this.saxParser = sax.parser(this.options.strict, { + trim: false, + normalize: false, + xmlns: this.options.xmlns + }); + this.saxParser.errThrown = false; + this.saxParser.onerror = (function(_this) { + return function(error) { + _this.saxParser.resume(); + if (!_this.saxParser.errThrown) { + _this.saxParser.errThrown = true; + return _this.emit("error", error); + } + }; + })(this); + this.saxParser.onend = (function(_this) { + return function() { + if (!_this.saxParser.ended) { + _this.saxParser.ended = true; + return _this.emit("end", _this.resultObject); + } + }; + })(this); + this.saxParser.ended = false; + this.EXPLICIT_CHARKEY = this.options.explicitCharkey; + this.resultObject = null; + stack = []; + attrkey = this.options.attrkey; + charkey = this.options.charkey; + this.saxParser.onopentag = (function(_this) { + return function(node) { + var key, newValue, obj, processedKey, ref; + obj = Object.create(null); + obj[charkey] = ""; + if (!_this.options.ignoreAttrs) { + ref = node.attributes; + for (key in ref) { + if (!hasProp.call(ref, key)) continue; + if (!(attrkey in obj) && !_this.options.mergeAttrs) { + obj[attrkey] = Object.create(null); + } + newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key]; + processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key; + if (_this.options.mergeAttrs) { + _this.assignOrPush(obj, processedKey, newValue); + } else { + obj[attrkey][processedKey] = newValue; + } + } + } + obj["#name"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name; + if (_this.options.xmlns) { + obj[_this.options.xmlnskey] = { + uri: node.uri, + local: node.local + }; + } + return stack.push(obj); + }; + })(this); + this.saxParser.onclosetag = (function(_this) { + return function() { + var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath; + obj = stack.pop(); + nodeName = obj["#name"]; + if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) { + delete obj["#name"]; + } + if (obj.cdata === true) { + cdata = obj.cdata; + delete obj.cdata; + } + s = stack[stack.length - 1]; + if (obj[charkey].match(/^\s*$/) && !cdata) { + emptyStr = obj[charkey]; + delete obj[charkey]; + } else { + if (_this.options.trim) { + obj[charkey] = obj[charkey].trim(); + } + if (_this.options.normalize) { + obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim(); + } + obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey]; + if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) { + obj = obj[charkey]; + } + } + if (isEmpty(obj)) { + if (typeof _this.options.emptyTag === 'function') { + obj = _this.options.emptyTag(); + } else { + obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr; + } + } + if (_this.options.validator != null) { + xpath = "/" + ((function() { + var i, len, results; + results = []; + for (i = 0, len = stack.length; i < len; i++) { + node = stack[i]; + results.push(node["#name"]); + } + return results; + })()).concat(nodeName).join("/"); + (function() { + var err; + try { + return obj = _this.options.validator(xpath, s && s[nodeName], obj); + } catch (error1) { + err = error1; + return _this.emit("error", err); + } + })(); + } + if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') { + if (!_this.options.preserveChildrenOrder) { + node = Object.create(null); + if (_this.options.attrkey in obj) { + node[_this.options.attrkey] = obj[_this.options.attrkey]; + delete obj[_this.options.attrkey]; + } + if (!_this.options.charsAsChildren && _this.options.charkey in obj) { + node[_this.options.charkey] = obj[_this.options.charkey]; + delete obj[_this.options.charkey]; + } + if (Object.getOwnPropertyNames(obj).length > 0) { + node[_this.options.childkey] = obj; + } + obj = node; + } else if (s) { + s[_this.options.childkey] = s[_this.options.childkey] || []; + objClone = Object.create(null); + for (key in obj) { + if (!hasProp.call(obj, key)) continue; + objClone[key] = obj[key]; + } + s[_this.options.childkey].push(objClone); + delete obj["#name"]; + if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) { + obj = obj[charkey]; + } + } + } + if (stack.length > 0) { + return _this.assignOrPush(s, nodeName, obj); + } else { + if (_this.options.explicitRoot) { + old = obj; + obj = Object.create(null); + obj[nodeName] = old; + } + _this.resultObject = obj; + _this.saxParser.ended = true; + return _this.emit("end", _this.resultObject); + } + }; + })(this); + ontext = (function(_this) { + return function(text) { + var charChild, s; + s = stack[stack.length - 1]; + if (s) { + s[charkey] += text; + if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, '').trim() !== '')) { + s[_this.options.childkey] = s[_this.options.childkey] || []; + charChild = { + '#name': '__text__' + }; + charChild[charkey] = text; + if (_this.options.normalize) { + charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim(); + } + s[_this.options.childkey].push(charChild); + } + return s; + } + }; + })(this); + this.saxParser.ontext = ontext; + return this.saxParser.oncdata = (function(_this) { + return function(text) { + var s; + s = ontext(text); + if (s) { + return s.cdata = true; + } + }; + })(this); + }; -URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { - if (isSpecial(this.url)) { - if (c === 92) { - this.parseError = true; - } - this.state = "path"; + Parser.prototype.parseString = function(str, cb) { + var err; + if ((cb != null) && typeof cb === "function") { + this.on("end", function(result) { + this.reset(); + return cb(null, result); + }); + this.on("error", function(err) { + this.reset(); + return cb(err); + }); + } + try { + str = str.toString(); + if (str.trim() === '') { + this.emit("end", null); + return true; + } + str = bom.stripBOM(str); + if (this.options.async) { + this.remaining = str; + setImmediate(this.processAsync); + return this.saxParser; + } + return this.saxParser.write(str).close(); + } catch (error1) { + err = error1; + if (!(this.saxParser.errThrown || this.saxParser.ended)) { + this.emit('error', err); + return this.saxParser.errThrown = true; + } else if (this.saxParser.ended) { + throw err; + } + } + }; - if (c !== 47 && c !== 92) { - --this.pointer; - } - } else if (!this.stateOverride && c === 63) { - this.url.query = ""; - this.state = "query"; - } else if (!this.stateOverride && c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } else if (c !== undefined) { - this.state = "path"; - if (c !== 47) { - --this.pointer; - } - } + Parser.prototype.parseStringPromise = function(str) { + return new Promise((function(_this) { + return function(resolve, reject) { + return _this.parseString(str, function(err, value) { + if (err) { + return reject(err); + } else { + return resolve(value); + } + }); + }; + })(this)); + }; - return true; -}; + return Parser; -URLStateMachine.prototype["parse path"] = function parsePath(c) { - if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || - (!this.stateOverride && (c === 63 || c === 35))) { - if (isSpecial(this.url) && c === 92) { - this.parseError = true; - } + })(events); - if (isDoubleDot(this.buffer)) { - shortenPath(this.url); - if (c !== 47 && !(isSpecial(this.url) && c === 92)) { - this.url.path.push(""); + exports.parseString = function(str, a, b) { + var cb, options, parser; + if (b != null) { + if (typeof b === 'function') { + cb = b; } - } else if (isSingleDot(this.buffer) && c !== 47 && - !(isSpecial(this.url) && c === 92)) { - this.url.path.push(""); - } else if (!isSingleDot(this.buffer)) { - if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { - if (this.url.host !== "" && this.url.host !== null) { - this.parseError = true; - this.url.host = ""; - } - this.buffer = this.buffer[0] + ":"; + if (typeof a === 'object') { + options = a; } - this.url.path.push(this.buffer); - } - this.buffer = ""; - if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { - while (this.url.path.length > 1 && this.url.path[0] === "") { - this.parseError = true; - this.url.path.shift(); + } else { + if (typeof a === 'function') { + cb = a; } + options = {}; } - if (c === 63) { - this.url.query = ""; - this.state = "query"; - } - if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } - } else { - // TODO: If c is not a URL code point and not "%", parse error. + parser = new exports.Parser(options); + return parser.parseString(str, cb); + }; - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; + exports.parseStringPromise = function(str, a) { + var options, parser; + if (typeof a === 'object') { + options = a; } + parser = new exports.Parser(options); + return parser.parseStringPromise(str); + }; - this.buffer += percentEncodeChar(c, isPathPercentEncode); - } +}).call(this); - return true; -}; -URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { - if (c === 63) { - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } else { - // TODO: Add: not a URL code point - if (!isNaN(c) && c !== 37) { - this.parseError = true; - } +/***/ }), - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } +/***/ 9236: +/***/ (function(__unused_webpack_module, exports) { - if (!isNaN(c)) { - this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); - } - } +// Generated by CoffeeScript 1.12.7 +(function() { + "use strict"; + var prefixMatch; - return true; -}; + prefixMatch = new RegExp(/(?!xmlns)^.*:/); -URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { - if (isNaN(c) || (!this.stateOverride && c === 35)) { - if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { - this.encodingOverride = "utf-8"; - } + exports.normalize = function(str) { + return str.toLowerCase(); + }; - const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead - for (let i = 0; i < buffer.length; ++i) { - if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || - buffer[i] === 0x3C || buffer[i] === 0x3E) { - this.url.query += percentEncode(buffer[i]); - } else { - this.url.query += String.fromCodePoint(buffer[i]); - } - } + exports.firstCharLowerCase = function(str) { + return str.charAt(0).toLowerCase() + str.slice(1); + }; - this.buffer = ""; - if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; + exports.stripPrefix = function(str) { + return str.replace(prefixMatch, ''); + }; + + exports.parseNumbers = function(str) { + if (!isNaN(str)) { + str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str); } - } else { - // TODO: If c is not a URL code point and not "%", parse error. - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; + return str; + }; + + exports.parseBooleans = function(str) { + if (/^(?:true|false)$/i.test(str)) { + str = str.toLowerCase() === 'true'; } + return str; + }; - this.buffer += cStr; - } +}).call(this); - return true; -}; -URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { - if (isNaN(c)) { // do nothing - } else if (c === 0x0) { - this.parseError = true; - } else { - // TODO: If c is not a URL code point and not "%", parse error. - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } +/***/ }), - this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); - } +/***/ 6189: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - return true; -}; +// Generated by CoffeeScript 1.12.7 +(function() { + "use strict"; + var builder, defaults, parser, processors, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; -function serializeURL(url, excludeFragment) { - let output = url.scheme + ":"; - if (url.host !== null) { - output += "//"; + defaults = __nccwpck_require__(7251); - if (url.username !== "" || url.password !== "") { - output += url.username; - if (url.password !== "") { - output += ":" + url.password; - } - output += "@"; - } + builder = __nccwpck_require__(3337); - output += serializeHost(url.host); + parser = __nccwpck_require__(3314); - if (url.port !== null) { - output += ":" + url.port; - } - } else if (url.host === null && url.scheme === "file") { - output += "//"; - } + processors = __nccwpck_require__(9236); - if (url.cannotBeABaseURL) { - output += url.path[0]; - } else { - for (const string of url.path) { - output += "/" + string; - } - } + exports.defaults = defaults.defaults; - if (url.query !== null) { - output += "?" + url.query; - } + exports.processors = processors; - if (!excludeFragment && url.fragment !== null) { - output += "#" + url.fragment; - } + exports.ValidationError = (function(superClass) { + extend(ValidationError, superClass); - return output; -} + function ValidationError(message) { + this.message = message; + } -function serializeOrigin(tuple) { - let result = tuple.scheme + "://"; - result += serializeHost(tuple.host); + return ValidationError; - if (tuple.port !== null) { - result += ":" + tuple.port; - } + })(Error); - return result; -} + exports.Builder = builder.Builder; -module.exports.serializeURL = serializeURL; + exports.Parser = parser.Parser; -module.exports.serializeURLOrigin = function (url) { - // https://url.spec.whatwg.org/#concept-url-origin - switch (url.scheme) { - case "blob": - try { - return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); - } catch (e) { - // serializing an opaque origin returns "null" - return "null"; - } - case "ftp": - case "gopher": - case "http": - case "https": - case "ws": - case "wss": - return serializeOrigin({ - scheme: url.scheme, - host: url.host, - port: url.port - }); - case "file": - // spec says "exercise to the reader", chrome says "file://" - return "file://"; - default: - // serializing an opaque origin returns "null" - return "null"; - } -}; + exports.parseString = parser.parseString; -module.exports.basicURLParse = function (input, options) { - if (options === undefined) { - options = {}; - } + exports.parseStringPromise = parser.parseStringPromise; - const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); - if (usm.failure) { - return "failure"; - } +}).call(this); - return usm.url; -}; -module.exports.setTheUsername = function (url, username) { - url.username = ""; - const decoded = punycode.ucs2.decode(username); - for (let i = 0; i < decoded.length; ++i) { - url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); - } -}; +/***/ }), -module.exports.setThePassword = function (url, password) { - url.password = ""; - const decoded = punycode.ucs2.decode(password); - for (let i = 0; i < decoded.length; ++i) { - url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); - } -}; +/***/ 2839: +/***/ (function(module) { -module.exports.serializeHost = serializeHost; +// Generated by CoffeeScript 1.12.7 +(function() { + module.exports = { + Disconnected: 1, + Preceding: 2, + Following: 4, + Contains: 8, + ContainedBy: 16, + ImplementationSpecific: 32 + }; -module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; +}).call(this); -module.exports.serializeInteger = function (integer) { - return String(integer); -}; -module.exports.parseURL = function (input, options) { - if (options === undefined) { - options = {}; - } +/***/ }), - // We don't handle blobs, so this just delegates: - return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); -}; +/***/ 9267: +/***/ (function(module) { + +// Generated by CoffeeScript 1.12.7 +(function() { + module.exports = { + Element: 1, + Attribute: 2, + Text: 3, + CData: 4, + EntityReference: 5, + EntityDeclaration: 6, + ProcessingInstruction: 7, + Comment: 8, + Document: 9, + DocType: 10, + DocumentFragment: 11, + NotationDeclaration: 12, + Declaration: 201, + Raw: 202, + AttributeDeclaration: 203, + ElementDeclaration: 204, + Dummy: 205 + }; + +}).call(this); /***/ }), -/***/ 3185: -/***/ ((module) => { +/***/ 8229: +/***/ (function(module) { -"use strict"; +// Generated by CoffeeScript 1.12.7 +(function() { + var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject, + slice = [].slice, + hasProp = {}.hasOwnProperty; + assign = function() { + var i, key, len, source, sources, target; + target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : []; + if (isFunction(Object.assign)) { + Object.assign.apply(null, arguments); + } else { + for (i = 0, len = sources.length; i < len; i++) { + source = sources[i]; + if (source != null) { + for (key in source) { + if (!hasProp.call(source, key)) continue; + target[key] = source[key]; + } + } + } + } + return target; + }; -module.exports.mixin = function mixin(target, source) { - const keys = Object.getOwnPropertyNames(source); - for (let i = 0; i < keys.length; ++i) { - Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i])); - } -}; + isFunction = function(val) { + return !!val && Object.prototype.toString.call(val) === '[object Function]'; + }; -module.exports.wrapperSymbol = Symbol("wrapper"); -module.exports.implSymbol = Symbol("impl"); + isObject = function(val) { + var ref; + return !!val && ((ref = typeof val) === 'function' || ref === 'object'); + }; -module.exports.wrapperForImpl = function (impl) { - return impl[module.exports.wrapperSymbol]; -}; + isArray = function(val) { + if (isFunction(Array.isArray)) { + return Array.isArray(val); + } else { + return Object.prototype.toString.call(val) === '[object Array]'; + } + }; -module.exports.implForWrapper = function (wrapper) { - return wrapper[module.exports.implSymbol]; -}; + isEmpty = function(val) { + var key; + if (isArray(val)) { + return !val.length; + } else { + for (key in val) { + if (!hasProp.call(val, key)) continue; + return false; + } + return true; + } + }; + + isPlainObject = function(val) { + var ctor, proto; + return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object)); + }; + + getValue = function(obj) { + if (isFunction(obj.valueOf)) { + return obj.valueOf(); + } else { + return obj; + } + }; + + module.exports.assign = assign; + + module.exports.isFunction = isFunction; + + module.exports.isObject = isObject; + + module.exports.isArray = isArray; + + module.exports.isEmpty = isEmpty; + + module.exports.isPlainObject = isPlainObject; + + module.exports.getValue = getValue; +}).call(this); /***/ }), -/***/ 2624: -/***/ (function(__unused_webpack_module, exports) { +/***/ 9766: +/***/ (function(module) { // Generated by CoffeeScript 1.12.7 (function() { - "use strict"; - exports.stripBOM = function(str) { - if (str[0] === '\uFEFF') { - return str.substring(1); - } else { - return str; - } + module.exports = { + None: 0, + OpenTag: 1, + InsideTag: 2, + CloseTag: 3 }; }).call(this); @@ -79741,132 +78455,113 @@ module.exports.implForWrapper = function (wrapper) { /***/ }), -/***/ 3337: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 8376: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - "use strict"; - var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA, - hasProp = {}.hasOwnProperty; + var NodeType, XMLAttribute, XMLNode; - builder = __nccwpck_require__(2958); + NodeType = __nccwpck_require__(9267); - defaults = (__nccwpck_require__(7251).defaults); + XMLNode = __nccwpck_require__(7608); - requiresCDATA = function(entry) { - return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0); - }; + module.exports = XMLAttribute = (function() { + function XMLAttribute(parent, name, value) { + this.parent = parent; + if (this.parent) { + this.options = this.parent.options; + this.stringify = this.parent.stringify; + } + if (name == null) { + throw new Error("Missing attribute name. " + this.debugInfo(name)); + } + this.name = this.stringify.name(name); + this.value = this.stringify.attValue(value); + this.type = NodeType.Attribute; + this.isId = false; + this.schemaTypeInfo = null; + } - wrapCDATA = function(entry) { - return ""; - }; + Object.defineProperty(XMLAttribute.prototype, 'nodeType', { + get: function() { + return this.type; + } + }); - escapeCDATA = function(entry) { - return entry.replace(']]>', ']]]]>'); - }; + Object.defineProperty(XMLAttribute.prototype, 'ownerElement', { + get: function() { + return this.parent; + } + }); - exports.Builder = (function() { - function Builder(opts) { - var key, ref, value; - this.options = {}; - ref = defaults["0.2"]; - for (key in ref) { - if (!hasProp.call(ref, key)) continue; - value = ref[key]; - this.options[key] = value; + Object.defineProperty(XMLAttribute.prototype, 'textContent', { + get: function() { + return this.value; + }, + set: function(value) { + return this.value = value || ''; + } + }); + + Object.defineProperty(XMLAttribute.prototype, 'namespaceURI', { + get: function() { + return ''; + } + }); + + Object.defineProperty(XMLAttribute.prototype, 'prefix', { + get: function() { + return ''; + } + }); + + Object.defineProperty(XMLAttribute.prototype, 'localName', { + get: function() { + return this.name; + } + }); + + Object.defineProperty(XMLAttribute.prototype, 'specified', { + get: function() { + return true; + } + }); + + XMLAttribute.prototype.clone = function() { + return Object.create(this); + }; + + XMLAttribute.prototype.toString = function(options) { + return this.options.writer.attribute(this, this.options.writer.filterOptions(options)); + }; + + XMLAttribute.prototype.debugInfo = function(name) { + name = name || this.name; + if (name == null) { + return "parent: <" + this.parent.name + ">"; + } else { + return "attribute: {" + name + "}, parent: <" + this.parent.name + ">"; + } + }; + + XMLAttribute.prototype.isEqualNode = function(node) { + if (node.namespaceURI !== this.namespaceURI) { + return false; + } + if (node.prefix !== this.prefix) { + return false; } - for (key in opts) { - if (!hasProp.call(opts, key)) continue; - value = opts[key]; - this.options[key] = value; + if (node.localName !== this.localName) { + return false; } - } - - Builder.prototype.buildObject = function(rootObj) { - var attrkey, charkey, render, rootElement, rootName; - attrkey = this.options.attrkey; - charkey = this.options.charkey; - if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) { - rootName = Object.keys(rootObj)[0]; - rootObj = rootObj[rootName]; - } else { - rootName = this.options.rootName; + if (node.value !== this.value) { + return false; } - render = (function(_this) { - return function(element, obj) { - var attr, child, entry, index, key, value; - if (typeof obj !== 'object') { - if (_this.options.cdata && requiresCDATA(obj)) { - element.raw(wrapCDATA(obj)); - } else { - element.txt(obj); - } - } else if (Array.isArray(obj)) { - for (index in obj) { - if (!hasProp.call(obj, index)) continue; - child = obj[index]; - for (key in child) { - entry = child[key]; - element = render(element.ele(key), entry).up(); - } - } - } else { - for (key in obj) { - if (!hasProp.call(obj, key)) continue; - child = obj[key]; - if (key === attrkey) { - if (typeof child === "object") { - for (attr in child) { - value = child[attr]; - element = element.att(attr, value); - } - } - } else if (key === charkey) { - if (_this.options.cdata && requiresCDATA(child)) { - element = element.raw(wrapCDATA(child)); - } else { - element = element.txt(child); - } - } else if (Array.isArray(child)) { - for (index in child) { - if (!hasProp.call(child, index)) continue; - entry = child[index]; - if (typeof entry === 'string') { - if (_this.options.cdata && requiresCDATA(entry)) { - element = element.ele(key).raw(wrapCDATA(entry)).up(); - } else { - element = element.ele(key, entry).up(); - } - } else { - element = render(element.ele(key), entry).up(); - } - } - } else if (typeof child === "object") { - element = render(element.ele(key), child).up(); - } else { - if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) { - element = element.ele(key).raw(wrapCDATA(child)).up(); - } else { - if (child == null) { - child = ''; - } - element = element.ele(key, child.toString()).up(); - } - } - } - } - return element; - }; - })(this); - rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, { - headless: this.options.headless, - allowSurrogateChars: this.options.allowSurrogateChars - }); - return render(rootElement, rootObj).end(this.options.renderOpts); + return true; }; - return Builder; + return XMLAttribute; })(); @@ -79875,1487 +78570,1673 @@ module.exports.implForWrapper = function (wrapper) { /***/ }), -/***/ 7251: -/***/ (function(__unused_webpack_module, exports) { +/***/ 333: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - exports.defaults = { - "0.1": { - explicitCharkey: false, - trim: true, - normalize: true, - normalizeTags: false, - attrkey: "@", - charkey: "#", - explicitArray: false, - ignoreAttrs: false, - mergeAttrs: false, - explicitRoot: false, - validator: null, - xmlns: false, - explicitChildren: false, - childkey: '@@', - charsAsChildren: false, - includeWhiteChars: false, - async: false, - strict: true, - attrNameProcessors: null, - attrValueProcessors: null, - tagNameProcessors: null, - valueProcessors: null, - emptyTag: '' - }, - "0.2": { - explicitCharkey: false, - trim: false, - normalize: false, - normalizeTags: false, - attrkey: "$", - charkey: "_", - explicitArray: true, - ignoreAttrs: false, - mergeAttrs: false, - explicitRoot: true, - validator: null, - xmlns: false, - explicitChildren: false, - preserveChildrenOrder: false, - childkey: '$$', - charsAsChildren: false, - includeWhiteChars: false, - async: false, - strict: true, - attrNameProcessors: null, - attrValueProcessors: null, - tagNameProcessors: null, - valueProcessors: null, - rootName: 'root', - xmldec: { - 'version': '1.0', - 'encoding': 'UTF-8', - 'standalone': true - }, - doctype: null, - renderOpts: { - 'pretty': true, - 'indent': ' ', - 'newline': '\n' - }, - headless: false, - chunkSize: 10000, - emptyTag: '', - cdata: false + var NodeType, XMLCData, XMLCharacterData, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + NodeType = __nccwpck_require__(9267); + + XMLCharacterData = __nccwpck_require__(7709); + + module.exports = XMLCData = (function(superClass) { + extend(XMLCData, superClass); + + function XMLCData(parent, text) { + XMLCData.__super__.constructor.call(this, parent); + if (text == null) { + throw new Error("Missing CDATA text. " + this.debugInfo()); + } + this.name = "#cdata-section"; + this.type = NodeType.CData; + this.value = this.stringify.cdata(text); } - }; + + XMLCData.prototype.clone = function() { + return Object.create(this); + }; + + XMLCData.prototype.toString = function(options) { + return this.options.writer.cdata(this, this.options.writer.filterOptions(options)); + }; + + return XMLCData; + + })(XMLCharacterData); }).call(this); /***/ }), -/***/ 3314: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 7709: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - "use strict"; - var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate, - bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + var XMLCharacterData, XMLNode, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - sax = __nccwpck_require__(2043); - - events = __nccwpck_require__(2361); - - bom = __nccwpck_require__(2624); - - processors = __nccwpck_require__(9236); - - setImmediate = (__nccwpck_require__(9512).setImmediate); - - defaults = (__nccwpck_require__(7251).defaults); + XMLNode = __nccwpck_require__(7608); - isEmpty = function(thing) { - return typeof thing === "object" && (thing != null) && Object.keys(thing).length === 0; - }; + module.exports = XMLCharacterData = (function(superClass) { + extend(XMLCharacterData, superClass); - processItem = function(processors, item, key) { - var i, len, process; - for (i = 0, len = processors.length; i < len; i++) { - process = processors[i]; - item = process(item, key); + function XMLCharacterData(parent) { + XMLCharacterData.__super__.constructor.call(this, parent); + this.value = ''; } - return item; - }; - - exports.Parser = (function(superClass) { - extend(Parser, superClass); - function Parser(opts) { - this.parseStringPromise = bind(this.parseStringPromise, this); - this.parseString = bind(this.parseString, this); - this.reset = bind(this.reset, this); - this.assignOrPush = bind(this.assignOrPush, this); - this.processAsync = bind(this.processAsync, this); - var key, ref, value; - if (!(this instanceof exports.Parser)) { - return new exports.Parser(opts); - } - this.options = {}; - ref = defaults["0.2"]; - for (key in ref) { - if (!hasProp.call(ref, key)) continue; - value = ref[key]; - this.options[key] = value; - } - for (key in opts) { - if (!hasProp.call(opts, key)) continue; - value = opts[key]; - this.options[key] = value; - } - if (this.options.xmlns) { - this.options.xmlnskey = this.options.attrkey + "ns"; - } - if (this.options.normalizeTags) { - if (!this.options.tagNameProcessors) { - this.options.tagNameProcessors = []; - } - this.options.tagNameProcessors.unshift(processors.normalize); + Object.defineProperty(XMLCharacterData.prototype, 'data', { + get: function() { + return this.value; + }, + set: function(value) { + return this.value = value || ''; } - this.reset(); - } + }); - Parser.prototype.processAsync = function() { - var chunk, err; - try { - if (this.remaining.length <= this.options.chunkSize) { - chunk = this.remaining; - this.remaining = ''; - this.saxParser = this.saxParser.write(chunk); - return this.saxParser.close(); - } else { - chunk = this.remaining.substr(0, this.options.chunkSize); - this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length); - this.saxParser = this.saxParser.write(chunk); - return setImmediate(this.processAsync); - } - } catch (error1) { - err = error1; - if (!this.saxParser.errThrown) { - this.saxParser.errThrown = true; - return this.emit(err); - } + Object.defineProperty(XMLCharacterData.prototype, 'length', { + get: function() { + return this.value.length; } - }; + }); - Parser.prototype.assignOrPush = function(obj, key, newValue) { - if (!(key in obj)) { - if (!this.options.explicitArray) { - return obj[key] = newValue; - } else { - return obj[key] = [newValue]; - } - } else { - if (!(obj[key] instanceof Array)) { - obj[key] = [obj[key]]; - } - return obj[key].push(newValue); + Object.defineProperty(XMLCharacterData.prototype, 'textContent', { + get: function() { + return this.value; + }, + set: function(value) { + return this.value = value || ''; } - }; + }); - Parser.prototype.reset = function() { - var attrkey, charkey, ontext, stack; - this.removeAllListeners(); - this.saxParser = sax.parser(this.options.strict, { - trim: false, - normalize: false, - xmlns: this.options.xmlns - }); - this.saxParser.errThrown = false; - this.saxParser.onerror = (function(_this) { - return function(error) { - _this.saxParser.resume(); - if (!_this.saxParser.errThrown) { - _this.saxParser.errThrown = true; - return _this.emit("error", error); - } - }; - })(this); - this.saxParser.onend = (function(_this) { - return function() { - if (!_this.saxParser.ended) { - _this.saxParser.ended = true; - return _this.emit("end", _this.resultObject); - } - }; - })(this); - this.saxParser.ended = false; - this.EXPLICIT_CHARKEY = this.options.explicitCharkey; - this.resultObject = null; - stack = []; - attrkey = this.options.attrkey; - charkey = this.options.charkey; - this.saxParser.onopentag = (function(_this) { - return function(node) { - var key, newValue, obj, processedKey, ref; - obj = Object.create(null); - obj[charkey] = ""; - if (!_this.options.ignoreAttrs) { - ref = node.attributes; - for (key in ref) { - if (!hasProp.call(ref, key)) continue; - if (!(attrkey in obj) && !_this.options.mergeAttrs) { - obj[attrkey] = Object.create(null); - } - newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key]; - processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key; - if (_this.options.mergeAttrs) { - _this.assignOrPush(obj, processedKey, newValue); - } else { - obj[attrkey][processedKey] = newValue; - } - } - } - obj["#name"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name; - if (_this.options.xmlns) { - obj[_this.options.xmlnskey] = { - uri: node.uri, - local: node.local - }; - } - return stack.push(obj); - }; - })(this); - this.saxParser.onclosetag = (function(_this) { - return function() { - var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath; - obj = stack.pop(); - nodeName = obj["#name"]; - if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) { - delete obj["#name"]; - } - if (obj.cdata === true) { - cdata = obj.cdata; - delete obj.cdata; - } - s = stack[stack.length - 1]; - if (obj[charkey].match(/^\s*$/) && !cdata) { - emptyStr = obj[charkey]; - delete obj[charkey]; - } else { - if (_this.options.trim) { - obj[charkey] = obj[charkey].trim(); - } - if (_this.options.normalize) { - obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim(); - } - obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey]; - if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) { - obj = obj[charkey]; - } - } - if (isEmpty(obj)) { - if (typeof _this.options.emptyTag === 'function') { - obj = _this.options.emptyTag(); - } else { - obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr; - } - } - if (_this.options.validator != null) { - xpath = "/" + ((function() { - var i, len, results; - results = []; - for (i = 0, len = stack.length; i < len; i++) { - node = stack[i]; - results.push(node["#name"]); - } - return results; - })()).concat(nodeName).join("/"); - (function() { - var err; - try { - return obj = _this.options.validator(xpath, s && s[nodeName], obj); - } catch (error1) { - err = error1; - return _this.emit("error", err); - } - })(); - } - if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') { - if (!_this.options.preserveChildrenOrder) { - node = Object.create(null); - if (_this.options.attrkey in obj) { - node[_this.options.attrkey] = obj[_this.options.attrkey]; - delete obj[_this.options.attrkey]; - } - if (!_this.options.charsAsChildren && _this.options.charkey in obj) { - node[_this.options.charkey] = obj[_this.options.charkey]; - delete obj[_this.options.charkey]; - } - if (Object.getOwnPropertyNames(obj).length > 0) { - node[_this.options.childkey] = obj; - } - obj = node; - } else if (s) { - s[_this.options.childkey] = s[_this.options.childkey] || []; - objClone = Object.create(null); - for (key in obj) { - if (!hasProp.call(obj, key)) continue; - objClone[key] = obj[key]; - } - s[_this.options.childkey].push(objClone); - delete obj["#name"]; - if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) { - obj = obj[charkey]; - } - } - } - if (stack.length > 0) { - return _this.assignOrPush(s, nodeName, obj); - } else { - if (_this.options.explicitRoot) { - old = obj; - obj = Object.create(null); - obj[nodeName] = old; - } - _this.resultObject = obj; - _this.saxParser.ended = true; - return _this.emit("end", _this.resultObject); - } - }; - })(this); - ontext = (function(_this) { - return function(text) { - var charChild, s; - s = stack[stack.length - 1]; - if (s) { - s[charkey] += text; - if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, '').trim() !== '')) { - s[_this.options.childkey] = s[_this.options.childkey] || []; - charChild = { - '#name': '__text__' - }; - charChild[charkey] = text; - if (_this.options.normalize) { - charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim(); - } - s[_this.options.childkey].push(charChild); - } - return s; - } - }; - })(this); - this.saxParser.ontext = ontext; - return this.saxParser.oncdata = (function(_this) { - return function(text) { - var s; - s = ontext(text); - if (s) { - return s.cdata = true; - } - }; - })(this); + XMLCharacterData.prototype.clone = function() { + return Object.create(this); }; - Parser.prototype.parseString = function(str, cb) { - var err; - if ((cb != null) && typeof cb === "function") { - this.on("end", function(result) { - this.reset(); - return cb(null, result); - }); - this.on("error", function(err) { - this.reset(); - return cb(err); - }); - } - try { - str = str.toString(); - if (str.trim() === '') { - this.emit("end", null); - return true; - } - str = bom.stripBOM(str); - if (this.options.async) { - this.remaining = str; - setImmediate(this.processAsync); - return this.saxParser; - } - return this.saxParser.write(str).close(); - } catch (error1) { - err = error1; - if (!(this.saxParser.errThrown || this.saxParser.ended)) { - this.emit('error', err); - return this.saxParser.errThrown = true; - } else if (this.saxParser.ended) { - throw err; - } - } + XMLCharacterData.prototype.substringData = function(offset, count) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - Parser.prototype.parseStringPromise = function(str) { - return new Promise((function(_this) { - return function(resolve, reject) { - return _this.parseString(str, function(err, value) { - if (err) { - return reject(err); - } else { - return resolve(value); - } - }); - }; - })(this)); + XMLCharacterData.prototype.appendData = function(arg) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - return Parser; + XMLCharacterData.prototype.insertData = function(offset, arg) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - })(events); + XMLCharacterData.prototype.deleteData = function(offset, count) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - exports.parseString = function(str, a, b) { - var cb, options, parser; - if (b != null) { - if (typeof b === 'function') { - cb = b; + XMLCharacterData.prototype.replaceData = function(offset, count, arg) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLCharacterData.prototype.isEqualNode = function(node) { + if (!XMLCharacterData.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { + return false; } - if (typeof a === 'object') { - options = a; + if (node.data !== this.data) { + return false; } - } else { - if (typeof a === 'function') { - cb = a; + return true; + }; + + return XMLCharacterData; + + })(XMLNode); + +}).call(this); + + +/***/ }), + +/***/ 4407: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var NodeType, XMLCharacterData, XMLComment, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + NodeType = __nccwpck_require__(9267); + + XMLCharacterData = __nccwpck_require__(7709); + + module.exports = XMLComment = (function(superClass) { + extend(XMLComment, superClass); + + function XMLComment(parent, text) { + XMLComment.__super__.constructor.call(this, parent); + if (text == null) { + throw new Error("Missing comment text. " + this.debugInfo()); } - options = {}; + this.name = "#comment"; + this.type = NodeType.Comment; + this.value = this.stringify.comment(text); } - parser = new exports.Parser(options); - return parser.parseString(str, cb); - }; - exports.parseStringPromise = function(str, a) { - var options, parser; - if (typeof a === 'object') { - options = a; + XMLComment.prototype.clone = function() { + return Object.create(this); + }; + + XMLComment.prototype.toString = function(options) { + return this.options.writer.comment(this, this.options.writer.filterOptions(options)); + }; + + return XMLComment; + + })(XMLCharacterData); + +}).call(this); + + +/***/ }), + +/***/ 7465: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList; + + XMLDOMErrorHandler = __nccwpck_require__(6744); + + XMLDOMStringList = __nccwpck_require__(7028); + + module.exports = XMLDOMConfiguration = (function() { + function XMLDOMConfiguration() { + var clonedSelf; + this.defaultParams = { + "canonical-form": false, + "cdata-sections": false, + "comments": false, + "datatype-normalization": false, + "element-content-whitespace": true, + "entities": true, + "error-handler": new XMLDOMErrorHandler(), + "infoset": true, + "validate-if-schema": false, + "namespaces": true, + "namespace-declarations": true, + "normalize-characters": false, + "schema-location": '', + "schema-type": '', + "split-cdata-sections": true, + "validate": false, + "well-formed": true + }; + this.params = clonedSelf = Object.create(this.defaultParams); } - parser = new exports.Parser(options); - return parser.parseStringPromise(str); - }; + + Object.defineProperty(XMLDOMConfiguration.prototype, 'parameterNames', { + get: function() { + return new XMLDOMStringList(Object.keys(this.defaultParams)); + } + }); + + XMLDOMConfiguration.prototype.getParameter = function(name) { + if (this.params.hasOwnProperty(name)) { + return this.params[name]; + } else { + return null; + } + }; + + XMLDOMConfiguration.prototype.canSetParameter = function(name, value) { + return true; + }; + + XMLDOMConfiguration.prototype.setParameter = function(name, value) { + if (value != null) { + return this.params[name] = value; + } else { + return delete this.params[name]; + } + }; + + return XMLDOMConfiguration; + + })(); }).call(this); /***/ }), -/***/ 9236: -/***/ (function(__unused_webpack_module, exports) { +/***/ 6744: +/***/ (function(module) { // Generated by CoffeeScript 1.12.7 (function() { - "use strict"; - var prefixMatch; + var XMLDOMErrorHandler; - prefixMatch = new RegExp(/(?!xmlns)^.*:/); + module.exports = XMLDOMErrorHandler = (function() { + function XMLDOMErrorHandler() {} - exports.normalize = function(str) { - return str.toLowerCase(); - }; + XMLDOMErrorHandler.prototype.handleError = function(error) { + throw new Error(error); + }; - exports.firstCharLowerCase = function(str) { - return str.charAt(0).toLowerCase() + str.slice(1); - }; + return XMLDOMErrorHandler; - exports.stripPrefix = function(str) { - return str.replace(prefixMatch, ''); - }; + })(); - exports.parseNumbers = function(str) { - if (!isNaN(str)) { - str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str); +}).call(this); + + +/***/ }), + +/***/ 8310: +/***/ (function(module) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var XMLDOMImplementation; + + module.exports = XMLDOMImplementation = (function() { + function XMLDOMImplementation() {} + + XMLDOMImplementation.prototype.hasFeature = function(feature, version) { + return true; + }; + + XMLDOMImplementation.prototype.createDocumentType = function(qualifiedName, publicId, systemId) { + throw new Error("This DOM method is not implemented."); + }; + + XMLDOMImplementation.prototype.createDocument = function(namespaceURI, qualifiedName, doctype) { + throw new Error("This DOM method is not implemented."); + }; + + XMLDOMImplementation.prototype.createHTMLDocument = function(title) { + throw new Error("This DOM method is not implemented."); + }; + + XMLDOMImplementation.prototype.getFeature = function(feature, version) { + throw new Error("This DOM method is not implemented."); + }; + + return XMLDOMImplementation; + + })(); + +}).call(this); + + +/***/ }), + +/***/ 7028: +/***/ (function(module) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var XMLDOMStringList; + + module.exports = XMLDOMStringList = (function() { + function XMLDOMStringList(arr) { + this.arr = arr || []; } - return str; - }; - exports.parseBooleans = function(str) { - if (/^(?:true|false)$/i.test(str)) { - str = str.toLowerCase() === 'true'; + Object.defineProperty(XMLDOMStringList.prototype, 'length', { + get: function() { + return this.arr.length; + } + }); + + XMLDOMStringList.prototype.item = function(index) { + return this.arr[index] || null; + }; + + XMLDOMStringList.prototype.contains = function(str) { + return this.arr.indexOf(str) !== -1; + }; + + return XMLDOMStringList; + + })(); + +}).call(this); + + +/***/ }), + +/***/ 1015: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var NodeType, XMLDTDAttList, XMLNode, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + XMLNode = __nccwpck_require__(7608); + + NodeType = __nccwpck_require__(9267); + + module.exports = XMLDTDAttList = (function(superClass) { + extend(XMLDTDAttList, superClass); + + function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) { + XMLDTDAttList.__super__.constructor.call(this, parent); + if (elementName == null) { + throw new Error("Missing DTD element name. " + this.debugInfo()); + } + if (attributeName == null) { + throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName)); + } + if (!attributeType) { + throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName)); + } + if (!defaultValueType) { + throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName)); + } + if (defaultValueType.indexOf('#') !== 0) { + defaultValueType = '#' + defaultValueType; + } + if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) { + throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName)); + } + if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) { + throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName)); + } + this.elementName = this.stringify.name(elementName); + this.type = NodeType.AttributeDeclaration; + this.attributeName = this.stringify.name(attributeName); + this.attributeType = this.stringify.dtdAttType(attributeType); + if (defaultValue) { + this.defaultValue = this.stringify.dtdAttDefault(defaultValue); + } + this.defaultValueType = defaultValueType; } - return str; - }; + + XMLDTDAttList.prototype.toString = function(options) { + return this.options.writer.dtdAttList(this, this.options.writer.filterOptions(options)); + }; + + return XMLDTDAttList; + + })(XMLNode); }).call(this); /***/ }), -/***/ 6189: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 2421: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - "use strict"; - var builder, defaults, parser, processors, + var NodeType, XMLDTDElement, XMLNode, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - defaults = __nccwpck_require__(7251); + XMLNode = __nccwpck_require__(7608); - builder = __nccwpck_require__(3337); + NodeType = __nccwpck_require__(9267); - parser = __nccwpck_require__(3314); + module.exports = XMLDTDElement = (function(superClass) { + extend(XMLDTDElement, superClass); - processors = __nccwpck_require__(9236); + function XMLDTDElement(parent, name, value) { + XMLDTDElement.__super__.constructor.call(this, parent); + if (name == null) { + throw new Error("Missing DTD element name. " + this.debugInfo()); + } + if (!value) { + value = '(#PCDATA)'; + } + if (Array.isArray(value)) { + value = '(' + value.join(',') + ')'; + } + this.name = this.stringify.name(name); + this.type = NodeType.ElementDeclaration; + this.value = this.stringify.dtdElementValue(value); + } - exports.defaults = defaults.defaults; + XMLDTDElement.prototype.toString = function(options) { + return this.options.writer.dtdElement(this, this.options.writer.filterOptions(options)); + }; - exports.processors = processors; + return XMLDTDElement; - exports.ValidationError = (function(superClass) { - extend(ValidationError, superClass); + })(XMLNode); - function ValidationError(message) { - this.message = message; +}).call(this); + + +/***/ }), + +/***/ 53: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var NodeType, XMLDTDEntity, XMLNode, isObject, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + isObject = (__nccwpck_require__(8229).isObject); + + XMLNode = __nccwpck_require__(7608); + + NodeType = __nccwpck_require__(9267); + + module.exports = XMLDTDEntity = (function(superClass) { + extend(XMLDTDEntity, superClass); + + function XMLDTDEntity(parent, pe, name, value) { + XMLDTDEntity.__super__.constructor.call(this, parent); + if (name == null) { + throw new Error("Missing DTD entity name. " + this.debugInfo(name)); + } + if (value == null) { + throw new Error("Missing DTD entity value. " + this.debugInfo(name)); + } + this.pe = !!pe; + this.name = this.stringify.name(name); + this.type = NodeType.EntityDeclaration; + if (!isObject(value)) { + this.value = this.stringify.dtdEntityValue(value); + this.internal = true; + } else { + if (!value.pubID && !value.sysID) { + throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name)); + } + if (value.pubID && !value.sysID) { + throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name)); + } + this.internal = false; + if (value.pubID != null) { + this.pubID = this.stringify.dtdPubID(value.pubID); + } + if (value.sysID != null) { + this.sysID = this.stringify.dtdSysID(value.sysID); + } + if (value.nData != null) { + this.nData = this.stringify.dtdNData(value.nData); + } + if (this.pe && this.nData) { + throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name)); + } + } } - return ValidationError; + Object.defineProperty(XMLDTDEntity.prototype, 'publicId', { + get: function() { + return this.pubID; + } + }); - })(Error); + Object.defineProperty(XMLDTDEntity.prototype, 'systemId', { + get: function() { + return this.sysID; + } + }); - exports.Builder = builder.Builder; + Object.defineProperty(XMLDTDEntity.prototype, 'notationName', { + get: function() { + return this.nData || null; + } + }); - exports.Parser = parser.Parser; + Object.defineProperty(XMLDTDEntity.prototype, 'inputEncoding', { + get: function() { + return null; + } + }); - exports.parseString = parser.parseString; + Object.defineProperty(XMLDTDEntity.prototype, 'xmlEncoding', { + get: function() { + return null; + } + }); - exports.parseStringPromise = parser.parseStringPromise; + Object.defineProperty(XMLDTDEntity.prototype, 'xmlVersion', { + get: function() { + return null; + } + }); + + XMLDTDEntity.prototype.toString = function(options) { + return this.options.writer.dtdEntity(this, this.options.writer.filterOptions(options)); + }; + + return XMLDTDEntity; + + })(XMLNode); }).call(this); /***/ }), -/***/ 2839: -/***/ (function(module) { +/***/ 2837: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - module.exports = { - Disconnected: 1, - Preceding: 2, - Following: 4, - Contains: 8, - ContainedBy: 16, - ImplementationSpecific: 32 - }; + var NodeType, XMLDTDNotation, XMLNode, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; -}).call(this); + XMLNode = __nccwpck_require__(7608); + NodeType = __nccwpck_require__(9267); -/***/ }), + module.exports = XMLDTDNotation = (function(superClass) { + extend(XMLDTDNotation, superClass); -/***/ 9267: -/***/ (function(module) { + function XMLDTDNotation(parent, name, value) { + XMLDTDNotation.__super__.constructor.call(this, parent); + if (name == null) { + throw new Error("Missing DTD notation name. " + this.debugInfo(name)); + } + if (!value.pubID && !value.sysID) { + throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name)); + } + this.name = this.stringify.name(name); + this.type = NodeType.NotationDeclaration; + if (value.pubID != null) { + this.pubID = this.stringify.dtdPubID(value.pubID); + } + if (value.sysID != null) { + this.sysID = this.stringify.dtdSysID(value.sysID); + } + } -// Generated by CoffeeScript 1.12.7 -(function() { - module.exports = { - Element: 1, - Attribute: 2, - Text: 3, - CData: 4, - EntityReference: 5, - EntityDeclaration: 6, - ProcessingInstruction: 7, - Comment: 8, - Document: 9, - DocType: 10, - DocumentFragment: 11, - NotationDeclaration: 12, - Declaration: 201, - Raw: 202, - AttributeDeclaration: 203, - ElementDeclaration: 204, - Dummy: 205 - }; + Object.defineProperty(XMLDTDNotation.prototype, 'publicId', { + get: function() { + return this.pubID; + } + }); + + Object.defineProperty(XMLDTDNotation.prototype, 'systemId', { + get: function() { + return this.sysID; + } + }); + + XMLDTDNotation.prototype.toString = function(options) { + return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options)); + }; + + return XMLDTDNotation; + + })(XMLNode); }).call(this); /***/ }), -/***/ 8229: -/***/ (function(module) { +/***/ 6364: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject, - slice = [].slice, + var NodeType, XMLDeclaration, XMLNode, isObject, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - assign = function() { - var i, key, len, source, sources, target; - target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : []; - if (isFunction(Object.assign)) { - Object.assign.apply(null, arguments); - } else { - for (i = 0, len = sources.length; i < len; i++) { - source = sources[i]; - if (source != null) { - for (key in source) { - if (!hasProp.call(source, key)) continue; - target[key] = source[key]; - } - } - } - } - return target; - }; + isObject = (__nccwpck_require__(8229).isObject); - isFunction = function(val) { - return !!val && Object.prototype.toString.call(val) === '[object Function]'; - }; + XMLNode = __nccwpck_require__(7608); - isObject = function(val) { - var ref; - return !!val && ((ref = typeof val) === 'function' || ref === 'object'); - }; + NodeType = __nccwpck_require__(9267); - isArray = function(val) { - if (isFunction(Array.isArray)) { - return Array.isArray(val); - } else { - return Object.prototype.toString.call(val) === '[object Array]'; - } - }; + module.exports = XMLDeclaration = (function(superClass) { + extend(XMLDeclaration, superClass); - isEmpty = function(val) { - var key; - if (isArray(val)) { - return !val.length; - } else { - for (key in val) { - if (!hasProp.call(val, key)) continue; - return false; + function XMLDeclaration(parent, version, encoding, standalone) { + var ref; + XMLDeclaration.__super__.constructor.call(this, parent); + if (isObject(version)) { + ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone; + } + if (!version) { + version = '1.0'; + } + this.type = NodeType.Declaration; + this.version = this.stringify.xmlVersion(version); + if (encoding != null) { + this.encoding = this.stringify.xmlEncoding(encoding); + } + if (standalone != null) { + this.standalone = this.stringify.xmlStandalone(standalone); } - return true; - } - }; - - isPlainObject = function(val) { - var ctor, proto; - return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object)); - }; - - getValue = function(obj) { - if (isFunction(obj.valueOf)) { - return obj.valueOf(); - } else { - return obj; } - }; - - module.exports.assign = assign; - - module.exports.isFunction = isFunction; - - module.exports.isObject = isObject; - - module.exports.isArray = isArray; - module.exports.isEmpty = isEmpty; + XMLDeclaration.prototype.toString = function(options) { + return this.options.writer.declaration(this, this.options.writer.filterOptions(options)); + }; - module.exports.isPlainObject = isPlainObject; + return XMLDeclaration; - module.exports.getValue = getValue; + })(XMLNode); }).call(this); /***/ }), -/***/ 9766: -/***/ (function(module) { +/***/ 1801: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - module.exports = { - None: 0, - OpenTag: 1, - InsideTag: 2, - CloseTag: 3 - }; + var NodeType, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNamedNodeMap, XMLNode, isObject, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; -}).call(this); + isObject = (__nccwpck_require__(8229).isObject); + XMLNode = __nccwpck_require__(7608); -/***/ }), + NodeType = __nccwpck_require__(9267); -/***/ 8376: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + XMLDTDAttList = __nccwpck_require__(1015); -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLAttribute, XMLNode; + XMLDTDEntity = __nccwpck_require__(53); - NodeType = __nccwpck_require__(9267); + XMLDTDElement = __nccwpck_require__(2421); - XMLNode = __nccwpck_require__(7608); + XMLDTDNotation = __nccwpck_require__(2837); - module.exports = XMLAttribute = (function() { - function XMLAttribute(parent, name, value) { - this.parent = parent; - if (this.parent) { - this.options = this.parent.options; - this.stringify = this.parent.stringify; + XMLNamedNodeMap = __nccwpck_require__(4361); + + module.exports = XMLDocType = (function(superClass) { + extend(XMLDocType, superClass); + + function XMLDocType(parent, pubID, sysID) { + var child, i, len, ref, ref1, ref2; + XMLDocType.__super__.constructor.call(this, parent); + this.type = NodeType.DocType; + if (parent.children) { + ref = parent.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + if (child.type === NodeType.Element) { + this.name = child.name; + break; + } + } } - if (name == null) { - throw new Error("Missing attribute name. " + this.debugInfo(name)); + this.documentObject = parent; + if (isObject(pubID)) { + ref1 = pubID, pubID = ref1.pubID, sysID = ref1.sysID; + } + if (sysID == null) { + ref2 = [pubID, sysID], sysID = ref2[0], pubID = ref2[1]; + } + if (pubID != null) { + this.pubID = this.stringify.dtdPubID(pubID); + } + if (sysID != null) { + this.sysID = this.stringify.dtdSysID(sysID); } - this.name = this.stringify.name(name); - this.value = this.stringify.attValue(value); - this.type = NodeType.Attribute; - this.isId = false; - this.schemaTypeInfo = null; } - Object.defineProperty(XMLAttribute.prototype, 'nodeType', { + Object.defineProperty(XMLDocType.prototype, 'entities', { get: function() { - return this.type; + var child, i, len, nodes, ref; + nodes = {}; + ref = this.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + if ((child.type === NodeType.EntityDeclaration) && !child.pe) { + nodes[child.name] = child; + } + } + return new XMLNamedNodeMap(nodes); } }); - Object.defineProperty(XMLAttribute.prototype, 'ownerElement', { + Object.defineProperty(XMLDocType.prototype, 'notations', { get: function() { - return this.parent; + var child, i, len, nodes, ref; + nodes = {}; + ref = this.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + if (child.type === NodeType.NotationDeclaration) { + nodes[child.name] = child; + } + } + return new XMLNamedNodeMap(nodes); } }); - Object.defineProperty(XMLAttribute.prototype, 'textContent', { + Object.defineProperty(XMLDocType.prototype, 'publicId', { get: function() { - return this.value; - }, - set: function(value) { - return this.value = value || ''; + return this.pubID; } }); - Object.defineProperty(XMLAttribute.prototype, 'namespaceURI', { + Object.defineProperty(XMLDocType.prototype, 'systemId', { get: function() { - return ''; + return this.sysID; } }); - Object.defineProperty(XMLAttribute.prototype, 'prefix', { + Object.defineProperty(XMLDocType.prototype, 'internalSubset', { get: function() { - return ''; + throw new Error("This DOM method is not implemented." + this.debugInfo()); } }); - Object.defineProperty(XMLAttribute.prototype, 'localName', { - get: function() { - return this.name; - } - }); + XMLDocType.prototype.element = function(name, value) { + var child; + child = new XMLDTDElement(this, name, value); + this.children.push(child); + return this; + }; - Object.defineProperty(XMLAttribute.prototype, 'specified', { - get: function() { - return true; - } - }); + XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { + var child; + child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); + this.children.push(child); + return this; + }; - XMLAttribute.prototype.clone = function() { - return Object.create(this); + XMLDocType.prototype.entity = function(name, value) { + var child; + child = new XMLDTDEntity(this, false, name, value); + this.children.push(child); + return this; }; - XMLAttribute.prototype.toString = function(options) { - return this.options.writer.attribute(this, this.options.writer.filterOptions(options)); + XMLDocType.prototype.pEntity = function(name, value) { + var child; + child = new XMLDTDEntity(this, true, name, value); + this.children.push(child); + return this; }; - XMLAttribute.prototype.debugInfo = function(name) { - name = name || this.name; - if (name == null) { - return "parent: <" + this.parent.name + ">"; - } else { - return "attribute: {" + name + "}, parent: <" + this.parent.name + ">"; - } + XMLDocType.prototype.notation = function(name, value) { + var child; + child = new XMLDTDNotation(this, name, value); + this.children.push(child); + return this; }; - XMLAttribute.prototype.isEqualNode = function(node) { - if (node.namespaceURI !== this.namespaceURI) { + XMLDocType.prototype.toString = function(options) { + return this.options.writer.docType(this, this.options.writer.filterOptions(options)); + }; + + XMLDocType.prototype.ele = function(name, value) { + return this.element(name, value); + }; + + XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { + return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue); + }; + + XMLDocType.prototype.ent = function(name, value) { + return this.entity(name, value); + }; + + XMLDocType.prototype.pent = function(name, value) { + return this.pEntity(name, value); + }; + + XMLDocType.prototype.not = function(name, value) { + return this.notation(name, value); + }; + + XMLDocType.prototype.up = function() { + return this.root() || this.documentObject; + }; + + XMLDocType.prototype.isEqualNode = function(node) { + if (!XMLDocType.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { return false; } - if (node.prefix !== this.prefix) { + if (node.name !== this.name) { return false; } - if (node.localName !== this.localName) { + if (node.publicId !== this.publicId) { return false; } - if (node.value !== this.value) { + if (node.systemId !== this.systemId) { return false; } return true; }; - return XMLAttribute; + return XMLDocType; - })(); + })(XMLNode); }).call(this); /***/ }), -/***/ 333: +/***/ 3730: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var NodeType, XMLCData, XMLCharacterData, + var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - NodeType = __nccwpck_require__(9267); + isPlainObject = (__nccwpck_require__(8229).isPlainObject); - XMLCharacterData = __nccwpck_require__(7709); + XMLDOMImplementation = __nccwpck_require__(8310); - module.exports = XMLCData = (function(superClass) { - extend(XMLCData, superClass); + XMLDOMConfiguration = __nccwpck_require__(7465); - function XMLCData(parent, text) { - XMLCData.__super__.constructor.call(this, parent); - if (text == null) { - throw new Error("Missing CDATA text. " + this.debugInfo()); - } - this.name = "#cdata-section"; - this.type = NodeType.CData; - this.value = this.stringify.cdata(text); - } + XMLNode = __nccwpck_require__(7608); - XMLCData.prototype.clone = function() { - return Object.create(this); - }; + NodeType = __nccwpck_require__(9267); - XMLCData.prototype.toString = function(options) { - return this.options.writer.cdata(this, this.options.writer.filterOptions(options)); - }; + XMLStringifier = __nccwpck_require__(8594); - return XMLCData; + XMLStringWriter = __nccwpck_require__(5913); - })(XMLCharacterData); + module.exports = XMLDocument = (function(superClass) { + extend(XMLDocument, superClass); -}).call(this); + function XMLDocument(options) { + XMLDocument.__super__.constructor.call(this, null); + this.name = "#document"; + this.type = NodeType.Document; + this.documentURI = null; + this.domConfig = new XMLDOMConfiguration(); + options || (options = {}); + if (!options.writer) { + options.writer = new XMLStringWriter(); + } + this.options = options; + this.stringify = new XMLStringifier(options); + } + Object.defineProperty(XMLDocument.prototype, 'implementation', { + value: new XMLDOMImplementation() + }); -/***/ }), + Object.defineProperty(XMLDocument.prototype, 'doctype', { + get: function() { + var child, i, len, ref; + ref = this.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + if (child.type === NodeType.DocType) { + return child; + } + } + return null; + } + }); -/***/ 7709: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + Object.defineProperty(XMLDocument.prototype, 'documentElement', { + get: function() { + return this.rootObject || null; + } + }); -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLCharacterData, XMLNode, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + Object.defineProperty(XMLDocument.prototype, 'inputEncoding', { + get: function() { + return null; + } + }); - XMLNode = __nccwpck_require__(7608); + Object.defineProperty(XMLDocument.prototype, 'strictErrorChecking', { + get: function() { + return false; + } + }); - module.exports = XMLCharacterData = (function(superClass) { - extend(XMLCharacterData, superClass); + Object.defineProperty(XMLDocument.prototype, 'xmlEncoding', { + get: function() { + if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { + return this.children[0].encoding; + } else { + return null; + } + } + }); - function XMLCharacterData(parent) { - XMLCharacterData.__super__.constructor.call(this, parent); - this.value = ''; - } + Object.defineProperty(XMLDocument.prototype, 'xmlStandalone', { + get: function() { + if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { + return this.children[0].standalone === 'yes'; + } else { + return false; + } + } + }); + + Object.defineProperty(XMLDocument.prototype, 'xmlVersion', { + get: function() { + if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { + return this.children[0].version; + } else { + return "1.0"; + } + } + }); + + Object.defineProperty(XMLDocument.prototype, 'URL', { + get: function() { + return this.documentURI; + } + }); - Object.defineProperty(XMLCharacterData.prototype, 'data', { + Object.defineProperty(XMLDocument.prototype, 'origin', { get: function() { - return this.value; - }, - set: function(value) { - return this.value = value || ''; + return null; } }); - Object.defineProperty(XMLCharacterData.prototype, 'length', { + Object.defineProperty(XMLDocument.prototype, 'compatMode', { get: function() { - return this.value.length; + return null; } }); - Object.defineProperty(XMLCharacterData.prototype, 'textContent', { + Object.defineProperty(XMLDocument.prototype, 'characterSet', { get: function() { - return this.value; - }, - set: function(value) { - return this.value = value || ''; + return null; } }); - XMLCharacterData.prototype.clone = function() { - return Object.create(this); + Object.defineProperty(XMLDocument.prototype, 'contentType', { + get: function() { + return null; + } + }); + + XMLDocument.prototype.end = function(writer) { + var writerOptions; + writerOptions = {}; + if (!writer) { + writer = this.options.writer; + } else if (isPlainObject(writer)) { + writerOptions = writer; + writer = this.options.writer; + } + return writer.document(this, writer.filterOptions(writerOptions)); }; - XMLCharacterData.prototype.substringData = function(offset, count) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLDocument.prototype.toString = function(options) { + return this.options.writer.document(this, this.options.writer.filterOptions(options)); }; - XMLCharacterData.prototype.appendData = function(arg) { + XMLDocument.prototype.createElement = function(tagName) { throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLCharacterData.prototype.insertData = function(offset, arg) { + XMLDocument.prototype.createDocumentFragment = function() { throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLCharacterData.prototype.deleteData = function(offset, count) { + XMLDocument.prototype.createTextNode = function(data) { throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLCharacterData.prototype.replaceData = function(offset, count, arg) { + XMLDocument.prototype.createComment = function(data) { throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLCharacterData.prototype.isEqualNode = function(node) { - if (!XMLCharacterData.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { - return false; - } - if (node.data !== this.data) { - return false; - } - return true; + XMLDocument.prototype.createCDATASection = function(data) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - return XMLCharacterData; - - })(XMLNode); - -}).call(this); - - -/***/ }), - -/***/ 4407: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLCharacterData, XMLComment, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; - - NodeType = __nccwpck_require__(9267); - - XMLCharacterData = __nccwpck_require__(7709); - - module.exports = XMLComment = (function(superClass) { - extend(XMLComment, superClass); - - function XMLComment(parent, text) { - XMLComment.__super__.constructor.call(this, parent); - if (text == null) { - throw new Error("Missing comment text. " + this.debugInfo()); - } - this.name = "#comment"; - this.type = NodeType.Comment; - this.value = this.stringify.comment(text); - } + XMLDocument.prototype.createProcessingInstruction = function(target, data) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - XMLComment.prototype.clone = function() { - return Object.create(this); + XMLDocument.prototype.createAttribute = function(name) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLComment.prototype.toString = function(options) { - return this.options.writer.comment(this, this.options.writer.filterOptions(options)); + XMLDocument.prototype.createEntityReference = function(name) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - return XMLComment; + XMLDocument.prototype.getElementsByTagName = function(tagname) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - })(XMLCharacterData); + XMLDocument.prototype.importNode = function(importedNode, deep) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; -}).call(this); + XMLDocument.prototype.createElementNS = function(namespaceURI, qualifiedName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + XMLDocument.prototype.createAttributeNS = function(namespaceURI, qualifiedName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; -/***/ }), + XMLDocument.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; -/***/ 7465: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + XMLDocument.prototype.getElementById = function(elementId) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList; + XMLDocument.prototype.adoptNode = function(source) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - XMLDOMErrorHandler = __nccwpck_require__(6744); + XMLDocument.prototype.normalizeDocument = function() { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - XMLDOMStringList = __nccwpck_require__(7028); + XMLDocument.prototype.renameNode = function(node, namespaceURI, qualifiedName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - module.exports = XMLDOMConfiguration = (function() { - function XMLDOMConfiguration() { - var clonedSelf; - this.defaultParams = { - "canonical-form": false, - "cdata-sections": false, - "comments": false, - "datatype-normalization": false, - "element-content-whitespace": true, - "entities": true, - "error-handler": new XMLDOMErrorHandler(), - "infoset": true, - "validate-if-schema": false, - "namespaces": true, - "namespace-declarations": true, - "normalize-characters": false, - "schema-location": '', - "schema-type": '', - "split-cdata-sections": true, - "validate": false, - "well-formed": true - }; - this.params = clonedSelf = Object.create(this.defaultParams); - } + XMLDocument.prototype.getElementsByClassName = function(classNames) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - Object.defineProperty(XMLDOMConfiguration.prototype, 'parameterNames', { - get: function() { - return new XMLDOMStringList(Object.keys(this.defaultParams)); - } - }); + XMLDocument.prototype.createEvent = function(eventInterface) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - XMLDOMConfiguration.prototype.getParameter = function(name) { - if (this.params.hasOwnProperty(name)) { - return this.params[name]; - } else { - return null; - } + XMLDocument.prototype.createRange = function() { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDOMConfiguration.prototype.canSetParameter = function(name, value) { - return true; + XMLDocument.prototype.createNodeIterator = function(root, whatToShow, filter) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDOMConfiguration.prototype.setParameter = function(name, value) { - if (value != null) { - return this.params[name] = value; - } else { - return delete this.params[name]; - } + XMLDocument.prototype.createTreeWalker = function(root, whatToShow, filter) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - return XMLDOMConfiguration; + return XMLDocument; - })(); + })(XMLNode); }).call(this); /***/ }), -/***/ 6744: -/***/ (function(module) { +/***/ 7356: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var XMLDOMErrorHandler; - - module.exports = XMLDOMErrorHandler = (function() { - function XMLDOMErrorHandler() {} - - XMLDOMErrorHandler.prototype.handleError = function(error) { - throw new Error(error); - }; - - return XMLDOMErrorHandler; + var NodeType, WriterState, XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocument, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject, ref, + hasProp = {}.hasOwnProperty; - })(); + ref = __nccwpck_require__(8229), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue; -}).call(this); + NodeType = __nccwpck_require__(9267); + XMLDocument = __nccwpck_require__(3730); -/***/ }), + XMLElement = __nccwpck_require__(9437); -/***/ 8310: -/***/ (function(module) { + XMLCData = __nccwpck_require__(333); -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLDOMImplementation; + XMLComment = __nccwpck_require__(4407); - module.exports = XMLDOMImplementation = (function() { - function XMLDOMImplementation() {} + XMLRaw = __nccwpck_require__(6329); - XMLDOMImplementation.prototype.hasFeature = function(feature, version) { - return true; - }; + XMLText = __nccwpck_require__(1318); - XMLDOMImplementation.prototype.createDocumentType = function(qualifiedName, publicId, systemId) { - throw new Error("This DOM method is not implemented."); - }; + XMLProcessingInstruction = __nccwpck_require__(6939); - XMLDOMImplementation.prototype.createDocument = function(namespaceURI, qualifiedName, doctype) { - throw new Error("This DOM method is not implemented."); - }; + XMLDeclaration = __nccwpck_require__(6364); - XMLDOMImplementation.prototype.createHTMLDocument = function(title) { - throw new Error("This DOM method is not implemented."); - }; + XMLDocType = __nccwpck_require__(1801); - XMLDOMImplementation.prototype.getFeature = function(feature, version) { - throw new Error("This DOM method is not implemented."); - }; + XMLDTDAttList = __nccwpck_require__(1015); - return XMLDOMImplementation; + XMLDTDEntity = __nccwpck_require__(53); - })(); + XMLDTDElement = __nccwpck_require__(2421); -}).call(this); + XMLDTDNotation = __nccwpck_require__(2837); + XMLAttribute = __nccwpck_require__(8376); -/***/ }), + XMLStringifier = __nccwpck_require__(8594); -/***/ 7028: -/***/ (function(module) { + XMLStringWriter = __nccwpck_require__(5913); -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLDOMStringList; + WriterState = __nccwpck_require__(9766); - module.exports = XMLDOMStringList = (function() { - function XMLDOMStringList(arr) { - this.arr = arr || []; + module.exports = XMLDocumentCB = (function() { + function XMLDocumentCB(options, onData, onEnd) { + var writerOptions; + this.name = "?xml"; + this.type = NodeType.Document; + options || (options = {}); + writerOptions = {}; + if (!options.writer) { + options.writer = new XMLStringWriter(); + } else if (isPlainObject(options.writer)) { + writerOptions = options.writer; + options.writer = new XMLStringWriter(); + } + this.options = options; + this.writer = options.writer; + this.writerOptions = this.writer.filterOptions(writerOptions); + this.stringify = new XMLStringifier(options); + this.onDataCallback = onData || function() {}; + this.onEndCallback = onEnd || function() {}; + this.currentNode = null; + this.currentLevel = -1; + this.openTags = {}; + this.documentStarted = false; + this.documentCompleted = false; + this.root = null; } - Object.defineProperty(XMLDOMStringList.prototype, 'length', { - get: function() { - return this.arr.length; + XMLDocumentCB.prototype.createChildNode = function(node) { + var att, attName, attributes, child, i, len, ref1, ref2; + switch (node.type) { + case NodeType.CData: + this.cdata(node.value); + break; + case NodeType.Comment: + this.comment(node.value); + break; + case NodeType.Element: + attributes = {}; + ref1 = node.attribs; + for (attName in ref1) { + if (!hasProp.call(ref1, attName)) continue; + att = ref1[attName]; + attributes[attName] = att.value; + } + this.node(node.name, attributes); + break; + case NodeType.Dummy: + this.dummy(); + break; + case NodeType.Raw: + this.raw(node.value); + break; + case NodeType.Text: + this.text(node.value); + break; + case NodeType.ProcessingInstruction: + this.instruction(node.target, node.value); + break; + default: + throw new Error("This XML node type is not supported in a JS object: " + node.constructor.name); } - }); - - XMLDOMStringList.prototype.item = function(index) { - return this.arr[index] || null; + ref2 = node.children; + for (i = 0, len = ref2.length; i < len; i++) { + child = ref2[i]; + this.createChildNode(child); + if (child.type === NodeType.Element) { + this.up(); + } + } + return this; }; - XMLDOMStringList.prototype.contains = function(str) { - return this.arr.indexOf(str) !== -1; + XMLDocumentCB.prototype.dummy = function() { + return this; }; - return XMLDOMStringList; - - })(); - -}).call(this); - - -/***/ }), - -/***/ 1015: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLDTDAttList, XMLNode, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; - - XMLNode = __nccwpck_require__(7608); - - NodeType = __nccwpck_require__(9267); - - module.exports = XMLDTDAttList = (function(superClass) { - extend(XMLDTDAttList, superClass); - - function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) { - XMLDTDAttList.__super__.constructor.call(this, parent); - if (elementName == null) { - throw new Error("Missing DTD element name. " + this.debugInfo()); + XMLDocumentCB.prototype.node = function(name, attributes, text) { + var ref1; + if (name == null) { + throw new Error("Missing node name."); } - if (attributeName == null) { - throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName)); + if (this.root && this.currentLevel === -1) { + throw new Error("Document can only have one root node. " + this.debugInfo(name)); } - if (!attributeType) { - throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName)); + this.openCurrent(); + name = getValue(name); + if (attributes == null) { + attributes = {}; } - if (!defaultValueType) { - throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName)); + attributes = getValue(attributes); + if (!isObject(attributes)) { + ref1 = [attributes, text], text = ref1[0], attributes = ref1[1]; } - if (defaultValueType.indexOf('#') !== 0) { - defaultValueType = '#' + defaultValueType; + this.currentNode = new XMLElement(this, name, attributes); + this.currentNode.children = false; + this.currentLevel++; + this.openTags[this.currentLevel] = this.currentNode; + if (text != null) { + this.text(text); } - if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) { - throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName)); + return this; + }; + + XMLDocumentCB.prototype.element = function(name, attributes, text) { + var child, i, len, oldValidationFlag, ref1, root; + if (this.currentNode && this.currentNode.type === NodeType.DocType) { + this.dtdElement.apply(this, arguments); + } else { + if (Array.isArray(name) || isObject(name) || isFunction(name)) { + oldValidationFlag = this.options.noValidation; + this.options.noValidation = true; + root = new XMLDocument(this.options).element('TEMP_ROOT'); + root.element(name); + this.options.noValidation = oldValidationFlag; + ref1 = root.children; + for (i = 0, len = ref1.length; i < len; i++) { + child = ref1[i]; + this.createChildNode(child); + if (child.type === NodeType.Element) { + this.up(); + } + } + } else { + this.node(name, attributes, text); + } } - if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) { - throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName)); + return this; + }; + + XMLDocumentCB.prototype.attribute = function(name, value) { + var attName, attValue; + if (!this.currentNode || this.currentNode.children) { + throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name)); } - this.elementName = this.stringify.name(elementName); - this.type = NodeType.AttributeDeclaration; - this.attributeName = this.stringify.name(attributeName); - this.attributeType = this.stringify.dtdAttType(attributeType); - if (defaultValue) { - this.defaultValue = this.stringify.dtdAttDefault(defaultValue); + if (name != null) { + name = getValue(name); } - this.defaultValueType = defaultValueType; - } - - XMLDTDAttList.prototype.toString = function(options) { - return this.options.writer.dtdAttList(this, this.options.writer.filterOptions(options)); + if (isObject(name)) { + for (attName in name) { + if (!hasProp.call(name, attName)) continue; + attValue = name[attName]; + this.attribute(attName, attValue); + } + } else { + if (isFunction(value)) { + value = value.apply(); + } + if (this.options.keepNullAttributes && (value == null)) { + this.currentNode.attribs[name] = new XMLAttribute(this, name, ""); + } else if (value != null) { + this.currentNode.attribs[name] = new XMLAttribute(this, name, value); + } + } + return this; }; - return XMLDTDAttList; - - })(XMLNode); - -}).call(this); - - -/***/ }), - -/***/ 2421: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLDTDElement, XMLNode, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + XMLDocumentCB.prototype.text = function(value) { + var node; + this.openCurrent(); + node = new XMLText(this, value); + this.onData(this.writer.text(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - XMLNode = __nccwpck_require__(7608); + XMLDocumentCB.prototype.cdata = function(value) { + var node; + this.openCurrent(); + node = new XMLCData(this, value); + this.onData(this.writer.cdata(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - NodeType = __nccwpck_require__(9267); + XMLDocumentCB.prototype.comment = function(value) { + var node; + this.openCurrent(); + node = new XMLComment(this, value); + this.onData(this.writer.comment(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - module.exports = XMLDTDElement = (function(superClass) { - extend(XMLDTDElement, superClass); + XMLDocumentCB.prototype.raw = function(value) { + var node; + this.openCurrent(); + node = new XMLRaw(this, value); + this.onData(this.writer.raw(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - function XMLDTDElement(parent, name, value) { - XMLDTDElement.__super__.constructor.call(this, parent); - if (name == null) { - throw new Error("Missing DTD element name. " + this.debugInfo()); + XMLDocumentCB.prototype.instruction = function(target, value) { + var i, insTarget, insValue, len, node; + this.openCurrent(); + if (target != null) { + target = getValue(target); } - if (!value) { - value = '(#PCDATA)'; + if (value != null) { + value = getValue(value); } - if (Array.isArray(value)) { - value = '(' + value.join(',') + ')'; + if (Array.isArray(target)) { + for (i = 0, len = target.length; i < len; i++) { + insTarget = target[i]; + this.instruction(insTarget); + } + } else if (isObject(target)) { + for (insTarget in target) { + if (!hasProp.call(target, insTarget)) continue; + insValue = target[insTarget]; + this.instruction(insTarget, insValue); + } + } else { + if (isFunction(value)) { + value = value.apply(); + } + node = new XMLProcessingInstruction(this, target, value); + this.onData(this.writer.processingInstruction(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); } - this.name = this.stringify.name(name); - this.type = NodeType.ElementDeclaration; - this.value = this.stringify.dtdElementValue(value); - } - - XMLDTDElement.prototype.toString = function(options) { - return this.options.writer.dtdElement(this, this.options.writer.filterOptions(options)); + return this; }; - return XMLDTDElement; - - })(XMLNode); - -}).call(this); - - -/***/ }), + XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) { + var node; + this.openCurrent(); + if (this.documentStarted) { + throw new Error("declaration() must be the first node."); + } + node = new XMLDeclaration(this, version, encoding, standalone); + this.onData(this.writer.declaration(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; -/***/ 53: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) { + this.openCurrent(); + if (root == null) { + throw new Error("Missing root node name."); + } + if (this.root) { + throw new Error("dtd() must come before the root node."); + } + this.currentNode = new XMLDocType(this, pubID, sysID); + this.currentNode.rootNodeName = root; + this.currentNode.children = false; + this.currentLevel++; + this.openTags[this.currentLevel] = this.currentNode; + return this; + }; -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLDTDEntity, XMLNode, isObject, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + XMLDocumentCB.prototype.dtdElement = function(name, value) { + var node; + this.openCurrent(); + node = new XMLDTDElement(this, name, value); + this.onData(this.writer.dtdElement(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - isObject = (__nccwpck_require__(8229).isObject); + XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { + var node; + this.openCurrent(); + node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); + this.onData(this.writer.dtdAttList(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - XMLNode = __nccwpck_require__(7608); + XMLDocumentCB.prototype.entity = function(name, value) { + var node; + this.openCurrent(); + node = new XMLDTDEntity(this, false, name, value); + this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - NodeType = __nccwpck_require__(9267); + XMLDocumentCB.prototype.pEntity = function(name, value) { + var node; + this.openCurrent(); + node = new XMLDTDEntity(this, true, name, value); + this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - module.exports = XMLDTDEntity = (function(superClass) { - extend(XMLDTDEntity, superClass); + XMLDocumentCB.prototype.notation = function(name, value) { + var node; + this.openCurrent(); + node = new XMLDTDNotation(this, name, value); + this.onData(this.writer.dtdNotation(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - function XMLDTDEntity(parent, pe, name, value) { - XMLDTDEntity.__super__.constructor.call(this, parent); - if (name == null) { - throw new Error("Missing DTD entity name. " + this.debugInfo(name)); - } - if (value == null) { - throw new Error("Missing DTD entity value. " + this.debugInfo(name)); + XMLDocumentCB.prototype.up = function() { + if (this.currentLevel < 0) { + throw new Error("The document node has no parent."); } - this.pe = !!pe; - this.name = this.stringify.name(name); - this.type = NodeType.EntityDeclaration; - if (!isObject(value)) { - this.value = this.stringify.dtdEntityValue(value); - this.internal = true; - } else { - if (!value.pubID && !value.sysID) { - throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name)); - } - if (value.pubID && !value.sysID) { - throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name)); - } - this.internal = false; - if (value.pubID != null) { - this.pubID = this.stringify.dtdPubID(value.pubID); - } - if (value.sysID != null) { - this.sysID = this.stringify.dtdSysID(value.sysID); - } - if (value.nData != null) { - this.nData = this.stringify.dtdNData(value.nData); - } - if (this.pe && this.nData) { - throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name)); + if (this.currentNode) { + if (this.currentNode.children) { + this.closeNode(this.currentNode); + } else { + this.openNode(this.currentNode); } + this.currentNode = null; + } else { + this.closeNode(this.openTags[this.currentLevel]); } - } + delete this.openTags[this.currentLevel]; + this.currentLevel--; + return this; + }; - Object.defineProperty(XMLDTDEntity.prototype, 'publicId', { - get: function() { - return this.pubID; + XMLDocumentCB.prototype.end = function() { + while (this.currentLevel >= 0) { + this.up(); } - }); + return this.onEnd(); + }; - Object.defineProperty(XMLDTDEntity.prototype, 'systemId', { - get: function() { - return this.sysID; + XMLDocumentCB.prototype.openCurrent = function() { + if (this.currentNode) { + this.currentNode.children = true; + return this.openNode(this.currentNode); } - }); + }; - Object.defineProperty(XMLDTDEntity.prototype, 'notationName', { - get: function() { - return this.nData || null; + XMLDocumentCB.prototype.openNode = function(node) { + var att, chunk, name, ref1; + if (!node.isOpen) { + if (!this.root && this.currentLevel === 0 && node.type === NodeType.Element) { + this.root = node; + } + chunk = ''; + if (node.type === NodeType.Element) { + this.writerOptions.state = WriterState.OpenTag; + chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<' + node.name; + ref1 = node.attribs; + for (name in ref1) { + if (!hasProp.call(ref1, name)) continue; + att = ref1[name]; + chunk += this.writer.attribute(att, this.writerOptions, this.currentLevel); + } + chunk += (node.children ? '>' : '/>') + this.writer.endline(node, this.writerOptions, this.currentLevel); + this.writerOptions.state = WriterState.InsideTag; + } else { + this.writerOptions.state = WriterState.OpenTag; + chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ''; + } + chunk += this.writer.endline(node, this.writerOptions, this.currentLevel); + } + this.onData(chunk, this.currentLevel); + return node.isOpen = true; } - }); + }; - Object.defineProperty(XMLDTDEntity.prototype, 'inputEncoding', { - get: function() { - return null; + XMLDocumentCB.prototype.closeNode = function(node) { + var chunk; + if (!node.isClosed) { + chunk = ''; + this.writerOptions.state = WriterState.CloseTag; + if (node.type === NodeType.Element) { + chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '' + this.writer.endline(node, this.writerOptions, this.currentLevel); + } else { + chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ']>' + this.writer.endline(node, this.writerOptions, this.currentLevel); + } + this.writerOptions.state = WriterState.None; + this.onData(chunk, this.currentLevel); + return node.isClosed = true; } - }); + }; - Object.defineProperty(XMLDTDEntity.prototype, 'xmlEncoding', { - get: function() { - return null; - } - }); + XMLDocumentCB.prototype.onData = function(chunk, level) { + this.documentStarted = true; + return this.onDataCallback(chunk, level + 1); + }; - Object.defineProperty(XMLDTDEntity.prototype, 'xmlVersion', { - get: function() { - return null; + XMLDocumentCB.prototype.onEnd = function() { + this.documentCompleted = true; + return this.onEndCallback(); + }; + + XMLDocumentCB.prototype.debugInfo = function(name) { + if (name == null) { + return ""; + } else { + return "node: <" + name + ">"; } - }); + }; - XMLDTDEntity.prototype.toString = function(options) { - return this.options.writer.dtdEntity(this, this.options.writer.filterOptions(options)); + XMLDocumentCB.prototype.ele = function() { + return this.element.apply(this, arguments); }; - return XMLDTDEntity; + XMLDocumentCB.prototype.nod = function(name, attributes, text) { + return this.node(name, attributes, text); + }; - })(XMLNode); + XMLDocumentCB.prototype.txt = function(value) { + return this.text(value); + }; -}).call(this); + XMLDocumentCB.prototype.dat = function(value) { + return this.cdata(value); + }; + XMLDocumentCB.prototype.com = function(value) { + return this.comment(value); + }; -/***/ }), + XMLDocumentCB.prototype.ins = function(target, value) { + return this.instruction(target, value); + }; -/***/ 2837: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + XMLDocumentCB.prototype.dec = function(version, encoding, standalone) { + return this.declaration(version, encoding, standalone); + }; -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLDTDNotation, XMLNode, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) { + return this.doctype(root, pubID, sysID); + }; - XMLNode = __nccwpck_require__(7608); + XMLDocumentCB.prototype.e = function(name, attributes, text) { + return this.element(name, attributes, text); + }; - NodeType = __nccwpck_require__(9267); + XMLDocumentCB.prototype.n = function(name, attributes, text) { + return this.node(name, attributes, text); + }; - module.exports = XMLDTDNotation = (function(superClass) { - extend(XMLDTDNotation, superClass); + XMLDocumentCB.prototype.t = function(value) { + return this.text(value); + }; - function XMLDTDNotation(parent, name, value) { - XMLDTDNotation.__super__.constructor.call(this, parent); - if (name == null) { - throw new Error("Missing DTD notation name. " + this.debugInfo(name)); - } - if (!value.pubID && !value.sysID) { - throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name)); - } - this.name = this.stringify.name(name); - this.type = NodeType.NotationDeclaration; - if (value.pubID != null) { - this.pubID = this.stringify.dtdPubID(value.pubID); - } - if (value.sysID != null) { - this.sysID = this.stringify.dtdSysID(value.sysID); - } - } + XMLDocumentCB.prototype.d = function(value) { + return this.cdata(value); + }; - Object.defineProperty(XMLDTDNotation.prototype, 'publicId', { - get: function() { - return this.pubID; + XMLDocumentCB.prototype.c = function(value) { + return this.comment(value); + }; + + XMLDocumentCB.prototype.r = function(value) { + return this.raw(value); + }; + + XMLDocumentCB.prototype.i = function(target, value) { + return this.instruction(target, value); + }; + + XMLDocumentCB.prototype.att = function() { + if (this.currentNode && this.currentNode.type === NodeType.DocType) { + return this.attList.apply(this, arguments); + } else { + return this.attribute.apply(this, arguments); } - }); + }; - Object.defineProperty(XMLDTDNotation.prototype, 'systemId', { - get: function() { - return this.sysID; + XMLDocumentCB.prototype.a = function() { + if (this.currentNode && this.currentNode.type === NodeType.DocType) { + return this.attList.apply(this, arguments); + } else { + return this.attribute.apply(this, arguments); } - }); + }; - XMLDTDNotation.prototype.toString = function(options) { - return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options)); + XMLDocumentCB.prototype.ent = function(name, value) { + return this.entity(name, value); }; - return XMLDTDNotation; + XMLDocumentCB.prototype.pent = function(name, value) { + return this.pEntity(name, value); + }; - })(XMLNode); + XMLDocumentCB.prototype.not = function(name, value) { + return this.notation(name, value); + }; + + return XMLDocumentCB; + + })(); }).call(this); /***/ }), -/***/ 6364: +/***/ 3590: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var NodeType, XMLDeclaration, XMLNode, isObject, + var NodeType, XMLDummy, XMLNode, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - isObject = (__nccwpck_require__(8229).isObject); - XMLNode = __nccwpck_require__(7608); NodeType = __nccwpck_require__(9267); - module.exports = XMLDeclaration = (function(superClass) { - extend(XMLDeclaration, superClass); + module.exports = XMLDummy = (function(superClass) { + extend(XMLDummy, superClass); - function XMLDeclaration(parent, version, encoding, standalone) { - var ref; - XMLDeclaration.__super__.constructor.call(this, parent); - if (isObject(version)) { - ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone; - } - if (!version) { - version = '1.0'; - } - this.type = NodeType.Declaration; - this.version = this.stringify.xmlVersion(version); - if (encoding != null) { - this.encoding = this.stringify.xmlEncoding(encoding); - } - if (standalone != null) { - this.standalone = this.stringify.xmlStandalone(standalone); - } + function XMLDummy(parent) { + XMLDummy.__super__.constructor.call(this, parent); + this.type = NodeType.Dummy; } - XMLDeclaration.prototype.toString = function(options) { - return this.options.writer.declaration(this, this.options.writer.filterOptions(options)); + XMLDummy.prototype.clone = function() { + return Object.create(this); }; - return XMLDeclaration; + XMLDummy.prototype.toString = function(options) { + return ''; + }; + + return XMLDummy; })(XMLNode); @@ -81364,191 +80245,303 @@ module.exports.implForWrapper = function (wrapper) { /***/ }), -/***/ 1801: +/***/ 9437: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var NodeType, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNamedNodeMap, XMLNode, isObject, + var NodeType, XMLAttribute, XMLElement, XMLNamedNodeMap, XMLNode, getValue, isFunction, isObject, ref, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - isObject = (__nccwpck_require__(8229).isObject); + ref = __nccwpck_require__(8229), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue; XMLNode = __nccwpck_require__(7608); NodeType = __nccwpck_require__(9267); - XMLDTDAttList = __nccwpck_require__(1015); - - XMLDTDEntity = __nccwpck_require__(53); - - XMLDTDElement = __nccwpck_require__(2421); - - XMLDTDNotation = __nccwpck_require__(2837); + XMLAttribute = __nccwpck_require__(8376); XMLNamedNodeMap = __nccwpck_require__(4361); - module.exports = XMLDocType = (function(superClass) { - extend(XMLDocType, superClass); + module.exports = XMLElement = (function(superClass) { + extend(XMLElement, superClass); - function XMLDocType(parent, pubID, sysID) { - var child, i, len, ref, ref1, ref2; - XMLDocType.__super__.constructor.call(this, parent); - this.type = NodeType.DocType; - if (parent.children) { - ref = parent.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - if (child.type === NodeType.Element) { - this.name = child.name; - break; - } - } + function XMLElement(parent, name, attributes) { + var child, j, len, ref1; + XMLElement.__super__.constructor.call(this, parent); + if (name == null) { + throw new Error("Missing element name. " + this.debugInfo()); } - this.documentObject = parent; - if (isObject(pubID)) { - ref1 = pubID, pubID = ref1.pubID, sysID = ref1.sysID; + this.name = this.stringify.name(name); + this.type = NodeType.Element; + this.attribs = {}; + this.schemaTypeInfo = null; + if (attributes != null) { + this.attribute(attributes); } - if (sysID == null) { - ref2 = [pubID, sysID], sysID = ref2[0], pubID = ref2[1]; + if (parent.type === NodeType.Document) { + this.isRoot = true; + this.documentObject = parent; + parent.rootObject = this; + if (parent.children) { + ref1 = parent.children; + for (j = 0, len = ref1.length; j < len; j++) { + child = ref1[j]; + if (child.type === NodeType.DocType) { + child.name = this.name; + break; + } + } + } } - if (pubID != null) { - this.pubID = this.stringify.dtdPubID(pubID); + } + + Object.defineProperty(XMLElement.prototype, 'tagName', { + get: function() { + return this.name; } - if (sysID != null) { - this.sysID = this.stringify.dtdSysID(sysID); + }); + + Object.defineProperty(XMLElement.prototype, 'namespaceURI', { + get: function() { + return ''; } - } + }); - Object.defineProperty(XMLDocType.prototype, 'entities', { + Object.defineProperty(XMLElement.prototype, 'prefix', { get: function() { - var child, i, len, nodes, ref; - nodes = {}; - ref = this.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - if ((child.type === NodeType.EntityDeclaration) && !child.pe) { - nodes[child.name] = child; - } - } - return new XMLNamedNodeMap(nodes); + return ''; } }); - Object.defineProperty(XMLDocType.prototype, 'notations', { + Object.defineProperty(XMLElement.prototype, 'localName', { get: function() { - var child, i, len, nodes, ref; - nodes = {}; - ref = this.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - if (child.type === NodeType.NotationDeclaration) { - nodes[child.name] = child; - } - } - return new XMLNamedNodeMap(nodes); + return this.name; } }); - Object.defineProperty(XMLDocType.prototype, 'publicId', { + Object.defineProperty(XMLElement.prototype, 'id', { get: function() { - return this.pubID; + throw new Error("This DOM method is not implemented." + this.debugInfo()); } }); - Object.defineProperty(XMLDocType.prototype, 'systemId', { + Object.defineProperty(XMLElement.prototype, 'className', { get: function() { - return this.sysID; + throw new Error("This DOM method is not implemented." + this.debugInfo()); } }); - Object.defineProperty(XMLDocType.prototype, 'internalSubset', { + Object.defineProperty(XMLElement.prototype, 'classList', { get: function() { throw new Error("This DOM method is not implemented." + this.debugInfo()); } }); - XMLDocType.prototype.element = function(name, value) { - var child; - child = new XMLDTDElement(this, name, value); - this.children.push(child); - return this; + Object.defineProperty(XMLElement.prototype, 'attributes', { + get: function() { + if (!this.attributeMap || !this.attributeMap.nodes) { + this.attributeMap = new XMLNamedNodeMap(this.attribs); + } + return this.attributeMap; + } + }); + + XMLElement.prototype.clone = function() { + var att, attName, clonedSelf, ref1; + clonedSelf = Object.create(this); + if (clonedSelf.isRoot) { + clonedSelf.documentObject = null; + } + clonedSelf.attribs = {}; + ref1 = this.attribs; + for (attName in ref1) { + if (!hasProp.call(ref1, attName)) continue; + att = ref1[attName]; + clonedSelf.attribs[attName] = att.clone(); + } + clonedSelf.children = []; + this.children.forEach(function(child) { + var clonedChild; + clonedChild = child.clone(); + clonedChild.parent = clonedSelf; + return clonedSelf.children.push(clonedChild); + }); + return clonedSelf; }; - XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { - var child; - child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); - this.children.push(child); + XMLElement.prototype.attribute = function(name, value) { + var attName, attValue; + if (name != null) { + name = getValue(name); + } + if (isObject(name)) { + for (attName in name) { + if (!hasProp.call(name, attName)) continue; + attValue = name[attName]; + this.attribute(attName, attValue); + } + } else { + if (isFunction(value)) { + value = value.apply(); + } + if (this.options.keepNullAttributes && (value == null)) { + this.attribs[name] = new XMLAttribute(this, name, ""); + } else if (value != null) { + this.attribs[name] = new XMLAttribute(this, name, value); + } + } return this; }; - XMLDocType.prototype.entity = function(name, value) { - var child; - child = new XMLDTDEntity(this, false, name, value); - this.children.push(child); + XMLElement.prototype.removeAttribute = function(name) { + var attName, j, len; + if (name == null) { + throw new Error("Missing attribute name. " + this.debugInfo()); + } + name = getValue(name); + if (Array.isArray(name)) { + for (j = 0, len = name.length; j < len; j++) { + attName = name[j]; + delete this.attribs[attName]; + } + } else { + delete this.attribs[name]; + } return this; }; - XMLDocType.prototype.pEntity = function(name, value) { - var child; - child = new XMLDTDEntity(this, true, name, value); - this.children.push(child); - return this; + XMLElement.prototype.toString = function(options) { + return this.options.writer.element(this, this.options.writer.filterOptions(options)); }; - XMLDocType.prototype.notation = function(name, value) { - var child; - child = new XMLDTDNotation(this, name, value); - this.children.push(child); - return this; + XMLElement.prototype.att = function(name, value) { + return this.attribute(name, value); }; - XMLDocType.prototype.toString = function(options) { - return this.options.writer.docType(this, this.options.writer.filterOptions(options)); + XMLElement.prototype.a = function(name, value) { + return this.attribute(name, value); }; - XMLDocType.prototype.ele = function(name, value) { - return this.element(name, value); + XMLElement.prototype.getAttribute = function(name) { + if (this.attribs.hasOwnProperty(name)) { + return this.attribs[name].value; + } else { + return null; + } }; - XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { - return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue); + XMLElement.prototype.setAttribute = function(name, value) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocType.prototype.ent = function(name, value) { - return this.entity(name, value); + XMLElement.prototype.getAttributeNode = function(name) { + if (this.attribs.hasOwnProperty(name)) { + return this.attribs[name]; + } else { + return null; + } }; - XMLDocType.prototype.pent = function(name, value) { - return this.pEntity(name, value); + XMLElement.prototype.setAttributeNode = function(newAttr) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocType.prototype.not = function(name, value) { - return this.notation(name, value); + XMLElement.prototype.removeAttributeNode = function(oldAttr) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocType.prototype.up = function() { - return this.root() || this.documentObject; + XMLElement.prototype.getElementsByTagName = function(name) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocType.prototype.isEqualNode = function(node) { - if (!XMLDocType.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { + XMLElement.prototype.getAttributeNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.setAttributeNS = function(namespaceURI, qualifiedName, value) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.removeAttributeNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.getAttributeNodeNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.setAttributeNodeNS = function(newAttr) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.hasAttribute = function(name) { + return this.attribs.hasOwnProperty(name); + }; + + XMLElement.prototype.hasAttributeNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.setIdAttribute = function(name, isId) { + if (this.attribs.hasOwnProperty(name)) { + return this.attribs[name].isId; + } else { + return isId; + } + }; + + XMLElement.prototype.setIdAttributeNS = function(namespaceURI, localName, isId) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.setIdAttributeNode = function(idAttr, isId) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.getElementsByTagName = function(tagname) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.getElementsByClassName = function(classNames) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.isEqualNode = function(node) { + var i, j, ref1; + if (!XMLElement.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { return false; } - if (node.name !== this.name) { + if (node.namespaceURI !== this.namespaceURI) { return false; } - if (node.publicId !== this.publicId) { + if (node.prefix !== this.prefix) { return false; } - if (node.systemId !== this.systemId) { + if (node.localName !== this.localName) { return false; } + if (node.attribs.length !== this.attribs.length) { + return false; + } + for (i = j = 0, ref1 = this.attribs.length - 1; 0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) { + if (!this.attribs[i].isEqualNode(node.attribs[i])) { + return false; + } + } return true; }; - return XMLDocType; + return XMLElement; })(XMLNode); @@ -81557,820 +80550,988 @@ module.exports.implForWrapper = function (wrapper) { /***/ }), -/***/ 3730: +/***/ 4361: +/***/ (function(module) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var XMLNamedNodeMap; + + module.exports = XMLNamedNodeMap = (function() { + function XMLNamedNodeMap(nodes) { + this.nodes = nodes; + } + + Object.defineProperty(XMLNamedNodeMap.prototype, 'length', { + get: function() { + return Object.keys(this.nodes).length || 0; + } + }); + + XMLNamedNodeMap.prototype.clone = function() { + return this.nodes = null; + }; + + XMLNamedNodeMap.prototype.getNamedItem = function(name) { + return this.nodes[name]; + }; + + XMLNamedNodeMap.prototype.setNamedItem = function(node) { + var oldNode; + oldNode = this.nodes[node.nodeName]; + this.nodes[node.nodeName] = node; + return oldNode || null; + }; + + XMLNamedNodeMap.prototype.removeNamedItem = function(name) { + var oldNode; + oldNode = this.nodes[name]; + delete this.nodes[name]; + return oldNode || null; + }; + + XMLNamedNodeMap.prototype.item = function(index) { + return this.nodes[Object.keys(this.nodes)[index]] || null; + }; + + XMLNamedNodeMap.prototype.getNamedItemNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented."); + }; + + XMLNamedNodeMap.prototype.setNamedItemNS = function(node) { + throw new Error("This DOM method is not implemented."); + }; + + XMLNamedNodeMap.prototype.removeNamedItemNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented."); + }; + + return XMLNamedNodeMap; + + })(); + +}).call(this); + + +/***/ }), + +/***/ 7608: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref1, hasProp = {}.hasOwnProperty; - isPlainObject = (__nccwpck_require__(8229).isPlainObject); + ref1 = __nccwpck_require__(8229), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue; - XMLDOMImplementation = __nccwpck_require__(8310); + XMLElement = null; - XMLDOMConfiguration = __nccwpck_require__(7465); + XMLCData = null; - XMLNode = __nccwpck_require__(7608); + XMLComment = null; - NodeType = __nccwpck_require__(9267); + XMLDeclaration = null; - XMLStringifier = __nccwpck_require__(8594); + XMLDocType = null; - XMLStringWriter = __nccwpck_require__(5913); + XMLRaw = null; - module.exports = XMLDocument = (function(superClass) { - extend(XMLDocument, superClass); + XMLText = null; - function XMLDocument(options) { - XMLDocument.__super__.constructor.call(this, null); - this.name = "#document"; - this.type = NodeType.Document; - this.documentURI = null; - this.domConfig = new XMLDOMConfiguration(); - options || (options = {}); - if (!options.writer) { - options.writer = new XMLStringWriter(); + XMLProcessingInstruction = null; + + XMLDummy = null; + + NodeType = null; + + XMLNodeList = null; + + XMLNamedNodeMap = null; + + DocumentPosition = null; + + module.exports = XMLNode = (function() { + function XMLNode(parent1) { + this.parent = parent1; + if (this.parent) { + this.options = this.parent.options; + this.stringify = this.parent.stringify; + } + this.value = null; + this.children = []; + this.baseURI = null; + if (!XMLElement) { + XMLElement = __nccwpck_require__(9437); + XMLCData = __nccwpck_require__(333); + XMLComment = __nccwpck_require__(4407); + XMLDeclaration = __nccwpck_require__(6364); + XMLDocType = __nccwpck_require__(1801); + XMLRaw = __nccwpck_require__(6329); + XMLText = __nccwpck_require__(1318); + XMLProcessingInstruction = __nccwpck_require__(6939); + XMLDummy = __nccwpck_require__(3590); + NodeType = __nccwpck_require__(9267); + XMLNodeList = __nccwpck_require__(6768); + XMLNamedNodeMap = __nccwpck_require__(4361); + DocumentPosition = __nccwpck_require__(2839); } - this.options = options; - this.stringify = new XMLStringifier(options); } - Object.defineProperty(XMLDocument.prototype, 'implementation', { - value: new XMLDOMImplementation() + Object.defineProperty(XMLNode.prototype, 'nodeName', { + get: function() { + return this.name; + } }); - Object.defineProperty(XMLDocument.prototype, 'doctype', { + Object.defineProperty(XMLNode.prototype, 'nodeType', { get: function() { - var child, i, len, ref; - ref = this.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - if (child.type === NodeType.DocType) { - return child; - } + return this.type; + } + }); + + Object.defineProperty(XMLNode.prototype, 'nodeValue', { + get: function() { + return this.value; + } + }); + + Object.defineProperty(XMLNode.prototype, 'parentNode', { + get: function() { + return this.parent; + } + }); + + Object.defineProperty(XMLNode.prototype, 'childNodes', { + get: function() { + if (!this.childNodeList || !this.childNodeList.nodes) { + this.childNodeList = new XMLNodeList(this.children); } - return null; + return this.childNodeList; } }); - Object.defineProperty(XMLDocument.prototype, 'documentElement', { + Object.defineProperty(XMLNode.prototype, 'firstChild', { get: function() { - return this.rootObject || null; + return this.children[0] || null; } }); - Object.defineProperty(XMLDocument.prototype, 'inputEncoding', { + Object.defineProperty(XMLNode.prototype, 'lastChild', { get: function() { - return null; + return this.children[this.children.length - 1] || null; } }); - Object.defineProperty(XMLDocument.prototype, 'strictErrorChecking', { + Object.defineProperty(XMLNode.prototype, 'previousSibling', { get: function() { - return false; + var i; + i = this.parent.children.indexOf(this); + return this.parent.children[i - 1] || null; } }); - Object.defineProperty(XMLDocument.prototype, 'xmlEncoding', { + Object.defineProperty(XMLNode.prototype, 'nextSibling', { get: function() { - if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { - return this.children[0].encoding; + var i; + i = this.parent.children.indexOf(this); + return this.parent.children[i + 1] || null; + } + }); + + Object.defineProperty(XMLNode.prototype, 'ownerDocument', { + get: function() { + return this.document() || null; + } + }); + + Object.defineProperty(XMLNode.prototype, 'textContent', { + get: function() { + var child, j, len, ref2, str; + if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) { + str = ''; + ref2 = this.children; + for (j = 0, len = ref2.length; j < len; j++) { + child = ref2[j]; + if (child.textContent) { + str += child.textContent; + } + } + return str; } else { return null; } - } - }); - - Object.defineProperty(XMLDocument.prototype, 'xmlStandalone', { - get: function() { - if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { - return this.children[0].standalone === 'yes'; + }, + set: function(value) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + }); + + XMLNode.prototype.setParent = function(parent) { + var child, j, len, ref2, results; + this.parent = parent; + if (parent) { + this.options = parent.options; + this.stringify = parent.stringify; + } + ref2 = this.children; + results = []; + for (j = 0, len = ref2.length; j < len; j++) { + child = ref2[j]; + results.push(child.setParent(this)); + } + return results; + }; + + XMLNode.prototype.element = function(name, attributes, text) { + var childNode, item, j, k, key, lastChild, len, len1, ref2, ref3, val; + lastChild = null; + if (attributes === null && (text == null)) { + ref2 = [{}, null], attributes = ref2[0], text = ref2[1]; + } + if (attributes == null) { + attributes = {}; + } + attributes = getValue(attributes); + if (!isObject(attributes)) { + ref3 = [attributes, text], text = ref3[0], attributes = ref3[1]; + } + if (name != null) { + name = getValue(name); + } + if (Array.isArray(name)) { + for (j = 0, len = name.length; j < len; j++) { + item = name[j]; + lastChild = this.element(item); + } + } else if (isFunction(name)) { + lastChild = this.element(name.apply()); + } else if (isObject(name)) { + for (key in name) { + if (!hasProp.call(name, key)) continue; + val = name[key]; + if (isFunction(val)) { + val = val.apply(); + } + if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) { + lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val); + } else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) { + lastChild = this.dummy(); + } else if (isObject(val) && isEmpty(val)) { + lastChild = this.element(key); + } else if (!this.options.keepNullNodes && (val == null)) { + lastChild = this.dummy(); + } else if (!this.options.separateArrayItems && Array.isArray(val)) { + for (k = 0, len1 = val.length; k < len1; k++) { + item = val[k]; + childNode = {}; + childNode[key] = item; + lastChild = this.element(childNode); + } + } else if (isObject(val)) { + if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) { + lastChild = this.element(val); + } else { + lastChild = this.element(key); + lastChild.element(val); + } + } else { + lastChild = this.element(key, val); + } + } + } else if (!this.options.keepNullNodes && text === null) { + lastChild = this.dummy(); + } else { + if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) { + lastChild = this.text(text); + } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) { + lastChild = this.cdata(text); + } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) { + lastChild = this.comment(text); + } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) { + lastChild = this.raw(text); + } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) { + lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text); } else { - return false; + lastChild = this.node(name, attributes, text); } } - }); + if (lastChild == null) { + throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo()); + } + return lastChild; + }; - Object.defineProperty(XMLDocument.prototype, 'xmlVersion', { - get: function() { - if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { - return this.children[0].version; + XMLNode.prototype.insertBefore = function(name, attributes, text) { + var child, i, newChild, refChild, removed; + if (name != null ? name.type : void 0) { + newChild = name; + refChild = attributes; + newChild.setParent(this); + if (refChild) { + i = children.indexOf(refChild); + removed = children.splice(i); + children.push(newChild); + Array.prototype.push.apply(children, removed); } else { - return "1.0"; + children.push(newChild); } + return newChild; + } else { + if (this.isRoot) { + throw new Error("Cannot insert elements at root level. " + this.debugInfo(name)); + } + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i); + child = this.parent.element(name, attributes, text); + Array.prototype.push.apply(this.parent.children, removed); + return child; } - }); - - Object.defineProperty(XMLDocument.prototype, 'URL', { - get: function() { - return this.documentURI; - } - }); + }; - Object.defineProperty(XMLDocument.prototype, 'origin', { - get: function() { - return null; + XMLNode.prototype.insertAfter = function(name, attributes, text) { + var child, i, removed; + if (this.isRoot) { + throw new Error("Cannot insert elements at root level. " + this.debugInfo(name)); } - }); + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i + 1); + child = this.parent.element(name, attributes, text); + Array.prototype.push.apply(this.parent.children, removed); + return child; + }; - Object.defineProperty(XMLDocument.prototype, 'compatMode', { - get: function() { - return null; + XMLNode.prototype.remove = function() { + var i, ref2; + if (this.isRoot) { + throw new Error("Cannot remove the root element. " + this.debugInfo()); } - }); + i = this.parent.children.indexOf(this); + [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref2 = [])), ref2; + return this.parent; + }; - Object.defineProperty(XMLDocument.prototype, 'characterSet', { - get: function() { - return null; + XMLNode.prototype.node = function(name, attributes, text) { + var child, ref2; + if (name != null) { + name = getValue(name); } - }); - - Object.defineProperty(XMLDocument.prototype, 'contentType', { - get: function() { - return null; + attributes || (attributes = {}); + attributes = getValue(attributes); + if (!isObject(attributes)) { + ref2 = [attributes, text], text = ref2[0], attributes = ref2[1]; } - }); - - XMLDocument.prototype.end = function(writer) { - var writerOptions; - writerOptions = {}; - if (!writer) { - writer = this.options.writer; - } else if (isPlainObject(writer)) { - writerOptions = writer; - writer = this.options.writer; + child = new XMLElement(this, name, attributes); + if (text != null) { + child.text(text); } - return writer.document(this, writer.filterOptions(writerOptions)); - }; - - XMLDocument.prototype.toString = function(options) { - return this.options.writer.document(this, this.options.writer.filterOptions(options)); - }; - - XMLDocument.prototype.createElement = function(tagName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createDocumentFragment = function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createTextNode = function(data) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createComment = function(data) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createCDATASection = function(data) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createProcessingInstruction = function(target, data) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createAttribute = function(name) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createEntityReference = function(name) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.getElementsByTagName = function(tagname) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.importNode = function(importedNode, deep) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createElementNS = function(namespaceURI, qualifiedName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createAttributeNS = function(namespaceURI, qualifiedName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.getElementById = function(elementId) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.adoptNode = function(source) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + this.children.push(child); + return child; }; - XMLDocument.prototype.normalizeDocument = function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLNode.prototype.text = function(value) { + var child; + if (isObject(value)) { + this.element(value); + } + child = new XMLText(this, value); + this.children.push(child); + return this; }; - XMLDocument.prototype.renameNode = function(node, namespaceURI, qualifiedName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLNode.prototype.cdata = function(value) { + var child; + child = new XMLCData(this, value); + this.children.push(child); + return this; }; - XMLDocument.prototype.getElementsByClassName = function(classNames) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLNode.prototype.comment = function(value) { + var child; + child = new XMLComment(this, value); + this.children.push(child); + return this; }; - XMLDocument.prototype.createEvent = function(eventInterface) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLNode.prototype.commentBefore = function(value) { + var child, i, removed; + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i); + child = this.parent.comment(value); + Array.prototype.push.apply(this.parent.children, removed); + return this; }; - XMLDocument.prototype.createRange = function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLNode.prototype.commentAfter = function(value) { + var child, i, removed; + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i + 1); + child = this.parent.comment(value); + Array.prototype.push.apply(this.parent.children, removed); + return this; }; - XMLDocument.prototype.createNodeIterator = function(root, whatToShow, filter) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLNode.prototype.raw = function(value) { + var child; + child = new XMLRaw(this, value); + this.children.push(child); + return this; }; - XMLDocument.prototype.createTreeWalker = function(root, whatToShow, filter) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLNode.prototype.dummy = function() { + var child; + child = new XMLDummy(this); + return child; }; - return XMLDocument; - - })(XMLNode); - -}).call(this); - - -/***/ }), - -/***/ 7356: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, WriterState, XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocument, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject, ref, - hasProp = {}.hasOwnProperty; - - ref = __nccwpck_require__(8229), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue; - - NodeType = __nccwpck_require__(9267); - - XMLDocument = __nccwpck_require__(3730); - - XMLElement = __nccwpck_require__(9437); - - XMLCData = __nccwpck_require__(333); - - XMLComment = __nccwpck_require__(4407); - - XMLRaw = __nccwpck_require__(6329); - - XMLText = __nccwpck_require__(1318); - - XMLProcessingInstruction = __nccwpck_require__(6939); - - XMLDeclaration = __nccwpck_require__(6364); - - XMLDocType = __nccwpck_require__(1801); - - XMLDTDAttList = __nccwpck_require__(1015); - - XMLDTDEntity = __nccwpck_require__(53); - - XMLDTDElement = __nccwpck_require__(2421); - - XMLDTDNotation = __nccwpck_require__(2837); - - XMLAttribute = __nccwpck_require__(8376); - - XMLStringifier = __nccwpck_require__(8594); - - XMLStringWriter = __nccwpck_require__(5913); - - WriterState = __nccwpck_require__(9766); - - module.exports = XMLDocumentCB = (function() { - function XMLDocumentCB(options, onData, onEnd) { - var writerOptions; - this.name = "?xml"; - this.type = NodeType.Document; - options || (options = {}); - writerOptions = {}; - if (!options.writer) { - options.writer = new XMLStringWriter(); - } else if (isPlainObject(options.writer)) { - writerOptions = options.writer; - options.writer = new XMLStringWriter(); + XMLNode.prototype.instruction = function(target, value) { + var insTarget, insValue, instruction, j, len; + if (target != null) { + target = getValue(target); } - this.options = options; - this.writer = options.writer; - this.writerOptions = this.writer.filterOptions(writerOptions); - this.stringify = new XMLStringifier(options); - this.onDataCallback = onData || function() {}; - this.onEndCallback = onEnd || function() {}; - this.currentNode = null; - this.currentLevel = -1; - this.openTags = {}; - this.documentStarted = false; - this.documentCompleted = false; - this.root = null; - } - - XMLDocumentCB.prototype.createChildNode = function(node) { - var att, attName, attributes, child, i, len, ref1, ref2; - switch (node.type) { - case NodeType.CData: - this.cdata(node.value); - break; - case NodeType.Comment: - this.comment(node.value); - break; - case NodeType.Element: - attributes = {}; - ref1 = node.attribs; - for (attName in ref1) { - if (!hasProp.call(ref1, attName)) continue; - att = ref1[attName]; - attributes[attName] = att.value; - } - this.node(node.name, attributes); - break; - case NodeType.Dummy: - this.dummy(); - break; - case NodeType.Raw: - this.raw(node.value); - break; - case NodeType.Text: - this.text(node.value); - break; - case NodeType.ProcessingInstruction: - this.instruction(node.target, node.value); - break; - default: - throw new Error("This XML node type is not supported in a JS object: " + node.constructor.name); + if (value != null) { + value = getValue(value); } - ref2 = node.children; - for (i = 0, len = ref2.length; i < len; i++) { - child = ref2[i]; - this.createChildNode(child); - if (child.type === NodeType.Element) { - this.up(); + if (Array.isArray(target)) { + for (j = 0, len = target.length; j < len; j++) { + insTarget = target[j]; + this.instruction(insTarget); + } + } else if (isObject(target)) { + for (insTarget in target) { + if (!hasProp.call(target, insTarget)) continue; + insValue = target[insTarget]; + this.instruction(insTarget, insValue); + } + } else { + if (isFunction(value)) { + value = value.apply(); } + instruction = new XMLProcessingInstruction(this, target, value); + this.children.push(instruction); } return this; }; - XMLDocumentCB.prototype.dummy = function() { + XMLNode.prototype.instructionBefore = function(target, value) { + var child, i, removed; + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i); + child = this.parent.instruction(target, value); + Array.prototype.push.apply(this.parent.children, removed); return this; }; - XMLDocumentCB.prototype.node = function(name, attributes, text) { - var ref1; - if (name == null) { - throw new Error("Missing node name."); - } - if (this.root && this.currentLevel === -1) { - throw new Error("Document can only have one root node. " + this.debugInfo(name)); + XMLNode.prototype.instructionAfter = function(target, value) { + var child, i, removed; + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i + 1); + child = this.parent.instruction(target, value); + Array.prototype.push.apply(this.parent.children, removed); + return this; + }; + + XMLNode.prototype.declaration = function(version, encoding, standalone) { + var doc, xmldec; + doc = this.document(); + xmldec = new XMLDeclaration(doc, version, encoding, standalone); + if (doc.children.length === 0) { + doc.children.unshift(xmldec); + } else if (doc.children[0].type === NodeType.Declaration) { + doc.children[0] = xmldec; + } else { + doc.children.unshift(xmldec); } - this.openCurrent(); - name = getValue(name); - if (attributes == null) { - attributes = {}; + return doc.root() || doc; + }; + + XMLNode.prototype.dtd = function(pubID, sysID) { + var child, doc, doctype, i, j, k, len, len1, ref2, ref3; + doc = this.document(); + doctype = new XMLDocType(doc, pubID, sysID); + ref2 = doc.children; + for (i = j = 0, len = ref2.length; j < len; i = ++j) { + child = ref2[i]; + if (child.type === NodeType.DocType) { + doc.children[i] = doctype; + return doctype; + } } - attributes = getValue(attributes); - if (!isObject(attributes)) { - ref1 = [attributes, text], text = ref1[0], attributes = ref1[1]; + ref3 = doc.children; + for (i = k = 0, len1 = ref3.length; k < len1; i = ++k) { + child = ref3[i]; + if (child.isRoot) { + doc.children.splice(i, 0, doctype); + return doctype; + } } - this.currentNode = new XMLElement(this, name, attributes); - this.currentNode.children = false; - this.currentLevel++; - this.openTags[this.currentLevel] = this.currentNode; - if (text != null) { - this.text(text); + doc.children.push(doctype); + return doctype; + }; + + XMLNode.prototype.up = function() { + if (this.isRoot) { + throw new Error("The root node has no parent. Use doc() if you need to get the document object."); } - return this; + return this.parent; }; - XMLDocumentCB.prototype.element = function(name, attributes, text) { - var child, i, len, oldValidationFlag, ref1, root; - if (this.currentNode && this.currentNode.type === NodeType.DocType) { - this.dtdElement.apply(this, arguments); - } else { - if (Array.isArray(name) || isObject(name) || isFunction(name)) { - oldValidationFlag = this.options.noValidation; - this.options.noValidation = true; - root = new XMLDocument(this.options).element('TEMP_ROOT'); - root.element(name); - this.options.noValidation = oldValidationFlag; - ref1 = root.children; - for (i = 0, len = ref1.length; i < len; i++) { - child = ref1[i]; - this.createChildNode(child); - if (child.type === NodeType.Element) { - this.up(); - } - } + XMLNode.prototype.root = function() { + var node; + node = this; + while (node) { + if (node.type === NodeType.Document) { + return node.rootObject; + } else if (node.isRoot) { + return node; } else { - this.node(name, attributes, text); + node = node.parent; } } - return this; }; - XMLDocumentCB.prototype.attribute = function(name, value) { - var attName, attValue; - if (!this.currentNode || this.currentNode.children) { - throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name)); - } - if (name != null) { - name = getValue(name); - } - if (isObject(name)) { - for (attName in name) { - if (!hasProp.call(name, attName)) continue; - attValue = name[attName]; - this.attribute(attName, attValue); - } - } else { - if (isFunction(value)) { - value = value.apply(); - } - if (this.options.keepNullAttributes && (value == null)) { - this.currentNode.attribs[name] = new XMLAttribute(this, name, ""); - } else if (value != null) { - this.currentNode.attribs[name] = new XMLAttribute(this, name, value); + XMLNode.prototype.document = function() { + var node; + node = this; + while (node) { + if (node.type === NodeType.Document) { + return node; + } else { + node = node.parent; } } - return this; }; - XMLDocumentCB.prototype.text = function(value) { - var node; - this.openCurrent(); - node = new XMLText(this, value); - this.onData(this.writer.text(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.end = function(options) { + return this.document().end(options); }; - XMLDocumentCB.prototype.cdata = function(value) { - var node; - this.openCurrent(); - node = new XMLCData(this, value); - this.onData(this.writer.cdata(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.prev = function() { + var i; + i = this.parent.children.indexOf(this); + if (i < 1) { + throw new Error("Already at the first node. " + this.debugInfo()); + } + return this.parent.children[i - 1]; }; - XMLDocumentCB.prototype.comment = function(value) { - var node; - this.openCurrent(); - node = new XMLComment(this, value); - this.onData(this.writer.comment(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.next = function() { + var i; + i = this.parent.children.indexOf(this); + if (i === -1 || i === this.parent.children.length - 1) { + throw new Error("Already at the last node. " + this.debugInfo()); + } + return this.parent.children[i + 1]; }; - XMLDocumentCB.prototype.raw = function(value) { - var node; - this.openCurrent(); - node = new XMLRaw(this, value); - this.onData(this.writer.raw(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + XMLNode.prototype.importDocument = function(doc) { + var clonedRoot; + clonedRoot = doc.root().clone(); + clonedRoot.parent = this; + clonedRoot.isRoot = false; + this.children.push(clonedRoot); return this; }; - XMLDocumentCB.prototype.instruction = function(target, value) { - var i, insTarget, insValue, len, node; - this.openCurrent(); - if (target != null) { - target = getValue(target); - } - if (value != null) { - value = getValue(value); - } - if (Array.isArray(target)) { - for (i = 0, len = target.length; i < len; i++) { - insTarget = target[i]; - this.instruction(insTarget); - } - } else if (isObject(target)) { - for (insTarget in target) { - if (!hasProp.call(target, insTarget)) continue; - insValue = target[insTarget]; - this.instruction(insTarget, insValue); - } + XMLNode.prototype.debugInfo = function(name) { + var ref2, ref3; + name = name || this.name; + if ((name == null) && !((ref2 = this.parent) != null ? ref2.name : void 0)) { + return ""; + } else if (name == null) { + return "parent: <" + this.parent.name + ">"; + } else if (!((ref3 = this.parent) != null ? ref3.name : void 0)) { + return "node: <" + name + ">"; } else { - if (isFunction(value)) { - value = value.apply(); - } - node = new XMLProcessingInstruction(this, target, value); - this.onData(this.writer.processingInstruction(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return "node: <" + name + ">, parent: <" + this.parent.name + ">"; } - return this; }; - XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) { - var node; - this.openCurrent(); - if (this.documentStarted) { - throw new Error("declaration() must be the first node."); - } - node = new XMLDeclaration(this, version, encoding, standalone); - this.onData(this.writer.declaration(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.ele = function(name, attributes, text) { + return this.element(name, attributes, text); }; - XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) { - this.openCurrent(); - if (root == null) { - throw new Error("Missing root node name."); - } - if (this.root) { - throw new Error("dtd() must come before the root node."); - } - this.currentNode = new XMLDocType(this, pubID, sysID); - this.currentNode.rootNodeName = root; - this.currentNode.children = false; - this.currentLevel++; - this.openTags[this.currentLevel] = this.currentNode; - return this; + XMLNode.prototype.nod = function(name, attributes, text) { + return this.node(name, attributes, text); }; - XMLDocumentCB.prototype.dtdElement = function(name, value) { - var node; - this.openCurrent(); - node = new XMLDTDElement(this, name, value); - this.onData(this.writer.dtdElement(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.txt = function(value) { + return this.text(value); }; - XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { - var node; - this.openCurrent(); - node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); - this.onData(this.writer.dtdAttList(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.dat = function(value) { + return this.cdata(value); }; - XMLDocumentCB.prototype.entity = function(name, value) { - var node; - this.openCurrent(); - node = new XMLDTDEntity(this, false, name, value); - this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.com = function(value) { + return this.comment(value); }; - XMLDocumentCB.prototype.pEntity = function(name, value) { - var node; - this.openCurrent(); - node = new XMLDTDEntity(this, true, name, value); - this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.ins = function(target, value) { + return this.instruction(target, value); }; - XMLDocumentCB.prototype.notation = function(name, value) { - var node; - this.openCurrent(); - node = new XMLDTDNotation(this, name, value); - this.onData(this.writer.dtdNotation(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.doc = function() { + return this.document(); }; - XMLDocumentCB.prototype.up = function() { - if (this.currentLevel < 0) { - throw new Error("The document node has no parent."); - } - if (this.currentNode) { - if (this.currentNode.children) { - this.closeNode(this.currentNode); + XMLNode.prototype.dec = function(version, encoding, standalone) { + return this.declaration(version, encoding, standalone); + }; + + XMLNode.prototype.e = function(name, attributes, text) { + return this.element(name, attributes, text); + }; + + XMLNode.prototype.n = function(name, attributes, text) { + return this.node(name, attributes, text); + }; + + XMLNode.prototype.t = function(value) { + return this.text(value); + }; + + XMLNode.prototype.d = function(value) { + return this.cdata(value); + }; + + XMLNode.prototype.c = function(value) { + return this.comment(value); + }; + + XMLNode.prototype.r = function(value) { + return this.raw(value); + }; + + XMLNode.prototype.i = function(target, value) { + return this.instruction(target, value); + }; + + XMLNode.prototype.u = function() { + return this.up(); + }; + + XMLNode.prototype.importXMLBuilder = function(doc) { + return this.importDocument(doc); + }; + + XMLNode.prototype.replaceChild = function(newChild, oldChild) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLNode.prototype.removeChild = function(oldChild) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLNode.prototype.appendChild = function(newChild) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLNode.prototype.hasChildNodes = function() { + return this.children.length !== 0; + }; + + XMLNode.prototype.cloneNode = function(deep) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLNode.prototype.normalize = function() { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLNode.prototype.isSupported = function(feature, version) { + return true; + }; + + XMLNode.prototype.hasAttributes = function() { + return this.attribs.length !== 0; + }; + + XMLNode.prototype.compareDocumentPosition = function(other) { + var ref, res; + ref = this; + if (ref === other) { + return 0; + } else if (this.document() !== other.document()) { + res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific; + if (Math.random() < 0.5) { + res |= DocumentPosition.Preceding; } else { - this.openNode(this.currentNode); + res |= DocumentPosition.Following; } - this.currentNode = null; + return res; + } else if (ref.isAncestor(other)) { + return DocumentPosition.Contains | DocumentPosition.Preceding; + } else if (ref.isDescendant(other)) { + return DocumentPosition.Contains | DocumentPosition.Following; + } else if (ref.isPreceding(other)) { + return DocumentPosition.Preceding; } else { - this.closeNode(this.openTags[this.currentLevel]); + return DocumentPosition.Following; } - delete this.openTags[this.currentLevel]; - this.currentLevel--; - return this; }; - XMLDocumentCB.prototype.end = function() { - while (this.currentLevel >= 0) { - this.up(); - } - return this.onEnd(); + XMLNode.prototype.isSameNode = function(other) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocumentCB.prototype.openCurrent = function() { - if (this.currentNode) { - this.currentNode.children = true; - return this.openNode(this.currentNode); - } + XMLNode.prototype.lookupPrefix = function(namespaceURI) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocumentCB.prototype.openNode = function(node) { - var att, chunk, name, ref1; - if (!node.isOpen) { - if (!this.root && this.currentLevel === 0 && node.type === NodeType.Element) { - this.root = node; - } - chunk = ''; - if (node.type === NodeType.Element) { - this.writerOptions.state = WriterState.OpenTag; - chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<' + node.name; - ref1 = node.attribs; - for (name in ref1) { - if (!hasProp.call(ref1, name)) continue; - att = ref1[name]; - chunk += this.writer.attribute(att, this.writerOptions, this.currentLevel); - } - chunk += (node.children ? '>' : '/>') + this.writer.endline(node, this.writerOptions, this.currentLevel); - this.writerOptions.state = WriterState.InsideTag; - } else { - this.writerOptions.state = WriterState.OpenTag; - chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ''; - } - chunk += this.writer.endline(node, this.writerOptions, this.currentLevel); - } - this.onData(chunk, this.currentLevel); - return node.isOpen = true; - } + XMLNode.prototype.isDefaultNamespace = function(namespaceURI) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocumentCB.prototype.closeNode = function(node) { - var chunk; - if (!node.isClosed) { - chunk = ''; - this.writerOptions.state = WriterState.CloseTag; - if (node.type === NodeType.Element) { - chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '' + this.writer.endline(node, this.writerOptions, this.currentLevel); - } else { - chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ']>' + this.writer.endline(node, this.writerOptions, this.currentLevel); + XMLNode.prototype.lookupNamespaceURI = function(prefix) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLNode.prototype.isEqualNode = function(node) { + var i, j, ref2; + if (node.nodeType !== this.nodeType) { + return false; + } + if (node.children.length !== this.children.length) { + return false; + } + for (i = j = 0, ref2 = this.children.length - 1; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) { + if (!this.children[i].isEqualNode(node.children[i])) { + return false; } - this.writerOptions.state = WriterState.None; - this.onData(chunk, this.currentLevel); - return node.isClosed = true; } + return true; }; - XMLDocumentCB.prototype.onData = function(chunk, level) { - this.documentStarted = true; - return this.onDataCallback(chunk, level + 1); + XMLNode.prototype.getFeature = function(feature, version) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocumentCB.prototype.onEnd = function() { - this.documentCompleted = true; - return this.onEndCallback(); + XMLNode.prototype.setUserData = function(key, data, handler) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocumentCB.prototype.debugInfo = function(name) { - if (name == null) { - return ""; - } else { - return "node: <" + name + ">"; - } + XMLNode.prototype.getUserData = function(key) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocumentCB.prototype.ele = function() { - return this.element.apply(this, arguments); + XMLNode.prototype.contains = function(other) { + if (!other) { + return false; + } + return other === this || this.isDescendant(other); }; - XMLDocumentCB.prototype.nod = function(name, attributes, text) { - return this.node(name, attributes, text); + XMLNode.prototype.isDescendant = function(node) { + var child, isDescendantChild, j, len, ref2; + ref2 = this.children; + for (j = 0, len = ref2.length; j < len; j++) { + child = ref2[j]; + if (node === child) { + return true; + } + isDescendantChild = child.isDescendant(node); + if (isDescendantChild) { + return true; + } + } + return false; }; - XMLDocumentCB.prototype.txt = function(value) { - return this.text(value); + XMLNode.prototype.isAncestor = function(node) { + return node.isDescendant(this); }; - XMLDocumentCB.prototype.dat = function(value) { - return this.cdata(value); + XMLNode.prototype.isPreceding = function(node) { + var nodePos, thisPos; + nodePos = this.treePosition(node); + thisPos = this.treePosition(this); + if (nodePos === -1 || thisPos === -1) { + return false; + } else { + return nodePos < thisPos; + } }; - XMLDocumentCB.prototype.com = function(value) { - return this.comment(value); + XMLNode.prototype.isFollowing = function(node) { + var nodePos, thisPos; + nodePos = this.treePosition(node); + thisPos = this.treePosition(this); + if (nodePos === -1 || thisPos === -1) { + return false; + } else { + return nodePos > thisPos; + } }; - XMLDocumentCB.prototype.ins = function(target, value) { - return this.instruction(target, value); + XMLNode.prototype.treePosition = function(node) { + var found, pos; + pos = 0; + found = false; + this.foreachTreeNode(this.document(), function(childNode) { + pos++; + if (!found && childNode === node) { + return found = true; + } + }); + if (found) { + return pos; + } else { + return -1; + } }; - XMLDocumentCB.prototype.dec = function(version, encoding, standalone) { - return this.declaration(version, encoding, standalone); + XMLNode.prototype.foreachTreeNode = function(node, func) { + var child, j, len, ref2, res; + node || (node = this.document()); + ref2 = node.children; + for (j = 0, len = ref2.length; j < len; j++) { + child = ref2[j]; + if (res = func(child)) { + return res; + } else { + res = this.foreachTreeNode(child, func); + if (res) { + return res; + } + } + } }; - XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) { - return this.doctype(root, pubID, sysID); - }; + return XMLNode; - XMLDocumentCB.prototype.e = function(name, attributes, text) { - return this.element(name, attributes, text); + })(); + +}).call(this); + + +/***/ }), + +/***/ 6768: +/***/ (function(module) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var XMLNodeList; + + module.exports = XMLNodeList = (function() { + function XMLNodeList(nodes) { + this.nodes = nodes; + } + + Object.defineProperty(XMLNodeList.prototype, 'length', { + get: function() { + return this.nodes.length || 0; + } + }); + + XMLNodeList.prototype.clone = function() { + return this.nodes = null; }; - XMLDocumentCB.prototype.n = function(name, attributes, text) { - return this.node(name, attributes, text); + XMLNodeList.prototype.item = function(index) { + return this.nodes[index] || null; }; - XMLDocumentCB.prototype.t = function(value) { - return this.text(value); - }; + return XMLNodeList; + + })(); + +}).call(this); + + +/***/ }), + +/***/ 6939: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - XMLDocumentCB.prototype.d = function(value) { - return this.cdata(value); - }; +// Generated by CoffeeScript 1.12.7 +(function() { + var NodeType, XMLCharacterData, XMLProcessingInstruction, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - XMLDocumentCB.prototype.c = function(value) { - return this.comment(value); - }; + NodeType = __nccwpck_require__(9267); - XMLDocumentCB.prototype.r = function(value) { - return this.raw(value); - }; + XMLCharacterData = __nccwpck_require__(7709); - XMLDocumentCB.prototype.i = function(target, value) { - return this.instruction(target, value); - }; + module.exports = XMLProcessingInstruction = (function(superClass) { + extend(XMLProcessingInstruction, superClass); - XMLDocumentCB.prototype.att = function() { - if (this.currentNode && this.currentNode.type === NodeType.DocType) { - return this.attList.apply(this, arguments); - } else { - return this.attribute.apply(this, arguments); + function XMLProcessingInstruction(parent, target, value) { + XMLProcessingInstruction.__super__.constructor.call(this, parent); + if (target == null) { + throw new Error("Missing instruction target. " + this.debugInfo()); } - }; - - XMLDocumentCB.prototype.a = function() { - if (this.currentNode && this.currentNode.type === NodeType.DocType) { - return this.attList.apply(this, arguments); - } else { - return this.attribute.apply(this, arguments); + this.type = NodeType.ProcessingInstruction; + this.target = this.stringify.insTarget(target); + this.name = this.target; + if (value) { + this.value = this.stringify.insValue(value); } - }; + } - XMLDocumentCB.prototype.ent = function(name, value) { - return this.entity(name, value); + XMLProcessingInstruction.prototype.clone = function() { + return Object.create(this); }; - XMLDocumentCB.prototype.pent = function(name, value) { - return this.pEntity(name, value); + XMLProcessingInstruction.prototype.toString = function(options) { + return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options)); }; - XMLDocumentCB.prototype.not = function(name, value) { - return this.notation(name, value); + XMLProcessingInstruction.prototype.isEqualNode = function(node) { + if (!XMLProcessingInstruction.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { + return false; + } + if (node.target !== this.target) { + return false; + } + return true; }; - return XMLDocumentCB; + return XMLProcessingInstruction; - })(); + })(XMLCharacterData); }).call(this); /***/ }), -/***/ 3590: +/***/ 6329: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var NodeType, XMLDummy, XMLNode, + var NodeType, XMLNode, XMLRaw, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - XMLNode = __nccwpck_require__(7608); - NodeType = __nccwpck_require__(9267); - module.exports = XMLDummy = (function(superClass) { - extend(XMLDummy, superClass); + XMLNode = __nccwpck_require__(7608); - function XMLDummy(parent) { - XMLDummy.__super__.constructor.call(this, parent); - this.type = NodeType.Dummy; + module.exports = XMLRaw = (function(superClass) { + extend(XMLRaw, superClass); + + function XMLRaw(parent, text) { + XMLRaw.__super__.constructor.call(this, parent); + if (text == null) { + throw new Error("Missing raw text. " + this.debugInfo()); + } + this.type = NodeType.Raw; + this.value = this.stringify.raw(text); } - XMLDummy.prototype.clone = function() { + XMLRaw.prototype.clone = function() { return Object.create(this); }; - XMLDummy.prototype.toString = function(options) { - return ''; + XMLRaw.prototype.toString = function(options) { + return this.options.writer.raw(this, this.options.writer.filterOptions(options)); }; - return XMLDummy; + return XMLRaw; })(XMLNode); @@ -82379,368 +81540,470 @@ module.exports.implForWrapper = function (wrapper) { /***/ }), -/***/ 9437: +/***/ 8601: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var NodeType, XMLAttribute, XMLElement, XMLNamedNodeMap, XMLNode, getValue, isFunction, isObject, ref, + var NodeType, WriterState, XMLStreamWriter, XMLWriterBase, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - ref = __nccwpck_require__(8229), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue; - - XMLNode = __nccwpck_require__(7608); - NodeType = __nccwpck_require__(9267); - XMLAttribute = __nccwpck_require__(8376); + XMLWriterBase = __nccwpck_require__(6752); - XMLNamedNodeMap = __nccwpck_require__(4361); + WriterState = __nccwpck_require__(9766); - module.exports = XMLElement = (function(superClass) { - extend(XMLElement, superClass); + module.exports = XMLStreamWriter = (function(superClass) { + extend(XMLStreamWriter, superClass); - function XMLElement(parent, name, attributes) { - var child, j, len, ref1; - XMLElement.__super__.constructor.call(this, parent); - if (name == null) { - throw new Error("Missing element name. " + this.debugInfo()); - } - this.name = this.stringify.name(name); - this.type = NodeType.Element; - this.attribs = {}; - this.schemaTypeInfo = null; - if (attributes != null) { - this.attribute(attributes); - } - if (parent.type === NodeType.Document) { - this.isRoot = true; - this.documentObject = parent; - parent.rootObject = this; - if (parent.children) { - ref1 = parent.children; - for (j = 0, len = ref1.length; j < len; j++) { - child = ref1[j]; - if (child.type === NodeType.DocType) { - child.name = this.name; - break; - } - } - } - } + function XMLStreamWriter(stream, options) { + this.stream = stream; + XMLStreamWriter.__super__.constructor.call(this, options); } - Object.defineProperty(XMLElement.prototype, 'tagName', { - get: function() { - return this.name; - } - }); - - Object.defineProperty(XMLElement.prototype, 'namespaceURI', { - get: function() { + XMLStreamWriter.prototype.endline = function(node, options, level) { + if (node.isLastRootNode && options.state === WriterState.CloseTag) { return ''; + } else { + return XMLStreamWriter.__super__.endline.call(this, node, options, level); } - }); + }; - Object.defineProperty(XMLElement.prototype, 'prefix', { - get: function() { - return ''; + XMLStreamWriter.prototype.document = function(doc, options) { + var child, i, j, k, len, len1, ref, ref1, results; + ref = doc.children; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + child = ref[i]; + child.isLastRootNode = i === doc.children.length - 1; } - }); - - Object.defineProperty(XMLElement.prototype, 'localName', { - get: function() { - return this.name; + options = this.filterOptions(options); + ref1 = doc.children; + results = []; + for (k = 0, len1 = ref1.length; k < len1; k++) { + child = ref1[k]; + results.push(this.writeChildNode(child, options, 0)); } - }); + return results; + }; - Object.defineProperty(XMLElement.prototype, 'id', { - get: function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - } - }); + XMLStreamWriter.prototype.attribute = function(att, options, level) { + return this.stream.write(XMLStreamWriter.__super__.attribute.call(this, att, options, level)); + }; - Object.defineProperty(XMLElement.prototype, 'className', { - get: function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - } - }); + XMLStreamWriter.prototype.cdata = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.cdata.call(this, node, options, level)); + }; - Object.defineProperty(XMLElement.prototype, 'classList', { - get: function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - } - }); + XMLStreamWriter.prototype.comment = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.comment.call(this, node, options, level)); + }; - Object.defineProperty(XMLElement.prototype, 'attributes', { - get: function() { - if (!this.attributeMap || !this.attributeMap.nodes) { - this.attributeMap = new XMLNamedNodeMap(this.attribs); - } - return this.attributeMap; - } - }); + XMLStreamWriter.prototype.declaration = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.declaration.call(this, node, options, level)); + }; - XMLElement.prototype.clone = function() { - var att, attName, clonedSelf, ref1; - clonedSelf = Object.create(this); - if (clonedSelf.isRoot) { - clonedSelf.documentObject = null; + XMLStreamWriter.prototype.docType = function(node, options, level) { + var child, j, len, ref; + level || (level = 0); + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + this.stream.write(this.indent(node, options, level)); + this.stream.write(' 0) { + this.stream.write(' ['); + this.stream.write(this.endline(node, options, level)); + options.state = WriterState.InsideTag; + ref = node.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + this.writeChildNode(child, options, level + 1); + } + options.state = WriterState.CloseTag; + this.stream.write(']'); } - clonedSelf.children = []; - this.children.forEach(function(child) { - var clonedChild; - clonedChild = child.clone(); - clonedChild.parent = clonedSelf; - return clonedSelf.children.push(clonedChild); - }); - return clonedSelf; + options.state = WriterState.CloseTag; + this.stream.write(options.spaceBeforeSlash + '>'); + this.stream.write(this.endline(node, options, level)); + options.state = WriterState.None; + return this.closeNode(node, options, level); }; - XMLElement.prototype.attribute = function(name, value) { - var attName, attValue; - if (name != null) { - name = getValue(name); + XMLStreamWriter.prototype.element = function(node, options, level) { + var att, child, childNodeCount, firstChildNode, j, len, name, prettySuppressed, ref, ref1; + level || (level = 0); + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + this.stream.write(this.indent(node, options, level) + '<' + node.name); + ref = node.attribs; + for (name in ref) { + if (!hasProp.call(ref, name)) continue; + att = ref[name]; + this.attribute(att, options, level); } - if (isObject(name)) { - for (attName in name) { - if (!hasProp.call(name, attName)) continue; - attValue = name[attName]; - this.attribute(attName, attValue); + childNodeCount = node.children.length; + firstChildNode = childNodeCount === 0 ? null : node.children[0]; + if (childNodeCount === 0 || node.children.every(function(e) { + return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === ''; + })) { + if (options.allowEmpty) { + this.stream.write('>'); + options.state = WriterState.CloseTag; + this.stream.write(''); + } else { + options.state = WriterState.CloseTag; + this.stream.write(options.spaceBeforeSlash + '/>'); } + } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) { + this.stream.write('>'); + options.state = WriterState.InsideTag; + options.suppressPrettyCount++; + prettySuppressed = true; + this.writeChildNode(firstChildNode, options, level + 1); + options.suppressPrettyCount--; + prettySuppressed = false; + options.state = WriterState.CloseTag; + this.stream.write(''); } else { - if (isFunction(value)) { - value = value.apply(); - } - if (this.options.keepNullAttributes && (value == null)) { - this.attribs[name] = new XMLAttribute(this, name, ""); - } else if (value != null) { - this.attribs[name] = new XMLAttribute(this, name, value); + this.stream.write('>' + this.endline(node, options, level)); + options.state = WriterState.InsideTag; + ref1 = node.children; + for (j = 0, len = ref1.length; j < len; j++) { + child = ref1[j]; + this.writeChildNode(child, options, level + 1); } + options.state = WriterState.CloseTag; + this.stream.write(this.indent(node, options, level) + ''); } - return this; + this.stream.write(this.endline(node, options, level)); + options.state = WriterState.None; + return this.closeNode(node, options, level); }; - XMLElement.prototype.removeAttribute = function(name) { - var attName, j, len; - if (name == null) { - throw new Error("Missing attribute name. " + this.debugInfo()); - } - name = getValue(name); - if (Array.isArray(name)) { - for (j = 0, len = name.length; j < len; j++) { - attName = name[j]; - delete this.attribs[attName]; - } - } else { - delete this.attribs[name]; - } - return this; + XMLStreamWriter.prototype.processingInstruction = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.processingInstruction.call(this, node, options, level)); }; - XMLElement.prototype.toString = function(options) { - return this.options.writer.element(this, this.options.writer.filterOptions(options)); + XMLStreamWriter.prototype.raw = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.raw.call(this, node, options, level)); }; - XMLElement.prototype.att = function(name, value) { - return this.attribute(name, value); + XMLStreamWriter.prototype.text = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.text.call(this, node, options, level)); }; - XMLElement.prototype.a = function(name, value) { - return this.attribute(name, value); + XMLStreamWriter.prototype.dtdAttList = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.dtdAttList.call(this, node, options, level)); }; - XMLElement.prototype.getAttribute = function(name) { - if (this.attribs.hasOwnProperty(name)) { - return this.attribs[name].value; - } else { - return null; - } + XMLStreamWriter.prototype.dtdElement = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.dtdElement.call(this, node, options, level)); }; - XMLElement.prototype.setAttribute = function(name, value) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStreamWriter.prototype.dtdEntity = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.dtdEntity.call(this, node, options, level)); }; - XMLElement.prototype.getAttributeNode = function(name) { - if (this.attribs.hasOwnProperty(name)) { - return this.attribs[name]; - } else { - return null; - } + XMLStreamWriter.prototype.dtdNotation = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.dtdNotation.call(this, node, options, level)); }; - XMLElement.prototype.setAttributeNode = function(newAttr) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + return XMLStreamWriter; + + })(XMLWriterBase); + +}).call(this); + + +/***/ }), + +/***/ 5913: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var XMLStringWriter, XMLWriterBase, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + XMLWriterBase = __nccwpck_require__(6752); + + module.exports = XMLStringWriter = (function(superClass) { + extend(XMLStringWriter, superClass); + + function XMLStringWriter(options) { + XMLStringWriter.__super__.constructor.call(this, options); + } + + XMLStringWriter.prototype.document = function(doc, options) { + var child, i, len, r, ref; + options = this.filterOptions(options); + r = ''; + ref = doc.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + r += this.writeChildNode(child, options, 0); + } + if (options.pretty && r.slice(-options.newline.length) === options.newline) { + r = r.slice(0, -options.newline.length); + } + return r; }; - XMLElement.prototype.removeAttributeNode = function(oldAttr) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + return XMLStringWriter; + + })(XMLWriterBase); + +}).call(this); + + +/***/ }), + +/***/ 8594: +/***/ (function(module) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var XMLStringifier, + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + hasProp = {}.hasOwnProperty; + + module.exports = XMLStringifier = (function() { + function XMLStringifier(options) { + this.assertLegalName = bind(this.assertLegalName, this); + this.assertLegalChar = bind(this.assertLegalChar, this); + var key, ref, value; + options || (options = {}); + this.options = options; + if (!this.options.version) { + this.options.version = '1.0'; + } + ref = options.stringify || {}; + for (key in ref) { + if (!hasProp.call(ref, key)) continue; + value = ref[key]; + this[key] = value; + } + } + + XMLStringifier.prototype.name = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalName('' + val || ''); }; - XMLElement.prototype.getElementsByTagName = function(name) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.text = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar(this.textEscape('' + val || '')); }; - XMLElement.prototype.getAttributeNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.cdata = function(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + val = val.replace(']]>', ']]]]>'); + return this.assertLegalChar(val); }; - XMLElement.prototype.setAttributeNS = function(namespaceURI, qualifiedName, value) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.comment = function(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + if (val.match(/--/)) { + throw new Error("Comment text cannot contain double-hypen: " + val); + } + return this.assertLegalChar(val); }; - XMLElement.prototype.removeAttributeNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.raw = function(val) { + if (this.options.noValidation) { + return val; + } + return '' + val || ''; }; - XMLElement.prototype.getAttributeNodeNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.attValue = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar(this.attEscape(val = '' + val || '')); }; - XMLElement.prototype.setAttributeNodeNS = function(newAttr) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.insTarget = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); }; - XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.insValue = function(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + if (val.match(/\?>/)) { + throw new Error("Invalid processing instruction value: " + val); + } + return this.assertLegalChar(val); }; - XMLElement.prototype.hasAttribute = function(name) { - return this.attribs.hasOwnProperty(name); + XMLStringifier.prototype.xmlVersion = function(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + if (!val.match(/1\.[0-9]+/)) { + throw new Error("Invalid version number: " + val); + } + return val; }; - XMLElement.prototype.hasAttributeNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.xmlEncoding = function(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) { + throw new Error("Invalid encoding: " + val); + } + return this.assertLegalChar(val); }; - XMLElement.prototype.setIdAttribute = function(name, isId) { - if (this.attribs.hasOwnProperty(name)) { - return this.attribs[name].isId; + XMLStringifier.prototype.xmlStandalone = function(val) { + if (this.options.noValidation) { + return val; + } + if (val) { + return "yes"; } else { - return isId; + return "no"; } }; - XMLElement.prototype.setIdAttributeNS = function(namespaceURI, localName, isId) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.dtdPubID = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); }; - XMLElement.prototype.setIdAttributeNode = function(idAttr, isId) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.dtdSysID = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); }; - XMLElement.prototype.getElementsByTagName = function(tagname) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.dtdElementValue = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); }; - XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.dtdAttType = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); }; - XMLElement.prototype.getElementsByClassName = function(classNames) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.dtdAttDefault = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); }; - XMLElement.prototype.isEqualNode = function(node) { - var i, j, ref1; - if (!XMLElement.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { - return false; - } - if (node.namespaceURI !== this.namespaceURI) { - return false; - } - if (node.prefix !== this.prefix) { - return false; - } - if (node.localName !== this.localName) { - return false; - } - if (node.attribs.length !== this.attribs.length) { - return false; - } - for (i = j = 0, ref1 = this.attribs.length - 1; 0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) { - if (!this.attribs[i].isEqualNode(node.attribs[i])) { - return false; - } + XMLStringifier.prototype.dtdEntityValue = function(val) { + if (this.options.noValidation) { + return val; } - return true; + return this.assertLegalChar('' + val || ''); }; - return XMLElement; - - })(XMLNode); + XMLStringifier.prototype.dtdNData = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); + }; -}).call(this); + XMLStringifier.prototype.convertAttKey = '@'; + XMLStringifier.prototype.convertPIKey = '?'; -/***/ }), + XMLStringifier.prototype.convertTextKey = '#text'; -/***/ 4361: -/***/ (function(module) { + XMLStringifier.prototype.convertCDataKey = '#cdata'; -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLNamedNodeMap; + XMLStringifier.prototype.convertCommentKey = '#comment'; - module.exports = XMLNamedNodeMap = (function() { - function XMLNamedNodeMap(nodes) { - this.nodes = nodes; - } + XMLStringifier.prototype.convertRawKey = '#raw'; - Object.defineProperty(XMLNamedNodeMap.prototype, 'length', { - get: function() { - return Object.keys(this.nodes).length || 0; + XMLStringifier.prototype.assertLegalChar = function(str) { + var regex, res; + if (this.options.noValidation) { + return str; } - }); - - XMLNamedNodeMap.prototype.clone = function() { - return this.nodes = null; - }; - - XMLNamedNodeMap.prototype.getNamedItem = function(name) { - return this.nodes[name]; - }; - - XMLNamedNodeMap.prototype.setNamedItem = function(node) { - var oldNode; - oldNode = this.nodes[node.nodeName]; - this.nodes[node.nodeName] = node; - return oldNode || null; - }; - - XMLNamedNodeMap.prototype.removeNamedItem = function(name) { - var oldNode; - oldNode = this.nodes[name]; - delete this.nodes[name]; - return oldNode || null; - }; - - XMLNamedNodeMap.prototype.item = function(index) { - return this.nodes[Object.keys(this.nodes)[index]] || null; + regex = ''; + if (this.options.version === '1.0') { + regex = /[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; + if (res = str.match(regex)) { + throw new Error("Invalid character in string: " + str + " at index " + res.index); + } + } else if (this.options.version === '1.1') { + regex = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; + if (res = str.match(regex)) { + throw new Error("Invalid character in string: " + str + " at index " + res.index); + } + } + return str; }; - XMLNamedNodeMap.prototype.getNamedItemNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented."); + XMLStringifier.prototype.assertLegalName = function(str) { + var regex; + if (this.options.noValidation) { + return str; + } + this.assertLegalChar(str); + regex = /^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/; + if (!str.match(regex)) { + throw new Error("Invalid character in name"); + } + return str; }; - XMLNamedNodeMap.prototype.setNamedItemNS = function(node) { - throw new Error("This DOM method is not implemented."); + XMLStringifier.prototype.textEscape = function(str) { + var ampregex; + if (this.options.noValidation) { + return str; + } + ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g; + return str.replace(ampregex, '&').replace(//g, '>').replace(/\r/g, ' '); }; - XMLNamedNodeMap.prototype.removeNamedItemNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented."); + XMLStringifier.prototype.attEscape = function(str) { + var ampregex; + if (this.options.noValidation) { + return str; + } + ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g; + return str.replace(ampregex, '&').replace(/ 0) { + return new Array(indentLevel).join(options.indent); + } } - child = new XMLText(this, value); - this.children.push(child); - return this; + return ''; }; - XMLNode.prototype.cdata = function(value) { - var child; - child = new XMLCData(this, value); - this.children.push(child); - return this; + XMLWriterBase.prototype.endline = function(node, options, level) { + if (!options.pretty || options.suppressPrettyCount) { + return ''; + } else { + return options.newline; + } }; - XMLNode.prototype.comment = function(value) { - var child; - child = new XMLComment(this, value); - this.children.push(child); - return this; + XMLWriterBase.prototype.attribute = function(att, options, level) { + var r; + this.openAttribute(att, options, level); + r = ' ' + att.name + '="' + att.value + '"'; + this.closeAttribute(att, options, level); + return r; }; - XMLNode.prototype.commentBefore = function(value) { - var child, i, removed; - i = this.parent.children.indexOf(this); - removed = this.parent.children.splice(i); - child = this.parent.comment(value); - Array.prototype.push.apply(this.parent.children, removed); - return this; + XMLWriterBase.prototype.cdata = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.commentAfter = function(value) { - var child, i, removed; - i = this.parent.children.indexOf(this); - removed = this.parent.children.splice(i + 1); - child = this.parent.comment(value); - Array.prototype.push.apply(this.parent.children, removed); - return this; + XMLWriterBase.prototype.comment = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.raw = function(value) { - var child; - child = new XMLRaw(this, value); - this.children.push(child); - return this; + XMLWriterBase.prototype.declaration = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + ''; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.dummy = function() { - var child; - child = new XMLDummy(this); - return child; + XMLWriterBase.prototype.docType = function(node, options, level) { + var child, i, len, r, ref; + level || (level = 0); + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level); + r += ' 0) { + r += ' ['; + r += this.endline(node, options, level); + options.state = WriterState.InsideTag; + ref = node.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + r += this.writeChildNode(child, options, level + 1); + } + options.state = WriterState.CloseTag; + r += ']'; + } + options.state = WriterState.CloseTag; + r += options.spaceBeforeSlash + '>'; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.instruction = function(target, value) { - var insTarget, insValue, instruction, j, len; - if (target != null) { - target = getValue(target); - } - if (value != null) { - value = getValue(value); + XMLWriterBase.prototype.element = function(node, options, level) { + var att, child, childNodeCount, firstChildNode, i, j, len, len1, name, prettySuppressed, r, ref, ref1, ref2; + level || (level = 0); + prettySuppressed = false; + r = ''; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r += this.indent(node, options, level) + '<' + node.name; + ref = node.attribs; + for (name in ref) { + if (!hasProp.call(ref, name)) continue; + att = ref[name]; + r += this.attribute(att, options, level); } - if (Array.isArray(target)) { - for (j = 0, len = target.length; j < len; j++) { - insTarget = target[j]; - this.instruction(insTarget); - } - } else if (isObject(target)) { - for (insTarget in target) { - if (!hasProp.call(target, insTarget)) continue; - insValue = target[insTarget]; - this.instruction(insTarget, insValue); + childNodeCount = node.children.length; + firstChildNode = childNodeCount === 0 ? null : node.children[0]; + if (childNodeCount === 0 || node.children.every(function(e) { + return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === ''; + })) { + if (options.allowEmpty) { + r += '>'; + options.state = WriterState.CloseTag; + r += '' + this.endline(node, options, level); + } else { + options.state = WriterState.CloseTag; + r += options.spaceBeforeSlash + '/>' + this.endline(node, options, level); } + } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) { + r += '>'; + options.state = WriterState.InsideTag; + options.suppressPrettyCount++; + prettySuppressed = true; + r += this.writeChildNode(firstChildNode, options, level + 1); + options.suppressPrettyCount--; + prettySuppressed = false; + options.state = WriterState.CloseTag; + r += '' + this.endline(node, options, level); } else { - if (isFunction(value)) { - value = value.apply(); + if (options.dontPrettyTextNodes) { + ref1 = node.children; + for (i = 0, len = ref1.length; i < len; i++) { + child = ref1[i]; + if ((child.type === NodeType.Text || child.type === NodeType.Raw) && (child.value != null)) { + options.suppressPrettyCount++; + prettySuppressed = true; + break; + } + } } - instruction = new XMLProcessingInstruction(this, target, value); - this.children.push(instruction); + r += '>' + this.endline(node, options, level); + options.state = WriterState.InsideTag; + ref2 = node.children; + for (j = 0, len1 = ref2.length; j < len1; j++) { + child = ref2[j]; + r += this.writeChildNode(child, options, level + 1); + } + options.state = WriterState.CloseTag; + r += this.indent(node, options, level) + ''; + if (prettySuppressed) { + options.suppressPrettyCount--; + } + r += this.endline(node, options, level); + options.state = WriterState.None; } - return this; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.instructionBefore = function(target, value) { - var child, i, removed; - i = this.parent.children.indexOf(this); - removed = this.parent.children.splice(i); - child = this.parent.instruction(target, value); - Array.prototype.push.apply(this.parent.children, removed); - return this; + XMLWriterBase.prototype.writeChildNode = function(node, options, level) { + switch (node.type) { + case NodeType.CData: + return this.cdata(node, options, level); + case NodeType.Comment: + return this.comment(node, options, level); + case NodeType.Element: + return this.element(node, options, level); + case NodeType.Raw: + return this.raw(node, options, level); + case NodeType.Text: + return this.text(node, options, level); + case NodeType.ProcessingInstruction: + return this.processingInstruction(node, options, level); + case NodeType.Dummy: + return ''; + case NodeType.Declaration: + return this.declaration(node, options, level); + case NodeType.DocType: + return this.docType(node, options, level); + case NodeType.AttributeDeclaration: + return this.dtdAttList(node, options, level); + case NodeType.ElementDeclaration: + return this.dtdElement(node, options, level); + case NodeType.EntityDeclaration: + return this.dtdEntity(node, options, level); + case NodeType.NotationDeclaration: + return this.dtdNotation(node, options, level); + default: + throw new Error("Unknown XML node type: " + node.constructor.name); + } }; - XMLNode.prototype.instructionAfter = function(target, value) { - var child, i, removed; - i = this.parent.children.indexOf(this); - removed = this.parent.children.splice(i + 1); - child = this.parent.instruction(target, value); - Array.prototype.push.apply(this.parent.children, removed); - return this; + XMLWriterBase.prototype.processingInstruction = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + ''; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.declaration = function(version, encoding, standalone) { - var doc, xmldec; - doc = this.document(); - xmldec = new XMLDeclaration(doc, version, encoding, standalone); - if (doc.children.length === 0) { - doc.children.unshift(xmldec); - } else if (doc.children[0].type === NodeType.Declaration) { - doc.children[0] = xmldec; - } else { - doc.children.unshift(xmldec); - } - return doc.root() || doc; + XMLWriterBase.prototype.raw = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level); + options.state = WriterState.InsideTag; + r += node.value; + options.state = WriterState.CloseTag; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.dtd = function(pubID, sysID) { - var child, doc, doctype, i, j, k, len, len1, ref2, ref3; - doc = this.document(); - doctype = new XMLDocType(doc, pubID, sysID); - ref2 = doc.children; - for (i = j = 0, len = ref2.length; j < len; i = ++j) { - child = ref2[i]; - if (child.type === NodeType.DocType) { - doc.children[i] = doctype; - return doctype; - } + XMLWriterBase.prototype.text = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level); + options.state = WriterState.InsideTag; + r += node.value; + options.state = WriterState.CloseTag; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; + }; + + XMLWriterBase.prototype.dtdAttList = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.up = function() { - if (this.isRoot) { - throw new Error("The root node has no parent. Use doc() if you need to get the document object."); - } - return this.parent; + XMLWriterBase.prototype.dtdElement = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.root = function() { - var node; - node = this; - while (node) { - if (node.type === NodeType.Document) { - return node.rootObject; - } else if (node.isRoot) { - return node; - } else { - node = node.parent; + XMLWriterBase.prototype.dtdEntity = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.document = function() { - var node; - node = this; - while (node) { - if (node.type === NodeType.Document) { - return node; - } else { - node = node.parent; - } + XMLWriterBase.prototype.dtdNotation = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.end = function(options) { - return this.document().end(options); - }; + XMLWriterBase.prototype.openNode = function(node, options, level) {}; - XMLNode.prototype.prev = function() { - var i; - i = this.parent.children.indexOf(this); - if (i < 1) { - throw new Error("Already at the first node. " + this.debugInfo()); - } - return this.parent.children[i - 1]; - }; + XMLWriterBase.prototype.closeNode = function(node, options, level) {}; - XMLNode.prototype.next = function() { - var i; - i = this.parent.children.indexOf(this); - if (i === -1 || i === this.parent.children.length - 1) { - throw new Error("Already at the last node. " + this.debugInfo()); - } - return this.parent.children[i + 1]; - }; + XMLWriterBase.prototype.openAttribute = function(att, options, level) {}; - XMLNode.prototype.importDocument = function(doc) { - var clonedRoot; - clonedRoot = doc.root().clone(); - clonedRoot.parent = this; - clonedRoot.isRoot = false; - this.children.push(clonedRoot); - return this; - }; + XMLWriterBase.prototype.closeAttribute = function(att, options, level) {}; - XMLNode.prototype.debugInfo = function(name) { - var ref2, ref3; - name = name || this.name; - if ((name == null) && !((ref2 = this.parent) != null ? ref2.name : void 0)) { - return ""; - } else if (name == null) { - return "parent: <" + this.parent.name + ">"; - } else if (!((ref3 = this.parent) != null ? ref3.name : void 0)) { - return "node: <" + name + ">"; - } else { - return "node: <" + name + ">, parent: <" + this.parent.name + ">"; - } - }; + return XMLWriterBase; - XMLNode.prototype.ele = function(name, attributes, text) { - return this.element(name, attributes, text); - }; + })(); - XMLNode.prototype.nod = function(name, attributes, text) { - return this.node(name, attributes, text); - }; +}).call(this); - XMLNode.prototype.txt = function(value) { - return this.text(value); - }; - XMLNode.prototype.dat = function(value) { - return this.cdata(value); - }; +/***/ }), - XMLNode.prototype.com = function(value) { - return this.comment(value); - }; +/***/ 2958: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - XMLNode.prototype.ins = function(target, value) { - return this.instruction(target, value); - }; +// Generated by CoffeeScript 1.12.7 +(function() { + var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref; - XMLNode.prototype.doc = function() { - return this.document(); - }; + ref = __nccwpck_require__(8229), assign = ref.assign, isFunction = ref.isFunction; - XMLNode.prototype.dec = function(version, encoding, standalone) { - return this.declaration(version, encoding, standalone); - }; + XMLDOMImplementation = __nccwpck_require__(8310); - XMLNode.prototype.e = function(name, attributes, text) { - return this.element(name, attributes, text); - }; + XMLDocument = __nccwpck_require__(3730); - XMLNode.prototype.n = function(name, attributes, text) { - return this.node(name, attributes, text); - }; + XMLDocumentCB = __nccwpck_require__(7356); - XMLNode.prototype.t = function(value) { - return this.text(value); - }; + XMLStringWriter = __nccwpck_require__(5913); - XMLNode.prototype.d = function(value) { - return this.cdata(value); - }; + XMLStreamWriter = __nccwpck_require__(8601); - XMLNode.prototype.c = function(value) { - return this.comment(value); - }; + NodeType = __nccwpck_require__(9267); - XMLNode.prototype.r = function(value) { - return this.raw(value); - }; + WriterState = __nccwpck_require__(9766); - XMLNode.prototype.i = function(target, value) { - return this.instruction(target, value); - }; + module.exports.create = function(name, xmldec, doctype, options) { + var doc, root; + if (name == null) { + throw new Error("Root element needs a name."); + } + options = assign({}, xmldec, doctype, options); + doc = new XMLDocument(options); + root = doc.element(name); + if (!options.headless) { + doc.declaration(options); + if ((options.pubID != null) || (options.sysID != null)) { + doc.dtd(options); + } + } + return root; + }; - XMLNode.prototype.u = function() { - return this.up(); - }; + module.exports.begin = function(options, onData, onEnd) { + var ref1; + if (isFunction(options)) { + ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1]; + options = {}; + } + if (onData) { + return new XMLDocumentCB(options, onData, onEnd); + } else { + return new XMLDocument(options); + } + }; - XMLNode.prototype.importXMLBuilder = function(doc) { - return this.importDocument(doc); - }; + module.exports.stringWriter = function(options) { + return new XMLStringWriter(options); + }; - XMLNode.prototype.replaceChild = function(newChild, oldChild) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; + module.exports.streamWriter = function(stream, options) { + return new XMLStreamWriter(stream, options); + }; - XMLNode.prototype.removeChild = function(oldChild) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; + module.exports.implementation = new XMLDOMImplementation(); - XMLNode.prototype.appendChild = function(newChild) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; + module.exports.nodeType = NodeType; - XMLNode.prototype.hasChildNodes = function() { - return this.children.length !== 0; - }; + module.exports.writerState = WriterState; - XMLNode.prototype.cloneNode = function(deep) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +}).call(this); - XMLNode.prototype.normalize = function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - XMLNode.prototype.isSupported = function(feature, version) { - return true; - }; +/***/ }), - XMLNode.prototype.hasAttributes = function() { - return this.attribs.length !== 0; - }; +/***/ 2877: +/***/ ((module) => { - XMLNode.prototype.compareDocumentPosition = function(other) { - var ref, res; - ref = this; - if (ref === other) { - return 0; - } else if (this.document() !== other.document()) { - res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific; - if (Math.random() < 0.5) { - res |= DocumentPosition.Preceding; - } else { - res |= DocumentPosition.Following; - } - return res; - } else if (ref.isAncestor(other)) { - return DocumentPosition.Contains | DocumentPosition.Preceding; - } else if (ref.isDescendant(other)) { - return DocumentPosition.Contains | DocumentPosition.Following; - } else if (ref.isPreceding(other)) { - return DocumentPosition.Preceding; - } else { - return DocumentPosition.Following; - } - }; +module.exports = eval("require")("encoding"); - XMLNode.prototype.isSameNode = function(other) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - XMLNode.prototype.lookupPrefix = function(namespaceURI) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +/***/ }), - XMLNode.prototype.isDefaultNamespace = function(namespaceURI) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +/***/ 9491: +/***/ ((module) => { - XMLNode.prototype.lookupNamespaceURI = function(prefix) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +"use strict"; +module.exports = require("assert"); - XMLNode.prototype.isEqualNode = function(node) { - var i, j, ref2; - if (node.nodeType !== this.nodeType) { - return false; - } - if (node.children.length !== this.children.length) { - return false; - } - for (i = j = 0, ref2 = this.children.length - 1; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) { - if (!this.children[i].isEqualNode(node.children[i])) { - return false; - } - } - return true; - }; +/***/ }), - XMLNode.prototype.getFeature = function(feature, version) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +/***/ 852: +/***/ ((module) => { - XMLNode.prototype.setUserData = function(key, data, handler) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +"use strict"; +module.exports = require("async_hooks"); - XMLNode.prototype.getUserData = function(key) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +/***/ }), - XMLNode.prototype.contains = function(other) { - if (!other) { - return false; - } - return other === this || this.isDescendant(other); - }; +/***/ 4300: +/***/ ((module) => { - XMLNode.prototype.isDescendant = function(node) { - var child, isDescendantChild, j, len, ref2; - ref2 = this.children; - for (j = 0, len = ref2.length; j < len; j++) { - child = ref2[j]; - if (node === child) { - return true; - } - isDescendantChild = child.isDescendant(node); - if (isDescendantChild) { - return true; - } - } - return false; - }; +"use strict"; +module.exports = require("buffer"); - XMLNode.prototype.isAncestor = function(node) { - return node.isDescendant(this); - }; +/***/ }), - XMLNode.prototype.isPreceding = function(node) { - var nodePos, thisPos; - nodePos = this.treePosition(node); - thisPos = this.treePosition(this); - if (nodePos === -1 || thisPos === -1) { - return false; - } else { - return nodePos < thisPos; - } - }; +/***/ 2081: +/***/ ((module) => { - XMLNode.prototype.isFollowing = function(node) { - var nodePos, thisPos; - nodePos = this.treePosition(node); - thisPos = this.treePosition(this); - if (nodePos === -1 || thisPos === -1) { - return false; - } else { - return nodePos > thisPos; - } - }; +"use strict"; +module.exports = require("child_process"); - XMLNode.prototype.treePosition = function(node) { - var found, pos; - pos = 0; - found = false; - this.foreachTreeNode(this.document(), function(childNode) { - pos++; - if (!found && childNode === node) { - return found = true; - } - }); - if (found) { - return pos; - } else { - return -1; - } - }; +/***/ }), - XMLNode.prototype.foreachTreeNode = function(node, func) { - var child, j, len, ref2, res; - node || (node = this.document()); - ref2 = node.children; - for (j = 0, len = ref2.length; j < len; j++) { - child = ref2[j]; - if (res = func(child)) { - return res; - } else { - res = this.foreachTreeNode(child, func); - if (res) { - return res; - } - } - } - }; +/***/ 6206: +/***/ ((module) => { - return XMLNode; +"use strict"; +module.exports = require("console"); - })(); +/***/ }), -}).call(this); +/***/ 6113: +/***/ ((module) => { +"use strict"; +module.exports = require("crypto"); /***/ }), -/***/ 6768: -/***/ (function(module) { +/***/ 7643: +/***/ ((module) => { -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLNodeList; +"use strict"; +module.exports = require("diagnostics_channel"); - module.exports = XMLNodeList = (function() { - function XMLNodeList(nodes) { - this.nodes = nodes; - } +/***/ }), - Object.defineProperty(XMLNodeList.prototype, 'length', { - get: function() { - return this.nodes.length || 0; - } - }); +/***/ 2361: +/***/ ((module) => { - XMLNodeList.prototype.clone = function() { - return this.nodes = null; - }; +"use strict"; +module.exports = require("events"); - XMLNodeList.prototype.item = function(index) { - return this.nodes[index] || null; - }; +/***/ }), - return XMLNodeList; +/***/ 7147: +/***/ ((module) => { - })(); +"use strict"; +module.exports = require("fs"); -}).call(this); +/***/ }), + +/***/ 3292: +/***/ ((module) => { +"use strict"; +module.exports = require("fs/promises"); /***/ }), -/***/ 6939: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { +/***/ 3685: +/***/ ((module) => { -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLCharacterData, XMLProcessingInstruction, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; +"use strict"; +module.exports = require("http"); - NodeType = __nccwpck_require__(9267); +/***/ }), - XMLCharacterData = __nccwpck_require__(7709); +/***/ 5158: +/***/ ((module) => { - module.exports = XMLProcessingInstruction = (function(superClass) { - extend(XMLProcessingInstruction, superClass); +"use strict"; +module.exports = require("http2"); - function XMLProcessingInstruction(parent, target, value) { - XMLProcessingInstruction.__super__.constructor.call(this, parent); - if (target == null) { - throw new Error("Missing instruction target. " + this.debugInfo()); - } - this.type = NodeType.ProcessingInstruction; - this.target = this.stringify.insTarget(target); - this.name = this.target; - if (value) { - this.value = this.stringify.insValue(value); - } - } +/***/ }), - XMLProcessingInstruction.prototype.clone = function() { - return Object.create(this); - }; +/***/ 5687: +/***/ ((module) => { - XMLProcessingInstruction.prototype.toString = function(options) { - return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options)); - }; +"use strict"; +module.exports = require("https"); - XMLProcessingInstruction.prototype.isEqualNode = function(node) { - if (!XMLProcessingInstruction.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { - return false; - } - if (node.target !== this.target) { - return false; - } - return true; - }; +/***/ }), - return XMLProcessingInstruction; +/***/ 1808: +/***/ ((module) => { - })(XMLCharacterData); +"use strict"; +module.exports = require("net"); -}).call(this); +/***/ }), + +/***/ 5673: +/***/ ((module) => { +"use strict"; +module.exports = require("node:events"); /***/ }), -/***/ 6329: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { +/***/ 612: +/***/ ((module) => { -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLNode, XMLRaw, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; +"use strict"; +module.exports = require("node:os"); - NodeType = __nccwpck_require__(9267); +/***/ }), - XMLNode = __nccwpck_require__(7608); +/***/ 7742: +/***/ ((module) => { - module.exports = XMLRaw = (function(superClass) { - extend(XMLRaw, superClass); +"use strict"; +module.exports = require("node:process"); - function XMLRaw(parent, text) { - XMLRaw.__super__.constructor.call(this, parent); - if (text == null) { - throw new Error("Missing raw text. " + this.debugInfo()); - } - this.type = NodeType.Raw; - this.value = this.stringify.raw(text); - } +/***/ }), - XMLRaw.prototype.clone = function() { - return Object.create(this); - }; +/***/ 4492: +/***/ ((module) => { - XMLRaw.prototype.toString = function(options) { - return this.options.writer.raw(this, this.options.writer.filterOptions(options)); - }; +"use strict"; +module.exports = require("node:stream"); - return XMLRaw; +/***/ }), + +/***/ 7261: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:util"); + +/***/ }), + +/***/ 2037: +/***/ ((module) => { + +"use strict"; +module.exports = require("os"); - })(XMLNode); +/***/ }), -}).call(this); +/***/ 1017: +/***/ ((module) => { +"use strict"; +module.exports = require("path"); /***/ }), -/***/ 8601: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { +/***/ 4074: +/***/ ((module) => { -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, WriterState, XMLStreamWriter, XMLWriterBase, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; +"use strict"; +module.exports = require("perf_hooks"); - NodeType = __nccwpck_require__(9267); +/***/ }), - XMLWriterBase = __nccwpck_require__(6752); +/***/ 5477: +/***/ ((module) => { - WriterState = __nccwpck_require__(9766); +"use strict"; +module.exports = require("punycode"); - module.exports = XMLStreamWriter = (function(superClass) { - extend(XMLStreamWriter, superClass); +/***/ }), - function XMLStreamWriter(stream, options) { - this.stream = stream; - XMLStreamWriter.__super__.constructor.call(this, options); - } +/***/ 3477: +/***/ ((module) => { - XMLStreamWriter.prototype.endline = function(node, options, level) { - if (node.isLastRootNode && options.state === WriterState.CloseTag) { - return ''; - } else { - return XMLStreamWriter.__super__.endline.call(this, node, options, level); - } - }; +"use strict"; +module.exports = require("querystring"); - XMLStreamWriter.prototype.document = function(doc, options) { - var child, i, j, k, len, len1, ref, ref1, results; - ref = doc.children; - for (i = j = 0, len = ref.length; j < len; i = ++j) { - child = ref[i]; - child.isLastRootNode = i === doc.children.length - 1; - } - options = this.filterOptions(options); - ref1 = doc.children; - results = []; - for (k = 0, len1 = ref1.length; k < len1; k++) { - child = ref1[k]; - results.push(this.writeChildNode(child, options, 0)); - } - return results; - }; +/***/ }), - XMLStreamWriter.prototype.attribute = function(att, options, level) { - return this.stream.write(XMLStreamWriter.__super__.attribute.call(this, att, options, level)); - }; +/***/ 2781: +/***/ ((module) => { - XMLStreamWriter.prototype.cdata = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.cdata.call(this, node, options, level)); - }; +"use strict"; +module.exports = require("stream"); - XMLStreamWriter.prototype.comment = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.comment.call(this, node, options, level)); - }; +/***/ }), - XMLStreamWriter.prototype.declaration = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.declaration.call(this, node, options, level)); - }; +/***/ 5356: +/***/ ((module) => { - XMLStreamWriter.prototype.docType = function(node, options, level) { - var child, j, len, ref; - level || (level = 0); - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - this.stream.write(this.indent(node, options, level)); - this.stream.write(' 0) { - this.stream.write(' ['); - this.stream.write(this.endline(node, options, level)); - options.state = WriterState.InsideTag; - ref = node.children; - for (j = 0, len = ref.length; j < len; j++) { - child = ref[j]; - this.writeChildNode(child, options, level + 1); - } - options.state = WriterState.CloseTag; - this.stream.write(']'); - } - options.state = WriterState.CloseTag; - this.stream.write(options.spaceBeforeSlash + '>'); - this.stream.write(this.endline(node, options, level)); - options.state = WriterState.None; - return this.closeNode(node, options, level); - }; +"use strict"; +module.exports = require("stream/web"); - XMLStreamWriter.prototype.element = function(node, options, level) { - var att, child, childNodeCount, firstChildNode, j, len, name, prettySuppressed, ref, ref1; - level || (level = 0); - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - this.stream.write(this.indent(node, options, level) + '<' + node.name); - ref = node.attribs; - for (name in ref) { - if (!hasProp.call(ref, name)) continue; - att = ref[name]; - this.attribute(att, options, level); - } - childNodeCount = node.children.length; - firstChildNode = childNodeCount === 0 ? null : node.children[0]; - if (childNodeCount === 0 || node.children.every(function(e) { - return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === ''; - })) { - if (options.allowEmpty) { - this.stream.write('>'); - options.state = WriterState.CloseTag; - this.stream.write(''); - } else { - options.state = WriterState.CloseTag; - this.stream.write(options.spaceBeforeSlash + '/>'); - } - } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) { - this.stream.write('>'); - options.state = WriterState.InsideTag; - options.suppressPrettyCount++; - prettySuppressed = true; - this.writeChildNode(firstChildNode, options, level + 1); - options.suppressPrettyCount--; - prettySuppressed = false; - options.state = WriterState.CloseTag; - this.stream.write(''); - } else { - this.stream.write('>' + this.endline(node, options, level)); - options.state = WriterState.InsideTag; - ref1 = node.children; - for (j = 0, len = ref1.length; j < len; j++) { - child = ref1[j]; - this.writeChildNode(child, options, level + 1); - } - options.state = WriterState.CloseTag; - this.stream.write(this.indent(node, options, level) + ''); - } - this.stream.write(this.endline(node, options, level)); - options.state = WriterState.None; - return this.closeNode(node, options, level); - }; +/***/ }), - XMLStreamWriter.prototype.processingInstruction = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.processingInstruction.call(this, node, options, level)); - }; +/***/ 1576: +/***/ ((module) => { - XMLStreamWriter.prototype.raw = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.raw.call(this, node, options, level)); - }; +"use strict"; +module.exports = require("string_decoder"); - XMLStreamWriter.prototype.text = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.text.call(this, node, options, level)); - }; +/***/ }), - XMLStreamWriter.prototype.dtdAttList = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.dtdAttList.call(this, node, options, level)); - }; +/***/ 9512: +/***/ ((module) => { - XMLStreamWriter.prototype.dtdElement = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.dtdElement.call(this, node, options, level)); - }; +"use strict"; +module.exports = require("timers"); - XMLStreamWriter.prototype.dtdEntity = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.dtdEntity.call(this, node, options, level)); - }; +/***/ }), - XMLStreamWriter.prototype.dtdNotation = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.dtdNotation.call(this, node, options, level)); - }; +/***/ 4404: +/***/ ((module) => { - return XMLStreamWriter; +"use strict"; +module.exports = require("tls"); - })(XMLWriterBase); +/***/ }), -}).call(this); +/***/ 7310: +/***/ ((module) => { +"use strict"; +module.exports = require("url"); /***/ }), -/***/ 5913: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { +/***/ 3837: +/***/ ((module) => { -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLStringWriter, XMLWriterBase, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; +"use strict"; +module.exports = require("util"); - XMLWriterBase = __nccwpck_require__(6752); +/***/ }), - module.exports = XMLStringWriter = (function(superClass) { - extend(XMLStringWriter, superClass); +/***/ 9830: +/***/ ((module) => { - function XMLStringWriter(options) { - XMLStringWriter.__super__.constructor.call(this, options); - } +"use strict"; +module.exports = require("util/types"); - XMLStringWriter.prototype.document = function(doc, options) { - var child, i, len, r, ref; - options = this.filterOptions(options); - r = ''; - ref = doc.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - r += this.writeChildNode(child, options, 0); - } - if (options.pretty && r.slice(-options.newline.length) === options.newline) { - r = r.slice(0, -options.newline.length); - } - return r; - }; +/***/ }), - return XMLStringWriter; +/***/ 1267: +/***/ ((module) => { - })(XMLWriterBase); +"use strict"; +module.exports = require("worker_threads"); -}).call(this); +/***/ }), +/***/ 9796: +/***/ ((module) => { + +"use strict"; +module.exports = require("zlib"); /***/ }), -/***/ 8594: -/***/ (function(module) { +/***/ 1875: +/***/ ((__unused_webpack_module, exports) => { -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLStringifier, - bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - hasProp = {}.hasOwnProperty; +"use strict"; - module.exports = XMLStringifier = (function() { - function XMLStringifier(options) { - this.assertLegalName = bind(this.assertLegalName, this); - this.assertLegalChar = bind(this.assertLegalChar, this); - var key, ref, value; - options || (options = {}); - this.options = options; - if (!this.options.version) { - this.options.version = '1.0'; - } - ref = options.stringify || {}; - for (key in ref) { - if (!hasProp.call(ref, key)) continue; - value = ref[key]; - this[key] = value; - } +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AzureKeyCredential = void 0; +/** + * A static-key-based credential that supports updating + * the underlying key value. + */ +class AzureKeyCredential { + _key; + /** + * The value of the key to be used in authentication + */ + get key() { + return this._key; } + /** + * Create an instance of an AzureKeyCredential for use + * with a service client. + * + * @param key - The initial value of the key to use in authentication + */ + constructor(key) { + if (!key) { + throw new Error("key must be a non-empty string"); + } + this._key = key; + } + /** + * Change the value of the key. + * + * Updates will take effect upon the next request after + * updating the key value. + * + * @param newKey - The new key value to be used + */ + update(newKey) { + this._key = newKey; + } +} +exports.AzureKeyCredential = AzureKeyCredential; +//# sourceMappingURL=azureKeyCredential.js.map - XMLStringifier.prototype.name = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalName('' + val || ''); - }; - - XMLStringifier.prototype.text = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar(this.textEscape('' + val || '')); - }; - - XMLStringifier.prototype.cdata = function(val) { - if (this.options.noValidation) { - return val; - } - val = '' + val || ''; - val = val.replace(']]>', ']]]]>'); - return this.assertLegalChar(val); - }; +/***/ }), - XMLStringifier.prototype.comment = function(val) { - if (this.options.noValidation) { - return val; - } - val = '' + val || ''; - if (val.match(/--/)) { - throw new Error("Comment text cannot contain double-hypen: " + val); - } - return this.assertLegalChar(val); - }; +/***/ 1377: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLStringifier.prototype.raw = function(val) { - if (this.options.noValidation) { - return val; - } - return '' + val || ''; - }; +"use strict"; - XMLStringifier.prototype.attValue = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar(this.attEscape(val = '' + val || '')); - }; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isNamedKeyCredential = exports.AzureNamedKeyCredential = void 0; +const core_util_1 = __nccwpck_require__(637); +/** + * A static name/key-based credential that supports updating + * the underlying name and key values. + */ +class AzureNamedKeyCredential { + _key; + _name; + /** + * The value of the key to be used in authentication. + */ + get key() { + return this._key; + } + /** + * The value of the name to be used in authentication. + */ + get name() { + return this._name; + } + /** + * Create an instance of an AzureNamedKeyCredential for use + * with a service client. + * + * @param name - The initial value of the name to use in authentication. + * @param key - The initial value of the key to use in authentication. + */ + constructor(name, key) { + if (!name || !key) { + throw new TypeError("name and key must be non-empty strings"); + } + this._name = name; + this._key = key; + } + /** + * Change the value of the key. + * + * Updates will take effect upon the next request after + * updating the key value. + * + * @param newName - The new name value to be used. + * @param newKey - The new key value to be used. + */ + update(newName, newKey) { + if (!newName || !newKey) { + throw new TypeError("newName and newKey must be non-empty strings"); + } + this._name = newName; + this._key = newKey; + } +} +exports.AzureNamedKeyCredential = AzureNamedKeyCredential; +/** + * Tests an object to determine whether it implements NamedKeyCredential. + * + * @param credential - The assumed NamedKeyCredential to be tested. + */ +function isNamedKeyCredential(credential) { + return ((0, core_util_1.isObjectWithProperties)(credential, ["name", "key"]) && + typeof credential.key === "string" && + typeof credential.name === "string"); +} +exports.isNamedKeyCredential = isNamedKeyCredential; +//# sourceMappingURL=azureNamedKeyCredential.js.map - XMLStringifier.prototype.insTarget = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +/***/ }), - XMLStringifier.prototype.insValue = function(val) { - if (this.options.noValidation) { - return val; - } - val = '' + val || ''; - if (val.match(/\?>/)) { - throw new Error("Invalid processing instruction value: " + val); - } - return this.assertLegalChar(val); - }; +/***/ 7182: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLStringifier.prototype.xmlVersion = function(val) { - if (this.options.noValidation) { - return val; - } - val = '' + val || ''; - if (!val.match(/1\.[0-9]+/)) { - throw new Error("Invalid version number: " + val); - } - return val; - }; +"use strict"; - XMLStringifier.prototype.xmlEncoding = function(val) { - if (this.options.noValidation) { - return val; - } - val = '' + val || ''; - if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) { - throw new Error("Invalid encoding: " + val); - } - return this.assertLegalChar(val); - }; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isSASCredential = exports.AzureSASCredential = void 0; +const core_util_1 = __nccwpck_require__(637); +/** + * A static-signature-based credential that supports updating + * the underlying signature value. + */ +class AzureSASCredential { + _signature; + /** + * The value of the shared access signature to be used in authentication + */ + get signature() { + return this._signature; + } + /** + * Create an instance of an AzureSASCredential for use + * with a service client. + * + * @param signature - The initial value of the shared access signature to use in authentication + */ + constructor(signature) { + if (!signature) { + throw new Error("shared access signature must be a non-empty string"); + } + this._signature = signature; + } + /** + * Change the value of the signature. + * + * Updates will take effect upon the next request after + * updating the signature value. + * + * @param newSignature - The new shared access signature value to be used + */ + update(newSignature) { + if (!newSignature) { + throw new Error("shared access signature must be a non-empty string"); + } + this._signature = newSignature; + } +} +exports.AzureSASCredential = AzureSASCredential; +/** + * Tests an object to determine whether it implements SASCredential. + * + * @param credential - The assumed SASCredential to be tested. + */ +function isSASCredential(credential) { + return ((0, core_util_1.isObjectWithProperties)(credential, ["signature"]) && typeof credential.signature === "string"); +} +exports.isSASCredential = isSASCredential; +//# sourceMappingURL=azureSASCredential.js.map - XMLStringifier.prototype.xmlStandalone = function(val) { - if (this.options.noValidation) { - return val; - } - if (val) { - return "yes"; - } else { - return "no"; - } - }; +/***/ }), - XMLStringifier.prototype.dtdPubID = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +/***/ 8834: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLStringifier.prototype.dtdSysID = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +"use strict"; - XMLStringifier.prototype.dtdElementValue = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isTokenCredential = exports.isSASCredential = exports.AzureSASCredential = exports.isNamedKeyCredential = exports.AzureNamedKeyCredential = exports.isKeyCredential = exports.AzureKeyCredential = void 0; +var azureKeyCredential_js_1 = __nccwpck_require__(1875); +Object.defineProperty(exports, "AzureKeyCredential", ({ enumerable: true, get: function () { return azureKeyCredential_js_1.AzureKeyCredential; } })); +var keyCredential_js_1 = __nccwpck_require__(9122); +Object.defineProperty(exports, "isKeyCredential", ({ enumerable: true, get: function () { return keyCredential_js_1.isKeyCredential; } })); +var azureNamedKeyCredential_js_1 = __nccwpck_require__(1377); +Object.defineProperty(exports, "AzureNamedKeyCredential", ({ enumerable: true, get: function () { return azureNamedKeyCredential_js_1.AzureNamedKeyCredential; } })); +Object.defineProperty(exports, "isNamedKeyCredential", ({ enumerable: true, get: function () { return azureNamedKeyCredential_js_1.isNamedKeyCredential; } })); +var azureSASCredential_js_1 = __nccwpck_require__(7182); +Object.defineProperty(exports, "AzureSASCredential", ({ enumerable: true, get: function () { return azureSASCredential_js_1.AzureSASCredential; } })); +Object.defineProperty(exports, "isSASCredential", ({ enumerable: true, get: function () { return azureSASCredential_js_1.isSASCredential; } })); +var tokenCredential_js_1 = __nccwpck_require__(9162); +Object.defineProperty(exports, "isTokenCredential", ({ enumerable: true, get: function () { return tokenCredential_js_1.isTokenCredential; } })); +//# sourceMappingURL=index.js.map - XMLStringifier.prototype.dtdAttType = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +/***/ }), - XMLStringifier.prototype.dtdAttDefault = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +/***/ 9122: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLStringifier.prototype.dtdEntityValue = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +"use strict"; - XMLStringifier.prototype.dtdNData = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isKeyCredential = void 0; +const core_util_1 = __nccwpck_require__(637); +/** + * Tests an object to determine whether it implements KeyCredential. + * + * @param credential - The assumed KeyCredential to be tested. + */ +function isKeyCredential(credential) { + return (0, core_util_1.isObjectWithProperties)(credential, ["key"]) && typeof credential.key === "string"; +} +exports.isKeyCredential = isKeyCredential; +//# sourceMappingURL=keyCredential.js.map - XMLStringifier.prototype.convertAttKey = '@'; +/***/ }), - XMLStringifier.prototype.convertPIKey = '?'; +/***/ 9162: +/***/ ((__unused_webpack_module, exports) => { - XMLStringifier.prototype.convertTextKey = '#text'; +"use strict"; - XMLStringifier.prototype.convertCDataKey = '#cdata'; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isTokenCredential = void 0; +/** + * Tests an object to determine whether it implements TokenCredential. + * + * @param credential - The assumed TokenCredential to be tested. + */ +function isTokenCredential(credential) { + // Check for an object with a 'getToken' function and possibly with + // a 'signRequest' function. We do this check to make sure that + // a ServiceClientCredentials implementor (like TokenClientCredentials + // in ms-rest-nodeauth) doesn't get mistaken for a TokenCredential if + // it doesn't actually implement TokenCredential also. + const castCredential = credential; + return (castCredential && + typeof castCredential.getToken === "function" && + (castCredential.signRequest === undefined || castCredential.getToken.length > 0)); +} +exports.isTokenCredential = isTokenCredential; +//# sourceMappingURL=tokenCredential.js.map - XMLStringifier.prototype.convertCommentKey = '#comment'; +/***/ }), - XMLStringifier.prototype.convertRawKey = '#raw'; +/***/ 7759: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLStringifier.prototype.assertLegalChar = function(str) { - var regex, res; - if (this.options.noValidation) { - return str; - } - regex = ''; - if (this.options.version === '1.0') { - regex = /[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; - if (res = str.match(regex)) { - throw new Error("Invalid character in string: " + str + " at index " + res.index); +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.pollHttpOperation = exports.isOperationError = exports.getResourceLocation = exports.getOperationStatus = exports.getOperationLocation = exports.initHttpOperation = exports.getStatusFromInitialResponse = exports.getErrorFromResponse = exports.parseRetryAfter = exports.inferLroMode = void 0; +const operation_js_1 = __nccwpck_require__(281); +const logger_js_1 = __nccwpck_require__(8121); +function getOperationLocationPollingUrl(inputs) { + const { azureAsyncOperation, operationLocation } = inputs; + return operationLocation ?? azureAsyncOperation; +} +function getLocationHeader(rawResponse) { + return rawResponse.headers["location"]; +} +function getOperationLocationHeader(rawResponse) { + return rawResponse.headers["operation-location"]; +} +function getAzureAsyncOperationHeader(rawResponse) { + return rawResponse.headers["azure-asyncoperation"]; +} +function findResourceLocation(inputs) { + const { location, requestMethod, requestPath, resourceLocationConfig } = inputs; + switch (requestMethod) { + case "PUT": { + return requestPath; } - } else if (this.options.version === '1.1') { - regex = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; - if (res = str.match(regex)) { - throw new Error("Invalid character in string: " + str + " at index " + res.index); + case "DELETE": { + return undefined; } - } - return str; - }; + case "PATCH": { + return getDefault() ?? requestPath; + } + default: { + return getDefault(); + } + } + function getDefault() { + switch (resourceLocationConfig) { + case "azure-async-operation": { + return undefined; + } + case "original-uri": { + return requestPath; + } + case "location": + default: { + return location; + } + } + } +} +function inferLroMode(inputs) { + const { rawResponse, requestMethod, requestPath, resourceLocationConfig } = inputs; + const operationLocation = getOperationLocationHeader(rawResponse); + const azureAsyncOperation = getAzureAsyncOperationHeader(rawResponse); + const pollingUrl = getOperationLocationPollingUrl({ operationLocation, azureAsyncOperation }); + const location = getLocationHeader(rawResponse); + const normalizedRequestMethod = requestMethod?.toLocaleUpperCase(); + if (pollingUrl !== undefined) { + return { + mode: "OperationLocation", + operationLocation: pollingUrl, + resourceLocation: findResourceLocation({ + requestMethod: normalizedRequestMethod, + location, + requestPath, + resourceLocationConfig, + }), + }; + } + else if (location !== undefined) { + return { + mode: "ResourceLocation", + operationLocation: location, + }; + } + else if (normalizedRequestMethod === "PUT" && requestPath) { + return { + mode: "Body", + operationLocation: requestPath, + }; + } + else { + return undefined; + } +} +exports.inferLroMode = inferLroMode; +function transformStatus(inputs) { + const { status, statusCode } = inputs; + if (typeof status !== "string" && status !== undefined) { + throw new Error(`Polling was unsuccessful. Expected status to have a string value or no value but it has instead: ${status}. This doesn't necessarily indicate the operation has failed. Check your Azure subscription or resource status for more information.`); + } + switch (status?.toLocaleLowerCase()) { + case undefined: + return toOperationStatus(statusCode); + case "succeeded": + return "succeeded"; + case "failed": + return "failed"; + case "running": + case "accepted": + case "started": + case "canceling": + case "cancelling": + return "running"; + case "canceled": + case "cancelled": + return "canceled"; + default: { + logger_js_1.logger.verbose(`LRO: unrecognized operation status: ${status}`); + return status; + } + } +} +function getStatus(rawResponse) { + const { status } = rawResponse.body ?? {}; + return transformStatus({ status, statusCode: rawResponse.statusCode }); +} +function getProvisioningState(rawResponse) { + const { properties, provisioningState } = rawResponse.body ?? {}; + const status = properties?.provisioningState ?? provisioningState; + return transformStatus({ status, statusCode: rawResponse.statusCode }); +} +function toOperationStatus(statusCode) { + if (statusCode === 202) { + return "running"; + } + else if (statusCode < 300) { + return "succeeded"; + } + else { + return "failed"; + } +} +function parseRetryAfter({ rawResponse }) { + const retryAfter = rawResponse.headers["retry-after"]; + if (retryAfter !== undefined) { + // Retry-After header value is either in HTTP date format, or in seconds + const retryAfterInSeconds = parseInt(retryAfter); + return isNaN(retryAfterInSeconds) + ? calculatePollingIntervalFromDate(new Date(retryAfter)) + : retryAfterInSeconds * 1000; + } + return undefined; +} +exports.parseRetryAfter = parseRetryAfter; +function getErrorFromResponse(response) { + const error = accessBodyProperty(response, "error"); + if (!error) { + logger_js_1.logger.warning(`The long-running operation failed but there is no error property in the response's body`); + return; + } + if (!error.code || !error.message) { + logger_js_1.logger.warning(`The long-running operation failed but the error property in the response's body doesn't contain code or message`); + return; + } + return error; +} +exports.getErrorFromResponse = getErrorFromResponse; +function calculatePollingIntervalFromDate(retryAfterDate) { + const timeNow = Math.floor(new Date().getTime()); + const retryAfterTime = retryAfterDate.getTime(); + if (timeNow < retryAfterTime) { + return retryAfterTime - timeNow; + } + return undefined; +} +function getStatusFromInitialResponse(inputs) { + const { response, state, operationLocation } = inputs; + function helper() { + const mode = state.config.metadata?.["mode"]; + switch (mode) { + case undefined: + return toOperationStatus(response.rawResponse.statusCode); + case "Body": + return getOperationStatus(response, state); + default: + return "running"; + } + } + const status = helper(); + return status === "running" && operationLocation === undefined ? "succeeded" : status; +} +exports.getStatusFromInitialResponse = getStatusFromInitialResponse; +/** + * Initiates the long-running operation. + */ +async function initHttpOperation(inputs) { + const { stateProxy, resourceLocationConfig, processResult, lro, setErrorAsResult } = inputs; + return (0, operation_js_1.initOperation)({ + init: async () => { + const response = await lro.sendInitialRequest(); + const config = inferLroMode({ + rawResponse: response.rawResponse, + requestPath: lro.requestPath, + requestMethod: lro.requestMethod, + resourceLocationConfig, + }); + return { + response, + operationLocation: config?.operationLocation, + resourceLocation: config?.resourceLocation, + ...(config?.mode ? { metadata: { mode: config.mode } } : {}), + }; + }, + stateProxy, + processResult: processResult + ? ({ flatResponse }, state) => processResult(flatResponse, state) + : ({ flatResponse }) => flatResponse, + getOperationStatus: getStatusFromInitialResponse, + setErrorAsResult, + }); +} +exports.initHttpOperation = initHttpOperation; +function getOperationLocation({ rawResponse }, state) { + const mode = state.config.metadata?.["mode"]; + switch (mode) { + case "OperationLocation": { + return getOperationLocationPollingUrl({ + operationLocation: getOperationLocationHeader(rawResponse), + azureAsyncOperation: getAzureAsyncOperationHeader(rawResponse), + }); + } + case "ResourceLocation": { + return getLocationHeader(rawResponse); + } + case "Body": + default: { + return undefined; + } + } +} +exports.getOperationLocation = getOperationLocation; +function getOperationStatus({ rawResponse }, state) { + const mode = state.config.metadata?.["mode"]; + switch (mode) { + case "OperationLocation": { + return getStatus(rawResponse); + } + case "ResourceLocation": { + return toOperationStatus(rawResponse.statusCode); + } + case "Body": { + return getProvisioningState(rawResponse); + } + default: + throw new Error(`Internal error: Unexpected operation mode: ${mode}`); + } +} +exports.getOperationStatus = getOperationStatus; +function accessBodyProperty({ flatResponse, rawResponse }, prop) { + return flatResponse?.[prop] ?? rawResponse.body?.[prop]; +} +function getResourceLocation(res, state) { + const loc = accessBodyProperty(res, "resourceLocation"); + if (loc && typeof loc === "string") { + state.config.resourceLocation = loc; + } + return state.config.resourceLocation; +} +exports.getResourceLocation = getResourceLocation; +function isOperationError(e) { + return e.name === "RestError"; +} +exports.isOperationError = isOperationError; +/** Polls the long-running operation. */ +async function pollHttpOperation(inputs) { + const { lro, stateProxy, options, processResult, updateState, setDelay, state, setErrorAsResult, } = inputs; + return (0, operation_js_1.pollOperation)({ + state, + stateProxy, + setDelay, + processResult: processResult + ? ({ flatResponse }, inputState) => processResult(flatResponse, inputState) + : ({ flatResponse }) => flatResponse, + getError: getErrorFromResponse, + updateState, + getPollingInterval: parseRetryAfter, + getOperationLocation, + getOperationStatus, + isOperationError, + getResourceLocation, + options, + /** + * The expansion here is intentional because `lro` could be an object that + * references an inner this, so we need to preserve a reference to it. + */ + poll: async (location, inputOptions) => lro.sendPollRequest(location, inputOptions), + setErrorAsResult, + }); +} +exports.pollHttpOperation = pollHttpOperation; +//# sourceMappingURL=operation.js.map - XMLStringifier.prototype.assertLegalName = function(str) { - var regex; - if (this.options.noValidation) { - return str; - } - this.assertLegalChar(str); - regex = /^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/; - if (!str.match(regex)) { - throw new Error("Invalid character in name"); - } - return str; - }; +/***/ }), - XMLStringifier.prototype.textEscape = function(str) { - var ampregex; - if (this.options.noValidation) { - return str; - } - ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g; - return str.replace(ampregex, '&').replace(//g, '>').replace(/\r/g, ' '); - }; +/***/ 8412: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLStringifier.prototype.attEscape = function(str) { - var ampregex; - if (this.options.noValidation) { - return str; - } - ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g; - return str.replace(ampregex, '&').replace(/ { + const response = await lro.sendInitialRequest(); + const config = (0, operation_js_1.inferLroMode)({ + rawResponse: response.rawResponse, + requestPath: lro.requestPath, + requestMethod: lro.requestMethod, + resourceLocationConfig, + }); + return { + response, + operationLocation: config?.operationLocation, + resourceLocation: config?.resourceLocation, + ...(config?.mode ? { metadata: { mode: config.mode } } : {}), + }; + }, + poll: lro.sendPollRequest, + }, { + intervalInMs, + withOperationLocation, + restoreFrom, + updateState, + processResult: processResult + ? ({ flatResponse }, state) => processResult(flatResponse, state) + : ({ flatResponse }) => flatResponse, + }); +} +exports.createHttpPoller = createHttpPoller; +//# sourceMappingURL=poller.js.map - })(); +/***/ }), -}).call(this); +/***/ 334: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createHttpPoller = void 0; +const tslib_1 = __nccwpck_require__(4351); +var poller_js_1 = __nccwpck_require__(8412); +Object.defineProperty(exports, "createHttpPoller", ({ enumerable: true, get: function () { return poller_js_1.createHttpPoller; } })); +/** + * This can be uncommented to expose the protocol-agnostic poller + */ +// export { +// BuildCreatePollerOptions, +// Operation, +// CreatePollerOptions, +// OperationConfig, +// RestorableOperationState, +// } from "./poller/models"; +// export { buildCreatePoller } from "./poller/poller"; +/** legacy */ +tslib_1.__exportStar(__nccwpck_require__(2260), exports); +tslib_1.__exportStar(__nccwpck_require__(7270), exports); +tslib_1.__exportStar(__nccwpck_require__(3586), exports); +//# sourceMappingURL=index.js.map /***/ }), -/***/ 1318: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { +/***/ 2260: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLCharacterData, XMLText, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; +"use strict"; - NodeType = __nccwpck_require__(9267); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.LroEngine = void 0; +var lroEngine_js_1 = __nccwpck_require__(5780); +Object.defineProperty(exports, "LroEngine", ({ enumerable: true, get: function () { return lroEngine_js_1.LroEngine; } })); +//# sourceMappingURL=index.js.map - XMLCharacterData = __nccwpck_require__(7709); +/***/ }), - module.exports = XMLText = (function(superClass) { - extend(XMLText, superClass); +/***/ 5780: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - function XMLText(parent, text) { - XMLText.__super__.constructor.call(this, parent); - if (text == null) { - throw new Error("Missing element text. " + this.debugInfo()); - } - this.name = "#text"; - this.type = NodeType.Text; - this.value = this.stringify.text(text); +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.LroEngine = void 0; +const operation_js_1 = __nccwpck_require__(7954); +const constants_js_1 = __nccwpck_require__(3846); +const poller_js_1 = __nccwpck_require__(7270); +const operation_js_2 = __nccwpck_require__(281); +/** + * The LRO Engine, a class that performs polling. + */ +class LroEngine extends poller_js_1.Poller { + config; + constructor(lro, options) { + const { intervalInMs = constants_js_1.POLL_INTERVAL_IN_MS, resumeFrom, resolveOnUnsuccessful = false, isDone, lroResourceLocationConfig, processResult, updateState, } = options || {}; + const state = resumeFrom + ? (0, operation_js_2.deserializeState)(resumeFrom) + : {}; + const operation = new operation_js_1.GenericPollOperation(state, lro, !resolveOnUnsuccessful, lroResourceLocationConfig, processResult, updateState, isDone); + super(operation); + this.resolveOnUnsuccessful = resolveOnUnsuccessful; + this.config = { intervalInMs: intervalInMs }; + operation.setPollerConfig(this.config); + } + /** + * The method used by the poller to wait before attempting to update its operation. + */ + delay() { + return new Promise((resolve) => setTimeout(() => resolve(), this.config.intervalInMs)); } +} +exports.LroEngine = LroEngine; +//# sourceMappingURL=lroEngine.js.map - Object.defineProperty(XMLText.prototype, 'isElementContentWhitespace', { - get: function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - } - }); +/***/ }), - Object.defineProperty(XMLText.prototype, 'wholeText', { - get: function() { - var next, prev, str; - str = ''; - prev = this.previousSibling; - while (prev) { - str = prev.data + str; - prev = prev.previousSibling; +/***/ 7954: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.GenericPollOperation = void 0; +const operation_js_1 = __nccwpck_require__(7759); +const logger_js_1 = __nccwpck_require__(8121); +const createStateProxy = () => ({ + initState: (config) => ({ config, isStarted: true }), + setCanceled: (state) => (state.isCancelled = true), + setError: (state, error) => (state.error = error), + setResult: (state, result) => (state.result = result), + setRunning: (state) => (state.isStarted = true), + setSucceeded: (state) => (state.isCompleted = true), + setFailed: () => { + /** empty body */ + }, + getError: (state) => state.error, + getResult: (state) => state.result, + isCanceled: (state) => !!state.isCancelled, + isFailed: (state) => !!state.error, + isRunning: (state) => !!state.isStarted, + isSucceeded: (state) => Boolean(state.isCompleted && !state.isCancelled && !state.error), +}); +class GenericPollOperation { + state; + lro; + setErrorAsResult; + lroResourceLocationConfig; + processResult; + updateState; + isDone; + pollerConfig; + constructor(state, lro, setErrorAsResult, lroResourceLocationConfig, processResult, updateState, isDone) { + this.state = state; + this.lro = lro; + this.setErrorAsResult = setErrorAsResult; + this.lroResourceLocationConfig = lroResourceLocationConfig; + this.processResult = processResult; + this.updateState = updateState; + this.isDone = isDone; + } + setPollerConfig(pollerConfig) { + this.pollerConfig = pollerConfig; + } + async update(options) { + const stateProxy = createStateProxy(); + if (!this.state.isStarted) { + this.state = { + ...this.state, + ...(await (0, operation_js_1.initHttpOperation)({ + lro: this.lro, + stateProxy, + resourceLocationConfig: this.lroResourceLocationConfig, + processResult: this.processResult, + setErrorAsResult: this.setErrorAsResult, + })), + }; } - str += this.data; - next = this.nextSibling; - while (next) { - str = str + next.data; - next = next.nextSibling; + const updateState = this.updateState; + const isDone = this.isDone; + if (!this.state.isCompleted && this.state.error === undefined) { + await (0, operation_js_1.pollHttpOperation)({ + lro: this.lro, + state: this.state, + stateProxy, + processResult: this.processResult, + updateState: updateState + ? (state, { rawResponse }) => updateState(state, rawResponse) + : undefined, + isDone: isDone + ? ({ flatResponse }, state) => isDone(flatResponse, state) + : undefined, + options, + setDelay: (intervalInMs) => { + this.pollerConfig.intervalInMs = intervalInMs; + }, + setErrorAsResult: this.setErrorAsResult, + }); } - return str; - } - }); + options?.fireProgress?.(this.state); + return this; + } + async cancel() { + logger_js_1.logger.error("`cancelOperation` is deprecated because it wasn't implemented"); + return this; + } + /** + * Serializes the Poller operation. + */ + toString() { + return JSON.stringify({ + state: this.state, + }); + } +} +exports.GenericPollOperation = GenericPollOperation; +//# sourceMappingURL=operation.js.map - XMLText.prototype.clone = function() { - return Object.create(this); - }; +/***/ }), - XMLText.prototype.toString = function(options) { - return this.options.writer.text(this, this.options.writer.filterOptions(options)); - }; +/***/ 3586: +/***/ ((__unused_webpack_module, exports) => { - XMLText.prototype.splitText = function(offset) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +"use strict"; - XMLText.prototype.replaceWholeText = function(content) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=pollOperation.js.map - return XMLText; +/***/ }), - })(XMLCharacterData); +/***/ 7270: +/***/ ((__unused_webpack_module, exports) => { -}).call(this); +"use strict"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Poller = exports.PollerCancelledError = exports.PollerStoppedError = void 0; +/** + * When a poller is manually stopped through the `stopPolling` method, + * the poller will be rejected with an instance of the PollerStoppedError. + */ +class PollerStoppedError extends Error { + constructor(message) { + super(message); + this.name = "PollerStoppedError"; + Object.setPrototypeOf(this, PollerStoppedError.prototype); + } +} +exports.PollerStoppedError = PollerStoppedError; +/** + * When the operation is cancelled, the poller will be rejected with an instance + * of the PollerCancelledError. + */ +class PollerCancelledError extends Error { + constructor(message) { + super(message); + this.name = "PollerCancelledError"; + Object.setPrototypeOf(this, PollerCancelledError.prototype); + } +} +exports.PollerCancelledError = PollerCancelledError; +/** + * A class that represents the definition of a program that polls through consecutive requests + * until it reaches a state of completion. + * + * A poller can be executed manually, by polling request by request by calling to the `poll()` method repeatedly, until its operation is completed. + * It also provides a way to wait until the operation completes, by calling `pollUntilDone()` and waiting until the operation finishes. + * Pollers can also request the cancellation of the ongoing process to whom is providing the underlying long running operation. + * + * ```ts + * const poller = new MyPoller(); + * + * // Polling just once: + * await poller.poll(); + * + * // We can try to cancel the request here, by calling: + * // + * // await poller.cancelOperation(); + * // + * + * // Getting the final result: + * const result = await poller.pollUntilDone(); + * ``` + * + * The Poller is defined by two types, a type representing the state of the poller, which + * must include a basic set of properties from `PollOperationState`, + * and a return type defined by `TResult`, which can be anything. + * + * The Poller class implements the `PollerLike` interface, which allows poller implementations to avoid having + * to export the Poller's class directly, and instead only export the already instantiated poller with the PollerLike type. + * + * ```ts + * class Client { + * public async makePoller: PollerLike { + * const poller = new MyPoller({}); + * // It might be preferred to return the poller after the first request is made, + * // so that some information can be obtained right away. + * await poller.poll(); + * return poller; + * } + * } + * + * const poller: PollerLike = myClient.makePoller(); + * ``` + * + * A poller can be created through its constructor, then it can be polled until it's completed. + * At any point in time, the state of the poller can be obtained without delay through the getOperationState method. + * At any point in time, the intermediate forms of the result type can be requested without delay. + * Once the underlying operation is marked as completed, the poller will stop and the final value will be returned. + * + * ```ts + * const poller = myClient.makePoller(); + * const state: MyOperationState = poller.getOperationState(); + * + * // The intermediate result can be obtained at any time. + * const result: MyResult | undefined = poller.getResult(); + * + * // The final result can only be obtained after the poller finishes. + * const result: MyResult = await poller.pollUntilDone(); + * ``` + * + */ +// eslint-disable-next-line no-use-before-define +class Poller { + /** controls whether to throw an error if the operation failed or was canceled. */ + resolveOnUnsuccessful = false; + stopped = true; + resolve; + reject; + pollOncePromise; + cancelPromise; + promise; + pollProgressCallbacks = []; + /** + * The poller's operation is available in full to any of the methods of the Poller class + * and any class extending the Poller class. + */ + operation; + /** + * A poller needs to be initialized by passing in at least the basic properties of the `PollOperation`. + * + * When writing an implementation of a Poller, this implementation needs to deal with the initialization + * of any custom state beyond the basic definition of the poller. The basic poller assumes that the poller's + * operation has already been defined, at least its basic properties. The code below shows how to approach + * the definition of the constructor of a new custom poller. + * + * ```ts + * export class MyPoller extends Poller { + * constructor({ + * // Anything you might need outside of the basics + * }) { + * let state: MyOperationState = { + * privateProperty: private, + * publicProperty: public, + * }; + * + * const operation = { + * state, + * update, + * cancel, + * toString + * } + * + * // Sending the operation to the parent's constructor. + * super(operation); + * + * // You can assign more local properties here. + * } + * } + * ``` + * + * Inside of this constructor, a new promise is created. This will be used to + * tell the user when the poller finishes (see `pollUntilDone()`). The promise's + * resolve and reject methods are also used internally to control when to resolve + * or reject anyone waiting for the poller to finish. + * + * The constructor of a custom implementation of a poller is where any serialized version of + * a previous poller's operation should be deserialized into the operation sent to the + * base constructor. For example: + * + * ```ts + * export class MyPoller extends Poller { + * constructor( + * baseOperation: string | undefined + * ) { + * let state: MyOperationState = {}; + * if (baseOperation) { + * state = { + * ...JSON.parse(baseOperation).state, + * ...state + * }; + * } + * const operation = { + * state, + * // ... + * } + * super(operation); + * } + * } + * ``` + * + * @param operation - Must contain the basic properties of `PollOperation`. + */ + constructor(operation) { + this.operation = operation; + this.promise = new Promise((resolve, reject) => { + this.resolve = resolve; + this.reject = reject; + }); + // This prevents the UnhandledPromiseRejectionWarning in node.js from being thrown. + // The above warning would get thrown if `poller.poll` is called, it returns an error, + // and pullUntilDone did not have a .catch or await try/catch on it's return value. + this.promise.catch(() => { + /* intentionally blank */ + }); + } + /** + * Starts a loop that will break only if the poller is done + * or if the poller is stopped. + */ + async startPolling(pollOptions = {}) { + if (this.stopped) { + this.stopped = false; + } + while (!this.isStopped() && !this.isDone()) { + await this.poll(pollOptions); + await this.delay(); + } + } + /** + * pollOnce does one polling, by calling to the update method of the underlying + * poll operation to make any relevant change effective. + * + * It only optionally receives an object with an abortSignal property, from \@azure/abort-controller's AbortSignalLike. + * + * @param options - Optional properties passed to the operation's update method. + */ + async pollOnce(options = {}) { + if (!this.isDone()) { + this.operation = await this.operation.update({ + abortSignal: options.abortSignal, + fireProgress: this.fireProgress.bind(this), + }); + } + this.processUpdatedState(); + } + /** + * fireProgress calls the functions passed in via onProgress the method of the poller. + * + * It loops over all of the callbacks received from onProgress, and executes them, sending them + * the current operation state. + * + * @param state - The current operation state. + */ + fireProgress(state) { + for (const callback of this.pollProgressCallbacks) { + callback(state); + } + } + /** + * Invokes the underlying operation's cancel method. + */ + async cancelOnce(options = {}) { + this.operation = await this.operation.cancel(options); + } + /** + * Returns a promise that will resolve once a single polling request finishes. + * It does this by calling the update method of the Poller's operation. + * + * It only optionally receives an object with an abortSignal property, from \@azure/abort-controller's AbortSignalLike. + * + * @param options - Optional properties passed to the operation's update method. + */ + poll(options = {}) { + if (!this.pollOncePromise) { + this.pollOncePromise = this.pollOnce(options); + const clearPollOncePromise = () => { + this.pollOncePromise = undefined; + }; + this.pollOncePromise.then(clearPollOncePromise, clearPollOncePromise).catch(this.reject); + } + return this.pollOncePromise; + } + processUpdatedState() { + if (this.operation.state.error) { + this.stopped = true; + if (!this.resolveOnUnsuccessful) { + this.reject(this.operation.state.error); + throw this.operation.state.error; + } + } + if (this.operation.state.isCancelled) { + this.stopped = true; + if (!this.resolveOnUnsuccessful) { + const error = new PollerCancelledError("Operation was canceled"); + this.reject(error); + throw error; + } + } + if (this.isDone() && this.resolve) { + // If the poller has finished polling, this means we now have a result. + // However, it can be the case that TResult is instantiated to void, so + // we are not expecting a result anyway. To assert that we might not + // have a result eventually after finishing polling, we cast the result + // to TResult. + this.resolve(this.getResult()); + } + } + /** + * Returns a promise that will resolve once the underlying operation is completed. + */ + async pollUntilDone(pollOptions = {}) { + if (this.stopped) { + this.startPolling(pollOptions).catch(this.reject); + } + // This is needed because the state could have been updated by + // `cancelOperation`, e.g. the operation is canceled or an error occurred. + this.processUpdatedState(); + return this.promise; + } + /** + * Invokes the provided callback after each polling is completed, + * sending the current state of the poller's operation. + * + * It returns a method that can be used to stop receiving updates on the given callback function. + */ + onProgress(callback) { + this.pollProgressCallbacks.push(callback); + return () => { + this.pollProgressCallbacks = this.pollProgressCallbacks.filter((c) => c !== callback); + }; + } + /** + * Returns true if the poller has finished polling. + */ + isDone() { + const state = this.operation.state; + return Boolean(state.isCompleted || state.isCancelled || state.error); + } + /** + * Stops the poller from continuing to poll. + */ + stopPolling() { + if (!this.stopped) { + this.stopped = true; + if (this.reject) { + this.reject(new PollerStoppedError("This poller is already stopped")); + } + } + } + /** + * Returns true if the poller is stopped. + */ + isStopped() { + return this.stopped; + } + /** + * Attempts to cancel the underlying operation. + * + * It only optionally receives an object with an abortSignal property, from \@azure/abort-controller's AbortSignalLike. + * + * If it's called again before it finishes, it will throw an error. + * + * @param options - Optional properties passed to the operation's update method. + */ + cancelOperation(options = {}) { + if (!this.cancelPromise) { + this.cancelPromise = this.cancelOnce(options); + } + else if (options.abortSignal) { + throw new Error("A cancel request is currently pending"); + } + return this.cancelPromise; + } + /** + * Returns the state of the operation. + * + * Even though TState will be the same type inside any of the methods of any extension of the Poller class, + * implementations of the pollers can customize what's shared with the public by writing their own + * version of the `getOperationState` method, and by defining two types, one representing the internal state of the poller + * and a public type representing a safe to share subset of the properties of the internal state. + * Their definition of getOperationState can then return their public type. + * + * Example: + * + * ```ts + * // Let's say we have our poller's operation state defined as: + * interface MyOperationState extends PollOperationState { + * privateProperty?: string; + * publicProperty?: string; + * } + * + * // To allow us to have a true separation of public and private state, we have to define another interface: + * interface PublicState extends PollOperationState { + * publicProperty?: string; + * } + * + * // Then, we define our Poller as follows: + * export class MyPoller extends Poller { + * // ... More content is needed here ... + * + * public getOperationState(): PublicState { + * const state: PublicState = this.operation.state; + * return { + * // Properties from PollOperationState + * isStarted: state.isStarted, + * isCompleted: state.isCompleted, + * isCancelled: state.isCancelled, + * error: state.error, + * result: state.result, + * + * // The only other property needed by PublicState. + * publicProperty: state.publicProperty + * } + * } + * } + * ``` + * + * You can see this in the tests of this repository, go to the file: + * `../test/utils/testPoller.ts` + * and look for the getOperationState implementation. + */ + getOperationState() { + return this.operation.state; + } + /** + * Returns the result value of the operation, + * regardless of the state of the poller. + * It can return undefined or an incomplete form of the final TResult value + * depending on the implementation. + */ + getResult() { + const state = this.operation.state; + return state.result; + } + /** + * Returns a serialized version of the poller's operation + * by invoking the operation's toString method. + */ + toString() { + return this.operation.toString(); + } +} +exports.Poller = Poller; +//# sourceMappingURL=poller.js.map /***/ }), -/***/ 6752: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, WriterState, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLText, XMLWriterBase, assign, - hasProp = {}.hasOwnProperty; - - assign = (__nccwpck_require__(8229).assign); - - NodeType = __nccwpck_require__(9267); - - XMLDeclaration = __nccwpck_require__(6364); - - XMLDocType = __nccwpck_require__(1801); - - XMLCData = __nccwpck_require__(333); - - XMLComment = __nccwpck_require__(4407); - - XMLElement = __nccwpck_require__(9437); +/***/ 8121: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLRaw = __nccwpck_require__(6329); +"use strict"; - XMLText = __nccwpck_require__(1318); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.logger = void 0; +const logger_1 = __nccwpck_require__(9497); +/** + * The `@azure/logger` configuration for this package. + * @internal + */ +exports.logger = (0, logger_1.createClientLogger)("core-lro"); +//# sourceMappingURL=logger.js.map - XMLProcessingInstruction = __nccwpck_require__(6939); +/***/ }), - XMLDummy = __nccwpck_require__(3590); +/***/ 3846: +/***/ ((__unused_webpack_module, exports) => { - XMLDTDAttList = __nccwpck_require__(1015); +"use strict"; - XMLDTDElement = __nccwpck_require__(2421); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.terminalStates = exports.POLL_INTERVAL_IN_MS = void 0; +/** + * The default time interval to wait before sending the next polling request. + */ +exports.POLL_INTERVAL_IN_MS = 2000; +/** + * The closed set of terminal states. + */ +exports.terminalStates = ["succeeded", "canceled", "failed"]; +//# sourceMappingURL=constants.js.map - XMLDTDEntity = __nccwpck_require__(53); +/***/ }), - XMLDTDNotation = __nccwpck_require__(2837); +/***/ 281: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - WriterState = __nccwpck_require__(9766); +"use strict"; - module.exports = XMLWriterBase = (function() { - function XMLWriterBase(options) { - var key, ref, value; - options || (options = {}); - this.options = options; - ref = options.writer || {}; - for (key in ref) { - if (!hasProp.call(ref, key)) continue; - value = ref[key]; - this["_" + key] = this[key]; - this[key] = value; - } +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.pollOperation = exports.initOperation = exports.deserializeState = void 0; +const logger_js_1 = __nccwpck_require__(8121); +const constants_js_1 = __nccwpck_require__(3846); +/** + * Deserializes the state + */ +function deserializeState(serializedState) { + try { + return JSON.parse(serializedState).state; } - - XMLWriterBase.prototype.filterOptions = function(options) { - var filteredOptions, ref, ref1, ref2, ref3, ref4, ref5, ref6; - options || (options = {}); - options = assign({}, this.options, options); - filteredOptions = { - writer: this - }; - filteredOptions.pretty = options.pretty || false; - filteredOptions.allowEmpty = options.allowEmpty || false; - filteredOptions.indent = (ref = options.indent) != null ? ref : ' '; - filteredOptions.newline = (ref1 = options.newline) != null ? ref1 : '\n'; - filteredOptions.offset = (ref2 = options.offset) != null ? ref2 : 0; - filteredOptions.dontPrettyTextNodes = (ref3 = (ref4 = options.dontPrettyTextNodes) != null ? ref4 : options.dontprettytextnodes) != null ? ref3 : 0; - filteredOptions.spaceBeforeSlash = (ref5 = (ref6 = options.spaceBeforeSlash) != null ? ref6 : options.spacebeforeslash) != null ? ref5 : ''; - if (filteredOptions.spaceBeforeSlash === true) { - filteredOptions.spaceBeforeSlash = ' '; - } - filteredOptions.suppressPrettyCount = 0; - filteredOptions.user = {}; - filteredOptions.state = WriterState.None; - return filteredOptions; - }; - - XMLWriterBase.prototype.indent = function(node, options, level) { - var indentLevel; - if (!options.pretty || options.suppressPrettyCount) { - return ''; - } else if (options.pretty) { - indentLevel = (level || 0) + options.offset + 1; - if (indentLevel > 0) { - return new Array(indentLevel).join(options.indent); + catch (e) { + throw new Error(`Unable to deserialize input state: ${serializedState}`); + } +} +exports.deserializeState = deserializeState; +function setStateError(inputs) { + const { state, stateProxy, isOperationError } = inputs; + return (error) => { + if (isOperationError(error)) { + stateProxy.setError(state, error); + stateProxy.setFailed(state); } - } - return ''; - }; - - XMLWriterBase.prototype.endline = function(node, options, level) { - if (!options.pretty || options.suppressPrettyCount) { - return ''; - } else { - return options.newline; - } - }; - - XMLWriterBase.prototype.attribute = function(att, options, level) { - var r; - this.openAttribute(att, options, level); - r = ' ' + att.name + '="' + att.value + '"'; - this.closeAttribute(att, options, level); - return r; - }; - - XMLWriterBase.prototype.cdata = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + '' + this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.comment = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + '' + this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.declaration = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + ''; - r += this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; + throw error; }; - - XMLWriterBase.prototype.docType = function(node, options, level) { - var child, i, len, r, ref; - level || (level = 0); - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level); - r += ' 0) { - r += ' ['; - r += this.endline(node, options, level); - options.state = WriterState.InsideTag; - ref = node.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - r += this.writeChildNode(child, options, level + 1); - } - options.state = WriterState.CloseTag; - r += ']'; - } - options.state = WriterState.CloseTag; - r += options.spaceBeforeSlash + '>'; - r += this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; +} +function appendReadableErrorMessage(currentMessage, innerMessage) { + let message = currentMessage; + if (message.slice(-1) !== ".") { + message = message + "."; + } + return message + " " + innerMessage; +} +function simplifyError(err) { + let message = err.message; + let code = err.code; + let curErr = err; + while (curErr.innererror) { + curErr = curErr.innererror; + code = curErr.code; + message = appendReadableErrorMessage(message, curErr.message); + } + return { + code, + message, }; - - XMLWriterBase.prototype.element = function(node, options, level) { - var att, child, childNodeCount, firstChildNode, i, j, len, len1, name, prettySuppressed, r, ref, ref1, ref2; - level || (level = 0); - prettySuppressed = false; - r = ''; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r += this.indent(node, options, level) + '<' + node.name; - ref = node.attribs; - for (name in ref) { - if (!hasProp.call(ref, name)) continue; - att = ref[name]; - r += this.attribute(att, options, level); - } - childNodeCount = node.children.length; - firstChildNode = childNodeCount === 0 ? null : node.children[0]; - if (childNodeCount === 0 || node.children.every(function(e) { - return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === ''; - })) { - if (options.allowEmpty) { - r += '>'; - options.state = WriterState.CloseTag; - r += '' + this.endline(node, options, level); - } else { - options.state = WriterState.CloseTag; - r += options.spaceBeforeSlash + '/>' + this.endline(node, options, level); +} +function processOperationStatus(result) { + const { state, stateProxy, status, isDone, processResult, getError, response, setErrorAsResult } = result; + switch (status) { + case "succeeded": { + stateProxy.setSucceeded(state); + break; } - } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) { - r += '>'; - options.state = WriterState.InsideTag; - options.suppressPrettyCount++; - prettySuppressed = true; - r += this.writeChildNode(firstChildNode, options, level + 1); - options.suppressPrettyCount--; - prettySuppressed = false; - options.state = WriterState.CloseTag; - r += '' + this.endline(node, options, level); - } else { - if (options.dontPrettyTextNodes) { - ref1 = node.children; - for (i = 0, len = ref1.length; i < len; i++) { - child = ref1[i]; - if ((child.type === NodeType.Text || child.type === NodeType.Raw) && (child.value != null)) { - options.suppressPrettyCount++; - prettySuppressed = true; - break; + case "failed": { + const err = getError?.(response); + let postfix = ""; + if (err) { + const { code, message } = simplifyError(err); + postfix = `. ${code}. ${message}`; } - } - } - r += '>' + this.endline(node, options, level); - options.state = WriterState.InsideTag; - ref2 = node.children; - for (j = 0, len1 = ref2.length; j < len1; j++) { - child = ref2[j]; - r += this.writeChildNode(child, options, level + 1); - } - options.state = WriterState.CloseTag; - r += this.indent(node, options, level) + ''; - if (prettySuppressed) { - options.suppressPrettyCount--; - } - r += this.endline(node, options, level); - options.state = WriterState.None; - } - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.writeChildNode = function(node, options, level) { - switch (node.type) { - case NodeType.CData: - return this.cdata(node, options, level); - case NodeType.Comment: - return this.comment(node, options, level); - case NodeType.Element: - return this.element(node, options, level); - case NodeType.Raw: - return this.raw(node, options, level); - case NodeType.Text: - return this.text(node, options, level); - case NodeType.ProcessingInstruction: - return this.processingInstruction(node, options, level); - case NodeType.Dummy: - return ''; - case NodeType.Declaration: - return this.declaration(node, options, level); - case NodeType.DocType: - return this.docType(node, options, level); - case NodeType.AttributeDeclaration: - return this.dtdAttList(node, options, level); - case NodeType.ElementDeclaration: - return this.dtdElement(node, options, level); - case NodeType.EntityDeclaration: - return this.dtdEntity(node, options, level); - case NodeType.NotationDeclaration: - return this.dtdNotation(node, options, level); - default: - throw new Error("Unknown XML node type: " + node.constructor.name); - } - }; - - XMLWriterBase.prototype.processingInstruction = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + ''; - r += this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.raw = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level); - options.state = WriterState.InsideTag; - r += node.value; - options.state = WriterState.CloseTag; - r += this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.text = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level); - options.state = WriterState.InsideTag; - r += node.value; - options.state = WriterState.CloseTag; - r += this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.dtdAttList = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + '' + this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.dtdElement = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + '' + this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.dtdEntity = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + '' + this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.dtdNotation = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + '' + this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; + } + if (isDone?.(response, state) || + (isDone === undefined && + ["succeeded", "canceled"].concat(setErrorAsResult ? [] : ["failed"]).includes(status))) { + stateProxy.setResult(state, buildResult({ + response, + state, + processResult, + })); + } +} +function buildResult(inputs) { + const { processResult, response, state } = inputs; + return processResult ? processResult(response, state) : response; +} +/** + * Initiates the long-running operation. + */ +async function initOperation(inputs) { + const { init, stateProxy, processResult, getOperationStatus, withOperationLocation, setErrorAsResult, } = inputs; + const { operationLocation, resourceLocation, metadata, response } = await init(); + if (operationLocation) + withOperationLocation?.(operationLocation, false); + const config = { + metadata, + operationLocation, + resourceLocation, }; - - XMLWriterBase.prototype.openNode = function(node, options, level) {}; - - XMLWriterBase.prototype.closeNode = function(node, options, level) {}; - - XMLWriterBase.prototype.openAttribute = function(att, options, level) {}; - - XMLWriterBase.prototype.closeAttribute = function(att, options, level) {}; - - return XMLWriterBase; - - })(); - -}).call(this); - + logger_js_1.logger.verbose(`LRO: Operation description:`, config); + const state = stateProxy.initState(config); + const status = getOperationStatus({ response, state, operationLocation }); + processOperationStatus({ state, status, stateProxy, response, setErrorAsResult, processResult }); + return state; +} +exports.initOperation = initOperation; +async function pollOperationHelper(inputs) { + const { poll, state, stateProxy, operationLocation, getOperationStatus, getResourceLocation, isOperationError, options, } = inputs; + const response = await poll(operationLocation, options).catch(setStateError({ + state, + stateProxy, + isOperationError, + })); + const status = getOperationStatus(response, state); + logger_js_1.logger.verbose(`LRO: Status:\n\tPolling from: ${state.config.operationLocation}\n\tOperation status: ${status}\n\tPolling status: ${constants_js_1.terminalStates.includes(status) ? "Stopped" : "Running"}`); + if (status === "succeeded") { + const resourceLocation = getResourceLocation(response, state); + if (resourceLocation !== undefined) { + return { + response: await poll(resourceLocation).catch(setStateError({ state, stateProxy, isOperationError })), + status, + }; + } + } + return { response, status }; +} +/** Polls the long-running operation. */ +async function pollOperation(inputs) { + const { poll, state, stateProxy, options, getOperationStatus, getResourceLocation, getOperationLocation, isOperationError, withOperationLocation, getPollingInterval, processResult, getError, updateState, setDelay, isDone, setErrorAsResult, } = inputs; + const { operationLocation } = state.config; + if (operationLocation !== undefined) { + const { response, status } = await pollOperationHelper({ + poll, + getOperationStatus, + state, + stateProxy, + operationLocation, + getResourceLocation, + isOperationError, + options, + }); + processOperationStatus({ + status, + response, + state, + stateProxy, + isDone, + processResult, + getError, + setErrorAsResult, + }); + if (!constants_js_1.terminalStates.includes(status)) { + const intervalInMs = getPollingInterval?.(response); + if (intervalInMs) + setDelay(intervalInMs); + const location = getOperationLocation?.(response, state); + if (location !== undefined) { + const isUpdated = operationLocation !== location; + state.config.operationLocation = location; + withOperationLocation?.(location, isUpdated); + } + else + withOperationLocation?.(operationLocation, false); + } + updateState?.(state, response); + } +} +exports.pollOperation = pollOperation; +//# sourceMappingURL=operation.js.map /***/ }), -/***/ 2958: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref; - - ref = __nccwpck_require__(8229), assign = ref.assign, isFunction = ref.isFunction; - - XMLDOMImplementation = __nccwpck_require__(8310); - - XMLDocument = __nccwpck_require__(3730); +/***/ 6713: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLDocumentCB = __nccwpck_require__(7356); +"use strict"; - XMLStringWriter = __nccwpck_require__(5913); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.buildCreatePoller = void 0; +const operation_js_1 = __nccwpck_require__(281); +const constants_js_1 = __nccwpck_require__(3846); +const core_util_1 = __nccwpck_require__(637); +const createStateProxy = () => ({ + /** + * The state at this point is created to be of type OperationState. + * It will be updated later to be of type TState when the + * customer-provided callback, `updateState`, is called during polling. + */ + initState: (config) => ({ status: "running", config }), + setCanceled: (state) => (state.status = "canceled"), + setError: (state, error) => (state.error = error), + setResult: (state, result) => (state.result = result), + setRunning: (state) => (state.status = "running"), + setSucceeded: (state) => (state.status = "succeeded"), + setFailed: (state) => (state.status = "failed"), + getError: (state) => state.error, + getResult: (state) => state.result, + isCanceled: (state) => state.status === "canceled", + isFailed: (state) => state.status === "failed", + isRunning: (state) => state.status === "running", + isSucceeded: (state) => state.status === "succeeded", +}); +/** + * Returns a poller factory. + */ +function buildCreatePoller(inputs) { + const { getOperationLocation, getStatusFromInitialResponse, getStatusFromPollResponse, isOperationError, getResourceLocation, getPollingInterval, getError, resolveOnUnsuccessful, } = inputs; + return async ({ init, poll }, options) => { + const { processResult, updateState, withOperationLocation: withOperationLocationCallback, intervalInMs = constants_js_1.POLL_INTERVAL_IN_MS, restoreFrom, } = options || {}; + const stateProxy = createStateProxy(); + const withOperationLocation = withOperationLocationCallback + ? (() => { + let called = false; + return (operationLocation, isUpdated) => { + if (isUpdated) + withOperationLocationCallback(operationLocation); + else if (!called) + withOperationLocationCallback(operationLocation); + called = true; + }; + })() + : undefined; + const state = restoreFrom + ? (0, operation_js_1.deserializeState)(restoreFrom) + : await (0, operation_js_1.initOperation)({ + init, + stateProxy, + processResult, + getOperationStatus: getStatusFromInitialResponse, + withOperationLocation, + setErrorAsResult: !resolveOnUnsuccessful, + }); + let resultPromise; + const abortController = new AbortController(); + const handlers = new Map(); + const handleProgressEvents = async () => handlers.forEach((h) => h(state)); + const cancelErrMsg = "Operation was canceled"; + let currentPollIntervalInMs = intervalInMs; + const poller = { + getOperationState: () => state, + getResult: () => state.result, + isDone: () => ["succeeded", "failed", "canceled"].includes(state.status), + isStopped: () => resultPromise === undefined, + stopPolling: () => { + abortController.abort(); + }, + toString: () => JSON.stringify({ + state, + }), + onProgress: (callback) => { + const s = Symbol(); + handlers.set(s, callback); + return () => handlers.delete(s); + }, + pollUntilDone: (pollOptions) => (resultPromise ??= (async () => { + const { abortSignal: inputAbortSignal } = pollOptions || {}; + // In the future we can use AbortSignal.any() instead + function abortListener() { + abortController.abort(); + } + const abortSignal = abortController.signal; + if (inputAbortSignal?.aborted) { + abortController.abort(); + } + else if (!abortSignal.aborted) { + inputAbortSignal?.addEventListener("abort", abortListener, { once: true }); + } + try { + if (!poller.isDone()) { + await poller.poll({ abortSignal }); + while (!poller.isDone()) { + await (0, core_util_1.delay)(currentPollIntervalInMs, { abortSignal }); + await poller.poll({ abortSignal }); + } + } + } + finally { + inputAbortSignal?.removeEventListener("abort", abortListener); + } + if (resolveOnUnsuccessful) { + return poller.getResult(); + } + else { + switch (state.status) { + case "succeeded": + return poller.getResult(); + case "canceled": + throw new Error(cancelErrMsg); + case "failed": + throw state.error; + case "notStarted": + case "running": + throw new Error(`Polling completed without succeeding or failing`); + } + } + })().finally(() => { + resultPromise = undefined; + })), + async poll(pollOptions) { + if (resolveOnUnsuccessful) { + if (poller.isDone()) + return; + } + else { + switch (state.status) { + case "succeeded": + return; + case "canceled": + throw new Error(cancelErrMsg); + case "failed": + throw state.error; + } + } + await (0, operation_js_1.pollOperation)({ + poll, + state, + stateProxy, + getOperationLocation, + isOperationError, + withOperationLocation, + getPollingInterval, + getOperationStatus: getStatusFromPollResponse, + getResourceLocation, + processResult, + getError, + updateState, + options: pollOptions, + setDelay: (pollIntervalInMs) => { + currentPollIntervalInMs = pollIntervalInMs; + }, + setErrorAsResult: !resolveOnUnsuccessful, + }); + await handleProgressEvents(); + if (!resolveOnUnsuccessful) { + switch (state.status) { + case "canceled": + throw new Error(cancelErrMsg); + case "failed": + throw state.error; + } + } + }, + }; + return poller; + }; +} +exports.buildCreatePoller = buildCreatePoller; +//# sourceMappingURL=poller.js.map - XMLStreamWriter = __nccwpck_require__(8601); +/***/ }), - NodeType = __nccwpck_require__(9267); +/***/ 5002: +/***/ ((__unused_webpack_module, exports) => { - WriterState = __nccwpck_require__(9766); +"use strict"; - module.exports.create = function(name, xmldec, doctype, options) { - var doc, root; - if (name == null) { - throw new Error("Root element needs a name."); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getPagedAsyncIterator = void 0; +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ +function getPagedAsyncIterator(pagedResult) { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: pagedResult?.byPage ?? + ((settings) => { + const { continuationToken, maxPageSize } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + maxPageSize, + }); + }), + }; +} +exports.getPagedAsyncIterator = getPagedAsyncIterator; +async function* getItemAsyncIterator(pagedResult) { + const pages = getPageAsyncIterator(pagedResult); + const firstVal = await pages.next(); + // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is + if (!Array.isArray(firstVal.value)) { + // can extract elements from this page + const { toElements } = pagedResult; + if (toElements) { + yield* toElements(firstVal.value); + for await (const page of pages) { + yield* toElements(page); + } + } + else { + yield firstVal.value; + // `pages` is of type `AsyncIterableIterator` but TPage = TElement in this case + yield* pages; + } } - options = assign({}, xmldec, doctype, options); - doc = new XMLDocument(options); - root = doc.element(name); - if (!options.headless) { - doc.declaration(options); - if ((options.pubID != null) || (options.sysID != null)) { - doc.dtd(options); - } + else { + yield* firstVal.value; + for await (const page of pages) { + // pages is of type `AsyncIterableIterator` so `page` is of type `TPage`. In this branch, + // it must be the case that `TPage = TElement[]` + yield* page; + } } - return root; - }; - - module.exports.begin = function(options, onData, onEnd) { - var ref1; - if (isFunction(options)) { - ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1]; - options = {}; +} +async function* getPageAsyncIterator(pagedResult, options = {}) { + const { pageLink, maxPageSize } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink, maxPageSize); + if (!response) { + return; } - if (onData) { - return new XMLDocumentCB(options, onData, onEnd); - } else { - return new XMLDocument(options); + yield response.page; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink, maxPageSize); + if (!response) { + return; + } + yield response.page; } - }; - - module.exports.stringWriter = function(options) { - return new XMLStringWriter(options); - }; - - module.exports.streamWriter = function(stream, options) { - return new XMLStreamWriter(stream, options); - }; - - module.exports.implementation = new XMLDOMImplementation(); - - module.exports.nodeType = NodeType; - - module.exports.writerState = WriterState; - -}).call(this); - - -/***/ }), - -/***/ 2877: -/***/ ((module) => { - -module.exports = eval("require")("encoding"); - +} +//# sourceMappingURL=getPagedAsyncIterator.js.map /***/ }), -/***/ 9491: -/***/ ((module) => { +/***/ 7947: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("assert"); - -/***/ }), - -/***/ 852: -/***/ ((module) => { -"use strict"; -module.exports = require("async_hooks"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __nccwpck_require__(4351); +tslib_1.__exportStar(__nccwpck_require__(2519), exports); +tslib_1.__exportStar(__nccwpck_require__(5002), exports); +//# sourceMappingURL=index.js.map /***/ }), -/***/ 4300: -/***/ ((module) => { +/***/ 2519: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("buffer"); - -/***/ }), -/***/ 2081: -/***/ ((module) => { - -"use strict"; -module.exports = require("child_process"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=models.js.map /***/ }), -/***/ 6206: -/***/ ((module) => { +/***/ 7205: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("console"); -/***/ }), - -/***/ 6113: -/***/ ((module) => { - -"use strict"; -module.exports = require("crypto"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.cancelablePromiseRace = void 0; +/** + * promise.race() wrapper that aborts rest of promises as soon as the first promise settles. + */ +async function cancelablePromiseRace(abortablePromiseBuilders, options) { + const aborter = new AbortController(); + function abortHandler() { + aborter.abort(); + } + options?.abortSignal?.addEventListener("abort", abortHandler); + try { + return await Promise.race(abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal }))); + } + finally { + aborter.abort(); + options?.abortSignal?.removeEventListener("abort", abortHandler); + } +} +exports.cancelablePromiseRace = cancelablePromiseRace; +//# sourceMappingURL=aborterUtils.js.map /***/ }), -/***/ 7643: -/***/ ((module) => { +/***/ 9972: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("diagnostics_channel"); - -/***/ }), -/***/ 2361: -/***/ ((module) => { - -"use strict"; -module.exports = require("events"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.stringToUint8Array = exports.uint8ArrayToString = void 0; +/** + * The helper that transforms bytes with specific character encoding into string + * @param bytes - the uint8array bytes + * @param format - the format we use to encode the byte + * @returns a string of the encoded string + */ +function uint8ArrayToString(bytes, format) { + return Buffer.from(bytes).toString(format); +} +exports.uint8ArrayToString = uint8ArrayToString; +/** + * The helper that transforms string to specific character encoded bytes array. + * @param value - the string to be converted + * @param format - the format we use to decode the value + * @returns a uint8array + */ +function stringToUint8Array(value, format) { + return Buffer.from(value, format); +} +exports.stringToUint8Array = stringToUint8Array; +//# sourceMappingURL=bytesEncoding.js.map /***/ }), -/***/ 7147: -/***/ ((module) => { +/***/ 7980: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("fs"); -/***/ }), - -/***/ 3292: -/***/ ((module) => { - -"use strict"; -module.exports = require("fs/promises"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isReactNative = exports.isNode = exports.isBun = exports.isDeno = exports.isWebWorker = exports.isBrowser = void 0; +/** + * A constant that indicates whether the environment the code is running is a Web Browser. + */ +// eslint-disable-next-line @azure/azure-sdk/ts-no-window +exports.isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; +/** + * A constant that indicates whether the environment the code is running is a Web Worker. + */ +exports.isWebWorker = typeof self === "object" && + typeof self?.importScripts === "function" && + (self.constructor?.name === "DedicatedWorkerGlobalScope" || + self.constructor?.name === "ServiceWorkerGlobalScope" || + self.constructor?.name === "SharedWorkerGlobalScope"); +/** + * A constant that indicates whether the environment the code is running is Deno. + */ +exports.isDeno = typeof Deno !== "undefined" && + typeof Deno.version !== "undefined" && + typeof Deno.version.deno !== "undefined"; +/** + * A constant that indicates whether the environment the code is running is Bun.sh. + */ +exports.isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; +/** + * A constant that indicates whether the environment the code is running is Node.JS. + */ +exports.isNode = typeof globalThis.process !== "undefined" && + Boolean(globalThis.process.version) && + Boolean(globalThis.process.versions?.node) && + // Deno thought it was a good idea to spoof process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions + !exports.isDeno && + !exports.isBun; +/** + * A constant that indicates whether the environment the code is running is in React-Native. + */ +// https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js +exports.isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; +//# sourceMappingURL=checkEnvironment.js.map /***/ }), -/***/ 3685: -/***/ ((module) => { +/***/ 2307: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("http"); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createAbortablePromise = void 0; +const abort_controller_1 = __nccwpck_require__(4812); +/** + * Creates an abortable promise. + * @param buildPromise - A function that takes the resolve and reject functions as parameters. + * @param options - The options for the abortable promise. + * @returns A promise that can be aborted. + */ +function createAbortablePromise(buildPromise, options) { + const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options ?? {}; + return new Promise((resolve, reject) => { + function rejectOnAbort() { + reject(new abort_controller_1.AbortError(abortErrorMsg ?? "The operation was aborted.")); + } + function removeListeners() { + abortSignal?.removeEventListener("abort", onAbort); + } + function onAbort() { + cleanupBeforeAbort?.(); + removeListeners(); + rejectOnAbort(); + } + if (abortSignal?.aborted) { + return rejectOnAbort(); + } + try { + buildPromise((x) => { + removeListeners(); + resolve(x); + }, (x) => { + removeListeners(); + reject(x); + }); + } + catch (err) { + reject(err); + } + abortSignal?.addEventListener("abort", onAbort); + }); +} +exports.createAbortablePromise = createAbortablePromise; +//# sourceMappingURL=createAbortablePromise.js.map /***/ }), -/***/ 5158: -/***/ ((module) => { +/***/ 9259: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("http2"); - -/***/ }), -/***/ 5687: -/***/ ((module) => { - -"use strict"; -module.exports = require("https"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.delay = void 0; +const createAbortablePromise_js_1 = __nccwpck_require__(2307); +const StandardAbortMessage = "The delay was aborted."; +/** + * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds. + * @param timeInMs - The number of milliseconds to be delayed. + * @param options - The options for delay - currently abort options + * @returns Promise that is resolved after timeInMs + */ +function delay(timeInMs, options) { + let token; + const { abortSignal, abortErrorMsg } = options ?? {}; + return (0, createAbortablePromise_js_1.createAbortablePromise)((resolve) => { + token = setTimeout(resolve, timeInMs); + }, { + cleanupBeforeAbort: () => clearTimeout(token), + abortSignal, + abortErrorMsg: abortErrorMsg ?? StandardAbortMessage, + }); +} +exports.delay = delay; +//# sourceMappingURL=delay.js.map /***/ }), -/***/ 1808: -/***/ ((module) => { +/***/ 6734: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("net"); - -/***/ }), - -/***/ 5673: -/***/ ((module) => { -"use strict"; -module.exports = require("node:events"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getErrorMessage = exports.isError = void 0; +const object_js_1 = __nccwpck_require__(6538); +/** + * Typeguard for an error object shape (has name and message) + * @param e - Something caught by a catch clause. + */ +function isError(e) { + if ((0, object_js_1.isObject)(e)) { + const hasName = typeof e.name === "string"; + const hasMessage = typeof e.message === "string"; + return hasName && hasMessage; + } + return false; +} +exports.isError = isError; +/** + * Given what is thought to be an error object, return the message if possible. + * If the message is missing, returns a stringified version of the input. + * @param e - Something thrown from a try block + * @returns The error message or a string of the input + */ +function getErrorMessage(e) { + if (isError(e)) { + return e.message; + } + else { + let stringified; + try { + if (typeof e === "object" && e) { + stringified = JSON.stringify(e); + } + else { + stringified = String(e); + } + } + catch (err) { + stringified = "[unable to stringify input]"; + } + return `Unknown error ${stringified}`; + } +} +exports.getErrorMessage = getErrorMessage; +//# sourceMappingURL=error.js.map /***/ }), -/***/ 4492: -/***/ ((module) => { +/***/ 637: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("node:stream"); - -/***/ }), - -/***/ 7261: -/***/ ((module) => { -"use strict"; -module.exports = require("node:util"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.stringToUint8Array = exports.uint8ArrayToString = exports.isWebWorker = exports.isReactNative = exports.isDeno = exports.isNode = exports.isBun = exports.isBrowser = exports.randomUUID = exports.objectHasProperty = exports.isObjectWithProperties = exports.isDefined = exports.computeSha256Hmac = exports.computeSha256Hash = exports.getErrorMessage = exports.isError = exports.isObject = exports.getRandomIntegerInclusive = exports.createAbortablePromise = exports.cancelablePromiseRace = exports.delay = void 0; +var delay_js_1 = __nccwpck_require__(9259); +Object.defineProperty(exports, "delay", ({ enumerable: true, get: function () { return delay_js_1.delay; } })); +var aborterUtils_js_1 = __nccwpck_require__(7205); +Object.defineProperty(exports, "cancelablePromiseRace", ({ enumerable: true, get: function () { return aborterUtils_js_1.cancelablePromiseRace; } })); +var createAbortablePromise_js_1 = __nccwpck_require__(2307); +Object.defineProperty(exports, "createAbortablePromise", ({ enumerable: true, get: function () { return createAbortablePromise_js_1.createAbortablePromise; } })); +var random_js_1 = __nccwpck_require__(3710); +Object.defineProperty(exports, "getRandomIntegerInclusive", ({ enumerable: true, get: function () { return random_js_1.getRandomIntegerInclusive; } })); +var object_js_1 = __nccwpck_require__(6538); +Object.defineProperty(exports, "isObject", ({ enumerable: true, get: function () { return object_js_1.isObject; } })); +var error_js_1 = __nccwpck_require__(6734); +Object.defineProperty(exports, "isError", ({ enumerable: true, get: function () { return error_js_1.isError; } })); +Object.defineProperty(exports, "getErrorMessage", ({ enumerable: true, get: function () { return error_js_1.getErrorMessage; } })); +var sha256_js_1 = __nccwpck_require__(4793); +Object.defineProperty(exports, "computeSha256Hash", ({ enumerable: true, get: function () { return sha256_js_1.computeSha256Hash; } })); +Object.defineProperty(exports, "computeSha256Hmac", ({ enumerable: true, get: function () { return sha256_js_1.computeSha256Hmac; } })); +var typeGuards_js_1 = __nccwpck_require__(1187); +Object.defineProperty(exports, "isDefined", ({ enumerable: true, get: function () { return typeGuards_js_1.isDefined; } })); +Object.defineProperty(exports, "isObjectWithProperties", ({ enumerable: true, get: function () { return typeGuards_js_1.isObjectWithProperties; } })); +Object.defineProperty(exports, "objectHasProperty", ({ enumerable: true, get: function () { return typeGuards_js_1.objectHasProperty; } })); +var uuidUtils_js_1 = __nccwpck_require__(7658); +Object.defineProperty(exports, "randomUUID", ({ enumerable: true, get: function () { return uuidUtils_js_1.randomUUID; } })); +var checkEnvironment_js_1 = __nccwpck_require__(7980); +Object.defineProperty(exports, "isBrowser", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isBrowser; } })); +Object.defineProperty(exports, "isBun", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isBun; } })); +Object.defineProperty(exports, "isNode", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isNode; } })); +Object.defineProperty(exports, "isDeno", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isDeno; } })); +Object.defineProperty(exports, "isReactNative", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isReactNative; } })); +Object.defineProperty(exports, "isWebWorker", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isWebWorker; } })); +var bytesEncoding_js_1 = __nccwpck_require__(9972); +Object.defineProperty(exports, "uint8ArrayToString", ({ enumerable: true, get: function () { return bytesEncoding_js_1.uint8ArrayToString; } })); +Object.defineProperty(exports, "stringToUint8Array", ({ enumerable: true, get: function () { return bytesEncoding_js_1.stringToUint8Array; } })); +//# sourceMappingURL=index.js.map /***/ }), -/***/ 2037: -/***/ ((module) => { +/***/ 6538: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("os"); -/***/ }), - -/***/ 1017: -/***/ ((module) => { - -"use strict"; -module.exports = require("path"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isObject = void 0; +/** + * Helper to determine when an input is a generic JS object. + * @returns true when input is an object type that is not null, Array, RegExp, or Date. + */ +function isObject(input) { + return (typeof input === "object" && + input !== null && + !Array.isArray(input) && + !(input instanceof RegExp) && + !(input instanceof Date)); +} +exports.isObject = isObject; +//# sourceMappingURL=object.js.map /***/ }), -/***/ 4074: -/***/ ((module) => { +/***/ 3710: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("perf_hooks"); - -/***/ }), -/***/ 5477: -/***/ ((module) => { - -"use strict"; -module.exports = require("punycode"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getRandomIntegerInclusive = void 0; +/** + * Returns a random integer value between a lower and upper bound, + * inclusive of both bounds. + * Note that this uses Math.random and isn't secure. If you need to use + * this for any kind of security purpose, find a better source of random. + * @param min - The smallest integer value allowed. + * @param max - The largest integer value allowed. + */ +function getRandomIntegerInclusive(min, max) { + // Make sure inputs are integers. + min = Math.ceil(min); + max = Math.floor(max); + // Pick a random offset from zero to the size of the range. + // Since Math.random() can never return 1, we have to make the range one larger + // in order to be inclusive of the maximum value after we take the floor. + const offset = Math.floor(Math.random() * (max - min + 1)); + return offset + min; +} +exports.getRandomIntegerInclusive = getRandomIntegerInclusive; +//# sourceMappingURL=random.js.map /***/ }), -/***/ 3477: -/***/ ((module) => { +/***/ 4793: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("querystring"); - -/***/ }), - -/***/ 2781: -/***/ ((module) => { -"use strict"; -module.exports = require("stream"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.computeSha256Hash = exports.computeSha256Hmac = void 0; +const crypto_1 = __nccwpck_require__(6113); +/** + * Generates a SHA-256 HMAC signature. + * @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash. + * @param stringToSign - The data to be signed. + * @param encoding - The textual encoding to use for the returned HMAC digest. + */ +async function computeSha256Hmac(key, stringToSign, encoding) { + const decodedKey = Buffer.from(key, "base64"); + return (0, crypto_1.createHmac)("sha256", decodedKey).update(stringToSign).digest(encoding); +} +exports.computeSha256Hmac = computeSha256Hmac; +/** + * Generates a SHA-256 hash. + * @param content - The data to be included in the hash. + * @param encoding - The textual encoding to use for the returned hash. + */ +async function computeSha256Hash(content, encoding) { + return (0, crypto_1.createHash)("sha256").update(content).digest(encoding); +} +exports.computeSha256Hash = computeSha256Hash; +//# sourceMappingURL=sha256.js.map /***/ }), -/***/ 5356: -/***/ ((module) => { +/***/ 1187: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("stream/web"); - -/***/ }), - -/***/ 1576: -/***/ ((module) => { -"use strict"; -module.exports = require("string_decoder"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.objectHasProperty = exports.isObjectWithProperties = exports.isDefined = void 0; +/** + * Helper TypeGuard that checks if something is defined or not. + * @param thing - Anything + */ +function isDefined(thing) { + return typeof thing !== "undefined" && thing !== null; +} +exports.isDefined = isDefined; +/** + * Helper TypeGuard that checks if the input is an object with the specified properties. + * @param thing - Anything. + * @param properties - The name of the properties that should appear in the object. + */ +function isObjectWithProperties(thing, properties) { + if (!isDefined(thing) || typeof thing !== "object") { + return false; + } + for (const property of properties) { + if (!objectHasProperty(thing, property)) { + return false; + } + } + return true; +} +exports.isObjectWithProperties = isObjectWithProperties; +/** + * Helper TypeGuard that checks if the input is an object with the specified property. + * @param thing - Any object. + * @param property - The name of the property that should appear in the object. + */ +function objectHasProperty(thing, property) { + return (isDefined(thing) && typeof thing === "object" && property in thing); +} +exports.objectHasProperty = objectHasProperty; +//# sourceMappingURL=typeGuards.js.map /***/ }), -/***/ 9512: -/***/ ((module) => { +/***/ 7658: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("timers"); - -/***/ }), - -/***/ 4404: -/***/ ((module) => { -"use strict"; -module.exports = require("tls"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.randomUUID = void 0; +const crypto_1 = __nccwpck_require__(6113); +// NOTE: This is a workaround until we can use `globalThis.crypto.randomUUID` in Node.js 19+. +const uuidFunction = typeof globalThis?.crypto?.randomUUID === "function" + ? globalThis.crypto.randomUUID.bind(globalThis.crypto) + : crypto_1.randomUUID; +/** + * Generated Universally Unique Identifier + * + * @returns RFC4122 v4 UUID. + */ +function randomUUID() { + return uuidFunction(); +} +exports.randomUUID = randomUUID; +//# sourceMappingURL=uuidUtils.js.map /***/ }), -/***/ 7310: -/***/ ((module) => { +/***/ 2118: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("url"); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AbortError = void 0; +/** + * This error is thrown when an asynchronous operation has been aborted. + * Check for this error by testing the `name` that the name property of the + * error matches `"AbortError"`. + * + * @example + * ```ts + * const controller = new AbortController(); + * controller.abort(); + * try { + * doAsyncWork(controller.signal) + * } catch (e) { + * if (e.name === 'AbortError') { + * // handle abort error here. + * } + * } + * ``` + */ +class AbortError extends Error { + constructor(message) { + super(message); + this.name = "AbortError"; + } +} +exports.AbortError = AbortError; +//# sourceMappingURL=AbortError.js.map /***/ }), -/***/ 3837: -/***/ ((module) => { +/***/ 4812: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("util"); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AbortError = void 0; +var AbortError_js_1 = __nccwpck_require__(2118); +Object.defineProperty(exports, "AbortError", ({ enumerable: true, get: function () { return AbortError_js_1.AbortError; } })); +//# sourceMappingURL=index.js.map /***/ }), -/***/ 9830: -/***/ ((module) => { +/***/ 162: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("util/types"); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +const log_js_1 = __nccwpck_require__(8898); +const debugEnvVariable = (typeof process !== "undefined" && process.env && process.env.DEBUG) || undefined; +let enabledString; +let enabledNamespaces = []; +let skippedNamespaces = []; +const debuggers = []; +if (debugEnvVariable) { + enable(debugEnvVariable); +} +const debugObj = Object.assign((namespace) => { + return createDebugger(namespace); +}, { + enable, + enabled, + disable, + log: log_js_1.log, +}); +function enable(namespaces) { + enabledString = namespaces; + enabledNamespaces = []; + skippedNamespaces = []; + const wildcard = /\*/g; + const namespaceList = namespaces.split(",").map((ns) => ns.trim().replace(wildcard, ".*?")); + for (const ns of namespaceList) { + if (ns.startsWith("-")) { + skippedNamespaces.push(new RegExp(`^${ns.substr(1)}$`)); + } + else { + enabledNamespaces.push(new RegExp(`^${ns}$`)); + } + } + for (const instance of debuggers) { + instance.enabled = enabled(instance.namespace); + } +} +function enabled(namespace) { + if (namespace.endsWith("*")) { + return true; + } + for (const skipped of skippedNamespaces) { + if (skipped.test(namespace)) { + return false; + } + } + for (const enabledNamespace of enabledNamespaces) { + if (enabledNamespace.test(namespace)) { + return true; + } + } + return false; +} +function disable() { + const result = enabledString || ""; + enable(""); + return result; +} +function createDebugger(namespace) { + const newDebugger = Object.assign(debug, { + enabled: enabled(namespace), + destroy, + log: debugObj.log, + namespace, + extend, + }); + function debug(...args) { + if (!newDebugger.enabled) { + return; + } + if (args.length > 0) { + args[0] = `${namespace} ${args[0]}`; + } + newDebugger.log(...args); + } + debuggers.push(newDebugger); + return newDebugger; +} +function destroy() { + const index = debuggers.indexOf(this); + if (index >= 0) { + debuggers.splice(index, 1); + return true; + } + return false; +} +function extend(namespace) { + const newDebugger = createDebugger(`${this.namespace}:${namespace}`); + newDebugger.log = this.log; + return newDebugger; +} +exports["default"] = debugObj; +//# sourceMappingURL=debug.js.map /***/ }), -/***/ 1267: -/***/ ((module) => { +/***/ 9497: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("worker_threads"); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createClientLogger = exports.getLogLevel = exports.setLogLevel = exports.AzureLogger = void 0; +const tslib_1 = __nccwpck_require__(4351); +const debug_js_1 = tslib_1.__importDefault(__nccwpck_require__(162)); +const registeredLoggers = new Set(); +const logLevelFromEnv = (typeof process !== "undefined" && process.env && process.env.AZURE_LOG_LEVEL) || undefined; +let azureLogLevel; +/** + * The AzureLogger provides a mechanism for overriding where logs are output to. + * By default, logs are sent to stderr. + * Override the `log` method to redirect logs to another location. + */ +exports.AzureLogger = (0, debug_js_1.default)("azure"); +exports.AzureLogger.log = (...args) => { + debug_js_1.default.log(...args); +}; +const AZURE_LOG_LEVELS = ["verbose", "info", "warning", "error"]; +if (logLevelFromEnv) { + // avoid calling setLogLevel because we don't want a mis-set environment variable to crash + if (isAzureLogLevel(logLevelFromEnv)) { + setLogLevel(logLevelFromEnv); + } + else { + console.error(`AZURE_LOG_LEVEL set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${AZURE_LOG_LEVELS.join(", ")}.`); + } +} +/** + * Immediately enables logging at the specified log level. If no level is specified, logging is disabled. + * @param level - The log level to enable for logging. + * Options from most verbose to least verbose are: + * - verbose + * - info + * - warning + * - error + */ +function setLogLevel(level) { + if (level && !isAzureLogLevel(level)) { + throw new Error(`Unknown log level '${level}'. Acceptable values: ${AZURE_LOG_LEVELS.join(",")}`); + } + azureLogLevel = level; + const enabledNamespaces = []; + for (const logger of registeredLoggers) { + if (shouldEnable(logger)) { + enabledNamespaces.push(logger.namespace); + } + } + debug_js_1.default.enable(enabledNamespaces.join(",")); +} +exports.setLogLevel = setLogLevel; +/** + * Retrieves the currently specified log level. + */ +function getLogLevel() { + return azureLogLevel; +} +exports.getLogLevel = getLogLevel; +const levelMap = { + verbose: 400, + info: 300, + warning: 200, + error: 100, +}; +/** + * Creates a logger for use by the Azure SDKs that inherits from `AzureLogger`. + * @param namespace - The name of the SDK package. + * @hidden + */ +function createClientLogger(namespace) { + const clientRootLogger = exports.AzureLogger.extend(namespace); + patchLogMethod(exports.AzureLogger, clientRootLogger); + return { + error: createLogger(clientRootLogger, "error"), + warning: createLogger(clientRootLogger, "warning"), + info: createLogger(clientRootLogger, "info"), + verbose: createLogger(clientRootLogger, "verbose"), + }; +} +exports.createClientLogger = createClientLogger; +function patchLogMethod(parent, child) { + child.log = (...args) => { + parent.log(...args); + }; +} +function createLogger(parent, level) { + const logger = Object.assign(parent.extend(level), { + level, + }); + patchLogMethod(parent, logger); + if (shouldEnable(logger)) { + const enabledNamespaces = debug_js_1.default.disable(); + debug_js_1.default.enable(enabledNamespaces + "," + logger.namespace); + } + registeredLoggers.add(logger); + return logger; +} +function shouldEnable(logger) { + return Boolean(azureLogLevel && levelMap[logger.level] <= levelMap[azureLogLevel]); +} +function isAzureLogLevel(logLevel) { + return AZURE_LOG_LEVELS.includes(logLevel); +} +//# sourceMappingURL=index.js.map /***/ }), -/***/ 9796: -/***/ ((module) => { +/***/ 8898: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("zlib"); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.log = void 0; +const tslib_1 = __nccwpck_require__(4351); +const node_os_1 = __nccwpck_require__(612); +const node_util_1 = tslib_1.__importDefault(__nccwpck_require__(7261)); +const process = tslib_1.__importStar(__nccwpck_require__(7742)); +function log(message, ...args) { + process.stderr.write(`${node_util_1.default.format(message, ...args)}${node_os_1.EOL}`); +} +exports.log = log; +//# sourceMappingURL=log.js.map /***/ }), @@ -85077,7 +85472,7 @@ Dicer.prototype._write = function (data, encoding, cb) { if (this._headerFirst && this._isPreamble) { if (!this._part) { this._part = new PartStream(this._partOpts) - if (this._events.preamble) { this.emit('preamble', this._part) } else { this._ignore() } + if (this.listenerCount('preamble') !== 0) { this.emit('preamble', this._part) } else { this._ignore() } } const r = this._hparser.push(data) if (!this._inHeader && r !== undefined && r < data.length) { data = data.slice(r) } else { return cb() } @@ -85134,7 +85529,7 @@ Dicer.prototype._oninfo = function (isMatch, data, start, end) { } } if (this._dashes === 2) { - if ((start + i) < end && this._events.trailer) { this.emit('trailer', data.slice(start + i, end)) } + if ((start + i) < end && this.listenerCount('trailer') !== 0) { this.emit('trailer', data.slice(start + i, end)) } this.reset() this._finished = true // no more parts will be added @@ -85152,7 +85547,13 @@ Dicer.prototype._oninfo = function (isMatch, data, start, end) { this._part._read = function (n) { self._unpause() } - if (this._isPreamble && this._events.preamble) { this.emit('preamble', this._part) } else if (this._isPreamble !== true && this._events.part) { this.emit('part', this._part) } else { this._ignore() } + if (this._isPreamble && this.listenerCount('preamble') !== 0) { + this.emit('preamble', this._part) + } else if (this._isPreamble !== true && this.listenerCount('part') !== 0) { + this.emit('part', this._part) + } else { + this._ignore() + } if (!this._isPreamble) { this._inHeader = true } } if (data && start < end && !this._ignoreData) { @@ -85835,7 +86236,7 @@ function Multipart (boy, cfg) { ++nfiles - if (!boy._events.file) { + if (boy.listenerCount('file') === 0) { self.parser._ignore() return } @@ -86364,7 +86765,7 @@ const decoders = { if (textDecoders.has(this.toString())) { try { return textDecoders.get(this).decode(data) - } catch (e) { } + } catch {} } return typeof data === 'string' ? data diff --git a/dist/save/index.js b/dist/save/index.js index 91474b4..a26db52 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -9598,7 +9598,7 @@ class HttpClient { if (this._keepAlive && useProxy) { agent = this._proxyAgent; } - if (this._keepAlive && !useProxy) { + if (!useProxy) { agent = this._agent; } // if agent is already assigned use that agent. @@ -9630,16 +9630,12 @@ class HttpClient { agent = tunnelAgent(agentOptions); this._proxyAgent = agent; } - // if reusing agent across request and tunneling agent isn't assigned create a new agent - if (this._keepAlive && !agent) { + // if tunneling agent isn't assigned create a new agent + if (!agent) { const options = { keepAlive: this._keepAlive, maxSockets }; agent = usingSsl ? new https.Agent(options) : new http.Agent(options); this._agent = agent; } - // if not using private agent and tunnel agent isn't setup then use global agent - if (!agent) { - agent = usingSsl ? https.globalAgent : http.globalAgent; - } if (usingSsl && this._ignoreSslError) { // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options @@ -10583,206 +10579,6 @@ exports.AbortSignal = AbortSignal; //# sourceMappingURL=index.js.map -/***/ }), - -/***/ 9645: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var coreUtil = __nccwpck_require__(1333); - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * A static-key-based credential that supports updating - * the underlying key value. - */ -class AzureKeyCredential { - /** - * The value of the key to be used in authentication - */ - get key() { - return this._key; - } - /** - * Create an instance of an AzureKeyCredential for use - * with a service client. - * - * @param key - The initial value of the key to use in authentication - */ - constructor(key) { - if (!key) { - throw new Error("key must be a non-empty string"); - } - this._key = key; - } - /** - * Change the value of the key. - * - * Updates will take effect upon the next request after - * updating the key value. - * - * @param newKey - The new key value to be used - */ - update(newKey) { - this._key = newKey; - } -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Tests an object to determine whether it implements KeyCredential. - * - * @param credential - The assumed KeyCredential to be tested. - */ -function isKeyCredential(credential) { - return coreUtil.isObjectWithProperties(credential, ["key"]) && typeof credential.key === "string"; -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * A static name/key-based credential that supports updating - * the underlying name and key values. - */ -class AzureNamedKeyCredential { - /** - * The value of the key to be used in authentication. - */ - get key() { - return this._key; - } - /** - * The value of the name to be used in authentication. - */ - get name() { - return this._name; - } - /** - * Create an instance of an AzureNamedKeyCredential for use - * with a service client. - * - * @param name - The initial value of the name to use in authentication. - * @param key - The initial value of the key to use in authentication. - */ - constructor(name, key) { - if (!name || !key) { - throw new TypeError("name and key must be non-empty strings"); - } - this._name = name; - this._key = key; - } - /** - * Change the value of the key. - * - * Updates will take effect upon the next request after - * updating the key value. - * - * @param newName - The new name value to be used. - * @param newKey - The new key value to be used. - */ - update(newName, newKey) { - if (!newName || !newKey) { - throw new TypeError("newName and newKey must be non-empty strings"); - } - this._name = newName; - this._key = newKey; - } -} -/** - * Tests an object to determine whether it implements NamedKeyCredential. - * - * @param credential - The assumed NamedKeyCredential to be tested. - */ -function isNamedKeyCredential(credential) { - return (coreUtil.isObjectWithProperties(credential, ["name", "key"]) && - typeof credential.key === "string" && - typeof credential.name === "string"); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * A static-signature-based credential that supports updating - * the underlying signature value. - */ -class AzureSASCredential { - /** - * The value of the shared access signature to be used in authentication - */ - get signature() { - return this._signature; - } - /** - * Create an instance of an AzureSASCredential for use - * with a service client. - * - * @param signature - The initial value of the shared access signature to use in authentication - */ - constructor(signature) { - if (!signature) { - throw new Error("shared access signature must be a non-empty string"); - } - this._signature = signature; - } - /** - * Change the value of the signature. - * - * Updates will take effect upon the next request after - * updating the signature value. - * - * @param newSignature - The new shared access signature value to be used - */ - update(newSignature) { - if (!newSignature) { - throw new Error("shared access signature must be a non-empty string"); - } - this._signature = newSignature; - } -} -/** - * Tests an object to determine whether it implements SASCredential. - * - * @param credential - The assumed SASCredential to be tested. - */ -function isSASCredential(credential) { - return (coreUtil.isObjectWithProperties(credential, ["signature"]) && typeof credential.signature === "string"); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Tests an object to determine whether it implements TokenCredential. - * - * @param credential - The assumed TokenCredential to be tested. - */ -function isTokenCredential(credential) { - // Check for an object with a 'getToken' function and possibly with - // a 'signRequest' function. We do this check to make sure that - // a ServiceClientCredentials implementor (like TokenClientCredentials - // in ms-rest-nodeauth) doesn't get mistaken for a TokenCredential if - // it doesn't actually implement TokenCredential also. - const castCredential = credential; - return (castCredential && - typeof castCredential.getToken === "function" && - (castCredential.signRequest === undefined || castCredential.getToken.length > 0)); -} - -exports.AzureKeyCredential = AzureKeyCredential; -exports.AzureNamedKeyCredential = AzureNamedKeyCredential; -exports.AzureSASCredential = AzureSASCredential; -exports.isKeyCredential = isKeyCredential; -exports.isNamedKeyCredential = isNamedKeyCredential; -exports.isSASCredential = isSASCredential; -exports.isTokenCredential = isTokenCredential; -//# sourceMappingURL=index.js.map - - /***/ }), /***/ 4607: @@ -10797,9 +10593,9 @@ var uuid = __nccwpck_require__(3415); var util = __nccwpck_require__(3837); var tslib = __nccwpck_require__(4351); var xml2js = __nccwpck_require__(6189); -var coreUtil = __nccwpck_require__(1333); -var logger$1 = __nccwpck_require__(3233); -var coreAuth = __nccwpck_require__(9645); +var coreUtil = __nccwpck_require__(637); +var logger$1 = __nccwpck_require__(9497); +var coreAuth = __nccwpck_require__(8834); var os = __nccwpck_require__(2037); var http = __nccwpck_require__(3685); var https = __nccwpck_require__(5687); @@ -16270,7 +16066,7 @@ var parseUrl = (__nccwpck_require__(7310).parse); var fs = __nccwpck_require__(7147); var Stream = (__nccwpck_require__(2781).Stream); var mime = __nccwpck_require__(3583); -var asynckit = __nccwpck_require__(4812); +var asynckit = __nccwpck_require__(6284); var populate = __nccwpck_require__(3971); // Public API @@ -17429,7 +17225,7 @@ exports["default"] = _default; /***/ }), -/***/ 7094: +/***/ 4175: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -17437,2294 +17233,361 @@ exports["default"] = _default; Object.defineProperty(exports, "__esModule", ({ value: true })); -var logger$1 = __nccwpck_require__(3233); -var coreUtil = __nccwpck_require__(1333); +var api = __nccwpck_require__(5163); // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +(function (SpanKind) { + /** Default value. Indicates that the span is used internally. */ + SpanKind[SpanKind["INTERNAL"] = 0] = "INTERNAL"; + /** + * Indicates that the span covers server-side handling of an RPC or other + * remote request. + */ + SpanKind[SpanKind["SERVER"] = 1] = "SERVER"; + /** + * Indicates that the span covers the client-side wrapper around an RPC or + * other remote request. + */ + SpanKind[SpanKind["CLIENT"] = 2] = "CLIENT"; + /** + * Indicates that the span describes producer sending a message to a + * broker. Unlike client and server, there is no direct critical path latency + * relationship between producer and consumer spans. + */ + SpanKind[SpanKind["PRODUCER"] = 3] = "PRODUCER"; + /** + * Indicates that the span describes consumer receiving a message from a + * broker. Unlike client and server, there is no direct critical path latency + * relationship between producer and consumer spans. + */ + SpanKind[SpanKind["CONSUMER"] = 4] = "CONSUMER"; +})(exports.SpanKind || (exports.SpanKind = {})); /** - * The `@azure/logger` configuration for this package. - * @internal + * Return the span if one exists + * + * @param context - context to get span from */ -const logger = logger$1.createClientLogger("core-lro"); - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +function getSpan(context) { + return api.trace.getSpan(context); +} /** - * The default time interval to wait before sending the next polling request. + * Set the span on a context + * + * @param context - context to use as parent + * @param span - span to set active */ -const POLL_INTERVAL_IN_MS = 2000; +function setSpan(context, span) { + return api.trace.setSpan(context, span); +} /** - * The closed set of terminal states. + * Wrap span context in a NoopSpan and set as span in a new + * context + * + * @param context - context to set active span on + * @param spanContext - span context to be wrapped */ -const terminalStates = ["succeeded", "canceled", "failed"]; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +function setSpanContext(context, spanContext) { + return api.trace.setSpanContext(context, spanContext); +} /** - * Deserializes the state + * Get the span context of the span if it exists. + * + * @param context - context to get values from */ -function deserializeState(serializedState) { - try { - return JSON.parse(serializedState).state; - } - catch (e) { - throw new Error(`Unable to deserialize input state: ${serializedState}`); - } -} -function setStateError(inputs) { - const { state, stateProxy, isOperationError } = inputs; - return (error) => { - if (isOperationError(error)) { - stateProxy.setError(state, error); - stateProxy.setFailed(state); - } - throw error; - }; +function getSpanContext(context) { + return api.trace.getSpanContext(context); } -function appendReadableErrorMessage(currentMessage, innerMessage) { - let message = currentMessage; - if (message.slice(-1) !== ".") { - message = message + "."; - } - return message + " " + innerMessage; +/** + * Returns true of the given {@link SpanContext} is valid. + * A valid {@link SpanContext} is one which has a valid trace ID and span ID as per the spec. + * + * @param context - the {@link SpanContext} to validate. + * + * @returns true if the {@link SpanContext} is valid, false otherwise. + */ +function isSpanContextValid(context) { + return api.trace.isSpanContextValid(context); } -function simplifyError(err) { - let message = err.message; - let code = err.code; - let curErr = err; - while (curErr.innererror) { - curErr = curErr.innererror; - code = curErr.code; - message = appendReadableErrorMessage(message, curErr.message); - } - return { - code, - message, - }; +function getTracer(name, version) { + return api.trace.getTracer(name || "azure/core-tracing", version); } -function processOperationStatus(result) { - const { state, stateProxy, status, isDone, processResult, getError, response, setErrorAsResult } = result; - switch (status) { - case "succeeded": { - stateProxy.setSucceeded(state); - break; - } - case "failed": { - const err = getError === null || getError === void 0 ? void 0 : getError(response); - let postfix = ""; - if (err) { - const { code, message } = simplifyError(err); - postfix = `. ${code}. ${message}`; - } - const errStr = `The long-running operation has failed${postfix}`; - stateProxy.setError(state, new Error(errStr)); - stateProxy.setFailed(state); - logger.warning(errStr); - break; - } - case "canceled": { - stateProxy.setCanceled(state); - break; - } +/** Entrypoint for context API */ +const context = api.context; +(function (SpanStatusCode) { + /** + * The default status. + */ + SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET"; + /** + * The operation has been validated by an Application developer or + * Operator to have completed successfully. + */ + SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK"; + /** + * The operation contains an error. + */ + SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR"; +})(exports.SpanStatusCode || (exports.SpanStatusCode = {})); + +// Copyright (c) Microsoft Corporation. +function isTracingDisabled() { + var _a; + if (typeof process === "undefined") { + // not supported in browser for now without polyfills + return false; } - if ((isDone === null || isDone === void 0 ? void 0 : isDone(response, state)) || - (isDone === undefined && - ["succeeded", "canceled"].concat(setErrorAsResult ? [] : ["failed"]).includes(status))) { - stateProxy.setResult(state, buildResult({ - response, - state, - processResult, - })); + const azureTracingDisabledValue = (_a = process.env.AZURE_TRACING_DISABLED) === null || _a === void 0 ? void 0 : _a.toLowerCase(); + if (azureTracingDisabledValue === "false" || azureTracingDisabledValue === "0") { + return false; } -} -function buildResult(inputs) { - const { processResult, response, state } = inputs; - return processResult ? processResult(response, state) : response; + return Boolean(azureTracingDisabledValue); } /** - * Initiates the long-running operation. + * Creates a function that can be used to create spans using the global tracer. + * + * Usage: + * + * ```typescript + * // once + * const createSpan = createSpanFunction({ packagePrefix: "Azure.Data.AppConfiguration", namespace: "Microsoft.AppConfiguration" }); + * + * // in each operation + * const span = createSpan("deleteConfigurationSetting", operationOptions); + * // code... + * span.end(); + * ``` + * + * @hidden + * @param args - allows configuration of the prefix for each span as well as the az.namespace field. */ -async function initOperation(inputs) { - const { init, stateProxy, processResult, getOperationStatus, withOperationLocation, setErrorAsResult, } = inputs; - const { operationLocation, resourceLocation, metadata, response } = await init(); - if (operationLocation) - withOperationLocation === null || withOperationLocation === void 0 ? void 0 : withOperationLocation(operationLocation, false); - const config = { - metadata, - operationLocation, - resourceLocation, - }; - logger.verbose(`LRO: Operation description:`, config); - const state = stateProxy.initState(config); - const status = getOperationStatus({ response, state, operationLocation }); - processOperationStatus({ state, status, stateProxy, response, setErrorAsResult, processResult }); - return state; -} -async function pollOperationHelper(inputs) { - const { poll, state, stateProxy, operationLocation, getOperationStatus, getResourceLocation, isOperationError, options, } = inputs; - const response = await poll(operationLocation, options).catch(setStateError({ - state, - stateProxy, - isOperationError, - })); - const status = getOperationStatus(response, state); - logger.verbose(`LRO: Status:\n\tPolling from: ${state.config.operationLocation}\n\tOperation status: ${status}\n\tPolling status: ${terminalStates.includes(status) ? "Stopped" : "Running"}`); - if (status === "succeeded") { - const resourceLocation = getResourceLocation(response, state); - if (resourceLocation !== undefined) { - return { - response: await poll(resourceLocation).catch(setStateError({ state, stateProxy, isOperationError })), - status, - }; +function createSpanFunction(args) { + return function (operationName, operationOptions) { + const tracer = getTracer(); + const tracingOptions = (operationOptions === null || operationOptions === void 0 ? void 0 : operationOptions.tracingOptions) || {}; + const spanOptions = Object.assign({ kind: exports.SpanKind.INTERNAL }, tracingOptions.spanOptions); + const spanName = args.packagePrefix ? `${args.packagePrefix}.${operationName}` : operationName; + let span; + if (isTracingDisabled()) { + span = api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT); } - } - return { response, status }; -} -/** Polls the long-running operation. */ -async function pollOperation(inputs) { - const { poll, state, stateProxy, options, getOperationStatus, getResourceLocation, getOperationLocation, isOperationError, withOperationLocation, getPollingInterval, processResult, getError, updateState, setDelay, isDone, setErrorAsResult, } = inputs; - const { operationLocation } = state.config; - if (operationLocation !== undefined) { - const { response, status } = await pollOperationHelper({ - poll, - getOperationStatus, - state, - stateProxy, - operationLocation, - getResourceLocation, - isOperationError, - options, - }); - processOperationStatus({ - status, - response, - state, - stateProxy, - isDone, - processResult, - getError, - setErrorAsResult, - }); - if (!terminalStates.includes(status)) { - const intervalInMs = getPollingInterval === null || getPollingInterval === void 0 ? void 0 : getPollingInterval(response); - if (intervalInMs) - setDelay(intervalInMs); - const location = getOperationLocation === null || getOperationLocation === void 0 ? void 0 : getOperationLocation(response, state); - if (location !== undefined) { - const isUpdated = operationLocation !== location; - state.config.operationLocation = location; - withOperationLocation === null || withOperationLocation === void 0 ? void 0 : withOperationLocation(location, isUpdated); - } - else - withOperationLocation === null || withOperationLocation === void 0 ? void 0 : withOperationLocation(operationLocation, false); + else { + span = tracer.startSpan(spanName, spanOptions, tracingOptions.tracingContext); } - updateState === null || updateState === void 0 ? void 0 : updateState(state, response); - } + if (args.namespace) { + span.setAttribute("az.namespace", args.namespace); + } + let newSpanOptions = tracingOptions.spanOptions || {}; + if (span.isRecording() && args.namespace) { + newSpanOptions = Object.assign(Object.assign({}, tracingOptions.spanOptions), { attributes: Object.assign(Object.assign({}, spanOptions.attributes), { "az.namespace": args.namespace }) }); + } + const newTracingOptions = Object.assign(Object.assign({}, tracingOptions), { spanOptions: newSpanOptions, tracingContext: setSpan(tracingOptions.tracingContext || context.active(), span) }); + const newOperationOptions = Object.assign(Object.assign({}, operationOptions), { tracingOptions: newTracingOptions }); + return { + span, + updatedOptions: newOperationOptions + }; + }; } // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -function getOperationLocationPollingUrl(inputs) { - const { azureAsyncOperation, operationLocation } = inputs; - return operationLocation !== null && operationLocation !== void 0 ? operationLocation : azureAsyncOperation; -} -function getLocationHeader(rawResponse) { - return rawResponse.headers["location"]; -} -function getOperationLocationHeader(rawResponse) { - return rawResponse.headers["operation-location"]; -} -function getAzureAsyncOperationHeader(rawResponse) { - return rawResponse.headers["azure-asyncoperation"]; -} -function findResourceLocation(inputs) { - var _a; - const { location, requestMethod, requestPath, resourceLocationConfig } = inputs; - switch (requestMethod) { - case "PUT": { - return requestPath; - } - case "DELETE": { - return undefined; - } - case "PATCH": { - return (_a = getDefault()) !== null && _a !== void 0 ? _a : requestPath; - } - default: { - return getDefault(); - } - } - function getDefault() { - switch (resourceLocationConfig) { - case "azure-async-operation": { - return undefined; - } - case "original-uri": { - return requestPath; - } - case "location": - default: { - return location; - } - } - } -} -function inferLroMode(inputs) { - const { rawResponse, requestMethod, requestPath, resourceLocationConfig } = inputs; - const operationLocation = getOperationLocationHeader(rawResponse); - const azureAsyncOperation = getAzureAsyncOperationHeader(rawResponse); - const pollingUrl = getOperationLocationPollingUrl({ operationLocation, azureAsyncOperation }); - const location = getLocationHeader(rawResponse); - const normalizedRequestMethod = requestMethod === null || requestMethod === void 0 ? void 0 : requestMethod.toLocaleUpperCase(); - if (pollingUrl !== undefined) { - return { - mode: "OperationLocation", - operationLocation: pollingUrl, - resourceLocation: findResourceLocation({ - requestMethod: normalizedRequestMethod, - location, - requestPath, - resourceLocationConfig, - }), - }; - } - else if (location !== undefined) { - return { - mode: "ResourceLocation", - operationLocation: location, - }; - } - else if (normalizedRequestMethod === "PUT" && requestPath) { - return { - mode: "Body", - operationLocation: requestPath, - }; - } - else { - return undefined; - } -} -function transformStatus(inputs) { - const { status, statusCode } = inputs; - if (typeof status !== "string" && status !== undefined) { - throw new Error(`Polling was unsuccessful. Expected status to have a string value or no value but it has instead: ${status}. This doesn't necessarily indicate the operation has failed. Check your Azure subscription or resource status for more information.`); - } - switch (status === null || status === void 0 ? void 0 : status.toLocaleLowerCase()) { - case undefined: - return toOperationStatus(statusCode); - case "succeeded": - return "succeeded"; - case "failed": - return "failed"; - case "running": - case "accepted": - case "started": - case "canceling": - case "cancelling": - return "running"; - case "canceled": - case "cancelled": - return "canceled"; - default: { - logger.verbose(`LRO: unrecognized operation status: ${status}`); - return status; - } - } -} -function getStatus(rawResponse) { - var _a; - const { status } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {}; - return transformStatus({ status, statusCode: rawResponse.statusCode }); -} -function getProvisioningState(rawResponse) { - var _a, _b; - const { properties, provisioningState } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {}; - const status = (_b = properties === null || properties === void 0 ? void 0 : properties.provisioningState) !== null && _b !== void 0 ? _b : provisioningState; - return transformStatus({ status, statusCode: rawResponse.statusCode }); -} -function toOperationStatus(statusCode) { - if (statusCode === 202) { - return "running"; - } - else if (statusCode < 300) { - return "succeeded"; - } - else { - return "failed"; - } -} -function parseRetryAfter({ rawResponse }) { - const retryAfter = rawResponse.headers["retry-after"]; - if (retryAfter !== undefined) { - // Retry-After header value is either in HTTP date format, or in seconds - const retryAfterInSeconds = parseInt(retryAfter); - return isNaN(retryAfterInSeconds) - ? calculatePollingIntervalFromDate(new Date(retryAfter)) - : retryAfterInSeconds * 1000; - } - return undefined; -} -function getErrorFromResponse(response) { - const error = accessBodyProperty(response, "error"); - if (!error) { - logger.warning(`The long-running operation failed but there is no error property in the response's body`); - return; - } - if (!error.code || !error.message) { - logger.warning(`The long-running operation failed but the error property in the response's body doesn't contain code or message`); - return; - } - return error; -} -function calculatePollingIntervalFromDate(retryAfterDate) { - const timeNow = Math.floor(new Date().getTime()); - const retryAfterTime = retryAfterDate.getTime(); - if (timeNow < retryAfterTime) { - return retryAfterTime - timeNow; - } - return undefined; -} -function getStatusFromInitialResponse(inputs) { - const { response, state, operationLocation } = inputs; - function helper() { - var _a; - const mode = (_a = state.config.metadata) === null || _a === void 0 ? void 0 : _a["mode"]; - switch (mode) { - case undefined: - return toOperationStatus(response.rawResponse.statusCode); - case "Body": - return getOperationStatus(response, state); - default: - return "running"; - } - } - const status = helper(); - return status === "running" && operationLocation === undefined ? "succeeded" : status; +const VERSION = "00"; +/** + * Generates a `SpanContext` given a `traceparent` header value. + * @param traceParent - Serialized span context data as a `traceparent` header value. + * @returns The `SpanContext` generated from the `traceparent` value. + */ +function extractSpanContextFromTraceParentHeader(traceParentHeader) { + const parts = traceParentHeader.split("-"); + if (parts.length !== 4) { + return; + } + const [version, traceId, spanId, traceOptions] = parts; + if (version !== VERSION) { + return; + } + const traceFlags = parseInt(traceOptions, 16); + const spanContext = { + spanId, + traceId, + traceFlags + }; + return spanContext; } /** - * Initiates the long-running operation. + * Generates a `traceparent` value given a span context. + * @param spanContext - Contains context for a specific span. + * @returns The `spanContext` represented as a `traceparent` value. */ -async function initHttpOperation(inputs) { - const { stateProxy, resourceLocationConfig, processResult, lro, setErrorAsResult } = inputs; - return initOperation({ - init: async () => { - const response = await lro.sendInitialRequest(); - const config = inferLroMode({ - rawResponse: response.rawResponse, - requestPath: lro.requestPath, - requestMethod: lro.requestMethod, - resourceLocationConfig, - }); - return Object.assign({ response, operationLocation: config === null || config === void 0 ? void 0 : config.operationLocation, resourceLocation: config === null || config === void 0 ? void 0 : config.resourceLocation }, ((config === null || config === void 0 ? void 0 : config.mode) ? { metadata: { mode: config.mode } } : {})); - }, - stateProxy, - processResult: processResult - ? ({ flatResponse }, state) => processResult(flatResponse, state) - : ({ flatResponse }) => flatResponse, - getOperationStatus: getStatusFromInitialResponse, - setErrorAsResult, - }); -} -function getOperationLocation({ rawResponse }, state) { - var _a; - const mode = (_a = state.config.metadata) === null || _a === void 0 ? void 0 : _a["mode"]; - switch (mode) { - case "OperationLocation": { - return getOperationLocationPollingUrl({ - operationLocation: getOperationLocationHeader(rawResponse), - azureAsyncOperation: getAzureAsyncOperationHeader(rawResponse), - }); - } - case "ResourceLocation": { - return getLocationHeader(rawResponse); - } - case "Body": - default: { - return undefined; - } +function getTraceParentHeader(spanContext) { + const missingFields = []; + if (!spanContext.traceId) { + missingFields.push("traceId"); } -} -function getOperationStatus({ rawResponse }, state) { - var _a; - const mode = (_a = state.config.metadata) === null || _a === void 0 ? void 0 : _a["mode"]; - switch (mode) { - case "OperationLocation": { - return getStatus(rawResponse); - } - case "ResourceLocation": { - return toOperationStatus(rawResponse.statusCode); - } - case "Body": { - return getProvisioningState(rawResponse); - } - default: - throw new Error(`Internal error: Unexpected operation mode: ${mode}`); + if (!spanContext.spanId) { + missingFields.push("spanId"); } -} -function accessBodyProperty({ flatResponse, rawResponse }, prop) { - var _a, _b; - return (_a = flatResponse === null || flatResponse === void 0 ? void 0 : flatResponse[prop]) !== null && _a !== void 0 ? _a : (_b = rawResponse.body) === null || _b === void 0 ? void 0 : _b[prop]; -} -function getResourceLocation(res, state) { - const loc = accessBodyProperty(res, "resourceLocation"); - if (loc && typeof loc === "string") { - state.config.resourceLocation = loc; + if (missingFields.length) { + return; } - return state.config.resourceLocation; -} -function isOperationError(e) { - return e.name === "RestError"; + const flags = spanContext.traceFlags || 0 /* NONE */; + const hexFlags = flags.toString(16); + const traceFlags = hexFlags.length === 1 ? `0${hexFlags}` : hexFlags; + // https://www.w3.org/TR/trace-context/#traceparent-header-field-values + return `${VERSION}-${spanContext.traceId}-${spanContext.spanId}-${traceFlags}`; } -/** Polls the long-running operation. */ -async function pollHttpOperation(inputs) { - const { lro, stateProxy, options, processResult, updateState, setDelay, state, setErrorAsResult, } = inputs; - return pollOperation({ - state, - stateProxy, - setDelay, - processResult: processResult - ? ({ flatResponse }, inputState) => processResult(flatResponse, inputState) - : ({ flatResponse }) => flatResponse, - getError: getErrorFromResponse, - updateState, - getPollingInterval: parseRetryAfter, - getOperationLocation, - getOperationStatus, - isOperationError, - getResourceLocation, - options, - /** - * The expansion here is intentional because `lro` could be an object that - * references an inner this, so we need to preserve a reference to it. - */ - poll: async (location, inputOptions) => lro.sendPollRequest(location, inputOptions), - setErrorAsResult, - }); + +exports.context = context; +exports.createSpanFunction = createSpanFunction; +exports.extractSpanContextFromTraceParentHeader = extractSpanContextFromTraceParentHeader; +exports.getSpan = getSpan; +exports.getSpanContext = getSpanContext; +exports.getTraceParentHeader = getTraceParentHeader; +exports.getTracer = getTracer; +exports.isSpanContextValid = isSpanContextValid; +exports.setSpan = setSpan; +exports.setSpanContext = setSpanContext; +//# sourceMappingURL=index.js.map + + +/***/ }), + +/***/ 4100: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var coreHttp = __nccwpck_require__(4607); +var tslib = __nccwpck_require__(4351); +var coreTracing = __nccwpck_require__(4175); +var logger$1 = __nccwpck_require__(9497); +var abortController = __nccwpck_require__(978); +var os = __nccwpck_require__(2037); +var crypto = __nccwpck_require__(6113); +var stream = __nccwpck_require__(2781); +__nccwpck_require__(7947); +var coreLro = __nccwpck_require__(334); +var events = __nccwpck_require__(2361); +var fs = __nccwpck_require__(7147); +var util = __nccwpck_require__(3837); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n["default"] = e; + return Object.freeze(n); } -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -const createStateProxy$1 = () => ({ - /** - * The state at this point is created to be of type OperationState. - * It will be updated later to be of type TState when the - * customer-provided callback, `updateState`, is called during polling. - */ - initState: (config) => ({ status: "running", config }), - setCanceled: (state) => (state.status = "canceled"), - setError: (state, error) => (state.error = error), - setResult: (state, result) => (state.result = result), - setRunning: (state) => (state.status = "running"), - setSucceeded: (state) => (state.status = "succeeded"), - setFailed: (state) => (state.status = "failed"), - getError: (state) => state.error, - getResult: (state) => state.result, - isCanceled: (state) => state.status === "canceled", - isFailed: (state) => state.status === "failed", - isRunning: (state) => state.status === "running", - isSucceeded: (state) => state.status === "succeeded", -}); -/** - * Returns a poller factory. +var coreHttp__namespace = /*#__PURE__*/_interopNamespace(coreHttp); +var os__namespace = /*#__PURE__*/_interopNamespace(os); +var fs__namespace = /*#__PURE__*/_interopNamespace(fs); +var util__namespace = /*#__PURE__*/_interopNamespace(util); + +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -function buildCreatePoller(inputs) { - const { getOperationLocation, getStatusFromInitialResponse, getStatusFromPollResponse, isOperationError, getResourceLocation, getPollingInterval, getError, resolveOnUnsuccessful, } = inputs; - return async ({ init, poll }, options) => { - const { processResult, updateState, withOperationLocation: withOperationLocationCallback, intervalInMs = POLL_INTERVAL_IN_MS, restoreFrom, } = options || {}; - const stateProxy = createStateProxy$1(); - const withOperationLocation = withOperationLocationCallback - ? (() => { - let called = false; - return (operationLocation, isUpdated) => { - if (isUpdated) - withOperationLocationCallback(operationLocation); - else if (!called) - withOperationLocationCallback(operationLocation); - called = true; - }; - })() - : undefined; - const state = restoreFrom - ? deserializeState(restoreFrom) - : await initOperation({ - init, - stateProxy, - processResult, - getOperationStatus: getStatusFromInitialResponse, - withOperationLocation, - setErrorAsResult: !resolveOnUnsuccessful, - }); - let resultPromise; - const abortController = new AbortController(); - const handlers = new Map(); - const handleProgressEvents = async () => handlers.forEach((h) => h(state)); - const cancelErrMsg = "Operation was canceled"; - let currentPollIntervalInMs = intervalInMs; - const poller = { - getOperationState: () => state, - getResult: () => state.result, - isDone: () => ["succeeded", "failed", "canceled"].includes(state.status), - isStopped: () => resultPromise === undefined, - stopPolling: () => { - abortController.abort(); - }, - toString: () => JSON.stringify({ - state, - }), - onProgress: (callback) => { - const s = Symbol(); - handlers.set(s, callback); - return () => handlers.delete(s); - }, - pollUntilDone: (pollOptions) => (resultPromise !== null && resultPromise !== void 0 ? resultPromise : (resultPromise = (async () => { - const { abortSignal: inputAbortSignal } = pollOptions || {}; - // In the future we can use AbortSignal.any() instead - function abortListener() { - abortController.abort(); +const BlobServiceProperties = { + serializedName: "BlobServiceProperties", + xmlName: "StorageServiceProperties", + type: { + name: "Composite", + className: "BlobServiceProperties", + modelProperties: { + blobAnalyticsLogging: { + serializedName: "Logging", + xmlName: "Logging", + type: { + name: "Composite", + className: "Logging" } - const abortSignal = abortController.signal; - if (inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.aborted) { - abortController.abort(); + }, + hourMetrics: { + serializedName: "HourMetrics", + xmlName: "HourMetrics", + type: { + name: "Composite", + className: "Metrics" } - else if (!abortSignal.aborted) { - inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.addEventListener("abort", abortListener, { once: true }); + }, + minuteMetrics: { + serializedName: "MinuteMetrics", + xmlName: "MinuteMetrics", + type: { + name: "Composite", + className: "Metrics" } - try { - if (!poller.isDone()) { - await poller.poll({ abortSignal }); - while (!poller.isDone()) { - await coreUtil.delay(currentPollIntervalInMs, { abortSignal }); - await poller.poll({ abortSignal }); + }, + cors: { + serializedName: "Cors", + xmlName: "Cors", + xmlIsWrapped: true, + xmlElementName: "CorsRule", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CorsRule" } } } - finally { - inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.removeEventListener("abort", abortListener); - } - if (resolveOnUnsuccessful) { - return poller.getResult(); + }, + defaultServiceVersion: { + serializedName: "DefaultServiceVersion", + xmlName: "DefaultServiceVersion", + type: { + name: "String" } - else { - switch (state.status) { - case "succeeded": - return poller.getResult(); - case "canceled": - throw new Error(cancelErrMsg); - case "failed": - throw state.error; - case "notStarted": - case "running": - throw new Error(`Polling completed without succeeding or failing`); - } + }, + deleteRetentionPolicy: { + serializedName: "DeleteRetentionPolicy", + xmlName: "DeleteRetentionPolicy", + type: { + name: "Composite", + className: "RetentionPolicy" } - })().finally(() => { - resultPromise = undefined; - }))), - async poll(pollOptions) { - if (resolveOnUnsuccessful) { - if (poller.isDone()) - return; + }, + staticWebsite: { + serializedName: "StaticWebsite", + xmlName: "StaticWebsite", + type: { + name: "Composite", + className: "StaticWebsite" } - else { - switch (state.status) { - case "succeeded": - return; - case "canceled": - throw new Error(cancelErrMsg); - case "failed": - throw state.error; - } - } - await pollOperation({ - poll, - state, - stateProxy, - getOperationLocation, - isOperationError, - withOperationLocation, - getPollingInterval, - getOperationStatus: getStatusFromPollResponse, - getResourceLocation, - processResult, - getError, - updateState, - options: pollOptions, - setDelay: (pollIntervalInMs) => { - currentPollIntervalInMs = pollIntervalInMs; - }, - setErrorAsResult: !resolveOnUnsuccessful, - }); - await handleProgressEvents(); - if (!resolveOnUnsuccessful) { - switch (state.status) { - case "canceled": - throw new Error(cancelErrMsg); - case "failed": - throw state.error; - } - } - }, - }; - return poller; - }; -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Creates a poller that can be used to poll a long-running operation. - * @param lro - Description of the long-running operation - * @param options - options to configure the poller - * @returns an initialized poller - */ -async function createHttpPoller(lro, options) { - const { resourceLocationConfig, intervalInMs, processResult, restoreFrom, updateState, withOperationLocation, resolveOnUnsuccessful = false, } = options || {}; - return buildCreatePoller({ - getStatusFromInitialResponse, - getStatusFromPollResponse: getOperationStatus, - isOperationError, - getOperationLocation, - getResourceLocation, - getPollingInterval: parseRetryAfter, - getError: getErrorFromResponse, - resolveOnUnsuccessful, - })({ - init: async () => { - const response = await lro.sendInitialRequest(); - const config = inferLroMode({ - rawResponse: response.rawResponse, - requestPath: lro.requestPath, - requestMethod: lro.requestMethod, - resourceLocationConfig, - }); - return Object.assign({ response, operationLocation: config === null || config === void 0 ? void 0 : config.operationLocation, resourceLocation: config === null || config === void 0 ? void 0 : config.resourceLocation }, ((config === null || config === void 0 ? void 0 : config.mode) ? { metadata: { mode: config.mode } } : {})); - }, - poll: lro.sendPollRequest, - }, { - intervalInMs, - withOperationLocation, - restoreFrom, - updateState, - processResult: processResult - ? ({ flatResponse }, state) => processResult(flatResponse, state) - : ({ flatResponse }) => flatResponse, - }); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -const createStateProxy = () => ({ - initState: (config) => ({ config, isStarted: true }), - setCanceled: (state) => (state.isCancelled = true), - setError: (state, error) => (state.error = error), - setResult: (state, result) => (state.result = result), - setRunning: (state) => (state.isStarted = true), - setSucceeded: (state) => (state.isCompleted = true), - setFailed: () => { - /** empty body */ - }, - getError: (state) => state.error, - getResult: (state) => state.result, - isCanceled: (state) => !!state.isCancelled, - isFailed: (state) => !!state.error, - isRunning: (state) => !!state.isStarted, - isSucceeded: (state) => Boolean(state.isCompleted && !state.isCancelled && !state.error), -}); -class GenericPollOperation { - constructor(state, lro, setErrorAsResult, lroResourceLocationConfig, processResult, updateState, isDone) { - this.state = state; - this.lro = lro; - this.setErrorAsResult = setErrorAsResult; - this.lroResourceLocationConfig = lroResourceLocationConfig; - this.processResult = processResult; - this.updateState = updateState; - this.isDone = isDone; - } - setPollerConfig(pollerConfig) { - this.pollerConfig = pollerConfig; - } - async update(options) { - var _a; - const stateProxy = createStateProxy(); - if (!this.state.isStarted) { - this.state = Object.assign(Object.assign({}, this.state), (await initHttpOperation({ - lro: this.lro, - stateProxy, - resourceLocationConfig: this.lroResourceLocationConfig, - processResult: this.processResult, - setErrorAsResult: this.setErrorAsResult, - }))); - } - const updateState = this.updateState; - const isDone = this.isDone; - if (!this.state.isCompleted && this.state.error === undefined) { - await pollHttpOperation({ - lro: this.lro, - state: this.state, - stateProxy, - processResult: this.processResult, - updateState: updateState - ? (state, { rawResponse }) => updateState(state, rawResponse) - : undefined, - isDone: isDone - ? ({ flatResponse }, state) => isDone(flatResponse, state) - : undefined, - options, - setDelay: (intervalInMs) => { - this.pollerConfig.intervalInMs = intervalInMs; - }, - setErrorAsResult: this.setErrorAsResult, - }); - } - (_a = options === null || options === void 0 ? void 0 : options.fireProgress) === null || _a === void 0 ? void 0 : _a.call(options, this.state); - return this; - } - async cancel() { - logger.error("`cancelOperation` is deprecated because it wasn't implemented"); - return this; - } - /** - * Serializes the Poller operation. - */ - toString() { - return JSON.stringify({ - state: this.state, - }); - } -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * When a poller is manually stopped through the `stopPolling` method, - * the poller will be rejected with an instance of the PollerStoppedError. - */ -class PollerStoppedError extends Error { - constructor(message) { - super(message); - this.name = "PollerStoppedError"; - Object.setPrototypeOf(this, PollerStoppedError.prototype); - } -} -/** - * When the operation is cancelled, the poller will be rejected with an instance - * of the PollerCancelledError. - */ -class PollerCancelledError extends Error { - constructor(message) { - super(message); - this.name = "PollerCancelledError"; - Object.setPrototypeOf(this, PollerCancelledError.prototype); - } -} -/** - * A class that represents the definition of a program that polls through consecutive requests - * until it reaches a state of completion. - * - * A poller can be executed manually, by polling request by request by calling to the `poll()` method repeatedly, until its operation is completed. - * It also provides a way to wait until the operation completes, by calling `pollUntilDone()` and waiting until the operation finishes. - * Pollers can also request the cancellation of the ongoing process to whom is providing the underlying long running operation. - * - * ```ts - * const poller = new MyPoller(); - * - * // Polling just once: - * await poller.poll(); - * - * // We can try to cancel the request here, by calling: - * // - * // await poller.cancelOperation(); - * // - * - * // Getting the final result: - * const result = await poller.pollUntilDone(); - * ``` - * - * The Poller is defined by two types, a type representing the state of the poller, which - * must include a basic set of properties from `PollOperationState`, - * and a return type defined by `TResult`, which can be anything. - * - * The Poller class implements the `PollerLike` interface, which allows poller implementations to avoid having - * to export the Poller's class directly, and instead only export the already instantiated poller with the PollerLike type. - * - * ```ts - * class Client { - * public async makePoller: PollerLike { - * const poller = new MyPoller({}); - * // It might be preferred to return the poller after the first request is made, - * // so that some information can be obtained right away. - * await poller.poll(); - * return poller; - * } - * } - * - * const poller: PollerLike = myClient.makePoller(); - * ``` - * - * A poller can be created through its constructor, then it can be polled until it's completed. - * At any point in time, the state of the poller can be obtained without delay through the getOperationState method. - * At any point in time, the intermediate forms of the result type can be requested without delay. - * Once the underlying operation is marked as completed, the poller will stop and the final value will be returned. - * - * ```ts - * const poller = myClient.makePoller(); - * const state: MyOperationState = poller.getOperationState(); - * - * // The intermediate result can be obtained at any time. - * const result: MyResult | undefined = poller.getResult(); - * - * // The final result can only be obtained after the poller finishes. - * const result: MyResult = await poller.pollUntilDone(); - * ``` - * - */ -// eslint-disable-next-line no-use-before-define -class Poller { - /** - * A poller needs to be initialized by passing in at least the basic properties of the `PollOperation`. - * - * When writing an implementation of a Poller, this implementation needs to deal with the initialization - * of any custom state beyond the basic definition of the poller. The basic poller assumes that the poller's - * operation has already been defined, at least its basic properties. The code below shows how to approach - * the definition of the constructor of a new custom poller. - * - * ```ts - * export class MyPoller extends Poller { - * constructor({ - * // Anything you might need outside of the basics - * }) { - * let state: MyOperationState = { - * privateProperty: private, - * publicProperty: public, - * }; - * - * const operation = { - * state, - * update, - * cancel, - * toString - * } - * - * // Sending the operation to the parent's constructor. - * super(operation); - * - * // You can assign more local properties here. - * } - * } - * ``` - * - * Inside of this constructor, a new promise is created. This will be used to - * tell the user when the poller finishes (see `pollUntilDone()`). The promise's - * resolve and reject methods are also used internally to control when to resolve - * or reject anyone waiting for the poller to finish. - * - * The constructor of a custom implementation of a poller is where any serialized version of - * a previous poller's operation should be deserialized into the operation sent to the - * base constructor. For example: - * - * ```ts - * export class MyPoller extends Poller { - * constructor( - * baseOperation: string | undefined - * ) { - * let state: MyOperationState = {}; - * if (baseOperation) { - * state = { - * ...JSON.parse(baseOperation).state, - * ...state - * }; - * } - * const operation = { - * state, - * // ... - * } - * super(operation); - * } - * } - * ``` - * - * @param operation - Must contain the basic properties of `PollOperation`. - */ - constructor(operation) { - /** controls whether to throw an error if the operation failed or was canceled. */ - this.resolveOnUnsuccessful = false; - this.stopped = true; - this.pollProgressCallbacks = []; - this.operation = operation; - this.promise = new Promise((resolve, reject) => { - this.resolve = resolve; - this.reject = reject; - }); - // This prevents the UnhandledPromiseRejectionWarning in node.js from being thrown. - // The above warning would get thrown if `poller.poll` is called, it returns an error, - // and pullUntilDone did not have a .catch or await try/catch on it's return value. - this.promise.catch(() => { - /* intentionally blank */ - }); - } - /** - * Starts a loop that will break only if the poller is done - * or if the poller is stopped. - */ - async startPolling(pollOptions = {}) { - if (this.stopped) { - this.stopped = false; - } - while (!this.isStopped() && !this.isDone()) { - await this.poll(pollOptions); - await this.delay(); - } - } - /** - * pollOnce does one polling, by calling to the update method of the underlying - * poll operation to make any relevant change effective. - * - * It only optionally receives an object with an abortSignal property, from \@azure/abort-controller's AbortSignalLike. - * - * @param options - Optional properties passed to the operation's update method. - */ - async pollOnce(options = {}) { - if (!this.isDone()) { - this.operation = await this.operation.update({ - abortSignal: options.abortSignal, - fireProgress: this.fireProgress.bind(this), - }); - } - this.processUpdatedState(); - } - /** - * fireProgress calls the functions passed in via onProgress the method of the poller. - * - * It loops over all of the callbacks received from onProgress, and executes them, sending them - * the current operation state. - * - * @param state - The current operation state. - */ - fireProgress(state) { - for (const callback of this.pollProgressCallbacks) { - callback(state); - } - } - /** - * Invokes the underlying operation's cancel method. - */ - async cancelOnce(options = {}) { - this.operation = await this.operation.cancel(options); - } - /** - * Returns a promise that will resolve once a single polling request finishes. - * It does this by calling the update method of the Poller's operation. - * - * It only optionally receives an object with an abortSignal property, from \@azure/abort-controller's AbortSignalLike. - * - * @param options - Optional properties passed to the operation's update method. - */ - poll(options = {}) { - if (!this.pollOncePromise) { - this.pollOncePromise = this.pollOnce(options); - const clearPollOncePromise = () => { - this.pollOncePromise = undefined; - }; - this.pollOncePromise.then(clearPollOncePromise, clearPollOncePromise).catch(this.reject); - } - return this.pollOncePromise; - } - processUpdatedState() { - if (this.operation.state.error) { - this.stopped = true; - if (!this.resolveOnUnsuccessful) { - this.reject(this.operation.state.error); - throw this.operation.state.error; - } - } - if (this.operation.state.isCancelled) { - this.stopped = true; - if (!this.resolveOnUnsuccessful) { - const error = new PollerCancelledError("Operation was canceled"); - this.reject(error); - throw error; - } - } - if (this.isDone() && this.resolve) { - // If the poller has finished polling, this means we now have a result. - // However, it can be the case that TResult is instantiated to void, so - // we are not expecting a result anyway. To assert that we might not - // have a result eventually after finishing polling, we cast the result - // to TResult. - this.resolve(this.getResult()); - } - } - /** - * Returns a promise that will resolve once the underlying operation is completed. - */ - async pollUntilDone(pollOptions = {}) { - if (this.stopped) { - this.startPolling(pollOptions).catch(this.reject); - } - // This is needed because the state could have been updated by - // `cancelOperation`, e.g. the operation is canceled or an error occurred. - this.processUpdatedState(); - return this.promise; - } - /** - * Invokes the provided callback after each polling is completed, - * sending the current state of the poller's operation. - * - * It returns a method that can be used to stop receiving updates on the given callback function. - */ - onProgress(callback) { - this.pollProgressCallbacks.push(callback); - return () => { - this.pollProgressCallbacks = this.pollProgressCallbacks.filter((c) => c !== callback); - }; - } - /** - * Returns true if the poller has finished polling. - */ - isDone() { - const state = this.operation.state; - return Boolean(state.isCompleted || state.isCancelled || state.error); - } - /** - * Stops the poller from continuing to poll. - */ - stopPolling() { - if (!this.stopped) { - this.stopped = true; - if (this.reject) { - this.reject(new PollerStoppedError("This poller is already stopped")); - } - } - } - /** - * Returns true if the poller is stopped. - */ - isStopped() { - return this.stopped; - } - /** - * Attempts to cancel the underlying operation. - * - * It only optionally receives an object with an abortSignal property, from \@azure/abort-controller's AbortSignalLike. - * - * If it's called again before it finishes, it will throw an error. - * - * @param options - Optional properties passed to the operation's update method. - */ - cancelOperation(options = {}) { - if (!this.cancelPromise) { - this.cancelPromise = this.cancelOnce(options); - } - else if (options.abortSignal) { - throw new Error("A cancel request is currently pending"); - } - return this.cancelPromise; - } - /** - * Returns the state of the operation. - * - * Even though TState will be the same type inside any of the methods of any extension of the Poller class, - * implementations of the pollers can customize what's shared with the public by writing their own - * version of the `getOperationState` method, and by defining two types, one representing the internal state of the poller - * and a public type representing a safe to share subset of the properties of the internal state. - * Their definition of getOperationState can then return their public type. - * - * Example: - * - * ```ts - * // Let's say we have our poller's operation state defined as: - * interface MyOperationState extends PollOperationState { - * privateProperty?: string; - * publicProperty?: string; - * } - * - * // To allow us to have a true separation of public and private state, we have to define another interface: - * interface PublicState extends PollOperationState { - * publicProperty?: string; - * } - * - * // Then, we define our Poller as follows: - * export class MyPoller extends Poller { - * // ... More content is needed here ... - * - * public getOperationState(): PublicState { - * const state: PublicState = this.operation.state; - * return { - * // Properties from PollOperationState - * isStarted: state.isStarted, - * isCompleted: state.isCompleted, - * isCancelled: state.isCancelled, - * error: state.error, - * result: state.result, - * - * // The only other property needed by PublicState. - * publicProperty: state.publicProperty - * } - * } - * } - * ``` - * - * You can see this in the tests of this repository, go to the file: - * `../test/utils/testPoller.ts` - * and look for the getOperationState implementation. - */ - getOperationState() { - return this.operation.state; - } - /** - * Returns the result value of the operation, - * regardless of the state of the poller. - * It can return undefined or an incomplete form of the final TResult value - * depending on the implementation. - */ - getResult() { - const state = this.operation.state; - return state.result; - } - /** - * Returns a serialized version of the poller's operation - * by invoking the operation's toString method. - */ - toString() { - return this.operation.toString(); - } -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * The LRO Engine, a class that performs polling. - */ -class LroEngine extends Poller { - constructor(lro, options) { - const { intervalInMs = POLL_INTERVAL_IN_MS, resumeFrom, resolveOnUnsuccessful = false, isDone, lroResourceLocationConfig, processResult, updateState, } = options || {}; - const state = resumeFrom - ? deserializeState(resumeFrom) - : {}; - const operation = new GenericPollOperation(state, lro, !resolveOnUnsuccessful, lroResourceLocationConfig, processResult, updateState, isDone); - super(operation); - this.resolveOnUnsuccessful = resolveOnUnsuccessful; - this.config = { intervalInMs: intervalInMs }; - operation.setPollerConfig(this.config); - } - /** - * The method used by the poller to wait before attempting to update its operation. - */ - delay() { - return new Promise((resolve) => setTimeout(() => resolve(), this.config.intervalInMs)); - } -} - -exports.LroEngine = LroEngine; -exports.Poller = Poller; -exports.PollerCancelledError = PollerCancelledError; -exports.PollerStoppedError = PollerStoppedError; -exports.createHttpPoller = createHttpPoller; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ 4559: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var tslib = __nccwpck_require__(4351); - -// Copyright (c) Microsoft Corporation. -/** - * returns an async iterator that iterates over results. It also has a `byPage` - * method that returns pages of items at once. - * - * @param pagedResult - an object that specifies how to get pages. - * @returns a paged async iterator that iterates over results. - */ -function getPagedAsyncIterator(pagedResult) { - var _a; - const iter = getItemAsyncIterator(pagedResult); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (_a = pagedResult === null || pagedResult === void 0 ? void 0 : pagedResult.byPage) !== null && _a !== void 0 ? _a : ((settings) => { - const { continuationToken, maxPageSize } = settings !== null && settings !== void 0 ? settings : {}; - return getPageAsyncIterator(pagedResult, { - pageLink: continuationToken, - maxPageSize, - }); - }), - }; -} -function getItemAsyncIterator(pagedResult) { - return tslib.__asyncGenerator(this, arguments, function* getItemAsyncIterator_1() { - var e_1, _a, e_2, _b; - const pages = getPageAsyncIterator(pagedResult); - const firstVal = yield tslib.__await(pages.next()); - // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is - if (!Array.isArray(firstVal.value)) { - // can extract elements from this page - const { toElements } = pagedResult; - if (toElements) { - yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(toElements(firstVal.value)))); - try { - for (var pages_1 = tslib.__asyncValues(pages), pages_1_1; pages_1_1 = yield tslib.__await(pages_1.next()), !pages_1_1.done;) { - const page = pages_1_1.value; - yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(toElements(page)))); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (pages_1_1 && !pages_1_1.done && (_a = pages_1.return)) yield tslib.__await(_a.call(pages_1)); - } - finally { if (e_1) throw e_1.error; } - } - } - else { - yield yield tslib.__await(firstVal.value); - // `pages` is of type `AsyncIterableIterator` but TPage = TElement in this case - yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(pages))); - } - } - else { - yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(firstVal.value))); - try { - for (var pages_2 = tslib.__asyncValues(pages), pages_2_1; pages_2_1 = yield tslib.__await(pages_2.next()), !pages_2_1.done;) { - const page = pages_2_1.value; - // pages is of type `AsyncIterableIterator` so `page` is of type `TPage`. In this branch, - // it must be the case that `TPage = TElement[]` - yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page))); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (pages_2_1 && !pages_2_1.done && (_b = pages_2.return)) yield tslib.__await(_b.call(pages_2)); - } - finally { if (e_2) throw e_2.error; } - } - } - }); -} -function getPageAsyncIterator(pagedResult, options = {}) { - return tslib.__asyncGenerator(this, arguments, function* getPageAsyncIterator_1() { - const { pageLink, maxPageSize } = options; - let response = yield tslib.__await(pagedResult.getPage(pageLink !== null && pageLink !== void 0 ? pageLink : pagedResult.firstPageLink, maxPageSize)); - if (!response) { - return yield tslib.__await(void 0); - } - yield yield tslib.__await(response.page); - while (response.nextPageLink) { - response = yield tslib.__await(pagedResult.getPage(response.nextPageLink, maxPageSize)); - if (!response) { - return yield tslib.__await(void 0); - } - yield yield tslib.__await(response.page); - } - }); -} - -exports.getPagedAsyncIterator = getPagedAsyncIterator; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ 4175: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var api = __nccwpck_require__(5163); - -// Copyright (c) Microsoft Corporation. -(function (SpanKind) { - /** Default value. Indicates that the span is used internally. */ - SpanKind[SpanKind["INTERNAL"] = 0] = "INTERNAL"; - /** - * Indicates that the span covers server-side handling of an RPC or other - * remote request. - */ - SpanKind[SpanKind["SERVER"] = 1] = "SERVER"; - /** - * Indicates that the span covers the client-side wrapper around an RPC or - * other remote request. - */ - SpanKind[SpanKind["CLIENT"] = 2] = "CLIENT"; - /** - * Indicates that the span describes producer sending a message to a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - SpanKind[SpanKind["PRODUCER"] = 3] = "PRODUCER"; - /** - * Indicates that the span describes consumer receiving a message from a - * broker. Unlike client and server, there is no direct critical path latency - * relationship between producer and consumer spans. - */ - SpanKind[SpanKind["CONSUMER"] = 4] = "CONSUMER"; -})(exports.SpanKind || (exports.SpanKind = {})); -/** - * Return the span if one exists - * - * @param context - context to get span from - */ -function getSpan(context) { - return api.trace.getSpan(context); -} -/** - * Set the span on a context - * - * @param context - context to use as parent - * @param span - span to set active - */ -function setSpan(context, span) { - return api.trace.setSpan(context, span); -} -/** - * Wrap span context in a NoopSpan and set as span in a new - * context - * - * @param context - context to set active span on - * @param spanContext - span context to be wrapped - */ -function setSpanContext(context, spanContext) { - return api.trace.setSpanContext(context, spanContext); -} -/** - * Get the span context of the span if it exists. - * - * @param context - context to get values from - */ -function getSpanContext(context) { - return api.trace.getSpanContext(context); -} -/** - * Returns true of the given {@link SpanContext} is valid. - * A valid {@link SpanContext} is one which has a valid trace ID and span ID as per the spec. - * - * @param context - the {@link SpanContext} to validate. - * - * @returns true if the {@link SpanContext} is valid, false otherwise. - */ -function isSpanContextValid(context) { - return api.trace.isSpanContextValid(context); -} -function getTracer(name, version) { - return api.trace.getTracer(name || "azure/core-tracing", version); -} -/** Entrypoint for context API */ -const context = api.context; -(function (SpanStatusCode) { - /** - * The default status. - */ - SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET"; - /** - * The operation has been validated by an Application developer or - * Operator to have completed successfully. - */ - SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK"; - /** - * The operation contains an error. - */ - SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR"; -})(exports.SpanStatusCode || (exports.SpanStatusCode = {})); - -// Copyright (c) Microsoft Corporation. -function isTracingDisabled() { - var _a; - if (typeof process === "undefined") { - // not supported in browser for now without polyfills - return false; - } - const azureTracingDisabledValue = (_a = process.env.AZURE_TRACING_DISABLED) === null || _a === void 0 ? void 0 : _a.toLowerCase(); - if (azureTracingDisabledValue === "false" || azureTracingDisabledValue === "0") { - return false; - } - return Boolean(azureTracingDisabledValue); -} -/** - * Creates a function that can be used to create spans using the global tracer. - * - * Usage: - * - * ```typescript - * // once - * const createSpan = createSpanFunction({ packagePrefix: "Azure.Data.AppConfiguration", namespace: "Microsoft.AppConfiguration" }); - * - * // in each operation - * const span = createSpan("deleteConfigurationSetting", operationOptions); - * // code... - * span.end(); - * ``` - * - * @hidden - * @param args - allows configuration of the prefix for each span as well as the az.namespace field. - */ -function createSpanFunction(args) { - return function (operationName, operationOptions) { - const tracer = getTracer(); - const tracingOptions = (operationOptions === null || operationOptions === void 0 ? void 0 : operationOptions.tracingOptions) || {}; - const spanOptions = Object.assign({ kind: exports.SpanKind.INTERNAL }, tracingOptions.spanOptions); - const spanName = args.packagePrefix ? `${args.packagePrefix}.${operationName}` : operationName; - let span; - if (isTracingDisabled()) { - span = api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT); - } - else { - span = tracer.startSpan(spanName, spanOptions, tracingOptions.tracingContext); - } - if (args.namespace) { - span.setAttribute("az.namespace", args.namespace); - } - let newSpanOptions = tracingOptions.spanOptions || {}; - if (span.isRecording() && args.namespace) { - newSpanOptions = Object.assign(Object.assign({}, tracingOptions.spanOptions), { attributes: Object.assign(Object.assign({}, spanOptions.attributes), { "az.namespace": args.namespace }) }); - } - const newTracingOptions = Object.assign(Object.assign({}, tracingOptions), { spanOptions: newSpanOptions, tracingContext: setSpan(tracingOptions.tracingContext || context.active(), span) }); - const newOperationOptions = Object.assign(Object.assign({}, operationOptions), { tracingOptions: newTracingOptions }); - return { - span, - updatedOptions: newOperationOptions - }; - }; -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -const VERSION = "00"; -/** - * Generates a `SpanContext` given a `traceparent` header value. - * @param traceParent - Serialized span context data as a `traceparent` header value. - * @returns The `SpanContext` generated from the `traceparent` value. - */ -function extractSpanContextFromTraceParentHeader(traceParentHeader) { - const parts = traceParentHeader.split("-"); - if (parts.length !== 4) { - return; - } - const [version, traceId, spanId, traceOptions] = parts; - if (version !== VERSION) { - return; - } - const traceFlags = parseInt(traceOptions, 16); - const spanContext = { - spanId, - traceId, - traceFlags - }; - return spanContext; -} -/** - * Generates a `traceparent` value given a span context. - * @param spanContext - Contains context for a specific span. - * @returns The `spanContext` represented as a `traceparent` value. - */ -function getTraceParentHeader(spanContext) { - const missingFields = []; - if (!spanContext.traceId) { - missingFields.push("traceId"); - } - if (!spanContext.spanId) { - missingFields.push("spanId"); - } - if (missingFields.length) { - return; - } - const flags = spanContext.traceFlags || 0 /* NONE */; - const hexFlags = flags.toString(16); - const traceFlags = hexFlags.length === 1 ? `0${hexFlags}` : hexFlags; - // https://www.w3.org/TR/trace-context/#traceparent-header-field-values - return `${VERSION}-${spanContext.traceId}-${spanContext.spanId}-${traceFlags}`; -} - -exports.context = context; -exports.createSpanFunction = createSpanFunction; -exports.extractSpanContextFromTraceParentHeader = extractSpanContextFromTraceParentHeader; -exports.getSpan = getSpan; -exports.getSpanContext = getSpanContext; -exports.getTraceParentHeader = getTraceParentHeader; -exports.getTracer = getTracer; -exports.isSpanContextValid = isSpanContextValid; -exports.setSpan = setSpan; -exports.setSpanContext = setSpanContext; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ 1333: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var abortController = __nccwpck_require__(4200); -var crypto = __nccwpck_require__(6113); - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Creates an abortable promise. - * @param buildPromise - A function that takes the resolve and reject functions as parameters. - * @param options - The options for the abortable promise. - * @returns A promise that can be aborted. - */ -function createAbortablePromise(buildPromise, options) { - const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options !== null && options !== void 0 ? options : {}; - return new Promise((resolve, reject) => { - function rejectOnAbort() { - reject(new abortController.AbortError(abortErrorMsg !== null && abortErrorMsg !== void 0 ? abortErrorMsg : "The operation was aborted.")); - } - function removeListeners() { - abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.removeEventListener("abort", onAbort); - } - function onAbort() { - cleanupBeforeAbort === null || cleanupBeforeAbort === void 0 ? void 0 : cleanupBeforeAbort(); - removeListeners(); - rejectOnAbort(); - } - if (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted) { - return rejectOnAbort(); - } - try { - buildPromise((x) => { - removeListeners(); - resolve(x); - }, (x) => { - removeListeners(); - reject(x); - }); - } - catch (err) { - reject(err); - } - abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.addEventListener("abort", onAbort); - }); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -const StandardAbortMessage = "The delay was aborted."; -/** - * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds. - * @param timeInMs - The number of milliseconds to be delayed. - * @param options - The options for delay - currently abort options - * @returns Promise that is resolved after timeInMs - */ -function delay(timeInMs, options) { - let token; - const { abortSignal, abortErrorMsg } = options !== null && options !== void 0 ? options : {}; - return createAbortablePromise((resolve) => { - token = setTimeout(resolve, timeInMs); - }, { - cleanupBeforeAbort: () => clearTimeout(token), - abortSignal, - abortErrorMsg: abortErrorMsg !== null && abortErrorMsg !== void 0 ? abortErrorMsg : StandardAbortMessage, - }); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * promise.race() wrapper that aborts rest of promises as soon as the first promise settles. - */ -async function cancelablePromiseRace(abortablePromiseBuilders, options) { - var _a, _b; - const aborter = new AbortController(); - function abortHandler() { - aborter.abort(); - } - (_a = options === null || options === void 0 ? void 0 : options.abortSignal) === null || _a === void 0 ? void 0 : _a.addEventListener("abort", abortHandler); - try { - return await Promise.race(abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal }))); - } - finally { - aborter.abort(); - (_b = options === null || options === void 0 ? void 0 : options.abortSignal) === null || _b === void 0 ? void 0 : _b.removeEventListener("abort", abortHandler); - } -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Returns a random integer value between a lower and upper bound, - * inclusive of both bounds. - * Note that this uses Math.random and isn't secure. If you need to use - * this for any kind of security purpose, find a better source of random. - * @param min - The smallest integer value allowed. - * @param max - The largest integer value allowed. - */ -function getRandomIntegerInclusive(min, max) { - // Make sure inputs are integers. - min = Math.ceil(min); - max = Math.floor(max); - // Pick a random offset from zero to the size of the range. - // Since Math.random() can never return 1, we have to make the range one larger - // in order to be inclusive of the maximum value after we take the floor. - const offset = Math.floor(Math.random() * (max - min + 1)); - return offset + min; -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Helper to determine when an input is a generic JS object. - * @returns true when input is an object type that is not null, Array, RegExp, or Date. - */ -function isObject(input) { - return (typeof input === "object" && - input !== null && - !Array.isArray(input) && - !(input instanceof RegExp) && - !(input instanceof Date)); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Typeguard for an error object shape (has name and message) - * @param e - Something caught by a catch clause. - */ -function isError(e) { - if (isObject(e)) { - const hasName = typeof e.name === "string"; - const hasMessage = typeof e.message === "string"; - return hasName && hasMessage; - } - return false; -} -/** - * Given what is thought to be an error object, return the message if possible. - * If the message is missing, returns a stringified version of the input. - * @param e - Something thrown from a try block - * @returns The error message or a string of the input - */ -function getErrorMessage(e) { - if (isError(e)) { - return e.message; - } - else { - let stringified; - try { - if (typeof e === "object" && e) { - stringified = JSON.stringify(e); - } - else { - stringified = String(e); - } - } - catch (err) { - stringified = "[unable to stringify input]"; - } - return `Unknown error ${stringified}`; - } -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Generates a SHA-256 HMAC signature. - * @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash. - * @param stringToSign - The data to be signed. - * @param encoding - The textual encoding to use for the returned HMAC digest. - */ -async function computeSha256Hmac(key, stringToSign, encoding) { - const decodedKey = Buffer.from(key, "base64"); - return crypto.createHmac("sha256", decodedKey).update(stringToSign).digest(encoding); -} -/** - * Generates a SHA-256 hash. - * @param content - The data to be included in the hash. - * @param encoding - The textual encoding to use for the returned hash. - */ -async function computeSha256Hash(content, encoding) { - return crypto.createHash("sha256").update(content).digest(encoding); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * Helper TypeGuard that checks if something is defined or not. - * @param thing - Anything - */ -function isDefined(thing) { - return typeof thing !== "undefined" && thing !== null; -} -/** - * Helper TypeGuard that checks if the input is an object with the specified properties. - * @param thing - Anything. - * @param properties - The name of the properties that should appear in the object. - */ -function isObjectWithProperties(thing, properties) { - if (!isDefined(thing) || typeof thing !== "object") { - return false; - } - for (const property of properties) { - if (!objectHasProperty(thing, property)) { - return false; - } - } - return true; -} -/** - * Helper TypeGuard that checks if the input is an object with the specified property. - * @param thing - Any object. - * @param property - The name of the property that should appear in the object. - */ -function objectHasProperty(thing, property) { - return (isDefined(thing) && typeof thing === "object" && property in thing); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/* - * NOTE: When moving this file, please update "react-native" section in package.json. - */ -/** - * Generated Universally Unique Identifier - * - * @returns RFC4122 v4 UUID. - */ -function generateUUID() { - let uuid = ""; - for (let i = 0; i < 32; i++) { - // Generate a random number between 0 and 15 - const randomNumber = Math.floor(Math.random() * 16); - // Set the UUID version to 4 in the 13th position - if (i === 12) { - uuid += "4"; - } - else if (i === 16) { - // Set the UUID variant to "10" in the 17th position - uuid += (randomNumber & 0x3) | 0x8; - } - else { - // Add a random hexadecimal digit to the UUID string - uuid += randomNumber.toString(16); - } - // Add hyphens to the UUID string at the appropriate positions - if (i === 7 || i === 11 || i === 15 || i === 19) { - uuid += "-"; - } - } - return uuid; -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -var _a$1; -// NOTE: This is a workaround until we can use `globalThis.crypto.randomUUID` in Node.js 19+. -let uuidFunction = typeof ((_a$1 = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a$1 === void 0 ? void 0 : _a$1.randomUUID) === "function" - ? globalThis.crypto.randomUUID.bind(globalThis.crypto) - : crypto.randomUUID; -// Not defined in earlier versions of Node.js 14 -if (!uuidFunction) { - uuidFunction = generateUUID; -} -/** - * Generated Universally Unique Identifier - * - * @returns RFC4122 v4 UUID. - */ -function randomUUID() { - return uuidFunction(); -} - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -var _a, _b, _c, _d; -/** - * A constant that indicates whether the environment the code is running is a Web Browser. - */ -// eslint-disable-next-line @azure/azure-sdk/ts-no-window -const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; -/** - * A constant that indicates whether the environment the code is running is a Web Worker. - */ -const isWebWorker = typeof self === "object" && - typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" && - (((_a = self.constructor) === null || _a === void 0 ? void 0 : _a.name) === "DedicatedWorkerGlobalScope" || - ((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "ServiceWorkerGlobalScope" || - ((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "SharedWorkerGlobalScope"); -/** - * A constant that indicates whether the environment the code is running is Deno. - */ -const isDeno = typeof Deno !== "undefined" && - typeof Deno.version !== "undefined" && - typeof Deno.version.deno !== "undefined"; -/** - * A constant that indicates whether the environment the code is running is Node.JS. - */ -const isNode = typeof process !== "undefined" && - Boolean(process.version) && - Boolean((_d = process.versions) === null || _d === void 0 ? void 0 : _d.node) && - // Deno thought it was a good idea to spoof process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions - !isDeno; -/** - * A constant that indicates whether the environment the code is running is Bun.sh. - */ -const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; -/** - * A constant that indicates whether the environment the code is running is in React-Native. - */ -// https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js -const isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === void 0 ? void 0 : navigator.product) === "ReactNative"; - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * The helper that transforms bytes with specific character encoding into string - * @param bytes - the uint8array bytes - * @param format - the format we use to encode the byte - * @returns a string of the encoded string - */ -function uint8ArrayToString(bytes, format) { - return Buffer.from(bytes).toString(format); -} -/** - * The helper that transforms string to specific character encoded bytes array. - * @param value - the string to be converted - * @param format - the format we use to decode the value - * @returns a uint8array - */ -function stringToUint8Array(value, format) { - return Buffer.from(value, format); -} - -exports.cancelablePromiseRace = cancelablePromiseRace; -exports.computeSha256Hash = computeSha256Hash; -exports.computeSha256Hmac = computeSha256Hmac; -exports.createAbortablePromise = createAbortablePromise; -exports.delay = delay; -exports.getErrorMessage = getErrorMessage; -exports.getRandomIntegerInclusive = getRandomIntegerInclusive; -exports.isBrowser = isBrowser; -exports.isBun = isBun; -exports.isDefined = isDefined; -exports.isDeno = isDeno; -exports.isError = isError; -exports.isNode = isNode; -exports.isObject = isObject; -exports.isObjectWithProperties = isObjectWithProperties; -exports.isReactNative = isReactNative; -exports.isWebWorker = isWebWorker; -exports.objectHasProperty = objectHasProperty; -exports.randomUUID = randomUUID; -exports.stringToUint8Array = stringToUint8Array; -exports.uint8ArrayToString = uint8ArrayToString; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ 4200: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -/** - * This error is thrown when an asynchronous operation has been aborted. - * Check for this error by testing the `name` that the name property of the - * error matches `"AbortError"`. - * - * @example - * ```ts - * const controller = new AbortController(); - * controller.abort(); - * try { - * doAsyncWork(controller.signal) - * } catch (e) { - * if (e.name === 'AbortError') { - * // handle abort error here. - * } - * } - * ``` - */ -class AbortError extends Error { - constructor(message) { - super(message); - this.name = "AbortError"; - } -} - -exports.AbortError = AbortError; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ 3233: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var os = __nccwpck_require__(2037); -var util = __nccwpck_require__(3837); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var util__default = /*#__PURE__*/_interopDefaultLegacy(util); - -// Copyright (c) Microsoft Corporation. -function log(message, ...args) { - process.stderr.write(`${util__default["default"].format(message, ...args)}${os.EOL}`); -} - -// Copyright (c) Microsoft Corporation. -const debugEnvVariable = (typeof process !== "undefined" && process.env && process.env.DEBUG) || undefined; -let enabledString; -let enabledNamespaces = []; -let skippedNamespaces = []; -const debuggers = []; -if (debugEnvVariable) { - enable(debugEnvVariable); -} -const debugObj = Object.assign((namespace) => { - return createDebugger(namespace); -}, { - enable, - enabled, - disable, - log, -}); -function enable(namespaces) { - enabledString = namespaces; - enabledNamespaces = []; - skippedNamespaces = []; - const wildcard = /\*/g; - const namespaceList = namespaces.split(",").map((ns) => ns.trim().replace(wildcard, ".*?")); - for (const ns of namespaceList) { - if (ns.startsWith("-")) { - skippedNamespaces.push(new RegExp(`^${ns.substr(1)}$`)); - } - else { - enabledNamespaces.push(new RegExp(`^${ns}$`)); - } - } - for (const instance of debuggers) { - instance.enabled = enabled(instance.namespace); - } -} -function enabled(namespace) { - if (namespace.endsWith("*")) { - return true; - } - for (const skipped of skippedNamespaces) { - if (skipped.test(namespace)) { - return false; - } - } - for (const enabledNamespace of enabledNamespaces) { - if (enabledNamespace.test(namespace)) { - return true; - } - } - return false; -} -function disable() { - const result = enabledString || ""; - enable(""); - return result; -} -function createDebugger(namespace) { - const newDebugger = Object.assign(debug, { - enabled: enabled(namespace), - destroy, - log: debugObj.log, - namespace, - extend, - }); - function debug(...args) { - if (!newDebugger.enabled) { - return; - } - if (args.length > 0) { - args[0] = `${namespace} ${args[0]}`; - } - newDebugger.log(...args); - } - debuggers.push(newDebugger); - return newDebugger; -} -function destroy() { - const index = debuggers.indexOf(this); - if (index >= 0) { - debuggers.splice(index, 1); - return true; - } - return false; -} -function extend(namespace) { - const newDebugger = createDebugger(`${this.namespace}:${namespace}`); - newDebugger.log = this.log; - return newDebugger; -} -var debug = debugObj; - -// Copyright (c) Microsoft Corporation. -const registeredLoggers = new Set(); -const logLevelFromEnv = (typeof process !== "undefined" && process.env && process.env.AZURE_LOG_LEVEL) || undefined; -let azureLogLevel; -/** - * The AzureLogger provides a mechanism for overriding where logs are output to. - * By default, logs are sent to stderr. - * Override the `log` method to redirect logs to another location. - */ -const AzureLogger = debug("azure"); -AzureLogger.log = (...args) => { - debug.log(...args); -}; -const AZURE_LOG_LEVELS = ["verbose", "info", "warning", "error"]; -if (logLevelFromEnv) { - // avoid calling setLogLevel because we don't want a mis-set environment variable to crash - if (isAzureLogLevel(logLevelFromEnv)) { - setLogLevel(logLevelFromEnv); - } - else { - console.error(`AZURE_LOG_LEVEL set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${AZURE_LOG_LEVELS.join(", ")}.`); - } -} -/** - * Immediately enables logging at the specified log level. If no level is specified, logging is disabled. - * @param level - The log level to enable for logging. - * Options from most verbose to least verbose are: - * - verbose - * - info - * - warning - * - error - */ -function setLogLevel(level) { - if (level && !isAzureLogLevel(level)) { - throw new Error(`Unknown log level '${level}'. Acceptable values: ${AZURE_LOG_LEVELS.join(",")}`); - } - azureLogLevel = level; - const enabledNamespaces = []; - for (const logger of registeredLoggers) { - if (shouldEnable(logger)) { - enabledNamespaces.push(logger.namespace); - } - } - debug.enable(enabledNamespaces.join(",")); -} -/** - * Retrieves the currently specified log level. - */ -function getLogLevel() { - return azureLogLevel; -} -const levelMap = { - verbose: 400, - info: 300, - warning: 200, - error: 100, -}; -/** - * Creates a logger for use by the Azure SDKs that inherits from `AzureLogger`. - * @param namespace - The name of the SDK package. - * @hidden - */ -function createClientLogger(namespace) { - const clientRootLogger = AzureLogger.extend(namespace); - patchLogMethod(AzureLogger, clientRootLogger); - return { - error: createLogger(clientRootLogger, "error"), - warning: createLogger(clientRootLogger, "warning"), - info: createLogger(clientRootLogger, "info"), - verbose: createLogger(clientRootLogger, "verbose"), - }; -} -function patchLogMethod(parent, child) { - child.log = (...args) => { - parent.log(...args); - }; -} -function createLogger(parent, level) { - const logger = Object.assign(parent.extend(level), { - level, - }); - patchLogMethod(parent, logger); - if (shouldEnable(logger)) { - const enabledNamespaces = debug.disable(); - debug.enable(enabledNamespaces + "," + logger.namespace); - } - registeredLoggers.add(logger); - return logger; -} -function shouldEnable(logger) { - return Boolean(azureLogLevel && levelMap[logger.level] <= levelMap[azureLogLevel]); -} -function isAzureLogLevel(logLevel) { - return AZURE_LOG_LEVELS.includes(logLevel); -} - -exports.AzureLogger = AzureLogger; -exports.createClientLogger = createClientLogger; -exports.getLogLevel = getLogLevel; -exports.setLogLevel = setLogLevel; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ 4100: -/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var coreHttp = __nccwpck_require__(4607); -var tslib = __nccwpck_require__(4351); -var coreTracing = __nccwpck_require__(4175); -var logger$1 = __nccwpck_require__(3233); -var abortController = __nccwpck_require__(978); -var os = __nccwpck_require__(2037); -var crypto = __nccwpck_require__(6113); -var stream = __nccwpck_require__(2781); -__nccwpck_require__(4559); -var coreLro = __nccwpck_require__(7094); -var events = __nccwpck_require__(2361); -var fs = __nccwpck_require__(7147); -var util = __nccwpck_require__(3837); - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n["default"] = e; - return Object.freeze(n); -} - -var coreHttp__namespace = /*#__PURE__*/_interopNamespace(coreHttp); -var os__namespace = /*#__PURE__*/_interopNamespace(os); -var fs__namespace = /*#__PURE__*/_interopNamespace(fs); -var util__namespace = /*#__PURE__*/_interopNamespace(util); - -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ -const BlobServiceProperties = { - serializedName: "BlobServiceProperties", - xmlName: "StorageServiceProperties", - type: { - name: "Composite", - className: "BlobServiceProperties", - modelProperties: { - blobAnalyticsLogging: { - serializedName: "Logging", - xmlName: "Logging", - type: { - name: "Composite", - className: "Logging" - } - }, - hourMetrics: { - serializedName: "HourMetrics", - xmlName: "HourMetrics", - type: { - name: "Composite", - className: "Metrics" - } - }, - minuteMetrics: { - serializedName: "MinuteMetrics", - xmlName: "MinuteMetrics", - type: { - name: "Composite", - className: "Metrics" - } - }, - cors: { - serializedName: "Cors", - xmlName: "Cors", - xmlIsWrapped: true, - xmlElementName: "CorsRule", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "CorsRule" - } - } - } - }, - defaultServiceVersion: { - serializedName: "DefaultServiceVersion", - xmlName: "DefaultServiceVersion", - type: { - name: "String" - } - }, - deleteRetentionPolicy: { - serializedName: "DeleteRetentionPolicy", - xmlName: "DeleteRetentionPolicy", - type: { - name: "Composite", - className: "RetentionPolicy" - } - }, - staticWebsite: { - serializedName: "StaticWebsite", - xmlName: "StaticWebsite", - type: { - name: "Composite", - className: "StaticWebsite" - } - } - } - } -}; -const Logging = { - serializedName: "Logging", - type: { - name: "Composite", - className: "Logging", - modelProperties: { - version: { - serializedName: "Version", - required: true, - xmlName: "Version", - type: { - name: "String" + } + } + } +}; +const Logging = { + serializedName: "Logging", + type: { + name: "Composite", + className: "Logging", + modelProperties: { + version: { + serializedName: "Version", + required: true, + xmlName: "Version", + type: { + name: "String" } }, deleteProperty: { @@ -47427,12 +45290,12 @@ var TraceFlags; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.VERSION = void 0; // this is autogenerated file, see scripts/version-update.js -exports.VERSION = '1.7.0'; +exports.VERSION = '1.8.0'; //# sourceMappingURL=version.js.map /***/ }), -/***/ 4812: +/***/ 6284: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { module.exports = @@ -67384,6 +65247,9 @@ function httpRedirectFetch (fetchParams, response) { // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name request.headersList.delete('authorization') + // https://fetch.spec.whatwg.org/#authentication-entries + request.headersList.delete('proxy-authorization', true) + // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement. request.headersList.delete('cookie') request.headersList.delete('host') @@ -78484,1256 +76350,2104 @@ function percentEncode(c) { return "%" + hex; } -function utf8PercentEncode(c) { - const buf = new Buffer(c); - - let str = ""; +function utf8PercentEncode(c) { + const buf = new Buffer(c); + + let str = ""; + + for (let i = 0; i < buf.length; ++i) { + str += percentEncode(buf[i]); + } + + return str; +} + +function utf8PercentDecode(str) { + const input = new Buffer(str); + const output = []; + for (let i = 0; i < input.length; ++i) { + if (input[i] !== 37) { + output.push(input[i]); + } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { + output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); + i += 2; + } else { + output.push(input[i]); + } + } + return new Buffer(output).toString(); +} + +function isC0ControlPercentEncode(c) { + return c <= 0x1F || c > 0x7E; +} + +const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); +function isPathPercentEncode(c) { + return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); +} + +const extraUserinfoPercentEncodeSet = + new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); +function isUserinfoPercentEncode(c) { + return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); +} + +function percentEncodeChar(c, encodeSetPredicate) { + const cStr = String.fromCodePoint(c); + + if (encodeSetPredicate(c)) { + return utf8PercentEncode(cStr); + } + + return cStr; +} + +function parseIPv4Number(input) { + let R = 10; + + if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { + input = input.substring(2); + R = 16; + } else if (input.length >= 2 && input.charAt(0) === "0") { + input = input.substring(1); + R = 8; + } + + if (input === "") { + return 0; + } + + const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); + if (regex.test(input)) { + return failure; + } + + return parseInt(input, R); +} + +function parseIPv4(input) { + const parts = input.split("."); + if (parts[parts.length - 1] === "") { + if (parts.length > 1) { + parts.pop(); + } + } + + if (parts.length > 4) { + return input; + } + + const numbers = []; + for (const part of parts) { + if (part === "") { + return input; + } + const n = parseIPv4Number(part); + if (n === failure) { + return input; + } + + numbers.push(n); + } + + for (let i = 0; i < numbers.length - 1; ++i) { + if (numbers[i] > 255) { + return failure; + } + } + if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { + return failure; + } + + let ipv4 = numbers.pop(); + let counter = 0; + + for (const n of numbers) { + ipv4 += n * Math.pow(256, 3 - counter); + ++counter; + } + + return ipv4; +} + +function serializeIPv4(address) { + let output = ""; + let n = address; + + for (let i = 1; i <= 4; ++i) { + output = String(n % 256) + output; + if (i !== 4) { + output = "." + output; + } + n = Math.floor(n / 256); + } + + return output; +} + +function parseIPv6(input) { + const address = [0, 0, 0, 0, 0, 0, 0, 0]; + let pieceIndex = 0; + let compress = null; + let pointer = 0; + + input = punycode.ucs2.decode(input); + + if (input[pointer] === 58) { + if (input[pointer + 1] !== 58) { + return failure; + } + + pointer += 2; + ++pieceIndex; + compress = pieceIndex; + } + + while (pointer < input.length) { + if (pieceIndex === 8) { + return failure; + } + + if (input[pointer] === 58) { + if (compress !== null) { + return failure; + } + ++pointer; + ++pieceIndex; + compress = pieceIndex; + continue; + } + + let value = 0; + let length = 0; + + while (length < 4 && isASCIIHex(input[pointer])) { + value = value * 0x10 + parseInt(at(input, pointer), 16); + ++pointer; + ++length; + } + + if (input[pointer] === 46) { + if (length === 0) { + return failure; + } + + pointer -= length; + + if (pieceIndex > 6) { + return failure; + } + + let numbersSeen = 0; + + while (input[pointer] !== undefined) { + let ipv4Piece = null; + + if (numbersSeen > 0) { + if (input[pointer] === 46 && numbersSeen < 4) { + ++pointer; + } else { + return failure; + } + } + + if (!isASCIIDigit(input[pointer])) { + return failure; + } + + while (isASCIIDigit(input[pointer])) { + const number = parseInt(at(input, pointer)); + if (ipv4Piece === null) { + ipv4Piece = number; + } else if (ipv4Piece === 0) { + return failure; + } else { + ipv4Piece = ipv4Piece * 10 + number; + } + if (ipv4Piece > 255) { + return failure; + } + ++pointer; + } + + address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; + + ++numbersSeen; + + if (numbersSeen === 2 || numbersSeen === 4) { + ++pieceIndex; + } + } + + if (numbersSeen !== 4) { + return failure; + } + + break; + } else if (input[pointer] === 58) { + ++pointer; + if (input[pointer] === undefined) { + return failure; + } + } else if (input[pointer] !== undefined) { + return failure; + } + + address[pieceIndex] = value; + ++pieceIndex; + } + + if (compress !== null) { + let swaps = pieceIndex - compress; + pieceIndex = 7; + while (pieceIndex !== 0 && swaps > 0) { + const temp = address[compress + swaps - 1]; + address[compress + swaps - 1] = address[pieceIndex]; + address[pieceIndex] = temp; + --pieceIndex; + --swaps; + } + } else if (compress === null && pieceIndex !== 8) { + return failure; + } + + return address; +} + +function serializeIPv6(address) { + let output = ""; + const seqResult = findLongestZeroSequence(address); + const compress = seqResult.idx; + let ignore0 = false; + + for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { + if (ignore0 && address[pieceIndex] === 0) { + continue; + } else if (ignore0) { + ignore0 = false; + } + + if (compress === pieceIndex) { + const separator = pieceIndex === 0 ? "::" : ":"; + output += separator; + ignore0 = true; + continue; + } + + output += address[pieceIndex].toString(16); + + if (pieceIndex !== 7) { + output += ":"; + } + } + + return output; +} + +function parseHost(input, isSpecialArg) { + if (input[0] === "[") { + if (input[input.length - 1] !== "]") { + return failure; + } + + return parseIPv6(input.substring(1, input.length - 1)); + } + + if (!isSpecialArg) { + return parseOpaqueHost(input); + } + + const domain = utf8PercentDecode(input); + const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); + if (asciiDomain === null) { + return failure; + } + + if (containsForbiddenHostCodePoint(asciiDomain)) { + return failure; + } + + const ipv4Host = parseIPv4(asciiDomain); + if (typeof ipv4Host === "number" || ipv4Host === failure) { + return ipv4Host; + } + + return asciiDomain; +} + +function parseOpaqueHost(input) { + if (containsForbiddenHostCodePointExcludingPercent(input)) { + return failure; + } + + let output = ""; + const decoded = punycode.ucs2.decode(input); + for (let i = 0; i < decoded.length; ++i) { + output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); + } + return output; +} + +function findLongestZeroSequence(arr) { + let maxIdx = null; + let maxLen = 1; // only find elements > 1 + let currStart = null; + let currLen = 0; + + for (let i = 0; i < arr.length; ++i) { + if (arr[i] !== 0) { + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + currStart = null; + currLen = 0; + } else { + if (currStart === null) { + currStart = i; + } + ++currLen; + } + } + + // if trailing zeros + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + return { + idx: maxIdx, + len: maxLen + }; +} + +function serializeHost(host) { + if (typeof host === "number") { + return serializeIPv4(host); + } + + // IPv6 serializer + if (host instanceof Array) { + return "[" + serializeIPv6(host) + "]"; + } + + return host; +} + +function trimControlChars(url) { + return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); +} + +function trimTabAndNewline(url) { + return url.replace(/\u0009|\u000A|\u000D/g, ""); +} - for (let i = 0; i < buf.length; ++i) { - str += percentEncode(buf[i]); +function shortenPath(url) { + const path = url.path; + if (path.length === 0) { + return; + } + if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { + return; } - return str; + path.pop(); } -function utf8PercentDecode(str) { - const input = new Buffer(str); - const output = []; - for (let i = 0; i < input.length; ++i) { - if (input[i] !== 37) { - output.push(input[i]); - } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { - output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); - i += 2; - } else { - output.push(input[i]); - } - } - return new Buffer(output).toString(); +function includesCredentials(url) { + return url.username !== "" || url.password !== ""; } -function isC0ControlPercentEncode(c) { - return c <= 0x1F || c > 0x7E; +function cannotHaveAUsernamePasswordPort(url) { + return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; } -const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); -function isPathPercentEncode(c) { - return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); +function isNormalizedWindowsDriveLetter(string) { + return /^[A-Za-z]:$/.test(string); } -const extraUserinfoPercentEncodeSet = - new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); -function isUserinfoPercentEncode(c) { - return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); -} +function URLStateMachine(input, base, encodingOverride, url, stateOverride) { + this.pointer = 0; + this.input = input; + this.base = base || null; + this.encodingOverride = encodingOverride || "utf-8"; + this.stateOverride = stateOverride; + this.url = url; + this.failure = false; + this.parseError = false; -function percentEncodeChar(c, encodeSetPredicate) { - const cStr = String.fromCodePoint(c); + if (!this.url) { + this.url = { + scheme: "", + username: "", + password: "", + host: null, + port: null, + path: [], + query: null, + fragment: null, - if (encodeSetPredicate(c)) { - return utf8PercentEncode(cStr); + cannotBeABaseURL: false + }; + + const res = trimControlChars(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; } - return cStr; -} + const res = trimTabAndNewline(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; -function parseIPv4Number(input) { - let R = 10; + this.state = stateOverride || "scheme start"; - if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { - input = input.substring(2); - R = 16; - } else if (input.length >= 2 && input.charAt(0) === "0") { - input = input.substring(1); - R = 8; - } + this.buffer = ""; + this.atFlag = false; + this.arrFlag = false; + this.passwordTokenSeenFlag = false; - if (input === "") { - return 0; + this.input = punycode.ucs2.decode(this.input); + + for (; this.pointer <= this.input.length; ++this.pointer) { + const c = this.input[this.pointer]; + const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); + + // exec state machine + const ret = this["parse " + this.state](c, cStr); + if (!ret) { + break; // terminate algorithm + } else if (ret === failure) { + this.failure = true; + break; + } } +} - const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); - if (regex.test(input)) { +URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { + if (isASCIIAlpha(c)) { + this.buffer += cStr.toLowerCase(); + this.state = "scheme"; + } else if (!this.stateOverride) { + this.state = "no scheme"; + --this.pointer; + } else { + this.parseError = true; return failure; } - return parseInt(input, R); -} + return true; +}; -function parseIPv4(input) { - const parts = input.split("."); - if (parts[parts.length - 1] === "") { - if (parts.length > 1) { - parts.pop(); - } - } +URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { + if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { + this.buffer += cStr.toLowerCase(); + } else if (c === 58) { + if (this.stateOverride) { + if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { + return false; + } - if (parts.length > 4) { - return input; - } + if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { + return false; + } - const numbers = []; - for (const part of parts) { - if (part === "") { - return input; + if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { + return false; + } + + if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { + return false; + } } - const n = parseIPv4Number(part); - if (n === failure) { - return input; + this.url.scheme = this.buffer; + this.buffer = ""; + if (this.stateOverride) { + return false; } - - numbers.push(n); - } - - for (let i = 0; i < numbers.length - 1; ++i) { - if (numbers[i] > 255) { - return failure; + if (this.url.scheme === "file") { + if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { + this.parseError = true; + } + this.state = "file"; + } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { + this.state = "special relative or authority"; + } else if (isSpecial(this.url)) { + this.state = "special authority slashes"; + } else if (this.input[this.pointer + 1] === 47) { + this.state = "path or authority"; + ++this.pointer; + } else { + this.url.cannotBeABaseURL = true; + this.url.path.push(""); + this.state = "cannot-be-a-base-URL path"; } - } - if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { + } else if (!this.stateOverride) { + this.buffer = ""; + this.state = "no scheme"; + this.pointer = -1; + } else { + this.parseError = true; return failure; } - let ipv4 = numbers.pop(); - let counter = 0; + return true; +}; - for (const n of numbers) { - ipv4 += n * Math.pow(256, 3 - counter); - ++counter; +URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { + if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { + return failure; + } else if (this.base.cannotBeABaseURL && c === 35) { + this.url.scheme = this.base.scheme; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.url.cannotBeABaseURL = true; + this.state = "fragment"; + } else if (this.base.scheme === "file") { + this.state = "file"; + --this.pointer; + } else { + this.state = "relative"; + --this.pointer; } - return ipv4; -} - -function serializeIPv4(address) { - let output = ""; - let n = address; + return true; +}; - for (let i = 1; i <= 4; ++i) { - output = String(n % 256) + output; - if (i !== 4) { - output = "." + output; - } - n = Math.floor(n / 256); +URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "relative"; + --this.pointer; } - return output; -} + return true; +}; -function parseIPv6(input) { - const address = [0, 0, 0, 0, 0, 0, 0, 0]; - let pieceIndex = 0; - let compress = null; - let pointer = 0; +URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { + if (c === 47) { + this.state = "authority"; + } else { + this.state = "path"; + --this.pointer; + } - input = punycode.ucs2.decode(input); + return true; +}; - if (input[pointer] === 58) { - if (input[pointer + 1] !== 58) { - return failure; - } +URLStateMachine.prototype["parse relative"] = function parseRelative(c) { + this.url.scheme = this.base.scheme; + if (isNaN(c)) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 47) { + this.state = "relative slash"; + } else if (c === 63) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else if (isSpecial(this.url) && c === 92) { + this.parseError = true; + this.state = "relative slash"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(0, this.base.path.length - 1); - pointer += 2; - ++pieceIndex; - compress = pieceIndex; + this.state = "path"; + --this.pointer; } - while (pointer < input.length) { - if (pieceIndex === 8) { - return failure; - } + return true; +}; - if (input[pointer] === 58) { - if (compress !== null) { - return failure; - } - ++pointer; - ++pieceIndex; - compress = pieceIndex; - continue; +URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { + if (isSpecial(this.url) && (c === 47 || c === 92)) { + if (c === 92) { + this.parseError = true; } + this.state = "special authority ignore slashes"; + } else if (c === 47) { + this.state = "authority"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.state = "path"; + --this.pointer; + } - let value = 0; - let length = 0; + return true; +}; - while (length < 4 && isASCIIHex(input[pointer])) { - value = value * 0x10 + parseInt(at(input, pointer), 16); - ++pointer; - ++length; - } +URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "special authority ignore slashes"; + --this.pointer; + } - if (input[pointer] === 46) { - if (length === 0) { - return failure; - } + return true; +}; - pointer -= length; +URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { + if (c !== 47 && c !== 92) { + this.state = "authority"; + --this.pointer; + } else { + this.parseError = true; + } - if (pieceIndex > 6) { - return failure; - } + return true; +}; - let numbersSeen = 0; +URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { + if (c === 64) { + this.parseError = true; + if (this.atFlag) { + this.buffer = "%40" + this.buffer; + } + this.atFlag = true; - while (input[pointer] !== undefined) { - let ipv4Piece = null; + // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars + const len = countSymbols(this.buffer); + for (let pointer = 0; pointer < len; ++pointer) { + const codePoint = this.buffer.codePointAt(pointer); - if (numbersSeen > 0) { - if (input[pointer] === 46 && numbersSeen < 4) { - ++pointer; - } else { - return failure; - } - } + if (codePoint === 58 && !this.passwordTokenSeenFlag) { + this.passwordTokenSeenFlag = true; + continue; + } + const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); + if (this.passwordTokenSeenFlag) { + this.url.password += encodedCodePoints; + } else { + this.url.username += encodedCodePoints; + } + } + this.buffer = ""; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + if (this.atFlag && this.buffer === "") { + this.parseError = true; + return failure; + } + this.pointer -= countSymbols(this.buffer) + 1; + this.buffer = ""; + this.state = "host"; + } else { + this.buffer += cStr; + } - if (!isASCIIDigit(input[pointer])) { - return failure; - } + return true; +}; - while (isASCIIDigit(input[pointer])) { - const number = parseInt(at(input, pointer)); - if (ipv4Piece === null) { - ipv4Piece = number; - } else if (ipv4Piece === 0) { - return failure; - } else { - ipv4Piece = ipv4Piece * 10 + number; - } - if (ipv4Piece > 255) { - return failure; - } - ++pointer; - } +URLStateMachine.prototype["parse hostname"] = +URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { + if (this.stateOverride && this.url.scheme === "file") { + --this.pointer; + this.state = "file host"; + } else if (c === 58 && !this.arrFlag) { + if (this.buffer === "") { + this.parseError = true; + return failure; + } - address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } - ++numbersSeen; + this.url.host = host; + this.buffer = ""; + this.state = "port"; + if (this.stateOverride === "hostname") { + return false; + } + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + --this.pointer; + if (isSpecial(this.url) && this.buffer === "") { + this.parseError = true; + return failure; + } else if (this.stateOverride && this.buffer === "" && + (includesCredentials(this.url) || this.url.port !== null)) { + this.parseError = true; + return false; + } - if (numbersSeen === 2 || numbersSeen === 4) { - ++pieceIndex; - } - } + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } - if (numbersSeen !== 4) { - return failure; - } + this.url.host = host; + this.buffer = ""; + this.state = "path start"; + if (this.stateOverride) { + return false; + } + } else { + if (c === 91) { + this.arrFlag = true; + } else if (c === 93) { + this.arrFlag = false; + } + this.buffer += cStr; + } - break; - } else if (input[pointer] === 58) { - ++pointer; - if (input[pointer] === undefined) { + return true; +}; + +URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { + if (isASCIIDigit(c)) { + this.buffer += cStr; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92) || + this.stateOverride) { + if (this.buffer !== "") { + const port = parseInt(this.buffer); + if (port > Math.pow(2, 16) - 1) { + this.parseError = true; return failure; } - } else if (input[pointer] !== undefined) { - return failure; + this.url.port = port === defaultPort(this.url.scheme) ? null : port; + this.buffer = ""; } - - address[pieceIndex] = value; - ++pieceIndex; - } - - if (compress !== null) { - let swaps = pieceIndex - compress; - pieceIndex = 7; - while (pieceIndex !== 0 && swaps > 0) { - const temp = address[compress + swaps - 1]; - address[compress + swaps - 1] = address[pieceIndex]; - address[pieceIndex] = temp; - --pieceIndex; - --swaps; + if (this.stateOverride) { + return false; } - } else if (compress === null && pieceIndex !== 8) { + this.state = "path start"; + --this.pointer; + } else { + this.parseError = true; return failure; } - return address; -} + return true; +}; -function serializeIPv6(address) { - let output = ""; - const seqResult = findLongestZeroSequence(address); - const compress = seqResult.idx; - let ignore0 = false; +const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); - for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { - if (ignore0 && address[pieceIndex] === 0) { - continue; - } else if (ignore0) { - ignore0 = false; - } +URLStateMachine.prototype["parse file"] = function parseFile(c) { + this.url.scheme = "file"; - if (compress === pieceIndex) { - const separator = pieceIndex === 0 ? "::" : ":"; - output += separator; - ignore0 = true; - continue; + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; } + this.state = "file slash"; + } else if (this.base !== null && this.base.scheme === "file") { + if (isNaN(c)) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 63) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else { + if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points + !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || + (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points + !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + shortenPath(this.url); + } else { + this.parseError = true; + } - output += address[pieceIndex].toString(16); - - if (pieceIndex !== 7) { - output += ":"; + this.state = "path"; + --this.pointer; } + } else { + this.state = "path"; + --this.pointer; } - return output; -} + return true; +}; -function parseHost(input, isSpecialArg) { - if (input[0] === "[") { - if (input[input.length - 1] !== "]") { - return failure; +URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; } - - return parseIPv6(input.substring(1, input.length - 1)); + this.state = "file host"; + } else { + if (this.base !== null && this.base.scheme === "file") { + if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { + this.url.path.push(this.base.path[0]); + } else { + this.url.host = this.base.host; + } + } + this.state = "path"; + --this.pointer; } - if (!isSpecialArg) { - return parseOpaqueHost(input); - } + return true; +}; - const domain = utf8PercentDecode(input); - const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); - if (asciiDomain === null) { - return failure; - } +URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { + if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { + --this.pointer; + if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { + this.parseError = true; + this.state = "path"; + } else if (this.buffer === "") { + this.url.host = ""; + if (this.stateOverride) { + return false; + } + this.state = "path start"; + } else { + let host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + if (host === "localhost") { + host = ""; + } + this.url.host = host; - if (containsForbiddenHostCodePoint(asciiDomain)) { - return failure; - } + if (this.stateOverride) { + return false; + } - const ipv4Host = parseIPv4(asciiDomain); - if (typeof ipv4Host === "number" || ipv4Host === failure) { - return ipv4Host; + this.buffer = ""; + this.state = "path start"; + } + } else { + this.buffer += cStr; } - return asciiDomain; -} + return true; +}; -function parseOpaqueHost(input) { - if (containsForbiddenHostCodePointExcludingPercent(input)) { - return failure; - } +URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { + if (isSpecial(this.url)) { + if (c === 92) { + this.parseError = true; + } + this.state = "path"; - let output = ""; - const decoded = punycode.ucs2.decode(input); - for (let i = 0; i < decoded.length; ++i) { - output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); + if (c !== 47 && c !== 92) { + --this.pointer; + } + } else if (!this.stateOverride && c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (!this.stateOverride && c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else if (c !== undefined) { + this.state = "path"; + if (c !== 47) { + --this.pointer; + } } - return output; -} -function findLongestZeroSequence(arr) { - let maxIdx = null; - let maxLen = 1; // only find elements > 1 - let currStart = null; - let currLen = 0; + return true; +}; - for (let i = 0; i < arr.length; ++i) { - if (arr[i] !== 0) { - if (currLen > maxLen) { - maxIdx = currStart; - maxLen = currLen; - } +URLStateMachine.prototype["parse path"] = function parsePath(c) { + if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || + (!this.stateOverride && (c === 63 || c === 35))) { + if (isSpecial(this.url) && c === 92) { + this.parseError = true; + } - currStart = null; - currLen = 0; - } else { - if (currStart === null) { - currStart = i; + if (isDoubleDot(this.buffer)) { + shortenPath(this.url); + if (c !== 47 && !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); } - ++currLen; + } else if (isSingleDot(this.buffer) && c !== 47 && + !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } else if (!isSingleDot(this.buffer)) { + if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { + if (this.url.host !== "" && this.url.host !== null) { + this.parseError = true; + this.url.host = ""; + } + this.buffer = this.buffer[0] + ":"; + } + this.url.path.push(this.buffer); } - } - - // if trailing zeros - if (currLen > maxLen) { - maxIdx = currStart; - maxLen = currLen; - } - - return { - idx: maxIdx, - len: maxLen - }; -} + this.buffer = ""; + if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { + while (this.url.path.length > 1 && this.url.path[0] === "") { + this.parseError = true; + this.url.path.shift(); + } + } + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. -function serializeHost(host) { - if (typeof host === "number") { - return serializeIPv4(host); - } + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } - // IPv6 serializer - if (host instanceof Array) { - return "[" + serializeIPv6(host) + "]"; + this.buffer += percentEncodeChar(c, isPathPercentEncode); } - return host; -} + return true; +}; -function trimControlChars(url) { - return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); -} +URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else { + // TODO: Add: not a URL code point + if (!isNaN(c) && c !== 37) { + this.parseError = true; + } -function trimTabAndNewline(url) { - return url.replace(/\u0009|\u000A|\u000D/g, ""); -} + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } -function shortenPath(url) { - const path = url.path; - if (path.length === 0) { - return; - } - if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { - return; + if (!isNaN(c)) { + this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); + } } - path.pop(); -} - -function includesCredentials(url) { - return url.username !== "" || url.password !== ""; -} + return true; +}; -function cannotHaveAUsernamePasswordPort(url) { - return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; -} +URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { + if (isNaN(c) || (!this.stateOverride && c === 35)) { + if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { + this.encodingOverride = "utf-8"; + } -function isNormalizedWindowsDriveLetter(string) { - return /^[A-Za-z]:$/.test(string); -} + const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead + for (let i = 0; i < buffer.length; ++i) { + if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || + buffer[i] === 0x3C || buffer[i] === 0x3E) { + this.url.query += percentEncode(buffer[i]); + } else { + this.url.query += String.fromCodePoint(buffer[i]); + } + } -function URLStateMachine(input, base, encodingOverride, url, stateOverride) { - this.pointer = 0; - this.input = input; - this.base = base || null; - this.encodingOverride = encodingOverride || "utf-8"; - this.stateOverride = stateOverride; - this.url = url; - this.failure = false; - this.parseError = false; + this.buffer = ""; + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } - if (!this.url) { - this.url = { - scheme: "", - username: "", - password: "", - host: null, - port: null, - path: [], - query: null, - fragment: null, + this.buffer += cStr; + } - cannotBeABaseURL: false - }; + return true; +}; - const res = trimControlChars(this.input); - if (res !== this.input) { +URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { + if (isNaN(c)) { // do nothing + } else if (c === 0x0) { + this.parseError = true; + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { this.parseError = true; } - this.input = res; - } - const res = trimTabAndNewline(this.input); - if (res !== this.input) { - this.parseError = true; + this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); } - this.input = res; - this.state = stateOverride || "scheme start"; + return true; +}; - this.buffer = ""; - this.atFlag = false; - this.arrFlag = false; - this.passwordTokenSeenFlag = false; +function serializeURL(url, excludeFragment) { + let output = url.scheme + ":"; + if (url.host !== null) { + output += "//"; - this.input = punycode.ucs2.decode(this.input); + if (url.username !== "" || url.password !== "") { + output += url.username; + if (url.password !== "") { + output += ":" + url.password; + } + output += "@"; + } - for (; this.pointer <= this.input.length; ++this.pointer) { - const c = this.input[this.pointer]; - const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); + output += serializeHost(url.host); - // exec state machine - const ret = this["parse " + this.state](c, cStr); - if (!ret) { - break; // terminate algorithm - } else if (ret === failure) { - this.failure = true; - break; + if (url.port !== null) { + output += ":" + url.port; } + } else if (url.host === null && url.scheme === "file") { + output += "//"; } -} -URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { - if (isASCIIAlpha(c)) { - this.buffer += cStr.toLowerCase(); - this.state = "scheme"; - } else if (!this.stateOverride) { - this.state = "no scheme"; - --this.pointer; + if (url.cannotBeABaseURL) { + output += url.path[0]; } else { - this.parseError = true; - return failure; + for (const string of url.path) { + output += "/" + string; + } } - return true; -}; + if (url.query !== null) { + output += "?" + url.query; + } -URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { - if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { - this.buffer += cStr.toLowerCase(); - } else if (c === 58) { - if (this.stateOverride) { - if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { - return false; - } + if (!excludeFragment && url.fragment !== null) { + output += "#" + url.fragment; + } - if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { - return false; - } + return output; +} - if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { - return false; - } +function serializeOrigin(tuple) { + let result = tuple.scheme + "://"; + result += serializeHost(tuple.host); - if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { - return false; - } - } - this.url.scheme = this.buffer; - this.buffer = ""; - if (this.stateOverride) { - return false; - } - if (this.url.scheme === "file") { - if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { - this.parseError = true; - } - this.state = "file"; - } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { - this.state = "special relative or authority"; - } else if (isSpecial(this.url)) { - this.state = "special authority slashes"; - } else if (this.input[this.pointer + 1] === 47) { - this.state = "path or authority"; - ++this.pointer; - } else { - this.url.cannotBeABaseURL = true; - this.url.path.push(""); - this.state = "cannot-be-a-base-URL path"; - } - } else if (!this.stateOverride) { - this.buffer = ""; - this.state = "no scheme"; - this.pointer = -1; - } else { - this.parseError = true; - return failure; + if (tuple.port !== null) { + result += ":" + tuple.port; } - return true; -}; + return result; +} -URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { - if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { - return failure; - } else if (this.base.cannotBeABaseURL && c === 35) { - this.url.scheme = this.base.scheme; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.url.cannotBeABaseURL = true; - this.state = "fragment"; - } else if (this.base.scheme === "file") { - this.state = "file"; - --this.pointer; - } else { - this.state = "relative"; - --this.pointer; - } +module.exports.serializeURL = serializeURL; - return true; +module.exports.serializeURLOrigin = function (url) { + // https://url.spec.whatwg.org/#concept-url-origin + switch (url.scheme) { + case "blob": + try { + return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); + } catch (e) { + // serializing an opaque origin returns "null" + return "null"; + } + case "ftp": + case "gopher": + case "http": + case "https": + case "ws": + case "wss": + return serializeOrigin({ + scheme: url.scheme, + host: url.host, + port: url.port + }); + case "file": + // spec says "exercise to the reader", chrome says "file://" + return "file://"; + default: + // serializing an opaque origin returns "null" + return "null"; + } }; -URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { - if (c === 47 && this.input[this.pointer + 1] === 47) { - this.state = "special authority ignore slashes"; - ++this.pointer; - } else { - this.parseError = true; - this.state = "relative"; - --this.pointer; +module.exports.basicURLParse = function (input, options) { + if (options === undefined) { + options = {}; } - return true; + const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); + if (usm.failure) { + return "failure"; + } + + return usm.url; }; -URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { - if (c === 47) { - this.state = "authority"; - } else { - this.state = "path"; - --this.pointer; +module.exports.setTheUsername = function (url, username) { + url.username = ""; + const decoded = punycode.ucs2.decode(username); + for (let i = 0; i < decoded.length; ++i) { + url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); } +}; - return true; +module.exports.setThePassword = function (url, password) { + url.password = ""; + const decoded = punycode.ucs2.decode(password); + for (let i = 0; i < decoded.length; ++i) { + url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } }; -URLStateMachine.prototype["parse relative"] = function parseRelative(c) { - this.url.scheme = this.base.scheme; - if (isNaN(c)) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - } else if (c === 47) { - this.state = "relative slash"; - } else if (c === 63) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.state = "fragment"; - } else if (isSpecial(this.url) && c === 92) { - this.parseError = true; - this.state = "relative slash"; - } else { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.url.path = this.base.path.slice(0, this.base.path.length - 1); +module.exports.serializeHost = serializeHost; - this.state = "path"; - --this.pointer; - } +module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; - return true; +module.exports.serializeInteger = function (integer) { + return String(integer); }; -URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { - if (isSpecial(this.url) && (c === 47 || c === 92)) { - if (c === 92) { - this.parseError = true; - } - this.state = "special authority ignore slashes"; - } else if (c === 47) { - this.state = "authority"; - } else { - this.url.username = this.base.username; - this.url.password = this.base.password; - this.url.host = this.base.host; - this.url.port = this.base.port; - this.state = "path"; - --this.pointer; +module.exports.parseURL = function (input, options) { + if (options === undefined) { + options = {}; } - return true; + // We don't handle blobs, so this just delegates: + return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); }; -URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { - if (c === 47 && this.input[this.pointer + 1] === 47) { - this.state = "special authority ignore slashes"; - ++this.pointer; - } else { - this.parseError = true; - this.state = "special authority ignore slashes"; - --this.pointer; - } - return true; -}; +/***/ }), -URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { - if (c !== 47 && c !== 92) { - this.state = "authority"; - --this.pointer; - } else { - this.parseError = true; +/***/ 3185: +/***/ ((module) => { + +"use strict"; + + +module.exports.mixin = function mixin(target, source) { + const keys = Object.getOwnPropertyNames(source); + for (let i = 0; i < keys.length; ++i) { + Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i])); } +}; - return true; +module.exports.wrapperSymbol = Symbol("wrapper"); +module.exports.implSymbol = Symbol("impl"); + +module.exports.wrapperForImpl = function (impl) { + return impl[module.exports.wrapperSymbol]; }; -URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { - if (c === 64) { - this.parseError = true; - if (this.atFlag) { - this.buffer = "%40" + this.buffer; +module.exports.implForWrapper = function (wrapper) { + return wrapper[module.exports.implSymbol]; +}; + + + +/***/ }), + +/***/ 2624: +/***/ (function(__unused_webpack_module, exports) { + +// Generated by CoffeeScript 1.12.7 +(function() { + "use strict"; + exports.stripBOM = function(str) { + if (str[0] === '\uFEFF') { + return str.substring(1); + } else { + return str; } - this.atFlag = true; + }; - // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars - const len = countSymbols(this.buffer); - for (let pointer = 0; pointer < len; ++pointer) { - const codePoint = this.buffer.codePointAt(pointer); +}).call(this); - if (codePoint === 58 && !this.passwordTokenSeenFlag) { - this.passwordTokenSeenFlag = true; - continue; + +/***/ }), + +/***/ 3337: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +// Generated by CoffeeScript 1.12.7 +(function() { + "use strict"; + var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA, + hasProp = {}.hasOwnProperty; + + builder = __nccwpck_require__(2958); + + defaults = (__nccwpck_require__(7251).defaults); + + requiresCDATA = function(entry) { + return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0); + }; + + wrapCDATA = function(entry) { + return ""; + }; + + escapeCDATA = function(entry) { + return entry.replace(']]>', ']]]]>'); + }; + + exports.Builder = (function() { + function Builder(opts) { + var key, ref, value; + this.options = {}; + ref = defaults["0.2"]; + for (key in ref) { + if (!hasProp.call(ref, key)) continue; + value = ref[key]; + this.options[key] = value; } - const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); - if (this.passwordTokenSeenFlag) { - this.url.password += encodedCodePoints; - } else { - this.url.username += encodedCodePoints; + for (key in opts) { + if (!hasProp.call(opts, key)) continue; + value = opts[key]; + this.options[key] = value; } } - this.buffer = ""; - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92)) { - if (this.atFlag && this.buffer === "") { - this.parseError = true; - return failure; - } - this.pointer -= countSymbols(this.buffer) + 1; - this.buffer = ""; - this.state = "host"; - } else { - this.buffer += cStr; - } - return true; -}; + Builder.prototype.buildObject = function(rootObj) { + var attrkey, charkey, render, rootElement, rootName; + attrkey = this.options.attrkey; + charkey = this.options.charkey; + if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) { + rootName = Object.keys(rootObj)[0]; + rootObj = rootObj[rootName]; + } else { + rootName = this.options.rootName; + } + render = (function(_this) { + return function(element, obj) { + var attr, child, entry, index, key, value; + if (typeof obj !== 'object') { + if (_this.options.cdata && requiresCDATA(obj)) { + element.raw(wrapCDATA(obj)); + } else { + element.txt(obj); + } + } else if (Array.isArray(obj)) { + for (index in obj) { + if (!hasProp.call(obj, index)) continue; + child = obj[index]; + for (key in child) { + entry = child[key]; + element = render(element.ele(key), entry).up(); + } + } + } else { + for (key in obj) { + if (!hasProp.call(obj, key)) continue; + child = obj[key]; + if (key === attrkey) { + if (typeof child === "object") { + for (attr in child) { + value = child[attr]; + element = element.att(attr, value); + } + } + } else if (key === charkey) { + if (_this.options.cdata && requiresCDATA(child)) { + element = element.raw(wrapCDATA(child)); + } else { + element = element.txt(child); + } + } else if (Array.isArray(child)) { + for (index in child) { + if (!hasProp.call(child, index)) continue; + entry = child[index]; + if (typeof entry === 'string') { + if (_this.options.cdata && requiresCDATA(entry)) { + element = element.ele(key).raw(wrapCDATA(entry)).up(); + } else { + element = element.ele(key, entry).up(); + } + } else { + element = render(element.ele(key), entry).up(); + } + } + } else if (typeof child === "object") { + element = render(element.ele(key), child).up(); + } else { + if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) { + element = element.ele(key).raw(wrapCDATA(child)).up(); + } else { + if (child == null) { + child = ''; + } + element = element.ele(key, child.toString()).up(); + } + } + } + } + return element; + }; + })(this); + rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, { + headless: this.options.headless, + allowSurrogateChars: this.options.allowSurrogateChars + }); + return render(rootElement, rootObj).end(this.options.renderOpts); + }; -URLStateMachine.prototype["parse hostname"] = -URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { - if (this.stateOverride && this.url.scheme === "file") { - --this.pointer; - this.state = "file host"; - } else if (c === 58 && !this.arrFlag) { - if (this.buffer === "") { - this.parseError = true; - return failure; - } + return Builder; - const host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } + })(); - this.url.host = host; - this.buffer = ""; - this.state = "port"; - if (this.stateOverride === "hostname") { - return false; - } - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92)) { - --this.pointer; - if (isSpecial(this.url) && this.buffer === "") { - this.parseError = true; - return failure; - } else if (this.stateOverride && this.buffer === "" && - (includesCredentials(this.url) || this.url.port !== null)) { - this.parseError = true; - return false; - } +}).call(this); - const host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; - } - this.url.host = host; - this.buffer = ""; - this.state = "path start"; - if (this.stateOverride) { - return false; - } - } else { - if (c === 91) { - this.arrFlag = true; - } else if (c === 93) { - this.arrFlag = false; - } - this.buffer += cStr; - } +/***/ }), - return true; -}; +/***/ 7251: +/***/ (function(__unused_webpack_module, exports) { -URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { - if (isASCIIDigit(c)) { - this.buffer += cStr; - } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || - (isSpecial(this.url) && c === 92) || - this.stateOverride) { - if (this.buffer !== "") { - const port = parseInt(this.buffer); - if (port > Math.pow(2, 16) - 1) { - this.parseError = true; - return failure; - } - this.url.port = port === defaultPort(this.url.scheme) ? null : port; - this.buffer = ""; - } - if (this.stateOverride) { - return false; - } - this.state = "path start"; - --this.pointer; - } else { - this.parseError = true; - return failure; - } +// Generated by CoffeeScript 1.12.7 +(function() { + exports.defaults = { + "0.1": { + explicitCharkey: false, + trim: true, + normalize: true, + normalizeTags: false, + attrkey: "@", + charkey: "#", + explicitArray: false, + ignoreAttrs: false, + mergeAttrs: false, + explicitRoot: false, + validator: null, + xmlns: false, + explicitChildren: false, + childkey: '@@', + charsAsChildren: false, + includeWhiteChars: false, + async: false, + strict: true, + attrNameProcessors: null, + attrValueProcessors: null, + tagNameProcessors: null, + valueProcessors: null, + emptyTag: '' + }, + "0.2": { + explicitCharkey: false, + trim: false, + normalize: false, + normalizeTags: false, + attrkey: "$", + charkey: "_", + explicitArray: true, + ignoreAttrs: false, + mergeAttrs: false, + explicitRoot: true, + validator: null, + xmlns: false, + explicitChildren: false, + preserveChildrenOrder: false, + childkey: '$$', + charsAsChildren: false, + includeWhiteChars: false, + async: false, + strict: true, + attrNameProcessors: null, + attrValueProcessors: null, + tagNameProcessors: null, + valueProcessors: null, + rootName: 'root', + xmldec: { + 'version': '1.0', + 'encoding': 'UTF-8', + 'standalone': true + }, + doctype: null, + renderOpts: { + 'pretty': true, + 'indent': ' ', + 'newline': '\n' + }, + headless: false, + chunkSize: 10000, + emptyTag: '', + cdata: false + } + }; - return true; -}; +}).call(this); -const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); -URLStateMachine.prototype["parse file"] = function parseFile(c) { - this.url.scheme = "file"; +/***/ }), - if (c === 47 || c === 92) { - if (c === 92) { - this.parseError = true; - } - this.state = "file slash"; - } else if (this.base !== null && this.base.scheme === "file") { - if (isNaN(c)) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - } else if (c === 63) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - this.url.query = this.base.query; - this.url.fragment = ""; - this.state = "fragment"; - } else { - if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points - !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || - (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points - !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { - this.url.host = this.base.host; - this.url.path = this.base.path.slice(); - shortenPath(this.url); - } else { - this.parseError = true; - } +/***/ 3314: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - this.state = "path"; - --this.pointer; - } - } else { - this.state = "path"; - --this.pointer; - } +// Generated by CoffeeScript 1.12.7 +(function() { + "use strict"; + var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate, + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - return true; -}; + sax = __nccwpck_require__(2043); -URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { - if (c === 47 || c === 92) { - if (c === 92) { - this.parseError = true; - } - this.state = "file host"; - } else { - if (this.base !== null && this.base.scheme === "file") { - if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { - this.url.path.push(this.base.path[0]); - } else { - this.url.host = this.base.host; - } + events = __nccwpck_require__(2361); + + bom = __nccwpck_require__(2624); + + processors = __nccwpck_require__(9236); + + setImmediate = (__nccwpck_require__(9512).setImmediate); + + defaults = (__nccwpck_require__(7251).defaults); + + isEmpty = function(thing) { + return typeof thing === "object" && (thing != null) && Object.keys(thing).length === 0; + }; + + processItem = function(processors, item, key) { + var i, len, process; + for (i = 0, len = processors.length; i < len; i++) { + process = processors[i]; + item = process(item, key); } - this.state = "path"; - --this.pointer; - } + return item; + }; - return true; -}; + exports.Parser = (function(superClass) { + extend(Parser, superClass); -URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { - if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { - --this.pointer; - if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { - this.parseError = true; - this.state = "path"; - } else if (this.buffer === "") { - this.url.host = ""; - if (this.stateOverride) { - return false; + function Parser(opts) { + this.parseStringPromise = bind(this.parseStringPromise, this); + this.parseString = bind(this.parseString, this); + this.reset = bind(this.reset, this); + this.assignOrPush = bind(this.assignOrPush, this); + this.processAsync = bind(this.processAsync, this); + var key, ref, value; + if (!(this instanceof exports.Parser)) { + return new exports.Parser(opts); } - this.state = "path start"; - } else { - let host = parseHost(this.buffer, isSpecial(this.url)); - if (host === failure) { - return failure; + this.options = {}; + ref = defaults["0.2"]; + for (key in ref) { + if (!hasProp.call(ref, key)) continue; + value = ref[key]; + this.options[key] = value; } - if (host === "localhost") { - host = ""; + for (key in opts) { + if (!hasProp.call(opts, key)) continue; + value = opts[key]; + this.options[key] = value; } - this.url.host = host; + if (this.options.xmlns) { + this.options.xmlnskey = this.options.attrkey + "ns"; + } + if (this.options.normalizeTags) { + if (!this.options.tagNameProcessors) { + this.options.tagNameProcessors = []; + } + this.options.tagNameProcessors.unshift(processors.normalize); + } + this.reset(); + } - if (this.stateOverride) { - return false; + Parser.prototype.processAsync = function() { + var chunk, err; + try { + if (this.remaining.length <= this.options.chunkSize) { + chunk = this.remaining; + this.remaining = ''; + this.saxParser = this.saxParser.write(chunk); + return this.saxParser.close(); + } else { + chunk = this.remaining.substr(0, this.options.chunkSize); + this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length); + this.saxParser = this.saxParser.write(chunk); + return setImmediate(this.processAsync); + } + } catch (error1) { + err = error1; + if (!this.saxParser.errThrown) { + this.saxParser.errThrown = true; + return this.emit(err); + } } + }; - this.buffer = ""; - this.state = "path start"; - } - } else { - this.buffer += cStr; - } + Parser.prototype.assignOrPush = function(obj, key, newValue) { + if (!(key in obj)) { + if (!this.options.explicitArray) { + return obj[key] = newValue; + } else { + return obj[key] = [newValue]; + } + } else { + if (!(obj[key] instanceof Array)) { + obj[key] = [obj[key]]; + } + return obj[key].push(newValue); + } + }; - return true; -}; + Parser.prototype.reset = function() { + var attrkey, charkey, ontext, stack; + this.removeAllListeners(); + this.saxParser = sax.parser(this.options.strict, { + trim: false, + normalize: false, + xmlns: this.options.xmlns + }); + this.saxParser.errThrown = false; + this.saxParser.onerror = (function(_this) { + return function(error) { + _this.saxParser.resume(); + if (!_this.saxParser.errThrown) { + _this.saxParser.errThrown = true; + return _this.emit("error", error); + } + }; + })(this); + this.saxParser.onend = (function(_this) { + return function() { + if (!_this.saxParser.ended) { + _this.saxParser.ended = true; + return _this.emit("end", _this.resultObject); + } + }; + })(this); + this.saxParser.ended = false; + this.EXPLICIT_CHARKEY = this.options.explicitCharkey; + this.resultObject = null; + stack = []; + attrkey = this.options.attrkey; + charkey = this.options.charkey; + this.saxParser.onopentag = (function(_this) { + return function(node) { + var key, newValue, obj, processedKey, ref; + obj = Object.create(null); + obj[charkey] = ""; + if (!_this.options.ignoreAttrs) { + ref = node.attributes; + for (key in ref) { + if (!hasProp.call(ref, key)) continue; + if (!(attrkey in obj) && !_this.options.mergeAttrs) { + obj[attrkey] = Object.create(null); + } + newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key]; + processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key; + if (_this.options.mergeAttrs) { + _this.assignOrPush(obj, processedKey, newValue); + } else { + obj[attrkey][processedKey] = newValue; + } + } + } + obj["#name"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name; + if (_this.options.xmlns) { + obj[_this.options.xmlnskey] = { + uri: node.uri, + local: node.local + }; + } + return stack.push(obj); + }; + })(this); + this.saxParser.onclosetag = (function(_this) { + return function() { + var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath; + obj = stack.pop(); + nodeName = obj["#name"]; + if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) { + delete obj["#name"]; + } + if (obj.cdata === true) { + cdata = obj.cdata; + delete obj.cdata; + } + s = stack[stack.length - 1]; + if (obj[charkey].match(/^\s*$/) && !cdata) { + emptyStr = obj[charkey]; + delete obj[charkey]; + } else { + if (_this.options.trim) { + obj[charkey] = obj[charkey].trim(); + } + if (_this.options.normalize) { + obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim(); + } + obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey]; + if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) { + obj = obj[charkey]; + } + } + if (isEmpty(obj)) { + if (typeof _this.options.emptyTag === 'function') { + obj = _this.options.emptyTag(); + } else { + obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr; + } + } + if (_this.options.validator != null) { + xpath = "/" + ((function() { + var i, len, results; + results = []; + for (i = 0, len = stack.length; i < len; i++) { + node = stack[i]; + results.push(node["#name"]); + } + return results; + })()).concat(nodeName).join("/"); + (function() { + var err; + try { + return obj = _this.options.validator(xpath, s && s[nodeName], obj); + } catch (error1) { + err = error1; + return _this.emit("error", err); + } + })(); + } + if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') { + if (!_this.options.preserveChildrenOrder) { + node = Object.create(null); + if (_this.options.attrkey in obj) { + node[_this.options.attrkey] = obj[_this.options.attrkey]; + delete obj[_this.options.attrkey]; + } + if (!_this.options.charsAsChildren && _this.options.charkey in obj) { + node[_this.options.charkey] = obj[_this.options.charkey]; + delete obj[_this.options.charkey]; + } + if (Object.getOwnPropertyNames(obj).length > 0) { + node[_this.options.childkey] = obj; + } + obj = node; + } else if (s) { + s[_this.options.childkey] = s[_this.options.childkey] || []; + objClone = Object.create(null); + for (key in obj) { + if (!hasProp.call(obj, key)) continue; + objClone[key] = obj[key]; + } + s[_this.options.childkey].push(objClone); + delete obj["#name"]; + if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) { + obj = obj[charkey]; + } + } + } + if (stack.length > 0) { + return _this.assignOrPush(s, nodeName, obj); + } else { + if (_this.options.explicitRoot) { + old = obj; + obj = Object.create(null); + obj[nodeName] = old; + } + _this.resultObject = obj; + _this.saxParser.ended = true; + return _this.emit("end", _this.resultObject); + } + }; + })(this); + ontext = (function(_this) { + return function(text) { + var charChild, s; + s = stack[stack.length - 1]; + if (s) { + s[charkey] += text; + if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, '').trim() !== '')) { + s[_this.options.childkey] = s[_this.options.childkey] || []; + charChild = { + '#name': '__text__' + }; + charChild[charkey] = text; + if (_this.options.normalize) { + charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim(); + } + s[_this.options.childkey].push(charChild); + } + return s; + } + }; + })(this); + this.saxParser.ontext = ontext; + return this.saxParser.oncdata = (function(_this) { + return function(text) { + var s; + s = ontext(text); + if (s) { + return s.cdata = true; + } + }; + })(this); + }; -URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { - if (isSpecial(this.url)) { - if (c === 92) { - this.parseError = true; - } - this.state = "path"; + Parser.prototype.parseString = function(str, cb) { + var err; + if ((cb != null) && typeof cb === "function") { + this.on("end", function(result) { + this.reset(); + return cb(null, result); + }); + this.on("error", function(err) { + this.reset(); + return cb(err); + }); + } + try { + str = str.toString(); + if (str.trim() === '') { + this.emit("end", null); + return true; + } + str = bom.stripBOM(str); + if (this.options.async) { + this.remaining = str; + setImmediate(this.processAsync); + return this.saxParser; + } + return this.saxParser.write(str).close(); + } catch (error1) { + err = error1; + if (!(this.saxParser.errThrown || this.saxParser.ended)) { + this.emit('error', err); + return this.saxParser.errThrown = true; + } else if (this.saxParser.ended) { + throw err; + } + } + }; - if (c !== 47 && c !== 92) { - --this.pointer; - } - } else if (!this.stateOverride && c === 63) { - this.url.query = ""; - this.state = "query"; - } else if (!this.stateOverride && c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } else if (c !== undefined) { - this.state = "path"; - if (c !== 47) { - --this.pointer; - } - } + Parser.prototype.parseStringPromise = function(str) { + return new Promise((function(_this) { + return function(resolve, reject) { + return _this.parseString(str, function(err, value) { + if (err) { + return reject(err); + } else { + return resolve(value); + } + }); + }; + })(this)); + }; - return true; -}; + return Parser; -URLStateMachine.prototype["parse path"] = function parsePath(c) { - if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || - (!this.stateOverride && (c === 63 || c === 35))) { - if (isSpecial(this.url) && c === 92) { - this.parseError = true; - } + })(events); - if (isDoubleDot(this.buffer)) { - shortenPath(this.url); - if (c !== 47 && !(isSpecial(this.url) && c === 92)) { - this.url.path.push(""); + exports.parseString = function(str, a, b) { + var cb, options, parser; + if (b != null) { + if (typeof b === 'function') { + cb = b; } - } else if (isSingleDot(this.buffer) && c !== 47 && - !(isSpecial(this.url) && c === 92)) { - this.url.path.push(""); - } else if (!isSingleDot(this.buffer)) { - if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { - if (this.url.host !== "" && this.url.host !== null) { - this.parseError = true; - this.url.host = ""; - } - this.buffer = this.buffer[0] + ":"; + if (typeof a === 'object') { + options = a; } - this.url.path.push(this.buffer); - } - this.buffer = ""; - if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { - while (this.url.path.length > 1 && this.url.path[0] === "") { - this.parseError = true; - this.url.path.shift(); + } else { + if (typeof a === 'function') { + cb = a; } + options = {}; } - if (c === 63) { - this.url.query = ""; - this.state = "query"; - } - if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } - } else { - // TODO: If c is not a URL code point and not "%", parse error. + parser = new exports.Parser(options); + return parser.parseString(str, cb); + }; - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; + exports.parseStringPromise = function(str, a) { + var options, parser; + if (typeof a === 'object') { + options = a; } + parser = new exports.Parser(options); + return parser.parseStringPromise(str); + }; - this.buffer += percentEncodeChar(c, isPathPercentEncode); - } +}).call(this); - return true; -}; -URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { - if (c === 63) { - this.url.query = ""; - this.state = "query"; - } else if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; - } else { - // TODO: Add: not a URL code point - if (!isNaN(c) && c !== 37) { - this.parseError = true; - } +/***/ }), - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } +/***/ 9236: +/***/ (function(__unused_webpack_module, exports) { - if (!isNaN(c)) { - this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); - } - } +// Generated by CoffeeScript 1.12.7 +(function() { + "use strict"; + var prefixMatch; - return true; -}; + prefixMatch = new RegExp(/(?!xmlns)^.*:/); -URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { - if (isNaN(c) || (!this.stateOverride && c === 35)) { - if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { - this.encodingOverride = "utf-8"; - } + exports.normalize = function(str) { + return str.toLowerCase(); + }; - const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead - for (let i = 0; i < buffer.length; ++i) { - if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || - buffer[i] === 0x3C || buffer[i] === 0x3E) { - this.url.query += percentEncode(buffer[i]); - } else { - this.url.query += String.fromCodePoint(buffer[i]); - } - } + exports.firstCharLowerCase = function(str) { + return str.charAt(0).toLowerCase() + str.slice(1); + }; - this.buffer = ""; - if (c === 35) { - this.url.fragment = ""; - this.state = "fragment"; + exports.stripPrefix = function(str) { + return str.replace(prefixMatch, ''); + }; + + exports.parseNumbers = function(str) { + if (!isNaN(str)) { + str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str); } - } else { - // TODO: If c is not a URL code point and not "%", parse error. - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; + return str; + }; + + exports.parseBooleans = function(str) { + if (/^(?:true|false)$/i.test(str)) { + str = str.toLowerCase() === 'true'; } + return str; + }; - this.buffer += cStr; - } +}).call(this); - return true; -}; -URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { - if (isNaN(c)) { // do nothing - } else if (c === 0x0) { - this.parseError = true; - } else { - // TODO: If c is not a URL code point and not "%", parse error. - if (c === 37 && - (!isASCIIHex(this.input[this.pointer + 1]) || - !isASCIIHex(this.input[this.pointer + 2]))) { - this.parseError = true; - } +/***/ }), - this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); - } +/***/ 6189: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { - return true; -}; +// Generated by CoffeeScript 1.12.7 +(function() { + "use strict"; + var builder, defaults, parser, processors, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; -function serializeURL(url, excludeFragment) { - let output = url.scheme + ":"; - if (url.host !== null) { - output += "//"; + defaults = __nccwpck_require__(7251); - if (url.username !== "" || url.password !== "") { - output += url.username; - if (url.password !== "") { - output += ":" + url.password; - } - output += "@"; - } + builder = __nccwpck_require__(3337); - output += serializeHost(url.host); + parser = __nccwpck_require__(3314); - if (url.port !== null) { - output += ":" + url.port; - } - } else if (url.host === null && url.scheme === "file") { - output += "//"; - } + processors = __nccwpck_require__(9236); - if (url.cannotBeABaseURL) { - output += url.path[0]; - } else { - for (const string of url.path) { - output += "/" + string; - } - } + exports.defaults = defaults.defaults; - if (url.query !== null) { - output += "?" + url.query; - } + exports.processors = processors; - if (!excludeFragment && url.fragment !== null) { - output += "#" + url.fragment; - } + exports.ValidationError = (function(superClass) { + extend(ValidationError, superClass); - return output; -} + function ValidationError(message) { + this.message = message; + } -function serializeOrigin(tuple) { - let result = tuple.scheme + "://"; - result += serializeHost(tuple.host); + return ValidationError; - if (tuple.port !== null) { - result += ":" + tuple.port; - } + })(Error); - return result; -} + exports.Builder = builder.Builder; -module.exports.serializeURL = serializeURL; + exports.Parser = parser.Parser; -module.exports.serializeURLOrigin = function (url) { - // https://url.spec.whatwg.org/#concept-url-origin - switch (url.scheme) { - case "blob": - try { - return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); - } catch (e) { - // serializing an opaque origin returns "null" - return "null"; - } - case "ftp": - case "gopher": - case "http": - case "https": - case "ws": - case "wss": - return serializeOrigin({ - scheme: url.scheme, - host: url.host, - port: url.port - }); - case "file": - // spec says "exercise to the reader", chrome says "file://" - return "file://"; - default: - // serializing an opaque origin returns "null" - return "null"; - } -}; + exports.parseString = parser.parseString; -module.exports.basicURLParse = function (input, options) { - if (options === undefined) { - options = {}; - } + exports.parseStringPromise = parser.parseStringPromise; - const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); - if (usm.failure) { - return "failure"; - } +}).call(this); - return usm.url; -}; -module.exports.setTheUsername = function (url, username) { - url.username = ""; - const decoded = punycode.ucs2.decode(username); - for (let i = 0; i < decoded.length; ++i) { - url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); - } -}; +/***/ }), -module.exports.setThePassword = function (url, password) { - url.password = ""; - const decoded = punycode.ucs2.decode(password); - for (let i = 0; i < decoded.length; ++i) { - url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); - } -}; +/***/ 2839: +/***/ (function(module) { -module.exports.serializeHost = serializeHost; +// Generated by CoffeeScript 1.12.7 +(function() { + module.exports = { + Disconnected: 1, + Preceding: 2, + Following: 4, + Contains: 8, + ContainedBy: 16, + ImplementationSpecific: 32 + }; -module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; +}).call(this); -module.exports.serializeInteger = function (integer) { - return String(integer); -}; -module.exports.parseURL = function (input, options) { - if (options === undefined) { - options = {}; - } +/***/ }), - // We don't handle blobs, so this just delegates: - return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); -}; +/***/ 9267: +/***/ (function(module) { + +// Generated by CoffeeScript 1.12.7 +(function() { + module.exports = { + Element: 1, + Attribute: 2, + Text: 3, + CData: 4, + EntityReference: 5, + EntityDeclaration: 6, + ProcessingInstruction: 7, + Comment: 8, + Document: 9, + DocType: 10, + DocumentFragment: 11, + NotationDeclaration: 12, + Declaration: 201, + Raw: 202, + AttributeDeclaration: 203, + ElementDeclaration: 204, + Dummy: 205 + }; + +}).call(this); /***/ }), -/***/ 3185: -/***/ ((module) => { +/***/ 8229: +/***/ (function(module) { -"use strict"; +// Generated by CoffeeScript 1.12.7 +(function() { + var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject, + slice = [].slice, + hasProp = {}.hasOwnProperty; + assign = function() { + var i, key, len, source, sources, target; + target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : []; + if (isFunction(Object.assign)) { + Object.assign.apply(null, arguments); + } else { + for (i = 0, len = sources.length; i < len; i++) { + source = sources[i]; + if (source != null) { + for (key in source) { + if (!hasProp.call(source, key)) continue; + target[key] = source[key]; + } + } + } + } + return target; + }; -module.exports.mixin = function mixin(target, source) { - const keys = Object.getOwnPropertyNames(source); - for (let i = 0; i < keys.length; ++i) { - Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i])); - } -}; + isFunction = function(val) { + return !!val && Object.prototype.toString.call(val) === '[object Function]'; + }; -module.exports.wrapperSymbol = Symbol("wrapper"); -module.exports.implSymbol = Symbol("impl"); + isObject = function(val) { + var ref; + return !!val && ((ref = typeof val) === 'function' || ref === 'object'); + }; -module.exports.wrapperForImpl = function (impl) { - return impl[module.exports.wrapperSymbol]; -}; + isArray = function(val) { + if (isFunction(Array.isArray)) { + return Array.isArray(val); + } else { + return Object.prototype.toString.call(val) === '[object Array]'; + } + }; -module.exports.implForWrapper = function (wrapper) { - return wrapper[module.exports.implSymbol]; -}; + isEmpty = function(val) { + var key; + if (isArray(val)) { + return !val.length; + } else { + for (key in val) { + if (!hasProp.call(val, key)) continue; + return false; + } + return true; + } + }; + + isPlainObject = function(val) { + var ctor, proto; + return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object)); + }; + + getValue = function(obj) { + if (isFunction(obj.valueOf)) { + return obj.valueOf(); + } else { + return obj; + } + }; + + module.exports.assign = assign; + + module.exports.isFunction = isFunction; + + module.exports.isObject = isObject; + + module.exports.isArray = isArray; + + module.exports.isEmpty = isEmpty; + + module.exports.isPlainObject = isPlainObject; + + module.exports.getValue = getValue; +}).call(this); /***/ }), -/***/ 2624: -/***/ (function(__unused_webpack_module, exports) { +/***/ 9766: +/***/ (function(module) { // Generated by CoffeeScript 1.12.7 (function() { - "use strict"; - exports.stripBOM = function(str) { - if (str[0] === '\uFEFF') { - return str.substring(1); - } else { - return str; - } + module.exports = { + None: 0, + OpenTag: 1, + InsideTag: 2, + CloseTag: 3 }; }).call(this); @@ -79741,132 +78455,113 @@ module.exports.implForWrapper = function (wrapper) { /***/ }), -/***/ 3337: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 8376: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - "use strict"; - var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA, - hasProp = {}.hasOwnProperty; + var NodeType, XMLAttribute, XMLNode; - builder = __nccwpck_require__(2958); + NodeType = __nccwpck_require__(9267); - defaults = (__nccwpck_require__(7251).defaults); + XMLNode = __nccwpck_require__(7608); - requiresCDATA = function(entry) { - return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0); - }; + module.exports = XMLAttribute = (function() { + function XMLAttribute(parent, name, value) { + this.parent = parent; + if (this.parent) { + this.options = this.parent.options; + this.stringify = this.parent.stringify; + } + if (name == null) { + throw new Error("Missing attribute name. " + this.debugInfo(name)); + } + this.name = this.stringify.name(name); + this.value = this.stringify.attValue(value); + this.type = NodeType.Attribute; + this.isId = false; + this.schemaTypeInfo = null; + } - wrapCDATA = function(entry) { - return ""; - }; + Object.defineProperty(XMLAttribute.prototype, 'nodeType', { + get: function() { + return this.type; + } + }); - escapeCDATA = function(entry) { - return entry.replace(']]>', ']]]]>'); - }; + Object.defineProperty(XMLAttribute.prototype, 'ownerElement', { + get: function() { + return this.parent; + } + }); - exports.Builder = (function() { - function Builder(opts) { - var key, ref, value; - this.options = {}; - ref = defaults["0.2"]; - for (key in ref) { - if (!hasProp.call(ref, key)) continue; - value = ref[key]; - this.options[key] = value; + Object.defineProperty(XMLAttribute.prototype, 'textContent', { + get: function() { + return this.value; + }, + set: function(value) { + return this.value = value || ''; + } + }); + + Object.defineProperty(XMLAttribute.prototype, 'namespaceURI', { + get: function() { + return ''; + } + }); + + Object.defineProperty(XMLAttribute.prototype, 'prefix', { + get: function() { + return ''; + } + }); + + Object.defineProperty(XMLAttribute.prototype, 'localName', { + get: function() { + return this.name; + } + }); + + Object.defineProperty(XMLAttribute.prototype, 'specified', { + get: function() { + return true; + } + }); + + XMLAttribute.prototype.clone = function() { + return Object.create(this); + }; + + XMLAttribute.prototype.toString = function(options) { + return this.options.writer.attribute(this, this.options.writer.filterOptions(options)); + }; + + XMLAttribute.prototype.debugInfo = function(name) { + name = name || this.name; + if (name == null) { + return "parent: <" + this.parent.name + ">"; + } else { + return "attribute: {" + name + "}, parent: <" + this.parent.name + ">"; + } + }; + + XMLAttribute.prototype.isEqualNode = function(node) { + if (node.namespaceURI !== this.namespaceURI) { + return false; + } + if (node.prefix !== this.prefix) { + return false; } - for (key in opts) { - if (!hasProp.call(opts, key)) continue; - value = opts[key]; - this.options[key] = value; + if (node.localName !== this.localName) { + return false; } - } - - Builder.prototype.buildObject = function(rootObj) { - var attrkey, charkey, render, rootElement, rootName; - attrkey = this.options.attrkey; - charkey = this.options.charkey; - if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) { - rootName = Object.keys(rootObj)[0]; - rootObj = rootObj[rootName]; - } else { - rootName = this.options.rootName; + if (node.value !== this.value) { + return false; } - render = (function(_this) { - return function(element, obj) { - var attr, child, entry, index, key, value; - if (typeof obj !== 'object') { - if (_this.options.cdata && requiresCDATA(obj)) { - element.raw(wrapCDATA(obj)); - } else { - element.txt(obj); - } - } else if (Array.isArray(obj)) { - for (index in obj) { - if (!hasProp.call(obj, index)) continue; - child = obj[index]; - for (key in child) { - entry = child[key]; - element = render(element.ele(key), entry).up(); - } - } - } else { - for (key in obj) { - if (!hasProp.call(obj, key)) continue; - child = obj[key]; - if (key === attrkey) { - if (typeof child === "object") { - for (attr in child) { - value = child[attr]; - element = element.att(attr, value); - } - } - } else if (key === charkey) { - if (_this.options.cdata && requiresCDATA(child)) { - element = element.raw(wrapCDATA(child)); - } else { - element = element.txt(child); - } - } else if (Array.isArray(child)) { - for (index in child) { - if (!hasProp.call(child, index)) continue; - entry = child[index]; - if (typeof entry === 'string') { - if (_this.options.cdata && requiresCDATA(entry)) { - element = element.ele(key).raw(wrapCDATA(entry)).up(); - } else { - element = element.ele(key, entry).up(); - } - } else { - element = render(element.ele(key), entry).up(); - } - } - } else if (typeof child === "object") { - element = render(element.ele(key), child).up(); - } else { - if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) { - element = element.ele(key).raw(wrapCDATA(child)).up(); - } else { - if (child == null) { - child = ''; - } - element = element.ele(key, child.toString()).up(); - } - } - } - } - return element; - }; - })(this); - rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, { - headless: this.options.headless, - allowSurrogateChars: this.options.allowSurrogateChars - }); - return render(rootElement, rootObj).end(this.options.renderOpts); + return true; }; - return Builder; + return XMLAttribute; })(); @@ -79875,1487 +78570,1673 @@ module.exports.implForWrapper = function (wrapper) { /***/ }), -/***/ 7251: -/***/ (function(__unused_webpack_module, exports) { +/***/ 333: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - exports.defaults = { - "0.1": { - explicitCharkey: false, - trim: true, - normalize: true, - normalizeTags: false, - attrkey: "@", - charkey: "#", - explicitArray: false, - ignoreAttrs: false, - mergeAttrs: false, - explicitRoot: false, - validator: null, - xmlns: false, - explicitChildren: false, - childkey: '@@', - charsAsChildren: false, - includeWhiteChars: false, - async: false, - strict: true, - attrNameProcessors: null, - attrValueProcessors: null, - tagNameProcessors: null, - valueProcessors: null, - emptyTag: '' - }, - "0.2": { - explicitCharkey: false, - trim: false, - normalize: false, - normalizeTags: false, - attrkey: "$", - charkey: "_", - explicitArray: true, - ignoreAttrs: false, - mergeAttrs: false, - explicitRoot: true, - validator: null, - xmlns: false, - explicitChildren: false, - preserveChildrenOrder: false, - childkey: '$$', - charsAsChildren: false, - includeWhiteChars: false, - async: false, - strict: true, - attrNameProcessors: null, - attrValueProcessors: null, - tagNameProcessors: null, - valueProcessors: null, - rootName: 'root', - xmldec: { - 'version': '1.0', - 'encoding': 'UTF-8', - 'standalone': true - }, - doctype: null, - renderOpts: { - 'pretty': true, - 'indent': ' ', - 'newline': '\n' - }, - headless: false, - chunkSize: 10000, - emptyTag: '', - cdata: false + var NodeType, XMLCData, XMLCharacterData, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + NodeType = __nccwpck_require__(9267); + + XMLCharacterData = __nccwpck_require__(7709); + + module.exports = XMLCData = (function(superClass) { + extend(XMLCData, superClass); + + function XMLCData(parent, text) { + XMLCData.__super__.constructor.call(this, parent); + if (text == null) { + throw new Error("Missing CDATA text. " + this.debugInfo()); + } + this.name = "#cdata-section"; + this.type = NodeType.CData; + this.value = this.stringify.cdata(text); } - }; + + XMLCData.prototype.clone = function() { + return Object.create(this); + }; + + XMLCData.prototype.toString = function(options) { + return this.options.writer.cdata(this, this.options.writer.filterOptions(options)); + }; + + return XMLCData; + + })(XMLCharacterData); }).call(this); /***/ }), -/***/ 3314: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 7709: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - "use strict"; - var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate, - bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + var XMLCharacterData, XMLNode, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - sax = __nccwpck_require__(2043); - - events = __nccwpck_require__(2361); - - bom = __nccwpck_require__(2624); - - processors = __nccwpck_require__(9236); - - setImmediate = (__nccwpck_require__(9512).setImmediate); - - defaults = (__nccwpck_require__(7251).defaults); + XMLNode = __nccwpck_require__(7608); - isEmpty = function(thing) { - return typeof thing === "object" && (thing != null) && Object.keys(thing).length === 0; - }; + module.exports = XMLCharacterData = (function(superClass) { + extend(XMLCharacterData, superClass); - processItem = function(processors, item, key) { - var i, len, process; - for (i = 0, len = processors.length; i < len; i++) { - process = processors[i]; - item = process(item, key); + function XMLCharacterData(parent) { + XMLCharacterData.__super__.constructor.call(this, parent); + this.value = ''; } - return item; - }; - - exports.Parser = (function(superClass) { - extend(Parser, superClass); - function Parser(opts) { - this.parseStringPromise = bind(this.parseStringPromise, this); - this.parseString = bind(this.parseString, this); - this.reset = bind(this.reset, this); - this.assignOrPush = bind(this.assignOrPush, this); - this.processAsync = bind(this.processAsync, this); - var key, ref, value; - if (!(this instanceof exports.Parser)) { - return new exports.Parser(opts); - } - this.options = {}; - ref = defaults["0.2"]; - for (key in ref) { - if (!hasProp.call(ref, key)) continue; - value = ref[key]; - this.options[key] = value; - } - for (key in opts) { - if (!hasProp.call(opts, key)) continue; - value = opts[key]; - this.options[key] = value; - } - if (this.options.xmlns) { - this.options.xmlnskey = this.options.attrkey + "ns"; - } - if (this.options.normalizeTags) { - if (!this.options.tagNameProcessors) { - this.options.tagNameProcessors = []; - } - this.options.tagNameProcessors.unshift(processors.normalize); + Object.defineProperty(XMLCharacterData.prototype, 'data', { + get: function() { + return this.value; + }, + set: function(value) { + return this.value = value || ''; } - this.reset(); - } + }); - Parser.prototype.processAsync = function() { - var chunk, err; - try { - if (this.remaining.length <= this.options.chunkSize) { - chunk = this.remaining; - this.remaining = ''; - this.saxParser = this.saxParser.write(chunk); - return this.saxParser.close(); - } else { - chunk = this.remaining.substr(0, this.options.chunkSize); - this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length); - this.saxParser = this.saxParser.write(chunk); - return setImmediate(this.processAsync); - } - } catch (error1) { - err = error1; - if (!this.saxParser.errThrown) { - this.saxParser.errThrown = true; - return this.emit(err); - } + Object.defineProperty(XMLCharacterData.prototype, 'length', { + get: function() { + return this.value.length; } - }; + }); - Parser.prototype.assignOrPush = function(obj, key, newValue) { - if (!(key in obj)) { - if (!this.options.explicitArray) { - return obj[key] = newValue; - } else { - return obj[key] = [newValue]; - } - } else { - if (!(obj[key] instanceof Array)) { - obj[key] = [obj[key]]; - } - return obj[key].push(newValue); + Object.defineProperty(XMLCharacterData.prototype, 'textContent', { + get: function() { + return this.value; + }, + set: function(value) { + return this.value = value || ''; } - }; + }); - Parser.prototype.reset = function() { - var attrkey, charkey, ontext, stack; - this.removeAllListeners(); - this.saxParser = sax.parser(this.options.strict, { - trim: false, - normalize: false, - xmlns: this.options.xmlns - }); - this.saxParser.errThrown = false; - this.saxParser.onerror = (function(_this) { - return function(error) { - _this.saxParser.resume(); - if (!_this.saxParser.errThrown) { - _this.saxParser.errThrown = true; - return _this.emit("error", error); - } - }; - })(this); - this.saxParser.onend = (function(_this) { - return function() { - if (!_this.saxParser.ended) { - _this.saxParser.ended = true; - return _this.emit("end", _this.resultObject); - } - }; - })(this); - this.saxParser.ended = false; - this.EXPLICIT_CHARKEY = this.options.explicitCharkey; - this.resultObject = null; - stack = []; - attrkey = this.options.attrkey; - charkey = this.options.charkey; - this.saxParser.onopentag = (function(_this) { - return function(node) { - var key, newValue, obj, processedKey, ref; - obj = Object.create(null); - obj[charkey] = ""; - if (!_this.options.ignoreAttrs) { - ref = node.attributes; - for (key in ref) { - if (!hasProp.call(ref, key)) continue; - if (!(attrkey in obj) && !_this.options.mergeAttrs) { - obj[attrkey] = Object.create(null); - } - newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key]; - processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key; - if (_this.options.mergeAttrs) { - _this.assignOrPush(obj, processedKey, newValue); - } else { - obj[attrkey][processedKey] = newValue; - } - } - } - obj["#name"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name; - if (_this.options.xmlns) { - obj[_this.options.xmlnskey] = { - uri: node.uri, - local: node.local - }; - } - return stack.push(obj); - }; - })(this); - this.saxParser.onclosetag = (function(_this) { - return function() { - var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath; - obj = stack.pop(); - nodeName = obj["#name"]; - if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) { - delete obj["#name"]; - } - if (obj.cdata === true) { - cdata = obj.cdata; - delete obj.cdata; - } - s = stack[stack.length - 1]; - if (obj[charkey].match(/^\s*$/) && !cdata) { - emptyStr = obj[charkey]; - delete obj[charkey]; - } else { - if (_this.options.trim) { - obj[charkey] = obj[charkey].trim(); - } - if (_this.options.normalize) { - obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim(); - } - obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey]; - if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) { - obj = obj[charkey]; - } - } - if (isEmpty(obj)) { - if (typeof _this.options.emptyTag === 'function') { - obj = _this.options.emptyTag(); - } else { - obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr; - } - } - if (_this.options.validator != null) { - xpath = "/" + ((function() { - var i, len, results; - results = []; - for (i = 0, len = stack.length; i < len; i++) { - node = stack[i]; - results.push(node["#name"]); - } - return results; - })()).concat(nodeName).join("/"); - (function() { - var err; - try { - return obj = _this.options.validator(xpath, s && s[nodeName], obj); - } catch (error1) { - err = error1; - return _this.emit("error", err); - } - })(); - } - if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') { - if (!_this.options.preserveChildrenOrder) { - node = Object.create(null); - if (_this.options.attrkey in obj) { - node[_this.options.attrkey] = obj[_this.options.attrkey]; - delete obj[_this.options.attrkey]; - } - if (!_this.options.charsAsChildren && _this.options.charkey in obj) { - node[_this.options.charkey] = obj[_this.options.charkey]; - delete obj[_this.options.charkey]; - } - if (Object.getOwnPropertyNames(obj).length > 0) { - node[_this.options.childkey] = obj; - } - obj = node; - } else if (s) { - s[_this.options.childkey] = s[_this.options.childkey] || []; - objClone = Object.create(null); - for (key in obj) { - if (!hasProp.call(obj, key)) continue; - objClone[key] = obj[key]; - } - s[_this.options.childkey].push(objClone); - delete obj["#name"]; - if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) { - obj = obj[charkey]; - } - } - } - if (stack.length > 0) { - return _this.assignOrPush(s, nodeName, obj); - } else { - if (_this.options.explicitRoot) { - old = obj; - obj = Object.create(null); - obj[nodeName] = old; - } - _this.resultObject = obj; - _this.saxParser.ended = true; - return _this.emit("end", _this.resultObject); - } - }; - })(this); - ontext = (function(_this) { - return function(text) { - var charChild, s; - s = stack[stack.length - 1]; - if (s) { - s[charkey] += text; - if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, '').trim() !== '')) { - s[_this.options.childkey] = s[_this.options.childkey] || []; - charChild = { - '#name': '__text__' - }; - charChild[charkey] = text; - if (_this.options.normalize) { - charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim(); - } - s[_this.options.childkey].push(charChild); - } - return s; - } - }; - })(this); - this.saxParser.ontext = ontext; - return this.saxParser.oncdata = (function(_this) { - return function(text) { - var s; - s = ontext(text); - if (s) { - return s.cdata = true; - } - }; - })(this); + XMLCharacterData.prototype.clone = function() { + return Object.create(this); }; - Parser.prototype.parseString = function(str, cb) { - var err; - if ((cb != null) && typeof cb === "function") { - this.on("end", function(result) { - this.reset(); - return cb(null, result); - }); - this.on("error", function(err) { - this.reset(); - return cb(err); - }); - } - try { - str = str.toString(); - if (str.trim() === '') { - this.emit("end", null); - return true; - } - str = bom.stripBOM(str); - if (this.options.async) { - this.remaining = str; - setImmediate(this.processAsync); - return this.saxParser; - } - return this.saxParser.write(str).close(); - } catch (error1) { - err = error1; - if (!(this.saxParser.errThrown || this.saxParser.ended)) { - this.emit('error', err); - return this.saxParser.errThrown = true; - } else if (this.saxParser.ended) { - throw err; - } - } + XMLCharacterData.prototype.substringData = function(offset, count) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - Parser.prototype.parseStringPromise = function(str) { - return new Promise((function(_this) { - return function(resolve, reject) { - return _this.parseString(str, function(err, value) { - if (err) { - return reject(err); - } else { - return resolve(value); - } - }); - }; - })(this)); + XMLCharacterData.prototype.appendData = function(arg) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - return Parser; + XMLCharacterData.prototype.insertData = function(offset, arg) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - })(events); + XMLCharacterData.prototype.deleteData = function(offset, count) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - exports.parseString = function(str, a, b) { - var cb, options, parser; - if (b != null) { - if (typeof b === 'function') { - cb = b; + XMLCharacterData.prototype.replaceData = function(offset, count, arg) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLCharacterData.prototype.isEqualNode = function(node) { + if (!XMLCharacterData.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { + return false; } - if (typeof a === 'object') { - options = a; + if (node.data !== this.data) { + return false; } - } else { - if (typeof a === 'function') { - cb = a; + return true; + }; + + return XMLCharacterData; + + })(XMLNode); + +}).call(this); + + +/***/ }), + +/***/ 4407: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var NodeType, XMLCharacterData, XMLComment, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + NodeType = __nccwpck_require__(9267); + + XMLCharacterData = __nccwpck_require__(7709); + + module.exports = XMLComment = (function(superClass) { + extend(XMLComment, superClass); + + function XMLComment(parent, text) { + XMLComment.__super__.constructor.call(this, parent); + if (text == null) { + throw new Error("Missing comment text. " + this.debugInfo()); } - options = {}; + this.name = "#comment"; + this.type = NodeType.Comment; + this.value = this.stringify.comment(text); } - parser = new exports.Parser(options); - return parser.parseString(str, cb); - }; - exports.parseStringPromise = function(str, a) { - var options, parser; - if (typeof a === 'object') { - options = a; + XMLComment.prototype.clone = function() { + return Object.create(this); + }; + + XMLComment.prototype.toString = function(options) { + return this.options.writer.comment(this, this.options.writer.filterOptions(options)); + }; + + return XMLComment; + + })(XMLCharacterData); + +}).call(this); + + +/***/ }), + +/***/ 7465: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList; + + XMLDOMErrorHandler = __nccwpck_require__(6744); + + XMLDOMStringList = __nccwpck_require__(7028); + + module.exports = XMLDOMConfiguration = (function() { + function XMLDOMConfiguration() { + var clonedSelf; + this.defaultParams = { + "canonical-form": false, + "cdata-sections": false, + "comments": false, + "datatype-normalization": false, + "element-content-whitespace": true, + "entities": true, + "error-handler": new XMLDOMErrorHandler(), + "infoset": true, + "validate-if-schema": false, + "namespaces": true, + "namespace-declarations": true, + "normalize-characters": false, + "schema-location": '', + "schema-type": '', + "split-cdata-sections": true, + "validate": false, + "well-formed": true + }; + this.params = clonedSelf = Object.create(this.defaultParams); } - parser = new exports.Parser(options); - return parser.parseStringPromise(str); - }; + + Object.defineProperty(XMLDOMConfiguration.prototype, 'parameterNames', { + get: function() { + return new XMLDOMStringList(Object.keys(this.defaultParams)); + } + }); + + XMLDOMConfiguration.prototype.getParameter = function(name) { + if (this.params.hasOwnProperty(name)) { + return this.params[name]; + } else { + return null; + } + }; + + XMLDOMConfiguration.prototype.canSetParameter = function(name, value) { + return true; + }; + + XMLDOMConfiguration.prototype.setParameter = function(name, value) { + if (value != null) { + return this.params[name] = value; + } else { + return delete this.params[name]; + } + }; + + return XMLDOMConfiguration; + + })(); }).call(this); /***/ }), -/***/ 9236: -/***/ (function(__unused_webpack_module, exports) { +/***/ 6744: +/***/ (function(module) { // Generated by CoffeeScript 1.12.7 (function() { - "use strict"; - var prefixMatch; + var XMLDOMErrorHandler; - prefixMatch = new RegExp(/(?!xmlns)^.*:/); + module.exports = XMLDOMErrorHandler = (function() { + function XMLDOMErrorHandler() {} - exports.normalize = function(str) { - return str.toLowerCase(); - }; + XMLDOMErrorHandler.prototype.handleError = function(error) { + throw new Error(error); + }; - exports.firstCharLowerCase = function(str) { - return str.charAt(0).toLowerCase() + str.slice(1); - }; + return XMLDOMErrorHandler; - exports.stripPrefix = function(str) { - return str.replace(prefixMatch, ''); - }; + })(); - exports.parseNumbers = function(str) { - if (!isNaN(str)) { - str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str); +}).call(this); + + +/***/ }), + +/***/ 8310: +/***/ (function(module) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var XMLDOMImplementation; + + module.exports = XMLDOMImplementation = (function() { + function XMLDOMImplementation() {} + + XMLDOMImplementation.prototype.hasFeature = function(feature, version) { + return true; + }; + + XMLDOMImplementation.prototype.createDocumentType = function(qualifiedName, publicId, systemId) { + throw new Error("This DOM method is not implemented."); + }; + + XMLDOMImplementation.prototype.createDocument = function(namespaceURI, qualifiedName, doctype) { + throw new Error("This DOM method is not implemented."); + }; + + XMLDOMImplementation.prototype.createHTMLDocument = function(title) { + throw new Error("This DOM method is not implemented."); + }; + + XMLDOMImplementation.prototype.getFeature = function(feature, version) { + throw new Error("This DOM method is not implemented."); + }; + + return XMLDOMImplementation; + + })(); + +}).call(this); + + +/***/ }), + +/***/ 7028: +/***/ (function(module) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var XMLDOMStringList; + + module.exports = XMLDOMStringList = (function() { + function XMLDOMStringList(arr) { + this.arr = arr || []; } - return str; - }; - exports.parseBooleans = function(str) { - if (/^(?:true|false)$/i.test(str)) { - str = str.toLowerCase() === 'true'; + Object.defineProperty(XMLDOMStringList.prototype, 'length', { + get: function() { + return this.arr.length; + } + }); + + XMLDOMStringList.prototype.item = function(index) { + return this.arr[index] || null; + }; + + XMLDOMStringList.prototype.contains = function(str) { + return this.arr.indexOf(str) !== -1; + }; + + return XMLDOMStringList; + + })(); + +}).call(this); + + +/***/ }), + +/***/ 1015: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var NodeType, XMLDTDAttList, XMLNode, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + XMLNode = __nccwpck_require__(7608); + + NodeType = __nccwpck_require__(9267); + + module.exports = XMLDTDAttList = (function(superClass) { + extend(XMLDTDAttList, superClass); + + function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) { + XMLDTDAttList.__super__.constructor.call(this, parent); + if (elementName == null) { + throw new Error("Missing DTD element name. " + this.debugInfo()); + } + if (attributeName == null) { + throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName)); + } + if (!attributeType) { + throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName)); + } + if (!defaultValueType) { + throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName)); + } + if (defaultValueType.indexOf('#') !== 0) { + defaultValueType = '#' + defaultValueType; + } + if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) { + throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName)); + } + if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) { + throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName)); + } + this.elementName = this.stringify.name(elementName); + this.type = NodeType.AttributeDeclaration; + this.attributeName = this.stringify.name(attributeName); + this.attributeType = this.stringify.dtdAttType(attributeType); + if (defaultValue) { + this.defaultValue = this.stringify.dtdAttDefault(defaultValue); + } + this.defaultValueType = defaultValueType; } - return str; - }; + + XMLDTDAttList.prototype.toString = function(options) { + return this.options.writer.dtdAttList(this, this.options.writer.filterOptions(options)); + }; + + return XMLDTDAttList; + + })(XMLNode); }).call(this); /***/ }), -/***/ 6189: -/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { +/***/ 2421: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - "use strict"; - var builder, defaults, parser, processors, + var NodeType, XMLDTDElement, XMLNode, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - defaults = __nccwpck_require__(7251); + XMLNode = __nccwpck_require__(7608); - builder = __nccwpck_require__(3337); + NodeType = __nccwpck_require__(9267); - parser = __nccwpck_require__(3314); + module.exports = XMLDTDElement = (function(superClass) { + extend(XMLDTDElement, superClass); - processors = __nccwpck_require__(9236); + function XMLDTDElement(parent, name, value) { + XMLDTDElement.__super__.constructor.call(this, parent); + if (name == null) { + throw new Error("Missing DTD element name. " + this.debugInfo()); + } + if (!value) { + value = '(#PCDATA)'; + } + if (Array.isArray(value)) { + value = '(' + value.join(',') + ')'; + } + this.name = this.stringify.name(name); + this.type = NodeType.ElementDeclaration; + this.value = this.stringify.dtdElementValue(value); + } - exports.defaults = defaults.defaults; + XMLDTDElement.prototype.toString = function(options) { + return this.options.writer.dtdElement(this, this.options.writer.filterOptions(options)); + }; - exports.processors = processors; + return XMLDTDElement; - exports.ValidationError = (function(superClass) { - extend(ValidationError, superClass); + })(XMLNode); - function ValidationError(message) { - this.message = message; +}).call(this); + + +/***/ }), + +/***/ 53: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var NodeType, XMLDTDEntity, XMLNode, isObject, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + isObject = (__nccwpck_require__(8229).isObject); + + XMLNode = __nccwpck_require__(7608); + + NodeType = __nccwpck_require__(9267); + + module.exports = XMLDTDEntity = (function(superClass) { + extend(XMLDTDEntity, superClass); + + function XMLDTDEntity(parent, pe, name, value) { + XMLDTDEntity.__super__.constructor.call(this, parent); + if (name == null) { + throw new Error("Missing DTD entity name. " + this.debugInfo(name)); + } + if (value == null) { + throw new Error("Missing DTD entity value. " + this.debugInfo(name)); + } + this.pe = !!pe; + this.name = this.stringify.name(name); + this.type = NodeType.EntityDeclaration; + if (!isObject(value)) { + this.value = this.stringify.dtdEntityValue(value); + this.internal = true; + } else { + if (!value.pubID && !value.sysID) { + throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name)); + } + if (value.pubID && !value.sysID) { + throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name)); + } + this.internal = false; + if (value.pubID != null) { + this.pubID = this.stringify.dtdPubID(value.pubID); + } + if (value.sysID != null) { + this.sysID = this.stringify.dtdSysID(value.sysID); + } + if (value.nData != null) { + this.nData = this.stringify.dtdNData(value.nData); + } + if (this.pe && this.nData) { + throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name)); + } + } } - return ValidationError; + Object.defineProperty(XMLDTDEntity.prototype, 'publicId', { + get: function() { + return this.pubID; + } + }); - })(Error); + Object.defineProperty(XMLDTDEntity.prototype, 'systemId', { + get: function() { + return this.sysID; + } + }); - exports.Builder = builder.Builder; + Object.defineProperty(XMLDTDEntity.prototype, 'notationName', { + get: function() { + return this.nData || null; + } + }); - exports.Parser = parser.Parser; + Object.defineProperty(XMLDTDEntity.prototype, 'inputEncoding', { + get: function() { + return null; + } + }); - exports.parseString = parser.parseString; + Object.defineProperty(XMLDTDEntity.prototype, 'xmlEncoding', { + get: function() { + return null; + } + }); - exports.parseStringPromise = parser.parseStringPromise; + Object.defineProperty(XMLDTDEntity.prototype, 'xmlVersion', { + get: function() { + return null; + } + }); + + XMLDTDEntity.prototype.toString = function(options) { + return this.options.writer.dtdEntity(this, this.options.writer.filterOptions(options)); + }; + + return XMLDTDEntity; + + })(XMLNode); }).call(this); /***/ }), -/***/ 2839: -/***/ (function(module) { +/***/ 2837: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - module.exports = { - Disconnected: 1, - Preceding: 2, - Following: 4, - Contains: 8, - ContainedBy: 16, - ImplementationSpecific: 32 - }; + var NodeType, XMLDTDNotation, XMLNode, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; -}).call(this); + XMLNode = __nccwpck_require__(7608); + NodeType = __nccwpck_require__(9267); -/***/ }), + module.exports = XMLDTDNotation = (function(superClass) { + extend(XMLDTDNotation, superClass); -/***/ 9267: -/***/ (function(module) { + function XMLDTDNotation(parent, name, value) { + XMLDTDNotation.__super__.constructor.call(this, parent); + if (name == null) { + throw new Error("Missing DTD notation name. " + this.debugInfo(name)); + } + if (!value.pubID && !value.sysID) { + throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name)); + } + this.name = this.stringify.name(name); + this.type = NodeType.NotationDeclaration; + if (value.pubID != null) { + this.pubID = this.stringify.dtdPubID(value.pubID); + } + if (value.sysID != null) { + this.sysID = this.stringify.dtdSysID(value.sysID); + } + } -// Generated by CoffeeScript 1.12.7 -(function() { - module.exports = { - Element: 1, - Attribute: 2, - Text: 3, - CData: 4, - EntityReference: 5, - EntityDeclaration: 6, - ProcessingInstruction: 7, - Comment: 8, - Document: 9, - DocType: 10, - DocumentFragment: 11, - NotationDeclaration: 12, - Declaration: 201, - Raw: 202, - AttributeDeclaration: 203, - ElementDeclaration: 204, - Dummy: 205 - }; + Object.defineProperty(XMLDTDNotation.prototype, 'publicId', { + get: function() { + return this.pubID; + } + }); + + Object.defineProperty(XMLDTDNotation.prototype, 'systemId', { + get: function() { + return this.sysID; + } + }); + + XMLDTDNotation.prototype.toString = function(options) { + return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options)); + }; + + return XMLDTDNotation; + + })(XMLNode); }).call(this); /***/ }), -/***/ 8229: -/***/ (function(module) { +/***/ 6364: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject, - slice = [].slice, + var NodeType, XMLDeclaration, XMLNode, isObject, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - assign = function() { - var i, key, len, source, sources, target; - target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : []; - if (isFunction(Object.assign)) { - Object.assign.apply(null, arguments); - } else { - for (i = 0, len = sources.length; i < len; i++) { - source = sources[i]; - if (source != null) { - for (key in source) { - if (!hasProp.call(source, key)) continue; - target[key] = source[key]; - } - } - } - } - return target; - }; + isObject = (__nccwpck_require__(8229).isObject); - isFunction = function(val) { - return !!val && Object.prototype.toString.call(val) === '[object Function]'; - }; + XMLNode = __nccwpck_require__(7608); - isObject = function(val) { - var ref; - return !!val && ((ref = typeof val) === 'function' || ref === 'object'); - }; + NodeType = __nccwpck_require__(9267); - isArray = function(val) { - if (isFunction(Array.isArray)) { - return Array.isArray(val); - } else { - return Object.prototype.toString.call(val) === '[object Array]'; - } - }; + module.exports = XMLDeclaration = (function(superClass) { + extend(XMLDeclaration, superClass); - isEmpty = function(val) { - var key; - if (isArray(val)) { - return !val.length; - } else { - for (key in val) { - if (!hasProp.call(val, key)) continue; - return false; + function XMLDeclaration(parent, version, encoding, standalone) { + var ref; + XMLDeclaration.__super__.constructor.call(this, parent); + if (isObject(version)) { + ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone; + } + if (!version) { + version = '1.0'; + } + this.type = NodeType.Declaration; + this.version = this.stringify.xmlVersion(version); + if (encoding != null) { + this.encoding = this.stringify.xmlEncoding(encoding); + } + if (standalone != null) { + this.standalone = this.stringify.xmlStandalone(standalone); } - return true; - } - }; - - isPlainObject = function(val) { - var ctor, proto; - return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object)); - }; - - getValue = function(obj) { - if (isFunction(obj.valueOf)) { - return obj.valueOf(); - } else { - return obj; } - }; - - module.exports.assign = assign; - - module.exports.isFunction = isFunction; - - module.exports.isObject = isObject; - - module.exports.isArray = isArray; - module.exports.isEmpty = isEmpty; + XMLDeclaration.prototype.toString = function(options) { + return this.options.writer.declaration(this, this.options.writer.filterOptions(options)); + }; - module.exports.isPlainObject = isPlainObject; + return XMLDeclaration; - module.exports.getValue = getValue; + })(XMLNode); }).call(this); /***/ }), -/***/ 9766: -/***/ (function(module) { +/***/ 1801: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - module.exports = { - None: 0, - OpenTag: 1, - InsideTag: 2, - CloseTag: 3 - }; + var NodeType, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNamedNodeMap, XMLNode, isObject, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; -}).call(this); + isObject = (__nccwpck_require__(8229).isObject); + XMLNode = __nccwpck_require__(7608); -/***/ }), + NodeType = __nccwpck_require__(9267); -/***/ 8376: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + XMLDTDAttList = __nccwpck_require__(1015); -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLAttribute, XMLNode; + XMLDTDEntity = __nccwpck_require__(53); - NodeType = __nccwpck_require__(9267); + XMLDTDElement = __nccwpck_require__(2421); - XMLNode = __nccwpck_require__(7608); + XMLDTDNotation = __nccwpck_require__(2837); - module.exports = XMLAttribute = (function() { - function XMLAttribute(parent, name, value) { - this.parent = parent; - if (this.parent) { - this.options = this.parent.options; - this.stringify = this.parent.stringify; + XMLNamedNodeMap = __nccwpck_require__(4361); + + module.exports = XMLDocType = (function(superClass) { + extend(XMLDocType, superClass); + + function XMLDocType(parent, pubID, sysID) { + var child, i, len, ref, ref1, ref2; + XMLDocType.__super__.constructor.call(this, parent); + this.type = NodeType.DocType; + if (parent.children) { + ref = parent.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + if (child.type === NodeType.Element) { + this.name = child.name; + break; + } + } } - if (name == null) { - throw new Error("Missing attribute name. " + this.debugInfo(name)); + this.documentObject = parent; + if (isObject(pubID)) { + ref1 = pubID, pubID = ref1.pubID, sysID = ref1.sysID; + } + if (sysID == null) { + ref2 = [pubID, sysID], sysID = ref2[0], pubID = ref2[1]; + } + if (pubID != null) { + this.pubID = this.stringify.dtdPubID(pubID); + } + if (sysID != null) { + this.sysID = this.stringify.dtdSysID(sysID); } - this.name = this.stringify.name(name); - this.value = this.stringify.attValue(value); - this.type = NodeType.Attribute; - this.isId = false; - this.schemaTypeInfo = null; } - Object.defineProperty(XMLAttribute.prototype, 'nodeType', { + Object.defineProperty(XMLDocType.prototype, 'entities', { get: function() { - return this.type; + var child, i, len, nodes, ref; + nodes = {}; + ref = this.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + if ((child.type === NodeType.EntityDeclaration) && !child.pe) { + nodes[child.name] = child; + } + } + return new XMLNamedNodeMap(nodes); } }); - Object.defineProperty(XMLAttribute.prototype, 'ownerElement', { + Object.defineProperty(XMLDocType.prototype, 'notations', { get: function() { - return this.parent; + var child, i, len, nodes, ref; + nodes = {}; + ref = this.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + if (child.type === NodeType.NotationDeclaration) { + nodes[child.name] = child; + } + } + return new XMLNamedNodeMap(nodes); } }); - Object.defineProperty(XMLAttribute.prototype, 'textContent', { + Object.defineProperty(XMLDocType.prototype, 'publicId', { get: function() { - return this.value; - }, - set: function(value) { - return this.value = value || ''; + return this.pubID; } }); - Object.defineProperty(XMLAttribute.prototype, 'namespaceURI', { + Object.defineProperty(XMLDocType.prototype, 'systemId', { get: function() { - return ''; + return this.sysID; } }); - Object.defineProperty(XMLAttribute.prototype, 'prefix', { + Object.defineProperty(XMLDocType.prototype, 'internalSubset', { get: function() { - return ''; + throw new Error("This DOM method is not implemented." + this.debugInfo()); } }); - Object.defineProperty(XMLAttribute.prototype, 'localName', { - get: function() { - return this.name; - } - }); + XMLDocType.prototype.element = function(name, value) { + var child; + child = new XMLDTDElement(this, name, value); + this.children.push(child); + return this; + }; - Object.defineProperty(XMLAttribute.prototype, 'specified', { - get: function() { - return true; - } - }); + XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { + var child; + child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); + this.children.push(child); + return this; + }; - XMLAttribute.prototype.clone = function() { - return Object.create(this); + XMLDocType.prototype.entity = function(name, value) { + var child; + child = new XMLDTDEntity(this, false, name, value); + this.children.push(child); + return this; }; - XMLAttribute.prototype.toString = function(options) { - return this.options.writer.attribute(this, this.options.writer.filterOptions(options)); + XMLDocType.prototype.pEntity = function(name, value) { + var child; + child = new XMLDTDEntity(this, true, name, value); + this.children.push(child); + return this; }; - XMLAttribute.prototype.debugInfo = function(name) { - name = name || this.name; - if (name == null) { - return "parent: <" + this.parent.name + ">"; - } else { - return "attribute: {" + name + "}, parent: <" + this.parent.name + ">"; - } + XMLDocType.prototype.notation = function(name, value) { + var child; + child = new XMLDTDNotation(this, name, value); + this.children.push(child); + return this; }; - XMLAttribute.prototype.isEqualNode = function(node) { - if (node.namespaceURI !== this.namespaceURI) { + XMLDocType.prototype.toString = function(options) { + return this.options.writer.docType(this, this.options.writer.filterOptions(options)); + }; + + XMLDocType.prototype.ele = function(name, value) { + return this.element(name, value); + }; + + XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { + return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue); + }; + + XMLDocType.prototype.ent = function(name, value) { + return this.entity(name, value); + }; + + XMLDocType.prototype.pent = function(name, value) { + return this.pEntity(name, value); + }; + + XMLDocType.prototype.not = function(name, value) { + return this.notation(name, value); + }; + + XMLDocType.prototype.up = function() { + return this.root() || this.documentObject; + }; + + XMLDocType.prototype.isEqualNode = function(node) { + if (!XMLDocType.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { return false; } - if (node.prefix !== this.prefix) { + if (node.name !== this.name) { return false; } - if (node.localName !== this.localName) { + if (node.publicId !== this.publicId) { return false; } - if (node.value !== this.value) { + if (node.systemId !== this.systemId) { return false; } return true; }; - return XMLAttribute; + return XMLDocType; - })(); + })(XMLNode); }).call(this); /***/ }), -/***/ 333: +/***/ 3730: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var NodeType, XMLCData, XMLCharacterData, + var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - NodeType = __nccwpck_require__(9267); + isPlainObject = (__nccwpck_require__(8229).isPlainObject); - XMLCharacterData = __nccwpck_require__(7709); + XMLDOMImplementation = __nccwpck_require__(8310); - module.exports = XMLCData = (function(superClass) { - extend(XMLCData, superClass); + XMLDOMConfiguration = __nccwpck_require__(7465); - function XMLCData(parent, text) { - XMLCData.__super__.constructor.call(this, parent); - if (text == null) { - throw new Error("Missing CDATA text. " + this.debugInfo()); - } - this.name = "#cdata-section"; - this.type = NodeType.CData; - this.value = this.stringify.cdata(text); - } + XMLNode = __nccwpck_require__(7608); - XMLCData.prototype.clone = function() { - return Object.create(this); - }; + NodeType = __nccwpck_require__(9267); - XMLCData.prototype.toString = function(options) { - return this.options.writer.cdata(this, this.options.writer.filterOptions(options)); - }; + XMLStringifier = __nccwpck_require__(8594); - return XMLCData; + XMLStringWriter = __nccwpck_require__(5913); - })(XMLCharacterData); + module.exports = XMLDocument = (function(superClass) { + extend(XMLDocument, superClass); -}).call(this); + function XMLDocument(options) { + XMLDocument.__super__.constructor.call(this, null); + this.name = "#document"; + this.type = NodeType.Document; + this.documentURI = null; + this.domConfig = new XMLDOMConfiguration(); + options || (options = {}); + if (!options.writer) { + options.writer = new XMLStringWriter(); + } + this.options = options; + this.stringify = new XMLStringifier(options); + } + Object.defineProperty(XMLDocument.prototype, 'implementation', { + value: new XMLDOMImplementation() + }); -/***/ }), + Object.defineProperty(XMLDocument.prototype, 'doctype', { + get: function() { + var child, i, len, ref; + ref = this.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + if (child.type === NodeType.DocType) { + return child; + } + } + return null; + } + }); -/***/ 7709: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + Object.defineProperty(XMLDocument.prototype, 'documentElement', { + get: function() { + return this.rootObject || null; + } + }); -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLCharacterData, XMLNode, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + Object.defineProperty(XMLDocument.prototype, 'inputEncoding', { + get: function() { + return null; + } + }); - XMLNode = __nccwpck_require__(7608); + Object.defineProperty(XMLDocument.prototype, 'strictErrorChecking', { + get: function() { + return false; + } + }); - module.exports = XMLCharacterData = (function(superClass) { - extend(XMLCharacterData, superClass); + Object.defineProperty(XMLDocument.prototype, 'xmlEncoding', { + get: function() { + if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { + return this.children[0].encoding; + } else { + return null; + } + } + }); - function XMLCharacterData(parent) { - XMLCharacterData.__super__.constructor.call(this, parent); - this.value = ''; - } + Object.defineProperty(XMLDocument.prototype, 'xmlStandalone', { + get: function() { + if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { + return this.children[0].standalone === 'yes'; + } else { + return false; + } + } + }); + + Object.defineProperty(XMLDocument.prototype, 'xmlVersion', { + get: function() { + if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { + return this.children[0].version; + } else { + return "1.0"; + } + } + }); + + Object.defineProperty(XMLDocument.prototype, 'URL', { + get: function() { + return this.documentURI; + } + }); - Object.defineProperty(XMLCharacterData.prototype, 'data', { + Object.defineProperty(XMLDocument.prototype, 'origin', { get: function() { - return this.value; - }, - set: function(value) { - return this.value = value || ''; + return null; } }); - Object.defineProperty(XMLCharacterData.prototype, 'length', { + Object.defineProperty(XMLDocument.prototype, 'compatMode', { get: function() { - return this.value.length; + return null; } }); - Object.defineProperty(XMLCharacterData.prototype, 'textContent', { + Object.defineProperty(XMLDocument.prototype, 'characterSet', { get: function() { - return this.value; - }, - set: function(value) { - return this.value = value || ''; + return null; } }); - XMLCharacterData.prototype.clone = function() { - return Object.create(this); + Object.defineProperty(XMLDocument.prototype, 'contentType', { + get: function() { + return null; + } + }); + + XMLDocument.prototype.end = function(writer) { + var writerOptions; + writerOptions = {}; + if (!writer) { + writer = this.options.writer; + } else if (isPlainObject(writer)) { + writerOptions = writer; + writer = this.options.writer; + } + return writer.document(this, writer.filterOptions(writerOptions)); }; - XMLCharacterData.prototype.substringData = function(offset, count) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLDocument.prototype.toString = function(options) { + return this.options.writer.document(this, this.options.writer.filterOptions(options)); }; - XMLCharacterData.prototype.appendData = function(arg) { + XMLDocument.prototype.createElement = function(tagName) { throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLCharacterData.prototype.insertData = function(offset, arg) { + XMLDocument.prototype.createDocumentFragment = function() { throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLCharacterData.prototype.deleteData = function(offset, count) { + XMLDocument.prototype.createTextNode = function(data) { throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLCharacterData.prototype.replaceData = function(offset, count, arg) { + XMLDocument.prototype.createComment = function(data) { throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLCharacterData.prototype.isEqualNode = function(node) { - if (!XMLCharacterData.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { - return false; - } - if (node.data !== this.data) { - return false; - } - return true; + XMLDocument.prototype.createCDATASection = function(data) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - return XMLCharacterData; - - })(XMLNode); - -}).call(this); - - -/***/ }), - -/***/ 4407: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLCharacterData, XMLComment, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; - - NodeType = __nccwpck_require__(9267); - - XMLCharacterData = __nccwpck_require__(7709); - - module.exports = XMLComment = (function(superClass) { - extend(XMLComment, superClass); - - function XMLComment(parent, text) { - XMLComment.__super__.constructor.call(this, parent); - if (text == null) { - throw new Error("Missing comment text. " + this.debugInfo()); - } - this.name = "#comment"; - this.type = NodeType.Comment; - this.value = this.stringify.comment(text); - } + XMLDocument.prototype.createProcessingInstruction = function(target, data) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - XMLComment.prototype.clone = function() { - return Object.create(this); + XMLDocument.prototype.createAttribute = function(name) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLComment.prototype.toString = function(options) { - return this.options.writer.comment(this, this.options.writer.filterOptions(options)); + XMLDocument.prototype.createEntityReference = function(name) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - return XMLComment; + XMLDocument.prototype.getElementsByTagName = function(tagname) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - })(XMLCharacterData); + XMLDocument.prototype.importNode = function(importedNode, deep) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; -}).call(this); + XMLDocument.prototype.createElementNS = function(namespaceURI, qualifiedName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + XMLDocument.prototype.createAttributeNS = function(namespaceURI, qualifiedName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; -/***/ }), + XMLDocument.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; -/***/ 7465: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + XMLDocument.prototype.getElementById = function(elementId) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList; + XMLDocument.prototype.adoptNode = function(source) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - XMLDOMErrorHandler = __nccwpck_require__(6744); + XMLDocument.prototype.normalizeDocument = function() { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - XMLDOMStringList = __nccwpck_require__(7028); + XMLDocument.prototype.renameNode = function(node, namespaceURI, qualifiedName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - module.exports = XMLDOMConfiguration = (function() { - function XMLDOMConfiguration() { - var clonedSelf; - this.defaultParams = { - "canonical-form": false, - "cdata-sections": false, - "comments": false, - "datatype-normalization": false, - "element-content-whitespace": true, - "entities": true, - "error-handler": new XMLDOMErrorHandler(), - "infoset": true, - "validate-if-schema": false, - "namespaces": true, - "namespace-declarations": true, - "normalize-characters": false, - "schema-location": '', - "schema-type": '', - "split-cdata-sections": true, - "validate": false, - "well-formed": true - }; - this.params = clonedSelf = Object.create(this.defaultParams); - } + XMLDocument.prototype.getElementsByClassName = function(classNames) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - Object.defineProperty(XMLDOMConfiguration.prototype, 'parameterNames', { - get: function() { - return new XMLDOMStringList(Object.keys(this.defaultParams)); - } - }); + XMLDocument.prototype.createEvent = function(eventInterface) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; - XMLDOMConfiguration.prototype.getParameter = function(name) { - if (this.params.hasOwnProperty(name)) { - return this.params[name]; - } else { - return null; - } + XMLDocument.prototype.createRange = function() { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDOMConfiguration.prototype.canSetParameter = function(name, value) { - return true; + XMLDocument.prototype.createNodeIterator = function(root, whatToShow, filter) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDOMConfiguration.prototype.setParameter = function(name, value) { - if (value != null) { - return this.params[name] = value; - } else { - return delete this.params[name]; - } + XMLDocument.prototype.createTreeWalker = function(root, whatToShow, filter) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - return XMLDOMConfiguration; + return XMLDocument; - })(); + })(XMLNode); }).call(this); /***/ }), -/***/ 6744: -/***/ (function(module) { +/***/ 7356: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var XMLDOMErrorHandler; - - module.exports = XMLDOMErrorHandler = (function() { - function XMLDOMErrorHandler() {} - - XMLDOMErrorHandler.prototype.handleError = function(error) { - throw new Error(error); - }; - - return XMLDOMErrorHandler; + var NodeType, WriterState, XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocument, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject, ref, + hasProp = {}.hasOwnProperty; - })(); + ref = __nccwpck_require__(8229), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue; -}).call(this); + NodeType = __nccwpck_require__(9267); + XMLDocument = __nccwpck_require__(3730); -/***/ }), + XMLElement = __nccwpck_require__(9437); -/***/ 8310: -/***/ (function(module) { + XMLCData = __nccwpck_require__(333); -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLDOMImplementation; + XMLComment = __nccwpck_require__(4407); - module.exports = XMLDOMImplementation = (function() { - function XMLDOMImplementation() {} + XMLRaw = __nccwpck_require__(6329); - XMLDOMImplementation.prototype.hasFeature = function(feature, version) { - return true; - }; + XMLText = __nccwpck_require__(1318); - XMLDOMImplementation.prototype.createDocumentType = function(qualifiedName, publicId, systemId) { - throw new Error("This DOM method is not implemented."); - }; + XMLProcessingInstruction = __nccwpck_require__(6939); - XMLDOMImplementation.prototype.createDocument = function(namespaceURI, qualifiedName, doctype) { - throw new Error("This DOM method is not implemented."); - }; + XMLDeclaration = __nccwpck_require__(6364); - XMLDOMImplementation.prototype.createHTMLDocument = function(title) { - throw new Error("This DOM method is not implemented."); - }; + XMLDocType = __nccwpck_require__(1801); - XMLDOMImplementation.prototype.getFeature = function(feature, version) { - throw new Error("This DOM method is not implemented."); - }; + XMLDTDAttList = __nccwpck_require__(1015); - return XMLDOMImplementation; + XMLDTDEntity = __nccwpck_require__(53); - })(); + XMLDTDElement = __nccwpck_require__(2421); -}).call(this); + XMLDTDNotation = __nccwpck_require__(2837); + XMLAttribute = __nccwpck_require__(8376); -/***/ }), + XMLStringifier = __nccwpck_require__(8594); -/***/ 7028: -/***/ (function(module) { + XMLStringWriter = __nccwpck_require__(5913); -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLDOMStringList; + WriterState = __nccwpck_require__(9766); - module.exports = XMLDOMStringList = (function() { - function XMLDOMStringList(arr) { - this.arr = arr || []; + module.exports = XMLDocumentCB = (function() { + function XMLDocumentCB(options, onData, onEnd) { + var writerOptions; + this.name = "?xml"; + this.type = NodeType.Document; + options || (options = {}); + writerOptions = {}; + if (!options.writer) { + options.writer = new XMLStringWriter(); + } else if (isPlainObject(options.writer)) { + writerOptions = options.writer; + options.writer = new XMLStringWriter(); + } + this.options = options; + this.writer = options.writer; + this.writerOptions = this.writer.filterOptions(writerOptions); + this.stringify = new XMLStringifier(options); + this.onDataCallback = onData || function() {}; + this.onEndCallback = onEnd || function() {}; + this.currentNode = null; + this.currentLevel = -1; + this.openTags = {}; + this.documentStarted = false; + this.documentCompleted = false; + this.root = null; } - Object.defineProperty(XMLDOMStringList.prototype, 'length', { - get: function() { - return this.arr.length; + XMLDocumentCB.prototype.createChildNode = function(node) { + var att, attName, attributes, child, i, len, ref1, ref2; + switch (node.type) { + case NodeType.CData: + this.cdata(node.value); + break; + case NodeType.Comment: + this.comment(node.value); + break; + case NodeType.Element: + attributes = {}; + ref1 = node.attribs; + for (attName in ref1) { + if (!hasProp.call(ref1, attName)) continue; + att = ref1[attName]; + attributes[attName] = att.value; + } + this.node(node.name, attributes); + break; + case NodeType.Dummy: + this.dummy(); + break; + case NodeType.Raw: + this.raw(node.value); + break; + case NodeType.Text: + this.text(node.value); + break; + case NodeType.ProcessingInstruction: + this.instruction(node.target, node.value); + break; + default: + throw new Error("This XML node type is not supported in a JS object: " + node.constructor.name); } - }); - - XMLDOMStringList.prototype.item = function(index) { - return this.arr[index] || null; + ref2 = node.children; + for (i = 0, len = ref2.length; i < len; i++) { + child = ref2[i]; + this.createChildNode(child); + if (child.type === NodeType.Element) { + this.up(); + } + } + return this; }; - XMLDOMStringList.prototype.contains = function(str) { - return this.arr.indexOf(str) !== -1; + XMLDocumentCB.prototype.dummy = function() { + return this; }; - return XMLDOMStringList; - - })(); - -}).call(this); - - -/***/ }), - -/***/ 1015: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLDTDAttList, XMLNode, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; - - XMLNode = __nccwpck_require__(7608); - - NodeType = __nccwpck_require__(9267); - - module.exports = XMLDTDAttList = (function(superClass) { - extend(XMLDTDAttList, superClass); - - function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) { - XMLDTDAttList.__super__.constructor.call(this, parent); - if (elementName == null) { - throw new Error("Missing DTD element name. " + this.debugInfo()); + XMLDocumentCB.prototype.node = function(name, attributes, text) { + var ref1; + if (name == null) { + throw new Error("Missing node name."); } - if (attributeName == null) { - throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName)); + if (this.root && this.currentLevel === -1) { + throw new Error("Document can only have one root node. " + this.debugInfo(name)); } - if (!attributeType) { - throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName)); + this.openCurrent(); + name = getValue(name); + if (attributes == null) { + attributes = {}; } - if (!defaultValueType) { - throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName)); + attributes = getValue(attributes); + if (!isObject(attributes)) { + ref1 = [attributes, text], text = ref1[0], attributes = ref1[1]; } - if (defaultValueType.indexOf('#') !== 0) { - defaultValueType = '#' + defaultValueType; + this.currentNode = new XMLElement(this, name, attributes); + this.currentNode.children = false; + this.currentLevel++; + this.openTags[this.currentLevel] = this.currentNode; + if (text != null) { + this.text(text); } - if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) { - throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName)); + return this; + }; + + XMLDocumentCB.prototype.element = function(name, attributes, text) { + var child, i, len, oldValidationFlag, ref1, root; + if (this.currentNode && this.currentNode.type === NodeType.DocType) { + this.dtdElement.apply(this, arguments); + } else { + if (Array.isArray(name) || isObject(name) || isFunction(name)) { + oldValidationFlag = this.options.noValidation; + this.options.noValidation = true; + root = new XMLDocument(this.options).element('TEMP_ROOT'); + root.element(name); + this.options.noValidation = oldValidationFlag; + ref1 = root.children; + for (i = 0, len = ref1.length; i < len; i++) { + child = ref1[i]; + this.createChildNode(child); + if (child.type === NodeType.Element) { + this.up(); + } + } + } else { + this.node(name, attributes, text); + } } - if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) { - throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName)); + return this; + }; + + XMLDocumentCB.prototype.attribute = function(name, value) { + var attName, attValue; + if (!this.currentNode || this.currentNode.children) { + throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name)); } - this.elementName = this.stringify.name(elementName); - this.type = NodeType.AttributeDeclaration; - this.attributeName = this.stringify.name(attributeName); - this.attributeType = this.stringify.dtdAttType(attributeType); - if (defaultValue) { - this.defaultValue = this.stringify.dtdAttDefault(defaultValue); + if (name != null) { + name = getValue(name); } - this.defaultValueType = defaultValueType; - } - - XMLDTDAttList.prototype.toString = function(options) { - return this.options.writer.dtdAttList(this, this.options.writer.filterOptions(options)); + if (isObject(name)) { + for (attName in name) { + if (!hasProp.call(name, attName)) continue; + attValue = name[attName]; + this.attribute(attName, attValue); + } + } else { + if (isFunction(value)) { + value = value.apply(); + } + if (this.options.keepNullAttributes && (value == null)) { + this.currentNode.attribs[name] = new XMLAttribute(this, name, ""); + } else if (value != null) { + this.currentNode.attribs[name] = new XMLAttribute(this, name, value); + } + } + return this; }; - return XMLDTDAttList; - - })(XMLNode); - -}).call(this); - - -/***/ }), - -/***/ 2421: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLDTDElement, XMLNode, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + XMLDocumentCB.prototype.text = function(value) { + var node; + this.openCurrent(); + node = new XMLText(this, value); + this.onData(this.writer.text(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - XMLNode = __nccwpck_require__(7608); + XMLDocumentCB.prototype.cdata = function(value) { + var node; + this.openCurrent(); + node = new XMLCData(this, value); + this.onData(this.writer.cdata(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - NodeType = __nccwpck_require__(9267); + XMLDocumentCB.prototype.comment = function(value) { + var node; + this.openCurrent(); + node = new XMLComment(this, value); + this.onData(this.writer.comment(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - module.exports = XMLDTDElement = (function(superClass) { - extend(XMLDTDElement, superClass); + XMLDocumentCB.prototype.raw = function(value) { + var node; + this.openCurrent(); + node = new XMLRaw(this, value); + this.onData(this.writer.raw(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - function XMLDTDElement(parent, name, value) { - XMLDTDElement.__super__.constructor.call(this, parent); - if (name == null) { - throw new Error("Missing DTD element name. " + this.debugInfo()); + XMLDocumentCB.prototype.instruction = function(target, value) { + var i, insTarget, insValue, len, node; + this.openCurrent(); + if (target != null) { + target = getValue(target); } - if (!value) { - value = '(#PCDATA)'; + if (value != null) { + value = getValue(value); } - if (Array.isArray(value)) { - value = '(' + value.join(',') + ')'; + if (Array.isArray(target)) { + for (i = 0, len = target.length; i < len; i++) { + insTarget = target[i]; + this.instruction(insTarget); + } + } else if (isObject(target)) { + for (insTarget in target) { + if (!hasProp.call(target, insTarget)) continue; + insValue = target[insTarget]; + this.instruction(insTarget, insValue); + } + } else { + if (isFunction(value)) { + value = value.apply(); + } + node = new XMLProcessingInstruction(this, target, value); + this.onData(this.writer.processingInstruction(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); } - this.name = this.stringify.name(name); - this.type = NodeType.ElementDeclaration; - this.value = this.stringify.dtdElementValue(value); - } - - XMLDTDElement.prototype.toString = function(options) { - return this.options.writer.dtdElement(this, this.options.writer.filterOptions(options)); + return this; }; - return XMLDTDElement; - - })(XMLNode); - -}).call(this); - - -/***/ }), + XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) { + var node; + this.openCurrent(); + if (this.documentStarted) { + throw new Error("declaration() must be the first node."); + } + node = new XMLDeclaration(this, version, encoding, standalone); + this.onData(this.writer.declaration(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; -/***/ 53: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) { + this.openCurrent(); + if (root == null) { + throw new Error("Missing root node name."); + } + if (this.root) { + throw new Error("dtd() must come before the root node."); + } + this.currentNode = new XMLDocType(this, pubID, sysID); + this.currentNode.rootNodeName = root; + this.currentNode.children = false; + this.currentLevel++; + this.openTags[this.currentLevel] = this.currentNode; + return this; + }; -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLDTDEntity, XMLNode, isObject, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + XMLDocumentCB.prototype.dtdElement = function(name, value) { + var node; + this.openCurrent(); + node = new XMLDTDElement(this, name, value); + this.onData(this.writer.dtdElement(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - isObject = (__nccwpck_require__(8229).isObject); + XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { + var node; + this.openCurrent(); + node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); + this.onData(this.writer.dtdAttList(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - XMLNode = __nccwpck_require__(7608); + XMLDocumentCB.prototype.entity = function(name, value) { + var node; + this.openCurrent(); + node = new XMLDTDEntity(this, false, name, value); + this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - NodeType = __nccwpck_require__(9267); + XMLDocumentCB.prototype.pEntity = function(name, value) { + var node; + this.openCurrent(); + node = new XMLDTDEntity(this, true, name, value); + this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - module.exports = XMLDTDEntity = (function(superClass) { - extend(XMLDTDEntity, superClass); + XMLDocumentCB.prototype.notation = function(name, value) { + var node; + this.openCurrent(); + node = new XMLDTDNotation(this, name, value); + this.onData(this.writer.dtdNotation(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return this; + }; - function XMLDTDEntity(parent, pe, name, value) { - XMLDTDEntity.__super__.constructor.call(this, parent); - if (name == null) { - throw new Error("Missing DTD entity name. " + this.debugInfo(name)); - } - if (value == null) { - throw new Error("Missing DTD entity value. " + this.debugInfo(name)); + XMLDocumentCB.prototype.up = function() { + if (this.currentLevel < 0) { + throw new Error("The document node has no parent."); } - this.pe = !!pe; - this.name = this.stringify.name(name); - this.type = NodeType.EntityDeclaration; - if (!isObject(value)) { - this.value = this.stringify.dtdEntityValue(value); - this.internal = true; - } else { - if (!value.pubID && !value.sysID) { - throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name)); - } - if (value.pubID && !value.sysID) { - throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name)); - } - this.internal = false; - if (value.pubID != null) { - this.pubID = this.stringify.dtdPubID(value.pubID); - } - if (value.sysID != null) { - this.sysID = this.stringify.dtdSysID(value.sysID); - } - if (value.nData != null) { - this.nData = this.stringify.dtdNData(value.nData); - } - if (this.pe && this.nData) { - throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name)); + if (this.currentNode) { + if (this.currentNode.children) { + this.closeNode(this.currentNode); + } else { + this.openNode(this.currentNode); } + this.currentNode = null; + } else { + this.closeNode(this.openTags[this.currentLevel]); } - } + delete this.openTags[this.currentLevel]; + this.currentLevel--; + return this; + }; - Object.defineProperty(XMLDTDEntity.prototype, 'publicId', { - get: function() { - return this.pubID; + XMLDocumentCB.prototype.end = function() { + while (this.currentLevel >= 0) { + this.up(); } - }); + return this.onEnd(); + }; - Object.defineProperty(XMLDTDEntity.prototype, 'systemId', { - get: function() { - return this.sysID; + XMLDocumentCB.prototype.openCurrent = function() { + if (this.currentNode) { + this.currentNode.children = true; + return this.openNode(this.currentNode); } - }); + }; - Object.defineProperty(XMLDTDEntity.prototype, 'notationName', { - get: function() { - return this.nData || null; + XMLDocumentCB.prototype.openNode = function(node) { + var att, chunk, name, ref1; + if (!node.isOpen) { + if (!this.root && this.currentLevel === 0 && node.type === NodeType.Element) { + this.root = node; + } + chunk = ''; + if (node.type === NodeType.Element) { + this.writerOptions.state = WriterState.OpenTag; + chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<' + node.name; + ref1 = node.attribs; + for (name in ref1) { + if (!hasProp.call(ref1, name)) continue; + att = ref1[name]; + chunk += this.writer.attribute(att, this.writerOptions, this.currentLevel); + } + chunk += (node.children ? '>' : '/>') + this.writer.endline(node, this.writerOptions, this.currentLevel); + this.writerOptions.state = WriterState.InsideTag; + } else { + this.writerOptions.state = WriterState.OpenTag; + chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ''; + } + chunk += this.writer.endline(node, this.writerOptions, this.currentLevel); + } + this.onData(chunk, this.currentLevel); + return node.isOpen = true; } - }); + }; - Object.defineProperty(XMLDTDEntity.prototype, 'inputEncoding', { - get: function() { - return null; + XMLDocumentCB.prototype.closeNode = function(node) { + var chunk; + if (!node.isClosed) { + chunk = ''; + this.writerOptions.state = WriterState.CloseTag; + if (node.type === NodeType.Element) { + chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '' + this.writer.endline(node, this.writerOptions, this.currentLevel); + } else { + chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ']>' + this.writer.endline(node, this.writerOptions, this.currentLevel); + } + this.writerOptions.state = WriterState.None; + this.onData(chunk, this.currentLevel); + return node.isClosed = true; } - }); + }; - Object.defineProperty(XMLDTDEntity.prototype, 'xmlEncoding', { - get: function() { - return null; - } - }); + XMLDocumentCB.prototype.onData = function(chunk, level) { + this.documentStarted = true; + return this.onDataCallback(chunk, level + 1); + }; - Object.defineProperty(XMLDTDEntity.prototype, 'xmlVersion', { - get: function() { - return null; + XMLDocumentCB.prototype.onEnd = function() { + this.documentCompleted = true; + return this.onEndCallback(); + }; + + XMLDocumentCB.prototype.debugInfo = function(name) { + if (name == null) { + return ""; + } else { + return "node: <" + name + ">"; } - }); + }; - XMLDTDEntity.prototype.toString = function(options) { - return this.options.writer.dtdEntity(this, this.options.writer.filterOptions(options)); + XMLDocumentCB.prototype.ele = function() { + return this.element.apply(this, arguments); }; - return XMLDTDEntity; + XMLDocumentCB.prototype.nod = function(name, attributes, text) { + return this.node(name, attributes, text); + }; - })(XMLNode); + XMLDocumentCB.prototype.txt = function(value) { + return this.text(value); + }; -}).call(this); + XMLDocumentCB.prototype.dat = function(value) { + return this.cdata(value); + }; + XMLDocumentCB.prototype.com = function(value) { + return this.comment(value); + }; -/***/ }), + XMLDocumentCB.prototype.ins = function(target, value) { + return this.instruction(target, value); + }; -/***/ 2837: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + XMLDocumentCB.prototype.dec = function(version, encoding, standalone) { + return this.declaration(version, encoding, standalone); + }; -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLDTDNotation, XMLNode, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) { + return this.doctype(root, pubID, sysID); + }; - XMLNode = __nccwpck_require__(7608); + XMLDocumentCB.prototype.e = function(name, attributes, text) { + return this.element(name, attributes, text); + }; - NodeType = __nccwpck_require__(9267); + XMLDocumentCB.prototype.n = function(name, attributes, text) { + return this.node(name, attributes, text); + }; - module.exports = XMLDTDNotation = (function(superClass) { - extend(XMLDTDNotation, superClass); + XMLDocumentCB.prototype.t = function(value) { + return this.text(value); + }; - function XMLDTDNotation(parent, name, value) { - XMLDTDNotation.__super__.constructor.call(this, parent); - if (name == null) { - throw new Error("Missing DTD notation name. " + this.debugInfo(name)); - } - if (!value.pubID && !value.sysID) { - throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name)); - } - this.name = this.stringify.name(name); - this.type = NodeType.NotationDeclaration; - if (value.pubID != null) { - this.pubID = this.stringify.dtdPubID(value.pubID); - } - if (value.sysID != null) { - this.sysID = this.stringify.dtdSysID(value.sysID); - } - } + XMLDocumentCB.prototype.d = function(value) { + return this.cdata(value); + }; - Object.defineProperty(XMLDTDNotation.prototype, 'publicId', { - get: function() { - return this.pubID; + XMLDocumentCB.prototype.c = function(value) { + return this.comment(value); + }; + + XMLDocumentCB.prototype.r = function(value) { + return this.raw(value); + }; + + XMLDocumentCB.prototype.i = function(target, value) { + return this.instruction(target, value); + }; + + XMLDocumentCB.prototype.att = function() { + if (this.currentNode && this.currentNode.type === NodeType.DocType) { + return this.attList.apply(this, arguments); + } else { + return this.attribute.apply(this, arguments); } - }); + }; - Object.defineProperty(XMLDTDNotation.prototype, 'systemId', { - get: function() { - return this.sysID; + XMLDocumentCB.prototype.a = function() { + if (this.currentNode && this.currentNode.type === NodeType.DocType) { + return this.attList.apply(this, arguments); + } else { + return this.attribute.apply(this, arguments); } - }); + }; - XMLDTDNotation.prototype.toString = function(options) { - return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options)); + XMLDocumentCB.prototype.ent = function(name, value) { + return this.entity(name, value); }; - return XMLDTDNotation; + XMLDocumentCB.prototype.pent = function(name, value) { + return this.pEntity(name, value); + }; - })(XMLNode); + XMLDocumentCB.prototype.not = function(name, value) { + return this.notation(name, value); + }; + + return XMLDocumentCB; + + })(); }).call(this); /***/ }), -/***/ 6364: +/***/ 3590: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var NodeType, XMLDeclaration, XMLNode, isObject, + var NodeType, XMLDummy, XMLNode, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - isObject = (__nccwpck_require__(8229).isObject); - XMLNode = __nccwpck_require__(7608); NodeType = __nccwpck_require__(9267); - module.exports = XMLDeclaration = (function(superClass) { - extend(XMLDeclaration, superClass); + module.exports = XMLDummy = (function(superClass) { + extend(XMLDummy, superClass); - function XMLDeclaration(parent, version, encoding, standalone) { - var ref; - XMLDeclaration.__super__.constructor.call(this, parent); - if (isObject(version)) { - ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone; - } - if (!version) { - version = '1.0'; - } - this.type = NodeType.Declaration; - this.version = this.stringify.xmlVersion(version); - if (encoding != null) { - this.encoding = this.stringify.xmlEncoding(encoding); - } - if (standalone != null) { - this.standalone = this.stringify.xmlStandalone(standalone); - } + function XMLDummy(parent) { + XMLDummy.__super__.constructor.call(this, parent); + this.type = NodeType.Dummy; } - XMLDeclaration.prototype.toString = function(options) { - return this.options.writer.declaration(this, this.options.writer.filterOptions(options)); + XMLDummy.prototype.clone = function() { + return Object.create(this); }; - return XMLDeclaration; + XMLDummy.prototype.toString = function(options) { + return ''; + }; + + return XMLDummy; })(XMLNode); @@ -81364,191 +80245,303 @@ module.exports.implForWrapper = function (wrapper) { /***/ }), -/***/ 1801: +/***/ 9437: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var NodeType, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNamedNodeMap, XMLNode, isObject, + var NodeType, XMLAttribute, XMLElement, XMLNamedNodeMap, XMLNode, getValue, isFunction, isObject, ref, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - isObject = (__nccwpck_require__(8229).isObject); + ref = __nccwpck_require__(8229), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue; XMLNode = __nccwpck_require__(7608); NodeType = __nccwpck_require__(9267); - XMLDTDAttList = __nccwpck_require__(1015); - - XMLDTDEntity = __nccwpck_require__(53); - - XMLDTDElement = __nccwpck_require__(2421); - - XMLDTDNotation = __nccwpck_require__(2837); + XMLAttribute = __nccwpck_require__(8376); XMLNamedNodeMap = __nccwpck_require__(4361); - module.exports = XMLDocType = (function(superClass) { - extend(XMLDocType, superClass); + module.exports = XMLElement = (function(superClass) { + extend(XMLElement, superClass); - function XMLDocType(parent, pubID, sysID) { - var child, i, len, ref, ref1, ref2; - XMLDocType.__super__.constructor.call(this, parent); - this.type = NodeType.DocType; - if (parent.children) { - ref = parent.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - if (child.type === NodeType.Element) { - this.name = child.name; - break; - } - } + function XMLElement(parent, name, attributes) { + var child, j, len, ref1; + XMLElement.__super__.constructor.call(this, parent); + if (name == null) { + throw new Error("Missing element name. " + this.debugInfo()); } - this.documentObject = parent; - if (isObject(pubID)) { - ref1 = pubID, pubID = ref1.pubID, sysID = ref1.sysID; + this.name = this.stringify.name(name); + this.type = NodeType.Element; + this.attribs = {}; + this.schemaTypeInfo = null; + if (attributes != null) { + this.attribute(attributes); } - if (sysID == null) { - ref2 = [pubID, sysID], sysID = ref2[0], pubID = ref2[1]; + if (parent.type === NodeType.Document) { + this.isRoot = true; + this.documentObject = parent; + parent.rootObject = this; + if (parent.children) { + ref1 = parent.children; + for (j = 0, len = ref1.length; j < len; j++) { + child = ref1[j]; + if (child.type === NodeType.DocType) { + child.name = this.name; + break; + } + } + } } - if (pubID != null) { - this.pubID = this.stringify.dtdPubID(pubID); + } + + Object.defineProperty(XMLElement.prototype, 'tagName', { + get: function() { + return this.name; } - if (sysID != null) { - this.sysID = this.stringify.dtdSysID(sysID); + }); + + Object.defineProperty(XMLElement.prototype, 'namespaceURI', { + get: function() { + return ''; } - } + }); - Object.defineProperty(XMLDocType.prototype, 'entities', { + Object.defineProperty(XMLElement.prototype, 'prefix', { get: function() { - var child, i, len, nodes, ref; - nodes = {}; - ref = this.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - if ((child.type === NodeType.EntityDeclaration) && !child.pe) { - nodes[child.name] = child; - } - } - return new XMLNamedNodeMap(nodes); + return ''; } }); - Object.defineProperty(XMLDocType.prototype, 'notations', { + Object.defineProperty(XMLElement.prototype, 'localName', { get: function() { - var child, i, len, nodes, ref; - nodes = {}; - ref = this.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - if (child.type === NodeType.NotationDeclaration) { - nodes[child.name] = child; - } - } - return new XMLNamedNodeMap(nodes); + return this.name; } }); - Object.defineProperty(XMLDocType.prototype, 'publicId', { + Object.defineProperty(XMLElement.prototype, 'id', { get: function() { - return this.pubID; + throw new Error("This DOM method is not implemented." + this.debugInfo()); } }); - Object.defineProperty(XMLDocType.prototype, 'systemId', { + Object.defineProperty(XMLElement.prototype, 'className', { get: function() { - return this.sysID; + throw new Error("This DOM method is not implemented." + this.debugInfo()); } }); - Object.defineProperty(XMLDocType.prototype, 'internalSubset', { + Object.defineProperty(XMLElement.prototype, 'classList', { get: function() { throw new Error("This DOM method is not implemented." + this.debugInfo()); } }); - XMLDocType.prototype.element = function(name, value) { - var child; - child = new XMLDTDElement(this, name, value); - this.children.push(child); - return this; + Object.defineProperty(XMLElement.prototype, 'attributes', { + get: function() { + if (!this.attributeMap || !this.attributeMap.nodes) { + this.attributeMap = new XMLNamedNodeMap(this.attribs); + } + return this.attributeMap; + } + }); + + XMLElement.prototype.clone = function() { + var att, attName, clonedSelf, ref1; + clonedSelf = Object.create(this); + if (clonedSelf.isRoot) { + clonedSelf.documentObject = null; + } + clonedSelf.attribs = {}; + ref1 = this.attribs; + for (attName in ref1) { + if (!hasProp.call(ref1, attName)) continue; + att = ref1[attName]; + clonedSelf.attribs[attName] = att.clone(); + } + clonedSelf.children = []; + this.children.forEach(function(child) { + var clonedChild; + clonedChild = child.clone(); + clonedChild.parent = clonedSelf; + return clonedSelf.children.push(clonedChild); + }); + return clonedSelf; }; - XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { - var child; - child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); - this.children.push(child); + XMLElement.prototype.attribute = function(name, value) { + var attName, attValue; + if (name != null) { + name = getValue(name); + } + if (isObject(name)) { + for (attName in name) { + if (!hasProp.call(name, attName)) continue; + attValue = name[attName]; + this.attribute(attName, attValue); + } + } else { + if (isFunction(value)) { + value = value.apply(); + } + if (this.options.keepNullAttributes && (value == null)) { + this.attribs[name] = new XMLAttribute(this, name, ""); + } else if (value != null) { + this.attribs[name] = new XMLAttribute(this, name, value); + } + } return this; }; - XMLDocType.prototype.entity = function(name, value) { - var child; - child = new XMLDTDEntity(this, false, name, value); - this.children.push(child); + XMLElement.prototype.removeAttribute = function(name) { + var attName, j, len; + if (name == null) { + throw new Error("Missing attribute name. " + this.debugInfo()); + } + name = getValue(name); + if (Array.isArray(name)) { + for (j = 0, len = name.length; j < len; j++) { + attName = name[j]; + delete this.attribs[attName]; + } + } else { + delete this.attribs[name]; + } return this; }; - XMLDocType.prototype.pEntity = function(name, value) { - var child; - child = new XMLDTDEntity(this, true, name, value); - this.children.push(child); - return this; + XMLElement.prototype.toString = function(options) { + return this.options.writer.element(this, this.options.writer.filterOptions(options)); }; - XMLDocType.prototype.notation = function(name, value) { - var child; - child = new XMLDTDNotation(this, name, value); - this.children.push(child); - return this; + XMLElement.prototype.att = function(name, value) { + return this.attribute(name, value); }; - XMLDocType.prototype.toString = function(options) { - return this.options.writer.docType(this, this.options.writer.filterOptions(options)); + XMLElement.prototype.a = function(name, value) { + return this.attribute(name, value); }; - XMLDocType.prototype.ele = function(name, value) { - return this.element(name, value); + XMLElement.prototype.getAttribute = function(name) { + if (this.attribs.hasOwnProperty(name)) { + return this.attribs[name].value; + } else { + return null; + } }; - XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { - return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue); + XMLElement.prototype.setAttribute = function(name, value) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocType.prototype.ent = function(name, value) { - return this.entity(name, value); + XMLElement.prototype.getAttributeNode = function(name) { + if (this.attribs.hasOwnProperty(name)) { + return this.attribs[name]; + } else { + return null; + } }; - XMLDocType.prototype.pent = function(name, value) { - return this.pEntity(name, value); + XMLElement.prototype.setAttributeNode = function(newAttr) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocType.prototype.not = function(name, value) { - return this.notation(name, value); + XMLElement.prototype.removeAttributeNode = function(oldAttr) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocType.prototype.up = function() { - return this.root() || this.documentObject; + XMLElement.prototype.getElementsByTagName = function(name) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocType.prototype.isEqualNode = function(node) { - if (!XMLDocType.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { + XMLElement.prototype.getAttributeNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.setAttributeNS = function(namespaceURI, qualifiedName, value) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.removeAttributeNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.getAttributeNodeNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.setAttributeNodeNS = function(newAttr) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.hasAttribute = function(name) { + return this.attribs.hasOwnProperty(name); + }; + + XMLElement.prototype.hasAttributeNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.setIdAttribute = function(name, isId) { + if (this.attribs.hasOwnProperty(name)) { + return this.attribs[name].isId; + } else { + return isId; + } + }; + + XMLElement.prototype.setIdAttributeNS = function(namespaceURI, localName, isId) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.setIdAttributeNode = function(idAttr, isId) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.getElementsByTagName = function(tagname) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.getElementsByClassName = function(classNames) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLElement.prototype.isEqualNode = function(node) { + var i, j, ref1; + if (!XMLElement.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { return false; } - if (node.name !== this.name) { + if (node.namespaceURI !== this.namespaceURI) { return false; } - if (node.publicId !== this.publicId) { + if (node.prefix !== this.prefix) { return false; } - if (node.systemId !== this.systemId) { + if (node.localName !== this.localName) { return false; } + if (node.attribs.length !== this.attribs.length) { + return false; + } + for (i = j = 0, ref1 = this.attribs.length - 1; 0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) { + if (!this.attribs[i].isEqualNode(node.attribs[i])) { + return false; + } + } return true; }; - return XMLDocType; + return XMLElement; })(XMLNode); @@ -81557,820 +80550,988 @@ module.exports.implForWrapper = function (wrapper) { /***/ }), -/***/ 3730: +/***/ 4361: +/***/ (function(module) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var XMLNamedNodeMap; + + module.exports = XMLNamedNodeMap = (function() { + function XMLNamedNodeMap(nodes) { + this.nodes = nodes; + } + + Object.defineProperty(XMLNamedNodeMap.prototype, 'length', { + get: function() { + return Object.keys(this.nodes).length || 0; + } + }); + + XMLNamedNodeMap.prototype.clone = function() { + return this.nodes = null; + }; + + XMLNamedNodeMap.prototype.getNamedItem = function(name) { + return this.nodes[name]; + }; + + XMLNamedNodeMap.prototype.setNamedItem = function(node) { + var oldNode; + oldNode = this.nodes[node.nodeName]; + this.nodes[node.nodeName] = node; + return oldNode || null; + }; + + XMLNamedNodeMap.prototype.removeNamedItem = function(name) { + var oldNode; + oldNode = this.nodes[name]; + delete this.nodes[name]; + return oldNode || null; + }; + + XMLNamedNodeMap.prototype.item = function(index) { + return this.nodes[Object.keys(this.nodes)[index]] || null; + }; + + XMLNamedNodeMap.prototype.getNamedItemNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented."); + }; + + XMLNamedNodeMap.prototype.setNamedItemNS = function(node) { + throw new Error("This DOM method is not implemented."); + }; + + XMLNamedNodeMap.prototype.removeNamedItemNS = function(namespaceURI, localName) { + throw new Error("This DOM method is not implemented."); + }; + + return XMLNamedNodeMap; + + })(); + +}).call(this); + + +/***/ }), + +/***/ 7608: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref1, hasProp = {}.hasOwnProperty; - isPlainObject = (__nccwpck_require__(8229).isPlainObject); + ref1 = __nccwpck_require__(8229), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue; - XMLDOMImplementation = __nccwpck_require__(8310); + XMLElement = null; - XMLDOMConfiguration = __nccwpck_require__(7465); + XMLCData = null; - XMLNode = __nccwpck_require__(7608); + XMLComment = null; - NodeType = __nccwpck_require__(9267); + XMLDeclaration = null; - XMLStringifier = __nccwpck_require__(8594); + XMLDocType = null; - XMLStringWriter = __nccwpck_require__(5913); + XMLRaw = null; - module.exports = XMLDocument = (function(superClass) { - extend(XMLDocument, superClass); + XMLText = null; - function XMLDocument(options) { - XMLDocument.__super__.constructor.call(this, null); - this.name = "#document"; - this.type = NodeType.Document; - this.documentURI = null; - this.domConfig = new XMLDOMConfiguration(); - options || (options = {}); - if (!options.writer) { - options.writer = new XMLStringWriter(); + XMLProcessingInstruction = null; + + XMLDummy = null; + + NodeType = null; + + XMLNodeList = null; + + XMLNamedNodeMap = null; + + DocumentPosition = null; + + module.exports = XMLNode = (function() { + function XMLNode(parent1) { + this.parent = parent1; + if (this.parent) { + this.options = this.parent.options; + this.stringify = this.parent.stringify; + } + this.value = null; + this.children = []; + this.baseURI = null; + if (!XMLElement) { + XMLElement = __nccwpck_require__(9437); + XMLCData = __nccwpck_require__(333); + XMLComment = __nccwpck_require__(4407); + XMLDeclaration = __nccwpck_require__(6364); + XMLDocType = __nccwpck_require__(1801); + XMLRaw = __nccwpck_require__(6329); + XMLText = __nccwpck_require__(1318); + XMLProcessingInstruction = __nccwpck_require__(6939); + XMLDummy = __nccwpck_require__(3590); + NodeType = __nccwpck_require__(9267); + XMLNodeList = __nccwpck_require__(6768); + XMLNamedNodeMap = __nccwpck_require__(4361); + DocumentPosition = __nccwpck_require__(2839); } - this.options = options; - this.stringify = new XMLStringifier(options); } - Object.defineProperty(XMLDocument.prototype, 'implementation', { - value: new XMLDOMImplementation() + Object.defineProperty(XMLNode.prototype, 'nodeName', { + get: function() { + return this.name; + } }); - Object.defineProperty(XMLDocument.prototype, 'doctype', { + Object.defineProperty(XMLNode.prototype, 'nodeType', { get: function() { - var child, i, len, ref; - ref = this.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - if (child.type === NodeType.DocType) { - return child; - } + return this.type; + } + }); + + Object.defineProperty(XMLNode.prototype, 'nodeValue', { + get: function() { + return this.value; + } + }); + + Object.defineProperty(XMLNode.prototype, 'parentNode', { + get: function() { + return this.parent; + } + }); + + Object.defineProperty(XMLNode.prototype, 'childNodes', { + get: function() { + if (!this.childNodeList || !this.childNodeList.nodes) { + this.childNodeList = new XMLNodeList(this.children); } - return null; + return this.childNodeList; } }); - Object.defineProperty(XMLDocument.prototype, 'documentElement', { + Object.defineProperty(XMLNode.prototype, 'firstChild', { get: function() { - return this.rootObject || null; + return this.children[0] || null; } }); - Object.defineProperty(XMLDocument.prototype, 'inputEncoding', { + Object.defineProperty(XMLNode.prototype, 'lastChild', { get: function() { - return null; + return this.children[this.children.length - 1] || null; } }); - Object.defineProperty(XMLDocument.prototype, 'strictErrorChecking', { + Object.defineProperty(XMLNode.prototype, 'previousSibling', { get: function() { - return false; + var i; + i = this.parent.children.indexOf(this); + return this.parent.children[i - 1] || null; } }); - Object.defineProperty(XMLDocument.prototype, 'xmlEncoding', { + Object.defineProperty(XMLNode.prototype, 'nextSibling', { get: function() { - if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { - return this.children[0].encoding; + var i; + i = this.parent.children.indexOf(this); + return this.parent.children[i + 1] || null; + } + }); + + Object.defineProperty(XMLNode.prototype, 'ownerDocument', { + get: function() { + return this.document() || null; + } + }); + + Object.defineProperty(XMLNode.prototype, 'textContent', { + get: function() { + var child, j, len, ref2, str; + if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) { + str = ''; + ref2 = this.children; + for (j = 0, len = ref2.length; j < len; j++) { + child = ref2[j]; + if (child.textContent) { + str += child.textContent; + } + } + return str; } else { return null; } - } - }); - - Object.defineProperty(XMLDocument.prototype, 'xmlStandalone', { - get: function() { - if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { - return this.children[0].standalone === 'yes'; + }, + set: function(value) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + } + }); + + XMLNode.prototype.setParent = function(parent) { + var child, j, len, ref2, results; + this.parent = parent; + if (parent) { + this.options = parent.options; + this.stringify = parent.stringify; + } + ref2 = this.children; + results = []; + for (j = 0, len = ref2.length; j < len; j++) { + child = ref2[j]; + results.push(child.setParent(this)); + } + return results; + }; + + XMLNode.prototype.element = function(name, attributes, text) { + var childNode, item, j, k, key, lastChild, len, len1, ref2, ref3, val; + lastChild = null; + if (attributes === null && (text == null)) { + ref2 = [{}, null], attributes = ref2[0], text = ref2[1]; + } + if (attributes == null) { + attributes = {}; + } + attributes = getValue(attributes); + if (!isObject(attributes)) { + ref3 = [attributes, text], text = ref3[0], attributes = ref3[1]; + } + if (name != null) { + name = getValue(name); + } + if (Array.isArray(name)) { + for (j = 0, len = name.length; j < len; j++) { + item = name[j]; + lastChild = this.element(item); + } + } else if (isFunction(name)) { + lastChild = this.element(name.apply()); + } else if (isObject(name)) { + for (key in name) { + if (!hasProp.call(name, key)) continue; + val = name[key]; + if (isFunction(val)) { + val = val.apply(); + } + if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) { + lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val); + } else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) { + lastChild = this.dummy(); + } else if (isObject(val) && isEmpty(val)) { + lastChild = this.element(key); + } else if (!this.options.keepNullNodes && (val == null)) { + lastChild = this.dummy(); + } else if (!this.options.separateArrayItems && Array.isArray(val)) { + for (k = 0, len1 = val.length; k < len1; k++) { + item = val[k]; + childNode = {}; + childNode[key] = item; + lastChild = this.element(childNode); + } + } else if (isObject(val)) { + if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) { + lastChild = this.element(val); + } else { + lastChild = this.element(key); + lastChild.element(val); + } + } else { + lastChild = this.element(key, val); + } + } + } else if (!this.options.keepNullNodes && text === null) { + lastChild = this.dummy(); + } else { + if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) { + lastChild = this.text(text); + } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) { + lastChild = this.cdata(text); + } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) { + lastChild = this.comment(text); + } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) { + lastChild = this.raw(text); + } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) { + lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text); } else { - return false; + lastChild = this.node(name, attributes, text); } } - }); + if (lastChild == null) { + throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo()); + } + return lastChild; + }; - Object.defineProperty(XMLDocument.prototype, 'xmlVersion', { - get: function() { - if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { - return this.children[0].version; + XMLNode.prototype.insertBefore = function(name, attributes, text) { + var child, i, newChild, refChild, removed; + if (name != null ? name.type : void 0) { + newChild = name; + refChild = attributes; + newChild.setParent(this); + if (refChild) { + i = children.indexOf(refChild); + removed = children.splice(i); + children.push(newChild); + Array.prototype.push.apply(children, removed); } else { - return "1.0"; + children.push(newChild); } + return newChild; + } else { + if (this.isRoot) { + throw new Error("Cannot insert elements at root level. " + this.debugInfo(name)); + } + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i); + child = this.parent.element(name, attributes, text); + Array.prototype.push.apply(this.parent.children, removed); + return child; } - }); - - Object.defineProperty(XMLDocument.prototype, 'URL', { - get: function() { - return this.documentURI; - } - }); + }; - Object.defineProperty(XMLDocument.prototype, 'origin', { - get: function() { - return null; + XMLNode.prototype.insertAfter = function(name, attributes, text) { + var child, i, removed; + if (this.isRoot) { + throw new Error("Cannot insert elements at root level. " + this.debugInfo(name)); } - }); + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i + 1); + child = this.parent.element(name, attributes, text); + Array.prototype.push.apply(this.parent.children, removed); + return child; + }; - Object.defineProperty(XMLDocument.prototype, 'compatMode', { - get: function() { - return null; + XMLNode.prototype.remove = function() { + var i, ref2; + if (this.isRoot) { + throw new Error("Cannot remove the root element. " + this.debugInfo()); } - }); + i = this.parent.children.indexOf(this); + [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref2 = [])), ref2; + return this.parent; + }; - Object.defineProperty(XMLDocument.prototype, 'characterSet', { - get: function() { - return null; + XMLNode.prototype.node = function(name, attributes, text) { + var child, ref2; + if (name != null) { + name = getValue(name); } - }); - - Object.defineProperty(XMLDocument.prototype, 'contentType', { - get: function() { - return null; + attributes || (attributes = {}); + attributes = getValue(attributes); + if (!isObject(attributes)) { + ref2 = [attributes, text], text = ref2[0], attributes = ref2[1]; } - }); - - XMLDocument.prototype.end = function(writer) { - var writerOptions; - writerOptions = {}; - if (!writer) { - writer = this.options.writer; - } else if (isPlainObject(writer)) { - writerOptions = writer; - writer = this.options.writer; + child = new XMLElement(this, name, attributes); + if (text != null) { + child.text(text); } - return writer.document(this, writer.filterOptions(writerOptions)); - }; - - XMLDocument.prototype.toString = function(options) { - return this.options.writer.document(this, this.options.writer.filterOptions(options)); - }; - - XMLDocument.prototype.createElement = function(tagName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createDocumentFragment = function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createTextNode = function(data) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createComment = function(data) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createCDATASection = function(data) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createProcessingInstruction = function(target, data) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createAttribute = function(name) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createEntityReference = function(name) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.getElementsByTagName = function(tagname) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.importNode = function(importedNode, deep) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createElementNS = function(namespaceURI, qualifiedName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.createAttributeNS = function(namespaceURI, qualifiedName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.getElementById = function(elementId) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - - XMLDocument.prototype.adoptNode = function(source) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + this.children.push(child); + return child; }; - XMLDocument.prototype.normalizeDocument = function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLNode.prototype.text = function(value) { + var child; + if (isObject(value)) { + this.element(value); + } + child = new XMLText(this, value); + this.children.push(child); + return this; }; - XMLDocument.prototype.renameNode = function(node, namespaceURI, qualifiedName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLNode.prototype.cdata = function(value) { + var child; + child = new XMLCData(this, value); + this.children.push(child); + return this; }; - XMLDocument.prototype.getElementsByClassName = function(classNames) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLNode.prototype.comment = function(value) { + var child; + child = new XMLComment(this, value); + this.children.push(child); + return this; }; - XMLDocument.prototype.createEvent = function(eventInterface) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLNode.prototype.commentBefore = function(value) { + var child, i, removed; + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i); + child = this.parent.comment(value); + Array.prototype.push.apply(this.parent.children, removed); + return this; }; - XMLDocument.prototype.createRange = function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLNode.prototype.commentAfter = function(value) { + var child, i, removed; + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i + 1); + child = this.parent.comment(value); + Array.prototype.push.apply(this.parent.children, removed); + return this; }; - XMLDocument.prototype.createNodeIterator = function(root, whatToShow, filter) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLNode.prototype.raw = function(value) { + var child; + child = new XMLRaw(this, value); + this.children.push(child); + return this; }; - XMLDocument.prototype.createTreeWalker = function(root, whatToShow, filter) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLNode.prototype.dummy = function() { + var child; + child = new XMLDummy(this); + return child; }; - return XMLDocument; - - })(XMLNode); - -}).call(this); - - -/***/ }), - -/***/ 7356: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, WriterState, XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocument, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject, ref, - hasProp = {}.hasOwnProperty; - - ref = __nccwpck_require__(8229), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue; - - NodeType = __nccwpck_require__(9267); - - XMLDocument = __nccwpck_require__(3730); - - XMLElement = __nccwpck_require__(9437); - - XMLCData = __nccwpck_require__(333); - - XMLComment = __nccwpck_require__(4407); - - XMLRaw = __nccwpck_require__(6329); - - XMLText = __nccwpck_require__(1318); - - XMLProcessingInstruction = __nccwpck_require__(6939); - - XMLDeclaration = __nccwpck_require__(6364); - - XMLDocType = __nccwpck_require__(1801); - - XMLDTDAttList = __nccwpck_require__(1015); - - XMLDTDEntity = __nccwpck_require__(53); - - XMLDTDElement = __nccwpck_require__(2421); - - XMLDTDNotation = __nccwpck_require__(2837); - - XMLAttribute = __nccwpck_require__(8376); - - XMLStringifier = __nccwpck_require__(8594); - - XMLStringWriter = __nccwpck_require__(5913); - - WriterState = __nccwpck_require__(9766); - - module.exports = XMLDocumentCB = (function() { - function XMLDocumentCB(options, onData, onEnd) { - var writerOptions; - this.name = "?xml"; - this.type = NodeType.Document; - options || (options = {}); - writerOptions = {}; - if (!options.writer) { - options.writer = new XMLStringWriter(); - } else if (isPlainObject(options.writer)) { - writerOptions = options.writer; - options.writer = new XMLStringWriter(); + XMLNode.prototype.instruction = function(target, value) { + var insTarget, insValue, instruction, j, len; + if (target != null) { + target = getValue(target); } - this.options = options; - this.writer = options.writer; - this.writerOptions = this.writer.filterOptions(writerOptions); - this.stringify = new XMLStringifier(options); - this.onDataCallback = onData || function() {}; - this.onEndCallback = onEnd || function() {}; - this.currentNode = null; - this.currentLevel = -1; - this.openTags = {}; - this.documentStarted = false; - this.documentCompleted = false; - this.root = null; - } - - XMLDocumentCB.prototype.createChildNode = function(node) { - var att, attName, attributes, child, i, len, ref1, ref2; - switch (node.type) { - case NodeType.CData: - this.cdata(node.value); - break; - case NodeType.Comment: - this.comment(node.value); - break; - case NodeType.Element: - attributes = {}; - ref1 = node.attribs; - for (attName in ref1) { - if (!hasProp.call(ref1, attName)) continue; - att = ref1[attName]; - attributes[attName] = att.value; - } - this.node(node.name, attributes); - break; - case NodeType.Dummy: - this.dummy(); - break; - case NodeType.Raw: - this.raw(node.value); - break; - case NodeType.Text: - this.text(node.value); - break; - case NodeType.ProcessingInstruction: - this.instruction(node.target, node.value); - break; - default: - throw new Error("This XML node type is not supported in a JS object: " + node.constructor.name); + if (value != null) { + value = getValue(value); } - ref2 = node.children; - for (i = 0, len = ref2.length; i < len; i++) { - child = ref2[i]; - this.createChildNode(child); - if (child.type === NodeType.Element) { - this.up(); + if (Array.isArray(target)) { + for (j = 0, len = target.length; j < len; j++) { + insTarget = target[j]; + this.instruction(insTarget); + } + } else if (isObject(target)) { + for (insTarget in target) { + if (!hasProp.call(target, insTarget)) continue; + insValue = target[insTarget]; + this.instruction(insTarget, insValue); + } + } else { + if (isFunction(value)) { + value = value.apply(); } + instruction = new XMLProcessingInstruction(this, target, value); + this.children.push(instruction); } return this; }; - XMLDocumentCB.prototype.dummy = function() { + XMLNode.prototype.instructionBefore = function(target, value) { + var child, i, removed; + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i); + child = this.parent.instruction(target, value); + Array.prototype.push.apply(this.parent.children, removed); return this; }; - XMLDocumentCB.prototype.node = function(name, attributes, text) { - var ref1; - if (name == null) { - throw new Error("Missing node name."); - } - if (this.root && this.currentLevel === -1) { - throw new Error("Document can only have one root node. " + this.debugInfo(name)); + XMLNode.prototype.instructionAfter = function(target, value) { + var child, i, removed; + i = this.parent.children.indexOf(this); + removed = this.parent.children.splice(i + 1); + child = this.parent.instruction(target, value); + Array.prototype.push.apply(this.parent.children, removed); + return this; + }; + + XMLNode.prototype.declaration = function(version, encoding, standalone) { + var doc, xmldec; + doc = this.document(); + xmldec = new XMLDeclaration(doc, version, encoding, standalone); + if (doc.children.length === 0) { + doc.children.unshift(xmldec); + } else if (doc.children[0].type === NodeType.Declaration) { + doc.children[0] = xmldec; + } else { + doc.children.unshift(xmldec); } - this.openCurrent(); - name = getValue(name); - if (attributes == null) { - attributes = {}; + return doc.root() || doc; + }; + + XMLNode.prototype.dtd = function(pubID, sysID) { + var child, doc, doctype, i, j, k, len, len1, ref2, ref3; + doc = this.document(); + doctype = new XMLDocType(doc, pubID, sysID); + ref2 = doc.children; + for (i = j = 0, len = ref2.length; j < len; i = ++j) { + child = ref2[i]; + if (child.type === NodeType.DocType) { + doc.children[i] = doctype; + return doctype; + } } - attributes = getValue(attributes); - if (!isObject(attributes)) { - ref1 = [attributes, text], text = ref1[0], attributes = ref1[1]; + ref3 = doc.children; + for (i = k = 0, len1 = ref3.length; k < len1; i = ++k) { + child = ref3[i]; + if (child.isRoot) { + doc.children.splice(i, 0, doctype); + return doctype; + } } - this.currentNode = new XMLElement(this, name, attributes); - this.currentNode.children = false; - this.currentLevel++; - this.openTags[this.currentLevel] = this.currentNode; - if (text != null) { - this.text(text); + doc.children.push(doctype); + return doctype; + }; + + XMLNode.prototype.up = function() { + if (this.isRoot) { + throw new Error("The root node has no parent. Use doc() if you need to get the document object."); } - return this; + return this.parent; }; - XMLDocumentCB.prototype.element = function(name, attributes, text) { - var child, i, len, oldValidationFlag, ref1, root; - if (this.currentNode && this.currentNode.type === NodeType.DocType) { - this.dtdElement.apply(this, arguments); - } else { - if (Array.isArray(name) || isObject(name) || isFunction(name)) { - oldValidationFlag = this.options.noValidation; - this.options.noValidation = true; - root = new XMLDocument(this.options).element('TEMP_ROOT'); - root.element(name); - this.options.noValidation = oldValidationFlag; - ref1 = root.children; - for (i = 0, len = ref1.length; i < len; i++) { - child = ref1[i]; - this.createChildNode(child); - if (child.type === NodeType.Element) { - this.up(); - } - } + XMLNode.prototype.root = function() { + var node; + node = this; + while (node) { + if (node.type === NodeType.Document) { + return node.rootObject; + } else if (node.isRoot) { + return node; } else { - this.node(name, attributes, text); + node = node.parent; } } - return this; }; - XMLDocumentCB.prototype.attribute = function(name, value) { - var attName, attValue; - if (!this.currentNode || this.currentNode.children) { - throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name)); - } - if (name != null) { - name = getValue(name); - } - if (isObject(name)) { - for (attName in name) { - if (!hasProp.call(name, attName)) continue; - attValue = name[attName]; - this.attribute(attName, attValue); - } - } else { - if (isFunction(value)) { - value = value.apply(); - } - if (this.options.keepNullAttributes && (value == null)) { - this.currentNode.attribs[name] = new XMLAttribute(this, name, ""); - } else if (value != null) { - this.currentNode.attribs[name] = new XMLAttribute(this, name, value); + XMLNode.prototype.document = function() { + var node; + node = this; + while (node) { + if (node.type === NodeType.Document) { + return node; + } else { + node = node.parent; } } - return this; }; - XMLDocumentCB.prototype.text = function(value) { - var node; - this.openCurrent(); - node = new XMLText(this, value); - this.onData(this.writer.text(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.end = function(options) { + return this.document().end(options); }; - XMLDocumentCB.prototype.cdata = function(value) { - var node; - this.openCurrent(); - node = new XMLCData(this, value); - this.onData(this.writer.cdata(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.prev = function() { + var i; + i = this.parent.children.indexOf(this); + if (i < 1) { + throw new Error("Already at the first node. " + this.debugInfo()); + } + return this.parent.children[i - 1]; }; - XMLDocumentCB.prototype.comment = function(value) { - var node; - this.openCurrent(); - node = new XMLComment(this, value); - this.onData(this.writer.comment(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.next = function() { + var i; + i = this.parent.children.indexOf(this); + if (i === -1 || i === this.parent.children.length - 1) { + throw new Error("Already at the last node. " + this.debugInfo()); + } + return this.parent.children[i + 1]; }; - XMLDocumentCB.prototype.raw = function(value) { - var node; - this.openCurrent(); - node = new XMLRaw(this, value); - this.onData(this.writer.raw(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + XMLNode.prototype.importDocument = function(doc) { + var clonedRoot; + clonedRoot = doc.root().clone(); + clonedRoot.parent = this; + clonedRoot.isRoot = false; + this.children.push(clonedRoot); return this; }; - XMLDocumentCB.prototype.instruction = function(target, value) { - var i, insTarget, insValue, len, node; - this.openCurrent(); - if (target != null) { - target = getValue(target); - } - if (value != null) { - value = getValue(value); - } - if (Array.isArray(target)) { - for (i = 0, len = target.length; i < len; i++) { - insTarget = target[i]; - this.instruction(insTarget); - } - } else if (isObject(target)) { - for (insTarget in target) { - if (!hasProp.call(target, insTarget)) continue; - insValue = target[insTarget]; - this.instruction(insTarget, insValue); - } + XMLNode.prototype.debugInfo = function(name) { + var ref2, ref3; + name = name || this.name; + if ((name == null) && !((ref2 = this.parent) != null ? ref2.name : void 0)) { + return ""; + } else if (name == null) { + return "parent: <" + this.parent.name + ">"; + } else if (!((ref3 = this.parent) != null ? ref3.name : void 0)) { + return "node: <" + name + ">"; } else { - if (isFunction(value)) { - value = value.apply(); - } - node = new XMLProcessingInstruction(this, target, value); - this.onData(this.writer.processingInstruction(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); + return "node: <" + name + ">, parent: <" + this.parent.name + ">"; } - return this; }; - XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) { - var node; - this.openCurrent(); - if (this.documentStarted) { - throw new Error("declaration() must be the first node."); - } - node = new XMLDeclaration(this, version, encoding, standalone); - this.onData(this.writer.declaration(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.ele = function(name, attributes, text) { + return this.element(name, attributes, text); }; - XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) { - this.openCurrent(); - if (root == null) { - throw new Error("Missing root node name."); - } - if (this.root) { - throw new Error("dtd() must come before the root node."); - } - this.currentNode = new XMLDocType(this, pubID, sysID); - this.currentNode.rootNodeName = root; - this.currentNode.children = false; - this.currentLevel++; - this.openTags[this.currentLevel] = this.currentNode; - return this; + XMLNode.prototype.nod = function(name, attributes, text) { + return this.node(name, attributes, text); }; - XMLDocumentCB.prototype.dtdElement = function(name, value) { - var node; - this.openCurrent(); - node = new XMLDTDElement(this, name, value); - this.onData(this.writer.dtdElement(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.txt = function(value) { + return this.text(value); }; - XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { - var node; - this.openCurrent(); - node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); - this.onData(this.writer.dtdAttList(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.dat = function(value) { + return this.cdata(value); }; - XMLDocumentCB.prototype.entity = function(name, value) { - var node; - this.openCurrent(); - node = new XMLDTDEntity(this, false, name, value); - this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.com = function(value) { + return this.comment(value); }; - XMLDocumentCB.prototype.pEntity = function(name, value) { - var node; - this.openCurrent(); - node = new XMLDTDEntity(this, true, name, value); - this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.ins = function(target, value) { + return this.instruction(target, value); }; - XMLDocumentCB.prototype.notation = function(name, value) { - var node; - this.openCurrent(); - node = new XMLDTDNotation(this, name, value); - this.onData(this.writer.dtdNotation(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); - return this; + XMLNode.prototype.doc = function() { + return this.document(); }; - XMLDocumentCB.prototype.up = function() { - if (this.currentLevel < 0) { - throw new Error("The document node has no parent."); - } - if (this.currentNode) { - if (this.currentNode.children) { - this.closeNode(this.currentNode); + XMLNode.prototype.dec = function(version, encoding, standalone) { + return this.declaration(version, encoding, standalone); + }; + + XMLNode.prototype.e = function(name, attributes, text) { + return this.element(name, attributes, text); + }; + + XMLNode.prototype.n = function(name, attributes, text) { + return this.node(name, attributes, text); + }; + + XMLNode.prototype.t = function(value) { + return this.text(value); + }; + + XMLNode.prototype.d = function(value) { + return this.cdata(value); + }; + + XMLNode.prototype.c = function(value) { + return this.comment(value); + }; + + XMLNode.prototype.r = function(value) { + return this.raw(value); + }; + + XMLNode.prototype.i = function(target, value) { + return this.instruction(target, value); + }; + + XMLNode.prototype.u = function() { + return this.up(); + }; + + XMLNode.prototype.importXMLBuilder = function(doc) { + return this.importDocument(doc); + }; + + XMLNode.prototype.replaceChild = function(newChild, oldChild) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLNode.prototype.removeChild = function(oldChild) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLNode.prototype.appendChild = function(newChild) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLNode.prototype.hasChildNodes = function() { + return this.children.length !== 0; + }; + + XMLNode.prototype.cloneNode = function(deep) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLNode.prototype.normalize = function() { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLNode.prototype.isSupported = function(feature, version) { + return true; + }; + + XMLNode.prototype.hasAttributes = function() { + return this.attribs.length !== 0; + }; + + XMLNode.prototype.compareDocumentPosition = function(other) { + var ref, res; + ref = this; + if (ref === other) { + return 0; + } else if (this.document() !== other.document()) { + res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific; + if (Math.random() < 0.5) { + res |= DocumentPosition.Preceding; } else { - this.openNode(this.currentNode); + res |= DocumentPosition.Following; } - this.currentNode = null; + return res; + } else if (ref.isAncestor(other)) { + return DocumentPosition.Contains | DocumentPosition.Preceding; + } else if (ref.isDescendant(other)) { + return DocumentPosition.Contains | DocumentPosition.Following; + } else if (ref.isPreceding(other)) { + return DocumentPosition.Preceding; } else { - this.closeNode(this.openTags[this.currentLevel]); + return DocumentPosition.Following; } - delete this.openTags[this.currentLevel]; - this.currentLevel--; - return this; }; - XMLDocumentCB.prototype.end = function() { - while (this.currentLevel >= 0) { - this.up(); - } - return this.onEnd(); + XMLNode.prototype.isSameNode = function(other) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocumentCB.prototype.openCurrent = function() { - if (this.currentNode) { - this.currentNode.children = true; - return this.openNode(this.currentNode); - } + XMLNode.prototype.lookupPrefix = function(namespaceURI) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocumentCB.prototype.openNode = function(node) { - var att, chunk, name, ref1; - if (!node.isOpen) { - if (!this.root && this.currentLevel === 0 && node.type === NodeType.Element) { - this.root = node; - } - chunk = ''; - if (node.type === NodeType.Element) { - this.writerOptions.state = WriterState.OpenTag; - chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<' + node.name; - ref1 = node.attribs; - for (name in ref1) { - if (!hasProp.call(ref1, name)) continue; - att = ref1[name]; - chunk += this.writer.attribute(att, this.writerOptions, this.currentLevel); - } - chunk += (node.children ? '>' : '/>') + this.writer.endline(node, this.writerOptions, this.currentLevel); - this.writerOptions.state = WriterState.InsideTag; - } else { - this.writerOptions.state = WriterState.OpenTag; - chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ''; - } - chunk += this.writer.endline(node, this.writerOptions, this.currentLevel); - } - this.onData(chunk, this.currentLevel); - return node.isOpen = true; - } + XMLNode.prototype.isDefaultNamespace = function(namespaceURI) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocumentCB.prototype.closeNode = function(node) { - var chunk; - if (!node.isClosed) { - chunk = ''; - this.writerOptions.state = WriterState.CloseTag; - if (node.type === NodeType.Element) { - chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '' + this.writer.endline(node, this.writerOptions, this.currentLevel); - } else { - chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ']>' + this.writer.endline(node, this.writerOptions, this.currentLevel); + XMLNode.prototype.lookupNamespaceURI = function(prefix) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); + }; + + XMLNode.prototype.isEqualNode = function(node) { + var i, j, ref2; + if (node.nodeType !== this.nodeType) { + return false; + } + if (node.children.length !== this.children.length) { + return false; + } + for (i = j = 0, ref2 = this.children.length - 1; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) { + if (!this.children[i].isEqualNode(node.children[i])) { + return false; } - this.writerOptions.state = WriterState.None; - this.onData(chunk, this.currentLevel); - return node.isClosed = true; } + return true; }; - XMLDocumentCB.prototype.onData = function(chunk, level) { - this.documentStarted = true; - return this.onDataCallback(chunk, level + 1); + XMLNode.prototype.getFeature = function(feature, version) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocumentCB.prototype.onEnd = function() { - this.documentCompleted = true; - return this.onEndCallback(); + XMLNode.prototype.setUserData = function(key, data, handler) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocumentCB.prototype.debugInfo = function(name) { - if (name == null) { - return ""; - } else { - return "node: <" + name + ">"; - } + XMLNode.prototype.getUserData = function(key) { + throw new Error("This DOM method is not implemented." + this.debugInfo()); }; - XMLDocumentCB.prototype.ele = function() { - return this.element.apply(this, arguments); + XMLNode.prototype.contains = function(other) { + if (!other) { + return false; + } + return other === this || this.isDescendant(other); }; - XMLDocumentCB.prototype.nod = function(name, attributes, text) { - return this.node(name, attributes, text); + XMLNode.prototype.isDescendant = function(node) { + var child, isDescendantChild, j, len, ref2; + ref2 = this.children; + for (j = 0, len = ref2.length; j < len; j++) { + child = ref2[j]; + if (node === child) { + return true; + } + isDescendantChild = child.isDescendant(node); + if (isDescendantChild) { + return true; + } + } + return false; }; - XMLDocumentCB.prototype.txt = function(value) { - return this.text(value); + XMLNode.prototype.isAncestor = function(node) { + return node.isDescendant(this); }; - XMLDocumentCB.prototype.dat = function(value) { - return this.cdata(value); + XMLNode.prototype.isPreceding = function(node) { + var nodePos, thisPos; + nodePos = this.treePosition(node); + thisPos = this.treePosition(this); + if (nodePos === -1 || thisPos === -1) { + return false; + } else { + return nodePos < thisPos; + } }; - XMLDocumentCB.prototype.com = function(value) { - return this.comment(value); + XMLNode.prototype.isFollowing = function(node) { + var nodePos, thisPos; + nodePos = this.treePosition(node); + thisPos = this.treePosition(this); + if (nodePos === -1 || thisPos === -1) { + return false; + } else { + return nodePos > thisPos; + } }; - XMLDocumentCB.prototype.ins = function(target, value) { - return this.instruction(target, value); + XMLNode.prototype.treePosition = function(node) { + var found, pos; + pos = 0; + found = false; + this.foreachTreeNode(this.document(), function(childNode) { + pos++; + if (!found && childNode === node) { + return found = true; + } + }); + if (found) { + return pos; + } else { + return -1; + } }; - XMLDocumentCB.prototype.dec = function(version, encoding, standalone) { - return this.declaration(version, encoding, standalone); + XMLNode.prototype.foreachTreeNode = function(node, func) { + var child, j, len, ref2, res; + node || (node = this.document()); + ref2 = node.children; + for (j = 0, len = ref2.length; j < len; j++) { + child = ref2[j]; + if (res = func(child)) { + return res; + } else { + res = this.foreachTreeNode(child, func); + if (res) { + return res; + } + } + } }; - XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) { - return this.doctype(root, pubID, sysID); - }; + return XMLNode; - XMLDocumentCB.prototype.e = function(name, attributes, text) { - return this.element(name, attributes, text); + })(); + +}).call(this); + + +/***/ }), + +/***/ 6768: +/***/ (function(module) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var XMLNodeList; + + module.exports = XMLNodeList = (function() { + function XMLNodeList(nodes) { + this.nodes = nodes; + } + + Object.defineProperty(XMLNodeList.prototype, 'length', { + get: function() { + return this.nodes.length || 0; + } + }); + + XMLNodeList.prototype.clone = function() { + return this.nodes = null; }; - XMLDocumentCB.prototype.n = function(name, attributes, text) { - return this.node(name, attributes, text); + XMLNodeList.prototype.item = function(index) { + return this.nodes[index] || null; }; - XMLDocumentCB.prototype.t = function(value) { - return this.text(value); - }; + return XMLNodeList; + + })(); + +}).call(this); + + +/***/ }), + +/***/ 6939: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - XMLDocumentCB.prototype.d = function(value) { - return this.cdata(value); - }; +// Generated by CoffeeScript 1.12.7 +(function() { + var NodeType, XMLCharacterData, XMLProcessingInstruction, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - XMLDocumentCB.prototype.c = function(value) { - return this.comment(value); - }; + NodeType = __nccwpck_require__(9267); - XMLDocumentCB.prototype.r = function(value) { - return this.raw(value); - }; + XMLCharacterData = __nccwpck_require__(7709); - XMLDocumentCB.prototype.i = function(target, value) { - return this.instruction(target, value); - }; + module.exports = XMLProcessingInstruction = (function(superClass) { + extend(XMLProcessingInstruction, superClass); - XMLDocumentCB.prototype.att = function() { - if (this.currentNode && this.currentNode.type === NodeType.DocType) { - return this.attList.apply(this, arguments); - } else { - return this.attribute.apply(this, arguments); + function XMLProcessingInstruction(parent, target, value) { + XMLProcessingInstruction.__super__.constructor.call(this, parent); + if (target == null) { + throw new Error("Missing instruction target. " + this.debugInfo()); } - }; - - XMLDocumentCB.prototype.a = function() { - if (this.currentNode && this.currentNode.type === NodeType.DocType) { - return this.attList.apply(this, arguments); - } else { - return this.attribute.apply(this, arguments); + this.type = NodeType.ProcessingInstruction; + this.target = this.stringify.insTarget(target); + this.name = this.target; + if (value) { + this.value = this.stringify.insValue(value); } - }; + } - XMLDocumentCB.prototype.ent = function(name, value) { - return this.entity(name, value); + XMLProcessingInstruction.prototype.clone = function() { + return Object.create(this); }; - XMLDocumentCB.prototype.pent = function(name, value) { - return this.pEntity(name, value); + XMLProcessingInstruction.prototype.toString = function(options) { + return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options)); }; - XMLDocumentCB.prototype.not = function(name, value) { - return this.notation(name, value); + XMLProcessingInstruction.prototype.isEqualNode = function(node) { + if (!XMLProcessingInstruction.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { + return false; + } + if (node.target !== this.target) { + return false; + } + return true; }; - return XMLDocumentCB; + return XMLProcessingInstruction; - })(); + })(XMLCharacterData); }).call(this); /***/ }), -/***/ 3590: +/***/ 6329: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var NodeType, XMLDummy, XMLNode, + var NodeType, XMLNode, XMLRaw, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - XMLNode = __nccwpck_require__(7608); - NodeType = __nccwpck_require__(9267); - module.exports = XMLDummy = (function(superClass) { - extend(XMLDummy, superClass); + XMLNode = __nccwpck_require__(7608); - function XMLDummy(parent) { - XMLDummy.__super__.constructor.call(this, parent); - this.type = NodeType.Dummy; + module.exports = XMLRaw = (function(superClass) { + extend(XMLRaw, superClass); + + function XMLRaw(parent, text) { + XMLRaw.__super__.constructor.call(this, parent); + if (text == null) { + throw new Error("Missing raw text. " + this.debugInfo()); + } + this.type = NodeType.Raw; + this.value = this.stringify.raw(text); } - XMLDummy.prototype.clone = function() { + XMLRaw.prototype.clone = function() { return Object.create(this); }; - XMLDummy.prototype.toString = function(options) { - return ''; + XMLRaw.prototype.toString = function(options) { + return this.options.writer.raw(this, this.options.writer.filterOptions(options)); }; - return XMLDummy; + return XMLRaw; })(XMLNode); @@ -82379,368 +81540,470 @@ module.exports.implForWrapper = function (wrapper) { /***/ }), -/***/ 9437: +/***/ 8601: /***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { // Generated by CoffeeScript 1.12.7 (function() { - var NodeType, XMLAttribute, XMLElement, XMLNamedNodeMap, XMLNode, getValue, isFunction, isObject, ref, + var NodeType, WriterState, XMLStreamWriter, XMLWriterBase, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - ref = __nccwpck_require__(8229), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue; - - XMLNode = __nccwpck_require__(7608); - NodeType = __nccwpck_require__(9267); - XMLAttribute = __nccwpck_require__(8376); + XMLWriterBase = __nccwpck_require__(6752); - XMLNamedNodeMap = __nccwpck_require__(4361); + WriterState = __nccwpck_require__(9766); - module.exports = XMLElement = (function(superClass) { - extend(XMLElement, superClass); + module.exports = XMLStreamWriter = (function(superClass) { + extend(XMLStreamWriter, superClass); - function XMLElement(parent, name, attributes) { - var child, j, len, ref1; - XMLElement.__super__.constructor.call(this, parent); - if (name == null) { - throw new Error("Missing element name. " + this.debugInfo()); - } - this.name = this.stringify.name(name); - this.type = NodeType.Element; - this.attribs = {}; - this.schemaTypeInfo = null; - if (attributes != null) { - this.attribute(attributes); - } - if (parent.type === NodeType.Document) { - this.isRoot = true; - this.documentObject = parent; - parent.rootObject = this; - if (parent.children) { - ref1 = parent.children; - for (j = 0, len = ref1.length; j < len; j++) { - child = ref1[j]; - if (child.type === NodeType.DocType) { - child.name = this.name; - break; - } - } - } - } + function XMLStreamWriter(stream, options) { + this.stream = stream; + XMLStreamWriter.__super__.constructor.call(this, options); } - Object.defineProperty(XMLElement.prototype, 'tagName', { - get: function() { - return this.name; - } - }); - - Object.defineProperty(XMLElement.prototype, 'namespaceURI', { - get: function() { + XMLStreamWriter.prototype.endline = function(node, options, level) { + if (node.isLastRootNode && options.state === WriterState.CloseTag) { return ''; + } else { + return XMLStreamWriter.__super__.endline.call(this, node, options, level); } - }); + }; - Object.defineProperty(XMLElement.prototype, 'prefix', { - get: function() { - return ''; + XMLStreamWriter.prototype.document = function(doc, options) { + var child, i, j, k, len, len1, ref, ref1, results; + ref = doc.children; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + child = ref[i]; + child.isLastRootNode = i === doc.children.length - 1; } - }); - - Object.defineProperty(XMLElement.prototype, 'localName', { - get: function() { - return this.name; + options = this.filterOptions(options); + ref1 = doc.children; + results = []; + for (k = 0, len1 = ref1.length; k < len1; k++) { + child = ref1[k]; + results.push(this.writeChildNode(child, options, 0)); } - }); + return results; + }; - Object.defineProperty(XMLElement.prototype, 'id', { - get: function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - } - }); + XMLStreamWriter.prototype.attribute = function(att, options, level) { + return this.stream.write(XMLStreamWriter.__super__.attribute.call(this, att, options, level)); + }; - Object.defineProperty(XMLElement.prototype, 'className', { - get: function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - } - }); + XMLStreamWriter.prototype.cdata = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.cdata.call(this, node, options, level)); + }; - Object.defineProperty(XMLElement.prototype, 'classList', { - get: function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - } - }); + XMLStreamWriter.prototype.comment = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.comment.call(this, node, options, level)); + }; - Object.defineProperty(XMLElement.prototype, 'attributes', { - get: function() { - if (!this.attributeMap || !this.attributeMap.nodes) { - this.attributeMap = new XMLNamedNodeMap(this.attribs); - } - return this.attributeMap; - } - }); + XMLStreamWriter.prototype.declaration = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.declaration.call(this, node, options, level)); + }; - XMLElement.prototype.clone = function() { - var att, attName, clonedSelf, ref1; - clonedSelf = Object.create(this); - if (clonedSelf.isRoot) { - clonedSelf.documentObject = null; + XMLStreamWriter.prototype.docType = function(node, options, level) { + var child, j, len, ref; + level || (level = 0); + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + this.stream.write(this.indent(node, options, level)); + this.stream.write(' 0) { + this.stream.write(' ['); + this.stream.write(this.endline(node, options, level)); + options.state = WriterState.InsideTag; + ref = node.children; + for (j = 0, len = ref.length; j < len; j++) { + child = ref[j]; + this.writeChildNode(child, options, level + 1); + } + options.state = WriterState.CloseTag; + this.stream.write(']'); } - clonedSelf.children = []; - this.children.forEach(function(child) { - var clonedChild; - clonedChild = child.clone(); - clonedChild.parent = clonedSelf; - return clonedSelf.children.push(clonedChild); - }); - return clonedSelf; + options.state = WriterState.CloseTag; + this.stream.write(options.spaceBeforeSlash + '>'); + this.stream.write(this.endline(node, options, level)); + options.state = WriterState.None; + return this.closeNode(node, options, level); }; - XMLElement.prototype.attribute = function(name, value) { - var attName, attValue; - if (name != null) { - name = getValue(name); + XMLStreamWriter.prototype.element = function(node, options, level) { + var att, child, childNodeCount, firstChildNode, j, len, name, prettySuppressed, ref, ref1; + level || (level = 0); + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + this.stream.write(this.indent(node, options, level) + '<' + node.name); + ref = node.attribs; + for (name in ref) { + if (!hasProp.call(ref, name)) continue; + att = ref[name]; + this.attribute(att, options, level); } - if (isObject(name)) { - for (attName in name) { - if (!hasProp.call(name, attName)) continue; - attValue = name[attName]; - this.attribute(attName, attValue); + childNodeCount = node.children.length; + firstChildNode = childNodeCount === 0 ? null : node.children[0]; + if (childNodeCount === 0 || node.children.every(function(e) { + return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === ''; + })) { + if (options.allowEmpty) { + this.stream.write('>'); + options.state = WriterState.CloseTag; + this.stream.write(''); + } else { + options.state = WriterState.CloseTag; + this.stream.write(options.spaceBeforeSlash + '/>'); } + } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) { + this.stream.write('>'); + options.state = WriterState.InsideTag; + options.suppressPrettyCount++; + prettySuppressed = true; + this.writeChildNode(firstChildNode, options, level + 1); + options.suppressPrettyCount--; + prettySuppressed = false; + options.state = WriterState.CloseTag; + this.stream.write(''); } else { - if (isFunction(value)) { - value = value.apply(); - } - if (this.options.keepNullAttributes && (value == null)) { - this.attribs[name] = new XMLAttribute(this, name, ""); - } else if (value != null) { - this.attribs[name] = new XMLAttribute(this, name, value); + this.stream.write('>' + this.endline(node, options, level)); + options.state = WriterState.InsideTag; + ref1 = node.children; + for (j = 0, len = ref1.length; j < len; j++) { + child = ref1[j]; + this.writeChildNode(child, options, level + 1); } + options.state = WriterState.CloseTag; + this.stream.write(this.indent(node, options, level) + ''); } - return this; + this.stream.write(this.endline(node, options, level)); + options.state = WriterState.None; + return this.closeNode(node, options, level); }; - XMLElement.prototype.removeAttribute = function(name) { - var attName, j, len; - if (name == null) { - throw new Error("Missing attribute name. " + this.debugInfo()); - } - name = getValue(name); - if (Array.isArray(name)) { - for (j = 0, len = name.length; j < len; j++) { - attName = name[j]; - delete this.attribs[attName]; - } - } else { - delete this.attribs[name]; - } - return this; + XMLStreamWriter.prototype.processingInstruction = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.processingInstruction.call(this, node, options, level)); }; - XMLElement.prototype.toString = function(options) { - return this.options.writer.element(this, this.options.writer.filterOptions(options)); + XMLStreamWriter.prototype.raw = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.raw.call(this, node, options, level)); }; - XMLElement.prototype.att = function(name, value) { - return this.attribute(name, value); + XMLStreamWriter.prototype.text = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.text.call(this, node, options, level)); }; - XMLElement.prototype.a = function(name, value) { - return this.attribute(name, value); + XMLStreamWriter.prototype.dtdAttList = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.dtdAttList.call(this, node, options, level)); }; - XMLElement.prototype.getAttribute = function(name) { - if (this.attribs.hasOwnProperty(name)) { - return this.attribs[name].value; - } else { - return null; - } + XMLStreamWriter.prototype.dtdElement = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.dtdElement.call(this, node, options, level)); }; - XMLElement.prototype.setAttribute = function(name, value) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStreamWriter.prototype.dtdEntity = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.dtdEntity.call(this, node, options, level)); }; - XMLElement.prototype.getAttributeNode = function(name) { - if (this.attribs.hasOwnProperty(name)) { - return this.attribs[name]; - } else { - return null; - } + XMLStreamWriter.prototype.dtdNotation = function(node, options, level) { + return this.stream.write(XMLStreamWriter.__super__.dtdNotation.call(this, node, options, level)); }; - XMLElement.prototype.setAttributeNode = function(newAttr) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + return XMLStreamWriter; + + })(XMLWriterBase); + +}).call(this); + + +/***/ }), + +/***/ 5913: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var XMLStringWriter, XMLWriterBase, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + XMLWriterBase = __nccwpck_require__(6752); + + module.exports = XMLStringWriter = (function(superClass) { + extend(XMLStringWriter, superClass); + + function XMLStringWriter(options) { + XMLStringWriter.__super__.constructor.call(this, options); + } + + XMLStringWriter.prototype.document = function(doc, options) { + var child, i, len, r, ref; + options = this.filterOptions(options); + r = ''; + ref = doc.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + r += this.writeChildNode(child, options, 0); + } + if (options.pretty && r.slice(-options.newline.length) === options.newline) { + r = r.slice(0, -options.newline.length); + } + return r; }; - XMLElement.prototype.removeAttributeNode = function(oldAttr) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + return XMLStringWriter; + + })(XMLWriterBase); + +}).call(this); + + +/***/ }), + +/***/ 8594: +/***/ (function(module) { + +// Generated by CoffeeScript 1.12.7 +(function() { + var XMLStringifier, + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + hasProp = {}.hasOwnProperty; + + module.exports = XMLStringifier = (function() { + function XMLStringifier(options) { + this.assertLegalName = bind(this.assertLegalName, this); + this.assertLegalChar = bind(this.assertLegalChar, this); + var key, ref, value; + options || (options = {}); + this.options = options; + if (!this.options.version) { + this.options.version = '1.0'; + } + ref = options.stringify || {}; + for (key in ref) { + if (!hasProp.call(ref, key)) continue; + value = ref[key]; + this[key] = value; + } + } + + XMLStringifier.prototype.name = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalName('' + val || ''); }; - XMLElement.prototype.getElementsByTagName = function(name) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.text = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar(this.textEscape('' + val || '')); }; - XMLElement.prototype.getAttributeNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.cdata = function(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + val = val.replace(']]>', ']]]]>'); + return this.assertLegalChar(val); }; - XMLElement.prototype.setAttributeNS = function(namespaceURI, qualifiedName, value) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.comment = function(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + if (val.match(/--/)) { + throw new Error("Comment text cannot contain double-hypen: " + val); + } + return this.assertLegalChar(val); }; - XMLElement.prototype.removeAttributeNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.raw = function(val) { + if (this.options.noValidation) { + return val; + } + return '' + val || ''; }; - XMLElement.prototype.getAttributeNodeNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.attValue = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar(this.attEscape(val = '' + val || '')); }; - XMLElement.prototype.setAttributeNodeNS = function(newAttr) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.insTarget = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); }; - XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.insValue = function(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + if (val.match(/\?>/)) { + throw new Error("Invalid processing instruction value: " + val); + } + return this.assertLegalChar(val); }; - XMLElement.prototype.hasAttribute = function(name) { - return this.attribs.hasOwnProperty(name); + XMLStringifier.prototype.xmlVersion = function(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + if (!val.match(/1\.[0-9]+/)) { + throw new Error("Invalid version number: " + val); + } + return val; }; - XMLElement.prototype.hasAttributeNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.xmlEncoding = function(val) { + if (this.options.noValidation) { + return val; + } + val = '' + val || ''; + if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) { + throw new Error("Invalid encoding: " + val); + } + return this.assertLegalChar(val); }; - XMLElement.prototype.setIdAttribute = function(name, isId) { - if (this.attribs.hasOwnProperty(name)) { - return this.attribs[name].isId; + XMLStringifier.prototype.xmlStandalone = function(val) { + if (this.options.noValidation) { + return val; + } + if (val) { + return "yes"; } else { - return isId; + return "no"; } }; - XMLElement.prototype.setIdAttributeNS = function(namespaceURI, localName, isId) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.dtdPubID = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); }; - XMLElement.prototype.setIdAttributeNode = function(idAttr, isId) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.dtdSysID = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); }; - XMLElement.prototype.getElementsByTagName = function(tagname) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.dtdElementValue = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); }; - XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.dtdAttType = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); }; - XMLElement.prototype.getElementsByClassName = function(classNames) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); + XMLStringifier.prototype.dtdAttDefault = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); }; - XMLElement.prototype.isEqualNode = function(node) { - var i, j, ref1; - if (!XMLElement.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { - return false; - } - if (node.namespaceURI !== this.namespaceURI) { - return false; - } - if (node.prefix !== this.prefix) { - return false; - } - if (node.localName !== this.localName) { - return false; - } - if (node.attribs.length !== this.attribs.length) { - return false; - } - for (i = j = 0, ref1 = this.attribs.length - 1; 0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) { - if (!this.attribs[i].isEqualNode(node.attribs[i])) { - return false; - } + XMLStringifier.prototype.dtdEntityValue = function(val) { + if (this.options.noValidation) { + return val; } - return true; + return this.assertLegalChar('' + val || ''); }; - return XMLElement; - - })(XMLNode); + XMLStringifier.prototype.dtdNData = function(val) { + if (this.options.noValidation) { + return val; + } + return this.assertLegalChar('' + val || ''); + }; -}).call(this); + XMLStringifier.prototype.convertAttKey = '@'; + XMLStringifier.prototype.convertPIKey = '?'; -/***/ }), + XMLStringifier.prototype.convertTextKey = '#text'; -/***/ 4361: -/***/ (function(module) { + XMLStringifier.prototype.convertCDataKey = '#cdata'; -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLNamedNodeMap; + XMLStringifier.prototype.convertCommentKey = '#comment'; - module.exports = XMLNamedNodeMap = (function() { - function XMLNamedNodeMap(nodes) { - this.nodes = nodes; - } + XMLStringifier.prototype.convertRawKey = '#raw'; - Object.defineProperty(XMLNamedNodeMap.prototype, 'length', { - get: function() { - return Object.keys(this.nodes).length || 0; + XMLStringifier.prototype.assertLegalChar = function(str) { + var regex, res; + if (this.options.noValidation) { + return str; } - }); - - XMLNamedNodeMap.prototype.clone = function() { - return this.nodes = null; - }; - - XMLNamedNodeMap.prototype.getNamedItem = function(name) { - return this.nodes[name]; - }; - - XMLNamedNodeMap.prototype.setNamedItem = function(node) { - var oldNode; - oldNode = this.nodes[node.nodeName]; - this.nodes[node.nodeName] = node; - return oldNode || null; - }; - - XMLNamedNodeMap.prototype.removeNamedItem = function(name) { - var oldNode; - oldNode = this.nodes[name]; - delete this.nodes[name]; - return oldNode || null; - }; - - XMLNamedNodeMap.prototype.item = function(index) { - return this.nodes[Object.keys(this.nodes)[index]] || null; + regex = ''; + if (this.options.version === '1.0') { + regex = /[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; + if (res = str.match(regex)) { + throw new Error("Invalid character in string: " + str + " at index " + res.index); + } + } else if (this.options.version === '1.1') { + regex = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; + if (res = str.match(regex)) { + throw new Error("Invalid character in string: " + str + " at index " + res.index); + } + } + return str; }; - XMLNamedNodeMap.prototype.getNamedItemNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented."); + XMLStringifier.prototype.assertLegalName = function(str) { + var regex; + if (this.options.noValidation) { + return str; + } + this.assertLegalChar(str); + regex = /^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/; + if (!str.match(regex)) { + throw new Error("Invalid character in name"); + } + return str; }; - XMLNamedNodeMap.prototype.setNamedItemNS = function(node) { - throw new Error("This DOM method is not implemented."); + XMLStringifier.prototype.textEscape = function(str) { + var ampregex; + if (this.options.noValidation) { + return str; + } + ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g; + return str.replace(ampregex, '&').replace(//g, '>').replace(/\r/g, ' '); }; - XMLNamedNodeMap.prototype.removeNamedItemNS = function(namespaceURI, localName) { - throw new Error("This DOM method is not implemented."); + XMLStringifier.prototype.attEscape = function(str) { + var ampregex; + if (this.options.noValidation) { + return str; + } + ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g; + return str.replace(ampregex, '&').replace(/ 0) { + return new Array(indentLevel).join(options.indent); + } } - child = new XMLText(this, value); - this.children.push(child); - return this; + return ''; }; - XMLNode.prototype.cdata = function(value) { - var child; - child = new XMLCData(this, value); - this.children.push(child); - return this; + XMLWriterBase.prototype.endline = function(node, options, level) { + if (!options.pretty || options.suppressPrettyCount) { + return ''; + } else { + return options.newline; + } }; - XMLNode.prototype.comment = function(value) { - var child; - child = new XMLComment(this, value); - this.children.push(child); - return this; + XMLWriterBase.prototype.attribute = function(att, options, level) { + var r; + this.openAttribute(att, options, level); + r = ' ' + att.name + '="' + att.value + '"'; + this.closeAttribute(att, options, level); + return r; }; - XMLNode.prototype.commentBefore = function(value) { - var child, i, removed; - i = this.parent.children.indexOf(this); - removed = this.parent.children.splice(i); - child = this.parent.comment(value); - Array.prototype.push.apply(this.parent.children, removed); - return this; + XMLWriterBase.prototype.cdata = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.commentAfter = function(value) { - var child, i, removed; - i = this.parent.children.indexOf(this); - removed = this.parent.children.splice(i + 1); - child = this.parent.comment(value); - Array.prototype.push.apply(this.parent.children, removed); - return this; + XMLWriterBase.prototype.comment = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.raw = function(value) { - var child; - child = new XMLRaw(this, value); - this.children.push(child); - return this; + XMLWriterBase.prototype.declaration = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + ''; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.dummy = function() { - var child; - child = new XMLDummy(this); - return child; + XMLWriterBase.prototype.docType = function(node, options, level) { + var child, i, len, r, ref; + level || (level = 0); + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level); + r += ' 0) { + r += ' ['; + r += this.endline(node, options, level); + options.state = WriterState.InsideTag; + ref = node.children; + for (i = 0, len = ref.length; i < len; i++) { + child = ref[i]; + r += this.writeChildNode(child, options, level + 1); + } + options.state = WriterState.CloseTag; + r += ']'; + } + options.state = WriterState.CloseTag; + r += options.spaceBeforeSlash + '>'; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.instruction = function(target, value) { - var insTarget, insValue, instruction, j, len; - if (target != null) { - target = getValue(target); - } - if (value != null) { - value = getValue(value); + XMLWriterBase.prototype.element = function(node, options, level) { + var att, child, childNodeCount, firstChildNode, i, j, len, len1, name, prettySuppressed, r, ref, ref1, ref2; + level || (level = 0); + prettySuppressed = false; + r = ''; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r += this.indent(node, options, level) + '<' + node.name; + ref = node.attribs; + for (name in ref) { + if (!hasProp.call(ref, name)) continue; + att = ref[name]; + r += this.attribute(att, options, level); } - if (Array.isArray(target)) { - for (j = 0, len = target.length; j < len; j++) { - insTarget = target[j]; - this.instruction(insTarget); - } - } else if (isObject(target)) { - for (insTarget in target) { - if (!hasProp.call(target, insTarget)) continue; - insValue = target[insTarget]; - this.instruction(insTarget, insValue); + childNodeCount = node.children.length; + firstChildNode = childNodeCount === 0 ? null : node.children[0]; + if (childNodeCount === 0 || node.children.every(function(e) { + return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === ''; + })) { + if (options.allowEmpty) { + r += '>'; + options.state = WriterState.CloseTag; + r += '' + this.endline(node, options, level); + } else { + options.state = WriterState.CloseTag; + r += options.spaceBeforeSlash + '/>' + this.endline(node, options, level); } + } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) { + r += '>'; + options.state = WriterState.InsideTag; + options.suppressPrettyCount++; + prettySuppressed = true; + r += this.writeChildNode(firstChildNode, options, level + 1); + options.suppressPrettyCount--; + prettySuppressed = false; + options.state = WriterState.CloseTag; + r += '' + this.endline(node, options, level); } else { - if (isFunction(value)) { - value = value.apply(); + if (options.dontPrettyTextNodes) { + ref1 = node.children; + for (i = 0, len = ref1.length; i < len; i++) { + child = ref1[i]; + if ((child.type === NodeType.Text || child.type === NodeType.Raw) && (child.value != null)) { + options.suppressPrettyCount++; + prettySuppressed = true; + break; + } + } } - instruction = new XMLProcessingInstruction(this, target, value); - this.children.push(instruction); + r += '>' + this.endline(node, options, level); + options.state = WriterState.InsideTag; + ref2 = node.children; + for (j = 0, len1 = ref2.length; j < len1; j++) { + child = ref2[j]; + r += this.writeChildNode(child, options, level + 1); + } + options.state = WriterState.CloseTag; + r += this.indent(node, options, level) + ''; + if (prettySuppressed) { + options.suppressPrettyCount--; + } + r += this.endline(node, options, level); + options.state = WriterState.None; } - return this; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.instructionBefore = function(target, value) { - var child, i, removed; - i = this.parent.children.indexOf(this); - removed = this.parent.children.splice(i); - child = this.parent.instruction(target, value); - Array.prototype.push.apply(this.parent.children, removed); - return this; + XMLWriterBase.prototype.writeChildNode = function(node, options, level) { + switch (node.type) { + case NodeType.CData: + return this.cdata(node, options, level); + case NodeType.Comment: + return this.comment(node, options, level); + case NodeType.Element: + return this.element(node, options, level); + case NodeType.Raw: + return this.raw(node, options, level); + case NodeType.Text: + return this.text(node, options, level); + case NodeType.ProcessingInstruction: + return this.processingInstruction(node, options, level); + case NodeType.Dummy: + return ''; + case NodeType.Declaration: + return this.declaration(node, options, level); + case NodeType.DocType: + return this.docType(node, options, level); + case NodeType.AttributeDeclaration: + return this.dtdAttList(node, options, level); + case NodeType.ElementDeclaration: + return this.dtdElement(node, options, level); + case NodeType.EntityDeclaration: + return this.dtdEntity(node, options, level); + case NodeType.NotationDeclaration: + return this.dtdNotation(node, options, level); + default: + throw new Error("Unknown XML node type: " + node.constructor.name); + } }; - XMLNode.prototype.instructionAfter = function(target, value) { - var child, i, removed; - i = this.parent.children.indexOf(this); - removed = this.parent.children.splice(i + 1); - child = this.parent.instruction(target, value); - Array.prototype.push.apply(this.parent.children, removed); - return this; + XMLWriterBase.prototype.processingInstruction = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + ''; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.declaration = function(version, encoding, standalone) { - var doc, xmldec; - doc = this.document(); - xmldec = new XMLDeclaration(doc, version, encoding, standalone); - if (doc.children.length === 0) { - doc.children.unshift(xmldec); - } else if (doc.children[0].type === NodeType.Declaration) { - doc.children[0] = xmldec; - } else { - doc.children.unshift(xmldec); - } - return doc.root() || doc; + XMLWriterBase.prototype.raw = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level); + options.state = WriterState.InsideTag; + r += node.value; + options.state = WriterState.CloseTag; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.dtd = function(pubID, sysID) { - var child, doc, doctype, i, j, k, len, len1, ref2, ref3; - doc = this.document(); - doctype = new XMLDocType(doc, pubID, sysID); - ref2 = doc.children; - for (i = j = 0, len = ref2.length; j < len; i = ++j) { - child = ref2[i]; - if (child.type === NodeType.DocType) { - doc.children[i] = doctype; - return doctype; - } + XMLWriterBase.prototype.text = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level); + options.state = WriterState.InsideTag; + r += node.value; + options.state = WriterState.CloseTag; + r += this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; + }; + + XMLWriterBase.prototype.dtdAttList = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.up = function() { - if (this.isRoot) { - throw new Error("The root node has no parent. Use doc() if you need to get the document object."); - } - return this.parent; + XMLWriterBase.prototype.dtdElement = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.root = function() { - var node; - node = this; - while (node) { - if (node.type === NodeType.Document) { - return node.rootObject; - } else if (node.isRoot) { - return node; - } else { - node = node.parent; + XMLWriterBase.prototype.dtdEntity = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.document = function() { - var node; - node = this; - while (node) { - if (node.type === NodeType.Document) { - return node; - } else { - node = node.parent; - } + XMLWriterBase.prototype.dtdNotation = function(node, options, level) { + var r; + this.openNode(node, options, level); + options.state = WriterState.OpenTag; + r = this.indent(node, options, level) + '' + this.endline(node, options, level); + options.state = WriterState.None; + this.closeNode(node, options, level); + return r; }; - XMLNode.prototype.end = function(options) { - return this.document().end(options); - }; + XMLWriterBase.prototype.openNode = function(node, options, level) {}; - XMLNode.prototype.prev = function() { - var i; - i = this.parent.children.indexOf(this); - if (i < 1) { - throw new Error("Already at the first node. " + this.debugInfo()); - } - return this.parent.children[i - 1]; - }; + XMLWriterBase.prototype.closeNode = function(node, options, level) {}; - XMLNode.prototype.next = function() { - var i; - i = this.parent.children.indexOf(this); - if (i === -1 || i === this.parent.children.length - 1) { - throw new Error("Already at the last node. " + this.debugInfo()); - } - return this.parent.children[i + 1]; - }; + XMLWriterBase.prototype.openAttribute = function(att, options, level) {}; - XMLNode.prototype.importDocument = function(doc) { - var clonedRoot; - clonedRoot = doc.root().clone(); - clonedRoot.parent = this; - clonedRoot.isRoot = false; - this.children.push(clonedRoot); - return this; - }; + XMLWriterBase.prototype.closeAttribute = function(att, options, level) {}; - XMLNode.prototype.debugInfo = function(name) { - var ref2, ref3; - name = name || this.name; - if ((name == null) && !((ref2 = this.parent) != null ? ref2.name : void 0)) { - return ""; - } else if (name == null) { - return "parent: <" + this.parent.name + ">"; - } else if (!((ref3 = this.parent) != null ? ref3.name : void 0)) { - return "node: <" + name + ">"; - } else { - return "node: <" + name + ">, parent: <" + this.parent.name + ">"; - } - }; + return XMLWriterBase; - XMLNode.prototype.ele = function(name, attributes, text) { - return this.element(name, attributes, text); - }; + })(); - XMLNode.prototype.nod = function(name, attributes, text) { - return this.node(name, attributes, text); - }; +}).call(this); - XMLNode.prototype.txt = function(value) { - return this.text(value); - }; - XMLNode.prototype.dat = function(value) { - return this.cdata(value); - }; +/***/ }), - XMLNode.prototype.com = function(value) { - return this.comment(value); - }; +/***/ 2958: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - XMLNode.prototype.ins = function(target, value) { - return this.instruction(target, value); - }; +// Generated by CoffeeScript 1.12.7 +(function() { + var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref; - XMLNode.prototype.doc = function() { - return this.document(); - }; + ref = __nccwpck_require__(8229), assign = ref.assign, isFunction = ref.isFunction; - XMLNode.prototype.dec = function(version, encoding, standalone) { - return this.declaration(version, encoding, standalone); - }; + XMLDOMImplementation = __nccwpck_require__(8310); - XMLNode.prototype.e = function(name, attributes, text) { - return this.element(name, attributes, text); - }; + XMLDocument = __nccwpck_require__(3730); - XMLNode.prototype.n = function(name, attributes, text) { - return this.node(name, attributes, text); - }; + XMLDocumentCB = __nccwpck_require__(7356); - XMLNode.prototype.t = function(value) { - return this.text(value); - }; + XMLStringWriter = __nccwpck_require__(5913); - XMLNode.prototype.d = function(value) { - return this.cdata(value); - }; + XMLStreamWriter = __nccwpck_require__(8601); - XMLNode.prototype.c = function(value) { - return this.comment(value); - }; + NodeType = __nccwpck_require__(9267); - XMLNode.prototype.r = function(value) { - return this.raw(value); - }; + WriterState = __nccwpck_require__(9766); - XMLNode.prototype.i = function(target, value) { - return this.instruction(target, value); - }; + module.exports.create = function(name, xmldec, doctype, options) { + var doc, root; + if (name == null) { + throw new Error("Root element needs a name."); + } + options = assign({}, xmldec, doctype, options); + doc = new XMLDocument(options); + root = doc.element(name); + if (!options.headless) { + doc.declaration(options); + if ((options.pubID != null) || (options.sysID != null)) { + doc.dtd(options); + } + } + return root; + }; - XMLNode.prototype.u = function() { - return this.up(); - }; + module.exports.begin = function(options, onData, onEnd) { + var ref1; + if (isFunction(options)) { + ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1]; + options = {}; + } + if (onData) { + return new XMLDocumentCB(options, onData, onEnd); + } else { + return new XMLDocument(options); + } + }; - XMLNode.prototype.importXMLBuilder = function(doc) { - return this.importDocument(doc); - }; + module.exports.stringWriter = function(options) { + return new XMLStringWriter(options); + }; - XMLNode.prototype.replaceChild = function(newChild, oldChild) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; + module.exports.streamWriter = function(stream, options) { + return new XMLStreamWriter(stream, options); + }; - XMLNode.prototype.removeChild = function(oldChild) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; + module.exports.implementation = new XMLDOMImplementation(); - XMLNode.prototype.appendChild = function(newChild) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; + module.exports.nodeType = NodeType; - XMLNode.prototype.hasChildNodes = function() { - return this.children.length !== 0; - }; + module.exports.writerState = WriterState; - XMLNode.prototype.cloneNode = function(deep) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +}).call(this); - XMLNode.prototype.normalize = function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - XMLNode.prototype.isSupported = function(feature, version) { - return true; - }; +/***/ }), - XMLNode.prototype.hasAttributes = function() { - return this.attribs.length !== 0; - }; +/***/ 2877: +/***/ ((module) => { - XMLNode.prototype.compareDocumentPosition = function(other) { - var ref, res; - ref = this; - if (ref === other) { - return 0; - } else if (this.document() !== other.document()) { - res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific; - if (Math.random() < 0.5) { - res |= DocumentPosition.Preceding; - } else { - res |= DocumentPosition.Following; - } - return res; - } else if (ref.isAncestor(other)) { - return DocumentPosition.Contains | DocumentPosition.Preceding; - } else if (ref.isDescendant(other)) { - return DocumentPosition.Contains | DocumentPosition.Following; - } else if (ref.isPreceding(other)) { - return DocumentPosition.Preceding; - } else { - return DocumentPosition.Following; - } - }; +module.exports = eval("require")("encoding"); - XMLNode.prototype.isSameNode = function(other) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; - XMLNode.prototype.lookupPrefix = function(namespaceURI) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +/***/ }), - XMLNode.prototype.isDefaultNamespace = function(namespaceURI) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +/***/ 9491: +/***/ ((module) => { - XMLNode.prototype.lookupNamespaceURI = function(prefix) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +"use strict"; +module.exports = require("assert"); - XMLNode.prototype.isEqualNode = function(node) { - var i, j, ref2; - if (node.nodeType !== this.nodeType) { - return false; - } - if (node.children.length !== this.children.length) { - return false; - } - for (i = j = 0, ref2 = this.children.length - 1; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) { - if (!this.children[i].isEqualNode(node.children[i])) { - return false; - } - } - return true; - }; +/***/ }), - XMLNode.prototype.getFeature = function(feature, version) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +/***/ 852: +/***/ ((module) => { - XMLNode.prototype.setUserData = function(key, data, handler) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +"use strict"; +module.exports = require("async_hooks"); - XMLNode.prototype.getUserData = function(key) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +/***/ }), - XMLNode.prototype.contains = function(other) { - if (!other) { - return false; - } - return other === this || this.isDescendant(other); - }; +/***/ 4300: +/***/ ((module) => { - XMLNode.prototype.isDescendant = function(node) { - var child, isDescendantChild, j, len, ref2; - ref2 = this.children; - for (j = 0, len = ref2.length; j < len; j++) { - child = ref2[j]; - if (node === child) { - return true; - } - isDescendantChild = child.isDescendant(node); - if (isDescendantChild) { - return true; - } - } - return false; - }; +"use strict"; +module.exports = require("buffer"); - XMLNode.prototype.isAncestor = function(node) { - return node.isDescendant(this); - }; +/***/ }), - XMLNode.prototype.isPreceding = function(node) { - var nodePos, thisPos; - nodePos = this.treePosition(node); - thisPos = this.treePosition(this); - if (nodePos === -1 || thisPos === -1) { - return false; - } else { - return nodePos < thisPos; - } - }; +/***/ 2081: +/***/ ((module) => { - XMLNode.prototype.isFollowing = function(node) { - var nodePos, thisPos; - nodePos = this.treePosition(node); - thisPos = this.treePosition(this); - if (nodePos === -1 || thisPos === -1) { - return false; - } else { - return nodePos > thisPos; - } - }; +"use strict"; +module.exports = require("child_process"); - XMLNode.prototype.treePosition = function(node) { - var found, pos; - pos = 0; - found = false; - this.foreachTreeNode(this.document(), function(childNode) { - pos++; - if (!found && childNode === node) { - return found = true; - } - }); - if (found) { - return pos; - } else { - return -1; - } - }; +/***/ }), - XMLNode.prototype.foreachTreeNode = function(node, func) { - var child, j, len, ref2, res; - node || (node = this.document()); - ref2 = node.children; - for (j = 0, len = ref2.length; j < len; j++) { - child = ref2[j]; - if (res = func(child)) { - return res; - } else { - res = this.foreachTreeNode(child, func); - if (res) { - return res; - } - } - } - }; +/***/ 6206: +/***/ ((module) => { - return XMLNode; +"use strict"; +module.exports = require("console"); - })(); +/***/ }), -}).call(this); +/***/ 6113: +/***/ ((module) => { +"use strict"; +module.exports = require("crypto"); /***/ }), -/***/ 6768: -/***/ (function(module) { +/***/ 7643: +/***/ ((module) => { -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLNodeList; +"use strict"; +module.exports = require("diagnostics_channel"); - module.exports = XMLNodeList = (function() { - function XMLNodeList(nodes) { - this.nodes = nodes; - } +/***/ }), - Object.defineProperty(XMLNodeList.prototype, 'length', { - get: function() { - return this.nodes.length || 0; - } - }); +/***/ 2361: +/***/ ((module) => { - XMLNodeList.prototype.clone = function() { - return this.nodes = null; - }; +"use strict"; +module.exports = require("events"); - XMLNodeList.prototype.item = function(index) { - return this.nodes[index] || null; - }; +/***/ }), - return XMLNodeList; +/***/ 7147: +/***/ ((module) => { - })(); +"use strict"; +module.exports = require("fs"); -}).call(this); +/***/ }), + +/***/ 3292: +/***/ ((module) => { +"use strict"; +module.exports = require("fs/promises"); /***/ }), -/***/ 6939: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { +/***/ 3685: +/***/ ((module) => { -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLCharacterData, XMLProcessingInstruction, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; +"use strict"; +module.exports = require("http"); - NodeType = __nccwpck_require__(9267); +/***/ }), - XMLCharacterData = __nccwpck_require__(7709); +/***/ 5158: +/***/ ((module) => { - module.exports = XMLProcessingInstruction = (function(superClass) { - extend(XMLProcessingInstruction, superClass); +"use strict"; +module.exports = require("http2"); - function XMLProcessingInstruction(parent, target, value) { - XMLProcessingInstruction.__super__.constructor.call(this, parent); - if (target == null) { - throw new Error("Missing instruction target. " + this.debugInfo()); - } - this.type = NodeType.ProcessingInstruction; - this.target = this.stringify.insTarget(target); - this.name = this.target; - if (value) { - this.value = this.stringify.insValue(value); - } - } +/***/ }), - XMLProcessingInstruction.prototype.clone = function() { - return Object.create(this); - }; +/***/ 5687: +/***/ ((module) => { - XMLProcessingInstruction.prototype.toString = function(options) { - return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options)); - }; +"use strict"; +module.exports = require("https"); - XMLProcessingInstruction.prototype.isEqualNode = function(node) { - if (!XMLProcessingInstruction.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) { - return false; - } - if (node.target !== this.target) { - return false; - } - return true; - }; +/***/ }), - return XMLProcessingInstruction; +/***/ 1808: +/***/ ((module) => { - })(XMLCharacterData); +"use strict"; +module.exports = require("net"); -}).call(this); +/***/ }), + +/***/ 5673: +/***/ ((module) => { +"use strict"; +module.exports = require("node:events"); /***/ }), -/***/ 6329: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { +/***/ 612: +/***/ ((module) => { -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLNode, XMLRaw, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; +"use strict"; +module.exports = require("node:os"); - NodeType = __nccwpck_require__(9267); +/***/ }), - XMLNode = __nccwpck_require__(7608); +/***/ 7742: +/***/ ((module) => { - module.exports = XMLRaw = (function(superClass) { - extend(XMLRaw, superClass); +"use strict"; +module.exports = require("node:process"); - function XMLRaw(parent, text) { - XMLRaw.__super__.constructor.call(this, parent); - if (text == null) { - throw new Error("Missing raw text. " + this.debugInfo()); - } - this.type = NodeType.Raw; - this.value = this.stringify.raw(text); - } +/***/ }), - XMLRaw.prototype.clone = function() { - return Object.create(this); - }; +/***/ 4492: +/***/ ((module) => { - XMLRaw.prototype.toString = function(options) { - return this.options.writer.raw(this, this.options.writer.filterOptions(options)); - }; +"use strict"; +module.exports = require("node:stream"); - return XMLRaw; +/***/ }), + +/***/ 7261: +/***/ ((module) => { + +"use strict"; +module.exports = require("node:util"); + +/***/ }), + +/***/ 2037: +/***/ ((module) => { + +"use strict"; +module.exports = require("os"); - })(XMLNode); +/***/ }), -}).call(this); +/***/ 1017: +/***/ ((module) => { +"use strict"; +module.exports = require("path"); /***/ }), -/***/ 8601: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { +/***/ 4074: +/***/ ((module) => { -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, WriterState, XMLStreamWriter, XMLWriterBase, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; +"use strict"; +module.exports = require("perf_hooks"); - NodeType = __nccwpck_require__(9267); +/***/ }), - XMLWriterBase = __nccwpck_require__(6752); +/***/ 5477: +/***/ ((module) => { - WriterState = __nccwpck_require__(9766); +"use strict"; +module.exports = require("punycode"); - module.exports = XMLStreamWriter = (function(superClass) { - extend(XMLStreamWriter, superClass); +/***/ }), - function XMLStreamWriter(stream, options) { - this.stream = stream; - XMLStreamWriter.__super__.constructor.call(this, options); - } +/***/ 3477: +/***/ ((module) => { - XMLStreamWriter.prototype.endline = function(node, options, level) { - if (node.isLastRootNode && options.state === WriterState.CloseTag) { - return ''; - } else { - return XMLStreamWriter.__super__.endline.call(this, node, options, level); - } - }; +"use strict"; +module.exports = require("querystring"); - XMLStreamWriter.prototype.document = function(doc, options) { - var child, i, j, k, len, len1, ref, ref1, results; - ref = doc.children; - for (i = j = 0, len = ref.length; j < len; i = ++j) { - child = ref[i]; - child.isLastRootNode = i === doc.children.length - 1; - } - options = this.filterOptions(options); - ref1 = doc.children; - results = []; - for (k = 0, len1 = ref1.length; k < len1; k++) { - child = ref1[k]; - results.push(this.writeChildNode(child, options, 0)); - } - return results; - }; +/***/ }), - XMLStreamWriter.prototype.attribute = function(att, options, level) { - return this.stream.write(XMLStreamWriter.__super__.attribute.call(this, att, options, level)); - }; +/***/ 2781: +/***/ ((module) => { - XMLStreamWriter.prototype.cdata = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.cdata.call(this, node, options, level)); - }; +"use strict"; +module.exports = require("stream"); - XMLStreamWriter.prototype.comment = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.comment.call(this, node, options, level)); - }; +/***/ }), - XMLStreamWriter.prototype.declaration = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.declaration.call(this, node, options, level)); - }; +/***/ 5356: +/***/ ((module) => { - XMLStreamWriter.prototype.docType = function(node, options, level) { - var child, j, len, ref; - level || (level = 0); - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - this.stream.write(this.indent(node, options, level)); - this.stream.write(' 0) { - this.stream.write(' ['); - this.stream.write(this.endline(node, options, level)); - options.state = WriterState.InsideTag; - ref = node.children; - for (j = 0, len = ref.length; j < len; j++) { - child = ref[j]; - this.writeChildNode(child, options, level + 1); - } - options.state = WriterState.CloseTag; - this.stream.write(']'); - } - options.state = WriterState.CloseTag; - this.stream.write(options.spaceBeforeSlash + '>'); - this.stream.write(this.endline(node, options, level)); - options.state = WriterState.None; - return this.closeNode(node, options, level); - }; +"use strict"; +module.exports = require("stream/web"); - XMLStreamWriter.prototype.element = function(node, options, level) { - var att, child, childNodeCount, firstChildNode, j, len, name, prettySuppressed, ref, ref1; - level || (level = 0); - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - this.stream.write(this.indent(node, options, level) + '<' + node.name); - ref = node.attribs; - for (name in ref) { - if (!hasProp.call(ref, name)) continue; - att = ref[name]; - this.attribute(att, options, level); - } - childNodeCount = node.children.length; - firstChildNode = childNodeCount === 0 ? null : node.children[0]; - if (childNodeCount === 0 || node.children.every(function(e) { - return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === ''; - })) { - if (options.allowEmpty) { - this.stream.write('>'); - options.state = WriterState.CloseTag; - this.stream.write(''); - } else { - options.state = WriterState.CloseTag; - this.stream.write(options.spaceBeforeSlash + '/>'); - } - } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) { - this.stream.write('>'); - options.state = WriterState.InsideTag; - options.suppressPrettyCount++; - prettySuppressed = true; - this.writeChildNode(firstChildNode, options, level + 1); - options.suppressPrettyCount--; - prettySuppressed = false; - options.state = WriterState.CloseTag; - this.stream.write(''); - } else { - this.stream.write('>' + this.endline(node, options, level)); - options.state = WriterState.InsideTag; - ref1 = node.children; - for (j = 0, len = ref1.length; j < len; j++) { - child = ref1[j]; - this.writeChildNode(child, options, level + 1); - } - options.state = WriterState.CloseTag; - this.stream.write(this.indent(node, options, level) + ''); - } - this.stream.write(this.endline(node, options, level)); - options.state = WriterState.None; - return this.closeNode(node, options, level); - }; +/***/ }), - XMLStreamWriter.prototype.processingInstruction = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.processingInstruction.call(this, node, options, level)); - }; +/***/ 1576: +/***/ ((module) => { - XMLStreamWriter.prototype.raw = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.raw.call(this, node, options, level)); - }; +"use strict"; +module.exports = require("string_decoder"); - XMLStreamWriter.prototype.text = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.text.call(this, node, options, level)); - }; +/***/ }), - XMLStreamWriter.prototype.dtdAttList = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.dtdAttList.call(this, node, options, level)); - }; +/***/ 9512: +/***/ ((module) => { - XMLStreamWriter.prototype.dtdElement = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.dtdElement.call(this, node, options, level)); - }; +"use strict"; +module.exports = require("timers"); - XMLStreamWriter.prototype.dtdEntity = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.dtdEntity.call(this, node, options, level)); - }; +/***/ }), - XMLStreamWriter.prototype.dtdNotation = function(node, options, level) { - return this.stream.write(XMLStreamWriter.__super__.dtdNotation.call(this, node, options, level)); - }; +/***/ 4404: +/***/ ((module) => { - return XMLStreamWriter; +"use strict"; +module.exports = require("tls"); - })(XMLWriterBase); +/***/ }), -}).call(this); +/***/ 7310: +/***/ ((module) => { +"use strict"; +module.exports = require("url"); /***/ }), -/***/ 5913: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { +/***/ 3837: +/***/ ((module) => { -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLStringWriter, XMLWriterBase, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; +"use strict"; +module.exports = require("util"); - XMLWriterBase = __nccwpck_require__(6752); +/***/ }), - module.exports = XMLStringWriter = (function(superClass) { - extend(XMLStringWriter, superClass); +/***/ 9830: +/***/ ((module) => { - function XMLStringWriter(options) { - XMLStringWriter.__super__.constructor.call(this, options); - } +"use strict"; +module.exports = require("util/types"); - XMLStringWriter.prototype.document = function(doc, options) { - var child, i, len, r, ref; - options = this.filterOptions(options); - r = ''; - ref = doc.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - r += this.writeChildNode(child, options, 0); - } - if (options.pretty && r.slice(-options.newline.length) === options.newline) { - r = r.slice(0, -options.newline.length); - } - return r; - }; +/***/ }), - return XMLStringWriter; +/***/ 1267: +/***/ ((module) => { - })(XMLWriterBase); +"use strict"; +module.exports = require("worker_threads"); -}).call(this); +/***/ }), +/***/ 9796: +/***/ ((module) => { + +"use strict"; +module.exports = require("zlib"); /***/ }), -/***/ 8594: -/***/ (function(module) { +/***/ 1875: +/***/ ((__unused_webpack_module, exports) => { -// Generated by CoffeeScript 1.12.7 -(function() { - var XMLStringifier, - bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - hasProp = {}.hasOwnProperty; +"use strict"; - module.exports = XMLStringifier = (function() { - function XMLStringifier(options) { - this.assertLegalName = bind(this.assertLegalName, this); - this.assertLegalChar = bind(this.assertLegalChar, this); - var key, ref, value; - options || (options = {}); - this.options = options; - if (!this.options.version) { - this.options.version = '1.0'; - } - ref = options.stringify || {}; - for (key in ref) { - if (!hasProp.call(ref, key)) continue; - value = ref[key]; - this[key] = value; - } +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AzureKeyCredential = void 0; +/** + * A static-key-based credential that supports updating + * the underlying key value. + */ +class AzureKeyCredential { + _key; + /** + * The value of the key to be used in authentication + */ + get key() { + return this._key; } + /** + * Create an instance of an AzureKeyCredential for use + * with a service client. + * + * @param key - The initial value of the key to use in authentication + */ + constructor(key) { + if (!key) { + throw new Error("key must be a non-empty string"); + } + this._key = key; + } + /** + * Change the value of the key. + * + * Updates will take effect upon the next request after + * updating the key value. + * + * @param newKey - The new key value to be used + */ + update(newKey) { + this._key = newKey; + } +} +exports.AzureKeyCredential = AzureKeyCredential; +//# sourceMappingURL=azureKeyCredential.js.map - XMLStringifier.prototype.name = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalName('' + val || ''); - }; - - XMLStringifier.prototype.text = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar(this.textEscape('' + val || '')); - }; - - XMLStringifier.prototype.cdata = function(val) { - if (this.options.noValidation) { - return val; - } - val = '' + val || ''; - val = val.replace(']]>', ']]]]>'); - return this.assertLegalChar(val); - }; +/***/ }), - XMLStringifier.prototype.comment = function(val) { - if (this.options.noValidation) { - return val; - } - val = '' + val || ''; - if (val.match(/--/)) { - throw new Error("Comment text cannot contain double-hypen: " + val); - } - return this.assertLegalChar(val); - }; +/***/ 1377: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLStringifier.prototype.raw = function(val) { - if (this.options.noValidation) { - return val; - } - return '' + val || ''; - }; +"use strict"; - XMLStringifier.prototype.attValue = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar(this.attEscape(val = '' + val || '')); - }; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isNamedKeyCredential = exports.AzureNamedKeyCredential = void 0; +const core_util_1 = __nccwpck_require__(637); +/** + * A static name/key-based credential that supports updating + * the underlying name and key values. + */ +class AzureNamedKeyCredential { + _key; + _name; + /** + * The value of the key to be used in authentication. + */ + get key() { + return this._key; + } + /** + * The value of the name to be used in authentication. + */ + get name() { + return this._name; + } + /** + * Create an instance of an AzureNamedKeyCredential for use + * with a service client. + * + * @param name - The initial value of the name to use in authentication. + * @param key - The initial value of the key to use in authentication. + */ + constructor(name, key) { + if (!name || !key) { + throw new TypeError("name and key must be non-empty strings"); + } + this._name = name; + this._key = key; + } + /** + * Change the value of the key. + * + * Updates will take effect upon the next request after + * updating the key value. + * + * @param newName - The new name value to be used. + * @param newKey - The new key value to be used. + */ + update(newName, newKey) { + if (!newName || !newKey) { + throw new TypeError("newName and newKey must be non-empty strings"); + } + this._name = newName; + this._key = newKey; + } +} +exports.AzureNamedKeyCredential = AzureNamedKeyCredential; +/** + * Tests an object to determine whether it implements NamedKeyCredential. + * + * @param credential - The assumed NamedKeyCredential to be tested. + */ +function isNamedKeyCredential(credential) { + return ((0, core_util_1.isObjectWithProperties)(credential, ["name", "key"]) && + typeof credential.key === "string" && + typeof credential.name === "string"); +} +exports.isNamedKeyCredential = isNamedKeyCredential; +//# sourceMappingURL=azureNamedKeyCredential.js.map - XMLStringifier.prototype.insTarget = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +/***/ }), - XMLStringifier.prototype.insValue = function(val) { - if (this.options.noValidation) { - return val; - } - val = '' + val || ''; - if (val.match(/\?>/)) { - throw new Error("Invalid processing instruction value: " + val); - } - return this.assertLegalChar(val); - }; +/***/ 7182: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLStringifier.prototype.xmlVersion = function(val) { - if (this.options.noValidation) { - return val; - } - val = '' + val || ''; - if (!val.match(/1\.[0-9]+/)) { - throw new Error("Invalid version number: " + val); - } - return val; - }; +"use strict"; - XMLStringifier.prototype.xmlEncoding = function(val) { - if (this.options.noValidation) { - return val; - } - val = '' + val || ''; - if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) { - throw new Error("Invalid encoding: " + val); - } - return this.assertLegalChar(val); - }; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isSASCredential = exports.AzureSASCredential = void 0; +const core_util_1 = __nccwpck_require__(637); +/** + * A static-signature-based credential that supports updating + * the underlying signature value. + */ +class AzureSASCredential { + _signature; + /** + * The value of the shared access signature to be used in authentication + */ + get signature() { + return this._signature; + } + /** + * Create an instance of an AzureSASCredential for use + * with a service client. + * + * @param signature - The initial value of the shared access signature to use in authentication + */ + constructor(signature) { + if (!signature) { + throw new Error("shared access signature must be a non-empty string"); + } + this._signature = signature; + } + /** + * Change the value of the signature. + * + * Updates will take effect upon the next request after + * updating the signature value. + * + * @param newSignature - The new shared access signature value to be used + */ + update(newSignature) { + if (!newSignature) { + throw new Error("shared access signature must be a non-empty string"); + } + this._signature = newSignature; + } +} +exports.AzureSASCredential = AzureSASCredential; +/** + * Tests an object to determine whether it implements SASCredential. + * + * @param credential - The assumed SASCredential to be tested. + */ +function isSASCredential(credential) { + return ((0, core_util_1.isObjectWithProperties)(credential, ["signature"]) && typeof credential.signature === "string"); +} +exports.isSASCredential = isSASCredential; +//# sourceMappingURL=azureSASCredential.js.map - XMLStringifier.prototype.xmlStandalone = function(val) { - if (this.options.noValidation) { - return val; - } - if (val) { - return "yes"; - } else { - return "no"; - } - }; +/***/ }), - XMLStringifier.prototype.dtdPubID = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +/***/ 8834: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLStringifier.prototype.dtdSysID = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +"use strict"; - XMLStringifier.prototype.dtdElementValue = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isTokenCredential = exports.isSASCredential = exports.AzureSASCredential = exports.isNamedKeyCredential = exports.AzureNamedKeyCredential = exports.isKeyCredential = exports.AzureKeyCredential = void 0; +var azureKeyCredential_js_1 = __nccwpck_require__(1875); +Object.defineProperty(exports, "AzureKeyCredential", ({ enumerable: true, get: function () { return azureKeyCredential_js_1.AzureKeyCredential; } })); +var keyCredential_js_1 = __nccwpck_require__(9122); +Object.defineProperty(exports, "isKeyCredential", ({ enumerable: true, get: function () { return keyCredential_js_1.isKeyCredential; } })); +var azureNamedKeyCredential_js_1 = __nccwpck_require__(1377); +Object.defineProperty(exports, "AzureNamedKeyCredential", ({ enumerable: true, get: function () { return azureNamedKeyCredential_js_1.AzureNamedKeyCredential; } })); +Object.defineProperty(exports, "isNamedKeyCredential", ({ enumerable: true, get: function () { return azureNamedKeyCredential_js_1.isNamedKeyCredential; } })); +var azureSASCredential_js_1 = __nccwpck_require__(7182); +Object.defineProperty(exports, "AzureSASCredential", ({ enumerable: true, get: function () { return azureSASCredential_js_1.AzureSASCredential; } })); +Object.defineProperty(exports, "isSASCredential", ({ enumerable: true, get: function () { return azureSASCredential_js_1.isSASCredential; } })); +var tokenCredential_js_1 = __nccwpck_require__(9162); +Object.defineProperty(exports, "isTokenCredential", ({ enumerable: true, get: function () { return tokenCredential_js_1.isTokenCredential; } })); +//# sourceMappingURL=index.js.map - XMLStringifier.prototype.dtdAttType = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +/***/ }), - XMLStringifier.prototype.dtdAttDefault = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +/***/ 9122: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLStringifier.prototype.dtdEntityValue = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +"use strict"; - XMLStringifier.prototype.dtdNData = function(val) { - if (this.options.noValidation) { - return val; - } - return this.assertLegalChar('' + val || ''); - }; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isKeyCredential = void 0; +const core_util_1 = __nccwpck_require__(637); +/** + * Tests an object to determine whether it implements KeyCredential. + * + * @param credential - The assumed KeyCredential to be tested. + */ +function isKeyCredential(credential) { + return (0, core_util_1.isObjectWithProperties)(credential, ["key"]) && typeof credential.key === "string"; +} +exports.isKeyCredential = isKeyCredential; +//# sourceMappingURL=keyCredential.js.map - XMLStringifier.prototype.convertAttKey = '@'; +/***/ }), - XMLStringifier.prototype.convertPIKey = '?'; +/***/ 9162: +/***/ ((__unused_webpack_module, exports) => { - XMLStringifier.prototype.convertTextKey = '#text'; +"use strict"; - XMLStringifier.prototype.convertCDataKey = '#cdata'; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isTokenCredential = void 0; +/** + * Tests an object to determine whether it implements TokenCredential. + * + * @param credential - The assumed TokenCredential to be tested. + */ +function isTokenCredential(credential) { + // Check for an object with a 'getToken' function and possibly with + // a 'signRequest' function. We do this check to make sure that + // a ServiceClientCredentials implementor (like TokenClientCredentials + // in ms-rest-nodeauth) doesn't get mistaken for a TokenCredential if + // it doesn't actually implement TokenCredential also. + const castCredential = credential; + return (castCredential && + typeof castCredential.getToken === "function" && + (castCredential.signRequest === undefined || castCredential.getToken.length > 0)); +} +exports.isTokenCredential = isTokenCredential; +//# sourceMappingURL=tokenCredential.js.map - XMLStringifier.prototype.convertCommentKey = '#comment'; +/***/ }), - XMLStringifier.prototype.convertRawKey = '#raw'; +/***/ 7759: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLStringifier.prototype.assertLegalChar = function(str) { - var regex, res; - if (this.options.noValidation) { - return str; - } - regex = ''; - if (this.options.version === '1.0') { - regex = /[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; - if (res = str.match(regex)) { - throw new Error("Invalid character in string: " + str + " at index " + res.index); +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.pollHttpOperation = exports.isOperationError = exports.getResourceLocation = exports.getOperationStatus = exports.getOperationLocation = exports.initHttpOperation = exports.getStatusFromInitialResponse = exports.getErrorFromResponse = exports.parseRetryAfter = exports.inferLroMode = void 0; +const operation_js_1 = __nccwpck_require__(281); +const logger_js_1 = __nccwpck_require__(8121); +function getOperationLocationPollingUrl(inputs) { + const { azureAsyncOperation, operationLocation } = inputs; + return operationLocation ?? azureAsyncOperation; +} +function getLocationHeader(rawResponse) { + return rawResponse.headers["location"]; +} +function getOperationLocationHeader(rawResponse) { + return rawResponse.headers["operation-location"]; +} +function getAzureAsyncOperationHeader(rawResponse) { + return rawResponse.headers["azure-asyncoperation"]; +} +function findResourceLocation(inputs) { + const { location, requestMethod, requestPath, resourceLocationConfig } = inputs; + switch (requestMethod) { + case "PUT": { + return requestPath; } - } else if (this.options.version === '1.1') { - regex = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; - if (res = str.match(regex)) { - throw new Error("Invalid character in string: " + str + " at index " + res.index); + case "DELETE": { + return undefined; } - } - return str; - }; + case "PATCH": { + return getDefault() ?? requestPath; + } + default: { + return getDefault(); + } + } + function getDefault() { + switch (resourceLocationConfig) { + case "azure-async-operation": { + return undefined; + } + case "original-uri": { + return requestPath; + } + case "location": + default: { + return location; + } + } + } +} +function inferLroMode(inputs) { + const { rawResponse, requestMethod, requestPath, resourceLocationConfig } = inputs; + const operationLocation = getOperationLocationHeader(rawResponse); + const azureAsyncOperation = getAzureAsyncOperationHeader(rawResponse); + const pollingUrl = getOperationLocationPollingUrl({ operationLocation, azureAsyncOperation }); + const location = getLocationHeader(rawResponse); + const normalizedRequestMethod = requestMethod?.toLocaleUpperCase(); + if (pollingUrl !== undefined) { + return { + mode: "OperationLocation", + operationLocation: pollingUrl, + resourceLocation: findResourceLocation({ + requestMethod: normalizedRequestMethod, + location, + requestPath, + resourceLocationConfig, + }), + }; + } + else if (location !== undefined) { + return { + mode: "ResourceLocation", + operationLocation: location, + }; + } + else if (normalizedRequestMethod === "PUT" && requestPath) { + return { + mode: "Body", + operationLocation: requestPath, + }; + } + else { + return undefined; + } +} +exports.inferLroMode = inferLroMode; +function transformStatus(inputs) { + const { status, statusCode } = inputs; + if (typeof status !== "string" && status !== undefined) { + throw new Error(`Polling was unsuccessful. Expected status to have a string value or no value but it has instead: ${status}. This doesn't necessarily indicate the operation has failed. Check your Azure subscription or resource status for more information.`); + } + switch (status?.toLocaleLowerCase()) { + case undefined: + return toOperationStatus(statusCode); + case "succeeded": + return "succeeded"; + case "failed": + return "failed"; + case "running": + case "accepted": + case "started": + case "canceling": + case "cancelling": + return "running"; + case "canceled": + case "cancelled": + return "canceled"; + default: { + logger_js_1.logger.verbose(`LRO: unrecognized operation status: ${status}`); + return status; + } + } +} +function getStatus(rawResponse) { + const { status } = rawResponse.body ?? {}; + return transformStatus({ status, statusCode: rawResponse.statusCode }); +} +function getProvisioningState(rawResponse) { + const { properties, provisioningState } = rawResponse.body ?? {}; + const status = properties?.provisioningState ?? provisioningState; + return transformStatus({ status, statusCode: rawResponse.statusCode }); +} +function toOperationStatus(statusCode) { + if (statusCode === 202) { + return "running"; + } + else if (statusCode < 300) { + return "succeeded"; + } + else { + return "failed"; + } +} +function parseRetryAfter({ rawResponse }) { + const retryAfter = rawResponse.headers["retry-after"]; + if (retryAfter !== undefined) { + // Retry-After header value is either in HTTP date format, or in seconds + const retryAfterInSeconds = parseInt(retryAfter); + return isNaN(retryAfterInSeconds) + ? calculatePollingIntervalFromDate(new Date(retryAfter)) + : retryAfterInSeconds * 1000; + } + return undefined; +} +exports.parseRetryAfter = parseRetryAfter; +function getErrorFromResponse(response) { + const error = accessBodyProperty(response, "error"); + if (!error) { + logger_js_1.logger.warning(`The long-running operation failed but there is no error property in the response's body`); + return; + } + if (!error.code || !error.message) { + logger_js_1.logger.warning(`The long-running operation failed but the error property in the response's body doesn't contain code or message`); + return; + } + return error; +} +exports.getErrorFromResponse = getErrorFromResponse; +function calculatePollingIntervalFromDate(retryAfterDate) { + const timeNow = Math.floor(new Date().getTime()); + const retryAfterTime = retryAfterDate.getTime(); + if (timeNow < retryAfterTime) { + return retryAfterTime - timeNow; + } + return undefined; +} +function getStatusFromInitialResponse(inputs) { + const { response, state, operationLocation } = inputs; + function helper() { + const mode = state.config.metadata?.["mode"]; + switch (mode) { + case undefined: + return toOperationStatus(response.rawResponse.statusCode); + case "Body": + return getOperationStatus(response, state); + default: + return "running"; + } + } + const status = helper(); + return status === "running" && operationLocation === undefined ? "succeeded" : status; +} +exports.getStatusFromInitialResponse = getStatusFromInitialResponse; +/** + * Initiates the long-running operation. + */ +async function initHttpOperation(inputs) { + const { stateProxy, resourceLocationConfig, processResult, lro, setErrorAsResult } = inputs; + return (0, operation_js_1.initOperation)({ + init: async () => { + const response = await lro.sendInitialRequest(); + const config = inferLroMode({ + rawResponse: response.rawResponse, + requestPath: lro.requestPath, + requestMethod: lro.requestMethod, + resourceLocationConfig, + }); + return { + response, + operationLocation: config?.operationLocation, + resourceLocation: config?.resourceLocation, + ...(config?.mode ? { metadata: { mode: config.mode } } : {}), + }; + }, + stateProxy, + processResult: processResult + ? ({ flatResponse }, state) => processResult(flatResponse, state) + : ({ flatResponse }) => flatResponse, + getOperationStatus: getStatusFromInitialResponse, + setErrorAsResult, + }); +} +exports.initHttpOperation = initHttpOperation; +function getOperationLocation({ rawResponse }, state) { + const mode = state.config.metadata?.["mode"]; + switch (mode) { + case "OperationLocation": { + return getOperationLocationPollingUrl({ + operationLocation: getOperationLocationHeader(rawResponse), + azureAsyncOperation: getAzureAsyncOperationHeader(rawResponse), + }); + } + case "ResourceLocation": { + return getLocationHeader(rawResponse); + } + case "Body": + default: { + return undefined; + } + } +} +exports.getOperationLocation = getOperationLocation; +function getOperationStatus({ rawResponse }, state) { + const mode = state.config.metadata?.["mode"]; + switch (mode) { + case "OperationLocation": { + return getStatus(rawResponse); + } + case "ResourceLocation": { + return toOperationStatus(rawResponse.statusCode); + } + case "Body": { + return getProvisioningState(rawResponse); + } + default: + throw new Error(`Internal error: Unexpected operation mode: ${mode}`); + } +} +exports.getOperationStatus = getOperationStatus; +function accessBodyProperty({ flatResponse, rawResponse }, prop) { + return flatResponse?.[prop] ?? rawResponse.body?.[prop]; +} +function getResourceLocation(res, state) { + const loc = accessBodyProperty(res, "resourceLocation"); + if (loc && typeof loc === "string") { + state.config.resourceLocation = loc; + } + return state.config.resourceLocation; +} +exports.getResourceLocation = getResourceLocation; +function isOperationError(e) { + return e.name === "RestError"; +} +exports.isOperationError = isOperationError; +/** Polls the long-running operation. */ +async function pollHttpOperation(inputs) { + const { lro, stateProxy, options, processResult, updateState, setDelay, state, setErrorAsResult, } = inputs; + return (0, operation_js_1.pollOperation)({ + state, + stateProxy, + setDelay, + processResult: processResult + ? ({ flatResponse }, inputState) => processResult(flatResponse, inputState) + : ({ flatResponse }) => flatResponse, + getError: getErrorFromResponse, + updateState, + getPollingInterval: parseRetryAfter, + getOperationLocation, + getOperationStatus, + isOperationError, + getResourceLocation, + options, + /** + * The expansion here is intentional because `lro` could be an object that + * references an inner this, so we need to preserve a reference to it. + */ + poll: async (location, inputOptions) => lro.sendPollRequest(location, inputOptions), + setErrorAsResult, + }); +} +exports.pollHttpOperation = pollHttpOperation; +//# sourceMappingURL=operation.js.map - XMLStringifier.prototype.assertLegalName = function(str) { - var regex; - if (this.options.noValidation) { - return str; - } - this.assertLegalChar(str); - regex = /^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/; - if (!str.match(regex)) { - throw new Error("Invalid character in name"); - } - return str; - }; +/***/ }), - XMLStringifier.prototype.textEscape = function(str) { - var ampregex; - if (this.options.noValidation) { - return str; - } - ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g; - return str.replace(ampregex, '&').replace(//g, '>').replace(/\r/g, ' '); - }; +/***/ 8412: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLStringifier.prototype.attEscape = function(str) { - var ampregex; - if (this.options.noValidation) { - return str; - } - ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g; - return str.replace(ampregex, '&').replace(/ { + const response = await lro.sendInitialRequest(); + const config = (0, operation_js_1.inferLroMode)({ + rawResponse: response.rawResponse, + requestPath: lro.requestPath, + requestMethod: lro.requestMethod, + resourceLocationConfig, + }); + return { + response, + operationLocation: config?.operationLocation, + resourceLocation: config?.resourceLocation, + ...(config?.mode ? { metadata: { mode: config.mode } } : {}), + }; + }, + poll: lro.sendPollRequest, + }, { + intervalInMs, + withOperationLocation, + restoreFrom, + updateState, + processResult: processResult + ? ({ flatResponse }, state) => processResult(flatResponse, state) + : ({ flatResponse }) => flatResponse, + }); +} +exports.createHttpPoller = createHttpPoller; +//# sourceMappingURL=poller.js.map - })(); +/***/ }), -}).call(this); +/***/ 334: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createHttpPoller = void 0; +const tslib_1 = __nccwpck_require__(4351); +var poller_js_1 = __nccwpck_require__(8412); +Object.defineProperty(exports, "createHttpPoller", ({ enumerable: true, get: function () { return poller_js_1.createHttpPoller; } })); +/** + * This can be uncommented to expose the protocol-agnostic poller + */ +// export { +// BuildCreatePollerOptions, +// Operation, +// CreatePollerOptions, +// OperationConfig, +// RestorableOperationState, +// } from "./poller/models"; +// export { buildCreatePoller } from "./poller/poller"; +/** legacy */ +tslib_1.__exportStar(__nccwpck_require__(2260), exports); +tslib_1.__exportStar(__nccwpck_require__(7270), exports); +tslib_1.__exportStar(__nccwpck_require__(3586), exports); +//# sourceMappingURL=index.js.map /***/ }), -/***/ 1318: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { +/***/ 2260: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, XMLCharacterData, XMLText, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; +"use strict"; - NodeType = __nccwpck_require__(9267); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.LroEngine = void 0; +var lroEngine_js_1 = __nccwpck_require__(5780); +Object.defineProperty(exports, "LroEngine", ({ enumerable: true, get: function () { return lroEngine_js_1.LroEngine; } })); +//# sourceMappingURL=index.js.map - XMLCharacterData = __nccwpck_require__(7709); +/***/ }), - module.exports = XMLText = (function(superClass) { - extend(XMLText, superClass); +/***/ 5780: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - function XMLText(parent, text) { - XMLText.__super__.constructor.call(this, parent); - if (text == null) { - throw new Error("Missing element text. " + this.debugInfo()); - } - this.name = "#text"; - this.type = NodeType.Text; - this.value = this.stringify.text(text); +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.LroEngine = void 0; +const operation_js_1 = __nccwpck_require__(7954); +const constants_js_1 = __nccwpck_require__(3846); +const poller_js_1 = __nccwpck_require__(7270); +const operation_js_2 = __nccwpck_require__(281); +/** + * The LRO Engine, a class that performs polling. + */ +class LroEngine extends poller_js_1.Poller { + config; + constructor(lro, options) { + const { intervalInMs = constants_js_1.POLL_INTERVAL_IN_MS, resumeFrom, resolveOnUnsuccessful = false, isDone, lroResourceLocationConfig, processResult, updateState, } = options || {}; + const state = resumeFrom + ? (0, operation_js_2.deserializeState)(resumeFrom) + : {}; + const operation = new operation_js_1.GenericPollOperation(state, lro, !resolveOnUnsuccessful, lroResourceLocationConfig, processResult, updateState, isDone); + super(operation); + this.resolveOnUnsuccessful = resolveOnUnsuccessful; + this.config = { intervalInMs: intervalInMs }; + operation.setPollerConfig(this.config); + } + /** + * The method used by the poller to wait before attempting to update its operation. + */ + delay() { + return new Promise((resolve) => setTimeout(() => resolve(), this.config.intervalInMs)); } +} +exports.LroEngine = LroEngine; +//# sourceMappingURL=lroEngine.js.map - Object.defineProperty(XMLText.prototype, 'isElementContentWhitespace', { - get: function() { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - } - }); +/***/ }), - Object.defineProperty(XMLText.prototype, 'wholeText', { - get: function() { - var next, prev, str; - str = ''; - prev = this.previousSibling; - while (prev) { - str = prev.data + str; - prev = prev.previousSibling; +/***/ 7954: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.GenericPollOperation = void 0; +const operation_js_1 = __nccwpck_require__(7759); +const logger_js_1 = __nccwpck_require__(8121); +const createStateProxy = () => ({ + initState: (config) => ({ config, isStarted: true }), + setCanceled: (state) => (state.isCancelled = true), + setError: (state, error) => (state.error = error), + setResult: (state, result) => (state.result = result), + setRunning: (state) => (state.isStarted = true), + setSucceeded: (state) => (state.isCompleted = true), + setFailed: () => { + /** empty body */ + }, + getError: (state) => state.error, + getResult: (state) => state.result, + isCanceled: (state) => !!state.isCancelled, + isFailed: (state) => !!state.error, + isRunning: (state) => !!state.isStarted, + isSucceeded: (state) => Boolean(state.isCompleted && !state.isCancelled && !state.error), +}); +class GenericPollOperation { + state; + lro; + setErrorAsResult; + lroResourceLocationConfig; + processResult; + updateState; + isDone; + pollerConfig; + constructor(state, lro, setErrorAsResult, lroResourceLocationConfig, processResult, updateState, isDone) { + this.state = state; + this.lro = lro; + this.setErrorAsResult = setErrorAsResult; + this.lroResourceLocationConfig = lroResourceLocationConfig; + this.processResult = processResult; + this.updateState = updateState; + this.isDone = isDone; + } + setPollerConfig(pollerConfig) { + this.pollerConfig = pollerConfig; + } + async update(options) { + const stateProxy = createStateProxy(); + if (!this.state.isStarted) { + this.state = { + ...this.state, + ...(await (0, operation_js_1.initHttpOperation)({ + lro: this.lro, + stateProxy, + resourceLocationConfig: this.lroResourceLocationConfig, + processResult: this.processResult, + setErrorAsResult: this.setErrorAsResult, + })), + }; } - str += this.data; - next = this.nextSibling; - while (next) { - str = str + next.data; - next = next.nextSibling; + const updateState = this.updateState; + const isDone = this.isDone; + if (!this.state.isCompleted && this.state.error === undefined) { + await (0, operation_js_1.pollHttpOperation)({ + lro: this.lro, + state: this.state, + stateProxy, + processResult: this.processResult, + updateState: updateState + ? (state, { rawResponse }) => updateState(state, rawResponse) + : undefined, + isDone: isDone + ? ({ flatResponse }, state) => isDone(flatResponse, state) + : undefined, + options, + setDelay: (intervalInMs) => { + this.pollerConfig.intervalInMs = intervalInMs; + }, + setErrorAsResult: this.setErrorAsResult, + }); } - return str; - } - }); + options?.fireProgress?.(this.state); + return this; + } + async cancel() { + logger_js_1.logger.error("`cancelOperation` is deprecated because it wasn't implemented"); + return this; + } + /** + * Serializes the Poller operation. + */ + toString() { + return JSON.stringify({ + state: this.state, + }); + } +} +exports.GenericPollOperation = GenericPollOperation; +//# sourceMappingURL=operation.js.map - XMLText.prototype.clone = function() { - return Object.create(this); - }; +/***/ }), - XMLText.prototype.toString = function(options) { - return this.options.writer.text(this, this.options.writer.filterOptions(options)); - }; +/***/ 3586: +/***/ ((__unused_webpack_module, exports) => { - XMLText.prototype.splitText = function(offset) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +"use strict"; - XMLText.prototype.replaceWholeText = function(content) { - throw new Error("This DOM method is not implemented." + this.debugInfo()); - }; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=pollOperation.js.map - return XMLText; +/***/ }), - })(XMLCharacterData); +/***/ 7270: +/***/ ((__unused_webpack_module, exports) => { -}).call(this); +"use strict"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Poller = exports.PollerCancelledError = exports.PollerStoppedError = void 0; +/** + * When a poller is manually stopped through the `stopPolling` method, + * the poller will be rejected with an instance of the PollerStoppedError. + */ +class PollerStoppedError extends Error { + constructor(message) { + super(message); + this.name = "PollerStoppedError"; + Object.setPrototypeOf(this, PollerStoppedError.prototype); + } +} +exports.PollerStoppedError = PollerStoppedError; +/** + * When the operation is cancelled, the poller will be rejected with an instance + * of the PollerCancelledError. + */ +class PollerCancelledError extends Error { + constructor(message) { + super(message); + this.name = "PollerCancelledError"; + Object.setPrototypeOf(this, PollerCancelledError.prototype); + } +} +exports.PollerCancelledError = PollerCancelledError; +/** + * A class that represents the definition of a program that polls through consecutive requests + * until it reaches a state of completion. + * + * A poller can be executed manually, by polling request by request by calling to the `poll()` method repeatedly, until its operation is completed. + * It also provides a way to wait until the operation completes, by calling `pollUntilDone()` and waiting until the operation finishes. + * Pollers can also request the cancellation of the ongoing process to whom is providing the underlying long running operation. + * + * ```ts + * const poller = new MyPoller(); + * + * // Polling just once: + * await poller.poll(); + * + * // We can try to cancel the request here, by calling: + * // + * // await poller.cancelOperation(); + * // + * + * // Getting the final result: + * const result = await poller.pollUntilDone(); + * ``` + * + * The Poller is defined by two types, a type representing the state of the poller, which + * must include a basic set of properties from `PollOperationState`, + * and a return type defined by `TResult`, which can be anything. + * + * The Poller class implements the `PollerLike` interface, which allows poller implementations to avoid having + * to export the Poller's class directly, and instead only export the already instantiated poller with the PollerLike type. + * + * ```ts + * class Client { + * public async makePoller: PollerLike { + * const poller = new MyPoller({}); + * // It might be preferred to return the poller after the first request is made, + * // so that some information can be obtained right away. + * await poller.poll(); + * return poller; + * } + * } + * + * const poller: PollerLike = myClient.makePoller(); + * ``` + * + * A poller can be created through its constructor, then it can be polled until it's completed. + * At any point in time, the state of the poller can be obtained without delay through the getOperationState method. + * At any point in time, the intermediate forms of the result type can be requested without delay. + * Once the underlying operation is marked as completed, the poller will stop and the final value will be returned. + * + * ```ts + * const poller = myClient.makePoller(); + * const state: MyOperationState = poller.getOperationState(); + * + * // The intermediate result can be obtained at any time. + * const result: MyResult | undefined = poller.getResult(); + * + * // The final result can only be obtained after the poller finishes. + * const result: MyResult = await poller.pollUntilDone(); + * ``` + * + */ +// eslint-disable-next-line no-use-before-define +class Poller { + /** controls whether to throw an error if the operation failed or was canceled. */ + resolveOnUnsuccessful = false; + stopped = true; + resolve; + reject; + pollOncePromise; + cancelPromise; + promise; + pollProgressCallbacks = []; + /** + * The poller's operation is available in full to any of the methods of the Poller class + * and any class extending the Poller class. + */ + operation; + /** + * A poller needs to be initialized by passing in at least the basic properties of the `PollOperation`. + * + * When writing an implementation of a Poller, this implementation needs to deal with the initialization + * of any custom state beyond the basic definition of the poller. The basic poller assumes that the poller's + * operation has already been defined, at least its basic properties. The code below shows how to approach + * the definition of the constructor of a new custom poller. + * + * ```ts + * export class MyPoller extends Poller { + * constructor({ + * // Anything you might need outside of the basics + * }) { + * let state: MyOperationState = { + * privateProperty: private, + * publicProperty: public, + * }; + * + * const operation = { + * state, + * update, + * cancel, + * toString + * } + * + * // Sending the operation to the parent's constructor. + * super(operation); + * + * // You can assign more local properties here. + * } + * } + * ``` + * + * Inside of this constructor, a new promise is created. This will be used to + * tell the user when the poller finishes (see `pollUntilDone()`). The promise's + * resolve and reject methods are also used internally to control when to resolve + * or reject anyone waiting for the poller to finish. + * + * The constructor of a custom implementation of a poller is where any serialized version of + * a previous poller's operation should be deserialized into the operation sent to the + * base constructor. For example: + * + * ```ts + * export class MyPoller extends Poller { + * constructor( + * baseOperation: string | undefined + * ) { + * let state: MyOperationState = {}; + * if (baseOperation) { + * state = { + * ...JSON.parse(baseOperation).state, + * ...state + * }; + * } + * const operation = { + * state, + * // ... + * } + * super(operation); + * } + * } + * ``` + * + * @param operation - Must contain the basic properties of `PollOperation`. + */ + constructor(operation) { + this.operation = operation; + this.promise = new Promise((resolve, reject) => { + this.resolve = resolve; + this.reject = reject; + }); + // This prevents the UnhandledPromiseRejectionWarning in node.js from being thrown. + // The above warning would get thrown if `poller.poll` is called, it returns an error, + // and pullUntilDone did not have a .catch or await try/catch on it's return value. + this.promise.catch(() => { + /* intentionally blank */ + }); + } + /** + * Starts a loop that will break only if the poller is done + * or if the poller is stopped. + */ + async startPolling(pollOptions = {}) { + if (this.stopped) { + this.stopped = false; + } + while (!this.isStopped() && !this.isDone()) { + await this.poll(pollOptions); + await this.delay(); + } + } + /** + * pollOnce does one polling, by calling to the update method of the underlying + * poll operation to make any relevant change effective. + * + * It only optionally receives an object with an abortSignal property, from \@azure/abort-controller's AbortSignalLike. + * + * @param options - Optional properties passed to the operation's update method. + */ + async pollOnce(options = {}) { + if (!this.isDone()) { + this.operation = await this.operation.update({ + abortSignal: options.abortSignal, + fireProgress: this.fireProgress.bind(this), + }); + } + this.processUpdatedState(); + } + /** + * fireProgress calls the functions passed in via onProgress the method of the poller. + * + * It loops over all of the callbacks received from onProgress, and executes them, sending them + * the current operation state. + * + * @param state - The current operation state. + */ + fireProgress(state) { + for (const callback of this.pollProgressCallbacks) { + callback(state); + } + } + /** + * Invokes the underlying operation's cancel method. + */ + async cancelOnce(options = {}) { + this.operation = await this.operation.cancel(options); + } + /** + * Returns a promise that will resolve once a single polling request finishes. + * It does this by calling the update method of the Poller's operation. + * + * It only optionally receives an object with an abortSignal property, from \@azure/abort-controller's AbortSignalLike. + * + * @param options - Optional properties passed to the operation's update method. + */ + poll(options = {}) { + if (!this.pollOncePromise) { + this.pollOncePromise = this.pollOnce(options); + const clearPollOncePromise = () => { + this.pollOncePromise = undefined; + }; + this.pollOncePromise.then(clearPollOncePromise, clearPollOncePromise).catch(this.reject); + } + return this.pollOncePromise; + } + processUpdatedState() { + if (this.operation.state.error) { + this.stopped = true; + if (!this.resolveOnUnsuccessful) { + this.reject(this.operation.state.error); + throw this.operation.state.error; + } + } + if (this.operation.state.isCancelled) { + this.stopped = true; + if (!this.resolveOnUnsuccessful) { + const error = new PollerCancelledError("Operation was canceled"); + this.reject(error); + throw error; + } + } + if (this.isDone() && this.resolve) { + // If the poller has finished polling, this means we now have a result. + // However, it can be the case that TResult is instantiated to void, so + // we are not expecting a result anyway. To assert that we might not + // have a result eventually after finishing polling, we cast the result + // to TResult. + this.resolve(this.getResult()); + } + } + /** + * Returns a promise that will resolve once the underlying operation is completed. + */ + async pollUntilDone(pollOptions = {}) { + if (this.stopped) { + this.startPolling(pollOptions).catch(this.reject); + } + // This is needed because the state could have been updated by + // `cancelOperation`, e.g. the operation is canceled or an error occurred. + this.processUpdatedState(); + return this.promise; + } + /** + * Invokes the provided callback after each polling is completed, + * sending the current state of the poller's operation. + * + * It returns a method that can be used to stop receiving updates on the given callback function. + */ + onProgress(callback) { + this.pollProgressCallbacks.push(callback); + return () => { + this.pollProgressCallbacks = this.pollProgressCallbacks.filter((c) => c !== callback); + }; + } + /** + * Returns true if the poller has finished polling. + */ + isDone() { + const state = this.operation.state; + return Boolean(state.isCompleted || state.isCancelled || state.error); + } + /** + * Stops the poller from continuing to poll. + */ + stopPolling() { + if (!this.stopped) { + this.stopped = true; + if (this.reject) { + this.reject(new PollerStoppedError("This poller is already stopped")); + } + } + } + /** + * Returns true if the poller is stopped. + */ + isStopped() { + return this.stopped; + } + /** + * Attempts to cancel the underlying operation. + * + * It only optionally receives an object with an abortSignal property, from \@azure/abort-controller's AbortSignalLike. + * + * If it's called again before it finishes, it will throw an error. + * + * @param options - Optional properties passed to the operation's update method. + */ + cancelOperation(options = {}) { + if (!this.cancelPromise) { + this.cancelPromise = this.cancelOnce(options); + } + else if (options.abortSignal) { + throw new Error("A cancel request is currently pending"); + } + return this.cancelPromise; + } + /** + * Returns the state of the operation. + * + * Even though TState will be the same type inside any of the methods of any extension of the Poller class, + * implementations of the pollers can customize what's shared with the public by writing their own + * version of the `getOperationState` method, and by defining two types, one representing the internal state of the poller + * and a public type representing a safe to share subset of the properties of the internal state. + * Their definition of getOperationState can then return their public type. + * + * Example: + * + * ```ts + * // Let's say we have our poller's operation state defined as: + * interface MyOperationState extends PollOperationState { + * privateProperty?: string; + * publicProperty?: string; + * } + * + * // To allow us to have a true separation of public and private state, we have to define another interface: + * interface PublicState extends PollOperationState { + * publicProperty?: string; + * } + * + * // Then, we define our Poller as follows: + * export class MyPoller extends Poller { + * // ... More content is needed here ... + * + * public getOperationState(): PublicState { + * const state: PublicState = this.operation.state; + * return { + * // Properties from PollOperationState + * isStarted: state.isStarted, + * isCompleted: state.isCompleted, + * isCancelled: state.isCancelled, + * error: state.error, + * result: state.result, + * + * // The only other property needed by PublicState. + * publicProperty: state.publicProperty + * } + * } + * } + * ``` + * + * You can see this in the tests of this repository, go to the file: + * `../test/utils/testPoller.ts` + * and look for the getOperationState implementation. + */ + getOperationState() { + return this.operation.state; + } + /** + * Returns the result value of the operation, + * regardless of the state of the poller. + * It can return undefined or an incomplete form of the final TResult value + * depending on the implementation. + */ + getResult() { + const state = this.operation.state; + return state.result; + } + /** + * Returns a serialized version of the poller's operation + * by invoking the operation's toString method. + */ + toString() { + return this.operation.toString(); + } +} +exports.Poller = Poller; +//# sourceMappingURL=poller.js.map /***/ }), -/***/ 6752: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, WriterState, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLText, XMLWriterBase, assign, - hasProp = {}.hasOwnProperty; - - assign = (__nccwpck_require__(8229).assign); - - NodeType = __nccwpck_require__(9267); - - XMLDeclaration = __nccwpck_require__(6364); - - XMLDocType = __nccwpck_require__(1801); - - XMLCData = __nccwpck_require__(333); - - XMLComment = __nccwpck_require__(4407); - - XMLElement = __nccwpck_require__(9437); +/***/ 8121: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLRaw = __nccwpck_require__(6329); +"use strict"; - XMLText = __nccwpck_require__(1318); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.logger = void 0; +const logger_1 = __nccwpck_require__(9497); +/** + * The `@azure/logger` configuration for this package. + * @internal + */ +exports.logger = (0, logger_1.createClientLogger)("core-lro"); +//# sourceMappingURL=logger.js.map - XMLProcessingInstruction = __nccwpck_require__(6939); +/***/ }), - XMLDummy = __nccwpck_require__(3590); +/***/ 3846: +/***/ ((__unused_webpack_module, exports) => { - XMLDTDAttList = __nccwpck_require__(1015); +"use strict"; - XMLDTDElement = __nccwpck_require__(2421); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.terminalStates = exports.POLL_INTERVAL_IN_MS = void 0; +/** + * The default time interval to wait before sending the next polling request. + */ +exports.POLL_INTERVAL_IN_MS = 2000; +/** + * The closed set of terminal states. + */ +exports.terminalStates = ["succeeded", "canceled", "failed"]; +//# sourceMappingURL=constants.js.map - XMLDTDEntity = __nccwpck_require__(53); +/***/ }), - XMLDTDNotation = __nccwpck_require__(2837); +/***/ 281: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - WriterState = __nccwpck_require__(9766); +"use strict"; - module.exports = XMLWriterBase = (function() { - function XMLWriterBase(options) { - var key, ref, value; - options || (options = {}); - this.options = options; - ref = options.writer || {}; - for (key in ref) { - if (!hasProp.call(ref, key)) continue; - value = ref[key]; - this["_" + key] = this[key]; - this[key] = value; - } +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.pollOperation = exports.initOperation = exports.deserializeState = void 0; +const logger_js_1 = __nccwpck_require__(8121); +const constants_js_1 = __nccwpck_require__(3846); +/** + * Deserializes the state + */ +function deserializeState(serializedState) { + try { + return JSON.parse(serializedState).state; } - - XMLWriterBase.prototype.filterOptions = function(options) { - var filteredOptions, ref, ref1, ref2, ref3, ref4, ref5, ref6; - options || (options = {}); - options = assign({}, this.options, options); - filteredOptions = { - writer: this - }; - filteredOptions.pretty = options.pretty || false; - filteredOptions.allowEmpty = options.allowEmpty || false; - filteredOptions.indent = (ref = options.indent) != null ? ref : ' '; - filteredOptions.newline = (ref1 = options.newline) != null ? ref1 : '\n'; - filteredOptions.offset = (ref2 = options.offset) != null ? ref2 : 0; - filteredOptions.dontPrettyTextNodes = (ref3 = (ref4 = options.dontPrettyTextNodes) != null ? ref4 : options.dontprettytextnodes) != null ? ref3 : 0; - filteredOptions.spaceBeforeSlash = (ref5 = (ref6 = options.spaceBeforeSlash) != null ? ref6 : options.spacebeforeslash) != null ? ref5 : ''; - if (filteredOptions.spaceBeforeSlash === true) { - filteredOptions.spaceBeforeSlash = ' '; - } - filteredOptions.suppressPrettyCount = 0; - filteredOptions.user = {}; - filteredOptions.state = WriterState.None; - return filteredOptions; - }; - - XMLWriterBase.prototype.indent = function(node, options, level) { - var indentLevel; - if (!options.pretty || options.suppressPrettyCount) { - return ''; - } else if (options.pretty) { - indentLevel = (level || 0) + options.offset + 1; - if (indentLevel > 0) { - return new Array(indentLevel).join(options.indent); + catch (e) { + throw new Error(`Unable to deserialize input state: ${serializedState}`); + } +} +exports.deserializeState = deserializeState; +function setStateError(inputs) { + const { state, stateProxy, isOperationError } = inputs; + return (error) => { + if (isOperationError(error)) { + stateProxy.setError(state, error); + stateProxy.setFailed(state); } - } - return ''; - }; - - XMLWriterBase.prototype.endline = function(node, options, level) { - if (!options.pretty || options.suppressPrettyCount) { - return ''; - } else { - return options.newline; - } - }; - - XMLWriterBase.prototype.attribute = function(att, options, level) { - var r; - this.openAttribute(att, options, level); - r = ' ' + att.name + '="' + att.value + '"'; - this.closeAttribute(att, options, level); - return r; - }; - - XMLWriterBase.prototype.cdata = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + '' + this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.comment = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + '' + this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.declaration = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + ''; - r += this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; + throw error; }; - - XMLWriterBase.prototype.docType = function(node, options, level) { - var child, i, len, r, ref; - level || (level = 0); - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level); - r += ' 0) { - r += ' ['; - r += this.endline(node, options, level); - options.state = WriterState.InsideTag; - ref = node.children; - for (i = 0, len = ref.length; i < len; i++) { - child = ref[i]; - r += this.writeChildNode(child, options, level + 1); - } - options.state = WriterState.CloseTag; - r += ']'; - } - options.state = WriterState.CloseTag; - r += options.spaceBeforeSlash + '>'; - r += this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; +} +function appendReadableErrorMessage(currentMessage, innerMessage) { + let message = currentMessage; + if (message.slice(-1) !== ".") { + message = message + "."; + } + return message + " " + innerMessage; +} +function simplifyError(err) { + let message = err.message; + let code = err.code; + let curErr = err; + while (curErr.innererror) { + curErr = curErr.innererror; + code = curErr.code; + message = appendReadableErrorMessage(message, curErr.message); + } + return { + code, + message, }; - - XMLWriterBase.prototype.element = function(node, options, level) { - var att, child, childNodeCount, firstChildNode, i, j, len, len1, name, prettySuppressed, r, ref, ref1, ref2; - level || (level = 0); - prettySuppressed = false; - r = ''; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r += this.indent(node, options, level) + '<' + node.name; - ref = node.attribs; - for (name in ref) { - if (!hasProp.call(ref, name)) continue; - att = ref[name]; - r += this.attribute(att, options, level); - } - childNodeCount = node.children.length; - firstChildNode = childNodeCount === 0 ? null : node.children[0]; - if (childNodeCount === 0 || node.children.every(function(e) { - return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === ''; - })) { - if (options.allowEmpty) { - r += '>'; - options.state = WriterState.CloseTag; - r += '' + this.endline(node, options, level); - } else { - options.state = WriterState.CloseTag; - r += options.spaceBeforeSlash + '/>' + this.endline(node, options, level); +} +function processOperationStatus(result) { + const { state, stateProxy, status, isDone, processResult, getError, response, setErrorAsResult } = result; + switch (status) { + case "succeeded": { + stateProxy.setSucceeded(state); + break; } - } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) { - r += '>'; - options.state = WriterState.InsideTag; - options.suppressPrettyCount++; - prettySuppressed = true; - r += this.writeChildNode(firstChildNode, options, level + 1); - options.suppressPrettyCount--; - prettySuppressed = false; - options.state = WriterState.CloseTag; - r += '' + this.endline(node, options, level); - } else { - if (options.dontPrettyTextNodes) { - ref1 = node.children; - for (i = 0, len = ref1.length; i < len; i++) { - child = ref1[i]; - if ((child.type === NodeType.Text || child.type === NodeType.Raw) && (child.value != null)) { - options.suppressPrettyCount++; - prettySuppressed = true; - break; + case "failed": { + const err = getError?.(response); + let postfix = ""; + if (err) { + const { code, message } = simplifyError(err); + postfix = `. ${code}. ${message}`; } - } - } - r += '>' + this.endline(node, options, level); - options.state = WriterState.InsideTag; - ref2 = node.children; - for (j = 0, len1 = ref2.length; j < len1; j++) { - child = ref2[j]; - r += this.writeChildNode(child, options, level + 1); - } - options.state = WriterState.CloseTag; - r += this.indent(node, options, level) + ''; - if (prettySuppressed) { - options.suppressPrettyCount--; - } - r += this.endline(node, options, level); - options.state = WriterState.None; - } - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.writeChildNode = function(node, options, level) { - switch (node.type) { - case NodeType.CData: - return this.cdata(node, options, level); - case NodeType.Comment: - return this.comment(node, options, level); - case NodeType.Element: - return this.element(node, options, level); - case NodeType.Raw: - return this.raw(node, options, level); - case NodeType.Text: - return this.text(node, options, level); - case NodeType.ProcessingInstruction: - return this.processingInstruction(node, options, level); - case NodeType.Dummy: - return ''; - case NodeType.Declaration: - return this.declaration(node, options, level); - case NodeType.DocType: - return this.docType(node, options, level); - case NodeType.AttributeDeclaration: - return this.dtdAttList(node, options, level); - case NodeType.ElementDeclaration: - return this.dtdElement(node, options, level); - case NodeType.EntityDeclaration: - return this.dtdEntity(node, options, level); - case NodeType.NotationDeclaration: - return this.dtdNotation(node, options, level); - default: - throw new Error("Unknown XML node type: " + node.constructor.name); - } - }; - - XMLWriterBase.prototype.processingInstruction = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + ''; - r += this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.raw = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level); - options.state = WriterState.InsideTag; - r += node.value; - options.state = WriterState.CloseTag; - r += this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.text = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level); - options.state = WriterState.InsideTag; - r += node.value; - options.state = WriterState.CloseTag; - r += this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.dtdAttList = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + '' + this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.dtdElement = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + '' + this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.dtdEntity = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + '' + this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; - }; - - XMLWriterBase.prototype.dtdNotation = function(node, options, level) { - var r; - this.openNode(node, options, level); - options.state = WriterState.OpenTag; - r = this.indent(node, options, level) + '' + this.endline(node, options, level); - options.state = WriterState.None; - this.closeNode(node, options, level); - return r; + } + if (isDone?.(response, state) || + (isDone === undefined && + ["succeeded", "canceled"].concat(setErrorAsResult ? [] : ["failed"]).includes(status))) { + stateProxy.setResult(state, buildResult({ + response, + state, + processResult, + })); + } +} +function buildResult(inputs) { + const { processResult, response, state } = inputs; + return processResult ? processResult(response, state) : response; +} +/** + * Initiates the long-running operation. + */ +async function initOperation(inputs) { + const { init, stateProxy, processResult, getOperationStatus, withOperationLocation, setErrorAsResult, } = inputs; + const { operationLocation, resourceLocation, metadata, response } = await init(); + if (operationLocation) + withOperationLocation?.(operationLocation, false); + const config = { + metadata, + operationLocation, + resourceLocation, }; - - XMLWriterBase.prototype.openNode = function(node, options, level) {}; - - XMLWriterBase.prototype.closeNode = function(node, options, level) {}; - - XMLWriterBase.prototype.openAttribute = function(att, options, level) {}; - - XMLWriterBase.prototype.closeAttribute = function(att, options, level) {}; - - return XMLWriterBase; - - })(); - -}).call(this); - + logger_js_1.logger.verbose(`LRO: Operation description:`, config); + const state = stateProxy.initState(config); + const status = getOperationStatus({ response, state, operationLocation }); + processOperationStatus({ state, status, stateProxy, response, setErrorAsResult, processResult }); + return state; +} +exports.initOperation = initOperation; +async function pollOperationHelper(inputs) { + const { poll, state, stateProxy, operationLocation, getOperationStatus, getResourceLocation, isOperationError, options, } = inputs; + const response = await poll(operationLocation, options).catch(setStateError({ + state, + stateProxy, + isOperationError, + })); + const status = getOperationStatus(response, state); + logger_js_1.logger.verbose(`LRO: Status:\n\tPolling from: ${state.config.operationLocation}\n\tOperation status: ${status}\n\tPolling status: ${constants_js_1.terminalStates.includes(status) ? "Stopped" : "Running"}`); + if (status === "succeeded") { + const resourceLocation = getResourceLocation(response, state); + if (resourceLocation !== undefined) { + return { + response: await poll(resourceLocation).catch(setStateError({ state, stateProxy, isOperationError })), + status, + }; + } + } + return { response, status }; +} +/** Polls the long-running operation. */ +async function pollOperation(inputs) { + const { poll, state, stateProxy, options, getOperationStatus, getResourceLocation, getOperationLocation, isOperationError, withOperationLocation, getPollingInterval, processResult, getError, updateState, setDelay, isDone, setErrorAsResult, } = inputs; + const { operationLocation } = state.config; + if (operationLocation !== undefined) { + const { response, status } = await pollOperationHelper({ + poll, + getOperationStatus, + state, + stateProxy, + operationLocation, + getResourceLocation, + isOperationError, + options, + }); + processOperationStatus({ + status, + response, + state, + stateProxy, + isDone, + processResult, + getError, + setErrorAsResult, + }); + if (!constants_js_1.terminalStates.includes(status)) { + const intervalInMs = getPollingInterval?.(response); + if (intervalInMs) + setDelay(intervalInMs); + const location = getOperationLocation?.(response, state); + if (location !== undefined) { + const isUpdated = operationLocation !== location; + state.config.operationLocation = location; + withOperationLocation?.(location, isUpdated); + } + else + withOperationLocation?.(operationLocation, false); + } + updateState?.(state, response); + } +} +exports.pollOperation = pollOperation; +//# sourceMappingURL=operation.js.map /***/ }), -/***/ 2958: -/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { - -// Generated by CoffeeScript 1.12.7 -(function() { - var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref; - - ref = __nccwpck_require__(8229), assign = ref.assign, isFunction = ref.isFunction; - - XMLDOMImplementation = __nccwpck_require__(8310); - - XMLDocument = __nccwpck_require__(3730); +/***/ 6713: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - XMLDocumentCB = __nccwpck_require__(7356); +"use strict"; - XMLStringWriter = __nccwpck_require__(5913); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.buildCreatePoller = void 0; +const operation_js_1 = __nccwpck_require__(281); +const constants_js_1 = __nccwpck_require__(3846); +const core_util_1 = __nccwpck_require__(637); +const createStateProxy = () => ({ + /** + * The state at this point is created to be of type OperationState. + * It will be updated later to be of type TState when the + * customer-provided callback, `updateState`, is called during polling. + */ + initState: (config) => ({ status: "running", config }), + setCanceled: (state) => (state.status = "canceled"), + setError: (state, error) => (state.error = error), + setResult: (state, result) => (state.result = result), + setRunning: (state) => (state.status = "running"), + setSucceeded: (state) => (state.status = "succeeded"), + setFailed: (state) => (state.status = "failed"), + getError: (state) => state.error, + getResult: (state) => state.result, + isCanceled: (state) => state.status === "canceled", + isFailed: (state) => state.status === "failed", + isRunning: (state) => state.status === "running", + isSucceeded: (state) => state.status === "succeeded", +}); +/** + * Returns a poller factory. + */ +function buildCreatePoller(inputs) { + const { getOperationLocation, getStatusFromInitialResponse, getStatusFromPollResponse, isOperationError, getResourceLocation, getPollingInterval, getError, resolveOnUnsuccessful, } = inputs; + return async ({ init, poll }, options) => { + const { processResult, updateState, withOperationLocation: withOperationLocationCallback, intervalInMs = constants_js_1.POLL_INTERVAL_IN_MS, restoreFrom, } = options || {}; + const stateProxy = createStateProxy(); + const withOperationLocation = withOperationLocationCallback + ? (() => { + let called = false; + return (operationLocation, isUpdated) => { + if (isUpdated) + withOperationLocationCallback(operationLocation); + else if (!called) + withOperationLocationCallback(operationLocation); + called = true; + }; + })() + : undefined; + const state = restoreFrom + ? (0, operation_js_1.deserializeState)(restoreFrom) + : await (0, operation_js_1.initOperation)({ + init, + stateProxy, + processResult, + getOperationStatus: getStatusFromInitialResponse, + withOperationLocation, + setErrorAsResult: !resolveOnUnsuccessful, + }); + let resultPromise; + const abortController = new AbortController(); + const handlers = new Map(); + const handleProgressEvents = async () => handlers.forEach((h) => h(state)); + const cancelErrMsg = "Operation was canceled"; + let currentPollIntervalInMs = intervalInMs; + const poller = { + getOperationState: () => state, + getResult: () => state.result, + isDone: () => ["succeeded", "failed", "canceled"].includes(state.status), + isStopped: () => resultPromise === undefined, + stopPolling: () => { + abortController.abort(); + }, + toString: () => JSON.stringify({ + state, + }), + onProgress: (callback) => { + const s = Symbol(); + handlers.set(s, callback); + return () => handlers.delete(s); + }, + pollUntilDone: (pollOptions) => (resultPromise ??= (async () => { + const { abortSignal: inputAbortSignal } = pollOptions || {}; + // In the future we can use AbortSignal.any() instead + function abortListener() { + abortController.abort(); + } + const abortSignal = abortController.signal; + if (inputAbortSignal?.aborted) { + abortController.abort(); + } + else if (!abortSignal.aborted) { + inputAbortSignal?.addEventListener("abort", abortListener, { once: true }); + } + try { + if (!poller.isDone()) { + await poller.poll({ abortSignal }); + while (!poller.isDone()) { + await (0, core_util_1.delay)(currentPollIntervalInMs, { abortSignal }); + await poller.poll({ abortSignal }); + } + } + } + finally { + inputAbortSignal?.removeEventListener("abort", abortListener); + } + if (resolveOnUnsuccessful) { + return poller.getResult(); + } + else { + switch (state.status) { + case "succeeded": + return poller.getResult(); + case "canceled": + throw new Error(cancelErrMsg); + case "failed": + throw state.error; + case "notStarted": + case "running": + throw new Error(`Polling completed without succeeding or failing`); + } + } + })().finally(() => { + resultPromise = undefined; + })), + async poll(pollOptions) { + if (resolveOnUnsuccessful) { + if (poller.isDone()) + return; + } + else { + switch (state.status) { + case "succeeded": + return; + case "canceled": + throw new Error(cancelErrMsg); + case "failed": + throw state.error; + } + } + await (0, operation_js_1.pollOperation)({ + poll, + state, + stateProxy, + getOperationLocation, + isOperationError, + withOperationLocation, + getPollingInterval, + getOperationStatus: getStatusFromPollResponse, + getResourceLocation, + processResult, + getError, + updateState, + options: pollOptions, + setDelay: (pollIntervalInMs) => { + currentPollIntervalInMs = pollIntervalInMs; + }, + setErrorAsResult: !resolveOnUnsuccessful, + }); + await handleProgressEvents(); + if (!resolveOnUnsuccessful) { + switch (state.status) { + case "canceled": + throw new Error(cancelErrMsg); + case "failed": + throw state.error; + } + } + }, + }; + return poller; + }; +} +exports.buildCreatePoller = buildCreatePoller; +//# sourceMappingURL=poller.js.map - XMLStreamWriter = __nccwpck_require__(8601); +/***/ }), - NodeType = __nccwpck_require__(9267); +/***/ 5002: +/***/ ((__unused_webpack_module, exports) => { - WriterState = __nccwpck_require__(9766); +"use strict"; - module.exports.create = function(name, xmldec, doctype, options) { - var doc, root; - if (name == null) { - throw new Error("Root element needs a name."); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getPagedAsyncIterator = void 0; +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ +function getPagedAsyncIterator(pagedResult) { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: pagedResult?.byPage ?? + ((settings) => { + const { continuationToken, maxPageSize } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + maxPageSize, + }); + }), + }; +} +exports.getPagedAsyncIterator = getPagedAsyncIterator; +async function* getItemAsyncIterator(pagedResult) { + const pages = getPageAsyncIterator(pagedResult); + const firstVal = await pages.next(); + // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is + if (!Array.isArray(firstVal.value)) { + // can extract elements from this page + const { toElements } = pagedResult; + if (toElements) { + yield* toElements(firstVal.value); + for await (const page of pages) { + yield* toElements(page); + } + } + else { + yield firstVal.value; + // `pages` is of type `AsyncIterableIterator` but TPage = TElement in this case + yield* pages; + } } - options = assign({}, xmldec, doctype, options); - doc = new XMLDocument(options); - root = doc.element(name); - if (!options.headless) { - doc.declaration(options); - if ((options.pubID != null) || (options.sysID != null)) { - doc.dtd(options); - } + else { + yield* firstVal.value; + for await (const page of pages) { + // pages is of type `AsyncIterableIterator` so `page` is of type `TPage`. In this branch, + // it must be the case that `TPage = TElement[]` + yield* page; + } } - return root; - }; - - module.exports.begin = function(options, onData, onEnd) { - var ref1; - if (isFunction(options)) { - ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1]; - options = {}; +} +async function* getPageAsyncIterator(pagedResult, options = {}) { + const { pageLink, maxPageSize } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink, maxPageSize); + if (!response) { + return; } - if (onData) { - return new XMLDocumentCB(options, onData, onEnd); - } else { - return new XMLDocument(options); + yield response.page; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink, maxPageSize); + if (!response) { + return; + } + yield response.page; } - }; - - module.exports.stringWriter = function(options) { - return new XMLStringWriter(options); - }; - - module.exports.streamWriter = function(stream, options) { - return new XMLStreamWriter(stream, options); - }; - - module.exports.implementation = new XMLDOMImplementation(); - - module.exports.nodeType = NodeType; - - module.exports.writerState = WriterState; - -}).call(this); - - -/***/ }), - -/***/ 2877: -/***/ ((module) => { - -module.exports = eval("require")("encoding"); - +} +//# sourceMappingURL=getPagedAsyncIterator.js.map /***/ }), -/***/ 9491: -/***/ ((module) => { +/***/ 7947: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("assert"); - -/***/ }), - -/***/ 852: -/***/ ((module) => { -"use strict"; -module.exports = require("async_hooks"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +const tslib_1 = __nccwpck_require__(4351); +tslib_1.__exportStar(__nccwpck_require__(2519), exports); +tslib_1.__exportStar(__nccwpck_require__(5002), exports); +//# sourceMappingURL=index.js.map /***/ }), -/***/ 4300: -/***/ ((module) => { +/***/ 2519: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("buffer"); - -/***/ }), -/***/ 2081: -/***/ ((module) => { - -"use strict"; -module.exports = require("child_process"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=models.js.map /***/ }), -/***/ 6206: -/***/ ((module) => { +/***/ 7205: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("console"); -/***/ }), - -/***/ 6113: -/***/ ((module) => { - -"use strict"; -module.exports = require("crypto"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.cancelablePromiseRace = void 0; +/** + * promise.race() wrapper that aborts rest of promises as soon as the first promise settles. + */ +async function cancelablePromiseRace(abortablePromiseBuilders, options) { + const aborter = new AbortController(); + function abortHandler() { + aborter.abort(); + } + options?.abortSignal?.addEventListener("abort", abortHandler); + try { + return await Promise.race(abortablePromiseBuilders.map((p) => p({ abortSignal: aborter.signal }))); + } + finally { + aborter.abort(); + options?.abortSignal?.removeEventListener("abort", abortHandler); + } +} +exports.cancelablePromiseRace = cancelablePromiseRace; +//# sourceMappingURL=aborterUtils.js.map /***/ }), -/***/ 7643: -/***/ ((module) => { +/***/ 9972: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("diagnostics_channel"); - -/***/ }), -/***/ 2361: -/***/ ((module) => { - -"use strict"; -module.exports = require("events"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.stringToUint8Array = exports.uint8ArrayToString = void 0; +/** + * The helper that transforms bytes with specific character encoding into string + * @param bytes - the uint8array bytes + * @param format - the format we use to encode the byte + * @returns a string of the encoded string + */ +function uint8ArrayToString(bytes, format) { + return Buffer.from(bytes).toString(format); +} +exports.uint8ArrayToString = uint8ArrayToString; +/** + * The helper that transforms string to specific character encoded bytes array. + * @param value - the string to be converted + * @param format - the format we use to decode the value + * @returns a uint8array + */ +function stringToUint8Array(value, format) { + return Buffer.from(value, format); +} +exports.stringToUint8Array = stringToUint8Array; +//# sourceMappingURL=bytesEncoding.js.map /***/ }), -/***/ 7147: -/***/ ((module) => { +/***/ 7980: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("fs"); -/***/ }), - -/***/ 3292: -/***/ ((module) => { - -"use strict"; -module.exports = require("fs/promises"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isReactNative = exports.isNode = exports.isBun = exports.isDeno = exports.isWebWorker = exports.isBrowser = void 0; +/** + * A constant that indicates whether the environment the code is running is a Web Browser. + */ +// eslint-disable-next-line @azure/azure-sdk/ts-no-window +exports.isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; +/** + * A constant that indicates whether the environment the code is running is a Web Worker. + */ +exports.isWebWorker = typeof self === "object" && + typeof self?.importScripts === "function" && + (self.constructor?.name === "DedicatedWorkerGlobalScope" || + self.constructor?.name === "ServiceWorkerGlobalScope" || + self.constructor?.name === "SharedWorkerGlobalScope"); +/** + * A constant that indicates whether the environment the code is running is Deno. + */ +exports.isDeno = typeof Deno !== "undefined" && + typeof Deno.version !== "undefined" && + typeof Deno.version.deno !== "undefined"; +/** + * A constant that indicates whether the environment the code is running is Bun.sh. + */ +exports.isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; +/** + * A constant that indicates whether the environment the code is running is Node.JS. + */ +exports.isNode = typeof globalThis.process !== "undefined" && + Boolean(globalThis.process.version) && + Boolean(globalThis.process.versions?.node) && + // Deno thought it was a good idea to spoof process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions + !exports.isDeno && + !exports.isBun; +/** + * A constant that indicates whether the environment the code is running is in React-Native. + */ +// https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js +exports.isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; +//# sourceMappingURL=checkEnvironment.js.map /***/ }), -/***/ 3685: -/***/ ((module) => { +/***/ 2307: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("http"); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createAbortablePromise = void 0; +const abort_controller_1 = __nccwpck_require__(4812); +/** + * Creates an abortable promise. + * @param buildPromise - A function that takes the resolve and reject functions as parameters. + * @param options - The options for the abortable promise. + * @returns A promise that can be aborted. + */ +function createAbortablePromise(buildPromise, options) { + const { cleanupBeforeAbort, abortSignal, abortErrorMsg } = options ?? {}; + return new Promise((resolve, reject) => { + function rejectOnAbort() { + reject(new abort_controller_1.AbortError(abortErrorMsg ?? "The operation was aborted.")); + } + function removeListeners() { + abortSignal?.removeEventListener("abort", onAbort); + } + function onAbort() { + cleanupBeforeAbort?.(); + removeListeners(); + rejectOnAbort(); + } + if (abortSignal?.aborted) { + return rejectOnAbort(); + } + try { + buildPromise((x) => { + removeListeners(); + resolve(x); + }, (x) => { + removeListeners(); + reject(x); + }); + } + catch (err) { + reject(err); + } + abortSignal?.addEventListener("abort", onAbort); + }); +} +exports.createAbortablePromise = createAbortablePromise; +//# sourceMappingURL=createAbortablePromise.js.map /***/ }), -/***/ 5158: -/***/ ((module) => { +/***/ 9259: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("http2"); - -/***/ }), -/***/ 5687: -/***/ ((module) => { - -"use strict"; -module.exports = require("https"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.delay = void 0; +const createAbortablePromise_js_1 = __nccwpck_require__(2307); +const StandardAbortMessage = "The delay was aborted."; +/** + * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds. + * @param timeInMs - The number of milliseconds to be delayed. + * @param options - The options for delay - currently abort options + * @returns Promise that is resolved after timeInMs + */ +function delay(timeInMs, options) { + let token; + const { abortSignal, abortErrorMsg } = options ?? {}; + return (0, createAbortablePromise_js_1.createAbortablePromise)((resolve) => { + token = setTimeout(resolve, timeInMs); + }, { + cleanupBeforeAbort: () => clearTimeout(token), + abortSignal, + abortErrorMsg: abortErrorMsg ?? StandardAbortMessage, + }); +} +exports.delay = delay; +//# sourceMappingURL=delay.js.map /***/ }), -/***/ 1808: -/***/ ((module) => { +/***/ 6734: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("net"); - -/***/ }), - -/***/ 5673: -/***/ ((module) => { -"use strict"; -module.exports = require("node:events"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getErrorMessage = exports.isError = void 0; +const object_js_1 = __nccwpck_require__(6538); +/** + * Typeguard for an error object shape (has name and message) + * @param e - Something caught by a catch clause. + */ +function isError(e) { + if ((0, object_js_1.isObject)(e)) { + const hasName = typeof e.name === "string"; + const hasMessage = typeof e.message === "string"; + return hasName && hasMessage; + } + return false; +} +exports.isError = isError; +/** + * Given what is thought to be an error object, return the message if possible. + * If the message is missing, returns a stringified version of the input. + * @param e - Something thrown from a try block + * @returns The error message or a string of the input + */ +function getErrorMessage(e) { + if (isError(e)) { + return e.message; + } + else { + let stringified; + try { + if (typeof e === "object" && e) { + stringified = JSON.stringify(e); + } + else { + stringified = String(e); + } + } + catch (err) { + stringified = "[unable to stringify input]"; + } + return `Unknown error ${stringified}`; + } +} +exports.getErrorMessage = getErrorMessage; +//# sourceMappingURL=error.js.map /***/ }), -/***/ 4492: -/***/ ((module) => { +/***/ 637: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("node:stream"); - -/***/ }), - -/***/ 7261: -/***/ ((module) => { -"use strict"; -module.exports = require("node:util"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.stringToUint8Array = exports.uint8ArrayToString = exports.isWebWorker = exports.isReactNative = exports.isDeno = exports.isNode = exports.isBun = exports.isBrowser = exports.randomUUID = exports.objectHasProperty = exports.isObjectWithProperties = exports.isDefined = exports.computeSha256Hmac = exports.computeSha256Hash = exports.getErrorMessage = exports.isError = exports.isObject = exports.getRandomIntegerInclusive = exports.createAbortablePromise = exports.cancelablePromiseRace = exports.delay = void 0; +var delay_js_1 = __nccwpck_require__(9259); +Object.defineProperty(exports, "delay", ({ enumerable: true, get: function () { return delay_js_1.delay; } })); +var aborterUtils_js_1 = __nccwpck_require__(7205); +Object.defineProperty(exports, "cancelablePromiseRace", ({ enumerable: true, get: function () { return aborterUtils_js_1.cancelablePromiseRace; } })); +var createAbortablePromise_js_1 = __nccwpck_require__(2307); +Object.defineProperty(exports, "createAbortablePromise", ({ enumerable: true, get: function () { return createAbortablePromise_js_1.createAbortablePromise; } })); +var random_js_1 = __nccwpck_require__(3710); +Object.defineProperty(exports, "getRandomIntegerInclusive", ({ enumerable: true, get: function () { return random_js_1.getRandomIntegerInclusive; } })); +var object_js_1 = __nccwpck_require__(6538); +Object.defineProperty(exports, "isObject", ({ enumerable: true, get: function () { return object_js_1.isObject; } })); +var error_js_1 = __nccwpck_require__(6734); +Object.defineProperty(exports, "isError", ({ enumerable: true, get: function () { return error_js_1.isError; } })); +Object.defineProperty(exports, "getErrorMessage", ({ enumerable: true, get: function () { return error_js_1.getErrorMessage; } })); +var sha256_js_1 = __nccwpck_require__(4793); +Object.defineProperty(exports, "computeSha256Hash", ({ enumerable: true, get: function () { return sha256_js_1.computeSha256Hash; } })); +Object.defineProperty(exports, "computeSha256Hmac", ({ enumerable: true, get: function () { return sha256_js_1.computeSha256Hmac; } })); +var typeGuards_js_1 = __nccwpck_require__(1187); +Object.defineProperty(exports, "isDefined", ({ enumerable: true, get: function () { return typeGuards_js_1.isDefined; } })); +Object.defineProperty(exports, "isObjectWithProperties", ({ enumerable: true, get: function () { return typeGuards_js_1.isObjectWithProperties; } })); +Object.defineProperty(exports, "objectHasProperty", ({ enumerable: true, get: function () { return typeGuards_js_1.objectHasProperty; } })); +var uuidUtils_js_1 = __nccwpck_require__(7658); +Object.defineProperty(exports, "randomUUID", ({ enumerable: true, get: function () { return uuidUtils_js_1.randomUUID; } })); +var checkEnvironment_js_1 = __nccwpck_require__(7980); +Object.defineProperty(exports, "isBrowser", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isBrowser; } })); +Object.defineProperty(exports, "isBun", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isBun; } })); +Object.defineProperty(exports, "isNode", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isNode; } })); +Object.defineProperty(exports, "isDeno", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isDeno; } })); +Object.defineProperty(exports, "isReactNative", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isReactNative; } })); +Object.defineProperty(exports, "isWebWorker", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isWebWorker; } })); +var bytesEncoding_js_1 = __nccwpck_require__(9972); +Object.defineProperty(exports, "uint8ArrayToString", ({ enumerable: true, get: function () { return bytesEncoding_js_1.uint8ArrayToString; } })); +Object.defineProperty(exports, "stringToUint8Array", ({ enumerable: true, get: function () { return bytesEncoding_js_1.stringToUint8Array; } })); +//# sourceMappingURL=index.js.map /***/ }), -/***/ 2037: -/***/ ((module) => { +/***/ 6538: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("os"); -/***/ }), - -/***/ 1017: -/***/ ((module) => { - -"use strict"; -module.exports = require("path"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.isObject = void 0; +/** + * Helper to determine when an input is a generic JS object. + * @returns true when input is an object type that is not null, Array, RegExp, or Date. + */ +function isObject(input) { + return (typeof input === "object" && + input !== null && + !Array.isArray(input) && + !(input instanceof RegExp) && + !(input instanceof Date)); +} +exports.isObject = isObject; +//# sourceMappingURL=object.js.map /***/ }), -/***/ 4074: -/***/ ((module) => { +/***/ 3710: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("perf_hooks"); - -/***/ }), -/***/ 5477: -/***/ ((module) => { - -"use strict"; -module.exports = require("punycode"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getRandomIntegerInclusive = void 0; +/** + * Returns a random integer value between a lower and upper bound, + * inclusive of both bounds. + * Note that this uses Math.random and isn't secure. If you need to use + * this for any kind of security purpose, find a better source of random. + * @param min - The smallest integer value allowed. + * @param max - The largest integer value allowed. + */ +function getRandomIntegerInclusive(min, max) { + // Make sure inputs are integers. + min = Math.ceil(min); + max = Math.floor(max); + // Pick a random offset from zero to the size of the range. + // Since Math.random() can never return 1, we have to make the range one larger + // in order to be inclusive of the maximum value after we take the floor. + const offset = Math.floor(Math.random() * (max - min + 1)); + return offset + min; +} +exports.getRandomIntegerInclusive = getRandomIntegerInclusive; +//# sourceMappingURL=random.js.map /***/ }), -/***/ 3477: -/***/ ((module) => { +/***/ 4793: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("querystring"); - -/***/ }), - -/***/ 2781: -/***/ ((module) => { -"use strict"; -module.exports = require("stream"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.computeSha256Hash = exports.computeSha256Hmac = void 0; +const crypto_1 = __nccwpck_require__(6113); +/** + * Generates a SHA-256 HMAC signature. + * @param key - The HMAC key represented as a base64 string, used to generate the cryptographic HMAC hash. + * @param stringToSign - The data to be signed. + * @param encoding - The textual encoding to use for the returned HMAC digest. + */ +async function computeSha256Hmac(key, stringToSign, encoding) { + const decodedKey = Buffer.from(key, "base64"); + return (0, crypto_1.createHmac)("sha256", decodedKey).update(stringToSign).digest(encoding); +} +exports.computeSha256Hmac = computeSha256Hmac; +/** + * Generates a SHA-256 hash. + * @param content - The data to be included in the hash. + * @param encoding - The textual encoding to use for the returned hash. + */ +async function computeSha256Hash(content, encoding) { + return (0, crypto_1.createHash)("sha256").update(content).digest(encoding); +} +exports.computeSha256Hash = computeSha256Hash; +//# sourceMappingURL=sha256.js.map /***/ }), -/***/ 5356: -/***/ ((module) => { +/***/ 1187: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("stream/web"); - -/***/ }), - -/***/ 1576: -/***/ ((module) => { -"use strict"; -module.exports = require("string_decoder"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.objectHasProperty = exports.isObjectWithProperties = exports.isDefined = void 0; +/** + * Helper TypeGuard that checks if something is defined or not. + * @param thing - Anything + */ +function isDefined(thing) { + return typeof thing !== "undefined" && thing !== null; +} +exports.isDefined = isDefined; +/** + * Helper TypeGuard that checks if the input is an object with the specified properties. + * @param thing - Anything. + * @param properties - The name of the properties that should appear in the object. + */ +function isObjectWithProperties(thing, properties) { + if (!isDefined(thing) || typeof thing !== "object") { + return false; + } + for (const property of properties) { + if (!objectHasProperty(thing, property)) { + return false; + } + } + return true; +} +exports.isObjectWithProperties = isObjectWithProperties; +/** + * Helper TypeGuard that checks if the input is an object with the specified property. + * @param thing - Any object. + * @param property - The name of the property that should appear in the object. + */ +function objectHasProperty(thing, property) { + return (isDefined(thing) && typeof thing === "object" && property in thing); +} +exports.objectHasProperty = objectHasProperty; +//# sourceMappingURL=typeGuards.js.map /***/ }), -/***/ 9512: -/***/ ((module) => { +/***/ 7658: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("timers"); - -/***/ }), - -/***/ 4404: -/***/ ((module) => { -"use strict"; -module.exports = require("tls"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.randomUUID = void 0; +const crypto_1 = __nccwpck_require__(6113); +// NOTE: This is a workaround until we can use `globalThis.crypto.randomUUID` in Node.js 19+. +const uuidFunction = typeof globalThis?.crypto?.randomUUID === "function" + ? globalThis.crypto.randomUUID.bind(globalThis.crypto) + : crypto_1.randomUUID; +/** + * Generated Universally Unique Identifier + * + * @returns RFC4122 v4 UUID. + */ +function randomUUID() { + return uuidFunction(); +} +exports.randomUUID = randomUUID; +//# sourceMappingURL=uuidUtils.js.map /***/ }), -/***/ 7310: -/***/ ((module) => { +/***/ 2118: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = require("url"); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AbortError = void 0; +/** + * This error is thrown when an asynchronous operation has been aborted. + * Check for this error by testing the `name` that the name property of the + * error matches `"AbortError"`. + * + * @example + * ```ts + * const controller = new AbortController(); + * controller.abort(); + * try { + * doAsyncWork(controller.signal) + * } catch (e) { + * if (e.name === 'AbortError') { + * // handle abort error here. + * } + * } + * ``` + */ +class AbortError extends Error { + constructor(message) { + super(message); + this.name = "AbortError"; + } +} +exports.AbortError = AbortError; +//# sourceMappingURL=AbortError.js.map /***/ }), -/***/ 3837: -/***/ ((module) => { +/***/ 4812: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("util"); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AbortError = void 0; +var AbortError_js_1 = __nccwpck_require__(2118); +Object.defineProperty(exports, "AbortError", ({ enumerable: true, get: function () { return AbortError_js_1.AbortError; } })); +//# sourceMappingURL=index.js.map /***/ }), -/***/ 9830: -/***/ ((module) => { +/***/ 162: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("util/types"); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +const log_js_1 = __nccwpck_require__(8898); +const debugEnvVariable = (typeof process !== "undefined" && process.env && process.env.DEBUG) || undefined; +let enabledString; +let enabledNamespaces = []; +let skippedNamespaces = []; +const debuggers = []; +if (debugEnvVariable) { + enable(debugEnvVariable); +} +const debugObj = Object.assign((namespace) => { + return createDebugger(namespace); +}, { + enable, + enabled, + disable, + log: log_js_1.log, +}); +function enable(namespaces) { + enabledString = namespaces; + enabledNamespaces = []; + skippedNamespaces = []; + const wildcard = /\*/g; + const namespaceList = namespaces.split(",").map((ns) => ns.trim().replace(wildcard, ".*?")); + for (const ns of namespaceList) { + if (ns.startsWith("-")) { + skippedNamespaces.push(new RegExp(`^${ns.substr(1)}$`)); + } + else { + enabledNamespaces.push(new RegExp(`^${ns}$`)); + } + } + for (const instance of debuggers) { + instance.enabled = enabled(instance.namespace); + } +} +function enabled(namespace) { + if (namespace.endsWith("*")) { + return true; + } + for (const skipped of skippedNamespaces) { + if (skipped.test(namespace)) { + return false; + } + } + for (const enabledNamespace of enabledNamespaces) { + if (enabledNamespace.test(namespace)) { + return true; + } + } + return false; +} +function disable() { + const result = enabledString || ""; + enable(""); + return result; +} +function createDebugger(namespace) { + const newDebugger = Object.assign(debug, { + enabled: enabled(namespace), + destroy, + log: debugObj.log, + namespace, + extend, + }); + function debug(...args) { + if (!newDebugger.enabled) { + return; + } + if (args.length > 0) { + args[0] = `${namespace} ${args[0]}`; + } + newDebugger.log(...args); + } + debuggers.push(newDebugger); + return newDebugger; +} +function destroy() { + const index = debuggers.indexOf(this); + if (index >= 0) { + debuggers.splice(index, 1); + return true; + } + return false; +} +function extend(namespace) { + const newDebugger = createDebugger(`${this.namespace}:${namespace}`); + newDebugger.log = this.log; + return newDebugger; +} +exports["default"] = debugObj; +//# sourceMappingURL=debug.js.map /***/ }), -/***/ 1267: -/***/ ((module) => { +/***/ 9497: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("worker_threads"); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createClientLogger = exports.getLogLevel = exports.setLogLevel = exports.AzureLogger = void 0; +const tslib_1 = __nccwpck_require__(4351); +const debug_js_1 = tslib_1.__importDefault(__nccwpck_require__(162)); +const registeredLoggers = new Set(); +const logLevelFromEnv = (typeof process !== "undefined" && process.env && process.env.AZURE_LOG_LEVEL) || undefined; +let azureLogLevel; +/** + * The AzureLogger provides a mechanism for overriding where logs are output to. + * By default, logs are sent to stderr. + * Override the `log` method to redirect logs to another location. + */ +exports.AzureLogger = (0, debug_js_1.default)("azure"); +exports.AzureLogger.log = (...args) => { + debug_js_1.default.log(...args); +}; +const AZURE_LOG_LEVELS = ["verbose", "info", "warning", "error"]; +if (logLevelFromEnv) { + // avoid calling setLogLevel because we don't want a mis-set environment variable to crash + if (isAzureLogLevel(logLevelFromEnv)) { + setLogLevel(logLevelFromEnv); + } + else { + console.error(`AZURE_LOG_LEVEL set to unknown log level '${logLevelFromEnv}'; logging is not enabled. Acceptable values: ${AZURE_LOG_LEVELS.join(", ")}.`); + } +} +/** + * Immediately enables logging at the specified log level. If no level is specified, logging is disabled. + * @param level - The log level to enable for logging. + * Options from most verbose to least verbose are: + * - verbose + * - info + * - warning + * - error + */ +function setLogLevel(level) { + if (level && !isAzureLogLevel(level)) { + throw new Error(`Unknown log level '${level}'. Acceptable values: ${AZURE_LOG_LEVELS.join(",")}`); + } + azureLogLevel = level; + const enabledNamespaces = []; + for (const logger of registeredLoggers) { + if (shouldEnable(logger)) { + enabledNamespaces.push(logger.namespace); + } + } + debug_js_1.default.enable(enabledNamespaces.join(",")); +} +exports.setLogLevel = setLogLevel; +/** + * Retrieves the currently specified log level. + */ +function getLogLevel() { + return azureLogLevel; +} +exports.getLogLevel = getLogLevel; +const levelMap = { + verbose: 400, + info: 300, + warning: 200, + error: 100, +}; +/** + * Creates a logger for use by the Azure SDKs that inherits from `AzureLogger`. + * @param namespace - The name of the SDK package. + * @hidden + */ +function createClientLogger(namespace) { + const clientRootLogger = exports.AzureLogger.extend(namespace); + patchLogMethod(exports.AzureLogger, clientRootLogger); + return { + error: createLogger(clientRootLogger, "error"), + warning: createLogger(clientRootLogger, "warning"), + info: createLogger(clientRootLogger, "info"), + verbose: createLogger(clientRootLogger, "verbose"), + }; +} +exports.createClientLogger = createClientLogger; +function patchLogMethod(parent, child) { + child.log = (...args) => { + parent.log(...args); + }; +} +function createLogger(parent, level) { + const logger = Object.assign(parent.extend(level), { + level, + }); + patchLogMethod(parent, logger); + if (shouldEnable(logger)) { + const enabledNamespaces = debug_js_1.default.disable(); + debug_js_1.default.enable(enabledNamespaces + "," + logger.namespace); + } + registeredLoggers.add(logger); + return logger; +} +function shouldEnable(logger) { + return Boolean(azureLogLevel && levelMap[logger.level] <= levelMap[azureLogLevel]); +} +function isAzureLogLevel(logLevel) { + return AZURE_LOG_LEVELS.includes(logLevel); +} +//# sourceMappingURL=index.js.map /***/ }), -/***/ 9796: -/***/ ((module) => { +/***/ 8898: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; -module.exports = require("zlib"); + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.log = void 0; +const tslib_1 = __nccwpck_require__(4351); +const node_os_1 = __nccwpck_require__(612); +const node_util_1 = tslib_1.__importDefault(__nccwpck_require__(7261)); +const process = tslib_1.__importStar(__nccwpck_require__(7742)); +function log(message, ...args) { + process.stderr.write(`${node_util_1.default.format(message, ...args)}${node_os_1.EOL}`); +} +exports.log = log; +//# sourceMappingURL=log.js.map /***/ }), @@ -85077,7 +85472,7 @@ Dicer.prototype._write = function (data, encoding, cb) { if (this._headerFirst && this._isPreamble) { if (!this._part) { this._part = new PartStream(this._partOpts) - if (this._events.preamble) { this.emit('preamble', this._part) } else { this._ignore() } + if (this.listenerCount('preamble') !== 0) { this.emit('preamble', this._part) } else { this._ignore() } } const r = this._hparser.push(data) if (!this._inHeader && r !== undefined && r < data.length) { data = data.slice(r) } else { return cb() } @@ -85134,7 +85529,7 @@ Dicer.prototype._oninfo = function (isMatch, data, start, end) { } } if (this._dashes === 2) { - if ((start + i) < end && this._events.trailer) { this.emit('trailer', data.slice(start + i, end)) } + if ((start + i) < end && this.listenerCount('trailer') !== 0) { this.emit('trailer', data.slice(start + i, end)) } this.reset() this._finished = true // no more parts will be added @@ -85152,7 +85547,13 @@ Dicer.prototype._oninfo = function (isMatch, data, start, end) { this._part._read = function (n) { self._unpause() } - if (this._isPreamble && this._events.preamble) { this.emit('preamble', this._part) } else if (this._isPreamble !== true && this._events.part) { this.emit('part', this._part) } else { this._ignore() } + if (this._isPreamble && this.listenerCount('preamble') !== 0) { + this.emit('preamble', this._part) + } else if (this._isPreamble !== true && this.listenerCount('part') !== 0) { + this.emit('part', this._part) + } else { + this._ignore() + } if (!this._isPreamble) { this._inHeader = true } } if (data && start < end && !this._ignoreData) { @@ -85835,7 +86236,7 @@ function Multipart (boy, cfg) { ++nfiles - if (!boy._events.file) { + if (boy.listenerCount('file') === 0) { self.parser._ignore() return } @@ -86364,7 +86765,7 @@ const decoders = { if (textDecoders.has(this.toString())) { try { return textDecoders.get(this).decode(data) - } catch (e) { } + } catch {} } return typeof data === 'string' ? data diff --git a/package-lock.json b/package-lock.json index 381695b..2936697 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "devDependencies": { "@vercel/ncc": "^0.38.1", "linefix": "^0.1.1", - "typescript": "5.3.3" + "typescript": "5.4.3" }, "funding": { "url": "https://github.com/sponsors/Swatinem" @@ -111,9 +111,9 @@ } }, "node_modules/@actions/http-client": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.0.tgz", - "integrity": "sha512-q+epW0trjVUUHboliPb4UF9g2msf+w61b32tAkFEwL/IwP0DQWgbCMM0Hbe3e3WXSKz5VcUXbzJQgy8Hkra/Lg==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.1.tgz", + "integrity": "sha512-KhC/cZsq7f8I4LfZSJKgCvEwfkE8o1538VoBeoGzokVLLnbFDEAdFD3UhoMklxo2un9NJVBdANOresx7vTHlHw==", "dependencies": { "tunnel": "^0.0.6", "undici": "^5.25.4" @@ -136,24 +136,24 @@ } }, "node_modules/@azure/core-auth": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.6.0.tgz", - "integrity": "sha512-3X9wzaaGgRaBCwhLQZDtFp5uLIXCPrGbwJNWPPugvL4xbIGgScv77YzzxToKGLAKvG9amDoofMoP+9hsH1vs1w==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.7.1.tgz", + "integrity": "sha512-dyeQwvgthqs/SlPVQbZQetpslXceHd4i5a7M/7z/lGEAVwnSluabnQOjF2/dk/hhWgMISusv1Ytp4mQ8JNy62A==", "dependencies": { "@azure/abort-controller": "^2.0.0", "@azure/core-util": "^1.1.0", - "tslib": "^2.2.0" + "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } }, "node_modules/@azure/core-auth/node_modules/@azure/abort-controller": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.0.0.tgz", - "integrity": "sha512-RP/mR/WJchR+g+nQFJGOec+nzeN/VvjlwbinccoqfhTsTHbb8X5+mLDp48kHT0ueyum0BNSwGm0kX0UZuIqTGg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.1.tgz", + "integrity": "sha512-NhzeNm5zu2fPlwGXPUjzsRCRuPx5demaZyNcyNYJDqpa/Sbxzvo/RYt9IwUaAOnDW5+r7J9UOE6f22TQnb9nhQ==", "dependencies": { - "tslib": "^2.2.0" + "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" @@ -205,39 +205,39 @@ } }, "node_modules/@azure/core-lro": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.6.0.tgz", - "integrity": "sha512-PyRNcaIOfMgoUC01/24NoG+k8O81VrKxYARnDlo+Q2xji0/0/j2nIt8BwQh294pb1c5QnXTDPbNR4KzoDKXEoQ==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.7.1.tgz", + "integrity": "sha512-kXSlrNHOCTVZMxpXNRqzgh9/j4cnNXU5Hf2YjMyjddRhCXFiFRzmNaqwN+XO9rGTsCOIaaG7M67zZdyliXZG9g==", "dependencies": { "@azure/abort-controller": "^2.0.0", "@azure/core-util": "^1.2.0", "@azure/logger": "^1.0.0", - "tslib": "^2.2.0" + "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } }, "node_modules/@azure/core-lro/node_modules/@azure/abort-controller": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.0.0.tgz", - "integrity": "sha512-RP/mR/WJchR+g+nQFJGOec+nzeN/VvjlwbinccoqfhTsTHbb8X5+mLDp48kHT0ueyum0BNSwGm0kX0UZuIqTGg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.1.tgz", + "integrity": "sha512-NhzeNm5zu2fPlwGXPUjzsRCRuPx5demaZyNcyNYJDqpa/Sbxzvo/RYt9IwUaAOnDW5+r7J9UOE6f22TQnb9nhQ==", "dependencies": { - "tslib": "^2.2.0" + "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } }, "node_modules/@azure/core-paging": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.5.0.tgz", - "integrity": "sha512-zqWdVIt+2Z+3wqxEOGzR5hXFZ8MGKK52x4vFLw8n58pR6ZfKRx3EXYTxTaYxYHc/PexPUTyimcTWFJbji9Z6Iw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.6.1.tgz", + "integrity": "sha512-3tKIQXSU3mlN+ITz0m2pXLnKK3oQ6/EVcW8ud011Iq+M0rx6Wnm7NUEpoMeOAEedeKlPtemrQzO6YWoDR71O5w==", "dependencies": { - "tslib": "^2.2.0" + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18.0.0" } }, "node_modules/@azure/core-tracing": { @@ -253,37 +253,37 @@ } }, "node_modules/@azure/core-util": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.7.0.tgz", - "integrity": "sha512-Zq2i3QO6k9DA8vnm29mYM4G8IE9u1mhF1GUabVEqPNX8Lj833gdxQ2NAFxt2BZsfAL+e9cT8SyVN7dFVJ/Hf0g==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.8.1.tgz", + "integrity": "sha512-L3voj0StUdJ+YKomvwnTv7gHzguJO+a6h30pmmZdRprJCM+RJlGMPxzuh4R7lhQu1jNmEtaHX5wvTgWLDAmbGQ==", "dependencies": { "@azure/abort-controller": "^2.0.0", - "tslib": "^2.2.0" + "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } }, "node_modules/@azure/core-util/node_modules/@azure/abort-controller": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.0.0.tgz", - "integrity": "sha512-RP/mR/WJchR+g+nQFJGOec+nzeN/VvjlwbinccoqfhTsTHbb8X5+mLDp48kHT0ueyum0BNSwGm0kX0UZuIqTGg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.1.tgz", + "integrity": "sha512-NhzeNm5zu2fPlwGXPUjzsRCRuPx5demaZyNcyNYJDqpa/Sbxzvo/RYt9IwUaAOnDW5+r7J9UOE6f22TQnb9nhQ==", "dependencies": { - "tslib": "^2.2.0" + "tslib": "^2.6.2" }, "engines": { "node": ">=18.0.0" } }, "node_modules/@azure/logger": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.0.4.tgz", - "integrity": "sha512-ustrPY8MryhloQj7OWGe+HrYx+aoiOxzbXTtgblbV3xwCqpzUK36phH3XNHQKj3EPonyFUuDTfR3qFhTEAuZEg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.1.1.tgz", + "integrity": "sha512-/+4TtokaGgC+MnThdf6HyIH9Wrjp+CnCn3Nx3ggevN7FFjjNyjqg0yLlc2i9S+Z2uAzI8GYOo35Nzb1MhQ89MA==", "dependencies": { - "tslib": "^2.2.0" + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=18.0.0" } }, "node_modules/@azure/ms-rest-js": { @@ -333,25 +333,25 @@ } }, "node_modules/@fastify/busboy": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", - "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", "engines": { "node": ">=14" } }, "node_modules/@opentelemetry/api": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.7.0.tgz", - "integrity": "sha512-AdY5wvN0P2vXBi3b29hxZgSFvdhdxPB9+f0B6s//P9Q8nibRWeA3cHm8UmLpio9ABigkVHJ5NMPk+Mz8VCCyrw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", + "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==", "engines": { "node": ">=8.0.0" } }, "node_modules/@types/node": { - "version": "20.11.16", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.16.tgz", - "integrity": "sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ==", + "version": "20.11.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.30.tgz", + "integrity": "sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==", "dependencies": { "undici-types": "~5.26.4" } @@ -585,9 +585,9 @@ } }, "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz", + "integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -598,9 +598,9 @@ } }, "node_modules/undici": { - "version": "5.28.2", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.2.tgz", - "integrity": "sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==", + "version": "5.28.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", + "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", "dependencies": { "@fastify/busboy": "^2.0.0" }, diff --git a/package.json b/package.json index bea1b01..bb27b82 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "devDependencies": { "@vercel/ncc": "^0.38.1", "linefix": "^0.1.1", - "typescript": "5.3.3" + "typescript": "5.4.3" }, "scripts": { "prepare": "ncc build --target es2020 -o dist/restore src/restore.ts && ncc build --target es2020 -o dist/save src/save.ts && linefix dist"