loader.js1365 lines · main
| 1 | 'use strict' |
| 2 | /*!----------------------------------------------------------- |
| 3 | * Copyright (c) Microsoft Corporation. All rights reserved. |
| 4 | * Version: 0.37.0(20c3f8ff1e9176c954b34c052b2a84358d41a030) |
| 5 | * Released under the MIT license |
| 6 | * https://github.com/microsoft/vscode/blob/main/LICENSE.txt |
| 7 | *-----------------------------------------------------------*/ const _amdLoaderGlobal = this, |
| 8 | _commonjsGlobal = typeof global == 'object' ? global : {} |
| 9 | var AMDLoader |
| 10 | ;(function (u) { |
| 11 | u.global = _amdLoaderGlobal |
| 12 | class y { |
| 13 | get isWindows() { |
| 14 | return this._detect(), this._isWindows |
| 15 | } |
| 16 | get isNode() { |
| 17 | return this._detect(), this._isNode |
| 18 | } |
| 19 | get isElectronRenderer() { |
| 20 | return this._detect(), this._isElectronRenderer |
| 21 | } |
| 22 | get isWebWorker() { |
| 23 | return this._detect(), this._isWebWorker |
| 24 | } |
| 25 | get isElectronNodeIntegrationWebWorker() { |
| 26 | return this._detect(), this._isElectronNodeIntegrationWebWorker |
| 27 | } |
| 28 | constructor() { |
| 29 | ;(this._detected = !1), |
| 30 | (this._isWindows = !1), |
| 31 | (this._isNode = !1), |
| 32 | (this._isElectronRenderer = !1), |
| 33 | (this._isWebWorker = !1), |
| 34 | (this._isElectronNodeIntegrationWebWorker = !1) |
| 35 | } |
| 36 | _detect() { |
| 37 | this._detected || |
| 38 | ((this._detected = !0), |
| 39 | (this._isWindows = y._isWindows()), |
| 40 | (this._isNode = typeof module < 'u' && !!module.exports), |
| 41 | (this._isElectronRenderer = |
| 42 | typeof process < 'u' && |
| 43 | typeof process.versions < 'u' && |
| 44 | typeof process.versions.electron < 'u' && |
| 45 | process.type === 'renderer'), |
| 46 | (this._isWebWorker = typeof u.global.importScripts == 'function'), |
| 47 | (this._isElectronNodeIntegrationWebWorker = |
| 48 | this._isWebWorker && |
| 49 | typeof process < 'u' && |
| 50 | typeof process.versions < 'u' && |
| 51 | typeof process.versions.electron < 'u' && |
| 52 | process.type === 'worker')) |
| 53 | } |
| 54 | static _isWindows() { |
| 55 | return typeof navigator < 'u' && |
| 56 | navigator.userAgent && |
| 57 | navigator.userAgent.indexOf('Windows') >= 0 |
| 58 | ? !0 |
| 59 | : typeof process < 'u' |
| 60 | ? process.platform === 'win32' |
| 61 | : !1 |
| 62 | } |
| 63 | } |
| 64 | u.Environment = y |
| 65 | })(AMDLoader || (AMDLoader = {})) |
| 66 | var AMDLoader |
| 67 | ;(function (u) { |
| 68 | class y { |
| 69 | constructor(r, c, a) { |
| 70 | ;(this.type = r), (this.detail = c), (this.timestamp = a) |
| 71 | } |
| 72 | } |
| 73 | u.LoaderEvent = y |
| 74 | class m { |
| 75 | constructor(r) { |
| 76 | this._events = [new y(1, '', r)] |
| 77 | } |
| 78 | record(r, c) { |
| 79 | this._events.push(new y(r, c, u.Utilities.getHighPerformanceTimestamp())) |
| 80 | } |
| 81 | getEvents() { |
| 82 | return this._events |
| 83 | } |
| 84 | } |
| 85 | u.LoaderEventRecorder = m |
| 86 | class p { |
| 87 | record(r, c) {} |
| 88 | getEvents() { |
| 89 | return [] |
| 90 | } |
| 91 | } |
| 92 | ;(p.INSTANCE = new p()), (u.NullLoaderEventRecorder = p) |
| 93 | })(AMDLoader || (AMDLoader = {})) |
| 94 | var AMDLoader |
| 95 | ;(function (u) { |
| 96 | class y { |
| 97 | static fileUriToFilePath(p, h) { |
| 98 | if (((h = decodeURI(h).replace(/%23/g, '#')), p)) { |
| 99 | if (/^file:\/\/\//.test(h)) return h.substr(8) |
| 100 | if (/^file:\/\//.test(h)) return h.substr(5) |
| 101 | } else if (/^file:\/\//.test(h)) return h.substr(7) |
| 102 | return h |
| 103 | } |
| 104 | static startsWith(p, h) { |
| 105 | return p.length >= h.length && p.substr(0, h.length) === h |
| 106 | } |
| 107 | static endsWith(p, h) { |
| 108 | return p.length >= h.length && p.substr(p.length - h.length) === h |
| 109 | } |
| 110 | static containsQueryString(p) { |
| 111 | return /^[^\#]*\?/gi.test(p) |
| 112 | } |
| 113 | static isAbsolutePath(p) { |
| 114 | return /^((http:\/\/)|(https:\/\/)|(file:\/\/)|(\/))/.test(p) |
| 115 | } |
| 116 | static forEachProperty(p, h) { |
| 117 | if (p) { |
| 118 | let r |
| 119 | for (r in p) p.hasOwnProperty(r) && h(r, p[r]) |
| 120 | } |
| 121 | } |
| 122 | static isEmpty(p) { |
| 123 | let h = !0 |
| 124 | return ( |
| 125 | y.forEachProperty(p, () => { |
| 126 | h = !1 |
| 127 | }), |
| 128 | h |
| 129 | ) |
| 130 | } |
| 131 | static recursiveClone(p) { |
| 132 | if ( |
| 133 | !p || |
| 134 | typeof p != 'object' || |
| 135 | p instanceof RegExp || |
| 136 | (!Array.isArray(p) && Object.getPrototypeOf(p) !== Object.prototype) |
| 137 | ) |
| 138 | return p |
| 139 | let h = Array.isArray(p) ? [] : {} |
| 140 | return ( |
| 141 | y.forEachProperty(p, (r, c) => { |
| 142 | c && typeof c == 'object' ? (h[r] = y.recursiveClone(c)) : (h[r] = c) |
| 143 | }), |
| 144 | h |
| 145 | ) |
| 146 | } |
| 147 | static generateAnonymousModule() { |
| 148 | return '===anonymous' + y.NEXT_ANONYMOUS_ID++ + '===' |
| 149 | } |
| 150 | static isAnonymousModule(p) { |
| 151 | return y.startsWith(p, '===anonymous') |
| 152 | } |
| 153 | static getHighPerformanceTimestamp() { |
| 154 | return ( |
| 155 | this.PERFORMANCE_NOW_PROBED || |
| 156 | ((this.PERFORMANCE_NOW_PROBED = !0), |
| 157 | (this.HAS_PERFORMANCE_NOW = |
| 158 | u.global.performance && typeof u.global.performance.now == 'function')), |
| 159 | this.HAS_PERFORMANCE_NOW ? u.global.performance.now() : Date.now() |
| 160 | ) |
| 161 | } |
| 162 | } |
| 163 | ;(y.NEXT_ANONYMOUS_ID = 1), |
| 164 | (y.PERFORMANCE_NOW_PROBED = !1), |
| 165 | (y.HAS_PERFORMANCE_NOW = !1), |
| 166 | (u.Utilities = y) |
| 167 | })(AMDLoader || (AMDLoader = {})) |
| 168 | var AMDLoader |
| 169 | ;(function (u) { |
| 170 | function y(h) { |
| 171 | if (h instanceof Error) return h |
| 172 | const r = new Error(h.message || String(h) || 'Unknown Error') |
| 173 | return h.stack && (r.stack = h.stack), r |
| 174 | } |
| 175 | u.ensureError = y |
| 176 | class m { |
| 177 | static validateConfigurationOptions(r) { |
| 178 | function c(a) { |
| 179 | if (a.phase === 'loading') { |
| 180 | console.error('Loading "' + a.moduleId + '" failed'), |
| 181 | console.error(a), |
| 182 | console.error('Here are the modules that depend on it:'), |
| 183 | console.error(a.neededBy) |
| 184 | return |
| 185 | } |
| 186 | if (a.phase === 'factory') { |
| 187 | console.error('The factory function of "' + a.moduleId + '" has thrown an exception'), |
| 188 | console.error(a), |
| 189 | console.error('Here are the modules that depend on it:'), |
| 190 | console.error(a.neededBy) |
| 191 | return |
| 192 | } |
| 193 | } |
| 194 | if ( |
| 195 | ((r = r || {}), |
| 196 | typeof r.baseUrl != 'string' && (r.baseUrl = ''), |
| 197 | typeof r.isBuild != 'boolean' && (r.isBuild = !1), |
| 198 | typeof r.paths != 'object' && (r.paths = {}), |
| 199 | typeof r.config != 'object' && (r.config = {}), |
| 200 | typeof r.catchError > 'u' && (r.catchError = !1), |
| 201 | typeof r.recordStats > 'u' && (r.recordStats = !1), |
| 202 | typeof r.urlArgs != 'string' && (r.urlArgs = ''), |
| 203 | typeof r.onError != 'function' && (r.onError = c), |
| 204 | Array.isArray(r.ignoreDuplicateModules) || (r.ignoreDuplicateModules = []), |
| 205 | r.baseUrl.length > 0 && (u.Utilities.endsWith(r.baseUrl, '/') || (r.baseUrl += '/')), |
| 206 | typeof r.cspNonce != 'string' && (r.cspNonce = ''), |
| 207 | typeof r.preferScriptTags > 'u' && (r.preferScriptTags = !1), |
| 208 | r.nodeCachedData && |
| 209 | typeof r.nodeCachedData == 'object' && |
| 210 | (typeof r.nodeCachedData.seed != 'string' && (r.nodeCachedData.seed = 'seed'), |
| 211 | (typeof r.nodeCachedData.writeDelay != 'number' || r.nodeCachedData.writeDelay < 0) && |
| 212 | (r.nodeCachedData.writeDelay = 1e3 * 7), |
| 213 | !r.nodeCachedData.path || typeof r.nodeCachedData.path != 'string')) |
| 214 | ) { |
| 215 | const a = y(new Error("INVALID cached data configuration, 'path' MUST be set")) |
| 216 | ;(a.phase = 'configuration'), r.onError(a), (r.nodeCachedData = void 0) |
| 217 | } |
| 218 | return r |
| 219 | } |
| 220 | static mergeConfigurationOptions(r = null, c = null) { |
| 221 | let a = u.Utilities.recursiveClone(c || {}) |
| 222 | return ( |
| 223 | u.Utilities.forEachProperty(r, (t, e) => { |
| 224 | t === 'ignoreDuplicateModules' && typeof a.ignoreDuplicateModules < 'u' |
| 225 | ? (a.ignoreDuplicateModules = a.ignoreDuplicateModules.concat(e)) |
| 226 | : t === 'paths' && typeof a.paths < 'u' |
| 227 | ? u.Utilities.forEachProperty(e, (i, s) => (a.paths[i] = s)) |
| 228 | : t === 'config' && typeof a.config < 'u' |
| 229 | ? u.Utilities.forEachProperty(e, (i, s) => (a.config[i] = s)) |
| 230 | : (a[t] = u.Utilities.recursiveClone(e)) |
| 231 | }), |
| 232 | m.validateConfigurationOptions(a) |
| 233 | ) |
| 234 | } |
| 235 | } |
| 236 | u.ConfigurationOptionsUtil = m |
| 237 | class p { |
| 238 | constructor(r, c) { |
| 239 | if ( |
| 240 | ((this._env = r), |
| 241 | (this.options = m.mergeConfigurationOptions(c)), |
| 242 | this._createIgnoreDuplicateModulesMap(), |
| 243 | this._createSortedPathsRules(), |
| 244 | this.options.baseUrl === '' && |
| 245 | this.options.nodeRequire && |
| 246 | this.options.nodeRequire.main && |
| 247 | this.options.nodeRequire.main.filename && |
| 248 | this._env.isNode) |
| 249 | ) { |
| 250 | let a = this.options.nodeRequire.main.filename, |
| 251 | t = Math.max(a.lastIndexOf('/'), a.lastIndexOf('\\')) |
| 252 | this.options.baseUrl = a.substring(0, t + 1) |
| 253 | } |
| 254 | } |
| 255 | _createIgnoreDuplicateModulesMap() { |
| 256 | this.ignoreDuplicateModulesMap = {} |
| 257 | for (let r = 0; r < this.options.ignoreDuplicateModules.length; r++) |
| 258 | this.ignoreDuplicateModulesMap[this.options.ignoreDuplicateModules[r]] = !0 |
| 259 | } |
| 260 | _createSortedPathsRules() { |
| 261 | ;(this.sortedPathsRules = []), |
| 262 | u.Utilities.forEachProperty(this.options.paths, (r, c) => { |
| 263 | Array.isArray(c) |
| 264 | ? this.sortedPathsRules.push({ from: r, to: c }) |
| 265 | : this.sortedPathsRules.push({ from: r, to: [c] }) |
| 266 | }), |
| 267 | this.sortedPathsRules.sort((r, c) => c.from.length - r.from.length) |
| 268 | } |
| 269 | cloneAndMerge(r) { |
| 270 | return new p(this._env, m.mergeConfigurationOptions(r, this.options)) |
| 271 | } |
| 272 | getOptionsLiteral() { |
| 273 | return this.options |
| 274 | } |
| 275 | _applyPaths(r) { |
| 276 | let c |
| 277 | for (let a = 0, t = this.sortedPathsRules.length; a < t; a++) |
| 278 | if (((c = this.sortedPathsRules[a]), u.Utilities.startsWith(r, c.from))) { |
| 279 | let e = [] |
| 280 | for (let i = 0, s = c.to.length; i < s; i++) e.push(c.to[i] + r.substr(c.from.length)) |
| 281 | return e |
| 282 | } |
| 283 | return [r] |
| 284 | } |
| 285 | _addUrlArgsToUrl(r) { |
| 286 | return u.Utilities.containsQueryString(r) |
| 287 | ? r + '&' + this.options.urlArgs |
| 288 | : r + '?' + this.options.urlArgs |
| 289 | } |
| 290 | _addUrlArgsIfNecessaryToUrl(r) { |
| 291 | return this.options.urlArgs ? this._addUrlArgsToUrl(r) : r |
| 292 | } |
| 293 | _addUrlArgsIfNecessaryToUrls(r) { |
| 294 | if (this.options.urlArgs) |
| 295 | for (let c = 0, a = r.length; c < a; c++) r[c] = this._addUrlArgsToUrl(r[c]) |
| 296 | return r |
| 297 | } |
| 298 | moduleIdToPaths(r) { |
| 299 | if ( |
| 300 | this._env.isNode && |
| 301 | this.options.amdModulesPattern instanceof RegExp && |
| 302 | !this.options.amdModulesPattern.test(r) |
| 303 | ) |
| 304 | return this.isBuild() ? ['empty:'] : ['node|' + r] |
| 305 | let c = r, |
| 306 | a |
| 307 | if (!u.Utilities.endsWith(c, '.js') && !u.Utilities.isAbsolutePath(c)) { |
| 308 | a = this._applyPaths(c) |
| 309 | for (let t = 0, e = a.length; t < e; t++) |
| 310 | (this.isBuild() && a[t] === 'empty:') || |
| 311 | (u.Utilities.isAbsolutePath(a[t]) || (a[t] = this.options.baseUrl + a[t]), |
| 312 | !u.Utilities.endsWith(a[t], '.js') && |
| 313 | !u.Utilities.containsQueryString(a[t]) && |
| 314 | (a[t] = a[t] + '.js')) |
| 315 | } else |
| 316 | !u.Utilities.endsWith(c, '.js') && !u.Utilities.containsQueryString(c) && (c = c + '.js'), |
| 317 | (a = [c]) |
| 318 | return this._addUrlArgsIfNecessaryToUrls(a) |
| 319 | } |
| 320 | requireToUrl(r) { |
| 321 | let c = r |
| 322 | return ( |
| 323 | u.Utilities.isAbsolutePath(c) || |
| 324 | ((c = this._applyPaths(c)[0]), |
| 325 | u.Utilities.isAbsolutePath(c) || (c = this.options.baseUrl + c)), |
| 326 | this._addUrlArgsIfNecessaryToUrl(c) |
| 327 | ) |
| 328 | } |
| 329 | isBuild() { |
| 330 | return this.options.isBuild |
| 331 | } |
| 332 | shouldInvokeFactory(r) { |
| 333 | return !!( |
| 334 | !this.options.isBuild || |
| 335 | u.Utilities.isAnonymousModule(r) || |
| 336 | (this.options.buildForceInvokeFactory && this.options.buildForceInvokeFactory[r]) |
| 337 | ) |
| 338 | } |
| 339 | isDuplicateMessageIgnoredFor(r) { |
| 340 | return this.ignoreDuplicateModulesMap.hasOwnProperty(r) |
| 341 | } |
| 342 | getConfigForModule(r) { |
| 343 | if (this.options.config) return this.options.config[r] |
| 344 | } |
| 345 | shouldCatchError() { |
| 346 | return this.options.catchError |
| 347 | } |
| 348 | shouldRecordStats() { |
| 349 | return this.options.recordStats |
| 350 | } |
| 351 | onError(r) { |
| 352 | this.options.onError(r) |
| 353 | } |
| 354 | } |
| 355 | u.Configuration = p |
| 356 | })(AMDLoader || (AMDLoader = {})) |
| 357 | var AMDLoader |
| 358 | ;(function (u) { |
| 359 | class y { |
| 360 | constructor(e) { |
| 361 | ;(this._env = e), (this._scriptLoader = null), (this._callbackMap = {}) |
| 362 | } |
| 363 | load(e, i, s, n) { |
| 364 | if (!this._scriptLoader) |
| 365 | if (this._env.isWebWorker) this._scriptLoader = new h() |
| 366 | else if (this._env.isElectronRenderer) { |
| 367 | const { preferScriptTags: d } = e.getConfig().getOptionsLiteral() |
| 368 | d ? (this._scriptLoader = new m()) : (this._scriptLoader = new r(this._env)) |
| 369 | } else |
| 370 | this._env.isNode |
| 371 | ? (this._scriptLoader = new r(this._env)) |
| 372 | : (this._scriptLoader = new m()) |
| 373 | let l = { callback: s, errorback: n } |
| 374 | if (this._callbackMap.hasOwnProperty(i)) { |
| 375 | this._callbackMap[i].push(l) |
| 376 | return |
| 377 | } |
| 378 | ;(this._callbackMap[i] = [l]), |
| 379 | this._scriptLoader.load( |
| 380 | e, |
| 381 | i, |
| 382 | () => this.triggerCallback(i), |
| 383 | (d) => this.triggerErrorback(i, d) |
| 384 | ) |
| 385 | } |
| 386 | triggerCallback(e) { |
| 387 | let i = this._callbackMap[e] |
| 388 | delete this._callbackMap[e] |
| 389 | for (let s = 0; s < i.length; s++) i[s].callback() |
| 390 | } |
| 391 | triggerErrorback(e, i) { |
| 392 | let s = this._callbackMap[e] |
| 393 | delete this._callbackMap[e] |
| 394 | for (let n = 0; n < s.length; n++) s[n].errorback(i) |
| 395 | } |
| 396 | } |
| 397 | class m { |
| 398 | attachListeners(e, i, s) { |
| 399 | let n = () => { |
| 400 | e.removeEventListener('load', l), e.removeEventListener('error', d) |
| 401 | }, |
| 402 | l = (o) => { |
| 403 | n(), i() |
| 404 | }, |
| 405 | d = (o) => { |
| 406 | n(), s(o) |
| 407 | } |
| 408 | e.addEventListener('load', l), e.addEventListener('error', d) |
| 409 | } |
| 410 | load(e, i, s, n) { |
| 411 | if (/^node\|/.test(i)) { |
| 412 | let l = e.getConfig().getOptionsLiteral(), |
| 413 | d = c(e.getRecorder(), l.nodeRequire || u.global.nodeRequire), |
| 414 | o = i.split('|'), |
| 415 | _ = null |
| 416 | try { |
| 417 | _ = d(o[1]) |
| 418 | } catch (f) { |
| 419 | n(f) |
| 420 | return |
| 421 | } |
| 422 | e.enqueueDefineAnonymousModule([], () => _), s() |
| 423 | } else { |
| 424 | let l = document.createElement('script') |
| 425 | l.setAttribute('async', 'async'), |
| 426 | l.setAttribute('type', 'text/javascript'), |
| 427 | this.attachListeners(l, s, n) |
| 428 | const { trustedTypesPolicy: d } = e.getConfig().getOptionsLiteral() |
| 429 | d && (i = d.createScriptURL(i)), l.setAttribute('src', i) |
| 430 | const { cspNonce: o } = e.getConfig().getOptionsLiteral() |
| 431 | o && l.setAttribute('nonce', o), document.getElementsByTagName('head')[0].appendChild(l) |
| 432 | } |
| 433 | } |
| 434 | } |
| 435 | function p(t) { |
| 436 | const { trustedTypesPolicy: e } = t.getConfig().getOptionsLiteral() |
| 437 | try { |
| 438 | return (e ? self.eval(e.createScript('', 'true')) : new Function('true')).call(self), !0 |
| 439 | } catch { |
| 440 | return !1 |
| 441 | } |
| 442 | } |
| 443 | class h { |
| 444 | constructor() { |
| 445 | this._cachedCanUseEval = null |
| 446 | } |
| 447 | _canUseEval(e) { |
| 448 | return ( |
| 449 | this._cachedCanUseEval === null && (this._cachedCanUseEval = p(e)), this._cachedCanUseEval |
| 450 | ) |
| 451 | } |
| 452 | load(e, i, s, n) { |
| 453 | if (/^node\|/.test(i)) { |
| 454 | const l = e.getConfig().getOptionsLiteral(), |
| 455 | d = c(e.getRecorder(), l.nodeRequire || u.global.nodeRequire), |
| 456 | o = i.split('|') |
| 457 | let _ = null |
| 458 | try { |
| 459 | _ = d(o[1]) |
| 460 | } catch (f) { |
| 461 | n(f) |
| 462 | return |
| 463 | } |
| 464 | e.enqueueDefineAnonymousModule([], function () { |
| 465 | return _ |
| 466 | }), |
| 467 | s() |
| 468 | } else { |
| 469 | const { trustedTypesPolicy: l } = e.getConfig().getOptionsLiteral() |
| 470 | if ( |
| 471 | !( |
| 472 | /^((http:)|(https:)|(file:))/.test(i) && |
| 473 | i.substring(0, self.origin.length) !== self.origin |
| 474 | ) && |
| 475 | this._canUseEval(e) |
| 476 | ) { |
| 477 | fetch(i) |
| 478 | .then((o) => { |
| 479 | if (o.status !== 200) throw new Error(o.statusText) |
| 480 | return o.text() |
| 481 | }) |
| 482 | .then((o) => { |
| 483 | ;(o = `${o} |
| 484 | //# sourceURL=${i}`), |
| 485 | (l ? self.eval(l.createScript('', o)) : new Function(o)).call(self), |
| 486 | s() |
| 487 | }) |
| 488 | .then(void 0, n) |
| 489 | return |
| 490 | } |
| 491 | try { |
| 492 | l && (i = l.createScriptURL(i)), importScripts(i), s() |
| 493 | } catch (o) { |
| 494 | n(o) |
| 495 | } |
| 496 | } |
| 497 | } |
| 498 | } |
| 499 | class r { |
| 500 | constructor(e) { |
| 501 | ;(this._env = e), (this._didInitialize = !1), (this._didPatchNodeRequire = !1) |
| 502 | } |
| 503 | _init(e) { |
| 504 | this._didInitialize || |
| 505 | ((this._didInitialize = !0), |
| 506 | (this._fs = e('fs')), |
| 507 | (this._vm = e('vm')), |
| 508 | (this._path = e('path')), |
| 509 | (this._crypto = e('crypto'))) |
| 510 | } |
| 511 | _initNodeRequire(e, i) { |
| 512 | const { nodeCachedData: s } = i.getConfig().getOptionsLiteral() |
| 513 | if (!s || this._didPatchNodeRequire) return |
| 514 | this._didPatchNodeRequire = !0 |
| 515 | const n = this, |
| 516 | l = e('module') |
| 517 | function d(o) { |
| 518 | const _ = o.constructor |
| 519 | let f = function (v) { |
| 520 | try { |
| 521 | return o.require(v) |
| 522 | } finally { |
| 523 | } |
| 524 | } |
| 525 | return ( |
| 526 | (f.resolve = function (v, E) { |
| 527 | return _._resolveFilename(v, o, !1, E) |
| 528 | }), |
| 529 | (f.resolve.paths = function (v) { |
| 530 | return _._resolveLookupPaths(v, o) |
| 531 | }), |
| 532 | (f.main = process.mainModule), |
| 533 | (f.extensions = _._extensions), |
| 534 | (f.cache = _._cache), |
| 535 | f |
| 536 | ) |
| 537 | } |
| 538 | l.prototype._compile = function (o, _) { |
| 539 | const f = l.wrap(o.replace(/^#!.*/, '')), |
| 540 | g = i.getRecorder(), |
| 541 | v = n._getCachedDataPath(s, _), |
| 542 | E = { filename: _ } |
| 543 | let I |
| 544 | try { |
| 545 | const D = n._fs.readFileSync(v) |
| 546 | ;(I = D.slice(0, 16)), (E.cachedData = D.slice(16)), g.record(60, v) |
| 547 | } catch { |
| 548 | g.record(61, v) |
| 549 | } |
| 550 | const C = new n._vm.Script(f, E), |
| 551 | P = C.runInThisContext(E), |
| 552 | w = n._path.dirname(_), |
| 553 | R = d(this), |
| 554 | U = [this.exports, R, this, _, w, process, _commonjsGlobal, Buffer], |
| 555 | b = P.apply(this.exports, U) |
| 556 | return n._handleCachedData(C, f, v, !E.cachedData, i), n._verifyCachedData(C, f, v, I, i), b |
| 557 | } |
| 558 | } |
| 559 | load(e, i, s, n) { |
| 560 | const l = e.getConfig().getOptionsLiteral(), |
| 561 | d = c(e.getRecorder(), l.nodeRequire || u.global.nodeRequire), |
| 562 | o = |
| 563 | l.nodeInstrumenter || |
| 564 | function (f) { |
| 565 | return f |
| 566 | } |
| 567 | this._init(d), this._initNodeRequire(d, e) |
| 568 | let _ = e.getRecorder() |
| 569 | if (/^node\|/.test(i)) { |
| 570 | let f = i.split('|'), |
| 571 | g = null |
| 572 | try { |
| 573 | g = d(f[1]) |
| 574 | } catch (v) { |
| 575 | n(v) |
| 576 | return |
| 577 | } |
| 578 | e.enqueueDefineAnonymousModule([], () => g), s() |
| 579 | } else { |
| 580 | i = u.Utilities.fileUriToFilePath(this._env.isWindows, i) |
| 581 | const f = this._path.normalize(i), |
| 582 | g = this._getElectronRendererScriptPathOrUri(f), |
| 583 | v = Boolean(l.nodeCachedData), |
| 584 | E = v ? this._getCachedDataPath(l.nodeCachedData, i) : void 0 |
| 585 | this._readSourceAndCachedData(f, E, _, (I, C, P, w) => { |
| 586 | if (I) { |
| 587 | n(I) |
| 588 | return |
| 589 | } |
| 590 | let R |
| 591 | C.charCodeAt(0) === r._BOM |
| 592 | ? (R = r._PREFIX + C.substring(1) + r._SUFFIX) |
| 593 | : (R = r._PREFIX + C + r._SUFFIX), |
| 594 | (R = o(R, f)) |
| 595 | const U = { filename: g, cachedData: P }, |
| 596 | b = this._createAndEvalScript(e, R, U, s, n) |
| 597 | this._handleCachedData(b, R, E, v && !P, e), this._verifyCachedData(b, R, E, w, e) |
| 598 | }) |
| 599 | } |
| 600 | } |
| 601 | _createAndEvalScript(e, i, s, n, l) { |
| 602 | const d = e.getRecorder() |
| 603 | d.record(31, s.filename) |
| 604 | const o = new this._vm.Script(i, s), |
| 605 | _ = o.runInThisContext(s), |
| 606 | f = e.getGlobalAMDDefineFunc() |
| 607 | let g = !1 |
| 608 | const v = function () { |
| 609 | return (g = !0), f.apply(null, arguments) |
| 610 | } |
| 611 | return ( |
| 612 | (v.amd = f.amd), |
| 613 | _.call( |
| 614 | u.global, |
| 615 | e.getGlobalAMDRequireFunc(), |
| 616 | v, |
| 617 | s.filename, |
| 618 | this._path.dirname(s.filename) |
| 619 | ), |
| 620 | d.record(32, s.filename), |
| 621 | g ? n() : l(new Error(`Didn't receive define call in ${s.filename}!`)), |
| 622 | o |
| 623 | ) |
| 624 | } |
| 625 | _getElectronRendererScriptPathOrUri(e) { |
| 626 | if (!this._env.isElectronRenderer) return e |
| 627 | let i = e.match(/^([a-z])\:(.*)/i) |
| 628 | return i ? `file:///${(i[1].toUpperCase() + ':' + i[2]).replace(/\\/g, '/')}` : `file://${e}` |
| 629 | } |
| 630 | _getCachedDataPath(e, i) { |
| 631 | const s = this._crypto |
| 632 | .createHash('md5') |
| 633 | .update(i, 'utf8') |
| 634 | .update(e.seed, 'utf8') |
| 635 | .update(process.arch, '') |
| 636 | .digest('hex'), |
| 637 | n = this._path.basename(i).replace(/\.js$/, '') |
| 638 | return this._path.join(e.path, `${n}-${s}.code`) |
| 639 | } |
| 640 | _handleCachedData(e, i, s, n, l) { |
| 641 | e.cachedDataRejected |
| 642 | ? this._fs.unlink(s, (d) => { |
| 643 | l.getRecorder().record(62, s), |
| 644 | this._createAndWriteCachedData(e, i, s, l), |
| 645 | d && l.getConfig().onError(d) |
| 646 | }) |
| 647 | : n && this._createAndWriteCachedData(e, i, s, l) |
| 648 | } |
| 649 | _createAndWriteCachedData(e, i, s, n) { |
| 650 | let l = Math.ceil( |
| 651 | n.getConfig().getOptionsLiteral().nodeCachedData.writeDelay * (1 + Math.random()) |
| 652 | ), |
| 653 | d = -1, |
| 654 | o = 0, |
| 655 | _ |
| 656 | const f = () => { |
| 657 | setTimeout(() => { |
| 658 | _ || (_ = this._crypto.createHash('md5').update(i, 'utf8').digest()) |
| 659 | const g = e.createCachedData() |
| 660 | if (!(g.length === 0 || g.length === d || o >= 5)) { |
| 661 | if (g.length < d) { |
| 662 | f() |
| 663 | return |
| 664 | } |
| 665 | ;(d = g.length), |
| 666 | this._fs.writeFile(s, Buffer.concat([_, g]), (v) => { |
| 667 | v && n.getConfig().onError(v), n.getRecorder().record(63, s), f() |
| 668 | }) |
| 669 | } |
| 670 | }, l * Math.pow(4, o++)) |
| 671 | } |
| 672 | f() |
| 673 | } |
| 674 | _readSourceAndCachedData(e, i, s, n) { |
| 675 | if (!i) this._fs.readFile(e, { encoding: 'utf8' }, n) |
| 676 | else { |
| 677 | let l, |
| 678 | d, |
| 679 | o, |
| 680 | _ = 2 |
| 681 | const f = (g) => { |
| 682 | g ? n(g) : --_ === 0 && n(void 0, l, d, o) |
| 683 | } |
| 684 | this._fs.readFile(e, { encoding: 'utf8' }, (g, v) => { |
| 685 | ;(l = v), f(g) |
| 686 | }), |
| 687 | this._fs.readFile(i, (g, v) => { |
| 688 | !g && v && v.length > 0 |
| 689 | ? ((o = v.slice(0, 16)), (d = v.slice(16)), s.record(60, i)) |
| 690 | : s.record(61, i), |
| 691 | f() |
| 692 | }) |
| 693 | } |
| 694 | } |
| 695 | _verifyCachedData(e, i, s, n, l) { |
| 696 | !n || |
| 697 | e.cachedDataRejected || |
| 698 | setTimeout(() => { |
| 699 | const d = this._crypto.createHash('md5').update(i, 'utf8').digest() |
| 700 | n.equals(d) || |
| 701 | (l |
| 702 | .getConfig() |
| 703 | .onError( |
| 704 | new Error( |
| 705 | `FAILED TO VERIFY CACHED DATA, deleting stale '${s}' now, but a RESTART IS REQUIRED` |
| 706 | ) |
| 707 | ), |
| 708 | this._fs.unlink(s, (o) => { |
| 709 | o && l.getConfig().onError(o) |
| 710 | })) |
| 711 | }, Math.ceil(5e3 * (1 + Math.random()))) |
| 712 | } |
| 713 | } |
| 714 | ;(r._BOM = 65279), |
| 715 | (r._PREFIX = '(function (require, define, __filename, __dirname) { '), |
| 716 | (r._SUFFIX = ` |
| 717 | });`) |
| 718 | function c(t, e) { |
| 719 | if (e.__$__isRecorded) return e |
| 720 | const i = function (n) { |
| 721 | t.record(33, n) |
| 722 | try { |
| 723 | return e(n) |
| 724 | } finally { |
| 725 | t.record(34, n) |
| 726 | } |
| 727 | } |
| 728 | return (i.__$__isRecorded = !0), i |
| 729 | } |
| 730 | u.ensureRecordedNodeRequire = c |
| 731 | function a(t) { |
| 732 | return new y(t) |
| 733 | } |
| 734 | u.createScriptLoader = a |
| 735 | })(AMDLoader || (AMDLoader = {})) |
| 736 | var AMDLoader |
| 737 | ;(function (u) { |
| 738 | class y { |
| 739 | constructor(t) { |
| 740 | let e = t.lastIndexOf('/') |
| 741 | e !== -1 ? (this.fromModulePath = t.substr(0, e + 1)) : (this.fromModulePath = '') |
| 742 | } |
| 743 | static _normalizeModuleId(t) { |
| 744 | let e = t, |
| 745 | i |
| 746 | for (i = /\/\.\//; i.test(e); ) e = e.replace(i, '/') |
| 747 | for ( |
| 748 | e = e.replace(/^\.\//g, ''), |
| 749 | i = /\/(([^\/])|([^\/][^\/\.])|([^\/\.][^\/])|([^\/][^\/][^\/]+))\/\.\.\//; |
| 750 | i.test(e); |
| 751 | |
| 752 | ) |
| 753 | e = e.replace(i, '/') |
| 754 | return ( |
| 755 | (e = e.replace(/^(([^\/])|([^\/][^\/\.])|([^\/\.][^\/])|([^\/][^\/][^\/]+))\/\.\.\//, '')), |
| 756 | e |
| 757 | ) |
| 758 | } |
| 759 | resolveModule(t) { |
| 760 | let e = t |
| 761 | return ( |
| 762 | u.Utilities.isAbsolutePath(e) || |
| 763 | ((u.Utilities.startsWith(e, './') || u.Utilities.startsWith(e, '../')) && |
| 764 | (e = y._normalizeModuleId(this.fromModulePath + e))), |
| 765 | e |
| 766 | ) |
| 767 | } |
| 768 | } |
| 769 | ;(y.ROOT = new y('')), (u.ModuleIdResolver = y) |
| 770 | class m { |
| 771 | constructor(t, e, i, s, n, l) { |
| 772 | ;(this.id = t), |
| 773 | (this.strId = e), |
| 774 | (this.dependencies = i), |
| 775 | (this._callback = s), |
| 776 | (this._errorback = n), |
| 777 | (this.moduleIdResolver = l), |
| 778 | (this.exports = {}), |
| 779 | (this.error = null), |
| 780 | (this.exportsPassedIn = !1), |
| 781 | (this.unresolvedDependenciesCount = this.dependencies.length), |
| 782 | (this._isComplete = !1) |
| 783 | } |
| 784 | static _safeInvokeFunction(t, e) { |
| 785 | try { |
| 786 | return { returnedValue: t.apply(u.global, e), producedError: null } |
| 787 | } catch (i) { |
| 788 | return { returnedValue: null, producedError: i } |
| 789 | } |
| 790 | } |
| 791 | static _invokeFactory(t, e, i, s) { |
| 792 | return t.shouldInvokeFactory(e) |
| 793 | ? t.shouldCatchError() |
| 794 | ? this._safeInvokeFunction(i, s) |
| 795 | : { returnedValue: i.apply(u.global, s), producedError: null } |
| 796 | : { returnedValue: null, producedError: null } |
| 797 | } |
| 798 | complete(t, e, i, s) { |
| 799 | this._isComplete = !0 |
| 800 | let n = null |
| 801 | if (this._callback) |
| 802 | if (typeof this._callback == 'function') { |
| 803 | t.record(21, this.strId) |
| 804 | let l = m._invokeFactory(e, this.strId, this._callback, i) |
| 805 | ;(n = l.producedError), |
| 806 | t.record(22, this.strId), |
| 807 | !n && |
| 808 | typeof l.returnedValue < 'u' && |
| 809 | (!this.exportsPassedIn || u.Utilities.isEmpty(this.exports)) && |
| 810 | (this.exports = l.returnedValue) |
| 811 | } else this.exports = this._callback |
| 812 | if (n) { |
| 813 | let l = u.ensureError(n) |
| 814 | ;(l.phase = 'factory'), |
| 815 | (l.moduleId = this.strId), |
| 816 | (l.neededBy = s(this.id)), |
| 817 | (this.error = l), |
| 818 | e.onError(l) |
| 819 | } |
| 820 | ;(this.dependencies = null), |
| 821 | (this._callback = null), |
| 822 | (this._errorback = null), |
| 823 | (this.moduleIdResolver = null) |
| 824 | } |
| 825 | onDependencyError(t) { |
| 826 | return ( |
| 827 | (this._isComplete = !0), (this.error = t), this._errorback ? (this._errorback(t), !0) : !1 |
| 828 | ) |
| 829 | } |
| 830 | isComplete() { |
| 831 | return this._isComplete |
| 832 | } |
| 833 | } |
| 834 | u.Module = m |
| 835 | class p { |
| 836 | constructor() { |
| 837 | ;(this._nextId = 0), |
| 838 | (this._strModuleIdToIntModuleId = new Map()), |
| 839 | (this._intModuleIdToStrModuleId = []), |
| 840 | this.getModuleId('exports'), |
| 841 | this.getModuleId('module'), |
| 842 | this.getModuleId('require') |
| 843 | } |
| 844 | getMaxModuleId() { |
| 845 | return this._nextId |
| 846 | } |
| 847 | getModuleId(t) { |
| 848 | let e = this._strModuleIdToIntModuleId.get(t) |
| 849 | return ( |
| 850 | typeof e > 'u' && |
| 851 | ((e = this._nextId++), |
| 852 | this._strModuleIdToIntModuleId.set(t, e), |
| 853 | (this._intModuleIdToStrModuleId[e] = t)), |
| 854 | e |
| 855 | ) |
| 856 | } |
| 857 | getStrModuleId(t) { |
| 858 | return this._intModuleIdToStrModuleId[t] |
| 859 | } |
| 860 | } |
| 861 | class h { |
| 862 | constructor(t) { |
| 863 | this.id = t |
| 864 | } |
| 865 | } |
| 866 | ;(h.EXPORTS = new h(0)), (h.MODULE = new h(1)), (h.REQUIRE = new h(2)), (u.RegularDependency = h) |
| 867 | class r { |
| 868 | constructor(t, e, i) { |
| 869 | ;(this.id = t), (this.pluginId = e), (this.pluginParam = i) |
| 870 | } |
| 871 | } |
| 872 | u.PluginDependency = r |
| 873 | class c { |
| 874 | constructor(t, e, i, s, n = 0) { |
| 875 | ;(this._env = t), |
| 876 | (this._scriptLoader = e), |
| 877 | (this._loaderAvailableTimestamp = n), |
| 878 | (this._defineFunc = i), |
| 879 | (this._requireFunc = s), |
| 880 | (this._moduleIdProvider = new p()), |
| 881 | (this._config = new u.Configuration(this._env)), |
| 882 | (this._hasDependencyCycle = !1), |
| 883 | (this._modules2 = []), |
| 884 | (this._knownModules2 = []), |
| 885 | (this._inverseDependencies2 = []), |
| 886 | (this._inversePluginDependencies2 = new Map()), |
| 887 | (this._currentAnonymousDefineCall = null), |
| 888 | (this._recorder = null), |
| 889 | (this._buildInfoPath = []), |
| 890 | (this._buildInfoDefineStack = []), |
| 891 | (this._buildInfoDependencies = []) |
| 892 | } |
| 893 | reset() { |
| 894 | return new c( |
| 895 | this._env, |
| 896 | this._scriptLoader, |
| 897 | this._defineFunc, |
| 898 | this._requireFunc, |
| 899 | this._loaderAvailableTimestamp |
| 900 | ) |
| 901 | } |
| 902 | getGlobalAMDDefineFunc() { |
| 903 | return this._defineFunc |
| 904 | } |
| 905 | getGlobalAMDRequireFunc() { |
| 906 | return this._requireFunc |
| 907 | } |
| 908 | static _findRelevantLocationInStack(t, e) { |
| 909 | let i = (l) => l.replace(/\\/g, '/'), |
| 910 | s = i(t), |
| 911 | n = e.split(/\n/) |
| 912 | for (let l = 0; l < n.length; l++) { |
| 913 | let d = n[l].match(/(.*):(\d+):(\d+)\)?$/) |
| 914 | if (d) { |
| 915 | let o = d[1], |
| 916 | _ = d[2], |
| 917 | f = d[3], |
| 918 | g = Math.max(o.lastIndexOf(' ') + 1, o.lastIndexOf('(') + 1) |
| 919 | if (((o = o.substr(g)), (o = i(o)), o === s)) { |
| 920 | let v = { line: parseInt(_, 10), col: parseInt(f, 10) } |
| 921 | return v.line === 1 && (v.col -= 53), v |
| 922 | } |
| 923 | } |
| 924 | } |
| 925 | throw new Error('Could not correlate define call site for needle ' + t) |
| 926 | } |
| 927 | getBuildInfo() { |
| 928 | if (!this._config.isBuild()) return null |
| 929 | let t = [], |
| 930 | e = 0 |
| 931 | for (let i = 0, s = this._modules2.length; i < s; i++) { |
| 932 | let n = this._modules2[i] |
| 933 | if (!n) continue |
| 934 | let l = this._buildInfoPath[n.id] || null, |
| 935 | d = this._buildInfoDefineStack[n.id] || null, |
| 936 | o = this._buildInfoDependencies[n.id] |
| 937 | t[e++] = { |
| 938 | id: n.strId, |
| 939 | path: l, |
| 940 | defineLocation: l && d ? c._findRelevantLocationInStack(l, d) : null, |
| 941 | dependencies: o, |
| 942 | shim: null, |
| 943 | exports: n.exports, |
| 944 | } |
| 945 | } |
| 946 | return t |
| 947 | } |
| 948 | getRecorder() { |
| 949 | return ( |
| 950 | this._recorder || |
| 951 | (this._config.shouldRecordStats() |
| 952 | ? (this._recorder = new u.LoaderEventRecorder(this._loaderAvailableTimestamp)) |
| 953 | : (this._recorder = u.NullLoaderEventRecorder.INSTANCE)), |
| 954 | this._recorder |
| 955 | ) |
| 956 | } |
| 957 | getLoaderEvents() { |
| 958 | return this.getRecorder().getEvents() |
| 959 | } |
| 960 | enqueueDefineAnonymousModule(t, e) { |
| 961 | if (this._currentAnonymousDefineCall !== null) |
| 962 | throw new Error('Can only have one anonymous define call per script file') |
| 963 | let i = null |
| 964 | this._config.isBuild() && (i = new Error('StackLocation').stack || null), |
| 965 | (this._currentAnonymousDefineCall = { stack: i, dependencies: t, callback: e }) |
| 966 | } |
| 967 | defineModule(t, e, i, s, n, l = new y(t)) { |
| 968 | let d = this._moduleIdProvider.getModuleId(t) |
| 969 | if (this._modules2[d]) { |
| 970 | this._config.isDuplicateMessageIgnoredFor(t) || |
| 971 | console.warn("Duplicate definition of module '" + t + "'") |
| 972 | return |
| 973 | } |
| 974 | let o = new m(d, t, this._normalizeDependencies(e, l), i, s, l) |
| 975 | ;(this._modules2[d] = o), |
| 976 | this._config.isBuild() && |
| 977 | ((this._buildInfoDefineStack[d] = n), |
| 978 | (this._buildInfoDependencies[d] = (o.dependencies || []).map((_) => |
| 979 | this._moduleIdProvider.getStrModuleId(_.id) |
| 980 | ))), |
| 981 | this._resolve(o) |
| 982 | } |
| 983 | _normalizeDependency(t, e) { |
| 984 | if (t === 'exports') return h.EXPORTS |
| 985 | if (t === 'module') return h.MODULE |
| 986 | if (t === 'require') return h.REQUIRE |
| 987 | let i = t.indexOf('!') |
| 988 | if (i >= 0) { |
| 989 | let s = e.resolveModule(t.substr(0, i)), |
| 990 | n = e.resolveModule(t.substr(i + 1)), |
| 991 | l = this._moduleIdProvider.getModuleId(s + '!' + n), |
| 992 | d = this._moduleIdProvider.getModuleId(s) |
| 993 | return new r(l, d, n) |
| 994 | } |
| 995 | return new h(this._moduleIdProvider.getModuleId(e.resolveModule(t))) |
| 996 | } |
| 997 | _normalizeDependencies(t, e) { |
| 998 | let i = [], |
| 999 | s = 0 |
| 1000 | for (let n = 0, l = t.length; n < l; n++) i[s++] = this._normalizeDependency(t[n], e) |
| 1001 | return i |
| 1002 | } |
| 1003 | _relativeRequire(t, e, i, s) { |
| 1004 | if (typeof e == 'string') return this.synchronousRequire(e, t) |
| 1005 | this.defineModule(u.Utilities.generateAnonymousModule(), e, i, s, null, t) |
| 1006 | } |
| 1007 | synchronousRequire(t, e = new y(t)) { |
| 1008 | let i = this._normalizeDependency(t, e), |
| 1009 | s = this._modules2[i.id] |
| 1010 | if (!s) |
| 1011 | throw new Error( |
| 1012 | "Check dependency list! Synchronous require cannot resolve module '" + |
| 1013 | t + |
| 1014 | "'. This is the first mention of this module!" |
| 1015 | ) |
| 1016 | if (!s.isComplete()) |
| 1017 | throw new Error( |
| 1018 | "Check dependency list! Synchronous require cannot resolve module '" + |
| 1019 | t + |
| 1020 | "'. This module has not been resolved completely yet." |
| 1021 | ) |
| 1022 | if (s.error) throw s.error |
| 1023 | return s.exports |
| 1024 | } |
| 1025 | configure(t, e) { |
| 1026 | let i = this._config.shouldRecordStats() |
| 1027 | e |
| 1028 | ? (this._config = new u.Configuration(this._env, t)) |
| 1029 | : (this._config = this._config.cloneAndMerge(t)), |
| 1030 | this._config.shouldRecordStats() && !i && (this._recorder = null) |
| 1031 | } |
| 1032 | getConfig() { |
| 1033 | return this._config |
| 1034 | } |
| 1035 | _onLoad(t) { |
| 1036 | if (this._currentAnonymousDefineCall !== null) { |
| 1037 | let e = this._currentAnonymousDefineCall |
| 1038 | ;(this._currentAnonymousDefineCall = null), |
| 1039 | this.defineModule( |
| 1040 | this._moduleIdProvider.getStrModuleId(t), |
| 1041 | e.dependencies, |
| 1042 | e.callback, |
| 1043 | null, |
| 1044 | e.stack |
| 1045 | ) |
| 1046 | } |
| 1047 | } |
| 1048 | _createLoadError(t, e) { |
| 1049 | let i = this._moduleIdProvider.getStrModuleId(t), |
| 1050 | s = (this._inverseDependencies2[t] || []).map((l) => |
| 1051 | this._moduleIdProvider.getStrModuleId(l) |
| 1052 | ) |
| 1053 | const n = u.ensureError(e) |
| 1054 | return (n.phase = 'loading'), (n.moduleId = i), (n.neededBy = s), n |
| 1055 | } |
| 1056 | _onLoadError(t, e) { |
| 1057 | const i = this._createLoadError(t, e) |
| 1058 | this._modules2[t] || |
| 1059 | (this._modules2[t] = new m( |
| 1060 | t, |
| 1061 | this._moduleIdProvider.getStrModuleId(t), |
| 1062 | [], |
| 1063 | () => {}, |
| 1064 | null, |
| 1065 | null |
| 1066 | )) |
| 1067 | let s = [] |
| 1068 | for (let d = 0, o = this._moduleIdProvider.getMaxModuleId(); d < o; d++) s[d] = !1 |
| 1069 | let n = !1, |
| 1070 | l = [] |
| 1071 | for (l.push(t), s[t] = !0; l.length > 0; ) { |
| 1072 | let d = l.shift(), |
| 1073 | o = this._modules2[d] |
| 1074 | o && (n = o.onDependencyError(i) || n) |
| 1075 | let _ = this._inverseDependencies2[d] |
| 1076 | if (_) |
| 1077 | for (let f = 0, g = _.length; f < g; f++) { |
| 1078 | let v = _[f] |
| 1079 | s[v] || (l.push(v), (s[v] = !0)) |
| 1080 | } |
| 1081 | } |
| 1082 | n || this._config.onError(i) |
| 1083 | } |
| 1084 | _hasDependencyPath(t, e) { |
| 1085 | let i = this._modules2[t] |
| 1086 | if (!i) return !1 |
| 1087 | let s = [] |
| 1088 | for (let l = 0, d = this._moduleIdProvider.getMaxModuleId(); l < d; l++) s[l] = !1 |
| 1089 | let n = [] |
| 1090 | for (n.push(i), s[t] = !0; n.length > 0; ) { |
| 1091 | let d = n.shift().dependencies |
| 1092 | if (d) |
| 1093 | for (let o = 0, _ = d.length; o < _; o++) { |
| 1094 | let f = d[o] |
| 1095 | if (f.id === e) return !0 |
| 1096 | let g = this._modules2[f.id] |
| 1097 | g && !s[f.id] && ((s[f.id] = !0), n.push(g)) |
| 1098 | } |
| 1099 | } |
| 1100 | return !1 |
| 1101 | } |
| 1102 | _findCyclePath(t, e, i) { |
| 1103 | if (t === e || i === 50) return [t] |
| 1104 | let s = this._modules2[t] |
| 1105 | if (!s) return null |
| 1106 | let n = s.dependencies |
| 1107 | if (n) |
| 1108 | for (let l = 0, d = n.length; l < d; l++) { |
| 1109 | let o = this._findCyclePath(n[l].id, e, i + 1) |
| 1110 | if (o !== null) return o.push(t), o |
| 1111 | } |
| 1112 | return null |
| 1113 | } |
| 1114 | _createRequire(t) { |
| 1115 | let e = (i, s, n) => this._relativeRequire(t, i, s, n) |
| 1116 | return ( |
| 1117 | (e.toUrl = (i) => this._config.requireToUrl(t.resolveModule(i))), |
| 1118 | (e.getStats = () => this.getLoaderEvents()), |
| 1119 | (e.hasDependencyCycle = () => this._hasDependencyCycle), |
| 1120 | (e.config = (i, s = !1) => { |
| 1121 | this.configure(i, s) |
| 1122 | }), |
| 1123 | (e.__$__nodeRequire = u.global.nodeRequire), |
| 1124 | e |
| 1125 | ) |
| 1126 | } |
| 1127 | _loadModule(t) { |
| 1128 | if (this._modules2[t] || this._knownModules2[t]) return |
| 1129 | this._knownModules2[t] = !0 |
| 1130 | let e = this._moduleIdProvider.getStrModuleId(t), |
| 1131 | i = this._config.moduleIdToPaths(e), |
| 1132 | s = /^@[^\/]+\/[^\/]+$/ |
| 1133 | this._env.isNode && (e.indexOf('/') === -1 || s.test(e)) && i.push('node|' + e) |
| 1134 | let n = -1, |
| 1135 | l = (d) => { |
| 1136 | if ((n++, n >= i.length)) this._onLoadError(t, d) |
| 1137 | else { |
| 1138 | let o = i[n], |
| 1139 | _ = this.getRecorder() |
| 1140 | if (this._config.isBuild() && o === 'empty:') { |
| 1141 | ;(this._buildInfoPath[t] = o), |
| 1142 | this.defineModule(this._moduleIdProvider.getStrModuleId(t), [], null, null, null), |
| 1143 | this._onLoad(t) |
| 1144 | return |
| 1145 | } |
| 1146 | _.record(10, o), |
| 1147 | this._scriptLoader.load( |
| 1148 | this, |
| 1149 | o, |
| 1150 | () => { |
| 1151 | this._config.isBuild() && (this._buildInfoPath[t] = o), |
| 1152 | _.record(11, o), |
| 1153 | this._onLoad(t) |
| 1154 | }, |
| 1155 | (f) => { |
| 1156 | _.record(12, o), l(f) |
| 1157 | } |
| 1158 | ) |
| 1159 | } |
| 1160 | } |
| 1161 | l(null) |
| 1162 | } |
| 1163 | _loadPluginDependency(t, e) { |
| 1164 | if (this._modules2[e.id] || this._knownModules2[e.id]) return |
| 1165 | this._knownModules2[e.id] = !0 |
| 1166 | let i = (s) => { |
| 1167 | this.defineModule(this._moduleIdProvider.getStrModuleId(e.id), [], s, null, null) |
| 1168 | } |
| 1169 | ;(i.error = (s) => { |
| 1170 | this._config.onError(this._createLoadError(e.id, s)) |
| 1171 | }), |
| 1172 | t.load(e.pluginParam, this._createRequire(y.ROOT), i, this._config.getOptionsLiteral()) |
| 1173 | } |
| 1174 | _resolve(t) { |
| 1175 | let e = t.dependencies |
| 1176 | if (e) |
| 1177 | for (let i = 0, s = e.length; i < s; i++) { |
| 1178 | let n = e[i] |
| 1179 | if (n === h.EXPORTS) { |
| 1180 | ;(t.exportsPassedIn = !0), t.unresolvedDependenciesCount-- |
| 1181 | continue |
| 1182 | } |
| 1183 | if (n === h.MODULE) { |
| 1184 | t.unresolvedDependenciesCount-- |
| 1185 | continue |
| 1186 | } |
| 1187 | if (n === h.REQUIRE) { |
| 1188 | t.unresolvedDependenciesCount-- |
| 1189 | continue |
| 1190 | } |
| 1191 | let l = this._modules2[n.id] |
| 1192 | if (l && l.isComplete()) { |
| 1193 | if (l.error) { |
| 1194 | t.onDependencyError(l.error) |
| 1195 | return |
| 1196 | } |
| 1197 | t.unresolvedDependenciesCount-- |
| 1198 | continue |
| 1199 | } |
| 1200 | if (this._hasDependencyPath(n.id, t.id)) { |
| 1201 | ;(this._hasDependencyCycle = !0), |
| 1202 | console.warn( |
| 1203 | "There is a dependency cycle between '" + |
| 1204 | this._moduleIdProvider.getStrModuleId(n.id) + |
| 1205 | "' and '" + |
| 1206 | this._moduleIdProvider.getStrModuleId(t.id) + |
| 1207 | "'. The cyclic path follows:" |
| 1208 | ) |
| 1209 | let d = this._findCyclePath(n.id, t.id, 0) || [] |
| 1210 | d.reverse(), |
| 1211 | d.push(n.id), |
| 1212 | console.warn( |
| 1213 | d.map((o) => this._moduleIdProvider.getStrModuleId(o)).join(` => |
| 1214 | `) |
| 1215 | ), |
| 1216 | t.unresolvedDependenciesCount-- |
| 1217 | continue |
| 1218 | } |
| 1219 | if ( |
| 1220 | ((this._inverseDependencies2[n.id] = this._inverseDependencies2[n.id] || []), |
| 1221 | this._inverseDependencies2[n.id].push(t.id), |
| 1222 | n instanceof r) |
| 1223 | ) { |
| 1224 | let d = this._modules2[n.pluginId] |
| 1225 | if (d && d.isComplete()) { |
| 1226 | this._loadPluginDependency(d.exports, n) |
| 1227 | continue |
| 1228 | } |
| 1229 | let o = this._inversePluginDependencies2.get(n.pluginId) |
| 1230 | o || ((o = []), this._inversePluginDependencies2.set(n.pluginId, o)), |
| 1231 | o.push(n), |
| 1232 | this._loadModule(n.pluginId) |
| 1233 | continue |
| 1234 | } |
| 1235 | this._loadModule(n.id) |
| 1236 | } |
| 1237 | t.unresolvedDependenciesCount === 0 && this._onModuleComplete(t) |
| 1238 | } |
| 1239 | _onModuleComplete(t) { |
| 1240 | let e = this.getRecorder() |
| 1241 | if (t.isComplete()) return |
| 1242 | let i = t.dependencies, |
| 1243 | s = [] |
| 1244 | if (i) |
| 1245 | for (let o = 0, _ = i.length; o < _; o++) { |
| 1246 | let f = i[o] |
| 1247 | if (f === h.EXPORTS) { |
| 1248 | s[o] = t.exports |
| 1249 | continue |
| 1250 | } |
| 1251 | if (f === h.MODULE) { |
| 1252 | s[o] = { id: t.strId, config: () => this._config.getConfigForModule(t.strId) } |
| 1253 | continue |
| 1254 | } |
| 1255 | if (f === h.REQUIRE) { |
| 1256 | s[o] = this._createRequire(t.moduleIdResolver) |
| 1257 | continue |
| 1258 | } |
| 1259 | let g = this._modules2[f.id] |
| 1260 | if (g) { |
| 1261 | s[o] = g.exports |
| 1262 | continue |
| 1263 | } |
| 1264 | s[o] = null |
| 1265 | } |
| 1266 | const n = (o) => |
| 1267 | (this._inverseDependencies2[o] || []).map((_) => this._moduleIdProvider.getStrModuleId(_)) |
| 1268 | t.complete(e, this._config, s, n) |
| 1269 | let l = this._inverseDependencies2[t.id] |
| 1270 | if (((this._inverseDependencies2[t.id] = null), l)) |
| 1271 | for (let o = 0, _ = l.length; o < _; o++) { |
| 1272 | let f = l[o], |
| 1273 | g = this._modules2[f] |
| 1274 | g.unresolvedDependenciesCount--, |
| 1275 | g.unresolvedDependenciesCount === 0 && this._onModuleComplete(g) |
| 1276 | } |
| 1277 | let d = this._inversePluginDependencies2.get(t.id) |
| 1278 | if (d) { |
| 1279 | this._inversePluginDependencies2.delete(t.id) |
| 1280 | for (let o = 0, _ = d.length; o < _; o++) this._loadPluginDependency(t.exports, d[o]) |
| 1281 | } |
| 1282 | } |
| 1283 | } |
| 1284 | u.ModuleManager = c |
| 1285 | })(AMDLoader || (AMDLoader = {})) |
| 1286 | var define, AMDLoader |
| 1287 | ;(function (u) { |
| 1288 | const y = new u.Environment() |
| 1289 | let m = null |
| 1290 | const p = function (a, t, e) { |
| 1291 | typeof a != 'string' && ((e = t), (t = a), (a = null)), |
| 1292 | (typeof t != 'object' || !Array.isArray(t)) && ((e = t), (t = null)), |
| 1293 | t || (t = ['require', 'exports', 'module']), |
| 1294 | a ? m.defineModule(a, t, e, null, null) : m.enqueueDefineAnonymousModule(t, e) |
| 1295 | } |
| 1296 | p.amd = { jQuery: !0 } |
| 1297 | const h = function (a, t = !1) { |
| 1298 | m.configure(a, t) |
| 1299 | }, |
| 1300 | r = function () { |
| 1301 | if (arguments.length === 1) { |
| 1302 | if (arguments[0] instanceof Object && !Array.isArray(arguments[0])) { |
| 1303 | h(arguments[0]) |
| 1304 | return |
| 1305 | } |
| 1306 | if (typeof arguments[0] == 'string') return m.synchronousRequire(arguments[0]) |
| 1307 | } |
| 1308 | if ((arguments.length === 2 || arguments.length === 3) && Array.isArray(arguments[0])) { |
| 1309 | m.defineModule( |
| 1310 | u.Utilities.generateAnonymousModule(), |
| 1311 | arguments[0], |
| 1312 | arguments[1], |
| 1313 | arguments[2], |
| 1314 | null |
| 1315 | ) |
| 1316 | return |
| 1317 | } |
| 1318 | throw new Error('Unrecognized require call') |
| 1319 | } |
| 1320 | ;(r.config = h), |
| 1321 | (r.getConfig = function () { |
| 1322 | return m.getConfig().getOptionsLiteral() |
| 1323 | }), |
| 1324 | (r.reset = function () { |
| 1325 | m = m.reset() |
| 1326 | }), |
| 1327 | (r.getBuildInfo = function () { |
| 1328 | return m.getBuildInfo() |
| 1329 | }), |
| 1330 | (r.getStats = function () { |
| 1331 | return m.getLoaderEvents() |
| 1332 | }), |
| 1333 | (r.define = p) |
| 1334 | function c() { |
| 1335 | if (typeof u.global.require < 'u' || typeof require < 'u') { |
| 1336 | const a = u.global.require || require |
| 1337 | if (typeof a == 'function' && typeof a.resolve == 'function') { |
| 1338 | const t = u.ensureRecordedNodeRequire(m.getRecorder(), a) |
| 1339 | ;(u.global.nodeRequire = t), (r.nodeRequire = t), (r.__$__nodeRequire = t) |
| 1340 | } |
| 1341 | } |
| 1342 | y.isNode && !y.isElectronRenderer && !y.isElectronNodeIntegrationWebWorker |
| 1343 | ? (module.exports = r) |
| 1344 | : (y.isElectronRenderer || (u.global.define = p), (u.global.require = r)) |
| 1345 | } |
| 1346 | ;(u.init = c), |
| 1347 | (typeof u.global.define != 'function' || !u.global.define.amd) && |
| 1348 | ((m = new u.ModuleManager( |
| 1349 | y, |
| 1350 | u.createScriptLoader(y), |
| 1351 | p, |
| 1352 | r, |
| 1353 | u.Utilities.getHighPerformanceTimestamp() |
| 1354 | )), |
| 1355 | typeof u.global.require < 'u' && |
| 1356 | typeof u.global.require != 'function' && |
| 1357 | r.config(u.global.require), |
| 1358 | (define = function () { |
| 1359 | return p.apply(null, arguments) |
| 1360 | }), |
| 1361 | (define.amd = p.amd), |
| 1362 | typeof doNotInitLoader > 'u' && c()) |
| 1363 | })(AMDLoader || (AMDLoader = {})) |
| 1364 | |
| 1365 | //# sourceMappingURL=../../min-maps/vs/loader.js.map |