1 |
- {"version":3,"sources":["fake","vs/loader.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"loader.js","sourcesContent":["/*!-----------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Version: 0.20.0(6363745c0a33c27b149b89342a7b96d354fb554c)\n * Released under the MIT license\n * https://github.com/Microsoft/vscode/blob/master/LICENSE.txt\n *-----------------------------------------------------------*/\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n'use strict';\r\n/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n/*---------------------------------------------------------------------------------------------\r\n *---------------------------------------------------------------------------------------------\r\n *---------------------------------------------------------------------------------------------\r\n *---------------------------------------------------------------------------------------------\r\n *---------------------------------------------------------------------------------------------\r\n * Please make sure to make edits in the .ts file at https://github.com/Microsoft/vscode-loader/\r\n *---------------------------------------------------------------------------------------------\r\n *---------------------------------------------------------------------------------------------\r\n *---------------------------------------------------------------------------------------------\r\n *---------------------------------------------------------------------------------------------\r\n *--------------------------------------------------------------------------------------------*/\r\nvar _amdLoaderGlobal = this;\r\nvar _commonjsGlobal = typeof global === 'object' ? global : {};\r\nvar AMDLoader;\r\n(function (AMDLoader) {\r\n AMDLoader.global = _amdLoaderGlobal;\r\n var Environment = /** @class */ (function () {\r\n function Environment() {\r\n this._detected = false;\r\n this._isWindows = false;\r\n this._isNode = false;\r\n this._isElectronRenderer = false;\r\n this._isWebWorker = false;\r\n }\r\n Object.defineProperty(Environment.prototype, \"isWindows\", {\r\n get: function () {\r\n this._detect();\r\n return this._isWindows;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Environment.prototype, \"isNode\", {\r\n get: function () {\r\n this._detect();\r\n return this._isNode;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Environment.prototype, \"isElectronRenderer\", {\r\n get: function () {\r\n this._detect();\r\n return this._isElectronRenderer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Environment.prototype, \"isWebWorker\", {\r\n get: function () {\r\n this._detect();\r\n return this._isWebWorker;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Environment.prototype._detect = function () {\r\n if (this._detected) {\r\n return;\r\n }\r\n this._detected = true;\r\n this._isWindows = Environment._isWindows();\r\n this._isNode = (typeof module !== 'undefined' && !!module.exports);\r\n this._isElectronRenderer = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions.electron !== 'undefined' && process.type === 'renderer');\r\n this._isWebWorker = (typeof AMDLoader.global.importScripts === 'function');\r\n };\r\n Environment._isWindows = function () {\r\n if (typeof navigator !== 'undefined') {\r\n if (navigator.userAgent && navigator.userAgent.indexOf('Windows') >= 0) {\r\n return true;\r\n }\r\n }\r\n if (typeof process !== 'undefined') {\r\n return (process.platform === 'win32');\r\n }\r\n return false;\r\n };\r\n return Environment;\r\n }());\r\n AMDLoader.Environment = Environment;\r\n})(AMDLoader || (AMDLoader = {}));\r\n/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar AMDLoader;\r\n(function (AMDLoader) {\r\n var LoaderEvent = /** @class */ (function () {\r\n function LoaderEvent(type, detail, timestamp) {\r\n this.type = type;\r\n this.detail = detail;\r\n this.timestamp = timestamp;\r\n }\r\n return LoaderEvent;\r\n }());\r\n AMDLoader.LoaderEvent = LoaderEvent;\r\n var LoaderEventRecorder = /** @class */ (function () {\r\n function LoaderEventRecorder(loaderAvailableTimestamp) {\r\n this._events = [new LoaderEvent(1 /* LoaderAvailable */, '', loaderAvailableTimestamp)];\r\n }\r\n LoaderEventRecorder.prototype.record = function (type, detail) {\r\n this._events.push(new LoaderEvent(type, detail, AMDLoader.Utilities.getHighPerformanceTimestamp()));\r\n };\r\n LoaderEventRecorder.prototype.getEvents = function () {\r\n return this._events;\r\n };\r\n return LoaderEventRecorder;\r\n }());\r\n AMDLoader.LoaderEventRecorder = LoaderEventRecorder;\r\n var NullLoaderEventRecorder = /** @class */ (function () {\r\n function NullLoaderEventRecorder() {\r\n }\r\n NullLoaderEventRecorder.prototype.record = function (type, detail) {\r\n // Nothing to do\r\n };\r\n NullLoaderEventRecorder.prototype.getEvents = function () {\r\n return [];\r\n };\r\n NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder();\r\n return NullLoaderEventRecorder;\r\n }());\r\n AMDLoader.NullLoaderEventRecorder = NullLoaderEventRecorder;\r\n})(AMDLoader || (AMDLoader = {}));\r\n/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar AMDLoader;\r\n(function (AMDLoader) {\r\n var Utilities = /** @class */ (function () {\r\n function Utilities() {\r\n }\r\n /**\r\n * This method does not take care of / vs \\\r\n */\r\n Utilities.fileUriToFilePath = function (isWindows, uri) {\r\n uri = decodeURI(uri).replace(/%23/g, '#');\r\n if (isWindows) {\r\n if (/^file:\\/\\/\\//.test(uri)) {\r\n // This is a URI without a hostname => return only the path segment\r\n return uri.substr(8);\r\n }\r\n if (/^file:\\/\\//.test(uri)) {\r\n return uri.substr(5);\r\n }\r\n }\r\n else {\r\n if (/^file:\\/\\//.test(uri)) {\r\n return uri.substr(7);\r\n }\r\n }\r\n // Not sure...\r\n return uri;\r\n };\r\n Utilities.startsWith = function (haystack, needle) {\r\n return haystack.length >= needle.length && haystack.substr(0, needle.length) === needle;\r\n };\r\n Utilities.endsWith = function (haystack, needle) {\r\n return haystack.length >= needle.length && haystack.substr(haystack.length - needle.length) === needle;\r\n };\r\n // only check for \"?\" before \"#\" to ensure that there is a real Query-String\r\n Utilities.containsQueryString = function (url) {\r\n return /^[^\\#]*\\?/gi.test(url);\r\n };\r\n /**\r\n * Does `url` start with http:// or https:// or file:// or / ?\r\n */\r\n Utilities.isAbsolutePath = function (url) {\r\n return /^((http:\\/\\/)|(https:\\/\\/)|(file:\\/\\/)|(\\/))/.test(url);\r\n };\r\n Utilities.forEachProperty = function (obj, callback) {\r\n if (obj) {\r\n var key = void 0;\r\n for (key in obj) {\r\n if (obj.hasOwnProperty(key)) {\r\n callback(key, obj[key]);\r\n }\r\n }\r\n }\r\n };\r\n Utilities.isEmpty = function (obj) {\r\n var isEmpty = true;\r\n Utilities.forEachProperty(obj, function () {\r\n isEmpty = false;\r\n });\r\n return isEmpty;\r\n };\r\n Utilities.recursiveClone = function (obj) {\r\n if (!obj || typeof obj !== 'object') {\r\n return obj;\r\n }\r\n var result = Array.isArray(obj) ? [] : {};\r\n Utilities.forEachProperty(obj, function (key, value) {\r\n if (value && typeof value === 'object') {\r\n result[key] = Utilities.recursiveClone(value);\r\n }\r\n else {\r\n result[key] = value;\r\n }\r\n });\r\n return result;\r\n };\r\n Utilities.generateAnonymousModule = function () {\r\n return '===anonymous' + (Utilities.NEXT_ANONYMOUS_ID++) + '===';\r\n };\r\n Utilities.isAnonymousModule = function (id) {\r\n return Utilities.startsWith(id, '===anonymous');\r\n };\r\n Utilities.getHighPerformanceTimestamp = function () {\r\n if (!this.PERFORMANCE_NOW_PROBED) {\r\n this.PERFORMANCE_NOW_PROBED = true;\r\n this.HAS_PERFORMANCE_NOW = (AMDLoader.global.performance && typeof AMDLoader.global.performance.now === 'function');\r\n }\r\n return (this.HAS_PERFORMANCE_NOW ? AMDLoader.global.performance.now() : Date.now());\r\n };\r\n Utilities.NEXT_ANONYMOUS_ID = 1;\r\n Utilities.PERFORMANCE_NOW_PROBED = false;\r\n Utilities.HAS_PERFORMANCE_NOW = false;\r\n return Utilities;\r\n }());\r\n AMDLoader.Utilities = Utilities;\r\n})(AMDLoader || (AMDLoader = {}));\r\n/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar AMDLoader;\r\n(function (AMDLoader) {\r\n function ensureError(err) {\r\n if (err instanceof Error) {\r\n return err;\r\n }\r\n var result = new Error(err.message || String(err) || 'Unknown Error');\r\n if (err.stack) {\r\n result.stack = err.stack;\r\n }\r\n return result;\r\n }\r\n AMDLoader.ensureError = ensureError;\r\n ;\r\n var ConfigurationOptionsUtil = /** @class */ (function () {\r\n function ConfigurationOptionsUtil() {\r\n }\r\n /**\r\n * Ensure configuration options make sense\r\n */\r\n ConfigurationOptionsUtil.validateConfigurationOptions = function (options) {\r\n function defaultOnError(err) {\r\n if (err.phase === 'loading') {\r\n console.error('Loading \"' + err.moduleId + '\" failed');\r\n console.error(err);\r\n console.error('Here are the modules that depend on it:');\r\n console.error(err.neededBy);\r\n return;\r\n }\r\n if (err.phase === 'factory') {\r\n console.error('The factory method of \"' + err.moduleId + '\" has thrown an exception');\r\n console.error(err);\r\n return;\r\n }\r\n }\r\n options = options || {};\r\n if (typeof options.baseUrl !== 'string') {\r\n options.baseUrl = '';\r\n }\r\n if (typeof options.isBuild !== 'boolean') {\r\n options.isBuild = false;\r\n }\r\n if (typeof options.paths !== 'object') {\r\n options.paths = {};\r\n }\r\n if (typeof options.config !== 'object') {\r\n options.config = {};\r\n }\r\n if (typeof options.catchError === 'undefined') {\r\n options.catchError = false;\r\n }\r\n if (typeof options.recordStats === 'undefined') {\r\n options.recordStats = false;\r\n }\r\n if (typeof options.urlArgs !== 'string') {\r\n options.urlArgs = '';\r\n }\r\n if (typeof options.onError !== 'function') {\r\n options.onError = defaultOnError;\r\n }\r\n if (!Array.isArray(options.ignoreDuplicateModules)) {\r\n options.ignoreDuplicateModules = [];\r\n }\r\n if (options.baseUrl.length > 0) {\r\n if (!AMDLoader.Utilities.endsWith(options.baseUrl, '/')) {\r\n options.baseUrl += '/';\r\n }\r\n }\r\n if (typeof options.cspNonce !== 'string') {\r\n options.cspNonce = '';\r\n }\r\n if (!Array.isArray(options.nodeModules)) {\r\n options.nodeModules = [];\r\n }\r\n if (options.nodeCachedData && typeof options.nodeCachedData === 'object') {\r\n if (typeof options.nodeCachedData.seed !== 'string') {\r\n options.nodeCachedData.seed = 'seed';\r\n }\r\n if (typeof options.nodeCachedData.writeDelay !== 'number' || options.nodeCachedData.writeDelay < 0) {\r\n options.nodeCachedData.writeDelay = 1000 * 7;\r\n }\r\n if (!options.nodeCachedData.path || typeof options.nodeCachedData.path !== 'string') {\r\n var err = ensureError(new Error('INVALID cached data configuration, \\'path\\' MUST be set'));\r\n err.phase = 'configuration';\r\n options.onError(err);\r\n options.nodeCachedData = undefined;\r\n }\r\n }\r\n return options;\r\n };\r\n ConfigurationOptionsUtil.mergeConfigurationOptions = function (overwrite, base) {\r\n if (overwrite === void 0) { overwrite = null; }\r\n if (base === void 0) { base = null; }\r\n var result = AMDLoader.Utilities.recursiveClone(base || {});\r\n // Merge known properties and overwrite the unknown ones\r\n AMDLoader.Utilities.forEachProperty(overwrite, function (key, value) {\r\n if (key === 'ignoreDuplicateModules' && typeof result.ignoreDuplicateModules !== 'undefined') {\r\n result.ignoreDuplicateModules = result.ignoreDuplicateModules.concat(value);\r\n }\r\n else if (key === 'paths' && typeof result.paths !== 'undefined') {\r\n AMDLoader.Utilities.forEachProperty(value, function (key2, value2) { return result.paths[key2] = value2; });\r\n }\r\n else if (key === 'config' && typeof result.config !== 'undefined') {\r\n AMDLoader.Utilities.forEachProperty(value, function (key2, value2) { return result.config[key2] = value2; });\r\n }\r\n else {\r\n result[key] = AMDLoader.Utilities.recursiveClone(value);\r\n }\r\n });\r\n return ConfigurationOptionsUtil.validateConfigurationOptions(result);\r\n };\r\n return ConfigurationOptionsUtil;\r\n }());\r\n AMDLoader.ConfigurationOptionsUtil = ConfigurationOptionsUtil;\r\n var Configuration = /** @class */ (function () {\r\n function Configuration(env, options) {\r\n this._env = env;\r\n this.options = ConfigurationOptionsUtil.mergeConfigurationOptions(options);\r\n this._createIgnoreDuplicateModulesMap();\r\n this._createNodeModulesMap();\r\n this._createSortedPathsRules();\r\n if (this.options.baseUrl === '') {\r\n if (this.options.nodeRequire && this.options.nodeRequire.main && this.options.nodeRequire.main.filename && this._env.isNode) {\r\n var nodeMain = this.options.nodeRequire.main.filename;\r\n var dirnameIndex = Math.max(nodeMain.lastIndexOf('/'), nodeMain.lastIndexOf('\\\\'));\r\n this.options.baseUrl = nodeMain.substring(0, dirnameIndex + 1);\r\n }\r\n if (this.options.nodeMain && this._env.isNode) {\r\n var nodeMain = this.options.nodeMain;\r\n var dirnameIndex = Math.max(nodeMain.lastIndexOf('/'), nodeMain.lastIndexOf('\\\\'));\r\n this.options.baseUrl = nodeMain.substring(0, dirnameIndex + 1);\r\n }\r\n }\r\n }\r\n Configuration.prototype._createIgnoreDuplicateModulesMap = function () {\r\n // Build a map out of the ignoreDuplicateModules array\r\n this.ignoreDuplicateModulesMap = {};\r\n for (var i = 0; i < this.options.ignoreDuplicateModules.length; i++) {\r\n this.ignoreDuplicateModulesMap[this.options.ignoreDuplicateModules[i]] = true;\r\n }\r\n };\r\n Configuration.prototype._createNodeModulesMap = function () {\r\n // Build a map out of nodeModules array\r\n this.nodeModulesMap = Object.create(null);\r\n for (var _i = 0, _a = this.options.nodeModules; _i < _a.length; _i++) {\r\n var nodeModule = _a[_i];\r\n this.nodeModulesMap[nodeModule] = true;\r\n }\r\n };\r\n Configuration.prototype._createSortedPathsRules = function () {\r\n var _this = this;\r\n // Create an array our of the paths rules, sorted descending by length to\r\n // result in a more specific -> less specific order\r\n this.sortedPathsRules = [];\r\n AMDLoader.Utilities.forEachProperty(this.options.paths, function (from, to) {\r\n if (!Array.isArray(to)) {\r\n _this.sortedPathsRules.push({\r\n from: from,\r\n to: [to]\r\n });\r\n }\r\n else {\r\n _this.sortedPathsRules.push({\r\n from: from,\r\n to: to\r\n });\r\n }\r\n });\r\n this.sortedPathsRules.sort(function (a, b) {\r\n return b.from.length - a.from.length;\r\n });\r\n };\r\n /**\r\n * Clone current configuration and overwrite options selectively.\r\n * @param options The selective options to overwrite with.\r\n * @result A new configuration\r\n */\r\n Configuration.prototype.cloneAndMerge = function (options) {\r\n return new Configuration(this._env, ConfigurationOptionsUtil.mergeConfigurationOptions(options, this.options));\r\n };\r\n /**\r\n * Get current options bag. Useful for passing it forward to plugins.\r\n */\r\n Configuration.prototype.getOptionsLiteral = function () {\r\n return this.options;\r\n };\r\n Configuration.prototype._applyPaths = function (moduleId) {\r\n var pathRule;\r\n for (var i = 0, len = this.sortedPathsRules.length; i < len; i++) {\r\n pathRule = this.sortedPathsRules[i];\r\n if (AMDLoader.Utilities.startsWith(moduleId, pathRule.from)) {\r\n var result = [];\r\n for (var j = 0, lenJ = pathRule.to.length; j < lenJ; j++) {\r\n result.push(pathRule.to[j] + moduleId.substr(pathRule.from.length));\r\n }\r\n return result;\r\n }\r\n }\r\n return [moduleId];\r\n };\r\n Configuration.prototype._addUrlArgsToUrl = function (url) {\r\n if (AMDLoader.Utilities.containsQueryString(url)) {\r\n return url + '&' + this.options.urlArgs;\r\n }\r\n else {\r\n return url + '?' + this.options.urlArgs;\r\n }\r\n };\r\n Configuration.prototype._addUrlArgsIfNecessaryToUrl = function (url) {\r\n if (this.options.urlArgs) {\r\n return this._addUrlArgsToUrl(url);\r\n }\r\n return url;\r\n };\r\n Configuration.prototype._addUrlArgsIfNecessaryToUrls = function (urls) {\r\n if (this.options.urlArgs) {\r\n for (var i = 0, len = urls.length; i < len; i++) {\r\n urls[i] = this._addUrlArgsToUrl(urls[i]);\r\n }\r\n }\r\n return urls;\r\n };\r\n /**\r\n * Transform a module id to a location. Appends .js to module ids\r\n */\r\n Configuration.prototype.moduleIdToPaths = function (moduleId) {\r\n if (this.nodeModulesMap[moduleId] === true) {\r\n // This is a node module...\r\n if (this.isBuild()) {\r\n // ...and we are at build time, drop it\r\n return ['empty:'];\r\n }\r\n else {\r\n // ...and at runtime we create a `shortcut`-path\r\n return ['node|' + moduleId];\r\n }\r\n }\r\n var result = moduleId;\r\n var results;\r\n if (!AMDLoader.Utilities.endsWith(result, '.js') && !AMDLoader.Utilities.isAbsolutePath(result)) {\r\n results = this._applyPaths(result);\r\n for (var i = 0, len = results.length; i < len; i++) {\r\n if (this.isBuild() && results[i] === 'empty:') {\r\n continue;\r\n }\r\n if (!AMDLoader.Utilities.isAbsolutePath(results[i])) {\r\n results[i] = this.options.baseUrl + results[i];\r\n }\r\n if (!AMDLoader.Utilities.endsWith(results[i], '.js') && !AMDLoader.Utilities.containsQueryString(results[i])) {\r\n results[i] = results[i] + '.js';\r\n }\r\n }\r\n }\r\n else {\r\n if (!AMDLoader.Utilities.endsWith(result, '.js') && !AMDLoader.Utilities.containsQueryString(result)) {\r\n result = result + '.js';\r\n }\r\n results = [result];\r\n }\r\n return this._addUrlArgsIfNecessaryToUrls(results);\r\n };\r\n /**\r\n * Transform a module id or url to a location.\r\n */\r\n Configuration.prototype.requireToUrl = function (url) {\r\n var result = url;\r\n if (!AMDLoader.Utilities.isAbsolutePath(result)) {\r\n result = this._applyPaths(result)[0];\r\n if (!AMDLoader.Utilities.isAbsolutePath(result)) {\r\n result = this.options.baseUrl + result;\r\n }\r\n }\r\n return this._addUrlArgsIfNecessaryToUrl(result);\r\n };\r\n /**\r\n * Flag to indicate if current execution is as part of a build.\r\n */\r\n Configuration.prototype.isBuild = function () {\r\n return this.options.isBuild;\r\n };\r\n /**\r\n * Test if module `moduleId` is expected to be defined multiple times\r\n */\r\n Configuration.prototype.isDuplicateMessageIgnoredFor = function (moduleId) {\r\n return this.ignoreDuplicateModulesMap.hasOwnProperty(moduleId);\r\n };\r\n /**\r\n * Get the configuration settings for the provided module id\r\n */\r\n Configuration.prototype.getConfigForModule = function (moduleId) {\r\n if (this.options.config) {\r\n return this.options.config[moduleId];\r\n }\r\n };\r\n /**\r\n * Should errors be caught when executing module factories?\r\n */\r\n Configuration.prototype.shouldCatchError = function () {\r\n return this.options.catchError;\r\n };\r\n /**\r\n * Should statistics be recorded?\r\n */\r\n Configuration.prototype.shouldRecordStats = function () {\r\n return this.options.recordStats;\r\n };\r\n /**\r\n * Forward an error to the error handler.\r\n */\r\n Configuration.prototype.onError = function (err) {\r\n this.options.onError(err);\r\n };\r\n return Configuration;\r\n }());\r\n AMDLoader.Configuration = Configuration;\r\n})(AMDLoader || (AMDLoader = {}));\r\n/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar AMDLoader;\r\n(function (AMDLoader) {\r\n /**\r\n * Load `scriptSrc` only once (avoid multiple <script> tags)\r\n */\r\n var OnlyOnceScriptLoader = /** @class */ (function () {\r\n function OnlyOnceScriptLoader(env) {\r\n this._env = env;\r\n this._scriptLoader = null;\r\n this._callbackMap = {};\r\n }\r\n OnlyOnceScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {\r\n var _this = this;\r\n if (!this._scriptLoader) {\r\n this._scriptLoader = (this._env.isWebWorker\r\n ? new WorkerScriptLoader()\r\n : this._env.isNode\r\n ? new NodeScriptLoader(this._env)\r\n : new BrowserScriptLoader());\r\n }\r\n var scriptCallbacks = {\r\n callback: callback,\r\n errorback: errorback\r\n };\r\n if (this._callbackMap.hasOwnProperty(scriptSrc)) {\r\n this._callbackMap[scriptSrc].push(scriptCallbacks);\r\n return;\r\n }\r\n this._callbackMap[scriptSrc] = [scriptCallbacks];\r\n this._scriptLoader.load(moduleManager, scriptSrc, function () { return _this.triggerCallback(scriptSrc); }, function (err) { return _this.triggerErrorback(scriptSrc, err); });\r\n };\r\n OnlyOnceScriptLoader.prototype.triggerCallback = function (scriptSrc) {\r\n var scriptCallbacks = this._callbackMap[scriptSrc];\r\n delete this._callbackMap[scriptSrc];\r\n for (var i = 0; i < scriptCallbacks.length; i++) {\r\n scriptCallbacks[i].callback();\r\n }\r\n };\r\n OnlyOnceScriptLoader.prototype.triggerErrorback = function (scriptSrc, err) {\r\n var scriptCallbacks = this._callbackMap[scriptSrc];\r\n delete this._callbackMap[scriptSrc];\r\n for (var i = 0; i < scriptCallbacks.length; i++) {\r\n scriptCallbacks[i].errorback(err);\r\n }\r\n };\r\n return OnlyOnceScriptLoader;\r\n }());\r\n var BrowserScriptLoader = /** @class */ (function () {\r\n function BrowserScriptLoader() {\r\n }\r\n /**\r\n * Attach load / error listeners to a script element and remove them when either one has fired.\r\n * Implemented for browssers supporting HTML5 standard 'load' and 'error' events.\r\n */\r\n BrowserScriptLoader.prototype.attachListeners = function (script, callback, errorback) {\r\n var unbind = function () {\r\n script.removeEventListener('load', loadEventListener);\r\n script.removeEventListener('error', errorEventListener);\r\n };\r\n var loadEventListener = function (e) {\r\n unbind();\r\n callback();\r\n };\r\n var errorEventListener = function (e) {\r\n unbind();\r\n errorback(e);\r\n };\r\n script.addEventListener('load', loadEventListener);\r\n script.addEventListener('error', errorEventListener);\r\n };\r\n BrowserScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {\r\n var script = document.createElement('script');\r\n script.setAttribute('async', 'async');\r\n script.setAttribute('type', 'text/javascript');\r\n this.attachListeners(script, callback, errorback);\r\n script.setAttribute('src', scriptSrc);\r\n // Propagate CSP nonce to dynamically created script tag.\r\n var cspNonce = moduleManager.getConfig().getOptionsLiteral().cspNonce;\r\n if (cspNonce) {\r\n script.setAttribute('nonce', cspNonce);\r\n }\r\n document.getElementsByTagName('head')[0].appendChild(script);\r\n };\r\n return BrowserScriptLoader;\r\n }());\r\n var WorkerScriptLoader = /** @class */ (function () {\r\n function WorkerScriptLoader() {\r\n }\r\n WorkerScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {\r\n try {\r\n importScripts(scriptSrc);\r\n callback();\r\n }\r\n catch (e) {\r\n errorback(e);\r\n }\r\n };\r\n return WorkerScriptLoader;\r\n }());\r\n var NodeScriptLoader = /** @class */ (function () {\r\n function NodeScriptLoader(env) {\r\n this._env = env;\r\n this._didInitialize = false;\r\n this._didPatchNodeRequire = false;\r\n }\r\n NodeScriptLoader.prototype._init = function (nodeRequire) {\r\n if (this._didInitialize) {\r\n return;\r\n }\r\n this._didInitialize = true;\r\n // capture node modules\r\n this._fs = nodeRequire('fs');\r\n this._vm = nodeRequire('vm');\r\n this._path = nodeRequire('path');\r\n this._crypto = nodeRequire('crypto');\r\n };\r\n // patch require-function of nodejs such that we can manually create a script\r\n // from cached data. this is done by overriding the `Module._compile` function\r\n NodeScriptLoader.prototype._initNodeRequire = function (nodeRequire, moduleManager) {\r\n // It is important to check for `nodeCachedData` first and then set `_didPatchNodeRequire`.\r\n // That's because `nodeCachedData` is set _after_ calling this for the first time...\r\n var nodeCachedData = moduleManager.getConfig().getOptionsLiteral().nodeCachedData;\r\n if (!nodeCachedData) {\r\n return;\r\n }\r\n if (this._didPatchNodeRequire) {\r\n return;\r\n }\r\n this._didPatchNodeRequire = true;\r\n var that = this;\r\n var Module = nodeRequire('module');\r\n function makeRequireFunction(mod) {\r\n var Module = mod.constructor;\r\n var require = function require(path) {\r\n try {\r\n return mod.require(path);\r\n }\r\n finally {\r\n // nothing\r\n }\r\n };\r\n require.resolve = function resolve(request) {\r\n return Module._resolveFilename(request, mod);\r\n };\r\n require.main = process.mainModule;\r\n require.extensions = Module._extensions;\r\n require.cache = Module._cache;\r\n return require;\r\n }\r\n Module.prototype._compile = function (content, filename) {\r\n // remove shebang and create wrapper function\r\n var scriptSource = Module.wrap(content.replace(/^#!.*/, ''));\r\n // create script\r\n var recorder = moduleManager.getRecorder();\r\n var cachedDataPath = that._getCachedDataPath(nodeCachedData, filename);\r\n var options = { filename: filename };\r\n var hashData;\r\n try {\r\n var data = that._fs.readFileSync(cachedDataPath);\r\n hashData = data.slice(0, 16);\r\n options.cachedData = data.slice(16);\r\n recorder.record(60 /* CachedDataFound */, cachedDataPath);\r\n }\r\n catch (_e) {\r\n recorder.record(61 /* CachedDataMissed */, cachedDataPath);\r\n }\r\n var script = new that._vm.Script(scriptSource, options);\r\n var compileWrapper = script.runInThisContext(options);\r\n // run script\r\n var dirname = that._path.dirname(filename);\r\n var require = makeRequireFunction(this);\r\n var args = [this.exports, require, this, filename, dirname, process, _commonjsGlobal, Buffer];\r\n var result = compileWrapper.apply(this.exports, args);\r\n // cached data aftermath\r\n that._handleCachedData(script, scriptSource, cachedDataPath, !options.cachedData, moduleManager);\r\n that._verifyCachedData(script, scriptSource, cachedDataPath, hashData, moduleManager);\r\n return result;\r\n };\r\n };\r\n NodeScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {\r\n var _this = this;\r\n var opts = moduleManager.getConfig().getOptionsLiteral();\r\n var nodeRequire = (opts.nodeRequire || AMDLoader.global.nodeRequire);\r\n var nodeInstrumenter = (opts.nodeInstrumenter || function (c) { return c; });\r\n this._init(nodeRequire);\r\n this._initNodeRequire(nodeRequire, moduleManager);\r\n var recorder = moduleManager.getRecorder();\r\n if (/^node\\|/.test(scriptSrc)) {\r\n var pieces = scriptSrc.split('|');\r\n var moduleExports_1 = null;\r\n try {\r\n moduleExports_1 = nodeRequire(pieces[1]);\r\n }\r\n catch (err) {\r\n errorback(err);\r\n return;\r\n }\r\n moduleManager.enqueueDefineAnonymousModule([], function () { return moduleExports_1; });\r\n callback();\r\n }\r\n else {\r\n scriptSrc = AMDLoader.Utilities.fileUriToFilePath(this._env.isWindows, scriptSrc);\r\n var normalizedScriptSrc_1 = this._path.normalize(scriptSrc);\r\n var vmScriptPathOrUri_1 = this._getElectronRendererScriptPathOrUri(normalizedScriptSrc_1);\r\n var wantsCachedData_1 = Boolean(opts.nodeCachedData);\r\n var cachedDataPath_1 = wantsCachedData_1 ? this._getCachedDataPath(opts.nodeCachedData, scriptSrc) : undefined;\r\n this._readSourceAndCachedData(normalizedScriptSrc_1, cachedDataPath_1, recorder, function (err, data, cachedData, hashData) {\r\n if (err) {\r\n errorback(err);\r\n return;\r\n }\r\n var scriptSource;\r\n if (data.charCodeAt(0) === NodeScriptLoader._BOM) {\r\n scriptSource = NodeScriptLoader._PREFIX + data.substring(1) + NodeScriptLoader._SUFFIX;\r\n }\r\n else {\r\n scriptSource = NodeScriptLoader._PREFIX + data + NodeScriptLoader._SUFFIX;\r\n }\r\n scriptSource = nodeInstrumenter(scriptSource, normalizedScriptSrc_1);\r\n var scriptOpts = { filename: vmScriptPathOrUri_1, cachedData: cachedData };\r\n var script = _this._createAndEvalScript(moduleManager, scriptSource, scriptOpts, callback, errorback);\r\n _this._handleCachedData(script, scriptSource, cachedDataPath_1, wantsCachedData_1 && !cachedData, moduleManager);\r\n _this._verifyCachedData(script, scriptSource, cachedDataPath_1, hashData, moduleManager);\r\n });\r\n }\r\n };\r\n NodeScriptLoader.prototype._createAndEvalScript = function (moduleManager, contents, options, callback, errorback) {\r\n var recorder = moduleManager.getRecorder();\r\n recorder.record(31 /* NodeBeginEvaluatingScript */, options.filename);\r\n var script = new this._vm.Script(contents, options);\r\n var ret = script.runInThisContext(options);\r\n var globalDefineFunc = moduleManager.getGlobalAMDDefineFunc();\r\n var receivedDefineCall = false;\r\n var localDefineFunc = function () {\r\n receivedDefineCall = true;\r\n return globalDefineFunc.apply(null, arguments);\r\n };\r\n localDefineFunc.amd = globalDefineFunc.amd;\r\n ret.call(AMDLoader.global, moduleManager.getGlobalAMDRequireFunc(), localDefineFunc, options.filename, this._path.dirname(options.filename));\r\n recorder.record(32 /* NodeEndEvaluatingScript */, options.filename);\r\n if (receivedDefineCall) {\r\n callback();\r\n }\r\n else {\r\n errorback(new Error(\"Didn't receive define call in \" + options.filename + \"!\"));\r\n }\r\n return script;\r\n };\r\n NodeScriptLoader.prototype._getElectronRendererScriptPathOrUri = function (path) {\r\n if (!this._env.isElectronRenderer) {\r\n return path;\r\n }\r\n var driveLetterMatch = path.match(/^([a-z])\\:(.*)/i);\r\n if (driveLetterMatch) {\r\n // windows\r\n return \"file:///\" + (driveLetterMatch[1].toUpperCase() + ':' + driveLetterMatch[2]).replace(/\\\\/g, '/');\r\n }\r\n else {\r\n // nix\r\n return \"file://\" + path;\r\n }\r\n };\r\n NodeScriptLoader.prototype._getCachedDataPath = function (config, filename) {\r\n var hash = this._crypto.createHash('md5').update(filename, 'utf8').update(config.seed, 'utf8').digest('hex');\r\n var basename = this._path.basename(filename).replace(/\\.js$/, '');\r\n return this._path.join(config.path, basename + \"-\" + hash + \".code\");\r\n };\r\n NodeScriptLoader.prototype._handleCachedData = function (script, scriptSource, cachedDataPath, createCachedData, moduleManager) {\r\n var _this = this;\r\n if (script.cachedDataRejected) {\r\n // cached data got rejected -> delete and re-create\r\n this._fs.unlink(cachedDataPath, function (err) {\r\n moduleManager.getRecorder().record(62 /* CachedDataRejected */, cachedDataPath);\r\n _this._createAndWriteCachedData(script, scriptSource, cachedDataPath, moduleManager);\r\n if (err) {\r\n moduleManager.getConfig().onError(err);\r\n }\r\n });\r\n }\r\n else if (createCachedData) {\r\n // no cached data, but wanted\r\n this._createAndWriteCachedData(script, scriptSource, cachedDataPath, moduleManager);\r\n }\r\n };\r\n // Cached data format: | SOURCE_HASH | V8_CACHED_DATA |\r\n // -SOURCE_HASH is the md5 hash of the JS source (always 16 bytes)\r\n // -V8_CACHED_DATA is what v8 produces\r\n NodeScriptLoader.prototype._createAndWriteCachedData = function (script, scriptSource, cachedDataPath, moduleManager) {\r\n var _this = this;\r\n var timeout = Math.ceil(moduleManager.getConfig().getOptionsLiteral().nodeCachedData.writeDelay * (1 + Math.random()));\r\n var lastSize = -1;\r\n var iteration = 0;\r\n var hashData = undefined;\r\n var createLoop = function () {\r\n setTimeout(function () {\r\n if (!hashData) {\r\n hashData = _this._crypto.createHash('md5').update(scriptSource, 'utf8').digest();\r\n }\r\n var cachedData = script.createCachedData();\r\n if (cachedData.length === 0 || cachedData.length === lastSize || iteration >= 5) {\r\n return;\r\n }\r\n lastSize = cachedData.length;\r\n _this._fs.writeFile(cachedDataPath, Buffer.concat([hashData, cachedData]), function (err) {\r\n if (err) {\r\n moduleManager.getConfig().onError(err);\r\n }\r\n moduleManager.getRecorder().record(63 /* CachedDataCreated */, cachedDataPath);\r\n createLoop();\r\n });\r\n }, timeout * (Math.pow(4, iteration++)));\r\n };\r\n // with some delay (`timeout`) create cached data\r\n // and repeat that (with backoff delay) until the\r\n // data seems to be not changing anymore\r\n createLoop();\r\n };\r\n NodeScriptLoader.prototype._readSourceAndCachedData = function (sourcePath, cachedDataPath, recorder, callback) {\r\n if (!cachedDataPath) {\r\n // no cached data case\r\n this._fs.readFile(sourcePath, { encoding: 'utf8' }, callback);\r\n }\r\n else {\r\n // cached data case: read both files in parallel\r\n var source_1 = undefined;\r\n var cachedData_1 = undefined;\r\n var hashData_1 = undefined;\r\n var steps_1 = 2;\r\n var step_1 = function (err) {\r\n if (err) {\r\n callback(err);\r\n }\r\n else if (--steps_1 === 0) {\r\n callback(undefined, source_1, cachedData_1, hashData_1);\r\n }\r\n };\r\n this._fs.readFile(sourcePath, { encoding: 'utf8' }, function (err, data) {\r\n source_1 = data;\r\n step_1(err);\r\n });\r\n this._fs.readFile(cachedDataPath, function (err, data) {\r\n if (!err && data && data.length > 0) {\r\n hashData_1 = data.slice(0, 16);\r\n cachedData_1 = data.slice(16);\r\n recorder.record(60 /* CachedDataFound */, cachedDataPath);\r\n }\r\n else {\r\n recorder.record(61 /* CachedDataMissed */, cachedDataPath);\r\n }\r\n step_1(); // ignored: cached data is optional\r\n });\r\n }\r\n };\r\n NodeScriptLoader.prototype._verifyCachedData = function (script, scriptSource, cachedDataPath, hashData, moduleManager) {\r\n var _this = this;\r\n if (!hashData) {\r\n // nothing to do\r\n return;\r\n }\r\n if (script.cachedDataRejected) {\r\n // invalid anyways\r\n return;\r\n }\r\n setTimeout(function () {\r\n // check source hash - the contract is that file paths change when file content\r\n // change (e.g use the commit or version id as cache path). this check is\r\n // for violations of this contract.\r\n var hashDataNow = _this._crypto.createHash('md5').update(scriptSource, 'utf8').digest();\r\n if (!hashData.equals(hashDataNow)) {\r\n moduleManager.getConfig().onError(new Error(\"FAILED TO VERIFY CACHED DATA, deleting stale '\" + cachedDataPath + \"' now, but a RESTART IS REQUIRED\"));\r\n _this._fs.unlink(cachedDataPath, function (err) { return moduleManager.getConfig().onError(err); });\r\n }\r\n }, Math.ceil(5000 * (1 + Math.random())));\r\n };\r\n NodeScriptLoader._BOM = 0xFEFF;\r\n NodeScriptLoader._PREFIX = '(function (require, define, __filename, __dirname) { ';\r\n NodeScriptLoader._SUFFIX = '\\n});';\r\n return NodeScriptLoader;\r\n }());\r\n function createScriptLoader(env) {\r\n return new OnlyOnceScriptLoader(env);\r\n }\r\n AMDLoader.createScriptLoader = createScriptLoader;\r\n})(AMDLoader || (AMDLoader = {}));\r\n/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nvar AMDLoader;\r\n(function (AMDLoader) {\r\n // ------------------------------------------------------------------------\r\n // ModuleIdResolver\r\n var ModuleIdResolver = /** @class */ (function () {\r\n function ModuleIdResolver(fromModuleId) {\r\n var lastSlash = fromModuleId.lastIndexOf('/');\r\n if (lastSlash !== -1) {\r\n this.fromModulePath = fromModuleId.substr(0, lastSlash + 1);\r\n }\r\n else {\r\n this.fromModulePath = '';\r\n }\r\n }\r\n /**\r\n * Normalize 'a/../name' to 'name', etc.\r\n */\r\n ModuleIdResolver._normalizeModuleId = function (moduleId) {\r\n var r = moduleId, pattern;\r\n // replace /./ => /\r\n pattern = /\\/\\.\\//;\r\n while (pattern.test(r)) {\r\n r = r.replace(pattern, '/');\r\n }\r\n // replace ^./ => nothing\r\n r = r.replace(/^\\.\\//g, '');\r\n // replace /aa/../ => / (BUT IGNORE /../../)\r\n pattern = /\\/(([^\\/])|([^\\/][^\\/\\.])|([^\\/\\.][^\\/])|([^\\/][^\\/][^\\/]+))\\/\\.\\.\\//;\r\n while (pattern.test(r)) {\r\n r = r.replace(pattern, '/');\r\n }\r\n // replace ^aa/../ => nothing (BUT IGNORE ../../)\r\n r = r.replace(/^(([^\\/])|([^\\/][^\\/\\.])|([^\\/\\.][^\\/])|([^\\/][^\\/][^\\/]+))\\/\\.\\.\\//, '');\r\n return r;\r\n };\r\n /**\r\n * Resolve relative module ids\r\n */\r\n ModuleIdResolver.prototype.resolveModule = function (moduleId) {\r\n var result = moduleId;\r\n if (!AMDLoader.Utilities.isAbsolutePath(result)) {\r\n if (AMDLoader.Utilities.startsWith(result, './') || AMDLoader.Utilities.startsWith(result, '../')) {\r\n result = ModuleIdResolver._normalizeModuleId(this.fromModulePath + result);\r\n }\r\n }\r\n return result;\r\n };\r\n ModuleIdResolver.ROOT = new ModuleIdResolver('');\r\n return ModuleIdResolver;\r\n }());\r\n AMDLoader.ModuleIdResolver = ModuleIdResolver;\r\n // ------------------------------------------------------------------------\r\n // Module\r\n var Module = /** @class */ (function () {\r\n function Module(id, strId, dependencies, callback, errorback, moduleIdResolver) {\r\n this.id = id;\r\n this.strId = strId;\r\n this.dependencies = dependencies;\r\n this._callback = callback;\r\n this._errorback = errorback;\r\n this.moduleIdResolver = moduleIdResolver;\r\n this.exports = {};\r\n this.error = null;\r\n this.exportsPassedIn = false;\r\n this.unresolvedDependenciesCount = this.dependencies.length;\r\n this._isComplete = false;\r\n }\r\n Module._safeInvokeFunction = function (callback, args) {\r\n try {\r\n return {\r\n returnedValue: callback.apply(AMDLoader.global, args),\r\n producedError: null\r\n };\r\n }\r\n catch (e) {\r\n return {\r\n returnedValue: null,\r\n producedError: e\r\n };\r\n }\r\n };\r\n Module._invokeFactory = function (config, strModuleId, callback, dependenciesValues) {\r\n if (config.isBuild() && !AMDLoader.Utilities.isAnonymousModule(strModuleId)) {\r\n return {\r\n returnedValue: null,\r\n producedError: null\r\n };\r\n }\r\n if (config.shouldCatchError()) {\r\n return this._safeInvokeFunction(callback, dependenciesValues);\r\n }\r\n return {\r\n returnedValue: callback.apply(AMDLoader.global, dependenciesValues),\r\n producedError: null\r\n };\r\n };\r\n Module.prototype.complete = function (recorder, config, dependenciesValues) {\r\n this._isComplete = true;\r\n var producedError = null;\r\n if (this._callback) {\r\n if (typeof this._callback === 'function') {\r\n recorder.record(21 /* BeginInvokeFactory */, this.strId);\r\n var r = Module._invokeFactory(config, this.strId, this._callback, dependenciesValues);\r\n producedError = r.producedError;\r\n recorder.record(22 /* EndInvokeFactory */, this.strId);\r\n if (!producedError && typeof r.returnedValue !== 'undefined' && (!this.exportsPassedIn || AMDLoader.Utilities.isEmpty(this.exports))) {\r\n this.exports = r.returnedValue;\r\n }\r\n }\r\n else {\r\n this.exports = this._callback;\r\n }\r\n }\r\n if (producedError) {\r\n var err = AMDLoader.ensureError(producedError);\r\n err.phase = 'factory';\r\n err.moduleId = this.strId;\r\n this.error = err;\r\n config.onError(err);\r\n }\r\n this.dependencies = null;\r\n this._callback = null;\r\n this._errorback = null;\r\n this.moduleIdResolver = null;\r\n };\r\n /**\r\n * One of the direct dependencies or a transitive dependency has failed to load.\r\n */\r\n Module.prototype.onDependencyError = function (err) {\r\n this._isComplete = true;\r\n this.error = err;\r\n if (this._errorback) {\r\n this._errorback(err);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Is the current module complete?\r\n */\r\n Module.prototype.isComplete = function () {\r\n return this._isComplete;\r\n };\r\n return Module;\r\n }());\r\n AMDLoader.Module = Module;\r\n var ModuleIdProvider = /** @class */ (function () {\r\n function ModuleIdProvider() {\r\n this._nextId = 0;\r\n this._strModuleIdToIntModuleId = new Map();\r\n this._intModuleIdToStrModuleId = [];\r\n // Ensure values 0, 1, 2 are assigned accordingly with ModuleId\r\n this.getModuleId('exports');\r\n this.getModuleId('module');\r\n this.getModuleId('require');\r\n }\r\n ModuleIdProvider.prototype.getMaxModuleId = function () {\r\n return this._nextId;\r\n };\r\n ModuleIdProvider.prototype.getModuleId = function (strModuleId) {\r\n var id = this._strModuleIdToIntModuleId.get(strModuleId);\r\n if (typeof id === 'undefined') {\r\n id = this._nextId++;\r\n this._strModuleIdToIntModuleId.set(strModuleId, id);\r\n this._intModuleIdToStrModuleId[id] = strModuleId;\r\n }\r\n return id;\r\n };\r\n ModuleIdProvider.prototype.getStrModuleId = function (moduleId) {\r\n return this._intModuleIdToStrModuleId[moduleId];\r\n };\r\n return ModuleIdProvider;\r\n }());\r\n var RegularDependency = /** @class */ (function () {\r\n function RegularDependency(id) {\r\n this.id = id;\r\n }\r\n RegularDependency.EXPORTS = new RegularDependency(0 /* EXPORTS */);\r\n RegularDependency.MODULE = new RegularDependency(1 /* MODULE */);\r\n RegularDependency.REQUIRE = new RegularDependency(2 /* REQUIRE */);\r\n return RegularDependency;\r\n }());\r\n AMDLoader.RegularDependency = RegularDependency;\r\n var PluginDependency = /** @class */ (function () {\r\n function PluginDependency(id, pluginId, pluginParam) {\r\n this.id = id;\r\n this.pluginId = pluginId;\r\n this.pluginParam = pluginParam;\r\n }\r\n return PluginDependency;\r\n }());\r\n AMDLoader.PluginDependency = PluginDependency;\r\n var ModuleManager = /** @class */ (function () {\r\n function ModuleManager(env, scriptLoader, defineFunc, requireFunc, loaderAvailableTimestamp) {\r\n if (loaderAvailableTimestamp === void 0) { loaderAvailableTimestamp = 0; }\r\n this._env = env;\r\n this._scriptLoader = scriptLoader;\r\n this._loaderAvailableTimestamp = loaderAvailableTimestamp;\r\n this._defineFunc = defineFunc;\r\n this._requireFunc = requireFunc;\r\n this._moduleIdProvider = new ModuleIdProvider();\r\n this._config = new AMDLoader.Configuration(this._env);\r\n this._modules2 = [];\r\n this._knownModules2 = [];\r\n this._inverseDependencies2 = [];\r\n this._inversePluginDependencies2 = new Map();\r\n this._currentAnnonymousDefineCall = null;\r\n this._recorder = null;\r\n this._buildInfoPath = [];\r\n this._buildInfoDefineStack = [];\r\n this._buildInfoDependencies = [];\r\n }\r\n ModuleManager.prototype.reset = function () {\r\n return new ModuleManager(this._env, this._scriptLoader, this._defineFunc, this._requireFunc, this._loaderAvailableTimestamp);\r\n };\r\n ModuleManager.prototype.getGlobalAMDDefineFunc = function () {\r\n return this._defineFunc;\r\n };\r\n ModuleManager.prototype.getGlobalAMDRequireFunc = function () {\r\n return this._requireFunc;\r\n };\r\n ModuleManager._findRelevantLocationInStack = function (needle, stack) {\r\n var normalize = function (str) { return str.replace(/\\\\/g, '/'); };\r\n var normalizedPath = normalize(needle);\r\n var stackPieces = stack.split(/\\n/);\r\n for (var i = 0; i < stackPieces.length; i++) {\r\n var m = stackPieces[i].match(/(.*):(\\d+):(\\d+)\\)?$/);\r\n if (m) {\r\n var stackPath = m[1];\r\n var stackLine = m[2];\r\n var stackColumn = m[3];\r\n var trimPathOffset = Math.max(stackPath.lastIndexOf(' ') + 1, stackPath.lastIndexOf('(') + 1);\r\n stackPath = stackPath.substr(trimPathOffset);\r\n stackPath = normalize(stackPath);\r\n if (stackPath === normalizedPath) {\r\n var r = {\r\n line: parseInt(stackLine, 10),\r\n col: parseInt(stackColumn, 10)\r\n };\r\n if (r.line === 1) {\r\n r.col -= '(function (require, define, __filename, __dirname) { '.length;\r\n }\r\n return r;\r\n }\r\n }\r\n }\r\n throw new Error('Could not correlate define call site for needle ' + needle);\r\n };\r\n ModuleManager.prototype.getBuildInfo = function () {\r\n if (!this._config.isBuild()) {\r\n return null;\r\n }\r\n var result = [], resultLen = 0;\r\n for (var i = 0, len = this._modules2.length; i < len; i++) {\r\n var m = this._modules2[i];\r\n if (!m) {\r\n continue;\r\n }\r\n var location_1 = this._buildInfoPath[m.id] || null;\r\n var defineStack = this._buildInfoDefineStack[m.id] || null;\r\n var dependencies = this._buildInfoDependencies[m.id];\r\n result[resultLen++] = {\r\n id: m.strId,\r\n path: location_1,\r\n defineLocation: (location_1 && defineStack ? ModuleManager._findRelevantLocationInStack(location_1, defineStack) : null),\r\n dependencies: dependencies,\r\n shim: null,\r\n exports: m.exports\r\n };\r\n }\r\n return result;\r\n };\r\n ModuleManager.prototype.getRecorder = function () {\r\n if (!this._recorder) {\r\n if (this._config.shouldRecordStats()) {\r\n this._recorder = new AMDLoader.LoaderEventRecorder(this._loaderAvailableTimestamp);\r\n }\r\n else {\r\n this._recorder = AMDLoader.NullLoaderEventRecorder.INSTANCE;\r\n }\r\n }\r\n return this._recorder;\r\n };\r\n ModuleManager.prototype.getLoaderEvents = function () {\r\n return this.getRecorder().getEvents();\r\n };\r\n /**\r\n * Defines an anonymous module (without an id). Its name will be resolved as we receive a callback from the scriptLoader.\r\n * @param dependecies @see defineModule\r\n * @param callback @see defineModule\r\n */\r\n ModuleManager.prototype.enqueueDefineAnonymousModule = function (dependencies, callback) {\r\n if (this._currentAnnonymousDefineCall !== null) {\r\n throw new Error('Can only have one anonymous define call per script file');\r\n }\r\n var stack = null;\r\n if (this._config.isBuild()) {\r\n stack = new Error('StackLocation').stack || null;\r\n }\r\n this._currentAnnonymousDefineCall = {\r\n stack: stack,\r\n dependencies: dependencies,\r\n callback: callback\r\n };\r\n };\r\n /**\r\n * Creates a module and stores it in _modules. The manager will immediately begin resolving its dependencies.\r\n * @param strModuleId An unique and absolute id of the module. This must not collide with another module's id\r\n * @param dependencies An array with the dependencies of the module. Special keys are: \"require\", \"exports\" and \"module\"\r\n * @param callback if callback is a function, it will be called with the resolved dependencies. if callback is an object, it will be considered as the exports of the module.\r\n */\r\n ModuleManager.prototype.defineModule = function (strModuleId, dependencies, callback, errorback, stack, moduleIdResolver) {\r\n var _this = this;\r\n if (moduleIdResolver === void 0) { moduleIdResolver = new ModuleIdResolver(strModuleId); }\r\n var moduleId = this._moduleIdProvider.getModuleId(strModuleId);\r\n if (this._modules2[moduleId]) {\r\n if (!this._config.isDuplicateMessageIgnoredFor(strModuleId)) {\r\n console.warn('Duplicate definition of module \\'' + strModuleId + '\\'');\r\n }\r\n // Super important! Completely ignore duplicate module definition\r\n return;\r\n }\r\n var m = new Module(moduleId, strModuleId, this._normalizeDependencies(dependencies, moduleIdResolver), callback, errorback, moduleIdResolver);\r\n this._modules2[moduleId] = m;\r\n if (this._config.isBuild()) {\r\n this._buildInfoDefineStack[moduleId] = stack;\r\n this._buildInfoDependencies[moduleId] = (m.dependencies || []).map(function (dep) { return _this._moduleIdProvider.getStrModuleId(dep.id); });\r\n }\r\n // Resolving of dependencies is immediate (not in a timeout). If there's a need to support a packer that concatenates in an\r\n // unordered manner, in order to finish processing the file, execute the following method in a timeout\r\n this._resolve(m);\r\n };\r\n ModuleManager.prototype._normalizeDependency = function (dependency, moduleIdResolver) {\r\n if (dependency === 'exports') {\r\n return RegularDependency.EXPORTS;\r\n }\r\n if (dependency === 'module') {\r\n return RegularDependency.MODULE;\r\n }\r\n if (dependency === 'require') {\r\n return RegularDependency.REQUIRE;\r\n }\r\n // Normalize dependency and then request it from the manager\r\n var bangIndex = dependency.indexOf('!');\r\n if (bangIndex >= 0) {\r\n var strPluginId = moduleIdResolver.resolveModule(dependency.substr(0, bangIndex));\r\n var pluginParam = moduleIdResolver.resolveModule(dependency.substr(bangIndex + 1));\r\n var dependencyId = this._moduleIdProvider.getModuleId(strPluginId + '!' + pluginParam);\r\n var pluginId = this._moduleIdProvider.getModuleId(strPluginId);\r\n return new PluginDependency(dependencyId, pluginId, pluginParam);\r\n }\r\n return new RegularDependency(this._moduleIdProvider.getModuleId(moduleIdResolver.resolveModule(dependency)));\r\n };\r\n ModuleManager.prototype._normalizeDependencies = function (dependencies, moduleIdResolver) {\r\n var result = [], resultLen = 0;\r\n for (var i = 0, len = dependencies.length; i < len; i++) {\r\n result[resultLen++] = this._normalizeDependency(dependencies[i], moduleIdResolver);\r\n }\r\n return result;\r\n };\r\n ModuleManager.prototype._relativeRequire = function (moduleIdResolver, dependencies, callback, errorback) {\r\n if (typeof dependencies === 'string') {\r\n return this.synchronousRequire(dependencies, moduleIdResolver);\r\n }\r\n this.defineModule(AMDLoader.Utilities.generateAnonymousModule(), dependencies, callback, errorback, null, moduleIdResolver);\r\n };\r\n /**\r\n * Require synchronously a module by its absolute id. If the module is not loaded, an exception will be thrown.\r\n * @param id The unique and absolute id of the required module\r\n * @return The exports of module 'id'\r\n */\r\n ModuleManager.prototype.synchronousRequire = function (_strModuleId, moduleIdResolver) {\r\n if (moduleIdResolver === void 0) { moduleIdResolver = new ModuleIdResolver(_strModuleId); }\r\n var dependency = this._normalizeDependency(_strModuleId, moduleIdResolver);\r\n var m = this._modules2[dependency.id];\r\n if (!m) {\r\n throw new Error('Check dependency list! Synchronous require cannot resolve module \\'' + _strModuleId + '\\'. This is the first mention of this module!');\r\n }\r\n if (!m.isComplete()) {\r\n throw new Error('Check dependency list! Synchronous require cannot resolve module \\'' + _strModuleId + '\\'. This module has not been resolved completely yet.');\r\n }\r\n if (m.error) {\r\n throw m.error;\r\n }\r\n return m.exports;\r\n };\r\n ModuleManager.prototype.configure = function (params, shouldOverwrite) {\r\n var oldShouldRecordStats = this._config.shouldRecordStats();\r\n if (shouldOverwrite) {\r\n this._config = new AMDLoader.Configuration(this._env, params);\r\n }\r\n else {\r\n this._config = this._config.cloneAndMerge(params);\r\n }\r\n if (this._config.shouldRecordStats() && !oldShouldRecordStats) {\r\n this._recorder = null;\r\n }\r\n };\r\n ModuleManager.prototype.getConfig = function () {\r\n return this._config;\r\n };\r\n /**\r\n * Callback from the scriptLoader when a module has been loaded.\r\n * This means its code is available and has been executed.\r\n */\r\n ModuleManager.prototype._onLoad = function (moduleId) {\r\n if (this._currentAnnonymousDefineCall !== null) {\r\n var defineCall = this._currentAnnonymousDefineCall;\r\n this._currentAnnonymousDefineCall = null;\r\n // Hit an anonymous define call\r\n this.defineModule(this._moduleIdProvider.getStrModuleId(moduleId), defineCall.dependencies, defineCall.callback, null, defineCall.stack);\r\n }\r\n };\r\n ModuleManager.prototype._createLoadError = function (moduleId, _err) {\r\n var _this = this;\r\n var strModuleId = this._moduleIdProvider.getStrModuleId(moduleId);\r\n var neededBy = (this._inverseDependencies2[moduleId] || []).map(function (intModuleId) { return _this._moduleIdProvider.getStrModuleId(intModuleId); });\r\n var err = AMDLoader.ensureError(_err);\r\n err.phase = 'loading';\r\n err.moduleId = strModuleId;\r\n err.neededBy = neededBy;\r\n return err;\r\n };\r\n /**\r\n * Callback from the scriptLoader when a module hasn't been loaded.\r\n * This means that the script was not found (e.g. 404) or there was an error in the script.\r\n */\r\n ModuleManager.prototype._onLoadError = function (moduleId, err) {\r\n var error = this._createLoadError(moduleId, err);\r\n if (!this._modules2[moduleId]) {\r\n this._modules2[moduleId] = new Module(moduleId, this._moduleIdProvider.getStrModuleId(moduleId), [], function () { }, function () { }, null);\r\n }\r\n // Find any 'local' error handlers, walk the entire chain of inverse dependencies if necessary.\r\n var seenModuleId = [];\r\n for (var i = 0, len = this._moduleIdProvider.getMaxModuleId(); i < len; i++) {\r\n seenModuleId[i] = false;\r\n }\r\n var someoneNotified = false;\r\n var queue = [];\r\n queue.push(moduleId);\r\n seenModuleId[moduleId] = true;\r\n while (queue.length > 0) {\r\n var queueElement = queue.shift();\r\n var m = this._modules2[queueElement];\r\n if (m) {\r\n someoneNotified = m.onDependencyError(error) || someoneNotified;\r\n }\r\n var inverseDeps = this._inverseDependencies2[queueElement];\r\n if (inverseDeps) {\r\n for (var i = 0, len = inverseDeps.length; i < len; i++) {\r\n var inverseDep = inverseDeps[i];\r\n if (!seenModuleId[inverseDep]) {\r\n queue.push(inverseDep);\r\n seenModuleId[inverseDep] = true;\r\n }\r\n }\r\n }\r\n }\r\n if (!someoneNotified) {\r\n this._config.onError(error);\r\n }\r\n };\r\n /**\r\n * Walks (recursively) the dependencies of 'from' in search of 'to'.\r\n * Returns true if there is such a path or false otherwise.\r\n * @param from Module id to start at\r\n * @param to Module id to look for\r\n */\r\n ModuleManager.prototype._hasDependencyPath = function (fromId, toId) {\r\n var from = this._modules2[fromId];\r\n if (!from) {\r\n return false;\r\n }\r\n var inQueue = [];\r\n for (var i = 0, len = this._moduleIdProvider.getMaxModuleId(); i < len; i++) {\r\n inQueue[i] = false;\r\n }\r\n var queue = [];\r\n // Insert 'from' in queue\r\n queue.push(from);\r\n inQueue[fromId] = true;\r\n while (queue.length > 0) {\r\n // Pop first inserted element of queue\r\n var element = queue.shift();\r\n var dependencies = element.dependencies;\r\n if (dependencies) {\r\n // Walk the element's dependencies\r\n for (var i = 0, len = dependencies.length; i < len; i++) {\r\n var dependency = dependencies[i];\r\n if (dependency.id === toId) {\r\n // There is a path to 'to'\r\n return true;\r\n }\r\n var dependencyModule = this._modules2[dependency.id];\r\n if (dependencyModule && !inQueue[dependency.id]) {\r\n // Insert 'dependency' in queue\r\n inQueue[dependency.id] = true;\r\n queue.push(dependencyModule);\r\n }\r\n }\r\n }\r\n }\r\n // There is no path to 'to'\r\n return false;\r\n };\r\n /**\r\n * Walks (recursively) the dependencies of 'from' in search of 'to'.\r\n * Returns cycle as array.\r\n * @param from Module id to start at\r\n * @param to Module id to look for\r\n */\r\n ModuleManager.prototype._findCyclePath = function (fromId, toId, depth) {\r\n if (fromId === toId || depth === 50) {\r\n return [fromId];\r\n }\r\n var from = this._modules2[fromId];\r\n if (!from) {\r\n return null;\r\n }\r\n // Walk the element's dependencies\r\n var dependencies = from.dependencies;\r\n if (dependencies) {\r\n for (var i = 0, len = dependencies.length; i < len; i++) {\r\n var path = this._findCyclePath(dependencies[i].id, toId, depth + 1);\r\n if (path !== null) {\r\n path.push(fromId);\r\n return path;\r\n }\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Create the local 'require' that is passed into modules\r\n */\r\n ModuleManager.prototype._createRequire = function (moduleIdResolver) {\r\n var _this = this;\r\n var result = (function (dependencies, callback, errorback) {\r\n return _this._relativeRequire(moduleIdResolver, dependencies, callback, errorback);\r\n });\r\n result.toUrl = function (id) {\r\n return _this._config.requireToUrl(moduleIdResolver.resolveModule(id));\r\n };\r\n result.getStats = function () {\r\n return _this.getLoaderEvents();\r\n };\r\n result.__$__nodeRequire = AMDLoader.global.nodeRequire;\r\n return result;\r\n };\r\n ModuleManager.prototype._loadModule = function (moduleId) {\r\n var _this = this;\r\n if (this._modules2[moduleId] || this._knownModules2[moduleId]) {\r\n // known module\r\n return;\r\n }\r\n this._knownModules2[moduleId] = true;\r\n var strModuleId = this._moduleIdProvider.getStrModuleId(moduleId);\r\n var paths = this._config.moduleIdToPaths(strModuleId);\r\n var scopedPackageRegex = /^@[^\\/]+\\/[^\\/]+$/; // matches @scope/package-name\r\n if (this._env.isNode && (strModuleId.indexOf('/') === -1 || scopedPackageRegex.test(strModuleId))) {\r\n paths.push('node|' + strModuleId);\r\n }\r\n var lastPathIndex = -1;\r\n var loadNextPath = function (err) {\r\n lastPathIndex++;\r\n if (lastPathIndex >= paths.length) {\r\n // No more paths to try\r\n _this._onLoadError(moduleId, err);\r\n }\r\n else {\r\n var currentPath_1 = paths[lastPathIndex];\r\n var recorder_1 = _this.getRecorder();\r\n if (_this._config.isBuild() && currentPath_1 === 'empty:') {\r\n _this._buildInfoPath[moduleId] = currentPath_1;\r\n _this.defineModule(_this._moduleIdProvider.getStrModuleId(moduleId), [], null, null, null);\r\n _this._onLoad(moduleId);\r\n return;\r\n }\r\n recorder_1.record(10 /* BeginLoadingScript */, currentPath_1);\r\n _this._scriptLoader.load(_this, currentPath_1, function () {\r\n if (_this._config.isBuild()) {\r\n _this._buildInfoPath[moduleId] = currentPath_1;\r\n }\r\n recorder_1.record(11 /* EndLoadingScriptOK */, currentPath_1);\r\n _this._onLoad(moduleId);\r\n }, function (err) {\r\n recorder_1.record(12 /* EndLoadingScriptError */, currentPath_1);\r\n loadNextPath(err);\r\n });\r\n }\r\n };\r\n loadNextPath(null);\r\n };\r\n /**\r\n * Resolve a plugin dependency with the plugin loaded & complete\r\n * @param module The module that has this dependency\r\n * @param pluginDependency The semi-normalized dependency that appears in the module. e.g. 'vs/css!./mycssfile'. Only the plugin part (before !) is normalized\r\n * @param plugin The plugin (what the plugin exports)\r\n */\r\n ModuleManager.prototype._loadPluginDependency = function (plugin, pluginDependency) {\r\n var _this = this;\r\n if (this._modules2[pluginDependency.id] || this._knownModules2[pluginDependency.id]) {\r\n // known module\r\n return;\r\n }\r\n this._knownModules2[pluginDependency.id] = true;\r\n // Delegate the loading of the resource to the plugin\r\n var load = (function (value) {\r\n _this.defineModule(_this._moduleIdProvider.getStrModuleId(pluginDependency.id), [], value, null, null);\r\n });\r\n load.error = function (err) {\r\n _this._config.onError(_this._createLoadError(pluginDependency.id, err));\r\n };\r\n plugin.load(pluginDependency.pluginParam, this._createRequire(ModuleIdResolver.ROOT), load, this._config.getOptionsLiteral());\r\n };\r\n /**\r\n * Examine the dependencies of module 'module' and resolve them as needed.\r\n */\r\n ModuleManager.prototype._resolve = function (module) {\r\n var _this = this;\r\n var dependencies = module.dependencies;\r\n if (dependencies) {\r\n for (var i = 0, len = dependencies.length; i < len; i++) {\r\n var dependency = dependencies[i];\r\n if (dependency === RegularDependency.EXPORTS) {\r\n module.exportsPassedIn = true;\r\n module.unresolvedDependenciesCount--;\r\n continue;\r\n }\r\n if (dependency === RegularDependency.MODULE) {\r\n module.unresolvedDependenciesCount--;\r\n continue;\r\n }\r\n if (dependency === RegularDependency.REQUIRE) {\r\n module.unresolvedDependenciesCount--;\r\n continue;\r\n }\r\n var dependencyModule = this._modules2[dependency.id];\r\n if (dependencyModule && dependencyModule.isComplete()) {\r\n if (dependencyModule.error) {\r\n module.onDependencyError(dependencyModule.error);\r\n return;\r\n }\r\n module.unresolvedDependenciesCount--;\r\n continue;\r\n }\r\n if (this._hasDependencyPath(dependency.id, module.id)) {\r\n console.warn('There is a dependency cycle between \\'' + this._moduleIdProvider.getStrModuleId(dependency.id) + '\\' and \\'' + this._moduleIdProvider.getStrModuleId(module.id) + '\\'. The cyclic path follows:');\r\n var cyclePath = this._findCyclePath(dependency.id, module.id, 0) || [];\r\n cyclePath.reverse();\r\n cyclePath.push(dependency.id);\r\n console.warn(cyclePath.map(function (id) { return _this._moduleIdProvider.getStrModuleId(id); }).join(' => \\n'));\r\n // Break the cycle\r\n module.unresolvedDependenciesCount--;\r\n continue;\r\n }\r\n // record inverse dependency\r\n this._inverseDependencies2[dependency.id] = this._inverseDependencies2[dependency.id] || [];\r\n this._inverseDependencies2[dependency.id].push(module.id);\r\n if (dependency instanceof PluginDependency) {\r\n var plugin = this._modules2[dependency.pluginId];\r\n if (plugin && plugin.isComplete()) {\r\n this._loadPluginDependency(plugin.exports, dependency);\r\n continue;\r\n }\r\n // Record dependency for when the plugin gets loaded\r\n var inversePluginDeps = this._inversePluginDependencies2.get(dependency.pluginId);\r\n if (!inversePluginDeps) {\r\n inversePluginDeps = [];\r\n this._inversePluginDependencies2.set(dependency.pluginId, inversePluginDeps);\r\n }\r\n inversePluginDeps.push(dependency);\r\n this._loadModule(dependency.pluginId);\r\n continue;\r\n }\r\n this._loadModule(dependency.id);\r\n }\r\n }\r\n if (module.unresolvedDependenciesCount === 0) {\r\n this._onModuleComplete(module);\r\n }\r\n };\r\n ModuleManager.prototype._onModuleComplete = function (module) {\r\n var _this = this;\r\n var recorder = this.getRecorder();\r\n if (module.isComplete()) {\r\n // already done\r\n return;\r\n }\r\n var dependencies = module.dependencies;\r\n var dependenciesValues = [];\r\n if (dependencies) {\r\n for (var i = 0, len = dependencies.length; i < len; i++) {\r\n var dependency = dependencies[i];\r\n if (dependency === RegularDependency.EXPORTS) {\r\n dependenciesValues[i] = module.exports;\r\n continue;\r\n }\r\n if (dependency === RegularDependency.MODULE) {\r\n dependenciesValues[i] = {\r\n id: module.strId,\r\n config: function () {\r\n return _this._config.getConfigForModule(module.strId);\r\n }\r\n };\r\n continue;\r\n }\r\n if (dependency === RegularDependency.REQUIRE) {\r\n dependenciesValues[i] = this._createRequire(module.moduleIdResolver);\r\n continue;\r\n }\r\n var dependencyModule = this._modules2[dependency.id];\r\n if (dependencyModule) {\r\n dependenciesValues[i] = dependencyModule.exports;\r\n continue;\r\n }\r\n dependenciesValues[i] = null;\r\n }\r\n }\r\n module.complete(recorder, this._config, dependenciesValues);\r\n // Fetch and clear inverse dependencies\r\n var inverseDeps = this._inverseDependencies2[module.id];\r\n this._inverseDependencies2[module.id] = null;\r\n if (inverseDeps) {\r\n // Resolve one inverse dependency at a time, always\r\n // on the lookout for a completed module.\r\n for (var i = 0, len = inverseDeps.length; i < len; i++) {\r\n var inverseDependencyId = inverseDeps[i];\r\n var inverseDependency = this._modules2[inverseDependencyId];\r\n inverseDependency.unresolvedDependenciesCount--;\r\n if (inverseDependency.unresolvedDependenciesCount === 0) {\r\n this._onModuleComplete(inverseDependency);\r\n }\r\n }\r\n }\r\n var inversePluginDeps = this._inversePluginDependencies2.get(module.id);\r\n if (inversePluginDeps) {\r\n // This module is used as a plugin at least once\r\n // Fetch and clear these inverse plugin dependencies\r\n this._inversePluginDependencies2.delete(module.id);\r\n // Resolve plugin dependencies one at a time\r\n for (var i = 0, len = inversePluginDeps.length; i < len; i++) {\r\n this._loadPluginDependency(module.exports, inversePluginDeps[i]);\r\n }\r\n }\r\n };\r\n return ModuleManager;\r\n }());\r\n AMDLoader.ModuleManager = ModuleManager;\r\n})(AMDLoader || (AMDLoader = {}));\r\nvar define;\r\nvar AMDLoader;\r\n(function (AMDLoader) {\r\n var env = new AMDLoader.Environment();\r\n var moduleManager = null;\r\n var DefineFunc = function (id, dependencies, callback) {\r\n if (typeof id !== 'string') {\r\n callback = dependencies;\r\n dependencies = id;\r\n id = null;\r\n }\r\n if (typeof dependencies !== 'object' || !Array.isArray(dependencies)) {\r\n callback = dependencies;\r\n dependencies = null;\r\n }\r\n if (!dependencies) {\r\n dependencies = ['require', 'exports', 'module'];\r\n }\r\n if (id) {\r\n moduleManager.defineModule(id, dependencies, callback, null, null);\r\n }\r\n else {\r\n moduleManager.enqueueDefineAnonymousModule(dependencies, callback);\r\n }\r\n };\r\n DefineFunc.amd = {\r\n jQuery: true\r\n };\r\n var _requireFunc_config = function (params, shouldOverwrite) {\r\n if (shouldOverwrite === void 0) { shouldOverwrite = false; }\r\n moduleManager.configure(params, shouldOverwrite);\r\n };\r\n var RequireFunc = function () {\r\n if (arguments.length === 1) {\r\n if ((arguments[0] instanceof Object) && !Array.isArray(arguments[0])) {\r\n _requireFunc_config(arguments[0]);\r\n return;\r\n }\r\n if (typeof arguments[0] === 'string') {\r\n return moduleManager.synchronousRequire(arguments[0]);\r\n }\r\n }\r\n if (arguments.length === 2 || arguments.length === 3) {\r\n if (Array.isArray(arguments[0])) {\r\n moduleManager.defineModule(AMDLoader.Utilities.generateAnonymousModule(), arguments[0], arguments[1], arguments[2], null);\r\n return;\r\n }\r\n }\r\n throw new Error('Unrecognized require call');\r\n };\r\n RequireFunc.config = _requireFunc_config;\r\n RequireFunc.getConfig = function () {\r\n return moduleManager.getConfig().getOptionsLiteral();\r\n };\r\n RequireFunc.reset = function () {\r\n moduleManager = moduleManager.reset();\r\n };\r\n RequireFunc.getBuildInfo = function () {\r\n return moduleManager.getBuildInfo();\r\n };\r\n RequireFunc.getStats = function () {\r\n return moduleManager.getLoaderEvents();\r\n };\r\n RequireFunc.define = function () {\r\n return DefineFunc.apply(null, arguments);\r\n };\r\n function init() {\r\n if (typeof AMDLoader.global.require !== 'undefined' || typeof require !== 'undefined') {\r\n var _nodeRequire_1 = (AMDLoader.global.require || require);\r\n if (typeof _nodeRequire_1 === 'function' && typeof _nodeRequire_1.resolve === 'function') {\r\n // re-expose node's require function\r\n var nodeRequire = function (what) {\r\n moduleManager.getRecorder().record(33 /* NodeBeginNativeRequire */, what);\r\n try {\r\n return _nodeRequire_1(what);\r\n }\r\n finally {\r\n moduleManager.getRecorder().record(34 /* NodeEndNativeRequire */, what);\r\n }\r\n };\r\n AMDLoader.global.nodeRequire = nodeRequire;\r\n RequireFunc.nodeRequire = nodeRequire;\r\n RequireFunc.__$__nodeRequire = nodeRequire;\r\n }\r\n }\r\n if (env.isNode && !env.isElectronRenderer) {\r\n module.exports = RequireFunc;\r\n require = RequireFunc;\r\n }\r\n else {\r\n if (!env.isElectronRenderer) {\r\n AMDLoader.global.define = DefineFunc;\r\n }\r\n AMDLoader.global.require = RequireFunc;\r\n }\r\n }\r\n AMDLoader.init = init;\r\n if (typeof AMDLoader.global.define !== 'function' || !AMDLoader.global.define.amd) {\r\n moduleManager = new AMDLoader.ModuleManager(env, AMDLoader.createScriptLoader(env), DefineFunc, RequireFunc, AMDLoader.Utilities.getHighPerformanceTimestamp());\r\n // The global variable require can configure the loader\r\n if (typeof AMDLoader.global.require !== 'undefined' && typeof AMDLoader.global.require !== 'function') {\r\n RequireFunc.config(AMDLoader.global.require);\r\n }\r\n // This define is for the local closure defined in node in the case that the loader is concatenated\r\n define = function () {\r\n return DefineFunc.apply(null, arguments);\r\n };\r\n define.amd = DefineFunc.amd;\r\n if (typeof doNotInitLoader === 'undefined') {\r\n init();\r\n }\r\n }\r\n})(AMDLoader || (AMDLoader = {}));\r\n"]}
|