@tidbcloud/uikit 2.0.0-beta.103 → 2.0.0-beta.104

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 (106) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/_virtual/BufferList.cjs +4 -0
  3. package/dist/_virtual/BufferList.js +4 -0
  4. package/dist/_virtual/___vite-browser-external.cjs +6 -0
  5. package/dist/_virtual/___vite-browser-external.js +6 -0
  6. package/dist/_virtual/__vite-browser-external.cjs +4 -0
  7. package/dist/_virtual/__vite-browser-external.js +4 -0
  8. package/dist/_virtual/_commonjsHelpers.cjs +25 -0
  9. package/dist/_virtual/_commonjsHelpers.js +25 -0
  10. package/dist/_virtual/index.cjs +2 -2
  11. package/dist/_virtual/index.js +2 -2
  12. package/dist/_virtual/index2.cjs +2 -2
  13. package/dist/_virtual/index2.js +2 -2
  14. package/dist/_virtual/index3.cjs +4 -0
  15. package/dist/_virtual/index3.js +4 -0
  16. package/dist/_virtual/index4.cjs +4 -0
  17. package/dist/_virtual/index4.js +4 -0
  18. package/dist/_virtual/index5.cjs +4 -0
  19. package/dist/_virtual/index5.js +4 -0
  20. package/dist/_virtual/index6.cjs +4 -0
  21. package/dist/_virtual/index6.js +4 -0
  22. package/dist/_virtual/index7.cjs +4 -0
  23. package/dist/_virtual/index7.js +4 -0
  24. package/dist/_virtual/inherits_browser.cjs +4 -0
  25. package/dist/_virtual/inherits_browser.js +4 -0
  26. package/dist/_virtual/readable-browser.cjs +4 -0
  27. package/dist/_virtual/readable-browser.js +4 -0
  28. package/dist/_virtual/readable.cjs +4 -0
  29. package/dist/_virtual/readable.js +4 -0
  30. package/dist/_virtual/string_decoder.cjs +4 -0
  31. package/dist/_virtual/string_decoder.js +4 -0
  32. package/dist/_virtual/util.cjs +4 -0
  33. package/dist/_virtual/util.js +4 -0
  34. package/dist/node_modules/.pnpm/@emotion_server@11.11.0/node_modules/@emotion/server/create-instance/dist/emotion-server-create-instance.browser.esm.cjs +176 -0
  35. package/dist/node_modules/.pnpm/@emotion_server@11.11.0/node_modules/@emotion/server/create-instance/dist/emotion-server-create-instance.browser.esm.js +176 -0
  36. package/dist/node_modules/.pnpm/buffer-from@0.1.2/node_modules/buffer-from/index.cjs +46 -0
  37. package/dist/node_modules/.pnpm/buffer-from@0.1.2/node_modules/buffer-from/index.js +46 -0
  38. package/dist/node_modules/.pnpm/core-util-is@1.0.3/node_modules/core-util-is/lib/util.cjs +69 -0
  39. package/dist/node_modules/.pnpm/core-util-is@1.0.3/node_modules/core-util-is/lib/util.js +69 -0
  40. package/dist/node_modules/.pnpm/duplexer2@0.1.4/node_modules/duplexer2/index.cjs +64 -0
  41. package/dist/node_modules/.pnpm/duplexer2@0.1.4/node_modules/duplexer2/index.js +64 -0
  42. package/dist/node_modules/.pnpm/html-tokenize@2.0.1/node_modules/html-tokenize/index.cjs +199 -0
  43. package/dist/node_modules/.pnpm/html-tokenize@2.0.1/node_modules/html-tokenize/index.js +199 -0
  44. package/dist/node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.cjs +31 -0
  45. package/dist/node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js +31 -0
  46. package/dist/node_modules/.pnpm/isarray@0.0.1/node_modules/isarray/index.cjs +6 -0
  47. package/dist/node_modules/.pnpm/isarray@0.0.1/node_modules/isarray/index.js +6 -0
  48. package/dist/node_modules/.pnpm/isarray@1.0.0/node_modules/isarray/index.cjs +7 -0
  49. package/dist/node_modules/.pnpm/isarray@1.0.0/node_modules/isarray/index.js +7 -0
  50. package/dist/node_modules/.pnpm/multipipe@1.0.2/node_modules/multipipe/index.cjs +67 -0
  51. package/dist/node_modules/.pnpm/multipipe@1.0.2/node_modules/multipipe/index.js +67 -0
  52. package/dist/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.cjs +56 -63
  53. package/dist/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js +56 -63
  54. package/dist/node_modules/.pnpm/process-nextick-args@2.0.1/node_modules/process-nextick-args/index.cjs +43 -0
  55. package/dist/node_modules/.pnpm/process-nextick-args@2.0.1/node_modules/process-nextick-args/index.js +43 -0
  56. package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.cjs +1 -1
  57. package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.js +2 -2
  58. package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.cjs +1 -1
  59. package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +1 -1
  60. package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.cjs +1 -1
  61. package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +1 -1
  62. package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_duplex.cjs +54 -0
  63. package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_duplex.js +54 -0
  64. package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_passthrough.cjs +20 -0
  65. package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_passthrough.js +20 -0
  66. package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_readable.cjs +607 -0
  67. package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_readable.js +607 -0
  68. package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_transform.cjs +95 -0
  69. package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_transform.js +95 -0
  70. package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_writable.cjs +240 -0
  71. package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_writable.js +240 -0
  72. package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/readable.cjs +24 -0
  73. package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/readable.js +24 -0
  74. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_duplex.cjs +83 -0
  75. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_duplex.js +83 -0
  76. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_passthrough.cjs +19 -0
  77. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_passthrough.js +19 -0
  78. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_readable.cjs +702 -0
  79. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_readable.js +702 -0
  80. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_transform.cjs +100 -0
  81. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_transform.js +100 -0
  82. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_writable.cjs +453 -0
  83. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_writable.js +453 -0
  84. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/BufferList.cjs +85 -0
  85. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/BufferList.js +85 -0
  86. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/destroy.cjs +66 -0
  87. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/destroy.js +66 -0
  88. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/stream-browser.cjs +5 -0
  89. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/stream-browser.js +5 -0
  90. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/readable-browser.cjs +19 -0
  91. package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/readable-browser.js +19 -0
  92. package/dist/node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.cjs +59 -0
  93. package/dist/node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.js +59 -0
  94. package/dist/node_modules/.pnpm/string_decoder@0.10.31/node_modules/string_decoder/index.cjs +143 -0
  95. package/dist/node_modules/.pnpm/string_decoder@0.10.31/node_modules/string_decoder/index.js +143 -0
  96. package/dist/node_modules/.pnpm/string_decoder@1.1.1/node_modules/string_decoder/lib/string_decoder.cjs +242 -0
  97. package/dist/node_modules/.pnpm/string_decoder@1.1.1/node_modules/string_decoder/lib/string_decoder.js +242 -0
  98. package/dist/node_modules/.pnpm/through@2.3.8/node_modules/through/index.cjs +91 -0
  99. package/dist/node_modules/.pnpm/through@2.3.8/node_modules/through/index.js +91 -0
  100. package/dist/node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/browser.cjs +35 -0
  101. package/dist/node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/browser.js +35 -0
  102. package/dist/utils/emotion.d.cts +1 -0
  103. package/dist/utils/emotion.d.ts +1 -0
  104. package/dist/utils/index.cjs +2 -0
  105. package/dist/utils/index.js +4 -2
  106. package/package.json +2 -1
