@pismo/marola 0.0.1-alpha.9 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/README.md +1 -1
  2. package/dist/{Button-B1umG8kJ.js → Button-2b1peDFT.js} +25 -26
  3. package/dist/{ClickAwayListener-BKznXF1d.js → ClickAwayListener-BSW-Nd-y.js} +3 -2
  4. package/dist/Dialog.module-DFEmFdYT.js +30 -0
  5. package/dist/Group-B3p31ftp.js +26 -0
  6. package/dist/Popup-B6ZSGIEI.js +1248 -0
  7. package/dist/{Portal-BcdMtRGF.js → Portal-DIeBsWdL.js} +2 -2
  8. package/dist/SelectButton-C8JQKaf4.js +61 -0
  9. package/dist/Tabs.module-jkH1Qjn7.js +22 -0
  10. package/dist/Toggle-BCgIItCc.js +142 -0
  11. package/dist/assets/Advice.css +1 -1
  12. package/dist/assets/Button.css +1 -1
  13. package/dist/assets/Checkbox.css +1 -1
  14. package/dist/assets/Dialog.css +1 -1
  15. package/dist/assets/EllipsisTooltip.css +1 -0
  16. package/dist/assets/Group.css +1 -0
  17. package/dist/assets/IconButton.css +1 -1
  18. package/dist/assets/Input.css +1 -1
  19. package/dist/assets/InputSearch.css +1 -1
  20. package/dist/assets/PageHeader.css +1 -1
  21. package/dist/assets/Pagination.css +1 -1
  22. package/dist/assets/SelectButton.css +1 -0
  23. package/dist/assets/Skeleton.css +1 -1
  24. package/dist/assets/Snackbar.css +1 -1
  25. package/dist/assets/SortTooltip.css +1 -1
  26. package/dist/assets/Stepper.css +1 -1
  27. package/dist/assets/Table.css +1 -1
  28. package/dist/assets/TextDisplay.css +1 -0
  29. package/dist/assets/Toggle.css +1 -1
  30. package/dist/assets/Toggle2.css +1 -0
  31. package/dist/assets/Typography.css +1 -1
  32. package/dist/combineHooksSlotProps-DVjg9PRh.js +80 -0
  33. package/dist/components/Advice/Advice.d.ts +17 -3
  34. package/dist/components/Advice/Advice.js +39 -17
  35. package/dist/components/Advice/Advice.stories.d.ts +18 -0
  36. package/dist/components/Button/Button.d.ts +6 -3
  37. package/dist/components/Button/Button.js +60 -65
  38. package/dist/components/Button/Button.stories.d.ts +3 -1
  39. package/dist/components/Checkbox/Checkbox.d.ts +19 -2
  40. package/dist/components/Checkbox/Checkbox.js +63 -40
  41. package/dist/components/Checkbox/Checkbox.stories.d.ts +31 -0
  42. package/dist/components/Chip/Chip.d.ts +39 -0
  43. package/dist/components/Chip/Chip.js +19 -0
  44. package/dist/components/Chip/Chip.stories.d.ts +42 -0
  45. package/dist/components/Chip/chip.test.d.ts +1 -0
  46. package/dist/components/Dialog/Actions.js +1 -1
  47. package/dist/components/Dialog/Backdrop.js +1 -1
  48. package/dist/components/Dialog/CloseIconButton.js +2 -2
  49. package/dist/components/Dialog/Dialog.d.ts +1 -1
  50. package/dist/components/Dialog/Dialog.js +13 -13
  51. package/dist/components/Dialog/Dialog.stories.d.ts +10 -10
  52. package/dist/components/Dialog/{Title.d.ts → DialogTitle.d.ts} +3 -3
  53. package/dist/components/Dialog/DialogTitle.js +29 -0
  54. package/dist/components/EllipsisTooltip/EllipsisTooltip.d.ts +7 -0
  55. package/dist/components/EllipsisTooltip/EllipsisTooltip.js +23 -0
  56. package/dist/components/EllipsisTooltip/EllipsisTooltip.stories.d.ts +31 -0
  57. package/dist/components/Icon/Icon.d.ts +8 -15
  58. package/dist/components/Icon/Icon.js +85 -41
  59. package/dist/components/Icon/Icon.stories.d.ts +15 -0
  60. package/dist/components/Icon/types.d.ts +5 -0
  61. package/dist/components/Icon/types.js +1 -0
  62. package/dist/components/IconButton/Icon.stories.d.ts +15 -0
  63. package/dist/components/IconButton/IconButton.d.ts +18 -2
  64. package/dist/components/IconButton/IconButton.js +58 -63
  65. package/dist/components/Input/Input.d.ts +1 -1
  66. package/dist/components/Input/Input.js +241 -230
  67. package/dist/components/InputSearch/InputSearch.d.ts +7 -9
  68. package/dist/components/InputSearch/InputSearch.js +30 -25
  69. package/dist/components/InputSearch/InputSearch.stories.d.ts +21 -4
  70. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +1 -1
  71. package/dist/components/PageHeader/PageHeader.d.ts +36 -6
  72. package/dist/components/PageHeader/PageHeader.js +83 -47
  73. package/dist/components/PageHeader/PageHeader.stories.d.ts +2 -31
  74. package/dist/components/Pagination/Pagination.d.ts +24 -5
  75. package/dist/components/Pagination/Pagination.js +127 -109
  76. package/dist/components/Pagination/Pagination.stories.d.ts +17 -0
  77. package/dist/components/Select/Select.d.ts +26 -0
  78. package/dist/components/Select/Select.js +857 -0
  79. package/dist/components/Select/Select.stories.d.ts +22 -0
  80. package/dist/components/Select/SelectButton.d.ts +12 -0
  81. package/dist/components/Select/SelectButton.js +8 -0
  82. package/dist/components/Skeleton/Skeleton.d.ts +10 -3
  83. package/dist/components/Skeleton/Skeleton.js +16 -19
  84. package/dist/components/Skeleton/Skeleton.stories.d.ts +14 -0
  85. package/dist/components/Skeleton/SkeletonCircle.stories.d.ts +14 -0
  86. package/dist/components/Skeleton/SkeletonTable.stories.d.ts +16 -0
  87. package/dist/components/Snackbar/Snackbar.d.ts +19 -5
  88. package/dist/components/Snackbar/Snackbar.js +247 -230
  89. package/dist/components/Snackbar/Snackbar.stories.d.ts +319 -0
  90. package/dist/components/SortTooltip/SortTooltip.d.ts +3 -1
  91. package/dist/components/SortTooltip/SortTooltip.js +55 -29
  92. package/dist/components/Stepper/Stepper.d.ts +11 -1
  93. package/dist/components/Stepper/Stepper.js +37 -22
  94. package/dist/components/Stepper/Stepper.stories.d.ts +16 -0
  95. package/dist/components/Table/Table.d.ts +33 -16
  96. package/dist/components/Table/Table.js +106 -91
  97. package/dist/components/Table/Table.stories.d.ts +29 -0
  98. package/dist/components/Table/_Table.TBody.stories.d.ts +14 -0
  99. package/dist/components/Table/_Table.THead.stories.d.ts +14 -0
  100. package/dist/components/Table/_Table.Td.stories.d.ts +16 -0
  101. package/dist/components/Table/_Table.Th.stories.d.ts +15 -0
  102. package/dist/components/Table/_Table.Tr.stories.d.ts +15 -0
  103. package/dist/components/Tabs/Tab.d.ts +5 -0
  104. package/dist/components/Tabs/Tab.js +179 -6
  105. package/dist/components/Tabs/Tab.stories.d.ts +15 -0
  106. package/dist/components/Tabs/TabPanel.d.ts +4 -0
  107. package/dist/components/Tabs/TabPanel.js +12 -12
  108. package/dist/components/Tabs/TabPanel.stories.d.ts +14 -0
  109. package/dist/components/Tabs/Tabs.d.ts +5 -1
  110. package/dist/components/Tabs/Tabs.js +242 -668
  111. package/dist/components/Tabs/Tabs.stories.d.ts +14 -0
  112. package/dist/components/TextDisplay/TextDisplay.d.ts +23 -0
  113. package/dist/components/TextDisplay/TextDisplay.js +37 -0
  114. package/dist/components/TextDisplay/TextDisplay.stories.d.ts +13 -0
  115. package/dist/components/TextDisplay/textDisplay.test.d.ts +1 -0
  116. package/dist/components/Toggle/Toggle.js +143 -129
  117. package/dist/components/ToggleGroup/Group.d.ts +18 -0
  118. package/dist/components/ToggleGroup/Group.js +7 -0
  119. package/dist/components/ToggleGroup/Group.test.d.ts +1 -0
  120. package/dist/components/ToggleGroup/Toggle.d.ts +15 -0
  121. package/dist/components/ToggleGroup/Toggle.js +17 -0
  122. package/dist/components/ToggleGroup/Toggle.test.d.ts +1 -0
  123. package/dist/components/ToggleGroup/ToggleGroup.d.ts +2 -0
  124. package/dist/components/ToggleGroup/ToggleGroup.js +6 -0
  125. package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +25 -0
  126. package/dist/components/Tooltip/Tooltip.d.ts +22 -6
  127. package/dist/components/Tooltip/Tooltip.js +114 -1339
  128. package/dist/components/Tooltip/Tooltip.stories.d.ts +35 -0
  129. package/dist/components/Typography/Typography.d.ts +4 -2
  130. package/dist/components/Typography/Typography.js +56 -73
  131. package/dist/components/Typography/Typography.stories.d.ts +1 -0
  132. package/dist/contexts/SnackbarProvider/SnackbarProvider.d.ts +11 -0
  133. package/dist/contexts/SnackbarProvider/SnackbarProvider.js +50 -0
  134. package/dist/contexts/SnackbarProvider/SnackbarProvider.stories.d.ts +21 -0
  135. package/dist/{index-CqjC7P5Y.js → index-CH45lKw7.js} +333 -307
  136. package/dist/{index-BNWbc5Kh.js → index-CjW42-M-.js} +3108 -3152
  137. package/dist/main.d.ts +10 -1
  138. package/dist/main.js +73 -55
  139. package/dist/marola.css +1 -0
  140. package/dist/{useButton-Bc8IAgyk.js → useButton-DNk3wrQp.js} +3 -4
  141. package/dist/useCompoundItem-D1iRfg8D.js +84 -0
  142. package/dist/useEventCallback-xTG9piMa.js +45 -0
  143. package/dist/useList-B0hog_3-.js +436 -0
  144. package/dist/utils/styleStrings.d.ts +1 -1
  145. package/dist/utils/styleStrings.js +7 -7
  146. package/package.json +4 -4
  147. package/dist/Dialog.module-CGVM5V_D.js +0 -15
  148. package/dist/Tab-CRwnhsj5.js +0 -254
  149. package/dist/Tabs.module-yYcTJnj6.js +0 -103
  150. package/dist/_commonjsHelpers-CT_km90n.js +0 -30
  151. package/dist/assets/global.css +0 -1
  152. package/dist/components/Button/Button.stories.js +0 -40
  153. package/dist/components/Dialog/Dialog.stories.js +0 -59
  154. package/dist/components/Dialog/Title.js +0 -29
  155. package/dist/components/Input/Input.stories.js +0 -106
  156. package/dist/components/InputSearch/InputSearch.stories.js +0 -36
  157. package/dist/components/LoadingSpinner/LoadingSpinner.stories.js +0 -38
  158. package/dist/components/PageHeader/PageHeader.stories.js +0 -49
  159. package/dist/components/Toggle/Toggle.stories.js +0 -33
  160. package/dist/components/Typography/Typography.stories.js +0 -30
  161. package/dist/components/Typography/typography.test.js +0 -11357
  162. package/dist/magic-string.es-O_8lTkE3.js +0 -738
  163. package/dist/objectWithoutPropertiesLoose-D7Cp0Pg_.js +0 -26
  164. package/dist/utils/styleStrings.test.js +0 -41
  165. package/dist/vi.Y_w82WR8-Df0JUamG.js +0 -9860
