jass-vue 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jass/vue/version.rb +1 -1
  3. data/lib/jass/vue.rb +1 -0
  4. data/vendor/node_modules/balanced-match/index.js +59 -0
  5. data/vendor/node_modules/balanced-match/package.json +49 -0
  6. data/vendor/node_modules/brace-expansion/index.js +201 -0
  7. data/vendor/node_modules/brace-expansion/package.json +47 -0
  8. data/vendor/node_modules/concat-map/index.js +13 -0
  9. data/vendor/node_modules/concat-map/package.json +43 -0
  10. data/vendor/node_modules/minimatch/minimatch.js +923 -0
  11. data/vendor/node_modules/minimatch/package.json +30 -0
  12. data/vendor/node_modules/rollup-plugin-replace/dist/rollup-plugin-replace.cjs.js +88 -0
  13. data/vendor/node_modules/rollup-plugin-replace/dist/rollup-plugin-replace.es.js +84 -0
  14. data/vendor/node_modules/rollup-plugin-replace/node_modules/estree-walker/dist/estree-walker.es.js +57 -0
  15. data/vendor/node_modules/rollup-plugin-replace/node_modules/estree-walker/dist/estree-walker.umd.js +68 -0
  16. data/vendor/node_modules/rollup-plugin-replace/node_modules/estree-walker/index.d.ts +17 -0
  17. data/vendor/node_modules/rollup-plugin-replace/node_modules/estree-walker/package.json +35 -0
  18. data/vendor/node_modules/rollup-plugin-replace/node_modules/estree-walker/src/estree-walker.js +51 -0
  19. data/vendor/node_modules/rollup-plugin-replace/node_modules/magic-string/dist/magic-string.cjs.js +1300 -0
  20. data/vendor/node_modules/rollup-plugin-replace/node_modules/magic-string/dist/magic-string.es.js +1296 -0
  21. data/vendor/node_modules/rollup-plugin-replace/node_modules/magic-string/dist/magic-string.umd.js +1352 -0
  22. data/vendor/node_modules/rollup-plugin-replace/node_modules/magic-string/index.d.ts +83 -0
  23. data/vendor/node_modules/rollup-plugin-replace/node_modules/magic-string/package.json +55 -0
  24. data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js +302 -0
  25. data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/dist/pluginutils.es.js +292 -0
  26. data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/package.json +46 -0
  27. data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/addExtension.js +6 -0
  28. data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/attachScopes.js +155 -0
  29. data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/createFilter.js +33 -0
  30. data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/dataToEsm.js +69 -0
  31. data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/index.js +5 -0
  32. data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/makeLegalIdentifier.js +15 -0
  33. data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/utils/ensureArray.js +5 -0
  34. data/vendor/node_modules/rollup-plugin-replace/package.json +43 -0
  35. data/vendor/node_modules/rollup-plugin-replace/src/index.js +80 -0
  36. data/vendor/package.json +1 -0
  37. data/vendor/yarn.lock +47 -1
  38. metadata +36 -4
