@hortiview/default-components 1.5.1 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,859 +0,0 @@
1
- var M = { exports: {} }, lt = M.exports, K;
2
- function ut() {
3
- return K || (K = 1, function(E, t) {
4
- (function(e, n) {
5
- n(t);
6
- })(lt, function(e) {
7
- const r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", u = new Uint8Array(64), f = new Uint8Array(128);
8
- for (let a = 0; a < r.length; a++) {
9
- const h = r.charCodeAt(a);
10
- u[a] = h, f[h] = a;
11
- }
12
- function o(a, h) {
13
- let i = 0, l = 0, d = 0;
14
- do {
15
- const b = a.next();
16
- d = f[b], i |= (d & 31) << l, l += 5;
17
- } while (d & 32);
18
- const g = i & 1;
19
- return i >>>= 1, g && (i = -2147483648 | -i), h + i;
20
- }
21
- function c(a, h, i) {
22
- let l = h - i;
23
- l = l < 0 ? -l << 1 | 1 : l << 1;
24
- do {
25
- let d = l & 31;
26
- l >>>= 5, l > 0 && (d |= 32), a.write(u[d]);
27
- } while (l > 0);
28
- return h;
29
- }
30
- function k(a, h) {
31
- return a.pos >= h ? !1 : a.peek() !== 44;
32
- }
33
- const O = 1024 * 16, z = typeof TextDecoder < "u" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer < "u" ? {
34
- decode(a) {
35
- return Buffer.from(a.buffer, a.byteOffset, a.byteLength).toString();
36
- }
37
- } : {
38
- decode(a) {
39
- let h = "";
40
- for (let i = 0; i < a.length; i++)
41
- h += String.fromCharCode(a[i]);
42
- return h;
43
- }
44
- };
45
- class D {
46
- constructor() {
47
- this.pos = 0, this.out = "", this.buffer = new Uint8Array(O);
48
- }
49
- write(h) {
50
- const { buffer: i } = this;
51
- i[this.pos++] = h, this.pos === O && (this.out += z.decode(i), this.pos = 0);
52
- }
53
- flush() {
54
- const { buffer: h, out: i, pos: l } = this;
55
- return l > 0 ? i + z.decode(h.subarray(0, l)) : i;
56
- }
57
- }
58
- class G {
59
- constructor(h) {
60
- this.pos = 0, this.buffer = h;
61
- }
62
- next() {
63
- return this.buffer.charCodeAt(this.pos++);
64
- }
65
- peek() {
66
- return this.buffer.charCodeAt(this.pos);
67
- }
68
- indexOf(h) {
69
- const { buffer: i, pos: l } = this, d = i.indexOf(h, l);
70
- return d === -1 ? i.length : d;
71
- }
72
- }
73
- const F = [];
74
- function Z(a) {
75
- const { length: h } = a, i = new G(a), l = [], d = [];
76
- let g = 0;
77
- for (; i.pos < h; i.pos++) {
78
- g = o(i, g);
79
- const b = o(i, 0);
80
- if (!k(i, h)) {
81
- const v = d.pop();
82
- v[2] = g, v[3] = b;
83
- continue;
84
- }
85
- const m = o(i, 0), w = o(i, 0) & 1 ? [g, b, 0, 0, m, o(i, 0)] : [g, b, 0, 0, m];
86
- let y = F;
87
- if (k(i, h)) {
88
- y = [];
89
- do {
90
- const v = o(i, 0);
91
- y.push(v);
92
- } while (k(i, h));
93
- }
94
- w.vars = y, l.push(w), d.push(w);
95
- }
96
- return l;
97
- }
98
- function V(a) {
99
- const h = new D();
100
- for (let i = 0; i < a.length; )
101
- i = H(a, i, h, [0]);
102
- return h.flush();
103
- }
104
- function H(a, h, i, l) {
105
- const d = a[h], { 0: g, 1: b, 2: m, 3: S, 4: C, vars: w } = d;
106
- h > 0 && i.write(44), l[0] = c(i, g, l[0]), c(i, b, 0), c(i, C, 0);
107
- const y = d.length === 6 ? 1 : 0;
108
- c(i, y, 0), d.length === 6 && c(i, d[5], 0);
109
- for (const v of w)
110
- c(i, v, 0);
111
- for (h++; h < a.length; ) {
112
- const v = a[h], { 0: p, 1: x } = v;
113
- if (p > m || p === m && x >= S)
114
- break;
115
- h = H(a, h, i, l);
116
- }
117
- return i.write(44), l[0] = c(i, m, l[0]), c(i, S, 0), h;
118
- }
119
- function tt(a) {
120
- const { length: h } = a, i = new G(a), l = [], d = [];
121
- let g = 0, b = 0, m = 0, S = 0, C = 0, w = 0, y = 0, v = 0;
122
- do {
123
- const p = i.indexOf(";");
124
- let x = 0;
125
- for (; i.pos < p; i.pos++) {
126
- if (x = o(i, x), !k(i, p)) {
127
- const L = d.pop();
128
- L[2] = g, L[3] = x;
129
- continue;
130
- }
131
- const R = o(i, 0), B = R & 1, A = R & 2, T = R & 4;
132
- let Y = null, q = F, _;
133
- if (B) {
134
- const L = o(i, b);
135
- m = o(i, b === L ? m : 0), b = L, _ = [g, x, 0, 0, L, m];
136
- } else
137
- _ = [g, x, 0, 0];
138
- if (_.isScope = !!T, A) {
139
- const L = S, I = C;
140
- S = o(i, S);
141
- const j = L === S;
142
- C = o(i, j ? C : 0), w = o(i, j && I === C ? w : 0), Y = [S, C, w];
143
- }
144
- if (_.callsite = Y, k(i, p)) {
145
- q = [];
146
- do {
147
- y = g, v = x;
148
- const L = o(i, 0);
149
- let I;
150
- if (L < -1) {
151
- I = [[o(i, 0)]];
152
- for (let j = -1; j > L; j--) {
153
- const ot = y;
154
- y = o(i, y), v = o(i, y === ot ? v : 0);
155
- const ht = o(i, 0);
156
- I.push([ht, y, v]);
157
- }
158
- } else
159
- I = [[L]];
160
- q.push(I);
161
- } while (k(i, p));
162
- }
163
- _.bindings = q, l.push(_), d.push(_);
164
- }
165
- g++, i.pos = p + 1;
166
- } while (i.pos < h);
167
- return l;
168
- }
169
- function et(a) {
170
- if (a.length === 0)
171
- return "";
172
- const h = new D();
173
- for (let i = 0; i < a.length; )
174
- i = J(a, i, h, [0, 0, 0, 0, 0, 0, 0]);
175
- return h.flush();
176
- }
177
- function J(a, h, i, l) {
178
- const d = a[h], { 0: g, 1: b, 2: m, 3: S, isScope: C, callsite: w, bindings: y } = d;
179
- l[0] < g ? (W(i, l[0], g), l[0] = g, l[1] = 0) : h > 0 && i.write(44), l[1] = c(i, d[1], l[1]);
180
- const v = (d.length === 6 ? 1 : 0) | (w ? 2 : 0) | (C ? 4 : 0);
181
- if (c(i, v, 0), d.length === 6) {
182
- const { 4: p, 5: x } = d;
183
- p !== l[2] && (l[3] = 0), l[2] = c(i, p, l[2]), l[3] = c(i, x, l[3]);
184
- }
185
- if (w) {
186
- const { 0: p, 1: x, 2: R } = d.callsite;
187
- p !== l[4] ? (l[5] = 0, l[6] = 0) : x !== l[5] && (l[6] = 0), l[4] = c(i, p, l[4]), l[5] = c(i, x, l[5]), l[6] = c(i, R, l[6]);
188
- }
189
- if (y)
190
- for (const p of y) {
191
- p.length > 1 && c(i, -p.length, 0);
192
- const x = p[0][0];
193
- c(i, x, 0);
194
- let R = g, B = b;
195
- for (let A = 1; A < p.length; A++) {
196
- const T = p[A];
197
- R = c(i, T[1], R), B = c(i, T[2], B), c(i, T[0], 0);
198
- }
199
- }
200
- for (h++; h < a.length; ) {
201
- const p = a[h], { 0: x, 1: R } = p;
202
- if (x > m || x === m && R >= S)
203
- break;
204
- h = J(a, h, i, l);
205
- }
206
- return l[0] < m ? (W(i, l[0], m), l[0] = m, l[1] = 0) : i.write(44), l[1] = c(i, S, l[1]), h;
207
- }
208
- function W(a, h, i) {
209
- do
210
- a.write(59);
211
- while (++h < i);
212
- }
213
- function nt(a) {
214
- const { length: h } = a, i = new G(a), l = [];
215
- let d = 0, g = 0, b = 0, m = 0, S = 0;
216
- do {
217
- const C = i.indexOf(";"), w = [];
218
- let y = !0, v = 0;
219
- for (d = 0; i.pos < C; ) {
220
- let p;
221
- d = o(i, d), d < v && (y = !1), v = d, k(i, C) ? (g = o(i, g), b = o(i, b), m = o(i, m), k(i, C) ? (S = o(i, S), p = [d, g, b, m, S]) : p = [d, g, b, m]) : p = [d], w.push(p), i.pos++;
222
- }
223
- y || it(w), l.push(w), i.pos = C + 1;
224
- } while (i.pos <= h);
225
- return l;
226
- }
227
- function it(a) {
228
- a.sort(st);
229
- }
230
- function st(a, h) {
231
- return a[0] - h[0];
232
- }
233
- function rt(a) {
234
- const h = new D();
235
- let i = 0, l = 0, d = 0, g = 0;
236
- for (let b = 0; b < a.length; b++) {
237
- const m = a[b];
238
- if (b > 0 && h.write(59), m.length === 0)
239
- continue;
240
- let S = 0;
241
- for (let C = 0; C < m.length; C++) {
242
- const w = m[C];
243
- C > 0 && h.write(44), S = c(h, w[0], S), w.length !== 1 && (i = c(h, w[1], i), l = c(h, w[2], l), d = c(h, w[3], d), w.length !== 4 && (g = c(h, w[4], g)));
244
- }
245
- }
246
- return h.flush();
247
- }
248
- e.decode = nt, e.decodeGeneratedRanges = tt, e.decodeOriginalScopes = Z, e.encode = rt, e.encodeGeneratedRanges = et, e.encodeOriginalScopes = V, Object.defineProperty(e, "__esModule", { value: !0 });
249
- });
250
- }(M, M.exports)), M.exports;
251
- }
252
- var ct = ut();
253
- class P {
254
- constructor(t) {
255
- this.bits = t instanceof P ? t.bits.slice() : [];
256
- }
257
- add(t) {
258
- this.bits[t >> 5] |= 1 << (t & 31);
259
- }
260
- has(t) {
261
- return !!(this.bits[t >> 5] & 1 << (t & 31));
262
- }
263
- }
264
- class U {
265
- constructor(t, e, n) {
266
- this.start = t, this.end = e, this.original = n, this.intro = "", this.outro = "", this.content = n, this.storeName = !1, this.edited = !1, this.previous = null, this.next = null;
267
- }
268
- appendLeft(t) {
269
- this.outro += t;
270
- }
271
- appendRight(t) {
272
- this.intro = this.intro + t;
273
- }
274
- clone() {
275
- const t = new U(this.start, this.end, this.original);
276
- return t.intro = this.intro, t.outro = this.outro, t.content = this.content, t.storeName = this.storeName, t.edited = this.edited, t;
277
- }
278
- contains(t) {
279
- return this.start < t && t < this.end;
280
- }
281
- eachNext(t) {
282
- let e = this;
283
- for (; e; )
284
- t(e), e = e.next;
285
- }
286
- eachPrevious(t) {
287
- let e = this;
288
- for (; e; )
289
- t(e), e = e.previous;
290
- }
291
- edit(t, e, n) {
292
- return this.content = t, n || (this.intro = "", this.outro = ""), this.storeName = e, this.edited = !0, this;
293
- }
294
- prependLeft(t) {
295
- this.outro = t + this.outro;
296
- }
297
- prependRight(t) {
298
- this.intro = t + this.intro;
299
- }
300
- reset() {
301
- this.intro = "", this.outro = "", this.edited && (this.content = this.original, this.storeName = !1, this.edited = !1);
302
- }
303
- split(t) {
304
- const e = t - this.start, n = this.original.slice(0, e), s = this.original.slice(e);
305
- this.original = n;
306
- const r = new U(t, this.end, s);
307
- return r.outro = this.outro, this.outro = "", this.end = t, this.edited ? (r.edit("", !1), this.content = "") : this.content = n, r.next = this.next, r.next && (r.next.previous = r), r.previous = this, this.next = r, r;
308
- }
309
- toString() {
310
- return this.intro + this.content + this.outro;
311
- }
312
- trimEnd(t) {
313
- if (this.outro = this.outro.replace(t, ""), this.outro.length) return !0;
314
- const e = this.content.replace(t, "");
315
- if (e.length)
316
- return e !== this.content && (this.split(this.start + e.length).edit("", void 0, !0), this.edited && this.edit(e, this.storeName, !0)), !0;
317
- if (this.edit("", void 0, !0), this.intro = this.intro.replace(t, ""), this.intro.length) return !0;
318
- }
319
- trimStart(t) {
320
- if (this.intro = this.intro.replace(t, ""), this.intro.length) return !0;
321
- const e = this.content.replace(t, "");
322
- if (e.length) {
323
- if (e !== this.content) {
324
- const n = this.split(this.end - e.length);
325
- this.edited && n.edit(e, this.storeName, !0), this.edit("", void 0, !0);
326
- }
327
- return !0;
328
- } else if (this.edit("", void 0, !0), this.outro = this.outro.replace(t, ""), this.outro.length) return !0;
329
- }
330
- }
331
- function at() {
332
- return typeof globalThis < "u" && typeof globalThis.btoa == "function" ? (E) => globalThis.btoa(unescape(encodeURIComponent(E))) : typeof Buffer == "function" ? (E) => Buffer.from(E, "utf-8").toString("base64") : () => {
333
- throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
334
- };
335
- }
336
- const ft = /* @__PURE__ */ at();
337
- class dt {
338
- constructor(t) {
339
- this.version = 3, this.file = t.file, this.sources = t.sources, this.sourcesContent = t.sourcesContent, this.names = t.names, this.mappings = ct.encode(t.mappings), typeof t.x_google_ignoreList < "u" && (this.x_google_ignoreList = t.x_google_ignoreList), typeof t.debugId < "u" && (this.debugId = t.debugId);
340
- }
341
- toString() {
342
- return JSON.stringify(this);
343
- }
344
- toUrl() {
345
- return "data:application/json;charset=utf-8;base64," + ft(this.toString());
346
- }
347
- }
348
- function gt(E) {
349
- const t = E.split(`
350
- `), e = t.filter((r) => /^\t+/.test(r)), n = t.filter((r) => /^ {2,}/.test(r));
351
- if (e.length === 0 && n.length === 0)
352
- return null;
353
- if (e.length >= n.length)
354
- return " ";
355
- const s = n.reduce((r, u) => {
356
- const f = /^ +/.exec(u)[0].length;
357
- return Math.min(f, r);
358
- }, 1 / 0);
359
- return new Array(s + 1).join(" ");
360
- }
361
- function pt(E, t) {
362
- const e = E.split(/[/\\]/), n = t.split(/[/\\]/);
363
- for (e.pop(); e[0] === n[0]; )
364
- e.shift(), n.shift();
365
- if (e.length) {
366
- let s = e.length;
367
- for (; s--; ) e[s] = "..";
368
- }
369
- return e.concat(n).join("/");
370
- }
371
- const mt = Object.prototype.toString;
372
- function wt(E) {
373
- return mt.call(E) === "[object Object]";
374
- }
375
- function Q(E) {
376
- const t = E.split(`
377
- `), e = [];
378
- for (let n = 0, s = 0; n < t.length; n++)
379
- e.push(s), s += t[n].length + 1;
380
- return function(s) {
381
- let r = 0, u = e.length;
382
- for (; r < u; ) {
383
- const c = r + u >> 1;
384
- s < e[c] ? u = c : r = c + 1;
385
- }
386
- const f = r - 1, o = s - e[f];
387
- return { line: f, column: o };
388
- };
389
- }
390
- const bt = /\w/;
391
- class Ct {
392
- constructor(t) {
393
- this.hires = t, this.generatedCodeLine = 0, this.generatedCodeColumn = 0, this.raw = [], this.rawSegments = this.raw[this.generatedCodeLine] = [], this.pending = null;
394
- }
395
- addEdit(t, e, n, s) {
396
- if (e.length) {
397
- const r = e.length - 1;
398
- let u = e.indexOf(`
399
- `, 0), f = -1;
400
- for (; u >= 0 && r > u; ) {
401
- const c = [this.generatedCodeColumn, t, n.line, n.column];
402
- s >= 0 && c.push(s), this.rawSegments.push(c), this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = [], this.generatedCodeColumn = 0, f = u, u = e.indexOf(`
403
- `, u + 1);
404
- }
405
- const o = [this.generatedCodeColumn, t, n.line, n.column];
406
- s >= 0 && o.push(s), this.rawSegments.push(o), this.advance(e.slice(f + 1));
407
- } else this.pending && (this.rawSegments.push(this.pending), this.advance(e));
408
- this.pending = null;
409
- }
410
- addUneditedChunk(t, e, n, s, r) {
411
- let u = e.start, f = !0, o = !1;
412
- for (; u < e.end; ) {
413
- if (n[u] === `
414
- `)
415
- s.line += 1, s.column = 0, this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = [], this.generatedCodeColumn = 0, f = !0, o = !1;
416
- else {
417
- if (this.hires || f || r.has(u)) {
418
- const c = [this.generatedCodeColumn, t, s.line, s.column];
419
- this.hires === "boundary" ? bt.test(n[u]) ? o || (this.rawSegments.push(c), o = !0) : (this.rawSegments.push(c), o = !1) : this.rawSegments.push(c);
420
- }
421
- s.column += 1, this.generatedCodeColumn += 1, f = !1;
422
- }
423
- u += 1;
424
- }
425
- this.pending = null;
426
- }
427
- advance(t) {
428
- if (!t) return;
429
- const e = t.split(`
430
- `);
431
- if (e.length > 1) {
432
- for (let n = 0; n < e.length - 1; n++)
433
- this.generatedCodeLine++, this.raw[this.generatedCodeLine] = this.rawSegments = [];
434
- this.generatedCodeColumn = 0;
435
- }
436
- this.generatedCodeColumn += e[e.length - 1].length;
437
- }
438
- }
439
- const $ = `
440
- `, N = {
441
- insertLeft: !1,
442
- insertRight: !1,
443
- storeName: !1
444
- };
445
- class X {
446
- constructor(t, e = {}) {
447
- const n = new U(0, t.length, t);
448
- Object.defineProperties(this, {
449
- original: { writable: !0, value: t },
450
- outro: { writable: !0, value: "" },
451
- intro: { writable: !0, value: "" },
452
- firstChunk: { writable: !0, value: n },
453
- lastChunk: { writable: !0, value: n },
454
- lastSearchedChunk: { writable: !0, value: n },
455
- byStart: { writable: !0, value: {} },
456
- byEnd: { writable: !0, value: {} },
457
- filename: { writable: !0, value: e.filename },
458
- indentExclusionRanges: { writable: !0, value: e.indentExclusionRanges },
459
- sourcemapLocations: { writable: !0, value: new P() },
460
- storedNames: { writable: !0, value: {} },
461
- indentStr: { writable: !0, value: void 0 },
462
- ignoreList: { writable: !0, value: e.ignoreList },
463
- offset: { writable: !0, value: e.offset || 0 }
464
- }), this.byStart[0] = n, this.byEnd[t.length] = n;
465
- }
466
- addSourcemapLocation(t) {
467
- this.sourcemapLocations.add(t);
468
- }
469
- append(t) {
470
- if (typeof t != "string") throw new TypeError("outro content must be a string");
471
- return this.outro += t, this;
472
- }
473
- appendLeft(t, e) {
474
- if (t = t + this.offset, typeof e != "string") throw new TypeError("inserted content must be a string");
475
- this._split(t);
476
- const n = this.byEnd[t];
477
- return n ? n.appendLeft(e) : this.intro += e, this;
478
- }
479
- appendRight(t, e) {
480
- if (t = t + this.offset, typeof e != "string") throw new TypeError("inserted content must be a string");
481
- this._split(t);
482
- const n = this.byStart[t];
483
- return n ? n.appendRight(e) : this.outro += e, this;
484
- }
485
- clone() {
486
- const t = new X(this.original, { filename: this.filename, offset: this.offset });
487
- let e = this.firstChunk, n = t.firstChunk = t.lastSearchedChunk = e.clone();
488
- for (; e; ) {
489
- t.byStart[n.start] = n, t.byEnd[n.end] = n;
490
- const s = e.next, r = s && s.clone();
491
- r && (n.next = r, r.previous = n, n = r), e = s;
492
- }
493
- return t.lastChunk = n, this.indentExclusionRanges && (t.indentExclusionRanges = this.indentExclusionRanges.slice()), t.sourcemapLocations = new P(this.sourcemapLocations), t.intro = this.intro, t.outro = this.outro, t;
494
- }
495
- generateDecodedMap(t) {
496
- t = t || {};
497
- const e = 0, n = Object.keys(this.storedNames), s = new Ct(t.hires), r = Q(this.original);
498
- return this.intro && s.advance(this.intro), this.firstChunk.eachNext((u) => {
499
- const f = r(u.start);
500
- u.intro.length && s.advance(u.intro), u.edited ? s.addEdit(
501
- e,
502
- u.content,
503
- f,
504
- u.storeName ? n.indexOf(u.original) : -1
505
- ) : s.addUneditedChunk(e, u, this.original, f, this.sourcemapLocations), u.outro.length && s.advance(u.outro);
506
- }), {
507
- file: t.file ? t.file.split(/[/\\]/).pop() : void 0,
508
- sources: [
509
- t.source ? pt(t.file || "", t.source) : t.file || ""
510
- ],
511
- sourcesContent: t.includeContent ? [this.original] : void 0,
512
- names: n,
513
- mappings: s.raw,
514
- x_google_ignoreList: this.ignoreList ? [e] : void 0
515
- };
516
- }
517
- generateMap(t) {
518
- return new dt(this.generateDecodedMap(t));
519
- }
520
- _ensureindentStr() {
521
- this.indentStr === void 0 && (this.indentStr = gt(this.original));
522
- }
523
- _getRawIndentString() {
524
- return this._ensureindentStr(), this.indentStr;
525
- }
526
- getIndentString() {
527
- return this._ensureindentStr(), this.indentStr === null ? " " : this.indentStr;
528
- }
529
- indent(t, e) {
530
- const n = /^[^\r\n]/gm;
531
- if (wt(t) && (e = t, t = void 0), t === void 0 && (this._ensureindentStr(), t = this.indentStr || " "), t === "") return this;
532
- e = e || {};
533
- const s = {};
534
- e.exclude && (typeof e.exclude[0] == "number" ? [e.exclude] : e.exclude).forEach((k) => {
535
- for (let O = k[0]; O < k[1]; O += 1)
536
- s[O] = !0;
537
- });
538
- let r = e.indentStart !== !1;
539
- const u = (c) => r ? `${t}${c}` : (r = !0, c);
540
- this.intro = this.intro.replace(n, u);
541
- let f = 0, o = this.firstChunk;
542
- for (; o; ) {
543
- const c = o.end;
544
- if (o.edited)
545
- s[f] || (o.content = o.content.replace(n, u), o.content.length && (r = o.content[o.content.length - 1] === `
546
- `));
547
- else
548
- for (f = o.start; f < c; ) {
549
- if (!s[f]) {
550
- const k = this.original[f];
551
- k === `
552
- ` ? r = !0 : k !== "\r" && r && (r = !1, f === o.start || (this._splitChunk(o, f), o = o.next), o.prependRight(t));
553
- }
554
- f += 1;
555
- }
556
- f = o.end, o = o.next;
557
- }
558
- return this.outro = this.outro.replace(n, u), this;
559
- }
560
- insert() {
561
- throw new Error(
562
- "magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)"
563
- );
564
- }
565
- insertLeft(t, e) {
566
- return N.insertLeft || (console.warn(
567
- "magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"
568
- ), N.insertLeft = !0), this.appendLeft(t, e);
569
- }
570
- insertRight(t, e) {
571
- return N.insertRight || (console.warn(
572
- "magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"
573
- ), N.insertRight = !0), this.prependRight(t, e);
574
- }
575
- move(t, e, n) {
576
- if (t = t + this.offset, e = e + this.offset, n = n + this.offset, n >= t && n <= e) throw new Error("Cannot move a selection inside itself");
577
- this._split(t), this._split(e), this._split(n);
578
- const s = this.byStart[t], r = this.byEnd[e], u = s.previous, f = r.next, o = this.byStart[n];
579
- if (!o && r === this.lastChunk) return this;
580
- const c = o ? o.previous : this.lastChunk;
581
- return u && (u.next = f), f && (f.previous = u), c && (c.next = s), o && (o.previous = r), s.previous || (this.firstChunk = r.next), r.next || (this.lastChunk = s.previous, this.lastChunk.next = null), s.previous = c, r.next = o || null, c || (this.firstChunk = s), o || (this.lastChunk = r), this;
582
- }
583
- overwrite(t, e, n, s) {
584
- return s = s || {}, this.update(t, e, n, { ...s, overwrite: !s.contentOnly });
585
- }
586
- update(t, e, n, s) {
587
- if (t = t + this.offset, e = e + this.offset, typeof n != "string") throw new TypeError("replacement content must be a string");
588
- if (this.original.length !== 0) {
589
- for (; t < 0; ) t += this.original.length;
590
- for (; e < 0; ) e += this.original.length;
591
- }
592
- if (e > this.original.length) throw new Error("end is out of bounds");
593
- if (t === e)
594
- throw new Error(
595
- "Cannot overwrite a zero-length range – use appendLeft or prependRight instead"
596
- );
597
- this._split(t), this._split(e), s === !0 && (N.storeName || (console.warn(
598
- "The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"
599
- ), N.storeName = !0), s = { storeName: !0 });
600
- const r = s !== void 0 ? s.storeName : !1, u = s !== void 0 ? s.overwrite : !1;
601
- if (r) {
602
- const c = this.original.slice(t, e);
603
- Object.defineProperty(this.storedNames, c, {
604
- writable: !0,
605
- value: !0,
606
- enumerable: !0
607
- });
608
- }
609
- const f = this.byStart[t], o = this.byEnd[e];
610
- if (f) {
611
- let c = f;
612
- for (; c !== o; ) {
613
- if (c.next !== this.byStart[c.end])
614
- throw new Error("Cannot overwrite across a split point");
615
- c = c.next, c.edit("", !1);
616
- }
617
- f.edit(n, r, !u);
618
- } else {
619
- const c = new U(t, e, "").edit(n, r);
620
- o.next = c, c.previous = o;
621
- }
622
- return this;
623
- }
624
- prepend(t) {
625
- if (typeof t != "string") throw new TypeError("outro content must be a string");
626
- return this.intro = t + this.intro, this;
627
- }
628
- prependLeft(t, e) {
629
- if (t = t + this.offset, typeof e != "string") throw new TypeError("inserted content must be a string");
630
- this._split(t);
631
- const n = this.byEnd[t];
632
- return n ? n.prependLeft(e) : this.intro = e + this.intro, this;
633
- }
634
- prependRight(t, e) {
635
- if (t = t + this.offset, typeof e != "string") throw new TypeError("inserted content must be a string");
636
- this._split(t);
637
- const n = this.byStart[t];
638
- return n ? n.prependRight(e) : this.outro = e + this.outro, this;
639
- }
640
- remove(t, e) {
641
- if (t = t + this.offset, e = e + this.offset, this.original.length !== 0) {
642
- for (; t < 0; ) t += this.original.length;
643
- for (; e < 0; ) e += this.original.length;
644
- }
645
- if (t === e) return this;
646
- if (t < 0 || e > this.original.length) throw new Error("Character is out of bounds");
647
- if (t > e) throw new Error("end must be greater than start");
648
- this._split(t), this._split(e);
649
- let n = this.byStart[t];
650
- for (; n; )
651
- n.intro = "", n.outro = "", n.edit(""), n = e > n.end ? this.byStart[n.end] : null;
652
- return this;
653
- }
654
- reset(t, e) {
655
- if (t = t + this.offset, e = e + this.offset, this.original.length !== 0) {
656
- for (; t < 0; ) t += this.original.length;
657
- for (; e < 0; ) e += this.original.length;
658
- }
659
- if (t === e) return this;
660
- if (t < 0 || e > this.original.length) throw new Error("Character is out of bounds");
661
- if (t > e) throw new Error("end must be greater than start");
662
- this._split(t), this._split(e);
663
- let n = this.byStart[t];
664
- for (; n; )
665
- n.reset(), n = e > n.end ? this.byStart[n.end] : null;
666
- return this;
667
- }
668
- lastChar() {
669
- if (this.outro.length) return this.outro[this.outro.length - 1];
670
- let t = this.lastChunk;
671
- do {
672
- if (t.outro.length) return t.outro[t.outro.length - 1];
673
- if (t.content.length) return t.content[t.content.length - 1];
674
- if (t.intro.length) return t.intro[t.intro.length - 1];
675
- } while (t = t.previous);
676
- return this.intro.length ? this.intro[this.intro.length - 1] : "";
677
- }
678
- lastLine() {
679
- let t = this.outro.lastIndexOf($);
680
- if (t !== -1) return this.outro.substr(t + 1);
681
- let e = this.outro, n = this.lastChunk;
682
- do {
683
- if (n.outro.length > 0) {
684
- if (t = n.outro.lastIndexOf($), t !== -1) return n.outro.substr(t + 1) + e;
685
- e = n.outro + e;
686
- }
687
- if (n.content.length > 0) {
688
- if (t = n.content.lastIndexOf($), t !== -1) return n.content.substr(t + 1) + e;
689
- e = n.content + e;
690
- }
691
- if (n.intro.length > 0) {
692
- if (t = n.intro.lastIndexOf($), t !== -1) return n.intro.substr(t + 1) + e;
693
- e = n.intro + e;
694
- }
695
- } while (n = n.previous);
696
- return t = this.intro.lastIndexOf($), t !== -1 ? this.intro.substr(t + 1) + e : this.intro + e;
697
- }
698
- slice(t = 0, e = this.original.length - this.offset) {
699
- if (t = t + this.offset, e = e + this.offset, this.original.length !== 0) {
700
- for (; t < 0; ) t += this.original.length;
701
- for (; e < 0; ) e += this.original.length;
702
- }
703
- let n = "", s = this.firstChunk;
704
- for (; s && (s.start > t || s.end <= t); ) {
705
- if (s.start < e && s.end >= e)
706
- return n;
707
- s = s.next;
708
- }
709
- if (s && s.edited && s.start !== t)
710
- throw new Error(`Cannot use replaced character ${t} as slice start anchor.`);
711
- const r = s;
712
- for (; s; ) {
713
- s.intro && (r !== s || s.start === t) && (n += s.intro);
714
- const u = s.start < e && s.end >= e;
715
- if (u && s.edited && s.end !== e)
716
- throw new Error(`Cannot use replaced character ${e} as slice end anchor.`);
717
- const f = r === s ? t - s.start : 0, o = u ? s.content.length + e - s.end : s.content.length;
718
- if (n += s.content.slice(f, o), s.outro && (!u || s.end === e) && (n += s.outro), u)
719
- break;
720
- s = s.next;
721
- }
722
- return n;
723
- }
724
- // TODO deprecate this? not really very useful
725
- snip(t, e) {
726
- const n = this.clone();
727
- return n.remove(0, t), n.remove(e, n.original.length), n;
728
- }
729
- _split(t) {
730
- if (this.byStart[t] || this.byEnd[t]) return;
731
- let e = this.lastSearchedChunk;
732
- const n = t > e.end;
733
- for (; e; ) {
734
- if (e.contains(t)) return this._splitChunk(e, t);
735
- e = n ? this.byStart[e.end] : this.byEnd[e.start];
736
- }
737
- }
738
- _splitChunk(t, e) {
739
- if (t.edited && t.content.length) {
740
- const s = Q(this.original)(e);
741
- throw new Error(
742
- `Cannot split a chunk that has already been edited (${s.line}:${s.column} – "${t.original}")`
743
- );
744
- }
745
- const n = t.split(e);
746
- return this.byEnd[e] = t, this.byStart[e] = n, this.byEnd[n.end] = n, t === this.lastChunk && (this.lastChunk = n), this.lastSearchedChunk = t, !0;
747
- }
748
- toString() {
749
- let t = this.intro, e = this.firstChunk;
750
- for (; e; )
751
- t += e.toString(), e = e.next;
752
- return t + this.outro;
753
- }
754
- isEmpty() {
755
- let t = this.firstChunk;
756
- do
757
- if (t.intro.length && t.intro.trim() || t.content.length && t.content.trim() || t.outro.length && t.outro.trim())
758
- return !1;
759
- while (t = t.next);
760
- return !0;
761
- }
762
- length() {
763
- let t = this.firstChunk, e = 0;
764
- do
765
- e += t.intro.length + t.content.length + t.outro.length;
766
- while (t = t.next);
767
- return e;
768
- }
769
- trimLines() {
770
- return this.trim("[\\r\\n]");
771
- }
772
- trim(t) {
773
- return this.trimStart(t).trimEnd(t);
774
- }
775
- trimEndAborted(t) {
776
- const e = new RegExp((t || "\\s") + "+$");
777
- if (this.outro = this.outro.replace(e, ""), this.outro.length) return !0;
778
- let n = this.lastChunk;
779
- do {
780
- const s = n.end, r = n.trimEnd(e);
781
- if (n.end !== s && (this.lastChunk === n && (this.lastChunk = n.next), this.byEnd[n.end] = n, this.byStart[n.next.start] = n.next, this.byEnd[n.next.end] = n.next), r) return !0;
782
- n = n.previous;
783
- } while (n);
784
- return !1;
785
- }
786
- trimEnd(t) {
787
- return this.trimEndAborted(t), this;
788
- }
789
- trimStartAborted(t) {
790
- const e = new RegExp("^" + (t || "\\s") + "+");
791
- if (this.intro = this.intro.replace(e, ""), this.intro.length) return !0;
792
- let n = this.firstChunk;
793
- do {
794
- const s = n.end, r = n.trimStart(e);
795
- if (n.end !== s && (n === this.lastChunk && (this.lastChunk = n.next), this.byEnd[n.end] = n, this.byStart[n.next.start] = n.next, this.byEnd[n.next.end] = n.next), r) return !0;
796
- n = n.next;
797
- } while (n);
798
- return !1;
799
- }
800
- trimStart(t) {
801
- return this.trimStartAborted(t), this;
802
- }
803
- hasChanged() {
804
- return this.original !== this.toString();
805
- }
806
- _replaceRegexp(t, e) {
807
- function n(r, u) {
808
- return typeof e == "string" ? e.replace(/\$(\$|&|\d+)/g, (f, o) => o === "$" ? "$" : o === "&" ? r[0] : +o < r.length ? r[+o] : `$${o}`) : e(...r, r.index, u, r.groups);
809
- }
810
- function s(r, u) {
811
- let f;
812
- const o = [];
813
- for (; f = r.exec(u); )
814
- o.push(f);
815
- return o;
816
- }
817
- if (t.global)
818
- s(t, this.original).forEach((u) => {
819
- if (u.index != null) {
820
- const f = n(u, this.original);
821
- f !== u[0] && this.overwrite(u.index, u.index + u[0].length, f);
822
- }
823
- });
824
- else {
825
- const r = this.original.match(t);
826
- if (r && r.index != null) {
827
- const u = n(r, this.original);
828
- u !== r[0] && this.overwrite(r.index, r.index + r[0].length, u);
829
- }
830
- }
831
- return this;
832
- }
833
- _replaceString(t, e) {
834
- const { original: n } = this, s = n.indexOf(t);
835
- return s !== -1 && this.overwrite(s, s + t.length, e), this;
836
- }
837
- replace(t, e) {
838
- return typeof t == "string" ? this._replaceString(t, e) : this._replaceRegexp(t, e);
839
- }
840
- _replaceAllString(t, e) {
841
- const { original: n } = this, s = t.length;
842
- for (let r = n.indexOf(t); r !== -1; r = n.indexOf(t, r + s))
843
- n.slice(r, r + s) !== e && this.overwrite(r, r + s, e);
844
- return this;
845
- }
846
- replaceAll(t, e) {
847
- if (typeof t == "string")
848
- return this._replaceAllString(t, e);
849
- if (!t.global)
850
- throw new TypeError(
851
- "MagicString.prototype.replaceAll called with a non-global RegExp argument"
852
- );
853
- return this._replaceRegexp(t, e);
854
- }
855
- }
856
- export {
857
- dt as SourceMap,
858
- X as default
859
- };