@@ -1,738 +0,0 @@
1
- import { c as U } from "./_commonjsHelpers-CT_km90n.js";
2
- var O = { exports: {} };
3
- (function(p, t) {
4
- (function(e, n) {
5
- n(t);
6
- })(U, function(e) {
7
- const r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", s = new Uint8Array(64), h = new Uint8Array(128);
8
- for (let u = 0; u < r.length; u++) {
9
- const l = r.charCodeAt(u);
10
- s[u] = l, h[l] = u;
11
- }
12
- const o = typeof TextDecoder < "u" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer < "u" ? {
13
- decode(u) {
14
- return Buffer.from(u.buffer, u.byteOffset, u.byteLength).toString();
15
- }
16
- } : {
17
- decode(u) {
18
- let l = "";
19
- for (let g = 0; g < u.length; g++)
20
- l += String.fromCharCode(u[g]);
21
- return l;
22
- }
23
- };
24
- function a(u) {
25
- const l = new Int32Array(5), g = [];
26
- let w = 0;
27
- do {
28
- const d = S(u, w), m = [];
29
- let c = !0, b = 0;
30
- l[0] = 0;
31
- for (let f = w; f < d; f++) {
32
- let x;
33
- f = y(u, f, l, 0);
34
- const C = l[0];
35
- C < b && (c = !1), b = C, N(u, f, d) ? (f = y(u, f, l, 1), f = y(u, f, l, 2), f = y(u, f, l, 3), N(u, f, d) ? (f = y(u, f, l, 4), x = [C, l[1], l[2], l[3], l[4]]) : x = [C, l[1], l[2], l[3]]) : x = [C], m.push(x);
36
- }
37
- c || T(m), g.push(m), w = d + 1;
38
- } while (w <= u.length);
39
- return g;
40
- }
41
- function S(u, l) {
42
- const g = u.indexOf(";", l);
43
- return g === -1 ? u.length : g;
44
- }
45
- function y(u, l, g, w) {
46
- let d = 0, m = 0, c = 0;
47
- do {
48
- const f = u.charCodeAt(l++);
49
- c = h[f], d |= (c & 31) << m, m += 5;
50
- } while (c & 32);
51
- const b = d & 1;
52
- return d >>>= 1, b && (d = -2147483648 | -d), g[w] += d, l;
53
- }
54
- function N(u, l, g) {
55
- return l >= g ? !1 : u.charCodeAt(l) !== 44;
56
- }
57
- function T(u) {
58
- u.sort(j);
59
- }
60
- function j(u, l) {
61
- return u[0] - l[0];
62
- }
63
- function $(u) {
64
- const l = new Int32Array(5), g = 1024 * 16, w = g - 36, d = new Uint8Array(g), m = d.subarray(0, w);
65
- let c = 0, b = "";
66
- for (let f = 0; f < u.length; f++) {
67
- const x = u[f];
68
- if (f > 0 && (c === g && (b += o.decode(d), c = 0), d[c++] = 59), x.length !== 0) {
69
- l[0] = 0;
70
- for (let C = 0; C < x.length; C++) {
71
- const v = x[C];
72
- c > w && (b += o.decode(m), d.copyWithin(0, w, c), c -= w), C > 0 && (d[c++] = 44), c = k(d, c, l, v, 0), v.length !== 1 && (c = k(d, c, l, v, 1), c = k(d, c, l, v, 2), c = k(d, c, l, v, 3), v.length !== 4 && (c = k(d, c, l, v, 4)));
73
- }
74
- }
75
- }
76
- return b + o.decode(d.subarray(0, c));
77
- }
78
- function k(u, l, g, w, d) {
79
- const m = w[d];
80
- let c = m - g[d];
81
- g[d] = m, c = c < 0 ? -c << 1 | 1 : c << 1;
82
- do {
83
- let b = c & 31;
84
- c >>>= 5, c > 0 && (b |= 32), u[l++] = s[b];
85
- } while (c > 0);
86
- return l;
87
- }
88
- e.decode = a, e.encode = $, Object.defineProperty(e, "__esModule", { value: !0 });
89
- });
90
- })(O, O.exports);
91
- var M = O.exports;
92
- class R {
93
- constructor(t) {
94
- this.bits = t instanceof R ? t.bits.slice() : [];
95
- }
96
- add(t) {
97
- this.bits[t >> 5] |= 1 << (t & 31);
98
- }
99
- has(t) {
100
- return !!(this.bits[t >> 5] & 1 << (t & 31));
101
- }
102
- }
103
- class _ {
104
- constructor(t, e, n) {
105
- 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;
106
- }
107
- appendLeft(t) {
108
- this.outro += t;
109
- }
110
- appendRight(t) {
111
- this.intro = this.intro + t;
112
- }
113
- clone() {
114
- const t = new _(this.start, this.end, this.original);
115
- return t.intro = this.intro, t.outro = this.outro, t.content = this.content, t.storeName = this.storeName, t.edited = this.edited, t;
116
- }
117
- contains(t) {
118
- return this.start < t && t < this.end;
119
- }
120
- eachNext(t) {
121
- let e = this;
122
- for (; e; )
123
- t(e), e = e.next;
124
- }
125
- eachPrevious(t) {
126
- let e = this;
127
- for (; e; )
128
- t(e), e = e.previous;
129
- }
130
- edit(t, e, n) {
131
- return this.content = t, n || (this.intro = "", this.outro = ""), this.storeName = e, this.edited = !0, this;
132
- }
133
- prependLeft(t) {
134
- this.outro = t + this.outro;
135
- }
136
- prependRight(t) {
137
- this.intro = t + this.intro;
138
- }
139
- reset() {
140
- this.intro = "", this.outro = "", this.edited && (this.content = this.original, this.storeName = !1, this.edited = !1);
141
- }
142
- split(t) {
143
- const e = t - this.start, n = this.original.slice(0, e), i = this.original.slice(e);
144
- this.original = n;
145
- const r = new _(t, this.end, i);
146
- 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;
147
- }
148
- toString() {
149
- return this.intro + this.content + this.outro;
150
- }
151
- trimEnd(t) {
152
- if (this.outro = this.outro.replace(t, ""), this.outro.length)
153
- return !0;
154
- const e = this.content.replace(t, "");
155
- if (e.length)
156
- return e !== this.content && (this.split(this.start + e.length).edit("", void 0, !0), this.edited && this.edit(e, this.storeName, !0)), !0;
157
- if (this.edit("", void 0, !0), this.intro = this.intro.replace(t, ""), this.intro.length)
158
- return !0;
159
- }
160
- trimStart(t) {
161
- if (this.intro = this.intro.replace(t, ""), this.intro.length)
162
- return !0;
163
- const e = this.content.replace(t, "");
164
- if (e.length) {
165
- if (e !== this.content) {
166
- const n = this.split(this.end - e.length);
167
- this.edited && n.edit(e, this.storeName, !0), this.edit("", void 0, !0);
168
- }
169
- return !0;
170
- } else if (this.edit("", void 0, !0), this.outro = this.outro.replace(t, ""), this.outro.length)
171
- return !0;
172
- }
173
- }
174
- function B() {
175
- return typeof globalThis < "u" && typeof globalThis.btoa == "function" ? (p) => globalThis.btoa(unescape(encodeURIComponent(p))) : typeof Buffer == "function" ? (p) => Buffer.from(p, "utf-8").toString("base64") : () => {
176
- throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
177
- };
178
- }
179
- const P = /* @__PURE__ */ B();
180
- class D {
181
- constructor(t) {
182
- this.version = 3, this.file = t.file, this.sources = t.sources, this.sourcesContent = t.sourcesContent, this.names = t.names, this.mappings = M.encode(t.mappings), typeof t.x_google_ignoreList < "u" && (this.x_google_ignoreList = t.x_google_ignoreList);
183
- }
184
- toString() {
185
- return JSON.stringify(this);
186
- }
187
- toUrl() {
188
- return "data:application/json;charset=utf-8;base64," + P(this.toString());
189
- }
190
- }
191
- function q(p) {
192
- const t = p.split(`
193
- `), e = t.filter((r) => /^\t+/.test(r)), n = t.filter((r) => /^ {2,}/.test(r));
194
- if (e.length === 0 && n.length === 0)
195
- return null;
196
- if (e.length >= n.length)
197
- return " ";
198
- const i = n.reduce((r, s) => {
199
- const h = /^ +/.exec(s)[0].length;
200
- return Math.min(h, r);
201
- }, 1 / 0);
202
- return new Array(i + 1).join(" ");
203
- }
204
- function z(p, t) {
205
- const e = p.split(/[/\\]/), n = t.split(/[/\\]/);
206
- for (e.pop(); e[0] === n[0]; )
207
- e.shift(), n.shift();
208
- if (e.length) {
209
- let i = e.length;
210
- for (; i--; )
211
- e[i] = "..";
212
- }
213
- return e.concat(n).join("/");
214
- }
215
- const F = Object.prototype.toString;
216
- function G(p) {
217
- return F.call(p) === "[object Object]";
218
- }
219
- function A(p) {
220
- const t = p.split(`
221
- `), e = [];
222
- for (let n = 0, i = 0; n < t.length; n++)
223
- e.push(i), i += t[n].length + 1;
224
- return function(i) {
225
- let r = 0, s = e.length;
226
- for (; r < s; ) {
227
- const a = r + s >> 1;
228
- i < e[a] ? s = a : r = a + 1;
229
- }
230
- const h = r - 1, o = i - e[h];
231
- return { line: h, column: o };
232
- };
233
- }
234
- const H = /\w/;
235
- class J {
236
- constructor(t) {
237
- this.hires = t, this.generatedCodeLine = 0, this.generatedCodeColumn = 0, this.raw = [], this.rawSegments = this.raw[this.generatedCodeLine] = [], this.pending = null;
238
- }
239
- addEdit(t, e, n, i) {
240
- if (e.length) {
241
- const r = e.length - 1;
242
- let s = e.indexOf(`
243
- `, 0), h = -1;
244
- for (; s >= 0 && r > s; ) {
245
- const a = [this.generatedCodeColumn, t, n.line, n.column];
246
- i >= 0 && a.push(i), this.rawSegments.push(a), this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = [], this.generatedCodeColumn = 0, h = s, s = e.indexOf(`
247
- `, s + 1);
248
- }
249
- const o = [this.generatedCodeColumn, t, n.line, n.column];
250
- i >= 0 && o.push(i), this.rawSegments.push(o), this.advance(e.slice(h + 1));
251
- } else
252
- this.pending && (this.rawSegments.push(this.pending), this.advance(e));
253
- this.pending = null;
254
- }
255
- addUneditedChunk(t, e, n, i, r) {
256
- let s = e.start, h = !0, o = !1;
257
- for (; s < e.end; ) {
258
- if (this.hires || h || r.has(s)) {
259
- const a = [this.generatedCodeColumn, t, i.line, i.column];
260
- this.hires === "boundary" ? H.test(n[s]) ? o || (this.rawSegments.push(a), o = !0) : (this.rawSegments.push(a), o = !1) : this.rawSegments.push(a);
261
- }
262
- n[s] === `
263
- ` ? (i.line += 1, i.column = 0, this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = [], this.generatedCodeColumn = 0, h = !0) : (i.column += 1, this.generatedCodeColumn += 1, h = !1), s += 1;
264
- }
265
- this.pending = null;
266
- }
267
- advance(t) {
268
- if (!t)
269
- return;
270
- const e = t.split(`
271
- `);
272
- if (e.length > 1) {
273
- for (let n = 0; n < e.length - 1; n++)
274
- this.generatedCodeLine++, this.raw[this.generatedCodeLine] = this.rawSegments = [];
275
- this.generatedCodeColumn = 0;
276
- }
277
- this.generatedCodeColumn += e[e.length - 1].length;
278
- }
279
- }
280
- const L = `
281
- `, E = {
282
- insertLeft: !1,
283
- insertRight: !1,
284
- storeName: !1
285
- };
286
- class I {
287
- constructor(t, e = {}) {
288
- const n = new _(0, t.length, t);
289
- Object.defineProperties(this, {
290
- original: { writable: !0, value: t },
291
- outro: { writable: !0, value: "" },
292
- intro: { writable: !0, value: "" },
293
- firstChunk: { writable: !0, value: n },
294
- lastChunk: { writable: !0, value: n },
295
- lastSearchedChunk: { writable: !0, value: n },
296
- byStart: { writable: !0, value: {} },
297
- byEnd: { writable: !0, value: {} },
298
- filename: { writable: !0, value: e.filename },
299
- indentExclusionRanges: { writable: !0, value: e.indentExclusionRanges },
300
- sourcemapLocations: { writable: !0, value: new R() },
301
- storedNames: { writable: !0, value: {} },
302
- indentStr: { writable: !0, value: void 0 },
303
- ignoreList: { writable: !0, value: e.ignoreList }
304
- }), this.byStart[0] = n, this.byEnd[t.length] = n;
305
- }
306
- addSourcemapLocation(t) {
307
- this.sourcemapLocations.add(t);
308
- }
309
- append(t) {
310
- if (typeof t != "string")
311
- throw new TypeError("outro content must be a string");
312
- return this.outro += t, this;
313
- }
314
- appendLeft(t, e) {
315
- if (typeof e != "string")
316
- throw new TypeError("inserted content must be a string");
317
- this._split(t);
318
- const n = this.byEnd[t];
319
- return n ? n.appendLeft(e) : this.intro += e, this;
320
- }
321
- appendRight(t, e) {
322
- if (typeof e != "string")
323
- throw new TypeError("inserted content must be a string");
324
- this._split(t);
325
- const n = this.byStart[t];
326
- return n ? n.appendRight(e) : this.outro += e, this;
327
- }
328
- clone() {
329
- const t = new I(this.original, { filename: this.filename });
330
- let e = this.firstChunk, n = t.firstChunk = t.lastSearchedChunk = e.clone();
331
- for (; e; ) {
332
- t.byStart[n.start] = n, t.byEnd[n.end] = n;
333
- const i = e.next, r = i && i.clone();
334
- r && (n.next = r, r.previous = n, n = r), e = i;
335
- }
336
- return t.lastChunk = n, this.indentExclusionRanges && (t.indentExclusionRanges = this.indentExclusionRanges.slice()), t.sourcemapLocations = new R(this.sourcemapLocations), t.intro = this.intro, t.outro = this.outro, t;
337
- }
338
- generateDecodedMap(t) {
339
- t = t || {};
340
- const e = 0, n = Object.keys(this.storedNames), i = new J(t.hires), r = A(this.original);
341
- return this.intro && i.advance(this.intro), this.firstChunk.eachNext((s) => {
342
- const h = r(s.start);
343
- s.intro.length && i.advance(s.intro), s.edited ? i.addEdit(
344
- e,
345
- s.content,
346
- h,
347
- s.storeName ? n.indexOf(s.original) : -1
348
- ) : i.addUneditedChunk(e, s, this.original, h, this.sourcemapLocations), s.outro.length && i.advance(s.outro);
349
- }), {
350
- file: t.file ? t.file.split(/[/\\]/).pop() : void 0,
351
- sources: [
352
- t.source ? z(t.file || "", t.source) : t.file || ""
353
- ],
354
- sourcesContent: t.includeContent ? [this.original] : void 0,
355
- names: n,
356
- mappings: i.raw,
357
- x_google_ignoreList: this.ignoreList ? [e] : void 0
358
- };
359
- }
360
- generateMap(t) {
361
- return new D(this.generateDecodedMap(t));
362
- }
363
- _ensureindentStr() {
364
- this.indentStr === void 0 && (this.indentStr = q(this.original));
365
- }
366
- _getRawIndentString() {
367
- return this._ensureindentStr(), this.indentStr;
368
- }
369
- getIndentString() {
370
- return this._ensureindentStr(), this.indentStr === null ? " " : this.indentStr;
371
- }
372
- indent(t, e) {
373
- const n = /^[^\r\n]/gm;
374
- if (G(t) && (e = t, t = void 0), t === void 0 && (this._ensureindentStr(), t = this.indentStr || " "), t === "")
375
- return this;
376
- e = e || {};
377
- const i = {};
378
- e.exclude && (typeof e.exclude[0] == "number" ? [e.exclude] : e.exclude).forEach((S) => {
379
- for (let y = S[0]; y < S[1]; y += 1)
380
- i[y] = !0;
381
- });
382
- let r = e.indentStart !== !1;
383
- const s = (a) => r ? `${t}${a}` : (r = !0, a);
384
- this.intro = this.intro.replace(n, s);
385
- let h = 0, o = this.firstChunk;
386
- for (; o; ) {
387
- const a = o.end;
388
- if (o.edited)
389
- i[h] || (o.content = o.content.replace(n, s), o.content.length && (r = o.content[o.content.length - 1] === `
390
- `));
391
- else
392
- for (h = o.start; h < a; ) {
393
- if (!i[h]) {
394
- const S = this.original[h];
395
- S === `
396
- ` ? r = !0 : S !== "\r" && r && (r = !1, h === o.start || (this._splitChunk(o, h), o = o.next), o.prependRight(t));
397
- }
398
- h += 1;
399
- }
400
- h = o.end, o = o.next;
401
- }
402
- return this.outro = this.outro.replace(n, s), this;
403
- }
404
- insert() {
405
- throw new Error(
406
- "magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)"
407
- );
408
- }
409
- insertLeft(t, e) {
410
- return E.insertLeft || (console.warn(
411
- "magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"
412
- ), E.insertLeft = !0), this.appendLeft(t, e);
413
- }
414
- insertRight(t, e) {
415
- return E.insertRight || (console.warn(
416
- "magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"
417
- ), E.insertRight = !0), this.prependRight(t, e);
418
- }
419
- move(t, e, n) {
420
- if (n >= t && n <= e)
421
- throw new Error("Cannot move a selection inside itself");
422
- this._split(t), this._split(e), this._split(n);
423
- const i = this.byStart[t], r = this.byEnd[e], s = i.previous, h = r.next, o = this.byStart[n];
424
- if (!o && r === this.lastChunk)
425
- return this;
426
- const a = o ? o.previous : this.lastChunk;
427
- return s && (s.next = h), h && (h.previous = s), a && (a.next = i), o && (o.previous = r), i.previous || (this.firstChunk = r.next), r.next || (this.lastChunk = i.previous, this.lastChunk.next = null), i.previous = a, r.next = o || null, a || (this.firstChunk = i), o || (this.lastChunk = r), this;
428
- }
429
- overwrite(t, e, n, i) {
430
- return i = i || {}, this.update(t, e, n, { ...i, overwrite: !i.contentOnly });
431
- }
432
- update(t, e, n, i) {
433
- if (typeof n != "string")
434
- throw new TypeError("replacement content must be a string");
435
- for (; t < 0; )
436
- t += this.original.length;
437
- for (; e < 0; )
438
- e += this.original.length;
439
- if (e > this.original.length)
440
- throw new Error("end is out of bounds");
441
- if (t === e)
442
- throw new Error(
443
- "Cannot overwrite a zero-length range – use appendLeft or prependRight instead"
444
- );
445
- this._split(t), this._split(e), i === !0 && (E.storeName || (console.warn(
446
- "The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"
447
- ), E.storeName = !0), i = { storeName: !0 });
448
- const r = i !== void 0 ? i.storeName : !1, s = i !== void 0 ? i.overwrite : !1;
449
- if (r) {
450
- const a = this.original.slice(t, e);
451
- Object.defineProperty(this.storedNames, a, {
452
- writable: !0,
453
- value: !0,
454
- enumerable: !0
455
- });
456
- }
457
- const h = this.byStart[t], o = this.byEnd[e];
458
- if (h) {
459
- let a = h;
460
- for (; a !== o; ) {
461
- if (a.next !== this.byStart[a.end])
462
- throw new Error("Cannot overwrite across a split point");
463
- a = a.next, a.edit("", !1);
464
- }
465
- h.edit(n, r, !s);
466
- } else {
467
- const a = new _(t, e, "").edit(n, r);
468
- o.next = a, a.previous = o;
469
- }
470
- return this;
471
- }
472
- prepend(t) {
473
- if (typeof t != "string")
474
- throw new TypeError("outro content must be a string");
475
- return this.intro = t + this.intro, this;
476
- }
477
- prependLeft(t, e) {
478
- if (typeof e != "string")
479
- throw new TypeError("inserted content must be a string");
480
- this._split(t);
481
- const n = this.byEnd[t];
482
- return n ? n.prependLeft(e) : this.intro = e + this.intro, this;
483
- }
484
- prependRight(t, e) {
485
- if (typeof e != "string")
486
- throw new TypeError("inserted content must be a string");
487
- this._split(t);
488
- const n = this.byStart[t];
489
- return n ? n.prependRight(e) : this.outro = e + this.outro, this;
490
- }
491
- remove(t, e) {
492
- for (; t < 0; )
493
- t += this.original.length;
494
- for (; e < 0; )
495
- e += this.original.length;
496
- if (t === e)
497
- return this;
498
- if (t < 0 || e > this.original.length)
499
- throw new Error("Character is out of bounds");
500
- if (t > e)
501
- throw new Error("end must be greater than start");
502
- this._split(t), this._split(e);
503
- let n = this.byStart[t];
504
- for (; n; )
505
- n.intro = "", n.outro = "", n.edit(""), n = e > n.end ? this.byStart[n.end] : null;
506
- return this;
507
- }
508
- reset(t, e) {
509
- for (; t < 0; )
510
- t += this.original.length;
511
- for (; e < 0; )
512
- e += this.original.length;
513
- if (t === e)
514
- return this;
515
- if (t < 0 || e > this.original.length)
516
- throw new Error("Character is out of bounds");
517
- if (t > e)
518
- throw new Error("end must be greater than start");
519
- this._split(t), this._split(e);
520
- let n = this.byStart[t];
521
- for (; n; )
522
- n.reset(), n = e > n.end ? this.byStart[n.end] : null;
523
- return this;
524
- }
525
- lastChar() {
526
- if (this.outro.length)
527
- return this.outro[this.outro.length - 1];
528
- let t = this.lastChunk;
529
- do {
530
- if (t.outro.length)
531
- return t.outro[t.outro.length - 1];
532
- if (t.content.length)
533
- return t.content[t.content.length - 1];
534
- if (t.intro.length)
535
- return t.intro[t.intro.length - 1];
536
- } while (t = t.previous);
537
- return this.intro.length ? this.intro[this.intro.length - 1] : "";
538
- }
539
- lastLine() {
540
- let t = this.outro.lastIndexOf(L);
541
- if (t !== -1)
542
- return this.outro.substr(t + 1);
543
- let e = this.outro, n = this.lastChunk;
544
- do {
545
- if (n.outro.length > 0) {
546
- if (t = n.outro.lastIndexOf(L), t !== -1)
547
- return n.outro.substr(t + 1) + e;
548
- e = n.outro + e;
549
- }
550
- if (n.content.length > 0) {
551
- if (t = n.content.lastIndexOf(L), t !== -1)
552
- return n.content.substr(t + 1) + e;
553
- e = n.content + e;
554
- }
555
- if (n.intro.length > 0) {
556
- if (t = n.intro.lastIndexOf(L), t !== -1)
557
- return n.intro.substr(t + 1) + e;
558
- e = n.intro + e;
559
- }
560
- } while (n = n.previous);
561
- return t = this.intro.lastIndexOf(L), t !== -1 ? this.intro.substr(t + 1) + e : this.intro + e;
562
- }
563
- slice(t = 0, e = this.original.length) {
564
- for (; t < 0; )
565
- t += this.original.length;
566
- for (; e < 0; )
567
- e += this.original.length;
568
- let n = "", i = this.firstChunk;
569
- for (; i && (i.start > t || i.end <= t); ) {
570
- if (i.start < e && i.end >= e)
571
- return n;
572
- i = i.next;
573
- }
574
- if (i && i.edited && i.start !== t)
575
- throw new Error(`Cannot use replaced character ${t} as slice start anchor.`);
576
- const r = i;
577
- for (; i; ) {
578
- i.intro && (r !== i || i.start === t) && (n += i.intro);
579
- const s = i.start < e && i.end >= e;
580
- if (s && i.edited && i.end !== e)
581
- throw new Error(`Cannot use replaced character ${e} as slice end anchor.`);
582
- const h = r === i ? t - i.start : 0, o = s ? i.content.length + e - i.end : i.content.length;
583
- if (n += i.content.slice(h, o), i.outro && (!s || i.end === e) && (n += i.outro), s)
584
- break;
585
- i = i.next;
586
- }
587
- return n;
588
- }
589
- // TODO deprecate this? not really very useful
590
- snip(t, e) {
591
- const n = this.clone();
592
- return n.remove(0, t), n.remove(e, n.original.length), n;
593
- }
594
- _split(t) {
595
- if (this.byStart[t] || this.byEnd[t])
596
- return;
597
- let e = this.lastSearchedChunk;
598
- const n = t > e.end;
599
- for (; e; ) {
600
- if (e.contains(t))
601
- return this._splitChunk(e, t);
602
- e = n ? this.byStart[e.end] : this.byEnd[e.start];
603
- }
604
- }
605
- _splitChunk(t, e) {
606
- if (t.edited && t.content.length) {
607
- const i = A(this.original)(e);
608
- throw new Error(
609
- `Cannot split a chunk that has already been edited (${i.line}:${i.column} – "${t.original}")`
610
- );
611
- }
612
- const n = t.split(e);
613
- return this.byEnd[e] = t, this.byStart[e] = n, this.byEnd[n.end] = n, t === this.lastChunk && (this.lastChunk = n), this.lastSearchedChunk = t, !0;
614
- }
615
- toString() {
616
- let t = this.intro, e = this.firstChunk;
617
- for (; e; )
618
- t += e.toString(), e = e.next;
619
- return t + this.outro;
620
- }
621
- isEmpty() {
622
- let t = this.firstChunk;
623
- do
624
- if (t.intro.length && t.intro.trim() || t.content.length && t.content.trim() || t.outro.length && t.outro.trim())
625
- return !1;
626
- while (t = t.next);
627
- return !0;
628
- }
629
- length() {
630
- let t = this.firstChunk, e = 0;
631
- do
632
- e += t.intro.length + t.content.length + t.outro.length;
633
- while (t = t.next);
634
- return e;
635
- }
636
- trimLines() {
637
- return this.trim("[\\r\\n]");
638
- }
639
- trim(t) {
640
- return this.trimStart(t).trimEnd(t);
641
- }
642
- trimEndAborted(t) {
643
- const e = new RegExp((t || "\\s") + "+$");
644
- if (this.outro = this.outro.replace(e, ""), this.outro.length)
645
- return !0;
646
- let n = this.lastChunk;
647
- do {
648
- const i = n.end, r = n.trimEnd(e);
649
- if (n.end !== i && (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)
650
- return !0;
651
- n = n.previous;
652
- } while (n);
653
- return !1;
654
- }
655
- trimEnd(t) {
656
- return this.trimEndAborted(t), this;
657
- }
658
- trimStartAborted(t) {
659
- const e = new RegExp("^" + (t || "\\s") + "+");
660
- if (this.intro = this.intro.replace(e, ""), this.intro.length)
661
- return !0;
662
- let n = this.firstChunk;
663
- do {
664
- const i = n.end, r = n.trimStart(e);
665
- if (n.end !== i && (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)
666
- return !0;
667
- n = n.next;
668
- } while (n);
669
- return !1;
670
- }
671
- trimStart(t) {
672
- return this.trimStartAborted(t), this;
673
- }
674
- hasChanged() {
675
- return this.original !== this.toString();
676
- }
677
- _replaceRegexp(t, e) {
678
- function n(r, s) {
679
- return typeof e == "string" ? e.replace(/\$(\$|&|\d+)/g, (h, o) => o === "$" ? "$" : o === "&" ? r[0] : +o < r.length ? r[+o] : `$${o}`) : e(...r, r.index, s, r.groups);
680
- }
681
- function i(r, s) {
682
- let h;
683
- const o = [];
684
- for (; h = r.exec(s); )
685
- o.push(h);
686
- return o;
687
- }
688
- if (t.global)
689
- i(t, this.original).forEach((s) => {
690
- if (s.index != null) {
691
- const h = n(s, this.original);
692
- h !== s[0] && this.overwrite(
693
- s.index,
694
- s.index + s[0].length,
695
- h
696
- );
697
- }
698
- });
699
- else {
700
- const r = this.original.match(t);
701
- if (r && r.index != null) {
702
- const s = n(r, this.original);
703
- s !== r[0] && this.overwrite(
704
- r.index,
705
- r.index + r[0].length,
706
- s
707
- );
708
- }
709
- }
710
- return this;
711
- }
712
- _replaceString(t, e) {
713
- const { original: n } = this, i = n.indexOf(t);
714
- return i !== -1 && this.overwrite(i, i + t.length, e), this;
715
- }
716
- replace(t, e) {
717
- return typeof t == "string" ? this._replaceString(t, e) : this._replaceRegexp(t, e);
718
- }
719
- _replaceAllString(t, e) {
720
- const { original: n } = this, i = t.length;
721
- for (let r = n.indexOf(t); r !== -1; r = n.indexOf(t, r + i))
722
- n.slice(r, r + i) !== e && this.overwrite(r, r + i, e);
723
- return this;
724
- }
725
- replaceAll(t, e) {
726
- if (typeof t == "string")
727
- return this._replaceAllString(t, e);
728
- if (!t.global)
729
- throw new TypeError(
730
- "MagicString.prototype.replaceAll called with a non-global RegExp argument"
731
- );
732
- return this._replaceRegexp(t, e);
733
- }
734
- }
735
- export {
736
- D as SourceMap,
737
- I as default
738
- };