@@ -0,0 +1,1352 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
+ typeof define === 'function' && define.amd ? define(factory) :
4
+ (global.MagicString = factory());
5
+ }(this, (function () { 'use strict';
6
+
7
+ function Chunk ( start, end, content ) {
8
+ this.start = start;
9
+ this.end = end;
10
+ this.original = content;
11
+
12
+ this.intro = '';
13
+ this.outro = '';
14
+
15
+ this.content = content;
16
+ this.storeName = false;
17
+ this.edited = false;
18
+
19
+ // we make these non-enumerable, for sanity while debugging
20
+ Object.defineProperties( this, {
21
+ previous: { writable: true, value: null },
22
+ next: { writable: true, value: null }
23
+ });
24
+ }
25
+
26
+ Chunk.prototype = {
27
+ appendLeft: function appendLeft ( content ) {
28
+ this.outro += content;
29
+ },
30
+
31
+ appendRight: function appendRight ( content ) {
32
+ this.intro = this.intro + content;
33
+ },
34
+
35
+ clone: function clone () {
36
+ var chunk = new Chunk( this.start, this.end, this.original );
37
+
38
+ chunk.intro = this.intro;
39
+ chunk.outro = this.outro;
40
+ chunk.content = this.content;
41
+ chunk.storeName = this.storeName;
42
+ chunk.edited = this.edited;
43
+
44
+ return chunk;
45
+ },
46
+
47
+ contains: function contains ( index ) {
48
+ return this.start < index && index < this.end;
49
+ },
50
+
51
+ eachNext: function eachNext ( fn ) {
52
+ var chunk = this;
53
+ while ( chunk ) {
54
+ fn( chunk );
55
+ chunk = chunk.next;
56
+ }
57
+ },
58
+
59
+ eachPrevious: function eachPrevious ( fn ) {
60
+ var chunk = this;
61
+ while ( chunk ) {
62
+ fn( chunk );
63
+ chunk = chunk.previous;
64
+ }
65
+ },
66
+
67
+ edit: function edit ( content, storeName, contentOnly ) {
68
+ this.content = content;
69
+ if ( !contentOnly ) {
70
+ this.intro = '';
71
+ this.outro = '';
72
+ }
73
+ this.storeName = storeName;
74
+
75
+ this.edited = true;
76
+
77
+ return this;
78
+ },
79
+
80
+ prependLeft: function prependLeft ( content ) {
81
+ this.outro = content + this.outro;
82
+ },
83
+
84
+ prependRight: function prependRight ( content ) {
85
+ this.intro = content + this.intro;
86
+ },
87
+
88
+ split: function split ( index ) {
89
+ var sliceIndex = index - this.start;
90
+
91
+ var originalBefore = this.original.slice( 0, sliceIndex );
92
+ var originalAfter = this.original.slice( sliceIndex );
93
+
94
+ this.original = originalBefore;
95
+
96
+ var newChunk = new Chunk( index, this.end, originalAfter );
97
+ newChunk.outro = this.outro;
98
+ this.outro = '';
99
+
100
+ this.end = index;
101
+
102
+ if ( this.edited ) {
103
+ // TODO is this block necessary?...
104
+ newChunk.edit( '', false );
105
+ this.content = '';
106
+ } else {
107
+ this.content = originalBefore;
108
+ }
109
+
110
+ newChunk.next = this.next;
111
+ if ( newChunk.next ) { newChunk.next.previous = newChunk; }
112
+ newChunk.previous = this;
113
+ this.next = newChunk;
114
+
115
+ return newChunk;
116
+ },
117
+
118
+ toString: function toString () {
119
+ return this.intro + this.content + this.outro;
120
+ },
121
+
122
+ trimEnd: function trimEnd ( rx ) {
123
+ this.outro = this.outro.replace( rx, '' );
124
+ if ( this.outro.length ) { return true; }
125
+
126
+ var trimmed = this.content.replace( rx, '' );
127
+
128
+ if ( trimmed.length ) {
129
+ if ( trimmed !== this.content ) {
130
+ this.split( this.start + trimmed.length ).edit( '', false );
131
+ }
132
+
133
+ return true;
134
+ } else {
135
+ this.edit( '', false );
136
+
137
+ this.intro = this.intro.replace( rx, '' );
138
+ if ( this.intro.length ) { return true; }
139
+ }
140
+ },
141
+
142
+ trimStart: function trimStart ( rx ) {
143
+ this.intro = this.intro.replace( rx, '' );
144
+ if ( this.intro.length ) { return true; }
145
+
146
+ var trimmed = this.content.replace( rx, '' );
147
+
148
+ if ( trimmed.length ) {
149
+ if ( trimmed !== this.content ) {
150
+ this.split( this.end - trimmed.length );
151
+ this.edit( '', false );
152
+ }
153
+
154
+ return true;
155
+ } else {
156
+ this.edit( '', false );
157
+
158
+ this.outro = this.outro.replace( rx, '' );
159
+ if ( this.outro.length ) { return true; }
160
+ }
161
+ }
162
+ };
163
+
164
+ var _btoa;
165
+
166
+ if ( typeof window !== 'undefined' && typeof window.btoa === 'function' ) {
167
+ _btoa = window.btoa;
168
+ } else if ( typeof Buffer === 'function' ) {
169
+ _btoa = function (str) { return new Buffer( str ).toString( 'base64' ); };
170
+ } else {
171
+ _btoa = function () {
172
+ throw new Error( 'Unsupported environment: `window.btoa` or `Buffer` should be supported.' );
173
+ };
174
+ }
175
+
176
+ var btoa = _btoa;
177
+
178
+ function SourceMap ( properties ) {
179
+ this.version = 3;
180
+
181
+ this.file = properties.file;
182
+ this.sources = properties.sources;
183
+ this.sourcesContent = properties.sourcesContent;
184
+ this.names = properties.names;
185
+ this.mappings = properties.mappings;
186
+ }
187
+
188
+ SourceMap.prototype = {
189
+ toString: function toString () {
190
+ return JSON.stringify( this );
191
+ },
192
+
193
+ toUrl: function toUrl () {
194
+ return 'data:application/json;charset=utf-8;base64,' + btoa( this.toString() );
195
+ }
196
+ };
197
+
198
+ function guessIndent ( code ) {
199
+ var lines = code.split( '\n' );
200
+
201
+ var tabbed = lines.filter( function (line) { return /^\t+/.test( line ); } );
202
+ var spaced = lines.filter( function (line) { return /^ {2,}/.test( line ); } );
203
+
204
+ if ( tabbed.length === 0 && spaced.length === 0 ) {
205
+ return null;
206
+ }
207
+
208
+ // More lines tabbed than spaced? Assume tabs, and
209
+ // default to tabs in the case of a tie (or nothing
210
+ // to go on)
211
+ if ( tabbed.length >= spaced.length ) {
212
+ return '\t';
213
+ }
214
+
215
+ // Otherwise, we need to guess the multiple
216
+ var min = spaced.reduce( function ( previous, current ) {
217
+ var numSpaces = /^ +/.exec( current )[0].length;
218
+ return Math.min( numSpaces, previous );
219
+ }, Infinity );
220
+
221
+ return new Array( min + 1 ).join( ' ' );
222
+ }
223
+
224
+ function getRelativePath ( from, to ) {
225
+ var fromParts = from.split( /[\/\\]/ );
226
+ var toParts = to.split( /[\/\\]/ );
227
+
228
+ fromParts.pop(); // get dirname
229
+
230
+ while ( fromParts[0] === toParts[0] ) {
231
+ fromParts.shift();
232
+ toParts.shift();
233
+ }
234
+
235
+ if ( fromParts.length ) {
236
+ var i = fromParts.length;
237
+ while ( i-- ) { fromParts[i] = '..'; }
238
+ }
239
+
240
+ return fromParts.concat( toParts ).join( '/' );
241
+ }
242
+
243
+ var toString = Object.prototype.toString;
244
+
245
+ function isObject ( thing ) {
246
+ return toString.call( thing ) === '[object Object]';
247
+ }
248
+
249
+ function getLocator ( source ) {
250
+ var originalLines = source.split( '\n' );
251
+
252
+ var start = 0;
253
+ var lineRanges = originalLines.map( function ( line, i ) {
254
+ var end = start + line.length + 1;
255
+ var range = { start: start, end: end, line: i };
256
+
257
+ start = end;
258
+ return range;
259
+ });
260
+
261
+ var i = 0;
262
+
263
+ function rangeContains ( range, index ) {
264
+ return range.start <= index && index < range.end;
265
+ }
266
+
267
+ function getLocation ( range, index ) {
268
+ return { line: range.line, column: index - range.start };
269
+ }
270
+
271
+ return function locate ( index ) {
272
+ var range = lineRanges[i];
273
+
274
+ var d = index >= range.end ? 1 : -1;
275
+
276
+ while ( range ) {
277
+ if ( rangeContains( range, index ) ) { return getLocation( range, index ); }
278
+
279
+ i += d;
280
+ range = lineRanges[i];
281
+ }
282
+ };
283
+ }
284
+
285
+ var charToInteger = {};
286
+ var integerToChar = {};
287
+
288
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split( '' ).forEach( function ( char, i ) {
289
+ charToInteger[ char ] = i;
290
+ integerToChar[ i ] = char;
291
+ });
292
+
293
+
294
+
295
+ function encode ( value ) {
296
+ var result;
297
+
298
+ if ( typeof value === 'number' ) {
299
+ result = encodeInteger( value );
300
+ } else {
301
+ result = '';
302
+ for ( var i = 0; i < value.length; i += 1 ) {
303
+ result += encodeInteger( value[i] );
304
+ }
305
+ }
306
+
307
+ return result;
308
+ }
309
+
310
+ function encodeInteger ( num ) {
311
+ var result = '';
312
+
313
+ if ( num < 0 ) {
314
+ num = ( -num << 1 ) | 1;
315
+ } else {
316
+ num <<= 1;
317
+ }
318
+
319
+ do {
320
+ var clamped = num & 31;
321
+ num >>= 5;
322
+
323
+ if ( num > 0 ) {
324
+ clamped |= 32;
325
+ }
326
+
327
+ result += integerToChar[ clamped ];
328
+ } while ( num > 0 );
329
+
330
+ return result;
331
+ }
332
+
333
+ function Mappings ( hires ) {
334
+ var this$1 = this;
335
+
336
+ var offsets = {
337
+ generatedCodeColumn: 0,
338
+ sourceIndex: 0,
339
+ sourceCodeLine: 0,
340
+ sourceCodeColumn: 0,
341
+ sourceCodeName: 0
342
+ };
343
+
344
+ var generatedCodeLine = 0;
345
+ var generatedCodeColumn = 0;
346
+
347
+ this.raw = [];
348
+ var rawSegments = this.raw[ generatedCodeLine ] = [];
349
+
350
+ var pending = null;
351
+
352
+ this.addEdit = function ( sourceIndex, content, original, loc, nameIndex ) {
353
+ if ( content.length ) {
354
+ rawSegments.push([
355
+ generatedCodeColumn,
356
+ sourceIndex,
357
+ loc.line,
358
+ loc.column,
359
+ nameIndex ]);
360
+ } else if ( pending ) {
361
+ rawSegments.push( pending );
362
+ }
363
+
364
+ this$1.advance( content );
365
+ pending = null;
366
+ };
367
+
368
+ this.addUneditedChunk = function ( sourceIndex, chunk, original, loc, sourcemapLocations ) {
369
+ var originalCharIndex = chunk.start;
370
+ var first = true;
371
+
372
+ while ( originalCharIndex < chunk.end ) {
373
+ if ( hires || first || sourcemapLocations[ originalCharIndex ] ) {
374
+ rawSegments.push([
375
+ generatedCodeColumn,
376
+ sourceIndex,
377
+ loc.line,
378
+ loc.column,
379
+ -1
380
+ ]);
381
+ }
382
+
383
+ if ( original[ originalCharIndex ] === '\n' ) {
384
+ loc.line += 1;
385
+ loc.column = 0;
386
+ generatedCodeLine += 1;
387
+ this$1.raw[ generatedCodeLine ] = rawSegments = [];
388
+ generatedCodeColumn = 0;
389
+ } else {
390
+ loc.column += 1;
391
+ generatedCodeColumn += 1;
392
+ }
393
+
394
+ originalCharIndex += 1;
395
+ first = false;
396
+ }
397
+
398
+ pending = [
399
+ generatedCodeColumn,
400
+ sourceIndex,
401
+ loc.line,
402
+ loc.column,
403
+ -1 ];
404
+ };
405
+
406
+ this.advance = function (str) {
407
+ if ( !str ) { return; }
408
+
409
+ var lines = str.split( '\n' );
410
+ var lastLine = lines.pop();
411
+
412
+ if ( lines.length ) {
413
+ generatedCodeLine += lines.length;
414
+ this$1.raw[ generatedCodeLine ] = rawSegments = [];
415
+ generatedCodeColumn = lastLine.length;
416
+ } else {
417
+ generatedCodeColumn += lastLine.length;
418
+ }
419
+ };
420
+
421
+ this.encode = function () {
422
+ return this$1.raw.map( function (segments) {
423
+ var generatedCodeColumn = 0;
424
+
425
+ return segments.map( function (segment) {
426
+ var arr = [
427
+ segment[0] - generatedCodeColumn,
428
+ segment[1] - offsets.sourceIndex,
429
+ segment[2] - offsets.sourceCodeLine,
430
+ segment[3] - offsets.sourceCodeColumn
431
+ ];
432
+
433
+ generatedCodeColumn = segment[0];
434
+ offsets.sourceIndex = segment[1];
435
+ offsets.sourceCodeLine = segment[2];
436
+ offsets.sourceCodeColumn = segment[3];
437
+
438
+ if ( ~segment[4] ) {
439
+ arr.push( segment[4] - offsets.sourceCodeName );
440
+ offsets.sourceCodeName = segment[4];
441
+ }
442
+
443
+ return encode( arr );
444
+ }).join( ',' );
445
+ }).join( ';' );
446
+ };
447
+ }
448
+
449
+ var Stats = function Stats () {
450
+ Object.defineProperties( this, {
451
+ startTimes: { value: {} }
452
+ });
453
+ };
454
+
455
+ Stats.prototype.time = function time ( label ) {
456
+ this.startTimes[ label ] = process.hrtime();
457
+ };
458
+
459
+ Stats.prototype.timeEnd = function timeEnd ( label ) {
460
+ var elapsed = process.hrtime( this.startTimes[ label ] );
461
+
462
+ if ( !this[ label ] ) { this[ label ] = 0; }
463
+ this[ label ] += elapsed[0] * 1e3 + elapsed[1] * 1e-6;
464
+ };
465
+
466
+ var warned = {
467
+ insertLeft: false,
468
+ insertRight: false,
469
+ storeName: false
470
+ };
471
+
472
+ function MagicString$1 ( string, options ) {
473
+ if ( options === void 0 ) options = {};
474
+
475
+ var chunk = new Chunk( 0, string.length, string );
476
+
477
+ Object.defineProperties( this, {
478
+ original: { writable: true, value: string },
479
+ outro: { writable: true, value: '' },
480
+ intro: { writable: true, value: '' },
481
+ firstChunk: { writable: true, value: chunk },
482
+ lastChunk: { writable: true, value: chunk },
483
+ lastSearchedChunk: { writable: true, value: chunk },
484
+ byStart: { writable: true, value: {} },
485
+ byEnd: { writable: true, value: {} },
486
+ filename: { writable: true, value: options.filename },
487
+ indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
488
+ sourcemapLocations: { writable: true, value: {} },
489
+ storedNames: { writable: true, value: {} },
490
+ indentStr: { writable: true, value: guessIndent( string ) }
491
+ });
492
+
493
+ this.byStart[ 0 ] = chunk;
494
+ this.byEnd[ string.length ] = chunk;
495
+ }
496
+
497
+ MagicString$1.prototype = {
498
+ addSourcemapLocation: function addSourcemapLocation ( char ) {
499
+ this.sourcemapLocations[ char ] = true;
500
+ },
501
+
502
+ append: function append ( content ) {
503
+ if ( typeof content !== 'string' ) { throw new TypeError( 'outro content must be a string' ); }
504
+
505
+ this.outro += content;
506
+ return this;
507
+ },
508
+
509
+ appendLeft: function appendLeft ( index, content ) {
510
+ if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
511
+
512
+ this._split( index );
513
+
514
+ var chunk = this.byEnd[ index ];
515
+
516
+ if ( chunk ) {
517
+ chunk.appendLeft( content );
518
+ } else {
519
+ this.intro += content;
520
+ }
521
+
522
+ return this;
523
+ },
524
+
525
+ appendRight: function appendRight ( index, content ) {
526
+ if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
527
+
528
+ this._split( index );
529
+
530
+ var chunk = this.byStart[ index ];
531
+
532
+ if ( chunk ) {
533
+ chunk.appendRight( content );
534
+ } else {
535
+ this.outro += content;
536
+ }
537
+
538
+ return this;
539
+ },
540
+
541
+ clone: function clone () {
542
+ var cloned = new MagicString$1( this.original, { filename: this.filename });
543
+
544
+ var originalChunk = this.firstChunk;
545
+ var clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();
546
+
547
+ while ( originalChunk ) {
548
+ cloned.byStart[ clonedChunk.start ] = clonedChunk;
549
+ cloned.byEnd[ clonedChunk.end ] = clonedChunk;
550
+
551
+ var nextOriginalChunk = originalChunk.next;
552
+ var nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
553
+
554
+ if ( nextClonedChunk ) {
555
+ clonedChunk.next = nextClonedChunk;
556
+ nextClonedChunk.previous = clonedChunk;
557
+
558
+ clonedChunk = nextClonedChunk;
559
+ }
560
+
561
+ originalChunk = nextOriginalChunk;
562
+ }
563
+
564
+ cloned.lastChunk = clonedChunk;
565
+
566
+ if ( this.indentExclusionRanges ) {
567
+ cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
568
+ }
569
+
570
+ Object.keys( this.sourcemapLocations ).forEach( function (loc) {
571
+ cloned.sourcemapLocations[ loc ] = true;
572
+ });
573
+
574
+ return cloned;
575
+ },
576
+
577
+ generateMap: function generateMap ( options ) {
578
+ var this$1 = this;
579
+
580
+ options = options || {};
581
+
582
+ var sourceIndex = 0;
583
+ var names = Object.keys( this.storedNames );
584
+ var mappings = new Mappings( options.hires );
585
+
586
+ var locate = getLocator( this.original );
587
+
588
+ if ( this.intro ) {
589
+ mappings.advance( this.intro );
590
+ }
591
+
592
+ this.firstChunk.eachNext( function (chunk) {
593
+ var loc = locate( chunk.start );
594
+
595
+ if ( chunk.intro.length ) { mappings.advance( chunk.intro ); }
596
+
597
+ if ( chunk.edited ) {
598
+ mappings.addEdit( sourceIndex, chunk.content, chunk.original, loc, chunk.storeName ? names.indexOf( chunk.original ) : -1 );
599
+ } else {
600
+ mappings.addUneditedChunk( sourceIndex, chunk, this$1.original, loc, this$1.sourcemapLocations );
601
+ }
602
+
603
+ if ( chunk.outro.length ) { mappings.advance( chunk.outro ); }
604
+ });
605
+
606
+ var map = new SourceMap({
607
+ file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
608
+ sources: [ options.source ? getRelativePath( options.file || '', options.source ) : null ],
609
+ sourcesContent: options.includeContent ? [ this.original ] : [ null ],
610
+ names: names,
611
+ mappings: mappings.encode()
612
+ });
613
+ return map;
614
+ },
615
+
616
+ getIndentString: function getIndentString () {
617
+ return this.indentStr === null ? '\t' : this.indentStr;
618
+ },
619
+
620
+ indent: function indent ( indentStr, options ) {
621
+ var this$1 = this;
622
+
623
+ var pattern = /^[^\r\n]/gm;
624
+
625
+ if ( isObject( indentStr ) ) {
626
+ options = indentStr;
627
+ indentStr = undefined;
628
+ }
629
+
630
+ indentStr = indentStr !== undefined ? indentStr : ( this.indentStr || '\t' );
631
+
632
+ if ( indentStr === '' ) { return this; } // noop
633
+
634
+ options = options || {};
635
+
636
+ // Process exclusion ranges
637
+ var isExcluded = {};
638
+
639
+ if ( options.exclude ) {
640
+ var exclusions = typeof options.exclude[0] === 'number' ? [ options.exclude ] : options.exclude;
641
+ exclusions.forEach( function (exclusion) {
642
+ for ( var i = exclusion[0]; i < exclusion[1]; i += 1 ) {
643
+ isExcluded[i] = true;
644
+ }
645
+ });
646
+ }
647
+
648
+ var shouldIndentNextCharacter = options.indentStart !== false;
649
+ var replacer = function (match) {
650
+ if ( shouldIndentNextCharacter ) { return ("" + indentStr + match); }
651
+ shouldIndentNextCharacter = true;
652
+ return match;
653
+ };
654
+
655
+ this.intro = this.intro.replace( pattern, replacer );
656
+
657
+ var charIndex = 0;
658
+
659
+ var chunk = this.firstChunk;
660
+
661
+ while ( chunk ) {
662
+ var end = chunk.end;
663
+
664
+ if ( chunk.edited ) {
665
+ if ( !isExcluded[ charIndex ] ) {
666
+ chunk.content = chunk.content.replace( pattern, replacer );
667
+
668
+ if ( chunk.content.length ) {
669
+ shouldIndentNextCharacter = chunk.content[ chunk.content.length - 1 ] === '\n';
670
+ }
671
+ }
672
+ } else {
673
+ charIndex = chunk.start;
674
+
675
+ while ( charIndex < end ) {
676
+ if ( !isExcluded[ charIndex ] ) {
677
+ var char = this$1.original[ charIndex ];
678
+
679
+ if ( char === '\n' ) {
680
+ shouldIndentNextCharacter = true;
681
+ } else if ( char !== '\r' && shouldIndentNextCharacter ) {
682
+ shouldIndentNextCharacter = false;
683
+
684
+ if ( charIndex === chunk.start ) {
685
+ chunk.prependRight( indentStr );
686
+ } else {
687
+ this$1._splitChunk( chunk, charIndex );
688
+ chunk = chunk.next;
689
+ chunk.prependRight( indentStr );
690
+ }
691
+ }
692
+ }
693
+
694
+ charIndex += 1;
695
+ }
696
+ }
697
+
698
+ charIndex = chunk.end;
699
+ chunk = chunk.next;
700
+ }
701
+
702
+ this.outro = this.outro.replace( pattern, replacer );
703
+
704
+ return this;
705
+ },
706
+
707
+ insert: function insert () {
708
+ throw new Error( 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)' );
709
+ },
710
+
711
+ insertLeft: function insertLeft ( index, content ) {
712
+ if ( !warned.insertLeft ) {
713
+ console.warn( 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead' ); // eslint-disable-line no-console
714
+ warned.insertLeft = true;
715
+ }
716
+
717
+ return this.appendLeft( index, content );
718
+ },
719
+
720
+ insertRight: function insertRight ( index, content ) {
721
+ if ( !warned.insertRight ) {
722
+ console.warn( 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead' ); // eslint-disable-line no-console
723
+ warned.insertRight = true;
724
+ }
725
+
726
+ return this.prependRight( index, content );
727
+ },
728
+
729
+ move: function move ( start, end, index ) {
730
+ if ( index >= start && index <= end ) { throw new Error( 'Cannot move a selection inside itself' ); }
731
+
732
+ this._split( start );
733
+ this._split( end );
734
+ this._split( index );
735
+
736
+ var first = this.byStart[ start ];
737
+ var last = this.byEnd[ end ];
738
+
739
+ var oldLeft = first.previous;
740
+ var oldRight = last.next;
741
+
742
+ var newRight = this.byStart[ index ];
743
+ if ( !newRight && last === this.lastChunk ) { return this; }
744
+ var newLeft = newRight ? newRight.previous : this.lastChunk;
745
+
746
+ if ( oldLeft ) { oldLeft.next = oldRight; }
747
+ if ( oldRight ) { oldRight.previous = oldLeft; }
748
+
749
+ if ( newLeft ) { newLeft.next = first; }
750
+ if ( newRight ) { newRight.previous = last; }
751
+
752
+ if ( !first.previous ) { this.firstChunk = last.next; }
753
+ if ( !last.next ) {
754
+ this.lastChunk = first.previous;
755
+ this.lastChunk.next = null;
756
+ }
757
+
758
+ first.previous = newLeft;
759
+ last.next = newRight || null;
760
+
761
+ if ( !newLeft ) { this.firstChunk = first; }
762
+ if ( !newRight ) { this.lastChunk = last; }
763
+
764
+ return this;
765
+ },
766
+
767
+ overwrite: function overwrite ( start, end, content, options ) {
768
+ var this$1 = this;
769
+
770
+ if ( typeof content !== 'string' ) { throw new TypeError( 'replacement content must be a string' ); }
771
+
772
+ while ( start < 0 ) { start += this$1.original.length; }
773
+ while ( end < 0 ) { end += this$1.original.length; }
774
+
775
+ if ( end > this.original.length ) { throw new Error( 'end is out of bounds' ); }
776
+ if ( start === end ) { throw new Error( 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead' ); }
777
+
778
+ this._split( start );
779
+ this._split( end );
780
+
781
+ if ( options === true ) {
782
+ if ( !warned.storeName ) {
783
+ console.warn( 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string' ); // eslint-disable-line no-console
784
+ warned.storeName = true;
785
+ }
786
+
787
+ options = { storeName: true };
788
+ }
789
+ var storeName = options !== undefined ? options.storeName : false;
790
+ var contentOnly = options !== undefined ? options.contentOnly : false;
791
+
792
+ if ( storeName ) {
793
+ var original = this.original.slice( start, end );
794
+ this.storedNames[ original ] = true;
795
+ }
796
+
797
+ var first = this.byStart[ start ];
798
+ var last = this.byEnd[ end ];
799
+
800
+ if ( first ) {
801
+ if ( end > first.end && first.next !== this.byStart[ first.end ] ) {
802
+ throw new Error( 'Cannot overwrite across a split point' );
803
+ }
804
+
805
+ first.edit( content, storeName, contentOnly );
806
+
807
+ if ( first !== last ) {
808
+ var chunk = first.next;
809
+ while ( chunk !== last ) {
810
+ chunk.edit( '', false );
811
+ chunk = chunk.next;
812
+ }
813
+
814
+ chunk.edit( '', false );
815
+ }
816
+ }
817
+
818
+ else {
819
+ // must be inserting at the end
820
+ var newChunk = new Chunk( start, end, '' ).edit( content, storeName );
821
+
822
+ // TODO last chunk in the array may not be the last chunk, if it's moved...
823
+ last.next = newChunk;
824
+ newChunk.previous = last;
825
+ }
826
+
827
+ return this;
828
+ },
829
+
830
+ prepend: function prepend ( content ) {
831
+ if ( typeof content !== 'string' ) { throw new TypeError( 'outro content must be a string' ); }
832
+
833
+ this.intro = content + this.intro;
834
+ return this;
835
+ },
836
+
837
+ prependLeft: function prependLeft ( index, content ) {
838
+ if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
839
+
840
+ this._split( index );
841
+
842
+ var chunk = this.byEnd[ index ];
843
+
844
+ if ( chunk ) {
845
+ chunk.prependLeft( content );
846
+ } else {
847
+ this.intro = content + this.intro;
848
+ }
849
+
850
+ return this;
851
+ },
852
+
853
+ prependRight: function prependRight ( index, content ) {
854
+ if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
855
+
856
+ this._split( index );
857
+
858
+ var chunk = this.byStart[ index ];
859
+
860
+ if ( chunk ) {
861
+ chunk.prependRight( content );
862
+ } else {
863
+ this.outro = content + this.outro;
864
+ }
865
+
866
+ return this;
867
+ },
868
+
869
+ remove: function remove ( start, end ) {
870
+ var this$1 = this;
871
+
872
+ while ( start < 0 ) { start += this$1.original.length; }
873
+ while ( end < 0 ) { end += this$1.original.length; }
874
+
875
+ if ( start === end ) { return this; }
876
+
877
+ if ( start < 0 || end > this.original.length ) { throw new Error( 'Character is out of bounds' ); }
878
+ if ( start > end ) { throw new Error( 'end must be greater than start' ); }
879
+
880
+ this._split( start );
881
+ this._split( end );
882
+
883
+ var chunk = this.byStart[ start ];
884
+
885
+ while ( chunk ) {
886
+ chunk.intro = '';
887
+ chunk.outro = '';
888
+ chunk.edit( '' );
889
+
890
+ chunk = end > chunk.end ? this$1.byStart[ chunk.end ] : null;
891
+ }
892
+
893
+ return this;
894
+ },
895
+
896
+ slice: function slice ( start, end ) {
897
+ var this$1 = this;
898
+ if ( start === void 0 ) start = 0;
899
+ if ( end === void 0 ) end = this.original.length;
900
+
901
+ while ( start < 0 ) { start += this$1.original.length; }
902
+ while ( end < 0 ) { end += this$1.original.length; }
903
+
904
+ var result = '';
905
+
906
+ // find start chunk
907
+ var chunk = this.firstChunk;
908
+ while ( chunk && ( chunk.start > start || chunk.end <= start ) ) {
909
+
910
+ // found end chunk before start
911
+ if ( chunk.start < end && chunk.end >= end ) {
912
+ return result;
913
+ }
914
+
915
+ chunk = chunk.next;
916
+ }
917
+
918
+ if ( chunk && chunk.edited && chunk.start !== start ) { throw new Error(("Cannot use replaced character " + start + " as slice start anchor.")); }
919
+
920
+ var startChunk = chunk;
921
+ while ( chunk ) {
922
+ if ( chunk.intro && ( startChunk !== chunk || chunk.start === start ) ) {
923
+ result += chunk.intro;
924
+ }
925
+
926
+ var containsEnd = chunk.start < end && chunk.end >= end;
927
+ if ( containsEnd && chunk.edited && chunk.end !== end ) { throw new Error(("Cannot use replaced character " + end + " as slice end anchor.")); }
928
+
929
+ var sliceStart = startChunk === chunk ? start - chunk.start : 0;
930
+ var sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
931
+
932
+ result += chunk.content.slice( sliceStart, sliceEnd );
933
+
934
+ if ( chunk.outro && ( !containsEnd || chunk.end === end ) ) {
935
+ result += chunk.outro;
936
+ }
937
+
938
+ if ( containsEnd ) {
939
+ break;
940
+ }
941
+
942
+ chunk = chunk.next;
943
+ }
944
+
945
+ return result;
946
+ },
947
+
948
+ // TODO deprecate this? not really very useful
949
+ snip: function snip ( start, end ) {
950
+ var clone = this.clone();
951
+ clone.remove( 0, start );
952
+ clone.remove( end, clone.original.length );
953
+
954
+ return clone;
955
+ },
956
+
957
+ _split: function _split ( index ) {
958
+ var this$1 = this;
959
+
960
+ if ( this.byStart[ index ] || this.byEnd[ index ] ) { return; }
961
+
962
+ var chunk = this.lastSearchedChunk;
963
+ var searchForward = index > chunk.end;
964
+
965
+ while ( true ) {
966
+ if ( chunk.contains( index ) ) { return this$1._splitChunk( chunk, index ); }
967
+
968
+ chunk = searchForward ?
969
+ this$1.byStart[ chunk.end ] :
970
+ this$1.byEnd[ chunk.start ];
971
+ }
972
+ },
973
+
974
+ _splitChunk: function _splitChunk ( chunk, index ) {
975
+ if ( chunk.edited && chunk.content.length ) { // zero-length edited chunks are a special case (overlapping replacements)
976
+ var loc = getLocator( this.original )( index );
977
+ throw new Error( ("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")") );
978
+ }
979
+
980
+ var newChunk = chunk.split( index );
981
+
982
+ this.byEnd[ index ] = chunk;
983
+ this.byStart[ index ] = newChunk;
984
+ this.byEnd[ newChunk.end ] = newChunk;
985
+
986
+ if ( chunk === this.lastChunk ) { this.lastChunk = newChunk; }
987
+
988
+ this.lastSearchedChunk = chunk;
989
+ return true;
990
+ },
991
+
992
+ toString: function toString () {
993
+ var str = this.intro;
994
+
995
+ var chunk = this.firstChunk;
996
+ while ( chunk ) {
997
+ str += chunk.toString();
998
+ chunk = chunk.next;
999
+ }
1000
+
1001
+ return str + this.outro;
1002
+ },
1003
+
1004
+ trimLines: function trimLines () {
1005
+ return this.trim('[\\r\\n]');
1006
+ },
1007
+
1008
+ trim: function trim ( charType ) {
1009
+ return this.trimStart( charType ).trimEnd( charType );
1010
+ },
1011
+
1012
+ trimEnd: function trimEnd ( charType ) {
1013
+ var this$1 = this;
1014
+
1015
+ var rx = new RegExp( ( charType || '\\s' ) + '+$' );
1016
+
1017
+ this.outro = this.outro.replace( rx, '' );
1018
+ if ( this.outro.length ) { return this; }
1019
+
1020
+ var chunk = this.lastChunk;
1021
+
1022
+ do {
1023
+ var end = chunk.end;
1024
+ var aborted = chunk.trimEnd( rx );
1025
+
1026
+ // if chunk was trimmed, we have a new lastChunk
1027
+ if ( chunk.end !== end ) {
1028
+ if ( this$1.lastChunk === chunk ) {
1029
+ this$1.lastChunk = chunk.next;
1030
+ }
1031
+
1032
+ this$1.byEnd[ chunk.end ] = chunk;
1033
+ this$1.byStart[ chunk.next.start ] = chunk.next;
1034
+ this$1.byEnd[ chunk.next.end ] = chunk.next;
1035
+ }
1036
+
1037
+ if ( aborted ) { return this$1; }
1038
+ chunk = chunk.previous;
1039
+ } while ( chunk );
1040
+
1041
+ return this;
1042
+ },
1043
+
1044
+ trimStart: function trimStart ( charType ) {
1045
+ var this$1 = this;
1046
+
1047
+ var rx = new RegExp( '^' + ( charType || '\\s' ) + '+' );
1048
+
1049
+ this.intro = this.intro.replace( rx, '' );
1050
+ if ( this.intro.length ) { return this; }
1051
+
1052
+ var chunk = this.firstChunk;
1053
+
1054
+ do {
1055
+ var end = chunk.end;
1056
+ var aborted = chunk.trimStart( rx );
1057
+
1058
+ if ( chunk.end !== end ) {
1059
+ // special case...
1060
+ if ( chunk === this$1.lastChunk ) { this$1.lastChunk = chunk.next; }
1061
+
1062
+ this$1.byEnd[ chunk.end ] = chunk;
1063
+ this$1.byStart[ chunk.next.start ] = chunk.next;
1064
+ this$1.byEnd[ chunk.next.end ] = chunk.next;
1065
+ }
1066
+
1067
+ if ( aborted ) { return this$1; }
1068
+ chunk = chunk.next;
1069
+ } while ( chunk );
1070
+
1071
+ return this;
1072
+ }
1073
+ };
1074
+
1075
+ var hasOwnProp = Object.prototype.hasOwnProperty;
1076
+
1077
+ function Bundle ( options ) {
1078
+ if ( options === void 0 ) options = {};
1079
+
1080
+ this.intro = options.intro || '';
1081
+ this.separator = options.separator !== undefined ? options.separator : '\n';
1082
+
1083
+ this.sources = [];
1084
+
1085
+ this.uniqueSources = [];
1086
+ this.uniqueSourceIndexByFilename = {};
1087
+ }
1088
+
1089
+ Bundle.prototype = {
1090
+ addSource: function addSource ( source ) {
1091
+ if ( source instanceof MagicString$1 ) {
1092
+ return this.addSource({
1093
+ content: source,
1094
+ filename: source.filename,
1095
+ separator: this.separator
1096
+ });
1097
+ }
1098
+
1099
+ if ( !isObject( source ) || !source.content ) {
1100
+ throw new Error( 'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`' );
1101
+ }
1102
+
1103
+ [ 'filename', 'indentExclusionRanges', 'separator' ].forEach( function (option) {
1104
+ if ( !hasOwnProp.call( source, option ) ) { source[ option ] = source.content[ option ]; }
1105
+ });
1106
+
1107
+ if ( source.separator === undefined ) { // TODO there's a bunch of this sort of thing, needs cleaning up
1108
+ source.separator = this.separator;
1109
+ }
1110
+
1111
+ if ( source.filename ) {
1112
+ if ( !hasOwnProp.call( this.uniqueSourceIndexByFilename, source.filename ) ) {
1113
+ this.uniqueSourceIndexByFilename[ source.filename ] = this.uniqueSources.length;
1114
+ this.uniqueSources.push({ filename: source.filename, content: source.content.original });
1115
+ } else {
1116
+ var uniqueSource = this.uniqueSources[ this.uniqueSourceIndexByFilename[ source.filename ] ];
1117
+ if ( source.content.original !== uniqueSource.content ) {
1118
+ throw new Error( ("Illegal source: same filename (" + (source.filename) + "), different contents") );
1119
+ }
1120
+ }
1121
+ }
1122
+
1123
+ this.sources.push( source );
1124
+ return this;
1125
+ },
1126
+
1127
+ append: function append ( str, options ) {
1128
+ this.addSource({
1129
+ content: new MagicString$1( str ),
1130
+ separator: ( options && options.separator ) || ''
1131
+ });
1132
+
1133
+ return this;
1134
+ },
1135
+
1136
+ clone: function clone () {
1137
+ var bundle = new Bundle({
1138
+ intro: this.intro,
1139
+ separator: this.separator
1140
+ });
1141
+
1142
+ this.sources.forEach( function (source) {
1143
+ bundle.addSource({
1144
+ filename: source.filename,
1145
+ content: source.content.clone(),
1146
+ separator: source.separator
1147
+ });
1148
+ });
1149
+
1150
+ return bundle;
1151
+ },
1152
+
1153
+ generateMap: function generateMap ( options ) {
1154
+ var this$1 = this;
1155
+ if ( options === void 0 ) options = {};
1156
+
1157
+ var names = [];
1158
+ this.sources.forEach( function (source) {
1159
+ Object.keys( source.content.storedNames ).forEach( function (name) {
1160
+ if ( !~names.indexOf( name ) ) { names.push( name ); }
1161
+ });
1162
+ });
1163
+
1164
+ var mappings = new Mappings( options.hires );
1165
+
1166
+ if ( this.intro ) {
1167
+ mappings.advance( this.intro );
1168
+ }
1169
+
1170
+ this.sources.forEach( function ( source, i ) {
1171
+ if ( i > 0 ) {
1172
+ mappings.advance( this$1.separator );
1173
+ }
1174
+
1175
+ var sourceIndex = source.filename ? this$1.uniqueSourceIndexByFilename[ source.filename ] : -1;
1176
+ var magicString = source.content;
1177
+ var locate = getLocator( magicString.original );
1178
+
1179
+ if ( magicString.intro ) {
1180
+ mappings.advance( magicString.intro );
1181
+ }
1182
+
1183
+ magicString.firstChunk.eachNext( function (chunk) {
1184
+ var loc = locate( chunk.start );
1185
+
1186
+ if ( chunk.intro.length ) { mappings.advance( chunk.intro ); }
1187
+
1188
+ if ( source.filename ) {
1189
+ if ( chunk.edited ) {
1190
+ mappings.addEdit( sourceIndex, chunk.content, chunk.original, loc, chunk.storeName ? names.indexOf( chunk.original ) : -1 );
1191
+ } else {
1192
+ mappings.addUneditedChunk( sourceIndex, chunk, magicString.original, loc, magicString.sourcemapLocations );
1193
+ }
1194
+ }
1195
+
1196
+ else {
1197
+ mappings.advance( chunk.content );
1198
+ }
1199
+
1200
+ if ( chunk.outro.length ) { mappings.advance( chunk.outro ); }
1201
+ });
1202
+
1203
+ if ( magicString.outro ) {
1204
+ mappings.advance( magicString.outro );
1205
+ }
1206
+ });
1207
+
1208
+ return new SourceMap({
1209
+ file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
1210
+ sources: this.uniqueSources.map( function (source) {
1211
+ return options.file ? getRelativePath( options.file, source.filename ) : source.filename;
1212
+ }),
1213
+ sourcesContent: this.uniqueSources.map( function (source) {
1214
+ return options.includeContent ? source.content : null;
1215
+ }),
1216
+ names: names,
1217
+ mappings: mappings.encode()
1218
+ });
1219
+ },
1220
+
1221
+ getIndentString: function getIndentString () {
1222
+ var indentStringCounts = {};
1223
+
1224
+ this.sources.forEach( function (source) {
1225
+ var indentStr = source.content.indentStr;
1226
+
1227
+ if ( indentStr === null ) { return; }
1228
+
1229
+ if ( !indentStringCounts[ indentStr ] ) { indentStringCounts[ indentStr ] = 0; }
1230
+ indentStringCounts[ indentStr ] += 1;
1231
+ });
1232
+
1233
+ return ( Object.keys( indentStringCounts ).sort( function ( a, b ) {
1234
+ return indentStringCounts[a] - indentStringCounts[b];
1235
+ })[0] ) || '\t';
1236
+ },
1237
+
1238
+ indent: function indent ( indentStr ) {
1239
+ var this$1 = this;
1240
+
1241
+ if ( !arguments.length ) {
1242
+ indentStr = this.getIndentString();
1243
+ }
1244
+
1245
+ if ( indentStr === '' ) { return this; } // noop
1246
+
1247
+ var trailingNewline = !this.intro || this.intro.slice( -1 ) === '\n';
1248
+
1249
+ this.sources.forEach( function ( source, i ) {
1250
+ var separator = source.separator !== undefined ? source.separator : this$1.separator;
1251
+ var indentStart = trailingNewline || ( i > 0 && /\r?\n$/.test( separator ) );
1252
+
1253
+ source.content.indent( indentStr, {
1254
+ exclude: source.indentExclusionRanges,
1255
+ indentStart: indentStart//: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator )
1256
+ });
1257
+
1258
+ // TODO this is a very slow way to determine this
1259
+ trailingNewline = source.content.toString().slice( 0, -1 ) === '\n';
1260
+ });
1261
+
1262
+ if ( this.intro ) {
1263
+ this.intro = indentStr + this.intro.replace( /^[^\n]/gm, function ( match, index ) {
1264
+ return index > 0 ? indentStr + match : match;
1265
+ });
1266
+ }
1267
+
1268
+ return this;
1269
+ },
1270
+
1271
+ prepend: function prepend ( str ) {
1272
+ this.intro = str + this.intro;
1273
+ return this;
1274
+ },
1275
+
1276
+ toString: function toString () {
1277
+ var this$1 = this;
1278
+
1279
+ var body = this.sources.map( function ( source, i ) {
1280
+ var separator = source.separator !== undefined ? source.separator : this$1.separator;
1281
+ var str = ( i > 0 ? separator : '' ) + source.content.toString();
1282
+
1283
+ return str;
1284
+ }).join( '' );
1285
+
1286
+ return this.intro + body;
1287
+ },
1288
+
1289
+ trimLines: function trimLines () {
1290
+ return this.trim('[\\r\\n]');
1291
+ },
1292
+
1293
+ trim: function trim ( charType ) {
1294
+ return this.trimStart( charType ).trimEnd( charType );
1295
+ },
1296
+
1297
+ trimStart: function trimStart ( charType ) {
1298
+ var this$1 = this;
1299
+
1300
+ var rx = new RegExp( '^' + ( charType || '\\s' ) + '+' );
1301
+ this.intro = this.intro.replace( rx, '' );
1302
+
1303
+ if ( !this.intro ) {
1304
+ var source;
1305
+ var i = 0;
1306
+
1307
+ do {
1308
+ source = this$1.sources[i];
1309
+
1310
+ if ( !source ) {
1311
+ break;
1312
+ }
1313
+
1314
+ source.content.trimStart( charType );
1315
+ i += 1;
1316
+ } while ( source.content.toString() === '' ); // TODO faster way to determine non-empty source?
1317
+ }
1318
+
1319
+ return this;
1320
+ },
1321
+
1322
+ trimEnd: function trimEnd ( charType ) {
1323
+ var this$1 = this;
1324
+
1325
+ var rx = new RegExp( ( charType || '\\s' ) + '+$' );
1326
+
1327
+ var source;
1328
+ var i = this.sources.length - 1;
1329
+
1330
+ do {
1331
+ source = this$1.sources[i];
1332
+
1333
+ if ( !source ) {
1334
+ this$1.intro = this$1.intro.replace( rx, '' );
1335
+ break;
1336
+ }
1337
+
1338
+ source.content.trimEnd( charType );
1339
+ i -= 1;
1340
+ } while ( source.content.toString() === '' ); // TODO faster way to determine non-empty source?
1341
+
1342
+ return this;
1343
+ }
1344
+ };
1345
+
1346
+ MagicString$1.Bundle = Bundle;
1347
+ MagicString$1.default = MagicString$1; // work around TypeScript bug https://github.com/Rich-Harris/magic-string/pull/121
1348
+
1349
+ return MagicString$1;
1350
+
1351
+ })));
1352
+ //# sourceMappingURL=magic-string.umd.js.map