@@ -0,0 +1,607 @@
1
+ import { i as isarray } from "../../../../isarray@0.0.1/node_modules/isarray/index.js";
2
+ import require$$1 from "../../../../../../_virtual/___vite-browser-external.js";
3
+ import "../../../../core-util-is@1.0.3/node_modules/core-util-is/lib/util.js";
4
+ import { i as inherits_browserExports } from "../../../../inherits@2.0.4/node_modules/inherits/inherits_browser.js";
5
+ import { __require as requireString_decoder } from "../../../../string_decoder@0.10.31/node_modules/string_decoder/index.js";
6
+ import { __exports as util$1 } from "../../../../../../_virtual/util.js";
7
+ var _stream_readable = Readable;
8
+ var isArray = isarray;
9
+ var Buffer = require$$1.Buffer;
10
+ Readable.ReadableState = ReadableState;
11
+ var EE = require$$1.EventEmitter;
12
+ if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
13
+ return emitter.listeners(type).length;
14
+ };
15
+ var Stream = require$$1;
16
+ var util = util$1;
17
+ util.inherits = inherits_browserExports;
18
+ var StringDecoder;
19
+ util.inherits(Readable, Stream);
20
+ function ReadableState(options, stream) {
21
+ options = options || {};
22
+ var hwm = options.highWaterMark;
23
+ this.highWaterMark = hwm || hwm === 0 ? hwm : 16 * 1024;
24
+ this.highWaterMark = ~~this.highWaterMark;
25
+ this.buffer = [];
26
+ this.length = 0;
27
+ this.pipes = null;
28
+ this.pipesCount = 0;
29
+ this.flowing = false;
30
+ this.ended = false;
31
+ this.endEmitted = false;
32
+ this.reading = false;
33
+ this.calledRead = false;
34
+ this.sync = true;
35
+ this.needReadable = false;
36
+ this.emittedReadable = false;
37
+ this.readableListening = false;
38
+ this.objectMode = !!options.objectMode;
39
+ this.defaultEncoding = options.defaultEncoding || "utf8";
40
+ this.ranOut = false;
41
+ this.awaitDrain = 0;
42
+ this.readingMore = false;
43
+ this.decoder = null;
44
+ this.encoding = null;
45
+ if (options.encoding) {
46
+ if (!StringDecoder)
47
+ StringDecoder = requireString_decoder().StringDecoder;
48
+ this.decoder = new StringDecoder(options.encoding);
49
+ this.encoding = options.encoding;
50
+ }
51
+ }
52
+ function Readable(options) {
53
+ if (!(this instanceof Readable))
54
+ return new Readable(options);
55
+ this._readableState = new ReadableState(options);
56
+ this.readable = true;
57
+ Stream.call(this);
58
+ }
59
+ Readable.prototype.push = function(chunk, encoding) {
60
+ var state = this._readableState;
61
+ if (typeof chunk === "string" && !state.objectMode) {
62
+ encoding = encoding || state.defaultEncoding;
63
+ if (encoding !== state.encoding) {
64
+ chunk = new Buffer(chunk, encoding);
65
+ encoding = "";
66
+ }
67
+ }
68
+ return readableAddChunk(this, state, chunk, encoding, false);
69
+ };
70
+ Readable.prototype.unshift = function(chunk) {
71
+ var state = this._readableState;
72
+ return readableAddChunk(this, state, chunk, "", true);
73
+ };
74
+ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
75
+ var er = chunkInvalid(state, chunk);
76
+ if (er) {
77
+ stream.emit("error", er);
78
+ } else if (chunk === null || chunk === void 0) {
79
+ state.reading = false;
80
+ if (!state.ended)
81
+ onEofChunk(stream, state);
82
+ } else if (state.objectMode || chunk && chunk.length > 0) {
83
+ if (state.ended && !addToFront) {
84
+ var e = new Error("stream.push() after EOF");
85
+ stream.emit("error", e);
86
+ } else if (state.endEmitted && addToFront) {
87
+ var e = new Error("stream.unshift() after end event");
88
+ stream.emit("error", e);
89
+ } else {
90
+ if (state.decoder && !addToFront && !encoding)
91
+ chunk = state.decoder.write(chunk);
92
+ state.length += state.objectMode ? 1 : chunk.length;
93
+ if (addToFront) {
94
+ state.buffer.unshift(chunk);
95
+ } else {
96
+ state.reading = false;
97
+ state.buffer.push(chunk);
98
+ }
99
+ if (state.needReadable)
100
+ emitReadable(stream);
101
+ maybeReadMore(stream, state);
102
+ }
103
+ } else if (!addToFront) {
104
+ state.reading = false;
105
+ }
106
+ return needMoreData(state);
107
+ }
108
+ function needMoreData(state) {
109
+ return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
110
+ }
111
+ Readable.prototype.setEncoding = function(enc) {
112
+ if (!StringDecoder)
113
+ StringDecoder = requireString_decoder().StringDecoder;
114
+ this._readableState.decoder = new StringDecoder(enc);
115
+ this._readableState.encoding = enc;
116
+ };
117
+ var MAX_HWM = 8388608;
118
+ function roundUpToNextPowerOf2(n) {
119
+ if (n >= MAX_HWM) {
120
+ n = MAX_HWM;
121
+ } else {
122
+ n--;
123
+ for (var p = 1; p < 32; p <<= 1) n |= n >> p;
124
+ n++;
125
+ }
126
+ return n;
127
+ }
128
+ function howMuchToRead(n, state) {
129
+ if (state.length === 0 && state.ended)
130
+ return 0;
131
+ if (state.objectMode)
132
+ return n === 0 ? 0 : 1;
133
+ if (n === null || isNaN(n)) {
134
+ if (state.flowing && state.buffer.length)
135
+ return state.buffer[0].length;
136
+ else
137
+ return state.length;
138
+ }
139
+ if (n <= 0)
140
+ return 0;
141
+ if (n > state.highWaterMark)
142
+ state.highWaterMark = roundUpToNextPowerOf2(n);
143
+ if (n > state.length) {
144
+ if (!state.ended) {
145
+ state.needReadable = true;
146
+ return 0;
147
+ } else
148
+ return state.length;
149
+ }
150
+ return n;
151
+ }
152
+ Readable.prototype.read = function(n) {
153
+ var state = this._readableState;
154
+ state.calledRead = true;
155
+ var nOrig = n;
156
+ var ret;
157
+ if (typeof n !== "number" || n > 0)
158
+ state.emittedReadable = false;
159
+ if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
160
+ emitReadable(this);
161
+ return null;
162
+ }
163
+ n = howMuchToRead(n, state);
164
+ if (n === 0 && state.ended) {
165
+ ret = null;
166
+ if (state.length > 0 && state.decoder) {
167
+ ret = fromList(n, state);
168
+ state.length -= ret.length;
169
+ }
170
+ if (state.length === 0)
171
+ endReadable(this);
172
+ return ret;
173
+ }
174
+ var doRead = state.needReadable;
175
+ if (state.length - n <= state.highWaterMark)
176
+ doRead = true;
177
+ if (state.ended || state.reading)
178
+ doRead = false;
179
+ if (doRead) {
180
+ state.reading = true;
181
+ state.sync = true;
182
+ if (state.length === 0)
183
+ state.needReadable = true;
184
+ this._read(state.highWaterMark);
185
+ state.sync = false;
186
+ }
187
+ if (doRead && !state.reading)
188
+ n = howMuchToRead(nOrig, state);
189
+ if (n > 0)
190
+ ret = fromList(n, state);
191
+ else
192
+ ret = null;
193
+ if (ret === null) {
194
+ state.needReadable = true;
195
+ n = 0;
196
+ }
197
+ state.length -= n;
198
+ if (state.length === 0 && !state.ended)
199
+ state.needReadable = true;
200
+ if (state.ended && !state.endEmitted && state.length === 0)
201
+ endReadable(this);
202
+ return ret;
203
+ };
204
+ function chunkInvalid(state, chunk) {
205
+ var er = null;
206
+ if (!Buffer.isBuffer(chunk) && "string" !== typeof chunk && chunk !== null && chunk !== void 0 && !state.objectMode) {
207
+ er = new TypeError("Invalid non-string/buffer chunk");
208
+ }
209
+ return er;
210
+ }
211
+ function onEofChunk(stream, state) {
212
+ if (state.decoder && !state.ended) {
213
+ var chunk = state.decoder.end();
214
+ if (chunk && chunk.length) {
215
+ state.buffer.push(chunk);
216
+ state.length += state.objectMode ? 1 : chunk.length;
217
+ }
218
+ }
219
+ state.ended = true;
220
+ if (state.length > 0)
221
+ emitReadable(stream);
222
+ else
223
+ endReadable(stream);
224
+ }
225
+ function emitReadable(stream) {
226
+ var state = stream._readableState;
227
+ state.needReadable = false;
228
+ if (state.emittedReadable)
229
+ return;
230
+ state.emittedReadable = true;
231
+ if (state.sync)
232
+ process.nextTick(function() {
233
+ emitReadable_(stream);
234
+ });
235
+ else
236
+ emitReadable_(stream);
237
+ }
238
+ function emitReadable_(stream) {
239
+ stream.emit("readable");
240
+ }
241
+ function maybeReadMore(stream, state) {
242
+ if (!state.readingMore) {
243
+ state.readingMore = true;
244
+ process.nextTick(function() {
245
+ maybeReadMore_(stream, state);
246
+ });
247
+ }
248
+ }
249
+ function maybeReadMore_(stream, state) {
250
+ var len = state.length;
251
+ while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
252
+ stream.read(0);
253
+ if (len === state.length)
254
+ break;
255
+ else
256
+ len = state.length;
257
+ }
258
+ state.readingMore = false;
259
+ }
260
+ Readable.prototype._read = function(n) {
261
+ this.emit("error", new Error("not implemented"));
262
+ };
263
+ Readable.prototype.pipe = function(dest, pipeOpts) {
264
+ var src = this;
265
+ var state = this._readableState;
266
+ switch (state.pipesCount) {
267
+ case 0:
268
+ state.pipes = dest;
269
+ break;
270
+ case 1:
271
+ state.pipes = [state.pipes, dest];
272
+ break;
273
+ default:
274
+ state.pipes.push(dest);
275
+ break;
276
+ }
277
+ state.pipesCount += 1;
278
+ var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
279
+ var endFn = doEnd ? onend : cleanup;
280
+ if (state.endEmitted)
281
+ process.nextTick(endFn);
282
+ else
283
+ src.once("end", endFn);
284
+ dest.on("unpipe", onunpipe);
285
+ function onunpipe(readable) {
286
+ if (readable !== src) return;
287
+ cleanup();
288
+ }
289
+ function onend() {
290
+ dest.end();
291
+ }
292
+ var ondrain = pipeOnDrain(src);
293
+ dest.on("drain", ondrain);
294
+ function cleanup() {
295
+ dest.removeListener("close", onclose);
296
+ dest.removeListener("finish", onfinish);
297
+ dest.removeListener("drain", ondrain);
298
+ dest.removeListener("error", onerror);
299
+ dest.removeListener("unpipe", onunpipe);
300
+ src.removeListener("end", onend);
301
+ src.removeListener("end", cleanup);
302
+ if (!dest._writableState || dest._writableState.needDrain)
303
+ ondrain();
304
+ }
305
+ function onerror(er) {
306
+ unpipe();
307
+ dest.removeListener("error", onerror);
308
+ if (EE.listenerCount(dest, "error") === 0)
309
+ dest.emit("error", er);
310
+ }
311
+ if (!dest._events || !dest._events.error)
312
+ dest.on("error", onerror);
313
+ else if (isArray(dest._events.error))
314
+ dest._events.error.unshift(onerror);
315
+ else
316
+ dest._events.error = [onerror, dest._events.error];
317
+ function onclose() {
318
+ dest.removeListener("finish", onfinish);
319
+ unpipe();
320
+ }
321
+ dest.once("close", onclose);
322
+ function onfinish() {
323
+ dest.removeListener("close", onclose);
324
+ unpipe();
325
+ }
326
+ dest.once("finish", onfinish);
327
+ function unpipe() {
328
+ src.unpipe(dest);
329
+ }
330
+ dest.emit("pipe", src);
331
+ if (!state.flowing) {
332
+ this.on("readable", pipeOnReadable);
333
+ state.flowing = true;
334
+ process.nextTick(function() {
335
+ flow(src);
336
+ });
337
+ }
338
+ return dest;
339
+ };
340
+ function pipeOnDrain(src) {
341
+ return function() {
342
+ var state = src._readableState;
343
+ state.awaitDrain--;
344
+ if (state.awaitDrain === 0)
345
+ flow(src);
346
+ };
347
+ }
348
+ function flow(src) {
349
+ var state = src._readableState;
350
+ var chunk;
351
+ state.awaitDrain = 0;
352
+ function write(dest, i, list) {
353
+ var written = dest.write(chunk);
354
+ if (false === written) {
355
+ state.awaitDrain++;
356
+ }
357
+ }
358
+ while (state.pipesCount && null !== (chunk = src.read())) {
359
+ if (state.pipesCount === 1)
360
+ write(state.pipes);
361
+ else
362
+ forEach(state.pipes, write);
363
+ src.emit("data", chunk);
364
+ if (state.awaitDrain > 0)
365
+ return;
366
+ }
367
+ if (state.pipesCount === 0) {
368
+ state.flowing = false;
369
+ if (EE.listenerCount(src, "data") > 0)
370
+ emitDataEvents(src);
371
+ return;
372
+ }
373
+ state.ranOut = true;
374
+ }
375
+ function pipeOnReadable() {
376
+ if (this._readableState.ranOut) {
377
+ this._readableState.ranOut = false;
378
+ flow(this);
379
+ }
380
+ }
381
+ Readable.prototype.unpipe = function(dest) {
382
+ var state = this._readableState;
383
+ if (state.pipesCount === 0)
384
+ return this;
385
+ if (state.pipesCount === 1) {
386
+ if (dest && dest !== state.pipes)
387
+ return this;
388
+ if (!dest)
389
+ dest = state.pipes;
390
+ state.pipes = null;
391
+ state.pipesCount = 0;
392
+ this.removeListener("readable", pipeOnReadable);
393
+ state.flowing = false;
394
+ if (dest)
395
+ dest.emit("unpipe", this);
396
+ return this;
397
+ }
398
+ if (!dest) {
399
+ var dests = state.pipes;
400
+ var len = state.pipesCount;
401
+ state.pipes = null;
402
+ state.pipesCount = 0;
403
+ this.removeListener("readable", pipeOnReadable);
404
+ state.flowing = false;
405
+ for (var i = 0; i < len; i++)
406
+ dests[i].emit("unpipe", this);
407
+ return this;
408
+ }
409
+ var i = indexOf(state.pipes, dest);
410
+ if (i === -1)
411
+ return this;
412
+ state.pipes.splice(i, 1);
413
+ state.pipesCount -= 1;
414
+ if (state.pipesCount === 1)
415
+ state.pipes = state.pipes[0];
416
+ dest.emit("unpipe", this);
417
+ return this;
418
+ };
419
+ Readable.prototype.on = function(ev, fn) {
420
+ var res = Stream.prototype.on.call(this, ev, fn);
421
+ if (ev === "data" && !this._readableState.flowing)
422
+ emitDataEvents(this);
423
+ if (ev === "readable" && this.readable) {
424
+ var state = this._readableState;
425
+ if (!state.readableListening) {
426
+ state.readableListening = true;
427
+ state.emittedReadable = false;
428
+ state.needReadable = true;
429
+ if (!state.reading) {
430
+ this.read(0);
431
+ } else if (state.length) {
432
+ emitReadable(this);
433
+ }
434
+ }
435
+ }
436
+ return res;
437
+ };
438
+ Readable.prototype.addListener = Readable.prototype.on;
439
+ Readable.prototype.resume = function() {
440
+ emitDataEvents(this);
441
+ this.read(0);
442
+ this.emit("resume");
443
+ };
444
+ Readable.prototype.pause = function() {
445
+ emitDataEvents(this, true);
446
+ this.emit("pause");
447
+ };
448
+ function emitDataEvents(stream, startPaused) {
449
+ var state = stream._readableState;
450
+ if (state.flowing) {
451
+ throw new Error("Cannot switch to old mode now.");
452
+ }
453
+ var paused = startPaused || false;
454
+ var readable = false;
455
+ stream.readable = true;
456
+ stream.pipe = Stream.prototype.pipe;
457
+ stream.on = stream.addListener = Stream.prototype.on;
458
+ stream.on("readable", function() {
459
+ readable = true;
460
+ var c;
461
+ while (!paused && null !== (c = stream.read()))
462
+ stream.emit("data", c);
463
+ if (c === null) {
464
+ readable = false;
465
+ stream._readableState.needReadable = true;
466
+ }
467
+ });
468
+ stream.pause = function() {
469
+ paused = true;
470
+ this.emit("pause");
471
+ };
472
+ stream.resume = function() {
473
+ paused = false;
474
+ if (readable)
475
+ process.nextTick(function() {
476
+ stream.emit("readable");
477
+ });
478
+ else
479
+ this.read(0);
480
+ this.emit("resume");
481
+ };
482
+ stream.emit("readable");
483
+ }
484
+ Readable.prototype.wrap = function(stream) {
485
+ var state = this._readableState;
486
+ var paused = false;
487
+ var self = this;
488
+ stream.on("end", function() {
489
+ if (state.decoder && !state.ended) {
490
+ var chunk = state.decoder.end();
491
+ if (chunk && chunk.length)
492
+ self.push(chunk);
493
+ }
494
+ self.push(null);
495
+ });
496
+ stream.on("data", function(chunk) {
497
+ if (state.decoder)
498
+ chunk = state.decoder.write(chunk);
499
+ if (state.objectMode && (chunk === null || chunk === void 0))
500
+ return;
501
+ else if (!state.objectMode && (!chunk || !chunk.length))
502
+ return;
503
+ var ret = self.push(chunk);
504
+ if (!ret) {
505
+ paused = true;
506
+ stream.pause();
507
+ }
508
+ });
509
+ for (var i in stream) {
510
+ if (typeof stream[i] === "function" && typeof this[i] === "undefined") {
511
+ this[i] = /* @__PURE__ */ function(method) {
512
+ return function() {
513
+ return stream[method].apply(stream, arguments);
514
+ };
515
+ }(i);
516
+ }
517
+ }
518
+ var events = ["error", "close", "destroy", "pause", "resume"];
519
+ forEach(events, function(ev) {
520
+ stream.on(ev, self.emit.bind(self, ev));
521
+ });
522
+ self._read = function(n) {
523
+ if (paused) {
524
+ paused = false;
525
+ stream.resume();
526
+ }
527
+ };
528
+ return self;
529
+ };
530
+ Readable._fromList = fromList;
531
+ function fromList(n, state) {
532
+ var list = state.buffer;
533
+ var length = state.length;
534
+ var stringMode = !!state.decoder;
535
+ var objectMode = !!state.objectMode;
536
+ var ret;
537
+ if (list.length === 0)
538
+ return null;
539
+ if (length === 0)
540
+ ret = null;
541
+ else if (objectMode)
542
+ ret = list.shift();
543
+ else if (!n || n >= length) {
544
+ if (stringMode)
545
+ ret = list.join("");
546
+ else
547
+ ret = Buffer.concat(list, length);
548
+ list.length = 0;
549
+ } else {
550
+ if (n < list[0].length) {
551
+ var buf = list[0];
552
+ ret = buf.slice(0, n);
553
+ list[0] = buf.slice(n);
554
+ } else if (n === list[0].length) {
555
+ ret = list.shift();
556
+ } else {
557
+ if (stringMode)
558
+ ret = "";
559
+ else
560
+ ret = new Buffer(n);
561
+ var c = 0;
562
+ for (var i = 0, l = list.length; i < l && c < n; i++) {
563
+ var buf = list[0];
564
+ var cpy = Math.min(n - c, buf.length);
565
+ if (stringMode)
566
+ ret += buf.slice(0, cpy);
567
+ else
568
+ buf.copy(ret, c, 0, cpy);
569
+ if (cpy < buf.length)
570
+ list[0] = buf.slice(cpy);
571
+ else
572
+ list.shift();
573
+ c += cpy;
574
+ }
575
+ }
576
+ }
577
+ return ret;
578
+ }
579
+ function endReadable(stream) {
580
+ var state = stream._readableState;
581
+ if (state.length > 0)
582
+ throw new Error("endReadable called on non-empty stream");
583
+ if (!state.endEmitted && state.calledRead) {
584
+ state.ended = true;
585
+ process.nextTick(function() {
586
+ if (!state.endEmitted && state.length === 0) {
587
+ state.endEmitted = true;
588
+ stream.readable = false;
589
+ stream.emit("end");
590
+ }
591
+ });
592
+ }
593
+ }
594
+ function forEach(xs, f) {
595
+ for (var i = 0, l = xs.length; i < l; i++) {
596
+ f(xs[i], i);
597
+ }
598
+ }
599
+ function indexOf(xs, x) {
600
+ for (var i = 0, l = xs.length; i < l; i++) {
601
+ if (xs[i] === x) return i;
602
+ }
603
+ return -1;
604
+ }
605
+ export {
606
+ _stream_readable as _
607
+ };
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const _stream_duplex = require("./_stream_duplex.cjs");
4
+ require("../../../../core-util-is@1.0.3/node_modules/core-util-is/lib/util.cjs");
5
+ const inherits_browser = require("../../../../inherits@2.0.4/node_modules/inherits/inherits_browser.cjs");
6
+ const util$1 = require("../../../../../../_virtual/util.cjs");
7
+ var _stream_transform = Transform;
8
+ var Duplex = _stream_duplex.__require();
9
+ var util = util$1.__exports;
10
+ util.inherits = inherits_browser.inherits_browserExports;
11
+ util.inherits(Transform, Duplex);
12
+ function TransformState(options, stream) {
13
+ this.afterTransform = function(er, data) {
14
+ return afterTransform(stream, er, data);
15
+ };
16
+ this.needTransform = false;
17
+ this.transforming = false;
18
+ this.writecb = null;
19
+ this.writechunk = null;
20
+ }
21
+ function afterTransform(stream, er, data) {
22
+ var ts = stream._transformState;
23
+ ts.transforming = false;
24
+ var cb = ts.writecb;
25
+ if (!cb)
26
+ return stream.emit("error", new Error("no writecb in Transform class"));
27
+ ts.writechunk = null;
28
+ ts.writecb = null;
29
+ if (data !== null && data !== void 0)
30
+ stream.push(data);
31
+ if (cb)
32
+ cb(er);
33
+ var rs = stream._readableState;
34
+ rs.reading = false;
35
+ if (rs.needReadable || rs.length < rs.highWaterMark) {
36
+ stream._read(rs.highWaterMark);
37
+ }
38
+ }
39
+ function Transform(options) {
40
+ if (!(this instanceof Transform))
41
+ return new Transform(options);
42
+ Duplex.call(this, options);
43
+ this._transformState = new TransformState(options, this);
44
+ var stream = this;
45
+ this._readableState.needReadable = true;
46
+ this._readableState.sync = false;
47
+ this.once("finish", function() {
48
+ if ("function" === typeof this._flush)
49
+ this._flush(function(er) {
50
+ done(stream, er);
51
+ });
52
+ else
53
+ done(stream);
54
+ });
55
+ }
56
+ Transform.prototype.push = function(chunk, encoding) {
57
+ this._transformState.needTransform = false;
58
+ return Duplex.prototype.push.call(this, chunk, encoding);
59
+ };
60
+ Transform.prototype._transform = function(chunk, encoding, cb) {
61
+ throw new Error("not implemented");
62
+ };
63
+ Transform.prototype._write = function(chunk, encoding, cb) {
64
+ var ts = this._transformState;
65
+ ts.writecb = cb;
66
+ ts.writechunk = chunk;
67
+ ts.writeencoding = encoding;
68
+ if (!ts.transforming) {
69
+ var rs = this._readableState;
70
+ if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
71
+ this._read(rs.highWaterMark);
72
+ }
73
+ };
74
+ Transform.prototype._read = function(n) {
75
+ var ts = this._transformState;
76
+ if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
77
+ ts.transforming = true;
78
+ this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
79
+ } else {
80
+ ts.needTransform = true;
81
+ }
82
+ };
83
+ function done(stream, er) {
84
+ if (er)
85
+ return stream.emit("error", er);
86
+ var ws = stream._writableState;
87
+ stream._readableState;
88
+ var ts = stream._transformState;
89
+ if (ws.length)
90
+ throw new Error("calling transform done when ws.length != 0");
91
+ if (ts.transforming)
92
+ throw new Error("calling transform done when still transforming");
93
+ return stream.push(null);
94
+ }
95
+ exports._stream_transform = _stream_transform;