@zntc/react-native 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1065 -1065
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -104,60 +104,16 @@ const URI_REGEX = /^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
104
104
  }
105
105
  });
106
106
  //#endregion
107
- //#region (disabled):url
108
- var require__disabled__url = __commonJS({
109
- "(disabled):url"(exports, module) {
110
- }
111
- });
112
- //#endregion
113
- //#region array-set.js
114
- var require_source_map_lib_array_set = __commonJS({
115
- "array-set.js"(exports, module) {
116
- class ArraySet {
117
- constructor() {
118
- this._array = [];
119
- this._set = new Map();
120
- }
121
- static fromArray(aArray,aAllowDuplicates) {
122
- const set = new ArraySet();
123
- for (let i = 0,len = aArray.length; i < len; i++) {
124
- set.add(aArray[i], aAllowDuplicates);
125
- }
126
- return set;
127
- }
128
- size() {
129
- return this._set.size;
130
- }
131
- add(aStr,aAllowDuplicates) {
132
- const isDuplicate = this.has(aStr),idx = this._array.length;
133
- if (!isDuplicate || aAllowDuplicates) {
134
- this._array.push(aStr);
135
- }
136
- if (!isDuplicate) {
137
- this._set.set(aStr, idx);
138
- }
139
- }
140
- has(aStr) {
141
- return this._set.has(aStr);
142
- }
143
- indexOf(aStr) {
144
- const idx = this._set.get(aStr);
145
- if (idx >= 0) {
146
- return idx;
147
- }
148
- throw new Error("\"" + aStr + "\" is not in the set.");
149
- }
150
- at(aIdx) {
151
- if (aIdx >= 0 && aIdx < this._array.length) {
152
- return this._array[aIdx];
153
- }
154
- throw new Error("No element indexed by " + aIdx);
155
- }
156
- toArray() {
157
- return this._array.slice();
107
+ //#region base64.js
108
+ var require_source_map_lib_base64 = __commonJS({
109
+ "base64.js"(exports, module) {
110
+ const intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
111
+ exports.encode = function(number) {
112
+ if (0 <= number && number < intToCharMap.length) {
113
+ return intToCharMap[number];
158
114
  }
159
- }
160
- exports.ArraySet = ArraySet;
115
+ throw new TypeError("Must be between 0 and 63: " + number);
116
+ };
161
117
 
162
118
  }
163
119
  });
@@ -185,661 +141,420 @@ const base64 = require_source_map_lib_base64(),VLQ_BASE_SHIFT = 5,VLQ_BASE = 1 <
185
141
  }
186
142
  });
187
143
  //#endregion
188
- //#region base64.js
189
- var require_source_map_lib_base64 = __commonJS({
190
- "base64.js"(exports, module) {
191
- const intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
192
- exports.encode = function(number) {
193
- if (0 <= number && number < intToCharMap.length) {
194
- return intToCharMap[number];
195
- }
196
- throw new TypeError("Must be between 0 and 63: " + number);
197
- };
144
+ //#region (disabled):url
145
+ var require__disabled__url = __commonJS({
146
+ "(disabled):url"(exports, module) {
147
+ }
148
+ });
149
+ //#endregion
150
+ //#region url.js
151
+ var require_source_map_lib_url = __commonJS({
152
+ "url.js"(exports, module) {
153
+ "use strict";
154
+ module.exports = typeof URL == "function" ? URL : require__disabled__url().URL;
198
155
 
199
156
  }
200
157
  });
201
158
  //#endregion
202
- //#region binary-search.js
203
- var require_source_map_lib_binary_search = __commonJS({
204
- "binary-search.js"(exports, module) {
205
- exports.GREATEST_LOWER_BOUND = 1;
206
- exports.LEAST_UPPER_BOUND = 2;
207
- function recursiveSearch(aLow,aHigh,aNeedle,aHaystack,aCompare,aBias) {
208
- const mid = Math.floor((aHigh - aLow) / 2) + aLow,cmp = aCompare(aNeedle, aHaystack[mid], true);
209
- if (cmp === 0) {
210
- return mid;
211
- } else if (cmp > 0) {
212
- if (aHigh - mid > 1) {
213
- return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
214
- }
215
- if (aBias === exports.LEAST_UPPER_BOUND) {
216
- return aHigh < aHaystack.length ? aHigh : -1;
217
- }
218
- return mid;
159
+ //#region util.js
160
+ var require_source_map_lib_util = __commonJS({
161
+ "util.js"(exports, module) {
162
+ const URL = require_source_map_lib_url();
163
+ function getArg(aArgs,aName,aDefaultValue) {
164
+ if (aName in aArgs) {
165
+ return aArgs[aName];
166
+ } else if (arguments.length === 3) {
167
+ return aDefaultValue;
219
168
  }
220
- if (mid - aLow > 1) {
221
- return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
169
+ throw new Error("\"" + aName + "\" is a required argument.");
170
+ }
171
+ exports.getArg = getArg;
172
+ const supportsNullProto = (function() {
173
+ const obj = Object.create(null);
174
+ return !("__proto__" in obj);
175
+ })();
176
+ function identity(s) {
177
+ return s;
178
+ }
179
+ function toSetString(aStr) {
180
+ if (isProtoString(aStr)) {
181
+ return "$" + aStr;
222
182
  }
223
- if (aBias == exports.LEAST_UPPER_BOUND) {
224
- return mid;
183
+ return aStr;
184
+ }
185
+ exports.toSetString = supportsNullProto ? identity : toSetString;
186
+ function fromSetString(aStr) {
187
+ if (isProtoString(aStr)) {
188
+ return aStr.slice(1);
225
189
  }
226
- return aLow < 0 ? -1 : aLow;
190
+ return aStr;
227
191
  }
228
- exports.search = function search(aNeedle,aHaystack,aCompare,aBias) {
229
- if (aHaystack.length === 0) {
230
- return -1;
192
+ exports.fromSetString = supportsNullProto ? identity : fromSetString;
193
+ function isProtoString(s) {
194
+ if (!s) {
195
+ return false;
231
196
  }
232
- let index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports.GREATEST_LOWER_BOUND);
233
- if (index < 0) {
234
- return -1;
197
+ const length = s.length;
198
+ if (length < 9) {
199
+ return false;
235
200
  }
236
- while (index - 1 >= 0) {
237
- if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
238
- break;
201
+ if (s.charCodeAt(length - 1) !== 95 || s.charCodeAt(length - 2) !== 95 || s.charCodeAt(length - 3) !== 111 || s.charCodeAt(length - 4) !== 116 || s.charCodeAt(length - 5) !== 111 || s.charCodeAt(length - 6) !== 114 || s.charCodeAt(length - 7) !== 112 || s.charCodeAt(length - 8) !== 95 || s.charCodeAt(length - 9) !== 95) {
202
+ return false;
203
+ }
204
+ for (let i = length - 10; i >= 0; i--) {
205
+ if (s.charCodeAt(i) !== 36) {
206
+ return false;
239
207
  }
240
- --index;
241
208
  }
242
- return index;
243
- };
244
-
245
- }
246
- });
247
- //#endregion
248
- //#region mapping-list.js
249
- var require_source_map_lib_mapping_list = __commonJS({
250
- "mapping-list.js"(exports, module) {
251
- const util = require_source_map_lib_util();
252
- function generatedPositionAfter(mappingA,mappingB) {
253
- const lineA = mappingA.generatedLine,lineB = mappingB.generatedLine,columnA = mappingA.generatedColumn,columnB = mappingB.generatedColumn;
254
- return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
209
+ return true;
255
210
  }
256
- class MappingList {
257
- constructor() {
258
- this._array = [];
259
- this._sorted = true;
260
- this._last = { generatedLine: -1, generatedColumn: 0 };
211
+ function strcmp(aStr1,aStr2) {
212
+ if (aStr1 === aStr2) {
213
+ return 0;
261
214
  }
262
- unsortedForEach(aCallback,aThisArg) {
263
- this._array.forEach(aCallback, aThisArg);
215
+ if (aStr1 === null) {
216
+ return 1;
264
217
  }
265
- add(aMapping) {
266
- if (generatedPositionAfter(this._last, aMapping)) {
267
- this._last = aMapping;
268
- this._array.push(aMapping);
269
- } else {
270
- this._sorted = false;
271
- this._array.push(aMapping);
272
- }
218
+ if (aStr2 === null) {
219
+ return -1;
273
220
  }
274
- toArray() {
275
- if (!this._sorted) {
276
- this._array.sort(util.compareByGeneratedPositionsInflated);
277
- this._sorted = true;
278
- }
279
- return this._array;
221
+ if (aStr1 > aStr2) {
222
+ return 1;
280
223
  }
224
+ return -1;
281
225
  }
282
- exports.MappingList = MappingList;
283
-
284
- }
285
- });
286
- //#endregion
287
- //#region read-wasm-browser.js
288
- var require_source_map_lib_read_wasm_browser = __commonJS({
289
- "read-wasm-browser.js"(exports, module) {
290
- "use strict";
291
- let mappingsWasm = null;
292
- module.exports = function readWasm() {
293
- if (typeof mappingsWasm == "string") {
294
- return fetch(mappingsWasm).then((response) => response.arrayBuffer());
226
+ function compareByGeneratedPositionsInflated(mappingA,mappingB) {
227
+ let cmp = mappingA.generatedLine - mappingB.generatedLine;
228
+ if (cmp !== 0) {
229
+ return cmp;
295
230
  }
296
- if (mappingsWasm instanceof ArrayBuffer) {
297
- return Promise.resolve(mappingsWasm);
231
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
232
+ if (cmp !== 0) {
233
+ return cmp;
298
234
  }
299
- throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer");
300
- };
301
- module.exports.initialize = (input) => {
302
- mappingsWasm = input;
303
- };
304
-
305
- }
306
- });
307
- //#endregion
308
- //#region source-map-consumer.js
309
- var require_source_map_lib_source_map_consumer = __commonJS({
310
- "source-map-consumer.js"(exports, module) {
311
- const util = require_source_map_lib_util(),binarySearch = require_source_map_lib_binary_search(),ArraySet = require_source_map_lib_array_set().ArraySet,base64VLQ = require_source_map_lib_base64_vlq(),readWasm = require_source_map_lib_read_wasm_browser(),wasm = require_source_map_lib_wasm(),INTERNAL = Symbol("smcInternal");
312
- class SourceMapConsumer {
313
- constructor(aSourceMap,aSourceMapURL) {
314
- if (aSourceMap == INTERNAL) {
315
- return Promise.resolve(this);
316
- }
317
- return _factory(aSourceMap, aSourceMapURL);
235
+ cmp = strcmp(mappingA.source, mappingB.source);
236
+ if (cmp !== 0) {
237
+ return cmp;
318
238
  }
319
- static initialize(opts) {
320
- readWasm.initialize(opts["lib/mappings.wasm"]);
239
+ cmp = mappingA.originalLine - mappingB.originalLine;
240
+ if (cmp !== 0) {
241
+ return cmp;
321
242
  }
322
- static fromSourceMap(aSourceMap,aSourceMapURL) {
323
- return _factoryBSM(aSourceMap, aSourceMapURL);
243
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
244
+ if (cmp !== 0) {
245
+ return cmp;
324
246
  }
325
- static async with(rawSourceMap,sourceMapUrl,f) {
326
- const consumer = await new SourceMapConsumer(rawSourceMap, sourceMapUrl);
327
- try {
328
- return await f(consumer);
329
- } finally {
330
- consumer.destroy();
247
+ return strcmp(mappingA.name, mappingB.name);
248
+ }
249
+ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
250
+ function parseSourceMapInput(str) {
251
+ return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
252
+ }
253
+ exports.parseSourceMapInput = parseSourceMapInput;
254
+ const PROTOCOL = "http:",PROTOCOL_AND_HOST = `${PROTOCOL}//host`;
255
+ function createSafeHandler(cb) {
256
+ return (input) => {
257
+ const type = getURLType(input),base = buildSafeBase(input),url = new URL(input, base);
258
+ cb(url);
259
+ const result = url.toString();
260
+ if (type === "absolute") {
261
+ return result;
262
+ } else if (type === "scheme-relative") {
263
+ return result.slice(PROTOCOL.length);
264
+ } else if (type === "path-absolute") {
265
+ return result.slice(PROTOCOL_AND_HOST.length);
331
266
  }
267
+ return computeRelativeURL(base, result);
268
+ };
269
+ }
270
+ function withBase(url,base) {
271
+ return new URL(url, base).toString();
272
+ }
273
+ function buildUniqueSegment(prefix,str) {
274
+ let id = 0;
275
+ do {
276
+ const ident = prefix + id++;
277
+ if (str.indexOf(ident) === -1)return ident;
278
+ } while (true);
279
+ }
280
+ function buildSafeBase(str) {
281
+ const maxDotParts = str.split("..").length - 1,segment = buildUniqueSegment("p", str);
282
+ let base = `${PROTOCOL_AND_HOST}/`;
283
+ for (let i = 0; i < maxDotParts; i++) {
284
+ base += `${segment}/`;
332
285
  }
333
- eachMapping(aCallback,aContext,aOrder) {
334
- throw new Error("Subclasses must implement eachMapping");
286
+ return base;
287
+ }
288
+ const ABSOLUTE_SCHEME = /^[A-Za-z0-9\+\-\.]+:/;
289
+ function getURLType(url) {
290
+ if (url[0] === "/") {
291
+ if (url[1] === "/")return "scheme-relative";
292
+ return "path-absolute";
335
293
  }
336
- allGeneratedPositionsFor(aArgs) {
337
- throw new Error("Subclasses must implement allGeneratedPositionsFor");
294
+ return ABSOLUTE_SCHEME.test(url) ? "absolute" : "path-relative";
295
+ }
296
+ function computeRelativeURL(rootURL,targetURL) {
297
+ if (typeof rootURL == "string")rootURL = new URL(rootURL);
298
+ if (typeof targetURL == "string")targetURL = new URL(targetURL);
299
+ const targetParts = targetURL.pathname.split("/"),rootParts = rootURL.pathname.split("/");
300
+ if (rootParts.length > 0 && !rootParts[rootParts.length - 1]) {
301
+ rootParts.pop();
338
302
  }
339
- destroy() {
340
- throw new Error("Subclasses must implement destroy");
303
+ while (targetParts.length > 0 && rootParts.length > 0 && targetParts[0] === rootParts[0]) {
304
+ targetParts.shift();
305
+ rootParts.shift();
341
306
  }
307
+ const relativePath = rootParts.map(() => "..").concat(targetParts).join("/");
308
+ return relativePath + targetURL.search + targetURL.hash;
342
309
  }
343
- SourceMapConsumer.prototype._version = 3;
344
- SourceMapConsumer.GENERATED_ORDER = 1;
345
- SourceMapConsumer.ORIGINAL_ORDER = 2;
346
- SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
347
- SourceMapConsumer.LEAST_UPPER_BOUND = 2;
348
- exports.SourceMapConsumer = SourceMapConsumer;
349
- class BasicSourceMapConsumer extends SourceMapConsumer {
350
- constructor(aSourceMap,aSourceMapURL) {
351
- return super(INTERNAL).then((that) => {
352
- let sourceMap = aSourceMap;
353
- if (typeof aSourceMap == "string") {
354
- sourceMap = util.parseSourceMapInput(aSourceMap);
355
- }
356
- const version = util.getArg(sourceMap, "version"),sources = util.getArg(sourceMap, "sources").map(String),names = util.getArg(sourceMap, "names", []),sourceRoot = util.getArg(sourceMap, "sourceRoot", null),sourcesContent = util.getArg(sourceMap, "sourcesContent", null),mappings = util.getArg(sourceMap, "mappings"),file = util.getArg(sourceMap, "file", null),x_google_ignoreList = util.getArg(sourceMap, "x_google_ignoreList", null);
357
- if (version != that._version) {
358
- throw new Error("Unsupported version: " + version);
359
- }
360
- that._sourceLookupCache = new Map();
361
- that._names = ArraySet.fromArray(names.map(String), true);
362
- that._sources = ArraySet.fromArray(sources, true);
363
- that._absoluteSources = ArraySet.fromArray(that._sources.toArray().map(function(s) {
364
- return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
365
- }), true);
366
- that.sourceRoot = sourceRoot;
367
- that.sourcesContent = sourcesContent;
368
- that._mappings = mappings;
369
- that._sourceMapURL = aSourceMapURL;
370
- that.file = file;
371
- that.x_google_ignoreList = x_google_ignoreList;
372
- that._computedColumnSpans = false;
373
- that._mappingsPtr = 0;
374
- that._wasm = null;
375
- return wasm().then((w) => {
376
- that._wasm = w;
377
- return that;
378
- });
379
- });
310
+ const ensureDirectory = createSafeHandler((url) => {
311
+ url.pathname = url.pathname.replace(/\/?$/, "/");
312
+ }),trimFilename = createSafeHandler((url) => {
313
+ url.href = new URL(".", url.toString()).toString();
314
+ }),normalize = createSafeHandler((url) => {
315
+ });
316
+ exports.normalize = normalize;
317
+ function join(aRoot,aPath) {
318
+ const pathType = getURLType(aPath),rootType = getURLType(aRoot);
319
+ aRoot = ensureDirectory(aRoot);
320
+ if (pathType === "absolute") {
321
+ return withBase(aPath, undefined);
380
322
  }
381
- _findSourceIndex(aSource) {
382
- const cachedIndex = this._sourceLookupCache.get(aSource);
383
- if (typeof cachedIndex == "number") {
384
- return cachedIndex;
385
- }
386
- const sourceAsMapRelative = util.computeSourceURL(null, aSource, this._sourceMapURL);
387
- if (this._absoluteSources.has(sourceAsMapRelative)) {
388
- const index = this._absoluteSources.indexOf(sourceAsMapRelative);
389
- this._sourceLookupCache.set(aSource, index);
390
- return index;
391
- }
392
- const sourceAsSourceRootRelative = util.computeSourceURL(this.sourceRoot, aSource, this._sourceMapURL);
393
- if (this._absoluteSources.has(sourceAsSourceRootRelative)) {
394
- const index = this._absoluteSources.indexOf(sourceAsSourceRootRelative);
395
- this._sourceLookupCache.set(aSource, index);
396
- return index;
397
- }
398
- return -1;
323
+ if (rootType === "absolute") {
324
+ return withBase(aPath, aRoot);
399
325
  }
400
- static fromSourceMap(aSourceMap,aSourceMapURL) {
401
- return new BasicSourceMapConsumer(aSourceMap.toString());
326
+ if (pathType === "scheme-relative") {
327
+ return normalize(aPath);
402
328
  }
403
- get sources() {
404
- return this._absoluteSources.toArray();
329
+ if (rootType === "scheme-relative") {
330
+ return withBase(aPath, withBase(aRoot, PROTOCOL_AND_HOST)).slice(PROTOCOL.length);
405
331
  }
406
- _getMappingsPtr() {
407
- if (this._mappingsPtr === 0) {
408
- this._parseMappings();
332
+ if (pathType === "path-absolute") {
333
+ return normalize(aPath);
334
+ }
335
+ if (rootType === "path-absolute") {
336
+ return withBase(aPath, withBase(aRoot, PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);
337
+ }
338
+ const base = buildSafeBase(aPath + aRoot),newPath = withBase(aPath, withBase(aRoot, base));
339
+ return computeRelativeURL(base, newPath);
340
+ }
341
+ exports.join = join;
342
+ function relative(rootURL,targetURL) {
343
+ const result = relativeIfPossible(rootURL, targetURL);
344
+ return typeof result == "string" ? result : normalize(targetURL);
345
+ }
346
+ exports.relative = relative;
347
+ function relativeIfPossible(rootURL,targetURL) {
348
+ const urlType = getURLType(rootURL);
349
+ if (urlType !== getURLType(targetURL)) {
350
+ return null;
351
+ }
352
+ const base = buildSafeBase(rootURL + targetURL),root = new URL(rootURL, base),target = new URL(targetURL, base);
353
+ try {
354
+ new URL("", target.toString());
355
+ } catch (err) {
356
+ return null;
357
+ }
358
+ if (target.protocol !== root.protocol || target.user !== root.user || target.password !== root.password || target.hostname !== root.hostname || target.port !== root.port) {
359
+ return null;
360
+ }
361
+ return computeRelativeURL(root, target);
362
+ }
363
+ function computeSourceURL(sourceRoot,sourceURL,sourceMapURL) {
364
+ if (sourceRoot && getURLType(sourceURL) === "path-absolute") {
365
+ sourceURL = sourceURL.replace(/^\//, "");
366
+ }
367
+ let url = normalize(sourceURL || "");
368
+ if (sourceRoot)url = join(sourceRoot, url);
369
+ if (sourceMapURL)url = join(trimFilename(sourceMapURL), url);
370
+ return url;
371
+ }
372
+ exports.computeSourceURL = computeSourceURL;
373
+
374
+ }
375
+ });
376
+ //#endregion
377
+ //#region array-set.js
378
+ var require_source_map_lib_array_set = __commonJS({
379
+ "array-set.js"(exports, module) {
380
+ class ArraySet {
381
+ constructor() {
382
+ this._array = [];
383
+ this._set = new Map();
384
+ }
385
+ static fromArray(aArray,aAllowDuplicates) {
386
+ const set = new ArraySet();
387
+ for (let i = 0,len = aArray.length; i < len; i++) {
388
+ set.add(aArray[i], aAllowDuplicates);
409
389
  }
410
- return this._mappingsPtr;
390
+ return set;
411
391
  }
412
- _parseMappings() {
413
- const aStr = this._mappings,size = aStr.length,mappingsBufPtr = this._wasm.exports.allocate_mappings(size) >>> 0,mappingsBuf = new Uint8Array(this._wasm.exports.memory.buffer, mappingsBufPtr, size);
414
- for (let i = 0; i < size; i++) {
415
- mappingsBuf[i] = aStr.charCodeAt(i);
392
+ size() {
393
+ return this._set.size;
394
+ }
395
+ add(aStr,aAllowDuplicates) {
396
+ const isDuplicate = this.has(aStr),idx = this._array.length;
397
+ if (!isDuplicate || aAllowDuplicates) {
398
+ this._array.push(aStr);
416
399
  }
417
- const mappingsPtr = this._wasm.exports.parse_mappings(mappingsBufPtr);
418
- if (!mappingsPtr) {
419
- const error = this._wasm.exports.get_last_error();
420
- let msg = `Error parsing mappings (code ${error}): `;
421
- switch (error) {
422
- case 1:
423
- msg += "the mappings contained a negative line, column, source index, or name index";
424
- break;
425
- case 2:
426
- msg += "the mappings contained a number larger than 2**32";
427
- break;
428
- case 3:
429
- msg += "reached EOF while in the middle of parsing a VLQ";
430
- break;
431
- case 4:
432
- msg += "invalid base 64 character while parsing a VLQ";
433
- break;
434
- default:
435
- msg += "unknown error code";
436
- break;
437
- }
438
- throw new Error(msg);
400
+ if (!isDuplicate) {
401
+ this._set.set(aStr, idx);
439
402
  }
440
- this._mappingsPtr = mappingsPtr;
441
403
  }
442
- eachMapping(aCallback,aContext,aOrder) {
443
- const context = aContext || null,order = aOrder || SourceMapConsumer.GENERATED_ORDER;
444
- this._wasm.withMappingCallback((mapping) => {
445
- if (mapping.source !== null) {
446
- mapping.source = this._absoluteSources.at(mapping.source);
447
- if (mapping.name !== null) {
448
- mapping.name = this._names.at(mapping.name);
449
- }
450
- }
451
- if (this._computedColumnSpans && mapping.lastGeneratedColumn === null) {
452
- mapping.lastGeneratedColumn = Infinity;
453
- }
454
- aCallback.call(context, mapping);
455
- }, () => {
456
- switch (order) {
457
- case SourceMapConsumer.GENERATED_ORDER:
458
- this._wasm.exports.by_generated_location(this._getMappingsPtr());
459
- break;
460
- case SourceMapConsumer.ORIGINAL_ORDER:
461
- this._wasm.exports.by_original_location(this._getMappingsPtr());
462
- break;
463
- default:
464
- throw new Error("Unknown order of iteration.");
465
- }
466
- });
404
+ has(aStr) {
405
+ return this._set.has(aStr);
467
406
  }
468
- allGeneratedPositionsFor(aArgs) {
469
- let source = util.getArg(aArgs, "source");
470
- const originalLine = util.getArg(aArgs, "line"),originalColumn = aArgs.column || 0;
471
- source = this._findSourceIndex(source);
472
- if (source < 0) {
473
- return [];
474
- }
475
- if (originalLine < 1) {
476
- throw new Error("Line numbers must be >= 1");
477
- }
478
- if (originalColumn < 0) {
479
- throw new Error("Column numbers must be >= 0");
407
+ indexOf(aStr) {
408
+ const idx = this._set.get(aStr);
409
+ if (idx >= 0) {
410
+ return idx;
480
411
  }
481
- const mappings = [];
482
- this._wasm.withMappingCallback((m) => {
483
- let lastColumn = m.lastGeneratedColumn;
484
- if (this._computedColumnSpans && lastColumn === null) {
485
- lastColumn = Infinity;
486
- }
487
- mappings.push({ line: m.generatedLine, column: m.generatedColumn, lastColumn });
488
- }, () => {
489
- this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(), source, originalLine - 1, "column" in aArgs, originalColumn);
490
- });
491
- return mappings;
412
+ throw new Error("\"" + aStr + "\" is not in the set.");
492
413
  }
493
- destroy() {
494
- if (this._mappingsPtr !== 0) {
495
- this._wasm.exports.free_mappings(this._mappingsPtr);
496
- this._mappingsPtr = 0;
414
+ at(aIdx) {
415
+ if (aIdx >= 0 && aIdx < this._array.length) {
416
+ return this._array[aIdx];
497
417
  }
418
+ throw new Error("No element indexed by " + aIdx);
498
419
  }
499
- computeColumnSpans() {
500
- if (this._computedColumnSpans) {
501
- return;
502
- }
503
- this._wasm.exports.compute_column_spans(this._getMappingsPtr());
504
- this._computedColumnSpans = true;
420
+ toArray() {
421
+ return this._array.slice();
505
422
  }
506
- originalPositionFor(aArgs) {
507
- const needle = { generatedLine: util.getArg(aArgs, "line"), generatedColumn: util.getArg(aArgs, "column") };
508
- if (needle.generatedLine < 1) {
509
- throw new Error("Line numbers must be >= 1");
423
+ }
424
+ exports.ArraySet = ArraySet;
425
+
426
+ }
427
+ });
428
+ //#endregion
429
+ //#region mapping-list.js
430
+ var require_source_map_lib_mapping_list = __commonJS({
431
+ "mapping-list.js"(exports, module) {
432
+ const util = require_source_map_lib_util();
433
+ function generatedPositionAfter(mappingA,mappingB) {
434
+ const lineA = mappingA.generatedLine,lineB = mappingB.generatedLine,columnA = mappingA.generatedColumn,columnB = mappingB.generatedColumn;
435
+ return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
436
+ }
437
+ class MappingList {
438
+ constructor() {
439
+ this._array = [];
440
+ this._sorted = true;
441
+ this._last = { generatedLine: -1, generatedColumn: 0 };
442
+ }
443
+ unsortedForEach(aCallback,aThisArg) {
444
+ this._array.forEach(aCallback, aThisArg);
445
+ }
446
+ add(aMapping) {
447
+ if (generatedPositionAfter(this._last, aMapping)) {
448
+ this._last = aMapping;
449
+ this._array.push(aMapping);
450
+ } else {
451
+ this._sorted = false;
452
+ this._array.push(aMapping);
510
453
  }
511
- if (needle.generatedColumn < 0) {
512
- throw new Error("Column numbers must be >= 0");
454
+ }
455
+ toArray() {
456
+ if (!this._sorted) {
457
+ this._array.sort(util.compareByGeneratedPositionsInflated);
458
+ this._sorted = true;
513
459
  }
514
- let bias = util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND);
515
- if (bias == null) {
516
- bias = SourceMapConsumer.GREATEST_LOWER_BOUND;
460
+ return this._array;
461
+ }
462
+ }
463
+ exports.MappingList = MappingList;
464
+
465
+ }
466
+ });
467
+ //#endregion
468
+ //#region source-map-generator.js
469
+ var require_source_map_lib_source_map_generator = __commonJS({
470
+ "source-map-generator.js"(exports, module) {
471
+ const base64VLQ = require_source_map_lib_base64_vlq(),util = require_source_map_lib_util(),ArraySet = require_source_map_lib_array_set().ArraySet,MappingList = require_source_map_lib_mapping_list().MappingList;
472
+ class SourceMapGenerator {
473
+ constructor(aArgs) {
474
+ if (!aArgs) {
475
+ aArgs = {};
517
476
  }
518
- let mapping;
519
- this._wasm.withMappingCallback((m) => mapping = m, () => {
520
- this._wasm.exports.original_location_for(this._getMappingsPtr(), needle.generatedLine - 1, needle.generatedColumn, bias);
521
- });
522
- if (mapping) {
523
- if (mapping.generatedLine === needle.generatedLine) {
524
- let source = util.getArg(mapping, "source", null);
525
- if (source !== null) {
526
- source = this._absoluteSources.at(source);
477
+ this._file = util.getArg(aArgs, "file", null);
478
+ this._sourceRoot = util.getArg(aArgs, "sourceRoot", null);
479
+ this._skipValidation = util.getArg(aArgs, "skipValidation", false);
480
+ this._sources = new ArraySet();
481
+ this._names = new ArraySet();
482
+ this._mappings = new MappingList();
483
+ this._sourcesContents = null;
484
+ }
485
+ static fromSourceMap(aSourceMapConsumer) {
486
+ const sourceRoot = aSourceMapConsumer.sourceRoot,generator = new SourceMapGenerator({ file: aSourceMapConsumer.file, sourceRoot });
487
+ aSourceMapConsumer.eachMapping(function(mapping) {
488
+ const newMapping = { generated: { line: mapping.generatedLine, column: mapping.generatedColumn } };
489
+ if (mapping.source != null) {
490
+ newMapping.source = mapping.source;
491
+ if (sourceRoot != null) {
492
+ newMapping.source = util.relative(sourceRoot, newMapping.source);
527
493
  }
528
- let name = util.getArg(mapping, "name", null);
529
- if (name !== null) {
530
- name = this._names.at(name);
494
+ newMapping.original = { line: mapping.originalLine, column: mapping.originalColumn };
495
+ if (mapping.name != null) {
496
+ newMapping.name = mapping.name;
531
497
  }
532
- return { source, line: util.getArg(mapping, "originalLine", null), column: util.getArg(mapping, "originalColumn", null), name };
533
498
  }
534
- }
535
- return { source: null, line: null, column: null, name: null };
536
- }
537
- hasContentsOfAllSources() {
538
- if (!this.sourcesContent) {
539
- return false;
540
- }
541
- return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(sc) {
542
- return sc == null;
499
+ generator.addMapping(newMapping);
500
+ });
501
+ aSourceMapConsumer.sources.forEach(function(sourceFile) {
502
+ let sourceRelative = sourceFile;
503
+ if (sourceRoot != null) {
504
+ sourceRelative = util.relative(sourceRoot, sourceFile);
505
+ }
506
+ if (!generator._sources.has(sourceRelative)) {
507
+ generator._sources.add(sourceRelative);
508
+ }
509
+ const content = aSourceMapConsumer.sourceContentFor(sourceFile);
510
+ if (content != null) {
511
+ generator.setSourceContent(sourceFile, content);
512
+ }
543
513
  });
514
+ return generator;
544
515
  }
545
- sourceContentFor(aSource,nullOnMissing) {
546
- if (!this.sourcesContent) {
547
- return null;
516
+ addMapping(aArgs) {
517
+ const generated = util.getArg(aArgs, "generated"),original = util.getArg(aArgs, "original", null);
518
+ let source = util.getArg(aArgs, "source", null),name = util.getArg(aArgs, "name", null);
519
+ if (!this._skipValidation) {
520
+ this._validateMapping(generated, original, source, name);
548
521
  }
549
- const index = this._findSourceIndex(aSource);
550
- if (index >= 0) {
551
- return this.sourcesContent[index];
522
+ if (source != null) {
523
+ source = String(source);
524
+ if (!this._sources.has(source)) {
525
+ this._sources.add(source);
526
+ }
552
527
  }
553
- if (nullOnMissing) {
554
- return null;
528
+ if (name != null) {
529
+ name = String(name);
530
+ if (!this._names.has(name)) {
531
+ this._names.add(name);
532
+ }
555
533
  }
556
- throw new Error("\"" + aSource + "\" is not in the SourceMap.");
534
+ this._mappings.add({ generatedLine: generated.line, generatedColumn: generated.column, originalLine: original && original.line, originalColumn: original && original.column, source, name });
557
535
  }
558
- generatedPositionFor(aArgs) {
559
- let source = util.getArg(aArgs, "source");
560
- source = this._findSourceIndex(source);
561
- if (source < 0) {
562
- return { line: null, column: null, lastColumn: null };
563
- }
564
- const needle = { source, originalLine: util.getArg(aArgs, "line"), originalColumn: util.getArg(aArgs, "column") };
565
- if (needle.originalLine < 1) {
566
- throw new Error("Line numbers must be >= 1");
567
- }
568
- if (needle.originalColumn < 0) {
569
- throw new Error("Column numbers must be >= 0");
570
- }
571
- let bias = util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND);
572
- if (bias == null) {
573
- bias = SourceMapConsumer.GREATEST_LOWER_BOUND;
536
+ setSourceContent(aSourceFile,aSourceContent) {
537
+ let source = aSourceFile;
538
+ if (this._sourceRoot != null) {
539
+ source = util.relative(this._sourceRoot, source);
574
540
  }
575
- let mapping;
576
- this._wasm.withMappingCallback((m) => mapping = m, () => {
577
- this._wasm.exports.generated_location_for(this._getMappingsPtr(), needle.source, needle.originalLine - 1, needle.originalColumn, bias);
578
- });
579
- if (mapping) {
580
- if (mapping.source === needle.source) {
581
- let lastColumn = mapping.lastGeneratedColumn;
582
- if (this._computedColumnSpans && lastColumn === null) {
583
- lastColumn = Infinity;
584
- }
585
- return { line: util.getArg(mapping, "generatedLine", null), column: util.getArg(mapping, "generatedColumn", null), lastColumn };
541
+ if (aSourceContent != null) {
542
+ if (!this._sourcesContents) {
543
+ this._sourcesContents = Object.create(null);
544
+ }
545
+ this._sourcesContents[util.toSetString(source)] = aSourceContent;
546
+ } else if (this._sourcesContents) {
547
+ delete this._sourcesContents[util.toSetString(source)];
548
+ if (Object.keys(this._sourcesContents).length === 0) {
549
+ this._sourcesContents = null;
586
550
  }
587
551
  }
588
- return { line: null, column: null, lastColumn: null };
589
552
  }
590
- }
591
- BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
592
- exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
593
- class IndexedSourceMapConsumer extends SourceMapConsumer {
594
- constructor(aSourceMap,aSourceMapURL) {
595
- return super(INTERNAL).then((that) => {
596
- let sourceMap = aSourceMap;
597
- if (typeof aSourceMap == "string") {
598
- sourceMap = util.parseSourceMapInput(aSourceMap);
599
- }
600
- const version = util.getArg(sourceMap, "version"),sections = util.getArg(sourceMap, "sections");
601
- if (version != that._version) {
602
- throw new Error("Unsupported version: " + version);
603
- }
604
- let lastOffset = { line: -1, column: 0 };
605
- return Promise.all(sections.map((s) => {
606
- if (s.url) {
607
- throw new Error("Support for url field in sections not implemented.");
608
- }
609
- const offset = util.getArg(s, "offset"),offsetLine = util.getArg(offset, "line"),offsetColumn = util.getArg(offset, "column");
610
- if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) {
611
- throw new Error("Section offsets must be ordered and non-overlapping.");
612
- }
613
- lastOffset = offset;
614
- const cons = new SourceMapConsumer(util.getArg(s, "map"), aSourceMapURL);
615
- return cons.then((consumer) => {
616
- return { generatedOffset: { generatedLine: offsetLine + 1, generatedColumn: offsetColumn + 1 }, consumer };
617
- });
618
- })).then((s) => {
619
- that._sections = s;
620
- return that;
621
- });
622
- });
623
- }
624
- get sources() {
625
- const sources = [];
626
- for (let i = 0; i < this._sections.length; i++) {
627
- for (let j = 0; j < this._sections[i].consumer.sources.length; j++) {
628
- sources.push(this._sections[i].consumer.sources[j]);
629
- }
630
- }
631
- return sources;
632
- }
633
- originalPositionFor(aArgs) {
634
- const needle = { generatedLine: util.getArg(aArgs, "line"), generatedColumn: util.getArg(aArgs, "column") },sectionIndex = binarySearch.search(needle, this._sections, function(aNeedle,section) {
635
- const cmp = aNeedle.generatedLine - section.generatedOffset.generatedLine;
636
- if (cmp) {
637
- return cmp;
638
- }
639
- return aNeedle.generatedColumn - (section.generatedOffset.generatedColumn - 1);
640
- }),section = this._sections[sectionIndex];
641
- if (!section) {
642
- return { source: null, line: null, column: null, name: null };
643
- }
644
- return section.consumer.originalPositionFor({ line: needle.generatedLine - (section.generatedOffset.generatedLine - 1), column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0), bias: aArgs.bias });
645
- }
646
- hasContentsOfAllSources() {
647
- return this._sections.every(function(s) {
648
- return s.consumer.hasContentsOfAllSources();
649
- });
650
- }
651
- sourceContentFor(aSource,nullOnMissing) {
652
- for (let i = 0; i < this._sections.length; i++) {
653
- const section = this._sections[i],content = section.consumer.sourceContentFor(aSource, true);
654
- if (content) {
655
- return content;
656
- }
657
- }
658
- if (nullOnMissing) {
659
- return null;
660
- }
661
- throw new Error("\"" + aSource + "\" is not in the SourceMap.");
662
- }
663
- _findSectionIndex(source) {
664
- for (let i = 0; i < this._sections.length; i++) {
665
- const { consumer:consumer } = this._sections[i];
666
- if (consumer._findSourceIndex(source) !== -1) {
667
- return i;
668
- }
669
- }
670
- return -1;
671
- }
672
- generatedPositionFor(aArgs) {
673
- const index = this._findSectionIndex(util.getArg(aArgs, "source")),section = index >= 0 ? this._sections[index] : null,nextSection = index >= 0 && index + 1 < this._sections.length ? this._sections[index + 1] : null,generatedPosition = section && section.consumer.generatedPositionFor(aArgs);
674
- if (generatedPosition && generatedPosition.line !== null) {
675
- const lineShift = section.generatedOffset.generatedLine - 1,columnShift = section.generatedOffset.generatedColumn - 1;
676
- if (generatedPosition.line === 1) {
677
- generatedPosition.column += columnShift;
678
- if (typeof generatedPosition.lastColumn == "number") {
679
- generatedPosition.lastColumn += columnShift;
680
- }
681
- }
682
- if (generatedPosition.lastColumn === Infinity && nextSection && generatedPosition.line === nextSection.generatedOffset.generatedLine) {
683
- generatedPosition.lastColumn = nextSection.generatedOffset.generatedColumn - 2;
684
- }
685
- generatedPosition.line += lineShift;
686
- return generatedPosition;
687
- }
688
- return { line: null, column: null, lastColumn: null };
689
- }
690
- allGeneratedPositionsFor(aArgs) {
691
- const index = this._findSectionIndex(util.getArg(aArgs, "source")),section = index >= 0 ? this._sections[index] : null,nextSection = index >= 0 && index + 1 < this._sections.length ? this._sections[index + 1] : null;
692
- if (!section)return [];
693
- return section.consumer.allGeneratedPositionsFor(aArgs).map((generatedPosition) => {
694
- const lineShift = section.generatedOffset.generatedLine - 1,columnShift = section.generatedOffset.generatedColumn - 1;
695
- if (generatedPosition.line === 1) {
696
- generatedPosition.column += columnShift;
697
- if (typeof generatedPosition.lastColumn == "number") {
698
- generatedPosition.lastColumn += columnShift;
699
- }
700
- }
701
- if (generatedPosition.lastColumn === Infinity && nextSection && generatedPosition.line === nextSection.generatedOffset.generatedLine) {
702
- generatedPosition.lastColumn = nextSection.generatedOffset.generatedColumn - 2;
703
- }
704
- generatedPosition.line += lineShift;
705
- return generatedPosition;
706
- });
707
- }
708
- eachMapping(aCallback,aContext,aOrder) {
709
- this._sections.forEach((section, index) => {
710
- const nextSection = index + 1 < this._sections.length ? this._sections[index + 1] : null,{ generatedOffset:generatedOffset } = section,lineShift = generatedOffset.generatedLine - 1,columnShift = generatedOffset.generatedColumn - 1;
711
- section.consumer.eachMapping(function(mapping) {
712
- if (mapping.generatedLine === 1) {
713
- mapping.generatedColumn += columnShift;
714
- if (typeof mapping.lastGeneratedColumn == "number") {
715
- mapping.lastGeneratedColumn += columnShift;
716
- }
717
- }
718
- if (mapping.lastGeneratedColumn === Infinity && nextSection && mapping.generatedLine === nextSection.generatedOffset.generatedLine) {
719
- mapping.lastGeneratedColumn = nextSection.generatedOffset.generatedColumn - 2;
720
- }
721
- mapping.generatedLine += lineShift;
722
- aCallback.call(this, mapping);
723
- }, aContext, aOrder);
724
- });
725
- }
726
- computeColumnSpans() {
727
- for (let i = 0; i < this._sections.length; i++) {
728
- this._sections[i].consumer.computeColumnSpans();
729
- }
730
- }
731
- destroy() {
732
- for (let i = 0; i < this._sections.length; i++) {
733
- this._sections[i].consumer.destroy();
734
- }
735
- }
736
- }
737
- exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
738
- function _factory(aSourceMap,aSourceMapURL) {
739
- let sourceMap = aSourceMap;
740
- if (typeof aSourceMap == "string") {
741
- sourceMap = util.parseSourceMapInput(aSourceMap);
742
- }
743
- const consumer = sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
744
- return Promise.resolve(consumer);
745
- }
746
- function _factoryBSM(aSourceMap,aSourceMapURL) {
747
- return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
748
- }
749
-
750
- }
751
- });
752
- //#endregion
753
- //#region source-map-generator.js
754
- var require_source_map_lib_source_map_generator = __commonJS({
755
- "source-map-generator.js"(exports, module) {
756
- const base64VLQ = require_source_map_lib_base64_vlq(),util = require_source_map_lib_util(),ArraySet = require_source_map_lib_array_set().ArraySet,MappingList = require_source_map_lib_mapping_list().MappingList;
757
- class SourceMapGenerator {
758
- constructor(aArgs) {
759
- if (!aArgs) {
760
- aArgs = {};
761
- }
762
- this._file = util.getArg(aArgs, "file", null);
763
- this._sourceRoot = util.getArg(aArgs, "sourceRoot", null);
764
- this._skipValidation = util.getArg(aArgs, "skipValidation", false);
765
- this._sources = new ArraySet();
766
- this._names = new ArraySet();
767
- this._mappings = new MappingList();
768
- this._sourcesContents = null;
769
- }
770
- static fromSourceMap(aSourceMapConsumer) {
771
- const sourceRoot = aSourceMapConsumer.sourceRoot,generator = new SourceMapGenerator({ file: aSourceMapConsumer.file, sourceRoot });
772
- aSourceMapConsumer.eachMapping(function(mapping) {
773
- const newMapping = { generated: { line: mapping.generatedLine, column: mapping.generatedColumn } };
774
- if (mapping.source != null) {
775
- newMapping.source = mapping.source;
776
- if (sourceRoot != null) {
777
- newMapping.source = util.relative(sourceRoot, newMapping.source);
778
- }
779
- newMapping.original = { line: mapping.originalLine, column: mapping.originalColumn };
780
- if (mapping.name != null) {
781
- newMapping.name = mapping.name;
782
- }
783
- }
784
- generator.addMapping(newMapping);
785
- });
786
- aSourceMapConsumer.sources.forEach(function(sourceFile) {
787
- let sourceRelative = sourceFile;
788
- if (sourceRoot != null) {
789
- sourceRelative = util.relative(sourceRoot, sourceFile);
790
- }
791
- if (!generator._sources.has(sourceRelative)) {
792
- generator._sources.add(sourceRelative);
793
- }
794
- const content = aSourceMapConsumer.sourceContentFor(sourceFile);
795
- if (content != null) {
796
- generator.setSourceContent(sourceFile, content);
797
- }
798
- });
799
- return generator;
800
- }
801
- addMapping(aArgs) {
802
- const generated = util.getArg(aArgs, "generated"),original = util.getArg(aArgs, "original", null);
803
- let source = util.getArg(aArgs, "source", null),name = util.getArg(aArgs, "name", null);
804
- if (!this._skipValidation) {
805
- this._validateMapping(generated, original, source, name);
806
- }
807
- if (source != null) {
808
- source = String(source);
809
- if (!this._sources.has(source)) {
810
- this._sources.add(source);
811
- }
812
- }
813
- if (name != null) {
814
- name = String(name);
815
- if (!this._names.has(name)) {
816
- this._names.add(name);
817
- }
818
- }
819
- this._mappings.add({ generatedLine: generated.line, generatedColumn: generated.column, originalLine: original && original.line, originalColumn: original && original.column, source, name });
820
- }
821
- setSourceContent(aSourceFile,aSourceContent) {
822
- let source = aSourceFile;
823
- if (this._sourceRoot != null) {
824
- source = util.relative(this._sourceRoot, source);
825
- }
826
- if (aSourceContent != null) {
827
- if (!this._sourcesContents) {
828
- this._sourcesContents = Object.create(null);
829
- }
830
- this._sourcesContents[util.toSetString(source)] = aSourceContent;
831
- } else if (this._sourcesContents) {
832
- delete this._sourcesContents[util.toSetString(source)];
833
- if (Object.keys(this._sourcesContents).length === 0) {
834
- this._sourcesContents = null;
835
- }
836
- }
837
- }
838
- applySourceMap(aSourceMapConsumer,aSourceFile,aSourceMapPath) {
839
- let sourceFile = aSourceFile;
840
- if (aSourceFile == null) {
841
- if (aSourceMapConsumer.file == null) {
842
- throw new Error("SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, " + "or the source map's \"file\" property. Both were omitted.");
553
+ applySourceMap(aSourceMapConsumer,aSourceFile,aSourceMapPath) {
554
+ let sourceFile = aSourceFile;
555
+ if (aSourceFile == null) {
556
+ if (aSourceMapConsumer.file == null) {
557
+ throw new Error("SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, " + "or the source map's \"file\" property. Both were omitted.");
843
558
  }
844
559
  sourceFile = aSourceMapConsumer.file;
845
560
  }
@@ -973,436 +688,69 @@ const base64VLQ = require_source_map_lib_base64_vlq(),util = require_source_map_
973
688
  }
974
689
  });
975
690
  //#endregion
976
- //#region source-node.js
977
- var require_source_map_lib_source_node = __commonJS({
978
- "source-node.js"(exports, module) {
979
- const SourceMapGenerator = require_source_map_lib_source_map_generator().SourceMapGenerator,util = require_source_map_lib_util(),REGEX_NEWLINE = /(\r?\n)/,NEWLINE_CODE = 10,isSourceNode = "$$$isSourceNode$$$";
980
- class SourceNode {
981
- constructor(aLine,aColumn,aSource,aChunks,aName) {
982
- this.children = [];
983
- this.sourceContents = {};
984
- this.line = aLine == null ? null : aLine;
985
- this.column = aColumn == null ? null : aColumn;
986
- this.source = aSource == null ? null : aSource;
987
- this.name = aName == null ? null : aName;
988
- this[isSourceNode] = true;
989
- if (aChunks != null)this.add(aChunks);
990
- }
991
- static fromStringWithSourceMap(aGeneratedCode,aSourceMapConsumer,aRelativePath) {
992
- const node = new SourceNode(),remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
993
- let remainingLinesIndex = 0;
994
- const shiftNextLine = function() {
995
- const lineContents = getNextLine(),newLine = getNextLine() || "";
996
- return lineContents + newLine;
997
- function getNextLine() {
998
- return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : undefined;
999
- }
1000
- };
1001
- let lastGeneratedLine = 1,lastGeneratedColumn = 0,lastMapping = null,nextLine;
1002
- aSourceMapConsumer.eachMapping(function(mapping) {
1003
- if (lastMapping !== null) {
1004
- if (lastGeneratedLine < mapping.generatedLine) {
1005
- addMappingWithCode(lastMapping, shiftNextLine());
1006
- lastGeneratedLine++;
1007
- lastGeneratedColumn = 0;
1008
- } else {
1009
- nextLine = remainingLines[remainingLinesIndex] || "";
1010
- const code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
1011
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
1012
- lastGeneratedColumn = mapping.generatedColumn;
1013
- addMappingWithCode(lastMapping, code);
1014
- lastMapping = mapping;
1015
- return;
1016
- }
1017
- }
1018
- while (lastGeneratedLine < mapping.generatedLine) {
1019
- node.add(shiftNextLine());
1020
- lastGeneratedLine++;
1021
- }
1022
- if (lastGeneratedColumn < mapping.generatedColumn) {
1023
- nextLine = remainingLines[remainingLinesIndex] || "";
1024
- node.add(nextLine.substr(0, mapping.generatedColumn));
1025
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
1026
- lastGeneratedColumn = mapping.generatedColumn;
1027
- }
1028
- lastMapping = mapping;
1029
- }, this);
1030
- if (remainingLinesIndex < remainingLines.length) {
1031
- if (lastMapping) {
1032
- addMappingWithCode(lastMapping, shiftNextLine());
1033
- }
1034
- node.add(remainingLines.splice(remainingLinesIndex).join(""));
1035
- }
1036
- aSourceMapConsumer.sources.forEach(function(sourceFile) {
1037
- const content = aSourceMapConsumer.sourceContentFor(sourceFile);
1038
- if (content != null) {
1039
- if (aRelativePath != null) {
1040
- sourceFile = util.join(aRelativePath, sourceFile);
1041
- }
1042
- node.setSourceContent(sourceFile, content);
1043
- }
1044
- });
1045
- return node;
1046
- function addMappingWithCode(mapping,code) {
1047
- if (mapping === null || mapping.source === undefined) {
1048
- node.add(code);
1049
- } else {
1050
- const source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
1051
- node.add(new SourceNode(mapping.originalLine, mapping.originalColumn, source, code, mapping.name));
1052
- }
1053
- }
1054
- }
1055
- add(aChunk) {
1056
- if (Array.isArray(aChunk)) {
1057
- aChunk.forEach(function(chunk) {
1058
- this.add(chunk);
1059
- }, this);
1060
- } else if (aChunk[isSourceNode] || typeof aChunk == "string") {
1061
- if (aChunk) {
1062
- this.children.push(aChunk);
1063
- }
1064
- } else {
1065
- throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
691
+ //#region binary-search.js
692
+ var require_source_map_lib_binary_search = __commonJS({
693
+ "binary-search.js"(exports, module) {
694
+ exports.GREATEST_LOWER_BOUND = 1;
695
+ exports.LEAST_UPPER_BOUND = 2;
696
+ function recursiveSearch(aLow,aHigh,aNeedle,aHaystack,aCompare,aBias) {
697
+ const mid = Math.floor((aHigh - aLow) / 2) + aLow,cmp = aCompare(aNeedle, aHaystack[mid], true);
698
+ if (cmp === 0) {
699
+ return mid;
700
+ } else if (cmp > 0) {
701
+ if (aHigh - mid > 1) {
702
+ return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
1066
703
  }
1067
- return this;
1068
- }
1069
- prepend(aChunk) {
1070
- if (Array.isArray(aChunk)) {
1071
- for (let i = aChunk.length - 1; i >= 0; i--) {
1072
- this.prepend(aChunk[i]);
1073
- }
1074
- } else if (aChunk[isSourceNode] || typeof aChunk == "string") {
1075
- this.children.unshift(aChunk);
1076
- } else {
1077
- throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
704
+ if (aBias === exports.LEAST_UPPER_BOUND) {
705
+ return aHigh < aHaystack.length ? aHigh : -1;
1078
706
  }
1079
- return this;
707
+ return mid;
1080
708
  }
1081
- walk(aFn) {
1082
- let chunk;
1083
- for (let i = 0,len = this.children.length; i < len; i++) {
1084
- chunk = this.children[i];
1085
- if (chunk[isSourceNode]) {
1086
- chunk.walk(aFn);
1087
- } else if (chunk !== "") {
1088
- aFn(chunk, { source: this.source, line: this.line, column: this.column, name: this.name });
1089
- }
1090
- }
709
+ if (mid - aLow > 1) {
710
+ return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
1091
711
  }
1092
- join(aSep) {
1093
- let newChildren,i;
1094
- const len = this.children.length;
1095
- if (len > 0) {
1096
- newChildren = [];
1097
- for (i = 0; i < len - 1; i++) {
1098
- newChildren.push(this.children[i]);
1099
- newChildren.push(aSep);
1100
- }
1101
- newChildren.push(this.children[i]);
1102
- this.children = newChildren;
1103
- }
1104
- return this;
712
+ if (aBias == exports.LEAST_UPPER_BOUND) {
713
+ return mid;
1105
714
  }
1106
- replaceRight(aPattern,aReplacement) {
1107
- const lastChild = this.children[this.children.length - 1];
1108
- if (lastChild[isSourceNode]) {
1109
- lastChild.replaceRight(aPattern, aReplacement);
1110
- } else if (typeof lastChild == "string") {
1111
- this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
1112
- } else {
1113
- this.children.push("".replace(aPattern, aReplacement));
1114
- }
1115
- return this;
715
+ return aLow < 0 ? -1 : aLow;
716
+ }
717
+ exports.search = function search(aNeedle,aHaystack,aCompare,aBias) {
718
+ if (aHaystack.length === 0) {
719
+ return -1;
1116
720
  }
1117
- setSourceContent(aSourceFile,aSourceContent) {
1118
- this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
721
+ let index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports.GREATEST_LOWER_BOUND);
722
+ if (index < 0) {
723
+ return -1;
1119
724
  }
1120
- walkSourceContents(aFn) {
1121
- for (let i = 0,len = this.children.length; i < len; i++) {
1122
- if (this.children[i][isSourceNode]) {
1123
- this.children[i].walkSourceContents(aFn);
1124
- }
1125
- }
1126
- const sources = Object.keys(this.sourceContents);
1127
- for (let i = 0,len = sources.length; i < len; i++) {
1128
- aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
725
+ while (index - 1 >= 0) {
726
+ if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
727
+ break;
1129
728
  }
729
+ --index;
1130
730
  }
1131
- toString() {
1132
- let str = "";
1133
- this.walk(function(chunk) {
1134
- str += chunk;
1135
- });
1136
- return str;
1137
- }
1138
- toStringWithSourceMap(aArgs) {
1139
- const generated = { code: "", line: 1, column: 0 },map = new SourceMapGenerator(aArgs);
1140
- let sourceMappingActive = false,lastOriginalSource = null,lastOriginalLine = null,lastOriginalColumn = null,lastOriginalName = null;
1141
- this.walk(function(chunk,original) {
1142
- generated.code += chunk;
1143
- if (original.source !== null && original.line !== null && original.column !== null) {
1144
- if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
1145
- map.addMapping({ source: original.source, original: { line: original.line, column: original.column }, generated: { line: generated.line, column: generated.column }, name: original.name });
1146
- }
1147
- lastOriginalSource = original.source;
1148
- lastOriginalLine = original.line;
1149
- lastOriginalColumn = original.column;
1150
- lastOriginalName = original.name;
1151
- sourceMappingActive = true;
1152
- } else if (sourceMappingActive) {
1153
- map.addMapping({ generated: { line: generated.line, column: generated.column } });
1154
- lastOriginalSource = null;
1155
- sourceMappingActive = false;
1156
- }
1157
- for (let idx = 0,length = chunk.length; idx < length; idx++) {
1158
- if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
1159
- generated.line++;
1160
- generated.column = 0;
1161
- if (idx + 1 === length) {
1162
- lastOriginalSource = null;
1163
- sourceMappingActive = false;
1164
- } else if (sourceMappingActive) {
1165
- map.addMapping({ source: original.source, original: { line: original.line, column: original.column }, generated: { line: generated.line, column: generated.column }, name: original.name });
1166
- }
1167
- } else {
1168
- generated.column++;
1169
- }
1170
- }
1171
- });
1172
- this.walkSourceContents(function(sourceFile,sourceContent) {
1173
- map.setSourceContent(sourceFile, sourceContent);
1174
- });
1175
- return { code: generated.code, map };
1176
- }
1177
- }
1178
- exports.SourceNode = SourceNode;
731
+ return index;
732
+ };
1179
733
 
1180
734
  }
1181
735
  });
1182
736
  //#endregion
1183
- //#region url.js
1184
- var require_source_map_lib_url = __commonJS({
1185
- "url.js"(exports, module) {
737
+ //#region read-wasm-browser.js
738
+ var require_source_map_lib_read_wasm_browser = __commonJS({
739
+ "read-wasm-browser.js"(exports, module) {
1186
740
  "use strict";
1187
- module.exports = typeof URL == "function" ? URL : require__disabled__url().URL;
1188
-
1189
- }
1190
- });
1191
- //#endregion
1192
- //#region util.js
1193
- var require_source_map_lib_util = __commonJS({
1194
- "util.js"(exports, module) {
1195
- const URL = require_source_map_lib_url();
1196
- function getArg(aArgs,aName,aDefaultValue) {
1197
- if (aName in aArgs) {
1198
- return aArgs[aName];
1199
- } else if (arguments.length === 3) {
1200
- return aDefaultValue;
1201
- }
1202
- throw new Error("\"" + aName + "\" is a required argument.");
1203
- }
1204
- exports.getArg = getArg;
1205
- const supportsNullProto = (function() {
1206
- const obj = Object.create(null);
1207
- return !("__proto__" in obj);
1208
- })();
1209
- function identity(s) {
1210
- return s;
1211
- }
1212
- function toSetString(aStr) {
1213
- if (isProtoString(aStr)) {
1214
- return "$" + aStr;
1215
- }
1216
- return aStr;
1217
- }
1218
- exports.toSetString = supportsNullProto ? identity : toSetString;
1219
- function fromSetString(aStr) {
1220
- if (isProtoString(aStr)) {
1221
- return aStr.slice(1);
1222
- }
1223
- return aStr;
1224
- }
1225
- exports.fromSetString = supportsNullProto ? identity : fromSetString;
1226
- function isProtoString(s) {
1227
- if (!s) {
1228
- return false;
1229
- }
1230
- const length = s.length;
1231
- if (length < 9) {
1232
- return false;
1233
- }
1234
- if (s.charCodeAt(length - 1) !== 95 || s.charCodeAt(length - 2) !== 95 || s.charCodeAt(length - 3) !== 111 || s.charCodeAt(length - 4) !== 116 || s.charCodeAt(length - 5) !== 111 || s.charCodeAt(length - 6) !== 114 || s.charCodeAt(length - 7) !== 112 || s.charCodeAt(length - 8) !== 95 || s.charCodeAt(length - 9) !== 95) {
1235
- return false;
1236
- }
1237
- for (let i = length - 10; i >= 0; i--) {
1238
- if (s.charCodeAt(i) !== 36) {
1239
- return false;
1240
- }
1241
- }
1242
- return true;
1243
- }
1244
- function strcmp(aStr1,aStr2) {
1245
- if (aStr1 === aStr2) {
1246
- return 0;
1247
- }
1248
- if (aStr1 === null) {
1249
- return 1;
1250
- }
1251
- if (aStr2 === null) {
1252
- return -1;
1253
- }
1254
- if (aStr1 > aStr2) {
1255
- return 1;
1256
- }
1257
- return -1;
1258
- }
1259
- function compareByGeneratedPositionsInflated(mappingA,mappingB) {
1260
- let cmp = mappingA.generatedLine - mappingB.generatedLine;
1261
- if (cmp !== 0) {
1262
- return cmp;
1263
- }
1264
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
1265
- if (cmp !== 0) {
1266
- return cmp;
1267
- }
1268
- cmp = strcmp(mappingA.source, mappingB.source);
1269
- if (cmp !== 0) {
1270
- return cmp;
1271
- }
1272
- cmp = mappingA.originalLine - mappingB.originalLine;
1273
- if (cmp !== 0) {
1274
- return cmp;
1275
- }
1276
- cmp = mappingA.originalColumn - mappingB.originalColumn;
1277
- if (cmp !== 0) {
1278
- return cmp;
1279
- }
1280
- return strcmp(mappingA.name, mappingB.name);
1281
- }
1282
- exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
1283
- function parseSourceMapInput(str) {
1284
- return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
1285
- }
1286
- exports.parseSourceMapInput = parseSourceMapInput;
1287
- const PROTOCOL = "http:",PROTOCOL_AND_HOST = `${PROTOCOL}//host`;
1288
- function createSafeHandler(cb) {
1289
- return (input) => {
1290
- const type = getURLType(input),base = buildSafeBase(input),url = new URL(input, base);
1291
- cb(url);
1292
- const result = url.toString();
1293
- if (type === "absolute") {
1294
- return result;
1295
- } else if (type === "scheme-relative") {
1296
- return result.slice(PROTOCOL.length);
1297
- } else if (type === "path-absolute") {
1298
- return result.slice(PROTOCOL_AND_HOST.length);
1299
- }
1300
- return computeRelativeURL(base, result);
1301
- };
1302
- }
1303
- function withBase(url,base) {
1304
- return new URL(url, base).toString();
1305
- }
1306
- function buildUniqueSegment(prefix,str) {
1307
- let id = 0;
1308
- do {
1309
- const ident = prefix + id++;
1310
- if (str.indexOf(ident) === -1)return ident;
1311
- } while (true);
1312
- }
1313
- function buildSafeBase(str) {
1314
- const maxDotParts = str.split("..").length - 1,segment = buildUniqueSegment("p", str);
1315
- let base = `${PROTOCOL_AND_HOST}/`;
1316
- for (let i = 0; i < maxDotParts; i++) {
1317
- base += `${segment}/`;
1318
- }
1319
- return base;
1320
- }
1321
- const ABSOLUTE_SCHEME = /^[A-Za-z0-9\+\-\.]+:/;
1322
- function getURLType(url) {
1323
- if (url[0] === "/") {
1324
- if (url[1] === "/")return "scheme-relative";
1325
- return "path-absolute";
1326
- }
1327
- return ABSOLUTE_SCHEME.test(url) ? "absolute" : "path-relative";
1328
- }
1329
- function computeRelativeURL(rootURL,targetURL) {
1330
- if (typeof rootURL == "string")rootURL = new URL(rootURL);
1331
- if (typeof targetURL == "string")targetURL = new URL(targetURL);
1332
- const targetParts = targetURL.pathname.split("/"),rootParts = rootURL.pathname.split("/");
1333
- if (rootParts.length > 0 && !rootParts[rootParts.length - 1]) {
1334
- rootParts.pop();
1335
- }
1336
- while (targetParts.length > 0 && rootParts.length > 0 && targetParts[0] === rootParts[0]) {
1337
- targetParts.shift();
1338
- rootParts.shift();
1339
- }
1340
- const relativePath = rootParts.map(() => "..").concat(targetParts).join("/");
1341
- return relativePath + targetURL.search + targetURL.hash;
1342
- }
1343
- const ensureDirectory = createSafeHandler((url) => {
1344
- url.pathname = url.pathname.replace(/\/?$/, "/");
1345
- }),trimFilename = createSafeHandler((url) => {
1346
- url.href = new URL(".", url.toString()).toString();
1347
- }),normalize = createSafeHandler((url) => {
1348
- });
1349
- exports.normalize = normalize;
1350
- function join(aRoot,aPath) {
1351
- const pathType = getURLType(aPath),rootType = getURLType(aRoot);
1352
- aRoot = ensureDirectory(aRoot);
1353
- if (pathType === "absolute") {
1354
- return withBase(aPath, undefined);
1355
- }
1356
- if (rootType === "absolute") {
1357
- return withBase(aPath, aRoot);
1358
- }
1359
- if (pathType === "scheme-relative") {
1360
- return normalize(aPath);
1361
- }
1362
- if (rootType === "scheme-relative") {
1363
- return withBase(aPath, withBase(aRoot, PROTOCOL_AND_HOST)).slice(PROTOCOL.length);
1364
- }
1365
- if (pathType === "path-absolute") {
1366
- return normalize(aPath);
1367
- }
1368
- if (rootType === "path-absolute") {
1369
- return withBase(aPath, withBase(aRoot, PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);
1370
- }
1371
- const base = buildSafeBase(aPath + aRoot),newPath = withBase(aPath, withBase(aRoot, base));
1372
- return computeRelativeURL(base, newPath);
1373
- }
1374
- exports.join = join;
1375
- function relative(rootURL,targetURL) {
1376
- const result = relativeIfPossible(rootURL, targetURL);
1377
- return typeof result == "string" ? result : normalize(targetURL);
1378
- }
1379
- exports.relative = relative;
1380
- function relativeIfPossible(rootURL,targetURL) {
1381
- const urlType = getURLType(rootURL);
1382
- if (urlType !== getURLType(targetURL)) {
1383
- return null;
1384
- }
1385
- const base = buildSafeBase(rootURL + targetURL),root = new URL(rootURL, base),target = new URL(targetURL, base);
1386
- try {
1387
- new URL("", target.toString());
1388
- } catch (err) {
1389
- return null;
1390
- }
1391
- if (target.protocol !== root.protocol || target.user !== root.user || target.password !== root.password || target.hostname !== root.hostname || target.port !== root.port) {
1392
- return null;
1393
- }
1394
- return computeRelativeURL(root, target);
1395
- }
1396
- function computeSourceURL(sourceRoot,sourceURL,sourceMapURL) {
1397
- if (sourceRoot && getURLType(sourceURL) === "path-absolute") {
1398
- sourceURL = sourceURL.replace(/^\//, "");
1399
- }
1400
- let url = normalize(sourceURL || "");
1401
- if (sourceRoot)url = join(sourceRoot, url);
1402
- if (sourceMapURL)url = join(trimFilename(sourceMapURL), url);
1403
- return url;
1404
- }
1405
- exports.computeSourceURL = computeSourceURL;
741
+ let mappingsWasm = null;
742
+ module.exports = function readWasm() {
743
+ if (typeof mappingsWasm == "string") {
744
+ return fetch(mappingsWasm).then((response) => response.arrayBuffer());
745
+ }
746
+ if (mappingsWasm instanceof ArrayBuffer) {
747
+ return Promise.resolve(mappingsWasm);
748
+ }
749
+ throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer");
750
+ };
751
+ module.exports.initialize = (input) => {
752
+ mappingsWasm = input;
753
+ };
1406
754
 
1407
755
  }
1408
756
  });
@@ -1491,6 +839,658 @@ const readWasm = require_source_map_lib_read_wasm_browser();
1491
839
  }
1492
840
  });
1493
841
  //#endregion
842
+ //#region source-map-consumer.js
843
+ var require_source_map_lib_source_map_consumer = __commonJS({
844
+ "source-map-consumer.js"(exports, module) {
845
+ const util = require_source_map_lib_util(),binarySearch = require_source_map_lib_binary_search(),ArraySet = require_source_map_lib_array_set().ArraySet,base64VLQ = require_source_map_lib_base64_vlq(),readWasm = require_source_map_lib_read_wasm_browser(),wasm = require_source_map_lib_wasm(),INTERNAL = Symbol("smcInternal");
846
+ class SourceMapConsumer {
847
+ constructor(aSourceMap,aSourceMapURL) {
848
+ if (aSourceMap == INTERNAL) {
849
+ return Promise.resolve(this);
850
+ }
851
+ return _factory(aSourceMap, aSourceMapURL);
852
+ }
853
+ static initialize(opts) {
854
+ readWasm.initialize(opts["lib/mappings.wasm"]);
855
+ }
856
+ static fromSourceMap(aSourceMap,aSourceMapURL) {
857
+ return _factoryBSM(aSourceMap, aSourceMapURL);
858
+ }
859
+ static async with(rawSourceMap,sourceMapUrl,f) {
860
+ const consumer = await new SourceMapConsumer(rawSourceMap, sourceMapUrl);
861
+ try {
862
+ return await f(consumer);
863
+ } finally {
864
+ consumer.destroy();
865
+ }
866
+ }
867
+ eachMapping(aCallback,aContext,aOrder) {
868
+ throw new Error("Subclasses must implement eachMapping");
869
+ }
870
+ allGeneratedPositionsFor(aArgs) {
871
+ throw new Error("Subclasses must implement allGeneratedPositionsFor");
872
+ }
873
+ destroy() {
874
+ throw new Error("Subclasses must implement destroy");
875
+ }
876
+ }
877
+ SourceMapConsumer.prototype._version = 3;
878
+ SourceMapConsumer.GENERATED_ORDER = 1;
879
+ SourceMapConsumer.ORIGINAL_ORDER = 2;
880
+ SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
881
+ SourceMapConsumer.LEAST_UPPER_BOUND = 2;
882
+ exports.SourceMapConsumer = SourceMapConsumer;
883
+ class BasicSourceMapConsumer extends SourceMapConsumer {
884
+ constructor(aSourceMap,aSourceMapURL) {
885
+ return super(INTERNAL).then((that) => {
886
+ let sourceMap = aSourceMap;
887
+ if (typeof aSourceMap == "string") {
888
+ sourceMap = util.parseSourceMapInput(aSourceMap);
889
+ }
890
+ const version = util.getArg(sourceMap, "version"),sources = util.getArg(sourceMap, "sources").map(String),names = util.getArg(sourceMap, "names", []),sourceRoot = util.getArg(sourceMap, "sourceRoot", null),sourcesContent = util.getArg(sourceMap, "sourcesContent", null),mappings = util.getArg(sourceMap, "mappings"),file = util.getArg(sourceMap, "file", null),x_google_ignoreList = util.getArg(sourceMap, "x_google_ignoreList", null);
891
+ if (version != that._version) {
892
+ throw new Error("Unsupported version: " + version);
893
+ }
894
+ that._sourceLookupCache = new Map();
895
+ that._names = ArraySet.fromArray(names.map(String), true);
896
+ that._sources = ArraySet.fromArray(sources, true);
897
+ that._absoluteSources = ArraySet.fromArray(that._sources.toArray().map(function(s) {
898
+ return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
899
+ }), true);
900
+ that.sourceRoot = sourceRoot;
901
+ that.sourcesContent = sourcesContent;
902
+ that._mappings = mappings;
903
+ that._sourceMapURL = aSourceMapURL;
904
+ that.file = file;
905
+ that.x_google_ignoreList = x_google_ignoreList;
906
+ that._computedColumnSpans = false;
907
+ that._mappingsPtr = 0;
908
+ that._wasm = null;
909
+ return wasm().then((w) => {
910
+ that._wasm = w;
911
+ return that;
912
+ });
913
+ });
914
+ }
915
+ _findSourceIndex(aSource) {
916
+ const cachedIndex = this._sourceLookupCache.get(aSource);
917
+ if (typeof cachedIndex == "number") {
918
+ return cachedIndex;
919
+ }
920
+ const sourceAsMapRelative = util.computeSourceURL(null, aSource, this._sourceMapURL);
921
+ if (this._absoluteSources.has(sourceAsMapRelative)) {
922
+ const index = this._absoluteSources.indexOf(sourceAsMapRelative);
923
+ this._sourceLookupCache.set(aSource, index);
924
+ return index;
925
+ }
926
+ const sourceAsSourceRootRelative = util.computeSourceURL(this.sourceRoot, aSource, this._sourceMapURL);
927
+ if (this._absoluteSources.has(sourceAsSourceRootRelative)) {
928
+ const index = this._absoluteSources.indexOf(sourceAsSourceRootRelative);
929
+ this._sourceLookupCache.set(aSource, index);
930
+ return index;
931
+ }
932
+ return -1;
933
+ }
934
+ static fromSourceMap(aSourceMap,aSourceMapURL) {
935
+ return new BasicSourceMapConsumer(aSourceMap.toString());
936
+ }
937
+ get sources() {
938
+ return this._absoluteSources.toArray();
939
+ }
940
+ _getMappingsPtr() {
941
+ if (this._mappingsPtr === 0) {
942
+ this._parseMappings();
943
+ }
944
+ return this._mappingsPtr;
945
+ }
946
+ _parseMappings() {
947
+ const aStr = this._mappings,size = aStr.length,mappingsBufPtr = this._wasm.exports.allocate_mappings(size) >>> 0,mappingsBuf = new Uint8Array(this._wasm.exports.memory.buffer, mappingsBufPtr, size);
948
+ for (let i = 0; i < size; i++) {
949
+ mappingsBuf[i] = aStr.charCodeAt(i);
950
+ }
951
+ const mappingsPtr = this._wasm.exports.parse_mappings(mappingsBufPtr);
952
+ if (!mappingsPtr) {
953
+ const error = this._wasm.exports.get_last_error();
954
+ let msg = `Error parsing mappings (code ${error}): `;
955
+ switch (error) {
956
+ case 1:
957
+ msg += "the mappings contained a negative line, column, source index, or name index";
958
+ break;
959
+ case 2:
960
+ msg += "the mappings contained a number larger than 2**32";
961
+ break;
962
+ case 3:
963
+ msg += "reached EOF while in the middle of parsing a VLQ";
964
+ break;
965
+ case 4:
966
+ msg += "invalid base 64 character while parsing a VLQ";
967
+ break;
968
+ default:
969
+ msg += "unknown error code";
970
+ break;
971
+ }
972
+ throw new Error(msg);
973
+ }
974
+ this._mappingsPtr = mappingsPtr;
975
+ }
976
+ eachMapping(aCallback,aContext,aOrder) {
977
+ const context = aContext || null,order = aOrder || SourceMapConsumer.GENERATED_ORDER;
978
+ this._wasm.withMappingCallback((mapping) => {
979
+ if (mapping.source !== null) {
980
+ mapping.source = this._absoluteSources.at(mapping.source);
981
+ if (mapping.name !== null) {
982
+ mapping.name = this._names.at(mapping.name);
983
+ }
984
+ }
985
+ if (this._computedColumnSpans && mapping.lastGeneratedColumn === null) {
986
+ mapping.lastGeneratedColumn = Infinity;
987
+ }
988
+ aCallback.call(context, mapping);
989
+ }, () => {
990
+ switch (order) {
991
+ case SourceMapConsumer.GENERATED_ORDER:
992
+ this._wasm.exports.by_generated_location(this._getMappingsPtr());
993
+ break;
994
+ case SourceMapConsumer.ORIGINAL_ORDER:
995
+ this._wasm.exports.by_original_location(this._getMappingsPtr());
996
+ break;
997
+ default:
998
+ throw new Error("Unknown order of iteration.");
999
+ }
1000
+ });
1001
+ }
1002
+ allGeneratedPositionsFor(aArgs) {
1003
+ let source = util.getArg(aArgs, "source");
1004
+ const originalLine = util.getArg(aArgs, "line"),originalColumn = aArgs.column || 0;
1005
+ source = this._findSourceIndex(source);
1006
+ if (source < 0) {
1007
+ return [];
1008
+ }
1009
+ if (originalLine < 1) {
1010
+ throw new Error("Line numbers must be >= 1");
1011
+ }
1012
+ if (originalColumn < 0) {
1013
+ throw new Error("Column numbers must be >= 0");
1014
+ }
1015
+ const mappings = [];
1016
+ this._wasm.withMappingCallback((m) => {
1017
+ let lastColumn = m.lastGeneratedColumn;
1018
+ if (this._computedColumnSpans && lastColumn === null) {
1019
+ lastColumn = Infinity;
1020
+ }
1021
+ mappings.push({ line: m.generatedLine, column: m.generatedColumn, lastColumn });
1022
+ }, () => {
1023
+ this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(), source, originalLine - 1, "column" in aArgs, originalColumn);
1024
+ });
1025
+ return mappings;
1026
+ }
1027
+ destroy() {
1028
+ if (this._mappingsPtr !== 0) {
1029
+ this._wasm.exports.free_mappings(this._mappingsPtr);
1030
+ this._mappingsPtr = 0;
1031
+ }
1032
+ }
1033
+ computeColumnSpans() {
1034
+ if (this._computedColumnSpans) {
1035
+ return;
1036
+ }
1037
+ this._wasm.exports.compute_column_spans(this._getMappingsPtr());
1038
+ this._computedColumnSpans = true;
1039
+ }
1040
+ originalPositionFor(aArgs) {
1041
+ const needle = { generatedLine: util.getArg(aArgs, "line"), generatedColumn: util.getArg(aArgs, "column") };
1042
+ if (needle.generatedLine < 1) {
1043
+ throw new Error("Line numbers must be >= 1");
1044
+ }
1045
+ if (needle.generatedColumn < 0) {
1046
+ throw new Error("Column numbers must be >= 0");
1047
+ }
1048
+ let bias = util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND);
1049
+ if (bias == null) {
1050
+ bias = SourceMapConsumer.GREATEST_LOWER_BOUND;
1051
+ }
1052
+ let mapping;
1053
+ this._wasm.withMappingCallback((m) => mapping = m, () => {
1054
+ this._wasm.exports.original_location_for(this._getMappingsPtr(), needle.generatedLine - 1, needle.generatedColumn, bias);
1055
+ });
1056
+ if (mapping) {
1057
+ if (mapping.generatedLine === needle.generatedLine) {
1058
+ let source = util.getArg(mapping, "source", null);
1059
+ if (source !== null) {
1060
+ source = this._absoluteSources.at(source);
1061
+ }
1062
+ let name = util.getArg(mapping, "name", null);
1063
+ if (name !== null) {
1064
+ name = this._names.at(name);
1065
+ }
1066
+ return { source, line: util.getArg(mapping, "originalLine", null), column: util.getArg(mapping, "originalColumn", null), name };
1067
+ }
1068
+ }
1069
+ return { source: null, line: null, column: null, name: null };
1070
+ }
1071
+ hasContentsOfAllSources() {
1072
+ if (!this.sourcesContent) {
1073
+ return false;
1074
+ }
1075
+ return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(sc) {
1076
+ return sc == null;
1077
+ });
1078
+ }
1079
+ sourceContentFor(aSource,nullOnMissing) {
1080
+ if (!this.sourcesContent) {
1081
+ return null;
1082
+ }
1083
+ const index = this._findSourceIndex(aSource);
1084
+ if (index >= 0) {
1085
+ return this.sourcesContent[index];
1086
+ }
1087
+ if (nullOnMissing) {
1088
+ return null;
1089
+ }
1090
+ throw new Error("\"" + aSource + "\" is not in the SourceMap.");
1091
+ }
1092
+ generatedPositionFor(aArgs) {
1093
+ let source = util.getArg(aArgs, "source");
1094
+ source = this._findSourceIndex(source);
1095
+ if (source < 0) {
1096
+ return { line: null, column: null, lastColumn: null };
1097
+ }
1098
+ const needle = { source, originalLine: util.getArg(aArgs, "line"), originalColumn: util.getArg(aArgs, "column") };
1099
+ if (needle.originalLine < 1) {
1100
+ throw new Error("Line numbers must be >= 1");
1101
+ }
1102
+ if (needle.originalColumn < 0) {
1103
+ throw new Error("Column numbers must be >= 0");
1104
+ }
1105
+ let bias = util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND);
1106
+ if (bias == null) {
1107
+ bias = SourceMapConsumer.GREATEST_LOWER_BOUND;
1108
+ }
1109
+ let mapping;
1110
+ this._wasm.withMappingCallback((m) => mapping = m, () => {
1111
+ this._wasm.exports.generated_location_for(this._getMappingsPtr(), needle.source, needle.originalLine - 1, needle.originalColumn, bias);
1112
+ });
1113
+ if (mapping) {
1114
+ if (mapping.source === needle.source) {
1115
+ let lastColumn = mapping.lastGeneratedColumn;
1116
+ if (this._computedColumnSpans && lastColumn === null) {
1117
+ lastColumn = Infinity;
1118
+ }
1119
+ return { line: util.getArg(mapping, "generatedLine", null), column: util.getArg(mapping, "generatedColumn", null), lastColumn };
1120
+ }
1121
+ }
1122
+ return { line: null, column: null, lastColumn: null };
1123
+ }
1124
+ }
1125
+ BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
1126
+ exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
1127
+ class IndexedSourceMapConsumer extends SourceMapConsumer {
1128
+ constructor(aSourceMap,aSourceMapURL) {
1129
+ return super(INTERNAL).then((that) => {
1130
+ let sourceMap = aSourceMap;
1131
+ if (typeof aSourceMap == "string") {
1132
+ sourceMap = util.parseSourceMapInput(aSourceMap);
1133
+ }
1134
+ const version = util.getArg(sourceMap, "version"),sections = util.getArg(sourceMap, "sections");
1135
+ if (version != that._version) {
1136
+ throw new Error("Unsupported version: " + version);
1137
+ }
1138
+ let lastOffset = { line: -1, column: 0 };
1139
+ return Promise.all(sections.map((s) => {
1140
+ if (s.url) {
1141
+ throw new Error("Support for url field in sections not implemented.");
1142
+ }
1143
+ const offset = util.getArg(s, "offset"),offsetLine = util.getArg(offset, "line"),offsetColumn = util.getArg(offset, "column");
1144
+ if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) {
1145
+ throw new Error("Section offsets must be ordered and non-overlapping.");
1146
+ }
1147
+ lastOffset = offset;
1148
+ const cons = new SourceMapConsumer(util.getArg(s, "map"), aSourceMapURL);
1149
+ return cons.then((consumer) => {
1150
+ return { generatedOffset: { generatedLine: offsetLine + 1, generatedColumn: offsetColumn + 1 }, consumer };
1151
+ });
1152
+ })).then((s) => {
1153
+ that._sections = s;
1154
+ return that;
1155
+ });
1156
+ });
1157
+ }
1158
+ get sources() {
1159
+ const sources = [];
1160
+ for (let i = 0; i < this._sections.length; i++) {
1161
+ for (let j = 0; j < this._sections[i].consumer.sources.length; j++) {
1162
+ sources.push(this._sections[i].consumer.sources[j]);
1163
+ }
1164
+ }
1165
+ return sources;
1166
+ }
1167
+ originalPositionFor(aArgs) {
1168
+ const needle = { generatedLine: util.getArg(aArgs, "line"), generatedColumn: util.getArg(aArgs, "column") },sectionIndex = binarySearch.search(needle, this._sections, function(aNeedle,section) {
1169
+ const cmp = aNeedle.generatedLine - section.generatedOffset.generatedLine;
1170
+ if (cmp) {
1171
+ return cmp;
1172
+ }
1173
+ return aNeedle.generatedColumn - (section.generatedOffset.generatedColumn - 1);
1174
+ }),section = this._sections[sectionIndex];
1175
+ if (!section) {
1176
+ return { source: null, line: null, column: null, name: null };
1177
+ }
1178
+ return section.consumer.originalPositionFor({ line: needle.generatedLine - (section.generatedOffset.generatedLine - 1), column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0), bias: aArgs.bias });
1179
+ }
1180
+ hasContentsOfAllSources() {
1181
+ return this._sections.every(function(s) {
1182
+ return s.consumer.hasContentsOfAllSources();
1183
+ });
1184
+ }
1185
+ sourceContentFor(aSource,nullOnMissing) {
1186
+ for (let i = 0; i < this._sections.length; i++) {
1187
+ const section = this._sections[i],content = section.consumer.sourceContentFor(aSource, true);
1188
+ if (content) {
1189
+ return content;
1190
+ }
1191
+ }
1192
+ if (nullOnMissing) {
1193
+ return null;
1194
+ }
1195
+ throw new Error("\"" + aSource + "\" is not in the SourceMap.");
1196
+ }
1197
+ _findSectionIndex(source) {
1198
+ for (let i = 0; i < this._sections.length; i++) {
1199
+ const { consumer:consumer } = this._sections[i];
1200
+ if (consumer._findSourceIndex(source) !== -1) {
1201
+ return i;
1202
+ }
1203
+ }
1204
+ return -1;
1205
+ }
1206
+ generatedPositionFor(aArgs) {
1207
+ const index = this._findSectionIndex(util.getArg(aArgs, "source")),section = index >= 0 ? this._sections[index] : null,nextSection = index >= 0 && index + 1 < this._sections.length ? this._sections[index + 1] : null,generatedPosition = section && section.consumer.generatedPositionFor(aArgs);
1208
+ if (generatedPosition && generatedPosition.line !== null) {
1209
+ const lineShift = section.generatedOffset.generatedLine - 1,columnShift = section.generatedOffset.generatedColumn - 1;
1210
+ if (generatedPosition.line === 1) {
1211
+ generatedPosition.column += columnShift;
1212
+ if (typeof generatedPosition.lastColumn == "number") {
1213
+ generatedPosition.lastColumn += columnShift;
1214
+ }
1215
+ }
1216
+ if (generatedPosition.lastColumn === Infinity && nextSection && generatedPosition.line === nextSection.generatedOffset.generatedLine) {
1217
+ generatedPosition.lastColumn = nextSection.generatedOffset.generatedColumn - 2;
1218
+ }
1219
+ generatedPosition.line += lineShift;
1220
+ return generatedPosition;
1221
+ }
1222
+ return { line: null, column: null, lastColumn: null };
1223
+ }
1224
+ allGeneratedPositionsFor(aArgs) {
1225
+ const index = this._findSectionIndex(util.getArg(aArgs, "source")),section = index >= 0 ? this._sections[index] : null,nextSection = index >= 0 && index + 1 < this._sections.length ? this._sections[index + 1] : null;
1226
+ if (!section)return [];
1227
+ return section.consumer.allGeneratedPositionsFor(aArgs).map((generatedPosition) => {
1228
+ const lineShift = section.generatedOffset.generatedLine - 1,columnShift = section.generatedOffset.generatedColumn - 1;
1229
+ if (generatedPosition.line === 1) {
1230
+ generatedPosition.column += columnShift;
1231
+ if (typeof generatedPosition.lastColumn == "number") {
1232
+ generatedPosition.lastColumn += columnShift;
1233
+ }
1234
+ }
1235
+ if (generatedPosition.lastColumn === Infinity && nextSection && generatedPosition.line === nextSection.generatedOffset.generatedLine) {
1236
+ generatedPosition.lastColumn = nextSection.generatedOffset.generatedColumn - 2;
1237
+ }
1238
+ generatedPosition.line += lineShift;
1239
+ return generatedPosition;
1240
+ });
1241
+ }
1242
+ eachMapping(aCallback,aContext,aOrder) {
1243
+ this._sections.forEach((section, index) => {
1244
+ const nextSection = index + 1 < this._sections.length ? this._sections[index + 1] : null,{ generatedOffset:generatedOffset } = section,lineShift = generatedOffset.generatedLine - 1,columnShift = generatedOffset.generatedColumn - 1;
1245
+ section.consumer.eachMapping(function(mapping) {
1246
+ if (mapping.generatedLine === 1) {
1247
+ mapping.generatedColumn += columnShift;
1248
+ if (typeof mapping.lastGeneratedColumn == "number") {
1249
+ mapping.lastGeneratedColumn += columnShift;
1250
+ }
1251
+ }
1252
+ if (mapping.lastGeneratedColumn === Infinity && nextSection && mapping.generatedLine === nextSection.generatedOffset.generatedLine) {
1253
+ mapping.lastGeneratedColumn = nextSection.generatedOffset.generatedColumn - 2;
1254
+ }
1255
+ mapping.generatedLine += lineShift;
1256
+ aCallback.call(this, mapping);
1257
+ }, aContext, aOrder);
1258
+ });
1259
+ }
1260
+ computeColumnSpans() {
1261
+ for (let i = 0; i < this._sections.length; i++) {
1262
+ this._sections[i].consumer.computeColumnSpans();
1263
+ }
1264
+ }
1265
+ destroy() {
1266
+ for (let i = 0; i < this._sections.length; i++) {
1267
+ this._sections[i].consumer.destroy();
1268
+ }
1269
+ }
1270
+ }
1271
+ exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
1272
+ function _factory(aSourceMap,aSourceMapURL) {
1273
+ let sourceMap = aSourceMap;
1274
+ if (typeof aSourceMap == "string") {
1275
+ sourceMap = util.parseSourceMapInput(aSourceMap);
1276
+ }
1277
+ const consumer = sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
1278
+ return Promise.resolve(consumer);
1279
+ }
1280
+ function _factoryBSM(aSourceMap,aSourceMapURL) {
1281
+ return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
1282
+ }
1283
+
1284
+ }
1285
+ });
1286
+ //#endregion
1287
+ //#region source-node.js
1288
+ var require_source_map_lib_source_node = __commonJS({
1289
+ "source-node.js"(exports, module) {
1290
+ const SourceMapGenerator = require_source_map_lib_source_map_generator().SourceMapGenerator,util = require_source_map_lib_util(),REGEX_NEWLINE = /(\r?\n)/,NEWLINE_CODE = 10,isSourceNode = "$$$isSourceNode$$$";
1291
+ class SourceNode {
1292
+ constructor(aLine,aColumn,aSource,aChunks,aName) {
1293
+ this.children = [];
1294
+ this.sourceContents = {};
1295
+ this.line = aLine == null ? null : aLine;
1296
+ this.column = aColumn == null ? null : aColumn;
1297
+ this.source = aSource == null ? null : aSource;
1298
+ this.name = aName == null ? null : aName;
1299
+ this[isSourceNode] = true;
1300
+ if (aChunks != null)this.add(aChunks);
1301
+ }
1302
+ static fromStringWithSourceMap(aGeneratedCode,aSourceMapConsumer,aRelativePath) {
1303
+ const node = new SourceNode(),remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
1304
+ let remainingLinesIndex = 0;
1305
+ const shiftNextLine = function() {
1306
+ const lineContents = getNextLine(),newLine = getNextLine() || "";
1307
+ return lineContents + newLine;
1308
+ function getNextLine() {
1309
+ return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : undefined;
1310
+ }
1311
+ };
1312
+ let lastGeneratedLine = 1,lastGeneratedColumn = 0,lastMapping = null,nextLine;
1313
+ aSourceMapConsumer.eachMapping(function(mapping) {
1314
+ if (lastMapping !== null) {
1315
+ if (lastGeneratedLine < mapping.generatedLine) {
1316
+ addMappingWithCode(lastMapping, shiftNextLine());
1317
+ lastGeneratedLine++;
1318
+ lastGeneratedColumn = 0;
1319
+ } else {
1320
+ nextLine = remainingLines[remainingLinesIndex] || "";
1321
+ const code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
1322
+ remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
1323
+ lastGeneratedColumn = mapping.generatedColumn;
1324
+ addMappingWithCode(lastMapping, code);
1325
+ lastMapping = mapping;
1326
+ return;
1327
+ }
1328
+ }
1329
+ while (lastGeneratedLine < mapping.generatedLine) {
1330
+ node.add(shiftNextLine());
1331
+ lastGeneratedLine++;
1332
+ }
1333
+ if (lastGeneratedColumn < mapping.generatedColumn) {
1334
+ nextLine = remainingLines[remainingLinesIndex] || "";
1335
+ node.add(nextLine.substr(0, mapping.generatedColumn));
1336
+ remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
1337
+ lastGeneratedColumn = mapping.generatedColumn;
1338
+ }
1339
+ lastMapping = mapping;
1340
+ }, this);
1341
+ if (remainingLinesIndex < remainingLines.length) {
1342
+ if (lastMapping) {
1343
+ addMappingWithCode(lastMapping, shiftNextLine());
1344
+ }
1345
+ node.add(remainingLines.splice(remainingLinesIndex).join(""));
1346
+ }
1347
+ aSourceMapConsumer.sources.forEach(function(sourceFile) {
1348
+ const content = aSourceMapConsumer.sourceContentFor(sourceFile);
1349
+ if (content != null) {
1350
+ if (aRelativePath != null) {
1351
+ sourceFile = util.join(aRelativePath, sourceFile);
1352
+ }
1353
+ node.setSourceContent(sourceFile, content);
1354
+ }
1355
+ });
1356
+ return node;
1357
+ function addMappingWithCode(mapping,code) {
1358
+ if (mapping === null || mapping.source === undefined) {
1359
+ node.add(code);
1360
+ } else {
1361
+ const source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
1362
+ node.add(new SourceNode(mapping.originalLine, mapping.originalColumn, source, code, mapping.name));
1363
+ }
1364
+ }
1365
+ }
1366
+ add(aChunk) {
1367
+ if (Array.isArray(aChunk)) {
1368
+ aChunk.forEach(function(chunk) {
1369
+ this.add(chunk);
1370
+ }, this);
1371
+ } else if (aChunk[isSourceNode] || typeof aChunk == "string") {
1372
+ if (aChunk) {
1373
+ this.children.push(aChunk);
1374
+ }
1375
+ } else {
1376
+ throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
1377
+ }
1378
+ return this;
1379
+ }
1380
+ prepend(aChunk) {
1381
+ if (Array.isArray(aChunk)) {
1382
+ for (let i = aChunk.length - 1; i >= 0; i--) {
1383
+ this.prepend(aChunk[i]);
1384
+ }
1385
+ } else if (aChunk[isSourceNode] || typeof aChunk == "string") {
1386
+ this.children.unshift(aChunk);
1387
+ } else {
1388
+ throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
1389
+ }
1390
+ return this;
1391
+ }
1392
+ walk(aFn) {
1393
+ let chunk;
1394
+ for (let i = 0,len = this.children.length; i < len; i++) {
1395
+ chunk = this.children[i];
1396
+ if (chunk[isSourceNode]) {
1397
+ chunk.walk(aFn);
1398
+ } else if (chunk !== "") {
1399
+ aFn(chunk, { source: this.source, line: this.line, column: this.column, name: this.name });
1400
+ }
1401
+ }
1402
+ }
1403
+ join(aSep) {
1404
+ let newChildren,i;
1405
+ const len = this.children.length;
1406
+ if (len > 0) {
1407
+ newChildren = [];
1408
+ for (i = 0; i < len - 1; i++) {
1409
+ newChildren.push(this.children[i]);
1410
+ newChildren.push(aSep);
1411
+ }
1412
+ newChildren.push(this.children[i]);
1413
+ this.children = newChildren;
1414
+ }
1415
+ return this;
1416
+ }
1417
+ replaceRight(aPattern,aReplacement) {
1418
+ const lastChild = this.children[this.children.length - 1];
1419
+ if (lastChild[isSourceNode]) {
1420
+ lastChild.replaceRight(aPattern, aReplacement);
1421
+ } else if (typeof lastChild == "string") {
1422
+ this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
1423
+ } else {
1424
+ this.children.push("".replace(aPattern, aReplacement));
1425
+ }
1426
+ return this;
1427
+ }
1428
+ setSourceContent(aSourceFile,aSourceContent) {
1429
+ this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
1430
+ }
1431
+ walkSourceContents(aFn) {
1432
+ for (let i = 0,len = this.children.length; i < len; i++) {
1433
+ if (this.children[i][isSourceNode]) {
1434
+ this.children[i].walkSourceContents(aFn);
1435
+ }
1436
+ }
1437
+ const sources = Object.keys(this.sourceContents);
1438
+ for (let i = 0,len = sources.length; i < len; i++) {
1439
+ aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
1440
+ }
1441
+ }
1442
+ toString() {
1443
+ let str = "";
1444
+ this.walk(function(chunk) {
1445
+ str += chunk;
1446
+ });
1447
+ return str;
1448
+ }
1449
+ toStringWithSourceMap(aArgs) {
1450
+ const generated = { code: "", line: 1, column: 0 },map = new SourceMapGenerator(aArgs);
1451
+ let sourceMappingActive = false,lastOriginalSource = null,lastOriginalLine = null,lastOriginalColumn = null,lastOriginalName = null;
1452
+ this.walk(function(chunk,original) {
1453
+ generated.code += chunk;
1454
+ if (original.source !== null && original.line !== null && original.column !== null) {
1455
+ if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
1456
+ map.addMapping({ source: original.source, original: { line: original.line, column: original.column }, generated: { line: generated.line, column: generated.column }, name: original.name });
1457
+ }
1458
+ lastOriginalSource = original.source;
1459
+ lastOriginalLine = original.line;
1460
+ lastOriginalColumn = original.column;
1461
+ lastOriginalName = original.name;
1462
+ sourceMappingActive = true;
1463
+ } else if (sourceMappingActive) {
1464
+ map.addMapping({ generated: { line: generated.line, column: generated.column } });
1465
+ lastOriginalSource = null;
1466
+ sourceMappingActive = false;
1467
+ }
1468
+ for (let idx = 0,length = chunk.length; idx < length; idx++) {
1469
+ if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
1470
+ generated.line++;
1471
+ generated.column = 0;
1472
+ if (idx + 1 === length) {
1473
+ lastOriginalSource = null;
1474
+ sourceMappingActive = false;
1475
+ } else if (sourceMappingActive) {
1476
+ map.addMapping({ source: original.source, original: { line: original.line, column: original.column }, generated: { line: generated.line, column: generated.column }, name: original.name });
1477
+ }
1478
+ } else {
1479
+ generated.column++;
1480
+ }
1481
+ }
1482
+ });
1483
+ this.walkSourceContents(function(sourceFile,sourceContent) {
1484
+ map.setSourceContent(sourceFile, sourceContent);
1485
+ });
1486
+ return { code: generated.code, map };
1487
+ }
1488
+ }
1489
+ exports.SourceNode = SourceNode;
1490
+
1491
+ }
1492
+ });
1493
+ //#endregion
1494
1494
  //#region source-map.js
1495
1495
  var require_source_map_source_map = __commonJS({
1496
1496
  "source-map.js"(exports, module) {
@@ -2845,7 +2845,7 @@ async function createSourceMapConsumer(sourceMapJson) {
2845
2845
  return null;
2846
2846
  }
2847
2847
  try {
2848
- const mod = await Promise.resolve().then(()=>require_source_map_source_map());
2848
+ const mod = await Promise.resolve().then(()=>__toESM(require_source_map_source_map()));
2849
2849
  return await new mod.SourceMapConsumer(parsed);
2850
2850
  } catch {
2851
2851
  return null;