jass-vue 0.2.1

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