swerasty_editor 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/swerasty-editor.js +348 -270
- package/dist/swerasty-editor.umd.cjs +69 -39
- package/package.json +1 -1
package/dist/swerasty-editor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as g, jsxs as N } from "react/jsx-runtime";
|
|
2
|
-
import oo, { forwardRef as
|
|
3
|
-
const so =
|
|
4
|
-
const n =
|
|
2
|
+
import oo, { forwardRef as be, useRef as j, useState as V, useCallback as Ce, useEffect as pe, useImperativeHandle as io, createElement as Ye, useMemo as ni } from "react";
|
|
3
|
+
const so = be(({ onHistoryChange: t }, e) => {
|
|
4
|
+
const n = j(null), o = j(null), [s, l] = V(!1), [a, u] = V(!1), c = j(null), [d, f] = V([]), [p, h] = V(-1), m = Ce(() => {
|
|
5
5
|
const _ = n.current, v = c.current;
|
|
6
6
|
if (!_ || !v || _.width === 0 || _.height === 0) return;
|
|
7
7
|
const I = v.getImageData(0, 0, _.width, _.height), x = d.slice(0, p + 1);
|
|
@@ -21,10 +21,10 @@ const so = Ue(({ onHistoryChange: t }, e) => {
|
|
|
21
21
|
var P;
|
|
22
22
|
const { width: M, height: R } = x[0].contentRect;
|
|
23
23
|
if (M === 0 || R === 0) return;
|
|
24
|
-
let
|
|
25
|
-
_.width > 0 && _.height > 0 && (
|
|
24
|
+
let U = null;
|
|
25
|
+
_.width > 0 && _.height > 0 && (U = ((P = c.current) == null ? void 0 : P.getImageData(0, 0, _.width, _.height)) || null), _.width = M, _.height = R;
|
|
26
26
|
const A = c.current;
|
|
27
|
-
if (A && (A.lineCap = "round", A.strokeStyle = "#000", A.lineWidth = 2,
|
|
27
|
+
if (A && (A.lineCap = "round", A.strokeStyle = "#000", A.lineWidth = 2, U && A.putImageData(U, 0, 0)), d.length === 0) {
|
|
28
28
|
const L = A == null ? void 0 : A.getImageData(0, 0, M, R);
|
|
29
29
|
L && (f([L]), h(0));
|
|
30
30
|
}
|
|
@@ -87,18 +87,18 @@ const so = Ue(({ onHistoryChange: t }, e) => {
|
|
|
87
87
|
const _ = n.current, v = c.current;
|
|
88
88
|
if (!a || !_ || !v || _.width === 0 || _.height === 0) return null;
|
|
89
89
|
const I = _.width, x = _.height, R = v.getImageData(0, 0, I, x).data;
|
|
90
|
-
let
|
|
90
|
+
let U = I, A = x, P = 0, L = 0;
|
|
91
91
|
for (let H = 0; H < x; H++)
|
|
92
|
-
for (let
|
|
93
|
-
R[(I * H +
|
|
94
|
-
if (
|
|
92
|
+
for (let K = 0; K < I; K++)
|
|
93
|
+
R[(I * H + K) * 4 + 3] > 0 && (U = Math.min(U, K), A = Math.min(A, H), P = Math.max(P, K), L = Math.max(L, H));
|
|
94
|
+
if (U === I)
|
|
95
95
|
return null;
|
|
96
96
|
const k = 15;
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
w.width =
|
|
97
|
+
U = Math.max(0, U - k), A = Math.max(0, A - k), P = Math.min(I, P + k), L = Math.min(x, L + k);
|
|
98
|
+
const b = P - U, q = L - A, w = document.createElement("canvas");
|
|
99
|
+
w.width = b, w.height = q;
|
|
100
100
|
const G = w.getContext("2d");
|
|
101
|
-
return G ? (G.drawImage(_,
|
|
101
|
+
return G ? (G.drawImage(_, U, A, b, q, 0, 0, b, q), w.toDataURL("image/png")) : null;
|
|
102
102
|
}
|
|
103
103
|
})), /* @__PURE__ */ g("div", { ref: o, className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ g(
|
|
104
104
|
"canvas",
|
|
@@ -142,7 +142,7 @@ function ri(t, e, n, o) {
|
|
|
142
142
|
* Copyright 2025 Google LLC
|
|
143
143
|
* SPDX-License-Identifier: Apache-2.0
|
|
144
144
|
*/
|
|
145
|
-
class
|
|
145
|
+
class te {
|
|
146
146
|
}
|
|
147
147
|
function S(t, e) {
|
|
148
148
|
const n = /\{([^}]+)\}/g;
|
|
@@ -447,10 +447,10 @@ var vt;
|
|
|
447
447
|
(function(t) {
|
|
448
448
|
t.SCHEDULING_UNSPECIFIED = "SCHEDULING_UNSPECIFIED", t.SILENT = "SILENT", t.WHEN_IDLE = "WHEN_IDLE", t.INTERRUPT = "INTERRUPT";
|
|
449
449
|
})(vt || (vt = {}));
|
|
450
|
-
var
|
|
450
|
+
var oe;
|
|
451
451
|
(function(t) {
|
|
452
452
|
t.TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED", t.STRING = "STRING", t.NUMBER = "NUMBER", t.INTEGER = "INTEGER", t.BOOLEAN = "BOOLEAN", t.ARRAY = "ARRAY", t.OBJECT = "OBJECT", t.NULL = "NULL";
|
|
453
|
-
})(
|
|
453
|
+
})(oe || (oe = {}));
|
|
454
454
|
var It;
|
|
455
455
|
(function(t) {
|
|
456
456
|
t.MODE_UNSPECIFIED = "MODE_UNSPECIFIED", t.MODE_DYNAMIC = "MODE_DYNAMIC";
|
|
@@ -495,14 +495,14 @@ var Dt;
|
|
|
495
495
|
(function(t) {
|
|
496
496
|
t.HARM_PROBABILITY_UNSPECIFIED = "HARM_PROBABILITY_UNSPECIFIED", t.NEGLIGIBLE = "NEGLIGIBLE", t.LOW = "LOW", t.MEDIUM = "MEDIUM", t.HIGH = "HIGH";
|
|
497
497
|
})(Dt || (Dt = {}));
|
|
498
|
-
var
|
|
498
|
+
var Ut;
|
|
499
499
|
(function(t) {
|
|
500
500
|
t.HARM_SEVERITY_UNSPECIFIED = "HARM_SEVERITY_UNSPECIFIED", t.HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE", t.HARM_SEVERITY_LOW = "HARM_SEVERITY_LOW", t.HARM_SEVERITY_MEDIUM = "HARM_SEVERITY_MEDIUM", t.HARM_SEVERITY_HIGH = "HARM_SEVERITY_HIGH";
|
|
501
|
-
})(
|
|
502
|
-
var
|
|
501
|
+
})(Ut || (Ut = {}));
|
|
502
|
+
var bt;
|
|
503
503
|
(function(t) {
|
|
504
504
|
t.URL_RETRIEVAL_STATUS_UNSPECIFIED = "URL_RETRIEVAL_STATUS_UNSPECIFIED", t.URL_RETRIEVAL_STATUS_SUCCESS = "URL_RETRIEVAL_STATUS_SUCCESS", t.URL_RETRIEVAL_STATUS_ERROR = "URL_RETRIEVAL_STATUS_ERROR", t.URL_RETRIEVAL_STATUS_PAYWALL = "URL_RETRIEVAL_STATUS_PAYWALL", t.URL_RETRIEVAL_STATUS_UNSAFE = "URL_RETRIEVAL_STATUS_UNSAFE";
|
|
505
|
-
})(
|
|
505
|
+
})(bt || (bt = {}));
|
|
506
506
|
var Lt;
|
|
507
507
|
(function(t) {
|
|
508
508
|
t.BLOCKED_REASON_UNSPECIFIED = "BLOCKED_REASON_UNSPECIFIED", t.SAFETY = "SAFETY", t.OTHER = "OTHER", t.BLOCKLIST = "BLOCKLIST", t.PROHIBITED_CONTENT = "PROHIBITED_CONTENT", t.IMAGE_SAFETY = "IMAGE_SAFETY", t.MODEL_ARMOR = "MODEL_ARMOR", t.JAILBREAK = "JAILBREAK";
|
|
@@ -960,7 +960,7 @@ class Di {
|
|
|
960
960
|
return l.length > 0 && console.warn(`there are non-data parts ${l} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`), s.length > 0 ? btoa(s) : void 0;
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
|
-
class
|
|
963
|
+
class Ui {
|
|
964
964
|
/**
|
|
965
965
|
* Returns the first audio chunk from the server content, if present.
|
|
966
966
|
*
|
|
@@ -1072,7 +1072,7 @@ function dt(t, e) {
|
|
|
1072
1072
|
}
|
|
1073
1073
|
return Array.isArray(e) ? e.map((n) => J(n)) : [J(e)];
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1075
|
+
function z(t) {
|
|
1076
1076
|
if (t == null || Array.isArray(t) && t.length === 0)
|
|
1077
1077
|
throw new Error("contents are required");
|
|
1078
1078
|
if (!Array.isArray(t)) {
|
|
@@ -1095,16 +1095,16 @@ function K(t) {
|
|
|
1095
1095
|
}
|
|
1096
1096
|
return o || e.push({ role: "user", parts: fo(n) }), e;
|
|
1097
1097
|
}
|
|
1098
|
-
function
|
|
1098
|
+
function bi(t, e) {
|
|
1099
1099
|
t.includes("null") && (e.nullable = !0);
|
|
1100
1100
|
const n = t.filter((o) => o !== "null");
|
|
1101
1101
|
if (n.length === 1)
|
|
1102
|
-
e.type = Object.values(
|
|
1102
|
+
e.type = Object.values(oe).includes(n[0].toUpperCase()) ? n[0].toUpperCase() : oe.TYPE_UNSPECIFIED;
|
|
1103
1103
|
else {
|
|
1104
1104
|
e.anyOf = [];
|
|
1105
1105
|
for (const o of n)
|
|
1106
1106
|
e.anyOf.push({
|
|
1107
|
-
type: Object.values(
|
|
1107
|
+
type: Object.values(oe).includes(o.toUpperCase()) ? o.toUpperCase() : oe.TYPE_UNSPECIFIED
|
|
1108
1108
|
});
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
@@ -1113,7 +1113,7 @@ function ce(t) {
|
|
|
1113
1113
|
if (t.type && t.anyOf)
|
|
1114
1114
|
throw new Error("type and anyOf cannot be both populated.");
|
|
1115
1115
|
const l = t.anyOf;
|
|
1116
|
-
l != null && l.length == 2 && (l[0].type === "null" ? (e.nullable = !0, t = l[1]) : l[1].type === "null" && (e.nullable = !0, t = l[0])), t.type instanceof Array &&
|
|
1116
|
+
l != null && l.length == 2 && (l[0].type === "null" ? (e.nullable = !0, t = l[1]) : l[1].type === "null" && (e.nullable = !0, t = l[0])), t.type instanceof Array && bi(t.type, e);
|
|
1117
1117
|
for (const [a, u] of Object.entries(t))
|
|
1118
1118
|
if (u != null)
|
|
1119
1119
|
if (a == "type") {
|
|
@@ -1121,7 +1121,7 @@ function ce(t) {
|
|
|
1121
1121
|
throw new Error("type: null can not be the only possible type for the field.");
|
|
1122
1122
|
if (u instanceof Array)
|
|
1123
1123
|
continue;
|
|
1124
|
-
e.type = Object.values(
|
|
1124
|
+
e.type = Object.values(oe).includes(u.toUpperCase()) ? u.toUpperCase() : oe.TYPE_UNSPECIFIED;
|
|
1125
1125
|
} else if (n.includes(a))
|
|
1126
1126
|
e[a] = ce(u);
|
|
1127
1127
|
else if (o.includes(a)) {
|
|
@@ -1187,7 +1187,7 @@ function Li(t, e, n, o = 1) {
|
|
|
1187
1187
|
const s = !e.startsWith(`${n}/`) && e.split("/").length === o;
|
|
1188
1188
|
return t.isVertexAI() ? e.startsWith("projects/") ? e : e.startsWith("locations/") ? `projects/${t.getProject()}/${e}` : e.startsWith(`${n}/`) ? `projects/${t.getProject()}/locations/${t.getLocation()}/${e}` : s ? `projects/${t.getProject()}/locations/${t.getLocation()}/${n}/${e}` : e : s ? `${n}/${e}` : e;
|
|
1189
1189
|
}
|
|
1190
|
-
function
|
|
1190
|
+
function ne(t, e) {
|
|
1191
1191
|
if (typeof e != "string")
|
|
1192
1192
|
throw new Error("name must be a string");
|
|
1193
1193
|
return Li(t, e, "cachedContents");
|
|
@@ -1206,7 +1206,7 @@ function po(t) {
|
|
|
1206
1206
|
return t;
|
|
1207
1207
|
}
|
|
1208
1208
|
}
|
|
1209
|
-
function
|
|
1209
|
+
function ie(t) {
|
|
1210
1210
|
return lt(t);
|
|
1211
1211
|
}
|
|
1212
1212
|
function Fi(t) {
|
|
@@ -1770,13 +1770,13 @@ function gs(t, e, n) {
|
|
|
1770
1770
|
"safetySettings"
|
|
1771
1771
|
]);
|
|
1772
1772
|
if (n !== void 0 && v != null) {
|
|
1773
|
-
let
|
|
1774
|
-
Array.isArray(
|
|
1773
|
+
let b = v;
|
|
1774
|
+
Array.isArray(b) && (b = b.map((q) => ks(q))), r(n, ["safetySettings"], b);
|
|
1775
1775
|
}
|
|
1776
1776
|
const I = i(e, ["tools"]);
|
|
1777
1777
|
if (n !== void 0 && I != null) {
|
|
1778
|
-
let
|
|
1779
|
-
Array.isArray(
|
|
1778
|
+
let b = me(I);
|
|
1779
|
+
Array.isArray(b) && (b = b.map((q) => Us(he(q)))), r(n, ["tools"], b);
|
|
1780
1780
|
}
|
|
1781
1781
|
const x = i(e, ["toolConfig"]);
|
|
1782
1782
|
if (n !== void 0 && x != null && r(n, ["toolConfig"], Ds(x)), i(e, ["labels"]) !== void 0)
|
|
@@ -1784,15 +1784,15 @@ function gs(t, e, n) {
|
|
|
1784
1784
|
const M = i(e, [
|
|
1785
1785
|
"cachedContent"
|
|
1786
1786
|
]);
|
|
1787
|
-
n !== void 0 && M != null && r(n, ["cachedContent"],
|
|
1787
|
+
n !== void 0 && M != null && r(n, ["cachedContent"], ne(t, M));
|
|
1788
1788
|
const R = i(e, [
|
|
1789
1789
|
"responseModalities"
|
|
1790
1790
|
]);
|
|
1791
1791
|
R != null && r(o, ["responseModalities"], R);
|
|
1792
|
-
const
|
|
1792
|
+
const U = i(e, [
|
|
1793
1793
|
"mediaResolution"
|
|
1794
1794
|
]);
|
|
1795
|
-
|
|
1795
|
+
U != null && r(o, ["mediaResolution"], U);
|
|
1796
1796
|
const A = i(e, ["speechConfig"]);
|
|
1797
1797
|
if (A != null && r(o, ["speechConfig"], ft(A)), i(e, ["audioTimestamp"]) !== void 0)
|
|
1798
1798
|
throw new Error("audioTimestamp parameter is not supported in Gemini API.");
|
|
@@ -1871,7 +1871,7 @@ function Is(t, e) {
|
|
|
1871
1871
|
o != null && r(n, ["request", "model"], F(t, o));
|
|
1872
1872
|
const s = i(e, ["contents"]);
|
|
1873
1873
|
if (s != null) {
|
|
1874
|
-
let u =
|
|
1874
|
+
let u = z(s);
|
|
1875
1875
|
Array.isArray(u) && (u = u.map((c) => Eo(c))), r(n, ["request", "contents"], u);
|
|
1876
1876
|
}
|
|
1877
1877
|
const l = i(e, ["metadata"]);
|
|
@@ -1996,7 +1996,7 @@ function Ds(t) {
|
|
|
1996
1996
|
]);
|
|
1997
1997
|
return o != null && r(e, ["retrievalConfig"], o), e;
|
|
1998
1998
|
}
|
|
1999
|
-
function
|
|
1999
|
+
function Us(t) {
|
|
2000
2000
|
const e = {}, n = i(t, [
|
|
2001
2001
|
"functionDeclarations"
|
|
2002
2002
|
]);
|
|
@@ -2031,11 +2031,11 @@ function bs(t) {
|
|
|
2031
2031
|
* Copyright 2025 Google LLC
|
|
2032
2032
|
* SPDX-License-Identifier: Apache-2.0
|
|
2033
2033
|
*/
|
|
2034
|
-
var
|
|
2034
|
+
var ee;
|
|
2035
2035
|
(function(t) {
|
|
2036
2036
|
t.PAGED_ITEM_BATCH_JOBS = "batchJobs", t.PAGED_ITEM_MODELS = "models", t.PAGED_ITEM_TUNING_JOBS = "tuningJobs", t.PAGED_ITEM_FILES = "files", t.PAGED_ITEM_CACHED_CONTENTS = "cachedContents", t.PAGED_ITEM_FILE_SEARCH_STORES = "fileSearchStores", t.PAGED_ITEM_DOCUMENTS = "documents";
|
|
2037
|
-
})(
|
|
2038
|
-
class
|
|
2037
|
+
})(ee || (ee = {}));
|
|
2038
|
+
class le {
|
|
2039
2039
|
constructor(e, n, o, s) {
|
|
2040
2040
|
this.pageInternal = [], this.paramsInternal = {}, this.requestInternal = n, this.init(e, o, s);
|
|
2041
2041
|
}
|
|
@@ -2173,9 +2173,9 @@ class re {
|
|
|
2173
2173
|
* Copyright 2025 Google LLC
|
|
2174
2174
|
* SPDX-License-Identifier: Apache-2.0
|
|
2175
2175
|
*/
|
|
2176
|
-
class
|
|
2176
|
+
class bs extends te {
|
|
2177
2177
|
constructor(e) {
|
|
2178
|
-
super(), this.apiClient = e, this.list = async (n = {}) => new
|
|
2178
|
+
super(), this.apiClient = e, this.list = async (n = {}) => new le(ee.PAGED_ITEM_BATCH_JOBS, (o) => this.listInternal(o), await this.listInternal(n), n), this.create = async (n) => (this.apiClient.isVertexAI() && (n.config = this.formatDestination(n.src, n.config)), this.createInternal(n)), this.createEmbeddings = async (n) => {
|
|
2179
2179
|
if (console.warn("batches.createEmbeddings() is experimental and may change without notice."), this.apiClient.isVertexAI())
|
|
2180
2180
|
throw new Error("Vertex AI does not support batches.createEmbeddings.");
|
|
2181
2181
|
return this.createEmbeddingsInternal(n);
|
|
@@ -2474,7 +2474,7 @@ function Fs(t, e) {
|
|
|
2474
2474
|
e !== void 0 && l != null && r(e, ["displayName"], l);
|
|
2475
2475
|
const a = i(t, ["contents"]);
|
|
2476
2476
|
if (e !== void 0 && a != null) {
|
|
2477
|
-
let f =
|
|
2477
|
+
let f = z(a);
|
|
2478
2478
|
Array.isArray(f) && (f = f.map((p) => Dn(p))), r(e, ["contents"], f);
|
|
2479
2479
|
}
|
|
2480
2480
|
const u = i(t, [
|
|
@@ -2500,7 +2500,7 @@ function Gs(t, e) {
|
|
|
2500
2500
|
e !== void 0 && l != null && r(e, ["displayName"], l);
|
|
2501
2501
|
const a = i(t, ["contents"]);
|
|
2502
2502
|
if (e !== void 0 && a != null) {
|
|
2503
|
-
let p =
|
|
2503
|
+
let p = z(a);
|
|
2504
2504
|
Array.isArray(p) && (p = p.map((h) => h)), r(e, ["contents"], p);
|
|
2505
2505
|
}
|
|
2506
2506
|
const u = i(t, [
|
|
@@ -2531,11 +2531,11 @@ function qs(t, e) {
|
|
|
2531
2531
|
}
|
|
2532
2532
|
function Hs(t, e) {
|
|
2533
2533
|
const n = {}, o = i(e, ["name"]);
|
|
2534
|
-
return o != null && r(n, ["_url", "name"],
|
|
2534
|
+
return o != null && r(n, ["_url", "name"], ne(t, o)), n;
|
|
2535
2535
|
}
|
|
2536
2536
|
function Bs(t, e) {
|
|
2537
2537
|
const n = {}, o = i(e, ["name"]);
|
|
2538
|
-
return o != null && r(n, ["_url", "name"],
|
|
2538
|
+
return o != null && r(n, ["_url", "name"], ne(t, o)), n;
|
|
2539
2539
|
}
|
|
2540
2540
|
function Js(t) {
|
|
2541
2541
|
const e = {}, n = i(t, [
|
|
@@ -2603,11 +2603,11 @@ function zs(t) {
|
|
|
2603
2603
|
}
|
|
2604
2604
|
function Os(t, e) {
|
|
2605
2605
|
const n = {}, o = i(e, ["name"]);
|
|
2606
|
-
return o != null && r(n, ["_url", "name"],
|
|
2606
|
+
return o != null && r(n, ["_url", "name"], ne(t, o)), n;
|
|
2607
2607
|
}
|
|
2608
2608
|
function Xs(t, e) {
|
|
2609
2609
|
const n = {}, o = i(e, ["name"]);
|
|
2610
|
-
return o != null && r(n, ["_url", "name"],
|
|
2610
|
+
return o != null && r(n, ["_url", "name"], ne(t, o)), n;
|
|
2611
2611
|
}
|
|
2612
2612
|
function Qs(t) {
|
|
2613
2613
|
const e = {};
|
|
@@ -2805,13 +2805,13 @@ function dr(t, e) {
|
|
|
2805
2805
|
}
|
|
2806
2806
|
function cr(t, e) {
|
|
2807
2807
|
const n = {}, o = i(e, ["name"]);
|
|
2808
|
-
o != null && r(n, ["_url", "name"],
|
|
2808
|
+
o != null && r(n, ["_url", "name"], ne(t, o));
|
|
2809
2809
|
const s = i(e, ["config"]);
|
|
2810
2810
|
return s != null && ur(s, n), n;
|
|
2811
2811
|
}
|
|
2812
2812
|
function fr(t, e) {
|
|
2813
2813
|
const n = {}, o = i(e, ["name"]);
|
|
2814
|
-
o != null && r(n, ["_url", "name"],
|
|
2814
|
+
o != null && r(n, ["_url", "name"], ne(t, o));
|
|
2815
2815
|
const s = i(e, ["config"]);
|
|
2816
2816
|
return s != null && dr(s, n), n;
|
|
2817
2817
|
}
|
|
@@ -2820,9 +2820,9 @@ function fr(t, e) {
|
|
|
2820
2820
|
* Copyright 2025 Google LLC
|
|
2821
2821
|
* SPDX-License-Identifier: Apache-2.0
|
|
2822
2822
|
*/
|
|
2823
|
-
class pr extends
|
|
2823
|
+
class pr extends te {
|
|
2824
2824
|
constructor(e) {
|
|
2825
|
-
super(), this.apiClient = e, this.list = async (n = {}) => new
|
|
2825
|
+
super(), this.apiClient = e, this.list = async (n = {}) => new le(ee.PAGED_ITEM_CACHED_CONTENTS, (o) => this.listInternal(o), await this.listInternal(n), n);
|
|
2826
2826
|
}
|
|
2827
2827
|
/**
|
|
2828
2828
|
* Creates a cached contents resource.
|
|
@@ -3052,7 +3052,7 @@ function ke(t, e) {
|
|
|
3052
3052
|
e.indexOf(o[s]) < 0 && Object.prototype.propertyIsEnumerable.call(t, o[s]) && (n[o[s]] = t[o[s]]);
|
|
3053
3053
|
return n;
|
|
3054
3054
|
}
|
|
3055
|
-
function
|
|
3055
|
+
function Un(t) {
|
|
3056
3056
|
var e = typeof Symbol == "function" && Symbol.iterator, n = e && t[e], o = 0;
|
|
3057
3057
|
if (n) return n.call(t);
|
|
3058
3058
|
if (t && typeof t.length == "number") return {
|
|
@@ -3065,7 +3065,7 @@ function bn(t) {
|
|
|
3065
3065
|
function D(t) {
|
|
3066
3066
|
return this instanceof D ? (this.v = t, this) : new D(t);
|
|
3067
3067
|
}
|
|
3068
|
-
function
|
|
3068
|
+
function X(t, e, n) {
|
|
3069
3069
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
3070
3070
|
var o = n.apply(t, e || []), s, l = [];
|
|
3071
3071
|
return s = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), u("next"), u("throw"), u("return", a), s[Symbol.asyncIterator] = function() {
|
|
@@ -3103,10 +3103,10 @@ function O(t, e, n) {
|
|
|
3103
3103
|
m(y), l.shift(), l.length && c(l[0][0], l[0][1]);
|
|
3104
3104
|
}
|
|
3105
3105
|
}
|
|
3106
|
-
function
|
|
3106
|
+
function Q(t) {
|
|
3107
3107
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
3108
3108
|
var e = t[Symbol.asyncIterator], n;
|
|
3109
|
-
return e ? e.call(t) : (t = typeof
|
|
3109
|
+
return e ? e.call(t) : (t = typeof Un == "function" ? Un(t) : t[Symbol.iterator](), n = {}, o("next"), o("throw"), o("return"), n[Symbol.asyncIterator] = function() {
|
|
3110
3110
|
return this;
|
|
3111
3111
|
}, n);
|
|
3112
3112
|
function o(l) {
|
|
@@ -3149,7 +3149,7 @@ function mr(t) {
|
|
|
3149
3149
|
throw new Error(`Role must be user or model, but got ${e.role}.`);
|
|
3150
3150
|
}
|
|
3151
3151
|
}
|
|
3152
|
-
function
|
|
3152
|
+
function bn(t) {
|
|
3153
3153
|
if (t === void 0 || t.length === 0)
|
|
3154
3154
|
return [];
|
|
3155
3155
|
const e = [], n = t.length;
|
|
@@ -3307,15 +3307,15 @@ class yr {
|
|
|
3307
3307
|
* chat session.
|
|
3308
3308
|
*/
|
|
3309
3309
|
getHistory(e = !1) {
|
|
3310
|
-
const n = e ?
|
|
3310
|
+
const n = e ? bn(this.history) : this.history;
|
|
3311
3311
|
return structuredClone(n);
|
|
3312
3312
|
}
|
|
3313
3313
|
processStreamResponse(e, n) {
|
|
3314
|
-
return
|
|
3314
|
+
return X(this, arguments, function* () {
|
|
3315
3315
|
var s, l, a, u, c, d;
|
|
3316
3316
|
const f = [];
|
|
3317
3317
|
try {
|
|
3318
|
-
for (var p = !0, h =
|
|
3318
|
+
for (var p = !0, h = Q(e), m; m = yield D(h.next()), s = m.done, !s; p = !0) {
|
|
3319
3319
|
u = m.value, p = !1;
|
|
3320
3320
|
const y = u;
|
|
3321
3321
|
if (hr(y)) {
|
|
@@ -3341,7 +3341,7 @@ class yr {
|
|
|
3341
3341
|
n.length > 0 && n.every((l) => l.role !== void 0) ? s = n : s.push({
|
|
3342
3342
|
role: "model",
|
|
3343
3343
|
parts: []
|
|
3344
|
-
}), o && o.length > 0 ? this.history.push(...
|
|
3344
|
+
}), o && o.length > 0 ? this.history.push(...bn(o)) : this.history.push(e), this.history.push(...s);
|
|
3345
3345
|
}
|
|
3346
3346
|
}
|
|
3347
3347
|
/**
|
|
@@ -3414,9 +3414,9 @@ function Ar(t) {
|
|
|
3414
3414
|
* Copyright 2025 Google LLC
|
|
3415
3415
|
* SPDX-License-Identifier: Apache-2.0
|
|
3416
3416
|
*/
|
|
3417
|
-
class xr extends
|
|
3417
|
+
class xr extends te {
|
|
3418
3418
|
constructor(e) {
|
|
3419
|
-
super(), this.apiClient = e, this.list = async (n = {}) => new
|
|
3419
|
+
super(), this.apiClient = e, this.list = async (n = {}) => new le(ee.PAGED_ITEM_FILES, (o) => this.listInternal(o), await this.listInternal(n), n);
|
|
3420
3420
|
}
|
|
3421
3421
|
/**
|
|
3422
3422
|
* Uploads a file asynchronously to the Gemini API.
|
|
@@ -3762,7 +3762,7 @@ function Dr(t) {
|
|
|
3762
3762
|
]);
|
|
3763
3763
|
return n != null && r(e, ["timeRangeFilter"], n), e;
|
|
3764
3764
|
}
|
|
3765
|
-
function
|
|
3765
|
+
function Ur(t, e) {
|
|
3766
3766
|
const n = {}, o = i(t, [
|
|
3767
3767
|
"generationConfig"
|
|
3768
3768
|
]);
|
|
@@ -3831,7 +3831,7 @@ function br(t, e) {
|
|
|
3831
3831
|
throw new Error("explicitVadSignal parameter is not supported in Gemini API.");
|
|
3832
3832
|
return n;
|
|
3833
3833
|
}
|
|
3834
|
-
function
|
|
3834
|
+
function br(t, e) {
|
|
3835
3835
|
const n = {}, o = i(t, [
|
|
3836
3836
|
"generationConfig"
|
|
3837
3837
|
]);
|
|
@@ -3873,7 +3873,7 @@ function Ur(t, e) {
|
|
|
3873
3873
|
const C = i(t, ["tools"]);
|
|
3874
3874
|
if (e !== void 0 && C != null) {
|
|
3875
3875
|
let R = me(C);
|
|
3876
|
-
Array.isArray(R) && (R = R.map((
|
|
3876
|
+
Array.isArray(R) && (R = R.map((U) => Yr(he(U)))), r(e, ["setup", "tools"], R);
|
|
3877
3877
|
}
|
|
3878
3878
|
const T = i(t, [
|
|
3879
3879
|
"sessionResumption"
|
|
@@ -3906,13 +3906,13 @@ function Lr(t, e) {
|
|
|
3906
3906
|
const n = {}, o = i(e, ["model"]);
|
|
3907
3907
|
o != null && r(n, ["setup", "model"], F(t, o));
|
|
3908
3908
|
const s = i(e, ["config"]);
|
|
3909
|
-
return s != null && r(n, ["config"],
|
|
3909
|
+
return s != null && r(n, ["config"], Ur(s, n)), n;
|
|
3910
3910
|
}
|
|
3911
3911
|
function Fr(t, e) {
|
|
3912
3912
|
const n = {}, o = i(e, ["model"]);
|
|
3913
3913
|
o != null && r(n, ["setup", "model"], F(t, o));
|
|
3914
3914
|
const s = i(e, ["config"]);
|
|
3915
|
-
return s != null && r(n, ["config"],
|
|
3915
|
+
return s != null && r(n, ["config"], br(s, n)), n;
|
|
3916
3916
|
}
|
|
3917
3917
|
function Gr(t) {
|
|
3918
3918
|
const e = {}, n = i(t, [
|
|
@@ -4226,7 +4226,7 @@ function Qr(t, e) {
|
|
|
4226
4226
|
o != null && r(n, ["_url", "model"], F(t, o));
|
|
4227
4227
|
const s = i(e, ["contents"]);
|
|
4228
4228
|
if (s != null) {
|
|
4229
|
-
let l =
|
|
4229
|
+
let l = z(s);
|
|
4230
4230
|
Array.isArray(l) && (l = l.map((a) => a)), r(n, ["contents"], l);
|
|
4231
4231
|
}
|
|
4232
4232
|
return n;
|
|
@@ -4302,7 +4302,7 @@ function il(t, e) {
|
|
|
4302
4302
|
o != null && r(n, ["_url", "model"], F(t, o));
|
|
4303
4303
|
const s = i(e, ["contents"]);
|
|
4304
4304
|
if (s != null) {
|
|
4305
|
-
let a =
|
|
4305
|
+
let a = z(s);
|
|
4306
4306
|
Array.isArray(a) && (a = a.map((u) => Fe(u))), r(n, ["contents"], a);
|
|
4307
4307
|
}
|
|
4308
4308
|
const l = i(e, ["config"]);
|
|
@@ -4313,7 +4313,7 @@ function sl(t, e) {
|
|
|
4313
4313
|
o != null && r(n, ["_url", "model"], F(t, o));
|
|
4314
4314
|
const s = i(e, ["contents"]);
|
|
4315
4315
|
if (s != null) {
|
|
4316
|
-
let a =
|
|
4316
|
+
let a = z(s);
|
|
4317
4317
|
Array.isArray(a) && (a = a.map((u) => u)), r(n, ["contents"], a);
|
|
4318
4318
|
}
|
|
4319
4319
|
const l = i(e, ["config"]);
|
|
@@ -4641,13 +4641,13 @@ function xl(t, e, n) {
|
|
|
4641
4641
|
"safetySettings"
|
|
4642
4642
|
]);
|
|
4643
4643
|
if (n !== void 0 && v != null) {
|
|
4644
|
-
let
|
|
4645
|
-
Array.isArray(
|
|
4644
|
+
let b = v;
|
|
4645
|
+
Array.isArray(b) && (b = b.map((q) => ga(q))), r(n, ["safetySettings"], b);
|
|
4646
4646
|
}
|
|
4647
4647
|
const I = i(e, ["tools"]);
|
|
4648
4648
|
if (n !== void 0 && I != null) {
|
|
4649
|
-
let
|
|
4650
|
-
Array.isArray(
|
|
4649
|
+
let b = me(I);
|
|
4650
|
+
Array.isArray(b) && (b = b.map((q) => Ia(he(q)))), r(n, ["tools"], b);
|
|
4651
4651
|
}
|
|
4652
4652
|
const x = i(e, ["toolConfig"]);
|
|
4653
4653
|
if (n !== void 0 && x != null && r(n, ["toolConfig"], va(x)), i(e, ["labels"]) !== void 0)
|
|
@@ -4655,15 +4655,15 @@ function xl(t, e, n) {
|
|
|
4655
4655
|
const M = i(e, [
|
|
4656
4656
|
"cachedContent"
|
|
4657
4657
|
]);
|
|
4658
|
-
n !== void 0 && M != null && r(n, ["cachedContent"],
|
|
4658
|
+
n !== void 0 && M != null && r(n, ["cachedContent"], ne(t, M));
|
|
4659
4659
|
const R = i(e, [
|
|
4660
4660
|
"responseModalities"
|
|
4661
4661
|
]);
|
|
4662
4662
|
R != null && r(o, ["responseModalities"], R);
|
|
4663
|
-
const
|
|
4663
|
+
const U = i(e, [
|
|
4664
4664
|
"mediaResolution"
|
|
4665
4665
|
]);
|
|
4666
|
-
|
|
4666
|
+
U != null && r(o, ["mediaResolution"], U);
|
|
4667
4667
|
const A = i(e, ["speechConfig"]);
|
|
4668
4668
|
if (A != null && r(o, ["speechConfig"], ft(A)), i(e, ["audioTimestamp"]) !== void 0)
|
|
4669
4669
|
throw new Error("audioTimestamp parameter is not supported in Gemini API.");
|
|
@@ -4751,12 +4751,12 @@ function wl(t, e, n) {
|
|
|
4751
4751
|
}
|
|
4752
4752
|
const R = i(e, ["toolConfig"]);
|
|
4753
4753
|
n !== void 0 && R != null && r(n, ["toolConfig"], R);
|
|
4754
|
-
const
|
|
4755
|
-
n !== void 0 &&
|
|
4754
|
+
const U = i(e, ["labels"]);
|
|
4755
|
+
n !== void 0 && U != null && r(n, ["labels"], U);
|
|
4756
4756
|
const A = i(e, [
|
|
4757
4757
|
"cachedContent"
|
|
4758
4758
|
]);
|
|
4759
|
-
n !== void 0 && A != null && r(n, ["cachedContent"],
|
|
4759
|
+
n !== void 0 && A != null && r(n, ["cachedContent"], ne(t, A));
|
|
4760
4760
|
const P = i(e, [
|
|
4761
4761
|
"responseModalities"
|
|
4762
4762
|
]);
|
|
@@ -4767,10 +4767,10 @@ function wl(t, e, n) {
|
|
|
4767
4767
|
L != null && r(o, ["mediaResolution"], L);
|
|
4768
4768
|
const k = i(e, ["speechConfig"]);
|
|
4769
4769
|
k != null && r(o, ["speechConfig"], ft(k));
|
|
4770
|
-
const
|
|
4770
|
+
const b = i(e, [
|
|
4771
4771
|
"audioTimestamp"
|
|
4772
4772
|
]);
|
|
4773
|
-
|
|
4773
|
+
b != null && r(o, ["audioTimestamp"], b);
|
|
4774
4774
|
const q = i(e, [
|
|
4775
4775
|
"thinkingConfig"
|
|
4776
4776
|
]);
|
|
@@ -4785,7 +4785,7 @@ function Ln(t, e) {
|
|
|
4785
4785
|
o != null && r(n, ["_url", "model"], F(t, o));
|
|
4786
4786
|
const s = i(e, ["contents"]);
|
|
4787
4787
|
if (s != null) {
|
|
4788
|
-
let a =
|
|
4788
|
+
let a = z(s);
|
|
4789
4789
|
Array.isArray(a) && (a = a.map((u) => Fe(u))), r(n, ["contents"], a);
|
|
4790
4790
|
}
|
|
4791
4791
|
const l = i(e, ["config"]);
|
|
@@ -4796,7 +4796,7 @@ function Fn(t, e) {
|
|
|
4796
4796
|
o != null && r(n, ["_url", "model"], F(t, o));
|
|
4797
4797
|
const s = i(e, ["contents"]);
|
|
4798
4798
|
if (s != null) {
|
|
4799
|
-
let a =
|
|
4799
|
+
let a = z(s);
|
|
4800
4800
|
Array.isArray(a) && (a = a.map((u) => u)), r(n, ["contents"], a);
|
|
4801
4801
|
}
|
|
4802
4802
|
const l = i(e, ["config"]);
|
|
@@ -5007,7 +5007,7 @@ function Dl(t) {
|
|
|
5007
5007
|
]);
|
|
5008
5008
|
return s != null && r(e, ["positivePromptSafetyAttributes"], So(s)), e;
|
|
5009
5009
|
}
|
|
5010
|
-
function
|
|
5010
|
+
function Ul(t, e) {
|
|
5011
5011
|
const n = {}, o = i(t, [
|
|
5012
5012
|
"numberOfVideos"
|
|
5013
5013
|
]);
|
|
@@ -5053,7 +5053,7 @@ function bl(t, e) {
|
|
|
5053
5053
|
throw new Error("compressionQuality parameter is not supported in Gemini API.");
|
|
5054
5054
|
return n;
|
|
5055
5055
|
}
|
|
5056
|
-
function
|
|
5056
|
+
function bl(t, e) {
|
|
5057
5057
|
const n = {}, o = i(t, [
|
|
5058
5058
|
"numberOfVideos"
|
|
5059
5059
|
]);
|
|
@@ -5091,7 +5091,7 @@ function Ul(t, e) {
|
|
|
5091
5091
|
]);
|
|
5092
5092
|
e !== void 0 && y != null && r(e, ["parameters", "generateAudio"], y);
|
|
5093
5093
|
const C = i(t, ["lastFrame"]);
|
|
5094
|
-
e !== void 0 && C != null && r(e, ["instances[0]", "lastFrame"],
|
|
5094
|
+
e !== void 0 && C != null && r(e, ["instances[0]", "lastFrame"], Z(C));
|
|
5095
5095
|
const T = i(t, [
|
|
5096
5096
|
"referenceImages"
|
|
5097
5097
|
]);
|
|
@@ -5100,7 +5100,7 @@ function Ul(t, e) {
|
|
|
5100
5100
|
Array.isArray(v) && (v = v.map((I) => Fa(I))), r(e, ["instances[0]", "referenceImages"], v);
|
|
5101
5101
|
}
|
|
5102
5102
|
const E = i(t, ["mask"]);
|
|
5103
|
-
e !== void 0 && E != null && r(e, ["instances[0]", "mask"],
|
|
5103
|
+
e !== void 0 && E != null && r(e, ["instances[0]", "mask"], ba(E));
|
|
5104
5104
|
const _ = i(t, [
|
|
5105
5105
|
"compressionQuality"
|
|
5106
5106
|
]);
|
|
@@ -5145,7 +5145,7 @@ function Gl(t, e) {
|
|
|
5145
5145
|
const u = i(e, ["source"]);
|
|
5146
5146
|
u != null && Bl(u, n);
|
|
5147
5147
|
const c = i(e, ["config"]);
|
|
5148
|
-
return c != null &&
|
|
5148
|
+
return c != null && Ul(c, n), n;
|
|
5149
5149
|
}
|
|
5150
5150
|
function Vl(t, e) {
|
|
5151
5151
|
const n = {}, o = i(e, ["model"]);
|
|
@@ -5153,13 +5153,13 @@ function Vl(t, e) {
|
|
|
5153
5153
|
const s = i(e, ["prompt"]);
|
|
5154
5154
|
s != null && r(n, ["instances[0]", "prompt"], s);
|
|
5155
5155
|
const l = i(e, ["image"]);
|
|
5156
|
-
l != null && r(n, ["instances[0]", "image"],
|
|
5156
|
+
l != null && r(n, ["instances[0]", "image"], Z(l));
|
|
5157
5157
|
const a = i(e, ["video"]);
|
|
5158
5158
|
a != null && r(n, ["instances[0]", "video"], wo(a));
|
|
5159
5159
|
const u = i(e, ["source"]);
|
|
5160
5160
|
u != null && Jl(u, n);
|
|
5161
5161
|
const c = i(e, ["config"]);
|
|
5162
|
-
return c != null &&
|
|
5162
|
+
return c != null && bl(c, n), n;
|
|
5163
5163
|
}
|
|
5164
5164
|
function ql(t) {
|
|
5165
5165
|
const e = {}, n = i(t, [
|
|
@@ -5205,7 +5205,7 @@ function Jl(t, e) {
|
|
|
5205
5205
|
const n = {}, o = i(t, ["prompt"]);
|
|
5206
5206
|
e !== void 0 && o != null && r(e, ["instances[0]", "prompt"], o);
|
|
5207
5207
|
const s = i(t, ["image"]);
|
|
5208
|
-
e !== void 0 && s != null && r(e, ["instances[0]", "image"],
|
|
5208
|
+
e !== void 0 && s != null && r(e, ["instances[0]", "image"], Z(s));
|
|
5209
5209
|
const l = i(t, ["video"]);
|
|
5210
5210
|
return e !== void 0 && l != null && r(e, ["instances[0]", "video"], wo(l)), n;
|
|
5211
5211
|
}
|
|
@@ -5247,7 +5247,7 @@ function Yl(t) {
|
|
|
5247
5247
|
}
|
|
5248
5248
|
function Kl(t) {
|
|
5249
5249
|
const e = {}, n = i(t, ["_self"]);
|
|
5250
|
-
return n != null && r(e, ["video"],
|
|
5250
|
+
return n != null && r(e, ["video"], Ua(n)), e;
|
|
5251
5251
|
}
|
|
5252
5252
|
function zl(t) {
|
|
5253
5253
|
const e = {}, n = i(t, [
|
|
@@ -5383,7 +5383,7 @@ function ta(t) {
|
|
|
5383
5383
|
const e = {}, n = i(t, [
|
|
5384
5384
|
"bytesBase64Encoded"
|
|
5385
5385
|
]);
|
|
5386
|
-
n != null && r(e, ["imageBytes"],
|
|
5386
|
+
n != null && r(e, ["imageBytes"], ie(n));
|
|
5387
5387
|
const o = i(t, ["mimeType"]);
|
|
5388
5388
|
return o != null && r(e, ["mimeType"], o), e;
|
|
5389
5389
|
}
|
|
@@ -5393,7 +5393,7 @@ function vo(t) {
|
|
|
5393
5393
|
const o = i(t, [
|
|
5394
5394
|
"bytesBase64Encoded"
|
|
5395
5395
|
]);
|
|
5396
|
-
o != null && r(e, ["imageBytes"],
|
|
5396
|
+
o != null && r(e, ["imageBytes"], ie(o));
|
|
5397
5397
|
const s = i(t, ["mimeType"]);
|
|
5398
5398
|
return s != null && r(e, ["mimeType"], s), e;
|
|
5399
5399
|
}
|
|
@@ -5402,15 +5402,15 @@ function Ve(t) {
|
|
|
5402
5402
|
if (i(t, ["gcsUri"]) !== void 0)
|
|
5403
5403
|
throw new Error("gcsUri parameter is not supported in Gemini API.");
|
|
5404
5404
|
const n = i(t, ["imageBytes"]);
|
|
5405
|
-
n != null && r(e, ["bytesBase64Encoded"],
|
|
5405
|
+
n != null && r(e, ["bytesBase64Encoded"], ie(n));
|
|
5406
5406
|
const o = i(t, ["mimeType"]);
|
|
5407
5407
|
return o != null && r(e, ["mimeType"], o), e;
|
|
5408
5408
|
}
|
|
5409
|
-
function
|
|
5409
|
+
function Z(t) {
|
|
5410
5410
|
const e = {}, n = i(t, ["gcsUri"]);
|
|
5411
5411
|
n != null && r(e, ["gcsUri"], n);
|
|
5412
5412
|
const o = i(t, ["imageBytes"]);
|
|
5413
|
-
o != null && r(e, ["bytesBase64Encoded"],
|
|
5413
|
+
o != null && r(e, ["bytesBase64Encoded"], ie(o));
|
|
5414
5414
|
const s = i(t, ["mimeType"]);
|
|
5415
5415
|
return s != null && r(e, ["mimeType"], s), e;
|
|
5416
5416
|
}
|
|
@@ -5587,7 +5587,7 @@ function ua(t) {
|
|
|
5587
5587
|
}
|
|
5588
5588
|
function da(t) {
|
|
5589
5589
|
const e = {}, n = i(t, ["productImage"]);
|
|
5590
|
-
return n != null && r(e, ["image"],
|
|
5590
|
+
return n != null && r(e, ["image"], Z(n)), e;
|
|
5591
5591
|
}
|
|
5592
5592
|
function ca(t, e) {
|
|
5593
5593
|
const n = {}, o = i(t, [
|
|
@@ -5647,7 +5647,7 @@ function ha(t, e) {
|
|
|
5647
5647
|
const n = {}, o = i(t, ["prompt"]);
|
|
5648
5648
|
e !== void 0 && o != null && r(e, ["instances[0]", "prompt"], o);
|
|
5649
5649
|
const s = i(t, ["personImage"]);
|
|
5650
|
-
e !== void 0 && s != null && r(e, ["instances[0]", "personImage", "image"],
|
|
5650
|
+
e !== void 0 && s != null && r(e, ["instances[0]", "personImage", "image"], Z(s));
|
|
5651
5651
|
const l = i(t, [
|
|
5652
5652
|
"productImages"
|
|
5653
5653
|
]);
|
|
@@ -5661,7 +5661,7 @@ function ma(t) {
|
|
|
5661
5661
|
const e = {}, n = i(t, [
|
|
5662
5662
|
"referenceImage"
|
|
5663
5663
|
]);
|
|
5664
|
-
n != null && r(e, ["referenceImage"],
|
|
5664
|
+
n != null && r(e, ["referenceImage"], Z(n));
|
|
5665
5665
|
const o = i(t, ["referenceId"]);
|
|
5666
5666
|
o != null && r(e, ["referenceId"], o);
|
|
5667
5667
|
const s = i(t, [
|
|
@@ -5722,7 +5722,7 @@ function ga(t) {
|
|
|
5722
5722
|
}
|
|
5723
5723
|
function ya(t) {
|
|
5724
5724
|
const e = {}, n = i(t, ["image"]);
|
|
5725
|
-
return n != null && r(e, ["image"],
|
|
5725
|
+
return n != null && r(e, ["image"], Z(n)), e;
|
|
5726
5726
|
}
|
|
5727
5727
|
function Ta(t, e) {
|
|
5728
5728
|
const n = {}, o = i(t, ["mode"]);
|
|
@@ -5764,7 +5764,7 @@ function Ca(t, e) {
|
|
|
5764
5764
|
const n = {}, o = i(t, ["prompt"]);
|
|
5765
5765
|
e !== void 0 && o != null && r(e, ["instances[0]", "prompt"], o);
|
|
5766
5766
|
const s = i(t, ["image"]);
|
|
5767
|
-
e !== void 0 && s != null && r(e, ["instances[0]", "image"],
|
|
5767
|
+
e !== void 0 && s != null && r(e, ["instances[0]", "image"], Z(s));
|
|
5768
5768
|
const l = i(t, [
|
|
5769
5769
|
"scribbleImage"
|
|
5770
5770
|
]);
|
|
@@ -5937,7 +5937,7 @@ function Pa(t, e) {
|
|
|
5937
5937
|
const n = {}, o = i(e, ["model"]);
|
|
5938
5938
|
o != null && r(n, ["_url", "model"], F(t, o));
|
|
5939
5939
|
const s = i(e, ["image"]);
|
|
5940
|
-
s != null && r(n, ["instances[0]", "image"],
|
|
5940
|
+
s != null && r(n, ["instances[0]", "image"], Z(s));
|
|
5941
5941
|
const l = i(e, [
|
|
5942
5942
|
"upscaleFactor"
|
|
5943
5943
|
]);
|
|
@@ -5963,23 +5963,23 @@ function Da(t) {
|
|
|
5963
5963
|
const e = {}, n = i(t, ["uri"]);
|
|
5964
5964
|
n != null && r(e, ["uri"], n);
|
|
5965
5965
|
const o = i(t, ["encodedVideo"]);
|
|
5966
|
-
o != null && r(e, ["videoBytes"],
|
|
5966
|
+
o != null && r(e, ["videoBytes"], ie(o));
|
|
5967
5967
|
const s = i(t, ["encoding"]);
|
|
5968
5968
|
return s != null && r(e, ["mimeType"], s), e;
|
|
5969
5969
|
}
|
|
5970
|
-
function
|
|
5970
|
+
function Ua(t) {
|
|
5971
5971
|
const e = {}, n = i(t, ["gcsUri"]);
|
|
5972
5972
|
n != null && r(e, ["uri"], n);
|
|
5973
5973
|
const o = i(t, [
|
|
5974
5974
|
"bytesBase64Encoded"
|
|
5975
5975
|
]);
|
|
5976
|
-
o != null && r(e, ["videoBytes"],
|
|
5976
|
+
o != null && r(e, ["videoBytes"], ie(o));
|
|
5977
5977
|
const s = i(t, ["mimeType"]);
|
|
5978
5978
|
return s != null && r(e, ["mimeType"], s), e;
|
|
5979
5979
|
}
|
|
5980
|
-
function
|
|
5980
|
+
function ba(t) {
|
|
5981
5981
|
const e = {}, n = i(t, ["image"]);
|
|
5982
|
-
n != null && r(e, ["_self"],
|
|
5982
|
+
n != null && r(e, ["_self"], Z(n));
|
|
5983
5983
|
const o = i(t, ["maskMode"]);
|
|
5984
5984
|
return o != null && r(e, ["maskMode"], o), e;
|
|
5985
5985
|
}
|
|
@@ -5993,7 +5993,7 @@ function La(t) {
|
|
|
5993
5993
|
}
|
|
5994
5994
|
function Fa(t) {
|
|
5995
5995
|
const e = {}, n = i(t, ["image"]);
|
|
5996
|
-
n != null && r(e, ["image"],
|
|
5996
|
+
n != null && r(e, ["image"], Z(n));
|
|
5997
5997
|
const o = i(t, [
|
|
5998
5998
|
"referenceType"
|
|
5999
5999
|
]);
|
|
@@ -6003,7 +6003,7 @@ function xo(t) {
|
|
|
6003
6003
|
const e = {}, n = i(t, ["uri"]);
|
|
6004
6004
|
n != null && r(e, ["uri"], n);
|
|
6005
6005
|
const o = i(t, ["videoBytes"]);
|
|
6006
|
-
o != null && r(e, ["encodedVideo"],
|
|
6006
|
+
o != null && r(e, ["encodedVideo"], ie(o));
|
|
6007
6007
|
const s = i(t, ["mimeType"]);
|
|
6008
6008
|
return s != null && r(e, ["encoding"], s), e;
|
|
6009
6009
|
}
|
|
@@ -6011,7 +6011,7 @@ function wo(t) {
|
|
|
6011
6011
|
const e = {}, n = i(t, ["uri"]);
|
|
6012
6012
|
n != null && r(e, ["gcsUri"], n);
|
|
6013
6013
|
const o = i(t, ["videoBytes"]);
|
|
6014
|
-
o != null && r(e, ["bytesBase64Encoded"],
|
|
6014
|
+
o != null && r(e, ["bytesBase64Encoded"], ie(o));
|
|
6015
6015
|
const s = i(t, ["mimeType"]);
|
|
6016
6016
|
return s != null && r(e, ["mimeType"], s), e;
|
|
6017
6017
|
}
|
|
@@ -6296,7 +6296,7 @@ class su {
|
|
|
6296
6296
|
});
|
|
6297
6297
|
}
|
|
6298
6298
|
processStreamResponse(e) {
|
|
6299
|
-
return
|
|
6299
|
+
return X(this, arguments, function* () {
|
|
6300
6300
|
var o;
|
|
6301
6301
|
const s = (o = e == null ? void 0 : e.body) === null || o === void 0 ? void 0 : o.getReader(), l = new TextDecoder("utf-8");
|
|
6302
6302
|
if (!s)
|
|
@@ -6541,7 +6541,7 @@ function uu(t) {
|
|
|
6541
6541
|
return t !== null && typeof t == "object" && t instanceof ht;
|
|
6542
6542
|
}
|
|
6543
6543
|
function du(t) {
|
|
6544
|
-
return
|
|
6544
|
+
return X(this, arguments, function* (n, o = 100) {
|
|
6545
6545
|
let s, l = 0;
|
|
6546
6546
|
for (; l < o; ) {
|
|
6547
6547
|
const a = yield D(n.listTools({ cursor: s }));
|
|
@@ -6577,7 +6577,7 @@ class ht {
|
|
|
6577
6577
|
const l = {}, a = [];
|
|
6578
6578
|
for (const f of this.mcpClients)
|
|
6579
6579
|
try {
|
|
6580
|
-
for (var u = !0, c = (n = void 0,
|
|
6580
|
+
for (var u = !0, c = (n = void 0, Q(du(f))), d; d = await c.next(), e = d.done, !e; u = !0) {
|
|
6581
6581
|
s = d.value, u = !1;
|
|
6582
6582
|
const p = s;
|
|
6583
6583
|
a.push(p);
|
|
@@ -6636,7 +6636,7 @@ class ht {
|
|
|
6636
6636
|
* SPDX-License-Identifier: Apache-2.0
|
|
6637
6637
|
*/
|
|
6638
6638
|
async function cu(t, e, n) {
|
|
6639
|
-
const o = new
|
|
6639
|
+
const o = new Ui();
|
|
6640
6640
|
let s;
|
|
6641
6641
|
n.data instanceof Blob ? s = JSON.parse(await n.data.text()) : s = JSON.parse(n.data), Object.assign(o, s), e(o);
|
|
6642
6642
|
}
|
|
@@ -6911,12 +6911,12 @@ class Tu {
|
|
|
6911
6911
|
} else
|
|
6912
6912
|
R.push(A);
|
|
6913
6913
|
R.length > 0 && (e.config.tools = R);
|
|
6914
|
-
const
|
|
6914
|
+
const U = {
|
|
6915
6915
|
model: I,
|
|
6916
6916
|
config: e.config,
|
|
6917
6917
|
callbacks: e.callbacks
|
|
6918
6918
|
};
|
|
6919
|
-
return this.apiClient.isVertexAI() ? x = Fr(this.apiClient,
|
|
6919
|
+
return this.apiClient.isVertexAI() ? x = Fr(this.apiClient, U) : x = Lr(this.apiClient, U), delete x.config, v.send(JSON.stringify(x)), new Eu(v, this.apiClient);
|
|
6920
6920
|
}
|
|
6921
6921
|
// TODO: b/416041229 - Abstract this method to a common place.
|
|
6922
6922
|
isCallableTool(e) {
|
|
@@ -6934,7 +6934,7 @@ class Eu {
|
|
|
6934
6934
|
if (n.turns !== null && n.turns !== void 0) {
|
|
6935
6935
|
let o = [];
|
|
6936
6936
|
try {
|
|
6937
|
-
o =
|
|
6937
|
+
o = z(n.turns), e.isVertexAI() || (o = o.map((s) => Fe(s)));
|
|
6938
6938
|
} catch {
|
|
6939
6939
|
throw new Error(`Failed to parse client content "turns", type: '${typeof n.turns}'`);
|
|
6940
6940
|
}
|
|
@@ -7152,7 +7152,7 @@ function $n(t) {
|
|
|
7152
7152
|
* Copyright 2025 Google LLC
|
|
7153
7153
|
* SPDX-License-Identifier: Apache-2.0
|
|
7154
7154
|
*/
|
|
7155
|
-
class Su extends
|
|
7155
|
+
class Su extends te {
|
|
7156
7156
|
constructor(e) {
|
|
7157
7157
|
super(), this.apiClient = e, this.generateContent = async (n) => {
|
|
7158
7158
|
var o, s, l, a, u;
|
|
@@ -7165,7 +7165,7 @@ class Su extends ee {
|
|
|
7165
7165
|
throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${C}.`);
|
|
7166
7166
|
}
|
|
7167
7167
|
let f, p;
|
|
7168
|
-
const h =
|
|
7168
|
+
const h = z(c.contents), m = (l = (s = (o = c.config) === null || o === void 0 ? void 0 : o.automaticFunctionCalling) === null || s === void 0 ? void 0 : s.maximumRemoteCalls) !== null && l !== void 0 ? l : Hn;
|
|
7169
7169
|
let y = 0;
|
|
7170
7170
|
for (; y < m && (f = await this.generateContentInternal(c), !(!f.functionCalls || f.functionCalls.length === 0)); ) {
|
|
7171
7171
|
const C = f.candidates[0].content, T = [];
|
|
@@ -7177,7 +7177,7 @@ class Su extends ee {
|
|
|
7177
7177
|
y++, p = {
|
|
7178
7178
|
role: "user",
|
|
7179
7179
|
parts: T
|
|
7180
|
-
}, c.contents =
|
|
7180
|
+
}, c.contents = z(c.contents), c.contents.push(C), c.contents.push(p), $n(c.config) && (h.push(C), h.push(p));
|
|
7181
7181
|
}
|
|
7182
7182
|
return $n(c.config) && (f.automaticFunctionCallingHistory = h), f;
|
|
7183
7183
|
}, this.generateContentStream = async (n) => {
|
|
@@ -7223,7 +7223,7 @@ class Su extends ee {
|
|
|
7223
7223
|
throw new Error("Filtering tuned models list for Vertex AI is not currently supported");
|
|
7224
7224
|
a.config.filter = "labels.tune-type:*";
|
|
7225
7225
|
}
|
|
7226
|
-
return new
|
|
7226
|
+
return new le(ee.PAGED_ITEM_MODELS, (u) => this.listInternal(u), await this.listInternal(a), a);
|
|
7227
7227
|
}, this.editImage = async (n) => {
|
|
7228
7228
|
const o = {
|
|
7229
7229
|
model: n.model,
|
|
@@ -7313,16 +7313,16 @@ class Su extends ee {
|
|
|
7313
7313
|
let a = !1, u = 0;
|
|
7314
7314
|
const c = await this.initAfcToolsMap(e);
|
|
7315
7315
|
return function(d, f, p) {
|
|
7316
|
-
return
|
|
7316
|
+
return X(this, arguments, function* () {
|
|
7317
7317
|
for (var h, m, y, C, T, E; u < l; ) {
|
|
7318
7318
|
a && (u++, a = !1);
|
|
7319
|
-
const x = yield D(d.processParamsMaybeAddMcpUsage(p)), M = yield D(d.generateContentStreamInternal(x)), R = [],
|
|
7319
|
+
const x = yield D(d.processParamsMaybeAddMcpUsage(p)), M = yield D(d.generateContentStreamInternal(x)), R = [], U = [];
|
|
7320
7320
|
try {
|
|
7321
|
-
for (var _ = !0, v = (m = void 0,
|
|
7321
|
+
for (var _ = !0, v = (m = void 0, Q(M)), I; I = yield D(v.next()), h = I.done, !h; _ = !0) {
|
|
7322
7322
|
C = I.value, _ = !1;
|
|
7323
7323
|
const A = C;
|
|
7324
7324
|
if (yield yield D(A), A.candidates && (!((T = A.candidates[0]) === null || T === void 0) && T.content)) {
|
|
7325
|
-
|
|
7325
|
+
U.push(A.candidates[0].content);
|
|
7326
7326
|
for (const P of (E = A.candidates[0].content.parts) !== null && E !== void 0 ? E : [])
|
|
7327
7327
|
if (u < l && P.functionCall) {
|
|
7328
7328
|
if (!P.functionCall.name)
|
|
@@ -7356,11 +7356,11 @@ class Su extends ee {
|
|
|
7356
7356
|
}
|
|
7357
7357
|
], yield yield D(A);
|
|
7358
7358
|
const P = [];
|
|
7359
|
-
P.push(...
|
|
7359
|
+
P.push(...U), P.push({
|
|
7360
7360
|
role: "user",
|
|
7361
7361
|
parts: R
|
|
7362
7362
|
});
|
|
7363
|
-
const L =
|
|
7363
|
+
const L = z(p.contents).concat(P);
|
|
7364
7364
|
p.contents = L;
|
|
7365
7365
|
} else
|
|
7366
7366
|
break;
|
|
@@ -7422,10 +7422,10 @@ class Su extends ee {
|
|
|
7422
7422
|
httpOptions: (n = e.config) === null || n === void 0 ? void 0 : n.httpOptions,
|
|
7423
7423
|
abortSignal: (o = e.config) === null || o === void 0 ? void 0 : o.abortSignal
|
|
7424
7424
|
}), a.then(function(p) {
|
|
7425
|
-
return
|
|
7425
|
+
return X(this, arguments, function* () {
|
|
7426
7426
|
var h, m, y, C;
|
|
7427
7427
|
try {
|
|
7428
|
-
for (var T = !0, E =
|
|
7428
|
+
for (var T = !0, E = Q(p), _; _ = yield D(E.next()), h = _.done, !h; T = !0) {
|
|
7429
7429
|
C = _.value, T = !1;
|
|
7430
7430
|
const v = C, I = Vn(yield D(v.json()));
|
|
7431
7431
|
I.sdkHttpResponse = {
|
|
@@ -7455,10 +7455,10 @@ class Su extends ee {
|
|
|
7455
7455
|
httpOptions: (s = e.config) === null || s === void 0 ? void 0 : s.httpOptions,
|
|
7456
7456
|
abortSignal: (l = e.config) === null || l === void 0 ? void 0 : l.abortSignal
|
|
7457
7457
|
}), a.then(function(p) {
|
|
7458
|
-
return
|
|
7458
|
+
return X(this, arguments, function* () {
|
|
7459
7459
|
var h, m, y, C;
|
|
7460
7460
|
try {
|
|
7461
|
-
for (var T = !0, E =
|
|
7461
|
+
for (var T = !0, E = Q(p), _; _ = yield D(E.next()), h = _.done, !h; T = !0) {
|
|
7462
7462
|
C = _.value, T = !1;
|
|
7463
7463
|
const v = C, I = Gn(yield D(v.json()));
|
|
7464
7464
|
I.sdkHttpResponse = {
|
|
@@ -8043,7 +8043,7 @@ class Su extends ee {
|
|
|
8043
8043
|
* Copyright 2025 Google LLC
|
|
8044
8044
|
* SPDX-License-Identifier: Apache-2.0
|
|
8045
8045
|
*/
|
|
8046
|
-
class Au extends
|
|
8046
|
+
class Au extends te {
|
|
8047
8047
|
constructor(e) {
|
|
8048
8048
|
super(), this.apiClient = e;
|
|
8049
8049
|
}
|
|
@@ -8190,7 +8190,7 @@ function Ru(t, e, n) {
|
|
|
8190
8190
|
const u = i(e, [
|
|
8191
8191
|
"liveConnectConstraints"
|
|
8192
8192
|
]);
|
|
8193
|
-
n !== void 0 && u != null && r(n, ["bidiGenerateContentSetup"],
|
|
8193
|
+
n !== void 0 && u != null && r(n, ["bidiGenerateContentSetup"], bu(t, u));
|
|
8194
8194
|
const c = i(e, [
|
|
8195
8195
|
"lockAdditionalFields"
|
|
8196
8196
|
]);
|
|
@@ -8239,7 +8239,7 @@ function Du(t) {
|
|
|
8239
8239
|
]);
|
|
8240
8240
|
return n != null && r(e, ["timeRangeFilter"], n), e;
|
|
8241
8241
|
}
|
|
8242
|
-
function
|
|
8242
|
+
function Uu(t, e) {
|
|
8243
8243
|
const n = {}, o = i(t, [
|
|
8244
8244
|
"generationConfig"
|
|
8245
8245
|
]);
|
|
@@ -8308,11 +8308,11 @@ function bu(t, e) {
|
|
|
8308
8308
|
throw new Error("explicitVadSignal parameter is not supported in Gemini API.");
|
|
8309
8309
|
return n;
|
|
8310
8310
|
}
|
|
8311
|
-
function
|
|
8311
|
+
function bu(t, e) {
|
|
8312
8312
|
const n = {}, o = i(e, ["model"]);
|
|
8313
8313
|
o != null && r(n, ["setup", "model"], F(t, o));
|
|
8314
8314
|
const s = i(e, ["config"]);
|
|
8315
|
-
return s != null && r(n, ["config"],
|
|
8315
|
+
return s != null && r(n, ["config"], Uu(s, n)), n;
|
|
8316
8316
|
}
|
|
8317
8317
|
function Lu(t) {
|
|
8318
8318
|
const e = {}, n = i(t, [
|
|
@@ -8436,7 +8436,7 @@ function qu(t, e) {
|
|
|
8436
8436
|
s !== null && Array.isArray(s) && s.length > 0 ? t.fieldMask = s.join(",") : delete t.fieldMask;
|
|
8437
8437
|
return t;
|
|
8438
8438
|
}
|
|
8439
|
-
class Hu extends
|
|
8439
|
+
class Hu extends te {
|
|
8440
8440
|
constructor(e) {
|
|
8441
8441
|
super(), this.apiClient = e;
|
|
8442
8442
|
}
|
|
@@ -8595,9 +8595,9 @@ function Ku(t) {
|
|
|
8595
8595
|
* Copyright 2025 Google LLC
|
|
8596
8596
|
* SPDX-License-Identifier: Apache-2.0
|
|
8597
8597
|
*/
|
|
8598
|
-
class zu extends
|
|
8598
|
+
class zu extends te {
|
|
8599
8599
|
constructor(e) {
|
|
8600
|
-
super(), this.apiClient = e, this.list = async (n) => new
|
|
8600
|
+
super(), this.apiClient = e, this.list = async (n) => new le(ee.PAGED_ITEM_DOCUMENTS, (o) => this.listInternal({ parent: n.parent, config: o.config }), await this.listInternal(n), n);
|
|
8601
8601
|
}
|
|
8602
8602
|
/**
|
|
8603
8603
|
* Gets a Document.
|
|
@@ -8670,9 +8670,9 @@ class zu extends ee {
|
|
|
8670
8670
|
* Copyright 2025 Google LLC
|
|
8671
8671
|
* SPDX-License-Identifier: Apache-2.0
|
|
8672
8672
|
*/
|
|
8673
|
-
class Ou extends
|
|
8673
|
+
class Ou extends te {
|
|
8674
8674
|
constructor(e, n = new zu(e)) {
|
|
8675
|
-
super(), this.apiClient = e, this.documents = n, this.list = async (o = {}) => new
|
|
8675
|
+
super(), this.apiClient = e, this.documents = n, this.list = async (o = {}) => new le(ee.PAGED_ITEM_FILE_SEARCH_STORES, (s) => this.listInternal(s), await this.listInternal(o), o);
|
|
8676
8676
|
}
|
|
8677
8677
|
/**
|
|
8678
8678
|
* Uploads a file asynchronously to a given File Search Store.
|
|
@@ -8898,9 +8898,9 @@ const nt = (t) => {
|
|
|
8898
8898
|
* Copyright 2025 Google LLC
|
|
8899
8899
|
* SPDX-License-Identifier: Apache-2.0
|
|
8900
8900
|
*/
|
|
8901
|
-
class
|
|
8901
|
+
class O extends Error {
|
|
8902
8902
|
}
|
|
8903
|
-
class W extends
|
|
8903
|
+
class W extends O {
|
|
8904
8904
|
constructor(e, n, o, s) {
|
|
8905
8905
|
super(`${W.makeMessage(e, n, o)}`), this.status = e, this.headers = s, this.error = n;
|
|
8906
8906
|
}
|
|
@@ -8912,7 +8912,7 @@ class W extends z {
|
|
|
8912
8912
|
if (!e || !s)
|
|
8913
8913
|
return new qe({ message: o, cause: nt(n) });
|
|
8914
8914
|
const l = n;
|
|
8915
|
-
return e === 400 ? new Do(e, l, o, s) : e === 401 ? new
|
|
8915
|
+
return e === 400 ? new Do(e, l, o, s) : e === 401 ? new Uo(e, l, o, s) : e === 403 ? new bo(e, l, o, s) : e === 404 ? new Lo(e, l, o, s) : e === 409 ? new Fo(e, l, o, s) : e === 422 ? new Go(e, l, o, s) : e === 429 ? new Vo(e, l, o, s) : e >= 500 ? new qo(e, l, o, s) : new W(e, l, o, s);
|
|
8916
8916
|
}
|
|
8917
8917
|
}
|
|
8918
8918
|
class ot extends W {
|
|
@@ -8932,10 +8932,10 @@ class ko extends qe {
|
|
|
8932
8932
|
}
|
|
8933
8933
|
class Do extends W {
|
|
8934
8934
|
}
|
|
8935
|
-
class bo extends W {
|
|
8936
|
-
}
|
|
8937
8935
|
class Uo extends W {
|
|
8938
8936
|
}
|
|
8937
|
+
class bo extends W {
|
|
8938
|
+
}
|
|
8939
8939
|
class Lo extends W {
|
|
8940
8940
|
}
|
|
8941
8941
|
class Fo extends W {
|
|
@@ -8968,9 +8968,9 @@ function nd(t, e) {
|
|
|
8968
8968
|
}
|
|
8969
8969
|
const od = (t, e) => {
|
|
8970
8970
|
if (typeof e != "number" || !Number.isInteger(e))
|
|
8971
|
-
throw new
|
|
8971
|
+
throw new O(`${t} must be an integer`);
|
|
8972
8972
|
if (e < 0)
|
|
8973
|
-
throw new
|
|
8973
|
+
throw new O(`${t} must be a positive integer`);
|
|
8974
8974
|
return e;
|
|
8975
8975
|
}, id = (t) => {
|
|
8976
8976
|
try {
|
|
@@ -9193,7 +9193,7 @@ async function st(t) {
|
|
|
9193
9193
|
a.push(t instanceof Blob ? t : await t.arrayBuffer());
|
|
9194
9194
|
else if (md(t))
|
|
9195
9195
|
try {
|
|
9196
|
-
for (var u = !0, c =
|
|
9196
|
+
for (var u = !0, c = Q(t), d; d = await c.next(), e = d.done, !e; u = !0) {
|
|
9197
9197
|
s = d.value, u = !1;
|
|
9198
9198
|
const f = s;
|
|
9199
9199
|
a.push(...await st(f));
|
|
@@ -9264,7 +9264,7 @@ const zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null)), E
|
|
|
9264
9264
|
const y = " ".repeat(m.start - f), C = "^".repeat(m.length);
|
|
9265
9265
|
return f = m.start + m.length, h + y + C;
|
|
9266
9266
|
}, "");
|
|
9267
|
-
throw new
|
|
9267
|
+
throw new O(`Path parameters result in path with invalid segments:
|
|
9268
9268
|
${l.map((h) => h.error).join(`
|
|
9269
9269
|
`)}
|
|
9270
9270
|
${a}
|
|
@@ -9282,9 +9282,9 @@ class Ko extends Wo {
|
|
|
9282
9282
|
var o;
|
|
9283
9283
|
const { api_version: s = this._client.apiVersion } = e, l = ke(e, ["api_version"]);
|
|
9284
9284
|
if ("model" in l && "agent_config" in l)
|
|
9285
|
-
throw new
|
|
9285
|
+
throw new O("Invalid request: specified `model` and `agent_config`. If specifying `model`, use `generation_config`.");
|
|
9286
9286
|
if ("agent" in l && "generation_config" in l)
|
|
9287
|
-
throw new
|
|
9287
|
+
throw new O("Invalid request: specified `agent` and `generation_config`. If specifying `agent`, use `agent_config`.");
|
|
9288
9288
|
return this._client.post(Ie`/${s}/interactions`, Object.assign(Object.assign({ body: l }, n), { stream: (o = e.stream) !== null && o !== void 0 ? o : !1 }));
|
|
9289
9289
|
}
|
|
9290
9290
|
/**
|
|
@@ -9447,7 +9447,7 @@ function $(t) {
|
|
|
9447
9447
|
};
|
|
9448
9448
|
return Qn.set(n, [o, l]), l;
|
|
9449
9449
|
}
|
|
9450
|
-
const
|
|
9450
|
+
const re = (t) => (t.options && (t.options = Object.assign({}, t.options), delete t.options.headers), t.headers && (t.headers = Object.fromEntries((t.headers instanceof Headers ? [...t.headers] : Object.entries(t.headers)).map(([e, n]) => [
|
|
9451
9451
|
e,
|
|
9452
9452
|
e.toLowerCase() === "x-goog-api-key" || e.toLowerCase() === "authorization" || e.toLowerCase() === "cookie" || e.toLowerCase() === "set-cookie" ? "***" : n
|
|
9453
9453
|
]))), "retryOfRequestLogID" in t && (t.retryOfRequestLogID && (t.retryOf = t.retryOfRequestLogID), delete t.retryOfRequestLogID), t);
|
|
@@ -9464,15 +9464,15 @@ class de {
|
|
|
9464
9464
|
let s = !1;
|
|
9465
9465
|
const l = o ? $(o) : console;
|
|
9466
9466
|
function a() {
|
|
9467
|
-
return
|
|
9467
|
+
return X(this, arguments, function* () {
|
|
9468
9468
|
var c, d, f, p;
|
|
9469
9469
|
if (s)
|
|
9470
|
-
throw new
|
|
9470
|
+
throw new O("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");
|
|
9471
9471
|
s = !0;
|
|
9472
9472
|
let h = !1;
|
|
9473
9473
|
try {
|
|
9474
9474
|
try {
|
|
9475
|
-
for (var m = !0, y =
|
|
9475
|
+
for (var m = !0, y = Q(Ad(e, n)), C; C = yield D(y.next()), c = C.done, !c; m = !0) {
|
|
9476
9476
|
p = C.value, m = !1;
|
|
9477
9477
|
const T = p;
|
|
9478
9478
|
if (!h)
|
|
@@ -9514,11 +9514,11 @@ class de {
|
|
|
9514
9514
|
static fromReadableStream(e, n, o) {
|
|
9515
9515
|
let s = !1;
|
|
9516
9516
|
function l() {
|
|
9517
|
-
return
|
|
9517
|
+
return X(this, arguments, function* () {
|
|
9518
9518
|
var c, d, f, p;
|
|
9519
9519
|
const h = new He(), m = Bo(e);
|
|
9520
9520
|
try {
|
|
9521
|
-
for (var y = !0, C =
|
|
9521
|
+
for (var y = !0, C = Q(m), T; T = yield D(C.next()), c = T.done, !c; y = !0) {
|
|
9522
9522
|
p = T.value, y = !1;
|
|
9523
9523
|
const E = p;
|
|
9524
9524
|
for (const _ of h.decode(E))
|
|
@@ -9538,15 +9538,15 @@ class de {
|
|
|
9538
9538
|
});
|
|
9539
9539
|
}
|
|
9540
9540
|
function a() {
|
|
9541
|
-
return
|
|
9541
|
+
return X(this, arguments, function* () {
|
|
9542
9542
|
var c, d, f, p;
|
|
9543
9543
|
if (s)
|
|
9544
|
-
throw new
|
|
9544
|
+
throw new O("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");
|
|
9545
9545
|
s = !0;
|
|
9546
9546
|
let h = !1;
|
|
9547
9547
|
try {
|
|
9548
9548
|
try {
|
|
9549
|
-
for (var m = !0, y =
|
|
9549
|
+
for (var m = !0, y = Q(l()), C; C = yield D(y.next()), c = C.done, !c; m = !0) {
|
|
9550
9550
|
p = C.value, m = !1;
|
|
9551
9551
|
const T = p;
|
|
9552
9552
|
h || T && (yield yield D(JSON.parse(T)));
|
|
@@ -9626,13 +9626,13 @@ class de {
|
|
|
9626
9626
|
}
|
|
9627
9627
|
}
|
|
9628
9628
|
function Ad(t, e) {
|
|
9629
|
-
return
|
|
9629
|
+
return X(this, arguments, function* () {
|
|
9630
9630
|
var o, s, l, a;
|
|
9631
9631
|
if (!t.body)
|
|
9632
|
-
throw e.abort(), typeof globalThis.navigator < "u" && globalThis.navigator.product === "ReactNative" ? new
|
|
9632
|
+
throw e.abort(), typeof globalThis.navigator < "u" && globalThis.navigator.product === "ReactNative" ? new O("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api") : new O("Attempted to iterate over a response with no body");
|
|
9633
9633
|
const u = new wd(), c = new He(), d = Bo(t.body);
|
|
9634
9634
|
try {
|
|
9635
|
-
for (var f = !0, p =
|
|
9635
|
+
for (var f = !0, p = Q(xd(d)), h; h = yield D(p.next()), o = h.done, !o; f = !0) {
|
|
9636
9636
|
a = h.value, f = !1;
|
|
9637
9637
|
const m = a;
|
|
9638
9638
|
for (const y of c.decode(m)) {
|
|
@@ -9656,11 +9656,11 @@ function Ad(t, e) {
|
|
|
9656
9656
|
});
|
|
9657
9657
|
}
|
|
9658
9658
|
function xd(t) {
|
|
9659
|
-
return
|
|
9659
|
+
return X(this, arguments, function* () {
|
|
9660
9660
|
var n, o, s, l;
|
|
9661
9661
|
let a = new Uint8Array();
|
|
9662
9662
|
try {
|
|
9663
|
-
for (var u = !0, c =
|
|
9663
|
+
for (var u = !0, c = Q(t), d; d = yield D(c.next()), n = d.done, !n; u = !0) {
|
|
9664
9664
|
l = d.value, u = !1;
|
|
9665
9665
|
const f = l;
|
|
9666
9666
|
if (f == null)
|
|
@@ -9727,7 +9727,7 @@ async function Nd(t, e) {
|
|
|
9727
9727
|
const c = n.headers.get("content-type"), d = (u = c == null ? void 0 : c.split(";")[0]) === null || u === void 0 ? void 0 : u.trim();
|
|
9728
9728
|
return (d == null ? void 0 : d.includes("application/json")) || (d == null ? void 0 : d.endsWith("+json")) ? await n.json() : await n.text();
|
|
9729
9729
|
})();
|
|
9730
|
-
return $(t).debug(`[${o}] response parsed`,
|
|
9730
|
+
return $(t).debug(`[${o}] response parsed`, re({
|
|
9731
9731
|
retryOfRequestLogID: s,
|
|
9732
9732
|
url: n.url,
|
|
9733
9733
|
status: n.status,
|
|
@@ -9908,7 +9908,7 @@ class Be {
|
|
|
9908
9908
|
return `${encodeURIComponent(n)}=${encodeURIComponent(o)}`;
|
|
9909
9909
|
if (o === null)
|
|
9910
9910
|
return `${encodeURIComponent(n)}=`;
|
|
9911
|
-
throw new
|
|
9911
|
+
throw new O(`Cannot stringify type ${typeof o}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`);
|
|
9912
9912
|
}).join("&");
|
|
9913
9913
|
}
|
|
9914
9914
|
getUserAgent() {
|
|
@@ -9972,7 +9972,7 @@ class Be {
|
|
|
9972
9972
|
});
|
|
9973
9973
|
await this.prepareRequest(d, { url: f, options: u });
|
|
9974
9974
|
const h = "log_" + (Math.random() * (1 << 24) | 0).toString(16).padStart(6, "0"), m = o === void 0 ? "" : `, retryOf: ${o}`, y = Date.now();
|
|
9975
|
-
if ($(this).debug(`[${h}] sending request`,
|
|
9975
|
+
if ($(this).debug(`[${h}] sending request`, re({
|
|
9976
9976
|
retryOfRequestLogID: o,
|
|
9977
9977
|
method: u.method,
|
|
9978
9978
|
url: f,
|
|
@@ -9987,13 +9987,13 @@ class Be {
|
|
|
9987
9987
|
throw new ot();
|
|
9988
9988
|
const I = tt(T) || /timed? ?out/i.test(String(T) + ("cause" in T ? String(T.cause) : ""));
|
|
9989
9989
|
if (n)
|
|
9990
|
-
return $(this).info(`[${h}] connection ${I ? "timed out" : "failed"} - ${v}`), $(this).debug(`[${h}] connection ${I ? "timed out" : "failed"} (${v})`,
|
|
9990
|
+
return $(this).info(`[${h}] connection ${I ? "timed out" : "failed"} - ${v}`), $(this).debug(`[${h}] connection ${I ? "timed out" : "failed"} (${v})`, re({
|
|
9991
9991
|
retryOfRequestLogID: o,
|
|
9992
9992
|
url: f,
|
|
9993
9993
|
durationMs: E - y,
|
|
9994
9994
|
message: T.message
|
|
9995
9995
|
})), this.retryRequest(u, n, o ?? h);
|
|
9996
|
-
throw $(this).info(`[${h}] connection ${I ? "timed out" : "failed"} - error; no more retries left`), $(this).debug(`[${h}] connection ${I ? "timed out" : "failed"} (error; no more retries left)`,
|
|
9996
|
+
throw $(this).info(`[${h}] connection ${I ? "timed out" : "failed"} - error; no more retries left`), $(this).debug(`[${h}] connection ${I ? "timed out" : "failed"} (error; no more retries left)`, re({
|
|
9997
9997
|
retryOfRequestLogID: o,
|
|
9998
9998
|
url: f,
|
|
9999
9999
|
durationMs: E - y,
|
|
@@ -10005,7 +10005,7 @@ class Be {
|
|
|
10005
10005
|
const v = await this.shouldRetry(T);
|
|
10006
10006
|
if (n && v) {
|
|
10007
10007
|
const A = `retrying, ${n} attempts remaining`;
|
|
10008
|
-
return await fd(T.body), $(this).info(`${_} - ${A}`), $(this).debug(`[${h}] response error (${A})`,
|
|
10008
|
+
return await fd(T.body), $(this).info(`${_} - ${A}`), $(this).debug(`[${h}] response error (${A})`, re({
|
|
10009
10009
|
retryOfRequestLogID: o,
|
|
10010
10010
|
url: T.url,
|
|
10011
10011
|
status: T.status,
|
|
@@ -10016,7 +10016,7 @@ class Be {
|
|
|
10016
10016
|
const I = v ? "error; no more retries left" : "error; not retryable";
|
|
10017
10017
|
$(this).info(`${_} - ${I}`);
|
|
10018
10018
|
const x = await T.text().catch((A) => nt(A).message), M = id(x), R = M ? void 0 : x;
|
|
10019
|
-
throw $(this).debug(`[${h}] response error (${I})`,
|
|
10019
|
+
throw $(this).debug(`[${h}] response error (${I})`, re({
|
|
10020
10020
|
retryOfRequestLogID: o,
|
|
10021
10021
|
url: T.url,
|
|
10022
10022
|
status: T.status,
|
|
@@ -10025,7 +10025,7 @@ class Be {
|
|
|
10025
10025
|
durationMs: Date.now() - y
|
|
10026
10026
|
})), this.makeStatusError(T.status, M, R, T.headers);
|
|
10027
10027
|
}
|
|
10028
|
-
return $(this).info(_), $(this).debug(`[${h}] response start`,
|
|
10028
|
+
return $(this).info(_), $(this).debug(`[${h}] response start`, re({
|
|
10029
10029
|
retryOfRequestLogID: o,
|
|
10030
10030
|
url: T.url,
|
|
10031
10031
|
status: T.status,
|
|
@@ -10115,7 +10115,7 @@ class B extends Be {
|
|
|
10115
10115
|
}
|
|
10116
10116
|
Xo = B;
|
|
10117
10117
|
B.GeminiNextGenAPIClient = Xo;
|
|
10118
|
-
B.GeminiNextGenAPIClientError =
|
|
10118
|
+
B.GeminiNextGenAPIClientError = O;
|
|
10119
10119
|
B.APIError = W;
|
|
10120
10120
|
B.APIConnectionError = qe;
|
|
10121
10121
|
B.APIConnectionTimeoutError = ko;
|
|
@@ -10124,9 +10124,9 @@ B.NotFoundError = Lo;
|
|
|
10124
10124
|
B.ConflictError = Fo;
|
|
10125
10125
|
B.RateLimitError = Vo;
|
|
10126
10126
|
B.BadRequestError = Do;
|
|
10127
|
-
B.AuthenticationError =
|
|
10127
|
+
B.AuthenticationError = Uo;
|
|
10128
10128
|
B.InternalServerError = qo;
|
|
10129
|
-
B.PermissionDeniedError =
|
|
10129
|
+
B.PermissionDeniedError = bo;
|
|
10130
10130
|
B.UnprocessableEntityError = Go;
|
|
10131
10131
|
B.toFile = Td;
|
|
10132
10132
|
B.Interactions = zo;
|
|
@@ -10149,13 +10149,13 @@ function Dd(t, e) {
|
|
|
10149
10149
|
]);
|
|
10150
10150
|
return o != null && r(n, ["sdkHttpResponse"], o), n;
|
|
10151
10151
|
}
|
|
10152
|
-
function
|
|
10152
|
+
function Ud(t, e) {
|
|
10153
10153
|
const n = {}, o = i(t, [
|
|
10154
10154
|
"sdkHttpResponse"
|
|
10155
10155
|
]);
|
|
10156
10156
|
return o != null && r(n, ["sdkHttpResponse"], o), n;
|
|
10157
10157
|
}
|
|
10158
|
-
function
|
|
10158
|
+
function bd(t, e, n) {
|
|
10159
10159
|
const o = {};
|
|
10160
10160
|
if (i(t, ["validationDataset"]) !== void 0)
|
|
10161
10161
|
throw new Error("validationDataset parameter is not supported in Gemini API.");
|
|
@@ -10281,7 +10281,7 @@ function Fd(t, e) {
|
|
|
10281
10281
|
]);
|
|
10282
10282
|
l != null && zd(l);
|
|
10283
10283
|
const a = i(t, ["config"]);
|
|
10284
|
-
return a != null &&
|
|
10284
|
+
return a != null && bd(a, n), n;
|
|
10285
10285
|
}
|
|
10286
10286
|
function Gd(t, e) {
|
|
10287
10287
|
const n = {}, o = i(t, ["baseModel"]);
|
|
@@ -10501,8 +10501,8 @@ function rt(t, e) {
|
|
|
10501
10501
|
M != null && r(n, ["labels"], M);
|
|
10502
10502
|
const R = i(t, ["outputUri"]);
|
|
10503
10503
|
R != null && r(n, ["outputUri"], R);
|
|
10504
|
-
const
|
|
10505
|
-
|
|
10504
|
+
const U = i(t, ["pipelineJob"]);
|
|
10505
|
+
U != null && r(n, ["pipelineJob"], U);
|
|
10506
10506
|
const A = i(t, [
|
|
10507
10507
|
"serviceAccount"
|
|
10508
10508
|
]);
|
|
@@ -10543,9 +10543,9 @@ function Zn(t, e) {
|
|
|
10543
10543
|
* Copyright 2025 Google LLC
|
|
10544
10544
|
* SPDX-License-Identifier: Apache-2.0
|
|
10545
10545
|
*/
|
|
10546
|
-
class Qd extends
|
|
10546
|
+
class Qd extends te {
|
|
10547
10547
|
constructor(e) {
|
|
10548
|
-
super(), this.apiClient = e, this.list = async (n = {}) => new
|
|
10548
|
+
super(), this.apiClient = e, this.list = async (n = {}) => new le(ee.PAGED_ITEM_TUNING_JOBS, (o) => this.listInternal(o), await this.listInternal(n), n), this.get = async (n) => await this.getInternal(n), this.tune = async (n) => {
|
|
10549
10549
|
var o;
|
|
10550
10550
|
if (this.apiClient.isVertexAI())
|
|
10551
10551
|
if (n.baseModel.startsWith("projects/")) {
|
|
@@ -10674,7 +10674,7 @@ class Qd extends ee {
|
|
|
10674
10674
|
headers: f.headers
|
|
10675
10675
|
}, h;
|
|
10676
10676
|
})), a.then((f) => {
|
|
10677
|
-
const p =
|
|
10677
|
+
const p = Ud(f), h = new An();
|
|
10678
10678
|
return Object.assign(h, p), h;
|
|
10679
10679
|
});
|
|
10680
10680
|
} else {
|
|
@@ -10751,18 +10751,18 @@ class Zd {
|
|
|
10751
10751
|
throw new Error("Download to file is not supported in the browser, please use a browser compliant download like an <a> tag.");
|
|
10752
10752
|
}
|
|
10753
10753
|
}
|
|
10754
|
-
const jd = 1024 * 1024 * 8, ec = 3, tc = 1e3, nc = 2,
|
|
10754
|
+
const jd = 1024 * 1024 * 8, ec = 3, tc = 1e3, nc = 2, Ue = "x-goog-upload-status";
|
|
10755
10755
|
async function oc(t, e, n) {
|
|
10756
10756
|
var o;
|
|
10757
10757
|
const s = await Zo(t, e, n), l = await (s == null ? void 0 : s.json());
|
|
10758
|
-
if (((o = s == null ? void 0 : s.headers) === null || o === void 0 ? void 0 : o[
|
|
10758
|
+
if (((o = s == null ? void 0 : s.headers) === null || o === void 0 ? void 0 : o[Ue]) !== "final")
|
|
10759
10759
|
throw new Error("Failed to upload file: Upload status is not finalized.");
|
|
10760
10760
|
return l.file;
|
|
10761
10761
|
}
|
|
10762
10762
|
async function ic(t, e, n) {
|
|
10763
10763
|
var o;
|
|
10764
10764
|
const s = await Zo(t, e, n), l = await (s == null ? void 0 : s.json());
|
|
10765
|
-
if (((o = s == null ? void 0 : s.headers) === null || o === void 0 ? void 0 : o[
|
|
10765
|
+
if (((o = s == null ? void 0 : s.headers) === null || o === void 0 ? void 0 : o[Ue]) !== "final")
|
|
10766
10766
|
throw new Error("Failed to upload file: Upload status is not finalized.");
|
|
10767
10767
|
const a = ro(l), u = new ut();
|
|
10768
10768
|
return Object.assign(u, a), u;
|
|
@@ -10787,9 +10787,9 @@ async function Zo(t, e, n) {
|
|
|
10787
10787
|
"Content-Length": String(d)
|
|
10788
10788
|
}
|
|
10789
10789
|
}
|
|
10790
|
-
}), !(!((o = u == null ? void 0 : u.headers) === null || o === void 0) && o[
|
|
10790
|
+
}), !(!((o = u == null ? void 0 : u.headers) === null || o === void 0) && o[Ue])); )
|
|
10791
10791
|
p++, await rc(h), h = h * nc;
|
|
10792
|
-
if (a += d, ((s = u == null ? void 0 : u.headers) === null || s === void 0 ? void 0 : s[
|
|
10792
|
+
if (a += d, ((s = u == null ? void 0 : u.headers) === null || s === void 0 ? void 0 : s[Ue]) !== "active")
|
|
10793
10793
|
break;
|
|
10794
10794
|
if (l <= a)
|
|
10795
10795
|
throw new Error("All content has been uploaded, but the upload status is not finalized.");
|
|
@@ -10917,7 +10917,7 @@ class fc {
|
|
|
10917
10917
|
userAgentExtra: cc + "web",
|
|
10918
10918
|
uploader: new lc(),
|
|
10919
10919
|
downloader: new Zd()
|
|
10920
|
-
}), this.models = new Su(this.apiClient), this.live = new Tu(this.apiClient, s, new ac()), this.batches = new
|
|
10920
|
+
}), this.models = new Su(this.apiClient), this.live = new Tu(this.apiClient, s, new ac()), this.batches = new bs(this.apiClient), this.chats = new gr(this.models, this.apiClient), this.caches = new pr(this.apiClient), this.files = new xr(this.apiClient), this.operations = new Au(this.apiClient), this.authTokens = new Hu(this.apiClient), this.tunings = new Qd(this.apiClient), this.fileSearchStores = new Ou(this.apiClient);
|
|
10921
10921
|
}
|
|
10922
10922
|
}
|
|
10923
10923
|
const pc = async (t, e) => {
|
|
@@ -11348,7 +11348,7 @@ var xc = {
|
|
|
11348
11348
|
* This source code is licensed under the ISC license.
|
|
11349
11349
|
* See the LICENSE file in the root directory of this source tree.
|
|
11350
11350
|
*/
|
|
11351
|
-
const wc =
|
|
11351
|
+
const wc = be(
|
|
11352
11352
|
({
|
|
11353
11353
|
color: t = "currentColor",
|
|
11354
11354
|
size: e = 24,
|
|
@@ -11383,8 +11383,8 @@ const wc = Ue(
|
|
|
11383
11383
|
* This source code is licensed under the ISC license.
|
|
11384
11384
|
* See the LICENSE file in the root directory of this source tree.
|
|
11385
11385
|
*/
|
|
11386
|
-
const
|
|
11387
|
-
const n =
|
|
11386
|
+
const Y = (t, e) => {
|
|
11387
|
+
const n = be(
|
|
11388
11388
|
({ className: o, ...s }, l) => Ye(wc, {
|
|
11389
11389
|
ref: l,
|
|
11390
11390
|
iconNode: e,
|
|
@@ -11405,6 +11405,27 @@ const le = (t, e) => {
|
|
|
11405
11405
|
* See the LICENSE file in the root directory of this source tree.
|
|
11406
11406
|
*/
|
|
11407
11407
|
const Rc = [
|
|
11408
|
+
["path", { d: "m9 11-6 6v3h9l3-3", key: "1a3l36" }],
|
|
11409
|
+
["path", { d: "m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4", key: "14a9rk" }]
|
|
11410
|
+
], Nc = Y("highlighter", Rc);
|
|
11411
|
+
/**
|
|
11412
|
+
* @license lucide-react v0.562.0 - ISC
|
|
11413
|
+
*
|
|
11414
|
+
* This source code is licensed under the ISC license.
|
|
11415
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11416
|
+
*/
|
|
11417
|
+
const Mc = [
|
|
11418
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
|
|
11419
|
+
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
|
|
11420
|
+
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
|
|
11421
|
+
], Pc = Y("image", Mc);
|
|
11422
|
+
/**
|
|
11423
|
+
* @license lucide-react v0.562.0 - ISC
|
|
11424
|
+
*
|
|
11425
|
+
* This source code is licensed under the ISC license.
|
|
11426
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11427
|
+
*/
|
|
11428
|
+
const kc = [
|
|
11408
11429
|
["path", { d: "M10 8h.01", key: "1r9ogq" }],
|
|
11409
11430
|
["path", { d: "M12 12h.01", key: "1mp3jc" }],
|
|
11410
11431
|
["path", { d: "M14 8h.01", key: "1primd" }],
|
|
@@ -11414,21 +11435,68 @@ const Rc = [
|
|
|
11414
11435
|
["path", { d: "M7 16h10", key: "wp8him" }],
|
|
11415
11436
|
["path", { d: "M8 12h.01", key: "czm47f" }],
|
|
11416
11437
|
["rect", { width: "20", height: "16", x: "2", y: "4", rx: "2", key: "18n3k1" }]
|
|
11417
|
-
],
|
|
11438
|
+
], Dc = Y("keyboard", kc);
|
|
11418
11439
|
/**
|
|
11419
11440
|
* @license lucide-react v0.562.0 - ISC
|
|
11420
11441
|
*
|
|
11421
11442
|
* This source code is licensed under the ISC license.
|
|
11422
11443
|
* See the LICENSE file in the root directory of this source tree.
|
|
11423
11444
|
*/
|
|
11424
|
-
const
|
|
11445
|
+
const Uc = [
|
|
11446
|
+
["path", { d: "M11 5h10", key: "1cz7ny" }],
|
|
11447
|
+
["path", { d: "M11 12h10", key: "1438ji" }],
|
|
11448
|
+
["path", { d: "M11 19h10", key: "11t30w" }],
|
|
11449
|
+
["path", { d: "M4 4h1v5", key: "10yrso" }],
|
|
11450
|
+
["path", { d: "M4 9h2", key: "r1h2o0" }],
|
|
11451
|
+
["path", { d: "M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02", key: "xtkcd5" }]
|
|
11452
|
+
], bc = Y("list-ordered", Uc);
|
|
11425
11453
|
/**
|
|
11426
11454
|
* @license lucide-react v0.562.0 - ISC
|
|
11427
11455
|
*
|
|
11428
11456
|
* This source code is licensed under the ISC license.
|
|
11429
11457
|
* See the LICENSE file in the root directory of this source tree.
|
|
11430
11458
|
*/
|
|
11431
|
-
const
|
|
11459
|
+
const Lc = [
|
|
11460
|
+
["path", { d: "M3 5h.01", key: "18ugdj" }],
|
|
11461
|
+
["path", { d: "M3 12h.01", key: "nlz23k" }],
|
|
11462
|
+
["path", { d: "M3 19h.01", key: "noohij" }],
|
|
11463
|
+
["path", { d: "M8 5h13", key: "1pao27" }],
|
|
11464
|
+
["path", { d: "M8 12h13", key: "1za7za" }],
|
|
11465
|
+
["path", { d: "M8 19h13", key: "m83p4d" }]
|
|
11466
|
+
], Fc = Y("list", Lc);
|
|
11467
|
+
/**
|
|
11468
|
+
* @license lucide-react v0.562.0 - ISC
|
|
11469
|
+
*
|
|
11470
|
+
* This source code is licensed under the ISC license.
|
|
11471
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11472
|
+
*/
|
|
11473
|
+
const Gc = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], Vc = Y("loader-circle", Gc);
|
|
11474
|
+
/**
|
|
11475
|
+
* @license lucide-react v0.562.0 - ISC
|
|
11476
|
+
*
|
|
11477
|
+
* This source code is licensed under the ISC license.
|
|
11478
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11479
|
+
*/
|
|
11480
|
+
const qc = [
|
|
11481
|
+
[
|
|
11482
|
+
"path",
|
|
11483
|
+
{
|
|
11484
|
+
d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",
|
|
11485
|
+
key: "e79jfc"
|
|
11486
|
+
}
|
|
11487
|
+
],
|
|
11488
|
+
["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
|
|
11489
|
+
["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
|
|
11490
|
+
["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
|
|
11491
|
+
["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
|
|
11492
|
+
], Hc = Y("palette", qc);
|
|
11493
|
+
/**
|
|
11494
|
+
* @license lucide-react v0.562.0 - ISC
|
|
11495
|
+
*
|
|
11496
|
+
* This source code is licensed under the ISC license.
|
|
11497
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11498
|
+
*/
|
|
11499
|
+
const Bc = [
|
|
11432
11500
|
[
|
|
11433
11501
|
"path",
|
|
11434
11502
|
{
|
|
@@ -11437,51 +11505,63 @@ const kc = [
|
|
|
11437
11505
|
}
|
|
11438
11506
|
],
|
|
11439
11507
|
["path", { d: "m15 5 4 4", key: "1mk7zo" }]
|
|
11440
|
-
],
|
|
11508
|
+
], Jc = Y("pencil", Bc);
|
|
11441
11509
|
/**
|
|
11442
11510
|
* @license lucide-react v0.562.0 - ISC
|
|
11443
11511
|
*
|
|
11444
11512
|
* This source code is licensed under the ISC license.
|
|
11445
11513
|
* See the LICENSE file in the root directory of this source tree.
|
|
11446
11514
|
*/
|
|
11447
|
-
const
|
|
11515
|
+
const $c = [
|
|
11448
11516
|
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
11449
11517
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
11450
|
-
],
|
|
11518
|
+
], Wc = Y("rotate-ccw", $c);
|
|
11451
11519
|
/**
|
|
11452
11520
|
* @license lucide-react v0.562.0 - ISC
|
|
11453
11521
|
*
|
|
11454
11522
|
* This source code is licensed under the ISC license.
|
|
11455
11523
|
* See the LICENSE file in the root directory of this source tree.
|
|
11456
11524
|
*/
|
|
11457
|
-
const
|
|
11525
|
+
const Yc = [
|
|
11458
11526
|
["path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8", key: "1p45f6" }],
|
|
11459
11527
|
["path", { d: "M21 3v5h-5", key: "1q7to0" }]
|
|
11460
|
-
],
|
|
11528
|
+
], Kc = Y("rotate-cw", Yc);
|
|
11461
11529
|
/**
|
|
11462
11530
|
* @license lucide-react v0.562.0 - ISC
|
|
11463
11531
|
*
|
|
11464
11532
|
* This source code is licensed under the ISC license.
|
|
11465
11533
|
* See the LICENSE file in the root directory of this source tree.
|
|
11466
11534
|
*/
|
|
11467
|
-
const
|
|
11535
|
+
const zc = [
|
|
11536
|
+
["path", { d: "M12 3v18", key: "108xh3" }],
|
|
11537
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
11538
|
+
["path", { d: "M3 9h18", key: "1pudct" }],
|
|
11539
|
+
["path", { d: "M3 15h18", key: "5xshup" }]
|
|
11540
|
+
], Oc = Y("table", zc);
|
|
11541
|
+
/**
|
|
11542
|
+
* @license lucide-react v0.562.0 - ISC
|
|
11543
|
+
*
|
|
11544
|
+
* This source code is licensed under the ISC license.
|
|
11545
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11546
|
+
*/
|
|
11547
|
+
const Xc = [
|
|
11468
11548
|
["path", { d: "M10 11v6", key: "nco0om" }],
|
|
11469
11549
|
["path", { d: "M14 11v6", key: "outv1u" }],
|
|
11470
11550
|
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
11471
11551
|
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
11472
11552
|
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
11473
|
-
],
|
|
11553
|
+
], Qc = Y("trash-2", Xc);
|
|
11474
11554
|
/**
|
|
11475
11555
|
* @license lucide-react v0.562.0 - ISC
|
|
11476
11556
|
*
|
|
11477
11557
|
* This source code is licensed under the ISC license.
|
|
11478
11558
|
* See the LICENSE file in the root directory of this source tree.
|
|
11479
11559
|
*/
|
|
11480
|
-
const
|
|
11560
|
+
const Zc = [
|
|
11481
11561
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
11482
11562
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
11483
|
-
],
|
|
11484
|
-
const s =
|
|
11563
|
+
], jc = Y("x", Zc), ef = ({ isOpen: t, onClose: e, onInsert: n, apiKey: o = "" }) => {
|
|
11564
|
+
const s = j(null), l = j(null), [a, u] = V(!1), [c, d] = V(null), [f, p] = V(""), [h, m] = V("keyboard"), [y, C] = V("math"), [T, E] = V(!1), [_, v] = V(!1), [I, x] = V(""), [M, R] = V(!1);
|
|
11485
11565
|
pe(() => {
|
|
11486
11566
|
if (h === "keyboard" && f.trim() && window.katex)
|
|
11487
11567
|
try {
|
|
@@ -11497,28 +11577,28 @@ const qc = [
|
|
|
11497
11577
|
else
|
|
11498
11578
|
x(""), R(!1);
|
|
11499
11579
|
}, [f, h]);
|
|
11500
|
-
const
|
|
11580
|
+
const U = (k) => {
|
|
11501
11581
|
C(k), k === "chem" && m("keyboard");
|
|
11502
11582
|
}, A = Ce(() => {
|
|
11503
11583
|
var k;
|
|
11504
11584
|
(k = s.current) == null || k.clear(), p(""), d(null), u(!1);
|
|
11505
11585
|
}, []), P = Ce((k) => {
|
|
11506
|
-
const
|
|
11507
|
-
if (!
|
|
11586
|
+
const b = l.current;
|
|
11587
|
+
if (!b) {
|
|
11508
11588
|
p((H) => H + k);
|
|
11509
11589
|
return;
|
|
11510
11590
|
}
|
|
11511
|
-
const q =
|
|
11591
|
+
const q = b.selectionStart, w = b.selectionEnd, G = f.substring(0, q) + k + f.substring(w);
|
|
11512
11592
|
p(G), setTimeout(() => {
|
|
11513
|
-
|
|
11593
|
+
b.focus(), b.selectionStart = b.selectionEnd = q + k.length;
|
|
11514
11594
|
}, 0);
|
|
11515
11595
|
}, [f]), L = Ce(async () => {
|
|
11516
|
-
var
|
|
11596
|
+
var b, q;
|
|
11517
11597
|
if (!o) {
|
|
11518
11598
|
d("Please configure your Gemini API key in the main editor.");
|
|
11519
11599
|
return;
|
|
11520
11600
|
}
|
|
11521
|
-
const k = (
|
|
11601
|
+
const k = (b = s.current) == null ? void 0 : b.getTrimmedImageData();
|
|
11522
11602
|
if (!k) {
|
|
11523
11603
|
d("Draw a formula on the pad first.");
|
|
11524
11604
|
return;
|
|
@@ -11538,16 +11618,16 @@ const qc = [
|
|
|
11538
11618
|
/* @__PURE__ */ N("div", { className: "flex items-center gap-6", children: [
|
|
11539
11619
|
/* @__PURE__ */ g("h2", { className: "text-lg font-bold text-slate-900", children: "AI Formula Pad" }),
|
|
11540
11620
|
/* @__PURE__ */ N("div", { className: "flex bg-slate-200 p-1 rounded-lg", children: [
|
|
11541
|
-
/* @__PURE__ */ g("button", { onClick: () =>
|
|
11542
|
-
/* @__PURE__ */ g("button", { onClick: () =>
|
|
11621
|
+
/* @__PURE__ */ g("button", { onClick: () => U("math"), className: `px-4 py-1 text-xs font-semibold rounded-md transition-all ${y === "math" ? "bg-white shadow text-blue-600" : "text-slate-500"}`, children: "Math" }),
|
|
11622
|
+
/* @__PURE__ */ g("button", { onClick: () => U("chem"), className: `px-4 py-1 text-xs font-semibold rounded-md transition-all ${y === "chem" ? "bg-white shadow text-blue-600" : "text-slate-500"}`, children: "Chemistry" })
|
|
11543
11623
|
] })
|
|
11544
11624
|
] }),
|
|
11545
|
-
/* @__PURE__ */ g("button", { onClick: e, className: "p-2 hover:bg-slate-200 rounded-full text-slate-400 hover:text-slate-600 transition-colors", children: /* @__PURE__ */ g(
|
|
11625
|
+
/* @__PURE__ */ g("button", { title: "Close", onClick: e, className: "p-2 hover:bg-slate-200 rounded-full text-slate-400 hover:text-slate-600 transition-colors", children: /* @__PURE__ */ g(jc, { size: 20 }) })
|
|
11546
11626
|
] }),
|
|
11547
11627
|
/* @__PURE__ */ N("div", { className: "flex-1 flex overflow-hidden", children: [
|
|
11548
11628
|
/* @__PURE__ */ N("div", { className: "w-16 border-r border-slate-100 flex flex-col items-center py-6 gap-4 bg-slate-50/30", children: [
|
|
11549
|
-
/* @__PURE__ */ g("button", { onClick: () => m("keyboard"), className: `p-3 rounded-xl transition-all ${h === "keyboard" ? "bg-blue-600 text-white shadow-lg" : "text-slate-400 hover:text-slate-600"}`, children: /* @__PURE__ */ g(
|
|
11550
|
-
y === "math" && /* @__PURE__ */ g("button", { onClick: () => m("handwriting"), className: `p-3 rounded-xl transition-all ${h === "handwriting" ? "bg-blue-600 text-white shadow-lg" : "text-slate-400 hover:text-slate-600"}`, children: /* @__PURE__ */ g(
|
|
11629
|
+
/* @__PURE__ */ g("button", { onClick: () => m("keyboard"), className: `p-3 rounded-xl transition-all ${h === "keyboard" ? "bg-blue-600 text-white shadow-lg" : "text-slate-400 hover:text-slate-600"}`, children: /* @__PURE__ */ g(Dc, { size: 24 }) }),
|
|
11630
|
+
y === "math" && /* @__PURE__ */ g("button", { onClick: () => m("handwriting"), className: `p-3 rounded-xl transition-all ${h === "handwriting" ? "bg-blue-600 text-white shadow-lg" : "text-slate-400 hover:text-slate-600"}`, children: /* @__PURE__ */ g(Jc, { size: 24 }) })
|
|
11551
11631
|
] }),
|
|
11552
11632
|
/* @__PURE__ */ N("div", { className: "flex-1 flex flex-col overflow-hidden", children: [
|
|
11553
11633
|
/* @__PURE__ */ g("div", { className: "shrink-0", children: h === "keyboard" && (y === "math" ? /* @__PURE__ */ g(Tc, { onInsert: P }) : /* @__PURE__ */ g(vc, { onInsert: P })) }),
|
|
@@ -11571,12 +11651,12 @@ const qc = [
|
|
|
11571
11651
|
/* @__PURE__ */ g("button", { onClick: () => {
|
|
11572
11652
|
var k;
|
|
11573
11653
|
return (k = s.current) == null ? void 0 : k.undo();
|
|
11574
|
-
}, disabled: !T, className: "p-2 bg-white border border-slate-200 rounded-lg shadow-sm disabled:opacity-30 hover:bg-slate-50", children: /* @__PURE__ */ g(
|
|
11654
|
+
}, disabled: !T, className: "p-2 bg-white border border-slate-200 rounded-lg shadow-sm disabled:opacity-30 hover:bg-slate-50", children: /* @__PURE__ */ g(Wc, { size: 18 }) }),
|
|
11575
11655
|
/* @__PURE__ */ g("button", { onClick: () => {
|
|
11576
11656
|
var k;
|
|
11577
11657
|
return (k = s.current) == null ? void 0 : k.redo();
|
|
11578
|
-
}, disabled: !_, className: "p-2 bg-white border border-slate-200 rounded-lg shadow-sm disabled:opacity-30 hover:bg-slate-50", children: /* @__PURE__ */ g(
|
|
11579
|
-
/* @__PURE__ */ g("button", { onClick: A, className: "p-2 bg-white border border-slate-200 rounded-lg shadow-sm text-red-500 hover:bg-red-50", children: /* @__PURE__ */ g(
|
|
11658
|
+
}, disabled: !_, className: "p-2 bg-white border border-slate-200 rounded-lg shadow-sm disabled:opacity-30 hover:bg-slate-50", children: /* @__PURE__ */ g(Kc, { size: 18 }) }),
|
|
11659
|
+
/* @__PURE__ */ g("button", { onClick: A, className: "p-2 bg-white border border-slate-200 rounded-lg shadow-sm text-red-500 hover:bg-red-50", children: /* @__PURE__ */ g(Qc, { size: 18 }) })
|
|
11580
11660
|
] }),
|
|
11581
11661
|
/* @__PURE__ */ g("div", { className: "absolute bottom-6 left-1/2 -translate-x-1/2 flex gap-4", children: /* @__PURE__ */ N(
|
|
11582
11662
|
"button",
|
|
@@ -11585,7 +11665,7 @@ const qc = [
|
|
|
11585
11665
|
disabled: a,
|
|
11586
11666
|
className: "px-8 py-2.5 bg-blue-600 text-white rounded-full font-bold shadow-xl hover:bg-blue-700 transition flex items-center gap-2 disabled:bg-slate-400",
|
|
11587
11667
|
children: [
|
|
11588
|
-
a ? /* @__PURE__ */ g(
|
|
11668
|
+
a ? /* @__PURE__ */ g(Vc, { className: "animate-spin", size: 18 }) : null,
|
|
11589
11669
|
a ? "Processing..." : "Recognize Drawing"
|
|
11590
11670
|
]
|
|
11591
11671
|
}
|
|
@@ -11611,7 +11691,7 @@ const qc = [
|
|
|
11611
11691
|
] })
|
|
11612
11692
|
] })
|
|
11613
11693
|
] }) }) : null;
|
|
11614
|
-
},
|
|
11694
|
+
}, tf = ({ isOpen: t, onClose: e, onInsert: n }) => {
|
|
11615
11695
|
const [o, s] = V(3), [l, a] = V(3);
|
|
11616
11696
|
return t ? /* @__PURE__ */ g("div", { className: "fixed inset-0 z-[60] flex items-center justify-center bg-black bg-opacity-50 backdrop-blur-sm", onClick: e, children: /* @__PURE__ */ N("div", { className: "bg-white rounded-lg shadow-xl p-6 w-full max-w-sm", onClick: (c) => c.stopPropagation(), children: [
|
|
11617
11697
|
/* @__PURE__ */ g("h3", { className: "text-lg font-semibold text-gray-800 mb-4", children: "Insert Table" }),
|
|
@@ -11644,13 +11724,13 @@ const qc = [
|
|
|
11644
11724
|
] })
|
|
11645
11725
|
] }),
|
|
11646
11726
|
/* @__PURE__ */ N("div", { className: "mt-6 flex justify-end space-x-3", children: [
|
|
11647
|
-
/* @__PURE__ */ g("button", { onClick: e, className: "px-4 py-2 bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition", children: "Cancel" }),
|
|
11727
|
+
/* @__PURE__ */ g("button", { title: "Cancel and discard", onClick: e, className: "px-4 py-2 bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition", children: "Cancel" }),
|
|
11648
11728
|
/* @__PURE__ */ g("button", { onClick: () => {
|
|
11649
11729
|
o > 0 && l > 0 && n(o, l);
|
|
11650
11730
|
}, className: "px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition", children: "Insert" })
|
|
11651
11731
|
] })
|
|
11652
11732
|
] }) }) : null;
|
|
11653
|
-
},
|
|
11733
|
+
}, nf = ({
|
|
11654
11734
|
onOpenHandwritingModal: t,
|
|
11655
11735
|
onApplyStyle: e,
|
|
11656
11736
|
onUndo: n,
|
|
@@ -11659,7 +11739,7 @@ const qc = [
|
|
|
11659
11739
|
canRedo: l,
|
|
11660
11740
|
apiKey: a
|
|
11661
11741
|
}) => {
|
|
11662
|
-
const [u, c] = V(!1), [d, f] = V(!1), [p, h] = V(7), m =
|
|
11742
|
+
const [u, c] = V(!1), [d, f] = V(!1), [p, h] = V(7), m = j(null), y = j([]), C = j(null), [T, E] = V(!1);
|
|
11663
11743
|
pe(() => {
|
|
11664
11744
|
a !== "" && a && E(!0);
|
|
11665
11745
|
}, [a]);
|
|
@@ -11676,13 +11756,13 @@ const qc = [
|
|
|
11676
11756
|
const w = m.current;
|
|
11677
11757
|
if (!w) return;
|
|
11678
11758
|
const G = new ResizeObserver((H) => {
|
|
11679
|
-
const
|
|
11759
|
+
const se = H[0].contentRect.width - 50;
|
|
11680
11760
|
let ye = 0, yt = 0;
|
|
11681
11761
|
for (let Je = 0; Je < y.current.length; Je++) {
|
|
11682
11762
|
const Tt = y.current[Je];
|
|
11683
11763
|
if (Tt) {
|
|
11684
11764
|
const _t = Tt.getBoundingClientRect().width + 8;
|
|
11685
|
-
if (ye + _t <=
|
|
11765
|
+
if (ye + _t <= se)
|
|
11686
11766
|
ye += _t, yt++;
|
|
11687
11767
|
else
|
|
11688
11768
|
break;
|
|
@@ -11696,61 +11776,58 @@ const qc = [
|
|
|
11696
11776
|
var H;
|
|
11697
11777
|
const G = (H = w.target.files) == null ? void 0 : H[0];
|
|
11698
11778
|
if (G) {
|
|
11699
|
-
const
|
|
11700
|
-
|
|
11779
|
+
const K = new FileReader();
|
|
11780
|
+
K.onload = (se) => {
|
|
11701
11781
|
var ye;
|
|
11702
|
-
return e("insertImage", (ye =
|
|
11703
|
-
},
|
|
11782
|
+
return e("insertImage", (ye = se.target) == null ? void 0 : ye.result);
|
|
11783
|
+
}, K.readAsDataURL(G);
|
|
11704
11784
|
}
|
|
11705
11785
|
w.target.value = "";
|
|
11706
11786
|
}, I = (w, G) => {
|
|
11707
11787
|
let H = '<table style="width:100%; border-collapse: collapse; border: 1px solid black;"><tbody>';
|
|
11708
|
-
for (let
|
|
11788
|
+
for (let K = 0; K < w; K++) {
|
|
11709
11789
|
H += "<tr>";
|
|
11710
|
-
for (let
|
|
11790
|
+
for (let se = 0; se < G; se++) H += '<td style="border: 1px solid black; padding: 5px;"><p><br></p></td>';
|
|
11711
11791
|
H += "</tr>";
|
|
11712
11792
|
}
|
|
11713
11793
|
H += "</tbody></table><p><br></p>", e("insertHTML", H), c(!1);
|
|
11714
11794
|
}, x = () => /* @__PURE__ */ N("div", { ref: (w) => y.current[0] = w, className: "flex items-center gap-2 shrink-0", children: [
|
|
11715
|
-
/* @__PURE__ */ N("select", { onChange: (w) => e("fontName", w.target.value), defaultValue: "Arial", className: "bg-white border border-gray-300 rounded px-2 py-1 text-xs text-black outline-none focus:ring-1 focus:ring-blue-500 min-w-[80px]", children: [
|
|
11795
|
+
/* @__PURE__ */ N("select", { title: "Font Family", onChange: (w) => e("fontName", w.target.value), defaultValue: "Arial", className: "bg-white border border-gray-300 rounded px-2 py-1 text-xs text-black outline-none focus:ring-1 focus:ring-blue-500 min-w-[80px]", children: [
|
|
11716
11796
|
/* @__PURE__ */ g("option", { value: "Arial", children: "Arial" }),
|
|
11717
11797
|
/* @__PURE__ */ g("option", { value: "Verdana", children: "Verdana" }),
|
|
11718
11798
|
/* @__PURE__ */ g("option", { value: "Georgia", children: "Georgia" })
|
|
11719
11799
|
] }),
|
|
11720
|
-
/* @__PURE__ */ N("select", { onChange: (w) => e("fontSize", w.target.value), defaultValue: "3", className: "bg-white border border-gray-300 rounded px-2 py-1 text-xs text-black outline-none focus:ring-1 focus:ring-blue-500", children: [
|
|
11800
|
+
/* @__PURE__ */ N("select", { title: "Font Size", onChange: (w) => e("fontSize", w.target.value), defaultValue: "3", className: "bg-white border border-gray-300 rounded px-2 py-1 text-xs text-black outline-none focus:ring-1 focus:ring-blue-500", children: [
|
|
11721
11801
|
/* @__PURE__ */ g("option", { value: "1", children: "S" }),
|
|
11722
11802
|
/* @__PURE__ */ g("option", { value: "3", children: "M" }),
|
|
11723
11803
|
/* @__PURE__ */ g("option", { value: "5", children: "L" })
|
|
11724
11804
|
] })
|
|
11725
11805
|
] }), M = () => /* @__PURE__ */ N("div", { ref: (w) => y.current[1] = w, className: "flex bg-white border border-gray-300 rounded overflow-hidden shrink-0", children: [
|
|
11726
|
-
/* @__PURE__ */ g("button", { onClick: n, disabled: !s, className: "p-1.5 hover:bg-gray-100 disabled:opacity-30 border-r border-gray-200", children: /* @__PURE__ */ g("svg", { className: "w-4 h-4 text-black", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ g("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M10 19l-7-7m0 0l7-7m-7 7h18" }) }) }),
|
|
11727
|
-
/* @__PURE__ */ g("button", { onClick: o, disabled: !l, className: "p-1.5 hover:bg-gray-100 disabled:opacity-30", children: /* @__PURE__ */ g("svg", { className: "w-4 h-4 text-black", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ g("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M14 5l7 7m0 0l-7 7m7-7H3" }) }) })
|
|
11806
|
+
/* @__PURE__ */ g("button", { title: "Undo", onClick: n, disabled: !s, className: "p-1.5 hover:bg-gray-100 disabled:opacity-30 border-r border-gray-200", children: /* @__PURE__ */ g("svg", { className: "w-4 h-4 text-black", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ g("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M10 19l-7-7m0 0l7-7m-7 7h18" }) }) }),
|
|
11807
|
+
/* @__PURE__ */ g("button", { title: "Redo", onClick: o, disabled: !l, className: "p-1.5 hover:bg-gray-100 disabled:opacity-30", children: /* @__PURE__ */ g("svg", { className: "w-4 h-4 text-black", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ g("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M14 5l7 7m0 0l-7 7m7-7H3" }) }) })
|
|
11728
11808
|
] }), R = () => /* @__PURE__ */ N("div", { ref: (w) => y.current[2] = w, className: "flex bg-white border border-gray-300 rounded overflow-hidden shrink-0", children: [
|
|
11729
|
-
/* @__PURE__ */ g("button", { onClick: () => e("bold"), className: "p-1.5 hover:bg-gray-100 border-r border-gray-200", children: /* @__PURE__ */ g("b", { className: "text-black", children: "B" }) }),
|
|
11730
|
-
/* @__PURE__ */ g("button", { onClick: () => e("italic"), className: "p-1.5 hover:bg-gray-100 border-r border-gray-200", children: /* @__PURE__ */ g("i", { className: "text-black", children: "I" }) }),
|
|
11731
|
-
/* @__PURE__ */ g("button", { onClick: () => e("underline"), className: "p-1.5 hover:bg-gray-100", children: /* @__PURE__ */ g("u", { className: "text-black", children: "U" }) })
|
|
11732
|
-
] }),
|
|
11809
|
+
/* @__PURE__ */ g("button", { title: "Bold", onClick: () => e("bold"), className: "p-1.5 hover:bg-gray-100 border-r border-gray-200", children: /* @__PURE__ */ g("b", { className: "text-black", children: "B" }) }),
|
|
11810
|
+
/* @__PURE__ */ g("button", { title: "Italic", onClick: () => e("italic"), className: "p-1.5 hover:bg-gray-100 border-r border-gray-200", children: /* @__PURE__ */ g("i", { className: "text-black", children: "I" }) }),
|
|
11811
|
+
/* @__PURE__ */ g("button", { title: "Underline", onClick: () => e("underline"), className: "p-1.5 hover:bg-gray-100", children: /* @__PURE__ */ g("u", { className: "text-black", children: "U" }) })
|
|
11812
|
+
] }), U = () => /* @__PURE__ */ N("div", { ref: (w) => y.current[3] = w, className: "flex bg-white border border-gray-300 rounded overflow-hidden shrink-0", children: [
|
|
11733
11813
|
/* @__PURE__ */ N("label", { className: "p-1.5 hover:bg-gray-100 border-r border-gray-200 cursor-pointer relative", children: [
|
|
11734
|
-
/* @__PURE__ */ g(
|
|
11814
|
+
/* @__PURE__ */ g(Hc, { size: 18, className: "text-slate-600" }),
|
|
11735
11815
|
/* @__PURE__ */ g("input", { type: "color", onInput: (w) => e("foreColor", w.target.value), className: "opacity-0 absolute inset-0 cursor-pointer" })
|
|
11736
11816
|
] }),
|
|
11737
11817
|
/* @__PURE__ */ N("label", { className: "p-1.5 hover:bg-gray-100 cursor-pointer relative", children: [
|
|
11738
|
-
/* @__PURE__ */ g(
|
|
11818
|
+
/* @__PURE__ */ g(Nc, { size: 18, className: "text-slate-600" }),
|
|
11739
11819
|
/* @__PURE__ */ g("input", { type: "color", onInput: (w) => e("backColor", w.target.value), className: "opacity-0 absolute inset-0 cursor-pointer" })
|
|
11740
11820
|
] })
|
|
11741
11821
|
] }), A = () => /* @__PURE__ */ N("div", { ref: (w) => y.current[4] = w, className: "flex bg-white border border-gray-300 rounded overflow-hidden shrink-0", children: [
|
|
11742
|
-
/* @__PURE__ */ g("button", { onClick: () => e("insertOrderedList"), className: "p-1.5 hover:bg-gray-100 border-r border-gray-200", children: /* @__PURE__ */ g(
|
|
11743
|
-
/* @__PURE__ */ g("button", { onClick: () => e("insertUnorderedList"), className: "p-1.5 hover:bg-gray-100", children: /* @__PURE__ */
|
|
11744
|
-
/* @__PURE__ */ g("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M4 6h16M4 12h16M4 18h16" }),
|
|
11745
|
-
/* @__PURE__ */ g("circle", { cx: "2", cy: "6", r: "1" })
|
|
11746
|
-
] }) })
|
|
11822
|
+
/* @__PURE__ */ g("button", { title: "Ordered List", onClick: () => e("insertOrderedList"), className: "p-1.5 hover:bg-gray-100 border-r border-gray-200", children: /* @__PURE__ */ g(bc, { size: 18 }) }),
|
|
11823
|
+
/* @__PURE__ */ g("button", { title: "Unordered List", onClick: () => e("insertUnorderedList"), className: "p-1.5 hover:bg-gray-100", children: /* @__PURE__ */ g(Fc, { size: 18 }) })
|
|
11747
11824
|
] }), P = () => /* @__PURE__ */ N("div", { ref: (w) => y.current[5] = w, className: "flex bg-white border border-gray-300 rounded overflow-hidden shrink-0", children: [
|
|
11748
|
-
/* @__PURE__ */ g("button", { onClick: () => {
|
|
11825
|
+
/* @__PURE__ */ g("button", { title: "Upload Image", onClick: () => {
|
|
11749
11826
|
var w;
|
|
11750
11827
|
return (w = C.current) == null ? void 0 : w.click();
|
|
11751
|
-
}, className: "p-1.5 hover:bg-gray-100 border-r border-gray-200", children: /* @__PURE__ */ g(
|
|
11752
|
-
/* @__PURE__ */ g("button", { onClick: () => c(!0), className: "p-1.5 hover:bg-gray-100", children: /* @__PURE__ */ g(
|
|
11753
|
-
] }), L = () => /* @__PURE__ */ g("div", { ref: (w) => y.current[6] = w, className: "shrink-0", children: /* @__PURE__ */ g("button", { onClick: t, className: "p-2 bg-blue-50 border border-blue-200 hover:bg-blue-100 text-blue-700 rounded flex items-center transition-colors shadow-sm", children: /* @__PURE__ */ N("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
11828
|
+
}, className: "p-1.5 hover:bg-gray-100 border-r border-gray-200", children: /* @__PURE__ */ g(Pc, { size: 18 }) }),
|
|
11829
|
+
/* @__PURE__ */ g("button", { title: "Insert Table", onClick: () => c(!0), className: "p-1.5 hover:bg-gray-100", children: /* @__PURE__ */ g(Oc, { size: 18 }) })
|
|
11830
|
+
] }), L = () => /* @__PURE__ */ g("div", { ref: (w) => y.current[6] = w, className: "shrink-0", children: /* @__PURE__ */ g("button", { title: "Handwriting Math Pad", onClick: t, className: "p-2 bg-blue-50 border border-blue-200 hover:bg-blue-100 text-blue-700 rounded flex items-center transition-colors shadow-sm", children: /* @__PURE__ */ N("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
11754
11831
|
/* @__PURE__ */ g("path", { d: "M3 12h2l4 8 4-16h6" }),
|
|
11755
11832
|
/* @__PURE__ */ g("path", { d: "m17 8 4 4" }),
|
|
11756
11833
|
/* @__PURE__ */ g("path", { d: "m21 8-4 4" })
|
|
@@ -11763,7 +11840,7 @@ const qc = [
|
|
|
11763
11840
|
case "formatting":
|
|
11764
11841
|
return /* @__PURE__ */ g(R, {}, "formatting");
|
|
11765
11842
|
case "colors":
|
|
11766
|
-
return /* @__PURE__ */ g(
|
|
11843
|
+
return /* @__PURE__ */ g(U, {}, "colors");
|
|
11767
11844
|
case "lists":
|
|
11768
11845
|
return /* @__PURE__ */ g(A, {}, "lists");
|
|
11769
11846
|
case "media":
|
|
@@ -11773,23 +11850,24 @@ const qc = [
|
|
|
11773
11850
|
default:
|
|
11774
11851
|
return null;
|
|
11775
11852
|
}
|
|
11776
|
-
},
|
|
11853
|
+
}, b = _.slice(0, p), q = _.slice(p);
|
|
11777
11854
|
return /* @__PURE__ */ N("div", { className: "relative", children: [
|
|
11778
11855
|
/* @__PURE__ */ N("div", { ref: m, className: "bg-gray-50 p-2 flex items-center gap-3 border-b border-gray-200 rounded-t-lg flex-nowrap overflow-visible", children: [
|
|
11779
11856
|
/* @__PURE__ */ N("div", { className: "absolute top-0 left-0 invisible pointer-events-none flex gap-3 whitespace-nowrap overflow-hidden", children: [
|
|
11780
11857
|
/* @__PURE__ */ g(x, {}),
|
|
11781
11858
|
/* @__PURE__ */ g(M, {}),
|
|
11782
11859
|
/* @__PURE__ */ g(R, {}),
|
|
11783
|
-
/* @__PURE__ */ g(
|
|
11860
|
+
/* @__PURE__ */ g(U, {}),
|
|
11784
11861
|
/* @__PURE__ */ g(A, {}),
|
|
11785
11862
|
/* @__PURE__ */ g(P, {}),
|
|
11786
11863
|
T && /* @__PURE__ */ g(L, {})
|
|
11787
11864
|
] }),
|
|
11788
|
-
/* @__PURE__ */ g("div", { className: "flex items-center gap-3 flex-nowrap overflow-hidden", children:
|
|
11865
|
+
/* @__PURE__ */ g("div", { className: "flex items-center gap-3 flex-nowrap overflow-hidden", children: b.map((w) => k(w.id)) }),
|
|
11789
11866
|
q.length > 0 && /* @__PURE__ */ N("div", { className: "ml-auto relative shrink-0", children: [
|
|
11790
11867
|
/* @__PURE__ */ g(
|
|
11791
11868
|
"button",
|
|
11792
11869
|
{
|
|
11870
|
+
title: "More Tools",
|
|
11793
11871
|
onClick: () => f(!d),
|
|
11794
11872
|
className: `p-1.5 rounded hover:bg-gray-200 transition-colors ${d ? "bg-gray-200" : ""}`,
|
|
11795
11873
|
children: /* @__PURE__ */ g("svg", { className: "w-5 h-5 text-gray-600", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ g("path", { d: "M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM18 10a2 2 0 11-4 0 2 2 0 014 0z" }) })
|
|
@@ -11802,11 +11880,11 @@ const qc = [
|
|
|
11802
11880
|
] })
|
|
11803
11881
|
] }),
|
|
11804
11882
|
/* @__PURE__ */ g("input", { type: "file", ref: C, onChange: v, accept: "image/*", className: "hidden" }),
|
|
11805
|
-
/* @__PURE__ */ g(
|
|
11883
|
+
/* @__PURE__ */ g(tf, { isOpen: u, onClose: () => c(!1), onInsert: I }),
|
|
11806
11884
|
d && /* @__PURE__ */ g("div", { className: "fixed inset-0 z-[90]", onClick: () => f(!1) })
|
|
11807
11885
|
] });
|
|
11808
|
-
},
|
|
11809
|
-
const s =
|
|
11886
|
+
}, of = be(({ initialContent: t = "", onChange: e, apiKey: n }, o) => {
|
|
11887
|
+
const s = j(null), [l, a] = V(!1), [u, c] = V([t]), [d, f] = V(0), p = d > 0, h = d < u.length - 1, m = Ce((E) => {
|
|
11810
11888
|
if (E === u[d]) return;
|
|
11811
11889
|
const _ = u.slice(0, d + 1);
|
|
11812
11890
|
_.push(E), _.length > 50 && _.shift(), c(_), f(_.length - 1), e == null || e(E);
|
|
@@ -11823,7 +11901,7 @@ const qc = [
|
|
|
11823
11901
|
s.current && t && !s.current.innerHTML && (s.current.innerHTML = t);
|
|
11824
11902
|
}, [t]), /* @__PURE__ */ N("div", { className: "w-full max-w-5xl bg-white shadow-xl border border-slate-200 flex flex-col transition-all duration-300", children: [
|
|
11825
11903
|
/* @__PURE__ */ g("div", { className: "relative z-20", children: /* @__PURE__ */ g(
|
|
11826
|
-
|
|
11904
|
+
nf,
|
|
11827
11905
|
{
|
|
11828
11906
|
onApplyStyle: (E, _) => {
|
|
11829
11907
|
var v, I;
|
|
@@ -11861,7 +11939,7 @@ const qc = [
|
|
|
11861
11939
|
}
|
|
11862
11940
|
),
|
|
11863
11941
|
l && /* @__PURE__ */ g(
|
|
11864
|
-
|
|
11942
|
+
ef,
|
|
11865
11943
|
{
|
|
11866
11944
|
isOpen: l,
|
|
11867
11945
|
onClose: () => a(!1),
|
|
@@ -11874,7 +11952,7 @@ const qc = [
|
|
|
11874
11952
|
)
|
|
11875
11953
|
] });
|
|
11876
11954
|
});
|
|
11877
|
-
|
|
11955
|
+
of.displayName = "Editor";
|
|
11878
11956
|
export {
|
|
11879
|
-
|
|
11957
|
+
of as Editor
|
|
11880
11958
|
};
|