@hintergrund/ui 0.3.4 → 0.3.6
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.
- package/dist/BuilderAgentPane-Vj3NCGvZ.js +25916 -0
- package/dist/IntegrationHealth-D1HcBrQn.js +218 -0
- package/dist/admin.js +22766 -28480
- package/dist/anthropic-messages-D8Vp-Ncs.js +3772 -0
- package/dist/azure-openai-responses-DnjyYuiz.js +168 -0
- package/dist/builder.js +27 -22
- package/dist/config.types-DZ5yfeqq.js +20 -0
- package/dist/deferred-tools-nxpq94I4.js +34 -0
- package/dist/diagnostics-x5QOwca_.js +91 -0
- package/dist/error-body-pXgvw5vV.js +68 -0
- package/dist/font-pool/LICENSES.txt +22 -0
- package/dist/font-pool/inter.ttf +0 -0
- package/dist/font-pool/inter.woff2 +0 -0
- package/dist/font-pool/jetbrains-mono.ttf +0 -0
- package/dist/font-pool/jetbrains-mono.woff2 +0 -0
- package/dist/font-pool/lora.ttf +0 -0
- package/dist/font-pool/lora.woff2 +0 -0
- package/dist/font-pool/merriweather.ttf +0 -0
- package/dist/font-pool/merriweather.woff2 +0 -0
- package/dist/font-pool/montserrat.ttf +0 -0
- package/dist/font-pool/montserrat.woff2 +0 -0
- package/dist/font-pool/playfair-display.ttf +0 -0
- package/dist/font-pool/playfair-display.woff2 +0 -0
- package/dist/font-pool/poppins.ttf +0 -0
- package/dist/font-pool/poppins.woff2 +0 -0
- package/dist/font-pool/roboto.ttf +0 -0
- package/dist/font-pool/roboto.woff2 +0 -0
- package/dist/font-pool/space-grotesk.ttf +0 -0
- package/dist/font-pool/space-grotesk.woff2 +0 -0
- package/dist/font-pool/work-sans.ttf +0 -0
- package/dist/font-pool/work-sans.woff2 +0 -0
- package/dist/github-copilot-headers-pRo3v4t7.js +27 -0
- package/dist/global-xsR9gLDa.js +30568 -0
- package/dist/google-generative-ai-BmzNjEvl.js +291 -0
- package/dist/google-shared-CG2Lbh1z.js +8746 -0
- package/dist/google-vertex-Dfla93V_.js +329 -0
- package/dist/hash-BixfZjoG.js +21 -0
- package/dist/headers-CnTiKpOL.js +24 -0
- package/dist/json-parse-CxjAnWaM.js +231 -0
- package/dist/legacy-Zmnk-v81.js +14 -0
- package/dist/login.js +131 -146
- package/dist/mail.js +694 -789
- package/dist/mistral-conversations-DeDb7Gbd.js +558 -0
- package/dist/openai-ClxLHXsh.js +5371 -0
- package/dist/openai-codex-responses-usgOtWUT.js +909 -0
- package/dist/openai-completions-D_nFQy7A.js +730 -0
- package/dist/openai-prompt-cache-Bm8Re6Vv.js +17 -0
- package/dist/openai-responses-BqL3PFsb.js +192 -0
- package/dist/openai-responses-shared-BhQj78KM.js +481 -0
- package/dist/pi-messages-CRx0yqMp.js +268 -0
- package/dist/pi-user-agent-CsXkkH60.js +20 -0
- package/dist/provider-env-Cj6X7Wly.js +35 -0
- package/dist/provider-retry-BGImU1PV.js +68 -0
- package/dist/rolldown-runtime-nTTD767F.js +37 -0
- package/dist/setup.js +391 -418
- package/dist/transform-messages-DvxSeyBQ.js +383 -0
- package/dist/ui.css +2 -1
- package/package.json +5 -5
- package/dist/BuilderAgentPane-CwG29LOX.js +0 -13938
- package/dist/IntegrationHealth-G_4vzV66.js +0 -209
- package/dist/anthropic-messages-BmLfYiwX.js +0 -5605
- package/dist/azure-openai-responses-yf2M6GVe.js +0 -222
- package/dist/client-Cd7yMX39.js +0 -7860
- package/dist/config.types-iZoywORE.js +0 -15
- package/dist/deferred-tools-BZWMWBYN.js +0 -28
- package/dist/error-body-BUPcH4GF.js +0 -71
- package/dist/github-copilot-headers-B1RBGoZi.js +0 -21
- package/dist/global-CTQcFve1.js +0 -36177
- package/dist/google-generative-ai-DkzwUYzL.js +0 -264
- package/dist/google-shared-DTgKMtfJ.js +0 -11710
- package/dist/google-vertex-D2IzqvQM.js +0 -305
- package/dist/hash-DFlR084x.js +0 -14
- package/dist/headers-D4iLzGaS.js +0 -21
- package/dist/json-parse-LZdWp-Nd.js +0 -232
- package/dist/legacy-CckexQcJ.js +0 -5
- package/dist/mistral-conversations-CNfKG0tU.js +0 -513
- package/dist/openai-codex-responses-BLNjExaC.js +0 -947
- package/dist/openai-completions-46IVoF2N.js +0 -741
- package/dist/openai-prompt-cache-BJwqbEDx.js +0 -13
- package/dist/openai-responses-BfHoZFHI.js +0 -184
- package/dist/openai-responses-shared-DOTQAbCj.js +0 -477
- package/dist/pi-messages-fnW87Z4Z.js +0 -251
- package/dist/pi-user-agent-CUqx-qiX.js +0 -13
- package/dist/provider-env-D2VjEV3S.js +0 -26
- package/dist/provider-retry-BsigVlMg.js +0 -67
- package/dist/select-Cke4DYH1.js +0 -78
- package/dist/transform-messages-CsKsy6b4.js +0 -398
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
globalThis.process === void 0 && (globalThis.process = {
|
|
2
|
+
env: {},
|
|
3
|
+
platform: "browser",
|
|
4
|
+
version: "",
|
|
5
|
+
versions: {},
|
|
6
|
+
browser: !0,
|
|
7
|
+
nextTick: function(e) {
|
|
8
|
+
return Promise.resolve().then(e);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
import { i as e, n as t, t as n } from "./diagnostics-x5QOwca_.js";
|
|
12
|
+
import { n as r } from "./json-parse-CxjAnWaM.js";
|
|
13
|
+
import { t as i } from "./provider-env-Cj6X7Wly.js";
|
|
14
|
+
import { n as a, t as o } from "./headers-CnTiKpOL.js";
|
|
15
|
+
//#region ../../../../node_modules/.pnpm/@earendil-works+pi-ai@0.84.2_supports-color@10.2.2_ws@8.21.3_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js
|
|
16
|
+
var s = class extends Error {
|
|
17
|
+
code;
|
|
18
|
+
diagnosticDetails;
|
|
19
|
+
constructor(e, t, n) {
|
|
20
|
+
super(e), this.name = "PiMessagesResponseError", this.code = t, this.diagnosticDetails = n;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
function c(e) {
|
|
24
|
+
try {
|
|
25
|
+
let t = JSON.parse(e), n = t?.error;
|
|
26
|
+
return t && typeof n == "object" && n && !Array.isArray(n) ? t : void 0;
|
|
27
|
+
} catch {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function l(e) {
|
|
32
|
+
let t = 8192;
|
|
33
|
+
return e.length > t ? `${e.slice(0, t)}…` : e;
|
|
34
|
+
}
|
|
35
|
+
function u(e, t, n) {
|
|
36
|
+
let r = typeof n?.error?.message == "string" ? n.error.message : void 0, i = typeof n?.error?.code == "string" ? n.error.code : void 0, a = r ?? t, o = i ? ` (${i})` : "";
|
|
37
|
+
return `${e.status} ${e.statusText}: ${a}${o}`;
|
|
38
|
+
}
|
|
39
|
+
function d(e, t, n, r) {
|
|
40
|
+
let i = c(r), a = typeof i?.error?.code == "string" ? i.error.code : void 0;
|
|
41
|
+
return new s(u(n, r, i), a, {
|
|
42
|
+
version: 1,
|
|
43
|
+
provider: e.provider,
|
|
44
|
+
model: e.id,
|
|
45
|
+
url: t.toString(),
|
|
46
|
+
status: n.status,
|
|
47
|
+
statusText: n.statusText,
|
|
48
|
+
error: i?.error,
|
|
49
|
+
body: i ? void 0 : l(r),
|
|
50
|
+
timestampMs: Date.now()
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function f() {
|
|
54
|
+
return {
|
|
55
|
+
input: 0,
|
|
56
|
+
output: 0,
|
|
57
|
+
cacheRead: 0,
|
|
58
|
+
cacheWrite: 0,
|
|
59
|
+
totalTokens: 0,
|
|
60
|
+
cost: {
|
|
61
|
+
input: 0,
|
|
62
|
+
output: 0,
|
|
63
|
+
cacheRead: 0,
|
|
64
|
+
cacheWrite: 0,
|
|
65
|
+
total: 0
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function p(e, t) {
|
|
70
|
+
t && n(e, {
|
|
71
|
+
type: "pi_messages_rewrite",
|
|
72
|
+
timestamp: Date.now(),
|
|
73
|
+
details: { ...t }
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function m(e) {
|
|
77
|
+
let t = {
|
|
78
|
+
role: "assistant",
|
|
79
|
+
content: [],
|
|
80
|
+
api: e.api,
|
|
81
|
+
provider: e.provider,
|
|
82
|
+
model: e.id,
|
|
83
|
+
usage: f(),
|
|
84
|
+
stopReason: "pending",
|
|
85
|
+
timestamp: Date.now()
|
|
86
|
+
}, n = /* @__PURE__ */ new Map();
|
|
87
|
+
return (e) => {
|
|
88
|
+
switch (e.type) {
|
|
89
|
+
case "done": return Object.assign(t, {
|
|
90
|
+
stopReason: e.reason,
|
|
91
|
+
usage: e.usage,
|
|
92
|
+
responseId: e.responseId
|
|
93
|
+
}), p(t, e.rewrite), {
|
|
94
|
+
type: "done",
|
|
95
|
+
reason: e.reason,
|
|
96
|
+
message: t
|
|
97
|
+
};
|
|
98
|
+
case "error": return Object.assign(t, {
|
|
99
|
+
stopReason: e.reason,
|
|
100
|
+
usage: e.usage,
|
|
101
|
+
errorMessage: e.errorMessage,
|
|
102
|
+
responseId: e.responseId
|
|
103
|
+
}), p(t, e.rewrite), {
|
|
104
|
+
type: "error",
|
|
105
|
+
reason: e.reason,
|
|
106
|
+
error: t
|
|
107
|
+
};
|
|
108
|
+
case "start": break;
|
|
109
|
+
case "text_start":
|
|
110
|
+
t.content[e.contentIndex] = {
|
|
111
|
+
type: "text",
|
|
112
|
+
text: ""
|
|
113
|
+
};
|
|
114
|
+
break;
|
|
115
|
+
case "text_delta":
|
|
116
|
+
t.content[e.contentIndex].text += e.delta;
|
|
117
|
+
break;
|
|
118
|
+
case "text_end":
|
|
119
|
+
Object.assign(t.content[e.contentIndex], {
|
|
120
|
+
text: e.content,
|
|
121
|
+
textSignature: e.contentSignature
|
|
122
|
+
});
|
|
123
|
+
break;
|
|
124
|
+
case "thinking_start":
|
|
125
|
+
t.content[e.contentIndex] = {
|
|
126
|
+
type: "thinking",
|
|
127
|
+
thinking: ""
|
|
128
|
+
};
|
|
129
|
+
break;
|
|
130
|
+
case "thinking_delta":
|
|
131
|
+
t.content[e.contentIndex].thinking += e.delta;
|
|
132
|
+
break;
|
|
133
|
+
case "thinking_end":
|
|
134
|
+
Object.assign(t.content[e.contentIndex], {
|
|
135
|
+
thinking: e.content,
|
|
136
|
+
thinkingSignature: e.contentSignature,
|
|
137
|
+
redacted: e.redacted
|
|
138
|
+
});
|
|
139
|
+
break;
|
|
140
|
+
case "toolcall_start":
|
|
141
|
+
t.content[e.contentIndex] = {
|
|
142
|
+
type: "toolCall",
|
|
143
|
+
id: e.id,
|
|
144
|
+
name: e.toolName,
|
|
145
|
+
arguments: {}
|
|
146
|
+
}, n.set(e.contentIndex, "");
|
|
147
|
+
break;
|
|
148
|
+
case "toolcall_delta": {
|
|
149
|
+
let i = `${n.get(e.contentIndex) ?? ""}${e.delta}`;
|
|
150
|
+
n.set(e.contentIndex, i), t.content[e.contentIndex].arguments = r(i);
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case "toolcall_end": return Object.assign(t.content[e.contentIndex], e.toolCall), n.delete(e.contentIndex), {
|
|
154
|
+
type: "toolcall_end",
|
|
155
|
+
contentIndex: e.contentIndex,
|
|
156
|
+
toolCall: t.content[e.contentIndex],
|
|
157
|
+
partial: t
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
...e,
|
|
162
|
+
partial: t
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
async function* h(e) {
|
|
167
|
+
let t = new TextDecoder(), n = e.getReader(), r = "";
|
|
168
|
+
try {
|
|
169
|
+
for (;;) {
|
|
170
|
+
let { done: e, value: i } = await n.read();
|
|
171
|
+
r += e ? t.decode() : t.decode(i, { stream: !0 }), r = r.replace(/\r\n/g, "\n");
|
|
172
|
+
let a = r.indexOf("\n\n");
|
|
173
|
+
for (; a !== -1;) {
|
|
174
|
+
let e = g(r.slice(0, a));
|
|
175
|
+
e && (yield e), r = r.slice(a + 2), a = r.indexOf("\n\n");
|
|
176
|
+
}
|
|
177
|
+
if (e) break;
|
|
178
|
+
}
|
|
179
|
+
if (r.trim()) {
|
|
180
|
+
let e = g(r);
|
|
181
|
+
e && (yield e);
|
|
182
|
+
}
|
|
183
|
+
} finally {
|
|
184
|
+
n.releaseLock();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function g(e) {
|
|
188
|
+
let t = e.split("\n").find((e) => e.startsWith("data:"))?.slice(5).trim();
|
|
189
|
+
return t && t !== "[DONE]" ? JSON.parse(t) : void 0;
|
|
190
|
+
}
|
|
191
|
+
function _(e, r, i) {
|
|
192
|
+
let a = i ? "aborted" : "error", o = {
|
|
193
|
+
role: "assistant",
|
|
194
|
+
content: [],
|
|
195
|
+
api: e.api,
|
|
196
|
+
provider: e.provider,
|
|
197
|
+
model: e.id,
|
|
198
|
+
usage: f(),
|
|
199
|
+
stopReason: a,
|
|
200
|
+
errorMessage: r instanceof Error ? r.message : String(r),
|
|
201
|
+
timestamp: Date.now()
|
|
202
|
+
};
|
|
203
|
+
return !i && r instanceof s && n(o, t("pi_messages_response_failure", r, r.diagnosticDetails)), {
|
|
204
|
+
type: "error",
|
|
205
|
+
reason: a,
|
|
206
|
+
error: o
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function v(e, t) {
|
|
210
|
+
return e || (i("PI_CACHE_RETENTION", t) === "long" ? "long" : void 0);
|
|
211
|
+
}
|
|
212
|
+
var y = (t, n, r) => {
|
|
213
|
+
let i = new e(), s = m(t);
|
|
214
|
+
return (async () => {
|
|
215
|
+
try {
|
|
216
|
+
let e = r?.apiKey;
|
|
217
|
+
if (!e) throw Error(`No API key provided for provider "${t.provider}"`);
|
|
218
|
+
let c = new URL(`${t.baseUrl.replace(/\/+$/u, "")}/messages`);
|
|
219
|
+
r?.debug && c.searchParams.set("debug", "1");
|
|
220
|
+
let l = {
|
|
221
|
+
model: t.id,
|
|
222
|
+
context: n,
|
|
223
|
+
options: {
|
|
224
|
+
temperature: r?.temperature,
|
|
225
|
+
maxTokens: r?.maxTokens,
|
|
226
|
+
reasoning: r?.reasoning,
|
|
227
|
+
cacheRetention: v(r?.cacheRetention, r?.env),
|
|
228
|
+
sessionId: r?.sessionId,
|
|
229
|
+
toolChoice: r?.toolChoice
|
|
230
|
+
}
|
|
231
|
+
}, u = await r?.onPayload?.(l, t);
|
|
232
|
+
u !== void 0 && (l = u);
|
|
233
|
+
let f = await (r?.fetch ?? globalThis.fetch)(c, {
|
|
234
|
+
method: "POST",
|
|
235
|
+
headers: {
|
|
236
|
+
authorization: `Bearer ${e}`,
|
|
237
|
+
accept: "text/event-stream",
|
|
238
|
+
"content-type": "application/json",
|
|
239
|
+
...a(r?.headers)
|
|
240
|
+
},
|
|
241
|
+
body: JSON.stringify(l),
|
|
242
|
+
signal: r?.signal
|
|
243
|
+
});
|
|
244
|
+
if (await r?.onResponse?.({
|
|
245
|
+
status: f.status,
|
|
246
|
+
headers: o(f.headers)
|
|
247
|
+
}, t), !f.ok) throw d(t, c, f, await f.text());
|
|
248
|
+
if (!f.body) throw Error(`${t.provider} response has no body`);
|
|
249
|
+
for await (let e of h(f.body)) {
|
|
250
|
+
let t = s(e);
|
|
251
|
+
if (i.push(t), t.type === "done" || t.type === "error") return;
|
|
252
|
+
}
|
|
253
|
+
throw Error(`${t.provider} stream ended without a terminal event`);
|
|
254
|
+
} catch (e) {
|
|
255
|
+
i.push(_(t, e, r?.signal?.aborted ?? !1));
|
|
256
|
+
}
|
|
257
|
+
})(), i;
|
|
258
|
+
}, b = (e, t, n) => {
|
|
259
|
+
let r = n;
|
|
260
|
+
return y(e, t, {
|
|
261
|
+
...n,
|
|
262
|
+
reasoning: n?.reasoning,
|
|
263
|
+
toolChoice: r?.toolChoice,
|
|
264
|
+
debug: r?.debug
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
//#endregion
|
|
268
|
+
export { s as PiMessagesResponseError, y as stream, b as streamSimple };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
globalThis.process === void 0 && (globalThis.process = {
|
|
2
|
+
env: {},
|
|
3
|
+
platform: "browser",
|
|
4
|
+
version: "",
|
|
5
|
+
versions: {},
|
|
6
|
+
browser: !0,
|
|
7
|
+
nextTick: function(e) {
|
|
8
|
+
return Promise.resolve().then(e);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
//#region ../../../../node_modules/.pnpm/@earendil-works+pi-ai@0.84.2_supports-color@10.2.2_ws@8.21.3_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/utils/pi-user-agent.js
|
|
12
|
+
function e() {
|
|
13
|
+
return typeof process > "u" || !(process.versions?.node || process.versions?.bun) ? null : process.getBuiltinModule?.("node:os") ?? null;
|
|
14
|
+
}
|
|
15
|
+
var t = e();
|
|
16
|
+
function n() {
|
|
17
|
+
return t ? `pi (${t.platform()} ${t.release()}; ${t.arch()})` : "pi (browser)";
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { n as t };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
globalThis.process === void 0 && (globalThis.process = {
|
|
2
|
+
env: {},
|
|
3
|
+
platform: "browser",
|
|
4
|
+
version: "",
|
|
5
|
+
versions: {},
|
|
6
|
+
browser: !0,
|
|
7
|
+
nextTick: function(e) {
|
|
8
|
+
return Promise.resolve().then(e);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
import { t as e } from "./rolldown-runtime-nTTD767F.js";
|
|
12
|
+
//#region __vite-browser-external
|
|
13
|
+
var t = /* @__PURE__ */ e(((e, t) => {
|
|
14
|
+
t.exports = {};
|
|
15
|
+
})), n = null;
|
|
16
|
+
function r(e) {
|
|
17
|
+
if (!(typeof process > "u" || !process.versions?.bun || Object.keys(process.env).length > 0)) {
|
|
18
|
+
if (n === null) {
|
|
19
|
+
n = /* @__PURE__ */ new Map();
|
|
20
|
+
try {
|
|
21
|
+
let { readFileSync: e } = t(), r = e("/proc/self/environ", "utf-8");
|
|
22
|
+
for (let e of r.split("\0")) {
|
|
23
|
+
let t = e.indexOf("=");
|
|
24
|
+
t > 0 && n.set(e.slice(0, t), e.slice(t + 1));
|
|
25
|
+
}
|
|
26
|
+
} catch {}
|
|
27
|
+
}
|
|
28
|
+
return n.get(e);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function i(e, t) {
|
|
32
|
+
return t?.[e] || (typeof process < "u" ? process.env[e] : void 0) || r(e) || void 0;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { i as t };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
globalThis.process === void 0 && (globalThis.process = {
|
|
2
|
+
env: {},
|
|
3
|
+
platform: "browser",
|
|
4
|
+
version: "",
|
|
5
|
+
versions: {},
|
|
6
|
+
browser: !0,
|
|
7
|
+
nextTick: function(e) {
|
|
8
|
+
return Promise.resolve().then(e);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
//#region ../../../../node_modules/.pnpm/@earendil-works+pi-ai@0.84.2_supports-color@10.2.2_ws@8.21.3_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js
|
|
12
|
+
var e = 6e4;
|
|
13
|
+
function t(e) {
|
|
14
|
+
return !(e instanceof Error) || !("status" in e) || !("headers" in e) ? !1 : (e.status === void 0 || typeof e.status == "number") && (e.headers === void 0 || e.headers instanceof Headers);
|
|
15
|
+
}
|
|
16
|
+
function n(e) {
|
|
17
|
+
let t = e.headers?.get("x-should-retry");
|
|
18
|
+
return t === "true" ? !0 : t === "false" ? !1 : e.status === void 0 || e.status === 408 || e.status === 409 || e.status === 429 || typeof e.status == "number" && e.status >= 500;
|
|
19
|
+
}
|
|
20
|
+
function r(t, n, r) {
|
|
21
|
+
let i = n ?? e;
|
|
22
|
+
if (i > 0 && t > i) throw Error(`Server requested ${Math.ceil(t / 1e3)}s retry delay (max: ${Math.ceil(i / 1e3)}s). ${r}`);
|
|
23
|
+
return t;
|
|
24
|
+
}
|
|
25
|
+
function i(e, t, n) {
|
|
26
|
+
let i = e.headers?.get("retry-after-ms");
|
|
27
|
+
if (i) {
|
|
28
|
+
let t = Number.parseFloat(i);
|
|
29
|
+
if (!Number.isNaN(t)) return r(t, n, e.message);
|
|
30
|
+
}
|
|
31
|
+
let a = e.headers?.get("retry-after");
|
|
32
|
+
if (a) {
|
|
33
|
+
let t = Number.parseFloat(a);
|
|
34
|
+
return r(Number.isNaN(t) ? Date.parse(a) - Date.now() : t * 1e3, n, e.message);
|
|
35
|
+
}
|
|
36
|
+
return Math.min(.5 * 2 ** t, 8) * 1e3 * (1 - Math.random() * .25);
|
|
37
|
+
}
|
|
38
|
+
function a() {
|
|
39
|
+
let e = /* @__PURE__ */ Error("Request aborted");
|
|
40
|
+
return e.name = "AbortError", e;
|
|
41
|
+
}
|
|
42
|
+
function o(e, t) {
|
|
43
|
+
return new Promise((n, r) => {
|
|
44
|
+
if (t?.aborted) {
|
|
45
|
+
r(a());
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
let i = () => {
|
|
49
|
+
clearTimeout(o), r(a());
|
|
50
|
+
}, o = setTimeout(() => {
|
|
51
|
+
t?.removeEventListener("abort", i), n();
|
|
52
|
+
}, Math.max(0, e));
|
|
53
|
+
t?.addEventListener("abort", i, { once: !0 });
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async function s(e, r = {}) {
|
|
57
|
+
let s = r.maxRetries ?? 0, c = s;
|
|
58
|
+
for (;;) try {
|
|
59
|
+
return await e();
|
|
60
|
+
} catch (e) {
|
|
61
|
+
if (r.signal?.aborted) throw a();
|
|
62
|
+
if (c <= 0 || !t(e) || !n(e)) throw e;
|
|
63
|
+
let l = s - c;
|
|
64
|
+
c--, await o(i(e, l, r.maxRetryDelayMs), r.signal);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { s as t };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
globalThis.process === void 0 && (globalThis.process = {
|
|
2
|
+
env: {},
|
|
3
|
+
platform: "browser",
|
|
4
|
+
version: "",
|
|
5
|
+
versions: {},
|
|
6
|
+
browser: !0,
|
|
7
|
+
nextTick: function(e) {
|
|
8
|
+
return Promise.resolve().then(e);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
//#region \0rolldown/runtime.js
|
|
12
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t, n) => () => {
|
|
13
|
+
if (n) throw n[0];
|
|
14
|
+
try {
|
|
15
|
+
return e && (t = e(e = 0)), t;
|
|
16
|
+
} catch (e) {
|
|
17
|
+
throw n = [e], e;
|
|
18
|
+
}
|
|
19
|
+
}, s = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), c = (e, n) => {
|
|
20
|
+
let r = {};
|
|
21
|
+
for (var i in e) t(r, i, {
|
|
22
|
+
get: e[i],
|
|
23
|
+
enumerable: !0
|
|
24
|
+
});
|
|
25
|
+
return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
26
|
+
}, l = (e, i, o, s) => {
|
|
27
|
+
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
28
|
+
get: ((e) => i[e]).bind(null, d),
|
|
29
|
+
enumerable: !(s = n(i, d)) || s.enumerable
|
|
30
|
+
});
|
|
31
|
+
return e;
|
|
32
|
+
}, u = (n, r, o) => (o = n == null ? {} : e(i(n)), l(r || !n || !n.__esModule || !a.call(n, "default") ? t(o, "default", {
|
|
33
|
+
value: n,
|
|
34
|
+
enumerable: !0
|
|
35
|
+
}) : o, n)), d = (e) => a.call(e, "module.exports") ? e["module.exports"] : l(t({}, "__esModule", { value: !0 }), e);
|
|
36
|
+
//#endregion
|
|
37
|
+
export { u as a, d as i, o as n, c as r, s as t };
|