@hintergrund/ui 0.1.14 → 0.2.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.
@@ -1,5 +1,5 @@
1
- import { i as T, r as x, m as M, G as S, c as R, a as L, b as _ } from "./google-shared-DwNDktpf.js";
2
- import { v as I, y as G, w as O, x as A } from "./Builder-CeAPIdQ9.js";
1
+ import { i as v, r as I, m as M, G as S, c as R, a as L, b as _ } from "./google-shared-tABuvUYZ.js";
2
+ import { d as x, h as G, e as O, f as A } from "./Builder-RvOmGKW5.js";
3
3
  import { b as N, s as P } from "./transform-messages-CkpQp6fJ.js";
4
4
  typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
5
5
  return Promise.resolve().then(e);
@@ -26,21 +26,21 @@ const f = (e, s, n) => {
26
26
  timestamp: Date.now()
27
27
  };
28
28
  try {
29
- const r = n?.apiKey || I(e.provider) || "", c = W(e, r, n?.headers);
29
+ const r = n?.apiKey || x(e.provider) || "", c = W(e, r, n?.headers);
30
30
  let u = B(e, s, n);
31
31
  const y = await n?.onPayload?.(u, e);
32
32
  y !== void 0 && (u = y);
33
- const v = await c.models.generateContentStream(u);
33
+ const T = await c.models.generateContentStream(u);
34
34
  i.push({ type: "start", partial: t });
35
35
  let a = null;
36
36
  const b = t.content, l = () => b.length - 1;
37
- for await (const g of v) {
37
+ for await (const g of T) {
38
38
  t.responseId ||= g.responseId;
39
39
  const d = g.candidates?.[0];
40
40
  if (d?.content?.parts)
41
41
  for (const o of d.content.parts) {
42
42
  if (o.text !== void 0) {
43
- const h = T(o);
43
+ const h = v(o);
44
44
  (!a || h && a.type !== "thinking" || !h && a.type !== "text") && (a && (a.type === "text" ? i.push({
45
45
  type: "text_end",
46
46
  contentIndex: b.length - 1,
@@ -51,12 +51,12 @@ const f = (e, s, n) => {
51
51
  contentIndex: l(),
52
52
  content: a.thinking,
53
53
  partial: t
54
- })), h ? (a = { type: "thinking", thinking: "", thinkingSignature: void 0 }, t.content.push(a), i.push({ type: "thinking_start", contentIndex: l(), partial: t })) : (a = { type: "text", text: "" }, t.content.push(a), i.push({ type: "text_start", contentIndex: l(), partial: t }))), a.type === "thinking" ? (a.thinking += o.text, a.thinkingSignature = x(a.thinkingSignature, o.thoughtSignature), i.push({
54
+ })), h ? (a = { type: "thinking", thinking: "", thinkingSignature: void 0 }, t.content.push(a), i.push({ type: "thinking_start", contentIndex: l(), partial: t })) : (a = { type: "text", text: "" }, t.content.push(a), i.push({ type: "text_start", contentIndex: l(), partial: t }))), a.type === "thinking" ? (a.thinking += o.text, a.thinkingSignature = I(a.thinkingSignature, o.thoughtSignature), i.push({
55
55
  type: "thinking_delta",
56
56
  contentIndex: l(),
57
57
  delta: o.text,
58
58
  partial: t
59
- })) : (a.text += o.text, a.textSignature = x(a.textSignature, o.thoughtSignature), i.push({
59
+ })) : (a.text += o.text, a.textSignature = I(a.textSignature, o.thoughtSignature), i.push({
60
60
  type: "text_delta",
61
61
  contentIndex: l(),
62
62
  delta: o.text,
@@ -127,7 +127,7 @@ const f = (e, s, n) => {
127
127
  }
128
128
  })(), i;
129
129
  }, z = (e, s, n) => {
130
- const i = n?.apiKey || I(e.provider);
130
+ const i = n?.apiKey || x(e.provider);
131
131
  if (!i)
132
132
  throw new Error(`No API key for provider: ${e.provider}`);
133
133
  const t = N(e, n, i);
@@ -1,4 +1,4 @@
1
- import { z as ii } from "./Builder-CeAPIdQ9.js";
1
+ import { bf as ii } from "./global-JDSIqdYm.js";
2
2
  import { t as ri, s as re } from "./transform-messages-CkpQp6fJ.js";
3
3
  typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(t) {
4
4
  return Promise.resolve().then(t);
@@ -1,5 +1,5 @@
1
- import { i as E, r as x, m as v, G as O, c as w, a as R, b as M, T as h, R as G } from "./google-shared-DwNDktpf.js";
2
- import { y as S, w as N, x as A } from "./Builder-CeAPIdQ9.js";
1
+ import { i as E, r as x, m as v, G as O, c as w, a as R, b as M, T as h, R as G } from "./google-shared-tABuvUYZ.js";
2
+ import { h as S, e as N, f as A } from "./Builder-RvOmGKW5.js";
3
3
  import { b as P, s as U } from "./transform-messages-CkpQp6fJ.js";
4
4
  typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
5
5
  return Promise.resolve().then(e);
@@ -1,4 +1,4 @@
1
- import { D as s } from "./Builder-CeAPIdQ9.js";
1
+ import { i as s } from "./Builder-RvOmGKW5.js";
2
2
  typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
3
3
  return Promise.resolve().then(e);
4
4
  } });
package/dist/login.js CHANGED
@@ -1,98 +1,106 @@
1
- import { Y as F, a6 as G, Z as I, Q as K, ad as t, a7 as u, aa as s, $ as x, a3 as v, a4 as X, a8 as m, a5 as g, ab as $, V as r, ac as i, a0 as q, af as T, ag as Z, a2 as ee, aj as A, ak as W } from "./global-sT-BxRei.js";
2
- import { p as re } from "./props-DkIpnWKa.js";
3
- typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(f) {
4
- return Promise.resolve().then(f);
1
+ import { a2 as G, a3 as I, a4 as K, as as W, Q as Y, Z as r, a7 as l, a8 as o, ad as y, ab as n, ag as ee, X as m, ah as g, au as ae, V as a, aj as i, ae as q, am as E, al as M, a9 as te, aD as re, a6 as se, aa as D, aE as oe, af as J } from "./global-JDSIqdYm.js";
2
+ typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(p) {
3
+ return Promise.resolve().then(p);
5
4
  } });
6
- var ae = g('<div class="flash flash-error mb-3 svelte-uxwqu2"><svg class="octicon svelte-uxwqu2" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M2.343 13.657A8 8 0 1 1 13.658 2.343 8 8 0 0 1 2.343 13.657ZM6.03 4.97a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042L6.94 8 4.97 9.97a.749.749 0 0 0 .326 1.275.749.749 0 0 0 .734-.215L8 9.06l1.97 1.97a.749.749 0 0 0 1.275-.326.749.749 0 0 0-.215-.734L9.06 8l1.97-1.97a.749.749 0 0 0-.326-1.275.749.749 0 0 0-.734.215L8 6.94Z"></path></svg> </div>'), oe = g('<div class="flash flash-success svelte-uxwqu2"><svg class="octicon svelte-uxwqu2" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16Zm3.78-9.72a.751.751 0 0 0-.018-1.042.751.751 0 0 0-1.042-.018L6.75 9.19 5.28 7.72a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042l2 2a.75.75 0 0 0 1.06 0Z"></path></svg> </div>'), te = g('<div class="form-group svelte-uxwqu2"><label for="password" class="svelte-uxwqu2">Password</label> <input type="password" id="password" name="password" class="form-control form-control-lg svelte-uxwqu2" required="" placeholder="••••••••"/></div>'), se = g('<div class="Box svelte-uxwqu2"><div class="Box-body svelte-uxwqu2"><form autocomplete="off"><div class="form-group svelte-uxwqu2"><label for="email" class="svelte-uxwqu2">Email</label> <input type="email" id="email" name="email" class="form-control form-control-lg svelte-uxwqu2" required="" placeholder="you@example.com"/></div> <!> <button type="submit" class="btn btn-primary btn-block btn-lg svelte-uxwqu2"><!></button></form></div></div>'), ie = g('<main class="auth-wrapper svelte-uxwqu2"><div class="auth-container svelte-uxwqu2"><div class="auth-header svelte-uxwqu2"><svg class="auth-logo svelte-uxwqu2" viewBox="0 0 90 90" width="48" height="48" fill="currentColor"><rect x="12" y="12" width="66" height="66" fill="currentColor"></rect></svg> <h1 class="svelte-uxwqu2">Sign in to Hintergrund</h1></div> <!> <!></div></main>');
7
- const le = {
5
+ var ie = g('<div class="flash flash-error"><svg class="octicon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M2.343 13.657A8 8 0 1 1 13.658 2.343 8 8 0 0 1 2.343 13.657ZM6.03 4.97a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042L6.94 8 4.97 9.97a.749.749 0 0 0 .326 1.275.749.749 0 0 0 .734-.215L8 9.06l1.97 1.97a.749.749 0 0 0 1.275-.326.749.749 0 0 0-.215-.734L9.06 8l1.97-1.97a.749.749 0 0 0-.326-1.275.749.749 0 0 0-.734.215L8 6.94Z"></path></svg> </div>'), le = g('<div class="flash flash-success"><svg class="octicon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16Zm3.78-9.72a.751.751 0 0 0-.018-1.042.751.751 0 0 0-1.042-.018L6.75 9.19 5.28 7.72a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042l2 2a.75.75 0 0 0 1.06 0Z"></path></svg> </div>'), ne = g('<div class="form-group"><label for="password">Password</label> <input type="password" id="password" name="password" class="form-control form-control-lg" required="" placeholder="••••••••"/></div>'), de = g('<div class="Box"><div class="Box-body"><form autocomplete="off"><div class="form-group"><label for="email">Email</label> <input type="email" id="email" name="email" class="form-control form-control-lg" required="" placeholder="you@example.com"/></div> <!> <!></form></div></div>'), ve = g('<main class="auth-wrapper svelte-uxwqu2"><div class="auth-container svelte-uxwqu2"><div class="auth-header svelte-uxwqu2"><svg class="auth-logo svelte-uxwqu2" viewBox="0 0 90 90" width="48" height="48" fill="currentColor"><rect x="12" y="12" width="66" height="66" fill="currentColor"></rect></svg> <h1 class="svelte-uxwqu2">Sign in to Hintergrund</h1></div> <!> <!></div></main>');
6
+ const ue = {
8
7
  hash: "svelte-uxwqu2",
9
- code: `.auth-wrapper.svelte-uxwqu2 {min-height:100vh;display:flex;align-items:center;justify-content:center;background-color:var(--bgColor-muted);padding:var(--base-size-24);}.auth-container.svelte-uxwqu2 {width:100%;max-width:340px;}.auth-header.svelte-uxwqu2 {text-align:center;margin-bottom:var(--base-size-24);}.auth-logo.svelte-uxwqu2 {color:var(--fgColor-default);margin-bottom:var(--base-size-16);}.auth-header.svelte-uxwqu2 h1:where(.svelte-uxwqu2) {font-size:var(--text-title-size-medium);font-weight:var(--base-text-weight-light);color:var(--fgColor-default);margin:0;}.Box.svelte-uxwqu2 {background-color:var(--bgColor-default);border:var(--borderWidth-thin) solid var(--borderColor-default);border-radius:var(--borderRadius-medium);}.Box-body.svelte-uxwqu2 {padding:var(--base-size-16);}.flash.svelte-uxwqu2 {display:flex;align-items:flex-start;gap:var(--base-size-8);padding:var(--base-size-16);margin-bottom:var(--base-size-16);border:var(--borderWidth-thin) solid;border-radius:var(--borderRadius-medium);font-size:var(--text-body-size-medium);line-height:var(--text-body-lineHeight-medium);}.flash-error.svelte-uxwqu2 {color:var(--fgColor-danger);background-color:var(--bgColor-danger-muted);border-color:var(--borderColor-danger-muted);}.flash-success.svelte-uxwqu2 {color:var(--fgColor-success, #1a7f37);background-color:var(--bgColor-success-muted, #dafbe1);border-color:var(--borderColor-success-muted, #aceebb);}.flash.svelte-uxwqu2 .octicon:where(.svelte-uxwqu2) {flex-shrink:0;margin-top:2px;}.form-group.svelte-uxwqu2 {margin-bottom:var(--base-size-16);}.form-group.svelte-uxwqu2 label:where(.svelte-uxwqu2) {display:block;margin-bottom:var(--base-size-8);font-weight:var(--base-text-weight-semibold);font-size:var(--text-body-size-medium);color:var(--fgColor-default);}.form-control.svelte-uxwqu2 {display:block;width:100%;padding:var(--base-size-8) var(--base-size-12);font-size:var(--text-body-size-medium);line-height:1.5;color:var(--fgColor-default);background-color:var(--bgColor-default);border:var(--borderWidth-thin) solid var(--borderColor-default);border-radius:var(--borderRadius-medium);outline:none;box-shadow:var(--shadow-inset);transition:border-color 0.2s ease,
10
- box-shadow 0.2s ease;}.form-control.svelte-uxwqu2:focus {border-color:var(--borderColor-accent-emphasis);outline:2px solid var(--borderColor-accent-emphasis);outline-offset:-1px;box-shadow:none;}.form-control-lg.svelte-uxwqu2 {padding:var(--base-size-12) var(--base-size-12);font-size:var(--text-body-size-large);}.btn.svelte-uxwqu2 {display:inline-flex;align-items:center;justify-content:center;padding:var(--base-size-8) var(--base-size-16);font-size:var(--text-body-size-medium);font-weight:var(--base-text-weight-medium);line-height:1.5;white-space:nowrap;vertical-align:middle;cursor:pointer;user-select:none;border:var(--borderWidth-thin) solid transparent;border-radius:var(--borderRadius-medium);transition:background-color 0.2s ease,
11
- border-color 0.2s ease;}.btn.svelte-uxwqu2:disabled {cursor:not-allowed;opacity:0.5;}.btn-primary.svelte-uxwqu2 {color:var(--button-primary-fgColor-rest);background-color:var(--button-primary-bgColor-rest);border-color:var(--button-primary-borderColor-rest);}.btn-primary.svelte-uxwqu2:hover:not(:disabled) {background-color:var(--button-primary-bgColor-hover);}.btn-primary.svelte-uxwqu2:active:not(:disabled) {background-color:var(--button-primary-bgColor-active);}.btn-block.svelte-uxwqu2 {display:flex;width:100%;}.btn-lg.svelte-uxwqu2 {padding:var(--base-size-12) var(--base-size-24);}.mb-3.svelte-uxwqu2 {margin-bottom:var(--base-size-16);}`
8
+ code: ".auth-wrapper.svelte-uxwqu2 {min-height:100vh;display:flex;align-items:center;justify-content:center;background-color:var(--bgColor-muted);padding:var(--base-size-24);}.auth-container.svelte-uxwqu2 {width:100%;max-width:340px;}.auth-header.svelte-uxwqu2 {text-align:center;margin-bottom:var(--base-size-24);}.auth-logo.svelte-uxwqu2 {color:var(--fgColor-default);margin-bottom:var(--base-size-16);}.auth-header.svelte-uxwqu2 h1:where(.svelte-uxwqu2) {font-size:var(--text-title-size-medium);font-weight:var(--base-text-weight-light);color:var(--fgColor-default);margin:0;}"
12
9
  };
13
- function ue(f, B) {
14
- G(B, !0), I(f, le);
15
- let L = re(B, "config", 7), w = m(!1), y = m(""), h = m(""), c = m(""), p = m(""), b = m(!1);
16
- K(() => {
10
+ function ce(p, B) {
11
+ I(B, !0), K(p, ue);
12
+ let T = W(B, "config", 7), w = m(!1), P = m(""), x = m(""), u = m(""), _ = m(""), c = m(!1);
13
+ Y(() => {
17
14
  const e = new URLSearchParams(window.location.search).get("error");
18
- e && (t(c, e, !0), window.history.replaceState({}, "", window.location.pathname));
15
+ e && (r(u, e, !0), window.history.replaceState({}, "", window.location.pathname));
19
16
  });
20
- async function E(a) {
21
- a.preventDefault(), t(c, ""), t(p, ""), t(b, !0);
17
+ async function O(t) {
18
+ t.preventDefault(), r(u, ""), r(_, ""), r(c, !0);
22
19
  try {
23
20
  const e = {};
24
- r(h) && (e.email = r(h)), r(w) && (e.password = r(y));
25
- const l = await (await fetch("/api/admin/login", {
21
+ a(x) && (e.email = a(x)), a(w) && (e.password = a(P));
22
+ const s = await (await fetch("/api/admin/login", {
26
23
  method: "POST",
27
24
  headers: { "Content-Type": "application/json" },
28
25
  body: JSON.stringify(e)
29
26
  })).json();
30
- l.success ? l.requirePassword ? t(w, !0) : l.emailSent ? t(p, l.message || "Check your email for the login link.", !0) : window.location.href = "/admin" : t(c, l.message ?? "An error occurred. Please try again.", !0);
27
+ s.success ? s.requirePassword ? r(w, !0) : s.emailSent ? r(_, s.message || "Check your email for the login link.", !0) : window.location.href = "/admin" : r(u, s.message ?? "An error occurred. Please try again.", !0);
31
28
  } catch {
32
- t(c, "An error occurred. Please try again.");
29
+ r(u, "An error occurred. Please try again.");
33
30
  } finally {
34
- t(b, !1);
31
+ r(c, !1);
35
32
  }
36
33
  }
37
- var M = {
34
+ var U = {
38
35
  get config() {
39
- return L();
36
+ return T();
40
37
  },
41
- set config(a) {
42
- L(a), $();
38
+ set config(t) {
39
+ T(t), ae();
43
40
  }
44
- }, z = ie(), S = s(z), j = u(s(S), 2);
41
+ }, C = ve(), Z = o(C), j = l(o(Z), 2);
45
42
  {
46
- var H = (a) => {
47
- var e = ae(), n = u(s(e));
48
- i(e), q(() => T(n, ` ${r(c) ?? ""}`)), v(a, e);
43
+ var $ = (t) => {
44
+ var e = ie(), d = l(o(e));
45
+ i(e), q(() => E(d, ` ${a(u) ?? ""}`)), n(t, e);
49
46
  };
50
- x(j, (a) => {
51
- r(c) && a(H);
47
+ y(j, (t) => {
48
+ a(u) && t($);
52
49
  });
53
50
  }
54
- var J = u(j, 2);
51
+ var H = l(j, 2);
55
52
  {
56
- var O = (a) => {
57
- var e = oe(), n = u(s(e));
58
- i(e), q(() => T(n, ` ${r(p) ?? ""}`)), v(a, e);
59
- }, U = (a) => {
60
- var e = se(), n = s(e), l = s(n), _ = s(l), C = u(s(_), 2);
61
- Z(C), i(_);
62
- var R = u(_, 2);
53
+ var N = (t) => {
54
+ var e = le(), d = l(o(e));
55
+ i(e), q(() => E(d, ` ${a(_) ?? ""}`)), n(t, e);
56
+ }, Q = (t) => {
57
+ var e = de(), d = o(e), s = o(d), L = o(s), S = l(o(L), 2);
58
+ M(S), i(L);
59
+ var A = l(L, 2);
63
60
  {
64
- var D = (o) => {
65
- var d = te(), P = u(s(d), 2);
66
- Z(P), i(d), q(() => P.disabled = r(b)), A(P, () => r(y), (Y) => t(y, Y)), v(o, d);
61
+ var R = (v) => {
62
+ var b = ne(), f = l(o(b), 2);
63
+ M(f), i(b), q(() => f.disabled = a(c)), J(f, () => a(P), (k) => r(P, k)), n(v, b);
67
64
  };
68
- x(R, (o) => {
69
- r(w) && o(D);
65
+ y(A, (v) => {
66
+ a(w) && v(R);
70
67
  });
71
68
  }
72
- var k = u(R, 2), N = s(k);
73
- {
74
- var Q = (o) => {
75
- var d = W("Please wait...");
76
- v(o, d);
77
- }, V = (o) => {
78
- var d = W("Continue");
79
- v(o, d);
80
- };
81
- x(N, (o) => {
82
- r(b) ? o(Q) : o(V, -1);
83
- });
84
- }
85
- i(k), i(l), i(n), i(e), q(() => {
86
- C.disabled = r(b) || r(w), k.disabled = r(b);
87
- }), ee("submit", l, E), A(C, () => r(h), (o) => t(h, o)), v(a, e);
69
+ var V = l(A, 2);
70
+ te(V, {
71
+ type: "submit",
72
+ variant: "primary",
73
+ size: "large",
74
+ block: !0,
75
+ get disabled() {
76
+ return a(c);
77
+ },
78
+ children: (v, b) => {
79
+ var f = re(), k = se(f);
80
+ {
81
+ var X = (h) => {
82
+ var z = D("Please wait...");
83
+ n(h, z);
84
+ }, F = (h) => {
85
+ var z = D("Continue");
86
+ n(h, z);
87
+ };
88
+ y(k, (h) => {
89
+ a(c) ? h(X) : h(F, -1);
90
+ });
91
+ }
92
+ n(v, f);
93
+ },
94
+ $$slots: { default: !0 }
95
+ }), i(s), i(d), i(e), q(() => S.disabled = a(c) || a(w)), oe("submit", s, O), J(S, () => a(x), (v) => r(x, v)), n(t, e);
88
96
  };
89
- x(J, (a) => {
90
- r(p) ? a(O) : a(U, -1);
97
+ y(H, (t) => {
98
+ a(_) ? t(N) : t(Q, -1);
91
99
  });
92
100
  }
93
- return i(S), i(z), v(f, z), X(M);
101
+ return i(Z), i(C), n(p, C), ee(U);
94
102
  }
95
- customElements.define("hintergrund-login", F(ue, { config: {} }, [], []));
103
+ customElements.define("hintergrund-login", G(ce, { config: {} }, [], []));
96
104
  export {
97
- ue as default
105
+ ce as default
98
106
  };
@@ -1,6 +1,6 @@
1
- import { v as Cn, y as Vu, w as Gu, x as Ju } from "./Builder-CeAPIdQ9.js";
1
+ import { d as Cn, h as Vu, e as Gu, f as Ju } from "./Builder-RvOmGKW5.js";
2
2
  import { s as Bu } from "./hash-DFlR084x.js";
3
- import { p as Ir } from "./json-parse-B4gFxgnW.js";
3
+ import { p as Ir } from "./json-parse-Didq-LlA.js";
4
4
  import { b as Yu, t as Qu, s as We } from "./transform-messages-CkpQp6fJ.js";
5
5
  typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
6
6
  return Promise.resolve().then(e);
@@ -1,6 +1,6 @@
1
- import { v as P, y as Z, w as ee } from "./Builder-CeAPIdQ9.js";
1
+ import { d as P, h as Z, e as ee } from "./Builder-RvOmGKW5.js";
2
2
  import { h as N } from "./headers-u7rXGJ9f.js";
3
- import { c as $, a as te, p as F } from "./openai-responses-shared-x2D0MKUa.js";
3
+ import { c as $, a as te, p as F } from "./openai-responses-shared-qXvKLxLt.js";
4
4
  import { b as re } from "./transform-messages-CkpQp6fJ.js";
5
5
  typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
6
6
  return Promise.resolve().then(e);
@@ -36,7 +36,7 @@ const ie = (e) => import(e), ce = "node:os";
36
36
  typeof process < "u" && (process.versions?.node || process.versions?.bun) && ie(ce).then((e) => {
37
37
  S = e;
38
38
  });
39
- const ue = "https://chatgpt.com/backend-api", le = "https://api.openai.com/auth", R = 3, A = 1e3, J = /* @__PURE__ */ new Set(["openai", "openai-codex", "opencode"]), de = 1009, fe = /* @__PURE__ */ new Set([
39
+ const ue = "https://chatgpt.com/backend-api", de = "https://api.openai.com/auth", R = 3, A = 1e3, J = /* @__PURE__ */ new Set(["openai", "openai-codex", "opencode"]), le = 1009, fe = /* @__PURE__ */ new Set([
40
40
  "completed",
41
41
  "incomplete",
42
42
  "failed",
@@ -87,7 +87,7 @@ const ye = (e, r, t) => {
87
87
  let a = we(e, r, t);
88
88
  const c = await t?.onPayload?.(a, e);
89
89
  c !== void 0 && (a = c);
90
- const l = t?.sessionId || $e(), h = Fe(e.headers, t?.headers, i, n, t?.sessionId), g = Je(e.headers, t?.headers, i, n, l), d = JSON.stringify(a), b = t?.transport || "auto", f = b !== "sse" && z(t?.sessionId);
90
+ const d = t?.sessionId || $e(), h = Fe(e.headers, t?.headers, i, n, t?.sessionId), g = Je(e.headers, t?.headers, i, n, d), l = JSON.stringify(a), b = t?.transport || "auto", f = b !== "sse" && z(t?.sessionId);
91
91
  if (f && B(t?.sessionId), b !== "sse" && !f) {
92
92
  let w = !1;
93
93
  try {
@@ -107,7 +107,7 @@ const ye = (e, r, t) => {
107
107
  fallbackTransport: w ? void 0 : "sse",
108
108
  eventsEmitted: w,
109
109
  phase: w ? "after_message_stream_start" : "before_message_stream_start",
110
- requestBytes: new TextEncoder().encode(d).byteLength
110
+ requestBytes: new TextEncoder().encode(l).byteLength
111
111
  })), Re(t?.sessionId, p), w))
112
112
  throw p;
113
113
  B(t?.sessionId);
@@ -121,7 +121,7 @@ const ye = (e, r, t) => {
121
121
  if (u = await fetch(K(e.baseUrl), {
122
122
  method: "POST",
123
123
  headers: h,
124
- body: d,
124
+ body: l,
125
125
  signal: t?.signal
126
126
  }), await t?.onResponse?.({ status: u.status, headers: N(u.headers) }, e), u.ok)
127
127
  break;
@@ -288,17 +288,17 @@ async function* Se(e) {
288
288
  const a = s.slice(0, i);
289
289
  s = s.slice(i + 2);
290
290
  const c = a.split(`
291
- `).filter((l) => l.startsWith("data:")).map((l) => l.slice(5).trim());
291
+ `).filter((d) => d.startsWith("data:")).map((d) => d.slice(5).trim());
292
292
  if (c.length > 0) {
293
- const l = c.join(`
293
+ const d = c.join(`
294
294
  `).trim();
295
- if (l && l !== "[DONE]")
295
+ if (d && d !== "[DONE]")
296
296
  try {
297
- yield JSON.parse(l);
297
+ yield JSON.parse(d);
298
298
  } catch (h) {
299
299
  throw new C(`Invalid Codex SSE JSON: ${_(h)}`, {
300
300
  cause: h,
301
- payload: l
301
+ payload: d
302
302
  });
303
303
  }
304
304
  }
@@ -408,7 +408,7 @@ async function T(e, r, t) {
408
408
  i(f instanceof Error ? f : new Error(String(f)));
409
409
  return;
410
410
  }
411
- const l = () => {
411
+ const d = () => {
412
412
  a || (a = !0, b(), n(c));
413
413
  }, h = (f) => {
414
414
  const u = X(f);
@@ -416,12 +416,12 @@ async function T(e, r, t) {
416
416
  }, g = (f) => {
417
417
  const u = G(f);
418
418
  a || (a = !0, b(), i(u));
419
- }, d = () => {
419
+ }, l = () => {
420
420
  a || (a = !0, b(), c.close(1e3, "aborted"), i(new Error("Request was aborted")));
421
421
  }, b = () => {
422
- c.removeEventListener("open", l), c.removeEventListener("error", h), c.removeEventListener("close", g), t?.removeEventListener("abort", d);
422
+ c.removeEventListener("open", d), c.removeEventListener("error", h), c.removeEventListener("close", g), t?.removeEventListener("abort", l);
423
423
  };
424
- c.addEventListener("open", l), c.addEventListener("error", h), c.addEventListener("close", g), t?.addEventListener("abort", d);
424
+ c.addEventListener("open", d), c.addEventListener("error", h), c.addEventListener("close", g), t?.addEventListener("abort", l);
425
425
  });
426
426
  }
427
427
  async function Oe(e, r, t, s) {
@@ -500,7 +500,7 @@ function G(e) {
500
500
  if (e && typeof e == "object") {
501
501
  const r = "code" in e ? e.code : void 0, t = "reason" in e ? e.reason : void 0, s = "wasClean" in e ? e.wasClean : void 0, o = typeof r == "number" ? ` ${r}` : "";
502
502
  let n = typeof t == "string" && t.length > 0 ? ` ${t}` : "";
503
- return !n && r === de && (n = " message too big"), new xe(`WebSocket closed${o}${n}`.trim(), {
503
+ return !n && r === le && (n = " message too big"), new xe(`WebSocket closed${o}${n}`.trim(), {
504
504
  code: typeof r == "number" ? r : void 0,
505
505
  reason: typeof t == "string" && t.length > 0 ? t : void 0,
506
506
  wasClean: typeof s == "boolean" ? s : void 0
@@ -529,13 +529,13 @@ async function* We(e, r) {
529
529
  const a = () => {
530
530
  if (!s)
531
531
  return;
532
- const d = s;
533
- s = null, d();
534
- }, c = (d) => {
532
+ const l = s;
533
+ s = null, l();
534
+ }, c = (l) => {
535
535
  (async () => {
536
536
  let b = null;
537
537
  try {
538
- if (!d || typeof d != "object" || !("data" in d) || (b = await Ie(d.data), !b))
538
+ if (!l || typeof l != "object" || !("data" in l) || (b = await Ie(l.data), !b))
539
539
  return;
540
540
  const f = JSON.parse(b), u = typeof f.type == "string" ? f.type : "";
541
541
  (u === "response.completed" || u === "response.done" || u === "response.incomplete") && (i = !0, o = !0), t.push(f), a();
@@ -546,18 +546,18 @@ async function* We(e, r) {
546
546
  }), o = !0, a();
547
547
  }
548
548
  })();
549
- }, l = (d) => {
550
- n = X(d), o = !0, a();
551
- }, h = (d) => {
549
+ }, d = (l) => {
550
+ n = X(l), o = !0, a();
551
+ }, h = (l) => {
552
552
  if (i) {
553
553
  o = !0, a();
554
554
  return;
555
555
  }
556
- n || (n = G(d)), o = !0, a();
556
+ n || (n = G(l)), o = !0, a();
557
557
  }, g = () => {
558
558
  n = new Error("Request was aborted"), o = !0, a();
559
559
  };
560
- e.addEventListener("message", c), e.addEventListener("error", l), e.addEventListener("close", h), r?.addEventListener("abort", g);
560
+ e.addEventListener("message", c), e.addEventListener("error", d), e.addEventListener("close", h), r?.addEventListener("abort", g);
561
561
  try {
562
562
  for (; ; ) {
563
563
  if (r?.aborted)
@@ -568,8 +568,8 @@ async function* We(e, r) {
568
568
  }
569
569
  if (o)
570
570
  break;
571
- await new Promise((d) => {
572
- s = d;
571
+ await new Promise((l) => {
572
+ s = l;
573
573
  });
574
574
  }
575
575
  if (n)
@@ -577,7 +577,7 @@ async function* We(e, r) {
577
577
  if (!i)
578
578
  throw new Error("WebSocket stream closed before response.completed");
579
579
  } finally {
580
- e.removeEventListener("message", c), e.removeEventListener("error", l), e.removeEventListener("close", h), r?.removeEventListener("abort", g);
580
+ e.removeEventListener("message", c), e.removeEventListener("error", d), e.removeEventListener("close", h), r?.removeEventListener("abort", g);
581
581
  }
582
582
  }
583
583
  function M(e) {
@@ -617,9 +617,9 @@ async function* De(e, r, t, s) {
617
617
  o || (o = !0, s(), t.push({ type: "start", partial: r })), yield n;
618
618
  }
619
619
  async function Me(e, r, t, s, o, n, i, a) {
620
- const { socket: c, entry: l, reused: h, release: g } = await Oe(e, t, a?.sessionId, a?.signal);
621
- let d = !0;
622
- const b = a?.transport === "websocket-cached" || a?.transport === "auto", f = r, u = b && l ? Be(l, f) : f, y = a?.sessionId ? O(a.sessionId) : void 0;
620
+ const { socket: c, entry: d, reused: h, release: g } = await Oe(e, t, a?.sessionId, a?.signal);
621
+ let l = !0;
622
+ const b = a?.transport === "websocket-cached" || a?.transport === "auto", f = r, u = b && d ? Be(d, f) : f, y = a?.sessionId ? O(a.sessionId) : void 0;
623
623
  y && (y.requests++, h ? y.connectionsReused++ : y.connectionsCreated++, b && y.cachedContextRequests++, u.store === !0 && y.storeTrueRequests++, y.lastInputItems = u.input?.length ?? 0, u.previous_response_id ? (y.deltaRequests++, y.lastDeltaInputItems = u.input?.length ?? 0, y.lastPreviousResponseId = u.previous_response_id) : (y.fullContextRequests++, y.lastDeltaInputItems = void 0, y.lastPreviousResponseId = void 0));
624
624
  try {
625
625
  if (c.send(JSON.stringify({ type: "response.create", ...u })), await F(De(V(We(c, a?.signal)), s, o, i), s, o, n, {
@@ -627,21 +627,21 @@ async function Me(e, r, t, s, o, n, i, a) {
627
627
  resolveServiceTier: H,
628
628
  applyServiceTierPricing: (w, p) => U(w, p, n)
629
629
  }), a?.signal?.aborted)
630
- d = !1;
631
- else if (b && l && s.responseId) {
630
+ l = !1;
631
+ else if (b && d && s.responseId) {
632
632
  const w = $(n, { messages: [s] }, J, {
633
633
  includeSystemPrompt: !1
634
634
  }).filter((p) => p.type !== "function_call_output");
635
- l.continuation = {
635
+ d.continuation = {
636
636
  lastRequestBody: f,
637
637
  lastResponseId: s.responseId,
638
638
  lastResponseItems: w
639
639
  };
640
640
  }
641
641
  } catch (w) {
642
- throw l && (l.continuation = void 0), d = !1, w;
642
+ throw d && (d.continuation = void 0), l = !1, w;
643
643
  } finally {
644
- g({ keep: d });
644
+ g({ keep: l });
645
645
  }
646
646
  }
647
647
  async function Pe(e) {
@@ -652,8 +652,8 @@ async function Pe(e) {
652
652
  if (n) {
653
653
  const i = n.code || n.type || "";
654
654
  if (/usage_limit_reached|usage_not_included|rate_limit_exceeded/i.test(i) || e.status === 429) {
655
- const a = n.plan_type ? ` (${n.plan_type.toLowerCase()} plan)` : "", c = n.resets_at ? Math.max(0, Math.round((n.resets_at * 1e3 - Date.now()) / 6e4)) : void 0, l = c !== void 0 ? ` Try again in ~${c} min.` : "";
656
- s = `You have hit your ChatGPT usage limit${a}.${l}`.trim();
655
+ const a = n.plan_type ? ` (${n.plan_type.toLowerCase()} plan)` : "", c = n.resets_at ? Math.max(0, Math.round((n.resets_at * 1e3 - Date.now()) / 6e4)) : void 0, d = c !== void 0 ? ` Try again in ~${c} min.` : "";
656
+ s = `You have hit your ChatGPT usage limit${a}.${d}`.trim();
657
657
  }
658
658
  t = n.message || s || t;
659
659
  }
@@ -666,7 +666,7 @@ function Ne(e) {
666
666
  const r = e.split(".");
667
667
  if (r.length !== 3)
668
668
  throw new Error("Invalid token");
669
- const s = JSON.parse(atob(r[1]))?.[le]?.chatgpt_account_id;
669
+ const s = JSON.parse(atob(r[1]))?.[de]?.chatgpt_account_id;
670
670
  if (!s)
671
671
  throw new Error("No account ID in token");
672
672
  return s;
@@ -1,7 +1,7 @@
1
1
  import { O as H } from "./client-Sh7wNjbG.js";
2
- import { v as F, y as j, w as G, x as $ } from "./Builder-CeAPIdQ9.js";
2
+ import { d as F, h as j, e as G, f as $ } from "./Builder-RvOmGKW5.js";
3
3
  import { h as W } from "./headers-u7rXGJ9f.js";
4
- import { p as q } from "./json-parse-B4gFxgnW.js";
4
+ import { p as q } from "./json-parse-Didq-LlA.js";
5
5
  import { b as J, t as K, s as A } from "./transform-messages-CkpQp6fJ.js";
6
6
  import { h as Y, b as V, i as Z, r as Q } from "./github-copilot-headers-DWh_6bE3.js";
7
7
  typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
@@ -60,7 +60,7 @@ const se = (e, n, t) => {
60
60
  }, { data: T, response: R } = await p.chat.completions.create(d, _).withResponse();
61
61
  await t?.onResponse?.({ status: R.status, headers: W(R.headers) }, e), s.push({ type: "start", partial: o });
62
62
  let x = null, c = null;
63
- const k = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), v = o.content, C = (a) => v.indexOf(a), L = (a) => {
63
+ const k = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), v = o.content, C = (a) => v.indexOf(a), L = (a) => {
64
64
  const f = C(a);
65
65
  f !== -1 && (a.type === "text" ? s.push({
66
66
  type: "text_end",
@@ -85,18 +85,18 @@ const se = (e, n, t) => {
85
85
  }, v.push(c), s.push({ type: "thinking_start", contentIndex: C(c), partial: o })), c), U = (a) => {
86
86
  const f = typeof a.index == "number" ? a.index : void 0;
87
87
  let h = f !== void 0 ? k.get(f) : void 0;
88
- return !h && a.id && (h = I.get(a.id)), h || (h = {
88
+ return !h && a.id && (h = w.get(a.id)), h || (h = {
89
89
  type: "toolCall",
90
90
  id: a.id || "",
91
91
  name: a.function?.name || "",
92
92
  arguments: {},
93
93
  partialArgs: "",
94
94
  streamIndex: f
95
- }, f !== void 0 && k.set(f, h), a.id && I.set(a.id, h), v.push(h), s.push({
95
+ }, f !== void 0 && k.set(f, h), a.id && w.set(a.id, h), v.push(h), s.push({
96
96
  type: "toolcall_start",
97
97
  contentIndex: C(h),
98
98
  partial: o
99
- })), f !== void 0 && h.streamIndex === void 0 && (h.streamIndex = f, k.set(f, h)), a.id && I.set(a.id, h), h;
99
+ })), f !== void 0 && h.streamIndex === void 0 && (h.streamIndex = f, k.set(f, h)), a.id && w.set(a.id, h), h;
100
100
  };
101
101
  for await (const a of T) {
102
102
  if (!a || typeof a != "object")
@@ -142,12 +142,12 @@ const se = (e, n, t) => {
142
142
  if (f?.delta?.tool_calls)
143
143
  for (const g of f.delta.tool_calls) {
144
144
  const m = U(g);
145
- !m.id && g.id && (m.id = g.id, I.set(g.id, m)), !m.name && g.function?.name && (m.name = g.function.name);
146
- let w = "";
147
- g.function?.arguments && (w = g.function.arguments, m.partialArgs = (m.partialArgs ?? "") + g.function.arguments, m.arguments = q(m.partialArgs)), s.push({
145
+ !m.id && g.id && (m.id = g.id, w.set(g.id, m)), !m.name && g.function?.name && (m.name = g.function.name);
146
+ let I = "";
147
+ g.function?.arguments && (I = g.function.arguments, m.partialArgs = (m.partialArgs ?? "") + g.function.arguments, m.arguments = q(m.partialArgs)), s.push({
148
148
  type: "toolcall_delta",
149
149
  contentIndex: C(m),
150
- delta: w,
150
+ delta: I,
151
151
  partial: o
152
152
  });
153
153
  }
@@ -155,7 +155,7 @@ const se = (e, n, t) => {
155
155
  if (S && Array.isArray(S)) {
156
156
  for (const g of S)
157
157
  if (g.type === "reasoning.encrypted" && g.id && g.data) {
158
- const m = o.content.find((w) => w.type === "toolCall" && w.id === g.id);
158
+ const m = o.content.find((I) => I.type === "toolCall" && I.id === g.id);
159
159
  m && (m.thoughtSignature = JSON.stringify(g));
160
160
  }
161
161
  }
@@ -1,8 +1,8 @@
1
1
  import { O as w } from "./client-Sh7wNjbG.js";
2
- import { v as d, y, w as E } from "./Builder-CeAPIdQ9.js";
2
+ import { d, h as y, e as E } from "./Builder-RvOmGKW5.js";
3
3
  import { h as b } from "./headers-u7rXGJ9f.js";
4
4
  import { h as I, b as A, i as _, r as P } from "./github-copilot-headers-DWh_6bE3.js";
5
- import { p as T, c as O, a as S } from "./openai-responses-shared-x2D0MKUa.js";
5
+ import { p as T, c as O, a as S } from "./openai-responses-shared-qXvKLxLt.js";
6
6
  import { b as C } from "./transform-messages-CkpQp6fJ.js";
7
7
  typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(e) {
8
8
  return Promise.resolve().then(e);
@@ -1,6 +1,6 @@
1
- import { x as S } from "./Builder-CeAPIdQ9.js";
1
+ import { f as S } from "./Builder-RvOmGKW5.js";
2
2
  import { s as v } from "./hash-DFlR084x.js";
3
- import { p as x } from "./json-parse-B4gFxgnW.js";
3
+ import { p as x } from "./json-parse-Didq-LlA.js";
4
4
  import { t as T, s as _ } from "./transform-messages-CkpQp6fJ.js";
5
5
  typeof globalThis.process > "u" && (globalThis.process = { env: {}, platform: "browser", version: "", versions: {}, browser: !0, nextTick: function(r) {
6
6
  return Promise.resolve().then(r);