source: frontend/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 10.9 KB
Line 
1(function (global, factory) {
2 if (typeof exports === 'object' && typeof module !== 'undefined') {
3 factory(module, require('@jridgewell/sourcemap-codec'), require('@jridgewell/trace-mapping'));
4 module.exports = def(module);
5 } else if (typeof define === 'function' && define.amd) {
6 define(['module', '@jridgewell/sourcemap-codec', '@jridgewell/trace-mapping'], function(mod) {
7 factory.apply(this, arguments);
8 mod.exports = def(mod);
9 });
10 } else {
11 const mod = { exports: {} };
12 factory(mod, global.sourcemapCodec, global.traceMapping);
13 global = typeof globalThis !== 'undefined' ? globalThis : global || self;
14 global.genMapping = def(mod);
15 }
16 function def(m) { return 'default' in m.exports ? m.exports.default : m.exports; }
17})(this, (function (module, require_sourcemapCodec, require_traceMapping) {
18"use strict";
19var __create = Object.create;
20var __defProp = Object.defineProperty;
21var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
22var __getOwnPropNames = Object.getOwnPropertyNames;
23var __getProtoOf = Object.getPrototypeOf;
24var __hasOwnProp = Object.prototype.hasOwnProperty;
25var __commonJS = (cb, mod) => function __require() {
26 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
27};
28var __export = (target, all) => {
29 for (var name in all)
30 __defProp(target, name, { get: all[name], enumerable: true });
31};
32var __copyProps = (to, from, except, desc) => {
33 if (from && typeof from === "object" || typeof from === "function") {
34 for (let key of __getOwnPropNames(from))
35 if (!__hasOwnProp.call(to, key) && key !== except)
36 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
37 }
38 return to;
39};
40var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
41 // If the importer is in node compatibility mode or this is not an ESM
42 // file that has been converted to a CommonJS file using a Babel-
43 // compatible transform (i.e. "__esModule" has not been set), then set
44 // "default" to the CommonJS "module.exports" for node compatibility.
45 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
46 mod
47));
48var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
49
50// umd:@jridgewell/sourcemap-codec
51var require_sourcemap_codec = __commonJS({
52 "umd:@jridgewell/sourcemap-codec"(exports, module2) {
53 module2.exports = require_sourcemapCodec;
54 }
55});
56
57// umd:@jridgewell/trace-mapping
58var require_trace_mapping = __commonJS({
59 "umd:@jridgewell/trace-mapping"(exports, module2) {
60 module2.exports = require_traceMapping;
61 }
62});
63
64// src/gen-mapping.ts
65var gen_mapping_exports = {};
66__export(gen_mapping_exports, {
67 GenMapping: () => GenMapping,
68 addMapping: () => addMapping,
69 addSegment: () => addSegment,
70 allMappings: () => allMappings,
71 fromMap: () => fromMap,
72 maybeAddMapping: () => maybeAddMapping,
73 maybeAddSegment: () => maybeAddSegment,
74 setIgnore: () => setIgnore,
75 setSourceContent: () => setSourceContent,
76 toDecodedMap: () => toDecodedMap,
77 toEncodedMap: () => toEncodedMap
78});
79module.exports = __toCommonJS(gen_mapping_exports);
80
81// src/set-array.ts
82var SetArray = class {
83 constructor() {
84 this._indexes = { __proto__: null };
85 this.array = [];
86 }
87};
88function cast(set) {
89 return set;
90}
91function get(setarr, key) {
92 return cast(setarr)._indexes[key];
93}
94function put(setarr, key) {
95 const index = get(setarr, key);
96 if (index !== void 0) return index;
97 const { array, _indexes: indexes } = cast(setarr);
98 const length = array.push(key);
99 return indexes[key] = length - 1;
100}
101function remove(setarr, key) {
102 const index = get(setarr, key);
103 if (index === void 0) return;
104 const { array, _indexes: indexes } = cast(setarr);
105 for (let i = index + 1; i < array.length; i++) {
106 const k = array[i];
107 array[i - 1] = k;
108 indexes[k]--;
109 }
110 indexes[key] = void 0;
111 array.pop();
112}
113
114// src/gen-mapping.ts
115var import_sourcemap_codec = __toESM(require_sourcemap_codec());
116var import_trace_mapping = __toESM(require_trace_mapping());
117
118// src/sourcemap-segment.ts
119var COLUMN = 0;
120var SOURCES_INDEX = 1;
121var SOURCE_LINE = 2;
122var SOURCE_COLUMN = 3;
123var NAMES_INDEX = 4;
124
125// src/gen-mapping.ts
126var NO_NAME = -1;
127var GenMapping = class {
128 constructor({ file, sourceRoot } = {}) {
129 this._names = new SetArray();
130 this._sources = new SetArray();
131 this._sourcesContent = [];
132 this._mappings = [];
133 this.file = file;
134 this.sourceRoot = sourceRoot;
135 this._ignoreList = new SetArray();
136 }
137};
138function cast2(map) {
139 return map;
140}
141function addSegment(map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) {
142 return addSegmentInternal(
143 false,
144 map,
145 genLine,
146 genColumn,
147 source,
148 sourceLine,
149 sourceColumn,
150 name,
151 content
152 );
153}
154function addMapping(map, mapping) {
155 return addMappingInternal(false, map, mapping);
156}
157var maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
158 return addSegmentInternal(
159 true,
160 map,
161 genLine,
162 genColumn,
163 source,
164 sourceLine,
165 sourceColumn,
166 name,
167 content
168 );
169};
170var maybeAddMapping = (map, mapping) => {
171 return addMappingInternal(true, map, mapping);
172};
173function setSourceContent(map, source, content) {
174 const {
175 _sources: sources,
176 _sourcesContent: sourcesContent
177 // _originalScopes: originalScopes,
178 } = cast2(map);
179 const index = put(sources, source);
180 sourcesContent[index] = content;
181}
182function setIgnore(map, source, ignore = true) {
183 const {
184 _sources: sources,
185 _sourcesContent: sourcesContent,
186 _ignoreList: ignoreList
187 // _originalScopes: originalScopes,
188 } = cast2(map);
189 const index = put(sources, source);
190 if (index === sourcesContent.length) sourcesContent[index] = null;
191 if (ignore) put(ignoreList, index);
192 else remove(ignoreList, index);
193}
194function toDecodedMap(map) {
195 const {
196 _mappings: mappings,
197 _sources: sources,
198 _sourcesContent: sourcesContent,
199 _names: names,
200 _ignoreList: ignoreList
201 // _originalScopes: originalScopes,
202 // _generatedRanges: generatedRanges,
203 } = cast2(map);
204 removeEmptyFinalLines(mappings);
205 return {
206 version: 3,
207 file: map.file || void 0,
208 names: names.array,
209 sourceRoot: map.sourceRoot || void 0,
210 sources: sources.array,
211 sourcesContent,
212 mappings,
213 // originalScopes,
214 // generatedRanges,
215 ignoreList: ignoreList.array
216 };
217}
218function toEncodedMap(map) {
219 const decoded = toDecodedMap(map);
220 return Object.assign({}, decoded, {
221 // originalScopes: decoded.originalScopes.map((os) => encodeOriginalScopes(os)),
222 // generatedRanges: encodeGeneratedRanges(decoded.generatedRanges as GeneratedRange[]),
223 mappings: (0, import_sourcemap_codec.encode)(decoded.mappings)
224 });
225}
226function fromMap(input) {
227 const map = new import_trace_mapping.TraceMap(input);
228 const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot });
229 putAll(cast2(gen)._names, map.names);
230 putAll(cast2(gen)._sources, map.sources);
231 cast2(gen)._sourcesContent = map.sourcesContent || map.sources.map(() => null);
232 cast2(gen)._mappings = (0, import_trace_mapping.decodedMappings)(map);
233 if (map.ignoreList) putAll(cast2(gen)._ignoreList, map.ignoreList);
234 return gen;
235}
236function allMappings(map) {
237 const out = [];
238 const { _mappings: mappings, _sources: sources, _names: names } = cast2(map);
239 for (let i = 0; i < mappings.length; i++) {
240 const line = mappings[i];
241 for (let j = 0; j < line.length; j++) {
242 const seg = line[j];
243 const generated = { line: i + 1, column: seg[COLUMN] };
244 let source = void 0;
245 let original = void 0;
246 let name = void 0;
247 if (seg.length !== 1) {
248 source = sources.array[seg[SOURCES_INDEX]];
249 original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };
250 if (seg.length === 5) name = names.array[seg[NAMES_INDEX]];
251 }
252 out.push({ generated, source, original, name });
253 }
254 }
255 return out;
256}
257function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) {
258 const {
259 _mappings: mappings,
260 _sources: sources,
261 _sourcesContent: sourcesContent,
262 _names: names
263 // _originalScopes: originalScopes,
264 } = cast2(map);
265 const line = getIndex(mappings, genLine);
266 const index = getColumnIndex(line, genColumn);
267 if (!source) {
268 if (skipable && skipSourceless(line, index)) return;
269 return insert(line, index, [genColumn]);
270 }
271 assert(sourceLine);
272 assert(sourceColumn);
273 const sourcesIndex = put(sources, source);
274 const namesIndex = name ? put(names, name) : NO_NAME;
275 if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null;
276 if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
277 return;
278 }
279 return insert(
280 line,
281 index,
282 name ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] : [genColumn, sourcesIndex, sourceLine, sourceColumn]
283 );
284}
285function assert(_val) {
286}
287function getIndex(arr, index) {
288 for (let i = arr.length; i <= index; i++) {
289 arr[i] = [];
290 }
291 return arr[index];
292}
293function getColumnIndex(line, genColumn) {
294 let index = line.length;
295 for (let i = index - 1; i >= 0; index = i--) {
296 const current = line[i];
297 if (genColumn >= current[COLUMN]) break;
298 }
299 return index;
300}
301function insert(array, index, value) {
302 for (let i = array.length; i > index; i--) {
303 array[i] = array[i - 1];
304 }
305 array[index] = value;
306}
307function removeEmptyFinalLines(mappings) {
308 const { length } = mappings;
309 let len = length;
310 for (let i = len - 1; i >= 0; len = i, i--) {
311 if (mappings[i].length > 0) break;
312 }
313 if (len < length) mappings.length = len;
314}
315function putAll(setarr, array) {
316 for (let i = 0; i < array.length; i++) put(setarr, array[i]);
317}
318function skipSourceless(line, index) {
319 if (index === 0) return true;
320 const prev = line[index - 1];
321 return prev.length === 1;
322}
323function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) {
324 if (index === 0) return false;
325 const prev = line[index - 1];
326 if (prev.length === 1) return false;
327 return sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME);
328}
329function addMappingInternal(skipable, map, mapping) {
330 const { generated, source, original, name, content } = mapping;
331 if (!source) {
332 return addSegmentInternal(
333 skipable,
334 map,
335 generated.line - 1,
336 generated.column,
337 null,
338 null,
339 null,
340 null,
341 null
342 );
343 }
344 assert(original);
345 return addSegmentInternal(
346 skipable,
347 map,
348 generated.line - 1,
349 generated.column,
350 source,
351 original.line - 1,
352 original.column,
353 name,
354 content
355 );
356}
357}));
358//# sourceMappingURL=gen-mapping.umd.js.map
Note: See TracBrowser for help on using the repository browser.